Auto merge of #140180 - ChrisDenton:rollup-5pvs08u, r=ChrisDenton

Rollup of 7 pull requests

Successful merges:

 - #140142 (Some more graphviz tweaks)
 - #140146 (Update `compiler_builtins` to 0.1.156)
 - #140147 (Clean: rename `open_braces` to `open_delimiters` in lexer and move `make_unclosed_delims_error` into `diagnostics.rs`.)
 - #140160 (Use `is_lang_item` and `as_lang_item` instead of handrolling their logic)
 - #140163 (Validate extension in `PathBuf::add_extension`)
 - #140173 (Ping Mara when touching format_args!() internals.)
 - #140175 (`rc""` more clear error message)

r? `@ghost`
`@rustbot` modify labels: rollup
This commit is contained in:
bors
2025-04-23 15:12:33 +00:00
41 changed files with 374 additions and 356 deletions

View File

@@ -43,11 +43,8 @@ use token_type::TokenTypeSet;
pub use token_type::{ExpKeywordPair, ExpTokenPair, TokenType};
use tracing::debug;
use crate::errors::{
self, IncorrectVisibilityRestriction, MismatchedClosingDelimiter, NonStringAbiLiteral,
};
use crate::errors::{self, IncorrectVisibilityRestriction, NonStringAbiLiteral};
use crate::exp;
use crate::lexer::UnmatchedDelim;
#[cfg(test)]
mod tests;
@@ -1745,27 +1742,6 @@ impl<'a> Parser<'a> {
}
}
pub(crate) fn make_unclosed_delims_error(
unmatched: UnmatchedDelim,
psess: &ParseSess,
) -> Option<Diag<'_>> {
// `None` here means an `Eof` was found. We already emit those errors elsewhere, we add them to
// `unmatched_delims` only for error recovery in the `Parser`.
let found_delim = unmatched.found_delim?;
let mut spans = vec![unmatched.found_span];
if let Some(sp) = unmatched.unclosed_span {
spans.push(sp);
};
let err = psess.dcx().create_err(MismatchedClosingDelimiter {
spans,
delimiter: pprust::token_kind_to_string(&found_delim.as_close_token_kind()).to_string(),
unmatched: unmatched.found_span,
opening_candidate: unmatched.candidate_span,
unclosed: unmatched.unclosed_span,
});
Some(err)
}
/// A helper struct used when building an `AttrTokenStream` from
/// a `LazyAttrTokenStream`. Both delimiter and non-delimited tokens
/// are stored as `FlatToken::Token`. A vector of `FlatToken`s