libcore float tests: replace macro shadowing by const-compatible macro#153485
libcore float tests: replace macro shadowing by const-compatible macro#153485rust-bors[bot] merged 1 commit intorust-lang:mainfrom
Conversation
|
|
| assert_approx_eq_const as assert_approx_eq, | ||
| assert_biteq_const as assert_biteq, | ||
| }; | ||
| use super::*; |
There was a problem hiding this comment.
Being able to import super::* here is the main payoff from this change (aside from the reduced code duplication).
| type Float = f128; | ||
| #[allow(unused)] | ||
| const fn flt (x: $fty) -> $fty { x } | ||
| const fn flt (x: Float) -> Float { x } |
There was a problem hiding this comment.
I originally made this Float name a parameter to avoid magically bringing names into scope, but meanwhile flt has been added which is magically brought in scope so we might as well also do that with Float.
| if !l.is_nan() && !r.is_nan() { | ||
| // Also check that standard equality holds, since most tests use `assert_biteq` rather | ||
| // than `assert_eq`. | ||
| assert!(l == r); | ||
| } |
There was a problem hiding this comment.
I have no idea why this was added. If the values are bit-equal and not NaN then they are always also float-equal, so there's no good reason to compare them as floats here I think.
There was a problem hiding this comment.
I think it's not to test the float values but rather to check the equality operator. Seems fine to remove though
80f76af to
0fd3ac4
Compare
|
Some changes occurred in compiler/rustc_codegen_cranelift cc @bjorn3 |
|
Lib tests should be done @bors r+ |
…oss35 libcore float tests: replace macro shadowing by const-compatible macro This lets us avoid rust-lang#153478. However this means we generate 3 function items per assertion -- or rather, 3*8, since every assertion gets duplicated 8 times (4 float types, each in a const and a non-const variant). That's a lot; is it enough to be concerned about? coretest already takes forever to build. In a quick test, build time increased from 29.8s to 30.8s, but that may also entirely be noise. r? @tgross35
…uwer Rollup of 14 pull requests Successful merges: - #153466 (`rust-analyzer` subtree update) - #151280 (Fix incorrect trailing comma suggested in no_accessible_fields) - #152593 (Box in `ValTreeKind::Branch(Box<[I::Const]>)` changed to `List`) - #153174 (std: add wasm64 to sync::Once and thread_parking atomics cfg guards) - #153485 (libcore float tests: replace macro shadowing by const-compatible macro) - #153495 (Fix ICE in `offset_of!` error recovery) - #152040 (Do not emit ConstEvaluatable goals if type-const) - #152741 (Suppress invalid suggestions in destructuring assignment) - #153189 (refactor: move `check_align` to `parse_alignment`) - #153230 (Roll rustfmt reviewers for in-tree rustfmt) - #153445 (Consider try blocks as block-like for overflowed expr) - #153452 (Cleanup unused diagnostic emission methods) - #153476 (bootstrap.py: fix typo "parallle") - #153483 (Preserve parentheses around `Fn` trait bounds in pretty printer)
Rollup merge of #153485 - RalfJung:float-macros-const, r=tgross35 libcore float tests: replace macro shadowing by const-compatible macro This lets us avoid #153478. However this means we generate 3 function items per assertion -- or rather, 3*8, since every assertion gets duplicated 8 times (4 float types, each in a const and a non-const variant). That's a lot; is it enough to be concerned about? coretest already takes forever to build. In a quick test, build time increased from 29.8s to 30.8s, but that may also entirely be noise. r? @tgross35
…uwer Rollup of 14 pull requests Successful merges: - rust-lang/rust#153466 (`rust-analyzer` subtree update) - rust-lang/rust#151280 (Fix incorrect trailing comma suggested in no_accessible_fields) - rust-lang/rust#152593 (Box in `ValTreeKind::Branch(Box<[I::Const]>)` changed to `List`) - rust-lang/rust#153174 (std: add wasm64 to sync::Once and thread_parking atomics cfg guards) - rust-lang/rust#153485 (libcore float tests: replace macro shadowing by const-compatible macro) - rust-lang/rust#153495 (Fix ICE in `offset_of!` error recovery) - rust-lang/rust#152040 (Do not emit ConstEvaluatable goals if type-const) - rust-lang/rust#152741 (Suppress invalid suggestions in destructuring assignment) - rust-lang/rust#153189 (refactor: move `check_align` to `parse_alignment`) - rust-lang/rust#153230 (Roll rustfmt reviewers for in-tree rustfmt) - rust-lang/rust#153445 (Consider try blocks as block-like for overflowed expr) - rust-lang/rust#153452 (Cleanup unused diagnostic emission methods) - rust-lang/rust#153476 (bootstrap.py: fix typo "parallle") - rust-lang/rust#153483 (Preserve parentheses around `Fn` trait bounds in pretty printer)
This lets us avoid #153478.
However this means we generate 3 function items per assertion -- or rather, 3*8, since every assertion gets duplicated 8 times (4 float types, each in a const and a non-const variant). That's a lot; is it enough to be concerned about?
coretest already takes forever to build. In a quick test, build time increased from 29.8s to 30.8s, but that may also entirely be noise.
r? @tgross35