File tree 7 files changed +7
-46
lines changed
compiler/rustc_ty_utils/src
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> {
233
233
self . visit_opaque_ty ( alias_ty) ;
234
234
}
235
235
ty:: Alias ( ty:: Projection , alias_ty) => {
236
+ if let CollectionMode :: TypeAliasImplTraitTransition = self . mode {
237
+ return ControlFlow :: Continue ( ( ) ) ;
238
+ }
236
239
// This avoids having to do normalization of `Self::AssocTy` by only
237
240
// supporting the case of a method defining opaque types from assoc types
238
241
// 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 {
20
20
21
21
fn a ( & ' a self ) -> Self :: B < ' a > { } //~ ERROR: non-defining opaque type use in defining scope
22
22
//~^ ERROR: non-defining opaque type use in defining scope
23
- //~| ERROR: non-defining opaque type use in defining scope
24
23
}
Original file line number Diff line number Diff line change @@ -10,19 +10,6 @@ note: for this opaque type
10
10
LL | type B<'b> = impl Clone;
11
11
| ^^^^^^^^^^
12
12
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
-
26
13
error: non-defining opaque type use in defining scope
27
14
--> $DIR/issue-88595.rs:21:35
28
15
|
@@ -37,5 +24,5 @@ LL | impl<'a> A<'a> for C {
37
24
LL | type B<'b> = impl Clone;
38
25
| ^^
39
26
40
- error: aborting due to 3 previous errors
27
+ error: aborting due to 2 previous errors
41
28
Original file line number Diff line number Diff line change @@ -16,7 +16,6 @@ impl Foo for () {
16
16
type Baz = impl Sized ;
17
17
fn foo ( ) -> ( Self :: Bar < u32 > , Self :: Baz ) {
18
18
//~^ ERROR non-defining opaque type use
19
- //~| ERROR non-defining opaque type use
20
19
( ( ) , ( ) )
21
20
//~^ ERROR expected generic type parameter
22
21
}
Original file line number Diff line number Diff line change @@ -10,28 +10,15 @@ note: for this opaque type
10
10
LL | type Bar<T> = impl Sized;
11
11
| ^^^^^^^^^^
12
12
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
-
26
13
error[E0792]: expected generic type parameter, found `u32`
27
- --> $DIR/multi-error.rs:20 :9
14
+ --> $DIR/multi-error.rs:19 :9
28
15
|
29
16
LL | type Bar<T> = impl Sized;
30
17
| - this generic parameter must be used with a generic type parameter
31
18
...
32
19
LL | ((), ())
33
20
| ^^^^^^^^
34
21
35
- error: aborting due to 3 previous errors
22
+ error: aborting due to 2 previous errors
36
23
37
24
For 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 () {
15
15
type Bar < T > = impl Sized ;
16
16
fn foo ( ) -> Self :: Bar < u32 > { }
17
17
//~^ ERROR non-defining opaque type use
18
- //~| ERROR non-defining opaque type use
19
18
//~| ERROR expected generic type parameter, found `u32`
20
19
fn bar < T > ( ) -> Self :: Bar < T > { }
21
20
}
Original file line number Diff line number Diff line change @@ -10,19 +10,6 @@ note: for this opaque type
10
10
LL | type Bar<T> = impl Sized;
11
11
| ^^^^^^^^^^
12
12
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
-
26
13
error[E0792]: expected generic type parameter, found `u32`
27
14
--> $DIR/non-defining-method.rs:16:32
28
15
|
@@ -31,6 +18,6 @@ LL | type Bar<T> = impl Sized;
31
18
LL | fn foo() -> Self::Bar<u32> {}
32
19
| ^^
33
20
34
- error: aborting due to 3 previous errors
21
+ error: aborting due to 2 previous errors
35
22
36
23
For more information about this error, try `rustc --explain E0792`.
You can’t perform that action at this time.
0 commit comments