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
fix: Move CoerceShared into ops
  • Loading branch information
aapoalas committed Sep 15, 2025
commit c4a87eb62cd74e31e5d3889741a76a4bb2a48ed6
9 changes: 0 additions & 9 deletions library/core/src/marker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1372,12 +1372,3 @@ pub trait CoercePointeeValidated {
pub trait Reborrow {
// Empty.
}

/// Allows reborrowable value to be reborrowed as shared, creating a copy of
/// that disables the source for writes for the lifetime of the copy.
#[lang = "coerce_shared"]
#[unstable(feature = "reborrow", issue = "145612")]
pub trait CoerceShared: Reborrow {
/// The type of this value when reborrowed as shared.
type Target: Copy;
}
3 changes: 3 additions & 0 deletions library/core/src/ops/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ mod function;
mod index;
mod index_range;
mod range;
mod reborrow;
mod try_trait;
mod unsize;

Expand Down Expand Up @@ -189,6 +190,8 @@ pub use self::range::{Bound, RangeBounds, RangeInclusive, RangeToInclusive};
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;
#[unstable(feature = "try_trait_v2_residual", issue = "91285")]
pub use self::try_trait::Residual;
#[unstable(feature = "try_trait_v2_yeet", issue = "96374")]
Expand Down
10 changes: 10 additions & 0 deletions library/core/src/ops/reborrow.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
use crate::marker::Reborrow;

/// Allows reborrowable value to be reborrowed as shared, creating a copy
/// that disables the source for writes for the lifetime of the copy.
#[lang = "coerce_shared"]
#[unstable(feature = "reborrow", issue = "145612")]
pub trait CoerceShared: Reborrow {
/// The type of this value when reborrowed as shared.
type Target: Copy;
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
use std::marker::CoerceShared; //~ ERROR use of unstable library feature `reborrow`
use std::ops::CoerceShared; //~ ERROR use of unstable library feature `reborrow`

fn main() {}
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-coerce-shared.rs:1:5
|
LL | use std::marker::CoerceShared;
| ^^^^^^^^^^^^^^^^^^^^^^^^^
LL | use std::ops::CoerceShared;
| ^^^^^^^^^^^^^^^^^^^^^^
|
= 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
3 changes: 2 additions & 1 deletion tests/ui/reborrow/custom_mut_coerce_shared.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#![feature(reborrow)]
use std::marker::{Reborrow, CoerceShared};
use std::marker::Reborrow;
use std::ops::CoerceShared;

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:23:12
--> $DIR/custom_mut_coerce_shared.rs:24: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:19:4
--> $DIR/custom_mut_coerce_shared.rs:20:4
|
LL | fn method(a: CustomRef<'_, ()>) {}
| ^^^^^^ --------------------
Expand Down
Loading