Skip to content

Commit 64de44e

Browse files
Set back Ty parameter to FnCntxt
1 parent 8dee5ab commit 64de44e

File tree

3 files changed

+6
-7
lines changed

3 files changed

+6
-7
lines changed

src/librustc_typeck/check/compare_method.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -376,8 +376,7 @@ fn compare_predicate_entailment<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
376376
&infcx.parameter_environment.caller_bounds);
377377
infcx.resolve_regions_and_report_errors(&free_regions, impl_m_body_id);
378378
} else {
379-
let mut fcx = FnCtxt::new(&inh, impl_m_body_id);
380-
fcx.ret_ty = Some(tcx.types.err);
379+
let fcx = FnCtxt::new(&inh, Some(tcx.types.err), impl_m_body_id);
381380
fcx.regionck_item(impl_m_body_id, impl_m_span, &[]);
382381
}
383382

src/librustc_typeck/check/mod.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -785,7 +785,7 @@ fn check_fn<'a, 'gcx, 'tcx>(inherited: &'a Inherited<'a, 'gcx, 'tcx>,
785785

786786
// Create the function context. This is either derived from scratch or,
787787
// in the case of function expressions, based on the outer context.
788-
let mut fcx = FnCtxt::new(inherited, body.id);
788+
let mut fcx = FnCtxt::new(inherited, None, body.id);
789789
let ret_ty = fn_sig.output();
790790
*fcx.ps.borrow_mut() = UnsafetyState::function(unsafety, unsafety_id);
791791

@@ -1246,7 +1246,7 @@ fn check_const_with_type<'a, 'tcx>(ccx: &'a CrateCtxt<'a, 'tcx>,
12461246
expected_type: Ty<'tcx>,
12471247
id: ast::NodeId) {
12481248
ccx.inherited(id).enter(|inh| {
1249-
let fcx = FnCtxt::new(&inh, expr.id);
1249+
let fcx = FnCtxt::new(&inh, None, expr.id);
12501250
fcx.require_type_is_sized(expected_type, expr.span, traits::ConstSized);
12511251

12521252
// Gather locals in statics (because of block expressions).
@@ -1531,14 +1531,15 @@ enum TupleArgumentsFlag {
15311531

15321532
impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
15331533
pub fn new(inh: &'a Inherited<'a, 'gcx, 'tcx>,
1534+
rty: Option<Ty<'tcx>>,
15341535
body_id: ast::NodeId)
15351536
-> FnCtxt<'a, 'gcx, 'tcx> {
15361537
FnCtxt {
15371538
ast_ty_to_ty_cache: RefCell::new(NodeMap()),
15381539
body_id: body_id,
15391540
writeback_errors: Cell::new(false),
15401541
err_count_on_creation: inh.tcx.sess.err_count(),
1541-
ret_ty: None,
1542+
ret_ty: rty,
15421543
ps: RefCell::new(UnsafetyState::function(hir::Unsafety::Normal,
15431544
ast::CRATE_NODE_ID)),
15441545
diverges: Cell::new(Diverges::Maybe),

src/librustc_typeck/check/wfcheck.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,7 @@ impl<'a, 'gcx, 'tcx> CheckWfFcxBuilder<'a, 'gcx, 'tcx> {
5151
let id = self.id;
5252
let span = self.span;
5353
self.inherited.enter(|inh| {
54-
let mut fcx = FnCtxt::new(&inh, id);
55-
fcx.ret_ty = Some(inh.ccx.tcx.types.never);
54+
let fcx = FnCtxt::new(&inh, Some(inh.ccx.tcx.types.never), id);
5655
let wf_tys = f(&fcx, &mut CheckTypeWellFormedVisitor {
5756
ccx: fcx.ccx,
5857
code: code

0 commit comments

Comments
 (0)