Move ParseSess to librustc_session

This commit is contained in:
Mark Rousskov 2019-11-29 15:45:26 -05:00
parent 817d1ae834
commit 52d4d478a1
3 changed files with 9 additions and 5 deletions

View File

@ -3,3 +3,4 @@ pub mod utils;
#[macro_use] #[macro_use]
pub mod lint; pub mod lint;
pub mod node_id; pub mod node_id;
pub mod parse;

View File

@ -1,10 +1,10 @@
//! Contains `ParseSess` which holds state living beyond what one `Parser` might. //! Contains `ParseSess` which holds state living beyond what one `Parser` might.
//! It also serves as an input to the parser itself. //! It also serves as an input to the parser itself.
use crate::ast::{CrateConfig, NodeId}; use crate::node_id::NodeId;
use crate::early_buffered_lints::BufferedEarlyLint; use crate::lint::BufferedEarlyLint;
use errors::{Applicability, emitter::SilentEmitter, Handler, ColorConfig, DiagnosticBuilder}; use rustc_errors::{Applicability, emitter::SilentEmitter, Handler, ColorConfig, DiagnosticBuilder};
use rustc_data_structures::fx::{FxHashSet, FxHashMap}; use rustc_data_structures::fx::{FxHashSet, FxHashMap};
use rustc_data_structures::sync::{Lrc, Lock, Once}; use rustc_data_structures::sync::{Lrc, Lock, Once};
use rustc_feature::UnstableFeatures; use rustc_feature::UnstableFeatures;
@ -16,6 +16,9 @@ use syntax_pos::source_map::{SourceMap, FilePathMapping};
use std::path::PathBuf; use std::path::PathBuf;
use std::str; use std::str;
// Duplicated from syntax::ast for now
type CrateConfig = FxHashSet<(Symbol, Option<Symbol>)>;
/// Collected spans during parsing for places where a certain feature was /// Collected spans during parsing for places where a certain feature was
/// used and should be feature gated accordingly in `check_crate`. /// used and should be feature gated accordingly in `check_crate`.
#[derive(Default)] #[derive(Default)]
@ -137,7 +140,7 @@ impl ParseSess {
pub fn buffer_lint( pub fn buffer_lint(
&self, &self,
lint_id: &'static rustc_session::lint::Lint, lint_id: &'static crate::lint::Lint,
span: impl Into<MultiSpan>, span: impl Into<MultiSpan>,
id: NodeId, id: NodeId,
msg: &str, msg: &str,

View File

@ -102,7 +102,7 @@ pub mod ptr;
pub mod show_span; pub mod show_span;
pub use syntax_pos::edition; pub use syntax_pos::edition;
pub use syntax_pos::symbol; pub use syntax_pos::symbol;
pub mod sess; pub use rustc_session::parse as sess;
pub mod token; pub mod token;
pub mod tokenstream; pub mod tokenstream;
pub mod visit; pub mod visit;