Skip to content

Commit

Permalink
use_self - add test case of #3859
Browse files Browse the repository at this point in the history
  • Loading branch information
tnielens committed Apr 26, 2020
1 parent f0dc26f commit 5020fcf
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 6 deletions.
20 changes: 17 additions & 3 deletions tests/ui/use_self.fixed
Original file line number Diff line number Diff line change
Expand Up @@ -341,12 +341,26 @@ mod issue2843 {
trait Foo {
type Bar;
}

impl Foo for usize {
type Bar = u8;
}

impl<T: Foo> Foo for Option<T> {
type Bar = Option<T::Bar>;
}
}
}

mod issue3859 {
pub struct Foo;
pub struct Bar([usize; 3]);

impl Foo {
pub const BAR: usize = 3;

pub fn foo() {
const _X: usize = Foo::BAR;
// const _Y: usize = Self::BAR;
}
}
}
20 changes: 17 additions & 3 deletions tests/ui/use_self.rs
Original file line number Diff line number Diff line change
Expand Up @@ -341,12 +341,26 @@ mod issue2843 {
trait Foo {
type Bar;
}

impl Foo for usize {
type Bar = u8;
}

impl<T: Foo> Foo for Option<T> {
type Bar = Option<T::Bar>;
}
}
}

mod issue3859 {
pub struct Foo;
pub struct Bar([usize; 3]);

impl Foo {
pub const BAR: usize = 3;

pub fn foo() {
const _X: usize = Foo::BAR;
// const _Y: usize = Self::BAR;
}
}
}

0 comments on commit 5020fcf

Please sign in to comment.