Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lower MSRV to 1.65 #313

Merged
merged 8 commits into from
Dec 5, 2023
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
5 changes: 4 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:
strategy:
fail-fast: false
matrix:
msrv: ["1.72.0"]
msrv: ["1.65.0"]
os:
- ubuntu
- macOS
Expand All @@ -74,6 +74,9 @@ jobs:

- run: cargo test --workspace --features full,testing-helpers
-- --skip compile_fail
env:
RUSTFLAGS: --cfg msrv
RUSTDOCFLAGS: --cfg msrv

no_std:
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

### Breaking changes

- The minimum supported Rust version (MSRV) is now Rust 1.72.
- The minimum supported Rust version (MSRV) is now Rust 1.65.
- Add the `std` feature which should be disabled in `no_std` environments.
- All Cargo features, except `std`, are now disabled by default. The `full`
feature can be used to get the old behavior of supporting all possible
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "derive_more"
version = "1.0.0-beta.6"
edition = "2021"
rust-version = "1.72.0"
rust-version = "1.65.0"
description = "Adds #[derive(x)] macros for more traits"
authors = ["Jelte Fennema <github-tech@jeltef.nl>"]
license = "MIT"
Expand Down
47 changes: 36 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
[![Latest Version](https://img.shields.io/crates/v/derive_more.svg)](https://crates.io/crates/derive_more)
[![Rust Documentation](https://docs.rs/derive_more/badge.svg)](https://docs.rs/derive_more)
[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/JelteF/derive_more/master/LICENSE)
[![Rust 1.72+](https://img.shields.io/badge/rustc-1.72+-lightgray.svg)](https://blog.rust-lang.org/2023/08/24/Rust-1.72.0.html)
[![Rust 1.65+](https://img.shields.io/badge/rustc-1.65+-lightgray.svg)](https://blog.rust-lang.org/2022/11/03/Rust-1.65.0.html)
[![Unsafe Forbidden](https://img.shields.io/badge/unsafe-forbidden-success.svg)](https://github.com/rust-secure-code/safety-dance)

Rust has lots of builtin traits that are implemented for its basic types, such
Expand Down Expand Up @@ -137,13 +137,22 @@ These don't derive traits, but derive static methods instead.
4. [`TryUnwrap`], for each variant `foo` of an enum type, derives an `try_unwrap_foo` method.


### Re-exports

This crate also re-exports all the standard library traits that it adds derives
for. So, both the `Display` derive and the `Display` trait will be in scope when
you add the following code:
```rust
use derive_more::Display;
```




## Installation

This library requires Rust 1.72 or higher. To avoid redundant compilation times, by
default no derives are supported. You have to enable each type of derive as a feature
in `Cargo.toml`:
To avoid redundant compilation times, by default no derives are supported.
You have to enable each type of derive as a feature in `Cargo.toml`:

```toml
[dependencies]
Expand Down Expand Up @@ -176,14 +185,25 @@ extern crate derive_more;
# fn main() {} // omit wrapping statements above into `main()` in tests
```

## Re-exports

This crate also re-exports all of the standard library traits that it adds
derives for. So both the `Display` derive and the `Display` trait will be in
scope when you add the following code:
```rust
use derive_more::Display;
```
## [MSRV] policy

This library requires Rust 1.65 or higher.

Changing [MSRV] (minimum supported Rust version) of this crate is treated as a **minor version change** in terms of [Semantic Versioning].
- So, if [MSRV] changes are **NOT concerning** for your project, just use the default [caret requirement]:
```toml
[dependencies]
derive_more = "1" # or "1.0", or "^1.0"
```
- However, if [MSRV] changes are concerning for your project, then use the [tilde requirement] to **omit breaking code**:
```toml
[dependencies]
derive_more = "~1.0" # or "~1.0.0"
```




[`cargo-expand`]: https://github.com/dtolnay/cargo-expand
[`derive-new`]: https://github.com/nrc/derive-new
Expand Down Expand Up @@ -216,3 +236,8 @@ use derive_more::Display;
[`IsVariant`]: https://jeltef.github.io/derive_more/derive_more/is_variant.html
[`Unwrap`]: https://jeltef.github.io/derive_more/derive_more/unwrap.html
[`TryUnwrap`]: https://jeltef.github.io/derive_more/derive_more/try_unwrap.html

[caret requirement]: https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html#caret-requirements
[tilde requirement]: https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html#tilde-requirements
[MSRV]: https://doc.rust-lang.org/cargo/reference/manifest.html#the-rust-version-field
[Semantic Versioning]: http://semver.org
2 changes: 1 addition & 1 deletion clippy.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# See full lints list at:
# https://rust-lang.github.io/rust-clippy/master/index.html

msrv = "1.72.0"
msrv = "1.65.0"

# Ensures consistent bracing for macro calls in the codebase.
# Extends default settings:
Expand Down
2 changes: 1 addition & 1 deletion impl/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "derive_more-impl"
version = "1.0.0-beta.6"
edition = "2021"
rust-version = "1.72.0"
rust-version = "1.65.0"
description = "Internal implementation of `derive_more` crate"
authors = ["Jelte Fennema <github-tech@jeltef.nl>"]
license = "MIT"
Expand Down
3 changes: 3 additions & 0 deletions impl/doc/try_from.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ The type can be changed with a `#[repr(u/i*)]` attribute, e.g., `#[repr(u8)]` or
Only field-less variants can be constructed from their variant, therefor the `TryFrom` implementation will return an error for a discriminant representing a variant with fields.

```rust
# #[cfg(msrv)] fn main() {} // TODO: Remove once MSRV bumps 1.66 or higher.
# #[cfg(not(msrv))] fn main() {
# use derive_more::TryFrom;
#[derive(TryFrom, Debug, PartialEq)]
#[try_from(repr)]
Expand All @@ -29,4 +31,5 @@ assert_eq!(Enum::EmptySeven{}, Enum::try_from(7).unwrap());

// Variants with fields are not supported, as the value for their fields would be undefined.
assert!(Enum::try_from(6).is_err());
# }
```
1 change: 1 addition & 0 deletions tests/try_from.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ fn enum_with_complex_repr() {
assert!(Enum::try_from(-1).is_err());
}

#[cfg(not(msrv))] // TODO: Remove once MSRV bumps 1.66 or higher.
#[test]
fn test_discriminants_on_enum_with_fields() {
#[derive(TryFrom, Clone, Copy, Debug, Eq, PartialEq)]
Expand Down