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

The compiler sets bad krate span for plugins #23964

Closed
huonw opened this Issue Apr 2, 2015 · 2 comments

Comments

Projects
None yet
2 participants
@huonw
Copy link
Member

huonw commented Apr 2, 2015

// bad_plugin_span.rs
#![crate_type="dylib"]
#![feature(plugin_registrar, rustc_private)]

extern crate rustc;

#[plugin_registrar]
pub fn plugin_registrar(reg: &mut rustc::plugin::Registry) {
    println!("{:?}", reg.krate_span);
    reg.sess.span_err(reg.krate_span, "should point to `#[plugin(...)]`");
}
// bad_plugin_span_demo.rs
#![feature(plugin)]
#![plugin(bad_plugin_span)]

fn main() {}
$ rustc bad_plugin_span.rs && rustc -L . bad_plugin_span_demo.rs
Span { lo: BytePos(27), hi: BytePos(87), expn_id: ExpnId(4294967295) }
bad_plugin_span_demo.rs:2:1: 5:12 error: should point to `#[plugin(...)]`
bad_plugin_span_demo.rs:2 #![feature(plugin)]
bad_plugin_span_demo.rs:3 #![plugin(bad_plugin_span)]
bad_plugin_span_demo.rs:4 
bad_plugin_span_demo.rs:5 fn main() {}
error: aborting due to previous error

The krate_span field of the registry should be pointing to the place that introduces the plugin, i.e. the #[plugin(...)] but it is instead pointing to the whole file (at least, from the start of the first token to the end of the last).

@brson

This comment has been minimized.

Copy link
Contributor

brson commented Dec 1, 2016

Is this still reproducible?

@brson brson added the I-wrong label Dec 1, 2016

@brson

This comment has been minimized.

Copy link
Contributor

brson commented Dec 1, 2016

Whatever. Closing because you're old, bug.

@brson brson closed this Dec 1, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.