]> git.proxmox.com Git - rustc.git/blobdiff - compiler/rustc_passes/src/check_const.rs
New upstream version 1.69.0+dfsg1
[rustc.git] / compiler / rustc_passes / src / check_const.rs
index aa726d6cd92aad0b9a7ce3374f23c64c944fe7d1..526b829bf676ae2e952cbcad78e3a21fe666817d 100644 (file)
@@ -17,7 +17,7 @@ use rustc_middle::ty::TyCtxt;
 use rustc_session::parse::feature_err;
 use rustc_span::{sym, Span, Symbol};
 
-use crate::errors::ExprNotAllowedInContext;
+use crate::errors::{ExprNotAllowedInContext, SkippingConstChecks};
 
 /// An expression that is not *always* legal in a const context.
 #[derive(Clone, Copy)]
@@ -48,7 +48,7 @@ impl NonConstExpr {
             Self::Match(TryDesugar) => &[sym::const_try],
 
             // All other expressions are allowed.
-            Self::Loop(Loop | While) | Self::Match(Normal) => &[],
+            Self::Loop(Loop | While) | Self::Match(Normal | FormatArgs) => &[],
         };
 
         Some(gates)
@@ -124,7 +124,7 @@ impl<'tcx> CheckConstVisitor<'tcx> {
             // corresponding feature gate. This encourages nightly users to use feature gates when
             // possible.
             None if tcx.sess.opts.unstable_opts.unleash_the_miri_inside_of_you => {
-                tcx.sess.span_warn(span, "skipping const checks");
+                tcx.sess.emit_warning(SkippingConstChecks { span });
                 return;
             }