temporarily disable effects on specialization tests

This commit is contained in:
Deadbeef 2024-06-25 07:52:44 +00:00
parent 3637b153f7
commit 74e7b5bd76
8 changed files with 43 additions and 50 deletions

View File

@ -879,6 +879,7 @@ pub(super) fn check_specialization_validity<'tcx>(
let result = opt_result.unwrap_or(Ok(())); let result = opt_result.unwrap_or(Ok(()));
if let Err(parent_impl) = result { if let Err(parent_impl) = result {
// FIXME(effects) the associated type from effects could be specialized
if !tcx.is_impl_trait_in_trait(impl_item) && !tcx.is_effects_desugared_assoc_ty(impl_item) { if !tcx.is_impl_trait_in_trait(impl_item) && !tcx.is_effects_desugared_assoc_ty(impl_item) {
report_forbidden_specialization(tcx, impl_item, parent_impl); report_forbidden_specialization(tcx, impl_item, parent_impl);
} else { } else {

View File

@ -179,6 +179,11 @@ fn associated_item_from_impl_item_ref(impl_item_ref: &hir::ImplItemRef) -> ty::A
/// If `def_id` is an impl, then synthesize the associated type according /// If `def_id` is an impl, then synthesize the associated type according
/// to the constness of the impl. /// to the constness of the impl.
fn associated_type_for_effects(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Option<DefId> { fn associated_type_for_effects(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Option<DefId> {
// don't synthesize the associated type even if the user has written `const_trait`
// if the effects feature is disabled.
if !tcx.features().effects {
return None;
}
match tcx.def_kind(def_id) { match tcx.def_kind(def_id) {
DefKind::Trait => { DefKind::Trait => {
let trait_def_id = def_id; let trait_def_id = def_id;
@ -309,7 +314,7 @@ fn associated_type_for_effects(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Option<De
} }
}); });
impl_assoc_ty.explicit_item_bounds(ty::EarlyBinder::bind(&[])); // impl_assoc_ty.explicit_item_bounds(ty::EarlyBinder::bind(&[]));
impl_assoc_ty.explicit_item_super_predicates(ty::EarlyBinder::bind(&[])); impl_assoc_ty.explicit_item_super_predicates(ty::EarlyBinder::bind(&[]));
// There are no inferred outlives for the synthesized associated type. // There are no inferred outlives for the synthesized associated type.

View File

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

View File

@ -1,11 +1,11 @@
error: const trait bounds are not allowed in trait object types error: const trait bounds are not allowed in trait object types
--> $DIR/const-trait-bounds-trait-objects.rs:8:17 --> $DIR/const-trait-bounds-trait-objects.rs:9:17
| |
LL | let _: &dyn const Trait; LL | let _: &dyn const Trait;
| ^^^^^^^^^^^ | ^^^^^^^^^^^
error: `~const` is not allowed here error: `~const` is not allowed here
--> $DIR/const-trait-bounds-trait-objects.rs:9:17 --> $DIR/const-trait-bounds-trait-objects.rs:10:17
| |
LL | let _: &dyn ~const Trait; LL | let _: &dyn ~const Trait;
| ^^^^^^ | ^^^^^^
@ -13,27 +13,18 @@ LL | let _: &dyn ~const Trait;
= note: trait objects cannot have `~const` trait bounds = note: trait objects cannot have `~const` trait bounds
error: const trait bounds are not allowed in trait object types error: const trait bounds are not allowed in trait object types
--> $DIR/const-trait-bounds-trait-objects.rs:14:25 --> $DIR/const-trait-bounds-trait-objects.rs:15:25
| |
LL | const fn handle(_: &dyn const NonConst) {} LL | const fn handle(_: &dyn const NonConst) {}
| ^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^
error: `~const` is not allowed here error: `~const` is not allowed here
--> $DIR/const-trait-bounds-trait-objects.rs:16:23 --> $DIR/const-trait-bounds-trait-objects.rs:17:23
| |
LL | const fn take(_: &dyn ~const NonConst) {} LL | const fn take(_: &dyn ~const NonConst) {}
| ^^^^^^ | ^^^^^^
| |
= note: trait objects cannot have `~const` trait bounds = note: trait objects cannot have `~const` trait bounds
warning: the feature `effects` is incomplete and may not be safe to use and/or cause compiler crashes error: aborting due to 4 previous errors
--> $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,4 +1,4 @@
#![feature(const_trait_impl, effects, min_specialization, rustc_attrs)] #![feature(const_trait_impl, min_specialization, rustc_attrs)]
//@ known-bug: #110395 //@ known-bug: #110395
#[rustc_specialization_trait] #[rustc_specialization_trait]
#[const_trait] #[const_trait]

View File

@ -1,31 +1,36 @@
warning: the feature `effects` is incomplete and may not be safe to use and/or cause compiler crashes error[E0049]: method `a` has 1 const parameter but its trait declaration has 0 const parameters
--> $DIR/specializing-constness-2.rs:1:30 --> $DIR/specializing-constness-2.rs:9:1
| |
LL | #![feature(const_trait_impl, effects, min_specialization, rustc_attrs)] LL | #[const_trait]
| ^^^^^^^ | ^^^^^^^^^^^^^^ found 1 const parameter
| LL | pub trait A {
= note: see issue #102090 <https://github.com/rust-lang/rust/issues/102090> for more information LL | fn a() -> u32;
= note: `#[warn(incomplete_features)]` on by default | - expected 0 const parameters
error[E0119]: conflicting implementations of trait `A` error[E0049]: method `a` has 1 const parameter but its trait declaration has 0 const parameters
--> $DIR/specializing-constness-2.rs:20:1 --> $DIR/specializing-constness-2.rs:9:1
| |
LL | impl<T: Default> A for T { LL | #[const_trait]
| ------------------------ first implementation here | ^^^^^^^^^^^^^^ found 1 const parameter
... LL | pub trait A {
LL | impl<T: Default + ~const Sup> const A for T { LL | fn a() -> u32;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation | - expected 0 const parameters
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0308]: mismatched types error[E0015]: cannot call non-const fn `<T as A>::a` in constant functions
--> $DIR/specializing-constness-2.rs:27:5 --> $DIR/specializing-constness-2.rs:27:5
| |
LL | <T as A>::a(); LL | <T as A>::a();
| ^^^^^^^^^^^^^ expected `host`, found `true` | ^^^^^^^^^^^^^
|
= 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)]
| |
= note: expected constant `host`
found constant `true`
error: aborting due to 2 previous errors; 1 warning emitted error: aborting due to 3 previous errors
Some errors have detailed explanations: E0119, E0308. Some errors have detailed explanations: E0015, E0049.
For more information about an error, try `rustc --explain E0119`. For more information about an error, try `rustc --explain E0015`.

View File

@ -1,7 +1,8 @@
//@ run-pass //@ run-pass
//@ compile-flags: -Znext-solver //@ compile-flags: -Znext-solver
#![feature(const_trait_impl, effects)] //~ WARN the feature `effects` is incomplete #![feature(const_trait_impl, effects)]
#![allow(incomplete_features)]
#[const_trait] #[const_trait]
trait Bar { trait Bar {

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/trait-where-clause-run.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