Auto merge of #146830 - Zalathar:rollup-lj8jfok, r=Zalathar
Rollup of 8 pull requests Successful merges: - rust-lang/rust#140983 (Improve doc of some methods that take ranges) - rust-lang/rust#144091 (Stabilize `new_zeroed_alloc`) - rust-lang/rust#145664 (Stabilize `std::panic::Location::file_as_c_str`) - rust-lang/rust#146551 (fix issue with `cmse-nonsecure-entry` ABI being both async and c-variadic) - rust-lang/rust#146744 (Deref related cleanups in ref_prop) - rust-lang/rust#146793 (naked_asm: emit a label starting with `func_end`) - rust-lang/rust#146820 (Add unstable attribute to BTreeMap-related allocator generics) - rust-lang/rust#146822 (Fix old typo in lang_start_internal comment) r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
commit
dfa22235d8
23 changed files with 164 additions and 111 deletions
|
|
@ -228,6 +228,9 @@ fn prefix_and_suffix<'tcx>(
|
|||
writeln!(begin, "{asm_name}:").unwrap();
|
||||
|
||||
writeln!(end).unwrap();
|
||||
// emit a label starting with `func_end` for `cargo asm` and other tooling that might
|
||||
// pattern match on assembly generated by LLVM.
|
||||
writeln!(end, ".Lfunc_end_{asm_name}:").unwrap();
|
||||
writeln!(end, ".size {asm_name}, . - {asm_name}").unwrap();
|
||||
writeln!(end, ".popsection").unwrap();
|
||||
if !arch_suffix.is_empty() {
|
||||
|
|
@ -246,6 +249,7 @@ fn prefix_and_suffix<'tcx>(
|
|||
writeln!(begin, "{asm_name}:").unwrap();
|
||||
|
||||
writeln!(end).unwrap();
|
||||
writeln!(end, ".Lfunc_end_{asm_name}:").unwrap();
|
||||
writeln!(end, ".popsection").unwrap();
|
||||
if !arch_suffix.is_empty() {
|
||||
writeln!(end, "{}", arch_suffix).unwrap();
|
||||
|
|
@ -263,6 +267,7 @@ fn prefix_and_suffix<'tcx>(
|
|||
writeln!(begin, "{asm_name}:").unwrap();
|
||||
|
||||
writeln!(end).unwrap();
|
||||
writeln!(end, ".Lfunc_end_{asm_name}:").unwrap();
|
||||
writeln!(end, ".popsection").unwrap();
|
||||
if !arch_suffix.is_empty() {
|
||||
writeln!(end, "{}", arch_suffix).unwrap();
|
||||
|
|
@ -287,6 +292,7 @@ fn prefix_and_suffix<'tcx>(
|
|||
writeln!(end).unwrap();
|
||||
// .size is ignored for function symbols, so we can skip it
|
||||
writeln!(end, "end_function").unwrap();
|
||||
writeln!(end, ".Lfunc_end_{asm_name}:").unwrap();
|
||||
}
|
||||
BinaryFormat::Xcoff => {
|
||||
// the LLVM XCOFFAsmParser is extremely incomplete and does not implement many of the
|
||||
|
|
|
|||
|
|
@ -85,6 +85,12 @@ pub(crate) fn validate_cmse_abi<'tcx>(
|
|||
return;
|
||||
};
|
||||
|
||||
// An `extern "cmse-nonsecure-entry"` function cannot be c-variadic. We run
|
||||
// into https://github.com/rust-lang/rust/issues/132142 if we don't explicitly bail.
|
||||
if decl.c_variadic {
|
||||
return;
|
||||
}
|
||||
|
||||
match is_valid_cmse_inputs(tcx, fn_sig) {
|
||||
Ok(Ok(())) => {}
|
||||
Ok(Err(index)) => {
|
||||
|
|
|
|||
|
|
@ -645,7 +645,7 @@ impl<T: Idx> ChunkedBitSet<T> {
|
|||
};
|
||||
#[cfg(not(feature = "nightly"))]
|
||||
let mut words = {
|
||||
// FIXME: unconditionally use `Rc::new_zeroed` once it is stable (#63291).
|
||||
// FIXME: unconditionally use `Rc::new_zeroed` once it is stable (#129396).
|
||||
let words = mem::MaybeUninit::<[Word; CHUNK_WORDS]>::zeroed();
|
||||
// SAFETY: `words` can safely be all zeroes.
|
||||
let words = unsafe { words.assume_init() };
|
||||
|
|
@ -708,7 +708,7 @@ impl<T: Idx> ChunkedBitSet<T> {
|
|||
};
|
||||
#[cfg(not(feature = "nightly"))]
|
||||
let mut words = {
|
||||
// FIXME: unconditionally use `Rc::new_zeroed` once it is stable (#63291).
|
||||
// FIXME: unconditionally use `Rc::new_zeroed` once it is stable (#129396).
|
||||
let words = mem::MaybeUninit::<[Word; CHUNK_WORDS]>::zeroed();
|
||||
// SAFETY: `words` can safely be all zeroes.
|
||||
let words = unsafe { words.assume_init() };
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
// tidy-alphabetical-start
|
||||
#![cfg_attr(all(feature = "nightly", test), feature(stmt_expr_attributes))]
|
||||
#![cfg_attr(bootstrap, feature(new_zeroed_alloc))]
|
||||
#![cfg_attr(feature = "nightly", allow(internal_features))]
|
||||
#![cfg_attr(feature = "nightly", feature(extend_one, step_trait, test))]
|
||||
#![cfg_attr(feature = "nightly", feature(new_range_api))]
|
||||
#![cfg_attr(feature = "nightly", feature(new_zeroed_alloc))]
|
||||
// tidy-alphabetical-end
|
||||
|
||||
pub mod bit_set;
|
||||
|
|
|
|||
|
|
@ -195,10 +195,10 @@ fn compute_replacement<'tcx>(
|
|||
// including DEF. This violates the DEF dominates USE condition, and so is impossible.
|
||||
let is_constant_place = |place: Place<'_>| {
|
||||
// We only allow `Deref` as the first projection, to avoid surprises.
|
||||
if place.projection.first() == Some(&PlaceElem::Deref) {
|
||||
if let Some((&PlaceElem::Deref, rest)) = place.projection.split_first() {
|
||||
// `place == (*some_local).xxx`, it is constant only if `some_local` is constant.
|
||||
// We approximate constness using SSAness.
|
||||
ssa.is_ssa(place.local) && place.projection[1..].iter().all(PlaceElem::is_stable_offset)
|
||||
ssa.is_ssa(place.local) && rest.iter().all(PlaceElem::is_stable_offset)
|
||||
} else {
|
||||
storage_live.has_single_storage(place.local)
|
||||
&& place.projection[..].iter().all(PlaceElem::is_stable_offset)
|
||||
|
|
@ -206,7 +206,7 @@ fn compute_replacement<'tcx>(
|
|||
};
|
||||
|
||||
let mut can_perform_opt = |target: Place<'tcx>, loc: Location| {
|
||||
if target.projection.first() == Some(&PlaceElem::Deref) {
|
||||
if target.is_indirect_first_projection() {
|
||||
// We are creating a reborrow. As `place.local` is a reference, removing the storage
|
||||
// statements should not make it much harder for LLVM to optimize.
|
||||
storage_to_remove.insert(target.local);
|
||||
|
|
@ -266,7 +266,7 @@ fn compute_replacement<'tcx>(
|
|||
Rvalue::Ref(_, _, place) | Rvalue::RawPtr(_, place) => {
|
||||
let mut place = *place;
|
||||
// Try to see through `place` in order to collapse reborrow chains.
|
||||
if place.projection.first() == Some(&PlaceElem::Deref)
|
||||
if let Some((&PlaceElem::Deref, rest)) = place.projection.split_first()
|
||||
&& let Value::Pointer(target, inner_needs_unique) = targets[place.local]
|
||||
// Only see through immutable reference and pointers, as we do not know yet if
|
||||
// mutable references are fully replaced.
|
||||
|
|
@ -274,7 +274,7 @@ fn compute_replacement<'tcx>(
|
|||
// Only collapse chain if the pointee is definitely live.
|
||||
&& can_perform_opt(target, location)
|
||||
{
|
||||
place = target.project_deeper(&place.projection[1..], tcx);
|
||||
place = target.project_deeper(rest, tcx);
|
||||
}
|
||||
assert_ne!(place.local, local);
|
||||
if is_constant_place(place) {
|
||||
|
|
@ -323,7 +323,7 @@ fn compute_replacement<'tcx>(
|
|||
return;
|
||||
}
|
||||
|
||||
if place.projection.first() != Some(&PlaceElem::Deref) {
|
||||
if !place.is_indirect_first_projection() {
|
||||
// This is not a dereference, nothing to do.
|
||||
return;
|
||||
}
|
||||
|
|
@ -392,20 +392,15 @@ impl<'tcx> MutVisitor<'tcx> for Replacer<'tcx> {
|
|||
}
|
||||
|
||||
fn visit_var_debug_info(&mut self, debuginfo: &mut VarDebugInfo<'tcx>) {
|
||||
// If the debuginfo is a pointer to another place:
|
||||
// - if it's a reborrow, see through it;
|
||||
// - if it's a direct borrow, increase `debuginfo.references`.
|
||||
// If the debuginfo is a pointer to another place
|
||||
// and it's a reborrow: see through it
|
||||
while let VarDebugInfoContents::Place(ref mut place) = debuginfo.value
|
||||
&& place.projection.is_empty()
|
||||
&& let Value::Pointer(target, _) = self.targets[place.local]
|
||||
&& target.projection.iter().all(|p| p.can_use_in_debuginfo())
|
||||
&& let &[PlaceElem::Deref] = &target.projection[..]
|
||||
{
|
||||
if let Some((&PlaceElem::Deref, rest)) = target.projection.split_last() {
|
||||
*place = Place::from(target.local).project_deeper(rest, self.tcx);
|
||||
self.any_replacement = true;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
*place = Place::from(target.local);
|
||||
self.any_replacement = true;
|
||||
}
|
||||
|
||||
// Simplify eventual projections left inside `debuginfo`.
|
||||
|
|
@ -414,9 +409,7 @@ impl<'tcx> MutVisitor<'tcx> for Replacer<'tcx> {
|
|||
|
||||
fn visit_place(&mut self, place: &mut Place<'tcx>, ctxt: PlaceContext, loc: Location) {
|
||||
loop {
|
||||
if place.projection.first() != Some(&PlaceElem::Deref) {
|
||||
return;
|
||||
}
|
||||
let Some((&PlaceElem::Deref, rest)) = place.projection.split_first() else { return };
|
||||
|
||||
let Value::Pointer(target, _) = self.targets[place.local] else { return };
|
||||
|
||||
|
|
@ -432,7 +425,7 @@ impl<'tcx> MutVisitor<'tcx> for Replacer<'tcx> {
|
|||
return;
|
||||
}
|
||||
|
||||
*place = target.project_deeper(&place.projection[1..], self.tcx);
|
||||
*place = target.project_deeper(rest, self.tcx);
|
||||
self.any_replacement = true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -290,8 +290,6 @@ impl<T> Box<T> {
|
|||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// #![feature(new_zeroed_alloc)]
|
||||
///
|
||||
/// let zero = Box::<u32>::new_zeroed();
|
||||
/// let zero = unsafe { zero.assume_init() };
|
||||
///
|
||||
|
|
@ -301,7 +299,7 @@ impl<T> Box<T> {
|
|||
/// [zeroed]: mem::MaybeUninit::zeroed
|
||||
#[cfg(not(no_global_oom_handling))]
|
||||
#[inline]
|
||||
#[unstable(feature = "new_zeroed_alloc", issue = "129396")]
|
||||
#[stable(feature = "new_zeroed_alloc", since = "CURRENT_RUSTC_VERSION")]
|
||||
#[must_use]
|
||||
pub fn new_zeroed() -> Box<mem::MaybeUninit<T>> {
|
||||
Self::new_zeroed_in(Global)
|
||||
|
|
@ -358,7 +356,6 @@ impl<T> Box<T> {
|
|||
/// # Ok::<(), std::alloc::AllocError>(())
|
||||
/// ```
|
||||
#[unstable(feature = "allocator_api", issue = "32838")]
|
||||
// #[unstable(feature = "new_uninit", issue = "63291")]
|
||||
#[inline]
|
||||
pub fn try_new_uninit() -> Result<Box<mem::MaybeUninit<T>>, AllocError> {
|
||||
Box::try_new_uninit_in(Global)
|
||||
|
|
@ -384,7 +381,6 @@ impl<T> Box<T> {
|
|||
///
|
||||
/// [zeroed]: mem::MaybeUninit::zeroed
|
||||
#[unstable(feature = "allocator_api", issue = "32838")]
|
||||
// #[unstable(feature = "new_uninit", issue = "63291")]
|
||||
#[inline]
|
||||
pub fn try_new_zeroed() -> Result<Box<mem::MaybeUninit<T>>, AllocError> {
|
||||
Box::try_new_zeroed_in(Global)
|
||||
|
|
@ -463,7 +459,6 @@ impl<T, A: Allocator> Box<T, A> {
|
|||
#[unstable(feature = "allocator_api", issue = "32838")]
|
||||
#[cfg(not(no_global_oom_handling))]
|
||||
#[must_use]
|
||||
// #[unstable(feature = "new_uninit", issue = "63291")]
|
||||
pub fn new_uninit_in(alloc: A) -> Box<mem::MaybeUninit<T>, A>
|
||||
where
|
||||
A: Allocator,
|
||||
|
|
@ -496,7 +491,6 @@ impl<T, A: Allocator> Box<T, A> {
|
|||
/// # Ok::<(), std::alloc::AllocError>(())
|
||||
/// ```
|
||||
#[unstable(feature = "allocator_api", issue = "32838")]
|
||||
// #[unstable(feature = "new_uninit", issue = "63291")]
|
||||
pub fn try_new_uninit_in(alloc: A) -> Result<Box<mem::MaybeUninit<T>, A>, AllocError>
|
||||
where
|
||||
A: Allocator,
|
||||
|
|
@ -532,7 +526,6 @@ impl<T, A: Allocator> Box<T, A> {
|
|||
/// [zeroed]: mem::MaybeUninit::zeroed
|
||||
#[unstable(feature = "allocator_api", issue = "32838")]
|
||||
#[cfg(not(no_global_oom_handling))]
|
||||
// #[unstable(feature = "new_uninit", issue = "63291")]
|
||||
#[must_use]
|
||||
pub fn new_zeroed_in(alloc: A) -> Box<mem::MaybeUninit<T>, A>
|
||||
where
|
||||
|
|
@ -570,7 +563,6 @@ impl<T, A: Allocator> Box<T, A> {
|
|||
///
|
||||
/// [zeroed]: mem::MaybeUninit::zeroed
|
||||
#[unstable(feature = "allocator_api", issue = "32838")]
|
||||
// #[unstable(feature = "new_uninit", issue = "63291")]
|
||||
pub fn try_new_zeroed_in(alloc: A) -> Result<Box<mem::MaybeUninit<T>, A>, AllocError>
|
||||
where
|
||||
A: Allocator,
|
||||
|
|
@ -660,8 +652,6 @@ impl<T> Box<[T]> {
|
|||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// #![feature(new_zeroed_alloc)]
|
||||
///
|
||||
/// let values = Box::<[u32]>::new_zeroed_slice(3);
|
||||
/// let values = unsafe { values.assume_init() };
|
||||
///
|
||||
|
|
@ -670,7 +660,7 @@ impl<T> Box<[T]> {
|
|||
///
|
||||
/// [zeroed]: mem::MaybeUninit::zeroed
|
||||
#[cfg(not(no_global_oom_handling))]
|
||||
#[unstable(feature = "new_zeroed_alloc", issue = "129396")]
|
||||
#[stable(feature = "new_zeroed_alloc", since = "CURRENT_RUSTC_VERSION")]
|
||||
#[must_use]
|
||||
pub fn new_zeroed_slice(len: usize) -> Box<[mem::MaybeUninit<T>]> {
|
||||
unsafe { RawVec::with_capacity_zeroed(len).into_box(len) }
|
||||
|
|
@ -785,7 +775,6 @@ impl<T, A: Allocator> Box<[T], A> {
|
|||
/// ```
|
||||
#[cfg(not(no_global_oom_handling))]
|
||||
#[unstable(feature = "allocator_api", issue = "32838")]
|
||||
// #[unstable(feature = "new_uninit", issue = "63291")]
|
||||
#[must_use]
|
||||
pub fn new_uninit_slice_in(len: usize, alloc: A) -> Box<[mem::MaybeUninit<T>], A> {
|
||||
unsafe { RawVec::with_capacity_in(len, alloc).into_box(len) }
|
||||
|
|
@ -813,7 +802,6 @@ impl<T, A: Allocator> Box<[T], A> {
|
|||
/// [zeroed]: mem::MaybeUninit::zeroed
|
||||
#[cfg(not(no_global_oom_handling))]
|
||||
#[unstable(feature = "allocator_api", issue = "32838")]
|
||||
// #[unstable(feature = "new_uninit", issue = "63291")]
|
||||
#[must_use]
|
||||
pub fn new_zeroed_slice_in(len: usize, alloc: A) -> Box<[mem::MaybeUninit<T>], A> {
|
||||
unsafe { RawVec::with_capacity_zeroed_in(len, alloc).into_box(len) }
|
||||
|
|
|
|||
|
|
@ -546,7 +546,11 @@ impl<K, V: fmt::Debug> fmt::Debug for ValuesMut<'_, K, V> {
|
|||
/// [`into_keys`]: BTreeMap::into_keys
|
||||
#[must_use = "iterators are lazy and do nothing unless consumed"]
|
||||
#[stable(feature = "map_into_keys_values", since = "1.54.0")]
|
||||
pub struct IntoKeys<K, V, A: Allocator + Clone = Global> {
|
||||
pub struct IntoKeys<
|
||||
K,
|
||||
V,
|
||||
#[unstable(feature = "allocator_api", issue = "32838")] A: Allocator + Clone = Global,
|
||||
> {
|
||||
inner: IntoIter<K, V, A>,
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -99,7 +99,12 @@ impl<K: Debug + Ord, V: Debug, A: Allocator + Clone> Debug for OccupiedEntry<'_,
|
|||
///
|
||||
/// Contains the occupied entry, and the value that was not inserted.
|
||||
#[unstable(feature = "map_try_insert", issue = "82766")]
|
||||
pub struct OccupiedError<'a, K: 'a, V: 'a, A: Allocator + Clone = Global> {
|
||||
pub struct OccupiedError<
|
||||
'a,
|
||||
K: 'a,
|
||||
V: 'a,
|
||||
#[unstable(feature = "allocator_api", issue = "32838")] A: Allocator + Clone = Global,
|
||||
> {
|
||||
/// The entry in the map that was already occupied.
|
||||
pub entry: OccupiedEntry<'a, K, V, A>,
|
||||
/// The value which was not inserted, because the entry was already occupied.
|
||||
|
|
|
|||
|
|
@ -1486,8 +1486,8 @@ impl<T, A: Allocator> VecDeque<T, A> {
|
|||
///
|
||||
/// # Panics
|
||||
///
|
||||
/// Panics if the starting point is greater than the end point or if
|
||||
/// the end point is greater than the length of the deque.
|
||||
/// Panics if the range has `start_bound > end_bound`, or, if the range is
|
||||
/// bounded on either end and past the length of the deque.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
|
|
@ -1522,8 +1522,8 @@ impl<T, A: Allocator> VecDeque<T, A> {
|
|||
///
|
||||
/// # Panics
|
||||
///
|
||||
/// Panics if the starting point is greater than the end point or if
|
||||
/// the end point is greater than the length of the deque.
|
||||
/// Panics if the range has `start_bound > end_bound`, or, if the range is
|
||||
/// bounded on either end and past the length of the deque.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
|
|
@ -1568,8 +1568,8 @@ impl<T, A: Allocator> VecDeque<T, A> {
|
|||
///
|
||||
/// # Panics
|
||||
///
|
||||
/// Panics if the starting point is greater than the end point or if
|
||||
/// the end point is greater than the length of the deque.
|
||||
/// Panics if the range has `start_bound > end_bound`, or, if the range is
|
||||
/// bounded on either end and past the length of the deque.
|
||||
///
|
||||
/// # Leaking
|
||||
///
|
||||
|
|
|
|||
|
|
@ -515,8 +515,6 @@ impl<T> Rc<T> {
|
|||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// #![feature(new_zeroed_alloc)]
|
||||
///
|
||||
/// use std::rc::Rc;
|
||||
///
|
||||
/// let zero = Rc::<u32>::new_zeroed();
|
||||
|
|
@ -527,7 +525,7 @@ impl<T> Rc<T> {
|
|||
///
|
||||
/// [zeroed]: mem::MaybeUninit::zeroed
|
||||
#[cfg(not(no_global_oom_handling))]
|
||||
#[unstable(feature = "new_zeroed_alloc", issue = "129396")]
|
||||
#[stable(feature = "new_zeroed_alloc", since = "CURRENT_RUSTC_VERSION")]
|
||||
#[must_use]
|
||||
pub fn new_zeroed() -> Rc<mem::MaybeUninit<T>> {
|
||||
unsafe {
|
||||
|
|
@ -589,7 +587,6 @@ impl<T> Rc<T> {
|
|||
/// # Ok::<(), std::alloc::AllocError>(())
|
||||
/// ```
|
||||
#[unstable(feature = "allocator_api", issue = "32838")]
|
||||
// #[unstable(feature = "new_uninit", issue = "63291")]
|
||||
pub fn try_new_uninit() -> Result<Rc<mem::MaybeUninit<T>>, AllocError> {
|
||||
unsafe {
|
||||
Ok(Rc::from_ptr(Rc::try_allocate_for_layout(
|
||||
|
|
@ -622,7 +619,6 @@ impl<T> Rc<T> {
|
|||
///
|
||||
/// [zeroed]: mem::MaybeUninit::zeroed
|
||||
#[unstable(feature = "allocator_api", issue = "32838")]
|
||||
//#[unstable(feature = "new_uninit", issue = "63291")]
|
||||
pub fn try_new_zeroed() -> Result<Rc<mem::MaybeUninit<T>>, AllocError> {
|
||||
unsafe {
|
||||
Ok(Rc::from_ptr(Rc::try_allocate_for_layout(
|
||||
|
|
@ -690,7 +686,6 @@ impl<T, A: Allocator> Rc<T, A> {
|
|||
/// ```
|
||||
#[cfg(not(no_global_oom_handling))]
|
||||
#[unstable(feature = "allocator_api", issue = "32838")]
|
||||
// #[unstable(feature = "new_uninit", issue = "63291")]
|
||||
#[inline]
|
||||
pub fn new_uninit_in(alloc: A) -> Rc<mem::MaybeUninit<T>, A> {
|
||||
unsafe {
|
||||
|
|
@ -728,7 +723,6 @@ impl<T, A: Allocator> Rc<T, A> {
|
|||
/// [zeroed]: mem::MaybeUninit::zeroed
|
||||
#[cfg(not(no_global_oom_handling))]
|
||||
#[unstable(feature = "allocator_api", issue = "32838")]
|
||||
// #[unstable(feature = "new_uninit", issue = "63291")]
|
||||
#[inline]
|
||||
pub fn new_zeroed_in(alloc: A) -> Rc<mem::MaybeUninit<T>, A> {
|
||||
unsafe {
|
||||
|
|
@ -873,7 +867,6 @@ impl<T, A: Allocator> Rc<T, A> {
|
|||
/// # Ok::<(), std::alloc::AllocError>(())
|
||||
/// ```
|
||||
#[unstable(feature = "allocator_api", issue = "32838")]
|
||||
// #[unstable(feature = "new_uninit", issue = "63291")]
|
||||
#[inline]
|
||||
pub fn try_new_uninit_in(alloc: A) -> Result<Rc<mem::MaybeUninit<T>, A>, AllocError> {
|
||||
unsafe {
|
||||
|
|
@ -912,7 +905,6 @@ impl<T, A: Allocator> Rc<T, A> {
|
|||
///
|
||||
/// [zeroed]: mem::MaybeUninit::zeroed
|
||||
#[unstable(feature = "allocator_api", issue = "32838")]
|
||||
//#[unstable(feature = "new_uninit", issue = "63291")]
|
||||
#[inline]
|
||||
pub fn try_new_zeroed_in(alloc: A) -> Result<Rc<mem::MaybeUninit<T>, A>, AllocError> {
|
||||
unsafe {
|
||||
|
|
@ -1054,8 +1046,6 @@ impl<T> Rc<[T]> {
|
|||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// #![feature(new_zeroed_alloc)]
|
||||
///
|
||||
/// use std::rc::Rc;
|
||||
///
|
||||
/// let values = Rc::<[u32]>::new_zeroed_slice(3);
|
||||
|
|
@ -1066,7 +1056,7 @@ impl<T> Rc<[T]> {
|
|||
///
|
||||
/// [zeroed]: mem::MaybeUninit::zeroed
|
||||
#[cfg(not(no_global_oom_handling))]
|
||||
#[unstable(feature = "new_zeroed_alloc", issue = "129396")]
|
||||
#[stable(feature = "new_zeroed_alloc", since = "CURRENT_RUSTC_VERSION")]
|
||||
#[must_use]
|
||||
pub fn new_zeroed_slice(len: usize) -> Rc<[mem::MaybeUninit<T>]> {
|
||||
unsafe {
|
||||
|
|
@ -1129,7 +1119,6 @@ impl<T, A: Allocator> Rc<[T], A> {
|
|||
/// ```
|
||||
#[cfg(not(no_global_oom_handling))]
|
||||
#[unstable(feature = "allocator_api", issue = "32838")]
|
||||
// #[unstable(feature = "new_uninit", issue = "63291")]
|
||||
#[inline]
|
||||
pub fn new_uninit_slice_in(len: usize, alloc: A) -> Rc<[mem::MaybeUninit<T>], A> {
|
||||
unsafe { Rc::from_ptr_in(Rc::allocate_for_slice_in(len, &alloc), alloc) }
|
||||
|
|
@ -1158,7 +1147,6 @@ impl<T, A: Allocator> Rc<[T], A> {
|
|||
/// [zeroed]: mem::MaybeUninit::zeroed
|
||||
#[cfg(not(no_global_oom_handling))]
|
||||
#[unstable(feature = "allocator_api", issue = "32838")]
|
||||
// #[unstable(feature = "new_uninit", issue = "63291")]
|
||||
#[inline]
|
||||
pub fn new_zeroed_slice_in(len: usize, alloc: A) -> Rc<[mem::MaybeUninit<T>], A> {
|
||||
unsafe {
|
||||
|
|
|
|||
|
|
@ -1117,8 +1117,8 @@ impl String {
|
|||
///
|
||||
/// # Panics
|
||||
///
|
||||
/// Panics if the starting point or end point do not lie on a [`char`]
|
||||
/// boundary, or if they're out of bounds.
|
||||
/// Panics if the range has `start_bound > end_bound`, or, if the range is
|
||||
/// bounded on either end and does not lie on a [`char`] boundary.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
|
|
@ -1939,8 +1939,8 @@ impl String {
|
|||
///
|
||||
/// # Panics
|
||||
///
|
||||
/// Panics if the starting point or end point do not lie on a [`char`]
|
||||
/// boundary, or if they're out of bounds.
|
||||
/// Panics if the range has `start_bound > end_bound`, or, if the range is
|
||||
/// bounded on either end and does not lie on a [`char`] boundary.
|
||||
///
|
||||
/// # Leaking
|
||||
///
|
||||
|
|
@ -2050,8 +2050,8 @@ impl String {
|
|||
///
|
||||
/// # Panics
|
||||
///
|
||||
/// Panics if the starting point or end point do not lie on a [`char`]
|
||||
/// boundary, or if they're out of bounds.
|
||||
/// Panics if the range has `start_bound > end_bound`, or, if the range is
|
||||
/// bounded on either end and does not lie on a [`char`] boundary.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
|
|
|
|||
|
|
@ -516,8 +516,6 @@ impl<T> Arc<T> {
|
|||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// #![feature(new_zeroed_alloc)]
|
||||
///
|
||||
/// use std::sync::Arc;
|
||||
///
|
||||
/// let zero = Arc::<u32>::new_zeroed();
|
||||
|
|
@ -529,7 +527,7 @@ impl<T> Arc<T> {
|
|||
/// [zeroed]: mem::MaybeUninit::zeroed
|
||||
#[cfg(not(no_global_oom_handling))]
|
||||
#[inline]
|
||||
#[unstable(feature = "new_zeroed_alloc", issue = "129396")]
|
||||
#[stable(feature = "new_zeroed_alloc", since = "CURRENT_RUSTC_VERSION")]
|
||||
#[must_use]
|
||||
pub fn new_zeroed() -> Arc<mem::MaybeUninit<T>> {
|
||||
unsafe {
|
||||
|
|
@ -603,7 +601,6 @@ impl<T> Arc<T> {
|
|||
/// # Ok::<(), std::alloc::AllocError>(())
|
||||
/// ```
|
||||
#[unstable(feature = "allocator_api", issue = "32838")]
|
||||
// #[unstable(feature = "new_uninit", issue = "63291")]
|
||||
pub fn try_new_uninit() -> Result<Arc<mem::MaybeUninit<T>>, AllocError> {
|
||||
unsafe {
|
||||
Ok(Arc::from_ptr(Arc::try_allocate_for_layout(
|
||||
|
|
@ -636,7 +633,6 @@ impl<T> Arc<T> {
|
|||
///
|
||||
/// [zeroed]: mem::MaybeUninit::zeroed
|
||||
#[unstable(feature = "allocator_api", issue = "32838")]
|
||||
// #[unstable(feature = "new_uninit", issue = "63291")]
|
||||
pub fn try_new_zeroed() -> Result<Arc<mem::MaybeUninit<T>>, AllocError> {
|
||||
unsafe {
|
||||
Ok(Arc::from_ptr(Arc::try_allocate_for_layout(
|
||||
|
|
@ -703,7 +699,6 @@ impl<T, A: Allocator> Arc<T, A> {
|
|||
/// ```
|
||||
#[cfg(not(no_global_oom_handling))]
|
||||
#[unstable(feature = "allocator_api", issue = "32838")]
|
||||
// #[unstable(feature = "new_uninit", issue = "63291")]
|
||||
#[inline]
|
||||
pub fn new_uninit_in(alloc: A) -> Arc<mem::MaybeUninit<T>, A> {
|
||||
unsafe {
|
||||
|
|
@ -741,7 +736,6 @@ impl<T, A: Allocator> Arc<T, A> {
|
|||
/// [zeroed]: mem::MaybeUninit::zeroed
|
||||
#[cfg(not(no_global_oom_handling))]
|
||||
#[unstable(feature = "allocator_api", issue = "32838")]
|
||||
// #[unstable(feature = "new_uninit", issue = "63291")]
|
||||
#[inline]
|
||||
pub fn new_zeroed_in(alloc: A) -> Arc<mem::MaybeUninit<T>, A> {
|
||||
unsafe {
|
||||
|
|
@ -927,7 +921,6 @@ impl<T, A: Allocator> Arc<T, A> {
|
|||
/// # Ok::<(), std::alloc::AllocError>(())
|
||||
/// ```
|
||||
#[unstable(feature = "allocator_api", issue = "32838")]
|
||||
// #[unstable(feature = "new_uninit", issue = "63291")]
|
||||
#[inline]
|
||||
pub fn try_new_uninit_in(alloc: A) -> Result<Arc<mem::MaybeUninit<T>, A>, AllocError> {
|
||||
unsafe {
|
||||
|
|
@ -966,7 +959,6 @@ impl<T, A: Allocator> Arc<T, A> {
|
|||
///
|
||||
/// [zeroed]: mem::MaybeUninit::zeroed
|
||||
#[unstable(feature = "allocator_api", issue = "32838")]
|
||||
// #[unstable(feature = "new_uninit", issue = "63291")]
|
||||
#[inline]
|
||||
pub fn try_new_zeroed_in(alloc: A) -> Result<Arc<mem::MaybeUninit<T>, A>, AllocError> {
|
||||
unsafe {
|
||||
|
|
@ -1197,8 +1189,6 @@ impl<T> Arc<[T]> {
|
|||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// #![feature(new_zeroed_alloc)]
|
||||
///
|
||||
/// use std::sync::Arc;
|
||||
///
|
||||
/// let values = Arc::<[u32]>::new_zeroed_slice(3);
|
||||
|
|
@ -1210,7 +1200,7 @@ impl<T> Arc<[T]> {
|
|||
/// [zeroed]: mem::MaybeUninit::zeroed
|
||||
#[cfg(not(no_global_oom_handling))]
|
||||
#[inline]
|
||||
#[unstable(feature = "new_zeroed_alloc", issue = "129396")]
|
||||
#[stable(feature = "new_zeroed_alloc", since = "CURRENT_RUSTC_VERSION")]
|
||||
#[must_use]
|
||||
pub fn new_zeroed_slice(len: usize) -> Arc<[mem::MaybeUninit<T>]> {
|
||||
unsafe {
|
||||
|
|
|
|||
|
|
@ -2796,8 +2796,8 @@ impl<T, A: Allocator> Vec<T, A> {
|
|||
///
|
||||
/// # Panics
|
||||
///
|
||||
/// Panics if the starting point is greater than the end point or if
|
||||
/// the end point is greater than the length of the vector.
|
||||
/// Panics if the range has `start_bound > end_bound`, or, if the range is
|
||||
/// bounded on either end and past the length of the vector.
|
||||
///
|
||||
/// # Leaking
|
||||
///
|
||||
|
|
@ -3860,8 +3860,8 @@ impl<T, A: Allocator> Vec<T, A> {
|
|||
///
|
||||
/// # Panics
|
||||
///
|
||||
/// Panics if the starting point is greater than the end point or if
|
||||
/// the end point is greater than the length of the vector.
|
||||
/// Panics if the range has `start_bound > end_bound`, or, if the range is
|
||||
/// bounded on either end and past the length of the vector.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
|
|
|
|||
|
|
@ -193,8 +193,9 @@ impl<'a> Location<'a> {
|
|||
/// This is useful for interop with APIs that expect C/C++ `__FILE__` or
|
||||
/// `std::source_location::file_name`, both of which return a nul-terminated `const char*`.
|
||||
#[must_use]
|
||||
#[unstable(feature = "file_with_nul", issue = "141727")]
|
||||
#[inline]
|
||||
#[stable(feature = "file_with_nul", since = "CURRENT_RUSTC_VERSION")]
|
||||
#[rustc_const_stable(feature = "file_with_nul", since = "CURRENT_RUSTC_VERSION")]
|
||||
pub const fn file_as_c_str(&self) -> &'a CStr {
|
||||
let filename = self.filename.as_ptr();
|
||||
|
||||
|
|
|
|||
|
|
@ -381,7 +381,6 @@
|
|||
#![feature(allocator_api)]
|
||||
#![feature(get_mut_unchecked)]
|
||||
#![feature(map_try_insert)]
|
||||
#![feature(new_zeroed_alloc)]
|
||||
#![feature(slice_concat_trait)]
|
||||
#![feature(thin_box)]
|
||||
#![feature(try_reserve_kind)]
|
||||
|
|
|
|||
|
|
@ -161,7 +161,7 @@ fn lang_start_internal(
|
|||
// mechanism itself.
|
||||
//
|
||||
// There are a couple of instances where unwinding can begin. First is inside of the
|
||||
// `rt::init`, `rt::cleanup` and similar functions controlled by bstd. In those instances a
|
||||
// `rt::init`, `rt::cleanup` and similar functions controlled by std. In those instances a
|
||||
// panic is a std implementation bug. A quite likely one too, as there isn't any way to
|
||||
// prevent std from accidentally introducing a panic to these functions. Another is from
|
||||
// user code from `main` or, more nefariously, as described in e.g. issue #86030.
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ use minicore::*;
|
|||
// CHECK: .functype nop () -> ()
|
||||
// CHECK-NOT: .size
|
||||
// CHECK: end_function
|
||||
// CHECK-LABEL: .Lfunc_end_nop:
|
||||
#[no_mangle]
|
||||
#[unsafe(naked)]
|
||||
extern "C" fn nop() {
|
||||
|
|
|
|||
|
|
@ -1,3 +0,0 @@
|
|||
//@ known-bug: #132142
|
||||
|
||||
async extern "cmse-nonsecure-entry" fn fun(...) {}
|
||||
69
tests/ui/cmse-nonsecure/cmse-nonsecure-entry/c-variadic.rs
Normal file
69
tests/ui/cmse-nonsecure/cmse-nonsecure-entry/c-variadic.rs
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
//@ add-core-stubs
|
||||
//@ edition: 2018
|
||||
//@ compile-flags: --target thumbv8m.main-none-eabi --crate-type lib
|
||||
//@ needs-llvm-components: arm
|
||||
#![feature(cmse_nonsecure_entry, c_variadic, no_core, lang_items)]
|
||||
#![no_core]
|
||||
|
||||
extern crate minicore;
|
||||
use minicore::*;
|
||||
|
||||
#[lang = "va_list"]
|
||||
struct VaList(*mut u8);
|
||||
|
||||
unsafe extern "cmse-nonsecure-entry" fn c_variadic(_: u32, _: ...) {
|
||||
//~^ ERROR `...` is not supported for `extern "cmse-nonsecure-entry"` functions
|
||||
}
|
||||
|
||||
// A regression test for https://github.com/rust-lang/rust/issues/132142
|
||||
async unsafe extern "cmse-nonsecure-entry" fn async_and_c_variadic(_: ...) {
|
||||
//~^ ERROR `...` is not supported for `extern "cmse-nonsecure-entry"` functions
|
||||
//~| ERROR functions cannot be both `async` and C-variadic
|
||||
}
|
||||
|
||||
// Below are the lang items that are required for a program that defines an `async` function.
|
||||
// Without them, the ICE that is tested for here is not reached for this target. For now they are in
|
||||
// this file, but they may be moved into `minicore` if/when other `#[no_core]` tests want to use
|
||||
// them.
|
||||
|
||||
// NOTE: in `core` this type uses `NonNull`.
|
||||
#[lang = "ResumeTy"]
|
||||
pub struct ResumeTy(*mut Context<'static>);
|
||||
|
||||
#[lang = "future_trait"]
|
||||
pub trait Future {
|
||||
/// The type of value produced on completion.
|
||||
#[lang = "future_output"]
|
||||
type Output;
|
||||
|
||||
// NOTE: misses the `poll` method.
|
||||
}
|
||||
|
||||
#[lang = "async_drop"]
|
||||
pub trait AsyncDrop {
|
||||
// NOTE: misses the `drop` method.
|
||||
}
|
||||
|
||||
#[lang = "Poll"]
|
||||
pub enum Poll<T> {
|
||||
#[lang = "Ready"]
|
||||
Ready(T),
|
||||
|
||||
#[lang = "Pending"]
|
||||
Pending,
|
||||
}
|
||||
|
||||
#[lang = "Context"]
|
||||
pub struct Context<'a> {
|
||||
// NOTE: misses a bunch of fields.
|
||||
_marker: PhantomData<fn(&'a ()) -> &'a ()>,
|
||||
}
|
||||
|
||||
#[lang = "get_context"]
|
||||
pub unsafe fn get_context<'a, 'b>(cx: ResumeTy) -> &'a mut Context<'b> {
|
||||
// NOTE: the actual implementation looks different.
|
||||
mem::transmute(cx.0)
|
||||
}
|
||||
|
||||
#[lang = "pin"]
|
||||
pub struct Pin<T>(T);
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
error: `...` is not supported for `extern "cmse-nonsecure-entry"` functions
|
||||
--> $DIR/c-variadic.rs:14:60
|
||||
|
|
||||
LL | unsafe extern "cmse-nonsecure-entry" fn c_variadic(_: u32, _: ...) {
|
||||
| ----------------------------- ^^^^^^
|
||||
| |
|
||||
| `extern "cmse-nonsecure-entry"` because of this
|
||||
|
|
||||
= help: only `extern "C"` and `extern "C-unwind"` functions may have a C variable argument list
|
||||
|
||||
error: functions cannot be both `async` and C-variadic
|
||||
--> $DIR/c-variadic.rs:19:1
|
||||
|
|
||||
LL | async unsafe extern "cmse-nonsecure-entry" fn async_and_c_variadic(_: ...) {
|
||||
| ^^^^^ `async` because of this ^^^^^^ C-variadic because of this
|
||||
|
||||
error: `...` is not supported for `extern "cmse-nonsecure-entry"` functions
|
||||
--> $DIR/c-variadic.rs:19:68
|
||||
|
|
||||
LL | async unsafe extern "cmse-nonsecure-entry" fn async_and_c_variadic(_: ...) {
|
||||
| ----------------------------- ^^^^^^
|
||||
| |
|
||||
| `extern "cmse-nonsecure-entry"` because of this
|
||||
|
|
||||
= help: only `extern "C"` and `extern "C-unwind"` functions may have a C variable argument list
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
//@ add-core-stubs
|
||||
//@ compile-flags: --target thumbv8m.main-none-eabi --crate-type lib
|
||||
//@ needs-llvm-components: arm
|
||||
#![feature(cmse_nonsecure_entry, c_variadic, no_core, lang_items)]
|
||||
#![feature(cmse_nonsecure_entry, no_core, lang_items)]
|
||||
#![no_core]
|
||||
|
||||
extern crate minicore;
|
||||
|
|
@ -65,8 +65,3 @@ extern "cmse-nonsecure-entry" fn wrapped_trait_object(x: WrapperTransparent) ->
|
|||
//~^ ERROR return value of `"cmse-nonsecure-entry"` function too large to pass via registers [E0798]
|
||||
x
|
||||
}
|
||||
|
||||
unsafe extern "cmse-nonsecure-entry" fn c_variadic(_: u32, _: ...) {
|
||||
//~^ ERROR `...` is not supported for `extern "cmse-nonsecure-entry"` functions
|
||||
//~| ERROR requires `va_list` lang_item
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,13 +1,3 @@
|
|||
error: `...` is not supported for `extern "cmse-nonsecure-entry"` functions
|
||||
--> $DIR/generics.rs:69:60
|
||||
|
|
||||
LL | unsafe extern "cmse-nonsecure-entry" fn c_variadic(_: u32, _: ...) {
|
||||
| ----------------------------- ^^^^^^
|
||||
| |
|
||||
| `extern "cmse-nonsecure-entry"` because of this
|
||||
|
|
||||
= help: only `extern "C"` and `extern "C-unwind"` functions may have a C variable argument list
|
||||
|
||||
error[E0798]: functions with the `"cmse-nonsecure-entry"` ABI cannot contain generics in their type
|
||||
--> $DIR/generics.rs:30:1
|
||||
|
|
||||
|
|
@ -71,12 +61,6 @@ LL | extern "cmse-nonsecure-entry" fn wrapped_trait_object(x: WrapperTransparent
|
|||
= note: functions with the `"cmse-nonsecure-entry"` ABI must pass their result via the available return registers
|
||||
= note: the result must either be a (transparently wrapped) i64, u64 or f64, or be at most 4 bytes in size
|
||||
|
||||
error: requires `va_list` lang_item
|
||||
--> $DIR/generics.rs:69:60
|
||||
|
|
||||
LL | unsafe extern "cmse-nonsecure-entry" fn c_variadic(_: u32, _: ...) {
|
||||
| ^^^^^^
|
||||
|
||||
error: aborting due to 9 previous errors
|
||||
error: aborting due to 7 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0798`.
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
//@ run-pass
|
||||
#![feature(file_with_nul)]
|
||||
|
||||
#[track_caller]
|
||||
const fn assert_file_has_trailing_zero() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue