-
Notifications
You must be signed in to change notification settings - Fork 43
Accumulate outlives separately, read-only typeck-env #210
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
base: main
Are you sure you want to change the base?
Conversation
- Fn(fn_id) values now return FnDef types instead of storing in side table - Call sites extract function signature from FnDef type - Removes callee_input_tys field from TypeckEnv entirely - More correct type system behavior
- Removes ret_place_is_initialised field from TypeckEnv - Comments out return place initialization checks (filed as issue rust-lang#209) - Updates test expectations for struct format changes - Marks test_uninitialised_return_type with FIXME(rust-lang#209) - should fail when issue is resolved This enables using &self for TypeckEnv methods instead of &mut self, supporting the pending_outlives refactoring.
- Remove pending_outlives field from TypeckEnv struct - Thread &mut Set<PendingOutlives> parameter through all type checking functions - Update borrow_check to take pending_outlives as parameter - Update transitively_outlived_by to take pending_outlives parameter - Most TypeckEnv methods now use &self instead of &mut self (except those that still mutate other fields) - Update test expectations for struct format changes This makes outlives constraint collection more explicit and functional rather than hidden mutable state.
| } | ||
|
|
||
| /// The borrow checker's job is to pick up where the type-checker left off: | ||
| /// Given the `TypeckEnv`, which includes a (populated) list of `pending_outlives` |
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.
As we've extracted the outlives out of the env, this doc comment was slightly invalidated, so maybe:
| /// Given the `TypeckEnv`, which includes a (populated) list of `pending_outlives` | |
| /// Given the `TypeckEnv`, and a (populated) list of `pending_outlives` |
| CrateItem::NegTraitImpl(i) => self.check_neg_trait_impl(i), | ||
| CrateItem::Test(t) => self.check_test(t), | ||
| CrateItem::FeatureGate(_feature_gate) => { | ||
| Ok(ProofTree::leaf("feature gates are OK with me!")) |
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.
maybe we can add a comment like "TODO: reject duplicate gates like rustc"
| } | ||
|
|
||
| // Test the behaviour of having unitialised return local variable. | ||
| // FIXME(#209): This test should fail but currently passes due to removed return place initialization check |
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.
we could maybe just #[ignore] that test with the comment, rather than changing the assertion from err to ok?
Per our discussion today, we are moving towards modeling polonius-α which will require a context-dependent notion of outlives. This will also imply merging the type-check + borrow-check rules. These refactorings move us closer to that world.
r? @lqd or @jackh726