Skip to content

Commit bd51f17

Browse files
Remove SelectionContext::allow_negative_impls field
1 parent ad88732 commit bd51f17

File tree

2 files changed

+2
-26
lines changed

2 files changed

+2
-26
lines changed

compiler/rustc_trait_selection/src/traits/auto_trait.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ impl<'tcx> AutoTraitFinder<'tcx> {
8787
let trait_pred = ty::Binder::dummy(trait_ref);
8888

8989
let bail_out = tcx.infer_ctxt().enter(|infcx| {
90-
let mut selcx = SelectionContext::with_negative(&infcx, true);
90+
let mut selcx = SelectionContext::new(&infcx);
9191
let result = selcx.select(&Obligation::new(
9292
ObligationCause::dummy(),
9393
orig_env,
@@ -295,7 +295,7 @@ impl<'tcx> AutoTraitFinder<'tcx> {
295295
fresh_preds.insert(self.clean_pred(infcx, predicate));
296296
}
297297

298-
let mut select = SelectionContext::with_negative(&infcx, true);
298+
let mut select = SelectionContext::new(&infcx);
299299

300300
let mut already_visited = FxHashSet::default();
301301
let mut predicates = VecDeque::new();

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

-24
Original file line numberDiff line numberDiff line change
@@ -119,11 +119,6 @@ pub struct SelectionContext<'cx, 'tcx> {
119119

120120
intercrate_ambiguity_causes: Option<Vec<IntercrateAmbiguityCause>>,
121121

122-
/// Controls whether or not to filter out negative impls when selecting.
123-
/// This is used in librustdoc to distinguish between the lack of an impl
124-
/// and a negative impl
125-
allow_negative_impls: bool,
126-
127122
/// The mode that trait queries run in, which informs our error handling
128123
/// policy. In essence, canonicalized queries need their errors propagated
129124
/// rather than immediately reported because we do not have accurate spans.
@@ -215,7 +210,6 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
215210
freshener: infcx.freshener_keep_static(),
216211
intercrate: false,
217212
intercrate_ambiguity_causes: None,
218-
allow_negative_impls: false,
219213
query_mode: TraitQueryMode::Standard,
220214
}
221215
}
@@ -226,22 +220,6 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
226220
freshener: infcx.freshener_keep_static(),
227221
intercrate: true,
228222
intercrate_ambiguity_causes: None,
229-
allow_negative_impls: false,
230-
query_mode: TraitQueryMode::Standard,
231-
}
232-
}
233-
234-
pub fn with_negative(
235-
infcx: &'cx InferCtxt<'cx, 'tcx>,
236-
allow_negative_impls: bool,
237-
) -> SelectionContext<'cx, 'tcx> {
238-
debug!(?allow_negative_impls, "with_negative");
239-
SelectionContext {
240-
infcx,
241-
freshener: infcx.freshener_keep_static(),
242-
intercrate: false,
243-
intercrate_ambiguity_causes: None,
244-
allow_negative_impls,
245223
query_mode: TraitQueryMode::Standard,
246224
}
247225
}
@@ -256,7 +234,6 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
256234
freshener: infcx.freshener_keep_static(),
257235
intercrate: false,
258236
intercrate_ambiguity_causes: None,
259-
allow_negative_impls: false,
260237
query_mode,
261238
}
262239
}
@@ -1192,7 +1169,6 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
11921169
if let ImplCandidate(def_id) = candidate {
11931170
if ty::ImplPolarity::Reservation == tcx.impl_polarity(def_id)
11941171
|| obligation.polarity() == tcx.impl_polarity(def_id)
1195-
|| self.allow_negative_impls
11961172
{
11971173
result.push(candidate);
11981174
}

0 commit comments

Comments
 (0)