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

Commit 182ad87

Browse files
committed
Fixed build with newest nightly.
The `TyCtxt` and `InferCtxt` refactoring truly was a blessing.
1 parent bdefd58 commit 182ad87

File tree

5 files changed

+54
-63
lines changed

5 files changed

+54
-63
lines changed

src/bin/cargo_semver.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -282,11 +282,7 @@ mod cli {
282282
"Space-separated list of features to activate",
283283
"FEATURES",
284284
);
285-
opts.optflag(
286-
"",
287-
"all-features",
288-
"Activate all available features",
289-
);
285+
opts.optflag("", "all-features", "Activate all available features");
290286
opts.optflag(
291287
"",
292288
"no-default-features",

src/mismatch.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ use std::collections::{HashMap, HashSet, VecDeque};
2424
/// This allows to match up some items that aren't exported, and which possibly even differ in
2525
/// their names across versions.
2626
#[cfg_attr(feature = "cargo-clippy", allow(clippy::module_name_repetitions))]
27-
pub struct MismatchRelation<'a, 'gcx: 'tcx, 'tcx> {
27+
pub struct MismatchRelation<'a, 'tcx> {
2828
/// The type context used.
29-
tcx: TyCtxt<'gcx, 'tcx>,
29+
tcx: TyCtxt<'tcx>,
3030
/// The queue of found item pairings to be processed.
3131
item_queue: VecDeque<(Res, Res)>,
3232
/// The id mapping to use.
@@ -37,9 +37,9 @@ pub struct MismatchRelation<'a, 'gcx: 'tcx, 'tcx> {
3737
current_new_types: HashSet<Ty<'tcx>>,
3838
}
3939

40-
impl<'a, 'gcx: 'tcx, 'tcx> MismatchRelation<'a, 'gcx, 'tcx> {
40+
impl<'a, 'tcx> MismatchRelation<'a, 'tcx> {
4141
/// Construct a new mismtach type relation.
42-
pub fn new(tcx: TyCtxt<'gcx, 'tcx>, id_mapping: &'a mut IdMapping) -> Self {
42+
pub fn new(tcx: TyCtxt<'tcx>, id_mapping: &'a mut IdMapping) -> Self {
4343
Self {
4444
tcx,
4545
item_queue: id_mapping.toplevel_queue(),
@@ -100,8 +100,8 @@ impl<'a, 'gcx: 'tcx, 'tcx> MismatchRelation<'a, 'gcx, 'tcx> {
100100
}
101101
}
102102

103-
impl<'a, 'gcx, 'tcx> TypeRelation<'gcx, 'tcx> for MismatchRelation<'a, 'gcx, 'tcx> {
104-
fn tcx(&self) -> TyCtxt<'gcx, 'tcx> {
103+
impl<'a, 'tcx> TypeRelation<'tcx> for MismatchRelation<'a, 'tcx> {
104+
fn tcx(&self) -> TyCtxt<'tcx> {
105105
self.tcx
106106
}
107107

src/translate.rs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ use rustc::{
1515
use std::collections::HashMap;
1616

1717
/// The context in which `DefId` translation happens.
18-
pub struct TranslationContext<'a, 'gcx: 'tcx, 'tcx> {
18+
pub struct TranslationContext<'a, 'tcx> {
1919
/// The type context to use.
20-
tcx: TyCtxt<'gcx, 'tcx>,
20+
tcx: TyCtxt<'tcx>,
2121
/// The id mapping to use.
2222
id_mapping: &'a IdMapping,
2323
/// Whether to translate type and region parameters.
@@ -28,13 +28,13 @@ pub struct TranslationContext<'a, 'gcx: 'tcx, 'tcx> {
2828
translate_orig: fn(&IdMapping, DefId) -> Option<DefId>,
2929
}
3030

31-
impl<'a, 'gcx, 'tcx> TranslationContext<'a, 'gcx, 'tcx> {
31+
impl<'a, 'tcx> TranslationContext<'a, 'tcx> {
3232
/// Construct a translation context translating to the new crate's `DefId`s.
3333
pub fn target_new(
34-
tcx: TyCtxt<'gcx, 'tcx>,
34+
tcx: TyCtxt<'tcx>,
3535
id_mapping: &'a IdMapping,
3636
translate_params: bool,
37-
) -> TranslationContext<'a, 'gcx, 'tcx> {
37+
) -> TranslationContext<'a, 'tcx> {
3838
TranslationContext {
3939
tcx,
4040
id_mapping,
@@ -46,10 +46,10 @@ impl<'a, 'gcx, 'tcx> TranslationContext<'a, 'gcx, 'tcx> {
4646

4747
/// Construct a translation context translating to the old crate's `DefId`s.
4848
pub fn target_old(
49-
tcx: TyCtxt<'gcx, 'tcx>,
49+
tcx: TyCtxt<'tcx>,
5050
id_mapping: &'a IdMapping,
5151
translate_params: bool,
52-
) -> TranslationContext<'a, 'gcx, 'tcx> {
52+
) -> TranslationContext<'a, 'tcx> {
5353
TranslationContext {
5454
tcx,
5555
id_mapping,
@@ -520,20 +520,20 @@ impl<'a, 'gcx, 'tcx> TranslationContext<'a, 'gcx, 'tcx> {
520520
///
521521
/// Used to lift type errors and predicates to wrap them in an error type.
522522
#[derive(Clone)]
523-
pub struct InferenceCleanupFolder<'a, 'gcx: 'a + 'tcx, 'tcx: 'a> {
523+
pub struct InferenceCleanupFolder<'a, 'tcx: 'a> {
524524
/// The inference context used.
525-
infcx: &'a InferCtxt<'a, 'gcx, 'tcx>,
525+
infcx: &'a InferCtxt<'a, 'tcx>,
526526
}
527527

528-
impl<'a, 'gcx, 'tcx> InferenceCleanupFolder<'a, 'gcx, 'tcx> {
528+
impl<'a, 'tcx> InferenceCleanupFolder<'a, 'tcx> {
529529
/// Construct a new folder.
530-
pub fn new(infcx: &'a InferCtxt<'a, 'gcx, 'tcx>) -> Self {
530+
pub fn new(infcx: &'a InferCtxt<'a, 'tcx>) -> Self {
531531
InferenceCleanupFolder { infcx }
532532
}
533533
}
534534

535-
impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for InferenceCleanupFolder<'a, 'gcx, 'tcx> {
536-
fn tcx(&self) -> TyCtxt<'gcx, 'tcx> {
535+
impl<'a, 'tcx> TypeFolder<'tcx> for InferenceCleanupFolder<'a, 'tcx> {
536+
fn tcx(&self) -> TyCtxt<'tcx> {
537537
self.infcx.tcx
538538
}
539539

src/traverse.rs

Lines changed: 16 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ use std::collections::{BTreeMap, HashSet, VecDeque};
3535
/// The main entry point to our analysis passes.
3636
///
3737
/// Set up the necessary data structures and run the analysis passes and call the actual passes.
38-
pub fn run_analysis<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, old: DefId, new: DefId) -> ChangeSet<'tcx> {
38+
pub fn run_analysis<'tcx>(tcx: TyCtxt<'tcx>, old: DefId, new: DefId) -> ChangeSet<'tcx> {
3939
let mut changes = ChangeSet::default();
4040
let mut id_mapping = IdMapping::new(old.krate, new.krate);
4141

@@ -74,7 +74,7 @@ fn get_vis(outer_vis: Visibility, def: Export<HirId>) -> Visibility {
7474
}
7575
}
7676

77-
pub fn run_traversal<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, new: DefId) {
77+
pub fn run_traversal<'tcx>(tcx: TyCtxt<'tcx>, new: DefId) {
7878
use rustc::hir::def::DefKind::*;
7979
let mut visited = HashSet::new();
8080
let mut mod_queue = VecDeque::new();
@@ -124,7 +124,7 @@ pub fn run_traversal<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, new: DefId) {
124124
fn diff_structure<'tcx>(
125125
changes: &mut ChangeSet,
126126
id_mapping: &mut IdMapping,
127-
tcx: TyCtxt<'tcx, 'tcx>,
127+
tcx: TyCtxt<'tcx>,
128128
old: DefId,
129129
new: DefId,
130130
) {
@@ -358,7 +358,7 @@ fn diff_structure<'tcx>(
358358
}
359359

360360
/// Given two fn items, perform structural checks.
361-
fn diff_fn<'tcx>(changes: &mut ChangeSet, tcx: TyCtxt<'tcx, 'tcx>, old: Res, new: Res) {
361+
fn diff_fn<'tcx>(changes: &mut ChangeSet, tcx: TyCtxt<'tcx>, old: Res, new: Res) {
362362
let old_def_id = old.def_id();
363363
let new_def_id = new.def_id();
364364

@@ -377,12 +377,7 @@ fn diff_fn<'tcx>(changes: &mut ChangeSet, tcx: TyCtxt<'tcx, 'tcx>, old: Res, new
377377
}
378378

379379
/// Given two method items, perform structural checks.
380-
fn diff_method<'tcx>(
381-
changes: &mut ChangeSet,
382-
tcx: TyCtxt<'tcx, 'tcx>,
383-
old: AssocItem,
384-
new: AssocItem,
385-
) {
380+
fn diff_method<'tcx>(changes: &mut ChangeSet, tcx: TyCtxt<'tcx>, old: AssocItem, new: AssocItem) {
386381
if old.method_has_self_argument != new.method_has_self_argument {
387382
changes.add_change(
388383
ChangeType::MethodSelfChanged {
@@ -561,7 +556,7 @@ fn diff_adts(changes: &mut ChangeSet, id_mapping: &mut IdMapping, tcx: TyCtxt, o
561556
fn diff_traits<'tcx>(
562557
changes: &mut ChangeSet,
563558
id_mapping: &mut IdMapping,
564-
tcx: TyCtxt<'tcx, 'tcx>,
559+
tcx: TyCtxt<'tcx>,
565560
old: DefId,
566561
new: DefId,
567562
output: bool,
@@ -832,7 +827,7 @@ fn diff_generics(
832827
fn diff_types<'tcx>(
833828
changes: &mut ChangeSet<'tcx>,
834829
id_mapping: &IdMapping,
835-
tcx: TyCtxt<'tcx, 'tcx>,
830+
tcx: TyCtxt<'tcx>,
836831
old: Res,
837832
new: Res,
838833
) {
@@ -901,7 +896,7 @@ fn diff_types<'tcx>(
901896
fn cmp_types<'tcx>(
902897
changes: &mut ChangeSet<'tcx>,
903898
id_mapping: &IdMapping,
904-
tcx: TyCtxt<'tcx, 'tcx>,
899+
tcx: TyCtxt<'tcx>,
905900
orig_def_id: DefId,
906901
target_def_id: DefId,
907902
orig: Ty<'tcx>,
@@ -954,7 +949,7 @@ fn cmp_types<'tcx>(
954949
fn cmp_bounds<'tcx>(
955950
changes: &mut ChangeSet<'tcx>,
956951
id_mapping: &IdMapping,
957-
tcx: TyCtxt<'tcx, 'tcx>,
952+
tcx: TyCtxt<'tcx>,
958953
orig_def_id: DefId,
959954
target_def_id: DefId,
960955
) {
@@ -987,7 +982,7 @@ fn cmp_bounds<'tcx>(
987982
fn diff_inherent_impls<'tcx>(
988983
changes: &mut ChangeSet<'tcx>,
989984
id_mapping: &IdMapping,
990-
tcx: TyCtxt<'tcx, 'tcx>,
985+
tcx: TyCtxt<'tcx>,
991986
) {
992987
debug!("diffing inherent impls");
993988

@@ -1067,8 +1062,8 @@ fn diff_inherent_impls<'tcx>(
10671062
// from perfect and will cause false positives in some cases (see comment in the inner function).
10681063
#[allow(clippy::let_and_return)]
10691064
#[allow(clippy::match_same_arms)]
1070-
fn is_impl_trait_public<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, impl_def_id: DefId) -> bool {
1071-
fn type_visibility<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, ty: Ty) -> Visibility {
1065+
fn is_impl_trait_public<'tcx>(tcx: TyCtxt<'tcx>, impl_def_id: DefId) -> bool {
1066+
fn type_visibility<'tcx>(tcx: TyCtxt<'tcx>, ty: Ty) -> Visibility {
10721067
match ty.sty {
10731068
TyKind::Adt(def, _) => tcx.visibility(def.did),
10741069

@@ -1111,7 +1106,7 @@ fn is_impl_trait_public<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, impl_def_id: DefId) -> bo
11111106
fn diff_trait_impls<'tcx>(
11121107
changes: &mut ChangeSet<'tcx>,
11131108
id_mapping: &IdMapping,
1114-
tcx: TyCtxt<'tcx, 'tcx>,
1109+
tcx: TyCtxt<'tcx>,
11151110
) {
11161111
debug!("diffing trait impls");
11171112

@@ -1164,7 +1159,7 @@ fn diff_trait_impls<'tcx>(
11641159
fn match_inherent_impl<'tcx>(
11651160
changes: &mut ChangeSet<'tcx>,
11661161
id_mapping: &IdMapping,
1167-
tcx: TyCtxt<'tcx, 'tcx>,
1162+
tcx: TyCtxt<'tcx>,
11681163
orig_impl_def_id: DefId,
11691164
target_impl_def_id: DefId,
11701165
orig_item: AssocItem,
@@ -1290,8 +1285,8 @@ fn match_inherent_impl<'tcx>(
12901285
/// Compare two implementations and indicate whether the target one is compatible with the
12911286
/// original one.
12921287
fn match_trait_impl<'a, 'tcx>(
1293-
tcx: TyCtxt<'tcx, 'tcx>,
1294-
trans: &TranslationContext<'a, 'tcx, 'tcx>,
1288+
tcx: TyCtxt<'tcx>,
1289+
trans: &TranslationContext<'a, 'tcx>,
12951290
orig_def_id: DefId,
12961291
) -> bool {
12971292
debug!("matching: {:?}", orig_def_id);

src/typeck.rs

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,18 @@ use rustc::{
2222
};
2323

2424
/// The context in which bounds analysis happens.
25-
pub struct BoundContext<'a, 'gcx: 'a + 'tcx, 'tcx: 'a> {
25+
pub struct BoundContext<'a, 'tcx: 'a> {
2626
/// The inference context to use.
27-
infcx: &'a InferCtxt<'a, 'gcx, 'tcx>,
27+
infcx: &'a InferCtxt<'a, 'tcx>,
2828
/// The fulfillment context to use.
2929
fulfill_cx: FulfillmentContext<'tcx>,
3030
/// The param env to be assumed.
3131
given_param_env: ParamEnv<'tcx>,
3232
}
3333

34-
impl<'a, 'gcx, 'tcx> BoundContext<'a, 'gcx, 'tcx> {
34+
impl<'a, 'tcx> BoundContext<'a, 'tcx> {
3535
/// Construct a new bound context.
36-
pub fn new(infcx: &'a InferCtxt<'a, 'gcx, 'tcx>, given_param_env: ParamEnv<'tcx>) -> Self {
36+
pub fn new(infcx: &'a InferCtxt<'a, 'tcx>, given_param_env: ParamEnv<'tcx>) -> Self {
3737
BoundContext {
3838
infcx,
3939
fulfill_cx: FulfillmentContext::new(),
@@ -91,25 +91,25 @@ impl<'a, 'gcx, 'tcx> BoundContext<'a, 'gcx, 'tcx> {
9191
}
9292

9393
/// The context in which types and their bounds can be compared.
94-
pub struct TypeComparisonContext<'a, 'gcx: 'a + 'tcx, 'tcx: 'a> {
94+
pub struct TypeComparisonContext<'a, 'tcx: 'a> {
9595
/// The inference context to use.
96-
infcx: &'a InferCtxt<'a, 'gcx, 'tcx>,
96+
infcx: &'a InferCtxt<'a, 'tcx>,
9797
/// The index mapping to use.
9898
id_mapping: &'a IdMapping,
9999
/// The folder to clean up found errors of inference artifacts.
100-
folder: InferenceCleanupFolder<'a, 'gcx, 'tcx>,
100+
folder: InferenceCleanupFolder<'a, 'tcx>,
101101
/// The translation context translating from original to target items.
102-
pub forward_trans: TranslationContext<'a, 'gcx, 'tcx>,
102+
pub forward_trans: TranslationContext<'a, 'tcx>,
103103
/// The translation context translating from target to original items.
104-
pub backward_trans: TranslationContext<'a, 'gcx, 'tcx>,
104+
pub backward_trans: TranslationContext<'a, 'tcx>,
105105
/// Whether we are checking a trait definition.
106106
checking_trait_def: bool,
107107
}
108108

109-
impl<'a, 'gcx, 'tcx> TypeComparisonContext<'a, 'gcx, 'tcx> {
109+
impl<'a, 'tcx> TypeComparisonContext<'a, 'tcx> {
110110
/// Construct a new context where the original item is old.
111111
pub fn target_new(
112-
infcx: &'a InferCtxt<'a, 'gcx, 'tcx>,
112+
infcx: &'a InferCtxt<'a, 'tcx>,
113113
id_mapping: &'a IdMapping,
114114
checking_trait_def: bool,
115115
) -> Self {
@@ -126,7 +126,7 @@ impl<'a, 'gcx, 'tcx> TypeComparisonContext<'a, 'gcx, 'tcx> {
126126

127127
/// Construct a new context where the original item is new.
128128
pub fn target_old(
129-
infcx: &'a InferCtxt<'a, 'gcx, 'tcx>,
129+
infcx: &'a InferCtxt<'a, 'tcx>,
130130
id_mapping: &'a IdMapping,
131131
checking_trait_def: bool,
132132
) -> Self {
@@ -143,10 +143,10 @@ impl<'a, 'gcx, 'tcx> TypeComparisonContext<'a, 'gcx, 'tcx> {
143143

144144
/// Construct a new context given a pair of translation contexts.
145145
fn from_trans(
146-
infcx: &'a InferCtxt<'a, 'gcx, 'tcx>,
146+
infcx: &'a InferCtxt<'a, 'tcx>,
147147
id_mapping: &'a IdMapping,
148-
forward_trans: TranslationContext<'a, 'gcx, 'tcx>,
149-
backward_trans: TranslationContext<'a, 'gcx, 'tcx>,
148+
forward_trans: TranslationContext<'a, 'tcx>,
149+
backward_trans: TranslationContext<'a, 'tcx>,
150150
checking_trait_def: bool,
151151
) -> Self {
152152
TypeComparisonContext {
@@ -203,7 +203,7 @@ impl<'a, 'gcx, 'tcx> TypeComparisonContext<'a, 'gcx, 'tcx> {
203203
/// Check for type mismatches in a pair of items.
204204
pub fn check_type_error<'tcx2>(
205205
&self,
206-
lift_tcx: TyCtxt<'tcx2, 'tcx2>,
206+
lift_tcx: TyCtxt<'tcx2>,
207207
target_def_id: DefId,
208208
target_param_env: ParamEnv<'tcx>,
209209
orig: Ty<'tcx>,
@@ -260,7 +260,7 @@ impl<'a, 'gcx, 'tcx> TypeComparisonContext<'a, 'gcx, 'tcx> {
260260
/// Check for trait bound mismatches in a pair of items.
261261
pub fn check_bounds_error<'tcx2>(
262262
&self,
263-
lift_tcx: TyCtxt<'tcx2, 'tcx2>,
263+
lift_tcx: TyCtxt<'tcx2>,
264264
orig_param_env: ParamEnv<'tcx>,
265265
target_def_id: DefId,
266266
target_substs: SubstsRef<'tcx>,
@@ -292,7 +292,7 @@ impl<'a, 'gcx, 'tcx> TypeComparisonContext<'a, 'gcx, 'tcx> {
292292
pub fn check_bounds_bidirectional<'tcx2>(
293293
&self,
294294
changes: &mut ChangeSet<'tcx2>,
295-
lift_tcx: TyCtxt<'tcx2, 'tcx2>,
295+
lift_tcx: TyCtxt<'tcx2>,
296296
orig_def_id: DefId,
297297
target_def_id: DefId,
298298
orig_substs: SubstsRef<'tcx>,

0 commit comments

Comments
 (0)