Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 29 additions & 18 deletions gcc/rust/parse/rust-parse-impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -9460,28 +9460,39 @@ Parser<ManagedTokenSource>::parse_paren_prefixed_type ()
{
// release vector pointer
std::unique_ptr<AST::Type> released_ptr = std::move (types[0]);

// We don't want to convert it to TraitBound as it could be a
// ParenthesisedType

return std::unique_ptr<AST::ParenthesisedType> (
new AST::ParenthesisedType (std::move (released_ptr),
left_delim_locus));

/* HACK: attempt to convert to trait bound. if fails, parenthesised
* type */
std::unique_ptr<AST::TraitBound> converted_bound (
released_ptr->to_trait_bound (true));
if (converted_bound == nullptr)
{
// parenthesised type
return std::unique_ptr<AST::ParenthesisedType> (
new AST::ParenthesisedType (std::move (released_ptr),
left_delim_locus));
}
else
{
// trait object type (one bound)

// get value semantics trait bound
AST::TraitBound value_bound (*converted_bound);
/*
std::unique_ptr<AST::TraitBound> converted_bound (
released_ptr->to_trait_bound (true));
if (converted_bound == nullptr)
{
// parenthesised type
return std::unique_ptr<AST::ParenthesisedType> (
new AST::ParenthesisedType (std::move (released_ptr),
left_delim_locus));
}
else
{
// trait object type (one bound)

return std::unique_ptr<AST::TraitObjectTypeOneBound> (
new AST::TraitObjectTypeOneBound (value_bound,
left_delim_locus));
}
// get value semantics trait bound
AST::TraitBound value_bound (*converted_bound);

return std::unique_ptr<AST::TraitObjectTypeOneBound> (
new AST::TraitObjectTypeOneBound (value_bound,
left_delim_locus));
}
*/
}
}
else
Expand Down
2 changes: 0 additions & 2 deletions gcc/testsuite/rust/compile/issue-4148.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// { dg-excess-errors "warnings" }

// TODO: all `xfail` conditions should be changed to `target` once the ICE in #4148 is resolved

pub fn ret_parens(x: i32) -> i32 {
Expand Down
Loading