Auto merge of #42282 - Mark-Simulacrum:issue-40342, r=arielb1
Don't warn on lifetime generic no_mangle functions. Fixes #40342.
This commit is contained in:
commit
77d096a2bb
@ -1075,10 +1075,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…
x
Reference in New Issue
Block a user