pchampin / mownstr

MownStr: Maybe Owned String
1 stars 2 forks source link

Panicking in constant function is unstable #3

Closed damooo closed 2 years ago

damooo commented 2 years ago

Namaste @pchampin

Current version is building against stable rust 2021,

error says Panicking in constant function is unstable at line 34

/home/damodarreddy/.cargo/registry/src/github.com-1ecc6299db9ec823/mownstr-0.1.3/src/lib.rs:34:9
   |
34 |         assert!(other.len() <= LEN_MASK);
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: see issue #51999 <https://github.com/rust-lang/rust/issues/51999> for more information
   = note: this error originates in the macro `assert` (in Nightly builds, run with -Z macro-backtrace for more info)
pchampin commented 2 years ago

Namaste :) I can't reproduce this bug... I suspect that you are not using the latest version of the Rust compiler... What does rustc --version give you?

damooo commented 2 years ago

rusc version: rustc 1.56.1 (59eed8a2a 2021-11-01) toolchain: stable-x86_64-unknown-linux-gnu

Crate compiles well with nightly. Error is introduced in 0.1.3, v0.1.1 works fine with stable. Due to same error sophia crates with version 0.7.1 are also not able to be compiled with stable, where as v0.7.0 crates works fine

pchampin commented 2 years ago

That explains why our experience differ. I am using 1.57.0 (stable), which introduced support for panic in const context.

Is upgrading to 1.57.0 a show stopper for you?

damooo commented 2 years ago

Not at all. May be it will be helpfull to add Minimum Supported Rust Version to sophia, and mownstr docs. Thanks again for your great work.

pchampin commented 2 years ago

I just pushed a note in mownstr's README.

For Sophia, I will wait, because I will temporarily use the nightly toolchain.

I think this issue can be closed, if that's ok with you.