split attributes
This commit is contained in:
parent
eedc229049
commit
1341366af9
29 changed files with 1521 additions and 1415 deletions
|
@ -6,7 +6,7 @@ use std::num::NonZero;
|
|||
|
||||
use rustc_attr::{
|
||||
self as attr, ConstStability, DeprecatedSince, Stability, StabilityLevel, StableSince,
|
||||
Unstable, UnstableReason, VERSION_PLACEHOLDER,
|
||||
UnstableReason, VERSION_PLACEHOLDER,
|
||||
};
|
||||
use rustc_data_structures::fx::FxIndexMap;
|
||||
use rustc_data_structures::unord::{ExtendUnord, UnordMap, UnordSet};
|
||||
|
@ -199,7 +199,7 @@ impl<'a, 'tcx> Annotator<'a, 'tcx> {
|
|||
// this is *almost surely* an accident.
|
||||
if let (
|
||||
&Some(DeprecatedSince::RustcVersion(dep_since)),
|
||||
&attr::Stable { since: stab_since, .. },
|
||||
&attr::StabilityLevel::Stable { since: stab_since, .. },
|
||||
) = (&depr.as_ref().map(|(d, _)| d.since), &stab.level)
|
||||
{
|
||||
match stab_since {
|
||||
|
@ -224,15 +224,17 @@ impl<'a, 'tcx> Annotator<'a, 'tcx> {
|
|||
|
||||
// Stable *language* features shouldn't be used as unstable library features.
|
||||
// (Not doing this for stable library features is checked by tidy.)
|
||||
if let Stability { level: Unstable { .. }, feature } = stab {
|
||||
if let Stability { level: StabilityLevel::Unstable { .. }, feature } = stab {
|
||||
if ACCEPTED_LANG_FEATURES.iter().find(|f| f.name == feature).is_some() {
|
||||
self.tcx
|
||||
.dcx()
|
||||
.emit_err(errors::UnstableAttrForAlreadyStableFeature { span, item_sp });
|
||||
}
|
||||
}
|
||||
if let Stability { level: Unstable { implied_by: Some(implied_by), .. }, feature } =
|
||||
stab
|
||||
if let Stability {
|
||||
level: StabilityLevel::Unstable { implied_by: Some(implied_by), .. },
|
||||
feature,
|
||||
} = stab
|
||||
{
|
||||
self.index.implications.insert(implied_by, feature);
|
||||
}
|
||||
|
@ -278,8 +280,10 @@ impl<'a, 'tcx> Annotator<'a, 'tcx> {
|
|||
|
||||
// Stable *language* features shouldn't be used as unstable library features.
|
||||
// (Not doing this for stable library features is checked by tidy.)
|
||||
if let Some((ConstStability { level: Unstable { .. }, feature, .. }, const_span)) =
|
||||
const_stab
|
||||
if let Some((
|
||||
ConstStability { level: StabilityLevel::Unstable { .. }, feature, .. },
|
||||
const_span,
|
||||
)) = const_stab
|
||||
{
|
||||
if ACCEPTED_LANG_FEATURES.iter().find(|f| f.name == feature).is_some() {
|
||||
self.tcx.dcx().emit_err(errors::UnstableAttrForAlreadyStableFeature {
|
||||
|
@ -314,7 +318,7 @@ impl<'a, 'tcx> Annotator<'a, 'tcx> {
|
|||
});
|
||||
|
||||
if let Some(ConstStability {
|
||||
level: Unstable { implied_by: Some(implied_by), .. },
|
||||
level: StabilityLevel::Unstable { implied_by: Some(implied_by), .. },
|
||||
feature,
|
||||
..
|
||||
}) = const_stab
|
||||
|
@ -780,7 +784,11 @@ impl<'tcx> Visitor<'tcx> for Checker<'tcx> {
|
|||
// error if all involved types and traits are stable, because
|
||||
// it will have no effect.
|
||||
// See: https://github.com/rust-lang/rust/issues/55436
|
||||
if let Some((Stability { level: attr::Unstable { .. }, .. }, span)) = stab {
|
||||
if let Some((
|
||||
Stability { level: attr::StabilityLevel::Unstable { .. }, .. },
|
||||
span,
|
||||
)) = stab
|
||||
{
|
||||
let mut c = CheckTraitImplStable { tcx: self.tcx, fully_stable: true };
|
||||
c.visit_ty(self_ty);
|
||||
c.visit_trait_ref(t);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue