about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--compiler/rustc_trait_selection/src/traits/select/mod.rs24
-rw-r--r--src/test/ui/async-await/issue-68112.stderr1
-rw-r--r--src/test/ui/generator/issue-68112.stderr1
-rw-r--r--src/test/ui/generator/print/generator-print-verbose-1.stderr1
-rw-r--r--src/test/ui/impl-trait/auto-trait-leak2.stderr2
5 files changed, 9 insertions, 20 deletions
diff --git a/compiler/rustc_trait_selection/src/traits/select/mod.rs b/compiler/rustc_trait_selection/src/traits/select/mod.rs
index efe01191e58..c21012591b6 100644
--- a/compiler/rustc_trait_selection/src/traits/select/mod.rs
+++ b/compiler/rustc_trait_selection/src/traits/select/mod.rs
@@ -1708,29 +1708,13 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
 
             ty::Closure(_, ref substs) => {
                 let ty = self.infcx.shallow_resolve(substs.as_closure().tupled_upvars_ty());
-                if let ty::Infer(ty::TyVar(_)) = ty.kind() {
-                    // The inference variable will be replaced by a tuple once capture analysis
-                    // completes. If the tuple meets a bound, so do all the elements within it.
-                    vec![ty]
-                } else {
-                    substs.as_closure().upvar_tys().collect()
-                }
+                vec![ty]
             }
 
             ty::Generator(_, ref substs, _) => {
-                let upvar_tys_resolved =
-                    self.infcx.shallow_resolve(substs.as_generator().tupled_upvars_ty());
-
-                if let ty::Infer(ty::TyVar(_)) = upvar_tys_resolved.kind() {
-                    // The inference variable will be replaced by a tuple once capture analysis
-                    // completes, if the tuple meets a bound, so do all the elements within it.
-                    let witness_resolved =
-                        self.infcx.shallow_resolve(substs.as_generator().witness());
-                    vec![upvar_tys_resolved, witness_resolved]
-                } else {
-                    let witness = substs.as_generator().witness();
-                    substs.as_generator().upvar_tys().chain(iter::once(witness)).collect()
-                }
+                let ty = self.infcx.shallow_resolve(substs.as_generator().tupled_upvars_ty());
+                let witness = substs.as_generator().witness();
+                vec![ty].into_iter().chain(iter::once(witness)).collect()
             }
 
             ty::GeneratorWitness(types) => {
diff --git a/src/test/ui/async-await/issue-68112.stderr b/src/test/ui/async-await/issue-68112.stderr
index e97d088cf3e..a6c93e91a9e 100644
--- a/src/test/ui/async-await/issue-68112.stderr
+++ b/src/test/ui/async-await/issue-68112.stderr
@@ -41,6 +41,7 @@ LL |     require_send(send_fut);
    |
    = help: the trait `Sync` is not implemented for `RefCell<i32>`
    = note: required because of the requirements on the impl of `Send` for `Arc<RefCell<i32>>`
+   = note: required because it appears within the type `(Arc<RefCell<i32>>,)`
    = note: required because it appears within the type `[static generator@$DIR/issue-68112.rs:47:31: 47:36 {}]`
    = note: required because it appears within the type `from_generator::GenFuture<[static generator@$DIR/issue-68112.rs:47:31: 47:36 {}]>`
    = note: required because it appears within the type `impl Future`
diff --git a/src/test/ui/generator/issue-68112.stderr b/src/test/ui/generator/issue-68112.stderr
index 96a8d6d70e0..5793bbd950e 100644
--- a/src/test/ui/generator/issue-68112.stderr
+++ b/src/test/ui/generator/issue-68112.stderr
@@ -29,6 +29,7 @@ LL |     require_send(send_gen);
    |
    = help: the trait `Sync` is not implemented for `RefCell<i32>`
    = note: required because of the requirements on the impl of `Send` for `Arc<RefCell<i32>>`
+   = note: required because it appears within the type `(Arc<RefCell<i32>>,)`
    = note: required because it appears within the type `[generator@$DIR/issue-68112.rs:38:5: 41:6 {()}]`
    = note: required because it appears within the type `impl Generator`
    = note: required because it appears within the type `impl Generator`
diff --git a/src/test/ui/generator/print/generator-print-verbose-1.stderr b/src/test/ui/generator/print/generator-print-verbose-1.stderr
index b5c63584c6c..9669f4d96b9 100644
--- a/src/test/ui/generator/print/generator-print-verbose-1.stderr
+++ b/src/test/ui/generator/print/generator-print-verbose-1.stderr
@@ -29,6 +29,7 @@ LL |     require_send(send_gen);
    |
    = help: the trait `Sync` is not implemented for `RefCell<i32>`
    = note: required because of the requirements on the impl of `Send` for `Arc<RefCell<i32>>`
+   = note: required because it appears within the type `(Arc<RefCell<i32>>,)`
    = note: required because it appears within the type `[make_gen2<Arc<RefCell<i32>>>::{closure#0} upvar_tys=(Arc<RefCell<i32>>) {()}]`
    = note: required because it appears within the type `Opaque(DefId(0:29 ~ generator_print_verbose_1[317d]::make_gen2::{opaque#0}), [std::sync::Arc<std::cell::RefCell<i32>>])`
    = note: required because it appears within the type `Opaque(DefId(0:32 ~ generator_print_verbose_1[317d]::make_non_send_generator2::{opaque#0}), [])`
diff --git a/src/test/ui/impl-trait/auto-trait-leak2.stderr b/src/test/ui/impl-trait/auto-trait-leak2.stderr
index 6b2b8248a4f..fc2bc62f3a7 100644
--- a/src/test/ui/impl-trait/auto-trait-leak2.stderr
+++ b/src/test/ui/impl-trait/auto-trait-leak2.stderr
@@ -11,6 +11,7 @@ LL |     send(before());
    |     ^^^^ `Rc<Cell<i32>>` cannot be sent between threads safely
    |
    = help: within `impl Fn<(i32,)>`, the trait `Send` is not implemented for `Rc<Cell<i32>>`
+   = note: required because it appears within the type `(Rc<Cell<i32>>,)`
    = note: required because it appears within the type `[closure@$DIR/auto-trait-leak2.rs:7:5: 7:22]`
    = note: required because it appears within the type `impl Fn<(i32,)>`
 
@@ -27,6 +28,7 @@ LL | fn after() -> impl Fn(i32) {
    |               ------------ within this `impl Fn<(i32,)>`
    |
    = help: within `impl Fn<(i32,)>`, the trait `Send` is not implemented for `Rc<Cell<i32>>`
+   = note: required because it appears within the type `(Rc<Cell<i32>>,)`
    = note: required because it appears within the type `[closure@$DIR/auto-trait-leak2.rs:24:5: 24:22]`
    = note: required because it appears within the type `impl Fn<(i32,)>`