mirror of
https://github.com/astral-sh/ruff
synced 2026-01-07 22:54:28 -05:00
[ty] Require that we can find a root when listing sub-modules
This is similar to a change made in the "list top-level modules" implementation that had been masked by poor Salsa failure modes. Basically, if we can't find a root here, it *must* be a bug. And if we just silently skip over it, we risk voiding Salsa's purity contract, leading to more difficult to debug panics. This did cause one test to fail, but only because the test wasn't properly setting up roots.
This commit is contained in:
committed by
Andrew Gallant
parent
3b913ce652
commit
9cea752934
@@ -161,9 +161,11 @@ fn all_submodule_names_for_package(db: &dyn Db, file: File) -> Option<Vec<Name>>
|
||||
// tree. When the revision gets bumped, the cache
|
||||
// that Salsa creates does for this routine will be
|
||||
// invalidated.
|
||||
if let Some(root) = db.files().root(db, parent_directory) {
|
||||
let _ = root.revision(db);
|
||||
}
|
||||
let root = db
|
||||
.files()
|
||||
.root(db, parent_directory)
|
||||
.expect("System search path should have a registered root");
|
||||
let _ = root.revision(db);
|
||||
|
||||
db.system()
|
||||
.read_directory(parent_directory)
|
||||
|
||||
Reference in New Issue
Block a user