Skip to content

Commit bb67210

Browse files
committed
validate (ish) eii
1 parent 7a4f708 commit bb67210

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

compiler/rustc_attr_parsing/src/context.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ use rustc_span::{DUMMY_SP, ErrorGuaranteed, Span, Symbol, sym};
1414
use crate::attributes::allow_unstable::{AllowConstFnUnstableParser, AllowInternalUnstableParser};
1515
use crate::attributes::confusables::ConfusablesParser;
1616
use crate::attributes::deprecation::DeprecationParser;
17+
use crate::attributes::eii::EiiParser;
1718
use crate::attributes::repr::ReprParser;
1819
use crate::attributes::stability::{
1920
BodyStabilityParser, ConstStabilityIndirectParser, ConstStabilityParser, StabilityParser,
@@ -76,6 +77,7 @@ attribute_groups!(
7677
// tidy-alphabetical-start
7778
Single<ConstStabilityIndirectParser>,
7879
Single<DeprecationParser>,
80+
Single<EiiParser>,
7981
Single<TransparencyParser>,
8082
// tidy-alphabetical-end
8183
];

compiler/rustc_passes/src/check_attr.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,9 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
124124
AttributeKind::Stability { span, .. }
125125
| AttributeKind::ConstStability { span, .. },
126126
) => self.check_stability_promotable(*span, target),
127+
Attribute::Parsed(AttributeKind::Eii(attr_span)) => {
128+
self.check_eii(hir_id, *attr_span, span, target)
129+
}
127130
Attribute::Parsed(AttributeKind::AllowInternalUnstable(syms)) => self
128131
.check_allow_internal_unstable(
129132
hir_id,
@@ -451,6 +454,17 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
451454
}
452455
}
453456

457+
/// Checks if an `#[inline]` is applied to a function or a closure.
458+
fn check_eii(&self, _hir_id: HirId, attr_span: Span, _defn_span: Span, target: Target) {
459+
match target {
460+
Target::ForeignFn => {}
461+
target => {
462+
// TODO:
463+
bug!("wrong target for EII: {target:?}");
464+
}
465+
}
466+
}
467+
454468
/// Checks that `#[coverage(..)]` is applied to a function/closure/method,
455469
/// or to an impl block or module.
456470
fn check_coverage(&self, attr: &Attribute, target_span: Span, target: Target) {

0 commit comments

Comments
 (0)