Rollup merge of #112643 - compiler-errors:sized-obl-for-arg, r=wesleywiser
Always register sized obligation for argument Removes a "hack" that skips registering sized obligations for parameters that are simple identifiers. This doesn't seem to affect diagnostics because we're probably already being smart enough about deduplicating identical error messages anyways. Fixes #112608
This commit is contained in:
commit
27ae068de3
7 changed files with 57 additions and 22 deletions
|
@ -92,10 +92,7 @@ pub(super) fn check_fn<'a, 'tcx>(
|
|||
fcx.check_pat_top(¶m.pat, param_ty, ty_span, None);
|
||||
|
||||
// Check that argument is Sized.
|
||||
// The check for a non-trivial pattern is a hack to avoid duplicate warnings
|
||||
// for simple cases like `fn foo(x: Trait)`,
|
||||
// where we would error once on the parameter as a whole, and once on the binding `x`.
|
||||
if param.pat.simple_ident().is_none() && !params_can_be_unsized {
|
||||
if !params_can_be_unsized {
|
||||
fcx.require_type_is_sized(
|
||||
param_ty,
|
||||
param.pat.span,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue