Add tests for #26448
This commit is contained in:
parent
5c563f98b8
commit
651c1abfb7
13
src/test/ui/issues/issue-26448-1.rs
Normal file
13
src/test/ui/issues/issue-26448-1.rs
Normal file
@ -0,0 +1,13 @@
|
||||
// run-pass
|
||||
|
||||
pub trait Foo<T> {
|
||||
fn foo(self) -> T;
|
||||
}
|
||||
|
||||
impl<'a, T> Foo<T> for &'a str where &'a str: Into<T> {
|
||||
fn foo(self) -> T {
|
||||
panic!();
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
21
src/test/ui/issues/issue-26448-2.rs
Normal file
21
src/test/ui/issues/issue-26448-2.rs
Normal file
@ -0,0 +1,21 @@
|
||||
// run-pass
|
||||
|
||||
pub struct Bar<T> {
|
||||
items: Vec<&'static str>,
|
||||
inner: T,
|
||||
}
|
||||
|
||||
pub trait IntoBar<T> {
|
||||
fn into_bar(self) -> Bar<T>;
|
||||
}
|
||||
|
||||
impl<'a, T> IntoBar<T> for &'a str where &'a str: Into<T> {
|
||||
fn into_bar(self) -> Bar<T> {
|
||||
Bar {
|
||||
items: Vec::new(),
|
||||
inner: self.into(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
25
src/test/ui/issues/issue-26448-3.rs
Normal file
25
src/test/ui/issues/issue-26448-3.rs
Normal file
@ -0,0 +1,25 @@
|
||||
// run-pass
|
||||
|
||||
pub struct Item {
|
||||
_inner: &'static str,
|
||||
}
|
||||
|
||||
pub struct Bar<T> {
|
||||
items: Vec<Item>,
|
||||
inner: T,
|
||||
}
|
||||
|
||||
pub trait IntoBar<T> {
|
||||
fn into_bar(self) -> Bar<T>;
|
||||
}
|
||||
|
||||
impl<'a, T> IntoBar<T> for &'a str where &'a str: Into<T> {
|
||||
fn into_bar(self) -> Bar<T> {
|
||||
Bar {
|
||||
items: Vec::new(),
|
||||
inner: self.into(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
Loading…
x
Reference in New Issue
Block a user