Skip to content

Commit d7185dc

Browse files
committed
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)] ^~~~ ```
2 parents cfceeca + 70db73a commit d7185dc

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/librustc_lint/builtin.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -2203,7 +2203,11 @@ impl LintPass for UnstableFeatures {
22032203
}
22042204
fn check_attribute(&mut self, ctx: &Context, attr: &ast::Attribute) {
22052205
if attr::contains_name(&[attr.node.value.clone()], "feature") {
2206-
ctx.span_lint(UNSTABLE_FEATURES, attr.span, "unstable feature");
2206+
if let Some(items) = attr.node.value.meta_item_list() {
2207+
for item in items {
2208+
ctx.span_lint(UNSTABLE_FEATURES, item.span, "unstable feature");
2209+
}
2210+
}
22072211
}
22082212
}
22092213
}

0 commit comments

Comments
 (0)