Remove the re-exports for InlineAttr variants.
This commit is contained in:
parent
48aeaba934
commit
63513d06a2
2 changed files with 17 additions and 18 deletions
|
@ -433,13 +433,13 @@ pub fn set_inline_hint(f: ValueRef) {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn set_llvm_fn_attrs(ccx: &CrateContext, attrs: &[ast::Attribute], llfn: ValueRef) {
|
pub fn set_llvm_fn_attrs(ccx: &CrateContext, attrs: &[ast::Attribute], llfn: ValueRef) {
|
||||||
use syntax::attr::*;
|
use syntax::attr::{find_inline_attr, InlineAttr};
|
||||||
// Set the inline hint if there is one
|
// Set the inline hint if there is one
|
||||||
match find_inline_attr(Some(ccx.sess().diagnostic()), attrs) {
|
match find_inline_attr(Some(ccx.sess().diagnostic()), attrs) {
|
||||||
InlineHint => set_inline_hint(llfn),
|
InlineAttr::Hint => set_inline_hint(llfn),
|
||||||
InlineAlways => set_always_inline(llfn),
|
InlineAttr::Always => set_always_inline(llfn),
|
||||||
InlineNever => set_no_inline(llfn),
|
InlineAttr::Never => set_no_inline(llfn),
|
||||||
InlineNone => { /* fallthrough */ }
|
InlineAttr::None => { /* fallthrough */ }
|
||||||
}
|
}
|
||||||
|
|
||||||
for attr in attrs {
|
for attr in attrs {
|
||||||
|
|
|
@ -10,7 +10,6 @@
|
||||||
|
|
||||||
// Functions dealing with attributes and meta items
|
// Functions dealing with attributes and meta items
|
||||||
|
|
||||||
pub use self::InlineAttr::*;
|
|
||||||
pub use self::StabilityLevel::*;
|
pub use self::StabilityLevel::*;
|
||||||
pub use self::ReprAttr::*;
|
pub use self::ReprAttr::*;
|
||||||
pub use self::IntType::*;
|
pub use self::IntType::*;
|
||||||
|
@ -285,33 +284,33 @@ pub fn find_crate_name(attrs: &[Attribute]) -> Option<InternedString> {
|
||||||
|
|
||||||
#[derive(Copy, PartialEq)]
|
#[derive(Copy, PartialEq)]
|
||||||
pub enum InlineAttr {
|
pub enum InlineAttr {
|
||||||
InlineNone,
|
None,
|
||||||
InlineHint,
|
Hint,
|
||||||
InlineAlways,
|
Always,
|
||||||
InlineNever,
|
Never,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Determine what `#[inline]` attribute is present in `attrs`, if any.
|
/// Determine what `#[inline]` attribute is present in `attrs`, if any.
|
||||||
pub fn find_inline_attr(diagnostic: Option<&SpanHandler>, attrs: &[Attribute]) -> InlineAttr {
|
pub fn find_inline_attr(diagnostic: Option<&SpanHandler>, attrs: &[Attribute]) -> InlineAttr {
|
||||||
// FIXME (#2809)---validate the usage of #[inline] and #[inline]
|
// FIXME (#2809)---validate the usage of #[inline] and #[inline]
|
||||||
attrs.iter().fold(InlineNone, |ia,attr| {
|
attrs.iter().fold(InlineAttr::None, |ia,attr| {
|
||||||
match attr.node.value.node {
|
match attr.node.value.node {
|
||||||
MetaWord(ref n) if *n == "inline" => {
|
MetaWord(ref n) if *n == "inline" => {
|
||||||
mark_used(attr);
|
mark_used(attr);
|
||||||
InlineHint
|
InlineAttr::Hint
|
||||||
}
|
}
|
||||||
MetaList(ref n, ref items) if *n == "inline" => {
|
MetaList(ref n, ref items) if *n == "inline" => {
|
||||||
mark_used(attr);
|
mark_used(attr);
|
||||||
if items.len() != 1 {
|
if items.len() != 1 {
|
||||||
diagnostic.map(|d|{ d.span_err(attr.span, "expected one argument"); });
|
diagnostic.map(|d|{ d.span_err(attr.span, "expected one argument"); });
|
||||||
InlineNone
|
InlineAttr::None
|
||||||
} else if contains_name(&items[..], "always") {
|
} else if contains_name(&items[..], "always") {
|
||||||
InlineAlways
|
InlineAttr::Always
|
||||||
} else if contains_name(&items[..], "never") {
|
} else if contains_name(&items[..], "never") {
|
||||||
InlineNever
|
InlineAttr::Never
|
||||||
} else {
|
} else {
|
||||||
diagnostic.map(|d|{ d.span_err((*items[0]).span, "invalid argument"); });
|
diagnostic.map(|d|{ d.span_err((*items[0]).span, "invalid argument"); });
|
||||||
InlineNone
|
InlineAttr::None
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ => ia
|
_ => ia
|
||||||
|
@ -322,8 +321,8 @@ pub fn find_inline_attr(diagnostic: Option<&SpanHandler>, attrs: &[Attribute]) -
|
||||||
/// True if `#[inline]` or `#[inline(always)]` is present in `attrs`.
|
/// True if `#[inline]` or `#[inline(always)]` is present in `attrs`.
|
||||||
pub fn requests_inline(attrs: &[Attribute]) -> bool {
|
pub fn requests_inline(attrs: &[Attribute]) -> bool {
|
||||||
match find_inline_attr(None, attrs) {
|
match find_inline_attr(None, attrs) {
|
||||||
InlineHint | InlineAlways => true,
|
InlineAttr::Hint | InlineAttr::Always => true,
|
||||||
InlineNone | InlineNever => false,
|
InlineAttr::None | InlineAttr::Never => false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue