mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-28 09:44:08 +00:00
Don't warn on lifetime generic no_mangle functions.
This commit is contained in:
parent
5d2512ec5b
commit
6b84f7dd5e
@ -1114,10 +1114,10 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for InvalidNoMangleItems {
|
||||
it.name);
|
||||
cx.span_lint(PRIVATE_NO_MANGLE_FNS, it.span, &msg);
|
||||
}
|
||||
if generics.is_parameterized() {
|
||||
if generics.is_type_parameterized() {
|
||||
cx.span_lint(NO_MANGLE_GENERIC_ITEMS,
|
||||
it.span,
|
||||
"generic functions must be mangled");
|
||||
"functions generic over types must be mangled");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -11,9 +11,15 @@
|
||||
#![deny(no_mangle_generic_items)]
|
||||
|
||||
#[no_mangle]
|
||||
pub fn foo<T>() {} //~ ERROR generic functions must be mangled
|
||||
pub fn foo<T>() {} //~ ERROR functions generic over types must be mangled
|
||||
|
||||
#[no_mangle]
|
||||
pub extern fn bar<T>() {} //~ ERROR generic functions must be mangled
|
||||
pub extern fn bar<T>() {} //~ ERROR functions generic over types must be mangled
|
||||
|
||||
#[no_mangle]
|
||||
pub fn baz(x: &i32) -> &i32 { x }
|
||||
|
||||
#[no_mangle]
|
||||
pub fn qux<'a>(x: &'a i32) -> &i32 { x }
|
||||
|
||||
fn main() {}
|
||||
|
Loading…
Reference in New Issue
Block a user