Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move Sessions into (new) librustc_session #66878

Merged
merged 18 commits into from
Dec 3, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3205,6 +3205,7 @@ dependencies = [
"rustc_fs_util",
"rustc_index",
"rustc_macros",
"rustc_session",
"rustc_target",
"scoped-tls",
"serialize",
Expand Down Expand Up @@ -3518,6 +3519,7 @@ dependencies = [
"rustc_fs_util",
"rustc_incremental",
"rustc_index",
"rustc_session",
"rustc_target",
"serialize",
"syntax",
Expand Down Expand Up @@ -3634,6 +3636,7 @@ dependencies = [
"rustc",
"rustc_data_structures",
"rustc_fs_util",
"rustc_session",
"serialize",
"syntax",
"syntax_pos",
Expand Down Expand Up @@ -3697,6 +3700,7 @@ dependencies = [
"rustc_error_codes",
"rustc_feature",
"rustc_index",
"rustc_session",
"rustc_target",
"syntax",
"syntax_pos",
Expand Down Expand Up @@ -3884,6 +3888,22 @@ dependencies = [
"syntax_pos",
]

[[package]]
name = "rustc_session"
version = "0.0.0"
dependencies = [
"log",
"num_cpus",
"rustc_data_structures",
"rustc_errors",
"rustc_feature",
"rustc_fs_util",
"rustc_index",
"rustc_target",
Mark-Simulacrum marked this conversation as resolved.
Show resolved Hide resolved
"serialize",
"syntax_pos",
]

[[package]]
name = "rustc_target"
version = "0.0.0"
Expand Down Expand Up @@ -4463,6 +4483,7 @@ dependencies = [
"rustc_index",
"rustc_lexer",
"rustc_macros",
"rustc_session",
Mark-Simulacrum marked this conversation as resolved.
Show resolved Hide resolved
"scoped-tls",
"serialize",
"smallvec 1.0.0",
Expand Down
1 change: 1 addition & 0 deletions src/librustc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,4 @@ rustc_fs_util = { path = "../librustc_fs_util" }
smallvec = { version = "1.0", features = ["union", "may_dangle"] }
measureme = "0.4"
rustc_error_codes = { path = "../librustc_error_codes" }
rustc_session = { path = "../librustc_session" }
1 change: 0 additions & 1 deletion src/librustc/dep_graph/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ mod prev;
mod query;
mod safe;
mod serialized;
pub mod cgu_reuse_tracker;

pub use self::dep_node::{DepNode, DepKind, DepConstructor, WorkProductId, RecoverKey, label_strs};
pub use self::graph::{DepGraph, WorkProduct, DepNodeIndex, DepNodeColor, TaskDeps, hash_result};
Expand Down
7 changes: 1 addition & 6 deletions src/librustc/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@
#![recursion_limit="512"]

#[macro_use] extern crate bitflags;
extern crate getopts;
#[macro_use] extern crate scoped_tls;
#[cfg(windows)]
extern crate libc;
Expand All @@ -74,10 +73,6 @@ extern crate libc;
#[macro_use] extern crate syntax;
#[macro_use] extern crate smallvec;

// Use the test crate here so we depend on getopts through it. This allow tools to link to both
// librustc_driver and libtest.
extern crate test as _;

#[cfg(test)]
mod tests;

Expand Down Expand Up @@ -113,7 +108,7 @@ pub mod middle {
}

pub mod mir;
pub mod session;
pub use rustc_session as session;
pub mod traits;
pub mod ty;

Expand Down
31 changes: 4 additions & 27 deletions src/librustc/lint/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ use syntax::ast;
use syntax::edition::Edition;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder what, if anything, is holding us back from moving more lints from this file to rustc_lints.
It might be good to structure things as one lint per file like is done in Clippy.
(Also not actionable but making a note of it... cc @oli-obk)

use syntax::source_map::Span;
use syntax::symbol::Symbol;
use syntax::early_buffered_lints::{ILL_FORMED_ATTRIBUTE_INPUT, META_VARIABLE_MISUSE};
use rustc_session::declare_lint;

declare_lint! {
pub EXCEEDING_BITSHIFTS,
Expand Down Expand Up @@ -404,31 +406,6 @@ declare_lint! {
};
}

/// Some lints that are buffered from `libsyntax`. See `syntax::early_buffered_lints`.
pub mod parser {
declare_lint! {
pub ILL_FORMED_ATTRIBUTE_INPUT,
Deny,
"ill-formed attribute inputs that were previously accepted and used in practice",
@future_incompatible = super::FutureIncompatibleInfo {
reference: "issue #57571 <https://github.com/rust-lang/rust/issues/57571>",
edition: None,
};
}

declare_lint! {
pub META_VARIABLE_MISUSE,
Allow,
"possible meta-variable misuse at macro definition"
}

declare_lint! {
pub INCOMPLETE_INCLUDE,
Deny,
"trailing content in included file"
}
}

declare_lint! {
pub DEPRECATED_IN_FUTURE,
Allow,
Expand Down Expand Up @@ -520,8 +497,8 @@ declare_lint_pass! {
PROC_MACRO_DERIVE_RESOLUTION_FALLBACK,
MACRO_USE_EXTERN_CRATE,
MACRO_EXPANDED_MACRO_EXPORTS_ACCESSED_BY_ABSOLUTE_PATHS,
parser::ILL_FORMED_ATTRIBUTE_INPUT,
parser::META_VARIABLE_MISUSE,
ILL_FORMED_ATTRIBUTE_INPUT,
META_VARIABLE_MISUSE,
DEPRECATED_IN_FUTURE,
AMBIGUOUS_ASSOCIATED_ITEMS,
MUTABLE_BORROW_RESERVATION_CONFLICT,
Expand Down
1 change: 1 addition & 0 deletions src/librustc/lint/internal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use errors::Applicability;
use rustc_data_structures::fx::FxHashMap;
use syntax::ast::{Ident, Item, ItemKind};
use syntax::symbol::{sym, Symbol};
use rustc_session::declare_tool_lint;

declare_tool_lint! {
pub rustc::DEFAULT_HASH_TYPES,
Expand Down
20 changes: 2 additions & 18 deletions src/librustc/lint/levels.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use crate::lint::{self, Lint, LintId, Level, LintSource};
use crate::session::Session;
use crate::util::nodemap::FxHashMap;
use errors::{Applicability, DiagnosticBuilder};
use rustc_data_structures::stable_hasher::{HashStable, ToStableHashKey, StableHasher};
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
use syntax::ast;
use syntax::attr;
use syntax::feature_gate;
Expand Down Expand Up @@ -93,7 +93,7 @@ impl LintLevelSets {

// If `level` is none then we actually assume the default level for this
// lint.
let mut level = level.unwrap_or_else(|| lint.default_level(sess));
let mut level = level.unwrap_or_else(|| lint.default_level(sess.edition()));

// If we're about to issue a warning, check at the last minute for any
// directives against the warnings "lint". If, for example, there's an
Expand Down Expand Up @@ -566,19 +566,3 @@ impl<'a> HashStable<StableHashingContext<'a>> for LintLevelMap {
})
}
}

impl<HCX> HashStable<HCX> for LintId {
#[inline]
fn hash_stable(&self, hcx: &mut HCX, hasher: &mut StableHasher) {
self.lint_name_raw().hash_stable(hcx, hasher);
}
}

impl<HCX> ToStableHashKey<HCX> for LintId {
type KeyType = &'static str;

#[inline]
fn to_stable_hash_key(&self, _: &HCX) -> &'static str {
self.lint_name_raw()
}
}
Loading