Commit graph

485 commits

Author SHA1 Message Date
bors
22648b2655 Auto merge of #17405 - Veykril:modpath-clone, r=Veykril
internal: Don't unnecessarily clone ModPaths in early name res
2024-06-12 09:27:49 +00:00
Lukas Wirth
855282fa53 internal: Don't unnecessarily clone ModPaths in early name res 2024-06-12 11:25:19 +02:00
bors
c07076b35c Auto merge of #17394 - Veykril:recurse-fix, r=Veykril
fix: Fix `HirDisplay` stackoverflow for parameter Self defaults

Fixes https://github.com/rust-lang/rust-analyzer/issues/10932
2024-06-11 15:05:26 +00:00
Lukas Wirth
1ecf230792 fix: Fix HirDisplay stackoverflow for parameter Self defaults 2024-06-11 17:04:07 +02:00
roife
78118f98f6 feat: add hover config for showing container bounds 2024-06-11 21:02:13 +08:00
Lukas Wirth
d4dc3ca83b Register virtual workspace Cargo.toml files in the VFS 2024-06-09 12:54:50 +02:00
Wilfred Hughes
27182bb96b chore: Prefer tracing span shorthand macros 2024-06-06 16:52:25 -07:00
Lukas Wirth
60fa981df1 Simplify 2024-06-03 19:06:58 +02:00
bors
89218cf29c Auto merge of #17329 - Nilstrieb:rustc_deprecated_safe_2024, r=Veykril
Don't mark `#[rustc_deprecated_safe_2024]` functions as unsafe

`std::env::set_var` will be unsafe in edition 2024, but not before it. I couldn't quite figure out how to check for the span properly, so for now we just turn the false positives into false negatives, which are less bad.
2024-06-03 12:44:21 +00:00
Nilstrieb
0e1353bebd Don't mark #[rustc_deprecated_safe_2024] functions as unsafe
`std::env::set_var` will be unsafe in edition 2024, but not before it.
I couldn't quite figure out how to check for the span properly, so for now
we just turn the false positives into false negatives, which are less bad.
2024-06-02 15:04:26 +02:00
Hamir Mahal
7c34eb3880
style: simplify string interpolation 2024-05-30 16:18:49 -07:00
bors
f6fc109fcb Auto merge of #17287 - Veykril:sysroot-encode-empty, r=Veykril
Allow sysroots to only consist of the source root dir

Fixes https://github.com/rust-lang/rust-analyzer/issues/17159

This PR encodes the `None` case of an optional sysroot into `Sysroot` itself. This simplifies a lot of things and allows us to have sysroots that consist of nothing, only standard library sources, everything but the standard library sources or everything. This makes things a lot more flexible. Additionally, this removes the workspace status bar info again, as it turns out that that can be too much information for the status bar to handle (this is better rendered somewhere else, like in the status view).
2024-05-23 18:13:47 +00:00
Lukas Wirth
bd37e2790b Allow sysroots to only consist of the source root dir 2024-05-23 20:12:31 +02:00
bors
dec43b6cb3 Auto merge of #17174 - Kohei316:fix-infer-async-block-with-tail-return-expr, r=Veykril
Fix: infer type of async block with tail return expr

Fixes #17106
The `infer_async_block` method calls the `infer_block` method internally, which returns the never type without coercion when `tail_expr` is `None` and `ctx.diverges` is `Diverges::Always`.This is the reason for the bug in this issue.
cfce2bb46d/crates/hir-ty/src/infer/expr.rs (L1411-L1413)

This PR solves the bug by adding a process to coerce after calling `infer_block` method.

This code passes all the tests, including tests I added for this isuue, however, I am not sure if this solution is right. I think that this solution is an ad hoc solution. So, I would appreciate to have your review.
I apologize if I'm off the mark, but `infer_async_block` method should be rewritten to share code with the process of infering type of `expr::Closure` instead of the `infer_block` method. That way it will be closer to the infer process of rustc.
2024-05-23 08:42:09 +00:00
Lukas Wirth
ac3b2d4b54
Update crates/hir-ty/src/infer/expr.rs 2024-05-23 10:36:57 +02:00
Lukas Wirth
3a7dcf91c4 Simplify 2024-05-22 21:57:44 +02:00
David Barsky
b75301cec8 internal: refactor prefer_no_std/prefer_prelude bools into a struct 2024-05-22 20:46:30 +02:00
bors
6a16749eb0 Auto merge of #17277 - Veykril:find-path-fixes, r=Veykril
fix: Various find path fixes

Fixes https://github.com/rust-lang/rust-analyzer/issues/17271
2024-05-22 18:22:32 +00:00
bors
daf66ad8eb Auto merge of #17268 - Veykril:signatures, r=Veykril
feat: More callable info

With this PR we retain more info about callables other than functions, allowing for closure parameter type inlay hints to be linkable as well as better signature help around closures and `Fn*` implementors.
2024-05-22 12:48:17 +00:00
Lukas Wirth
c88b421853 fix: Fix general find-path inconsistencies 2024-05-22 14:05:24 +02:00
Laurențiu Nicola
49cae17fa2 Merge from rust-lang/rust 2024-05-19 11:20:26 +03:00
Lukas Wirth
7bd343e085 Show fn traits in signature info for trait implementors 2024-05-18 16:22:59 +02:00
Lukas Wirth
ff79903cf6 Render closure fn trait kind in siganture help 2024-05-18 15:01:37 +02:00
beetrees
861cca5249
Refactor float Primitives to a separate Float type 2024-05-06 14:56:10 +01:00
dfireBird
8cbeb04ba2
fix lifetime bound var index in dyn trait 2024-05-05 23:40:34 +05:30
Lukas Wirth
c97ac34caa Fix impl trait params not being counted properly 2024-05-02 13:56:10 +02:00
Lukas Wirth
8241d8a0b8 fix: Fix implicit ty args being lowered where they shouldn't 2024-05-02 11:53:53 +02:00
Wilfred Hughes
c981ff0944 fix: Tracing span names should match function names
When viewing traces, it's slightly confusing when the span name doesn't
match the function name. Ensure the names are consistent.

(It might be worth moving most of these to use #[tracing::instrument]
so the name can never go stale. @davidbarsky suggested that is marginally
slower, so I've just done the simple change here.)
2024-04-30 11:22:47 -07:00
morine0122
da3fa2b7f0 Fix coercion of async block 2024-04-30 18:31:10 +09:00
dfireBird
40a677ddf0
implement creating generics for impl traits in associated types 2024-04-29 23:55:02 +05:30
Lukas Wirth
bfe59bbdc8 fix: Fix attributes on generic parameters colliding in item tree 2024-04-27 13:15:36 +02:00
Lukas Wirth
ac389ce2ef fix: Fix expression scopes not being calculated for inline consts 2024-04-25 09:49:19 +02:00
Lukas Wirth
31304ad1ad Drop unknown lifetimes when rendering generic args 2024-04-24 21:22:48 +02:00
Bao Zhiyuan
5c88e98419 different error code based on variant 2024-04-23 20:54:03 +08:00
bors
4c08e2d32f 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
Lukas Wirth
3b9a2af21f Peek for panic message in test output 2024-04-21 08:50:25 +02:00
Laurențiu Nicola
4c94e69115 Add in-rust-tree feature to hir-expand 2024-04-20 18:44:27 +03:00
Lukas Wirth
6de838c255 Implement BeginPanic for mir eval 2024-04-19 12:42:32 +02:00
Lukas Wirth
a9140e197c Fix #[rustc_const_panic_str] functions not actually being hooked 2024-04-18 15:49:08 +02:00
Nilstrieb
805f569adc 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
David Barsky
5ba37f3f8e chore: fix a few spans without .entered() 2024-04-17 12:44:49 -04:00
Lukas Wirth
531a270d91 Generally optimize diagnostics performance 2024-04-15 22:15:41 +02:00
Lukas Wirth
94e38261b3 Optimize exhaustiveness checking perf a bit 2024-04-15 19:35:48 +02:00
Lukas Wirth
91659da5a6 internal: Use hir_fmt_args everywhere in hir_ty::display 2024-04-15 16:17:29 +02:00
Lukas Wirth
1915980031 fix: Fix impl Trait<Self> causing stackoverflows 2024-04-15 15:41:20 +02:00
Laurențiu Nicola
f5e4eb2ef9 Fix rustc_skip_array_during_method_dispatch edition check 2024-04-15 08:54:07 +03:00
Lukas Wirth
83370fe5d7 Use Edition::CURRENT 2024-04-14 15:30:29 +02:00
Lukas Wirth
8078c3d9e8 Bump chalk 2024-04-08 11:03:19 +02:00
Lukas Wirth
a82e028e30 Cleanup util::Generics method names 2024-04-06 14:29:40 +02:00
Lukas Wirth
336dee3415 Remove some allocs 2024-04-06 13:40:15 +02:00