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

Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
48af94c
Operand::extract_field: only cast llval if it's a pointer and replace…
luqmana Dec 12, 2022
75f3faf
Add test.
luqmana Dec 12, 2022
af69cc0
Make test more targeted.
luqmana Dec 12, 2022
6a5ee11
Don't bitcast aggregate field.
luqmana Dec 16, 2022
2942121
Update test location.
luqmana May 5, 2023
7b1eeda
Switch test back to run-pass.
luqmana May 5, 2023
c7c042a
Address review comments.
luqmana May 5, 2023
7e3b934
clean up transmutes in core
May 6, 2023
b2acf3e
rustc --explain E0726 - grammar fixing (it's => its + add a `the` whe…
Astroide May 6, 2023
05414b0
update Rust Unstable Book docs for `--extern force`
mhammerly May 6, 2023
faa797e
Emit while_true lint spanning the entire loop condition
Flying-Toast May 6, 2023
ec7fcdc
Remove unneeded calls to `mem::forget`
nullptrderef29 May 6, 2023
fd005b0
delete whitelist and add checks to check_item() for missing_docs
mj10021 May 3, 2023
d6ef6e0
Update compiler/rustc_error_codes/src/error_codes/E0726.md
Astroide May 6, 2023
5859771
Rollup merge of #105583 - luqmana:bitcast-immediates, r=oli-obk
JohnTitor May 7, 2023
aef008a
Rollup merge of #110094 - lukas-code:less-transmute, r=thomcc
JohnTitor May 7, 2023
61115cd
Rollup merge of #111150 - mj10021:issue-111025-fix, r=petrochenkov
JohnTitor May 7, 2023
4e4e5bf
Rollup merge of #111293 - Astroide:patch-1, r=compiler-errors
JohnTitor May 7, 2023
88a0204
Rollup merge of #111300 - Flying-Toast:while_true_span_condition, r=c…
JohnTitor May 7, 2023
816e029
Rollup merge of #111301 - JohnBobbo96:cleanup_option_insert_methods, …
JohnTitor May 7, 2023
8372eae
Rollup merge of #111303 - mhammerly:extern-force-docs, r=JohnTitor
JohnTitor May 7, 2023
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
clean up transmutes in core
  • Loading branch information
Lukas Markeffsky committed May 6, 2023
commit 7e3b93417c620072169a061e7f3c975705723d30
4 changes: 2 additions & 2 deletions library/core/src/mem/maybe_uninit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1287,7 +1287,7 @@ impl<T, const N: usize> MaybeUninit<[T; N]> {
#[inline]
pub const fn transpose(self) -> [MaybeUninit<T>; N] {
// SAFETY: T and MaybeUninit<T> have the same layout
unsafe { super::transmute_copy(&ManuallyDrop::new(self)) }
unsafe { intrinsics::transmute_unchecked(self) }
}
}

Expand All @@ -1307,6 +1307,6 @@ impl<T, const N: usize> [MaybeUninit<T>; N] {
#[inline]
pub const fn transpose(self) -> MaybeUninit<[T; N]> {
// SAFETY: T and MaybeUninit<T> have the same layout
unsafe { super::transmute_copy(&ManuallyDrop::new(self)) }
unsafe { intrinsics::transmute_unchecked(self) }
}
}
18 changes: 7 additions & 11 deletions library/core/src/tuple.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// See src/libstd/primitive_docs.rs for documentation.

use crate::cmp::Ordering::{self, *};
use crate::mem::transmute;

// Recursive macro for implementing n-ary tuple functions and operations
//
Expand Down Expand Up @@ -142,16 +141,13 @@ macro_rules! maybe_tuple_doc {
#[inline]
const fn ordering_is_some(c: Option<Ordering>, x: Ordering) -> bool {
// FIXME: Just use `==` once that's const-stable on `Option`s.
// This isn't using `match` because that optimizes worse due to
// making a two-step check (`Some` *then* the inner value).

// SAFETY: There's no public guarantee for `Option<Ordering>`,
// but we're core so we know that it's definitely a byte.
unsafe {
let c: i8 = transmute(c);
let x: i8 = transmute(Some(x));
c == x
}
// This is mapping `None` to 2 and then doing the comparison afterwards
// because it optimizes better (`None::<Ordering>` is represented as 2).
x as i8
== match c {
Some(c) => c as i8,
None => 2,
}
}

// Constructs an expression that performs a lexical ordering using method `$rel`.
Expand Down