Commit graph

303 commits

Author SHA1 Message Date
Harry Sarson
dd16cbcb4e
braces around {self} in UseTree are not unnecessary
Before this commit `UseTree::remove_unnecessary_braces` removed the braces
around `{self}` in `use x::y::{self};` but `use x::y::self;` is not valid
rust.
2024-04-30 18:17:32 +01:00
bors
a200391f54 Auto merge of #17025 - lnicola:josh, r=lnicola
internal: Use josh for subtree syncs
2024-04-21 16:39:18 +00:00
bors
8ea8c7432b Auto merge of #16938 - Nilstrieb:dont-panic-tests, r=Veykril
Implement `BeginPanic` handling in const eval

for #16935, needs some figuring out of how to write these tests correctly
2024-04-21 16:22:02 +00:00
bors
7a3ad0308a Auto merge of #17115 - leviska:json_is_not_rust_better_names, r=Veykril
Try to generate more meaningful names in json converter

I just found out about rust-analyzer json converter, but I think it would be more convenient, if names were more useful, like using the names of the keys.

Let's look at some realistic arbitrary json:

```json
{
    "user": {
        "address": {
            "street": "Main St",
            "house": 3
        },
        "email": "example@example.com"
    }
}
```
I think, new generated code is much easier to read and to edit, than the old:
```rust
// Old
struct Struct1{ house: i64, street: String }
struct Struct2{ address: Struct1, email: String }
struct Struct3{ user: Struct2 }

// New
struct Address1{ house: i64, street: String }
struct User1{ address: Address1, email: String }
struct Root1{ user: User1 }
```

Ideally, if we drop the numbers, I can see it being usable just as is (may be rename root)
```rust
struct Address{ house: i64, street: String }
struct User{ address: Address, email: String }
struct Root{ user: User }
```

Sadly, we can't just drop them, because there can be multiple fields (recursive) with the same name, and we can't just easily retroactively add numbers if the name has 2 instances due to parsing being single pass.
We could ignore the `1` and add number only if it's > 1, but I will leave this open to discussion and right now made it the simpler way

In sum, even with numbers, I think this PR still helps in readability
2024-04-21 16:09:17 +00:00
Lukas Wirth
0a29e6fc85 Support flychecking for cargo scripts 2024-04-21 17:40:17 +02:00
Lukas Wirth
92ace4b139 Extract common fields out of ProjectWorkspace variants 2024-04-21 17:03:02 +02:00
Lukas Wirth
7c39263450 Allow rust files to be used linkedProjects 2024-04-21 16:26:55 +02:00
Laurențiu Nicola
8f2138102f Use josh for subtree syncs 2024-04-21 10:07:08 +03:00
Lukas Wirth
04de0fff1e Peek for panic message in test output 2024-04-21 08:50:25 +02:00
Lev Iskandarov
846f8046b0 add test with multiple names 2024-04-20 21:04:53 +03:00
Lev Iskandarov
570c725f69 try to generate more meaningful names 2024-04-20 20:50:47 +03:00
Lukas Wirth
2efaa44acf Implement BeginPanic for mir eval 2024-04-19 12:42:32 +02:00
Lukas Wirth
ca53651640 Fix #[rustc_const_panic_str] functions not actually being hooked 2024-04-18 15:49:08 +02:00
Lukas Wirth
4a33c5f305 Fixup some issues with minicore 2024-04-18 12:20:54 +02:00
Lukas Wirth
b6751b7611 Fix missing function body in minicore 2024-04-18 12:20:54 +02:00
Nilstrieb
a8e50cffbc 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.
2024-04-18 12:20:54 +02:00
Aleksey Kladov
7c67612b8a organizize 2018-08-10 22:33:29 +03:00
Aleksey Kladov
2e165ae82e logging 2018-08-10 17:49:45 +03:00
Aleksey Kladov
d7c5a6f308 Start lang server 2018-08-10 15:07:43 +03:00
Aleksey Kladov
4a900fd681 Split diagnostics 2018-08-09 21:27:44 +03:00
Aleksey Kladov
afa94d4f37 fn_item -> function 2018-08-09 17:54:49 +03:00
Aleksey Kladov
d8b2a5efc0 Generate AST 2018-08-09 17:43:39 +03:00
Aleksey Kladov
36bd28633b Extract runnables 2018-08-09 16:03:21 +03:00
Aleksey Kladov
34bf0a0b18 More premature layout micro optimizations 2018-08-09 02:41:31 +03:00
Aleksey Kladov
08475a690c Simplify string optimizations 2018-08-09 02:26:22 +03:00
Aleksey Kladov
7974c6b1a0 Mincrooptimization 2018-08-09 01:59:36 +03:00
Aleksey Kladov
f4d294f32c Simplify event processing 2018-08-09 01:57:51 +03:00
Aleksey Kladov
1f6c442a3f Fix panic with EOF token 2018-08-08 23:09:40 +03:00
Aleksey Kladov
8c598d3d8a Support crate vis 2018-08-08 22:15:14 +03:00
Aleksey Kladov
a5dc5f1b5c Improve tree building 2018-08-08 21:14:18 +03:00
Aleksey Kladov
1fa5b2ffbc smol strings 2018-08-08 20:25:35 +03:00
Aleksey Kladov
cc4c90aa2c minor 2018-08-08 19:44:16 +03:00
Aleksey Kladov
eb8e9043e2 Where clauses 2018-08-08 19:31:44 +03:00
Aleksey Kladov
8f21afacfc Optional patterns in fn types 2018-08-08 18:34:26 +03:00
Aleksey Kladov
de7b1887ae Introduce param falvor 2018-08-08 18:13:30 +03:00
Aleksey Kladov
99f6976b20 bouds in types 2018-08-08 17:33:16 +03:00
Aleksey Kladov
5e0fbd5964 Range patterns 2018-08-08 15:05:33 +03:00
Aleksey Kladov
bfb90dc4f1 Fn-style type params 2018-08-08 14:43:14 +03:00
Aleksey Kladov
678882d4f8 literal pattern 2018-08-08 00:59:16 +03:00
Aleksey Kladov
64a65a4ff4 trait items 2018-08-08 00:53:03 +03:00
Aleksey Kladov
2fb854ccda 🎉 extend selection 2018-08-07 18:36:33 +03:00
Aleksey Kladov
a04473e2bb Semi statements 2018-08-07 17:00:45 +03:00
Aleksey Kladov
bcd6754f12 semis after blcoks 2018-08-07 16:32:09 +03:00
Aleksey Kladov
0ab1e255ee Generalize blocklike 2018-08-07 16:11:40 +03:00
Aleksey Kladov
42e3a8ef77 infix range is range 2018-08-07 15:23:05 +03:00
Aleksey Kladov
9ef9ec9ec3 Simplify tests 2018-08-07 14:57:19 +03:00
Aleksey Kladov
1a25cb0b1e simplify unary expr grammar 2018-08-07 14:52:03 +03:00
Aleksey Kladov
ba21da5274 tuple patterns 2018-08-07 14:41:03 +03:00
Aleksey Kladov
a6ba736a50 comparison ops 2018-08-07 14:28:07 +03:00
Aleksey Kladov
8908e51aea full precedence 2018-08-07 14:24:03 +03:00