diff options
author | Philip Herron <philip.herron@embecosm.com> | 2022-04-26 20:12:58 +0100 |
---|---|---|
committer | Philip Herron <philip.herron@embecosm.com> | 2022-04-26 21:44:00 +0100 |
commit | ea38a59ee8329bb7b309400a7de57d53ad7bde31 (patch) | |
tree | 7efe52d94bf719b0a4db1d15d0f90ec65e6e5141 /gcc/rust/backend/rust-compile-expr.h | |
parent | 40f2979b73b56e4ddc5ab5686d75164a8b664320 (diff) | |
download | gcc-ea38a59ee8329bb7b309400a7de57d53ad7bde31.zip gcc-ea38a59ee8329bb7b309400a7de57d53ad7bde31.tar.gz gcc-ea38a59ee8329bb7b309400a7de57d53ad7bde31.tar.bz2 |
Fix regression in fix for #1173
A regression was introduced in e476433c45624ec713395c85bcbd410806e90639
this was a tricky bug to fix. There are several fixes here but they all
rely on one another so in order to have a commit which does not introduce
more regressions it seems best to keep these fixes together.
In this patch we remove the check at the end of type resolution to look
for any error type nodes within the type context since this will only ever
produce false postive/duplicate errors. Since any real error will have been
emitted at the time of occurance.
We also fixed a bug in infering the types on a generic type so for example:
struct Foo<A,B>(A,B);
impl<T> Foo<T,T> { ... }
In this example the Self type on the impl block will be Foo<T,T> so in the
code for infering the arguments for the type we simply iterated each of the
generic parameter mappings and if any of them need substitution we generate
implict inference variables for them but in this case the ParamType is T
so generating one for each of these T's will introduce a stay inference
variable which we cannot infer so it will not be used. This patch keeps
a mapping inside SubstitutionRef::infer_substitions to ensure we don't
introduce any extra inference variables than required.
The final fix was around how we clone inference variables, there is a
comment explaining this but we cannot safely clone a inference variables
simply by creating a new object, inference variables are closely tied to
the type-conext so that when we infer the type to be a concrete type we
need to be able to update the reference in memory but simply cloning an
inference variable does not guarentee this to occur. This change ensures
that we create a new implict inference variable and setup the reference
and chain apropirately.
Diffstat (limited to 'gcc/rust/backend/rust-compile-expr.h')
0 files changed, 0 insertions, 0 deletions