-
Notifications
You must be signed in to change notification settings - Fork 13.3k
add test to reproduce #137687 and add a hotfix #140584
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
extern crate proc_macro; | ||
|
||
use proc_macro::TokenStream; | ||
|
||
#[proc_macro_derive(Bar, attributes(arg))] | ||
pub fn derive_bar(_: proc_macro::TokenStream) -> proc_macro::TokenStream { | ||
TokenStream::new() | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
//@compile-flags: --crate-type=lib | ||
// reproduces #137687 | ||
// FIXME(jdonszelmann): should ERROR malformed `crate_name` attribute input but now still ignored. | ||
// This is for the beta backport of 1.87 | ||
#[crate_name = concat!("Cloneb")] | ||
|
||
macro_rules! inline { | ||
() => {}; | ||
} | ||
|
||
#[crate_name] //~ ERROR malformed `crate_name` attribute input | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh yeah, this test case should definitely not reside in the same file as the one above as it masks the delayed_span_bug! If you remove the one below, the one above still ICEs on master: In compiler/rustc_attr_parsing/src/context.rs:337:43 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ugh, alright ty There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. will fix There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just to be clear because it's getting slightly complicated ^^', you can either hotfix this issue (#137687) in this PR as you said you might and then we can beta-nominate it or we just ignore the ICE hitting stable (because it's fuzzer-generated and might not affect real users but who knows) and wait for "that lint buffering PR" to get merged which would unblock your real fix in #137729. 🤷 |
||
mod foo {} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
error: malformed `crate_name` attribute input | ||
--> $DIR/crate_name_on_other_items.rs:11:1 | ||
| | ||
LL | #[crate_name] | ||
| ^^^^^^^^^^^^^ help: must be of the form: `#[crate_name = "name"]` | ||
|
||
error: aborting due to 1 previous error | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
//@ proc-macro: bar_derive.rs | ||
//@ check-pass | ||
|
||
extern crate bar_derive; | ||
use bar_derive as bar; | ||
|
||
macro_rules! call_macro { | ||
($text:expr) => { | ||
#[derive(bar::Bar)] | ||
#[arg($text)] | ||
pub struct Foo; | ||
}; | ||
} | ||
|
||
call_macro!(1 + 1); | ||
|
||
fn main() {} |
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,8 @@ | ||||||||||
//@check-pass | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
with |
||||||||||
//@ compile-flags: --print=file-names | ||||||||||
|
||||||||||
#[crate_name = concat!("wrapped")] | ||||||||||
|
||||||||||
macro_rules! inline { | ||||||||||
() => {}; | ||||||||||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
print-file-names-request-malformed-crate-name-3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is
MetaItemOrLitParser::Err
no longer constructed onmaster
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this may be true, actually! lets see
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think @nnethercote 's recent work did that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Uh, right. It was 'unintentionally' fixed in #124141 which is part of 1.88 and since we need a hotfix for 1.87 (current beta) and certainly don't want to backport #124141, we'd need a PR targeting the beta branch. Lemme think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Opened #140601.