Skip to content

#[no_mangle] warns for lifetime parameters #40342

Closed
@bluss

Description

@bluss

Lifetime parameters should not be a problem for name mangling.

Besides, it's not even consistently warning for lifetimes, only explicit lifetime parameters.

#![crate_type="lib"]

#[no_mangle]
pub fn foo(x: &i32) -> &i32 { x }

#[no_mangle]
pub fn bar<'a>(x: &'a i32) -> &i32 { x }

Actual Output (Note: only 1 warning)

rustc 1.17.0-nightly (b1e31766d 2017-03-03)
warning: generic functions must be mangled
 --> <anon>:7:1
  |
7 | pub fn bar<'a>(x: &'a i32) -> &i32 { x }
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: #[warn(no_mangle_generic_items)] on by default

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-FFIArea: Foreign function interface (FFI)A-diagnosticsArea: Messages for errors, warnings, and lintsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions