Skip to content
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 7 pull requests #65670

Closed
wants to merge 40 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
a12788a
make is_power_of_two a const function
tspiteri Aug 22, 2019
0a08841
Remove uses of `allow(unions_with_drop_fields)` in the standard library
SimonSapin Jul 3, 2019
84ca0a1
Remove most uses of `allow(unions_with_drop_fields)` in tests
SimonSapin Jul 3, 2019
2f0c821
Change untagged_unions to not allow union fields with drop
bluss Dec 19, 2018
fe13bbd
Remove unions_with_drop_fields lint
SimonSapin Jul 3, 2019
e247a40
Fixes #41073, it is no longer an ICE
SimonSapin Jul 3, 2019
05a644e
Update src/librustc_typeck/check/mod.rs
SimonSapin Jul 4, 2019
8c5ae86
Update src/librustc_typeck/check/mod.rs
SimonSapin Jul 4, 2019
0301eaf
Update src/librustc_typeck/error_codes.rs
SimonSapin Jul 4, 2019
bf25a9c
Update src/test/run-pass/union/union-nodrop.rs
SimonSapin Jul 4, 2019
fc512d2
More descriptive variable name
SimonSapin Jul 4, 2019
616cf52
Extend union-nodrop.rs test
SimonSapin Jul 4, 2019
50ec10e
rpass tests are now part of `ui` tests
oli-obk Sep 20, 2019
9c1ad0f
Preserve originally intended test semantics
oli-obk Sep 20, 2019
2fc257c
Prefer `ManuallyDrop::{take,new}` over `ptr::{read,write}`
oli-obk Sep 20, 2019
fb23a5c
Clarify a vague comment
oli-obk Sep 20, 2019
7e1a65d
Ensure we do not treat all unions as not having any drop glue.
oli-obk Sep 20, 2019
f5669eb
Update ui stderr
oli-obk Sep 20, 2019
bb5a652
Rebase fallout
oli-obk Oct 17, 2019
5719f57
miri add write_bytes method to Memory doing bounds-checks and support…
RalfJung Oct 20, 2019
50ddcbb
also check the iterator is not too long
RalfJung Oct 20, 2019
77c50dc
Remove unnecessary trait bounds from `keys::Keys`.
nnethercote Oct 19, 2019
c3b3a86
Remove unnecessary `Hash` bounds from various types.
nnethercote Oct 19, 2019
0653694
Don't silently do nothing on mis_use of `check_union_fields`
oli-obk Oct 21, 2019
875bdd5
Report even duplilcate errors in case the feature gat is not active
oli-obk Oct 21, 2019
55b787e
keep the root dir clean from debugging
RalfJung Oct 21, 2019
d4b3654
points the user away from the Allocation type and towards the Memory …
RalfJung Oct 20, 2019
f6d70b4
remove write_repeat; it is subsumed by the new write_bytes
RalfJung Oct 21, 2019
ac6daed
Remove many unnecessary trait derivations.
nnethercote Oct 20, 2019
3de7698
Fix typo from #65214
Amanieu Oct 21, 2019
d689c70
improve readability of is_power_of_two
tspiteri Oct 21, 2019
c3e909f
Remove `src/llvm-emscripten` submodule
alexcrichton Oct 17, 2019
ebc9a1a
expand comment
RalfJung Oct 21, 2019
b1feb95
Rollup merge of #62330 - SimonSapin:no-drop-in-union-fields, r=RalfJung
Centril Oct 21, 2019
ece5e58
Rollup merge of #65092 - tspiteri:const-is-pow2, r=oli-obk
Centril Oct 21, 2019
1f28401
Rollup merge of #65501 - alexcrichton:remove-emscripten-backend, r=Ma…
Centril Oct 21, 2019
57205dd
Rollup merge of #65621 - RalfJung:write_bytes, r=oli-obk
Centril Oct 21, 2019
2cf747f
Rollup merge of #65647 - nnethercote:rm-unnecessary-traits, r=Centril
Centril Oct 21, 2019
811a573
Rollup merge of #65653 - RalfJung:gitignore, r=Mark-Simulacrum,Centril
Centril Oct 21, 2019
644228d
Rollup merge of #65663 - Amanieu:typo, r=varkor
Centril Oct 21, 2019
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
15 changes: 7 additions & 8 deletions src/libstd/panicking.rs
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@ use core::panic::{BoxMeUp, PanicInfo, Location};
use crate::any::Any;
use crate::fmt;
use crate::intrinsics;
use crate::mem;
use crate::mem::{self, ManuallyDrop};
use crate::ptr;
use crate::raw;
use crate::sync::atomic::{AtomicBool, Ordering};
@@ -227,10 +227,9 @@ pub use realstd::rt::update_panic_count;

/// Invoke a closure, capturing the cause of an unwinding panic if one occurs.
pub unsafe fn r#try<R, F: FnOnce() -> R>(f: F) -> Result<R, Box<dyn Any + Send>> {
#[allow(unions_with_drop_fields)]
union Data<F, R> {
f: F,
r: R,
f: ManuallyDrop<F>,
r: ManuallyDrop<R>,
}

// We do some sketchy operations with ownership here for the sake of
@@ -261,7 +260,7 @@ pub unsafe fn r#try<R, F: FnOnce() -> R>(f: F) -> Result<R, Box<dyn Any + Send>>
let mut any_data = 0;
let mut any_vtable = 0;
let mut data = Data {
f,
f: ManuallyDrop::new(f)
};

let r = __rust_maybe_catch_panic(do_call::<F, R>,
@@ -271,7 +270,7 @@ pub unsafe fn r#try<R, F: FnOnce() -> R>(f: F) -> Result<R, Box<dyn Any + Send>>

return if r == 0 {
debug_assert!(update_panic_count(0) == 0);
Ok(data.r)
Ok(ManuallyDrop::into_inner(data.r))
} else {
update_panic_count(-1);
debug_assert!(update_panic_count(0) == 0);
@@ -284,8 +283,8 @@ pub unsafe fn r#try<R, F: FnOnce() -> R>(f: F) -> Result<R, Box<dyn Any + Send>>
fn do_call<F: FnOnce() -> R, R>(data: *mut u8) {
unsafe {
let data = data as *mut Data<F, R>;
let f = ptr::read(&mut (*data).f);
ptr::write(&mut (*data).r, f());
let f = ptr::read(&mut *(*data).f);
ptr::write(&mut *(*data).r, f());
}
}
}