Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 11 additions & 10 deletions ci/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -78,16 +78,17 @@ check() {
check_test "write-integer"

# ensure our partial features aren't allowed, as are unsupported features
cd "${home}/lexical-core"
partial=(parse write floats integers)
for feature in "${partial[@]}"; do
check_error "${feature}"
done

cd "${home}/lexical"
for feature in "${partial[@]}"; do
check_error "${feature}"
done
# FIXME: Restore once we remove our partial features
# cd "${home}/lexical-core"
# partial=(parse write floats integers)
# for feature in "${partial[@]}"; do
# check_error "${feature}"
# done
#
# cd "${home}/lexical"
# for feature in "${partial[@]}"; do
# check_error "${feature}"
# done

cd "${home}"
}
Expand Down
4 changes: 2 additions & 2 deletions clippy.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ disallowed-macros = [
{ path = "std::print", reason = "no IO allowed" },
{ path = "std::println", reason = "no IO allowed" },
{ path = "std::format", reason = "no string allocation allowed" },
{ path = "std::debug", reason = "debugging macros should not be present in any release" },
{ path = "std::dbg", reason = "debugging macros should not be present in any release" },
# NOTE: unimplemented is fine because this can be for intentionally disabled methods
{ path = "std::todo", reason = "should never have TODO macros in releases" },
]
Expand All @@ -14,7 +14,7 @@ disallowed-methods = [
{ path = "std::io::stderr", reason = "no IO allowed" },
]
disallowed-types = [
{ path = "std::io::File", reason = "no IO allowed" },
{ path = "std::fs::File", reason = "no IO allowed" },
{ path = "std::io::BufReader", reason = "need our own abstractions for reading/writing" },
{ path = "std::io::BufWriter", reason = "need our own abstractions for reading/writing" },
]
4 changes: 4 additions & 0 deletions extras/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,7 @@ opt-level = 3
debug = false
debug-assertions = false
lto = true

# FIXME: Support 0.61.0+ when we only support Rustc 1.71.0+.
[patch.crates-io]
windows-sys = { git = "https://github.com/microsoft/windows-rs.git", rev = "308e08e" }
9 changes: 8 additions & 1 deletion extras/benchmark/write-float/special.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,14 @@ macro_rules! gen_vec {
let value = fastrand::$i($exp_mask..);
// NOTE: We want mem::transmute, not from_bits because we
// don't want the special handling of from_bits
#[allow(clippy::transmute_int_to_float)]
// FIXME: Move to `to_bits` in 1.83.0+ (const stable)
// FIXME: change to `unnecessary_transmutes` when supported.
#[allow(
renamed_and_removed_lints,
unknown_lints,
clippy::transmute_int_to_float,
unnecessary_transmutes
)]
vec.push(unsafe { mem::transmute::<$i, $f>(value) });
}
vec
Expand Down
4 changes: 2 additions & 2 deletions extras/clippy.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ disallowed-macros = [
{ path = "std::print", reason = "no IO allowed" },
{ path = "std::println", reason = "no IO allowed" },
{ path = "std::format", reason = "no string allocation allowed" },
{ path = "std::debug", reason = "debugging macros should not be present in any release" },
{ path = "std::dbg", reason = "debugging macros should not be present in any release" },
# NOTE: unimplemented is fine because this can be for intentionally disabled methods
{ path = "std::todo", reason = "should never have TODO macros in releases" },
]
Expand All @@ -14,7 +14,7 @@ disallowed-methods = [
{ path = "std::io::stderr", reason = "no IO allowed" },
]
disallowed-types = [
{ path = "std::io::File", reason = "no IO allowed" },
{ path = "std::fs::File", reason = "no IO allowed" },
{ path = "std::io::BufReader", reason = "need our own abstractions for reading/writing" },
{ path = "std::io::BufWriter", reason = "need our own abstractions for reading/writing" },
]
3 changes: 2 additions & 1 deletion extras/parse-float/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ default-features = false
# Issue: https://github.com/BurntSushi/quickcheck/issues/295
# Fix: https://github.com/BurntSushi/quickcheck/pull/296
quickcheck = { git = "https://github.com/Alexhuszagh/quickcheck/", branch = "i32min-shrink-bound-legacy" }
proptest = ">=1.5.0"
# FIXME: Support 1.7.0+ when we only support Rustc 1.66.0+.
proptest = ">=1.5.0, <1.7.0"

[features]
default = ["std"]
Expand Down
3 changes: 2 additions & 1 deletion extras/parse-integer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ default-features = false
# Issue: https://github.com/BurntSushi/quickcheck/issues/295
# Fix: https://github.com/BurntSushi/quickcheck/pull/296
quickcheck = { git = "https://github.com/Alexhuszagh/quickcheck/", branch = "i32min-shrink-bound-legacy" }
proptest = ">=1.5.0"
# FIXME: Support 1.7.0+ when we only support Rustc 1.66.0+.
proptest = ">=1.5.0, <1.7.0"

[features]
default = ["std"]
Expand Down
3 changes: 2 additions & 1 deletion extras/util/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ default-features = false
# Issue: https://github.com/BurntSushi/quickcheck/issues/295
# Fix: https://github.com/BurntSushi/quickcheck/pull/296
quickcheck = { git = "https://github.com/Alexhuszagh/quickcheck/", branch = "i32min-shrink-bound-legacy" }
proptest = ">=1.5.0"
# FIXME: Support 1.7.0+ when we only support Rustc 1.66.0+.
proptest = ">=1.5.0, <1.7.0"

[features]
default = ["std"]
Expand Down
3 changes: 2 additions & 1 deletion extras/write-float/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@ approx = "0.5.0"
# Issue: https://github.com/BurntSushi/quickcheck/issues/295
# Fix: https://github.com/BurntSushi/quickcheck/pull/296
quickcheck = { git = "https://github.com/Alexhuszagh/quickcheck/", branch = "i32min-shrink-bound-legacy" }
proptest = ">=1.5.0"
fraction = "0.15.0"
# FIXME: Support 1.7.0+ when we only support Rustc 1.66.0+.
proptest = ">=1.5.0, <1.7.0"

[features]
default = ["std"]
Expand Down
3 changes: 2 additions & 1 deletion extras/write-integer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@ default-features = false
# Issue: https://github.com/BurntSushi/quickcheck/issues/295
# Fix: https://github.com/BurntSushi/quickcheck/pull/296
quickcheck = { git = "https://github.com/Alexhuszagh/quickcheck/", branch = "i32min-shrink-bound-legacy" }
proptest = ">=1.5.0"
rustversion = ">=1.0.18"
# FIXME: Support 1.7.0+ when we only support Rustc 1.66.0+.
proptest = ">=1.5.0, <1.7.0"

[features]
default = ["std"]
Expand Down
10 changes: 10 additions & 0 deletions lexical-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,16 @@ f128 = [
"lexical-write-float?/f128"
]

# DEPRECATED
# ----------
# These were never supported, however, they exist in case existing code
# uses them. They should not be used under any circumstances and should
# be removed.
parse = ["parse-integers", "parse-floats"]
write = ["write-integers", "write-floats"]
integers = ["parse-integers", "write-integers"]
floats = ["parse-floats", "write-floats"]

[package.metadata.docs.rs]
features = ["radix", "format", "write-integers", "write-floats", "parse-integers", "parse-floats", "f16"]
rustdoc-args = ["--cfg", "docsrs"]
8 changes: 6 additions & 2 deletions lexical-core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -629,6 +629,11 @@
//! [`lexical-write-float`], and [`lexical-write-integer`]) could cause those
//! safety invariants to be broken.
//!
//! [`lexical-parse-float`]: https://crates.io/crates/lexical-parse-float
//! [`lexical-parse-integer`]: https://crates.io/crates/lexical-parse-integer
//! [`lexical-write-float`]: https://crates.io/crates/lexical-write-float
//! [`lexical-write-integer`]: https://crates.io/crates/lexical-write-integer
//!
//! <!-- Spacer for Rustfmt -->
#![cfg_attr(
any(feature = "write-floats", feature = "write-integers"),
Expand Down Expand Up @@ -686,8 +691,7 @@
clippy::unnecessary_safety_comment,
clippy::semicolon_if_nothing_returned,
clippy::unwrap_used,
clippy::as_underscore,
clippy::doc_markdown
clippy::as_underscore
)]
#![allow(
// used when concepts are logically separate
Expand Down
2 changes: 1 addition & 1 deletion lexical-parse-float/src/bigint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -635,7 +635,7 @@ impl<const SIZE: usize> StackVec<SIZE> {
/// Create a reverse view of the vector for indexing.
#[must_use]
#[inline(always)]
pub fn rview(&self) -> ReverseView<Limb> {
pub fn rview(&self) -> ReverseView<'_, Limb> {
ReverseView {
inner: self,
}
Expand Down
3 changes: 0 additions & 3 deletions lexical-parse-float/src/float.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ pub trait RawFloat: Float + ExactFloat + MaxDigits {
#[must_use]
#[inline(always)]
fn int_pow_fast_path(exponent: usize, radix: u32) -> u64 {
// SAFETY: safe as long as the exponent is smaller than the radix table.
#[cfg(not(feature = "compact"))]
return get_small_int_power(exponent, radix);

Expand All @@ -76,7 +75,6 @@ pub trait RawFloat: Float + ExactFloat + MaxDigits {
impl RawFloat for f32 {
#[inline(always)]
fn pow_fast_path(exponent: usize, radix: u32) -> Self {
// SAFETY: safe as long as the exponent is smaller than the radix table.
#[cfg(not(feature = "compact"))]
return get_small_f32_power(exponent, radix);

Expand All @@ -88,7 +86,6 @@ impl RawFloat for f32 {
impl RawFloat for f64 {
#[inline(always)]
fn pow_fast_path(exponent: usize, radix: u32) -> Self {
// SAFETY: safe as long as the exponent is smaller than the radix table.
#[cfg(not(feature = "compact"))]
return get_small_f64_power(exponent, radix);

Expand Down
3 changes: 1 addition & 2 deletions lexical-parse-float/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -518,8 +518,7 @@
clippy::unnecessary_safety_comment,
clippy::semicolon_if_nothing_returned,
clippy::unwrap_used,
clippy::as_underscore,
clippy::doc_markdown
clippy::as_underscore
)]
#![allow(
// used when concepts are logically separate
Expand Down
3 changes: 2 additions & 1 deletion lexical-parse-float/src/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -653,7 +653,8 @@ impl OptionsBuilder {
///
/// # Panics
///
/// If the built options are not valid.
/// If the built options are not valid. This should always
/// be used within a const context to avoid panics at runtime.
#[inline(always)]
pub const fn build_strict(&self) -> Options {
match self.build() {
Expand Down
3 changes: 1 addition & 2 deletions lexical-parse-integer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -263,8 +263,7 @@
clippy::unnecessary_safety_comment,
clippy::semicolon_if_nothing_returned,
clippy::unwrap_used,
clippy::as_underscore,
clippy::doc_markdown
clippy::as_underscore
)]
#![allow(
// used when concepts are logically separate
Expand Down
10 changes: 9 additions & 1 deletion lexical-parse-integer/src/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,15 @@ impl OptionsBuilder {
}
}

/// Build the [`Options`] struct. This can never panic.
/// Build the [`Options`] struct.
///
/// This can never panic.
///
/// <!-- # Panics
///
/// If the built options are not valid. This should always
/// be used within a const context to avoid panics at runtime.
/// -->
#[inline(always)]
pub const fn build_strict(&self) -> Options {
match self.build() {
Expand Down
10 changes: 10 additions & 0 deletions lexical-util/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,16 @@ lint = []
# Enable support for 128-bit floats.
f128 = ["parse-floats", "write-floats"]

# DEPRECATED
# ----------
# These were never supported, however, they exist in case existing code
# uses them. They should not be used under any circumstances and should
# be removed.
parse = ["parse-integers", "parse-floats"]
write = ["write-integers", "write-floats"]
integers = ["parse-integers", "write-integers"]
floats = ["parse-floats", "write-floats"]

[package.metadata.docs.rs]
features = ["radix", "format", "write-integers", "write-floats", "parse-integers", "parse-floats", "f16"]
rustdoc-args = ["--cfg", "docsrs"]
3 changes: 2 additions & 1 deletion lexical-util/src/format_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3277,7 +3277,8 @@ impl NumberFormatBuilder {
///
/// # Panics
///
/// If the built format is not valid.
/// If the built format is not valid. This should always
/// be used within a const context to avoid panics at runtime.
#[inline(always)]
pub const fn build_strict(&self) -> u128 {
use crate::format::format_error_impl;
Expand Down
3 changes: 1 addition & 2 deletions lexical-util/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,7 @@
clippy::unnecessary_safety_comment,
clippy::semicolon_if_nothing_returned,
clippy::unwrap_used,
clippy::as_underscore,
clippy::doc_markdown
clippy::as_underscore
)]
#![allow(
// used when concepts are logically separate
Expand Down
Loading