Skip to content

Commit 8e25d89

Browse files
committed
implement inline parser
1 parent 015c777 commit 8e25d89

File tree

4 files changed

+6
-2
lines changed

4 files changed

+6
-2
lines changed

compiler/rustc_attr_data_structures/src/attributes.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use thin_vec::ThinVec;
88

99
use crate::{DefaultBodyStability, PartialConstStability, PrintAttribute, RustcVersion, Stability};
1010

11-
#[derive(Copy, Clone, PartialEq, Encodable, Decodable, Debug, HashStable_Generic)]
11+
#[derive(Copy, Clone, PartialEq, Encodable, Decodable, Debug, HashStable_Generic, PrintAttribute)]
1212
pub enum InlineAttr {
1313
None,
1414
Hint,
@@ -189,6 +189,7 @@ pub enum AttributeKind {
189189
DocComment { style: AttrStyle, kind: CommentKind, span: Span, comment: Symbol },
190190

191191
/// Represents `#[rustc_macro_transparency]`.
192+
Inline(InlineAttr, Span),
192193
MacroTransparency(Transparency),
193194

194195
/// Represents [`#[repr]`](https://doc.rust-lang.org/stable/reference/type-layout.html#representations).

compiler/rustc_attr_parsing/src/attributes/inline.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ impl<S: Stage> SingleAttributeParser<S> for RustcForceInlineParser {
6363
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::WarnButFutureError;
6464
const TEMPLATE: AttributeTemplate = template!(Word, List: "reason", NameValueStr: "reason");
6565

66-
fn convert(cx: &AcceptContext<'_, '_, S>, args: &ArgParser<'_>) -> Option<AttributeKind> {
66+
fn convert(cx: &mut AcceptContext<'_, '_, S>, args: &ArgParser<'_>) -> Option<AttributeKind> {
6767
let reason = match args {
6868
ArgParser::NoArgs => None,
6969
ArgParser::List(list) => {

compiler/rustc_attr_parsing/src/attributes/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ pub(crate) mod allow_unstable;
2929
pub(crate) mod cfg;
3030
pub(crate) mod confusables;
3131
pub(crate) mod deprecation;
32+
pub(crate) mod inline;
3233
pub(crate) mod repr;
3334
pub(crate) mod stability;
3435
pub(crate) mod transparency;

compiler/rustc_attr_parsing/src/context.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ use rustc_span::{DUMMY_SP, ErrorGuaranteed, Span, Symbol, sym};
1818
use crate::attributes::allow_unstable::{AllowConstFnUnstableParser, AllowInternalUnstableParser};
1919
use crate::attributes::confusables::ConfusablesParser;
2020
use crate::attributes::deprecation::DeprecationParser;
21+
use crate::attributes::inline::InlineParser;
2122
use crate::attributes::repr::ReprParser;
2223
use crate::attributes::stability::{
2324
BodyStabilityParser, ConstStabilityIndirectParser, ConstStabilityParser, StabilityParser,
@@ -104,6 +105,7 @@ attribute_parsers!(
104105
// tidy-alphabetical-start
105106
Single<ConstStabilityIndirectParser>,
106107
Single<DeprecationParser>,
108+
Single<InlineParser>,
107109
Single<TransparencyParser>,
108110
// tidy-alphabetical-end
109111
];

0 commit comments

Comments
 (0)