-
Notifications
You must be signed in to change notification settings - Fork 1
Give enums nested in a body, impl, or closure a unique SMT-safe datatype name #317
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| //@error-in-other-file: Unsat | ||
| //@compile-flags: -C debug-assertions=off | ||
|
|
||
| trait T { | ||
| fn f(b: bool) -> i64; | ||
| } | ||
|
|
||
| struct A; | ||
| struct B; | ||
|
|
||
| impl thrust_models::Model for A { | ||
| type Ty = Self; | ||
| } | ||
|
|
||
| impl thrust_models::Model for B { | ||
| type Ty = Self; | ||
| } | ||
|
|
||
| impl T for A { | ||
| fn f(b: bool) -> i64 { | ||
| enum E { | ||
| X(i64), | ||
| Y, | ||
| } | ||
| impl thrust_models::Model for E { | ||
| type Ty = Self; | ||
| } | ||
| let e = if b { E::X(1) } else { E::Y }; | ||
| match e { | ||
| E::X(x) => x, | ||
| E::Y => 0, | ||
| } | ||
| } | ||
| } | ||
|
|
||
| impl T for B { | ||
| fn f(b: bool) -> i64 { | ||
| enum E { | ||
| Z(bool), | ||
| W(i64), | ||
| } | ||
| impl thrust_models::Model for E { | ||
| type Ty = Self; | ||
| } | ||
| let e = if b { E::Z(true) } else { E::W(5) }; | ||
| match e { | ||
| E::Z(_) => 10, | ||
| E::W(v) => v, | ||
| } | ||
| } | ||
| } | ||
|
|
||
| fn main() { | ||
| assert!(A::f(true) == 1); | ||
| assert!(B::f(false) == 10); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| //@check-pass | ||
| //@compile-flags: -C debug-assertions=off | ||
|
|
||
| trait T { | ||
| fn f(b: bool) -> i64; | ||
| } | ||
|
|
||
| struct A; | ||
| struct B; | ||
|
|
||
| impl thrust_models::Model for A { | ||
| type Ty = Self; | ||
| } | ||
|
|
||
| impl thrust_models::Model for B { | ||
| type Ty = Self; | ||
| } | ||
|
|
||
| impl T for A { | ||
| fn f(b: bool) -> i64 { | ||
| enum E { | ||
| X(i64), | ||
| Y, | ||
| } | ||
| impl thrust_models::Model for E { | ||
| type Ty = Self; | ||
| } | ||
| let e = if b { E::X(1) } else { E::Y }; | ||
| match e { | ||
| E::X(x) => x, | ||
| E::Y => 0, | ||
| } | ||
| } | ||
| } | ||
|
|
||
| impl T for B { | ||
| fn f(b: bool) -> i64 { | ||
| enum E { | ||
| Z(bool), | ||
| W(i64), | ||
| } | ||
| impl thrust_models::Model for E { | ||
| type Ty = Self; | ||
| } | ||
| let e = if b { E::Z(true) } else { E::W(5) }; | ||
| match e { | ||
| E::Z(_) => 10, | ||
| E::W(v) => v, | ||
| } | ||
| } | ||
| } | ||
|
|
||
| fn main() { | ||
| assert!(A::f(true) == 1); | ||
| assert!(B::f(false) == 5); | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When verification uses an existing module-level enum—most notably
std.option.Optionintests/ui/pass/slice_split_first_mut_loop.rs—this unconditionally replaces its prior readable symbol with a hash-suffixed name even though only locally nested enums need disambiguation. PCSat is sensitive to these names: this renaming increases that representative case from roughly 5 seconds to beyond the solver's 30-second default, turning a valid program into a timeout. Keep the olddef_path_strsymbol for paths consisting only of module/type-namespace segments and use the stable def-id symbol only for nested items.Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Leaving this as is. The maintainer asked to drop the module-path branch, so this PR now uses the stable symbol for every enum. The slowdown is PCSat reacting to one particular name string: the SMT is semantically identical, and other renamings of the same file solve in 6–9s. So it isn't a good reason to keep two naming schemes. I'm waiting for CI on ff61c0b to see whether that test times out on the runner.
Generated by Claude Code