Skip to content

Commit 2aafe45

Browse files
committedMar 18, 2021
Auto merge of #82868 - petrochenkov:bto, r=estebank
Report missing cases of `bare_trait_objects` Fixes #65371
2 parents 81c1d7a + b48530b commit 2aafe45

File tree

39 files changed

+192
-93
lines changed

39 files changed

+192
-93
lines changed
 

‎compiler/rustc_ast/src/ast.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1964,7 +1964,7 @@ impl TyKind {
19641964
}
19651965

19661966
/// Syntax used to declare a trait object.
1967-
#[derive(Clone, Copy, PartialEq, Encodable, Decodable, Debug)]
1967+
#[derive(Clone, Copy, PartialEq, Encodable, Decodable, Debug, HashStable_Generic)]
19681968
pub enum TraitObjectSyntax {
19691969
Dyn,
19701970
None,

‎compiler/rustc_ast_lowering/src/lib.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1396,7 +1396,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
13961396
if kind != TraitObjectSyntax::Dyn {
13971397
self.maybe_lint_bare_trait(t.span, t.id, false);
13981398
}
1399-
hir::TyKind::TraitObject(bounds, lifetime_bound)
1399+
hir::TyKind::TraitObject(bounds, lifetime_bound, kind)
14001400
}
14011401
TyKind::ImplTrait(def_node_id, ref bounds) => {
14021402
let span = t.span;
@@ -2648,6 +2648,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
26482648
hir::TyKind::TraitObject(
26492649
arena_vec![self; principal],
26502650
self.elided_dyn_bound(span),
2651+
TraitObjectSyntax::None,
26512652
)
26522653
}
26532654
_ => hir::TyKind::Path(hir::QPath::Resolved(None, path)),

‎compiler/rustc_hir/src/hir.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use crate::{itemlikevisit, LangItem};
66

77
use rustc_ast::util::parser::ExprPrecedence;
88
use rustc_ast::{self as ast, CrateSugar, LlvmAsmDialect};
9-
use rustc_ast::{Attribute, FloatTy, IntTy, Label, LitKind, StrStyle, UintTy};
9+
use rustc_ast::{Attribute, FloatTy, IntTy, Label, LitKind, StrStyle, TraitObjectSyntax, UintTy};
1010
pub use rustc_ast::{BorrowKind, ImplPolarity, IsAuto};
1111
pub use rustc_ast::{CaptureBy, Movability, Mutability};
1212
use rustc_ast::{InlineAsmOptions, InlineAsmTemplatePiece};
@@ -2327,7 +2327,7 @@ pub enum TyKind<'hir> {
23272327
OpaqueDef(ItemId, &'hir [GenericArg<'hir>]),
23282328
/// A trait object type `Bound1 + Bound2 + Bound3`
23292329
/// where `Bound` is a trait or a lifetime.
2330-
TraitObject(&'hir [PolyTraitRef<'hir>], Lifetime),
2330+
TraitObject(&'hir [PolyTraitRef<'hir>], Lifetime, TraitObjectSyntax),
23312331
/// Unused for now.
23322332
Typeof(AnonConst),
23332333
/// `TyKind::Infer` means the type should be inferred instead of it having been

‎compiler/rustc_hir/src/intravisit.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -709,7 +709,7 @@ pub fn walk_ty<'v, V: Visitor<'v>>(visitor: &mut V, typ: &'v Ty<'v>) {
709709
visitor.visit_ty(ty);
710710
visitor.visit_anon_const(length)
711711
}
712-
TyKind::TraitObject(bounds, ref lifetime) => {
712+
TyKind::TraitObject(bounds, ref lifetime, _syntax) => {
713713
for bound in bounds {
714714
visitor.visit_poly_trait_ref(bound, TraitBoundModifier::None);
715715
}

‎compiler/rustc_hir_pretty/src/lib.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,10 @@ impl<'a> State<'a> {
410410
}
411411
hir::TyKind::OpaqueDef(..) => self.s.word("/*impl Trait*/"),
412412
hir::TyKind::Path(ref qpath) => self.print_qpath(qpath, false),
413-
hir::TyKind::TraitObject(bounds, ref lifetime) => {
413+
hir::TyKind::TraitObject(bounds, ref lifetime, syntax) => {
414+
if syntax == ast::TraitObjectSyntax::Dyn {
415+
self.word_space("dyn");
416+
}
414417
let mut first = true;
415418
for bound in bounds {
416419
if first {

‎compiler/rustc_infer/src/infer/error_reporting/nice_region_error/find_anon_type.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ impl Visitor<'tcx> for FindNestedTypeVisitor<'tcx> {
9999
return;
100100
}
101101

102-
hir::TyKind::TraitObject(bounds, _) => {
102+
hir::TyKind::TraitObject(bounds, ..) => {
103103
for bound in bounds {
104104
self.current_index.shift_in(1);
105105
self.visit_poly_trait_ref(bound, hir::TraitBoundModifier::None);

‎compiler/rustc_infer/src/infer/error_reporting/nice_region_error/static_impl_trait.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
292292
);
293293
}
294294
}
295-
TyKind::TraitObject(_, lt) => match lt.name {
295+
TyKind::TraitObject(_, lt, _) => match lt.name {
296296
LifetimeName::ImplicitObjectLifetimeDefault => {
297297
err.span_suggestion_verbose(
298298
fn_return.span.shrink_to_hi(),
@@ -498,6 +498,7 @@ impl<'tcx> Visitor<'tcx> for HirTraitObjectVisitor {
498498
if let TyKind::TraitObject(
499499
poly_trait_refs,
500500
Lifetime { name: LifetimeName::ImplicitObjectLifetimeDefault, .. },
501+
_,
501502
) = t.kind
502503
{
503504
for ptr in poly_trait_refs {

‎compiler/rustc_middle/src/ty/diagnostics.rs

+1
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,7 @@ impl<'v> hir::intravisit::Visitor<'v> for TraitObjectVisitor<'v> {
314314
hir::LifetimeName::ImplicitObjectLifetimeDefault | hir::LifetimeName::Static,
315315
..
316316
},
317+
_,
317318
) => {
318319
self.0.push(ty);
319320
}

‎compiler/rustc_resolve/src/late/lifetimes.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -540,7 +540,7 @@ impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> {
540540
self.missing_named_lifetime_spots.pop();
541541
self.is_in_fn_syntax = was_in_fn_syntax;
542542
}
543-
hir::TyKind::TraitObject(bounds, ref lifetime) => {
543+
hir::TyKind::TraitObject(bounds, ref lifetime, _) => {
544544
debug!("visit_ty: TraitObject(bounds={:?}, lifetime={:?})", bounds, lifetime);
545545
for bound in bounds {
546546
self.visit_poly_trait_ref(bound, hir::TraitBoundModifier::None);
@@ -2299,7 +2299,7 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
22992299
self.outer_index.shift_in(1);
23002300
}
23012301
match ty.kind {
2302-
hir::TyKind::TraitObject(bounds, ref lifetime) => {
2302+
hir::TyKind::TraitObject(bounds, ref lifetime, _) => {
23032303
for bound in bounds {
23042304
self.visit_poly_trait_ref(bound, hir::TraitBoundModifier::None);
23052305
}

‎compiler/rustc_trait_selection/src/infer.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ impl<'tcx> InferCtxtBuilderExt<'tcx> for InferCtxtBuilder<'tcx> {
124124
DUMMY_SP,
125125
canonical_key,
126126
|ref infcx, key, canonical_inference_vars| {
127-
let mut fulfill_cx = TraitEngine::new(infcx.tcx);
127+
let mut fulfill_cx = <dyn TraitEngine<'_>>::new(infcx.tcx);
128128
let value = operation(infcx, &mut *fulfill_cx, key)?;
129129
infcx.make_canonicalized_query_response(
130130
canonical_inference_vars,

‎compiler/rustc_trait_selection/src/traits/query/type_op/custom.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ fn scrape_region_constraints<'tcx, R>(
6262
infcx: &InferCtxt<'_, 'tcx>,
6363
op: impl FnOnce() -> Fallible<InferOk<'tcx, R>>,
6464
) -> Fallible<(R, Option<Rc<QueryRegionConstraints<'tcx>>>)> {
65-
let mut fulfill_cx = TraitEngine::new(infcx.tcx);
65+
let mut fulfill_cx = <dyn TraitEngine<'_>>::new(infcx.tcx);
6666
let dummy_body_id = ObligationCause::dummy().body_id;
6767

6868
// During NLL, we expect that nobody will register region

‎compiler/rustc_traits/src/dropck_outlives.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ fn dropck_outlives<'tcx>(
7575
// Set used to detect infinite recursion.
7676
let mut ty_set = FxHashSet::default();
7777

78-
let mut fulfill_cx = TraitEngine::new(infcx.tcx);
78+
let mut fulfill_cx = <dyn TraitEngine<'_>>::new(infcx.tcx);
7979

8080
let cause = ObligationCause::dummy();
8181
let mut constraints = DtorckConstraint::empty();

‎compiler/rustc_typeck/src/astconv/mod.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -1608,6 +1608,8 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
16081608
// the whole path.
16091609
// Will fail except for `T::A` and `Self::A`; i.e., if `qself_ty`/`qself_def` are not a type
16101610
// parameter or `Self`.
1611+
// NOTE: When this function starts resolving `Trait::AssocTy` successfully
1612+
// it should also start reportint the `BARE_TRAIT_OBJECTS` lint.
16111613
pub fn associated_path_to_ty(
16121614
&self,
16131615
hir_ref_id: hir::HirId,
@@ -2201,7 +2203,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
22012203
Some(ast_ty),
22022204
))
22032205
}
2204-
hir::TyKind::TraitObject(ref bounds, ref lifetime) => {
2206+
hir::TyKind::TraitObject(ref bounds, ref lifetime, _) => {
22052207
self.conv_object_ty_poly_trait_ref(ast_ty.span, bounds, lifetime, borrowed)
22062208
}
22072209
hir::TyKind::Path(hir::QPath::Resolved(ref maybe_qself, ref path)) => {

‎compiler/rustc_typeck/src/check/coercion.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1554,7 +1554,7 @@ impl<'tcx, 'exprs, E: AsCoercionSite> CoerceMany<'tcx, 'exprs, E> {
15541554
if let hir::FnRetTy::Return(ty) = fn_output {
15551555
// Get the return type.
15561556
if let hir::TyKind::OpaqueDef(..) = ty.kind {
1557-
let ty = AstConv::ast_ty_to_ty(fcx, ty);
1557+
let ty = <dyn AstConv<'_>>::ast_ty_to_ty(fcx, ty);
15581558
// Get the `impl Trait`'s `DefId`.
15591559
if let ty::Opaque(def_id, _) = ty.kind() {
15601560
let hir_id = fcx.tcx.hir().local_def_id_to_hir_id(def_id.expect_local());
@@ -1616,7 +1616,7 @@ impl<'tcx, 'exprs, E: AsCoercionSite> CoerceMany<'tcx, 'exprs, E> {
16161616
fn is_return_ty_unsized(&self, fcx: &FnCtxt<'a, 'tcx>, blk_id: hir::HirId) -> bool {
16171617
if let Some((fn_decl, _)) = fcx.get_fn_decl(blk_id) {
16181618
if let hir::FnRetTy::Return(ty) = fn_decl.output {
1619-
let ty = AstConv::ast_ty_to_ty(fcx, ty);
1619+
let ty = <dyn AstConv<'_>>::ast_ty_to_ty(fcx, ty);
16201620
if let ty::Dynamic(..) = ty.kind() {
16211621
return true;
16221622
}

‎compiler/rustc_typeck/src/check/dropck.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ fn ensure_drop_params_and_item_params_correspond<'tcx>(
7777
tcx.infer_ctxt().enter(|ref infcx| {
7878
let impl_param_env = tcx.param_env(self_type_did);
7979
let tcx = infcx.tcx;
80-
let mut fulfillment_cx = TraitEngine::new(tcx);
80+
let mut fulfillment_cx = <dyn TraitEngine<'_>>::new(tcx);
8181

8282
let named_type = tcx.type_of(self_type_did);
8383

‎compiler/rustc_typeck/src/check/fn_ctxt/_impl.rs

+41-11
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,15 @@ use crate::check::callee::{self, DeferredCallResolution};
66
use crate::check::method::{self, MethodCallee, SelfSource};
77
use crate::check::{BreakableCtxt, Diverges, Expectation, FallbackMode, FnCtxt, LocalTy};
88

9+
use rustc_ast::TraitObjectSyntax;
910
use rustc_data_structures::captures::Captures;
1011
use rustc_data_structures::fx::FxHashSet;
1112
use rustc_errors::{Applicability, DiagnosticBuilder, ErrorReported};
1213
use rustc_hir as hir;
1314
use rustc_hir::def::{CtorOf, DefKind, Res};
1415
use rustc_hir::def_id::DefId;
1516
use rustc_hir::lang_items::LangItem;
16-
use rustc_hir::{ExprKind, GenericArg, Node, QPath};
17+
use rustc_hir::{ExprKind, GenericArg, Node, QPath, TyKind};
1718
use rustc_infer::infer::canonical::{Canonical, OriginalQueryValues, QueryResponse};
1819
use rustc_infer::infer::error_reporting::TypeAnnotationNeeded::E0282;
1920
use rustc_infer::infer::{InferOk, InferResult};
@@ -26,7 +27,9 @@ use rustc_middle::ty::{
2627
self, AdtKind, CanonicalUserType, DefIdTree, GenericParamDefKind, ToPolyTraitRef, ToPredicate,
2728
Ty, UserType,
2829
};
29-
use rustc_session::{lint, parse::feature_err};
30+
use rustc_session::lint;
31+
use rustc_session::lint::builtin::BARE_TRAIT_OBJECTS;
32+
use rustc_session::parse::feature_err;
3033
use rustc_span::source_map::{original_sp, DUMMY_SP};
3134
use rustc_span::symbol::{kw, sym, Ident};
3235
use rustc_span::{self, BytePos, MultiSpan, Span};
@@ -472,7 +475,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
472475
}
473476

474477
pub fn to_ty(&self, ast_t: &hir::Ty<'_>) -> Ty<'tcx> {
475-
let t = AstConv::ast_ty_to_ty(self, ast_t);
478+
let t = <dyn AstConv<'_>>::ast_ty_to_ty(self, ast_t);
476479
self.register_wf_obligation(t.into(), ast_t.span, traits::MiscObligation);
477480
t
478481
}
@@ -854,7 +857,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
854857
// out unconstrained or ambiguous, as we're
855858
// just trying to get hints here.
856859
self.save_and_restore_in_snapshot_flag(|_| {
857-
let mut fulfill = TraitEngine::new(self.tcx);
860+
let mut fulfill = <dyn TraitEngine<'_>>::new(self.tcx);
858861
for obligation in ok.obligations {
859862
fulfill.register_predicate_obligation(self, obligation);
860863
}
@@ -947,6 +950,10 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
947950
result
948951
});
949952

953+
if result.is_ok() {
954+
self.maybe_lint_bare_trait(qpath, hir_id);
955+
}
956+
950957
// Write back the new resolution.
951958
self.write_resolution(hir_id, result);
952959
(
@@ -956,6 +963,29 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
956963
)
957964
}
958965

966+
fn maybe_lint_bare_trait(&self, qpath: &QPath<'_>, hir_id: hir::HirId) {
967+
if let QPath::TypeRelative(self_ty, _) = qpath {
968+
if let TyKind::TraitObject([poly_trait_ref, ..], _, TraitObjectSyntax::None) =
969+
self_ty.kind
970+
{
971+
self.tcx.struct_span_lint_hir(BARE_TRAIT_OBJECTS, hir_id, self_ty.span, |lint| {
972+
let mut db = lint
973+
.build(&format!("trait objects without an explicit `dyn` are deprecated"));
974+
let (sugg, app) = match self.tcx.sess.source_map().span_to_snippet(self_ty.span)
975+
{
976+
Ok(s) if poly_trait_ref.trait_ref.path.is_global() => {
977+
(format!("<dyn ({})>", s), Applicability::MachineApplicable)
978+
}
979+
Ok(s) => (format!("<dyn {}>", s), Applicability::MachineApplicable),
980+
Err(_) => ("<dyn <type>>".to_string(), Applicability::HasPlaceholders),
981+
};
982+
db.span_suggestion(self_ty.span, "use `dyn`", sugg, app);
983+
db.emit()
984+
});
985+
}
986+
}
987+
}
988+
959989
/// Given a function `Node`, return its `FnDecl` if it exists, or `None` otherwise.
960990
pub(in super::super) fn get_node_fn_decl(
961991
&self,
@@ -1174,9 +1204,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
11741204

11751205
let path_segs = match res {
11761206
Res::Local(_) | Res::SelfCtor(_) => vec![],
1177-
Res::Def(kind, def_id) => {
1178-
AstConv::def_ids_for_value_path_segments(self, segments, self_ty, kind, def_id)
1179-
}
1207+
Res::Def(kind, def_id) => <dyn AstConv<'_>>::def_ids_for_value_path_segments(
1208+
self, segments, self_ty, kind, def_id,
1209+
),
11801210
_ => bug!("instantiate_value_path on {:?}", res),
11811211
};
11821212

@@ -1219,7 +1249,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
12191249
// errors if type parameters are provided in an inappropriate place.
12201250

12211251
let generic_segs: FxHashSet<_> = path_segs.iter().map(|PathSeg(_, index)| index).collect();
1222-
let generics_has_err = AstConv::prohibit_generics(
1252+
let generics_has_err = <dyn AstConv<'_>>::prohibit_generics(
12231253
self,
12241254
segments.iter().enumerate().filter_map(|(index, seg)| {
12251255
if !generic_segs.contains(&index) || is_alias_variant_ctor {
@@ -1262,7 +1292,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
12621292
if let GenericArgCountResult {
12631293
correct: Err(GenericArgCountMismatch { reported: Some(_), .. }),
12641294
..
1265-
} = AstConv::check_generic_arg_count_for_call(
1295+
} = <dyn AstConv<'_>>::check_generic_arg_count_for_call(
12661296
tcx,
12671297
span,
12681298
def_id,
@@ -1370,7 +1400,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
13701400
) -> subst::GenericArg<'tcx> {
13711401
match (&param.kind, arg) {
13721402
(GenericParamDefKind::Lifetime, GenericArg::Lifetime(lt)) => {
1373-
AstConv::ast_region_to_region(self.fcx, lt, Some(param)).into()
1403+
<dyn AstConv<'_>>::ast_region_to_region(self.fcx, lt, Some(param)).into()
13741404
}
13751405
(GenericParamDefKind::Type { .. }, GenericArg::Type(ty)) => {
13761406
self.fcx.to_ty(ty).into()
@@ -1423,7 +1453,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
14231453
}
14241454

14251455
let substs = self_ctor_substs.unwrap_or_else(|| {
1426-
AstConv::create_substs_for_generic_args(
1456+
<dyn AstConv<'_>>::create_substs_for_generic_args(
14271457
tcx,
14281458
def_id,
14291459
&[][..],

‎compiler/rustc_typeck/src/check/fn_ctxt/checks.rs

+5-4
Original file line numberDiff line numberDiff line change
@@ -875,7 +875,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
875875
match *qpath {
876876
QPath::Resolved(ref maybe_qself, ref path) => {
877877
let self_ty = maybe_qself.as_ref().map(|qself| self.to_ty(qself));
878-
let ty = AstConv::res_to_ty(self, self_ty, path, true);
878+
let ty = <dyn AstConv<'_>>::res_to_ty(self, self_ty, path, true);
879879
(path.res, ty)
880880
}
881881
QPath::TypeRelative(ref qself, ref segment) => {
@@ -886,8 +886,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
886886
} else {
887887
Res::Err
888888
};
889-
let result =
890-
AstConv::associated_path_to_ty(self, hir_id, path_span, ty, res, segment, true);
889+
let result = <dyn AstConv<'_>>::associated_path_to_ty(
890+
self, hir_id, path_span, ty, res, segment, true,
891+
);
891892
let ty = result.map(|(ty, _, _)| ty).unwrap_or_else(|_| self.tcx().ty_error());
892893
let result = result.map(|(_, kind, def_id)| (kind, def_id));
893894

@@ -1000,7 +1001,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
10001001
// would trigger in `is_send::<T::AssocType>();`
10011002
// from `typeck-default-trait-impl-assoc-type.rs`.
10021003
} else {
1003-
let ty = AstConv::ast_ty_to_ty(self, hir_ty);
1004+
let ty = <dyn AstConv<'_>>::ast_ty_to_ty(self, hir_ty);
10041005
let ty = self.resolve_vars_if_possible(ty);
10051006
if ty == predicate.self_ty() {
10061007
error.obligation.cause.make_mut().span = hir_ty.span;

‎compiler/rustc_typeck/src/check/fn_ctxt/suggestions.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
461461
// are not, the expectation must have been caused by something else.
462462
debug!("suggest_missing_return_type: return type {:?} node {:?}", ty, ty.kind);
463463
let sp = ty.span;
464-
let ty = AstConv::ast_ty_to_ty(self, ty);
464+
let ty = <dyn AstConv<'_>>::ast_ty_to_ty(self, ty);
465465
debug!("suggest_missing_return_type: return type {:?}", ty);
466466
debug!("suggest_missing_return_type: expected type {:?}", ty);
467467
if ty.kind() == expected.kind() {
@@ -486,7 +486,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
486486
}
487487
let found = self.resolve_vars_with_obligations(found);
488488
if let hir::FnRetTy::Return(ty) = fn_decl.output {
489-
let ty = AstConv::ast_ty_to_ty(self, ty);
489+
let ty = <dyn AstConv<'_>>::ast_ty_to_ty(self, ty);
490490
let ty = self.tcx.erase_late_bound_regions(Binder::bind(ty));
491491
let ty = self.normalize_associated_types_in(expr.span, ty);
492492
if self.can_coerce(found, ty) {

‎compiler/rustc_typeck/src/check/inherited.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ impl Inherited<'a, 'tcx> {
117117
maybe_typeck_results: infcx.in_progress_typeck_results,
118118
},
119119
infcx,
120-
fulfillment_cx: RefCell::new(TraitEngine::new(tcx)),
120+
fulfillment_cx: RefCell::new(<dyn TraitEngine<'_>>::new(tcx)),
121121
locals: RefCell::new(Default::default()),
122122
deferred_sized_obligations: RefCell::new(Vec::new()),
123123
deferred_call_resolutions: RefCell::new(Default::default()),

0 commit comments

Comments
 (0)