rust/tests/ui/on-unimplemented/suggest_tuple_wrap.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

20 lines
535 B
Rust
Raw Normal View History

2024-11-04 11:06:19 +00:00
pub trait Argument {}
impl Argument for u8 {}
impl Argument for i8 {}
impl Argument for String {}
impl Argument for &str {}
pub trait TupleArgs {}
impl<A: Argument> TupleArgs for (A,) {}
impl<A: Argument, B: Argument> TupleArgs for (A, B) {}
impl<A: Argument, B: Argument, C: Argument> TupleArgs for (A, B, C) {}
fn convert_into_tuple(_x: impl TupleArgs) {}
fn main() {
convert_into_tuple(42_u8);
//~^ ERROR E0277
//~| HELP the following other types implement trait `TupleArgs`
//~| HELP use a unary tuple instead
}