File tree Expand file tree Collapse file tree 7 files changed +7
-46
lines changed
compiler/rustc_ty_utils/src Expand file tree Collapse file tree 7 files changed +7
-46
lines changed Original file line number Diff line number Diff line change @@ -233,6 +233,9 @@ impl<'tcx> TypeVisitor<TyCtxt<'tcx>> for OpaqueTypeCollector<'tcx> {
233233 self . visit_opaque_ty ( alias_ty) ;
234234 }
235235 ty:: Alias ( ty:: Projection , alias_ty) => {
236+ if let CollectionMode :: TypeAliasImplTraitTransition = self . mode {
237+ return ControlFlow :: Continue ( ( ) ) ;
238+ }
236239 // This avoids having to do normalization of `Self::AssocTy` by only
237240 // supporting the case of a method defining opaque types from assoc types
238241 // in the same impl block.
Original file line number Diff line number Diff line change @@ -20,5 +20,4 @@ impl<'a> A<'a> for C {
2020
2121 fn a ( & ' a self ) -> Self :: B < ' a > { } //~ ERROR: non-defining opaque type use in defining scope
2222 //~^ ERROR: non-defining opaque type use in defining scope
23- //~| ERROR: non-defining opaque type use in defining scope
2423}
Original file line number Diff line number Diff line change @@ -10,19 +10,6 @@ note: for this opaque type
1010LL | type B<'b> = impl Clone;
1111 | ^^^^^^^^^^
1212
13- error: non-defining opaque type use in defining scope
14- --> $DIR/issue-88595.rs:21:23
15- |
16- LL | fn a(&'a self) -> Self::B<'a> {}
17- | ^^^^^^^^^^^ generic argument `'a` used twice
18- |
19- note: for this opaque type
20- --> $DIR/issue-88595.rs:19:18
21- |
22- LL | type B<'b> = impl Clone;
23- | ^^^^^^^^^^
24- = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
25-
2613error: non-defining opaque type use in defining scope
2714 --> $DIR/issue-88595.rs:21:35
2815 |
@@ -37,5 +24,5 @@ LL | impl<'a> A<'a> for C {
3724LL | type B<'b> = impl Clone;
3825 | ^^
3926
40- error: aborting due to 3 previous errors
27+ error: aborting due to 2 previous errors
4128
Original file line number Diff line number Diff line change @@ -16,7 +16,6 @@ impl Foo for () {
1616 type Baz = impl Sized ;
1717 fn foo ( ) -> ( Self :: Bar < u32 > , Self :: Baz ) {
1818 //~^ ERROR non-defining opaque type use
19- //~| ERROR non-defining opaque type use
2019 ( ( ) , ( ) )
2120 //~^ ERROR expected generic type parameter
2221 }
Original file line number Diff line number Diff line change @@ -10,28 +10,15 @@ note: for this opaque type
1010LL | type Bar<T> = impl Sized;
1111 | ^^^^^^^^^^
1212
13- error[E0792]: non-defining opaque type use in defining scope
14- --> $DIR/multi-error.rs:17:17
15- |
16- LL | fn foo() -> (Self::Bar<u32>, Self::Baz) {
17- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ argument `u32` is not a generic parameter
18- |
19- note: for this opaque type
20- --> $DIR/multi-error.rs:15:19
21- |
22- LL | type Bar<T> = impl Sized;
23- | ^^^^^^^^^^
24- = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
25-
2613error[E0792]: expected generic type parameter, found `u32`
27- --> $DIR/multi-error.rs:20 :9
14+ --> $DIR/multi-error.rs:19 :9
2815 |
2916LL | type Bar<T> = impl Sized;
3017 | - this generic parameter must be used with a generic type parameter
3118...
3219LL | ((), ())
3320 | ^^^^^^^^
3421
35- error: aborting due to 3 previous errors
22+ error: aborting due to 2 previous errors
3623
3724For more information about this error, try `rustc --explain E0792`.
Original file line number Diff line number Diff line change @@ -15,7 +15,6 @@ impl Foo for () {
1515 type Bar < T > = impl Sized ;
1616 fn foo ( ) -> Self :: Bar < u32 > { }
1717 //~^ ERROR non-defining opaque type use
18- //~| ERROR non-defining opaque type use
1918 //~| ERROR expected generic type parameter, found `u32`
2019 fn bar < T > ( ) -> Self :: Bar < T > { }
2120}
Original file line number Diff line number Diff line change @@ -10,19 +10,6 @@ note: for this opaque type
1010LL | type Bar<T> = impl Sized;
1111 | ^^^^^^^^^^
1212
13- error[E0792]: non-defining opaque type use in defining scope
14- --> $DIR/non-defining-method.rs:16:17
15- |
16- LL | fn foo() -> Self::Bar<u32> {}
17- | ^^^^^^^^^^^^^^ argument `u32` is not a generic parameter
18- |
19- note: for this opaque type
20- --> $DIR/non-defining-method.rs:15:19
21- |
22- LL | type Bar<T> = impl Sized;
23- | ^^^^^^^^^^
24- = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
25-
2613error[E0792]: expected generic type parameter, found `u32`
2714 --> $DIR/non-defining-method.rs:16:32
2815 |
@@ -31,6 +18,6 @@ LL | type Bar<T> = impl Sized;
3118LL | fn foo() -> Self::Bar<u32> {}
3219 | ^^
3320
34- error: aborting due to 3 previous errors
21+ error: aborting due to 2 previous errors
3522
3623For more information about this error, try `rustc --explain E0792`.
You can’t perform that action at this time.
0 commit comments