Commit Graph

19576 Commits

Author SHA1 Message Date
dfireBird
13301e7a1a
replace static_lifetime with new_lifetime_var where necessary
implemented suggested fixes and changes and fix merge conflicts
2024-03-18 17:53:09 +05:30
dfireBird
a555e95c9a
fix make HirDisplay format lifetimes first 2024-03-18 17:18:08 +05:30
dfireBird
8d08b337fa
include lifetime in the filter for data layout in analysis-stats
clippy fixes
2024-03-18 17:18:08 +05:30
dfireBird
490391f576
fix HirDisplay inserting anonymous lifetimes and update tests 2024-03-18 17:18:08 +05:30
dfireBird
0669ae7faf
handle lifetimes separately in substs function 2024-03-18 17:18:08 +05:30
dfireBird
a6c8cbfd91
update Generics iter methods to return GenericParamId 2024-03-18 17:18:08 +05:30
dfireBird
d6e3929841
include lifetime in ParamKind and in Generics::provenance_split 2024-03-18 17:18:08 +05:30
dfireBird
e463a3e1cf
update make_binders to include lifetimes in generics
adds a bunch of iter methods that include lifetimes
2024-03-18 17:18:08 +05:30
dfireBird
16493e301e
fix index returned for the use of BoundVar 2024-03-18 17:18:08 +05:30
dfireBird
f95b3d4cd2
implement resolving and lowering of Lifetimes 2024-03-18 17:18:06 +05:30
bors
d3eeadc242 Auto merge of #16852 - ShoyuVanilla:atpit, r=Veykril
feat: Implement ATPIT

Resolves #16584

Note: This implementation only works for ATPIT, not for TAIT.
The main hinderence that blocks the later is the defining sites of TAIT can be inner blocks like in;
```rust
type X = impl Default;

mod foo {
    fn bar() -> super::X {
        ()
    }
}
```
So, to figure out we are defining it or not, we should recursively probe for nested modules and bodies.

For ATPIT, we can just look into current body because `error[E0401]: can't use 'Self' from outer item` prevent such nested structures;

```rust
trait Foo {
    type Item;
    fn foo() -> Self::Item;
}

struct Bar;

impl Foo for Bar {
    type Item = impl Default;
    fn foo() -> Self::Item {
        fn bar() -> Self::Item {
                    ^^^^^^^^^^
                    |
                    use of `Self` from outer item
                    refer to the type directly here instead
            5
        }
        bar()
    }
}
```

But this implementation does not checks for unification of same ATPIT between different bodies, monomorphization, nor layout for similar reason. (But these can be done with lazyness if we can utilize something like "mutation of interned value" with `db`. I coundn't find such thing but I would appreciate it if such thing exists and you could let me know 😅)
2024-03-18 10:38:24 +00:00
Shoyu Vanilla
d034ab0f92 Apply reviewed suggestions 2024-03-18 18:25:41 +09:00
bors
7c2bb75bc8 Auto merge of #16860 - Veykril:macarons, r=Veykril
feat: Syntax highlighting improvements

Specifically
- Adds a new `constant` modifier, attached to keyword `const` (except for `*const ()` and `&raw const ()`), `const` items and `const` functions
- Adds (or rather reveals) `associated` modifier for associated items
- Fixes usage of the standard `static` modifier, now it acts like `associated` except being omitted for methods.
- Splits `SymbolKind::Function` into `Function` and `Method`. We already split other things like that (notable self param from params), so the split makes sense in general as a lot special cases around it anyways.
2024-03-18 09:14:08 +00:00
bors
f40c7d8a9c Auto merge of #16822 - Veykril:inlays, r=Veykril
fix: Make inlay hint resolving work better for inlays targetting the same position
2024-03-18 09:00:59 +00:00
Lukas Wirth
4a93368590 Use a hash to find the correct inlay hint when resolving 2024-03-18 09:51:51 +01:00
Lukas Wirth
3115fd8b41 Simplify inlay hints needs_resolve 2024-03-18 09:50:27 +01:00
bors
a71a0328d8 Auto merge of #16830 - Jesse-Bakker:fix-ty-panic, r=ShoyuVanilla
Fix panic with impl trait associated types in where clause

Not sure if this is the correct fix, but the tests are green :')

Fixes #16823
2024-03-18 08:35:53 +00:00
Lukas Wirth
4b679f90dd Generate AST in a more stable manner 2024-03-18 09:24:10 +01:00
bors
f07489ada9 Auto merge of #16868 - roife:fix-issue-16848, r=Veykril
fix: handle attributes when typing curly bracket

fix #16848.

When inserting a `{`, if it is identified that the front part of `expr` is `attr`, we consider it as inserting `{}` around the entire `expr` (excluding the attr part).
2024-03-18 08:22:26 +00:00
bors
65c601fa42 Auto merge of #16863 - Nadrieril:update-pat-ana, r=Veykril
Bump dependencies and use in-tree `rustc_pattern_analysis`

One last `pattern_analysis` API change. I don't have any more planned! So we can now use the in-tree version when available.
2024-03-18 08:08:11 +00:00
roife
109344cfb7 fix: handle attributes when typing curly bracket 2024-03-18 13:29:14 +08:00
bors
b6d1887bc4 Auto merge of #16861 - Veykril:macro-diag-exceptions, r=Veykril
fix: Ignore some warnings if they originate from within macro expansions

These tend to be annoying noise as we can't handle `allow`s for them properly for the time being.
2024-03-17 20:41:40 +00:00
Lukas Wirth
bb541c38d3 fix: Ignore some warnings if they originate from within macro expansions 2024-03-17 21:30:56 +01:00
Nadrieril
8d59aaf735 Use in-tree rustc_pattern_analysis 2024-03-17 14:16:30 +01:00
Nadrieril
b99618c191 Bump dependencies 2024-03-17 14:11:44 +01:00
Matthias Krüger
2a8edaa14d remove redundant clone()s 2024-03-17 14:06:21 +01:00
Lukas Wirth
20d521db74 Adjust benchmark_syntax_highlighting_parser for changes 2024-03-17 11:38:10 +01:00
Lukas Wirth
77607ab99a More precise highlighting rules for constant modifier 2024-03-17 11:26:05 +01:00
Lukas Wirth
640c8b722e Move custom async modifier to standard one 2024-03-17 11:10:29 +01:00
Lukas Wirth
23fff55f0c Split SymbolKind::Function into Function and Method 2024-03-17 11:07:22 +01:00
Lukas Wirth
c8f6655327 Don't emit modifiers depending on the symbol kind in lsp conversion layer 2024-03-17 10:40:32 +01:00
Lukas Wirth
66adc1cc94 Emit Const modifier in syntax highlighting for const-like things 2024-03-17 10:35:33 +01:00
bors
5ecace48f6 Auto merge of #16846 - roife:fix-issue16826, r=Veykril
fix: incorrect handling of `use` and panic issue in `extract_module`.

fix #16826

This PR includes the following changes:

1. Simplify the implementation partially, removing many unnecessary loops and `clone()`.

2. When it is found that the top level of the selection contains a `use` statement, a copy of the `use` will be reinserted before extraction. (#16826)

3. Fixed an issue during `extract_module`, where if the top level of the selected part contains `A` and `use A::B`, it caused a duplication of `use A`.
2024-03-16 17:35:49 +00:00
bors
b94c2852fa Auto merge of #16856 - Veykril:macarons, r=Veykril
fix: Fix wrong where clause rendering on hover

We were not accounting for proper newline indentation in some places making the hover look weird (or just straight up wrong for type aliases)
2024-03-16 17:23:02 +00:00
Lukas Wirth
d69a81fddb fix: Fix wrong where clause rendering on hover 2024-03-16 17:49:59 +01:00
Shoyu Vanilla
fc53c59388 fix: typo 2024-03-16 03:53:55 +09:00
Shoyu Vanilla
d2aba91a0c feat: Implement ATPIT 2024-03-16 03:31:12 +09:00
hkalbasi
dcfc9ccace Distinguish integration tests from crates in test explorer 2024-03-15 17:16:28 +03:30
bors
f9a4d05195 Auto merge of #16845 - HKalbasi:test-explorer, r=HKalbasi
Show compilation progress in test explorer

Fix part of #16827
2024-03-15 13:15:35 +00:00
roife
10aa999c74 fix: typo 2024-03-15 21:14:17 +08:00
roife
d40c0fe48b test: add test for extract_module 2024-03-15 21:05:04 +08:00
roife
513c6d35ed fix: re-insert use stmts that is extracted 2024-03-15 21:04:51 +08:00
hkalbasi
eeff20d172 Show compilation progress in test explorer 2024-03-15 16:28:59 +03:30
Lukas Wirth
0dd89d7ee7 Remove usages of SpanData where Span suffices 2024-03-15 13:02:40 +01:00
roife
de716058c9 fix: remove useless loop 2024-03-15 19:54:58 +08:00
Lukas Wirth
b59c8c76db Repalce Span with SyntaxContextId in MacroCallLoc 2024-03-15 12:47:05 +01:00
Lukas Wirth
08327e0e5d Drop eager macro parse errors, they can't crop up 2024-03-15 11:45:51 +01:00
Lukas Wirth
3b1ad2379d internal: Make def site span for proc-macro more invalidation resistant 2024-03-15 10:14:00 +01:00
Lukas Wirth
c50c4f8bbb internal: Use assoc items as anchors for spans 2024-03-15 09:28:39 +01:00
roife
5b2809f329 fix: simplification on extract_module 2024-03-15 14:24:16 +08:00