Skip to content

Commit f65d96f

Browse files
authored
Auto merge of rust-lang#35340 - michaelwoerister:incr-comp-cli-args, r=nikomatsakis
Take commandline arguments into account for incr. comp. Implements the conservative strategy described in rust-lang#33727. From now one, every time a new commandline option is added, one has to specify if it influences the incremental compilation cache. I've tried to implement this as automatic as possible: One just has to added either the `[TRACKED]` or the `[UNTRACKED]` marker next to the field. The `Options`, `CodegenOptions`, and `DebuggingOptions` definitions in `session::config` show plenty of examples. The PR removes some cruft from `session::config::Options`, mostly unnecessary copies of flags also present in `DebuggingOptions` or `CodeGenOptions` in the same struct. One notable removal is the `cfg` field that contained the values passed via `--cfg` commandline arguments. I chose to remove it because (1) its content is only a subset of what later is stored in `hir::Crate::config` and it's pretty likely that reading the cfgs from `Options` would not be what you wanted, and (2) we could not incorporate it into the dep-tracking hash of the `Options` struct because of how the test framework works, leaving us with a piece of untracked but vital data. It is now recommended (just as before) to access the crate config via the `krate()` method in the HIR map. Because the `cfg` field is not present in the `Options` struct any more, some methods in the `CompilerCalls` trait now take the crate config as an explicit parameter -- which might constitute a breaking change for plugin authors.
2 parents b72fa8c + 67f19e5 commit f65d96f

File tree

26 files changed

+1186
-248
lines changed

26 files changed

+1186
-248
lines changed

src/librustc/lint/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ impl LintId {
269269
}
270270

271271
/// Setting for how to handle a lint.
272-
#[derive(Clone, Copy, PartialEq, PartialOrd, Eq, Ord, Debug)]
272+
#[derive(Clone, Copy, PartialEq, PartialOrd, Eq, Ord, Debug, Hash)]
273273
pub enum Level {
274274
Allow, Warn, Deny, Forbid
275275
}

src/librustc/middle/cstore.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ pub enum LinkagePreference {
7373
}
7474

7575
enum_from_u32! {
76-
#[derive(Copy, Clone, PartialEq)]
76+
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
7777
pub enum NativeLibraryKind {
7878
NativeStatic, // native static library (.a archive)
7979
NativeFramework, // OSX-specific

0 commit comments

Comments
 (0)