Auto merge of #107105 - matthiaskrgr:rollup-rkz9t7r, r=matthiaskrgr
Rollup of 8 pull requests Successful merges: - #106783 (Recover labels written as identifiers) - #106973 (Don't treat closures from other crates as local) - #106979 (Document how to get the type of a default associated type) - #107053 (signal update string representation for haiku.) - #107058 (Recognise double-equals homoglyph) - #107067 (Custom MIR: Support storage statements) - #107076 (Added const-generic ui test case for issue #106419) - #107091 (Fix broken format strings in `infer.ftl`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
commit
04a41f889f
20 changed files with 508 additions and 341 deletions
|
@ -193,7 +193,7 @@ infer_actual_impl_expl_expected_signature_any = {$leading_ellipsis ->
|
||||||
infer_actual_impl_expl_expected_signature_some = {$leading_ellipsis ->
|
infer_actual_impl_expl_expected_signature_some = {$leading_ellipsis ->
|
||||||
[true] ...
|
[true] ...
|
||||||
*[false] {""}
|
*[false] {""}
|
||||||
}closure with signature `{$ty_or_sig}` must implement `{$trait_path}`, for some specific lifetime `'{lifetime_1}`...
|
}closure with signature `{$ty_or_sig}` must implement `{$trait_path}`, for some specific lifetime `'{$lifetime_1}`...
|
||||||
infer_actual_impl_expl_expected_signature_nothing = {$leading_ellipsis ->
|
infer_actual_impl_expl_expected_signature_nothing = {$leading_ellipsis ->
|
||||||
[true] ...
|
[true] ...
|
||||||
*[false] {""}
|
*[false] {""}
|
||||||
|
@ -209,7 +209,7 @@ infer_actual_impl_expl_expected_passive_any = {$leading_ellipsis ->
|
||||||
infer_actual_impl_expl_expected_passive_some = {$leading_ellipsis ->
|
infer_actual_impl_expl_expected_passive_some = {$leading_ellipsis ->
|
||||||
[true] ...
|
[true] ...
|
||||||
*[false] {""}
|
*[false] {""}
|
||||||
}`{$trait_path}` would have to be implemented for the type `{$ty_or_sig}`, for some specific lifetime `'{lifetime_1}`...
|
}`{$trait_path}` would have to be implemented for the type `{$ty_or_sig}`, for some specific lifetime `'{$lifetime_1}`...
|
||||||
infer_actual_impl_expl_expected_passive_nothing = {$leading_ellipsis ->
|
infer_actual_impl_expl_expected_passive_nothing = {$leading_ellipsis ->
|
||||||
[true] ...
|
[true] ...
|
||||||
*[false] {""}
|
*[false] {""}
|
||||||
|
@ -225,7 +225,7 @@ infer_actual_impl_expl_expected_other_any = {$leading_ellipsis ->
|
||||||
infer_actual_impl_expl_expected_other_some = {$leading_ellipsis ->
|
infer_actual_impl_expl_expected_other_some = {$leading_ellipsis ->
|
||||||
[true] ...
|
[true] ...
|
||||||
*[false] {""}
|
*[false] {""}
|
||||||
}`{$ty_or_sig}` must implement `{$trait_path}`, for some specific lifetime `'{lifetime_1}`...
|
}`{$ty_or_sig}` must implement `{$trait_path}`, for some specific lifetime `'{$lifetime_1}`...
|
||||||
infer_actual_impl_expl_expected_other_nothing = {$leading_ellipsis ->
|
infer_actual_impl_expl_expected_other_nothing = {$leading_ellipsis ->
|
||||||
[true] ...
|
[true] ...
|
||||||
*[false] {""}
|
*[false] {""}
|
||||||
|
@ -268,11 +268,11 @@ infer_but_calling_introduces = {$has_param_name ->
|
||||||
[true] `{$param_name}`
|
[true] `{$param_name}`
|
||||||
*[false] `fn` parameter
|
*[false] `fn` parameter
|
||||||
} has {$lifetime_kind ->
|
} has {$lifetime_kind ->
|
||||||
[named] lifetime `{lifetime}`
|
[named] lifetime `{$lifetime}`
|
||||||
*[anon] an anonymous lifetime `'_`
|
*[anon] an anonymous lifetime `'_`
|
||||||
} but calling `{assoc_item}` introduces an implicit `'static` lifetime requirement
|
} but calling `{assoc_item}` introduces an implicit `'static` lifetime requirement
|
||||||
.label1 = {$has_lifetime ->
|
.label1 = {$has_lifetime ->
|
||||||
[named] lifetime `{lifetime}`
|
[named] lifetime `{$lifetime}`
|
||||||
*[anon] an anonymous lifetime `'_`
|
*[anon] an anonymous lifetime `'_`
|
||||||
}
|
}
|
||||||
.label2 = ...is used and required to live as long as `'static` here because of an implicit lifetime bound on the {$has_impl_path ->
|
.label2 = ...is used and required to live as long as `'static` here because of an implicit lifetime bound on the {$has_impl_path ->
|
||||||
|
@ -284,11 +284,11 @@ infer_but_needs_to_satisfy = {$has_param_name ->
|
||||||
[true] `{$param_name}`
|
[true] `{$param_name}`
|
||||||
*[false] `fn` parameter
|
*[false] `fn` parameter
|
||||||
} has {$has_lifetime ->
|
} has {$has_lifetime ->
|
||||||
[named] lifetime `{lifetime}`
|
[named] lifetime `{$lifetime}`
|
||||||
*[anon] an anonymous lifetime `'_`
|
*[anon] an anonymous lifetime `'_`
|
||||||
} but it needs to satisfy a `'static` lifetime requirement
|
} but it needs to satisfy a `'static` lifetime requirement
|
||||||
.influencer = this data with {$has_lifetime ->
|
.influencer = this data with {$has_lifetime ->
|
||||||
[named] lifetime `{lifetime}`
|
[named] lifetime `{$lifetime}`
|
||||||
*[anon] an anonymous lifetime `'_`
|
*[anon] an anonymous lifetime `'_`
|
||||||
}...
|
}...
|
||||||
.require = {$spans_empty ->
|
.require = {$spans_empty ->
|
||||||
|
@ -302,7 +302,7 @@ infer_more_targeted = {$has_param_name ->
|
||||||
[true] `{$param_name}`
|
[true] `{$param_name}`
|
||||||
*[false] `fn` parameter
|
*[false] `fn` parameter
|
||||||
} has {$has_lifetime ->
|
} has {$has_lifetime ->
|
||||||
[named] lifetime `{lifetime}`
|
[named] lifetime `{$lifetime}`
|
||||||
*[anon] an anonymous lifetime `'_`
|
*[anon] an anonymous lifetime `'_`
|
||||||
} but calling `{$ident}` introduces an implicit `'static` lifetime requirement
|
} but calling `{$ident}` introduces an implicit `'static` lifetime requirement
|
||||||
|
|
||||||
|
|
|
@ -37,6 +37,11 @@ impl AssocItem {
|
||||||
Ident::new(self.name, tcx.def_ident_span(self.def_id).unwrap())
|
Ident::new(self.name, tcx.def_ident_span(self.def_id).unwrap())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Gets the defaultness of the associated item.
|
||||||
|
/// To get the default associated type, use the [`type_of`] query on the
|
||||||
|
/// [`DefId`] of the type.
|
||||||
|
///
|
||||||
|
/// [`type_of`]: crate::ty::TyCtxt::type_of
|
||||||
pub fn defaultness(&self, tcx: TyCtxt<'_>) -> hir::Defaultness {
|
pub fn defaultness(&self, tcx: TyCtxt<'_>) -> hir::Defaultness {
|
||||||
tcx.impl_defaultness(self.def_id)
|
tcx.impl_defaultness(self.def_id)
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,12 @@ use super::{parse_by_kind, PResult, ParseCtxt};
|
||||||
impl<'tcx, 'body> ParseCtxt<'tcx, 'body> {
|
impl<'tcx, 'body> ParseCtxt<'tcx, 'body> {
|
||||||
pub fn parse_statement(&self, expr_id: ExprId) -> PResult<StatementKind<'tcx>> {
|
pub fn parse_statement(&self, expr_id: ExprId) -> PResult<StatementKind<'tcx>> {
|
||||||
parse_by_kind!(self, expr_id, _, "statement",
|
parse_by_kind!(self, expr_id, _, "statement",
|
||||||
|
@call("mir_storage_live", args) => {
|
||||||
|
Ok(StatementKind::StorageLive(self.parse_local(args[0])?))
|
||||||
|
},
|
||||||
|
@call("mir_storage_dead", args) => {
|
||||||
|
Ok(StatementKind::StorageDead(self.parse_local(args[0])?))
|
||||||
|
},
|
||||||
@call("mir_retag", args) => {
|
@call("mir_retag", args) => {
|
||||||
Ok(StatementKind::Retag(RetagKind::Default, Box::new(self.parse_place(args[0])?)))
|
Ok(StatementKind::Retag(RetagKind::Default, Box::new(self.parse_place(args[0])?)))
|
||||||
},
|
},
|
||||||
|
|
|
@ -7,329 +7,331 @@ use rustc_errors::{Applicability, Diagnostic};
|
||||||
use rustc_span::{symbol::kw, BytePos, Pos, Span};
|
use rustc_span::{symbol::kw, BytePos, Pos, Span};
|
||||||
|
|
||||||
#[rustfmt::skip] // for line breaks
|
#[rustfmt::skip] // for line breaks
|
||||||
pub(crate) const UNICODE_ARRAY: &[(char, &str, char)] = &[
|
pub(crate) const UNICODE_ARRAY: &[(char, &str, &str)] = &[
|
||||||
('
', "Line Separator", ' '),
|
('
', "Line Separator", " "),
|
||||||
('
', "Paragraph Separator", ' '),
|
('
', "Paragraph Separator", " "),
|
||||||
(' ', "Ogham Space mark", ' '),
|
(' ', "Ogham Space mark", " "),
|
||||||
(' ', "En Quad", ' '),
|
(' ', "En Quad", " "),
|
||||||
(' ', "Em Quad", ' '),
|
(' ', "Em Quad", " "),
|
||||||
(' ', "En Space", ' '),
|
(' ', "En Space", " "),
|
||||||
(' ', "Em Space", ' '),
|
(' ', "Em Space", " "),
|
||||||
(' ', "Three-Per-Em Space", ' '),
|
(' ', "Three-Per-Em Space", " "),
|
||||||
(' ', "Four-Per-Em Space", ' '),
|
(' ', "Four-Per-Em Space", " "),
|
||||||
(' ', "Six-Per-Em Space", ' '),
|
(' ', "Six-Per-Em Space", " "),
|
||||||
(' ', "Punctuation Space", ' '),
|
(' ', "Punctuation Space", " "),
|
||||||
(' ', "Thin Space", ' '),
|
(' ', "Thin Space", " "),
|
||||||
(' ', "Hair Space", ' '),
|
(' ', "Hair Space", " "),
|
||||||
(' ', "Medium Mathematical Space", ' '),
|
(' ', "Medium Mathematical Space", " "),
|
||||||
(' ', "No-Break Space", ' '),
|
(' ', "No-Break Space", " "),
|
||||||
(' ', "Figure Space", ' '),
|
(' ', "Figure Space", " "),
|
||||||
(' ', "Narrow No-Break Space", ' '),
|
(' ', "Narrow No-Break Space", " "),
|
||||||
(' ', "Ideographic Space", ' '),
|
(' ', "Ideographic Space", " "),
|
||||||
|
|
||||||
('ߺ', "Nko Lajanyalan", '_'),
|
('ߺ', "Nko Lajanyalan", "_"),
|
||||||
('﹍', "Dashed Low Line", '_'),
|
('﹍', "Dashed Low Line", "_"),
|
||||||
('﹎', "Centreline Low Line", '_'),
|
('﹎', "Centreline Low Line", "_"),
|
||||||
('﹏', "Wavy Low Line", '_'),
|
('﹏', "Wavy Low Line", "_"),
|
||||||
('_', "Fullwidth Low Line", '_'),
|
('_', "Fullwidth Low Line", "_"),
|
||||||
|
|
||||||
('‐', "Hyphen", '-'),
|
('‐', "Hyphen", "-"),
|
||||||
('‑', "Non-Breaking Hyphen", '-'),
|
('‑', "Non-Breaking Hyphen", "-"),
|
||||||
('‒', "Figure Dash", '-'),
|
('‒', "Figure Dash", "-"),
|
||||||
('–', "En Dash", '-'),
|
('–', "En Dash", "-"),
|
||||||
('—', "Em Dash", '-'),
|
('—', "Em Dash", "-"),
|
||||||
('﹘', "Small Em Dash", '-'),
|
('﹘', "Small Em Dash", "-"),
|
||||||
('۔', "Arabic Full Stop", '-'),
|
('۔', "Arabic Full Stop", "-"),
|
||||||
('⁃', "Hyphen Bullet", '-'),
|
('⁃', "Hyphen Bullet", "-"),
|
||||||
('˗', "Modifier Letter Minus Sign", '-'),
|
('˗', "Modifier Letter Minus Sign", "-"),
|
||||||
('−', "Minus Sign", '-'),
|
('−', "Minus Sign", "-"),
|
||||||
('➖', "Heavy Minus Sign", '-'),
|
('➖', "Heavy Minus Sign", "-"),
|
||||||
('Ⲻ', "Coptic Letter Dialect-P Ni", '-'),
|
('Ⲻ', "Coptic Letter Dialect-P Ni", "-"),
|
||||||
('ー', "Katakana-Hiragana Prolonged Sound Mark", '-'),
|
('ー', "Katakana-Hiragana Prolonged Sound Mark", "-"),
|
||||||
('-', "Fullwidth Hyphen-Minus", '-'),
|
('-', "Fullwidth Hyphen-Minus", "-"),
|
||||||
('―', "Horizontal Bar", '-'),
|
('―', "Horizontal Bar", "-"),
|
||||||
('─', "Box Drawings Light Horizontal", '-'),
|
('─', "Box Drawings Light Horizontal", "-"),
|
||||||
('━', "Box Drawings Heavy Horizontal", '-'),
|
('━', "Box Drawings Heavy Horizontal", "-"),
|
||||||
('㇐', "CJK Stroke H", '-'),
|
('㇐', "CJK Stroke H", "-"),
|
||||||
('ꟷ', "Latin Epigraphic Letter Sideways I", '-'),
|
('ꟷ', "Latin Epigraphic Letter Sideways I", "-"),
|
||||||
('ᅳ', "Hangul Jungseong Eu", '-'),
|
('ᅳ', "Hangul Jungseong Eu", "-"),
|
||||||
('ㅡ', "Hangul Letter Eu", '-'),
|
('ㅡ', "Hangul Letter Eu", "-"),
|
||||||
('一', "CJK Unified Ideograph-4E00", '-'),
|
('一', "CJK Unified Ideograph-4E00", "-"),
|
||||||
('⼀', "Kangxi Radical One", '-'),
|
('⼀', "Kangxi Radical One", "-"),
|
||||||
|
|
||||||
('؍', "Arabic Date Separator", ','),
|
('؍', "Arabic Date Separator", ","),
|
||||||
('٫', "Arabic Decimal Separator", ','),
|
('٫', "Arabic Decimal Separator", ","),
|
||||||
('‚', "Single Low-9 Quotation Mark", ','),
|
('‚', "Single Low-9 Quotation Mark", ","),
|
||||||
('¸', "Cedilla", ','),
|
('¸', "Cedilla", ","),
|
||||||
('ꓹ', "Lisu Letter Tone Na Po", ','),
|
('ꓹ', "Lisu Letter Tone Na Po", ","),
|
||||||
(',', "Fullwidth Comma", ','),
|
(',', "Fullwidth Comma", ","),
|
||||||
|
|
||||||
(';', "Greek Question Mark", ';'),
|
(';', "Greek Question Mark", ";"),
|
||||||
(';', "Fullwidth Semicolon", ';'),
|
(';', "Fullwidth Semicolon", ";"),
|
||||||
('︔', "Presentation Form For Vertical Semicolon", ';'),
|
('︔', "Presentation Form For Vertical Semicolon", ";"),
|
||||||
|
|
||||||
('ः', "Devanagari Sign Visarga", ':'),
|
('ः', "Devanagari Sign Visarga", ":"),
|
||||||
('ઃ', "Gujarati Sign Visarga", ':'),
|
('ઃ', "Gujarati Sign Visarga", ":"),
|
||||||
(':', "Fullwidth Colon", ':'),
|
(':', "Fullwidth Colon", ":"),
|
||||||
('։', "Armenian Full Stop", ':'),
|
('։', "Armenian Full Stop", ":"),
|
||||||
('܃', "Syriac Supralinear Colon", ':'),
|
('܃', "Syriac Supralinear Colon", ":"),
|
||||||
('܄', "Syriac Sublinear Colon", ':'),
|
('܄', "Syriac Sublinear Colon", ":"),
|
||||||
('᛬', "Runic Multiple Punctuation", ':'),
|
('᛬', "Runic Multiple Punctuation", ":"),
|
||||||
('︰', "Presentation Form For Vertical Two Dot Leader", ':'),
|
('︰', "Presentation Form For Vertical Two Dot Leader", ":"),
|
||||||
('᠃', "Mongolian Full Stop", ':'),
|
('᠃', "Mongolian Full Stop", ":"),
|
||||||
('᠉', "Mongolian Manchu Full Stop", ':'),
|
('᠉', "Mongolian Manchu Full Stop", ":"),
|
||||||
('⁚', "Two Dot Punctuation", ':'),
|
('⁚', "Two Dot Punctuation", ":"),
|
||||||
('׃', "Hebrew Punctuation Sof Pasuq", ':'),
|
('׃', "Hebrew Punctuation Sof Pasuq", ":"),
|
||||||
('˸', "Modifier Letter Raised Colon", ':'),
|
('˸', "Modifier Letter Raised Colon", ":"),
|
||||||
('꞉', "Modifier Letter Colon", ':'),
|
('꞉', "Modifier Letter Colon", ":"),
|
||||||
('∶', "Ratio", ':'),
|
('∶', "Ratio", ":"),
|
||||||
('ː', "Modifier Letter Triangular Colon", ':'),
|
('ː', "Modifier Letter Triangular Colon", ":"),
|
||||||
('ꓽ', "Lisu Letter Tone Mya Jeu", ':'),
|
('ꓽ', "Lisu Letter Tone Mya Jeu", ":"),
|
||||||
('︓', "Presentation Form For Vertical Colon", ':'),
|
('︓', "Presentation Form For Vertical Colon", ":"),
|
||||||
|
|
||||||
('!', "Fullwidth Exclamation Mark", '!'),
|
('!', "Fullwidth Exclamation Mark", "!"),
|
||||||
('ǃ', "Latin Letter Retroflex Click", '!'),
|
('ǃ', "Latin Letter Retroflex Click", "!"),
|
||||||
('ⵑ', "Tifinagh Letter Tuareg Yang", '!'),
|
('ⵑ', "Tifinagh Letter Tuareg Yang", "!"),
|
||||||
('︕', "Presentation Form For Vertical Exclamation Mark", '!'),
|
('︕', "Presentation Form For Vertical Exclamation Mark", "!"),
|
||||||
|
|
||||||
('ʔ', "Latin Letter Glottal Stop", '?'),
|
('ʔ', "Latin Letter Glottal Stop", "?"),
|
||||||
('Ɂ', "Latin Capital Letter Glottal Stop", '?'),
|
('Ɂ', "Latin Capital Letter Glottal Stop", "?"),
|
||||||
('ॽ', "Devanagari Letter Glottal Stop", '?'),
|
('ॽ', "Devanagari Letter Glottal Stop", "?"),
|
||||||
('Ꭾ', "Cherokee Letter He", '?'),
|
('Ꭾ', "Cherokee Letter He", "?"),
|
||||||
('ꛫ', "Bamum Letter Ntuu", '?'),
|
('ꛫ', "Bamum Letter Ntuu", "?"),
|
||||||
('?', "Fullwidth Question Mark", '?'),
|
('?', "Fullwidth Question Mark", "?"),
|
||||||
('︖', "Presentation Form For Vertical Question Mark", '?'),
|
('︖', "Presentation Form For Vertical Question Mark", "?"),
|
||||||
|
|
||||||
('𝅭', "Musical Symbol Combining Augmentation Dot", '.'),
|
('𝅭', "Musical Symbol Combining Augmentation Dot", "."),
|
||||||
('․', "One Dot Leader", '.'),
|
('․', "One Dot Leader", "."),
|
||||||
('܁', "Syriac Supralinear Full Stop", '.'),
|
('܁', "Syriac Supralinear Full Stop", "."),
|
||||||
('܂', "Syriac Sublinear Full Stop", '.'),
|
('܂', "Syriac Sublinear Full Stop", "."),
|
||||||
('꘎', "Vai Full Stop", '.'),
|
('꘎', "Vai Full Stop", "."),
|
||||||
('𐩐', "Kharoshthi Punctuation Dot", '.'),
|
('𐩐', "Kharoshthi Punctuation Dot", "."),
|
||||||
('٠', "Arabic-Indic Digit Zero", '.'),
|
('٠', "Arabic-Indic Digit Zero", "."),
|
||||||
('۰', "Extended Arabic-Indic Digit Zero", '.'),
|
('۰', "Extended Arabic-Indic Digit Zero", "."),
|
||||||
('ꓸ', "Lisu Letter Tone Mya Ti", '.'),
|
('ꓸ', "Lisu Letter Tone Mya Ti", "."),
|
||||||
('·', "Middle Dot", '.'),
|
('·', "Middle Dot", "."),
|
||||||
('・', "Katakana Middle Dot", '.'),
|
('・', "Katakana Middle Dot", "."),
|
||||||
('・', "Halfwidth Katakana Middle Dot", '.'),
|
('・', "Halfwidth Katakana Middle Dot", "."),
|
||||||
('᛫', "Runic Single Punctuation", '.'),
|
('᛫', "Runic Single Punctuation", "."),
|
||||||
('·', "Greek Ano Teleia", '.'),
|
('·', "Greek Ano Teleia", "."),
|
||||||
('⸱', "Word Separator Middle Dot", '.'),
|
('⸱', "Word Separator Middle Dot", "."),
|
||||||
('𐄁', "Aegean Word Separator Dot", '.'),
|
('𐄁', "Aegean Word Separator Dot", "."),
|
||||||
('•', "Bullet", '.'),
|
('•', "Bullet", "."),
|
||||||
('‧', "Hyphenation Point", '.'),
|
('‧', "Hyphenation Point", "."),
|
||||||
('∙', "Bullet Operator", '.'),
|
('∙', "Bullet Operator", "."),
|
||||||
('⋅', "Dot Operator", '.'),
|
('⋅', "Dot Operator", "."),
|
||||||
('ꞏ', "Latin Letter Sinological Dot", '.'),
|
('ꞏ', "Latin Letter Sinological Dot", "."),
|
||||||
('ᐧ', "Canadian Syllabics Final Middle Dot", '.'),
|
('ᐧ', "Canadian Syllabics Final Middle Dot", "."),
|
||||||
('ᐧ', "Canadian Syllabics Final Middle Dot", '.'),
|
('ᐧ', "Canadian Syllabics Final Middle Dot", "."),
|
||||||
('.', "Fullwidth Full Stop", '.'),
|
('.', "Fullwidth Full Stop", "."),
|
||||||
('。', "Ideographic Full Stop", '.'),
|
('。', "Ideographic Full Stop", "."),
|
||||||
('︒', "Presentation Form For Vertical Ideographic Full Stop", '.'),
|
('︒', "Presentation Form For Vertical Ideographic Full Stop", "."),
|
||||||
|
|
||||||
('՝', "Armenian Comma", '\''),
|
('՝', "Armenian Comma", "\'"),
|
||||||
(''', "Fullwidth Apostrophe", '\''),
|
(''', "Fullwidth Apostrophe", "\'"),
|
||||||
('‘', "Left Single Quotation Mark", '\''),
|
('‘', "Left Single Quotation Mark", "\'"),
|
||||||
('’', "Right Single Quotation Mark", '\''),
|
('’', "Right Single Quotation Mark", "\'"),
|
||||||
('‛', "Single High-Reversed-9 Quotation Mark", '\''),
|
('‛', "Single High-Reversed-9 Quotation Mark", "\'"),
|
||||||
('′', "Prime", '\''),
|
('′', "Prime", "\'"),
|
||||||
('‵', "Reversed Prime", '\''),
|
('‵', "Reversed Prime", "\'"),
|
||||||
('՚', "Armenian Apostrophe", '\''),
|
('՚', "Armenian Apostrophe", "\'"),
|
||||||
('׳', "Hebrew Punctuation Geresh", '\''),
|
('׳', "Hebrew Punctuation Geresh", "\'"),
|
||||||
('`', "Grave Accent", '\''),
|
('`', "Grave Accent", "\'"),
|
||||||
('`', "Greek Varia", '\''),
|
('`', "Greek Varia", "\'"),
|
||||||
('`', "Fullwidth Grave Accent", '\''),
|
('`', "Fullwidth Grave Accent", "\'"),
|
||||||
('´', "Acute Accent", '\''),
|
('´', "Acute Accent", "\'"),
|
||||||
('΄', "Greek Tonos", '\''),
|
('΄', "Greek Tonos", "\'"),
|
||||||
('´', "Greek Oxia", '\''),
|
('´', "Greek Oxia", "\'"),
|
||||||
('᾽', "Greek Koronis", '\''),
|
('᾽', "Greek Koronis", "\'"),
|
||||||
('᾿', "Greek Psili", '\''),
|
('᾿', "Greek Psili", "\'"),
|
||||||
('῾', "Greek Dasia", '\''),
|
('῾', "Greek Dasia", "\'"),
|
||||||
('ʹ', "Modifier Letter Prime", '\''),
|
('ʹ', "Modifier Letter Prime", "\'"),
|
||||||
('ʹ', "Greek Numeral Sign", '\''),
|
('ʹ', "Greek Numeral Sign", "\'"),
|
||||||
('ˈ', "Modifier Letter Vertical Line", '\''),
|
('ˈ', "Modifier Letter Vertical Line", "\'"),
|
||||||
('ˊ', "Modifier Letter Acute Accent", '\''),
|
('ˊ', "Modifier Letter Acute Accent", "\'"),
|
||||||
('ˋ', "Modifier Letter Grave Accent", '\''),
|
('ˋ', "Modifier Letter Grave Accent", "\'"),
|
||||||
('˴', "Modifier Letter Middle Grave Accent", '\''),
|
('˴', "Modifier Letter Middle Grave Accent", "\'"),
|
||||||
('ʻ', "Modifier Letter Turned Comma", '\''),
|
('ʻ', "Modifier Letter Turned Comma", "\'"),
|
||||||
('ʽ', "Modifier Letter Reversed Comma", '\''),
|
('ʽ', "Modifier Letter Reversed Comma", "\'"),
|
||||||
('ʼ', "Modifier Letter Apostrophe", '\''),
|
('ʼ', "Modifier Letter Apostrophe", "\'"),
|
||||||
('ʾ', "Modifier Letter Right Half Ring", '\''),
|
('ʾ', "Modifier Letter Right Half Ring", "\'"),
|
||||||
('ꞌ', "Latin Small Letter Saltillo", '\''),
|
('ꞌ', "Latin Small Letter Saltillo", "\'"),
|
||||||
('י', "Hebrew Letter Yod", '\''),
|
('י', "Hebrew Letter Yod", "\'"),
|
||||||
('ߴ', "Nko High Tone Apostrophe", '\''),
|
('ߴ', "Nko High Tone Apostrophe", "\'"),
|
||||||
('ߵ', "Nko Low Tone Apostrophe", '\''),
|
('ߵ', "Nko Low Tone Apostrophe", "\'"),
|
||||||
('ᑊ', "Canadian Syllabics West-Cree P", '\''),
|
('ᑊ', "Canadian Syllabics West-Cree P", "\'"),
|
||||||
('ᛌ', "Runic Letter Short-Twig-Sol S", '\''),
|
('ᛌ', "Runic Letter Short-Twig-Sol S", "\'"),
|
||||||
('𖽑', "Miao Sign Aspiration", '\''),
|
('𖽑', "Miao Sign Aspiration", "\'"),
|
||||||
('𖽒', "Miao Sign Reformed Voicing", '\''),
|
('𖽒', "Miao Sign Reformed Voicing", "\'"),
|
||||||
|
|
||||||
('᳓', "Vedic Sign Nihshvasa", '"'),
|
('᳓', "Vedic Sign Nihshvasa", "\""),
|
||||||
('"', "Fullwidth Quotation Mark", '"'),
|
('"', "Fullwidth Quotation Mark", "\""),
|
||||||
('“', "Left Double Quotation Mark", '"'),
|
('“', "Left Double Quotation Mark", "\""),
|
||||||
('”', "Right Double Quotation Mark", '"'),
|
('”', "Right Double Quotation Mark", "\""),
|
||||||
('‟', "Double High-Reversed-9 Quotation Mark", '"'),
|
('‟', "Double High-Reversed-9 Quotation Mark", "\""),
|
||||||
('″', "Double Prime", '"'),
|
('″', "Double Prime", "\""),
|
||||||
('‶', "Reversed Double Prime", '"'),
|
('‶', "Reversed Double Prime", "\""),
|
||||||
('〃', "Ditto Mark", '"'),
|
('〃', "Ditto Mark", "\""),
|
||||||
('״', "Hebrew Punctuation Gershayim", '"'),
|
('״', "Hebrew Punctuation Gershayim", "\""),
|
||||||
('˝', "Double Acute Accent", '"'),
|
('˝', "Double Acute Accent", "\""),
|
||||||
('ʺ', "Modifier Letter Double Prime", '"'),
|
('ʺ', "Modifier Letter Double Prime", "\""),
|
||||||
('˶', "Modifier Letter Middle Double Acute Accent", '"'),
|
('˶', "Modifier Letter Middle Double Acute Accent", "\""),
|
||||||
('˵', "Modifier Letter Middle Double Grave Accent", '"'),
|
('˵', "Modifier Letter Middle Double Grave Accent", "\""),
|
||||||
('ˮ', "Modifier Letter Double Apostrophe", '"'),
|
('ˮ', "Modifier Letter Double Apostrophe", "\""),
|
||||||
('ײ', "Hebrew Ligature Yiddish Double Yod", '"'),
|
('ײ', "Hebrew Ligature Yiddish Double Yod", "\""),
|
||||||
('❞', "Heavy Double Comma Quotation Mark Ornament", '"'),
|
('❞', "Heavy Double Comma Quotation Mark Ornament", "\""),
|
||||||
('❝', "Heavy Double Turned Comma Quotation Mark Ornament", '"'),
|
('❝', "Heavy Double Turned Comma Quotation Mark Ornament", "\""),
|
||||||
|
|
||||||
('(', "Fullwidth Left Parenthesis", '('),
|
('(', "Fullwidth Left Parenthesis", "("),
|
||||||
('❨', "Medium Left Parenthesis Ornament", '('),
|
('❨', "Medium Left Parenthesis Ornament", "("),
|
||||||
('﴾', "Ornate Left Parenthesis", '('),
|
('﴾', "Ornate Left Parenthesis", "("),
|
||||||
|
|
||||||
(')', "Fullwidth Right Parenthesis", ')'),
|
(')', "Fullwidth Right Parenthesis", ")"),
|
||||||
('❩', "Medium Right Parenthesis Ornament", ')'),
|
('❩', "Medium Right Parenthesis Ornament", ")"),
|
||||||
('﴿', "Ornate Right Parenthesis", ')'),
|
('﴿', "Ornate Right Parenthesis", ")"),
|
||||||
|
|
||||||
('[', "Fullwidth Left Square Bracket", '['),
|
('[', "Fullwidth Left Square Bracket", "["),
|
||||||
('❲', "Light Left Tortoise Shell Bracket Ornament", '['),
|
('❲', "Light Left Tortoise Shell Bracket Ornament", "["),
|
||||||
('「', "Left Corner Bracket", '['),
|
('「', "Left Corner Bracket", "["),
|
||||||
('『', "Left White Corner Bracket", '['),
|
('『', "Left White Corner Bracket", "["),
|
||||||
('【', "Left Black Lenticular Bracket", '['),
|
('【', "Left Black Lenticular Bracket", "["),
|
||||||
('〔', "Left Tortoise Shell Bracket", '['),
|
('〔', "Left Tortoise Shell Bracket", "["),
|
||||||
('〖', "Left White Lenticular Bracket", '['),
|
('〖', "Left White Lenticular Bracket", "["),
|
||||||
('〘', "Left White Tortoise Shell Bracket", '['),
|
('〘', "Left White Tortoise Shell Bracket", "["),
|
||||||
('〚', "Left White Square Bracket", '['),
|
('〚', "Left White Square Bracket", "["),
|
||||||
|
|
||||||
(']', "Fullwidth Right Square Bracket", ']'),
|
(']', "Fullwidth Right Square Bracket", "]"),
|
||||||
('❳', "Light Right Tortoise Shell Bracket Ornament", ']'),
|
('❳', "Light Right Tortoise Shell Bracket Ornament", "]"),
|
||||||
('」', "Right Corner Bracket", ']'),
|
('」', "Right Corner Bracket", "]"),
|
||||||
('』', "Right White Corner Bracket", ']'),
|
('』', "Right White Corner Bracket", "]"),
|
||||||
('】', "Right Black Lenticular Bracket", ']'),
|
('】', "Right Black Lenticular Bracket", "]"),
|
||||||
('〕', "Right Tortoise Shell Bracket", ']'),
|
('〕', "Right Tortoise Shell Bracket", "]"),
|
||||||
('〗', "Right White Lenticular Bracket", ']'),
|
('〗', "Right White Lenticular Bracket", "]"),
|
||||||
('〙', "Right White Tortoise Shell Bracket", ']'),
|
('〙', "Right White Tortoise Shell Bracket", "]"),
|
||||||
('〛', "Right White Square Bracket", ']'),
|
('〛', "Right White Square Bracket", "]"),
|
||||||
|
|
||||||
('❴', "Medium Left Curly Bracket Ornament", '{'),
|
('❴', "Medium Left Curly Bracket Ornament", "{"),
|
||||||
('𝄔', "Musical Symbol Brace", '{'),
|
('𝄔', "Musical Symbol Brace", "{"),
|
||||||
('{', "Fullwidth Left Curly Bracket", '{'),
|
('{', "Fullwidth Left Curly Bracket", "{"),
|
||||||
|
|
||||||
('❵', "Medium Right Curly Bracket Ornament", '}'),
|
('❵', "Medium Right Curly Bracket Ornament", "}"),
|
||||||
('}', "Fullwidth Right Curly Bracket", '}'),
|
('}', "Fullwidth Right Curly Bracket", "}"),
|
||||||
|
|
||||||
('⁎', "Low Asterisk", '*'),
|
('⁎', "Low Asterisk", "*"),
|
||||||
('٭', "Arabic Five Pointed Star", '*'),
|
('٭', "Arabic Five Pointed Star", "*"),
|
||||||
('∗', "Asterisk Operator", '*'),
|
('∗', "Asterisk Operator", "*"),
|
||||||
('𐌟', "Old Italic Letter Ess", '*'),
|
('𐌟', "Old Italic Letter Ess", "*"),
|
||||||
('*', "Fullwidth Asterisk", '*'),
|
('*', "Fullwidth Asterisk", "*"),
|
||||||
|
|
||||||
('᜵', "Philippine Single Punctuation", '/'),
|
('᜵', "Philippine Single Punctuation", "/"),
|
||||||
('⁁', "Caret Insertion Point", '/'),
|
('⁁', "Caret Insertion Point", "/"),
|
||||||
('∕', "Division Slash", '/'),
|
('∕', "Division Slash", "/"),
|
||||||
('⁄', "Fraction Slash", '/'),
|
('⁄', "Fraction Slash", "/"),
|
||||||
('╱', "Box Drawings Light Diagonal Upper Right To Lower Left", '/'),
|
('╱', "Box Drawings Light Diagonal Upper Right To Lower Left", "/"),
|
||||||
('⟋', "Mathematical Rising Diagonal", '/'),
|
('⟋', "Mathematical Rising Diagonal", "/"),
|
||||||
('⧸', "Big Solidus", '/'),
|
('⧸', "Big Solidus", "/"),
|
||||||
('𝈺', "Greek Instrumental Notation Symbol-47", '/'),
|
('𝈺', "Greek Instrumental Notation Symbol-47", "/"),
|
||||||
('㇓', "CJK Stroke Sp", '/'),
|
('㇓', "CJK Stroke Sp", "/"),
|
||||||
('〳', "Vertical Kana Repeat Mark Upper Half", '/'),
|
('〳', "Vertical Kana Repeat Mark Upper Half", "/"),
|
||||||
('Ⳇ', "Coptic Capital Letter Old Coptic Esh", '/'),
|
('Ⳇ', "Coptic Capital Letter Old Coptic Esh", "/"),
|
||||||
('ノ', "Katakana Letter No", '/'),
|
('ノ', "Katakana Letter No", "/"),
|
||||||
('丿', "CJK Unified Ideograph-4E3F", '/'),
|
('丿', "CJK Unified Ideograph-4E3F", "/"),
|
||||||
('⼃', "Kangxi Radical Slash", '/'),
|
('⼃', "Kangxi Radical Slash", "/"),
|
||||||
('/', "Fullwidth Solidus", '/'),
|
('/', "Fullwidth Solidus", "/"),
|
||||||
|
|
||||||
('\', "Fullwidth Reverse Solidus", '\\'),
|
('\', "Fullwidth Reverse Solidus", "\\"),
|
||||||
('﹨', "Small Reverse Solidus", '\\'),
|
('﹨', "Small Reverse Solidus", "\\"),
|
||||||
('∖', "Set Minus", '\\'),
|
('∖', "Set Minus", "\\"),
|
||||||
('⟍', "Mathematical Falling Diagonal", '\\'),
|
('⟍', "Mathematical Falling Diagonal", "\\"),
|
||||||
('⧵', "Reverse Solidus Operator", '\\'),
|
('⧵', "Reverse Solidus Operator", "\\"),
|
||||||
('⧹', "Big Reverse Solidus", '\\'),
|
('⧹', "Big Reverse Solidus", "\\"),
|
||||||
('⧹', "Greek Vocal Notation Symbol-16", '\\'),
|
('⧹', "Greek Vocal Notation Symbol-16", "\\"),
|
||||||
('⧹', "Greek Instrumental Symbol-48", '\\'),
|
('⧹', "Greek Instrumental Symbol-48", "\\"),
|
||||||
('㇔', "CJK Stroke D", '\\'),
|
('㇔', "CJK Stroke D", "\\"),
|
||||||
('丶', "CJK Unified Ideograph-4E36", '\\'),
|
('丶', "CJK Unified Ideograph-4E36", "\\"),
|
||||||
('⼂', "Kangxi Radical Dot", '\\'),
|
('⼂', "Kangxi Radical Dot", "\\"),
|
||||||
('、', "Ideographic Comma", '\\'),
|
('、', "Ideographic Comma", "\\"),
|
||||||
('ヽ', "Katakana Iteration Mark", '\\'),
|
('ヽ', "Katakana Iteration Mark", "\\"),
|
||||||
|
|
||||||
('ꝸ', "Latin Small Letter Um", '&'),
|
('ꝸ', "Latin Small Letter Um", "&"),
|
||||||
('&', "Fullwidth Ampersand", '&'),
|
('&', "Fullwidth Ampersand", "&"),
|
||||||
|
|
||||||
('᛭', "Runic Cross Punctuation", '+'),
|
('᛭', "Runic Cross Punctuation", "+"),
|
||||||
('➕', "Heavy Plus Sign", '+'),
|
('➕', "Heavy Plus Sign", "+"),
|
||||||
('𐊛', "Lycian Letter H", '+'),
|
('𐊛', "Lycian Letter H", "+"),
|
||||||
('﬩', "Hebrew Letter Alternative Plus Sign", '+'),
|
('﬩', "Hebrew Letter Alternative Plus Sign", "+"),
|
||||||
('+', "Fullwidth Plus Sign", '+'),
|
('+', "Fullwidth Plus Sign", "+"),
|
||||||
|
|
||||||
('‹', "Single Left-Pointing Angle Quotation Mark", '<'),
|
('‹', "Single Left-Pointing Angle Quotation Mark", "<"),
|
||||||
('❮', "Heavy Left-Pointing Angle Quotation Mark Ornament", '<'),
|
('❮', "Heavy Left-Pointing Angle Quotation Mark Ornament", "<"),
|
||||||
('˂', "Modifier Letter Left Arrowhead", '<'),
|
('˂', "Modifier Letter Left Arrowhead", "<"),
|
||||||
('𝈶', "Greek Instrumental Symbol-40", '<'),
|
('𝈶', "Greek Instrumental Symbol-40", "<"),
|
||||||
('ᐸ', "Canadian Syllabics Pa", '<'),
|
('ᐸ', "Canadian Syllabics Pa", "<"),
|
||||||
('ᚲ', "Runic Letter Kauna", '<'),
|
('ᚲ', "Runic Letter Kauna", "<"),
|
||||||
('❬', "Medium Left-Pointing Angle Bracket Ornament", '<'),
|
('❬', "Medium Left-Pointing Angle Bracket Ornament", "<"),
|
||||||
('⟨', "Mathematical Left Angle Bracket", '<'),
|
('⟨', "Mathematical Left Angle Bracket", "<"),
|
||||||
('〈', "Left-Pointing Angle Bracket", '<'),
|
('〈', "Left-Pointing Angle Bracket", "<"),
|
||||||
('〈', "Left Angle Bracket", '<'),
|
('〈', "Left Angle Bracket", "<"),
|
||||||
('㇛', "CJK Stroke Pd", '<'),
|
('㇛', "CJK Stroke Pd", "<"),
|
||||||
('く', "Hiragana Letter Ku", '<'),
|
('く', "Hiragana Letter Ku", "<"),
|
||||||
('𡿨', "CJK Unified Ideograph-21FE8", '<'),
|
('𡿨', "CJK Unified Ideograph-21FE8", "<"),
|
||||||
('《', "Left Double Angle Bracket", '<'),
|
('《', "Left Double Angle Bracket", "<"),
|
||||||
('<', "Fullwidth Less-Than Sign", '<'),
|
('<', "Fullwidth Less-Than Sign", "<"),
|
||||||
|
|
||||||
('᐀', "Canadian Syllabics Hyphen", '='),
|
('᐀', "Canadian Syllabics Hyphen", "="),
|
||||||
('⹀', "Double Hyphen", '='),
|
('⹀', "Double Hyphen", "="),
|
||||||
('゠', "Katakana-Hiragana Double Hyphen", '='),
|
('゠', "Katakana-Hiragana Double Hyphen", "="),
|
||||||
('꓿', "Lisu Punctuation Full Stop", '='),
|
('꓿', "Lisu Punctuation Full Stop", "="),
|
||||||
('=', "Fullwidth Equals Sign", '='),
|
('=', "Fullwidth Equals Sign", "="),
|
||||||
|
|
||||||
('›', "Single Right-Pointing Angle Quotation Mark", '>'),
|
('›', "Single Right-Pointing Angle Quotation Mark", ">"),
|
||||||
('❯', "Heavy Right-Pointing Angle Quotation Mark Ornament", '>'),
|
('❯', "Heavy Right-Pointing Angle Quotation Mark Ornament", ">"),
|
||||||
('˃', "Modifier Letter Right Arrowhead", '>'),
|
('˃', "Modifier Letter Right Arrowhead", ">"),
|
||||||
('𝈷', "Greek Instrumental Symbol-42", '>'),
|
('𝈷', "Greek Instrumental Symbol-42", ">"),
|
||||||
('ᐳ', "Canadian Syllabics Po", '>'),
|
('ᐳ', "Canadian Syllabics Po", ">"),
|
||||||
('𖼿', "Miao Letter Archaic Zza", '>'),
|
('𖼿', "Miao Letter Archaic Zza", ">"),
|
||||||
('❭', "Medium Right-Pointing Angle Bracket Ornament", '>'),
|
('❭', "Medium Right-Pointing Angle Bracket Ornament", ">"),
|
||||||
('⟩', "Mathematical Right Angle Bracket", '>'),
|
('⟩', "Mathematical Right Angle Bracket", ">"),
|
||||||
('〉', "Right-Pointing Angle Bracket", '>'),
|
('〉', "Right-Pointing Angle Bracket", ">"),
|
||||||
('〉', "Right Angle Bracket", '>'),
|
('〉', "Right Angle Bracket", ">"),
|
||||||
('》', "Right Double Angle Bracket", '>'),
|
('》', "Right Double Angle Bracket", ">"),
|
||||||
('>', "Fullwidth Greater-Than Sign", '>'),
|
('>', "Fullwidth Greater-Than Sign", ">"),
|
||||||
|
('⩵', "Two Consecutive Equals Signs", "==")
|
||||||
];
|
];
|
||||||
|
|
||||||
// FIXME: the lexer could be used to turn the ASCII version of unicode homoglyphs, instead of
|
// FIXME: the lexer could be used to turn the ASCII version of unicode homoglyphs, instead of
|
||||||
// keeping the substitution token in this table. Ideally, this should be inside `rustc_lexer`.
|
// keeping the substitution token in this table. Ideally, this should be inside `rustc_lexer`.
|
||||||
// However, we should first remove compound tokens like `<<` from `rustc_lexer`, and then add
|
// However, we should first remove compound tokens like `<<` from `rustc_lexer`, and then add
|
||||||
// fancier error recovery to it, as there will be less overall work to do this way.
|
// fancier error recovery to it, as there will be less overall work to do this way.
|
||||||
const ASCII_ARRAY: &[(char, &str, Option<token::TokenKind>)] = &[
|
const ASCII_ARRAY: &[(&str, &str, Option<token::TokenKind>)] = &[
|
||||||
(' ', "Space", None),
|
(" ", "Space", None),
|
||||||
('_', "Underscore", Some(token::Ident(kw::Underscore, false))),
|
("_", "Underscore", Some(token::Ident(kw::Underscore, false))),
|
||||||
('-', "Minus/Hyphen", Some(token::BinOp(token::Minus))),
|
("-", "Minus/Hyphen", Some(token::BinOp(token::Minus))),
|
||||||
(',', "Comma", Some(token::Comma)),
|
(",", "Comma", Some(token::Comma)),
|
||||||
(';', "Semicolon", Some(token::Semi)),
|
(";", "Semicolon", Some(token::Semi)),
|
||||||
(':', "Colon", Some(token::Colon)),
|
(":", "Colon", Some(token::Colon)),
|
||||||
('!', "Exclamation Mark", Some(token::Not)),
|
("!", "Exclamation Mark", Some(token::Not)),
|
||||||
('?', "Question Mark", Some(token::Question)),
|
("?", "Question Mark", Some(token::Question)),
|
||||||
('.', "Period", Some(token::Dot)),
|
(".", "Period", Some(token::Dot)),
|
||||||
('(', "Left Parenthesis", Some(token::OpenDelim(Delimiter::Parenthesis))),
|
("(", "Left Parenthesis", Some(token::OpenDelim(Delimiter::Parenthesis))),
|
||||||
(')', "Right Parenthesis", Some(token::CloseDelim(Delimiter::Parenthesis))),
|
(")", "Right Parenthesis", Some(token::CloseDelim(Delimiter::Parenthesis))),
|
||||||
('[', "Left Square Bracket", Some(token::OpenDelim(Delimiter::Bracket))),
|
("[", "Left Square Bracket", Some(token::OpenDelim(Delimiter::Bracket))),
|
||||||
(']', "Right Square Bracket", Some(token::CloseDelim(Delimiter::Bracket))),
|
("]", "Right Square Bracket", Some(token::CloseDelim(Delimiter::Bracket))),
|
||||||
('{', "Left Curly Brace", Some(token::OpenDelim(Delimiter::Brace))),
|
("{", "Left Curly Brace", Some(token::OpenDelim(Delimiter::Brace))),
|
||||||
('}', "Right Curly Brace", Some(token::CloseDelim(Delimiter::Brace))),
|
("}", "Right Curly Brace", Some(token::CloseDelim(Delimiter::Brace))),
|
||||||
('*', "Asterisk", Some(token::BinOp(token::Star))),
|
("*", "Asterisk", Some(token::BinOp(token::Star))),
|
||||||
('/', "Slash", Some(token::BinOp(token::Slash))),
|
("/", "Slash", Some(token::BinOp(token::Slash))),
|
||||||
('\\', "Backslash", None),
|
("\\", "Backslash", None),
|
||||||
('&', "Ampersand", Some(token::BinOp(token::And))),
|
("&", "Ampersand", Some(token::BinOp(token::And))),
|
||||||
('+', "Plus Sign", Some(token::BinOp(token::Plus))),
|
("+", "Plus Sign", Some(token::BinOp(token::Plus))),
|
||||||
('<', "Less-Than Sign", Some(token::Lt)),
|
("<", "Less-Than Sign", Some(token::Lt)),
|
||||||
('=', "Equals Sign", Some(token::Eq)),
|
("=", "Equals Sign", Some(token::Eq)),
|
||||||
('>', "Greater-Than Sign", Some(token::Gt)),
|
("==", "Double Equals Sign", Some(token::EqEq)),
|
||||||
|
(">", "Greater-Than Sign", Some(token::Gt)),
|
||||||
// FIXME: Literals are already lexed by this point, so we can't recover gracefully just by
|
// FIXME: Literals are already lexed by this point, so we can't recover gracefully just by
|
||||||
// spitting the correct token out.
|
// spitting the correct token out.
|
||||||
('\'', "Single Quote", None),
|
("\'", "Single Quote", None),
|
||||||
('"', "Quotation Mark", None),
|
("\"", "Quotation Mark", None),
|
||||||
];
|
];
|
||||||
|
|
||||||
pub(super) fn check_for_substitution<'a>(
|
pub(super) fn check_for_substitution<'a>(
|
||||||
|
@ -339,11 +341,11 @@ pub(super) fn check_for_substitution<'a>(
|
||||||
err: &mut Diagnostic,
|
err: &mut Diagnostic,
|
||||||
count: usize,
|
count: usize,
|
||||||
) -> Option<token::TokenKind> {
|
) -> Option<token::TokenKind> {
|
||||||
let &(_u_char, u_name, ascii_char) = UNICODE_ARRAY.iter().find(|&&(c, _, _)| c == ch)?;
|
let &(_, u_name, ascii_str) = UNICODE_ARRAY.iter().find(|&&(c, _, _)| c == ch)?;
|
||||||
|
|
||||||
let span = Span::with_root_ctxt(pos, pos + Pos::from_usize(ch.len_utf8() * count));
|
let span = Span::with_root_ctxt(pos, pos + Pos::from_usize(ch.len_utf8() * count));
|
||||||
|
|
||||||
let Some((_ascii_char, ascii_name, token)) = ASCII_ARRAY.iter().find(|&&(c, _, _)| c == ascii_char) else {
|
let Some((_, ascii_name, token)) = ASCII_ARRAY.iter().find(|&&(s, _, _)| s == ascii_str) else {
|
||||||
let msg = format!("substitution character not found for '{}'", ch);
|
let msg = format!("substitution character not found for '{}'", ch);
|
||||||
reader.sess.span_diagnostic.span_bug_no_panic(span, &msg);
|
reader.sess.span_diagnostic.span_bug_no_panic(span, &msg);
|
||||||
return None;
|
return None;
|
||||||
|
@ -354,7 +356,7 @@ pub(super) fn check_for_substitution<'a>(
|
||||||
let msg = format!(
|
let msg = format!(
|
||||||
"Unicode characters '“' (Left Double Quotation Mark) and \
|
"Unicode characters '“' (Left Double Quotation Mark) and \
|
||||||
'”' (Right Double Quotation Mark) look like '{}' ({}), but are not",
|
'”' (Right Double Quotation Mark) look like '{}' ({}), but are not",
|
||||||
ascii_char, ascii_name
|
ascii_str, ascii_name
|
||||||
);
|
);
|
||||||
err.span_suggestion(
|
err.span_suggestion(
|
||||||
Span::with_root_ctxt(
|
Span::with_root_ctxt(
|
||||||
|
@ -368,12 +370,12 @@ pub(super) fn check_for_substitution<'a>(
|
||||||
} else {
|
} else {
|
||||||
let msg = format!(
|
let msg = format!(
|
||||||
"Unicode character '{}' ({}) looks like '{}' ({}), but it is not",
|
"Unicode character '{}' ({}) looks like '{}' ({}), but it is not",
|
||||||
ch, u_name, ascii_char, ascii_name
|
ch, u_name, ascii_str, ascii_name
|
||||||
);
|
);
|
||||||
err.span_suggestion(
|
err.span_suggestion(
|
||||||
span,
|
span,
|
||||||
&msg,
|
&msg,
|
||||||
ascii_char.to_string().repeat(count),
|
ascii_str.to_string().repeat(count),
|
||||||
Applicability::MaybeIncorrect,
|
Applicability::MaybeIncorrect,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1353,9 +1353,6 @@ impl<'a> Parser<'a> {
|
||||||
err.span_label(sp, "while parsing this `loop` expression");
|
err.span_label(sp, "while parsing this `loop` expression");
|
||||||
err
|
err
|
||||||
})
|
})
|
||||||
} else if self.eat_keyword(kw::Continue) {
|
|
||||||
let kind = ExprKind::Continue(self.eat_label());
|
|
||||||
Ok(self.mk_expr(lo.to(self.prev_token.span), kind))
|
|
||||||
} else if self.eat_keyword(kw::Match) {
|
} else if self.eat_keyword(kw::Match) {
|
||||||
let match_sp = self.prev_token.span;
|
let match_sp = self.prev_token.span;
|
||||||
self.parse_match_expr().map_err(|mut err| {
|
self.parse_match_expr().map_err(|mut err| {
|
||||||
|
@ -1379,6 +1376,8 @@ impl<'a> Parser<'a> {
|
||||||
self.parse_try_block(lo)
|
self.parse_try_block(lo)
|
||||||
} else if self.eat_keyword(kw::Return) {
|
} else if self.eat_keyword(kw::Return) {
|
||||||
self.parse_return_expr()
|
self.parse_return_expr()
|
||||||
|
} else if self.eat_keyword(kw::Continue) {
|
||||||
|
self.parse_continue_expr(lo)
|
||||||
} else if self.eat_keyword(kw::Break) {
|
} else if self.eat_keyword(kw::Break) {
|
||||||
self.parse_break_expr()
|
self.parse_break_expr()
|
||||||
} else if self.eat_keyword(kw::Yield) {
|
} else if self.eat_keyword(kw::Yield) {
|
||||||
|
@ -1715,10 +1714,10 @@ impl<'a> Parser<'a> {
|
||||||
fn parse_break_expr(&mut self) -> PResult<'a, P<Expr>> {
|
fn parse_break_expr(&mut self) -> PResult<'a, P<Expr>> {
|
||||||
let lo = self.prev_token.span;
|
let lo = self.prev_token.span;
|
||||||
let mut label = self.eat_label();
|
let mut label = self.eat_label();
|
||||||
let kind = if label.is_some() && self.token == token::Colon {
|
let kind = if self.token == token::Colon && let Some(label) = label.take() {
|
||||||
// The value expression can be a labeled loop, see issue #86948, e.g.:
|
// The value expression can be a labeled loop, see issue #86948, e.g.:
|
||||||
// `loop { break 'label: loop { break 'label 42; }; }`
|
// `loop { break 'label: loop { break 'label 42; }; }`
|
||||||
let lexpr = self.parse_labeled_expr(label.take().unwrap(), true)?;
|
let lexpr = self.parse_labeled_expr(label, true)?;
|
||||||
self.sess.emit_err(LabeledLoopInBreak {
|
self.sess.emit_err(LabeledLoopInBreak {
|
||||||
span: lexpr.span,
|
span: lexpr.span,
|
||||||
sub: WrapExpressionInParentheses {
|
sub: WrapExpressionInParentheses {
|
||||||
|
@ -1730,8 +1729,8 @@ impl<'a> Parser<'a> {
|
||||||
} else if self.token != token::OpenDelim(Delimiter::Brace)
|
} else if self.token != token::OpenDelim(Delimiter::Brace)
|
||||||
|| !self.restrictions.contains(Restrictions::NO_STRUCT_LITERAL)
|
|| !self.restrictions.contains(Restrictions::NO_STRUCT_LITERAL)
|
||||||
{
|
{
|
||||||
let expr = self.parse_expr_opt()?;
|
let mut expr = self.parse_expr_opt()?;
|
||||||
if let Some(expr) = &expr {
|
if let Some(expr) = &mut expr {
|
||||||
if label.is_some()
|
if label.is_some()
|
||||||
&& matches!(
|
&& matches!(
|
||||||
expr.kind,
|
expr.kind,
|
||||||
|
@ -1749,7 +1748,19 @@ impl<'a> Parser<'a> {
|
||||||
BuiltinLintDiagnostics::BreakWithLabelAndLoop(expr.span),
|
BuiltinLintDiagnostics::BreakWithLabelAndLoop(expr.span),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Recover `break label aaaaa`
|
||||||
|
if self.may_recover()
|
||||||
|
&& let ExprKind::Path(None, p) = &expr.kind
|
||||||
|
&& let [segment] = &*p.segments
|
||||||
|
&& let &ast::PathSegment { ident, args: None, .. } = segment
|
||||||
|
&& let Some(next) = self.parse_expr_opt()?
|
||||||
|
{
|
||||||
|
label = Some(self.recover_ident_into_label(ident));
|
||||||
|
*expr = next;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
expr
|
expr
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
|
@ -1758,6 +1769,23 @@ impl<'a> Parser<'a> {
|
||||||
self.maybe_recover_from_bad_qpath(expr)
|
self.maybe_recover_from_bad_qpath(expr)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Parse `"continue" label?`.
|
||||||
|
fn parse_continue_expr(&mut self, lo: Span) -> PResult<'a, P<Expr>> {
|
||||||
|
let mut label = self.eat_label();
|
||||||
|
|
||||||
|
// Recover `continue label` -> `continue 'label`
|
||||||
|
if self.may_recover()
|
||||||
|
&& label.is_none()
|
||||||
|
&& let Some((ident, _)) = self.token.ident()
|
||||||
|
{
|
||||||
|
self.bump();
|
||||||
|
label = Some(self.recover_ident_into_label(ident));
|
||||||
|
}
|
||||||
|
|
||||||
|
let kind = ExprKind::Continue(label);
|
||||||
|
Ok(self.mk_expr(lo.to(self.prev_token.span), kind))
|
||||||
|
}
|
||||||
|
|
||||||
/// Parse `"yield" expr?`.
|
/// Parse `"yield" expr?`.
|
||||||
fn parse_yield_expr(&mut self) -> PResult<'a, P<Expr>> {
|
fn parse_yield_expr(&mut self) -> PResult<'a, P<Expr>> {
|
||||||
let lo = self.prev_token.span;
|
let lo = self.prev_token.span;
|
||||||
|
@ -3046,6 +3074,25 @@ impl<'a> Parser<'a> {
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Converts an ident into 'label and emits an "expected a label, found an identifier" error.
|
||||||
|
fn recover_ident_into_label(&mut self, ident: Ident) -> Label {
|
||||||
|
// Convert `label` -> `'label`,
|
||||||
|
// so that nameres doesn't complain about non-existing label
|
||||||
|
let label = format!("'{}", ident.name);
|
||||||
|
let ident = Ident { name: Symbol::intern(&label), span: ident.span };
|
||||||
|
|
||||||
|
self.struct_span_err(ident.span, "expected a label, found an identifier")
|
||||||
|
.span_suggestion(
|
||||||
|
ident.span,
|
||||||
|
"labels start with a tick",
|
||||||
|
label,
|
||||||
|
Applicability::MachineApplicable,
|
||||||
|
)
|
||||||
|
.emit();
|
||||||
|
|
||||||
|
Label { ident }
|
||||||
|
}
|
||||||
|
|
||||||
/// Parses `ident (COLON expr)?`.
|
/// Parses `ident (COLON expr)?`.
|
||||||
fn parse_expr_field(&mut self) -> PResult<'a, ExprField> {
|
fn parse_expr_field(&mut self) -> PResult<'a, ExprField> {
|
||||||
let attrs = self.parse_outer_attributes()?;
|
let attrs = self.parse_outer_attributes()?;
|
||||||
|
|
|
@ -401,12 +401,12 @@ fn resolve_negative_obligation<'tcx>(
|
||||||
infcx.resolve_regions(&outlives_env).is_empty()
|
infcx.resolve_regions(&outlives_env).is_empty()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[instrument(level = "debug", skip(tcx), ret)]
|
||||||
pub fn trait_ref_is_knowable<'tcx>(
|
pub fn trait_ref_is_knowable<'tcx>(
|
||||||
tcx: TyCtxt<'tcx>,
|
tcx: TyCtxt<'tcx>,
|
||||||
trait_ref: ty::TraitRef<'tcx>,
|
trait_ref: ty::TraitRef<'tcx>,
|
||||||
) -> Result<(), Conflict> {
|
) -> Result<(), Conflict> {
|
||||||
debug!("trait_ref_is_knowable(trait_ref={:?})", trait_ref);
|
if orphan_check_trait_ref(trait_ref, InCrate::Remote).is_ok() {
|
||||||
if orphan_check_trait_ref(tcx, trait_ref, InCrate::Remote).is_ok() {
|
|
||||||
// A downstream or cousin crate is allowed to implement some
|
// A downstream or cousin crate is allowed to implement some
|
||||||
// substitution of this trait-ref.
|
// substitution of this trait-ref.
|
||||||
return Err(Conflict::Downstream);
|
return Err(Conflict::Downstream);
|
||||||
|
@ -429,11 +429,9 @@ pub fn trait_ref_is_knowable<'tcx>(
|
||||||
// and if we are an intermediate owner, then we don't care
|
// and if we are an intermediate owner, then we don't care
|
||||||
// about future-compatibility, which means that we're OK if
|
// about future-compatibility, which means that we're OK if
|
||||||
// we are an owner.
|
// we are an owner.
|
||||||
if orphan_check_trait_ref(tcx, trait_ref, InCrate::Local).is_ok() {
|
if orphan_check_trait_ref(trait_ref, InCrate::Local).is_ok() {
|
||||||
debug!("trait_ref_is_knowable: orphan check passed");
|
|
||||||
Ok(())
|
Ok(())
|
||||||
} else {
|
} else {
|
||||||
debug!("trait_ref_is_knowable: nonlocal, nonfundamental, unowned");
|
|
||||||
Err(Conflict::Upstream)
|
Err(Conflict::Upstream)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -445,6 +443,7 @@ pub fn trait_ref_is_local_or_fundamental<'tcx>(
|
||||||
trait_ref.def_id.krate == LOCAL_CRATE || tcx.has_attr(trait_ref.def_id, sym::fundamental)
|
trait_ref.def_id.krate == LOCAL_CRATE || tcx.has_attr(trait_ref.def_id, sym::fundamental)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Debug)]
|
||||||
pub enum OrphanCheckErr<'tcx> {
|
pub enum OrphanCheckErr<'tcx> {
|
||||||
NonLocalInputType(Vec<(Ty<'tcx>, bool /* Is this the first input type? */)>),
|
NonLocalInputType(Vec<(Ty<'tcx>, bool /* Is this the first input type? */)>),
|
||||||
UncoveredTy(Ty<'tcx>, Option<Ty<'tcx>>),
|
UncoveredTy(Ty<'tcx>, Option<Ty<'tcx>>),
|
||||||
|
@ -456,13 +455,12 @@ pub enum OrphanCheckErr<'tcx> {
|
||||||
///
|
///
|
||||||
/// 1. All type parameters in `Self` must be "covered" by some local type constructor.
|
/// 1. All type parameters in `Self` must be "covered" by some local type constructor.
|
||||||
/// 2. Some local type must appear in `Self`.
|
/// 2. Some local type must appear in `Self`.
|
||||||
|
#[instrument(level = "debug", skip(tcx), ret)]
|
||||||
pub fn orphan_check(tcx: TyCtxt<'_>, impl_def_id: DefId) -> Result<(), OrphanCheckErr<'_>> {
|
pub fn orphan_check(tcx: TyCtxt<'_>, impl_def_id: DefId) -> Result<(), OrphanCheckErr<'_>> {
|
||||||
debug!("orphan_check({:?})", impl_def_id);
|
|
||||||
|
|
||||||
// We only except this routine to be invoked on implementations
|
// We only except this routine to be invoked on implementations
|
||||||
// of a trait, not inherent implementations.
|
// of a trait, not inherent implementations.
|
||||||
let trait_ref = tcx.impl_trait_ref(impl_def_id).unwrap().subst_identity();
|
let trait_ref = tcx.impl_trait_ref(impl_def_id).unwrap().subst_identity();
|
||||||
debug!("orphan_check: trait_ref={:?}", trait_ref);
|
debug!(?trait_ref);
|
||||||
|
|
||||||
// If the *trait* is local to the crate, ok.
|
// If the *trait* is local to the crate, ok.
|
||||||
if trait_ref.def_id.is_local() {
|
if trait_ref.def_id.is_local() {
|
||||||
|
@ -470,7 +468,7 @@ pub fn orphan_check(tcx: TyCtxt<'_>, impl_def_id: DefId) -> Result<(), OrphanChe
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
|
|
||||||
orphan_check_trait_ref(tcx, trait_ref, InCrate::Local)
|
orphan_check_trait_ref(trait_ref, InCrate::Local)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Checks whether a trait-ref is potentially implementable by a crate.
|
/// Checks whether a trait-ref is potentially implementable by a crate.
|
||||||
|
@ -559,13 +557,11 @@ pub fn orphan_check(tcx: TyCtxt<'_>, impl_def_id: DefId) -> Result<(), OrphanChe
|
||||||
///
|
///
|
||||||
/// Note that this function is never called for types that have both type
|
/// Note that this function is never called for types that have both type
|
||||||
/// parameters and inference variables.
|
/// parameters and inference variables.
|
||||||
|
#[instrument(level = "trace", ret)]
|
||||||
fn orphan_check_trait_ref<'tcx>(
|
fn orphan_check_trait_ref<'tcx>(
|
||||||
tcx: TyCtxt<'tcx>,
|
|
||||||
trait_ref: ty::TraitRef<'tcx>,
|
trait_ref: ty::TraitRef<'tcx>,
|
||||||
in_crate: InCrate,
|
in_crate: InCrate,
|
||||||
) -> Result<(), OrphanCheckErr<'tcx>> {
|
) -> Result<(), OrphanCheckErr<'tcx>> {
|
||||||
debug!("orphan_check_trait_ref(trait_ref={:?}, in_crate={:?})", trait_ref, in_crate);
|
|
||||||
|
|
||||||
if trait_ref.needs_infer() && trait_ref.needs_subst() {
|
if trait_ref.needs_infer() && trait_ref.needs_subst() {
|
||||||
bug!(
|
bug!(
|
||||||
"can't orphan check a trait ref with both params and inference variables {:?}",
|
"can't orphan check a trait ref with both params and inference variables {:?}",
|
||||||
|
@ -573,7 +569,7 @@ fn orphan_check_trait_ref<'tcx>(
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut checker = OrphanChecker::new(tcx, in_crate);
|
let mut checker = OrphanChecker::new(in_crate);
|
||||||
match trait_ref.visit_with(&mut checker) {
|
match trait_ref.visit_with(&mut checker) {
|
||||||
ControlFlow::Continue(()) => Err(OrphanCheckErr::NonLocalInputType(checker.non_local_tys)),
|
ControlFlow::Continue(()) => Err(OrphanCheckErr::NonLocalInputType(checker.non_local_tys)),
|
||||||
ControlFlow::Break(OrphanCheckEarlyExit::ParamTy(ty)) => {
|
ControlFlow::Break(OrphanCheckEarlyExit::ParamTy(ty)) => {
|
||||||
|
@ -592,7 +588,6 @@ fn orphan_check_trait_ref<'tcx>(
|
||||||
}
|
}
|
||||||
|
|
||||||
struct OrphanChecker<'tcx> {
|
struct OrphanChecker<'tcx> {
|
||||||
tcx: TyCtxt<'tcx>,
|
|
||||||
in_crate: InCrate,
|
in_crate: InCrate,
|
||||||
in_self_ty: bool,
|
in_self_ty: bool,
|
||||||
/// Ignore orphan check failures and exclusively search for the first
|
/// Ignore orphan check failures and exclusively search for the first
|
||||||
|
@ -602,9 +597,8 @@ struct OrphanChecker<'tcx> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'tcx> OrphanChecker<'tcx> {
|
impl<'tcx> OrphanChecker<'tcx> {
|
||||||
fn new(tcx: TyCtxt<'tcx>, in_crate: InCrate) -> Self {
|
fn new(in_crate: InCrate) -> Self {
|
||||||
OrphanChecker {
|
OrphanChecker {
|
||||||
tcx,
|
|
||||||
in_crate,
|
in_crate,
|
||||||
in_self_ty: true,
|
in_self_ty: true,
|
||||||
search_first_local_ty: false,
|
search_first_local_ty: false,
|
||||||
|
@ -697,13 +691,17 @@ impl<'tcx> TypeVisitor<'tcx> for OrphanChecker<'tcx> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ty::Error(_) => ControlFlow::Break(OrphanCheckEarlyExit::LocalTy(ty)),
|
ty::Error(_) => ControlFlow::Break(OrphanCheckEarlyExit::LocalTy(ty)),
|
||||||
ty::Closure(..) | ty::Generator(..) | ty::GeneratorWitness(..) => {
|
ty::Closure(did, ..) | ty::Generator(did, ..) => {
|
||||||
self.tcx.sess.delay_span_bug(
|
if self.def_id_is_local(did) {
|
||||||
DUMMY_SP,
|
ControlFlow::Break(OrphanCheckEarlyExit::LocalTy(ty))
|
||||||
format!("ty_is_local invoked on closure or generator: {:?}", ty),
|
} else {
|
||||||
);
|
self.found_non_local_ty(ty)
|
||||||
ControlFlow::Break(OrphanCheckEarlyExit::LocalTy(ty))
|
}
|
||||||
}
|
}
|
||||||
|
// This should only be created when checking whether we have to check whether some
|
||||||
|
// auto trait impl applies. There will never be multiple impls, so we can just
|
||||||
|
// act as if it were a local type here.
|
||||||
|
ty::GeneratorWitness(_) => ControlFlow::Break(OrphanCheckEarlyExit::LocalTy(ty)),
|
||||||
ty::Alias(ty::Opaque, ..) => {
|
ty::Alias(ty::Opaque, ..) => {
|
||||||
// This merits some explanation.
|
// This merits some explanation.
|
||||||
// Normally, opaque types are not involved when performing
|
// Normally, opaque types are not involved when performing
|
||||||
|
|
|
@ -259,6 +259,8 @@ define!("mir_unreachable", fn Unreachable() -> BasicBlock);
|
||||||
define!("mir_drop", fn Drop<T>(place: T, goto: BasicBlock));
|
define!("mir_drop", fn Drop<T>(place: T, goto: BasicBlock));
|
||||||
define!("mir_drop_and_replace", fn DropAndReplace<T>(place: T, value: T, goto: BasicBlock));
|
define!("mir_drop_and_replace", fn DropAndReplace<T>(place: T, value: T, goto: BasicBlock));
|
||||||
define!("mir_call", fn Call<T>(place: T, goto: BasicBlock, call: T));
|
define!("mir_call", fn Call<T>(place: T, goto: BasicBlock, call: T));
|
||||||
|
define!("mir_storage_live", fn StorageLive<T>(local: T));
|
||||||
|
define!("mir_storage_dead", fn StorageDead<T>(local: T));
|
||||||
define!("mir_retag", fn Retag<T>(place: T));
|
define!("mir_retag", fn Retag<T>(place: T));
|
||||||
define!("mir_move", fn Move<T>(place: T) -> T);
|
define!("mir_move", fn Move<T>(place: T) -> T);
|
||||||
define!("mir_static", fn Static<T>(s: T) -> &'static T);
|
define!("mir_static", fn Static<T>(s: T) -> &'static T);
|
||||||
|
|
|
@ -746,6 +746,8 @@ fn signal_string(signal: i32) -> &'static str {
|
||||||
libc::SIGWINCH => " (SIGWINCH)",
|
libc::SIGWINCH => " (SIGWINCH)",
|
||||||
#[cfg(not(target_os = "haiku"))]
|
#[cfg(not(target_os = "haiku"))]
|
||||||
libc::SIGIO => " (SIGIO)",
|
libc::SIGIO => " (SIGIO)",
|
||||||
|
#[cfg(target_os = "haiku")]
|
||||||
|
libc::SIGPOLL => " (SIGPOLL)",
|
||||||
libc::SIGSYS => " (SIGSYS)",
|
libc::SIGSYS => " (SIGSYS)",
|
||||||
// For information on Linux signals, run `man 7 signal`
|
// For information on Linux signals, run `man 7 signal`
|
||||||
#[cfg(all(
|
#[cfg(all(
|
||||||
|
|
|
@ -11,12 +11,14 @@ pub fn simple(x: i32) -> i32 {
|
||||||
let temp2: _;
|
let temp2: _;
|
||||||
|
|
||||||
{
|
{
|
||||||
|
StorageLive(temp1);
|
||||||
temp1 = x;
|
temp1 = x;
|
||||||
Goto(exit)
|
Goto(exit)
|
||||||
}
|
}
|
||||||
|
|
||||||
exit = {
|
exit = {
|
||||||
temp2 = Move(temp1);
|
temp2 = Move(temp1);
|
||||||
|
StorageDead(temp1);
|
||||||
RET = temp2;
|
RET = temp2;
|
||||||
Return()
|
Return()
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,13 +6,15 @@ fn simple(_1: i32) -> i32 {
|
||||||
let mut _3: i32; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
|
let mut _3: i32; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
|
||||||
|
|
||||||
bb0: {
|
bb0: {
|
||||||
_2 = _1; // scope 0 at $DIR/simple_assign.rs:+6:13: +6:22
|
StorageLive(_2); // scope 0 at $DIR/simple_assign.rs:+6:13: +6:31
|
||||||
goto -> bb1; // scope 0 at $DIR/simple_assign.rs:+7:13: +7:23
|
_2 = _1; // scope 0 at $DIR/simple_assign.rs:+7:13: +7:22
|
||||||
|
goto -> bb1; // scope 0 at $DIR/simple_assign.rs:+8:13: +8:23
|
||||||
}
|
}
|
||||||
|
|
||||||
bb1: {
|
bb1: {
|
||||||
_3 = move _2; // scope 0 at $DIR/simple_assign.rs:+11:13: +11:32
|
_3 = move _2; // scope 0 at $DIR/simple_assign.rs:+12:13: +12:32
|
||||||
_0 = _3; // scope 0 at $DIR/simple_assign.rs:+12:13: +12:24
|
StorageDead(_2); // scope 0 at $DIR/simple_assign.rs:+13:13: +13:31
|
||||||
return; // scope 0 at $DIR/simple_assign.rs:+13:13: +13:21
|
_0 = _3; // scope 0 at $DIR/simple_assign.rs:+14:13: +14:24
|
||||||
|
return; // scope 0 at $DIR/simple_assign.rs:+15:13: +15:21
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,11 @@
|
||||||
// Test that encountering closures during coherence does not cause issues.
|
// Test that encountering closures during coherence does not cause issues.
|
||||||
#![feature(type_alias_impl_trait, generators)]
|
#![feature(type_alias_impl_trait, generators)]
|
||||||
|
#![cfg_attr(specialized, feature(specialization))]
|
||||||
|
#![allow(incomplete_features)]
|
||||||
|
|
||||||
|
// revisions: stock specialized
|
||||||
|
// [specialized]check-pass
|
||||||
|
|
||||||
type OpaqueGenerator = impl Sized;
|
type OpaqueGenerator = impl Sized;
|
||||||
fn defining_use() -> OpaqueGenerator {
|
fn defining_use() -> OpaqueGenerator {
|
||||||
|| {
|
|| {
|
||||||
|
@ -13,6 +19,6 @@ struct Wrapper<T>(T);
|
||||||
trait Trait {}
|
trait Trait {}
|
||||||
impl Trait for Wrapper<OpaqueGenerator> {}
|
impl Trait for Wrapper<OpaqueGenerator> {}
|
||||||
impl<T: Sync> Trait for Wrapper<T> {}
|
impl<T: Sync> Trait for Wrapper<T> {}
|
||||||
//~^ ERROR conflicting implementations of trait `Trait` for type `Wrapper<OpaqueGenerator>`
|
//[stock]~^ ERROR conflicting implementations of trait `Trait` for type `Wrapper<OpaqueGenerator>`
|
||||||
|
|
||||||
fn main() {}
|
fn main() {}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
error[E0119]: conflicting implementations of trait `Trait` for type `Wrapper<OpaqueGenerator>`
|
error[E0119]: conflicting implementations of trait `Trait` for type `Wrapper<OpaqueGenerator>`
|
||||||
--> $DIR/coherence-with-generator.rs:15:1
|
--> $DIR/coherence-with-generator.rs:21:1
|
||||||
|
|
|
|
||||||
LL | impl Trait for Wrapper<OpaqueGenerator> {}
|
LL | impl Trait for Wrapper<OpaqueGenerator> {}
|
||||||
| --------------------------------------- first implementation here
|
| --------------------------------------- first implementation here
|
|
@ -0,0 +1,12 @@
|
||||||
|
// check-pass
|
||||||
|
#![feature(generic_const_exprs)]
|
||||||
|
#![allow(incomplete_features)]
|
||||||
|
|
||||||
|
#[derive(Clone)]
|
||||||
|
struct Bar<const A: usize, const B: usize>
|
||||||
|
where
|
||||||
|
[(); A as usize]:,
|
||||||
|
[(); B as usize]:,
|
||||||
|
{}
|
||||||
|
|
||||||
|
fn main() {}
|
7
tests/ui/parser/recover-unticked-labels.fixed
Normal file
7
tests/ui/parser/recover-unticked-labels.fixed
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
// run-rustfix
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
'label: loop { break 'label }; //~ error: cannot find value `label` in this scope
|
||||||
|
'label: loop { break 'label 0 }; //~ error: expected a label, found an identifier
|
||||||
|
'label: loop { continue 'label }; //~ error: expected a label, found an identifier
|
||||||
|
}
|
7
tests/ui/parser/recover-unticked-labels.rs
Normal file
7
tests/ui/parser/recover-unticked-labels.rs
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
// run-rustfix
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
'label: loop { break label }; //~ error: cannot find value `label` in this scope
|
||||||
|
'label: loop { break label 0 }; //~ error: expected a label, found an identifier
|
||||||
|
'label: loop { continue label }; //~ error: expected a label, found an identifier
|
||||||
|
}
|
25
tests/ui/parser/recover-unticked-labels.stderr
Normal file
25
tests/ui/parser/recover-unticked-labels.stderr
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
error: expected a label, found an identifier
|
||||||
|
--> $DIR/recover-unticked-labels.rs:5:26
|
||||||
|
|
|
||||||
|
LL | 'label: loop { break label 0 };
|
||||||
|
| ^^^^^ help: labels start with a tick: `'label`
|
||||||
|
|
||||||
|
error: expected a label, found an identifier
|
||||||
|
--> $DIR/recover-unticked-labels.rs:6:29
|
||||||
|
|
|
||||||
|
LL | 'label: loop { continue label };
|
||||||
|
| ^^^^^ help: labels start with a tick: `'label`
|
||||||
|
|
||||||
|
error[E0425]: cannot find value `label` in this scope
|
||||||
|
--> $DIR/recover-unticked-labels.rs:4:26
|
||||||
|
|
|
||||||
|
LL | 'label: loop { break label };
|
||||||
|
| ------ ^^^^^
|
||||||
|
| | |
|
||||||
|
| | not found in this scope
|
||||||
|
| | help: use the similarly named label: `'label`
|
||||||
|
| a label with a similar name exists
|
||||||
|
|
||||||
|
error: aborting due to 3 previous errors
|
||||||
|
|
||||||
|
For more information about this error, try `rustc --explain E0425`.
|
|
@ -6,4 +6,7 @@ fn main() {
|
||||||
//~^ ERROR unknown start of token: \u{a0}
|
//~^ ERROR unknown start of token: \u{a0}
|
||||||
//~^^ NOTE character appears 3 more times
|
//~^^ NOTE character appears 3 more times
|
||||||
//~^^^ HELP Unicode character ' ' (No-Break Space) looks like ' ' (Space), but it is not
|
//~^^^ HELP Unicode character ' ' (No-Break Space) looks like ' ' (Space), but it is not
|
||||||
|
let _ = 1 ⩵ 2;
|
||||||
|
//~^ ERROR unknown start of token
|
||||||
|
//~^^ HELP Unicode character '⩵' (Two Consecutive Equals Signs) looks like '==' (Double Equals Sign), but it is not
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,5 +21,16 @@ help: Unicode character ' ' (No-Break Space) looks like ' ' (Space), but it is
|
||||||
LL | let x = 0;
|
LL | let x = 0;
|
||||||
| ++++
|
| ++++
|
||||||
|
|
||||||
error: aborting due to 2 previous errors
|
error: unknown start of token: \u{2a75}
|
||||||
|
--> $DIR/unicode-chars.rs:9:15
|
||||||
|
|
|
||||||
|
LL | let _ = 1 ⩵ 2;
|
||||||
|
| ^
|
||||||
|
|
|
||||||
|
help: Unicode character '⩵' (Two Consecutive Equals Signs) looks like '==' (Double Equals Sign), but it is not
|
||||||
|
|
|
||||||
|
LL | let _ = 1 == 2;
|
||||||
|
| ~~
|
||||||
|
|
||||||
|
error: aborting due to 3 previous errors
|
||||||
|
|
||||||
|
|
19
tests/ui/type-alias-impl-trait/issue-104817.rs
Normal file
19
tests/ui/type-alias-impl-trait/issue-104817.rs
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
#![feature(type_alias_impl_trait)]
|
||||||
|
#![cfg_attr(specialized, feature(specialization))]
|
||||||
|
#![allow(incomplete_features)]
|
||||||
|
|
||||||
|
// revisions: stock specialized
|
||||||
|
// [specialized]check-pass
|
||||||
|
|
||||||
|
trait OpaqueTrait {}
|
||||||
|
impl<T> OpaqueTrait for T {}
|
||||||
|
type OpaqueType = impl OpaqueTrait;
|
||||||
|
fn mk_opaque() -> OpaqueType {
|
||||||
|
|| 0
|
||||||
|
}
|
||||||
|
trait AnotherTrait {}
|
||||||
|
impl<T: Send> AnotherTrait for T {}
|
||||||
|
impl AnotherTrait for OpaqueType {}
|
||||||
|
//[stock]~^ conflicting implementations of trait `AnotherTrait` for type `OpaqueType`
|
||||||
|
|
||||||
|
fn main() {}
|
11
tests/ui/type-alias-impl-trait/issue-104817.stock.stderr
Normal file
11
tests/ui/type-alias-impl-trait/issue-104817.stock.stderr
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
error[E0119]: conflicting implementations of trait `AnotherTrait` for type `OpaqueType`
|
||||||
|
--> $DIR/issue-104817.rs:16:1
|
||||||
|
|
|
||||||
|
LL | impl<T: Send> AnotherTrait for T {}
|
||||||
|
| -------------------------------- first implementation here
|
||||||
|
LL | impl AnotherTrait for OpaqueType {}
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `OpaqueType`
|
||||||
|
|
||||||
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
For more information about this error, try `rustc --explain E0119`.
|
Loading…
Add table
Add a link
Reference in a new issue