Skip to content

Commit 8fc8358

Browse files
committed
Update tests after feature stabilization
1 parent 7723506 commit 8fc8358

File tree

86 files changed

+107
-718
lines changed

Some content is hidden

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

86 files changed

+107
-718
lines changed

compiler/rustc_const_eval/src/transform/check_consts/check.rs

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -359,22 +359,6 @@ impl<'mir, 'tcx> Checker<'mir, 'tcx> {
359359
match *ty.kind() {
360360
ty::Ref(_, _, hir::Mutability::Mut) => self.check_op(ops::ty::MutRef(kind)),
361361
ty::Opaque(..) => self.check_op(ops::ty::ImplTrait),
362-
363-
ty::Dynamic(preds, _) => {
364-
for pred in preds.iter() {
365-
match pred.skip_binder() {
366-
ty::ExistentialPredicate::AutoTrait(_)
367-
| ty::ExistentialPredicate::Projection(_) => {
368-
self.check_op(ops::ty::DynTrait(kind))
369-
}
370-
ty::ExistentialPredicate::Trait(trait_ref) => {
371-
if Some(trait_ref.def_id) != self.tcx.lang_items().sized_trait() {
372-
self.check_op(ops::ty::DynTrait(kind))
373-
}
374-
}
375-
}
376-
}
377-
}
378362
_ => {}
379363
}
380364
}

compiler/rustc_const_eval/src/transform/check_consts/ops.rs

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -817,49 +817,6 @@ pub mod ty {
817817
}
818818
}
819819

820-
#[derive(Debug)]
821-
pub struct DynTrait(pub mir::LocalKind);
822-
impl<'tcx> NonConstOp<'tcx> for DynTrait {
823-
fn importance(&self) -> DiagnosticImportance {
824-
match self.0 {
825-
mir::LocalKind::Var | mir::LocalKind::Temp => DiagnosticImportance::Secondary,
826-
mir::LocalKind::ReturnPointer | mir::LocalKind::Arg => {
827-
DiagnosticImportance::Primary
828-
}
829-
}
830-
}
831-
832-
fn status_in_item(&self, ccx: &ConstCx<'_, 'tcx>) -> Status {
833-
if ccx.const_kind() != hir::ConstContext::ConstFn {
834-
Status::Allowed
835-
} else {
836-
Status::Unstable(sym::const_fn_trait_bound)
837-
}
838-
}
839-
840-
fn build_error(
841-
&self,
842-
ccx: &ConstCx<'_, 'tcx>,
843-
span: Span,
844-
) -> DiagnosticBuilder<'tcx, ErrorGuaranteed> {
845-
let mut err = feature_err(
846-
&ccx.tcx.sess.parse_sess,
847-
sym::const_fn_trait_bound,
848-
span,
849-
"trait objects in const fn are unstable",
850-
);
851-
852-
match ccx.fn_sig() {
853-
Some(fn_sig) if !fn_sig.span.contains(span) => {
854-
err.span_label(fn_sig.span, "function declared as const here");
855-
}
856-
_ => {}
857-
}
858-
859-
err
860-
}
861-
}
862-
863820
/// A trait bound with the `?const Trait` opt-out
864821
#[derive(Debug)]
865822
pub struct TraitBoundNotConst;

src/test/ui/borrowck/issue-88434-minimal-example.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#![feature(const_fn_trait_bound)]
21
// Regression test related to issue 88434
32

43
const _CONST: &() = &f(&|_| {});

src/test/ui/borrowck/issue-88434-minimal-example.stderr

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
error[E0080]: evaluation of constant value failed
2-
--> $DIR/issue-88434-minimal-example.rs:10:5
2+
--> $DIR/issue-88434-minimal-example.rs:9:5
33
|
44
LL | const _CONST: &() = &f(&|_| {});
5-
| ---------- inside `_CONST` at $DIR/issue-88434-minimal-example.rs:4:22
5+
| ---------- inside `_CONST` at $DIR/issue-88434-minimal-example.rs:3:22
66
...
77
LL | panic!()
88
| ^^^^^^^^
99
| |
10-
| the evaluated program panicked at 'explicit panic', $DIR/issue-88434-minimal-example.rs:10:5
11-
| inside `f::<[closure@$DIR/issue-88434-minimal-example.rs:4:25: 4:31]>` at $SRC_DIR/std/src/panic.rs:LL:COL
10+
| the evaluated program panicked at 'explicit panic', $DIR/issue-88434-minimal-example.rs:9:5
11+
| inside `f::<[closure@$DIR/issue-88434-minimal-example.rs:3:25: 3:31]>` at $SRC_DIR/std/src/panic.rs:LL:COL
1212
|
1313
= note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info)
1414

src/test/ui/borrowck/issue-88434-removal-index-should-be-less.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#![feature(const_fn_trait_bound)]
21
// Regression test for issue 88434
32

43
const _CONST: &[u8] = &f(&[], |_| {});

src/test/ui/borrowck/issue-88434-removal-index-should-be-less.stderr

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
error[E0080]: evaluation of constant value failed
2-
--> $DIR/issue-88434-removal-index-should-be-less.rs:10:5
2+
--> $DIR/issue-88434-removal-index-should-be-less.rs:9:5
33
|
44
LL | const _CONST: &[u8] = &f(&[], |_| {});
5-
| -------------- inside `_CONST` at $DIR/issue-88434-removal-index-should-be-less.rs:4:24
5+
| -------------- inside `_CONST` at $DIR/issue-88434-removal-index-should-be-less.rs:3:24
66
...
77
LL | panic!()
88
| ^^^^^^^^
99
| |
10-
| the evaluated program panicked at 'explicit panic', $DIR/issue-88434-removal-index-should-be-less.rs:10:5
11-
| inside `f::<[closure@$DIR/issue-88434-removal-index-should-be-less.rs:4:31: 4:37]>` at $SRC_DIR/std/src/panic.rs:LL:COL
10+
| the evaluated program panicked at 'explicit panic', $DIR/issue-88434-removal-index-should-be-less.rs:9:5
11+
| inside `f::<[closure@$DIR/issue-88434-removal-index-should-be-less.rs:3:31: 3:37]>` at $SRC_DIR/std/src/panic.rs:LL:COL
1212
|
1313
= note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info)
1414

src/test/ui/const-generics/generic_const_exprs/issue-85848.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![feature(const_fn_trait_bound, generic_const_exprs)]
1+
#![feature(generic_const_exprs)]
22
#![allow(incomplete_features)]
33

44
trait _Contains<T> {

src/test/ui/const-generics/issues/issue-79674.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![feature(const_fn_trait_bound, generic_const_exprs)]
1+
#![feature(generic_const_exprs)]
22
#![allow(incomplete_features)]
33

44
trait MiniTypeId {

src/test/ui/consts/auxiliary/const_fn_lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
// Crate that exports a const fn. Used for testing cross-crate.
22

3-
#![feature(const_fn_fn_ptr_basics)]
43
#![crate_type="rlib"]
54

65
pub const fn foo() -> usize { 22 }

src/test/ui/consts/const-block-const-bound.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#![allow(unused)]
2-
#![feature(const_fn_trait_bound, const_trait_impl, inline_const, negative_impls)]
2+
#![feature(const_trait_impl, inline_const, negative_impls)]
33

44
const fn f<T: ~const Drop>(x: T) {}
55

src/test/ui/consts/const-eval/const_fn_ptr.stderr

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,11 @@ help: skipping check that does not even have a feature gate
1010
|
1111
LL | X_CONST(x)
1212
| ^^^^^^^^^^
13-
help: skipping check for `const_fn_fn_ptr_basics` feature
14-
--> $DIR/const_fn_ptr.rs:18:14
15-
|
16-
LL | const fn foo(x: fn(usize) -> usize, y: usize) -> usize {
17-
| ^
18-
help: skipping check for `const_fn_fn_ptr_basics` feature
19-
--> $DIR/const_fn_ptr.rs:19:5
20-
|
21-
LL | x(y)
22-
| ^
2313
help: skipping check that does not even have a feature gate
2414
--> $DIR/const_fn_ptr.rs:19:5
2515
|
2616
LL | x(y)
2717
| ^^^^
2818

29-
error: `-Zunleash-the-miri-inside-of-you` may not be used to circumvent feature gates, except when testing error paths in the CTFE engine
30-
31-
error: aborting due to previous error; 1 warning emitted
19+
warning: 1 warning emitted
3220

src/test/ui/consts/const-eval/const_fn_ptr_fail2.stderr

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,6 @@ LL | assert_eq!(Z, 4);
1212

1313
warning: skipping const checks
1414
|
15-
help: skipping check for `const_fn_fn_ptr_basics` feature
16-
--> $DIR/const_fn_ptr_fail2.rs:11:14
17-
|
18-
LL | const fn bar(x: fn(usize) -> usize, y: usize) -> usize {
19-
| ^
20-
help: skipping check for `const_fn_fn_ptr_basics` feature
21-
--> $DIR/const_fn_ptr_fail2.rs:12:5
22-
|
23-
LL | x(y)
24-
| ^
2515
help: skipping check that does not even have a feature gate
2616
--> $DIR/const_fn_ptr_fail2.rs:12:5
2717
|

src/test/ui/consts/const-eval/issue-49296.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
// issue-49296: Unsafe shenigans in constants can result in missing errors
22

3-
#![feature(const_fn_trait_bound)]
4-
53
use std::mem::transmute;
64

75
const fn wat(x: u64) -> &'static u64 {

src/test/ui/consts/const-eval/issue-49296.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0080]: evaluation of constant value failed
2-
--> $DIR/issue-49296.rs:11:16
2+
--> $DIR/issue-49296.rs:9:16
33
|
44
LL | const X: u64 = *wat(42);
55
| ^^^^^^^^ pointer to alloc2 was dereferenced after this allocation got freed

src/test/ui/consts/const-eval/issue-70804-fn-subtyping.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
// check-pass
2-
#![feature(const_fn_fn_ptr_basics)]
32

43
const fn nested(x: (for<'a> fn(&'a ()), String)) -> (fn(&'static ()), String) {
54
x

src/test/ui/consts/const-extern-fn/const-extern-fn-min-const-fn.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
const extern "C" fn unsize(x: &[u8; 3]) -> &[u8] { x }
44
const unsafe extern "C" fn closure() -> fn() { || {} }
5-
//~^ ERROR function pointer
6-
//~| ERROR function pointer cast
75
const unsafe extern "C" fn use_float() { 1.0 + 1.0; }
86
//~^ ERROR floating point arithmetic
97
const extern "C" fn ptr_cast(val: *const u8) { val as usize; }
Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,5 @@
1-
error[E0658]: function pointers cannot appear in constant functions
2-
--> $DIR/const-extern-fn-min-const-fn.rs:4:41
3-
|
4-
LL | const unsafe extern "C" fn closure() -> fn() { || {} }
5-
| ^^^^
6-
|
7-
= note: see issue #57563 <https://github.com/rust-lang/rust/issues/57563> for more information
8-
= help: add `#![feature(const_fn_fn_ptr_basics)]` to the crate attributes to enable
9-
10-
error[E0658]: function pointer casts are not allowed in constant functions
11-
--> $DIR/const-extern-fn-min-const-fn.rs:4:48
12-
|
13-
LL | const unsafe extern "C" fn closure() -> fn() { || {} }
14-
| ^^^^^
15-
|
16-
= note: see issue #57563 <https://github.com/rust-lang/rust/issues/57563> for more information
17-
= help: add `#![feature(const_fn_fn_ptr_basics)]` to the crate attributes to enable
18-
191
error[E0658]: floating point arithmetic is not allowed in constant functions
20-
--> $DIR/const-extern-fn-min-const-fn.rs:7:42
2+
--> $DIR/const-extern-fn-min-const-fn.rs:5:42
213
|
224
LL | const unsafe extern "C" fn use_float() { 1.0 + 1.0; }
235
| ^^^^^^^^^
@@ -26,14 +8,14 @@ LL | const unsafe extern "C" fn use_float() { 1.0 + 1.0; }
268
= help: add `#![feature(const_fn_floating_point_arithmetic)]` to the crate attributes to enable
279

2810
error: pointers cannot be cast to integers during const eval
29-
--> $DIR/const-extern-fn-min-const-fn.rs:9:48
11+
--> $DIR/const-extern-fn-min-const-fn.rs:7:48
3012
|
3113
LL | const extern "C" fn ptr_cast(val: *const u8) { val as usize; }
3214
| ^^^^^^^^^^^^
3315
|
3416
= note: at compile-time, pointers do not have an integer value
3517
= note: avoiding this restriction via `transmute`, `union`, or raw pointers leads to compile-time undefined behavior
3618

37-
error: aborting due to 4 previous errors
19+
error: aborting due to 2 previous errors
3820

3921
For more information about this error, try `rustc --explain E0658`.

src/test/ui/consts/const-fn.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
// A very basic test of const fn functionality.
55

66
#![feature(const_indexing)]
7-
#![feature(const_fn_trait_bound)]
87

98
const fn add(x: u32, y: u32) -> u32 {
109
x + y

src/test/ui/consts/const_fn_trait_bound.gated.stderr

Lines changed: 0 additions & 8 deletions
This file was deleted.

src/test/ui/consts/const_fn_trait_bound.rs

Lines changed: 0 additions & 17 deletions
This file was deleted.

src/test/ui/consts/const_fn_trait_bound.stock.stderr

Lines changed: 0 additions & 30 deletions
This file was deleted.

src/test/ui/consts/issue-37550-1.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1+
// check-pass
2+
13
const fn x() {
24
let t = true;
3-
let x = || t; //~ ERROR function pointer
5+
let x = || t;
46
}
57

68
fn main() {}

src/test/ui/consts/issue-37550-1.stderr

Lines changed: 0 additions & 12 deletions
This file was deleted.

src/test/ui/consts/issue-37550.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
#![allow(dead_code)]
33
#![allow(unused_variables)]
44

5-
#![feature(const_fn_fn_ptr_basics)]
6-
75
const fn x() {
86
let t = true;
97
let x = || t;

src/test/ui/consts/issue-46553.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
// run-pass
2-
#![feature(const_fn_fn_ptr_basics)]
32
#![deny(const_err)]
43

54
pub struct Data<T> {

src/test/ui/consts/issue-56164.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#![feature(const_fn_fn_ptr_basics)]
2-
31
const fn foo() { (||{})() }
42
//~^ ERROR cannot call non-const closure
53

src/test/ui/consts/issue-56164.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0015]: cannot call non-const closure in constant functions
2-
--> $DIR/issue-56164.rs:3:18
2+
--> $DIR/issue-56164.rs:1:18
33
|
44
LL | const fn foo() { (||{})() }
55
| ^^^^^^^^
@@ -8,7 +8,7 @@ LL | const fn foo() { (||{})() }
88
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
99

1010
error: function pointers are not allowed in const fn
11-
--> $DIR/issue-56164.rs:7:5
11+
--> $DIR/issue-56164.rs:5:5
1212
|
1313
LL | input()
1414
| ^^^^^^^

src/test/ui/consts/issue-88071.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
// regression test for #88071
44

55
#![feature(const_btree_new)]
6-
#![feature(const_fn_trait_bound)]
76

87
use std::collections::BTreeMap;
98

0 commit comments

Comments
 (0)