mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 23:04:33 +00:00
don't let const_fn feature flag affect impl-block-level trait bounds
This commit is contained in:
parent
ada102456d
commit
9a852776f4
@ -426,7 +426,7 @@ impl Validator<'mir, 'tcx> {
|
||||
ty::PredicateKind::Subtype(_) => {
|
||||
bug!("subtype predicate on function: {:#?}", predicate)
|
||||
}
|
||||
ty::PredicateKind::Trait(pred, constness) => {
|
||||
ty::PredicateKind::Trait(pred, _constness) => {
|
||||
if Some(pred.def_id()) == tcx.lang_items().sized_trait() {
|
||||
continue;
|
||||
}
|
||||
@ -440,16 +440,7 @@ impl Validator<'mir, 'tcx> {
|
||||
// arguments when determining importance.
|
||||
let kind = LocalKind::Arg;
|
||||
|
||||
if constness == hir::Constness::Const {
|
||||
self.check_op_spanned(ops::ty::TraitBound(kind), span);
|
||||
} else if !tcx.features().const_fn
|
||||
|| self.ccx.is_const_stable_const_fn()
|
||||
{
|
||||
// HACK: We shouldn't need the conditional above, but trait
|
||||
// bounds on containing impl blocks are wrongly being marked as
|
||||
// "not-const".
|
||||
self.check_op_spanned(ops::ty::TraitBound(kind), span);
|
||||
}
|
||||
self.check_op_spanned(ops::ty::TraitBound(kind), span);
|
||||
}
|
||||
// other kinds of bounds are either tautologies
|
||||
// or cause errors in other passes
|
||||
|
@ -21,7 +21,8 @@
|
||||
#![feature(rustc_allow_const_fn_unstable)]
|
||||
#![feature(nll)]
|
||||
#![feature(staged_api)]
|
||||
#![feature(const_fn)]
|
||||
#![cfg_attr(bootstrap, feature(const_fn))]
|
||||
#![cfg_attr(not(bootstrap), feature(const_fn_trait_bound))]
|
||||
#![feature(const_fn_fn_ptr_basics)]
|
||||
#![feature(allow_internal_unstable)]
|
||||
#![feature(decl_macro)]
|
||||
|
@ -5,7 +5,6 @@
|
||||
|
||||
#![allow(incomplete_features)]
|
||||
#![feature(const_trait_impl)]
|
||||
#![feature(const_fn)]
|
||||
|
||||
struct NonConstAdd(i32);
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
#![allow(incomplete_features)]
|
||||
#![feature(const_trait_impl)]
|
||||
#![feature(const_fn)]
|
||||
|
||||
pub trait Plus {
|
||||
fn plus(self, rhs: Self) -> Self;
|
||||
|
@ -1,5 +1,5 @@
|
||||
error[E0015]: calls in constant functions are limited to constant functions, tuple structs and tuple variants
|
||||
--> $DIR/call-const-trait-method-fail.rs:26:5
|
||||
--> $DIR/call-const-trait-method-fail.rs:25:5
|
||||
|
|
||||
LL | a.plus(b)
|
||||
| ^^^^^^^^^
|
||||
|
@ -2,7 +2,6 @@
|
||||
|
||||
#![allow(incomplete_features)]
|
||||
#![feature(const_trait_impl)]
|
||||
#![feature(const_fn)]
|
||||
|
||||
struct Int(i32);
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#![feature(const_fn)]
|
||||
#![feature(const_fn_trait_bound)]
|
||||
#![feature(const_trait_impl)]
|
||||
#![feature(const_trait_bound_opt_out)]
|
||||
#![allow(incomplete_features)]
|
||||
|
@ -1,6 +1,6 @@
|
||||
// check-pass
|
||||
|
||||
#![feature(const_fn)]
|
||||
#![feature(const_fn_trait_bound)]
|
||||
#![feature(const_trait_impl)]
|
||||
#![feature(const_trait_bound_opt_out)]
|
||||
#![allow(incomplete_features)]
|
||||
|
@ -1,7 +1,6 @@
|
||||
// FIXME(jschievink): this is not rejected correctly (only when the non-const impl is actually used)
|
||||
// ignore-test
|
||||
|
||||
#![feature(const_fn)]
|
||||
#![feature(const_trait_impl)]
|
||||
#![allow(incomplete_features)]
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
#![cfg_attr(gated, feature(const_trait_bound_opt_out))]
|
||||
#![allow(incomplete_features)]
|
||||
#![feature(rustc_attrs)]
|
||||
#![feature(const_fn)]
|
||||
#![feature(const_fn_trait_bound)]
|
||||
|
||||
trait T {
|
||||
const CONST: i32;
|
||||
|
@ -1,6 +1,6 @@
|
||||
// Regression test for #69615.
|
||||
|
||||
#![feature(const_trait_impl, const_fn)]
|
||||
#![feature(const_trait_impl)]
|
||||
#![allow(incomplete_features)]
|
||||
|
||||
pub trait MyTrait {
|
||||
|
Loading…
Reference in New Issue
Block a user