mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 22:31:43 +00:00
Auto merge of #16935 - Nilstrieb:dont-panic, r=HKalbasi
Handle panicking like rustc CTFE does Instead of using `core::fmt::format` to format panic messages, which may in turn panic too and cause recursive panics and other messy things, redirect `panic_fmt` to `const_panic_fmt` like CTFE, which in turn goes to `panic_display` and does the things normally. See the tests for the full call stack. The tests don't work yet, I probably missed something in minicore. fixes #16907 in my local testing, I also need to add a test for it
This commit is contained in:
commit
6f6b03f9de
3 changed files with 56 additions and 40 deletions
|
@ -2356,7 +2356,7 @@ impl Evaluator<'_> {
|
|||
|
||||
fn exec_fn_with_args(
|
||||
&mut self,
|
||||
def: FunctionId,
|
||||
mut def: FunctionId,
|
||||
args: &[IntervalAndTy],
|
||||
generic_args: Substitution,
|
||||
locals: &Locals,
|
||||
|
@ -2374,6 +2374,9 @@ impl Evaluator<'_> {
|
|||
)? {
|
||||
return Ok(None);
|
||||
}
|
||||
if let Some(redirect_def) = self.detect_and_redirect_special_function(def)? {
|
||||
def = redirect_def;
|
||||
}
|
||||
let arg_bytes = args.iter().map(|it| IntervalOrOwned::Borrowed(it.interval));
|
||||
match self.get_mir_or_dyn_index(def, generic_args.clone(), locals, span)? {
|
||||
MirOrDynIndex::Dyn(self_ty_idx) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue