Update Rust toolchain to 1.88 and MSRV to 1.86 (#19011)

This commit is contained in:
Micha Reiser 2025-06-28 20:24:00 +02:00 committed by GitHub
parent c5995c40d3
commit 29927f2b59
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
59 changed files with 210 additions and 425 deletions

View file

@ -1,10 +1,10 @@
use crate::lint::{LintRegistry, RuleSelection};
use ruff_db::Db as SourceDb;
use ruff_db::files::File;
use ruff_db::{Db as SourceDb, Upcast};
/// Database giving access to semantic information about a Python program.
#[salsa::db]
pub trait Db: SourceDb + Upcast<dyn SourceDb> {
pub trait Db: SourceDb {
fn is_file_open(&self, file: File) -> bool;
/// Resolves the rule selection for a given file.
@ -26,12 +26,12 @@ pub(crate) mod tests {
use super::Db;
use crate::lint::{LintRegistry, RuleSelection};
use anyhow::Context;
use ruff_db::Db as SourceDb;
use ruff_db::files::{File, Files};
use ruff_db::system::{
DbWithTestSystem, DbWithWritableSystem as _, System, SystemPath, SystemPathBuf, TestSystem,
};
use ruff_db::vendored::VendoredFileSystem;
use ruff_db::{Db as SourceDb, Upcast};
use ruff_python_ast::PythonVersion;
type Events = Arc<Mutex<Vec<salsa::Event>>>;
@ -112,15 +112,6 @@ pub(crate) mod tests {
}
}
impl Upcast<dyn SourceDb> for TestDb {
fn upcast(&self) -> &(dyn SourceDb + 'static) {
self
}
fn upcast_mut(&mut self) -> &mut (dyn SourceDb + 'static) {
self
}
}
#[salsa::db]
impl Db for TestDb {
fn is_file_open(&self, file: File) -> bool {

View file

@ -32,7 +32,7 @@ fn dunder_all_names_cycle_initial(_db: &dyn Db, _file: File) -> Option<FxHashSet
pub(crate) fn dunder_all_names(db: &dyn Db, file: File) -> Option<FxHashSet<Name>> {
let _span = tracing::trace_span!("dunder_all_names", file=?file.path(db)).entered();
let module = parsed_module(db.upcast(), file).load(db.upcast());
let module = parsed_module(db, file).load(db);
let index = semantic_index(db, file);
let mut collector = DunderAllNamesCollector::new(db, file, index);
collector.visit_body(module.suite());

View file

@ -76,7 +76,7 @@ impl ModulePath {
| SearchPathInner::FirstParty(search_path)
| SearchPathInner::SitePackages(search_path)
| SearchPathInner::Editable(search_path) => {
system_path_to_file(resolver.db.upcast(), search_path.join(relative_path))
system_path_to_file(resolver.db, search_path.join(relative_path))
== Err(FileError::IsADirectory)
}
SearchPathInner::StandardLibraryCustom(stdlib_root) => {
@ -84,7 +84,7 @@ impl ModulePath {
TypeshedVersionsQueryResult::DoesNotExist => false,
TypeshedVersionsQueryResult::Exists
| TypeshedVersionsQueryResult::MaybeExists => {
system_path_to_file(resolver.db.upcast(), stdlib_root.join(relative_path))
system_path_to_file(resolver.db, stdlib_root.join(relative_path))
== Err(FileError::IsADirectory)
}
}
@ -115,16 +115,15 @@ impl ModulePath {
| SearchPathInner::Editable(search_path) => {
let absolute_path = search_path.join(relative_path);
system_path_to_file(resolver.db.upcast(), absolute_path.join("__init__.py")).is_ok()
|| system_path_to_file(resolver.db.upcast(), absolute_path.join("__init__.pyi"))
.is_ok()
system_path_to_file(resolver.db, absolute_path.join("__init__.py")).is_ok()
|| system_path_to_file(resolver.db, absolute_path.join("__init__.pyi")).is_ok()
}
SearchPathInner::StandardLibraryCustom(search_path) => {
match query_stdlib_version(relative_path, resolver) {
TypeshedVersionsQueryResult::DoesNotExist => false,
TypeshedVersionsQueryResult::Exists
| TypeshedVersionsQueryResult::MaybeExists => system_path_to_file(
resolver.db.upcast(),
resolver.db,
search_path.join(relative_path).join("__init__.pyi"),
)
.is_ok(),
@ -161,7 +160,7 @@ impl ModulePath {
#[must_use]
pub(super) fn to_file(&self, resolver: &ResolverContext) -> Option<File> {
let db = resolver.db.upcast();
let db = resolver.db;
let ModulePath {
search_path,
relative_path,

View file

@ -73,7 +73,7 @@ pub(crate) fn path_to_module(db: &dyn Db, path: &FilePath) -> Option<Module> {
// all arguments are Salsa ingredients (something stored in Salsa). `Path`s aren't salsa ingredients but
// `VfsFile` is. So what we do here is to retrieve the `path`'s `VfsFile` so that we can make
// use of Salsa's caching and invalidation.
let file = path.to_file(db.upcast())?;
let file = path.to_file(db)?;
file_to_module(db, file)
}
@ -99,7 +99,7 @@ impl std::fmt::Display for SystemOrVendoredPathRef<'_> {
pub(crate) fn file_to_module(db: &dyn Db, file: File) -> Option<Module> {
let _span = tracing::trace_span!("file_to_module", ?file).entered();
let path = match file.path(db.upcast()) {
let path = match file.path(db) {
FilePath::System(system) => SystemOrVendoredPathRef::System(system),
FilePath::Vendored(vendored) => SystemOrVendoredPathRef::Vendored(vendored),
FilePath::SystemVirtual(_) => return None,
@ -260,7 +260,7 @@ impl SearchPaths {
for path in self.static_paths.iter().chain(self.site_packages.iter()) {
if let Some(system_path) = path.as_system_path() {
if !path.is_first_party() {
files.try_add_root(db.upcast(), system_path, FileRootKind::LibrarySearchPath);
files.try_add_root(db, system_path, FileRootKind::LibrarySearchPath);
}
}
}
@ -332,7 +332,7 @@ pub(crate) fn dynamic_resolution_paths(db: &dyn Db) -> Vec<SearchPath> {
}
let site_packages_root = files
.root(db.upcast(), site_packages_dir)
.root(db, site_packages_dir)
.expect("Site-package root to have been created");
// This query needs to be re-executed each time a `.pth` file
@ -340,7 +340,7 @@ pub(crate) fn dynamic_resolution_paths(db: &dyn Db) -> Vec<SearchPath> {
// However, we don't use Salsa queries to read the source text of `.pth` files;
// we use the APIs on the `System` trait directly. As such, add a dependency on the
// site-package directory's revision.
site_packages_root.revision(db.upcast());
site_packages_root.revision(db);
dynamic_paths.push(site_packages_search_path.clone());

View file

@ -329,7 +329,7 @@ pub(crate) fn imported_symbol<'db>(
requires_explicit_reexport: Option<RequiresExplicitReExport>,
) -> PlaceAndQualifiers<'db> {
let requires_explicit_reexport = requires_explicit_reexport.unwrap_or_else(|| {
if file.is_stub(db.upcast()) {
if file.is_stub(db) {
RequiresExplicitReExport::Yes
} else {
RequiresExplicitReExport::No
@ -717,7 +717,7 @@ fn place_by_id<'db>(
.expr
.is_name_and(|name| matches!(name, "__slots__" | "TYPE_CHECKING"));
if scope.file(db).is_stub(db.upcast()) {
if scope.file(db).is_stub(db) {
// We generally trust module-level undeclared places in stubs and do not union
// with `Unknown`. If we don't do this, simple aliases like `IOError = OSError` in
// stubs would result in `IOError` being a union of `OSError` and `Unknown`, which

View file

@ -137,7 +137,7 @@ impl PythonVersionFileSource {
/// Useful for subdiagnostics when informing the user
/// what the inferred Python version of their project is.
pub(crate) fn span(&self, db: &dyn Db) -> Option<Span> {
let file = system_path_to_file(db.upcast(), &*self.path).ok()?;
let file = system_path_to_file(db, &*self.path).ok()?;
Some(Span::from(file).with_optional_range(self.range))
}
}

View file

@ -12,7 +12,7 @@ use ruff_python_ast::{
pub fn pull_types(db: &dyn Db, file: File) {
let mut visitor = PullTypesVisitor::new(db, file);
let ast = parsed_module(db.upcast(), file).load(db.upcast());
let ast = parsed_module(db, file).load(db);
visitor.visit_body(ast.suite());
}

View file

@ -51,7 +51,7 @@ type PlaceSet = hashbrown::HashTable<ScopedPlaceId>;
pub(crate) fn semantic_index(db: &dyn Db, file: File) -> SemanticIndex<'_> {
let _span = tracing::trace_span!("semantic_index", ?file).entered();
let module = parsed_module(db.upcast(), file).load(db.upcast());
let module = parsed_module(db, file).load(db);
SemanticIndexBuilder::new(db, file, &module).build()
}
@ -133,7 +133,7 @@ pub(crate) fn attribute_scopes<'db, 's>(
class_body_scope: ScopeId<'db>,
) -> impl Iterator<Item = FileScopeId> + use<'s, 'db> {
let file = class_body_scope.file(db);
let module = parsed_module(db.upcast(), file).load(db.upcast());
let module = parsed_module(db, file).load(db);
let index = semantic_index(db, file);
let class_scope_id = class_body_scope.file_scope_id(db);

View file

@ -121,7 +121,7 @@ impl<'db, 'ast> SemanticIndexBuilder<'db, 'ast> {
let mut builder = Self {
db,
file,
source_type: file.source_type(db.upcast()),
source_type: file.source_type(db),
module: module_ref,
scope_stack: Vec::new(),
current_assignments: vec![],
@ -1047,7 +1047,7 @@ impl<'db, 'ast> SemanticIndexBuilder<'db, 'ast> {
fn source_text(&self) -> &SourceText {
self.source_text
.get_or_init(|| source_text(self.db.upcast(), self.file))
.get_or_init(|| source_text(self.db, self.file))
}
}

View file

@ -45,7 +45,7 @@ fn exports_cycle_initial(_db: &dyn Db, _file: File) -> Box<[Name]> {
#[salsa::tracked(returns(deref), cycle_fn=exports_cycle_recover, cycle_initial=exports_cycle_initial, heap_size=get_size2::GetSize::get_heap_size)]
pub(super) fn exported_names(db: &dyn Db, file: File) -> Box<[Name]> {
let module = parsed_module(db.upcast(), file).load(db.upcast());
let module = parsed_module(db, file).load(db);
let mut finder = ExportFinder::new(db, file);
finder.visit_body(module.suite());
finder.resolve_exports()
@ -64,7 +64,7 @@ impl<'db> ExportFinder<'db> {
Self {
db,
file,
visiting_stub_file: file.is_stub(db.upcast()),
visiting_stub_file: file.is_stub(db),
exports: FxHashMap::default(),
dunder_all: DunderAll::NotPresent,
}

View file

@ -34,7 +34,7 @@ impl<'db> SemanticModel<'db> {
}
pub fn line_index(&self) -> LineIndex {
line_index(self.db.upcast(), self.file)
line_index(self.db, self.file)
}
pub fn resolve_module(&self, module_name: &ModuleName) -> Option<Module> {

View file

@ -88,8 +88,8 @@ declare_lint! {
#[salsa::tracked(returns(ref), heap_size=get_size2::GetSize::get_heap_size)]
pub(crate) fn suppressions(db: &dyn Db, file: File) -> Suppressions {
let parsed = parsed_module(db.upcast(), file).load(db.upcast());
let source = source_text(db.upcast(), file);
let parsed = parsed_module(db, file).load(db);
let source = source_text(db, file);
let mut builder = SuppressionsBuilder::new(&source, db.lint_registry());
let mut line_start = TextSize::default();

View file

@ -5001,7 +5001,7 @@ impl<'db> Type<'db> {
SpecialFormType::Callable => Ok(CallableType::unknown(db)),
SpecialFormType::TypingSelf => {
let module = parsed_module(db.upcast(), scope_id.file(db)).load(db.upcast());
let module = parsed_module(db, scope_id.file(db)).load(db);
let index = semantic_index(db, scope_id.file(db));
let Some(class) = nearest_enclosing_class(db, index, scope_id, &module) else {
return Err(InvalidTypeExpressionError {
@ -7500,7 +7500,7 @@ impl get_size2::GetSize for PEP695TypeAliasType<'_> {}
impl<'db> PEP695TypeAliasType<'db> {
pub(crate) fn definition(self, db: &'db dyn Db) -> Definition<'db> {
let scope = self.rhs_scope(db);
let module = parsed_module(db.upcast(), scope.file(db)).load(db.upcast());
let module = parsed_module(db, scope.file(db)).load(db);
let type_alias_stmt_node = scope.node(db).expect_type_alias(&module);
semantic_index(db, scope.file(db)).expect_single_definition(type_alias_stmt_node)
@ -7509,7 +7509,7 @@ impl<'db> PEP695TypeAliasType<'db> {
#[salsa::tracked(heap_size=get_size2::GetSize::get_heap_size)]
pub(crate) fn value_type(self, db: &'db dyn Db) -> Type<'db> {
let scope = self.rhs_scope(db);
let module = parsed_module(db.upcast(), scope.file(db)).load(db.upcast());
let module = parsed_module(db, scope.file(db)).load(db);
let type_alias_stmt_node = scope.node(db).expect_type_alias(&module);
let definition = self.definition(db);
definition_expression_type(db, definition, &type_alias_stmt_node.value)

View file

@ -2751,9 +2751,8 @@ impl<'db> BindingError<'db> {
));
if let Some(typevar_definition) = typevar.definition(context.db()) {
let module =
parsed_module(context.db().upcast(), typevar_definition.file(context.db()))
.load(context.db().upcast());
let module = parsed_module(context.db(), typevar_definition.file(context.db()))
.load(context.db());
let typevar_range = typevar_definition.full_range(context.db(), &module);
let mut sub = SubDiagnostic::new(Severity::Info, "Type variable defined here");
sub.annotate(Annotation::primary(typevar_range.into()));

View file

@ -814,7 +814,7 @@ impl<'db> ClassLiteral<'db> {
#[salsa::tracked(cycle_fn=pep695_generic_context_cycle_recover, cycle_initial=pep695_generic_context_cycle_initial, heap_size=get_size2::GetSize::get_heap_size)]
pub(crate) fn pep695_generic_context(self, db: &'db dyn Db) -> Option<GenericContext<'db>> {
let scope = self.body_scope(db);
let parsed = parsed_module(db.upcast(), scope.file(db)).load(db.upcast());
let parsed = parsed_module(db, scope.file(db)).load(db);
let class_def_node = scope.node(db).expect_class(&parsed);
class_def_node.type_params.as_ref().map(|type_params| {
let index = semantic_index(db, scope.file(db));
@ -861,7 +861,7 @@ impl<'db> ClassLiteral<'db> {
pub(crate) fn definition(self, db: &'db dyn Db) -> Definition<'db> {
let body_scope = self.body_scope(db);
let module = parsed_module(db.upcast(), body_scope.file(db)).load(db.upcast());
let module = parsed_module(db, body_scope.file(db)).load(db);
let index = semantic_index(db, body_scope.file(db));
index.expect_single_definition(body_scope.node(db).expect_class(&module))
}
@ -925,7 +925,7 @@ impl<'db> ClassLiteral<'db> {
pub(super) fn explicit_bases(self, db: &'db dyn Db) -> Box<[Type<'db>]> {
tracing::trace!("ClassLiteral::explicit_bases_query: {}", self.name(db));
let module = parsed_module(db.upcast(), self.file(db)).load(db.upcast());
let module = parsed_module(db, self.file(db)).load(db);
let class_stmt = self.node(db, &module);
let class_definition =
semantic_index(db, self.file(db)).expect_single_definition(class_stmt);
@ -1001,7 +1001,7 @@ impl<'db> ClassLiteral<'db> {
fn decorators(self, db: &'db dyn Db) -> Box<[Type<'db>]> {
tracing::trace!("ClassLiteral::decorators: {}", self.name(db));
let module = parsed_module(db.upcast(), self.file(db)).load(db.upcast());
let module = parsed_module(db, self.file(db)).load(db);
let class_stmt = self.node(db, &module);
if class_stmt.decorator_list.is_empty() {
@ -1146,7 +1146,7 @@ impl<'db> ClassLiteral<'db> {
return Ok((SubclassOfType::subclass_of_unknown(), None));
}
let module = parsed_module(db.upcast(), self.file(db)).load(db.upcast());
let module = parsed_module(db, self.file(db)).load(db);
let explicit_metaclass = self.explicit_metaclass(db, &module);
let (metaclass, class_metaclass_was_from) = if let Some(metaclass) = explicit_metaclass {
@ -1739,7 +1739,7 @@ impl<'db> ClassLiteral<'db> {
let mut is_attribute_bound = Truthiness::AlwaysFalse;
let file = class_body_scope.file(db);
let module = parsed_module(db.upcast(), file).load(db.upcast());
let module = parsed_module(db, file).load(db);
let index = semantic_index(db, file);
let class_map = use_def_map(db, class_body_scope);
let class_table = place_table(db, class_body_scope);
@ -2178,7 +2178,7 @@ impl<'db> ClassLiteral<'db> {
/// ```
pub(super) fn header_range(self, db: &'db dyn Db) -> TextRange {
let class_scope = self.body_scope(db);
let module = parsed_module(db.upcast(), class_scope.file(db)).load(db.upcast());
let module = parsed_module(db, class_scope.file(db)).load(db);
let class_node = class_scope.node(db).expect_class(&module);
let class_name = &class_node.name;
TextRange::new(

View file

@ -187,7 +187,7 @@ impl<'db, 'ast> InferContext<'db, 'ast> {
/// Are we currently inferring types in a stub file?
pub(crate) fn in_stub(&self) -> bool {
self.file.is_stub(self.db().upcast())
self.file.is_stub(self.db())
}
#[must_use]

View file

@ -22,7 +22,7 @@ impl TypeDefinition<'_> {
| Self::Function(definition)
| Self::TypeVar(definition)
| Self::TypeAlias(definition) => {
let module = parsed_module(db.upcast(), definition.file(db)).load(db.upcast());
let module = parsed_module(db, definition.file(db)).load(db);
Some(definition.focus_range(db, &module))
}
}
@ -32,14 +32,14 @@ impl TypeDefinition<'_> {
match self {
Self::Module(module) => {
let file = module.file()?;
let source = source_text(db.upcast(), file);
let source = source_text(db, file);
Some(FileRange::new(file, TextRange::up_to(source.text_len())))
}
Self::Class(definition)
| Self::Function(definition)
| Self::TypeVar(definition)
| Self::TypeAlias(definition) => {
let module = parsed_module(db.upcast(), definition.file(db)).load(db.upcast());
let module = parsed_module(db, definition.file(db)).load(db);
Some(definition.full_range(db, &module))
}
}

View file

@ -274,7 +274,7 @@ impl<'db> OverloadLiteral<'db> {
/// over-invalidation.
fn definition(self, db: &'db dyn Db) -> Definition<'db> {
let body_scope = self.body_scope(db);
let module = parsed_module(db.upcast(), self.file(db)).load(db.upcast());
let module = parsed_module(db, self.file(db)).load(db);
let index = semantic_index(db, body_scope.file(db));
index.expect_single_definition(body_scope.node(db).expect_function(&module))
}
@ -285,7 +285,7 @@ impl<'db> OverloadLiteral<'db> {
// The semantic model records a use for each function on the name node. This is used
// here to get the previous function definition with the same name.
let scope = self.definition(db).scope(db);
let module = parsed_module(db.upcast(), self.file(db)).load(db.upcast());
let module = parsed_module(db, self.file(db)).load(db);
let use_def = semantic_index(db, scope.file(db)).use_def_map(scope.file_scope_id(db));
let use_id = self
.body_scope(db)
@ -326,7 +326,7 @@ impl<'db> OverloadLiteral<'db> {
inherited_generic_context: Option<GenericContext<'db>>,
) -> Signature<'db> {
let scope = self.body_scope(db);
let module = parsed_module(db.upcast(), self.file(db)).load(db.upcast());
let module = parsed_module(db, self.file(db)).load(db);
let function_stmt_node = scope.node(db).expect_function(&module);
let definition = self.definition(db);
let generic_context = function_stmt_node.type_params.as_ref().map(|type_params| {
@ -350,7 +350,7 @@ impl<'db> OverloadLiteral<'db> {
let function_scope = self.body_scope(db);
let span = Span::from(function_scope.file(db));
let node = function_scope.node(db);
let module = parsed_module(db.upcast(), self.file(db)).load(db.upcast());
let module = parsed_module(db, self.file(db)).load(db);
let func_def = node.as_function(&module)?;
let range = parameter_index
.and_then(|parameter_index| {
@ -370,7 +370,7 @@ impl<'db> OverloadLiteral<'db> {
let function_scope = self.body_scope(db);
let span = Span::from(function_scope.file(db));
let node = function_scope.node(db);
let module = parsed_module(db.upcast(), self.file(db)).load(db.upcast());
let module = parsed_module(db, self.file(db)).load(db);
let func_def = node.as_function(&module)?;
let return_type_range = func_def.returns.as_ref().map(|returns| returns.range());
let mut signature = func_def.name.range.cover(func_def.parameters.range);

View file

@ -134,7 +134,7 @@ pub(crate) fn infer_scope_types<'db>(db: &'db dyn Db, scope: ScopeId<'db>) -> Ty
let file = scope.file(db);
let _span = tracing::trace_span!("infer_scope_types", scope=?scope.as_id(), ?file).entered();
let module = parsed_module(db.upcast(), file).load(db.upcast());
let module = parsed_module(db, file).load(db);
// Using the index here is fine because the code below depends on the AST anyway.
// The isolation of the query is by the return inferred types.
@ -164,7 +164,7 @@ pub(crate) fn infer_definition_types<'db>(
definition: Definition<'db>,
) -> TypeInference<'db> {
let file = definition.file(db);
let module = parsed_module(db.upcast(), file).load(db.upcast());
let module = parsed_module(db, file).load(db);
let _span = tracing::trace_span!(
"infer_definition_types",
range = ?definition.kind(db).target_range(&module),
@ -203,7 +203,7 @@ pub(crate) fn infer_deferred_types<'db>(
definition: Definition<'db>,
) -> TypeInference<'db> {
let file = definition.file(db);
let module = parsed_module(db.upcast(), file).load(db.upcast());
let module = parsed_module(db, file).load(db);
let _span = tracing::trace_span!(
"infer_deferred_types",
definition = ?definition.as_id(),
@ -240,7 +240,7 @@ pub(crate) fn infer_expression_types<'db>(
expression: Expression<'db>,
) -> TypeInference<'db> {
let file = expression.file(db);
let module = parsed_module(db.upcast(), file).load(db.upcast());
let module = parsed_module(db, file).load(db);
let _span = tracing::trace_span!(
"infer_expression_types",
expression = ?expression.as_id(),
@ -302,7 +302,7 @@ pub(crate) fn infer_expression_type<'db>(
expression: Expression<'db>,
) -> Type<'db> {
let file = expression.file(db);
let module = parsed_module(db.upcast(), file).load(db.upcast());
let module = parsed_module(db, file).load(db);
// It's okay to call the "same file" version here because we're inside a salsa query.
infer_same_file_expression_type(db, expression, &module)
@ -333,7 +333,7 @@ fn single_expression_cycle_initial<'db>(
#[salsa::tracked(returns(ref), cycle_fn=unpack_cycle_recover, cycle_initial=unpack_cycle_initial, heap_size=get_size2::GetSize::get_heap_size)]
pub(super) fn infer_unpack_types<'db>(db: &'db dyn Db, unpack: Unpack<'db>) -> UnpackResult<'db> {
let file = unpack.file(db);
let module = parsed_module(db.upcast(), file).load(db.upcast());
let module = parsed_module(db, file).load(db);
let _span = tracing::trace_span!("infer_unpack_types", range=?unpack.range(db, &module), ?file)
.entered();

View file

@ -74,7 +74,7 @@ fn all_narrowing_constraints_for_pattern<'db>(
db: &'db dyn Db,
pattern: PatternPredicate<'db>,
) -> Option<NarrowingConstraints<'db>> {
let module = parsed_module(db.upcast(), pattern.file(db)).load(db.upcast());
let module = parsed_module(db, pattern.file(db)).load(db);
NarrowingConstraintsBuilder::new(db, &module, PredicateNode::Pattern(pattern), true).finish()
}
@ -88,7 +88,7 @@ fn all_narrowing_constraints_for_expression<'db>(
db: &'db dyn Db,
expression: Expression<'db>,
) -> Option<NarrowingConstraints<'db>> {
let module = parsed_module(db.upcast(), expression.file(db)).load(db.upcast());
let module = parsed_module(db, expression.file(db)).load(db);
NarrowingConstraintsBuilder::new(db, &module, PredicateNode::Expression(expression), true)
.finish()
}
@ -103,7 +103,7 @@ fn all_negative_narrowing_constraints_for_expression<'db>(
db: &'db dyn Db,
expression: Expression<'db>,
) -> Option<NarrowingConstraints<'db>> {
let module = parsed_module(db.upcast(), expression.file(db)).load(db.upcast());
let module = parsed_module(db, expression.file(db)).load(db);
NarrowingConstraintsBuilder::new(db, &module, PredicateNode::Expression(expression), false)
.finish()
}
@ -113,7 +113,7 @@ fn all_negative_narrowing_constraints_for_pattern<'db>(
db: &'db dyn Db,
pattern: PatternPredicate<'db>,
) -> Option<NarrowingConstraints<'db>> {
let module = parsed_module(db.upcast(), pattern.file(db)).load(db.upcast());
let module = parsed_module(db, pattern.file(db)).load(db);
NarrowingConstraintsBuilder::new(db, &module, PredicateNode::Pattern(pattern), false).finish()
}

View file

@ -137,7 +137,7 @@ pub(crate) fn parse_string_annotation(
let _span = tracing::trace_span!("parse_string_annotation", string=?string_expr.range(), ?file)
.entered();
let source = source_text(db.upcast(), file);
let source = source_text(db, file);
if let Some(string_literal) = string_expr.as_single_part_string() {
let prefix = string_literal.flags.prefix();

View file

@ -415,7 +415,7 @@ where
unsafe fn maybe_update(old_pointer: *mut Self, new_value: Self) -> bool {
unsafe {
let old_value = &mut *old_pointer;
Vec::maybe_update(&mut old_value.0, new_value.0)
Vec::maybe_update(&raw mut old_value.0, new_value.0)
}
}
}
@ -829,9 +829,9 @@ where
unsafe fn maybe_update(old_pointer: *mut Self, new_value: Self) -> bool {
let old_value = unsafe { &mut *old_pointer };
let mut changed = false;
changed |= unsafe { Vec::maybe_update(&mut old_value.prefix, new_value.prefix) };
changed |= unsafe { T::maybe_update(&mut old_value.variable, new_value.variable) };
changed |= unsafe { Vec::maybe_update(&mut old_value.suffix, new_value.suffix) };
changed |= unsafe { Vec::maybe_update(&raw mut old_value.prefix, new_value.prefix) };
changed |= unsafe { T::maybe_update(&raw mut old_value.variable, new_value.variable) };
changed |= unsafe { Vec::maybe_update(&raw mut old_value.suffix, new_value.suffix) };
changed
}
}