Skip to content

Commit 0905e42

Browse files
committed
1 parent a3657c0 commit 0905e42

File tree

5 files changed

+93
-99
lines changed

5 files changed

+93
-99
lines changed

README.md

Lines changed: 4 additions & 4 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-2021-09-30` toolchain.
31-
You can install it by using `rustup install nightly-2021-09-30` if you already have rustup.
30+
It's recommended to use `nightly-2021-10-15` toolchain.
31+
You can install it by using `rustup install nightly-2021-10-15` if you already have rustup.
3232
Then you can do:
3333

3434
```sh
35-
$ rustup component add rustc-dev llvm-tools-preview --toolchain nightly-2021-09-30
36-
$ cargo +nightly-2021-09-30 install --git https://github.com/rust-lang/rust-semverver
35+
$ rustup component add rustc-dev llvm-tools-preview --toolchain nightly-2021-10-15
36+
$ cargo +nightly-2021-10-15 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-2021-09-30"
3+
channel = "nightly-2021-10-15"
44
components = ["llvm-tools-preview", "rustc-dev"]

src/translate.rs

Lines changed: 85 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -376,102 +376,97 @@ impl<'a, 'tcx> TranslationContext<'a, 'tcx> {
376376
predicate: Predicate<'tcx>,
377377
) -> Option<Predicate<'tcx>> {
378378
use rustc_middle::ty::{
379-
CoercePredicate, OutlivesPredicate, PredicateKind, ProjectionPredicate, ProjectionTy,
380-
self, SubtypePredicate, ToPredicate, TraitPredicate, WithOptConstParam,
379+
self, CoercePredicate, OutlivesPredicate, PredicateKind, ProjectionPredicate,
380+
ProjectionTy, SubtypePredicate, ToPredicate, TraitPredicate, WithOptConstParam,
381381
};
382382

383383
let pred = match predicate.kind().skip_binder() {
384-
PredicateKind::Trait(pred) => PredicateKind::Trait(
385-
if let Some((target_def_id, target_substs)) = self.translate_orig_substs(
386-
index_map,
387-
pred.trait_ref.def_id,
388-
pred.trait_ref.substs,
389-
) {
390-
TraitPredicate {
391-
trait_ref: TraitRef {
392-
def_id: target_def_id,
393-
substs: target_substs,
394-
},
395-
constness: pred.constness,
396-
}
397-
} else {
398-
return None;
399-
},
400-
),
401-
PredicateKind::RegionOutlives(pred) => PredicateKind::RegionOutlives({
402-
let l = self.translate_region(pred.0);
403-
let r = self.translate_region(pred.1);
404-
OutlivesPredicate(l, r)
405-
}),
406-
PredicateKind::TypeOutlives(pred) => PredicateKind::TypeOutlives({
407-
let l = self.translate(index_map, pred.0);
408-
let r = self.translate_region(pred.1);
409-
OutlivesPredicate(l, r)
410-
}),
411-
PredicateKind::Projection(pred) => PredicateKind::Projection(
412-
if let Some((target_def_id, target_substs)) = self.translate_orig_substs(
413-
index_map,
414-
pred.projection_ty.item_def_id,
415-
pred.projection_ty.substs,
416-
) {
417-
ProjectionPredicate {
418-
projection_ty: ProjectionTy {
419-
substs: target_substs,
420-
item_def_id: target_def_id,
421-
},
422-
ty: self.translate(index_map, pred.ty),
423-
}
424-
} else {
425-
return None;
426-
},
427-
),
428-
PredicateKind::WellFormed(ty) => {
429-
PredicateKind::WellFormed(self.translate(index_map, ty))
430-
}
431-
PredicateKind::ObjectSafe(did) => {
432-
PredicateKind::ObjectSafe(self.translate_orig(did))
433-
}
434-
PredicateKind::ClosureKind(did, substs, kind) => PredicateKind::ClosureKind(
435-
self.translate_orig(did),
436-
self.translate(index_map, substs),
437-
kind,
438-
),
439-
PredicateKind::Subtype(pred) => PredicateKind::Subtype({
440-
let l = self.translate(index_map, pred.a);
441-
let r = self.translate(index_map, pred.b);
442-
SubtypePredicate {
443-
a_is_expected: pred.a_is_expected,
444-
a: l,
445-
b: r,
384+
PredicateKind::Trait(pred) => PredicateKind::Trait(
385+
if let Some((target_def_id, target_substs)) = self.translate_orig_substs(
386+
index_map,
387+
pred.trait_ref.def_id,
388+
pred.trait_ref.substs,
389+
) {
390+
TraitPredicate {
391+
trait_ref: TraitRef {
392+
def_id: target_def_id,
393+
substs: target_substs,
394+
},
395+
constness: pred.constness,
446396
}
447-
}),
448-
PredicateKind::Coerce(pred) => PredicateKind::Coerce({
449-
let a = self.translate(index_map, pred.a);
450-
let b = self.translate(index_map, pred.b);
451-
CoercePredicate { a, b }
452-
}),
453-
PredicateKind::ConstEvaluatable(uv) => {
454-
if let Some((target_def_id, target_substs)) =
455-
self.translate_orig_substs(index_map, uv.def.did, uv.substs(self.tcx))
456-
{
457-
// TODO: We could probably use translated version for
458-
// `WithOptConstParam::const_param_did`
459-
let const_param = WithOptConstParam::unknown(target_def_id);
460-
PredicateKind::ConstEvaluatable(Unevaluated::new(
461-
const_param,
462-
target_substs,
463-
))
464-
} else {
465-
return None;
397+
} else {
398+
return None;
399+
},
400+
),
401+
PredicateKind::RegionOutlives(pred) => PredicateKind::RegionOutlives({
402+
let l = self.translate_region(pred.0);
403+
let r = self.translate_region(pred.1);
404+
OutlivesPredicate(l, r)
405+
}),
406+
PredicateKind::TypeOutlives(pred) => PredicateKind::TypeOutlives({
407+
let l = self.translate(index_map, pred.0);
408+
let r = self.translate_region(pred.1);
409+
OutlivesPredicate(l, r)
410+
}),
411+
PredicateKind::Projection(pred) => PredicateKind::Projection(
412+
if let Some((target_def_id, target_substs)) = self.translate_orig_substs(
413+
index_map,
414+
pred.projection_ty.item_def_id,
415+
pred.projection_ty.substs,
416+
) {
417+
ProjectionPredicate {
418+
projection_ty: ProjectionTy {
419+
substs: target_substs,
420+
item_def_id: target_def_id,
421+
},
422+
ty: self.translate(index_map, pred.ty),
466423
}
424+
} else {
425+
return None;
426+
},
427+
),
428+
PredicateKind::WellFormed(ty) => {
429+
PredicateKind::WellFormed(self.translate(index_map, ty))
430+
}
431+
PredicateKind::ObjectSafe(did) => PredicateKind::ObjectSafe(self.translate_orig(did)),
432+
PredicateKind::ClosureKind(did, substs, kind) => PredicateKind::ClosureKind(
433+
self.translate_orig(did),
434+
self.translate(index_map, substs),
435+
kind,
436+
),
437+
PredicateKind::Subtype(pred) => PredicateKind::Subtype({
438+
let l = self.translate(index_map, pred.a);
439+
let r = self.translate(index_map, pred.b);
440+
SubtypePredicate {
441+
a_is_expected: pred.a_is_expected,
442+
a: l,
443+
b: r,
467444
}
468-
PredicateKind::ConstEquate(c1, c2) => PredicateKind::ConstEquate(
469-
self.translate(index_map, c1),
470-
self.translate(index_map, c2),
471-
),
472-
// NOTE: Only used for Chalk trait solver
473-
PredicateKind::TypeWellFormedFromEnv(_) => unimplemented!(),
474-
};
445+
}),
446+
PredicateKind::Coerce(pred) => PredicateKind::Coerce({
447+
let a = self.translate(index_map, pred.a);
448+
let b = self.translate(index_map, pred.b);
449+
CoercePredicate { a, b }
450+
}),
451+
PredicateKind::ConstEvaluatable(uv) => {
452+
if let Some((target_def_id, target_substs)) =
453+
self.translate_orig_substs(index_map, uv.def.did, uv.substs(self.tcx))
454+
{
455+
// TODO: We could probably use translated version for
456+
// `WithOptConstParam::const_param_did`
457+
let const_param = WithOptConstParam::unknown(target_def_id);
458+
PredicateKind::ConstEvaluatable(Unevaluated::new(const_param, target_substs))
459+
} else {
460+
return None;
461+
}
462+
}
463+
PredicateKind::ConstEquate(c1, c2) => PredicateKind::ConstEquate(
464+
self.translate(index_map, c1),
465+
self.translate(index_map, c2),
466+
),
467+
// NOTE: Only used for Chalk trait solver
468+
PredicateKind::TypeWellFormedFromEnv(_) => unimplemented!(),
469+
};
475470

476471
Some(ty::Binder::dummy(pred).to_predicate(self.tcx))
477472
}

src/traverse.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ use crate::{
1717
typeck::{BoundContext, TypeComparisonContext},
1818
};
1919
use log::{debug, info};
20-
use rustc_const_eval::const_eval::is_const_fn;
2120
use rustc_hir::def::{CtorKind, CtorOf, DefKind, Res, Res::Def};
2221
use rustc_hir::def_id::DefId;
2322
use rustc_hir::hir_id::HirId;
@@ -363,8 +362,8 @@ fn diff_fn<'tcx>(changes: &mut ChangeSet, tcx: TyCtxt<'tcx>, old: Res, new: Res)
363362
let old_def_id = old.def_id();
364363
let new_def_id = new.def_id();
365364

366-
let old_const = is_const_fn(tcx, old_def_id);
367-
let new_const = is_const_fn(tcx, new_def_id);
365+
let old_const = tcx.is_const_fn(old_def_id);
366+
let new_const = tcx.is_const_fn(new_def_id);
368367

369368
if old_const != new_const {
370369
changes.add_change(

src/typeck.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ impl<'a, 'tcx> BoundContext<'a, 'tcx> {
7272

7373
/// Register the trait bound represented by a `TraitRef`.
7474
pub fn register_trait_ref(&mut self, checked_trait_ref: TraitRef<'tcx>) {
75-
use rustc_middle::ty::{BoundConstness, self, ToPredicate, TraitPredicate};
75+
use rustc_middle::ty::{self, BoundConstness, ToPredicate, TraitPredicate};
7676

7777
let predicate = ty::Binder::dummy(PredicateKind::Trait(TraitPredicate {
7878
trait_ref: checked_trait_ref,

0 commit comments

Comments
 (0)