Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
6 changes: 3 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ regex-automata = { version = "0.4.9" }
rustc-hash = { version = "2.0.0" }
rustc-stable-hash = { version = "0.1.2" }
# When updating salsa, make sure to also update the revision in `fuzz/Cargo.toml`
salsa = { git = "https://github.com/salsa-rs/salsa.git", rev = "664750a6e588ed23a0d2d9105a02cb5993c8e178", default-features = false, features = [
salsa = { git = "https://github.com/salsa-rs/salsa.git", rev = "05a9af7f554b64b8aadc2eeb6f2caf73d0408d09", default-features = false, features = [
"compact_str",
"macros",
"salsa_unstable",
Expand Down
28 changes: 12 additions & 16 deletions crates/ty_python_semantic/src/types/infer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,17 +114,15 @@ pub(crate) fn infer_definition_types<'db>(
fn definition_cycle_recover<'db>(
db: &'db dyn Db,
_id: salsa::Id,
_last_provisional_value: &DefinitionInference<'db>,
_value: &DefinitionInference<'db>,
last_provisional_value: &DefinitionInference<'db>,
value: DefinitionInference<'db>,
count: u32,
definition: Definition<'db>,
) -> salsa::CycleRecoveryAction<DefinitionInference<'db>> {
if count == ITERATIONS_BEFORE_FALLBACK {
salsa::CycleRecoveryAction::Fallback(DefinitionInference::cycle_fallback(
definition.scope(db),
))
) -> DefinitionInference<'db> {
if &value == last_provisional_value || count != ITERATIONS_BEFORE_FALLBACK {
Copy link
Member Author

@MichaReiser MichaReiser Nov 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be correcter for us to use count < ITERATIONS_BEFORE_FALLBACK but one existing mdtest fails if we do so (but it fixes a corpus test panic).

I decided not to spend any time on debugging this further, given that #20566 is about to solve this holistically

value
} else {
salsa::CycleRecoveryAction::Iterate
DefinitionInference::cycle_fallback(definition.scope(db))
}
}

Expand Down Expand Up @@ -230,17 +228,15 @@ pub(crate) fn infer_isolated_expression<'db>(
fn expression_cycle_recover<'db>(
db: &'db dyn Db,
_id: salsa::Id,
_last_provisional_value: &ExpressionInference<'db>,
_value: &ExpressionInference<'db>,
last_provisional_value: &ExpressionInference<'db>,
value: ExpressionInference<'db>,
count: u32,
input: InferExpression<'db>,
) -> salsa::CycleRecoveryAction<ExpressionInference<'db>> {
if count == ITERATIONS_BEFORE_FALLBACK {
salsa::CycleRecoveryAction::Fallback(ExpressionInference::cycle_fallback(
input.expression(db).scope(db),
))
) -> ExpressionInference<'db> {
if &value == last_provisional_value || count != ITERATIONS_BEFORE_FALLBACK {
value
} else {
salsa::CycleRecoveryAction::Iterate
ExpressionInference::cycle_fallback(input.expression(db).scope(db))
}
}

Expand Down
2 changes: 1 addition & 1 deletion fuzz/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ ty_python_semantic = { path = "../crates/ty_python_semantic" }
ty_vendored = { path = "../crates/ty_vendored" }

libfuzzer-sys = { git = "https://github.com/rust-fuzz/libfuzzer", default-features = false }
salsa = { git = "https://github.com/salsa-rs/salsa.git", rev = "664750a6e588ed23a0d2d9105a02cb5993c8e178", default-features = false, features = [
salsa = { git = "https://github.com/salsa-rs/salsa.git", rev = "05a9af7f554b64b8aadc2eeb6f2caf73d0408d09", default-features = false, features = [
"compact_str",
"macros",
"salsa_unstable",
Expand Down