-
Notifications
You must be signed in to change notification settings - Fork 12.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Const-eval array lengths in rustdoc. #46894
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @eddyb (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
@bors r+ |
📌 Commit d5b1119 has been approved by |
No tests? :'( |
@bors r- @GuillaumeGomez Can you help with the tests? I have no idea how rustdoc tests work. |
Creating a test at I have more problems with reproducing the problem in a test case. |
@detrumi Try |
@eddyb You mean this? pub trait Foo {}
pub struct Bar<T> { x: T }
impl<T> Foo for Bar<[T; 1 + 1 + 1]> {} That just produces Unless I'm mistaken, the problem only occurs because of the macro. However, this doesn't trigger it: pub trait Foo {}
pub struct Bar<T> { x: T }
macro_rules! impl_foo {
{$n:expr, $t:ident $($ts:ident)*} => {
impl<T> Foo for Bar<[T; $n]> {}
impl_foo!{($n - 1), $($ts)*}
};
{$n:expr,} => {
impl<T> Foo for Bar<[T; $n]> {}
};
}
impl_foo!{32, T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T} (adapted from the macro here) |
The macro shouldn't affect it at all. I guess it's because of cross-crate inlining, so maybe just |
You can set up auxiliary builds in rustdoc tests to test for this. Set up the impls in EDIT: Here's an example of a really simple auxiliary build, for the |
Re-exporting did the trick, without needing |
@bors r+ |
📌 Commit d10d389 has been approved by |
Const-eval array lengths in rustdoc. Fixes rust-lang#46727 r? @eddyb Big thanks to @eddyb for helping me figure this out.
☀️ Test successful - status-appveyor, status-travis |
Fixes #46727
r? @eddyb
Big thanks to @eddyb for helping me figure this out.