Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
c8663ee
Introduce CoerceShared lang item and trait
aapoalas Aug 29, 2025
fce8c13
Add reborrow CoerceShared feature gate test
aapoalas Aug 29, 2025
35bae9d
Introduce basic Reborrow tests
aapoalas Aug 30, 2025
c4a87eb
fix: Move CoerceShared into ops
aapoalas Sep 15, 2025
e32b975
tests: relax expectations after llvm change 902ddda120a5
durin42 Sep 18, 2025
9877b26
Correctly display merged doctest compilation time
GuillaumeGomez Sep 25, 2025
7a9b6d9
PassWrapper: update for new PGOOptions args in LLVM 22
durin42 Sep 25, 2025
68c0e97
re-order normalizations in run-make linker-warning test
Fabian-Gruenbichler Sep 25, 2025
c0e0d4b
Make `def_path_hash_to_def_id` not panic when passed an invalid hash
Lysxia Sep 26, 2025
4c7292a
PassWrapper: drop unused variable for LLVM 22+
durin42 Sep 26, 2025
99456cc
tests: use max-llvm-major-version instead of ignore-llvm-version
durin42 Sep 26, 2025
2e904c4
update issue number for more_float_constants
joshuarayton Sep 26, 2025
c0de794
std::net: update tcp deferaccept delay type to Duration.
devnexen Apr 29, 2025
852aa20
Rename `rust.use-lld` to `rust.bootstrap-override-lld`
Kobzol Sep 25, 2025
bd860bd
Fix typo in LLVM_VERSION_ macro use
durin42 Sep 26, 2025
b7e444d
Add regression test for merged doctests compilation time display
GuillaumeGomez Sep 25, 2025
e88fa08
move Reborrow to ops, fix fmt issues
aapoalas Sep 26, 2025
186eec8
Rollup merge of #140482 - devnexen:tcp_deferaccept_toduration, r=joboet
GuillaumeGomez Sep 27, 2025
4bc0eb1
Rollup merge of #146037 - aapoalas:reborrow-lang-experiment, r=tmandry
GuillaumeGomez Sep 27, 2025
1e86f72
Rollup merge of #146732 - durin42:llvm-22-less-assumes, r=nikic
GuillaumeGomez Sep 27, 2025
ec55150
Rollup merge of #147018 - Fabian-Gruenbichler:mr/fix-linker-warning-t…
GuillaumeGomez Sep 27, 2025
e97b75f
Rollup merge of #147032 - GuillaumeGomez:fix-doctest-compilation-time…
GuillaumeGomez Sep 27, 2025
6d2310a
Rollup merge of #147046 - Kobzol:bootstrap-ll, r=jieyouxu
GuillaumeGomez Sep 27, 2025
7a66da9
Rollup merge of #147050 - durin42:llvm-22-pgo-options-args, r=cuviper
GuillaumeGomez Sep 27, 2025
aad3956
Rollup merge of #147075 - Lysxia:no-panic-def-path-hash, r=petrochenkov
GuillaumeGomez Sep 27, 2025
bd7e79f
Rollup merge of #147076 - joshuarayton:more-float-constants-issue, r=…
GuillaumeGomez Sep 27, 2025
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
move Reborrow to ops, fix fmt issues
  • Loading branch information
aapoalas committed Sep 26, 2025
commit e88fa086fb597041a207a9bb5df0654628d57b1a
8 changes: 0 additions & 8 deletions library/core/src/marker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1364,11 +1364,3 @@ pub macro CoercePointee($item:item) {
pub trait CoercePointeeValidated {
/* compiler built-in */
}

/// Allows value to be reborrowed as exclusive, creating a copy of the value
/// that disables the source for reads and writes for the lifetime of the copy.
#[lang = "reborrow"]
#[unstable(feature = "reborrow", issue = "145612")]
pub trait Reborrow {
// Empty.
}
2 changes: 1 addition & 1 deletion library/core/src/ops/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ pub use self::range::{OneSidedRange, OneSidedRangeBound};
#[stable(feature = "rust1", since = "1.0.0")]
pub use self::range::{Range, RangeFrom, RangeFull, RangeTo};
#[unstable(feature = "reborrow", issue = "145612")]
pub use self::reborrow::CoerceShared;
pub use self::reborrow::{CoerceShared, Reborrow};
#[unstable(feature = "try_trait_v2_residual", issue = "91285")]
pub use self::try_trait::Residual;
#[unstable(feature = "try_trait_v2_yeet", issue = "96374")]
Expand Down
8 changes: 7 additions & 1 deletion library/core/src/ops/reborrow.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
use crate::marker::Reborrow;
/// Allows value to be reborrowed as exclusive, creating a copy of the value
/// that disables the source for reads and writes for the lifetime of the copy.
#[lang = "reborrow"]
#[unstable(feature = "reborrow", issue = "145612")]
pub trait Reborrow {
// Empty.
}

/// Allows reborrowable value to be reborrowed as shared, creating a copy
/// that disables the source for writes for the lifetime of the copy.
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/feature-gates/feature-gate-reborrow.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
use std::marker::Reborrow; //~ ERROR use of unstable library feature `reborrow`
use std::ops::Reborrow; //~ ERROR use of unstable library feature `reborrow`

fn main() {}
4 changes: 2 additions & 2 deletions tests/ui/feature-gates/feature-gate-reborrow.stderr
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
error[E0658]: use of unstable library feature `reborrow`
--> $DIR/feature-gate-reborrow.rs:1:5
|
LL | use std::marker::Reborrow;
| ^^^^^^^^^^^^^^^^^^^^^
LL | use std::ops::Reborrow;
| ^^^^^^^^^^^^^^^^^^
|
= note: see issue #145612 <https://github.com/rust-lang/rust/issues/145612> for more information
= help: add `#![feature(reborrow)]` to the crate attributes to enable
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/reborrow/custom_mut.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#![feature(reborrow)]
use std::marker::Reborrow;
use std::ops::Reborrow;

struct CustomMut<'a, T>(&'a mut T);
impl<'a, T> Reborrow for CustomMut<'a, T> {}
Expand Down
3 changes: 1 addition & 2 deletions tests/ui/reborrow/custom_mut_coerce_shared.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#![feature(reborrow)]
use std::marker::Reborrow;
use std::ops::CoerceShared;
use std::ops::{CoerceShared, Reborrow};

struct CustomMut<'a, T>(&'a mut T);
impl<'a, T> Reborrow for CustomMut<'a, T> {}
Expand Down
4 changes: 2 additions & 2 deletions tests/ui/reborrow/custom_mut_coerce_shared.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error[E0308]: mismatched types
--> $DIR/custom_mut_coerce_shared.rs:24:12
--> $DIR/custom_mut_coerce_shared.rs:23:12
|
LL | method(a);
| ------ ^ expected `CustomRef<'_, ()>`, found `CustomMut<'_, ()>`
Expand All @@ -9,7 +9,7 @@ LL | method(a);
= note: expected struct `CustomRef<'_, ()>`
found struct `CustomMut<'_, ()>`
note: function defined here
--> $DIR/custom_mut_coerce_shared.rs:20:4
--> $DIR/custom_mut_coerce_shared.rs:19:4
|
LL | fn method(a: CustomRef<'_, ()>) {}
| ^^^^^^ --------------------
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/reborrow/option_mut.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
fn method(a: Option<& mut ()>) {}
fn method(a: Option<&mut ()>) {}

fn main() {
let a = Some(&mut ());
Expand Down
4 changes: 2 additions & 2 deletions tests/ui/reborrow/option_mut.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ LL | let _ = method(a);
note: consider changing this parameter type in function `method` to borrow instead if owning the value isn't necessary
--> $DIR/option_mut.rs:1:14
|
LL | fn method(a: Option<& mut ()>) {}
| ------ ^^^^^^^^^^^^^^^^ this parameter takes ownership of the value
LL | fn method(a: Option<&mut ()>) {}
| ------ ^^^^^^^^^^^^^^^ this parameter takes ownership of the value
| |
| in this function

Expand Down
2 changes: 1 addition & 1 deletion tests/ui/reborrow/pin_mut.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::pin::Pin;

fn method(a: Pin<& mut ()>) {}
fn method(a: Pin<&mut ()>) {}

fn main() {
let a = &mut ();
Expand Down
4 changes: 2 additions & 2 deletions tests/ui/reborrow/pin_mut.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ LL | let _ = method(a);
note: consider changing this parameter type in function `method` to borrow instead if owning the value isn't necessary
--> $DIR/pin_mut.rs:3:14
|
LL | fn method(a: Pin<& mut ()>) {}
| ------ ^^^^^^^^^^^^^ this parameter takes ownership of the value
LL | fn method(a: Pin<&mut ()>) {}
| ------ ^^^^^^^^^^^^ this parameter takes ownership of the value
| |
| in this function

Expand Down
1 change: 0 additions & 1 deletion tests/ui/reborrow/pin_mut_coerce_shared.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,4 @@ fn main() {
//~| NOTE arguments to this function are incorrect
//~| NOTE types differ in mutability
//~| NOTE expected struct `Pin<&()>`
//~| NOTE found struct `Pin<&mut ()>`
}
Loading