Skip to content

Commit bc41973

Browse files
committed
Use trimmed paths in constantant validation errors
The constant validation errors are user facing and should always be emitted to the user - use trimmed path when constructing them.
1 parent 6a8fcdc commit bc41973

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

compiler/rustc_const_eval/src/interpret/validity.rs

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,14 @@ macro_rules! throw_validation_failure {
3838
msg.push_str(", but expected ");
3939
write!(&mut msg, $($expected_fmt)*).unwrap();
4040
)?
41-
let path = rustc_middle::ty::print::with_no_trimmed_paths!({
42-
let where_ = &$where;
43-
if !where_.is_empty() {
44-
let mut path = String::new();
45-
write_path(&mut path, where_);
46-
Some(path)
47-
} else {
48-
None
49-
}
50-
});
41+
let where_ = &$where;
42+
let path = if !where_.is_empty() {
43+
let mut path = String::new();
44+
write_path(&mut path, where_);
45+
Some(path)
46+
} else {
47+
None
48+
};
5149
throw_ub!(ValidationFailure { path, msg })
5250
}};
5351
}

0 commit comments

Comments
 (0)