Skip to content

Commit e4bbca2

Browse files
authored
Rollup merge of rust-lang#135523 - RalfJung:wrong-known-bug, r=compiler-errors
const traits: remove some known-bug that do not seem to make sense These tests were made to point to rust-lang#103507 in rust-lang#114134; I think that was a mistake: that issue is about a rather specific problem, and most tests marked as known-bug in that PR are pointing at rust-lang#110395 which makes more sense. Of the 4 tests that still point to rust-lang#103507: - One is [the original test](https://github.com/rust-lang/rust/blob/20882608529a969bd878ad787cf0038716c021df/tests/ui/impl-trait/normalize-tait-in-const.rs). It still fails to compile, though currently for unrelated reasons (`~const Fn` is not valid as that is not a const trait). I made it point at rust-lang#110395 like all the other tests that were disabled when the previous const trait impl was removed. - One is being fixed in rust-lang#135423 - The other two are fixed in this PR The errors we are getting here are not great but they do look correct? FWIW there are still a whole lot of tests mentioning rust-lang#110395 despite that issue being closed... I hope someone is tracking that.^^ r? `@compiler-errors`
2 parents 5bebace + 0922c19 commit e4bbca2

6 files changed

+10
-15
lines changed

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

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
//@ known-bug: #103507
2-
31
#![allow(unused)]
42
#![feature(const_trait_impl, negative_impls, const_destruct)]
53

@@ -16,6 +14,6 @@ impl Drop for UnconstDrop {
1614
fn main() {
1715
const {
1816
f(UnconstDrop);
19-
//FIXME ~^ ERROR can't drop
17+
//~^ ERROR trait bound `UnconstDrop: const Destruct` is not satisfied
2018
}
2119
}

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
error[E0277]: the trait bound `UnconstDrop: const Destruct` is not satisfied
2-
--> $DIR/const-block-const-bound.rs:18:11
2+
--> $DIR/const-block-const-bound.rs:16:11
33
|
44
LL | f(UnconstDrop);
55
| - ^^^^^^^^^^^
66
| |
77
| required by a bound introduced by this call
88
|
99
note: required by a bound in `f`
10-
--> $DIR/const-block-const-bound.rs:8:15
10+
--> $DIR/const-block-const-bound.rs:6:15
1111
|
1212
LL | const fn f<T: ~const Destruct>(x: T) {}
1313
| ^^^^^^ required by this bound in `f`

tests/ui/consts/issue-94675.rs

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

53
struct Foo<'a> {
@@ -9,9 +7,7 @@ struct Foo<'a> {
97
impl<'a> Foo<'a> {
108
const fn spam(&mut self, baz: &mut Vec<u32>) {
119
self.bar[0] = baz.len();
12-
//FIXME ~^ ERROR: cannot call
13-
//FIXME ~| ERROR: cannot call
14-
//FIXME ~| ERROR: the trait bound
10+
//~^ ERROR: cannot call
1511
}
1612
}
1713

tests/ui/consts/issue-94675.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0015]: cannot call non-const operator in constant functions
2-
--> $DIR/issue-94675.rs:11:17
2+
--> $DIR/issue-94675.rs:9:17
33
|
44
LL | self.bar[0] = baz.len();
55
| ^^^

tests/ui/impl-trait/normalize-tait-in-const.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
//@ known-bug: #103507
1+
//! This is a regression test for <https://github.com/rust-lang/rust/issues/103507>.
2+
//@ known-bug: #110395
23

34
#![feature(type_alias_impl_trait)]
45
#![feature(const_trait_impl, const_destruct)]

tests/ui/impl-trait/normalize-tait-in-const.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: `~const` can only be applied to `#[const_trait]` traits
2-
--> $DIR/normalize-tait-in-const.rs:26:35
2+
--> $DIR/normalize-tait-in-const.rs:27:35
33
|
44
LL | const fn with_positive<F: for<'a> ~const Fn(&'a Alias<'a>) + ~const Destruct>(fun: F) {
55
| ^^^^^^ can't be applied to `Fn`
@@ -8,7 +8,7 @@ note: `Fn` can't be used with `~const` because it isn't annotated with `#[const_
88
--> $SRC_DIR/core/src/ops/function.rs:LL:COL
99

1010
error: `~const` can only be applied to `#[const_trait]` traits
11-
--> $DIR/normalize-tait-in-const.rs:26:35
11+
--> $DIR/normalize-tait-in-const.rs:27:35
1212
|
1313
LL | const fn with_positive<F: for<'a> ~const Fn(&'a Alias<'a>) + ~const Destruct>(fun: F) {
1414
| ^^^^^^ can't be applied to `Fn`
@@ -18,7 +18,7 @@ note: `Fn` can't be used with `~const` because it isn't annotated with `#[const_
1818
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
1919

2020
error[E0015]: cannot call non-const closure in constant functions
21-
--> $DIR/normalize-tait-in-const.rs:27:5
21+
--> $DIR/normalize-tait-in-const.rs:28:5
2222
|
2323
LL | fun(filter_positive());
2424
| ^^^^^^^^^^^^^^^^^^^^^^

0 commit comments

Comments
 (0)