2025-08-06 01:26:26 +02:00
|
|
|
// Ensure that we reject generic parameters on foreign items.
|
|
|
|
|
|
2020-09-01 17:12:52 -04:00
|
|
|
extern "C" {
|
2014-08-01 22:25:41 -06:00
|
|
|
fn foo<T>(); //~ ERROR foreign items may not have type parameters
|
2025-08-06 01:26:26 +02:00
|
|
|
|
|
|
|
|
// Furthermore, check that type parameter defaults lead to a *hard* error,
|
|
|
|
|
// not just a lint error, for maximum forward compatibility.
|
|
|
|
|
#[allow(invalid_type_param_default)] // Should have no effect here.
|
|
|
|
|
fn bar<T = ()>(); //~ ERROR foreign items may not have type parameters
|
|
|
|
|
//~^ ERROR defaults for generic parameters are not allowed here
|
2014-08-01 22:25:41 -06:00
|
|
|
}
|
2014-02-17 18:52:11 +13:00
|
|
|
|
|
|
|
|
fn main() {
|
2025-08-06 01:26:26 +02:00
|
|
|
unsafe { foo::<i32>() };
|
2014-02-17 18:52:11 +13:00
|
|
|
}
|