1
Fork 0

Auto merge of #125326 - weiznich:move/do_not_recommend_to_diganostic_namespace, r=compiler-errors

Move `#[do_not_recommend]` to the `#[diagnostic]` namespace

This commit moves the `#[do_not_recommend]` attribute to the `#[diagnostic]` namespace. It still requires
`#![feature(do_not_recommend)]` to work.

r? `@compiler-errors`
This commit is contained in:
bors 2024-05-22 04:14:08 +00:00
commit b54dd08a84
22 changed files with 228 additions and 209 deletions

View file

@ -13,6 +13,7 @@ use crate::util::literal::escape_string_symbol;
use rustc_index::bit_set::GrowableBitSet;
use rustc_span::symbol::{sym, Ident, Symbol};
use rustc_span::Span;
use smallvec::{smallvec, SmallVec};
use std::iter;
use std::sync::atomic::{AtomicU32, Ordering};
use thin_vec::{thin_vec, ThinVec};
@ -87,10 +88,20 @@ impl Attribute {
AttrKind::DocComment(..) => None,
}
}
pub fn name_or_empty(&self) -> Symbol {
self.ident().unwrap_or_else(Ident::empty).name
}
pub fn path(&self) -> SmallVec<[Symbol; 1]> {
match &self.kind {
AttrKind::Normal(normal) => {
normal.item.path.segments.iter().map(|s| s.ident.name).collect()
}
AttrKind::DocComment(..) => smallvec![sym::doc],
}
}
#[inline]
pub fn has_name(&self, name: Symbol) -> bool {
match &self.kind {