Lukas Wirth
f2d51073d2
Use statics + clone instead of const until const can access statics
2024-07-14 17:52:59 +02:00
Campbell
af30111b1c
feat: Add incorrect case diagnostics for enum variant fields and all variables
2024-07-13 21:54:22 +12:00
Lukas Wirth
3fe815b0f3
Use Symbol in Name
2024-07-12 16:06:44 +02:00
beetrees
d5db933f9d
Add f16
and f128
support
2024-07-10 10:43:14 +01:00
beetrees
320022622c
fix: Fix double rounding of f32
literals
2024-07-08 16:31:32 +01:00
bors
a494aaba87
Auto merge of #17523 - wada314:master, r=Veykril
...
Add an option to use "::" for the external crate prefix.
Fixes #11823 .
Hi I'm very new to rust-analyzer and not sure how the review process are. Can somebody take a look at this PR? thanks!
2024-07-07 08:32:46 +00:00
Lukas Wirth
866102cdaf
Re-implement tidy as an xtask action
2024-07-07 09:12:16 +02:00
Lukas Wirth
b9c1c42959
Allow new clippy lint in test
2024-07-07 08:41:41 +02:00
bors
058c88da66
Auto merge of #17551 - Veykril:has-errors, r=Veykril
...
Also mark InferenceResult::has_errors flag when there are error types
Should work around https://github.com/rust-lang/rust-analyzer/issues/15090#issuecomment-2211647133
2024-07-06 18:56:23 +00:00
Lukas Wirth
e0105c473e
Also mark InferenceResult::has_errors flag when there are error types
2024-07-06 20:45:23 +02:00
Lukas Wirth
4420e7148f
Diagnose unresolved self value in path expression
2024-07-06 15:44:12 +02:00
Shoyu Vanilla
4bb623decb
Disallow nested impl traits
2024-07-04 23:31:55 +09:00
Lukas Wirth
26c7bfd0b4
Skip match exhaustiveness checking if pattern type contains errors
2024-07-03 08:31:40 +02:00
Lukas Wirth
baa959fa99
Move lifetimes in front of type and const params but after self
2024-07-02 14:17:34 +02:00
Lukas Wirth
966798b7ba
Make GenericParams::lifetimes private
2024-07-02 13:45:53 +02:00
Lukas Wirth
be1ea4028b
Make GenericParams::where_predicates private
2024-07-02 13:45:50 +02:00
Lukas Wirth
372e2d22e6
Make GenericParams::type_or_consts private
2024-07-02 13:45:48 +02:00
Lukas Wirth
1a929d6485
Fix lifetime parameters moving paramter defaults
2024-07-02 12:34:32 +02:00
Shohei Wada
3725ab3146
squash.
2024-07-02 01:52:34 +09:00
bors
72f278b5be
Auto merge of #17522 - Veykril:comptimes, r=Veykril
...
internal: Cut compiletimes slightly
2024-07-01 08:43:11 +00:00
Lukas Wirth
d859e40db9
Bump rustc_pattern_analysis
2024-06-30 18:41:55 +02:00
bors
ea7fdada6a
Auto merge of #17520 - Veykril:slim-proc-macro-api, r=Veykril
...
internal: Cleanup proc-macro-srv some more
2024-06-30 15:12:50 +00:00
Lukas Wirth
21a3d01875
Remove inline rust_2018_idioms, unused_lifetimes
lint warn, Cargo.toml already enforces this
2024-06-30 15:23:54 +02:00
Shoyu Vanilla
7e9da2d67d
Use proper ImplTraits
in insert_inference_vars_for_impl_trait
2024-06-27 23:51:33 +09:00
Shoyu Vanilla
50b7678621
Add a regression test for issue 17199 that causes stack overflow
2024-06-27 23:48:15 +09:00
Lukas Wirth
8df034d453
Shrink mbe's Op
2024-06-24 10:07:32 +02:00
Lukas Wirth
5548aecdca
Save a bit on empty item trees by deduplicating them
2024-06-24 10:07:32 +02:00
Lukas Wirth
3168ab5b99
Enum variants are not generic def ids
2024-06-24 10:07:31 +02:00
Lukas Wirth
4c62e6b05f
Prevent re-allocation in CallableSig::from_params_and_return
2024-06-21 19:26:08 +02:00
Lukas Wirth
34ba8db3ed
Save allocations for empty generic_defaults query results
2024-06-21 19:21:27 +02:00
Lukas Wirth
2761b1e236
Don't attempt to compute implict sized clauses for empty generics
2024-06-21 19:10:57 +02:00
Lukas Wirth
4d709cc866
Save allocations for empty generic_predicates query results
2024-06-21 19:10:45 +02:00
Lukas Wirth
7a16e06009
Lazy generics
2024-06-21 18:38:37 +02:00
Lukas Wirth
c01f4cf902
Simplify
2024-06-21 18:27:05 +02:00
Lukas Wirth
480bfd5a7d
There can only be one self param
2024-06-21 17:55:16 +02:00
Lukas Wirth
cf2b757a1a
Light docs and privacy
2024-06-21 17:54:40 +02:00
Lukas Wirth
585cc9e014
Extract generics module
2024-06-21 10:55:05 +02:00
Laurențiu Nicola
0a2652390a
Merge from rust-lang/rust
2024-06-20 08:03:36 +03:00
Wilfred Hughes
3874681cb6
Prefer plain trait definitions over macros for salsa
2024-06-13 17:32:06 -07:00
Ralf Jung
588eb6b6ad
use is_none_or in some places in the compiler
2024-06-12 16:20:07 +02:00
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 Primitive
s 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
Lukas Wirth
13890697eb
Simplify
2024-04-06 13:12:07 +02:00
Lukas Wirth
86967032f7
Consider ADT generic parameter defaults for unsubstituted layout calculations
2024-04-03 09:01:27 +02:00
bors
c3b8c2a254
Auto merge of #16996 - Veykril:lt-err, r=Veykril
...
internal: Lower outlive goals, respect them in display impls
2024-04-02 14:13:22 +00:00
Lukas Wirth
707be6b99c
Adjust display impls to respect lifetime bounds
2024-04-02 14:51:08 +02:00
Lukas Wirth
0927f86247
Replace static_lifetime usages with error_lifetime, lower outlives goals
2024-04-02 14:51:06 +02:00
bors
23dd54b010
Auto merge of #16968 - roife:fix-issue-16801, r=Veykril
...
fix: silence mismatches involving unresolved projections
fix #16801
2024-04-01 20:05:33 +00:00
roife
2636e44378
fix: simplify the usage of UnknownMismatch
2024-04-02 03:26:32 +08:00
roife
3d373fec8c
tests: add tests for mismatches with unresolved projections
2024-04-02 01:32:43 +08:00
roife
8d6b65c544
fix: silence mismatches involving unresolved projections
2024-04-02 01:27:22 +08:00
bors
3691380c35
Auto merge of #16920 - Veykril:clippy-lints, r=Veykril
...
internal: Fix new nightly clippy lints
2024-04-01 16:00:18 +00:00