diff options
| author | bors <bors@rust-lang.org> | 2018-12-27 22:27:27 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2018-12-27 22:27:27 +0000 |
| commit | f8caa321c7c7214a6c5415e4b3694e65b4ff73a7 (patch) | |
| tree | 0ba10b2287624eb95f56f7e5ddce2f7041125acd /src/test/ui/issues | |
| parent | fb86d604bf65c3becd16180b56267a329cf268d5 (diff) | |
| parent | bc16edeb28e38e5bbed8828fb6314b1cc5151235 (diff) | |
| download | rust-f8caa321c7c7214a6c5415e4b3694e65b4ff73a7.tar.gz rust-f8caa321c7c7214a6c5415e4b3694e65b4ff73a7.zip | |
Auto merge of #56999 - petrochenkov:macrecov2, r=estebank
AST/HIR: Introduce `ExprKind::Err` for better error recovery in the front-end This way we can avoid aborting compilation if expansion produces errors and generate `ExprKind::Err`s instead.
Diffstat (limited to 'src/test/ui/issues')
22 files changed, 86 insertions, 37 deletions
diff --git a/src/test/ui/issues/issue-10536.rs b/src/test/ui/issues/issue-10536.rs index f8695caca5b..95c8c2b0585 100644 --- a/src/test/ui/issues/issue-10536.rs +++ b/src/test/ui/issues/issue-10536.rs @@ -1,8 +1,6 @@ // We only want to assert that this doesn't ICE, we don't particularly care // about whether it nor it fails to compile. -// error-pattern: - macro_rules! foo{ () => {{ macro_rules! bar{() => (())} @@ -15,9 +13,11 @@ pub fn main() { assert!({one! two()}); //~^ ERROR macros that expand to items must either be surrounded with braces or followed by a + //~| ERROR cannot find macro `one!` in this scope + //~| ERROR mismatched types // regardless of whether nested macro_rules works, the following should at // least throw a conventional error. assert!({one! two}); - //~^ ERROR expected + //~^ ERROR expected `(` or `{`, found `}` } diff --git a/src/test/ui/issues/issue-10536.stderr b/src/test/ui/issues/issue-10536.stderr index bc542ce35c0..d5caf777cd4 100644 --- a/src/test/ui/issues/issue-10536.stderr +++ b/src/test/ui/issues/issue-10536.stderr @@ -1,5 +1,5 @@ error: macros that expand to items must either be surrounded with braces or followed by a semicolon - --> $DIR/issue-10536.rs:16:22 + --> $DIR/issue-10536.rs:14:22 | LL | assert!({one! two()}); | ^^ @@ -10,5 +10,21 @@ error: expected `(` or `{`, found `}` LL | assert!({one! two}); | ^ expected `(` or `{` -error: aborting due to 2 previous errors +error: cannot find macro `one!` in this scope + --> $DIR/issue-10536.rs:14:14 + | +LL | assert!({one! two()}); + | ^^^ + +error[E0308]: mismatched types + --> $DIR/issue-10536.rs:14:13 + | +LL | assert!({one! two()}); + | ^^^^^^^^^^^^ expected bool, found () + | + = note: expected type `bool` + found type `()` + +error: aborting due to 4 previous errors +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/issues/issue-11692-1.rs b/src/test/ui/issues/issue-11692-1.rs index eae555ad83c..22777780402 100644 --- a/src/test/ui/issues/issue-11692-1.rs +++ b/src/test/ui/issues/issue-11692-1.rs @@ -1,4 +1,5 @@ fn main() { print!(testo!()); //~^ ERROR: format argument must be a string literal + //~| ERROR: cannot find macro `testo!` in this scope } diff --git a/src/test/ui/issues/issue-11692-1.stderr b/src/test/ui/issues/issue-11692-1.stderr index 1173e056321..f4cc825803a 100644 --- a/src/test/ui/issues/issue-11692-1.stderr +++ b/src/test/ui/issues/issue-11692-1.stderr @@ -8,5 +8,11 @@ help: you might be missing a string literal to format with LL | print!("{}", testo!()); | ^^^^^ -error: aborting due to previous error +error: cannot find macro `testo!` in this scope + --> $DIR/issue-11692-1.rs:2:12 + | +LL | print!(testo!()); + | ^^^^^ + +error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-11692-2.rs b/src/test/ui/issues/issue-11692-2.rs index 61be284d732..61039316573 100644 --- a/src/test/ui/issues/issue-11692-2.rs +++ b/src/test/ui/issues/issue-11692-2.rs @@ -1,3 +1,4 @@ fn main() { concat!(test!()); //~ ERROR cannot find macro `test!` in this scope + //~| ERROR expected a literal } diff --git a/src/test/ui/issues/issue-11692-2.stderr b/src/test/ui/issues/issue-11692-2.stderr index 5d4467080f1..848415435a7 100644 --- a/src/test/ui/issues/issue-11692-2.stderr +++ b/src/test/ui/issues/issue-11692-2.stderr @@ -1,8 +1,16 @@ +error: expected a literal + --> $DIR/issue-11692-2.rs:2:13 + | +LL | concat!(test!()); //~ ERROR cannot find macro `test!` in this scope + | ^^^^^^^ + | + = note: only literals (like `"foo"`, `42` and `3.14`) can be passed to `concat!()` + error: cannot find macro `test!` in this scope --> $DIR/issue-11692-2.rs:2:13 | LL | concat!(test!()); //~ ERROR cannot find macro `test!` in this scope | ^^^^ -error: aborting due to previous error +error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-32950.rs b/src/test/ui/issues/issue-32950.rs index dc5b063ada4..27d68a11c1f 100644 --- a/src/test/ui/issues/issue-32950.rs +++ b/src/test/ui/issues/issue-32950.rs @@ -3,6 +3,7 @@ #[derive(Debug)] struct Baz<T>( concat_idents!(Foo, Bar) //~ ERROR `derive` cannot be used on items with type macros + //~^ ERROR cannot find type `FooBar` in this scope ); fn main() {} diff --git a/src/test/ui/issues/issue-32950.stderr b/src/test/ui/issues/issue-32950.stderr index e8e3347af2e..13aed4a1756 100644 --- a/src/test/ui/issues/issue-32950.stderr +++ b/src/test/ui/issues/issue-32950.stderr @@ -4,5 +4,12 @@ error: `derive` cannot be used on items with type macros LL | concat_idents!(Foo, Bar) //~ ERROR `derive` cannot be used on items with type macros | ^^^^^^^^^^^^^^^^^^^^^^^^ -error: aborting due to previous error +error[E0412]: cannot find type `FooBar` in this scope + --> $DIR/issue-32950.rs:5:5 + | +LL | concat_idents!(Foo, Bar) //~ ERROR `derive` cannot be used on items with type macros + | ^^^^^^^^^^^^^^^^^^^^^^^^ not found in this scope + +error: aborting due to 2 previous errors +For more information about this error, try `rustc --explain E0412`. diff --git a/src/test/ui/issues/issue-33571.rs b/src/test/ui/issues/issue-33571.rs index 5f9c514addb..223bbc3ff5e 100644 --- a/src/test/ui/issues/issue-33571.rs +++ b/src/test/ui/issues/issue-33571.rs @@ -2,3 +2,5 @@ Sync, //~ ERROR this unsafe trait should be implemented explicitly Copy)] enum Foo {} + +fn main() {} diff --git a/src/test/ui/issues/issue-35677.rs b/src/test/ui/issues/issue-35677.rs index 46d3f7e4af0..71e2125ffd2 100644 --- a/src/test/ui/issues/issue-35677.rs +++ b/src/test/ui/issues/issue-35677.rs @@ -3,3 +3,5 @@ fn intersect_map<K, V>(this: &mut HashMap<K, V>, other: HashMap<K, V>) -> bool { this.drain() //~^ ERROR no method named } + +fn main() {} diff --git a/src/test/ui/issues/issue-35677.stderr b/src/test/ui/issues/issue-35677.stderr index dca096b93f5..61ddb75b3b5 100644 --- a/src/test/ui/issues/issue-35677.stderr +++ b/src/test/ui/issues/issue-35677.stderr @@ -1,7 +1,3 @@ -error[E0601]: `main` function not found in crate `issue_35677` - | - = note: consider adding a `main` function to `$DIR/issue-35677.rs` - error[E0599]: no method named `drain` found for type `&mut std::collections::HashMap<K, V>` in the current scope --> $DIR/issue-35677.rs:3:10 | @@ -12,7 +8,6 @@ LL | this.drain() `K : std::cmp::Eq` `K : std::hash::Hash` -error: aborting due to 2 previous errors +error: aborting due to previous error -Some errors occurred: E0599, E0601. -For more information about an error, try `rustc --explain E0599`. +For more information about this error, try `rustc --explain E0599`. diff --git a/src/test/ui/issues/issue-36617.rs b/src/test/ui/issues/issue-36617.rs index 846efac41c8..87092689a28 100644 --- a/src/test/ui/issues/issue-36617.rs +++ b/src/test/ui/issues/issue-36617.rs @@ -1 +1,3 @@ #![derive(Copy)] //~ ERROR `derive` may only be applied to structs, enums and unions + +fn main() {} diff --git a/src/test/ui/issues/issue-43023.rs b/src/test/ui/issues/issue-43023.rs index 32bd66f5a93..072243d881c 100644 --- a/src/test/ui/issues/issue-43023.rs +++ b/src/test/ui/issues/issue-43023.rs @@ -16,3 +16,5 @@ trait Tr2 { #[derive(Debug)] //~ ERROR `derive` may only be applied to structs, enums and unions type F; } + +fn main() {} diff --git a/src/test/ui/issues/issue-46438.rs b/src/test/ui/issues/issue-46438.rs index a16c4c31d81..d78b958463f 100644 --- a/src/test/ui/issues/issue-46438.rs +++ b/src/test/ui/issues/issue-46438.rs @@ -4,7 +4,7 @@ macro_rules! m { } } -trait Trait {} +trait Tr {} m!(Tr); diff --git a/src/test/ui/issues/issue-49074.rs b/src/test/ui/issues/issue-49074.rs index dbd96e96191..ad66e421c6b 100644 --- a/src/test/ui/issues/issue-49074.rs +++ b/src/test/ui/issues/issue-49074.rs @@ -9,5 +9,5 @@ mod foo { } fn main() { - bar!(); + bar!(); //~ ERROR cannot find macro `bar!` in this scope } diff --git a/src/test/ui/issues/issue-49074.stderr b/src/test/ui/issues/issue-49074.stderr index 8de4d081413..d4648270f2d 100644 --- a/src/test/ui/issues/issue-49074.stderr +++ b/src/test/ui/issues/issue-49074.stderr @@ -6,6 +6,14 @@ LL | #[marco_use] // typo | = help: add #![feature(custom_attribute)] to the crate attributes to enable -error: aborting due to previous error +error: cannot find macro `bar!` in this scope + --> $DIR/issue-49074.rs:12:4 + | +LL | bar!(); //~ ERROR cannot find macro `bar!` in this scope + | ^^^ + | + = help: have you added the `#[macro_use]` on the module/import? + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/issues/issue-51279.rs b/src/test/ui/issues/issue-51279.rs index caef23043cb..ad5438fbd46 100644 --- a/src/test/ui/issues/issue-51279.rs +++ b/src/test/ui/issues/issue-51279.rs @@ -22,3 +22,4 @@ unsafe impl<#[cfg_attr(none, may_dangle)] T> Drop for M<T> { type Z<#[ignored] 'a, #[cfg(none)] T> = X<'a, T>; //~^ ERROR #[cfg] cannot be applied on a generic parameter +//~| ERROR attribute `ignored` is currently unknown to the compiler diff --git a/src/test/ui/issues/issue-51279.stderr b/src/test/ui/issues/issue-51279.stderr index 89786f72e18..1706e98e83b 100644 --- a/src/test/ui/issues/issue-51279.stderr +++ b/src/test/ui/issues/issue-51279.stderr @@ -46,5 +46,14 @@ error: #[cfg] cannot be applied on a generic parameter LL | type Z<#[ignored] 'a, #[cfg(none)] T> = X<'a, T>; | ^^^^^^^^^^^^ -error: aborting due to 8 previous errors +error[E0658]: The attribute `ignored` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) + --> $DIR/issue-51279.rs:23:8 + | +LL | type Z<#[ignored] 'a, #[cfg(none)] T> = X<'a, T>; + | ^^^^^^^^^^ + | + = help: add #![feature(custom_attribute)] to the crate attributes to enable + +error: aborting due to 9 previous errors +For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/issues/issue-55796.rs b/src/test/ui/issues/issue-55796.rs index a172f6a7bfa..efdea5c9b1e 100644 --- a/src/test/ui/issues/issue-55796.rs +++ b/src/test/ui/issues/issue-55796.rs @@ -22,3 +22,5 @@ pub trait Graph<'a> { //~^ ERROR cannot infer } } + +fn main() {} diff --git a/src/test/ui/issues/issue-55796.stderr b/src/test/ui/issues/issue-55796.stderr index f8ca0727efb..c05f8b85d0e 100644 --- a/src/test/ui/issues/issue-55796.stderr +++ b/src/test/ui/issues/issue-55796.stderr @@ -1,7 +1,3 @@ -error[E0601]: `main` function not found in crate `issue_55796` - | - = note: consider adding a `main` function to `$DIR/issue-55796.rs` - error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements --> $DIR/issue-55796.rs:16:9 | @@ -44,7 +40,6 @@ LL | Box::new(self.in_edges(u).map(|e| e.target())) expected std::boxed::Box<(dyn std::iter::Iterator<Item=<Self as Graph<'a>>::Node> + 'static)> found std::boxed::Box<dyn std::iter::Iterator<Item=<Self as Graph<'a>>::Node>> -error: aborting due to 3 previous errors +error: aborting due to 2 previous errors -Some errors occurred: E0495, E0601. -For more information about an error, try `rustc --explain E0495`. +For more information about this error, try `rustc --explain E0495`. diff --git a/src/test/ui/issues/issue-6596-2.rs b/src/test/ui/issues/issue-6596-2.rs index 056a720bc5c..b19700efe5a 100644 --- a/src/test/ui/issues/issue-6596-2.rs +++ b/src/test/ui/issues/issue-6596-2.rs @@ -4,10 +4,10 @@ macro_rules! g { ($inp:ident) => ( { $inp $nonexistent } //~^ ERROR unknown macro variable `nonexistent` - //~| ERROR expected one of ); } fn main() { + let foo = 0; g!(foo); } diff --git a/src/test/ui/issues/issue-6596-2.stderr b/src/test/ui/issues/issue-6596-2.stderr index 99decd177ef..20fbe0fab01 100644 --- a/src/test/ui/issues/issue-6596-2.stderr +++ b/src/test/ui/issues/issue-6596-2.stderr @@ -7,14 +7,5 @@ LL | { $inp $nonexistent } LL | g!(foo); | -------- in this macro invocation -error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `nonexistent` - --> $DIR/issue-6596-2.rs:5:16 - | -LL | { $inp $nonexistent } - | ^^^^^^^^^^^^ expected one of 8 possible tokens here -... -LL | g!(foo); - | -------- in this macro invocation - -error: aborting due to 2 previous errors +error: aborting due to previous error |
