Skip to content
This repository was archived by the owner on Apr 5, 2024. It is now read-only.

Commit 9608fcf

Browse files
committed
Fix compilation for the latest nightly.
1 parent cad2a60 commit 9608fcf

File tree

8 files changed

+27
-43
lines changed

8 files changed

+27
-43
lines changed

Cargo.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,17 @@ name = "rust-semver-public"
2727
path = "src/bin/rust_semver_public.rs"
2828

2929
[dependencies]
30-
cargo = "0.37"
31-
crates-io = "0.24"
30+
cargo = "0.39"
31+
crates-io = "0.27"
3232
curl = "0.4.21"
33-
env_logger = "0.6"
33+
env_logger = "0.7"
3434
failure = "0.1"
3535
log = "0.4"
36-
rand = "0.6"
36+
rand = "0.7"
3737
semver = "0.9"
3838
serde = "1.0.84"
3939
serde_derive = "1.0.84"
4040
serde_json = "1.0.34"
4141

4242
[dev-dependencies]
43-
quickcheck = "0.7"
43+
quickcheck = "0.9"

src/bin/rust_semver_public.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ extern crate rustc_interface;
77
extern crate syntax;
88

99
use log::debug;
10-
use rustc::middle::cstore::ExternCrate;
1110
use rustc_driver::{Callbacks, Compilation};
1211
use rustc_interface::interface;
1312
use semverver::run_traversal;
@@ -48,9 +47,7 @@ fn main() {
4847
let def_id = crate_num.as_def_id();
4948

5049
match tcx.extern_crate(def_id) {
51-
Some(ExternCrate {
52-
span, direct: true, ..
53-
}) if span.data().lo.to_usize() > 0 => Some(def_id),
50+
Some(extern_crate) if extern_crate.is_direct() && extern_crate.span.data().lo.to_usize() > 0 => Some(def_id),
5451
_ => None,
5552
}
5653
})

src/bin/rust_semverver.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ extern crate rustc_metadata;
1010
extern crate syntax;
1111

1212
use log::debug;
13-
use rustc::middle::cstore::ExternCrate;
1413
use rustc_driver::{Callbacks, Compilation};
1514
use rustc_interface::interface;
1615
use semverver::run_analysis;
@@ -69,10 +68,8 @@ fn main() {
6968
let def_id = crate_num.as_def_id();
7069

7170
match tcx.extern_crate(def_id) {
72-
Some(ExternCrate {
73-
span, direct: true, ..
74-
}) if span.data().lo.to_usize() > 0 =>
75-
Some((span.data().lo.to_usize(), def_id)),
71+
Some(extern_crate) if extern_crate.is_direct() && extern_crate.span.data().lo.to_usize() > 0 =>
72+
Some((extern_crate.span.data().lo.to_usize(), def_id)),
7673
_ => None,
7774
}
7875
})

src/mismatch.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ impl<'a, 'tcx> MismatchRelation<'a, 'tcx> {
8787

8888
/// Ensure that the pair of given `SubstsRef`s is suitable to be related.
8989
fn check_substs(&self, a_substs: SubstsRef<'tcx>, b_substs: SubstsRef<'tcx>) -> bool {
90-
use rustc::ty::subst::UnpackedKind::*;
90+
use rustc::ty::subst::GenericArgKind::*;
9191

9292
for (a, b) in a_substs.iter().zip(b_substs) {
9393
match (a.unpack(), b.unpack()) {
@@ -142,7 +142,7 @@ impl<'a, 'tcx> TypeRelation<'tcx> for MismatchRelation<'a, 'tcx> {
142142
self.current_new_types.insert(b);
143143

144144
debug!("tys: mismatch relation: a: {:?}, b: {:?}", a, b);
145-
let matching = match (&a.sty, &b.sty) {
145+
let matching = match (&a.kind, &b.kind) {
146146
(&TyKind::Adt(a_def, a_substs), &TyKind::Adt(b_def, b_substs)) => {
147147
if self.check_substs(a_substs, b_substs) {
148148
let _ = self.relate_item_substs(a_def.did, a_substs, b_substs)?;

src/translate.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use rustc::{
88
infer::InferCtxt,
99
ty::{
1010
fold::{BottomUpFolder, TypeFoldable, TypeFolder},
11-
subst::{InternalSubsts, Kind, SubstsRef},
11+
subst::{InternalSubsts, GenericArg, SubstsRef},
1212
GenericParamDefKind, ParamEnv, Predicate, Region, TraitRef, Ty, TyCtxt,
1313
},
1414
};
@@ -103,7 +103,7 @@ impl<'a, 'tcx> TranslationContext<'a, 'tcx> {
103103
orig_def_id: DefId,
104104
orig_substs: SubstsRef<'tcx>,
105105
) -> Option<(DefId, SubstsRef<'tcx>)> {
106-
use rustc::ty::subst::UnpackedKind;
106+
use rustc::ty::subst::GenericArgKind;
107107
use rustc::ty::ReEarlyBound;
108108
use std::cell::Cell;
109109

@@ -119,10 +119,10 @@ impl<'a, 'tcx> TranslationContext<'a, 'tcx> {
119119

120120
let target_substs =
121121
InternalSubsts::for_item(self.tcx, target_def_id, |def, _| match def.kind {
122-
GenericParamDefKind::Lifetime => Kind::from(if !success.get() {
122+
GenericParamDefKind::Lifetime => GenericArg::from(if !success.get() {
123123
self.tcx
124124
.mk_region(ReEarlyBound(def.to_early_bound_region_data()))
125-
} else if let Some(UnpackedKind::Lifetime(region)) =
125+
} else if let Some(GenericArgKind::Lifetime(region)) =
126126
orig_substs.get(def.index as usize).map(|k| k.unpack())
127127
{
128128
self.translate_region(region)
@@ -134,15 +134,15 @@ impl<'a, 'tcx> TranslationContext<'a, 'tcx> {
134134
GenericParamDefKind::Type { .. } => {
135135
if !success.get() {
136136
self.tcx.mk_param_from_def(def)
137-
} else if let Some(UnpackedKind::Type(type_)) =
137+
} else if let Some(GenericArgKind::Type(type_)) =
138138
orig_substs.get(def.index as usize).map(|k| k.unpack())
139139
{
140-
self.translate(index_map, &Kind::from(type_))
140+
self.translate(index_map, &GenericArg::from(type_))
141141
} else if self
142142
.id_mapping
143143
.is_non_mapped_defaulted_type_param(def.def_id)
144144
{
145-
Kind::from(self.tcx.type_of(def.def_id))
145+
GenericArg::from(self.tcx.type_of(def.def_id))
146146
} else if self.tcx.generics_of(target_def_id).has_self && def.index == 0 {
147147
self.tcx.mk_param_from_def(def)
148148
} else {
@@ -171,7 +171,7 @@ impl<'a, 'tcx> TranslationContext<'a, 'tcx> {
171171
orig.fold_with(&mut BottomUpFolder {
172172
tcx: self.tcx,
173173
ty_op: |ty| {
174-
match ty.sty {
174+
match ty.kind {
175175
TyKind::Adt(&AdtDef { ref did, .. }, substs)
176176
if self.needs_translation(*did) =>
177177
{
@@ -293,14 +293,14 @@ impl<'a, 'tcx> TranslationContext<'a, 'tcx> {
293293
// `Self` is special
294294
let orig_def_id = index_map[&param.index];
295295
if self.needs_translation(orig_def_id) {
296-
use rustc::ty::subst::UnpackedKind;
296+
use rustc::ty::subst::GenericArgKind;
297297

298298
let target_def_id = self.translate_orig(orig_def_id);
299299
debug!("translating type param: {:?}", param);
300300
let type_param = self.id_mapping.get_type_param(&target_def_id);
301301
debug!("translated type param: {:?}", type_param);
302302
match self.tcx.mk_param_from_def(&type_param).unpack() {
303-
UnpackedKind::Type(param_t) => param_t,
303+
GenericArgKind::Type(param_t) => param_t,
304304
_ => unreachable!(),
305305
}
306306
} else {
@@ -542,7 +542,7 @@ impl<'a, 'tcx> TypeFolder<'tcx> for InferenceCleanupFolder<'a, 'tcx> {
542542
use rustc::ty::TypeAndMut;
543543

544544
let t1 = ty.super_fold_with(self);
545-
match t1.sty {
545+
match t1.kind {
546546
TyKind::Ref(region, ty, mutbl) if region.needs_infer() => {
547547
let ty_and_mut = TypeAndMut { ty, mutbl };
548548
self.infcx

src/traverse.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -560,7 +560,7 @@ fn diff_traits<'tcx>(
560560
output: bool,
561561
) {
562562
use rustc::hir::Unsafety::Unsafe;
563-
use rustc::ty::subst::UnpackedKind::Type;
563+
use rustc::ty::subst::GenericArgKind::Type;
564564
use rustc::ty::{ParamTy, Predicate, TyS};
565565

566566
debug!(
@@ -590,7 +590,7 @@ fn diff_traits<'tcx>(
590590

591591
if id_mapping.is_private_trait(trait_ref.def_id) && trait_ref.substs.len() == 1 {
592592
if let Type(&TyS {
593-
sty: TyKind::Param(ParamTy { index: 0, .. }),
593+
kind: TyKind::Param(ParamTy { index: 0, .. }),
594594
..
595595
}) = trait_ref.substs[0].unpack()
596596
{
@@ -1087,7 +1087,7 @@ fn diff_inherent_impls<'tcx>(
10871087
#[allow(clippy::match_same_arms)]
10881088
fn is_impl_trait_public<'tcx>(tcx: TyCtxt<'tcx>, impl_def_id: DefId) -> bool {
10891089
fn type_visibility(tcx: TyCtxt, ty: Ty) -> Visibility {
1090-
match ty.sty {
1090+
match ty.kind {
10911091
TyKind::Adt(def, _) => tcx.visibility(def.did),
10921092

10931093
TyKind::Array(t, _)

src/typeck.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use rustc::{
1616
ty::{
1717
error::TypeError,
1818
fold::TypeFoldable,
19-
subst::{InternalSubsts, Kind, SubstsRef},
19+
subst::{InternalSubsts, GenericArg, SubstsRef},
2020
GenericParamDefKind, ParamEnv, Predicate, TraitRef, Ty, TyCtxt,
2121
},
2222
};
@@ -181,7 +181,7 @@ impl<'a, 'tcx> TypeComparisonContext<'a, 'tcx> {
181181
use rustc::ty::ReEarlyBound;
182182

183183
InternalSubsts::for_item(self.infcx.tcx, target_def_id, |def, _| match def.kind {
184-
GenericParamDefKind::Lifetime => Kind::from(
184+
GenericParamDefKind::Lifetime => GenericArg::from(
185185
self.infcx
186186
.tcx
187187
.mk_region(ReEarlyBound(def.to_early_bound_region_data())),
@@ -191,7 +191,7 @@ impl<'a, 'tcx> TypeComparisonContext<'a, 'tcx> {
191191
.id_mapping
192192
.is_non_mapped_defaulted_type_param(def.def_id)
193193
{
194-
Kind::from(self.infcx.tcx.type_of(def.def_id))
194+
GenericArg::from(self.infcx.tcx.type_of(def.def_id))
195195
} else {
196196
self.infcx.tcx.mk_param_from_def(def)
197197
}

tests/full.rs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,6 @@ mod full {
1010
};
1111

1212
fn test_full(crate_name: &str, old_version: &str, new_version: &str, expected_result: bool) {
13-
// Full test are not working on windows. See issue #105.
14-
/* if std::env::var_os("CI").is_some() && cfg!(all(target_os = "windows", target_env = "msvc"))
15-
{
16-
eprintln!(
17-
"Skipping full test of crate {} ({} -> {}) on windows. See issue #105.",
18-
crate_name, old_version, new_version
19-
);
20-
return;
21-
} */
22-
2313
// Add target dir to PATH so cargo-semver will call the right rust-semverver
2414
if let Some(path) = env::var_os("PATH") {
2515
let mut paths = env::split_paths(&path).collect::<Vec<_>>();

0 commit comments

Comments
 (0)