Rollup merge of #118639 - fmease:deny-features-in-stable-rustc-crates, r=WaffleLapkin
Undeprecate lint `unstable_features` and make use of it in the compiler See also #117937. r? compiler
This commit is contained in:
commit
a54c295665
5 changed files with 35 additions and 13 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue