File tree Expand file tree Collapse file tree 4 files changed +33
-0
lines changed Expand file tree Collapse file tree 4 files changed +33
-0
lines changed Original file line number Diff line number Diff line change 11// Test that we cannot create objects from unsized types.
2+ //@ revisions: current next
3+ //@ ignore-compare-mode-next-solver (explicit revisions)
4+ //@[next] compile-flags: -Znext-solver
25
36trait Foo { fn foo ( & self ) { } }
47impl Foo for str { }
Original file line number Diff line number Diff line change 1+ //@ check-pass
2+ //@ revisions: current next
3+ //@ ignore-compare-mode-next-solver (explicit revisions)
4+ //@[next] compile-flags: -Znext-solver
5+
6+ trait Super < T > { }
7+ trait Trait < T > : Super < T > + for < ' hr > Super < & ' hr ( ) > { }
8+
9+ fn foo < ' a > ( x : Box < dyn Trait < & ' a ( ) > > ) -> Box < dyn Super < & ' a ( ) > > {
10+ x
11+ }
12+
13+ fn main ( ) { }
Original file line number Diff line number Diff line change 1+ //@ compile-flags: -Znext-solver
2+ trait Super < ' a > { }
3+ trait Trait < ' a > : Super < ' a > + for < ' hr > Super < ' hr > { }
4+
5+ fn foo < ' a > ( x : Box < dyn Trait < ' a > > ) -> Box < dyn Super < ' a > > {
6+ x
7+ //~^ ERROR type annotations needed: cannot satisfy `dyn Trait<'_>: Unsize<dyn Super<'_>>
8+ }
9+
10+ fn main ( ) { }
Original file line number Diff line number Diff line change 1+ //@ compile-flags: -Znext-solver
2+ #![ recursion_limit = "8" ]
3+
4+ fn main ( ) {
5+ let _: Box < dyn Send > = Box :: new ( & & & & & & & 1 ) ;
6+ //~^ ERROR overflow evaluating the requirement `Box<&&&&&&&i32>: CoerceUnsized<Box<dyn Send>>
7+ }
You can’t perform that action at this time.
0 commit comments