Skip to content

Commit 548e586

Browse files
Auto merge of rust-lang#150784 - Kobzol:rollup-0mvdoy5, r=Kobzol
Rollup of 4 pull requests Successful merges: - rust-lang#150738 (Factorize `triagebot.toml` float parsing mentions with a glob matching) - rust-lang#150761 (rustc book: fix grammar) - rust-lang#150764 (Convert static lifetime to an nll var) - rust-lang#150775 (Move issue-12660 to 'ui/cross-crate/ with a descriptive name) r? @ghost
2 parents fecb335 + beb734b commit 548e586

File tree

9 files changed

+64
-12
lines changed

9 files changed

+64
-12
lines changed

Cargo.lock

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5658,6 +5658,7 @@ dependencies = [
56585658
"build_helper",
56595659
"cargo_metadata 0.21.0",
56605660
"fluent-syntax",
5661+
"globset",
56615662
"ignore",
56625663
"miropt-test-tools",
56635664
"regex",

compiler/rustc_borrowck/src/type_check/mod.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1581,12 +1581,18 @@ impl<'a, 'tcx> Visitor<'tcx> for TypeChecker<'a, 'tcx> {
15811581
.unwrap();
15821582
}
15831583
(None, None) => {
1584+
// `struct_tail` returns regions which haven't been mapped
1585+
// to nll vars yet so we do it here as `outlives_constraints`
1586+
// expects nll vars.
1587+
let src_lt = self.universal_regions.to_region_vid(src_lt);
1588+
let dst_lt = self.universal_regions.to_region_vid(dst_lt);
1589+
15841590
// The principalless (no non-auto traits) case:
15851591
// You can only cast `dyn Send + 'long` to `dyn Send + 'short`.
15861592
self.constraints.outlives_constraints.push(
15871593
OutlivesConstraint {
1588-
sup: src_lt.as_var(),
1589-
sub: dst_lt.as_var(),
1594+
sup: src_lt,
1595+
sub: dst_lt,
15901596
locations: location.to_locations(),
15911597
span: location.to_locations().span(self.body),
15921598
category: ConstraintCategory::Cast {

src/doc/rustc/src/remap-source-paths.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
`rustc` supports remapping source paths prefixes **as a best effort** in all compiler generated
44
output, including compiler diagnostics, debugging information, macro expansions, etc.
55

6-
This is useful for normalizing build products, for example by removing the current directory
6+
This is useful for normalizing build products, for example, by removing the current directory
77
out of the paths emitted into object files.
88

99
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
4141

4242
## Caveats and Limitations
4343

44-
### Linkers generated paths
44+
### Paths generated by linkers
4545

4646
On some platforms like `x86_64-pc-windows-msvc`, the linker may embed absolute host paths and compiler
4747
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.
5454
### Textual replacement only
5555

5656
The remapping is strictly textual and does not account for different path separator conventions across
57-
platforms. Care must be taken when specifying prefixes, especially on Windows where both `/` and `\` may
57+
platforms. Care must be taken when specifying prefixes, especially on Windows, where both `/` and `\` may
5858
appear in paths.
5959

6060
### External tools

src/tools/tidy/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ autobins = false
88
build_helper = { path = "../../build_helper" }
99
cargo_metadata = "0.21"
1010
regex = "1"
11+
globset = "0.4.18"
1112
miropt-test-tools = { path = "../miropt-test-tools" }
1213
walkdir = "2"
1314
ignore = "0.4.18"

src/tools/tidy/src/triagebot.rs

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
//! Tidy check to ensure paths mentioned in triagebot.toml exist in the project.
22
3+
use std::collections::HashSet;
34
use std::path::Path;
45

56
use toml::Value;
@@ -22,6 +23,9 @@ pub fn check(path: &Path, tidy_ctx: TidyCtx) {
2223

2324
// Check [mentions."*"] sections, i.e. [mentions."compiler/rustc_const_eval/src/"]
2425
if let Some(Value::Table(mentions)) = config.get("mentions") {
26+
let mut builder = globset::GlobSetBuilder::new();
27+
let mut glob_entries = Vec::new();
28+
2529
for (entry_key, entry_val) in mentions.iter() {
2630
// If the type is set to something other than "filename", then this is not a path.
2731
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) {
3337
let full_path = path.join(clean_path);
3438

3539
if !full_path.exists() {
40+
// The full-path doesn't exists, maybe it's a glob, let's add it to the glob set builder
41+
// to be checked against all the file and directories in the repository.
42+
builder.add(globset::Glob::new(&format!("{clean_path}*")).unwrap());
43+
glob_entries.push(clean_path.to_string());
44+
}
45+
}
46+
47+
let gs = builder.build().unwrap();
48+
49+
let mut found = HashSet::new();
50+
let mut matches = Vec::new();
51+
52+
// Walk the entire repository and match any entry against the remaining paths
53+
for entry in ignore::WalkBuilder::new(path).build().flatten() {
54+
// Strip the prefix as mentions entries are always relative to the repo
55+
let entry_path = entry.path().strip_prefix(path).unwrap();
56+
57+
// Find the matches and add them to the found set
58+
gs.matches_into(entry_path, &mut matches);
59+
found.extend(matches.iter().copied());
60+
61+
// Early-exist if all the globs have been matched
62+
if found.len() == glob_entries.len() {
63+
break;
64+
}
65+
}
66+
67+
for (i, clean_path) in glob_entries.iter().enumerate() {
68+
if !found.contains(&i) {
3669
check.error(format!(
37-
"triagebot.toml [mentions.*] contains path '{clean_path}' which doesn't exist"
70+
"triagebot.toml [mentions.*] contains '{clean_path}' which doesn't match any file or directory in the repository"
3871
));
3972
}
4073
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
//@ check-pass
2+
3+
// During MIR typeck when casting `*mut dyn Sync + '?x` to
4+
// `*mut Wrap` we compute the tail of `Wrap` as `dyn Sync + 'static`.
5+
//
6+
// This test ensures that we first convert the `'static` lifetime to
7+
// the nll var `'?0` before introducing the region constraint `'?x: 'static`.
8+
9+
struct Wrap(dyn Sync + 'static);
10+
11+
fn cast(x: *mut (dyn Sync + 'static)) {
12+
x as *mut Wrap;
13+
}
14+
15+
fn main() {}
File renamed without changes.

tests/ui/issues/issue-12660.rs renamed to tests/ui/cross-crate/cross-crate-unit-struct-reexport.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//@ run-pass
2-
//@ aux-build:issue-12660-aux.rs
2+
//@ aux-build:aux-12660.rs
33

44

55
extern crate issue12660aux;

triagebot.toml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1059,14 +1059,10 @@ gets adapted for the changes, if necessary.
10591059
"""
10601060
cc = ["@rust-lang/miri", "@RalfJung", "@oli-obk", "@lcnr"]
10611061

1062-
[mentions."library/core/src/num/dec2flt"]
1062+
[mentions."library/core/src/num/{dec2flt,flt2dec}"]
10631063
message = "Some changes occurred in float parsing"
10641064
cc = ["@tgross35"]
10651065

1066-
[mentions."library/core/src/num/flt2dec"]
1067-
message = "Some changes occurred in float printing"
1068-
cc = ["@tgross35"]
1069-
10701066
[mentions."library/core/src/fmt/num.rs"]
10711067
message = "Some changes occurred in integer formatting"
10721068
cc = ["@tgross35"]

0 commit comments

Comments
 (0)