File tree Expand file tree Collapse file tree 7 files changed +151
-18
lines changed Expand file tree Collapse file tree 7 files changed +151
-18
lines changed Original file line number Diff line number Diff line change 1- // compile-flags: -Zmir-opt-level=4
1+ // build-pass
2+ // compile-flags: -Zmir-opt-level=3 --crate-type=lib
23
3- pub fn bar < T > ( s : & ' static mut ( ) )
4+ #![ feature( trivial_bounds) ]
5+ #![ allow( trivial_bounds) ]
6+
7+ trait Foo {
8+ fn test ( self ) ;
9+ }
10+ fn baz < T > ( )
411where
5- & ' static mut ( ) : Clone , //~ ERROR the trait bound
12+ & ' static str : Foo ,
613{
7- < & ' static mut ( ) as Clone > :: clone ( & s ) ;
14+ "Foo" . test ( )
815}
9-
10- fn main ( ) { }
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ // check-pass
2+
3+ fn main ( ) {
4+ println ! ( "{:?}" , {
5+ type T = ( ) ;
6+
7+ pub fn cloneit( it: & ' _ mut T ) -> ( & ' _ mut T , & ' _ mut T )
8+ where
9+ for <' any> & ' any mut T : Clone ,
10+ {
11+ ( it. clone( ) , it)
12+ }
13+ } ) ;
14+ }
Original file line number Diff line number Diff line change 1+ // check-pass
2+
3+ trait Identity < Q > {
4+ type T ;
5+ }
6+
7+ impl < Q , T > Identity < Q > for T {
8+ type T = T ;
9+ }
10+
11+ trait Holds {
12+ type Q ;
13+ }
14+
15+ struct S ;
16+ struct X ( S ) ;
17+
18+ struct XHelper ;
19+
20+ impl Holds for X {
21+ type Q = XHelper ;
22+ }
23+
24+ impl < Q > Clone for X
25+ where
26+ <S as Identity < Q > >:: T : Clone ,
27+ X : Holds < Q = Q > ,
28+ {
29+ fn clone ( & self ) -> Self {
30+ Self ( self . 0 . clone ( ) )
31+ }
32+ }
33+
34+ fn main ( ) { }
Original file line number Diff line number Diff line change 1+ // build-pass
2+ // compile-flags:-Zmir-opt-level=3
3+
4+ struct D ;
5+
6+ trait Tr {
7+ type It ;
8+ fn foo ( self ) -> Option < Self :: It > ;
9+ }
10+
11+ impl < ' a > Tr for & ' a D {
12+ type It = ( ) ;
13+ fn foo ( self ) -> Option < ( ) > {
14+ None
15+ }
16+ }
17+
18+ fn run < F > ( f : F )
19+ where
20+ for < ' a > & ' a D : Tr ,
21+ F : Fn ( <& D as Tr >:: It ) ,
22+ {
23+ let d = & D ;
24+ while let Some ( i) = d. foo ( ) {
25+ f ( i) ;
26+ }
27+ }
28+
29+ fn main ( ) {
30+ run ( |_| { } ) ;
31+ }
Original file line number Diff line number Diff line change 1+ // known-bug
2+ // build-fail
3+ // failure-status: 101
4+ // compile-flags:--crate-type=lib -Zmir-opt-level=3
5+ // rustc-env:RUST_BACKTRACE=0
6+
7+ // normalize-stderr-test "thread 'rustc' panicked.*" -> "thread 'rustc' panicked"
8+ // normalize-stderr-test "note:.*RUST_BACKTRACE=1.*\n" -> ""
9+ // normalize-stderr-test "error: internal compiler error.*" -> "error: internal compiler error"
10+ // normalize-stderr-test "encountered.*with incompatible types:" "encountered ... with incompatible types:"
11+ // normalize-stderr-test "note:.*unexpectedly panicked.*\n\n" -> ""
12+ // normalize-stderr-test "note: we would appreciate a bug report.*\n\n" -> ""
13+ // normalize-stderr-test "note: compiler flags.*\n\n" -> ""
14+ // normalize-stderr-test "note: rustc.*running on.*\n\n" -> ""
15+ // normalize-stderr-test "query stack during panic:\n" -> ""
16+ // normalize-stderr-test "we're just showing a limited slice of the query stack\n" -> ""
17+ // normalize-stderr-test "end of query stack\n" -> ""
18+ // normalize-stderr-test "#.*\n" -> ""
19+
20+ // This is a known bug that @compiler-errors tried to fix in #94238,
21+ // but the solution was probably not correct.
22+
23+ pub trait Factory < T > {
24+ type Item ;
25+ }
26+
27+ pub struct IntFactory ;
28+
29+ impl < T > Factory < T > for IntFactory {
30+ type Item = usize ;
31+ }
32+
33+ pub fn foo < T > ( )
34+ where
35+ IntFactory : Factory < T > ,
36+ {
37+ let mut x: <IntFactory as Factory < T > >:: Item = bar :: < T > ( ) ;
38+ }
39+
40+ #[ inline]
41+ pub fn bar < T > ( ) -> <IntFactory as Factory < T > >:: Item {
42+ 0usize
43+ }
Original file line number Diff line number Diff line change 1+ error: internal compiler error
2+
3+ error: internal compiler error
4+ encountered ... with incompatible types:
5+ left-hand side has type: <IntFactory as Factory<T>>::Item
6+ right-hand side has type: usize
7+ --> $DIR/select-param-env-instead-of-blanket.rs:42:5
8+ |
9+ LL | let mut x: <IntFactory as Factory<T>>::Item = bar::<T>();
10+ | ---------- in this inlined function call
11+ ...
12+ LL | 0usize
13+ | ^^^^^^
14+ |
15+ = note: delayed at compiler/rustc_const_eval/src/transform/validate.rs:128:36
16+
17+ thread 'rustc' panicked
18+
You can’t perform that action at this time.
0 commit comments