Skip to content

Commit 1350eea

Browse files
committed
Auto merge of #131887 - jieyouxu:rollup-ftik4ni, r=jieyouxu
Rollup of 9 pull requests Successful merges: - #130136 (Partially stabilize const_pin) - #131755 (Regression test for AVR `rjmp` offset) - #131774 (Add getentropy for RTEMS) - #131802 (Dont ICE when computing coverage of synthetic async closure body) - #131809 (Fix predicate signatures in retain_mut docs) - #131858 (Remove outdated documentation for `repeat_n`) - #131866 (Avoid use imports in `thread_local_inner!`) - #131874 (Default to the medium code model on OpenHarmony LoongArch target) - #131877 (checktools.sh: add link to issue for more context about disabled Miri tests) r? `@ghost` `@rustbot` modify labels: rollup
2 parents acfdb8d + 80a8f7b commit 1350eea

File tree

26 files changed

+287
-60
lines changed

26 files changed

+287
-60
lines changed

compiler/rustc_middle/src/query/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -570,6 +570,7 @@ rustc_queries! {
570570
/// either `#[coverage(on)]` or no coverage attribute was found.
571571
query coverage_attr_on(key: LocalDefId) -> bool {
572572
desc { |tcx| "checking for `#[coverage(..)]` on `{}`", tcx.def_path_str(key) }
573+
feedable
573574
}
574575

575576
/// Summarizes coverage IDs inserted by the `InstrumentCoverage` MIR pass

compiler/rustc_mir_transform/src/coroutine/by_move_body.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,7 @@ pub(crate) fn coroutine_by_move_body_def_id<'tcx>(
223223

224224
// Inherited from the by-ref coroutine.
225225
body_def.codegen_fn_attrs(tcx.codegen_fn_attrs(coroutine_def_id).clone());
226+
body_def.coverage_attr_on(tcx.coverage_attr_on(coroutine_def_id));
226227
body_def.constness(tcx.constness(coroutine_def_id));
227228
body_def.coroutine_kind(tcx.coroutine_kind(coroutine_def_id));
228229
body_def.def_ident_span(tcx.def_ident_span(coroutine_def_id));

compiler/rustc_mir_transform/src/coverage/mod.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -524,6 +524,11 @@ fn extract_hir_info<'tcx>(tcx: TyCtxt<'tcx>, def_id: LocalDefId) -> ExtractedHir
524524
// FIXME(#79625): Consider improving MIR to provide the information needed, to avoid going back
525525
// to HIR for it.
526526

527+
// HACK: For synthetic MIR bodies (async closures), use the def id of the HIR body.
528+
if tcx.is_synthetic_mir(def_id) {
529+
return extract_hir_info(tcx, tcx.local_parent(def_id));
530+
}
531+
527532
let hir_node = tcx.hir_node_by_def_id(def_id);
528533
let fn_body_id = hir_node.body_id().expect("HIR node is a function with body");
529534
let hir_body = tcx.hir().body(fn_body_id);

compiler/rustc_target/src/spec/targets/loongarch64_unknown_linux_ohos.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::spec::{SanitizerSet, Target, TargetOptions, base};
1+
use crate::spec::{CodeModel, SanitizerSet, Target, TargetOptions, base};
22

33
pub(crate) fn target() -> Target {
44
Target {
@@ -13,6 +13,7 @@ pub(crate) fn target() -> Target {
1313
data_layout: "e-m:e-p:64:64-i64:64-i128:128-n32:64-S128".into(),
1414
arch: "loongarch64".into(),
1515
options: TargetOptions {
16+
code_model: Some(CodeModel::Medium),
1617
cpu: "generic".into(),
1718
features: "+f,+d".into(),
1819
llvm_abiname: "lp64d".into(),

library/alloc/src/collections/linked_list.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1082,7 +1082,7 @@ impl<T, A: Allocator> LinkedList<T, A> {
10821082

10831083
/// Retains only the elements specified by the predicate.
10841084
///
1085-
/// In other words, remove all elements `e` for which `f(&e)` returns false.
1085+
/// In other words, remove all elements `e` for which `f(&mut e)` returns false.
10861086
/// This method operates in place, visiting each element exactly once in the
10871087
/// original order, and preserves the order of the retained elements.
10881088
///

library/alloc/src/collections/vec_deque/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2122,7 +2122,7 @@ impl<T, A: Allocator> VecDeque<T, A> {
21222122

21232123
/// Retains only the elements specified by the predicate.
21242124
///
2125-
/// In other words, remove all elements `e` for which `f(&e)` returns false.
2125+
/// In other words, remove all elements `e` for which `f(&mut e)` returns false.
21262126
/// This method operates in place, visiting each element exactly once in the
21272127
/// original order, and preserves the order of the retained elements.
21282128
///

library/alloc/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,6 @@
112112
#![feature(const_eval_select)]
113113
#![feature(const_heap)]
114114
#![feature(const_maybe_uninit_write)]
115-
#![feature(const_pin)]
116115
#![feature(const_size_of_val)]
117116
#![feature(const_vec_string_slice)]
118117
#![feature(core_intrinsics)]

library/core/src/iter/sources/repeat_n.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@ use crate::num::NonZero;
88
/// The `repeat_n()` function repeats a single value exactly `n` times.
99
///
1010
/// This is very similar to using [`repeat()`] with [`Iterator::take()`],
11-
/// but there are two differences:
12-
/// - `repeat_n()` can return the original value, rather than always cloning.
13-
/// - `repeat_n()` produces an [`ExactSizeIterator`].
11+
/// but `repeat_n()` can return the original value, rather than always cloning.
1412
///
1513
/// [`repeat()`]: crate::iter::repeat
1614
///

library/core/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@
129129
#![feature(const_nonnull_new)]
130130
#![feature(const_num_midpoint)]
131131
#![feature(const_option_ext)]
132-
#![feature(const_pin)]
132+
#![feature(const_pin_2)]
133133
#![feature(const_pointer_is_aligned)]
134134
#![feature(const_ptr_is_null)]
135135
#![feature(const_ptr_sub_ptr)]

library/core/src/pin.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1186,7 +1186,7 @@ impl<Ptr: Deref<Target: Unpin>> Pin<Ptr> {
11861186
/// let mut pinned: Pin<&mut u8> = Pin::new(&mut val);
11871187
/// ```
11881188
#[inline(always)]
1189-
#[rustc_const_unstable(feature = "const_pin", issue = "76654")]
1189+
#[rustc_const_stable(feature = "const_pin", since = "CURRENT_RUSTC_VERSION")]
11901190
#[stable(feature = "pin", since = "1.33.0")]
11911191
pub const fn new(pointer: Ptr) -> Pin<Ptr> {
11921192
// SAFETY: the value pointed to is `Unpin`, and so has no requirements
@@ -1214,7 +1214,7 @@ impl<Ptr: Deref<Target: Unpin>> Pin<Ptr> {
12141214
/// assert_eq!(*r, 5);
12151215
/// ```
12161216
#[inline(always)]
1217-
#[rustc_const_unstable(feature = "const_pin", issue = "76654")]
1217+
#[rustc_const_unstable(feature = "const_pin_2", issue = "76654")]
12181218
#[stable(feature = "pin_into_inner", since = "1.39.0")]
12191219
pub const fn into_inner(pin: Pin<Ptr>) -> Ptr {
12201220
pin.__pointer
@@ -1351,7 +1351,7 @@ impl<Ptr: Deref> Pin<Ptr> {
13511351
/// [`pin` module docs]: self
13521352
#[lang = "new_unchecked"]
13531353
#[inline(always)]
1354-
#[rustc_const_unstable(feature = "const_pin", issue = "76654")]
1354+
#[rustc_const_stable(feature = "const_pin", since = "CURRENT_RUSTC_VERSION")]
13551355
#[stable(feature = "pin", since = "1.33.0")]
13561356
pub const unsafe fn new_unchecked(pointer: Ptr) -> Pin<Ptr> {
13571357
Pin { __pointer: pointer }
@@ -1503,7 +1503,7 @@ impl<Ptr: Deref> Pin<Ptr> {
15031503
/// If the underlying data is [`Unpin`], [`Pin::into_inner`] should be used
15041504
/// instead.
15051505
#[inline(always)]
1506-
#[rustc_const_unstable(feature = "const_pin", issue = "76654")]
1506+
#[rustc_const_unstable(feature = "const_pin_2", issue = "76654")]
15071507
#[stable(feature = "pin_into_inner", since = "1.39.0")]
15081508
pub const unsafe fn into_inner_unchecked(pin: Pin<Ptr>) -> Ptr {
15091509
pin.__pointer
@@ -1559,7 +1559,7 @@ impl<'a, T: ?Sized> Pin<&'a T> {
15591559
/// ["pinning projections"]: self#projections-and-structural-pinning
15601560
#[inline(always)]
15611561
#[must_use]
1562-
#[rustc_const_unstable(feature = "const_pin", issue = "76654")]
1562+
#[rustc_const_stable(feature = "const_pin", since = "CURRENT_RUSTC_VERSION")]
15631563
#[stable(feature = "pin", since = "1.33.0")]
15641564
pub const fn get_ref(self) -> &'a T {
15651565
self.__pointer
@@ -1570,7 +1570,7 @@ impl<'a, T: ?Sized> Pin<&'a mut T> {
15701570
/// Converts this `Pin<&mut T>` into a `Pin<&T>` with the same lifetime.
15711571
#[inline(always)]
15721572
#[must_use = "`self` will be dropped if the result is not used"]
1573-
#[rustc_const_unstable(feature = "const_pin", issue = "76654")]
1573+
#[rustc_const_stable(feature = "const_pin", since = "CURRENT_RUSTC_VERSION")]
15741574
#[stable(feature = "pin", since = "1.33.0")]
15751575
pub const fn into_ref(self) -> Pin<&'a T> {
15761576
Pin { __pointer: self.__pointer }
@@ -1588,7 +1588,7 @@ impl<'a, T: ?Sized> Pin<&'a mut T> {
15881588
#[inline(always)]
15891589
#[must_use = "`self` will be dropped if the result is not used"]
15901590
#[stable(feature = "pin", since = "1.33.0")]
1591-
#[rustc_const_unstable(feature = "const_pin", issue = "76654")]
1591+
#[rustc_const_stable(feature = "const_pin", since = "CURRENT_RUSTC_VERSION")]
15921592
pub const fn get_mut(self) -> &'a mut T
15931593
where
15941594
T: Unpin,
@@ -1609,7 +1609,7 @@ impl<'a, T: ?Sized> Pin<&'a mut T> {
16091609
#[inline(always)]
16101610
#[must_use = "`self` will be dropped if the result is not used"]
16111611
#[stable(feature = "pin", since = "1.33.0")]
1612-
#[rustc_const_unstable(feature = "const_pin", issue = "76654")]
1612+
#[rustc_const_stable(feature = "const_pin", since = "CURRENT_RUSTC_VERSION")]
16131613
pub const unsafe fn get_unchecked_mut(self) -> &'a mut T {
16141614
self.__pointer
16151615
}
@@ -1652,7 +1652,7 @@ impl<T: ?Sized> Pin<&'static T> {
16521652
/// This is safe because `T` is borrowed immutably for the `'static` lifetime, which
16531653
/// never ends.
16541654
#[stable(feature = "pin_static_ref", since = "1.61.0")]
1655-
#[rustc_const_unstable(feature = "const_pin", issue = "76654")]
1655+
#[rustc_const_stable(feature = "const_pin", since = "CURRENT_RUSTC_VERSION")]
16561656
pub const fn static_ref(r: &'static T) -> Pin<&'static T> {
16571657
// SAFETY: The 'static borrow guarantees the data will not be
16581658
// moved/invalidated until it gets dropped (which is never).
@@ -1666,7 +1666,7 @@ impl<T: ?Sized> Pin<&'static mut T> {
16661666
/// This is safe because `T` is borrowed for the `'static` lifetime, which
16671667
/// never ends.
16681668
#[stable(feature = "pin_static_ref", since = "1.61.0")]
1669-
#[rustc_const_unstable(feature = "const_pin", issue = "76654")]
1669+
#[rustc_const_stable(feature = "const_pin", since = "CURRENT_RUSTC_VERSION")]
16701670
pub const fn static_mut(r: &'static mut T) -> Pin<&'static mut T> {
16711671
// SAFETY: The 'static borrow guarantees the data will not be
16721672
// moved/invalidated until it gets dropped (which is never).

0 commit comments

Comments
 (0)