Auto merge of #126838 - matthiaskrgr:rollup-qkop22o, r=matthiaskrgr

Rollup of 3 pull requests

Successful merges:

 - #126140 (Rename `std::fs::try_exists` to  `std::fs::exists` and stabilize fs_try_exists)
 - #126318 (Add a `x perf` command for integrating bootstrap with `rustc-perf`)
 - #126552 (Remove use of const traits (and `feature(effects)`) from stdlib)

r? `@ghost`
`@rustbot` modify labels: rollup
This commit is contained in:
bors 2024-06-22 18:48:10 +00:00
commit a0f01c3c10
181 changed files with 2257 additions and 338 deletions

View File

@ -449,7 +449,7 @@ declare_features! (
/// Allows `dyn* Trait` objects. /// Allows `dyn* Trait` objects.
(incomplete, dyn_star, "1.65.0", Some(102425)), (incomplete, dyn_star, "1.65.0", Some(102425)),
/// Uses generic effect parameters for ~const bounds /// Uses generic effect parameters for ~const bounds
(unstable, effects, "1.72.0", Some(102090)), (incomplete, effects, "1.72.0", Some(102090)),
/// Allows exhaustive pattern matching on types that contain uninhabited types. /// Allows exhaustive pattern matching on types that contain uninhabited types.
(unstable, exhaustive_patterns, "1.13.0", Some(51085)), (unstable, exhaustive_patterns, "1.13.0", Some(51085)),
/// Allows explicit tail calls via `become` expression. /// Allows explicit tail calls via `become` expression.

View File

@ -429,17 +429,17 @@ pub fn check_intrinsic_type(
sym::ptr_guaranteed_cmp => ( sym::ptr_guaranteed_cmp => (
1, 1,
1, 0,
vec![Ty::new_imm_ptr(tcx, param(0)), Ty::new_imm_ptr(tcx, param(0))], vec![Ty::new_imm_ptr(tcx, param(0)), Ty::new_imm_ptr(tcx, param(0))],
tcx.types.u8, tcx.types.u8,
), ),
sym::const_allocate => { sym::const_allocate => {
(0, 1, vec![tcx.types.usize, tcx.types.usize], Ty::new_mut_ptr(tcx, tcx.types.u8)) (0, 0, vec![tcx.types.usize, tcx.types.usize], Ty::new_mut_ptr(tcx, tcx.types.u8))
} }
sym::const_deallocate => ( sym::const_deallocate => (
0, 0,
1, 0,
vec![Ty::new_mut_ptr(tcx, tcx.types.u8), tcx.types.usize, tcx.types.usize], vec![Ty::new_mut_ptr(tcx, tcx.types.u8), tcx.types.usize, tcx.types.usize],
tcx.types.unit, tcx.types.unit,
), ),
@ -478,16 +478,16 @@ pub fn check_intrinsic_type(
| sym::frem_algebraic => (1, 0, vec![param(0), param(0)], param(0)), | sym::frem_algebraic => (1, 0, vec![param(0), param(0)], param(0)),
sym::float_to_int_unchecked => (2, 0, vec![param(0)], param(1)), sym::float_to_int_unchecked => (2, 0, vec![param(0)], param(1)),
sym::assume => (0, 1, vec![tcx.types.bool], tcx.types.unit), sym::assume => (0, 0, vec![tcx.types.bool], tcx.types.unit),
sym::likely => (0, 1, vec![tcx.types.bool], tcx.types.bool), sym::likely => (0, 0, vec![tcx.types.bool], tcx.types.bool),
sym::unlikely => (0, 1, vec![tcx.types.bool], tcx.types.bool), sym::unlikely => (0, 0, vec![tcx.types.bool], tcx.types.bool),
sym::read_via_copy => (1, 0, vec![Ty::new_imm_ptr(tcx, param(0))], param(0)), sym::read_via_copy => (1, 0, vec![Ty::new_imm_ptr(tcx, param(0))], param(0)),
sym::write_via_move => { sym::write_via_move => {
(1, 0, vec![Ty::new_mut_ptr(tcx, param(0)), param(0)], tcx.types.unit) (1, 0, vec![Ty::new_mut_ptr(tcx, param(0)), param(0)], tcx.types.unit)
} }
sym::typed_swap => (1, 1, vec![Ty::new_mut_ptr(tcx, param(0)); 2], tcx.types.unit), sym::typed_swap => (1, 0, vec![Ty::new_mut_ptr(tcx, param(0)); 2], tcx.types.unit),
sym::discriminant_value => { sym::discriminant_value => {
let assoc_items = tcx.associated_item_def_ids( let assoc_items = tcx.associated_item_def_ids(
@ -566,9 +566,9 @@ pub fn check_intrinsic_type(
sym::black_box => (1, 0, vec![param(0)], param(0)), sym::black_box => (1, 0, vec![param(0)], param(0)),
sym::is_val_statically_known => (1, 1, vec![param(0)], tcx.types.bool), sym::is_val_statically_known => (1, 0, vec![param(0)], tcx.types.bool),
sym::const_eval_select => (4, 1, vec![param(0), param(1), param(2)], param(3)), sym::const_eval_select => (4, 0, vec![param(0), param(1), param(2)], param(3)),
sym::vtable_size | sym::vtable_align => { sym::vtable_size | sym::vtable_align => {
(0, 0, vec![Ty::new_imm_ptr(tcx, tcx.types.unit)], tcx.types.usize) (0, 0, vec![Ty::new_imm_ptr(tcx, tcx.types.unit)], tcx.types.usize)
@ -576,10 +576,10 @@ pub fn check_intrinsic_type(
// This type check is not particularly useful, but the `where` bounds // This type check is not particularly useful, but the `where` bounds
// on the definition in `core` do the heavy lifting for checking it. // on the definition in `core` do the heavy lifting for checking it.
sym::aggregate_raw_ptr => (3, 1, vec![param(1), param(2)], param(0)), sym::aggregate_raw_ptr => (3, 0, vec![param(1), param(2)], param(0)),
sym::ptr_metadata => (2, 1, vec![Ty::new_imm_ptr(tcx, param(0))], param(1)), sym::ptr_metadata => (2, 0, vec![Ty::new_imm_ptr(tcx, param(0))], param(1)),
sym::ub_checks => (0, 1, Vec::new(), tcx.types.bool), sym::ub_checks => (0, 0, Vec::new(), tcx.types.bool),
sym::simd_eq sym::simd_eq
| sym::simd_ne | sym::simd_ne

View File

@ -176,7 +176,6 @@
#![feature(const_mut_refs)] #![feature(const_mut_refs)]
#![feature(const_precise_live_drops)] #![feature(const_precise_live_drops)]
#![feature(const_ptr_write)] #![feature(const_ptr_write)]
#![feature(const_trait_impl)]
#![feature(const_try)] #![feature(const_try)]
#![feature(decl_macro)] #![feature(decl_macro)]
#![feature(dropck_eyepatch)] #![feature(dropck_eyepatch)]

View File

@ -245,7 +245,6 @@ use self::Ordering::*;
append_const_msg append_const_msg
)] )]
#[rustc_diagnostic_item = "PartialEq"] #[rustc_diagnostic_item = "PartialEq"]
#[const_trait]
pub trait PartialEq<Rhs: ?Sized = Self> { pub trait PartialEq<Rhs: ?Sized = Self> {
/// This method tests for `self` and `other` values to be equal, and is used /// This method tests for `self` and `other` values to be equal, and is used
/// by `==`. /// by `==`.
@ -1475,8 +1474,7 @@ mod impls {
macro_rules! partial_eq_impl { macro_rules! partial_eq_impl {
($($t:ty)*) => ($( ($($t:ty)*) => ($(
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[rustc_const_unstable(feature = "const_cmp", issue = "92391")] impl PartialEq for $t {
impl const PartialEq for $t {
#[inline] #[inline]
fn eq(&self, other: &$t) -> bool { (*self) == (*other) } fn eq(&self, other: &$t) -> bool { (*self) == (*other) }
#[inline] #[inline]

View File

@ -60,7 +60,7 @@ const fn escape_ascii<const N: usize>(byte: u8) -> ([ascii::Char; N], Range<u8>)
const fn escape_unicode<const N: usize>(c: char) -> ([ascii::Char; N], Range<u8>) { const fn escape_unicode<const N: usize>(c: char) -> ([ascii::Char; N], Range<u8>) {
const { assert!(N >= 10 && N < u8::MAX as usize) }; const { assert!(N >= 10 && N < u8::MAX as usize) };
let c = u32::from(c); let c = c as u32;
// OR-ing `1` ensures that for `c == 0` the code computes that // OR-ing `1` ensures that for `c == 0` the code computes that
// one digit should be printed. // one digit should be printed.

View File

@ -515,7 +515,10 @@ impl CStr {
#[inline] #[inline]
#[must_use] #[must_use]
const fn as_non_null_ptr(&self) -> NonNull<c_char> { const fn as_non_null_ptr(&self) -> NonNull<c_char> {
NonNull::from(&self.inner).as_non_null_ptr() // FIXME(effects) replace with `NonNull::from`
// SAFETY: a reference is never null
unsafe { NonNull::new_unchecked(&self.inner as *const [c_char] as *mut [c_char]) }
.as_non_null_ptr()
} }
/// Returns the length of `self`. Like C's `strlen`, this does not include the nul terminator. /// Returns the length of `self`. Like C's `strlen`, this does not include the nul terminator.

View File

@ -200,6 +200,7 @@
// Language features: // Language features:
// tidy-alphabetical-start // tidy-alphabetical-start
#![cfg_attr(bootstrap, feature(c_unwind))] #![cfg_attr(bootstrap, feature(c_unwind))]
#![cfg_attr(bootstrap, feature(effects))]
#![feature(abi_unadjusted)] #![feature(abi_unadjusted)]
#![feature(adt_const_params)] #![feature(adt_const_params)]
#![feature(allow_internal_unsafe)] #![feature(allow_internal_unsafe)]
@ -214,13 +215,11 @@
#![feature(const_mut_refs)] #![feature(const_mut_refs)]
#![feature(const_precise_live_drops)] #![feature(const_precise_live_drops)]
#![feature(const_refs_to_cell)] #![feature(const_refs_to_cell)]
#![feature(const_trait_impl)]
#![feature(decl_macro)] #![feature(decl_macro)]
#![feature(deprecated_suggestion)] #![feature(deprecated_suggestion)]
#![feature(doc_cfg)] #![feature(doc_cfg)]
#![feature(doc_cfg_hide)] #![feature(doc_cfg_hide)]
#![feature(doc_notable_trait)] #![feature(doc_notable_trait)]
#![feature(effects)]
#![feature(extern_types)] #![feature(extern_types)]
#![feature(f128)] #![feature(f128)]
#![feature(f16)] #![feature(f16)]

View File

@ -944,7 +944,6 @@ marker_impls! {
#[lang = "destruct"] #[lang = "destruct"]
#[rustc_on_unimplemented(message = "can't drop `{Self}`", append_const_msg)] #[rustc_on_unimplemented(message = "can't drop `{Self}`", append_const_msg)]
#[rustc_deny_explicit_impl(implement_via_object = false)] #[rustc_deny_explicit_impl(implement_via_object = false)]
#[const_trait]
pub trait Destruct {} pub trait Destruct {}
/// A marker for tuple types. /// A marker for tuple types.

View File

@ -33,7 +33,6 @@ use super::{IntErrorKind, ParseIntError};
reason = "implementation detail which may disappear or be replaced at any time", reason = "implementation detail which may disappear or be replaced at any time",
issue = "none" issue = "none"
)] )]
#[const_trait]
pub unsafe trait ZeroablePrimitive: Sized + Copy + private::Sealed { pub unsafe trait ZeroablePrimitive: Sized + Copy + private::Sealed {
#[doc(hidden)] #[doc(hidden)]
type NonZeroInner: Sized + Copy; type NonZeroInner: Sized + Copy;
@ -47,7 +46,6 @@ macro_rules! impl_zeroable_primitive {
reason = "implementation detail which may disappear or be replaced at any time", reason = "implementation detail which may disappear or be replaced at any time",
issue = "none" issue = "none"
)] )]
#[const_trait]
pub trait Sealed {} pub trait Sealed {}
$( $(
@ -70,14 +68,14 @@ macro_rules! impl_zeroable_primitive {
reason = "implementation detail which may disappear or be replaced at any time", reason = "implementation detail which may disappear or be replaced at any time",
issue = "none" issue = "none"
)] )]
impl const private::Sealed for $primitive {} impl private::Sealed for $primitive {}
#[unstable( #[unstable(
feature = "nonzero_internals", feature = "nonzero_internals",
reason = "implementation detail which may disappear or be replaced at any time", reason = "implementation detail which may disappear or be replaced at any time",
issue = "none" issue = "none"
)] )]
unsafe impl const ZeroablePrimitive for $primitive { unsafe impl ZeroablePrimitive for $primitive {
type NonZeroInner = private::$NonZeroInner; type NonZeroInner = private::$NonZeroInner;
} }
)+ )+

View File

@ -73,7 +73,6 @@
append_const_msg append_const_msg
)] )]
#[doc(alias = "+")] #[doc(alias = "+")]
#[const_trait]
pub trait Add<Rhs = Self> { pub trait Add<Rhs = Self> {
/// The resulting type after applying the `+` operator. /// The resulting type after applying the `+` operator.
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
@ -95,8 +94,7 @@ pub trait Add<Rhs = Self> {
macro_rules! add_impl { macro_rules! add_impl {
($($t:ty)*) => ($( ($($t:ty)*) => ($(
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[rustc_const_unstable(feature = "const_ops", issue = "90080")] impl Add for $t {
impl const Add for $t {
type Output = $t; type Output = $t;
#[inline] #[inline]

View File

@ -282,7 +282,7 @@ impl<'a> Context<'a> {
pub const fn ext(&mut self) -> &mut dyn Any { pub const fn ext(&mut self) -> &mut dyn Any {
// FIXME: this field makes Context extra-weird about unwind safety // FIXME: this field makes Context extra-weird about unwind safety
// can we justify AssertUnwindSafe if we stabilize this? do we care? // can we justify AssertUnwindSafe if we stabilize this? do we care?
match &mut *self.ext { match &mut self.ext.0 {
ExtData::Some(data) => *data, ExtData::Some(data) => *data,
ExtData::None(unit) => unit, ExtData::None(unit) => unit,
} }
@ -356,7 +356,7 @@ impl<'a> ContextBuilder<'a> {
#[rustc_const_unstable(feature = "const_waker", issue = "102012")] #[rustc_const_unstable(feature = "const_waker", issue = "102012")]
#[unstable(feature = "context_ext", issue = "123392")] #[unstable(feature = "context_ext", issue = "123392")]
pub const fn from(cx: &'a mut Context<'_>) -> Self { pub const fn from(cx: &'a mut Context<'_>) -> Self {
let ext = match &mut *cx.ext { let ext = match &mut cx.ext.0 {
ExtData::Some(ext) => ExtData::Some(*ext), ExtData::Some(ext) => ExtData::Some(*ext),
ExtData::None(()) => ExtData::None(()), ExtData::None(()) => ExtData::None(()),
}; };

View File

@ -2742,18 +2742,15 @@ impl AsInnerMut<fs_imp::DirBuilder> for DirBuilder {
/// # Examples /// # Examples
/// ///
/// ```no_run /// ```no_run
/// #![feature(fs_try_exists)]
/// use std::fs; /// use std::fs;
/// ///
/// assert!(!fs::try_exists("does_not_exist.txt").expect("Can't check existence of file does_not_exist.txt")); /// assert!(!fs::exists("does_not_exist.txt").expect("Can't check existence of file does_not_exist.txt"));
/// assert!(fs::try_exists("/root/secret_file.txt").is_err()); /// assert!(fs::exists("/root/secret_file.txt").is_err());
/// ``` /// ```
/// ///
/// [`Path::exists`]: crate::path::Path::exists /// [`Path::exists`]: crate::path::Path::exists
// FIXME: stabilization should modify documentation of `exists()` to recommend this method #[stable(feature = "fs_try_exists", since = "CURRENT_RUSTC_VERSION")]
// instead.
#[unstable(feature = "fs_try_exists", issue = "83186")]
#[inline] #[inline]
pub fn try_exists<P: AsRef<Path>>(path: P) -> io::Result<bool> { pub fn exists<P: AsRef<Path>>(path: P) -> io::Result<bool> {
fs_imp::try_exists(path.as_ref()) fs_imp::exists(path.as_ref())
} }

View File

@ -284,7 +284,6 @@
#![feature(cfi_encoding)] #![feature(cfi_encoding)]
#![feature(concat_idents)] #![feature(concat_idents)]
#![feature(const_mut_refs)] #![feature(const_mut_refs)]
#![feature(const_trait_impl)]
#![feature(decl_macro)] #![feature(decl_macro)]
#![feature(deprecated_suggestion)] #![feature(deprecated_suggestion)]
#![feature(doc_cfg)] #![feature(doc_cfg)]

View File

@ -2907,6 +2907,8 @@ impl Path {
/// prevent time-of-check to time-of-use (TOCTOU) bugs. You should only use it in scenarios /// prevent time-of-check to time-of-use (TOCTOU) bugs. You should only use it in scenarios
/// where those bugs are not an issue. /// where those bugs are not an issue.
/// ///
/// This is an alias for [`std::fs::exists`](crate::fs::exists).
///
/// # Examples /// # Examples
/// ///
/// ```no_run /// ```no_run
@ -2919,7 +2921,7 @@ impl Path {
#[stable(feature = "path_try_exists", since = "1.63.0")] #[stable(feature = "path_try_exists", since = "1.63.0")]
#[inline] #[inline]
pub fn try_exists(&self) -> io::Result<bool> { pub fn try_exists(&self) -> io::Result<bool> {
fs::try_exists(self) fs::exists(self)
} }
/// Returns `true` if the path exists on disk and is pointing at a regular file. /// Returns `true` if the path exists on disk and is pointing at a regular file.

View File

@ -18,7 +18,7 @@ use crate::sys::time::SystemTime;
use crate::sys::unsupported; use crate::sys::unsupported;
use crate::sys_common::{AsInner, AsInnerMut, FromInner, IntoInner}; use crate::sys_common::{AsInner, AsInnerMut, FromInner, IntoInner};
pub use crate::sys_common::fs::{copy, try_exists}; pub use crate::sys_common::fs::{copy, exists};
#[derive(Debug)] #[derive(Debug)]
pub struct File(FileDesc); pub struct File(FileDesc);

View File

@ -12,7 +12,7 @@ use crate::{
sys::unsupported, sys::unsupported,
}; };
pub use crate::sys_common::fs::try_exists; pub use crate::sys_common::fs::exists;
/// A file descriptor. /// A file descriptor.
#[derive(Clone, Copy)] #[derive(Clone, Copy)]

View File

@ -97,7 +97,7 @@ use libc::{
))] ))]
use libc::{dirent64, fstat64, ftruncate64, lseek64, lstat64, off64_t, open64, stat64}; use libc::{dirent64, fstat64, ftruncate64, lseek64, lstat64, off64_t, open64, stat64};
pub use crate::sys_common::fs::try_exists; pub use crate::sys_common::fs::exists;
pub struct File(FileDesc); pub struct File(FileDesc);

View File

@ -478,7 +478,7 @@ mod cgroups {
use crate::borrow::Cow; use crate::borrow::Cow;
use crate::ffi::OsString; use crate::ffi::OsString;
use crate::fs::{try_exists, File}; use crate::fs::{exists, File};
use crate::io::Read; use crate::io::Read;
use crate::io::{BufRead, BufReader}; use crate::io::{BufRead, BufReader};
use crate::os::unix::ffi::OsStringExt; use crate::os::unix::ffi::OsStringExt;
@ -556,7 +556,7 @@ mod cgroups {
path.push("cgroup.controllers"); path.push("cgroup.controllers");
// skip if we're not looking at cgroup2 // skip if we're not looking at cgroup2
if matches!(try_exists(&path), Err(_) | Ok(false)) { if matches!(exists(&path), Err(_) | Ok(false)) {
return usize::MAX; return usize::MAX;
}; };
@ -613,7 +613,7 @@ mod cgroups {
path.push(&group_path); path.push(&group_path);
// skip if we guessed the mount incorrectly // skip if we guessed the mount incorrectly
if matches!(try_exists(&path), Err(_) | Ok(false)) { if matches!(exists(&path), Err(_) | Ok(false)) {
continue; continue;
} }

View File

@ -291,7 +291,7 @@ pub fn remove_dir_all(_path: &Path) -> io::Result<()> {
unsupported() unsupported()
} }
pub fn try_exists(_path: &Path) -> io::Result<bool> { pub fn exists(_path: &Path) -> io::Result<bool> {
unsupported() unsupported()
} }

View File

@ -17,7 +17,7 @@ use crate::sys::time::SystemTime;
use crate::sys::unsupported; use crate::sys::unsupported;
use crate::sys_common::{AsInner, FromInner, IntoInner}; use crate::sys_common::{AsInner, FromInner, IntoInner};
pub use crate::sys_common::fs::try_exists; pub use crate::sys_common::fs::exists;
pub struct File { pub struct File {
fd: WasiFd, fd: WasiFd,

View File

@ -1531,7 +1531,7 @@ pub fn junction_point(original: &Path, link: &Path) -> io::Result<()> {
} }
// Try to see if a file exists but, unlike `exists`, report I/O errors. // Try to see if a file exists but, unlike `exists`, report I/O errors.
pub fn try_exists(path: &Path) -> io::Result<bool> { pub fn exists(path: &Path) -> io::Result<bool> {
// Open the file to ensure any symlinks are followed to their target. // Open the file to ensure any symlinks are followed to their target.
let mut opts = OpenOptions::new(); let mut opts = OpenOptions::new();
// No read, write, etc access rights are needed. // No read, write, etc access rights are needed.

View File

@ -42,7 +42,7 @@ fn remove_dir_all_recursive(path: &Path) -> io::Result<()> {
fs::remove_dir(path) fs::remove_dir(path)
} }
pub fn try_exists(path: &Path) -> io::Result<bool> { pub fn exists(path: &Path) -> io::Result<bool> {
match fs::metadata(path) { match fs::metadata(path) {
Ok(_) => Ok(true), Ok(_) => Ok(true),
Err(error) if error.kind() == io::ErrorKind::NotFound => Ok(false), Err(error) if error.kind() == io::ErrorKind::NotFound => Ok(false),

View File

@ -7,6 +7,7 @@ pub(crate) mod doc;
pub(crate) mod format; pub(crate) mod format;
pub(crate) mod install; pub(crate) mod install;
pub(crate) mod llvm; pub(crate) mod llvm;
pub(crate) mod perf;
pub(crate) mod run; pub(crate) mod run;
pub(crate) mod setup; pub(crate) mod setup;
pub(crate) mod suggest; pub(crate) mod suggest;

View File

@ -0,0 +1,45 @@
use std::process::Command;
use crate::core::build_steps::compile::{Std, Sysroot};
use crate::core::build_steps::tool::RustcPerf;
use crate::core::builder::Builder;
use crate::core::config::DebuginfoLevel;
/// Performs profiling using `rustc-perf` on a built version of the compiler.
pub fn perf(builder: &Builder<'_>) {
let collector = builder.ensure(RustcPerf {
compiler: builder.compiler(0, builder.config.build),
target: builder.config.build,
});
if builder.build.config.rust_debuginfo_level_rustc == DebuginfoLevel::None {
builder.info(r#"WARNING: You are compiling rustc without debuginfo, this will make profiling less useful.
Consider setting `rust.debuginfo-level = 1` in `config.toml`."#);
}
let compiler = builder.compiler(builder.top_stage, builder.config.build);
builder.ensure(Std::new(compiler, builder.config.build));
let sysroot = builder.ensure(Sysroot::new(compiler));
let rustc = sysroot.join("bin/rustc");
let results_dir = builder.build.tempdir().join("rustc-perf");
let mut cmd = Command::new(collector);
let cmd = cmd
.arg("profile_local")
.arg("eprintln")
.arg("--out-dir")
.arg(&results_dir)
.arg("--include")
.arg("helloworld")
.arg(&rustc);
builder.info(&format!("Running `rustc-perf` using `{}`", rustc.display()));
// We need to set the working directory to `src/tools/perf`, so that it can find the directory
// with compile-time benchmarks.
let cmd = cmd.current_dir(builder.src.join("src/tools/rustc-perf"));
builder.build.run(cmd);
builder.info(&format!("You can find the results at `{}`", results_dir.display()));
}

View File

@ -32,6 +32,8 @@ struct ToolBuild {
extra_features: Vec<String>, extra_features: Vec<String>,
/// Nightly-only features that are allowed (comma-separated list). /// Nightly-only features that are allowed (comma-separated list).
allow_features: &'static str, allow_features: &'static str,
/// Additional arguments to pass to the `cargo` invocation.
cargo_args: Vec<String>,
} }
impl Builder<'_> { impl Builder<'_> {
@ -100,6 +102,7 @@ impl Step for ToolBuild {
if !self.allow_features.is_empty() { if !self.allow_features.is_empty() {
cargo.allow_features(self.allow_features); cargo.allow_features(self.allow_features);
} }
cargo.args(self.cargo_args);
let _guard = builder.msg_tool( let _guard = builder.msg_tool(
Kind::Build, Kind::Build,
self.mode, self.mode,
@ -126,10 +129,7 @@ impl Step for ToolBuild {
if tool == "tidy" { if tool == "tidy" {
tool = "rust-tidy"; tool = "rust-tidy";
} }
let cargo_out = builder.cargo_out(compiler, self.mode, target).join(exe(tool, target)); copy_link_tool_bin(builder, self.compiler, self.target, self.mode, tool)
let bin = builder.tools_dir(compiler).join(exe(tool, target));
builder.copy_link(&cargo_out, &bin);
bin
} }
} }
} }
@ -214,6 +214,21 @@ pub fn prepare_tool_cargo(
cargo cargo
} }
/// Links a built tool binary with the given `name` from the build directory to the
/// tools directory.
fn copy_link_tool_bin(
builder: &Builder<'_>,
compiler: Compiler,
target: TargetSelection,
mode: Mode,
name: &str,
) -> PathBuf {
let cargo_out = builder.cargo_out(compiler, mode, target).join(exe(name, target));
let bin = builder.tools_dir(compiler).join(exe(name, target));
builder.copy_link(&cargo_out, &bin);
bin
}
macro_rules! bootstrap_tool { macro_rules! bootstrap_tool {
($( ($(
$name:ident, $path:expr, $tool_name:expr $name:ident, $path:expr, $tool_name:expr
@ -283,6 +298,7 @@ macro_rules! bootstrap_tool {
}, },
extra_features: vec![], extra_features: vec![],
allow_features: concat!($($allow_features)*), allow_features: concat!($($allow_features)*),
cargo_args: vec![]
}) })
} }
} }
@ -349,10 +365,60 @@ impl Step for OptimizedDist {
source_type: SourceType::InTree, source_type: SourceType::InTree,
extra_features: Vec::new(), extra_features: Vec::new(),
allow_features: "", allow_features: "",
cargo_args: Vec::new(),
}) })
} }
} }
/// The [rustc-perf](https://github.com/rust-lang/rustc-perf) benchmark suite, which is added
/// as a submodule at `src/tools/rustc-perf`.
#[derive(Debug, Clone, Hash, PartialEq, Eq)]
pub struct RustcPerf {
pub compiler: Compiler,
pub target: TargetSelection,
}
impl Step for RustcPerf {
/// Path to the built `collector` binary.
type Output = PathBuf;
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
run.path("src/tools/rustc-perf")
}
fn make_run(run: RunConfig<'_>) {
run.builder.ensure(RustcPerf {
compiler: run.builder.compiler(0, run.builder.config.build),
target: run.target,
});
}
fn run(self, builder: &Builder<'_>) -> PathBuf {
// We need to ensure the rustc-perf submodule is initialized.
builder.update_submodule(Path::new("src/tools/rustc-perf"));
let tool = ToolBuild {
compiler: self.compiler,
target: self.target,
tool: "collector",
mode: Mode::ToolBootstrap,
path: "src/tools/rustc-perf",
source_type: SourceType::Submodule,
extra_features: Vec::new(),
allow_features: "",
// Only build the collector package, which is used for benchmarking through
// a CLI.
cargo_args: vec!["-p".to_string(), "collector".to_string()],
};
let collector_bin = builder.ensure(tool.clone());
// We also need to symlink the `rustc-fake` binary to the corresponding directory,
// because `collector` expects it in the same directory.
copy_link_tool_bin(builder, tool.compiler, tool.target, tool.mode, "rustc-fake");
collector_bin
}
}
#[derive(Debug, Clone, Hash, PartialEq, Eq, Ord, PartialOrd)] #[derive(Debug, Clone, Hash, PartialEq, Eq, Ord, PartialOrd)]
pub struct ErrorIndex { pub struct ErrorIndex {
pub compiler: Compiler, pub compiler: Compiler,
@ -403,6 +469,7 @@ impl Step for ErrorIndex {
source_type: SourceType::InTree, source_type: SourceType::InTree,
extra_features: Vec::new(), extra_features: Vec::new(),
allow_features: "", allow_features: "",
cargo_args: Vec::new(),
}) })
} }
} }
@ -437,6 +504,7 @@ impl Step for RemoteTestServer {
source_type: SourceType::InTree, source_type: SourceType::InTree,
extra_features: Vec::new(), extra_features: Vec::new(),
allow_features: "", allow_features: "",
cargo_args: Vec::new(),
}) })
} }
} }
@ -595,6 +663,7 @@ impl Step for Cargo {
source_type: SourceType::Submodule, source_type: SourceType::Submodule,
extra_features: Vec::new(), extra_features: Vec::new(),
allow_features: "", allow_features: "",
cargo_args: Vec::new(),
}) })
} }
} }
@ -622,6 +691,7 @@ impl Step for LldWrapper {
source_type: SourceType::InTree, source_type: SourceType::InTree,
extra_features: Vec::new(), extra_features: Vec::new(),
allow_features: "", allow_features: "",
cargo_args: Vec::new(),
}) })
} }
} }
@ -670,6 +740,7 @@ impl Step for RustAnalyzer {
extra_features: vec!["in-rust-tree".to_owned()], extra_features: vec!["in-rust-tree".to_owned()],
source_type: SourceType::InTree, source_type: SourceType::InTree,
allow_features: RustAnalyzer::ALLOW_FEATURES, allow_features: RustAnalyzer::ALLOW_FEATURES,
cargo_args: Vec::new(),
}) })
} }
} }
@ -717,6 +788,7 @@ impl Step for RustAnalyzerProcMacroSrv {
extra_features: vec!["in-rust-tree".to_owned()], extra_features: vec!["in-rust-tree".to_owned()],
source_type: SourceType::InTree, source_type: SourceType::InTree,
allow_features: RustAnalyzer::ALLOW_FEATURES, allow_features: RustAnalyzer::ALLOW_FEATURES,
cargo_args: Vec::new(),
}); });
// Copy `rust-analyzer-proc-macro-srv` to `<sysroot>/libexec/` // Copy `rust-analyzer-proc-macro-srv` to `<sysroot>/libexec/`
@ -923,6 +995,7 @@ macro_rules! tool_extended {
extra_features: $sel.extra_features, extra_features: $sel.extra_features,
source_type: SourceType::InTree, source_type: SourceType::InTree,
allow_features: concat!($($allow_features)*), allow_features: concat!($($allow_features)*),
cargo_args: vec![]
}); });
if (false $(|| !$add_bins_to_sysroot.is_empty())?) && $sel.compiler.stage > 0 { if (false $(|| !$add_bins_to_sysroot.is_empty())?) && $sel.compiler.stage > 0 {

View File

@ -666,6 +666,7 @@ pub enum Kind {
Setup, Setup,
Suggest, Suggest,
Vendor, Vendor,
Perf,
} }
impl Kind { impl Kind {
@ -687,6 +688,7 @@ impl Kind {
Kind::Setup => "setup", Kind::Setup => "setup",
Kind::Suggest => "suggest", Kind::Suggest => "suggest",
Kind::Vendor => "vendor", Kind::Vendor => "vendor",
Kind::Perf => "perf",
} }
} }
@ -698,6 +700,7 @@ impl Kind {
Kind::Run => "Running", Kind::Run => "Running",
Kind::Suggest => "Suggesting", Kind::Suggest => "Suggesting",
Kind::Clippy => "Linting", Kind::Clippy => "Linting",
Kind::Perf => "Profiling & benchmarking",
_ => { _ => {
let title_letter = self.as_str()[0..1].to_ascii_uppercase(); let title_letter = self.as_str()[0..1].to_ascii_uppercase();
return format!("{title_letter}{}ing", &self.as_str()[1..]); return format!("{title_letter}{}ing", &self.as_str()[1..]);
@ -749,7 +752,8 @@ impl<'a> Builder<'a> {
tool::RustdocGUITest, tool::RustdocGUITest,
tool::OptimizedDist, tool::OptimizedDist,
tool::CoverageDump, tool::CoverageDump,
tool::LlvmBitcodeLinker tool::LlvmBitcodeLinker,
tool::RustcPerf,
), ),
Kind::Clippy => describe!( Kind::Clippy => describe!(
clippy::Std, clippy::Std,
@ -945,7 +949,7 @@ impl<'a> Builder<'a> {
Kind::Clean => describe!(clean::CleanAll, clean::Rustc, clean::Std), Kind::Clean => describe!(clean::CleanAll, clean::Rustc, clean::Std),
Kind::Vendor => describe!(vendor::Vendor), Kind::Vendor => describe!(vendor::Vendor),
// special-cased in Build::build() // special-cased in Build::build()
Kind::Format | Kind::Suggest => vec![], Kind::Format | Kind::Suggest | Kind::Perf => vec![],
} }
} }
@ -1017,6 +1021,7 @@ impl<'a> Builder<'a> {
path.as_ref().map_or([].as_slice(), |path| std::slice::from_ref(path)), path.as_ref().map_or([].as_slice(), |path| std::slice::from_ref(path)),
), ),
Subcommand::Vendor { .. } => (Kind::Vendor, &paths[..]), Subcommand::Vendor { .. } => (Kind::Vendor, &paths[..]),
Subcommand::Perf { .. } => (Kind::Perf, &paths[..]),
}; };
Self::new_internal(build, kind, paths.to_owned()) Self::new_internal(build, kind, paths.to_owned())

View File

@ -2043,6 +2043,7 @@ impl Config {
Subcommand::Bench { .. } => flags.stage.or(bench_stage).unwrap_or(2), Subcommand::Bench { .. } => flags.stage.or(bench_stage).unwrap_or(2),
Subcommand::Dist { .. } => flags.stage.or(dist_stage).unwrap_or(2), Subcommand::Dist { .. } => flags.stage.or(dist_stage).unwrap_or(2),
Subcommand::Install { .. } => flags.stage.or(install_stage).unwrap_or(2), Subcommand::Install { .. } => flags.stage.or(install_stage).unwrap_or(2),
Subcommand::Perf { .. } => flags.stage.unwrap_or(1),
// These are all bootstrap tools, which don't depend on the compiler. // These are all bootstrap tools, which don't depend on the compiler.
// The stage we pass shouldn't matter, but use 0 just in case. // The stage we pass shouldn't matter, but use 0 just in case.
Subcommand::Clean { .. } Subcommand::Clean { .. }
@ -2080,7 +2081,8 @@ impl Config {
| Subcommand::Setup { .. } | Subcommand::Setup { .. }
| Subcommand::Format { .. } | Subcommand::Format { .. }
| Subcommand::Suggest { .. } | Subcommand::Suggest { .. }
| Subcommand::Vendor { .. } => {} | Subcommand::Vendor { .. }
| Subcommand::Perf { .. } => {}
} }
} }

View File

@ -469,6 +469,9 @@ Arguments:
#[arg(long)] #[arg(long)]
versioned_dirs: bool, versioned_dirs: bool,
}, },
/// Perform profiling and benchmarking of the compiler using the
/// `rustc-perf` benchmark suite.
Perf {},
} }
impl Subcommand { impl Subcommand {
@ -490,6 +493,7 @@ impl Subcommand {
Subcommand::Setup { .. } => Kind::Setup, Subcommand::Setup { .. } => Kind::Setup,
Subcommand::Suggest { .. } => Kind::Suggest, Subcommand::Suggest { .. } => Kind::Suggest,
Subcommand::Vendor { .. } => Kind::Vendor, Subcommand::Vendor { .. } => Kind::Vendor,
Subcommand::Perf { .. } => Kind::Perf,
} }
} }

View File

@ -659,6 +659,9 @@ impl Build {
Subcommand::Suggest { run } => { Subcommand::Suggest { run } => {
return core::build_steps::suggest::suggest(&builder::Builder::new(self), *run); return core::build_steps::suggest::suggest(&builder::Builder::new(self), *run);
} }
Subcommand::Perf { .. } => {
return core::build_steps::perf::perf(&builder::Builder::new(self));
}
_ => (), _ => (),
} }

View File

@ -18,7 +18,7 @@ All intrinsic fallback bodies are automatically made cross-crate inlineable (lik
by the codegen backend, but not the MIR inliner. by the codegen backend, but not the MIR inliner.
```rust ```rust
#![feature(rustc_attrs, effects)] #![feature(rustc_attrs)]
#![allow(internal_features)] #![allow(internal_features)]
#[rustc_intrinsic] #[rustc_intrinsic]
@ -28,7 +28,7 @@ const unsafe fn const_deallocate(_ptr: *mut u8, _size: usize, _align: usize) {}
Since these are just regular functions, it is perfectly ok to create the intrinsic twice: Since these are just regular functions, it is perfectly ok to create the intrinsic twice:
```rust ```rust
#![feature(rustc_attrs, effects)] #![feature(rustc_attrs)]
#![allow(internal_features)] #![allow(internal_features)]
#[rustc_intrinsic] #[rustc_intrinsic]

View File

@ -48,6 +48,7 @@ complete -c x.py -n "__fish_use_subcommand" -f -a "run" -d 'Run tools contained
complete -c x.py -n "__fish_use_subcommand" -f -a "setup" -d 'Set up the environment for development' complete -c x.py -n "__fish_use_subcommand" -f -a "setup" -d 'Set up the environment for development'
complete -c x.py -n "__fish_use_subcommand" -f -a "suggest" -d 'Suggest a subset of tests to run, based on modified files' complete -c x.py -n "__fish_use_subcommand" -f -a "suggest" -d 'Suggest a subset of tests to run, based on modified files'
complete -c x.py -n "__fish_use_subcommand" -f -a "vendor" -d 'Vendor dependencies' complete -c x.py -n "__fish_use_subcommand" -f -a "vendor" -d 'Vendor dependencies'
complete -c x.py -n "__fish_use_subcommand" -f -a "perf" -d 'Perform profiling and benchmarking of the compiler using the `rustc-perf` benchmark suite'
complete -c x.py -n "__fish_seen_subcommand_from build" -l config -d 'TOML configuration file for build' -r -F complete -c x.py -n "__fish_seen_subcommand_from build" -l config -d 'TOML configuration file for build' -r -F
complete -c x.py -n "__fish_seen_subcommand_from build" -l build-dir -d 'Build directory, overrides `build.build-dir` in `config.toml`' -r -f -a "(__fish_complete_directories)" complete -c x.py -n "__fish_seen_subcommand_from build" -l build-dir -d 'Build directory, overrides `build.build-dir` in `config.toml`' -r -f -a "(__fish_complete_directories)"
complete -c x.py -n "__fish_seen_subcommand_from build" -l build -d 'build target of the stage0 compiler' -r -f complete -c x.py -n "__fish_seen_subcommand_from build" -l build -d 'build target of the stage0 compiler' -r -f
@ -628,3 +629,37 @@ complete -c x.py -n "__fish_seen_subcommand_from vendor" -l llvm-profile-generat
complete -c x.py -n "__fish_seen_subcommand_from vendor" -l enable-bolt-settings -d 'Enable BOLT link flags' complete -c x.py -n "__fish_seen_subcommand_from vendor" -l enable-bolt-settings -d 'Enable BOLT link flags'
complete -c x.py -n "__fish_seen_subcommand_from vendor" -l skip-stage0-validation -d 'Skip stage0 compiler validation' complete -c x.py -n "__fish_seen_subcommand_from vendor" -l skip-stage0-validation -d 'Skip stage0 compiler validation'
complete -c x.py -n "__fish_seen_subcommand_from vendor" -s h -l help -d 'Print help (see more with \'--help\')' complete -c x.py -n "__fish_seen_subcommand_from vendor" -s h -l help -d 'Print help (see more with \'--help\')'
complete -c x.py -n "__fish_seen_subcommand_from perf" -l config -d 'TOML configuration file for build' -r -F
complete -c x.py -n "__fish_seen_subcommand_from perf" -l build-dir -d 'Build directory, overrides `build.build-dir` in `config.toml`' -r -f -a "(__fish_complete_directories)"
complete -c x.py -n "__fish_seen_subcommand_from perf" -l build -d 'build target of the stage0 compiler' -r -f
complete -c x.py -n "__fish_seen_subcommand_from perf" -l host -d 'host targets to build' -r -f
complete -c x.py -n "__fish_seen_subcommand_from perf" -l target -d 'target targets to build' -r -f
complete -c x.py -n "__fish_seen_subcommand_from perf" -l exclude -d 'build paths to exclude' -r -F
complete -c x.py -n "__fish_seen_subcommand_from perf" -l skip -d 'build paths to skip' -r -F
complete -c x.py -n "__fish_seen_subcommand_from perf" -l rustc-error-format -r -f
complete -c x.py -n "__fish_seen_subcommand_from perf" -l on-fail -d 'command to run on failure' -r -f -a "(__fish_complete_command)"
complete -c x.py -n "__fish_seen_subcommand_from perf" -l stage -d 'stage to build (indicates compiler to use/test, e.g., stage 0 uses the bootstrap compiler, stage 1 the stage 0 rustc artifacts, etc.)' -r -f
complete -c x.py -n "__fish_seen_subcommand_from perf" -l keep-stage -d 'stage(s) to keep without recompiling (pass multiple times to keep e.g., both stages 0 and 1)' -r -f
complete -c x.py -n "__fish_seen_subcommand_from perf" -l keep-stage-std -d 'stage(s) of the standard library to keep without recompiling (pass multiple times to keep e.g., both stages 0 and 1)' -r -f
complete -c x.py -n "__fish_seen_subcommand_from perf" -l src -d 'path to the root of the rust checkout' -r -f -a "(__fish_complete_directories)"
complete -c x.py -n "__fish_seen_subcommand_from perf" -s j -l jobs -d 'number of jobs to run in parallel' -r -f
complete -c x.py -n "__fish_seen_subcommand_from perf" -l warnings -d 'if value is deny, will deny warnings if value is warn, will emit warnings otherwise, use the default configured behaviour' -r -f -a "{deny '',warn '',default ''}"
complete -c x.py -n "__fish_seen_subcommand_from perf" -l error-format -d 'rustc error format' -r -f
complete -c x.py -n "__fish_seen_subcommand_from perf" -l color -d 'whether to use color in cargo and rustc output' -r -f -a "{always '',never '',auto ''}"
complete -c x.py -n "__fish_seen_subcommand_from perf" -l llvm-skip-rebuild -d 'whether rebuilding llvm should be skipped, overriding `skip-rebuld` in config.toml' -r -f -a "{true '',false ''}"
complete -c x.py -n "__fish_seen_subcommand_from perf" -l rust-profile-generate -d 'generate PGO profile with rustc build' -r -F
complete -c x.py -n "__fish_seen_subcommand_from perf" -l rust-profile-use -d 'use PGO profile for rustc build' -r -F
complete -c x.py -n "__fish_seen_subcommand_from perf" -l llvm-profile-use -d 'use PGO profile for LLVM build' -r -F
complete -c x.py -n "__fish_seen_subcommand_from perf" -l reproducible-artifact -d 'Additional reproducible artifacts that should be added to the reproducible artifacts archive' -r
complete -c x.py -n "__fish_seen_subcommand_from perf" -l set -d 'override options in config.toml' -r -f
complete -c x.py -n "__fish_seen_subcommand_from perf" -s v -l verbose -d 'use verbose output (-vv for very verbose)'
complete -c x.py -n "__fish_seen_subcommand_from perf" -s i -l incremental -d 'use incremental compilation'
complete -c x.py -n "__fish_seen_subcommand_from perf" -l include-default-paths -d 'include default paths in addition to the provided ones'
complete -c x.py -n "__fish_seen_subcommand_from perf" -l dry-run -d 'dry run; don\'t build anything'
complete -c x.py -n "__fish_seen_subcommand_from perf" -l dump-bootstrap-shims -d 'Indicates whether to dump the work done from bootstrap shims'
complete -c x.py -n "__fish_seen_subcommand_from perf" -l json-output -d 'use message-format=json'
complete -c x.py -n "__fish_seen_subcommand_from perf" -l bypass-bootstrap-lock -d 'Bootstrap uses this value to decide whether it should bypass locking the build process. This is rarely needed (e.g., compiling the std library for different targets in parallel)'
complete -c x.py -n "__fish_seen_subcommand_from perf" -l llvm-profile-generate -d 'generate PGO profile with llvm built for rustc'
complete -c x.py -n "__fish_seen_subcommand_from perf" -l enable-bolt-settings -d 'Enable BOLT link flags'
complete -c x.py -n "__fish_seen_subcommand_from perf" -l skip-stage0-validation -d 'Skip stage0 compiler validation'
complete -c x.py -n "__fish_seen_subcommand_from perf" -s h -l help -d 'Print help (see more with \'--help\')'

View File

@ -75,6 +75,7 @@ Register-ArgumentCompleter -Native -CommandName 'x.py' -ScriptBlock {
[CompletionResult]::new('setup', 'setup', [CompletionResultType]::ParameterValue, 'Set up the environment for development') [CompletionResult]::new('setup', 'setup', [CompletionResultType]::ParameterValue, 'Set up the environment for development')
[CompletionResult]::new('suggest', 'suggest', [CompletionResultType]::ParameterValue, 'Suggest a subset of tests to run, based on modified files') [CompletionResult]::new('suggest', 'suggest', [CompletionResultType]::ParameterValue, 'Suggest a subset of tests to run, based on modified files')
[CompletionResult]::new('vendor', 'vendor', [CompletionResultType]::ParameterValue, 'Vendor dependencies') [CompletionResult]::new('vendor', 'vendor', [CompletionResultType]::ParameterValue, 'Vendor dependencies')
[CompletionResult]::new('perf', 'perf', [CompletionResultType]::ParameterValue, 'Perform profiling and benchmarking of the compiler using the `rustc-perf` benchmark suite')
break break
} }
'x.py;build' { 'x.py;build' {
@ -769,6 +770,47 @@ Register-ArgumentCompleter -Native -CommandName 'x.py' -ScriptBlock {
[CompletionResult]::new('--help', 'help', [CompletionResultType]::ParameterName, 'Print help (see more with ''--help'')') [CompletionResult]::new('--help', 'help', [CompletionResultType]::ParameterName, 'Print help (see more with ''--help'')')
break break
} }
'x.py;perf' {
[CompletionResult]::new('--config', 'config', [CompletionResultType]::ParameterName, 'TOML configuration file for build')
[CompletionResult]::new('--build-dir', 'build-dir', [CompletionResultType]::ParameterName, 'Build directory, overrides `build.build-dir` in `config.toml`')
[CompletionResult]::new('--build', 'build', [CompletionResultType]::ParameterName, 'build target of the stage0 compiler')
[CompletionResult]::new('--host', 'host', [CompletionResultType]::ParameterName, 'host targets to build')
[CompletionResult]::new('--target', 'target', [CompletionResultType]::ParameterName, 'target targets to build')
[CompletionResult]::new('--exclude', 'exclude', [CompletionResultType]::ParameterName, 'build paths to exclude')
[CompletionResult]::new('--skip', 'skip', [CompletionResultType]::ParameterName, 'build paths to skip')
[CompletionResult]::new('--rustc-error-format', 'rustc-error-format', [CompletionResultType]::ParameterName, 'rustc-error-format')
[CompletionResult]::new('--on-fail', 'on-fail', [CompletionResultType]::ParameterName, 'command to run on failure')
[CompletionResult]::new('--stage', 'stage', [CompletionResultType]::ParameterName, 'stage to build (indicates compiler to use/test, e.g., stage 0 uses the bootstrap compiler, stage 1 the stage 0 rustc artifacts, etc.)')
[CompletionResult]::new('--keep-stage', 'keep-stage', [CompletionResultType]::ParameterName, 'stage(s) to keep without recompiling (pass multiple times to keep e.g., both stages 0 and 1)')
[CompletionResult]::new('--keep-stage-std', 'keep-stage-std', [CompletionResultType]::ParameterName, 'stage(s) of the standard library to keep without recompiling (pass multiple times to keep e.g., both stages 0 and 1)')
[CompletionResult]::new('--src', 'src', [CompletionResultType]::ParameterName, 'path to the root of the rust checkout')
[CompletionResult]::new('-j', 'j', [CompletionResultType]::ParameterName, 'number of jobs to run in parallel')
[CompletionResult]::new('--jobs', 'jobs', [CompletionResultType]::ParameterName, 'number of jobs to run in parallel')
[CompletionResult]::new('--warnings', 'warnings', [CompletionResultType]::ParameterName, 'if value is deny, will deny warnings if value is warn, will emit warnings otherwise, use the default configured behaviour')
[CompletionResult]::new('--error-format', 'error-format', [CompletionResultType]::ParameterName, 'rustc error format')
[CompletionResult]::new('--color', 'color', [CompletionResultType]::ParameterName, 'whether to use color in cargo and rustc output')
[CompletionResult]::new('--llvm-skip-rebuild', 'llvm-skip-rebuild', [CompletionResultType]::ParameterName, 'whether rebuilding llvm should be skipped, overriding `skip-rebuld` in config.toml')
[CompletionResult]::new('--rust-profile-generate', 'rust-profile-generate', [CompletionResultType]::ParameterName, 'generate PGO profile with rustc build')
[CompletionResult]::new('--rust-profile-use', 'rust-profile-use', [CompletionResultType]::ParameterName, 'use PGO profile for rustc build')
[CompletionResult]::new('--llvm-profile-use', 'llvm-profile-use', [CompletionResultType]::ParameterName, 'use PGO profile for LLVM build')
[CompletionResult]::new('--reproducible-artifact', 'reproducible-artifact', [CompletionResultType]::ParameterName, 'Additional reproducible artifacts that should be added to the reproducible artifacts archive')
[CompletionResult]::new('--set', 'set', [CompletionResultType]::ParameterName, 'override options in config.toml')
[CompletionResult]::new('-v', 'v', [CompletionResultType]::ParameterName, 'use verbose output (-vv for very verbose)')
[CompletionResult]::new('--verbose', 'verbose', [CompletionResultType]::ParameterName, 'use verbose output (-vv for very verbose)')
[CompletionResult]::new('-i', 'i', [CompletionResultType]::ParameterName, 'use incremental compilation')
[CompletionResult]::new('--incremental', 'incremental', [CompletionResultType]::ParameterName, 'use incremental compilation')
[CompletionResult]::new('--include-default-paths', 'include-default-paths', [CompletionResultType]::ParameterName, 'include default paths in addition to the provided ones')
[CompletionResult]::new('--dry-run', 'dry-run', [CompletionResultType]::ParameterName, 'dry run; don''t build anything')
[CompletionResult]::new('--dump-bootstrap-shims', 'dump-bootstrap-shims', [CompletionResultType]::ParameterName, 'Indicates whether to dump the work done from bootstrap shims')
[CompletionResult]::new('--json-output', 'json-output', [CompletionResultType]::ParameterName, 'use message-format=json')
[CompletionResult]::new('--bypass-bootstrap-lock', 'bypass-bootstrap-lock', [CompletionResultType]::ParameterName, 'Bootstrap uses this value to decide whether it should bypass locking the build process. This is rarely needed (e.g., compiling the std library for different targets in parallel)')
[CompletionResult]::new('--llvm-profile-generate', 'llvm-profile-generate', [CompletionResultType]::ParameterName, 'generate PGO profile with llvm built for rustc')
[CompletionResult]::new('--enable-bolt-settings', 'enable-bolt-settings', [CompletionResultType]::ParameterName, 'Enable BOLT link flags')
[CompletionResult]::new('--skip-stage0-validation', 'skip-stage0-validation', [CompletionResultType]::ParameterName, 'Skip stage0 compiler validation')
[CompletionResult]::new('-h', 'h', [CompletionResultType]::ParameterName, 'Print help (see more with ''--help'')')
[CompletionResult]::new('--help', 'help', [CompletionResultType]::ParameterName, 'Print help (see more with ''--help'')')
break
}
}) })
$completions.Where{ $_.CompletionText -like "$wordToComplete*" } | $completions.Where{ $_.CompletionText -like "$wordToComplete*" } |

View File

@ -45,6 +45,9 @@ _x.py() {
bootstrap,miri) bootstrap,miri)
cmd="bootstrap__miri" cmd="bootstrap__miri"
;; ;;
bootstrap,perf)
cmd="bootstrap__perf"
;;
bootstrap,run) bootstrap,run)
cmd="bootstrap__run" cmd="bootstrap__run"
;; ;;
@ -67,7 +70,7 @@ _x.py() {
case "${cmd}" in case "${cmd}" in
x.py) x.py)
opts="-v -i -j -h --verbose --incremental --config --build-dir --build --host --target --exclude --skip --include-default-paths --rustc-error-format --on-fail --dry-run --dump-bootstrap-shims --stage --keep-stage --keep-stage-std --src --jobs --warnings --error-format --json-output --color --bypass-bootstrap-lock --llvm-skip-rebuild --rust-profile-generate --rust-profile-use --llvm-profile-use --llvm-profile-generate --enable-bolt-settings --skip-stage0-validation --reproducible-artifact --set --help [PATHS]... [ARGS]... build check clippy fix fmt doc test miri bench clean dist install run setup suggest vendor" opts="-v -i -j -h --verbose --incremental --config --build-dir --build --host --target --exclude --skip --include-default-paths --rustc-error-format --on-fail --dry-run --dump-bootstrap-shims --stage --keep-stage --keep-stage-std --src --jobs --warnings --error-format --json-output --color --bypass-bootstrap-lock --llvm-skip-rebuild --rust-profile-generate --rust-profile-use --llvm-profile-use --llvm-profile-generate --enable-bolt-settings --skip-stage0-validation --reproducible-artifact --set --help [PATHS]... [ARGS]... build check clippy fix fmt doc test miri bench clean dist install run setup suggest vendor perf"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0 return 0
@ -1414,6 +1417,116 @@ _x.py() {
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0 return 0
;; ;;
x.py__perf)
opts="-v -i -j -h --verbose --incremental --config --build-dir --build --host --target --exclude --skip --include-default-paths --rustc-error-format --on-fail --dry-run --dump-bootstrap-shims --stage --keep-stage --keep-stage-std --src --jobs --warnings --error-format --json-output --color --bypass-bootstrap-lock --llvm-skip-rebuild --rust-profile-generate --rust-profile-use --llvm-profile-use --llvm-profile-generate --enable-bolt-settings --skip-stage0-validation --reproducible-artifact --set --help [PATHS]... [ARGS]..."
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
--config)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
--build-dir)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
--build)
COMPREPLY=("${cur}")
return 0
;;
--host)
COMPREPLY=("${cur}")
return 0
;;
--target)
COMPREPLY=("${cur}")
return 0
;;
--exclude)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
--skip)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
--rustc-error-format)
COMPREPLY=("${cur}")
return 0
;;
--on-fail)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
--stage)
COMPREPLY=("${cur}")
return 0
;;
--keep-stage)
COMPREPLY=("${cur}")
return 0
;;
--keep-stage-std)
COMPREPLY=("${cur}")
return 0
;;
--src)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
--jobs)
COMPREPLY=("${cur}")
return 0
;;
-j)
COMPREPLY=("${cur}")
return 0
;;
--warnings)
COMPREPLY=($(compgen -W "deny warn default" -- "${cur}"))
return 0
;;
--error-format)
COMPREPLY=("${cur}")
return 0
;;
--color)
COMPREPLY=($(compgen -W "always never auto" -- "${cur}"))
return 0
;;
--llvm-skip-rebuild)
COMPREPLY=($(compgen -W "true false" -- "${cur}"))
return 0
;;
--rust-profile-generate)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
--rust-profile-use)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
--llvm-profile-use)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
--reproducible-artifact)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
--set)
COMPREPLY=("${cur}")
return 0
;;
*)
COMPREPLY=()
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
x.py__run) x.py__run)
opts="-v -i -j -h --args --verbose --incremental --config --build-dir --build --host --target --exclude --skip --include-default-paths --rustc-error-format --on-fail --dry-run --dump-bootstrap-shims --stage --keep-stage --keep-stage-std --src --jobs --warnings --error-format --json-output --color --bypass-bootstrap-lock --llvm-skip-rebuild --rust-profile-generate --rust-profile-use --llvm-profile-use --llvm-profile-generate --enable-bolt-settings --skip-stage0-validation --reproducible-artifact --set --help [PATHS]... [ARGS]..." opts="-v -i -j -h --args --verbose --incremental --config --build-dir --build --host --target --exclude --skip --include-default-paths --rustc-error-format --on-fail --dry-run --dump-bootstrap-shims --stage --keep-stage --keep-stage-std --src --jobs --warnings --error-format --json-output --color --bypass-bootstrap-lock --llvm-skip-rebuild --rust-profile-generate --rust-profile-use --llvm-profile-use --llvm-profile-generate --enable-bolt-settings --skip-stage0-validation --reproducible-artifact --set --help [PATHS]... [ARGS]..."
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then

View File

@ -788,6 +788,49 @@ _arguments "${_arguments_options[@]}" \
'--help[Print help (see more with '\''--help'\'')]' \ '--help[Print help (see more with '\''--help'\'')]' \
'*::paths -- paths for the subcommand:_files' \ '*::paths -- paths for the subcommand:_files' \
&& ret=0 && ret=0
;;
(perf)
_arguments "${_arguments_options[@]}" \
'--config=[TOML configuration file for build]:FILE:_files' \
'--build-dir=[Build directory, overrides \`build.build-dir\` in \`config.toml\`]:DIR:_files -/' \
'--build=[build target of the stage0 compiler]:BUILD:( )' \
'--host=[host targets to build]:HOST:( )' \
'--target=[target targets to build]:TARGET:( )' \
'*--exclude=[build paths to exclude]:PATH:_files' \
'*--skip=[build paths to skip]:PATH:_files' \
'--rustc-error-format=[]:RUSTC_ERROR_FORMAT:( )' \
'--on-fail=[command to run on failure]:CMD:_cmdstring' \
'--stage=[stage to build (indicates compiler to use/test, e.g., stage 0 uses the bootstrap compiler, stage 1 the stage 0 rustc artifacts, etc.)]:N:( )' \
'*--keep-stage=[stage(s) to keep without recompiling (pass multiple times to keep e.g., both stages 0 and 1)]:N:( )' \
'*--keep-stage-std=[stage(s) of the standard library to keep without recompiling (pass multiple times to keep e.g., both stages 0 and 1)]:N:( )' \
'--src=[path to the root of the rust checkout]:DIR:_files -/' \
'-j+[number of jobs to run in parallel]:JOBS:( )' \
'--jobs=[number of jobs to run in parallel]:JOBS:( )' \
'--warnings=[if value is deny, will deny warnings if value is warn, will emit warnings otherwise, use the default configured behaviour]:deny|warn:(deny warn default)' \
'--error-format=[rustc error format]:FORMAT:( )' \
'--color=[whether to use color in cargo and rustc output]:STYLE:(always never auto)' \
'--llvm-skip-rebuild=[whether rebuilding llvm should be skipped, overriding \`skip-rebuld\` in config.toml]:VALUE:(true false)' \
'--rust-profile-generate=[generate PGO profile with rustc build]:PROFILE:_files' \
'--rust-profile-use=[use PGO profile for rustc build]:PROFILE:_files' \
'--llvm-profile-use=[use PGO profile for LLVM build]:PROFILE:_files' \
'*--reproducible-artifact=[Additional reproducible artifacts that should be added to the reproducible artifacts archive]:REPRODUCIBLE_ARTIFACT: ' \
'*--set=[override options in config.toml]:section.option=value:( )' \
'*-v[use verbose output (-vv for very verbose)]' \
'*--verbose[use verbose output (-vv for very verbose)]' \
'-i[use incremental compilation]' \
'--incremental[use incremental compilation]' \
'--include-default-paths[include default paths in addition to the provided ones]' \
'--dry-run[dry run; don'\''t build anything]' \
'--dump-bootstrap-shims[Indicates whether to dump the work done from bootstrap shims]' \
'--json-output[use message-format=json]' \
'--bypass-bootstrap-lock[Bootstrap uses this value to decide whether it should bypass locking the build process. This is rarely needed (e.g., compiling the std library for different targets in parallel)]' \
'--llvm-profile-generate[generate PGO profile with llvm built for rustc]' \
'--enable-bolt-settings[Enable BOLT link flags]' \
'--skip-stage0-validation[Skip stage0 compiler validation]' \
'-h[Print help (see more with '\''--help'\'')]' \
'--help[Print help (see more with '\''--help'\'')]' \
'*::paths -- paths for the subcommand:_files' \
&& ret=0
;; ;;
esac esac
;; ;;
@ -813,6 +856,7 @@ _x.py_commands() {
'setup:Set up the environment for development' \ 'setup:Set up the environment for development' \
'suggest:Suggest a subset of tests to run, based on modified files' \ 'suggest:Suggest a subset of tests to run, based on modified files' \
'vendor:Vendor dependencies' \ 'vendor:Vendor dependencies' \
'perf:Perform profiling and benchmarking of the compiler using the \`rustc-perf\` benchmark suite' \
) )
_describe -t commands 'x.py commands' commands "$@" _describe -t commands 'x.py commands' commands "$@"
} }
@ -871,6 +915,11 @@ _x.py__miri_commands() {
local commands; commands=() local commands; commands=()
_describe -t commands 'x.py miri commands' commands "$@" _describe -t commands 'x.py miri commands' commands "$@"
} }
(( $+functions[_x.py__perf_commands] )) ||
_x.py__perf_commands() {
local commands; commands=()
_describe -t commands 'x.py perf commands' commands "$@"
}
(( $+functions[_x.py__run_commands] )) || (( $+functions[_x.py__run_commands] )) ||
_x.py__run_commands() { _x.py__run_commands() {
local commands; commands=() local commands; commands=()

View File

@ -1,4 +1,4 @@
#![feature(rustc_attrs, effects)] #![feature(rustc_attrs)]
#[rustc_intrinsic] #[rustc_intrinsic]
#[rustc_nounwind] #[rustc_nounwind]

View File

@ -1,10 +0,0 @@
//@ known-bug: #120503
#![feature(effects)]
trait MyTrait {}
impl MyTrait for i32 {
async const fn bar(&self) {
main8().await;
}
}

View File

@ -1,20 +0,0 @@
//@ known-bug: #121536
#![feature(effects)]
#[derive(Debug, Clone, Copy)]
pub struct Vec3 {
pub x: f32,
pub y: f32,
pub z: f32,
}
impl std::ops::Add<Vec3> for Vec3 {
type Output = Vec3;
const fn add(self, b: Vec3) -> Self::Output {
Vec3 {
x: self.x + b.x,
y: self.y + b.y,
z: self.z + b.z,
}
}
}

View File

@ -2,6 +2,7 @@
#![crate_name = "foo"] #![crate_name = "foo"]
#![feature(effects, const_trait_impl)] #![feature(effects, const_trait_impl)]
#![allow(incomplete_features)]
#[const_trait] #[const_trait]
pub trait Tr { pub trait Tr {

View File

@ -1,5 +1,6 @@
#![crate_name = "foo"] #![crate_name = "foo"]
#![feature(effects)] #![feature(effects)]
#![allow(incomplete_features)]
// @has foo/fn.bar.html // @has foo/fn.bar.html
// @has - '//pre[@class="rust item-decl"]' 'pub const fn bar() -> ' // @has - '//pre[@class="rust item-decl"]' 'pub const fn bar() -> '

View File

@ -7,6 +7,7 @@
// not remove this test. // not remove this test.
// //
// FIXME(effects) add `const_trait` to `Fn` so we use `~const` // FIXME(effects) add `const_trait` to `Fn` so we use `~const`
// FIXME(effects) restore `const_trait` to `Destruct`
#![feature(const_trait_impl)] #![feature(const_trait_impl)]
#![crate_name = "foo"] #![crate_name = "foo"]
@ -24,9 +25,9 @@ pub trait Tr<T> {
// @has - '//section[@id="method.a"]/h4[@class="code-header"]/a[@class="trait"]' 'Fn' // @has - '//section[@id="method.a"]/h4[@class="code-header"]/a[@class="trait"]' 'Fn'
// @!has - '//section[@id="method.a"]/h4[@class="code-header"]/span[@class="where"]' '~const' // @!has - '//section[@id="method.a"]/h4[@class="code-header"]/span[@class="where"]' '~const'
// @has - '//section[@id="method.a"]/h4[@class="code-header"]/div[@class="where"]' ': Fn' // @has - '//section[@id="method.a"]/h4[@class="code-header"]/div[@class="where"]' ': Fn'
fn a<A: /* ~const */ Fn() + ~const Destruct>() fn a<A: /* ~const */ Fn() /* + ~const Destruct */>()
where where
Option<A>: /* ~const */ Fn() + ~const Destruct, Option<A>: /* ~const */ Fn() /* + ~const Destruct */,
{ {
} }
} }
@ -36,13 +37,13 @@ pub trait Tr<T> {
// @has - '//section[@id="impl-Tr%3CT%3E-for-T"]/h3[@class="code-header"]/a[@class="trait"]' 'Fn' // @has - '//section[@id="impl-Tr%3CT%3E-for-T"]/h3[@class="code-header"]/a[@class="trait"]' 'Fn'
// @!has - '//section[@id="impl-Tr%3CT%3E-for-T"]/h3[@class="code-header"]/span[@class="where"]' '~const' // @!has - '//section[@id="impl-Tr%3CT%3E-for-T"]/h3[@class="code-header"]/span[@class="where"]' '~const'
// @has - '//section[@id="impl-Tr%3CT%3E-for-T"]/h3[@class="code-header"]/div[@class="where"]' ': Fn' // @has - '//section[@id="impl-Tr%3CT%3E-for-T"]/h3[@class="code-header"]/div[@class="where"]' ': Fn'
impl<T: /* ~const */ Fn() + ~const Destruct> const Tr<T> for T impl<T: /* ~const */ Fn() /* + ~const Destruct */> const Tr<T> for T
where where
Option<T>: /* ~const */ Fn() + ~const Destruct, Option<T>: /* ~const */ Fn() /* + ~const Destruct */,
{ {
fn a<A: /* ~const */ Fn() + ~const Destruct>() fn a<A: /* ~const */ Fn() /* + ~const Destruct */>()
where where
Option<A>: /* ~const */ Fn() + ~const Destruct, Option<A>: /* ~const */ Fn() /* + ~const Destruct */,
{ {
} }
} }
@ -51,9 +52,9 @@ where
// @has - '//pre[@class="rust item-decl"]/code/a[@class="trait"]' 'Fn' // @has - '//pre[@class="rust item-decl"]/code/a[@class="trait"]' 'Fn'
// @!has - '//pre[@class="rust item-decl"]/code/div[@class="where"]' '~const' // @!has - '//pre[@class="rust item-decl"]/code/div[@class="where"]' '~const'
// @has - '//pre[@class="rust item-decl"]/code/div[@class="where"]' ': Fn' // @has - '//pre[@class="rust item-decl"]/code/div[@class="where"]' ': Fn'
pub const fn foo<F: /* ~const */ Fn() + ~const Destruct>() pub const fn foo<F: /* ~const */ Fn() /* + ~const Destruct */>()
where where
Option<F>: /* ~const */ Fn() + ~const Destruct, Option<F>: /* ~const */ Fn() /* + ~const Destruct */,
{ {
F::a() F::a()
} }
@ -63,9 +64,9 @@ impl<T> S<T> {
// @has - '//section[@id="method.foo"]/h4[@class="code-header"]/a[@class="trait"]' 'Fn' // @has - '//section[@id="method.foo"]/h4[@class="code-header"]/a[@class="trait"]' 'Fn'
// @!has - '//section[@id="method.foo"]/h4[@class="code-header"]/span[@class="where"]' '~const' // @!has - '//section[@id="method.foo"]/h4[@class="code-header"]/span[@class="where"]' '~const'
// @has - '//section[@id="method.foo"]/h4[@class="code-header"]/div[@class="where"]' ': Fn' // @has - '//section[@id="method.foo"]/h4[@class="code-header"]/div[@class="where"]' ': Fn'
pub const fn foo<B, C: /* ~const */ Fn() + ~const Destruct>() pub const fn foo<B, C: /* ~const */ Fn() /* + ~const Destruct */>()
where where
B: /* ~const */ Fn() + ~const Destruct, B: /* ~const */ Fn() /* + ~const Destruct */,
{ {
B::a() B::a()
} }

View File

@ -1,6 +1,6 @@
//@ build-pass //@ build-pass
#![feature(const_trait_impl, effects)] #![feature(const_trait_impl, effects)] //~ WARN the feature `effects` is incomplete
#[const_trait] #[const_trait]
trait Func<T> { trait Func<T> {

View File

@ -0,0 +1,11 @@
warning: the feature `effects` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/const_trait_fn-issue-88433.rs:3:30
|
LL | #![feature(const_trait_impl, effects)]
| ^^^^^^^
|
= note: see issue #102090 <https://github.com/rust-lang/rust/issues/102090> for more information
= note: `#[warn(incomplete_features)]` on by default
warning: 1 warning emitted

View File

@ -1,5 +1,5 @@
#![crate_type = "lib"] #![crate_type = "lib"]
#![feature(const_closures, const_trait_impl, effects)] #![feature(const_closures, const_trait_impl, effects)] //~ WARN the feature `effects` is incomplete
pub const fn test() { pub const fn test() {
let cl = const || {}; let cl = const || {};

View File

@ -1,3 +1,9 @@
error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-block-const-bound.rs:8:22
|
LL | const fn f<T: ~const Destruct>(x: T) {}
| ^^^^^^^^
error[E0493]: destructor of `T` cannot be evaluated at compile-time error[E0493]: destructor of `T` cannot be evaluated at compile-time
--> $DIR/const-block-const-bound.rs:8:32 --> $DIR/const-block-const-bound.rs:8:32
| |
@ -6,6 +12,6 @@ LL | const fn f<T: ~const Destruct>(x: T) {}
| | | |
| the destructor for this type cannot be evaluated in constant functions | the destructor for this type cannot be evaluated in constant functions
error: aborting due to 1 previous error error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0493`. For more information about this error, try `rustc --explain E0493`.

View File

@ -1,5 +1,6 @@
//@ compile-flags: -Zmir-opt-level=0 //@ compile-flags: -Zmir-opt-level=0
//@ run-pass //@ known-bug: #110395
// FIXME(effects) run-pass
#![feature(const_float_bits_conv)] #![feature(const_float_bits_conv)]
#![feature(const_float_classify)] #![feature(const_float_classify)]

View File

@ -0,0 +1,223 @@
warning: the feature `effects` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/const-float-classify.rs:7:30
|
LL | #![feature(const_trait_impl, effects)]
| ^^^^^^^
|
= note: see issue #102090 <https://github.com/rust-lang/rust/issues/102090> for more information
= note: `#[warn(incomplete_features)]` on by default
error: const `impl` for trait `PartialEq` which is not marked with `#[const_trait]`
--> $DIR/const-float-classify.rs:12:12
|
LL | impl const PartialEq<NonDet> for bool {
| ^^^^^^^^^^^^^^^^^
|
= note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
= note: adding a non-const method body in the future would be a breaking change
error[E0207]: the const parameter `host` is not constrained by the impl trait, self type, or predicates
--> $DIR/const-float-classify.rs:12:6
|
LL | impl const PartialEq<NonDet> for bool {
| ^^^^^ unconstrained const parameter
|
= note: expressions using a const parameter must map each value to a distinct output value
= note: proving the result of expressions other than the parameter are unique is not supported
error[E0284]: type annotations needed
--> $DIR/const-float-classify.rs:21:35
|
LL | const _: () = assert!($a == $b);
| ^^ cannot infer the value of the constant `_`
...
LL | / suite! {
LL | | [is_nan, is_infinite, is_finite, is_normal, is_sign_positive, is_sign_negative]
LL | | -0.0 / 0.0 => [ true, false, false, false, NonDet, NonDet]
LL | | 0.0 / 0.0 => [ true, false, false, false, NonDet, NonDet]
... |
LL | | -1.0 / 0.0 => [ false, true, false, false, false, true]
LL | | }
| |_- in this macro invocation
|
note: required for `bool` to implement `PartialEq<NonDet>`
--> $DIR/const-float-classify.rs:12:12
|
LL | impl const PartialEq<NonDet> for bool {
| ----- ^^^^^^^^^^^^^^^^^ ^^^^
| |
| unsatisfied trait bound introduced here
= note: this error originates in the macro `const_assert` which comes from the expansion of the macro `suite` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0284]: type annotations needed
--> $DIR/const-float-classify.rs:21:35
|
LL | const _: () = assert!($a == $b);
| ^^ cannot infer the value of the constant `_`
...
LL | / suite! {
LL | | [is_nan, is_infinite, is_finite, is_normal, is_sign_positive, is_sign_negative]
LL | | -0.0 / 0.0 => [ true, false, false, false, NonDet, NonDet]
LL | | 0.0 / 0.0 => [ true, false, false, false, NonDet, NonDet]
... |
LL | | -1.0 / 0.0 => [ false, true, false, false, false, true]
LL | | }
| |_- in this macro invocation
|
note: required for `bool` to implement `PartialEq<NonDet>`
--> $DIR/const-float-classify.rs:12:12
|
LL | impl const PartialEq<NonDet> for bool {
| ----- ^^^^^^^^^^^^^^^^^ ^^^^
| |
| unsatisfied trait bound introduced here
= note: this error originates in the macro `const_assert` which comes from the expansion of the macro `suite` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0284]: type annotations needed
--> $DIR/const-float-classify.rs:21:35
|
LL | const _: () = assert!($a == $b);
| ^^ cannot infer the value of the constant `_`
...
LL | / suite! {
LL | | [is_nan, is_infinite, is_finite, is_normal, is_sign_positive, is_sign_negative]
LL | | -0.0 / 0.0 => [ true, false, false, false, NonDet, NonDet]
LL | | 0.0 / 0.0 => [ true, false, false, false, NonDet, NonDet]
... |
LL | | -1.0 / 0.0 => [ false, true, false, false, false, true]
LL | | }
| |_- in this macro invocation
|
note: required for `bool` to implement `PartialEq<NonDet>`
--> $DIR/const-float-classify.rs:12:12
|
LL | impl const PartialEq<NonDet> for bool {
| ----- ^^^^^^^^^^^^^^^^^ ^^^^
| |
| unsatisfied trait bound introduced here
= note: this error originates in the macro `const_assert` which comes from the expansion of the macro `suite` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0284]: type annotations needed
--> $DIR/const-float-classify.rs:21:35
|
LL | const _: () = assert!($a == $b);
| ^^ cannot infer the value of the constant `_`
...
LL | / suite! {
LL | | [is_nan, is_infinite, is_finite, is_normal, is_sign_positive, is_sign_negative]
LL | | -0.0 / 0.0 => [ true, false, false, false, NonDet, NonDet]
LL | | 0.0 / 0.0 => [ true, false, false, false, NonDet, NonDet]
... |
LL | | -1.0 / 0.0 => [ false, true, false, false, false, true]
LL | | }
| |_- in this macro invocation
|
note: required for `bool` to implement `PartialEq<NonDet>`
--> $DIR/const-float-classify.rs:12:12
|
LL | impl const PartialEq<NonDet> for bool {
| ----- ^^^^^^^^^^^^^^^^^ ^^^^
| |
| unsatisfied trait bound introduced here
= note: this error originates in the macro `const_assert` which comes from the expansion of the macro `suite` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0284]: type annotations needed
--> $DIR/const-float-classify.rs:21:35
|
LL | const _: () = assert!($a == $b);
| ^^ cannot infer the value of the constant `_`
...
LL | / suite! {
LL | | [is_nan, is_infinite, is_finite, is_normal, is_sign_positive, is_sign_negative]
LL | | -0.0 / 0.0 => [ true, false, false, false, NonDet, NonDet]
LL | | 0.0 / 0.0 => [ true, false, false, false, NonDet, NonDet]
... |
LL | | -1.0 / 0.0 => [ false, true, false, false, false, true]
LL | | }
| |_- in this macro invocation
|
note: required for `bool` to implement `PartialEq<NonDet>`
--> $DIR/const-float-classify.rs:12:12
|
LL | impl const PartialEq<NonDet> for bool {
| ----- ^^^^^^^^^^^^^^^^^ ^^^^
| |
| unsatisfied trait bound introduced here
= note: this error originates in the macro `const_assert` which comes from the expansion of the macro `suite` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0284]: type annotations needed
--> $DIR/const-float-classify.rs:21:35
|
LL | const _: () = assert!($a == $b);
| ^^ cannot infer the value of the constant `_`
...
LL | / suite! {
LL | | [is_nan, is_infinite, is_finite, is_normal, is_sign_positive, is_sign_negative]
LL | | -0.0 / 0.0 => [ true, false, false, false, NonDet, NonDet]
LL | | 0.0 / 0.0 => [ true, false, false, false, NonDet, NonDet]
... |
LL | | -1.0 / 0.0 => [ false, true, false, false, false, true]
LL | | }
| |_- in this macro invocation
|
note: required for `bool` to implement `PartialEq<NonDet>`
--> $DIR/const-float-classify.rs:12:12
|
LL | impl const PartialEq<NonDet> for bool {
| ----- ^^^^^^^^^^^^^^^^^ ^^^^
| |
| unsatisfied trait bound introduced here
= note: this error originates in the macro `const_assert` which comes from the expansion of the macro `suite` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0284]: type annotations needed
--> $DIR/const-float-classify.rs:21:35
|
LL | const _: () = assert!($a == $b);
| ^^ cannot infer the value of the constant `_`
...
LL | / suite! {
LL | | [is_nan, is_infinite, is_finite, is_normal, is_sign_positive, is_sign_negative]
LL | | -0.0 / 0.0 => [ true, false, false, false, NonDet, NonDet]
LL | | 0.0 / 0.0 => [ true, false, false, false, NonDet, NonDet]
... |
LL | | -1.0 / 0.0 => [ false, true, false, false, false, true]
LL | | }
| |_- in this macro invocation
|
note: required for `bool` to implement `PartialEq<NonDet>`
--> $DIR/const-float-classify.rs:12:12
|
LL | impl const PartialEq<NonDet> for bool {
| ----- ^^^^^^^^^^^^^^^^^ ^^^^
| |
| unsatisfied trait bound introduced here
= note: this error originates in the macro `const_assert` which comes from the expansion of the macro `suite` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0284]: type annotations needed
--> $DIR/const-float-classify.rs:21:35
|
LL | const _: () = assert!($a == $b);
| ^^ cannot infer the value of the constant `_`
...
LL | / suite! {
LL | | [is_nan, is_infinite, is_finite, is_normal, is_sign_positive, is_sign_negative]
LL | | -0.0 / 0.0 => [ true, false, false, false, NonDet, NonDet]
LL | | 0.0 / 0.0 => [ true, false, false, false, NonDet, NonDet]
... |
LL | | -1.0 / 0.0 => [ false, true, false, false, false, true]
LL | | }
| |_- in this macro invocation
|
note: required for `bool` to implement `PartialEq<NonDet>`
--> $DIR/const-float-classify.rs:12:12
|
LL | impl const PartialEq<NonDet> for bool {
| ----- ^^^^^^^^^^^^^^^^^ ^^^^
| |
| unsatisfied trait bound introduced here
= note: this error originates in the macro `const_assert` which comes from the expansion of the macro `suite` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 10 previous errors; 1 warning emitted
Some errors have detailed explanations: E0207, E0284.
For more information about an error, try `rustc --explain E0207`.

View File

@ -1,3 +1,12 @@
warning: the feature `effects` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/const_cmp_type_id.rs:3:30
|
LL | #![feature(const_trait_impl, effects)]
| ^^^^^^^
|
= note: see issue #102090 <https://github.com/rust-lang/rust/issues/102090> for more information
= note: `#[warn(incomplete_features)]` on by default
error[E0131]: `main` function is not allowed to have generic parameters error[E0131]: `main` function is not allowed to have generic parameters
--> $DIR/const_cmp_type_id.rs:7:14 --> $DIR/const_cmp_type_id.rs:7:14
| |
@ -10,25 +19,7 @@ error[E0080]: evaluation of constant value failed
LL | const _A: bool = TypeId::of::<u8>() < TypeId::of::<u16>(); LL | const _A: bool = TypeId::of::<u8>() < TypeId::of::<u16>();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ calling non-const function `<TypeId as PartialOrd>::lt` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ calling non-const function `<TypeId as PartialOrd>::lt`
error[E0308]: mismatched types error: aborting due to 2 previous errors; 1 warning emitted
--> $DIR/const_cmp_type_id.rs:8:13
|
LL | assert!(TypeId::of::<u8>() == TypeId::of::<u8>());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `host`, found `true`
|
= note: expected constant `host`
found constant `true`
error[E0308]: mismatched types Some errors have detailed explanations: E0080, E0131.
--> $DIR/const_cmp_type_id.rs:9:13
|
LL | assert!(TypeId::of::<()>() != TypeId::of::<u8>());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `host`, found `true`
|
= note: expected constant `host`
found constant `true`
error: aborting due to 4 previous errors
Some errors have detailed explanations: E0080, E0131, E0308.
For more information about an error, try `rustc --explain E0080`. For more information about an error, try `rustc --explain E0080`.

View File

@ -4,12 +4,24 @@ error[E0635]: unknown feature `const_fn_trait_ref_impls`
LL | #![feature(const_fn_trait_ref_impls)] LL | #![feature(const_fn_trait_ref_impls)]
| ^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^
error[E0635]: unknown feature `const_cmp`
--> $DIR/fn_trait_refs.rs:8:12
|
LL | #![feature(const_cmp)]
| ^^^^^^^^^
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/fn_trait_refs.rs:15:15 --> $DIR/fn_trait_refs.rs:15:15
| |
LL | T: ~const Fn<()> + ~const Destruct, LL | T: ~const Fn<()> + ~const Destruct,
| ^^^^^^ | ^^^^^^
error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/fn_trait_refs.rs:15:31
|
LL | T: ~const Fn<()> + ~const Destruct,
| ^^^^^^^^
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/fn_trait_refs.rs:15:15 --> $DIR/fn_trait_refs.rs:15:15
| |
@ -24,6 +36,12 @@ error: `~const` can only be applied to `#[const_trait]` traits
LL | T: ~const FnMut<()> + ~const Destruct, LL | T: ~const FnMut<()> + ~const Destruct,
| ^^^^^^^^^ | ^^^^^^^^^
error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/fn_trait_refs.rs:22:34
|
LL | T: ~const FnMut<()> + ~const Destruct,
| ^^^^^^^^
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/fn_trait_refs.rs:22:15 --> $DIR/fn_trait_refs.rs:22:15
| |
@ -52,6 +70,12 @@ error: `~const` can only be applied to `#[const_trait]` traits
LL | T: ~const Fn<()> + ~const Destruct, LL | T: ~const Fn<()> + ~const Destruct,
| ^^^^^^ | ^^^^^^
error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/fn_trait_refs.rs:36:31
|
LL | T: ~const Fn<()> + ~const Destruct,
| ^^^^^^^^
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/fn_trait_refs.rs:36:15 --> $DIR/fn_trait_refs.rs:36:15
| |
@ -66,6 +90,12 @@ error: `~const` can only be applied to `#[const_trait]` traits
LL | T: ~const FnMut<()> + ~const Destruct, LL | T: ~const FnMut<()> + ~const Destruct,
| ^^^^^^^^^ | ^^^^^^^^^
error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/fn_trait_refs.rs:50:34
|
LL | T: ~const FnMut<()> + ~const Destruct,
| ^^^^^^^^
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/fn_trait_refs.rs:50:15 --> $DIR/fn_trait_refs.rs:50:15
| |
@ -182,7 +212,7 @@ LL | const fn test_fn_mut<T>(mut f: T) -> (T::Output, T::Output)
LL | } LL | }
| - value is dropped here | - value is dropped here
error: aborting due to 20 previous errors error: aborting due to 25 previous errors
Some errors have detailed explanations: E0015, E0493, E0635. Some errors have detailed explanations: E0015, E0493, E0635.
For more information about an error, try `rustc --explain E0015`. For more information about an error, try `rustc --explain E0015`.

View File

@ -1,3 +1,12 @@
warning: the feature `effects` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/rustc-impl-const-stability.rs:5:30
|
LL | #![feature(const_trait_impl, effects)]
| ^^^^^^^
|
= note: see issue #102090 <https://github.com/rust-lang/rust/issues/102090> for more information
= note: `#[warn(incomplete_features)]` on by default
error: const `impl` for trait `Default` which is not marked with `#[const_trait]` error: const `impl` for trait `Default` which is not marked with `#[const_trait]`
--> $DIR/rustc-impl-const-stability.rs:15:12 --> $DIR/rustc-impl-const-stability.rs:15:12
| |
@ -16,6 +25,6 @@ LL | impl const Default for Data {
= note: expressions using a const parameter must map each value to a distinct output value = note: expressions using a const parameter must map each value to a distinct output value
= note: proving the result of expressions other than the parameter are unique is not supported = note: proving the result of expressions other than the parameter are unique is not supported
error: aborting due to 2 previous errors error: aborting due to 2 previous errors; 1 warning emitted
For more information about this error, try `rustc --explain E0207`. For more information about this error, try `rustc --explain E0207`.

View File

@ -4,6 +4,12 @@ error: `~const` can only be applied to `#[const_trait]` traits
LL | const fn with_positive<F: ~const for<'a> Fn(&'a Alias<'a>) + ~const Destruct>(fun: F) { LL | const fn with_positive<F: ~const for<'a> Fn(&'a Alias<'a>) + ~const Destruct>(fun: F) {
| ^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^
error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/normalize-tait-in-const.rs:27:69
|
LL | const fn with_positive<F: ~const for<'a> Fn(&'a Alias<'a>) + ~const Destruct>(fun: F) {
| ^^^^^^^^
error[E0015]: cannot call non-const closure in constant functions error[E0015]: cannot call non-const closure in constant functions
--> $DIR/normalize-tait-in-const.rs:28:5 --> $DIR/normalize-tait-in-const.rs:28:5
| |
@ -29,7 +35,7 @@ LL | fun(filter_positive());
LL | } LL | }
| - value is dropped here | - value is dropped here
error: aborting due to 3 previous errors error: aborting due to 4 previous errors
Some errors have detailed explanations: E0015, E0493. Some errors have detailed explanations: E0015, E0493.
For more information about an error, try `rustc --explain E0015`. For more information about an error, try `rustc --explain E0015`.

View File

@ -1,6 +1,6 @@
//! Check that intrinsics that do not get overridden, but are marked as such, //! Check that intrinsics that do not get overridden, but are marked as such,
//! cause an error instead of silently invoking the body. //! cause an error instead of silently invoking the body.
#![feature(rustc_attrs, effects)] #![feature(rustc_attrs/* , effects*/)] // FIXME(effects)
//@ build-fail //@ build-fail
//@ failure-status:101 //@ failure-status:101
//@ normalize-stderr-test ".*note: .*\n\n" -> "" //@ normalize-stderr-test ".*note: .*\n\n" -> ""

View File

@ -1,6 +1,6 @@
#![feature(intrinsics)] #![feature(intrinsics)]
#![feature(rustc_attrs)] #![feature(rustc_attrs)]
#![feature(effects)] // FIXME(effects) do this with revisions #![feature(effects)]
extern "rust-intrinsic" { extern "rust-intrinsic" {
fn size_of<T>() -> usize; //~ ERROR intrinsic safety mismatch fn size_of<T>() -> usize; //~ ERROR intrinsic safety mismatch
@ -19,7 +19,7 @@ const fn const_deallocate(_ptr: *mut u8, _size: usize, _align: usize) {}
mod foo { mod foo {
#[rustc_intrinsic] #[rustc_intrinsic]
unsafe fn const_deallocate(_ptr: *mut u8, _size: usize, _align: usize) {} unsafe fn const_deallocate(_ptr: *mut u8, _size: usize, _align: usize) {}
//~^ ERROR wrong number of const parameters // FIXME(effects) ~^ ERROR wrong number of const parameters
} }
fn main() {} fn main() {}

View File

@ -42,13 +42,6 @@ LL | const fn const_deallocate(_ptr: *mut u8, _size: usize, _align: usize) {}
= note: expected signature `unsafe fn(_, _, _)` = note: expected signature `unsafe fn(_, _, _)`
found signature `fn(_, _, _)` found signature `fn(_, _, _)`
error[E0094]: intrinsic has wrong number of const parameters: found 0, expected 1 error: aborting due to 6 previous errors
--> $DIR/safe-intrinsic-mismatch.rs:21:31
|
LL | unsafe fn const_deallocate(_ptr: *mut u8, _size: usize, _align: usize) {}
| ^ expected 1 const parameter
error: aborting due to 7 previous errors For more information about this error, try `rustc --explain E0308`.
Some errors have detailed explanations: E0094, E0308.
For more information about an error, try `rustc --explain E0094`.

View File

@ -1,7 +1,7 @@
// Regression test for part of issue #119924. // Regression test for part of issue #119924.
//@ check-pass //@ check-pass
#![feature(const_trait_impl, effects)] #![feature(const_trait_impl, effects)] //~ WARN the feature `effects` is incomplete
#[const_trait] #[const_trait]
trait Trait { trait Trait {

View File

@ -0,0 +1,11 @@
warning: the feature `effects` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/impls-nested-within-fns-semantic-1.rs:4:30
|
LL | #![feature(const_trait_impl, effects)]
| ^^^^^^^
|
= note: see issue #102090 <https://github.com/rust-lang/rust/issues/102090> for more information
= note: `#[warn(incomplete_features)]` on by default
warning: 1 warning emitted

View File

@ -1,3 +1,12 @@
warning: the feature `effects` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/assoc-type-const-bound-usage-0.rs:6:30
|
LL | #![feature(const_trait_impl, effects)]
| ^^^^^^^
|
= note: see issue #102090 <https://github.com/rust-lang/rust/issues/102090> for more information
= note: `#[warn(incomplete_features)]` on by default
error[E0277]: the trait bound `T: Trait` is not satisfied error[E0277]: the trait bound `T: Trait` is not satisfied
--> $DIR/assoc-type-const-bound-usage-0.rs:21:6 --> $DIR/assoc-type-const-bound-usage-0.rs:21:6
| |
@ -9,6 +18,6 @@ help: consider further restricting this bound
LL | const fn qualified<T: ~const Trait + Trait>() -> i32 { LL | const fn qualified<T: ~const Trait + Trait>() -> i32 {
| +++++++ | +++++++
error: aborting due to 1 previous error error: aborting due to 1 previous error; 1 warning emitted
For more information about this error, try `rustc --explain E0277`. For more information about this error, try `rustc --explain E0277`.

View File

@ -3,7 +3,7 @@
//@[unqualified] check-pass //@[unqualified] check-pass
//@[qualified] known-bug: unknown //@[qualified] known-bug: unknown
#![feature(const_trait_impl, effects)] #![feature(const_trait_impl, effects)] //[unqualified]~ WARN the feature `effects` is incomplete
#[const_trait] #[const_trait]
trait Trait { trait Trait {

View File

@ -0,0 +1,11 @@
warning: the feature `effects` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/assoc-type-const-bound-usage-0.rs:6:30
|
LL | #![feature(const_trait_impl, effects)]
| ^^^^^^^
|
= note: see issue #102090 <https://github.com/rust-lang/rust/issues/102090> for more information
= note: `#[warn(incomplete_features)]` on by default
warning: 1 warning emitted

View File

@ -1,5 +1,5 @@
// FIXME(effects): Replace `Add` with `std::ops::Add` once the latter a `#[const_trait]` again. // FIXME(effects): Replace `Add` with `std::ops::Add` once the latter a `#[const_trait]` again.
#![feature(const_trait_impl, effects)] #![feature(const_trait_impl, effects)] //~ WARN the feature `effects` is incomplete
#[const_trait] #[const_trait]
trait Add<Rhs = Self> { trait Add<Rhs = Self> {

View File

@ -1,3 +1,12 @@
warning: the feature `effects` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/assoc-type.rs:2:30
|
LL | #![feature(const_trait_impl, effects)]
| ^^^^^^^
|
= note: see issue #102090 <https://github.com/rust-lang/rust/issues/102090> for more information
= note: `#[warn(incomplete_features)]` on by default
error[E0277]: the trait bound `NonConstAdd: ~const Add` is not satisfied error[E0277]: the trait bound `NonConstAdd: ~const Add` is not satisfied
--> $DIR/assoc-type.rs:35:16 --> $DIR/assoc-type.rs:35:16
| |
@ -11,6 +20,6 @@ note: required by a bound in `Foo::Bar`
LL | type Bar: ~const Add; LL | type Bar: ~const Add;
| ^^^^^^^^^^ required by this bound in `Foo::Bar` | ^^^^^^^^^^ required by this bound in `Foo::Bar`
error: aborting due to 1 previous error error: aborting due to 1 previous error; 1 warning emitted
For more information about this error, try `rustc --explain E0277`. For more information about this error, try `rustc --explain E0277`.

View File

@ -1,4 +1,4 @@
#![feature(const_trait_impl, effects)] #![feature(const_trait_impl, effects)] //~ WARN the feature `effects` is incomplete
#[const_trait] #[const_trait]
pub trait MyTrait { pub trait MyTrait {

View File

@ -1,4 +1,4 @@
#![feature(const_trait_impl, effects)] #![feature(const_trait_impl, effects)] //~ WARN the feature `effects` is incomplete
#![feature(staged_api)] #![feature(staged_api)]
#![stable(feature = "rust1", since = "1.0.0")] #![stable(feature = "rust1", since = "1.0.0")]

View File

@ -1,4 +1,4 @@
#![feature(const_trait_impl, effects)] #![feature(const_trait_impl, effects)] //~ WARN the feature `effects` is incomplete
#[const_trait] #[const_trait]
pub trait Plus { pub trait Plus {

View File

@ -1,3 +1,12 @@
warning: the feature `effects` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/call-const-trait-method-fail.rs:1:30
|
LL | #![feature(const_trait_impl, effects)]
| ^^^^^^^
|
= note: see issue #102090 <https://github.com/rust-lang/rust/issues/102090> for more information
= note: `#[warn(incomplete_features)]` on by default
error[E0277]: the trait bound `u32: ~const Plus` is not satisfied error[E0277]: the trait bound `u32: ~const Plus` is not satisfied
--> $DIR/call-const-trait-method-fail.rs:25:5 --> $DIR/call-const-trait-method-fail.rs:25:5
| |
@ -6,6 +15,6 @@ LL | a.plus(b)
| |
= help: the trait `Plus` is implemented for `u32` = help: the trait `Plus` is implemented for `u32`
error: aborting due to 1 previous error error: aborting due to 1 previous error; 1 warning emitted
For more information about this error, try `rustc --explain E0277`. For more information about this error, try `rustc --explain E0277`.

View File

@ -1,4 +1,5 @@
//@ check-pass //@ known-bug: #110395
// FIXME(effects) check-pass
#![feature(const_trait_impl)] #![feature(const_trait_impl)]
#[const_trait] #[const_trait]

View File

@ -0,0 +1,8 @@
error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/call-generic-in-impl.rs:10:16
|
LL | impl<T: ~const PartialEq> const MyPartialEq for T {
| ^^^^^^^^^
error: aborting due to 1 previous error

View File

@ -1,6 +1,7 @@
//! Basic test for calling methods on generic type parameters in `const fn`. //! Basic test for calling methods on generic type parameters in `const fn`.
//@ check-pass //@ known-bug: #110395
// FIXME(effects) check-pass
#![feature(const_trait_impl, effects)] #![feature(const_trait_impl, effects)]

View File

@ -0,0 +1,71 @@
warning: the feature `effects` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/call-generic-method-chain.rs:6:30
|
LL | #![feature(const_trait_impl, effects)]
| ^^^^^^^
|
= note: see issue #102090 <https://github.com/rust-lang/rust/issues/102090> for more information
= note: `#[warn(incomplete_features)]` on by default
error: const `impl` for trait `PartialEq` which is not marked with `#[const_trait]`
--> $DIR/call-generic-method-chain.rs:10:12
|
LL | impl const PartialEq for S {
| ^^^^^^^^^
|
= note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
= note: adding a non-const method body in the future would be a breaking change
error[E0207]: the const parameter `host` is not constrained by the impl trait, self type, or predicates
--> $DIR/call-generic-method-chain.rs:10:6
|
LL | impl const PartialEq for S {
| ^^^^^ unconstrained const parameter
|
= note: expressions using a const parameter must map each value to a distinct output value
= note: proving the result of expressions other than the parameter are unique is not supported
error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/call-generic-method-chain.rs:19:32
|
LL | const fn equals_self<T: ~const PartialEq>(t: &T) -> bool {
| ^^^^^^^^^
error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/call-generic-method-chain.rs:23:40
|
LL | const fn equals_self_wrapper<T: ~const PartialEq>(t: &T) -> bool {
| ^^^^^^^^^
error[E0284]: type annotations needed
--> $DIR/call-generic-method-chain.rs:27:22
|
LL | pub const EQ: bool = equals_self_wrapper(&S);
| ^^^^^^^^^^^^^^^^^^^^^^^ cannot infer the value of the constant `_`
|
note: required for `S` to implement `PartialEq`
--> $DIR/call-generic-method-chain.rs:10:12
|
LL | impl const PartialEq for S {
| ----- ^^^^^^^^^ ^
| |
| unsatisfied trait bound introduced here
error[E0284]: type annotations needed
--> $DIR/call-generic-method-chain.rs:15:10
|
LL | !self.eq(other)
| ^^^^^^^^^^^^^^ cannot infer the value of the constant `_`
|
note: required for `S` to implement `PartialEq`
--> $DIR/call-generic-method-chain.rs:10:12
|
LL | impl const PartialEq for S {
| ----- ^^^^^^^^^ ^
| |
| unsatisfied trait bound introduced here
error: aborting due to 6 previous errors; 1 warning emitted
Some errors have detailed explanations: E0207, E0284.
For more information about an error, try `rustc --explain E0207`.

View File

@ -1,4 +1,5 @@
//@ check-pass //@ known-bug: #110395
// FIXME(effects) check-pass
#![feature(const_trait_impl, effects)] #![feature(const_trait_impl, effects)]

View File

@ -0,0 +1,85 @@
warning: the feature `effects` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/call-generic-method-dup-bound.rs:4:30
|
LL | #![feature(const_trait_impl, effects)]
| ^^^^^^^
|
= note: see issue #102090 <https://github.com/rust-lang/rust/issues/102090> for more information
= note: `#[warn(incomplete_features)]` on by default
error: const `impl` for trait `PartialEq` which is not marked with `#[const_trait]`
--> $DIR/call-generic-method-dup-bound.rs:8:12
|
LL | impl const PartialEq for S {
| ^^^^^^^^^
|
= note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
= note: adding a non-const method body in the future would be a breaking change
error[E0207]: the const parameter `host` is not constrained by the impl trait, self type, or predicates
--> $DIR/call-generic-method-dup-bound.rs:8:6
|
LL | impl const PartialEq for S {
| ^^^^^ unconstrained const parameter
|
= note: expressions using a const parameter must map each value to a distinct output value
= note: proving the result of expressions other than the parameter are unique is not supported
error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/call-generic-method-dup-bound.rs:19:44
|
LL | const fn equals_self<T: PartialEq + ~const PartialEq>(t: &T) -> bool {
| ^^^^^^^^^
error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/call-generic-method-dup-bound.rs:26:37
|
LL | const fn equals_self2<T: A + ~const PartialEq>(t: &T) -> bool {
| ^^^^^^^^^
error[E0284]: type annotations needed
--> $DIR/call-generic-method-dup-bound.rs:30:22
|
LL | pub const EQ: bool = equals_self(&S) && equals_self2(&S);
| ^^^^^^^^^^^^^^^ cannot infer the value of the constant `_`
|
note: required for `S` to implement `PartialEq`
--> $DIR/call-generic-method-dup-bound.rs:8:12
|
LL | impl const PartialEq for S {
| ----- ^^^^^^^^^ ^
| |
| unsatisfied trait bound introduced here
error[E0284]: type annotations needed
--> $DIR/call-generic-method-dup-bound.rs:30:41
|
LL | pub const EQ: bool = equals_self(&S) && equals_self2(&S);
| ^^^^^^^^^^^^^^^^ cannot infer the value of the constant `_`
|
note: required for `S` to implement `PartialEq`
--> $DIR/call-generic-method-dup-bound.rs:8:12
|
LL | impl const PartialEq for S {
| ----- ^^^^^^^^^ ^
| |
| unsatisfied trait bound introduced here
error[E0284]: type annotations needed
--> $DIR/call-generic-method-dup-bound.rs:13:10
|
LL | !self.eq(other)
| ^^^^^^^^^^^^^^ cannot infer the value of the constant `_`
|
note: required for `S` to implement `PartialEq`
--> $DIR/call-generic-method-dup-bound.rs:8:12
|
LL | impl const PartialEq for S {
| ----- ^^^^^^^^^ ^
| |
| unsatisfied trait bound introduced here
error: aborting due to 7 previous errors; 1 warning emitted
Some errors have detailed explanations: E0207, E0284.
For more information about an error, try `rustc --explain E0207`.

View File

@ -1,8 +1,10 @@
#![feature(const_trait_impl, effects)] //@ check-pass
#![feature(const_trait_impl, effects)] //~ WARN the feature `effects` is incomplete
pub const fn equals_self<T: PartialEq>(t: &T) -> bool { pub const fn equals_self<T: PartialEq>(t: &T) -> bool {
*t == *t *t == *t
//~^ ERROR mismatched types // FIXME(effects) ~^ ERROR mismatched types
// FIXME(effects): diagnostic // FIXME(effects): diagnostic
} }

View File

@ -1,12 +1,11 @@
error[E0308]: mismatched types warning: the feature `effects` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/call-generic-method-fail.rs:4:5 --> $DIR/call-generic-method-fail.rs:3:30
| |
LL | *t == *t LL | #![feature(const_trait_impl, effects)]
| ^^^^^^^^ expected `host`, found `true` | ^^^^^^^
| |
= note: expected constant `host` = note: see issue #102090 <https://github.com/rust-lang/rust/issues/102090> for more information
found constant `true` = note: `#[warn(incomplete_features)]` on by default
error: aborting due to 1 previous error warning: 1 warning emitted
For more information about this error, try `rustc --explain E0308`.

View File

@ -1,4 +1,4 @@
#![feature(const_trait_impl, effects)] #![feature(const_trait_impl, effects)] //~ WARN the feature `effects` is incomplete
struct S; struct S;

View File

@ -1,3 +1,12 @@
warning: the feature `effects` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/call-generic-method-nonconst.rs:1:30
|
LL | #![feature(const_trait_impl, effects)]
| ^^^^^^^
|
= note: see issue #102090 <https://github.com/rust-lang/rust/issues/102090> for more information
= note: `#[warn(incomplete_features)]` on by default
error[E0277]: the trait bound `S: const Foo` is not satisfied error[E0277]: the trait bound `S: const Foo` is not satisfied
--> $DIR/call-generic-method-nonconst.rs:23:34 --> $DIR/call-generic-method-nonconst.rs:23:34
| |
@ -13,6 +22,6 @@ note: required by a bound in `equals_self`
LL | const fn equals_self<T: ~const Foo>(t: &T) -> bool { LL | const fn equals_self<T: ~const Foo>(t: &T) -> bool {
| ^^^^^^^^^^ required by this bound in `equals_self` | ^^^^^^^^^^ required by this bound in `equals_self`
error: aborting due to 1 previous error error: aborting due to 1 previous error; 1 warning emitted
For more information about this error, try `rustc --explain E0277`. For more information about this error, try `rustc --explain E0277`.

View File

@ -1,6 +1,7 @@
//! Basic test for calling methods on generic type parameters in `const fn`. //! Basic test for calling methods on generic type parameters in `const fn`.
//@ check-pass //@ known-bug: #110395
// FIXME(effects) check-pass
#![feature(const_trait_impl, effects)] #![feature(const_trait_impl, effects)]

View File

@ -0,0 +1,65 @@
warning: the feature `effects` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/call-generic-method-pass.rs:6:30
|
LL | #![feature(const_trait_impl, effects)]
| ^^^^^^^
|
= note: see issue #102090 <https://github.com/rust-lang/rust/issues/102090> for more information
= note: `#[warn(incomplete_features)]` on by default
error: const `impl` for trait `PartialEq` which is not marked with `#[const_trait]`
--> $DIR/call-generic-method-pass.rs:10:12
|
LL | impl const PartialEq for S {
| ^^^^^^^^^
|
= note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
= note: adding a non-const method body in the future would be a breaking change
error[E0207]: the const parameter `host` is not constrained by the impl trait, self type, or predicates
--> $DIR/call-generic-method-pass.rs:10:6
|
LL | impl const PartialEq for S {
| ^^^^^ unconstrained const parameter
|
= note: expressions using a const parameter must map each value to a distinct output value
= note: proving the result of expressions other than the parameter are unique is not supported
error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/call-generic-method-pass.rs:19:32
|
LL | const fn equals_self<T: ~const PartialEq>(t: &T) -> bool {
| ^^^^^^^^^
error[E0284]: type annotations needed
--> $DIR/call-generic-method-pass.rs:23:22
|
LL | pub const EQ: bool = equals_self(&S);
| ^^^^^^^^^^^^^^^ cannot infer the value of the constant `_`
|
note: required for `S` to implement `PartialEq`
--> $DIR/call-generic-method-pass.rs:10:12
|
LL | impl const PartialEq for S {
| ----- ^^^^^^^^^ ^
| |
| unsatisfied trait bound introduced here
error[E0284]: type annotations needed
--> $DIR/call-generic-method-pass.rs:15:10
|
LL | !self.eq(other)
| ^^^^^^^^^^^^^^ cannot infer the value of the constant `_`
|
note: required for `S` to implement `PartialEq`
--> $DIR/call-generic-method-pass.rs:10:12
|
LL | impl const PartialEq for S {
| ----- ^^^^^^^^^ ^
| |
| unsatisfied trait bound introduced here
error: aborting due to 5 previous errors; 1 warning emitted
Some errors have detailed explanations: E0207, E0284.
For more information about an error, try `rustc --explain E0207`.

View File

@ -1,3 +1,12 @@
error[E0119]: conflicting implementations of trait `Add` for type `Int`
--> $DIR/const-and-non-const-impl.rs:23:1
|
LL | impl std::ops::Add for Int {
| -------------------------- first implementation here
...
LL | impl const std::ops::Add for Int {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `Int`
error[E0117]: only traits defined in the current crate can be implemented for primitive types error[E0117]: only traits defined in the current crate can be implemented for primitive types
--> $DIR/const-and-non-const-impl.rs:7:1 --> $DIR/const-and-non-const-impl.rs:7:1
| |
@ -10,15 +19,6 @@ LL | impl const std::ops::Add for i32 {
| |
= note: define and implement a trait or new type instead = note: define and implement a trait or new type instead
error[E0119]: conflicting implementations of trait `Add` for type `Int`
--> $DIR/const-and-non-const-impl.rs:23:1
|
LL | impl std::ops::Add for Int {
| -------------------------- first implementation here
...
LL | impl const std::ops::Add for Int {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `Int`
error: aborting due to 2 previous errors error: aborting due to 2 previous errors
Some errors have detailed explanations: E0117, E0119. Some errors have detailed explanations: E0117, E0119.

View File

@ -1,5 +1,5 @@
// Regression test for issue #117244. // Regression test for issue #117244.
#![feature(const_trait_impl, effects)] #![feature(const_trait_impl, effects)] //~ WARN the feature `effects` is incomplete
trait NonConst {} trait NonConst {}

View File

@ -1,3 +1,12 @@
warning: the feature `effects` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/const-bounds-non-const-trait.rs:2:30
|
LL | #![feature(const_trait_impl, effects)]
| ^^^^^^^
|
= note: see issue #102090 <https://github.com/rust-lang/rust/issues/102090> for more information
= note: `#[warn(incomplete_features)]` on by default
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-bounds-non-const-trait.rs:6:28 --> $DIR/const-bounds-non-const-trait.rs:6:28
| |
@ -10,5 +19,5 @@ error: `const` can only be applied to `#[const_trait]` traits
LL | fn operate<T: const NonConst>() {} LL | fn operate<T: const NonConst>() {}
| ^^^^^^^^ | ^^^^^^^^
error: aborting due to 2 previous errors error: aborting due to 2 previous errors; 1 warning emitted

View File

@ -1,4 +1,4 @@
#![feature(const_trait_impl, effects)] #![feature(const_trait_impl, effects)] //~ WARN the feature `effects` is incomplete
struct S; struct S;
#[const_trait] #[const_trait]

View File

@ -1,3 +1,12 @@
warning: the feature `effects` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/const-check-fns-in-const-impl.rs:1:30
|
LL | #![feature(const_trait_impl, effects)]
| ^^^^^^^
|
= note: see issue #102090 <https://github.com/rust-lang/rust/issues/102090> for more information
= note: `#[warn(incomplete_features)]` on by default
error[E0015]: cannot call non-const fn `non_const` in constant functions error[E0015]: cannot call non-const fn `non_const` in constant functions
--> $DIR/const-check-fns-in-const-impl.rs:12:16 --> $DIR/const-check-fns-in-const-impl.rs:12:16
| |
@ -6,6 +15,6 @@ LL | fn foo() { non_const() }
| |
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
error: aborting due to 1 previous error error: aborting due to 1 previous error; 1 warning emitted
For more information about this error, try `rustc --explain E0015`. For more information about this error, try `rustc --explain E0015`.

View File

@ -1,4 +1,4 @@
#![feature(const_trait_impl, effects)] #![feature(const_trait_impl, effects)] //~ WARN the feature `effects` is incomplete
#[const_trait] #[const_trait]
trait ConstDefaultFn: Sized { trait ConstDefaultFn: Sized {

View File

@ -1,3 +1,12 @@
warning: the feature `effects` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/const-default-method-bodies.rs:1:30
|
LL | #![feature(const_trait_impl, effects)]
| ^^^^^^^
|
= note: see issue #102090 <https://github.com/rust-lang/rust/issues/102090> for more information
= note: `#[warn(incomplete_features)]` on by default
error[E0277]: the trait bound `NonConstImpl: ~const ConstDefaultFn` is not satisfied error[E0277]: the trait bound `NonConstImpl: ~const ConstDefaultFn` is not satisfied
--> $DIR/const-default-method-bodies.rs:24:18 --> $DIR/const-default-method-bodies.rs:24:18
| |
@ -6,6 +15,6 @@ LL | NonConstImpl.a();
| |
= help: the trait `ConstDefaultFn` is implemented for `NonConstImpl` = help: the trait `ConstDefaultFn` is implemented for `NonConstImpl`
error: aborting due to 1 previous error error: aborting due to 1 previous error; 1 warning emitted
For more information about this error, try `rustc --explain E0277`. For more information about this error, try `rustc --explain E0277`.

View File

@ -1,9 +1,27 @@
error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-drop-bound.rs:9:68
|
LL | const fn foo<T, E>(res: Result<T, E>) -> Option<T> where E: ~const Destruct {
| ^^^^^^^^
error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-drop-bound.rs:20:15
|
LL | T: ~const Destruct,
| ^^^^^^^^
error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-drop-bound.rs:21:15
|
LL | E: ~const Destruct,
| ^^^^^^^^
error[E0493]: destructor of `E` cannot be evaluated at compile-time error[E0493]: destructor of `E` cannot be evaluated at compile-time
--> $DIR/const-drop-bound.rs:12:13 --> $DIR/const-drop-bound.rs:12:13
| |
LL | Err(_e) => None, LL | Err(_e) => None,
| ^^ the destructor for this type cannot be evaluated in constant functions | ^^ the destructor for this type cannot be evaluated in constant functions
error: aborting due to 1 previous error error: aborting due to 4 previous errors
For more information about this error, try `rustc --explain E0493`. For more information about this error, try `rustc --explain E0493`.

View File

@ -1,3 +1,9 @@
error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-drop-fail-2.rs:21:26
|
LL | const fn check<T: ~const Destruct>(_: T) {}
| ^^^^^^^^
error[E0493]: destructor of `T` cannot be evaluated at compile-time error[E0493]: destructor of `T` cannot be evaluated at compile-time
--> $DIR/const-drop-fail-2.rs:21:36 --> $DIR/const-drop-fail-2.rs:21:36
| |
@ -6,6 +12,6 @@ LL | const fn check<T: ~const Destruct>(_: T) {}
| | | |
| the destructor for this type cannot be evaluated in constant functions | the destructor for this type cannot be evaluated in constant functions
error: aborting due to 1 previous error error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0493`. For more information about this error, try `rustc --explain E0493`.

View File

@ -1,3 +1,9 @@
error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-drop-fail.rs:24:26
|
LL | const fn check<T: ~const Destruct>(_: T) {}
| ^^^^^^^^
error[E0493]: destructor of `T` cannot be evaluated at compile-time error[E0493]: destructor of `T` cannot be evaluated at compile-time
--> $DIR/const-drop-fail.rs:24:36 --> $DIR/const-drop-fail.rs:24:36
| |
@ -54,7 +60,7 @@ LL | | }
| |_- in this macro invocation | |_- in this macro invocation
= note: this error originates in the macro `check_all` (in Nightly builds, run with -Z macro-backtrace for more info) = note: this error originates in the macro `check_all` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 3 previous errors error: aborting due to 4 previous errors
Some errors have detailed explanations: E0080, E0493. Some errors have detailed explanations: E0080, E0493.
For more information about an error, try `rustc --explain E0080`. For more information about an error, try `rustc --explain E0080`.

View File

@ -1,3 +1,9 @@
error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-drop-fail.rs:24:26
|
LL | const fn check<T: ~const Destruct>(_: T) {}
| ^^^^^^^^
error[E0493]: destructor of `T` cannot be evaluated at compile-time error[E0493]: destructor of `T` cannot be evaluated at compile-time
--> $DIR/const-drop-fail.rs:24:36 --> $DIR/const-drop-fail.rs:24:36
| |
@ -6,6 +12,6 @@ LL | const fn check<T: ~const Destruct>(_: T) {}
| | | |
| the destructor for this type cannot be evaluated in constant functions | the destructor for this type cannot be evaluated in constant functions
error: aborting due to 1 previous error error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0493`. For more information about this error, try `rustc --explain E0493`.

View File

@ -1,3 +1,9 @@
error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-drop.rs:19:22
|
LL | const fn a<T: ~const Destruct>(_: T) {}
| ^^^^^^^^
error[E0493]: destructor of `S<'_>` cannot be evaluated at compile-time error[E0493]: destructor of `S<'_>` cannot be evaluated at compile-time
--> $DIR/const-drop.rs:24:13 --> $DIR/const-drop.rs:24:13
| |
@ -86,7 +92,7 @@ LL | | }
| |_- in this macro invocation | |_- in this macro invocation
= note: this error originates in the macro `implements_const_drop` (in Nightly builds, run with -Z macro-backtrace for more info) = note: this error originates in the macro `implements_const_drop` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 5 previous errors error: aborting due to 6 previous errors
Some errors have detailed explanations: E0080, E0493. Some errors have detailed explanations: E0080, E0493.
For more information about an error, try `rustc --explain E0080`. For more information about an error, try `rustc --explain E0080`.

View File

@ -1,3 +1,9 @@
error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-drop.rs:19:22
|
LL | const fn a<T: ~const Destruct>(_: T) {}
| ^^^^^^^^
error[E0493]: destructor of `S<'_>` cannot be evaluated at compile-time error[E0493]: destructor of `S<'_>` cannot be evaluated at compile-time
--> $DIR/const-drop.rs:24:13 --> $DIR/const-drop.rs:24:13
| |
@ -14,6 +20,6 @@ LL | const fn a<T: ~const Destruct>(_: T) {}
| | | |
| the destructor for this type cannot be evaluated in constant functions | the destructor for this type cannot be evaluated in constant functions
error: aborting due to 2 previous errors error: aborting due to 3 previous errors
For more information about this error, try `rustc --explain E0493`. For more information about this error, try `rustc --explain E0493`.

View File

@ -7,7 +7,7 @@
#![feature( #![feature(
auto_traits, auto_traits,
const_trait_impl, const_trait_impl,
effects, effects, //~ WARN the feature `effects` is incomplete
lang_items, lang_items,
no_core, no_core,
staged_api, staged_api,

View File

@ -0,0 +1,11 @@
warning: the feature `effects` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/const-fns-are-early-bound.rs:10:5
|
LL | effects,
| ^^^^^^^
|
= note: see issue #102090 <https://github.com/rust-lang/rust/issues/102090> for more information
= note: `#[warn(incomplete_features)]` on by default
warning: 1 warning emitted

View File

@ -1,3 +1,12 @@
warning: the feature `effects` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/const-impl-requires-const-trait.rs:3:30
|
LL | #![feature(const_trait_impl, effects)]
| ^^^^^^^
|
= note: see issue #102090 <https://github.com/rust-lang/rust/issues/102090> for more information
= note: `#[warn(incomplete_features)]` on by default
error: const `impl` for trait `A` which is not marked with `#[const_trait]` error: const `impl` for trait `A` which is not marked with `#[const_trait]`
--> $DIR/const-impl-requires-const-trait.rs:8:12 --> $DIR/const-impl-requires-const-trait.rs:8:12
| |
@ -19,6 +28,6 @@ LL | impl const A for () {}
= note: expressions using a const parameter must map each value to a distinct output value = note: expressions using a const parameter must map each value to a distinct output value
= note: proving the result of expressions other than the parameter are unique is not supported = note: proving the result of expressions other than the parameter are unique is not supported
error: aborting due to 2 previous errors error: aborting due to 2 previous errors; 1 warning emitted
For more information about this error, try `rustc --explain E0207`. For more information about this error, try `rustc --explain E0207`.

View File

@ -1,28 +1,244 @@
error[E0277]: can't compare `()` with `()` error[E0635]: unknown feature `const_cmp`
--> $DIR/const-impl-trait.rs:36:17 --> $DIR/const-impl-trait.rs:8:5
| |
LL | assert!(cmp(&())); LL | const_cmp,
| --- ^^^ no implementation for `() == ()` | ^^^^^^^^^
| |
| required by a bound introduced by this call error: `~const` can only be applied to `#[const_trait]` traits
| --> $DIR/const-impl-trait.rs:13:30
= help: the trait `const PartialEq` is not implemented for `()`
= help: the trait `PartialEq` is implemented for `()`
note: required by a bound in `cmp`
--> $DIR/const-impl-trait.rs:13:23
| |
LL | const fn cmp(a: &impl ~const PartialEq) -> bool { LL | const fn cmp(a: &impl ~const PartialEq) -> bool {
| ^^^^^^^^^^^^^^^^ required by this bound in `cmp` | ^^^^^^^^^
error[E0369]: binary operation `==` cannot be applied to type `&impl ~const PartialEq` error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-impl-trait.rs:14:7 --> $DIR/const-impl-trait.rs:17:30
| |
LL | a == a LL | const fn wrap(x: impl ~const PartialEq + ~const Destruct)
| - ^^ - &impl ~const PartialEq | ^^^^^^^^^
error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-impl-trait.rs:17:49
|
LL | const fn wrap(x: impl ~const PartialEq + ~const Destruct)
| ^^^^^^^^
error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-impl-trait.rs:18:20
|
LL | -> impl ~const PartialEq + ~const Destruct
| ^^^^^^^^^
error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-impl-trait.rs:18:39
|
LL | -> impl ~const PartialEq + ~const Destruct
| ^^^^^^^^
error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-impl-trait.rs:18:20
|
LL | -> impl ~const PartialEq + ~const Destruct
| ^^^^^^^^^
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-impl-trait.rs:18:39
|
LL | -> impl ~const PartialEq + ~const Destruct
| ^^^^^^^^
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-impl-trait.rs:25:29
|
LL | fn huh() -> impl ~const PartialEq + ~const Destruct + Copy;
| ^^^^^^^^^
error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-impl-trait.rs:25:48
|
LL | fn huh() -> impl ~const PartialEq + ~const Destruct + Copy;
| ^^^^^^^^
error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-impl-trait.rs:25:29
|
LL | fn huh() -> impl ~const PartialEq + ~const Destruct + Copy;
| ^^^^^^^^^
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-impl-trait.rs:25:48
|
LL | fn huh() -> impl ~const PartialEq + ~const Destruct + Copy;
| ^^^^^^^^
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-impl-trait.rs:25:29
|
LL | fn huh() -> impl ~const PartialEq + ~const Destruct + Copy;
| ^^^^^^^^^
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-impl-trait.rs:25:48
|
LL | fn huh() -> impl ~const PartialEq + ~const Destruct + Copy;
| ^^^^^^^^
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-impl-trait.rs:29:29
|
LL | fn huh() -> impl ~const PartialEq + ~const Destruct + Copy {
| ^^^^^^^^^
error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-impl-trait.rs:29:48
|
LL | fn huh() -> impl ~const PartialEq + ~const Destruct + Copy {
| ^^^^^^^^
error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-impl-trait.rs:29:29
|
LL | fn huh() -> impl ~const PartialEq + ~const Destruct + Copy {
| ^^^^^^^^^
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-impl-trait.rs:29:48
|
LL | fn huh() -> impl ~const PartialEq + ~const Destruct + Copy {
| ^^^^^^^^
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-impl-trait.rs:50:41
|
LL | const fn apit(_: impl ~const T + ~const Destruct) {}
| ^^^^^^^^
error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-impl-trait.rs:54:73
|
LL | const fn apit_assoc_bound(_: impl IntoIterator<Item: ~const T> + ~const Destruct) {}
| ^^^^^^^^
error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-impl-trait.rs:25:29
|
LL | fn huh() -> impl ~const PartialEq + ~const Destruct + Copy;
| ^^^^^^^^^
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-impl-trait.rs:25:48
|
LL | fn huh() -> impl ~const PartialEq + ~const Destruct + Copy;
| ^^^^^^^^
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0493]: destructor of `impl PartialEq + Destruct` cannot be evaluated at compile-time
--> $DIR/const-impl-trait.rs:37:26
|
LL | assert!(wrap(123) == wrap(123));
| ^^^^^^^^^- value is dropped here
| | | |
| &impl ~const PartialEq | the destructor for this type cannot be evaluated in constants
error: aborting due to 2 previous errors error[E0493]: destructor of `impl PartialEq + Destruct` cannot be evaluated at compile-time
--> $DIR/const-impl-trait.rs:37:26
|
LL | assert!(wrap(123) == wrap(123));
| ^^^^^^^^^- value is dropped here
| |
| the destructor for this type cannot be evaluated in constants
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
Some errors have detailed explanations: E0277, E0369. error[E0493]: destructor of `impl PartialEq + Destruct` cannot be evaluated at compile-time
For more information about an error, try `rustc --explain E0277`. --> $DIR/const-impl-trait.rs:37:13
|
LL | assert!(wrap(123) == wrap(123));
| ^^^^^^^^^ - value is dropped here
| |
| the destructor for this type cannot be evaluated in constants
error[E0493]: destructor of `impl PartialEq + Destruct` cannot be evaluated at compile-time
--> $DIR/const-impl-trait.rs:37:13
|
LL | assert!(wrap(123) == wrap(123));
| ^^^^^^^^^ - value is dropped here
| |
| the destructor for this type cannot be evaluated in constants
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0493]: destructor of `impl PartialEq + Destruct` cannot be evaluated at compile-time
--> $DIR/const-impl-trait.rs:38:26
|
LL | assert!(wrap(123) != wrap(456));
| ^^^^^^^^^- value is dropped here
| |
| the destructor for this type cannot be evaluated in constants
error[E0493]: destructor of `impl PartialEq + Destruct` cannot be evaluated at compile-time
--> $DIR/const-impl-trait.rs:38:26
|
LL | assert!(wrap(123) != wrap(456));
| ^^^^^^^^^- value is dropped here
| |
| the destructor for this type cannot be evaluated in constants
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0493]: destructor of `impl PartialEq + Destruct` cannot be evaluated at compile-time
--> $DIR/const-impl-trait.rs:38:13
|
LL | assert!(wrap(123) != wrap(456));
| ^^^^^^^^^ - value is dropped here
| |
| the destructor for this type cannot be evaluated in constants
error[E0493]: destructor of `impl PartialEq + Destruct` cannot be evaluated at compile-time
--> $DIR/const-impl-trait.rs:38:13
|
LL | assert!(wrap(123) != wrap(456));
| ^^^^^^^^^ - value is dropped here
| |
| the destructor for this type cannot be evaluated in constants
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0493]: destructor of `impl ~const T + ~const Destruct` cannot be evaluated at compile-time
--> $DIR/const-impl-trait.rs:50:15
|
LL | const fn apit(_: impl ~const T + ~const Destruct) {}
| ^ - value is dropped here
| |
| the destructor for this type cannot be evaluated in constant functions
error[E0493]: destructor of `impl IntoIterator<Item : ~const T> + ~const Destruct` cannot be evaluated at compile-time
--> $DIR/const-impl-trait.rs:54:27
|
LL | const fn apit_assoc_bound(_: impl IntoIterator<Item: ~const T> + ~const Destruct) {}
| ^ - value is dropped here
| |
| the destructor for this type cannot be evaluated in constant functions
error: aborting due to 32 previous errors
Some errors have detailed explanations: E0493, E0635.
For more information about an error, try `rustc --explain E0493`.

View File

@ -1,4 +1,4 @@
#![feature(const_trait_impl, effects)] #![feature(const_trait_impl, effects)] //~ WARN the feature `effects` is incomplete
//@ edition: 2021 //@ edition: 2021
#[const_trait] #[const_trait]

View File

@ -26,5 +26,14 @@ LL | const fn take(_: &dyn ~const NonConst) {}
| |
= note: trait objects cannot have `~const` trait bounds = note: trait objects cannot have `~const` trait bounds
error: aborting due to 4 previous errors warning: the feature `effects` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/const-trait-bounds-trait-objects.rs:1:30
|
LL | #![feature(const_trait_impl, effects)]
| ^^^^^^^
|
= note: see issue #102090 <https://github.com/rust-lang/rust/issues/102090> for more information
= note: `#[warn(incomplete_features)]` on by default
error: aborting due to 4 previous errors; 1 warning emitted

View File

@ -1,3 +1,12 @@
warning: the feature `effects` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/derive-const-non-const-type.rs:2:26
|
LL | #![feature(derive_const, effects)]
| ^^^^^^^
|
= note: see issue #102090 <https://github.com/rust-lang/rust/issues/102090> for more information
= note: `#[warn(incomplete_features)]` on by default
error: const `impl` for trait `Default` which is not marked with `#[const_trait]` error: const `impl` for trait `Default` which is not marked with `#[const_trait]`
--> $DIR/derive-const-non-const-type.rs:10:16 --> $DIR/derive-const-non-const-type.rs:10:16
| |
@ -13,6 +22,6 @@ error[E0207]: the const parameter `host` is not constrained by the impl trait, s
= note: expressions using a const parameter must map each value to a distinct output value = note: expressions using a const parameter must map each value to a distinct output value
= note: proving the result of expressions other than the parameter are unique is not supported = note: proving the result of expressions other than the parameter are unique is not supported
error: aborting due to 2 previous errors error: aborting due to 2 previous errors; 1 warning emitted
For more information about this error, try `rustc --explain E0207`. For more information about this error, try `rustc --explain E0207`.

View File

@ -1,3 +1,18 @@
warning: the feature `effects` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/derive-const-use.rs:3:76
|
LL | #![feature(const_trait_impl, const_cmp, const_default_impls, derive_const, effects)]
| ^^^^^^^
|
= note: see issue #102090 <https://github.com/rust-lang/rust/issues/102090> for more information
= note: `#[warn(incomplete_features)]` on by default
error[E0635]: unknown feature `const_cmp`
--> $DIR/derive-const-use.rs:3:30
|
LL | #![feature(const_trait_impl, const_cmp, const_default_impls, derive_const, effects)]
| ^^^^^^^^^
error[E0635]: unknown feature `const_default_impls` error[E0635]: unknown feature `const_default_impls`
--> $DIR/derive-const-use.rs:3:41 --> $DIR/derive-const-use.rs:3:41
| |
@ -22,6 +37,24 @@ LL | impl const Default for A {
= note: expressions using a const parameter must map each value to a distinct output value = note: expressions using a const parameter must map each value to a distinct output value
= note: proving the result of expressions other than the parameter are unique is not supported = note: proving the result of expressions other than the parameter are unique is not supported
error: const `impl` for trait `PartialEq` which is not marked with `#[const_trait]`
--> $DIR/derive-const-use.rs:11:12
|
LL | impl const PartialEq for A {
| ^^^^^^^^^
|
= note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
= note: adding a non-const method body in the future would be a breaking change
error[E0207]: the const parameter `host` is not constrained by the impl trait, self type, or predicates
--> $DIR/derive-const-use.rs:11:6
|
LL | impl const PartialEq for A {
| ^^^^^ unconstrained const parameter
|
= note: expressions using a const parameter must map each value to a distinct output value
= note: proving the result of expressions other than the parameter are unique is not supported
error: const `impl` for trait `Default` which is not marked with `#[const_trait]` error: const `impl` for trait `Default` which is not marked with `#[const_trait]`
--> $DIR/derive-const-use.rs:15:16 --> $DIR/derive-const-use.rs:15:16
| |
@ -37,6 +70,22 @@ error[E0207]: the const parameter `host` is not constrained by the impl trait, s
= note: expressions using a const parameter must map each value to a distinct output value = note: expressions using a const parameter must map each value to a distinct output value
= note: proving the result of expressions other than the parameter are unique is not supported = note: proving the result of expressions other than the parameter are unique is not supported
error: const `impl` for trait `PartialEq` which is not marked with `#[const_trait]`
--> $DIR/derive-const-use.rs:15:25
|
LL | #[derive_const(Default, PartialEq)]
| ^^^^^^^^^
|
= note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
= note: adding a non-const method body in the future would be a breaking change
= note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0207]: the const parameter `host` is not constrained by the impl trait, self type, or predicates
|
= note: expressions using a const parameter must map each value to a distinct output value
= note: proving the result of expressions other than the parameter are unique is not supported
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0284]: type annotations needed error[E0284]: type annotations needed
--> $DIR/derive-const-use.rs:18:35 --> $DIR/derive-const-use.rs:18:35
| |
@ -50,16 +99,17 @@ LL | #[derive_const(Default, PartialEq)]
| ^^^^^^^ unsatisfied trait bound introduced in this `derive` macro | ^^^^^^^ unsatisfied trait bound introduced in this `derive` macro
= note: this error originates in the derive macro `Default` (in Nightly builds, run with -Z macro-backtrace for more info) = note: this error originates in the derive macro `Default` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0308]: mismatched types error[E0284]: type annotations needed
--> $DIR/derive-const-use.rs:16:14 --> $DIR/derive-const-use.rs:18:23
|
LL | const _: () = assert!(S((), A) == S::default());
| ^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer the value of the constant `_`
|
note: required for `S` to implement `PartialEq`
--> $DIR/derive-const-use.rs:15:25
| |
LL | #[derive_const(Default, PartialEq)] LL | #[derive_const(Default, PartialEq)]
| --------- in this derive macro expansion | ^^^^^^^^^ unsatisfied trait bound introduced in this `derive` macro
LL | pub struct S((), A);
| ^^ expected `host`, found `true`
|
= note: expected constant `host`
found constant `true`
= note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info) = note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0284]: type annotations needed error[E0284]: type annotations needed
@ -79,7 +129,24 @@ LL | impl const Default for A {
| unsatisfied trait bound introduced here | unsatisfied trait bound introduced here
= note: this error originates in the derive macro `Default` (in Nightly builds, run with -Z macro-backtrace for more info) = note: this error originates in the derive macro `Default` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 8 previous errors error[E0284]: type annotations needed
--> $DIR/derive-const-use.rs:16:18
|
LL | #[derive_const(Default, PartialEq)]
| --------- in this derive macro expansion
LL | pub struct S((), A);
| ^ cannot infer the value of the constant `_`
|
note: required for `A` to implement `PartialEq`
--> $DIR/derive-const-use.rs:11:12
|
LL | impl const PartialEq for A {
| ----- ^^^^^^^^^ ^
| |
| unsatisfied trait bound introduced here
= note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info)
Some errors have detailed explanations: E0207, E0284, E0308, E0635. error: aborting due to 14 previous errors; 1 warning emitted
Some errors have detailed explanations: E0207, E0284, E0635.
For more information about an error, try `rustc --explain E0207`. For more information about an error, try `rustc --explain E0207`.

View File

@ -1,4 +1,5 @@
//@ check-pass //@ known-bug: #110395
// FIXME(effects) check-pass
#![feature(derive_const)] #![feature(derive_const)]
#![feature(const_trait_impl, effects)] #![feature(const_trait_impl, effects)]

View File

@ -0,0 +1,49 @@
warning: the feature `effects` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/derive-const-with-params.rs:5:30
|
LL | #![feature(const_trait_impl, effects)]
| ^^^^^^^
|
= note: see issue #102090 <https://github.com/rust-lang/rust/issues/102090> for more information
= note: `#[warn(incomplete_features)]` on by default
error: const `impl` for trait `PartialEq` which is not marked with `#[const_trait]`
--> $DIR/derive-const-with-params.rs:7:16
|
LL | #[derive_const(PartialEq)]
| ^^^^^^^^^
|
= note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
= note: adding a non-const method body in the future would be a breaking change
= note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info)
error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/derive-const-with-params.rs:7:16
|
LL | #[derive_const(PartialEq)]
| ^^^^^^^^^
|
= note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0207]: the const parameter `host` is not constrained by the impl trait, self type, or predicates
|
= note: expressions using a const parameter must map each value to a distinct output value
= note: proving the result of expressions other than the parameter are unique is not supported
error[E0284]: type annotations needed
--> $DIR/derive-const-with-params.rs:11:5
|
LL | a == b
| ^^^^^^ cannot infer the value of the constant `_`
|
note: required for `Reverse<i32>` to implement `PartialEq`
--> $DIR/derive-const-with-params.rs:7:16
|
LL | #[derive_const(PartialEq)]
| ^^^^^^^^^ unsatisfied trait bound introduced in this `derive` macro
= note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 4 previous errors; 1 warning emitted
Some errors have detailed explanations: E0207, E0284.
For more information about an error, try `rustc --explain E0207`.

View File

@ -3,7 +3,7 @@
// //
//@ check-pass //@ check-pass
#![feature(const_trait_impl, effects)] #![feature(const_trait_impl, effects)] //~ WARN the feature `effects` is incomplete
//@ aux-build: cross-crate.rs //@ aux-build: cross-crate.rs
extern crate cross_crate; extern crate cross_crate;

Some files were not shown because too many files have changed in this diff Show More