Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 0148b97

Browse files
committed
Auto merge of rust-lang#82263 - Dylan-DPC:rollup-cypm2uw, r=Dylan-DPC
Rollup of 10 pull requests Successful merges: - rust-lang#81546 ([libtest] Run the test synchronously when hitting thread limit) - rust-lang#82066 (Ensure valid TraitRefs are created for GATs) - rust-lang#82112 (const_generics: Dont evaluate array length const when handling yet another error ) - rust-lang#82194 (In some limited cases, suggest `where` bounds for non-type params) - rust-lang#82215 (Replace if-let and while-let with `if let` and `while let`) - rust-lang#82218 (Make sure pdbs are copied along with exe and dlls when bootstrapping) - rust-lang#82236 (avoid converting types into themselves (clippy::useless_conversion)) - rust-lang#82246 (Add long explanation for E0549) - rust-lang#82248 (Optimize counting digits in line numbers during error reporting) - rust-lang#82256 (Print -Ztime-passes (and misc stats/logs) on stderr, not stdout.) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents cb2effd + efdcb43 commit 0148b97

File tree

89 files changed

+877
-391
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

89 files changed

+877
-391
lines changed

compiler/rustc_ast_pretty/src/pprust/state.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -914,6 +914,7 @@ impl<'a> State<'a> {
914914

915915
pub fn print_assoc_constraint(&mut self, constraint: &ast::AssocTyConstraint) {
916916
self.print_ident(constraint.ident);
917+
constraint.gen_args.as_ref().map(|args| self.print_generic_args(args, false));
917918
self.s.space();
918919
match &constraint.kind {
919920
ast::AssocTyConstraintKind::Equality { ty } => {

compiler/rustc_data_structures/src/profiling.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -608,7 +608,7 @@ pub fn print_time_passes_entry(
608608
(None, None) => String::new(),
609609
};
610610

611-
println!("time: {:>7}{}\t{}", duration_to_secs_str(dur), mem_string, what);
611+
eprintln!("time: {:>7}{}\t{}", duration_to_secs_str(dur), mem_string, what);
612612
}
613613

614614
// Hack up our own formatting for the duration to make it easier for scripts

compiler/rustc_error_codes/src/error_codes.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,7 @@ E0543: include_str!("./error_codes/E0543.md"),
290290
E0545: include_str!("./error_codes/E0545.md"),
291291
E0546: include_str!("./error_codes/E0546.md"),
292292
E0547: include_str!("./error_codes/E0547.md"),
293+
E0549: include_str!("./error_codes/E0549.md"),
293294
E0550: include_str!("./error_codes/E0550.md"),
294295
E0551: include_str!("./error_codes/E0551.md"),
295296
E0552: include_str!("./error_codes/E0552.md"),
@@ -608,9 +609,6 @@ E0781: include_str!("./error_codes/E0781.md"),
608609
// E0540, // multiple rustc_deprecated attributes
609610
E0544, // multiple stability levels
610611
// E0548, // replaced with a generic attribute input check
611-
// rustc_deprecated attribute must be paired with either stable or unstable
612-
// attribute
613-
E0549,
614612
E0553, // multiple rustc_const_unstable attributes
615613
// E0555, // replaced with a generic attribute input check
616614
// E0558, // replaced with a generic attribute input check

compiler/rustc_error_codes/src/error_codes/E0162.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#### Note: this error code is no longer emitted by the compiler.
22

3-
An if-let pattern attempts to match the pattern, and enters the body if the
3+
An `if let` pattern attempts to match the pattern, and enters the body if the
44
match was successful. If the match is irrefutable (when it cannot fail to
55
match), use a regular `let`-binding instead. For instance:
66

compiler/rustc_error_codes/src/error_codes/E0165.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#### Note: this error code is no longer emitted by the compiler.
22

3-
A while-let pattern attempts to match the pattern, and enters the body if the
3+
A `while let` pattern attempts to match the pattern, and enters the body if the
44
match was successful. If the match is irrefutable (when it cannot fail to
55
match), use a regular `let`-binding inside a `loop` instead. For instance:
66

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
A `rustc_deprecated` attribute wasn't paired with a `stable`/`unstable`
2+
attribute.
3+
4+
Erroneous code example:
5+
6+
```compile_fail,E0549
7+
#![feature(staged_api)]
8+
#![stable(since = "1.0.0", feature = "test")]
9+
10+
#[rustc_deprecated(
11+
since = "1.0.1",
12+
reason = "explanation for deprecation"
13+
)] // invalid
14+
fn _deprecated_fn() {}
15+
```
16+
17+
To fix this issue, you need to add also an attribute `stable` or `unstable`.
18+
Example:
19+
20+
```
21+
#![feature(staged_api)]
22+
#![stable(since = "1.0.0", feature = "test")]
23+
24+
#[stable(since = "1.0.0", feature = "test")]
25+
#[rustc_deprecated(
26+
since = "1.0.1",
27+
reason = "explanation for deprecation"
28+
)] // ok!
29+
fn _deprecated_fn() {}
30+
```
31+
32+
See the [How Rust is Made and “Nightly Rust”][how-rust-made-nightly] appendix
33+
of the Book and the [Stability attributes][stability-attributes] section of the
34+
Rustc Dev Guide for more details.
35+
36+
[how-rust-made-nightly]: https://doc.rust-lang.org/book/appendix-07-nightly-rust.html
37+
[stability-attributes]: https://rustc-dev-guide.rust-lang.org/stability.html

compiler/rustc_errors/src/emitter.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1713,7 +1713,18 @@ impl EmitterWriter {
17131713
let max_line_num_len = if self.ui_testing {
17141714
ANONYMIZED_LINE_NUM.len()
17151715
} else {
1716-
self.get_max_line_num(span, children).to_string().len()
1716+
// Instead of using .to_string().len(), we iteratively count the
1717+
// number of digits to avoid allocation. This strategy has sizable
1718+
// performance gains over the old string strategy.
1719+
let mut n = self.get_max_line_num(span, children);
1720+
let mut num_digits = 0;
1721+
loop {
1722+
num_digits += 1;
1723+
n /= 10;
1724+
if n == 0 {
1725+
break num_digits;
1726+
}
1727+
}
17171728
};
17181729

17191730
match self.emit_message_default(span, message, code, level, max_line_num_len, false) {

compiler/rustc_hir/src/lang_items.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,7 @@ language_item_table! {
242242

243243
Deref, sym::deref, deref_trait, Target::Trait;
244244
DerefMut, sym::deref_mut, deref_mut_trait, Target::Trait;
245+
DerefTarget, sym::deref_target, deref_target, Target::AssocTy;
245246
Receiver, sym::receiver, receiver_trait, Target::Trait;
246247

247248
Fn, kw::Fn, fn_trait, Target::Trait;

compiler/rustc_incremental/src/persist/file_format.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ fn report_format_mismatch(report_incremental_info: bool, file: &Path, message: &
109109
debug!("read_file: {}", message);
110110

111111
if report_incremental_info {
112-
println!(
112+
eprintln!(
113113
"[incremental] ignoring cache artifact `{}`: {}",
114114
file.file_name().unwrap().to_string_lossy(),
115115
message

compiler/rustc_incremental/src/persist/fs.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -440,12 +440,12 @@ fn copy_files(sess: &Session, target_dir: &Path, source_dir: &Path) -> Result<bo
440440
}
441441

442442
if sess.opts.debugging_opts.incremental_info {
443-
println!(
443+
eprintln!(
444444
"[incremental] session directory: \
445445
{} files hard-linked",
446446
files_linked
447447
);
448-
println!(
448+
eprintln!(
449449
"[incremental] session directory: \
450450
{} files copied",
451451
files_copied

0 commit comments

Comments
 (0)