Skip to content

Commit 2f74925

Browse files
committed
Auto merge of #28087 - AlisdairO:diagnostics122, r=arielb1
As title :-) Part of #24407. r? @Manishearth
2 parents f3f23bf + 8ae2b1d commit 2f74925

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

src/librustc_typeck/diagnostics.rs

+20-1
Original file line numberDiff line numberDiff line change
@@ -1642,6 +1642,26 @@ static BAR: _ = "test"; // error, explicitly write out the type instead
16421642
```
16431643
"##,
16441644

1645+
E0122: r##"
1646+
An attempt was made to add a generic constraint to a type alias. While Rust will
1647+
allow this with a warning, it will not currently enforce the constraint.
1648+
Consider the example below:
1649+
1650+
```
1651+
trait Foo{}
1652+
1653+
type MyType<R: Foo> = (R, ());
1654+
1655+
fn main() {
1656+
let t: MyType<u32>;
1657+
}
1658+
```
1659+
1660+
We're able to declare a variable of type `MyType<u32>`, despite the fact that
1661+
`u32` does not implement `Foo`. As a result, one should avoid using generic
1662+
constraints in concert with type aliases.
1663+
"##,
1664+
16451665
E0124: r##"
16461666
You declared two fields of a struct with the same name. Erroneous code
16471667
example:
@@ -3010,7 +3030,6 @@ register_diagnostics! {
30103030
E0103, // @GuillaumeGomez: I was unable to get this error, try your best!
30113031
E0104,
30123032
E0118,
3013-
E0122,
30143033
// E0123,
30153034
// E0127,
30163035
// E0129,

0 commit comments

Comments
 (0)