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

Rustup to the latest nightly #124

Merged
merged 3 commits into from
May 25, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions ci/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ export RUST_BACKTRACE=full

cargo +nightly install rustup-toolchain-install-master
if [ "${TRAVIS_OS_NAME}" = "windows" ]; then
rustup-toolchain-install-master -f -n master -c rustc-dev -i x86_64-pc-windows-msvc
rustup-toolchain-install-master -f -n master -c rustc-dev -c llvm-tools -i x86_64-pc-windows-msvc
else
rustup-toolchain-install-master -f -n master -c rustc-dev
rustup-toolchain-install-master -f -n master -c rustc-dev -c llvm-tools
fi
rustup override set master

Expand Down
94 changes: 54 additions & 40 deletions src/translate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -362,12 +362,12 @@ impl<'a, 'tcx> TranslationContext<'a, 'tcx> {
predicate: Predicate<'tcx>,
) -> Option<Predicate<'tcx>> {
use rustc_middle::ty::{
Binder, OutlivesPredicate, ProjectionPredicate, ProjectionTy, SubtypePredicate,
TraitPredicate,
Binder, OutlivesPredicate, PredicateKind, ProjectionPredicate, ProjectionTy,
SubtypePredicate, ToPredicate, TraitPredicate,
};

Some(match predicate {
Predicate::Trait(trait_predicate, constness) => Predicate::Trait(
Some(match predicate.kind() {
PredicateKind::Trait(trait_predicate, constness) => PredicateKind::Trait(
Binder::bind(
if let Some((target_def_id, target_substs)) = self.translate_orig_substs(
index_map,
Expand All @@ -384,48 +384,59 @@ impl<'a, 'tcx> TranslationContext<'a, 'tcx> {
return None;
},
),
constness,
),
Predicate::RegionOutlives(region_outlives_predicate) => {
Predicate::RegionOutlives(region_outlives_predicate.map_bound(|r_pred| {
*constness,
)
.to_predicate(self.tcx),
PredicateKind::RegionOutlives(region_outlives_predicate) => {
PredicateKind::RegionOutlives(region_outlives_predicate.map_bound(|r_pred| {
let l = self.translate_region(r_pred.0);
let r = self.translate_region(r_pred.1);
OutlivesPredicate(l, r)
}))
.to_predicate(self.tcx)
}
Predicate::TypeOutlives(type_outlives_predicate) => {
Predicate::TypeOutlives(type_outlives_predicate.map_bound(|r_pred| {
PredicateKind::TypeOutlives(type_outlives_predicate) => {
PredicateKind::TypeOutlives(type_outlives_predicate.map_bound(|r_pred| {
let l = self.translate(index_map, &r_pred.0);
let r = self.translate_region(r_pred.1);
OutlivesPredicate(l, r)
}))
.to_predicate(self.tcx)
}
Predicate::Projection(projection_predicate) => Predicate::Projection(Binder::bind(
if let Some((target_def_id, target_substs)) = self.translate_orig_substs(
index_map,
projection_predicate.skip_binder().projection_ty.item_def_id,
projection_predicate.skip_binder().projection_ty.substs,
) {
ProjectionPredicate {
projection_ty: ProjectionTy {
substs: target_substs,
item_def_id: target_def_id,
},
ty: self.translate(index_map, &projection_predicate.skip_binder().ty),
}
} else {
return None;
},
)),
Predicate::WellFormed(ty) => Predicate::WellFormed(self.translate(index_map, &ty)),
Predicate::ObjectSafe(did) => Predicate::ObjectSafe(self.translate_orig(did)),
Predicate::ClosureKind(did, substs, kind) => Predicate::ClosureKind(
self.translate_orig(did),
PredicateKind::Projection(projection_predicate) => {
PredicateKind::Projection(Binder::bind(
if let Some((target_def_id, target_substs)) = self.translate_orig_substs(
index_map,
projection_predicate.skip_binder().projection_ty.item_def_id,
projection_predicate.skip_binder().projection_ty.substs,
) {
ProjectionPredicate {
projection_ty: ProjectionTy {
substs: target_substs,
item_def_id: target_def_id,
},
ty: self.translate(index_map, &projection_predicate.skip_binder().ty),
}
} else {
return None;
},
))
.to_predicate(self.tcx)
}
PredicateKind::WellFormed(ty) => {
PredicateKind::WellFormed(self.translate(index_map, &ty)).to_predicate(self.tcx)
}
PredicateKind::ObjectSafe(did) => {
PredicateKind::ObjectSafe(self.translate_orig(*did)).to_predicate(self.tcx)
}
PredicateKind::ClosureKind(did, substs, kind) => PredicateKind::ClosureKind(
self.translate_orig(*did),
self.translate(index_map, &substs),
kind,
),
Predicate::Subtype(subtype_predicate) => {
Predicate::Subtype(subtype_predicate.map_bound(|s_pred| {
*kind,
)
.to_predicate(self.tcx),
PredicateKind::Subtype(subtype_predicate) => {
PredicateKind::Subtype(subtype_predicate.map_bound(|s_pred| {
let l = self.translate(index_map, &s_pred.a);
let r = self.translate(index_map, &s_pred.b);
SubtypePredicate {
Expand All @@ -434,20 +445,23 @@ impl<'a, 'tcx> TranslationContext<'a, 'tcx> {
b: r,
}
}))
.to_predicate(self.tcx)
}
Predicate::ConstEvaluatable(orig_did, orig_substs) => {
PredicateKind::ConstEvaluatable(orig_did, orig_substs) => {
if let Some((target_def_id, target_substs)) =
self.translate_orig_substs(index_map, orig_did, orig_substs)
self.translate_orig_substs(index_map, *orig_did, orig_substs)
{
Predicate::ConstEvaluatable(target_def_id, target_substs)
PredicateKind::ConstEvaluatable(target_def_id, target_substs)
.to_predicate(self.tcx)
} else {
return None;
}
}
Predicate::ConstEquate(c1, c2) => Predicate::ConstEquate(
PredicateKind::ConstEquate(c1, c2) => PredicateKind::ConstEquate(
self.translate(index_map, &c1),
self.translate(index_map, &c2),
),
)
.to_predicate(self.tcx),
})
}

Expand Down
4 changes: 2 additions & 2 deletions src/traverse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,7 @@ fn diff_traits<'tcx>(
) {
use rustc_hir::Unsafety::Unsafe;
use rustc_middle::ty::subst::GenericArgKind::Type;
use rustc_middle::ty::{ParamTy, Predicate, TyS};
use rustc_middle::ty::{ParamTy, PredicateKind, TyS};

debug!(
"diff_traits: old: {:?}, new: {:?}, output: {:?}",
Expand All @@ -592,7 +592,7 @@ fn diff_traits<'tcx>(
let old_param_env = tcx.param_env(old);

for bound in old_param_env.caller_bounds {
if let Predicate::Trait(pred, _) = *bound {
if let PredicateKind::Trait(pred, _) = *bound.kind() {
let trait_ref = pred.skip_binder().trait_ref;

debug!("trait_ref substs (old): {:?}", trait_ref.substs);
Expand Down
10 changes: 4 additions & 6 deletions src/typeck.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use rustc_middle::{
error::TypeError,
fold::TypeFoldable,
subst::{GenericArg, InternalSubsts, SubstsRef},
GenericParamDefKind, ParamEnv, Predicate, TraitRef, Ty, TyCtxt,
GenericParamDefKind, ParamEnv, Predicate, PredicateKind, ToPredicate, TraitRef, Ty, TyCtxt,
},
};
use rustc_trait_selection::traits::FulfillmentContext;
Expand Down Expand Up @@ -75,12 +75,13 @@ impl<'a, 'tcx> BoundContext<'a, 'tcx> {
use rustc_hir::Constness;
use rustc_middle::ty::{Binder, TraitPredicate};

let predicate = Predicate::Trait(
let predicate = PredicateKind::Trait(
Binder::bind(TraitPredicate {
trait_ref: checked_trait_ref,
}),
Constness::NotConst,
);
)
.to_predicate(self.infcx.tcx);
let obligation = Obligation::new(ObligationCause::dummy(), self.given_param_env, predicate);
self.fulfill_cx
.register_predicate_obligation(self.infcx, obligation);
Expand Down Expand Up @@ -218,7 +219,6 @@ impl<'a, 'tcx> TypeComparisonContext<'a, 'tcx> {
) -> Option<TypeError<'tcx2>> {
use rustc_infer::infer::outlives::env::OutlivesEnvironment;
use rustc_infer::infer::{InferOk, RegionckMode};
use rustc_middle::middle::region::ScopeTree;
use rustc_middle::ty::Lift;

let error = self
Expand All @@ -230,7 +230,6 @@ impl<'a, 'tcx> TypeComparisonContext<'a, 'tcx> {
});

if let Err(err) = error {
let scope_tree = ScopeTree::default();
let outlives_env = OutlivesEnvironment::new(target_param_env);

// The old code here added the bounds from the target param env by hand. However, at
Expand All @@ -246,7 +245,6 @@ impl<'a, 'tcx> TypeComparisonContext<'a, 'tcx> {

self.infcx.resolve_regions_and_report_errors(
target_def_id,
&scope_tree,
&outlives_env,
RegionckMode::default(),
);
Expand Down
4 changes: 2 additions & 2 deletions tests/full_cases/log-0.3.4-0.3.8.osx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ warning: technically breaking changes in `<new::LogRecord<'a> as std::fmt::Debug
|
= note: trait impl generalized or newly added (technically breaking)

warning: technically breaking changes in `<new::LogMetadata<'a> as std::cmp::Eq>`
warning: technically breaking changes in `<new::LogMetadata<'a> as std::marker::StructuralEq>`
--> log-0.3.8/src/lib.rs:552:10
|
552 | #[derive(Eq, PartialEq, Ord, PartialOrd, Hash, Debug)]
Expand Down Expand Up @@ -71,7 +71,7 @@ warning: technically breaking changes in `<new::LogMetadata<'a> as std::fmt::Deb
|
= note: trait impl generalized or newly added (technically breaking)

warning: technically breaking changes in `<new::LogLocation as std::cmp::Eq>`
warning: technically breaking changes in `<new::LogLocation as std::marker::StructuralEq>`
--> log-0.3.8/src/lib.rs:604:30
|
604 | #[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
Expand Down