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

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

27 lines
568 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) {} //~ ERROR: size for values of type `str` cannot be known
2020-12-06 20:30:07 +00:00
}
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() {}