diff options
Diffstat (limited to 'tests/ui/impl-trait/auto-trait-selection.rs')
| -rw-r--r-- | tests/ui/impl-trait/auto-trait-selection.rs | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/ui/impl-trait/auto-trait-selection.rs b/tests/ui/impl-trait/auto-trait-selection.rs new file mode 100644 index 00000000000..beb0b189fd7 --- /dev/null +++ b/tests/ui/impl-trait/auto-trait-selection.rs @@ -0,0 +1,20 @@ +//! This test shows how we fail selection in a way that can influence +//! selection in a code path that succeeds. + +//@ revisions: next old +//@[next] compile-flags: -Znext-solver +//@[old]check-pass + +fn is_trait<T: Trait<U>, U: Default>(_: T) -> U { + Default::default() +} + +trait Trait<T> {} +impl<T: Send> Trait<u32> for T {} +impl<T> Trait<i32> for T {} +fn foo() -> impl Sized { + if false { is_trait(foo()) } else { Default::default() } + //[next]~^ ERROR: type annotations needed +} + +fn main() {} |
