Auto merge of #56897 - euclio:parse-fatal, r=estebank

make `panictry!` private to libsyntax

This commit completely removes usage of the `panictry!` macro from
outside libsyntax. The macro causes parse errors to be fatal, so using
it in libsyntax_ext caused parse failures *within* a syntax extension to
be fatal, which is probably not intended.

Furthermore, this commit adds spans to diagnostics emitted by empty
extensions if they were missing, à la #56491.
This commit is contained in:
bors 2019-01-04 19:39:24 +00:00
commit f381a96255
22 changed files with 451 additions and 134 deletions

View file

@ -1,5 +1,7 @@
#![feature(type_ascription)]
fn main() {
let a : u32 = 0;
let a : usize = 0;
let long_name : usize = 0;
println!("{}", a as usize > long_name);

View file

@ -1,5 +1,5 @@
error: `<` is interpreted as a start of generic arguments for `usize`, not a comparison
--> $DIR/issue-22644.rs:6:31
--> $DIR/issue-22644.rs:8:31
|
LL | println!("{}", a as usize < long_name); //~ ERROR `<` is interpreted as a start of generic
| ---------- ^ --------- interpreted as generic arguments
@ -8,7 +8,7 @@ LL | println!("{}", a as usize < long_name); //~ ERROR `<` is interpreted as
| help: try comparing the cast value: `(a as usize)`
error: `<` is interpreted as a start of generic arguments for `usize`, not a comparison
--> $DIR/issue-22644.rs:7:33
--> $DIR/issue-22644.rs:9:33
|
LL | println!("{}{}", a as usize < long_name, long_name);
| ---------- ^ -------------------- interpreted as generic arguments
@ -17,7 +17,7 @@ LL | println!("{}{}", a as usize < long_name, long_name);
| help: try comparing the cast value: `(a as usize)`
error: `<` is interpreted as a start of generic arguments for `usize`, not a comparison
--> $DIR/issue-22644.rs:9:31
--> $DIR/issue-22644.rs:11:31
|
LL | println!("{}", a as usize < 4); //~ ERROR `<` is interpreted as a start of generic
| ---------- ^ - interpreted as generic arguments
@ -26,7 +26,7 @@ LL | println!("{}", a as usize < 4); //~ ERROR `<` is interpreted as a start
| help: try comparing the cast value: `(a as usize)`
error: `<` is interpreted as a start of generic arguments for `usize`, not a comparison
--> $DIR/issue-22644.rs:11:31
--> $DIR/issue-22644.rs:13:31
|
LL | println!("{}{}", a: usize < long_name, long_name);
| -------- ^ -------------------- interpreted as generic arguments
@ -35,7 +35,7 @@ LL | println!("{}{}", a: usize < long_name, long_name);
| help: try comparing the cast value: `(a: usize)`
error: `<` is interpreted as a start of generic arguments for `usize`, not a comparison
--> $DIR/issue-22644.rs:13:29
--> $DIR/issue-22644.rs:15:29
|
LL | println!("{}", a: usize < 4); //~ ERROR `<` is interpreted as a start of generic
| -------- ^ - interpreted as generic arguments
@ -44,7 +44,7 @@ LL | println!("{}", a: usize < 4); //~ ERROR `<` is interpreted as a start o
| help: try comparing the cast value: `(a: usize)`
error: `<` is interpreted as a start of generic arguments for `usize`, not a comparison
--> $DIR/issue-22644.rs:18:20
--> $DIR/issue-22644.rs:20:20
|
LL | < //~ ERROR `<` is interpreted as a start of generic
| ^ not interpreted as comparison
@ -58,7 +58,7 @@ LL | usize)
|
error: `<` is interpreted as a start of generic arguments for `usize`, not a comparison
--> $DIR/issue-22644.rs:27:20
--> $DIR/issue-22644.rs:29:20
|
LL | < //~ ERROR `<` is interpreted as a start of generic
| ^ not interpreted as comparison
@ -75,7 +75,7 @@ LL |
...
error: `<` is interpreted as a start of generic arguments for `usize`, not a shift
--> $DIR/issue-22644.rs:30:31
--> $DIR/issue-22644.rs:32:31
|
LL | println!("{}", a as usize << long_name); //~ ERROR `<` is interpreted as a start of generic
| ---------- ^^ --------- interpreted as generic arguments
@ -84,7 +84,7 @@ LL | println!("{}", a as usize << long_name); //~ ERROR `<` is interpreted a
| help: try shifting the cast value: `(a as usize)`
error: expected type, found `4`
--> $DIR/issue-22644.rs:32:28
--> $DIR/issue-22644.rs:34:28
|
LL | println!("{}", a: &mut 4); //~ ERROR expected type, found `4`
| ^ expecting a type here because of type ascription