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

Rollup of 9 pull requests #101244

Closed
wants to merge 188 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
188 commits
Select commit Hold shift + click to select a range
171d082
Compare where predicates to trait bounds.
aldhsu Jul 12, 2022
b96842d
Split unfixable lints.
aldhsu Jul 13, 2022
3ddc04f
Add extra test cases from #8771, #8757, #9076.
aldhsu Jul 13, 2022
b426bd5
Don't lint `transmute_undefined_repr` when the the first field of a `…
Jarcho Aug 3, 2022
80f0f28
Extend `if_then_some_else_none` to also suggest `bool::then_some`
mkrasnitski Aug 4, 2022
99e77d0
Allow type erasure using `*const/mut int_type` in `transmute_undefine…
Jarcho Aug 7, 2022
73cd954
Add iter_once and iter_empty lints
sgued Jul 16, 2022
332e031
Fix the lint in clippy itself
sgued Jul 16, 2022
f3f86d8
Move iter_once and iter_empty to methods as a late pass
sgued Jul 16, 2022
f30d7c2
Improve suggestions
sgued Jul 19, 2022
b247594
Prevent some false positives
sgued Jul 28, 2022
af4885c
Rename new lints to iter_on_empty_collections and iter_on_single_items
sgued Jul 30, 2022
9ffddf5
Add new lint [`positional_named_format_parameters`]
miam-miam Jun 23, 2022
cf3f71d
Do not consider method call receiver as an argument in AST.
cjgillot Aug 7, 2022
6a73a45
Fix if_let_mutex not checking Mutexes behind refs
lukaslueg Aug 10, 2022
0428f0d
Add labels to if_let_mutex
lukaslueg Aug 10, 2022
eb68895
Simplify `rustc_ast::visit::Visitor::visit_poly_trait_ref`.
nnethercote Aug 11, 2022
459821b
fix
tamaroning Jul 2, 2022
45084ee
give up when gurad has side effects
tamaroning Aug 11, 2022
dc29cfb
Merge commit '2b2190cb5667cdd276a24ef8b9f3692209c54a89' into clippyup
flip1995 Aug 11, 2022
4d8b6d4
Rollup merge of #100392 - nnethercote:simplify-visitors, r=cjgillot
matthiaskrgr Aug 11, 2022
9ac237d
Auto merge of #100419 - flip1995:clippyup, r=Manishearth
bors Aug 12, 2022
f7f60b8
Adjust lint description for better clarity
mkrasnitski Aug 12, 2022
8bae517
Lint trait duplication in one pass.
Aug 12, 2022
3c4aec5
Update clippy for introduction of Node::ExprField
ehuss Jul 31, 2022
05fc1c7
Auto merge of #9289 - mkrasnitski:9094, r=xFrednet
bors Aug 12, 2022
1a3192a
Adjust cfgs
Mark-Simulacrum Aug 9, 2022
35486cb
Update Changelog to 1.63
flip1995 Aug 8, 2022
dfa780e
Auto merge of #9324 - flip1995:changelog, r=xFrednet
bors Aug 12, 2022
f18cd27
Update lint versions for 1.63 release
flip1995 Aug 12, 2022
4d5d191
Auto merge of #9326 - flip1995:version-update, r=xFrednet
bors Aug 13, 2022
84df61c
Auto merge of #9167 - aldhsu:fix-trait-duplication-false-pos, r=flip1995
bors Aug 14, 2022
679fa9f
Auto merge of #9187 - sgued:iter-once, r=flip1995
bors Aug 14, 2022
80826c3
Implement clippy::manual_empty_string_creations lint
Guilherme-Vasconcelos Jul 18, 2022
1bf8841
Update all tests to comply with clippy::manual_empty_string_creations
Guilherme-Vasconcelos Aug 5, 2022
1a2aaf6
Skip `unnecessary_to_owned` when `t != t.to_string()`
xphoniex Aug 14, 2022
86a0a18
Auto merge of #96745 - ehuss:even-more-attribute-validation, r=cjgillot
bors Aug 15, 2022
8c9040c
Auto merge of #9329 - xphoniex:fix-#9317, r=flip1995
bors Aug 15, 2022
6de4bdf
Fix label not starting with lcase-letter
lukaslueg Aug 15, 2022
7727c30
Simplify the borrow_deref_ref lint example
stanislav-tkach Aug 13, 2022
0fc95e8
Auto merge of #9318 - lukaslueg:ifletmutexref, r=xFrednet
bors Aug 15, 2022
a427b12
Auto merge of #9328 - stanislav-tkach:borrow_deref_ref-remove-extra-d…
bors Aug 16, 2022
6e5f90a
Shrink `ast::Attribute`.
nnethercote Aug 11, 2022
e92183c
Rename some things related to literals.
nnethercote Aug 1, 2022
9e9b3dd
Fix example
alex-semenyuk Aug 16, 2022
86ac6e8
Auto merge of #9040 - miam-miam100:unused_named_parameter, r=dswij
bors Aug 16, 2022
048e4d0
Auto merge of #9340 - alex-semenyuk:box_t, r=dswij
bors Aug 16, 2022
c1e0435
unwrap_used and expect_used: trigger on uses of their _err variants
sgued Aug 15, 2022
bd121ef
Fix [`non_ascii_literal`] in tests
Serial-ATA Aug 13, 2022
bfeaae8
suggest map_or in case_sensitive_file_extension_comparisons
Aug 16, 2022
f4f5bb4
Auto merge of #9327 - Serial-ATA:non_ascii_literal_macro, r=Alexendoo
bors Aug 16, 2022
343476d
Use `CARGO_TARGET_DIR` in compile-test
Serial-ATA Aug 16, 2022
a331766
Auto merge of #9343 - Serial-ATA:compiletest-target-env, r=Manishearth
bors Aug 16, 2022
a05cb74
Enhance `needless_borrow` to consider trait implementations
smoelius Jul 8, 2022
032f112
Fix adjacent code
smoelius Jul 8, 2022
18c6818
Auto merge of #9341 - bmc-msft:suggest-map_or-instead-of-unwrap_or, r…
bors Aug 17, 2022
48cb816
Handle `CARGO_TARGET_DIR` not being set in compile-test
Jarcho Aug 17, 2022
aadd014
Fix typo in as_undescore docs
cherryblossom000 Aug 17, 2022
4235b64
Auto merge of #9344 - Jarcho:opt_target_dir, r=flip1995
bors Aug 17, 2022
dc497c8
Auto merge of #9345 - cherryblossom000:patch-1, r=flip1995
bors Aug 17, 2022
37eeed7
Rollup merge of #100018 - nnethercote:clean-up-LitKind, r=petrochenkov
matthiaskrgr Aug 17, 2022
84fb7e0
Auto merge of #9287 - Jarcho:trans_undefined, r=xFrednet
bors Aug 17, 2022
ab91d5a
unwrap_used: Fix error message for unwrap_err when expect_used is all…
sgued Aug 17, 2022
849c1c0
Auto merge of #9338 - sgued:9331-unwrap-err-used, r=giraffate
bors Aug 17, 2022
c419d0a
Auto merge of #9136 - smoelius:enhance-needless-borrow, r=Jarcho
bors Aug 18, 2022
e87a5a1
Dont lint on match pattern-binding
lukaslueg Aug 18, 2022
eeaaba3
Auto merge of #9348 - lukaslueg:issue9347, r=Alexendoo
bors Aug 18, 2022
868dba9
Auto merge of #9295 - Guilherme-Vasconcelos:manual-empty-string-creat…
bors Aug 19, 2022
2666c38
Add [`unused_peekable`] lint
Serial-ATA Jul 29, 2022
0efafa4
Better handle method/function calls
Serial-ATA Aug 5, 2022
8ab2f88
Move `AsUnderscore` into `Casts` lint pass
Jarcho Jun 5, 2022
21f5954
Move `BorrowAsPtr` into `Casts` lint pass
Jarcho Jun 5, 2022
2502898
Move `ByteCount` into `Methods` lint pass
Jarcho Jun 5, 2022
ba6a459
Move `BytesCountToLen` into `Methods` lint pass
Jarcho Jun 5, 2022
e3b7797
Move `CaseSensitiveFileExtensionComparisons` into `Methods` lint pass
Jarcho Jun 5, 2022
a8d80d5
Move `GetFirst` into `Methods` lint pass
Jarcho Jun 5, 2022
5bc8813
Move `ManualOkOr` into `Methods` lint pass
Jarcho Jun 5, 2022
4523954
Move `MapClone` into `Methods` lint pass
Jarcho Jun 5, 2022
2f0ed0a
Move `MapErrIgnore` into `Methods` lint pass
Jarcho Jun 5, 2022
508cf6b
Move `MutMutexLock` into `Methods` lint pass
Jarcho Jun 5, 2022
0cc01ce
Move `OpenOptions` into `Methods` lint pass
Jarcho Jun 6, 2022
226f135
Move `PathBufPushOverwrite` into `Methods` lint group
Jarcho Jun 6, 2022
fd53761
Move `range_zip_with_len` into `Methods` lint pass
Jarcho Jun 6, 2022
06d752e
Move `RepeatOnce` into `Methods` lint pass
Jarcho Jun 6, 2022
e834855
Move `StableSortPrimitive` to `Methods` lint pass
Jarcho Jun 6, 2022
e213b6e
Move `TransmutingNull` into `Transmute` lint pass
Jarcho Jun 6, 2022
bb0584d
Move `UnitHash` into `Methods` lint pass
Jarcho Jun 6, 2022
d8d4a13
Move `UnnecessarySortBy` into `Methods` lint pass
Jarcho Jun 6, 2022
8acc4d2
Move `VecResizeToZero` into `Methods` lint pass
Jarcho Jun 6, 2022
d8808db
Move `VerboseFileReads` into `Methods` lint pass
Jarcho Jun 6, 2022
477c16d
Auto merge of #8957 - Jarcho:more_pass_merges, r=flip1995
bors Aug 19, 2022
4f049f5
Refactor `FormatArgsExpn`
Alexendoo Aug 18, 2022
d95b675
Rework `only_used_in_recursion`
Jarcho May 8, 2022
39f4bee
Move `only_used_in_recursion` back into `complexity`
Jarcho May 16, 2022
3e594de
Auto merge of #9349 - Alexendoo:format-args-expn, r=flip1995
bors Aug 19, 2022
3a54117
Auto merge of #8804 - Jarcho:in_recursion, r=Alexendoo
bors Aug 19, 2022
a4413f7
Register new lint collapsible_str_replace to methods
nahuakang Aug 2, 2022
89698b9
Extend and improve initial test cases for collapsible_str_replace
nahuakang Aug 4, 2022
6e86687
Handle replace calls with char slices
nahuakang Aug 5, 2022
a9bd0bd
Handle repeated str::replace calls with single char kind to str
nahuakang Aug 7, 2022
c989746
Remove checks on char slice; improve lint suggestion
nahuakang Aug 8, 2022
fb30b64
Adjust test cases; run cargo dev bless
nahuakang Aug 8, 2022
2091142
Auto merge of #9258 - Serial-ATA:unused-peekable, r=Alexendoo
bors Aug 19, 2022
2781ad0
Fix typos
alex-semenyuk Aug 20, 2022
b070b40
Simplify lint logic and address code review comments
nahuakang Aug 14, 2022
0dfec01
Auto merge of #9355 - alex-semenyuk:fixed_typos, r=giraffate
bors Aug 20, 2022
5820add
Auto merge of #9269 - nahuakang:collapsible_str_replace, r=flip1995
bors Aug 20, 2022
6f3d398
Add test for #8855
smoelius May 20, 2022
41309df
Auto merge of #8857 - smoelius:fix-8855, r=flip1995
bors Aug 20, 2022
bafa89b
Suggest moving redundant generic args of an assoc fn to its trait
hkmatsumoto Aug 21, 2022
5d403c0
allow check for `match` in lint [`option_if_let_else`]
J-ZhengLi Apr 16, 2022
ffe7125
and check for `Result`
J-ZhengLi Apr 16, 2022
f7a376e
Update needless_match.stderr
tamaroning Aug 21, 2022
1f75845
Reduce indentation and add comment about lint name
flip1995 Aug 21, 2022
87b3afc
Auto merge of #8696 - J-ZhengLi:issue8492, r=flip1995
bors Aug 21, 2022
5048af7
feat(fix): Do not lint if the target code is inside a loop
kyoto7250 Jun 13, 2022
318ed05
Reduce code duplication
flip1995 Aug 21, 2022
070b035
Improve error if rustfix coverage test spuriously fails
flip1995 Aug 21, 2022
e19a05c
Auto merge of #8992 - kyoto7250:fix_8753, r=flip1995
bors Aug 21, 2022
cc637ba
Auto merge of #9092 - tamaroning:fix-needless-match, r=llogiq
bors Aug 21, 2022
687fcf1
Fix `to_string_in_format_args` false positive
smoelius Jul 29, 2022
0bc26c8
`needed_ref` -> `needs_ref`
smoelius Jul 29, 2022
5735a3b
Auto merge of #9259 - smoelius:fix-9256, r=llogiq
bors Aug 22, 2022
06d7119
Remove the symbol from `ast::LitKind::Err`.
nnethercote Aug 22, 2022
2cb5318
Rename `manual_empty_string_creation` and move to pedantic
Alexendoo Aug 23, 2022
b33002d
Auto merge of #9366 - Alexendoo:manual_string_new, r=xFrednet
bors Aug 23, 2022
345c42a
Stabilize `#![feature(label_break_value)]`
jyn514 Jul 14, 2022
a0afbdf
Replace `contains_ty(..)` with `Ty::contains(..)`
Aug 24, 2022
79a439a
Auto merge of #9370 - mikerite:20220824_ty_contains, r=Jarcho
bors Aug 24, 2022
2cdc54d
Rollup merge of #99332 - jyn514:stabilize-label-break-value, r=petroc…
JohnTitor Aug 24, 2022
61aa4ef
uninit_vec: Vec::spare_capacity_mut is stable
sk1p Aug 25, 2022
fb7dffe
add `multi_assignments` lint
roynrishingha Aug 26, 2022
21f103a
Auto merge of #9379 - royrustdev:multi_assignments, r=llogiq
bors Aug 26, 2022
602bec2
Auto merge of #9374 - sk1p:patch-1, r=Jarcho
bors Aug 26, 2022
fe93b8d
Don't lint `needless_return` if `return` has attrs
lukaslueg Aug 26, 2022
de028e2
Implemented suspicious_to_owned lint to check if `to_owned` is called…
xanathar Jun 10, 2022
be8bd60
Auto merge of #9381 - lukaslueg:issue9361, r=dswij
bors Aug 27, 2022
90fe3be
remove parenthesis from unnecessary_cast suggestion
llogiq Aug 27, 2022
51e9113
Add `span_contains_comments` util
dswij Aug 1, 2022
b07d72b
Ignore when there is comment
dswij Aug 27, 2022
2d4d8e1
Auto merge of #8984 - xanathar:pr/suspicious_to_owned, r=llogiq
bors Aug 27, 2022
9678751
pretty printing give proper erro message without panic
chenyukang Aug 22, 2022
722d136
Use hir::Map to prevent false positives
hkmatsumoto Aug 28, 2022
8d9da4d
Auto merge of #9276 - dswij:9164, r=flip1995
bors Aug 28, 2022
75ed56f
Make CI pass
hkmatsumoto Aug 28, 2022
1529137
Support method calls
hkmatsumoto Aug 28, 2022
c542f1f
Don't lint literal None from expansion
lukaslueg Aug 28, 2022
3ad398d
Merge branch 'master' into rustup
Jarcho Aug 28, 2022
278b092
Bump nightly version -> 2022-08-27
Jarcho Aug 28, 2022
9790a32
Fixes for latest nightly
Jarcho Aug 28, 2022
4e31c8c
Auto merge of #9389 - lukaslueg:penmacro, r=llogiq
bors Aug 28, 2022
e550739
Disable incremental compilation on CI
Jarcho Aug 28, 2022
28ec27b
Auto merge of #9388 - Jarcho:rustup, r=Jarcho
bors Aug 29, 2022
58bbb1a
Auto merge of #9385 - rust-lang:unnecessary-cast-remove-parens, r=Ale…
bors Aug 29, 2022
26a6891
Fix missing parens in `suboptimal_flops` sugg
lukaslueg Aug 29, 2022
c5a8230
Fix `suspicious_to_owned` test when `c_char` is `u8`
Alexendoo Aug 29, 2022
30979bf
Add lint `cast_slice_from_raw_parts`
clubby789 Jul 26, 2022
cc9f203
Update clippy_lints/src/casts/mod.rs
clubby789 Aug 29, 2022
e9f7ce1
Auto merge of #9247 - clubby789:raw_slice_pointer_cast, r=Alexendoo
bors Aug 29, 2022
e1ecdb6
Auto merge of #9395 - Alexendoo:suspicious-to-owned-test, r=Manishearth
bors Aug 29, 2022
9ffc5a5
Fix more parens for `suboptimal_flops` suggs
lukaslueg Aug 29, 2022
bc68381
Add warning against unexpected --cfg with --check-cfg
Urgau Aug 11, 2022
4df6032
Auto merge of #9394 - lukaslueg:issue9391, r=Jarcho
bors Aug 30, 2022
77eb1ae
add UI test for unpretty
chenyukang Aug 30, 2022
19ef04f
Fix the order of `trait_duplication_in_bounds`
Jarcho Aug 30, 2022
66a9705
Initial implementation of `result_large_err`
lukaslueg Aug 24, 2022
09e4659
Auto merge of #9373 - lukaslueg:result_large_err, r=Alexendoo
bors Aug 30, 2022
f51aade
Auto merge of #9397 - Jarcho:trait_dup_order, r=dswij
bors Aug 31, 2022
e10ab62
Link “? operator” to relevant chapter in The Book
mgeisler Aug 31, 2022
4a33bf3
Simplify MIR opt tests
JakobDegen Aug 21, 2022
b8075e4
migrate rustc_query_system to use SessionDiagnostic
evopen Aug 21, 2022
d7e07c0
link related issue to FIXME
evopen Aug 22, 2022
ac638c1
use derive proc macro to impl SessionDiagnostic
evopen Aug 23, 2022
166aef9
delete leftover comment
evopen Aug 25, 2022
7ce59eb
SessionDiagnostic for QueryOverflow error
evopen Aug 27, 2022
11fc785
lint: avoid linting diag functions with diag lints
davidtwco Aug 31, 2022
9a67767
Merge commit 'f51aade56f93175dde89177a92e3669ebd8e7592' into clippyup
Jarcho Aug 31, 2022
cacc7bf
Fix a typo on `wasm64-unknown-unknown` doc
JohnTitor Aug 31, 2022
7ed1333
Use `CountIsStart` in clippy
Jarcho Aug 31, 2022
1d6d994
Rollup merge of #100574 - Urgau:check-cfg-warn-cfg, r=petrochenkov
matthiaskrgr Aug 31, 2022
60c6178
Rollup merge of #100787 - chenyukang:fix-100770-pretty-crash, r=petro…
matthiaskrgr Aug 31, 2022
49608a4
Rollup merge of #100827 - JakobDegen:better-tests, r=wesleywiser
matthiaskrgr Aug 31, 2022
d957090
Rollup merge of #100838 - hkmatsumoto:move-gen-args-to-trait-when-app…
matthiaskrgr Aug 31, 2022
83141af
Rollup merge of #100844 - evopen:migrate-diag, r=davidtwco
matthiaskrgr Aug 31, 2022
c8db236
Rollup merge of #101140 - Jarcho:clippyup, r=Jarcho
matthiaskrgr Aug 31, 2022
af02525
Rollup merge of #101229 - mgeisler:link-try-operator, r=thomcc
matthiaskrgr Aug 31, 2022
c4d2acc
Rollup merge of #101230 - davidtwco:translation-internal-lint-no-self…
matthiaskrgr Aug 31, 2022
998a950
Rollup merge of #101240 - JohnTitor:JohnTitor-patch-1, r=ehuss
matthiaskrgr Aug 31, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -727,6 +727,7 @@ version = "0.1.65"
dependencies = [
"arrayvec",
"if_chain",
"itertools",
"rustc-semver",
]

Expand Down
14 changes: 9 additions & 5 deletions compiler/rustc_driver/src/pretty.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
//! The various pretty-printing routines.

use crate::session_diagnostics::UnprettyDumpFail;
use rustc_ast as ast;
use rustc_ast_pretty::pprust;
use rustc_errors::ErrorGuaranteed;
Expand Down Expand Up @@ -357,12 +358,15 @@ fn get_source(input: &Input, sess: &Session) -> (String, FileName) {
(src, src_name)
}

fn write_or_print(out: &str, ofile: Option<&Path>) {
fn write_or_print(out: &str, ofile: Option<&Path>, sess: &Session) {
match ofile {
None => print!("{}", out),
Some(p) => {
if let Err(e) = std::fs::write(p, out) {
panic!("print-print failed to write {} due to {}", p.display(), e);
sess.emit_fatal(UnprettyDumpFail {
path: p.display().to_string(),
err: e.to_string(),
});
}
}
}
Expand Down Expand Up @@ -402,7 +406,7 @@ pub fn print_after_parsing(
_ => unreachable!(),
};

write_or_print(&out, ofile);
write_or_print(&out, ofile, sess);
}

pub fn print_after_hir_lowering<'tcx>(
Expand Down Expand Up @@ -468,7 +472,7 @@ pub fn print_after_hir_lowering<'tcx>(
_ => unreachable!(),
};

write_or_print(&out, ofile);
write_or_print(&out, ofile, tcx.sess);
}

// In an ideal world, this would be a public function called by the driver after
Expand Down Expand Up @@ -512,7 +516,7 @@ fn print_with_analysis(
_ => unreachable!(),
};

write_or_print(&out, ofile);
write_or_print(&out, ofile, tcx.sess);

Ok(())
}
7 changes: 7 additions & 0 deletions compiler/rustc_driver/src/session_diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,10 @@ pub(crate) struct RLinkRustcVersionMismatch<'a> {
#[derive(SessionDiagnostic)]
#[diag(driver::rlink_no_a_file)]
pub(crate) struct RlinkNotAFile;

#[derive(SessionDiagnostic)]
#[diag(driver::unpretty_dump_fail)]
pub(crate) struct UnprettyDumpFail {
pub path: String,
pub err: String,
}
2 changes: 2 additions & 0 deletions compiler/rustc_error_messages/locales/en-US/driver.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ driver_rlink_encoding_version_mismatch = .rlink file was produced with encoding
driver_rlink_rustc_version_mismatch = .rlink file was produced by rustc version `{$rustc_version}`, but the current version is `{$current_version}`

driver_rlink_no_a_file = rlink must be a file

driver_unpretty_dump_fail = pretty-print failed to write `{$path}` due to error `{$err}`
6 changes: 6 additions & 0 deletions compiler/rustc_error_messages/locales/en-US/lint.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,12 @@ lint_builtin_unreachable_pub = unreachable `pub` {$what}
.suggestion = consider restricting its visibility
.help = or consider exporting it for use by other crates

lint_builtin_unexpected_cli_config_name = unexpected `{$name}` as condition name
.help = was set with `--cfg` but isn't in the `--check-cfg` expected names

lint_builtin_unexpected_cli_config_value = unexpected condition value `{$value}` for condition name `{$name}`
.help = was set with `--cfg` but isn't in the `--check-cfg` expected values

lint_builtin_type_alias_bounds_help = use fully disambiguated paths (i.e., `<T as Trait>::Assoc`) to refer to associated types in type aliases

lint_builtin_type_alias_where_clause = where clauses are not enforced in type aliases
Expand Down
25 changes: 25 additions & 0 deletions compiler/rustc_error_messages/locales/en-US/query_system.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
query_system_reentrant = internal compiler error: re-entrant incremental verify failure, suppressing message

query_system_increment_compilation = internal compiler error: encountered incremental compilation error with {$dep_node}
.help = This is a known issue with the compiler. Run {$run_cmd} to allow your project to compile

query_system_increment_compilation_note1 = Please follow the instructions below to create a bug report with the provided information
query_system_increment_compilation_note2 = See <https://github.com/rust-lang/rust/issues/84970> for more information

query_system_cycle = cycle detected when {$stack_bottom}

query_system_cycle_usage = cycle used when {$usage}

query_system_cycle_stack_single = ...which immediately requires {$stack_bottom} again

query_system_cycle_stack_multiple = ...which again requires {$stack_bottom}, completing the cycle

query_system_cycle_recursive_ty_alias = type aliases cannot be recursive
query_system_cycle_recursive_ty_alias_help1 = consider using a struct, enum, or union instead to break the cycle
query_system_cycle_recursive_ty_alias_help2 = see <https://doc.rust-lang.org/reference/types.html#recursive-types> for more information

query_system_cycle_recursive_trait_alias = trait aliases cannot be recursive

query_system_cycle_which_requires = ...which requires {$desc}...

query_system_query_overflow = queries overflow the depth limit!
1 change: 1 addition & 0 deletions compiler/rustc_error_messages/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ fluent_messages! {
passes => "../locales/en-US/passes.ftl",
plugin_impl => "../locales/en-US/plugin_impl.ftl",
privacy => "../locales/en-US/privacy.ftl",
query_system => "../locales/en-US/query_system.ftl",
save_analysis => "../locales/en-US/save_analysis.ftl",
ty_utils => "../locales/en-US/ty_utils.ftl",
typeck => "../locales/en-US/typeck.ftl",
Expand Down
36 changes: 36 additions & 0 deletions compiler/rustc_lint/src/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3173,3 +3173,39 @@ impl<'tcx> LateLintPass<'tcx> for NamedAsmLabels {
}
}
}

pub use rustc_session::lint::builtin::UNEXPECTED_CFGS;

declare_lint_pass!(UnexpectedCfgs => [UNEXPECTED_CFGS]);

impl EarlyLintPass for UnexpectedCfgs {
fn check_crate(&mut self, cx: &EarlyContext<'_>, _: &ast::Crate) {
let cfg = &cx.sess().parse_sess.config;
let check_cfg = &cx.sess().parse_sess.check_config;
for &(name, value) in cfg {
if let Some(names_valid) = &check_cfg.names_valid {
if !names_valid.contains(&name) {
cx.lookup(UNEXPECTED_CFGS, None::<MultiSpan>, |diag| {
diag.build(fluent::lint::builtin_unexpected_cli_config_name)
.help(fluent::lint::help)
.set_arg("name", name)
.emit();
});
}
}
if let Some(value) = value {
if let Some(values) = &check_cfg.values_valid.get(&name) {
if !values.contains(&value) {
cx.lookup(UNEXPECTED_CFGS, None::<MultiSpan>, |diag| {
diag.build(fluent::lint::builtin_unexpected_cli_config_value)
.help(fluent::lint::help)
.set_arg("name", name)
.set_arg("value", value)
.emit();
});
}
}
}
}
}
}
12 changes: 9 additions & 3 deletions compiler/rustc_lint/src/internal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -393,8 +393,14 @@ impl LateLintPass<'_> for Diagnostics {
return;
}

let mut found_parent_with_attr = false;
let mut found_impl = false;
for (_, parent) in cx.tcx.hir().parent_iter(expr.hir_id) {
for (hir_id, parent) in cx.tcx.hir().parent_iter(expr.hir_id) {
if let Some(owner_did) = hir_id.as_owner() {
found_parent_with_attr = found_parent_with_attr
|| cx.tcx.has_attr(owner_did.to_def_id(), sym::rustc_lint_diagnostics);
}

debug!(?parent);
if let Node::Item(Item { kind: ItemKind::Impl(impl_), .. }) = parent &&
let Impl { of_trait: Some(of_trait), .. } = impl_ &&
Expand All @@ -407,7 +413,7 @@ impl LateLintPass<'_> for Diagnostics {
}
}
debug!(?found_impl);
if !found_impl {
if !found_parent_with_attr && !found_impl {
cx.struct_span_lint(DIAGNOSTIC_OUTSIDE_OF_IMPL, span, |lint| {
lint.build(fluent::lint::diag_out_of_impl).emit();
})
Expand All @@ -425,7 +431,7 @@ impl LateLintPass<'_> for Diagnostics {
}
}
debug!(?found_diagnostic_message);
if !found_diagnostic_message {
if !found_parent_with_attr && !found_diagnostic_message {
cx.struct_span_lint(UNTRANSLATABLE_DIAGNOSTIC, span, |lint| {
lint.build(fluent::lint::untranslatable_diag).emit();
})
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_lint/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ macro_rules! early_lint_passes {
IncompleteFeatures: IncompleteFeatures,
RedundantSemicolons: RedundantSemicolons,
UnusedDocComment: UnusedDocComment,
UnexpectedCfgs: UnexpectedCfgs,
]
);
};
Expand Down
1 change: 0 additions & 1 deletion compiler/rustc_lint_defs/src/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3365,7 +3365,6 @@ declare_lint_pass! {
DEPRECATED_CFG_ATTR_CRATE_TYPE_NAME,
DUPLICATE_MACRO_ATTRIBUTES,
SUSPICIOUS_AUTO_TRAIT_IMPLS,
UNEXPECTED_CFGS,
DEPRECATED_WHERE_CLAUSE_LOCATION,
TEST_UNSTABLE_LINT,
FFI_UNWIND_CALLS,
Expand Down
Loading