Auto merge of #150784 - Kobzol:rollup-0mvdoy5, r=Kobzol

Rollup of 4 pull requests

Successful merges:

 - rust-lang/rust#150738 (Factorize `triagebot.toml` float parsing mentions with a glob matching)
 - rust-lang/rust#150761 (rustc book: fix grammar)
 - rust-lang/rust#150764 (Convert static lifetime to an nll var)
 - rust-lang/rust#150775 (Move issue-12660 to 'ui/cross-crate/ with a descriptive name)

r? @ghost
This commit is contained in:
rust-bors[bot] 2026-01-07 23:59:12 +00:00 committed by GitHub
commit 548e586795
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 64 additions and 12 deletions

View file

@ -5658,6 +5658,7 @@ dependencies = [
"build_helper", "build_helper",
"cargo_metadata 0.21.0", "cargo_metadata 0.21.0",
"fluent-syntax", "fluent-syntax",
"globset",
"ignore", "ignore",
"miropt-test-tools", "miropt-test-tools",
"regex", "regex",

View file

@ -1581,12 +1581,18 @@ impl<'a, 'tcx> Visitor<'tcx> for TypeChecker<'a, 'tcx> {
.unwrap(); .unwrap();
} }
(None, None) => { (None, None) => {
// `struct_tail` returns regions which haven't been mapped
// to nll vars yet so we do it here as `outlives_constraints`
// expects nll vars.
let src_lt = self.universal_regions.to_region_vid(src_lt);
let dst_lt = self.universal_regions.to_region_vid(dst_lt);
// The principalless (no non-auto traits) case: // The principalless (no non-auto traits) case:
// You can only cast `dyn Send + 'long` to `dyn Send + 'short`. // You can only cast `dyn Send + 'long` to `dyn Send + 'short`.
self.constraints.outlives_constraints.push( self.constraints.outlives_constraints.push(
OutlivesConstraint { OutlivesConstraint {
sup: src_lt.as_var(), sup: src_lt,
sub: dst_lt.as_var(), sub: dst_lt,
locations: location.to_locations(), locations: location.to_locations(),
span: location.to_locations().span(self.body), span: location.to_locations().span(self.body),
category: ConstraintCategory::Cast { category: ConstraintCategory::Cast {

View file

@ -3,7 +3,7 @@
`rustc` supports remapping source paths prefixes **as a best effort** in all compiler generated `rustc` supports remapping source paths prefixes **as a best effort** in all compiler generated
output, including compiler diagnostics, debugging information, macro expansions, etc. output, including compiler diagnostics, debugging information, macro expansions, etc.
This is useful for normalizing build products, for example by removing the current directory This is useful for normalizing build products, for example, by removing the current directory
out of the paths emitted into object files. out of the paths emitted into object files.
The remapping is done via the `--remap-path-prefix` option. The remapping is done via the `--remap-path-prefix` option.
@ -41,7 +41,7 @@ This example replaces all occurrences of `/home/user/project` in emitted paths w
## Caveats and Limitations ## Caveats and Limitations
### Linkers generated paths ### Paths generated by linkers
On some platforms like `x86_64-pc-windows-msvc`, the linker may embed absolute host paths and compiler On some platforms like `x86_64-pc-windows-msvc`, the linker may embed absolute host paths and compiler
arguments into debug info files (like `.pdb`) independently of `rustc`. arguments into debug info files (like `.pdb`) independently of `rustc`.
@ -54,7 +54,7 @@ The `--remap-path-prefix` option does not affect these linker-generated paths.
### Textual replacement only ### Textual replacement only
The remapping is strictly textual and does not account for different path separator conventions across The remapping is strictly textual and does not account for different path separator conventions across
platforms. Care must be taken when specifying prefixes, especially on Windows where both `/` and `\` may platforms. Care must be taken when specifying prefixes, especially on Windows, where both `/` and `\` may
appear in paths. appear in paths.
### External tools ### External tools

View file

@ -8,6 +8,7 @@ autobins = false
build_helper = { path = "../../build_helper" } build_helper = { path = "../../build_helper" }
cargo_metadata = "0.21" cargo_metadata = "0.21"
regex = "1" regex = "1"
globset = "0.4.18"
miropt-test-tools = { path = "../miropt-test-tools" } miropt-test-tools = { path = "../miropt-test-tools" }
walkdir = "2" walkdir = "2"
ignore = "0.4.18" ignore = "0.4.18"

View file

@ -1,5 +1,6 @@
//! Tidy check to ensure paths mentioned in triagebot.toml exist in the project. //! Tidy check to ensure paths mentioned in triagebot.toml exist in the project.
use std::collections::HashSet;
use std::path::Path; use std::path::Path;
use toml::Value; use toml::Value;
@ -22,6 +23,9 @@ pub fn check(path: &Path, tidy_ctx: TidyCtx) {
// Check [mentions."*"] sections, i.e. [mentions."compiler/rustc_const_eval/src/"] // Check [mentions."*"] sections, i.e. [mentions."compiler/rustc_const_eval/src/"]
if let Some(Value::Table(mentions)) = config.get("mentions") { if let Some(Value::Table(mentions)) = config.get("mentions") {
let mut builder = globset::GlobSetBuilder::new();
let mut glob_entries = Vec::new();
for (entry_key, entry_val) in mentions.iter() { for (entry_key, entry_val) in mentions.iter() {
// If the type is set to something other than "filename", then this is not a path. // If the type is set to something other than "filename", then this is not a path.
if entry_val.get("type").is_some_and(|t| t.as_str().unwrap_or_default() != "filename") { if entry_val.get("type").is_some_and(|t| t.as_str().unwrap_or_default() != "filename") {
@ -33,8 +37,37 @@ pub fn check(path: &Path, tidy_ctx: TidyCtx) {
let full_path = path.join(clean_path); let full_path = path.join(clean_path);
if !full_path.exists() { if !full_path.exists() {
// The full-path doesn't exists, maybe it's a glob, let's add it to the glob set builder
// to be checked against all the file and directories in the repository.
builder.add(globset::Glob::new(&format!("{clean_path}*")).unwrap());
glob_entries.push(clean_path.to_string());
}
}
let gs = builder.build().unwrap();
let mut found = HashSet::new();
let mut matches = Vec::new();
// Walk the entire repository and match any entry against the remaining paths
for entry in ignore::WalkBuilder::new(path).build().flatten() {
// Strip the prefix as mentions entries are always relative to the repo
let entry_path = entry.path().strip_prefix(path).unwrap();
// Find the matches and add them to the found set
gs.matches_into(entry_path, &mut matches);
found.extend(matches.iter().copied());
// Early-exist if all the globs have been matched
if found.len() == glob_entries.len() {
break;
}
}
for (i, clean_path) in glob_entries.iter().enumerate() {
if !found.contains(&i) {
check.error(format!( check.error(format!(
"triagebot.toml [mentions.*] contains path '{clean_path}' which doesn't exist" "triagebot.toml [mentions.*] contains '{clean_path}' which doesn't match any file or directory in the repository"
)); ));
} }
} }

View file

@ -0,0 +1,15 @@
//@ check-pass
// During MIR typeck when casting `*mut dyn Sync + '?x` to
// `*mut Wrap` we compute the tail of `Wrap` as `dyn Sync + 'static`.
//
// This test ensures that we first convert the `'static` lifetime to
// the nll var `'?0` before introducing the region constraint `'?x: 'static`.
struct Wrap(dyn Sync + 'static);
fn cast(x: *mut (dyn Sync + 'static)) {
x as *mut Wrap;
}
fn main() {}

View file

@ -1,5 +1,5 @@
//@ run-pass //@ run-pass
//@ aux-build:issue-12660-aux.rs //@ aux-build:aux-12660.rs
extern crate issue12660aux; extern crate issue12660aux;

View file

@ -1059,14 +1059,10 @@ gets adapted for the changes, if necessary.
""" """
cc = ["@rust-lang/miri", "@RalfJung", "@oli-obk", "@lcnr"] cc = ["@rust-lang/miri", "@RalfJung", "@oli-obk", "@lcnr"]
[mentions."library/core/src/num/dec2flt"] [mentions."library/core/src/num/{dec2flt,flt2dec}"]
message = "Some changes occurred in float parsing" message = "Some changes occurred in float parsing"
cc = ["@tgross35"] cc = ["@tgross35"]
[mentions."library/core/src/num/flt2dec"]
message = "Some changes occurred in float printing"
cc = ["@tgross35"]
[mentions."library/core/src/fmt/num.rs"] [mentions."library/core/src/fmt/num.rs"]
message = "Some changes occurred in integer formatting" message = "Some changes occurred in integer formatting"
cc = ["@tgross35"] cc = ["@tgross35"]