-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
extract the list of clauses and intern it #41444
Labels
A-trait-system
Area: Trait system
C-cleanup
Category: PRs that clean code up or issues documenting cleanup.
E-medium
Call for participation: Medium difficulty. Experience needed to fix: Intermediate.
Comments
cc @tschottdorf, who is interested in working on this |
I'm taking a stab at this. |
tbg
added a commit
to tbg/rust
that referenced
this issue
May 2, 2017
See rust-lang#41444. As a first step towards untangling `ParameterEnvironment`, change its `caller_bounds` field from a `Vec` into an interned slice of `ty::Predicate`s. This change is intentionally well-contained and doesn't pull on any of the loose ends. In particular, you'll note that `normalize_param_env_or_error` now interns twice.
bors
added a commit
that referenced
this issue
May 2, 2017
Store interned predicates in ParameterEnvironment See #41444. As a first step towards untangling `ParameterEnvironment`, change its `caller_bounds` field from a `Vec` into an interned slice of `ty::Predicate`s. This change is intentionally well-contained and doesn't pull on any of the loose ends. In particular, you'll note that `normalize_param_env_or_error` now interns twice.
Closing as this was presumably fixed by #41605. @nikomatsakis please reopen if I'm wrong, the current paramenv is here: Lines 1198 to 1212 in 622e7e6
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
A-trait-system
Area: Trait system
C-cleanup
Category: PRs that clean code up or issues documenting cleanup.
E-medium
Call for participation: Medium difficulty. Experience needed to fix: Intermediate.
Right now the
ParameterEnvironment
is a kind of grab bag of things. The most important thing, however, is the list of "caller bounds". In more Prolog-y terms, these are the clauses in the environment -- that is, they are the where-clauses that are in scope, and hence which we can assume to be true. If you look in thelibrustc/traits
code, you'll see that in fact the only thing which gets used from theParameterEnvironment
is thiscaller_bounds
field.Eventually, I think we want to move the
caller_bounds
out into the obligations themselves. That is, in chalk, an obligation is not just the thing to be proven but also the environment in which it should be proven -- and this environment can grow and get new clauses as we go (this will be important for checking higher-ranked trait bounds likefor<T: Foo> Vec<T>: Bar
).To this end, a first step (this issue) is to refactor
caller_bounds
so that they are an interned, lightweight pointer. (The whole setup aroundParameterEnvironment
is, in fact, kind of a mess, but let's start simple). I envision a structEnvironment<'tcx>
:where the clauses list is interned. This struct will eventually be part of every
Obligation
, so it's important that it be cheap to copy. It will also eventually be hashed for cache keys, so having an interned list of predicates makes that cheap. It will also grow an additional field (universe_index: usize
), and hence it's convenient for it to be a named struct.We might want to pick a less overloaded name than
Environment<'tcx>
. I'm not sure what to use though, that's really the most common name for this sort of thing.The text was updated successfully, but these errors were encountered: