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 13 pull requests #77040

Closed
wants to merge 41 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
41 commits
Select commit Hold shift click to select a range
c5975e9
Reduce duplicate in liballoc reserve error handling
pickfire Aug 4, 2020
28db521
More implementations of Write for immutable refs
Sep 2, 2020
ec7f9b9
Deduplicates io::Write implementations
Sep 11, 2020
8f27e3c
Make some methods of `Pin` unstable const
CDirkx Sep 12, 2020
eede953
Only get ImplKind::Impl once
tesuji Sep 10, 2020
ed6c7ef
Use enum for status of non-const ops
ecstatic-morse Sep 2, 2020
c3607bd
Use helper function for searching `allow_internal_unstable`
ecstatic-morse Sep 2, 2020
e4edc16
Give name to extra `Span` in `LiveDrop` error
ecstatic-morse Sep 2, 2020
81b3b66
Error if an unstable const eval feature is used in a stable const fn
ecstatic-morse Sep 3, 2020
1e1257b
Bless `miri-unleashed` tests
ecstatic-morse Sep 16, 2020
abc7167
Test that `const_precise_live_drops` can't be depended upon stably
ecstatic-morse Sep 16, 2020
e3c6e46
Make some methods of `Pin<&mut T>` unstable const
CDirkx Sep 18, 2020
f7d5080
don't take `TyCtxt` by reference
lcnr Sep 18, 2020
a219ad6
extend `is_ty_or_ty_ctxt` to self types
lcnr Sep 19, 2020
67f319c
take `TyCtxt` by value
lcnr Sep 19, 2020
2a00dda
miri: correctly deal with `ConstKind::Bound`
lcnr Sep 10, 2020
6734230
do not ICE on `ty::Bound` in Layout::compute
lcnr Sep 11, 2020
65b3419
update stderr file
lcnr Sep 20, 2020
c690c82
use if let instead of single match arm expressions to compact code an…
matthiaskrgr Sep 18, 2020
88a29e6
Updates stability attributes to the current nightly version
Sep 21, 2020
0acb0ed
Update library/std/src/process.rs
FedericoPonzi Sep 21, 2020
60b102d
Don't recommend ManuallyDrop to customize drop order
matklad Aug 31, 2020
b4b4a2f
Reduce boilerplate for BytePos and CharPos
Juici Sep 21, 2020
8fc782a
add test
lcnr Sep 21, 2020
9a1f177
Remove cast to usize for BytePos and CharPos
Juici Sep 21, 2020
63195ec
Add explanation for E0756
GuillaumeGomez Sep 8, 2020
f5d71a9
Don't use `zip` to compare iterators during pretty-print hack
Aaron1011 Aug 30, 2020
d452744
lint missing docs for extern items
lcnr Sep 21, 2020
851ce56
Rollup merge of #72734 - pickfire:liballoc, r=KodrAus
ecstatic-morse Sep 22, 2020
46ef65c
Rollup merge of #76131 - Aaron1011:fix/pretty-print-zip, r=lcnr
ecstatic-morse Sep 22, 2020
17f9928
Rollup merge of #76150 - matklad:droporder, r=withoutboats
ecstatic-morse Sep 22, 2020
cc99c2a
Rollup merge of #76275 - FedericoPonzi:immutable-write-impl-73836, r=…
ecstatic-morse Sep 22, 2020
fe6ab6c
Rollup merge of #76489 - GuillaumeGomez:add-explanation-e0756, r=jyn514
ecstatic-morse Sep 22, 2020
bc90edf
Rollup merge of #76581 - lcnr:bound-too-generic, r=eddyb
ecstatic-morse Sep 22, 2020
2776eb8
Rollup merge of #76655 - CDirkx:const-pin, r=ecstatic-morse
ecstatic-morse Sep 22, 2020
d55b6e8
Rollup merge of #76783 - lzutao:rd_impl_kind, r=GuillaumeGomez
ecstatic-morse Sep 22, 2020
3eb7818
Rollup merge of #76807 - ecstatic-morse:const-checking-staged-api, r=…
ecstatic-morse Sep 22, 2020
af279e1
Rollup merge of #76888 - matthiaskrgr:clippy_single_match_2, r=Dylan-DPC
ecstatic-morse Sep 22, 2020
a6d4bf7
Rollup merge of #76914 - lcnr:path-no-more, r=ecstatic-morse
ecstatic-morse Sep 22, 2020
9a1fa7d
Rollup merge of #77022 - Juici:master, r=lcnr
ecstatic-morse Sep 22, 2020
e146fcf
Rollup merge of #77032 - lcnr:visit-all-the-item-likes, r=davidtwco
ecstatic-morse Sep 22, 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 some methods of Pin<&mut T> unstable const
Make the following methods unstable const under the `const_pin` feature:
- `into_ref`
- `get_mut`
- `get_unchecked_mut`
  • Loading branch information
CDirkx committed Sep 18, 2020
commit e3c6e46168758642f0bab64da374f93ed21b1cd0
13 changes: 8 additions & 5 deletions library/core/src/pin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -708,8 708,9 @@ impl<'a, T: ?Sized> Pin<&'a T> {
impl<'a, T: ?Sized> Pin<&'a mut T> {
/// Converts this `Pin<&mut T>` into a `Pin<&T>` with the same lifetime.
#[inline(always)]
#[rustc_const_unstable(feature = "const_pin", issue = "76654")]
#[stable(feature = "pin", since = "1.33.0")]
pub fn into_ref(self) -> Pin<&'a T> {
pub const fn into_ref(self) -> Pin<&'a T> {
Pin { pointer: self.pointer }
}

Expand All @@ -722,9 723,10 @@ impl<'a, T: ?Sized> Pin<&'a mut T> {
/// that lives for as long as the borrow of the `Pin`, not the lifetime of
/// the `Pin` itself. This method allows turning the `Pin` into a reference
/// with the same lifetime as the original `Pin`.
#[stable(feature = "pin", since = "1.33.0")]
#[inline(always)]
pub fn get_mut(self) -> &'a mut T
#[stable(feature = "pin", since = "1.33.0")]
#[rustc_const_unstable(feature = "const_pin", issue = "76654")]
pub const fn get_mut(self) -> &'a mut T
where
T: Unpin,
{
Expand All @@ -741,9 743,10 @@ impl<'a, T: ?Sized> Pin<&'a mut T> {
///
/// If the underlying data is `Unpin`, `Pin::get_mut` should be used
/// instead.
#[stable(feature = "pin", since = "1.33.0")]
#[inline(always)]
pub unsafe fn get_unchecked_mut(self) -> &'a mut T {
#[stable(feature = "pin", since = "1.33.0")]
#[rustc_const_unstable(feature = "const_pin", issue = "76654")]
pub const unsafe fn get_unchecked_mut(self) -> &'a mut T {
self.pointer
}

Expand Down
1 change: 1 addition & 0 deletions library/core/tests/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 39,7 @@
#![feature(iter_order_by)]
#![feature(cmp_min_max_by)]
#![feature(iter_map_while)]
#![feature(const_mut_refs)]
#![feature(const_pin)]
#![feature(const_slice_from_raw_parts)]
#![feature(const_raw_ptr_deref)]
Expand Down
12 changes: 11 additions & 1 deletion library/core/tests/pin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 17,15 @@ fn pin_const() {
assert_eq!(INNER_UNCHECKED, POINTER);

const REF: &'static usize = PINNED.get_ref();
assert_eq!(REF, POINTER)
assert_eq!(REF, POINTER);

// Note: `pin_mut_const` tests that the methods of `Pin<&mut T>` are usable in a const context.
// A const fn is used because `&mut` is not (yet) usable in constants.
const fn pin_mut_const() {
let _ = Pin::new(&mut 2).into_ref();
let _ = Pin::new(&mut 2).get_mut();
let _ = unsafe { Pin::new(&mut 2).get_unchecked_mut() };
}

pin_mut_const();
}