rust/tests/ui/kinds-of-primitive-impl.rs

27 lines
511 B
Rust
Raw Normal View History

2020-12-06 20:30:07 +00:00
impl u8 {
2022-03-15 15:32:52 +00:00
//~^ error: cannot define inherent `impl` for primitive types
2020-12-06 20:30:07 +00:00
pub const B: u8 = 0;
}
impl str {
2022-03-15 15:32:52 +00:00
//~^ error: cannot define inherent `impl` for primitive types
2020-12-06 20:30:07 +00:00
fn foo() {}
fn bar(self) {}
}
impl char {
2022-03-15 15:32:52 +00:00
//~^ error: cannot define inherent `impl` for primitive types
2020-12-06 20:30:07 +00:00
pub const B: u8 = 0;
pub const C: u8 = 0;
fn foo() {}
fn bar(self) {}
}
struct MyType;
impl &MyType {
//~^ error: cannot define inherent `impl` for primitive types
pub fn for_ref(self) {}
}
2020-12-06 20:30:07 +00:00
fn main() {}