Skip to content

Commit

Permalink
Auto merge of rust-lang#132314 - lnicola:sync-from-ra, r=lnicola
Browse files Browse the repository at this point in the history
Subtree update of `rust-analyzer`

r? `@ghost`
  • Loading branch information
bors committed Oct 29, 2024
2 parents 2df8dbb + eae9d7a commit c8a8c82
Show file tree
Hide file tree
Showing 218 changed files with 7,243 additions and 3,366 deletions.
37 changes: 17 additions & 20 deletions src/tools/rust-analyzer/.github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
# Please make sure that the `needs` fields for both `end-success` and `end-failure`
# Please make sure that the `needs` field for the `conclusion` job
# are updated when adding new jobs!

name: CI
on:
pull_request:
push:
branches:
- auto
- try
- automation/bors/try
merge_group:

env:
CARGO_INCREMENTAL: 0
Expand Down Expand Up @@ -237,20 +233,21 @@ jobs:
- name: check for typos
run: typos

end-success:
name: bors build finished
if: github.event.pusher.name == 'bors' && success()
runs-on: ubuntu-latest
conclusion:
needs: [rust, rust-cross, typescript, typo-check]
steps:
- name: Mark the job as successful
run: exit 0

end-failure:
name: bors build finished
if: github.event.pusher.name == 'bors' && !success()
# We need to ensure this job does *not* get skipped if its dependencies fail,
# because a skipped job is considered a success by GitHub. So we have to
# overwrite `if:`. We use `!cancelled()` to ensure the job does still not get run
# when the workflow is canceled manually.
#
# ALL THE PREVIOUS JOBS NEED TO BE ADDED TO THE `needs` SECTION OF THIS JOB!
if: ${{ !cancelled() }}
runs-on: ubuntu-latest
needs: [rust, rust-cross, typescript, typo-check]
steps:
- name: Mark the job as a failure
run: exit 1
# Manually check the status of all dependencies. `if: failure()` does not work.
- name: Conclusion
run: |
# Print the dependent jobs to see them in the CI log
jq -C <<< '${{ toJson(needs) }}'
# Check if all jobs that we depend on (in the needs array) were successful.
jq --exit-status 'all(.result == "success")' <<< '${{ toJson(needs) }}'
3 changes: 1 addition & 2 deletions src/tools/rust-analyzer/.gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/target/
target/
/dist/
crates/*/target
**/*.rs.bk
**/*.rs.pending-snap
.idea/*
Expand Down
45 changes: 16 additions & 29 deletions src/tools/rust-analyzer/Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ dependencies = [
"rustc-hash 2.0.0",
"syntax",
"syntax-bridge",
"tracing",
"tt",
]

Expand Down Expand Up @@ -556,6 +557,7 @@ dependencies = [
"syntax-bridge",
"test-fixture",
"test-utils",
"text-size",
"tracing",
"triomphe",
"tt",
Expand Down Expand Up @@ -670,7 +672,6 @@ dependencies = [
"syntax",
"test-fixture",
"test-utils",
"text-edit",
"toolchain",
"tracing",
"triomphe",
Expand All @@ -692,7 +693,6 @@ dependencies = [
"syntax",
"test-fixture",
"test-utils",
"text-edit",
"tracing",
]

Expand All @@ -711,7 +711,6 @@ dependencies = [
"syntax",
"test-fixture",
"test-utils",
"text-edit",
"tracing",
]

Expand Down Expand Up @@ -743,7 +742,6 @@ dependencies = [
"syntax",
"test-fixture",
"test-utils",
"text-edit",
"tracing",
"triomphe",
]
Expand All @@ -765,7 +763,6 @@ dependencies = [
"syntax",
"test-fixture",
"test-utils",
"text-edit",
"tracing",
]

Expand All @@ -784,7 +781,6 @@ dependencies = [
"syntax",
"test-fixture",
"test-utils",
"text-edit",
"triomphe",
]

Expand Down Expand Up @@ -1497,9 +1493,9 @@ dependencies = [

[[package]]
name = "ra-ap-rustc_abi"
version = "0.73.0"
version = "0.75.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "879ece0781e3c1cb670b9f29775c81a43a16db789d1296fad6bc5c74065b2fac"
checksum = "d5bc2cfc7264d84215a08875ef90a1d35f76b5c9ad1993515d2da7e4e40b2b4b"
dependencies = [
"bitflags 2.6.0",
"ra-ap-rustc_index",
Expand All @@ -1508,9 +1504,9 @@ dependencies = [

[[package]]
name = "ra-ap-rustc_index"
version = "0.73.0"
version = "0.75.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6910087ff89bb9f3db114bfcd86b5139042731fe7278d3ff4ceaa69a140154a7"
checksum = "e8929140697812e5dd09e19cf446d85146332363f0dbc125d4214834c34ead96"
dependencies = [
"arrayvec",
"ra-ap-rustc_index_macros",
Expand All @@ -1519,9 +1515,9 @@ dependencies = [

[[package]]
name = "ra-ap-rustc_index_macros"
version = "0.73.0"
version = "0.75.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3b6f7bd12b678fbb37444ba77f3b0cfc13b7394a6dc7b0c799491fc9df0a9997"
checksum = "514a3f5d04c8b4a2750f29746cc9abb1f78deb7e72e4ad1dc95bbc608f3db157"
dependencies = [
"proc-macro2",
"quote",
Expand All @@ -1530,29 +1526,29 @@ dependencies = [

[[package]]
name = "ra-ap-rustc_lexer"
version = "0.73.0"
version = "0.75.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "119bc05b5b6bc3e7f5b67ce8b8080e185da94bd83c447f91b6b3f3ecf60cbab1"
checksum = "276fcb1205da071a0cd64416f3f0e198043c11f176c5b501a45dbf0cb33979f2"
dependencies = [
"unicode-properties",
"unicode-xid",
]

[[package]]
name = "ra-ap-rustc_parse_format"
version = "0.73.0"
version = "0.75.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "70ed6150ae71d905c064dc88d7824ebb0fa81083f45d7477cba7b57176f2f635"
checksum = "961b30b22cfac296b14b72e9f95e79c16cebc8c926872755fb1568a6c4243a62"
dependencies = [
"ra-ap-rustc_index",
"ra-ap-rustc_lexer",
]

[[package]]
name = "ra-ap-rustc_pattern_analysis"
version = "0.73.0"
version = "0.75.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6e830862a0ec85fce211d34735315686bb8d6a12d418d6d735fb534aa1cd3293"
checksum = "614232513814a4b714fea7f11345d31c0c277bca3089bb6ca1ec20870bfc022a"
dependencies = [
"ra-ap-rustc_index",
"rustc-hash 2.0.0",
Expand Down Expand Up @@ -1884,9 +1880,9 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67"

[[package]]
name = "smol_str"
version = "0.3.1"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "66eaf762c5af19db3108300515c8aa7a50efc90ff745f4c62288052ebf9fdd25"
checksum = "9676b89cd56310a87b93dec47b11af744f34d5fc9f367b829474eec0a891350d"
dependencies = [
"borsh",
"serde",
Expand Down Expand Up @@ -1978,7 +1974,6 @@ dependencies = [
"smol_str",
"stdx",
"test-utils",
"text-edit",
"tracing",
"triomphe",
]
Expand Down Expand Up @@ -2026,14 +2021,6 @@ dependencies = [
"tracing",
]

[[package]]
name = "text-edit"
version = "0.0.0"
dependencies = [
"itertools",
"text-size",
]

[[package]]
name = "text-size"
version = "1.1.1"
Expand Down
15 changes: 7 additions & 8 deletions 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.81"
rust-version = "1.82"
edition = "2021"
license = "MIT OR Apache-2.0"
authors = ["rust-analyzer team"]
Expand Down Expand Up @@ -79,17 +79,16 @@ span = { path = "./crates/span", version = "0.0.0" }
stdx = { path = "./crates/stdx", version = "0.0.0" }
syntax = { path = "./crates/syntax", version = "0.0.0" }
syntax-bridge = { path = "./crates/syntax-bridge", version = "0.0.0" }
text-edit = { path = "./crates/text-edit", version = "0.0.0" }
toolchain = { path = "./crates/toolchain", version = "0.0.0" }
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.73", default-features = false }
ra-ap-rustc_parse_format = { version = "0.73", default-features = false }
ra-ap-rustc_index = { version = "0.73", default-features = false }
ra-ap-rustc_abi = { version = "0.73", default-features = false }
ra-ap-rustc_pattern_analysis = { version = "0.73", default-features = false }
ra-ap-rustc_lexer = { version = "0.75", default-features = false }
ra-ap-rustc_parse_format = { version = "0.75", default-features = false }
ra-ap-rustc_index = { version = "0.75", default-features = false }
ra-ap-rustc_abi = { version = "0.75", default-features = false }
ra-ap-rustc_pattern_analysis = { version = "0.75", default-features = false }

# local crates that aren't published to crates.io. These should not have versions.
test-fixture = { path = "./crates/test-fixture" }
Expand Down Expand Up @@ -145,7 +144,7 @@ smallvec = { version = "1.10.0", features = [
"union",
"const_generics",
] }
smol_str = "0.3.1"
smol_str = "0.3.2"
snap = "1.1.0"
text-size = "1.1.1"
tracing = "0.1.40"
Expand Down
1 change: 1 addition & 0 deletions src/tools/rust-analyzer/crates/cfg/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ doctest = false

[dependencies]
rustc-hash.workspace = true
tracing.workspace = true

# locals deps
tt = { workspace = true, optional = true }
Expand Down
32 changes: 26 additions & 6 deletions src/tools/rust-analyzer/crates/cfg/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use std::fmt;

use rustc_hash::FxHashSet;

use intern::Symbol;
use intern::{sym, Symbol};

pub use cfg_expr::{CfgAtom, CfgExpr};
pub use dnf::DnfExpr;
Expand All @@ -24,11 +24,17 @@ pub use dnf::DnfExpr;
/// of key and value in `key_values`.
///
/// See: <https://doc.rust-lang.org/reference/conditional-compilation.html#set-configuration-options>
#[derive(Clone, PartialEq, Eq, Default)]
#[derive(Clone, PartialEq, Eq)]
pub struct CfgOptions {
enabled: FxHashSet<CfgAtom>,
}

impl Default for CfgOptions {
fn default() -> Self {
Self { enabled: FxHashSet::from_iter([CfgAtom::Flag(sym::true_.clone())]) }
}
}

impl fmt::Debug for CfgOptions {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let mut items = self
Expand All @@ -54,23 +60,37 @@ impl CfgOptions {
}

pub fn insert_atom(&mut self, key: Symbol) {
self.enabled.insert(CfgAtom::Flag(key));
self.insert_any_atom(CfgAtom::Flag(key));
}

pub fn insert_key_value(&mut self, key: Symbol, value: Symbol) {
self.enabled.insert(CfgAtom::KeyValue { key, value });
self.insert_any_atom(CfgAtom::KeyValue { key, value });
}

pub fn apply_diff(&mut self, diff: CfgDiff) {
for atom in diff.enable {
self.enabled.insert(atom);
self.insert_any_atom(atom);
}

for atom in diff.disable {
let (CfgAtom::Flag(sym) | CfgAtom::KeyValue { key: sym, .. }) = &atom;
if *sym == sym::true_ || *sym == sym::false_ {
tracing::error!("cannot remove `true` or `false` from cfg");
continue;
}
self.enabled.remove(&atom);
}
}

fn insert_any_atom(&mut self, atom: CfgAtom) {
let (CfgAtom::Flag(sym) | CfgAtom::KeyValue { key: sym, .. }) = &atom;
if *sym == sym::true_ || *sym == sym::false_ {
tracing::error!("cannot insert `true` or `false` to cfg");
return;
}
self.enabled.insert(atom);
}

pub fn get_cfg_keys(&self) -> impl Iterator<Item = &Symbol> {
self.enabled.iter().map(|it| match it {
CfgAtom::Flag(key) => key,
Expand All @@ -88,7 +108,7 @@ impl CfgOptions {

impl Extend<CfgAtom> for CfgOptions {
fn extend<T: IntoIterator<Item = CfgAtom>>(&mut self, iter: T) {
iter.into_iter().for_each(|cfg_flag| _ = self.enabled.insert(cfg_flag));
iter.into_iter().for_each(|cfg_flag| self.insert_any_atom(cfg_flag));
}
}

Expand Down
1 change: 1 addition & 0 deletions src/tools/rust-analyzer/crates/hir-def/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ smallvec.workspace = true
hashbrown.workspace = true
triomphe.workspace = true
rustc_apfloat = "0.2.0"
text-size.workspace = true

ra-ap-rustc_parse_format.workspace = true
ra-ap-rustc_abi.workspace = true
Expand Down
Loading

0 comments on commit c8a8c82

Please sign in to comment.