Description
This is a tracking issue for improving the test coverage of feature(min_const_generics)
.
We collected a collection of interesting test cases in a hackmd and
now have to design these tests and add them to the test suite.
Topics
For more info about these topics you can also look at the above hackmd which elaborates a bit more for some of them
-
rustdoc
One interested fairly self-contained topic is probably rustdoc. We pretty much want tests for values 7, params N, associated consts fn test() -> [u8; Type::ASSOC] and more complex expressions (ConstKind::Unevaluated) 3 + 4 in different positions, like ret + arg impl trait, async fn ret + impl position, type alias, and defined inside of macros. Probably also nice to test reexports and usage of associated consts defined in a different crate. Consider also adding one test for a constant which contains a lot of weird stuff, like struct definitions and so on to see how that looks -
default values for const parameters should error (claimed by @ethanboxx)
I think this only needs one test which tries to use something like const N: usize = 23 and const N = 27: usize to check that the error is at least somewhat readable -
ordering of const parameters (only after types)
@JulianKnodt already added quite a few tests for that, so this is probably already good enough. At least I can't think of anything missing here -
supertraits + dyn type upcasting with supertraits (claimed by @hameerabbasi, added in Add const generics tests for supertraits + dyn traits. #78478)
This requires some knowledge about how all of this should work but is probably quite interesting to think about. -
trait methods trait Foo { fn bar() }
I think that's already fairly well tested thanks to the interaction with type dependent paths, at least I can't think of anything specific we are still missing here -
associated type bounds
hopefully one run-pass and one or two compile fail tests are enough here -
invalid bool and char bit-pattern (claimed by @JulianKnodt)
A test which tries to for example use 7 as a bool and 0xFF as a char -
macros (claimed by @JulianKnodt, added in Add macro test for min-const-generics #78912)
hopefully fairly self-contained, try defining a #[macro_export] macro inside of a const (which can be inside of async fn or impl trait or a repeat expression)
I think these are the more self-contained topics, for everything else it's probably easiest for someone - I expect and want this to be me - to just spend a few hours mixing stuff until it either breaks or there is a high confidence that it does not break.