Skip to content

Rollup of 7 pull requests #75715

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

Merged
merged 25 commits into from
Aug 19, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
172e67e
Adjust installation place for compiler docs
Mark-Simulacrum Aug 16, 2020
695d86f
Make OnceCell<T> transparent to dropck
matklad Aug 17, 2020
75d1373
mir building: fix some comments
RalfJung Aug 16, 2020
5d49c0e
Move to intra doc links for std::io
poliorcetics Aug 18, 2020
70dfe3f
move const param structural match checks to wfcheck
lcnr Aug 2, 2020
6ad01e9
run wfcheck in parralel again, add test for 74950
lcnr Aug 13, 2020
7542615
change const param ty warning message
lcnr Aug 18, 2020
34e7eac
Remove `#[cfg(miri)]` from OnceCell tests
matklad Aug 19, 2020
967ec1f
Refactor `impl_for_type` into a separate function
jyn514 Aug 17, 2020
8a0aa7b
Say `tcx.lang_items()` less
jyn514 Aug 17, 2020
3ddd8b2
Return all impls, not just the primary one
jyn514 Aug 17, 2020
06d6d3d
impl_for_type -> PrimitiveType::impls
jyn514 Aug 17, 2020
9cf2fa8
Allow reusing the code in `collect_trait_impls`
jyn514 Aug 17, 2020
219e93d
Use `impls` for intra doc links as well
jyn514 Aug 17, 2020
121974e
xpy fmt
jyn514 Aug 17, 2020
570b0d9
Add a test
jyn514 Aug 17, 2020
dad8e11
Fix nits in intra-doc links for std io
poliorcetics Aug 19, 2020
aff01f8
Add test for f32 and f64 methods
jyn514 Aug 19, 2020
672d009
Rollup merge of #75069 - lcnr:type-of-lazy-norm, r=varkor
tmandry Aug 19, 2020
1f70776
Rollup merge of #75587 - RalfJung:mir-comment-fixes, r=ecstatic-morse
tmandry Aug 19, 2020
0e7e939
Rollup merge of #75593 - Mark-Simulacrum:compiler-docs-must-not-overl…
tmandry Aug 19, 2020
4123237
Rollup merge of #75648 - matklad:lazy-dropck, r=KodrAus
tmandry Aug 19, 2020
7d14077
Rollup merge of #75649 - jyn514:inherent-lang-impls, r=guillaumegomez
tmandry Aug 19, 2020
0fdc8c0
Rollup merge of #75674 - poliorcetics:intra-links-std-io, r=jyn514
tmandry Aug 19, 2020
ad3db41
Rollup merge of #75696 - matklad:mirit, r=RalfJung
tmandry Aug 19, 2020
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 OnceCell<T> transparent to dropck
See the failed build in

#75555 (comment)

for an example where we need this in real life
  • Loading branch information
matklad committed Aug 17, 2020
commit 695d86f584bf2fb1fd49d34b83166b6b28d99d10
9 changes: 9 additions & 0 deletions library/core/tests/lazy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,3 +122,12 @@ fn reentrant_init() {
});
eprintln!("use after free: {:?}", dangling_ref.get().unwrap());
}

#[test]
fn dropck() {
let cell = OnceCell::new();
{
let s = String::new();
cell.set(&s).unwrap();
}
}
14 changes: 12 additions & 2 deletions library/std/src/lazy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -386,9 +386,10 @@ impl<T> SyncOnceCell<T> {
}
}

impl<T> Drop for SyncOnceCell<T> {
unsafe impl<#[may_dangle] T> Drop for SyncOnceCell<T> {
fn drop(&mut self) {
// Safety: The cell is being dropped, so it can't be accessed again
// Safety: The cell is being dropped, so it can't be accessed again.
// We also don't touch the `T`, which validates our usage of #[may_dangle].
unsafe { self.take_inner() };
}
}
Expand Down Expand Up @@ -845,4 +846,13 @@ mod tests {
assert_eq!(msg, MSG);
}
}

#[test]
fn dropck() {
let cell = SyncOnceCell::new();
{
let s = String::new();
cell.set(&s).unwrap();
}
}
}