temporarily disable effects on specialization tests
This commit is contained in:
parent
3637b153f7
commit
74e7b5bd76
@ -879,6 +879,7 @@ pub(super) fn check_specialization_validity<'tcx>(
|
||||
let result = opt_result.unwrap_or(Ok(()));
|
||||
|
||||
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) {
|
||||
report_forbidden_specialization(tcx, impl_item, parent_impl);
|
||||
} else {
|
||||
|
@ -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
|
||||
/// to the constness of the impl.
|
||||
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) {
|
||||
DefKind::Trait => {
|
||||
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(&[]));
|
||||
|
||||
// There are no inferred outlives for the synthesized associated type.
|
||||
|
@ -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
|
||||
|
||||
#[const_trait]
|
||||
|
@ -1,11 +1,11 @@
|
||||
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;
|
||||
| ^^^^^^^^^^^
|
||||
|
||||
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;
|
||||
| ^^^^^^
|
||||
@ -13,27 +13,18 @@ LL | let _: &dyn ~const Trait;
|
||||
= note: trait objects cannot have `~const` trait bounds
|
||||
|
||||
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) {}
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
||||
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) {}
|
||||
| ^^^^^^
|
||||
|
|
||||
= 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
|
||||
--> $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
|
||||
error: aborting due to 4 previous errors
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#![feature(const_trait_impl, effects, min_specialization, rustc_attrs)]
|
||||
#![feature(const_trait_impl, min_specialization, rustc_attrs)]
|
||||
//@ known-bug: #110395
|
||||
#[rustc_specialization_trait]
|
||||
#[const_trait]
|
||||
|
@ -1,31 +1,36 @@
|
||||
warning: the feature `effects` is incomplete and may not be safe to use and/or cause compiler crashes
|
||||
--> $DIR/specializing-constness-2.rs:1:30
|
||||
error[E0049]: method `a` has 1 const parameter but its trait declaration has 0 const parameters
|
||||
--> $DIR/specializing-constness-2.rs:9:1
|
||||
|
|
||||
LL | #![feature(const_trait_impl, effects, min_specialization, rustc_attrs)]
|
||||
| ^^^^^^^
|
||||
|
|
||||
= note: see issue #102090 <https://github.com/rust-lang/rust/issues/102090> for more information
|
||||
= note: `#[warn(incomplete_features)]` on by default
|
||||
LL | #[const_trait]
|
||||
| ^^^^^^^^^^^^^^ found 1 const parameter
|
||||
LL | pub trait A {
|
||||
LL | fn a() -> u32;
|
||||
| - expected 0 const parameters
|
||||
|
||||
error[E0119]: conflicting implementations of trait `A`
|
||||
--> $DIR/specializing-constness-2.rs:20:1
|
||||
error[E0049]: method `a` has 1 const parameter but its trait declaration has 0 const parameters
|
||||
--> $DIR/specializing-constness-2.rs:9:1
|
||||
|
|
||||
LL | impl<T: Default> A for T {
|
||||
| ------------------------ first implementation here
|
||||
...
|
||||
LL | impl<T: Default + ~const Sup> const A for T {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation
|
||||
LL | #[const_trait]
|
||||
| ^^^^^^^^^^^^^^ found 1 const parameter
|
||||
LL | pub trait A {
|
||||
LL | fn a() -> u32;
|
||||
| - 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
|
||||
|
|
||||
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.
|
||||
For more information about an error, try `rustc --explain E0119`.
|
||||
Some errors have detailed explanations: E0015, E0049.
|
||||
For more information about an error, try `rustc --explain E0015`.
|
||||
|
@ -1,7 +1,8 @@
|
||||
//@ run-pass
|
||||
//@ 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]
|
||||
trait Bar {
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user