diff options
Diffstat (limited to 'tests')
113 files changed, 816 insertions, 470 deletions
diff --git a/tests/rustdoc-ui/invalid_const_in_lifetime_position.stderr b/tests/rustdoc-ui/invalid_const_in_lifetime_position.stderr index 50d55284754..ef551cbea3e 100644 --- a/tests/rustdoc-ui/invalid_const_in_lifetime_position.stderr +++ b/tests/rustdoc-ui/invalid_const_in_lifetime_position.stderr @@ -18,7 +18,7 @@ error[E0107]: associated type takes 0 generic arguments but 1 generic argument w --> $DIR/invalid_const_in_lifetime_position.rs:4:26 | LL | fn f<'a>(arg : Box<dyn X<Y<1> = &'a ()>>) {} - | ^--- help: remove these generics + | ^--- help: remove the unnecessary generics | | | expected 0 generic arguments | @@ -49,7 +49,7 @@ error[E0107]: associated type takes 0 generic arguments but 1 generic argument w --> $DIR/invalid_const_in_lifetime_position.rs:4:26 | LL | fn f<'a>(arg : Box<dyn X<Y<1> = &'a ()>>) {} - | ^--- help: remove these generics + | ^--- help: remove the unnecessary generics | | | expected 0 generic arguments | @@ -81,7 +81,7 @@ error[E0107]: associated type takes 0 generic arguments but 1 generic argument w --> $DIR/invalid_const_in_lifetime_position.rs:4:26 | LL | fn f<'a>(arg : Box<dyn X<Y<1> = &'a ()>>) {} - | ^--- help: remove these generics + | ^--- help: remove the unnecessary generics | | | expected 0 generic arguments | diff --git a/tests/rustdoc-ui/mismatched_arg_count.stderr b/tests/rustdoc-ui/mismatched_arg_count.stderr index 857bbda2ef4..5daeef2eb18 100644 --- a/tests/rustdoc-ui/mismatched_arg_count.stderr +++ b/tests/rustdoc-ui/mismatched_arg_count.stderr @@ -2,7 +2,7 @@ error[E0107]: type alias takes 1 lifetime argument but 2 lifetime arguments were --> $DIR/mismatched_arg_count.rs:7:29 | LL | fn bar<'a, T: Trait<'a>>(_: Alias<'a, 'a, T>) {} - | ^^^^^ -- help: remove this lifetime argument + | ^^^^^ ---- help: remove the lifetime argument | | | expected 1 lifetime argument | diff --git a/tests/ui-fulldeps/pprust-expr-roundtrip.rs b/tests/ui-fulldeps/pprust-expr-roundtrip.rs index 762ad0b79ec..8379ca86494 100644 --- a/tests/ui-fulldeps/pprust-expr-roundtrip.rs +++ b/tests/ui-fulldeps/pprust-expr-roundtrip.rs @@ -46,9 +46,11 @@ use thin_vec::{thin_vec, ThinVec}; fn parse_expr(psess: &ParseSess, src: &str) -> Option<P<Expr>> { let src_as_string = src.to_string(); - let mut p = unwrap_or_emit_fatal( - new_parser_from_source_str(psess, FileName::Custom(src_as_string.clone()), src_as_string) - ); + let mut p = unwrap_or_emit_fatal(new_parser_from_source_str( + psess, + FileName::Custom(src_as_string.clone()), + src_as_string, + )); p.parse_expr().map_err(|e| e.cancel()).ok() } @@ -181,10 +183,9 @@ fn iter_exprs(depth: usize, f: &mut dyn FnMut(P<Expr>)) { 18 => { let pat = P(Pat { id: DUMMY_NODE_ID, kind: PatKind::Wild, span: DUMMY_SP, tokens: None }); - iter_exprs( - depth - 1, - &mut |e| g(ExprKind::Let(pat.clone(), e, DUMMY_SP, Recovered::No)) - ) + iter_exprs(depth - 1, &mut |e| { + g(ExprKind::Let(pat.clone(), e, DUMMY_SP, Recovered::No)) + }) } _ => panic!("bad counter value in iter_exprs"), } @@ -202,7 +203,7 @@ impl MutVisitor for RemoveParens { ExprKind::Paren(inner) => *e = inner, _ => {} }; - mut_visit::noop_visit_expr(e, self); + mut_visit::walk_expr(self, e); } } @@ -211,7 +212,7 @@ struct AddParens; impl MutVisitor for AddParens { fn visit_expr(&mut self, e: &mut P<Expr>) { - mut_visit::noop_visit_expr(e, self); + mut_visit::walk_expr(self, e); visit_clobber(e, |e| { P(Expr { id: DUMMY_NODE_ID, diff --git a/tests/ui/argument-suggestions/issue-100154.stderr b/tests/ui/argument-suggestions/issue-100154.stderr index 966f56e2a15..7eaebcafb59 100644 --- a/tests/ui/argument-suggestions/issue-100154.stderr +++ b/tests/ui/argument-suggestions/issue-100154.stderr @@ -2,7 +2,7 @@ error[E0107]: function takes 0 generic arguments but 1 generic argument was supp --> $DIR/issue-100154.rs:4:5 | LL | foo::<()>(()); - | ^^^------ help: remove these generics + | ^^^------ help: remove the unnecessary generics | | | expected 0 generic arguments | diff --git a/tests/ui/async-await/async-fn/edition-2015.rs b/tests/ui/async-await/async-fn/edition-2015.rs index 83b9d415dda..50448313b30 100644 --- a/tests/ui/async-await/async-fn/edition-2015.rs +++ b/tests/ui/async-await/async-fn/edition-2015.rs @@ -3,5 +3,7 @@ fn foo(x: impl async Fn()) -> impl async Fn() { x } //~| ERROR `async` trait bounds are only allowed in Rust 2018 or later //~| ERROR async closures are unstable //~| ERROR async closures are unstable +//~| ERROR use of unstable library feature 'async_closure' +//~| ERROR use of unstable library feature 'async_closure' fn main() {} diff --git a/tests/ui/async-await/async-fn/edition-2015.stderr b/tests/ui/async-await/async-fn/edition-2015.stderr index 0029d53868d..23ffee0d0a6 100644 --- a/tests/ui/async-await/async-fn/edition-2015.stderr +++ b/tests/ui/async-await/async-fn/edition-2015.stderr @@ -38,6 +38,26 @@ LL | fn foo(x: impl async Fn()) -> impl async Fn() { x } = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date = help: to use an async block, remove the `||`: `async {` -error: aborting due to 4 previous errors +error[E0658]: use of unstable library feature 'async_closure' + --> $DIR/edition-2015.rs:1:22 + | +LL | fn foo(x: impl async Fn()) -> impl async Fn() { x } + | ^^^^ + | + = note: see issue #62290 <https://github.com/rust-lang/rust/issues/62290> for more information + = help: add `#![feature(async_closure)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + +error[E0658]: use of unstable library feature 'async_closure' + --> $DIR/edition-2015.rs:1:42 + | +LL | fn foo(x: impl async Fn()) -> impl async Fn() { x } + | ^^^^ + | + = note: see issue #62290 <https://github.com/rust-lang/rust/issues/62290> for more information + = help: add `#![feature(async_closure)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + +error: aborting due to 6 previous errors For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/async-await/async-fn/simple.rs b/tests/ui/async-await/async-fn/simple.rs index 21972ba5aef..3f15b08560a 100644 --- a/tests/ui/async-await/async-fn/simple.rs +++ b/tests/ui/async-await/async-fn/simple.rs @@ -2,7 +2,7 @@ //@ edition: 2021 //@ build-pass -#![feature(async_fn_traits)] +#![feature(async_closure)] extern crate block_on; diff --git a/tests/crashes/119272.rs b/tests/ui/auto-traits/opaque_type_candidate_selection.rs index 02e2cfd09e2..d6973b76a6e 100644 --- a/tests/crashes/119272.rs +++ b/tests/ui/auto-traits/opaque_type_candidate_selection.rs @@ -1,4 +1,7 @@ -//@ known-bug: #119272 +//! used to ICE: #119272 + +//@ check-pass + #![feature(type_alias_impl_trait)] mod defining_scope { use super::*; diff --git a/tests/ui/borrowck/issue-82126-mismatched-subst-and-hir.stderr b/tests/ui/borrowck/issue-82126-mismatched-subst-and-hir.stderr index c0b6dcd1512..e9efc932ea8 100644 --- a/tests/ui/borrowck/issue-82126-mismatched-subst-and-hir.stderr +++ b/tests/ui/borrowck/issue-82126-mismatched-subst-and-hir.stderr @@ -2,7 +2,7 @@ error[E0107]: struct takes 0 lifetime arguments but 1 lifetime argument was supp --> $DIR/issue-82126-mismatched-subst-and-hir.rs:16:59 | LL | async fn buy_lock(coroutine: &Mutex<MarketMultiplier>) -> LockedMarket<'_> { - | ^^^^^^^^^^^^---- help: remove these generics + | ^^^^^^^^^^^^---- help: remove the unnecessary generics | | | expected 0 lifetime arguments | @@ -32,7 +32,7 @@ error[E0107]: struct takes 0 lifetime arguments but 1 lifetime argument was supp --> $DIR/issue-82126-mismatched-subst-and-hir.rs:16:59 | LL | async fn buy_lock(coroutine: &Mutex<MarketMultiplier>) -> LockedMarket<'_> { - | ^^^^^^^^^^^^---- help: remove these generics + | ^^^^^^^^^^^^---- help: remove the unnecessary generics | | | expected 0 lifetime arguments | diff --git a/tests/ui/const-generics/adt_const_params/transmutable-ice-110969.stderr b/tests/ui/const-generics/adt_const_params/transmutable-ice-110969.stderr index a8fc742e89f..5c04c4c9d5b 100644 --- a/tests/ui/const-generics/adt_const_params/transmutable-ice-110969.stderr +++ b/tests/ui/const-generics/adt_const_params/transmutable-ice-110969.stderr @@ -2,7 +2,7 @@ error[E0107]: trait takes at most 2 generic arguments but 3 generic arguments we --> $DIR/transmutable-ice-110969.rs:11:14 | LL | Dst: BikeshedIntrinsicFrom<Src, Context, ASSUME>, - | ^^^^^^^^^^^^^^^^^^^^^ ------ help: remove this generic argument + | ^^^^^^^^^^^^^^^^^^^^^ -------- help: remove the unnecessary generic argument | | | expected at most 2 generic arguments diff --git a/tests/ui/const-generics/generic_arg_infer/infer-arg-test.stderr b/tests/ui/const-generics/generic_arg_infer/infer-arg-test.stderr index 6d8dd017734..a9c57dbf26a 100644 --- a/tests/ui/const-generics/generic_arg_infer/infer-arg-test.stderr +++ b/tests/ui/const-generics/generic_arg_infer/infer-arg-test.stderr @@ -23,7 +23,7 @@ error[E0107]: struct takes 2 generic arguments but 3 generic arguments were supp --> $DIR/infer-arg-test.rs:18:10 | LL | let a: All<_, _, _>; - | ^^^ - help: remove this generic argument + | ^^^ --- help: remove the unnecessary generic argument | | | expected 2 generic arguments | diff --git a/tests/ui/const-generics/generic_const_exprs/const_kind_expr/issue_114151.stderr b/tests/ui/const-generics/generic_const_exprs/const_kind_expr/issue_114151.stderr index 0c29d94ed5b..4d1fb02b59e 100644 --- a/tests/ui/const-generics/generic_const_exprs/const_kind_expr/issue_114151.stderr +++ b/tests/ui/const-generics/generic_const_exprs/const_kind_expr/issue_114151.stderr @@ -2,7 +2,7 @@ error[E0107]: function takes 1 generic argument but 2 generic arguments were sup --> $DIR/issue_114151.rs:17:5 | LL | foo::<_, L>([(); L + 1 + L]); - | ^^^ - help: remove this generic argument + | ^^^ --- help: remove the unnecessary generic argument | | | expected 1 generic argument | diff --git a/tests/ui/const-generics/generic_const_exprs/issue-102768.stderr b/tests/ui/const-generics/generic_const_exprs/issue-102768.stderr index a470c36134c..37e09a075fe 100644 --- a/tests/ui/const-generics/generic_const_exprs/issue-102768.stderr +++ b/tests/ui/const-generics/generic_const_exprs/issue-102768.stderr @@ -18,7 +18,7 @@ error[E0107]: associated type takes 0 generic arguments but 1 generic argument w --> $DIR/issue-102768.rs:9:30 | LL | fn f2<'a>(arg: Box<dyn X<Y<1> = &'a ()>>) {} - | ^--- help: remove these generics + | ^--- help: remove the unnecessary generics | | | expected 0 generic arguments | @@ -49,7 +49,7 @@ error[E0107]: associated type takes 0 generic arguments but 1 generic argument w --> $DIR/issue-102768.rs:9:30 | LL | fn f2<'a>(arg: Box<dyn X<Y<1> = &'a ()>>) {} - | ^--- help: remove these generics + | ^--- help: remove the unnecessary generics | | | expected 0 generic arguments | @@ -81,7 +81,7 @@ error[E0107]: associated type takes 0 generic arguments but 1 generic argument w --> $DIR/issue-102768.rs:9:30 | LL | fn f2<'a>(arg: Box<dyn X<Y<1> = &'a ()>>) {} - | ^--- help: remove these generics + | ^--- help: remove the unnecessary generics | | | expected 0 generic arguments | diff --git a/tests/ui/const-generics/incorrect-number-of-const-args.stderr b/tests/ui/const-generics/incorrect-number-of-const-args.stderr index 01ac4e69a05..09c963c350e 100644 --- a/tests/ui/const-generics/incorrect-number-of-const-args.stderr +++ b/tests/ui/const-generics/incorrect-number-of-const-args.stderr @@ -20,7 +20,7 @@ error[E0107]: function takes 2 generic arguments but 3 generic arguments were su --> $DIR/incorrect-number-of-const-args.rs:9:5 | LL | foo::<0, 0, 0>(); - | ^^^ - help: remove this generic argument + | ^^^ --- help: remove the unnecessary generic argument | | | expected 2 generic arguments | diff --git a/tests/ui/const-generics/invalid-const-arg-for-type-param.stderr b/tests/ui/const-generics/invalid-const-arg-for-type-param.stderr index 4a649d8a7e8..4004ad19032 100644 --- a/tests/ui/const-generics/invalid-const-arg-for-type-param.stderr +++ b/tests/ui/const-generics/invalid-const-arg-for-type-param.stderr @@ -8,7 +8,7 @@ help: consider moving this generic argument to the `TryInto` trait, which takes | LL | let _: u32 = TryInto::<32>::try_into(5i32).unwrap(); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -help: remove these generics +help: remove the unnecessary generics | LL - let _: u32 = 5i32.try_into::<32>().unwrap(); LL + let _: u32 = 5i32.try_into().unwrap(); @@ -27,7 +27,7 @@ error[E0107]: struct takes 0 generic arguments but 1 generic argument was suppli --> $DIR/invalid-const-arg-for-type-param.rs:12:5 | LL | S::<0>; - | ^----- help: remove these generics + | ^----- help: remove the unnecessary generics | | | expected 0 generic arguments | diff --git a/tests/ui/const-generics/invalid-constant-in-args.stderr b/tests/ui/const-generics/invalid-constant-in-args.stderr index 158b9722ee6..3e1263e8e8c 100644 --- a/tests/ui/const-generics/invalid-constant-in-args.stderr +++ b/tests/ui/const-generics/invalid-constant-in-args.stderr @@ -2,7 +2,7 @@ error[E0107]: struct takes 1 generic argument but 2 generic arguments were suppl --> $DIR/invalid-constant-in-args.rs:4:12 | LL | let _: Cell<&str, "a"> = Cell::new(""); - | ^^^^ --- help: remove this generic argument + | ^^^^ ----- help: remove the unnecessary generic argument | | | expected 1 generic argument diff --git a/tests/ui/const-generics/opaque_types.stderr b/tests/ui/const-generics/opaque_types.stderr index 2c7384984c6..3947d645fcb 100644 --- a/tests/ui/const-generics/opaque_types.stderr +++ b/tests/ui/const-generics/opaque_types.stderr @@ -122,8 +122,6 @@ note: ...which requires const checking `main::{constant#0}`... | LL | foo::<42>(); | ^^ - = note: ...which requires computing whether `Foo` is freeze... - = note: ...which requires evaluating trait selection obligation `Foo: core::marker::Freeze`... = note: ...which again requires computing type of opaque `Foo::{opaque#0}`, completing the cycle note: cycle used when computing type of `Foo::{opaque#0}` --> $DIR/opaque_types.rs:3:12 diff --git a/tests/ui/constructor-lifetime-args.stderr b/tests/ui/constructor-lifetime-args.stderr index a18123fe19c..d3759f4b365 100644 --- a/tests/ui/constructor-lifetime-args.stderr +++ b/tests/ui/constructor-lifetime-args.stderr @@ -20,7 +20,7 @@ error[E0107]: struct takes 2 lifetime arguments but 3 lifetime arguments were su --> $DIR/constructor-lifetime-args.rs:19:5 | LL | S::<'static, 'static, 'static>(&0, &0); - | ^ ------- help: remove this lifetime argument + | ^ --------- help: remove the lifetime argument | | | expected 2 lifetime arguments | @@ -52,7 +52,7 @@ error[E0107]: enum takes 2 lifetime arguments but 3 lifetime arguments were supp --> $DIR/constructor-lifetime-args.rs:24:8 | LL | E::V::<'static, 'static, 'static>(&0); - | ^ ------- help: remove this lifetime argument + | ^ --------- help: remove the lifetime argument | | | expected 2 lifetime arguments | diff --git a/tests/ui/consts/const-fn-cycle.rs b/tests/ui/consts/const-fn-cycle.rs index 5175296a53e..2879e3049c0 100644 --- a/tests/ui/consts/const-fn-cycle.rs +++ b/tests/ui/consts/const-fn-cycle.rs @@ -7,6 +7,8 @@ /// to end up revealing opaque types (the RPIT in `many`'s return type), /// which can quickly lead to cycles. +//@ check-pass + pub struct Parser<H>(H); impl<H, T> Parser<H> @@ -18,7 +20,6 @@ where } pub const fn many<'s>(&'s self) -> Parser<impl for<'a> Fn(&'a str) -> Vec<T> + 's> { - //~^ ERROR: cycle detected Parser::new(|_| unimplemented!()) } } diff --git a/tests/ui/consts/const-fn-cycle.stderr b/tests/ui/consts/const-fn-cycle.stderr deleted file mode 100644 index c851f7342be..00000000000 --- a/tests/ui/consts/const-fn-cycle.stderr +++ /dev/null @@ -1,34 +0,0 @@ -error[E0391]: cycle detected when computing type of opaque `<impl at $DIR/const-fn-cycle.rs:12:1: 14:33>::many::{opaque#0}` - --> $DIR/const-fn-cycle.rs:20:47 - | -LL | pub const fn many<'s>(&'s self) -> Parser<impl for<'a> Fn(&'a str) -> Vec<T> + 's> { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | -note: ...which requires borrow-checking `<impl at $DIR/const-fn-cycle.rs:12:1: 14:33>::many`... - --> $DIR/const-fn-cycle.rs:20:5 - | -LL | pub const fn many<'s>(&'s self) -> Parser<impl for<'a> Fn(&'a str) -> Vec<T> + 's> { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -note: ...which requires promoting constants in MIR for `<impl at $DIR/const-fn-cycle.rs:12:1: 14:33>::many`... - --> $DIR/const-fn-cycle.rs:20:5 - | -LL | pub const fn many<'s>(&'s self) -> Parser<impl for<'a> Fn(&'a str) -> Vec<T> + 's> { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -note: ...which requires const checking `<impl at $DIR/const-fn-cycle.rs:12:1: 14:33>::many`... - --> $DIR/const-fn-cycle.rs:20:5 - | -LL | pub const fn many<'s>(&'s self) -> Parser<impl for<'a> Fn(&'a str) -> Vec<T> + 's> { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = note: ...which requires computing whether `Parser<<impl at $DIR/const-fn-cycle.rs:12:1: 14:33>::many::{opaque#0}>` is freeze... - = note: ...which requires evaluating trait selection obligation `Parser<<impl at $DIR/const-fn-cycle.rs:12:1: 14:33>::many::{opaque#0}>: core::marker::Freeze`... - = note: ...which again requires computing type of opaque `<impl at $DIR/const-fn-cycle.rs:12:1: 14:33>::many::{opaque#0}`, completing the cycle -note: cycle used when computing type of `<impl at $DIR/const-fn-cycle.rs:12:1: 14:33>::many::{opaque#0}` - --> $DIR/const-fn-cycle.rs:20:47 - | -LL | pub const fn many<'s>(&'s self) -> Parser<impl for<'a> Fn(&'a str) -> Vec<T> + 's> { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0391`. diff --git a/tests/ui/consts/const-promoted-opaque.atomic.stderr b/tests/ui/consts/const-promoted-opaque.atomic.stderr index a0459f4040e..1f2a7753ff5 100644 --- a/tests/ui/consts/const-promoted-opaque.atomic.stderr +++ b/tests/ui/consts/const-promoted-opaque.atomic.stderr @@ -1,5 +1,5 @@ error[E0658]: cannot borrow here, since the borrowed element may contain interior mutability - --> $DIR/const-promoted-opaque.rs:29:25 + --> $DIR/const-promoted-opaque.rs:28:25 | LL | let _: &'static _ = &FOO; | ^^^^ @@ -9,7 +9,7 @@ LL | let _: &'static _ = &FOO; = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0493]: destructor of `helper::Foo` cannot be evaluated at compile-time - --> $DIR/const-promoted-opaque.rs:29:26 + --> $DIR/const-promoted-opaque.rs:28:26 | LL | let _: &'static _ = &FOO; | ^^^ the destructor for this type cannot be evaluated in constants @@ -18,13 +18,13 @@ LL | }; | - value is dropped here error[E0492]: constants cannot refer to interior mutable data - --> $DIR/const-promoted-opaque.rs:34:19 + --> $DIR/const-promoted-opaque.rs:33:19 | LL | const BAZ: &Foo = &FOO; | ^^^^ this borrow of an interior mutable value may end up in the final value error[E0716]: temporary value dropped while borrowed - --> $DIR/const-promoted-opaque.rs:38:26 + --> $DIR/const-promoted-opaque.rs:37:26 | LL | let _: &'static _ = &FOO; | ---------- ^^^ creates a temporary value which is freed while still in use @@ -34,38 +34,7 @@ LL | LL | } | - temporary value is freed at the end of this statement -error[E0391]: cycle detected when computing type of opaque `helper::Foo::{opaque#0}` - --> $DIR/const-promoted-opaque.rs:14:20 - | -LL | pub type Foo = impl Sized; - | ^^^^^^^^^^ - | -note: ...which requires borrow-checking `helper::FOO`... - --> $DIR/const-promoted-opaque.rs:21:5 - | -LL | pub const FOO: Foo = std::sync::atomic::AtomicU8::new(42); - | ^^^^^^^^^^^^^^^^^^ -note: ...which requires promoting constants in MIR for `helper::FOO`... - --> $DIR/const-promoted-opaque.rs:21:5 - | -LL | pub const FOO: Foo = std::sync::atomic::AtomicU8::new(42); - | ^^^^^^^^^^^^^^^^^^ -note: ...which requires const checking `helper::FOO`... - --> $DIR/const-promoted-opaque.rs:21:5 - | -LL | pub const FOO: Foo = std::sync::atomic::AtomicU8::new(42); - | ^^^^^^^^^^^^^^^^^^ - = note: ...which requires computing whether `helper::Foo` is freeze... - = note: ...which requires evaluating trait selection obligation `helper::Foo: core::marker::Freeze`... - = note: ...which again requires computing type of opaque `helper::Foo::{opaque#0}`, completing the cycle -note: cycle used when computing type of `helper::Foo::{opaque#0}` - --> $DIR/const-promoted-opaque.rs:14:20 - | -LL | pub type Foo = impl Sized; - | ^^^^^^^^^^ - = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information - -error: aborting due to 5 previous errors +error: aborting due to 4 previous errors -Some errors have detailed explanations: E0391, E0492, E0493, E0658, E0716. -For more information about an error, try `rustc --explain E0391`. +Some errors have detailed explanations: E0492, E0493, E0658, E0716. +For more information about an error, try `rustc --explain E0492`. diff --git a/tests/ui/consts/const-promoted-opaque.rs b/tests/ui/consts/const-promoted-opaque.rs index e20823527f4..303618df9df 100644 --- a/tests/ui/consts/const-promoted-opaque.rs +++ b/tests/ui/consts/const-promoted-opaque.rs @@ -12,7 +12,6 @@ mod helper { pub type Foo = impl Sized; - //[string,atomic]~^ ERROR cycle detected #[cfg(string)] pub const FOO: Foo = String::new(); @@ -28,11 +27,11 @@ use helper::*; const BAR: () = { let _: &'static _ = &FOO; //[string,atomic]~^ ERROR: destructor of `helper::Foo` cannot be evaluated at compile-time - //[string,atomic]~| ERROR: cannot borrow here + //[atomic]~| ERROR: cannot borrow here }; const BAZ: &Foo = &FOO; -//[string,atomic]~^ ERROR: constants cannot refer to interior mutable data +//[atomic]~^ ERROR: constants cannot refer to interior mutable data fn main() { let _: &'static _ = &FOO; diff --git a/tests/ui/consts/const-promoted-opaque.string.stderr b/tests/ui/consts/const-promoted-opaque.string.stderr index a613d517e68..fa1dbb05d17 100644 --- a/tests/ui/consts/const-promoted-opaque.string.stderr +++ b/tests/ui/consts/const-promoted-opaque.string.stderr @@ -1,15 +1,5 @@ -error[E0658]: cannot borrow here, since the borrowed element may contain interior mutability - --> $DIR/const-promoted-opaque.rs:29:25 - | -LL | let _: &'static _ = &FOO; - | ^^^^ - | - = note: see issue #80384 <https://github.com/rust-lang/rust/issues/80384> for more information - = help: add `#![feature(const_refs_to_cell)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - error[E0493]: destructor of `helper::Foo` cannot be evaluated at compile-time - --> $DIR/const-promoted-opaque.rs:29:26 + --> $DIR/const-promoted-opaque.rs:28:26 | LL | let _: &'static _ = &FOO; | ^^^ the destructor for this type cannot be evaluated in constants @@ -17,14 +7,8 @@ LL | let _: &'static _ = &FOO; LL | }; | - value is dropped here -error[E0492]: constants cannot refer to interior mutable data - --> $DIR/const-promoted-opaque.rs:34:19 - | -LL | const BAZ: &Foo = &FOO; - | ^^^^ this borrow of an interior mutable value may end up in the final value - error[E0716]: temporary value dropped while borrowed - --> $DIR/const-promoted-opaque.rs:38:26 + --> $DIR/const-promoted-opaque.rs:37:26 | LL | let _: &'static _ = &FOO; | ---------- ^^^ creates a temporary value which is freed while still in use @@ -34,38 +18,7 @@ LL | LL | } | - temporary value is freed at the end of this statement -error[E0391]: cycle detected when computing type of opaque `helper::Foo::{opaque#0}` - --> $DIR/const-promoted-opaque.rs:14:20 - | -LL | pub type Foo = impl Sized; - | ^^^^^^^^^^ - | -note: ...which requires borrow-checking `helper::FOO`... - --> $DIR/const-promoted-opaque.rs:18:5 - | -LL | pub const FOO: Foo = String::new(); - | ^^^^^^^^^^^^^^^^^^ -note: ...which requires promoting constants in MIR for `helper::FOO`... - --> $DIR/const-promoted-opaque.rs:18:5 - | -LL | pub const FOO: Foo = String::new(); - | ^^^^^^^^^^^^^^^^^^ -note: ...which requires const checking `helper::FOO`... - --> $DIR/const-promoted-opaque.rs:18:5 - | -LL | pub const FOO: Foo = String::new(); - | ^^^^^^^^^^^^^^^^^^ - = note: ...which requires computing whether `helper::Foo` is freeze... - = note: ...which requires evaluating trait selection obligation `helper::Foo: core::marker::Freeze`... - = note: ...which again requires computing type of opaque `helper::Foo::{opaque#0}`, completing the cycle -note: cycle used when computing type of `helper::Foo::{opaque#0}` - --> $DIR/const-promoted-opaque.rs:14:20 - | -LL | pub type Foo = impl Sized; - | ^^^^^^^^^^ - = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information - -error: aborting due to 5 previous errors +error: aborting due to 2 previous errors -Some errors have detailed explanations: E0391, E0492, E0493, E0658, E0716. -For more information about an error, try `rustc --explain E0391`. +Some errors have detailed explanations: E0493, E0716. +For more information about an error, try `rustc --explain E0493`. diff --git a/tests/ui/consts/effect_param.stderr b/tests/ui/consts/effect_param.stderr index dba5d49b792..c63be8035f3 100644 --- a/tests/ui/consts/effect_param.stderr +++ b/tests/ui/consts/effect_param.stderr @@ -2,7 +2,7 @@ error[E0107]: method takes 0 generic arguments but 1 generic argument was suppli --> $DIR/effect_param.rs:11:9 | LL | i8::checked_sub::<false>(42, 43); - | ^^^^^^^^^^^--------- help: remove these generics + | ^^^^^^^^^^^--------- help: remove the unnecessary generics | | | expected 0 generic arguments @@ -10,7 +10,7 @@ error[E0107]: method takes 0 generic arguments but 1 generic argument was suppli --> $DIR/effect_param.rs:13:9 | LL | i8::checked_sub::<true>(42, 43); - | ^^^^^^^^^^^-------- help: remove these generics + | ^^^^^^^^^^^-------- help: remove the unnecessary generics | | | expected 0 generic arguments @@ -18,7 +18,7 @@ error[E0107]: method takes 0 generic arguments but 1 generic argument was suppli --> $DIR/effect_param.rs:4:9 | LL | i8::checked_sub::<true>(42, 43); - | ^^^^^^^^^^^-------- help: remove these generics + | ^^^^^^^^^^^-------- help: remove the unnecessary generics | | | expected 0 generic arguments @@ -26,7 +26,7 @@ error[E0107]: method takes 0 generic arguments but 1 generic argument was suppli --> $DIR/effect_param.rs:6:9 | LL | i8::checked_sub::<false>(42, 43); - | ^^^^^^^^^^^--------- help: remove these generics + | ^^^^^^^^^^^--------- help: remove the unnecessary generics | | | expected 0 generic arguments diff --git a/tests/ui/error-codes/E0107.rs b/tests/ui/error-codes/E0107.rs index fd23e7c00f2..161360a5012 100644 --- a/tests/ui/error-codes/E0107.rs +++ b/tests/ui/error-codes/E0107.rs @@ -16,35 +16,35 @@ struct Baz<'a, 'b, 'c> { bar: Bar<'a>, //~^ ERROR enum takes 0 lifetime arguments - //~| HELP remove these generics + //~| HELP remove the unnecessary generics foo2: Foo<'a, 'b, 'c>, //~^ ERROR struct takes 1 lifetime argument - //~| HELP remove these lifetime arguments + //~| HELP remove the lifetime arguments qux1: Qux<'a, 'b, i32>, //~^ ERROR struct takes 1 lifetime argument - //~| HELP remove this lifetime argument + //~| HELP remove the lifetime argument qux2: Qux<'a, i32, 'b>, //~^ ERROR struct takes 1 lifetime argument - //~| HELP remove this lifetime argument + //~| HELP remove the lifetime argument qux3: Qux<'a, 'b, 'c, i32>, //~^ ERROR struct takes 1 lifetime argument - //~| HELP remove these lifetime arguments + //~| HELP remove the lifetime arguments qux4: Qux<'a, i32, 'b, 'c>, //~^ ERROR struct takes 1 lifetime argument - //~| HELP remove these lifetime arguments + //~| HELP remove the lifetime arguments qux5: Qux<'a, 'b, i32, 'c>, //~^ ERROR struct takes 1 lifetime argument - //~| HELP remove this lifetime argument + //~| HELP remove the lifetime argument quux: Quux<'a, i32, 'b>, //~^ ERROR struct takes 0 lifetime arguments - //~| HELP remove this lifetime argument + //~| HELP remove the lifetime argument } pub trait T { diff --git a/tests/ui/error-codes/E0107.stderr b/tests/ui/error-codes/E0107.stderr index 3f540eb08bc..4aa83cf7f5f 100644 --- a/tests/ui/error-codes/E0107.stderr +++ b/tests/ui/error-codes/E0107.stderr @@ -20,7 +20,7 @@ error[E0107]: enum takes 0 lifetime arguments but 1 lifetime argument was suppli --> $DIR/E0107.rs:17:10 | LL | bar: Bar<'a>, - | ^^^---- help: remove these generics + | ^^^---- help: remove the unnecessary generics | | | expected 0 lifetime arguments | @@ -34,7 +34,7 @@ error[E0107]: struct takes 1 lifetime argument but 3 lifetime arguments were sup --> $DIR/E0107.rs:21:11 | LL | foo2: Foo<'a, 'b, 'c>, - | ^^^ ------ help: remove these lifetime arguments + | ^^^ -------- help: remove the lifetime arguments | | | expected 1 lifetime argument | @@ -48,7 +48,7 @@ error[E0107]: struct takes 1 lifetime argument but 2 lifetime arguments were sup --> $DIR/E0107.rs:25:11 | LL | qux1: Qux<'a, 'b, i32>, - | ^^^ -- help: remove this lifetime argument + | ^^^ ---- help: remove the lifetime argument | | | expected 1 lifetime argument | @@ -62,7 +62,7 @@ error[E0107]: struct takes 1 lifetime argument but 2 lifetime arguments were sup --> $DIR/E0107.rs:29:11 | LL | qux2: Qux<'a, i32, 'b>, - | ^^^ -- help: remove this lifetime argument + | ^^^ --------- help: remove the lifetime argument | | | expected 1 lifetime argument | @@ -76,7 +76,7 @@ error[E0107]: struct takes 1 lifetime argument but 3 lifetime arguments were sup --> $DIR/E0107.rs:33:11 | LL | qux3: Qux<'a, 'b, 'c, i32>, - | ^^^ ------ help: remove these lifetime arguments + | ^^^ -------- help: remove the lifetime arguments | | | expected 1 lifetime argument | @@ -90,7 +90,7 @@ error[E0107]: struct takes 1 lifetime argument but 3 lifetime arguments were sup --> $DIR/E0107.rs:37:11 | LL | qux4: Qux<'a, i32, 'b, 'c>, - | ^^^ ------ help: remove these lifetime arguments + | ^^^ ------------- help: remove the lifetime arguments | | | expected 1 lifetime argument | @@ -104,7 +104,7 @@ error[E0107]: struct takes 1 lifetime argument but 3 lifetime arguments were sup --> $DIR/E0107.rs:41:11 | LL | qux5: Qux<'a, 'b, i32, 'c>, - | ^^^ -- help: remove this lifetime argument + | ^^^ ---- help: remove the lifetime argument | | | expected 1 lifetime argument | @@ -118,7 +118,7 @@ error[E0107]: struct takes 0 lifetime arguments but 2 lifetime arguments were su --> $DIR/E0107.rs:45:11 | LL | quux: Quux<'a, i32, 'b>, - | ^^^^ -- help: remove this lifetime argument + | ^^^^ -- help: remove the lifetime argument | | | expected 0 lifetime arguments | diff --git a/tests/ui/generic-associated-types/gat-trait-path-parenthesised-args.stderr b/tests/ui/generic-associated-types/gat-trait-path-parenthesised-args.stderr index fcd3e7d9aac..9d8e91c02ca 100644 --- a/tests/ui/generic-associated-types/gat-trait-path-parenthesised-args.stderr +++ b/tests/ui/generic-associated-types/gat-trait-path-parenthesised-args.stderr @@ -43,7 +43,7 @@ error[E0107]: associated type takes 0 generic arguments but 1 generic argument w --> $DIR/gat-trait-path-parenthesised-args.rs:5:27 | LL | fn foo<'a>(arg: Box<dyn X<Y('a) = &'a ()>>) {} - | ^---- help: remove these generics + | ^---- help: remove the unnecessary generics | | | expected 0 generic arguments | @@ -74,7 +74,7 @@ error[E0107]: associated type takes 0 generic arguments but 1 generic argument w --> $DIR/gat-trait-path-parenthesised-args.rs:5:27 | LL | fn foo<'a>(arg: Box<dyn X<Y('a) = &'a ()>>) {} - | ^---- help: remove these generics + | ^---- help: remove the unnecessary generics | | | expected 0 generic arguments | @@ -106,7 +106,7 @@ error[E0107]: associated type takes 0 generic arguments but 1 generic argument w --> $DIR/gat-trait-path-parenthesised-args.rs:5:27 | LL | fn foo<'a>(arg: Box<dyn X<Y('a) = &'a ()>>) {} - | ^---- help: remove these generics + | ^---- help: remove the unnecessary generics | | | expected 0 generic arguments | diff --git a/tests/ui/generic-associated-types/parameter_number_and_kind.stderr b/tests/ui/generic-associated-types/parameter_number_and_kind.stderr index 4523044b588..4a20cf55cae 100644 --- a/tests/ui/generic-associated-types/parameter_number_and_kind.stderr +++ b/tests/ui/generic-associated-types/parameter_number_and_kind.stderr @@ -2,7 +2,7 @@ error[E0107]: associated type takes 1 lifetime argument but 2 lifetime arguments --> $DIR/parameter_number_and_kind.rs:11:24 | LL | type FErr1 = Self::E<'static, 'static>; - | ^ ------- help: remove this lifetime argument + | ^ --------- help: remove the lifetime argument | | | expected 1 lifetime argument | @@ -32,7 +32,7 @@ error[E0107]: associated type takes 1 generic argument but 2 generic arguments w --> $DIR/parameter_number_and_kind.rs:14:27 | LL | type FErr2<T> = Self::E<'static, T, u32>; - | ^ --- help: remove this generic argument + | ^ ----- help: remove the unnecessary generic argument | | | expected 1 generic argument | diff --git a/tests/ui/generic-associated-types/parse/trait-path-type-error-once-implemented.stderr b/tests/ui/generic-associated-types/parse/trait-path-type-error-once-implemented.stderr index 2090f75aed3..539b6695e9e 100644 --- a/tests/ui/generic-associated-types/parse/trait-path-type-error-once-implemented.stderr +++ b/tests/ui/generic-associated-types/parse/trait-path-type-error-once-implemented.stderr @@ -18,7 +18,7 @@ error[E0107]: associated type takes 0 generic arguments but 1 generic argument w --> $DIR/trait-path-type-error-once-implemented.rs:6:29 | LL | fn f2<'a>(arg : Box<dyn X<Y<1> = &'a ()>>) {} - | ^--- help: remove these generics + | ^--- help: remove the unnecessary generics | | | expected 0 generic arguments | @@ -49,7 +49,7 @@ error[E0107]: associated type takes 0 generic arguments but 1 generic argument w --> $DIR/trait-path-type-error-once-implemented.rs:6:29 | LL | fn f2<'a>(arg : Box<dyn X<Y<1> = &'a ()>>) {} - | ^--- help: remove these generics + | ^--- help: remove the unnecessary generics | | | expected 0 generic arguments | @@ -81,7 +81,7 @@ error[E0107]: associated type takes 0 generic arguments but 1 generic argument w --> $DIR/trait-path-type-error-once-implemented.rs:6:29 | LL | fn f2<'a>(arg : Box<dyn X<Y<1> = &'a ()>>) {} - | ^--- help: remove these generics + | ^--- help: remove the unnecessary generics | | | expected 0 generic arguments | diff --git a/tests/ui/generics/bad-mid-path-type-params.stderr b/tests/ui/generics/bad-mid-path-type-params.stderr index 71e15dd4c92..de3c0289fc6 100644 --- a/tests/ui/generics/bad-mid-path-type-params.stderr +++ b/tests/ui/generics/bad-mid-path-type-params.stderr @@ -2,7 +2,7 @@ error[E0107]: associated function takes 1 generic argument but 2 generic argumen --> $DIR/bad-mid-path-type-params.rs:30:16 | LL | let _ = S::new::<isize,f64>(1, 1.0); - | ^^^ --- help: remove this generic argument + | ^^^ ---- help: remove the unnecessary generic argument | | | expected 1 generic argument | @@ -16,7 +16,7 @@ error[E0107]: struct takes 0 lifetime arguments but 1 lifetime argument was supp --> $DIR/bad-mid-path-type-params.rs:33:13 | LL | let _ = S::<'a,isize>::new::<f64>(1, 1.0); - | ^ -- help: remove this lifetime argument + | ^ -- help: remove the lifetime argument | | | expected 0 lifetime arguments | @@ -30,7 +30,7 @@ error[E0107]: associated function takes 1 generic argument but 2 generic argumen --> $DIR/bad-mid-path-type-params.rs:36:24 | LL | let _: S2 = Trait::new::<isize,f64>(1, 1.0); - | ^^^ --- help: remove this generic argument + | ^^^ ---- help: remove the unnecessary generic argument | | | expected 1 generic argument | @@ -44,7 +44,7 @@ error[E0107]: trait takes 0 lifetime arguments but 1 lifetime argument was suppl --> $DIR/bad-mid-path-type-params.rs:39:17 | LL | let _: S2 = Trait::<'a,isize>::new::<f64,f64>(1, 1.0); - | ^^^^^ -- help: remove this lifetime argument + | ^^^^^ -- help: remove the lifetime argument | | | expected 0 lifetime arguments | @@ -58,7 +58,7 @@ error[E0107]: associated function takes 1 generic argument but 2 generic argumen --> $DIR/bad-mid-path-type-params.rs:39:36 | LL | let _: S2 = Trait::<'a,isize>::new::<f64,f64>(1, 1.0); - | ^^^ --- help: remove this generic argument + | ^^^ ---- help: remove the unnecessary generic argument | | | expected 1 generic argument | diff --git a/tests/ui/generics/foreign-generic-mismatch.stderr b/tests/ui/generics/foreign-generic-mismatch.stderr index 5322b3f919d..32beac41b21 100644 --- a/tests/ui/generics/foreign-generic-mismatch.stderr +++ b/tests/ui/generics/foreign-generic-mismatch.stderr @@ -20,7 +20,7 @@ error[E0107]: function takes 1 lifetime argument but 2 lifetime arguments were s --> $DIR/foreign-generic-mismatch.rs:8:31 | LL | foreign_generic_mismatch::lt_arg::<'static, 'static>(); - | ^^^^^^ ------- help: remove this lifetime argument + | ^^^^^^ --------- help: remove the lifetime argument | | | expected 1 lifetime argument | diff --git a/tests/ui/generics/generic-arg-mismatch-recover.stderr b/tests/ui/generics/generic-arg-mismatch-recover.stderr index f549a7180fc..172683a8f9b 100644 --- a/tests/ui/generics/generic-arg-mismatch-recover.stderr +++ b/tests/ui/generics/generic-arg-mismatch-recover.stderr @@ -2,7 +2,7 @@ error[E0107]: struct takes 1 lifetime argument but 2 lifetime arguments were sup --> $DIR/generic-arg-mismatch-recover.rs:6:5 | LL | Foo::<'static, 'static, ()>(&0); - | ^^^ ------- help: remove this lifetime argument + | ^^^ --------- help: remove the lifetime argument | | | expected 1 lifetime argument | @@ -16,7 +16,7 @@ error[E0107]: struct takes 1 lifetime argument but 2 lifetime arguments were sup --> $DIR/generic-arg-mismatch-recover.rs:9:5 | LL | Bar::<'static, 'static, ()>(&()); - | ^^^ ------- help: remove this lifetime argument + | ^^^ --------- help: remove the lifetime argument | | | expected 1 lifetime argument | @@ -30,7 +30,7 @@ error[E0107]: struct takes 0 generic arguments but 1 generic argument was suppli --> $DIR/generic-arg-mismatch-recover.rs:9:5 | LL | Bar::<'static, 'static, ()>(&()); - | ^^^ -- help: remove this generic argument + | ^^^ -- help: remove the unnecessary generic argument | | | expected 0 generic arguments | diff --git a/tests/ui/generics/generic-impl-more-params-with-defaults.stderr b/tests/ui/generics/generic-impl-more-params-with-defaults.stderr index c5812abfd3d..16bdc2de252 100644 --- a/tests/ui/generics/generic-impl-more-params-with-defaults.stderr +++ b/tests/ui/generics/generic-impl-more-params-with-defaults.stderr @@ -2,7 +2,7 @@ error[E0107]: struct takes at most 2 generic arguments but 3 generic arguments w --> $DIR/generic-impl-more-params-with-defaults.rs:13:5 | LL | Vec::<isize, Heap, bool>::new(); - | ^^^ ---- help: remove this generic argument + | ^^^ ------ help: remove the unnecessary generic argument | | | expected at most 2 generic arguments | diff --git a/tests/ui/generics/generic-type-more-params-with-defaults.stderr b/tests/ui/generics/generic-type-more-params-with-defaults.stderr index c44f6b7ddc0..1eb76e043e0 100644 --- a/tests/ui/generics/generic-type-more-params-with-defaults.stderr +++ b/tests/ui/generics/generic-type-more-params-with-defaults.stderr @@ -2,7 +2,7 @@ error[E0107]: struct takes at most 2 generic arguments but 3 generic arguments w --> $DIR/generic-type-more-params-with-defaults.rs:9:12 | LL | let _: Vec<isize, Heap, bool>; - | ^^^ ---- help: remove this generic argument + | ^^^ ------ help: remove the unnecessary generic argument | | | expected at most 2 generic arguments | diff --git a/tests/ui/generics/wrong-number-of-args.rs b/tests/ui/generics/wrong-number-of-args.rs index 95463d1c32c..6524bd538b6 100644 --- a/tests/ui/generics/wrong-number-of-args.rs +++ b/tests/ui/generics/wrong-number-of-args.rs @@ -5,19 +5,19 @@ mod no_generics { type B = Ty<'static>; //~^ ERROR struct takes 0 lifetime arguments but 1 lifetime argument - //~| HELP remove these generics + //~| HELP remove the unnecessary generics type C = Ty<'static, usize>; //~^ ERROR struct takes 0 lifetime arguments but 1 lifetime argument //~| ERROR struct takes 0 generic arguments but 1 generic argument - //~| HELP remove this lifetime argument - //~| HELP remove this generic argument + //~| HELP remove the lifetime argument + //~| HELP remove the unnecessary generic argument type D = Ty<'static, usize, { 0 }>; //~^ ERROR struct takes 0 lifetime arguments but 1 lifetime argument //~| ERROR struct takes 0 generic arguments but 2 generic arguments - //~| HELP remove this lifetime argument - //~| HELP remove these generic arguments + //~| HELP remove the lifetime argument + //~| HELP remove the unnecessary generic arguments } mod type_and_type { @@ -35,7 +35,7 @@ mod type_and_type { type D = Ty<usize, String, char>; //~^ ERROR struct takes 2 generic arguments but 3 generic arguments - //~| HELP remove this + //~| HELP remove the type E = Ty<>; //~^ ERROR struct takes 2 generic arguments but 0 generic arguments were supplied @@ -70,8 +70,8 @@ mod lifetime_and_type { type F = Ty<'static, usize, 'static, usize>; //~^ ERROR struct takes 1 lifetime argument but 2 lifetime arguments //~| ERROR struct takes 1 generic argument but 2 generic arguments - //~| HELP remove this lifetime argument - //~| HELP remove this generic argument + //~| HELP remove the lifetime argument + //~| HELP remove the unnecessary generic argument } mod type_and_type_and_type { @@ -317,13 +317,13 @@ mod stdlib { type C = HashMap<'static>; //~^ ERROR struct takes 0 lifetime arguments but 1 lifetime argument - //~| HELP remove these generics + //~| HELP remove the //~| ERROR struct takes at least 2 //~| HELP add missing type D = HashMap<usize, String, char, f64>; //~^ ERROR struct takes at most 3 - //~| HELP remove this + //~| HELP remove the type E = HashMap<>; //~^ ERROR struct takes at least 2 generic arguments but 0 generic arguments @@ -341,7 +341,7 @@ mod stdlib { type C = Result<'static>; //~^ ERROR enum takes 0 lifetime arguments but 1 lifetime argument - //~| HELP remove these generics + //~| HELP remove the unnecessary generics //~| ERROR enum takes 2 generic arguments but 0 generic arguments //~| HELP add missing diff --git a/tests/ui/generics/wrong-number-of-args.stderr b/tests/ui/generics/wrong-number-of-args.stderr index e04408a0fdf..bac0d26b622 100644 --- a/tests/ui/generics/wrong-number-of-args.stderr +++ b/tests/ui/generics/wrong-number-of-args.stderr @@ -171,7 +171,7 @@ error[E0107]: struct takes 0 lifetime arguments but 1 lifetime argument was supp --> $DIR/wrong-number-of-args.rs:6:14 | LL | type B = Ty<'static>; - | ^^--------- help: remove these generics + | ^^--------- help: remove the unnecessary generics | | | expected 0 lifetime arguments | @@ -185,7 +185,7 @@ error[E0107]: struct takes 0 lifetime arguments but 1 lifetime argument was supp --> $DIR/wrong-number-of-args.rs:10:14 | LL | type C = Ty<'static, usize>; - | ^^ ------- help: remove this lifetime argument + | ^^ ------- help: remove the lifetime argument | | | expected 0 lifetime arguments | @@ -199,7 +199,7 @@ error[E0107]: struct takes 0 generic arguments but 1 generic argument was suppli --> $DIR/wrong-number-of-args.rs:10:14 | LL | type C = Ty<'static, usize>; - | ^^ ----- help: remove this generic argument + | ^^ ----- help: remove the unnecessary generic argument | | | expected 0 generic arguments | @@ -213,7 +213,7 @@ error[E0107]: struct takes 0 lifetime arguments but 1 lifetime argument was supp --> $DIR/wrong-number-of-args.rs:16:14 | LL | type D = Ty<'static, usize, { 0 }>; - | ^^ ------- help: remove this lifetime argument + | ^^ ------- help: remove the lifetime argument | | | expected 0 lifetime arguments | @@ -227,7 +227,7 @@ error[E0107]: struct takes 0 generic arguments but 2 generic arguments were supp --> $DIR/wrong-number-of-args.rs:16:14 | LL | type D = Ty<'static, usize, { 0 }>; - | ^^ ------------ help: remove these generic arguments + | ^^ ------- help: remove the unnecessary generic arguments | | | expected 0 generic arguments | @@ -275,7 +275,7 @@ error[E0107]: struct takes 2 generic arguments but 3 generic arguments were supp --> $DIR/wrong-number-of-args.rs:36:14 | LL | type D = Ty<usize, String, char>; - | ^^ ---- help: remove this generic argument + | ^^ ------ help: remove the unnecessary generic argument | | | expected 2 generic arguments | @@ -353,7 +353,7 @@ error[E0107]: struct takes 1 lifetime argument but 2 lifetime arguments were sup --> $DIR/wrong-number-of-args.rs:70:14 | LL | type F = Ty<'static, usize, 'static, usize>; - | ^^ ------- help: remove this lifetime argument + | ^^ ---------------- help: remove the lifetime argument | | | expected 1 lifetime argument | @@ -367,7 +367,7 @@ error[E0107]: struct takes 1 generic argument but 2 generic arguments were suppl --> $DIR/wrong-number-of-args.rs:70:14 | LL | type F = Ty<'static, usize, 'static, usize>; - | ^^ ----- help: remove this generic argument + | ^^ ---------------- help: remove the unnecessary generic argument | | | expected 1 generic argument | @@ -415,7 +415,7 @@ error[E0107]: struct takes at most 3 generic arguments but 4 generic arguments w --> $DIR/wrong-number-of-args.rs:92:14 | LL | type E = Ty<usize, String, char, f64>; - | ^^ --- help: remove this generic argument + | ^^ ----- help: remove the unnecessary generic argument | | | expected at most 3 generic arguments | @@ -445,7 +445,7 @@ error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplie --> $DIR/wrong-number-of-args.rs:116:22 | LL | type A = Box<dyn NonGeneric<usize>>; - | ^^^^^^^^^^------- help: remove these generics + | ^^^^^^^^^^------- help: remove the unnecessary generics | | | expected 0 generic arguments | @@ -459,7 +459,7 @@ error[E0107]: trait takes 1 lifetime argument but 2 lifetime arguments were supp --> $DIR/wrong-number-of-args.rs:125:22 | LL | type C = Box<dyn GenericLifetime<'static, 'static>>; - | ^^^^^^^^^^^^^^^ ------- help: remove this lifetime argument + | ^^^^^^^^^^^^^^^ --------- help: remove the lifetime argument | | | expected 1 lifetime argument | @@ -489,7 +489,7 @@ error[E0107]: trait takes 1 generic argument but 2 generic arguments were suppli --> $DIR/wrong-number-of-args.rs:133:22 | LL | type E = Box<dyn GenericType<String, usize>>; - | ^^^^^^^^^^^ ----- help: remove this generic argument + | ^^^^^^^^^^^ ------- help: remove the unnecessary generic argument | | | expected 1 generic argument | @@ -519,7 +519,7 @@ error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplie --> $DIR/wrong-number-of-args.rs:153:26 | LL | type A = Box<dyn NonGenericAT<usize, AssocTy=()>>; - | ^^^^^^^^^^^^------------------- help: remove these generics + | ^^^^^^^^^^^^------------------- help: remove the unnecessary generics | | | expected 0 generic arguments | @@ -533,7 +533,7 @@ error[E0107]: trait takes 1 lifetime argument but 2 lifetime arguments were supp --> $DIR/wrong-number-of-args.rs:168:26 | LL | type B = Box<dyn GenericLifetimeAT<'static, 'static, AssocTy=()>>; - | ^^^^^^^^^^^^^^^^^ ------- help: remove this lifetime argument + | ^^^^^^^^^^^^^^^^^ --------- help: remove the lifetime argument | | | expected 1 lifetime argument | @@ -547,7 +547,7 @@ error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplie --> $DIR/wrong-number-of-args.rs:172:26 | LL | type C = Box<dyn GenericLifetimeAT<(), AssocTy=()>>; - | ^^^^^^^^^^^^^^^^^ -- help: remove this generic argument + | ^^^^^^^^^^^^^^^^^ -- help: remove the unnecessary generic argument | | | expected 0 generic arguments | @@ -577,7 +577,7 @@ error[E0107]: trait takes 1 generic argument but 2 generic arguments were suppli --> $DIR/wrong-number-of-args.rs:189:26 | LL | type B = Box<dyn GenericTypeAT<(), (), AssocTy=()>>; - | ^^^^^^^^^^^^^ -- help: remove this generic argument + | ^^^^^^^^^^^^^ ---- help: remove the unnecessary generic argument | | | expected 1 generic argument | @@ -591,7 +591,7 @@ error[E0107]: trait takes 0 lifetime arguments but 1 lifetime argument was suppl --> $DIR/wrong-number-of-args.rs:193:26 | LL | type C = Box<dyn GenericTypeAT<'static, AssocTy=()>>; - | ^^^^^^^^^^^^^--------------------- help: remove these generics + | ^^^^^^^^^^^^^--------------------- help: remove the unnecessary generics | | | expected 0 lifetime arguments | @@ -653,7 +653,7 @@ error[E0107]: trait takes 1 lifetime argument but 2 lifetime arguments were supp --> $DIR/wrong-number-of-args.rs:216:26 | LL | type C = Box<dyn GenericLifetimeTypeAT<'static, 'static, AssocTy=()>>; - | ^^^^^^^^^^^^^^^^^^^^^ ------- help: remove this lifetime argument + | ^^^^^^^^^^^^^^^^^^^^^ --------- help: remove the lifetime argument | | | expected 1 lifetime argument | @@ -683,7 +683,7 @@ error[E0107]: trait takes 1 generic argument but 2 generic arguments were suppli --> $DIR/wrong-number-of-args.rs:227:26 | LL | type E = Box<dyn GenericLifetimeTypeAT<(), (), AssocTy=()>>; - | ^^^^^^^^^^^^^^^^^^^^^ -- help: remove this generic argument + | ^^^^^^^^^^^^^^^^^^^^^ ---- help: remove the unnecessary generic argument | | | expected 1 generic argument | @@ -697,7 +697,7 @@ error[E0107]: trait takes 1 lifetime argument but 2 lifetime arguments were supp --> $DIR/wrong-number-of-args.rs:234:26 | LL | type F = Box<dyn GenericLifetimeTypeAT<'static, 'static, (), AssocTy=()>>; - | ^^^^^^^^^^^^^^^^^^^^^ ------- help: remove this lifetime argument + | ^^^^^^^^^^^^^^^^^^^^^ --------- help: remove the lifetime argument | | | expected 1 lifetime argument | @@ -711,7 +711,7 @@ error[E0107]: trait takes 1 generic argument but 2 generic arguments were suppli --> $DIR/wrong-number-of-args.rs:238:26 | LL | type G = Box<dyn GenericLifetimeTypeAT<'static, (), (), AssocTy=()>>; - | ^^^^^^^^^^^^^^^^^^^^^ -- help: remove this generic argument + | ^^^^^^^^^^^^^^^^^^^^^ ---- help: remove the unnecessary generic argument | | | expected 1 generic argument | @@ -725,7 +725,7 @@ error[E0107]: trait takes 1 lifetime argument but 2 lifetime arguments were supp --> $DIR/wrong-number-of-args.rs:242:26 | LL | type H = Box<dyn GenericLifetimeTypeAT<'static, 'static, (), (), AssocTy=()>>; - | ^^^^^^^^^^^^^^^^^^^^^ ------- help: remove this lifetime argument + | ^^^^^^^^^^^^^^^^^^^^^ --------- help: remove the lifetime argument | | | expected 1 lifetime argument | @@ -739,7 +739,7 @@ error[E0107]: trait takes 1 generic argument but 2 generic arguments were suppli --> $DIR/wrong-number-of-args.rs:242:26 | LL | type H = Box<dyn GenericLifetimeTypeAT<'static, 'static, (), (), AssocTy=()>>; - | ^^^^^^^^^^^^^^^^^^^^^ -- help: remove this generic argument + | ^^^^^^^^^^^^^^^^^^^^^ ---- help: remove the unnecessary generic argument | | | expected 1 generic argument | @@ -787,7 +787,7 @@ error[E0107]: trait takes 2 generic arguments but 3 generic arguments were suppl --> $DIR/wrong-number-of-args.rs:262:26 | LL | type C = Box<dyn GenericTypeTypeAT<(), (), (), AssocTy=()>>; - | ^^^^^^^^^^^^^^^^^ -- help: remove this generic argument + | ^^^^^^^^^^^^^^^^^ ---- help: remove the unnecessary generic argument | | | expected 2 generic arguments | @@ -911,7 +911,7 @@ error[E0107]: struct takes 0 lifetime arguments but 1 lifetime argument was supp --> $DIR/wrong-number-of-args.rs:318:18 | LL | type C = HashMap<'static>; - | ^^^^^^^--------- help: remove these generics + | ^^^^^^^--------- help: remove the unnecessary generics | | | expected 0 lifetime arguments @@ -930,7 +930,7 @@ error[E0107]: struct takes at most 3 generic arguments but 4 generic arguments w --> $DIR/wrong-number-of-args.rs:324:18 | LL | type D = HashMap<usize, String, char, f64>; - | ^^^^^^^ --- help: remove this generic argument + | ^^^^^^^ ----- help: remove the unnecessary generic argument | | | expected at most 3 generic arguments @@ -973,7 +973,7 @@ error[E0107]: enum takes 0 lifetime arguments but 1 lifetime argument was suppli --> $DIR/wrong-number-of-args.rs:342:18 | LL | type C = Result<'static>; - | ^^^^^^--------- help: remove these generics + | ^^^^^^--------- help: remove the unnecessary generics | | | expected 0 lifetime arguments @@ -992,7 +992,7 @@ error[E0107]: enum takes 2 generic arguments but 3 generic arguments were suppli --> $DIR/wrong-number-of-args.rs:348:18 | LL | type D = Result<usize, String, char>; - | ^^^^^^ ---- help: remove this generic argument + | ^^^^^^ ------ help: remove the unnecessary generic argument | | | expected 2 generic arguments diff --git a/tests/ui/impl-trait/auto-trait-selection-freeze.next.stderr b/tests/ui/impl-trait/auto-trait-selection-freeze.next.stderr new file mode 100644 index 00000000000..5caf0eb2fd4 --- /dev/null +++ b/tests/ui/impl-trait/auto-trait-selection-freeze.next.stderr @@ -0,0 +1,22 @@ +error[E0283]: type annotations needed + --> $DIR/auto-trait-selection-freeze.rs:19:16 + | +LL | if false { is_trait(foo()) } else { Default::default() } + | ^^^^^^^^ ----- type must be known at this point + | | + | cannot infer type of the type parameter `T` declared on the function `is_trait` + | + = note: cannot satisfy `_: Trait<_>` +note: required by a bound in `is_trait` + --> $DIR/auto-trait-selection-freeze.rs:11:16 + | +LL | fn is_trait<T: Trait<U>, U: Default>(_: T) -> U { + | ^^^^^^^^ required by this bound in `is_trait` +help: consider specifying the generic arguments + | +LL | if false { is_trait::<T, U>(foo()) } else { Default::default() } + | ++++++++ + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0283`. diff --git a/tests/ui/impl-trait/auto-trait-selection-freeze.old.stderr b/tests/ui/impl-trait/auto-trait-selection-freeze.old.stderr new file mode 100644 index 00000000000..b4d2229d408 --- /dev/null +++ b/tests/ui/impl-trait/auto-trait-selection-freeze.old.stderr @@ -0,0 +1,26 @@ +error[E0283]: type annotations needed + --> $DIR/auto-trait-selection-freeze.rs:19:16 + | +LL | if false { is_trait(foo()) } else { Default::default() } + | ^^^^^^^^ cannot infer type of the type parameter `U` declared on the function `is_trait` + | +note: multiple `impl`s satisfying `impl Sized: Trait<_>` found + --> $DIR/auto-trait-selection-freeze.rs:16:1 + | +LL | impl<T: Freeze> Trait<u32> for T {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | impl<T> Trait<i32> for T {} + | ^^^^^^^^^^^^^^^^^^^^^^^^ +note: required by a bound in `is_trait` + --> $DIR/auto-trait-selection-freeze.rs:11:16 + | +LL | fn is_trait<T: Trait<U>, U: Default>(_: T) -> U { + | ^^^^^^^^ required by this bound in `is_trait` +help: consider specifying the generic arguments + | +LL | if false { is_trait::<_, U>(foo()) } else { Default::default() } + | ++++++++ + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0283`. diff --git a/tests/ui/impl-trait/auto-trait-selection-freeze.rs b/tests/ui/impl-trait/auto-trait-selection-freeze.rs new file mode 100644 index 00000000000..7306a1c41f7 --- /dev/null +++ b/tests/ui/impl-trait/auto-trait-selection-freeze.rs @@ -0,0 +1,23 @@ +//! This test shows how we fail selection in a way that can influence +//! selection in a code path that succeeds. + +//@ revisions: next old +//@[next] compile-flags: -Znext-solver + +#![feature(freeze)] + +use std::marker::Freeze; + +fn is_trait<T: Trait<U>, U: Default>(_: T) -> U { + Default::default() +} + +trait Trait<T> {} +impl<T: Freeze> Trait<u32> for T {} +impl<T> Trait<i32> for T {} +fn foo() -> impl Sized { + if false { is_trait(foo()) } else { Default::default() } + //~^ ERROR: type annotations needed +} + +fn main() {} diff --git a/tests/ui/impl-trait/auto-trait-selection.next.stderr b/tests/ui/impl-trait/auto-trait-selection.next.stderr new file mode 100644 index 00000000000..d34fdcc4496 --- /dev/null +++ b/tests/ui/impl-trait/auto-trait-selection.next.stderr @@ -0,0 +1,22 @@ +error[E0283]: type annotations needed + --> $DIR/auto-trait-selection.rs:15:16 + | +LL | if false { is_trait(foo()) } else { Default::default() } + | ^^^^^^^^ ----- type must be known at this point + | | + | cannot infer type of the type parameter `T` declared on the function `is_trait` + | + = note: cannot satisfy `_: Trait<_>` +note: required by a bound in `is_trait` + --> $DIR/auto-trait-selection.rs:7:16 + | +LL | fn is_trait<T: Trait<U>, U: Default>(_: T) -> U { + | ^^^^^^^^ required by this bound in `is_trait` +help: consider specifying the generic arguments + | +LL | if false { is_trait::<T, U>(foo()) } else { Default::default() } + | ++++++++ + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0283`. diff --git a/tests/ui/impl-trait/auto-trait-selection.old.stderr b/tests/ui/impl-trait/auto-trait-selection.old.stderr new file mode 100644 index 00000000000..1b5fd95fdf9 --- /dev/null +++ b/tests/ui/impl-trait/auto-trait-selection.old.stderr @@ -0,0 +1,26 @@ +error[E0283]: type annotations needed + --> $DIR/auto-trait-selection.rs:15:16 + | +LL | if false { is_trait(foo()) } else { Default::default() } + | ^^^^^^^^ cannot infer type of the type parameter `U` declared on the function `is_trait` + | +note: multiple `impl`s satisfying `impl Sized: Trait<_>` found + --> $DIR/auto-trait-selection.rs:12:1 + | +LL | impl<T: Send> Trait<u32> for T {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | impl<T> Trait<i32> for T {} + | ^^^^^^^^^^^^^^^^^^^^^^^^ +note: required by a bound in `is_trait` + --> $DIR/auto-trait-selection.rs:7:16 + | +LL | fn is_trait<T: Trait<U>, U: Default>(_: T) -> U { + | ^^^^^^^^ required by this bound in `is_trait` +help: consider specifying the generic arguments + | +LL | if false { is_trait::<_, U>(foo()) } else { Default::default() } + | ++++++++ + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0283`. diff --git a/tests/ui/impl-trait/auto-trait-selection.rs b/tests/ui/impl-trait/auto-trait-selection.rs new file mode 100644 index 00000000000..ee5612459c2 --- /dev/null +++ b/tests/ui/impl-trait/auto-trait-selection.rs @@ -0,0 +1,19 @@ +//! This test shows how we fail selection in a way that can influence +//! selection in a code path that succeeds. + +//@ revisions: next old +//@[next] compile-flags: -Znext-solver + +fn is_trait<T: Trait<U>, U: Default>(_: T) -> U { + Default::default() +} + +trait Trait<T> {} +impl<T: Send> Trait<u32> for T {} +impl<T> Trait<i32> for T {} +fn foo() -> impl Sized { + if false { is_trait(foo()) } else { Default::default() } + //~^ ERROR: type annotations needed +} + +fn main() {} diff --git a/tests/ui/impl-trait/call_method_on_inherent_impl_ref.current.stderr b/tests/ui/impl-trait/call_method_on_inherent_impl_ref.current.stderr index fe6e166cb4f..fb51bb7b417 100644 --- a/tests/ui/impl-trait/call_method_on_inherent_impl_ref.current.stderr +++ b/tests/ui/impl-trait/call_method_on_inherent_impl_ref.current.stderr @@ -1,5 +1,5 @@ error[E0599]: no method named `my_debug` found for opaque type `impl Debug` in the current scope - --> $DIR/call_method_on_inherent_impl_ref.rs:20:11 + --> $DIR/call_method_on_inherent_impl_ref.rs:19:11 | LL | fn my_debug(&self); | -------- the method is available for `&impl Debug` here @@ -14,27 +14,6 @@ note: `MyDebug` defines an item `my_debug`, perhaps you need to implement it LL | trait MyDebug { | ^^^^^^^^^^^^^ -error[E0391]: cycle detected when computing type of opaque `my_foo::{opaque#0}` - --> $DIR/call_method_on_inherent_impl_ref.rs:15:16 - | -LL | fn my_foo() -> impl std::fmt::Debug { - | ^^^^^^^^^^^^^^^^^^^^ - | -note: ...which requires type-checking `my_foo`... - --> $DIR/call_method_on_inherent_impl_ref.rs:20:9 - | -LL | x.my_debug(); - | ^ - = note: ...which requires evaluating trait selection obligation `my_foo::{opaque#0}: core::marker::Unpin`... - = note: ...which again requires computing type of opaque `my_foo::{opaque#0}`, completing the cycle -note: cycle used when computing type of `my_foo::{opaque#0}` - --> $DIR/call_method_on_inherent_impl_ref.rs:15:16 - | -LL | fn my_foo() -> impl std::fmt::Debug { - | ^^^^^^^^^^^^^^^^^^^^ - = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information - -error: aborting due to 2 previous errors +error: aborting due to 1 previous error -Some errors have detailed explanations: E0391, E0599. -For more information about an error, try `rustc --explain E0391`. +For more information about this error, try `rustc --explain E0599`. diff --git a/tests/ui/impl-trait/call_method_on_inherent_impl_ref.next.stderr b/tests/ui/impl-trait/call_method_on_inherent_impl_ref.next.stderr index 327f6ca3450..7202cb6f90a 100644 --- a/tests/ui/impl-trait/call_method_on_inherent_impl_ref.next.stderr +++ b/tests/ui/impl-trait/call_method_on_inherent_impl_ref.next.stderr @@ -1,5 +1,5 @@ error[E0282]: type annotations needed - --> $DIR/call_method_on_inherent_impl_ref.rs:18:13 + --> $DIR/call_method_on_inherent_impl_ref.rs:17:13 | LL | let x = my_foo(); | ^ @@ -13,7 +13,7 @@ LL | let x: /* Type */ = my_foo(); | ++++++++++++ error[E0282]: type annotations needed for `&_` - --> $DIR/call_method_on_inherent_impl_ref.rs:28:13 + --> $DIR/call_method_on_inherent_impl_ref.rs:27:13 | LL | let x = &my_bar(); | ^ diff --git a/tests/ui/impl-trait/call_method_on_inherent_impl_ref.rs b/tests/ui/impl-trait/call_method_on_inherent_impl_ref.rs index 40ad21532a4..abe60e5e45a 100644 --- a/tests/ui/impl-trait/call_method_on_inherent_impl_ref.rs +++ b/tests/ui/impl-trait/call_method_on_inherent_impl_ref.rs @@ -13,7 +13,6 @@ where } fn my_foo() -> impl std::fmt::Debug { - //[current]~^ cycle if false { let x = my_foo(); //[next]~^ type annotations needed diff --git a/tests/ui/impl-trait/explicit-generic-args-with-impl-trait/explicit-generic-args-for-impl.stderr b/tests/ui/impl-trait/explicit-generic-args-with-impl-trait/explicit-generic-args-for-impl.stderr index e8cd16bc301..9b0d0c554f0 100644 --- a/tests/ui/impl-trait/explicit-generic-args-with-impl-trait/explicit-generic-args-for-impl.stderr +++ b/tests/ui/impl-trait/explicit-generic-args-with-impl-trait/explicit-generic-args-for-impl.stderr @@ -2,7 +2,7 @@ error[E0107]: function takes 1 generic argument but 2 generic arguments were sup --> $DIR/explicit-generic-args-for-impl.rs:4:5 | LL | foo::<str, String>("".to_string()); - | ^^^ ------ help: remove this generic argument + | ^^^ -------- help: remove the unnecessary generic argument | | | expected 1 generic argument | diff --git a/tests/ui/impl-trait/in-trait/opaque-and-lifetime-mismatch.stderr b/tests/ui/impl-trait/in-trait/opaque-and-lifetime-mismatch.stderr index 1f8a0d5edd7..81570781b27 100644 --- a/tests/ui/impl-trait/in-trait/opaque-and-lifetime-mismatch.stderr +++ b/tests/ui/impl-trait/in-trait/opaque-and-lifetime-mismatch.stderr @@ -38,7 +38,7 @@ error[E0107]: struct takes 0 generic arguments but 1 generic argument was suppli --> $DIR/opaque-and-lifetime-mismatch.rs:4:17 | LL | fn bar() -> Wrapper<impl Sized>; - | ^^^^^^^ ---------- help: remove this generic argument + | ^^^^^^^ ---------- help: remove the unnecessary generic argument | | | expected 0 generic arguments | @@ -52,7 +52,7 @@ error[E0107]: struct takes 0 generic arguments but 1 generic argument was suppli --> $DIR/opaque-and-lifetime-mismatch.rs:18:17 | LL | fn foo() -> Wrapper<impl Sized>; - | ^^^^^^^ ---------- help: remove this generic argument + | ^^^^^^^ ---------- help: remove the unnecessary generic argument | | | expected 0 generic arguments | @@ -93,7 +93,7 @@ error[E0107]: struct takes 0 generic arguments but 1 generic argument was suppli --> $DIR/opaque-and-lifetime-mismatch.rs:24:17 | LL | fn foo() -> Wrapper<impl Sized> { - | ^^^^^^^ ---------- help: remove this generic argument + | ^^^^^^^ ---------- help: remove the unnecessary generic argument | | | expected 0 generic arguments | diff --git a/tests/ui/impl-trait/rpit/const_check_false_cycle.rs b/tests/ui/impl-trait/rpit/const_check_false_cycle.rs new file mode 100644 index 00000000000..d4ea0e3b147 --- /dev/null +++ b/tests/ui/impl-trait/rpit/const_check_false_cycle.rs @@ -0,0 +1,14 @@ +//! This test caused a cycle error when checking whether the +//! return type is `Freeze` during const checking, even though +//! the information is readily available. + +//@ revisions: current next +//@[next] compile-flags: -Znext-solver +//@ check-pass + +const fn f() -> impl Eq { + g() +} +const fn g() {} + +fn main() {} diff --git a/tests/ui/impl-trait/unsized_coercion3.next.stderr b/tests/ui/impl-trait/unsized_coercion3.next.stderr index bab8d1cd83b..586ae076028 100644 --- a/tests/ui/impl-trait/unsized_coercion3.next.stderr +++ b/tests/ui/impl-trait/unsized_coercion3.next.stderr @@ -5,7 +5,7 @@ LL | let x = hello(); | ^^^^^^^ types differ error[E0308]: mismatched types - --> $DIR/unsized_coercion3.rs:19:14 + --> $DIR/unsized_coercion3.rs:18:14 | LL | fn hello() -> Box<impl Trait + ?Sized> { | ------------------- the expected opaque type @@ -21,7 +21,7 @@ note: associated function defined here --> $SRC_DIR/alloc/src/boxed.rs:LL:COL error[E0277]: the size for values of type `impl Trait + ?Sized` cannot be known at compilation time - --> $DIR/unsized_coercion3.rs:19:14 + --> $DIR/unsized_coercion3.rs:18:14 | LL | Box::new(1u32) | -------- ^^^^ doesn't have a size known at compile-time diff --git a/tests/ui/impl-trait/unsized_coercion3.old.stderr b/tests/ui/impl-trait/unsized_coercion3.old.stderr index 24a302d7007..52a72b84a8d 100644 --- a/tests/ui/impl-trait/unsized_coercion3.old.stderr +++ b/tests/ui/impl-trait/unsized_coercion3.old.stderr @@ -1,17 +1,3 @@ -error: cannot check whether the hidden type of opaque type satisfies auto traits - --> $DIR/unsized_coercion3.rs:15:32 - | -LL | let y: Box<dyn Send> = x; - | ^ - | - = note: fetching the hidden types of an opaque inside of the defining scope is not supported. You can try moving the opaque type and the item that actually registers a hidden type into a new submodule -note: opaque type is declared here - --> $DIR/unsized_coercion3.rs:11:19 - | -LL | fn hello() -> Box<impl Trait + ?Sized> { - | ^^^^^^^^^^^^^^^^^^^ - = note: required for the cast from `Box<impl Trait + ?Sized>` to `Box<dyn Send>` - error[E0277]: the size for values of type `impl Trait + ?Sized` cannot be known at compilation time --> $DIR/unsized_coercion3.rs:15:32 | @@ -21,6 +7,6 @@ LL | let y: Box<dyn Send> = x; = help: the trait `Sized` is not implemented for `impl Trait + ?Sized` = note: required for the cast from `Box<impl Trait + ?Sized>` to `Box<dyn Send>` -error: aborting due to 2 previous errors +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/impl-trait/unsized_coercion3.rs b/tests/ui/impl-trait/unsized_coercion3.rs index 85950ac583e..7e862de2157 100644 --- a/tests/ui/impl-trait/unsized_coercion3.rs +++ b/tests/ui/impl-trait/unsized_coercion3.rs @@ -14,7 +14,6 @@ fn hello() -> Box<impl Trait + ?Sized> { //[next]~^ ERROR: type mismatch resolving `impl Trait + ?Sized <: dyn Send` let y: Box<dyn Send> = x; //[old]~^ ERROR: the size for values of type `impl Trait + ?Sized` cannot be know - //[old]~| ERROR: cannot check whether the hidden type of opaque type satisfies auto traits } Box::new(1u32) //[next]~^ ERROR: mismatched types diff --git a/tests/ui/impl-trait/unsized_coercion5.old.stderr b/tests/ui/impl-trait/unsized_coercion5.old.stderr index b6437266f27..06ad54b1f1d 100644 --- a/tests/ui/impl-trait/unsized_coercion5.old.stderr +++ b/tests/ui/impl-trait/unsized_coercion5.old.stderr @@ -9,20 +9,6 @@ LL | let y: Box<dyn Send> = x as Box<dyn Trait + Send>; = note: expected struct `Box<dyn Send>` found struct `Box<dyn Trait + Send>` -error: cannot check whether the hidden type of opaque type satisfies auto traits - --> $DIR/unsized_coercion5.rs:16:32 - | -LL | let y: Box<dyn Send> = x as Box<dyn Trait + Send>; - | ^ - | - = note: fetching the hidden types of an opaque inside of the defining scope is not supported. You can try moving the opaque type and the item that actually registers a hidden type into a new submodule -note: opaque type is declared here - --> $DIR/unsized_coercion5.rs:13:19 - | -LL | fn hello() -> Box<impl Trait + ?Sized> { - | ^^^^^^^^^^^^^^^^^^^ - = note: required for the cast from `Box<impl Trait + ?Sized>` to `Box<dyn Trait + Send>` - error[E0277]: the size for values of type `impl Trait + ?Sized` cannot be known at compilation time --> $DIR/unsized_coercion5.rs:16:32 | @@ -32,7 +18,7 @@ LL | let y: Box<dyn Send> = x as Box<dyn Trait + Send>; = help: the trait `Sized` is not implemented for `impl Trait + ?Sized` = note: required for the cast from `Box<impl Trait + ?Sized>` to `Box<dyn Trait + Send>` -error: aborting due to 3 previous errors +error: aborting due to 2 previous errors Some errors have detailed explanations: E0277, E0308. For more information about an error, try `rustc --explain E0277`. diff --git a/tests/ui/impl-trait/unsized_coercion5.rs b/tests/ui/impl-trait/unsized_coercion5.rs index b007267a006..85d313caa13 100644 --- a/tests/ui/impl-trait/unsized_coercion5.rs +++ b/tests/ui/impl-trait/unsized_coercion5.rs @@ -15,8 +15,7 @@ fn hello() -> Box<impl Trait + ?Sized> { let x = hello(); let y: Box<dyn Send> = x as Box<dyn Trait + Send>; //[old]~^ ERROR: the size for values of type `impl Trait + ?Sized` cannot be know - //[old]~| ERROR: cannot check whether the hidden type of opaque type satisfies auto traits - //~^^^ ERROR: mismatched types + //~^^ ERROR: mismatched types } Box::new(1u32) } diff --git a/tests/ui/issues/issue-18423.stderr b/tests/ui/issues/issue-18423.stderr index 2c6015eaa9d..b5f19b5c9b2 100644 --- a/tests/ui/issues/issue-18423.stderr +++ b/tests/ui/issues/issue-18423.stderr @@ -2,7 +2,7 @@ error[E0107]: struct takes 0 lifetime arguments but 1 lifetime argument was supp --> $DIR/issue-18423.rs:4:8 | LL | x: Box<'a, isize> - | ^^^ -- help: remove this lifetime argument + | ^^^ -- help: remove the lifetime argument | | | expected 0 lifetime arguments diff --git a/tests/ui/issues/issue-53251.stderr b/tests/ui/issues/issue-53251.stderr index 05ea6311589..981966354b9 100644 --- a/tests/ui/issues/issue-53251.stderr +++ b/tests/ui/issues/issue-53251.stderr @@ -2,7 +2,7 @@ error[E0107]: associated function takes 0 generic arguments but 1 generic argume --> $DIR/issue-53251.rs:11:20 | LL | S::f::<i64>(); - | ^------- help: remove these generics + | ^------- help: remove the unnecessary generics | | | expected 0 generic arguments ... @@ -20,7 +20,7 @@ error[E0107]: associated function takes 0 generic arguments but 1 generic argume --> $DIR/issue-53251.rs:11:20 | LL | S::f::<i64>(); - | ^------- help: remove these generics + | ^------- help: remove the unnecessary generics | | | expected 0 generic arguments ... diff --git a/tests/ui/issues/issue-60622.stderr b/tests/ui/issues/issue-60622.stderr index 43da2773940..298ef3799f2 100644 --- a/tests/ui/issues/issue-60622.stderr +++ b/tests/ui/issues/issue-60622.stderr @@ -20,7 +20,7 @@ error[E0107]: method takes 0 generic arguments but 1 generic argument was suppli --> $DIR/issue-60622.rs:10:7 | LL | b.a::<'_, T>(); - | ^ - help: remove this generic argument + | ^ - help: remove the unnecessary generic argument | | | expected 0 generic arguments | diff --git a/tests/ui/late-bound-lifetimes/mismatched_arg_count.stderr b/tests/ui/late-bound-lifetimes/mismatched_arg_count.stderr index 1b8f1c3fd6f..1717b6aa124 100644 --- a/tests/ui/late-bound-lifetimes/mismatched_arg_count.stderr +++ b/tests/ui/late-bound-lifetimes/mismatched_arg_count.stderr @@ -2,7 +2,7 @@ error[E0107]: type alias takes 1 lifetime argument but 2 lifetime arguments were --> $DIR/mismatched_arg_count.rs:9:29 | LL | fn bar<'a, T: Trait<'a>>(_: Alias<'a, 'a, T>) {} - | ^^^^^ -- help: remove this lifetime argument + | ^^^^^ ---- help: remove the lifetime argument | | | expected 1 lifetime argument | diff --git a/tests/ui/layout/size-of-val-raw-too-big.rs b/tests/ui/layout/size-of-val-raw-too-big.rs new file mode 100644 index 00000000000..8d82c78d953 --- /dev/null +++ b/tests/ui/layout/size-of-val-raw-too-big.rs @@ -0,0 +1,18 @@ +//@ build-fail +//@ compile-flags: --crate-type lib +//@ only-32bit Layout computation rejects this layout for different reasons on 64-bit. +//@ error-pattern: too big for the current architecture +#![feature(core_intrinsics)] +#![allow(internal_features)] + +// isize::MAX is fine, but with the padding for the unsized tail it is too big. +#[repr(C)] +pub struct Example([u8; isize::MAX as usize], [u16]); + +// We guarantee that with length 0, `size_of_val_raw` (which calls the `size_of_val` intrinsic) +// is safe to call. The compiler aborts compilation if a length of 0 would overflow. +// So let's construct a case where length 0 just barely overflows, and ensure that +// does abort compilation. +pub fn check(x: *const Example) -> usize { + unsafe { std::intrinsics::size_of_val(x) } +} diff --git a/tests/ui/layout/size-of-val-raw-too-big.stderr b/tests/ui/layout/size-of-val-raw-too-big.stderr new file mode 100644 index 00000000000..aa9abd644fa --- /dev/null +++ b/tests/ui/layout/size-of-val-raw-too-big.stderr @@ -0,0 +1,4 @@ +error: values of the type `Example` are too big for the current architecture + +error: aborting due to 1 previous error + diff --git a/tests/ui/lifetimes/noisy-follow-up-erro.stderr b/tests/ui/lifetimes/noisy-follow-up-erro.stderr index f549009a87c..04863badbd1 100644 --- a/tests/ui/lifetimes/noisy-follow-up-erro.stderr +++ b/tests/ui/lifetimes/noisy-follow-up-erro.stderr @@ -2,7 +2,7 @@ error[E0107]: struct takes 2 lifetime arguments but 3 lifetime arguments were su --> $DIR/noisy-follow-up-erro.rs:12:30 | LL | fn boom(&self, foo: &mut Foo<'_, '_, 'a>) -> Result<(), &'a ()> { - | ^^^ -- help: remove this lifetime argument + | ^^^ ---- help: remove the lifetime argument | | | expected 2 lifetime arguments | diff --git a/tests/ui/lint/expansion-time.stderr b/tests/ui/lint/expansion-time.stderr index 626e51dd00c..e490ae91a48 100644 --- a/tests/ui/lint/expansion-time.stderr +++ b/tests/ui/lint/expansion-time.stderr @@ -55,6 +55,21 @@ LL | #[warn(incomplete_include)] warning: 4 warnings emitted Future incompatibility report: Future breakage diagnostic: +warning: missing fragment specifier + --> $DIR/expansion-time.rs:9:19 + | +LL | macro_rules! m { ($i) => {} } + | ^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #40107 <https://github.com/rust-lang/rust/issues/40107> +note: the lint level is defined here + --> $DIR/expansion-time.rs:8:8 + | +LL | #[warn(missing_fragment_specifier)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Future breakage diagnostic: warning: use of unstable library feature 'test': `bench` is a part of custom test frameworks which are unstable --> $DIR/expansion-time.rs:14:7 | diff --git a/tests/ui/macros/issue-39404.stderr b/tests/ui/macros/issue-39404.stderr index 33cafd93a40..176c8e9f073 100644 --- a/tests/ui/macros/issue-39404.stderr +++ b/tests/ui/macros/issue-39404.stderr @@ -10,3 +10,14 @@ LL | macro_rules! m { ($i) => {} } error: aborting due to 1 previous error +Future incompatibility report: Future breakage diagnostic: +error: missing fragment specifier + --> $DIR/issue-39404.rs:3:19 + | +LL | macro_rules! m { ($i) => {} } + | ^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #40107 <https://github.com/rust-lang/rust/issues/40107> + = note: `#[deny(missing_fragment_specifier)]` on by default + diff --git a/tests/ui/macros/macro-match-nonterminal.stderr b/tests/ui/macros/macro-match-nonterminal.stderr index ef7261c0239..831579c4fef 100644 --- a/tests/ui/macros/macro-match-nonterminal.stderr +++ b/tests/ui/macros/macro-match-nonterminal.stderr @@ -25,3 +25,25 @@ LL | ($a, $b) => { error: aborting due to 3 previous errors +Future incompatibility report: Future breakage diagnostic: +error: missing fragment specifier + --> $DIR/macro-match-nonterminal.rs:2:8 + | +LL | ($a, $b) => { + | ^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #40107 <https://github.com/rust-lang/rust/issues/40107> + = note: `#[deny(missing_fragment_specifier)]` on by default + +Future breakage diagnostic: +error: missing fragment specifier + --> $DIR/macro-match-nonterminal.rs:2:10 + | +LL | ($a, $b) => { + | ^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #40107 <https://github.com/rust-lang/rust/issues/40107> + = note: `#[deny(missing_fragment_specifier)]` on by default + diff --git a/tests/ui/macros/macro-missing-fragment-deduplication.stderr b/tests/ui/macros/macro-missing-fragment-deduplication.stderr index 3b9e716e194..c46712f70fd 100644 --- a/tests/ui/macros/macro-missing-fragment-deduplication.stderr +++ b/tests/ui/macros/macro-missing-fragment-deduplication.stderr @@ -16,3 +16,14 @@ LL | ($name) => {} error: aborting due to 2 previous errors +Future incompatibility report: Future breakage diagnostic: +error: missing fragment specifier + --> $DIR/macro-missing-fragment-deduplication.rs:4:6 + | +LL | ($name) => {} + | ^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #40107 <https://github.com/rust-lang/rust/issues/40107> + = note: `#[deny(missing_fragment_specifier)]` on by default + diff --git a/tests/ui/macros/macro-missing-fragment.stderr b/tests/ui/macros/macro-missing-fragment.stderr index 1089f67f433..abe4d4cd68a 100644 --- a/tests/ui/macros/macro-missing-fragment.stderr +++ b/tests/ui/macros/macro-missing-fragment.stderr @@ -38,3 +38,48 @@ LL | ( $name ) => {}; error: aborting due to 1 previous error; 3 warnings emitted +Future incompatibility report: Future breakage diagnostic: +warning: missing fragment specifier + --> $DIR/macro-missing-fragment.rs:4:20 + | +LL | ( $( any_token $field_rust_type )* ) => {}; + | ^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #40107 <https://github.com/rust-lang/rust/issues/40107> +note: the lint level is defined here + --> $DIR/macro-missing-fragment.rs:1:9 + | +LL | #![warn(missing_fragment_specifier)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Future breakage diagnostic: +warning: missing fragment specifier + --> $DIR/macro-missing-fragment.rs:12:7 + | +LL | ( $name ) => {}; + | ^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #40107 <https://github.com/rust-lang/rust/issues/40107> +note: the lint level is defined here + --> $DIR/macro-missing-fragment.rs:1:9 + | +LL | #![warn(missing_fragment_specifier)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Future breakage diagnostic: +warning: missing fragment specifier + --> $DIR/macro-missing-fragment.rs:18:7 + | +LL | ( $name ) => {}; + | ^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #40107 <https://github.com/rust-lang/rust/issues/40107> +note: the lint level is defined here + --> $DIR/macro-missing-fragment.rs:1:9 + | +LL | #![warn(missing_fragment_specifier)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + diff --git a/tests/ui/methods/method-call-lifetime-args-fail.stderr b/tests/ui/methods/method-call-lifetime-args-fail.stderr index 645d8b8d14a..b251dd4d342 100644 --- a/tests/ui/methods/method-call-lifetime-args-fail.stderr +++ b/tests/ui/methods/method-call-lifetime-args-fail.stderr @@ -20,7 +20,7 @@ error[E0107]: method takes 2 lifetime arguments but 3 lifetime arguments were su --> $DIR/method-call-lifetime-args-fail.rs:18:7 | LL | S.early::<'static, 'static, 'static>(); - | ^^^^^ ------- help: remove this lifetime argument + | ^^^^^ --------- help: remove the lifetime argument | | | expected 2 lifetime arguments | @@ -220,7 +220,7 @@ error[E0107]: method takes 2 lifetime arguments but 3 lifetime arguments were su --> $DIR/method-call-lifetime-args-fail.rs:65:8 | LL | S::early::<'static, 'static, 'static>(S); - | ^^^^^ ------- help: remove this lifetime argument + | ^^^^^ --------- help: remove the lifetime argument | | | expected 2 lifetime arguments | diff --git a/tests/ui/parser/macro/issue-33569.stderr b/tests/ui/parser/macro/issue-33569.stderr index 0dca090fb87..d1b6abfeeeb 100644 --- a/tests/ui/parser/macro/issue-33569.stderr +++ b/tests/ui/parser/macro/issue-33569.stderr @@ -28,3 +28,14 @@ LL | { $+ } => { error: aborting due to 4 previous errors +Future incompatibility report: Future breakage diagnostic: +error: missing fragment specifier + --> $DIR/issue-33569.rs:2:8 + | +LL | { $+ } => { + | ^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #40107 <https://github.com/rust-lang/rust/issues/40107> + = note: `#[deny(missing_fragment_specifier)]` on by default + diff --git a/tests/ui/proc-macro/cfg-eval-inner.stdout b/tests/ui/proc-macro/cfg-eval-inner.stdout index 9fa8f437d0e..1aac28b2ec2 100644 --- a/tests/ui/proc-macro/cfg-eval-inner.stdout +++ b/tests/ui/proc-macro/cfg-eval-inner.stdout @@ -73,7 +73,7 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [ span: $DIR/cfg-eval-inner.rs:19:40: 19:54 (#0), }, ], - span: $DIR/cfg-eval-inner.rs:19:5: 19:6 (#0), + span: $DIR/cfg-eval-inner.rs:19:7: 19:56 (#0), }, Punct { ch: '#', @@ -168,7 +168,7 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [ span: $DIR/cfg-eval-inner.rs:23:48: 23:70 (#0), }, ], - span: $DIR/cfg-eval-inner.rs:23:13: 23:14 (#0), + span: $DIR/cfg-eval-inner.rs:23:15: 23:72 (#0), }, Literal { kind: Integer, @@ -233,7 +233,7 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [ span: $DIR/cfg-eval-inner.rs:32:40: 32:56 (#0), }, ], - span: $DIR/cfg-eval-inner.rs:32:5: 32:6 (#0), + span: $DIR/cfg-eval-inner.rs:32:7: 32:58 (#0), }, Ident { ident: "fn", diff --git a/tests/ui/proc-macro/cfg-eval.stdout b/tests/ui/proc-macro/cfg-eval.stdout index e26e16f5a8c..5d88297ad68 100644 --- a/tests/ui/proc-macro/cfg-eval.stdout +++ b/tests/ui/proc-macro/cfg-eval.stdout @@ -60,7 +60,7 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [ span: $DIR/cfg-eval.rs:22:36: 22:38 (#0), }, ], - span: $DIR/cfg-eval.rs:22:5: 22:6 (#0), + span: $DIR/cfg-eval.rs:22:6: 22:40 (#0), }, Ident { ident: "field_true", @@ -99,7 +99,7 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [ span: $DIR/cfg-eval.rs:35:62: 35:73 (#0), }, ], - span: $DIR/cfg-eval.rs:35:39: 35:40 (#0), + span: $DIR/cfg-eval.rs:35:40: 35:75 (#0), }, Group { delimiter: Parenthesis, diff --git a/tests/ui/proc-macro/expand-to-derive.stdout b/tests/ui/proc-macro/expand-to-derive.stdout index d59b7e5b88f..81fc52ea22d 100644 --- a/tests/ui/proc-macro/expand-to-derive.stdout +++ b/tests/ui/proc-macro/expand-to-derive.stdout @@ -57,7 +57,7 @@ PRINT-DERIVE INPUT (DEBUG): TokenStream [ span: $DIR/expand-to-derive.rs:27:28: 27:39 (#0), }, ], - span: $DIR/expand-to-derive.rs:27:5: 27:6 (#0), + span: $DIR/expand-to-derive.rs:27:6: 27:41 (#0), }, Ident { ident: "struct", diff --git a/tests/ui/proc-macro/inner-attrs.stdout b/tests/ui/proc-macro/inner-attrs.stdout index c8d93babe3a..ed47ee2cf5a 100644 --- a/tests/ui/proc-macro/inner-attrs.stdout +++ b/tests/ui/proc-macro/inner-attrs.stdout @@ -674,7 +674,7 @@ PRINT-DERIVE INPUT (DEBUG): TokenStream [ span: $DIR/inner-attrs.rs:41:52: 41:59 (#0), }, ], - span: $DIR/inner-attrs.rs:41:17: 41:18 (#0), + span: $DIR/inner-attrs.rs:41:19: 41:61 (#0), }, Ident { ident: "true", diff --git a/tests/ui/proc-macro/issue-75930-derive-cfg.stdout b/tests/ui/proc-macro/issue-75930-derive-cfg.stdout index cc712abf2a5..4dcf2b717d8 100644 --- a/tests/ui/proc-macro/issue-75930-derive-cfg.stdout +++ b/tests/ui/proc-macro/issue-75930-derive-cfg.stdout @@ -119,7 +119,7 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [ span: $DIR/issue-75930-derive-cfg.rs:50:29: 50:40 (#0), }, ], - span: $DIR/issue-75930-derive-cfg.rs:50:1: 50:2 (#0), + span: $DIR/issue-75930-derive-cfg.rs:50:2: 50:42 (#0), }, Punct { ch: '#', @@ -1395,7 +1395,7 @@ PRINT-DERIVE INPUT (DEBUG): TokenStream [ span: $DIR/issue-75930-derive-cfg.rs:50:29: 50:40 (#0), }, ], - span: $DIR/issue-75930-derive-cfg.rs:50:1: 50:2 (#0), + span: $DIR/issue-75930-derive-cfg.rs:50:2: 50:42 (#0), }, Punct { ch: '#', @@ -1571,7 +1571,7 @@ PRINT-DERIVE INPUT (DEBUG): TokenStream [ span: $DIR/issue-75930-derive-cfg.rs:63:41: 63:51 (#0), }, ], - span: $DIR/issue-75930-derive-cfg.rs:63:13: 63:14 (#0), + span: $DIR/issue-75930-derive-cfg.rs:63:14: 63:53 (#0), }, Ident { ident: "false", diff --git a/tests/ui/proc-macro/macro-rules-derive-cfg.stdout b/tests/ui/proc-macro/macro-rules-derive-cfg.stdout index 257d59974b8..fadf210127e 100644 --- a/tests/ui/proc-macro/macro-rules-derive-cfg.stdout +++ b/tests/ui/proc-macro/macro-rules-derive-cfg.stdout @@ -88,7 +88,7 @@ PRINT-DERIVE INPUT (DEBUG): TokenStream [ span: $DIR/macro-rules-derive-cfg.rs:19:59: 19:66 (#3), }, ], - span: $DIR/macro-rules-derive-cfg.rs:19:25: 19:26 (#3), + span: $DIR/macro-rules-derive-cfg.rs:19:26: 19:68 (#3), }, Punct { ch: '#', @@ -113,7 +113,7 @@ PRINT-DERIVE INPUT (DEBUG): TokenStream [ span: $DIR/macro-rules-derive-cfg.rs:26:47: 26:55 (#0), }, ], - span: $DIR/macro-rules-derive-cfg.rs:26:13: 26:14 (#0), + span: $DIR/macro-rules-derive-cfg.rs:26:14: 26:57 (#0), }, Group { delimiter: Brace, @@ -146,7 +146,7 @@ PRINT-DERIVE INPUT (DEBUG): TokenStream [ span: $DIR/macro-rules-derive-cfg.rs:27:34: 27:42 (#0), }, ], - span: $DIR/macro-rules-derive-cfg.rs:27:5: 27:6 (#0), + span: $DIR/macro-rules-derive-cfg.rs:27:7: 27:44 (#0), }, Literal { kind: Integer, diff --git a/tests/ui/resolve/issue-3214.stderr b/tests/ui/resolve/issue-3214.stderr index 5b57c1baf90..1c64fdc1711 100644 --- a/tests/ui/resolve/issue-3214.stderr +++ b/tests/ui/resolve/issue-3214.stderr @@ -12,7 +12,7 @@ error[E0107]: struct takes 0 generic arguments but 1 generic argument was suppli --> $DIR/issue-3214.rs:6:22 | LL | impl<T> Drop for Foo<T> { - | ^^^--- help: remove these generics + | ^^^--- help: remove the unnecessary generics | | | expected 0 generic arguments | diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/no-explicit-const-params-cross-crate.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/no-explicit-const-params-cross-crate.stderr index fa2e3da368b..8c591edac54 100644 --- a/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/no-explicit-const-params-cross-crate.stderr +++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/no-explicit-const-params-cross-crate.stderr @@ -2,7 +2,7 @@ error[E0107]: function takes 0 generic arguments but 1 generic argument was supp --> $DIR/no-explicit-const-params-cross-crate.rs:14:5 | LL | foo::<false>(); - | ^^^--------- help: remove these generics + | ^^^--------- help: remove the unnecessary generics | | | expected 0 generic arguments | @@ -32,7 +32,7 @@ error[E0107]: function takes 0 generic arguments but 1 generic argument was supp --> $DIR/no-explicit-const-params-cross-crate.rs:7:5 | LL | foo::<true>(); - | ^^^-------- help: remove these generics + | ^^^-------- help: remove the unnecessary generics | | | expected 0 generic arguments | diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/no-explicit-const-params.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/no-explicit-const-params.stderr index fbb96dfd85e..cc08114ddb5 100644 --- a/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/no-explicit-const-params.stderr +++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/no-explicit-const-params.stderr @@ -16,7 +16,7 @@ error[E0107]: function takes 0 generic arguments but 1 generic argument was supp --> $DIR/no-explicit-const-params.rs:22:5 | LL | foo::<false>(); - | ^^^--------- help: remove these generics + | ^^^--------- help: remove the unnecessary generics | | | expected 0 generic arguments | @@ -55,7 +55,7 @@ error[E0107]: function takes 0 generic arguments but 1 generic argument was supp --> $DIR/no-explicit-const-params.rs:15:5 | LL | foo::<true>(); - | ^^^-------- help: remove these generics + | ^^^-------- help: remove the unnecessary generics | | | expected 0 generic arguments | diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/ice-120503-async-const-method.rs b/tests/ui/rfcs/rfc-2632-const-trait-impl/ice-120503-async-const-method.rs index ab46d49073c..9cd18d4566d 100644 --- a/tests/ui/rfcs/rfc-2632-const-trait-impl/ice-120503-async-const-method.rs +++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/ice-120503-async-const-method.rs @@ -9,7 +9,6 @@ impl MyTrait for i32 { //~| ERROR functions in trait impls cannot be declared const //~| ERROR functions cannot be both `const` and `async` //~| ERROR method `bar` is not a member - //~| ERROR cycle detected when computing type main8().await; //~^ ERROR cannot find function } diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/ice-120503-async-const-method.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/ice-120503-async-const-method.stderr index 1f309e1e854..90771c344b5 100644 --- a/tests/ui/rfcs/rfc-2632-const-trait-impl/ice-120503-async-const-method.stderr +++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/ice-120503-async-const-method.stderr @@ -61,7 +61,7 @@ error: using `#![feature(effects)]` without enabling next trait solver globally = help: use `-Znext-solver` to enable error[E0425]: cannot find function `main8` in this scope - --> $DIR/ice-120503-async-const-method.rs:13:9 + --> $DIR/ice-120503-async-const-method.rs:12:9 | LL | main8().await; | ^^^^^ help: a function with a similar name exists: `main` @@ -69,38 +69,7 @@ LL | main8().await; LL | fn main() {} | --------- similarly named function `main` defined here -error[E0391]: cycle detected when computing type of opaque `<impl at $DIR/ice-120503-async-const-method.rs:6:1: 6:21>::bar::{opaque#0}` - --> $DIR/ice-120503-async-const-method.rs:7:5 - | -LL | async const fn bar(&self) { - | ^^^^^^^^^^^^^^^^^^^^^^^^^ - | -note: ...which requires borrow-checking `<impl at $DIR/ice-120503-async-const-method.rs:6:1: 6:21>::bar`... - --> $DIR/ice-120503-async-const-method.rs:7:5 - | -LL | async const fn bar(&self) { - | ^^^^^^^^^^^^^^^^^^^^^^^^^ -note: ...which requires promoting constants in MIR for `<impl at $DIR/ice-120503-async-const-method.rs:6:1: 6:21>::bar`... - --> $DIR/ice-120503-async-const-method.rs:7:5 - | -LL | async const fn bar(&self) { - | ^^^^^^^^^^^^^^^^^^^^^^^^^ -note: ...which requires const checking `<impl at $DIR/ice-120503-async-const-method.rs:6:1: 6:21>::bar`... - --> $DIR/ice-120503-async-const-method.rs:7:5 - | -LL | async const fn bar(&self) { - | ^^^^^^^^^^^^^^^^^^^^^^^^^ - = note: ...which requires computing whether `<impl at $DIR/ice-120503-async-const-method.rs:6:1: 6:21>::bar::{opaque#0}` is freeze... - = note: ...which requires evaluating trait selection obligation `<impl at $DIR/ice-120503-async-const-method.rs:6:1: 6:21>::bar::{opaque#0}: core::marker::Freeze`... - = note: ...which again requires computing type of opaque `<impl at $DIR/ice-120503-async-const-method.rs:6:1: 6:21>::bar::{opaque#0}`, completing the cycle -note: cycle used when computing type of `<impl at $DIR/ice-120503-async-const-method.rs:6:1: 6:21>::bar::{opaque#0}` - --> $DIR/ice-120503-async-const-method.rs:7:5 - | -LL | async const fn bar(&self) { - | ^^^^^^^^^^^^^^^^^^^^^^^^^ - = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information - -error: aborting due to 7 previous errors; 1 warning emitted +error: aborting due to 6 previous errors; 1 warning emitted -Some errors have detailed explanations: E0379, E0391, E0407, E0425. +Some errors have detailed explanations: E0379, E0407, E0425. For more information about an error, try `rustc --explain E0379`. diff --git a/tests/ui/seq-args.stderr b/tests/ui/seq-args.stderr index a5b0f8e98dc..6e0d484d013 100644 --- a/tests/ui/seq-args.stderr +++ b/tests/ui/seq-args.stderr @@ -2,7 +2,7 @@ error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplie --> $DIR/seq-args.rs:4:13 | LL | impl<T> Seq<T> for Vec<T> { - | ^^^--- help: remove these generics + | ^^^--- help: remove the unnecessary generics | | | expected 0 generic arguments | @@ -16,7 +16,7 @@ error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplie --> $DIR/seq-args.rs:9:10 | LL | impl Seq<bool> for u32 { - | ^^^------ help: remove these generics + | ^^^------ help: remove the unnecessary generics | | | expected 0 generic arguments | diff --git a/tests/ui/structs/struct-path-associated-type.stderr b/tests/ui/structs/struct-path-associated-type.stderr index 0c9d2aad5d8..de396e875b0 100644 --- a/tests/ui/structs/struct-path-associated-type.stderr +++ b/tests/ui/structs/struct-path-associated-type.stderr @@ -8,7 +8,7 @@ error[E0107]: associated type takes 0 generic arguments but 1 generic argument w --> $DIR/struct-path-associated-type.rs:14:16 | LL | let z = T::A::<u8> {}; - | ^------ help: remove these generics + | ^------ help: remove the unnecessary generics | | | expected 0 generic arguments | @@ -34,7 +34,7 @@ error[E0107]: associated type takes 0 generic arguments but 1 generic argument w --> $DIR/struct-path-associated-type.rs:25:16 | LL | let z = T::A::<u8> {}; - | ^------ help: remove these generics + | ^------ help: remove the unnecessary generics | | | expected 0 generic arguments | diff --git a/tests/ui/structs/structure-constructor-type-mismatch.stderr b/tests/ui/structs/structure-constructor-type-mismatch.stderr index cb957487347..819b65ffb71 100644 --- a/tests/ui/structs/structure-constructor-type-mismatch.stderr +++ b/tests/ui/structs/structure-constructor-type-mismatch.stderr @@ -68,7 +68,7 @@ error[E0107]: type alias takes 0 generic arguments but 1 generic argument was su --> $DIR/structure-constructor-type-mismatch.rs:48:15 | LL | let pt3 = PointF::<i32> { - | ^^^^^^------- help: remove these generics + | ^^^^^^------- help: remove the unnecessary generics | | | expected 0 generic arguments | @@ -104,7 +104,7 @@ error[E0107]: type alias takes 0 generic arguments but 1 generic argument was su --> $DIR/structure-constructor-type-mismatch.rs:54:9 | LL | PointF::<u32> { .. } => {} - | ^^^^^^------- help: remove these generics + | ^^^^^^------- help: remove the unnecessary generics | | | expected 0 generic arguments | diff --git a/tests/ui/suggestions/issue-101421.stderr b/tests/ui/suggestions/issue-101421.stderr index ececba5fb1b..12b4c04c2a3 100644 --- a/tests/ui/suggestions/issue-101421.stderr +++ b/tests/ui/suggestions/issue-101421.stderr @@ -2,7 +2,7 @@ error[E0107]: method takes 0 generic arguments but 1 generic argument was suppli --> $DIR/issue-101421.rs:10:8 | LL | ().f::<()>(()); - | ^------ help: remove these generics + | ^------ help: remove the unnecessary generics | | | expected 0 generic arguments | diff --git a/tests/ui/suggestions/issue-104287.stderr b/tests/ui/suggestions/issue-104287.stderr index ed59b2e7a2d..d728e6c3d8c 100644 --- a/tests/ui/suggestions/issue-104287.stderr +++ b/tests/ui/suggestions/issue-104287.stderr @@ -2,7 +2,7 @@ error[E0107]: method takes 0 generic arguments but 1 generic argument was suppli --> $DIR/issue-104287.rs:10:5 | LL | foo::<()>(x); - | ^^^------ help: remove these generics + | ^^^------ help: remove the unnecessary generics | | | expected 0 generic arguments | diff --git a/tests/ui/suggestions/issue-104961.fixed b/tests/ui/suggestions/issue-104961.fixed index 5def21b506e..3019242880f 100644 --- a/tests/ui/suggestions/issue-104961.fixed +++ b/tests/ui/suggestions/issue-104961.fixed @@ -2,12 +2,12 @@ fn foo(x: &str) -> bool { x.starts_with(&("hi".to_string() + " you")) - //~^ ERROR the trait bound `String: Pattern<'_>` is not satisfied [E0277] + //~^ ERROR the trait bound `String: Pattern` is not satisfied [E0277] } fn foo2(x: &str) -> bool { x.starts_with(&"hi".to_string()) - //~^ ERROR the trait bound `String: Pattern<'_>` is not satisfied [E0277] + //~^ ERROR the trait bound `String: Pattern` is not satisfied [E0277] } fn main() { diff --git a/tests/ui/suggestions/issue-104961.rs b/tests/ui/suggestions/issue-104961.rs index a09b8a88711..b315e9bab0d 100644 --- a/tests/ui/suggestions/issue-104961.rs +++ b/tests/ui/suggestions/issue-104961.rs @@ -2,12 +2,12 @@ fn foo(x: &str) -> bool { x.starts_with("hi".to_string() + " you") - //~^ ERROR the trait bound `String: Pattern<'_>` is not satisfied [E0277] + //~^ ERROR the trait bound `String: Pattern` is not satisfied [E0277] } fn foo2(x: &str) -> bool { x.starts_with("hi".to_string()) - //~^ ERROR the trait bound `String: Pattern<'_>` is not satisfied [E0277] + //~^ ERROR the trait bound `String: Pattern` is not satisfied [E0277] } fn main() { diff --git a/tests/ui/suggestions/issue-104961.stderr b/tests/ui/suggestions/issue-104961.stderr index 3c5f86817f3..0d229e6dada 100644 --- a/tests/ui/suggestions/issue-104961.stderr +++ b/tests/ui/suggestions/issue-104961.stderr @@ -1,12 +1,12 @@ -error[E0277]: the trait bound `String: Pattern<'_>` is not satisfied +error[E0277]: the trait bound `String: Pattern` is not satisfied --> $DIR/issue-104961.rs:4:19 | LL | x.starts_with("hi".to_string() + " you") - | ----------- ^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Pattern<'_>` is not implemented for `String` + | ----------- ^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Pattern` is not implemented for `String` | | | required by a bound introduced by this call | - = note: required for `String` to implement `Pattern<'_>` + = note: required for `String` to implement `Pattern` note: required by a bound in `core::str::<impl str>::starts_with` --> $SRC_DIR/core/src/str/mod.rs:LL:COL help: consider borrowing here @@ -14,15 +14,15 @@ help: consider borrowing here LL | x.starts_with(&("hi".to_string() + " you")) | ++ + -error[E0277]: the trait bound `String: Pattern<'_>` is not satisfied +error[E0277]: the trait bound `String: Pattern` is not satisfied --> $DIR/issue-104961.rs:9:19 | LL | x.starts_with("hi".to_string()) - | ----------- ^^^^^^^^^^^^^^^^ the trait `Pattern<'_>` is not implemented for `String` + | ----------- ^^^^^^^^^^^^^^^^ the trait `Pattern` is not implemented for `String` | | | required by a bound introduced by this call | - = note: required for `String` to implement `Pattern<'_>` + = note: required for `String` to implement `Pattern` note: required by a bound in `core::str::<impl str>::starts_with` --> $SRC_DIR/core/src/str/mod.rs:LL:COL help: consider borrowing here diff --git a/tests/ui/suggestions/issue-62843.stderr b/tests/ui/suggestions/issue-62843.stderr index 84ab4a0edd3..c3c0360b3a9 100644 --- a/tests/ui/suggestions/issue-62843.stderr +++ b/tests/ui/suggestions/issue-62843.stderr @@ -1,12 +1,12 @@ -error[E0277]: the trait bound `String: Pattern<'_>` is not satisfied +error[E0277]: the trait bound `String: Pattern` is not satisfied --> $DIR/issue-62843.rs:4:32 | LL | println!("{:?}", line.find(pattern)); - | ---- ^^^^^^^ the trait `Pattern<'_>` is not implemented for `String` + | ---- ^^^^^^^ the trait `Pattern` is not implemented for `String` | | | required by a bound introduced by this call | - = note: required for `String` to implement `Pattern<'_>` + = note: required for `String` to implement `Pattern` note: required by a bound in `core::str::<impl str>::find` --> $SRC_DIR/core/src/str/mod.rs:LL:COL help: consider borrowing here diff --git a/tests/ui/suggestions/issue-89064.rs b/tests/ui/suggestions/issue-89064.rs index fa5fc899dc0..014d15a87f1 100644 --- a/tests/ui/suggestions/issue-89064.rs +++ b/tests/ui/suggestions/issue-89064.rs @@ -16,20 +16,20 @@ impl<T, U> B<T, U> for S {} fn main() { let _ = A::foo::<S>(); //~^ ERROR - //~| HELP remove these generics + //~| HELP remove the unnecessary generics //~| HELP consider moving this generic argument let _ = B::bar::<S, S>(); //~^ ERROR - //~| HELP remove these generics + //~| HELP remove the unnecessary generics //~| HELP consider moving these generic arguments let _ = A::<S>::foo::<S>(); //~^ ERROR - //~| HELP remove these generics + //~| HELP remove the unnecessary generics let _ = 42.into::<Option<_>>(); //~^ ERROR - //~| HELP remove these generics + //~| HELP remove the unnecessary generics //~| HELP consider moving this generic argument } diff --git a/tests/ui/suggestions/issue-89064.stderr b/tests/ui/suggestions/issue-89064.stderr index be09dd89512..837fef60d1e 100644 --- a/tests/ui/suggestions/issue-89064.stderr +++ b/tests/ui/suggestions/issue-89064.stderr @@ -14,7 +14,7 @@ help: consider moving this generic argument to the `A` trait, which takes up to LL - let _ = A::foo::<S>(); LL + let _ = A::<S>::foo(); | -help: remove these generics +help: remove the unnecessary generics | LL - let _ = A::foo::<S>(); LL + let _ = A::foo(); @@ -36,7 +36,7 @@ help: consider moving these generic arguments to the `B` trait, which takes up t LL - let _ = B::bar::<S, S>(); LL + let _ = B::<S, S>::bar(); | -help: remove these generics +help: remove the unnecessary generics | LL - let _ = B::bar::<S, S>(); LL + let _ = B::bar(); @@ -46,7 +46,7 @@ error[E0107]: associated function takes 0 generic arguments but 1 generic argume --> $DIR/issue-89064.rs:27:21 | LL | let _ = A::<S>::foo::<S>(); - | ^^^----- help: remove these generics + | ^^^----- help: remove the unnecessary generics | | | expected 0 generic arguments | @@ -66,7 +66,7 @@ help: consider moving this generic argument to the `Into` trait, which takes up | LL | let _ = Into::<Option<_>>::into(42); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -help: remove these generics +help: remove the unnecessary generics | LL - let _ = 42.into::<Option<_>>(); LL + let _ = 42.into(); diff --git a/tests/ui/suggestions/move-generic-to-trait-in-method-with-params.rs b/tests/ui/suggestions/move-generic-to-trait-in-method-with-params.rs index 4066cd3b11a..a719ddc4b16 100644 --- a/tests/ui/suggestions/move-generic-to-trait-in-method-with-params.rs +++ b/tests/ui/suggestions/move-generic-to-trait-in-method-with-params.rs @@ -14,5 +14,5 @@ fn main() { 1.bar::<i32>(0); //~^ ERROR method takes 0 generic arguments but 1 generic argument was supplied //~| HELP consider moving this generic argument to the `Foo` trait, which takes up to 1 argument - //~| HELP remove these generics + //~| HELP remove the unnecessary generics } diff --git a/tests/ui/suggestions/move-generic-to-trait-in-method-with-params.stderr b/tests/ui/suggestions/move-generic-to-trait-in-method-with-params.stderr index aa11bc7cf1d..cc735ef4c5e 100644 --- a/tests/ui/suggestions/move-generic-to-trait-in-method-with-params.stderr +++ b/tests/ui/suggestions/move-generic-to-trait-in-method-with-params.stderr @@ -13,7 +13,7 @@ help: consider moving this generic argument to the `Foo` trait, which takes up t | LL | Foo::<i32>::bar(1, 0); | ~~~~~~~~~~~~~~~~~~~~~ -help: remove these generics +help: remove the unnecessary generics | LL - 1.bar::<i32>(0); LL + 1.bar(0); diff --git a/tests/ui/trait-bounds/bad-suggestionf-for-repeated-unsized-bound-127441.rs b/tests/ui/trait-bounds/bad-suggestionf-for-repeated-unsized-bound-127441.rs new file mode 100644 index 00000000000..e6d7f74880f --- /dev/null +++ b/tests/ui/trait-bounds/bad-suggestionf-for-repeated-unsized-bound-127441.rs @@ -0,0 +1,39 @@ +// Regression test for #127441 + +// Tests that we make the correct suggestion +// in case there are more than one `?Sized` +// bounds on a function parameter + +use std::fmt::Debug; + +fn foo1<T: ?Sized>(a: T) {} +//~^ ERROR he size for values of type `T` cannot be known at compilation time + +fn foo2<T: ?Sized + ?Sized>(a: T) {} +//~^ ERROR type parameter has more than one relaxed default bound, only one is supported +//~| ERROR the size for values of type `T` cannot be known at compilation time + +fn foo3<T: ?Sized + ?Sized + Debug>(a: T) {} +//~^ ERROR type parameter has more than one relaxed default bound, only one is supported +//~| ERROR he size for values of type `T` cannot be known at compilation time + +fn foo4<T: ?Sized + Debug + ?Sized >(a: T) {} +//~^ ERROR type parameter has more than one relaxed default bound, only one is supported +//~| ERROR the size for values of type `T` cannot be known at compilation time + +fn foo5(_: impl ?Sized) {} +//~^ ERROR the size for values of type `impl ?Sized` cannot be known at compilation time + +fn foo6(_: impl ?Sized + ?Sized) {} +//~^ ERROR type parameter has more than one relaxed default bound, only one is supported +//~| ERROR the size for values of type `impl ?Sized + ?Sized` cannot be known at compilation tim + +fn foo7(_: impl ?Sized + ?Sized + Debug) {} +//~^ ERROR type parameter has more than one relaxed default bound, only one is supported +//~| ERROR the size for values of type `impl ?Sized + ?Sized + Debug` cannot be known at compilation time + +fn foo8(_: impl ?Sized + Debug + ?Sized ) {} +//~^ ERROR type parameter has more than one relaxed default bound, only one is supported +//~| ERROR the size for values of type `impl ?Sized + Debug + ?Sized` cannot be known at compilation time + +fn main() {} diff --git a/tests/ui/trait-bounds/bad-suggestionf-for-repeated-unsized-bound-127441.stderr b/tests/ui/trait-bounds/bad-suggestionf-for-repeated-unsized-bound-127441.stderr new file mode 100644 index 00000000000..3e8f45ee9fc --- /dev/null +++ b/tests/ui/trait-bounds/bad-suggestionf-for-repeated-unsized-bound-127441.stderr @@ -0,0 +1,192 @@ +error[E0203]: type parameter has more than one relaxed default bound, only one is supported + --> $DIR/bad-suggestionf-for-repeated-unsized-bound-127441.rs:12:12 + | +LL | fn foo2<T: ?Sized + ?Sized>(a: T) {} + | ^^^^^^ ^^^^^^ + +error[E0203]: type parameter has more than one relaxed default bound, only one is supported + --> $DIR/bad-suggestionf-for-repeated-unsized-bound-127441.rs:16:12 + | +LL | fn foo3<T: ?Sized + ?Sized + Debug>(a: T) {} + | ^^^^^^ ^^^^^^ + +error[E0203]: type parameter has more than one relaxed default bound, only one is supported + --> $DIR/bad-suggestionf-for-repeated-unsized-bound-127441.rs:20:12 + | +LL | fn foo4<T: ?Sized + Debug + ?Sized >(a: T) {} + | ^^^^^^ ^^^^^^ + +error[E0203]: type parameter has more than one relaxed default bound, only one is supported + --> $DIR/bad-suggestionf-for-repeated-unsized-bound-127441.rs:27:17 + | +LL | fn foo6(_: impl ?Sized + ?Sized) {} + | ^^^^^^ ^^^^^^ + +error[E0203]: type parameter has more than one relaxed default bound, only one is supported + --> $DIR/bad-suggestionf-for-repeated-unsized-bound-127441.rs:31:17 + | +LL | fn foo7(_: impl ?Sized + ?Sized + Debug) {} + | ^^^^^^ ^^^^^^ + +error[E0203]: type parameter has more than one relaxed default bound, only one is supported + --> $DIR/bad-suggestionf-for-repeated-unsized-bound-127441.rs:35:17 + | +LL | fn foo8(_: impl ?Sized + Debug + ?Sized ) {} + | ^^^^^^ ^^^^^^ + +error[E0277]: the size for values of type `T` cannot be known at compilation time + --> $DIR/bad-suggestionf-for-repeated-unsized-bound-127441.rs:9:20 + | +LL | fn foo1<T: ?Sized>(a: T) {} + | - ^ doesn't have a size known at compile-time + | | + | this type parameter needs to be `Sized` + | + = help: unsized fn params are gated as an unstable feature +help: consider removing the `?Sized` bound to make the type parameter `Sized` + | +LL - fn foo1<T: ?Sized>(a: T) {} +LL + fn foo1<T>(a: T) {} + | +help: function arguments must have a statically known size, borrowed types always have a known size + | +LL | fn foo1<T: ?Sized>(a: &T) {} + | + + +error[E0277]: the size for values of type `T` cannot be known at compilation time + --> $DIR/bad-suggestionf-for-repeated-unsized-bound-127441.rs:12:29 + | +LL | fn foo2<T: ?Sized + ?Sized>(a: T) {} + | - ^ doesn't have a size known at compile-time + | | + | this type parameter needs to be `Sized` + | + = help: unsized fn params are gated as an unstable feature +help: consider removing the `?Sized` bound to make the type parameter `Sized` + | +LL - fn foo2<T: ?Sized + ?Sized>(a: T) {} +LL + fn foo2<T>(a: T) {} + | +help: function arguments must have a statically known size, borrowed types always have a known size + | +LL | fn foo2<T: ?Sized + ?Sized>(a: &T) {} + | + + +error[E0277]: the size for values of type `T` cannot be known at compilation time + --> $DIR/bad-suggestionf-for-repeated-unsized-bound-127441.rs:16:37 + | +LL | fn foo3<T: ?Sized + ?Sized + Debug>(a: T) {} + | - ^ doesn't have a size known at compile-time + | | + | this type parameter needs to be `Sized` + | + = help: unsized fn params are gated as an unstable feature +help: consider restricting type parameters + | +LL - fn foo3<T: ?Sized + ?Sized + Debug>(a: T) {} +LL + fn foo3<T: Debug>(a: T) {} + | +help: function arguments must have a statically known size, borrowed types always have a known size + | +LL | fn foo3<T: ?Sized + ?Sized + Debug>(a: &T) {} + | + + +error[E0277]: the size for values of type `T` cannot be known at compilation time + --> $DIR/bad-suggestionf-for-repeated-unsized-bound-127441.rs:20:38 + | +LL | fn foo4<T: ?Sized + Debug + ?Sized >(a: T) {} + | - ^ doesn't have a size known at compile-time + | | + | this type parameter needs to be `Sized` + | + = help: unsized fn params are gated as an unstable feature +help: consider restricting type parameters + | +LL - fn foo4<T: ?Sized + Debug + ?Sized >(a: T) {} +LL + fn foo4<T: Debug >(a: T) {} + | +help: function arguments must have a statically known size, borrowed types always have a known size + | +LL | fn foo4<T: ?Sized + Debug + ?Sized >(a: &T) {} + | + + +error[E0277]: the size for values of type `impl ?Sized` cannot be known at compilation time + --> $DIR/bad-suggestionf-for-repeated-unsized-bound-127441.rs:24:9 + | +LL | fn foo5(_: impl ?Sized) {} + | ^ ----------- this type parameter needs to be `Sized` + | | + | doesn't have a size known at compile-time + | + = help: unsized fn params are gated as an unstable feature +help: consider replacing `?Sized` with `Sized` + | +LL - fn foo5(_: impl ?Sized) {} +LL + fn foo5(_: impl Sized) {} + | +help: function arguments must have a statically known size, borrowed types always have a known size + | +LL | fn foo5(_: &impl ?Sized) {} + | + + +error[E0277]: the size for values of type `impl ?Sized + ?Sized` cannot be known at compilation time + --> $DIR/bad-suggestionf-for-repeated-unsized-bound-127441.rs:27:9 + | +LL | fn foo6(_: impl ?Sized + ?Sized) {} + | ^ -------------------- this type parameter needs to be `Sized` + | | + | doesn't have a size known at compile-time + | + = help: unsized fn params are gated as an unstable feature +help: consider restricting type parameters + | +LL - fn foo6(_: impl ?Sized + ?Sized) {} +LL + fn foo6(_: impl Sized) {} + | +help: function arguments must have a statically known size, borrowed types always have a known size + | +LL | fn foo6(_: &impl ?Sized + ?Sized) {} + | + + +error[E0277]: the size for values of type `impl ?Sized + ?Sized + Debug` cannot be known at compilation time + --> $DIR/bad-suggestionf-for-repeated-unsized-bound-127441.rs:31:9 + | +LL | fn foo7(_: impl ?Sized + ?Sized + Debug) {} + | ^ ---------------------------- this type parameter needs to be `Sized` + | | + | doesn't have a size known at compile-time + | + = help: unsized fn params are gated as an unstable feature +help: consider restricting type parameters + | +LL - fn foo7(_: impl ?Sized + ?Sized + Debug) {} +LL + fn foo7(_: impl Debug) {} + | +help: function arguments must have a statically known size, borrowed types always have a known size + | +LL | fn foo7(_: &impl ?Sized + ?Sized + Debug) {} + | + + +error[E0277]: the size for values of type `impl ?Sized + Debug + ?Sized` cannot be known at compilation time + --> $DIR/bad-suggestionf-for-repeated-unsized-bound-127441.rs:35:9 + | +LL | fn foo8(_: impl ?Sized + Debug + ?Sized ) {} + | ^ ---------------------------- this type parameter needs to be `Sized` + | | + | doesn't have a size known at compile-time + | + = help: unsized fn params are gated as an unstable feature +help: consider restricting type parameters + | +LL - fn foo8(_: impl ?Sized + Debug + ?Sized ) {} +LL + fn foo8(_: impl Debug ) {} + | +help: function arguments must have a statically known size, borrowed types always have a known size + | +LL | fn foo8(_: &impl ?Sized + Debug + ?Sized ) {} + | + + +error: aborting due to 14 previous errors + +Some errors have detailed explanations: E0203, E0277. +For more information about an error, try `rustc --explain E0203`. diff --git a/tests/ui/traits/associated_type_bound/116464-invalid-assoc-type-suggestion-in-trait-impl.stderr b/tests/ui/traits/associated_type_bound/116464-invalid-assoc-type-suggestion-in-trait-impl.stderr index 06e2fa5d4d1..a22d88b7c59 100644 --- a/tests/ui/traits/associated_type_bound/116464-invalid-assoc-type-suggestion-in-trait-impl.stderr +++ b/tests/ui/traits/associated_type_bound/116464-invalid-assoc-type-suggestion-in-trait-impl.stderr @@ -117,7 +117,7 @@ error[E0107]: struct takes 1 generic argument but 2 generic arguments were suppl --> $DIR/116464-invalid-assoc-type-suggestion-in-trait-impl.rs:40:58 | LL | impl<T: Trait<u32, Assoc=String>, U> YetAnotherTrait for Struct<T, U> {} - | ^^^^^^ - help: remove this generic argument + | ^^^^^^ --- help: remove the unnecessary generic argument | | | expected 1 generic argument | diff --git a/tests/ui/traits/bound/assoc-fn-bound-root-obligation.rs b/tests/ui/traits/bound/assoc-fn-bound-root-obligation.rs index 98825bd536e..dc2de5bb715 100644 --- a/tests/ui/traits/bound/assoc-fn-bound-root-obligation.rs +++ b/tests/ui/traits/bound/assoc-fn-bound-root-obligation.rs @@ -1,11 +1,11 @@ fn strip_lf(s: &str) -> &str { s.strip_suffix(b'\n').unwrap_or(s) - //~^ ERROR expected a `FnMut(char)` closure, found `u8` - //~| NOTE expected an `FnMut(char)` closure, found `u8` - //~| HELP the trait `FnMut(char)` is not implemented for `u8` - //~| HELP the following other types implement trait `Pattern<'a>`: - //~| NOTE required for `u8` to implement `Pattern<'_>` - + //~^ ERROR the trait bound `u8: Pattern` is not satisfied + //~| NOTE required by a bound introduced by this call + //~| NOTE the trait `FnMut(char)` is not implemented for `u8`, which is required by `u8: Pattern` + //~| HELP the following other types implement trait `Pattern`: + //~| NOTE required for `u8` to implement `Pattern` + //~| NOTE required by a bound in `core::str::<impl str>::strip_suffix` } fn main() {} diff --git a/tests/ui/traits/bound/assoc-fn-bound-root-obligation.stderr b/tests/ui/traits/bound/assoc-fn-bound-root-obligation.stderr index 49272e7d357..8351d15fdf3 100644 --- a/tests/ui/traits/bound/assoc-fn-bound-root-obligation.stderr +++ b/tests/ui/traits/bound/assoc-fn-bound-root-obligation.stderr @@ -1,11 +1,12 @@ -error[E0277]: expected a `FnMut(char)` closure, found `u8` - --> $DIR/assoc-fn-bound-root-obligation.rs:2:7 +error[E0277]: the trait bound `u8: Pattern` is not satisfied + --> $DIR/assoc-fn-bound-root-obligation.rs:2:20 | LL | s.strip_suffix(b'\n').unwrap_or(s) - | ^^^^^^^^^^^^ expected an `FnMut(char)` closure, found `u8` + | ------------ ^^^^^ the trait `FnMut(char)` is not implemented for `u8`, which is required by `u8: Pattern` + | | + | required by a bound introduced by this call | - = help: the trait `FnMut(char)` is not implemented for `u8`, which is required by `u8: Pattern<'_>` - = help: the following other types implement trait `Pattern<'a>`: + = help: the following other types implement trait `Pattern`: &'b String &'b [char; N] &'b [char] @@ -13,7 +14,9 @@ LL | s.strip_suffix(b'\n').unwrap_or(s) &'c &'b str [char; N] char - = note: required for `u8` to implement `Pattern<'_>` + = note: required for `u8` to implement `Pattern` +note: required by a bound in `core::str::<impl str>::strip_suffix` + --> $SRC_DIR/core/src/str/mod.rs:LL:COL error: aborting due to 1 previous error diff --git a/tests/ui/traits/object/vs-lifetime.stderr b/tests/ui/traits/object/vs-lifetime.stderr index a69cd140807..916197ff096 100644 --- a/tests/ui/traits/object/vs-lifetime.stderr +++ b/tests/ui/traits/object/vs-lifetime.stderr @@ -8,7 +8,7 @@ error[E0107]: struct takes 1 lifetime argument but 2 lifetime arguments were sup --> $DIR/vs-lifetime.rs:11:12 | LL | let _: S<'static, 'static>; - | ^ ------- help: remove this lifetime argument + | ^ --------- help: remove the lifetime argument | | | expected 1 lifetime argument | diff --git a/tests/ui/traits/suggest-dereferences/root-obligation.fixed b/tests/ui/traits/suggest-dereferences/root-obligation.fixed index 072296c6b15..ad0f184dc9a 100644 --- a/tests/ui/traits/suggest-dereferences/root-obligation.fixed +++ b/tests/ui/traits/suggest-dereferences/root-obligation.fixed @@ -4,7 +4,7 @@ fn get_vowel_count(string: &str) -> usize { string .chars() .filter(|c| "aeiou".contains(*c)) - //~^ ERROR the trait bound `&char: Pattern<'_>` is not satisfied + //~^ ERROR the trait bound `&char: Pattern` is not satisfied .count() } diff --git a/tests/ui/traits/suggest-dereferences/root-obligation.rs b/tests/ui/traits/suggest-dereferences/root-obligation.rs index e7025fe0825..a31a9955d31 100644 --- a/tests/ui/traits/suggest-dereferences/root-obligation.rs +++ b/tests/ui/traits/suggest-dereferences/root-obligation.rs @@ -4,7 +4,7 @@ fn get_vowel_count(string: &str) -> usize { string .chars() .filter(|c| "aeiou".contains(c)) - //~^ ERROR the trait bound `&char: Pattern<'_>` is not satisfied + //~^ ERROR the trait bound `&char: Pattern` is not satisfied .count() } diff --git a/tests/ui/traits/suggest-dereferences/root-obligation.stderr b/tests/ui/traits/suggest-dereferences/root-obligation.stderr index bbfbb98fba7..2f5e1c5b537 100644 --- a/tests/ui/traits/suggest-dereferences/root-obligation.stderr +++ b/tests/ui/traits/suggest-dereferences/root-obligation.stderr @@ -1,13 +1,13 @@ -error[E0277]: the trait bound `&char: Pattern<'_>` is not satisfied +error[E0277]: the trait bound `&char: Pattern` is not satisfied --> $DIR/root-obligation.rs:6:38 | LL | .filter(|c| "aeiou".contains(c)) - | -------- ^ the trait `Fn(char)` is not implemented for `char`, which is required by `&char: Pattern<'_>` + | -------- ^ the trait `Fn(char)` is not implemented for `char`, which is required by `&char: Pattern` | | | required by a bound introduced by this call | = note: required for `&char` to implement `FnOnce(char)` - = note: required for `&char` to implement `Pattern<'_>` + = note: required for `&char` to implement `Pattern` note: required by a bound in `core::str::<impl str>::contains` --> $SRC_DIR/core/src/str/mod.rs:LL:COL help: consider dereferencing here diff --git a/tests/ui/traits/test-2.stderr b/tests/ui/traits/test-2.stderr index 3972e539776..0ee64cc0952 100644 --- a/tests/ui/traits/test-2.stderr +++ b/tests/ui/traits/test-2.stderr @@ -2,7 +2,7 @@ error[E0107]: method takes 0 generic arguments but 1 generic argument was suppli --> $DIR/test-2.rs:9:8 | LL | 10.dup::<i32>(); - | ^^^------- help: remove these generics + | ^^^------- help: remove the unnecessary generics | | | expected 0 generic arguments | @@ -16,7 +16,7 @@ error[E0107]: method takes 1 generic argument but 2 generic arguments were suppl --> $DIR/test-2.rs:11:8 | LL | 10.blah::<i32, i32>(); - | ^^^^ --- help: remove this generic argument + | ^^^^ ----- help: remove the unnecessary generic argument | | | expected 1 generic argument | diff --git a/tests/ui/transmutability/issue-101739-2.stderr b/tests/ui/transmutability/issue-101739-2.stderr index 519a374dc22..6b0a36a414b 100644 --- a/tests/ui/transmutability/issue-101739-2.stderr +++ b/tests/ui/transmutability/issue-101739-2.stderr @@ -3,11 +3,13 @@ error[E0107]: trait takes at most 2 generic arguments but 5 generic arguments we | LL | Dst: BikeshedIntrinsicFrom< | ^^^^^^^^^^^^^^^^^^^^^ expected at most 2 generic arguments -... -LL | / ASSUME_LIFETIMES, +LL | Src, +LL | ASSUME_ALIGNMENT, + | _____________________________- +LL | | ASSUME_LIFETIMES, LL | | ASSUME_VALIDITY, LL | | ASSUME_VISIBILITY, - | |_____________________________- help: remove these generic arguments + | |_____________________________- help: remove the unnecessary generic arguments error: aborting due to 1 previous error diff --git a/tests/ui/type-alias-enum-variants/enum-variant-generic-args.stderr b/tests/ui/type-alias-enum-variants/enum-variant-generic-args.stderr index 96a5c132763..482a314db60 100644 --- a/tests/ui/type-alias-enum-variants/enum-variant-generic-args.stderr +++ b/tests/ui/type-alias-enum-variants/enum-variant-generic-args.stderr @@ -308,7 +308,7 @@ error[E0107]: type alias takes 0 generic arguments but 1 generic argument was su --> $DIR/enum-variant-generic-args.rs:64:5 | LL | AliasFixed::<()>::TSVariant(()); - | ^^^^^^^^^^------ help: remove these generics + | ^^^^^^^^^^------ help: remove the unnecessary generics | | | expected 0 generic arguments | @@ -322,7 +322,7 @@ error[E0107]: type alias takes 0 generic arguments but 1 generic argument was su --> $DIR/enum-variant-generic-args.rs:66:5 | LL | AliasFixed::<()>::TSVariant::<()>(()); - | ^^^^^^^^^^------ help: remove these generics + | ^^^^^^^^^^------ help: remove the unnecessary generics | | | expected 0 generic arguments | @@ -399,7 +399,7 @@ error[E0107]: type alias takes 0 generic arguments but 1 generic argument was su --> $DIR/enum-variant-generic-args.rs:82:5 | LL | AliasFixed::<()>::SVariant { v: () }; - | ^^^^^^^^^^------ help: remove these generics + | ^^^^^^^^^^------ help: remove the unnecessary generics | | | expected 0 generic arguments | @@ -413,7 +413,7 @@ error[E0107]: type alias takes 0 generic arguments but 1 generic argument was su --> $DIR/enum-variant-generic-args.rs:84:5 | LL | AliasFixed::<()>::SVariant::<()> { v: () }; - | ^^^^^^^^^^------ help: remove these generics + | ^^^^^^^^^^------ help: remove the unnecessary generics | | | expected 0 generic arguments | @@ -474,7 +474,7 @@ error[E0107]: type alias takes 0 generic arguments but 1 generic argument was su --> $DIR/enum-variant-generic-args.rs:100:5 | LL | AliasFixed::<()>::UVariant; - | ^^^^^^^^^^------ help: remove these generics + | ^^^^^^^^^^------ help: remove the unnecessary generics | | | expected 0 generic arguments | @@ -488,7 +488,7 @@ error[E0107]: type alias takes 0 generic arguments but 1 generic argument was su --> $DIR/enum-variant-generic-args.rs:102:5 | LL | AliasFixed::<()>::UVariant::<()>; - | ^^^^^^^^^^------ help: remove these generics + | ^^^^^^^^^^------ help: remove the unnecessary generics | | | expected 0 generic arguments | diff --git a/tests/ui/type-alias-impl-trait/in-where-clause.rs b/tests/ui/type-alias-impl-trait/in-where-clause.rs index 7c0de39c7c9..a089fdc9075 100644 --- a/tests/ui/type-alias-impl-trait/in-where-clause.rs +++ b/tests/ui/type-alias-impl-trait/in-where-clause.rs @@ -4,13 +4,13 @@ #![feature(type_alias_impl_trait)] type Bar = impl Sized; //~^ ERROR: cycle -//~| ERROR: cycle fn foo() -> Bar where Bar: Send, { [0; 1 + 2] + //~^ ERROR: type annotations needed: cannot satisfy `Bar: Send` } fn main() {} diff --git a/tests/ui/type-alias-impl-trait/in-where-clause.stderr b/tests/ui/type-alias-impl-trait/in-where-clause.stderr index 9c08b8f127d..f1361b47c56 100644 --- a/tests/ui/type-alias-impl-trait/in-where-clause.stderr +++ b/tests/ui/type-alias-impl-trait/in-where-clause.stderr @@ -10,7 +10,7 @@ note: ...which requires computing type of opaque `Bar::{opaque#0}`... LL | type Bar = impl Sized; | ^^^^^^^^^^ note: ...which requires type-checking `foo`... - --> $DIR/in-where-clause.rs:9:1 + --> $DIR/in-where-clause.rs:8:1 | LL | / fn foo() -> Bar LL | | where @@ -25,26 +25,23 @@ LL | type Bar = impl Sized; | ^^^^^^^^^^ = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information -error[E0391]: cycle detected when computing type of opaque `Bar::{opaque#0}` - --> $DIR/in-where-clause.rs:5:12 - | -LL | type Bar = impl Sized; - | ^^^^^^^^^^ - | -note: ...which requires type-checking `foo`... - --> $DIR/in-where-clause.rs:13:9 +error[E0283]: type annotations needed: cannot satisfy `Bar: Send` + --> $DIR/in-where-clause.rs:12:9 | LL | [0; 1 + 2] | ^^^^^ - = note: ...which requires evaluating trait selection obligation `Bar: core::marker::Send`... - = note: ...which again requires computing type of opaque `Bar::{opaque#0}`, completing the cycle -note: cycle used when computing type of `Bar::{opaque#0}` - --> $DIR/in-where-clause.rs:5:12 | -LL | type Bar = impl Sized; - | ^^^^^^^^^^ - = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information + = note: cannot satisfy `Bar: Send` +note: required by a bound in `foo` + --> $DIR/in-where-clause.rs:10:10 + | +LL | fn foo() -> Bar + | --- required by a bound in this function +LL | where +LL | Bar: Send, + | ^^^^ required by this bound in `foo` error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0391`. +Some errors have detailed explanations: E0283, E0391. +For more information about an error, try `rustc --explain E0283`. diff --git a/tests/ui/type-alias-impl-trait/reveal_local.rs b/tests/ui/type-alias-impl-trait/reveal_local.rs index 07fd989b0fa..34f3788e234 100644 --- a/tests/ui/type-alias-impl-trait/reveal_local.rs +++ b/tests/ui/type-alias-impl-trait/reveal_local.rs @@ -20,7 +20,7 @@ fn not_gooder() -> Foo { // while we could know this from the hidden type, it would // need extra roundabout logic to support it. is_send::<Foo>(); - //~^ ERROR: cannot check whether the hidden type of `reveal_local[9507]::Foo::{opaque#0}` satisfies auto traits + //~^ ERROR: type annotations needed: cannot satisfy `Foo: Send` x } diff --git a/tests/ui/type-alias-impl-trait/reveal_local.stderr b/tests/ui/type-alias-impl-trait/reveal_local.stderr index e1b320cc38e..9829c58cf73 100644 --- a/tests/ui/type-alias-impl-trait/reveal_local.stderr +++ b/tests/ui/type-alias-impl-trait/reveal_local.stderr @@ -16,18 +16,13 @@ note: required by a bound in `is_send` LL | fn is_send<T: Send>() {} | ^^^^ required by this bound in `is_send` -error: cannot check whether the hidden type of `reveal_local[9507]::Foo::{opaque#0}` satisfies auto traits +error[E0283]: type annotations needed: cannot satisfy `Foo: Send` --> $DIR/reveal_local.rs:22:15 | LL | is_send::<Foo>(); | ^^^ | - = note: fetching the hidden types of an opaque inside of the defining scope is not supported. You can try moving the opaque type and the item that actually registers a hidden type into a new submodule -note: opaque type is declared here - --> $DIR/reveal_local.rs:5:12 - | -LL | type Foo = impl Debug; - | ^^^^^^^^^^ + = note: cannot satisfy `Foo: Send` note: required by a bound in `is_send` --> $DIR/reveal_local.rs:7:15 | @@ -36,3 +31,4 @@ LL | fn is_send<T: Send>() {} error: aborting due to 2 previous errors +For more information about this error, try `rustc --explain E0283`. diff --git a/tests/ui/typeck/typeck-builtin-bound-type-parameters.stderr b/tests/ui/typeck/typeck-builtin-bound-type-parameters.stderr index 9a9b2a68dbe..4235a14cdc0 100644 --- a/tests/ui/typeck/typeck-builtin-bound-type-parameters.stderr +++ b/tests/ui/typeck/typeck-builtin-bound-type-parameters.stderr @@ -2,7 +2,7 @@ error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplie --> $DIR/typeck-builtin-bound-type-parameters.rs:1:11 | LL | fn foo1<T:Copy<U>, U>(x: T) {} - | ^^^^--- help: remove these generics + | ^^^^--- help: remove the unnecessary generics | | | expected 0 generic arguments @@ -10,7 +10,7 @@ error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplie --> $DIR/typeck-builtin-bound-type-parameters.rs:4:14 | LL | trait Trait: Copy<dyn Send> {} - | ^^^^---------- help: remove these generics + | ^^^^---------- help: remove the unnecessary generics | | | expected 0 generic arguments @@ -18,7 +18,7 @@ error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplie --> $DIR/typeck-builtin-bound-type-parameters.rs:4:14 | LL | trait Trait: Copy<dyn Send> {} - | ^^^^---------- help: remove these generics + | ^^^^---------- help: remove the unnecessary generics | | | expected 0 generic arguments | @@ -28,7 +28,7 @@ error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplie --> $DIR/typeck-builtin-bound-type-parameters.rs:4:14 | LL | trait Trait: Copy<dyn Send> {} - | ^^^^---------- help: remove these generics + | ^^^^---------- help: remove the unnecessary generics | | | expected 0 generic arguments | @@ -38,7 +38,7 @@ error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplie --> $DIR/typeck-builtin-bound-type-parameters.rs:9:21 | LL | struct MyStruct1<T: Copy<T>>(T); - | ^^^^--- help: remove these generics + | ^^^^--- help: remove the unnecessary generics | | | expected 0 generic arguments @@ -46,7 +46,7 @@ error[E0107]: trait takes 0 lifetime arguments but 1 lifetime argument was suppl --> $DIR/typeck-builtin-bound-type-parameters.rs:12:25 | LL | struct MyStruct2<'a, T: Copy<'a>>(&'a T); - | ^^^^---- help: remove these generics + | ^^^^---- help: remove the unnecessary generics | | | expected 0 lifetime arguments @@ -54,7 +54,7 @@ error[E0107]: trait takes 0 lifetime arguments but 1 lifetime argument was suppl --> $DIR/typeck-builtin-bound-type-parameters.rs:15:15 | LL | fn foo2<'a, T:Copy<'a, U>, U>(x: T) {} - | ^^^^ -- help: remove this lifetime argument + | ^^^^ -- help: remove the lifetime argument | | | expected 0 lifetime arguments @@ -62,7 +62,7 @@ error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplie --> $DIR/typeck-builtin-bound-type-parameters.rs:15:15 | LL | fn foo2<'a, T:Copy<'a, U>, U>(x: T) {} - | ^^^^ - help: remove this generic argument + | ^^^^ - help: remove the unnecessary generic argument | | | expected 0 generic arguments diff --git a/tests/ui/typeck/typeck_type_placeholder_lifetime_1.stderr b/tests/ui/typeck/typeck_type_placeholder_lifetime_1.stderr index e4b1c02c201..bb1b6e4fc73 100644 --- a/tests/ui/typeck/typeck_type_placeholder_lifetime_1.stderr +++ b/tests/ui/typeck/typeck_type_placeholder_lifetime_1.stderr @@ -2,7 +2,7 @@ error[E0107]: struct takes 1 generic argument but 2 generic arguments were suppl --> $DIR/typeck_type_placeholder_lifetime_1.rs:9:12 | LL | let c: Foo<_, _> = Foo { r: &5 }; - | ^^^ - help: remove this generic argument + | ^^^ --- help: remove the unnecessary generic argument | | | expected 1 generic argument | diff --git a/tests/ui/typeck/typeck_type_placeholder_lifetime_2.stderr b/tests/ui/typeck/typeck_type_placeholder_lifetime_2.stderr index fcb5ecc4042..6b8f1e98d2c 100644 --- a/tests/ui/typeck/typeck_type_placeholder_lifetime_2.stderr +++ b/tests/ui/typeck/typeck_type_placeholder_lifetime_2.stderr @@ -2,7 +2,7 @@ error[E0107]: struct takes 1 generic argument but 2 generic arguments were suppl --> $DIR/typeck_type_placeholder_lifetime_2.rs:9:12 | LL | let c: Foo<_, usize> = Foo { r: &5 }; - | ^^^ ----- help: remove this generic argument + | ^^^ ------- help: remove the unnecessary generic argument | | | expected 1 generic argument | diff --git a/tests/ui/ufcs/ufcs-qpath-missing-params.stderr b/tests/ui/ufcs/ufcs-qpath-missing-params.stderr index 2338871218b..048cf96bcc8 100644 --- a/tests/ui/ufcs/ufcs-qpath-missing-params.stderr +++ b/tests/ui/ufcs/ufcs-qpath-missing-params.stderr @@ -34,7 +34,7 @@ error[E0107]: method takes 0 generic arguments but 1 generic argument was suppli --> $DIR/ufcs-qpath-missing-params.rs:17:26 | LL | <String as IntoCow>::into_cow::<str>("foo".to_string()); - | ^^^^^^^^------- help: remove these generics + | ^^^^^^^^------- help: remove the unnecessary generics | | | expected 0 generic arguments | diff --git a/tests/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters.stderr b/tests/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters.stderr index 5a2de132d70..a4e7232c8b3 100644 --- a/tests/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters.stderr +++ b/tests/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters.stderr @@ -2,7 +2,7 @@ error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplie --> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters.rs:5:17 | LL | fn foo1(_: &dyn Zero()) { - | ^^^^-- help: remove these parenthetical generics + | ^^^^-- help: remove the unnecessary parenthetical generics | | | expected 0 generic arguments | @@ -22,7 +22,7 @@ error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplie --> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters.rs:10:17 | LL | fn foo2(_: &dyn Zero<usize>) { - | ^^^^------- help: remove these generics + | ^^^^------- help: remove the unnecessary generics | | | expected 0 generic arguments | @@ -36,7 +36,7 @@ error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplie --> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters.rs:14:17 | LL | fn foo3(_: &dyn Zero < usize >) { - | ^^^^-------------- help: remove these generics + | ^^^^-------------- help: remove the unnecessary generics | | | expected 0 generic arguments | @@ -50,7 +50,7 @@ error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplie --> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters.rs:18:17 | LL | fn foo4(_: &dyn Zero(usize)) { - | ^^^^------- help: remove these parenthetical generics + | ^^^^------- help: remove the unnecessary parenthetical generics | | | expected 0 generic arguments | @@ -70,7 +70,7 @@ error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplie --> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters.rs:23:17 | LL | fn foo5(_: &dyn Zero ( usize )) { - | ^^^^-------------- help: remove these parenthetical generics + | ^^^^-------------- help: remove the unnecessary parenthetical generics | | | expected 0 generic arguments | diff --git a/tests/ui/unboxed-closures/unboxed-closure-sugar-wrong-trait.stderr b/tests/ui/unboxed-closures/unboxed-closure-sugar-wrong-trait.stderr index 130b193d69c..f5ef58fc91e 100644 --- a/tests/ui/unboxed-closures/unboxed-closure-sugar-wrong-trait.stderr +++ b/tests/ui/unboxed-closures/unboxed-closure-sugar-wrong-trait.stderr @@ -2,7 +2,7 @@ error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplie --> $DIR/unboxed-closure-sugar-wrong-trait.rs:5:8 | LL | fn f<F:Trait(isize) -> isize>(x: F) {} - | ^^^^^------- help: remove these parenthetical generics + | ^^^^^------- help: remove the unnecessary parenthetical generics | | | expected 0 generic arguments | |
