about summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2017-08-10 14:05:58 -0700
committerAlex Crichton <alex@alexcrichton.com>2017-08-10 14:05:58 -0700
commitb8aa595e6d159bfb5e0293659b69e0edc457a468 (patch)
tree01c3c1ef7415103c4d48a28cf57be47cba5cc624 /src/libsyntax
parentbe95ca4b17203a3aed27c17c1e93b76c9477e5bc (diff)
parentb6179602bea71607a9ea63197eca423fcce5f7b0 (diff)
downloadrust-b8aa595e6d159bfb5e0293659b69e0edc457a468.tar.gz
rust-b8aa595e6d159bfb5e0293659b69e0edc457a468.zip
Merge remote-tracking branch 'origin/master' into gen
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/diagnostic_list.rs60
-rw-r--r--src/libsyntax/ext/source_util.rs10
-rw-r--r--src/libsyntax/ext/tt/macro_parser.rs4
-rw-r--r--src/libsyntax/ext/tt/macro_rules.rs2
-rw-r--r--src/libsyntax/feature_gate.rs2
-rw-r--r--src/libsyntax/parse/lexer/unicode_chars.rs144
-rw-r--r--src/libsyntax/parse/parser.rs23
7 files changed, 209 insertions, 36 deletions
diff --git a/src/libsyntax/diagnostic_list.rs b/src/libsyntax/diagnostic_list.rs
index 6598ecb9444..2ea3fe51d30 100644
--- a/src/libsyntax/diagnostic_list.rs
+++ b/src/libsyntax/diagnostic_list.rs
@@ -162,6 +162,63 @@ For more information about the cfg attribute, read:
 https://doc.rust-lang.org/reference.html#conditional-compilation
 "##,
 
+E0552: r##"
+A unrecognized representation attribute was used.
+
+Erroneous code example:
+
+```compile_fail,E0552
+#[repr(D)] // error: unrecognized representation hint
+struct MyStruct {
+    my_field: usize
+}
+```
+
+You can use a `repr` attribute to tell the compiler how you want a struct or
+enum to be laid out in memory.
+
+Make sure you're using one of the supported options:
+
+```
+#[repr(C)] // ok!
+struct MyStruct {
+    my_field: usize
+}
+```
+
+For more information about specifying representations, see the ["Alternative
+Representations" section] of the Rustonomicon.
+
+["Alternative Representations" section]: https://doc.rust-lang.org/nomicon/other-reprs.html
+"##,
+
+E0554: r##"
+Feature attributes are only allowed on the nightly release channel. Stable or
+beta compilers will not comply.
+
+Example of erroneous code (on a stable compiler):
+
+```ignore (depends on release channel)
+#![feature(non_ascii_idents)] // error: #![feature] may not be used on the
+                              //        stable release channel
+```
+
+If you need the feature, make sure to use a nightly release of the compiler
+(but be warned that the feature may be removed or altered in the future).
+"##,
+
+E0557: r##"
+A feature attribute named a feature that has been removed.
+
+Erroneous code example:
+
+```compile_fail,E0557
+#![feature(managed_boxes)] // error: feature has been removed
+```
+
+Delete the offending feature attribute.
+"##,
+
 E0558: r##"
 The `export_name` attribute was malformed.
 
@@ -300,11 +357,8 @@ register_diagnostics! {
     E0549, // rustc_deprecated attribute must be paired with either stable or unstable attribute
     E0550, // multiple deprecated attributes
     E0551, // incorrect meta item
-    E0552, // unrecognized representation hint
-    E0554, // #[feature] may not be used on the [] release channel
     E0555, // malformed feature attribute, expected #![feature(...)]
     E0556, // malformed feature, expected just one word
-    E0557, // feature has been removed
     E0584, // file for module `..` found at both .. and ..
     E0589, // invalid `repr(align)` attribute
 }
diff --git a/src/libsyntax/ext/source_util.rs b/src/libsyntax/ext/source_util.rs
index 3cdd3a4b2c3..b293aa8de38 100644
--- a/src/libsyntax/ext/source_util.rs
+++ b/src/libsyntax/ext/source_util.rs
@@ -52,6 +52,16 @@ pub fn expand_column(cx: &mut ExtCtxt, sp: Span, tts: &[tokenstream::TokenTree])
     base::MacEager::expr(cx.expr_u32(topmost, loc.col.to_usize() as u32))
 }
 
+/* __rust_unstable_column!(): expands to the current column number */
+pub fn expand_column_gated(cx: &mut ExtCtxt, sp: Span, tts: &[tokenstream::TokenTree])
+                  -> Box<base::MacResult+'static> {
+    if sp.allows_unstable() {
+        expand_column(cx, sp, tts)
+    } else {
+        cx.span_fatal(sp, "the __rust_unstable_column macro is unstable");
+    }
+}
+
 /// file!(): expands to the current filename */
 /// The filemap (`loc.file`) contains a bunch more information we could spit
 /// out if we wanted.
diff --git a/src/libsyntax/ext/tt/macro_parser.rs b/src/libsyntax/ext/tt/macro_parser.rs
index 60833c75a15..146bd5d9856 100644
--- a/src/libsyntax/ext/tt/macro_parser.rs
+++ b/src/libsyntax/ext/tt/macro_parser.rs
@@ -211,7 +211,7 @@ pub enum NamedMatch {
 
 fn nameize<I: Iterator<Item=NamedMatch>>(sess: &ParseSess, ms: &[TokenTree], mut res: I)
                                              -> NamedParseResult {
-    fn n_rec<I: Iterator<Item=NamedMatch>>(sess: &ParseSess, m: &TokenTree, mut res: &mut I,
+    fn n_rec<I: Iterator<Item=NamedMatch>>(sess: &ParseSess, m: &TokenTree, res: &mut I,
              ret_val: &mut HashMap<Ident, Rc<NamedMatch>>)
              -> Result<(), (syntax_pos::Span, String)> {
         match *m {
@@ -445,7 +445,7 @@ pub fn parse(sess: &ParseSess,
         /* error messages here could be improved with links to orig. rules */
         if token_name_eq(&parser.token, &token::Eof) {
             if eof_items.len() == 1 {
-                let matches = eof_items[0].matches.iter_mut().map(|mut dv| {
+                let matches = eof_items[0].matches.iter_mut().map(|dv| {
                     Rc::make_mut(dv).pop().unwrap()
                 });
                 return nameize(sess, ms, matches);
diff --git a/src/libsyntax/ext/tt/macro_rules.rs b/src/libsyntax/ext/tt/macro_rules.rs
index 8e746676ecd..80b6794d1e3 100644
--- a/src/libsyntax/ext/tt/macro_rules.rs
+++ b/src/libsyntax/ext/tt/macro_rules.rs
@@ -86,7 +86,7 @@ impl TTMacroExpander for MacroRulesMacroExpander {
 
 fn trace_macros_note(cx: &mut ExtCtxt, sp: Span, message: String) {
     let sp = sp.macro_backtrace().last().map(|trace| trace.call_site).unwrap_or(sp);
-    let mut values: &mut Vec<String> = cx.expansions.entry(sp).or_insert_with(Vec::new);
+    let values: &mut Vec<String> = cx.expansions.entry(sp).or_insert_with(Vec::new);
     values.push(message);
 }
 
diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs
index bf19a7e0383..cb0cc2aafb0 100644
--- a/src/libsyntax/feature_gate.rs
+++ b/src/libsyntax/feature_gate.rs
@@ -1611,7 +1611,7 @@ fn maybe_stage_features(span_handler: &Handler, krate: &ast::Crate,
             if attr.check_name("feature") {
                 let release_channel = option_env!("CFG_RELEASE_CHANNEL").unwrap_or("(unknown)");
                 span_err!(span_handler, attr.span, E0554,
-                          "#[feature] may not be used on the {} release channel",
+                          "#![feature] may not be used on the {} release channel",
                           release_channel);
             }
         }
diff --git a/src/libsyntax/parse/lexer/unicode_chars.rs b/src/libsyntax/parse/lexer/unicode_chars.rs
index 83a164bdb96..85df4eee913 100644
--- a/src/libsyntax/parse/lexer/unicode_chars.rs
+++ b/src/libsyntax/parse/lexer/unicode_chars.rs
@@ -1,4 +1,4 @@
-// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
+// Copyright 2012-2017 The Rust Project Developers. See the COPYRIGHT
 // file at the top-level directory of this distribution and at
 // http://rust-lang.org/COPYRIGHT.
 //
@@ -9,15 +9,16 @@
 // except according to those terms.
 
 // Characters and their corresponding confusables were collected from
-// http://www.unicode.org/Public/security/revision-06/confusables.txt
+// http://www.unicode.org/Public/security/10.0.0/confusables.txt
 
 use syntax_pos::{Span, NO_EXPANSION};
 use errors::DiagnosticBuilder;
 use super::StringReader;
 
 const UNICODE_ARRAY: &'static [(char, &'static str, char)] = &[
-    (' ', "No-Break Space", ' '),
-    (' ', "Ogham Space Mark", ' '),
+    ('
', "Line Separator", ' '),
+    ('
', "Paragraph Separator", ' '),
+    (' ', "Ogham Space mark", ' '),
     (' ', "En Quad", ' '),
     (' ', "Em Quad", ' '),
     (' ', "En Space", ' '),
@@ -25,39 +26,63 @@ const UNICODE_ARRAY: &'static [(char, &'static str, char)] = &[
     (' ', "Three-Per-Em Space", ' '),
     (' ', "Four-Per-Em Space", ' '),
     (' ', "Six-Per-Em Space", ' '),
-    (' ', "Figure Space", ' '),
     (' ', "Punctuation Space", ' '),
     (' ', "Thin Space", ' '),
     (' ', "Hair Space", ' '),
-    (' ', "Narrow No-Break Space", ' '),
     (' ', "Medium Mathematical Space", ' '),
+    (' ', "No-Break Space", ' '),
+    (' ', "Figure Space", ' '),
+    (' ', "Narrow No-Break Space", ' '),
     (' ', "Ideographic Space", ' '),
+
     ('ߺ', "Nko Lajanyalan", '_'),
     ('﹍', "Dashed Low Line", '_'),
     ('﹎', "Centreline Low Line", '_'),
     ('﹏', "Wavy Low Line", '_'),
+    ('_', "Fullwidth Low Line", '_'),
+
     ('‐', "Hyphen", '-'),
     ('‑', "Non-Breaking Hyphen", '-'),
     ('‒', "Figure Dash", '-'),
     ('–', "En Dash", '-'),
     ('—', "Em Dash", '-'),
     ('﹘', "Small Em Dash", '-'),
+    ('۔', "Arabic Full Stop", '-'),
     ('⁃', "Hyphen Bullet", '-'),
     ('˗', "Modifier Letter Minus Sign", '-'),
     ('−', "Minus Sign", '-'),
+    ('➖', "Heavy Minus Sign", '-'),
+    ('Ⲻ', "Coptic Letter Dialect-P Ni", '-'),
     ('ー', "Katakana-Hiragana Prolonged Sound Mark", '-'),
+    ('-', "Fullwidth Hyphen-Minus", '-'),
+    ('―', "Horizontal Bar", '-'),
+    ('─', "Box Drawings Light Horizontal", '-'),
+    ('━', "Box Drawings Heavy Horizontal", '-'),
+    ('㇐', "CJK Stroke H", '-'),
+    ('ꟷ', "Latin Epigraphic Letter Dideways", '-'),
+    ('ᅳ', "Hangul Jungseong Eu", '-'),
+    ('ㅡ', "Hangul Letter Eu", '-'),
+    ('一', "CJK Unified Ideograph-4E00", '-'),
+    ('⼀', "Kangxi Radical One", '-'),
+
+    ('؍', "Arabic Date Separator", ','),
     ('٫', "Arabic Decimal Separator", ','),
     ('‚', "Single Low-9 Quotation Mark", ','),
+    ('¸', "Cedilla", ','),
     ('ꓹ', "Lisu Letter Tone Na Po", ','),
     (',', "Fullwidth Comma", ','),
+
     (';', "Greek Question Mark", ';'),
     (';', "Fullwidth Semicolon", ';'),
+    ('︔', "Presentation Form For Vertical Semicolon", ';'),
+
     ('ः', "Devanagari Sign Visarga", ':'),
     ('ઃ', "Gujarati Sign Visarga", ':'),
     (':', "Fullwidth Colon", ':'),
     ('։', "Armenian Full Stop", ':'),
     ('܃', "Syriac Supralinear Colon", ':'),
     ('܄', "Syriac Sublinear Colon", ':'),
+    ('᛬', "Runic Multiple Ponctuation", ':'),
     ('︰', "Presentation Form For Vertical Two Dot Leader", ':'),
     ('᠃', "Mongolian Full Stop", ':'),
     ('᠉', "Mongolian Manchu Full Stop", ':'),
@@ -68,25 +93,48 @@ const UNICODE_ARRAY: &'static [(char, &'static str, char)] = &[
     ('∶', "Ratio", ':'),
     ('ː', "Modifier Letter Triangular Colon", ':'),
     ('ꓽ', "Lisu Letter Tone Mya Jeu", ':'),
+    ('︓', "Presentation Form For Vertical Colon", ':'),
+
     ('!', "Fullwidth Exclamation Mark", '!'),
     ('ǃ', "Latin Letter Retroflex Click", '!'),
+    ('ⵑ', "Tifinagh Letter Tuareg Yang", '!'),
+    ('︕', "Presentation Form For Vertical Exclamation Mark", '!'),
+
     ('ʔ', "Latin Letter Glottal Stop", '?'),
+    ('Ɂ', "Latin Capital Letter Glottal Stop", '?'),
     ('ॽ', "Devanagari Letter Glottal Stop", '?'),
     ('Ꭾ', "Cherokee Letter He", '?'),
+    ('ꛫ', "Bamum Letter Ntuu", '?'),
     ('?', "Fullwidth Question Mark", '?'),
+    ('︖', "Presentation Form For Vertical Question Mark", '?'),
+
     ('𝅭', "Musical Symbol Combining Augmentation Dot", '.'),
     ('․', "One Dot Leader", '.'),
-    ('۔', "Arabic Full Stop", '.'),
     ('܁', "Syriac Supralinear Full Stop", '.'),
     ('܂', "Syriac Sublinear Full Stop", '.'),
     ('꘎', "Vai Full Stop", '.'),
     ('𐩐', "Kharoshthi Punctuation Dot", '.'),
-    ('·', "Middle Dot", '.'),
     ('٠', "Arabic-Indic Digit Zero", '.'),
     ('۰', "Extended Arabic-Indic Digit Zero", '.'),
     ('ꓸ', "Lisu Letter Tone Mya Ti", '.'),
-    ('。', "Ideographic Full Stop", '.'),
+    ('·', "Middle Dot", '.'),
     ('・', "Katakana Middle Dot", '.'),
+    ('・', "Halfwidth Katakana Middle Dot", '.'),
+    ('᛫', "Runic Single Punctuation", '.'),
+    ('·', "Greek Ano Teleia", '.'),
+    ('⸱', "Word Separator Middle Dot", '.'),
+    ('𐄁', "Aegean Word Separator Dot", '.'),
+    ('•', "Bullet", '.'),
+    ('‧', "Hyphenation Point", '.'),
+    ('∙', "Bullet Operator", '.'),
+    ('⋅', "Dot Operator", '.'),
+    ('ꞏ', "Latin Letter Sinological Dot", '.'),
+    ('ᐧ', "Canadian Syllabics Final Middle Dot", '.'),
+    ('ᐧ', "Canadian Syllabics Final Middle Dot", '.'),
+    ('.', "Fullwidth Full Stop", '.'),
+    ('。', "Ideographic Full Stop", '.'),
+    ('︒', "Presentation Form For Vertical Ideographic Full Stop", '.'),
+
     ('՝', "Armenian Comma", '\''),
     (''', "Fullwidth Apostrophe", '\''),
     ('‘', "Left Single Quotation Mark", '\''),
@@ -96,8 +144,10 @@ const UNICODE_ARRAY: &'static [(char, &'static str, char)] = &[
     ('‵', "Reversed Prime", '\''),
     ('՚', "Armenian Apostrophe", '\''),
     ('׳', "Hebrew Punctuation Geresh", '\''),
+    ('`', "Greek Accent", '\''),
     ('`', "Greek Varia", '\''),
     ('`', "Fullwidth Grave Accent", '\''),
+    ('´', "Acute Accent", '\''),
     ('΄', "Greek Tonos", '\''),
     ('´', "Greek Oxia", '\''),
     ('᾽', "Greek Koronis", '\''),
@@ -105,6 +155,7 @@ const UNICODE_ARRAY: &'static [(char, &'static str, char)] = &[
     ('῾', "Greek Dasia", '\''),
     ('ʹ', "Modifier Letter Prime", '\''),
     ('ʹ', "Greek Numeral Sign", '\''),
+    ('ˈ', "Modifier Letter Vertical Line", '\''),
     ('ˊ', "Modifier Letter Acute Accent", '\''),
     ('ˋ', "Modifier Letter Grave Accent", '\''),
     ('˴', "Modifier Letter Middle Grave Accent", '\''),
@@ -116,6 +167,12 @@ const UNICODE_ARRAY: &'static [(char, &'static str, char)] = &[
     ('י', "Hebrew Letter Yod", '\''),
     ('ߴ', "Nko High Tone Apostrophe", '\''),
     ('ߵ', "Nko Low Tone Apostrophe", '\''),
+    ('ᑊ', "Canadian Syllabics West-Cree P", '\''),
+    ('ᛌ', "Runic Letter Short-Twig-Sol S", '\''),
+    ('𖽑', "Miao Sign Aspiration", '\''),
+    ('𖽒', "Miao Sign Reformed Voicing", '\''),
+
+    ('᳓', "Vedic Sign Nihshvasa", '"'),
     ('"', "Fullwidth Quotation Mark", '"'),
     ('“', "Left Double Quotation Mark", '"'),
     ('”', "Right Double Quotation Mark", '"'),
@@ -132,12 +189,15 @@ const UNICODE_ARRAY: &'static [(char, &'static str, char)] = &[
     ('ײ', "Hebrew Ligature Yiddish Double Yod", '"'),
     ('❞', "Heavy Double Comma Quotation Mark Ornament", '"'),
     ('❝', "Heavy Double Turned Comma Quotation Mark Ornament", '"'),
+
+    ('(', "Fullwidth Left Parenthesis", '('),
     ('❨', "Medium Left Parenthesis Ornament", '('),
     ('﴾', "Ornate Left Parenthesis", '('),
-    ('(', "Fullwidth Left Parenthesis", '('),
+
+    (')', "Fullwidth Right Parenthesis", ')'),
     ('❩', "Medium Right Parenthesis Ornament", ')'),
     ('﴿', "Ornate Right Parenthesis", ')'),
-    (')', "Fullwidth Right Parenthesis", ')'),
+
     ('[', "Fullwidth Left Square Bracket", '['),
     ('❲', "Light Left Tortoise Shell Bracket Ornament", '['),
     ('「', "Left Corner Bracket", '['),
@@ -147,6 +207,7 @@ const UNICODE_ARRAY: &'static [(char, &'static str, char)] = &[
     ('〖', "Left White Lenticular Bracket", '['),
     ('〘', "Left White Tortoise Shell Bracket", '['),
     ('〚', "Left White Square Bracket", '['),
+
     (']', "Fullwidth Right Square Bracket", ']'),
     ('❳', "Light Right Tortoise Shell Bracket Ornament", ']'),
     ('」', "Right Corner Bracket", ']'),
@@ -156,11 +217,20 @@ const UNICODE_ARRAY: &'static [(char, &'static str, char)] = &[
     ('〗', "Right White Lenticular Bracket", ']'),
     ('〙', "Right White Tortoise Shell Bracket", ']'),
     ('〛', "Right White Square Bracket", ']'),
+
     ('❴', "Medium Left Curly Bracket Ornament", '{'),
+    ('𝄔', "Musical Symbol Brace", '{'),
+    ('{', "Fullwidth Left Curly Bracket", '{'),
+
     ('❵', "Medium Right Curly Bracket Ornament", '}'),
+    ('}', "Fullwidth Right Curly Bracket", '}'),
+
     ('⁎', "Low Asterisk", '*'),
     ('٭', "Arabic Five Pointed Star", '*'),
     ('∗', "Asterisk Operator", '*'),
+    ('𐌟', "Old Italic Letter Ess", '*'),
+    ('*', "Fullwidth Asterisk", '*'),
+
     ('᜵', "Philippine Single Punctuation", '/'),
     ('⁁', "Caret Insertion Point", '/'),
     ('∕', "Division Slash", '/'),
@@ -168,37 +238,73 @@ const UNICODE_ARRAY: &'static [(char, &'static str, char)] = &[
     ('╱', "Box Drawings Light Diagonal Upper Right To Lower Left", '/'),
     ('⟋', "Mathematical Rising Diagonal", '/'),
     ('⧸', "Big Solidus", '/'),
-    ('㇓', "Cjk Stroke Sp", '/'),
+    ('𝈺', "Greek Instrumental Notation Symbol-47", '/'),
+    ('㇓', "CJK Stroke Sp", '/'),
     ('〳', "Vertical Kana Repeat Mark Upper Half", '/'),
-    ('丿', "Cjk Unified Ideograph-4E3F", '/'),
+    ('Ⳇ', "Coptic Capital Letter Old Coptic Esh", '/'),
+    ('ノ', "Katakana Letter No", '/'),
+    ('丿', "CJK Unified Ideograph-4E3F", '/'),
     ('⼃', "Kangxi Radical Slash", '/'),
+    ('/', "Fullwidth Solidus", '/'),
+
     ('\', "Fullwidth Reverse Solidus", '\\'),
     ('﹨', "Small Reverse Solidus", '\\'),
     ('∖', "Set Minus", '\\'),
     ('⟍', "Mathematical Falling Diagonal", '\\'),
     ('⧵', "Reverse Solidus Operator", '\\'),
     ('⧹', "Big Reverse Solidus", '\\'),
+    ('⧹', "Greek Vocal Notation Symbol-16", '\\'),
+    ('⧹', "Greek Instrumental Symbol-48", '\\'),
+    ('㇔', "CJK Stroke D", '\\'),
+    ('丶', "CJK Unified Ideograph-4E36", '\\'),
+    ('⼂', "Kangxi Radical Dot", '\\'),
     ('、', "Ideographic Comma", '\\'),
     ('ヽ', "Katakana Iteration Mark", '\\'),
-    ('㇔', "Cjk Stroke D", '\\'),
-    ('丶', "Cjk Unified Ideograph-4E36", '\\'),
-    ('⼂', "Kangxi Radical Dot", '\\'),
+
     ('ꝸ', "Latin Small Letter Um", '&'),
+    ('&', "Fullwidth Ampersand", '&'),
+
+    ('᛭', "Runic Cros Punctuation", '+'),
+    ('➕', "Heavy Plus Sign", '+'),
+    ('𐊛', "Lycian Letter H", '+'),
     ('﬩', "Hebrew Letter Alternative Plus Sign", '+'),
+    ('+', "Fullwidth Plus Sign", '+'),
+
     ('‹', "Single Left-Pointing Angle Quotation Mark", '<'),
     ('❮', "Heavy Left-Pointing Angle Quotation Mark Ornament", '<'),
     ('˂', "Modifier Letter Left Arrowhead", '<'),
+    ('𝈶', "Greek Instrumental Symbol-40", '<'),
+    ('ᐸ', "Canadian Syllabics Pa", '<'),
+    ('ᚲ', "Runic Letter Kauna", '<'),
+    ('❬', "Medium Left-Pointing Angle Bracket Ornament", '<'),
+    ('⟨', "Mathematical Left Angle Bracket", '<'),
+    ('〈', "Left-Pointing Angle Bracket", '<'),
     ('〈', "Left Angle Bracket", '<'),
+    ('㇛', "CJK Stroke Pd", '<'),
+    ('く', "Hiragana Letter Ku", '<'),
+    ('𡿨', "CJK Unified Ideograph-21FE8", '<'),
     ('《', "Left Double Angle Bracket", '<'),
+    ('<', "Fullwidth Less-Than Sign", '<'),
+
+    ('᐀', "Canadian Syllabics Hyphen", '='),
+    ('⹀', "Double Hyphen", '='),
+    ('゠', "Katakana-Hiragana Double Hyphen", '='),
     ('꓿', "Lisu Punctuation Full Stop", '='),
+    ('=', "Fullwidth Equals Sign", '='),
+
     ('›', "Single Right-Pointing Angle Quotation Mark", '>'),
     ('❯', "Heavy Right-Pointing Angle Quotation Mark Ornament", '>'),
     ('˃', "Modifier Letter Right Arrowhead", '>'),
+    ('𝈷', "Greek Instrumental Symbol-42", '>'),
+    ('ᐳ', "Canadian Syllabics Po", '>'),
+    ('𖼿', "Miao Letter Archaic Zza", '>'),
+    ('❭', "Medium Right-Pointing Angle Bracket Ornament", '>'),
+    ('⟩', "Mathematical Right Angle Bracket", '>'),
+    ('〉', "Right-Pointing Angle Bracket", '>'),
     ('〉', "Right Angle Bracket", '>'),
     ('》', "Right Double Angle Bracket", '>'),
-    ('Ⲻ', "Coptic Capital Letter Dialect-P Ni", '-'),
-    ('Ɂ', "Latin Capital Letter Glottal Stop", '?'),
-    ('Ⳇ', "Coptic Capital Letter Old Coptic Esh", '/'), ];
+    ('>', "Fullwidth Greater-Than Sign", '>'), ];
+
 
 const ASCII_ARRAY: &'static [(char, &'static str)] = &[
     (' ', "Space"),
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index 5fe3cf0ddac..df1bae523a5 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -5526,12 +5526,11 @@ impl<'a> Parser<'a> {
         })
     }
 
-    /// Parse a static item from a foreign module
+    /// Parse a static item from a foreign module.
+    /// Assumes that the `static` keyword is already parsed.
     fn parse_item_foreign_static(&mut self, vis: ast::Visibility, lo: Span, attrs: Vec<Attribute>)
                                  -> PResult<'a, ForeignItem> {
-        self.expect_keyword(keywords::Static)?;
         let mutbl = self.eat_keyword(keywords::Mut);
-
         let ident = self.parse_ident()?;
         self.expect(&token::Colon)?;
         let ty = self.parse_ty()?;
@@ -6005,19 +6004,23 @@ impl<'a> Parser<'a> {
         let lo = self.span;
         let visibility = self.parse_visibility(false)?;
 
-        if self.check_keyword(keywords::Static) {
-            // FOREIGN STATIC ITEM
+        // FOREIGN STATIC ITEM
+        // Treat `const` as `static` for error recovery, but don't add it to expected tokens.
+        if self.check_keyword(keywords::Static) || self.token.is_keyword(keywords::Const) {
+            if self.token.is_keyword(keywords::Const) {
+                self.diagnostic()
+                    .struct_span_err(self.span, "extern items cannot be `const`")
+                    .span_suggestion(self.span, "instead try using", "static".to_owned())
+                    .emit();
+            }
+            self.bump(); // `static` or `const`
             return Ok(Some(self.parse_item_foreign_static(visibility, lo, attrs)?));
         }
+        // FOREIGN FUNCTION ITEM
         if self.check_keyword(keywords::Fn) {
-            // FOREIGN FUNCTION ITEM
             return Ok(Some(self.parse_item_foreign_fn(visibility, lo, attrs)?));
         }
 
-        if self.check_keyword(keywords::Const) {
-            return Err(self.span_fatal(self.span, "extern items cannot be `const`"));
-        }
-
         // FIXME #5668: this will occur for a macro invocation:
         match self.parse_macro_use_or_failure(attrs, true, false, lo, visibility)? {
             Some(item) => {