rust/tests/ui/self/self-ctor-inner-const.rs

18 lines
447 B
Rust
Raw Normal View History

2023-04-30 11:05:09 -05:00
// Verify that we ban usage of `Self` as constructor from inner items.
struct S0<T>(T);
impl<T> S0<T> {
fn foo() {
const C: S0<u8> = Self(0);
//~^ ERROR can't use generic parameters from outer function
fn bar() -> Self {
//~^ ERROR can't use generic parameters from outer function
Self(0)
//~^ ERROR can't use generic parameters from outer function
}
}
}
fn main() {}