-
Notifications
You must be signed in to change notification settings - Fork 12.3k
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
Rollup of 7 pull requests #92934
Rollup of 7 pull requests #92934
Commits on Jan 7, 2022
-
Configuration menu - View commit details
-
Copy full SHA for 8bdf5c3 - Browse repository at this point
Copy the full SHA 8bdf5c3View commit details -
Change panic::update_hook to simplify usage
And to remove possibility of panics while changing the panic handler, because that resulted in a double panic.
Configuration menu - View commit details
-
Copy full SHA for 8ef3ce8 - Browse repository at this point
Copy the full SHA 8ef3ce8View commit details -
Configuration menu - View commit details
-
Copy full SHA for 0c58586 - Browse repository at this point
Copy the full SHA 0c58586View commit details
Commits on Jan 9, 2022
-
feat: pass_by_value lint attribute
Useful for thin wrapper attributes that are best passed as value instead of reference.
Configuration menu - View commit details
-
Copy full SHA for 4c3e330 - Browse repository at this point
Copy the full SHA 4c3e330View commit details
Commits on Jan 10, 2022
-
Configuration menu - View commit details
-
Copy full SHA for 91ed689 - Browse repository at this point
Copy the full SHA 91ed689View commit details -
Configuration menu - View commit details
-
Copy full SHA for 71e3314 - Browse repository at this point
Copy the full SHA 71e3314View commit details
Commits on Jan 11, 2022
-
rustc_pass_by_value: allow types with no parameters on self
includes minor refactorings
Configuration menu - View commit details
-
Copy full SHA for a6762e9 - Browse repository at this point
Copy the full SHA a6762e9View commit details -
Configuration menu - View commit details
-
Copy full SHA for 959bf2b - Browse repository at this point
Copy the full SHA 959bf2bView commit details -
Configuration menu - View commit details
-
Copy full SHA for 2728af7 - Browse repository at this point
Copy the full SHA 2728af7View commit details
Commits on Jan 12, 2022
-
Configuration menu - View commit details
-
Copy full SHA for c84f2b2 - Browse repository at this point
Copy the full SHA c84f2b2View commit details -
Configuration menu - View commit details
-
Copy full SHA for 9625829 - Browse repository at this point
Copy the full SHA 9625829View commit details
Commits on Jan 13, 2022
-
Configuration menu - View commit details
-
Copy full SHA for 51d7665 - Browse repository at this point
Copy the full SHA 51d7665View commit details -
Configuration menu - View commit details
-
Copy full SHA for 9ff8ae0 - Browse repository at this point
Copy the full SHA 9ff8ae0View commit details -
Configuration menu - View commit details
-
Copy full SHA for ae20500 - Browse repository at this point
Copy the full SHA ae20500View commit details
Commits on Jan 15, 2022
-
Configuration menu - View commit details
-
Copy full SHA for 35c6efc - Browse repository at this point
Copy the full SHA 35c6efcView commit details -
Configuration menu - View commit details
-
Copy full SHA for 94521b7 - Browse repository at this point
Copy the full SHA 94521b7View commit details -
Rollup merge of rust-lang#92598 - Badel2:panic-update-hook, r=yaahc
Implement `panic::update_hook` Add a new function `panic::update_hook` to allow creating panic hooks that forward the call to the previously set panic hook, without race conditions. It works by taking a closure that transforms the old panic hook into a new one, while ensuring that during the execution of the closure no other thread can modify the panic hook. This is a small function so I hope it can be discussed here without a formal RFC, however if you prefer I can write one. Consider the following example: ```rust let prev = panic::take_hook(); panic::set_hook(Box::new(move |info| { println!("panic handler A"); prev(info); })); ``` This is a common pattern in libraries that need to do something in case of panic: log panic to a file, record code coverage, send panic message to a monitoring service, print custom message with link to github to open a new issue, etc. However it is impossible to avoid race conditions with the current API, because two threads can execute in this order: * Thread A calls `panic::take_hook()` * Thread B calls `panic::take_hook()` * Thread A calls `panic::set_hook()` * Thread B calls `panic::set_hook()` And the result is that the original panic hook has been lost, as well as the panic hook set by thread A. The resulting panic hook will be the one set by thread B, which forwards to the default panic hook. This is not considered a big issue because the panic handler setup is usually run during initialization code, probably before spawning any other threads. Using the new `panic::update_hook` function, this race condition is impossible, and the result will be either `A, B, original` or `B, A, original`. ```rust panic::update_hook(|prev| { Box::new(move |info| { println!("panic handler A"); prev(info); }) }); ``` I found one real world use case here: https://github.com/dtolnay/proc-macro2/blob/988cf403e741aadfd5340bbf67e35e1062a526aa/src/detection.rs#L32 the workaround is to detect the race condition and panic in that case. The pattern of `take_hook` + `set_hook` is very common, you can see some examples in this pull request, so I think it's natural to have a function that combines them both. Also using `update_hook` instead of `take_hook` + `set_hook` reduces the number of calls to `HOOK_LOCK.write()` from 2 to 1, but I don't expect this to make any difference in performance. ### Unresolved questions: * `panic::update_hook` takes a closure, if that closure panics the error message is "panicked while processing panic" which is not nice. This is a consequence of holding the `HOOK_LOCK` while executing the closure. Could be avoided using `catch_unwind`? * Reimplement `panic::set_hook` as `panic::update_hook(|_prev| hook)`?
Configuration menu - View commit details
-
Copy full SHA for 7352ed2 - Browse repository at this point
Copy the full SHA 7352ed2View commit details -
Rollup merge of rust-lang#92646 - mdibaiee:76935/pass-by-value, r=lcnr
feat: rustc_pass_by_value lint attribute Useful for thin wrapper attributes that are best passed as value instead of reference. Fixes rust-lang#76935
Configuration menu - View commit details
-
Copy full SHA for 7f7d541 - Browse repository at this point
Copy the full SHA 7f7d541View commit details -
Rollup merge of rust-lang#92792 - mdibaiee:92662/fix-intra-doc-generi…
…cs, r=camelid rustdoc: fix intra-link for generic trait impls fixes rust-lang#92662 r? ````@camelid````
Configuration menu - View commit details
-
Copy full SHA for 91aaee4 - Browse repository at this point
Copy the full SHA 91aaee4View commit details -
Rollup merge of rust-lang#92799 - rust-lang:followup-from-92533, r=Aa…
…ron1011 Remove some unnecessary uses of `FieldDef::ident` Followup from rust-lang#92533. cc ````@Aaron1011```` ````@petrochenkov````
Configuration menu - View commit details
-
Copy full SHA for dffb07a - Browse repository at this point
Copy the full SHA dffb07aView commit details -
Rollup merge of rust-lang#92814 - lcnr:unused-fixme, r=Mark-Simulacrum
remove unused FIXME rust-lang#56935 seems to be fixed.
Configuration menu - View commit details
-
Copy full SHA for 2f06a9e - Browse repository at this point
Copy the full SHA 2f06a9eView commit details -
Rollup merge of rust-lang#92819 - euclio:atty, r=CraftSpider
rustdoc: remove hand-rolled isatty This PR replaces bindings to the platform-specific isatty APIs with the `isatty` crate, as done elsewhere in the repository.
Configuration menu - View commit details
-
Copy full SHA for 47df44d - Browse repository at this point
Copy the full SHA 47df44dView commit details -
Rollup merge of rust-lang#92920 - dtolnay:printtidy, r=cjgillot
Move expr- and item-related pretty printing functions to modules Currently *compiler/rustc_ast_pretty/src/pprust/state.rs* is 2976 lines on master. The `tidy` limit is 3000, which is blocking rust-lang#92243. This PR adds a `mod expr;` and `mod item;` to move logic related to those AST nodes out of the single huge file.
Configuration menu - View commit details
-
Copy full SHA for b289c7c - Browse repository at this point
Copy the full SHA b289c7cView commit details