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
Point at associated types when they have a default type
Associated types with a default type in a trait can't be relied upon to
remain of that default type when in use, so literals of that type can't
be used in the trait's items. Point at the associated type and state
that information.
Reduce verbosity for associated consts of the wrong type.
Copy file name to clipboardExpand all lines: src/test/ui/specialization/specialization-default-types.stderr
+2-2
Original file line number
Diff line number
Diff line change
@@ -1,15 +1,15 @@
1
1
error[E0308]: mismatched types
2
2
--> $DIR/specialization-default-types.rs:15:9
3
3
|
4
+
LL | default type Output = Box<T>;
5
+
| ----------------------------- expected this associated type
4
6
LL | default fn generate(self) -> Self::Output {
5
7
| ------------ expected `<T as Example>::Output` because of return type
6
8
LL | Box::new(self)
7
9
| ^^^^^^^^^^^^^^ expected associated type, found struct `std::boxed::Box`
8
10
|
9
11
= note: expected associated type `<T as Example>::Output`
10
12
found struct `std::boxed::Box<T>`
11
-
= help: consider constraining the associated type `<T as Example>::Output` to `std::boxed::Box<T>` or calling a method that returns `<T as Example>::Output`
12
-
= note: for more information, visit https://doc.rust-lang.org/book/ch19-03-advanced-traits.html
0 commit comments