-
Notifications
You must be signed in to change notification settings - Fork 243
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Add more thorough check for whether a type is valid when passing…
… it from constrained code to unconstrained code (#5009) # Description ## Problem\* Resolves #5008 ## Summary\* Thank you to @nventuro for the minimal example and @TomAFrench for looking into this. As a result it was a quick fix. ## Additional Context All type system fixes must currently be duplicated in the elaborator so I've included this there as well. ## Documentation\* Check one: - [x] No documentation needed. - [ ] Documentation included in this PR. - [ ] **[For Experimental Features]** Documentation to be submitted in a separate PR. # PR Checklist\* - [x] I have tested the changes locally. - [x] I have formatted the changes with [Prettier](https://prettier.io/) and/or `cargo fmt` on default settings. --------- Co-authored-by: TomAFrench <[email protected]> Co-authored-by: Tom French <[email protected]>
- Loading branch information
1 parent
1a794e3
commit 318314d
Showing
5 changed files
with
69 additions
and
7 deletions.
There are no files selected for viewing
This file contains 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 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 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 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,7 @@ | ||
[package] | ||
name = "regression_5008" | ||
type = "bin" | ||
authors = [""] | ||
compiler_version = ">=0.28.0" | ||
|
||
[dependencies] |
This file contains 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,17 @@ | ||
struct Bar { | ||
value: Field, | ||
} | ||
|
||
struct Foo{ | ||
bar: &mut Bar, | ||
} | ||
|
||
impl Foo { | ||
unconstrained fn crash_fn(self) {} | ||
} | ||
|
||
fn main() { | ||
let foo = Foo { bar: &mut Bar { value: 0 } }; | ||
|
||
foo.crash_fn(); | ||
} |