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 1
1
error[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
3
3
|
4
4
LL | impl u8 {
5
5
| ^^^^^^^
6
6
|
7
7
= help: consider using an extension trait instead
8
8
9
9
error[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
11
11
|
12
12
LL | impl str {
13
13
| ^^^^^^^^
14
14
|
15
15
= help: consider using an extension trait instead
16
16
17
17
error[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
19
19
|
20
20
LL | impl char {
21
21
| ^^^^^^^^^
22
22
|
23
23
= help: consider using an extension trait instead
24
24
25
25
error[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
27
27
|
28
28
LL | impl &MyType {
29
29
| ^^^^^^^^^^^^
@@ -32,7 +32,7 @@ LL | impl &MyType {
32
32
= note: you could also try moving the reference to uses of `MyType` (such as `self`) within the implementation
33
33
34
34
error[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
36
36
|
37
37
LL | fn bar(self) {}
38
38
| ^^^^ doesn't have a size known at compile-time
You can’t perform that action at this time.
0 commit comments