From c23a457e72abe608715ac76f076f47dc42af07a5 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Thu, 30 May 2024 20:31:44 +0200 Subject: Merging upstream version 1.74.1+dfsg1. Signed-off-by: Daniel Baumann --- tests/ui/impl-trait/auto-trait-leak.rs | 1 - tests/ui/impl-trait/auto-trait-leak.stderr | 82 ++++------- tests/ui/impl-trait/bound-normalization-fail.rs | 3 +- .../ui/impl-trait/bound-normalization-fail.stderr | 16 +-- tests/ui/impl-trait/capture-lifetime-not-in-hir.rs | 21 +++ .../impl-trait/capture-lifetime-not-in-hir.stderr | 14 ++ .../coherence-treats-tait-ambig.next.stderr | 13 -- tests/ui/impl-trait/coherence-treats-tait-ambig.rs | 3 - .../impl-trait/coherence-treats-tait-ambig.stderr | 13 ++ .../equality-in-canonical-query.clone.stderr | 29 ++++ tests/ui/impl-trait/equality-in-canonical-query.rs | 23 ++++ tests/ui/impl-trait/feature-self-return-type.rs | 1 - .../ui/impl-trait/feature-self-return-type.stderr | 6 +- tests/ui/impl-trait/impl-subtyper.rs | 18 +++ tests/ui/impl-trait/impl-subtyper2.rs | 7 + .../in-trait/anonymize-binders-for-refine.rs | 13 ++ tests/ui/impl-trait/in-trait/auxiliary/rpitit.rs | 3 +- .../in-trait/bad-item-bound-within-rpitit.rs | 3 +- .../in-trait/bad-item-bound-within-rpitit.stderr | 18 ++- tests/ui/impl-trait/in-trait/deep-match-works.rs | 7 +- tests/ui/impl-trait/in-trait/foreign.rs | 14 +- tests/ui/impl-trait/in-trait/issue-102140.stderr | 6 +- tests/ui/impl-trait/in-trait/issue-102571.rs | 8 -- tests/ui/impl-trait/in-trait/issue-102571.stderr | 2 +- .../in-trait/lifetime-in-associated-trait-bound.rs | 19 +++ tests/ui/impl-trait/in-trait/nested-rpitit.rs | 10 +- .../ui/impl-trait/in-trait/object-safety-sized.rs | 23 ++++ tests/ui/impl-trait/in-trait/object-safety.rs | 3 +- tests/ui/impl-trait/in-trait/object-safety.stderr | 17 ++- tests/ui/impl-trait/in-trait/refine.rs | 48 +++++++ tests/ui/impl-trait/in-trait/refine.stderr | 67 +++++++++ tests/ui/impl-trait/in-trait/reveal.rs | 5 +- ...pitit-hidden-types-self-implied-wf-via-param.rs | 26 ++++ ...t-hidden-types-self-implied-wf-via-param.stderr | 16 +++ .../rpitit-hidden-types-self-implied-wf.rs | 23 ++++ .../rpitit-hidden-types-self-implied-wf.stderr | 16 +++ .../in-trait/rpitit-shadowed-by-missing-adt.rs | 3 +- .../in-trait/signature-mismatch.failure.stderr | 14 ++ tests/ui/impl-trait/in-trait/signature-mismatch.rs | 46 +++++-- .../impl-trait/in-trait/signature-mismatch.stderr | 61 --------- .../in-trait/specialization-substs-remap.rs | 5 +- tests/ui/impl-trait/in-trait/success.rs | 9 +- tests/ui/impl-trait/in-trait/variance.rs | 20 +++ tests/ui/impl-trait/in-trait/variance.stderr | 26 ++++ tests/ui/impl-trait/issue-103181-2.rs | 2 - tests/ui/impl-trait/issue-103181-2.stderr | 57 +------- tests/ui/impl-trait/issue-108591.rs | 3 +- tests/ui/impl-trait/issue-108592.rs | 3 +- .../impl-trait/issue-55872-2.drop_tracking.stderr | 8 -- .../issue-55872-2.drop_tracking_mir.stderr | 14 -- .../issue-55872-2.no_drop_tracking.stderr | 8 -- tests/ui/impl-trait/issue-55872-2.rs | 5 +- tests/ui/impl-trait/issue-55872-2.stderr | 14 ++ tests/ui/impl-trait/issue-55872-3.stderr | 4 +- tests/ui/impl-trait/issue-86465.rs | 6 +- tests/ui/impl-trait/issue-86465.stderr | 2 +- tests/ui/impl-trait/issue-99073.stderr | 2 +- tests/ui/impl-trait/issues/issue-74282.stderr | 2 +- tests/ui/impl-trait/issues/issue-78722-2.stderr | 2 +- tests/ui/impl-trait/issues/issue-78722.stderr | 2 +- tests/ui/impl-trait/issues/issue-86800.stderr | 4 +- .../must_outlive_least_region_or_bound.stderr | 2 +- .../ui/impl-trait/nested-return-type2-tait2.stderr | 2 +- .../ui/impl-trait/nested-return-type2-tait3.stderr | 2 +- tests/ui/impl-trait/nested-return-type4.stderr | 2 +- tests/ui/impl-trait/normalize-tait-in-const.stderr | 25 +--- tests/ui/impl-trait/recursive-generator.rs | 1 - tests/ui/impl-trait/recursive-generator.stderr | 15 +- ...e-impl-trait-type-indirect.drop_tracking.stderr | 152 --------------------- ...pl-trait-type-indirect.drop_tracking_mir.stderr | 147 -------------------- ...mpl-trait-type-indirect.no_drop_tracking.stderr | 152 --------------------- .../recursive-impl-trait-type-indirect.rs | 4 - .../recursive-impl-trait-type-indirect.stderr | 147 ++++++++++++++++++++ .../static-return-lifetime-infered.stderr | 4 +- tests/ui/impl-trait/variance.rs | 16 +++ tests/ui/impl-trait/variance.stderr | 26 ++++ 76 files changed, 816 insertions(+), 800 deletions(-) create mode 100644 tests/ui/impl-trait/capture-lifetime-not-in-hir.rs create mode 100644 tests/ui/impl-trait/capture-lifetime-not-in-hir.stderr delete mode 100644 tests/ui/impl-trait/coherence-treats-tait-ambig.next.stderr create mode 100644 tests/ui/impl-trait/coherence-treats-tait-ambig.stderr create mode 100644 tests/ui/impl-trait/equality-in-canonical-query.clone.stderr create mode 100644 tests/ui/impl-trait/equality-in-canonical-query.rs create mode 100644 tests/ui/impl-trait/impl-subtyper.rs create mode 100644 tests/ui/impl-trait/impl-subtyper2.rs create mode 100644 tests/ui/impl-trait/in-trait/anonymize-binders-for-refine.rs create mode 100644 tests/ui/impl-trait/in-trait/lifetime-in-associated-trait-bound.rs create mode 100644 tests/ui/impl-trait/in-trait/object-safety-sized.rs create mode 100644 tests/ui/impl-trait/in-trait/refine.rs create mode 100644 tests/ui/impl-trait/in-trait/refine.stderr create mode 100644 tests/ui/impl-trait/in-trait/rpitit-hidden-types-self-implied-wf-via-param.rs create mode 100644 tests/ui/impl-trait/in-trait/rpitit-hidden-types-self-implied-wf-via-param.stderr create mode 100644 tests/ui/impl-trait/in-trait/rpitit-hidden-types-self-implied-wf.rs create mode 100644 tests/ui/impl-trait/in-trait/rpitit-hidden-types-self-implied-wf.stderr create mode 100644 tests/ui/impl-trait/in-trait/signature-mismatch.failure.stderr delete mode 100644 tests/ui/impl-trait/in-trait/signature-mismatch.stderr create mode 100644 tests/ui/impl-trait/in-trait/variance.rs create mode 100644 tests/ui/impl-trait/in-trait/variance.stderr delete mode 100644 tests/ui/impl-trait/issue-55872-2.drop_tracking.stderr delete mode 100644 tests/ui/impl-trait/issue-55872-2.drop_tracking_mir.stderr delete mode 100644 tests/ui/impl-trait/issue-55872-2.no_drop_tracking.stderr create mode 100644 tests/ui/impl-trait/issue-55872-2.stderr delete mode 100644 tests/ui/impl-trait/recursive-impl-trait-type-indirect.drop_tracking.stderr delete mode 100644 tests/ui/impl-trait/recursive-impl-trait-type-indirect.drop_tracking_mir.stderr delete mode 100644 tests/ui/impl-trait/recursive-impl-trait-type-indirect.no_drop_tracking.stderr create mode 100644 tests/ui/impl-trait/recursive-impl-trait-type-indirect.stderr create mode 100644 tests/ui/impl-trait/variance.rs create mode 100644 tests/ui/impl-trait/variance.stderr (limited to 'tests/ui/impl-trait') diff --git a/tests/ui/impl-trait/auto-trait-leak.rs b/tests/ui/impl-trait/auto-trait-leak.rs index d71c09879..1f90292f4 100644 --- a/tests/ui/impl-trait/auto-trait-leak.rs +++ b/tests/ui/impl-trait/auto-trait-leak.rs @@ -12,7 +12,6 @@ fn cycle1() -> impl Clone { //~^ ERROR cycle detected //~| ERROR cycle detected send(cycle2().clone()); - //~^ ERROR: cannot check whether the hidden type of opaque type satisfies auto traits Rc::new(Cell::new(5)) } diff --git a/tests/ui/impl-trait/auto-trait-leak.stderr b/tests/ui/impl-trait/auto-trait-leak.stderr index a024cff0b..62341f6de 100644 --- a/tests/ui/impl-trait/auto-trait-leak.stderr +++ b/tests/ui/impl-trait/auto-trait-leak.stderr @@ -1,4 +1,4 @@ -error[E0391]: cycle detected when computing type of `cycle1::{opaque#0}` +error[E0391]: cycle detected when computing type of opaque `cycle1::{opaque#0}` --> $DIR/auto-trait-leak.rs:11:16 | LL | fn cycle1() -> impl Clone { @@ -10,32 +10,26 @@ note: ...which requires type-checking `cycle1`... LL | send(cycle2().clone()); | ^^^^ = note: ...which requires evaluating trait selection obligation `cycle2::{opaque#0}: core::marker::Send`... -note: ...which requires computing type of `cycle2::{opaque#0}`... - --> $DIR/auto-trait-leak.rs:20:16 +note: ...which requires computing type of opaque `cycle2::{opaque#0}`... + --> $DIR/auto-trait-leak.rs:19:16 | LL | fn cycle2() -> impl Clone { | ^^^^^^^^^^ note: ...which requires type-checking `cycle2`... - --> $DIR/auto-trait-leak.rs:21:5 + --> $DIR/auto-trait-leak.rs:20:5 | LL | send(cycle1().clone()); | ^^^^ = note: ...which requires evaluating trait selection obligation `cycle1::{opaque#0}: core::marker::Send`... - = note: ...which again requires computing type of `cycle1::{opaque#0}`, completing the cycle -note: cycle used when checking item types in top-level module - --> $DIR/auto-trait-leak.rs:1:1 - | -LL | / use std::cell::Cell; -LL | | use std::rc::Rc; -LL | | -LL | | fn send(_: T) {} -... | -LL | | Rc::new(String::from("foo")) -LL | | } - | |_^ + = note: ...which again requires computing type of opaque `cycle1::{opaque#0}`, completing the cycle +note: cycle used when computing type of `cycle1::{opaque#0}` + --> $DIR/auto-trait-leak.rs:11:16 + | +LL | fn cycle1() -> impl Clone { + | ^^^^^^^^^^ = 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 `cycle1::{opaque#0}` +error[E0391]: cycle detected when computing type of opaque `cycle1::{opaque#0}` --> $DIR/auto-trait-leak.rs:11:16 | LL | fn cycle1() -> impl Clone { @@ -47,32 +41,26 @@ note: ...which requires type-checking `cycle1`... LL | send(cycle2().clone()); | ^^^^ = note: ...which requires evaluating trait selection obligation `cycle2::{opaque#0}: core::marker::Send`... -note: ...which requires computing type of `cycle2::{opaque#0}`... - --> $DIR/auto-trait-leak.rs:20:16 +note: ...which requires computing type of opaque `cycle2::{opaque#0}`... + --> $DIR/auto-trait-leak.rs:19:16 | LL | fn cycle2() -> impl Clone { | ^^^^^^^^^^ note: ...which requires type-checking `cycle2`... - --> $DIR/auto-trait-leak.rs:20:1 + --> $DIR/auto-trait-leak.rs:19:1 | LL | fn cycle2() -> impl Clone { | ^^^^^^^^^^^^^^^^^^^^^^^^^ - = note: ...which again requires computing type of `cycle1::{opaque#0}`, completing the cycle -note: cycle used when checking item types in top-level module - --> $DIR/auto-trait-leak.rs:1:1 - | -LL | / use std::cell::Cell; -LL | | use std::rc::Rc; -LL | | -LL | | fn send(_: T) {} -... | -LL | | Rc::new(String::from("foo")) -LL | | } - | |_^ + = note: ...which again requires computing type of opaque `cycle1::{opaque#0}`, completing the cycle +note: cycle used when computing type of `cycle1::{opaque#0}` + --> $DIR/auto-trait-leak.rs:11:16 + | +LL | fn cycle1() -> impl Clone { + | ^^^^^^^^^^ = 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: cannot check whether the hidden type of opaque type satisfies auto traits - --> $DIR/auto-trait-leak.rs:21:10 + --> $DIR/auto-trait-leak.rs:20:10 | LL | send(cycle1().clone()); | ---- ^^^^^^^^^^^^^^^^ @@ -85,7 +73,7 @@ note: opaque type is declared here LL | fn cycle1() -> impl Clone { | ^^^^^^^^^^ note: this item depends on auto traits of the hidden type, but may also be registering the hidden type. This is not supported right now. You can try moving the opaque type and the item that actually registers a hidden type into a new submodule - --> $DIR/auto-trait-leak.rs:20:4 + --> $DIR/auto-trait-leak.rs:19:4 | LL | fn cycle2() -> impl Clone { | ^^^^^^ @@ -95,30 +83,6 @@ note: required by a bound in `send` LL | fn send(_: T) {} | ^^^^ required by this bound in `send` -error: cannot check whether the hidden type of opaque type satisfies auto traits - --> $DIR/auto-trait-leak.rs:14:10 - | -LL | send(cycle2().clone()); - | ---- ^^^^^^^^^^^^^^^^ - | | - | required by a bound introduced by this call - | -note: opaque type is declared here - --> $DIR/auto-trait-leak.rs:20:16 - | -LL | fn cycle2() -> impl Clone { - | ^^^^^^^^^^ -note: this item depends on auto traits of the hidden type, but may also be registering the hidden type. This is not supported right now. You can try moving the opaque type and the item that actually registers a hidden type into a new submodule - --> $DIR/auto-trait-leak.rs:11:4 - | -LL | fn cycle1() -> impl Clone { - | ^^^^^^ -note: required by a bound in `send` - --> $DIR/auto-trait-leak.rs:4:12 - | -LL | fn send(_: T) {} - | ^^^^ required by this bound in `send` - -error: aborting due to 4 previous errors +error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0391`. diff --git a/tests/ui/impl-trait/bound-normalization-fail.rs b/tests/ui/impl-trait/bound-normalization-fail.rs index 332959247..566a4a7ad 100644 --- a/tests/ui/impl-trait/bound-normalization-fail.rs +++ b/tests/ui/impl-trait/bound-normalization-fail.rs @@ -39,8 +39,7 @@ mod lifetimes { /// Missing bound constraining `Assoc`, `T::Assoc` can't be normalized further. fn foo2_fail<'a, T: Trait<'a>>() -> impl FooLike { - //~^ ERROR `impl Trait` return type cannot contain a projection or `Self` that references lifetimes from a parent scope - //~| ERROR: type mismatch + //~^ ERROR: type mismatch Foo(()) } } diff --git a/tests/ui/impl-trait/bound-normalization-fail.stderr b/tests/ui/impl-trait/bound-normalization-fail.stderr index f04a753a0..fcac9ac34 100644 --- a/tests/ui/impl-trait/bound-normalization-fail.stderr +++ b/tests/ui/impl-trait/bound-normalization-fail.stderr @@ -19,21 +19,12 @@ help: consider constraining the associated type `::Assoc LL | fn foo_fail>() -> impl FooLike { | ++++++++++++ -error[E0658]: `impl Trait` return type cannot contain a projection or `Self` that references lifetimes from a parent scope - --> $DIR/bound-normalization-fail.rs:41:41 - | -LL | fn foo2_fail<'a, T: Trait<'a>>() -> impl FooLike { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #103532 for more information - = help: add `#![feature(impl_trait_projections)]` to the crate attributes to enable - error[E0271]: type mismatch resolving ` as FooLike>::Output == >::Assoc` --> $DIR/bound-normalization-fail.rs:41:41 | LL | fn foo2_fail<'a, T: Trait<'a>>() -> impl FooLike { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type mismatch resolving ` as FooLike>::Output == >::Assoc` -... +LL | LL | Foo(()) | ------- return type was inferred to be `Foo<()>` here | @@ -49,7 +40,6 @@ help: consider constraining the associated type `>::As LL | fn foo2_fail<'a, T: Trait<'a, Assoc = ()>>() -> impl FooLike { | ++++++++++++ -error: aborting due to 3 previous errors +error: aborting due to 2 previous errors -Some errors have detailed explanations: E0271, E0658. -For more information about an error, try `rustc --explain E0271`. +For more information about this error, try `rustc --explain E0271`. diff --git a/tests/ui/impl-trait/capture-lifetime-not-in-hir.rs b/tests/ui/impl-trait/capture-lifetime-not-in-hir.rs new file mode 100644 index 000000000..9c067cb69 --- /dev/null +++ b/tests/ui/impl-trait/capture-lifetime-not-in-hir.rs @@ -0,0 +1,21 @@ +#![feature(rustc_attrs)] +#![rustc_variance_of_opaques] + +trait Bar<'a> { + type Assoc: From<()>; +} + +fn foo<'a, T: Bar<'a>>() -> impl Into { + //~^ ERROR [o, o] + // captures both T and 'a invariantly + () +} + +fn foo2<'a, T: Bar<'a>>() -> impl Into + 'a { + //~^ ERROR [o, o, o] + // captures both T and 'a invariantly, and also duplicates `'a` + // i.e. the opaque looks like `impl Into<>::Assoc> + 'a_duplicated` + () +} + +fn main() {} diff --git a/tests/ui/impl-trait/capture-lifetime-not-in-hir.stderr b/tests/ui/impl-trait/capture-lifetime-not-in-hir.stderr new file mode 100644 index 000000000..9d52001b0 --- /dev/null +++ b/tests/ui/impl-trait/capture-lifetime-not-in-hir.stderr @@ -0,0 +1,14 @@ +error: [o, o] + --> $DIR/capture-lifetime-not-in-hir.rs:8:29 + | +LL | fn foo<'a, T: Bar<'a>>() -> impl Into { + | ^^^^^^^^^^^^^^^^^^^ + +error: [o, o, o] + --> $DIR/capture-lifetime-not-in-hir.rs:14:30 + | +LL | fn foo2<'a, T: Bar<'a>>() -> impl Into + 'a { + | ^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 2 previous errors + diff --git a/tests/ui/impl-trait/coherence-treats-tait-ambig.next.stderr b/tests/ui/impl-trait/coherence-treats-tait-ambig.next.stderr deleted file mode 100644 index 61fed1629..000000000 --- a/tests/ui/impl-trait/coherence-treats-tait-ambig.next.stderr +++ /dev/null @@ -1,13 +0,0 @@ -error[E0119]: conflicting implementations of trait `Into` for type `Foo` - --> $DIR/coherence-treats-tait-ambig.rs:10:1 - | -LL | impl Into for Foo { - | ^^^^^^^^^^^^^^^^^^^^ - | - = note: conflicting implementation in crate `core`: - - impl Into for T - where U: From; - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0119`. diff --git a/tests/ui/impl-trait/coherence-treats-tait-ambig.rs b/tests/ui/impl-trait/coherence-treats-tait-ambig.rs index 156a7eb0e..df47208bf 100644 --- a/tests/ui/impl-trait/coherence-treats-tait-ambig.rs +++ b/tests/ui/impl-trait/coherence-treats-tait-ambig.rs @@ -1,6 +1,3 @@ -// revisions: current next -//[next] compile-flags: -Ztrait-solver=next - #![feature(type_alias_impl_trait)] type T = impl Sized; diff --git a/tests/ui/impl-trait/coherence-treats-tait-ambig.stderr b/tests/ui/impl-trait/coherence-treats-tait-ambig.stderr new file mode 100644 index 000000000..7c69c4bfe --- /dev/null +++ b/tests/ui/impl-trait/coherence-treats-tait-ambig.stderr @@ -0,0 +1,13 @@ +error[E0119]: conflicting implementations of trait `Into` for type `Foo` + --> $DIR/coherence-treats-tait-ambig.rs:7:1 + | +LL | impl Into for Foo { + | ^^^^^^^^^^^^^^^^^^^^ + | + = note: conflicting implementation in crate `core`: + - impl Into for T + where U: From; + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0119`. diff --git a/tests/ui/impl-trait/equality-in-canonical-query.clone.stderr b/tests/ui/impl-trait/equality-in-canonical-query.clone.stderr new file mode 100644 index 000000000..83791f0d3 --- /dev/null +++ b/tests/ui/impl-trait/equality-in-canonical-query.clone.stderr @@ -0,0 +1,29 @@ +error: internal compiler error: no errors encountered even though `delay_span_bug` issued + +error: internal compiler error: {OpaqueTypeKey { def_id: DefId(rpit::{opaque#0}), args: [] }: OpaqueTypeDecl { hidden_type: OpaqueHiddenType { span: no-location (#0), ty: Alias(Opaque, AliasTy { args: [], def_id: DefId(foo::{opaque#0}) }) } }} + | + = + + +error: internal compiler error: error performing ParamEnvAnd { param_env: ParamEnv { caller_bounds: [], reveal: UserFacing }, value: ProvePredicate { predicate: Binder { value: ProjectionPredicate(AliasTy { args: [FnDef(DefId(rpit), []), ()], def_id: DefId(ops::function::FnOnce::Output) }, Term::Ty(Alias(Opaque, AliasTy { args: [], def_id: DefId(foo::{opaque#0}) }))), bound_vars: [] } } } + --> $DIR/equality-in-canonical-query.rs:19:5 + | +LL | same_output(foo, rpit); + | ^^^^^^^^^^^^^^^^^^^^^^ + | + + --> $DIR/equality-in-canonical-query.rs:19:5 + | +LL | same_output(foo, rpit); + | ^^^^^^^^^^^^^^^^^^^^^^ + + + + + + + +query stack during panic: +end of query stack +error: aborting due to 3 previous errors + diff --git a/tests/ui/impl-trait/equality-in-canonical-query.rs b/tests/ui/impl-trait/equality-in-canonical-query.rs new file mode 100644 index 000000000..672b1eeea --- /dev/null +++ b/tests/ui/impl-trait/equality-in-canonical-query.rs @@ -0,0 +1,23 @@ +// issue: #116877 +// revisions: sized clone +//[sized] check-pass + +//[clone] known-bug: #108498 +//[clone] failure-status: 101 +//[clone] normalize-stderr-test: "DefId\(.*?\]::" -> "DefId(" +//[clone] normalize-stderr-test: "(?m)note: .*$" -> "" +//[clone] normalize-stderr-test: "(?m)^ *\d+: .*\n" -> "" +//[clone] normalize-stderr-test: "(?m)^ *at .*\n" -> "" + +#[cfg(sized)] fn rpit() -> impl Sized {} +#[cfg(clone)] fn rpit() -> impl Clone {} + +fn same_output(_: impl Fn() -> Out, _: impl Fn() -> Out) {} + +pub fn foo() -> impl Sized { + same_output(rpit, foo); + same_output(foo, rpit); + rpit() +} + +fn main () {} diff --git a/tests/ui/impl-trait/feature-self-return-type.rs b/tests/ui/impl-trait/feature-self-return-type.rs index 51877e9cc..7555df1b2 100644 --- a/tests/ui/impl-trait/feature-self-return-type.rs +++ b/tests/ui/impl-trait/feature-self-return-type.rs @@ -1,5 +1,4 @@ // edition:2018 -#![feature(impl_trait_projections)] // This test checks that we emit the correct borrowck error when `Self` or a projection is used as // a return type. See #61949 for context. diff --git a/tests/ui/impl-trait/feature-self-return-type.stderr b/tests/ui/impl-trait/feature-self-return-type.stderr index b9b8d00ce..e7113a9df 100644 --- a/tests/ui/impl-trait/feature-self-return-type.stderr +++ b/tests/ui/impl-trait/feature-self-return-type.stderr @@ -1,5 +1,5 @@ error[E0597]: `bar` does not live long enough - --> $DIR/feature-self-return-type.rs:23:22 + --> $DIR/feature-self-return-type.rs:22:22 | LL | let x = { | - borrow later stored here @@ -12,7 +12,7 @@ LL | }; | - `bar` dropped here while still borrowed error[E0597]: `y` does not live long enough - --> $DIR/feature-self-return-type.rs:63:17 + --> $DIR/feature-self-return-type.rs:62:17 | LL | let x = { | - borrow later stored here @@ -25,7 +25,7 @@ LL | }; | - `y` dropped here while still borrowed error[E0597]: `y` does not live long enough - --> $DIR/feature-self-return-type.rs:95:17 + --> $DIR/feature-self-return-type.rs:94:17 | LL | let x = { | - borrow later stored here diff --git a/tests/ui/impl-trait/impl-subtyper.rs b/tests/ui/impl-trait/impl-subtyper.rs new file mode 100644 index 000000000..2d99cdd4f --- /dev/null +++ b/tests/ui/impl-trait/impl-subtyper.rs @@ -0,0 +1,18 @@ +// check-pass + +#![crate_type = "lib"] +fn checkpoints() -> impl Iterator { + Some(()).iter().flat_map(|_| std::iter::once(())) +} + +fn block_checkpoints() -> impl Iterator { + checkpoints() +} + +fn iter_raw() -> impl Iterator { + let mut iter = block_checkpoints(); + + (0..9).map(move |_| { + iter.next(); + }) +} diff --git a/tests/ui/impl-trait/impl-subtyper2.rs b/tests/ui/impl-trait/impl-subtyper2.rs new file mode 100644 index 000000000..2e0acbae6 --- /dev/null +++ b/tests/ui/impl-trait/impl-subtyper2.rs @@ -0,0 +1,7 @@ +// check-pass + +fn ages() -> Option { + None::> +} + +fn main(){} diff --git a/tests/ui/impl-trait/in-trait/anonymize-binders-for-refine.rs b/tests/ui/impl-trait/in-trait/anonymize-binders-for-refine.rs new file mode 100644 index 000000000..e62662f2f --- /dev/null +++ b/tests/ui/impl-trait/in-trait/anonymize-binders-for-refine.rs @@ -0,0 +1,13 @@ +// compile-flags: --crate-type=lib +// check-pass + +#![feature(return_position_impl_trait_in_trait)] +#![deny(refining_impl_trait)] + +pub trait Tr { + fn foo() -> impl for<'a> Tr<&'a Self>; +} + +impl Tr for () { + fn foo() -> impl for<'a> Tr<&'a Self> {} +} diff --git a/tests/ui/impl-trait/in-trait/auxiliary/rpitit.rs b/tests/ui/impl-trait/in-trait/auxiliary/rpitit.rs index cfc2193f6..6e9940211 100644 --- a/tests/ui/impl-trait/in-trait/auxiliary/rpitit.rs +++ b/tests/ui/impl-trait/in-trait/auxiliary/rpitit.rs @@ -1,4 +1,4 @@ -#![feature(return_position_impl_trait_in_trait)] +#![feature(return_position_impl_trait_in_trait, lint_reasons)] use std::ops::Deref; @@ -8,6 +8,7 @@ pub trait Foo { pub struct Foreign; impl Foo for Foreign { + #[expect(refining_impl_trait)] fn bar(self) -> &'static () { &() } diff --git a/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit.rs b/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit.rs index ff7ad4bf3..fbbbb8585 100644 --- a/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit.rs +++ b/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit.rs @@ -2,7 +2,7 @@ #![feature(return_position_impl_trait_in_trait)] -trait Iterable { +pub trait Iterable { type Item<'a> where Self: 'a; @@ -17,6 +17,7 @@ impl<'a, I: 'a + Iterable> Iterable for &'a I { //~^ ERROR impl has stricter requirements than trait fn iter(&self) -> impl 'a + Iterator> { + //~^ WARN impl trait in impl method signature does not match trait method signature (*self).iter() } } diff --git a/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit.stderr b/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit.stderr index 106b8a7c8..a5fb338ea 100644 --- a/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit.stderr +++ b/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit.stderr @@ -12,6 +12,22 @@ help: copy the `where` clause predicates from the trait LL | where Self: 'b; | ~~~~~~~~~~~~~~ -error: aborting due to previous error +warning: impl trait in impl method signature does not match trait method signature + --> $DIR/bad-item-bound-within-rpitit.rs:19:28 + | +LL | fn iter(&self) -> impl '_ + Iterator>; + | ----------------------------------------- return type from trait method defined here +... +LL | fn iter(&self) -> impl 'a + Iterator> { + | ^^ this bound is stronger than that defined on the trait + | + = note: add `#[allow(refining_impl_trait)]` if it is intended for this to be part of the public API of this crate + = note: `#[warn(refining_impl_trait)]` on by default +help: replace the return type so that it matches the trait + | +LL | fn iter(&self) -> impl Iterator::Item<'_>> + '_ { + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +error: aborting due to previous error; 1 warning emitted For more information about this error, try `rustc --explain E0276`. diff --git a/tests/ui/impl-trait/in-trait/deep-match-works.rs b/tests/ui/impl-trait/in-trait/deep-match-works.rs index 78cff97c6..fc290f11f 100644 --- a/tests/ui/impl-trait/in-trait/deep-match-works.rs +++ b/tests/ui/impl-trait/in-trait/deep-match-works.rs @@ -1,15 +1,16 @@ // check-pass -#![feature(return_position_impl_trait_in_trait)] +#![feature(return_position_impl_trait_in_trait, lint_reasons)] #![allow(incomplete_features)] -struct Wrapper(T); +pub struct Wrapper(T); -trait Foo { +pub trait Foo { fn bar() -> Wrapper; } impl Foo for () { + #[expect(refining_impl_trait)] fn bar() -> Wrapper { Wrapper(0) } diff --git a/tests/ui/impl-trait/in-trait/foreign.rs b/tests/ui/impl-trait/in-trait/foreign.rs index b0c93a029..6285d7786 100644 --- a/tests/ui/impl-trait/in-trait/foreign.rs +++ b/tests/ui/impl-trait/in-trait/foreign.rs @@ -1,14 +1,25 @@ // check-pass // aux-build: rpitit.rs +#![feature(lint_reasons)] + extern crate rpitit; use rpitit::{Foo, Foreign}; use std::sync::Arc; // Implement an RPITIT from another crate. -struct Local; +pub struct Local; impl Foo for Local { + #[expect(refining_impl_trait)] + fn bar(self) -> Arc { + Arc::new(String::new()) + } +} + +struct LocalIgnoreRefining; +impl Foo for LocalIgnoreRefining { + #[deny(refining_impl_trait)] fn bar(self) -> Arc { Arc::new(String::new()) } @@ -23,4 +34,5 @@ fn main() { let &() = Foreign.bar(); let x: Arc = Local.bar(); + let x: Arc = LocalIgnoreRefining.bar(); } diff --git a/tests/ui/impl-trait/in-trait/issue-102140.stderr b/tests/ui/impl-trait/in-trait/issue-102140.stderr index 5d55b9fa4..18bb63745 100644 --- a/tests/ui/impl-trait/in-trait/issue-102140.stderr +++ b/tests/ui/impl-trait/in-trait/issue-102140.stderr @@ -6,7 +6,11 @@ LL | MyTrait::foo(&self) | | | required by a bound introduced by this call | - = help: the trait `MyTrait` is implemented for `Outer` +help: consider removing the leading `&`-reference + | +LL - MyTrait::foo(&self) +LL + MyTrait::foo(self) + | error[E0277]: the trait bound `&dyn MyTrait: MyTrait` is not satisfied --> $DIR/issue-102140.rs:23:9 diff --git a/tests/ui/impl-trait/in-trait/issue-102571.rs b/tests/ui/impl-trait/in-trait/issue-102571.rs index 61c91e644..ccb53031c 100644 --- a/tests/ui/impl-trait/in-trait/issue-102571.rs +++ b/tests/ui/impl-trait/in-trait/issue-102571.rs @@ -8,14 +8,6 @@ trait Foo { fn bar(self) -> impl Deref; } -struct A; - -impl Foo for A { - fn bar(self) -> &'static str { - "Hello, world" - } -} - fn foo(t: T) { let () = t.bar(); //~^ ERROR mismatched types diff --git a/tests/ui/impl-trait/in-trait/issue-102571.stderr b/tests/ui/impl-trait/in-trait/issue-102571.stderr index 87219941d..594b9ae9c 100644 --- a/tests/ui/impl-trait/in-trait/issue-102571.stderr +++ b/tests/ui/impl-trait/in-trait/issue-102571.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/issue-102571.rs:20:9 + --> $DIR/issue-102571.rs:12:9 | LL | let () = t.bar(); | ^^ ------- this expression has type `impl Deref` diff --git a/tests/ui/impl-trait/in-trait/lifetime-in-associated-trait-bound.rs b/tests/ui/impl-trait/in-trait/lifetime-in-associated-trait-bound.rs new file mode 100644 index 000000000..49d36d6c9 --- /dev/null +++ b/tests/ui/impl-trait/in-trait/lifetime-in-associated-trait-bound.rs @@ -0,0 +1,19 @@ +// check-pass + +#![feature(associated_type_bounds, return_position_impl_trait_in_trait)] + +trait Trait { + type Type; + + fn method(&self) -> impl Trait; +} + +impl Trait for () { + type Type = (); + + fn method(&self) -> impl Trait { + () + } +} + +fn main() {} diff --git a/tests/ui/impl-trait/in-trait/nested-rpitit.rs b/tests/ui/impl-trait/in-trait/nested-rpitit.rs index 65285e3a3..58ba1acaf 100644 --- a/tests/ui/impl-trait/in-trait/nested-rpitit.rs +++ b/tests/ui/impl-trait/in-trait/nested-rpitit.rs @@ -1,26 +1,28 @@ // check-pass -#![feature(return_position_impl_trait_in_trait)] +#![feature(return_position_impl_trait_in_trait, lint_reasons)] #![allow(incomplete_features)] use std::fmt::Display; use std::ops::Deref; -trait Foo { +pub trait Foo { fn bar(self) -> impl Deref; } -struct A; +pub struct A; impl Foo for A { + #[expect(refining_impl_trait)] fn bar(self) -> &'static str { "Hello, world" } } -struct B; +pub struct B; impl Foo for B { + #[expect(refining_impl_trait)] fn bar(self) -> Box { Box::new(42) } diff --git a/tests/ui/impl-trait/in-trait/object-safety-sized.rs b/tests/ui/impl-trait/in-trait/object-safety-sized.rs new file mode 100644 index 000000000..f221cfbb1 --- /dev/null +++ b/tests/ui/impl-trait/in-trait/object-safety-sized.rs @@ -0,0 +1,23 @@ +// check-pass +// revisions: current next +//[next] compile-flags: -Ztrait-solver=next + +#![feature(return_position_impl_trait_in_trait)] + +fn main() { + let vec: Vec> = Vec::new(); + + for i in vec { + i.fn_2(); + } +} + +trait OtherTrait {} + +trait Trait { + fn fn_1(&self) -> impl OtherTrait + where + Self: Sized; + + fn fn_2(&self) -> bool; +} diff --git a/tests/ui/impl-trait/in-trait/object-safety.rs b/tests/ui/impl-trait/in-trait/object-safety.rs index dd35b9a2d..d1c9fba4e 100644 --- a/tests/ui/impl-trait/in-trait/object-safety.rs +++ b/tests/ui/impl-trait/in-trait/object-safety.rs @@ -8,7 +8,7 @@ trait Foo { } impl Foo for u32 { - fn baz(&self) -> u32 { + fn baz(&self) -> impl Debug { 32 } } @@ -19,4 +19,5 @@ fn main() { //~| ERROR the trait `Foo` cannot be made into an object let s = i.baz(); //~^ ERROR the trait `Foo` cannot be made into an object + //~| ERROR the trait `Foo` cannot be made into an object } diff --git a/tests/ui/impl-trait/in-trait/object-safety.stderr b/tests/ui/impl-trait/in-trait/object-safety.stderr index 4a3b3b114..0170dc5d0 100644 --- a/tests/ui/impl-trait/in-trait/object-safety.stderr +++ b/tests/ui/impl-trait/in-trait/object-safety.stderr @@ -13,6 +13,21 @@ LL | fn baz(&self) -> impl Debug; | ^^^^^^^^^^ ...because method `baz` references an `impl Trait` type in its return type = help: consider moving `baz` to another trait +error[E0038]: the trait `Foo` cannot be made into an object + --> $DIR/object-safety.rs:20:15 + | +LL | let s = i.baz(); + | ^^^ `Foo` cannot be made into an object + | +note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit + --> $DIR/object-safety.rs:7:22 + | +LL | trait Foo { + | --- this trait cannot be made into an object... +LL | fn baz(&self) -> impl Debug; + | ^^^^^^^^^^ ...because method `baz` references an `impl Trait` type in its return type + = help: consider moving `baz` to another trait + error[E0038]: the trait `Foo` cannot be made into an object --> $DIR/object-safety.rs:20:13 | @@ -44,6 +59,6 @@ LL | fn baz(&self) -> impl Debug; = help: consider moving `baz` to another trait = note: required for the cast from `Box` to `Box` -error: aborting due to 3 previous errors +error: aborting due to 4 previous errors For more information about this error, try `rustc --explain E0038`. diff --git a/tests/ui/impl-trait/in-trait/refine.rs b/tests/ui/impl-trait/in-trait/refine.rs new file mode 100644 index 000000000..a91f9b3e7 --- /dev/null +++ b/tests/ui/impl-trait/in-trait/refine.rs @@ -0,0 +1,48 @@ +#![feature(return_position_impl_trait_in_trait, async_fn_in_trait)] +#![deny(refining_impl_trait)] + +pub trait Foo { + fn bar() -> impl Sized; +} + +pub struct A; +impl Foo for A { + fn bar() -> impl Copy {} + //~^ ERROR impl method signature does not match trait method signature +} + +pub struct B; +impl Foo for B { + fn bar() {} + //~^ ERROR impl method signature does not match trait method signature +} + +pub struct C; +impl Foo for C { + fn bar() -> () {} + //~^ ERROR impl method signature does not match trait method signature +} + +struct Private; +impl Foo for Private { + fn bar() -> () {} +} + +pub trait Arg { + fn bar() -> impl Sized; +} +impl Arg for A { + fn bar() -> () {} +} + +pub trait Late { + fn bar<'a>(&'a self) -> impl Sized + 'a; +} + +pub struct D; +impl Late for D { + fn bar(&self) -> impl Copy + '_ {} + //~^ ERROR impl method signature does not match trait method signature +} + +fn main() {} diff --git a/tests/ui/impl-trait/in-trait/refine.stderr b/tests/ui/impl-trait/in-trait/refine.stderr new file mode 100644 index 000000000..29aa08e25 --- /dev/null +++ b/tests/ui/impl-trait/in-trait/refine.stderr @@ -0,0 +1,67 @@ +error: impl trait in impl method signature does not match trait method signature + --> $DIR/refine.rs:10:22 + | +LL | fn bar() -> impl Sized; + | ---------- return type from trait method defined here +... +LL | fn bar() -> impl Copy {} + | ^^^^ this bound is stronger than that defined on the trait + | + = note: add `#[allow(refining_impl_trait)]` if it is intended for this to be part of the public API of this crate +note: the lint level is defined here + --> $DIR/refine.rs:2:9 + | +LL | #![deny(refining_impl_trait)] + | ^^^^^^^^^^^^^^^^^^^ +help: replace the return type so that it matches the trait + | +LL | fn bar() -> impl Sized {} + | ~~~~~~~~~~ + +error: impl trait in impl method signature does not match trait method signature + --> $DIR/refine.rs:16:5 + | +LL | fn bar() -> impl Sized; + | ---------- return type from trait method defined here +... +LL | fn bar() {} + | ^^^^^^^^ + | + = note: add `#[allow(refining_impl_trait)]` if it is intended for this to be part of the public API of this crate +help: replace the return type so that it matches the trait + | +LL | fn bar() -> impl Sized {} + | +++++++++++++ + +error: impl trait in impl method signature does not match trait method signature + --> $DIR/refine.rs:22:17 + | +LL | fn bar() -> impl Sized; + | ---------- return type from trait method defined here +... +LL | fn bar() -> () {} + | ^^ + | + = note: add `#[allow(refining_impl_trait)]` if it is intended for this to be part of the public API of this crate +help: replace the return type so that it matches the trait + | +LL | fn bar() -> impl Sized {} + | ~~~~~~~~~~ + +error: impl trait in impl method signature does not match trait method signature + --> $DIR/refine.rs:44:27 + | +LL | fn bar<'a>(&'a self) -> impl Sized + 'a; + | --------------- return type from trait method defined here +... +LL | fn bar(&self) -> impl Copy + '_ {} + | ^^^^ this bound is stronger than that defined on the trait + | + = note: add `#[allow(refining_impl_trait)]` if it is intended for this to be part of the public API of this crate +help: replace the return type so that it matches the trait + | +LL | fn bar(&self) -> impl Sized + '_ {} + | ~~~~~~~~~~~~~~~ + +error: aborting due to 4 previous errors + diff --git a/tests/ui/impl-trait/in-trait/reveal.rs b/tests/ui/impl-trait/in-trait/reveal.rs index d6ede1cc4..b1b46d75b 100644 --- a/tests/ui/impl-trait/in-trait/reveal.rs +++ b/tests/ui/impl-trait/in-trait/reveal.rs @@ -1,13 +1,14 @@ // check-pass -#![feature(return_position_impl_trait_in_trait)] +#![feature(return_position_impl_trait_in_trait, lint_reasons)] #![allow(incomplete_features)] -trait Foo { +pub trait Foo { fn f() -> Box; } impl Foo for () { + #[expect(refining_impl_trait)] fn f() -> Box { Box::new(String::new()) } diff --git a/tests/ui/impl-trait/in-trait/rpitit-hidden-types-self-implied-wf-via-param.rs b/tests/ui/impl-trait/in-trait/rpitit-hidden-types-self-implied-wf-via-param.rs new file mode 100644 index 000000000..5e14a7f8e --- /dev/null +++ b/tests/ui/impl-trait/in-trait/rpitit-hidden-types-self-implied-wf-via-param.rs @@ -0,0 +1,26 @@ +#![feature(return_position_impl_trait_in_trait)] + +trait Extend { + fn extend<'a: 'a>(_: &'a str) -> (impl Sized + 'a, &'static str); +} + +impl Extend for () { + fn extend<'a: 'a>(s: &'a str) -> (Option<&'static &'a ()>, &'static str) + //~^ ERROR in type `&'static &'a ()`, reference has a longer lifetime than the data it references + where + 'a: 'static, + { + (None, s) + } +} + +// This indirection is not necessary for reproduction, +// but it makes this test future-proof against #114936. +fn extend(s: &str) -> &'static str { + ::extend(s).1 +} + +fn main() { + let use_after_free = extend::<()>(&String::from("temporary")); + println!("{}", use_after_free); +} diff --git a/tests/ui/impl-trait/in-trait/rpitit-hidden-types-self-implied-wf-via-param.stderr b/tests/ui/impl-trait/in-trait/rpitit-hidden-types-self-implied-wf-via-param.stderr new file mode 100644 index 000000000..1d947310e --- /dev/null +++ b/tests/ui/impl-trait/in-trait/rpitit-hidden-types-self-implied-wf-via-param.stderr @@ -0,0 +1,16 @@ +error[E0491]: in type `&'static &'a ()`, reference has a longer lifetime than the data it references + --> $DIR/rpitit-hidden-types-self-implied-wf-via-param.rs:8:38 + | +LL | fn extend<'a: 'a>(s: &'a str) -> (Option<&'static &'a ()>, &'static str) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: the pointer is valid for the static lifetime +note: but the referenced data is only valid for the lifetime `'a` as defined here + --> $DIR/rpitit-hidden-types-self-implied-wf-via-param.rs:8:15 + | +LL | fn extend<'a: 'a>(s: &'a str) -> (Option<&'static &'a ()>, &'static str) + | ^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0491`. diff --git a/tests/ui/impl-trait/in-trait/rpitit-hidden-types-self-implied-wf.rs b/tests/ui/impl-trait/in-trait/rpitit-hidden-types-self-implied-wf.rs new file mode 100644 index 000000000..c1885af4e --- /dev/null +++ b/tests/ui/impl-trait/in-trait/rpitit-hidden-types-self-implied-wf.rs @@ -0,0 +1,23 @@ +#![feature(return_position_impl_trait_in_trait)] + +trait Extend { + fn extend(_: &str) -> (impl Sized + '_, &'static str); +} + +impl Extend for () { + fn extend(s: &str) -> (Option<&'static &'_ ()>, &'static str) { + //~^ ERROR in type `&'static &()`, reference has a longer lifetime than the data it references + (None, s) + } +} + +// This indirection is not necessary for reproduction, +// but it makes this test future-proof against #114936. +fn extend(s: &str) -> &'static str { + ::extend(s).1 +} + +fn main() { + let use_after_free = extend::<()>(&String::from("temporary")); + println!("{}", use_after_free); +} diff --git a/tests/ui/impl-trait/in-trait/rpitit-hidden-types-self-implied-wf.stderr b/tests/ui/impl-trait/in-trait/rpitit-hidden-types-self-implied-wf.stderr new file mode 100644 index 000000000..7b63e72ac --- /dev/null +++ b/tests/ui/impl-trait/in-trait/rpitit-hidden-types-self-implied-wf.stderr @@ -0,0 +1,16 @@ +error[E0491]: in type `&'static &()`, reference has a longer lifetime than the data it references + --> $DIR/rpitit-hidden-types-self-implied-wf.rs:8:27 + | +LL | fn extend(s: &str) -> (Option<&'static &'_ ()>, &'static str) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: the pointer is valid for the static lifetime +note: but the referenced data is only valid for the anonymous lifetime defined here + --> $DIR/rpitit-hidden-types-self-implied-wf.rs:8:18 + | +LL | fn extend(s: &str) -> (Option<&'static &'_ ()>, &'static str) { + | ^^^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0491`. diff --git a/tests/ui/impl-trait/in-trait/rpitit-shadowed-by-missing-adt.rs b/tests/ui/impl-trait/in-trait/rpitit-shadowed-by-missing-adt.rs index 7682884f8..44a2b4303 100644 --- a/tests/ui/impl-trait/in-trait/rpitit-shadowed-by-missing-adt.rs +++ b/tests/ui/impl-trait/in-trait/rpitit-shadowed-by-missing-adt.rs @@ -1,6 +1,6 @@ // issue: 113903 -#![feature(return_position_impl_trait_in_trait)] +#![feature(return_position_impl_trait_in_trait, lint_reasons)] use std::ops::Deref; @@ -10,6 +10,7 @@ pub trait Tr { } impl Tr for () { + #[expect(refining_impl_trait)] fn w() -> &'static () { &() } diff --git a/tests/ui/impl-trait/in-trait/signature-mismatch.failure.stderr b/tests/ui/impl-trait/in-trait/signature-mismatch.failure.stderr new file mode 100644 index 000000000..468cf12f1 --- /dev/null +++ b/tests/ui/impl-trait/in-trait/signature-mismatch.failure.stderr @@ -0,0 +1,14 @@ +error[E0623]: lifetime mismatch + --> $DIR/signature-mismatch.rs:79:10 + | +LL | &'a self, + | -------- this parameter and the return type are declared with different lifetimes... +... +LL | ) -> impl Future> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | | + | ...but data from `buff` is returned here + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0623`. diff --git a/tests/ui/impl-trait/in-trait/signature-mismatch.rs b/tests/ui/impl-trait/in-trait/signature-mismatch.rs index 1d63a6f3c..685c0f06e 100644 --- a/tests/ui/impl-trait/in-trait/signature-mismatch.rs +++ b/tests/ui/impl-trait/in-trait/signature-mismatch.rs @@ -1,26 +1,36 @@ // edition:2021 +// revisions: success failure +//[success] check-pass -#![feature(return_position_impl_trait_in_trait)] -#![allow(incomplete_features)] +#![feature(return_position_impl_trait_in_trait, lint_reasons)] use std::future::Future; -trait Captures<'a> {} +pub trait Captures<'a> {} impl Captures<'_> for T {} -trait Captures2<'a, 'b> {} +pub trait Captures2<'a, 'b> {} impl Captures2<'_, '_> for T {} pub trait AsyncTrait { + #[cfg(success)] fn async_fn(&self, buff: &[u8]) -> impl Future>; + + #[cfg(success)] fn async_fn_early<'a: 'a>(&self, buff: &'a [u8]) -> impl Future>; + + #[cfg(success)] fn async_fn_multiple<'a>(&'a self, buff: &[u8]) - -> impl Future> + Captures<'a>; + -> impl Future> + Captures<'a>; + + #[cfg(failure)] fn async_fn_reduce_outlive<'a, T>( &'a self, buff: &[u8], t: T, ) -> impl Future> + 'a; + + #[cfg(success)] fn async_fn_reduce<'a, T>( &'a self, buff: &[u8], @@ -31,38 +41,52 @@ pub trait AsyncTrait { pub struct Struct; impl AsyncTrait for Struct { + // Does not capture more lifetimes that trait def'n, since trait def'n + // implicitly captures all in-scope lifetimes. + #[cfg(success)] + #[expect(refining_impl_trait)] fn async_fn<'a>(&self, buff: &'a [u8]) -> impl Future> + 'a { - //~^ ERROR return type captures more lifetimes than trait definition async move { buff.to_vec() } } + // Does not capture more lifetimes that trait def'n, since trait def'n + // implicitly captures all in-scope lifetimes. + #[cfg(success)] + #[expect(refining_impl_trait)] fn async_fn_early<'a: 'a>(&self, buff: &'a [u8]) -> impl Future> + 'a { - //~^ ERROR return type captures more lifetimes than trait definition async move { buff.to_vec() } } + // Does not capture more lifetimes that trait def'n, since trait def'n + // implicitly captures all in-scope lifetimes. + #[cfg(success)] + #[expect(refining_impl_trait)] fn async_fn_multiple<'a, 'b>( &'a self, buff: &'b [u8], ) -> impl Future> + Captures2<'a, 'b> { - //~^ ERROR return type captures more lifetimes than trait definition async move { buff.to_vec() } } + // This error message is awkward, but `impl Future>` + // cannot outlive `'a` (from the trait signature) because it captures + // both `T` and `'b`. + #[cfg(failure)] fn async_fn_reduce_outlive<'a, 'b, T>( &'a self, buff: &'b [u8], t: T, ) -> impl Future> { - //~^ ERROR the parameter type `T` may not live long enough + //[failure]~^ ERROR lifetime mismatch async move { let _t = t; vec![] } } - // OK: We remove the `Captures<'a>`, providing a guarantee that we don't capture `'a`, - // but we still fulfill the `Captures<'a>` trait bound. + // Does not capture fewer lifetimes that trait def'n (not that it matters), + // since impl also captures all in-scope lifetimes. + #[cfg(success)] fn async_fn_reduce<'a, 'b, T>(&'a self, buff: &'b [u8], t: T) -> impl Future> { async move { let _t = t; diff --git a/tests/ui/impl-trait/in-trait/signature-mismatch.stderr b/tests/ui/impl-trait/in-trait/signature-mismatch.stderr deleted file mode 100644 index 616f1ac35..000000000 --- a/tests/ui/impl-trait/in-trait/signature-mismatch.stderr +++ /dev/null @@ -1,61 +0,0 @@ -error: return type captures more lifetimes than trait definition - --> $DIR/signature-mismatch.rs:34:47 - | -LL | fn async_fn<'a>(&self, buff: &'a [u8]) -> impl Future> + 'a { - | -- this lifetime was captured ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | -note: hidden type must only reference lifetimes captured by this impl trait - --> $DIR/signature-mismatch.rs:15:40 - | -LL | fn async_fn(&self, buff: &[u8]) -> impl Future>; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = note: hidden type inferred to be `impl Future> + 'a` - -error: return type captures more lifetimes than trait definition - --> $DIR/signature-mismatch.rs:39:57 - | -LL | fn async_fn_early<'a: 'a>(&self, buff: &'a [u8]) -> impl Future> + 'a { - | -- this lifetime was captured ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | -note: hidden type must only reference lifetimes captured by this impl trait - --> $DIR/signature-mismatch.rs:16:57 - | -LL | fn async_fn_early<'a: 'a>(&self, buff: &'a [u8]) -> impl Future>; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = note: hidden type inferred to be `impl Future> + 'a` - -error: return type captures more lifetimes than trait definition - --> $DIR/signature-mismatch.rs:47:10 - | -LL | fn async_fn_multiple<'a, 'b>( - | -- this lifetime was captured -... -LL | ) -> impl Future> + Captures2<'a, 'b> { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | -note: hidden type must only reference lifetimes captured by this impl trait - --> $DIR/signature-mismatch.rs:18:12 - | -LL | -> impl Future> + Captures<'a>; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = note: hidden type inferred to be `impl Future> + Captures2<'a, 'b>` - -error[E0309]: the parameter type `T` may not live long enough - --> $DIR/signature-mismatch.rs:56:10 - | -LL | ) -> impl Future> { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...so that the type `impl Future>` will meet its required lifetime bounds... - | -note: ...that is required by this bound - --> $DIR/signature-mismatch.rs:23:42 - | -LL | ) -> impl Future> + 'a; - | ^^ -help: consider adding an explicit lifetime bound... - | -LL | fn async_fn_reduce_outlive<'a, 'b, T: 'a>( - | ++++ - -error: aborting due to 4 previous errors - -For more information about this error, try `rustc --explain E0309`. diff --git a/tests/ui/impl-trait/in-trait/specialization-substs-remap.rs b/tests/ui/impl-trait/in-trait/specialization-substs-remap.rs index c9ee877db..41fc28588 100644 --- a/tests/ui/impl-trait/in-trait/specialization-substs-remap.rs +++ b/tests/ui/impl-trait/in-trait/specialization-substs-remap.rs @@ -1,10 +1,10 @@ // check-pass #![feature(specialization)] -#![feature(return_position_impl_trait_in_trait)] +#![feature(return_position_impl_trait_in_trait, lint_reasons)] #![allow(incomplete_features)] -trait Foo { +pub trait Foo { fn bar(&self) -> impl Sized; } @@ -12,6 +12,7 @@ impl Foo for U where U: Copy, { + #[expect(refining_impl_trait)] fn bar(&self) -> U { *self } diff --git a/tests/ui/impl-trait/in-trait/success.rs b/tests/ui/impl-trait/in-trait/success.rs index 4cbe682b4..7d415ea17 100644 --- a/tests/ui/impl-trait/in-trait/success.rs +++ b/tests/ui/impl-trait/in-trait/success.rs @@ -1,29 +1,32 @@ // check-pass -#![feature(return_position_impl_trait_in_trait)] +#![feature(return_position_impl_trait_in_trait, lint_reasons)] #![allow(incomplete_features)] use std::fmt::Display; -trait Foo { +pub trait Foo { fn bar(&self) -> impl Display; } impl Foo for i32 { + #[expect(refining_impl_trait)] fn bar(&self) -> i32 { *self } } impl Foo for &'static str { + #[expect(refining_impl_trait)] fn bar(&self) -> &'static str { *self } } -struct Yay; +pub struct Yay; impl Foo for Yay { + #[expect(refining_impl_trait)] fn bar(&self) -> String { String::from(":^)") } diff --git a/tests/ui/impl-trait/in-trait/variance.rs b/tests/ui/impl-trait/in-trait/variance.rs new file mode 100644 index 000000000..f8e4ab88c --- /dev/null +++ b/tests/ui/impl-trait/in-trait/variance.rs @@ -0,0 +1,20 @@ +#![feature(rustc_attrs, return_position_impl_trait_in_trait)] +#![allow(internal_features)] +#![rustc_variance_of_opaques] + +trait Captures<'a> {} +impl Captures<'_> for T {} + +trait Foo<'i> { + fn implicit_capture_early<'a: 'a>() -> impl Sized {} + //~^ [o, *, *, o, o] + // Self, 'i, 'a, 'i_duplicated, 'a_duplicated + + fn explicit_capture_early<'a: 'a>() -> impl Sized + Captures<'a> {} //~ [o, *, *, o, o] + + fn implicit_capture_late<'a>(_: &'a ()) -> impl Sized {} //~ [o, *, o, o] + + fn explicit_capture_late<'a>(_: &'a ()) -> impl Sized + Captures<'a> {} //~ [o, *, o, o] +} + +fn main() {} diff --git a/tests/ui/impl-trait/in-trait/variance.stderr b/tests/ui/impl-trait/in-trait/variance.stderr new file mode 100644 index 000000000..8cae5a92f --- /dev/null +++ b/tests/ui/impl-trait/in-trait/variance.stderr @@ -0,0 +1,26 @@ +error: [o, *, *, o, o] + --> $DIR/variance.rs:9:44 + | +LL | fn implicit_capture_early<'a: 'a>() -> impl Sized {} + | ^^^^^^^^^^ + +error: [o, *, *, o, o] + --> $DIR/variance.rs:13:44 + | +LL | fn explicit_capture_early<'a: 'a>() -> impl Sized + Captures<'a> {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: [o, *, o, o] + --> $DIR/variance.rs:15:48 + | +LL | fn implicit_capture_late<'a>(_: &'a ()) -> impl Sized {} + | ^^^^^^^^^^ + +error: [o, *, o, o] + --> $DIR/variance.rs:17:48 + | +LL | fn explicit_capture_late<'a>(_: &'a ()) -> impl Sized + Captures<'a> {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 4 previous errors + diff --git a/tests/ui/impl-trait/issue-103181-2.rs b/tests/ui/impl-trait/issue-103181-2.rs index 34deb98be..b43ac4507 100644 --- a/tests/ui/impl-trait/issue-103181-2.rs +++ b/tests/ui/impl-trait/issue-103181-2.rs @@ -24,8 +24,6 @@ where B: Send, // <- a second bound { normalize(broken_fut(), ()); - //~^ ERROR: cannot check whether the hidden type of opaque type satisfies auto traits - //~| ERROR: cannot check whether the hidden type of opaque type satisfies auto traits } fn main() {} diff --git a/tests/ui/impl-trait/issue-103181-2.stderr b/tests/ui/impl-trait/issue-103181-2.stderr index cb5253ea6..5eb2dd918 100644 --- a/tests/ui/impl-trait/issue-103181-2.stderr +++ b/tests/ui/impl-trait/issue-103181-2.stderr @@ -4,61 +4,6 @@ error[E0425]: cannot find value `ident_error` in this scope LL | ident_error; | ^^^^^^^^^^^ not found in this scope -error: cannot check whether the hidden type of opaque type satisfies auto traits - --> $DIR/issue-103181-2.rs:26:15 - | -LL | normalize(broken_fut(), ()); - | --------- ^^^^^^^^^^^^ - | | - | required by a bound introduced by this call - | -note: opaque type is declared here - --> $DIR/issue-103181-2.rs:11:23 - | -LL | async fn broken_fut() { - | ^ -note: this item depends on auto traits of the hidden type, but may also be registering the hidden type. This is not supported right now. You can try moving the opaque type and the item that actually registers a hidden type into a new submodule - --> $DIR/issue-103181-2.rs:20:10 - | -LL | async fn iceice() - | ^^^^^^ -note: required for `impl Future` to implement `SendFuture` - --> $DIR/issue-103181-2.rs:7:17 - | -LL | impl SendFuture for Fut { - | ---- ^^^^^^^^^^ ^^^ - | | - | unsatisfied trait bound introduced here -note: required by a bound in `normalize` - --> $DIR/issue-103181-2.rs:18:19 - | -LL | fn normalize(_: Fut, _: Fut::Output) {} - | ^^^^^^^^^^ required by this bound in `normalize` - -error: cannot check whether the hidden type of opaque type satisfies auto traits - --> $DIR/issue-103181-2.rs:26:5 - | -LL | normalize(broken_fut(), ()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | -note: opaque type is declared here - --> $DIR/issue-103181-2.rs:11:23 - | -LL | async fn broken_fut() { - | ^ -note: this item depends on auto traits of the hidden type, but may also be registering the hidden type. This is not supported right now. You can try moving the opaque type and the item that actually registers a hidden type into a new submodule - --> $DIR/issue-103181-2.rs:20:10 - | -LL | async fn iceice() - | ^^^^^^ -note: required for `impl Future` to implement `SendFuture` - --> $DIR/issue-103181-2.rs:7:17 - | -LL | impl SendFuture for Fut { - | ---- ^^^^^^^^^^ ^^^ - | | - | unsatisfied trait bound introduced here - -error: aborting due to 3 previous errors +error: aborting due to previous error For more information about this error, try `rustc --explain E0425`. diff --git a/tests/ui/impl-trait/issue-108591.rs b/tests/ui/impl-trait/issue-108591.rs index 6b9d14941..91ea2e9fb 100644 --- a/tests/ui/impl-trait/issue-108591.rs +++ b/tests/ui/impl-trait/issue-108591.rs @@ -13,7 +13,8 @@ impl MyTy<'_> { } } -type Opaque<'a> = impl Sized; +type Opaque2 = impl Sized; +type Opaque<'a> = Opaque2; fn define<'a>() -> Opaque<'a> {} fn test<'a>() { diff --git a/tests/ui/impl-trait/issue-108592.rs b/tests/ui/impl-trait/issue-108592.rs index 58a0ed9bf..953fffc48 100644 --- a/tests/ui/impl-trait/issue-108592.rs +++ b/tests/ui/impl-trait/issue-108592.rs @@ -11,7 +11,8 @@ fn test_closure() { closure(&opaque()); } -type Opaque<'a> = impl Sized; +type Opaque2 = impl Sized; +type Opaque<'a> = Opaque2; fn define<'a>() -> Opaque<'a> {} fn test_tait(_: &Opaque<'_>) { diff --git a/tests/ui/impl-trait/issue-55872-2.drop_tracking.stderr b/tests/ui/impl-trait/issue-55872-2.drop_tracking.stderr deleted file mode 100644 index 477c964bd..000000000 --- a/tests/ui/impl-trait/issue-55872-2.drop_tracking.stderr +++ /dev/null @@ -1,8 +0,0 @@ -error: type parameter `T` is part of concrete type but not used in parameter list for the `impl Trait` type alias - --> $DIR/issue-55872-2.rs:17:9 - | -LL | async {} - | ^^^^^^^^ - -error: aborting due to previous error - diff --git a/tests/ui/impl-trait/issue-55872-2.drop_tracking_mir.stderr b/tests/ui/impl-trait/issue-55872-2.drop_tracking_mir.stderr deleted file mode 100644 index c14bb5cc9..000000000 --- a/tests/ui/impl-trait/issue-55872-2.drop_tracking_mir.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error: type parameter `T` is part of concrete type but not used in parameter list for the `impl Trait` type alias - --> $DIR/issue-55872-2.rs:17:9 - | -LL | async {} - | ^^^^^^^^ - -error: type parameter `T` is part of concrete type but not used in parameter list for the `impl Trait` type alias - --> $DIR/issue-55872-2.rs:17:9 - | -LL | async {} - | ^^^^^^^^ - -error: aborting due to 2 previous errors - diff --git a/tests/ui/impl-trait/issue-55872-2.no_drop_tracking.stderr b/tests/ui/impl-trait/issue-55872-2.no_drop_tracking.stderr deleted file mode 100644 index 477c964bd..000000000 --- a/tests/ui/impl-trait/issue-55872-2.no_drop_tracking.stderr +++ /dev/null @@ -1,8 +0,0 @@ -error: type parameter `T` is part of concrete type but not used in parameter list for the `impl Trait` type alias - --> $DIR/issue-55872-2.rs:17:9 - | -LL | async {} - | ^^^^^^^^ - -error: aborting due to previous error - diff --git a/tests/ui/impl-trait/issue-55872-2.rs b/tests/ui/impl-trait/issue-55872-2.rs index 7a5cb3b3d..8a96fdc5c 100644 --- a/tests/ui/impl-trait/issue-55872-2.rs +++ b/tests/ui/impl-trait/issue-55872-2.rs @@ -1,6 +1,3 @@ -// revisions: no_drop_tracking drop_tracking drop_tracking_mir -// [drop_tracking] compile-flags: -Zdrop-tracking -// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir // edition:2018 #![feature(impl_trait_in_assoc_type)] @@ -16,7 +13,7 @@ impl Bar for S { fn foo() -> Self::E { async {} //~^ ERROR type parameter `T` is part of concrete type but not used in parameter list for the `impl Trait` type alias - //[drop_tracking_mir]~^^ ERROR type parameter `T` is part of concrete type but not used in parameter list for the `impl Trait` type alias + //~| ERROR type parameter `T` is part of concrete type but not used in parameter list for the `impl Trait` type alias } } diff --git a/tests/ui/impl-trait/issue-55872-2.stderr b/tests/ui/impl-trait/issue-55872-2.stderr new file mode 100644 index 000000000..3e70f1cf8 --- /dev/null +++ b/tests/ui/impl-trait/issue-55872-2.stderr @@ -0,0 +1,14 @@ +error: type parameter `T` is part of concrete type but not used in parameter list for the `impl Trait` type alias + --> $DIR/issue-55872-2.rs:14:9 + | +LL | async {} + | ^^^^^^^^ + +error: type parameter `T` is part of concrete type but not used in parameter list for the `impl Trait` type alias + --> $DIR/issue-55872-2.rs:14:9 + | +LL | async {} + | ^^^^^^^^ + +error: aborting due to 2 previous errors + diff --git a/tests/ui/impl-trait/issue-55872-3.stderr b/tests/ui/impl-trait/issue-55872-3.stderr index 827988974..b542b6141 100644 --- a/tests/ui/impl-trait/issue-55872-3.stderr +++ b/tests/ui/impl-trait/issue-55872-3.stderr @@ -1,8 +1,8 @@ -error[E0277]: the trait bound `[async block@$DIR/issue-55872-3.rs:15:9: 15:17]: Copy` is not satisfied +error[E0277]: the trait bound `{async block@$DIR/issue-55872-3.rs:15:9: 15:17}: Copy` is not satisfied --> $DIR/issue-55872-3.rs:13:20 | LL | fn foo() -> Self::E { - | ^^^^^^^ the trait `Copy` is not implemented for `[async block@$DIR/issue-55872-3.rs:15:9: 15:17]` + | ^^^^^^^ the trait `Copy` is not implemented for `{async block@$DIR/issue-55872-3.rs:15:9: 15:17}` error: aborting due to previous error diff --git a/tests/ui/impl-trait/issue-86465.rs b/tests/ui/impl-trait/issue-86465.rs index 8c7b41d73..a79bb6474 100644 --- a/tests/ui/impl-trait/issue-86465.rs +++ b/tests/ui/impl-trait/issue-86465.rs @@ -1,10 +1,6 @@ #![feature(type_alias_impl_trait)] -pub trait Captures<'a> {} - -impl<'a, T: ?Sized> Captures<'a> for T {} - -type X<'a, 'b> = impl std::fmt::Debug + Captures<'a> + Captures<'b>; +type X<'a, 'b> = impl std::fmt::Debug; fn f<'t, 'u>(a: &'t u32, b: &'u u32) -> (X<'t, 'u>, X<'u, 't>) { (a, a) diff --git a/tests/ui/impl-trait/issue-86465.stderr b/tests/ui/impl-trait/issue-86465.stderr index b949b2b42..90d6904ed 100644 --- a/tests/ui/impl-trait/issue-86465.stderr +++ b/tests/ui/impl-trait/issue-86465.stderr @@ -1,5 +1,5 @@ error: concrete type differs from previous defining opaque type use - --> $DIR/issue-86465.rs:10:5 + --> $DIR/issue-86465.rs:6:5 | LL | (a, a) | ^^^^^^ diff --git a/tests/ui/impl-trait/issue-99073.stderr b/tests/ui/impl-trait/issue-99073.stderr index a8400080e..3c32f1794 100644 --- a/tests/ui/impl-trait/issue-99073.stderr +++ b/tests/ui/impl-trait/issue-99073.stderr @@ -10,7 +10,7 @@ error: concrete type differs from previous defining opaque type use --> $DIR/issue-99073.rs:6:13 | LL | move || f(fix(&f)) - | ^^^^^^^ expected `[closure@$DIR/issue-99073.rs:6:3: 6:10]`, got `G` + | ^^^^^^^ expected `{closure@$DIR/issue-99073.rs:6:3: 6:10}`, got `G` | note: previous use here --> $DIR/issue-99073.rs:5:36 diff --git a/tests/ui/impl-trait/issues/issue-74282.stderr b/tests/ui/impl-trait/issues/issue-74282.stderr index d43e9fee0..f8e85f7ae 100644 --- a/tests/ui/impl-trait/issues/issue-74282.stderr +++ b/tests/ui/impl-trait/issues/issue-74282.stderr @@ -14,7 +14,7 @@ LL | | }) | |_____^ expected opaque type, found closure | = note: expected opaque type `Closure` - found closure `[closure@$DIR/issue-74282.rs:8:15: 8:17]` + found closure `{closure@$DIR/issue-74282.rs:8:15: 8:17}` = note: no two closures, even if identical, have the same type = help: consider boxing your closure and/or using it as a trait object note: tuple struct defined here diff --git a/tests/ui/impl-trait/issues/issue-78722-2.stderr b/tests/ui/impl-trait/issues/issue-78722-2.stderr index 6db603e77..8817eb7d2 100644 --- a/tests/ui/impl-trait/issues/issue-78722-2.stderr +++ b/tests/ui/impl-trait/issues/issue-78722-2.stderr @@ -7,7 +7,7 @@ LL | let f: F = async { 1 }; = note: see issue #85368 for more information = help: add `#![feature(const_async_blocks)]` to the crate attributes to enable -error[E0271]: expected `[async block@$DIR/issue-78722-2.rs:13:13: 13:21]` to be a future that resolves to `u8`, but it resolves to `()` +error[E0271]: expected `{async block@$DIR/issue-78722-2.rs:13:13: 13:21}` to be a future that resolves to `u8`, but it resolves to `()` --> $DIR/issue-78722-2.rs:11:30 | LL | fn concrete_use() -> F { diff --git a/tests/ui/impl-trait/issues/issue-78722.stderr b/tests/ui/impl-trait/issues/issue-78722.stderr index 36340a0ba..5ad659697 100644 --- a/tests/ui/impl-trait/issues/issue-78722.stderr +++ b/tests/ui/impl-trait/issues/issue-78722.stderr @@ -7,7 +7,7 @@ LL | let f: F = async { 1 }; = note: see issue #85368 for more information = help: add `#![feature(const_async_blocks)]` to the crate attributes to enable -error[E0271]: expected `[async block@$DIR/issue-78722.rs:10:13: 10:21]` to be a future that resolves to `u8`, but it resolves to `()` +error[E0271]: expected `{async block@$DIR/issue-78722.rs:10:13: 10:21}` to be a future that resolves to `u8`, but it resolves to `()` --> $DIR/issue-78722.rs:8:30 | LL | fn concrete_use() -> F { diff --git a/tests/ui/impl-trait/issues/issue-86800.stderr b/tests/ui/impl-trait/issues/issue-86800.stderr index facab390d..8228f8ace 100644 --- a/tests/ui/impl-trait/issues/issue-86800.stderr +++ b/tests/ui/impl-trait/issues/issue-86800.stderr @@ -7,6 +7,6 @@ LL | type TransactionFuture<'__, O> = impl '__ + Future