Skip to content

MSRV violation in no_std in toml #1053

@zacknewman

Description

@zacknewman

Not sure why #1018 was closed, but the issue reported remains. While the docs for f64::copysign claim the method has existed since 1.35.0 in core, that's simply not true as can be seen here. The following command using cargo 1.76.0 (the MSRV used by the toml crate) illustrates this:

[zack@laptop toml]$ cargo check --no-default-features -F display,parse,serde,unbounded
warning: unknown lint: `unnameable_types`
  |
  = note: the `unnameable_types` lint is unstable
  = note: see issue #48054 <https://github.com/rust-lang/rust/issues/48054> for more information
  = note: `#[warn(unknown_lints)]` on by default

warning: `toml_parser` (lib) generated 1 warning
warning: `&` without an explicit lifetime name cannot be used here
   --> crates/serde_spanned/src/spanned.rs:113:35
    |
113 |     pub(crate) const START_FIELD: &str = START_FIELD;
    |                                   ^
    |
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
    = note: for more information, see issue #115010 <https://github.com/rust-lang/rust/issues/115010>
    = note: `#[warn(elided_lifetimes_in_associated_constant)]` on by default
help: use the `'static` lifetime
    |
113 |     pub(crate) const START_FIELD: &'static str = START_FIELD;
    |                                    +++++++

warning: `&` without an explicit lifetime name cannot be used here
   --> crates/serde_spanned/src/spanned.rs:114:33
    |
114 |     pub(crate) const END_FIELD: &str = END_FIELD;
    |                                 ^
    |
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
    = note: for more information, see issue #115010 <https://github.com/rust-lang/rust/issues/115010>
help: use the `'static` lifetime
    |
114 |     pub(crate) const END_FIELD: &'static str = END_FIELD;
    |                                  +++++++

warning: `&` without an explicit lifetime name cannot be used here
   --> crates/serde_spanned/src/spanned.rs:115:35
    |
115 |     pub(crate) const VALUE_FIELD: &str = VALUE_FIELD;
    |                                   ^
    |
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
    = note: for more information, see issue #115010 <https://github.com/rust-lang/rust/issues/115010>
help: use the `'static` lifetime
    |
115 |     pub(crate) const VALUE_FIELD: &'static str = VALUE_FIELD;
    |                                    +++++++

warning: `serde_spanned` (lib) generated 4 warnings (1 duplicate) (run `cargo fix --lib -p serde_spanned` to apply 3 suggestions)
warning: `toml_datetime` (lib) generated 1 warning (1 duplicate)
warning: `toml_writer` (lib) generated 1 warning (1 duplicate)
    Checking toml v0.9.8 (/home/zack/projects/toml/crates/toml)
warning: unused import: `core::hash::Hash`
 --> crates/toml/src/value.rs:6:5
  |
6 | use core::hash::Hash;
  |     ^^^^^^^^^^^^^^^^
  |
  = note: `#[warn(unused_imports)]` on by default

error[E0599]: no method named `copysign` found for type `f64` in the current scope
   --> crates/toml/src/value.rs:899:27
    |
899 |             value = value.copysign(1.0);
    |                           ^^^^^^^^ method not found in `f64`

error[E0599]: no method named `copysign` found for type `f32` in the current scope
   --> crates/toml/src/ser/value/mod.rs:150:19
    |
150 |             v = v.copysign(1.0);
    |                   ^^^^^^^^ method not found in `f32`

error[E0599]: no method named `copysign` found for type `f64` in the current scope
   --> crates/toml/src/ser/value/mod.rs:165:19
    |
165 |             v = v.copysign(1.0);
    |                   ^^^^^^^^ method not found in `f64`

For more information about this error, try `rustc --explain E0599`.
warning: `toml` (lib) generated 2 warnings (1 duplicate)
error: could not compile `toml` (lib) due to 3 previous errors; 2 warnings emitted
[zack@laptop toml]$ cargo -V
cargo 1.76.0 (c84b36747 2024-01-18)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions