about summary refs log tree commit diff
path: root/compiler/rustc_const_eval
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-05-02 03:42:37 +0000
committerbors <bors@rust-lang.org>2023-05-02 03:42:37 +0000
commit5133e154590991203c84702ef59482f729b19bbf (patch)
treeb2d075cd5993b4d9d8d327ff278f5e0a6e61faaf /compiler/rustc_const_eval
parent1cb63572d271855a5ccef79a3e10a8015d00f6ad (diff)
parentd1bd1be66834d166a9cf509250ffad1de8ff2709 (diff)
downloadrust-5133e154590991203c84702ef59482f729b19bbf.tar.gz
rust-5133e154590991203c84702ef59482f729b19bbf.zip
Auto merge of #109521 - tmiasko:const-prop-validation, r=wesleywiser
Don't validate constants in const propagation

Validation is neither necessary nor desirable.

The constant validation is already omitted at mir-opt-level >= 3, so there there are not changes in MIR test output (the propagation of invalid constants is covered by an existing test in tests/mir-opt/const_prop/invalid_constant.rs).
Diffstat (limited to 'compiler/rustc_const_eval')
-rw-r--r--compiler/rustc_const_eval/src/interpret/validity.rs18
1 files changed, 8 insertions, 10 deletions
diff --git a/compiler/rustc_const_eval/src/interpret/validity.rs b/compiler/rustc_const_eval/src/interpret/validity.rs
index e06b634cdc3..01b77289937 100644
--- a/compiler/rustc_const_eval/src/interpret/validity.rs
+++ b/compiler/rustc_const_eval/src/interpret/validity.rs
@@ -38,16 +38,14 @@ macro_rules! throw_validation_failure {
             msg.push_str(", but expected ");
             write!(&mut msg, $($expected_fmt)*).unwrap();
         )?
-        let path = rustc_middle::ty::print::with_no_trimmed_paths!({
-            let where_ = &$where;
-            if !where_.is_empty() {
-                let mut path = String::new();
-                write_path(&mut path, where_);
-                Some(path)
-            } else {
-                None
-            }
-        });
+        let where_ = &$where;
+        let path = if !where_.is_empty() {
+            let mut path = String::new();
+            write_path(&mut path, where_);
+            Some(path)
+        } else {
+            None
+        };
         throw_ub!(ValidationFailure { path, msg })
     }};
 }