File tree 2 files changed +28
-3
lines changed
tests/ui/mismatched_types
2 files changed +28
-3
lines changed Original file line number Diff line number Diff line change 1
1
#![ allow( non_camel_case_types) ]
2
2
3
3
struct bool ;
4
+ struct str ;
4
5
5
6
fn foo ( _: bool ) { }
7
+ fn bar ( _: & str ) { }
6
8
7
9
fn main ( ) {
8
10
foo ( true ) ;
9
11
//~^ ERROR mismatched types [E0308]
12
+ bar ( "hello" ) ;
13
+ //~^ ERROR mismatched types [E0308]
10
14
}
Original file line number Diff line number Diff line change 1
1
error[E0308]: mismatched types
2
- --> $DIR/similar_paths_primitive.rs:8 :9
2
+ --> $DIR/similar_paths_primitive.rs:10 :9
3
3
|
4
4
LL | foo(true);
5
5
| --- ^^^^ expected `bool`, found a different `bool`
@@ -14,11 +14,32 @@ note: `bool` is defined in the current crate
14
14
LL | struct bool;
15
15
| ^^^^^^^^^^^
16
16
note: function defined here
17
- --> $DIR/similar_paths_primitive.rs:5 :4
17
+ --> $DIR/similar_paths_primitive.rs:6 :4
18
18
|
19
19
LL | fn foo(_: bool) {}
20
20
| ^^^ -------
21
21
22
- error: aborting due to 1 previous error
22
+ error[E0308]: mismatched types
23
+ --> $DIR/similar_paths_primitive.rs:12:9
24
+ |
25
+ LL | bar("hello");
26
+ | --- ^^^^^^^ expected `str`, found a different `str`
27
+ | |
28
+ | arguments to this function are incorrect
29
+ |
30
+ = note: str and `str` have similar names, but are actually distinct types
31
+ = note: str is a primitive defined by the language
32
+ note: `str` is defined in the current crate
33
+ --> $DIR/similar_paths_primitive.rs:4:1
34
+ |
35
+ LL | struct str;
36
+ | ^^^^^^^^^^
37
+ note: function defined here
38
+ --> $DIR/similar_paths_primitive.rs:7:4
39
+ |
40
+ LL | fn bar(_: &str) {}
41
+ | ^^^ -------
42
+
43
+ error: aborting due to 2 previous errors
23
44
24
45
For more information about this error, try `rustc --explain E0308`.
You can’t perform that action at this time.
0 commit comments