File tree Expand file tree Collapse file tree 2 files changed +31
-8
lines changed
src/test/ui/mismatched_types Expand file tree Collapse file tree 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
22// file at the top-level directory of this distribution and at
33// http://rust-lang.org/COPYRIGHT.
44//
77// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
88// option. This file may not be copied, modified, or distributed
99// except according to those terms.
10+ #![ feature( slice_patterns) ]
11+
1012
1113struct Foo {
1214}
1315
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 ) {
1523}
1624
17- fn bar ( foo : Foo ) { // legal
25+ fn zar ( & foo: & Foo ) {
1826}
1927
20- fn qux ( foo : & Foo ) { // legal
28+ fn agh ( & & bar : & u32 ) {
2129}
2230
23- fn zar ( & foo : & Foo ) { // legal
31+ fn ugh ( & [ bar ] : & u32 ) {
2432}
2533
2634fn main ( ) { }
Original file line number Diff line number Diff line change 11error[E0308]: mismatched types
2- --> $DIR/issue-38371.rs:14 :8
2+ --> $DIR/issue-38371.rs:16 :8
33 |
4- 14 | fn foo(&foo: Foo) { // illegal syntax
4+ 16 | fn foo(&foo: Foo) {
55 | ^^^^ expected struct `Foo`, found reference
66 |
77 = note: expected type `Foo`
88 = note: found type `&_`
99 = help: did you mean `foo: &Foo`?
1010
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
1227
You can’t perform that action at this time.
0 commit comments