You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Rollup merge of rust-lang#132214 - fmease:mv-impl-trait-val-paths, r=compiler-errors
Cleanup: Move an impl-Trait check from AST validation to AST lowering
Namely the one that rejects `impl Trait` in qself types and non-final path segments.
There's no good reason to perform this during AST validation.
We have better infrastructure in place in the AST lowerer (`ImplTraitContext`).
This shaves off a lot of code.
We now lower `impl Trait` in bad positions to `{type error}` which allows us to
remove a special case from HIR ty lowering.
Coincidentally fixesrust-lang#126725. Well, it only *masks* it by passing `{type error}` to HIR analysis instead of a "bad" opaque. I was able to find a new reproducer for it. See the issue.
error[E0277]: the trait bound `impl Debug: Step` is not satisfied
32
-
--> $DIR/impl_trait_projections.rs:26:8
33
-
|
34
-
LL | -> <::std::ops::Range<impl Debug> as Iterator>::Item
35
-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Step` is not implemented for `impl Debug`, which is required by `std::ops::Range<impl Debug>: Iterator`
36
-
|
37
-
= help: the following other types implement trait `Step`:
38
-
Char
39
-
Ipv4Addr
40
-
Ipv6Addr
41
-
char
42
-
i128
43
-
i16
44
-
i32
45
-
i64
46
-
and 8 others
47
-
= note: required for `std::ops::Range<impl Debug>` to implement `Iterator`
48
-
49
-
error[E0277]: the trait bound `impl Debug: Step` is not satisfied
50
-
--> $DIR/impl_trait_projections.rs:29:1
51
-
|
52
-
LL | / {
53
-
LL | |
54
-
LL | | (1i32..100).next().unwrap()
55
-
LL | | }
56
-
| |_^ the trait `Step` is not implemented for `impl Debug`, which is required by `std::ops::Range<impl Debug>: Iterator`
57
30
|
58
-
= help: the following other types implement trait `Step`:
59
-
Char
60
-
Ipv4Addr
61
-
Ipv6Addr
62
-
char
63
-
i128
64
-
i16
65
-
i32
66
-
i64
67
-
and 8 others
68
-
= note: required for `std::ops::Range<impl Debug>` to implement `Iterator`
31
+
= note: `impl Trait` is only allowed in arguments and return types of functions and methods
69
32
70
-
error: aborting due to 7 previous errors
33
+
error: aborting due to 4 previous errors
71
34
72
-
Some errors have detailed explanations: E0277, E0667.
73
-
For more information about an error, try `rustc --explain E0277`.
35
+
For more information about this error, try `rustc --explain E0562`.
0 commit comments