Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Subtree update of rust-analyzer #136117

Merged
merged 67 commits into from
Jan 29, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
4a7ec72
Make niches into nices
ThouCheese Jan 18, 2025
8b25ab0
Fix missing upmapping in trait impls completion
ChayimFriedman2 Jan 19, 2025
48d17b4
Move dual blanket impl logic from source analyzer to goto_def
Veykril Jan 20, 2025
4bc683d
Bring back goto def redirect for parse -> FromStr
Veykril Jan 20, 2025
ea3897b
Merge pull request #18984 from Veykril/push-nszlmxoxyxss
Veykril Jan 20, 2025
e9b410d
Goto `Display::fmt` when invoked on `to_string`
Veykril Jan 20, 2025
1d5af89
fix: Only refresh syntax tree view when the active document changes
Giga-Bowser Jan 20, 2025
f98e971
Fix another bug with completion of trait items inside macros
ChayimFriedman2 Jan 20, 2025
6291e1d
Merge pull request #18989 from Giga-Bowser/syntax-tree-refresh
Veykril Jan 21, 2025
0870bfb
Merge pull request #18977 from ChayimFriedman2/fix-upmapping
Veykril Jan 21, 2025
54d1d31
Cleanup `Name` string rendering
Veykril Jan 21, 2025
4b716bb
Merge pull request #18990 from Veykril/push-tqonnqxyrnsv
Veykril Jan 21, 2025
4308352
Merge pull request #18986 from Veykril/push-zlwvwlowpzqm
Veykril Jan 21, 2025
398cd2d
make large niche description more terse, switch to using u128::is_pow…
ThouCheese Jan 21, 2025
feb3fb5
Sort completion items that skip `await` and `iter()` behind those th…
ChayimFriedman2 Jan 20, 2025
a238ab8
Merge pull request #18988 from ChayimFriedman2/iter-relevance
ChayimFriedman2 Jan 21, 2025
f0f7204
Fix Param::as_local treating closures wrong
Veykril Jan 21, 2025
e08f6d4
switch from using leading zeros to trailing zeros
ThouCheese Jan 21, 2025
d8553c9
remove is_pwr2
ThouCheese Jan 21, 2025
284e0cd
Make `InlayHint::linked_location` computation lazy
Veykril Jan 21, 2025
802d9d5
Keep already computed inlay hint properties instead of late resolving…
Veykril Jan 21, 2025
5059c1a
Provide a config to control auto-insertion of `await` and `iter()`
ChayimFriedman2 Jan 21, 2025
c5ccf86
internal: Treat cfg fetching failures as a warning
Wilfred Jan 21, 2025
98582b2
manual: Document all rust-project.json fields
Wilfred Jan 8, 2025
fa272ed
Merge pull request #18878 from Wilfred/document_build_info
lnicola Jan 22, 2025
2eef052
increase `AUTODEREF_RECURSION_LIMIT` to 20
teoxoy Jan 22, 2025
3ca1066
Merge pull request #19004 from teoxoy/patch-1
ChayimFriedman2 Jan 22, 2025
a32f64d
Rephrase comment
lnicola Jan 23, 2025
7ba18da
Merge pull request #19009 from lnicola/dont-just-die
lnicola Jan 23, 2025
27084a2
Check cfg when collecting macro defs
darichey Jan 23, 2025
99b0ab5
Fix `ItemScope` not recording glob imports
Veykril Jan 24, 2025
a365f73
Merge pull request #19014 from darichey/fix-cfg-macro
Veykril Jan 24, 2025
dfd9490
fix: Fix flycheck panicking with "once" invocation strategy
Veykril Jan 24, 2025
2a9e6fb
Merge pull request #19016 from Veykril/push-moqnsytyrupu
Veykril Jan 24, 2025
5d9df43
Merge pull request #18994 from Wilfred/failed_rustc_cfg_as_warning
Veykril Jan 24, 2025
c3e88ae
Merge pull request #18993 from ChayimFriedman2/iter-config
Veykril Jan 24, 2025
b7997e0
Merge pull request #19017 from Veykril/push-uktrsknwmsvy
Veykril Jan 24, 2025
024da87
feat: Implement `arbitrary-self-types`
ShoyuVanilla Jan 23, 2025
3e6a933
Merge pull request #19012 from ShoyuVanilla/arbitrary-self
Veykril Jan 24, 2025
1dc34ee
Add a new failing test that overflows stack
ShoyuVanilla Jan 24, 2025
1e5f47b
Record the use tree index in glob imports
Veykril Jan 24, 2025
b44570f
Lazily compute location links in type hints again
Veykril Jan 24, 2025
51b323f
Merge pull request #18991 from Veykril/push-rmqmnrymwmoz
Veykril Jan 24, 2025
8063b1e
Merge pull request #19018 from Veykril/push-wxqqunxwrply
Veykril Jan 24, 2025
0a14e17
Explicitly add buildfiles when constructing ProjectFolders
darichey Jan 24, 2025
fff24d5
minor: Suggest better names when a type is a sequence
Wilfred Jan 24, 2025
165d78a
Merge pull request #19019 from darichey/add-buildfiles
Veykril Jan 25, 2025
7a7eb69
Merge pull request #19023 from Wilfred/sequence_type_names
Veykril Jan 25, 2025
37fc7ee
Merge pull request #18973 from ThouCheese/feat/nice-niches
Veykril Jan 25, 2025
592ecee
Only collect implicit visibile use symbols if they have renames
Veykril Jan 25, 2025
f45b8ad
Merge pull request #19026 from Veykril/push-wrxrutptywzx
Veykril Jan 25, 2025
0db8d05
Fix flyimport not filtering via stability of import path
Veykril Jan 25, 2025
58401ab
Merge pull request #19028 from Veykril/push-vuytpkvqzwzs
Veykril Jan 25, 2025
5d94c97
Skip redundant path search in `resolve_completion_edits`
Veykril Jan 25, 2025
a91b571
Merge pull request #19029 from Veykril/push-wklzwzqvkrou
Veykril Jan 25, 2025
105ea3b
Use `strict_provenance`
Veykril Jan 10, 2025
80615d9
Merge pull request #18909 from Veykril/push-rrpprwwzttkt
Veykril Jan 25, 2025
a5cd6c0
fix: Fix markdown horizontal ruler sometimes being treated as a heading
Veykril Jan 25, 2025
c1db5da
Merge pull request #19030 from Veykril/push-wuzvopyooznm
Veykril Jan 25, 2025
9691d22
fix: Prevent infinite recursion of bounds formatting
ShoyuVanilla Jan 24, 2025
2d94c69
Merge pull request #19020 from ShoyuVanilla/issues-19007
Veykril Jan 25, 2025
9ae0e7b
Don't complete doc(hidden) enum variants and use trees
ChayimFriedman2 Jan 25, 2025
3149e0f
Make proc_macro span's line & column 1-indexed, as documented
ChayimFriedman2 Jan 25, 2025
bbf9ff6
Merge pull request #19033 from ChayimFriedman2/span-1
ChayimFriedman2 Jan 26, 2025
176852b
Merge pull request #19034 from ChayimFriedman2/complete-hidden-variant
Veykril Jan 26, 2025
9ad5915
Update outdated permissions section in the README.md
Veykril Jan 26, 2025
a7cbe4b
Merge pull request #19035 from rust-lang/Veykril-patch-1
Veykril Jan 26, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions src/tools/rust-analyzer/Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -846,7 +846,6 @@ dependencies = [
"dashmap",
"hashbrown",
"rustc-hash 2.0.0",
"sptr",
"triomphe",
]

Expand Down Expand Up @@ -1927,12 +1926,6 @@ dependencies = [
"vfs",
]

[[package]]
name = "sptr"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3b9b39299b249ad65f3b7e96443bad61c02ca5cd3589f46cb6d610a0fd6c0d6a"

[[package]]
name = "stdx"
version = "0.0.0"
Expand Down
2 changes: 1 addition & 1 deletion src/tools/rust-analyzer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ exclude = ["crates/proc-macro-srv/proc-macro-test/imp"]
resolver = "2"

[workspace.package]
rust-version = "1.83"
rust-version = "1.84"
edition = "2021"
license = "MIT OR Apache-2.0"
authors = ["rust-analyzer team"]
Expand Down
6 changes: 6 additions & 0 deletions src/tools/rust-analyzer/crates/hir-def/src/body/lower.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1381,6 +1381,9 @@ impl ExprCollector<'_> {
}
}
ast::Stmt::Item(ast::Item::MacroDef(macro_)) => {
if self.check_cfg(&macro_).is_none() {
return;
}
let Some(name) = macro_.name() else {
statements.push(Statement::Item(Item::Other));
return;
Expand All @@ -1390,6 +1393,9 @@ impl ExprCollector<'_> {
self.collect_macro_def(statements, macro_id);
}
ast::Stmt::Item(ast::Item::MacroRules(macro_)) => {
if self.check_cfg(&macro_).is_none() {
return;
}
let Some(name) = macro_.name() else {
statements.push(Statement::Item(Item::Other));
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ fn outer() {

block scope::tests
name: _
outer: v
outer: vg

crate
outer: v
Expand Down
25 changes: 19 additions & 6 deletions src/tools/rust-analyzer/crates/hir-def/src/find_path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,10 @@ fn find_in_dep(
};
cov_mark::hit!(partially_imported);
if info.is_unstable {
if !ctx.cfg.allow_unstable {
// the item is unstable and we are not allowed to use unstable items
continue;
}
choice.stability = Unstable;
}

Expand Down Expand Up @@ -670,6 +674,7 @@ mod tests {
prefer_prelude: bool,
prefer_absolute: bool,
prefer_no_std: bool,
allow_unstable: bool,
expect: Expect,
) {
let (db, pos) = TestDB::with_position(ra_fixture);
Expand Down Expand Up @@ -711,7 +716,7 @@ mod tests {
module,
prefix,
ignore_local_imports,
ImportPathConfig { prefer_no_std, prefer_prelude, prefer_absolute },
ImportPathConfig { prefer_no_std, prefer_prelude, prefer_absolute, allow_unstable },
);
format_to!(
res,
Expand All @@ -732,31 +737,39 @@ mod tests {
path: &str,
expect: Expect,
) {
check_found_path_(ra_fixture, path, false, false, false, expect);
check_found_path_(ra_fixture, path, false, false, false, false, expect);
}

fn check_found_path_prelude(
#[rust_analyzer::rust_fixture] ra_fixture: &str,
path: &str,
expect: Expect,
) {
check_found_path_(ra_fixture, path, true, false, false, expect);
check_found_path_(ra_fixture, path, true, false, false, false, expect);
}

fn check_found_path_absolute(
#[rust_analyzer::rust_fixture] ra_fixture: &str,
path: &str,
expect: Expect,
) {
check_found_path_(ra_fixture, path, false, true, false, expect);
check_found_path_(ra_fixture, path, false, true, false, false, expect);
}

fn check_found_path_prefer_no_std(
#[rust_analyzer::rust_fixture] ra_fixture: &str,
path: &str,
expect: Expect,
) {
check_found_path_(ra_fixture, path, false, false, true, expect);
check_found_path_(ra_fixture, path, false, false, true, false, expect);
}

fn check_found_path_prefer_no_std_allow_unstable(
#[rust_analyzer::rust_fixture] ra_fixture: &str,
path: &str,
expect: Expect,
) {
check_found_path_(ra_fixture, path, false, false, true, true, expect);
}

#[test]
Expand Down Expand Up @@ -1951,7 +1964,7 @@ pub mod ops {

#[test]
fn respect_unstable_modules() {
check_found_path_prefer_no_std(
check_found_path_prefer_no_std_allow_unstable(
r#"
//- /main.rs crate:main deps:std,core
extern crate std;
Expand Down
18 changes: 7 additions & 11 deletions src/tools/rust-analyzer/crates/hir-def/src/import_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ use rustc_hash::FxHashSet;
use smallvec::SmallVec;
use span::Edition;
use stdx::{format_to, TupleExt};
use syntax::ToSmolStr;
use triomphe::Arc;

use crate::{
Expand Down Expand Up @@ -88,9 +87,9 @@ impl ImportMap {
.iter()
// We've only collected items, whose name cannot be tuple field so unwrapping is fine.
.flat_map(|(&item, (info, _))| {
info.iter().enumerate().map(move |(idx, info)| {
(item, info.name.unescaped().display(db.upcast()).to_smolstr(), idx as u32)
})
info.iter()
.enumerate()
.map(move |(idx, info)| (item, info.name.as_str(), idx as u32))
})
.collect();
importables.sort_by(|(_, l_info, _), (_, r_info, _)| {
Expand Down Expand Up @@ -168,7 +167,8 @@ impl ImportMap {
let attr_id = if let Some(import) = import {
match import {
ImportOrExternCrate::ExternCrate(id) => Some(id.into()),
ImportOrExternCrate::Import(id) => Some(id.import.into()),
ImportOrExternCrate::Import(id) => Some(id.use_.into()),
ImportOrExternCrate::Glob(id) => Some(id.use_.into()),
}
} else {
match item {
Expand Down Expand Up @@ -441,7 +441,7 @@ pub fn search_dependencies(
}

fn search_maps(
db: &dyn DefDatabase,
_db: &dyn DefDatabase,
import_maps: &[Arc<ImportMap>],
mut stream: fst::map::Union<'_>,
query: &Query,
Expand All @@ -464,11 +464,7 @@ fn search_maps(
.then(|| (item, &import_infos[info_idx as usize]))
})
.filter(|&(_, info)| {
query.search_mode.check(
&query.query,
query.case_sensitive,
&info.name.unescaped().display(db.upcast()).to_smolstr(),
)
query.search_mode.check(&query.query, query.case_sensitive, info.name.as_str())
});
res.extend(iter.map(TupleExt::head));
}
Expand Down
Loading
Loading