Skip to content

Commit 2f32eea

Browse files
committed
validate (ish) eii
1 parent accd64e commit 2f32eea

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::rustc::RustcMacroEdition2021Parser;
1920
use crate::attributes::stability::{
@@ -77,6 +78,7 @@ attribute_groups!(
7778
// tidy-alphabetical-start
7879
Single<ConstStabilityIndirectParser>,
7980
Single<DeprecationParser>,
81+
Single<EiiParser>,
8082
Single<RustcMacroEdition2021Parser>,
8183
Single<TransparencyParser>,
8284
// tidy-alphabetical-end

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,
@@ -453,6 +456,17 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
453456
}
454457
}
455458

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

0 commit comments

Comments
 (0)