Export #[inline] fns with extern indicators#73034
Export #[inline] fns with extern indicators#73034bors merged 7 commits intorust-lang:masterfrom cofibrant:nomangle-inline-linkage
#[inline] fns with extern indicators#73034Conversation
|
(rust_highfive has picked a reviewer for you, use r? to override) |
src/librustc_typeck/collect.rs
Outdated
There was a problem hiding this comment.
There is also #[export_name = "..."] and #[linkage = "..."] to consider so this should really be calling contains_extern_indicator.
There was a problem hiding this comment.
I wasn't aware of contains_extern_indicator, thank you so much for the suggestion!
src/librustc_typeck/collect.rs
Outdated
There was a problem hiding this comment.
Do we need to check the crate type here? Even when building rlibs we'll still need to codegen and export #[no_mangle] #[inline] items in case they're linked into a staticlib or cdylib.
There was a problem hiding this comment.
Just to check I understand between these two you're saying that #[inline] should always be superseded by an extern indicator and crate-type/specifics of indicator are irrelevant?
There was a problem hiding this comment.
Yes, this should be done regardless of the output crate type.
#[inline] #[no_mangle] fns in cdylibs and staticlibs#[inline] fns with extern indicators
|
@bors r+ |
|
📌 Commit f57893b has been approved by |
…matthewjasper Export `#[inline]` fns with extern indicators In ancient history (rust-lang#36280) we stopped `#[inline]` fns being codegened if they weren't used. However, - rust-lang#72944 - rust-lang#72463 observe that when writing something like ```rust #![crate_type = "cdylib"] #[no_mangle] #[inline] pub extern "C" fn foo() { // ... } ``` we really _do_ want `foo` to be codegened. This change makes this the case. Resolves rust-lang#72944, resolves rust-lang#72463 (and maybe some more)
|
@bors r- Failed in #73240 (comment): The function |
|
failed in rollup log @bors r- |
I can't reproduce this locally, is this an architecture specific failure? |
|
@mati865 that'll do it 😅 Thanks! |
|
So looking into this, |
|
|
|
@bors r+ |
|
📌 Commit e8e0a0e has been approved by |
…matthewjasper Export `#[inline]` fns with extern indicators In ancient history (rust-lang#36280) we stopped `#[inline]` fns being codegened if they weren't used. However, - rust-lang#72944 - rust-lang#72463 observe that when writing something like ```rust #![crate_type = "cdylib"] #[no_mangle] #[inline] pub extern "C" fn foo() { // ... } ``` we really _do_ want `foo` to be codegened. This change makes this the case. Resolves rust-lang#72944, resolves rust-lang#72463 (and maybe some more)
…matthewjasper Export `#[inline]` fns with extern indicators In ancient history (rust-lang#36280) we stopped `#[inline]` fns being codegened if they weren't used. However, - rust-lang#72944 - rust-lang#72463 observe that when writing something like ```rust #![crate_type = "cdylib"] #[no_mangle] #[inline] pub extern "C" fn foo() { // ... } ``` we really _do_ want `foo` to be codegened. This change makes this the case. Resolves rust-lang#72944, resolves rust-lang#72463 (and maybe some more)
…arth Rollup of 17 pull requests Successful merges: - rust-lang#70551 (Make all uses of ty::Error delay a span bug) - rust-lang#71338 (Expand "recursive opaque type" diagnostic) - rust-lang#71976 (Improve diagnostics for `let x += 1`) - rust-lang#72279 (add raw_ref macros) - rust-lang#72628 (Add tests for 'impl Default for [T; N]') - rust-lang#72804 (Further tweak lifetime errors involving `dyn Trait` and `impl Trait` in return position) - rust-lang#72814 (remove visit_terminator_kind from MIR visitor) - rust-lang#72836 (Complete the std::time documentation to warn about the inconsistencies between OS) - rust-lang#72968 (Only highlight doc search results via mouseover if mouse has moved) - rust-lang#73034 (Export `#[inline]` fns with extern indicators) - rust-lang#73315 (Clean up some weird command strings) - rust-lang#73320 (Make new type param suggestion more targetted) - rust-lang#73361 (Tweak "non-primitive cast" error) - rust-lang#73425 (Mention functions pointers in the documentation) - rust-lang#73428 (Fix typo in librustc_ast docs) - rust-lang#73447 (Improve document for `Result::as_deref(_mut)` methods) - rust-lang#73476 (Added tooltip for should_panic code examples) Failed merges: r? @ghost
In ancient history (#36280) we stopped
#[inline]fns being codegened if they weren't used. However,#[inline]prevents symbol from appearing instaticliboutput #72463observe that when writing something like
we really do want
footo be codegened. This change makes this the case.Resolves #72944, resolves #72463 (and maybe some more)