Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
1ee6e9a
Fix ICE for inherited const conditions on const closures
cijiugechu Apr 6, 2026
968ff5e
remove and rename two `deriving-bounds.rs` tests
cyrgani Apr 21, 2026
90e6477
merge trivial `Clone` tests
cyrgani Apr 21, 2026
1dea6b8
std: Update support for `wasm32-wasip3`
alexcrichton Apr 16, 2026
2863ed6
Add missing `dyn` keyword to `trait_alias` page of the Unstable Book
Omnikar Apr 21, 2026
3a6c164
cleanup `deriving/issue-*.rs`
cyrgani Apr 21, 2026
d54b62f
rename and move `deriving/issue-*.rs`
cyrgani Apr 21, 2026
6ca836b
c-variadic: tweak `std` docs
folkertdev Apr 21, 2026
fe2e5a9
Remove a bunch of unnecessary explicit lifetimes from the ast validator
oli-obk Apr 21, 2026
793c646
Migrate `bfail`/`build-pass` tests to `bpass` (1/2)
Zalathar Apr 21, 2026
0ea8958
Migrate `bfail`/`build-pass` tests to `bpass` (2/2)
Zalathar Apr 21, 2026
edbb862
Add support for `cpass` incremental revisions
Zalathar Apr 21, 2026
87ec57f
Forbid `*-pass` directives in incremental tests
Zalathar Apr 21, 2026
2a68b22
Rollup merge of #155589 - Zalathar:cpass, r=jieyouxu
jhpratt Apr 22, 2026
0ab2cdf
Rollup merge of #155610 - Omnikar:trait-alias-docs-fix, r=mejrs
jhpratt Apr 22, 2026
ca4aaaf
Rollup merge of #155615 - cyrgani:clean-deriving, r=Kivooeo
jhpratt Apr 22, 2026
b622dd0
Rollup merge of #154874 - cijiugechu:fix-const-closure-inherited-cond…
jhpratt Apr 22, 2026
6c0cbcf
Rollup merge of #155605 - alexcrichton:wasip3, r=jhpratt
jhpratt Apr 22, 2026
48f36ed
Rollup merge of #155613 - folkertdev:c-variadic-doc-tweaks, r=tgross35
jhpratt Apr 22, 2026
6fa2b1d
Rollup merge of #155619 - oli-obk:ast-validation-lifetimes, r=dingxia…
jhpratt Apr 22, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 16 additions & 16 deletions compiler/rustc_ast_passes/src/ast_validation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ impl<'a> AstValidator<'a> {
}

// Mirrors `visit::walk_ty`, but tracks relevant state.
fn walk_ty(&mut self, t: &'a Ty) {
fn walk_ty(&mut self, t: &Ty) {
match &t.kind {
TyKind::ImplTrait(_, bounds) => {
self.with_impl_trait(Some(t.span), |this| visit::walk_ty(this, t));
Expand Down Expand Up @@ -731,7 +731,7 @@ impl<'a> AstValidator<'a> {
/// C-variadics must be:
/// - Non-const
/// - Either foreign, or free and `unsafe extern "C"` semantically
fn check_c_variadic_type(&self, fk: FnKind<'a>, attrs: &'a AttrVec) {
fn check_c_variadic_type(&self, fk: FnKind<'_>, attrs: &AttrVec) {
// `...` is already rejected when it is not the final parameter.
let variadic_param = match fk.decl().inputs.last() {
Some(param) if matches!(param.ty.kind, TyKind::CVarArgs) => param,
Expand Down Expand Up @@ -806,7 +806,7 @@ impl<'a> AstValidator<'a> {
fn check_c_variadic_abi(
&self,
abi: ExternAbi,
attrs: &'a AttrVec,
attrs: &AttrVec,
dotdotdot_span: Span,
sig: &FnSig,
) {
Expand Down Expand Up @@ -976,7 +976,7 @@ impl<'a> AstValidator<'a> {
});
}

fn visit_ty_common(&mut self, ty: &'a Ty) {
fn visit_ty_common(&mut self, ty: &Ty) {
match &ty.kind {
TyKind::FnPtr(bfty) => {
self.check_fn_ptr_safety(bfty.decl_span, bfty.safety);
Expand Down Expand Up @@ -1039,13 +1039,13 @@ impl<'a> AstValidator<'a> {
}

// Used within `visit_item` for item kinds where we don't call `visit::walk_item`.
fn visit_attrs_vis(&mut self, attrs: &'a AttrVec, vis: &'a Visibility) {
fn visit_attrs_vis(&mut self, attrs: &AttrVec, vis: &Visibility) {
walk_list!(self, visit_attribute, attrs);
self.visit_vis(vis);
}

// Used within `visit_item` for item kinds where we don't call `visit::walk_item`.
fn visit_attrs_vis_ident(&mut self, attrs: &'a AttrVec, vis: &'a Visibility, ident: &'a Ident) {
fn visit_attrs_vis_ident(&mut self, attrs: &AttrVec, vis: &Visibility, ident: &Ident) {
walk_list!(self, visit_attribute, attrs);
self.visit_vis(vis);
self.visit_ident(ident);
Expand Down Expand Up @@ -1125,17 +1125,17 @@ fn validate_generic_param_order(dcx: DiagCtxtHandle<'_>, generics: &[GenericPara
}
}

impl<'a> Visitor<'a> for AstValidator<'a> {
impl Visitor<'_> for AstValidator<'_> {
fn visit_attribute(&mut self, attr: &Attribute) {
validate_attr::check_attr(&self.sess.psess, attr);
}

fn visit_ty(&mut self, ty: &'a Ty) {
fn visit_ty(&mut self, ty: &Ty) {
self.visit_ty_common(ty);
self.walk_ty(ty)
}

fn visit_item(&mut self, item: &'a Item) {
fn visit_item(&mut self, item: &Item) {
if item.attrs.iter().any(|attr| attr.is_proc_macro_attr()) {
self.has_proc_macro_decls = true;
}
Expand Down Expand Up @@ -1477,7 +1477,7 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
self.lint_node_id = previous_lint_node_id;
}

fn visit_foreign_item(&mut self, fi: &'a ForeignItem) {
fn visit_foreign_item(&mut self, fi: &ForeignItem) {
match &fi.kind {
ForeignItemKind::Fn(box Fn { defaultness, ident, sig, body, .. }) => {
self.check_defaultness(fi.span, *defaultness, AllowDefault::No, AllowFinal::No);
Expand Down Expand Up @@ -1527,7 +1527,7 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
}

// Mirrors `visit::walk_generic_args`, but tracks relevant state.
fn visit_generic_args(&mut self, generic_args: &'a GenericArgs) {
fn visit_generic_args(&mut self, generic_args: &GenericArgs) {
match generic_args {
GenericArgs::AngleBracketed(data) => {
self.check_generic_args_before_constraints(data);
Expand Down Expand Up @@ -1557,7 +1557,7 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
}
}

fn visit_generics(&mut self, generics: &'a Generics) {
fn visit_generics(&mut self, generics: &Generics) {
let mut prev_param_default = None;
for param in &generics.params {
match param.kind {
Expand Down Expand Up @@ -1613,7 +1613,7 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
}
}

fn visit_param_bound(&mut self, bound: &'a GenericBound, ctxt: BoundKind) {
fn visit_param_bound(&mut self, bound: &GenericBound, ctxt: BoundKind) {
match bound {
GenericBound::Trait(trait_ref) => {
match (ctxt, trait_ref.modifiers.constness, trait_ref.modifiers.polarity) {
Expand Down Expand Up @@ -1671,7 +1671,7 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
visit::walk_param_bound(self, bound)
}

fn visit_fn(&mut self, fk: FnKind<'a>, attrs: &AttrVec, span: Span, id: NodeId) {
fn visit_fn(&mut self, fk: FnKind<'_>, attrs: &AttrVec, span: Span, id: NodeId) {
// Only associated `fn`s can have `self` parameters.
let self_semantic = match fk.ctxt() {
Some(FnCtxt::Assoc(_)) => SelfSemantic::Yes,
Expand Down Expand Up @@ -1784,7 +1784,7 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
self.with_tilde_const(disallowed, |this| visit::walk_fn(this, fk));
}

fn visit_assoc_item(&mut self, item: &'a AssocItem, ctxt: AssocCtxt) {
fn visit_assoc_item(&mut self, item: &AssocItem, ctxt: AssocCtxt) {
if let Some(ident) = item.kind.ident()
&& attr::contains_name(&item.attrs, sym::no_mangle)
{
Expand Down Expand Up @@ -1931,7 +1931,7 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
}
}

fn visit_anon_const(&mut self, anon_const: &'a AnonConst) {
fn visit_anon_const(&mut self, anon_const: &AnonConst) {
self.with_tilde_const(
Some(TildeConstReason::AnonConst { span: anon_const.value.span }),
|this| visit::walk_anon_const(this, anon_const),
Expand Down
11 changes: 2 additions & 9 deletions compiler/rustc_trait_selection/src/traits/effects.rs
Original file line number Diff line number Diff line change
Expand Up @@ -556,15 +556,8 @@ fn evaluate_host_effect_for_fn_goal<'tcx>(

ty::Closure(def, args) => {
// For now we limit ourselves to closures without binders. The next solver can handle them.
let sig =
args.as_closure().sig().no_bound_vars().ok_or(EvaluationFailure::NoSolution)?;
(
def,
tcx.mk_args_from_iter(
[ty::GenericArg::from(*sig.inputs().get(0).unwrap()), sig.output().into()]
.into_iter(),
),
)
args.as_closure().sig().no_bound_vars().ok_or(EvaluationFailure::NoSolution)?;
(def, args)
}

// Everything else needs explicit impls or cannot have an impl
Expand Down
20 changes: 16 additions & 4 deletions library/Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,7 @@ dependencies = [
"vex-sdk",
"wasip1",
"wasip2",
"wasip3",
"windows-link 0.0.0",
]

Expand Down Expand Up @@ -418,9 +419,20 @@ dependencies = [

[[package]]
name = "wasip2"
version = "1.0.2+wasi-0.2.9"
version = "1.0.3+wasi-0.2.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9517f9239f02c069db75e65f174b3da828fe5f5b945c4dd26bd25d89c03ebcf5"
checksum = "20064672db26d7cdc89c7798c48a0fdfac8213434a1186e5ef29fd560ae223d6"
dependencies = [
"rustc-std-workspace-alloc",
"rustc-std-workspace-core",
"wit-bindgen",
]

[[package]]
name = "wasip3"
version = "0.6.0+wasi-0.3.0-rc-2026-03-15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ed83456dd6a0b8581998c0365e4651fa2997e5093b49243b7f35391afaa7a3d9"
dependencies = [
"rustc-std-workspace-alloc",
"rustc-std-workspace-core",
Expand Down Expand Up @@ -513,9 +525,9 @@ checksum = "d6bbff5f0aada427a1e5a6da5f1f98158182f26556f345ac9e04d36d0ebed650"

[[package]]
name = "wit-bindgen"
version = "0.51.0"
version = "0.57.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d7249219f66ced02969388cf2bb044a09756a083d0fab1e566056b04d9fbcaa5"
checksum = "1ebf944e87a7c253233ad6766e082e3cd714b5d03812acc24c318f549614536e"
dependencies = [
"rustc-std-workspace-alloc",
"rustc-std-workspace-core",
Expand Down
41 changes: 30 additions & 11 deletions library/core/src/ffi/va_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -213,14 +213,15 @@ crate::cfg_select! {
/// assert_eq!(unsafe { my_func(3, 42i32, -7i32, 20i32) }, 55);
/// ```
///
/// The [`VaList::arg`] method can be used to read an argument from the list. This method
/// automatically advances the `VaList` to the next argument. The C equivalent is `va_arg`.
/// The [`VaList::arg`] method reads the next argument from the variable argument list,
/// and is equivalent to C `va_arg`.
///
/// Cloning a `VaList` performs the equivalent of C `va_copy`, producing an independent cursor
/// that arguments can be read from without affecting the original. Dropping a `VaList` performs
/// the equivalent of C `va_end`.
///
/// This can be used across an FFI boundary, and fully matches the platform's `va_list`.
/// A `VaList` can be used across an FFI boundary, and fully matches the platform's `va_list` in
/// terms of layout and ABI.
#[repr(transparent)]
#[lang = "va_list"]
pub struct VaList<'a> {
Expand Down Expand Up @@ -285,17 +286,33 @@ mod sealed {

/// Types that are valid to read using [`VaList::arg`].
///
/// # Safety
/// This trait is implemented for primitive types that have a variable argument application-binary
/// interface (ABI) on the current platform. It is always implemented for:
///
/// - [`c_int`], [`c_long`] and [`c_longlong`]
/// - [`c_uint`], [`c_ulong`] and [`c_ulonglong`]
/// - [`c_double`]
/// - `*const T` and `*mut T`
///
/// The standard library implements this trait for primitive types that are
/// expected to have a variable argument application-binary interface (ABI) on all
/// platforms.
/// Implementations for e.g. `i32` or `usize` shouldn't be relied upon directly,
/// because they may not be available on all platforms.
///
/// # Safety
///
/// When C passes variable arguments, integers smaller than [`c_int`] and floats smaller
/// than [`c_double`] are implicitly promoted to [`c_int`] and [`c_double`] respectively.
/// Implementing this trait for types that are subject to this promotion rule is invalid.
/// When C passes variable arguments, signed integers smaller than [`c_int`] are promoted
/// to [`c_int`], unsigned integers smaller than [`c_uint`] are promoted to [`c_uint`],
/// and [`c_float`] is promoted to [`c_double`]. Implementing this trait for types that are
/// subject to this promotion rule is invalid.
///
/// [`c_int`]: core::ffi::c_int
/// [`c_long`]: core::ffi::c_long
/// [`c_longlong`]: core::ffi::c_longlong
///
/// [`c_uint`]: core::ffi::c_uint
/// [`c_ulong`]: core::ffi::c_ulong
/// [`c_ulonglong`]: core::ffi::c_ulonglong
///
/// [`c_float`]: core::ffi::c_float
/// [`c_double`]: core::ffi::c_double
// We may unseal this trait in the future, but currently our `va_arg` implementations don't support
// types with an alignment larger than 8, or with a non-scalar layout. Inline assembly can be used
Expand Down Expand Up @@ -352,14 +369,16 @@ const _: () = {
va_arg_safe_check::<crate::ffi::c_int>();
va_arg_safe_check::<crate::ffi::c_uint>();
va_arg_safe_check::<crate::ffi::c_long>();

va_arg_safe_check::<crate::ffi::c_ulong>();
va_arg_safe_check::<crate::ffi::c_longlong>();
va_arg_safe_check::<crate::ffi::c_ulonglong>();

va_arg_safe_check::<crate::ffi::c_double>();
};

impl<'f> VaList<'f> {
/// Read an argument from the variable argument list, and advance to the next argument.
/// Read the next argument from the variable argument list.
///
/// Only types that implement [`VaArgSafe`] can be read from a variable argument list.
///
Expand Down
4 changes: 2 additions & 2 deletions library/std/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,12 @@ wasip1 = { version = "1.0.0", features = [
], default-features = false }

[target.'cfg(all(target_os = "wasi", target_env = "p2"))'.dependencies]
wasip2 = { version = '1.0.2', features = [
wasip2 = { version = '1.0.3', features = [
'rustc-dep-of-std',
], default-features = false }

[target.'cfg(all(target_os = "wasi", target_env = "p3"))'.dependencies]
wasip2 = { version = '1.0.2', features = [
wasip3 = { version = '0.6.0', features = [
'rustc-dep-of-std',
], default-features = false }

Expand Down
4 changes: 2 additions & 2 deletions library/std/src/sys/args/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ cfg_select! {
pub use wasip1::*;
}
all(target_os = "wasi", any(target_env = "p2", target_env = "p3")) => {
mod wasip2;
pub use wasip2::*;
mod wasi;
pub use wasi::*;
}
target_os = "xous" => {
mod xous;
Expand Down
11 changes: 11 additions & 0 deletions library/std/src/sys/args/wasi.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#[cfg(target_env = "p2")]
use wasip2 as wasi;
#[cfg(target_env = "p3")]
use wasip3 as wasi;

pub use super::common::Args;

/// Returns the command line arguments
pub fn args() -> Args {
Args::new(wasi::cli::environment::get_arguments().into_iter().map(|arg| arg.into()).collect())
}
6 changes: 0 additions & 6 deletions library/std/src/sys/args/wasip2.rs

This file was deleted.

4 changes: 2 additions & 2 deletions library/std/src/sys/random/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ cfg_select! {
pub use wasip1::fill_bytes;
}
all(target_os = "wasi", any(target_env = "p2", target_env = "p3")) => {
mod wasip2;
pub use wasip2::{fill_bytes, hashmap_random_keys};
mod wasi;
pub use wasi::{fill_bytes, hashmap_random_keys};
}
target_os = "zkvm" => {
mod zkvm;
Expand Down
12 changes: 12 additions & 0 deletions library/std/src/sys/random/wasi.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#[cfg(target_env = "p2")]
use wasip2::random::{insecure_seed::insecure_seed as get_insecure_seed, random::get_random_bytes};
#[cfg(target_env = "p3")]
use wasip3::random::{insecure_seed::get_insecure_seed, random::get_random_bytes};

pub fn fill_bytes(bytes: &mut [u8]) {
bytes.copy_from_slice(&get_random_bytes(u64::try_from(bytes.len()).unwrap()));
}

pub fn hashmap_random_keys() -> (u64, u64) {
get_insecure_seed()
}
9 changes: 0 additions & 9 deletions library/std/src/sys/random/wasip2.rs

This file was deleted.

9 changes: 5 additions & 4 deletions src/doc/rustc-dev-guide/src/tests/compiletest.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,11 +156,12 @@ series of steps.
Compiletest starts with an empty directory with the `-C incremental` flag, and
then runs the compiler for each revision, reusing the incremental results from previous steps.

The revisions should start with:
Each revision name must start with one of:

* `bfail` — the test should fail to compile
* `bpass` — the test should compile successully
* `rpass` — the test should compile and run successfully
* `cpass` - the test must compile successfully (check build, no codegen)
* `bfail` — the test must fail to compile (full build, with codegen)
* `bpass` — the test must compile successully (full build, with codegen)
* `rpass` — the test must compile and run successfully

To make the revisions unique, you should add a suffix like `rpass1` and `rpass2`.

Expand Down
12 changes: 6 additions & 6 deletions src/doc/rustc-dev-guide/src/tests/directives.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,11 @@ See [Controlling pass/fail expectations](ui.md#controlling-passfail-expectations

| Directive | Explanation | Supported test suites | Possible values |
|-----------------------------|---------------------------------------------|-------------------------------------------|-----------------|
| `check-pass` | Building (no codegen) should pass | `ui`, `crashes`, `incremental` | N/A |
| `check-pass` | Building (no codegen) should pass | `ui`, `crashes` | N/A |
| `check-fail` | Building (no codegen) should fail | `ui`, `crashes` | N/A |
| `build-pass` | Building should pass | `ui`, `crashes`, `codegen`, `incremental` | N/A |
| `build-pass` | Building should pass | `ui`, `crashes`, `codegen` | N/A |
| `build-fail` | Building should fail | `ui`, `crashes` | N/A |
| `run-pass` | Program must exit with code `0` | `ui`, `crashes`, `incremental` | N/A |
| `run-pass` | Program must exit with code `0` | `ui`, `crashes` | N/A |
| `run-fail` | Program must exit with code `1..=127` | `ui`, `crashes` | N/A |
| `run-crash` | Program must crash | `ui` | N/A |
| `run-fail-or-crash` | Program must `run-fail` or `run-crash` | `ui` | N/A |
Expand All @@ -90,9 +90,9 @@ comparison](ui.md#output-comparison) and [Rustfix tests](ui.md#rustfix-tests) fo

| Directive | Explanation | Supported test suites | Possible values |
|-----------------------------------|--------------------------------------------------------------------------------------------------------------------------|----------------------------------------------|-----------------------------------------------------------------------------------------|
| `check-run-results` | Check run test binary `run-{pass,fail}` output snapshot | `ui`, `crashes`, `incremental` if `run-pass` | N/A |
| `error-pattern` | Check that output contains a specific string | `ui`, `crashes`, `incremental` if `run-pass` | String |
| `regex-error-pattern` | Check that output contains a regex pattern | `ui`, `crashes`, `incremental` if `run-pass` | Regex |
| `check-run-results` | Check run test binary `run-{pass,fail}` output snapshot | `ui`, `crashes`, `incremental` | N/A |
| `error-pattern` | Check that output contains a specific string | `ui`, `crashes`, `incremental` | String |
| `regex-error-pattern` | Check that output contains a regex pattern | `ui`, `crashes`, `incremental` | Regex |
| `check-stdout` | Check `stdout` against `error-pattern`s from running test binary[^check_stdout] | `ui`, `crashes`, `incremental` | N/A |
| `normalize-stderr-32bit` | Normalize actual stderr (for 32-bit platforms) with a rule `"<raw>" -> "<normalized>"` before comparing against snapshot | `ui`, `incremental` | `"<RAW>" -> "<NORMALIZED>"`, `<RAW>`/`<NORMALIZED>` is regex capture and replace syntax |
| `normalize-stderr-64bit` | Normalize actual stderr (for 64-bit platforms) with a rule `"<raw>" -> "<normalized>"` before comparing against snapshot | `ui`, `incremental` | `"<RAW>" -> "<NORMALIZED>"`, `<RAW>`/`<NORMALIZED>` is regex capture and replace syntax |
Expand Down
Loading
Loading