From 09e42bcb10cf056213b1101648befa7d49d05e98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Sat, 9 Jun 2018 15:44:32 -0700 Subject: [PATCH 1/9] Add code to `invalid ABI` error --- src/libsyntax/diagnostic_list.rs | 1 + src/libsyntax/parse/parser.rs | 13 ++++++++----- src/test/ui/codemap_tests/unicode.stderr | 7 +++++-- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/src/libsyntax/diagnostic_list.rs b/src/libsyntax/diagnostic_list.rs index ab8317bfa027e..b6748c40fc432 100644 --- a/src/libsyntax/diagnostic_list.rs +++ b/src/libsyntax/diagnostic_list.rs @@ -397,4 +397,5 @@ register_diagnostics! { E0630, // rustc_const_unstable attribute must be paired with stable/unstable attribute E0693, // incorrect `repr(align)` attribute format E0694, // an unknown tool name found in scoped attributes + E0697, // invalid ABI } diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 1735951da2f34..f38f4cc713735 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -6535,12 +6535,15 @@ impl<'a> Parser<'a> { Some(abi) => Ok(Some(abi)), None => { let prev_span = self.prev_span; - self.span_err( + let mut err = struct_span_err!( + self.sess.span_diagnostic, prev_span, - &format!("invalid ABI: expected one of [{}], \ - found `{}`", - abi::all_names().join(", "), - s)); + E0697, + "invalid ABI: found `{}`", + s); + err.span_label(prev_span, "invalid ABI"); + err.help(&format!("valid ABIs: {}", abi::all_names().join(", "))); + err.emit(); Ok(None) } } diff --git a/src/test/ui/codemap_tests/unicode.stderr b/src/test/ui/codemap_tests/unicode.stderr index b9b03c9b9ec62..d2e79a0b47d3f 100644 --- a/src/test/ui/codemap_tests/unicode.stderr +++ b/src/test/ui/codemap_tests/unicode.stderr @@ -1,8 +1,11 @@ -error: invalid ABI: expected one of [cdecl, stdcall, fastcall, vectorcall, thiscall, aapcs, win64, sysv64, ptx-kernel, msp430-interrupt, x86-interrupt, Rust, C, system, rust-intrinsic, rust-call, platform-intrinsic, unadjusted], found `路濫狼á́́` +error[E0697]: invalid ABI: found `路濫狼á́́` --> $DIR/unicode.rs:11:8 | LL | extern "路濫狼á́́" fn foo() {} //~ ERROR invalid ABI - | ^^^^^^^^^ + | ^^^^^^^^^ invalid ABI + | + = help: valid ABIs: cdecl, stdcall, fastcall, vectorcall, thiscall, aapcs, win64, sysv64, ptx-kernel, msp430-interrupt, x86-interrupt, Rust, C, system, rust-intrinsic, rust-call, platform-intrinsic, unadjusted error: aborting due to previous error +For more information about this error, try `rustc --explain E0697`. From b3a1d56ebe34276916f34ffb0fed34d406f73c55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Sat, 9 Jun 2018 16:08:47 -0700 Subject: [PATCH 2/9] Add code to incorrect `pub` restriction error --- src/libsyntax/diagnostic_list.rs | 1 + src/libsyntax/parse/parser.rs | 7 ++++--- src/test/ui/pub/pub-restricted.stderr | 9 +++++---- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/libsyntax/diagnostic_list.rs b/src/libsyntax/diagnostic_list.rs index b6748c40fc432..2031885475852 100644 --- a/src/libsyntax/diagnostic_list.rs +++ b/src/libsyntax/diagnostic_list.rs @@ -398,4 +398,5 @@ register_diagnostics! { E0693, // incorrect `repr(align)` attribute format E0694, // an unknown tool name found in scoped attributes E0697, // invalid ABI + E0698, // incorrect visibility restriction } diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index f38f4cc713735..afb0931f9504d 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -5986,12 +5986,13 @@ impl<'a> Parser<'a> { `pub(super)`: visible only in the current module's parent `pub(in path::to::module)`: visible only on the specified path"##; let path = self.parse_path(PathStyle::Mod)?; - let path_span = self.prev_span; + let sp = self.prev_span; let help_msg = format!("make this visible only to module `{}` with `in`", path); self.expect(&token::CloseDelim(token::Paren))?; // `)` - let mut err = self.span_fatal_help(path_span, msg, suggestion); + let mut err = struct_span_err!(self.sess.span_diagnostic, sp, E0698, "{}", msg); + err.help(suggestion); err.span_suggestion_with_applicability( - path_span, &help_msg, format!("in {}", path), Applicability::MachineApplicable + sp, &help_msg, format!("in {}", path), Applicability::MachineApplicable ); err.emit(); // emit diagnostic, but continue with public visibility } diff --git a/src/test/ui/pub/pub-restricted.stderr b/src/test/ui/pub/pub-restricted.stderr index 7005088965df1..114732c39f2cc 100644 --- a/src/test/ui/pub/pub-restricted.stderr +++ b/src/test/ui/pub/pub-restricted.stderr @@ -1,4 +1,4 @@ -error: incorrect visibility restriction +error[E0698]: incorrect visibility restriction --> $DIR/pub-restricted.rs:15:6 | LL | pub (a) fn afn() {} //~ incorrect visibility restriction @@ -9,7 +9,7 @@ LL | pub (a) fn afn() {} //~ incorrect visibility restriction `pub(super)`: visible only in the current module's parent `pub(in path::to::module)`: visible only on the specified path -error: incorrect visibility restriction +error[E0698]: incorrect visibility restriction --> $DIR/pub-restricted.rs:16:6 | LL | pub (b) fn bfn() {} //~ incorrect visibility restriction @@ -20,7 +20,7 @@ LL | pub (b) fn bfn() {} //~ incorrect visibility restriction `pub(super)`: visible only in the current module's parent `pub(in path::to::module)`: visible only on the specified path -error: incorrect visibility restriction +error[E0698]: incorrect visibility restriction --> $DIR/pub-restricted.rs:32:14 | LL | pub (a) invalid: usize, //~ incorrect visibility restriction @@ -31,7 +31,7 @@ LL | pub (a) invalid: usize, //~ incorrect visibility restriction `pub(super)`: visible only in the current module's parent `pub(in path::to::module)`: visible only on the specified path -error: incorrect visibility restriction +error[E0698]: incorrect visibility restriction --> $DIR/pub-restricted.rs:41:6 | LL | pub (xyz) fn xyz() {} //~ incorrect visibility restriction @@ -50,3 +50,4 @@ LL | pub (in x) non_parent_invalid: usize, //~ ERROR visibilities can on error: aborting due to 5 previous errors +For more information about this error, try `rustc --explain E0698`. From 776544f011a6a5beccb7923a261b0dcecdd2396a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Sat, 9 Jun 2018 16:53:36 -0700 Subject: [PATCH 3/9] Add message to `rustc_on_unimplemented` attributes in core --- src/liballoc/vec.rs | 10 +- src/libcore/cmp.rs | 10 +- src/libcore/iter/traits.rs | 7 +- src/libcore/marker.rs | 10 +- src/libcore/ops/index.rs | 10 +- src/libstd/panic.rs | 15 ++- src/libsyntax/parse/parser.rs | 8 -- .../compile-fail/associated-types-unsized.rs | 2 +- .../compile-fail/bad-method-typaram-kind.rs | 2 +- src/test/compile-fail/bad-sized.rs | 4 +- .../builtin-superkinds-double-superkind.rs | 2 +- .../builtin-superkinds-in-metadata.rs | 2 +- .../compile-fail/builtin-superkinds-simple.rs | 2 +- .../builtin-superkinds-typaram-not-send.rs | 3 +- ...bounds-cant-promote-superkind-in-struct.rs | 2 +- src/test/compile-fail/dst-bad-assign-2.rs | 2 +- src/test/compile-fail/dst-bad-assign-3.rs | 2 +- src/test/compile-fail/dst-bad-assign.rs | 2 +- src/test/compile-fail/dst-bad-deep-2.rs | 2 +- src/test/compile-fail/dst-bad-deep.rs | 2 +- .../dst-object-from-unsized-type.rs | 8 +- .../compile-fail/dst-sized-trait-param.rs | 4 +- .../extern-types-not-sync-send.rs | 2 +- src/test/compile-fail/extern-types-unsized.rs | 8 +- src/test/compile-fail/issue-14366.rs | 2 +- src/test/compile-fail/issue-15756.rs | 2 +- src/test/compile-fail/issue-17651.rs | 2 +- src/test/compile-fail/issue-18107.rs | 2 +- src/test/compile-fail/issue-18919.rs | 2 +- src/test/compile-fail/issue-20005.rs | 2 +- src/test/compile-fail/issue-20433.rs | 2 +- src/test/compile-fail/issue-20605.rs | 2 +- src/test/compile-fail/issue-21763.rs | 2 +- src/test/compile-fail/issue-22874.rs | 2 +- src/test/compile-fail/issue-23281.rs | 2 +- src/test/compile-fail/issue-24446.rs | 2 +- src/test/compile-fail/issue-27060-2.rs | 2 +- src/test/compile-fail/issue-27078.rs | 2 +- src/test/compile-fail/issue-35988.rs | 2 +- src/test/compile-fail/issue-38954.rs | 2 +- src/test/compile-fail/issue-41229-ref-str.rs | 4 +- src/test/compile-fail/issue-42312.rs | 4 +- src/test/compile-fail/issue-5883.rs | 4 +- src/test/compile-fail/issue-7013.rs | 2 +- .../compile-fail/kindck-impl-type-params.rs | 8 +- src/test/compile-fail/kindck-nonsendable-1.rs | 2 +- src/test/compile-fail/kindck-send-object.rs | 3 +- src/test/compile-fail/kindck-send-object1.rs | 2 +- src/test/compile-fail/kindck-send-object2.rs | 3 +- src/test/compile-fail/kindck-send-owned.rs | 3 +- src/test/compile-fail/kindck-send-unsafe.rs | 2 +- src/test/compile-fail/no-send-res-ports.rs | 2 +- src/test/compile-fail/no_send-enum.rs | 2 +- src/test/compile-fail/no_send-rc.rs | 2 +- src/test/compile-fail/no_send-struct.rs | 2 +- src/test/compile-fail/not-panic-safe-2.rs | 4 +- src/test/compile-fail/not-panic-safe-3.rs | 4 +- src/test/compile-fail/not-panic-safe-4.rs | 4 +- src/test/compile-fail/not-panic-safe-6.rs | 4 +- src/test/compile-fail/not-panic-safe.rs | 3 +- src/test/compile-fail/range-1.rs | 2 +- src/test/compile-fail/range_traits-1.rs | 24 ++-- src/test/compile-fail/str-idx.rs | 2 +- src/test/compile-fail/str-mut-idx.rs | 6 +- src/test/compile-fail/substs-ppaux.rs | 4 +- .../trait-bounds-not-on-bare-trait.rs | 2 +- .../compile-fail/traits-negative-impls.rs | 14 +-- ...typeck-default-trait-impl-negation-send.rs | 2 +- src/test/compile-fail/union/union-unsized.rs | 6 +- src/test/compile-fail/unsized-bare-typaram.rs | 3 +- src/test/compile-fail/unsized-enum.rs | 2 +- .../unsized-inherent-impl-self-type.rs | 3 +- src/test/compile-fail/unsized-struct.rs | 4 +- .../unsized-trait-impl-self-type.rs | 3 +- .../unsized-trait-impl-trait-arg.rs | 2 +- src/test/compile-fail/unsized3.rs | 12 +- src/test/compile-fail/unsized5.rs | 18 ++- src/test/compile-fail/unsized6.rs | 39 ++++-- src/test/compile-fail/unsized7.rs | 2 +- src/test/ui/const-unsized.rs | 8 +- src/test/ui/const-unsized.stderr | 8 +- src/test/ui/error-codes/E0277-2.rs | 2 +- src/test/ui/error-codes/E0277-2.stderr | 2 +- src/test/ui/error-codes/E0277.rs | 2 +- src/test/ui/error-codes/E0277.stderr | 2 +- .../ui/feature-gate-trivial_bounds.stderr | 6 +- src/test/ui/generator/sized-yield.rs | 6 +- src/test/ui/generator/sized-yield.stderr | 11 +- src/test/ui/impl-trait/auto-trait-leak.rs | 2 +- src/test/ui/impl-trait/auto-trait-leak.stderr | 2 +- src/test/ui/impl-trait/auto-trait-leak2.rs | 4 +- .../ui/impl-trait/auto-trait-leak2.stderr | 4 +- .../interior-mutability.rs | 3 +- .../interior-mutability.stderr | 6 +- src/test/ui/mismatched_types/binops.rs | 4 +- src/test/ui/mismatched_types/binops.stderr | 12 +- src/test/ui/mismatched_types/cast-rfc0401.rs | 4 +- .../ui/mismatched_types/cast-rfc0401.stderr | 8 +- src/test/ui/partialeq_help.stderr | 4 +- src/test/ui/resolve/issue-5035-2.rs | 3 +- src/test/ui/resolve/issue-5035-2.stderr | 4 +- .../ui/suggestions/str-array-assignment.rs | 2 +- .../suggestions/str-array-assignment.stderr | 2 +- src/test/ui/trait-suggest-where-clause.rs | 8 +- src/test/ui/trait-suggest-where-clause.stderr | 8 +- src/test/ui/trivial-bounds-leak.stderr | 2 +- src/test/ui/type-check-defaults.rs | 14 +-- src/test/ui/type-check-defaults.stderr | 8 +- src/test/ui/union/union-sized-field.rs | 9 +- src/test/ui/union/union-sized-field.stderr | 16 +-- src/test/ui/unsized-enum2.rs | 57 +++++---- src/test/ui/unsized-enum2.stderr | 112 +++++++++--------- 112 files changed, 394 insertions(+), 318 deletions(-) diff --git a/src/liballoc/vec.rs b/src/liballoc/vec.rs index b5739e1a82553..752a6c966d51a 100644 --- a/src/liballoc/vec.rs +++ b/src/liballoc/vec.rs @@ -1693,7 +1693,10 @@ impl Hash for Vec { } #[stable(feature = "rust1", since = "1.0.0")] -#[rustc_on_unimplemented = "vector indices are of type `usize` or ranges of `usize`"] +#[rustc_on_unimplemented( + message="vector indices are of type `usize` or ranges of `usize`", + label="vector indices are of type `usize` or ranges of `usize`", +)] impl Index for Vec where I: ::core::slice::SliceIndex<[T]>, @@ -1707,7 +1710,10 @@ where } #[stable(feature = "rust1", since = "1.0.0")] -#[rustc_on_unimplemented = "vector indices are of type `usize` or ranges of `usize`"] +#[rustc_on_unimplemented( + message="vector indices are of type `usize` or ranges of `usize`", + label="vector indices are of type `usize` or ranges of `usize`", +)] impl IndexMut for Vec where I: ::core::slice::SliceIndex<[T]>, diff --git a/src/libcore/cmp.rs b/src/libcore/cmp.rs index 13e838773a587..3626a266ad5d3 100644 --- a/src/libcore/cmp.rs +++ b/src/libcore/cmp.rs @@ -108,7 +108,10 @@ use self::Ordering::*; #[stable(feature = "rust1", since = "1.0.0")] #[doc(alias = "==")] #[doc(alias = "!=")] -#[rustc_on_unimplemented = "can't compare `{Self}` with `{Rhs}`"] +#[rustc_on_unimplemented( + message="can't compare `{Self}` with `{Rhs}`", + label="no implementation for `{Self} == {Rhs}`", +)] pub trait PartialEq { /// This method tests for `self` and `other` values to be equal, and is used /// by `==`. @@ -611,7 +614,10 @@ impl PartialOrd for Ordering { #[doc(alias = "<")] #[doc(alias = "<=")] #[doc(alias = ">=")] -#[rustc_on_unimplemented = "can't compare `{Self}` with `{Rhs}`"] +#[rustc_on_unimplemented( + message="can't compare `{Self}` with `{Rhs}`", + label="no implementation for `{Self} < {Rhs}` and `{Self} > {Rhs}`", +)] pub trait PartialOrd: PartialEq { /// This method returns an ordering between `self` and `other` values if one exists. /// diff --git a/src/libcore/iter/traits.rs b/src/libcore/iter/traits.rs index 3d2ce9e6b104b..4b2c1aa551e99 100644 --- a/src/libcore/iter/traits.rs +++ b/src/libcore/iter/traits.rs @@ -104,8 +104,11 @@ use super::LoopState; /// assert_eq!(c.0, vec![0, 1, 2, 3, 4]); /// ``` #[stable(feature = "rust1", since = "1.0.0")] -#[rustc_on_unimplemented="a collection of type `{Self}` cannot be \ - built from an iterator over elements of type `{A}`"] +#[rustc_on_unimplemented( + message="a collection of type `{Self}` cannot be built from an iterator \ + over elements of type `{A}`", + label="a collection of type `{Self}` cannot be built from `std::iter::Iterator`", +)] pub trait FromIterator: Sized { /// Creates a value from an iterator. /// diff --git a/src/libcore/marker.rs b/src/libcore/marker.rs index 3d3f63ecf37d5..d5416e393f463 100644 --- a/src/libcore/marker.rs +++ b/src/libcore/marker.rs @@ -39,7 +39,10 @@ use hash::Hasher; /// [arc]: ../../std/sync/struct.Arc.html /// [ub]: ../../reference/behavior-considered-undefined.html #[stable(feature = "rust1", since = "1.0.0")] -#[rustc_on_unimplemented = "`{Self}` cannot be sent between threads safely"] +#[rustc_on_unimplemented( + message="`{Self}` cannot be sent between threads safely", + label="`{Self}` cannot be sent between threads safely" +)] pub unsafe auto trait Send { // empty. } @@ -88,7 +91,10 @@ impl !Send for *mut T { } /// [trait object]: ../../book/first-edition/trait-objects.html #[stable(feature = "rust1", since = "1.0.0")] #[lang = "sized"] -#[rustc_on_unimplemented = "`{Self}` does not have a constant size known at compile-time"] +#[rustc_on_unimplemented( + message="`{Self}` does not have a constant size known at compile-time", + label="`{Self}` does not have a constant size known at compile-time" +)] #[fundamental] // for Default, for example, which requires that `[T]: !Default` be evaluatable pub trait Sized { // Empty. diff --git a/src/libcore/ops/index.rs b/src/libcore/ops/index.rs index 0a0e92a918006..1ac80ecc96ffe 100644 --- a/src/libcore/ops/index.rs +++ b/src/libcore/ops/index.rs @@ -60,7 +60,10 @@ /// assert_eq!(nucleotide_count[Nucleotide::T], 12); /// ``` #[lang = "index"] -#[rustc_on_unimplemented = "the type `{Self}` cannot be indexed by `{Idx}`"] +#[rustc_on_unimplemented( + message="the type `{Self}` cannot be indexed by `{Idx}`", + label="`{Self}` cannot be indexed by `{Idx}`", +)] #[stable(feature = "rust1", since = "1.0.0")] #[doc(alias = "]")] #[doc(alias = "[")] @@ -147,7 +150,10 @@ pub trait Index { /// balance[Side::Left] = Weight::Kilogram(3.0); /// ``` #[lang = "index_mut"] -#[rustc_on_unimplemented = "the type `{Self}` cannot be mutably indexed by `{Idx}`"] +#[rustc_on_unimplemented( + message="the type `{Self}` cannot be mutably indexed by `{Idx}`", + label="`{Self}` cannot be mutably indexed by `{Idx}`", +)] #[stable(feature = "rust1", since = "1.0.0")] #[doc(alias = "[")] #[doc(alias = "]")] diff --git a/src/libstd/panic.rs b/src/libstd/panic.rs index 4b5a063ea73aa..2c11c262488b2 100644 --- a/src/libstd/panic.rs +++ b/src/libstd/panic.rs @@ -110,8 +110,10 @@ pub use core::panic::{PanicInfo, Location}; /// /// [`AssertUnwindSafe`]: ./struct.AssertUnwindSafe.html #[stable(feature = "catch_unwind", since = "1.9.0")] -#[rustc_on_unimplemented = "the type {Self} may not be safely transferred \ - across an unwind boundary"] +#[rustc_on_unimplemented( + message="the type `{Self}` may not be safely transferred across an unwind boundary", + label="`{Self}` may not be safely transferred across an unwind boundary", +)] pub auto trait UnwindSafe {} /// A marker trait representing types where a shared reference is considered @@ -126,9 +128,12 @@ pub auto trait UnwindSafe {} /// [`UnsafeCell`]: ../cell/struct.UnsafeCell.html /// [`UnwindSafe`]: ./trait.UnwindSafe.html #[stable(feature = "catch_unwind", since = "1.9.0")] -#[rustc_on_unimplemented = "the type {Self} may contain interior mutability \ - and a reference may not be safely transferrable \ - across a catch_unwind boundary"] +#[rustc_on_unimplemented( + message="the type `{Self}` may contain interior mutability and a reference may not be safely \ + transferrable across a catch_unwind boundary", + label="`{Self}` may contain interior mutability and a reference may not be safely \ + transferrable across a catch_unwind boundary", +)] pub auto trait RefUnwindSafe {} /// A simple wrapper around a type to assert that it is unwind safe. diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index afb0931f9504d..5d04aa711c137 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -1204,14 +1204,6 @@ impl<'a> Parser<'a> { fn span_fatal_err>(&self, sp: S, err: Error) -> DiagnosticBuilder<'a> { err.span_err(sp, self.diagnostic()) } - fn span_fatal_help>(&self, - sp: S, - m: &str, - help: &str) -> DiagnosticBuilder<'a> { - let mut err = self.sess.span_diagnostic.struct_span_fatal(sp, m); - err.help(help); - err - } fn bug(&self, m: &str) -> ! { self.sess.span_diagnostic.span_bug(self.span, m) } diff --git a/src/test/compile-fail/associated-types-unsized.rs b/src/test/compile-fail/associated-types-unsized.rs index f182702296416..8c0ce26b294df 100644 --- a/src/test/compile-fail/associated-types-unsized.rs +++ b/src/test/compile-fail/associated-types-unsized.rs @@ -14,7 +14,7 @@ trait Get { } fn foo(t: T) { - let x = t.get(); //~ ERROR `::Value: std::marker::Sized` is not + let x = t.get(); //~ ERROR `::Value` does not have a constant size known at compile-time } fn main() { diff --git a/src/test/compile-fail/bad-method-typaram-kind.rs b/src/test/compile-fail/bad-method-typaram-kind.rs index 5be90f0501833..7cef3f13dfc2c 100644 --- a/src/test/compile-fail/bad-method-typaram-kind.rs +++ b/src/test/compile-fail/bad-method-typaram-kind.rs @@ -9,7 +9,7 @@ // except according to those terms. fn foo() { - 1.bar::(); //~ ERROR `T: std::marker::Send` is not satisfied + 1.bar::(); //~ ERROR `T` cannot be sent between threads safely } trait bar { diff --git a/src/test/compile-fail/bad-sized.rs b/src/test/compile-fail/bad-sized.rs index df3da5096bf53..55b009aef4f16 100644 --- a/src/test/compile-fail/bad-sized.rs +++ b/src/test/compile-fail/bad-sized.rs @@ -13,6 +13,6 @@ trait Trait {} pub fn main() { let x: Vec = Vec::new(); //~^ ERROR only auto traits can be used as additional traits in a trait object - //~| ERROR the trait bound `Trait: std::marker::Sized` is not satisfied - //~| ERROR the trait bound `Trait: std::marker::Sized` is not satisfied + //~| ERROR `Trait` does not have a constant size known at compile-time + //~| ERROR `Trait` does not have a constant size known at compile-time } diff --git a/src/test/compile-fail/builtin-superkinds-double-superkind.rs b/src/test/compile-fail/builtin-superkinds-double-superkind.rs index 261881d880bf9..3f7f2adabdfb1 100644 --- a/src/test/compile-fail/builtin-superkinds-double-superkind.rs +++ b/src/test/compile-fail/builtin-superkinds-double-superkind.rs @@ -14,7 +14,7 @@ trait Foo : Send+Sync { } impl Foo for (T,) { } -//~^ ERROR the trait bound `T: std::marker::Send` is not satisfied in `(T,)` [E0277] +//~^ ERROR `T` cannot be sent between threads safely [E0277] impl Foo for (T,T) { } //~^ ERROR `T` cannot be shared between threads safely [E0277] diff --git a/src/test/compile-fail/builtin-superkinds-in-metadata.rs b/src/test/compile-fail/builtin-superkinds-in-metadata.rs index de2084c4e8187..88b5a3fbb55b6 100644 --- a/src/test/compile-fail/builtin-superkinds-in-metadata.rs +++ b/src/test/compile-fail/builtin-superkinds-in-metadata.rs @@ -22,6 +22,6 @@ struct X(T); impl RequiresShare for X { } impl RequiresRequiresShareAndSend for X { } -//~^ ERROR `T: std::marker::Send` is not satisfied +//~^ ERROR `T` cannot be sent between threads safely [E0277] fn main() { } diff --git a/src/test/compile-fail/builtin-superkinds-simple.rs b/src/test/compile-fail/builtin-superkinds-simple.rs index 6dc5f39cb30df..22dc9598d29ca 100644 --- a/src/test/compile-fail/builtin-superkinds-simple.rs +++ b/src/test/compile-fail/builtin-superkinds-simple.rs @@ -14,6 +14,6 @@ trait Foo : Send { } impl Foo for std::rc::Rc { } -//~^ ERROR `std::rc::Rc: std::marker::Send` is not satisfied +//~^ ERROR `std::rc::Rc` cannot be sent between threads safely fn main() { } diff --git a/src/test/compile-fail/builtin-superkinds-typaram-not-send.rs b/src/test/compile-fail/builtin-superkinds-typaram-not-send.rs index d4bb8de13d056..e0b2043c1107c 100644 --- a/src/test/compile-fail/builtin-superkinds-typaram-not-send.rs +++ b/src/test/compile-fail/builtin-superkinds-typaram-not-send.rs @@ -12,6 +12,7 @@ trait Foo : Send { } -impl Foo for T { } //~ ERROR `T: std::marker::Send` is not satisfied +impl Foo for T { } +//~^ ERROR `T` cannot be sent between threads safely fn main() { } diff --git a/src/test/compile-fail/closure-bounds-cant-promote-superkind-in-struct.rs b/src/test/compile-fail/closure-bounds-cant-promote-superkind-in-struct.rs index b9224e7be7f12..12e9fb30902b5 100644 --- a/src/test/compile-fail/closure-bounds-cant-promote-superkind-in-struct.rs +++ b/src/test/compile-fail/closure-bounds-cant-promote-superkind-in-struct.rs @@ -13,7 +13,7 @@ struct X where F: FnOnce() + 'static + Send { } fn foo(blk: F) -> X where F: FnOnce() + 'static { - //~^ ERROR `F: std::marker::Send` is not satisfied + //~^ ERROR `F` cannot be sent between threads safely return X { field: blk }; } diff --git a/src/test/compile-fail/dst-bad-assign-2.rs b/src/test/compile-fail/dst-bad-assign-2.rs index 10c8f1eed00b0..c3cbc90484250 100644 --- a/src/test/compile-fail/dst-bad-assign-2.rs +++ b/src/test/compile-fail/dst-bad-assign-2.rs @@ -43,5 +43,5 @@ pub fn main() { let f5: &mut Fat = &mut Fat { f1: 5, f2: "some str", ptr: Bar1 {f :42} }; let z: Box = Box::new(Bar1 {f: 36}); f5.ptr = *z; - //~^ ERROR `ToBar: std::marker::Sized` is not satisfied + //~^ ERROR `ToBar` does not have a constant size known at compile-time } diff --git a/src/test/compile-fail/dst-bad-assign-3.rs b/src/test/compile-fail/dst-bad-assign-3.rs index ceaa371623223..1cd5b51fe34d4 100644 --- a/src/test/compile-fail/dst-bad-assign-3.rs +++ b/src/test/compile-fail/dst-bad-assign-3.rs @@ -45,5 +45,5 @@ pub fn main() { //~| expected type `ToBar` //~| found type `Bar1` //~| expected trait ToBar, found struct `Bar1` - //~| ERROR `ToBar: std::marker::Sized` is not satisfied + //~| ERROR `ToBar` does not have a constant size known at compile-time } diff --git a/src/test/compile-fail/dst-bad-assign.rs b/src/test/compile-fail/dst-bad-assign.rs index 4f7d07600ad15..dcd78ac044cd6 100644 --- a/src/test/compile-fail/dst-bad-assign.rs +++ b/src/test/compile-fail/dst-bad-assign.rs @@ -47,5 +47,5 @@ pub fn main() { //~| expected type `ToBar` //~| found type `Bar1` //~| expected trait ToBar, found struct `Bar1` - //~| ERROR `ToBar: std::marker::Sized` is not satisfied + //~| ERROR `ToBar` does not have a constant size known at compile-time } diff --git a/src/test/compile-fail/dst-bad-deep-2.rs b/src/test/compile-fail/dst-bad-deep-2.rs index 0c812b1d815ab..9ed2ec8d98d22 100644 --- a/src/test/compile-fail/dst-bad-deep-2.rs +++ b/src/test/compile-fail/dst-bad-deep-2.rs @@ -19,5 +19,5 @@ pub fn main() { let f: ([isize; 3],) = ([5, 6, 7],); let g: &([isize],) = &f; let h: &(([isize],),) = &(*g,); - //~^ ERROR `[isize]: std::marker::Sized` is not satisfied + //~^ ERROR `[isize]` does not have a constant size known at compile-time } diff --git a/src/test/compile-fail/dst-bad-deep.rs b/src/test/compile-fail/dst-bad-deep.rs index f508364d75115..9b575ae4aad30 100644 --- a/src/test/compile-fail/dst-bad-deep.rs +++ b/src/test/compile-fail/dst-bad-deep.rs @@ -21,5 +21,5 @@ pub fn main() { let f: Fat<[isize; 3]> = Fat { ptr: [5, 6, 7] }; let g: &Fat<[isize]> = &f; let h: &Fat> = &Fat { ptr: *g }; - //~^ ERROR `[isize]: std::marker::Sized` is not satisfied + //~^ ERROR `[isize]` does not have a constant size known at compile-time } diff --git a/src/test/compile-fail/dst-object-from-unsized-type.rs b/src/test/compile-fail/dst-object-from-unsized-type.rs index 8fafd78d40796..678eef76fdea5 100644 --- a/src/test/compile-fail/dst-object-from-unsized-type.rs +++ b/src/test/compile-fail/dst-object-from-unsized-type.rs @@ -16,22 +16,22 @@ impl Foo for [u8] {} fn test1(t: &T) { let u: &Foo = t; - //~^ ERROR `T: std::marker::Sized` is not satisfied + //~^ ERROR `T` does not have a constant size known at compile-time } fn test2(t: &T) { let v: &Foo = t as &Foo; - //~^ ERROR `T: std::marker::Sized` is not satisfied + //~^ ERROR `T` does not have a constant size known at compile-time } fn test3() { let _: &[&Foo] = &["hi"]; - //~^ ERROR `str: std::marker::Sized` is not satisfied + //~^ ERROR `str` does not have a constant size known at compile-time } fn test4(x: &[u8]) { let _: &Foo = x as &Foo; - //~^ ERROR `[u8]: std::marker::Sized` is not satisfied + //~^ ERROR `[u8]` does not have a constant size known at compile-time } fn main() { } diff --git a/src/test/compile-fail/dst-sized-trait-param.rs b/src/test/compile-fail/dst-sized-trait-param.rs index bd5fd3ee3b71e..cafd67809f812 100644 --- a/src/test/compile-fail/dst-sized-trait-param.rs +++ b/src/test/compile-fail/dst-sized-trait-param.rs @@ -15,9 +15,9 @@ trait Foo : Sized { fn take(self, x: &T) { } } // Note: T is sized impl Foo<[isize]> for usize { } -//~^ ERROR `[isize]: std::marker::Sized` is not satisfied +//~^ ERROR `[isize]` does not have a constant size known at compile-time impl Foo for [usize] { } -//~^ ERROR `[usize]: std::marker::Sized` is not satisfied +//~^ ERROR `[usize]` does not have a constant size known at compile-time pub fn main() { } diff --git a/src/test/compile-fail/extern-types-not-sync-send.rs b/src/test/compile-fail/extern-types-not-sync-send.rs index 6a7a515ba5fbb..10abb80a2f71b 100644 --- a/src/test/compile-fail/extern-types-not-sync-send.rs +++ b/src/test/compile-fail/extern-types-not-sync-send.rs @@ -24,5 +24,5 @@ fn main() { //~^ ERROR `A` cannot be shared between threads safely [E0277] assert_send::(); - //~^ ERROR the trait bound `A: std::marker::Send` is not satisfied + //~^ ERROR `A` cannot be sent between threads safely [E0277] } diff --git a/src/test/compile-fail/extern-types-unsized.rs b/src/test/compile-fail/extern-types-unsized.rs index faa27894806f8..b3e19899a67a8 100644 --- a/src/test/compile-fail/extern-types-unsized.rs +++ b/src/test/compile-fail/extern-types-unsized.rs @@ -30,14 +30,14 @@ fn assert_sized() { } fn main() { assert_sized::(); - //~^ ERROR the trait bound `A: std::marker::Sized` is not satisfied + //~^ ERROR `A` does not have a constant size known at compile-time assert_sized::(); - //~^ ERROR the trait bound `A: std::marker::Sized` is not satisfied + //~^ ERROR `A` does not have a constant size known at compile-time assert_sized::>(); - //~^ ERROR the trait bound `A: std::marker::Sized` is not satisfied + //~^ ERROR `A` does not have a constant size known at compile-time assert_sized::>>(); - //~^ ERROR the trait bound `A: std::marker::Sized` is not satisfied + //~^ ERROR `A` does not have a constant size known at compile-time } diff --git a/src/test/compile-fail/issue-14366.rs b/src/test/compile-fail/issue-14366.rs index 84452accc9a4a..7b4954a2d4ec9 100644 --- a/src/test/compile-fail/issue-14366.rs +++ b/src/test/compile-fail/issue-14366.rs @@ -10,5 +10,5 @@ fn main() { let _x = "test" as &::std::any::Any; -//~^ ERROR `str: std::marker::Sized` is not satisfied + //~^ ERROR `str` does not have a constant size known at compile-time } diff --git a/src/test/compile-fail/issue-15756.rs b/src/test/compile-fail/issue-15756.rs index 41349d7d7443b..0df82de83381b 100644 --- a/src/test/compile-fail/issue-15756.rs +++ b/src/test/compile-fail/issue-15756.rs @@ -15,7 +15,7 @@ fn dft_iter<'a, T>(arg1: Chunks<'a,T>, arg2: ChunksMut<'a,T>) { for &mut something -//~^ ERROR `[T]: std::marker::Sized` is not satisfied + //~^ ERROR `[T]` does not have a constant size known at compile-time in arg2 { } diff --git a/src/test/compile-fail/issue-17651.rs b/src/test/compile-fail/issue-17651.rs index 4996da057dd8e..13548b06ea18b 100644 --- a/src/test/compile-fail/issue-17651.rs +++ b/src/test/compile-fail/issue-17651.rs @@ -13,5 +13,5 @@ fn main() { (|| Box::new(*(&[0][..])))(); - //~^ ERROR `[{integer}]: std::marker::Sized` is not satisfied + //~^ ERROR `[{integer}]` does not have a constant size known at compile-time } diff --git a/src/test/compile-fail/issue-18107.rs b/src/test/compile-fail/issue-18107.rs index 33d68c121bf26..5faa8885e7319 100644 --- a/src/test/compile-fail/issue-18107.rs +++ b/src/test/compile-fail/issue-18107.rs @@ -12,7 +12,7 @@ pub trait AbstractRenderer {} fn _create_render(_: &()) -> AbstractRenderer -//~^ ERROR: `AbstractRenderer + 'static: std::marker::Sized` is not satisfied +//~^ ERROR: `AbstractRenderer + 'static` does not have a constant size known at compile-time { match 0 { _ => unimplemented!() diff --git a/src/test/compile-fail/issue-18919.rs b/src/test/compile-fail/issue-18919.rs index 3e21360721b6d..14b776cb1ff24 100644 --- a/src/test/compile-fail/issue-18919.rs +++ b/src/test/compile-fail/issue-18919.rs @@ -11,7 +11,7 @@ type FuncType<'f> = Fn(&isize) -> isize + 'f; fn ho_func(f: Option) { - //~^ ERROR: `for<'r> std::ops::Fn(&'r isize) -> isize: std::marker::Sized` is not satisfied + //~^ ERROR: `for<'r> std::ops::Fn(&'r isize) -> isize` does not have a constant size known at } fn main() {} diff --git a/src/test/compile-fail/issue-20005.rs b/src/test/compile-fail/issue-20005.rs index b02757fb5a313..ab47f687fc23c 100644 --- a/src/test/compile-fail/issue-20005.rs +++ b/src/test/compile-fail/issue-20005.rs @@ -15,7 +15,7 @@ trait From { } trait To { - fn to( //~ ERROR `Self: std::marker::Sized` is not satisfied + fn to( //~ ERROR `Self` does not have a constant size known at compile-time self ) -> >::Result where Dst: From { From::from(self) diff --git a/src/test/compile-fail/issue-20433.rs b/src/test/compile-fail/issue-20433.rs index d1a139e698e12..d8ca00d313f7a 100644 --- a/src/test/compile-fail/issue-20433.rs +++ b/src/test/compile-fail/issue-20433.rs @@ -14,5 +14,5 @@ struct The; impl The { fn iceman(c: Vec<[i32]>) {} - //~^ ERROR the trait bound `[i32]: std::marker::Sized` is not satisfied + //~^ ERROR `[i32]` does not have a constant size known at compile-time } diff --git a/src/test/compile-fail/issue-20605.rs b/src/test/compile-fail/issue-20605.rs index 5eb0e4360fc93..c5a724bba807a 100644 --- a/src/test/compile-fail/issue-20605.rs +++ b/src/test/compile-fail/issue-20605.rs @@ -10,7 +10,7 @@ fn changer<'a>(mut things: Box>) { for item in *things { *item = 0 } -//~^ ERROR the trait bound `std::iter::Iterator: std::marker::Sized` is not satisfied +//~^ ERROR `std::iter::Iterator` does not have a constant size known at compile-time } fn main() {} diff --git a/src/test/compile-fail/issue-21763.rs b/src/test/compile-fail/issue-21763.rs index cb0baee0a8787..b4f952c87d4aa 100644 --- a/src/test/compile-fail/issue-21763.rs +++ b/src/test/compile-fail/issue-21763.rs @@ -17,5 +17,5 @@ fn foo() {} fn main() { foo::, Rc<()>>>(); - //~^ ERROR: `std::rc::Rc<()>: std::marker::Send` is not satisfied + //~^ ERROR `std::rc::Rc<()>` cannot be sent between threads safely } diff --git a/src/test/compile-fail/issue-22874.rs b/src/test/compile-fail/issue-22874.rs index 0df84a436c0a9..de176486af7db 100644 --- a/src/test/compile-fail/issue-22874.rs +++ b/src/test/compile-fail/issue-22874.rs @@ -10,7 +10,7 @@ struct Table { rows: [[String]], - //~^ ERROR the trait bound `[std::string::String]: std::marker::Sized` is not satisfied [E0277] + //~^ ERROR `[std::string::String]` does not have a constant size known at compile-time } fn f(table: &Table) -> &[String] { diff --git a/src/test/compile-fail/issue-23281.rs b/src/test/compile-fail/issue-23281.rs index 5feeb36b1e4d4..fdab3b59d1bb6 100644 --- a/src/test/compile-fail/issue-23281.rs +++ b/src/test/compile-fail/issue-23281.rs @@ -14,7 +14,7 @@ pub struct Struct; impl Struct { pub fn function(funs: Vec ()>) {} - //~^ ERROR the trait bound `std::ops::Fn() + 'static: std::marker::Sized` is not satisfied + //~^ ERROR `std::ops::Fn() + 'static` does not have a constant size known at compile-time } fn main() {} diff --git a/src/test/compile-fail/issue-24446.rs b/src/test/compile-fail/issue-24446.rs index acd50bcf9e112..5f36bbcf5fd6a 100644 --- a/src/test/compile-fail/issue-24446.rs +++ b/src/test/compile-fail/issue-24446.rs @@ -11,7 +11,7 @@ fn main() { static foo: Fn() -> u32 = || -> u32 { //~^ ERROR: mismatched types - //~| ERROR: `std::ops::Fn() -> u32 + 'static: std::marker::Sized` is not satisfied + //~| ERROR: `std::ops::Fn() -> u32 + 'static` does not have a constant size known at compile-time 0 }; } diff --git a/src/test/compile-fail/issue-27060-2.rs b/src/test/compile-fail/issue-27060-2.rs index 28180b05c8de8..123bbf3358d89 100644 --- a/src/test/compile-fail/issue-27060-2.rs +++ b/src/test/compile-fail/issue-27060-2.rs @@ -10,7 +10,7 @@ #[repr(packed)] pub struct Bad { - data: T, //~ ERROR `T: std::marker::Sized` is not satisfied + data: T, //~ ERROR `T` does not have a constant size known at compile-time } fn main() {} diff --git a/src/test/compile-fail/issue-27078.rs b/src/test/compile-fail/issue-27078.rs index f34bef6224900..32933fa6176f7 100644 --- a/src/test/compile-fail/issue-27078.rs +++ b/src/test/compile-fail/issue-27078.rs @@ -13,7 +13,7 @@ trait Foo { const BAR: i32; fn foo(self) -> &'static i32 { - //~^ ERROR the trait bound `Self: std::marker::Sized` is not satisfied + //~^ ERROR `Self` does not have a constant size known at compile-time &::BAR } } diff --git a/src/test/compile-fail/issue-35988.rs b/src/test/compile-fail/issue-35988.rs index c2e6a88a57bff..8f5b68986e52c 100644 --- a/src/test/compile-fail/issue-35988.rs +++ b/src/test/compile-fail/issue-35988.rs @@ -10,7 +10,7 @@ enum E { V([Box]), - //~^ ERROR the trait bound `[std::boxed::Box]: std::marker::Sized` is not satisfied [E0277] + //~^ ERROR `[std::boxed::Box]` does not have a constant size known at compile-time } fn main() {} diff --git a/src/test/compile-fail/issue-38954.rs b/src/test/compile-fail/issue-38954.rs index 896728b6da0f1..960099f31934a 100644 --- a/src/test/compile-fail/issue-38954.rs +++ b/src/test/compile-fail/issue-38954.rs @@ -9,6 +9,6 @@ // except according to those terms. fn _test(ref _p: str) {} -//~^ ERROR the trait bound `str: std::marker::Sized` is not satisfied [E0277] +//~^ ERROR `str` does not have a constant size known at compile-time fn main() { } diff --git a/src/test/compile-fail/issue-41229-ref-str.rs b/src/test/compile-fail/issue-41229-ref-str.rs index 31bc21c23ba5f..b1e24c818d8a3 100644 --- a/src/test/compile-fail/issue-41229-ref-str.rs +++ b/src/test/compile-fail/issue-41229-ref-str.rs @@ -9,8 +9,6 @@ // except according to those terms. pub fn example(ref s: str) {} -//~^ ERROR the trait bound `str: std::marker::Sized` is not satisfied -//~| `str` does not have a constant size known at compile-time -//~| the trait `std::marker::Sized` is not implemented for `str` +//~^ ERROR `str` does not have a constant size known at compile-time fn main() {} diff --git a/src/test/compile-fail/issue-42312.rs b/src/test/compile-fail/issue-42312.rs index 06573b42b592d..89eb5c5ebc18e 100644 --- a/src/test/compile-fail/issue-42312.rs +++ b/src/test/compile-fail/issue-42312.rs @@ -12,10 +12,10 @@ use std::ops::Deref; pub trait Foo { fn baz(_: Self::Target) where Self: Deref {} - //~^ ERROR `::Target: std::marker::Sized` is not satisfied + //~^ ERROR `::Target` does not have a constant size known at } pub fn f(_: ToString) {} -//~^ ERROR the trait bound `std::string::ToString + 'static: std::marker::Sized` is not satisfied +//~^ ERROR `std::string::ToString + 'static` does not have a constant size known at compile-time fn main() { } diff --git a/src/test/compile-fail/issue-5883.rs b/src/test/compile-fail/issue-5883.rs index e14d9f3a35c84..580625f495530 100644 --- a/src/test/compile-fail/issue-5883.rs +++ b/src/test/compile-fail/issue-5883.rs @@ -15,8 +15,8 @@ struct Struct { } fn new_struct(r: A+'static) - -> Struct { //~^ ERROR `A + 'static: std::marker::Sized` is not satisfied - //~^ ERROR `A + 'static: std::marker::Sized` is not satisfied + -> Struct { //~^ ERROR `A + 'static` does not have a constant size known at compile-time + //~^ ERROR `A + 'static` does not have a constant size known at compile-time Struct { r: r } } diff --git a/src/test/compile-fail/issue-7013.rs b/src/test/compile-fail/issue-7013.rs index 95bbd4eccf4ff..0c19780bcb4ca 100644 --- a/src/test/compile-fail/issue-7013.rs +++ b/src/test/compile-fail/issue-7013.rs @@ -34,5 +34,5 @@ struct A { fn main() { let a = A {v: box B{v: None} as Box}; - //~^ ERROR `std::rc::Rc>: std::marker::Send` is not satisfied + //~^ ERROR `std::rc::Rc>` cannot be sent between threads safely } diff --git a/src/test/compile-fail/kindck-impl-type-params.rs b/src/test/compile-fail/kindck-impl-type-params.rs index 2a86cdef9812f..3a0e66f58e076 100644 --- a/src/test/compile-fail/kindck-impl-type-params.rs +++ b/src/test/compile-fail/kindck-impl-type-params.rs @@ -26,15 +26,15 @@ impl Gettable for S {} fn f(val: T) { let t: S = S(marker::PhantomData); let a = &t as &Gettable; - //~^ ERROR : std::marker::Send` is not satisfied - //~^^ ERROR : std::marker::Copy` is not satisfied + //~^ ERROR `T` cannot be sent between threads safely + //~| ERROR : std::marker::Copy` is not satisfied } fn g(val: T) { let t: S = S(marker::PhantomData); let a: &Gettable = &t; - //~^ ERROR : std::marker::Send` is not satisfied - //~^^ ERROR : std::marker::Copy` is not satisfied + //~^ ERROR `T` cannot be sent between threads safely + //~| ERROR : std::marker::Copy` is not satisfied } fn foo<'a>() { diff --git a/src/test/compile-fail/kindck-nonsendable-1.rs b/src/test/compile-fail/kindck-nonsendable-1.rs index dd77c2c138f46..43c212b2af582 100644 --- a/src/test/compile-fail/kindck-nonsendable-1.rs +++ b/src/test/compile-fail/kindck-nonsendable-1.rs @@ -18,5 +18,5 @@ fn bar(_: F) { } fn main() { let x = Rc::new(3); bar(move|| foo(x)); - //~^ ERROR : std::marker::Send` is not satisfied + //~^ ERROR `std::rc::Rc` cannot be sent between threads safely } diff --git a/src/test/compile-fail/kindck-send-object.rs b/src/test/compile-fail/kindck-send-object.rs index a84eae0bfdae8..a3eb47be3eed8 100644 --- a/src/test/compile-fail/kindck-send-object.rs +++ b/src/test/compile-fail/kindck-send-object.rs @@ -24,7 +24,8 @@ fn object_ref_with_static_bound_not_ok() { } fn box_object_with_no_bound_not_ok<'a>() { - assert_send::>(); //~ ERROR : std::marker::Send` is not satisfied + assert_send::>(); + //~^ ERROR `Dummy` cannot be sent between threads safely } fn object_with_send_bound_ok() { diff --git a/src/test/compile-fail/kindck-send-object1.rs b/src/test/compile-fail/kindck-send-object1.rs index 66865bbcc7ee1..673a6abc5f03d 100644 --- a/src/test/compile-fail/kindck-send-object1.rs +++ b/src/test/compile-fail/kindck-send-object1.rs @@ -37,7 +37,7 @@ fn test61() { // them not ok fn test_71<'a>() { assert_send::>(); - //~^ ERROR : std::marker::Send` is not satisfied + //~^ ERROR `Dummy + 'a` cannot be sent between threads safely } fn main() { } diff --git a/src/test/compile-fail/kindck-send-object2.rs b/src/test/compile-fail/kindck-send-object2.rs index 51bc587d74ff8..3a935af200054 100644 --- a/src/test/compile-fail/kindck-send-object2.rs +++ b/src/test/compile-fail/kindck-send-object2.rs @@ -19,7 +19,8 @@ fn test50() { } fn test53() { - assert_send::>(); //~ ERROR : std::marker::Send` is not satisfied + assert_send::>(); + //~^ ERROR `Dummy` cannot be sent between threads safely } // ...unless they are properly bounded diff --git a/src/test/compile-fail/kindck-send-owned.rs b/src/test/compile-fail/kindck-send-owned.rs index 583381a1c28f5..e48460a87537f 100644 --- a/src/test/compile-fail/kindck-send-owned.rs +++ b/src/test/compile-fail/kindck-send-owned.rs @@ -19,7 +19,8 @@ fn test32() { assert_send:: >(); } // but not if they own a bad thing fn test40() { - assert_send::>(); //~ ERROR : std::marker::Send` is not satisfied + assert_send::>(); + //~^ ERROR `*mut u8` cannot be sent between threads safely } fn main() { } diff --git a/src/test/compile-fail/kindck-send-unsafe.rs b/src/test/compile-fail/kindck-send-unsafe.rs index c717d1a72e05d..99b995b0906b4 100644 --- a/src/test/compile-fail/kindck-send-unsafe.rs +++ b/src/test/compile-fail/kindck-send-unsafe.rs @@ -14,7 +14,7 @@ fn assert_send() { } fn test71<'a>() { assert_send::<*mut &'a isize>(); - //~^ ERROR `*mut &'a isize: std::marker::Send` is not satisfied + //~^ ERROR `*mut &'a isize` cannot be sent between threads safely } fn main() { diff --git a/src/test/compile-fail/no-send-res-ports.rs b/src/test/compile-fail/no-send-res-ports.rs index 334952cefa6e0..6825963c48647 100644 --- a/src/test/compile-fail/no-send-res-ports.rs +++ b/src/test/compile-fail/no-send-res-ports.rs @@ -33,7 +33,7 @@ fn main() { let x = foo(Port(Rc::new(()))); thread::spawn(move|| { - //~^ ERROR `std::rc::Rc<()>: std::marker::Send` is not satisfied + //~^ ERROR `std::rc::Rc<()>` cannot be sent between threads safely let y = x; println!("{:?}", y); }); diff --git a/src/test/compile-fail/no_send-enum.rs b/src/test/compile-fail/no_send-enum.rs index 902710e96e274..83f19ed19efc2 100644 --- a/src/test/compile-fail/no_send-enum.rs +++ b/src/test/compile-fail/no_send-enum.rs @@ -24,5 +24,5 @@ fn bar(_: T) {} fn main() { let x = Foo::A(NoSend); bar(x); - //~^ ERROR `NoSend: std::marker::Send` is not satisfied + //~^ ERROR `NoSend` cannot be sent between threads safely } diff --git a/src/test/compile-fail/no_send-rc.rs b/src/test/compile-fail/no_send-rc.rs index f31d378733491..d3616d144229c 100644 --- a/src/test/compile-fail/no_send-rc.rs +++ b/src/test/compile-fail/no_send-rc.rs @@ -15,5 +15,5 @@ fn bar(_: T) {} fn main() { let x = Rc::new(5); bar(x); - //~^ ERROR `std::rc::Rc<{integer}>: std::marker::Send` is not satisfied + //~^ ERROR `std::rc::Rc<{integer}>` cannot be sent between threads safely } diff --git a/src/test/compile-fail/no_send-struct.rs b/src/test/compile-fail/no_send-struct.rs index b2ca4f9f5db16..d38d993e7e8e6 100644 --- a/src/test/compile-fail/no_send-struct.rs +++ b/src/test/compile-fail/no_send-struct.rs @@ -23,5 +23,5 @@ fn bar(_: T) {} fn main() { let x = Foo { a: 5 }; bar(x); - //~^ ERROR `Foo: std::marker::Send` is not satisfied + //~^ ERROR `Foo` cannot be sent between threads safely } diff --git a/src/test/compile-fail/not-panic-safe-2.rs b/src/test/compile-fail/not-panic-safe-2.rs index 7107211fc914b..d750851b719e4 100644 --- a/src/test/compile-fail/not-panic-safe-2.rs +++ b/src/test/compile-fail/not-panic-safe-2.rs @@ -18,6 +18,6 @@ fn assert() {} fn main() { assert::>>(); - //~^ ERROR `std::cell::UnsafeCell: std::panic::RefUnwindSafe` is not satisfied - //~^^ ERROR `std::cell::UnsafeCell: std::panic::RefUnwindSafe` is not satisfied + //~^ ERROR the type `std::cell::UnsafeCell` may contain interior mutability and a + //~| ERROR the type `std::cell::UnsafeCell` may contain interior mutability and a } diff --git a/src/test/compile-fail/not-panic-safe-3.rs b/src/test/compile-fail/not-panic-safe-3.rs index 76c34e4dc0b44..cd27b274258ea 100644 --- a/src/test/compile-fail/not-panic-safe-3.rs +++ b/src/test/compile-fail/not-panic-safe-3.rs @@ -18,6 +18,6 @@ fn assert() {} fn main() { assert::>>(); - //~^ ERROR `std::cell::UnsafeCell: std::panic::RefUnwindSafe` is not satisfied - //~^^ ERROR `std::cell::UnsafeCell: std::panic::RefUnwindSafe` is not satisfied + //~^ ERROR the type `std::cell::UnsafeCell` may contain interior mutability and a + //~| ERROR the type `std::cell::UnsafeCell` may contain interior mutability and a } diff --git a/src/test/compile-fail/not-panic-safe-4.rs b/src/test/compile-fail/not-panic-safe-4.rs index 177a43e2a7f71..956eca432c5f0 100644 --- a/src/test/compile-fail/not-panic-safe-4.rs +++ b/src/test/compile-fail/not-panic-safe-4.rs @@ -17,6 +17,6 @@ fn assert() {} fn main() { assert::<&RefCell>(); - //~^ ERROR `std::cell::UnsafeCell: std::panic::RefUnwindSafe` is not satisfied - //~^^ ERROR `std::cell::UnsafeCell: std::panic::RefUnwindSafe` is not satisfied + //~^ ERROR the type `std::cell::UnsafeCell` may contain interior mutability and a + //~| ERROR the type `std::cell::UnsafeCell` may contain interior mutability and a } diff --git a/src/test/compile-fail/not-panic-safe-6.rs b/src/test/compile-fail/not-panic-safe-6.rs index f03e1d545a808..d0ca1db521204 100644 --- a/src/test/compile-fail/not-panic-safe-6.rs +++ b/src/test/compile-fail/not-panic-safe-6.rs @@ -17,6 +17,6 @@ fn assert() {} fn main() { assert::<*mut RefCell>(); - //~^ ERROR `std::cell::UnsafeCell: std::panic::RefUnwindSafe` is not satisfied - //~^^ ERROR `std::cell::UnsafeCell: std::panic::RefUnwindSafe` is not satisfied + //~^ ERROR the type `std::cell::UnsafeCell` may contain interior mutability and a + //~| ERROR the type `std::cell::UnsafeCell` may contain interior mutability and a } diff --git a/src/test/compile-fail/not-panic-safe.rs b/src/test/compile-fail/not-panic-safe.rs index ece8fa7dc47bb..0ebf3d3fed7b5 100644 --- a/src/test/compile-fail/not-panic-safe.rs +++ b/src/test/compile-fail/not-panic-safe.rs @@ -16,5 +16,6 @@ use std::panic::UnwindSafe; fn assert() {} fn main() { - assert::<&mut i32>(); //~ ERROR: UnwindSafe` is not satisfied + assert::<&mut i32>(); + //~^ ERROR the type `&mut i32` may not be safely transferred across an unwind boundary } diff --git a/src/test/compile-fail/range-1.rs b/src/test/compile-fail/range-1.rs index 58794e3b35d53..3fb62b8d86928 100644 --- a/src/test/compile-fail/range-1.rs +++ b/src/test/compile-fail/range-1.rs @@ -22,5 +22,5 @@ pub fn main() { // Unsized type. let arr: &[_] = &[1, 2, 3]; let range = *arr..; - //~^ ERROR `[{integer}]: std::marker::Sized` is not satisfied + //~^ ERROR `[{integer}]` does not have a constant size known at compile-time } diff --git a/src/test/compile-fail/range_traits-1.rs b/src/test/compile-fail/range_traits-1.rs index 32f9b83b6e2c7..78d3702b449ca 100644 --- a/src/test/compile-fail/range_traits-1.rs +++ b/src/test/compile-fail/range_traits-1.rs @@ -13,23 +13,23 @@ use std::ops::*; #[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)] struct AllTheRanges { a: Range, - //~^ ERROR PartialOrd - //~^^ ERROR Ord + //~^ ERROR can't compare + //~| ERROR Ord b: RangeTo, - //~^ ERROR PartialOrd - //~^^ ERROR Ord + //~^ ERROR can't compare + //~| ERROR Ord c: RangeFrom, - //~^ ERROR PartialOrd - //~^^ ERROR Ord + //~^ ERROR can't compare + //~| ERROR Ord d: RangeFull, - //~^ ERROR PartialOrd - //~^^ ERROR Ord + //~^ ERROR can't compare + //~| ERROR Ord e: RangeInclusive, - //~^ ERROR PartialOrd - //~^^ ERROR Ord + //~^ ERROR can't compare + //~| ERROR Ord f: RangeToInclusive, - //~^ ERROR PartialOrd - //~^^ ERROR Ord + //~^ ERROR can't compare + //~| ERROR Ord } fn main() {} diff --git a/src/test/compile-fail/str-idx.rs b/src/test/compile-fail/str-idx.rs index 2b2c23a3ce4e9..b5f1ffb977ed6 100644 --- a/src/test/compile-fail/str-idx.rs +++ b/src/test/compile-fail/str-idx.rs @@ -10,5 +10,5 @@ pub fn main() { let s: &str = "hello"; - let c: u8 = s[4]; //~ ERROR `str: std::ops::Index<{integer}>` is not satisfied + let c: u8 = s[4]; //~ ERROR the type `str` cannot be indexed by `{integer}` } diff --git a/src/test/compile-fail/str-mut-idx.rs b/src/test/compile-fail/str-mut-idx.rs index 219fcdfd70265..c25d257d5f860 100644 --- a/src/test/compile-fail/str-mut-idx.rs +++ b/src/test/compile-fail/str-mut-idx.rs @@ -12,10 +12,10 @@ fn bot() -> T { loop {} } fn mutate(s: &mut str) { s[1..2] = bot(); - //~^ ERROR `str: std::marker::Sized` is not satisfied - //~| ERROR `str: std::marker::Sized` is not satisfied + //~^ ERROR `str` does not have a constant size known at compile-time + //~| ERROR `str` does not have a constant size known at compile-time s[1usize] = bot(); - //~^ ERROR `str: std::ops::IndexMut` is not satisfied + //~^ ERROR the type `str` cannot be mutably indexed by `usize` } pub fn main() {} diff --git a/src/test/compile-fail/substs-ppaux.rs b/src/test/compile-fail/substs-ppaux.rs index c857790e342d0..94d2a549a8606 100644 --- a/src/test/compile-fail/substs-ppaux.rs +++ b/src/test/compile-fail/substs-ppaux.rs @@ -56,6 +56,6 @@ fn foo<'z>() where &'z (): Sized { //[normal]~| found type `fn() {foo::<'static>}` >::bar; - //[verbose]~^ ERROR `str: std::marker::Sized` is not satisfied - //[normal]~^^ ERROR `str: std::marker::Sized` is not satisfied + //[verbose]~^ ERROR `str` does not have a constant size known at compile-time + //[normal]~^^ ERROR `str` does not have a constant size known at compile-time } diff --git a/src/test/compile-fail/trait-bounds-not-on-bare-trait.rs b/src/test/compile-fail/trait-bounds-not-on-bare-trait.rs index 983c66ec1c40f..effee4a70f342 100644 --- a/src/test/compile-fail/trait-bounds-not-on-bare-trait.rs +++ b/src/test/compile-fail/trait-bounds-not-on-bare-trait.rs @@ -15,7 +15,7 @@ trait Foo { // This should emit the less confusing error, not the more confusing one. fn foo(_x: Foo + Send) { - //~^ ERROR the trait bound `Foo + std::marker::Send + 'static: std::marker::Sized` is not + //~^ ERROR `Foo + std::marker::Send + 'static` does not have a constant size known at compile-time } fn main() { } diff --git a/src/test/compile-fail/traits-negative-impls.rs b/src/test/compile-fail/traits-negative-impls.rs index 8014f92e17344..a272686c53573 100644 --- a/src/test/compile-fail/traits-negative-impls.rs +++ b/src/test/compile-fail/traits-negative-impls.rs @@ -31,8 +31,8 @@ fn dummy() { impl !Send for TestType {} Outer(TestType); - //~^ ERROR `dummy::TestType: std::marker::Send` is not satisfied - //~| ERROR `dummy::TestType: std::marker::Send` is not satisfied + //~^ ERROR `dummy::TestType` cannot be sent between threads safely + //~| ERROR `dummy::TestType` cannot be sent between threads safely } fn dummy1b() { @@ -40,7 +40,7 @@ fn dummy1b() { impl !Send for TestType {} is_send(TestType); - //~^ ERROR `dummy1b::TestType: std::marker::Send` is not satisfied + //~^ ERROR `dummy1b::TestType` cannot be sent between threads safely } fn dummy1c() { @@ -48,7 +48,7 @@ fn dummy1c() { impl !Send for TestType {} is_send((8, TestType)); - //~^ ERROR `dummy1c::TestType: std::marker::Send` is not satisfied + //~^ ERROR `dummy1c::TestType` cannot be sent between threads safely } fn dummy2() { @@ -56,7 +56,7 @@ fn dummy2() { impl !Send for TestType {} is_send(Box::new(TestType)); - //~^ ERROR `dummy2::TestType: std::marker::Send` is not satisfied + //~^ ERROR `dummy2::TestType` cannot be sent between threads safely } fn dummy3() { @@ -64,7 +64,7 @@ fn dummy3() { impl !Send for TestType {} is_send(Box::new(Outer2(TestType))); - //~^ ERROR `dummy3::TestType: std::marker::Send` is not satisfied + //~^ ERROR `dummy3::TestType` cannot be sent between threads safely } fn main() { @@ -74,5 +74,5 @@ fn main() { // This will complain about a missing Send impl because `Sync` is implement *just* // for T that are `Send`. Look at #20366 and #19950 is_sync(Outer2(TestType)); - //~^ ERROR `main::TestType: std::marker::Send` is not satisfied + //~^ ERROR `main::TestType` cannot be sent between threads safely } diff --git a/src/test/compile-fail/typeck-default-trait-impl-negation-send.rs b/src/test/compile-fail/typeck-default-trait-impl-negation-send.rs index 853718f1e77d0..65438e5df8e08 100644 --- a/src/test/compile-fail/typeck-default-trait-impl-negation-send.rs +++ b/src/test/compile-fail/typeck-default-trait-impl-negation-send.rs @@ -27,5 +27,5 @@ fn is_send() {} fn main() { is_send::(); is_send::(); - //~^ ERROR `MyNotSendable: std::marker::Send` is not satisfied + //~^ ERROR `MyNotSendable` cannot be sent between threads safely } diff --git a/src/test/compile-fail/union/union-unsized.rs b/src/test/compile-fail/union/union-unsized.rs index a238eaf052508..32f22f052c17e 100644 --- a/src/test/compile-fail/union/union-unsized.rs +++ b/src/test/compile-fail/union/union-unsized.rs @@ -11,13 +11,15 @@ #![feature(untagged_unions)] union U { - a: str, //~ ERROR the trait bound `str: std::marker::Sized` is not satisfied + a: str, + //~^ ERROR `str` does not have a constant size known at compile-time b: u8, } union W { a: u8, - b: str, //~ ERROR the trait bound `str: std::marker::Sized` is not satisfied + b: str, + //~^ ERROR `str` does not have a constant size known at compile-time } fn main() {} diff --git a/src/test/compile-fail/unsized-bare-typaram.rs b/src/test/compile-fail/unsized-bare-typaram.rs index 3dcc7d248d72d..be1f1dea28cd1 100644 --- a/src/test/compile-fail/unsized-bare-typaram.rs +++ b/src/test/compile-fail/unsized-bare-typaram.rs @@ -9,5 +9,6 @@ // except according to those terms. fn bar() { } -fn foo() { bar::() } //~ ERROR `T: std::marker::Sized` is not satisfied +fn foo() { bar::() } +//~^ ERROR `T` does not have a constant size known at compile-time fn main() { } diff --git a/src/test/compile-fail/unsized-enum.rs b/src/test/compile-fail/unsized-enum.rs index 5d791215f36c6..2041c69da54ed 100644 --- a/src/test/compile-fail/unsized-enum.rs +++ b/src/test/compile-fail/unsized-enum.rs @@ -15,7 +15,7 @@ fn not_sized() { } enum Foo { FooSome(U), FooNone } fn foo1() { not_sized::>() } // Hunky dory. fn foo2() { not_sized::>() } -//~^ ERROR `T: std::marker::Sized` is not satisfied +//~^ ERROR `T` does not have a constant size known at compile-time // // Not OK: `T` is not sized. diff --git a/src/test/compile-fail/unsized-inherent-impl-self-type.rs b/src/test/compile-fail/unsized-inherent-impl-self-type.rs index 4d0774f2ce441..5e5280ff3ea39 100644 --- a/src/test/compile-fail/unsized-inherent-impl-self-type.rs +++ b/src/test/compile-fail/unsized-inherent-impl-self-type.rs @@ -14,7 +14,8 @@ struct S5(Y); -impl S5 { //~ ERROR E0277 +impl S5 { + //~^ ERROR `X` does not have a constant size known at compile-time } fn main() { } diff --git a/src/test/compile-fail/unsized-struct.rs b/src/test/compile-fail/unsized-struct.rs index bbefb2fcecd80..830ac5d6c207b 100644 --- a/src/test/compile-fail/unsized-struct.rs +++ b/src/test/compile-fail/unsized-struct.rs @@ -15,14 +15,14 @@ fn not_sized() { } struct Foo { data: T } fn foo1() { not_sized::>() } // Hunky dory. fn foo2() { not_sized::>() } -//~^ ERROR `T: std::marker::Sized` is not satisfied +//~^ ERROR `T` does not have a constant size known at compile-time // // Not OK: `T` is not sized. struct Bar { data: T } fn bar1() { not_sized::>() } fn bar2() { is_sized::>() } -//~^ ERROR `T: std::marker::Sized` is not satisfied +//~^ ERROR `T` does not have a constant size known at compile-time // // Not OK: `Bar` is not sized, but it should be. diff --git a/src/test/compile-fail/unsized-trait-impl-self-type.rs b/src/test/compile-fail/unsized-trait-impl-self-type.rs index c919bdf924f65..9bf4cf7a0bb20 100644 --- a/src/test/compile-fail/unsized-trait-impl-self-type.rs +++ b/src/test/compile-fail/unsized-trait-impl-self-type.rs @@ -17,7 +17,8 @@ trait T3 { struct S5(Y); -impl T3 for S5 { //~ ERROR E0277 +impl T3 for S5 { + //~^ ERROR `X` does not have a constant size known at compile-time } fn main() { } diff --git a/src/test/compile-fail/unsized-trait-impl-trait-arg.rs b/src/test/compile-fail/unsized-trait-impl-trait-arg.rs index ad5e4c2daef9e..b3a848954d104 100644 --- a/src/test/compile-fail/unsized-trait-impl-trait-arg.rs +++ b/src/test/compile-fail/unsized-trait-impl-trait-arg.rs @@ -16,7 +16,7 @@ trait T2 { } struct S4(Box); impl T2 for S4 { - //~^ ERROR `X: std::marker::Sized` is not satisfied + //~^ ERROR `X` does not have a constant size known at compile-time } fn main() { } diff --git a/src/test/compile-fail/unsized3.rs b/src/test/compile-fail/unsized3.rs index e96e0ea3aec36..e08cf8280fdf6 100644 --- a/src/test/compile-fail/unsized3.rs +++ b/src/test/compile-fail/unsized3.rs @@ -15,7 +15,7 @@ use std::marker; // Unbounded. fn f1(x: &X) { f2::(x); - //~^ ERROR `X: std::marker::Sized` is not satisfied + //~^ ERROR `X` does not have a constant size known at compile-time } fn f2(x: &X) { } @@ -26,7 +26,7 @@ trait T { } fn f3(x: &X) { f4::(x); - //~^ ERROR `X: std::marker::Sized` is not satisfied + //~^ ERROR `X` does not have a constant size known at compile-time } fn f4(x: &X) { } @@ -41,20 +41,20 @@ struct S { fn f8(x1: &S, x2: &S) { f5(x1); - //~^ ERROR `X: std::marker::Sized` is not satisfied + //~^ ERROR `X` does not have a constant size known at compile-time f6(x2); // ok } // Test some tuples. fn f9(x1: Box>) { f5(&(*x1, 34)); - //~^ ERROR `X: std::marker::Sized` is not satisfied + //~^ ERROR `X` does not have a constant size known at compile-time } fn f10(x1: Box>) { f5(&(32, *x1)); - //~^ ERROR `X: std::marker::Sized` is not satisfied - //~| ERROR `X: std::marker::Sized` is not satisfied + //~^ ERROR `X` does not have a constant size known at compile-time + //~| ERROR `X` does not have a constant size known at compile-time } pub fn main() { diff --git a/src/test/compile-fail/unsized5.rs b/src/test/compile-fail/unsized5.rs index 3e6c9cc4061e1..1fb32da5e319f 100644 --- a/src/test/compile-fail/unsized5.rs +++ b/src/test/compile-fail/unsized5.rs @@ -11,27 +11,33 @@ // Test `?Sized` types not allowed in fields (except the last one). struct S1 { - f1: X, //~ ERROR `X: std::marker::Sized` is not satisfied + f1: X, + //~^ ERROR `X` does not have a constant size known at compile-time f2: isize, } struct S2 { f: isize, - g: X, //~ ERROR `X: std::marker::Sized` is not satisfied + g: X, + //~^ ERROR `X` does not have a constant size known at compile-time h: isize, } struct S3 { - f: str, //~ ERROR `str: std::marker::Sized` is not satisfied + f: str, + //~^ ERROR `str` does not have a constant size known at compile-time g: [usize] } struct S4 { - f: [u8], //~ ERROR `[u8]: std::marker::Sized` is not satisfied + f: [u8], + //~^ ERROR `[u8]` does not have a constant size known at compile-time g: usize } enum E { - V1(X, isize), //~ERROR `X: std::marker::Sized` is not satisfied + V1(X, isize), + //~^ ERROR `X` does not have a constant size known at compile-time } enum F { - V2{f1: X, f: isize}, //~ERROR `X: std::marker::Sized` is not satisfied + V2{f1: X, f: isize}, + //~^ ERROR `X` does not have a constant size known at compile-time } pub fn main() { diff --git a/src/test/compile-fail/unsized6.rs b/src/test/compile-fail/unsized6.rs index dec8699f46e3b..7ce0e1eb4d850 100644 --- a/src/test/compile-fail/unsized6.rs +++ b/src/test/compile-fail/unsized6.rs @@ -14,28 +14,41 @@ trait T {} fn f1(x: &X) { let _: W; // <-- this is OK, no bindings created, no initializer. - let _: (isize, (X, isize)); //~ERROR `X: std::marker::Sized` is not satisfie - let y: Y; //~ERROR `Y: std::marker::Sized` is not satisfied - let y: (isize, (Z, usize)); //~ERROR `Z: std::marker::Sized` is not satisfied + let _: (isize, (X, isize)); + //~^ ERROR `X` does not have a constant size known at compile-time + let y: Y; + //~^ ERROR `Y` does not have a constant size known at compile-time + let y: (isize, (Z, usize)); + //~^ ERROR `Z` does not have a constant size known at compile-time } fn f2(x: &X) { - let y: X; //~ERROR `X: std::marker::Sized` is not satisfied - let y: (isize, (Y, isize)); //~ERROR `Y: std::marker::Sized` is not satisfied + let y: X; + //~^ ERROR `X` does not have a constant size known at compile-time + let y: (isize, (Y, isize)); + //~^ ERROR `Y` does not have a constant size known at compile-time } fn f3(x1: Box, x2: Box, x3: Box) { - let y: X = *x1; //~ERROR `X: std::marker::Sized` is not satisfied - let y = *x2; //~ERROR `X: std::marker::Sized` is not satisfied - let (y, z) = (*x3, 4); //~ERROR `X: std::marker::Sized` is not satisfied + let y: X = *x1; + //~^ ERROR `X` does not have a constant size known at compile-time + let y = *x2; + //~^ ERROR `X` does not have a constant size known at compile-time + let (y, z) = (*x3, 4); + //~^ ERROR `X` does not have a constant size known at compile-time } fn f4(x1: Box, x2: Box, x3: Box) { - let y: X = *x1; //~ERROR `X: std::marker::Sized` is not satisfied - let y = *x2; //~ERROR `X: std::marker::Sized` is not satisfied - let (y, z) = (*x3, 4); //~ERROR `X: std::marker::Sized` is not satisfied + let y: X = *x1; + //~^ ERROR `X` does not have a constant size known at compile-time + let y = *x2; + //~^ ERROR `X` does not have a constant size known at compile-time + let (y, z) = (*x3, 4); + //~^ ERROR `X` does not have a constant size known at compile-time } -fn g1(x: X) {} //~ERROR `X: std::marker::Sized` is not satisfied -fn g2(x: X) {} //~ERROR `X: std::marker::Sized` is not satisfied +fn g1(x: X) {} +//~^ ERROR `X` does not have a constant size known at compile-time +fn g2(x: X) {} +//~^ ERROR `X` does not have a constant size known at compile-time pub fn main() { } diff --git a/src/test/compile-fail/unsized7.rs b/src/test/compile-fail/unsized7.rs index 25868c594feb6..8a3d78f082716 100644 --- a/src/test/compile-fail/unsized7.rs +++ b/src/test/compile-fail/unsized7.rs @@ -20,7 +20,7 @@ trait T1 { struct S3(Box); impl T1 for S3 { - //~^ ERROR `X: std::marker::Sized` is not satisfied + //~^ ERROR `X` does not have a constant size known at compile-time } fn main() { } diff --git a/src/test/ui/const-unsized.rs b/src/test/ui/const-unsized.rs index c6ce34b60ca77..61ee622e21be9 100644 --- a/src/test/ui/const-unsized.rs +++ b/src/test/ui/const-unsized.rs @@ -11,16 +11,16 @@ use std::fmt::Debug; const CONST_0: Debug+Sync = *(&0 as &(Debug+Sync)); -//~^ ERROR `std::fmt::Debug + std::marker::Sync + 'static: std::marker::Sized` is not satisfied +//~^ ERROR `std::fmt::Debug + std::marker::Sync + 'static` does not have a constant size known at const CONST_FOO: str = *"foo"; -//~^ ERROR `str: std::marker::Sized` is not satisfied +//~^ ERROR `str` does not have a constant size known at compile-time static STATIC_1: Debug+Sync = *(&1 as &(Debug+Sync)); -//~^ ERROR `std::fmt::Debug + std::marker::Sync + 'static: std::marker::Sized` is not satisfied +//~^ ERROR `std::fmt::Debug + std::marker::Sync + 'static` does not have a constant size known at static STATIC_BAR: str = *"bar"; -//~^ ERROR `str: std::marker::Sized` is not satisfied +//~^ ERROR `str` does not have a constant size known at compile-time fn main() { println!("{:?} {:?} {:?} {:?}", &CONST_0, &CONST_FOO, &STATIC_1, &STATIC_BAR); diff --git a/src/test/ui/const-unsized.stderr b/src/test/ui/const-unsized.stderr index 0bbb5debbba69..ca434541cc285 100644 --- a/src/test/ui/const-unsized.stderr +++ b/src/test/ui/const-unsized.stderr @@ -1,4 +1,4 @@ -error[E0277]: the trait bound `std::fmt::Debug + std::marker::Sync + 'static: std::marker::Sized` is not satisfied +error[E0277]: `std::fmt::Debug + std::marker::Sync + 'static` does not have a constant size known at compile-time --> $DIR/const-unsized.rs:13:29 | LL | const CONST_0: Debug+Sync = *(&0 as &(Debug+Sync)); @@ -7,7 +7,7 @@ LL | const CONST_0: Debug+Sync = *(&0 as &(Debug+Sync)); = help: the trait `std::marker::Sized` is not implemented for `std::fmt::Debug + std::marker::Sync + 'static` = note: constant expressions must have a statically known size -error[E0277]: the trait bound `str: std::marker::Sized` is not satisfied +error[E0277]: `str` does not have a constant size known at compile-time --> $DIR/const-unsized.rs:16:24 | LL | const CONST_FOO: str = *"foo"; @@ -16,7 +16,7 @@ LL | const CONST_FOO: str = *"foo"; = help: the trait `std::marker::Sized` is not implemented for `str` = note: constant expressions must have a statically known size -error[E0277]: the trait bound `std::fmt::Debug + std::marker::Sync + 'static: std::marker::Sized` is not satisfied +error[E0277]: `std::fmt::Debug + std::marker::Sync + 'static` does not have a constant size known at compile-time --> $DIR/const-unsized.rs:19:31 | LL | static STATIC_1: Debug+Sync = *(&1 as &(Debug+Sync)); @@ -25,7 +25,7 @@ LL | static STATIC_1: Debug+Sync = *(&1 as &(Debug+Sync)); = help: the trait `std::marker::Sized` is not implemented for `std::fmt::Debug + std::marker::Sync + 'static` = note: constant expressions must have a statically known size -error[E0277]: the trait bound `str: std::marker::Sized` is not satisfied +error[E0277]: `str` does not have a constant size known at compile-time --> $DIR/const-unsized.rs:22:26 | LL | static STATIC_BAR: str = *"bar"; diff --git a/src/test/ui/error-codes/E0277-2.rs b/src/test/ui/error-codes/E0277-2.rs index 4d1c50002a39c..313aa1f706e93 100644 --- a/src/test/ui/error-codes/E0277-2.rs +++ b/src/test/ui/error-codes/E0277-2.rs @@ -24,5 +24,5 @@ fn is_send() { } fn main() { is_send::(); - //~^ ERROR the trait bound `*const u8: std::marker::Send` is not satisfied in `Foo` + //~^ ERROR `*const u8` cannot be sent between threads safely } diff --git a/src/test/ui/error-codes/E0277-2.stderr b/src/test/ui/error-codes/E0277-2.stderr index bbe04cfc6e16d..32776f028b4ce 100644 --- a/src/test/ui/error-codes/E0277-2.stderr +++ b/src/test/ui/error-codes/E0277-2.stderr @@ -1,4 +1,4 @@ -error[E0277]: the trait bound `*const u8: std::marker::Send` is not satisfied in `Foo` +error[E0277]: `*const u8` cannot be sent between threads safely --> $DIR/E0277-2.rs:26:5 | LL | is_send::(); diff --git a/src/test/ui/error-codes/E0277.rs b/src/test/ui/error-codes/E0277.rs index b29e435701507..9ff2ef4da90bc 100644 --- a/src/test/ui/error-codes/E0277.rs +++ b/src/test/ui/error-codes/E0277.rs @@ -21,7 +21,7 @@ fn some_func(foo: T) { } fn f(p: Path) { } -//~^ ERROR the trait bound `[u8]: std::marker::Sized` is not satisfied in `std::path::Path` +//~^ ERROR `[u8]` does not have a constant size known at compile-time fn main() { some_func(5i32); diff --git a/src/test/ui/error-codes/E0277.stderr b/src/test/ui/error-codes/E0277.stderr index 477128d7d9f08..9cfd42b9c195d 100644 --- a/src/test/ui/error-codes/E0277.stderr +++ b/src/test/ui/error-codes/E0277.stderr @@ -1,4 +1,4 @@ -error[E0277]: the trait bound `[u8]: std::marker::Sized` is not satisfied in `std::path::Path` +error[E0277]: `[u8]` does not have a constant size known at compile-time --> $DIR/E0277.rs:23:6 | LL | fn f(p: Path) { } diff --git a/src/test/ui/feature-gate-trivial_bounds.stderr b/src/test/ui/feature-gate-trivial_bounds.stderr index 9c2c80600b8c8..3c6d87e059a2f 100644 --- a/src/test/ui/feature-gate-trivial_bounds.stderr +++ b/src/test/ui/feature-gate-trivial_bounds.stderr @@ -87,7 +87,7 @@ LL | | } = help: see issue #48214 = help: add #![feature(trivial_bounds)] to the crate attributes to enable -error[E0277]: the trait bound `str: std::marker::Sized` is not satisfied +error[E0277]: `str` does not have a constant size known at compile-time --> $DIR/feature-gate-trivial_bounds.rs:62:1 | LL | struct TwoStrs(str, str) where str: Sized; //~ ERROR @@ -97,7 +97,7 @@ LL | struct TwoStrs(str, str) where str: Sized; //~ ERROR = help: see issue #48214 = help: add #![feature(trivial_bounds)] to the crate attributes to enable -error[E0277]: the trait bound `A + 'static: std::marker::Sized` is not satisfied in `Dst` +error[E0277]: `A + 'static` does not have a constant size known at compile-time --> $DIR/feature-gate-trivial_bounds.rs:65:1 | LL | / fn unsized_local() where Dst: Sized { //~ ERROR @@ -110,7 +110,7 @@ LL | | } = help: see issue #48214 = help: add #![feature(trivial_bounds)] to the crate attributes to enable -error[E0277]: the trait bound `str: std::marker::Sized` is not satisfied +error[E0277]: `str` does not have a constant size known at compile-time --> $DIR/feature-gate-trivial_bounds.rs:69:1 | LL | / fn return_str() -> str where str: Sized { //~ ERROR diff --git a/src/test/ui/generator/sized-yield.rs b/src/test/ui/generator/sized-yield.rs index a1c8ca77e41e8..165e27025973d 100644 --- a/src/test/ui/generator/sized-yield.rs +++ b/src/test/ui/generator/sized-yield.rs @@ -14,8 +14,10 @@ use std::ops::Generator; fn main() { let s = String::from("foo"); - let mut gen = move || { //~ ERROR the trait bound `str: std::marker::Sized` is not satisfied + let mut gen = move || { + //~^ ERROR `str` does not have a constant size known at compile-time yield s[..]; }; - unsafe { gen.resume(); } //~ ERROR the trait bound `str: std::marker::Sized` is not satisfied + unsafe { gen.resume(); } + //~^ ERROR `str` does not have a constant size known at compile-time } diff --git a/src/test/ui/generator/sized-yield.stderr b/src/test/ui/generator/sized-yield.stderr index 957fac172c258..45f0665905368 100644 --- a/src/test/ui/generator/sized-yield.stderr +++ b/src/test/ui/generator/sized-yield.stderr @@ -1,8 +1,9 @@ -error[E0277]: the trait bound `str: std::marker::Sized` is not satisfied +error[E0277]: `str` does not have a constant size known at compile-time --> $DIR/sized-yield.rs:17:26 | -LL | let mut gen = move || { //~ ERROR the trait bound `str: std::marker::Sized` is not satisfied +LL | let mut gen = move || { | __________________________^ +LL | | //~^ ERROR `str` does not have a constant size known at compile-time LL | | yield s[..]; LL | | }; | |____^ `str` does not have a constant size known at compile-time @@ -10,10 +11,10 @@ LL | | }; = help: the trait `std::marker::Sized` is not implemented for `str` = note: the yield type of a generator must have a statically known size -error[E0277]: the trait bound `str: std::marker::Sized` is not satisfied - --> $DIR/sized-yield.rs:20:17 +error[E0277]: `str` does not have a constant size known at compile-time + --> $DIR/sized-yield.rs:21:17 | -LL | unsafe { gen.resume(); } //~ ERROR the trait bound `str: std::marker::Sized` is not satisfied +LL | unsafe { gen.resume(); } | ^^^^^^ `str` does not have a constant size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `str` diff --git a/src/test/ui/impl-trait/auto-trait-leak.rs b/src/test/ui/impl-trait/auto-trait-leak.rs index abb3682a4987a..f6b64b394fc12 100644 --- a/src/test/ui/impl-trait/auto-trait-leak.rs +++ b/src/test/ui/impl-trait/auto-trait-leak.rs @@ -25,7 +25,7 @@ fn cycle1() -> impl Clone { //~^ ERROR cycle detected //~| ERROR cycle detected send(cycle2().clone()); - //~^ ERROR Send` is not satisfied + //~^ ERROR `std::rc::Rc` cannot be sent between threads safely Rc::new(Cell::new(5)) } diff --git a/src/test/ui/impl-trait/auto-trait-leak.stderr b/src/test/ui/impl-trait/auto-trait-leak.stderr index 4537c96c4ab3b..b34facd2d39ce 100644 --- a/src/test/ui/impl-trait/auto-trait-leak.stderr +++ b/src/test/ui/impl-trait/auto-trait-leak.stderr @@ -47,7 +47,7 @@ LL | fn cycle2() -> impl Clone { | ^^^^^^^^^^^^^^^^^^^^^^^^^ = note: ...which again requires processing `cycle1::{{exist-impl-Trait}}`, completing the cycle -error[E0277]: the trait bound `std::rc::Rc: std::marker::Send` is not satisfied in `impl std::clone::Clone` +error[E0277]: `std::rc::Rc` cannot be sent between threads safely --> $DIR/auto-trait-leak.rs:27:5 | LL | send(cycle2().clone()); diff --git a/src/test/ui/impl-trait/auto-trait-leak2.rs b/src/test/ui/impl-trait/auto-trait-leak2.rs index 16310e67f1bb9..3c61543a711bd 100644 --- a/src/test/ui/impl-trait/auto-trait-leak2.rs +++ b/src/test/ui/impl-trait/auto-trait-leak2.rs @@ -23,10 +23,10 @@ fn send(_: T) {} fn main() { send(before()); - //~^ ERROR the trait bound `std::rc::Rc>: std::marker::Send` is not satisfied + //~^ ERROR `std::rc::Rc>` cannot be sent between threads safely send(after()); - //~^ ERROR the trait bound `std::rc::Rc>: std::marker::Send` is not satisfied + //~^ ERROR `std::rc::Rc>` cannot be sent between threads safely } // Deferred path, main has to wait until typeck finishes, diff --git a/src/test/ui/impl-trait/auto-trait-leak2.stderr b/src/test/ui/impl-trait/auto-trait-leak2.stderr index 59623aed3d2b7..fb00c41f79c8f 100644 --- a/src/test/ui/impl-trait/auto-trait-leak2.stderr +++ b/src/test/ui/impl-trait/auto-trait-leak2.stderr @@ -1,4 +1,4 @@ -error[E0277]: the trait bound `std::rc::Rc>: std::marker::Send` is not satisfied in `impl std::ops::Fn<(i32,)>` +error[E0277]: `std::rc::Rc>` cannot be sent between threads safely --> $DIR/auto-trait-leak2.rs:25:5 | LL | send(before()); @@ -13,7 +13,7 @@ note: required by `send` LL | fn send(_: T) {} | ^^^^^^^^^^^^^^^^^^^^^^ -error[E0277]: the trait bound `std::rc::Rc>: std::marker::Send` is not satisfied in `impl std::ops::Fn<(i32,)>` +error[E0277]: `std::rc::Rc>` cannot be sent between threads safely --> $DIR/auto-trait-leak2.rs:28:5 | LL | send(after()); diff --git a/src/test/ui/interior-mutability/interior-mutability.rs b/src/test/ui/interior-mutability/interior-mutability.rs index a772d1f90cc0b..b0288463e9157 100644 --- a/src/test/ui/interior-mutability/interior-mutability.rs +++ b/src/test/ui/interior-mutability/interior-mutability.rs @@ -12,5 +12,6 @@ use std::cell::Cell; use std::panic::catch_unwind; fn main() { let mut x = Cell::new(22); - catch_unwind(|| { x.set(23); }); //~ ERROR the trait bound + catch_unwind(|| { x.set(23); }); + //~^ ERROR the type `std::cell::UnsafeCell` may contain interior mutability and a } diff --git a/src/test/ui/interior-mutability/interior-mutability.stderr b/src/test/ui/interior-mutability/interior-mutability.stderr index 4c489c5964ba7..f2aecc55ccb41 100644 --- a/src/test/ui/interior-mutability/interior-mutability.stderr +++ b/src/test/ui/interior-mutability/interior-mutability.stderr @@ -1,8 +1,8 @@ -error[E0277]: the trait bound `std::cell::UnsafeCell: std::panic::RefUnwindSafe` is not satisfied in `std::cell::Cell` +error[E0277]: the type `std::cell::UnsafeCell` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary --> $DIR/interior-mutability.rs:15:5 | -LL | catch_unwind(|| { x.set(23); }); //~ ERROR the trait bound - | ^^^^^^^^^^^^ the type std::cell::UnsafeCell may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary +LL | catch_unwind(|| { x.set(23); }); + | ^^^^^^^^^^^^ `std::cell::UnsafeCell` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary | = help: within `std::cell::Cell`, the trait `std::panic::RefUnwindSafe` is not implemented for `std::cell::UnsafeCell` = note: required because it appears within the type `std::cell::Cell` diff --git a/src/test/ui/mismatched_types/binops.rs b/src/test/ui/mismatched_types/binops.rs index 3f2cb59b11dee..86785f24f3637 100644 --- a/src/test/ui/mismatched_types/binops.rs +++ b/src/test/ui/mismatched_types/binops.rs @@ -13,6 +13,6 @@ fn main() { 2 as usize - Some(1); //~ ERROR cannot subtract `std::option::Option<{integer}>` from `usize` 3 * (); //~ ERROR cannot multiply `()` to `{integer}` 4 / ""; //~ ERROR cannot divide `{integer}` by `&str` - 5 < String::new(); //~ ERROR is not satisfied - 6 == Ok(1); //~ ERROR is not satisfied + 5 < String::new(); //~ ERROR can't compare `{integer}` with `std::string::String` + 6 == Ok(1); //~ ERROR can't compare `{integer}` with `std::result::Result<{integer}, _>` } diff --git a/src/test/ui/mismatched_types/binops.stderr b/src/test/ui/mismatched_types/binops.stderr index 9d23b256fd333..4c6d95efadb15 100644 --- a/src/test/ui/mismatched_types/binops.stderr +++ b/src/test/ui/mismatched_types/binops.stderr @@ -30,19 +30,19 @@ LL | 4 / ""; //~ ERROR cannot divide `{integer}` by `&str` | = help: the trait `std::ops::Div<&str>` is not implemented for `{integer}` -error[E0277]: the trait bound `{integer}: std::cmp::PartialOrd` is not satisfied +error[E0277]: can't compare `{integer}` with `std::string::String` --> $DIR/binops.rs:16:7 | -LL | 5 < String::new(); //~ ERROR is not satisfied - | ^ can't compare `{integer}` with `std::string::String` +LL | 5 < String::new(); //~ ERROR can't compare `{integer}` with `std::string::String` + | ^ no implementation for `{integer} < std::string::String` and `{integer} > std::string::String` | = help: the trait `std::cmp::PartialOrd` is not implemented for `{integer}` -error[E0277]: the trait bound `{integer}: std::cmp::PartialEq>` is not satisfied +error[E0277]: can't compare `{integer}` with `std::result::Result<{integer}, _>` --> $DIR/binops.rs:17:7 | -LL | 6 == Ok(1); //~ ERROR is not satisfied - | ^^ can't compare `{integer}` with `std::result::Result<{integer}, _>` +LL | 6 == Ok(1); //~ ERROR can't compare `{integer}` with `std::result::Result<{integer}, _>` + | ^^ no implementation for `{integer} == std::result::Result<{integer}, _>` | = help: the trait `std::cmp::PartialEq>` is not implemented for `{integer}` diff --git a/src/test/ui/mismatched_types/cast-rfc0401.rs b/src/test/ui/mismatched_types/cast-rfc0401.rs index 15388b3a7647f..7ec9593d2dec7 100644 --- a/src/test/ui/mismatched_types/cast-rfc0401.rs +++ b/src/test/ui/mismatched_types/cast-rfc0401.rs @@ -60,7 +60,7 @@ fn main() let _ = 42usize as *const [u8]; //~ ERROR is invalid let _ = v as *const [u8]; //~ ERROR cannot cast - let _ = fat_v as *const Foo; //~ ERROR is not satisfied + let _ = fat_v as *const Foo; //~ ERROR `[u8]` does not have a constant size known at compile-time let _ = foo as *const str; //~ ERROR is invalid let _ = foo as *mut str; //~ ERROR is invalid let _ = main as *mut str; //~ ERROR is invalid @@ -69,7 +69,7 @@ fn main() let _ = fat_sv as usize; //~ ERROR is invalid let a : *const str = "hello"; - let _ = a as *const Foo; //~ ERROR is not satisfied + let _ = a as *const Foo; //~ ERROR `str` does not have a constant size known at compile-time // check no error cascade let _ = main.f as *const u32; //~ ERROR no field diff --git a/src/test/ui/mismatched_types/cast-rfc0401.stderr b/src/test/ui/mismatched_types/cast-rfc0401.stderr index 7931e7ff07f4c..2b00c20e201ff 100644 --- a/src/test/ui/mismatched_types/cast-rfc0401.stderr +++ b/src/test/ui/mismatched_types/cast-rfc0401.stderr @@ -216,19 +216,19 @@ LL | let _ = cf as *const Bar; //~ ERROR is invalid | = note: vtable kinds may not match -error[E0277]: the trait bound `[u8]: std::marker::Sized` is not satisfied +error[E0277]: `[u8]` does not have a constant size known at compile-time --> $DIR/cast-rfc0401.rs:63:13 | -LL | let _ = fat_v as *const Foo; //~ ERROR is not satisfied +LL | let _ = fat_v as *const Foo; //~ ERROR `[u8]` does not have a constant size known at compile-time | ^^^^^ `[u8]` does not have a constant size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `[u8]` = note: required for the cast to the object type `Foo` -error[E0277]: the trait bound `str: std::marker::Sized` is not satisfied +error[E0277]: `str` does not have a constant size known at compile-time --> $DIR/cast-rfc0401.rs:72:13 | -LL | let _ = a as *const Foo; //~ ERROR is not satisfied +LL | let _ = a as *const Foo; //~ ERROR `str` does not have a constant size known at compile-time | ^ `str` does not have a constant size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `str` diff --git a/src/test/ui/partialeq_help.stderr b/src/test/ui/partialeq_help.stderr index c813b64d40b58..43f13d45684e8 100644 --- a/src/test/ui/partialeq_help.stderr +++ b/src/test/ui/partialeq_help.stderr @@ -1,8 +1,8 @@ -error[E0277]: the trait bound `&T: std::cmp::PartialEq` is not satisfied +error[E0277]: can't compare `&T` with `T` --> $DIR/partialeq_help.rs:12:7 | LL | a == b; //~ ERROR E0277 - | ^^ can't compare `&T` with `T` + | ^^ no implementation for `&T == T` | = help: the trait `std::cmp::PartialEq` is not implemented for `&T` = help: consider adding a `where &T: std::cmp::PartialEq` bound diff --git a/src/test/ui/resolve/issue-5035-2.rs b/src/test/ui/resolve/issue-5035-2.rs index 83ff95cc2ea48..f6cdb05394a47 100644 --- a/src/test/ui/resolve/issue-5035-2.rs +++ b/src/test/ui/resolve/issue-5035-2.rs @@ -11,6 +11,7 @@ trait I {} type K = I+'static; -fn foo(_x: K) {} //~ ERROR: `I + 'static: std::marker::Sized` is not satisfied +fn foo(_x: K) {} +//~^ ERROR `I + 'static` does not have a constant size known at compile-time fn main() {} diff --git a/src/test/ui/resolve/issue-5035-2.stderr b/src/test/ui/resolve/issue-5035-2.stderr index 92309274e8442..554e97a12815c 100644 --- a/src/test/ui/resolve/issue-5035-2.stderr +++ b/src/test/ui/resolve/issue-5035-2.stderr @@ -1,7 +1,7 @@ -error[E0277]: the trait bound `I + 'static: std::marker::Sized` is not satisfied +error[E0277]: `I + 'static` does not have a constant size known at compile-time --> $DIR/issue-5035-2.rs:14:8 | -LL | fn foo(_x: K) {} //~ ERROR: `I + 'static: std::marker::Sized` is not satisfied +LL | fn foo(_x: K) {} | ^^ `I + 'static` does not have a constant size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `I + 'static` diff --git a/src/test/ui/suggestions/str-array-assignment.rs b/src/test/ui/suggestions/str-array-assignment.rs index b70028bd926c6..f6b75981a662b 100644 --- a/src/test/ui/suggestions/str-array-assignment.rs +++ b/src/test/ui/suggestions/str-array-assignment.rs @@ -15,7 +15,7 @@ fn main() { let u: &str = if true { s[..2] } else { s }; //~^ ERROR mismatched types let v = s[..2]; - //~^ ERROR the trait bound `str: std::marker::Sized` is not satisfied + //~^ ERROR `str` does not have a constant size known at compile-time let w: &str = s[..2]; //~^ ERROR mismatched types } diff --git a/src/test/ui/suggestions/str-array-assignment.stderr b/src/test/ui/suggestions/str-array-assignment.stderr index 76db882742a01..91e86e344b41c 100644 --- a/src/test/ui/suggestions/str-array-assignment.stderr +++ b/src/test/ui/suggestions/str-array-assignment.stderr @@ -19,7 +19,7 @@ LL | let u: &str = if true { s[..2] } else { s }; = note: expected type `&str` found type `str` -error[E0277]: the trait bound `str: std::marker::Sized` is not satisfied +error[E0277]: `str` does not have a constant size known at compile-time --> $DIR/str-array-assignment.rs:17:7 | LL | let v = s[..2]; diff --git a/src/test/ui/trait-suggest-where-clause.rs b/src/test/ui/trait-suggest-where-clause.rs index 5dcb4c8a220ba..7962dbea3711f 100644 --- a/src/test/ui/trait-suggest-where-clause.rs +++ b/src/test/ui/trait-suggest-where-clause.rs @@ -15,10 +15,10 @@ struct Misc(T); fn check() { // suggest a where-clause, if needed mem::size_of::(); - //~^ ERROR `U: std::marker::Sized` is not satisfied + //~^ ERROR `U` does not have a constant size known at compile-time mem::size_of::>(); - //~^ ERROR `U: std::marker::Sized` is not satisfied + //~^ ERROR `U` does not have a constant size known at compile-time // ... even if T occurs as a type parameter @@ -36,10 +36,10 @@ fn check() { // ... and also not if the error is not related to the type mem::size_of::<[T]>(); - //~^ ERROR `[T]: std::marker::Sized` is not satisfied + //~^ ERROR `[T]` does not have a constant size known at compile-time mem::size_of::<[&U]>(); - //~^ ERROR `[&U]: std::marker::Sized` is not satisfied + //~^ ERROR `[&U]` does not have a constant size known at compile-time } fn main() { diff --git a/src/test/ui/trait-suggest-where-clause.stderr b/src/test/ui/trait-suggest-where-clause.stderr index abd9f5a8b73f7..d31e928803721 100644 --- a/src/test/ui/trait-suggest-where-clause.stderr +++ b/src/test/ui/trait-suggest-where-clause.stderr @@ -1,4 +1,4 @@ -error[E0277]: the trait bound `U: std::marker::Sized` is not satisfied +error[E0277]: `U` does not have a constant size known at compile-time --> $DIR/trait-suggest-where-clause.rs:17:5 | LL | mem::size_of::(); @@ -8,7 +8,7 @@ LL | mem::size_of::(); = help: consider adding a `where U: std::marker::Sized` bound = note: required by `std::mem::size_of` -error[E0277]: the trait bound `U: std::marker::Sized` is not satisfied in `Misc` +error[E0277]: `U` does not have a constant size known at compile-time --> $DIR/trait-suggest-where-clause.rs:20:5 | LL | mem::size_of::>(); @@ -45,7 +45,7 @@ LL | as From>::from; | = note: required by `std::convert::From::from` -error[E0277]: the trait bound `[T]: std::marker::Sized` is not satisfied +error[E0277]: `[T]` does not have a constant size known at compile-time --> $DIR/trait-suggest-where-clause.rs:38:5 | LL | mem::size_of::<[T]>(); @@ -54,7 +54,7 @@ LL | mem::size_of::<[T]>(); = help: the trait `std::marker::Sized` is not implemented for `[T]` = note: required by `std::mem::size_of` -error[E0277]: the trait bound `[&U]: std::marker::Sized` is not satisfied +error[E0277]: `[&U]` does not have a constant size known at compile-time --> $DIR/trait-suggest-where-clause.rs:41:5 | LL | mem::size_of::<[&U]>(); diff --git a/src/test/ui/trivial-bounds-leak.stderr b/src/test/ui/trivial-bounds-leak.stderr index df91ba0dd2ac5..d54414110b1f8 100644 --- a/src/test/ui/trivial-bounds-leak.stderr +++ b/src/test/ui/trivial-bounds-leak.stderr @@ -1,4 +1,4 @@ -error[E0277]: the trait bound `str: std::marker::Sized` is not satisfied +error[E0277]: `str` does not have a constant size known at compile-time --> $DIR/trivial-bounds-leak.rs:22:25 | LL | fn cant_return_str() -> str { //~ ERROR diff --git a/src/test/ui/type-check-defaults.rs b/src/test/ui/type-check-defaults.rs index f916df5d32d04..92a45db068968 100644 --- a/src/test/ui/type-check-defaults.rs +++ b/src/test/ui/type-check-defaults.rs @@ -14,24 +14,24 @@ use std::ops::Add; struct Foo>(T, U); struct WellFormed>(Z); -//~^ error: the trait bound `i32: std::iter::FromIterator` is not satisfied [E0277] +//~^ ERROR a collection of type `i32` cannot be built from an iterator over elements of type `i32` struct WellFormedNoBounds>(Z); -//~^ error: the trait bound `i32: std::iter::FromIterator` is not satisfied [E0277] +//~^ ERROR a collection of type `i32` cannot be built from an iterator over elements of type `i32` struct Bounds(T); -//~^ error: the trait bound `std::string::String: std::marker::Copy` is not satisfied [E0277] +//~^ ERROR the trait bound `std::string::String: std::marker::Copy` is not satisfied [E0277] struct WhereClause(T) where T: Copy; -//~^ error: the trait bound `std::string::String: std::marker::Copy` is not satisfied [E0277] +//~^ ERROR the trait bound `std::string::String: std::marker::Copy` is not satisfied [E0277] trait TraitBound {} -//~^ error: the trait bound `std::string::String: std::marker::Copy` is not satisfied [E0277] +//~^ ERROR the trait bound `std::string::String: std::marker::Copy` is not satisfied [E0277] trait Super { } trait Base: Super { } -//~^ error: the trait bound `T: std::marker::Copy` is not satisfied [E0277] +//~^ ERROR the trait bound `T: std::marker::Copy` is not satisfied [E0277] trait ProjectionPred> where T::Item : Add {} -//~^ error: cannot add `u8` to `i32` [E0277] +//~^ ERROR cannot add `u8` to `i32` [E0277] fn main() { } diff --git a/src/test/ui/type-check-defaults.stderr b/src/test/ui/type-check-defaults.stderr index a2d6e53df0502..aa124110243a5 100644 --- a/src/test/ui/type-check-defaults.stderr +++ b/src/test/ui/type-check-defaults.stderr @@ -1,8 +1,8 @@ -error[E0277]: the trait bound `i32: std::iter::FromIterator` is not satisfied +error[E0277]: a collection of type `i32` cannot be built from an iterator over elements of type `i32` --> $DIR/type-check-defaults.rs:16:19 | LL | struct WellFormed>(Z); - | ^ a collection of type `i32` cannot be built from an iterator over elements of type `i32` + | ^ a collection of type `i32` cannot be built from `std::iter::Iterator` | = help: the trait `std::iter::FromIterator` is not implemented for `i32` note: required by `Foo` @@ -11,11 +11,11 @@ note: required by `Foo` LL | struct Foo>(T, U); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error[E0277]: the trait bound `i32: std::iter::FromIterator` is not satisfied +error[E0277]: a collection of type `i32` cannot be built from an iterator over elements of type `i32` --> $DIR/type-check-defaults.rs:18:27 | LL | struct WellFormedNoBounds>(Z); - | ^ a collection of type `i32` cannot be built from an iterator over elements of type `i32` + | ^ a collection of type `i32` cannot be built from `std::iter::Iterator` | = help: the trait `std::iter::FromIterator` is not implemented for `i32` note: required by `Foo` diff --git a/src/test/ui/union/union-sized-field.rs b/src/test/ui/union/union-sized-field.rs index 8999f1e0930be..e40c6d11cb32c 100644 --- a/src/test/ui/union/union-sized-field.rs +++ b/src/test/ui/union/union-sized-field.rs @@ -11,16 +11,19 @@ #![feature(untagged_unions)] union Foo { - value: T, //~ ERROR the trait bound `T: std::marker::Sized` is not satisfied + value: T, + //~^ ERROR `T` does not have a constant size known at compile-time } struct Foo2 { - value: T, //~ ERROR the trait bound `T: std::marker::Sized` is not satisfied + value: T, + //~^ ERROR `T` does not have a constant size known at compile-time t: u32, } enum Foo3 { - Value(T), //~ ERROR the trait bound `T: std::marker::Sized` is not satisfied + Value(T), + //~^ ERROR `T` does not have a constant size known at compile-time } fn main() {} diff --git a/src/test/ui/union/union-sized-field.stderr b/src/test/ui/union/union-sized-field.stderr index ba80af6c7e037..ce6de86cff9b9 100644 --- a/src/test/ui/union/union-sized-field.stderr +++ b/src/test/ui/union/union-sized-field.stderr @@ -1,27 +1,27 @@ -error[E0277]: the trait bound `T: std::marker::Sized` is not satisfied +error[E0277]: `T` does not have a constant size known at compile-time --> $DIR/union-sized-field.rs:14:5 | -LL | value: T, //~ ERROR the trait bound `T: std::marker::Sized` is not satisfied +LL | value: T, | ^^^^^^^^ `T` does not have a constant size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `T` = help: consider adding a `where T: std::marker::Sized` bound = note: no field of a union may have a dynamically sized type -error[E0277]: the trait bound `T: std::marker::Sized` is not satisfied - --> $DIR/union-sized-field.rs:18:5 +error[E0277]: `T` does not have a constant size known at compile-time + --> $DIR/union-sized-field.rs:19:5 | -LL | value: T, //~ ERROR the trait bound `T: std::marker::Sized` is not satisfied +LL | value: T, | ^^^^^^^^ `T` does not have a constant size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `T` = help: consider adding a `where T: std::marker::Sized` bound = note: only the last field of a struct may have a dynamically sized type -error[E0277]: the trait bound `T: std::marker::Sized` is not satisfied - --> $DIR/union-sized-field.rs:23:11 +error[E0277]: `T` does not have a constant size known at compile-time + --> $DIR/union-sized-field.rs:25:11 | -LL | Value(T), //~ ERROR the trait bound `T: std::marker::Sized` is not satisfied +LL | Value(T), | ^ `T` does not have a constant size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `T` diff --git a/src/test/ui/unsized-enum2.rs b/src/test/ui/unsized-enum2.rs index 95fc3243fbed3..4e42b92289b36 100644 --- a/src/test/ui/unsized-enum2.rs +++ b/src/test/ui/unsized-enum2.rs @@ -30,37 +30,54 @@ struct Path4(PathHelper4); enum E { // parameter - VA(W), //~ ERROR `W: std::marker::Sized` is not satisfied - VB{x: X}, //~ ERROR `X: std::marker::Sized` is not satisfied - VC(isize, Y), //~ ERROR `Y: std::marker::Sized` is not satisfied - VD{u: isize, x: Z}, //~ ERROR `Z: std::marker::Sized` is not satisfied + VA(W), + //~^ ERROR `W` does not have a constant size known at compile-time + VB{x: X}, + //~^ ERROR `X` does not have a constant size known at compile-time + VC(isize, Y), + //~^ ERROR `Y` does not have a constant size known at compile-time + VD{u: isize, x: Z}, + //~^ ERROR `Z` does not have a constant size known at compile-time // slice / str - VE([u8]), //~ ERROR `[u8]: std::marker::Sized` is not satisfied - VF{x: str}, //~ ERROR `str: std::marker::Sized` is not satisfied - VG(isize, [f32]), //~ ERROR `[f32]: std::marker::Sized` is not satisfied - VH{u: isize, x: [u32]}, //~ ERROR `[u32]: std::marker::Sized` is not satisfied + VE([u8]), + //~^ ERROR `[u8]` does not have a constant size known at compile-time + VF{x: str}, + //~^ ERROR `str` does not have a constant size known at compile-time + VG(isize, [f32]), + //~^ ERROR `[f32]` does not have a constant size known at compile-time + VH{u: isize, x: [u32]}, + //~^ ERROR `[u32]` does not have a constant size known at compile-time // unsized struct - VI(Path1), //~ ERROR `PathHelper1 + 'static: std::marker::Sized` is not satisfied - VJ{x: Path2}, //~ ERROR `PathHelper2 + 'static: std::marker::Sized` is not satisfied - VK(isize, Path3), //~ ERROR `PathHelper3 + 'static: std::marker::Sized` is not satisfied - VL{u: isize, x: Path4}, //~ ERROR `PathHelper4 + 'static: std::marker::Sized` is not satisfied + VI(Path1), + //~^ ERROR `PathHelper1 + 'static` does not have a constant size known at compile-time + VJ{x: Path2}, + //~^ ERROR `PathHelper2 + 'static` does not have a constant size known at compile-time + VK(isize, Path3), + //~^ ERROR `PathHelper3 + 'static` does not have a constant size known at compile-time + VL{u: isize, x: Path4}, + //~^ ERROR `PathHelper4 + 'static` does not have a constant size known at compile-time // plain trait - VM(Foo), //~ ERROR `Foo + 'static: std::marker::Sized` is not satisfied - VN{x: Bar}, //~ ERROR `Bar + 'static: std::marker::Sized` is not satisfied - VO(isize, FooBar), //~ ERROR `FooBar + 'static: std::marker::Sized` is not satisfied - VP{u: isize, x: BarFoo}, //~ ERROR `BarFoo + 'static: std::marker::Sized` is not satisfied + VM(Foo), + //~^ ERROR `Foo + 'static` does not have a constant size known at compile-time + VN{x: Bar}, + //~^ ERROR `Bar + 'static` does not have a constant size known at compile-time + VO(isize, FooBar), + //~^ ERROR `FooBar + 'static` does not have a constant size known at compile-time + VP{u: isize, x: BarFoo}, + //~^ ERROR `BarFoo + 'static` does not have a constant size known at compile-time // projected - VQ(<&'static [i8] as Deref>::Target), //~ ERROR `[i8]: std::marker::Sized` is not satisfied + VQ(<&'static [i8] as Deref>::Target), + //~^ ERROR `[i8]` does not have a constant size known at compile-time VR{x: <&'static [char] as Deref>::Target}, - //~^ ERROR `[char]: std::marker::Sized` is not satisfied + //~^ ERROR `[char]` does not have a constant size known at compile-time VS(isize, <&'static [f64] as Deref>::Target), - //~^ ERROR `[f64]: std::marker::Sized` is not satisfied + //~^ ERROR `[f64]` does not have a constant size known at compile-time VT{u: isize, x: <&'static [i32] as Deref>::Target}, - //~^ ERROR `[i32]: std::marker::Sized` is not satisfied + //~^ ERROR `[i32]` does not have a constant size known at compile-time } diff --git a/src/test/ui/unsized-enum2.stderr b/src/test/ui/unsized-enum2.stderr index 0e18efbf9da3e..2784bf5af1b9d 100644 --- a/src/test/ui/unsized-enum2.stderr +++ b/src/test/ui/unsized-enum2.stderr @@ -1,126 +1,126 @@ -error[E0277]: the trait bound `W: std::marker::Sized` is not satisfied +error[E0277]: `W` does not have a constant size known at compile-time --> $DIR/unsized-enum2.rs:33:8 | -LL | VA(W), //~ ERROR `W: std::marker::Sized` is not satisfied +LL | VA(W), | ^ `W` does not have a constant size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `W` = help: consider adding a `where W: std::marker::Sized` bound = note: no field of an enum variant may have a dynamically sized type -error[E0277]: the trait bound `X: std::marker::Sized` is not satisfied - --> $DIR/unsized-enum2.rs:34:8 +error[E0277]: `X` does not have a constant size known at compile-time + --> $DIR/unsized-enum2.rs:35:8 | -LL | VB{x: X}, //~ ERROR `X: std::marker::Sized` is not satisfied +LL | VB{x: X}, | ^^^^ `X` does not have a constant size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `X` = help: consider adding a `where X: std::marker::Sized` bound = note: no field of an enum variant may have a dynamically sized type -error[E0277]: the trait bound `Y: std::marker::Sized` is not satisfied - --> $DIR/unsized-enum2.rs:35:15 +error[E0277]: `Y` does not have a constant size known at compile-time + --> $DIR/unsized-enum2.rs:37:15 | -LL | VC(isize, Y), //~ ERROR `Y: std::marker::Sized` is not satisfied +LL | VC(isize, Y), | ^ `Y` does not have a constant size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `Y` = help: consider adding a `where Y: std::marker::Sized` bound = note: no field of an enum variant may have a dynamically sized type -error[E0277]: the trait bound `Z: std::marker::Sized` is not satisfied - --> $DIR/unsized-enum2.rs:36:18 +error[E0277]: `Z` does not have a constant size known at compile-time + --> $DIR/unsized-enum2.rs:39:18 | -LL | VD{u: isize, x: Z}, //~ ERROR `Z: std::marker::Sized` is not satisfied +LL | VD{u: isize, x: Z}, | ^^^^ `Z` does not have a constant size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `Z` = help: consider adding a `where Z: std::marker::Sized` bound = note: no field of an enum variant may have a dynamically sized type -error[E0277]: the trait bound `[u8]: std::marker::Sized` is not satisfied - --> $DIR/unsized-enum2.rs:39:8 +error[E0277]: `[u8]` does not have a constant size known at compile-time + --> $DIR/unsized-enum2.rs:43:8 | -LL | VE([u8]), //~ ERROR `[u8]: std::marker::Sized` is not satisfied +LL | VE([u8]), | ^^^^ `[u8]` does not have a constant size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `[u8]` = note: no field of an enum variant may have a dynamically sized type -error[E0277]: the trait bound `str: std::marker::Sized` is not satisfied - --> $DIR/unsized-enum2.rs:40:8 +error[E0277]: `str` does not have a constant size known at compile-time + --> $DIR/unsized-enum2.rs:45:8 | -LL | VF{x: str}, //~ ERROR `str: std::marker::Sized` is not satisfied +LL | VF{x: str}, | ^^^^^^ `str` does not have a constant size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `str` = note: no field of an enum variant may have a dynamically sized type -error[E0277]: the trait bound `[f32]: std::marker::Sized` is not satisfied - --> $DIR/unsized-enum2.rs:41:15 +error[E0277]: `[f32]` does not have a constant size known at compile-time + --> $DIR/unsized-enum2.rs:47:15 | -LL | VG(isize, [f32]), //~ ERROR `[f32]: std::marker::Sized` is not satisfied +LL | VG(isize, [f32]), | ^^^^^ `[f32]` does not have a constant size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `[f32]` = note: no field of an enum variant may have a dynamically sized type -error[E0277]: the trait bound `[u32]: std::marker::Sized` is not satisfied - --> $DIR/unsized-enum2.rs:42:18 +error[E0277]: `[u32]` does not have a constant size known at compile-time + --> $DIR/unsized-enum2.rs:49:18 | -LL | VH{u: isize, x: [u32]}, //~ ERROR `[u32]: std::marker::Sized` is not satisfied +LL | VH{u: isize, x: [u32]}, | ^^^^^^^^ `[u32]` does not have a constant size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `[u32]` = note: no field of an enum variant may have a dynamically sized type -error[E0277]: the trait bound `Foo + 'static: std::marker::Sized` is not satisfied - --> $DIR/unsized-enum2.rs:51:8 +error[E0277]: `Foo + 'static` does not have a constant size known at compile-time + --> $DIR/unsized-enum2.rs:63:8 | -LL | VM(Foo), //~ ERROR `Foo + 'static: std::marker::Sized` is not satisfied +LL | VM(Foo), | ^^^ `Foo + 'static` does not have a constant size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `Foo + 'static` = note: no field of an enum variant may have a dynamically sized type -error[E0277]: the trait bound `Bar + 'static: std::marker::Sized` is not satisfied - --> $DIR/unsized-enum2.rs:52:8 +error[E0277]: `Bar + 'static` does not have a constant size known at compile-time + --> $DIR/unsized-enum2.rs:65:8 | -LL | VN{x: Bar}, //~ ERROR `Bar + 'static: std::marker::Sized` is not satisfied +LL | VN{x: Bar}, | ^^^^^^ `Bar + 'static` does not have a constant size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `Bar + 'static` = note: no field of an enum variant may have a dynamically sized type -error[E0277]: the trait bound `FooBar + 'static: std::marker::Sized` is not satisfied - --> $DIR/unsized-enum2.rs:53:15 +error[E0277]: `FooBar + 'static` does not have a constant size known at compile-time + --> $DIR/unsized-enum2.rs:67:15 | -LL | VO(isize, FooBar), //~ ERROR `FooBar + 'static: std::marker::Sized` is not satisfied +LL | VO(isize, FooBar), | ^^^^^^ `FooBar + 'static` does not have a constant size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `FooBar + 'static` = note: no field of an enum variant may have a dynamically sized type -error[E0277]: the trait bound `BarFoo + 'static: std::marker::Sized` is not satisfied - --> $DIR/unsized-enum2.rs:54:18 +error[E0277]: `BarFoo + 'static` does not have a constant size known at compile-time + --> $DIR/unsized-enum2.rs:69:18 | -LL | VP{u: isize, x: BarFoo}, //~ ERROR `BarFoo + 'static: std::marker::Sized` is not satisfied +LL | VP{u: isize, x: BarFoo}, | ^^^^^^^^^ `BarFoo + 'static` does not have a constant size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `BarFoo + 'static` = note: no field of an enum variant may have a dynamically sized type -error[E0277]: the trait bound `[i8]: std::marker::Sized` is not satisfied - --> $DIR/unsized-enum2.rs:57:8 +error[E0277]: `[i8]` does not have a constant size known at compile-time + --> $DIR/unsized-enum2.rs:73:8 | -LL | VQ(<&'static [i8] as Deref>::Target), //~ ERROR `[i8]: std::marker::Sized` is not satisfied +LL | VQ(<&'static [i8] as Deref>::Target), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `[i8]` does not have a constant size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `[i8]` = note: no field of an enum variant may have a dynamically sized type -error[E0277]: the trait bound `[char]: std::marker::Sized` is not satisfied - --> $DIR/unsized-enum2.rs:58:8 +error[E0277]: `[char]` does not have a constant size known at compile-time + --> $DIR/unsized-enum2.rs:75:8 | LL | VR{x: <&'static [char] as Deref>::Target}, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `[char]` does not have a constant size known at compile-time @@ -128,8 +128,8 @@ LL | VR{x: <&'static [char] as Deref>::Target}, = help: the trait `std::marker::Sized` is not implemented for `[char]` = note: no field of an enum variant may have a dynamically sized type -error[E0277]: the trait bound `[f64]: std::marker::Sized` is not satisfied - --> $DIR/unsized-enum2.rs:60:15 +error[E0277]: `[f64]` does not have a constant size known at compile-time + --> $DIR/unsized-enum2.rs:77:15 | LL | VS(isize, <&'static [f64] as Deref>::Target), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `[f64]` does not have a constant size known at compile-time @@ -137,8 +137,8 @@ LL | VS(isize, <&'static [f64] as Deref>::Target), = help: the trait `std::marker::Sized` is not implemented for `[f64]` = note: no field of an enum variant may have a dynamically sized type -error[E0277]: the trait bound `[i32]: std::marker::Sized` is not satisfied - --> $DIR/unsized-enum2.rs:62:18 +error[E0277]: `[i32]` does not have a constant size known at compile-time + --> $DIR/unsized-enum2.rs:79:18 | LL | VT{u: isize, x: <&'static [i32] as Deref>::Target}, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `[i32]` does not have a constant size known at compile-time @@ -146,40 +146,40 @@ LL | VT{u: isize, x: <&'static [i32] as Deref>::Target}, = help: the trait `std::marker::Sized` is not implemented for `[i32]` = note: no field of an enum variant may have a dynamically sized type -error[E0277]: the trait bound `PathHelper1 + 'static: std::marker::Sized` is not satisfied in `Path1` - --> $DIR/unsized-enum2.rs:45:8 +error[E0277]: `PathHelper1 + 'static` does not have a constant size known at compile-time + --> $DIR/unsized-enum2.rs:53:8 | -LL | VI(Path1), //~ ERROR `PathHelper1 + 'static: std::marker::Sized` is not satisfied +LL | VI(Path1), | ^^^^^ `PathHelper1 + 'static` does not have a constant size known at compile-time | = help: within `Path1`, the trait `std::marker::Sized` is not implemented for `PathHelper1 + 'static` = note: required because it appears within the type `Path1` = note: no field of an enum variant may have a dynamically sized type -error[E0277]: the trait bound `PathHelper2 + 'static: std::marker::Sized` is not satisfied in `Path2` - --> $DIR/unsized-enum2.rs:46:8 +error[E0277]: `PathHelper2 + 'static` does not have a constant size known at compile-time + --> $DIR/unsized-enum2.rs:55:8 | -LL | VJ{x: Path2}, //~ ERROR `PathHelper2 + 'static: std::marker::Sized` is not satisfied +LL | VJ{x: Path2}, | ^^^^^^^^ `PathHelper2 + 'static` does not have a constant size known at compile-time | = help: within `Path2`, the trait `std::marker::Sized` is not implemented for `PathHelper2 + 'static` = note: required because it appears within the type `Path2` = note: no field of an enum variant may have a dynamically sized type -error[E0277]: the trait bound `PathHelper3 + 'static: std::marker::Sized` is not satisfied in `Path3` - --> $DIR/unsized-enum2.rs:47:15 +error[E0277]: `PathHelper3 + 'static` does not have a constant size known at compile-time + --> $DIR/unsized-enum2.rs:57:15 | -LL | VK(isize, Path3), //~ ERROR `PathHelper3 + 'static: std::marker::Sized` is not satisfied +LL | VK(isize, Path3), | ^^^^^ `PathHelper3 + 'static` does not have a constant size known at compile-time | = help: within `Path3`, the trait `std::marker::Sized` is not implemented for `PathHelper3 + 'static` = note: required because it appears within the type `Path3` = note: no field of an enum variant may have a dynamically sized type -error[E0277]: the trait bound `PathHelper4 + 'static: std::marker::Sized` is not satisfied in `Path4` - --> $DIR/unsized-enum2.rs:48:18 +error[E0277]: `PathHelper4 + 'static` does not have a constant size known at compile-time + --> $DIR/unsized-enum2.rs:59:18 | -LL | VL{u: isize, x: Path4}, //~ ERROR `PathHelper4 + 'static: std::marker::Sized` is not satisfied +LL | VL{u: isize, x: Path4}, | ^^^^^^^^ `PathHelper4 + 'static` does not have a constant size known at compile-time | = help: within `Path4`, the trait `std::marker::Sized` is not implemented for `PathHelper4 + 'static` From f1dee43887821e34988f4427db009d19fae69496 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Sat, 9 Jun 2018 18:37:52 -0700 Subject: [PATCH 4/9] Add link to book for `Sized` errors --- src/libcore/marker.rs | 4 +++- src/test/ui/const-unsized.stderr | 4 ++++ src/test/ui/error-codes/E0277.stderr | 1 + .../ui/feature-gate-trivial_bounds.stderr | 3 +++ src/test/ui/generator/sized-yield.stderr | 2 ++ .../ui/mismatched_types/cast-rfc0401.stderr | 2 ++ src/test/ui/resolve/issue-5035-2.stderr | 1 + .../suggestions/str-array-assignment.stderr | 1 + src/test/ui/trait-suggest-where-clause.stderr | 4 ++++ src/test/ui/union/union-sized-field.stderr | 3 +++ src/test/ui/unsized-enum2.stderr | 20 +++++++++++++++++++ 11 files changed, 44 insertions(+), 1 deletion(-) diff --git a/src/libcore/marker.rs b/src/libcore/marker.rs index d5416e393f463..9c0508f1234e9 100644 --- a/src/libcore/marker.rs +++ b/src/libcore/marker.rs @@ -93,7 +93,9 @@ impl !Send for *mut T { } #[lang = "sized"] #[rustc_on_unimplemented( message="`{Self}` does not have a constant size known at compile-time", - label="`{Self}` does not have a constant size known at compile-time" + label="`{Self}` does not have a constant size known at compile-time", + note="to learn more, visit ", )] #[fundamental] // for Default, for example, which requires that `[T]: !Default` be evaluatable pub trait Sized { diff --git a/src/test/ui/const-unsized.stderr b/src/test/ui/const-unsized.stderr index ca434541cc285..6baeab90db220 100644 --- a/src/test/ui/const-unsized.stderr +++ b/src/test/ui/const-unsized.stderr @@ -5,6 +5,7 @@ LL | const CONST_0: Debug+Sync = *(&0 as &(Debug+Sync)); | ^^^^^^^^^^^^^^^^^^^^^^ `std::fmt::Debug + std::marker::Sync + 'static` does not have a constant size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `std::fmt::Debug + std::marker::Sync + 'static` + = note: to learn more, visit = note: constant expressions must have a statically known size error[E0277]: `str` does not have a constant size known at compile-time @@ -14,6 +15,7 @@ LL | const CONST_FOO: str = *"foo"; | ^^^^^^ `str` does not have a constant size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `str` + = note: to learn more, visit = note: constant expressions must have a statically known size error[E0277]: `std::fmt::Debug + std::marker::Sync + 'static` does not have a constant size known at compile-time @@ -23,6 +25,7 @@ LL | static STATIC_1: Debug+Sync = *(&1 as &(Debug+Sync)); | ^^^^^^^^^^^^^^^^^^^^^^ `std::fmt::Debug + std::marker::Sync + 'static` does not have a constant size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `std::fmt::Debug + std::marker::Sync + 'static` + = note: to learn more, visit = note: constant expressions must have a statically known size error[E0277]: `str` does not have a constant size known at compile-time @@ -32,6 +35,7 @@ LL | static STATIC_BAR: str = *"bar"; | ^^^^^^ `str` does not have a constant size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `str` + = note: to learn more, visit = note: constant expressions must have a statically known size error: aborting due to 4 previous errors diff --git a/src/test/ui/error-codes/E0277.stderr b/src/test/ui/error-codes/E0277.stderr index 9cfd42b9c195d..e1c3183104a1e 100644 --- a/src/test/ui/error-codes/E0277.stderr +++ b/src/test/ui/error-codes/E0277.stderr @@ -5,6 +5,7 @@ LL | fn f(p: Path) { } | ^ `[u8]` does not have a constant size known at compile-time | = help: within `std::path::Path`, the trait `std::marker::Sized` is not implemented for `[u8]` + = note: to learn more, visit = note: required because it appears within the type `std::path::Path` = note: all local variables must have a statically known size diff --git a/src/test/ui/feature-gate-trivial_bounds.stderr b/src/test/ui/feature-gate-trivial_bounds.stderr index 3c6d87e059a2f..9344e78c23c1d 100644 --- a/src/test/ui/feature-gate-trivial_bounds.stderr +++ b/src/test/ui/feature-gate-trivial_bounds.stderr @@ -94,6 +94,7 @@ LL | struct TwoStrs(str, str) where str: Sized; //~ ERROR | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `str` does not have a constant size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `str` + = note: to learn more, visit = help: see issue #48214 = help: add #![feature(trivial_bounds)] to the crate attributes to enable @@ -106,6 +107,7 @@ LL | | } | |_^ `A + 'static` does not have a constant size known at compile-time | = help: within `Dst`, the trait `std::marker::Sized` is not implemented for `A + 'static` + = note: to learn more, visit = note: required because it appears within the type `Dst` = help: see issue #48214 = help: add #![feature(trivial_bounds)] to the crate attributes to enable @@ -119,6 +121,7 @@ LL | | } | |_^ `str` does not have a constant size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `str` + = note: to learn more, visit = help: see issue #48214 = help: add #![feature(trivial_bounds)] to the crate attributes to enable diff --git a/src/test/ui/generator/sized-yield.stderr b/src/test/ui/generator/sized-yield.stderr index 45f0665905368..7918101850e0c 100644 --- a/src/test/ui/generator/sized-yield.stderr +++ b/src/test/ui/generator/sized-yield.stderr @@ -9,6 +9,7 @@ LL | | }; | |____^ `str` does not have a constant size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `str` + = note: to learn more, visit = note: the yield type of a generator must have a statically known size error[E0277]: `str` does not have a constant size known at compile-time @@ -18,6 +19,7 @@ LL | unsafe { gen.resume(); } | ^^^^^^ `str` does not have a constant size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `str` + = note: to learn more, visit error: aborting due to 2 previous errors diff --git a/src/test/ui/mismatched_types/cast-rfc0401.stderr b/src/test/ui/mismatched_types/cast-rfc0401.stderr index 2b00c20e201ff..70914ded96092 100644 --- a/src/test/ui/mismatched_types/cast-rfc0401.stderr +++ b/src/test/ui/mismatched_types/cast-rfc0401.stderr @@ -223,6 +223,7 @@ LL | let _ = fat_v as *const Foo; //~ ERROR `[u8]` does not have a constant | ^^^^^ `[u8]` does not have a constant size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `[u8]` + = note: to learn more, visit = note: required for the cast to the object type `Foo` error[E0277]: `str` does not have a constant size known at compile-time @@ -232,6 +233,7 @@ LL | let _ = a as *const Foo; //~ ERROR `str` does not have a constant size | ^ `str` does not have a constant size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `str` + = note: to learn more, visit = note: required for the cast to the object type `Foo` error[E0606]: casting `&{float}` as `f32` is invalid diff --git a/src/test/ui/resolve/issue-5035-2.stderr b/src/test/ui/resolve/issue-5035-2.stderr index 554e97a12815c..1488f6b998539 100644 --- a/src/test/ui/resolve/issue-5035-2.stderr +++ b/src/test/ui/resolve/issue-5035-2.stderr @@ -5,6 +5,7 @@ LL | fn foo(_x: K) {} | ^^ `I + 'static` does not have a constant size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `I + 'static` + = note: to learn more, visit = note: all local variables must have a statically known size error: aborting due to previous error diff --git a/src/test/ui/suggestions/str-array-assignment.stderr b/src/test/ui/suggestions/str-array-assignment.stderr index 91e86e344b41c..acf51f89fc48c 100644 --- a/src/test/ui/suggestions/str-array-assignment.stderr +++ b/src/test/ui/suggestions/str-array-assignment.stderr @@ -28,6 +28,7 @@ LL | let v = s[..2]; | `str` does not have a constant size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `str` + = note: to learn more, visit = note: all local variables must have a statically known size error[E0308]: mismatched types diff --git a/src/test/ui/trait-suggest-where-clause.stderr b/src/test/ui/trait-suggest-where-clause.stderr index d31e928803721..d87641d8d0fa9 100644 --- a/src/test/ui/trait-suggest-where-clause.stderr +++ b/src/test/ui/trait-suggest-where-clause.stderr @@ -5,6 +5,7 @@ LL | mem::size_of::(); | ^^^^^^^^^^^^^^^^^ `U` does not have a constant size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `U` + = note: to learn more, visit = help: consider adding a `where U: std::marker::Sized` bound = note: required by `std::mem::size_of` @@ -15,6 +16,7 @@ LL | mem::size_of::>(); | ^^^^^^^^^^^^^^^^^^^^^^^ `U` does not have a constant size known at compile-time | = help: within `Misc`, the trait `std::marker::Sized` is not implemented for `U` + = note: to learn more, visit = help: consider adding a `where U: std::marker::Sized` bound = note: required because it appears within the type `Misc` = note: required by `std::mem::size_of` @@ -52,6 +54,7 @@ LL | mem::size_of::<[T]>(); | ^^^^^^^^^^^^^^^^^^^ `[T]` does not have a constant size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `[T]` + = note: to learn more, visit = note: required by `std::mem::size_of` error[E0277]: `[&U]` does not have a constant size known at compile-time @@ -61,6 +64,7 @@ LL | mem::size_of::<[&U]>(); | ^^^^^^^^^^^^^^^^^^^^ `[&U]` does not have a constant size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `[&U]` + = note: to learn more, visit = note: required by `std::mem::size_of` error: aborting due to 7 previous errors diff --git a/src/test/ui/union/union-sized-field.stderr b/src/test/ui/union/union-sized-field.stderr index ce6de86cff9b9..9fdc5af0481ae 100644 --- a/src/test/ui/union/union-sized-field.stderr +++ b/src/test/ui/union/union-sized-field.stderr @@ -5,6 +5,7 @@ LL | value: T, | ^^^^^^^^ `T` does not have a constant size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `T` + = note: to learn more, visit = help: consider adding a `where T: std::marker::Sized` bound = note: no field of a union may have a dynamically sized type @@ -15,6 +16,7 @@ LL | value: T, | ^^^^^^^^ `T` does not have a constant size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `T` + = note: to learn more, visit = help: consider adding a `where T: std::marker::Sized` bound = note: only the last field of a struct may have a dynamically sized type @@ -25,6 +27,7 @@ LL | Value(T), | ^ `T` does not have a constant size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `T` + = note: to learn more, visit = help: consider adding a `where T: std::marker::Sized` bound = note: no field of an enum variant may have a dynamically sized type diff --git a/src/test/ui/unsized-enum2.stderr b/src/test/ui/unsized-enum2.stderr index 2784bf5af1b9d..91b8e5def7edd 100644 --- a/src/test/ui/unsized-enum2.stderr +++ b/src/test/ui/unsized-enum2.stderr @@ -5,6 +5,7 @@ LL | VA(W), | ^ `W` does not have a constant size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `W` + = note: to learn more, visit = help: consider adding a `where W: std::marker::Sized` bound = note: no field of an enum variant may have a dynamically sized type @@ -15,6 +16,7 @@ LL | VB{x: X}, | ^^^^ `X` does not have a constant size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `X` + = note: to learn more, visit = help: consider adding a `where X: std::marker::Sized` bound = note: no field of an enum variant may have a dynamically sized type @@ -25,6 +27,7 @@ LL | VC(isize, Y), | ^ `Y` does not have a constant size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `Y` + = note: to learn more, visit = help: consider adding a `where Y: std::marker::Sized` bound = note: no field of an enum variant may have a dynamically sized type @@ -35,6 +38,7 @@ LL | VD{u: isize, x: Z}, | ^^^^ `Z` does not have a constant size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `Z` + = note: to learn more, visit = help: consider adding a `where Z: std::marker::Sized` bound = note: no field of an enum variant may have a dynamically sized type @@ -45,6 +49,7 @@ LL | VE([u8]), | ^^^^ `[u8]` does not have a constant size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `[u8]` + = note: to learn more, visit = note: no field of an enum variant may have a dynamically sized type error[E0277]: `str` does not have a constant size known at compile-time @@ -54,6 +59,7 @@ LL | VF{x: str}, | ^^^^^^ `str` does not have a constant size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `str` + = note: to learn more, visit = note: no field of an enum variant may have a dynamically sized type error[E0277]: `[f32]` does not have a constant size known at compile-time @@ -63,6 +69,7 @@ LL | VG(isize, [f32]), | ^^^^^ `[f32]` does not have a constant size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `[f32]` + = note: to learn more, visit = note: no field of an enum variant may have a dynamically sized type error[E0277]: `[u32]` does not have a constant size known at compile-time @@ -72,6 +79,7 @@ LL | VH{u: isize, x: [u32]}, | ^^^^^^^^ `[u32]` does not have a constant size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `[u32]` + = note: to learn more, visit = note: no field of an enum variant may have a dynamically sized type error[E0277]: `Foo + 'static` does not have a constant size known at compile-time @@ -81,6 +89,7 @@ LL | VM(Foo), | ^^^ `Foo + 'static` does not have a constant size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `Foo + 'static` + = note: to learn more, visit = note: no field of an enum variant may have a dynamically sized type error[E0277]: `Bar + 'static` does not have a constant size known at compile-time @@ -90,6 +99,7 @@ LL | VN{x: Bar}, | ^^^^^^ `Bar + 'static` does not have a constant size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `Bar + 'static` + = note: to learn more, visit = note: no field of an enum variant may have a dynamically sized type error[E0277]: `FooBar + 'static` does not have a constant size known at compile-time @@ -99,6 +109,7 @@ LL | VO(isize, FooBar), | ^^^^^^ `FooBar + 'static` does not have a constant size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `FooBar + 'static` + = note: to learn more, visit = note: no field of an enum variant may have a dynamically sized type error[E0277]: `BarFoo + 'static` does not have a constant size known at compile-time @@ -108,6 +119,7 @@ LL | VP{u: isize, x: BarFoo}, | ^^^^^^^^^ `BarFoo + 'static` does not have a constant size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `BarFoo + 'static` + = note: to learn more, visit = note: no field of an enum variant may have a dynamically sized type error[E0277]: `[i8]` does not have a constant size known at compile-time @@ -117,6 +129,7 @@ LL | VQ(<&'static [i8] as Deref>::Target), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `[i8]` does not have a constant size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `[i8]` + = note: to learn more, visit = note: no field of an enum variant may have a dynamically sized type error[E0277]: `[char]` does not have a constant size known at compile-time @@ -126,6 +139,7 @@ LL | VR{x: <&'static [char] as Deref>::Target}, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `[char]` does not have a constant size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `[char]` + = note: to learn more, visit = note: no field of an enum variant may have a dynamically sized type error[E0277]: `[f64]` does not have a constant size known at compile-time @@ -135,6 +149,7 @@ LL | VS(isize, <&'static [f64] as Deref>::Target), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `[f64]` does not have a constant size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `[f64]` + = note: to learn more, visit = note: no field of an enum variant may have a dynamically sized type error[E0277]: `[i32]` does not have a constant size known at compile-time @@ -144,6 +159,7 @@ LL | VT{u: isize, x: <&'static [i32] as Deref>::Target}, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `[i32]` does not have a constant size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `[i32]` + = note: to learn more, visit = note: no field of an enum variant may have a dynamically sized type error[E0277]: `PathHelper1 + 'static` does not have a constant size known at compile-time @@ -153,6 +169,7 @@ LL | VI(Path1), | ^^^^^ `PathHelper1 + 'static` does not have a constant size known at compile-time | = help: within `Path1`, the trait `std::marker::Sized` is not implemented for `PathHelper1 + 'static` + = note: to learn more, visit = note: required because it appears within the type `Path1` = note: no field of an enum variant may have a dynamically sized type @@ -163,6 +180,7 @@ LL | VJ{x: Path2}, | ^^^^^^^^ `PathHelper2 + 'static` does not have a constant size known at compile-time | = help: within `Path2`, the trait `std::marker::Sized` is not implemented for `PathHelper2 + 'static` + = note: to learn more, visit = note: required because it appears within the type `Path2` = note: no field of an enum variant may have a dynamically sized type @@ -173,6 +191,7 @@ LL | VK(isize, Path3), | ^^^^^ `PathHelper3 + 'static` does not have a constant size known at compile-time | = help: within `Path3`, the trait `std::marker::Sized` is not implemented for `PathHelper3 + 'static` + = note: to learn more, visit = note: required because it appears within the type `Path3` = note: no field of an enum variant may have a dynamically sized type @@ -183,6 +202,7 @@ LL | VL{u: isize, x: Path4}, | ^^^^^^^^ `PathHelper4 + 'static` does not have a constant size known at compile-time | = help: within `Path4`, the trait `std::marker::Sized` is not implemented for `PathHelper4 + 'static` + = note: to learn more, visit = note: required because it appears within the type `Path4` = note: no field of an enum variant may have a dynamically sized type From a93f176b7440a38e6eda7e1b5e338cd4d05f92a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Sat, 9 Jun 2018 18:39:14 -0700 Subject: [PATCH 5/9] Point to previous line for single expected token --- src/libsyntax/parse/parser.rs | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 5d04aa711c137..4045053283e9c 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -637,7 +637,26 @@ impl<'a> Parser<'a> { let mut err = self.fatal(&format!("expected `{}`, found `{}`", token_str, this_token_str)); - err.span_label(self.span, format!("expected `{}`", token_str)); + + let sp = if self.token == token::Token::Eof { + // EOF, don't want to point at the following char, but rather the last token + self.prev_span + } else { + self.sess.codemap().next_point(self.prev_span) + }; + let label_exp = format!("expected `{}`", token_str); + let cm = self.sess.codemap(); + match (cm.lookup_line(self.span.lo()), cm.lookup_line(sp.lo())) { + (Ok(ref a), Ok(ref b)) if a.line == b.line => { + // When the spans are in the same line, it means that the only content between + // them is whitespace, point only at the found token. + err.span_label(self.span, label_exp); + } + _ => { + err.span_label(sp, label_exp); + err.span_label(self.span, "unexpected token"); + } + } Err(err) } } else { From 317258c1ceb9918fe67f98ddf8949f1e7e756fbd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Sat, 9 Jun 2018 19:00:32 -0700 Subject: [PATCH 6/9] Fix tidy and remove unused method --- src/libsyntax/parse/parser.rs | 4 ++-- src/test/compile-fail/associated-types-unsized.rs | 2 +- src/test/compile-fail/issue-24446.rs | 2 +- src/test/compile-fail/trait-bounds-not-on-bare-trait.rs | 2 +- src/test/ui/mismatched_types/cast-rfc0401.rs | 2 +- src/test/ui/mismatched_types/cast-rfc0401.stderr | 2 +- src/test/ui/trivial-bounds-leak.stderr | 1 + 7 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 4045053283e9c..398d2f04d0f04 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -648,8 +648,8 @@ impl<'a> Parser<'a> { let cm = self.sess.codemap(); match (cm.lookup_line(self.span.lo()), cm.lookup_line(sp.lo())) { (Ok(ref a), Ok(ref b)) if a.line == b.line => { - // When the spans are in the same line, it means that the only content between - // them is whitespace, point only at the found token. + // When the spans are in the same line, it means that the only content + // between them is whitespace, point only at the found token. err.span_label(self.span, label_exp); } _ => { diff --git a/src/test/compile-fail/associated-types-unsized.rs b/src/test/compile-fail/associated-types-unsized.rs index 8c0ce26b294df..29aa961474597 100644 --- a/src/test/compile-fail/associated-types-unsized.rs +++ b/src/test/compile-fail/associated-types-unsized.rs @@ -14,7 +14,7 @@ trait Get { } fn foo(t: T) { - let x = t.get(); //~ ERROR `::Value` does not have a constant size known at compile-time + let x = t.get(); //~ ERROR `::Value` does not have a constant size known at } fn main() { diff --git a/src/test/compile-fail/issue-24446.rs b/src/test/compile-fail/issue-24446.rs index 5f36bbcf5fd6a..cef68dd811bce 100644 --- a/src/test/compile-fail/issue-24446.rs +++ b/src/test/compile-fail/issue-24446.rs @@ -11,7 +11,7 @@ fn main() { static foo: Fn() -> u32 = || -> u32 { //~^ ERROR: mismatched types - //~| ERROR: `std::ops::Fn() -> u32 + 'static` does not have a constant size known at compile-time + //~| ERROR: `std::ops::Fn() -> u32 + 'static` does not have a constant size known at 0 }; } diff --git a/src/test/compile-fail/trait-bounds-not-on-bare-trait.rs b/src/test/compile-fail/trait-bounds-not-on-bare-trait.rs index effee4a70f342..fbf233573939a 100644 --- a/src/test/compile-fail/trait-bounds-not-on-bare-trait.rs +++ b/src/test/compile-fail/trait-bounds-not-on-bare-trait.rs @@ -15,7 +15,7 @@ trait Foo { // This should emit the less confusing error, not the more confusing one. fn foo(_x: Foo + Send) { - //~^ ERROR `Foo + std::marker::Send + 'static` does not have a constant size known at compile-time + //~^ ERROR `Foo + std::marker::Send + 'static` does not have a constant size known at } fn main() { } diff --git a/src/test/ui/mismatched_types/cast-rfc0401.rs b/src/test/ui/mismatched_types/cast-rfc0401.rs index 7ec9593d2dec7..67aa8f89ddf93 100644 --- a/src/test/ui/mismatched_types/cast-rfc0401.rs +++ b/src/test/ui/mismatched_types/cast-rfc0401.rs @@ -60,7 +60,7 @@ fn main() let _ = 42usize as *const [u8]; //~ ERROR is invalid let _ = v as *const [u8]; //~ ERROR cannot cast - let _ = fat_v as *const Foo; //~ ERROR `[u8]` does not have a constant size known at compile-time + let _ = fat_v as *const Foo; //~ ERROR `[u8]` does not have a constant size known at let _ = foo as *const str; //~ ERROR is invalid let _ = foo as *mut str; //~ ERROR is invalid let _ = main as *mut str; //~ ERROR is invalid diff --git a/src/test/ui/mismatched_types/cast-rfc0401.stderr b/src/test/ui/mismatched_types/cast-rfc0401.stderr index 70914ded96092..a5992cd680279 100644 --- a/src/test/ui/mismatched_types/cast-rfc0401.stderr +++ b/src/test/ui/mismatched_types/cast-rfc0401.stderr @@ -219,7 +219,7 @@ LL | let _ = cf as *const Bar; //~ ERROR is invalid error[E0277]: `[u8]` does not have a constant size known at compile-time --> $DIR/cast-rfc0401.rs:63:13 | -LL | let _ = fat_v as *const Foo; //~ ERROR `[u8]` does not have a constant size known at compile-time +LL | let _ = fat_v as *const Foo; //~ ERROR `[u8]` does not have a constant size known at | ^^^^^ `[u8]` does not have a constant size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `[u8]` diff --git a/src/test/ui/trivial-bounds-leak.stderr b/src/test/ui/trivial-bounds-leak.stderr index d54414110b1f8..6f1f885a5068b 100644 --- a/src/test/ui/trivial-bounds-leak.stderr +++ b/src/test/ui/trivial-bounds-leak.stderr @@ -5,6 +5,7 @@ LL | fn cant_return_str() -> str { //~ ERROR | ^^^ `str` does not have a constant size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `str` + = note: to learn more, visit = note: the return type of a function must have a statically known size error[E0599]: no method named `test` found for type `i32` in the current scope From 76a49524bd25804794f180b8905718a35cb113d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Tue, 19 Jun 2018 11:34:20 -0700 Subject: [PATCH 7/9] Add test for updated parser error --- .../ui/parser/expected-comma-found-token.rs | 22 +++++++++++++++++++ .../parser/expected-comma-found-token.stderr | 10 +++++++++ 2 files changed, 32 insertions(+) create mode 100644 src/test/ui/parser/expected-comma-found-token.rs create mode 100644 src/test/ui/parser/expected-comma-found-token.stderr diff --git a/src/test/ui/parser/expected-comma-found-token.rs b/src/test/ui/parser/expected-comma-found-token.rs new file mode 100644 index 0000000000000..3c53c3acf55c1 --- /dev/null +++ b/src/test/ui/parser/expected-comma-found-token.rs @@ -0,0 +1,22 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Tests that two closures cannot simultaneously have mutable +// access to the variable, whether that mutable access be used +// for direct assignment or for taking mutable ref. Issue #6801. + +#![feature(on_unimplemented)] + +#[rustc_on_unimplemented( + message="the message" + label="the label" +)] +trait T {} +//~^^^ ERROR expected one of `)` or `,`, found `label` diff --git a/src/test/ui/parser/expected-comma-found-token.stderr b/src/test/ui/parser/expected-comma-found-token.stderr new file mode 100644 index 0000000000000..9a564bb872e38 --- /dev/null +++ b/src/test/ui/parser/expected-comma-found-token.stderr @@ -0,0 +1,10 @@ +error: expected one of `)` or `,`, found `label` + --> $DIR/expected-comma-found-token.rs:19:5 + | +LL | message="the message" + | - expected one of `)` or `,` here +LL | label="the label" + | ^^^^^ unexpected token + +error: aborting due to previous error + From d4bfae1319b314f9eb0507f62ac16456ee55f0d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Tue, 19 Jun 2018 15:53:51 -0700 Subject: [PATCH 8/9] Update message for `!Sized` types --- src/libcore/marker.rs | 4 +- .../compile-fail/associated-types-unsized.rs | 2 +- src/test/compile-fail/bad-sized.rs | 4 +- src/test/compile-fail/dst-bad-assign-2.rs | 3 +- src/test/compile-fail/dst-bad-assign-3.rs | 2 +- src/test/compile-fail/dst-bad-assign.rs | 2 +- src/test/compile-fail/dst-bad-deep-2.rs | 2 +- src/test/compile-fail/dst-bad-deep.rs | 2 +- .../dst-object-from-unsized-type.rs | 8 +- .../compile-fail/dst-sized-trait-param.rs | 4 +- src/test/compile-fail/extern-types-unsized.rs | 8 +- src/test/compile-fail/issue-14366.rs | 2 +- src/test/compile-fail/issue-15756.rs | 2 +- src/test/compile-fail/issue-17651.rs | 2 +- src/test/compile-fail/issue-18107.rs | 2 +- src/test/compile-fail/issue-18919.rs | 2 +- src/test/compile-fail/issue-20005.rs | 2 +- src/test/compile-fail/issue-20433.rs | 2 +- src/test/compile-fail/issue-20605.rs | 2 +- src/test/compile-fail/issue-22874.rs | 2 +- src/test/compile-fail/issue-23281.rs | 2 +- src/test/compile-fail/issue-24446.rs | 4 +- src/test/compile-fail/issue-27060-2.rs | 2 +- src/test/compile-fail/issue-27078.rs | 2 +- src/test/compile-fail/issue-35988.rs | 2 +- src/test/compile-fail/issue-38954.rs | 2 +- src/test/compile-fail/issue-41229-ref-str.rs | 2 +- src/test/compile-fail/issue-42312.rs | 4 +- src/test/compile-fail/issue-5883.rs | 4 +- src/test/compile-fail/range-1.rs | 2 +- src/test/compile-fail/str-mut-idx.rs | 4 +- src/test/compile-fail/substs-ppaux.rs | 4 +- .../trait-bounds-not-on-bare-trait.rs | 2 +- src/test/compile-fail/union/union-unsized.rs | 5 +- src/test/compile-fail/unsized-bare-typaram.rs | 2 +- src/test/compile-fail/unsized-enum.rs | 2 +- .../unsized-inherent-impl-self-type.rs | 2 +- src/test/compile-fail/unsized-struct.rs | 4 +- .../unsized-trait-impl-self-type.rs | 2 +- .../unsized-trait-impl-trait-arg.rs | 2 +- src/test/compile-fail/unsized3.rs | 12 +-- src/test/compile-fail/unsized5.rs | 12 +-- src/test/compile-fail/unsized6.rs | 26 +++--- src/test/compile-fail/unsized7.rs | 2 +- src/test/ui/const-unsized.rs | 8 +- src/test/ui/const-unsized.stderr | 16 ++-- src/test/ui/error-codes/E0277.rs | 2 +- src/test/ui/error-codes/E0277.stderr | 4 +- .../ui/feature-gate-trivial_bounds.stderr | 12 +-- src/test/ui/generator/sized-yield.rs | 4 +- src/test/ui/generator/sized-yield.stderr | 10 +-- src/test/ui/mismatched_types/cast-rfc0401.rs | 4 +- .../ui/mismatched_types/cast-rfc0401.stderr | 12 +-- src/test/ui/resolve/issue-5035-2.rs | 2 +- src/test/ui/resolve/issue-5035-2.stderr | 4 +- .../ui/suggestions/str-array-assignment.rs | 2 +- .../suggestions/str-array-assignment.stderr | 4 +- src/test/ui/trait-suggest-where-clause.rs | 8 +- src/test/ui/trait-suggest-where-clause.stderr | 16 ++-- src/test/ui/trivial-bounds-leak.stderr | 4 +- src/test/ui/union/union-sized-field.rs | 6 +- src/test/ui/union/union-sized-field.stderr | 12 +-- src/test/ui/unsized-enum2.rs | 40 +++++----- src/test/ui/unsized-enum2.stderr | 80 +++++++++---------- 64 files changed, 209 insertions(+), 207 deletions(-) diff --git a/src/libcore/marker.rs b/src/libcore/marker.rs index 9c0508f1234e9..5db5d88d4a5ff 100644 --- a/src/libcore/marker.rs +++ b/src/libcore/marker.rs @@ -92,8 +92,8 @@ impl !Send for *mut T { } #[stable(feature = "rust1", since = "1.0.0")] #[lang = "sized"] #[rustc_on_unimplemented( - message="`{Self}` does not have a constant size known at compile-time", - label="`{Self}` does not have a constant size known at compile-time", + message="the size for value values of type `{Self}` cannot be known at compilation time", + label="doesn't have a size known at compile-time", note="to learn more, visit ", )] diff --git a/src/test/compile-fail/associated-types-unsized.rs b/src/test/compile-fail/associated-types-unsized.rs index 29aa961474597..3bb0382ef037b 100644 --- a/src/test/compile-fail/associated-types-unsized.rs +++ b/src/test/compile-fail/associated-types-unsized.rs @@ -14,7 +14,7 @@ trait Get { } fn foo(t: T) { - let x = t.get(); //~ ERROR `::Value` does not have a constant size known at + let x = t.get(); //~ ERROR the size for value values of type } fn main() { diff --git a/src/test/compile-fail/bad-sized.rs b/src/test/compile-fail/bad-sized.rs index 55b009aef4f16..9b87ec4d446cd 100644 --- a/src/test/compile-fail/bad-sized.rs +++ b/src/test/compile-fail/bad-sized.rs @@ -13,6 +13,6 @@ trait Trait {} pub fn main() { let x: Vec = Vec::new(); //~^ ERROR only auto traits can be used as additional traits in a trait object - //~| ERROR `Trait` does not have a constant size known at compile-time - //~| ERROR `Trait` does not have a constant size known at compile-time + //~| ERROR the size for value values of type + //~| ERROR the size for value values of type } diff --git a/src/test/compile-fail/dst-bad-assign-2.rs b/src/test/compile-fail/dst-bad-assign-2.rs index c3cbc90484250..1dbdd42ca36e2 100644 --- a/src/test/compile-fail/dst-bad-assign-2.rs +++ b/src/test/compile-fail/dst-bad-assign-2.rs @@ -43,5 +43,6 @@ pub fn main() { let f5: &mut Fat = &mut Fat { f1: 5, f2: "some str", ptr: Bar1 {f :42} }; let z: Box = Box::new(Bar1 {f: 36}); f5.ptr = *z; - //~^ ERROR `ToBar` does not have a constant size known at compile-time + //~^ ERROR the size for value values of type + } diff --git a/src/test/compile-fail/dst-bad-assign-3.rs b/src/test/compile-fail/dst-bad-assign-3.rs index 1cd5b51fe34d4..5bc6c6cda263a 100644 --- a/src/test/compile-fail/dst-bad-assign-3.rs +++ b/src/test/compile-fail/dst-bad-assign-3.rs @@ -45,5 +45,5 @@ pub fn main() { //~| expected type `ToBar` //~| found type `Bar1` //~| expected trait ToBar, found struct `Bar1` - //~| ERROR `ToBar` does not have a constant size known at compile-time + //~| ERROR the size for value values of type } diff --git a/src/test/compile-fail/dst-bad-assign.rs b/src/test/compile-fail/dst-bad-assign.rs index dcd78ac044cd6..37b6056d1a762 100644 --- a/src/test/compile-fail/dst-bad-assign.rs +++ b/src/test/compile-fail/dst-bad-assign.rs @@ -47,5 +47,5 @@ pub fn main() { //~| expected type `ToBar` //~| found type `Bar1` //~| expected trait ToBar, found struct `Bar1` - //~| ERROR `ToBar` does not have a constant size known at compile-time + //~| ERROR the size for value values of type } diff --git a/src/test/compile-fail/dst-bad-deep-2.rs b/src/test/compile-fail/dst-bad-deep-2.rs index 9ed2ec8d98d22..82d81913cd3a3 100644 --- a/src/test/compile-fail/dst-bad-deep-2.rs +++ b/src/test/compile-fail/dst-bad-deep-2.rs @@ -19,5 +19,5 @@ pub fn main() { let f: ([isize; 3],) = ([5, 6, 7],); let g: &([isize],) = &f; let h: &(([isize],),) = &(*g,); - //~^ ERROR `[isize]` does not have a constant size known at compile-time + //~^ ERROR the size for value values of type } diff --git a/src/test/compile-fail/dst-bad-deep.rs b/src/test/compile-fail/dst-bad-deep.rs index 9b575ae4aad30..b8ca22185bc3c 100644 --- a/src/test/compile-fail/dst-bad-deep.rs +++ b/src/test/compile-fail/dst-bad-deep.rs @@ -21,5 +21,5 @@ pub fn main() { let f: Fat<[isize; 3]> = Fat { ptr: [5, 6, 7] }; let g: &Fat<[isize]> = &f; let h: &Fat> = &Fat { ptr: *g }; - //~^ ERROR `[isize]` does not have a constant size known at compile-time + //~^ ERROR the size for value values of type } diff --git a/src/test/compile-fail/dst-object-from-unsized-type.rs b/src/test/compile-fail/dst-object-from-unsized-type.rs index 678eef76fdea5..4a892753595a7 100644 --- a/src/test/compile-fail/dst-object-from-unsized-type.rs +++ b/src/test/compile-fail/dst-object-from-unsized-type.rs @@ -16,22 +16,22 @@ impl Foo for [u8] {} fn test1(t: &T) { let u: &Foo = t; - //~^ ERROR `T` does not have a constant size known at compile-time + //~^ ERROR the size for value values of type } fn test2(t: &T) { let v: &Foo = t as &Foo; - //~^ ERROR `T` does not have a constant size known at compile-time + //~^ ERROR the size for value values of type } fn test3() { let _: &[&Foo] = &["hi"]; - //~^ ERROR `str` does not have a constant size known at compile-time + //~^ ERROR the size for value values of type } fn test4(x: &[u8]) { let _: &Foo = x as &Foo; - //~^ ERROR `[u8]` does not have a constant size known at compile-time + //~^ ERROR the size for value values of type } fn main() { } diff --git a/src/test/compile-fail/dst-sized-trait-param.rs b/src/test/compile-fail/dst-sized-trait-param.rs index cafd67809f812..0679556743228 100644 --- a/src/test/compile-fail/dst-sized-trait-param.rs +++ b/src/test/compile-fail/dst-sized-trait-param.rs @@ -15,9 +15,9 @@ trait Foo : Sized { fn take(self, x: &T) { } } // Note: T is sized impl Foo<[isize]> for usize { } -//~^ ERROR `[isize]` does not have a constant size known at compile-time +//~^ ERROR the size for value values of type impl Foo for [usize] { } -//~^ ERROR `[usize]` does not have a constant size known at compile-time +//~^ ERROR the size for value values of type pub fn main() { } diff --git a/src/test/compile-fail/extern-types-unsized.rs b/src/test/compile-fail/extern-types-unsized.rs index b3e19899a67a8..135b466161d77 100644 --- a/src/test/compile-fail/extern-types-unsized.rs +++ b/src/test/compile-fail/extern-types-unsized.rs @@ -30,14 +30,14 @@ fn assert_sized() { } fn main() { assert_sized::(); - //~^ ERROR `A` does not have a constant size known at compile-time + //~^ ERROR the size for value values of type assert_sized::(); - //~^ ERROR `A` does not have a constant size known at compile-time + //~^ ERROR the size for value values of type assert_sized::>(); - //~^ ERROR `A` does not have a constant size known at compile-time + //~^ ERROR the size for value values of type assert_sized::>>(); - //~^ ERROR `A` does not have a constant size known at compile-time + //~^ ERROR the size for value values of type } diff --git a/src/test/compile-fail/issue-14366.rs b/src/test/compile-fail/issue-14366.rs index 7b4954a2d4ec9..5212cbb004efa 100644 --- a/src/test/compile-fail/issue-14366.rs +++ b/src/test/compile-fail/issue-14366.rs @@ -10,5 +10,5 @@ fn main() { let _x = "test" as &::std::any::Any; - //~^ ERROR `str` does not have a constant size known at compile-time + //~^ ERROR the size for value values of type } diff --git a/src/test/compile-fail/issue-15756.rs b/src/test/compile-fail/issue-15756.rs index 0df82de83381b..4756099ab9568 100644 --- a/src/test/compile-fail/issue-15756.rs +++ b/src/test/compile-fail/issue-15756.rs @@ -15,7 +15,7 @@ fn dft_iter<'a, T>(arg1: Chunks<'a,T>, arg2: ChunksMut<'a,T>) { for &mut something - //~^ ERROR `[T]` does not have a constant size known at compile-time + //~^ ERROR the size for value values of type in arg2 { } diff --git a/src/test/compile-fail/issue-17651.rs b/src/test/compile-fail/issue-17651.rs index 13548b06ea18b..e7019ff7c0d21 100644 --- a/src/test/compile-fail/issue-17651.rs +++ b/src/test/compile-fail/issue-17651.rs @@ -13,5 +13,5 @@ fn main() { (|| Box::new(*(&[0][..])))(); - //~^ ERROR `[{integer}]` does not have a constant size known at compile-time + //~^ ERROR the size for value values of type } diff --git a/src/test/compile-fail/issue-18107.rs b/src/test/compile-fail/issue-18107.rs index 5faa8885e7319..9239ceb341fc6 100644 --- a/src/test/compile-fail/issue-18107.rs +++ b/src/test/compile-fail/issue-18107.rs @@ -12,7 +12,7 @@ pub trait AbstractRenderer {} fn _create_render(_: &()) -> AbstractRenderer -//~^ ERROR: `AbstractRenderer + 'static` does not have a constant size known at compile-time +//~^ ERROR the size for value values of type { match 0 { _ => unimplemented!() diff --git a/src/test/compile-fail/issue-18919.rs b/src/test/compile-fail/issue-18919.rs index 14b776cb1ff24..0b717ec641375 100644 --- a/src/test/compile-fail/issue-18919.rs +++ b/src/test/compile-fail/issue-18919.rs @@ -11,7 +11,7 @@ type FuncType<'f> = Fn(&isize) -> isize + 'f; fn ho_func(f: Option) { - //~^ ERROR: `for<'r> std::ops::Fn(&'r isize) -> isize` does not have a constant size known at + //~^ ERROR the size for value values of type } fn main() {} diff --git a/src/test/compile-fail/issue-20005.rs b/src/test/compile-fail/issue-20005.rs index ab47f687fc23c..426657ac92e2c 100644 --- a/src/test/compile-fail/issue-20005.rs +++ b/src/test/compile-fail/issue-20005.rs @@ -15,7 +15,7 @@ trait From { } trait To { - fn to( //~ ERROR `Self` does not have a constant size known at compile-time + fn to( //~ ERROR the size for value values of type self ) -> >::Result where Dst: From { From::from(self) diff --git a/src/test/compile-fail/issue-20433.rs b/src/test/compile-fail/issue-20433.rs index d8ca00d313f7a..8b7f2d5a4588e 100644 --- a/src/test/compile-fail/issue-20433.rs +++ b/src/test/compile-fail/issue-20433.rs @@ -14,5 +14,5 @@ struct The; impl The { fn iceman(c: Vec<[i32]>) {} - //~^ ERROR `[i32]` does not have a constant size known at compile-time + //~^ ERROR the size for value values of type } diff --git a/src/test/compile-fail/issue-20605.rs b/src/test/compile-fail/issue-20605.rs index c5a724bba807a..2d8d9c6565532 100644 --- a/src/test/compile-fail/issue-20605.rs +++ b/src/test/compile-fail/issue-20605.rs @@ -10,7 +10,7 @@ fn changer<'a>(mut things: Box>) { for item in *things { *item = 0 } -//~^ ERROR `std::iter::Iterator` does not have a constant size known at compile-time +//~^ ERROR the size for value values of type } fn main() {} diff --git a/src/test/compile-fail/issue-22874.rs b/src/test/compile-fail/issue-22874.rs index de176486af7db..cb199580b10dd 100644 --- a/src/test/compile-fail/issue-22874.rs +++ b/src/test/compile-fail/issue-22874.rs @@ -10,7 +10,7 @@ struct Table { rows: [[String]], - //~^ ERROR `[std::string::String]` does not have a constant size known at compile-time + //~^ ERROR the size for value values of type } fn f(table: &Table) -> &[String] { diff --git a/src/test/compile-fail/issue-23281.rs b/src/test/compile-fail/issue-23281.rs index fdab3b59d1bb6..d6b5c32982554 100644 --- a/src/test/compile-fail/issue-23281.rs +++ b/src/test/compile-fail/issue-23281.rs @@ -14,7 +14,7 @@ pub struct Struct; impl Struct { pub fn function(funs: Vec ()>) {} - //~^ ERROR `std::ops::Fn() + 'static` does not have a constant size known at compile-time + //~^ ERROR the size for value values of type } fn main() {} diff --git a/src/test/compile-fail/issue-24446.rs b/src/test/compile-fail/issue-24446.rs index cef68dd811bce..74c68c50ae35a 100644 --- a/src/test/compile-fail/issue-24446.rs +++ b/src/test/compile-fail/issue-24446.rs @@ -10,8 +10,8 @@ fn main() { static foo: Fn() -> u32 = || -> u32 { - //~^ ERROR: mismatched types - //~| ERROR: `std::ops::Fn() -> u32 + 'static` does not have a constant size known at + //~^ ERROR mismatched types + //~| ERROR the size for value values of type 0 }; } diff --git a/src/test/compile-fail/issue-27060-2.rs b/src/test/compile-fail/issue-27060-2.rs index 123bbf3358d89..bc5567e1686d3 100644 --- a/src/test/compile-fail/issue-27060-2.rs +++ b/src/test/compile-fail/issue-27060-2.rs @@ -10,7 +10,7 @@ #[repr(packed)] pub struct Bad { - data: T, //~ ERROR `T` does not have a constant size known at compile-time + data: T, //~ ERROR the size for value values of type } fn main() {} diff --git a/src/test/compile-fail/issue-27078.rs b/src/test/compile-fail/issue-27078.rs index 32933fa6176f7..6efc1f1024317 100644 --- a/src/test/compile-fail/issue-27078.rs +++ b/src/test/compile-fail/issue-27078.rs @@ -13,7 +13,7 @@ trait Foo { const BAR: i32; fn foo(self) -> &'static i32 { - //~^ ERROR `Self` does not have a constant size known at compile-time + //~^ ERROR the size for value values of type &::BAR } } diff --git a/src/test/compile-fail/issue-35988.rs b/src/test/compile-fail/issue-35988.rs index 8f5b68986e52c..805b1a48a0380 100644 --- a/src/test/compile-fail/issue-35988.rs +++ b/src/test/compile-fail/issue-35988.rs @@ -10,7 +10,7 @@ enum E { V([Box]), - //~^ ERROR `[std::boxed::Box]` does not have a constant size known at compile-time + //~^ ERROR the size for value values of type } fn main() {} diff --git a/src/test/compile-fail/issue-38954.rs b/src/test/compile-fail/issue-38954.rs index 960099f31934a..1b64d17bbeffe 100644 --- a/src/test/compile-fail/issue-38954.rs +++ b/src/test/compile-fail/issue-38954.rs @@ -9,6 +9,6 @@ // except according to those terms. fn _test(ref _p: str) {} -//~^ ERROR `str` does not have a constant size known at compile-time +//~^ ERROR the size for value values of type fn main() { } diff --git a/src/test/compile-fail/issue-41229-ref-str.rs b/src/test/compile-fail/issue-41229-ref-str.rs index b1e24c818d8a3..6207e669d0092 100644 --- a/src/test/compile-fail/issue-41229-ref-str.rs +++ b/src/test/compile-fail/issue-41229-ref-str.rs @@ -9,6 +9,6 @@ // except according to those terms. pub fn example(ref s: str) {} -//~^ ERROR `str` does not have a constant size known at compile-time +//~^ ERROR the size for value values of type fn main() {} diff --git a/src/test/compile-fail/issue-42312.rs b/src/test/compile-fail/issue-42312.rs index 89eb5c5ebc18e..2ab44433ede82 100644 --- a/src/test/compile-fail/issue-42312.rs +++ b/src/test/compile-fail/issue-42312.rs @@ -12,10 +12,10 @@ use std::ops::Deref; pub trait Foo { fn baz(_: Self::Target) where Self: Deref {} - //~^ ERROR `::Target` does not have a constant size known at + //~^ ERROR the size for value values of type } pub fn f(_: ToString) {} -//~^ ERROR `std::string::ToString + 'static` does not have a constant size known at compile-time +//~^ ERROR the size for value values of type fn main() { } diff --git a/src/test/compile-fail/issue-5883.rs b/src/test/compile-fail/issue-5883.rs index 580625f495530..82d4666ce549c 100644 --- a/src/test/compile-fail/issue-5883.rs +++ b/src/test/compile-fail/issue-5883.rs @@ -15,8 +15,8 @@ struct Struct { } fn new_struct(r: A+'static) - -> Struct { //~^ ERROR `A + 'static` does not have a constant size known at compile-time - //~^ ERROR `A + 'static` does not have a constant size known at compile-time + -> Struct { //~^ ERROR the size for value values of type + //~^ ERROR the size for value values of type Struct { r: r } } diff --git a/src/test/compile-fail/range-1.rs b/src/test/compile-fail/range-1.rs index 3fb62b8d86928..ed26204bbe109 100644 --- a/src/test/compile-fail/range-1.rs +++ b/src/test/compile-fail/range-1.rs @@ -22,5 +22,5 @@ pub fn main() { // Unsized type. let arr: &[_] = &[1, 2, 3]; let range = *arr..; - //~^ ERROR `[{integer}]` does not have a constant size known at compile-time + //~^ ERROR the size for value values of type } diff --git a/src/test/compile-fail/str-mut-idx.rs b/src/test/compile-fail/str-mut-idx.rs index c25d257d5f860..cc5fd7e3f24d8 100644 --- a/src/test/compile-fail/str-mut-idx.rs +++ b/src/test/compile-fail/str-mut-idx.rs @@ -12,8 +12,8 @@ fn bot() -> T { loop {} } fn mutate(s: &mut str) { s[1..2] = bot(); - //~^ ERROR `str` does not have a constant size known at compile-time - //~| ERROR `str` does not have a constant size known at compile-time + //~^ ERROR the size for value values of type + //~| ERROR the size for value values of type s[1usize] = bot(); //~^ ERROR the type `str` cannot be mutably indexed by `usize` } diff --git a/src/test/compile-fail/substs-ppaux.rs b/src/test/compile-fail/substs-ppaux.rs index 94d2a549a8606..b8557cb79e387 100644 --- a/src/test/compile-fail/substs-ppaux.rs +++ b/src/test/compile-fail/substs-ppaux.rs @@ -56,6 +56,6 @@ fn foo<'z>() where &'z (): Sized { //[normal]~| found type `fn() {foo::<'static>}` >::bar; - //[verbose]~^ ERROR `str` does not have a constant size known at compile-time - //[normal]~^^ ERROR `str` does not have a constant size known at compile-time + //[verbose]~^ ERROR the size for value values of type + //[normal]~^^ ERROR the size for value values of type } diff --git a/src/test/compile-fail/trait-bounds-not-on-bare-trait.rs b/src/test/compile-fail/trait-bounds-not-on-bare-trait.rs index fbf233573939a..89fddf1f65f02 100644 --- a/src/test/compile-fail/trait-bounds-not-on-bare-trait.rs +++ b/src/test/compile-fail/trait-bounds-not-on-bare-trait.rs @@ -15,7 +15,7 @@ trait Foo { // This should emit the less confusing error, not the more confusing one. fn foo(_x: Foo + Send) { - //~^ ERROR `Foo + std::marker::Send + 'static` does not have a constant size known at + //~^ ERROR the size for value values of type } fn main() { } diff --git a/src/test/compile-fail/union/union-unsized.rs b/src/test/compile-fail/union/union-unsized.rs index 32f22f052c17e..a9a2a3c4c92a1 100644 --- a/src/test/compile-fail/union/union-unsized.rs +++ b/src/test/compile-fail/union/union-unsized.rs @@ -12,14 +12,15 @@ union U { a: str, - //~^ ERROR `str` does not have a constant size known at compile-time + //~^ ERROR the size for value values of type + b: u8, } union W { a: u8, b: str, - //~^ ERROR `str` does not have a constant size known at compile-time + //~^ ERROR the size for value values of type } fn main() {} diff --git a/src/test/compile-fail/unsized-bare-typaram.rs b/src/test/compile-fail/unsized-bare-typaram.rs index be1f1dea28cd1..736794ac5384e 100644 --- a/src/test/compile-fail/unsized-bare-typaram.rs +++ b/src/test/compile-fail/unsized-bare-typaram.rs @@ -10,5 +10,5 @@ fn bar() { } fn foo() { bar::() } -//~^ ERROR `T` does not have a constant size known at compile-time +//~^ ERROR the size for value values of type fn main() { } diff --git a/src/test/compile-fail/unsized-enum.rs b/src/test/compile-fail/unsized-enum.rs index 2041c69da54ed..f9702e29f1dc3 100644 --- a/src/test/compile-fail/unsized-enum.rs +++ b/src/test/compile-fail/unsized-enum.rs @@ -15,7 +15,7 @@ fn not_sized() { } enum Foo { FooSome(U), FooNone } fn foo1() { not_sized::>() } // Hunky dory. fn foo2() { not_sized::>() } -//~^ ERROR `T` does not have a constant size known at compile-time +//~^ ERROR the size for value values of type // // Not OK: `T` is not sized. diff --git a/src/test/compile-fail/unsized-inherent-impl-self-type.rs b/src/test/compile-fail/unsized-inherent-impl-self-type.rs index 5e5280ff3ea39..03d3d98b59f01 100644 --- a/src/test/compile-fail/unsized-inherent-impl-self-type.rs +++ b/src/test/compile-fail/unsized-inherent-impl-self-type.rs @@ -15,7 +15,7 @@ struct S5(Y); impl S5 { - //~^ ERROR `X` does not have a constant size known at compile-time + //~^ ERROR the size for value values of type } fn main() { } diff --git a/src/test/compile-fail/unsized-struct.rs b/src/test/compile-fail/unsized-struct.rs index 830ac5d6c207b..8cb1f760664de 100644 --- a/src/test/compile-fail/unsized-struct.rs +++ b/src/test/compile-fail/unsized-struct.rs @@ -15,14 +15,14 @@ fn not_sized() { } struct Foo { data: T } fn foo1() { not_sized::>() } // Hunky dory. fn foo2() { not_sized::>() } -//~^ ERROR `T` does not have a constant size known at compile-time +//~^ ERROR the size for value values of type // // Not OK: `T` is not sized. struct Bar { data: T } fn bar1() { not_sized::>() } fn bar2() { is_sized::>() } -//~^ ERROR `T` does not have a constant size known at compile-time +//~^ ERROR the size for value values of type // // Not OK: `Bar` is not sized, but it should be. diff --git a/src/test/compile-fail/unsized-trait-impl-self-type.rs b/src/test/compile-fail/unsized-trait-impl-self-type.rs index 9bf4cf7a0bb20..b3610a4c9b9b6 100644 --- a/src/test/compile-fail/unsized-trait-impl-self-type.rs +++ b/src/test/compile-fail/unsized-trait-impl-self-type.rs @@ -18,7 +18,7 @@ trait T3 { struct S5(Y); impl T3 for S5 { - //~^ ERROR `X` does not have a constant size known at compile-time + //~^ ERROR the size for value values of type } fn main() { } diff --git a/src/test/compile-fail/unsized-trait-impl-trait-arg.rs b/src/test/compile-fail/unsized-trait-impl-trait-arg.rs index b3a848954d104..50a058a4338d8 100644 --- a/src/test/compile-fail/unsized-trait-impl-trait-arg.rs +++ b/src/test/compile-fail/unsized-trait-impl-trait-arg.rs @@ -16,7 +16,7 @@ trait T2 { } struct S4(Box); impl T2 for S4 { - //~^ ERROR `X` does not have a constant size known at compile-time + //~^ ERROR the size for value values of type } fn main() { } diff --git a/src/test/compile-fail/unsized3.rs b/src/test/compile-fail/unsized3.rs index e08cf8280fdf6..945f20b28779e 100644 --- a/src/test/compile-fail/unsized3.rs +++ b/src/test/compile-fail/unsized3.rs @@ -15,7 +15,7 @@ use std::marker; // Unbounded. fn f1(x: &X) { f2::(x); - //~^ ERROR `X` does not have a constant size known at compile-time + //~^ ERROR the size for value values of type } fn f2(x: &X) { } @@ -26,7 +26,7 @@ trait T { } fn f3(x: &X) { f4::(x); - //~^ ERROR `X` does not have a constant size known at compile-time + //~^ ERROR the size for value values of type } fn f4(x: &X) { } @@ -41,20 +41,20 @@ struct S { fn f8(x1: &S, x2: &S) { f5(x1); - //~^ ERROR `X` does not have a constant size known at compile-time + //~^ ERROR the size for value values of type f6(x2); // ok } // Test some tuples. fn f9(x1: Box>) { f5(&(*x1, 34)); - //~^ ERROR `X` does not have a constant size known at compile-time + //~^ ERROR the size for value values of type } fn f10(x1: Box>) { f5(&(32, *x1)); - //~^ ERROR `X` does not have a constant size known at compile-time - //~| ERROR `X` does not have a constant size known at compile-time + //~^ ERROR the size for value values of type + //~| ERROR the size for value values of type } pub fn main() { diff --git a/src/test/compile-fail/unsized5.rs b/src/test/compile-fail/unsized5.rs index 1fb32da5e319f..e04aa3599e9b5 100644 --- a/src/test/compile-fail/unsized5.rs +++ b/src/test/compile-fail/unsized5.rs @@ -12,32 +12,32 @@ struct S1 { f1: X, - //~^ ERROR `X` does not have a constant size known at compile-time + //~^ ERROR the size for value values of type f2: isize, } struct S2 { f: isize, g: X, - //~^ ERROR `X` does not have a constant size known at compile-time + //~^ ERROR the size for value values of type h: isize, } struct S3 { f: str, - //~^ ERROR `str` does not have a constant size known at compile-time + //~^ ERROR the size for value values of type g: [usize] } struct S4 { f: [u8], - //~^ ERROR `[u8]` does not have a constant size known at compile-time + //~^ ERROR the size for value values of type g: usize } enum E { V1(X, isize), - //~^ ERROR `X` does not have a constant size known at compile-time + //~^ ERROR the size for value values of type } enum F { V2{f1: X, f: isize}, - //~^ ERROR `X` does not have a constant size known at compile-time + //~^ ERROR the size for value values of type } pub fn main() { diff --git a/src/test/compile-fail/unsized6.rs b/src/test/compile-fail/unsized6.rs index 7ce0e1eb4d850..8ac9fe4c58787 100644 --- a/src/test/compile-fail/unsized6.rs +++ b/src/test/compile-fail/unsized6.rs @@ -15,40 +15,40 @@ trait T {} fn f1(x: &X) { let _: W; // <-- this is OK, no bindings created, no initializer. let _: (isize, (X, isize)); - //~^ ERROR `X` does not have a constant size known at compile-time + //~^ ERROR the size for value values of type let y: Y; - //~^ ERROR `Y` does not have a constant size known at compile-time + //~^ ERROR the size for value values of type let y: (isize, (Z, usize)); - //~^ ERROR `Z` does not have a constant size known at compile-time + //~^ ERROR the size for value values of type } fn f2(x: &X) { let y: X; - //~^ ERROR `X` does not have a constant size known at compile-time + //~^ ERROR the size for value values of type let y: (isize, (Y, isize)); - //~^ ERROR `Y` does not have a constant size known at compile-time + //~^ ERROR the size for value values of type } fn f3(x1: Box, x2: Box, x3: Box) { let y: X = *x1; - //~^ ERROR `X` does not have a constant size known at compile-time + //~^ ERROR the size for value values of type let y = *x2; - //~^ ERROR `X` does not have a constant size known at compile-time + //~^ ERROR the size for value values of type let (y, z) = (*x3, 4); - //~^ ERROR `X` does not have a constant size known at compile-time + //~^ ERROR the size for value values of type } fn f4(x1: Box, x2: Box, x3: Box) { let y: X = *x1; - //~^ ERROR `X` does not have a constant size known at compile-time + //~^ ERROR the size for value values of type let y = *x2; - //~^ ERROR `X` does not have a constant size known at compile-time + //~^ ERROR the size for value values of type let (y, z) = (*x3, 4); - //~^ ERROR `X` does not have a constant size known at compile-time + //~^ ERROR the size for value values of type } fn g1(x: X) {} -//~^ ERROR `X` does not have a constant size known at compile-time +//~^ ERROR the size for value values of type fn g2(x: X) {} -//~^ ERROR `X` does not have a constant size known at compile-time +//~^ ERROR the size for value values of type pub fn main() { } diff --git a/src/test/compile-fail/unsized7.rs b/src/test/compile-fail/unsized7.rs index 8a3d78f082716..44d7df35680ce 100644 --- a/src/test/compile-fail/unsized7.rs +++ b/src/test/compile-fail/unsized7.rs @@ -20,7 +20,7 @@ trait T1 { struct S3(Box); impl T1 for S3 { - //~^ ERROR `X` does not have a constant size known at compile-time + //~^ ERROR the size for value values of type } fn main() { } diff --git a/src/test/ui/const-unsized.rs b/src/test/ui/const-unsized.rs index 61ee622e21be9..c0a367604c374 100644 --- a/src/test/ui/const-unsized.rs +++ b/src/test/ui/const-unsized.rs @@ -11,16 +11,16 @@ use std::fmt::Debug; const CONST_0: Debug+Sync = *(&0 as &(Debug+Sync)); -//~^ ERROR `std::fmt::Debug + std::marker::Sync + 'static` does not have a constant size known at +//~^ ERROR the size for value values of type const CONST_FOO: str = *"foo"; -//~^ ERROR `str` does not have a constant size known at compile-time +//~^ ERROR the size for value values of type static STATIC_1: Debug+Sync = *(&1 as &(Debug+Sync)); -//~^ ERROR `std::fmt::Debug + std::marker::Sync + 'static` does not have a constant size known at +//~^ ERROR the size for value values of type static STATIC_BAR: str = *"bar"; -//~^ ERROR `str` does not have a constant size known at compile-time +//~^ ERROR the size for value values of type fn main() { println!("{:?} {:?} {:?} {:?}", &CONST_0, &CONST_FOO, &STATIC_1, &STATIC_BAR); diff --git a/src/test/ui/const-unsized.stderr b/src/test/ui/const-unsized.stderr index 6baeab90db220..2cde4aec2b5d4 100644 --- a/src/test/ui/const-unsized.stderr +++ b/src/test/ui/const-unsized.stderr @@ -1,38 +1,38 @@ -error[E0277]: `std::fmt::Debug + std::marker::Sync + 'static` does not have a constant size known at compile-time +error[E0277]: the size for value values of type `std::fmt::Debug + std::marker::Sync + 'static` cannot be known at compilation time --> $DIR/const-unsized.rs:13:29 | LL | const CONST_0: Debug+Sync = *(&0 as &(Debug+Sync)); - | ^^^^^^^^^^^^^^^^^^^^^^ `std::fmt::Debug + std::marker::Sync + 'static` does not have a constant size known at compile-time + | ^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `std::fmt::Debug + std::marker::Sync + 'static` = note: to learn more, visit = note: constant expressions must have a statically known size -error[E0277]: `str` does not have a constant size known at compile-time +error[E0277]: the size for value values of type `str` cannot be known at compilation time --> $DIR/const-unsized.rs:16:24 | LL | const CONST_FOO: str = *"foo"; - | ^^^^^^ `str` does not have a constant size known at compile-time + | ^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `str` = note: to learn more, visit = note: constant expressions must have a statically known size -error[E0277]: `std::fmt::Debug + std::marker::Sync + 'static` does not have a constant size known at compile-time +error[E0277]: the size for value values of type `std::fmt::Debug + std::marker::Sync + 'static` cannot be known at compilation time --> $DIR/const-unsized.rs:19:31 | LL | static STATIC_1: Debug+Sync = *(&1 as &(Debug+Sync)); - | ^^^^^^^^^^^^^^^^^^^^^^ `std::fmt::Debug + std::marker::Sync + 'static` does not have a constant size known at compile-time + | ^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `std::fmt::Debug + std::marker::Sync + 'static` = note: to learn more, visit = note: constant expressions must have a statically known size -error[E0277]: `str` does not have a constant size known at compile-time +error[E0277]: the size for value values of type `str` cannot be known at compilation time --> $DIR/const-unsized.rs:22:26 | LL | static STATIC_BAR: str = *"bar"; - | ^^^^^^ `str` does not have a constant size known at compile-time + | ^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `str` = note: to learn more, visit diff --git a/src/test/ui/error-codes/E0277.rs b/src/test/ui/error-codes/E0277.rs index 9ff2ef4da90bc..95f10e7206f92 100644 --- a/src/test/ui/error-codes/E0277.rs +++ b/src/test/ui/error-codes/E0277.rs @@ -21,7 +21,7 @@ fn some_func(foo: T) { } fn f(p: Path) { } -//~^ ERROR `[u8]` does not have a constant size known at compile-time +//~^ ERROR the size for value values of type fn main() { some_func(5i32); diff --git a/src/test/ui/error-codes/E0277.stderr b/src/test/ui/error-codes/E0277.stderr index e1c3183104a1e..ca5b0d2b987d6 100644 --- a/src/test/ui/error-codes/E0277.stderr +++ b/src/test/ui/error-codes/E0277.stderr @@ -1,8 +1,8 @@ -error[E0277]: `[u8]` does not have a constant size known at compile-time +error[E0277]: the size for value values of type `[u8]` cannot be known at compilation time --> $DIR/E0277.rs:23:6 | LL | fn f(p: Path) { } - | ^ `[u8]` does not have a constant size known at compile-time + | ^ doesn't have a size known at compile-time | = help: within `std::path::Path`, the trait `std::marker::Sized` is not implemented for `[u8]` = note: to learn more, visit diff --git a/src/test/ui/feature-gate-trivial_bounds.stderr b/src/test/ui/feature-gate-trivial_bounds.stderr index 9344e78c23c1d..db280f2d1f763 100644 --- a/src/test/ui/feature-gate-trivial_bounds.stderr +++ b/src/test/ui/feature-gate-trivial_bounds.stderr @@ -87,24 +87,24 @@ LL | | } = help: see issue #48214 = help: add #![feature(trivial_bounds)] to the crate attributes to enable -error[E0277]: `str` does not have a constant size known at compile-time +error[E0277]: the size for value values of type `str` cannot be known at compilation time --> $DIR/feature-gate-trivial_bounds.rs:62:1 | LL | struct TwoStrs(str, str) where str: Sized; //~ ERROR - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `str` does not have a constant size known at compile-time + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `str` = note: to learn more, visit = help: see issue #48214 = help: add #![feature(trivial_bounds)] to the crate attributes to enable -error[E0277]: `A + 'static` does not have a constant size known at compile-time +error[E0277]: the size for value values of type `A + 'static` cannot be known at compilation time --> $DIR/feature-gate-trivial_bounds.rs:65:1 | LL | / fn unsized_local() where Dst: Sized { //~ ERROR LL | | let x: Dst = *(Box::new(Dst { x: 1 }) as Box>); LL | | } - | |_^ `A + 'static` does not have a constant size known at compile-time + | |_^ doesn't have a size known at compile-time | = help: within `Dst`, the trait `std::marker::Sized` is not implemented for `A + 'static` = note: to learn more, visit @@ -112,13 +112,13 @@ LL | | } = help: see issue #48214 = help: add #![feature(trivial_bounds)] to the crate attributes to enable -error[E0277]: `str` does not have a constant size known at compile-time +error[E0277]: the size for value values of type `str` cannot be known at compilation time --> $DIR/feature-gate-trivial_bounds.rs:69:1 | LL | / fn return_str() -> str where str: Sized { //~ ERROR LL | | *"Sized".to_string().into_boxed_str() LL | | } - | |_^ `str` does not have a constant size known at compile-time + | |_^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `str` = note: to learn more, visit diff --git a/src/test/ui/generator/sized-yield.rs b/src/test/ui/generator/sized-yield.rs index 165e27025973d..efaee4095c148 100644 --- a/src/test/ui/generator/sized-yield.rs +++ b/src/test/ui/generator/sized-yield.rs @@ -15,9 +15,9 @@ use std::ops::Generator; fn main() { let s = String::from("foo"); let mut gen = move || { - //~^ ERROR `str` does not have a constant size known at compile-time + //~^ ERROR the size for value values of type yield s[..]; }; unsafe { gen.resume(); } - //~^ ERROR `str` does not have a constant size known at compile-time + //~^ ERROR the size for value values of type } diff --git a/src/test/ui/generator/sized-yield.stderr b/src/test/ui/generator/sized-yield.stderr index 7918101850e0c..2938268a804ae 100644 --- a/src/test/ui/generator/sized-yield.stderr +++ b/src/test/ui/generator/sized-yield.stderr @@ -1,22 +1,22 @@ -error[E0277]: `str` does not have a constant size known at compile-time +error[E0277]: the size for value values of type `str` cannot be known at compilation time --> $DIR/sized-yield.rs:17:26 | LL | let mut gen = move || { | __________________________^ -LL | | //~^ ERROR `str` does not have a constant size known at compile-time +LL | | //~^ ERROR the size for value values of type LL | | yield s[..]; LL | | }; - | |____^ `str` does not have a constant size known at compile-time + | |____^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `str` = note: to learn more, visit = note: the yield type of a generator must have a statically known size -error[E0277]: `str` does not have a constant size known at compile-time +error[E0277]: the size for value values of type `str` cannot be known at compilation time --> $DIR/sized-yield.rs:21:17 | LL | unsafe { gen.resume(); } - | ^^^^^^ `str` does not have a constant size known at compile-time + | ^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `str` = note: to learn more, visit diff --git a/src/test/ui/mismatched_types/cast-rfc0401.rs b/src/test/ui/mismatched_types/cast-rfc0401.rs index 67aa8f89ddf93..d76c4a015a2c2 100644 --- a/src/test/ui/mismatched_types/cast-rfc0401.rs +++ b/src/test/ui/mismatched_types/cast-rfc0401.rs @@ -60,7 +60,7 @@ fn main() let _ = 42usize as *const [u8]; //~ ERROR is invalid let _ = v as *const [u8]; //~ ERROR cannot cast - let _ = fat_v as *const Foo; //~ ERROR `[u8]` does not have a constant size known at + let _ = fat_v as *const Foo; //~ ERROR the size for value values of type let _ = foo as *const str; //~ ERROR is invalid let _ = foo as *mut str; //~ ERROR is invalid let _ = main as *mut str; //~ ERROR is invalid @@ -69,7 +69,7 @@ fn main() let _ = fat_sv as usize; //~ ERROR is invalid let a : *const str = "hello"; - let _ = a as *const Foo; //~ ERROR `str` does not have a constant size known at compile-time + let _ = a as *const Foo; //~ ERROR the size for value values of type // check no error cascade let _ = main.f as *const u32; //~ ERROR no field diff --git a/src/test/ui/mismatched_types/cast-rfc0401.stderr b/src/test/ui/mismatched_types/cast-rfc0401.stderr index a5992cd680279..feaf492837f7f 100644 --- a/src/test/ui/mismatched_types/cast-rfc0401.stderr +++ b/src/test/ui/mismatched_types/cast-rfc0401.stderr @@ -216,21 +216,21 @@ LL | let _ = cf as *const Bar; //~ ERROR is invalid | = note: vtable kinds may not match -error[E0277]: `[u8]` does not have a constant size known at compile-time +error[E0277]: the size for value values of type `[u8]` cannot be known at compilation time --> $DIR/cast-rfc0401.rs:63:13 | -LL | let _ = fat_v as *const Foo; //~ ERROR `[u8]` does not have a constant size known at - | ^^^^^ `[u8]` does not have a constant size known at compile-time +LL | let _ = fat_v as *const Foo; //~ ERROR the size for value values of type + | ^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `[u8]` = note: to learn more, visit = note: required for the cast to the object type `Foo` -error[E0277]: `str` does not have a constant size known at compile-time +error[E0277]: the size for value values of type `str` cannot be known at compilation time --> $DIR/cast-rfc0401.rs:72:13 | -LL | let _ = a as *const Foo; //~ ERROR `str` does not have a constant size known at compile-time - | ^ `str` does not have a constant size known at compile-time +LL | let _ = a as *const Foo; //~ ERROR the size for value values of type + | ^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `str` = note: to learn more, visit diff --git a/src/test/ui/resolve/issue-5035-2.rs b/src/test/ui/resolve/issue-5035-2.rs index f6cdb05394a47..ca854f9f70122 100644 --- a/src/test/ui/resolve/issue-5035-2.rs +++ b/src/test/ui/resolve/issue-5035-2.rs @@ -12,6 +12,6 @@ trait I {} type K = I+'static; fn foo(_x: K) {} -//~^ ERROR `I + 'static` does not have a constant size known at compile-time +//~^ ERROR the size for value values of type fn main() {} diff --git a/src/test/ui/resolve/issue-5035-2.stderr b/src/test/ui/resolve/issue-5035-2.stderr index 1488f6b998539..efcd0b3624811 100644 --- a/src/test/ui/resolve/issue-5035-2.stderr +++ b/src/test/ui/resolve/issue-5035-2.stderr @@ -1,8 +1,8 @@ -error[E0277]: `I + 'static` does not have a constant size known at compile-time +error[E0277]: the size for value values of type `I + 'static` cannot be known at compilation time --> $DIR/issue-5035-2.rs:14:8 | LL | fn foo(_x: K) {} - | ^^ `I + 'static` does not have a constant size known at compile-time + | ^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `I + 'static` = note: to learn more, visit diff --git a/src/test/ui/suggestions/str-array-assignment.rs b/src/test/ui/suggestions/str-array-assignment.rs index f6b75981a662b..8fbab40223271 100644 --- a/src/test/ui/suggestions/str-array-assignment.rs +++ b/src/test/ui/suggestions/str-array-assignment.rs @@ -15,7 +15,7 @@ fn main() { let u: &str = if true { s[..2] } else { s }; //~^ ERROR mismatched types let v = s[..2]; - //~^ ERROR `str` does not have a constant size known at compile-time + //~^ ERROR the size for value values of type let w: &str = s[..2]; //~^ ERROR mismatched types } diff --git a/src/test/ui/suggestions/str-array-assignment.stderr b/src/test/ui/suggestions/str-array-assignment.stderr index acf51f89fc48c..12699d8b25f81 100644 --- a/src/test/ui/suggestions/str-array-assignment.stderr +++ b/src/test/ui/suggestions/str-array-assignment.stderr @@ -19,13 +19,13 @@ LL | let u: &str = if true { s[..2] } else { s }; = note: expected type `&str` found type `str` -error[E0277]: `str` does not have a constant size known at compile-time +error[E0277]: the size for value values of type `str` cannot be known at compilation time --> $DIR/str-array-assignment.rs:17:7 | LL | let v = s[..2]; | ^ ------ help: consider borrowing here: `&s[..2]` | | - | `str` does not have a constant size known at compile-time + | doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `str` = note: to learn more, visit diff --git a/src/test/ui/trait-suggest-where-clause.rs b/src/test/ui/trait-suggest-where-clause.rs index 7962dbea3711f..dd74f4f479727 100644 --- a/src/test/ui/trait-suggest-where-clause.rs +++ b/src/test/ui/trait-suggest-where-clause.rs @@ -15,10 +15,10 @@ struct Misc(T); fn check() { // suggest a where-clause, if needed mem::size_of::(); - //~^ ERROR `U` does not have a constant size known at compile-time + //~^ ERROR the size for value values of type mem::size_of::>(); - //~^ ERROR `U` does not have a constant size known at compile-time + //~^ ERROR the size for value values of type // ... even if T occurs as a type parameter @@ -36,10 +36,10 @@ fn check() { // ... and also not if the error is not related to the type mem::size_of::<[T]>(); - //~^ ERROR `[T]` does not have a constant size known at compile-time + //~^ ERROR the size for value values of type mem::size_of::<[&U]>(); - //~^ ERROR `[&U]` does not have a constant size known at compile-time + //~^ ERROR the size for value values of type } fn main() { diff --git a/src/test/ui/trait-suggest-where-clause.stderr b/src/test/ui/trait-suggest-where-clause.stderr index d87641d8d0fa9..feb31ae22d8ca 100644 --- a/src/test/ui/trait-suggest-where-clause.stderr +++ b/src/test/ui/trait-suggest-where-clause.stderr @@ -1,19 +1,19 @@ -error[E0277]: `U` does not have a constant size known at compile-time +error[E0277]: the size for value values of type `U` cannot be known at compilation time --> $DIR/trait-suggest-where-clause.rs:17:5 | LL | mem::size_of::(); - | ^^^^^^^^^^^^^^^^^ `U` does not have a constant size known at compile-time + | ^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `U` = note: to learn more, visit = help: consider adding a `where U: std::marker::Sized` bound = note: required by `std::mem::size_of` -error[E0277]: `U` does not have a constant size known at compile-time +error[E0277]: the size for value values of type `U` cannot be known at compilation time --> $DIR/trait-suggest-where-clause.rs:20:5 | LL | mem::size_of::>(); - | ^^^^^^^^^^^^^^^^^^^^^^^ `U` does not have a constant size known at compile-time + | ^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: within `Misc`, the trait `std::marker::Sized` is not implemented for `U` = note: to learn more, visit @@ -47,21 +47,21 @@ LL | as From>::from; | = note: required by `std::convert::From::from` -error[E0277]: `[T]` does not have a constant size known at compile-time +error[E0277]: the size for value values of type `[T]` cannot be known at compilation time --> $DIR/trait-suggest-where-clause.rs:38:5 | LL | mem::size_of::<[T]>(); - | ^^^^^^^^^^^^^^^^^^^ `[T]` does not have a constant size known at compile-time + | ^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `[T]` = note: to learn more, visit = note: required by `std::mem::size_of` -error[E0277]: `[&U]` does not have a constant size known at compile-time +error[E0277]: the size for value values of type `[&U]` cannot be known at compilation time --> $DIR/trait-suggest-where-clause.rs:41:5 | LL | mem::size_of::<[&U]>(); - | ^^^^^^^^^^^^^^^^^^^^ `[&U]` does not have a constant size known at compile-time + | ^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `[&U]` = note: to learn more, visit diff --git a/src/test/ui/trivial-bounds-leak.stderr b/src/test/ui/trivial-bounds-leak.stderr index 6f1f885a5068b..d08574c3d8789 100644 --- a/src/test/ui/trivial-bounds-leak.stderr +++ b/src/test/ui/trivial-bounds-leak.stderr @@ -1,8 +1,8 @@ -error[E0277]: `str` does not have a constant size known at compile-time +error[E0277]: the size for value values of type `str` cannot be known at compilation time --> $DIR/trivial-bounds-leak.rs:22:25 | LL | fn cant_return_str() -> str { //~ ERROR - | ^^^ `str` does not have a constant size known at compile-time + | ^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `str` = note: to learn more, visit diff --git a/src/test/ui/union/union-sized-field.rs b/src/test/ui/union/union-sized-field.rs index e40c6d11cb32c..15822ae42998c 100644 --- a/src/test/ui/union/union-sized-field.rs +++ b/src/test/ui/union/union-sized-field.rs @@ -12,18 +12,18 @@ union Foo { value: T, - //~^ ERROR `T` does not have a constant size known at compile-time + //~^ ERROR the size for value values of type } struct Foo2 { value: T, - //~^ ERROR `T` does not have a constant size known at compile-time + //~^ ERROR the size for value values of type t: u32, } enum Foo3 { Value(T), - //~^ ERROR `T` does not have a constant size known at compile-time + //~^ ERROR the size for value values of type } fn main() {} diff --git a/src/test/ui/union/union-sized-field.stderr b/src/test/ui/union/union-sized-field.stderr index 9fdc5af0481ae..c6b7cf4e07823 100644 --- a/src/test/ui/union/union-sized-field.stderr +++ b/src/test/ui/union/union-sized-field.stderr @@ -1,30 +1,30 @@ -error[E0277]: `T` does not have a constant size known at compile-time +error[E0277]: the size for value values of type `T` cannot be known at compilation time --> $DIR/union-sized-field.rs:14:5 | LL | value: T, - | ^^^^^^^^ `T` does not have a constant size known at compile-time + | ^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `T` = note: to learn more, visit = help: consider adding a `where T: std::marker::Sized` bound = note: no field of a union may have a dynamically sized type -error[E0277]: `T` does not have a constant size known at compile-time +error[E0277]: the size for value values of type `T` cannot be known at compilation time --> $DIR/union-sized-field.rs:19:5 | LL | value: T, - | ^^^^^^^^ `T` does not have a constant size known at compile-time + | ^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `T` = note: to learn more, visit = help: consider adding a `where T: std::marker::Sized` bound = note: only the last field of a struct may have a dynamically sized type -error[E0277]: `T` does not have a constant size known at compile-time +error[E0277]: the size for value values of type `T` cannot be known at compilation time --> $DIR/union-sized-field.rs:25:11 | LL | Value(T), - | ^ `T` does not have a constant size known at compile-time + | ^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `T` = note: to learn more, visit diff --git a/src/test/ui/unsized-enum2.rs b/src/test/ui/unsized-enum2.rs index 4e42b92289b36..9082ea4abddbd 100644 --- a/src/test/ui/unsized-enum2.rs +++ b/src/test/ui/unsized-enum2.rs @@ -31,53 +31,53 @@ struct Path4(PathHelper4); enum E { // parameter VA(W), - //~^ ERROR `W` does not have a constant size known at compile-time + //~^ ERROR the size for value values of type VB{x: X}, - //~^ ERROR `X` does not have a constant size known at compile-time + //~^ ERROR the size for value values of type VC(isize, Y), - //~^ ERROR `Y` does not have a constant size known at compile-time + //~^ ERROR the size for value values of type VD{u: isize, x: Z}, - //~^ ERROR `Z` does not have a constant size known at compile-time + //~^ ERROR the size for value values of type // slice / str VE([u8]), - //~^ ERROR `[u8]` does not have a constant size known at compile-time + //~^ ERROR the size for value values of type VF{x: str}, - //~^ ERROR `str` does not have a constant size known at compile-time + //~^ ERROR the size for value values of type VG(isize, [f32]), - //~^ ERROR `[f32]` does not have a constant size known at compile-time + //~^ ERROR the size for value values of type VH{u: isize, x: [u32]}, - //~^ ERROR `[u32]` does not have a constant size known at compile-time + //~^ ERROR the size for value values of type // unsized struct VI(Path1), - //~^ ERROR `PathHelper1 + 'static` does not have a constant size known at compile-time + //~^ ERROR the size for value values of type VJ{x: Path2}, - //~^ ERROR `PathHelper2 + 'static` does not have a constant size known at compile-time + //~^ ERROR the size for value values of type VK(isize, Path3), - //~^ ERROR `PathHelper3 + 'static` does not have a constant size known at compile-time + //~^ ERROR the size for value values of type VL{u: isize, x: Path4}, - //~^ ERROR `PathHelper4 + 'static` does not have a constant size known at compile-time + //~^ ERROR the size for value values of type // plain trait VM(Foo), - //~^ ERROR `Foo + 'static` does not have a constant size known at compile-time + //~^ ERROR the size for value values of type VN{x: Bar}, - //~^ ERROR `Bar + 'static` does not have a constant size known at compile-time + //~^ ERROR the size for value values of type VO(isize, FooBar), - //~^ ERROR `FooBar + 'static` does not have a constant size known at compile-time + //~^ ERROR the size for value values of type VP{u: isize, x: BarFoo}, - //~^ ERROR `BarFoo + 'static` does not have a constant size known at compile-time + //~^ ERROR the size for value values of type // projected VQ(<&'static [i8] as Deref>::Target), - //~^ ERROR `[i8]` does not have a constant size known at compile-time + //~^ ERROR the size for value values of type VR{x: <&'static [char] as Deref>::Target}, - //~^ ERROR `[char]` does not have a constant size known at compile-time + //~^ ERROR the size for value values of type VS(isize, <&'static [f64] as Deref>::Target), - //~^ ERROR `[f64]` does not have a constant size known at compile-time + //~^ ERROR the size for value values of type VT{u: isize, x: <&'static [i32] as Deref>::Target}, - //~^ ERROR `[i32]` does not have a constant size known at compile-time + //~^ ERROR the size for value values of type } diff --git a/src/test/ui/unsized-enum2.stderr b/src/test/ui/unsized-enum2.stderr index 91b8e5def7edd..ff2aa1d1ef917 100644 --- a/src/test/ui/unsized-enum2.stderr +++ b/src/test/ui/unsized-enum2.stderr @@ -1,205 +1,205 @@ -error[E0277]: `W` does not have a constant size known at compile-time +error[E0277]: the size for value values of type `W` cannot be known at compilation time --> $DIR/unsized-enum2.rs:33:8 | LL | VA(W), - | ^ `W` does not have a constant size known at compile-time + | ^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `W` = note: to learn more, visit = help: consider adding a `where W: std::marker::Sized` bound = note: no field of an enum variant may have a dynamically sized type -error[E0277]: `X` does not have a constant size known at compile-time +error[E0277]: the size for value values of type `X` cannot be known at compilation time --> $DIR/unsized-enum2.rs:35:8 | LL | VB{x: X}, - | ^^^^ `X` does not have a constant size known at compile-time + | ^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `X` = note: to learn more, visit = help: consider adding a `where X: std::marker::Sized` bound = note: no field of an enum variant may have a dynamically sized type -error[E0277]: `Y` does not have a constant size known at compile-time +error[E0277]: the size for value values of type `Y` cannot be known at compilation time --> $DIR/unsized-enum2.rs:37:15 | LL | VC(isize, Y), - | ^ `Y` does not have a constant size known at compile-time + | ^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `Y` = note: to learn more, visit = help: consider adding a `where Y: std::marker::Sized` bound = note: no field of an enum variant may have a dynamically sized type -error[E0277]: `Z` does not have a constant size known at compile-time +error[E0277]: the size for value values of type `Z` cannot be known at compilation time --> $DIR/unsized-enum2.rs:39:18 | LL | VD{u: isize, x: Z}, - | ^^^^ `Z` does not have a constant size known at compile-time + | ^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `Z` = note: to learn more, visit = help: consider adding a `where Z: std::marker::Sized` bound = note: no field of an enum variant may have a dynamically sized type -error[E0277]: `[u8]` does not have a constant size known at compile-time +error[E0277]: the size for value values of type `[u8]` cannot be known at compilation time --> $DIR/unsized-enum2.rs:43:8 | LL | VE([u8]), - | ^^^^ `[u8]` does not have a constant size known at compile-time + | ^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `[u8]` = note: to learn more, visit = note: no field of an enum variant may have a dynamically sized type -error[E0277]: `str` does not have a constant size known at compile-time +error[E0277]: the size for value values of type `str` cannot be known at compilation time --> $DIR/unsized-enum2.rs:45:8 | LL | VF{x: str}, - | ^^^^^^ `str` does not have a constant size known at compile-time + | ^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `str` = note: to learn more, visit = note: no field of an enum variant may have a dynamically sized type -error[E0277]: `[f32]` does not have a constant size known at compile-time +error[E0277]: the size for value values of type `[f32]` cannot be known at compilation time --> $DIR/unsized-enum2.rs:47:15 | LL | VG(isize, [f32]), - | ^^^^^ `[f32]` does not have a constant size known at compile-time + | ^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `[f32]` = note: to learn more, visit = note: no field of an enum variant may have a dynamically sized type -error[E0277]: `[u32]` does not have a constant size known at compile-time +error[E0277]: the size for value values of type `[u32]` cannot be known at compilation time --> $DIR/unsized-enum2.rs:49:18 | LL | VH{u: isize, x: [u32]}, - | ^^^^^^^^ `[u32]` does not have a constant size known at compile-time + | ^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `[u32]` = note: to learn more, visit = note: no field of an enum variant may have a dynamically sized type -error[E0277]: `Foo + 'static` does not have a constant size known at compile-time +error[E0277]: the size for value values of type `Foo + 'static` cannot be known at compilation time --> $DIR/unsized-enum2.rs:63:8 | LL | VM(Foo), - | ^^^ `Foo + 'static` does not have a constant size known at compile-time + | ^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `Foo + 'static` = note: to learn more, visit = note: no field of an enum variant may have a dynamically sized type -error[E0277]: `Bar + 'static` does not have a constant size known at compile-time +error[E0277]: the size for value values of type `Bar + 'static` cannot be known at compilation time --> $DIR/unsized-enum2.rs:65:8 | LL | VN{x: Bar}, - | ^^^^^^ `Bar + 'static` does not have a constant size known at compile-time + | ^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `Bar + 'static` = note: to learn more, visit = note: no field of an enum variant may have a dynamically sized type -error[E0277]: `FooBar + 'static` does not have a constant size known at compile-time +error[E0277]: the size for value values of type `FooBar + 'static` cannot be known at compilation time --> $DIR/unsized-enum2.rs:67:15 | LL | VO(isize, FooBar), - | ^^^^^^ `FooBar + 'static` does not have a constant size known at compile-time + | ^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `FooBar + 'static` = note: to learn more, visit = note: no field of an enum variant may have a dynamically sized type -error[E0277]: `BarFoo + 'static` does not have a constant size known at compile-time +error[E0277]: the size for value values of type `BarFoo + 'static` cannot be known at compilation time --> $DIR/unsized-enum2.rs:69:18 | LL | VP{u: isize, x: BarFoo}, - | ^^^^^^^^^ `BarFoo + 'static` does not have a constant size known at compile-time + | ^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `BarFoo + 'static` = note: to learn more, visit = note: no field of an enum variant may have a dynamically sized type -error[E0277]: `[i8]` does not have a constant size known at compile-time +error[E0277]: the size for value values of type `[i8]` cannot be known at compilation time --> $DIR/unsized-enum2.rs:73:8 | LL | VQ(<&'static [i8] as Deref>::Target), - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `[i8]` does not have a constant size known at compile-time + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `[i8]` = note: to learn more, visit = note: no field of an enum variant may have a dynamically sized type -error[E0277]: `[char]` does not have a constant size known at compile-time +error[E0277]: the size for value values of type `[char]` cannot be known at compilation time --> $DIR/unsized-enum2.rs:75:8 | LL | VR{x: <&'static [char] as Deref>::Target}, - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `[char]` does not have a constant size known at compile-time + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `[char]` = note: to learn more, visit = note: no field of an enum variant may have a dynamically sized type -error[E0277]: `[f64]` does not have a constant size known at compile-time +error[E0277]: the size for value values of type `[f64]` cannot be known at compilation time --> $DIR/unsized-enum2.rs:77:15 | LL | VS(isize, <&'static [f64] as Deref>::Target), - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `[f64]` does not have a constant size known at compile-time + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `[f64]` = note: to learn more, visit = note: no field of an enum variant may have a dynamically sized type -error[E0277]: `[i32]` does not have a constant size known at compile-time +error[E0277]: the size for value values of type `[i32]` cannot be known at compilation time --> $DIR/unsized-enum2.rs:79:18 | LL | VT{u: isize, x: <&'static [i32] as Deref>::Target}, - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `[i32]` does not have a constant size known at compile-time + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `[i32]` = note: to learn more, visit = note: no field of an enum variant may have a dynamically sized type -error[E0277]: `PathHelper1 + 'static` does not have a constant size known at compile-time +error[E0277]: the size for value values of type `PathHelper1 + 'static` cannot be known at compilation time --> $DIR/unsized-enum2.rs:53:8 | LL | VI(Path1), - | ^^^^^ `PathHelper1 + 'static` does not have a constant size known at compile-time + | ^^^^^ doesn't have a size known at compile-time | = help: within `Path1`, the trait `std::marker::Sized` is not implemented for `PathHelper1 + 'static` = note: to learn more, visit = note: required because it appears within the type `Path1` = note: no field of an enum variant may have a dynamically sized type -error[E0277]: `PathHelper2 + 'static` does not have a constant size known at compile-time +error[E0277]: the size for value values of type `PathHelper2 + 'static` cannot be known at compilation time --> $DIR/unsized-enum2.rs:55:8 | LL | VJ{x: Path2}, - | ^^^^^^^^ `PathHelper2 + 'static` does not have a constant size known at compile-time + | ^^^^^^^^ doesn't have a size known at compile-time | = help: within `Path2`, the trait `std::marker::Sized` is not implemented for `PathHelper2 + 'static` = note: to learn more, visit = note: required because it appears within the type `Path2` = note: no field of an enum variant may have a dynamically sized type -error[E0277]: `PathHelper3 + 'static` does not have a constant size known at compile-time +error[E0277]: the size for value values of type `PathHelper3 + 'static` cannot be known at compilation time --> $DIR/unsized-enum2.rs:57:15 | LL | VK(isize, Path3), - | ^^^^^ `PathHelper3 + 'static` does not have a constant size known at compile-time + | ^^^^^ doesn't have a size known at compile-time | = help: within `Path3`, the trait `std::marker::Sized` is not implemented for `PathHelper3 + 'static` = note: to learn more, visit = note: required because it appears within the type `Path3` = note: no field of an enum variant may have a dynamically sized type -error[E0277]: `PathHelper4 + 'static` does not have a constant size known at compile-time +error[E0277]: the size for value values of type `PathHelper4 + 'static` cannot be known at compilation time --> $DIR/unsized-enum2.rs:59:18 | LL | VL{u: isize, x: Path4}, - | ^^^^^^^^ `PathHelper4 + 'static` does not have a constant size known at compile-time + | ^^^^^^^^ doesn't have a size known at compile-time | = help: within `Path4`, the trait `std::marker::Sized` is not implemented for `PathHelper4 + 'static` = note: to learn more, visit From 28cea50a46f4669b94d8332bf64d07e7e5a02d79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Tue, 19 Jun 2018 16:22:37 -0700 Subject: [PATCH 9/9] Update error code numbers --- src/libsyntax/diagnostic_list.rs | 4 ++-- src/libsyntax/parse/parser.rs | 4 ++-- src/test/ui/codemap_tests/unicode.stderr | 4 ++-- src/test/ui/pub/pub-restricted.stderr | 10 +++++----- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/libsyntax/diagnostic_list.rs b/src/libsyntax/diagnostic_list.rs index 2031885475852..8534969c623bc 100644 --- a/src/libsyntax/diagnostic_list.rs +++ b/src/libsyntax/diagnostic_list.rs @@ -397,6 +397,6 @@ register_diagnostics! { E0630, // rustc_const_unstable attribute must be paired with stable/unstable attribute E0693, // incorrect `repr(align)` attribute format E0694, // an unknown tool name found in scoped attributes - E0697, // invalid ABI - E0698, // incorrect visibility restriction + E0703, // invalid ABI + E0704, // incorrect visibility restriction } diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 398d2f04d0f04..2c6ea50d2c8ad 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -6000,7 +6000,7 @@ impl<'a> Parser<'a> { let sp = self.prev_span; let help_msg = format!("make this visible only to module `{}` with `in`", path); self.expect(&token::CloseDelim(token::Paren))?; // `)` - let mut err = struct_span_err!(self.sess.span_diagnostic, sp, E0698, "{}", msg); + let mut err = struct_span_err!(self.sess.span_diagnostic, sp, E0704, "{}", msg); err.help(suggestion); err.span_suggestion_with_applicability( sp, &help_msg, format!("in {}", path), Applicability::MachineApplicable @@ -6550,7 +6550,7 @@ impl<'a> Parser<'a> { let mut err = struct_span_err!( self.sess.span_diagnostic, prev_span, - E0697, + E0703, "invalid ABI: found `{}`", s); err.span_label(prev_span, "invalid ABI"); diff --git a/src/test/ui/codemap_tests/unicode.stderr b/src/test/ui/codemap_tests/unicode.stderr index d2e79a0b47d3f..4271382ed5b22 100644 --- a/src/test/ui/codemap_tests/unicode.stderr +++ b/src/test/ui/codemap_tests/unicode.stderr @@ -1,4 +1,4 @@ -error[E0697]: invalid ABI: found `路濫狼á́́` +error[E0703]: invalid ABI: found `路濫狼á́́` --> $DIR/unicode.rs:11:8 | LL | extern "路濫狼á́́" fn foo() {} //~ ERROR invalid ABI @@ -8,4 +8,4 @@ LL | extern "路濫狼á́́" fn foo() {} //~ ERROR invalid ABI error: aborting due to previous error -For more information about this error, try `rustc --explain E0697`. +For more information about this error, try `rustc --explain E0703`. diff --git a/src/test/ui/pub/pub-restricted.stderr b/src/test/ui/pub/pub-restricted.stderr index 114732c39f2cc..de755dd6a4602 100644 --- a/src/test/ui/pub/pub-restricted.stderr +++ b/src/test/ui/pub/pub-restricted.stderr @@ -1,4 +1,4 @@ -error[E0698]: incorrect visibility restriction +error[E0704]: incorrect visibility restriction --> $DIR/pub-restricted.rs:15:6 | LL | pub (a) fn afn() {} //~ incorrect visibility restriction @@ -9,7 +9,7 @@ LL | pub (a) fn afn() {} //~ incorrect visibility restriction `pub(super)`: visible only in the current module's parent `pub(in path::to::module)`: visible only on the specified path -error[E0698]: incorrect visibility restriction +error[E0704]: incorrect visibility restriction --> $DIR/pub-restricted.rs:16:6 | LL | pub (b) fn bfn() {} //~ incorrect visibility restriction @@ -20,7 +20,7 @@ LL | pub (b) fn bfn() {} //~ incorrect visibility restriction `pub(super)`: visible only in the current module's parent `pub(in path::to::module)`: visible only on the specified path -error[E0698]: incorrect visibility restriction +error[E0704]: incorrect visibility restriction --> $DIR/pub-restricted.rs:32:14 | LL | pub (a) invalid: usize, //~ incorrect visibility restriction @@ -31,7 +31,7 @@ LL | pub (a) invalid: usize, //~ incorrect visibility restriction `pub(super)`: visible only in the current module's parent `pub(in path::to::module)`: visible only on the specified path -error[E0698]: incorrect visibility restriction +error[E0704]: incorrect visibility restriction --> $DIR/pub-restricted.rs:41:6 | LL | pub (xyz) fn xyz() {} //~ incorrect visibility restriction @@ -50,4 +50,4 @@ LL | pub (in x) non_parent_invalid: usize, //~ ERROR visibilities can on error: aborting due to 5 previous errors -For more information about this error, try `rustc --explain E0698`. +For more information about this error, try `rustc --explain E0704`.