mirror of
https://github.com/rust-lang/rust.git
synced 2025-04-13 04:26:48 +00:00
update tests, adding known-bug
This commit is contained in:
parent
e6b423aebb
commit
2d59451274
@ -1,7 +1,6 @@
|
||||
struct X<const N: usize = {
|
||||
(||1usize)()
|
||||
//~^ ERROR cannot call non-const closure
|
||||
//~| ERROR the trait bound
|
||||
}>;
|
||||
|
||||
fn main() {}
|
||||
|
@ -1,17 +1,3 @@
|
||||
error[E0277]: the trait bound `[closure@$DIR/issue-93647.rs:2:6: 2:8]: Fn<()>` is not satisfied
|
||||
--> $DIR/issue-93647.rs:2:5
|
||||
|
|
||||
LL | (||1usize)()
|
||||
| ^^^^^^^^^^^^ expected an `Fn<()>` closure, found `[closure@$DIR/issue-93647.rs:2:6: 2:8]`
|
||||
|
|
||||
= help: the trait `~const Fn<()>` is not implemented for closure `[closure@$DIR/issue-93647.rs:2:6: 2:8]`
|
||||
note: the trait `Fn<()>` is implemented for `[closure@$DIR/issue-93647.rs:2:6: 2:8]`, but that implementation is not `const`
|
||||
--> $DIR/issue-93647.rs:2:5
|
||||
|
|
||||
LL | (||1usize)()
|
||||
| ^^^^^^^^^^^^
|
||||
= note: wrap the `[closure@$DIR/issue-93647.rs:2:6: 2:8]` in a closure with no arguments: `|| { /* code */ }`
|
||||
|
||||
error[E0015]: cannot call non-const closure in constants
|
||||
--> $DIR/issue-93647.rs:2:5
|
||||
|
|
||||
@ -22,7 +8,6 @@ LL | (||1usize)()
|
||||
= note: calls in constants are limited to constant functions, tuple structs and tuple variants
|
||||
= help: add `#![feature(const_trait_impl)]` to the crate attributes to enable
|
||||
|
||||
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 E0015`.
|
||||
|
@ -1,3 +1,5 @@
|
||||
// known-bug: #103507
|
||||
|
||||
#![allow(unused)]
|
||||
#![feature(const_trait_impl, inline_const, negative_impls)]
|
||||
|
||||
@ -14,6 +16,6 @@ impl Drop for UnconstDrop {
|
||||
fn main() {
|
||||
const {
|
||||
f(UnconstDrop);
|
||||
//~^ ERROR can't drop
|
||||
//FIXME ~^ ERROR can't drop
|
||||
}
|
||||
}
|
||||
|
@ -1,17 +1,11 @@
|
||||
error[E0277]: can't drop `UnconstDrop` in const contexts
|
||||
--> $DIR/const-block-const-bound.rs:16:9
|
||||
error[E0493]: destructor of `T` cannot be evaluated at compile-time
|
||||
--> $DIR/const-block-const-bound.rs:8:32
|
||||
|
|
||||
LL | f(UnconstDrop);
|
||||
| ^^^^^^^^^^^^^^ the trait `~const Destruct` is not implemented for `UnconstDrop`
|
||||
|
|
||||
= note: the trait bound `UnconstDrop: ~const Destruct` is not satisfied
|
||||
help: consider borrowing here
|
||||
|
|
||||
LL | &f(UnconstDrop);
|
||||
| +
|
||||
LL | &mut f(UnconstDrop);
|
||||
| ++++
|
||||
LL | const fn f<T: ~const Destruct>(x: T) {}
|
||||
| ^ - value is dropped here
|
||||
| |
|
||||
| the destructor for this type cannot be evaluated in constant functions
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0277`.
|
||||
For more information about this error, try `rustc --explain E0493`.
|
||||
|
@ -1,16 +1,3 @@
|
||||
error[E0277]: can't compare `TypeId` with `TypeId` in const contexts
|
||||
--> $DIR/const_cmp_type_id.rs:8:13
|
||||
|
|
||||
LL | assert!(TypeId::of::<u8>() == TypeId::of::<u8>());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no implementation for `TypeId == TypeId`
|
||||
|
|
||||
= help: the trait `~const PartialEq` is not implemented for `TypeId`
|
||||
note: the trait `PartialEq` is implemented for `TypeId`, but that implementation is not `const`
|
||||
--> $DIR/const_cmp_type_id.rs:8:13
|
||||
|
|
||||
LL | assert!(TypeId::of::<u8>() == TypeId::of::<u8>());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0015]: cannot call non-const operator in constant functions
|
||||
--> $DIR/const_cmp_type_id.rs:8:13
|
||||
|
|
||||
@ -21,19 +8,6 @@ note: impl defined here, but it is not `const`
|
||||
--> $SRC_DIR/core/src/any.rs:LL:COL
|
||||
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
|
||||
|
||||
error[E0277]: can't compare `TypeId` with `TypeId` in const contexts
|
||||
--> $DIR/const_cmp_type_id.rs:9:13
|
||||
|
|
||||
LL | assert!(TypeId::of::<()>() != TypeId::of::<u8>());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no implementation for `TypeId == TypeId`
|
||||
|
|
||||
= help: the trait `~const PartialEq` is not implemented for `TypeId`
|
||||
note: the trait `PartialEq` is implemented for `TypeId`, but that implementation is not `const`
|
||||
--> $DIR/const_cmp_type_id.rs:9:13
|
||||
|
|
||||
LL | assert!(TypeId::of::<()>() != TypeId::of::<u8>());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0015]: cannot call non-const operator in constant functions
|
||||
--> $DIR/const_cmp_type_id.rs:9:13
|
||||
|
|
||||
@ -44,19 +18,6 @@ note: impl defined here, but it is not `const`
|
||||
--> $SRC_DIR/core/src/any.rs:LL:COL
|
||||
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
|
||||
|
||||
error[E0277]: can't compare `TypeId` with `TypeId` in const contexts
|
||||
--> $DIR/const_cmp_type_id.rs:10:22
|
||||
|
|
||||
LL | const _A: bool = TypeId::of::<u8>() < TypeId::of::<u16>();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no implementation for `TypeId < TypeId` and `TypeId > TypeId`
|
||||
|
|
||||
= help: the trait `~const PartialOrd` is not implemented for `TypeId`
|
||||
note: the trait `PartialOrd` is implemented for `TypeId`, but that implementation is not `const`
|
||||
--> $DIR/const_cmp_type_id.rs:10:22
|
||||
|
|
||||
LL | const _A: bool = TypeId::of::<u8>() < TypeId::of::<u16>();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0015]: cannot call non-const operator in constants
|
||||
--> $DIR/const_cmp_type_id.rs:10:22
|
||||
|
|
||||
@ -68,7 +29,6 @@ note: impl defined here, but it is not `const`
|
||||
= note: calls in constants are limited to constant functions, tuple structs and tuple variants
|
||||
= note: this error originates in the derive macro `PartialOrd` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: aborting due to 6 previous errors
|
||||
error: aborting due to 3 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 E0015`.
|
||||
|
@ -5,6 +5,5 @@ fn main() {
|
||||
match () {
|
||||
const { (|| {})() } => {}
|
||||
//~^ ERROR cannot call non-const closure in constants
|
||||
//~| ERROR the trait bound
|
||||
}
|
||||
}
|
||||
|
@ -1,17 +1,3 @@
|
||||
error[E0277]: the trait bound `[closure@$DIR/invalid-inline-const-in-match-arm.rs:6:18: 6:20]: Fn<()>` is not satisfied
|
||||
--> $DIR/invalid-inline-const-in-match-arm.rs:6:17
|
||||
|
|
||||
LL | const { (|| {})() } => {}
|
||||
| ^^^^^^^^^ expected an `Fn<()>` closure, found `[closure@$DIR/invalid-inline-const-in-match-arm.rs:6:18: 6:20]`
|
||||
|
|
||||
= help: the trait `~const Fn<()>` is not implemented for closure `[closure@$DIR/invalid-inline-const-in-match-arm.rs:6:18: 6:20]`
|
||||
note: the trait `Fn<()>` is implemented for `[closure@$DIR/invalid-inline-const-in-match-arm.rs:6:18: 6:20]`, but that implementation is not `const`
|
||||
--> $DIR/invalid-inline-const-in-match-arm.rs:6:17
|
||||
|
|
||||
LL | const { (|| {})() } => {}
|
||||
| ^^^^^^^^^
|
||||
= note: wrap the `[closure@$DIR/invalid-inline-const-in-match-arm.rs:6:18: 6:20]` in a closure with no arguments: `|| { /* code */ }`
|
||||
|
||||
error[E0015]: cannot call non-const closure in constants
|
||||
--> $DIR/invalid-inline-const-in-match-arm.rs:6:17
|
||||
|
|
||||
@ -22,7 +8,6 @@ LL | const { (|| {})() } => {}
|
||||
= note: calls in constants are limited to constant functions, tuple structs and tuple variants
|
||||
= help: add `#![feature(const_trait_impl)]` to the crate attributes to enable
|
||||
|
||||
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 E0015`.
|
||||
|
@ -3,7 +3,6 @@
|
||||
const X: u8 =
|
||||
|| -> u8 { 5 }()
|
||||
//~^ ERROR cannot call non-const closure
|
||||
//~| ERROR the trait bound
|
||||
;
|
||||
|
||||
fn main() {}
|
||||
|
@ -1,17 +1,3 @@
|
||||
error[E0277]: the trait bound `[closure@$DIR/issue-28113.rs:4:5: 4:13]: Fn<()>` is not satisfied
|
||||
--> $DIR/issue-28113.rs:4:5
|
||||
|
|
||||
LL | || -> u8 { 5 }()
|
||||
| ^^^^^^^^^^^^^^^^ expected an `Fn<()>` closure, found `[closure@$DIR/issue-28113.rs:4:5: 4:13]`
|
||||
|
|
||||
= help: the trait `~const Fn<()>` is not implemented for closure `[closure@$DIR/issue-28113.rs:4:5: 4:13]`
|
||||
note: the trait `Fn<()>` is implemented for `[closure@$DIR/issue-28113.rs:4:5: 4:13]`, but that implementation is not `const`
|
||||
--> $DIR/issue-28113.rs:4:5
|
||||
|
|
||||
LL | || -> u8 { 5 }()
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
= note: wrap the `[closure@$DIR/issue-28113.rs:4:5: 4:13]` in a closure with no arguments: `|| { /* code */ }`
|
||||
|
||||
error[E0015]: cannot call non-const closure in constants
|
||||
--> $DIR/issue-28113.rs:4:5
|
||||
|
|
||||
@ -22,7 +8,6 @@ LL | || -> u8 { 5 }()
|
||||
= note: calls in constants are limited to constant functions, tuple structs and tuple variants
|
||||
= help: add `#![feature(const_trait_impl)]` to the crate attributes to enable
|
||||
|
||||
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 E0015`.
|
||||
|
@ -1,6 +1,5 @@
|
||||
const fn foo() { (||{})() }
|
||||
//~^ ERROR cannot call non-const closure
|
||||
//~| ERROR the trait bound
|
||||
|
||||
const fn bad(input: fn()) {
|
||||
input()
|
||||
|
@ -1,17 +1,3 @@
|
||||
error[E0277]: the trait bound `[closure@$DIR/issue-56164.rs:1:19: 1:21]: Fn<()>` is not satisfied
|
||||
--> $DIR/issue-56164.rs:1:18
|
||||
|
|
||||
LL | const fn foo() { (||{})() }
|
||||
| ^^^^^^^^ expected an `Fn<()>` closure, found `[closure@$DIR/issue-56164.rs:1:19: 1:21]`
|
||||
|
|
||||
= help: the trait `~const Fn<()>` is not implemented for closure `[closure@$DIR/issue-56164.rs:1:19: 1:21]`
|
||||
note: the trait `Fn<()>` is implemented for `[closure@$DIR/issue-56164.rs:1:19: 1:21]`, but that implementation is not `const`
|
||||
--> $DIR/issue-56164.rs:1:18
|
||||
|
|
||||
LL | const fn foo() { (||{})() }
|
||||
| ^^^^^^^^
|
||||
= note: wrap the `[closure@$DIR/issue-56164.rs:1:19: 1:21]` in a closure with no arguments: `|| { /* code */ }`
|
||||
|
||||
error[E0015]: cannot call non-const closure in constant functions
|
||||
--> $DIR/issue-56164.rs:1:18
|
||||
|
|
||||
@ -23,12 +9,11 @@ LL | const fn foo() { (||{})() }
|
||||
= help: add `#![feature(const_trait_impl)]` to the crate attributes to enable
|
||||
|
||||
error: function pointer calls are not allowed in constant functions
|
||||
--> $DIR/issue-56164.rs:6:5
|
||||
--> $DIR/issue-56164.rs:5:5
|
||||
|
|
||||
LL | input()
|
||||
| ^^^^^^^
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
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 E0015`.
|
||||
|
@ -4,7 +4,6 @@
|
||||
|
||||
struct Bug {
|
||||
a: [(); (|| { 0 })()] //~ ERROR cannot call non-const closure
|
||||
//~^ ERROR the trait bound
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
@ -1,17 +1,3 @@
|
||||
error[E0277]: the trait bound `[closure@$DIR/issue-68542-closure-in-array-len.rs:6:14: 6:16]: Fn<()>` is not satisfied
|
||||
--> $DIR/issue-68542-closure-in-array-len.rs:6:13
|
||||
|
|
||||
LL | a: [(); (|| { 0 })()]
|
||||
| ^^^^^^^^^^^^ expected an `Fn<()>` closure, found `[closure@$DIR/issue-68542-closure-in-array-len.rs:6:14: 6:16]`
|
||||
|
|
||||
= help: the trait `~const Fn<()>` is not implemented for closure `[closure@$DIR/issue-68542-closure-in-array-len.rs:6:14: 6:16]`
|
||||
note: the trait `Fn<()>` is implemented for `[closure@$DIR/issue-68542-closure-in-array-len.rs:6:14: 6:16]`, but that implementation is not `const`
|
||||
--> $DIR/issue-68542-closure-in-array-len.rs:6:13
|
||||
|
|
||||
LL | a: [(); (|| { 0 })()]
|
||||
| ^^^^^^^^^^^^
|
||||
= note: wrap the `[closure@$DIR/issue-68542-closure-in-array-len.rs:6:14: 6:16]` in a closure with no arguments: `|| { /* code */ }`
|
||||
|
||||
error[E0015]: cannot call non-const closure in constants
|
||||
--> $DIR/issue-68542-closure-in-array-len.rs:6:13
|
||||
|
|
||||
@ -22,7 +8,6 @@ LL | a: [(); (|| { 0 })()]
|
||||
= note: calls in constants are limited to constant functions, tuple structs and tuple variants
|
||||
= help: add `#![feature(const_trait_impl)]` to the crate attributes to enable
|
||||
|
||||
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 E0015`.
|
||||
|
@ -1,16 +1,3 @@
|
||||
error[E0277]: can't compare `TypeId` with `TypeId` in const contexts
|
||||
--> $DIR/issue-73976-monomorphic.rs:21:5
|
||||
|
|
||||
LL | GetTypeId::<T>::VALUE == GetTypeId::<usize>::VALUE
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no implementation for `TypeId == TypeId`
|
||||
|
|
||||
= help: the trait `~const PartialEq` is not implemented for `TypeId`
|
||||
note: the trait `PartialEq` is implemented for `TypeId`, but that implementation is not `const`
|
||||
--> $DIR/issue-73976-monomorphic.rs:21:5
|
||||
|
|
||||
LL | GetTypeId::<T>::VALUE == GetTypeId::<usize>::VALUE
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0015]: cannot call non-const operator in constant functions
|
||||
--> $DIR/issue-73976-monomorphic.rs:21:5
|
||||
|
|
||||
@ -21,7 +8,6 @@ note: impl defined here, but it is not `const`
|
||||
--> $SRC_DIR/core/src/any.rs:LL:COL
|
||||
= 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
|
||||
|
||||
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 E0015`.
|
||||
|
@ -1,3 +1,5 @@
|
||||
// known-bug: #103507
|
||||
|
||||
#![feature(const_trait_impl, const_mut_refs)]
|
||||
|
||||
struct Foo<'a> {
|
||||
@ -7,9 +9,9 @@ struct Foo<'a> {
|
||||
impl<'a> Foo<'a> {
|
||||
const fn spam(&mut self, baz: &mut Vec<u32>) {
|
||||
self.bar[0] = baz.len();
|
||||
//~^ ERROR: cannot call
|
||||
//~| ERROR: cannot call
|
||||
//~| ERROR: the trait bound
|
||||
//FIXME ~^ ERROR: cannot call
|
||||
//FIXME ~| ERROR: cannot call
|
||||
//FIXME ~| ERROR: the trait bound
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,26 +1,13 @@
|
||||
error[E0015]: cannot call non-const fn `Vec::<u32>::len` in constant functions
|
||||
--> $DIR/issue-94675.rs:9:27
|
||||
--> $DIR/issue-94675.rs:11:27
|
||||
|
|
||||
LL | self.bar[0] = baz.len();
|
||||
| ^^^^^
|
||||
|
|
||||
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
|
||||
|
||||
error[E0277]: the trait bound `Vec<usize>: ~const IndexMut<usize>` is not satisfied
|
||||
--> $DIR/issue-94675.rs:9:9
|
||||
|
|
||||
LL | self.bar[0] = baz.len();
|
||||
| ^^^^^^^^^^^ vector indices are of type `usize` or ranges of `usize`
|
||||
|
|
||||
= help: the trait `~const IndexMut<usize>` is not implemented for `Vec<usize>`
|
||||
note: the trait `IndexMut<usize>` is implemented for `Vec<usize>`, but that implementation is not `const`
|
||||
--> $DIR/issue-94675.rs:9:9
|
||||
|
|
||||
LL | self.bar[0] = baz.len();
|
||||
| ^^^^^^^^^^^
|
||||
|
||||
error[E0015]: cannot call non-const operator in constant functions
|
||||
--> $DIR/issue-94675.rs:9:9
|
||||
--> $DIR/issue-94675.rs:11:9
|
||||
|
|
||||
LL | self.bar[0] = baz.len();
|
||||
| ^^^^^^^^^^^
|
||||
@ -29,7 +16,6 @@ note: impl defined here, but it is not `const`
|
||||
--> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL
|
||||
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
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 E0015`.
|
||||
|
@ -1,6 +1,12 @@
|
||||
// Regression test for issue #89938.
|
||||
// check-pass
|
||||
// compile-flags: --crate-type=lib
|
||||
// known-bug: #103507
|
||||
// failure-status: 101
|
||||
// normalize-stderr-test "note: .*\n\n" -> ""
|
||||
// normalize-stderr-test "thread 'rustc' panicked.*\n" -> ""
|
||||
// normalize-stderr-test "(error: internal compiler error: [^:]+):\d+:\d+: " -> "$1:LL:CC: "
|
||||
// rustc-env:RUST_BACKTRACE=0
|
||||
|
||||
#![feature(const_precise_live_drops)]
|
||||
|
||||
pub const fn f() {
|
||||
|
6
tests/ui/consts/precise-drop-with-promoted.stderr
Normal file
6
tests/ui/consts/precise-drop-with-promoted.stderr
Normal file
@ -0,0 +1,6 @@
|
||||
error: the compiler unexpectedly panicked. this is a bug.
|
||||
|
||||
query stack during panic:
|
||||
#0 [mir_drops_elaborated_and_const_checked] elaborating drops for `f`
|
||||
#1 [analysis] running analysis passes on this crate
|
||||
end of query stack
|
@ -1,3 +1,5 @@
|
||||
// known-bug: #103507
|
||||
|
||||
#![feature(const_mut_refs)]
|
||||
#![feature(const_trait_impl)]
|
||||
|
||||
@ -7,15 +9,15 @@ impl const Drop for Panic { fn drop(&mut self) { panic!(); } }
|
||||
pub const fn id<T>(x: T) -> T { x }
|
||||
pub const C: () = {
|
||||
let _: &'static _ = &id(&Panic);
|
||||
//~^ ERROR: temporary value dropped while borrowed
|
||||
//~| ERROR: temporary value dropped while borrowed
|
||||
//FIXME ~^ ERROR: temporary value dropped while borrowed
|
||||
//FIXME ~| ERROR: temporary value dropped while borrowed
|
||||
};
|
||||
|
||||
fn main() {
|
||||
let _: &'static _ = &id(&Panic);
|
||||
//~^ ERROR: temporary value dropped while borrowed
|
||||
//~| ERROR: temporary value dropped while borrowed
|
||||
//FIXME ~^ ERROR: temporary value dropped while borrowed
|
||||
//FIXME ~| ERROR: temporary value dropped while borrowed
|
||||
let _: &'static _ = &&(Panic, 0).1;
|
||||
//~^ ERROR: temporary value dropped while borrowed
|
||||
//~| ERROR: temporary value dropped while borrowed
|
||||
//FIXME~^ ERROR: temporary value dropped while borrowed
|
||||
//FIXME~| ERROR: temporary value dropped while borrowed
|
||||
}
|
||||
|
@ -1,5 +1,13 @@
|
||||
error[E0493]: destructor of `Panic` cannot be evaluated at compile-time
|
||||
--> $DIR/promoted_const_call.rs:11:30
|
||||
|
|
||||
LL | let _: &'static _ = &id(&Panic);
|
||||
| ^^^^^ - value is dropped here
|
||||
| |
|
||||
| the destructor for this type cannot be evaluated in constants
|
||||
|
||||
error[E0716]: temporary value dropped while borrowed
|
||||
--> $DIR/promoted_const_call.rs:9:26
|
||||
--> $DIR/promoted_const_call.rs:11:26
|
||||
|
|
||||
LL | let _: &'static _ = &id(&Panic);
|
||||
| ---------- ^^^^^^^^^^ creates a temporary value which is freed while still in use
|
||||
@ -10,7 +18,7 @@ LL | };
|
||||
| - temporary value is freed at the end of this statement
|
||||
|
||||
error[E0716]: temporary value dropped while borrowed
|
||||
--> $DIR/promoted_const_call.rs:9:30
|
||||
--> $DIR/promoted_const_call.rs:11:30
|
||||
|
|
||||
LL | let _: &'static _ = &id(&Panic);
|
||||
| ---------- ^^^^^ - temporary value is freed at the end of this statement
|
||||
@ -19,7 +27,7 @@ LL | let _: &'static _ = &id(&Panic);
|
||||
| type annotation requires that borrow lasts for `'static`
|
||||
|
||||
error[E0716]: temporary value dropped while borrowed
|
||||
--> $DIR/promoted_const_call.rs:15:26
|
||||
--> $DIR/promoted_const_call.rs:17:26
|
||||
|
|
||||
LL | let _: &'static _ = &id(&Panic);
|
||||
| ---------- ^^^^^^^^^^ creates a temporary value which is freed while still in use
|
||||
@ -30,7 +38,7 @@ LL | }
|
||||
| - temporary value is freed at the end of this statement
|
||||
|
||||
error[E0716]: temporary value dropped while borrowed
|
||||
--> $DIR/promoted_const_call.rs:15:30
|
||||
--> $DIR/promoted_const_call.rs:17:30
|
||||
|
|
||||
LL | let _: &'static _ = &id(&Panic);
|
||||
| ---------- ^^^^^ - temporary value is freed at the end of this statement
|
||||
@ -39,7 +47,7 @@ LL | let _: &'static _ = &id(&Panic);
|
||||
| type annotation requires that borrow lasts for `'static`
|
||||
|
||||
error[E0716]: temporary value dropped while borrowed
|
||||
--> $DIR/promoted_const_call.rs:18:26
|
||||
--> $DIR/promoted_const_call.rs:20:26
|
||||
|
|
||||
LL | let _: &'static _ = &&(Panic, 0).1;
|
||||
| ---------- ^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
|
||||
@ -50,7 +58,7 @@ LL | }
|
||||
| - temporary value is freed at the end of this statement
|
||||
|
||||
error[E0716]: temporary value dropped while borrowed
|
||||
--> $DIR/promoted_const_call.rs:18:27
|
||||
--> $DIR/promoted_const_call.rs:20:27
|
||||
|
|
||||
LL | let _: &'static _ = &&(Panic, 0).1;
|
||||
| ---------- ^^^^^^^^^^ creates a temporary value which is freed while still in use
|
||||
@ -60,6 +68,7 @@ LL | let _: &'static _ = &&(Panic, 0).1;
|
||||
LL | }
|
||||
| - temporary value is freed at the end of this statement
|
||||
|
||||
error: aborting due to 6 previous errors
|
||||
error: aborting due to 7 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0716`.
|
||||
Some errors have detailed explanations: E0493, E0716.
|
||||
For more information about an error, try `rustc --explain E0493`.
|
||||
|
@ -1,9 +1,4 @@
|
||||
// known-bug: #103507
|
||||
// failure-status: 101
|
||||
// normalize-stderr-test "note: .*\n\n" -> ""
|
||||
// normalize-stderr-test "thread 'rustc' panicked.*\n" -> ""
|
||||
// normalize-stderr-test "(error: internal compiler error: [^:]+):\d+:\d+: " -> "$1:LL:CC: "
|
||||
// rustc-env:RUST_BACKTRACE=0
|
||||
|
||||
#![feature(type_alias_impl_trait)]
|
||||
#![feature(const_trait_impl)]
|
||||
|
@ -1,8 +1,12 @@
|
||||
error: internal compiler error: compiler/rustc_middle/src/ty/normalize_erasing_regions.rs:LL:CC: Failed to normalize <for<'a, 'b> fn(&'a Alias<'b>) {foo} as std::ops::FnOnce<(&&S,)>>::Output, maybe try to call `try_normalize_erasing_regions` instead
|
||||
error[E0493]: destructor of `F` cannot be evaluated at compile-time
|
||||
--> $DIR/normalize-tait-in-const.rs:25:79
|
||||
|
|
||||
LL | const fn with_positive<F: ~const for<'a> Fn(&'a Alias<'a>) + ~const Destruct>(fun: F) {
|
||||
| ^^^ the destructor for this type cannot be evaluated in constant functions
|
||||
LL | fun(filter_positive());
|
||||
LL | }
|
||||
| - value is dropped here
|
||||
|
||||
query stack during panic:
|
||||
#0 [eval_to_allocation_raw] const-evaluating + checking `BAR`
|
||||
#1 [eval_to_const_value_raw] simplifying constant for the type system `BAR`
|
||||
end of query stack
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0493`.
|
||||
|
@ -23,7 +23,7 @@ pub const fn add_i32(a: i32, b: i32) -> i32 {
|
||||
|
||||
pub const fn add_u32(a: u32, b: u32) -> u32 {
|
||||
a.plus(b)
|
||||
//~^ ERROR the trait bound
|
||||
//~^ ERROR cannot call
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
@ -1,15 +1,11 @@
|
||||
error[E0277]: the trait bound `u32: ~const Plus` is not satisfied
|
||||
error[E0015]: cannot call non-const fn `<u32 as Plus>::plus` in constant functions
|
||||
--> $DIR/call-const-trait-method-fail.rs:25:7
|
||||
|
|
||||
LL | a.plus(b)
|
||||
| ^^^^ the trait `~const Plus` is not implemented for `u32`
|
||||
| ^^^^^^^
|
||||
|
|
||||
note: the trait `Plus` is implemented for `u32`, but that implementation is not `const`
|
||||
--> $DIR/call-const-trait-method-fail.rs:25:7
|
||||
|
|
||||
LL | a.plus(b)
|
||||
| ^^^^
|
||||
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0277`.
|
||||
For more information about this error, try `rustc --explain E0015`.
|
||||
|
@ -1,15 +1,3 @@
|
||||
error[E0277]: can't compare `T` with `T` in const contexts
|
||||
--> $DIR/call-generic-method-fail.rs:5:5
|
||||
|
|
||||
LL | *t == *t
|
||||
| ^^^^^^^^ no implementation for `T == T`
|
||||
|
|
||||
note: the trait `PartialEq` is implemented for `T`, but that implementation is not `const`
|
||||
--> $DIR/call-generic-method-fail.rs:5:5
|
||||
|
|
||||
LL | *t == *t
|
||||
| ^^^^^^^^
|
||||
|
||||
error[E0015]: cannot call non-const operator in constant functions
|
||||
--> $DIR/call-generic-method-fail.rs:5:5
|
||||
|
|
||||
@ -22,7 +10,6 @@ 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 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 E0015`.
|
||||
|
@ -1,3 +1,6 @@
|
||||
// check-pass
|
||||
// known-bug: #110395
|
||||
|
||||
#![feature(const_trait_impl)]
|
||||
|
||||
struct S;
|
||||
@ -21,6 +24,6 @@ const fn equals_self<T: ~const Foo>(t: &T) -> bool {
|
||||
// it not using the impl.
|
||||
|
||||
pub const EQ: bool = equals_self(&S);
|
||||
//~^ ERROR
|
||||
// FIXME(effects) ~^ ERROR
|
||||
|
||||
fn main() {}
|
||||
|
@ -1,15 +0,0 @@
|
||||
error[E0277]: the trait bound `S: ~const Foo` is not satisfied
|
||||
--> $DIR/call-generic-method-nonconst.rs:23:22
|
||||
|
|
||||
LL | pub const EQ: bool = equals_self(&S);
|
||||
| ^^^^^^^^^^^^^^^ the trait `~const Foo` is not implemented for `S`
|
||||
|
|
||||
note: the trait `Foo` is implemented for `S`, but that implementation is not `const`
|
||||
--> $DIR/call-generic-method-nonconst.rs:23:22
|
||||
|
|
||||
LL | pub const EQ: bool = equals_self(&S);
|
||||
| ^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0277`.
|
@ -1,16 +1,21 @@
|
||||
error[E0277]: the trait bound `(): ~const Tr` is not satisfied in `fn(()) -> i32 {<() as Tr>::a}`
|
||||
--> $DIR/const-closure-trait-method-fail.rs:18:23
|
||||
error[E0080]: evaluation of constant value failed
|
||||
--> $SRC_DIR/core/src/ops/function.rs:LL:COL
|
||||
|
|
||||
LL | const _: () = assert!(need_const_closure(Tr::a) == 42);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ within `fn(()) -> i32 {<() as Tr>::a}`, the trait `~const Tr` is not implemented for `()`
|
||||
= note: calling non-const function `<() as Tr>::a`
|
||||
|
|
||||
note: the trait `Tr` is implemented for `()`, but that implementation is not `const`
|
||||
note: inside `<fn(()) -> i32 {<() as Tr>::a} as FnOnce<((),)>>::call_once - shim(fn(()) -> i32 {<() as Tr>::a})`
|
||||
--> $SRC_DIR/core/src/ops/function.rs:LL:COL
|
||||
note: inside `need_const_closure::<fn(()) -> i32 {<() as Tr>::a}>`
|
||||
--> $DIR/const-closure-trait-method-fail.rs:15:5
|
||||
|
|
||||
LL | x(())
|
||||
| ^^^^^
|
||||
note: inside `_`
|
||||
--> $DIR/const-closure-trait-method-fail.rs:18:23
|
||||
|
|
||||
LL | const _: () = assert!(need_const_closure(Tr::a) == 42);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: required because it appears within the type `fn(()) -> i32 {<() as Tr>::a}`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0277`.
|
||||
For more information about this error, try `rustc --explain E0080`.
|
||||
|
@ -22,7 +22,7 @@ impl const ConstDefaultFn for ConstImpl {
|
||||
|
||||
const fn test() {
|
||||
NonConstImpl.a();
|
||||
//~^ ERROR the trait bound
|
||||
//~^ ERROR cannot call
|
||||
ConstImpl.a();
|
||||
}
|
||||
|
||||
|
@ -1,15 +1,11 @@
|
||||
error[E0277]: the trait bound `NonConstImpl: ~const ConstDefaultFn` is not satisfied
|
||||
error[E0015]: cannot call non-const fn `<NonConstImpl as ConstDefaultFn>::a` in constant functions
|
||||
--> $DIR/const-default-method-bodies.rs:24:18
|
||||
|
|
||||
LL | NonConstImpl.a();
|
||||
| ^ 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:5
|
||||
|
|
||||
LL | NonConstImpl.a();
|
||||
| ^^^^^^^^^^^^
|
||||
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0277`.
|
||||
For more information about this error, try `rustc --explain E0015`.
|
||||
|
@ -1,4 +1,5 @@
|
||||
// check-pass
|
||||
// known-bug: #110395
|
||||
// FIXME check-pass
|
||||
|
||||
#![feature(const_trait_impl)]
|
||||
#![feature(const_precise_live_drops)]
|
||||
|
@ -0,0 +1,9 @@
|
||||
error[E0493]: destructor of `E` cannot be evaluated at compile-time
|
||||
--> $DIR/const-drop-bound.rs:12:13
|
||||
|
|
||||
LL | Err(_e) => None,
|
||||
| ^^ the destructor for this type cannot be evaluated in constant functions
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0493`.
|
@ -1,50 +1,11 @@
|
||||
error[E0277]: the trait bound `NonTrivialDrop: ~const A` is not satisfied
|
||||
--> $DIR/const-drop-fail-2.rs:31:23
|
||||
error[E0493]: destructor of `T` cannot be evaluated at compile-time
|
||||
--> $DIR/const-drop-fail-2.rs:29:36
|
||||
|
|
||||
LL | const _: () = check::<ConstDropImplWithBounds<NonTrivialDrop>>(
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `~const A` is not implemented for `NonTrivialDrop`
|
||||
|
|
||||
note: the trait `A` is implemented for `NonTrivialDrop`, but that implementation is not `const`
|
||||
--> $DIR/const-drop-fail-2.rs:31:23
|
||||
|
|
||||
LL | const _: () = check::<ConstDropImplWithBounds<NonTrivialDrop>>(
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
note: required by a bound in `ConstDropImplWithBounds`
|
||||
--> $DIR/const-drop-fail-2.rs:21:35
|
||||
|
|
||||
LL | struct ConstDropImplWithBounds<T: ~const A>(PhantomData<T>);
|
||||
| ^^^^^^^^ required by this bound in `ConstDropImplWithBounds`
|
||||
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 `NonTrivialDrop: ~const A` is not satisfied
|
||||
--> $DIR/const-drop-fail-2.rs:32:5
|
||||
|
|
||||
LL | ConstDropImplWithBounds(PhantomData)
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `~const A` is not implemented for `NonTrivialDrop`
|
||||
|
|
||||
note: the trait `A` is implemented for `NonTrivialDrop`, but that implementation is not `const`
|
||||
--> $DIR/const-drop-fail-2.rs:32:5
|
||||
|
|
||||
LL | ConstDropImplWithBounds(PhantomData)
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
note: required by a bound in `ConstDropImplWithBounds`
|
||||
--> $DIR/const-drop-fail-2.rs:21:35
|
||||
|
|
||||
LL | struct ConstDropImplWithBounds<T: ~const A>(PhantomData<T>);
|
||||
| ^^^^^^^^ required by this bound in `ConstDropImplWithBounds`
|
||||
error: aborting due to previous error
|
||||
|
||||
error[E0367]: `Drop` impl requires `T: ~const A` but the struct it is implemented for does not
|
||||
--> $DIR/const-drop-fail-2.rs:37:9
|
||||
|
|
||||
LL | impl<T: ~const A> const Drop for ConstDropImplWithNonConstBounds<T> {
|
||||
| ^^^^^^^^
|
||||
|
|
||||
note: the implementor must specify the same requirement
|
||||
--> $DIR/const-drop-fail-2.rs:35:1
|
||||
|
|
||||
LL | struct ConstDropImplWithNonConstBounds<T: A>(PhantomData<T>);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0277, E0367.
|
||||
For more information about an error, try `rustc --explain E0277`.
|
||||
For more information about this error, try `rustc --explain E0493`.
|
||||
|
@ -1,58 +1,9 @@
|
||||
error[E0277]: can't drop `NonTrivialDrop` in const contexts
|
||||
--> $DIR/const-drop-fail.rs:28:23
|
||||
error[E0493]: destructor of `T` cannot be evaluated at compile-time
|
||||
--> $DIR/const-drop-fail.rs:24:36
|
||||
|
|
||||
LL | const _: () = check($exp);
|
||||
| ^^^^^^^^^^^ the trait `~const Destruct` is not implemented for `NonTrivialDrop`
|
||||
...
|
||||
LL | / check_all! {
|
||||
LL | | NonTrivialDrop,
|
||||
LL | | ConstImplWithDropGlue(NonTrivialDrop),
|
||||
LL | | }
|
||||
| |_- in this macro invocation
|
||||
|
|
||||
note: the trait `Destruct` is implemented for `NonTrivialDrop`, but that implementation is not `const`
|
||||
--> $DIR/const-drop-fail.rs:28:23
|
||||
|
|
||||
LL | const _: () = check($exp);
|
||||
| ^^^^^^^^^^^
|
||||
...
|
||||
LL | / check_all! {
|
||||
LL | | NonTrivialDrop,
|
||||
LL | | ConstImplWithDropGlue(NonTrivialDrop),
|
||||
LL | | }
|
||||
| |_- in this macro invocation
|
||||
= note: this error originates in the macro `check_all` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
LL | const fn check<T: ~const Destruct>(_: T) {}
|
||||
| ^ the destructor for this type cannot be evaluated in constant functions
|
||||
|
||||
error[E0277]: can't drop `NonTrivialDrop` in const contexts
|
||||
--> $DIR/const-drop-fail.rs:28:23
|
||||
|
|
||||
LL | const _: () = check($exp);
|
||||
| ^^^^^^^^^^^ within `ConstImplWithDropGlue`, the trait `~const Destruct` is not implemented for `NonTrivialDrop`
|
||||
...
|
||||
LL | / check_all! {
|
||||
LL | | NonTrivialDrop,
|
||||
LL | | ConstImplWithDropGlue(NonTrivialDrop),
|
||||
LL | | }
|
||||
| |_- in this macro invocation
|
||||
|
|
||||
note: the trait `Destruct` is implemented for `NonTrivialDrop`, but that implementation is not `const`
|
||||
--> $DIR/const-drop-fail.rs:28:23
|
||||
|
|
||||
LL | const _: () = check($exp);
|
||||
| ^^^^^^^^^^^
|
||||
...
|
||||
LL | / check_all! {
|
||||
LL | | NonTrivialDrop,
|
||||
LL | | ConstImplWithDropGlue(NonTrivialDrop),
|
||||
LL | | }
|
||||
| |_- in this macro invocation
|
||||
note: required because it appears within the type `ConstImplWithDropGlue`
|
||||
--> $DIR/const-drop-fail.rs:18:8
|
||||
|
|
||||
LL | struct ConstImplWithDropGlue(NonTrivialDrop);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: this error originates in the macro `check_all` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
error: aborting due to previous error
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0277`.
|
||||
For more information about this error, try `rustc --explain E0493`.
|
||||
|
@ -1,58 +1,11 @@
|
||||
error[E0277]: can't drop `NonTrivialDrop` in const contexts
|
||||
--> $DIR/const-drop-fail.rs:28:23
|
||||
error[E0493]: destructor of `T` cannot be evaluated at compile-time
|
||||
--> $DIR/const-drop-fail.rs:24:36
|
||||
|
|
||||
LL | const _: () = check($exp);
|
||||
| ^^^^^^^^^^^ the trait `~const Destruct` is not implemented for `NonTrivialDrop`
|
||||
...
|
||||
LL | / check_all! {
|
||||
LL | | NonTrivialDrop,
|
||||
LL | | ConstImplWithDropGlue(NonTrivialDrop),
|
||||
LL | | }
|
||||
| |_- in this macro invocation
|
||||
|
|
||||
note: the trait `Destruct` is implemented for `NonTrivialDrop`, but that implementation is not `const`
|
||||
--> $DIR/const-drop-fail.rs:28:23
|
||||
|
|
||||
LL | const _: () = check($exp);
|
||||
| ^^^^^^^^^^^
|
||||
...
|
||||
LL | / check_all! {
|
||||
LL | | NonTrivialDrop,
|
||||
LL | | ConstImplWithDropGlue(NonTrivialDrop),
|
||||
LL | | }
|
||||
| |_- in this macro invocation
|
||||
= note: this error originates in the macro `check_all` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
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]: can't drop `NonTrivialDrop` in const contexts
|
||||
--> $DIR/const-drop-fail.rs:28:23
|
||||
|
|
||||
LL | const _: () = check($exp);
|
||||
| ^^^^^^^^^^^ within `ConstImplWithDropGlue`, the trait `~const Destruct` is not implemented for `NonTrivialDrop`
|
||||
...
|
||||
LL | / check_all! {
|
||||
LL | | NonTrivialDrop,
|
||||
LL | | ConstImplWithDropGlue(NonTrivialDrop),
|
||||
LL | | }
|
||||
| |_- in this macro invocation
|
||||
|
|
||||
note: the trait `Destruct` is implemented for `NonTrivialDrop`, but that implementation is not `const`
|
||||
--> $DIR/const-drop-fail.rs:28:23
|
||||
|
|
||||
LL | const _: () = check($exp);
|
||||
| ^^^^^^^^^^^
|
||||
...
|
||||
LL | / check_all! {
|
||||
LL | | NonTrivialDrop,
|
||||
LL | | ConstImplWithDropGlue(NonTrivialDrop),
|
||||
LL | | }
|
||||
| |_- in this macro invocation
|
||||
note: required because it appears within the type `ConstImplWithDropGlue`
|
||||
--> $DIR/const-drop-fail.rs:18:8
|
||||
|
|
||||
LL | struct ConstImplWithDropGlue(NonTrivialDrop);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: this error originates in the macro `check_all` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
error: aborting due to previous error
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0277`.
|
||||
For more information about this error, try `rustc --explain E0493`.
|
||||
|
@ -0,0 +1,19 @@
|
||||
error[E0493]: destructor of `T` cannot be evaluated at compile-time
|
||||
--> $DIR/const-drop.rs:19:32
|
||||
|
|
||||
LL | const fn a<T: ~const Destruct>(_: T) {}
|
||||
| ^ - value is dropped here
|
||||
| |
|
||||
| the destructor for this type cannot be evaluated in constant functions
|
||||
|
||||
error[E0493]: destructor of `S<'_>` cannot be evaluated at compile-time
|
||||
--> $DIR/const-drop.rs:24:13
|
||||
|
|
||||
LL | let _ = S(&mut c);
|
||||
| ^^^^^^^^^- value is dropped here
|
||||
| |
|
||||
| the destructor for this type cannot be evaluated in constant functions
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0493`.
|
@ -1,9 +1,10 @@
|
||||
// run-pass
|
||||
// FIXME run-pass
|
||||
// known-bug: #110395
|
||||
// revisions: stock precise
|
||||
#![feature(const_trait_impl)]
|
||||
#![feature(const_mut_refs)]
|
||||
#![feature(never_type)]
|
||||
#![cfg_attr(precise, feature(const_precise_live_drops))]
|
||||
// #![cfg_attr(precise, feature(const_precise_live_drops))]
|
||||
|
||||
use std::marker::Destruct;
|
||||
|
||||
@ -16,10 +17,12 @@ impl<'a> const Drop for S<'a> {
|
||||
}
|
||||
|
||||
const fn a<T: ~const Destruct>(_: T) {}
|
||||
//FIXME ~^ ERROR destructor of
|
||||
|
||||
const fn b() -> u8 {
|
||||
let mut c = 0;
|
||||
let _ = S(&mut c);
|
||||
//FIXME ~^ ERROR destructor of
|
||||
a(S(&mut c));
|
||||
c
|
||||
}
|
||||
|
@ -0,0 +1,19 @@
|
||||
error[E0493]: destructor of `T` cannot be evaluated at compile-time
|
||||
--> $DIR/const-drop.rs:19:32
|
||||
|
|
||||
LL | const fn a<T: ~const Destruct>(_: T) {}
|
||||
| ^ - value is dropped here
|
||||
| |
|
||||
| the destructor for this type cannot be evaluated in constant functions
|
||||
|
||||
error[E0493]: destructor of `S<'_>` cannot be evaluated at compile-time
|
||||
--> $DIR/const-drop.rs:24:13
|
||||
|
|
||||
LL | let _ = S(&mut c);
|
||||
| ^^^^^^^^^- value is dropped here
|
||||
| |
|
||||
| the destructor for this type cannot be evaluated in constant functions
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0493`.
|
@ -1,15 +1,11 @@
|
||||
error[E0277]: the trait bound `cross_crate::NonConst: ~const cross_crate::MyTrait` is not satisfied
|
||||
error[E0015]: cannot call non-const fn `<cross_crate::NonConst as cross_crate::MyTrait>::func` in constant functions
|
||||
--> $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:5
|
||||
|
|
||||
LL | NonConst.func();
|
||||
| ^^^^^^^^
|
||||
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0277`.
|
||||
For more information about this error, try `rustc --explain E0015`.
|
||||
|
@ -15,10 +15,11 @@ fn non_const_context() {
|
||||
const fn const_context() {
|
||||
#[cfg(any(stocknc, gatednc))]
|
||||
NonConst.func();
|
||||
//[stocknc]~^ ERROR: the trait bound
|
||||
//[gatednc]~^^ ERROR: the trait bound
|
||||
//[stocknc]~^ ERROR: cannot call
|
||||
//[gatednc]~^^ ERROR: cannot call
|
||||
Const.func();
|
||||
//[stock]~^ ERROR: cannot call
|
||||
//[stocknc]~^^ ERROR: cannot call
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
@ -1,15 +1,21 @@
|
||||
error[E0277]: the trait bound `cross_crate::NonConst: cross_crate::MyTrait` is not satisfied
|
||||
error[E0015]: cannot call non-const fn `<cross_crate::NonConst as cross_crate::MyTrait>::func` in constant functions
|
||||
--> $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:5
|
||||
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
|
||||
= help: add `#![feature(const_trait_impl)]` to the crate attributes to enable
|
||||
|
||||
error[E0015]: cannot call non-const fn `<cross_crate::Const as cross_crate::MyTrait>::func` in constant functions
|
||||
--> $DIR/cross-crate.rs:20:11
|
||||
|
|
||||
LL | NonConst.func();
|
||||
| ^^^^^^^^
|
||||
LL | Const.func();
|
||||
| ^^^^^^
|
||||
|
|
||||
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
|
||||
= help: add `#![feature(const_trait_impl)]` to the crate attributes to enable
|
||||
|
||||
error: aborting due to previous error
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0277`.
|
||||
For more information about this error, try `rustc --explain E0015`.
|
||||
|
@ -1,3 +1,6 @@
|
||||
// known-bug: #110395
|
||||
// check-pass
|
||||
|
||||
#![feature(const_trait_impl)]
|
||||
|
||||
#[const_trait]
|
||||
@ -10,7 +13,7 @@ const fn foo<T>() where T: ~const Tr {}
|
||||
pub trait Foo {
|
||||
fn foo() {
|
||||
foo::<()>();
|
||||
//~^ ERROR the trait bound `(): ~const Tr` is not satisfied
|
||||
//FIXME ~^ ERROR the trait bound `(): ~const Tr` is not satisfied
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,15 +0,0 @@
|
||||
error[E0277]: the trait bound `(): ~const Tr` is not satisfied
|
||||
--> $DIR/default-method-body-is-const-body-checking.rs:12:9
|
||||
|
|
||||
LL | foo::<()>();
|
||||
| ^^^^^^^^^^^ 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-body-checking.rs:12:9
|
||||
|
|
||||
LL | foo::<()>();
|
||||
| ^^^^^^^^^^^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0277`.
|
@ -1,3 +1,4 @@
|
||||
// known-bug: #110395
|
||||
#![feature(const_trait_impl)]
|
||||
|
||||
#[const_trait]
|
||||
@ -6,7 +7,7 @@ pub trait Tr {
|
||||
|
||||
fn b(&self) {
|
||||
().a()
|
||||
//~^ ERROR the trait bound
|
||||
//FIXME ~^ ERROR the trait bound
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,15 +1,11 @@
|
||||
error[E0277]: the trait bound `(): ~const Tr` is not satisfied
|
||||
--> $DIR/default-method-body-is-const-same-trait-ck.rs:8:12
|
||||
error[E0015]: cannot call non-const fn `<() as Tr>::a` in constant functions
|
||||
--> $DIR/default-method-body-is-const-same-trait-ck.rs:9:12
|
||||
|
|
||||
LL | ().a()
|
||||
| ^ 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:9
|
||||
|
|
||||
LL | ().a()
|
||||
| ^^
|
||||
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0277`.
|
||||
For more information about this error, try `rustc --explain E0015`.
|
||||
|
@ -1,11 +1,12 @@
|
||||
// known-bug: #110395
|
||||
#![feature(const_trait_impl)]
|
||||
|
||||
struct Bug {
|
||||
inner: [(); match || 1 {
|
||||
n => n(),
|
||||
//~^ ERROR the trait bound
|
||||
//~| ERROR the trait bound
|
||||
//~| ERROR cannot call non-const closure in constants
|
||||
//FIXME ~^ ERROR the trait bound
|
||||
//FIXME ~| ERROR the trait bound
|
||||
//FIXME ~| ERROR cannot call non-const closure in constants
|
||||
}],
|
||||
}
|
||||
|
||||
|
@ -1,41 +1,11 @@
|
||||
error[E0277]: the trait bound `[closure@$DIR/issue-102985.rs:4:23: 4:25]: ~const Fn<()>` is not satisfied
|
||||
--> $DIR/issue-102985.rs:5:14
|
||||
|
|
||||
LL | n => n(),
|
||||
| ^^^ expected an `Fn<()>` closure, found `[closure@$DIR/issue-102985.rs:4:23: 4:25]`
|
||||
|
|
||||
= help: the trait `~const Fn<()>` is not implemented for closure `[closure@$DIR/issue-102985.rs:4:23: 4:25]`
|
||||
note: the trait `Fn<()>` is implemented for `[closure@$DIR/issue-102985.rs:4:23: 4:25]`, but that implementation is not `const`
|
||||
--> $DIR/issue-102985.rs:5:14
|
||||
|
|
||||
LL | n => n(),
|
||||
| ^^^
|
||||
= note: wrap the `[closure@$DIR/issue-102985.rs:4:23: 4:25]` in a closure with no arguments: `|| { /* code */ }`
|
||||
|
||||
error[E0277]: the trait bound `[closure@$DIR/issue-102985.rs:4:23: 4:25]: ~const Fn<()>` is not satisfied
|
||||
--> $DIR/issue-102985.rs:5:14
|
||||
|
|
||||
LL | n => n(),
|
||||
| ^^^ expected an `Fn<()>` closure, found `[closure@$DIR/issue-102985.rs:4:23: 4:25]`
|
||||
|
|
||||
= help: the trait `~const Fn<()>` is not implemented for closure `[closure@$DIR/issue-102985.rs:4:23: 4:25]`
|
||||
note: the trait `Fn<()>` is implemented for `[closure@$DIR/issue-102985.rs:4:23: 4:25]`, but that implementation is not `const`
|
||||
--> $DIR/issue-102985.rs:5:14
|
||||
|
|
||||
LL | n => n(),
|
||||
| ^^^
|
||||
= note: wrap the `[closure@$DIR/issue-102985.rs:4:23: 4:25]` in a closure with no arguments: `|| { /* code */ }`
|
||||
|
||||
error[E0015]: cannot call non-const closure in constants
|
||||
--> $DIR/issue-102985.rs:5:14
|
||||
--> $DIR/issue-102985.rs:6:14
|
||||
|
|
||||
LL | n => n(),
|
||||
| ^^^
|
||||
|
|
||||
= note: closures need an RFC before allowed to be called in constants
|
||||
= note: calls in constants are limited to constant functions, tuple structs and tuple variants
|
||||
|
||||
error: aborting due to 3 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 E0015`.
|
||||
|
@ -1,3 +1,5 @@
|
||||
// known-bug: #110395
|
||||
|
||||
#![feature(const_trait_impl)]
|
||||
|
||||
pub trait A {
|
||||
@ -6,8 +8,8 @@ pub trait A {
|
||||
|
||||
pub const fn foo<T: A>() -> bool {
|
||||
T::assoc()
|
||||
//~^ ERROR the trait bound
|
||||
//~| ERROR cannot call non-const fn
|
||||
//FIXME ~^ ERROR the trait bound
|
||||
//FIXME ~| ERROR cannot call non-const fn
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
@ -1,24 +1,11 @@
|
||||
error[E0277]: the trait bound `T: ~const A` is not satisfied
|
||||
--> $DIR/issue-88155.rs:8:5
|
||||
|
|
||||
LL | T::assoc()
|
||||
| ^^^^^^^^^^ the trait `~const A` is not implemented for `T`
|
||||
|
|
||||
note: the trait `A` is implemented for `T`, but that implementation is not `const`
|
||||
--> $DIR/issue-88155.rs:8:5
|
||||
|
|
||||
LL | T::assoc()
|
||||
| ^^^^^^^^^^
|
||||
|
||||
error[E0015]: cannot call non-const fn `<T as A>::assoc` in constant functions
|
||||
--> $DIR/issue-88155.rs:8:5
|
||||
--> $DIR/issue-88155.rs:10:5
|
||||
|
|
||||
LL | T::assoc()
|
||||
| ^^^^^^^^^^
|
||||
|
|
||||
= 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
|
||||
|
||||
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 E0015`.
|
||||
|
@ -1,6 +1,7 @@
|
||||
// Regression test for #92111.
|
||||
//
|
||||
// check-pass
|
||||
// known-bug: #110395
|
||||
// FIXME check-pass
|
||||
|
||||
#![feature(const_trait_impl)]
|
||||
|
||||
|
11
tests/ui/rfcs/rfc-2632-const-trait-impl/issue-92111.stderr
Normal file
11
tests/ui/rfcs/rfc-2632-const-trait-impl/issue-92111.stderr
Normal file
@ -0,0 +1,11 @@
|
||||
error[E0493]: destructor of `T` cannot be evaluated at compile-time
|
||||
--> $DIR/issue-92111.rs:20:32
|
||||
|
|
||||
LL | const fn a<T: ~const Destruct>(t: T) {}
|
||||
| ^ - value is dropped here
|
||||
| |
|
||||
| the destructor for this type cannot be evaluated in constant functions
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0493`.
|
@ -1,26 +1,12 @@
|
||||
error[E0277]: can't compare `str` with `str` in const contexts
|
||||
--> $DIR/match-non-const-eq.rs:6:9
|
||||
|
|
||||
LL | "a" => (),
|
||||
| ^^^ no implementation for `str == str`
|
||||
|
|
||||
= help: the trait `~const PartialEq` is not implemented for `str`
|
||||
note: the trait `PartialEq` is implemented for `str`, but that implementation is not `const`
|
||||
--> $DIR/match-non-const-eq.rs:6:9
|
||||
|
|
||||
LL | "a" => (),
|
||||
| ^^^
|
||||
|
||||
error[E0015]: cannot match on `str` in constant functions
|
||||
--> $DIR/match-non-const-eq.rs:6:9
|
||||
--> $DIR/match-non-const-eq.rs:7:9
|
||||
|
|
||||
LL | "a" => (),
|
||||
LL | "a" => (), //FIXME [gated]~ ERROR can't compare `str` with `str` in const contexts
|
||||
| ^^^
|
||||
|
|
||||
= note: `str` cannot be compared in compile-time, and therefore cannot be used in `match`es
|
||||
= 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
|
||||
|
||||
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 E0015`.
|
||||
|
@ -1,10 +1,11 @@
|
||||
// known-bug: #110395
|
||||
// revisions: stock gated
|
||||
#![cfg_attr(gated, feature(const_trait_impl))]
|
||||
|
||||
const fn foo(input: &'static str) {
|
||||
match input {
|
||||
"a" => (), //[gated]~ ERROR can't compare `str` with `str` in const contexts
|
||||
//~^ ERROR cannot match on `str` in constant functions
|
||||
"a" => (), //FIXME [gated]~ ERROR can't compare `str` with `str` in const contexts
|
||||
//FIXME ~^ ERROR cannot match on `str` in constant functions
|
||||
_ => (),
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
error[E0015]: cannot match on `str` in constant functions
|
||||
--> $DIR/match-non-const-eq.rs:6:9
|
||||
--> $DIR/match-non-const-eq.rs:7:9
|
||||
|
|
||||
LL | "a" => (),
|
||||
LL | "a" => (), //FIXME [gated]~ ERROR can't compare `str` with `str` in const contexts
|
||||
| ^^^
|
||||
|
|
||||
= note: `str` cannot be compared in compile-time, and therefore cannot be used in `match`es
|
||||
|
@ -1,5 +1,6 @@
|
||||
// Tests that trait bounds on specializing trait impls must be `~const` if the
|
||||
// same bound is present on the default impl and is `~const` there.
|
||||
// known-bug: #110395
|
||||
|
||||
#![feature(const_trait_impl)]
|
||||
#![feature(rustc_attrs)]
|
||||
@ -29,7 +30,7 @@ where
|
||||
|
||||
impl<T> Bar for T
|
||||
where
|
||||
T: Foo, //~ ERROR missing `~const` qualifier
|
||||
T: Foo, //FIXME ~ ERROR missing `~const` qualifier
|
||||
T: Specialize,
|
||||
{
|
||||
fn bar() {}
|
||||
@ -47,7 +48,7 @@ where
|
||||
default fn baz() {}
|
||||
}
|
||||
|
||||
impl<T> const Baz for T //~ ERROR conflicting implementations of trait `Baz`
|
||||
impl<T> const Baz for T //FIXME ~ ERROR conflicting implementations of trait `Baz`
|
||||
where
|
||||
T: Foo,
|
||||
T: Specialize,
|
||||
|
@ -1,18 +1,14 @@
|
||||
error: missing `~const` qualifier for specialization
|
||||
--> $DIR/const-default-bound-non-const-specialized-bound.rs:32:8
|
||||
--> $DIR/const-default-bound-non-const-specialized-bound.rs:33:8
|
||||
|
|
||||
LL | T: Foo, //FIXME ~ ERROR missing `~const` qualifier
|
||||
| ^^^
|
||||
|
||||
error: missing `~const` qualifier for specialization
|
||||
--> $DIR/const-default-bound-non-const-specialized-bound.rs:53:8
|
||||
|
|
||||
LL | T: Foo,
|
||||
| ^^^
|
||||
|
||||
error[E0119]: conflicting implementations of trait `Baz`
|
||||
--> $DIR/const-default-bound-non-const-specialized-bound.rs:50:1
|
||||
|
|
||||
LL | impl<T> const Baz for T
|
||||
| ----------------------- first implementation here
|
||||
...
|
||||
LL | impl<T> const Baz for T
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0119`.
|
||||
|
@ -1,5 +1,5 @@
|
||||
#![feature(const_trait_impl, min_specialization, rustc_attrs)]
|
||||
|
||||
// known-bug: #110395
|
||||
#[rustc_specialization_trait]
|
||||
#[const_trait]
|
||||
pub trait Sup {}
|
||||
@ -25,7 +25,7 @@ impl<T: Default + ~const Sup> const A for T {
|
||||
|
||||
const fn generic<T: Default>() {
|
||||
<T as A>::a();
|
||||
//~^ ERROR: the trait bound `T: ~const Sup` is not satisfied
|
||||
//FIXME ~^ ERROR: the trait bound `T: ~const Sup` is not satisfied
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
@ -1,21 +1,11 @@
|
||||
error[E0277]: the trait bound `T: ~const Sup` is not satisfied
|
||||
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();
|
||||
| ^^^^^^^^^^^^^ the trait `~const Sup` is not implemented for `T`
|
||||
| ^^^^^^^^^^^^^
|
||||
|
|
||||
note: required for `T` to implement `~const A`
|
||||
--> $DIR/specializing-constness-2.rs:20:37
|
||||
|
|
||||
LL | impl<T: Default + ~const Sup> const A for T {
|
||||
| ---------- ^ ^
|
||||
| |
|
||||
| unsatisfied trait bound introduced here
|
||||
help: consider further restricting this bound
|
||||
|
|
||||
LL | const fn generic<T: Default + ~const Sup>() {
|
||||
| ++++++++++++
|
||||
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0277`.
|
||||
For more information about this error, try `rustc --explain E0015`.
|
||||
|
@ -1,5 +1,5 @@
|
||||
#![feature(const_trait_impl)]
|
||||
|
||||
// known-bug: #110395
|
||||
// revisions: yy yn ny nn
|
||||
|
||||
#[cfg_attr(any(yy, yn), const_trait)]
|
||||
@ -9,12 +9,12 @@ trait Foo {
|
||||
|
||||
#[cfg_attr(any(yy, ny), const_trait)]
|
||||
trait Bar: ~const Foo {}
|
||||
//[ny,nn]~^ ERROR: ~const can only be applied to `#[const_trait]`
|
||||
//[ny,nn]~| ERROR: ~const can only be applied to `#[const_trait]`
|
||||
// FIXME [ny,nn]~^ ERROR: ~const can only be applied to `#[const_trait]`
|
||||
// FIXME [ny,nn]~| ERROR: ~const can only be applied to `#[const_trait]`
|
||||
|
||||
const fn foo<T: Bar>(x: &T) {
|
||||
x.a();
|
||||
//[yn,yy]~^ ERROR the trait bound
|
||||
// FIXME [yn,yy]~^ ERROR the trait bound
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
@ -1,19 +1,11 @@
|
||||
error[E0277]: the trait bound `T: ~const Foo` is not satisfied
|
||||
error[E0015]: cannot call non-const fn `<T as Foo>::a` in constant functions
|
||||
--> $DIR/super-traits-fail-2.rs:16:7
|
||||
|
|
||||
LL | x.a();
|
||||
| ^ the trait `~const Foo` is not implemented for `T`
|
||||
| ^^^
|
||||
|
|
||||
note: the trait `Foo` is implemented for `T`, but that implementation is not `const`
|
||||
--> $DIR/super-traits-fail-2.rs:16:5
|
||||
|
|
||||
LL | x.a();
|
||||
| ^
|
||||
help: consider further restricting this bound
|
||||
|
|
||||
LL | const fn foo<T: Bar + ~const Foo>(x: &T) {
|
||||
| ++++++++++++
|
||||
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0277`.
|
||||
For more information about this error, try `rustc --explain E0015`.
|
||||
|
@ -1,19 +1,11 @@
|
||||
error[E0277]: the trait bound `T: ~const Foo` is not satisfied
|
||||
error[E0015]: cannot call non-const fn `<T as Foo>::a` in constant functions
|
||||
--> $DIR/super-traits-fail-2.rs:16:7
|
||||
|
|
||||
LL | x.a();
|
||||
| ^ the trait `~const Foo` is not implemented for `T`
|
||||
| ^^^
|
||||
|
|
||||
note: the trait `Foo` is implemented for `T`, but that implementation is not `const`
|
||||
--> $DIR/super-traits-fail-2.rs:16:5
|
||||
|
|
||||
LL | x.a();
|
||||
| ^
|
||||
help: consider further restricting this bound
|
||||
|
|
||||
LL | const fn foo<T: Bar + ~const Foo>(x: &T) {
|
||||
| ++++++++++++
|
||||
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0277`.
|
||||
For more information about this error, try `rustc --explain E0015`.
|
||||
|
@ -1,3 +1,6 @@
|
||||
// check-pass
|
||||
// known-bug: #110395
|
||||
|
||||
#![feature(const_trait_impl)]
|
||||
|
||||
#[const_trait]
|
||||
@ -13,6 +16,6 @@ impl Foo for S {
|
||||
}
|
||||
|
||||
impl const Bar for S {}
|
||||
//~^ ERROR the trait bound
|
||||
//FIXME ~^ ERROR the trait bound
|
||||
|
||||
fn main() {}
|
||||
|
@ -1,20 +0,0 @@
|
||||
error[E0277]: the trait bound `S: ~const Foo` is not satisfied
|
||||
--> $DIR/super-traits-fail.rs:15:20
|
||||
|
|
||||
LL | impl const Bar for S {}
|
||||
| ^ the trait `~const Foo` is not implemented for `S`
|
||||
|
|
||||
note: the trait `Foo` is implemented for `S`, but that implementation is not `const`
|
||||
--> $DIR/super-traits-fail.rs:15:20
|
||||
|
|
||||
LL | impl const Bar for S {}
|
||||
| ^
|
||||
note: required by a bound in `Bar`
|
||||
--> $DIR/super-traits-fail.rs:8:12
|
||||
|
|
||||
LL | trait Bar: ~const Foo {}
|
||||
| ^^^^^^^^^^ required by this bound in `Bar`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0277`.
|
@ -2,6 +2,8 @@
|
||||
// Checking the validity of traits' where clauses happen at a later stage.
|
||||
// (`rustc_const_eval` instead of `rustc_hir_analysis`) Therefore one file as a
|
||||
// test is not enough.
|
||||
// known-bug: #110395
|
||||
// check-pass
|
||||
#![feature(const_trait_impl)]
|
||||
|
||||
#[const_trait]
|
||||
@ -17,9 +19,9 @@ trait Foo {
|
||||
const fn test1<T: ~const Foo + Bar>() {
|
||||
T::a();
|
||||
T::b();
|
||||
//~^ ERROR the trait bound
|
||||
//FIXME ~^ ERROR the trait bound
|
||||
T::c::<T>();
|
||||
//~^ ERROR the trait bound
|
||||
//FIXME ~^ ERROR the trait bound
|
||||
}
|
||||
|
||||
const fn test2<T: ~const Foo + ~const Bar>() {
|
||||
|
@ -1,35 +0,0 @@
|
||||
error[E0277]: the trait bound `T: ~const Bar` is not satisfied
|
||||
--> $DIR/trait-where-clause-const.rs:19:5
|
||||
|
|
||||
LL | T::b();
|
||||
| ^^^^^^ the trait `~const Bar` is not implemented for `T`
|
||||
|
|
||||
note: the trait `Bar` is implemented for `T`, but that implementation is not `const`
|
||||
--> $DIR/trait-where-clause-const.rs:19:5
|
||||
|
|
||||
LL | T::b();
|
||||
| ^^^^^^
|
||||
help: consider further restricting this bound
|
||||
|
|
||||
LL | const fn test1<T: ~const Foo + Bar + ~const Bar>() {
|
||||
| ++++++++++++
|
||||
|
||||
error[E0277]: the trait bound `T: ~const Bar` is not satisfied
|
||||
--> $DIR/trait-where-clause-const.rs:21:5
|
||||
|
|
||||
LL | T::c::<T>();
|
||||
| ^^^^^^^^^^^ the trait `~const Bar` is not implemented for `T`
|
||||
|
|
||||
note: the trait `Bar` is implemented for `T`, but that implementation is not `const`
|
||||
--> $DIR/trait-where-clause-const.rs:21:5
|
||||
|
|
||||
LL | T::c::<T>();
|
||||
| ^^^^^^^^^^^
|
||||
help: consider further restricting this bound
|
||||
|
|
||||
LL | const fn test1<T: ~const Foo + Bar + ~const Bar>() {
|
||||
| ++++++++++++
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0277`.
|
Loading…
Reference in New Issue
Block a user