Skip to content

Commit ef8ee73

Browse files
committed
Auto merge of #112494 - matthiaskrgr:rollup-xdf3om8, r=matthiaskrgr
Rollup of 5 pull requests Successful merges: - #112297 (bootstrap: Disallow `--exclude test::std`) - #112298 (Update field-offset and enable unstable_offset_of) - #112335 (ci: Upgrade loongarch64-linux-gnu GCC to 13.1.0) - #112413 (Adjust span labels for `HIDDEN_GLOB_REEXPORTS`) - #112483 (Add deprecation warning to python versions <3.6 in x.py) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 788c98d + 68e162d commit ef8ee73

File tree

13 files changed

+104
-86
lines changed

13 files changed

+104
-86
lines changed

Cargo.lock

+14-5
Original file line numberDiff line numberDiff line change
@@ -848,7 +848,7 @@ dependencies = [
848848
"autocfg",
849849
"cfg-if",
850850
"crossbeam-utils",
851-
"memoffset",
851+
"memoffset 0.8.0",
852852
"scopeguard",
853853
]
854854

@@ -1193,11 +1193,11 @@ dependencies = [
11931193

11941194
[[package]]
11951195
name = "field-offset"
1196-
version = "0.3.5"
1196+
version = "0.3.6"
11971197
source = "registry+https://github.com/rust-lang/crates.io-index"
1198-
checksum = "a3cf3a800ff6e860c863ca6d4b16fd999db8b752819c1606884047b73e468535"
1198+
checksum = "38e2275cc4e4fc009b0669731a1e5ab7ebf11f469eaede2bab9309a5b4d6057f"
11991199
dependencies = [
1200-
"memoffset",
1200+
"memoffset 0.9.0",
12011201
"rustc_version",
12021202
]
12031203

@@ -2145,6 +2145,15 @@ dependencies = [
21452145
"autocfg",
21462146
]
21472147

2148+
[[package]]
2149+
name = "memoffset"
2150+
version = "0.9.0"
2151+
source = "registry+https://github.com/rust-lang/crates.io-index"
2152+
checksum = "5a634b1c61a95585bd15607c6ab0c4e5b226e695ff2800ba0cdccddf208c406c"
2153+
dependencies = [
2154+
"autocfg",
2155+
]
2156+
21482157
[[package]]
21492158
name = "mime"
21502159
version = "0.3.16"
@@ -3976,7 +3985,7 @@ version = "0.0.0"
39763985
dependencies = [
39773986
"field-offset",
39783987
"measureme",
3979-
"memoffset",
3988+
"memoffset 0.9.0",
39803989
"rustc-rayon-core",
39813990
"rustc_ast",
39823991
"rustc_data_structures",

compiler/rustc_lint/src/context.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -953,8 +953,8 @@ pub trait LintContext: Sized {
953953
db.span_label(duplicate_reexport_span, format!("but the name `{}` in the {} namespace is also re-exported here", name, namespace));
954954
}
955955
BuiltinLintDiagnostics::HiddenGlobReexports { name, namespace, glob_reexport_span, private_item_span } => {
956-
db.span_label(glob_reexport_span, format!("the name `{}` in the {} namespace is supposed to be publicly re-exported here", name, namespace));
957-
db.span_label(private_item_span, "but the private item here shadows it");
956+
db.span_note(glob_reexport_span, format!("the name `{}` in the {} namespace is supposed to be publicly re-exported here", name, namespace));
957+
db.span_note(private_item_span, "but the private item here shadows it".to_owned());
958958
}
959959
}
960960
// Rewrap `db`, and pass control to the user.

compiler/rustc_query_impl/Cargo.toml

+3-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ edition = "2021"
77

88

99
[dependencies]
10-
memoffset = { version = "0.8.0", features = ["unstable_const"] }
1110
field-offset = "0.3.5"
1211
measureme = "10.0.0"
1312
rustc_ast = { path = "../rustc_ast" }
@@ -25,5 +24,8 @@ rustc_span = { path = "../rustc_span" }
2524
thin-vec = "0.2.12"
2625
tracing = "0.1"
2726

27+
# Not used directly, but included to enable the unstable_offset_of feature
28+
memoffset = { version = "0.9.0", features = ["unstable_offset_of"] }
29+
2830
[features]
2931
rustc_use_parallel_compiler = ["rustc-rayon-core", "rustc_query_system/rustc_use_parallel_compiler"]

src/bootstrap/CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
1818
- `x.py fmt` now formats only files modified between the merge-base of HEAD and the last commit in the master branch of the rust-lang repository and the current working directory. To restore old behaviour, use `x.py fmt .`. The check mode is not affected by this change. [#105702](https://github.com/rust-lang/rust/pull/105702)
1919
- The `llvm.version-check` config option has been removed. Older versions were never supported. If you still need to support older versions (e.g. you are applying custom patches), patch `check_llvm_version` in bootstrap to change the minimum version. [#108619](https://github.com/rust-lang/rust/pull/108619)
2020
- The `rust.ignore-git` option has been renamed to `rust.omit-git-hash`. [#110059](https://github.com/rust-lang/rust/pull/110059)
21+
- `--exclude` no longer accepts a `Kind` as part of a Step; instead it uses the top-level Kind of the subcommand. If this matches how you were already using --exclude (e.g. `x test --exclude test::std`), simply remove the kind: `--exclude std`. If you were using a kind that did not match the top-level subcommand, please open an issue explaining why you wanted this feature.
2122

2223
### Non-breaking changes
2324

src/bootstrap/builder.rs

+9-36
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use std::fs::{self, File};
88
use std::hash::Hash;
99
use std::io::{BufRead, BufReader};
1010
use std::ops::Deref;
11-
use std::path::{Component, Path, PathBuf};
11+
use std::path::{Path, PathBuf};
1212
use std::process::Command;
1313
use std::time::{Duration, Instant};
1414

@@ -150,29 +150,6 @@ pub struct TaskPath {
150150
pub kind: Option<Kind>,
151151
}
152152

153-
impl TaskPath {
154-
pub fn parse(path: impl Into<PathBuf>) -> TaskPath {
155-
let mut kind = None;
156-
let mut path = path.into();
157-
158-
let mut components = path.components();
159-
if let Some(Component::Normal(os_str)) = components.next() {
160-
if let Some(str) = os_str.to_str() {
161-
if let Some((found_kind, found_prefix)) = str.split_once("::") {
162-
if found_kind.is_empty() {
163-
panic!("empty kind in task path {}", path.display());
164-
}
165-
kind = Kind::parse(found_kind);
166-
assert!(kind.is_some());
167-
path = Path::new(found_prefix).join(components.as_path());
168-
}
169-
}
170-
}
171-
172-
TaskPath { path, kind }
173-
}
174-
}
175-
176153
impl Debug for TaskPath {
177154
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
178155
if let Some(kind) = &self.kind {
@@ -216,17 +193,17 @@ impl PathSet {
216193
PathSet::Set(set)
217194
}
218195

219-
fn has(&self, needle: &Path, module: Option<Kind>) -> bool {
196+
fn has(&self, needle: &Path, module: Kind) -> bool {
220197
match self {
221198
PathSet::Set(set) => set.iter().any(|p| Self::check(p, needle, module)),
222199
PathSet::Suite(suite) => Self::check(suite, needle, module),
223200
}
224201
}
225202

226203
// internal use only
227-
fn check(p: &TaskPath, needle: &Path, module: Option<Kind>) -> bool {
228-
if let (Some(p_kind), Some(kind)) = (&p.kind, module) {
229-
p.path.ends_with(needle) && *p_kind == kind
204+
fn check(p: &TaskPath, needle: &Path, module: Kind) -> bool {
205+
if let Some(p_kind) = &p.kind {
206+
p.path.ends_with(needle) && *p_kind == module
230207
} else {
231208
p.path.ends_with(needle)
232209
}
@@ -238,11 +215,7 @@ impl PathSet {
238215
/// This is used for `StepDescription::krate`, which passes all matching crates at once to
239216
/// `Step::make_run`, rather than calling it many times with a single crate.
240217
/// See `tests.rs` for examples.
241-
fn intersection_removing_matches(
242-
&self,
243-
needles: &mut Vec<&Path>,
244-
module: Option<Kind>,
245-
) -> PathSet {
218+
fn intersection_removing_matches(&self, needles: &mut Vec<&Path>, module: Kind) -> PathSet {
246219
let mut check = |p| {
247220
for (i, n) in needles.iter().enumerate() {
248221
let matched = Self::check(p, n, module);
@@ -307,7 +280,7 @@ impl StepDescription {
307280
}
308281

309282
fn is_excluded(&self, builder: &Builder<'_>, pathset: &PathSet) -> bool {
310-
if builder.config.exclude.iter().any(|e| pathset.has(&e.path, e.kind)) {
283+
if builder.config.exclude.iter().any(|e| pathset.has(&e, builder.kind)) {
311284
println!("Skipping {:?} because it is excluded", pathset);
312285
return true;
313286
}
@@ -562,7 +535,7 @@ impl<'a> ShouldRun<'a> {
562535
) -> Vec<PathSet> {
563536
let mut sets = vec![];
564537
for pathset in &self.paths {
565-
let subset = pathset.intersection_removing_matches(paths, Some(kind));
538+
let subset = pathset.intersection_removing_matches(paths, kind);
566539
if subset != PathSet::empty() {
567540
sets.push(subset);
568541
}
@@ -2138,7 +2111,7 @@ impl<'a> Builder<'a> {
21382111
let should_run = (desc.should_run)(ShouldRun::new(self, desc.kind));
21392112

21402113
for path in &self.paths {
2141-
if should_run.paths.iter().any(|s| s.has(path, Some(desc.kind)))
2114+
if should_run.paths.iter().any(|s| s.has(path, desc.kind))
21422115
&& !desc.is_excluded(
21432116
self,
21442117
&PathSet::Suite(TaskPath { path: path.clone(), kind: Some(desc.kind) }),

src/bootstrap/builder/tests.rs

+15-22
Original file line numberDiff line numberDiff line change
@@ -101,23 +101,21 @@ fn test_invalid() {
101101

102102
#[test]
103103
fn test_intersection() {
104-
let set = PathSet::Set(
105-
["library/core", "library/alloc", "library/std"].into_iter().map(TaskPath::parse).collect(),
106-
);
104+
let set = |paths: &[&str]| {
105+
PathSet::Set(paths.into_iter().map(|p| TaskPath { path: p.into(), kind: None }).collect())
106+
};
107+
let library_set = set(&["library/core", "library/alloc", "library/std"]);
107108
let mut command_paths =
108109
vec![Path::new("library/core"), Path::new("library/alloc"), Path::new("library/stdarch")];
109-
let subset = set.intersection_removing_matches(&mut command_paths, None);
110-
assert_eq!(
111-
subset,
112-
PathSet::Set(["library/core", "library/alloc"].into_iter().map(TaskPath::parse).collect())
113-
);
110+
let subset = library_set.intersection_removing_matches(&mut command_paths, Kind::Build);
111+
assert_eq!(subset, set(&["library/core", "library/alloc"]),);
114112
assert_eq!(command_paths, vec![Path::new("library/stdarch")]);
115113
}
116114

117115
#[test]
118116
fn test_exclude() {
119117
let mut config = configure("test", &["A"], &["A"]);
120-
config.exclude = vec![TaskPath::parse("src/tools/tidy")];
118+
config.exclude = vec!["src/tools/tidy".into()];
121119
let cache = run_build(&[], config);
122120

123121
// Ensure we have really excluded tidy
@@ -129,21 +127,16 @@ fn test_exclude() {
129127

130128
#[test]
131129
fn test_exclude_kind() {
132-
let path = PathBuf::from("src/tools/cargotest");
133-
let exclude = TaskPath::parse("test::src/tools/cargotest");
134-
assert_eq!(exclude, TaskPath { kind: Some(Kind::Test), path: path.clone() });
130+
let path = PathBuf::from("compiler/rustc_data_structures");
135131

136132
let mut config = configure("test", &["A"], &["A"]);
137-
// Ensure our test is valid, and `test::Cargotest` would be run without the exclude.
138-
assert!(run_build(&[path.clone()], config.clone()).contains::<test::Cargotest>());
139-
// Ensure tests for cargotest are skipped.
140-
config.exclude = vec![exclude.clone()];
141-
assert!(!run_build(&[path.clone()], config).contains::<test::Cargotest>());
142-
143-
// Ensure builds for cargotest are not skipped.
144-
let mut config = configure("build", &["A"], &["A"]);
145-
config.exclude = vec![exclude];
146-
assert!(run_build(&[path], config).contains::<tool::CargoTest>());
133+
// Ensure our test is valid, and `test::Rustc` would be run without the exclude.
134+
assert!(run_build(&[], config.clone()).contains::<test::CrateLibrustc>());
135+
// Ensure tests for rustc are skipped.
136+
config.exclude = vec![path.clone()];
137+
assert!(!run_build(&[], config.clone()).contains::<test::CrateLibrustc>());
138+
// Ensure builds for rustc are not skipped.
139+
assert!(run_build(&[], config).contains::<compile::Rustc>());
147140
}
148141

149142
/// Ensure that if someone passes both a single crate and `library`, all library crates get built.

src/bootstrap/config.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ use std::path::{Path, PathBuf};
1717
use std::process::Command;
1818
use std::str::FromStr;
1919

20-
use crate::builder::TaskPath;
2120
use crate::cache::{Interned, INTERNER};
2221
use crate::cc_detect::{ndk_compiler, Language};
2322
use crate::channel::{self, GitInfo};
@@ -80,7 +79,7 @@ pub struct Config {
8079
pub sanitizers: bool,
8180
pub profiler: bool,
8281
pub omit_git_hash: bool,
83-
pub exclude: Vec<TaskPath>,
82+
pub exclude: Vec<PathBuf>,
8483
pub include_default_paths: bool,
8584
pub rustc_error_format: Option<String>,
8685
pub json_output: bool,
@@ -957,7 +956,7 @@ impl Config {
957956

958957
// Set flags.
959958
config.paths = std::mem::take(&mut flags.paths);
960-
config.exclude = flags.exclude.into_iter().map(|path| TaskPath::parse(path)).collect();
959+
config.exclude = flags.exclude;
961960
config.include_default_paths = flags.include_default_paths;
962961
config.rustc_error_format = flags.rustc_error_format;
963962
config.json_output = flags.json_output;

src/bootstrap/test.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1537,7 +1537,7 @@ note: if you're sure you want to do this, please open an issue as to why. In the
15371537

15381538
for exclude in &builder.config.exclude {
15391539
cmd.arg("--skip");
1540-
cmd.arg(&exclude.path);
1540+
cmd.arg(&exclude);
15411541
}
15421542

15431543
// Get paths from cmd args

src/ci/docker/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ For targets: `loongarch64-unknown-linux-gnu`
270270
- Operating System > Linux kernel version = 5.19.16
271271
- Binary utilities > Version of binutils = 2.40
272272
- C-library > glibc version = 2.36
273-
- C compiler > gcc version = 12.2.0
273+
- C compiler > gcc version = 13.1.0
274274
- C compiler > C++ = ENABLE -- to cross compile LLVM
275275
276276
### `mips-linux-gnu.defconfig`

src/ci/docker/scripts/crosstool-ng-git.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
set -ex
33

44
URL=https://github.com/crosstool-ng/crosstool-ng
5-
REV=943364711a650d9b9e84c1b42c91cc0265b6ab5c
5+
REV=227d99d7f3115f3a078595a580d2b307dcd23e93
66

77
mkdir crosstool-ng
88
cd crosstool-ng

tests/ui/resolve/hidden_glob_reexports.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ pub mod upstream_a {
66
pub struct Bar {}
77
}
88

9-
pub use self::inner::*;
10-
119
struct Foo;
1210
//~^ WARN private item shadows public glob re-export
11+
12+
pub use self::inner::*;
1313
}
1414

1515
pub mod upstream_b {
+34-11
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,54 @@
11
warning: private item shadows public glob re-export
2-
--> $DIR/hidden_glob_reexports.rs:11:5
2+
--> $DIR/hidden_glob_reexports.rs:9:5
33
|
4-
LL | pub use self::inner::*;
5-
| -------------- the name `Foo` in the type namespace is supposed to be publicly re-exported here
6-
LL |
74
LL | struct Foo;
8-
| ^^^^^^^^^^^ but the private item here shadows it
5+
| ^^^^^^^^^^^
6+
|
7+
note: the name `Foo` in the type namespace is supposed to be publicly re-exported here
8+
--> $DIR/hidden_glob_reexports.rs:12:13
9+
|
10+
LL | pub use self::inner::*;
11+
| ^^^^^^^^^^^^^^
12+
note: but the private item here shadows it
13+
--> $DIR/hidden_glob_reexports.rs:9:5
914
|
15+
LL | struct Foo;
16+
| ^^^^^^^^^^^
1017
= note: `#[warn(hidden_glob_reexports)]` on by default
1118

1219
warning: private item shadows public glob re-export
1320
--> $DIR/hidden_glob_reexports.rs:27:9
1421
|
22+
LL | use self::other::Foo;
23+
| ^^^^^^^^^^^^^^^^
24+
|
25+
note: the name `Foo` in the type namespace is supposed to be publicly re-exported here
26+
--> $DIR/hidden_glob_reexports.rs:25:13
27+
|
1528
LL | pub use self::inner::*;
16-
| -------------- the name `Foo` in the type namespace is supposed to be publicly re-exported here
17-
LL |
29+
| ^^^^^^^^^^^^^^
30+
note: but the private item here shadows it
31+
--> $DIR/hidden_glob_reexports.rs:27:9
32+
|
1833
LL | use self::other::Foo;
19-
| ^^^^^^^^^^^^^^^^ but the private item here shadows it
34+
| ^^^^^^^^^^^^^^^^
2035

2136
warning: private item shadows public glob re-export
2237
--> $DIR/hidden_glob_reexports.rs:40:9
2338
|
39+
LL | use std::primitive::u8;
40+
| ^^^^^^^^^^^^^^^^^^
41+
|
42+
note: the name `u8` in the type namespace is supposed to be publicly re-exported here
43+
--> $DIR/hidden_glob_reexports.rs:38:13
44+
|
2445
LL | pub use self::no_def_id::*;
25-
| ------------------ the name `u8` in the type namespace is supposed to be publicly re-exported here
26-
LL |
46+
| ^^^^^^^^^^^^^^^^^^
47+
note: but the private item here shadows it
48+
--> $DIR/hidden_glob_reexports.rs:40:9
49+
|
2750
LL | use std::primitive::u8;
28-
| ^^^^^^^^^^^^^^^^^^ but the private item here shadows it
51+
| ^^^^^^^^^^^^^^^^^^
2952

3053
warning: 3 warnings emitted
3154

0 commit comments

Comments
 (0)