Skip to content

Commit

Permalink
Add tests for #26448
Browse files Browse the repository at this point in the history
  • Loading branch information
varkor committed Mar 12, 2019
1 parent 5c563f9 commit 651c1ab
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
@@ -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
@@ -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
@@ -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 651c1ab

Please sign in to comment.