File tree Expand file tree Collapse file tree 4 files changed +88
-0
lines changed Expand file tree Collapse file tree 4 files changed +88
-0
lines changed Original file line number Diff line number Diff line change 1+ error[E0283]: type annotations needed
2+ --> $DIR/auto-trait-selection-freeze.rs:20:16
3+ |
4+ LL | if false { is_trait(foo()) } else { Default::default() }
5+ | ^^^^^^^^ ----- type must be known at this point
6+ | |
7+ | cannot infer type of the type parameter `T` declared on the function `is_trait`
8+ |
9+ = note: cannot satisfy `_: Trait<_>`
10+ note: required by a bound in `is_trait`
11+ --> $DIR/auto-trait-selection-freeze.rs:12:16
12+ |
13+ LL | fn is_trait<T: Trait<U>, U: Default>(_: T) -> U {
14+ | ^^^^^^^^ required by this bound in `is_trait`
15+ help: consider specifying the generic arguments
16+ |
17+ LL | if false { is_trait::<T, U>(foo()) } else { Default::default() }
18+ | ++++++++
19+
20+ error: aborting due to 1 previous error
21+
22+ For more information about this error, try `rustc --explain E0283`.
Original file line number Diff line number Diff line change 1+ //! This test shows how we fail selection in a way that can influence
2+ //! selection in a code path that succeeds.
3+
4+ //@ revisions: next old
5+ //@[next] compile-flags: -Znext-solver
6+ //@[old]check-pass
7+
8+ #![ feature( freeze) ]
9+
10+ use std:: marker:: Freeze ;
11+
12+ fn is_trait < T : Trait < U > , U : Default > ( _: T ) -> U {
13+ Default :: default ( )
14+ }
15+
16+ trait Trait < T > { }
17+ impl < T : Freeze > Trait < u32 > for T { }
18+ impl < T > Trait < i32 > for T { }
19+ fn foo ( ) -> impl Sized {
20+ if false { is_trait ( foo ( ) ) } else { Default :: default ( ) }
21+ //[next]~^ ERROR: type annotations needed
22+ }
23+
24+ fn main ( ) { }
Original file line number Diff line number Diff line change 1+ error[E0283]: type annotations needed
2+ --> $DIR/auto-trait-selection.rs:16:16
3+ |
4+ LL | if false { is_trait(foo()) } else { Default::default() }
5+ | ^^^^^^^^ ----- type must be known at this point
6+ | |
7+ | cannot infer type of the type parameter `T` declared on the function `is_trait`
8+ |
9+ = note: cannot satisfy `_: Trait<_>`
10+ note: required by a bound in `is_trait`
11+ --> $DIR/auto-trait-selection.rs:8:16
12+ |
13+ LL | fn is_trait<T: Trait<U>, U: Default>(_: T) -> U {
14+ | ^^^^^^^^ required by this bound in `is_trait`
15+ help: consider specifying the generic arguments
16+ |
17+ LL | if false { is_trait::<T, U>(foo()) } else { Default::default() }
18+ | ++++++++
19+
20+ error: aborting due to 1 previous error
21+
22+ For more information about this error, try `rustc --explain E0283`.
Original file line number Diff line number Diff line change 1+ //! This test shows how we fail selection in a way that can influence
2+ //! selection in a code path that succeeds.
3+
4+ //@ revisions: next old
5+ //@[next] compile-flags: -Znext-solver
6+ //@[old]check-pass
7+
8+ fn is_trait < T : Trait < U > , U : Default > ( _: T ) -> U {
9+ Default :: default ( )
10+ }
11+
12+ trait Trait < T > { }
13+ impl < T : Send > Trait < u32 > for T { }
14+ impl < T > Trait < i32 > for T { }
15+ fn foo ( ) -> impl Sized {
16+ if false { is_trait ( foo ( ) ) } else { Default :: default ( ) }
17+ //[next]~^ ERROR: type annotations needed
18+ }
19+
20+ fn main ( ) { }
You can’t perform that action at this time.
0 commit comments