Skip to content

Commit c659713

Browse files
committed
Auto merge of rust-lang#139377 - matthiaskrgr:rollup-hxkmxzl, r=matthiaskrgr
Rollup of 5 pull requests Successful merges: - rust-lang#138546 (Add integer to string formatting tests) - rust-lang#138950 (replace extra_filename with strict version hash in metrics file names) - rust-lang#139028 (Make target maintainers more easily pingable) - rust-lang#139274 (Rustdoc: typecheck settings.js) - rust-lang#139328 (Fix 2024 edition doctest panic output) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 5337252 + 6a70a42 commit c659713

File tree

99 files changed

+395
-222
lines changed

Some content is hidden

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

99 files changed

+395
-222
lines changed

compiler/rustc_driver_impl/src/lib.rs

+5-8
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ use rustc_session::lint::{Lint, LintId};
6464
use rustc_session::output::{CRATE_TYPES, collect_crate_types, invalid_output_for_target};
6565
use rustc_session::{EarlyDiagCtxt, Session, config, filesearch};
6666
use rustc_span::FileName;
67+
use rustc_span::def_id::LOCAL_CRATE;
6768
use rustc_target::json::ToJson;
6869
use rustc_target::spec::{Target, TargetTuple};
6970
use time::OffsetDateTime;
@@ -392,14 +393,10 @@ pub fn run_compiler(at_args: &[String], callbacks: &mut (dyn Callbacks + Send))
392393
}
393394

394395
fn dump_feature_usage_metrics(tcxt: TyCtxt<'_>, metrics_dir: &Path) {
395-
let output_filenames = tcxt.output_filenames(());
396-
let mut metrics_file_name = std::ffi::OsString::from("unstable_feature_usage_metrics-");
397-
let mut metrics_path = output_filenames.with_directory_and_extension(metrics_dir, "json");
398-
let metrics_file_stem =
399-
metrics_path.file_name().expect("there should be a valid default output filename");
400-
metrics_file_name.push(metrics_file_stem);
401-
metrics_path.pop();
402-
metrics_path.push(metrics_file_name);
396+
let hash = tcxt.crate_hash(LOCAL_CRATE);
397+
let crate_name = tcxt.crate_name(LOCAL_CRATE);
398+
let metrics_file_name = format!("unstable_feature_usage_metrics-{crate_name}-{hash}.json");
399+
let metrics_path = metrics_dir.join(metrics_file_name);
403400
if let Err(error) = tcxt.features().dump_feature_usage_metrics(metrics_path) {
404401
// FIXME(yaahc): once metrics can be enabled by default we will want "failure to emit
405402
// default metrics" to only produce a warning when metrics are enabled by default and emit

compiler/rustc_middle/src/ty/context.rs

+5
Original file line numberDiff line numberDiff line change
@@ -1804,10 +1804,15 @@ impl<'tcx> TyCtxt<'tcx> {
18041804
// - needs_metadata: for putting into crate metadata.
18051805
// - instrument_coverage: for putting into coverage data (see
18061806
// `hash_mir_source`).
1807+
// - metrics_dir: metrics use the strict version hash in the filenames
1808+
// for dumped metrics files to prevent overwriting distinct metrics
1809+
// for similar source builds (may change in the future, this is part
1810+
// of the proof of concept impl for the metrics initiative project goal)
18071811
cfg!(debug_assertions)
18081812
|| self.sess.opts.incremental.is_some()
18091813
|| self.needs_metadata()
18101814
|| self.sess.instrument_coverage()
1815+
|| self.sess.opts.unstable_opts.metrics_dir.is_some()
18111816
}
18121817

18131818
#[inline]

library/alloctests/tests/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ mod fmt;
6363
mod heap;
6464
mod linked_list;
6565
mod misc_tests;
66+
mod num;
6667
mod rc;
6768
mod slice;
6869
mod sort;

library/alloctests/tests/num.rs

+69
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
use std::fmt::{Debug, Display};
2+
use std::str::FromStr;
3+
4+
fn assert_nb<Int: ToString + FromStr + Debug + Display + Eq>(value: Int) {
5+
let s = value.to_string();
6+
let s2 = format!("s: {}.", value);
7+
8+
assert_eq!(format!("s: {s}."), s2);
9+
let Ok(ret) = Int::from_str(&s) else {
10+
panic!("failed to convert into to string");
11+
};
12+
assert_eq!(ret, value);
13+
}
14+
15+
macro_rules! uint_to_s {
16+
($($fn_name:ident, $int:ident,)+) => {
17+
$(
18+
#[test]
19+
fn $fn_name() {
20+
assert_nb::<$int>($int::MIN);
21+
assert_nb::<$int>($int::MAX);
22+
assert_nb::<$int>(1);
23+
assert_nb::<$int>($int::MIN / 2);
24+
assert_nb::<$int>($int::MAX / 2);
25+
}
26+
)+
27+
}
28+
}
29+
macro_rules! int_to_s {
30+
($($fn_name:ident, $int:ident,)+) => {
31+
$(
32+
#[test]
33+
fn $fn_name() {
34+
assert_nb::<$int>($int::MIN);
35+
assert_nb::<$int>($int::MAX);
36+
assert_nb::<$int>(1);
37+
assert_nb::<$int>(0);
38+
assert_nb::<$int>(-1);
39+
assert_nb::<$int>($int::MIN / 2);
40+
assert_nb::<$int>($int::MAX / 2);
41+
}
42+
)+
43+
}
44+
}
45+
46+
int_to_s!(
47+
test_i8_to_string,
48+
i8,
49+
test_i16_to_string,
50+
i16,
51+
test_i32_to_string,
52+
i32,
53+
test_i64_to_string,
54+
i64,
55+
test_i128_to_string,
56+
i128,
57+
);
58+
uint_to_s!(
59+
test_u8_to_string,
60+
u8,
61+
test_u16_to_string,
62+
u16,
63+
test_u32_to_string,
64+
u32,
65+
test_u64_to_string,
66+
u64,
67+
test_u128_to_string,
68+
u128,
69+
);

src/doc/rustc/src/platform-support/TEMPLATE.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ One-sentence description of the target (e.g. CPU, OS)
66

77
## Target maintainers
88

9-
- Some Person, https://github.com/...
9+
[@Ghost](https://github.com/Ghost)
10+
[@octocat](https://github.com/octocat)
1011

1112
## Requirements
1213

src/doc/rustc/src/platform-support/aarch64-nintendo-switch-freestanding.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44

55
Nintendo Switch with pure-Rust toolchain.
66

7-
## Designated Developers
7+
## Target Maintainers
88

9-
* [@leo60228](https://github.com/leo60228)
10-
* [@jam1garner](https://github.com/jam1garner)
9+
[@leo60228](https://github.com/leo60228)
10+
[@jam1garner](https://github.com/jam1garner)
1111

1212
## Requirements
1313

src/doc/rustc/src/platform-support/aarch64-unknown-teeos.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ TEEOS is open source in progress. [MORE about](https://gitee.com/opentrustee-gro
2020

2121
## Target maintainers
2222

23-
- Petrochenkov Vadim
24-
- Sword-Destiny
23+
[@petrochenkov](https://github.com/petrochenkov)
24+
[@Sword-Destiny](https://github.com/Sword-Destiny)
2525

2626
## Setup
2727
We use OpenHarmony SDK for TEEOS.

src/doc/rustc/src/platform-support/aix.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ Rust for AIX operating system, currently only 64-bit PowerPC is supported.
66

77
## Target maintainers
88

9-
- David Tenty `[email protected]`, https://github.com/daltenty
10-
- Chris Cambly, `[email protected]`, https://github.com/gilamn5tr
9+
[@daltenty](https://github.com/daltenty)
10+
[@gilamn5tr](https://github.com/gilamn5tr)
1111

1212
## Requirements
1313

src/doc/rustc/src/platform-support/amdgcn-amd-amdhsa.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ AMD GPU target for compute/HSA (Heterogeneous System Architecture).
66

77
## Target maintainers
88

9-
- [@Flakebi](https://github.com/Flakebi)
9+
[@Flakebi](https://github.com/Flakebi)
1010

1111
## Requirements
1212

src/doc/rustc/src/platform-support/android.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88

99
## Target maintainers
1010

11-
- Chris Wailes ([@chriswailes](https://github.com/chriswailes))
12-
- Matthew Maurer ([@maurer](https://github.com/maurer))
13-
- Martin Geisler ([@mgeisler](https://github.com/mgeisler))
11+
[@chriswailes](https://github.com/chriswailes)
12+
[@maurer](https://github.com/maurer)
13+
[@mgeisler](https://github.com/mgeisler)
1414

1515
## Requirements
1616

src/doc/rustc/src/platform-support/apple-darwin.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ Apple macOS targets.
99

1010
## Target maintainers
1111

12-
- [@thomcc](https://github.com/thomcc)
13-
- [@madsmtm](https://github.com/madsmtm)
12+
[@thomcc](https://github.com/thomcc)
13+
[@madsmtm](https://github.com/madsmtm)
1414

1515
## Requirements
1616

src/doc/rustc/src/platform-support/apple-ios-macabi.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ Apple Mac Catalyst targets.
99

1010
## Target maintainers
1111

12-
- [@badboy](https://github.com/badboy)
13-
- [@BlackHoleFox](https://github.com/BlackHoleFox)
14-
- [@madsmtm](https://github.com/madsmtm)
12+
[@badboy](https://github.com/badboy)
13+
[@BlackHoleFox](https://github.com/BlackHoleFox)
14+
[@madsmtm](https://github.com/madsmtm)
1515

1616
## Requirements
1717

src/doc/rustc/src/platform-support/apple-ios.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ Apple iOS / iPadOS targets.
1515

1616
## Target maintainers
1717

18-
- [@badboy](https://github.com/badboy)
19-
- [@deg4uss3r](https://github.com/deg4uss3r)
20-
- [@madsmtm](https://github.com/madsmtm)
18+
[@badboy](https://github.com/badboy)
19+
[@deg4uss3r](https://github.com/deg4uss3r)
20+
[@madsmtm](https://github.com/madsmtm)
2121

2222
## Requirements
2323

src/doc/rustc/src/platform-support/apple-tvos.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ Apple tvOS targets.
1010

1111
## Target maintainers
1212

13-
- [@thomcc](https://github.com/thomcc)
14-
- [@madsmtm](https://github.com/madsmtm)
13+
[@thomcc](https://github.com/thomcc)
14+
[@madsmtm](https://github.com/madsmtm)
1515

1616
## Requirements
1717

src/doc/rustc/src/platform-support/apple-visionos.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ Apple visionOS / xrOS targets.
99

1010
## Target maintainers
1111

12-
- [@agg23](https://github.com/agg23)
13-
- [@madsmtm](https://github.com/madsmtm)
12+
[@agg23](https://github.com/agg23)
13+
[@madsmtm](https://github.com/madsmtm)
1414

1515
## Requirements
1616

src/doc/rustc/src/platform-support/apple-watchos.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ Apple watchOS targets.
1212

1313
## Target maintainers
1414

15-
- [@deg4uss3r](https://github.com/deg4uss3r)
16-
- [@vladimir-ea](https://github.com/vladimir-ea)
17-
- [@leohowell](https://github.com/leohowell)
18-
- [@madsmtm](https://github.com/madsmtm)
15+
[@deg4uss3r](https://github.com/deg4uss3r)
16+
[@vladimir-ea](https://github.com/vladimir-ea)
17+
[@leohowell](https://github.com/leohowell)
18+
[@madsmtm](https://github.com/madsmtm)
1919

2020
## Requirements
2121

src/doc/rustc/src/platform-support/arm64e-apple-darwin.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ ARM64e macOS (11.0+, Big Sur+)
66

77
## Target maintainers
88

9-
- Artyom Tetyukhin ([@arttet](https://github.com/arttet))
9+
[@arttet](https://github.com/arttet)
1010

1111
## Requirements
1212

src/doc/rustc/src/platform-support/arm64e-apple-ios.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ ARM64e iOS (14.0+)
66

77
## Target maintainers
88

9-
- Artyom Tetyukhin ([@arttet](https://github.com/arttet))
9+
[@arttet](https://github.com/arttet)
1010

1111
## Requirements
1212

src/doc/rustc/src/platform-support/arm64e-apple-tvos.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ ARM64e tvOS (10.0+)
66

77
## Target maintainers
88

9-
- Artyom Tetyukhin ([@arttet](https://github.com/arttet))
9+
[@arttet](https://github.com/arttet)
1010

1111
## Requirements
1212

src/doc/rustc/src/platform-support/arm64ec-pc-windows-msvc.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ applications on AArch64 Windows 11. See <https://learn.microsoft.com/en-us/windo
77

88
## Target maintainers
99

10-
- [@dpaoliello](https://github.com/dpaoliello)
10+
[@dpaoliello](https://github.com/dpaoliello)
1111

1212
## Requirements
1313

src/doc/rustc/src/platform-support/armeb-unknown-linux-gnueabi.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ BE8 architecture retains the same little-endian ordered code-stream used by conv
1010
BE8 architecture is the default big-endian architecture for Arm since [Armv6](https://developer.arm.com/documentation/101754/0616/armlink-Reference/armlink-Command-line-Options/--be8?lang=en). It's predecessor, used for Armv4 and Armv5 devices was [BE32](https://developer.arm.com/documentation/dui0474/j/linker-command-line-options/--be32). On Armv6 architecture, endianness can be configured via [system registers](https://developer.arm.com/documentation/ddi0290/g/unaligned-and-mixed-endian-data-access-support/mixed-endian-access-support/interaction-between-the-bus-protocol-and-the-core-endianness). However, BE32 was withdrawn for [Armv7](https://developer.arm.com/documentation/ddi0406/cb/Appendixes/Deprecated-and-Obsolete-Features/Obsolete-features/Support-for-BE-32-endianness-model) onwards.
1111

1212
## Target Maintainers
13-
* [@WorksButNotTested](https://github.com/WorksButNotTested)
13+
14+
[@WorksButNotTested](https://github.com/WorksButNotTested)
1415

1516
## Requirements
1617
The target is cross-compiled. This target supports `std` in the normal way (indeed only nominal changes are required from the standard Arm configuration).

src/doc/rustc/src/platform-support/armv4t-none-eabi.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ overall performance.
1111

1212
## Target Maintainers
1313

14-
* [@Lokathor](https://github.com/lokathor)
15-
* [@corwinkuiper](https://github.com/corwinkuiper)
14+
[@Lokathor](https://github.com/lokathor)
15+
[@corwinkuiper](https://github.com/corwinkuiper)
1616

1717
## Testing
1818

src/doc/rustc/src/platform-support/armv5te-none-eabi.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ See [`arm-none-eabi`](arm-none-eabi.md) for information applicable to all
1313

1414
## Target Maintainers
1515

16-
* [@QuinnPainter](https://github.com/QuinnPainter)
16+
[@QuinnPainter](https://github.com/QuinnPainter)
1717

1818
## Testing
1919

src/doc/rustc/src/platform-support/armv6k-nintendo-3ds.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ from nor used with any official Nintendo SDK.
1313
This target is maintained by members of the [@rust3ds](https://github.com/rust3ds)
1414
organization:
1515

16-
- [@Meziu](https://github.com/Meziu)
17-
- [@AzureMarker](https://github.com/AzureMarker)
18-
- [@ian-h-chamberlain](https://github.com/ian-h-chamberlain)
16+
[@Meziu](https://github.com/Meziu)
17+
[@AzureMarker](https://github.com/AzureMarker)
18+
[@ian-h-chamberlain](https://github.com/ian-h-chamberlain)
1919

2020
## Requirements
2121

src/doc/rustc/src/platform-support/armv7-rtems-eabihf.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ ARM targets for the [RTEMS realtime operating system](https://www.rtems.org) us
66

77
## Target maintainers
88

9-
- [@thesummer](https://github.com/thesummer)
9+
[@thesummer](https://github.com/thesummer)
1010

1111
## Requirements
1212

src/doc/rustc/src/platform-support/armv7-sony-vita-newlibeabihf.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ from nor used with any official Sony SDK.
99

1010
## Target maintainers
1111

12-
* [@nikarh](https://github.com/nikarh)
13-
* [@pheki](https://github.com/pheki)
14-
* [@ZetaNumbers](https://github.com/ZetaNumbers)
12+
[@nikarh](https://github.com/nikarh)
13+
[@pheki](https://github.com/pheki)
14+
[@zetanumbers](https://github.com/zetanumbers)
1515

1616
## Requirements
1717

src/doc/rustc/src/platform-support/armv7-unknown-linux-uclibceabi.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ This target supports Armv7-A softfloat CPUs and uses the uclibc-ng standard libr
66

77
## Target maintainers
88

9-
* [@lancethepants](https://github.com/lancethepants)
9+
[@lancethepants](https://github.com/lancethepants)
1010

1111
## Requirements
1212

src/doc/rustc/src/platform-support/armv7-unknown-linux-uclibceabihf.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44

55
This tier supports the Armv7-A processor running a Linux kernel and uClibc-ng standard library. It provides full support for rust and the rust standard library.
66

7-
## Designated Developers
7+
## Target Maintainers
88

9-
* [@skrap](https://github.com/skrap)
9+
[@skrap](https://github.com/skrap)
1010

1111
## Requirements
1212

src/doc/rustc/src/platform-support/armv7r-none-eabi.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ See [`arm-none-eabi`](arm-none-eabi.md) for information applicable to all
1616

1717
## Target maintainers
1818

19-
- [Chris Copeland](https://github.com/chrisnc), `[email protected]`
19+
[@chrisnc](https://github.com/chrisnc)
2020

2121
## Requirements
2222

0 commit comments

Comments
 (0)