File tree Expand file tree Collapse file tree 3 files changed +33
-31
lines changed Expand file tree Collapse file tree 3 files changed +33
-31
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ //! Test that inherent impl blocks cannot be defined for primitive types
2+
3+ impl u8 {
4+ //~^ error: cannot define inherent `impl` for primitive types
5+ pub const B : u8 = 0 ;
6+ }
7+
8+ impl str {
9+ //~^ error: cannot define inherent `impl` for primitive types
10+ fn foo ( ) { }
11+ fn bar ( self ) { } //~ ERROR: size for values of type `str` cannot be known
12+ }
13+
14+ impl char {
15+ //~^ error: cannot define inherent `impl` for primitive types
16+ pub const B : u8 = 0 ;
17+ pub const C : u8 = 0 ;
18+ fn foo ( ) { }
19+ fn bar ( self ) { }
20+ }
21+
22+ struct MyType ;
23+ impl & MyType {
24+ //~^ error: cannot define inherent `impl` for primitive types
25+ pub fn for_ref ( self ) { }
26+ }
27+
28+ fn main ( ) { }
Original file line number Diff line number Diff line change 11error[E0390]: cannot define inherent `impl` for primitive types
2- --> $DIR/kinds-of -primitive-impl .rs:1 :1
2+ --> $DIR/inherent-impl -primitive-types-error .rs:3 :1
33 |
44LL | impl u8 {
55 | ^^^^^^^
66 |
77 = help: consider using an extension trait instead
88
99error[E0390]: cannot define inherent `impl` for primitive types
10- --> $DIR/kinds-of -primitive-impl .rs:6 :1
10+ --> $DIR/inherent-impl -primitive-types-error .rs:8 :1
1111 |
1212LL | impl str {
1313 | ^^^^^^^^
1414 |
1515 = help: consider using an extension trait instead
1616
1717error[E0390]: cannot define inherent `impl` for primitive types
18- --> $DIR/kinds-of -primitive-impl .rs:12 :1
18+ --> $DIR/inherent-impl -primitive-types-error .rs:14 :1
1919 |
2020LL | impl char {
2121 | ^^^^^^^^^
2222 |
2323 = help: consider using an extension trait instead
2424
2525error[E0390]: cannot define inherent `impl` for primitive types
26- --> $DIR/kinds-of -primitive-impl .rs:21 :1
26+ --> $DIR/inherent-impl -primitive-types-error .rs:23 :1
2727 |
2828LL | impl &MyType {
2929 | ^^^^^^^^^^^^
@@ -32,7 +32,7 @@ LL | impl &MyType {
3232 = note: you could also try moving the reference to uses of `MyType` (such as `self`) within the implementation
3333
3434error[E0277]: the size for values of type `str` cannot be known at compilation time
35- --> $DIR/kinds-of -primitive-impl .rs:9 :12
35+ --> $DIR/inherent-impl -primitive-types-error .rs:11 :12
3636 |
3737LL | fn bar(self) {}
3838 | ^^^^ doesn't have a size known at compile-time
You can’t perform that action at this time.
0 commit comments