Keep crate edition in metadata
This commit is contained in:
parent
cd4925d1b8
commit
76bf3454da
5 changed files with 18 additions and 1 deletions
|
@ -34,6 +34,7 @@ use session::search_paths::PathKind;
|
|||
use std::any::Any;
|
||||
use std::path::{Path, PathBuf};
|
||||
use syntax::ast;
|
||||
use syntax::edition::Edition;
|
||||
use syntax::ext::base::SyntaxExtension;
|
||||
use syntax::symbol::Symbol;
|
||||
use syntax_pos::Span;
|
||||
|
@ -235,6 +236,7 @@ pub trait CrateStore {
|
|||
fn crate_name_untracked(&self, cnum: CrateNum) -> Symbol;
|
||||
fn crate_disambiguator_untracked(&self, cnum: CrateNum) -> CrateDisambiguator;
|
||||
fn crate_hash_untracked(&self, cnum: CrateNum) -> Svh;
|
||||
fn crate_edition_untracked(&self, cnum: CrateNum) -> Edition;
|
||||
fn struct_field_names_untracked(&self, def: DefId) -> Vec<ast::Name>;
|
||||
fn item_children_untracked(&self, did: DefId, sess: &Session) -> Vec<def::Export>;
|
||||
fn load_macro_untracked(&self, did: DefId, sess: &Session) -> LoadedMacro;
|
||||
|
@ -309,6 +311,7 @@ impl CrateStore for DummyCrateStore {
|
|||
bug!("crate_disambiguator")
|
||||
}
|
||||
fn crate_hash_untracked(&self, cnum: CrateNum) -> Svh { bug!("crate_hash") }
|
||||
fn crate_edition_untracked(&self, cnum: CrateNum) -> Edition { bug!("crate_edition_untracked") }
|
||||
|
||||
// resolve
|
||||
fn def_key(&self, def: DefId) -> DefKey { bug!("def_key") }
|
||||
|
|
|
@ -24,6 +24,7 @@ use rustc::util::nodemap::{FxHashMap, NodeMap};
|
|||
|
||||
use rustc_data_structures::sync::{Lrc, RwLock, Lock};
|
||||
use syntax::{ast, attr};
|
||||
use syntax::edition::Edition;
|
||||
use syntax::ext::base::SyntaxExtension;
|
||||
use syntax::symbol::Symbol;
|
||||
use syntax_pos;
|
||||
|
@ -234,4 +235,8 @@ impl CrateMetadata {
|
|||
pub fn panic_strategy(&self) -> PanicStrategy {
|
||||
self.root.panic_strategy.clone()
|
||||
}
|
||||
|
||||
pub fn edition(&self) -> Edition {
|
||||
self.root.edition
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,6 +38,7 @@ use std::sync::Arc;
|
|||
use syntax::ast;
|
||||
use syntax::attr;
|
||||
use syntax::codemap;
|
||||
use syntax::edition::Edition;
|
||||
use syntax::ext::base::SyntaxExtension;
|
||||
use syntax::parse::filemap_to_stream;
|
||||
use syntax::symbol::Symbol;
|
||||
|
@ -464,6 +465,11 @@ impl CrateStore for cstore::CStore {
|
|||
self.get_crate_data(cnum).hash()
|
||||
}
|
||||
|
||||
fn crate_edition_untracked(&self, cnum: CrateNum) -> Edition
|
||||
{
|
||||
self.get_crate_data(cnum).edition()
|
||||
}
|
||||
|
||||
/// Returns the `DefKey` for a given `DefId`. This indicates the
|
||||
/// parent `DefId` as well as some idea of what kind of data the
|
||||
/// `DefId` refers to.
|
||||
|
|
|
@ -44,7 +44,7 @@ use syntax::ast::{self, CRATE_NODE_ID};
|
|||
use syntax::codemap::Spanned;
|
||||
use syntax::attr;
|
||||
use syntax::symbol::Symbol;
|
||||
use syntax_pos::{self, FileName, FileMap, Span, DUMMY_SP};
|
||||
use syntax_pos::{self, hygiene, FileName, FileMap, Span, DUMMY_SP};
|
||||
|
||||
use rustc::hir::{self, PatKind};
|
||||
use rustc::hir::itemlikevisit::ItemLikeVisitor;
|
||||
|
@ -496,6 +496,7 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
|
|||
hash: link_meta.crate_hash,
|
||||
disambiguator: tcx.sess.local_crate_disambiguator(),
|
||||
panic_strategy: tcx.sess.panic_strategy(),
|
||||
edition: hygiene::default_edition(),
|
||||
has_global_allocator: has_global_allocator,
|
||||
has_default_lib_allocator: has_default_lib_allocator,
|
||||
plugin_registrar_fn: tcx.sess
|
||||
|
|
|
@ -23,6 +23,7 @@ use rustc_target::spec::{PanicStrategy, TargetTriple};
|
|||
|
||||
use rustc_serialize as serialize;
|
||||
use syntax::{ast, attr};
|
||||
use syntax::edition::Edition;
|
||||
use syntax::symbol::Symbol;
|
||||
use syntax_pos::{self, Span};
|
||||
|
||||
|
@ -189,6 +190,7 @@ pub struct CrateRoot {
|
|||
pub hash: hir::svh::Svh,
|
||||
pub disambiguator: CrateDisambiguator,
|
||||
pub panic_strategy: PanicStrategy,
|
||||
pub edition: Edition,
|
||||
pub has_global_allocator: bool,
|
||||
pub has_default_lib_allocator: bool,
|
||||
pub plugin_registrar_fn: Option<DefIndex>,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue