-
Notifications
You must be signed in to change notification settings - Fork 12.5k
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 16 pull requests #101114
Rollup of 16 pull requests #101114
Commits on Jul 13, 2022
-
Add a
File::create_new
constructorWe have `File::create` for creating a file or opening an existing file, but the secure way to guarantee creating a new file requires a longhand invocation via `OpenOptions`. Add `File::create_new` to handle this case, to make it easier for people to do secure file creation.
Configuration menu - View commit details
-
Copy full SHA for e540425 - Browse repository at this point
Copy the full SHA e540425View commit details
Commits on Aug 4, 2022
-
std::io: migrate ReadBuf to BorrowBuf/BorrowCursor
Signed-off-by: Nick Cameron <nrc@ncameron.org>
Configuration menu - View commit details
-
Copy full SHA for c1aae4d - Browse repository at this point
Copy the full SHA c1aae4dView commit details -
Signed-off-by: Nick Cameron <nrc@ncameron.org>
Configuration menu - View commit details
-
Copy full SHA for b56cf67 - Browse repository at this point
Copy the full SHA b56cf67View commit details
Commits on Aug 5, 2022
-
Configuration menu - View commit details
-
Copy full SHA for 1a2122f - Browse repository at this point
Copy the full SHA 1a2122fView commit details
Commits on Aug 9, 2022
-
Configuration menu - View commit details
-
Copy full SHA for c04568b - Browse repository at this point
Copy the full SHA c04568bView commit details
Commits on Aug 14, 2022
-
Start uplifting
clippy::for_loops_over_fallibles
I refactored the code: - Removed handling of methods, as it felt entirely unnecessary - Removed clippy utils (obviously...) - Used some shiny compiler features (let-else is very handy for lints 👀) - I also renamed the lint to `for_loop_over_fallibles` (note: no `s`). I'm not sure what's the naming convention here, so maybe I'm wrong.
Configuration menu - View commit details
-
Copy full SHA for 7b4cd17 - Browse repository at this point
Copy the full SHA 7b4cd17View commit details -
Configuration menu - View commit details
-
Copy full SHA for 810cf60 - Browse repository at this point
Copy the full SHA 810cf60View commit details -
Configuration menu - View commit details
-
Copy full SHA for b661157 - Browse repository at this point
Copy the full SHA b661157View commit details -
Configuration menu - View commit details
-
Copy full SHA for 7cf94ad - Browse repository at this point
Copy the full SHA 7cf94adView commit details -
Configuration menu - View commit details
-
Copy full SHA for 14b8f24 - Browse repository at this point
Copy the full SHA 14b8f24View commit details -
Configuration menu - View commit details
-
Copy full SHA for 2bf213b - Browse repository at this point
Copy the full SHA 2bf213bView commit details -
Configuration menu - View commit details
-
Copy full SHA for 5128140 - Browse repository at this point
Copy the full SHA 5128140View commit details -
for_loop_over_fallibles
: fix suggestion for "remove.next()
" caseif the iterator is used after the loop, we need to use `.by_ref()`
Configuration menu - View commit details
-
Copy full SHA for 34815a9 - Browse repository at this point
Copy the full SHA 34815a9View commit details -
for_loop_over_fallibles
: don't useMachineApplicable
The loop could contain `break;` that won't work with an `if let`
Configuration menu - View commit details
-
Copy full SHA for c4ab59e - Browse repository at this point
Copy the full SHA c4ab59eView commit details -
Configuration menu - View commit details
-
Copy full SHA for 41fccb1 - Browse repository at this point
Copy the full SHA 41fccb1View commit details -
Configuration menu - View commit details
-
Copy full SHA for 86360f4 - Browse repository at this point
Copy the full SHA 86360f4View commit details -
Configuration menu - View commit details
-
Copy full SHA for d7b8a65 - Browse repository at this point
Copy the full SHA d7b8a65View commit details
Commits on Aug 15, 2022
-
Configuration menu - View commit details
-
Copy full SHA for aed1ae4 - Browse repository at this point
Copy the full SHA aed1ae4View commit details
Commits on Aug 18, 2022
-
Configuration menu - View commit details
-
Copy full SHA for 71b8c89 - Browse repository at this point
Copy the full SHA 71b8c89View commit details -
Configuration menu - View commit details
-
Copy full SHA for ac70aea - Browse repository at this point
Copy the full SHA ac70aeaView commit details
Commits on Aug 22, 2022
-
Export Cancel from std::os::fortanix_sgx::usercalls::raw
This was missed in rust-lang#100642
Configuration menu - View commit details
-
Copy full SHA for 85b3df2 - Browse repository at this point
Copy the full SHA 85b3df2View commit details
Commits on Aug 24, 2022
-
Configuration menu - View commit details
-
Copy full SHA for 2a26987 - Browse repository at this point
Copy the full SHA 2a26987View commit details -
Configuration menu - View commit details
-
Copy full SHA for 36c42fa - Browse repository at this point
Copy the full SHA 36c42faView commit details -
Configuration menu - View commit details
-
Copy full SHA for 63700a8 - Browse repository at this point
Copy the full SHA 63700a8View commit details -
Configuration menu - View commit details
-
Copy full SHA for 89c74e8 - Browse repository at this point
Copy the full SHA 89c74e8View commit details -
Configuration menu - View commit details
-
Copy full SHA for d61ecec - Browse repository at this point
Copy the full SHA d61ececView commit details -
error::Error: rename the chain method to sources
Signed-off-by: Nick Cameron <nrc@ncameron.org>
Configuration menu - View commit details
-
Copy full SHA for 80442f3 - Browse repository at this point
Copy the full SHA 80442f3View commit details -
error::Error: rename the Demand arguments from req to demand
Signed-off-by: Nick Cameron <nrc@ncameron.org>
Configuration menu - View commit details
-
Copy full SHA for b556a5b - Browse repository at this point
Copy the full SHA b556a5bView commit details -
translations: rename warn_ to warning
The macro warn_ was named like that because it the keyword warn is a built-in attribute and at the time this macro was created the word 'warning' was also taken. However it is no longer the case and we can rename warn_ to warning.
Configuration menu - View commit details
-
Copy full SHA for b508b50 - Browse repository at this point
Copy the full SHA b508b50View commit details -
Configuration menu - View commit details
-
Copy full SHA for 4e97626 - Browse repository at this point
Copy the full SHA 4e97626View commit details -
Configuration menu - View commit details
-
Copy full SHA for 4ff5872 - Browse repository at this point
Copy the full SHA 4ff5872View commit details -
Configuration menu - View commit details
-
Copy full SHA for d464d3a - Browse repository at this point
Copy the full SHA d464d3aView commit details -
Configuration menu - View commit details
-
Copy full SHA for 8189a45 - Browse repository at this point
Copy the full SHA 8189a45View commit details
Commits on Aug 25, 2022
-
error::Error: remove some comments
Signed-off-by: Nick Cameron <nrc@ncameron.org>
Configuration menu - View commit details
-
Copy full SHA for 9372c4f - Browse repository at this point
Copy the full SHA 9372c4fView commit details -
Configuration menu - View commit details
-
Copy full SHA for 252c65e - Browse repository at this point
Copy the full SHA 252c65eView commit details -
Configuration menu - View commit details
-
Copy full SHA for 7529029 - Browse repository at this point
Copy the full SHA 7529029View commit details -
Configuration menu - View commit details
-
Copy full SHA for c3f568b - Browse repository at this point
Copy the full SHA c3f568bView commit details
Commits on Aug 27, 2022
-
Configuration menu - View commit details
-
Copy full SHA for b33c3d6 - Browse repository at this point
Copy the full SHA b33c3d6View commit details -
Configuration menu - View commit details
-
Copy full SHA for aa76e13 - Browse repository at this point
Copy the full SHA aa76e13View commit details -
Configuration menu - View commit details
-
Copy full SHA for fc3f3c3 - Browse repository at this point
Copy the full SHA fc3f3c3View commit details -
unstable-book-gen: use std::fs::write
I wrote this code in 2017 back when std::fs::write wasn't available. Also, use the t macro from tidy.
Configuration menu - View commit details
-
Copy full SHA for 4a82c21 - Browse repository at this point
Copy the full SHA 4a82c21View commit details
Commits on Aug 28, 2022
-
Rollup merge of rust-lang#97015 - nrc:read-buf-cursor, r=Mark-Simulacrum
std::io: migrate ReadBuf to BorrowBuf/BorrowCursor This PR replaces `ReadBuf` (used by the `Read::read_buf` family of methods) with `BorrowBuf` and `BorrowCursor`. The general idea is to split `ReadBuf` because its API is large and confusing. `BorrowBuf` represents a borrowed buffer which is mostly read-only and (other than for construction) deals only with filled vs unfilled segments. a `BorrowCursor` is a mostly write-only view of the unfilled part of a `BorrowBuf` which distinguishes between initialized and uninitialized segments. For `Read::read_buf`, the caller would create a `BorrowBuf`, then pass a `BorrowCursor` to `read_buf`. In addition to the major API split, I've made the following smaller changes: * Removed some methods entirely from the API (mostly the functionality can be replicated with two calls rather than a single one) * Unified naming, e.g., by replacing initialized with init and assume_init with set_init * Added an easy way to get the number of bytes written to a cursor (`written` method) As well as simplifying the API (IMO), this approach has the following advantages: * Since we pass the cursor by value, we remove the 'unsoundness footgun' where a malicious `read_buf` could swap out the `ReadBuf`. * Since `read_buf` cannot write into the filled part of the buffer, we prevent the filled part shrinking or changing which could cause underflow for the caller or unexpected behaviour. ## Outline ```rust pub struct BorrowBuf<'a> impl Debug for BorrowBuf<'_> impl<'a> From<&'a mut [u8]> for BorrowBuf<'a> impl<'a> From<&'a mut [MaybeUninit<u8>]> for BorrowBuf<'a> impl<'a> BorrowBuf<'a> { pub fn capacity(&self) -> usize pub fn len(&self) -> usize pub fn init_len(&self) -> usize pub fn filled(&self) -> &[u8] pub fn unfilled<'this>(&'this mut self) -> BorrowCursor<'this, 'a> pub fn clear(&mut self) -> &mut Self pub unsafe fn set_init(&mut self, n: usize) -> &mut Self } pub struct BorrowCursor<'buf, 'data> impl<'buf, 'data> BorrowCursor<'buf, 'data> { pub fn clone<'this>(&'this mut self) -> BorrowCursor<'this, 'data> pub fn capacity(&self) -> usize pub fn written(&self) -> usize pub fn init_ref(&self) -> &[u8] pub fn init_mut(&mut self) -> &mut [u8] pub fn uninit_mut(&mut self) -> &mut [MaybeUninit<u8>] pub unsafe fn as_mut(&mut self) -> &mut [MaybeUninit<u8>] pub unsafe fn advance(&mut self, n: usize) -> &mut Self pub fn ensure_init(&mut self) -> &mut Self pub unsafe fn set_init(&mut self, n: usize) -> &mut Self pub fn append(&mut self, buf: &[u8]) } ``` ## TODO * ~~Migrate non-unix libs and tests~~ * ~~Naming~~ * ~~`BorrowBuf` or `BorrowedBuf` or `SliceBuf`? (We might want an owned equivalent for the async IO traits)~~ * ~~Should we rename the `readbuf` module? We might keep the name indicate it includes both the buf and cursor variations and someday the owned version too. Or we could change it. It is not publicly exposed, so it is not that important~~. * ~~`read_buf` method: we read into the cursor now, so the `_buf` suffix is a bit weird.~~ * ~~Documentation~~ * Tests are incomplete (I adjusted existing tests, but did not add new ones). cc rust-lang#78485, rust-lang#94741 supersedes: rust-lang#95770, rust-lang#93359 fixes rust-lang#93305
Configuration menu - View commit details
-
Copy full SHA for 084bf8d - Browse repository at this point
Copy the full SHA 084bf8dView commit details -
Rollup merge of rust-lang#98301 - ortem:pretty-printers-nonzero, r=we…
…sleywiser Add GDB/LLDB pretty-printers for NonZero types Add GDB/LLDB pretty-printers for `NonZero` types. These pretty-printers were originally implemented for IntelliJ Rust by ``@Kobzol`` in intellij-rust/intellij-rust#5270. Part of rust-lang#29392.
Configuration menu - View commit details
-
Copy full SHA for e5ca6a6 - Browse repository at this point
Copy the full SHA e5ca6a6View commit details -
Rollup merge of rust-lang#98801 - joshtriplett:file-create-new, r=thomcc
Add a `File::create_new` constructor We have `File::create` for creating a file or opening an existing file, but the secure way to guarantee creating a new file requires a longhand invocation via `OpenOptions`. Add `File::create_new` to handle this case, to make it easier for people to do secure file creation.
Configuration menu - View commit details
-
Copy full SHA for be9ed40 - Browse repository at this point
Copy the full SHA be9ed40View commit details -
Rollup merge of rust-lang#99696 - WaffleLapkin:uplift, r=fee1-dead
Uplift `clippy::for_loops_over_fallibles` lint into rustc This PR, as the title suggests, uplifts [`clippy::for_loops_over_fallibles`] lint into rustc. This lint warns for code like this: ```rust for _ in Some(1) {} for _ in Ok::<_, ()>(1) {} ``` i.e. directly iterating over `Option` and `Result` using `for` loop. There are a number of suggestions that this PR adds (on top of what clippy suggested): 1. If the argument (? is there a better name for that expression) of a `for` loop is a `.next()` call, then we can suggest removing it (or rather replacing with `.by_ref()` to allow iterator being used later) ```rust for _ in iter.next() {} // turns into for _ in iter.by_ref() {} ``` 2. (otherwise) We can suggest using `while let`, this is useful for non-iterator, iterator-like things like [async] channels ```rust for _ in rx.recv() {} // turns into while let Some(_) = rx.recv() {} ``` 3. If the argument type is `Result<impl IntoIterator, _>` and the body has a `Result<_, _>` type, we can suggest using `?` ```rust for _ in f() {} // turns into for _ in f()? {} ``` 4. To preserve the original behavior and clear intent, we can suggest using `if let` ```rust for _ in f() {} // turns into if let Some(_) = f() {} ``` (P.S. `Some` and `Ok` are interchangeable depending on the type) I still feel that the lint wording/look is somewhat off, so I'll be happy to hear suggestions (on how to improve suggestions :D)! Resolves rust-lang#99272 [`clippy::for_loops_over_fallibles`]: https://rust-lang.github.io/rust-clippy/master/index.html#for_loops_over_fallibles
Configuration menu - View commit details
-
Copy full SHA for 049c73e - Browse repository at this point
Copy the full SHA 049c73eView commit details -
Rollup merge of rust-lang#100337 - camelid:stabilize-io_read_to_strin…
…g, r=JohnTitor Stabilize `std::io::read_to_string` Closes rust-lang#80218. 🎉 This PR stabilizes the `std::io::read_to_string` function, with the following public API: ```rust pub fn read_to_string<R: Read>(reader: R) -> Result<String>; ``` It's analogous to `std::fs::read_to_string` for files, but it works on anything that implements `io::Read`, including `io::stdin()`. See the tracking issue (rust-lang#80218) or documentation for details.
Configuration menu - View commit details
-
Copy full SHA for b87b660 - Browse repository at this point
Copy the full SHA b87b660View commit details -
Rollup merge of rust-lang#100437 - compiler-errors:better-const-misma…
…tch-err, r=oli-obk Improve const mismatch `FulfillmentError` Fixes rust-lang#100414
Configuration menu - View commit details
-
Copy full SHA for ea30a62 - Browse repository at this point
Copy the full SHA ea30a62View commit details -
Rollup merge of rust-lang#100640 - reitermarkus:socket-display-buffer…
…, r=thomcc Use `DisplayBuffer` for socket addresses. Continuation of rust-lang#100625 for socket addresses. Renames `net::addr` to `net::addr::socket`, `net::ip` to `net::addr::ip` and `net::ip::display_buffer::IpDisplayBuffer` to `net::addr::display_buffer::DisplayBuffer`.
Configuration menu - View commit details
-
Copy full SHA for 09496a8 - Browse repository at this point
Copy the full SHA 09496a8View commit details -
Rollup merge of rust-lang#100885 - mzohreva:mz/sgx-export-cancel-type…
…, r=Mark-Simulacrum Export Cancel from std::os::fortanix_sgx::usercalls::raw This was missed in rust-lang#100642 cc `@raoulstrackx` and `@jethrogb`
Configuration menu - View commit details
-
Copy full SHA for 9ccd9c3 - Browse repository at this point
Copy the full SHA 9ccd9c3View commit details -
Rollup merge of rust-lang#100898 - compiler-errors:too-many-expr-fiel…
…ds, r=spastorino Do not report too many expr field candidates When considering "this expressions' field has a {field/method}" suggestions: 1. Don't report methods that are out of scope 2. Use `span_suggestions` instead of reporting each field candidate, which caps the number of suggestions to 4 4. Blacklist some common traits like `Clone` and `Deref` Fixes rust-lang#100894
Configuration menu - View commit details
-
Copy full SHA for f83d275 - Browse repository at this point
Copy the full SHA f83d275View commit details -
Rollup merge of rust-lang#100955 - nrc:chain, r=joshtriplett
Some papercuts on error::Error Renames the chain method, since I chain could mean anything and doesn't refer to a chain of sources (cc rust-lang#58520) (and adds a comment explaining why sources is not a provided method on Error). Renames arguments to the request method from `req` to `demand` since the type is `Demand` rather than Request or Requisition. r? `@yaahc`
Configuration menu - View commit details
-
Copy full SHA for 0b8e6a2 - Browse repository at this point
Copy the full SHA 0b8e6a2View commit details -
Rollup merge of rust-lang#100959 - LuisCardosoOliveira:translation-re…
…name-attr-warning, r=davidtwco translations: rename warn_ to warning ## Description This MR renames the the macro `warn_` to `warning`. To give a little bit of context, as [explained](https://rust-lang.zulipchat.com/#narrow/stream/336883-i18n/topic/.23100717.20diag.20translation/near/295074146) by `@davidtwco` in the Zulip channel, `warn_` was named like that because the keyword `warn` is a built-in attribute and at the time this macro was created the word `warning` was also taken. However, it is no longer the case and we can rename `warn_` to `warning`.
Configuration menu - View commit details
-
Copy full SHA for ac11fcb - Browse repository at this point
Copy the full SHA ac11fcbView commit details -
Rollup merge of rust-lang#101002 - estebank:hashmap-idx, r=davidtwco
Provide structured suggestion for `hashmap[idx] = val`
Configuration menu - View commit details
-
Copy full SHA for f37d3ea - Browse repository at this point
Copy the full SHA f37d3eaView commit details -
Rollup merge of rust-lang#101055 - TaKO8Ki:use-smaller-span, r=compil…
…er-errors Use smaller span for suggestions
Configuration menu - View commit details
-
Copy full SHA for df64d82 - Browse repository at this point
Copy the full SHA df64d82View commit details -
Rollup merge of rust-lang#101091 - TaKO8Ki:fix-101076, r=notriddle
Extend attrs if local_def_id exists Fixes rust-lang#101076
Configuration menu - View commit details
-
Copy full SHA for 0dc6ab6 - Browse repository at this point
Copy the full SHA 0dc6ab6View commit details -
Rollup merge of rust-lang#101098 - petrochenkov:noinvis, r=TaKO8Ki
rustc_middle: Remove `Visibility::Invisible` It had a different meaning in the past, but now it's only used as an implementation detail of import resolution.
Configuration menu - View commit details
-
Copy full SHA for 58ed74c - Browse repository at this point
Copy the full SHA 58ed74cView commit details -
Rollup merge of rust-lang#101102 - est31:unstable_book_gen_write, r=M…
…ark-Simulacrum unstable-book-gen: use std::fs::write I wrote this code in 2017 back when std::fs::write wasn't available. Also, use the t macro from tidy.
Configuration menu - View commit details
-
Copy full SHA for a5fd83a - Browse repository at this point
Copy the full SHA a5fd83aView commit details