Repository: rust
Issue: error: linking with `cc` failed: exit status: 1
Labels: A-codegen,P-medium,T-compiler,regression-from-stable-to-stable,C-bug

```rs
fn main() {
    let x = Delegate(|_: &String| ());
    dbg!(x);
}

pub struct Delegate<T>(fn(Data: &T));

use std::fmt;

impl<T> fmt::Debug for Delegate<T> {
    fn fmt<'a>(&'a self, f: &mut fmt::Formatter<'_>) -> std::fmt::Result {
        f.debug_tuple("Delegate")
            .field(&self.0 as &fn(&'a T))
            .finish()
    }
}
```
```
   Compiling playground v0.0.1 (/playground)
error: linking with `cc` failed: exit status: 1
  |
  = note: "cc" "-m64" "/playground/target/debug/deps/playground-4c173013dcdff931.playground.8c85a93c-cgu.0.rcgu.o" "/playground/target/debug/deps/playground-4c173013dcdff931.12vh8z6qs538xs91.rcgu.o" "-Wl,--as-needed" "-L" "/playground/target/debug/deps" "-L" "/playground/target/debug/build/libsqlite3-sys-0d351e27eaa1e97b/out" "-L" "/playground/target/debug/build/ring-38bf9793e960dc3f/out" "-L" "/playground/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-Wl,--start-group" "-Wl,-Bstatic" "/playground/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-d31eae41cd792517.rlib" "/playground/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libpanic_unwind-4695c0f6311791db.rlib" "/playground/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libminiz_oxide-1a282f8b292d9e3f.rlib" "/playground/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libadler-a54ae5159230894d.rlib" "/playground/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libobject-df56b38eda5fdb84.rlib" "/playground/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libmemchr-7509adad918d4b3b.rlib" "/playground/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libaddr2line-66d0be1f7efaf5ca.rlib" "/playground/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libgimli-41443b46a1557b2c.rlib" "/playground/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd_detect-60812e99072283ff.rlib" "/playground/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_demangle-412d545269c27063.rlib" "/playground/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libhashbrown-0dbc7e011696d844.rlib" "/playground/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_alloc-78b2343cc72ff57a.rlib" "/playground/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libunwind-65fa19680bfb5ee4.rlib" "/playground/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcfg_if-72cab8079f9b3b1e.rlib" "/playground/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-32d13a5363efe47b.rlib" "/playground/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-9ee1d5d15e6abbeb.rlib" "/playground/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_core-52d5241975807511.rlib" "/playground/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-9924c22ae1efcf66.rlib" "-Wl,--end-group" "/playground/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-96219fb718f2f3e8.rlib" "-Wl,-Bdynamic" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-Wl,--eh-frame-hdr" "-Wl,-znoexecstack" "-L" "/playground/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-o" "/playground/target/debug/deps/playground-4c173013dcdff931" "-Wl,--gc-sections" "-pie" "-Wl,-zrelro" "-Wl,-znow" "-nodefaultlibs"
  = note: /usr/bin/ld: /playground/target/debug/deps/playground-4c173013dcdff931.playground.8c85a93c-cgu.0.rcgu.o:(.data.rel.ro..L__unnamed_2+0x0): undefined reference to `core::ptr::drop_in_place<fn(&alloc::string::String)>'
          /usr/bin/ld: /playground/target/debug/deps/playground-4c173013dcdff931: hidden symbol `_ZN4core3ptr56drop_in_place$LT$fn$LP$$RF$alloc..string..String$RP$$GT$17hd611700673430a9aE' isn't defined
          /usr/bin/ld: final link failed: bad value
          collect2: error: ld returned 1 exit status
          
  = help: some `extern` functions couldn't be found; some native libraries may need to be installed or have their path specified
  = note: use the `-l` flag to specify native libraries to link
  = note: use the `cargo:rustc-link-lib` directive to specify the native libraries to link with Cargo (see https://doc.rust-lang.org/cargo/reference/build-scripts.html#cargorustc-link-libkindname)

error: could not compile `playground` due to previous error
```
([playground](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=0049d1f58c011203eaf87a602ee71e33))

@rustbot label T-compiler

<hr>

*Edit:* In case that isn’t clear: I’m expecting the code to compile. The context is [this thread on URLO](https://users.rust-lang.org/t/impl-of-debug-is-not-general-enough-error/64284).