Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
b676f55
rustdoc: add ways of collapsing all impl blocks
lolbinarycat May 27, 2025
978e11b
Upgrade the `fortanix-sgx-abi` dependency
tgross35 Jul 1, 2025
69b9bae
Guarantee 8 bytes of alignment in Thread::into_raw
orlp Jul 12, 2025
6f4d0bd
Tidy
orlp Jul 12, 2025
1d0eddb
tests: debuginfo: Work around or disable broken tests on powerpc
Gelbpunkt Jul 18, 2025
e1b6cfe
Rephrase comment to include some tracking issues
Gelbpunkt Jul 21, 2025
b8d628c
Use LocalKey<Cell> methods more
camsteffen Jul 22, 2025
e958b20
Fix unused_parens false positive
benschulz Jul 9, 2025
6fc68c1
Add test case for single bound
benschulz Jul 10, 2025
307f664
Replace unwrap_or with explicit match
benschulz Jul 24, 2025
730d33d
`loop_match`: suggest extracting to a `const` item
folkertdev Jul 7, 2025
1f4561b
Don't lint against named labels in `naked_asm!`
Amanieu May 9, 2025
53018dc
Disable has_reliable_f128_math on musl targets
Gelbpunkt Jul 25, 2025
33ed3fc
Rollup merge of #140871 - Amanieu:naked-asm-label, r=compiler-errors
tgross35 Jul 26, 2025
7abb4e2
Rollup merge of #141663 - lolbinarycat:rustdoc-collapse-impl-134429, …
tgross35 Jul 26, 2025
3b99668
Rollup merge of #143272 - tgross35:bump-fortanix, r=jhpratt,jethrogb
tgross35 Jul 26, 2025
d8f4ceb
Rollup merge of #143585 - folkertdev:loop-match-suggest-const-block, …
tgross35 Jul 26, 2025
75ed6de
Rollup merge of #143698 - benschulz:unused-parens-2, r=lcnr,compiler-…
tgross35 Jul 26, 2025
2fcea9f
Rollup merge of #143859 - orlp:thread-into-raw-align, r=jhpratt
tgross35 Jul 26, 2025
0f557ab
Rollup merge of #144160 - Gelbpunkt:debuginfo-tests-ppc, r=oli-obk
tgross35 Jul 26, 2025
bfacbf2
Rollup merge of #144412 - camsteffen:localkey-cell-refactors, r=petro…
tgross35 Jul 26, 2025
39141d0
Rollup merge of #144431 - Gelbpunkt:f128-math-musl, r=petrochenkov,tg…
tgross35 Jul 26, 2025
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
Fix unused_parens false positive
  • Loading branch information
benschulz committed Jul 24, 2025
commit e958b20af7ad3e3a053070a9c45389fe463ccc0c
7 changes: 6 additions & 1 deletion compiler/rustc_lint/src/unused.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1062,6 +1062,7 @@ pub(crate) struct UnusedParens {
/// ```
/// type Example = Box<dyn Fn() -> &'static dyn Send>;
/// ```
#[derive(Copy, Clone)]
enum NoBoundsException {
/// The type must be parenthesized.
None,
Expand Down Expand Up @@ -1340,7 +1341,11 @@ impl EarlyLintPass for UnusedParens {
self.with_self_ty_parens = false;
}
ast::TyKind::Ref(_, mut_ty) | ast::TyKind::Ptr(mut_ty) => {
self.in_no_bounds_pos.insert(mut_ty.ty.id, NoBoundsException::OneBound);
// If this type itself appears in no-bounds position, we propagate its
// potentially tighter constraint or risk a false posive (issue 143653).
let own_constraint = self.in_no_bounds_pos.get(&ty.id).copied();
let constraint = own_constraint.unwrap_or(NoBoundsException::OneBound);
self.in_no_bounds_pos.insert(mut_ty.ty.id, constraint);
}
ast::TyKind::TraitObject(bounds, _) | ast::TyKind::ImplTrait(_, bounds) => {
for i in 0..bounds.len() {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
//@ check-pass

#![deny(unused_parens)]
#![allow(warnings)]
trait MyTrait {}

fn foo(_: Box<dyn FnMut(&mut u32) -> &mut (dyn MyTrait) + Send + Sync>) {}

fn main() {}