rust-lang / rust-lang/rust

Functions are missing from "--emit=llvm-ir" and "--emit=asm"

Open
#119,850 4 comments 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-codegen C-discussion T-compiler
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

Ever since https://github.com/rust-lang/rust/pull/116505 landed, functions can be missing from "--emit=llvm-ir" and "--emit=asm" unless they are declared with #[inline(never)] or #[no_mangle]. This is quite surprising to most people that want to explore the LLVM IR / asm of a Rust function.

It's unclear how to best fix this, since not producing LLVM IR or asm (but only MIR) when compiling these functions was part of the goal of #116505. Maybe these --emit flags should themselves cause the functions to be monomorphized so they become visible again?

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 by reviewing pull request #116505 and reproducing the issue with --emit=llvm-ir and --emit=asm. Compare output for functions with and without #[inline(never)] or #[no_mangle], then determine how the emit flags should interact with the monomorphization behavior introduced there. Done means the intended functions are visible in LLVM IR or assembly without requiring those attributes while preserving the original MIR-only goal where appropriate.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.