1. 15 1月, 2021 10 次提交
    • M
      Rollup merge of #80969 - camelid:monomorph-ice-msg, r=nagisa · 90cc8158
      Mara Bos 提交于
      Use better ICE message when no MIR is available
      
      The ICE message is somewhat confusing and overly specific - the issue is
      that there's no MIR available.
      
      This should make debugging these ICEs easier since the error tells you
      what's actually wrong, not what it was trying to do when it failed.
      
      cc https://github.com/rust-lang/rust/pull/80952#issuecomment-759198841
      cc `````@jyn514`````
      90cc8158
    • M
      Rollup merge of #80966 - KodrAus:deprecate/spin_loop_hint, r=m-ou-se · 7855a730
      Mara Bos 提交于
      Deprecate atomic::spin_loop_hint in favour of hint::spin_loop
      
      For https://github.com/rust-lang/rust/issues/55002
      
      We wanted to leave `atomic::spin_loop_hint` alone when stabilizing `hint::spin_loop` so folks had some time to migrate. This now deprecates `atomic_spin_loop_hint`.
      7855a730
    • M
      Rollup merge of #80895 - sfackler:read-to-end-ub, r=m-ou-se · ce487094
      Mara Bos 提交于
      Fix handling of malicious Readers in read_to_end
      
      A malicious `Read` impl could return overly large values from `read`, which would result in the guard's drop impl setting the buffer's length to greater than its capacity! ~~To fix this, the drop impl now uses the safe `truncate` function instead of `set_len` which ensures that this will not happen. The result of calling the function will be nonsensical, but that's fine given the contract violation of the `Read` impl.~~
      
      ~~The `Guard` type is also used by `append_to_string` which does not pass untrusted values into the length field, so I've copied the guard type into each function and only modified the one used by `read_to_end`. We could just keep a single one and modify it, but it seems a bit cleaner to keep the guard code close to the functions and related specifically to them.~~
      
      To fix this, we now assert that the returned length is not larger than the buffer passed to the method.
      
      For reference, this bug has been present for ~2.5 years since 1.20: https://github.com/rust-lang/rust/commit/ecbb896b9eb2acadefde57be493e4298c1aa04a3.
      
      Closes #80894.
      ce487094
    • M
      Rollup merge of #80829 - jyn514:dep-constructor, r=michaelwoerister · 9e9aba87
      Mara Bos 提交于
      Get rid of `DepConstructor`
      
      This removes fully 235 unused functions.
      
      Follow-up to https://github.com/rust-lang/rust/pull/80325#discussion_r548491999.
      
      r? ``@michaelwoerister``
      cc ``@cjgillot``
      9e9aba87
    • M
      Rollup merge of #80567 - lukaslueg:intersperse_with, r=m-ou-se · 446ed771
      Mara Bos 提交于
      Add Iterator::intersperse_with
      
      This is a follow-up to #79479, tracking in #79524, as discussed https://github.com/rust-lang/rust/pull/79479#issuecomment-752671731.
      
      ~~Note that I had to manually implement `Clone` and `Debug` because `derive` insists on placing a `Clone`-bound on the struct-definition, which is too narrow. There is a long-standing issue # for this somewhere around here :-)~~
      
      Also, note that I refactored the guts of `Intersperse` into private functions and re-used them in `IntersperseWith`, so I also went light on duplicating all the tests.
      
      If this is suitable to be merged, the tracking issue should be updated, since it only mentions `intersperse`.
      
      Happy New Year!
      
      r? ``@m-ou-se``
      446ed771
    • M
      Rollup merge of #80444 - glittershark:bound-as-ref, r=dtolnay · 3308b43b
      Mara Bos 提交于
      Add as_ref and as_mut methods for Bound
      
      Add as_ref and as_mut method for std::ops::range::Bound, patterned off
      of the methods of the same name on Option.
      
      I'm not quite sure what the process is for introducing new feature gates (this is my first contribution) so I've left these ungated, but happy to do whatever is necessary to gate them.
      3308b43b
    • M
      Rollup merge of #80217 - camelid:io-read_to_string, r=m-ou-se · 9fc298ca
      Mara Bos 提交于
      Add a `std::io::read_to_string` function
      
      I recognize that you're usually supposed to open an issue first, but the
      implementation is very small so it's okay if this is closed and it was 'wasted
      work' :)
      
      -----
      
      The equivalent of `std::fs::read_to_string`, but generalized to all
      `Read` impls.
      
      As the documentation on `std::io::read_to_string` says, the advantage of
      this function is that it means you don't have to create a variable first
      and it provides more type safety since you can only get the buffer out
      if there were no errors. If you use `Read::read_to_string`, you have to
      remember to check whether the read succeeded because otherwise your
      buffer will be empty.
      
      It's friendlier to newcomers and better in most cases to use an explicit
      return value instead of an out parameter.
      9fc298ca
    • M
      Rollup merge of #80169 - frewsxcv:frewsxcv-docs-fix, r=jyn514 · 930371b3
      Mara Bos 提交于
      Recommend panic::resume_unwind instead of panicking.
      
      Fixes https://github.com/rust-lang/rust/issues/79950.
      930371b3
    • M
      Rollup merge of #80017 - camelid:sugg-rest-pattern, r=estebank · d3b31065
      Mara Bos 提交于
      Suggest `_` and `..` if a pattern has too few fields
      
      Fixes #80010.
      d3b31065
    • M
      Rollup merge of #79982 - ijackson:exit-status, r=dtolnay · 8ac21fb2
      Mara Bos 提交于
      Add missing methods to unix ExitStatusExt
      
      These are the methods corresponding to the remaining exit status examination macros from `wait.h`.  `WCOREDUMP` isn't in SuS but is it is very standard.  I have not done portability testing to see if this builds everywhere, so I may need to Do Something if it doesn't.
      
      There is also a bugfix and doc improvement to `.signal()`, and an `.into_raw()` accessor.
      
      This would fix #73128 and fix #73129.  Please let me know if you like this direction, and if so I will open the tracking issue and so on.
      
      If this MR goes well, I may tackle #73125 next - I have an idea for how to do it.
      8ac21fb2
  2. 14 1月, 2021 16 次提交
  3. 13 1月, 2021 14 次提交