about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--compiler/rustc_const_eval/src/check_consts/check.rs12
-rw-r--r--compiler/rustc_hir_typeck/src/callee.rs2
-rw-r--r--tests/ui/specialization/const_trait_impl.stderr51
-rw-r--r--tests/ui/traits/const-traits/call-const-trait-method-pass.stderr26
-rw-r--r--tests/ui/traits/const-traits/const-drop-fail-2.stderr30
-rw-r--r--tests/ui/traits/const-traits/const-drop.precise.stderr18
-rw-r--r--tests/ui/traits/const-traits/const-drop.stock.stderr18
-rw-r--r--tests/ui/traits/const-traits/default-method-body-is-const-body-checking.stderr6
-rw-r--r--tests/ui/traits/const-traits/specialization/const-default-const-specialized.rs3
-rw-r--r--tests/ui/traits/const-traits/specialization/const-default-const-specialized.stderr15
-rw-r--r--tests/ui/traits/const-traits/specialization/non-const-default-const-specialized.rs4
-rw-r--r--tests/ui/traits/const-traits/specialization/non-const-default-const-specialized.stderr15
-rw-r--r--tests/ui/traits/const-traits/specializing-constness-2.stderr17
13 files changed, 26 insertions, 191 deletions
diff --git a/compiler/rustc_const_eval/src/check_consts/check.rs b/compiler/rustc_const_eval/src/check_consts/check.rs
index 303c490d827..4583712c2c7 100644
--- a/compiler/rustc_const_eval/src/check_consts/check.rs
+++ b/compiler/rustc_const_eval/src/check_consts/check.rs
@@ -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");
         }
     }
 }
@@ -664,7 +658,7 @@ impl<'tcx> Visitor<'tcx> for Checker<'_, 'tcx> {
                     // 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 {
+                    if tcx.features().const_trait_impl() && trait_is_const {
                         // This skips the check below that ensures we only call `const fn`.
                         is_trait = true;
 
diff --git a/compiler/rustc_hir_typeck/src/callee.rs b/compiler/rustc_hir_typeck/src/callee.rs
index f9a21a9bef3..481a5f3a921 100644
--- a/compiler/rustc_hir_typeck/src/callee.rs
+++ b/compiler/rustc_hir_typeck/src/callee.rs
@@ -847,7 +847,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
         // 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;
         }
 
diff --git a/tests/ui/specialization/const_trait_impl.stderr b/tests/ui/specialization/const_trait_impl.stderr
index 40ac350980e..607fc06823e 100644
--- a/tests/ui/specialization/const_trait_impl.stderr
+++ b/tests/ui/specialization/const_trait_impl.stderr
@@ -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[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
+error: aborting due to 6 previous errors
 
-For more information about this error, try `rustc --explain E0015`.
diff --git a/tests/ui/traits/const-traits/call-const-trait-method-pass.stderr b/tests/ui/traits/const-traits/call-const-trait-method-pass.stderr
index 32f53137a00..9ae1ed18e35 100644
--- a/tests/ui/traits/const-traits/call-const-trait-method-pass.stderr
+++ b/tests/ui/traits/const-traits/call-const-trait-method-pass.stderr
@@ -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`.
diff --git a/tests/ui/traits/const-traits/const-drop-fail-2.stderr b/tests/ui/traits/const-traits/const-drop-fail-2.stderr
index 102dbb1a599..fde106599c2 100644
--- a/tests/ui/traits/const-traits/const-drop-fail-2.stderr
+++ b/tests/ui/traits/const-traits/const-drop-fail-2.stderr
@@ -21,33 +21,21 @@ LL | const fn check<T: ~const Destruct>(_: T) {}
    |
    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
 
-error[E0493]: destructor of `T` cannot be evaluated at compile-time
-  --> $DIR/const-drop-fail-2.rs:20:36
-   |
-LL | const fn check<T: ~const Destruct>(_: T) {}
-   |                                    ^      - value is dropped here
-   |                                    |
-   |                                    the destructor for this type cannot be evaluated in constant functions
-
 error[E0277]: the trait bound `T: ~const A` is not satisfied
   --> $DIR/const-drop-fail-2.rs:41:9
    |
 LL |         T::a();
    |         ^^^^^^
 
-error[E0015]: cannot call non-const fn `<T as A>::a` in constant functions
-  --> $DIR/const-drop-fail-2.rs:41:9
-   |
-LL |         T::a();
-   |         ^^^^^^
-   |
-   = 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[E0493]: destructor of `T` cannot be evaluated at compile-time
+  --> $DIR/const-drop-fail-2.rs:20:36
    |
+LL | const fn check<T: ~const Destruct>(_: T) {}
+   |                                    ^      - value is dropped here
+   |                                    |
+   |                                    the destructor for this type cannot be evaluated in constant functions
 
-error: aborting due to 6 previous errors
+error: aborting due to 5 previous errors
 
-Some errors have detailed explanations: E0015, E0277, E0493.
-For more information about an error, try `rustc --explain E0015`.
+Some errors have detailed explanations: E0277, E0493.
+For more information about an error, try `rustc --explain E0277`.
diff --git a/tests/ui/traits/const-traits/const-drop.precise.stderr b/tests/ui/traits/const-traits/const-drop.precise.stderr
index 7471b200c33..ed90b234761 100644
--- a/tests/ui/traits/const-traits/const-drop.precise.stderr
+++ b/tests/ui/traits/const-traits/const-drop.precise.stderr
@@ -84,19 +84,7 @@ error[E0277]: the trait bound `T: ~const SomeTrait` is not satisfied
 LL |             T::foo();
    |             ^^^^^^^^
 
-error[E0015]: cannot call non-const fn `<T as SomeTrait>::foo` in constant functions
-  --> $DIR/const-drop.rs:69:13
-   |
-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 11 previous errors
+error: aborting due to 10 previous errors
 
-Some errors have detailed explanations: E0015, E0277, E0493.
-For more information about an error, try `rustc --explain E0015`.
+Some errors have detailed explanations: E0277, E0493.
+For more information about an error, try `rustc --explain E0277`.
diff --git a/tests/ui/traits/const-traits/const-drop.stock.stderr b/tests/ui/traits/const-traits/const-drop.stock.stderr
index 71378349161..2b46b048e90 100644
--- a/tests/ui/traits/const-traits/const-drop.stock.stderr
+++ b/tests/ui/traits/const-traits/const-drop.stock.stderr
@@ -86,19 +86,7 @@ error[E0277]: the trait bound `T: ~const SomeTrait` is not satisfied
 LL |             T::foo();
    |             ^^^^^^^^
 
-error[E0015]: cannot call non-const fn `<T as SomeTrait>::foo` in constant functions
-  --> $DIR/const-drop.rs:69:13
-   |
-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 11 previous errors
+error: aborting due to 10 previous errors
 
-Some errors have detailed explanations: E0015, E0277, E0493.
-For more information about an error, try `rustc --explain E0015`.
+Some errors have detailed explanations: E0277, E0493.
+For more information about an error, try `rustc --explain E0277`.
diff --git a/tests/ui/traits/const-traits/default-method-body-is-const-body-checking.stderr b/tests/ui/traits/const-traits/default-method-body-is-const-body-checking.stderr
index 308a60c08d3..0534f3eb8d2 100644
--- a/tests/ui/traits/const-traits/default-method-body-is-const-body-checking.stderr
+++ b/tests/ui/traits/const-traits/default-method-body-is-const-body-checking.stderr
@@ -3,12 +3,6 @@ error[E0277]: the trait bound `(): ~const Tr` is not satisfied
    |
 LL |         foo::<()>();
    |         ^^^^^^^^^^^
-   |
-note: required by a bound in `foo`
-  --> $DIR/default-method-body-is-const-body-checking.rs:7:28
-   |
-LL | const fn foo<T>() where T: ~const Tr {}
-   |                            ^^^^^^ required by this bound in `foo`
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/traits/const-traits/specialization/const-default-const-specialized.rs b/tests/ui/traits/const-traits/specialization/const-default-const-specialized.rs
index a48a50b9e5c..89ad61c3c31 100644
--- a/tests/ui/traits/const-traits/specialization/const-default-const-specialized.rs
+++ b/tests/ui/traits/const-traits/specialization/const-default-const-specialized.rs
@@ -1,8 +1,7 @@
 // Tests that a const default trait impl can be specialized by another const
 // trait impl and that the specializing impl will be used during const-eval.
 
-//@ known-bug: #110395
-// FIXME(effects) run-pass
+//@ run-pass
 
 #![feature(const_trait_impl)]
 #![feature(min_specialization)]
diff --git a/tests/ui/traits/const-traits/specialization/const-default-const-specialized.stderr b/tests/ui/traits/const-traits/specialization/const-default-const-specialized.stderr
index f127268d2a1..e69de29bb2d 100644
--- a/tests/ui/traits/const-traits/specialization/const-default-const-specialized.stderr
+++ b/tests/ui/traits/const-traits/specialization/const-default-const-specialized.stderr
@@ -1,15 +0,0 @@
-error[E0015]: cannot call non-const fn `<T as Value>::value` in constant functions
-  --> $DIR/const-default-const-specialized.rs:16:5
-   |
-LL |     T::value()
-   |     ^^^^^^^^^^
-   |
-   = 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 1 previous error
-
-For more information about this error, try `rustc --explain E0015`.
diff --git a/tests/ui/traits/const-traits/specialization/non-const-default-const-specialized.rs b/tests/ui/traits/const-traits/specialization/non-const-default-const-specialized.rs
index 912b35095f9..e9b494bc2c0 100644
--- a/tests/ui/traits/const-traits/specialization/non-const-default-const-specialized.rs
+++ b/tests/ui/traits/const-traits/specialization/non-const-default-const-specialized.rs
@@ -1,7 +1,7 @@
 // Tests that a non-const default impl can be specialized by a const trait impl,
 // but that the default impl cannot be used in a const context.
-//@ known-bug: #110395
-// FIXME(effects) run-pass
+
+//@ run-pass
 
 #![feature(const_trait_impl)]
 #![feature(min_specialization)]
diff --git a/tests/ui/traits/const-traits/specialization/non-const-default-const-specialized.stderr b/tests/ui/traits/const-traits/specialization/non-const-default-const-specialized.stderr
index a4095d7e8ce..e69de29bb2d 100644
--- a/tests/ui/traits/const-traits/specialization/non-const-default-const-specialized.stderr
+++ b/tests/ui/traits/const-traits/specialization/non-const-default-const-specialized.stderr
@@ -1,15 +0,0 @@
-error[E0015]: cannot call non-const fn `<T as Value>::value` in constant functions
-  --> $DIR/non-const-default-const-specialized.rs:15:5
-   |
-LL |     T::value()
-   |     ^^^^^^^^^^
-   |
-   = 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 1 previous error
-
-For more information about this error, try `rustc --explain E0015`.
diff --git a/tests/ui/traits/const-traits/specializing-constness-2.stderr b/tests/ui/traits/const-traits/specializing-constness-2.stderr
index 98a9de2324a..4ad5e3157d4 100644
--- a/tests/ui/traits/const-traits/specializing-constness-2.stderr
+++ b/tests/ui/traits/const-traits/specializing-constness-2.stderr
@@ -4,19 +4,6 @@ error[E0277]: the trait bound `T: ~const A` is not satisfied
 LL |     <T as A>::a();
    |     ^^^^^^^^^^^^^
 
-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();
-   |     ^^^^^^^^^^^^^
-   |
-   = 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 2 previous errors
+error: aborting due to 1 previous error
 
-Some errors have detailed explanations: E0015, E0277.
-For more information about an error, try `rustc --explain E0015`.
+For more information about this error, try `rustc --explain E0277`.