diff options
| author | bors <bors@rust-lang.org> | 2021-11-25 08:16:08 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2021-11-25 08:16:08 +0000 |
| commit | 23a436606b118bd2fbb12f64fce21e7f9d355349 (patch) | |
| tree | f7cdcfcb705dc416fd967deb4e89ad3184f282c4 /compiler/rustc_session/src | |
| parent | c6eda7d8a7af3ef51311d3106874a7d8de994edc (diff) | |
| parent | d92916439c372967e4c12b7ece3c8d7e860a8777 (diff) | |
| download | rust-23a436606b118bd2fbb12f64fce21e7f9d355349.tar.gz rust-23a436606b118bd2fbb12f64fce21e7f9d355349.zip | |
Auto merge of #88781 - estebank:emoji-idents, r=oli-obk
Tokenize emoji as if they were valid identifiers In the lexer, consider emojis to be valid identifiers and reject them later to avoid knock down parse errors. Partially address #86102.
Diffstat (limited to 'compiler/rustc_session/src')
| -rw-r--r-- | compiler/rustc_session/src/parse.rs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/compiler/rustc_session/src/parse.rs b/compiler/rustc_session/src/parse.rs index f7246641dca..d5b520325e5 100644 --- a/compiler/rustc_session/src/parse.rs +++ b/compiler/rustc_session/src/parse.rs @@ -119,8 +119,13 @@ pub struct ParseSess { pub config: CrateConfig, pub edition: Edition, pub missing_fragment_specifiers: Lock<FxHashMap<Span, NodeId>>, - /// Places where raw identifiers were used. This is used for feature-gating raw identifiers. + /// Places where raw identifiers were used. This is used to avoid complaining about idents + /// clashing with keywords in new editions. pub raw_identifier_spans: Lock<Vec<Span>>, + /// Places where identifiers that contain invalid Unicode codepoints but that look like they + /// should be. Useful to avoid bad tokenization when encountering emoji. We group them to + /// provide a single error per unique incorrect identifier. + pub bad_unicode_identifiers: Lock<FxHashMap<Symbol, Vec<Span>>>, source_map: Lrc<SourceMap>, pub buffered_lints: Lock<Vec<BufferedEarlyLint>>, /// Contains the spans of block expressions that could have been incomplete based on the @@ -160,6 +165,7 @@ impl ParseSess { edition: ExpnId::root().expn_data().edition, missing_fragment_specifiers: Default::default(), raw_identifier_spans: Lock::new(Vec::new()), + bad_unicode_identifiers: Lock::new(Default::default()), source_map, buffered_lints: Lock::new(vec![]), ambiguous_block_expr_parse: Lock::new(FxHashMap::default()), |
