diff options
| author | bors <bors@rust-lang.org> | 2015-05-20 18:08:40 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2015-05-20 18:08:40 +0000 |
| commit | d7185dcff12a6963535e73ed4b0f392da236068c (patch) | |
| tree | 211ff657b6767ea805e648a2d3b320dc2ad9497d /src | |
| parent | cfceecafc680d10607e6a29b8c4b056bf86a819b (diff) | |
| parent | 70db73a33011794622e22f10fbc0c6b2cae4292c (diff) | |
| download | rust-d7185dcff12a6963535e73ed4b0f392da236068c.tar.gz rust-d7185dcff12a6963535e73ed4b0f392da236068c.zip | |
Auto merge of #25571 - hirschenberger:master, r=nrc
It is hard to find the actual unstable feature which caused the error when using a list of stable and unstable features as the span marks the whole line
```
src/k8055.rs:22:1: 22:64 error: unstable feature
src/k8055.rs:22 #![feature(slice_patterns, rustc_private, core, convert, libc)]
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```
This PR spawns an error for each unstable feature in the list:
```
est.rs:1:12: 1:26 error: unstable feature [-D unstable-features]
test.rs:1 #![feature(slice_patterns, rustc_private, core, convert, libc)]
^~~~~~~~~~~~~~
test.rs:1:28: 1:41 error: unstable feature [-D unstable-features]
test.rs:1 #![feature(slice_patterns, rustc_private, core, convert, libc)]
^~~~~~~~~~~~~
test.rs:1:43: 1:47 error: unstable feature [-D unstable-features]
test.rs:1 #![feature(slice_patterns, rustc_private, core, convert, libc)]
^~~~
test.rs:1:49: 1:56 error: unstable feature [-D unstable-features]
test.rs:1 #![feature(slice_patterns, rustc_private, core, convert, libc)]
^~~~~~~
test.rs:1:58: 1:62 error: unstable feature [-D unstable-features]
test.rs:1 #![feature(slice_patterns, rustc_private, core, convert, libc)]
^~~~
```
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustc_lint/builtin.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/librustc_lint/builtin.rs b/src/librustc_lint/builtin.rs index 3716ee395bf..a660c708f4a 100644 --- a/src/librustc_lint/builtin.rs +++ b/src/librustc_lint/builtin.rs @@ -2203,7 +2203,11 @@ impl LintPass for UnstableFeatures { } fn check_attribute(&mut self, ctx: &Context, attr: &ast::Attribute) { if attr::contains_name(&[attr.node.value.clone()], "feature") { - ctx.span_lint(UNSTABLE_FEATURES, attr.span, "unstable feature"); + if let Some(items) = attr.node.value.meta_item_list() { + for item in items { + ctx.span_lint(UNSTABLE_FEATURES, item.span, "unstable feature"); + } + } } } } |
