From adf4bf25e1da1074d9b58b0e7808b1219ccfbe8e Mon Sep 17 00:00:00 2001 From: Igor Matuszewski Date: Tue, 17 Nov 2020 17:40:05 +0100 Subject: [PATCH 1/2] Fix breakage due to rust-lang/rust#70551 --- rust-toolchain | 2 +- src/mismatch.rs | 9 +++++++-- src/translate.rs | 9 ++++++--- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/rust-toolchain b/rust-toolchain index dce0ff04..39968240 100644 --- a/rust-toolchain +++ b/rust-toolchain @@ -1 +1 @@ -nightly-2020-06-16 +nightly-2020-06-23 diff --git a/src/mismatch.rs b/src/mismatch.rs index 76229d3f..d712ca37 100644 --- a/src/mismatch.rs +++ b/src/mismatch.rs @@ -133,9 +133,14 @@ impl<'a, 'tcx> TypeRelation<'tcx> for MismatchRelation<'a, 'tcx> { #[allow(clippy::similar_names)] fn tys(&mut self, a: Ty<'tcx>, b: Ty<'tcx>) -> RelateResult<'tcx, Ty<'tcx>> { use rustc_middle::ty::TyKind; + // NOTE: Because this pass doesn't really relate but walks and collects + // matching items on the side, it doesn't really matter what we return. + // Instead, return unit as dummy type (rather than an error type that + // could potentially short-circuit somewhere). + let dummy_type = self.tcx.types.unit; if self.current_old_types.contains(a) || self.current_new_types.contains(b) { - return Ok(self.tcx.types.err); + return Ok(dummy_type); } self.current_old_types.insert(a); @@ -279,7 +284,7 @@ impl<'a, 'tcx> TypeRelation<'tcx> for MismatchRelation<'a, 'tcx> { } } - Ok(self.tcx.types.err) + Ok(dummy_type) } fn regions( diff --git a/src/translate.rs b/src/translate.rs index e5be434c..70c7fde7 100644 --- a/src/translate.rs +++ b/src/translate.rs @@ -204,6 +204,9 @@ impl<'a, 'tcx> TranslationContext<'a, 'tcx> { let success = Cell::new(true); let err_pred = AutoTrait(DefId::local(CRATE_DEF_INDEX)); + // A `Self` within original bounds are to be substituted + // with a `trait_object_dummy_self`. + let dummy_self = self.tcx.types.trait_object_dummy_self; let res: Vec<_> = preds .iter() @@ -211,7 +214,7 @@ impl<'a, 'tcx> TranslationContext<'a, 'tcx> { match *p.skip_binder() { Trait(existential_trait_ref) => { let trait_ref = Binder::bind(existential_trait_ref) - .with_self_ty(self.tcx, self.tcx.types.err); + .with_self_ty(self.tcx, dummy_self); let did = trait_ref.skip_binder().def_id; let substs = trait_ref.skip_binder().substs; @@ -234,7 +237,7 @@ impl<'a, 'tcx> TranslationContext<'a, 'tcx> { } Projection(existential_projection) => { let projection_pred = Binder::bind(existential_projection) - .with_self_ty(self.tcx, self.tcx.types.err); + .with_self_ty(self.tcx, dummy_self); let item_def_id = projection_pred.skip_binder().projection_ty.item_def_id; let substs = @@ -561,7 +564,7 @@ impl<'a, 'tcx> TypeFolder<'tcx> for InferenceCleanupFolder<'a, 'tcx> { .tcx .mk_ref(self.infcx.tcx.lifetimes.re_erased, ty_and_mut) } - TyKind::Infer(_) => self.infcx.tcx.mk_ty(TyKind::Error), + TyKind::Infer(_) => self.infcx.tcx.ty_error(), _ => t1, } } From f6f75386b35c4c309151e4e5001655529e12b430 Mon Sep 17 00:00:00 2001 From: Igor Matuszewski Date: Tue, 17 Nov 2020 17:44:27 +0100 Subject: [PATCH 2/2] Bless log test snapshot --- tests/full_cases/log-0.3.4-0.3.8.linux | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tests/full_cases/log-0.3.4-0.3.8.linux b/tests/full_cases/log-0.3.4-0.3.8.linux index 6f0122e2..0525bec7 100644 --- a/tests/full_cases/log-0.3.4-0.3.8.linux +++ b/tests/full_cases/log-0.3.4-0.3.8.linux @@ -23,7 +23,7 @@ warning: technically breaking changes in ` as std::fmt::Debug | = note: trait impl generalized or newly added (technically breaking) -warning: technically breaking changes in ` as std::cmp::Eq>` +warning: technically breaking changes in ` as std::marker::StructuralEq>` --> log-0.3.8/src/lib.rs:552:10 | 552 | #[derive(Eq, PartialEq, Ord, PartialOrd, Hash, Debug)] @@ -71,7 +71,7 @@ warning: technically breaking changes in ` as std::fmt::Deb | = note: trait impl generalized or newly added (technically breaking) -warning: technically breaking changes in `` +warning: technically breaking changes in `` --> log-0.3.8/src/lib.rs:604:30 | 604 | #[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] @@ -157,5 +157,4 @@ warning: path changes to `ShutdownLoggerError` | = note: added definition (technically breaking) -warning: 18 warnings emitted - +warning: 18 warnings emitted \ No newline at end of file