Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
19577f5
feat!: change return type of `TryFromIntError::kind`
sorairolake Oct 18, 2026
104e47a
style: apply `rustfmt`
sorairolake Oct 19, 2026
f608dbf
tools: remote-test-server: Fix UEFI crash return code
Ayush1325 Oct 19, 2026
a0a67f8
Add regression test for CoerceShared impl with unnormalizable target
zakrad Oct 24, 2026
73a5217
Replace `insta` with `expect-test` in bootstrap
Kobzol Oct 24, 2026
4ad4b24
Update snapshots
Kobzol Oct 24, 2026
3e342a2
Update documentation
Kobzol Oct 24, 2026
7d79665
Add regression test for self-referential inherent associated type ICE
zakrad Oct 24, 2026
c19a268
Add diagnostic items for env::vars / env::vars_os
notriddle Oct 25, 2026
7b173db
Move rustdoc-html tests in the right folder
GuillaumeGomez Oct 25, 2026
f0fa4d1
Improve `tests/rustdoc-html/trait/impossible-default.rs`
GuillaumeGomez Oct 25, 2026
e8b4f54
Rollup merge of #164617 - Ayush1325:uefi-tests, r=Mark-Simulacrum
JonathanBrouwer Oct 26, 2026
880c4e0
Rollup merge of #164549 - sorairolake:try-from-int-error-kind-return-…
JonathanBrouwer Oct 26, 2026
972009c
Rollup merge of #164856 - Kobzol:expect-test, r=Mark-Simulacrum
JonathanBrouwer Oct 26, 2026
1f5ce0e
Rollup merge of #164893 - notriddle:env-diagnostics, r=ChrisDenton
JonathanBrouwer Oct 26, 2026
f364b81
Rollup merge of #164897 - zakrad:regr-test-156699, r=ShoyuVanilla
JonathanBrouwer Oct 26, 2026
ad84e66
Rollup merge of #164908 - zakrad:regr-test-157774, r=chenyukang
JonathanBrouwer Oct 26, 2026
54bf220
Rollup merge of #164925 - GuillaumeGomez:cleanup-rustdoc-html-tests, …
JonathanBrouwer Oct 26, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions library/core/src/num/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ impl TryFromIntError {
/// Outputs the detailed cause of converting an integer failing.
#[must_use]
#[unstable(feature = "try_from_int_error_kind", issue = "153978")]
pub const fn kind(&self) -> &IntErrorKind {
&self.0
pub const fn kind(&self) -> IntErrorKind {
self.0
}
}

Expand Down
8 changes: 4 additions & 4 deletions library/coretests/tests/nonzero.rs
Original file line number Diff line number Diff line change
Expand Up @@ -285,11 +285,11 @@ fn test_nonzero_from_int_on_success() {

#[test]
fn test_nonzero_from_int_on_err() {
assert_eq!(NonZero::<u8>::try_from(0).unwrap_err().kind(), &IntErrorKind::Zero);
assert_eq!(NonZero::<u32>::try_from(0).unwrap_err().kind(), &IntErrorKind::Zero);
assert_eq!(NonZero::<u8>::try_from(0).unwrap_err().kind(), IntErrorKind::Zero);
assert_eq!(NonZero::<u32>::try_from(0).unwrap_err().kind(), IntErrorKind::Zero);

assert_eq!(NonZero::<i8>::try_from(0).unwrap_err().kind(), &IntErrorKind::Zero);
assert_eq!(NonZero::<i32>::try_from(0).unwrap_err().kind(), &IntErrorKind::Zero);
assert_eq!(NonZero::<i8>::try_from(0).unwrap_err().kind(), IntErrorKind::Zero);
assert_eq!(NonZero::<i32>::try_from(0).unwrap_err().kind(), IntErrorKind::Zero);
}

#[test]
Expand Down
25 changes: 11 additions & 14 deletions library/coretests/tests/num/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -388,17 +388,14 @@ macro_rules! test_impl_try_from_integer_to_bool {
let zero: $source = 0;
let one: $source = 1;
let two: $source = 2;
assert_eq!(bool::try_from(max).unwrap_err().kind(), &IntErrorKind::PosOverflow);
assert_eq!(bool::try_from(max).unwrap_err().kind(), IntErrorKind::PosOverflow);
if min != 0 {
assert_eq!(bool::try_from(min).unwrap_err().kind(), &IntErrorKind::NegOverflow);
assert_eq!(
bool::try_from(zero - 1).unwrap_err().kind(),
&IntErrorKind::NegOverflow
);
assert_eq!(bool::try_from(min).unwrap_err().kind(), IntErrorKind::NegOverflow);
assert_eq!(bool::try_from(zero - 1).unwrap_err().kind(), IntErrorKind::NegOverflow);
}
assert_eq!(bool::try_from(zero).unwrap(), false);
assert_eq!(bool::try_from(one).unwrap(), true);
assert_eq!(bool::try_from(two).unwrap_err().kind(), &IntErrorKind::PosOverflow);
assert_eq!(bool::try_from(two).unwrap_err().kind(), IntErrorKind::PosOverflow);
}
};
}
Expand Down Expand Up @@ -540,12 +537,12 @@ macro_rules! test_impl_try_from_signed_to_unsigned_upper_ok {
assert_eq!(<$target as TryFrom<$source>>::try_from(max).unwrap(), max as $target);
assert_eq!(
<$target as TryFrom<$source>>::try_from(min).unwrap_err().kind(),
&IntErrorKind::NegOverflow
IntErrorKind::NegOverflow
);
assert_eq!(<$target as TryFrom<$source>>::try_from(zero).unwrap(), zero as $target);
assert_eq!(
<$target as TryFrom<$source>>::try_from(neg_one).unwrap_err().kind(),
&IntErrorKind::NegOverflow
IntErrorKind::NegOverflow
);
}
};
Expand Down Expand Up @@ -609,7 +606,7 @@ macro_rules! test_impl_try_from_unsigned_to_signed_upper_err {
let zero: $source = 0;
assert_eq!(
<$target as TryFrom<$source>>::try_from(max).unwrap_err().kind(),
&IntErrorKind::PosOverflow
IntErrorKind::PosOverflow
);
assert_eq!(<$target as TryFrom<$source>>::try_from(min).unwrap(), min as $target);
assert_eq!(<$target as TryFrom<$source>>::try_from(zero).unwrap(), zero as $target);
Expand Down Expand Up @@ -675,12 +672,12 @@ macro_rules! test_impl_try_from_same_sign_err {
let t_min = <$target>::MIN;
assert_eq!(
<$target as TryFrom<$source>>::try_from(max).unwrap_err().kind(),
&IntErrorKind::PosOverflow
IntErrorKind::PosOverflow
);
if min != 0 {
assert_eq!(
<$target as TryFrom<$source>>::try_from(min).unwrap_err().kind(),
&IntErrorKind::NegOverflow
IntErrorKind::NegOverflow
);
}
assert_eq!(<$target as TryFrom<$source>>::try_from(zero).unwrap(), zero as $target);
Expand Down Expand Up @@ -770,11 +767,11 @@ macro_rules! test_impl_try_from_signed_to_unsigned_err {
let t_min = <$target>::MIN;
assert_eq!(
<$target as TryFrom<$source>>::try_from(max).unwrap_err().kind(),
&IntErrorKind::PosOverflow
IntErrorKind::PosOverflow
);
assert_eq!(
<$target as TryFrom<$source>>::try_from(min).unwrap_err().kind(),
&IntErrorKind::NegOverflow
IntErrorKind::NegOverflow
);
assert_eq!(<$target as TryFrom<$source>>::try_from(zero).unwrap(), zero as $target);
assert_eq!(
Expand Down
2 changes: 2 additions & 0 deletions library/std/src/env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ impl !Sync for VarsOs {}
/// [`env::vars_os()`]: vars_os
#[must_use]
#[stable(feature = "env", since = "1.0.0")]
#[cfg_attr(not(test), rustc_diagnostic_item = "env_vars")]
pub fn vars() -> Vars {
Vars { inner: vars_os() }
}
Expand All @@ -157,6 +158,7 @@ pub fn vars() -> Vars {
/// ```
#[must_use]
#[stable(feature = "env", since = "1.0.0")]
#[cfg_attr(not(test), rustc_diagnostic_item = "env_vars_os")]
pub fn vars_os() -> VarsOs {
VarsOs { inner: env_imp::env() }
}
Expand Down
47 changes: 14 additions & 33 deletions src/bootstrap/Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ dependencies = [
"clap",
"clap_complete",
"cmake",
"expect-test",
"home",
"ignore",
"insta",
"junction",
"libc",
"object",
Expand Down Expand Up @@ -175,17 +175,6 @@ dependencies = [
"cc",
]

[[package]]
name = "console"
version = "0.16.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d64e8af5551369d19cf50138de61f1c42074ab970f74e99be916646777f8fc87"
dependencies = [
"encode_unicode",
"libc",
"windows-sys",
]

[[package]]
name = "cpufeatures"
version = "0.2.15"
Expand Down Expand Up @@ -241,10 +230,10 @@ dependencies = [
]

[[package]]
name = "encode_unicode"
version = "1.0.0"
name = "dissimilar"
version = "1.0.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "34aa73646ffb006b8f5147f3dc182bd4bcb190227ce861fc4a4844bf8e3cb2c0"
checksum = "aeda16ab4059c5fd2a83f2b9c9e9c981327b18aa8e3b313f7e6563799d4f093e"

[[package]]
name = "errno"
Expand All @@ -256,6 +245,16 @@ dependencies = [
"windows-sys",
]

[[package]]
name = "expect-test"
version = "1.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "63af43ff4431e848fb47472a920f14fa71c24de13255a5692e93d4e90302acb0"
dependencies = [
"dissimilar",
"once_cell",
]

[[package]]
name = "fastrand"
version = "2.3.0"
Expand Down Expand Up @@ -345,18 +344,6 @@ dependencies = [
"winapi-util",
]

[[package]]
name = "insta"
version = "1.47.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7b4a6248eb93a4401ed2f37dfe8ea592d3cf05b7cf4f8efa867b6895af7e094e"
dependencies = [
"console",
"once_cell",
"similar",
"tempfile",
]

[[package]]
name = "itoa"
version = "1.0.11"
Expand Down Expand Up @@ -682,12 +669,6 @@ version = "1.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"

[[package]]
name = "similar"
version = "2.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bbbb5d9659141646ae647b42fe094daf6c6192d1620870b449d9557f748b2daa"

[[package]]
name = "smallvec"
version = "1.13.2"
Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ features = [
]

[dev-dependencies]
insta = "1.43"
expect-test = "1"

# We care a lot about bootstrap's compile times, so don't include debuginfo for
# dependencies, only bootstrap itself.
Expand Down
4 changes: 1 addition & 3 deletions src/bootstrap/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -222,9 +222,7 @@ please file issues on the [Rust issue tracker][rust-issue-tracker].
## Testing

To run bootstrap tests, execute `x test bootstrap`.
If you want to bless snapshot tests,
then install `cargo-insta` (`cargo install --locked cargo-insta`),
and then run `cargo insta review --manifest-path src/bootstrap/Cargo.toml`.
If you want to bless snapshot tests, use `x test bootstrap --bless`.

## Changelog

Expand Down
7 changes: 3 additions & 4 deletions src/bootstrap/src/core/build_steps/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4176,10 +4176,9 @@ impl CommandLineStep for Bootstrap {
.env("RUSTC_BOOTSTRAP", "1");

if builder.config.cmd.bless() {
// Tell `insta` to automatically bless any failing `.snap` files.
// Unlike compiletest blessing, the tests might still report failure.
// Does not bless inline snapshots.
cargo.env("INSTA_UPDATE", "always");
// Tell `expect-test` to automatically bless any failing `.snap` files
// and inline snapshots.
cargo.env("UPDATE_EXPECT", "1");
}

run_cargo_test(cargo, &[], &[], None, host, builder, record_failed_tests);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,3 @@
source: src/bootstrap/src/core/builder/cli_paths/tests.rs
expression: fmt
---

Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,3 @@
source: src/bootstrap/src/core/builder/cli_paths/tests.rs
expression: run
---

Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,3 @@
source: src/bootstrap/src/core/builder/cli_paths/tests.rs
expression: test rustdoc --skip=rustdoc
---

24 changes: 13 additions & 11 deletions src/bootstrap/src/core/builder/cli_paths/tests.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use std::collections::{BTreeSet, HashSet};
use std::path::PathBuf;
use std::path::{Path, PathBuf};
use std::sync::{Arc, Mutex};

use crate::core::builder::{Builder, CommandLineStepDescription};
Expand Down Expand Up @@ -59,12 +59,17 @@ fn render_steps_for_cli_args(args_str: &str) -> String {
}

fn snapshot_test_inner(name: &str, args_str: &str) {
let mut settings = insta::Settings::clone_current();
// Use the test name as the snapshot filename, not its whole fully-qualified name.
settings.set_prepend_module_to_snapshot(false);
settings.bind(|| {
insta::assert_snapshot!(name, render_steps_for_cli_args(args_str), args_str);
});
let name = Path::new("snapshots").join(format!("{name}.snap"));
let steps = render_steps_for_cli_args(args_str);
let file = file!();
let content = format!(
r"---
source: {file}
expression: {args_str}
---
{steps}"
);
expect_test::expect_file![name].assert_eq(&content);
}

/// Keep the snapshots directory tidy by forbidding `.snap` files that don't
Expand Down Expand Up @@ -119,10 +124,7 @@ macro_rules! declare_tests {

// Snapshot tests for bootstrap's command-line path-to-step handling.
//
// To bless these tests as necessary, choose one:
// - Run `INSTA_UPDATE=always ./x test bootstrap`
// - Run `./x test bootstrap --bless`
// - Follow the instructions for `cargo-insta` in bootstrap's README.md
// To bless these tests as necessary, run `./x test bootstrap --bless`.
//
// These snapshot tests capture _current_ behavior, to prevent unintended
// changes or regressions. If the current behavior is wrong or undersirable,
Expand Down
Loading
Loading