Skip to content

Commit 04f3011

Browse files
committed
---
yaml --- r: 190762 b: refs/heads/master c: bd2096c h: refs/heads/master v: v3
1 parent 79816e9 commit 04f3011

File tree

2 files changed

+15
-8
lines changed

2 files changed

+15
-8
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 99a508bc1795a7913ad790a3bf60f68dc782f282
2+
refs/heads/master: bd2096c497580da263c20e8231666a995722ac29
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: c64d671671aea2e44ee7fc6eb00ee75fc30ed7b9
55
refs/heads/try: 1c28ab65017d74fc13d003f7c7a73d1a48e5406f

trunk/src/librustc_trans/trans/meth.rs

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -842,13 +842,20 @@ fn emit_vtable_methods<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
842842
return nullptr;
843843
}
844844

845-
let predicates =
846-
monomorphize::apply_param_substs(tcx,
847-
&substs,
848-
&impl_method_type.predicates.predicates);
849-
if !predicates_hold(ccx, predicates.into_vec()) {
850-
debug!("emit_vtable_methods: predicates do not hold");
851-
return nullptr;
845+
// If this is a default method, it's possible that it
846+
// relies on where clauses that do not hold for this
847+
// particular set of type parameters. Note that this
848+
// method could then never be called, so we do not want to
849+
// try and trans it, in that case. Issue #23435.
850+
if ty::provided_source(tcx, impl_method_def_id).is_some() {
851+
let predicates =
852+
monomorphize::apply_param_substs(tcx,
853+
&substs,
854+
&impl_method_type.predicates.predicates);
855+
if !predicates_hold(ccx, predicates.into_vec()) {
856+
debug!("emit_vtable_methods: predicates do not hold");
857+
return nullptr;
858+
}
852859
}
853860

854861
trans_fn_ref_with_substs(ccx,

0 commit comments

Comments
 (0)