Skip to content

Commit 2b27dfd

Browse files
committed
Auto merge of rust-lang#22896 - Ms2ger:InlineAttr, r=huonw
2 parents 8902936 + 63513d0 commit 2b27dfd

File tree

2 files changed

+17
-18
lines changed

2 files changed

+17
-18
lines changed

src/librustc_trans/trans/base.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -433,13 +433,13 @@ pub fn set_inline_hint(f: ValueRef) {
433433
}
434434

435435
pub fn set_llvm_fn_attrs(ccx: &CrateContext, attrs: &[ast::Attribute], llfn: ValueRef) {
436-
use syntax::attr::*;
436+
use syntax::attr::{find_inline_attr, InlineAttr};
437437
// Set the inline hint if there is one
438438
match find_inline_attr(Some(ccx.sess().diagnostic()), attrs) {
439-
InlineHint => set_inline_hint(llfn),
440-
InlineAlways => set_always_inline(llfn),
441-
InlineNever => set_no_inline(llfn),
442-
InlineNone => { /* fallthrough */ }
439+
InlineAttr::Hint => set_inline_hint(llfn),
440+
InlineAttr::Always => set_always_inline(llfn),
441+
InlineAttr::Never => set_no_inline(llfn),
442+
InlineAttr::None => { /* fallthrough */ }
443443
}
444444

445445
for attr in attrs {

src/libsyntax/attr.rs

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
// Functions dealing with attributes and meta items
1212

13-
pub use self::InlineAttr::*;
1413
pub use self::StabilityLevel::*;
1514
pub use self::ReprAttr::*;
1615
pub use self::IntType::*;
@@ -285,33 +284,33 @@ pub fn find_crate_name(attrs: &[Attribute]) -> Option<InternedString> {
285284

286285
#[derive(Copy, PartialEq)]
287286
pub enum InlineAttr {
288-
InlineNone,
289-
InlineHint,
290-
InlineAlways,
291-
InlineNever,
287+
None,
288+
Hint,
289+
Always,
290+
Never,
292291
}
293292

294293
/// Determine what `#[inline]` attribute is present in `attrs`, if any.
295294
pub fn find_inline_attr(diagnostic: Option<&SpanHandler>, attrs: &[Attribute]) -> InlineAttr {
296295
// FIXME (#2809)---validate the usage of #[inline] and #[inline]
297-
attrs.iter().fold(InlineNone, |ia,attr| {
296+
attrs.iter().fold(InlineAttr::None, |ia,attr| {
298297
match attr.node.value.node {
299298
MetaWord(ref n) if *n == "inline" => {
300299
mark_used(attr);
301-
InlineHint
300+
InlineAttr::Hint
302301
}
303302
MetaList(ref n, ref items) if *n == "inline" => {
304303
mark_used(attr);
305304
if items.len() != 1 {
306305
diagnostic.map(|d|{ d.span_err(attr.span, "expected one argument"); });
307-
InlineNone
306+
InlineAttr::None
308307
} else if contains_name(&items[..], "always") {
309-
InlineAlways
308+
InlineAttr::Always
310309
} else if contains_name(&items[..], "never") {
311-
InlineNever
310+
InlineAttr::Never
312311
} else {
313312
diagnostic.map(|d|{ d.span_err((*items[0]).span, "invalid argument"); });
314-
InlineNone
313+
InlineAttr::None
315314
}
316315
}
317316
_ => ia
@@ -322,8 +321,8 @@ pub fn find_inline_attr(diagnostic: Option<&SpanHandler>, attrs: &[Attribute]) -
322321
/// True if `#[inline]` or `#[inline(always)]` is present in `attrs`.
323322
pub fn requests_inline(attrs: &[Attribute]) -> bool {
324323
match find_inline_attr(None, attrs) {
325-
InlineHint | InlineAlways => true,
326-
InlineNone | InlineNever => false,
324+
InlineAttr::Hint | InlineAttr::Always => true,
325+
InlineAttr::None | InlineAttr::Never => false,
327326
}
328327
}
329328

0 commit comments

Comments
 (0)