about summary refs log tree commit diff
path: root/src/librustc_mir/transform
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2017-11-30 08:00:27 +0000
committerbors <bors@rust-lang.org>2017-11-30 08:00:27 +0000
commitd6b010f98beae1591ea6e8e21008de97d6cf5be4 (patch)
treea315199382419e26b6c66078e7d3f348dffb0adf /src/librustc_mir/transform
parent909b94b5cceb046a7a3aa7134be1a3e25f75fec4 (diff)
parentebd219ab8e7be56020436f9c6d6a44c6d4f4a5cf (diff)
downloadrust-d6b010f98beae1591ea6e8e21008de97d6cf5be4.tar.gz
rust-d6b010f98beae1591ea6e8e21008de97d6cf5be4.zip
Auto merge of #46226 - arielb1:special-region-obligation, r=nikomatsakis
avoid type-live-for-region obligations on dummy nodes

Type-live-for-region obligations on DUMMY_NODE_ID cause an ICE, and it
turns out that in the few cases they are needed, these obligations are not
needed anyway because they are verified elsewhere.

Fixes #46069.

Beta-nominating because this is a regression for our new beta.
r? @nikomatsakis
Diffstat (limited to 'src/librustc_mir/transform')
-rw-r--r--src/librustc_mir/transform/nll/constraint_generation.rs13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/librustc_mir/transform/nll/constraint_generation.rs b/src/librustc_mir/transform/nll/constraint_generation.rs
index 1f905d32f84..479680cc7fe 100644
--- a/src/librustc_mir/transform/nll/constraint_generation.rs
+++ b/src/librustc_mir/transform/nll/constraint_generation.rs
@@ -152,10 +152,17 @@ impl<'cx, 'gcx, 'tcx> ConstraintGeneration<'cx, 'gcx, 'tcx> {
             // associated types and parameters). We need to normalize
             // associated types here and possibly recursively process.
             for ty in dtorck_types {
-                // FIXME -- I think that this may disregard some region obligations
-                // or something. Do we care? -nmatsakis
                 let cause = ObligationCause::dummy();
-                match traits::fully_normalize(self.infcx, cause, self.param_env, &ty) {
+                // We know that our original `dropped_ty` is well-formed,
+                // so region obligations resulting from this normalization
+                // should always hold.
+                //
+                // Therefore we ignore them instead of trying to match
+                // them up with a location.
+                let fulfillcx = traits::FulfillmentContext::new_ignoring_regions();
+                match traits::fully_normalize_with_fulfillcx(
+                    self.infcx, fulfillcx, cause, self.param_env, &ty
+                ) {
                     Ok(ty) => match ty.sty {
                         ty::TyParam(..) | ty::TyProjection(..) | ty::TyAnon(..) => {
                             self.add_regular_live_constraint(ty, location);