about summary refs log tree commit diff
AgeCommit message (Collapse)AuthorLines
2022-02-18Fix miniz_oxide types showing up in stdGuillaume Gomez-0/+4
2022-02-15Auto merge of #93176 - danielhenrymantilla:stack-pinning-macro, r=m-ou-sebors-1/+404
Add a stack-`pin!`-ning macro to `core::pin`. - https://github.com/rust-lang/rust/issues/93178 `pin!` allows pinning a value to the stack. Thanks to being implemented in the stdlib, which gives access to `macro` macros, and to the private `.pointer` field of the `Pin` wrapper, [it was recently discovered](https://rust-lang.zulipchat.com/#narrow/stream/187312-wg-async-foundations/topic/pin!.20.E2.80.94.20the.20.22definitive.22.20edition.20.28a.20rhs-compatible.20pin-nin.2E.2E.2E/near/268731241) ([archive link](https://zulip-archive.rust-lang.org/stream/187312-wg-async-foundations/topic/A.20rhs-compatible.20pin-ning.20macro.html#268731241)), contrary to popular belief, that it is actually possible to implement and feature such a macro: ```rust let foo: Pin<&mut PhantomPinned> = pin!(PhantomPinned); stuff(foo); ``` or, directly: ```rust stuff(pin!(PhantomPinned)); ``` - For context, historically, this used to require one of the two following syntaxes: - ```rust let foo = PhantomPinned; pin!(foo); stuff(foo); ``` - ```rust pin! { let foo = PhantomPinned; } stuff(foo); ``` This macro thus allows, for instance, doing things like: ```diff fn block_on<T>(fut: impl Future<Output = T>) -> T { // Pin the future so it can be polled. - let mut fut = Box::pin(fut); + let mut fut = pin!(fut); // Create a new context to be passed to the future. let t = thread::current(); let waker = Arc::new(ThreadWaker(t)).into(); let mut cx = Context::from_waker(&waker); // Run the future to completion. loop { match fut.as_mut().poll(&mut cx) { Poll::Ready(res) => return res, Poll::Pending => thread::park(), } } } ``` - _c.f._, https://doc.rust-lang.org/1.58.1/alloc/task/trait.Wake.html And so on, and so forth. I don't think such an API can get better than that, barring full featured language support (`&pin` references or something), so I see no reason not to start experimenting with featuring this in the stdlib already 🙂 - cc `@rust-lang/wg-async-foundations` \[EDIT: this doesn't seem to have pinged anybody 😩, thanks `@yoshuawuyts` for the real ping\] r? `@joshtriplett` ___ # Docs preview https://user-images.githubusercontent.com/9920355/150605731-1f45c2eb-c9b0-4ce3-b17f-2784fb75786e.mp4 ___ # Implementation The implementation ends up being dead simple (so much it's embarrassing): ```rust pub macro pin($value:expr $(,)?) { Pin { pointer: &mut { $value } } } ``` _and voilà_! - The key for it working lies in [the rules governing the scope of anonymous temporaries](https://doc.rust-lang.org/1.58.1/reference/destructors.html#temporary-lifetime-extension). <details><summary>Comments and context</summary> This is `Pin::new_unchecked(&mut { $value })`, so, for starters, let's review such a hypothetical macro (that any user-code could define): ```rust macro_rules! pin {( $value:expr ) => ( match &mut { $value } { at_value => unsafe { // Do not wrap `$value` in an `unsafe` block. $crate::pin::Pin::<&mut _>::new_unchecked(at_value) }} )} ``` Safety: - `type P = &mut _`. There are thus no pathological `Deref{,Mut}` impls that would break `Pin`'s invariants. - `{ $value }` is braced, making it a _block expression_, thus **moving** the given `$value`, and making it _become an **anonymous** temporary_. By virtue of being anonynomous, it can no longer be accessed, thus preventing any attemps to `mem::replace` it or `mem::forget` it, _etc._ This gives us a `pin!` definition that is sound, and which works, but only in certain scenarios: - If the `pin!(value)` expression is _directly_ fed to a function call: `let poll = pin!(fut).poll(cx);` - If the `pin!(value)` expression is part of a scrutinee: ```rust match pin!(fut) { pinned_fut => { pinned_fut.as_mut().poll(...); pinned_fut.as_mut().poll(...); }} // <- `fut` is dropped here. ``` Alas, it doesn't work for the more straight-forward use-case: `let` bindings. ```rust let pinned_fut = pin!(fut); // <- temporary value is freed at the end of this statement pinned_fut.poll(...) // error[E0716]: temporary value dropped while borrowed // note: consider using a `let` binding to create a longer lived value ``` - Issues such as this one are the ones motivating https://github.com/rust-lang/rfcs/pull/66 This makes such a macro incredibly unergonomic in practice, and the reason most macros out there had to take the path of being a statement/binding macro (_e.g._, `pin!(future);`) instead of featuring the more intuitive ergonomics of an expression macro. Luckily, there is a way to avoid the problem. Indeed, the problem stems from the fact that a temporary is dropped at the end of its enclosing statement when it is part of the parameters given to function call, which has precisely been the case with our `Pin::new_unchecked()`! For instance, ```rust let p = Pin::new_unchecked(&mut <temporary>); ``` becomes: ```rust let p = { let mut anon = <temporary>; &mut anon }; ``` However, when using a literal braced struct to construct the value, references to temporaries can then be taken. This makes Rust change the lifespan of such temporaries so that they are, instead, dropped _at the end of the enscoping block_. For instance, ```rust let p = Pin { pointer: &mut <temporary> }; ``` becomes: ```rust let mut anon = <temporary>; let p = Pin { pointer: &mut anon }; ``` which is *exactly* what we want. Finally, we don't hit problems _w.r.t._ the privacy of the `pointer` field, or the unqualified `Pin` name, thanks to `decl_macro`s being _fully_ hygienic (`def_site` hygiene). </details> ___ # TODO - [x] Add compile-fail tests with attempts to break the `Pin` invariants thanks to the macro (_e.g._, try to access the private `.pointer` field, or see what happens if such a pin is used outside its enscoping scope (borrow error)); - [ ] Follow-up stuff: - [ ] Try to experiment with adding `pin!` to the prelude: this may require to be handled with some extra care, as it may lead to issues reminiscent of those of `assert_matches!`: https://github.com/rust-lang/rust/issues/82913 - [x] Create the tracking issue.
2022-02-15Auto merge of #93918 - jonhoo:bootstrap-native-envflags, r=Mark-Simulacrumbors-31/+66
bootstrap: tidy up flag handling for llvm build This tidies up the logic in `src/bootstrap/native.rs` such that: - `CMAKE_*_LINKER_FLAGS` is not overridden if we add to it twice. - `CMAKE_*_FLAGS` also include the standard `*FLAGS` environment variables, which CMake respects when we _don't_ set `CMAKE_*_FLAGS`. - `llvm.ldflags` from `config.toml` appends to the ldflags Rust's bootstrap logic adds, rather than replacing them. It also takes a second stab at #89983 by moving `-static-libstdc++` to just be passed as a linker flag, since that's what it is. Fixes #93880. Fixes #70468. Closes #89983.
2022-02-15Auto merge of #93863 - pierwill:fix-93676, r=Mark-Simulacrumbors-41/+43
Update `sha1`, `sha2`, and `md-5` dependencies This replaces the deprecated [`cpuid-bool`](https://crates.io/crates/cpuid-bool) dependency with [`cpufeatures`](https://crates.io/crates/cpufeatures), while adding [`crypto-common`](https://crates.io/crates/crypto-common) as a new dependency. Closes #93676.
2022-02-15Auto merge of #93752 - eholk:drop-tracking-break-continue, r=nikomatsakisbors-10/+114
Generator drop tracking: improve break and continue handling This PR fixes two related issues. One, sometimes break or continue have a block target instead of an expression target. This seems to mainly happen with try blocks. Since the drop tracking analysis only works on expressions, if we see a block target for break or continue, we substitute the last expression of the block as the target instead. Two, break and continue were incorrectly being treated as the same, so continue would also show up as an exit from the loop or block. This patch corrects the way continue is handled by keeping a stack of loop entry points and uses those to find the target of the continue. Fixes #93197 r? `@nikomatsakis`
2022-02-14Update unsafe_pin_internals unstable version.Mara Bos-1/+1
2022-02-14Auto merge of #93652 - spastorino:fix-negative-overlap-check-regions, ↵bors-33/+134
r=nikomatsakis Fix negative overlap check regions r? `@nikomatsakis`
2022-02-14Add a comment to justify why the `pointer` field is `pub`.Daniel Henry-Mantilla-0/+5
Addresses https://github.com/rust-lang/rust/pull/93176/files#r795258110.
2022-02-14Mark `unsafe_pin_internals` as `incomplete`.Daniel Henry-Mantilla-0/+35
This thus still makes it technically possible to enable the feature, and thus to trigger UB without `unsafe`, but this is fine since incomplete features are known to be potentially unsound (labelled "may not be safe"). This follows from the discussion at https://github.com/rust-lang/rust/pull/93176#discussion_r799413561
2022-02-14Replace `def_site`-&-privacy implementation with a stability-based one.Daniel Henry-Mantilla-5/+6
Since `decl_macro`s and/or `Span::def_site()` is deemed quite unstable, no public-facing macro that relies on it can hope to be, itself, stabilized. We circumvent the issue by no longer relying on field privacy for safety and, instead, relying on an unstable feature-gate to act as the gate keeper for non users of the macro (thanks to `allow_internal_unstable`). This is technically not correct (since a `nightly` user could technically enable the feature and cause unsoundness with it); or, in other words, this makes the feature-gate used to gate the access to the field be (technically unsound, and in practice) `unsafe`. Hence it having `unsafe` in its name. Back to the macro, we go back to `macro_rules!` / `mixed_site()`-span rules thanks to declaring the `decl_macro` as `semitransparent`, which is a hack to basically have `pub macro_rules!` Co-Authored-By: Mara Bos <m-ou.se@m-ou.se>
2022-02-14Improve documentation.Daniel Henry-Mantilla-6/+5
Co-Authored-By: Mara Bos <m-ou.se@m-ou.se>
2022-02-14reveal_defining_opaque_types field doesn't exist after rebaseSantiago Pastorino-1/+0
2022-02-14Inline loose_check fn on call siteSantiago Pastorino-11/+1
2022-02-14Add comments about outlives_envSantiago Pastorino-0/+7
2022-02-14Add failing test that should passSantiago Pastorino-0/+23
2022-02-14Call the method fork instead of clone and add proper commentsSantiago Pastorino-3/+36
2022-02-14Update `macro:print` typed-query rustdoc test to include `pin!` resultsDaniel Henry-Mantilla-0/+2
2022-02-14Write {ui,} tests for `pin_macro` and `pin!`Daniel Henry-Mantilla-0/+119
2022-02-14Add a stack-`pin!`-ning macro to the `pin` module.Daniel Henry-Mantilla-0/+242
Add a type annotation to improve error messages with type mismatches Add a link to the temporary-lifetime-extension section of the reference
2022-02-14Properly check regions on negative overlap checkSantiago Pastorino-14/+59
2022-02-14Add debug calls for negative impls in coherenceSantiago Pastorino-4/+10
2022-02-14Move FIXME text to the right placeSantiago Pastorino-3/+3
2022-02-14Remove extra negative_impl_exists checkSantiago Pastorino-3/+1
2022-02-14Auto merge of #93298 - lcnr:issue-92113, r=cjgillotbors-153/+212
make `find_similar_impl_candidates` even fuzzier continues the good work of `@BGR360` in #92223. I might have overshot a bit and we're now slightly too fuzzy :sweat_smile: with this we can now also simplify `simplify_type`, which is nice :3
2022-02-14Auto merge of #93938 - BoxyUwU:fix_res_self_ty, r=lcnrbors-83/+102
Make `Res::SelfTy` a struct variant and update docs I found pattern matching on a `(Option<DefId>, Option<(DefId, bool)>)` to not be super readable, additionally the doc comments on the types in a tuple variant aren't visible anywhere at use sites as far as I can tell (using rust analyzer + vscode) The docs incorrectly assumed that the `DefId` in `Option<(DefId, bool)>` would only ever be for an impl item and I also found the code examples to be somewhat unclear about which `DefId` was being talked about. r? `@lcnr` since you reviewed the last PR changing these docs
2022-02-14update two rustdoc commentsEllen-3/+3
2022-02-14further update `fuzzy_match_tys`lcnr-66/+111
2022-02-14fast_reject: remove `StripReferences`lcnr-68/+20
2022-02-14fuzzify `fuzzy_match_tys`lcnr-120/+68
2022-02-14Make `find_similar_impl_candidates` a little fuzzier.Ben Reeves-33/+147
2022-02-14Auto merge of #93937 - bjorn3:simplifications3, r=cjgillotbors-26/+4
Remove Config::stderr 1. It captured stdout and not stderr 2. It isn't used anywhere 3. All error messages should go to the DiagnosticOutput instead 4. It modifies thread local state Marking as blocked as it will conflict a bit with https://github.com/rust-lang/rust/pull/93936.
2022-02-13Update `sha1`, `sha2`, and `md5` dependenciespierwill-41/+43
This removes the `cpuid-bool` dependency, which is deprecated, while adding `crypto-common` as a new dependency.
2022-02-13Auto merge of #83822 - petrochenkov:linkandro, r=davidtwcobors-7/+1
rustc_target: Remove compiler-rt linking hack on Android `compiler-rt` did some significant work last year trying to eliminate this kind of duplicated symbols, so the flag may be no longer necessary. Tested locally with AArch64 Android, seems to work, CI will check the rest of the targets.
2022-02-13Auto merge of #93837 - nikic:arm-update, r=Mark-Simulacrumbors-39/+0
Update dist-(arm|armv7|armhf)-linux to Ubuntu 20.04 I believe this should be safe, as actual artifacts will be produced by a cross toolchain. The build ran through cleanly locally. This came up in https://github.com/rust-lang/rust/pull/93577, where the host GCC ICEd during the LLD build. (Though I wonder why we build LLD for the host at all...) r? `@Mark-Simulacrum`
2022-02-13Auto merge of #93685 - Mark-Simulacrum:drop-time, r=Mark-Simulacrumbors-46/+16
Drop time dependency from bootstrap This was only used for the inclusion of 'current' dates into our manpages, but it is not clear that this is practically necessary. The manpage is essentially never updated, and so we can likely afford to keep a manual date in these files. It also seems possible to just omit it, but that may cause other tools trouble, so avoid doing that for now. This is largely done to reduce bootstrap complexity; the time crate is not particularly small and in #92480 would have started pulling in num-threads, which does runtime thread count detection. I would prefer to avoid that, so filing this to just drop the nearly unused dependency entirely. r? `@pietroalbini`
2022-02-13rustc_target: Remove compiler-rt linking hack on AndroidVadim Petrochenkov-7/+1
2022-02-13Auto merge of #91673 - ChrisDenton:path-absolute, r=Mark-Simulacrumbors-4/+209
`std::path::absolute` Implements #59117 by adding a `std::path::absolute` function that creates an absolute path without reading the filesystem. This is intended to be a drop-in replacement for [`std::fs::canonicalize`](https://doc.rust-lang.org/std/fs/fn.canonicalize.html) in cases where it isn't necessary to resolve symlinks. It can be used on paths that don't exist or where resolving symlinks is unwanted. It can also be used to avoid circumstances where `canonicalize` might otherwise fail. On Windows this is a wrapper around [`GetFullPathNameW`](https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-getfullpathnamew). On Unix it partially implements the POSIX [pathname resolution](https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap04.html#tag_04_13) specification, stopping just short of actually resolving symlinks.
2022-02-13Remove Config::stderrbjorn3-26/+4
1. It captured stdout and not stderr 2. It isn't used anywhere 3. All error messages should go to the DiagnosticOutput instead 4. It modifies thread local state
2022-02-13Auto merge of #93763 - jsha:re-space-empty-impls, r=GuillaumeGomezbors-3/+23
rustdoc: fix spacing of non-toggled impl blocks We [recently removed the "up here" arrows on item-infos](https://github.com/rust-lang/rust/pull/92651), and adjusted vertical spacing so that even without the arrow, it would be visually clear which item the item-info belonged to. The new CSS styles for vertical spacing only applied to toggles, though. This missed non-toggled impl blocks - for instance, those without any methods, like https://doc.rust-lang.org/nightly/std/marker/trait.Send.html#implementors. The result was lists of implementors that were spaced too closely. This PR fixes the spacing by making it apply to non-toggled impl blocks as well. This also fixes an issue where item-infos were displayed too far below their items. That was a result of display: table on .item-info .stab. Changed that to display: inline-block. Demo: https://rustdoc.crud.net/jsha/re-space-empty-impls/std/marker/trait.Send.html Before: <img width=300 src="https://user-images.githubusercontent.com/220205/152954394-ec0b80e7-2573-4f06-9d7a-7b10b8ceac60.png"> After: <img width=300 src="https://user-images.githubusercontent.com/220205/152954228-abac1d30-a76d-4ab1-89ec-ef7549fe8c9c.png"> r? `@GuillaumeGomez`
2022-02-13Auto merge of #93956 - matthiaskrgr:rollup-zfk35hb, r=matthiaskrgrbors-1131/+1551
Rollup of 9 pull requests Successful merges: - #89926 (make `Instant::{duration_since, elapsed, sub}` saturating and remove workarounds) - #90532 (More informative error message for E0015) - #93810 (Improve chalk integration) - #93851 (More practical examples for `Option::and_then` & `Result::and_then`) - #93885 (bootstrap.py: Suggest disabling download-ci-llvm option if url fails to download) - #93886 (Stabilise inherent_ascii_escape (FCP in #77174)) - #93930 (add link to format_args! when mention it in docs) - #93936 (Couple of driver cleanups) - #93944 (Don't relabel to a team if there is already a team label) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-02-13Rollup merge of #93944 - jackh726:team-exclude, r=Mark-SimulacrumMatthias Krüger-0/+6
Don't relabel to a team if there is already a team label Should prevent cases like #93628, where teams have been manually assigned, but changes are pushed. We give up adding new labels on *new* changes; but I feel like that is less frequent. r? `@Mark-Simulacrum`
2022-02-13Rollup merge of #93936 - bjorn3:simplifications2, r=cjgillotMatthias Krüger-199/+158
Couple of driver cleanups * Remove the `RustcDefaultCalls` struct, which hasn't been necessary since the introduction of `rustc_interface`. * Move the `setup_callbacks` call around for a tiny code deduplication. * Remove the `SPAN_DEBUG` global as it isn't actually necessary.
2022-02-13Rollup merge of #93930 - name1e5s:chore/docs, r=Mark-SimulacrumMatthias Krüger-2/+2
add link to format_args! when mention it in docs close #93904
2022-02-13Rollup merge of #93886 - clarfonthey:stable_ascii_escape, r=Mark-SimulacrumMatthias Krüger-16/+13
Stabilise inherent_ascii_escape (FCP in #77174) Implements #77174, which completed its FCP. This does *not* deprecate any existing methods or structs, as that is tracked in #93887. That stated, people should prefer using `u8::escape_ascii` to `std::ascii::escape_default`.
2022-02-13Rollup merge of #93885 - Badel2:error-download-ci-llvm, r=Mark-SimulacrumMatthias Krüger-8/+20
bootstrap.py: Suggest disabling download-ci-llvm option if url fails to download I got an error when trying to build the compiler using an old commit, and it turns out it was because the option `download-ci-llvm` was implicitly set to true. So this pull request tries to add a help message for other people that may run into the same problem. To reproduce my error: ``` git checkout 8d7707f3c4f72e6eb334d897354beca692b265d1 ./x.py test [...] spurious failure, trying again downloading https://ci-artifacts.rust-lang.org/rustc-builds/db002a06ae9154a35d410550bc5132df883d7baa/rust-dev-nightly-x86_64-unknown-linux-gnu.tar.xz curl: (22) The requested URL returned error: 404 failed to run: curl -# -y 30 -Y 10 --connect-timeout 30 --retry 3 -Sf -o /tmp/tmp8g13rb4n https://ci-artifacts.rust-lang.org/rustc-builds/db002a06ae9154a35d410550bc5132df883d7baa/rust-dev-nightly-x86_64-unknown-linux-gnu.tar.xz Build completed unsuccessfully in 0:00:46 ``` This is my `config.toml`: ``` # Includes one of the default files in src/bootstrap/defaults profile = "compiler" changelog-seen = 2 [rust] debug = true ``` To reproduce an error with this branch: Change line 618 of bootstrap.py to ``` url = "rustc-builds-error404/{}".format(llvm_sha) ``` Delete llvm and cached tarball, and set `llvm.download-ci-llvm=true` in config.toml. ``` ./x.py test [...] spurious failure, trying again downloading https://ci-artifacts.rust-lang.org/rustc-builds-error404/719b04ca99be0c78e09a8ec5e2eda082a5d8ccae/rust-dev-nightly-x86_64-unknown-linux-gnu.tar.xz curl: (22) The requested URL returned error: 404 failed to run: curl -# -y 30 -Y 10 --connect-timeout 30 --retry 3 -Sf -o /tmp/tmpesl1ydvo https://ci-artifacts.rust-lang.org/rustc-builds-error404/719b04ca99be0c78e09a8ec5e2eda082a5d8ccae/rust-dev-nightly-x86_64-unknown-linux-gnu.tar.xz error: failed to download llvm from ci help: old builds get deleted after a certain time help: if trying to compile an old commit of rustc, disable `download-ci-llvm` in config.toml: [llvm] download-ci-llvm = false Build completed unsuccessfully in 0:00:01 ``` Regarding the implementation, I expected to be able to use a try/catch block in `_download_ci_llvm`, but the `run` function calls `sys.exit` instead of raising an exception so that's not possible. Also, suggestions for better wording of the help message are welcome.
2022-02-13Rollup merge of #93851 - cyqsimon:option-examples, r=scottmcmMatthias Krüger-13/+37
More practical examples for `Option::and_then` & `Result::and_then` To be blatantly honest, I think the current example given for `Option::and_then` is objectively terrible. (No offence to whoever wrote them initially.) ```rust fn sq(x: u32) -> Option<u32> { Some(x * x) } fn nope(_: u32) -> Option<u32> { None } assert_eq!(Some(2).and_then(sq).and_then(sq), Some(16)); assert_eq!(Some(2).and_then(sq).and_then(nope), None); assert_eq!(Some(2).and_then(nope).and_then(sq), None); assert_eq!(None.and_then(sq).and_then(sq), None); ``` Current example: - does not demonstrate that `and_then` converts `Option<T>` to `Option<U>` - is far removed from any realistic code - generally just causes more confusion than it helps So I replaced them with two blocks: - the first one shows basic usage (including the type conversion) - the second one shows an example of typical usage Same thing with `Result::and_then`. Hopefully this helps with clarity.
2022-02-13Rollup merge of #93810 - matthewjasper:chalk-and-canonical-universes, r=jackh726Matthias Krüger-219/+362
Improve chalk integration - Support subtype bounds in chalk lowering - Handle universes in canonicalization - Handle type parameters in chalk responses - Use `chalk_ir::LifetimeData::Empty` for `ty::ReEmpty` - Remove `ignore-compare-mode-chalk` for tests that no longer hang (they may still fail or ICE) This is enough to get a hello world program to compile with `-Zchalk` now. Some of the remaining issues that are needed to get Chalk integration working on larger programs are: - rust-lang/chalk#234 - rust-lang/chalk#548 - rust-lang/chalk#734 - Generators are handled differently in chalk and rustc r? `@jackh726`
2022-02-13Rollup merge of #90532 - fee1-dead:improve-const-fn-err-msg, r=oli-obkMatthias Krüger-407/+896
More informative error message for E0015 Helps with #92380
2022-02-13Rollup merge of #89926 - the8472:saturate-instant, r=Mark-SimulacrumMatthias Krüger-267/+57
make `Instant::{duration_since, elapsed, sub}` saturating and remove workarounds This removes all mutex/atomic-based workarounds for non-monotonic clocks and makes the previously panicking methods saturating instead. Additionally `saturating_duration_since` becomes deprecated since `duration_since` now fills that role. Effectively this moves the fixup from `Instant` construction to the comparisons. This has some observable effects, especially on platforms without monotonic clocks: * Incorrectly ordered Instant comparisons no longer panic in release mode. This could hide some programming errors, but since debug mode still panics tests can still catch them. * `checked_duration_since` will now return `None` in more cases. Previously it only happened when one compared instants obtained in the wrong order or manually created ones. Now it also does on backslides. * non-monotonic intervals will not be transitive, i.e. `b.duration_since(a) + c.duration_since(b) != c.duration_since(a)` The upsides are reduced complexity and lower overhead of `Instant::now`. ## Motivation Currently we must choose between two poisons. One is high worst-case latency and jitter of `Instant::now()` due to explicit synchronization; see #83093 for benchmarks, the worst-case overhead is > 100x. The other is sporadic panics on specific, rare combinations of CPU/hypervisor/operating system due to platform bugs. Use-cases where low-overhead, fine-grained timestamps are needed - such as syscall tracing, performance profiles or sensor data acquisition (drone flight controllers were mentioned in a libs meeting) in multi-threaded programs - are negatively impacted by the synchronization. The panics are user-visible (program crashes), hard to reproduce and can be triggered by any dependency that might be using Instants for any reason. A solution that is fast _and_ doesn't panic is desirable. ---- closes #84448 closes #86470
2022-02-13Auto merge of #93713 - klensy:deps-up, r=Mark-Simulacrumbors-124/+63
Update deps cargo_metadata 0.12 -> 0.14, to dedupe and remove some `semver`, `semver-parser` versions pretty_assertions 0.6 -> 0.7, to drop some `ansi_term` version futures 0.1.29 -> 0.1.31, backported some [fixes](https://github.com/rust-lang/futures-rs/compare/0.1.29...0.1.31) to old versions futures-* 0.3.12 -> 0.3.19, to remove `proc-macro-hack`, `proc-macro-nested` and fix some [issues](https://github.com/rust-lang/futures-rs/blob/master/CHANGELOG.md#0319---2021-12-18). There exist 0.3.21, but it's quite new (06.02.22), so not updated to. itertools 0.9 -> 0.10 for rustdoc, will be droppped when rustfmt will bump `itertools` version linked-hash-map 0.5.3 -> 0.5.4, fix [UB](https://github.com/contain-rs/linked-hash-map/pull/106) markup5ever 0.10.0 -> 0.10.1, internally drops `serde`, reducing [build time](https://github.com/servo/html5ever/commit/3afd8d63853627e530b3063b0185eea3732cc29f#diff-4c20e8293515259c0aa26932413a55a334aa5f2b37de5a5adc92a2186f632606) for some usecases mio 0.7.13 -> 0.7.14 fix [unsoundness](https://github.com/tokio-rs/mio/compare/v0.7.13...v0.7.14) num_cpus 1.13.0 -> 1.13.1 fix parsing mountinfo and other [fixes](https://github.com/seanmonstar/num_cpus/compare/v1.13.0...v1.13.1) openssl-src 111.16.0+1.1.1l -> 111.17.0+1.1.1m fix CVE-2021-4160