-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Rolling up PRs in the queue #14234
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
Merged
Merged
Rolling up PRs in the queue #14234
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The current suite of benchmarks for the standard distribution take a significant amount of time to run, but it's unclear whether we're gaining any benefit from running them. Some specific pain points: * No one is looking at the data generated by the benchmarks. We have no graphs or analysis of what's happening, so all the data is largely being cast into the void. * No benchmark has ever uncovered a bug, they have always run successfully. * Benchmarks not only take a significant amount of time to run, but also take a significant amount of time to compile. I don't think we should mitigate this for now because it's useful to ensure that they do indeed still compile. This commit disables --bench test runs by default as part of `make check`, flipping the NO_BENCH environment variable to a PLEASE_BENCH variable which will manually enable benchmarking. If and when a dedicated bot is set up for benchmarking, this flag can be enabled on that bot.
After discussion with Alex, we think the proper policy is for dtors to not fail. This is consistent with C++. BufferedWriter already does this, so this patch modifies TempDir to not fail in the dtor, adding a `close` method for handling errors on destruction.
If a vector element fails in Drop, Vec needs to make sure it doesn't try to re-drop any elements it already dropped.
Previously, the `from_bits` function in the `std::bitflags::bitflags` macro was marked as unsafe, as it did not check that the bits being converted actually corresponded to flags. This patch changes the function to check against the full set of possible flags and return an `Option` which is `None` if a non-flag bit is set. It also adds a `from_bits_truncate` function which simply zeros any bits not corresponding to a flag. This addresses the concern raised in rust-lang#13897
pthread_yield is non-standard, while sched_yield is POSIX The Linux documentation recommends using the standard function. This is the only feature we're currently using that's present in glibc but not in musl.
The core library in theory has 0 dependencies, but in practice it has some in order for it to be efficient. These dependencies are in the form of the basic memory operations provided by libc traditionally, such as memset, memcmp, etc. These functions are trivial to implement and themselves have 0 dependencies. This commit adds a new crate, librlibc, which will serve the purpose of providing these dependencies. The crate is never linked to by default, but is available to be linked to by downstream consumers. Normally these functions are provided by the system libc, but in other freestanding contexts a libc may not be available. In these cases, librlibc will suffice for enabling execution with libcore. cc rust-lang#10116
Add `EntryPat` and `NodePat` variants to ast_map, so that lookups for id 1 in `let S{val: _x /* pat 2 */} /* pat 1 */ = ...` will actually resolve to the pattern `S{ ... }`, rather than "unknown node", in a function like `node_id_to_str`.
Refine lifetimes in signature for graph node/edge iteration methods. Added `pub` `node_id` and `edge_id` methods that correspond to NodeIndex and EdgeIndex `get` methods (note that the inner index is already `pub` in the struct definitions). (I decided that `get()`, used internally, just looks too generic and that client code is clearer with more explicit method names.)
1. Only insert non-dummy nodes into the exit map. 2. Revise handling of `break` and `continue` forms so that they are not treated as if control falls through to the next node (since it does not, it just jumps to the end or start of the loop body). 3. Fixed support for return expression in flow graph construction.
Passing `--pretty flowgraph=<NODEID>` makes rustc print a control flow graph. In pratice, you will also need to pass the additional option: `-o <FILE>` to emit output to a `.dot` file for graphviz. (You can only print the flow-graph for a particular block in the AST.) ---- An interesting implementation detail is the way the code puts both the node index (`cfg::CFGIndex`) and a reference to the payload (`cfg::CFGNode`) into the single `Node` type that is used for labelling and walking the graph. I had once mistakenly thought that I only wanted the `cfg::CFGNode`, but for labelling, you really want the cfg index too, rather than e.g. trying to use the `ast::NodeId` as the label (which breaks down e.g. due to `ast::DUMMY_NODE_ID`). ---- As a drive-by fix, I had to fix `rustc::middle::cfg::construct` interface to reflect changes that have happened on the master branch while I was getting this integrated into the compiler. (The next commit actually adds tests of the `--pretty flowgraph` functionality, so that should ensure that the `rustc::middle::cfg` code does not go stale again.)
Each test works by rendering the flowgraph for the last identified block we see in expanded pretty-printed output, and comparing it (via `diff`) against a checked in "foo.dot-expected.dot" file. Each test post-processes the output to remove NodeIds ` (id=NUM)` so that the expected output is somewhat stable (or at least independent of how we assign NodeIds) and easier for a human to interpret when looking at the expected output file itself. ---- Test writing style notes: I usually tried to write the tests in a way that would avoid duplicate labels in the output rendered flow graph, when possible. The tests that have string literals "unreachable" in the program text are deliberately written that way to remind the reader that the unreachable nodes in the resulting graph are not an error in the control flow computation, but rather a natural consequence of its construction.
Per discussion with @alexcrichton, this is a free function.
Closes rust-lang#14231 (mk: Don't run benchmarks with `make check`) Closes rust-lang#14215 (std: Modify TempDir to not fail on drop. Closes rust-lang#12628) Closes rust-lang#14211 (rustdoc: functions in ffi blocks are unsafe) Closes rust-lang#14210 (Make Vec.truncate() resilient against failure in Drop) Closes rust-lang#14208 (Make `from_bits` in `bitflags!` safe; add `from_bits_truncate`) Closes rust-lang#14206 (Register new snapshots) Closes rust-lang#14205 (use sched_yield on linux and freebsd) Closes rust-lang#14204 (Add a crate for missing stubs from libcore) Closes rust-lang#14203 (shootout-mandelbrot: Either 10-20% or 80-100% improvement.) Closes rust-lang#14202 (Add flow-graph visualization (via graphviz) to rustc) Closes rust-lang#14201 (Render not_found with an absolute path to the rust stylesheet) Closes rust-lang#14200 (std cleanup) Closes rust-lang#14189 (Implement cell::clone_ref)
lnicola
pushed a commit
to lnicola/rust
that referenced
this pull request
Mar 13, 2023
Don't drop rustc crates in the rustc workspace Turns out the rustc workspace has tools that rely on the external crates themselves so this check is faulty
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Let's try this again!