Skip to content
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

Missing span information for inner attributes in input TokenStream of procedural macro attribute. #52162

Closed
peterhuene opened this issue Jul 8, 2018 · 1 comment

Comments

@peterhuene
Copy link

peterhuene commented Jul 8, 2018

Overview

When an outer procedural macro attribute is executed, the provided TokenStream is missing span information for the inner attributes.

Example:

#[repro]
#[magic(foo = "bar")]
pub fn test() {}

For the above, the repro attribute is a procedural macro attribute. The magic attribute is actually something that the repro attribute respects and strips off when generating the code.

However, the span information for the magic attribute is missing from the TokenStream given to the repro procedural macro attribute.

Repro Steps

  1. git clone https://github.com/peterhuene/inner-attr-span-repro
  2. cargo build

Expected Results

The inner magic attribute has span information in the input TokenStream.

Actual Results

The inner magic attribute has span information that is #0 bytes(0..0) for all tokens of the inner attribute.

This prevents useful diagnostics on the inner attributes since only error messages can be emitted.

System Information

$ rustc --version
rustc 1.29.0-nightly (9fd3d7899 2018-07-07)
$ sw_vers
ProductName:    Mac OS X
ProductVersion: 10.13.5
BuildVersion:   17F77
@peterhuene
Copy link
Author

This appears to be a dupe of #47941.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant