Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closure symbols no longer contain hashes and also collide #12400

Closed
alexcrichton opened this issue Feb 19, 2014 · 1 comment
Closed

Closure symbols no longer contain hashes and also collide #12400

alexcrichton opened this issue Feb 19, 2014 · 1 comment
Labels
A-codegen Area: Code generation

Comments

@alexcrichton
Copy link
Member

With this code:

fn foo(a: ||) {}

fn main() {
    foo(|| println!("hello!"));
    foo(|| println!("hello!"));
    foo(|| println!("hello!"));
    foo(|| println!("hello!"));
    foo(|| println!("hello!"));
    foo(|| println!("hello!"));
    foo(|| println!("hello!"));
    foo(|| println!("hello!"));
    foo(|| println!("hello!"));
    foo(|| println!("hello!"));
    foo(|| println!("hello!"));
}

I inspected the disassembly via:

$ rustc foo.rs --emit=ir
$ cat foo.ll | grep 'define.*closure'
define internal void @_ZN4main7closureE1(i8*) unnamed_addr #5 {
define internal void @_ZN4main7closureE2(i8*) unnamed_addr #5 {
define internal void @_ZN4main7closureE3(i8*) unnamed_addr #5 {
define internal void @_ZN4main7closureE4(i8*) unnamed_addr #5 {
define internal void @_ZN4main7closureE5(i8*) unnamed_addr #5 {
define internal void @_ZN4main7closureE6(i8*) unnamed_addr #5 {
define internal void @_ZN4main7closureE7(i8*) unnamed_addr #5 {
define internal void @_ZN4main7closureE8(i8*) unnamed_addr #5 {
define internal void @_ZN4main7closureE9(i8*) unnamed_addr #5 {
define internal void @_ZN4main7closureE10(i8*) unnamed_addr #5 {
define internal void @_ZN4main7closureE(i8*) unnamed_addr #5 {

LLVM is silently renaming our closure symbols by appending numbers at the end of them. This is causing the symbols to not be able to get de-mangled (they don't end in E). Additionally, there is no hash information about the type or the crate which I think we expect in all of our symbols.

@alexcrichton
Copy link
Member Author

This is a regression from #12162

cc @eddyb

flip1995 pushed a commit to flip1995/rust that referenced this issue Mar 7, 2024
[`let_underscore_untyped`]: fix false positive on async function

changelog: [`let_underscore_untyped`]: fix false positive on async function

Fix rust-lang#12395
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-codegen Area: Code generation
Projects
None yet
Development

No branches or pull requests

1 participant