diff options
| author | bors <bors@rust-lang.org> | 2024-01-22 18:22:32 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2024-01-22 18:22:32 +0000 |
| commit | d5fd0997291ca0135401a39dff25c8a9c13b8961 (patch) | |
| tree | 3fd6447ffcb2d9dc5d5aad5fc7c921ae173a5476 /compiler/rustc_lint/src | |
| parent | 021861aea8de20c76c7411eb8ada7e8235e3d9b5 (diff) | |
| parent | 0b0f0be4198de16f3a23f05e824b3a054dda1355 (diff) | |
| download | rust-d5fd0997291ca0135401a39dff25c8a9c13b8961.tar.gz rust-d5fd0997291ca0135401a39dff25c8a9c13b8961.zip | |
Auto merge of #120242 - matthiaskrgr:rollup-a93yj3i, r=matthiaskrgr
Rollup of 10 pull requests Successful merges: - #117910 (Refactor uses of `objc_msgSend` to no longer have clashing definitions) - #118639 (Undeprecate lint `unstable_features` and make use of it in the compiler) - #119801 (Fix deallocation with wrong allocator in (A)Rc::from_box_in) - #120058 (bootstrap: improvements for compiler builds) - #120059 (Make generic const type mismatches not hide trait impls from the trait solver) - #120097 (Report unreachable subpatterns consistently) - #120137 (Validate AggregateKind types in MIR) - #120164 (`maybe_lint_impl_trait`: separate `is_downgradable` from `is_object_safe`) - #120181 (Allow any `const` expression blocks in `thread_local!`) - #120218 (rustfmt: Check that a token can begin a nonterminal kind before parsing it as a macro arg) r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_lint/src')
| -rw-r--r-- | compiler/rustc_lint/src/builtin.rs | 34 |
1 files changed, 27 insertions, 7 deletions
diff --git a/compiler/rustc_lint/src/builtin.rs b/compiler/rustc_lint/src/builtin.rs index 5e1f2ed11ac..2ce78152cc2 100644 --- a/compiler/rustc_lint/src/builtin.rs +++ b/compiler/rustc_lint/src/builtin.rs @@ -1233,10 +1233,30 @@ impl<'tcx> LateLintPass<'tcx> for MutableTransmutes { } declare_lint! { - /// The `unstable_features` is deprecated and should no longer be used. + /// The `unstable_features` lint detects uses of `#![feature]`. + /// + /// ### Example + /// + /// ```rust,compile_fail + /// #![deny(unstable_features)] + /// #![feature(test)] + /// ``` + /// + /// {{produces}} + /// + /// ### Explanation + /// + /// In larger nightly-based projects which + /// + /// * consist of a multitude of crates where a subset of crates has to compile on + /// stable either unconditionally or depending on a `cfg` flag to for example + /// allow stable users to depend on them, + /// * don't use nightly for experimental features but for, e.g., unstable options only, + /// + /// this lint may come in handy to enforce policies of these kinds. UNSTABLE_FEATURES, Allow, - "enabling unstable features (deprecated. do not use)" + "enabling unstable features" } declare_lint_pass!( @@ -1246,11 +1266,11 @@ declare_lint_pass!( impl<'tcx> LateLintPass<'tcx> for UnstableFeatures { fn check_attribute(&mut self, cx: &LateContext<'_>, attr: &ast::Attribute) { - if attr.has_name(sym::feature) { - if let Some(items) = attr.meta_item_list() { - for item in items { - cx.emit_spanned_lint(UNSTABLE_FEATURES, item.span(), BuiltinUnstableFeatures); - } + if attr.has_name(sym::feature) + && let Some(items) = attr.meta_item_list() + { + for item in items { + cx.emit_spanned_lint(UNSTABLE_FEATURES, item.span(), BuiltinUnstableFeatures); } } } |
