Skip to content

Commit 1c2d7d0

Browse files
committed
Auto merge of #16884 - Veykril:grammar-codegen, r=Veykril
internal: Move grammar codegen into xtask #14778, also threw in the one line fix for #13912
2 parents 054ebf9 + b38d539 commit 1c2d7d0

File tree

14 files changed

+389
-346
lines changed

14 files changed

+389
-346
lines changed

.github/workflows/publish-libs.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,5 @@ jobs:
3232
git config --global user.name "GitHub Action"
3333
# Remove r-a crates from the workspaces so we don't auto-publish them as well
3434
sed -i 's/ "crates\/\*"//' ./Cargo.toml
35+
sed -i 's/ "xtask\/"//' ./Cargo.toml
3536
cargo workspaces publish --yes --exact --from-git --no-git-commit --allow-dirty

Cargo.lock

+4-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/hir-ty/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ expect-test = "1.4.0"
5353
tracing.workspace = true
5454
tracing-subscriber.workspace = true
5555
tracing-tree.workspace = true
56-
project-model = { path = "../project-model" }
56+
project-model.workspace = true
5757

5858
# local deps
5959
test-utils.workspace = true

crates/ide-diagnostics/src/handlers/mutability_errors.rs

+14-8
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,12 @@ pub(crate) fn need_mut(ctx: &DiagnosticsContext<'_>, d: &hir::NeedMut) -> Option
5151
// Diagnostic: unused-mut
5252
//
5353
// This diagnostic is triggered when a mutable variable isn't actually mutated.
54-
pub(crate) fn unused_mut(ctx: &DiagnosticsContext<'_>, d: &hir::UnusedMut) -> Diagnostic {
54+
pub(crate) fn unused_mut(ctx: &DiagnosticsContext<'_>, d: &hir::UnusedMut) -> Option<Diagnostic> {
5555
let ast = d.local.primary_source(ctx.sema.db).syntax_ptr();
56+
if ast.file_id.macro_file().is_some() {
57+
// FIXME: Our infra can't handle allow from within macro expansions rn
58+
return None;
59+
}
5660
let fixes = (|| {
5761
let file_id = ast.file_id.file_id()?;
5862
let mut edit_builder = TextEdit::builder();
@@ -76,14 +80,16 @@ pub(crate) fn unused_mut(ctx: &DiagnosticsContext<'_>, d: &hir::UnusedMut) -> Di
7680
)])
7781
})();
7882
let ast = d.local.primary_source(ctx.sema.db).syntax_ptr();
79-
Diagnostic::new_with_syntax_node_ptr(
80-
ctx,
81-
DiagnosticCode::RustcLint("unused_mut"),
82-
"variable does not need to be mutable",
83-
ast,
83+
Some(
84+
Diagnostic::new_with_syntax_node_ptr(
85+
ctx,
86+
DiagnosticCode::RustcLint("unused_mut"),
87+
"variable does not need to be mutable",
88+
ast,
89+
)
90+
.experimental() // Not supporting `#[allow(unused_mut)]` in proc macros leads to false positive.
91+
.with_fixes(fixes),
8492
)
85-
.experimental() // Not supporting `#[allow(unused_mut)]` in proc macros leads to false positive.
86-
.with_fixes(fixes)
8793
}
8894

8995
pub(super) fn token(parent: &SyntaxNode, kind: SyntaxKind) -> Option<SyntaxToken> {

crates/ide-diagnostics/src/lib.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,10 @@ pub fn diagnostics(
387387
AnyDiagnostic::UnresolvedMethodCall(d) => handlers::unresolved_method::unresolved_method(&ctx, &d),
388388
AnyDiagnostic::UnresolvedModule(d) => handlers::unresolved_module::unresolved_module(&ctx, &d),
389389
AnyDiagnostic::UnresolvedProcMacro(d) => handlers::unresolved_proc_macro::unresolved_proc_macro(&ctx, &d, config.proc_macros_enabled, config.proc_attr_macros_enabled),
390-
AnyDiagnostic::UnusedMut(d) => handlers::mutability_errors::unused_mut(&ctx, &d),
390+
AnyDiagnostic::UnusedMut(d) => match handlers::mutability_errors::unused_mut(&ctx, &d) {
391+
Some(it) => it,
392+
None => continue,
393+
},
391394
AnyDiagnostic::UnusedVariable(d) => match handlers::unused_variables::unused_variables(&ctx, &d) {
392395
Some(it) => it,
393396
None => continue,

crates/syntax/Cargo.toml

-4
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,8 @@ text-edit.workspace = true
3333
[dev-dependencies]
3434
rayon.workspace = true
3535
expect-test = "1.4.0"
36-
proc-macro2 = "1.0.47"
37-
quote = "1.0.20"
38-
ungrammar = "1.16.1"
3936

4037
test-utils.workspace = true
41-
sourcegen.workspace = true
4238

4339
[features]
4440
in-rust-tree = []

0 commit comments

Comments
 (0)