Skip to content

Commit 72d2a7c

Browse files
committed
Auto merge of #78194 - bugadani:generic, r=varkor
Skip most of `create_substs_for_ast_path` if type is not generic
2 parents cfed918 + aebea52 commit 72d2a7c

File tree

1 file changed

+8
-0
lines changed
  • compiler/rustc_typeck/src/astconv

1 file changed

+8
-0
lines changed

compiler/rustc_typeck/src/astconv/mod.rs

+8
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,14 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
337337
infer_args,
338338
);
339339

340+
// Skip processing if type has no generic parameters.
341+
// Traits always have `Self` as a generic parameter, which means they will not return early
342+
// here and so associated type bindings will be handled regardless of whether there are any
343+
// non-`Self` generic parameters.
344+
if generic_params.params.len() == 0 {
345+
return (tcx.intern_substs(&[]), vec![], arg_count);
346+
}
347+
340348
let is_object = self_ty.map_or(false, |ty| ty == self.tcx().types.trait_object_dummy_self);
341349

342350
struct SubstsForAstPathCtxt<'a, 'tcx> {

0 commit comments

Comments
 (0)