-
Notifications
You must be signed in to change notification settings - Fork 12.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
syntax: recovery for incorrect associated item paths like `[T; N]::cl…
…one`
- Loading branch information
1 parent
af57ace
commit 70e5c37
Showing
9 changed files
with
357 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT | ||
// file at the top-level directory of this distribution and at | ||
// http://rust-lang.org/COPYRIGHT. | ||
// | ||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or | ||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license | ||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your | ||
// option. This file may not be copied, modified, or distributed | ||
// except according to those terms. | ||
|
||
fn main() { | ||
let a = [1, 2, 3, 4]; | ||
[i32; 4]::clone(&a); | ||
//~^ ERROR missing angle brackets in associated item path | ||
|
||
[i32]::as_ref(&a); | ||
//~^ ERROR missing angle brackets in associated item path | ||
|
||
(u8)::clone(&0); | ||
//~^ ERROR missing angle brackets in associated item path | ||
|
||
(u8, u8)::clone(&(0, 0)); | ||
//~^ ERROR missing angle brackets in associated item path | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
error: missing angle brackets in associated item path | ||
--> $DIR/bad-assoc-expr.rs:13:5 | ||
| | ||
13 | [i32; 4]::clone(&a); | ||
| ^^^^^^^^^^^^^^^ help: try: `<[i32; 4]>::clone` | ||
|
||
error: missing angle brackets in associated item path | ||
--> $DIR/bad-assoc-expr.rs:16:5 | ||
| | ||
16 | [i32]::as_ref(&a); | ||
| ^^^^^^^^^^^^^ help: try: `<[i32]>::as_ref` | ||
|
||
error: missing angle brackets in associated item path | ||
--> $DIR/bad-assoc-expr.rs:19:5 | ||
| | ||
19 | (u8)::clone(&0); | ||
| ^^^^^^^^^^^ help: try: `<(u8)>::clone` | ||
|
||
error: missing angle brackets in associated item path | ||
--> $DIR/bad-assoc-expr.rs:22:5 | ||
| | ||
22 | (u8, u8)::clone(&(0, 0)); | ||
| ^^^^^^^^^^^^^^^ help: try: `<(u8, u8)>::clone` | ||
|
||
error: aborting due to 4 previous errors | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT | ||
// file at the top-level directory of this distribution and at | ||
// http://rust-lang.org/COPYRIGHT. | ||
// | ||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or | ||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license | ||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your | ||
// option. This file may not be copied, modified, or distributed | ||
// except according to those terms. | ||
|
||
fn main() { | ||
match 0u8 { | ||
[u8]::AssocItem => {} | ||
//~^ ERROR missing angle brackets in associated item path | ||
//~| ERROR no associated item named `AssocItem` found for type `[u8]` in the current scope | ||
(u8, u8)::AssocItem => {} | ||
//~^ ERROR missing angle brackets in associated item path | ||
//~| ERROR no associated item named `AssocItem` found for type `(u8, u8)` in the current sco | ||
_::AssocItem => {} | ||
//~^ ERROR missing angle brackets in associated item path | ||
//~| ERROR no associated item named `AssocItem` found for type `_` in the current scope | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
error: missing angle brackets in associated item path | ||
--> $DIR/bad-assoc-pat.rs:13:9 | ||
| | ||
13 | [u8]::AssocItem => {} | ||
| ^^^^^^^^^^^^^^^ help: try: `<[u8]>::AssocItem` | ||
|
||
error: missing angle brackets in associated item path | ||
--> $DIR/bad-assoc-pat.rs:16:9 | ||
| | ||
16 | (u8, u8)::AssocItem => {} | ||
| ^^^^^^^^^^^^^^^^^^^ help: try: `<(u8, u8)>::AssocItem` | ||
|
||
error: missing angle brackets in associated item path | ||
--> $DIR/bad-assoc-pat.rs:19:9 | ||
| | ||
19 | _::AssocItem => {} | ||
| ^^^^^^^^^^^^ help: try: `<_>::AssocItem` | ||
|
||
error[E0599]: no associated item named `AssocItem` found for type `[u8]` in the current scope | ||
--> $DIR/bad-assoc-pat.rs:13:9 | ||
| | ||
13 | [u8]::AssocItem => {} | ||
| ^^^^^^^^^^^^^^^ associated item not found in `[u8]` | ||
|
||
error[E0599]: no associated item named `AssocItem` found for type `(u8, u8)` in the current scope | ||
--> $DIR/bad-assoc-pat.rs:16:9 | ||
| | ||
16 | (u8, u8)::AssocItem => {} | ||
| ^^^^^^^^^^^^^^^^^^^ associated item not found in `(u8, u8)` | ||
|
||
error[E0599]: no associated item named `AssocItem` found for type `_` in the current scope | ||
--> $DIR/bad-assoc-pat.rs:19:9 | ||
| | ||
19 | _::AssocItem => {} | ||
| ^^^^^^^^^^^^ associated item not found in `_` | ||
|
||
error: aborting due to 6 previous errors | ||
|
Oops, something went wrong.