diff options
Diffstat (limited to 'tests/ui/const-generics/try-from-with-const-genericsrs-98299.rs')
| -rw-r--r-- | tests/ui/const-generics/try-from-with-const-genericsrs-98299.rs | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/ui/const-generics/try-from-with-const-genericsrs-98299.rs b/tests/ui/const-generics/try-from-with-const-genericsrs-98299.rs new file mode 100644 index 00000000000..49c88856bc9 --- /dev/null +++ b/tests/ui/const-generics/try-from-with-const-genericsrs-98299.rs @@ -0,0 +1,21 @@ +// https://github.com/rust-lang/rust/issues/98299 +use std::convert::TryFrom; + +pub fn test_usage(p: ()) { + SmallCString::try_from(p).map(|cstr| cstr); + //~^ ERROR: type annotations needed + //~| ERROR: type annotations needed + //~| ERROR: type annotations needed +} + +pub struct SmallCString<const N: usize> {} + +impl<const N: usize> TryFrom<()> for SmallCString<N> { + type Error = (); + + fn try_from(path: ()) -> Result<Self, Self::Error> { + unimplemented!(); + } +} + +fn main() {} |
