-
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
Simplify output capturing #78714
Simplify output capturing #78714
Conversation
r? @KodrAus (rust_highfive has picked a reviewer for you, use r? to override) |
I think these are two unstable APIs that are actually relied upon out in the wild. We have reserved the right to tinker with them, but I'd be interested to see how widely they're actually used! I'll kick off a crater run to see what impact this has. @craterbot check |
🚨 Error: missing start toolchain 🆘 If you have any trouble with Crater please ping |
@bors try |
⌛ Trying commit b85533df13416e98e40f4ce7ac3661b72f24f109 with merge 3e22d1f9053c0fc87629b3c6d5d9567856368e5d... |
Those APIs were already broken recently by #75172 / #78227. Those didn't get a crater run, though. Searching for (These functions aren't just unstable, they are |
☀️ Try build successful - checks-actions |
Starting crater with @craterbot check start=beta |
🚨 Error: missing end toolchain 🆘 If you have any trouble with Crater please ping |
@craterbot check start=beta end=try#3e22d1f9053c0fc87629b3c6d5d9567856368e5d |
👌 Experiment ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more |
It was only ever used with Vec<u8> anyway. This simplifies some things. - It no longer needs to be flushed, because that's a no-op anyway for a Vec<u8>. - Writing to a Vec<u8> never fails. - No #[cfg(test)] code is needed anymore to use `realstd` instead of `std`, because Vec comes from alloc, not std (like Write).
There were no use cases for setting them separately. Merging them simplifies some things.
b85533d
to
aff7bd6
Compare
🚧 Experiment ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more |
🎉 Experiment
|
That crater run resulted in quite a few irrelevant failures, because it compaired against beta. These are the only four that had errors in their logs about missing
|
FWIW we have access to by-commit artifacts so you can get a smaller commit range, but ultimately it probably wouldn't help too much. If we want a better run I would probably revert the breakage in a pr, try commit that, then compare against that in crater. Let me know if you need more help here. |
In this case I knew what the error would be, so it was as simple as just downloading the build-fail tar.gz from crater and grepping for |
That's a lot fewer than I was expecting! Thanks for looking into this @m-ou-se |
Ok, this looks good to me. I was worried about churning an unstable hack that I thought was pretty widely relied on, but it turns out I was wrong! @bors r+ |
📌 Commit aff7bd6 has been approved by |
Rollup of 11 pull requests Successful merges: - rust-lang#74989 (Implement `Index` and `IndexMut` for arrays) - rust-lang#76339 (Test structural matching for all range types) - rust-lang#77691 (Rename/Deprecate LayoutErr in favor of LayoutError) - rust-lang#78364 (Update RELEASES.md for 1.48.0) - rust-lang#78678 (Add tests and improve rendering of cfgs on traits) - rust-lang#78714 (Simplify output capturing) - rust-lang#78769 (Remove unneeded lifetimes in array/mod.rs) - rust-lang#78903 (BTreeMap: test chaotic ordering & other bits & bobs) - rust-lang#79032 (improve type const mismatch errors) - rust-lang#79061 (Make all rustdoc functions and structs crate-private) - rust-lang#79087 (Update E0744 about control flow in `const` contexts to accurately describe when the error is triggered and why) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
This is a sequence of incremental improvements to the unstable/internal
set_panic
andset_print
mechanism used by thetest
crate:Remove the
LocalOutput
trait and useArc<Mutex<dyn Write>>
instead ofBox<dyn LocalOutput>
. In practice, all implementations ofLocalOutput
were justArc<Mutex<..>>
. This simplifies some logic and removes all customSink
implementations such aslibrary/test/src/helpers/sink.rs
. Also removes a layer of indirection, as the outermostBox
is now gone. It also means that locking now happens perwrite_fmt
, not per individualwrite
within. (So"{} {}\n"
now results in onelock()
, not four or more.)Since in all cases the
dyn Write
s were justVec<u8>
s, replace the type withArc<Mutex<Vec<u8>>>
. This simplifies things more, as error handling and flushing can be removed now. This also removes the hack needed in the default panic handler to make this work with::realstd
, as (unlikeWrite
)Vec<u8>
is fromalloc
, notstd
.Replace the
RefCell
s by regularCell
s. TheRefCell
s were mostly used asmem::replace(&mut *cell.borrow_mut(), something)
, which is justCell::replace
. This removes an unecessary bookkeeping and makes the code a bit easier to read.Merge
set_panic
andset_print
into a singleset_output_capture
. Neither the test crate nor rustc (the only users of this feature) have a use for using these separately. Merging them simplifies things even more. This uses a new function name and feature name, to make it clearer this is internal and not supposed to be used by other crates.Might be easier to review per commit.