Emilio Cobos Álvarez
5176f677f5
slice: Stabilize IterMut::as_slice.
...
Much like #72584 .
As per #58957 there's no blocker for this, and I wanted to use this
today :-)
2021-03-04 19:36:54 +01:00
Mara Bos
f223affd7a
Don't consume the expression in assert_matches!()'s failure case.
2021-03-04 19:36:36 +01:00
Mateusz Gacek
a5951d4b23
Add diagnostic item to Default trait
...
Required to resolve #6562 rust-clippy issue.
2021-03-04 10:14:48 -08:00
Mara Bos
5bd1204fc2
Fix assert_matches doc examples.
2021-03-04 18:41:43 +01:00
Mara Bos
0a8e401188
Add debug_assert_matches macro.
2021-03-04 18:12:33 +01:00
Mara Bos
cfce60ea37
Allow for multiple patterns and a guard in assert_matches.
2021-03-04 18:12:26 +01:00
Mara Bos
eb18746bc6
Add assert_matches!(expr, pat).
2021-03-04 18:07:20 +01:00
Mara Bos
eddd4f0501
Add tracking issue for map_try_insert.
2021-03-04 16:54:28 +01:00
Mara Bos
1aedb4c3a3
Remove unnecessary bound from HashMap::try_insert.
2021-03-04 16:46:41 +01:00
Mara Bos
da01455813
Ignore file length tidy warning in hash/map.rs.
2021-03-04 16:25:24 +01:00
bors
409920873c
Auto merge of #81451 - nikic:llvm-12, r=nagisa
...
Upgrade to LLVM 12
This implements the necessary adjustments to make rustc work with LLVM 12. I didn't encounter any major issues so far.
r? `@cuviper`
2021-03-04 15:16:44 +00:00
Mara Bos
d85d82ab22
Implement Error for OccupiedError.
2021-03-04 15:58:50 +01:00
Mara Bos
69d95e232a
Improve Debug implementations of OccupiedError.
2021-03-04 15:58:50 +01:00
Mara Bos
f6fe24aab3
Add HashMap::try_insert and hash_map::OccupiedError.
2021-03-04 15:58:50 +01:00
Mara Bos
09cbcdc2c3
Add BTreeMap::try_insert and btree_map::OccupiedError.
2021-03-04 15:58:50 +01:00
Waffle
1f031d95de
Add regression test for Vec::extend_from_within leak
2021-03-04 17:10:57 +03:00
Waffle
84e9608596
Fix leak in Vec::extend_from_within
...
Previously vec's len was updated only after full copy, making the method
leak if T::clone panic!s.
This commit makes `Vec::extend_from_within` (or, more accurately, it's
`T: Clone` specialization) update vec's len on every iteration, fixing
the issue.
`T: Copy` specialization was not affected by the issue b/c it doesn't
call user specified code (as, e.g. `T::clone`), and instead calls
`ptr::copy_nonoverlapping`.
2021-03-04 17:10:57 +03:00
Ian Jackson
8e4433ab3e
ExitStatus tests: Make less legible to satisfy "tidy"
...
I strongly disagree with tidy in this case but AIUI there is no way to
override it.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk >
2021-03-04 12:44:19 +00:00
Ian Jackson
a240ff5a77
ExitStatus unknown wait status test: Make it Linux only
...
If different unices have different bit patterns for WIFSTOPPED and
WIFCONTINUED then simply being glibc is probably not good enough for
this rather ad-hoc test to work. Do it on Linux only.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk >
2021-03-04 12:26:27 +00:00
Ian Jackson
67cfc22ee2
ExitStatus stop signal display test: Make it Linux only
...
MacOS uses a different representation.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk >
2021-03-04 12:18:04 +00:00
Yuki Okushi
290117f7d9
Rollup merge of #82564 - WaffleLapkin:revert_spare_mut, r=RalfJung
...
Revert `Vec::spare_capacity_mut` impl to prevent pointers invalidation
The implementation was changed in #79015 .
Later it was [pointed out](https://github.com/rust-lang/rust/issues/81944#issuecomment-782849785 ) that the implementation invalidates pointers to the buffer (initialized elements) by creating a unique reference to the buffer. This PR reverts the implementation.
r? ```@RalfJung```
2021-03-04 20:01:06 +09:00
Yuki Okushi
f898aa3f5b
Rollup merge of #80527 - jyn514:rustdoc-lints, r=GuillaumeGomez
...
Make rustdoc lints a tool lint instead of built-in
- Rename `broken_intra_doc_links` to `rustdoc::broken_intra_doc_links` (and similar for other rustdoc lints; I don't expect any others to be used frequently, though).
- Ensure that the old lint names still work and give deprecation errors
- Register lints even when running doctests
- Move lint machinery into a separate file
- Add `declare_rustdoc_lint!` macro
Unblocks https://github.com/rust-lang/rust/pull/80300 , https://github.com/rust-lang/rust/pull/79816 , https://github.com/rust-lang/rust/pull/80965 . Makes the strangeness in https://github.com/rust-lang/rust/pull/77364 more apparent to the end user (note that `missing_docs` is *not* moved to rustdoc in this PR). Closes https://github.com/rust-lang/rust/issues/78786 .
## Current status
This is blocked on #82620 (see https://github.com/rust-lang/rust/pull/80527#issuecomment-787401519 )
2021-03-04 20:01:01 +09:00
Ralf Jung
ebe0407dbf
improve offset_from docs
2021-03-04 10:05:51 +01:00
Giles Cope
d07c43af31
Alternative LUT rather than dividing.
2021-03-04 08:36:04 +00:00
Giacomo Stevanato
aeb4ea739e
Remove useless comparison since now self.index <= self.len is an invariant
2021-03-03 21:19:31 +01:00
Giacomo Stevanato
8b9ac4d415
Add test for underflow in specialized Zip's size_hint
2021-03-03 21:16:08 +01:00
Giacomo Stevanato
66a260617a
Increment self.len in specialized ZipImpl to avoid underflow in size_hint
2021-03-03 21:16:07 +01:00
Ryan Lopopolo
05ea200213
Add impls for iterators of Cow<OsStr>
2021-03-03 11:52:14 -08:00
Caleb Sander
9425e304b1
Avoid unnecessary Vec construction in BufReader
2021-03-03 12:26:20 -05:00
Stein Somers
e7f340e19b
BTree: move blocks around in node.rs
2021-03-03 18:06:35 +01:00
Waffle Lapkin
950f12119e
Update library/alloc/src/vec/mod.rs
...
Co-authored-by: Ralf Jung <post@ralfj.de >
2021-03-03 20:04:20 +03:00
bors
939b14334d
Auto merge of #82704 - RalfJung:miri-atomic-minmax, r=oli-obk
...
enable atomic_min/max tests in Miri
Thanks to `@henryboisdequin` and `@GregBowyer,` Miri now supports these intrinsics. :)
Also includes the necessary Miri update.
2021-03-03 11:05:01 +00:00
Ryan Levick
1999a3147f
Fix borrow and deref
2021-03-03 11:23:29 +01:00
Ryan Levick
da3995f0ec
Remove lint pass on borrow and deref
2021-03-03 11:23:14 +01:00
Ryan Levick
c5ff54cbdb
Fix std tests
2021-03-03 11:22:51 +01:00
Ryan Levick
d3b49c2ed2
Only allow new lint when not bootstrapping - since beta doesn't know about the lint
2021-03-03 11:22:50 +01:00
Ryan Levick
ee65416f0d
Fix core tests
2021-03-03 11:22:49 +01:00
Ryan Levick
3a86184777
Fix ui-full-deps suite
2021-03-03 11:22:49 +01:00
Ryan Levick
a6d926d80d
Fix tests
2021-03-03 11:22:44 +01:00
Ryan Levick
f49ed7a6b7
Add tests and support two more noop methods
2021-03-03 11:22:17 +01:00
Ryan Levick
040735c110
First version of noop-lint
2021-03-03 11:22:16 +01:00
bors
770ed1cf4b
Auto merge of #82718 - JohnTitor:rollup-vpfx3j2, r=JohnTitor
...
Rollup of 10 pull requests
Successful merges:
- #81223 ([rustdoc] Generate redirect map file)
- #82439 (BTree: fix untrue safety)
- #82469 (Use a crate to produce rustdoc tree comparisons instead of the `diff` command)
- #82589 (unix: Non-mutable bufs in send_vectored_with_ancillary_to)
- #82689 (meta: Notify Zulip for rustdoc nominated issues)
- #82695 (Revert non-power-of-two vector restriction)
- #82706 (use outer_expn_data() instead of outer_expn().expn_data())
- #82710 (FloatToInit: Replacing round_unchecked_to --> to_int_unchecked)
- #82712 (Remove unnecessary conditional `cfg(target_os)` for `redox` and `vxworks`)
- #82713 (Update cargo)
Failed merges:
r? `@ghost`
`@rustbot` modify labels: rollup
2021-03-03 08:36:46 +00:00
Yuki Okushi
68d4ff04ee
Rollup merge of #82712 - CDirkx:cfg-target_os, r=dtolnay
...
Remove unnecessary conditional `cfg(target_os)` for `redox` and `vxworks`
`redox` and `vxworks` are now part of target_family `unix`, thus `cfg(unix)` already implies `cfg(target_os="redox")` and `cfg(target_os="vxworks")`
35dbef2350/compiler/rustc_target/src/spec/redox_base.rs (L26)
35dbef2350/compiler/rustc_target/src/spec/vxworks_base.rs (L27)
2021-03-03 16:27:47 +09:00
Yuki Okushi
376655eaf6
Rollup merge of #82710 - peter-kehl:FloatToInit_82709, r=sfackler
...
FloatToInit: Replacing round_unchecked_to --> to_int_unchecked
FloatToInit docs: Replacing round_unchecked_to with
to_int_unchecked. Bug #82709 .
2021-03-03 16:27:46 +09:00
Yuki Okushi
b16b6820d3
Rollup merge of #82589 - LinkTed:master, r=joshtriplett
...
unix: Non-mutable bufs in send_vectored_with_ancillary_to
This is the same PR as [#79753 ](https://github.com/rust-lang/rust/pull/79753 ). It was closed because of inactivity. Therefore, I create a new one. ````@lukaslihotzki````
2021-03-03 16:27:41 +09:00
Yuki Okushi
46f9253098
Rollup merge of #82439 - ssomers:btree_fix_unsafety, r=Mark-Simulacrum
...
BTree: fix untrue safety
Fix needless and missing `unsafe` tags.
r? ````@Mark-Simulacrum````
2021-03-03 16:27:39 +09:00
bors
cbca5689a5
Auto merge of #76345 - okready:sgx-mem-range-overflow-checks, r=joshtriplett
...
Add is_enclave_range/is_user_range overflow checks
Fixes #76343 .
This adds overflow checking to `is_enclave_range` and `is_user_range` in `sgx::os::fortanix_sgx::mem` in order to mitigate possible security issues with enclave code. It also accounts for an edge case where the memory range provided ends exactly at the end of the address space, where calculating `p + len` would overflow back to zero despite the range potentially being valid.
2021-03-03 05:45:50 +00:00
Christiaan Dirkx
738f736066
Remove unnecessary conditional cfg(target_os) for redox and vxworks
...
`redox` and `vxworks` are part of target_family `unix`, thus `cfg(unix)` already implies `cfg(target_os="redox")` and `(target_os="vxworks")`
2021-03-03 01:14:17 +01:00
Waffle
a1835bcb01
Make Vec::split_at_spare_mut impl safer & simplier
2021-03-03 01:04:20 +03:00
Waffle
9c4e3af39d
Add test that Vec::spare_capacity_mut doesn't invalidate pointers
2021-03-03 01:00:59 +03:00