diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2022-05-09 10:40:43 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-09 10:40:43 +0000 |
commit | dd5a7654d32134d9bfbe25180dad114367e77767 (patch) | |
tree | 7e12b48420f98b819e567ef478d189db58853aed /gcc/rust/backend/rust-compile-pattern.cc | |
parent | 3b8f3e61394f27100fb788a839e61f8b753f502b (diff) | |
parent | 55346cc59b766266202a0ba2114275eb2fc53dda (diff) | |
parent | cb4d935508def8b250345ba5205a90ad9e177ab4 (diff) | |
parent | 16da547c6de0957d4dd697c53260a6bb9a087163 (diff) | |
download | gcc-dd5a7654d32134d9bfbe25180dad114367e77767.zip gcc-dd5a7654d32134d9bfbe25180dad114367e77767.tar.gz gcc-dd5a7654d32134d9bfbe25180dad114367e77767.tar.bz2 |
Merge #1222 #1223 #1225
1222: Destructure our generics, placeholers or projections during coercion r=philberty a=philberty
When we coerce types we need to destructure from the generics in order to
apply these coercion rules correctly or we end up returning a bad
error_mark_node.
This was found while fixing https://github.com/Rust-GCC/gccrs/pull/1220
1223: Add new monomorphize_clone interface r=philberty a=philberty
This interface is required when we monomorphize since types might be
placeholder -> projection -> param -> actual-type
This gives us a clean clone interface to destructure this into its actual
type. This is important so for example if we have a generic trait function
and resolve the function for a specific set of generics we update the
associated types. This works, then when we go to substitute the same
generic trait again the placeholders are again updated throwing off the
typing for the first type.
There is more cleanup we can do once this PR is in to make this part of
the general monomorphization path so that we sort out these as part
of the fntype
Fixes #1133
1225: macros: Error out when repeating metavars which refer to repetitions r=CohenArthur a=CohenArthur
In the case were a repeting metavar was used as a regular metavar ($var
instead of $($var)* for example), the compiler would crash on an
assertion that $var was only repeating once. We should instead error out
and point to the user that this is probably not what they intended to
do.
Some spurious errors are emitted, but improving them requires a major refactor of the SubstitutionContext file to report error states before.
Closes #1224
Thanks to `@bjorn3` for pointing this out.
Co-authored-by: Philip Herron <philip.herron@embecosm.com>
Co-authored-by: CohenArthur <arthur.cohen@epita.fr>