-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Fix for #31267 and additional zero-width constant bug #31291
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @nikomatsakis (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. |
See this for liblibc thing. |
@nagisa Thanks! A variation on that did the trick. |
Consider adding an rpass test containing the code from #31267 and squashing this down to one commit. |
Use .as_slices() for a more efficient code path in VecDeque's Hash impl. This still hashes the elements in the same order. Before/after timing of VecDeque hashing 1024 elements of u8 and u64 shows that the vecdeque now can match the Vec (test_hashing_vec_of_u64 is the Vec run). before test test_hashing_u64 ... bench: 14,031 ns/iter (+/- 236) = 583 MB/s test test_hashing_u8 ... bench: 7,887 ns/iter (+/- 65) = 129 MB/s test test_hashing_vec_of_u64 ... bench: 6,578 ns/iter (+/- 76) = 1245 MB/s after running 5 tests test test_hashing_u64 ... bench: 6,495 ns/iter (+/- 52) = 1261 MB/s test test_hashing_u8 ... bench: 851 ns/iter (+/- 16) = 1203 MB/s test test_hashing_vec_of_u64 ... bench: 6,499 ns/iter (+/- 59) = 1260 MB/s
I recently wrote a blog post on contributing to the Rust compiler which gained some interest. It was mentioned in a comment on Reddit that it would be useful to integrate some of the information from that post to the official contributing guide. This is the start of my efforts to integrate what I wrote with the official guide. This commit adds information on the build system. It is not a complete guide on the build system, but it should be enough to provide a good starting place for those wishing to contribute.
- Tweaked the build system intro paragraph - Added some more configure options & explanations - Added additional make target
The missing_docs lint only applies to public items in public modules, so this example code did not actually generate any warnings or errors.
Also a minor language tweak to the documentation of the `ffi::CString::from_raw` function.
This allows to render multiple spans on one line, or to splice multiple replacements into a code suggestion.
The purpose of the translation item collector is to find all monomorphic instances of functions, methods and statics that need to be translated into LLVM IR in order to compile the current crate. So far these instances have been discovered lazily during the trans path. For incremental compilation we want to know the set of these instances in advance, and that is what the trans::collect module provides. In the future, incremental and regular translation will be driven by the collector implemented here.
…erminate import (i.e. one that is not resolved and not known to have failed)
Unfortunately older clang compilers don't support this argument, so the bootstrap will fail. We don't actually really need to optimized the C code we compile, however, as currently we're just compiling jemalloc and not much else.
If the tests were run with `RUST_BACKTRACE=1 make check` this test failed. If they were run without it it succeeded. We need to use `env_remove` instead of `env_clear` because the latter will never work on windows
Block comments don't have to be in the format `/*! ... !*/` in order to be read as doc comments about the parent block. The format `/*! ... */` is enough.
Looks like the rumprun build has bitrotted over time, so this includes some libc fixes and some various libstd fixes which gets it back to bootstrapping.
Looks like the way to create these executables is to use the standard `powerpc-linux-gnu-gcc` compiler but with the `-m64` option.
Rustdoc could trigger a code path that relied on the $CFG_COMPILER_HOST_TRIPLE environment variable being set, causing an ICE if it was not. This fixes that, emitting an error instead of crashing.
Take care of zero-width constants. Needs a workover. Added quick fix to prevent zero-width constant expressions from being translated. Adjust comment. Revert accidental change to liblibc. This reverts commit a66892b. Fix for #31267 - associated const related ICE. Take care of zero-width constants. Needs a workover. Added quick fix to prevent zero-width constant expressions from being translated. Adjust comment. Revert "Merge fix for accidental file modification." This reverts commit 7a8f715, reversing changes made to c3e7788.
Well, I think I really bunged this one up, I'm going to close this PR and try again. Still adjusting to git. |
There's no need to make a new PR; you can fix the commit history with |
@tamird I tried that and it resulted in the mess you can see above :P I'm going to start over with a clean slate. Things started to get really messed up on local and my fork. I'm sure it would have been possible to fix, but it was quicker to just make a new fork at this point. |
Fixes #31267 - with this change, the code mentioned in the issue compiles.
Found and fixed another issue as well - constants of zero-size types, when used in ExprRepeats inside associated constants, were causing the compiler to crash at the same place as #31267. An example of this:
However, I'm fairly certain that my fix for this is not as elegant as it could be. The problem seems to occur only with an associated constant of a tuple struct containing a fixed size array which is initialized using a repeat expression, and when the element to be repeated provided to the repeat expression is another constant which is of a zero-sized type. The fix works by looking for constants and associated constants which are zero-width and consequently contain no data, but for which rustc is still attempting to emit an LLVM value; it simply stops rustc from attempting to emit anything. By my logic, this should work fine since the only values that are emitted in this case (according to the comments) are for closures with side effects, and constants will never have side effects, so it's fine to simply get rid of them. It fixes the error and things compile fine with it, but I have a sneaking suspicion that it could be done in a far better manner.