diff --git a/src/test/ui/consts/min_const_fn/min_const_fn.rs b/src/test/ui/consts/min_const_fn/min_const_fn.rs index c3436d4840ac..557439f39495 100644 --- a/src/test/ui/consts/min_const_fn/min_const_fn.rs +++ b/src/test/ui/consts/min_const_fn/min_const_fn.rs @@ -123,12 +123,9 @@ impl Foo { } struct AlanTuring(T); -const fn no_rpit2() -> AlanTuring { AlanTuring(0) } -//~^ ERROR `impl Trait` in const fn is unstable const fn no_apit2(_x: AlanTuring) {} //~^ ERROR trait bounds other than `Sized` const fn no_apit(_x: impl std::fmt::Debug) {} //~ ERROR trait bounds other than `Sized` -const fn no_rpit() -> impl std::fmt::Debug {} //~ ERROR `impl Trait` in const fn is unstable const fn no_dyn_trait(_x: &dyn std::fmt::Debug) {} //~ ERROR trait bounds other than `Sized` const fn no_dyn_trait_ret() -> &'static dyn std::fmt::Debug { &() } //~^ ERROR trait bounds other than `Sized` diff --git a/src/test/ui/consts/min_const_fn/min_const_fn.stderr b/src/test/ui/consts/min_const_fn/min_const_fn.stderr index 927cdfae189d..512b343011b4 100644 --- a/src/test/ui/consts/min_const_fn/min_const_fn.stderr +++ b/src/test/ui/consts/min_const_fn/min_const_fn.stderr @@ -214,17 +214,8 @@ LL | impl Foo { = note: see issue #57563 for more information = help: add `#![feature(const_fn)]` to the crate attributes to enable -error[E0723]: `impl Trait` in const fn is unstable - --> $DIR/min_const_fn.rs:126:24 - | -LL | const fn no_rpit2() -> AlanTuring { AlanTuring(0) } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #57563 for more information - = help: add `#![feature(const_fn)]` to the crate attributes to enable - error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable - --> $DIR/min_const_fn.rs:128:34 + --> $DIR/min_const_fn.rs:126:34 | LL | const fn no_apit2(_x: AlanTuring) {} | ^^^^^^^^^^^^^^^^^^^^ @@ -233,7 +224,7 @@ LL | const fn no_apit2(_x: AlanTuring) {} = help: add `#![feature(const_fn)]` to the crate attributes to enable error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable - --> $DIR/min_const_fn.rs:130:22 + --> $DIR/min_const_fn.rs:128:22 | LL | const fn no_apit(_x: impl std::fmt::Debug) {} | ^^^^^^^^^^^^^^^^^^^^ @@ -241,17 +232,8 @@ LL | const fn no_apit(_x: impl std::fmt::Debug) {} = note: see issue #57563 for more information = help: add `#![feature(const_fn)]` to the crate attributes to enable -error[E0723]: `impl Trait` in const fn is unstable - --> $DIR/min_const_fn.rs:131:23 - | -LL | const fn no_rpit() -> impl std::fmt::Debug {} - | ^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #57563 for more information - = help: add `#![feature(const_fn)]` to the crate attributes to enable - error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable - --> $DIR/min_const_fn.rs:132:23 + --> $DIR/min_const_fn.rs:129:23 | LL | const fn no_dyn_trait(_x: &dyn std::fmt::Debug) {} | ^^ @@ -260,7 +242,7 @@ LL | const fn no_dyn_trait(_x: &dyn std::fmt::Debug) {} = help: add `#![feature(const_fn)]` to the crate attributes to enable error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable - --> $DIR/min_const_fn.rs:133:32 + --> $DIR/min_const_fn.rs:130:32 | LL | const fn no_dyn_trait_ret() -> &'static dyn std::fmt::Debug { &() } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -269,7 +251,7 @@ LL | const fn no_dyn_trait_ret() -> &'static dyn std::fmt::Debug { &() } = help: add `#![feature(const_fn)]` to the crate attributes to enable error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable - --> $DIR/min_const_fn.rs:138:41 + --> $DIR/min_const_fn.rs:135:41 | LL | const fn really_no_traits_i_mean_it() { (&() as &dyn std::fmt::Debug, ()).1 } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -278,7 +260,7 @@ LL | const fn really_no_traits_i_mean_it() { (&() as &dyn std::fmt::Debug, ()).1 = help: add `#![feature(const_fn)]` to the crate attributes to enable error[E0723]: function pointers in const fn are unstable - --> $DIR/min_const_fn.rs:141:21 + --> $DIR/min_const_fn.rs:138:21 | LL | const fn no_fn_ptrs(_x: fn()) {} | ^^ @@ -287,7 +269,7 @@ LL | const fn no_fn_ptrs(_x: fn()) {} = help: add `#![feature(const_fn)]` to the crate attributes to enable error[E0723]: function pointers in const fn are unstable - --> $DIR/min_const_fn.rs:143:27 + --> $DIR/min_const_fn.rs:140:27 | LL | const fn no_fn_ptrs2() -> fn() { fn foo() {} foo } | ^^^^ @@ -295,7 +277,7 @@ LL | const fn no_fn_ptrs2() -> fn() { fn foo() {} foo } = note: see issue #57563 for more information = help: add `#![feature(const_fn)]` to the crate attributes to enable -error: aborting due to 34 previous errors +error: aborting due to 32 previous errors Some errors have detailed explanations: E0493, E0723. For more information about an error, try `rustc --explain E0493`. diff --git a/src/test/ui/consts/min_const_fn/min_const_fn_impl_trait.rs b/src/test/ui/consts/min_const_fn/min_const_fn_impl_trait.rs new file mode 100644 index 000000000000..9cc9b69ac0b6 --- /dev/null +++ b/src/test/ui/consts/min_const_fn/min_const_fn_impl_trait.rs @@ -0,0 +1,9 @@ +struct AlanTuring(T); +const fn no_rpit2() -> AlanTuring { + //~^ ERROR `impl Trait` in const fn is unstable + AlanTuring(0) +} + +const fn no_rpit() -> impl std::fmt::Debug {} //~ ERROR `impl Trait` in const fn is unstable + +fn main() {} diff --git a/src/test/ui/consts/min_const_fn/min_const_fn_impl_trait.stderr b/src/test/ui/consts/min_const_fn/min_const_fn_impl_trait.stderr new file mode 100644 index 000000000000..a62a340332db --- /dev/null +++ b/src/test/ui/consts/min_const_fn/min_const_fn_impl_trait.stderr @@ -0,0 +1,21 @@ +error[E0723]: `impl Trait` in const fn is unstable + --> $DIR/min_const_fn_impl_trait.rs:2:24 + | +LL | const fn no_rpit2() -> AlanTuring { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #57563 for more information + = help: add `#![feature(const_fn)]` to the crate attributes to enable + +error[E0723]: `impl Trait` in const fn is unstable + --> $DIR/min_const_fn_impl_trait.rs:7:23 + | +LL | const fn no_rpit() -> impl std::fmt::Debug {} + | ^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #57563 for more information + = help: add `#![feature(const_fn)]` to the crate attributes to enable + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0723`. diff --git a/src/test/ui/feature-gates/feature-gate-member-constraints.rs b/src/test/ui/feature-gates/feature-gate-member-constraints.rs index 293a93352e64..f6a92b0d0bfb 100644 --- a/src/test/ui/feature-gates/feature-gate-member-constraints.rs +++ b/src/test/ui/feature-gates/feature-gate-member-constraints.rs @@ -1,9 +1,10 @@ -trait Trait<'a, 'b> { } +trait Trait<'a, 'b> {} impl Trait<'_, '_> for T {} fn foo<'a, 'b>(x: &'a u32, y: &'b u32) -> impl Trait<'a, 'b> { //~^ ERROR ambiguous lifetime bound + //~| ERROR ambiguous lifetime bound (x, y) } -fn main() { } +fn main() {} diff --git a/src/test/ui/feature-gates/feature-gate-member-constraints.stderr b/src/test/ui/feature-gates/feature-gate-member-constraints.stderr index 3745d5e1c59d..c2ec7ae16a3a 100644 --- a/src/test/ui/feature-gates/feature-gate-member-constraints.stderr +++ b/src/test/ui/feature-gates/feature-gate-member-constraints.stderr @@ -6,5 +6,13 @@ LL | fn foo<'a, 'b>(x: &'a u32, y: &'b u32) -> impl Trait<'a, 'b> { | = help: add #![feature(member_constraints)] to the crate attributes to enable -error: aborting due to previous error +error: ambiguous lifetime bound in `impl Trait` + --> $DIR/feature-gate-member-constraints.rs:4:43 + | +LL | fn foo<'a, 'b>(x: &'a u32, y: &'b u32) -> impl Trait<'a, 'b> { + | ^^^^^^^^^^^^^^^^^^ the elided lifetimes here do not outlive one another + | + = help: add #![feature(member_constraints)] to the crate attributes to enable + +error: aborting due to 2 previous errors diff --git a/src/test/ui/impl-trait/auto-trait-leak.stderr b/src/test/ui/impl-trait/auto-trait-leak.stderr index 0ebaac894505..981fad57b0ff 100644 --- a/src/test/ui/impl-trait/auto-trait-leak.stderr +++ b/src/test/ui/impl-trait/auto-trait-leak.stderr @@ -4,9 +4,34 @@ error[E0391]: cycle detected when processing `cycle1::{{opaque}}#0` LL | fn cycle1() -> impl Clone { | ^^^^^^^^^^ | +note: ...which requires borrow-checking `cycle1`... + --> $DIR/auto-trait-leak.rs:12:1 + | +LL | fn cycle1() -> impl Clone { + | ^^^^^^^^^^^^^^^^^^^^^^^^^ note: ...which requires processing `cycle1`... --> $DIR/auto-trait-leak.rs:12:1 | +LL | fn cycle1() -> impl Clone { + | ^^^^^^^^^^^^^^^^^^^^^^^^^ +note: ...which requires processing `cycle1`... + --> $DIR/auto-trait-leak.rs:12:1 + | +LL | fn cycle1() -> impl Clone { + | ^^^^^^^^^^^^^^^^^^^^^^^^^ +note: ...which requires unsafety-checking `cycle1`... + --> $DIR/auto-trait-leak.rs:12:1 + | +LL | fn cycle1() -> impl Clone { + | ^^^^^^^^^^^^^^^^^^^^^^^^^ +note: ...which requires building MIR for... + --> $DIR/auto-trait-leak.rs:12:1 + | +LL | fn cycle1() -> impl Clone { + | ^^^^^^^^^^^^^^^^^^^^^^^^^ +note: ...which requires type-checking `cycle1`... + --> $DIR/auto-trait-leak.rs:12:1 + | LL | fn cycle1() -> impl Clone { | ^^^^^^^^^^^^^^^^^^^^^^^^^ = note: ...which requires evaluating trait selection obligation `impl std::clone::Clone: std::marker::Send`... @@ -15,9 +40,34 @@ note: ...which requires processing `cycle2::{{opaque}}#0`... | LL | fn cycle2() -> impl Clone { | ^^^^^^^^^^ +note: ...which requires borrow-checking `cycle2`... + --> $DIR/auto-trait-leak.rs:21:1 + | +LL | fn cycle2() -> impl Clone { + | ^^^^^^^^^^^^^^^^^^^^^^^^^ note: ...which requires processing `cycle2`... --> $DIR/auto-trait-leak.rs:22:1 | +LL | fn cycle2() -> impl Clone { + | ^^^^^^^^^^^^^^^^^^^^^^^^^ +note: ...which requires processing `cycle2`... + --> $DIR/auto-trait-leak.rs:21:1 + | +LL | fn cycle2() -> impl Clone { + | ^^^^^^^^^^^^^^^^^^^^^^^^^ +note: ...which requires unsafety-checking `cycle2`... + --> $DIR/auto-trait-leak.rs:21:1 + | +LL | fn cycle2() -> impl Clone { + | ^^^^^^^^^^^^^^^^^^^^^^^^^ +note: ...which requires building MIR for... + --> $DIR/auto-trait-leak.rs:21:1 + | +LL | fn cycle2() -> impl Clone { + | ^^^^^^^^^^^^^^^^^^^^^^^^^ +note: ...which requires type-checking `cycle2`... + --> $DIR/auto-trait-leak.rs:21:1 + | LL | fn cycle2() -> impl Clone { | ^^^^^^^^^^^^^^^^^^^^^^^^^ = note: ...which requires evaluating trait selection obligation `impl std::clone::Clone: std::marker::Send`... @@ -40,9 +90,34 @@ error[E0391]: cycle detected when processing `cycle1::{{opaque}}#0` LL | fn cycle1() -> impl Clone { | ^^^^^^^^^^ | +note: ...which requires borrow-checking `cycle1`... + --> $DIR/auto-trait-leak.rs:12:1 + | +LL | fn cycle1() -> impl Clone { + | ^^^^^^^^^^^^^^^^^^^^^^^^^ note: ...which requires processing `cycle1`... --> $DIR/auto-trait-leak.rs:12:1 | +LL | fn cycle1() -> impl Clone { + | ^^^^^^^^^^^^^^^^^^^^^^^^^ +note: ...which requires processing `cycle1`... + --> $DIR/auto-trait-leak.rs:12:1 + | +LL | fn cycle1() -> impl Clone { + | ^^^^^^^^^^^^^^^^^^^^^^^^^ +note: ...which requires unsafety-checking `cycle1`... + --> $DIR/auto-trait-leak.rs:12:1 + | +LL | fn cycle1() -> impl Clone { + | ^^^^^^^^^^^^^^^^^^^^^^^^^ +note: ...which requires building MIR for... + --> $DIR/auto-trait-leak.rs:12:1 + | +LL | fn cycle1() -> impl Clone { + | ^^^^^^^^^^^^^^^^^^^^^^^^^ +note: ...which requires type-checking `cycle1`... + --> $DIR/auto-trait-leak.rs:12:1 + | LL | fn cycle1() -> impl Clone { | ^^^^^^^^^^^^^^^^^^^^^^^^^ = note: ...which requires evaluating trait selection obligation `impl std::clone::Clone: std::marker::Send`... @@ -51,6 +126,11 @@ note: ...which requires processing `cycle2::{{opaque}}#0`... | LL | fn cycle2() -> impl Clone { | ^^^^^^^^^^ +note: ...which requires borrow-checking `cycle2`... + --> $DIR/auto-trait-leak.rs:21:1 + | +LL | fn cycle2() -> impl Clone { + | ^^^^^^^^^^^^^^^^^^^^^^^^^ note: ...which requires processing `cycle2`... --> $DIR/auto-trait-leak.rs:22:1 | @@ -89,6 +169,26 @@ LL | fn cycle2() -> impl Clone { note: ...which requires processing `cycle2`... --> $DIR/auto-trait-leak.rs:22:1 | +LL | fn cycle2() -> impl Clone { + | ^^^^^^^^^^^^^^^^^^^^^^^^^ +note: ...which requires processing `cycle2`... + --> $DIR/auto-trait-leak.rs:21:1 + | +LL | fn cycle2() -> impl Clone { + | ^^^^^^^^^^^^^^^^^^^^^^^^^ +note: ...which requires unsafety-checking `cycle2`... + --> $DIR/auto-trait-leak.rs:21:1 + | +LL | fn cycle2() -> impl Clone { + | ^^^^^^^^^^^^^^^^^^^^^^^^^ +note: ...which requires building MIR for... + --> $DIR/auto-trait-leak.rs:21:1 + | +LL | fn cycle2() -> impl Clone { + | ^^^^^^^^^^^^^^^^^^^^^^^^^ +note: ...which requires type-checking `cycle2`... + --> $DIR/auto-trait-leak.rs:21:1 + | LL | fn cycle2() -> impl Clone { | ^^^^^^^^^^^^^^^^^^^^^^^^^ = note: ...which again requires processing `cycle1::{{opaque}}#0`, completing the cycle diff --git a/src/test/ui/impl-trait/recursive-impl-trait-type-direct.rs b/src/test/ui/impl-trait/recursive-impl-trait-type-direct.rs index 2b4f5e0975ac..3cc537440977 100644 --- a/src/test/ui/impl-trait/recursive-impl-trait-type-direct.rs +++ b/src/test/ui/impl-trait/recursive-impl-trait-type-direct.rs @@ -1,6 +1,9 @@ // Test that an `impl Trait` type that expands to itself is an error. -fn test() -> impl Sized { //~ ERROR E0720 +#![allow(unconditional_recursion)] + +fn test() -> impl Sized { + //~^ ERROR E0720 test() } diff --git a/src/test/ui/impl-trait/recursive-impl-trait-type-direct.stderr b/src/test/ui/impl-trait/recursive-impl-trait-type-direct.stderr index 1b5dbd814a48..5a95e2969d1b 100644 --- a/src/test/ui/impl-trait/recursive-impl-trait-type-direct.stderr +++ b/src/test/ui/impl-trait/recursive-impl-trait-type-direct.stderr @@ -1,5 +1,5 @@ error[E0720]: opaque type expands to a recursive type - --> $DIR/recursive-impl-trait-type-direct.rs:3:14 + --> $DIR/recursive-impl-trait-type-direct.rs:5:14 | LL | fn test() -> impl Sized { | ^^^^^^^^^^ expands to a recursive type diff --git a/src/test/ui/impl-trait/recursive-impl-trait-type-indirect.rs b/src/test/ui/impl-trait/recursive-impl-trait-type-indirect.rs index 2428b560b700..e3c621f0c574 100644 --- a/src/test/ui/impl-trait/recursive-impl-trait-type-indirect.rs +++ b/src/test/ui/impl-trait/recursive-impl-trait-type-indirect.rs @@ -2,59 +2,75 @@ // otherwise forbidden. #![feature(generators)] +#![allow(unconditional_recursion)] -fn option(i: i32) -> impl Sized { //~ ERROR - if i < 0 { - None - } else { - Some((option(i - 1), i)) - } +fn option(i: i32) -> impl Sized { + //~^ ERROR + if i < 0 { None } else { Some((option(i - 1), i)) } } -fn tuple() -> impl Sized { //~ ERROR +fn tuple() -> impl Sized { + //~^ ERROR (tuple(),) } -fn array() -> impl Sized { //~ ERROR +fn array() -> impl Sized { + //~^ ERROR [array()] } -fn ptr() -> impl Sized { //~ ERROR +fn ptr() -> impl Sized { + //~^ ERROR &ptr() as *const _ } -fn fn_ptr() -> impl Sized { //~ ERROR +fn fn_ptr() -> impl Sized { + //~^ ERROR fn_ptr as fn() -> _ } -fn closure_capture() -> impl Sized { //~ ERROR +fn closure_capture() -> impl Sized { + //~^ ERROR let x = closure_capture(); - move || { x; } + move || { + x; + } } -fn closure_ref_capture() -> impl Sized { //~ ERROR +fn closure_ref_capture() -> impl Sized { + //~^ ERROR let x = closure_ref_capture(); - move || { &x; } + move || { + &x; + } } -fn closure_sig() -> impl Sized { //~ ERROR +fn closure_sig() -> impl Sized { + //~^ ERROR || closure_sig() } -fn generator_sig() -> impl Sized { //~ ERROR +fn generator_sig() -> impl Sized { + //~^ ERROR || generator_sig() } -fn generator_capture() -> impl Sized { //~ ERROR +fn generator_capture() -> impl Sized { + //~^ ERROR let x = generator_capture(); - move || { yield; x; } + move || { + yield; + x; + } } -fn substs_change() -> impl Sized { //~ ERROR +fn substs_change() -> impl Sized { + //~^ ERROR (substs_change::<&T>(),) } -fn generator_hold() -> impl Sized { //~ ERROR +fn generator_hold() -> impl Sized { + //~^ ERROR move || { let x = generator_hold(); yield; @@ -62,15 +78,18 @@ fn generator_hold() -> impl Sized { //~ ERROR } } -fn use_fn_ptr() -> impl Sized { // OK, error already reported +fn use_fn_ptr() -> impl Sized { + // OK, error already reported fn_ptr() } -fn mutual_recursion() -> impl Sync { //~ ERROR +fn mutual_recursion() -> impl Sync { + //~^ ERROR mutual_recursion_b() } -fn mutual_recursion_b() -> impl Sized { //~ ERROR +fn mutual_recursion_b() -> impl Sized { + //~^ ERROR mutual_recursion() } diff --git a/src/test/ui/impl-trait/recursive-impl-trait-type-indirect.stderr b/src/test/ui/impl-trait/recursive-impl-trait-type-indirect.stderr index b7ba0d6ab177..6573b00870c5 100644 --- a/src/test/ui/impl-trait/recursive-impl-trait-type-indirect.stderr +++ b/src/test/ui/impl-trait/recursive-impl-trait-type-indirect.stderr @@ -1,5 +1,5 @@ error[E0720]: opaque type expands to a recursive type - --> $DIR/recursive-impl-trait-type-indirect.rs:6:22 + --> $DIR/recursive-impl-trait-type-indirect.rs:7:22 | LL | fn option(i: i32) -> impl Sized { | ^^^^^^^^^^ expands to a recursive type @@ -7,7 +7,7 @@ LL | fn option(i: i32) -> impl Sized { = note: expanded type is `std::option::Option<(impl Sized, i32)>` error[E0720]: opaque type expands to a recursive type - --> $DIR/recursive-impl-trait-type-indirect.rs:14:15 + --> $DIR/recursive-impl-trait-type-indirect.rs:12:15 | LL | fn tuple() -> impl Sized { | ^^^^^^^^^^ expands to a recursive type @@ -15,7 +15,7 @@ LL | fn tuple() -> impl Sized { = note: expanded type is `(impl Sized,)` error[E0720]: opaque type expands to a recursive type - --> $DIR/recursive-impl-trait-type-indirect.rs:18:15 + --> $DIR/recursive-impl-trait-type-indirect.rs:17:15 | LL | fn array() -> impl Sized { | ^^^^^^^^^^ expands to a recursive type @@ -31,7 +31,7 @@ LL | fn ptr() -> impl Sized { = note: expanded type is `*const impl Sized` error[E0720]: opaque type expands to a recursive type - --> $DIR/recursive-impl-trait-type-indirect.rs:26:16 + --> $DIR/recursive-impl-trait-type-indirect.rs:27:16 | LL | fn fn_ptr() -> impl Sized { | ^^^^^^^^^^ expands to a recursive type @@ -39,63 +39,63 @@ LL | fn fn_ptr() -> impl Sized { = note: expanded type is `fn() -> impl Sized` error[E0720]: opaque type expands to a recursive type - --> $DIR/recursive-impl-trait-type-indirect.rs:30:25 + --> $DIR/recursive-impl-trait-type-indirect.rs:32:25 | LL | fn closure_capture() -> impl Sized { | ^^^^^^^^^^ expands to a recursive type | - = note: expanded type is `[closure@$DIR/recursive-impl-trait-type-indirect.rs:32:5: 32:19 x:impl Sized]` + = note: expanded type is `[closure@$DIR/recursive-impl-trait-type-indirect.rs:35:5: 37:6 x:impl Sized]` error[E0720]: opaque type expands to a recursive type - --> $DIR/recursive-impl-trait-type-indirect.rs:35:29 + --> $DIR/recursive-impl-trait-type-indirect.rs:40:29 | LL | fn closure_ref_capture() -> impl Sized { | ^^^^^^^^^^ expands to a recursive type | - = note: expanded type is `[closure@$DIR/recursive-impl-trait-type-indirect.rs:37:5: 37:20 x:impl Sized]` + = note: expanded type is `[closure@$DIR/recursive-impl-trait-type-indirect.rs:43:5: 45:6 x:impl Sized]` error[E0720]: opaque type expands to a recursive type - --> $DIR/recursive-impl-trait-type-indirect.rs:40:21 + --> $DIR/recursive-impl-trait-type-indirect.rs:48:21 | LL | fn closure_sig() -> impl Sized { | ^^^^^^^^^^ expands to a recursive type | - = note: expanded type is `[closure@$DIR/recursive-impl-trait-type-indirect.rs:41:5: 41:21]` + = note: expanded type is `[closure@$DIR/recursive-impl-trait-type-indirect.rs:50:5: 50:21]` error[E0720]: opaque type expands to a recursive type - --> $DIR/recursive-impl-trait-type-indirect.rs:44:23 + --> $DIR/recursive-impl-trait-type-indirect.rs:53:23 | LL | fn generator_sig() -> impl Sized { | ^^^^^^^^^^ expands to a recursive type | - = note: expanded type is `[closure@$DIR/recursive-impl-trait-type-indirect.rs:45:5: 45:23]` + = note: expanded type is `[closure@$DIR/recursive-impl-trait-type-indirect.rs:55:5: 55:23]` error[E0720]: opaque type expands to a recursive type - --> $DIR/recursive-impl-trait-type-indirect.rs:48:27 + --> $DIR/recursive-impl-trait-type-indirect.rs:58:27 | LL | fn generator_capture() -> impl Sized { | ^^^^^^^^^^ expands to a recursive type | - = note: expanded type is `[generator@$DIR/recursive-impl-trait-type-indirect.rs:50:5: 50:26 x:impl Sized {()}]` + = note: expanded type is `[generator@$DIR/recursive-impl-trait-type-indirect.rs:61:5: 64:6 x:impl Sized {()}]` error[E0720]: opaque type expands to a recursive type - --> $DIR/recursive-impl-trait-type-indirect.rs:53:26 + --> $DIR/recursive-impl-trait-type-indirect.rs:67:35 | -LL | fn substs_change() -> impl Sized { - | ^^^^^^^^^^ expands to a recursive type +LL | fn substs_change() -> impl Sized { + | ^^^^^^^^^^ expands to a recursive type | = note: expanded type is `(impl Sized,)` error[E0720]: opaque type expands to a recursive type - --> $DIR/recursive-impl-trait-type-indirect.rs:57:24 + --> $DIR/recursive-impl-trait-type-indirect.rs:72:24 | LL | fn generator_hold() -> impl Sized { | ^^^^^^^^^^ expands to a recursive type | - = note: expanded type is `[generator@$DIR/recursive-impl-trait-type-indirect.rs:58:5: 62:6 {impl Sized, ()}]` + = note: expanded type is `[generator@$DIR/recursive-impl-trait-type-indirect.rs:74:5: 78:6 {impl Sized, ()}]` error[E0720]: opaque type expands to a recursive type - --> $DIR/recursive-impl-trait-type-indirect.rs:69:26 + --> $DIR/recursive-impl-trait-type-indirect.rs:86:26 | LL | fn mutual_recursion() -> impl Sync { | ^^^^^^^^^ expands to a recursive type @@ -103,7 +103,7 @@ LL | fn mutual_recursion() -> impl Sync { = note: type resolves to itself error[E0720]: opaque type expands to a recursive type - --> $DIR/recursive-impl-trait-type-indirect.rs:73:28 + --> $DIR/recursive-impl-trait-type-indirect.rs:91:28 | LL | fn mutual_recursion_b() -> impl Sized { | ^^^^^^^^^^ expands to a recursive type diff --git a/src/test/ui/lint/lint-unused-mut-variables.rs b/src/test/ui/lint/lint-unused-mut-variables.rs index dd8dbda6d430..5c7ed9d52194 100644 --- a/src/test/ui/lint/lint-unused-mut-variables.rs +++ b/src/test/ui/lint/lint-unused-mut-variables.rs @@ -2,17 +2,17 @@ // Exercise the unused_mut attribute in some positive and negative cases -#![deny(unused_mut)] +#![warn(unused_mut)] #![feature(async_closure, raw_ref_op)] async fn baz_async( mut a: i32, - //~^ ERROR: variable does not need to be mutable + //~^ WARN: variable does not need to be mutable #[allow(unused_mut)] mut b: i32, ) {} fn baz( mut a: i32, - //~^ ERROR: variable does not need to be mutable + //~^ WARN: variable does not need to be mutable #[allow(unused_mut)] mut b: i32, #[allow(unused_mut)] (mut c, d): (i32, i32) ) {} @@ -21,13 +21,13 @@ struct RefStruct {} impl RefStruct { async fn baz_async( mut a: i32, - //~^ ERROR: variable does not need to be mutable + //~^ WARN: variable does not need to be mutable #[allow(unused_mut)] mut b: i32, ) {} fn baz( &self, mut a: i32, - //~^ ERROR: variable does not need to be mutable + //~^ WARN: variable does not need to be mutable #[allow(unused_mut)] mut b: i32, #[allow(unused_mut)] (mut c, d): (i32, i32) ) {} @@ -37,7 +37,7 @@ trait RefTrait { fn baz( &self, mut a: i32, - //~^ ERROR: variable does not need to be mutable + //~^ WARN: variable does not need to be mutable #[allow(unused_mut)] mut b: i32, #[allow(unused_mut)] (mut c, d): (i32, i32) ) {} @@ -46,7 +46,7 @@ impl RefTrait for () { fn baz( &self, mut a: i32, - //~^ ERROR: variable does not need to be mutable + //~^ WARN: variable does not need to be mutable #[allow(unused_mut)] mut b: i32, #[allow(unused_mut)] (mut c, d): (i32, i32) ) {} @@ -55,32 +55,32 @@ impl RefTrait for () { fn main() { let _ = async move | mut a: i32, - //~^ ERROR: variable does not need to be mutable + //~^ WARN: variable does not need to be mutable #[allow(unused_mut)] mut b: i32, | {}; let _ = | mut a: i32, - //~^ ERROR: variable does not need to be mutable + //~^ WARN: variable does not need to be mutable #[allow(unused_mut)] mut b: i32, #[allow(unused_mut)] (mut c, d): (i32, i32) | {}; // negative cases - let mut a = 3; //~ ERROR: variable does not need to be mutable + let mut a = 3; //~ WARN: variable does not need to be mutable - let mut a = 2; //~ ERROR: variable does not need to be mutable + let mut a = 2; //~ WARN: variable does not need to be mutable - let mut b = 3; //~ ERROR: variable does not need to be mutable + let mut b = 3; //~ WARN: variable does not need to be mutable - let mut a = vec![3]; //~ ERROR: variable does not need to be mutable + let mut a = vec![3]; //~ WARN: variable does not need to be mutable - let (mut a, b) = (1, 2); //~ ERROR: variable does not need to be mutable + let (mut a, b) = (1, 2); //~ WARN: variable does not need to be mutable - let mut a; //~ ERROR: variable does not need to be mutable + let mut a; //~ WARN: variable does not need to be mutable a = 3; - let mut b; //~ ERROR: variable does not need to be mutable + let mut b; //~ WARN: variable does not need to be mutable if true { b = 3; @@ -89,11 +89,11 @@ fn main() { } match 30 { - mut x => {} //~ ERROR: variable does not need to be mutable + mut x => {} //~ WARN: variable does not need to be mutable } match (30, 2) { - (mut x, 1) | //~ ERROR: variable does not need to be mutable + (mut x, 1) | //~ WARN: variable does not need to be mutable (mut x, 2) | (mut x, 3) => { @@ -101,20 +101,20 @@ fn main() { _ => {} } - let x = |mut y: isize| 10; //~ ERROR: variable does not need to be mutable + let x = |mut y: isize| 10; //~ WARN: variable does not need to be mutable - fn what(mut foo: isize) {} //~ ERROR: variable does not need to be mutable + fn what(mut foo: isize) {} //~ WARN: variable does not need to be mutable - let mut a = &mut 5; //~ ERROR: variable does not need to be mutable + let mut a = &mut 5; //~ WARN: variable does not need to be mutable *a = 4; let mut a = 5; - let mut b = (&mut a,); //~ ERROR: variable does not need to be mutable + let mut b = (&mut a,); //~ WARN: variable does not need to be mutable *b.0 = 4; - let mut x = &mut 1; //~ ERROR: variable does not need to be mutable + let mut x = &mut 1; //~ WARN: variable does not need to be mutable let mut f = || { *x += 1; @@ -122,11 +122,11 @@ fn main() { f(); fn mut_ref_arg(mut arg : &mut [u8]) -> &mut [u8] { - &mut arg[..] //~^ ERROR: variable does not need to be mutable + &mut arg[..] //~^ WARN: variable does not need to be mutable } - let mut v : &mut Vec<()> = &mut vec![]; //~ ERROR: variable does not need to be mutable + let mut v : &mut Vec<()> = &mut vec![]; //~ WARN: variable does not need to be mutable v.push(()); @@ -181,7 +181,7 @@ fn main() { let mut raw_address_of_mut = 1; // OK let mut_ptr = &raw mut raw_address_of_mut; - let mut raw_address_of_const = 1; //~ ERROR: variable does not need to be mutable + let mut raw_address_of_const = 1; //~ WARN: variable does not need to be mutable let const_ptr = &raw const raw_address_of_const; } diff --git a/src/test/ui/lint/lint-unused-mut-variables.stderr b/src/test/ui/lint/lint-unused-mut-variables.stderr index eda078da9a0e..b56b3c7569f7 100644 --- a/src/test/ui/lint/lint-unused-mut-variables.stderr +++ b/src/test/ui/lint/lint-unused-mut-variables.stderr @@ -1,4 +1,4 @@ -error: variable does not need to be mutable +warning: variable does not need to be mutable --> $DIR/lint-unused-mut-variables.rs:9:5 | LL | mut a: i32, @@ -9,18 +9,10 @@ LL | mut a: i32, note: the lint level is defined here --> $DIR/lint-unused-mut-variables.rs:5:9 | -LL | #![deny(unused_mut)] +LL | #![warn(unused_mut)] | ^^^^^^^^^^ -error: variable does not need to be mutable - --> $DIR/lint-unused-mut-variables.rs:14:5 - | -LL | mut a: i32, - | ----^ - | | - | help: remove this `mut` - -error: variable does not need to be mutable +warning: variable does not need to be mutable --> $DIR/lint-unused-mut-variables.rs:23:9 | LL | mut a: i32, @@ -28,7 +20,15 @@ LL | mut a: i32, | | | help: remove this `mut` -error: variable does not need to be mutable +warning: variable does not need to be mutable + --> $DIR/lint-unused-mut-variables.rs:14:5 + | +LL | mut a: i32, + | ----^ + | | + | help: remove this `mut` + +warning: variable does not need to be mutable --> $DIR/lint-unused-mut-variables.rs:29:9 | LL | mut a: i32, @@ -36,7 +36,7 @@ LL | mut a: i32, | | | help: remove this `mut` -error: variable does not need to be mutable +warning: variable does not need to be mutable --> $DIR/lint-unused-mut-variables.rs:39:9 | LL | mut a: i32, @@ -44,7 +44,7 @@ LL | mut a: i32, | | | help: remove this `mut` -error: variable does not need to be mutable +warning: variable does not need to be mutable --> $DIR/lint-unused-mut-variables.rs:48:9 | LL | mut a: i32, @@ -52,7 +52,7 @@ LL | mut a: i32, | | | help: remove this `mut` -error: variable does not need to be mutable +warning: variable does not need to be mutable --> $DIR/lint-unused-mut-variables.rs:57:9 | LL | mut a: i32, @@ -60,7 +60,7 @@ LL | mut a: i32, | | | help: remove this `mut` -error: variable does not need to be mutable +warning: variable does not need to be mutable --> $DIR/lint-unused-mut-variables.rs:62:9 | LL | mut a: i32, @@ -68,7 +68,7 @@ LL | mut a: i32, | | | help: remove this `mut` -error: variable does not need to be mutable +warning: variable does not need to be mutable --> $DIR/lint-unused-mut-variables.rs:104:14 | LL | let x = |mut y: isize| 10; @@ -76,7 +76,7 @@ LL | let x = |mut y: isize| 10; | | | help: remove this `mut` -error: variable does not need to be mutable +warning: variable does not need to be mutable --> $DIR/lint-unused-mut-variables.rs:69:9 | LL | let mut a = 3; @@ -84,7 +84,7 @@ LL | let mut a = 3; | | | help: remove this `mut` -error: variable does not need to be mutable +warning: variable does not need to be mutable --> $DIR/lint-unused-mut-variables.rs:71:9 | LL | let mut a = 2; @@ -92,7 +92,7 @@ LL | let mut a = 2; | | | help: remove this `mut` -error: variable does not need to be mutable +warning: variable does not need to be mutable --> $DIR/lint-unused-mut-variables.rs:73:9 | LL | let mut b = 3; @@ -100,7 +100,7 @@ LL | let mut b = 3; | | | help: remove this `mut` -error: variable does not need to be mutable +warning: variable does not need to be mutable --> $DIR/lint-unused-mut-variables.rs:75:9 | LL | let mut a = vec![3]; @@ -108,7 +108,7 @@ LL | let mut a = vec![3]; | | | help: remove this `mut` -error: variable does not need to be mutable +warning: variable does not need to be mutable --> $DIR/lint-unused-mut-variables.rs:77:10 | LL | let (mut a, b) = (1, 2); @@ -116,7 +116,7 @@ LL | let (mut a, b) = (1, 2); | | | help: remove this `mut` -error: variable does not need to be mutable +warning: variable does not need to be mutable --> $DIR/lint-unused-mut-variables.rs:79:9 | LL | let mut a; @@ -124,7 +124,7 @@ LL | let mut a; | | | help: remove this `mut` -error: variable does not need to be mutable +warning: variable does not need to be mutable --> $DIR/lint-unused-mut-variables.rs:83:9 | LL | let mut b; @@ -132,7 +132,7 @@ LL | let mut b; | | | help: remove this `mut` -error: variable does not need to be mutable +warning: variable does not need to be mutable --> $DIR/lint-unused-mut-variables.rs:92:9 | LL | mut x => {} @@ -140,7 +140,7 @@ LL | mut x => {} | | | help: remove this `mut` -error: variable does not need to be mutable +warning: variable does not need to be mutable --> $DIR/lint-unused-mut-variables.rs:96:8 | LL | (mut x, 1) | @@ -148,7 +148,7 @@ LL | (mut x, 1) | | | | help: remove this `mut` -error: variable does not need to be mutable +warning: variable does not need to be mutable --> $DIR/lint-unused-mut-variables.rs:109:9 | LL | let mut a = &mut 5; @@ -156,7 +156,7 @@ LL | let mut a = &mut 5; | | | help: remove this `mut` -error: variable does not need to be mutable +warning: variable does not need to be mutable --> $DIR/lint-unused-mut-variables.rs:114:9 | LL | let mut b = (&mut a,); @@ -164,7 +164,7 @@ LL | let mut b = (&mut a,); | | | help: remove this `mut` -error: variable does not need to be mutable +warning: variable does not need to be mutable --> $DIR/lint-unused-mut-variables.rs:117:9 | LL | let mut x = &mut 1; @@ -172,7 +172,7 @@ LL | let mut x = &mut 1; | | | help: remove this `mut` -error: variable does not need to be mutable +warning: variable does not need to be mutable --> $DIR/lint-unused-mut-variables.rs:129:9 | LL | let mut v : &mut Vec<()> = &mut vec![]; @@ -180,7 +180,7 @@ LL | let mut v : &mut Vec<()> = &mut vec![]; | | | help: remove this `mut` -error: variable does not need to be mutable +warning: variable does not need to be mutable --> $DIR/lint-unused-mut-variables.rs:184:9 | LL | let mut raw_address_of_const = 1; @@ -188,7 +188,7 @@ LL | let mut raw_address_of_const = 1; | | | help: remove this `mut` -error: variable does not need to be mutable +warning: variable does not need to be mutable --> $DIR/lint-unused-mut-variables.rs:106:13 | LL | fn what(mut foo: isize) {} @@ -196,7 +196,7 @@ LL | fn what(mut foo: isize) {} | | | help: remove this `mut` -error: variable does not need to be mutable +warning: variable does not need to be mutable --> $DIR/lint-unused-mut-variables.rs:124:20 | LL | fn mut_ref_arg(mut arg : &mut [u8]) -> &mut [u8] { @@ -218,5 +218,5 @@ note: the lint level is defined here LL | #[deny(unused_mut)] | ^^^^^^^^^^ -error: aborting due to 26 previous errors +error: aborting due to previous error diff --git a/src/test/ui/type-alias-impl-trait/generic_duplicate_param_use6.rs b/src/test/ui/type-alias-impl-trait/generic_duplicate_param_use6.rs index 59e7de413a2c..6cbb3069ecd4 100644 --- a/src/test/ui/type-alias-impl-trait/generic_duplicate_param_use6.rs +++ b/src/test/ui/type-alias-impl-trait/generic_duplicate_param_use6.rs @@ -7,11 +7,11 @@ fn main() {} // test that unused generic parameters are ok type Two = impl Debug; -fn two(t: T, u: U) -> Two { +fn two(t: T, u: U) -> Two { (t, t) } -fn three(t: T, u: U) -> Two { -//~^ concrete type differs from previous +fn three(t: T, u: U) -> Two { + //~^ concrete type differs from previous (u, t) } diff --git a/src/test/ui/type-alias-impl-trait/generic_duplicate_param_use6.stderr b/src/test/ui/type-alias-impl-trait/generic_duplicate_param_use6.stderr index 66649413d382..7e81d362661b 100644 --- a/src/test/ui/type-alias-impl-trait/generic_duplicate_param_use6.stderr +++ b/src/test/ui/type-alias-impl-trait/generic_duplicate_param_use6.stderr @@ -1,7 +1,7 @@ error: concrete type differs from previous defining opaque type use --> $DIR/generic_duplicate_param_use6.rs:14:1 | -LL | / fn three(t: T, u: U) -> Two { +LL | / fn three(t: T, u: U) -> Two { LL | | LL | | (u, t) LL | | } @@ -10,7 +10,7 @@ LL | | } note: previous use here --> $DIR/generic_duplicate_param_use6.rs:10:1 | -LL | / fn two(t: T, u: U) -> Two { +LL | / fn two(t: T, u: U) -> Two { LL | | (t, t) LL | | } | |_^ diff --git a/src/test/ui/type-alias-impl-trait/issue-52843-closure-constrain.rs b/src/test/ui/type-alias-impl-trait/issue-52843-closure-constrain.rs index a102d16078be..50eeff0b18fd 100644 --- a/src/test/ui/type-alias-impl-trait/issue-52843-closure-constrain.rs +++ b/src/test/ui/type-alias-impl-trait/issue-52843-closure-constrain.rs @@ -7,7 +7,7 @@ use std::fmt::Debug; fn main() { type Opaque = impl Debug; fn _unused() -> Opaque { String::new() } - //~^ ERROR: concrete type differs from previous defining opaque type use let null = || -> Opaque { 0 }; + //~^ ERROR: concrete type differs from previous defining opaque type use println!("{:?}", null()); } diff --git a/src/test/ui/type-alias-impl-trait/issue-52843-closure-constrain.stderr b/src/test/ui/type-alias-impl-trait/issue-52843-closure-constrain.stderr index c994eb5986cb..1333b4c63d18 100644 --- a/src/test/ui/type-alias-impl-trait/issue-52843-closure-constrain.stderr +++ b/src/test/ui/type-alias-impl-trait/issue-52843-closure-constrain.stderr @@ -1,20 +1,14 @@ error: concrete type differs from previous defining opaque type use + --> $DIR/issue-52843-closure-constrain.rs:10:16 + | +LL | let null = || -> Opaque { 0 }; + | ^^^^^^^^^^^^^^^^^^ expected `std::string::String`, got `i32` + | +note: previous use here --> $DIR/issue-52843-closure-constrain.rs:9:5 | LL | fn _unused() -> Opaque { String::new() } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `i32`, got `std::string::String` - | -note: previous use here - --> $DIR/issue-52843-closure-constrain.rs:7:1 - | -LL | / fn main() { -LL | | type Opaque = impl Debug; -LL | | fn _unused() -> Opaque { String::new() } -LL | | -LL | | let null = || -> Opaque { 0 }; -LL | | println!("{:?}", null()); -LL | | } - | |_^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/type-alias-impl-trait/issue-60564.rs b/src/test/ui/type-alias-impl-trait/issue-60564.rs index 8686100205ff..73acc92172ba 100644 --- a/src/test/ui/type-alias-impl-trait/issue-60564.rs +++ b/src/test/ui/type-alias-impl-trait/issue-60564.rs @@ -8,7 +8,7 @@ trait IterBits { type IterBitsIter = impl std::iter::Iterator; //~^ ERROR could not find defining uses -impl IterBits for T +impl IterBits for T where T: std::ops::Shr + std::ops::BitAnd