forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#49077 - sinkuu:macro_use_typo, r=estebank
Checks for unknown attributes before aborting due to unresolved macros Fixes rust-lang#49074 The ``attribute `...` is currently unknown to the compiler`` error was not shown if there are any unresolved macros, which might be caused by mistyped `macro_use`.
- Loading branch information
Showing
3 changed files
with
49 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// Copyright 2018 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. | ||
|
||
// Check that unknown attribute error is shown even if there are unresolved macros. | ||
|
||
#[marco_use] // typo | ||
//~^ ERROR The attribute `marco_use` is currently unknown to the compiler | ||
mod foo { | ||
macro_rules! bar { | ||
() => (); | ||
} | ||
} | ||
|
||
fn main() { | ||
bar!(); | ||
//~^ ERROR cannot find macro `bar!` | ||
} |
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,19 @@ | ||
error: cannot find macro `bar!` in this scope | ||
--> $DIR/issue-49074.rs:22:4 | ||
| | ||
LL | bar!(); | ||
| ^^^ | ||
| | ||
= help: have you added the `#[macro_use]` on the module/import? | ||
|
||
error[E0658]: The attribute `marco_use` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) | ||
--> $DIR/issue-49074.rs:13:1 | ||
| | ||
LL | #[marco_use] // typo | ||
| ^^^^^^^^^^^^ | ||
| | ||
= help: add #![feature(custom_attribute)] to the crate attributes to enable | ||
|
||
error: aborting due to 2 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0658`. |