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 9 pull requests #101016

Closed
wants to merge 23 commits into from
Closed
Changes from 3 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
54d35e7
distinguish the method and associated function diagnostic information
Jul 8, 2022
97c963d
make slice::{split_at,split_at_unchecked} const functions
tspiteri Aug 2, 2022
e4a4246
const_prop_lint: Consider array length constant even if array is not
TheWastl Jun 24, 2022
83f081f
Remove unstable Result::into_ok_or_err
dtolnay Aug 15, 2022
39809c5
Replace a try_fold in rustc_transmute to use ControlFlow instead of R…
dtolnay Aug 15, 2022
289d7cc
Reduce code size of `assert_matches_failed`
a1phyr Aug 23, 2022
b997af9
Handle `Err` in `ast::LitKind::to_token_lit`.
nnethercote Aug 24, 2022
31d892a
Fix liveness analysis for yield terminators
tmiasko Aug 1, 2022
4462b4a
Elaborate all box dereferences in `ElaborateBoxDerefs`
tmiasko Aug 1, 2022
58eabb2
Add method that applies DefUse effect
tmiasko Aug 25, 2022
4394ea8
Inline trivial `From<Local> for Place<'_>` impl
tmiasko Aug 25, 2022
bc3d719
review
tspiteri Aug 25, 2022
45cc8cb
rustdoc: remove unused CSS for `.multi-column`
notriddle Aug 25, 2022
258d367
Adding support for rustc_serialize encode and decode for Box and Vec …
Aug 25, 2022
2c5e159
Rollup merge of #99064 - lyming2007:issue-97687-fix, r=estebank
JohnTitor Aug 25, 2022
5b4739e
Rollup merge of #99920 - emarteca:custom-allocator-support, r=oli-obk
JohnTitor Aug 25, 2022
a48a13d
Rollup merge of #100034 - tmiasko:elaborate-box-derefs, r=oli-obk
JohnTitor Aug 25, 2022
5759a97
Rollup merge of #100076 - tspiteri:const_slice_split_at, r=oli-obk
JohnTitor Aug 25, 2022
911878e
Rollup merge of #100160 - TheWastl:issue-98444-const_prop_lint, r=oli…
JohnTitor Aug 25, 2022
6da589b
Rollup merge of #100604 - dtolnay:okorerr, r=m-ou-se
JohnTitor Aug 25, 2022
001e90d
Rollup merge of #100933 - a1phyr:cheap_assert_match_failed, r=JoshTri…
JohnTitor Aug 25, 2022
1418237
Rollup merge of #100978 - nnethercote:fix-100948, r=petrochenkov
JohnTitor Aug 25, 2022
f2521bb
Rollup merge of #101010 - notriddle:notriddle/multi-column, r=jsha
JohnTitor Aug 25, 2022
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
Original file line number Diff line number Diff line change
@@ -14,7 +14,6 @@ index 06c7be0..359e2e7 100644
@@ -75,7 +75,6 @@
#![feature(never_type)]
#![feature(unwrap_infallible)]
#![feature(result_into_ok_or_err)]
-#![feature(portable_simd)]
#![feature(ptr_metadata)]
#![feature(once_cell)]
18 changes: 10 additions & 8 deletions compiler/rustc_transmute/src/layout/tree.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use super::{Byte, Def, Ref};
use std::ops::ControlFlow;

#[cfg(test)]
mod tests;
@@ -86,17 +87,18 @@ where
F: Fn(D) -> bool,
{
match self {
Self::Seq(elts) => elts
.into_iter()
.map(|elt| elt.prune(f))
.try_fold(Tree::unit(), |elts, elt| {
Self::Seq(elts) => match elts.into_iter().map(|elt| elt.prune(f)).try_fold(
Tree::unit(),
|elts, elt| {
if elt == Tree::uninhabited() {
Err(Tree::uninhabited())
ControlFlow::Break(Tree::uninhabited())
} else {
Ok(elts.then(elt))
ControlFlow::Continue(elts.then(elt))
}
})
.into_ok_or_err(),
},
) {
ControlFlow::Break(node) | ControlFlow::Continue(node) => node,
},
Self::Alt(alts) => alts
.into_iter()
.map(|alt| alt.prune(f))
9 changes: 1 addition & 8 deletions compiler/rustc_transmute/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
#![feature(
alloc_layout_extra,
control_flow_enum,
decl_macro,
iterator_try_reduce,
never_type,
result_into_ok_or_err
)]
#![feature(alloc_layout_extra, control_flow_enum, decl_macro, iterator_try_reduce, never_type)]
#![allow(dead_code, unused_variables)]
#![deny(rustc::untranslatable_diagnostic)]
#![deny(rustc::diagnostic_outside_of_impl)]
34 changes: 0 additions & 34 deletions library/core/src/result.rs
Original file line number Diff line number Diff line change
@@ -1776,40 +1776,6 @@ impl<T, E> Result<Result<T, E>, E> {
}
}

impl<T> Result<T, T> {
/// Returns the [`Ok`] value if `self` is `Ok`, and the [`Err`] value if
/// `self` is `Err`.
///
/// In other words, this function returns the value (the `T`) of a
/// `Result<T, T>`, regardless of whether or not that result is `Ok` or
/// `Err`.
///
/// This can be useful in conjunction with APIs such as
/// [`Atomic*::compare_exchange`], or [`slice::binary_search`], but only in
/// cases where you don't care if the result was `Ok` or not.
///
/// [`Atomic*::compare_exchange`]: crate::sync::atomic::AtomicBool::compare_exchange
///
/// # Examples
///
/// ```
/// #![feature(result_into_ok_or_err)]
/// let ok: Result<u32, u32> = Ok(3);
/// let err: Result<u32, u32> = Err(4);
///
/// assert_eq!(ok.into_ok_or_err(), 3);
/// assert_eq!(err.into_ok_or_err(), 4);
/// ```
#[inline]
#[unstable(feature = "result_into_ok_or_err", reason = "newly added", issue = "82223")]
pub const fn into_ok_or_err(self) -> T {
match self {
Ok(v) => v,
Err(v) => v,
}
}
}

// This is a separate function to reduce the code size of the methods
#[cfg(not(feature = "panic_immediate_abort"))]
#[inline(never)]
1 change: 0 additions & 1 deletion library/core/tests/lib.rs
Original file line number Diff line number Diff line change
@@ -75,7 +75,6 @@
#![feature(const_pin)]
#![feature(never_type)]
#![feature(unwrap_infallible)]
#![feature(result_into_ok_or_err)]
#![feature(pointer_byte_offsets)]
#![feature(portable_simd)]
#![feature(ptr_metadata)]
9 changes: 0 additions & 9 deletions library/core/tests/result.rs
Original file line number Diff line number Diff line change
@@ -95,15 +95,6 @@ fn test_unwrap_or() {
assert_eq!(ok_err.unwrap_or(50), 50);
}

#[test]
fn test_ok_or_err() {
let ok: Result<isize, isize> = Ok(100);
let err: Result<isize, isize> = Err(200);

assert_eq!(ok.into_ok_or_err(), 100);
assert_eq!(err.into_ok_or_err(), 200);
}

#[test]
fn test_unwrap_or_else() {
fn handler(msg: &'static str) -> isize {