Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
47a443c
Duplicate lint specifications are always bug!
Mark-Simulacrum Sep 24, 2019
577d442
De-propagate optional session from lint registration
Mark-Simulacrum Sep 24, 2019
2121b04
Handle lints, not passes in push_lints
Mark-Simulacrum Sep 24, 2019
748eccd
Lints being from a plugin is dependent on the lint, not the registration
Mark-Simulacrum Oct 7, 2019
b060f3b
Split module and crate late pass registration
Mark-Simulacrum Oct 7, 2019
e1079c8
Split out just registration to separate function
Mark-Simulacrum Oct 7, 2019
68c07db
No longer implicitly register lints when registering passes
Mark-Simulacrum Oct 7, 2019
7fef397
Make get_lints be a static function
Mark-Simulacrum Oct 7, 2019
2454512
Take lint passes as constructor functions
Mark-Simulacrum Oct 7, 2019
aa4ee2c
Move to storing constructor functions inside LintStore
Mark-Simulacrum Oct 7, 2019
c1abc30
Make declare_lint take any amount of boolean fields
Mark-Simulacrum Oct 8, 2019
7abb1fa
Remove side table of future incompatibility info
Mark-Simulacrum Oct 9, 2019
c4475c7
Access future incompatibility information directly
Mark-Simulacrum Oct 9, 2019
da56d1d
Remove all borrows of lint store from Session from librustc
Mark-Simulacrum Oct 9, 2019
dab3bd6
Create lint store during plugin registration
Mark-Simulacrum Oct 9, 2019
b761367
Fix test fallout
Mark-Simulacrum Oct 9, 2019
6be0a70
Update API to be more compatible with plugin needs
Mark-Simulacrum Oct 10, 2019
4e8d1b2
Add some documentation
Mark-Simulacrum Oct 22, 2019
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
Prev Previous commit
Next Next commit
Split module and crate late pass registration
  • Loading branch information
Mark-Simulacrum committed Oct 17, 2019
commit b060f3b84d98a0288cf51a6ab82be61e8f047c31
18 changes: 9 additions & 9 deletions src/librustc/lint/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,17 +188,17 @@ impl LintStore {
}
}

pub fn register_late_pass(&mut self,
register_only: bool,
per_module: bool,
pass: LateLintPassObject) {
pub fn register_late_pass(&mut self, register_only: bool, pass: LateLintPassObject) {
self.push_lints(&pass.get_lints());
if !register_only {
if per_module {
self.late_module_passes.push(pass);
} else {
self.late_passes.lock().as_mut().unwrap().push(pass);
}
self.late_passes.lock().as_mut().unwrap().push(pass);
}
}

pub fn register_late_mod_pass(&mut self, register_only: bool, pass: LateLintPassObject) {
self.push_lints(&pass.get_lints());
if !register_only {
self.late_module_passes.push(pass);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/librustc_interface/passes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ pub fn register_plugins<'a>(
ls.register_early_pass(false, pass);
}
for pass in late_lint_passes {
ls.register_late_pass(false, false, pass);
ls.register_late_pass(false, pass);
}

for (name, (to, deprecated_name)) in lint_groups {
Expand Down
19 changes: 6 additions & 13 deletions src/librustc_lint/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -220,20 +220,13 @@ pub fn register_builtins(store: &mut lint::LintStore, no_interleave_lints: bool)
if no_interleave_lints {
pre_expansion_lint_passes!(register_passes, [register_pre_expansion_pass, []]);
early_lint_passes!(register_passes, [register_early_pass, []]);
late_lint_passes!(register_passes, [register_late_pass, [false]]);
late_lint_mod_passes!(register_passes, [register_late_pass, [true]]);
late_lint_passes!(register_passes, [register_late_pass, []]);
late_lint_mod_passes!(register_passes, [register_late_mod_pass, []]);
} else {
store.register_pre_expansion_pass(
true,
box BuiltinCombinedPreExpansionLintPass::new()
);
store.register_pre_expansion_pass(true, box BuiltinCombinedPreExpansionLintPass::new());
store.register_early_pass(true, box BuiltinCombinedEarlyLintPass::new());
store.register_late_pass(
true, true, box BuiltinCombinedModuleLateLintPass::new()
);
store.register_late_pass(
true, false, box BuiltinCombinedLateLintPass::new()
);
store.register_late_mod_pass(true, box BuiltinCombinedModuleLateLintPass::new());
store.register_late_pass(true, box BuiltinCombinedLateLintPass::new());
}

add_lint_group!("nonstandard_style",
Expand Down Expand Up @@ -493,7 +486,7 @@ pub fn register_builtins(store: &mut lint::LintStore, no_interleave_lints: bool)
pub fn register_internals(store: &mut lint::LintStore) {
store.register_early_pass(false, box DefaultHashTypes::new());
store.register_early_pass(false, box LintPassImpl);
store.register_late_pass(false, false, box TyTyKind);
store.register_late_pass(false, box TyTyKind);
store.register_group(
false,
"rustc::internal",
Expand Down