Skip to content

Commit 26a4f46

Browse files
authored
Rollup merge of #84682 - jackh726:transitive_bounds_rebind, r=nikomatsakis
Don't rebind in `transitive_bounds_that_define_assoc_type` Fixes #83737 Fixes #84604 Also fixes another issue that I don't have a test for, popped up in [zulip](https://rust-lang.zulipchat.com/#narrow/stream/144729-wg-traits/topic/Duplicate.20symbol.20error.20.2384604/near/236570445) r? `````@nikomatsakis`````
2 parents e720df6 + 5f82e22 commit 26a4f46

File tree

4 files changed

+28
-3
lines changed

4 files changed

+28
-3
lines changed

compiler/rustc_infer/src/traits/util.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -305,9 +305,7 @@ pub fn transitive_bounds_that_define_assoc_type<'tcx>(
305305
Some(assoc_name),
306306
));
307307
for (super_predicate, _) in super_predicates.predicates {
308-
let bound_predicate = super_predicate.kind();
309-
let subst_predicate = super_predicate
310-
.subst_supertrait(tcx, &bound_predicate.rebind(trait_ref.skip_binder()));
308+
let subst_predicate = super_predicate.subst_supertrait(tcx, &trait_ref);
311309
if let Some(binder) = subst_predicate.to_opt_poly_trait_ref() {
312310
stack.push(binder.value);
313311
}

compiler/rustc_middle/src/ty/flags.rs

+4
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,10 @@ impl FlagComputation {
5959
{
6060
let mut computation = FlagComputation::new();
6161

62+
if !value.bound_vars().is_empty() {
63+
computation.flags = computation.flags | TypeFlags::HAS_RE_LATE_BOUND;
64+
}
65+
6266
f(&mut computation, value.skip_binder());
6367

6468
self.add_flags(computation.flags);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// build-pass
2+
// compile-flags: --edition 2018
3+
// compile-flags: --crate-type rlib
4+
5+
use std::future::Future;
6+
7+
async fn handle<F>(slf: &F)
8+
where
9+
F: Fn(&()) -> Box<dyn for<'a> Future<Output = ()> + Unpin>,
10+
{
11+
(slf)(&()).await;
12+
}
13+
14+
fn main() {}

src/test/ui/lifetimes/issue-84604.rs

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// run-pass
2+
// compile-flags: -Zsymbol-mangling-version=v0
3+
4+
pub fn f<T: ?Sized>() {}
5+
pub trait Frob<T: ?Sized> {}
6+
fn main() {
7+
f::<dyn Frob<str>>();
8+
f::<dyn for<'a> Frob<str>>();
9+
}

0 commit comments

Comments
 (0)