mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 12:29:21 +00:00
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.
This commit is contained in:
parent
e265e3d518
commit
2dfe7de8b6
3 changed files with 56 additions and 40 deletions
|
@ -5105,6 +5105,32 @@ fn foo(e: E) {
|
|||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn hover_const_value() {
|
||||
check(
|
||||
r#"
|
||||
pub enum AA {
|
||||
BB,
|
||||
}
|
||||
const CONST: AA = AA::BB;
|
||||
pub fn the_function() -> AA {
|
||||
CON$0ST
|
||||
}
|
||||
"#,
|
||||
expect![[r#"
|
||||
*CONST*
|
||||
|
||||
```rust
|
||||
test
|
||||
```
|
||||
|
||||
```rust
|
||||
const CONST: AA = BB
|
||||
```
|
||||
"#]],
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn array_repeat_exp() {
|
||||
check(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue