Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 18587b1

Browse files
committed
Auto merge of rust-lang#84556 - RalfJung:const-fn-trait-bound, r=oli-obk
use correct feature flag for impl-block-level trait bounds on const fn I am not sure what that special hack was needed for, but it doesn't seem needed any more... This removes the last use of the `const_fn` feature flag -- Cc rust-lang#84510 r? `@oli-obk`
2 parents 814a560 + 3c4c5eb commit 18587b1

File tree

63 files changed

+85
-133
lines changed

Some content is hidden

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

63 files changed

+85
-133
lines changed

compiler/rustc_mir/src/transform/check_consts/validation.rs

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ impl Validator<'mir, 'tcx> {
426426
ty::PredicateKind::Subtype(_) => {
427427
bug!("subtype predicate on function: {:#?}", predicate)
428428
}
429-
ty::PredicateKind::Trait(pred, constness) => {
429+
ty::PredicateKind::Trait(pred, _constness) => {
430430
if Some(pred.def_id()) == tcx.lang_items().sized_trait() {
431431
continue;
432432
}
@@ -440,16 +440,7 @@ impl Validator<'mir, 'tcx> {
440440
// arguments when determining importance.
441441
let kind = LocalKind::Arg;
442442

443-
if constness == hir::Constness::Const {
444-
self.check_op_spanned(ops::ty::TraitBound(kind), span);
445-
} else if !tcx.features().const_fn
446-
|| self.ccx.is_const_stable_const_fn()
447-
{
448-
// HACK: We shouldn't need the conditional above, but trait
449-
// bounds on containing impl blocks are wrongly being marked as
450-
// "not-const".
451-
self.check_op_spanned(ops::ty::TraitBound(kind), span);
452-
}
443+
self.check_op_spanned(ops::ty::TraitBound(kind), span);
453444
}
454445
// other kinds of bounds are either tautologies
455446
// or cause errors in other passes

library/proc_macro/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@
2121
#![feature(rustc_allow_const_fn_unstable)]
2222
#![feature(nll)]
2323
#![feature(staged_api)]
24-
#![feature(const_fn)]
24+
#![cfg_attr(bootstrap, feature(const_fn))]
25+
#![cfg_attr(not(bootstrap), feature(const_fn_trait_bound))]
2526
#![feature(const_fn_fn_ptr_basics)]
2627
#![feature(allow_internal_unstable)]
2728
#![feature(decl_macro)]

src/test/ui/array-slice-vec/subslice-patterns-const-eval-match.rs

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

33
// run-pass
44

5-
#![feature(const_fn)]
6-
75
#[derive(PartialEq, Debug, Clone)]
86
struct N(u8);
97

src/test/ui/associated-consts/associated-const-in-trait.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// #29924
22

3-
#![feature(const_fn, associated_consts)]
3+
#![feature(associated_consts)]
44

55
trait Trait {
66
const N: usize;

src/test/ui/consts/const-eval/auxiliary/stability.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
#![crate_type="rlib"]
44
#![stable(feature = "rust1", since = "1.0.0")]
55

6-
#![feature(const_fn)]
76
#![feature(staged_api)]
87

98
#[stable(feature = "rust1", since = "1.0.0")]

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
// run-pass
22
// compile-flags: -Zunleash-the-miri-inside-of-you
3-
#![feature(const_fn)]
43

54
fn double(x: usize) -> usize { x * 2 }
65
const fn double_const(x: usize) -> usize { x * 2 }

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
11
warning: skipping const checks
22
|
33
help: skipping check that does not even have a feature gate
4-
--> $DIR/const_fn_ptr.rs:12:5
4+
--> $DIR/const_fn_ptr.rs:11:5
55
|
66
LL | X(x)
77
| ^^^^
88
help: skipping check that does not even have a feature gate
9-
--> $DIR/const_fn_ptr.rs:16:5
9+
--> $DIR/const_fn_ptr.rs:15:5
1010
|
1111
LL | X_CONST(x)
1212
| ^^^^^^^^^^
1313
help: skipping check for `const_fn_fn_ptr_basics` feature
14-
--> $DIR/const_fn_ptr.rs:19:14
14+
--> $DIR/const_fn_ptr.rs:18:14
1515
|
1616
LL | const fn foo(x: fn(usize) -> usize, y: usize) -> usize {
1717
| ^
1818
help: skipping check for `const_fn_fn_ptr_basics` feature
19-
--> $DIR/const_fn_ptr.rs:20:5
19+
--> $DIR/const_fn_ptr.rs:19:5
2020
|
2121
LL | x(y)
2222
| ^
2323
help: skipping check that does not even have a feature gate
24-
--> $DIR/const_fn_ptr.rs:20:5
24+
--> $DIR/const_fn_ptr.rs:19:5
2525
|
2626
LL | x(y)
2727
| ^^^^

src/test/ui/consts/const-eval/const_fn_ptr_fail.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
// run-pass
22
// compile-flags: -Zunleash-the-miri-inside-of-you
3-
#![feature(const_fn)]
43
#![allow(unused)]
54

65
fn double(x: usize) -> usize { x * 2 }

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
warning: skipping const checks
22
|
33
help: skipping check that does not even have a feature gate
4-
--> $DIR/const_fn_ptr_fail.rs:10:5
4+
--> $DIR/const_fn_ptr_fail.rs:9:5
55
|
66
LL | X(x) // FIXME: this should error someday
77
| ^^^^

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// build-fail
22
// compile-flags: -Zunleash-the-miri-inside-of-you
33

4-
#![feature(const_fn)]
54
#![allow(const_err)]
65

76
fn double(x: usize) -> usize {

0 commit comments

Comments
 (0)