diff options
| author | bors <bors@rust-lang.org> | 2015-02-23 20:47:30 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2015-02-23 20:47:30 +0000 |
| commit | 91a5a1ab4ad054c8dccf49f6f409542f82683cfc (patch) | |
| tree | 1c2a90b8e1aac6793a0fbf6350778a5b9ac65dae /src/libsyntax | |
| parent | f0f7ca27de6b4e03f30012656dad270cda55a363 (diff) | |
| parent | ee6f2a1ad6ab79ed954cd96fff6eaddcdfb6a043 (diff) | |
| download | rust-91a5a1ab4ad054c8dccf49f6f409542f82683cfc.tar.gz rust-91a5a1ab4ad054c8dccf49f6f409542f82683cfc.zip | |
Auto merge of #22724 - Manishearth:rollup, r=alexcrichton
Seems to pass `check-stage1`, but I had to tweak some things so it's going through the test gauntlet again.
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/attr.rs | 12 | ||||
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 3 |
2 files changed, 11 insertions, 4 deletions
diff --git a/src/libsyntax/attr.rs b/src/libsyntax/attr.rs index 62e676891a0..4fc08c0c2b2 100644 --- a/src/libsyntax/attr.rs +++ b/src/libsyntax/attr.rs @@ -292,7 +292,7 @@ pub enum InlineAttr { } /// Determine what `#[inline]` attribute is present in `attrs`, if any. -pub fn find_inline_attr(attrs: &[Attribute]) -> InlineAttr { +pub fn find_inline_attr(diagnostic: Option<&SpanHandler>, attrs: &[Attribute]) -> InlineAttr { // FIXME (#2809)---validate the usage of #[inline] and #[inline] attrs.iter().fold(InlineNone, |ia,attr| { match attr.node.value.node { @@ -302,12 +302,16 @@ pub fn find_inline_attr(attrs: &[Attribute]) -> InlineAttr { } MetaList(ref n, ref items) if *n == "inline" => { mark_used(attr); - if contains_name(&items[..], "always") { + if items.len() != 1 { + diagnostic.map(|d|{ d.span_err(attr.span, "expected one argument"); }); + InlineNone + } else if contains_name(&items[..], "always") { InlineAlways } else if contains_name(&items[..], "never") { InlineNever } else { - InlineHint + diagnostic.map(|d|{ d.span_err((*items[0]).span, "invalid argument"); }); + InlineNone } } _ => ia @@ -317,7 +321,7 @@ pub fn find_inline_attr(attrs: &[Attribute]) -> InlineAttr { /// True if `#[inline]` or `#[inline(always)]` is present in `attrs`. pub fn requests_inline(attrs: &[Attribute]) -> bool { - match find_inline_attr(attrs) { + match find_inline_attr(None, attrs) { InlineHint | InlineAlways => true, InlineNone | InlineNever => false, } diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index f43b09ddb9d..7977574b02b 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -3494,6 +3494,9 @@ impl<'a> Parser<'a> { }; pat = PatIdent(BindByValue(MutImmutable), pth1, sub); } + } else if self.look_ahead(1, |t| *t == token::Lt) { + self.bump(); + self.unexpected() } else { // parse an enum pat let enum_path = self.parse_path(LifetimeAndTypesWithColons); |
