Skip to content

Commit 2aae802

Browse files
committed
Auto merge of #97468 - matthiaskrgr:rollup-8cu0hqr, r=matthiaskrgr
Rollup of 6 pull requests Successful merges: - #95214 (Remove impossible panic note from `Vec::append`) - #97411 (Print stderr consistently) - #97453 (rename `TyKind` to `RegionKind` in comment in rustc_middle) - #97457 (Add regression test for #81899) - #97458 (Modify `derive(Debug)` to use `Self` in struct literal to avoid redundant error) - #97462 (Add more eslint rules) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents ebbcbfc + b37b735 commit 2aae802

File tree

19 files changed

+109
-47
lines changed

19 files changed

+109
-47
lines changed

compiler/rustc_builtin_macros/src/deriving/generic/mod.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1039,7 +1039,9 @@ impl<'a> MethodDef<'a> {
10391039
let span = trait_.span;
10401040
let mut patterns = Vec::new();
10411041
for i in 0..self_args.len() {
1042-
let struct_path = cx.path(span, vec![type_ident]);
1042+
// We could use `type_ident` instead of `Self`, but in the case of a type parameter
1043+
// shadowing the struct name, that causes a second, unnecessary E0578 error. #97343
1044+
let struct_path = cx.path(span, vec![Ident::new(kw::SelfUpper, type_ident.span)]);
10431045
let (pat, ident_expr) = trait_.create_struct_pattern(
10441046
cx,
10451047
struct_path,

compiler/rustc_middle/src/ty/sty.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1469,7 +1469,7 @@ impl ParamConst {
14691469
}
14701470
}
14711471

1472-
/// Use this rather than `TyKind`, whenever possible.
1472+
/// Use this rather than `RegionKind`, whenever possible.
14731473
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, HashStable)]
14741474
#[rustc_pass_by_value]
14751475
pub struct Region<'tcx>(pub Interned<'tcx, RegionKind>);

library/alloc/src/vec/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1771,7 +1771,7 @@ impl<T, A: Allocator> Vec<T, A> {
17711771
///
17721772
/// # Panics
17731773
///
1774-
/// Panics if the number of elements in the vector overflows a `usize`.
1774+
/// Panics if the new capacity exceeds `isize::MAX` bytes.
17751775
///
17761776
/// # Examples
17771777
///

src/bootstrap/builder.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ impl StepDescription {
227227

228228
fn is_excluded(&self, builder: &Builder<'_>, pathset: &PathSet) -> bool {
229229
if builder.config.exclude.iter().any(|e| pathset.has(&e.path, e.kind)) {
230-
eprintln!("Skipping {:?} because it is excluded", pathset);
230+
println!("Skipping {:?} because it is excluded", pathset);
231231
return true;
232232
}
233233

src/bootstrap/config.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -765,7 +765,7 @@ impl Config {
765765
{
766766
Ok(table) => table,
767767
Err(err) => {
768-
println!("failed to parse TOML configuration '{}': {}", file.display(), err);
768+
eprintln!("failed to parse TOML configuration '{}': {}", file.display(), err);
769769
process::exit(2);
770770
}
771771
}

src/bootstrap/flags.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -367,8 +367,8 @@ To learn more about a subcommand, run `./x.py <subcommand> -h`",
367367
}
368368
}
369369
if !pass_sanity_check {
370-
println!("{}\n", subcommand_help);
371-
println!(
370+
eprintln!("{}\n", subcommand_help);
371+
eprintln!(
372372
"Sorry, I couldn't figure out which subcommand you were trying to specify.\n\
373373
You may need to move some options to after the subcommand.\n"
374374
);
@@ -532,7 +532,7 @@ Arguments:
532532
Kind::Build => Subcommand::Build { paths },
533533
Kind::Check => {
534534
if matches.opt_present("all-targets") {
535-
eprintln!(
535+
println!(
536536
"Warning: --all-targets is now on by default and does not need to be passed explicitly."
537537
);
538538
}
@@ -606,7 +606,7 @@ Arguments:
606606
if matches.opt_str("keep-stage").is_some()
607607
|| matches.opt_str("keep-stage-std").is_some()
608608
{
609-
println!("--keep-stage not yet supported for x.py check");
609+
eprintln!("--keep-stage not yet supported for x.py check");
610610
process::exit(1);
611611
}
612612
}

src/bootstrap/format.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ pub fn format(build: &Build, check: bool, paths: &[PathBuf]) {
9696
entry.split(' ').nth(1).expect("every git status entry should list a path")
9797
});
9898
for untracked_path in untracked_paths {
99-
eprintln!("skip untracked path {} during rustfmt invocations", untracked_path);
99+
println!("skip untracked path {} during rustfmt invocations", untracked_path);
100100
// The leading `/` makes it an exact match against the
101101
// repository root, rather than a glob. Without that, if you
102102
// have `foo.rs` in the repository root it will also match
@@ -105,10 +105,10 @@ pub fn format(build: &Build, check: bool, paths: &[PathBuf]) {
105105
ignore_fmt.add(&format!("!/{}", untracked_path)).expect(&untracked_path);
106106
}
107107
} else {
108-
eprintln!("Not in git tree. Skipping git-aware format checks");
108+
println!("Not in git tree. Skipping git-aware format checks");
109109
}
110110
} else {
111-
eprintln!("Could not find usable git. Skipping git-aware format checks");
111+
println!("Could not find usable git. Skipping git-aware format checks");
112112
}
113113
let ignore_fmt = ignore_fmt.build().unwrap();
114114

src/bootstrap/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -689,9 +689,9 @@ impl Build {
689689
// Check for postponed failures from `test --no-fail-fast`.
690690
let failures = self.delayed_failures.borrow();
691691
if failures.len() > 0 {
692-
println!("\n{} command(s) did not execute successfully:\n", failures.len());
692+
eprintln!("\n{} command(s) did not execute successfully:\n", failures.len());
693693
for failure in failures.iter() {
694-
println!(" - {}\n", failure);
694+
eprintln!(" - {}\n", failure);
695695
}
696696
process::exit(1);
697697
}

src/bootstrap/native.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -138,10 +138,10 @@ pub(crate) fn maybe_download_ci_llvm(builder: &Builder<'_>) {
138138
let llvm_sha = llvm_sha.trim();
139139

140140
if llvm_sha == "" {
141-
println!("error: could not find commit hash for downloading LLVM");
142-
println!("help: maybe your repository history is too shallow?");
143-
println!("help: consider disabling `download-ci-llvm`");
144-
println!("help: or fetch enough history to include one upstream commit");
141+
eprintln!("error: could not find commit hash for downloading LLVM");
142+
eprintln!("help: maybe your repository history is too shallow?");
143+
eprintln!("help: consider disabling `download-ci-llvm`");
144+
eprintln!("help: or fetch enough history to include one upstream commit");
145145
panic!();
146146
}
147147

src/bootstrap/setup.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,12 @@ pub fn setup(config: &Config, profile: Profile) {
8585
let path = &config.config;
8686

8787
if path.exists() {
88-
println!(
88+
eprintln!(
8989
"error: you asked `x.py` to setup a new config file, but one already exists at `{}`",
9090
path.display()
9191
);
92-
println!("help: try adding `profile = \"{}\"` at the top of {}", profile, path.display());
93-
println!(
92+
eprintln!("help: try adding `profile = \"{}\"` at the top of {}", profile, path.display());
93+
eprintln!(
9494
"note: this will use the configuration in {}",
9595
profile.include_path(&config.src).display()
9696
);
@@ -115,7 +115,7 @@ pub fn setup(config: &Config, profile: Profile) {
115115
println!();
116116

117117
if !rustup_installed() && profile != Profile::User {
118-
println!("`rustup` is not installed; cannot link `stage1` toolchain");
118+
eprintln!("`rustup` is not installed; cannot link `stage1` toolchain");
119119
} else if stage_dir_exists(&stage_path[..]) {
120120
attempt_toolchain_link(&stage_path[..]);
121121
}
@@ -173,7 +173,7 @@ fn attempt_toolchain_link(stage_path: &str) {
173173
}
174174

175175
if !ensure_stage1_toolchain_placeholder_exists(stage_path) {
176-
println!(
176+
eprintln!(
177177
"Failed to create a template for stage 1 toolchain or confirm that it already exists"
178178
);
179179
return;
@@ -184,8 +184,8 @@ fn attempt_toolchain_link(stage_path: &str) {
184184
"Added `stage1` rustup toolchain; try `cargo +stage1 build` on a separate rust project to run a newly-built toolchain"
185185
);
186186
} else {
187-
println!("`rustup` failed to link stage 1 build to `stage1` toolchain");
188-
println!(
187+
eprintln!("`rustup` failed to link stage 1 build to `stage1` toolchain");
188+
eprintln!(
189189
"To manually link stage 1 build to `stage1` toolchain, run:\n
190190
`rustup toolchain link stage1 {}`",
191191
&stage_path
@@ -292,8 +292,8 @@ pub fn interactive_path() -> io::Result<Profile> {
292292
break match parse_with_abbrev(&input) {
293293
Ok(profile) => profile,
294294
Err(err) => {
295-
println!("error: {}", err);
296-
println!("note: press Ctrl+C to exit");
295+
eprintln!("error: {}", err);
296+
eprintln!("note: press Ctrl+C to exit");
297297
continue;
298298
}
299299
};
@@ -320,8 +320,8 @@ undesirable, simply delete the `pre-push` file from .git/hooks."
320320
"y" | "yes" => true,
321321
"n" | "no" | "" => false,
322322
_ => {
323-
println!("error: unrecognized option '{}'", input.trim());
324-
println!("note: press Ctrl+C to exit");
323+
eprintln!("error: unrecognized option '{}'", input.trim());
324+
eprintln!("note: press Ctrl+C to exit");
325325
continue;
326326
}
327327
};
@@ -337,7 +337,7 @@ undesirable, simply delete the `pre-push` file from .git/hooks."
337337
));
338338
let dst = git.join("hooks").join("pre-push");
339339
match fs::hard_link(src, &dst) {
340-
Err(e) => println!(
340+
Err(e) => eprintln!(
341341
"error: could not create hook {}: do you already have the git hook installed?\n{}",
342342
dst.display(),
343343
e

0 commit comments

Comments
 (0)