Skip to content

Commit 8b82fc2

Browse files
HalidOdatdtolnay
andauthored
Sync upstream/master (#48)
* Explicitly install a Rust toolchain for cargo-outdated job Debugging a recent cargo-outdated bug, it would have been nice not to wonder whether a rustc version change in GitHub's runner image was a contributing factor. * Resolve unexpected_cfgs warning warning: unexpected `cfg` condition name: `exhaustive` --> tests/exhaustive.rs:1:8 | 1 | #![cfg(exhaustive)] | ^^^^^^^^^^ | = help: expected names are: `clippy`, `debug_assertions`, `doc`, `docsrs`, `doctest`, `feature`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, `windows` = help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(exhaustive)");` to the top of the `build.rs` = note: see <https://doc.rust-lang.org/nightly/cargo/reference/build-scripts.html#rustc-check-cfg> for more information about checking conditional configuration = note: `#[warn(unexpected_cfgs)]` on by default * Move allow(unexpected_cfgs) to the crate where cfg(exhaustive) is used * Skip rerunning build script on library code changes * Ignore cast_possible_truncation pedantic clippy lint in test warning: casting `usize` to `u32` may truncate the value on targets with 64-bit wide pointers --> tests/exhaustive.rs:20:25 | 20 | let batch = counter.fetch_add(1, Ordering::Relaxed) as u32; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ... = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_possible_truncation = note: `-W clippy::cast-possible-truncation` implied by `-W clippy::pedantic` = help: to override `-W clippy::pedantic` add `#[allow(clippy::cast_possible_truncation)]` help: ... or use `try_from` and handle the error accordingly | 20 | let batch = u32::try_from(counter.fetch_add(1, Ordering::Relaxed)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * Mark exhaustive test #[ignore] in non-cfg(exhaustive) * Fill in ignore reasons in all #[ignore] attributes * Upload CI Cargo.lock for reproducing failures * Prevent upload-artifact step from causing CI failure This step has been failing way more than reasonable across my various repos. With the provided path, there will be 1 file uploaded Artifact name is valid! Root directory input is valid! Attempt 1 of 5 failed with error: Request timeout: /twirp/github.actions.results.api.v1.ArtifactService/CreateArtifact. Retrying request in 3000 ms... Attempt 2 of 5 failed with error: Request timeout: /twirp/github.actions.results.api.v1.ArtifactService/CreateArtifact. Retrying request in 6029 ms... Attempt 3 of 5 failed with error: Request timeout: /twirp/github.actions.results.api.v1.ArtifactService/CreateArtifact. Retrying request in 8270 ms... Attempt 4 of 5 failed with error: Request timeout: /twirp/github.actions.results.api.v1.ArtifactService/CreateArtifact. Retrying request in 12577 ms... Error: Failed to CreateArtifact: Failed to make request after 5 attempts: Request timeout: /twirp/github.actions.results.api.v1.ArtifactService/CreateArtifact * Remove **/*.rs.bk from project-specific gitignore Cargo stopped generating this in its project template 5 years ago. It would belong in a global gitignore instead. * More precise gitignore patterns * Update rand crate to 0.9 * Unset doc-scrape-examples for lib target False is the default value since Cargo PR 11499. * Fix clippy warnings --------- Co-authored-by: David Tolnay <[email protected]>
1 parent 8659928 commit 8b82fc2

File tree

12 files changed

+47
-31
lines changed

12 files changed

+47
-31
lines changed

.github/workflows/ci.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,12 @@ jobs:
3939
- run: cargo test --features small
4040
- run: cargo build --tests --features no-panic --release
4141
if: matrix.rust == 'nightly'
42+
- uses: actions/upload-artifact@v4
43+
if: matrix.rust == 'nightly' && always()
44+
with:
45+
name: Cargo.lock
46+
path: Cargo.lock
47+
continue-on-error: true
4248

4349
msrv:
4450
name: Rust 1.64.0
@@ -89,6 +95,7 @@ jobs:
8995
timeout-minutes: 45
9096
steps:
9197
- uses: actions/checkout@v4
98+
- uses: dtolnay/rust-toolchain@stable
9299
- uses: dtolnay/install@cargo-outdated
93100
- run: cargo outdated --workspace --exit-code 1
94101
- run: cargo outdated --manifest-path fuzz/Cargo.toml --exit-code 1

.gitignore

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/target
1+
/target/
22
/upstream
3-
**/*.rs.bk
4-
Cargo.lock
3+
/Cargo.lock

Cargo.toml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ categories = ["value-formatting", "no-std", "no-std::no-alloc"]
66
description = "Fast floating point to string conversion, ECMAScript compliant."
77
documentation = "https://docs.rs/ryu-js"
88
edition = "2018"
9-
exclude = ["performance.png", "chart/**"]
9+
exclude = ["build.rs", "performance.png", "chart/**"]
1010
keywords = ["float"]
1111
license = "Apache-2.0 OR BSL-1.0"
1212
repository = "https://github.com/boa-dev/ryu-js"
@@ -24,13 +24,12 @@ no-panic = { version = "0.1", optional = true }
2424

2525
[dev-dependencies]
2626
num_cpus = "1.8"
27-
rand = "0.8"
28-
rand_xorshift = "0.3"
27+
rand = "0.9"
28+
rand_xorshift = "0.4"
2929
criterion = "0.5"
3030

3131
[lib]
3232
bench = false
33-
doc-scrape-examples = false
3433

3534
[package.metadata.docs.rs]
3635
targets = ["x86_64-unknown-linux-gnu"]

build.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
fn main() {
2+
// Warning: build.rs is not published to crates.io.
3+
4+
println!("cargo:rerun-if-changed=build.rs");
5+
println!("cargo:rustc-cfg=check_cfg");
6+
println!("cargo:rustc-check-cfg=cfg(check_cfg)");
7+
println!("cargo:rustc-check-cfg=cfg(exhaustive)");
8+
}

chart/.gitignore

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
*.aux
2-
*.fdb_latexmk
3-
*.fls
4-
*.log
5-
*.pdf
6-
*.png
7-
*.svg
1+
/*.aux
2+
/*.fdb_latexmk
3+
/*.fls
4+
/*.log
5+
/*.pdf
6+
/*.png
7+
/*.svg

examples/upstream_benchmark.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ macro_rules! benchmark {
4545
let mut throwaway = 0;
4646
for _ in 0..SAMPLES {
4747
let f = loop {
48-
let f = $ty::from_bits(rng.gen());
48+
let f = $ty::from_bits(rng.random());
4949
if f.is_finite() {
5050
break f;
5151
}

fuzz/.gitignore

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
artifacts/
2-
corpus/
3-
coverage/
4-
target/
1+
/artifacts/
2+
/corpus/
3+
/coverage/
4+
/target/
5+
/Cargo.lock

src/f2s_intrinsics.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ fn mul_shift_32(m: u32, factor: u64, shift: i32) -> u32 {
6767

6868
let sum = (bits0 >> 32) + bits1;
6969
let shifted_sum = sum >> (shift - 32);
70-
debug_assert!(shifted_sum <= u32::max_value() as u64);
70+
debug_assert!(shifted_sum <= u32::MAX as u64);
7171
shifted_sum as u32
7272
}
7373

src/pretty/to_fixed/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ mod d2fixed_full_table;
1818
///
1919
/// - 1 byte for sign (-)
2020
/// - `22` bytes for whole part:
21-
/// Because we have a check for if `>= 1e21` (1 byte extra, just in case)
21+
/// Because we have a check for if `>= 1e21` (1 byte extra, just in case)
2222
/// - `1` byte for dot (`.`)
2323
/// - `108` (`9 * 12`) bytes for fraction part:
24-
/// We write digits in blocks, which consist of `9` digits.
24+
/// We write digits in blocks, which consist of `9` digits.
2525
///
2626
/// Total: `1 + 22 + 1 + 108 = 132`
2727
pub const MAX_BUFFER_SIZE: usize = 132;
@@ -123,7 +123,7 @@ impl Cursor {
123123
/// The caller has to guarantee that:
124124
///
125125
/// - 10^(olength-1) <= digits < 10^olength
126-
/// e.g., by passing `olength` as `decimalLength9(digits)`.
126+
/// e.g., by passing `olength` as `decimalLength9(digits)`.
127127
///
128128
/// - That the buffer has enough space for the decimal length of the given integer.
129129
#[cfg_attr(feature = "no-panic", no_panic)]

tests/d2s_test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ fn test_random() {
6969
}
7070

7171
#[test]
72-
#[cfg_attr(miri, ignore)]
72+
#[cfg_attr(miri, ignore = "too slow for miri")]
7373
fn test_non_finite() {
7474
for i in 0u64..1 << 23 {
7575
let f = f64::from_bits((((1 << 11) - 1) << 52) + (i << 29));

0 commit comments

Comments
 (0)