Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Closed
Changes from 1 commit
Commits
Show all changes
78 commits
Select commit Hold shift + click to select a range
f45bdcc
Implement size_hint for BufReader
Xavientois Jan 15, 2021
c3e47d9
Fix implementation to specialize
Xavientois Jan 15, 2021
fa76db3
Use helper trait to follow min_specialization rules
Xavientois Jan 15, 2021
11c49f6
Add missing generic
Xavientois Jan 15, 2021
260a270
Move default to trait definition
Xavientois Jan 15, 2021
5f60a30
Fix incorrect token
Xavientois Jan 15, 2021
eea99f4
Add default keyword for specialization
Xavientois Jan 15, 2021
7e56637
Add back lower_bound as memeber
Xavientois Jan 16, 2021
442de9a
Fix semicolon
Xavientois Jan 16, 2021
1190321
Remove exposing private trait
Xavientois Jan 16, 2021
421b40c
Add dyn for SizeHint cast
Xavientois Jan 16, 2021
265db94
Fix formatting
Xavientois Jan 16, 2021
93870c8
Remove stable annotation
Xavientois Jan 16, 2021
7869371
Remove unnecessary default keyword
Xavientois Jan 16, 2021
c8e0f8a
Use fully qualified syntax to avoid dyn
Xavientois Jan 16, 2021
96255f8
Implement SizeHint trait for BufReader, Emtpy, and Chain
Xavientois Jan 16, 2021
389e638
Add tests for SizeHint implementations
Xavientois Jan 16, 2021
b837f3a
Remove trailing newline
Xavientois Jan 16, 2021
81aba38
Add space for proper indentation
Xavientois Jan 16, 2021
fc9cd4a
Fix formatting on mod
Xavientois Jan 16, 2021
7674ae1
Fix line length format
Xavientois Jan 31, 2021
4cb089b
Inherit `#[stable(..)]` annotations in enum variants and fields from …
estebank Apr 23, 2020
19806e4
Tweak stability attribute diagnostic output
estebank Feb 11, 2021
7b021aa
resolve: Reduce scope of `pub_use_of_private_extern_crate` deprecatio…
petrochenkov Jan 28, 2021
49310ce
Add test for "const stability on macro"
estebank Feb 11, 2021
fbd575a
process::unix: Handle other wait statuses in ExitStatus as Display
ijackson Feb 22, 2021
d8cfd56
process::unix: Test wait status formatting
ijackson Feb 22, 2021
4bb8425
ExitStatus: Improve documentation re wait status vs exit status
ijackson Feb 22, 2021
2f04a79
Revert `Vec::spare_capacity_mut` impl to prevent pointers invalidation
WaffleLapkin Feb 26, 2021
cc62018
Rename rustdoc lints to be a tool lint instead of built-in.
jyn514 Dec 30, 2020
37e4cfe
Move lint machinery into a separate file
jyn514 Dec 30, 2020
7195355
Add `declare_rustdoc_lint!` macro
jyn514 Dec 30, 2020
e8ddfda
Improve error messages
jyn514 Jan 17, 2021
0517ea7
Address review comments
jyn514 Jan 18, 2021
c7535d1
Update comments
jyn514 Jan 19, 2021
75efb6e
Test that using the previous lint names still applies the lint
jyn514 Feb 28, 2021
768d5e9
Load rustdoc's JS search index on-demand.
jsha Feb 20, 2021
9c4e3af
Add test that Vec::spare_capacity_mut doesn't invalidate pointers
WaffleLapkin Mar 2, 2021
a1835bc
Make Vec::split_at_spare_mut impl safer & simplier
WaffleLapkin Mar 2, 2021
d3e7ffa
Improve page load performance in rustdoc.
jsha Feb 20, 2021
f9cfe15
Use Arial as fallback font instead of sans-serif.
jsha Mar 3, 2021
040735c
First version of noop-lint
rylev Jan 5, 2021
f49ed7a
Add tests and support two more noop methods
rylev Jan 5, 2021
a6d926d
Fix tests
rylev Jan 5, 2021
618c395
Bless test where order of error message changed
rylev Jan 6, 2021
3a86184
Fix ui-full-deps suite
rylev Jan 6, 2021
ee65416
Fix core tests
rylev Jan 6, 2021
d3b49c2
Only allow new lint when not bootstrapping - since beta doesn't know …
rylev Jan 7, 2021
c5ff54c
Fix std tests
rylev Jan 7, 2021
217c886
Improve warning
rylev Jan 8, 2021
16c4afb
Fix tidy errors
rylev Jan 8, 2021
95e330b
Update error message
rylev Jan 11, 2021
316e9db
Fix tidy error
rylev Jan 11, 2021
49f32e0
Improve error messages
rylev Jan 12, 2021
e48670c
Increase accuracy of lint trigger
estebank Jan 13, 2021
055db16
Clean up code rightward drift
estebank Jan 13, 2021
4be7052
Allow noop_method_call in clippy ui test
rylev Jan 18, 2021
6bf6652
Move unrelated ui test back to what it was before
rylev Feb 10, 2021
da3995f
Remove lint pass on borrow and deref
rylev Feb 16, 2021
1999a31
Fix borrow and deref
rylev Feb 16, 2021
25637b2
Warn in doc test
rylev Feb 17, 2021
6111445
Add `-Z unpretty` flags for the AST
LeSeulArtichaut Feb 19, 2021
950f121
Update library/alloc/src/vec/mod.rs
WaffleLapkin Mar 3, 2021
5461ee0
rustc_target: add "unwind" payloads to `Abi`
Aug 27, 2020
9a007cf
implement unwinding abi's (RFC 2945)
Sep 10, 2020
0fd2fd9
add integration tests, unwind across FFI boundary
Dec 12, 2020
d8bfdc8
address pr review comments
Oct 23, 2020
229ffc3
Rollup merge of #71481 - estebank:inherit-stability, r=nikomatsakis
Dylan-DPC Mar 4, 2021
045261f
Rollup merge of #76570 - cratelyn:implement-rfc-2945-c-unwind-abi, r=…
Dylan-DPC Mar 4, 2021
ea7c3e7
Rollup merge of #80527 - jyn514:rustdoc-lints, r=GuillaumeGomez
Dylan-DPC Mar 4, 2021
72e5b5a
Rollup merge of #80723 - rylev:noop-lint-pass, r=estebank
Dylan-DPC Mar 4, 2021
cb909a6
Rollup merge of #80763 - petrochenkov:pubusecrate, r=estebank
Dylan-DPC Mar 4, 2021
1dfd766
Rollup merge of #81136 - Xavientois:io_reader_size_hint, r=cramertj
Dylan-DPC Mar 4, 2021
e0ef270
Rollup merge of #82304 - LeSeulArtichaut:unpretty-ast, r=spastorino
Dylan-DPC Mar 4, 2021
4cb61a3
Rollup merge of #82310 - jsha:rustdoc-search-onfocus, r=GuillaumeGomez
Dylan-DPC Mar 4, 2021
ba4ee48
Rollup merge of #82315 - jsha:font-display-swap, r=GuillaumeGomez
Dylan-DPC Mar 4, 2021
ae2482e
Rollup merge of #82411 - ijackson:fix-exitstatus, r=dtolnay
Dylan-DPC Mar 4, 2021
b0b63ec
Rollup merge of #82564 - WaffleLapkin:revert_spare_mut, r=RalfJung
Dylan-DPC Mar 4, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Make Vec::split_at_spare_mut impl safer & simplier
  • Loading branch information
WaffleLapkin committed Mar 2, 2021
commit a1835bcb01fc345653fd9e9ce02b0d103032c58d
14 changes: 5 additions & 9 deletions library/alloc/src/vec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1944,20 +1944,16 @@ impl<T, A: Allocator> Vec<T, A> {
#[unstable(feature = "vec_split_at_spare", issue = "81944")]
#[inline]
pub fn split_at_spare_mut(&mut self) -> (&mut [T], &mut [MaybeUninit<T>]) {
let ptr = self.as_mut_ptr();

// SAFETY:
// - `ptr` is guaranteed to be in bounds for `capacity` elements
// - `len` is guaranteed to less or equal to `capacity`
// - `MaybeUninit<T>` has the same layout as `T`
let spare_ptr = unsafe { ptr.cast::<MaybeUninit<T>>().add(self.len) };
let Range { start: ptr, end: spare_ptr } = self.as_mut_ptr_range();
let spare_ptr = spare_ptr.cast::<MaybeUninit<T>>();
let spare_len = self.buf.capacity() - self.len;

// SAFETY:
// - `ptr` is guaranteed to be valid for `len` elements
// - `spare_ptr` is offseted from `ptr` by `len`, so it doesn't overlap `initialized` slice
// - `spare_ptr` is pointing one element past the buffer, so it doesn't overlap with `initialized` slice
unsafe {
let initialized = slice::from_raw_parts_mut(ptr, self.len);
let spare = slice::from_raw_parts_mut(spare_ptr, self.buf.capacity() - self.len);
let spare = slice::from_raw_parts_mut(spare_ptr, spare_len);

(initialized, spare)
}
Expand Down