-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
proc_macro_attribute input has invalid span for various input. #76874
Labels
A-proc-macros
Area: Procedural macros
C-bug
Category: This is a bug.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Comments
Both of these issues will be fixed by #76130 |
update:
|
This was referenced Nov 5, 2020
the third input should be fixed by #78980 |
estebank
added
the
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
label
Nov 13, 2020
Dylan-DPC-zz
pushed a commit
to Dylan-DPC-zz/rust
that referenced
this issue
Nov 13, 2020
Fix rustc_ast_pretty print_qpath resulting in invalid macro input related rust-lang#76874 (third case) ### Issue: The input for a procedural macro is incorrect, for the rust code: ```rust mod m { pub trait Tr { type Ts: super::Tu; } } trait Tu { fn dummy() { } } #[may_proc_macro] fn foo() { <T as m::Tr>::Ts::dummy(); } ``` the macro will get the input: ```rust fn foo() { <T as m::Tr>::dummy(); } ``` Thus `Ts` has disappeared. ### Fix: This is due to invalid pretty print of qpath. This PR fix it.
Dylan-DPC-zz
pushed a commit
to Dylan-DPC-zz/rust
that referenced
this issue
Nov 13, 2020
Fix rustc_ast_pretty print_qpath resulting in invalid macro input related rust-lang#76874 (third case) ### Issue: The input for a procedural macro is incorrect, for the rust code: ```rust mod m { pub trait Tr { type Ts: super::Tu; } } trait Tu { fn dummy() { } } #[may_proc_macro] fn foo() { <T as m::Tr>::Ts::dummy(); } ``` the macro will get the input: ```rust fn foo() { <T as m::Tr>::dummy(); } ``` Thus `Ts` has disappeared. ### Fix: This is due to invalid pretty print of qpath. This PR fix it.
Dylan-DPC-zz
pushed a commit
to Dylan-DPC-zz/rust
that referenced
this issue
Nov 14, 2020
Fix rustc_ast_pretty print_qpath resulting in invalid macro input related rust-lang#76874 (third case) ### Issue: The input for a procedural macro is incorrect, for the rust code: ```rust mod m { pub trait Tr { type Ts: super::Tu; } } trait Tu { fn dummy() { } } #[may_proc_macro] fn foo() { <T as m::Tr>::Ts::dummy(); } ``` the macro will get the input: ```rust fn foo() { <T as m::Tr>::dummy(); } ``` Thus `Ts` has disappeared. ### Fix: This is due to invalid pretty print of qpath. This PR fix it.
Dylan-DPC-zz
pushed a commit
to Dylan-DPC-zz/rust
that referenced
this issue
Nov 15, 2020
Fix rustc_ast_pretty print_qpath resulting in invalid macro input related rust-lang#76874 (third case) ### Issue: The input for a procedural macro is incorrect, for the rust code: ```rust mod m { pub trait Tr { type Ts: super::Tu; } } trait Tu { fn dummy() { } } #[may_proc_macro] fn foo() { <T as m::Tr>::Ts::dummy(); } ``` the macro will get the input: ```rust fn foo() { <T as m::Tr>::dummy(); } ``` Thus `Ts` has disappeared. ### Fix: This is due to invalid pretty print of qpath. This PR fix it.
the inner doc issue is remaining but it is a duplicate of #43081 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
A-proc-macros
Area: Procedural macros
C-bug
Category: This is a bug.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Context:
input of proc_macro_attribute have invalid (null) span for some input.
I test spans with this code:
Failing inputs:
1- inner doc (this is fixed by #76130 )
prints
removing the inner doc makes the token tree having non-null spans.
2- another path attribute (with two path segment)(this one is now fixed in rustc 1.49.0-nightly (ffa2e7a 2020-10-24))prints
note that this slightly modified input will give non-null spans:
3 - some method on associated type: (this is fixed by #78980)
This will output:
So the rust error message is not pointing the failing code. All span are
0
.Meta
cargo rustc -- --version --verbose
:EDIT: related #43081
The text was updated successfully, but these errors were encountered: