Skip to content

Commit 1fce203

Browse files
committed
expand "incomplete feature" message to include unsoundness and link to tracking issue
1 parent 945d110 commit 1fce203

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

src/librustc_lint/builtin.rs

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ use rustc_ast::visit::{FnCtxt, FnKind};
2828
use rustc_ast_pretty::pprust::{self, expr_to_string};
2929
use rustc_data_structures::fx::FxHashSet;
3030
use rustc_errors::{Applicability, DiagnosticBuilder};
31-
use rustc_feature::Stability;
3231
use rustc_feature::{deprecated_attributes, AttributeGate, AttributeTemplate, AttributeType};
32+
use rustc_feature::{GateIssue, Stability};
3333
use rustc_hir as hir;
3434
use rustc_hir::def::{DefKind, Res};
3535
use rustc_hir::def_id::DefId;
@@ -1817,13 +1817,21 @@ impl EarlyLintPass for IncompleteFeatures {
18171817
.map(|(name, span, _)| (name, span))
18181818
.chain(features.declared_lib_features.iter().map(|(name, span)| (name, span)))
18191819
.filter(|(name, _)| rustc_feature::INCOMPLETE_FEATURES.iter().any(|f| name == &f))
1820-
.for_each(|(name, &span)| {
1820+
.for_each(|(&name, &span)| {
18211821
cx.struct_span_lint(INCOMPLETE_FEATURES, span, |lint| {
1822-
lint.build(&format!(
1823-
"the feature `{}` is incomplete and may cause the compiler to crash",
1822+
let mut builder = lint.build(&format!(
1823+
"the feature `{}` is incomplete and may not be safe to use \
1824+
and/or cause compiler crashes",
18241825
name,
1825-
))
1826-
.emit()
1826+
));
1827+
if let Some(n) = rustc_feature::find_feature_issue(name, GateIssue::Language) {
1828+
builder.note(&format!(
1829+
"see issue #{} <https://github.com/rust-lang/rust/issues/{}> \
1830+
for more information",
1831+
n, n,
1832+
));
1833+
}
1834+
builder.emit();
18271835
})
18281836
});
18291837
}

0 commit comments

Comments
 (0)