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

Spans from serde losing expansion info #27817

Closed
Manishearth opened this issue Aug 13, 2015 · 3 comments
Closed

Spans from serde losing expansion info #27817

Manishearth opened this issue Aug 13, 2015 · 3 comments
Labels
A-diagnostics Area: Messages for errors, warnings, and lints C-bug Category: This is a bug.

Comments

@Manishearth
Copy link
Member

https://github.com/Manishearth/scratch/tree/rustc_serde_spans

If you run cargo build in poc there, the span_lint shows:

   Compiling poc v0.1.0 (file:///home/manishearth/sand/bar/poc)
src/lib.rs:7:10: 7:19 error: this let-binding has unit value.
src/lib.rs:7 #[derive(Serialize)]
                      ^~~~~~~~~
src/lib.rs:4:9: 4:23 note: lint level defined here
src/lib.rs:4 #![deny(let_unit_value)]
                     ^~~~~~~~~~~~~~
src/lib.rs:7:10: 7:19 error: this let-binding has unit value.
src/lib.rs:7 #[derive(Serialize)]
                      ^~~~~~~~~
src/lib.rs:4:9: 4:23 note: lint level defined here
src/lib.rs:4 #![deny(let_unit_value)]
                     ^~~~~~~~~~~~~~
error: aborting due to 2 previous errors
Could not compile `poc`.

I'm running a nightly, and serde by default uses the plugin infrastructure, so I doubt it's syntex causing any issues here. (Also for that to happen I'd need a build script on my side)

What's unusual here is that the span_lints don't say anything about being part of a macro. They're actually catching a let binding from inside the macro (I verified this by running it on the expanded code) -- but the span says nothing about expansion and just points at derive(). I think the ExpnInfo has vanished somehow, but I'm not sure.

cc @eddyb @erickt

@steveklabnik steveklabnik added the A-diagnostics Area: Messages for errors, warnings, and lints label Aug 17, 2015
@oli-obk
Copy link
Contributor

oli-obk commented Jan 28, 2017

I don't think this is an issue anymore with custom derive stabilized?

@steveklabnik steveklabnik removed the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Mar 9, 2017
@Mark-Simulacrum Mark-Simulacrum added the C-bug Category: This is a bug. label Jul 22, 2017
@Mark-Simulacrum
Copy link
Member

I feel like this is intentional, but not sure.

@estebank
Copy link
Contributor

I'm closing this, as with proc-macro-derive library writers can specify spans to provide appropriate spans for errors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints C-bug Category: This is a bug.
Projects
None yet
Development

No branches or pull requests

5 participants