cleanup dead ast-borrowck / migrate-mode code.

This commit is contained in:
Mazdak Farrokhzad 2019-09-26 01:22:16 +02:00
parent defd5088d6
commit dfd365f3e4
11 changed files with 20 additions and 106 deletions

View file

@ -86,7 +86,6 @@ 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,
[few] upstream_monomorphizations:
rustc::util::nodemap::DefIdMap<
rustc_data_structures::fx::FxHashMap<

View file

@ -93,6 +93,8 @@ impl SuppressRegionErrors {
/// checks, so we should ignore errors if NLL is (unconditionally)
/// enabled.
pub fn when_nll_is_enabled(tcx: TyCtxt<'_>) -> Self {
// FIXME(Centril): Once we actually remove `::Migrate` also make
// this always `true` and then proceed to eliminate the dead code.
match tcx.borrowck_mode() {
// If we're on Migrate mode, report AST region errors
BorrowckMode::Migrate => SuppressRegionErrors { suppressed: false },

View file

@ -100,7 +100,6 @@ pub mod infer;
pub mod lint;
pub mod middle {
pub mod borrowck;
pub mod expr_use_visitor;
pub mod cstore;
pub mod dead;

View file

@ -1,31 +0,0 @@
use crate::ich::StableHashingContext;
use rustc_data_structures::stable_hasher::{HashStable, StableHasher,
StableHasherResult};
#[derive(Copy, Clone, Debug, RustcEncodable, RustcDecodable)]
pub enum SignalledError { SawSomeError, NoErrorsSeen }
impl Default for SignalledError {
fn default() -> SignalledError {
SignalledError::NoErrorsSeen
}
}
impl_stable_hash_for!(enum self::SignalledError { SawSomeError, NoErrorsSeen });
#[derive(Debug, Default, RustcEncodable, RustcDecodable)]
pub struct BorrowCheckResult {
pub signalled_any_error: SignalledError,
}
impl<'a> HashStable<StableHashingContext<'a>> for BorrowCheckResult {
fn hash_stable<W: StableHasherResult>(&self,
hcx: &mut StableHashingContext<'a>,
hasher: &mut StableHasher<W>) {
let BorrowCheckResult {
ref signalled_any_error,
} = *self;
signalled_any_error.hash_stable(hcx, hasher);
}
}

View file

@ -397,10 +397,6 @@ rustc_queries! {
}
BorrowChecking {
query borrowck(key: DefId) -> &'tcx BorrowCheckResult {
cache_on_disk_if { key.is_local() }
}
/// Borrow-checks the function body. If this is a closure, returns
/// additional requirements that the closure's creator must verify.
query mir_borrowck(key: DefId) -> mir::BorrowCheckResult<'tcx> {

View file

@ -478,14 +478,6 @@ impl BorrowckMode {
BorrowckMode::Migrate => true,
}
}
/// Returns whether we should emit the AST-based borrow checker errors.
pub fn use_ast(self) -> bool {
match self {
BorrowckMode::Mir => false,
BorrowckMode::Migrate => false,
}
}
}
pub enum Input {

View file

@ -1435,12 +1435,6 @@ impl<'tcx> TyCtxt<'tcx> {
self.queries.on_disk_cache.serialize(self.global_tcx(), encoder)
}
/// If `true`, we should use the AST-based borrowck (we may *also* use
/// the MIR-based borrowck).
pub fn use_ast_borrowck(self) -> bool {
self.borrowck_mode().use_ast()
}
/// If `true`, we should use the MIR-based borrowck, but also
/// fall back on the AST borrowck if the MIR-based one errors.
pub fn migrate_borrowck(self) -> bool {

View file

@ -4,7 +4,6 @@ use crate::hir::def::{DefKind, Export};
use crate::hir::{self, TraitCandidate, ItemLocalId, CodegenFnAttrs};
use crate::infer::canonical::{self, Canonical};
use crate::lint;
use crate::middle::borrowck::BorrowCheckResult;
use crate::middle::cstore::{ExternCrate, LinkagePreference, NativeLibrary, ForeignModule};
use crate::middle::cstore::{NativeLibraryKind, DepKind, CrateSource};
use crate::middle::privacy::AccessLevels;