Auto merge of #132479 - compiler-errors:fx-feat-yeet, r=fee1-dead

Yeet the `effects` feature, move it onto `const_trait_impl`

This PR merges the `effects` feature into the `const_trait_impl` feature. There's really no need to have two feature gates for one feature.

After this PR, if `const_trait_impl` **is** enabled:
* Users can use and define const traits
* `HostEffect` const conditions will be enforced on the HIR
* We re-check the predicates in MIR just to make sure that we don't "leak" anything during MIR lowering

And if `const_trait_impl` **is not** enabled:
* Users cannot use nor define const traits
* `HostEffect` const conditions are not enforced on the HIR
* We will raise a const validation error if we call a function that has any const conditions (i.e. const traits and functions with any `~const` in their where clasues)

This should be the last step for us to be able to enable const traits in the standard library. We still need to re-constify `Drop` and `Destruct` and stuff for const traits to be particularly *useful* for some cases, but this is a good step :D

r? fee1-dead
cc `@rust-lang/project-const-traits`
This commit is contained in:
bors 2024-11-03 19:41:46 +00:00
commit b8c8287a22
221 changed files with 370 additions and 1025 deletions

View File

@ -594,8 +594,8 @@ pub(crate) struct ConstBoundTraitObject {
pub span: Span,
}
// FIXME(effects): Consider making the note/reason the message of the diagnostic.
// FIXME(effects): Provide structured suggestions (e.g., add `const` / `#[const_trait]` here).
// FIXME(const_trait_impl): Consider making the note/reason the message of the diagnostic.
// FIXME(const_trait_impl): Provide structured suggestions (e.g., add `const` / `#[const_trait]` here).
#[derive(Diagnostic)]
#[diag(ast_passes_tilde_const_disallowed)]
pub(crate) struct TildeConstDisallowed {

View File

@ -20,7 +20,6 @@ use rustc_mir_dataflow::Analysis;
use rustc_mir_dataflow::impls::MaybeStorageLive;
use rustc_mir_dataflow::storage::always_storage_live_locals;
use rustc_span::{Span, Symbol, sym};
use rustc_trait_selection::error_reporting::InferCtxtErrorExt;
use rustc_trait_selection::traits::{
Obligation, ObligationCause, ObligationCauseCode, ObligationCtxt,
};
@ -419,13 +418,8 @@ impl<'mir, 'tcx> Checker<'mir, 'tcx> {
let errors = ocx.select_all_or_error();
if !errors.is_empty() {
// FIXME(effects): Soon this should be unconditionally delaying a bug.
if matches!(call_source, CallSource::Normal) && tcx.features().effects() {
tcx.dcx()
.span_delayed_bug(call_span, "this should have reported a ~const error in HIR");
} else {
infcx.err_ctxt().report_fulfillment_errors(errors);
}
tcx.dcx()
.span_delayed_bug(call_span, "this should have reported a ~const error in HIR");
}
}
}
@ -663,8 +657,9 @@ impl<'tcx> Visitor<'tcx> for Checker<'_, 'tcx> {
// typeck ensures the conditions for calling a const trait method are met,
// so we only error if the trait isn't const. We try to resolve the trait
// into the concrete method, and uses that for const stability checks.
// FIXME(effects) we might consider moving const stability checks to typeck as well.
if tcx.features().effects() && trait_is_const {
// FIXME(const_trait_impl) we might consider moving const stability checks
// to typeck as well.
if tcx.features().const_trait_impl() && trait_is_const {
// This skips the check below that ensures we only call `const fn`.
is_trait = true;

View File

@ -120,7 +120,7 @@ impl<'tcx> NonConstOp<'tcx> for FnCallNonConst<'tcx> {
let implsrc = selcx.select(&obligation);
if let Ok(Some(ImplSource::UserDefined(data))) = implsrc {
// FIXME(effects) revisit this
// FIXME(const_trait_impl) revisit this
if !tcx.is_const_trait_impl(data.impl_def_id) {
let span = tcx.def_span(data.impl_def_id);
err.subdiagnostic(errors::NonConstImplNote { span });

View File

@ -192,7 +192,7 @@ impl Qualif for NeedsNonConstDrop {
return false;
}
// FIXME(effects): Reimplement const drop checking.
// FIXME(const_trait_impl): Reimplement const drop checking.
NeedsDrop::in_any_value_of_ty(cx, ty)
}

View File

@ -431,7 +431,7 @@ impl<'tcx> interpret::Machine<'tcx> for CompileTimeMachine<'tcx> {
// sensitive check here. But we can at least rule out functions that are not const at
// all. That said, we have to allow calling functions inside a trait marked with
// #[const_trait]. These *are* const-checked!
// FIXME(effects): why does `is_const_fn` not classify them as const?
// FIXME(const_trait_impl): why does `is_const_fn` not classify them as const?
if (!ecx.tcx.is_const_fn(def) && !ecx.tcx.is_const_default_method(def))
|| ecx.tcx.has_attr(def, sym::rustc_do_not_const_check)
{

View File

@ -100,6 +100,9 @@ declare_features! (
Some("renamed to `doc_notable_trait`")),
/// Allows using `#[unsafe_destructor_blind_to_params]` (RFC 1238).
(removed, dropck_parametricity, "1.38.0", Some(28498), None),
/// Uses generic effect parameters for ~const bounds
(removed, effects, "CURRENT_RUSTC_VERSION", Some(102090),
Some("removed, redundant with `#![feature(const_trait_impl)]`")),
/// Allows defining `existential type`s.
(removed, existential_type, "1.38.0", Some(63063),
Some("removed in favor of `#![feature(type_alias_impl_trait)]`")),

View File

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

View File

@ -205,7 +205,6 @@ fn compare_method_predicate_entailment<'tcx>(
trait_m_predicates.instantiate_own(tcx, trait_to_impl_args).map(|(predicate, _)| predicate),
);
// FIXME(effects): This should be replaced with a more dedicated method.
let is_conditionally_const = tcx.is_conditionally_const(impl_def_id);
if is_conditionally_const {
// Augment the hybrid param-env with the const conditions

View File

@ -563,7 +563,6 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
if let Err(guar) = ty.error_reported() {
return ty::Const::new_error(tcx, guar).into();
}
// FIXME(effects) see if we should special case effect params here
if !infer_args && has_default {
tcx.const_param_default(param.def_id)
.instantiate(tcx, preceding_args)

View File

@ -459,7 +459,7 @@ fn trait_predicates_eq<'tcx>(
predicate1: ty::Predicate<'tcx>,
predicate2: ty::Predicate<'tcx>,
) -> bool {
// FIXME(effects)
// FIXME(const_trait_impl)
predicate1 == predicate2
}

View File

@ -461,7 +461,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
}
(fn_sig, Some(def_id))
}
// FIXME(effects): these arms should error because we can't enforce them
// FIXME(const_trait_impl): these arms should error because we can't enforce them
ty::FnPtr(sig_tys, hdr) => (sig_tys.with(hdr), None),
_ => {
for arg in arg_exprs {
@ -843,11 +843,11 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
callee_did: DefId,
callee_args: GenericArgsRef<'tcx>,
) {
// FIXME(effects): We should be enforcing these effects unconditionally.
// FIXME(const_trait_impl): We should be enforcing these effects unconditionally.
// This can be done as soon as we convert the standard library back to
// using const traits, since if we were to enforce these conditions now,
// we'd fail on basically every builtin trait call (i.e. `1 + 2`).
if !self.tcx.features().effects() {
if !self.tcx.features().const_trait_impl() {
return;
}
@ -864,11 +864,11 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
None => return,
};
// FIXME(effects): Should this be `is_const_fn_raw`? It depends on if we move
// FIXME(const_trait_impl): Should this be `is_const_fn_raw`? It depends on if we move
// const stability checking here too, I guess.
if self.tcx.is_conditionally_const(callee_did) {
let q = self.tcx.const_conditions(callee_did);
// FIXME(effects): Use this span with a better cause code.
// FIXME(const_trait_impl): Use this span with a better cause code.
for (cond, _) in q.instantiate(self.tcx, callee_args) {
self.register_predicate(Obligation::new(
self.tcx,
@ -878,7 +878,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
));
}
} else {
// FIXME(effects): This should eventually be caught here.
// FIXME(const_trait_impl): This should eventually be caught here.
// For now, though, we defer some const checking to MIR.
}
}

View File

@ -3125,7 +3125,6 @@ impl<'tcx> TyCtxt<'tcx> {
}
}
// FIXME(effects): Please remove this. It's a footgun.
/// Whether the trait impl is marked const. This does not consider stability or feature gates.
pub fn is_const_trait_impl(self, def_id: DefId) -> bool {
self.def_kind(def_id) == DefKind::Impl { of_trait: true }

View File

@ -84,7 +84,7 @@ where
let cx = ecx.cx();
let mut candidates = vec![];
// FIXME(effects): We elaborate here because the implied const bounds
// FIXME(const_trait_impl): We elaborate here because the implied const bounds
// aren't necessarily elaborated. We probably should prefix this query
// with `explicit_`...
for clause in elaborate::elaborate(

View File

@ -609,8 +609,6 @@ where
return Err(NoSolution);
}
// FIXME(effects): Implement this when we get const working in the new solver
// `Destruct` is automatically implemented for every type in
// non-const environments.
ecx.probe_builtin_trait_candidate(BuiltinImplSource::Misc)

View File

@ -217,7 +217,7 @@ impl<'a, 'tcx> Annotator<'a, 'tcx> {
// `impl const Trait for Type` items forward their const stability to their
// immediate children.
// FIXME(effects): how is this supposed to interact with `#[rustc_const_stable_indirect]`?
// FIXME(const_trait_impl): how is this supposed to interact with `#[rustc_const_stable_indirect]`?
// Currently, once that is set, we do not inherit anything from the parent any more.
if const_stab.is_none() {
debug!("annotate: const_stab not found, parent = {:?}", self.parent_const_stab);

View File

@ -538,7 +538,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
}
ty::PredicateKind::Clause(ty::ClauseKind::HostEffect(predicate)) => {
// FIXME(effects): We should recompute the predicate with `~const`
// FIXME(const_trait_impl): We should recompute the predicate with `~const`
// if it's `const`, and if it holds, explain that this bound only
// *conditionally* holds. If that fails, we should also do selection
// to drill this down to an impl or built-in source, so we can
@ -2641,7 +2641,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
_span: Span,
) -> UnsatisfiedConst {
let unsatisfied_const = UnsatisfiedConst(false);
// FIXME(effects)
// FIXME(const_trait_impl)
unsatisfied_const
}
@ -3052,7 +3052,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
// Make a fresh inference variable so we can determine what the generic parameters
// of the trait are.
let var = self.next_ty_var(DUMMY_SP);
// FIXME(effects)
// FIXME(const_trait_impl)
let trait_ref = ty::TraitRef::new(self.tcx, trait_def_id, [ty.skip_binder(), var]);
let obligation = Obligation::new(
self.tcx,

View File

@ -3751,7 +3751,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
trait_pred.skip_binder().self_ty(),
diagnostic_name,
),
// FIXME(effects, const_trait_impl) derive_const as suggestion?
// FIXME(const_trait_impl) derive_const as suggestion?
format!("#[derive({diagnostic_name})]\n"),
Applicability::MaybeIncorrect,
);

View File

@ -374,7 +374,7 @@ impl<'a, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'tcx> {
| ty::PredicateKind::Coerce(_)
| ty::PredicateKind::Clause(ty::ClauseKind::ConstEvaluatable(..))
| ty::PredicateKind::ConstEquate(..)
// FIXME(effects): We may need to do this using the higher-ranked
// FIXME(const_trait_impl): We may need to do this using the higher-ranked
// pred instead of just instantiating it with placeholders b/c of
// higher-ranked implied bound issues in the old solver.
| ty::PredicateKind::Clause(ty::ClauseKind::HostEffect(..)) => {

View File

@ -1170,8 +1170,6 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
_obligation: &PolyTraitObligation<'tcx>,
candidates: &mut SelectionCandidateSet<'tcx>,
) {
// FIXME(effects): Destruct is not const yet, and it is implemented
// by all types today in non-const setting.
candidates.vec.push(BuiltinCandidate { has_nested: false });
}

View File

@ -81,7 +81,6 @@ fn resolve_instance_raw<'tcx>(
}
} else {
debug!(" => free item");
// FIXME(effects): we may want to erase the effect param if that is present on this item.
ty::InstanceKind::Item(def_id)
};

View File

@ -174,7 +174,6 @@ impl<I: Interner> UpcastFrom<I, TraitRef<I>> for TraitPredicate<I> {
impl<I: Interner> fmt::Debug for TraitPredicate<I> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
// FIXME(effects) printing?
write!(f, "TraitPredicate({:?}, polarity:{:?})", self.trait_ref, self.polarity)
}
}

View File

@ -510,7 +510,7 @@ impl CStr {
#[inline]
#[must_use]
const fn as_non_null_ptr(&self) -> NonNull<c_char> {
// FIXME(effects) replace with `NonNull::from`
// FIXME(const_trait_impl) 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()

View File

@ -203,7 +203,7 @@
/// [nomicon]: ../../nomicon/phantom-data.html#an-exception-the-special-case-of-the-standard-library-and-its-unstable-may_dangle
#[lang = "drop"]
#[stable(feature = "rust1", since = "1.0.0")]
// FIXME(effects) #[const_trait]
// FIXME(const_trait_impl) #[const_trait]
pub trait Drop {
/// Executes the destructor for this type.
///

View File

@ -72,7 +72,7 @@ use crate::marker::Tuple;
)]
#[fundamental] // so that regex can rely that `&str: !FnMut`
#[must_use = "closures are lazy and do nothing unless called"]
// FIXME(effects) #[const_trait]
// FIXME(const_trait_impl) #[const_trait]
pub trait Fn<Args: Tuple>: FnMut<Args> {
/// Performs the call operation.
#[unstable(feature = "fn_traits", issue = "29625")]
@ -159,7 +159,7 @@ pub trait Fn<Args: Tuple>: FnMut<Args> {
)]
#[fundamental] // so that regex can rely that `&str: !FnMut`
#[must_use = "closures are lazy and do nothing unless called"]
// FIXME(effects) #[const_trait]
// FIXME(const_trait_impl) #[const_trait]
pub trait FnMut<Args: Tuple>: FnOnce<Args> {
/// Performs the call operation.
#[unstable(feature = "fn_traits", issue = "29625")]
@ -238,7 +238,7 @@ pub trait FnMut<Args: Tuple>: FnOnce<Args> {
)]
#[fundamental] // so that regex can rely that `&str: !FnMut`
#[must_use = "closures are lazy and do nothing unless called"]
// FIXME(effects) #[const_trait]
// FIXME(const_trait_impl) #[const_trait]
pub trait FnOnce<Args: Tuple> {
/// The returned type after the call operator is used.
#[lang = "fn_once_output"]

View File

@ -102,7 +102,7 @@ impl<T: FreezeMarker> UnstableSmallSortTypeImpl for T {
}
}
/// FIXME(effects) use original ipnsort approach with choose_unstable_small_sort,
/// FIXME(const_trait_impl) use original ipnsort approach with choose_unstable_small_sort,
/// as found here <https://github.com/Voultapher/sort-research-rs/blob/438fad5d0495f65d4b72aa87f0b62fc96611dff3/ipnsort/src/smallsort.rs#L83C10-L83C36>.
pub(crate) trait UnstableSmallSortFreezeTypeImpl: Sized + FreezeMarker {
fn small_sort_threshold() -> usize;

View File

@ -369,7 +369,7 @@ pub(crate) fn clean_predicate<'tcx>(
ty::ClauseKind::ConstEvaluatable(..)
| ty::ClauseKind::WellFormed(..)
| ty::ClauseKind::ConstArgHasType(..)
// FIXME(effects): We can probably use this `HostEffect` pred to render `~const`.
// FIXME(const_trait_impl): We can probably use this `HostEffect` pred to render `~const`.
| ty::ClauseKind::HostEffect(_) => None,
}
}
@ -379,7 +379,7 @@ fn clean_poly_trait_predicate<'tcx>(
cx: &mut DocContext<'tcx>,
) -> Option<WherePredicate> {
// `T: ~const Destruct` is hidden because `T: Destruct` is a no-op.
// FIXME(effects) check constness
// FIXME(const_trait_impl) check constness
if Some(pred.skip_binder().def_id()) == cx.tcx.lang_items().destruct_trait() {
return None;
}

View File

@ -404,7 +404,7 @@ fn is_stable_const_fn(tcx: TyCtxt<'_>, def_id: DefId, msrv: &Msrv) -> bool {
}
fn is_ty_const_destruct<'tcx>(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>, body: &Body<'tcx>) -> bool {
// FIXME(effects, fee1-dead) revert to const destruct once it works again
// FIXME(const_trait_impl, fee1-dead) revert to const destruct once it works again
#[expect(unused)]
fn is_ty_const_destruct_unused<'tcx>(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>, body: &Body<'tcx>) -> bool {
// Avoid selecting for simple cases, such as builtin types.
@ -412,7 +412,7 @@ fn is_ty_const_destruct<'tcx>(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>, body: &Body<'tcx>
return true;
}
// FIXME(effects) constness
// FIXME(const_trait_impl) constness
let obligation = Obligation::new(
tcx,
ObligationCause::dummy_with_span(body.span),

View File

@ -104,7 +104,7 @@ fn main() {}
struct D;
/* FIXME(effects)
/* FIXME(const_trait_impl)
impl const Drop for D {
fn drop(&mut self) {
todo!();
@ -113,7 +113,7 @@ impl const Drop for D {
*/
// Lint this, since it can be dropped in const contexts
// FIXME(effects)
// FIXME(const_trait_impl)
const fn d(this: D) {}
//~^ ERROR: this could be a `const fn`

View File

@ -104,7 +104,7 @@ fn main() {}
struct D;
/* FIXME(effects)
/* FIXME(const_trait_impl)
impl const Drop for D {
fn drop(&mut self) {
todo!();
@ -113,7 +113,7 @@ impl const Drop for D {
*/
// Lint this, since it can be dropped in const contexts
// FIXME(effects)
// FIXME(const_trait_impl)
fn d(this: D) {}
//~^ ERROR: this could be a `const fn`

View File

@ -1,6 +1,6 @@
//@ known-bug: #112623
#![feature(const_trait_impl, effects)]
#![feature(const_trait_impl)]
#[const_trait]
trait Value {

View File

@ -1,5 +1,5 @@
//@ known-bug: #119701
#![feature(const_trait_impl, effects, generic_const_exprs)]
#![feature(const_trait_impl, generic_const_exprs)]
fn main() {
let _ = process::<()>([()]);

View File

@ -1,5 +1,5 @@
//@ known-bug: #121411
#![feature(const_trait_impl, effects)]
#![feature(const_trait_impl)]
#[const_trait]
trait Foo {

View File

@ -1,8 +1,7 @@
// Check that we don't render host effect parameters & arguments.
#![crate_name = "foo"]
#![feature(effects, const_trait_impl)]
#![allow(incomplete_features)]
#![feature(const_trait_impl)]
#[const_trait]
pub trait Tr {

View File

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

View File

@ -1,6 +1,5 @@
//@ compile-flags: -Znext-solver
#![feature(effects, const_trait_impl)]
#![allow(incomplete_features)]
#![feature(const_trait_impl)]
#[const_trait]
pub trait Resource {}

View File

@ -6,10 +6,9 @@
// stabilized when changing `@!has` to `@has`, and please do
// not remove this test.
//
// FIXME(effects) add `const_trait` to `Fn` so we use `~const`
// FIXME(effects) restore `const_trait` to `Destruct`
#![allow(incomplete_features)]
#![feature(const_trait_impl, effects)]
// FIXME(const_trait_impl) add `const_trait` to `Fn` so we use `~const`
// FIXME(const_trait_impl) restore `const_trait` to `Destruct`
#![feature(const_trait_impl)]
#![crate_name = "foo"]
use std::marker::Destruct;

View File

@ -1,8 +1,7 @@
//@ build-pass
//@ compile-flags: -Znext-solver
#![allow(incomplete_features)]
#![feature(const_trait_impl, effects)]
#![feature(const_trait_impl)]
#[const_trait]
trait Func<T> {

View File

@ -1,6 +1,6 @@
//@ known-bug: #110395
//@ compile-flags: -Znext-solver
#![feature(generic_const_exprs, adt_const_params, const_trait_impl, effects)]
#![feature(generic_const_exprs, adt_const_params, const_trait_impl)]
#![allow(incomplete_features)]
// test `N + N` unifies with explicit function calls for non-builtin-types

View File

@ -1,7 +1,7 @@
error: `-Znext-solver=globally` and `generic_const_exprs` are incompatible, using them at the same time is not allowed
--> $DIR/unify-op-with-fn-call.rs:3:12
|
LL | #![feature(generic_const_exprs, adt_const_params, const_trait_impl, effects)]
LL | #![feature(generic_const_exprs, adt_const_params, const_trait_impl)]
| ^^^^^^^^^^^^^^^^^^^
|
= help: remove one of these features

View File

@ -1,7 +1,7 @@
//@ known-bug: #110395
//@ compile-flags: -Znext-solver
#![allow(incomplete_features)]
#![feature(const_trait_impl, effects, generic_const_exprs)]
#![feature(const_trait_impl, generic_const_exprs)]
#[const_trait]
trait ConstName {

View File

@ -1,8 +1,8 @@
error: `-Znext-solver=globally` and `generic_const_exprs` are incompatible, using them at the same time is not allowed
--> $DIR/issue-88119.rs:4:39
--> $DIR/issue-88119.rs:4:30
|
LL | #![feature(const_trait_impl, effects, generic_const_exprs)]
| ^^^^^^^^^^^^^^^^^^^
LL | #![feature(const_trait_impl, generic_const_exprs)]
| ^^^^^^^^^^^^^^^^^^^
|
= help: remove one of these features

View File

@ -1,7 +1,6 @@
//@ compile-flags: -Znext-solver
#![crate_type = "lib"]
#![feature(const_closures, const_trait_impl, effects)]
#![allow(incomplete_features)]
#![feature(const_closures, const_trait_impl)]
pub const fn test() {
let cl = const || {};

View File

@ -1,8 +1,8 @@
// FIXME(effects) aux-build:closure-in-foreign-crate.rs
// FIXME(const_trait_impl) aux-build:closure-in-foreign-crate.rs
//@ build-pass
// FIXME(effects) extern crate closure_in_foreign_crate;
// FIXME(const_trait_impl) extern crate closure_in_foreign_crate;
// FIXME(effects) const _: () = closure_in_foreign_crate::test();
// FIXME(const_trait_impl) const _: () = closure_in_foreign_crate::test();
fn main() {}

View File

@ -4,9 +4,8 @@
#![crate_type = "lib"]
#![feature(try_trait_v2)]
#![feature(const_trait_impl, effects)]
#![feature(const_trait_impl)]
#![feature(const_try)]
#![allow(incomplete_features)]
use std::ops::{ControlFlow, FromResidual, Try};

View File

@ -1,5 +1,5 @@
error: const `impl` for trait `FromResidual` which is not marked with `#[const_trait]`
--> $DIR/const-try.rs:16:12
--> $DIR/const-try.rs:15:12
|
LL | impl const FromResidual<Error> for TryMe {
| ^^^^^^^^^^^^^^^^^^^
@ -8,7 +8,7 @@ LL | impl const FromResidual<Error> for TryMe {
= note: adding a non-const method body in the future would be a breaking change
error: const `impl` for trait `Try` which is not marked with `#[const_trait]`
--> $DIR/const-try.rs:23:12
--> $DIR/const-try.rs:22:12
|
LL | impl const Try for TryMe {
| ^^^
@ -17,7 +17,7 @@ LL | impl const Try for TryMe {
= note: adding a non-const method body in the future would be a breaking change
error[E0015]: `?` cannot determine the branch of `TryMe` in constant functions
--> $DIR/const-try.rs:36:5
--> $DIR/const-try.rs:35:5
|
LL | TryMe?;
| ^^^^^^
@ -25,7 +25,7 @@ LL | TryMe?;
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
error[E0015]: `?` cannot convert from residual of `TryMe` in constant functions
--> $DIR/const-try.rs:36:5
--> $DIR/const-try.rs:35:5
|
LL | TryMe?;
| ^^^^^^

View File

@ -1,6 +1,5 @@
//@ compile-flags: -Znext-solver
#![feature(const_type_id, const_trait_impl, effects)]
#![allow(incomplete_features)]
#![feature(const_type_id, const_trait_impl)]
use std::any::TypeId;
@ -13,6 +12,6 @@ fn main() {
let _a = TypeId::of::<u8>() < TypeId::of::<u16>();
//~^ ERROR cannot call non-const operator in constants
// can't assert `_a` because it is not deterministic
// FIXME(effects) make it pass
// FIXME(const_trait_impl) make it pass
}
}

View File

@ -1,5 +1,5 @@
error[E0015]: cannot call non-const operator in constants
--> $DIR/const_cmp_type_id.rs:9:17
--> $DIR/const_cmp_type_id.rs:8:17
|
LL | assert!(TypeId::of::<u8>() == TypeId::of::<u8>());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -9,7 +9,7 @@ note: impl defined here, but it is not `const`
= note: calls in constants are limited to constant functions, tuple structs and tuple variants
error[E0015]: cannot call non-const operator in constants
--> $DIR/const_cmp_type_id.rs:11:17
--> $DIR/const_cmp_type_id.rs:10:17
|
LL | assert!(TypeId::of::<()>() != TypeId::of::<u8>());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -19,7 +19,7 @@ note: impl defined here, but it is not `const`
= note: calls in constants are limited to constant functions, tuple structs and tuple variants
error[E0015]: cannot call non-const operator in constants
--> $DIR/const_cmp_type_id.rs:13:18
--> $DIR/const_cmp_type_id.rs:12:18
|
LL | let _a = TypeId::of::<u8>() < TypeId::of::<u16>();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

View File

@ -1,6 +1,6 @@
//@ known-bug: #102498
#![feature(const_trait_impl, effects, generic_const_exprs)]
#![feature(const_trait_impl, generic_const_exprs)]
#![allow(incomplete_features)]
#[const_trait]

View File

@ -2,8 +2,7 @@
//@ known-bug: #110395
#![crate_type = "lib"]
#![feature(staged_api, const_trait_impl, effects)]
#![allow(incomplete_features)]
#![feature(staged_api, const_trait_impl)]
#![stable(feature = "foo", since = "1.0.0")]
#[stable(feature = "potato", since = "1.27.0")]

View File

@ -1,5 +1,5 @@
error: const `impl` for trait `Default` which is not marked with `#[const_trait]`
--> $DIR/rustc-impl-const-stability.rs:16:12
--> $DIR/rustc-impl-const-stability.rs:15:12
|
LL | impl const Default for Data {
| ^^^^^^^

View File

@ -1,6 +1,5 @@
#![feature(const_trait_impl)]
#![feature(c_variadic)]
#![feature(effects)]
#![feature(fn_delegation)]
#![allow(incomplete_features)]

View File

@ -1,24 +1,24 @@
error[E0391]: cycle detected when computing type of `opaque::<impl at $DIR/unsupported.rs:26:5: 26:24>::{synthetic#0}`
--> $DIR/unsupported.rs:27:25
error[E0391]: cycle detected when computing type of `opaque::<impl at $DIR/unsupported.rs:25:5: 25:24>::{synthetic#0}`
--> $DIR/unsupported.rs:26:25
|
LL | reuse to_reuse::opaque_ret;
| ^^^^^^^^^^
|
note: ...which requires comparing an impl and trait method signature, inferring any hidden `impl Trait` types in the process...
--> $DIR/unsupported.rs:27:25
--> $DIR/unsupported.rs:26:25
|
LL | reuse to_reuse::opaque_ret;
| ^^^^^^^^^^
= note: ...which again requires computing type of `opaque::<impl at $DIR/unsupported.rs:26:5: 26:24>::{synthetic#0}`, completing the cycle
note: cycle used when checking that `opaque::<impl at $DIR/unsupported.rs:26:5: 26:24>` is well-formed
--> $DIR/unsupported.rs:26:5
= note: ...which again requires computing type of `opaque::<impl at $DIR/unsupported.rs:25:5: 25:24>::{synthetic#0}`, completing the cycle
note: cycle used when checking that `opaque::<impl at $DIR/unsupported.rs:25:5: 25:24>` is well-formed
--> $DIR/unsupported.rs:25:5
|
LL | impl ToReuse for u8 {
| ^^^^^^^^^^^^^^^^^^^
= note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
warning: this function depends on never type fallback being `()`
--> $DIR/unsupported.rs:14:9
--> $DIR/unsupported.rs:13:9
|
LL | pub fn opaque_ret() -> impl Trait { unimplemented!() }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -27,14 +27,14 @@ LL | pub fn opaque_ret() -> impl Trait { unimplemented!() }
= note: for more information, see issue #123748 <https://github.com/rust-lang/rust/issues/123748>
= help: specify the types explicitly
note: in edition 2024, the requirement `!: opaque::Trait` will fail
--> $DIR/unsupported.rs:14:32
--> $DIR/unsupported.rs:13:32
|
LL | pub fn opaque_ret() -> impl Trait { unimplemented!() }
| ^^^^^^^^^^
= note: `#[warn(dependency_on_unit_never_type_fallback)]` on by default
warning: this function depends on never type fallback being `()`
--> $DIR/unsupported.rs:20:9
--> $DIR/unsupported.rs:19:9
|
LL | fn opaque_ret() -> impl Trait { unimplemented!() }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -43,32 +43,32 @@ LL | fn opaque_ret() -> impl Trait { unimplemented!() }
= note: for more information, see issue #123748 <https://github.com/rust-lang/rust/issues/123748>
= help: specify the types explicitly
note: in edition 2024, the requirement `!: opaque::Trait` will fail
--> $DIR/unsupported.rs:20:28
--> $DIR/unsupported.rs:19:28
|
LL | fn opaque_ret() -> impl Trait { unimplemented!() }
| ^^^^^^^^^^
error[E0391]: cycle detected when computing type of `opaque::<impl at $DIR/unsupported.rs:29:5: 29:25>::{synthetic#0}`
--> $DIR/unsupported.rs:30:24
error[E0391]: cycle detected when computing type of `opaque::<impl at $DIR/unsupported.rs:28:5: 28:25>::{synthetic#0}`
--> $DIR/unsupported.rs:29:24
|
LL | reuse ToReuse::opaque_ret;
| ^^^^^^^^^^
|
note: ...which requires comparing an impl and trait method signature, inferring any hidden `impl Trait` types in the process...
--> $DIR/unsupported.rs:30:24
--> $DIR/unsupported.rs:29:24
|
LL | reuse ToReuse::opaque_ret;
| ^^^^^^^^^^
= note: ...which again requires computing type of `opaque::<impl at $DIR/unsupported.rs:29:5: 29:25>::{synthetic#0}`, completing the cycle
note: cycle used when checking that `opaque::<impl at $DIR/unsupported.rs:29:5: 29:25>` is well-formed
--> $DIR/unsupported.rs:29:5
= note: ...which again requires computing type of `opaque::<impl at $DIR/unsupported.rs:28:5: 28:25>::{synthetic#0}`, completing the cycle
note: cycle used when checking that `opaque::<impl at $DIR/unsupported.rs:28:5: 28:25>` is well-formed
--> $DIR/unsupported.rs:28:5
|
LL | impl ToReuse for u16 {
| ^^^^^^^^^^^^^^^^^^^^
= note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
error: recursive delegation is not supported yet
--> $DIR/unsupported.rs:43:22
--> $DIR/unsupported.rs:42:22
|
LL | pub reuse to_reuse2::foo;
| --- callee defined here
@ -77,7 +77,7 @@ LL | reuse to_reuse1::foo;
| ^^^
error[E0283]: type annotations needed
--> $DIR/unsupported.rs:53:18
--> $DIR/unsupported.rs:52:18
|
LL | reuse Trait::foo;
| ^^^ cannot infer type

View File

@ -1,6 +1,3 @@
#![feature(effects)]
//~^ WARN: the feature `effects` is incomplete
struct A();
impl const Drop for A {}

View File

@ -1,5 +1,5 @@
error[E0658]: const trait impls are experimental
--> $DIR/const_drop_is_valid.rs:6:6
--> $DIR/const_drop_is_valid.rs:3:6
|
LL | impl const Drop for A {}
| ^^^^^
@ -8,17 +8,8 @@ LL | impl const Drop for A {}
= help: add `#![feature(const_trait_impl)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
warning: the feature `effects` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/const_drop_is_valid.rs:1:12
|
LL | #![feature(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 `Drop` which is not marked with `#[const_trait]`
--> $DIR/const_drop_is_valid.rs:6:12
--> $DIR/const_drop_is_valid.rs:3:12
|
LL | impl const Drop for A {}
| ^^^^
@ -27,14 +18,14 @@ LL | impl const Drop for A {}
= note: adding a non-const method body in the future would be a breaking change
error[E0046]: not all trait items implemented, missing: `drop`
--> $DIR/const_drop_is_valid.rs:6:1
--> $DIR/const_drop_is_valid.rs:3:1
|
LL | impl const Drop for A {}
| ^^^^^^^^^^^^^^^^^^^^^ missing `drop` in implementation
|
= help: implement the missing item: `fn drop(&mut self) { todo!() }`
error: aborting due to 3 previous errors; 1 warning emitted
error: aborting due to 3 previous errors
Some errors have detailed explanations: E0046, E0658.
For more information about an error, try `rustc --explain E0046`.

View File

@ -2,7 +2,7 @@
//@ compile-flags: -Znext-solver
// Test that we can call methods from const trait impls inside of generic const items.
#![feature(generic_const_items, const_trait_impl, effects)]
#![feature(generic_const_items, const_trait_impl)]
#![allow(incomplete_features)]
#![crate_type = "lib"]

View File

@ -1,11 +1,5 @@
//@ revisions: stock effects
#![feature(intrinsics)]
#![feature(rustc_attrs)]
// as effects insert a const generic param to const intrinsics,
// check here that it doesn't report a const param mismatch either
// enabling or disabling effects.
#![cfg_attr(effects, feature(effects))]
#![allow(incomplete_features)]
extern "rust-intrinsic" {
fn size_of<T>() -> usize; //~ ERROR intrinsic safety mismatch
@ -24,7 +18,6 @@ const fn const_deallocate(_ptr: *mut u8, _size: usize, _align: usize) {}
mod foo {
#[rustc_intrinsic]
unsafe fn const_deallocate(_ptr: *mut u8, _size: usize, _align: usize) {}
// FIXME(effects) ~^ ERROR wrong number of const parameters
}
fn main() {}

View File

@ -1,11 +1,11 @@
error: intrinsic safety mismatch between list of intrinsics within the compiler and core library intrinsics for intrinsic `size_of`
--> $DIR/safe-intrinsic-mismatch.rs:11:5
--> $DIR/safe-intrinsic-mismatch.rs:5:5
|
LL | fn size_of<T>() -> usize;
| ^^^^^^^^^^^^^^^^^^^^^^^^^
error: intrinsic safety mismatch between list of intrinsics within the compiler and core library intrinsics for intrinsic `size_of`
--> $DIR/safe-intrinsic-mismatch.rs:11:5
--> $DIR/safe-intrinsic-mismatch.rs:5:5
|
LL | fn size_of<T>() -> usize;
| ^^^^^^^^^^^^^^^^^^^^^^^^^
@ -13,13 +13,13 @@ LL | fn size_of<T>() -> usize;
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: intrinsic safety mismatch between list of intrinsics within the compiler and core library intrinsics for intrinsic `assume`
--> $DIR/safe-intrinsic-mismatch.rs:16:1
--> $DIR/safe-intrinsic-mismatch.rs:10:1
|
LL | const fn assume(_b: bool) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0308]: intrinsic has wrong type
--> $DIR/safe-intrinsic-mismatch.rs:16:16
--> $DIR/safe-intrinsic-mismatch.rs:10:16
|
LL | const fn assume(_b: bool) {}
| ^ expected unsafe fn, found safe fn
@ -28,13 +28,13 @@ LL | const fn assume(_b: bool) {}
found signature `fn(_)`
error: intrinsic safety mismatch between list of intrinsics within the compiler and core library intrinsics for intrinsic `const_deallocate`
--> $DIR/safe-intrinsic-mismatch.rs:20:1
--> $DIR/safe-intrinsic-mismatch.rs:14:1
|
LL | const fn const_deallocate(_ptr: *mut u8, _size: usize, _align: usize) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0308]: intrinsic has wrong type
--> $DIR/safe-intrinsic-mismatch.rs:20:26
--> $DIR/safe-intrinsic-mismatch.rs:14:26
|
LL | const fn const_deallocate(_ptr: *mut u8, _size: usize, _align: usize) {}
| ^ expected unsafe fn, found safe fn

View File

@ -1,47 +0,0 @@
error: intrinsic safety mismatch between list of intrinsics within the compiler and core library intrinsics for intrinsic `size_of`
--> $DIR/safe-intrinsic-mismatch.rs:11:5
|
LL | fn size_of<T>() -> usize;
| ^^^^^^^^^^^^^^^^^^^^^^^^^
error: intrinsic safety mismatch between list of intrinsics within the compiler and core library intrinsics for intrinsic `size_of`
--> $DIR/safe-intrinsic-mismatch.rs:11:5
|
LL | fn size_of<T>() -> usize;
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: intrinsic safety mismatch between list of intrinsics within the compiler and core library intrinsics for intrinsic `assume`
--> $DIR/safe-intrinsic-mismatch.rs:16:1
|
LL | const fn assume(_b: bool) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0308]: intrinsic has wrong type
--> $DIR/safe-intrinsic-mismatch.rs:16:16
|
LL | const fn assume(_b: bool) {}
| ^ expected unsafe fn, found safe fn
|
= note: expected signature `unsafe fn(_)`
found signature `fn(_)`
error: intrinsic safety mismatch between list of intrinsics within the compiler and core library intrinsics for intrinsic `const_deallocate`
--> $DIR/safe-intrinsic-mismatch.rs:20:1
|
LL | const fn const_deallocate(_ptr: *mut u8, _size: usize, _align: usize) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0308]: intrinsic has wrong type
--> $DIR/safe-intrinsic-mismatch.rs:20:26
|
LL | const fn const_deallocate(_ptr: *mut u8, _size: usize, _align: usize) {}
| ^ expected unsafe fn, found safe fn
|
= note: expected signature `unsafe fn(_, _, _)`
found signature `fn(_, _, _)`
error: aborting due to 6 previous errors
For more information about this error, try `rustc --explain E0308`.

View File

@ -2,8 +2,7 @@
//@ check-pass
//@ compile-flags: -Znext-solver
#![allow(incomplete_features)]
#![feature(const_trait_impl, effects)]
#![feature(const_trait_impl)]
#[const_trait]
trait Trait {

View File

@ -40,54 +40,5 @@ LL | impl<T: ~const Default + ~const Sub> const A for T {
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0015]: cannot call non-const fn `<() as A>::a` in constants
--> $DIR/const_trait_impl.rs:52:23
|
LL | const _: () = assert!(<()>::a() == 42);
| ^^^^^^^^^
|
= note: calls in constants are limited to constant functions, tuple structs and tuple variants
help: add `#![feature(effects)]` to the crate attributes to enable
|
LL + #![feature(effects)]
|
error: aborting due to 6 previous errors
error[E0015]: cannot call non-const fn `<u8 as A>::a` in constants
--> $DIR/const_trait_impl.rs:53:23
|
LL | const _: () = assert!(<u8>::a() == 3);
| ^^^^^^^^^
|
= note: calls in constants are limited to constant functions, tuple structs and tuple variants
help: add `#![feature(effects)]` to the crate attributes to enable
|
LL + #![feature(effects)]
|
error[E0015]: cannot call non-const fn `<u16 as A>::a` in constants
--> $DIR/const_trait_impl.rs:54:23
|
LL | const _: () = assert!(<u16>::a() == 2);
| ^^^^^^^^^^
|
= note: calls in constants are limited to constant functions, tuple structs and tuple variants
help: add `#![feature(effects)]` to the crate attributes to enable
|
LL + #![feature(effects)]
|
error[E0015]: cannot call non-const fn `<T as Sup>::foo` in constant functions
--> $DIR/const_trait_impl.rs:48:9
|
LL | T::foo()
| ^^^^^^^^
|
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
help: add `#![feature(effects)]` to the crate attributes to enable
|
LL + #![feature(effects)]
|
error: aborting due to 10 previous errors
For more information about this error, try `rustc --explain E0015`.

View File

@ -1,6 +1,6 @@
//@ compile-flags: -Znext-solver
#![feature(staged_api)]
#![feature(const_trait_impl, effects, rustc_attrs, intrinsics)] //~ WARN the feature `effects` is incomplete
#![feature(const_trait_impl, rustc_attrs, intrinsics)]
#![stable(feature = "stable", since = "1.0.0")]
#[stable(feature = "stable", since = "1.0.0")]

View File

@ -1,12 +1,3 @@
warning: the feature `effects` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/missing-const-stability.rs:3:30
|
LL | #![feature(const_trait_impl, effects, rustc_attrs, intrinsics)]
| ^^^^^^^
|
= note: see issue #102090 <https://github.com/rust-lang/rust/issues/102090> for more information
= note: `#[warn(incomplete_features)]` on by default
error: function has missing const stability attribute
--> $DIR/missing-const-stability.rs:7:1
|
@ -34,5 +25,5 @@ error: associated function has missing const stability attribute
LL | pub const fn foo() {}
| ^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 4 previous errors; 1 warning emitted
error: aborting due to 4 previous errors

View File

@ -1,8 +1,7 @@
//@ compile-flags: -Znext-solver
//@ check-pass
#![allow(incomplete_features)]
#![feature(const_trait_impl, effects)]
#![feature(const_trait_impl)]
#[const_trait]
trait Trait {

View File

@ -1,7 +1,7 @@
//@ compile-flags: -Znext-solver
//@ known-bug: unknown
#![feature(const_trait_impl, effects, generic_const_exprs)]
#![feature(const_trait_impl, generic_const_exprs)]
#![allow(incomplete_features)]
#[const_trait]

View File

@ -1,8 +1,8 @@
error: `-Znext-solver=globally` and `generic_const_exprs` are incompatible, using them at the same time is not allowed
--> $DIR/assoc-type-const-bound-usage-1.rs:4:39
--> $DIR/assoc-type-const-bound-usage-1.rs:4:30
|
LL | #![feature(const_trait_impl, effects, generic_const_exprs)]
| ^^^^^^^^^^^^^^^^^^^
LL | #![feature(const_trait_impl, generic_const_exprs)]
| ^^^^^^^^^^^^^^^^^^^
|
= help: remove one of these features

View File

@ -5,8 +5,7 @@
// i.e. check that we validate the const conditions for the associated type
// when considering one of implied const bounds.
#![allow(incomplete_features)]
#![feature(const_trait_impl, effects)]
#![feature(const_trait_impl)]
#[const_trait]
trait Trait {

View File

@ -1,11 +1,11 @@
error[E0277]: the trait bound `<T as Trait>::Assoc<U>: ~const Trait` is not satisfied
--> $DIR/assoc-type-const-bound-usage-fail-2.rs:24:5
--> $DIR/assoc-type-const-bound-usage-fail-2.rs:23:5
|
LL | T::Assoc::<U>::func();
| ^^^^^^^^^^^^^^^^^^^^^
error[E0277]: the trait bound `<T as Trait>::Assoc<U>: ~const Trait` is not satisfied
--> $DIR/assoc-type-const-bound-usage-fail-2.rs:26:5
--> $DIR/assoc-type-const-bound-usage-fail-2.rs:25:5
|
LL | <T as Trait>::Assoc::<U>::func();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

View File

@ -4,8 +4,7 @@
// i.e. check that we validate the const conditions for the associated type
// when considering one of implied const bounds.
#![allow(incomplete_features)]
#![feature(const_trait_impl, effects)]
#![feature(const_trait_impl)]
#[const_trait]
trait Trait {

View File

@ -1,11 +1,11 @@
error[E0277]: the trait bound `T: ~const Trait` is not satisfied
--> $DIR/assoc-type-const-bound-usage-fail.rs:17:5
--> $DIR/assoc-type-const-bound-usage-fail.rs:16:5
|
LL | T::Assoc::func();
| ^^^^^^^^^^^^^^^^
error[E0277]: the trait bound `T: ~const Trait` is not satisfied
--> $DIR/assoc-type-const-bound-usage-fail.rs:19:5
--> $DIR/assoc-type-const-bound-usage-fail.rs:18:5
|
LL | <T as Trait>::Assoc::func();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^

View File

@ -1,6 +1,6 @@
//@ compile-flags: -Znext-solver
#![feature(const_trait_impl, effects)] //~ WARN the feature `effects` is incomplete
#![feature(const_trait_impl)]
#[const_trait]
trait Add<Rhs = Self> {

View File

@ -1,12 +1,3 @@
warning: the feature `effects` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/assoc-type.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[E0277]: the trait bound `NonConstAdd: ~const Add` is not satisfied
--> $DIR/assoc-type.rs:36:16
|
@ -19,6 +10,6 @@ note: required by a bound in `Foo::Bar`
LL | type Bar: ~const Add;
| ^^^^^^ required by this bound in `Foo::Bar`
error: aborting due to 1 previous error; 1 warning emitted
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0277`.

View File

@ -1,6 +1,5 @@
//@ compile-flags: -Znext-solver
#![allow(incomplete_features)]
#![feature(const_trait_impl, effects)]
#![feature(const_trait_impl)]
#[const_trait]
pub trait MyTrait {

View File

@ -1,6 +1,5 @@
//@ compile-flags: -Znext-solver
#![allow(incomplete_features)]
#![feature(const_trait_impl, effects)]
#![feature(const_trait_impl)]
#![feature(staged_api)]
#![stable(feature = "rust1", since = "1.0.0")]

View File

@ -1,7 +1,7 @@
//@ compile-flags: -Znext-solver
//@ edition:2021
#![feature(const_trait_impl, effects, const_closures)]
#![feature(const_trait_impl, const_closures)]
#![allow(incomplete_features)]
#[const_trait]
@ -16,7 +16,7 @@ impl Bar for () {
const FOO: () = {
(const || ().foo())();
//~^ ERROR the trait bound `(): ~const Bar` is not satisfied
// FIXME(effects): The constness environment for const closures is wrong.
// FIXME(const_trait_impl): The constness environment for const closures is wrong.
};
fn main() {}

View File

@ -1,6 +1,5 @@
//@ compile-flags: -Znext-solver
#![feature(const_trait_impl, effects)]
//~^ WARN the feature `effects` is incomplete
#![feature(const_trait_impl)]
#[const_trait] trait Foo {
fn foo();

View File

@ -1,18 +1,9 @@
warning: the feature `effects` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/call-const-in-tilde-const.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 `T: const Foo` is not satisfied
--> $DIR/call-const-in-tilde-const.rs:10:13
--> $DIR/call-const-in-tilde-const.rs:9:13
|
LL | const { T::foo() }
| ^^^^^^^^
error: aborting due to 1 previous error; 1 warning emitted
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0277`.

View File

@ -1,6 +1,5 @@
//@ compile-flags: -Znext-solver
#![allow(incomplete_features)]
#![feature(const_trait_impl, effects)]
#![feature(const_trait_impl)]
#[const_trait]
pub trait Plus {

View File

@ -1,5 +1,5 @@
error[E0277]: the trait bound `u32: ~const Plus` is not satisfied
--> $DIR/call-const-trait-method-fail.rs:27:5
--> $DIR/call-const-trait-method-fail.rs:26:5
|
LL | a.plus(b)
| ^^^^^^^^^

View File

@ -24,18 +24,6 @@ LL | const ADD_INT: Int = Int(1i32) + Int(2i32);
|
= note: calls in constants are limited to constant functions, tuple structs and tuple variants
error[E0015]: cannot call non-const fn `<i32 as Plus>::plus` in constant functions
--> $DIR/call-const-trait-method-pass.rs:11:20
|
LL | Int(self.0.plus(rhs.0))
| ^^^^^^^^^^^
|
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
help: add `#![feature(effects)]` to the crate attributes to enable
|
LL + #![feature(effects)]
|
error[E0015]: cannot call non-const fn `<Int as PartialEq>::eq` in constant functions
--> $DIR/call-const-trait-method-pass.rs:20:15
|
@ -44,18 +32,6 @@ LL | !self.eq(other)
|
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
error[E0015]: cannot call non-const fn `<i32 as Plus>::plus` in constant functions
--> $DIR/call-const-trait-method-pass.rs:36:7
|
LL | a.plus(b)
| ^^^^^^^
|
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
help: add `#![feature(effects)]` to the crate attributes to enable
|
LL + #![feature(effects)]
|
error: aborting due to 6 previous errors
error: aborting due to 4 previous errors
For more information about this error, try `rustc --explain E0015`.

View File

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

View File

@ -2,9 +2,9 @@
//@ known-bug: #110395
//@ compile-flags: -Znext-solver
// FIXME(effects) check-pass
// FIXME(const_trait_impl) check-pass
#![feature(const_trait_impl, effects)]
#![feature(const_trait_impl)]
struct S;

View File

@ -1,12 +1,3 @@
warning: the feature `effects` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/call-generic-method-chain.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/call-generic-method-chain.rs:11:12
|
@ -64,6 +55,6 @@ LL | !self.eq(other)
|
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
error: aborting due to 7 previous errors; 1 warning emitted
error: aborting due to 7 previous errors
For more information about this error, try `rustc --explain E0015`.

View File

@ -1,8 +1,8 @@
//@ compile-flags: -Znext-solver
//@ known-bug: #110395
// FIXME(effects) check-pass
// FIXME(const_trait_impl) check-pass
#![feature(const_trait_impl, effects)]
#![feature(const_trait_impl)]
struct S;

View File

@ -1,12 +1,3 @@
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: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/call-generic-method-dup-bound.rs:9:12
|
@ -76,6 +67,6 @@ help: consider further restricting this bound
LL | const fn equals_self2<T: A + ~const PartialEq + ~const std::cmp::PartialEq>(t: &T) -> bool {
| ++++++++++++++++++++++++++++
error: aborting due to 8 previous errors; 1 warning emitted
error: aborting due to 8 previous errors
For more information about this error, try `rustc --explain E0015`.

View File

@ -1,6 +1,5 @@
//@ compile-flags: -Znext-solver
#![allow(incomplete_features)]
#![feature(const_trait_impl, effects)]
#![feature(const_trait_impl)]
pub const fn equals_self<T: PartialEq>(t: &T) -> bool {
*t == *t

View File

@ -1,5 +1,5 @@
error[E0015]: cannot call non-const operator in constant functions
--> $DIR/call-generic-method-fail.rs:6:5
--> $DIR/call-generic-method-fail.rs:5:5
|
LL | *t == *t
| ^^^^^^^^

View File

@ -1,6 +1,5 @@
//@ compile-flags: -Znext-solver
#![allow(incomplete_features)]
#![feature(const_trait_impl, effects)]
#![feature(const_trait_impl)]
struct S;

View File

@ -1,5 +1,5 @@
error[E0277]: the trait bound `S: const Foo` is not satisfied
--> $DIR/call-generic-method-nonconst.rs:25:22
--> $DIR/call-generic-method-nonconst.rs:24:22
|
LL | pub const EQ: bool = equals_self(&S);
| ^^^^^^^^^^^^^^^

View File

@ -2,9 +2,9 @@
//@ compile-flags: -Znext-solver
//@ known-bug: #110395
// FIXME(effects) check-pass
// FIXME(const_trait_impl) check-pass
#![feature(const_trait_impl, effects)]
#![feature(const_trait_impl)]
struct S;

View File

@ -1,12 +1,3 @@
warning: the feature `effects` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/call-generic-method-pass.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/call-generic-method-pass.rs:11:12
|
@ -50,6 +41,6 @@ LL | !self.eq(other)
|
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
error: aborting due to 5 previous errors; 1 warning emitted
error: aborting due to 5 previous errors
For more information about this error, try `rustc --explain E0015`.

View File

@ -1,6 +1,6 @@
// FIXME(effects) check-pass
// FIXME(const_trait_impl) check-pass
//@ compile-flags: -Znext-solver
#![feature(const_closures, const_trait_impl, effects)]
#![feature(const_closures, const_trait_impl)]
#![allow(incomplete_features)]
pub const _: () = {

View File

@ -1,8 +1,7 @@
//@ compile-flags: -Znext-solver
//@ check-pass
#![feature(const_trait_impl, effects)]
//~^ WARN the feature `effects` is incomplete
#![feature(const_trait_impl)]
#[const_trait] trait Foo {
fn foo();

View File

@ -1,11 +0,0 @@
warning: the feature `effects` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/const-bound-in-host.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,7 +1,6 @@
//@ compile-flags: -Znext-solver
#![allow(incomplete_features)]
#![feature(const_trait_impl, effects)]
#![feature(const_trait_impl)]
#[const_trait]
trait MyTrait {

View File

@ -1,23 +1,23 @@
error: `~const` is not allowed here
--> $DIR/const-bound-on-not-const-associated-fn.rs:12:40
--> $DIR/const-bound-on-not-const-associated-fn.rs:11:40
|
LL | fn do_something_else() where Self: ~const MyTrait;
| ^^^^^^
|
note: this function is not `const`, so it cannot have `~const` trait bounds
--> $DIR/const-bound-on-not-const-associated-fn.rs:12:8
--> $DIR/const-bound-on-not-const-associated-fn.rs:11:8
|
LL | fn do_something_else() where Self: ~const MyTrait;
| ^^^^^^^^^^^^^^^^^
error: `~const` is not allowed here
--> $DIR/const-bound-on-not-const-associated-fn.rs:23:32
--> $DIR/const-bound-on-not-const-associated-fn.rs:22:32
|
LL | pub fn foo(&self) where T: ~const MyTrait {
| ^^^^^^
|
note: this function is not `const`, so it cannot have `~const` trait bounds
--> $DIR/const-bound-on-not-const-associated-fn.rs:23:12
--> $DIR/const-bound-on-not-const-associated-fn.rs:22:12
|
LL | pub fn foo(&self) where T: ~const MyTrait {
| ^^^

View File

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

View File

@ -1,12 +1,3 @@
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
--> $DIR/const-bounds-non-const-trait.rs:6:21
|
@ -27,5 +18,5 @@ error: `const` can only be applied to `#[const_trait]` traits
LL | fn operate<T: const NonConst>() {}
| ^^^^^
error: aborting due to 3 previous errors; 1 warning emitted
error: aborting due to 3 previous errors

View File

@ -1,6 +1,6 @@
//@ compile-flags: -Znext-solver
#![feature(const_trait_impl, effects)] //~ WARN the feature `effects` is incomplete
#![feature(const_trait_impl)]
struct S;
#[const_trait]

View File

@ -1,12 +1,3 @@
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: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[E0015]: cannot call non-const fn `non_const` in constant functions
--> $DIR/const-check-fns-in-const-impl.rs:14:16
|
@ -15,6 +6,6 @@ LL | fn foo() { non_const() }
|
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
error: aborting due to 1 previous error; 1 warning emitted
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0015`.

View File

@ -1,6 +1,5 @@
//@ compile-flags: -Znext-solver
#![allow(incomplete_features)]
#![feature(const_trait_impl, effects)]
#![feature(const_trait_impl)]
#[const_trait]
trait ConstDefaultFn: Sized {

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