Update tests after feature stabilization
This commit is contained in:
parent
7723506d13
commit
8fc835831c
86 changed files with 107 additions and 718 deletions
|
@ -359,22 +359,6 @@ impl<'mir, 'tcx> Checker<'mir, 'tcx> {
|
|||
match *ty.kind() {
|
||||
ty::Ref(_, _, hir::Mutability::Mut) => self.check_op(ops::ty::MutRef(kind)),
|
||||
ty::Opaque(..) => self.check_op(ops::ty::ImplTrait),
|
||||
|
||||
ty::Dynamic(preds, _) => {
|
||||
for pred in preds.iter() {
|
||||
match pred.skip_binder() {
|
||||
ty::ExistentialPredicate::AutoTrait(_)
|
||||
| ty::ExistentialPredicate::Projection(_) => {
|
||||
self.check_op(ops::ty::DynTrait(kind))
|
||||
}
|
||||
ty::ExistentialPredicate::Trait(trait_ref) => {
|
||||
if Some(trait_ref.def_id) != self.tcx.lang_items().sized_trait() {
|
||||
self.check_op(ops::ty::DynTrait(kind))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -817,49 +817,6 @@ pub mod ty {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct DynTrait(pub mir::LocalKind);
|
||||
impl<'tcx> NonConstOp<'tcx> for DynTrait {
|
||||
fn importance(&self) -> DiagnosticImportance {
|
||||
match self.0 {
|
||||
mir::LocalKind::Var | mir::LocalKind::Temp => DiagnosticImportance::Secondary,
|
||||
mir::LocalKind::ReturnPointer | mir::LocalKind::Arg => {
|
||||
DiagnosticImportance::Primary
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn status_in_item(&self, ccx: &ConstCx<'_, 'tcx>) -> Status {
|
||||
if ccx.const_kind() != hir::ConstContext::ConstFn {
|
||||
Status::Allowed
|
||||
} else {
|
||||
Status::Unstable(sym::const_fn_trait_bound)
|
||||
}
|
||||
}
|
||||
|
||||
fn build_error(
|
||||
&self,
|
||||
ccx: &ConstCx<'_, 'tcx>,
|
||||
span: Span,
|
||||
) -> DiagnosticBuilder<'tcx, ErrorGuaranteed> {
|
||||
let mut err = feature_err(
|
||||
&ccx.tcx.sess.parse_sess,
|
||||
sym::const_fn_trait_bound,
|
||||
span,
|
||||
"trait objects in const fn are unstable",
|
||||
);
|
||||
|
||||
match ccx.fn_sig() {
|
||||
Some(fn_sig) if !fn_sig.span.contains(span) => {
|
||||
err.span_label(fn_sig.span, "function declared as const here");
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
|
||||
err
|
||||
}
|
||||
}
|
||||
|
||||
/// A trait bound with the `?const Trait` opt-out
|
||||
#[derive(Debug)]
|
||||
pub struct TraitBoundNotConst;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue