diff options
Diffstat (limited to 'compiler')
| -rw-r--r-- | compiler/rustc_builtin_macros/src/lib.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_data_structures/src/lib.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_feature/src/accepted.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_feature/src/builtin_attrs.rs | 6 | ||||
| -rw-r--r-- | compiler/rustc_feature/src/unstable.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_lint/src/expect.rs | 5 | ||||
| -rw-r--r-- | compiler/rustc_lint/src/levels.rs | 10 | ||||
| -rw-r--r-- | compiler/rustc_lint_defs/src/builtin.rs | 26 |
8 files changed, 15 insertions, 40 deletions
diff --git a/compiler/rustc_builtin_macros/src/lib.rs b/compiler/rustc_builtin_macros/src/lib.rs index 8ac59605bc1..b3ec9a577b5 100644 --- a/compiler/rustc_builtin_macros/src/lib.rs +++ b/compiler/rustc_builtin_macros/src/lib.rs @@ -12,7 +12,7 @@ #![feature(decl_macro)] #![feature(if_let_guard)] #![feature(let_chains)] -#![feature(lint_reasons)] +#![cfg_attr(bootstrap, feature(lint_reasons))] #![feature(proc_macro_internals)] #![feature(proc_macro_quote)] #![feature(rustdoc_internals)] diff --git a/compiler/rustc_data_structures/src/lib.rs b/compiler/rustc_data_structures/src/lib.rs index cddc67d1578..356ddf014be 100644 --- a/compiler/rustc_data_structures/src/lib.rs +++ b/compiler/rustc_data_structures/src/lib.rs @@ -10,6 +10,7 @@ #![allow(internal_features)] #![allow(rustc::default_hash_types)] #![allow(rustc::potential_query_instability)] +#![cfg_attr(bootstrap, feature(lint_reasons))] #![cfg_attr(not(parallel_compiler), feature(cell_leak))] #![deny(unsafe_op_in_unsafe_fn)] #![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")] @@ -24,7 +25,6 @@ #![feature(extend_one)] #![feature(hash_raw_entry)] #![feature(hasher_prefixfree_extras)] -#![feature(lint_reasons)] #![feature(macro_metavar_expr)] #![feature(map_try_insert)] #![feature(min_specialization)] diff --git a/compiler/rustc_feature/src/accepted.rs b/compiler/rustc_feature/src/accepted.rs index 9beaa6b8d95..f082cc2b569 100644 --- a/compiler/rustc_feature/src/accepted.rs +++ b/compiler/rustc_feature/src/accepted.rs @@ -232,6 +232,8 @@ declare_features! ( (accepted, label_break_value, "1.65.0", Some(48594)), /// Allows `let...else` statements. (accepted, let_else, "1.65.0", Some(87335)), + /// Allows using `reason` in lint attributes and the `#[expect(lint)]` lint check. + (accepted, lint_reasons, "CURRENT_RUSTC_VERSION", Some(54503)), /// Allows `break {expr}` with a value inside `loop`s. (accepted, loop_break_value, "1.19.0", Some(37339)), /// Allows use of `?` as the Kleene "at most one" operator in macros. diff --git a/compiler/rustc_feature/src/builtin_attrs.rs b/compiler/rustc_feature/src/builtin_attrs.rs index c53bf965139..32a047a9363 100644 --- a/compiler/rustc_feature/src/builtin_attrs.rs +++ b/compiler/rustc_feature/src/builtin_attrs.rs @@ -369,9 +369,9 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[ allow, Normal, template!(List: r#"lint1, lint2, ..., /*opt*/ reason = "...""#), DuplicatesOk, EncodeCrossCrate::No, ), - gated!( - expect, Normal, template!(List: r#"lint1, lint2, ..., /*opt*/ reason = "...""#), DuplicatesOk, - EncodeCrossCrate::No, lint_reasons, experimental!(expect) + ungated!( + expect, Normal, template!(List: r#"lint1, lint2, ..., /*opt*/ reason = "...""#), + DuplicatesOk, EncodeCrossCrate::No, ), ungated!( forbid, Normal, template!(List: r#"lint1, lint2, ..., /*opt*/ reason = "...""#), diff --git a/compiler/rustc_feature/src/unstable.rs b/compiler/rustc_feature/src/unstable.rs index 2dfaac8f6e7..f4e20328814 100644 --- a/compiler/rustc_feature/src/unstable.rs +++ b/compiler/rustc_feature/src/unstable.rs @@ -512,8 +512,6 @@ declare_features! ( /// Allows using `#[link(kind = "link-arg", name = "...")]` /// to pass custom arguments to the linker. (unstable, link_arg_attribute, "1.76.0", Some(99427)), - /// Allows using `reason` in lint attributes and the `#[expect(lint)]` lint check. - (unstable, lint_reasons, "1.31.0", Some(54503)), /// Give access to additional metadata about declarative macro meta-variables. (unstable, macro_metavar_expr, "1.61.0", Some(83527)), /// Provides a way to concatenate identifiers using metavariable expressions. diff --git a/compiler/rustc_lint/src/expect.rs b/compiler/rustc_lint/src/expect.rs index 40db765da53..04c2ebf189f 100644 --- a/compiler/rustc_lint/src/expect.rs +++ b/compiler/rustc_lint/src/expect.rs @@ -3,7 +3,6 @@ use rustc_middle::query::Providers; use rustc_middle::ty::TyCtxt; use rustc_session::lint::builtin::UNFULFILLED_LINT_EXPECTATIONS; use rustc_session::lint::LintExpectationId; -use rustc_span::symbol::sym; use rustc_span::Symbol; pub(crate) fn provide(providers: &mut Providers) { @@ -11,10 +10,6 @@ pub(crate) fn provide(providers: &mut Providers) { } fn check_expectations(tcx: TyCtxt<'_>, tool_filter: Option<Symbol>) { - if !tcx.features().active(sym::lint_reasons) { - return; - } - let lint_expectations = tcx.lint_expectations(()); let fulfilled_expectations = tcx.dcx().steal_fulfilled_expectation_ids(); diff --git a/compiler/rustc_lint/src/levels.rs b/compiler/rustc_lint/src/levels.rs index 1317af50a4a..0df34c32e38 100644 --- a/compiler/rustc_lint/src/levels.rs +++ b/compiler/rustc_lint/src/levels.rs @@ -37,7 +37,6 @@ use rustc_session::lint::{ }, Level, Lint, LintExpectationId, LintId, }; -use rustc_session::parse::feature_err; use rustc_session::Session; use rustc_span::symbol::{sym, Symbol}; use rustc_span::{Span, DUMMY_SP}; @@ -788,15 +787,6 @@ impl<'s, P: LintLevelsProvider> LintLevelsBuilder<'s, P> { ast::MetaItemKind::NameValue(ref name_value) => { if item.path == sym::reason { if let ast::LitKind::Str(rationale, _) = name_value.kind { - if !self.features.lint_reasons { - feature_err( - &self.sess, - sym::lint_reasons, - item.span, - "lint reasons are experimental", - ) - .emit(); - } reason = Some(rationale); } else { sess.dcx().emit_err(MalformedAttribute { diff --git a/compiler/rustc_lint_defs/src/builtin.rs b/compiler/rustc_lint_defs/src/builtin.rs index a023d6161df..39066ddcf00 100644 --- a/compiler/rustc_lint_defs/src/builtin.rs +++ b/compiler/rustc_lint_defs/src/builtin.rs @@ -608,13 +608,13 @@ declare_lint! { } declare_lint! { - /// The `unfulfilled_lint_expectations` lint detects lint trigger expectations - /// that have not been fulfilled. + /// The `unfulfilled_lint_expectations` lint warns if a lint expectation is + /// unfulfilled. /// /// ### Example /// /// ```rust - /// #![feature(lint_reasons)] + /// #![cfg_attr(bootstrap, feature(lint_reasons))] /// /// #[expect(unused_variables)] /// let x = 10; @@ -625,24 +625,14 @@ declare_lint! { /// /// ### Explanation /// - /// It was expected that the marked code would emit a lint. This expectation - /// has not been fulfilled. + /// The `#[expect]` attribute can be used to create a lint expectation. The + /// expectation is fulfilled, if a `#[warn]` attribute at the same location + /// would result in a lint emission. If the expectation is unfulfilled, + /// because no lint was emitted, this lint will be emitted on the attribute. /// - /// The `expect` attribute can be removed if this is intended behavior otherwise - /// it should be investigated why the expected lint is no longer issued. - /// - /// In rare cases, the expectation might be emitted at a different location than - /// shown in the shown code snippet. In most cases, the `#[expect]` attribute - /// works when added to the outer scope. A few lints can only be expected - /// on a crate level. - /// - /// Part of RFC 2383. The progress is being tracked in [#54503] - /// - /// [#54503]: https://github.com/rust-lang/rust/issues/54503 pub UNFULFILLED_LINT_EXPECTATIONS, Warn, - "unfulfilled lint expectation", - @feature_gate = rustc_span::sym::lint_reasons; + "unfulfilled lint expectation" } declare_lint! { |
