Skip to content

Conversation

RalfJung
Copy link
Member

For some reason, a bunch of tests were disabled in Miri that don't use any fancy intrinsics. Let's enable them.

I verified this with ./x miri library/core --no-doc -- float.

r? @tgross35

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Sep 18, 2025
@tgross35
Copy link
Contributor

I think the history here is on me; the equivalent for target_has_reliable_f16_math used to be a config in std's build.rs, and was set to true there when running with miri. I moved it from build.rs to a compiler config at some point, and since then it's not getting enabled when we are running with miri.

Is there any way to detect miri within rustc? If so, this could be updated here

if tf_cfg.has_reliable_f16 {
cfg.insert((sym::target_has_reliable_f16, None));
}
if tf_cfg.has_reliable_f16_math {
cfg.insert((sym::target_has_reliable_f16_math, None));
}
if tf_cfg.has_reliable_f128 {
cfg.insert((sym::target_has_reliable_f128, None));
}
if tf_cfg.has_reliable_f128_math {
cfg.insert((sym::target_has_reliable_f128_math, None));
}
rather than needing to update all the places that config is used.

@RalfJung
Copy link
Member Author

Is there any way to detect miri within rustc?

Can the compiler check if miri is set in the cfg variables?

@tgross35
Copy link
Contributor

tgross35 commented Sep 18, 2025

Based on the description at

/// The parsed `--cfg` options that define the compilation environment of the
/// crate, used to drive conditional compilation.
///
/// An `FxIndexSet` is used to ensure deterministic ordering of error messages
/// relating to `--cfg`.
pub type Cfg = FxIndexSet<(Symbol, Option<Symbol>)>;
I was thinking it could just check the cfg arg in the function I linked. Haven't tested though, figured you may know off the top of your head :)

(I could see the argument that we shouldn't be string matching cfg usually, but I think it's probably fine for the temporary config here if it works)

@RalfJung
Copy link
Member Author

I don't know that cfg code at all, sorry.^^

@rustbot

This comment has been minimized.

Copy link
Contributor

@tgross35 tgross35 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is better than the status quo so let's merge it. I'd still like to check if miri happens to conveniently be in that cfg: &mut Cfg so we can avoid this in the future, but haven't gotten a chance to poke this yet.

View changes since this review

@tgross35
Copy link
Contributor

@bors r+ rollup

@bors
Copy link
Collaborator

bors commented Sep 24, 2025

📌 Commit d3d8a40 has been approved by tgross35

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 24, 2025
Zalathar added a commit to Zalathar/rust that referenced this pull request Sep 24, 2025
f16_f128: enable some more tests in Miri

For some reason, a bunch of tests were disabled in Miri that don't use any fancy intrinsics. Let's enable them.

I verified this with `./x miri library/core --no-doc -- float`.

r? `@tgross35`
@bors
Copy link
Collaborator

bors commented Sep 24, 2025

☔ The latest upstream changes (presumably #146946) made this pull request unmergeable. Please resolve the merge conflicts.

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Sep 24, 2025
@rustbot
Copy link
Collaborator

rustbot commented Sep 24, 2025

This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@RalfJung
Copy link
Member Author

@bors r=tgross35

@bors
Copy link
Collaborator

bors commented Sep 24, 2025

📌 Commit f509dff has been approved by tgross35

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Sep 24, 2025
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Sep 25, 2025
f16_f128: enable some more tests in Miri

For some reason, a bunch of tests were disabled in Miri that don't use any fancy intrinsics. Let's enable them.

I verified this with `./x miri library/core --no-doc -- float`.

r? ``@tgross35``
bors added a commit that referenced this pull request Sep 25, 2025
Rollup of 14 pull requests

Successful merges:

 - #145067 (RawVecInner: add missing `unsafe` to unsafe fns)
 - #145277 (Do not materialise X in [X; 0] when X is unsizing a const)
 - #145973 (Add `std` support for `armv7a-vex-v5`)
 - #146667 (Add an attribute to check the number of lanes in a SIMD vector after monomorphization)
 - #146735 (unstably constify float mul_add methods)
 - #146737 (f16_f128: enable some more tests in Miri)
 - #146766 (Add attributes for #[global_allocator] functions)
 - #146905 (llvm: update remarks support on LLVM 22)
 - #146982 (Remove erroneous normalization step in `tests/run-make/linker-warning`)
 - #147005 (Small string formatting cleanup)
 - #147007 (Explicitly note `&[SocketAddr]` impl of `ToSocketAddrs`)
 - #147008 (bootstrap.py: Respect build.jobs while building bootstrap tool)
 - #147013 (rustdoc: Fix documentation for `--doctest-build-arg`)
 - #147015 (Use `LLVMDisposeTargetMachine`)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit cec668f into rust-lang:master Sep 25, 2025
10 checks passed
@rustbot rustbot added this to the 1.92.0 milestone Sep 25, 2025
rust-timer added a commit that referenced this pull request Sep 25, 2025
Rollup merge of #146737 - RalfJung:f16-f128-miri, r=tgross35

f16_f128: enable some more tests in Miri

For some reason, a bunch of tests were disabled in Miri that don't use any fancy intrinsics. Let's enable them.

I verified this with `./x miri library/core --no-doc -- float`.

r? `@tgross35`
@RalfJung RalfJung deleted the f16-f128-miri branch September 25, 2025 19:42
github-actions bot pushed a commit to rust-lang/miri that referenced this pull request Sep 26, 2025
Rollup of 14 pull requests

Successful merges:

 - rust-lang/rust#145067 (RawVecInner: add missing `unsafe` to unsafe fns)
 - rust-lang/rust#145277 (Do not materialise X in [X; 0] when X is unsizing a const)
 - rust-lang/rust#145973 (Add `std` support for `armv7a-vex-v5`)
 - rust-lang/rust#146667 (Add an attribute to check the number of lanes in a SIMD vector after monomorphization)
 - rust-lang/rust#146735 (unstably constify float mul_add methods)
 - rust-lang/rust#146737 (f16_f128: enable some more tests in Miri)
 - rust-lang/rust#146766 (Add attributes for #[global_allocator] functions)
 - rust-lang/rust#146905 (llvm: update remarks support on LLVM 22)
 - rust-lang/rust#146982 (Remove erroneous normalization step in `tests/run-make/linker-warning`)
 - rust-lang/rust#147005 (Small string formatting cleanup)
 - rust-lang/rust#147007 (Explicitly note `&[SocketAddr]` impl of `ToSocketAddrs`)
 - rust-lang/rust#147008 (bootstrap.py: Respect build.jobs while building bootstrap tool)
 - rust-lang/rust#147013 (rustdoc: Fix documentation for `--doctest-build-arg`)
 - rust-lang/rust#147015 (Use `LLVMDisposeTargetMachine`)

r? `@ghost`
`@rustbot` modify labels: rollup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants