Commit graph

1090 commits

Author SHA1 Message Date
Lukas Wirth
4502a602a7 internal: Lay basic ground work for standalone mbe tests 2024-09-01 12:42:44 +02:00
Chayim Refael Friedman
1cd707e693 Fix name resolution of shadowed builtin macro 2024-08-28 23:20:46 +03:00
Lukas Wirth
fa48bc216c
Revert "feat: Implement module_path macro" 2024-08-27 08:19:09 +02:00
bors
0ad26e6025 Auto merge of #17941 - ChayimFriedman2:pre-closure-to-fn, r=Veykril
Preliminary work for #17940

I split the PR as requested, and made small commits.
2024-08-26 08:09:15 +00:00
bors
071997d475 Auto merge of #17958 - Veykril:deref-chain-method-completions, r=Veykril
fix: Fix trait method completions not acknowledging Deref impls
2024-08-25 08:56:23 +00:00
Lukas Wirth
737d5088e5 fix: Fix trait method completions not acknowledging Deref impls 2024-08-25 10:47:30 +02:00
Chayim Refael Friedman
e6d59e65ec Add helper methods to retrieve Future::Output and Iterator::Item 2024-08-24 23:46:32 +03:00
Chayim Refael Friedman
34920dde8d Provide Future::Output and Iterator lang items 2024-08-24 23:46:32 +03:00
Chayim Refael Friedman
3712bb7f6a Handle associated types that are lang items
Previously we were ignoring them.
2024-08-24 23:46:32 +03:00
Lukas Wirth
afcf3f2b28
Remove incorrect FIXME comment 2024-08-23 11:05:25 +02:00
Lukas Wirth
d44a3ab30c internal: Implement module_path macro 2024-08-21 13:50:05 +02:00
bors
c9ee892263 Auto merge of #17905 - ChayimFriedman2:edition-dependent-raw-keyword, r=Veykril
fix: Properly account for editions in names

This PR touches a lot of parts. But the main changes are changing `hir_expand::Name` to be raw edition-dependently and only when necessary (unrelated to how the user originally wrote the identifier), and changing `is_keyword()` and `is_raw_identifier()` to be edition-aware (this was done in #17896, but the FIXMEs were fixed here).

It is possible that I missed some cases, but most IDE parts should properly escape (or not escape) identifiers now.

The rules of thumb are:

 - If we show the identifier to the user, its rawness should be determined by the edition of the edited crate. This is nice for IDE features, but really important for changes we insert to the source code.
 - For tests, I chose `Edition::CURRENT` (so we only have to (maybe) update tests when an edition becomes stable, to avoid churn).
 - For debugging tools (helper methods and logs), I used `Edition::LATEST`.

Reviewing notes:

This is a really big PR but most of it is mechanical translation. I changed `Name` displayers to require an edition, and followed the compiler errors. Most methods just propagate the edition requirement. The interesting cases are mostly in `ide-assists`, as sometimes the correct crate to fetch the edition from requires awareness (there may be two). `ide-completions` and `ide-diagnostics` were solved pretty easily by introducing an edition field to their context. `ide` contains many features, for most of them it was propagated to the top level function and there the edition was fetched based on the file.

I also fixed all FIXMEs from #17896. Some required introducing an edition parameter (usually not for many methods after the changes to `Name`), some were changed to a new method `is_any_identifier()` because they really want any possible keyword.

Fixes #17895.
Fixes #17774.
2024-08-16 13:49:32 +00:00
Chayim Refael Friedman
9d3368f2c2 Properly account for editions in names
This PR touches a lot of parts. But the main changes are changing
`hir_expand::Name` to be raw edition-dependently and only when necessary
(unrelated to how the user originally wrote the identifier),
and changing `is_keyword()` and `is_raw_identifier()` to be edition-aware
(this was done in #17896, but the FIXMEs were fixed here).

It is possible that I missed some cases, but most IDE parts should properly
escape (or not escape) identifiers now.

The rules of thumb are:

 - If we show the identifier to the user, its rawness should be determined
   by the edition of the edited crate. This is nice for IDE features,
   but really important for changes we insert to the source code.
 - For tests, I chose `Edition::CURRENT` (so we only have to (maybe) update
   tests when an edition becomes stable, to avoid churn).
 - For debugging tools (helper methods and logs), I used `Edition::LATEST`.
2024-08-16 16:46:24 +03:00
bors
fc36e0ca16 Auto merge of #17907 - ChayimFriedman2:no-once_cell, r=Veykril
internal: Replace once_cell with std's recently stabilized OnceCell/Lock and LazyCell/Lock

This doesn't get rid of the once_cell dependency, unfortunately, since we have dependencies that use it, but it's a nice to do cleanup. And when our deps will eventually get rid of once_cell we will get rid of it for free.
2024-08-16 07:05:59 +00:00
Chayim Refael Friedman
955e609867 Replace once_cell with std's recently stabilized OnceCell/Lock and LazyCell/Lock
This doesn't get rid of the once_cell dependency, unfortunately, since we have dependencies that use it, but it's a nice to do cleanup. And when our deps will eventually get rid of once_cell we will get rid of it for free.
2024-08-16 09:53:37 +03:00
Lukas Wirth
f90bdfc13d internal: Properly check the edition for edition dependent syntax kinds 2024-08-15 15:57:47 +02:00
bors
518532426d Auto merge of #17863 - Veykril:include-diags, r=Veykril
fix: Resolve included files to their calling modules in IDE layer

Fixes https://github.com/rust-lang/rust-analyzer/issues/17390 at the expense of reporting duplicate diagnostics for modules that have includes in them when both the calling and called file are included.
2024-08-12 11:48:32 +00:00
Lukas Wirth
2362975137 Resolve included files to their calling modules in IDE layer 2024-08-12 13:45:33 +02:00
bors
e2fd1db609 Auto merge of #17859 - Veykril:rustc_deprecated_safe_2024, r=Veykril
fix: Correctly support `#[rustc_deprecated_safe_2024]`

Fixes https://github.com/rust-lang/rust-analyzer/issues/17852
2024-08-12 08:59:08 +00:00
Lukas Wirth
ded3e21fdd fix: Correctly support #[rustc_deprecated_safe_2024] 2024-08-12 10:56:59 +02:00
bors
c7cbbb9195 Auto merge of #17833 - edevil:fix_expansion_limit, r=Veykril
Reuse recursion limit as expansion limit

A configurable recursion limit was introduced by looking at the recursion_limit crate attribute. Instead of relying on a global constant we will reuse this value for expansion limit as well.

Addresses: https://github.com/rust-lang/rust-analyzer/issues/8640#issuecomment-2271740272
2024-08-12 08:22:55 +00:00
bors
6d9af33b31 Auto merge of #17845 - ShoyuVanilla:tait, r=Veykril
feat: Implement TAIT and fix ATPIT a bit

Closes #16296 (Commented on the issue)

In #16852, I implemented ATPIT, but as I didn't discern ATPIT and other non-assoc TAIT, I guess that it has been working for some TAITs.

As the definining usage of TAIT requires it should be appear in the Def body's type(const blocks' type annotations or functions' signatures), this can be done in simlilar way with ATPIT

And this PR also corrects some defining-usage resolution for ATPIT
2024-08-12 08:08:40 +00:00
Lukas Wirth
24c0e0bd48 fix: Fix find_path not respecting non-std preference config correctly 2024-08-10 10:32:10 +02:00
Shoyu Vanilla
c530e21714 feat: Implement TAIT 2024-08-10 15:22:05 +09:00
André Cruz
6041433999
Reuse recursion limit as expansion limit
A configurable recursion limit was introduced by looking at the
recursion_limit crate attribute. Instead of relying on a global constant
we will reuse this value for expansion limit as well.
2024-08-08 17:12:20 +01:00
Lukas Wirth
e3e31ce199 Fix unconfigured diagnostic being attached to the wrong file for modules 2024-08-07 15:07:09 +02:00
bors
25d9e05c03 Auto merge of #17791 - ShoyuVanilla:await-outside-of-async, r=Veykril
feat: Implement diagnostic for `await` outside of `async`

Closes #17781
2024-08-05 13:53:21 +00:00
Shoyu Vanilla
8a51419a2d feat: Implement diagnostic for await outside of async 2024-08-05 21:47:57 +09:00
bors
fbed308ebe Auto merge of #17799 - Veykril:syntax-bridge, r=Veykril
Split out syntax-bridge into a separate crate

This functionality is not really tied to mbe macros, so imo it has no place in that crate.
2024-08-05 12:31:45 +00:00
Lukas Wirth
d2dd4f6d5f Split out syntax-bridge into a separate crate 2024-08-05 13:45:00 +02:00
Lukas Wirth
fcb88832de Simplify FileDelegate 2024-08-05 13:03:03 +02:00
Shoyu Vanilla
8fa454d7aa fix: Insert a generic arg for impl Trait when lowering generic args 2024-08-05 00:06:29 +09:00
bors
5b934bd25c Auto merge of #17741 - Veykril:include-raw, r=Veykril
fix: Fix builtin includes rejecting raw string literals

Fixes https://github.com/rust-lang/rust-analyzer/issues/17701
2024-07-30 06:21:07 +00:00
Lukas Wirth
ad71abb9ad fix: Fix builtin includes rejecting raw string literals 2024-07-30 08:19:32 +02:00
bors
a021b85be5 Auto merge of #17707 - Veykril:proc-macro-err-cleanup, r=Veykril
feat: Use spans for builtin and declarative macro expansion errors

This should generally improve some error reporting for macro expansion errors. Especially for `compile_error!` within proc-macros
2024-07-29 14:07:33 +00:00
Lukas Wirth
ae9c553902 Make basic use of spans for macro expansion errors 2024-07-29 14:52:40 +02:00
Ryo Yoshida
fdb367ab89 fix: let glob imports override other globs' visibility 2024-07-27 00:10:53 -03:00
Lukas Wirth
7beac14cba Internal: Cleanup proc-macro error handling 2024-07-26 14:38:19 +02:00
Lukas Wirth
d32e60467f Remove unused trace module 2024-07-25 14:08:48 +02:00
bors
0ba6f4eda0 Auto merge of #17676 - winstxnhdw:precise-capturing, r=Veykril
feat: add preliminary support for `+ use<..>` `precise_capturing` syntax

## Summary

This PR adds basic support for the following syntax.

```rs
fn captures<'a: 'a, 'b: 'b, T>() -> impl Sized + use<'b, T> {}
//                                  ~~~~~~~~~~~~~~~~~~~~~~~
//                          This opaque type does not capture `'a`.

fn outlives<'o, T: 'o>(_: T) {}

fn caller<'o, 'a, 'b: 'o, T: 'o>() {
    //        ~~
    //        ^ Note that we don't need `'a: 'o`.
    outlives::<'o>(captures::<'a, 'b, T>());
}
```

Related to #17598
2024-07-25 11:10:56 +00:00
Winston H.
9f74787d5d fix: handle new TypeBoundKind variant 2024-07-25 10:58:25 +00:00
Lukas Wirth
0e93e6fee7 Make legacy_const_generics_indices thin by double boxing as its seldom used 2024-07-25 11:51:15 +02:00
Lukas Wirth
7f884487d7 Reduce size of TypeRef by 8 bytes 2024-07-25 11:14:55 +02:00
Lukas Wirth
f2fa456a8c Fix incorrect handling of cfg'd varargs 2024-07-25 11:02:19 +02:00
Lukas Wirth
9cbafa2d49 Remove Params and Fields from AstIdMap 2024-07-25 10:22:05 +02:00
Lukas Wirth
7c374a10bd internal: Shrink size of Binding 2024-07-22 17:14:17 +02:00
bors
36f58f5fff Auto merge of #17670 - Veykril:mem, r=Veykril
LRU `body_with_source_map` query

This query is being invalidated all the time anyways (we have an extra query on top of it for the body incrementality that is not source dependent), so there is little reason to keep these around all the time when only some IDE features are interested in them.
2024-07-22 14:48:05 +00:00
Lukas Wirth
bd359b32b0 LRU body_with_source_map query 2024-07-22 16:34:59 +02:00
bors
6f3030f316 Auto merge of #17586 - ShoyuVanilla:tuple-arg-macro-rest, r=Veykril
Allow macro expansions into `RestPat` in tuple args work as ellipsis like plain `RestPat`

Fixes #17292

Currently, Rust Analyzer lowers `ast::Pat::RestPat` into `Pat::Missing` in general cases on the following lines;

ffbc5ad993/crates/hir-def/src/body/lower.rs (L1359-L1367)

And in some proper positions such as `TupleStruct(..)`, it is specially handed on the following lines;

ffbc5ad993/crates/hir-def/src/body/lower.rs (L1429-L1437)

This behavior is reasonable because rustc does similar things in
62c068feea/compiler/rustc_ast_lowering/src/pat.rs (L108-L111)
and
62c068feea/compiler/rustc_ast_lowering/src/pat.rs (L123-L142)

But this sometimes works differently because Rust Analyzer expands macros while ast lowering;

ffbc5ad993/crates/hir-def/src/body/lower.rs (L1386-L1398)
ffbc5ad993/crates/hir-def/src/body/lower.rs (L941-L963)
but rustc uses expanded ast in the corresponding tuple-handling process, so it does not have macro patterns there.
62c068feea/compiler/rustc_ast_lowering/src/pat.rs (L114)

So, if a macro expansion in a tuple arg results in `..`, rustc permits it like plain `..` pattern, but Rust Analyzer rejects it.
This is the root cause of #17292 and this PR allows macros expanded into `..` in a tuple arg position work as ellipsis like that.
2024-07-22 09:08:12 +00:00
Sydney Acksman
cdd7b18149 Fix more path resolution for included submodules
Now with much more comprehensive testing! This
adds tests for includes within modules.
2024-07-21 19:04:19 -05:00
bors
e88946ace8 Auto merge of #17655 - Veykril:std-find-path, r=Veykril
More `find_path` improvements
2024-07-21 11:21:25 +00:00
Lukas Wirth
733cb1e645 Optimize find_path for sysroot library search some more 2024-07-21 13:20:12 +02:00
Lukas Wirth
4b2a123280 Fix visited module tracking not clearing itself on backtracking 2024-07-21 12:17:50 +02:00
Lukas Wirth
2a32976e90 Use out parameter instead of return value for find_path choice 2024-07-21 11:32:48 +02:00
Lukas Wirth
9fd6d26e97 Fix using wrong length for max_len arg 2024-07-21 11:16:23 +02:00
Lukas Wirth
2564b69e1d Specialize find_path local search 2024-07-21 11:10:15 +02:00
Lukas Wirth
a6e4ac705c Optimize find_path choice selection 2024-07-21 10:53:33 +02:00
bors
88258b7fd2 Auto merge of #17653 - Veykril:std-find-path, r=Veykril
Prefer standard library paths over shorter extern deps re-exports

This should generally speed up path finding for std items as we no longer bother looking through all external dependencies. It also makes more sense to prefer importing std items from the std dependencies directly.

Fixes https://github.com/rust-lang/rust-analyzer/issues/17540
2024-07-21 07:24:38 +00:00
Lukas Wirth
40bbc684ad Prefer standard library paths over shorter extern deps re-exports 2024-07-21 09:14:17 +02:00
bors
5f26438b5d Auto merge of #17650 - ObsidianMinor:fix/17645, r=Veykril
Fix path resolution for child mods of those expanded by `include!`

Child modules wouldn't use the correct candidate paths due to a branch that doesn't seem to be doing what it's intended to do. Removing the branch fixes the problem and all existing test cases pass.

Having no knowledge of how any of this works, I believe this fixes #17645. Using another test that writes the included mod directly into `lib.rs` instead, I found the difference can be traced to the candidate files we use to look up mods. A separate branch for if the file comes from an `include!` macro doesn't take into account the original mod we're contained within:

```rust
None if file_id.macro_file().map_or(false, |it| it.is_include_macro(db.upcast())) => {
    candidate_files.push(format!("{}.rs", name.display(db.upcast())));
    candidate_files.push(format!("{}/mod.rs", name.display(db.upcast())));
}
```

I'm not sure why this branch exists. Tracing the branch back takes us to 3bb9efb but it doesn't say *why* the branch was added. The test case that was added in this commit passes with the branch removed, so I think it's just superfluous at this point.
2024-07-21 06:17:14 +00:00
Sydney Acksman
b9469f52a3 Fix path resolution for child mods of those expanded by include!
Child modules wouldn't use the correct candidate paths due to a branch that doesn't seem to be doing what it's intended to do. Removing the branch fixes the problem and all existing test cases pass.
2024-07-20 14:32:28 -05:00
Laurențiu Nicola
1075978bed Fix some typos 2024-07-20 08:30:22 +03:00
Lukas Wirth
546eb6b530 Test macros doing edition dependent parsing 2024-07-19 16:43:58 +02:00
Lukas Wirth
5264f86242 Encode edition within FileId in the hir layer 2024-07-18 08:49:10 +02:00
Lukas Wirth
92268627a8 Support rustc_skip_during_method_dispatch 2024-07-17 11:46:36 +02:00
Lukas Wirth
7011094685 Add always disabled gen parse support 2024-07-17 10:49:12 +02:00
Lukas Wirth
2346a80ab4 Remove Name::to_smol_str 2024-07-16 12:43:58 +02:00
Lukas Wirth
df5f1777b8 More symbol usage 2024-07-16 12:05:16 +02:00
Lukas Wirth
93024ad411 Switch token trees to use Symbols 2024-07-16 10:11:59 +02:00
Lukas Wirth
dcfda55c82 Escape fetched env vars in env! expansion 2024-07-15 13:08:29 +02:00
Lukas Wirth
e846c04fbe Encode ident rawness and literal kind separately in tt::Leaf 2024-07-15 12:24:40 +02:00
Lukas Wirth
cde0f69cae Fix stable iteration ordering for Map<Name, ...> usages 2024-07-15 11:25:46 +02:00
Lukas Wirth
f2d51073d2 Use statics + clone instead of const until const can access statics 2024-07-14 17:52:59 +02:00
Shoyu Vanilla
b238855892 Allow macro expansions into RestPat in tuple args work as ellipsis like plain RestPat 2024-07-13 07:09:17 +09: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
a5b21ea0aa Auto merge of #17555 - Veykril:grammar-inline, r=Veykril
internal: Inline generated syntax methods
2024-07-07 09:21:04 +00:00
Lukas Wirth
c08d419fba HasGenericArgs syntax trait 2024-07-07 11:18:28 +02: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
90682c393d Drop unused profile things 2024-07-07 08:24:10 +02:00
Shoyu Vanilla
4bb623decb Disallow nested impl traits 2024-07-04 23:31:55 +09: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
Shohei Wada
3725ab3146 squash. 2024-07-02 01:52:34 +09: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
Lukas Wirth
882ae7105d Simplify unresolved proc-macro handling 2024-06-30 13:26:13 +02:00
Lukas Wirth
8df034d453 Shrink mbe's Op 2024-06-24 10:07:32 +02:00
Lukas Wirth
e052b3e9a6 Intern ModPath within RawVisibility 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
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
f9bb5476c3 fix: Fix pat fragment parsers choking on <eoi> 2024-06-17 19:42:56 +02:00
bors
6b8b8ff4c5 Auto merge of #17417 - Wilfred:intern_macros_salsa, r=Veykril
refactor: Prefer plain trait definitions over macros for impl_intern_value_trivial

`impl_intern_value_trivial` can be defined with a trait directly, so prefer that over a macro definition.
2024-06-14 06:20:26 +00:00
Wilfred Hughes
3874681cb6 Prefer plain trait definitions over macros for salsa 2024-06-13 17:32:06 -07:00
Wilfred Hughes
d68e549205 internal: Fix rustdoc warnings
`cargo doc` generates a bunch of warnings on rust-analyzer. Fix all the
bare URL and empty code block warnings.
2024-06-13 17:29:10 -07:00
bors
fa486e694e Auto merge of #17406 - Veykril:modpath-clone, r=Veykril
internal: Don't unnecessarily clone ModPaths out of interning wrappers
2024-06-12 09:49:41 +00:00
Lukas Wirth
ba543f7d76 internal: Don't unnecessarily clone ModPaths out of interning wrappers 2024-06-12 11:43:36 +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
b5e0d7c349 Auto merge of #17398 - Veykril:bogus-file, r=Veykril
internal: Remove FileId::BOGUS
2024-06-12 07:19:31 +00:00
Lukas Wirth
8ebabce475 internal: Remove FileId::BOGUS 2024-06-12 08:16:07 +02:00
Young-Flash
6403bdb930 minor: use push_str instead 2024-06-09 22:31:55 +08:00
Young-Flash
e8941dae46 internal: tweak test case 2024-06-09 20:55:40 +08:00
Young-Flash
dcbc76b967 internal: better print style for hir 2024-06-09 12:00:43 +08:00
Wilfred Hughes
27182bb96b chore: Prefer tracing span shorthand macros 2024-06-06 16:52:25 -07:00
bors
af488c971f Auto merge of #17352 - roife:fix-issue-17338, r=Veykril
fix: do not resolve prelude within block modules

fix #17338 (continuing from #17251).

In #17251, we injected preludes into non-top-level modules, which leading to r-a to directly resolve names in preludes in block modules. This PR fix it by checking whether the module is a pseudo-module introduced by blocks. (similar to what we do for extern preludes)
2024-06-06 09:40:39 +00:00
roife
c330c62aa2 fix: do not resolve prelude within block modules 2024-06-06 16:55:09 +08:00
Lukas Wirth
97b58f2846 Try caching macro calls more aggressively 2024-06-04 15:23:00 +02:00
Lukas Wirth
6f0207d594 Cleanup some inert attribute stuff 2024-06-04 12:38:20 +02:00
Lukas Wirth
f1dbb958c8 Add fuel to find_path 2024-06-03 20:07:00 +02:00
Lukas Wirth
f94d34bd72 Remove an allocation in find_path::find_local_import_locations 2024-06-03 19:57:49 +02:00
Lukas Wirth
48822e0941 Simplify 2024-06-03 19:46:40 +02:00
Lukas Wirth
426d01eab0 Deduplicate 2024-06-03 19:26:11 +02:00
Lukas Wirth
db80216dac Fix find_path search not reducing scope appropriately for foreign items 2024-06-03 19:21:19 +02:00
Lukas Wirth
60fa981df1 Simplify 2024-06-03 19:06:58 +02: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
bors
d4da3f925c Auto merge of #17251 - roife:fix-issue-17057, r=Veykril
fix: resolve extern prelude for local mods in block modules

fix https://github.com/rust-lang/rust-analyzer/issues/17057, https://github.com/rust-lang/rust-analyzer/issues/17032.

We should use `ModuleOrigin` to check if the current module is a pseudo-module introduced by blocks (where names might be shadowed), rather than checking `block_def_map`.
2024-05-22 20:11:24 +00: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
roife
d9cc159b26 fix: check pseudo-block by local_id instead of ModuleOrigin 2024-05-23 02:39:53 +08: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
42a8500ebf Auto merge of #17279 - Veykril:format_args-escape, r=Veykril
fix: Fix format_args lowering passing incorrect parameters to `rustc_parse_format`
2024-05-22 14:12:22 +00:00
Lukas Wirth
4f17d07e69 fix: Fix format_args lowering passing incorrect parameters to rustc_parse_format 2024-05-22 16:11:06 +02: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
ca06b090d7 expectify find_path tests 2024-05-22 14:05:24 +02:00
Lukas Wirth
c88b421853 fix: Fix general find-path inconsistencies 2024-05-22 14:05:24 +02:00
roife
48dc20f80d test: add tests for extern preludes resolving in local mods 2024-05-21 20:35:55 +08:00
Laurențiu Nicola
49cae17fa2 Merge from rust-lang/rust 2024-05-19 11:20:26 +03:00
Lukas Wirth
cd9e90cc71 Update builtin tool list 2024-05-18 10:52:05 +02:00
roife
55db9530eb fix: resolve extern prelude for local mods in block modules 2024-05-17 23:29:00 +08:00
bors
77c7886283 Auto merge of #17227 - Veykril:build-deps-changed-hashes, r=Veykril
fix: Hash file contents to verify whether file actually changed

Fixes https://github.com/rust-lang/rust-analyzer/issues/16580
2024-05-14 10:48:18 +00:00
Lukas Wirth
1ca97ba896 Hash file contents to verify whether file actually changed 2024-05-14 11:55:12 +02:00
bors
d28111dce8 Auto merge of #17224 - Veykril:lock-bump, r=Veykril
Bump Cargo.lock
2024-05-14 08:59:34 +00:00
Lukas Wirth
2a4be8d1f7 Bump Cargo.lock 2024-05-14 10:57:02 +02:00
bors
b98690ba74 Auto merge of #17221 - Veykril:lazier-validation, r=Veykril
internal: Lazier macro parse tree validation
2024-05-13 15:16:46 +00:00
Lukas Wirth
56552f4839 Push macro-parsing error calculation out of fundamental queries 2024-05-13 16:56:26 +02:00
Lukas Wirth
a39c0493a1 Render literal escaping errors in hovers 2024-05-13 12:51:57 +02:00
Martin Nordholts
938e1a0e2c Change SIGPIPE ui from #[unix_sigpipe = "..."] to -Zon-broken-pipe=...
In the stabilization attempt of `#[unix_sigpipe = "sig_dfl"]`, a concern
was raised related to using a language attribute for the feature: Long
term, we want `fn lang_start()` to be definable by any crate, not just
libstd. Having a special language attribute in that case becomes
awkward.

So as a first step towards towards the next stabilization attempt, this
PR changes the `#[unix_sigpipe = "..."]` attribute to a compiler flag
`-Zon-broken-pipe=...` to remove that concern, since now the language
is not "contaminated" by this feature.

Another point was also raised, namely that the ui should not leak
**how** it does things, but rather what the **end effect** is. The new
flag uses the proposed naming. This is of course something that can be
iterated on further before stabilization.
2024-05-02 19:48:29 +02:00
bors
ecba59d69c Auto merge of #17175 - Veykril:fix-implicit-ty-args, r=Veykril
fix: Fix implicit ty args being lowered where they shouldn't

Fixes https://github.com/rust-lang/rust-analyzer/issues/17173
2024-05-02 10:04:13 +00:00
Lukas Wirth
8241d8a0b8 fix: Fix implicit ty args being lowered where they shouldn't 2024-05-02 11:53:53 +02:00
Lukas Wirth
a268eaf053 fix: Correctly handle no_core/no_std for preludes 2024-05-02 10:50:28 +02:00
Lukas Wirth
da0fb75d10
Use RefCell::take 2024-04-30 14:19:56 +02:00
dfireBird
40a677ddf0
implement creating generics for impl traits in associated types 2024-04-29 23:55:02 +05:30
Lukas Wirth
36c1c77cf9 fix: Fix doc comment desugaring for proc-macros 2024-04-27 13:30:51 +02:00
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