Skip to content

transpile: prune_unwanted_decls only after setting prenamed_decls#1739

Merged
kkysen merged 3 commits intoimmunant:masterfrom
Rua:typedef-prune-fix
Apr 24, 2026
Merged

transpile: prune_unwanted_decls only after setting prenamed_decls#1739
kkysen merged 3 commits intoimmunant:masterfrom
Rua:typedef-prune-fix

Conversation

@Rua
Copy link
Copy Markdown
Contributor

@Rua Rua commented Apr 15, 2026

@Rua Rua force-pushed the typedef-prune-fix branch from 7f221d6 to 6f0ddb3 Compare April 15, 2026 17:03
@fw-immunant
Copy link
Copy Markdown
Contributor

Panic in CI:

[ FAILED ] translate enum_fwd_decl.c
thread 'main' panicked at 'Could not find CDeclId(155) in TypedAstContext', c2rust-transpile/src/c_ast/mod.rs:1009:44
stack backtrace:
   0: rust_begin_unwind
             at /rustc/d394408fb38c4de61f765a3ed5189d2731a1da91/library/std/src/panicking.rs:584:5
   1: core::panicking::panic_fmt
             at /rustc/d394408fb38c4de61f765a3ed5189d2731a1da91/library/core/src/panicking.rs:142:14
   2: c2rust_transpile::c_ast::TypedAstContext::set_prenamed_decls
   3: c2rust_transpile::translator::translate
   4: c2rust_transpile::transpile_single
   5: <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::fold
   6: <alloc::vec::Vec<T> as alloc::vec::spec_from_iter::SpecFromIter<T,I>>::from_iter
   7: c2rust_transpile::transpile
   8: c2rust_transpile::main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

@Rua
Copy link
Copy Markdown
Contributor Author

Rua commented Apr 15, 2026

Yeah, it's panicking on the problem reported in #1740. The AST contains a CDeclId that doesn't refer to anything.

@kkysen kkysen force-pushed the typedef-prune-fix branch from 5efc9cf to eaacdfe Compare April 24, 2026 08:13
@kkysen kkysen merged commit 80bb8c3 into immunant:master Apr 24, 2026
10 checks passed
@Rua Rua deleted the typedef-prune-fix branch April 24, 2026 09:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

transpile: typedef of anonymous types are lost if name is not used

4 participants