bless tests, remove nonexistent E0395

This commit is contained in:
Deadbeef
2022-07-25 08:17:00 +00:00
parent a6f9826979
commit d60ebe366b
24 changed files with 182 additions and 194 deletions

View File

@@ -3,7 +3,6 @@
pub const fn equals_self<T: PartialEq>(t: &T) -> bool {
*t == *t
//~^ ERROR can't compare
//~| ERROR cannot call non-const
}
fn main() {}

View File

@@ -1,28 +1,22 @@
error[E0277]: can't compare `T` with `T` in const contexts
--> $DIR/call-generic-method-fail.rs:4:5
error[E0277]: can't compare `T` with `_` in const contexts
--> $DIR/call-generic-method-fail.rs:4:8
|
LL | *t == *t
| ^^^^^^^^ no implementation for `T == T`
| ^^ no implementation for `T == _`
|
note: the trait `PartialEq` is implemented for `T`, but that implementation is not `const`
--> $DIR/call-generic-method-fail.rs:4:5
note: the trait `PartialEq<_>` is implemented for `T`, but that implementation is not `const`
--> $DIR/call-generic-method-fail.rs:4:8
|
LL | *t == *t
| ^^^^^^^^
| ^^
= help: the following other types implement trait `PartialEq<Rhs>`:
<&A as PartialEq<&B>>
<&A as PartialEq<&mut B>>
<&mut A as PartialEq<&B>>
<&mut A as PartialEq<&mut B>>
<*const T as PartialEq>
<*mut T as PartialEq>
error[E0015]: cannot call non-const operator in constant functions
--> $DIR/call-generic-method-fail.rs:4:5
|
LL | *t == *t
| ^^^^^^^^
|
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
help: consider further restricting this bound
|
LL | pub const fn equals_self<T: PartialEq + ~const std::cmp::PartialEq>(t: &T) -> bool {
| ++++++++++++++++++++++++++++
error: aborting due to previous error
error: aborting due to 2 previous errors
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`.

View File

@@ -23,7 +23,6 @@ impl const ConstDefaultFn for ConstImpl {
const fn test() {
NonConstImpl.a();
//~^ ERROR the trait bound
//~| ERROR cannot call non-const fn
ConstImpl.a();
}

View File

@@ -2,23 +2,18 @@ error[E0277]: the trait bound `NonConstImpl: ~const ConstDefaultFn` is not satis
--> $DIR/const-default-method-bodies.rs:24:18
|
LL | NonConstImpl.a();
| ^^^ the trait `~const ConstDefaultFn` is not implemented for `NonConstImpl`
| ^ the trait `~const ConstDefaultFn` is not implemented for `NonConstImpl`
|
note: the trait `ConstDefaultFn` is implemented for `NonConstImpl`, but that implementation is not `const`
--> $DIR/const-default-method-bodies.rs:24:18
|
LL | NonConstImpl.a();
| ^^^
error[E0015]: cannot call non-const fn `<NonConstImpl as ConstDefaultFn>::a` in constant functions
--> $DIR/const-default-method-bodies.rs:24:18
| ^
help: consider introducing a `where` clause, but there might be an alternative better way to express this requirement
|
LL | NonConstImpl.a();
| ^^^
|
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
LL | const fn test() where NonConstImpl: ~const ConstDefaultFn {
| +++++++++++++++++++++++++++++++++++++++++
error: aborting due to 2 previous errors
error: aborting due to 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`.

View File

@@ -1,24 +0,0 @@
error[E0277]: the trait bound `cross_crate::NonConst: ~const cross_crate::MyTrait` is not satisfied
--> $DIR/cross-crate.rs:15:14
|
LL | NonConst.func();
| ^^^^^^ the trait `~const cross_crate::MyTrait` is not implemented for `cross_crate::NonConst`
|
note: the trait `cross_crate::MyTrait` is implemented for `cross_crate::NonConst`, but that implementation is not `const`
--> $DIR/cross-crate.rs:15:14
|
LL | NonConst.func();
| ^^^^^^
error[E0015]: cannot call non-const fn `<cross_crate::NonConst as cross_crate::MyTrait>::func` in constant functions
--> $DIR/cross-crate.rs:15:14
|
LL | NonConst.func();
| ^^^^^^
|
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
error: aborting due to 2 previous errors
Some errors have detailed explanations: E0015, E0277.
For more information about an error, try `rustc --explain E0015`.

View File

@@ -0,0 +1,19 @@
error[E0277]: the trait bound `cross_crate::NonConst: ~const cross_crate::MyTrait` is not satisfied
--> $DIR/cross-crate.rs:17:14
|
LL | NonConst.func();
| ^^^^ the trait `~const cross_crate::MyTrait` is not implemented for `cross_crate::NonConst`
|
note: the trait `cross_crate::MyTrait` is implemented for `cross_crate::NonConst`, but that implementation is not `const`
--> $DIR/cross-crate.rs:17:14
|
LL | NonConst.func();
| ^^^^
help: consider introducing a `where` clause, but there might be an alternative better way to express this requirement
|
LL | const fn const_context() where cross_crate::NonConst: ~const cross_crate::MyTrait {
| ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
error: aborting due to previous error
For more information about this error, try `rustc --explain E0277`.

View File

@@ -1,5 +1,6 @@
// revisions: stock gated
#![cfg_attr(gated, feature(const_trait_impl))]
// revisions: stock gated stocknc gatednc
// [gated] check-pass
#![cfg_attr(any(gated, gatednc), feature(const_trait_impl))]
// aux-build: cross-crate.rs
extern crate cross_crate;
@@ -12,10 +13,12 @@ fn non_const_context() {
}
const fn const_context() {
NonConst.func(); //~ ERROR: cannot call non-const fn
//[gated]~^ ERROR: the trait bound
#[cfg(any(stocknc, gatednc))]
NonConst.func();
//[stocknc]~^ ERROR: the trait bound
//[gatednc]~^^ ERROR: the trait bound
Const.func();
//[stock]~^ ERROR: cannot call non-const fn
//[stock]~^ ERROR: cannot call
}
fn main() {}

View File

@@ -1,19 +1,11 @@
error[E0015]: cannot call non-const fn `<cross_crate::NonConst as cross_crate::MyTrait>::func` in constant functions
--> $DIR/cross-crate.rs:15:14
|
LL | NonConst.func();
| ^^^^^^
|
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
error[E0015]: cannot call non-const fn `<cross_crate::Const as cross_crate::MyTrait>::func` in constant functions
--> $DIR/cross-crate.rs:17:11
--> $DIR/cross-crate.rs:20:11
|
LL | Const.func();
| ^^^^^^
|
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
error: aborting due to 2 previous errors
error: aborting due to previous error
For more information about this error, try `rustc --explain E0015`.

View File

@@ -0,0 +1,19 @@
error[E0277]: the trait bound `cross_crate::NonConst: cross_crate::MyTrait` is not satisfied
--> $DIR/cross-crate.rs:17:14
|
LL | NonConst.func();
| ^^^^ the trait `~const cross_crate::MyTrait` is not implemented for `cross_crate::NonConst`
|
note: the trait `cross_crate::MyTrait` is implemented for `cross_crate::NonConst`, but that implementation is not `const`
--> $DIR/cross-crate.rs:17:14
|
LL | NonConst.func();
| ^^^^
help: consider introducing a `where` clause, but there might be an alternative better way to express this requirement
|
LL | const fn const_context() where cross_crate::NonConst: ~const cross_crate::MyTrait {
| ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
error: aborting due to previous error
For more information about this error, try `rustc --explain E0277`.

View File

@@ -7,7 +7,6 @@ pub trait Tr {
fn b(&self) {
().a()
//~^ ERROR the trait bound
//~| ERROR cannot call
}
}

View File

@@ -2,23 +2,18 @@ error[E0277]: the trait bound `(): ~const Tr` is not satisfied
--> $DIR/default-method-body-is-const-same-trait-ck.rs:8:12
|
LL | ().a()
| ^^^ the trait `~const Tr` is not implemented for `()`
| ^ the trait `~const Tr` is not implemented for `()`
|
note: the trait `Tr` is implemented for `()`, but that implementation is not `const`
--> $DIR/default-method-body-is-const-same-trait-ck.rs:8:12
|
LL | ().a()
| ^^^
error[E0015]: cannot call non-const fn `<() as Tr>::a` in constant functions
--> $DIR/default-method-body-is-const-same-trait-ck.rs:8:12
| ^
help: consider introducing a `where` clause, but there might be an alternative better way to express this requirement
|
LL | ().a()
| ^^^
|
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
LL | pub trait Tr where (): ~const Tr {
| +++++++++++++++++++
error: aborting due to 2 previous errors
error: aborting due to 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`.