Rust-GCC / Rust-GCC/gccrs

Self generic injection causes metadata dump issue

Open
#2,349 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
C++
Stars
2.9k
Forks
231
Avg merge
19h 55m
Merged PRs (30d)
67

Description

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 implicit Self and cannot compile anymore.

Code

See disabled test trait_import0.rs

Meta
  • 77279ee4a5a
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<char, std::char_traits<char>, std::allocator<char> > 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::AST::GenericParam, std::default_delete<Rust::AST::GenericParam> > Rust::Parser<Rust::Lexer>::parse_generic_param<bool (*)(Rust::TokenId)>(bool (*)(Rust::TokenId))
	../../gcc/rust/parse/rust-parse-impl.h:3135
0x111c5c1 std::vector<std::unique_ptr<Rust::AST::GenericParam, std::default_delete<Rust::AST::GenericParam> >, std::allocator<std::unique_ptr<Rust::AST::GenericParam, std::default_delete<Rust::AST::GenericParam> > > > Rust::Parser<Rust::Lexer>::parse_generic_params<bool (*)(Rust::TokenId)>(bool (*)(Rust::TokenId))
	../../gcc/rust/parse/rust-parse-impl.h:3168
0x111b105 Rust::Parser<Rust::Lexer>::parse_generic_params_in_angles()
	../../gcc/rust/parse/rust-parse-impl.h:3004
0x1116f5a Rust::Parser<Rust::Lexer>::parse_trait(Rust::AST::Visibility, std::vector<Rust::AST::Attribute, std::allocator<Rust::AST::Attribute> >)
	../../gcc/rust/parse/rust-parse-impl.h:4913
0x111057c Rust::Parser<Rust::Lexer>::parse_vis_item(std::vector<Rust::AST::Attribute, std::allocator<Rust::AST::Attribute> >)
	../../gcc/rust/parse/rust-parse-impl.h:1374
0x110ef75 Rust::Parser<Rust::Lexer>::parse_item(bool)
	../../gcc/rust/parse/rust-parse-impl.h:1117
0x10caa79 Rust::Parser<Rust::Lexer>::parse_items()
	../../gcc/rust/parse/rust-parse-impl.h:415
0x11d5f67 Rust::Parser<Rust::Lexer>::parse_crate()
	../../gcc/rust/parse/rust-parse-impl.h:444

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the disabled test trait_import0.rs and trace the metadata dump through the name-resolution step that injects the implicit Self generic. Reproduce the failure and inspect the metadata export and parser diagnostics; done means the dumped metadata retains the required generics and compiles without the parse failure.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, rust
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.