`f64::copysign` claims support since `1.35.0` in `core`
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 68/100
- Issue type
- Documentation
- Clarity
- Mostly clear
- Activity status
- Quiet
- Tech stack
- rust
- Domain
- documentation
Research direction
Start at the linked core::primitive.f64::copysign documentation and inspect how its availability version is recorded. Reproduce the shown no_std cargo check, then correct the documented version so it matches core support and verify the example no longer contradicts the API.
Written by the indexing model from the issue text.
Description
Location (URL)
https://doc.rust-lang.org/core/primitive.f64.html#method.copysign
Summary
#131304 added f64::copysign to core which is long after 1.35.0. The following code using the much newer cargo 1.76.0 in a no_std environment causes a compilation failure:
#![no_std]
fn example() {
_ = 0f64.copysign(0f64);
}
[zack@laptop src]$ cargo -V
cargo 1.76.0 (c84b36747 2024-01-18)
[zack@laptop src]$ cargo check
Checking water v0.1.0 (/home/zack/projects/water)
error[E0599]: no method named `copysign` found for type `f64` in the current scope
--> src/lib.rs:3:14
|
3 | _ = 0f64.copysign(0f64);
| ^^^^^^^^ method not found in `f64`
For more information about this error, try `rustc --explain E0599`.
error: could not compile `water` (lib) due to 1 previous error
Commenting out #![no_std] fixes the problem showing that while the method was defined in std since 1.35.0, it wasn't added to core until far later:
[zack@laptop src]$ cargo check
Checking water v0.1.0 (/home/zack/projects/water)
warning: function `example` is never used
--> src/lib.rs:2:4
|
2 | fn example() {
| ^^^^^^^
|
= note: `#[warn(dead_code)]` on by default
warning: `water` (lib) generated 1 warning
Finished dev [unoptimized + debuginfo] target(s) in 0.03s
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.2k
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 510
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from rust-lang/rust
-
needs-triage O-unix relnotes relnotes-tracking-issue T-libs
Difficulty 1/5 Under an hour Newbie friendliness 72/100
-
A-CI A-spurious C-bug O-fuchsia T-infra
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
A-run-make needs-triage O-hermit O-linux O-netbsd O-redox O-SGX O-solid O-unix O-wasi O-wasm O-windows relnotes relnotes-tracking-issue T-compiler T-rustdoc
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
A-attributes needs-triage relnotes relnotes-tracking-issue T-compiler
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
needs-triage O-SGX relnotes relnotes-tracking-issue T-libs
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Eynzof/Hermes-CN-Desktop#610 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
gitbutlerapp/gitbutler#15998 · 1 comment ·
-
bug triage:deciding
Difficulty 1/5 Under an hour Newbie friendliness 88/100
open-telemetry/otel-arrow#4132 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100