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 #120447

Merged
merged 38 commits into from
Feb 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
6001c50
Detect `NulInCStr` error earlier.
nnethercote Dec 6, 2023
6231ca5
fix(rust-analyzer): use new pkgid spec to compare
weihanglo Jan 18, 2024
7d4980a
Rollup merge of #119172 - nnethercote:earlier-NulInCStr, r=petrochenkov
matthiaskrgr Jan 18, 2024
1a9ef23
Remove unused codes
mu001999 Jan 21, 2024
0661390
Rollup merge of #120084 - weihanglo:pkgid-spec, r=Mark-Simulacrum
Nadrieril Jan 21, 2024
e4866b6
Merge commit 'a9116523604c998e7781f60d3b5a6f586e0414a9' into sync-fro…
lnicola Jan 21, 2024
47b0f46
Auto merge of #16409 - mu001999:master, r=HKalbasi
bors Jan 21, 2024
8af2b4d
Merge remote-tracking branch 'upstream/master' into sync-from-rust
lnicola Jan 21, 2024
ef6e6df
Merge remote-tracking branch 'upstream/master' into sync-from-rust
lnicola Jan 21, 2024
0ea0565
Revert "Detect `NulInCStr` error earlier."
lnicola Jan 21, 2024
5607714
Format code
lnicola Jan 21, 2024
d410d4a
Auto merge of #16412 - lnicola:sync-from-rust, r=lnicola
bors Jan 21, 2024
231f730
internal: Make TryToNav trait public
Waqar144 Jan 22, 2024
2370b70
Replace local copy of exhaustiveness checking with upstream librarifi…
Nadrieril Jan 16, 2024
0d52934
Auto merge of #16420 - Nadrieril:use-upstream-pattern-analysis, r=Vey…
bors Jan 24, 2024
b1b6e0c
Reapply "Detect `NulInCStr` error earlier."
lnicola Jan 25, 2024
b1b99cb
Bump rustc_lexer and rustc_parse_format
lnicola Jan 25, 2024
ea94c10
Bump rustc_index and rustc_abi
lnicola Jan 25, 2024
38f7a34
Auto merge of #16426 - lnicola:bump-rustc, r=lnicola
bors Jan 25, 2024
4505f03
fix: filter out cfg disabled filed when lowering `RecordPat`
Young-Flash Jan 25, 2024
1374bc8
test: ensure `no_such_field` diagnostic don't work for field with dis…
Young-Flash Jan 25, 2024
8f05e7c
Replaced adjusted_display_range with it's new version in mismatched_a…
Ar4ys Jan 25, 2024
f090205
Auto merge of #16415 - Waqar144:work/make-try-to-nav-pub, r=Veykril
bors Jan 26, 2024
e320004
Remove tt -> ast -> tt round trips in attrs lowering
Veykril Jan 24, 2024
880baa9
Shuffle hir-expand things around
Veykril Jan 25, 2024
d8ef6c2
Cleanup `convert_path`
Veykril Jan 25, 2024
5a34341
Add some size assertions
Veykril Jan 26, 2024
596e5c7
Auto merge of #16431 - Ar4ys:fix-E0107-error-range-in-proc-macro, r=V…
bors Jan 26, 2024
6cf7b5f
Don't parse intra doc links as syntax trees
Veykril Jan 26, 2024
ad5e2cf
Do not return code lens data after resolving
SomeoneToIgnore Jan 27, 2024
4a23744
Auto merge of #16435 - SomeoneToIgnore:less_resolve_data, r=lnicola
bors Jan 27, 2024
8a5829c
Re-order mod declarations
Veykril Jan 26, 2024
27c3ed9
Auto merge of #16434 - Veykril:things, r=Veykril
bors Jan 27, 2024
7219414
Auto merge of #16427 - Young-Flash:fix_no_such_field_diagnostics, r=V…
bors Jan 27, 2024
e71b4c7
Merge commit '7219414e81810fd4d967136c4a0650523892c157' into sync-fro…
lnicola Jan 28, 2024
e7e81cf
Silence triagebot on subtree syncs
lnicola Jan 28, 2024
309d615
Add rustc_apfloat license exception for RA
lnicola Jan 28, 2024
7159d88
Revert "Silence triagebot on subtree syncs"
lnicola Jan 28, 2024
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
91 changes: 69 additions & 22 deletions src/tools/rust-analyzer/Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ checksum = "5676cea088c32290fe65c82895be9d06dd21e0fa49bb97ca840529e9417ab71a"
dependencies = [
"proc-macro2",
"quote",
"syn",
"syn 2.0.39",
"synstructure",
]

Expand Down Expand Up @@ -312,6 +312,17 @@ dependencies = [
"parking_lot_core",
]

[[package]]
name = "derivative"
version = "2.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b"
dependencies = [
"proc-macro2",
"quote",
"syn 1.0.109",
]

[[package]]
name = "derive_arbitrary"
version = "1.3.2"
Expand All @@ -320,7 +331,7 @@ checksum = "67e77553c4162a157adbf834ebae5b415acbecbeafc7a74b0e886657506a7611"
dependencies = [
"proc-macro2",
"quote",
"syn",
"syn 2.0.39",
]

[[package]]
Expand Down Expand Up @@ -582,6 +593,7 @@ dependencies = [
"project-model",
"ra-ap-rustc_abi",
"ra-ap-rustc_index",
"ra-ap-rustc_pattern_analysis",
"rustc-hash",
"scoped-tls",
"smallvec",
Expand Down Expand Up @@ -1407,20 +1419,20 @@ dependencies = [

[[package]]
name = "ra-ap-rustc_abi"
version = "0.21.0"
version = "0.33.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7816f980fab89e878ff2e916e2077d484e3aa1c619a3cc982c8a417c3dfe45fa"
checksum = "8ce9100fc66c6c60aeeb076868ead9c2eaa65d6a5a90404f08c242327a92ff4b"
dependencies = [
"bitflags 1.3.2",
"bitflags 2.4.1",
"ra-ap-rustc_index",
"tracing",
]

[[package]]
name = "ra-ap-rustc_index"
version = "0.21.0"
version = "0.33.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8352918d61aa4afab9f2ed7314cf638976b20949b3d61d2f468c975b0d251f24"
checksum = "5e5313d7f243b63ef9e58d94355b11aa8499f1328055f1f58adf0a5ea7d2faca"
dependencies = [
"arrayvec",
"ra-ap-rustc_index_macros",
Expand All @@ -1429,36 +1441,50 @@ dependencies = [

[[package]]
name = "ra-ap-rustc_index_macros"
version = "0.21.0"
version = "0.33.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "66a9424018828155a3e3596515598f90e68427d8f35eff6df7f0856c73fc58a8"
checksum = "a83108ebf3e73dde205b9c25706209bcd7736480820f90ded28eabaf8b469f25"
dependencies = [
"proc-macro2",
"quote",
"syn",
"syn 2.0.39",
"synstructure",
]

[[package]]
name = "ra-ap-rustc_lexer"
version = "0.21.0"
version = "0.33.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dc741c7a78103efab416b562e35bd73c8d4967478575010c86c6062f8d3cbf29"
checksum = "d2d221356e5717595e8a0afa5fba1620dcb4032ab784dc4d98fdc7284e3feb66"
dependencies = [
"unicode-properties",
"unicode-xid",
]

[[package]]
name = "ra-ap-rustc_parse_format"
version = "0.21.0"
version = "0.33.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d557201d71792487bd2bab637ab5be9aa6fff59b88e25e12de180b0f9d2df60f"
checksum = "ab62fc925612374103b4f178da347b535b35d9eb1ff5ba42105c990b2e25a164"
dependencies = [
"ra-ap-rustc_index",
"ra-ap-rustc_lexer",
]

[[package]]
name = "ra-ap-rustc_pattern_analysis"
version = "0.33.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6c4085e0c771fd4b883930b599ef42966b855762bbe4052c17673b3253421a6d"
dependencies = [
"derivative",
"ra-ap-rustc_index",
"rustc-hash",
"rustc_apfloat",
"smallvec",
"tracing",
]

[[package]]
name = "rayon"
version = "1.8.0"
Expand Down Expand Up @@ -1593,7 +1619,7 @@ dependencies = [
"heck",
"proc-macro2",
"quote",
"syn",
"syn 2.0.39",
]

[[package]]
Expand All @@ -1608,6 +1634,16 @@ version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"

[[package]]
name = "rustc_apfloat"
version = "0.2.0+llvm-462a31f5a5ab"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "465187772033a5ee566f69fe008df03628fce549a0899aae76f0a0c2e34696be"
dependencies = [
"bitflags 1.3.2",
"smallvec",
]

[[package]]
name = "ryu"
version = "1.0.13"
Expand Down Expand Up @@ -1670,7 +1706,7 @@ checksum = "43576ca501357b9b071ac53cdc7da8ef0cbd9493d8df094cd821777ea6e894d3"
dependencies = [
"proc-macro2",
"quote",
"syn",
"syn 2.0.39",
]

[[package]]
Expand All @@ -1693,7 +1729,7 @@ checksum = "bcec881020c684085e55a25f7fd888954d56609ef363479dc5a1305eb0d40cab"
dependencies = [
"proc-macro2",
"quote",
"syn",
"syn 2.0.39",
]

[[package]]
Expand All @@ -1707,9 +1743,9 @@ dependencies = [

[[package]]
name = "smallvec"
version = "1.10.0"
version = "1.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0"
checksum = "2593d31f82ead8df961d8bd23a64c2ccf2eb5dd34b0a34bfb4dd54011c72009e"

[[package]]
name = "smol_str"
Expand Down Expand Up @@ -1770,6 +1806,17 @@ dependencies = [
"winapi",
]

[[package]]
name = "syn"
version = "1.0.109"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237"
dependencies = [
"proc-macro2",
"quote",
"unicode-ident",
]

[[package]]
name = "syn"
version = "2.0.39"
Expand All @@ -1789,7 +1836,7 @@ checksum = "285ba80e733fac80aa4270fbcdf83772a79b80aa35c97075320abfee4a915b06"
dependencies = [
"proc-macro2",
"quote",
"syn",
"syn 2.0.39",
"unicode-xid",
]

Expand Down Expand Up @@ -1876,7 +1923,7 @@ checksum = "f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f"
dependencies = [
"proc-macro2",
"quote",
"syn",
"syn 2.0.39",
]

[[package]]
Expand Down Expand Up @@ -1977,7 +2024,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7"
dependencies = [
"proc-macro2",
"quote",
"syn",
"syn 2.0.39",
]

[[package]]
Expand Down
9 changes: 5 additions & 4 deletions src/tools/rust-analyzer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,11 @@ tt = { path = "./crates/tt", version = "0.0.0" }
vfs-notify = { path = "./crates/vfs-notify", version = "0.0.0" }
vfs = { path = "./crates/vfs", version = "0.0.0" }

ra-ap-rustc_lexer = { version = "0.21.0", default-features = false }
ra-ap-rustc_parse_format = { version = "0.21.0", default-features = false }
ra-ap-rustc_index = { version = "0.21.0", default-features = false }
ra-ap-rustc_abi = { version = "0.21.0", default-features = false }
ra-ap-rustc_lexer = { version = "0.33.0", default-features = false }
ra-ap-rustc_parse_format = { version = "0.33.0", default-features = false }
ra-ap-rustc_index = { version = "0.33.0", default-features = false }
ra-ap-rustc_abi = { version = "0.33.0", default-features = false }
ra-ap-rustc_pattern_analysis = { version = "0.33.0", default-features = false }

# local crates that aren't published to crates.io. These should not have versions.
sourcegen = { path = "./crates/sourcegen" }
Expand Down
2 changes: 1 addition & 1 deletion src/tools/rust-analyzer/crates/base-db/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

#![warn(rust_2018_idioms, unused_lifetimes)]

mod input;
mod change;
mod input;

use std::panic;

Expand Down
22 changes: 0 additions & 22 deletions src/tools/rust-analyzer/crates/cfg/src/cfg_expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,28 +18,6 @@ pub enum CfgAtom {
KeyValue { key: SmolStr, value: SmolStr },
}

impl CfgAtom {
/// Returns `true` when the atom comes from the target specification.
///
/// If this returns `true`, then changing this atom requires changing the compilation target. If
/// it returns `false`, the atom might come from a build script or the build system.
pub fn is_target_defined(&self) -> bool {
match self {
CfgAtom::Flag(flag) => matches!(&**flag, "unix" | "windows"),
CfgAtom::KeyValue { key, value: _ } => matches!(
&**key,
"target_arch"
| "target_os"
| "target_env"
| "target_family"
| "target_endian"
| "target_pointer_width"
| "target_vendor" // NOTE: `target_feature` is left out since it can be configured via `-Ctarget-feature`
),
}
}
}

impl fmt::Display for CfgAtom {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Expand Down
8 changes: 3 additions & 5 deletions src/tools/rust-analyzer/crates/cfg/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,9 @@ impl CfgDiff {
/// of both.
pub fn new(enable: Vec<CfgAtom>, disable: Vec<CfgAtom>) -> Option<CfgDiff> {
let mut occupied = FxHashSet::default();
for item in enable.iter().chain(disable.iter()) {
if !occupied.insert(item) {
// was present
return None;
}
if enable.iter().chain(disable.iter()).any(|item| !occupied.insert(item)) {
// was present
return None;
}

Some(CfgDiff { enable, disable })
Expand Down
11 changes: 4 additions & 7 deletions src/tools/rust-analyzer/crates/hir-def/src/attr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ use crate::{
VariantId,
};

/// Desugared attributes of an item post `cfg_attr` expansion.
#[derive(Default, Debug, Clone, PartialEq, Eq)]
pub struct Attrs(RawAttrs);

Expand Down Expand Up @@ -228,7 +229,6 @@ pub enum DocAtom {
KeyValue { key: SmolStr, value: SmolStr },
}

// Adapted from `CfgExpr` parsing code
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum DocExpr {
Invalid,
Expand Down Expand Up @@ -448,10 +448,7 @@ impl AttrsWithOwner {
let map = db.fields_attrs_source_map(id.parent);
let file_id = id.parent.file_id(db);
let root = db.parse_or_expand(file_id);
let owner = match &map[id.local_id] {
Either::Left(it) => ast::AnyHasAttrs::new(it.to_node(&root)),
Either::Right(it) => ast::AnyHasAttrs::new(it.to_node(&root)),
};
let owner = ast::AnyHasAttrs::new(map[id.local_id].to_node(&root));
InFile::new(file_id, owner)
}
AttrDefId::AdtId(adt) => match adt {
Expand Down Expand Up @@ -634,7 +631,7 @@ fn attrs_from_item_tree_assoc<'db, N: ItemTreeModItemNode>(
pub(crate) fn fields_attrs_source_map(
db: &dyn DefDatabase,
def: VariantId,
) -> Arc<ArenaMap<LocalFieldId, Either<AstPtr<ast::TupleField>, AstPtr<ast::RecordField>>>> {
) -> Arc<ArenaMap<LocalFieldId, AstPtr<Either<ast::TupleField, ast::RecordField>>>> {
let mut res = ArenaMap::default();
let child_source = def.child_source(db);

Expand All @@ -643,7 +640,7 @@ pub(crate) fn fields_attrs_source_map(
idx,
variant
.as_ref()
.either(|l| Either::Left(AstPtr::new(l)), |r| Either::Right(AstPtr::new(r))),
.either(|l| AstPtr::new(l).wrap_left(), |r| AstPtr::new(r).wrap_right()),
);
}

Expand Down
4 changes: 2 additions & 2 deletions src/tools/rust-analyzer/crates/hir-def/src/body.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
//! Defines `Body`: a lowered representation of bodies of functions, statics and
//! consts.
mod lower;
mod pretty;
pub mod scope;
#[cfg(test)]
mod tests;
pub mod scope;
mod pretty;

use std::ops::Index;

Expand Down
1 change: 1 addition & 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 @@ -1335,6 +1335,7 @@ impl ExprCollector<'_> {
let args = record_pat_field_list
.fields()
.filter_map(|f| {
self.check_cfg(&f)?;
let ast_pat = f.pat()?;
let pat = self.collect_pat(ast_pat, binding_list);
let name = f.field_name()?.as_name();
Expand Down
2 changes: 1 addition & 1 deletion src/tools/rust-analyzer/crates/hir-def/src/db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ pub trait DefDatabase: InternDatabase + ExpandDatabase + Upcast<dyn ExpandDataba
fn fields_attrs_source_map(
&self,
def: VariantId,
) -> Arc<ArenaMap<LocalFieldId, Either<AstPtr<ast::TupleField>, AstPtr<ast::RecordField>>>>;
) -> Arc<ArenaMap<LocalFieldId, AstPtr<Either<ast::TupleField, ast::RecordField>>>>;

#[salsa::invoke(AttrsWithOwner::attrs_query)]
fn attrs(&self, def: AttrDefId) -> Attrs;
Expand Down
2 changes: 1 addition & 1 deletion src/tools/rust-analyzer/crates/hir-def/src/hir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
//!
//! See also a neighboring `body` module.

pub mod type_ref;
pub mod format_args;
pub mod type_ref;

use std::fmt;

Expand Down
Loading
Loading