mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-27 18:57:42 +03:00
Auto merge of #152934 - matthiaskrgr:rollup-lcy7ROk, r=matthiaskrgr
Rollup of 6 pull requests Successful merges: - rust-lang/rust#152929 (Tighten the `!range` bounds on alignments in vtables) - rust-lang/rust#151603 (Stabilize `str_as_str`) - rust-lang/rust#152878 (Remove two more flaky assertions from `oneshot` tests) - rust-lang/rust#152915 (Error on attempt to construct scalable vector type) - rust-lang/rust#152925 (Improve runtest revision redundant cfg check) - rust-lang/rust#152928 (Update wasm-component-ld)
This commit is contained in:
+30
-28
@@ -1665,7 +1665,6 @@ dependencies = [
|
||||
"allocator-api2",
|
||||
"equivalent",
|
||||
"foldhash 0.1.5",
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1675,6 +1674,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100"
|
||||
dependencies = [
|
||||
"foldhash 0.2.0",
|
||||
"serde",
|
||||
"serde_core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1898,9 +1899,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "id-arena"
|
||||
version = "2.2.1"
|
||||
version = "2.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "25a2bc672d1148e28034f176e01fffebb08b35768468cc954630da77a1449005"
|
||||
checksum = "3d3067d79b975e8844ca9eb072e16b31c3c1c36928edf9c6789548c524d0d954"
|
||||
|
||||
[[package]]
|
||||
name = "ident_case"
|
||||
@@ -6152,9 +6153,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wasm-component-ld"
|
||||
version = "0.5.20"
|
||||
version = "0.5.21"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "846d20ed66ae37b7a237e36dfcd2fdc979eae82a46cdb0586f9bba80782fd789"
|
||||
checksum = "59dcd765f510df84d1677a502c49057761486597a95950b4c92153e5707af091"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"clap",
|
||||
@@ -6163,7 +6164,7 @@ dependencies = [
|
||||
"libc",
|
||||
"tempfile",
|
||||
"wasi-preview1-component-adapter-provider",
|
||||
"wasmparser 0.243.0",
|
||||
"wasmparser 0.245.1",
|
||||
"wat",
|
||||
"windows-sys 0.61.2",
|
||||
"winsplit",
|
||||
@@ -6190,24 +6191,24 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wasm-encoder"
|
||||
version = "0.243.0"
|
||||
version = "0.245.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c55db9c896d70bd9fa535ce83cd4e1f2ec3726b0edd2142079f594fc3be1cb35"
|
||||
checksum = "3f9dca005e69bf015e45577e415b9af8c67e8ee3c0e38b5b0add5aa92581ed5c"
|
||||
dependencies = [
|
||||
"leb128fmt",
|
||||
"wasmparser 0.243.0",
|
||||
"wasmparser 0.245.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasm-metadata"
|
||||
version = "0.243.0"
|
||||
version = "0.245.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "eae05bf9579f45a62e8d0a4e3f52eaa8da518883ac5afa482ec8256c329ecd56"
|
||||
checksum = "da55e60097e8b37b475a0fa35c3420dd71d9eb7bd66109978ab55faf56a57efb"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"indexmap",
|
||||
"wasm-encoder 0.243.0",
|
||||
"wasmparser 0.243.0",
|
||||
"wasm-encoder 0.245.1",
|
||||
"wasmparser 0.245.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -6232,12 +6233,12 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wasmparser"
|
||||
version = "0.243.0"
|
||||
version = "0.245.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f6d8db401b0528ec316dfbe579e6ab4152d61739cfe076706d2009127970159d"
|
||||
checksum = "4f08c9adee0428b7bddf3890fc27e015ac4b761cc608c822667102b8bfd6995e"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"hashbrown 0.15.5",
|
||||
"hashbrown 0.16.1",
|
||||
"indexmap",
|
||||
"semver",
|
||||
"serde",
|
||||
@@ -6245,22 +6246,22 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wast"
|
||||
version = "243.0.0"
|
||||
version = "245.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "df21d01c2d91e46cb7a221d79e58a2d210ea02020d57c092e79255cc2999ca7f"
|
||||
checksum = "28cf1149285569120b8ce39db8b465e8a2b55c34cbb586bd977e43e2bc7300bf"
|
||||
dependencies = [
|
||||
"bumpalo",
|
||||
"leb128fmt",
|
||||
"memchr",
|
||||
"unicode-width 0.2.2",
|
||||
"wasm-encoder 0.243.0",
|
||||
"wasm-encoder 0.245.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wat"
|
||||
version = "1.243.0"
|
||||
version = "1.245.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "226a9a91cd80a50449312fef0c75c23478fcecfcc4092bdebe1dc8e760ef521b"
|
||||
checksum = "cd48d1679b6858988cb96b154dda0ec5bbb09275b71db46057be37332d5477be"
|
||||
dependencies = [
|
||||
"wast",
|
||||
]
|
||||
@@ -6707,9 +6708,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wit-component"
|
||||
version = "0.243.0"
|
||||
version = "0.245.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "36f9fc53513e461ce51dcf17a3e331752cb829f1d187069e54af5608fc998fe4"
|
||||
checksum = "4894f10d2d5cbc17c77e91f86a1e48e191a788da4425293b55c98b44ba3fcac9"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"bitflags",
|
||||
@@ -6718,19 +6719,20 @@ dependencies = [
|
||||
"serde",
|
||||
"serde_derive",
|
||||
"serde_json",
|
||||
"wasm-encoder 0.243.0",
|
||||
"wasm-encoder 0.245.1",
|
||||
"wasm-metadata",
|
||||
"wasmparser 0.243.0",
|
||||
"wasmparser 0.245.1",
|
||||
"wit-parser",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wit-parser"
|
||||
version = "0.243.0"
|
||||
version = "0.245.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "df983a8608e513d8997f435bb74207bf0933d0e49ca97aa9d8a6157164b9b7fc"
|
||||
checksum = "330698718e82983499419494dd1e3d7811a457a9bf9f69734e8c5f07a2547929"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"hashbrown 0.16.1",
|
||||
"id-arena",
|
||||
"indexmap",
|
||||
"log",
|
||||
@@ -6739,7 +6741,7 @@ dependencies = [
|
||||
"serde_derive",
|
||||
"serde_json",
|
||||
"unicode-xid",
|
||||
"wasmparser 0.243.0",
|
||||
"wasmparser 0.245.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
||||
@@ -1036,6 +1036,19 @@ impl Align {
|
||||
// LLVM has a maximal supported alignment of 2^29, we inherit that.
|
||||
pub const MAX: Align = Align { pow2: 29 };
|
||||
|
||||
/// Either `1 << (pointer_bits - 1)` or [`Align::MAX`], whichever is smaller.
|
||||
#[inline]
|
||||
pub fn max_for_target(tdl: &TargetDataLayout) -> Align {
|
||||
let pointer_bits = tdl.pointer_size().bits();
|
||||
if let Ok(pointer_bits) = u8::try_from(pointer_bits)
|
||||
&& pointer_bits <= Align::MAX.pow2
|
||||
{
|
||||
Align { pow2: pointer_bits - 1 }
|
||||
} else {
|
||||
Align::MAX
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn from_bits(bits: u64) -> Result<Align, AlignFromBytesError> {
|
||||
Align::from_bytes(Size::from_bits(bits).bytes())
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use rustc_abi::WrappingRange;
|
||||
use rustc_abi::{Align, WrappingRange};
|
||||
use rustc_middle::mir::SourceInfo;
|
||||
use rustc_middle::ty::{self, Ty, TyCtxt};
|
||||
use rustc_middle::{bug, span_bug};
|
||||
@@ -179,9 +179,11 @@ pub fn codegen_intrinsic_call(
|
||||
let size_bound = bx.data_layout().ptr_sized_integer().signed_max() as u128;
|
||||
bx.range_metadata(value, WrappingRange { start: 0, end: size_bound });
|
||||
}
|
||||
// Alignment is always nonzero.
|
||||
// Alignment is always a power of two, thus 1..=0x800…000,
|
||||
// but also bounded by the maximum we support in type layout.
|
||||
sym::vtable_align => {
|
||||
bx.range_metadata(value, WrappingRange { start: 1, end: !0 })
|
||||
let align_bound = Align::max_for_target(bx.data_layout()).bytes().into();
|
||||
bx.range_metadata(value, WrappingRange { start: 1, end: align_bound })
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
//! Computing the size and alignment of a value.
|
||||
|
||||
use rustc_abi::WrappingRange;
|
||||
use rustc_abi::{Align, WrappingRange};
|
||||
use rustc_hir::LangItem;
|
||||
use rustc_middle::bug;
|
||||
use rustc_middle::ty::print::{with_no_trimmed_paths, with_no_visible_paths};
|
||||
@@ -36,8 +36,10 @@ pub fn size_and_align_of_dst<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
|
||||
// Size is always <= isize::MAX.
|
||||
let size_bound = bx.data_layout().ptr_sized_integer().signed_max() as u128;
|
||||
bx.range_metadata(size, WrappingRange { start: 0, end: size_bound });
|
||||
// Alignment is always nonzero.
|
||||
bx.range_metadata(align, WrappingRange { start: 1, end: !0 });
|
||||
// Alignment is always a power of two, thus 1..=0x800…000,
|
||||
// but also bounded by the maximum we support in type layout.
|
||||
let align_bound = Align::max_for_target(bx.data_layout()).bytes().into();
|
||||
bx.range_metadata(align, WrappingRange { start: 1, end: align_bound });
|
||||
|
||||
(size, align)
|
||||
}
|
||||
|
||||
@@ -98,6 +98,15 @@ pub(crate) fn check_expr_call(
|
||||
_ => { /* cannot have a non-rust abi */ }
|
||||
}
|
||||
|
||||
if self.is_scalable_vector_ctor(autoderef.final_ty()) {
|
||||
let mut err = self.dcx().create_err(errors::ScalableVectorCtor {
|
||||
span: callee_expr.span,
|
||||
ty: autoderef.final_ty(),
|
||||
});
|
||||
err.span_label(callee_expr.span, "you can create scalable vectors using intrinsics");
|
||||
Ty::new_error(self.tcx, err.emit());
|
||||
}
|
||||
|
||||
self.register_predicates(autoderef.into_obligations());
|
||||
|
||||
let output = match result {
|
||||
@@ -420,6 +429,19 @@ fn try_overloaded_call_traits(
|
||||
None
|
||||
}
|
||||
|
||||
fn is_scalable_vector_ctor(&self, callee_ty: Ty<'_>) -> bool {
|
||||
if let ty::FnDef(def_id, _) = callee_ty.kind()
|
||||
&& let def::DefKind::Ctor(def::CtorOf::Struct, _) = self.tcx.def_kind(def_id)
|
||||
{
|
||||
self.tcx
|
||||
.opt_parent(*def_id)
|
||||
.and_then(|id| self.tcx.adt_def(id).repr().scalable)
|
||||
.is_some()
|
||||
} else {
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
/// Give appropriate suggestion when encountering `||{/* not callable */}()`, where the
|
||||
/// likely intention is to call the closure, suggest `(||{})()`. (#55851)
|
||||
fn identify_bad_closure_def_and_call(
|
||||
|
||||
@@ -569,6 +569,14 @@ pub(crate) struct InvalidCallee<'tcx> {
|
||||
pub found: String,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag("scalable vector types cannot be initialised using their constructor")]
|
||||
pub(crate) struct ScalableVectorCtor<'tcx> {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
pub ty: Ty<'tcx>,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag("cannot cast `{$expr_ty}` to a pointer that {$known_wide ->
|
||||
[true] is
|
||||
|
||||
@@ -33,7 +33,6 @@
|
||||
#![feature(thin_box)]
|
||||
#![feature(drain_keep_rest)]
|
||||
#![feature(local_waker)]
|
||||
#![feature(str_as_str)]
|
||||
#![feature(strict_provenance_lints)]
|
||||
#![feature(string_replace_in_place)]
|
||||
#![feature(vec_deque_truncate_front)]
|
||||
|
||||
@@ -74,7 +74,6 @@ pub const fn new<B: ?Sized + [const] AsRef<[u8]>>(bytes: &B) -> &Self {
|
||||
/// it helps dereferencing other "container" types,
|
||||
/// for example `Box<ByteStr>` or `Arc<ByteStr>`.
|
||||
#[inline]
|
||||
// #[unstable(feature = "str_as_str", issue = "130366")]
|
||||
#[unstable(feature = "bstr", issue = "134915")]
|
||||
pub const fn as_byte_str(&self) -> &ByteStr {
|
||||
self
|
||||
@@ -86,7 +85,6 @@ pub const fn as_byte_str(&self) -> &ByteStr {
|
||||
/// it helps dereferencing other "container" types,
|
||||
/// for example `Box<ByteStr>` or `MutexGuard<ByteStr>`.
|
||||
#[inline]
|
||||
// #[unstable(feature = "str_as_str", issue = "130366")]
|
||||
#[unstable(feature = "bstr", issue = "134915")]
|
||||
pub const fn as_mut_byte_str(&mut self) -> &mut ByteStr {
|
||||
self
|
||||
|
||||
@@ -655,7 +655,8 @@ pub fn display(&self) -> impl fmt::Display {
|
||||
/// it helps dereferencing other string-like types to string slices,
|
||||
/// for example references to `Box<CStr>` or `Arc<CStr>`.
|
||||
#[inline]
|
||||
#[unstable(feature = "str_as_str", issue = "130366")]
|
||||
#[stable(feature = "str_as_str", since = "CURRENT_RUSTC_VERSION")]
|
||||
#[rustc_const_stable(feature = "str_as_str", since = "CURRENT_RUSTC_VERSION")]
|
||||
pub const fn as_c_str(&self) -> &CStr {
|
||||
self
|
||||
}
|
||||
|
||||
@@ -5337,7 +5337,8 @@ pub fn subslice_range(&self, subslice: &[T]) -> Option<Range<usize>> {
|
||||
/// it helps dereferencing other "container" types to slices,
|
||||
/// for example `Box<[T]>` or `Arc<[T]>`.
|
||||
#[inline]
|
||||
#[unstable(feature = "str_as_str", issue = "130366")]
|
||||
#[stable(feature = "str_as_str", since = "CURRENT_RUSTC_VERSION")]
|
||||
#[rustc_const_stable(feature = "str_as_str", since = "CURRENT_RUSTC_VERSION")]
|
||||
pub const fn as_slice(&self) -> &[T] {
|
||||
self
|
||||
}
|
||||
@@ -5348,7 +5349,8 @@ pub const fn as_slice(&self) -> &[T] {
|
||||
/// it helps dereferencing other "container" types to slices,
|
||||
/// for example `Box<[T]>` or `MutexGuard<[T]>`.
|
||||
#[inline]
|
||||
#[unstable(feature = "str_as_str", issue = "130366")]
|
||||
#[stable(feature = "str_as_str", since = "CURRENT_RUSTC_VERSION")]
|
||||
#[rustc_const_stable(feature = "str_as_str", since = "CURRENT_RUSTC_VERSION")]
|
||||
pub const fn as_mut_slice(&mut self) -> &mut [T] {
|
||||
self
|
||||
}
|
||||
|
||||
@@ -3137,7 +3137,8 @@ pub fn substr_range(&self, substr: &str) -> Option<Range<usize>> {
|
||||
/// it helps dereferencing other string-like types to string slices,
|
||||
/// for example references to `Box<str>` or `Arc<str>`.
|
||||
#[inline]
|
||||
#[unstable(feature = "str_as_str", issue = "130366")]
|
||||
#[stable(feature = "str_as_str", since = "CURRENT_RUSTC_VERSION")]
|
||||
#[rustc_const_stable(feature = "str_as_str", since = "CURRENT_RUSTC_VERSION")]
|
||||
pub const fn as_str(&self) -> &str {
|
||||
self
|
||||
}
|
||||
|
||||
@@ -1285,7 +1285,8 @@ pub fn display(&self) -> Display<'_> {
|
||||
/// it helps dereferencing other string-like types to string slices,
|
||||
/// for example references to `Box<OsStr>` or `Arc<OsStr>`.
|
||||
#[inline]
|
||||
#[unstable(feature = "str_as_str", issue = "130366")]
|
||||
#[stable(feature = "str_as_str", since = "CURRENT_RUSTC_VERSION")]
|
||||
#[rustc_const_stable(feature = "str_as_str", since = "CURRENT_RUSTC_VERSION")]
|
||||
pub const fn as_os_str(&self) -> &OsStr {
|
||||
self
|
||||
}
|
||||
|
||||
@@ -3235,7 +3235,8 @@ pub fn display(&self) -> Display<'_> {
|
||||
/// it helps dereferencing other `PathBuf`-like types to `Path`s,
|
||||
/// for example references to `Box<Path>` or `Arc<Path>`.
|
||||
#[inline]
|
||||
#[unstable(feature = "str_as_str", issue = "130366")]
|
||||
#[stable(feature = "str_as_str", since = "CURRENT_RUSTC_VERSION")]
|
||||
#[rustc_const_stable(feature = "str_as_str", since = "CURRENT_RUSTC_VERSION")]
|
||||
pub const fn as_path(&self) -> &Path {
|
||||
self
|
||||
}
|
||||
|
||||
@@ -243,7 +243,9 @@ fn recv_deadline_passed() {
|
||||
}
|
||||
|
||||
assert!(start.elapsed() >= timeout);
|
||||
assert!(start.elapsed() < timeout * 3);
|
||||
// FIXME(#152878): An upper-bound assertion on the elapsed time was removed,
|
||||
// because CI runners can starve individual threads for a surprisingly long
|
||||
// time, leading to flaky failures.
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -252,12 +254,16 @@ fn recv_time_passed() {
|
||||
|
||||
let start = Instant::now();
|
||||
let timeout = Duration::from_millis(100);
|
||||
|
||||
match receiver.recv_timeout(timeout) {
|
||||
Err(RecvTimeoutError::Timeout(_)) => {}
|
||||
_ => panic!("expected timeout error"),
|
||||
}
|
||||
|
||||
assert!(start.elapsed() >= timeout);
|
||||
assert!(start.elapsed() < timeout * 3);
|
||||
// FIXME(#152878): An upper-bound assertion on the elapsed time was removed,
|
||||
// because CI runners can starve individual threads for a surprisingly long
|
||||
// time, leading to flaky failures.
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -504,12 +504,11 @@ fn set_revision_flags(&self, cmd: &mut Command) {
|
||||
let normalized_revision = normalize_revision(revision);
|
||||
let cfg_arg = ["--cfg", &normalized_revision];
|
||||
let arg = format!("--cfg={normalized_revision}");
|
||||
if self
|
||||
.props
|
||||
.compile_flags
|
||||
.windows(2)
|
||||
.any(|args| args == cfg_arg || args[0] == arg || args[1] == arg)
|
||||
{
|
||||
// Handle if compile_flags is length 1
|
||||
let contains_arg =
|
||||
self.props.compile_flags.iter().any(|considered_arg| *considered_arg == arg);
|
||||
let contains_cfg_arg = self.props.compile_flags.windows(2).any(|args| args == cfg_arg);
|
||||
if contains_arg || contains_cfg_arg {
|
||||
error!(
|
||||
"redundant cfg argument `{normalized_revision}` is already created by the \
|
||||
revision"
|
||||
|
||||
@@ -10,4 +10,4 @@ name = "wasm-component-ld"
|
||||
path = "src/main.rs"
|
||||
|
||||
[dependencies]
|
||||
wasm-component-ld = "0.5.20"
|
||||
wasm-component-ld = "0.5.21"
|
||||
|
||||
@@ -64,4 +64,4 @@ pub unsafe fn align_load_from_vtable_align_intrinsic(x: &dyn Trait) -> usize {
|
||||
core::intrinsics::vtable_align(vtable)
|
||||
}
|
||||
|
||||
// CHECK: [[RANGE_META]] = !{[[USIZE]] 1, [[USIZE]] 0}
|
||||
// CHECK: [[RANGE_META]] = !{[[USIZE]] 1, [[USIZE]] [[#0x20000001]]
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
//@ [COPY] compile-flags: --cfg=copy
|
||||
//@ revisions: COPY CLONE
|
||||
|
||||
// Test case from https://github.com/rust-lang/rust/issues/128081.
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
#![allow(incomplete_features, internal_features)]
|
||||
#![feature(rustc_attrs)]
|
||||
|
||||
#[rustc_scalable_vector(4)]
|
||||
#[allow(non_camel_case_types)]
|
||||
struct svint32_t(i32);
|
||||
fn main() {
|
||||
let foo = svint32_t(1);
|
||||
//~^ ERROR: scalable vector types cannot be initialised using their constructor
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
error: scalable vector types cannot be initialised using their constructor
|
||||
--> $DIR/illegal_init.rs:8:15
|
||||
|
|
||||
LL | let foo = svint32_t(1);
|
||||
| ^^^^^^^^^ you can create scalable vectors using intrinsics
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
Reference in New Issue
Block a user