From: Philip Herron <[email protected]>
This is just a basic patch to get past a crash in libcore we probably need
to default to unit-type somewhere later on.
gcc/rust/ChangeLog:
* typecheck/rust-tyty-bounds.cc: handle assertion
Signed-off-by: Philip Herron <[email protected]>
---
This change was merged into the gccrs repository and is posted here for
upstream visibility and potential drive-by review, as requested by GCC
release managers.
Each commit email contains a link to its details on github from where you can
find the Pull-Request and associated discussions.
Commit on github:
https://github.com/Rust-GCC/gccrs/commit/7ce9f8446d5665ec49137fd7f9d325694ffb4e76
The commit has NOT been mentioned in any issue.
The commit has been mentioned in the following pull-request(s):
- https://github.com/Rust-GCC/gccrs/pull/4831
gcc/rust/typecheck/rust-tyty-bounds.cc | 19 ++++++++++---------
1 file changed, 10 insertions(+), 9 deletions(-)
diff --git a/gcc/rust/typecheck/rust-tyty-bounds.cc
b/gcc/rust/typecheck/rust-tyty-bounds.cc
index f72ee57f9..fca42d61a 100644
--- a/gcc/rust/typecheck/rust-tyty-bounds.cc
+++ b/gcc/rust/typecheck/rust-tyty-bounds.cc
@@ -332,11 +332,6 @@ TypeCheckBase::get_predicate_from_bound (
std::make_unique<HIR::TupleType> (mapping, std::move (params_copy),
final_seg.get_locus ()));
- // resolve the fn_once_output type which assumes there must be an output
- // set
- rust_assert (fn.has_return_type ());
- TypeCheckType::Resolve (fn.get_return_type ());
-
HIR::TraitItem *trait_item
= mappings
.lookup_trait_item_lang_item (LangItem::Kind::FN_ONCE_OUTPUT,
@@ -344,10 +339,16 @@ TypeCheckBase::get_predicate_from_bound (
.value ();
std::vector<HIR::GenericArgsBinding> bindings;
- location_t output_locus = fn.get_return_type ().get_locus ();
- bindings.emplace_back (Identifier (trait_item->trait_identifier ()),
- fn.get_return_type ().clone_type (),
- output_locus);
+
+ if (fn.has_return_type ())
+ {
+ TypeCheckType::Resolve (fn.get_return_type ());
+
+ location_t output_locus = fn.get_return_type ().get_locus ();
+ bindings.emplace_back (Identifier (trait_item->trait_identifier ()),
+ fn.get_return_type ().clone_type (),
+ output_locus);
+ }
args = HIR::GenericArgs ({} /* lifetimes */,
std::move (inputs) /* type_args*/,
base-commit: a64ace613c317103e3a0e347aefd030906d6309b
--
2.55.0