]> git.lizzy.rs Git - rust.git/commitdiff
Use type-based qualification for statics
authorDylan MacKenzie <ecstaticmorse@gmail.com>
Fri, 22 Nov 2019 23:52:08 +0000 (15:52 -0800)
committerDylan MacKenzie <ecstaticmorse@gmail.com>
Wed, 27 Nov 2019 21:07:19 +0000 (13:07 -0800)
src/librustc_mir/transform/check_consts/qualifs.rs

index 9ed1ca740b8e727e94853f61dc622743d94156a9..85e4c8c91f47cc631dd9bea0c765e86eadd9f51e 100644 (file)
@@ -33,9 +33,10 @@ pub trait Qualif {
     /// of the type.
     fn in_any_value_of_ty(_cx: &ConstCx<'_, 'tcx>, _ty: Ty<'tcx>) -> bool;
 
-    fn in_static(_cx: &ConstCx<'_, 'tcx>, _def_id: DefId) -> bool {
-        // FIXME(eddyb) should we do anything here for value properties?
-        false
+    fn in_static(cx: &ConstCx<'_, 'tcx>, def_id: DefId) -> bool {
+        // `mir_const_qualif` does return the qualifs in the final value of a `static`, so we could
+        // use value-based qualification here, but we shouldn't do this without a good reason.
+        Self::in_any_value_of_ty(cx, cx.tcx.type_of(def_id))
     }
 
     fn in_projection_structurally(