mirror of https://github.com/rust-lang/rust.git
Update borrowck
This commit is contained in:
parent
8c936e422f
commit
99f6221bb6
|
@ -59,6 +59,7 @@ macro_rules! arena_types {
|
|||
rustc::infer::canonical::QueryResponse<'tcx, rustc::ty::Ty<'tcx>>
|
||||
>,
|
||||
[few] crate_inherent_impls: rustc::ty::CrateInherentImpls,
|
||||
[decode] borrowck: rustc::middle::borrowck::BorrowCheckResult,
|
||||
], $tcx);
|
||||
)
|
||||
}
|
||||
|
|
|
@ -371,7 +371,7 @@ rustc_queries! {
|
|||
}
|
||||
|
||||
BorrowChecking {
|
||||
query borrowck(_: DefId) -> Lrc<BorrowCheckResult> {}
|
||||
query borrowck(_: DefId) -> &'tcx BorrowCheckResult {}
|
||||
|
||||
/// Borrow-checks the function body. If this is a closure, returns
|
||||
/// additional requirements that the closure's creator must verify.
|
||||
|
|
|
@ -32,7 +32,6 @@ use std::borrow::Cow;
|
|||
use std::cell::{Cell, RefCell};
|
||||
use std::fmt;
|
||||
use std::rc::Rc;
|
||||
use rustc_data_structures::sync::Lrc;
|
||||
use std::hash::{Hash, Hasher};
|
||||
use syntax::source_map::CompilerDesugaringKind;
|
||||
use syntax_pos::{MultiSpan, Span};
|
||||
|
@ -75,7 +74,7 @@ pub struct AnalysisData<'a, 'tcx: 'a> {
|
|||
}
|
||||
|
||||
fn borrowck<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, owner_def_id: DefId)
|
||||
-> Lrc<BorrowCheckResult>
|
||||
-> &'tcx BorrowCheckResult
|
||||
{
|
||||
assert!(tcx.use_ast_borrowck() || tcx.migrate_borrowck());
|
||||
|
||||
|
@ -89,7 +88,7 @@ fn borrowck<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, owner_def_id: DefId)
|
|||
// those things (notably the synthesized constructors from
|
||||
// tuple structs/variants) do not have an associated body
|
||||
// and do not need borrowchecking.
|
||||
return Lrc::new(BorrowCheckResult {
|
||||
return tcx.arena.alloc(BorrowCheckResult {
|
||||
used_mut_nodes: Default::default(),
|
||||
signalled_any_error: SignalledError::NoErrorsSeen,
|
||||
})
|
||||
|
@ -136,7 +135,7 @@ fn borrowck<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, owner_def_id: DefId)
|
|||
check_loans::check_loans(&mut bccx, &loan_dfcx, &flowed_moves, &all_loans, body);
|
||||
}
|
||||
|
||||
Lrc::new(BorrowCheckResult {
|
||||
tcx.arena.alloc(BorrowCheckResult {
|
||||
used_mut_nodes: bccx.used_mut_nodes.into_inner(),
|
||||
signalled_any_error: bccx.signalled_any_error.into_inner(),
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue