Open P-E-P opened 1 year ago
Thanks for this, I want to re look at our metadata output pass for this case.
// we need to inject an implicit self TypeParam here
// FIXME: which location should be used for Rust::Identifier `Self`?
AST::TypeParam *implicit_self
= new AST::TypeParam ({"Self"}, trait.get_locus ());
trait.insert_implict_self (
std::unique_ptr<AST::GenericParam> (implicit_self));
CanonicalPath Self = CanonicalPath::get_big_self (trait.get_node_id ());
See rust-ast-resolve-item.cc:819
Dump process shall dump all generics in order to be accurate, but an implicit
Self
generic is injected during name-resolution step. This means, the dump used for metadata export does contain this implicitSelf
and cannot compile anymore.Code
See disabled test
trait_import0.rs
Meta
Error output
Failure to parse metadata.
Details
``` crab1: internal compiler error: in linemap_ordinary_map_lookup, at libcpp/line-map.cc:1101 0x395fae3 linemap_ordinary_map_lookup(line_maps const*, unsigned int) /home/patryp/Documents/gccrs/build/libcpp/../../libcpp/line-map.cc:1101 0x395f4fc linemap_lookup(line_maps const*, unsigned int) /home/patryp/Documents/gccrs/build/libcpp/../../libcpp/line-map.cc:1057 0x3961831 linemap_location_in_system_header_p(line_maps*, unsigned int) /home/patryp/Documents/gccrs/build/libcpp/../../libcpp/line-map.cc:1323 0x1609e8a in_system_header_at(unsigned int) ../../gcc/input.h:202 0x1e094df set_inlining_locations(diagnostic_context*, diagnostic_info*) /home/patryp/Documents/gccrs/build/gcc/../../gcc/tree-diagnostic.cc:358 0x38e2372 get_any_inlining_info(diagnostic_context*, diagnostic_info*) /home/patryp/Documents/gccrs/build/gcc/../../gcc/diagnostic.cc:1222 0x38dd34c diagnostic_enabled(diagnostic_context*, diagnostic_info*) /home/patryp/Documents/gccrs/build/gcc/../../gcc/diagnostic.cc:1431 0x38dd606 diagnostic_report_diagnostic(diagnostic_context*, diagnostic_info*) /home/patryp/Documents/gccrs/build/gcc/../../gcc/diagnostic.cc:1545 0x38de7f1 diagnostic_impl(rich_location*, diagnostic_metadata const*, int, char const*, __va_list_tag (*) [1], diagnostic_t) /home/patryp/Documents/gccrs/build/gcc/../../gcc/diagnostic.cc:1756 0x38dfbfc error_at(unsigned int, char const*, ...) /home/patryp/Documents/gccrs/build/gcc/../../gcc/diagnostic.cc:2079 0x1078e50 rust_be_error_at(Location, std::__cxx11::basic_string, std::allocator > const&)
/home/patryp/Documents/gccrs/build/gcc/../../gcc/rust/rust-diagnostics.cc:183
0x1078f15 rust_error_at(Location, char const*, ...)
/home/patryp/Documents/gccrs/build/gcc/../../gcc/rust/rust-diagnostics.cc:192
0x111d3ab std::unique_ptr > Rust::Parser::parse_generic_param(bool (*)(Rust::TokenId))
../../gcc/rust/parse/rust-parse-impl.h:3135
0x111c5c1 std::vector >, std::allocator > > > Rust::Parser::parse_generic_params(bool (*)(Rust::TokenId))
../../gcc/rust/parse/rust-parse-impl.h:3168
0x111b105 Rust::Parser::parse_generic_params_in_angles()
../../gcc/rust/parse/rust-parse-impl.h:3004
0x1116f5a Rust::Parser::parse_trait(Rust::AST::Visibility, std::vector >)
../../gcc/rust/parse/rust-parse-impl.h:4913
0x111057c Rust::Parser::parse_vis_item(std::vector >)
../../gcc/rust/parse/rust-parse-impl.h:1374
0x110ef75 Rust::Parser::parse_item(bool)
../../gcc/rust/parse/rust-parse-impl.h:1117
0x10caa79 Rust::Parser::parse_items()
../../gcc/rust/parse/rust-parse-impl.h:415
0x11d5f67 Rust::Parser::parse_crate()
../../gcc/rust/parse/rust-parse-impl.h:444
```