Rollup merge of #137449 - compiler-errors:control-flow, r=Amanieu,lnicola
Denote `ControlFlow` as `#[must_use]` I've repeatedly hit bugs in the compiler due to `ControlFlow` not being marked `#[must_use]`. There seems to be an accepted ACP to make the type `#[must_use]` (https://github.com/rust-lang/libs-team/issues/444), so this PR implements that part of it. Most of the usages in the compiler that trigger this new warning are "root" usages (calling into an API that uses control-flow internally, but for which the callee doesn't really care) and have been suppressed by `let _ = ...`, but I did legitimately find one instance of a missing `?` and one for a never-used `ControlFlow` value in #137448. Presumably this needs an FCP too, so I'm opening this and nominating it for T-libs-api. This PR also touches the tools (incl. rust-analyzer), but if this went into FCP, I'd split those out into separate PRs which can land before this one does. r? libs-api `@rustbot` label: T-libs-api I-libs-api-nominated
This commit is contained in:
commit
9adf2189f5
24 changed files with 67 additions and 62 deletions
|
@ -77,7 +77,7 @@ impl<'tcx> Visitor<'tcx> for FindNestedTypeVisitor<'tcx> {
|
|||
match arg.kind {
|
||||
hir::TyKind::BareFn(_) => {
|
||||
self.current_index.shift_in(1);
|
||||
intravisit::walk_ty(self, arg);
|
||||
let _ = intravisit::walk_ty(self, arg);
|
||||
self.current_index.shift_out(1);
|
||||
return ControlFlow::Continue(());
|
||||
}
|
||||
|
@ -85,7 +85,7 @@ impl<'tcx> Visitor<'tcx> for FindNestedTypeVisitor<'tcx> {
|
|||
hir::TyKind::TraitObject(bounds, ..) => {
|
||||
for bound in bounds {
|
||||
self.current_index.shift_in(1);
|
||||
self.visit_poly_trait_ref(bound);
|
||||
let _ = self.visit_poly_trait_ref(bound);
|
||||
self.current_index.shift_out(1);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -743,7 +743,7 @@ fn assemble_candidates_from_trait_def<'cx, 'tcx>(
|
|||
) {
|
||||
debug!("assemble_candidates_from_trait_def(..)");
|
||||
let mut ambiguous = false;
|
||||
selcx.for_each_item_bound(
|
||||
let _ = selcx.for_each_item_bound(
|
||||
obligation.predicate.self_ty(),
|
||||
|selcx, clause, _| {
|
||||
let Some(clause) = clause.as_projection_clause() else {
|
||||
|
|
|
@ -176,7 +176,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||
// normalization, so try to deduplicate when possible to avoid
|
||||
// unnecessary ambiguity.
|
||||
let mut distinct_normalized_bounds = FxHashSet::default();
|
||||
self.for_each_item_bound::<!>(
|
||||
let _ = self.for_each_item_bound::<!>(
|
||||
placeholder_trait_predicate.self_ty(),
|
||||
|selcx, bound, idx| {
|
||||
let Some(bound) = bound.as_trait_clause() else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue