about summary refs log tree commit diff
diff options
context:
space:
mode:
authorDeadbeef <ent3rm4n@gmail.com>2024-06-25 07:52:44 +0000
committerDeadbeef <ent3rm4n@gmail.com>2024-06-28 10:57:35 +0000
commit74e7b5bd762ac9be7d84689271324826d2056a7f (patch)
tree388f8f9001f6c47e5161547e5e6b4ef4173ec3cb
parent3637b153f7cb8de14588ea82a15a28499bcb3b3f (diff)
downloadrust-74e7b5bd762ac9be7d84689271324826d2056a7f.tar.gz
rust-74e7b5bd762ac9be7d84689271324826d2056a7f.zip
temporarily disable effects on specialization tests
-rw-r--r--compiler/rustc_hir_analysis/src/check/check.rs1
-rw-r--r--compiler/rustc_ty_utils/src/assoc.rs7
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/const-trait-bounds-trait-objects.rs3
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/const-trait-bounds-trait-objects.stderr19
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/specializing-constness-2.rs2
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/specializing-constness-2.stderr47
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/trait-where-clause-run.rs3
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/trait-where-clause-run.stderr11
8 files changed, 43 insertions, 50 deletions
diff --git a/compiler/rustc_hir_analysis/src/check/check.rs b/compiler/rustc_hir_analysis/src/check/check.rs
index e1813029778..f93777eda52 100644
--- a/compiler/rustc_hir_analysis/src/check/check.rs
+++ b/compiler/rustc_hir_analysis/src/check/check.rs
@@ -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 {
diff --git a/compiler/rustc_ty_utils/src/assoc.rs b/compiler/rustc_ty_utils/src/assoc.rs
index df6c54ab289..681f089e84f 100644
--- a/compiler/rustc_ty_utils/src/assoc.rs
+++ b/compiler/rustc_ty_utils/src/assoc.rs
@@ -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.
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/const-trait-bounds-trait-objects.rs b/tests/ui/rfcs/rfc-2632-const-trait-impl/const-trait-bounds-trait-objects.rs
index 8e71fa4d519..691bce19dc2 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/const-trait-bounds-trait-objects.rs
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/const-trait-bounds-trait-objects.rs
@@ -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]
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/const-trait-bounds-trait-objects.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/const-trait-bounds-trait-objects.stderr
index 7d774bef0e9..bd29b4b860b 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/const-trait-bounds-trait-objects.stderr
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/const-trait-bounds-trait-objects.stderr
@@ -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
 
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/specializing-constness-2.rs b/tests/ui/rfcs/rfc-2632-const-trait-impl/specializing-constness-2.rs
index 5218ea92566..c1fe42b9751 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/specializing-constness-2.rs
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/specializing-constness-2.rs
@@ -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]
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/specializing-constness-2.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/specializing-constness-2.stderr
index 7404b6a8b11..d082cd6de60 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/specializing-constness-2.stderr
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/specializing-constness-2.stderr
@@ -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 | #[const_trait]
+   | ^^^^^^^^^^^^^^ found 1 const parameter
+LL | pub trait A {
+LL |     fn a() -> u32;
+   |         - expected 0 const parameters
    |
-LL | impl<T: Default> A for T {
-   | ------------------------ first implementation here
-...
-LL | impl<T: Default + ~const Sup> const A for T {
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation
+   = 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`.
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/trait-where-clause-run.rs b/tests/ui/rfcs/rfc-2632-const-trait-impl/trait-where-clause-run.rs
index ddb26505202..2837c835429 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/trait-where-clause-run.rs
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/trait-where-clause-run.rs
@@ -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 {
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/trait-where-clause-run.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/trait-where-clause-run.stderr
deleted file mode 100644
index aef4f569d5e..00000000000
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/trait-where-clause-run.stderr
+++ /dev/null
@@ -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
-