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

Commit 523a3c7

Browse files
committed
1 parent 2d603a2 commit 523a3c7

File tree

4 files changed

+21
-14
lines changed

4 files changed

+21
-14
lines changed

README.md

+4-4
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-08-16` toolchain.
31-
You can install it by using `rustup install nightly-2021-08-16` if you already have rustup.
30+
It's recommended to use `nightly-2021-08-31` toolchain.
31+
You can install it by using `rustup install nightly-2021-08-31` 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-08-16
36-
$ cargo +nightly-2021-08-16 install --git https://github.com/rust-lang/rust-semverver
35+
$ rustup component add rustc-dev llvm-tools-preview --toolchain nightly-2021-08-31
36+
$ cargo +nightly-2021-08-31 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

+1-1
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-08-16"
3+
channel = "nightly-2021-08-31"
44
components = ["llvm-tools-preview", "rustc-dev"]

src/translate.rs

+14-6
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use rustc_infer::infer::InferCtxt;
88
use rustc_middle::ty::{
99
fold::{BottomUpFolder, TypeFoldable, TypeFolder},
1010
subst::{GenericArg, InternalSubsts, SubstsRef},
11-
GenericParamDefKind, ParamEnv, Predicate, Region, TraitRef, Ty, TyCtxt,
11+
GenericParamDefKind, ParamEnv, Predicate, Region, TraitRef, Ty, TyCtxt, Unevaluated,
1212
};
1313
use std::collections::HashMap;
1414

@@ -376,8 +376,8 @@ impl<'a, 'tcx> TranslationContext<'a, 'tcx> {
376376
predicate: Predicate<'tcx>,
377377
) -> Option<Predicate<'tcx>> {
378378
use rustc_middle::ty::{
379-
OutlivesPredicate, PredicateKind, ProjectionPredicate, ProjectionTy, SubtypePredicate,
380-
ToPredicate, TraitPredicate, WithOptConstParam,
379+
CoercePredicate, OutlivesPredicate, PredicateKind, ProjectionPredicate, ProjectionTy,
380+
SubtypePredicate, ToPredicate, TraitPredicate, WithOptConstParam,
381381
};
382382

383383
Some(
@@ -446,14 +446,22 @@ impl<'a, 'tcx> TranslationContext<'a, 'tcx> {
446446
b: r,
447447
}
448448
}),
449-
PredicateKind::ConstEvaluatable(param, orig_substs) => {
449+
PredicateKind::Coerce(pred) => PredicateKind::Coerce({
450+
let a = self.translate(index_map, pred.a);
451+
let b = self.translate(index_map, pred.b);
452+
CoercePredicate { a, b }
453+
}),
454+
PredicateKind::ConstEvaluatable(uv) => {
450455
if let Some((target_def_id, target_substs)) =
451-
self.translate_orig_substs(index_map, param.did, orig_substs)
456+
self.translate_orig_substs(index_map, uv.def.did, uv.substs(self.tcx))
452457
{
453458
// TODO: We could probably use translated version for
454459
// `WithOptConstParam::const_param_did`
455460
let const_param = WithOptConstParam::unknown(target_def_id);
456-
PredicateKind::ConstEvaluatable(const_param, target_substs)
461+
PredicateKind::ConstEvaluatable(Unevaluated::new(
462+
const_param,
463+
target_substs,
464+
))
457465
} else {
458466
return None;
459467
}

src/typeck.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,11 @@ 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_hir::Constness;
76-
use rustc_middle::ty::{ToPredicate, TraitPredicate};
75+
use rustc_middle::ty::{BoundConstness, ToPredicate, TraitPredicate};
7776

7877
let predicate = PredicateKind::Trait(TraitPredicate {
7978
trait_ref: checked_trait_ref,
80-
constness: Constness::NotConst,
79+
constness: BoundConstness::NotConst,
8180
})
8281
.to_predicate(self.infcx.tcx);
8382
let obligation = Obligation::new(ObligationCause::dummy(), self.given_param_env, predicate);

0 commit comments

Comments
 (0)