File tree 2 files changed +31
-8
lines changed
src/test/ui/mismatched_types
2 files changed +31
-8
lines changed Original file line number Diff line number Diff line change 1
- // Copyright 2016 The Rust Project Developers. See the COPYRIGHT
1
+ // Copyright 2017 The Rust Project Developers. See the COPYRIGHT
2
2
// file at the top-level directory of this distribution and at
3
3
// http://rust-lang.org/COPYRIGHT.
4
4
//
7
7
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8
8
// option. This file may not be copied, modified, or distributed
9
9
// except according to those terms.
10
+ #![ feature( slice_patterns) ]
11
+
10
12
11
13
struct Foo {
12
14
}
13
15
14
- fn foo ( & foo: Foo ) { // illegal syntax
16
+ fn foo ( & foo: Foo ) {
17
+ }
18
+
19
+ fn bar ( foo : Foo ) {
20
+ }
21
+
22
+ fn qux ( foo : & Foo ) {
15
23
}
16
24
17
- fn bar ( foo : Foo ) { // legal
25
+ fn zar ( & foo: & Foo ) {
18
26
}
19
27
20
- fn qux ( foo : & Foo ) { // legal
28
+ fn agh ( & & bar : & u32 ) {
21
29
}
22
30
23
- fn zar ( & foo : & Foo ) { // legal
31
+ fn ugh ( & [ bar ] : & u32 ) {
24
32
}
25
33
26
34
fn main ( ) { }
Original file line number Diff line number Diff line change 1
1
error[E0308]: mismatched types
2
- --> $DIR/issue-38371.rs:14 :8
2
+ --> $DIR/issue-38371.rs:16 :8
3
3
|
4
- 14 | fn foo(&foo: Foo) { // illegal syntax
4
+ 16 | fn foo(&foo: Foo) {
5
5
| ^^^^ expected struct `Foo`, found reference
6
6
|
7
7
= note: expected type `Foo`
8
8
= note: found type `&_`
9
9
= help: did you mean `foo: &Foo`?
10
10
11
- error: aborting due to previous error
11
+ error[E0308]: mismatched types
12
+ --> $DIR/issue-38371.rs:28:9
13
+ |
14
+ 28 | fn agh(&&bar: &u32) {
15
+ | ^^^^ expected u32, found reference
16
+ |
17
+ = note: expected type `u32`
18
+ = note: found type `&_`
19
+
20
+ error[E0529]: expected an array or slice, found `u32`
21
+ --> $DIR/issue-38371.rs:31:9
22
+ |
23
+ 31 | fn ugh(&[bar]: &u32) {
24
+ | ^^^^^ pattern cannot match with input type `u32`
25
+
26
+ error: aborting due to 3 previous errors
12
27
You can’t perform that action at this time.
0 commit comments