Skip to content

Commit 5af1c72

Browse files
committed
Adjust throw_validation_failure macro to shorten the use of with_no_trimmed_paths
1 parent 19fddc0 commit 5af1c72

File tree

1 file changed

+10
-13
lines changed

1 file changed

+10
-13
lines changed

compiler/rustc_mir/src/interpret/validity.rs

+10-13
Original file line numberDiff line numberDiff line change
@@ -26,25 +26,22 @@ use super::{
2626

2727
macro_rules! throw_validation_failure {
2828
($where:expr, { $( $what_fmt:expr ),+ } $( expected { $( $expected_fmt:expr ),+ } )?) => {{
29-
let (path, msg) = rustc_middle::ty::print::with_no_trimmed_paths(|| {
30-
let mut msg = String::new();
31-
msg.push_str("encountered ");
32-
write!(&mut msg, $($what_fmt),+).unwrap();
33-
$(
34-
msg.push_str(", but expected ");
35-
write!(&mut msg, $($expected_fmt),+).unwrap();
36-
)?
37-
29+
let mut msg = String::new();
30+
msg.push_str("encountered ");
31+
write!(&mut msg, $($what_fmt),+).unwrap();
32+
$(
33+
msg.push_str(", but expected ");
34+
write!(&mut msg, $($expected_fmt),+).unwrap();
35+
)?
36+
let path = rustc_middle::ty::print::with_no_trimmed_paths(|| {
3837
let where_ = &$where;
39-
let path = if !where_.is_empty() {
38+
if !where_.is_empty() {
4039
let mut path = String::new();
4140
write_path(&mut path, where_);
4241
Some(path)
4342
} else {
4443
None
45-
};
46-
47-
(path, msg)
44+
}
4845
});
4946
throw_ub!(ValidationFailure { path, msg })
5047
}};

0 commit comments

Comments
 (0)