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 #108466

Closed
Closed
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
41ff6a8
Update LLVM submodule
icedrocket Feb 10, 2023
313f04f
Add regression test for #105626
icedrocket Feb 22, 2023
a914f37
Add lint against `Iterator::map` receiving a callable that returns `()`
obeis Feb 16, 2023
ddd7d10
Add ui test for `map_unit_fn` lint
obeis Feb 16, 2023
a87443a
Emit `map_unit_fn` lint in closure case
obeis Feb 16, 2023
b93d545
Add ui test for `map_unit_fn` lint in closure case
obeis Feb 16, 2023
99344a8
Add ui test for `E0271` error
obeis Feb 20, 2023
37d4302
Add regression test for #107918
GuillaumeGomez Feb 24, 2023
dca52ac
make "proc macro panicked" translatable
tshepang Feb 24, 2023
60ac309
add `known-bug` test for unsoundness issue #108425
gburgessiv Feb 25, 2023
9f876cc
docs/test: add UI test and docs for `E0476`
Ezrashaw Feb 25, 2023
7d83d69
add `known-bug` test for unsoundness issue #107975
gburgessiv Feb 25, 2023
6adc76d
add `known-bug` test for unsoundness issue #105787
gburgessiv Feb 25, 2023
3b51e9f
fix: fix issue in macro
Ezrashaw Feb 25, 2023
ed34354
Do not lint unresolved trait for ineffective unstable trait impl
fee1-dead Feb 25, 2023
c934ee8
Don't run issue-107918.rs test on windows
GuillaumeGomez Feb 25, 2023
885f9e7
Complete migrating `ast_passes` to derive diagnostics
clubby789 Feb 25, 2023
3560e65
Treat `str` as containing `[u8]` for auto trait purposes
compiler-errors Feb 11, 2023
53fb433
Special note for str in auto traits
compiler-errors Feb 14, 2023
c961431
Rollup merge of #107879 - icedrocket:update-llvm, r=cuviper
compiler-errors Feb 25, 2023
ec961db
Rollup merge of #107890 - obeis:mapping-to-unit, r=cjgillot
compiler-errors Feb 25, 2023
dfcaa20
Rollup merge of #107941 - compiler-errors:str-has-u8-slice-for-auto, …
compiler-errors Feb 25, 2023
cf5c521
Rollup merge of #108431 - GuillaumeGomez:regression-test-for-107918, …
compiler-errors Feb 25, 2023
8fa308d
Rollup merge of #108436 - tshepang:translatable-proc-macro-panicked, …
compiler-errors Feb 25, 2023
cb58440
Rollup merge of #108444 - Ezrashaw:add-test+docs-for-e0476, r=Guillau…
compiler-errors Feb 25, 2023
4b8a3a6
Rollup merge of #108445 - gburgessiv:add-known-bug, r=compiler-errors
compiler-errors Feb 25, 2023
fea67c2
Rollup merge of #108449 - fee1-dead-contrib:do_not_lint_unresolved, r…
compiler-errors Feb 25, 2023
e05492a
Rollup merge of #108456 - clubby789:ast-passes-diag-migrate, r=compil…
compiler-errors Feb 25, 2023
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
Emit map_unit_fn lint in closure case
  • Loading branch information
obeis committed Feb 23, 2023
commit a87443a85999eadc867d261667363137adcb2420
16 changes: 16 additions & 0 deletions compiler/rustc_lint/src/map_unit_fn.rs
Original file line number Diff line number Diff line change
@@ -72,6 +72,22 @@ impl<'tcx> LateLintPass<'tcx> for MapUnitFn {
},
)
}
} else if let ty::Closure(id, subs) = arg_ty.kind() {
let cl_ty = subs.as_closure().sig();
let ret_ty = cl_ty.output().skip_binder();
if is_unit_type(ret_ty) {
cx.emit_spanned_lint(
MAP_UNIT_FN,
span,
MappingToUnit {
function_label: cx.tcx.span_of_impl(*id).unwrap(),
argument_label: args[0].span,
map_label: arg_ty.default_span(cx.tcx),
suggestion: path.ident.span,
replace: "for_each".to_string(),
},
)
}
}
}
}