Add unsized_fn_params feature
This commit is contained in:
parent
2a71e45411
commit
708fc3b1a2
46 changed files with 165 additions and 86 deletions
|
@ -1456,7 +1456,9 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
|
|||
}
|
||||
|
||||
self.check_rvalue(body, rv, location);
|
||||
if !self.tcx().features().unsized_locals {
|
||||
if !(self.tcx().features().unsized_locals
|
||||
|| self.tcx().features().unsized_fn_params)
|
||||
{
|
||||
let trait_ref = ty::TraitRef {
|
||||
def_id: tcx.require_lang_item(LangItem::Sized, Some(self.last_span)),
|
||||
substs: tcx.mk_substs_trait(place_ty, &[]),
|
||||
|
@ -1717,9 +1719,9 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
|
|||
);
|
||||
}
|
||||
|
||||
// When `#![feature(unsized_locals)]` is not enabled,
|
||||
// When `unsized_fn_params` or `unsized_locals` is not enabled,
|
||||
// this check is done at `check_local`.
|
||||
if self.tcx().features().unsized_locals {
|
||||
if self.tcx().features().unsized_locals || self.tcx().features().unsized_fn_params {
|
||||
let span = term.source_info.span;
|
||||
self.ensure_place_sized(dest_ty, span);
|
||||
}
|
||||
|
@ -1880,9 +1882,9 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
|
|||
LocalKind::Var | LocalKind::Temp => {}
|
||||
}
|
||||
|
||||
// When `#![feature(unsized_locals)]` is enabled, only function calls
|
||||
// When `unsized_fn_params` or `unsized_locals` is enabled, only function calls
|
||||
// and nullary ops are checked in `check_call_dest`.
|
||||
if !self.tcx().features().unsized_locals {
|
||||
if !(self.tcx().features().unsized_locals || self.tcx().features().unsized_fn_params) {
|
||||
let span = local_decl.source_info.span;
|
||||
let ty = local_decl.ty;
|
||||
self.ensure_place_sized(ty, span);
|
||||
|
@ -2024,7 +2026,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
|
|||
|
||||
Rvalue::NullaryOp(_, ty) => {
|
||||
// Even with unsized locals cannot box an unsized value.
|
||||
if self.tcx().features().unsized_locals {
|
||||
if self.tcx().features().unsized_locals || self.tcx().features().unsized_fn_params {
|
||||
let span = body.source_info(location).span;
|
||||
self.ensure_place_sized(ty, span);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue