mirror of
https://github.com/rust-lang/rust.git
synced 2025-06-06 04:08:40 +00:00
fix ICE when ~const
used on non-const trait
This commit is contained in:
parent
e4f237d39e
commit
324ca878ce
@ -378,7 +378,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
|||||||
assert!(self_ty.is_none());
|
assert!(self_ty.is_none());
|
||||||
}
|
}
|
||||||
|
|
||||||
let arg_count = check_generic_arg_count(
|
let mut arg_count = check_generic_arg_count(
|
||||||
tcx,
|
tcx,
|
||||||
span,
|
span,
|
||||||
def_id,
|
def_id,
|
||||||
@ -560,6 +560,14 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
|||||||
inferred_params: vec![],
|
inferred_params: vec![],
|
||||||
infer_args,
|
infer_args,
|
||||||
};
|
};
|
||||||
|
if let ty::BoundConstness::ConstIfConst = constness
|
||||||
|
&& generics.has_self
|
||||||
|
&& !tcx.has_attr(def_id, sym::const_trait)
|
||||||
|
{
|
||||||
|
let e = tcx.sess.emit_err(crate::errors::ConstBoundForNonConstTrait { span });
|
||||||
|
arg_count.correct =
|
||||||
|
Err(GenericArgCountMismatch { reported: Some(e), invalid_args: vec![] });
|
||||||
|
}
|
||||||
let args = create_args_for_parent_generic_args(
|
let args = create_args_for_parent_generic_args(
|
||||||
tcx,
|
tcx,
|
||||||
def_id,
|
def_id,
|
||||||
@ -570,13 +578,6 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
|||||||
&mut args_ctx,
|
&mut args_ctx,
|
||||||
);
|
);
|
||||||
|
|
||||||
if let ty::BoundConstness::ConstIfConst = constness
|
|
||||||
&& generics.has_self
|
|
||||||
&& !tcx.has_attr(def_id, sym::const_trait)
|
|
||||||
{
|
|
||||||
tcx.sess.emit_err(crate::errors::ConstBoundForNonConstTrait { span });
|
|
||||||
}
|
|
||||||
|
|
||||||
(args, arg_count)
|
(args, arg_count)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user