rust icon indicating copy to clipboard operation
rust copied to clipboard

Remove cfg(test) from library/core

Open saethlin opened this issue 5 months ago • 9 comments

The diff here is very small with the ignore whitespace option.

core doesn't/can't have unit tests. All of its tests are just modules under tests/, so it has no use for cfg(test), because the entire contents of library/core/src are only ever compiled with that cfg off, and the entire contents of library/core/tests are only ever compiled with that cfg on.

You can tell this is what's happening because we had #[cfg(test)] on a module declaration that has no source file.

I also deleted the extra mod tests { layer of nesting; there's no need to mention again in the module path that this is a module of tests. This exposes a name collision between the u128 module of tests and core::u128. Fixed that by using <u128>::MAX like is done in the check! macro, which is what avoids this name ambiguity for the other types.

saethlin avatar Aug 25 '24 21:08 saethlin