Move /src/test to /tests
This commit is contained in:
parent
ca855e6e42
commit
cf2dff2b1e
27592 changed files with 0 additions and 0 deletions
37
tests/ui/polymorphization/const_parameters/functions.rs
Normal file
37
tests/ui/polymorphization/const_parameters/functions.rs
Normal file
|
@ -0,0 +1,37 @@
|
|||
// build-fail
|
||||
// compile-flags:-Zpolymorphize=on
|
||||
#![feature(generic_const_exprs, rustc_attrs)]
|
||||
//~^ WARN the feature `generic_const_exprs` is incomplete
|
||||
|
||||
// This test checks that the polymorphization analysis correctly detects unused const
|
||||
// parameters in functions.
|
||||
|
||||
// Function doesn't have any generic parameters to be unused.
|
||||
#[rustc_polymorphize_error]
|
||||
pub fn no_parameters() {}
|
||||
|
||||
// Function has an unused generic parameter.
|
||||
#[rustc_polymorphize_error]
|
||||
pub fn unused<const T: usize>() {
|
||||
//~^ ERROR item has unused generic parameters
|
||||
}
|
||||
|
||||
// Function uses generic parameter in value of a binding.
|
||||
#[rustc_polymorphize_error]
|
||||
pub fn used_binding<const T: usize>() -> usize {
|
||||
let x: usize = T;
|
||||
x
|
||||
}
|
||||
|
||||
// Function uses generic parameter in substitutions to another function.
|
||||
#[rustc_polymorphize_error]
|
||||
pub fn used_substs<const T: usize>() {
|
||||
unused::<T>()
|
||||
}
|
||||
|
||||
fn main() {
|
||||
no_parameters();
|
||||
unused::<1>();
|
||||
used_binding::<1>();
|
||||
used_substs::<1>();
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue