Rollup merge of #94274 - djkoloski:unknown_unstable_lints, r=tmandry
Treat unstable lints as unknown This change causes unstable lints to be ignored if the `unknown_lints` lint is allowed. To achieve this, it also changes lints to apply as soon as they are processed. Previously, lints in the same set were processed as a batch and then all simultaneously applied. Implementation of https://github.com/rust-lang/compiler-team/issues/469
This commit is contained in:
commit
1ed2a94fd2
21 changed files with 383 additions and 114 deletions
|
@ -98,7 +98,26 @@ pub fn feature_err_issue<'a>(
|
|||
explain: &str,
|
||||
) -> DiagnosticBuilder<'a, ErrorGuaranteed> {
|
||||
let mut err = sess.span_diagnostic.struct_span_err_with_code(span, explain, error_code!(E0658));
|
||||
add_feature_diagnostics_for_issue(&mut err, sess, feature, issue);
|
||||
err
|
||||
}
|
||||
|
||||
/// Adds the diagnostics for a feature to an existing error.
|
||||
pub fn add_feature_diagnostics<'a>(err: &mut Diagnostic, sess: &'a ParseSess, feature: Symbol) {
|
||||
add_feature_diagnostics_for_issue(err, sess, feature, GateIssue::Language);
|
||||
}
|
||||
|
||||
/// Adds the diagnostics for a feature to an existing error.
|
||||
///
|
||||
/// This variant allows you to control whether it is a library or language feature.
|
||||
/// Almost always, you want to use this for a language feature. If so, prefer
|
||||
/// `add_feature_diagnostics`.
|
||||
pub fn add_feature_diagnostics_for_issue<'a>(
|
||||
err: &mut Diagnostic,
|
||||
sess: &'a ParseSess,
|
||||
feature: Symbol,
|
||||
issue: GateIssue,
|
||||
) {
|
||||
if let Some(n) = find_feature_issue(feature, issue) {
|
||||
err.note(&format!(
|
||||
"see issue #{} <https://github.com/rust-lang/rust/issues/{}> for more information",
|
||||
|
@ -110,8 +129,6 @@ pub fn feature_err_issue<'a>(
|
|||
if sess.unstable_features.is_nightly_build() {
|
||||
err.help(&format!("add `#![feature({})]` to the crate attributes to enable", feature));
|
||||
}
|
||||
|
||||
err
|
||||
}
|
||||
|
||||
/// Info about a parsing session.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue