don't let const_fn feature flag affect impl-block-level trait bounds
This commit is contained in:
parent
ada102456d
commit
9a852776f4
11 changed files with 9 additions and 21 deletions
|
@ -426,7 +426,7 @@ impl Validator<'mir, 'tcx> {
|
||||||
ty::PredicateKind::Subtype(_) => {
|
ty::PredicateKind::Subtype(_) => {
|
||||||
bug!("subtype predicate on function: {:#?}", predicate)
|
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() {
|
if Some(pred.def_id()) == tcx.lang_items().sized_trait() {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -440,16 +440,7 @@ impl Validator<'mir, 'tcx> {
|
||||||
// arguments when determining importance.
|
// arguments when determining importance.
|
||||||
let kind = LocalKind::Arg;
|
let kind = LocalKind::Arg;
|
||||||
|
|
||||||
if constness == hir::Constness::Const {
|
|
||||||
self.check_op_spanned(ops::ty::TraitBound(kind), span);
|
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// other kinds of bounds are either tautologies
|
// other kinds of bounds are either tautologies
|
||||||
// or cause errors in other passes
|
// or cause errors in other passes
|
||||||
|
|
|
@ -21,7 +21,8 @@
|
||||||
#![feature(rustc_allow_const_fn_unstable)]
|
#![feature(rustc_allow_const_fn_unstable)]
|
||||||
#![feature(nll)]
|
#![feature(nll)]
|
||||||
#![feature(staged_api)]
|
#![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(const_fn_fn_ptr_basics)]
|
||||||
#![feature(allow_internal_unstable)]
|
#![feature(allow_internal_unstable)]
|
||||||
#![feature(decl_macro)]
|
#![feature(decl_macro)]
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
|
|
||||||
#![allow(incomplete_features)]
|
#![allow(incomplete_features)]
|
||||||
#![feature(const_trait_impl)]
|
#![feature(const_trait_impl)]
|
||||||
#![feature(const_fn)]
|
|
||||||
|
|
||||||
struct NonConstAdd(i32);
|
struct NonConstAdd(i32);
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
#![allow(incomplete_features)]
|
#![allow(incomplete_features)]
|
||||||
#![feature(const_trait_impl)]
|
#![feature(const_trait_impl)]
|
||||||
#![feature(const_fn)]
|
|
||||||
|
|
||||||
pub trait Plus {
|
pub trait Plus {
|
||||||
fn plus(self, rhs: Self) -> Self;
|
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
|
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)
|
LL | a.plus(b)
|
||||||
| ^^^^^^^^^
|
| ^^^^^^^^^
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
#![allow(incomplete_features)]
|
#![allow(incomplete_features)]
|
||||||
#![feature(const_trait_impl)]
|
#![feature(const_trait_impl)]
|
||||||
#![feature(const_fn)]
|
|
||||||
|
|
||||||
struct Int(i32);
|
struct Int(i32);
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#![feature(const_fn)]
|
#![feature(const_fn_trait_bound)]
|
||||||
#![feature(const_trait_impl)]
|
#![feature(const_trait_impl)]
|
||||||
#![feature(const_trait_bound_opt_out)]
|
#![feature(const_trait_bound_opt_out)]
|
||||||
#![allow(incomplete_features)]
|
#![allow(incomplete_features)]
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// check-pass
|
// check-pass
|
||||||
|
|
||||||
#![feature(const_fn)]
|
#![feature(const_fn_trait_bound)]
|
||||||
#![feature(const_trait_impl)]
|
#![feature(const_trait_impl)]
|
||||||
#![feature(const_trait_bound_opt_out)]
|
#![feature(const_trait_bound_opt_out)]
|
||||||
#![allow(incomplete_features)]
|
#![allow(incomplete_features)]
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
// FIXME(jschievink): this is not rejected correctly (only when the non-const impl is actually used)
|
// FIXME(jschievink): this is not rejected correctly (only when the non-const impl is actually used)
|
||||||
// ignore-test
|
// ignore-test
|
||||||
|
|
||||||
#![feature(const_fn)]
|
|
||||||
#![feature(const_trait_impl)]
|
#![feature(const_trait_impl)]
|
||||||
#![allow(incomplete_features)]
|
#![allow(incomplete_features)]
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
#![cfg_attr(gated, feature(const_trait_bound_opt_out))]
|
#![cfg_attr(gated, feature(const_trait_bound_opt_out))]
|
||||||
#![allow(incomplete_features)]
|
#![allow(incomplete_features)]
|
||||||
#![feature(rustc_attrs)]
|
#![feature(rustc_attrs)]
|
||||||
#![feature(const_fn)]
|
#![feature(const_fn_trait_bound)]
|
||||||
|
|
||||||
trait T {
|
trait T {
|
||||||
const CONST: i32;
|
const CONST: i32;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// Regression test for #69615.
|
// Regression test for #69615.
|
||||||
|
|
||||||
#![feature(const_trait_impl, const_fn)]
|
#![feature(const_trait_impl)]
|
||||||
#![allow(incomplete_features)]
|
#![allow(incomplete_features)]
|
||||||
|
|
||||||
pub trait MyTrait {
|
pub trait MyTrait {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue