Skip to content

Rollup of 10 pull requests #83149

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

Merged
merged 33 commits into from
Mar 15, 2021
Merged
Changes from 1 commit
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
1ba71ab
Inline Attribute::has_name
tmiasko Mar 11, 2021
4943190
Validate rustc_layout_scalar_valid_range_{start,end} attributes
tmiasko Mar 11, 2021
9613a88
Refactor `check_doc_attrs` body
camelid Mar 13, 2021
7189c05
Lint non-meta doc attributes
camelid Mar 13, 2021
7e972a3
Report error for each invalid nested attribute
camelid Mar 11, 2021
fe64970
Add another test case
camelid Mar 12, 2021
5134047
Add hyphen to "crate level"
camelid Mar 13, 2021
13884dc
Update `rustdoc-ui` versions of the `doc-attr` test
camelid Mar 14, 2021
e161a2f
Remove unused `opt_local_def_id_to_hir_id` function
jyn514 Mar 14, 2021
71a784d
Fix a typo in `swap_nonoverlapping_bytes`
hiyoko3m Mar 12, 2021
5ec0540
Fix a typo in thread_local_dtor.rs
hiyoko3m Mar 14, 2021
6ddd840
Minor refactoring in try_index_step
osa1 Mar 14, 2021
14038c7
Remove duplicate asserts, replace eq assert with assert_eq
osa1 Mar 14, 2021
13076f9
Tweak diagnostics
camelid Mar 14, 2021
8f40e11
Use pretty-printer instead of `span_to_snippet`
camelid Mar 14, 2021
7429c68
Don't encode file information for span with a dummy location
Aaron1011 Mar 14, 2021
f190bc4
Introduce `proc_macro_back_compat` lint, and emit for `time-macros-impl`
Aaron1011 Mar 14, 2021
d7ab3c7
Add `rustc_interface::interface::Config::parse_sess_created`
Mar 15, 2021
176bb6b
Use `rustc_interface::interface::Config::parse_sess_created` in Clippy
Mar 15, 2021
ebe51cf
:arrow_up: rust-analyzer
lnicola Mar 15, 2021
5eae9af
Custom error on literal names from other languages
syvb Mar 15, 2021
4709dcd
Change the `.unwrap` to `.expect` with a helpful message
Mar 15, 2021
0bbfd54
Fix `src/test/run-make-fulldeps/issue-19371`
Mar 15, 2021
4eca492
Rollup merge of #82989 - Smittyvb:other-lang-literal-errors, r=varkor
Dylan-DPC Mar 15, 2021
b8622f2
Rollup merge of #83054 - tmiasko:rustc_layout_scalar_valid_range, r=d…
Dylan-DPC Mar 15, 2021
75a15bf
Rollup merge of #83098 - camelid:more-doc-attr-check, r=davidtwco
Dylan-DPC Mar 15, 2021
f1061d1
Rollup merge of #83108 - jyn514:remove-unused, r=estebank
Dylan-DPC Mar 15, 2021
194472c
Rollup merge of #83110 - hyksm:fix-typo, r=jonas-schievink
Dylan-DPC Mar 15, 2021
8ec9b2a
Rollup merge of #83113 - osa1:refactor_try_index_step, r=jonas-schievink
Dylan-DPC Mar 15, 2021
d1f5f1d
Rollup merge of #83127 - Aaron1011:time-macros-impl-warn, r=petrochenkov
Dylan-DPC Mar 15, 2021
9b16c7a
Rollup merge of #83132 - Aaron1011:fix/incr-cache-dummy, r=estebank
Dylan-DPC Mar 15, 2021
13eac5b
Rollup merge of #83141 - lnicola:rust-analyzer-2021-03-15, r=jonas-sc…
Dylan-DPC Mar 15, 2021
2816c11
Rollup merge of #83144 - hyd-dev:parse-sess-created, r=oli-obk
Dylan-DPC Mar 15, 2021
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
Use rustc_interface::interface::Config::parse_sess_created in Clippy
  • Loading branch information
hyd-dev committed Mar 15, 2021
commit 176bb6bd38dc73557dc6947077f7239dda7b64ef
20 changes: 8 additions & 12 deletions src/tools/clippy/src/driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ extern crate rustc_session;
extern crate rustc_span;

use rustc_interface::interface;
use rustc_session::Session;
use rustc_session::parse::ParseSess;
use rustc_span::symbol::Symbol;
use rustc_tools_util::VersionInfo;

Expand Down Expand Up @@ -63,8 +63,8 @@ fn test_arg_value() {
assert_eq!(arg_value(args, "--foo", |_| true), None);
}

fn track_clippy_args(sess: &Session, args_env_var: &Option<String>) {
sess.parse_sess.env_depinfo.borrow_mut().insert((
fn track_clippy_args(parse_sess: &mut ParseSess, args_env_var: &Option<String>) {
parse_sess.env_depinfo.get_mut().insert((
Symbol::intern("CLIPPY_ARGS"),
args_env_var.as_deref().map(Symbol::intern),
));
Expand All @@ -81,14 +81,9 @@ struct RustcCallbacks {

impl rustc_driver::Callbacks for RustcCallbacks {
fn config(&mut self, config: &mut interface::Config) {
let previous = config.register_lints.take();
let clippy_args_var = self.clippy_args_var.take();
config.register_lints = Some(Box::new(move |sess, lint_store| {
if let Some(ref previous) = previous {
(previous)(sess, lint_store);
}

track_clippy_args(sess, &clippy_args_var);
config.parse_sess_created = Some(Box::new(move |parse_sess| {
track_clippy_args(parse_sess, &clippy_args_var);
}));
}
}
Expand All @@ -101,15 +96,16 @@ impl rustc_driver::Callbacks for ClippyCallbacks {
fn config(&mut self, config: &mut interface::Config) {
let previous = config.register_lints.take();
let clippy_args_var = self.clippy_args_var.take();
config.parse_sess_created = Some(Box::new(move |parse_sess| {
track_clippy_args(parse_sess, &clippy_args_var);
}));
config.register_lints = Some(Box::new(move |sess, mut lint_store| {
// technically we're ~guaranteed that this is none but might as well call anything that
// is there already. Certainly it can't hurt.
if let Some(previous) = &previous {
(previous)(sess, lint_store);
}

track_clippy_args(sess, &clippy_args_var);

let conf = clippy_lints::read_conf(&[], &sess);
clippy_lints::register_plugins(&mut lint_store, &sess, &conf);
clippy_lints::register_pre_expansion_lints(&mut lint_store);
Expand Down