mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 08:13:41 +00:00
Auto merge of #131345 - Zalathar:rollup-scdxuou, r=Zalathar
Rollup of 3 pull requests Successful merges: - #128399 (liballoc: introduce String, Vec const-slicing) - #131308 (enable f16 and f128 on windows-gnullvm targets) - #131325 (coverage: Multiple small tweaks to counter creation) r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
commit
690332a251
@ -4,6 +4,7 @@ use rustc_data_structures::captures::Captures;
|
||||
use rustc_data_structures::fx::FxHashMap;
|
||||
use rustc_data_structures::graph::DirectedGraph;
|
||||
use rustc_index::IndexVec;
|
||||
use rustc_index::bit_set::BitSet;
|
||||
use rustc_middle::bug;
|
||||
use rustc_middle::mir::coverage::{CounterId, CovTerm, Expression, ExpressionId, Op};
|
||||
use tracing::{debug, debug_span, instrument};
|
||||
@ -13,13 +14,13 @@ use crate::coverage::graph::{BasicCoverageBlock, CoverageGraph, TraverseCoverage
|
||||
/// The coverage counter or counter expression associated with a particular
|
||||
/// BCB node or BCB edge.
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Hash)]
|
||||
pub(super) enum BcbCounter {
|
||||
enum BcbCounter {
|
||||
Counter { id: CounterId },
|
||||
Expression { id: ExpressionId },
|
||||
}
|
||||
|
||||
impl BcbCounter {
|
||||
pub(super) fn as_term(&self) -> CovTerm {
|
||||
fn as_term(&self) -> CovTerm {
|
||||
match *self {
|
||||
BcbCounter::Counter { id, .. } => CovTerm::Counter(id),
|
||||
BcbCounter::Expression { id, .. } => CovTerm::Expression(id),
|
||||
@ -78,21 +79,22 @@ impl CoverageCounters {
|
||||
/// counters or counter expressions for nodes and edges as required.
|
||||
pub(super) fn make_bcb_counters(
|
||||
basic_coverage_blocks: &CoverageGraph,
|
||||
bcb_needs_counter: impl Fn(BasicCoverageBlock) -> bool,
|
||||
bcb_needs_counter: &BitSet<BasicCoverageBlock>,
|
||||
) -> Self {
|
||||
let num_bcbs = basic_coverage_blocks.num_nodes();
|
||||
let mut counters = MakeBcbCounters::new(basic_coverage_blocks, bcb_needs_counter);
|
||||
counters.make_bcb_counters();
|
||||
|
||||
let mut this = Self {
|
||||
counters.coverage_counters
|
||||
}
|
||||
|
||||
fn with_num_bcbs(num_bcbs: usize) -> Self {
|
||||
Self {
|
||||
counter_increment_sites: IndexVec::new(),
|
||||
bcb_counters: IndexVec::from_elem_n(None, num_bcbs),
|
||||
bcb_edge_counters: FxHashMap::default(),
|
||||
expressions: IndexVec::new(),
|
||||
expressions_memo: FxHashMap::default(),
|
||||
};
|
||||
|
||||
MakeBcbCounters::new(&mut this, basic_coverage_blocks).make_bcb_counters(bcb_needs_counter);
|
||||
|
||||
this
|
||||
}
|
||||
}
|
||||
|
||||
/// Shared helper used by [`Self::make_phys_node_counter`] and
|
||||
@ -218,8 +220,8 @@ impl CoverageCounters {
|
||||
}
|
||||
}
|
||||
|
||||
pub(super) fn bcb_counter(&self, bcb: BasicCoverageBlock) -> Option<BcbCounter> {
|
||||
self.bcb_counters[bcb]
|
||||
pub(super) fn term_for_bcb(&self, bcb: BasicCoverageBlock) -> Option<CovTerm> {
|
||||
self.bcb_counters[bcb].map(|counter| counter.as_term())
|
||||
}
|
||||
|
||||
/// Returns an iterator over all the nodes/edges in the coverage graph that
|
||||
@ -265,19 +267,25 @@ impl CoverageCounters {
|
||||
|
||||
/// Helper struct that allows counter creation to inspect the BCB graph.
|
||||
struct MakeBcbCounters<'a> {
|
||||
coverage_counters: &'a mut CoverageCounters,
|
||||
coverage_counters: CoverageCounters,
|
||||
basic_coverage_blocks: &'a CoverageGraph,
|
||||
bcb_needs_counter: &'a BitSet<BasicCoverageBlock>,
|
||||
}
|
||||
|
||||
impl<'a> MakeBcbCounters<'a> {
|
||||
fn new(
|
||||
coverage_counters: &'a mut CoverageCounters,
|
||||
basic_coverage_blocks: &'a CoverageGraph,
|
||||
bcb_needs_counter: &'a BitSet<BasicCoverageBlock>,
|
||||
) -> Self {
|
||||
Self { coverage_counters, basic_coverage_blocks }
|
||||
assert_eq!(basic_coverage_blocks.num_nodes(), bcb_needs_counter.domain_size());
|
||||
Self {
|
||||
coverage_counters: CoverageCounters::with_num_bcbs(basic_coverage_blocks.num_nodes()),
|
||||
basic_coverage_blocks,
|
||||
bcb_needs_counter,
|
||||
}
|
||||
}
|
||||
|
||||
fn make_bcb_counters(&mut self, bcb_needs_counter: impl Fn(BasicCoverageBlock) -> bool) {
|
||||
fn make_bcb_counters(&mut self) {
|
||||
debug!("make_bcb_counters(): adding a counter or expression to each BasicCoverageBlock");
|
||||
|
||||
// Traverse the coverage graph, ensuring that every node that needs a
|
||||
@ -290,7 +298,7 @@ impl<'a> MakeBcbCounters<'a> {
|
||||
let mut traversal = TraverseCoverageGraphWithLoops::new(self.basic_coverage_blocks);
|
||||
while let Some(bcb) = traversal.next() {
|
||||
let _span = debug_span!("traversal", ?bcb).entered();
|
||||
if bcb_needs_counter(bcb) {
|
||||
if self.bcb_needs_counter.contains(bcb) {
|
||||
self.make_node_counter_and_out_edge_counters(&traversal, bcb);
|
||||
}
|
||||
}
|
||||
|
@ -94,9 +94,8 @@ fn instrument_function_for_coverage<'tcx>(tcx: TyCtxt<'tcx>, mir_body: &mut mir:
|
||||
return;
|
||||
}
|
||||
|
||||
let bcb_has_counter_mappings = |bcb| bcbs_with_counter_mappings.contains(bcb);
|
||||
let coverage_counters =
|
||||
CoverageCounters::make_bcb_counters(&basic_coverage_blocks, bcb_has_counter_mappings);
|
||||
CoverageCounters::make_bcb_counters(&basic_coverage_blocks, &bcbs_with_counter_mappings);
|
||||
|
||||
let mappings = create_mappings(tcx, &hir_info, &extracted_mappings, &coverage_counters);
|
||||
if mappings.is_empty() {
|
||||
@ -153,12 +152,8 @@ fn create_mappings<'tcx>(
|
||||
&source_file.name.for_scope(tcx.sess, RemapPathScopeComponents::MACRO).to_string_lossy(),
|
||||
);
|
||||
|
||||
let term_for_bcb = |bcb| {
|
||||
coverage_counters
|
||||
.bcb_counter(bcb)
|
||||
.expect("all BCBs with spans were given counters")
|
||||
.as_term()
|
||||
};
|
||||
let term_for_bcb =
|
||||
|bcb| coverage_counters.term_for_bcb(bcb).expect("all BCBs with spans were given counters");
|
||||
let region_for_span = |span: Span| make_source_region(source_map, file_name, span, body_span);
|
||||
|
||||
// Fully destructure the mappings struct to make sure we don't miss any kinds.
|
||||
|
@ -115,6 +115,7 @@
|
||||
#![feature(const_option)]
|
||||
#![feature(const_pin)]
|
||||
#![feature(const_size_of_val)]
|
||||
#![feature(const_vec_string_slice)]
|
||||
#![feature(core_intrinsics)]
|
||||
#![feature(deprecated_suggestion)]
|
||||
#![feature(deref_pure_trait)]
|
||||
|
@ -280,7 +280,7 @@ impl<T, A: Allocator> RawVec<T, A> {
|
||||
/// `Unique::dangling()` if `capacity == 0` or `T` is zero-sized. In the former case, you must
|
||||
/// be careful.
|
||||
#[inline]
|
||||
pub fn ptr(&self) -> *mut T {
|
||||
pub const fn ptr(&self) -> *mut T {
|
||||
self.inner.ptr()
|
||||
}
|
||||
|
||||
@ -293,7 +293,7 @@ impl<T, A: Allocator> RawVec<T, A> {
|
||||
///
|
||||
/// This will always be `usize::MAX` if `T` is zero-sized.
|
||||
#[inline]
|
||||
pub fn capacity(&self) -> usize {
|
||||
pub const fn capacity(&self) -> usize {
|
||||
self.inner.capacity(size_of::<T>())
|
||||
}
|
||||
|
||||
@ -488,17 +488,17 @@ impl<A: Allocator> RawVecInner<A> {
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn ptr<T>(&self) -> *mut T {
|
||||
const fn ptr<T>(&self) -> *mut T {
|
||||
self.non_null::<T>().as_ptr()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn non_null<T>(&self) -> NonNull<T> {
|
||||
self.ptr.cast().into()
|
||||
const fn non_null<T>(&self) -> NonNull<T> {
|
||||
self.ptr.cast().as_non_null_ptr()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn capacity(&self, elem_size: usize) -> usize {
|
||||
const fn capacity(&self, elem_size: usize) -> usize {
|
||||
if elem_size == 0 { usize::MAX } else { self.cap.0 }
|
||||
}
|
||||
|
||||
|
@ -1059,7 +1059,8 @@ impl String {
|
||||
#[inline]
|
||||
#[must_use = "`self` will be dropped if the result is not used"]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn into_bytes(self) -> Vec<u8> {
|
||||
#[rustc_const_unstable(feature = "const_vec_string_slice", issue = "129041")]
|
||||
pub const fn into_bytes(self) -> Vec<u8> {
|
||||
self.vec
|
||||
}
|
||||
|
||||
@ -1076,8 +1077,11 @@ impl String {
|
||||
#[must_use]
|
||||
#[stable(feature = "string_as_str", since = "1.7.0")]
|
||||
#[cfg_attr(not(test), rustc_diagnostic_item = "string_as_str")]
|
||||
pub fn as_str(&self) -> &str {
|
||||
self
|
||||
#[rustc_const_unstable(feature = "const_vec_string_slice", issue = "129041")]
|
||||
pub const fn as_str(&self) -> &str {
|
||||
// SAFETY: String contents are stipulated to be valid UTF-8, invalid contents are an error
|
||||
// at construction.
|
||||
unsafe { str::from_utf8_unchecked(self.vec.as_slice()) }
|
||||
}
|
||||
|
||||
/// Converts a `String` into a mutable string slice.
|
||||
@ -1096,8 +1100,11 @@ impl String {
|
||||
#[must_use]
|
||||
#[stable(feature = "string_as_str", since = "1.7.0")]
|
||||
#[cfg_attr(not(test), rustc_diagnostic_item = "string_as_mut_str")]
|
||||
pub fn as_mut_str(&mut self) -> &mut str {
|
||||
self
|
||||
#[rustc_const_unstable(feature = "const_vec_string_slice", issue = "129041")]
|
||||
pub const fn as_mut_str(&mut self) -> &mut str {
|
||||
// SAFETY: String contents are stipulated to be valid UTF-8, invalid contents are an error
|
||||
// at construction.
|
||||
unsafe { str::from_utf8_unchecked_mut(self.vec.as_mut_slice()) }
|
||||
}
|
||||
|
||||
/// Appends a given string slice onto the end of this `String`.
|
||||
@ -1168,7 +1175,8 @@ impl String {
|
||||
#[inline]
|
||||
#[must_use]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn capacity(&self) -> usize {
|
||||
#[rustc_const_unstable(feature = "const_vec_string_slice", issue = "129041")]
|
||||
pub const fn capacity(&self) -> usize {
|
||||
self.vec.capacity()
|
||||
}
|
||||
|
||||
@ -1431,8 +1439,9 @@ impl String {
|
||||
#[inline]
|
||||
#[must_use]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn as_bytes(&self) -> &[u8] {
|
||||
&self.vec
|
||||
#[rustc_const_unstable(feature = "const_vec_string_slice", issue = "129041")]
|
||||
pub const fn as_bytes(&self) -> &[u8] {
|
||||
self.vec.as_slice()
|
||||
}
|
||||
|
||||
/// Shortens this `String` to the specified length.
|
||||
@ -1784,7 +1793,8 @@ impl String {
|
||||
/// ```
|
||||
#[inline]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub unsafe fn as_mut_vec(&mut self) -> &mut Vec<u8> {
|
||||
#[rustc_const_unstable(feature = "const_vec_string_slice", issue = "129041")]
|
||||
pub const unsafe fn as_mut_vec(&mut self) -> &mut Vec<u8> {
|
||||
&mut self.vec
|
||||
}
|
||||
|
||||
@ -1805,8 +1815,9 @@ impl String {
|
||||
#[inline]
|
||||
#[must_use]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[rustc_const_unstable(feature = "const_vec_string_slice", issue = "129041")]
|
||||
#[rustc_confusables("length", "size")]
|
||||
pub fn len(&self) -> usize {
|
||||
pub const fn len(&self) -> usize {
|
||||
self.vec.len()
|
||||
}
|
||||
|
||||
@ -1824,7 +1835,8 @@ impl String {
|
||||
#[inline]
|
||||
#[must_use]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn is_empty(&self) -> bool {
|
||||
#[rustc_const_unstable(feature = "const_vec_string_slice", issue = "129041")]
|
||||
pub const fn is_empty(&self) -> bool {
|
||||
self.len() == 0
|
||||
}
|
||||
|
||||
@ -2589,7 +2601,7 @@ impl ops::Deref for String {
|
||||
|
||||
#[inline]
|
||||
fn deref(&self) -> &str {
|
||||
unsafe { str::from_utf8_unchecked(&self.vec) }
|
||||
self.as_str()
|
||||
}
|
||||
}
|
||||
|
||||
@ -2600,7 +2612,7 @@ unsafe impl ops::DerefPure for String {}
|
||||
impl ops::DerefMut for String {
|
||||
#[inline]
|
||||
fn deref_mut(&mut self) -> &mut str {
|
||||
unsafe { str::from_utf8_unchecked_mut(&mut *self.vec) }
|
||||
self.as_mut_str()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1240,7 +1240,8 @@ impl<T, A: Allocator> Vec<T, A> {
|
||||
/// ```
|
||||
#[inline]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn capacity(&self) -> usize {
|
||||
#[rustc_const_unstable(feature = "const_vec_string_slice", issue = "129041")]
|
||||
pub const fn capacity(&self) -> usize {
|
||||
self.buf.capacity()
|
||||
}
|
||||
|
||||
@ -1548,8 +1549,22 @@ impl<T, A: Allocator> Vec<T, A> {
|
||||
#[inline]
|
||||
#[stable(feature = "vec_as_slice", since = "1.7.0")]
|
||||
#[cfg_attr(not(test), rustc_diagnostic_item = "vec_as_slice")]
|
||||
pub fn as_slice(&self) -> &[T] {
|
||||
self
|
||||
#[rustc_const_unstable(feature = "const_vec_string_slice", issue = "129041")]
|
||||
pub const fn as_slice(&self) -> &[T] {
|
||||
// SAFETY: `slice::from_raw_parts` requires pointee is a contiguous, aligned buffer of size
|
||||
// `len` containing properly-initialized `T`s. Data must not be mutated for the returned
|
||||
// lifetime. Further, `len * mem::size_of::<T>` <= `ISIZE::MAX`, and allocation does not
|
||||
// "wrap" through overflowing memory addresses.
|
||||
//
|
||||
// * Vec API guarantees that self.buf:
|
||||
// * contains only properly-initialized items within 0..len
|
||||
// * is aligned, contiguous, and valid for `len` reads
|
||||
// * obeys size and address-wrapping constraints
|
||||
//
|
||||
// * We only construct `&mut` references to `self.buf` through `&mut self` methods; borrow-
|
||||
// check ensures that it is not possible to mutably alias `self.buf` within the
|
||||
// returned lifetime.
|
||||
unsafe { slice::from_raw_parts(self.as_ptr(), self.len) }
|
||||
}
|
||||
|
||||
/// Extracts a mutable slice of the entire vector.
|
||||
@ -1566,8 +1581,22 @@ impl<T, A: Allocator> Vec<T, A> {
|
||||
#[inline]
|
||||
#[stable(feature = "vec_as_slice", since = "1.7.0")]
|
||||
#[cfg_attr(not(test), rustc_diagnostic_item = "vec_as_mut_slice")]
|
||||
pub fn as_mut_slice(&mut self) -> &mut [T] {
|
||||
self
|
||||
#[rustc_const_unstable(feature = "const_vec_string_slice", issue = "129041")]
|
||||
pub const fn as_mut_slice(&mut self) -> &mut [T] {
|
||||
// SAFETY: `slice::from_raw_parts_mut` requires pointee is a contiguous, aligned buffer of
|
||||
// size `len` containing properly-initialized `T`s. Data must not be accessed through any
|
||||
// other pointer for the returned lifetime. Further, `len * mem::size_of::<T>` <=
|
||||
// `ISIZE::MAX` and allocation does not "wrap" through overflowing memory addresses.
|
||||
//
|
||||
// * Vec API guarantees that self.buf:
|
||||
// * contains only properly-initialized items within 0..len
|
||||
// * is aligned, contiguous, and valid for `len` reads
|
||||
// * obeys size and address-wrapping constraints
|
||||
//
|
||||
// * We only construct references to `self.buf` through `&self` and `&mut self` methods;
|
||||
// borrow-check ensures that it is not possible to construct a reference to `self.buf`
|
||||
// within the returned lifetime.
|
||||
unsafe { slice::from_raw_parts_mut(self.as_mut_ptr(), self.len) }
|
||||
}
|
||||
|
||||
/// Returns a raw pointer to the vector's buffer, or a dangling raw pointer
|
||||
@ -1624,9 +1653,10 @@ impl<T, A: Allocator> Vec<T, A> {
|
||||
/// [`as_ptr`]: Vec::as_ptr
|
||||
/// [`as_non_null`]: Vec::as_non_null
|
||||
#[stable(feature = "vec_as_ptr", since = "1.37.0")]
|
||||
#[rustc_const_unstable(feature = "const_vec_string_slice", issue = "129041")]
|
||||
#[rustc_never_returns_null_ptr]
|
||||
#[inline]
|
||||
pub fn as_ptr(&self) -> *const T {
|
||||
pub const fn as_ptr(&self) -> *const T {
|
||||
// We shadow the slice method of the same name to avoid going through
|
||||
// `deref`, which creates an intermediate reference.
|
||||
self.buf.ptr()
|
||||
@ -1685,9 +1715,10 @@ impl<T, A: Allocator> Vec<T, A> {
|
||||
/// [`as_ptr`]: Vec::as_ptr
|
||||
/// [`as_non_null`]: Vec::as_non_null
|
||||
#[stable(feature = "vec_as_ptr", since = "1.37.0")]
|
||||
#[rustc_const_unstable(feature = "const_vec_string_slice", issue = "129041")]
|
||||
#[rustc_never_returns_null_ptr]
|
||||
#[inline]
|
||||
pub fn as_mut_ptr(&mut self) -> *mut T {
|
||||
pub const fn as_mut_ptr(&mut self) -> *mut T {
|
||||
// We shadow the slice method of the same name to avoid going through
|
||||
// `deref_mut`, which creates an intermediate reference.
|
||||
self.buf.ptr()
|
||||
@ -2628,8 +2659,9 @@ impl<T, A: Allocator> Vec<T, A> {
|
||||
/// ```
|
||||
#[inline]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[rustc_const_unstable(feature = "const_vec_string_slice", issue = "129041")]
|
||||
#[rustc_confusables("length", "size")]
|
||||
pub fn len(&self) -> usize {
|
||||
pub const fn len(&self) -> usize {
|
||||
self.len
|
||||
}
|
||||
|
||||
@ -2646,7 +2678,8 @@ impl<T, A: Allocator> Vec<T, A> {
|
||||
/// ```
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[cfg_attr(not(test), rustc_diagnostic_item = "vec_is_empty")]
|
||||
pub fn is_empty(&self) -> bool {
|
||||
#[rustc_const_unstable(feature = "const_vec_string_slice", issue = "129041")]
|
||||
pub const fn is_empty(&self) -> bool {
|
||||
self.len() == 0
|
||||
}
|
||||
|
||||
@ -3197,7 +3230,7 @@ impl<T, A: Allocator> ops::Deref for Vec<T, A> {
|
||||
|
||||
#[inline]
|
||||
fn deref(&self) -> &[T] {
|
||||
unsafe { slice::from_raw_parts(self.as_ptr(), self.len) }
|
||||
self.as_slice()
|
||||
}
|
||||
}
|
||||
|
||||
@ -3205,7 +3238,7 @@ impl<T, A: Allocator> ops::Deref for Vec<T, A> {
|
||||
impl<T, A: Allocator> ops::DerefMut for Vec<T, A> {
|
||||
#[inline]
|
||||
fn deref_mut(&mut self) -> &mut [T] {
|
||||
unsafe { slice::from_raw_parts_mut(self.as_mut_ptr(), self.len) }
|
||||
self.as_mut_slice()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -7,6 +7,7 @@ fn main() {
|
||||
let target_vendor =
|
||||
env::var("CARGO_CFG_TARGET_VENDOR").expect("CARGO_CFG_TARGET_VENDOR was not set");
|
||||
let target_env = env::var("CARGO_CFG_TARGET_ENV").expect("CARGO_CFG_TARGET_ENV was not set");
|
||||
let target_abi = env::var("CARGO_CFG_TARGET_ABI").expect("CARGO_CFG_TARGET_ABI was not set");
|
||||
let target_pointer_width: u32 = env::var("CARGO_CFG_TARGET_POINTER_WIDTH")
|
||||
.expect("CARGO_CFG_TARGET_POINTER_WIDTH was not set")
|
||||
.parse()
|
||||
@ -101,7 +102,7 @@ fn main() {
|
||||
// Unsupported <https://github.com/llvm/llvm-project/issues/94434>
|
||||
("arm64ec", _) => false,
|
||||
// MinGW ABI bugs <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115054>
|
||||
("x86_64", "windows") if target_env == "gnu" => false,
|
||||
("x86_64", "windows") if target_env == "gnu" && target_abi != "llvm" => false,
|
||||
// Infinite recursion <https://github.com/llvm/llvm-project/issues/97981>
|
||||
("csky", _) => false,
|
||||
("hexagon", _) => false,
|
||||
@ -129,7 +130,7 @@ fn main() {
|
||||
// ABI unsupported <https://github.com/llvm/llvm-project/issues/41838>
|
||||
("sparc", _) => false,
|
||||
// MinGW ABI bugs <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115054>
|
||||
("x86_64", "windows") if target_env == "gnu" => false,
|
||||
("x86_64", "windows") if target_env == "gnu" && target_abi != "llvm" => false,
|
||||
// 64-bit Linux is about the only platform to have f128 symbols by default
|
||||
(_, "linux") if target_pointer_width == 64 => true,
|
||||
// Almost all OSs are missing symbol. compiler-builtins will have to add them.
|
||||
|
@ -5,66 +5,61 @@ fn vec_deref_to_slice(_1: &Vec<u8>) -> &[u8] {
|
||||
let mut _0: &[u8];
|
||||
scope 1 (inlined <Vec<u8> as Deref>::deref) {
|
||||
debug self => _1;
|
||||
let mut _6: usize;
|
||||
scope 2 (inlined Vec::<u8>::as_ptr) {
|
||||
scope 2 (inlined Vec::<u8>::as_slice) {
|
||||
debug self => _1;
|
||||
let mut _2: &alloc::raw_vec::RawVec<u8>;
|
||||
scope 3 (inlined alloc::raw_vec::RawVec::<u8>::ptr) {
|
||||
debug self => _2;
|
||||
let mut _3: &alloc::raw_vec::RawVecInner;
|
||||
scope 4 (inlined alloc::raw_vec::RawVecInner::ptr::<u8>) {
|
||||
debug self => _3;
|
||||
scope 5 (inlined alloc::raw_vec::RawVecInner::non_null::<u8>) {
|
||||
let mut _6: usize;
|
||||
scope 3 (inlined Vec::<u8>::as_ptr) {
|
||||
debug self => _1;
|
||||
let mut _2: &alloc::raw_vec::RawVec<u8>;
|
||||
scope 4 (inlined alloc::raw_vec::RawVec::<u8>::ptr) {
|
||||
debug self => _2;
|
||||
let mut _3: &alloc::raw_vec::RawVecInner;
|
||||
scope 5 (inlined alloc::raw_vec::RawVecInner::ptr::<u8>) {
|
||||
debug self => _3;
|
||||
let mut _4: std::ptr::NonNull<u8>;
|
||||
scope 6 (inlined Unique::<u8>::cast::<u8>) {
|
||||
debug ((self: Unique<u8>).0: std::ptr::NonNull<u8>) => _4;
|
||||
debug ((self: Unique<u8>).1: std::marker::PhantomData<u8>) => const PhantomData::<u8>;
|
||||
scope 7 (inlined NonNull::<u8>::cast::<u8>) {
|
||||
debug self => _4;
|
||||
scope 8 (inlined NonNull::<u8>::as_ptr) {
|
||||
scope 6 (inlined alloc::raw_vec::RawVecInner::non_null::<u8>) {
|
||||
debug self => _3;
|
||||
let mut _4: std::ptr::NonNull<u8>;
|
||||
scope 7 (inlined Unique::<u8>::cast::<u8>) {
|
||||
debug ((self: Unique<u8>).0: std::ptr::NonNull<u8>) => _4;
|
||||
debug ((self: Unique<u8>).1: std::marker::PhantomData<u8>) => const PhantomData::<u8>;
|
||||
scope 8 (inlined NonNull::<u8>::cast::<u8>) {
|
||||
debug self => _4;
|
||||
let mut _5: *const u8;
|
||||
scope 9 (inlined NonNull::<u8>::as_ptr) {
|
||||
debug self => _4;
|
||||
let mut _5: *const u8;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
scope 9 (inlined #[track_caller] <Unique<u8> as Into<NonNull<u8>>>::into) {
|
||||
debug ((self: Unique<u8>).0: std::ptr::NonNull<u8>) => _4;
|
||||
debug ((self: Unique<u8>).1: std::marker::PhantomData<u8>) => const PhantomData::<u8>;
|
||||
scope 10 (inlined <NonNull<u8> as From<Unique<u8>>>::from) {
|
||||
debug ((unique: Unique<u8>).0: std::ptr::NonNull<u8>) => _4;
|
||||
debug ((unique: Unique<u8>).1: std::marker::PhantomData<u8>) => const PhantomData::<u8>;
|
||||
scope 11 (inlined Unique::<u8>::as_non_null_ptr) {
|
||||
debug ((self: Unique<u8>).0: std::ptr::NonNull<u8>) => _4;
|
||||
debug ((self: Unique<u8>).1: std::marker::PhantomData<u8>) => const PhantomData::<u8>;
|
||||
}
|
||||
scope 10 (inlined Unique::<u8>::as_non_null_ptr) {
|
||||
debug ((self: Unique<u8>).0: std::ptr::NonNull<u8>) => _4;
|
||||
debug ((self: Unique<u8>).1: std::marker::PhantomData<u8>) => const PhantomData::<u8>;
|
||||
}
|
||||
}
|
||||
}
|
||||
scope 12 (inlined NonNull::<u8>::as_ptr) {
|
||||
debug self => _4;
|
||||
scope 11 (inlined NonNull::<u8>::as_ptr) {
|
||||
debug self => _4;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
scope 13 (inlined std::slice::from_raw_parts::<'_, u8>) {
|
||||
debug data => _5;
|
||||
debug len => _6;
|
||||
let _7: *const [u8];
|
||||
scope 14 (inlined core::ub_checks::check_language_ub) {
|
||||
scope 15 (inlined core::ub_checks::check_language_ub::runtime) {
|
||||
}
|
||||
}
|
||||
scope 16 (inlined std::mem::size_of::<u8>) {
|
||||
}
|
||||
scope 17 (inlined align_of::<u8>) {
|
||||
}
|
||||
scope 18 (inlined slice_from_raw_parts::<u8>) {
|
||||
scope 12 (inlined std::slice::from_raw_parts::<'_, u8>) {
|
||||
debug data => _5;
|
||||
debug len => _6;
|
||||
scope 19 (inlined std::ptr::from_raw_parts::<[u8], u8>) {
|
||||
debug data_pointer => _5;
|
||||
debug metadata => _6;
|
||||
let _7: *const [u8];
|
||||
scope 13 (inlined core::ub_checks::check_language_ub) {
|
||||
scope 14 (inlined core::ub_checks::check_language_ub::runtime) {
|
||||
}
|
||||
}
|
||||
scope 15 (inlined std::mem::size_of::<u8>) {
|
||||
}
|
||||
scope 16 (inlined align_of::<u8>) {
|
||||
}
|
||||
scope 17 (inlined slice_from_raw_parts::<u8>) {
|
||||
debug data => _5;
|
||||
debug len => _6;
|
||||
scope 18 (inlined std::ptr::from_raw_parts::<[u8], u8>) {
|
||||
debug data_pointer => _5;
|
||||
debug metadata => _6;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5,66 +5,61 @@ fn vec_deref_to_slice(_1: &Vec<u8>) -> &[u8] {
|
||||
let mut _0: &[u8];
|
||||
scope 1 (inlined <Vec<u8> as Deref>::deref) {
|
||||
debug self => _1;
|
||||
let mut _6: usize;
|
||||
scope 2 (inlined Vec::<u8>::as_ptr) {
|
||||
scope 2 (inlined Vec::<u8>::as_slice) {
|
||||
debug self => _1;
|
||||
let mut _2: &alloc::raw_vec::RawVec<u8>;
|
||||
scope 3 (inlined alloc::raw_vec::RawVec::<u8>::ptr) {
|
||||
debug self => _2;
|
||||
let mut _3: &alloc::raw_vec::RawVecInner;
|
||||
scope 4 (inlined alloc::raw_vec::RawVecInner::ptr::<u8>) {
|
||||
debug self => _3;
|
||||
scope 5 (inlined alloc::raw_vec::RawVecInner::non_null::<u8>) {
|
||||
let mut _6: usize;
|
||||
scope 3 (inlined Vec::<u8>::as_ptr) {
|
||||
debug self => _1;
|
||||
let mut _2: &alloc::raw_vec::RawVec<u8>;
|
||||
scope 4 (inlined alloc::raw_vec::RawVec::<u8>::ptr) {
|
||||
debug self => _2;
|
||||
let mut _3: &alloc::raw_vec::RawVecInner;
|
||||
scope 5 (inlined alloc::raw_vec::RawVecInner::ptr::<u8>) {
|
||||
debug self => _3;
|
||||
let mut _4: std::ptr::NonNull<u8>;
|
||||
scope 6 (inlined Unique::<u8>::cast::<u8>) {
|
||||
debug ((self: Unique<u8>).0: std::ptr::NonNull<u8>) => _4;
|
||||
debug ((self: Unique<u8>).1: std::marker::PhantomData<u8>) => const PhantomData::<u8>;
|
||||
scope 7 (inlined NonNull::<u8>::cast::<u8>) {
|
||||
debug self => _4;
|
||||
scope 8 (inlined NonNull::<u8>::as_ptr) {
|
||||
scope 6 (inlined alloc::raw_vec::RawVecInner::non_null::<u8>) {
|
||||
debug self => _3;
|
||||
let mut _4: std::ptr::NonNull<u8>;
|
||||
scope 7 (inlined Unique::<u8>::cast::<u8>) {
|
||||
debug ((self: Unique<u8>).0: std::ptr::NonNull<u8>) => _4;
|
||||
debug ((self: Unique<u8>).1: std::marker::PhantomData<u8>) => const PhantomData::<u8>;
|
||||
scope 8 (inlined NonNull::<u8>::cast::<u8>) {
|
||||
debug self => _4;
|
||||
let mut _5: *const u8;
|
||||
scope 9 (inlined NonNull::<u8>::as_ptr) {
|
||||
debug self => _4;
|
||||
let mut _5: *const u8;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
scope 9 (inlined #[track_caller] <Unique<u8> as Into<NonNull<u8>>>::into) {
|
||||
debug ((self: Unique<u8>).0: std::ptr::NonNull<u8>) => _4;
|
||||
debug ((self: Unique<u8>).1: std::marker::PhantomData<u8>) => const PhantomData::<u8>;
|
||||
scope 10 (inlined <NonNull<u8> as From<Unique<u8>>>::from) {
|
||||
debug ((unique: Unique<u8>).0: std::ptr::NonNull<u8>) => _4;
|
||||
debug ((unique: Unique<u8>).1: std::marker::PhantomData<u8>) => const PhantomData::<u8>;
|
||||
scope 11 (inlined Unique::<u8>::as_non_null_ptr) {
|
||||
debug ((self: Unique<u8>).0: std::ptr::NonNull<u8>) => _4;
|
||||
debug ((self: Unique<u8>).1: std::marker::PhantomData<u8>) => const PhantomData::<u8>;
|
||||
}
|
||||
scope 10 (inlined Unique::<u8>::as_non_null_ptr) {
|
||||
debug ((self: Unique<u8>).0: std::ptr::NonNull<u8>) => _4;
|
||||
debug ((self: Unique<u8>).1: std::marker::PhantomData<u8>) => const PhantomData::<u8>;
|
||||
}
|
||||
}
|
||||
}
|
||||
scope 12 (inlined NonNull::<u8>::as_ptr) {
|
||||
debug self => _4;
|
||||
scope 11 (inlined NonNull::<u8>::as_ptr) {
|
||||
debug self => _4;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
scope 13 (inlined std::slice::from_raw_parts::<'_, u8>) {
|
||||
debug data => _5;
|
||||
debug len => _6;
|
||||
let _7: *const [u8];
|
||||
scope 14 (inlined core::ub_checks::check_language_ub) {
|
||||
scope 15 (inlined core::ub_checks::check_language_ub::runtime) {
|
||||
}
|
||||
}
|
||||
scope 16 (inlined std::mem::size_of::<u8>) {
|
||||
}
|
||||
scope 17 (inlined align_of::<u8>) {
|
||||
}
|
||||
scope 18 (inlined slice_from_raw_parts::<u8>) {
|
||||
scope 12 (inlined std::slice::from_raw_parts::<'_, u8>) {
|
||||
debug data => _5;
|
||||
debug len => _6;
|
||||
scope 19 (inlined std::ptr::from_raw_parts::<[u8], u8>) {
|
||||
debug data_pointer => _5;
|
||||
debug metadata => _6;
|
||||
let _7: *const [u8];
|
||||
scope 13 (inlined core::ub_checks::check_language_ub) {
|
||||
scope 14 (inlined core::ub_checks::check_language_ub::runtime) {
|
||||
}
|
||||
}
|
||||
scope 15 (inlined std::mem::size_of::<u8>) {
|
||||
}
|
||||
scope 16 (inlined align_of::<u8>) {
|
||||
}
|
||||
scope 17 (inlined slice_from_raw_parts::<u8>) {
|
||||
debug data => _5;
|
||||
debug len => _6;
|
||||
scope 18 (inlined std::ptr::from_raw_parts::<[u8], u8>) {
|
||||
debug data_pointer => _5;
|
||||
debug metadata => _6;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
//@ known-bug: #103507
|
||||
|
||||
#![feature(const_trait_impl)]
|
||||
#![feature(const_trait_impl, const_vec_string_slice)]
|
||||
|
||||
struct Foo<'a> {
|
||||
bar: &'a mut Vec<usize>,
|
||||
|
@ -1,11 +1,3 @@
|
||||
error[E0015]: cannot call non-const fn `Vec::<u32>::len` in constant functions
|
||||
--> $DIR/issue-94675.rs:11:27
|
||||
|
|
||||
LL | self.bar[0] = baz.len();
|
||||
| ^^^^^
|
||||
|
|
||||
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
|
||||
|
||||
error[E0015]: cannot call non-const operator in constant functions
|
||||
--> $DIR/issue-94675.rs:11:17
|
||||
|
|
||||
@ -20,6 +12,6 @@ help: add `#![feature(effects)]` to the crate attributes to enable
|
||||
LL + #![feature(effects)]
|
||||
|
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0015`.
|
||||
|
Loading…
Reference in New Issue
Block a user