Skip to content
/ rust Public
forked from rust-lang/rust

Commit 2d59451

Browse files
committed
update tests, adding known-bug
1 parent e6b423a commit 2d59451

File tree

65 files changed

+288
-660
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+288
-660
lines changed
-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
struct X<const N: usize = {
22
(||1usize)()
33
//~^ ERROR cannot call non-const closure
4-
//~| ERROR the trait bound
54
}>;
65

76
fn main() {}
+2-17
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,3 @@
1-
error[E0277]: the trait bound `[closure@$DIR/issue-93647.rs:2:6: 2:8]: Fn<()>` is not satisfied
2-
--> $DIR/issue-93647.rs:2:5
3-
|
4-
LL | (||1usize)()
5-
| ^^^^^^^^^^^^ expected an `Fn<()>` closure, found `[closure@$DIR/issue-93647.rs:2:6: 2:8]`
6-
|
7-
= help: the trait `~const Fn<()>` is not implemented for closure `[closure@$DIR/issue-93647.rs:2:6: 2:8]`
8-
note: the trait `Fn<()>` is implemented for `[closure@$DIR/issue-93647.rs:2:6: 2:8]`, but that implementation is not `const`
9-
--> $DIR/issue-93647.rs:2:5
10-
|
11-
LL | (||1usize)()
12-
| ^^^^^^^^^^^^
13-
= note: wrap the `[closure@$DIR/issue-93647.rs:2:6: 2:8]` in a closure with no arguments: `|| { /* code */ }`
14-
151
error[E0015]: cannot call non-const closure in constants
162
--> $DIR/issue-93647.rs:2:5
173
|
@@ -22,7 +8,6 @@ LL | (||1usize)()
228
= note: calls in constants are limited to constant functions, tuple structs and tuple variants
239
= help: add `#![feature(const_trait_impl)]` to the crate attributes to enable
2410

25-
error: aborting due to 2 previous errors
11+
error: aborting due to previous error
2612

27-
Some errors have detailed explanations: E0015, E0277.
28-
For more information about an error, try `rustc --explain E0015`.
13+
For more information about this error, try `rustc --explain E0015`.

tests/ui/consts/const-block-const-bound.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// known-bug: #103507
2+
13
#![allow(unused)]
24
#![feature(const_trait_impl, inline_const, negative_impls)]
35

@@ -14,6 +16,6 @@ impl Drop for UnconstDrop {
1416
fn main() {
1517
const {
1618
f(UnconstDrop);
17-
//~^ ERROR can't drop
19+
//FIXME ~^ ERROR can't drop
1820
}
1921
}
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,11 @@
1-
error[E0277]: can't drop `UnconstDrop` in const contexts
2-
--> $DIR/const-block-const-bound.rs:16:9
1+
error[E0493]: destructor of `T` cannot be evaluated at compile-time
2+
--> $DIR/const-block-const-bound.rs:8:32
33
|
4-
LL | f(UnconstDrop);
5-
| ^^^^^^^^^^^^^^ the trait `~const Destruct` is not implemented for `UnconstDrop`
6-
|
7-
= note: the trait bound `UnconstDrop: ~const Destruct` is not satisfied
8-
help: consider borrowing here
9-
|
10-
LL | &f(UnconstDrop);
11-
| +
12-
LL | &mut f(UnconstDrop);
13-
| ++++
4+
LL | const fn f<T: ~const Destruct>(x: T) {}
5+
| ^ - value is dropped here
6+
| |
7+
| the destructor for this type cannot be evaluated in constant functions
148

159
error: aborting due to previous error
1610

17-
For more information about this error, try `rustc --explain E0277`.
11+
For more information about this error, try `rustc --explain E0493`.
+2-42
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,3 @@
1-
error[E0277]: can't compare `TypeId` with `TypeId` in const contexts
2-
--> $DIR/const_cmp_type_id.rs:8:13
3-
|
4-
LL | assert!(TypeId::of::<u8>() == TypeId::of::<u8>());
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no implementation for `TypeId == TypeId`
6-
|
7-
= help: the trait `~const PartialEq` is not implemented for `TypeId`
8-
note: the trait `PartialEq` is implemented for `TypeId`, but that implementation is not `const`
9-
--> $DIR/const_cmp_type_id.rs:8:13
10-
|
11-
LL | assert!(TypeId::of::<u8>() == TypeId::of::<u8>());
12-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
13-
141
error[E0015]: cannot call non-const operator in constant functions
152
--> $DIR/const_cmp_type_id.rs:8:13
163
|
@@ -21,19 +8,6 @@ note: impl defined here, but it is not `const`
218
--> $SRC_DIR/core/src/any.rs:LL:COL
229
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
2310

24-
error[E0277]: can't compare `TypeId` with `TypeId` in const contexts
25-
--> $DIR/const_cmp_type_id.rs:9:13
26-
|
27-
LL | assert!(TypeId::of::<()>() != TypeId::of::<u8>());
28-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no implementation for `TypeId == TypeId`
29-
|
30-
= help: the trait `~const PartialEq` is not implemented for `TypeId`
31-
note: the trait `PartialEq` is implemented for `TypeId`, but that implementation is not `const`
32-
--> $DIR/const_cmp_type_id.rs:9:13
33-
|
34-
LL | assert!(TypeId::of::<()>() != TypeId::of::<u8>());
35-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
36-
3711
error[E0015]: cannot call non-const operator in constant functions
3812
--> $DIR/const_cmp_type_id.rs:9:13
3913
|
@@ -44,19 +18,6 @@ note: impl defined here, but it is not `const`
4418
--> $SRC_DIR/core/src/any.rs:LL:COL
4519
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
4620

47-
error[E0277]: can't compare `TypeId` with `TypeId` in const contexts
48-
--> $DIR/const_cmp_type_id.rs:10:22
49-
|
50-
LL | const _A: bool = TypeId::of::<u8>() < TypeId::of::<u16>();
51-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no implementation for `TypeId < TypeId` and `TypeId > TypeId`
52-
|
53-
= help: the trait `~const PartialOrd` is not implemented for `TypeId`
54-
note: the trait `PartialOrd` is implemented for `TypeId`, but that implementation is not `const`
55-
--> $DIR/const_cmp_type_id.rs:10:22
56-
|
57-
LL | const _A: bool = TypeId::of::<u8>() < TypeId::of::<u16>();
58-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
59-
6021
error[E0015]: cannot call non-const operator in constants
6122
--> $DIR/const_cmp_type_id.rs:10:22
6223
|
@@ -68,7 +29,6 @@ note: impl defined here, but it is not `const`
6829
= note: calls in constants are limited to constant functions, tuple structs and tuple variants
6930
= note: this error originates in the derive macro `PartialOrd` (in Nightly builds, run with -Z macro-backtrace for more info)
7031

71-
error: aborting due to 6 previous errors
32+
error: aborting due to 3 previous errors
7233

73-
Some errors have detailed explanations: E0015, E0277.
74-
For more information about an error, try `rustc --explain E0015`.
34+
For more information about this error, try `rustc --explain E0015`.

tests/ui/consts/invalid-inline-const-in-match-arm.rs

-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,5 @@ fn main() {
55
match () {
66
const { (|| {})() } => {}
77
//~^ ERROR cannot call non-const closure in constants
8-
//~| ERROR the trait bound
98
}
109
}
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,3 @@
1-
error[E0277]: the trait bound `[closure@$DIR/invalid-inline-const-in-match-arm.rs:6:18: 6:20]: Fn<()>` is not satisfied
2-
--> $DIR/invalid-inline-const-in-match-arm.rs:6:17
3-
|
4-
LL | const { (|| {})() } => {}
5-
| ^^^^^^^^^ expected an `Fn<()>` closure, found `[closure@$DIR/invalid-inline-const-in-match-arm.rs:6:18: 6:20]`
6-
|
7-
= help: the trait `~const Fn<()>` is not implemented for closure `[closure@$DIR/invalid-inline-const-in-match-arm.rs:6:18: 6:20]`
8-
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`
9-
--> $DIR/invalid-inline-const-in-match-arm.rs:6:17
10-
|
11-
LL | const { (|| {})() } => {}
12-
| ^^^^^^^^^
13-
= note: wrap the `[closure@$DIR/invalid-inline-const-in-match-arm.rs:6:18: 6:20]` in a closure with no arguments: `|| { /* code */ }`
14-
151
error[E0015]: cannot call non-const closure in constants
162
--> $DIR/invalid-inline-const-in-match-arm.rs:6:17
173
|
@@ -22,7 +8,6 @@ LL | const { (|| {})() } => {}
228
= note: calls in constants are limited to constant functions, tuple structs and tuple variants
239
= help: add `#![feature(const_trait_impl)]` to the crate attributes to enable
2410

25-
error: aborting due to 2 previous errors
11+
error: aborting due to previous error
2612

27-
Some errors have detailed explanations: E0015, E0277.
28-
For more information about an error, try `rustc --explain E0015`.
13+
For more information about this error, try `rustc --explain E0015`.

tests/ui/consts/issue-28113.rs

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
const X: u8 =
44
|| -> u8 { 5 }()
55
//~^ ERROR cannot call non-const closure
6-
//~| ERROR the trait bound
76
;
87

98
fn main() {}

tests/ui/consts/issue-28113.stderr

+2-17
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,3 @@
1-
error[E0277]: the trait bound `[closure@$DIR/issue-28113.rs:4:5: 4:13]: Fn<()>` is not satisfied
2-
--> $DIR/issue-28113.rs:4:5
3-
|
4-
LL | || -> u8 { 5 }()
5-
| ^^^^^^^^^^^^^^^^ expected an `Fn<()>` closure, found `[closure@$DIR/issue-28113.rs:4:5: 4:13]`
6-
|
7-
= help: the trait `~const Fn<()>` is not implemented for closure `[closure@$DIR/issue-28113.rs:4:5: 4:13]`
8-
note: the trait `Fn<()>` is implemented for `[closure@$DIR/issue-28113.rs:4:5: 4:13]`, but that implementation is not `const`
9-
--> $DIR/issue-28113.rs:4:5
10-
|
11-
LL | || -> u8 { 5 }()
12-
| ^^^^^^^^^^^^^^^^
13-
= note: wrap the `[closure@$DIR/issue-28113.rs:4:5: 4:13]` in a closure with no arguments: `|| { /* code */ }`
14-
151
error[E0015]: cannot call non-const closure in constants
162
--> $DIR/issue-28113.rs:4:5
173
|
@@ -22,7 +8,6 @@ LL | || -> u8 { 5 }()
228
= note: calls in constants are limited to constant functions, tuple structs and tuple variants
239
= help: add `#![feature(const_trait_impl)]` to the crate attributes to enable
2410

25-
error: aborting due to 2 previous errors
11+
error: aborting due to previous error
2612

27-
Some errors have detailed explanations: E0015, E0277.
28-
For more information about an error, try `rustc --explain E0015`.
13+
For more information about this error, try `rustc --explain E0015`.

tests/ui/consts/issue-56164.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
const fn foo() { (||{})() }
22
//~^ ERROR cannot call non-const closure
3-
//~| ERROR the trait bound
43

54
const fn bad(input: fn()) {
65
input()

tests/ui/consts/issue-56164.stderr

+3-18
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,3 @@
1-
error[E0277]: the trait bound `[closure@$DIR/issue-56164.rs:1:19: 1:21]: Fn<()>` is not satisfied
2-
--> $DIR/issue-56164.rs:1:18
3-
|
4-
LL | const fn foo() { (||{})() }
5-
| ^^^^^^^^ expected an `Fn<()>` closure, found `[closure@$DIR/issue-56164.rs:1:19: 1:21]`
6-
|
7-
= help: the trait `~const Fn<()>` is not implemented for closure `[closure@$DIR/issue-56164.rs:1:19: 1:21]`
8-
note: the trait `Fn<()>` is implemented for `[closure@$DIR/issue-56164.rs:1:19: 1:21]`, but that implementation is not `const`
9-
--> $DIR/issue-56164.rs:1:18
10-
|
11-
LL | const fn foo() { (||{})() }
12-
| ^^^^^^^^
13-
= note: wrap the `[closure@$DIR/issue-56164.rs:1:19: 1:21]` in a closure with no arguments: `|| { /* code */ }`
14-
151
error[E0015]: cannot call non-const closure in constant functions
162
--> $DIR/issue-56164.rs:1:18
173
|
@@ -23,12 +9,11 @@ LL | const fn foo() { (||{})() }
239
= help: add `#![feature(const_trait_impl)]` to the crate attributes to enable
2410

2511
error: function pointer calls are not allowed in constant functions
26-
--> $DIR/issue-56164.rs:6:5
12+
--> $DIR/issue-56164.rs:5:5
2713
|
2814
LL | input()
2915
| ^^^^^^^
3016

31-
error: aborting due to 3 previous errors
17+
error: aborting due to 2 previous errors
3218

33-
Some errors have detailed explanations: E0015, E0277.
34-
For more information about an error, try `rustc --explain E0015`.
19+
For more information about this error, try `rustc --explain E0015`.

tests/ui/consts/issue-68542-closure-in-array-len.rs

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
struct Bug {
66
a: [(); (|| { 0 })()] //~ ERROR cannot call non-const closure
7-
//~^ ERROR the trait bound
87
}
98

109
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,3 @@
1-
error[E0277]: the trait bound `[closure@$DIR/issue-68542-closure-in-array-len.rs:6:14: 6:16]: Fn<()>` is not satisfied
2-
--> $DIR/issue-68542-closure-in-array-len.rs:6:13
3-
|
4-
LL | a: [(); (|| { 0 })()]
5-
| ^^^^^^^^^^^^ expected an `Fn<()>` closure, found `[closure@$DIR/issue-68542-closure-in-array-len.rs:6:14: 6:16]`
6-
|
7-
= help: the trait `~const Fn<()>` is not implemented for closure `[closure@$DIR/issue-68542-closure-in-array-len.rs:6:14: 6:16]`
8-
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`
9-
--> $DIR/issue-68542-closure-in-array-len.rs:6:13
10-
|
11-
LL | a: [(); (|| { 0 })()]
12-
| ^^^^^^^^^^^^
13-
= note: wrap the `[closure@$DIR/issue-68542-closure-in-array-len.rs:6:14: 6:16]` in a closure with no arguments: `|| { /* code */ }`
14-
151
error[E0015]: cannot call non-const closure in constants
162
--> $DIR/issue-68542-closure-in-array-len.rs:6:13
173
|
@@ -22,7 +8,6 @@ LL | a: [(); (|| { 0 })()]
228
= note: calls in constants are limited to constant functions, tuple structs and tuple variants
239
= help: add `#![feature(const_trait_impl)]` to the crate attributes to enable
2410

25-
error: aborting due to 2 previous errors
11+
error: aborting due to previous error
2612

27-
Some errors have detailed explanations: E0015, E0277.
28-
For more information about an error, try `rustc --explain E0015`.
13+
For more information about this error, try `rustc --explain E0015`.
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,3 @@
1-
error[E0277]: can't compare `TypeId` with `TypeId` in const contexts
2-
--> $DIR/issue-73976-monomorphic.rs:21:5
3-
|
4-
LL | GetTypeId::<T>::VALUE == GetTypeId::<usize>::VALUE
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no implementation for `TypeId == TypeId`
6-
|
7-
= help: the trait `~const PartialEq` is not implemented for `TypeId`
8-
note: the trait `PartialEq` is implemented for `TypeId`, but that implementation is not `const`
9-
--> $DIR/issue-73976-monomorphic.rs:21:5
10-
|
11-
LL | GetTypeId::<T>::VALUE == GetTypeId::<usize>::VALUE
12-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
13-
141
error[E0015]: cannot call non-const operator in constant functions
152
--> $DIR/issue-73976-monomorphic.rs:21:5
163
|
@@ -21,7 +8,6 @@ note: impl defined here, but it is not `const`
218
--> $SRC_DIR/core/src/any.rs:LL:COL
229
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
2310

24-
error: aborting due to 2 previous errors
11+
error: aborting due to previous error
2512

26-
Some errors have detailed explanations: E0015, E0277.
27-
For more information about an error, try `rustc --explain E0015`.
13+
For more information about this error, try `rustc --explain E0015`.

tests/ui/consts/issue-94675.rs

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// known-bug: #103507
2+
13
#![feature(const_trait_impl, const_mut_refs)]
24

35
struct Foo<'a> {
@@ -7,9 +9,9 @@ struct Foo<'a> {
79
impl<'a> Foo<'a> {
810
const fn spam(&mut self, baz: &mut Vec<u32>) {
911
self.bar[0] = baz.len();
10-
//~^ ERROR: cannot call
11-
//~| ERROR: cannot call
12-
//~| ERROR: the trait bound
12+
//FIXME ~^ ERROR: cannot call
13+
//FIXME ~| ERROR: cannot call
14+
//FIXME ~| ERROR: the trait bound
1315
}
1416
}
1517

tests/ui/consts/issue-94675.stderr

+4-18
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,13 @@
11
error[E0015]: cannot call non-const fn `Vec::<u32>::len` in constant functions
2-
--> $DIR/issue-94675.rs:9:27
2+
--> $DIR/issue-94675.rs:11:27
33
|
44
LL | self.bar[0] = baz.len();
55
| ^^^^^
66
|
77
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
88

9-
error[E0277]: the trait bound `Vec<usize>: ~const IndexMut<usize>` is not satisfied
10-
--> $DIR/issue-94675.rs:9:9
11-
|
12-
LL | self.bar[0] = baz.len();
13-
| ^^^^^^^^^^^ vector indices are of type `usize` or ranges of `usize`
14-
|
15-
= help: the trait `~const IndexMut<usize>` is not implemented for `Vec<usize>`
16-
note: the trait `IndexMut<usize>` is implemented for `Vec<usize>`, but that implementation is not `const`
17-
--> $DIR/issue-94675.rs:9:9
18-
|
19-
LL | self.bar[0] = baz.len();
20-
| ^^^^^^^^^^^
21-
229
error[E0015]: cannot call non-const operator in constant functions
23-
--> $DIR/issue-94675.rs:9:9
10+
--> $DIR/issue-94675.rs:11:9
2411
|
2512
LL | self.bar[0] = baz.len();
2613
| ^^^^^^^^^^^
@@ -29,7 +16,6 @@ note: impl defined here, but it is not `const`
2916
--> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL
3017
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
3118

32-
error: aborting due to 3 previous errors
19+
error: aborting due to 2 previous errors
3320

34-
Some errors have detailed explanations: E0015, E0277.
35-
For more information about an error, try `rustc --explain E0015`.
21+
For more information about this error, try `rustc --explain E0015`.

tests/ui/consts/precise-drop-with-promoted.rs

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
// Regression test for issue #89938.
2-
// check-pass
32
// compile-flags: --crate-type=lib
3+
// known-bug: #103507
4+
// failure-status: 101
5+
// normalize-stderr-test "note: .*\n\n" -> ""
6+
// normalize-stderr-test "thread 'rustc' panicked.*\n" -> ""
7+
// normalize-stderr-test "(error: internal compiler error: [^:]+):\d+:\d+: " -> "$1:LL:CC: "
8+
// rustc-env:RUST_BACKTRACE=0
9+
410
#![feature(const_precise_live_drops)]
511

612
pub const fn f() {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
error: the compiler unexpectedly panicked. this is a bug.
2+
3+
query stack during panic:
4+
#0 [mir_drops_elaborated_and_const_checked] elaborating drops for `f`
5+
#1 [analysis] running analysis passes on this crate
6+
end of query stack

0 commit comments

Comments
 (0)