diff options
| author | Tomasz Miąsko <tomasz.miasko@gmail.com> | 2023-03-22 00:00:00 +0000 |
|---|---|---|
| committer | Tomasz Miąsko <tomasz.miasko@gmail.com> | 2023-04-27 00:33:52 +0200 |
| commit | bc41973e35e60fe01cb6f464240a2f1db9afb4bd (patch) | |
| tree | 2b2674f79e3eb9f0e2156c36da02d752d9ea7e28 | |
| parent | 6a8fcdc597236d28e916b7f02e80eec674a52616 (diff) | |
| download | rust-bc41973e35e60fe01cb6f464240a2f1db9afb4bd.tar.gz rust-bc41973e35e60fe01cb6f464240a2f1db9afb4bd.zip | |
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.
| -rw-r--r-- | compiler/rustc_const_eval/src/interpret/validity.rs | 18 |
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 }) }}; } |
