Use TraitEngine in more places that don't specifically need Fulfillme… · rust-lang/rust@58f107a (original) (raw)

`@@ -14,7 +14,9 @@ use specialization_graph::GraphExt;

`

14

14

``

15

15

`use crate::infer::{InferCtxt, InferOk, TyCtxtInferExt};

`

16

16

`use crate::traits::select::IntercrateAmbiguityCause;

`

17

``

`-

use crate::traits::{self, coherence, FutureCompatOverlapErrorKind, ObligationCause, TraitEngine};

`

``

17

`+

use crate::traits::{

`

``

18

`+

self, coherence, FutureCompatOverlapErrorKind, ObligationCause, TraitEngine, TraitEngineExt,

`

``

19

`+

};

`

18

20

`use rustc_data_structures::fx::{FxHashSet, FxIndexSet};

`

19

21

`use rustc_errors::{struct_span_err, EmissionGuarantee, LintDiagnosticBuilder};

`

20

22

`use rustc_hir::def_id::{DefId, LocalDefId};

`

`@@ -24,8 +26,8 @@ use rustc_session::lint::builtin::COHERENCE_LEAK_CHECK;

`

24

26

`use rustc_session::lint::builtin::ORDER_DEPENDENT_TRAIT_OBJECTS;

`

25

27

`use rustc_span::{Span, DUMMY_SP};

`

26

28

``

27

``

`-

use super::util;

`

28

``

`-

use super::{FulfillmentContext, SelectionContext};

`

``

29

`+

use super::SelectionContext;

`

``

30

`+

use super::{util, FulfillmentContext};

`

29

31

``

30

32

`/// Information pertinent to an overlapping impl error.

`

31

33

`#[derive(Debug)]

`

`@@ -207,7 +209,7 @@ fn fulfill_implication<'a, 'tcx>(

`

207

209

`// (which are packed up in penv)

`

208

210

``

209

211

` infcx.save_and_restore_in_snapshot_flag(|infcx| {

`

210

``

`-

let mut fulfill_cx = FulfillmentContext::new();

`

``

212

`+

let mut fulfill_cx = <dyn TraitEngine<'tcx>>::new(infcx.tcx);

`

211

213

`for oblig in obligations.chain(more_obligations) {

`

212

214

` fulfill_cx.register_predicate_obligation(&infcx, oblig);

`

213

215

`}

`