Skip to content

Commit

Permalink
Add tests for rust-lang#26448
Browse files Browse the repository at this point in the history
  • Loading branch information
varkor committed Feb 26, 2019
1 parent 6fd716d commit 26e5fc3
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/test/ui/issues/issue-26448-1.rs
Original file line number Diff line number Diff line change
@@ -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 changes: 21 additions & 0 deletions src/test/ui/issues/issue-26448-2.rs
Original file line number Diff line number Diff line change
@@ -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 changes: 25 additions & 0 deletions src/test/ui/issues/issue-26448-3.rs
Original file line number Diff line number Diff line change
@@ -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() {}

0 comments on commit 26e5fc3

Please sign in to comment.