Open CohenArthur opened 1 year ago
There is a stray macro invocation during HIR lowering:
test.rs:11:25: note: lowering type!!!: MacroInvocation: [regular]
outer attributes: none
foo!(())
has semicolon: false
11 | pub fn foo<T: Bar<Baz = foo!()>>(_value: T) -> i32 {
| ^~~
crab1: internal compiler error: in translate, at rust/hir/rust-ast-lower-type.h:73
Its hitting:
(gdb) n
232 if (depth_exceeds_recursion_limit ())
(gdb)
238 if (invoc.get_kind () == AST::MacroInvocation::InvocKind::Builtin)
(gdb)
241 AST::MacroInvocData &invoc_data = invoc.get_invoc_data ();
(gdb)
261 auto fragment = AST::Fragment::create_error ();
(gdb)
262 invoc_data.set_expander (this);
(gdb)
265 AST::MacroRulesDefinition *rules_def = nullptr;
(gdb)
266 bool ok = mappings->lookup_macro_invocation (invoc, &rules_def);
(gdb)
270 if (!ok)
(gdb)
271 return;
I made a few tweaks:
diff --git a/gcc/rust/expand/rust-attribute-visitor.cc b/gcc/rust/expand/rust-attribute-visitor.cc
index 13ae28c0b5e..e9c3f5c6c38 100644
--- a/gcc/rust/expand/rust-attribute-visitor.cc
+++ b/gcc/rust/expand/rust-attribute-visitor.cc
@@ -166,19 +166,22 @@ AttrVisitor::expand_generic_args (AST::GenericArgs &args)
}
}
- expander.pop_context ();
-
// FIXME: Can we have macro invocations in generic type bindings?
// expand binding args - strip sub-types only
for (auto &binding : args.get_binding_args ())
{
auto &type = binding.get_type ();
+
+ rust_debug_loc (type->get_locus (), "HELLO");
type->accept_vis (*this);
+ maybe_expand_type (type);
if (type->is_marked_for_strip ())
rust_error_at (type->get_locus (),
"cannot strip type in this position");
}
+
+ expander.pop_context ();
@CohenArthur I know your making changes to the early name resolver at the moment I wonder if there is cross over here
I think the early name resolver is not being run on the type bindings so following gdb it just returns early.
@philberty I checked and this issue is still present. Did you maybe refer to the wrong issue number in #2322?
Ah darn it yes i mark the wrong issue sorry about this
I tried this code:
I expected to see this happen: no errors
Instead, this happened: internal compiler error when lowering the type:
9024d99f5b7
A different case with simpler associated types:
Same error, same hash