diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-08-20 12:34:35 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-20 12:34:35 +0000 |
commit | 79754bd20bdfa64a4ce91e5b4a65154c313b2d83 (patch) | |
tree | 47dc551f706c4015c017a299a4054cb7db460857 /gcc/rust/backend/rust-compile-item.h | |
parent | 387f73626ae0e04c3f81d71d4de6780a4caad052 (diff) | |
parent | 048261647afd1a08f681b78c90c58a9baaeef76d (diff) | |
download | gcc-79754bd20bdfa64a4ce91e5b4a65154c313b2d83.zip gcc-79754bd20bdfa64a4ce91e5b4a65154c313b2d83.tar.gz gcc-79754bd20bdfa64a4ce91e5b4a65154c313b2d83.tar.bz2 |
Merge #626
626: Optional trait items r=philberty a=philberty
Optional trait items like function may contain associated types. These
are dependant on the associated impl block for this type in order to
correctly propagate the correct types for the associated trait item during
type checking and compilation.
Fixes #542
Co-authored-by: Philip Herron <philip.herron@embecosm.com>
Diffstat (limited to 'gcc/rust/backend/rust-compile-item.h')
-rw-r--r-- | gcc/rust/backend/rust-compile-item.h | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/gcc/rust/backend/rust-compile-item.h b/gcc/rust/backend/rust-compile-item.h index 8b36289..a12e67e 100644 --- a/gcc/rust/backend/rust-compile-item.h +++ b/gcc/rust/backend/rust-compile-item.h @@ -59,7 +59,7 @@ public: &canonical_path)); std::string name = canonical_path->get (); - std::string asm_name = ctx->mangle_item (resolved_type, name); + std::string asm_name = ctx->mangle_item (resolved_type, *canonical_path); bool is_external = false; bool is_hidden = false; @@ -168,12 +168,24 @@ public: std::string ir_symbol_name = canonical_path->get () + fntype->subst_as_string (); + std::string asm_name = function.get_function_name (); // we don't mangle the main fn since we haven't implemented the main shim // yet if (!is_main_fn) - asm_name = ctx->mangle_item (fntype, ir_symbol_name); + { + std::string substs_str = fntype->subst_as_string (); + + Resolver::CanonicalPath mangle_me + = substs_str.empty () + ? *canonical_path + : canonical_path->append ( + Resolver::CanonicalPath::new_seg (0, + fntype->subst_as_string ())); + + asm_name = ctx->mangle_item (fntype, mangle_me); + } Bfunction *fndecl = ctx->get_backend ()->function (compiled_fn_type, ir_symbol_name, |