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.
This commit is contained in:
parent
6a8fcdc597
commit
bc41973e35
1 changed files with 8 additions and 10 deletions
|
@ -38,16 +38,14 @@ macro_rules! throw_validation_failure {
|
||||||
msg.push_str(", but expected ");
|
msg.push_str(", but expected ");
|
||||||
write!(&mut msg, $($expected_fmt)*).unwrap();
|
write!(&mut msg, $($expected_fmt)*).unwrap();
|
||||||
)?
|
)?
|
||||||
let path = rustc_middle::ty::print::with_no_trimmed_paths!({
|
let where_ = &$where;
|
||||||
let where_ = &$where;
|
let path = if !where_.is_empty() {
|
||||||
if !where_.is_empty() {
|
let mut path = String::new();
|
||||||
let mut path = String::new();
|
write_path(&mut path, where_);
|
||||||
write_path(&mut path, where_);
|
Some(path)
|
||||||
Some(path)
|
} else {
|
||||||
} else {
|
None
|
||||||
None
|
};
|
||||||
}
|
|
||||||
});
|
|
||||||
throw_ub!(ValidationFailure { path, msg })
|
throw_ub!(ValidationFailure { path, msg })
|
||||||
}};
|
}};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue