Skip to content

Commit fd5bf03

Browse files
committed
Add tests for rust-lang#26448
1 parent fa8a4fc commit fd5bf03

File tree

3 files changed

+59
-0
lines changed

3 files changed

+59
-0
lines changed

src/test/ui/issues/issue-26448-1.rs

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// run-pass
2+
3+
pub trait Foo<T> {
4+
fn foo(self) -> T;
5+
}
6+
7+
impl<'a, T> Foo<T> for &'a str where &'a str: Into<T> {
8+
fn foo(self) -> T {
9+
panic!();
10+
}
11+
}
12+
13+
fn main() {}

src/test/ui/issues/issue-26448-2.rs

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// run-pass
2+
3+
pub struct Bar<T> {
4+
items: Vec<&'static str>,
5+
inner: T,
6+
}
7+
8+
pub trait IntoBar<T> {
9+
fn into_bar(self) -> Bar<T>;
10+
}
11+
12+
impl<'a, T> IntoBar<T> for &'a str where &'a str: Into<T> {
13+
fn into_bar(self) -> Bar<T> {
14+
Bar {
15+
items: Vec::new(),
16+
inner: self.into(),
17+
}
18+
}
19+
}
20+
21+
fn main() {}

src/test/ui/issues/issue-26448-3.rs

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// run-pass
2+
3+
pub struct Item {
4+
_inner: &'static str,
5+
}
6+
7+
pub struct Bar<T> {
8+
items: Vec<Item>,
9+
inner: T,
10+
}
11+
12+
pub trait IntoBar<T> {
13+
fn into_bar(self) -> Bar<T>;
14+
}
15+
16+
impl<'a, T> IntoBar<T> for &'a str where &'a str: Into<T> {
17+
fn into_bar(self) -> Bar<T> {
18+
Bar {
19+
items: Vec::new(),
20+
inner: self.into(),
21+
}
22+
}
23+
}
24+
25+
fn main() {}

0 commit comments

Comments
 (0)