Skip to content

Commit 1ae1a13

Browse files
committed
Fix new ICE caused by derred arg Sized check
1 parent 0d3f077 commit 1ae1a13

File tree

3 files changed

+14
-18
lines changed

3 files changed

+14
-18
lines changed

compiler/rustc_typeck/src/check/check.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -131,11 +131,7 @@ pub(super) fn check_fn<'a, 'tcx>(
131131
// for simple cases like `fn foo(x: Trait)`,
132132
// where we would error once on the parameter as a whole, and once on the binding `x`.
133133
if param.pat.simple_ident().is_none() && !tcx.features().unsized_locals {
134-
fcx.require_type_is_sized_deferred(
135-
param_ty,
136-
param.pat.span,
137-
traits::SizedArgumentType(ty_span),
138-
);
134+
fcx.require_type_is_sized(param_ty, param.pat.span, traits::SizedArgumentType(ty_span));
139135
}
140136

141137
fcx.write_ty(param.hir_id, param_ty);

src/test/ui/closures/issue-41366.stderr

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
error[E0631]: type mismatch in closure arguments
2+
--> $DIR/issue-41366.rs:10:5
3+
|
4+
LL | (&|_| ()) as &dyn for<'x> Fn(<u32 as T<'x>>::V);
5+
| ^^------^
6+
| | |
7+
| | found signature of `fn(u16) -> _`
8+
| expected signature of `fn(<u32 as T<'x>>::V) -> _`
9+
|
10+
= note: required for the cast to the object type `dyn for<'x> Fn(<u32 as T<'x>>::V)`
11+
112
error[E0277]: the size for values of type `<u32 as T<'_>>::V` cannot be known at compilation time
213
--> $DIR/issue-41366.rs:10:8
314
|
@@ -15,17 +26,6 @@ help: function arguments must have a statically known size, borrowed types alway
1526
LL | (&|&_| ()) as &dyn for<'x> Fn(<u32 as T<'x>>::V);
1627
| ^
1728

18-
error[E0631]: type mismatch in closure arguments
19-
--> $DIR/issue-41366.rs:10:5
20-
|
21-
LL | (&|_| ()) as &dyn for<'x> Fn(<u32 as T<'x>>::V);
22-
| ^^------^
23-
| | |
24-
| | found signature of `fn(u16) -> _`
25-
| expected signature of `fn(<u32 as T<'x>>::V) -> _`
26-
|
27-
= note: required for the cast to the object type `dyn for<'x> Fn(<u32 as T<'x>>::V)`
28-
2929
error: aborting due to 2 previous errors
3030

3131
Some errors have detailed explanations: E0277, E0631.

src/test/ui/typeck/typeck_type_placeholder_item.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -314,10 +314,10 @@ LL | b: (T, T),
314314
|
315315

316316
error[E0282]: type annotations needed
317-
--> $DIR/typeck_type_placeholder_item.rs:128:27
317+
--> $DIR/typeck_type_placeholder_item.rs:128:18
318318
|
319319
LL | fn fn_test11(_: _) -> (_, _) { panic!() }
320-
| ^^^^^^ cannot infer type
320+
| ^ cannot infer type
321321

322322
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
323323
--> $DIR/typeck_type_placeholder_item.rs:128:28

0 commit comments

Comments
 (0)