blob: 5a42112529df73f6c120e306b95387d8eee0b7b6 [file] [edit]
//! Test that using `#[rustc_splat]` on un-resolvable types is an error.
#![allow(incomplete_features)]
#![allow(unconditional_recursion)]
#![feature(splat)]
#![feature(tuple_trait)]
fn tuple(#[rustc_splat] t: impl Sized) -> impl Sized {
//~^ ERROR cannot resolve opaque type
tuple(tuple((t, ())))
}
fn tuple_trait(#[rustc_splat] t: impl std::marker::Tuple) -> impl std::marker::Tuple {
//~^ ERROR cannot resolve opaque type
tuple_trait(tuple_trait((t, ())))
}
trait Trait {
type MaybeTup;
type Tup: std::marker::Tuple;
}
fn ambig(#[rustc_splat] t: Trait::MaybeTup) {}
//~^ ERROR ambiguous associated type
//~| ERROR cannot use `rustc_splat` attribute; the splatted argument type must be a tuple or unit, not a
//~| ERROR cannot use `rustc_splat` attribute; the splatted argument type must be a tuple or unit, not a
//~| ERROR cannot use `rustc_splat` attribute; the splatted argument type must be a tuple or unit, not a
fn ambig_tup(#[rustc_splat] t: Trait::Tup) {}
//~^ ERROR ambiguous associated type
//~| ERROR cannot use `rustc_splat` attribute; the splatted argument type must be a tuple or unit, not a
//~| ERROR cannot use `rustc_splat` attribute; the splatted argument type must be a tuple or unit, not a
//~| ERROR cannot use `rustc_splat` attribute; the splatted argument type must be a tuple or unit, not a
fn main() {
tuple();
tuple_trait();
ambig();
ambig_tup();
tuple(1);
tuple_trait(1);
ambig(1);
ambig_tup(1);
tuple(1, 2.0);
tuple_trait(1, 2.0);
ambig(1, 2.0);
ambig_tup(1, 2.0);
}