Skip to content

Update dependencies #227

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

Merged
merged 2 commits into from
Aug 30, 2019
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
2 changes: 0 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ matrix:
- rust: stable
- rust: beta
- rust: nightly
- rust: nightly
env: FEATURES="--features nightly"
- rust: stable
env: RUN=FMT
before_script: rustup component add rustfmt-preview
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ readme = "README.md"

[features]
default = ["clap/default"]
nightly = ["structopt-derive/nightly"]
suggestions = ["clap/suggestions"]
color = ["clap/color"]
wrap_help = ["clap/wrap_help"]
Expand All @@ -33,5 +32,6 @@ structopt-derive = { path = "structopt-derive", version = "0.3.0" }

[dev-dependencies]
trybuild = "1.0.5"
version_check = "0.9"

[workspace]
11 changes: 5 additions & 6 deletions structopt-derive/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,13 @@ license = "Apache-2.0/MIT"
travis-ci = { repository = "TeXitoi/structopt" }

[dependencies]
syn = { version = "0.15.10", features = ["full"] }
quote = "0.6"
proc-macro2 = "0.4"
heck = "^0.3.0"
proc-macro-error = "0.1"
syn = { version = "1", features = ["full"] }
quote = "1"
proc-macro2 = "1"
heck = "0.3.0"
proc-macro-error = "0.2"

[features]
nightly = ["proc-macro2/nightly"]
paw = []

[lib]
Expand Down
6 changes: 3 additions & 3 deletions structopt-derive/src/attrs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ impl Attrs {
.iter()
.filter_map(|attr| {
if attr.path.is_ident("doc") {
attr.interpret_meta()
attr.parse_meta().ok()
} else {
None
}
Expand All @@ -265,10 +265,10 @@ impl Attrs {
use crate::Lit::*;
use crate::Meta::*;
if let NameValue(MetaNameValue {
ident, lit: Str(s), ..
path, lit: Str(s), ..
}) = attr
{
if ident != "doc" {
if !path.is_ident("doc") {
return None;
}
let value = s.value();
Expand Down
2 changes: 1 addition & 1 deletion structopt-derive/src/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ pub fn parse_structopt_attributes(all_attrs: &[Attribute]) -> Vec<StructOptAttr>
.iter()
.filter(|attr| attr.path.is_ident("structopt"))
.flat_map(|attr| {
let attrs: StructOptAttributes = parse2(attr.tts.clone())
let attrs: StructOptAttributes = parse2(attr.tokens.clone())
.map_err(|e| match &*e.to_string() {
// this error message is misleading and points to Span::call_site()
// so we patch it with something meaningful
Expand Down
13 changes: 12 additions & 1 deletion tests/macro-errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,19 @@
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed

extern crate version_check;
use version_check::Version;

#[test]
fn ui() {
let t = trybuild::TestCases::new();
t.compile_fail("tests/ui/*.rs");

t.compile_fail("tests/ui-common/*.rs");

let version = Version::read().unwrap();
if version.at_least("1.39.0") {
t.compile_fail("tests/ui-1.39_post/*.rs");
} else {
t.compile_fail("tests/ui-pre_1.39/*.rs");
}
}
5 changes: 5 additions & 0 deletions tests/ui-1.39_post/opt_opt_nonpositional.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
error: Option<Option<T>> type is meaningless for positional argument
--> $DIR/opt_opt_nonpositional.rs:14:8
|
14 | n: Option<Option<u32>>,
| ^^^^^^^^^^^^^^^^^^^
5 changes: 5 additions & 0 deletions tests/ui-1.39_post/opt_vec_nonpositional.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
error: Option<Vec<T>> type is meaningless for positional argument
--> $DIR/opt_vec_nonpositional.rs:14:8
|
14 | n: Option<Vec<u32>>,
| ^^^^^^^^^^^^^^^^
5 changes: 5 additions & 0 deletions tests/ui-1.39_post/subcommand_opt_opt.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
error: Option<Option<T>> type is not allowed for subcommand
--> $DIR/subcommand_opt_opt.rs:18:10
|
18 | cmd: Option<Option<Command>>,
| ^^^^^^^^^^^^^^^^^^^^^^^
5 changes: 5 additions & 0 deletions tests/ui-1.39_post/subcommand_opt_vec.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
error: Option<Vec<T>> type is not allowed for subcommand
--> $DIR/subcommand_opt_vec.rs:18:10
|
18 | cmd: Option<Vec<Command>>,
| ^^^^^^^^^^^^^^^^^^^^
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
17 changes: 17 additions & 0 deletions tests/ui-pre_1.39/opt_opt_nonpositional.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Copyright 2018 Guillaume Pinot (@TeXitoi) <[email protected]>
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.

use structopt::StructOpt;

#[derive(StructOpt, Debug)]
#[structopt(name = "basic")]
struct Opt {
n: Option<Option<u32>>,
}

fn main() {}
17 changes: 17 additions & 0 deletions tests/ui-pre_1.39/opt_vec_nonpositional.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Copyright 2018 Guillaume Pinot (@TeXitoi) <[email protected]>
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.

use structopt::StructOpt;

#[derive(StructOpt, Debug)]
#[structopt(name = "basic")]
struct Opt {
n: Option<Vec<u32>>,
}

fn main() {}
33 changes: 33 additions & 0 deletions tests/ui-pre_1.39/subcommand_opt_opt.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// Copyright 2018 Guillaume Pinot (@TeXitoi) <[email protected]>
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.

use structopt::StructOpt;

#[derive(StructOpt)]
#[structopt(name = "make-cookie")]
struct MakeCookie {
#[structopt(short)]
s: String,

#[structopt(subcommand)]
cmd: Option<Option<Command>>,
}

#[derive(StructOpt)]
enum Command {
#[structopt(name = "pound")]
/// Pound acorns into flour for cookie dough.
Pound { acorns: u32 },

Sparkle {
#[structopt(short)]
color: String,
},
}

fn main() {}
33 changes: 33 additions & 0 deletions tests/ui-pre_1.39/subcommand_opt_vec.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// Copyright 2018 Guillaume Pinot (@TeXitoi) <[email protected]>
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.

use structopt::StructOpt;

#[derive(StructOpt)]
#[structopt(name = "make-cookie")]
struct MakeCookie {
#[structopt(short)]
s: String,

#[structopt(subcommand)]
cmd: Option<Vec<Command>>,
}

#[derive(StructOpt)]
enum Command {
#[structopt(name = "pound")]
/// Pound acorns into flour for cookie dough.
Pound { acorns: u32 },

Sparkle {
#[structopt(short)]
color: String,
},
}

fn main() {}