Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
8535baa
fix: don't error on tail comma for some macro
A4-Tacks Aug 13, 2026
84e7c4c
Optimize the heck out of the storage of token trees
ChayimFriedman2 Aug 9, 2026
798009c
Add a flag do not parse rest arguments
A4-Tacks Aug 17, 2026
c6e5196
Rename 'rest' to 'allow_rest_args'
A4-Tacks Aug 17, 2026
7504acb
Merge pull request #23134 from A4-Tacks/str-macro-tail-comma
ChayimFriedman2 Aug 17, 2026
e5cb09e
ide-diagnostics: emit E0600 for unary operator on unsupported type
kivancgnlp Aug 17, 2026
55f8db6
Prepare for merging from rust-lang/rust
invalid-email-address Aug 17, 2026
d287cfd
Merge ref '2c39ff499469' from rust-lang/rust
invalid-email-address Aug 17, 2026
642c35c
Download all artifacts in a single step
lnicola Aug 17, 2026
ec4bed4
Merge pull request #23164 from rust-lang/rustc-pull
lnicola Aug 17, 2026
2e32d85
Drop zigbuild support
lnicola Aug 17, 2026
bda4e60
Merge pull request #23166 from lnicola/download-faster
lnicola Aug 17, 2026
b9f3ee5
Merge pull request #23168 from lnicola/rm-zig
lnicola Aug 17, 2026
d458b39
Drop duplicate function
lnicola Aug 17, 2026
b0fdeff
Merge pull request #23169 from lnicola/pgo-build-command
lnicola Aug 17, 2026
3e3dd53
minor: skip iter excludes 'into_iter' method
A4-Tacks Aug 17, 2026
8884e78
Split VSIX publishing into different jobs and skip duplicates
lnicola Aug 17, 2026
e272f54
Merge pull request #23172 from lnicola/split-publish
ChayimFriedman2 Aug 17, 2026
5475ced
Merge pull request #23147 from kivancgnlp/e0600-unary-op-not-defined
ChayimFriedman2 Aug 17, 2026
3a7792a
Merge pull request #23171 from A4-Tacks/skip-iter-no-intoiter
A4-Tacks Aug 18, 2026
778fc4d
fix: allow `asm!` label blocks to diverge
MannXo Aug 18, 2026
cda4d5a
Merge pull request #23186 from MannXo/fix/23143-asm-label-diverges
ChayimFriedman2 Aug 19, 2026
88f14af
Prepare for merging from rust-lang/rust
invalid-email-address Aug 20, 2026
2b8f759
Merge ref 'f7d782a3be46' from rust-lang/rust
invalid-email-address Aug 20, 2026
7450ef7
Merge pull request #23198 from rust-lang/rustc-pull
lnicola Aug 20, 2026
0b8f007
fix:prevent stack overflow for recursive ADT layouts
YUZHEthefool Aug 20, 2026
31c3420
Fix 1.98.0 Clippy and rustfmt
ChayimFriedman2 Aug 20, 2026
c2ae364
Merge pull request #23205 from ChayimFriedman2/fix-clippy
ChayimFriedman2 Aug 20, 2026
5c771d4
Merge pull request #23079 from ChayimFriedman2/optimize-tts
ChayimFriedman2 Aug 21, 2026
511b370
Merge pull request #23201 from YUZHEthefool/fix/recursive-layout-stac…
ChayimFriedman2 Aug 21, 2026
cef9fe6
Remove two unused public methods
ChayimFriedman2 Aug 21, 2026
a0a9056
Merge pull request #23210 from ChayimFriedman2/remove-unused-fns
ChayimFriedman2 Aug 21, 2026
555a43c
Use Cargo build directory for flycheck logs
noib3 Aug 21, 2026
5a10e37
Merge pull request #23214 from noib3/fix/flycheck-build-directory
ChayimFriedman2 Aug 22, 2026
78da05d
fix(hir): Use expression store of parent body if available
Suryansh-Dey Aug 23, 2026
ca36586
Merge pull request #23202 from Suryansh-Dey/expression
ChayimFriedman2 Aug 23, 2026
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
30 changes: 3 additions & 27 deletions src/tools/rust-analyzer/.github/workflows/metrics.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -91,35 +91,11 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v6

- name: Download build metrics
- name: Download metrics
uses: actions/download-artifact@v8
with:
name: build-${{ github.sha }}

- name: Download self metrics
uses: actions/download-artifact@v8
with:
name: self-${{ github.sha }}

- name: Download ripgrep-13.0.0 metrics
uses: actions/download-artifact@v8
with:
name: ripgrep-13.0.0-${{ github.sha }}

- name: Download webrender-2022 metrics
uses: actions/download-artifact@v8
with:
name: webrender-2022-${{ github.sha }}

- name: Download diesel-1.4.8 metrics
uses: actions/download-artifact@v8
with:
name: diesel-1.4.8-${{ github.sha }}

- name: Download hyper-0.14.18 metrics
uses: actions/download-artifact@v8
with:
name: hyper-0.14.18-${{ github.sha }}
pattern: '*-${{ github.sha }}'
merge-multiple: true

- name: Combine json
run: |
Expand Down
91 changes: 33 additions & 58 deletions src/tools/rust-analyzer/.github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ jobs:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
# Use a container with glibc 2.28
# Zig is not used because it doesn't work with PGO
container: quay.io/pypa/manylinux_2_28_x86_64
code-target: linux-x64
allocator: system
Expand Down Expand Up @@ -200,15 +199,9 @@ jobs:

publish:
if: ${{ github.repository == 'rust-lang/rust-analyzer' || github.event_name == 'workflow_dispatch' }}
name: publish
runs-on: ubuntu-latest
needs: ["dist", "dist-x86_64-unknown-linux-musl"]
steps:
- name: Install Nodejs
uses: actions/setup-node@v6
with:
node-version: 22

- name: Checkout repository
uses: actions/checkout@v6
with:
Expand Down Expand Up @@ -237,40 +230,9 @@ jobs:

- uses: actions/download-artifact@v8
with:
name: dist-aarch64-apple-darwin
path: dist
- uses: actions/download-artifact@v8
with:
name: dist-x86_64-apple-darwin
path: dist
- uses: actions/download-artifact@v8
with:
name: dist-x86_64-unknown-linux-gnu
path: dist
- uses: actions/download-artifact@v8
with:
name: dist-x86_64-unknown-linux-musl
path: dist
- uses: actions/download-artifact@v8
with:
name: dist-aarch64-unknown-linux-gnu
path: dist
- uses: actions/download-artifact@v8
with:
name: dist-arm-unknown-linux-gnueabihf
path: dist
- uses: actions/download-artifact@v8
with:
name: dist-x86_64-pc-windows-msvc
path: dist
- uses: actions/download-artifact@v8
with:
name: dist-i686-pc-windows-msvc
path: dist
- uses: actions/download-artifact@v8
with:
name: dist-aarch64-pc-windows-msvc
pattern: dist-*
path: dist
merge-multiple: true
- run: ls -al ./dist

- name: Publish Release
Expand All @@ -280,28 +242,41 @@ jobs:
name: ${{ env.TAG }}
token: ${{ secrets.GITHUB_TOKEN }}

- run: npm ci
working-directory: ./editors/code
publish-extension:
if: ${{ github.repository == 'rust-lang/rust-analyzer' || github.event_name == 'workflow_dispatch' }}
name: publish-extension (${{ matrix.cmd }})
runs-on: ubuntu-latest
needs: publish
strategy:
fail-fast: false
matrix:
include:
- cmd: vsce
pat: MARKETPLACE_TOKEN
- cmd: ovsx
pat: OPENVSX_TOKEN
steps:
- name: Install Nodejs
uses: actions/setup-node@v6
with:
node-version: 22

- name: Publish Extension (Code Marketplace, release)
if: github.ref == 'refs/heads/release' && github.repository == 'rust-lang/rust-analyzer'
working-directory: ./editors/code
# token from https://dev.azure.com/rust-analyzer/
run: npx vsce publish --pat ${{ secrets.MARKETPLACE_TOKEN }} --packagePath ../../dist/rust-analyzer-*.vsix
- name: Checkout repository
uses: actions/checkout@v6
with:
fetch-depth: ${{ env.FETCH_DEPTH }}

- name: Publish Extension (OpenVSX, release)
if: github.ref == 'refs/heads/release' && github.repository == 'rust-lang/rust-analyzer'
working-directory: ./editors/code
run: npx ovsx publish --pat ${{ secrets.OPENVSX_TOKEN }} --packagePath ../../dist/rust-analyzer-*.vsix
timeout-minutes: 2
- uses: actions/download-artifact@v8
with:
pattern: dist-*
path: dist
merge-multiple: true

- name: Publish Extension (Code Marketplace, nightly)
if: github.ref != 'refs/heads/release' && github.repository == 'rust-lang/rust-analyzer'
- run: npm ci
working-directory: ./editors/code
run: npx vsce publish --pat ${{ secrets.MARKETPLACE_TOKEN }} --packagePath ../../dist/rust-analyzer-*.vsix --pre-release

- name: Publish Extension (OpenVSX, nightly)
if: github.ref != 'refs/heads/release' && github.repository == 'rust-lang/rust-analyzer'
- name: Publish Extension
if: github.repository == 'rust-lang/rust-analyzer'
working-directory: ./editors/code
run: npx ovsx publish --pat ${{ secrets.OPENVSX_TOKEN }} --packagePath ../../dist/rust-analyzer-*.vsix
run: npx ${{ matrix.cmd }} publish --skip-duplicate --pat ${{ secrets[matrix.pat] }} --packagePath ../../dist/rust-analyzer-*.vsix ${{ github.ref != 'refs/heads/release' && '--pre-release' || '' }}
timeout-minutes: 2
1 change: 0 additions & 1 deletion src/tools/rust-analyzer/Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3095,7 +3095,6 @@ name = "tt"
version = "0.0.0"
dependencies = [
"arrayvec",
"indexmap",
"intern",
"ra-ap-rustc_lexer",
"rustc-hash 2.1.2",
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 @@ -104,7 +104,7 @@ lsp-server = { version = "0.7.9" }
anyhow = "1.0.98"
arrayvec = "0.7.6"
bitflags = "2.9.1"
cargo_metadata = "0.23.0"
cargo_metadata = "0.23.1"
camino = "1.2.2"
crossbeam-channel = "0.5.15"
dissimilar = "1.0.10"
Expand Down
5 changes: 2 additions & 3 deletions src/tools/rust-analyzer/crates/cfg/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,9 @@ arbitrary = { version = "1.4.1", features = ["derive"] }

# local deps
syntax-bridge.workspace = true
syntax.workspace = true

# tt is needed for testing
cfg = { path = ".", default-features = false, features = ["tt"] }
# tt and syntax are needed for testing
cfg = { path = ".", default-features = false, features = ["tt", "syntax"] }

[features]
default = []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,13 +132,23 @@ fn test_env_expand() {
#[rustc_builtin_macro]
macro_rules! env {() => {}}

fn main() { env!("TEST_ENV_VAR"); }
fn main() {
env!("TEST_ENV_VAR");
env!("TEST_ENV_VAR",);
env!("TEST_ENV_VAR", "error");
env!("TEST_ENV_VAR", "error",);
}
"#,
expect![[r##"
#[rustc_builtin_macro]
macro_rules! env {() => {}}

fn main() { "UNRESOLVED_ENV_VAR"; }
fn main() {
"UNRESOLVED_ENV_VAR";
"UNRESOLVED_ENV_VAR";
"UNRESOLVED_ENV_VAR";
"UNRESOLVED_ENV_VAR";
}
"##]],
);
}
Expand All @@ -150,13 +160,21 @@ fn test_option_env_expand() {
#[rustc_builtin_macro]
macro_rules! option_env {() => {}}

fn main() { option_env!("TEST_ENV_VAR"); }
fn main() {
option_env!("TEST_ENV_VAR");
option_env!("TEST_ENV_VAR",);
option_env!("TEST_ENV_VAR", "invalid");
}
"#,
expect![[r#"
#[rustc_builtin_macro]
macro_rules! option_env {() => {}}

fn main() { $crate::option::Option::None:: < &str>; }
fn main() {
$crate::option::Option::None:: < &str>;
$crate::option::Option::None:: < &str>;
/* error: unexpected input */;
}
"#]],
);
}
Expand Down
38 changes: 31 additions & 7 deletions src/tools/rust-analyzer/crates/hir-expand/src/builtin/fn_macro.rs
Original file line number Diff line number Diff line change
Expand Up @@ -766,8 +766,32 @@ fn relative_file(
}
}

fn parse_string(tt: &tt::TopSubtree) -> Result<(Symbol, Span), ExpandError> {
let mut tt = TtElement::Subtree(tt.top_subtree(), tt.iter());
fn parse_string(tt: &tt::TopSubtree, allow_rest_args: bool) -> Result<(Symbol, Span), ExpandError> {
let expect_literal = |span| ExpandError::other(span, "expected string literal");
let mut tt = {
let mut tt_iter = tt.iter();
let extracted =
tt_iter.next().ok_or_else(|| expect_literal(tt.top_subtree().delimiter.close))?;

match tt_iter.next() {
None => {}
Some(TtElement::Leaf(tt::Leaf::Punct(it))) if it.char == ',' => {
// Tail comma
// FIXME: Ignored like env!("NAME", "compile_error message")
if let Some(tt) = tt_iter.next()
&& !allow_rest_args
{
return Err(ExpandError::other(tt.first_span(), "unexpected input"));
}
}
Some(tt) => {
return Err(ExpandError::other(tt.first_span(), "unexpected input"));
}
}

extracted
};

(|| {
// FIXME: We wrap expression fragments in parentheses which can break this expectation
// here
Expand Down Expand Up @@ -795,7 +819,7 @@ fn parse_string(tt: &tt::TopSubtree) -> Result<(Symbol, Span), ExpandError> {
TtElement::Subtree(tt, _) => Err(tt.delimiter.open.cover(tt.delimiter.close)),
}
})()
.map_err(|span| ExpandError::other(span, "expected string literal"))
.map_err(expect_literal)
}

fn include_expand(
Expand Down Expand Up @@ -827,7 +851,7 @@ pub fn include_input_to_file_id(
arg_id: MacroCallId,
arg: &tt::TopSubtree,
) -> Result<EditionedFileId, ExpandError> {
let (s, span) = parse_string(arg)?;
let (s, span) = parse_string(arg, false)?;
relative_file(db, arg_id, s.as_str(), false, span)
}

Expand All @@ -851,7 +875,7 @@ fn include_str_expand(
tt: &tt::TopSubtree,
call_site: Span,
) -> ExpandResult<tt::TopSubtree> {
let (path, input_span) = match parse_string(tt) {
let (path, input_span) = match parse_string(tt, false) {
Ok(it) => it,
Err(e) => {
return ExpandResult::new(
Expand Down Expand Up @@ -889,7 +913,7 @@ fn env_expand(
tt: &tt::TopSubtree,
span: Span,
) -> ExpandResult<tt::TopSubtree> {
let (key, span) = match parse_string(tt) {
let (key, span) = match parse_string(tt, true) {
Ok(it) => it,
Err(e) => {
return ExpandResult::new(
Expand Down Expand Up @@ -927,7 +951,7 @@ fn option_env_expand(
tt: &tt::TopSubtree,
call_site: Span,
) -> ExpandResult<tt::TopSubtree> {
let (key, span) = match parse_string(tt) {
let (key, span) = match parse_string(tt, false) {
Ok(it) => it,
Err(e) => {
return ExpandResult::new(
Expand Down
8 changes: 5 additions & 3 deletions src/tools/rust-analyzer/crates/hir-expand/src/fixup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -419,9 +419,11 @@ mod tests {
}

fn check_subtree_eq(a: &tt::TopSubtree, b: &tt::TopSubtree) -> bool {
let a = a.view().as_token_trees().iter_flat_tokens();
let b = b.view().as_token_trees().iter_flat_tokens();
a.len() == b.len() && std::iter::zip(a, b).all(|(a, b)| check_tt_eq(&a, &b))
let a = a.view().as_token_trees();
let b = b.view().as_token_trees();
a.len() == b.len()
&& std::iter::zip(a.iter_flat_tokens(), b.iter_flat_tokens())
.all(|(a, b)| check_tt_eq(&a, &b))
}

fn check_tt_eq(a: &tt::TokenTree, b: &tt::TokenTree) -> bool {
Expand Down
9 changes: 8 additions & 1 deletion src/tools/rust-analyzer/crates/hir-ty/src/infer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ use hir_def::{
TupleFieldId, TupleId, VariantId,
attrs::AttrFlags,
expr_store::{Body, ExpressionStore, HygieneId, body::Param, path::Path},
hir::{BindingId, ExprId, ExprOrPatId, ExprOrPatIdPacked, LabelId, PatId},
hir::{BindingId, ExprId, ExprOrPatId, ExprOrPatIdPacked, LabelId, PatId, UnaryOp},
lang_item::LangItems,
layout::Integer,
resolver::{HasResolver, ResolveValueResult, Resolver, TypeNs, ValueNs},
Expand Down Expand Up @@ -435,6 +435,13 @@ pub enum InferenceDiagnostic {
expr: ExprId,
found: StoredTy,
},
UnaryOperatorCannotBeApplied {
#[type_visitable(ignore)]
expr: ExprId,
#[type_visitable(ignore)]
op: UnaryOp,
found: StoredTy,
},
MutRefInImmRefPat {
#[type_visitable(ignore)]
pat: PatId,
Expand Down
12 changes: 10 additions & 2 deletions src/tools/rust-analyzer/crates/hir-ty/src/infer/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -821,7 +821,7 @@ impl<'db> InferenceContext<'db> {
}
};

let diverge = asm.options.contains(AsmOptions::NORETURN);
let mut diverge = asm.options.contains(AsmOptions::NORETURN);
asm.operands.iter().for_each(|(_, operand)| match *operand {
AsmOperand::In { expr, .. } => check_expr_asm_operand(self, expr, true),
AsmOperand::Out { expr: Some(expr), .. } | AsmOperand::InOut { expr, .. } => {
Expand All @@ -835,11 +835,19 @@ impl<'db> InferenceContext<'db> {
}
}
AsmOperand::Label(expr) => {
self.infer_expr(
let previous_diverges = self.diverges;
// The label blocks should have unit return value or diverge.
let ty = self.infer_expr_inner(
expr,
&Expectation::HasType(self.types.types.unit),
ExprIsRead::No,
);
if !ty.is_never() {
_ = self.demand_suptype(expr.into(), self.types.types.unit, ty);
diverge = false;
}
// We need this to avoid false unreachable warning when a label diverges.
self.diverges = previous_diverges;
}
AsmOperand::Const(expr) => {
self.infer_expr(expr, &Expectation::None, ExprIsRead::No);
Expand Down
Loading
Loading