File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change
1
+ /// The compiler previously did not properly check the bound of `From` when it was used from type
2
+ /// of the dyn trait object (use in `copy_any` below). Since the associated type is under user
3
+ /// control in this usage, the compiler could be tricked to believe any type implemented any trait.
4
+ /// This would ICE, except for pure marker traits like `Copy`. It did not require providing an
5
+ /// instance of the dyn trait type, only name said type.
6
+ trait Setup {
7
+ type From : Copy ;
8
+ }
9
+
10
+ fn copy < U : Setup + ?Sized > ( from : & U :: From ) -> U :: From {
11
+ * from
12
+ }
13
+
14
+ pub fn copy_any < T > ( t : & T ) -> T {
15
+ copy :: < dyn Setup < From =T > > ( t)
16
+ //~^ ERROR the trait bound `T: Copy` is not satisfied
17
+ }
18
+
19
+ fn main ( ) { }
You can’t perform that action at this time.
0 commit comments