Skip to content

Commit 282227e

Browse files
authored
Merge pull request rust-lang#98 from gnzlbg/fix_b
Fix broken nightly build
2 parents 059b404 + c35c0fa commit 282227e

File tree

7 files changed

+52
-26
lines changed

7 files changed

+52
-26
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ repository = "https://github.com/rust-dev-tools/rust-semverver"
55
readme = "README.md"
66
keywords = ["semver", "plugin"]
77
categories = ["development-tools", "development-tools::cargo-plugins"]
8-
version = "0.1.27"
8+
version = "0.1.28"
99
authors = ["Inokentiy Babushkin <[email protected]>"]
1010
license-file = "LICENSE"
1111
edition = "2018"

src/bin/cargo_semver.rs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,9 @@ fn main() {
6363
}
6464

6565
if matches.opt_present("q") {
66-
config.shell().set_verbosity(cargo::core::shell::Verbosity::Quiet);
66+
config
67+
.shell()
68+
.set_verbosity(cargo::core::shell::Verbosity::Quiet);
6769
}
6870

6971
if let Err(e) = cli::validate_args(&matches) {
@@ -218,7 +220,11 @@ mod cli {
218220
opts.optflag("h", "help", "print this message and exit");
219221
opts.optflag("V", "version", "print version information and exit");
220222
opts.optflag("e", "explain", "print detailed error explanations");
221-
opts.optflag("q", "quiet", "surpress regular cargo output, print only important messages");
223+
opts.optflag(
224+
"q",
225+
"quiet",
226+
"surpress regular cargo output, print only important messages",
227+
);
222228
opts.optflag("d", "debug", "print command to debug and exit");
223229
opts.optflag(
224230
"a",
@@ -298,7 +304,9 @@ mod cli {
298304

299305
/// Exit with error `e`.
300306
pub fn exit_with_error(config: &cargo::Config, e: failure::Error) -> ! {
301-
config.shell().set_verbosity(cargo::core::shell::Verbosity::Normal);
307+
config
308+
.shell()
309+
.set_verbosity(cargo::core::shell::Verbosity::Normal);
302310
cargo::exit_with_error(CliError::new(e, 1), &mut config.shell());
303311
}
304312
}

src/mapping.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -334,9 +334,8 @@ impl NameMapping {
334334
Const(_) |
335335
ConstParam(_) |
336336
Static(_, _) |
337-
StructCtor(_, _) |
337+
Ctor(_, _, _) |
338338
SelfCtor(_) |
339-
VariantCtor(_, _) |
340339
Method(_) |
341340
AssociatedConst(_) |
342341
Local(_) |

src/translate.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ impl<'a, 'gcx, 'tcx> TranslationContext<'a, 'gcx, 'tcx> {
149149
success.set(false);
150150
self.tcx.mk_param_from_def(def)
151151
}
152-
},
152+
}
153153
GenericParamDefKind::Const => unreachable!(),
154154
});
155155

src/traverse.rs

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,14 @@ use crate::{
1919
use log::{debug, info};
2020
use rustc::{
2121
hir::{
22-
def::{CtorKind, Def, Export},
22+
def::{CtorKind, CtorOf, Def, Export},
2323
def_id::DefId,
2424
},
2525
ty::{
2626
subst::{InternalSubsts, Subst},
2727
AssociatedItem, DefIdTree, GenericParamDef, GenericParamDefKind, Generics, Ty, TyCtxt,
28-
Visibility, Visibility::Public,
28+
Visibility,
29+
Visibility::Public,
2930
},
3031
};
3132
use std::collections::{BTreeMap, HashSet, VecDeque};
@@ -146,7 +147,9 @@ fn diff_structure<'a, 'tcx>(
146147
}
147148
} else if id_mapping.add_export(o.def, n.def) {
148149
// struct constructors are weird/hard - let's go shopping!
149-
if let (StructCtor(_, _), StructCtor(_, _)) = (o.def, n.def) {
150+
if let (Ctor(_, CtorOf::Struct, _), Ctor(_, CtorOf::Struct, _)) =
151+
(o.def, n.def)
152+
{
150153
continue;
151154
}
152155

@@ -183,8 +186,8 @@ fn diff_structure<'a, 'tcx>(
183186
| (PrimTy(_), PrimTy(_))
184187
| (TyParam(_), TyParam(_))
185188
| (SelfTy(_, _), SelfTy(_, _))
186-
| (StructCtor(_, _), StructCtor(_, _))
187-
| (VariantCtor(_, _), VariantCtor(_, _))
189+
| (Ctor(_, CtorOf::Struct, _), Ctor(_, CtorOf::Struct, _))
190+
| (Ctor(_, CtorOf::Variant, _), Ctor(_, CtorOf::Variant, _))
188191
| (AssociatedConst(_), AssociatedConst(_))
189192
| (Local(_), Local(_))
190193
| (Upvar(_, _, _), Upvar(_, _, _))
@@ -254,7 +257,7 @@ fn diff_structure<'a, 'tcx>(
254257
// only an old item is found
255258
(Some(o), None) => {
256259
// struct constructors are weird/hard - let's go shopping!
257-
if let StructCtor(_, _) = o.def {
260+
if let Ctor(_, CtorOf::Struct, _) = o.def {
258261
continue;
259262
}
260263

@@ -266,7 +269,7 @@ fn diff_structure<'a, 'tcx>(
266269
// only a new item is found
267270
(None, Some(n)) => {
268271
// struct constructors are weird/hard - let's go shopping!
269-
if let StructCtor(_, _) = n.def {
272+
if let Ctor(_, CtorOf::Struct, _) = n.def {
270273
continue;
271274
}
272275

@@ -421,7 +424,7 @@ fn diff_adts(changes: &mut ChangeSet, id_mapping: &mut IdMapping, tcx: TyCtxt, o
421424
now_struct: new.ctor_kind == CtorKind::Fictive,
422425
total_private,
423426
};
424-
changes.add_change(c, old_def_id, Some(tcx.def_span(new.did)));
427+
changes.add_change(c, old_def_id, Some(tcx.def_span(new.def_id)));
425428

426429
continue;
427430
}
@@ -469,14 +472,14 @@ fn diff_adts(changes: &mut ChangeSet, id_mapping: &mut IdMapping, tcx: TyCtxt, o
469472
changes.add_change(
470473
ChangeType::VariantRemoved,
471474
old_def_id,
472-
Some(tcx.def_span(old.did)),
475+
Some(tcx.def_span(old.def_id)),
473476
);
474477
}
475478
(None, Some(new)) => {
476479
changes.add_change(
477480
ChangeType::VariantAdded,
478481
old_def_id,
479-
Some(tcx.def_span(new.did)),
482+
Some(tcx.def_span(new.def_id)),
480483
);
481484
}
482485
(None, None) => unreachable!(),

src/typeck.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ impl<'a, 'gcx, 'tcx> TypeComparisonContext<'a, 'gcx, 'tcx> {
195195
} else {
196196
self.infcx.tcx.mk_param_from_def(def)
197197
}
198-
},
198+
}
199199
GenericParamDefKind::Const => unreachable!(),
200200
})
201201
}

tests/full.rs

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,11 @@ mod full {
2222

2323
let mut cmd = Command::new("./target/debug/cargo-semver");
2424
cmd.args(&[
25-
"-S", &format!("{}:{}", crate_name, old_version),
26-
"-C", &format!("{}:{}", crate_name, new_version),
27-
"-q"
25+
"-S",
26+
&format!("{}:{}", crate_name, old_version),
27+
"-C",
28+
&format!("{}:{}", crate_name, new_version),
29+
"-q",
2830
])
2931
.env("RUST_BACKTRACE", "full")
3032
.stdin(Stdio::null())
@@ -37,8 +39,11 @@ mod full {
3739

3840
let output = cmd.output().expect("could not run cargo semver");
3941

40-
assert_eq!(output.status.success(), expected_result,
41-
"cargo-semver returned unexpected exit status {}", output.status
42+
assert_eq!(
43+
output.status.success(),
44+
expected_result,
45+
"cargo-semver returned unexpected exit status {}",
46+
output.status
4247
);
4348

4449
// Choose solution depending on the platform
@@ -58,11 +63,17 @@ mod full {
5863
crate_name, old_version, new_version, file_ext
5964
));
6065

61-
assert!(filename.exists(), "file `{}` does not exist", filename.display());
66+
assert!(
67+
filename.exists(),
68+
"file `{}` does not exist",
69+
filename.display()
70+
);
6271

6372
let mut file = File::create(&filename).expect("could not create output file");
6473

65-
for line in output.stdout.lines()
74+
for line in output
75+
.stdout
76+
.lines()
6677
.chain(output.stderr.lines())
6778
.map(|r| r.expect("could not read line from cargo-semver output"))
6879
.skip_while(|line|
@@ -86,7 +97,12 @@ mod full {
8697
}
8798

8899
let git_result = Command::new("git")
89-
.args(&["diff", "--ignore-space-at-eol", "--exit-code", filename.to_str().unwrap()])
100+
.args(&[
101+
"diff",
102+
"--ignore-space-at-eol",
103+
"--exit-code",
104+
filename.to_str().unwrap(),
105+
])
90106
.env("PAGER", "")
91107
.status()
92108
.expect("could not run git diff")

0 commit comments

Comments
 (0)