summaryrefslogtreecommitdiffstats
path: root/tests/ui/rfcs/rfc-2632-const-trait-impl
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/assoc-type-const-bound-usage.stderr4
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/call-const-trait-method-fail.stderr4
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/const-closure-parse-not-item.rs3
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/const-closure-parse-not-item.stderr8
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/const-closure-trait-method-fail.stderr15
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/const-closure-trait-method.stderr15
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/const-closures.stderr49
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/effects/fallback.rs16
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/effects/infer-fallback.rs11
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/trait-where-clause-const.stderr2
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/trait-where-clause.stderr2
11 files changed, 69 insertions, 60 deletions
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/assoc-type-const-bound-usage.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/assoc-type-const-bound-usage.stderr
index 4fcfe9d47..ad11c090f 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/assoc-type-const-bound-usage.stderr
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/assoc-type-const-bound-usage.stderr
@@ -1,8 +1,8 @@
error[E0277]: the trait bound `T: Foo` is not satisfied
- --> $DIR/assoc-type-const-bound-usage.rs:12:5
+ --> $DIR/assoc-type-const-bound-usage.rs:12:6
|
LL | <T as Foo>::Assoc::foo();
- | ^^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `T`
+ | ^ the trait `Foo` is not implemented for `T`
|
help: consider further restricting this bound
|
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/call-const-trait-method-fail.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/call-const-trait-method-fail.stderr
index 2d9c49af8..452bf757d 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/call-const-trait-method-fail.stderr
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/call-const-trait-method-fail.stderr
@@ -1,8 +1,8 @@
error[E0277]: the trait bound `u32: ~const Plus` is not satisfied
- --> $DIR/call-const-trait-method-fail.rs:25:7
+ --> $DIR/call-const-trait-method-fail.rs:25:5
|
LL | a.plus(b)
- | ^^^^ the trait `Plus` is not implemented for `u32`
+ | ^ the trait `Plus` is not implemented for `u32`
|
= help: the trait `Plus` is implemented for `u32`
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/const-closure-parse-not-item.rs b/tests/ui/rfcs/rfc-2632-const-trait-impl/const-closure-parse-not-item.rs
index 2c99d8bf1..15f062edf 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/const-closure-parse-not-item.rs
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/const-closure-parse-not-item.rs
@@ -1,4 +1,5 @@
-// check-pass
+// known-bug: #110395
+// FIXME check-pass
#![feature(const_trait_impl, const_closures)]
#![allow(incomplete_features)]
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/const-closure-parse-not-item.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/const-closure-parse-not-item.stderr
new file mode 100644
index 000000000..f25390a90
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/const-closure-parse-not-item.stderr
@@ -0,0 +1,8 @@
+error: ~const can only be applied to `#[const_trait]` traits
+ --> $DIR/const-closure-parse-not-item.rs:7:32
+ |
+LL | const fn test() -> impl ~const Fn() {
+ | ^^^^
+
+error: aborting due to previous error
+
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/const-closure-trait-method-fail.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/const-closure-trait-method-fail.stderr
index 96ffca651..4c45b0e56 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/const-closure-trait-method-fail.stderr
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/const-closure-trait-method-fail.stderr
@@ -1,15 +1,8 @@
-error[E0015]: cannot call non-const closure in constant functions
- --> $DIR/const-closure-trait-method-fail.rs:15:5
+error: ~const can only be applied to `#[const_trait]` traits
+ --> $DIR/const-closure-trait-method-fail.rs:14:39
|
-LL | x(())
- | ^^^^^
- |
- = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
-help: consider further restricting this bound
- |
-LL | const fn need_const_closure<T: ~const FnOnce(()) -> i32 + ~const std::ops::FnOnce<((),)>>(x: T) -> i32 {
- | ++++++++++++++++++++++++++++++++
+LL | const fn need_const_closure<T: ~const FnOnce(()) -> i32>(x: T) -> i32 {
+ | ^^^^^^^^^^^^^^^^^
error: aborting due to previous error
-For more information about this error, try `rustc --explain E0015`.
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/const-closure-trait-method.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/const-closure-trait-method.stderr
index fd0c29118..a8ef244ea 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/const-closure-trait-method.stderr
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/const-closure-trait-method.stderr
@@ -1,15 +1,8 @@
-error[E0015]: cannot call non-const closure in constant functions
- --> $DIR/const-closure-trait-method.rs:15:5
+error: ~const can only be applied to `#[const_trait]` traits
+ --> $DIR/const-closure-trait-method.rs:14:39
|
-LL | x(())
- | ^^^^^
- |
- = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
-help: consider further restricting this bound
- |
-LL | const fn need_const_closure<T: ~const FnOnce(()) -> i32 + ~const std::ops::FnOnce<((),)>>(x: T) -> i32 {
- | ++++++++++++++++++++++++++++++++
+LL | const fn need_const_closure<T: ~const FnOnce(()) -> i32>(x: T) -> i32 {
+ | ^^^^^^^^^^^^^^^^^
error: aborting due to previous error
-For more information about this error, try `rustc --explain E0015`.
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/const-closures.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/const-closures.stderr
index abf2a2dc5..6d61b23e4 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/const-closures.stderr
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/const-closures.stderr
@@ -1,39 +1,26 @@
-error[E0015]: cannot call non-const closure in constant functions
- --> $DIR/const-closures.rs:12:5
+error: ~const can only be applied to `#[const_trait]` traits
+ --> $DIR/const-closures.rs:8:19
|
-LL | f() * 7
- | ^^^
- |
- = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
-help: consider further restricting this bound
- |
-LL | F: ~const FnOnce() -> u8 + ~const std::ops::Fn<()>,
- | +++++++++++++++++++++++++
+LL | F: ~const FnOnce() -> u8,
+ | ^^^^^^^^^^^^^^
-error[E0015]: cannot call non-const closure in constant functions
- --> $DIR/const-closures.rs:24:5
- |
-LL | f() + f()
- | ^^^
+error: ~const can only be applied to `#[const_trait]` traits
+ --> $DIR/const-closures.rs:9:19
|
- = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
-help: consider further restricting this bound
- |
-LL | const fn answer<F: ~const Fn() -> u8 + ~const std::ops::Fn<()>>(f: &F) -> u8 {
- | +++++++++++++++++++++++++
+LL | F: ~const FnMut() -> u8,
+ | ^^^^^^^^^^^^^
-error[E0015]: cannot call non-const closure in constant functions
- --> $DIR/const-closures.rs:24:11
- |
-LL | f() + f()
- | ^^^
+error: ~const can only be applied to `#[const_trait]` traits
+ --> $DIR/const-closures.rs:10:19
|
- = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
-help: consider further restricting this bound
+LL | F: ~const Fn() -> u8,
+ | ^^^^^^^^^^
+
+error: ~const can only be applied to `#[const_trait]` traits
+ --> $DIR/const-closures.rs:23:27
|
-LL | const fn answer<F: ~const Fn() -> u8 + ~const std::ops::Fn<()>>(f: &F) -> u8 {
- | +++++++++++++++++++++++++
+LL | const fn answer<F: ~const Fn() -> u8>(f: &F) -> u8 {
+ | ^^^^^^^^^^
-error: aborting due to 3 previous errors
+error: aborting due to 4 previous errors
-For more information about this error, try `rustc --explain E0015`.
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/fallback.rs b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/fallback.rs
new file mode 100644
index 000000000..da2778f61
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/fallback.rs
@@ -0,0 +1,16 @@
+// check-pass
+
+#![feature(effects)]
+
+pub const fn owo() {}
+
+fn main() {
+ // make sure falling back ty/int vars doesn't cause const fallback to be skipped...
+ // See issue: 115791.
+ let _ = 1;
+ if false {
+ let x = panic!();
+ }
+
+ let _ = owo;
+}
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/infer-fallback.rs b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/infer-fallback.rs
new file mode 100644
index 000000000..2f474d978
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/infer-fallback.rs
@@ -0,0 +1,11 @@
+// check-pass
+#![feature(const_trait_impl, effects)]
+
+const fn a() {}
+
+fn foo<F: FnOnce()>(a: F) {}
+
+fn main() {
+ let _ = a;
+ foo(a);
+}
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/trait-where-clause-const.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/trait-where-clause-const.stderr
index e8d0eec02..c94563d35 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/trait-where-clause-const.stderr
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/trait-where-clause-const.stderr
@@ -2,7 +2,7 @@ error[E0277]: the trait bound `T: ~const Bar` is not satisfied
--> $DIR/trait-where-clause-const.rs:21:5
|
LL | T::b();
- | ^^^^ the trait `Bar` is not implemented for `T`
+ | ^ the trait `Bar` is not implemented for `T`
|
note: required by a bound in `Foo::b`
--> $DIR/trait-where-clause-const.rs:15:24
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/trait-where-clause.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/trait-where-clause.stderr
index 11f0c4016..255878e17 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/trait-where-clause.stderr
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/trait-where-clause.stderr
@@ -2,7 +2,7 @@ error[E0277]: the trait bound `T: Bar` is not satisfied
--> $DIR/trait-where-clause.rs:14:5
|
LL | T::b();
- | ^^^^ the trait `Bar` is not implemented for `T`
+ | ^ the trait `Bar` is not implemented for `T`
|
note: required by a bound in `Foo::b`
--> $DIR/trait-where-clause.rs:8:24