Skip to content

Commit cc82ccb

Browse files
committed
#[must_use] for fns returning a list of errors
1 parent a19adef commit cc82ccb

File tree

4 files changed

+8
-1
lines changed

4 files changed

+8
-1
lines changed

compiler/rustc_infer/src/infer/outlives/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ impl<'tcx> InferCtxt<'tcx> {
7575
/// result. After this, no more unification operations should be
7676
/// done -- or the compiler will panic -- but it is legal to use
7777
/// `resolve_vars_if_possible` as well as `fully_resolve`.
78+
#[must_use]
7879
pub fn resolve_regions(
7980
&self,
8081
outlives_env: &OutlivesEnvironment<'tcx>,

compiler/rustc_infer/src/traits/engine.rs

+2
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ pub trait TraitEngine<'tcx>: 'tcx {
3636
obligation: PredicateObligation<'tcx>,
3737
);
3838

39+
#[must_use]
3940
fn select_where_possible(&mut self, infcx: &InferCtxt<'tcx>) -> Vec<FulfillmentError<'tcx>>;
4041

4142
fn collect_remaining_errors(&mut self) -> Vec<FulfillmentError<'tcx>>;
@@ -58,6 +59,7 @@ pub trait TraitEngineExt<'tcx> {
5859
obligations: impl IntoIterator<Item = PredicateObligation<'tcx>>,
5960
);
6061

62+
#[must_use]
6163
fn select_all_or_error(&mut self, infcx: &InferCtxt<'tcx>) -> Vec<FulfillmentError<'tcx>>;
6264
}
6365

compiler/rustc_trait_selection/src/traits/engine.rs

+2
Original file line numberDiff line numberDiff line change
@@ -175,10 +175,12 @@ impl<'a, 'tcx> ObligationCtxt<'a, 'tcx> {
175175
.map(|infer_ok| self.register_infer_ok_obligations(infer_ok))
176176
}
177177

178+
#[must_use]
178179
pub fn select_where_possible(&self) -> Vec<FulfillmentError<'tcx>> {
179180
self.engine.borrow_mut().select_where_possible(self.infcx)
180181
}
181182

183+
#[must_use]
182184
pub fn select_all_or_error(&self) -> Vec<FulfillmentError<'tcx>> {
183185
self.engine.borrow_mut().select_all_or_error(self.infcx)
184186
}

compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -1763,7 +1763,9 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
17631763

17641764
// constrain inference variables a bit more to nested obligations from normalize so
17651765
// we can have more helpful errors.
1766-
ocx.select_where_possible();
1766+
//
1767+
// we intentionally errors from normalization here.
1768+
let _ = ocx.select_where_possible();
17671769

17681770
if let Err(new_err) = ocx.eq_exp(
17691771
&obligation.cause,

0 commit comments

Comments
 (0)