diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 145db0ce0f3..45bb47c703b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,7 +21,7 @@ jobs: strategy: fail-fast: false matrix: - rust: [1.46.0, stable, beta] + rust: [1.54.0, stable, beta] os: [windows-latest, macos-latest, ubuntu-latest] target: - i686-pc-windows-msvc @@ -169,7 +169,7 @@ jobs: - name: Install rust uses: actions-rs/toolchain@v1 with: - toolchain: 1.46.0 + toolchain: 1.54.0 target: ${{ matrix.target }} override: true - name: Checkout diff --git a/CHANGELOG.md b/CHANGELOG.md index 6a0c9c8b228..cbdbbc3937a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,7 +8,7 @@ TODO: `cargo`, `std` features ## v3.0.0-rc.0 #### Minimum Required Rust -* As of this release, `clap` requires `rustc 1.46.0` or greater. +* As of this release, `clap` requires `rustc 1.54.0` or greater. #### BREAKING CHANGES diff --git a/Cargo.toml b/Cargo.toml index 498d6760f14..6b5929b878f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -91,7 +91,6 @@ derive = ["clap_derive", "lazy_static"] yaml = ["yaml-rust"] cargo = ["lazy_static"] # Disable if you're not using Cargo, enables Cargo-env-var-dependent macros debug = ["clap_derive/debug"] # Enables debug messages -doc = ["yaml", "regex"] # All the features which add to documentation [profile.test] opt-level = 1 @@ -101,7 +100,7 @@ lto = true codegen-units = 1 [package.metadata.docs.rs] -features = ["doc"] +features = ["yaml", "regex"] targets = ["x86_64-unknown-linux-gnu"] [workspace] diff --git a/README.md b/README.md index 4a34ff7584a..544b8ce5405 100644 --- a/README.md +++ b/README.md @@ -555,7 +555,7 @@ The following is a list of the minimum required version of Rust to compile `clap | clap | MSRV | | :----: | :----: | -| >=3.0 | 1.46.0 | +| >=3.0 | 1.54.0 | | >=2.21 | 1.24.0 | | >=2.2 | 1.12.0 | | >=2.1 | 1.6.0 | @@ -585,4 +585,4 @@ There are several excellent crates which can be used with `clap`, I recommend ch * [`assert_cmd`](https://github.com/assert-rs/assert_cmd) - This crate allows you test your CLIs in a very intuitive and functional way! [docs]: https://docs.rs/clap -[examples]: examples +[examples]: https://github.com/clap-rs/clap/tree/master/examples diff --git a/clap_derive/Cargo.toml b/clap_derive/Cargo.toml index 65fa16e4f00..37bc5a78d77 100644 --- a/clap_derive/Cargo.toml +++ b/clap_derive/Cargo.toml @@ -31,9 +31,9 @@ proc-macro = true bench = false [dependencies] -syn = { version = "1.0.69", features = ["full"] } +syn = { version = "1.0.74", features = ["full"] } quote = "1.0.9" -proc-macro2 = "1.0.26" +proc-macro2 = "1.0.28" heck = "0.3.0" proc-macro-error = "1" @@ -47,8 +47,6 @@ version-sync = "0.9" [features] default = [] debug = [] -doc = [] [package.metadata.docs.rs] -features = ["doc"] targets = ["x86_64-unknown-linux-gnu"] diff --git a/clap_derive/src/dummies.rs b/clap_derive/src/dummies.rs index 72e8ab4bed2..433fff3f16e 100644 --- a/clap_derive/src/dummies.rs +++ b/clap_derive/src/dummies.rs @@ -52,6 +52,9 @@ pub fn subcommand(name: &Ident) { fn augment_subcommands_for_update(_app: clap::App<'_>) -> clap::App<'_> { unimplemented!() } + fn has_subcommand(name: &str) -> bool { + unimplemented!() + } } }); } @@ -77,6 +80,9 @@ pub fn arg_enum(name: &Ident) { fn from_str(_input: &str, _case_insensitive: bool) -> Result { unimplemented!() } + fn as_arg(&self) -> Option<&'static str> { + unimplemented!() + } } }) } diff --git a/clap_derive/tests/ui.rs b/clap_derive/tests/ui.rs index 34be737263e..d96746e53df 100644 --- a/clap_derive/tests/ui.rs +++ b/clap_derive/tests/ui.rs @@ -5,7 +5,7 @@ // , at your // option. This file may not be copied, modified, or distributed -#[rustversion::attr(any(not(stable), before(1.45), since(1.46)), ignore)] +#[rustversion::attr(any(not(stable), before(1.54), since(1.55)), ignore)] #[test] fn ui() { let t = trybuild::TestCases::new(); diff --git a/clap_derive/tests/ui/arg_enum_on_struct.stderr b/clap_derive/tests/ui/arg_enum_on_struct.stderr index b64ac779e0e..d83386a4118 100644 --- a/clap_derive/tests/ui/arg_enum_on_struct.stderr +++ b/clap_derive/tests/ui/arg_enum_on_struct.stderr @@ -4,4 +4,4 @@ error: `#[derive(ArgEnum)]` only supports enums 3 | #[derive(ArgEnum, Debug)] | ^^^^^^^ | - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the derive macro `ArgEnum` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/clap_derive/tests/ui/enum_variant_not_args.stderr b/clap_derive/tests/ui/enum_variant_not_args.stderr index f1a9b207a44..5a874413b08 100644 --- a/clap_derive/tests/ui/enum_variant_not_args.stderr +++ b/clap_derive/tests/ui/enum_variant_not_args.stderr @@ -5,3 +5,11 @@ error[E0277]: the trait bound `SubCmd: clap::Args` is not satisfied | ^^^^^^ the trait `clap::Args` is not implemented for `SubCmd` | = note: required by `augment_args` + +error[E0277]: the trait bound `SubCmd: clap::Args` is not satisfied + --> $DIR/enum_variant_not_args.rs:3:9 + | +3 | Sub(SubCmd), + | ^^^^^^ the trait `clap::Args` is not implemented for `SubCmd` + | + = note: required by `augment_args_for_update` diff --git a/clap_derive/tests/ui/non_existent_attr.stderr b/clap_derive/tests/ui/non_existent_attr.stderr index 0887310693e..e6d308f7786 100644 --- a/clap_derive/tests/ui/non_existent_attr.stderr +++ b/clap_derive/tests/ui/non_existent_attr.stderr @@ -1,5 +1,5 @@ -error[E0599]: no method named `non_existing_attribute` found for struct `clap::Arg<'_>` in the current scope +error[E0599]: no method named `non_existing_attribute` found for struct `Arg` in the current scope --> $DIR/non_existent_attr.rs:14:19 | 14 | #[clap(short, non_existing_attribute = 1)] - | ^^^^^^^^^^^^^^^^^^^^^^ method not found in `clap::Arg<'_>` + | ^^^^^^^^^^^^^^^^^^^^^^ method not found in `Arg<'_>` diff --git a/clap_derive/tests/ui/skip_without_default.stderr b/clap_derive/tests/ui/skip_without_default.stderr index 85545e56086..747f3d27658 100644 --- a/clap_derive/tests/ui/skip_without_default.stderr +++ b/clap_derive/tests/ui/skip_without_default.stderr @@ -1,9 +1,7 @@ -error[E0277]: the trait bound `Kind: std::default::Default` is not satisfied +error[E0277]: the trait bound `Kind: Default` is not satisfied --> $DIR/skip_without_default.rs:22:12 | 22 | #[clap(skip)] - | ^^^^ the trait `std::default::Default` is not implemented for `Kind` + | ^^^^ the trait `Default` is not implemented for `Kind` | = note: required by `std::default::Default::default` - -For more information about this error, try `rustc --explain E0277`. diff --git a/clap_derive/tests/ui/subcommand_on_struct.stderr b/clap_derive/tests/ui/subcommand_on_struct.stderr index 14b03d895db..afef79fd1b1 100644 --- a/clap_derive/tests/ui/subcommand_on_struct.stderr +++ b/clap_derive/tests/ui/subcommand_on_struct.stderr @@ -4,4 +4,4 @@ error: `#[derive(Subcommand)]` only supports enums 3 | #[derive(Subcommand, Debug)] | ^^^^^^^^^^ | - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the derive macro `Subcommand` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/clap_derive/tests/ui/tuple_struct.stderr b/clap_derive/tests/ui/tuple_struct.stderr index 6adcce183ec..a4f1b7572ff 100644 --- a/clap_derive/tests/ui/tuple_struct.stderr +++ b/clap_derive/tests/ui/tuple_struct.stderr @@ -4,7 +4,7 @@ error: `#[derive(Clap)]` only supports non-tuple structs and enums 11 | #[derive(Clap, Debug)] | ^^^^ | - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the derive macro `Clap` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0599]: no function or associated item named `parse` found for struct `Opt` in the current scope --> $DIR/tuple_struct.rs:16:20 @@ -17,4 +17,4 @@ error[E0599]: no function or associated item named `parse` found for struct `Opt | = help: items from traits can only be used if the trait is implemented and in scope = note: the following trait defines an item `parse`, perhaps you need to implement it: - candidate #1: `clap::Clap` + candidate #1: `Clap` diff --git a/clap_generate/Cargo.toml b/clap_generate/Cargo.toml index 29295cbd3d8..675bb51b087 100644 --- a/clap_generate/Cargo.toml +++ b/clap_generate/Cargo.toml @@ -39,8 +39,6 @@ version-sync = "0.9" [features] default = [] debug = ["clap/debug"] -doc = [] [package.metadata.docs.rs] -features = ["doc"] targets = ["x86_64-unknown-linux-gnu"] diff --git a/src/lib.rs b/src/lib.rs index 03c3e517a83..7d786abaabf 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -3,10 +3,9 @@ // (see LICENSE or ) All files in the project carrying such // notice may not be copied, modified, or distributed except according to those terms. -#![cfg_attr(feature = "doc", feature(external_doc))] #![doc(html_logo_url = "https://clap.rs/images/media/clap.png")] #![doc(html_root_url = "https://docs.rs/clap/3.0.0-beta.2")] -#![cfg_attr(feature = "doc", doc(include = "../README.md"))] +#![doc = include_str!("../README.md")] //! #![crate_type = "lib"] #![deny(