public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc/devel/rust/master] Merge #1222 #1223 #1225
@ 2022-06-08 12:45 Thomas Schwinge
  0 siblings, 0 replies; only message in thread
From: Thomas Schwinge @ 2022-06-08 12:45 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:dd5a7654d32134d9bfbe25180dad114367e77767

commit dd5a7654d32134d9bfbe25180dad114367e77767
Merge: 3b8f3e61394 55346cc59b7 cb4d935508d 16da547c6de
Author: bors[bot] <26634292+bors[bot]@users.noreply.github.com>
Date:   Mon May 9 10:40:43 2022 +0000

    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>

Diff:

 gcc/rust/backend/rust-compile-base.h             |   4 +-
 gcc/rust/backend/rust-compile.cc                 |  25 ++-
 gcc/rust/expand/rust-macro-substitute-ctx.cc     |  15 ++
 gcc/rust/typecheck/rust-hir-type-check-expr.cc   |   3 +-
 gcc/rust/typecheck/rust-tyty.cc                  | 267 ++++++++++++++++++++++-
 gcc/rust/typecheck/rust-tyty.h                   |  48 ++++
 gcc/testsuite/rust/compile/macro-issue1224.rs    |   9 +
 gcc/testsuite/rust/execute/torture/issue-1133.rs | 146 +++++++++++++
 8 files changed, 496 insertions(+), 21 deletions(-)


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-06-08 12:45 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-08 12:45 [gcc/devel/rust/master] Merge #1222 #1223 #1225 Thomas Schwinge

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).