diff options
Diffstat (limited to 'compiler/rustc_parse/src/lexer/mod.rs')
-rw-r--r-- | compiler/rustc_parse/src/lexer/mod.rs | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/compiler/rustc_parse/src/lexer/mod.rs b/compiler/rustc_parse/src/lexer/mod.rs index f2eed5c9b..a91fbdff4 100644 --- a/compiler/rustc_parse/src/lexer/mod.rs +++ b/compiler/rustc_parse/src/lexer/mod.rs @@ -67,7 +67,7 @@ pub(crate) fn parse_token_trees<'a>( let (stream, res, unmatched_delims) = tokentrees::TokenTreesReader::parse_all_token_trees(string_reader); match res { - Ok(()) if unmatched_delims.is_empty() => Ok(stream), + Ok(_open_spacing) if unmatched_delims.is_empty() => Ok(stream), _ => { // Return error if there are unmatched delimiters or unclosed delimiters. // We emit delimiter mismatch errors first, then emit the unclosing delimiter mismatch @@ -75,7 +75,7 @@ pub(crate) fn parse_token_trees<'a>( let mut buffer = Vec::with_capacity(1); for unmatched in unmatched_delims { - if let Some(err) = make_unclosed_delims_error(unmatched, &sess) { + if let Some(err) = make_unclosed_delims_error(unmatched, sess) { err.buffer(&mut buffer); } } @@ -230,7 +230,7 @@ impl<'a> StringReader<'a> { let string = self.str_from(suffix_start); if string == "_" { self.sess - .span_diagnostic + .dcx .emit_err(errors::UnderscoreLiteralSuffix { span: self.mk_sp(suffix_start, self.pos) }); None } else { @@ -349,7 +349,7 @@ impl<'a> StringReader<'a> { c: char, ) -> DiagnosticBuilder<'a, !> { self.sess - .span_diagnostic + .dcx .struct_span_fatal(self.mk_sp(from_pos, to_pos), format!("{}: {}", m, escaped_char(c))) } @@ -362,7 +362,7 @@ impl<'a> StringReader<'a> { if contains_text_flow_control_chars(content) { let span = self.mk_sp(start, self.pos); self.sess.buffer_lint_with_diagnostic( - &TEXT_DIRECTION_CODEPOINT_IN_COMMENT, + TEXT_DIRECTION_CODEPOINT_IN_COMMENT, span, ast::CRATE_NODE_ID, "unicode codepoint changing visible direction of text present in comment", @@ -406,7 +406,7 @@ impl<'a> StringReader<'a> { match kind { rustc_lexer::LiteralKind::Char { terminated } => { if !terminated { - self.sess.span_diagnostic.span_fatal_with_code( + self.sess.dcx.span_fatal_with_code( self.mk_sp(start, end), "unterminated character literal", error_code!(E0762), @@ -416,7 +416,7 @@ impl<'a> StringReader<'a> { } rustc_lexer::LiteralKind::Byte { terminated } => { if !terminated { - self.sess.span_diagnostic.span_fatal_with_code( + self.sess.dcx.span_fatal_with_code( self.mk_sp(start + BytePos(1), end), "unterminated byte constant", error_code!(E0763), @@ -426,7 +426,7 @@ impl<'a> StringReader<'a> { } rustc_lexer::LiteralKind::Str { terminated } => { if !terminated { - self.sess.span_diagnostic.span_fatal_with_code( + self.sess.dcx.span_fatal_with_code( self.mk_sp(start, end), "unterminated double quote string", error_code!(E0765), @@ -436,7 +436,7 @@ impl<'a> StringReader<'a> { } rustc_lexer::LiteralKind::ByteStr { terminated } => { if !terminated { - self.sess.span_diagnostic.span_fatal_with_code( + self.sess.dcx.span_fatal_with_code( self.mk_sp(start + BytePos(1), end), "unterminated double quote byte string", error_code!(E0766), @@ -446,7 +446,7 @@ impl<'a> StringReader<'a> { } rustc_lexer::LiteralKind::CStr { terminated } => { if !terminated { - self.sess.span_diagnostic.span_fatal_with_code( + self.sess.dcx.span_fatal_with_code( self.mk_sp(start + BytePos(1), end), "unterminated C string", error_code!(E0767), @@ -581,7 +581,7 @@ impl<'a> StringReader<'a> { possible_offset: Option<u32>, found_terminators: u32, ) -> ! { - let mut err = self.sess.span_diagnostic.struct_span_fatal_with_code( + let mut err = self.sess.dcx.struct_span_fatal_with_code( self.mk_sp(start, start), "unterminated raw string", error_code!(E0748), @@ -617,7 +617,7 @@ impl<'a> StringReader<'a> { None => "unterminated block comment", }; let last_bpos = self.pos; - let mut err = self.sess.span_diagnostic.struct_span_fatal_with_code( + let mut err = self.sess.dcx.struct_span_fatal_with_code( self.mk_sp(start, last_bpos), msg, error_code!(E0758), @@ -683,7 +683,7 @@ impl<'a> StringReader<'a> { } else { // Before Rust 2021, only emit a lint for migration. self.sess.buffer_lint_with_diagnostic( - &RUST_2021_PREFIXES_INCOMPATIBLE_SYNTAX, + RUST_2021_PREFIXES_INCOMPATIBLE_SYNTAX, prefix_span, ast::CRATE_NODE_ID, format!("prefix `{prefix}` is unknown"), @@ -722,7 +722,7 @@ impl<'a> StringReader<'a> { has_fatal_err = true; } emit_unescape_error( - &self.sess.span_diagnostic, + &self.sess.dcx, lit_content, span_with_quotes, span, |