Skip to content
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
Prev Previous commit
Next Next commit
Rust: update toolchain to 1.91 and apply lint fixes
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
  • Loading branch information
tausbn and Copilot committed Apr 15, 2026
commit 35fc6fbd22e4453b49da746cde2d5ad252b24c7b
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
# reflected by `MODULE.bazel` in this repository).

[toolchain]
channel = "1.88"
channel = "1.91"
profile = "minimal"
components = [ "clippy", "rustfmt" ]
5 changes: 2 additions & 3 deletions rust/ast-generator/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -308,14 +308,13 @@ fn write_schema(
fn get_fields(node: &AstNodeSrc) -> Vec<FieldInfo> {
let mut result = Vec::new();
for field in &node.fields {
if let Field::Token { token, .. } = field {
if should_predicate_be_extracted(token) {
if let Field::Token { token, .. } = field
&& should_predicate_be_extracted(token) {
result.push(FieldInfo {
name: format!("is_{token}"),
ty: FieldType::Predicate,
});
}
}
}

result.extend(get_additional_fields(&node.name));
Expand Down
9 changes: 7 additions & 2 deletions rust/extractor/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ use ra_ap_ide_db::FxHashMap;
use ra_ap_intern::Symbol;
use ra_ap_load_cargo::{LoadCargoConfig, ProcMacroServerChoice};
use ra_ap_paths::{AbsPath, AbsPathBuf, Utf8PathBuf};
use ra_ap_project_model::{CargoConfig, CargoFeatures, CfgOverrides, RustLibSource, Sysroot, TargetDirectoryConfig};
use ra_ap_project_model::{
CargoConfig, CargoFeatures, CfgOverrides, RustLibSource, Sysroot, TargetDirectoryConfig,
};
use rust_extractor_macros::extractor_cli_config;
use serde::{Deserialize, Serialize};
use std::collections::HashSet;
Expand Down Expand Up @@ -176,7 +178,10 @@ impl Config {
.clone()
.unwrap_or_else(|| self.scratch_dir.join("target")),
)
.map_or(TargetDirectoryConfig::None, TargetDirectoryConfig::Directory),
.map_or(
TargetDirectoryConfig::None,
TargetDirectoryConfig::Directory,
),
features: self.cargo_features(),
target: self.cargo_target.clone(),
cfg_overrides: to_cfg_overrides(&self.cargo_cfg_overrides),
Expand Down
10 changes: 4 additions & 6 deletions rust/extractor/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ impl<'a> Extractor<'a> {
translator.emit_parse_error(&ast, &err);
}
let no_location = (LineCol { line: 0, col: 0 }, LineCol { line: 0, col: 0 });
if let Err(RustAnalyzerNoSemantics { severity, reason }) = semantics_info {
if !reason.is_empty() {
if let Err(RustAnalyzerNoSemantics { severity, reason }) = semantics_info
&& !reason.is_empty() {
let message = format!("semantic analyzer unavailable ({reason})");
let full_message = format!("{message}: macro expansion will be skipped.");
translator.emit_diagnostic(
Expand All @@ -92,7 +92,6 @@ impl<'a> Extractor<'a> {
no_location,
);
}
}
translator.emit_source_file(&ast);
translator.emit_truncated_diagnostics_message();
translator.trap.commit().unwrap_or_else(|err| {
Expand Down Expand Up @@ -300,8 +299,8 @@ fn main() -> anyhow::Result<()> {
};
}
for (file_id, file) in vfs.iter() {
if let Some(file) = file.as_path().map(<_ as AsRef<Path>>::as_ref) {
if file.extension().is_some_and(|ext| ext == "rs")
if let Some(file) = file.as_path().map(<_ as AsRef<Path>>::as_ref)
&& file.extension().is_some_and(|ext| ext == "rs")
&& processed_files.insert(file.to_owned())
&& db
.source_root(db.file_source_root(file_id).source_root_id(db))
Expand All @@ -311,7 +310,6 @@ fn main() -> anyhow::Result<()> {
extractor.extract_with_semantics(file, &semantics, vfs, library_mode);
extractor.archiver.archive(file);
}
}
}
} else {
for file in files {
Expand Down
17 changes: 8 additions & 9 deletions rust/extractor/src/translate/base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -215,14 +215,13 @@ impl<'a> Translator<'a> {
) {
let parent_range = parent.syntax().text_range();
let token_range = token.text_range();
if let Some(clipped_range) = token_range.intersect(parent_range) {
if let Some(parent_range2) = self.text_range_for_node(parent) {
if let Some(clipped_range) = token_range.intersect(parent_range)
&& let Some(parent_range2) = self.text_range_for_node(parent) {
let token_range = clipped_range + parent_range2.start() - parent_range.start();
if let Some((start, end)) = self.location(token_range) {
self.trap.emit_location(self.label, label, start, end)
}
}
}
}
pub fn emit_diagnostic(
&mut self,
Expand Down Expand Up @@ -332,16 +331,15 @@ impl<'a> Translator<'a> {
children: SyntaxElementChildren,
) {
for child in children {
if let NodeOrToken::Token(token) = child {
if token.kind() == SyntaxKind::COMMENT {
if let NodeOrToken::Token(token) = child
&& token.kind() == SyntaxKind::COMMENT {
let label = self.trap.emit(generated::Comment {
id: TrapId::Star,
parent: parent_label,
text: token.text().to_owned(),
});
self.emit_location_token(label.into(), parent_node, &token);
}
}
}
}
fn emit_macro_expansion_parse_errors(
Expand Down Expand Up @@ -479,9 +477,10 @@ impl<'a> Translator<'a> {
};
let cfg_expr = ra_ap_cfg::CfgExpr::parse_from_ast(cfg_predicate);
let file_id = sema.hir_file_for(item.syntax());
let krate = match file_id.file_id().and_then(|fid| {
sema.file_to_module_defs(fid.file_id(sema.db)).next()
}) {
let krate = match file_id
.file_id()
.and_then(|fid| sema.file_to_module_defs(fid.file_id(sema.db)).next())
{
Some(module) => module.krate(sema.db),
None => return false,
};
Expand Down