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

Commit 0bdee60

Browse files
committed
Auto merge of #186 - JohnTitor:nightly-bump, r=Xanewok
Update to `nightly-2020-12-20` The first round of bumping our nightly version. 714fb0d changes our behavior but other changes shouldn't.
2 parents bd54d89 + 96a2919 commit 0bdee60

File tree

6 files changed

+83
-74
lines changed

6 files changed

+83
-74
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@ repository and compiled from source or installed from
2727
of the nightly toolchain is supported at any given time.
2828

2929
<!-- NOTE: Keep in sync with nightly date on rust-toolchain. -->
30-
It's recommended to use `nightly-2020-11-19` toolchain.
31-
You can install it by using `rustup install nightly-2020-11-19` if you already have rustup.
30+
It's recommended to use `nightly-2020-12-20` toolchain.
31+
You can install it by using `rustup install nightly-2020-12-20` if you already have rustup.
3232
Then you can do:
3333

3434
```sh
3535
$ rustup component add rustc-dev llvm-tools-preview --toolchain nightly-2020-11-19
36-
$ cargo +nightly-2020-11-19 install --git https://github.com/rust-lang/rust-semverver
36+
$ cargo +nightly-2020-12-20 install --git https://github.com/rust-lang/rust-semverver
3737
```
3838

3939
You'd also need `cmake` for some dependencies, and a few common libraries (if you hit

rust-toolchain

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# NOTE: Keep in sync with nightly date on README
22
[toolchain]
3-
channel = "nightly-2020-11-19"
3+
channel = "nightly-2020-12-20"
44
components = ["llvm-tools-preview", "rustc-dev"]

src/mismatch.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -308,8 +308,6 @@ impl<'a, 'tcx> TypeRelation<'tcx> for MismatchRelation<'a, 'tcx> {
308308
a: ty::Binder<T>,
309309
b: ty::Binder<T>,
310310
) -> RelateResult<'tcx, ty::Binder<T>> {
311-
Ok(ty::Binder::bind(
312-
self.relate(a.skip_binder(), b.skip_binder())?,
313-
))
311+
Ok(a.rebind(self.relate(a.skip_binder(), b.skip_binder())?))
314312
}
315313
}

src/translate.rs

Lines changed: 69 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -211,61 +211,72 @@ impl<'a, 'tcx> TranslationContext<'a, 'tcx> {
211211
let res: Vec<_> = preds
212212
.iter()
213213
.map(|p| {
214-
match p.skip_binder() {
215-
Trait(existential_trait_ref) => {
216-
let trait_ref = Binder::bind(existential_trait_ref)
217-
.with_self_ty(self.tcx, dummy_self);
218-
let did = trait_ref.skip_binder().def_id;
219-
let substs = trait_ref.skip_binder().substs;
220-
221-
// TODO: here, the substs could also be already translated
222-
if let Some((target_def_id, target_substs)) =
223-
self.translate_orig_substs(index_map, did, substs)
224-
{
225-
let target_trait_ref = TraitRef {
226-
def_id: target_def_id,
227-
substs: target_substs,
228-
};
229-
Trait(ExistentialTraitRef::erase_self_ty(
230-
self.tcx,
231-
target_trait_ref,
232-
))
233-
} else {
234-
success.set(false);
235-
err_pred
214+
p.map_bound(|p| {
215+
match p {
216+
Trait(existential_trait_ref) => {
217+
let trait_ref = Binder::bind(existential_trait_ref)
218+
.with_self_ty(self.tcx, dummy_self);
219+
let did = trait_ref.skip_binder().def_id;
220+
let substs = trait_ref.skip_binder().substs;
221+
222+
// TODO: here, the substs could also be already translated
223+
if let Some((target_def_id, target_substs)) =
224+
self.translate_orig_substs(index_map, did, substs)
225+
{
226+
let target_trait_ref = TraitRef {
227+
def_id: target_def_id,
228+
substs: target_substs,
229+
};
230+
Trait(ExistentialTraitRef::erase_self_ty(
231+
self.tcx,
232+
target_trait_ref,
233+
))
234+
} else {
235+
success.set(false);
236+
err_pred
237+
}
236238
}
237-
}
238-
Projection(existential_projection) => {
239-
let projection_pred = Binder::bind(existential_projection)
240-
.with_self_ty(self.tcx, dummy_self);
241-
let item_def_id =
242-
projection_pred.skip_binder().projection_ty.item_def_id;
243-
let substs =
244-
projection_pred.skip_binder().projection_ty.substs;
245-
246-
// TODO: here, the substs could also be already translated
247-
if let Some((target_def_id, target_substs)) = self
248-
.translate_orig_substs(index_map, item_def_id, substs)
249-
{
250-
Projection(ExistentialProjection {
251-
item_def_id: target_def_id,
252-
// TODO: should be it's own method in rustc
253-
substs: self.tcx.intern_substs(&target_substs[1..]),
254-
ty,
255-
})
256-
} else {
257-
success.set(false);
258-
err_pred
239+
Projection(existential_projection) => {
240+
let projection_pred =
241+
Binder::bind(existential_projection)
242+
.with_self_ty(self.tcx, dummy_self);
243+
let item_def_id = projection_pred
244+
.skip_binder()
245+
.projection_ty
246+
.item_def_id;
247+
let substs =
248+
projection_pred.skip_binder().projection_ty.substs;
249+
250+
// TODO: here, the substs could also be already translated
251+
if let Some((target_def_id, target_substs)) = self
252+
.translate_orig_substs(
253+
index_map,
254+
item_def_id,
255+
substs,
256+
)
257+
{
258+
Projection(ExistentialProjection {
259+
item_def_id: target_def_id,
260+
// TODO: should be it's own method in rustc
261+
substs: self
262+
.tcx
263+
.intern_substs(&target_substs[1..]),
264+
ty,
265+
})
266+
} else {
267+
success.set(false);
268+
err_pred
269+
}
259270
}
271+
AutoTrait(did) => AutoTrait(self.translate_orig(did)),
260272
}
261-
AutoTrait(did) => AutoTrait(self.translate_orig(did)),
262-
}
273+
})
263274
})
264275
.collect();
265276

266277
if success.get() {
267-
let target_preds = self.tcx.mk_existential_predicates(res.iter());
268-
self.tcx.mk_dynamic(Binder::bind(target_preds), region)
278+
let target_preds = self.tcx.mk_poly_existential_predicates(res.iter());
279+
self.tcx.mk_dynamic(target_preds, region)
269280
} else {
270281
ty
271282
}
@@ -365,12 +376,12 @@ impl<'a, 'tcx> TranslationContext<'a, 'tcx> {
365376
predicate: Predicate<'tcx>,
366377
) -> Option<Predicate<'tcx>> {
367378
use rustc_middle::ty::{
368-
OutlivesPredicate, PredicateAtom, PredicateKind, ProjectionPredicate, ProjectionTy,
369-
SubtypePredicate, ToPredicate, TraitPredicate, WithOptConstParam,
379+
Binder, OutlivesPredicate, PredicateAtom, PredicateKind, ProjectionPredicate,
380+
ProjectionTy, SubtypePredicate, ToPredicate, TraitPredicate, WithOptConstParam,
370381
};
371382

372383
Some(match predicate.skip_binders() {
373-
PredicateAtom::Trait(pred, constness) => PredicateAtom::Trait(
384+
PredicateAtom::Trait(pred, constness) => Binder::bind(PredicateAtom::Trait(
374385
if let Some((target_def_id, target_substs)) = self.translate_orig_substs(
375386
index_map,
376387
pred.trait_ref.def_id,
@@ -386,21 +397,21 @@ impl<'a, 'tcx> TranslationContext<'a, 'tcx> {
386397
return None;
387398
},
388399
constness,
389-
)
400+
))
390401
.potentially_quantified(self.tcx, PredicateKind::ForAll),
391-
PredicateAtom::RegionOutlives(pred) => PredicateAtom::RegionOutlives({
402+
PredicateAtom::RegionOutlives(pred) => Binder::bind(PredicateAtom::RegionOutlives({
392403
let l = self.translate_region(pred.0);
393404
let r = self.translate_region(pred.1);
394405
OutlivesPredicate(l, r)
395-
})
406+
}))
396407
.potentially_quantified(self.tcx, PredicateKind::ForAll),
397-
PredicateAtom::TypeOutlives(pred) => PredicateAtom::TypeOutlives({
408+
PredicateAtom::TypeOutlives(pred) => Binder::bind(PredicateAtom::TypeOutlives({
398409
let l = self.translate(index_map, pred.0);
399410
let r = self.translate_region(pred.1);
400411
OutlivesPredicate(l, r)
401-
})
412+
}))
402413
.potentially_quantified(self.tcx, PredicateKind::ForAll),
403-
PredicateAtom::Projection(pred) => PredicateAtom::Projection(
414+
PredicateAtom::Projection(pred) => Binder::bind(PredicateAtom::Projection(
404415
if let Some((target_def_id, target_substs)) = self.translate_orig_substs(
405416
index_map,
406417
pred.projection_ty.item_def_id,
@@ -416,7 +427,7 @@ impl<'a, 'tcx> TranslationContext<'a, 'tcx> {
416427
} else {
417428
return None;
418429
},
419-
)
430+
))
420431
.potentially_quantified(self.tcx, PredicateKind::ForAll),
421432
PredicateAtom::WellFormed(ty) => {
422433
PredicateAtom::WellFormed(self.translate(index_map, ty)).to_predicate(self.tcx)

src/typeck.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,14 +74,14 @@ impl<'a, 'tcx> BoundContext<'a, 'tcx> {
7474
/// Register the trait bound represented by a `TraitRef`.
7575
pub fn register_trait_ref(&mut self, checked_trait_ref: TraitRef<'tcx>) {
7676
use rustc_hir::Constness;
77-
use rustc_middle::ty::TraitPredicate;
77+
use rustc_middle::ty::{Binder, TraitPredicate};
7878

79-
let predicate = PredicateAtom::Trait(
79+
let predicate = Binder::bind(PredicateAtom::Trait(
8080
TraitPredicate {
8181
trait_ref: checked_trait_ref,
8282
},
8383
Constness::NotConst,
84-
)
84+
))
8585
.potentially_quantified(self.infcx.tcx, PredicateKind::ForAll);
8686
let obligation = Obligation::new(ObligationCause::dummy(), self.given_param_env, predicate);
8787
self.fulfill_cx

tests/cases/enums/stdout

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,32 +73,32 @@ warning: variant with no public fields changed to a tuple variant (breaking)
7373
|
7474
19 | Abc(u8),
7575
| ^^^^^^^
76-
warning: variant with no public fields changed to a tuple variant (breaking)
76+
warning: variant with public fields changed to a tuple variant (breaking)
7777
--> enums/new.rs:20:5
7878
|
7979
20 | Bcd,
8080
| ^^^
81-
warning: variant with no public fields changed to a struct variant (breaking)
81+
warning: variant with public fields changed to a struct variant (breaking)
8282
--> enums/new.rs:21:5
8383
|
8484
21 | Cde { f: u8 },
8585
| ^^^^^^^^^^^^^
86-
warning: variant with no public fields changed to a tuple variant (breaking)
86+
warning: variant with public fields changed to a tuple variant (breaking)
8787
--> enums/new.rs:22:5
8888
|
8989
22 | Def,
9090
| ^^^
91-
warning: variant with no public fields changed to a struct variant (breaking)
91+
warning: variant with public fields changed to a struct variant (breaking)
9292
--> enums/new.rs:23:5
9393
|
9494
23 | Efg { f: u8 },
9595
| ^^^^^^^^^^^^^
96-
warning: private field removed from variant with private fields (breaking)
96+
warning: public field removed from variant with no private fields (breaking)
9797
--> enums/old.rs:25:11
9898
|
9999
25 | Ghi { f: u8 },
100100
| ^^^^^
101-
note: private field added to variant with private fields (non-breaking)
101+
warning: public field added to variant with no private fields (breaking)
102102
--> enums/new.rs:25:11
103103
|
104104
25 | Ghi { g: u8 },

0 commit comments

Comments
 (0)