`f64::copysign` claims support since `1.35.0` in `core`
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
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
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.
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.
Assessment
- Tech stack
- rust
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100