about summary refs log tree commit diff
path: root/src/rustllvm/RustWrapper.cpp
diff options
context:
space:
mode:
authorNiko Matsakis <niko@alum.mit.edu>2017-04-11 17:17:58 -0400
committerNiko Matsakis <niko@alum.mit.edu>2017-04-11 20:32:47 -0400
commitbca56e82a1bbd775498257cc080f5ea27b214f49 (patch)
tree7e860851e6843f720c3d75b8a1323c2d346ccbfa /src/rustllvm/RustWrapper.cpp
parent3a5bbf89b2229c629c6f01bdd87354cba136d133 (diff)
downloadrust-bca56e82a1bbd775498257cc080f5ea27b214f49.tar.gz
rust-bca56e82a1bbd775498257cc080f5ea27b214f49.zip
generalize type variables too
When we are generalizing a super/sub-type, we have to replace type
variables with a fresh variable (and not just region variables).  So if
we know that `Box<?T> <: ?U`, for example, we instantiate `?U` with
`Box<?V>` and then relate `Box<?T>` to `Box<?V>` (and hence require that
`?T <: ?V`).

This change has some complex interactions, however:

First, the occurs check must be updated to detect constraints like `?T
<: ?U` and `?U <: Box<?T>`. If we're not careful, we'll create a
never-ending sequence of new variables. To address this, we add a second
unification set into `type_variables` that tracks type variables related
through **either** equality **or** subtyping, and use that during the
occurs-check.

Second, the "fudge regions if ok" code was expecting no new type
variables to be created. It must be updated to create new type variables
outside of the probe. This is relatively straight-forward under the new
scheme, since type variables are now independent from one another, and
any relations are moderated by pending subtype obliations and so forth.
This part would be tricky to backport though.

cc #18653
cc #40951
Diffstat (limited to 'src/rustllvm/RustWrapper.cpp')
0 files changed, 0 insertions, 0 deletions