Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't concatenate binders across types #83870

Merged
merged 2 commits into from
Apr 9, 2021

Conversation

jackh726
Copy link
Member

@jackh726 jackh726 commented Apr 5, 2021

Partially addresses #83737

There's actually two issues that I uncovered in #83737. The first is that we are concatenating bound vars across types, i.e. in

F: Fn(&()) -> &mut (dyn Future<Output = ()> + Unpin)

the bound vars on Future get set as for<anon> since those are the binders on Fn(&(). This is obviously wrong, since we should only concatenate directly nested trait refs. This is solved here by introducing a new TraitRefBoundary scope, that we put around the "syntactical" trait refs and basically don't allow concatenation across.

Now, this alone shouldn't be a super terrible problem. At least not until you consider the other issue, which is a much more elusive and harder to design a "perfect" fix. A repro can be seen in:

use core::future::Future;

async fn handle<F>(slf: &F)
where
    F: Fn(&()) -> &mut (dyn for<'a> Future<Output = ()> + Unpin),
{
    (slf)(&()).await;
}

Notice the for<'a> around Future. Here, 'a is unused, so the for<'a> Binder gets changed to a for<> Binder in the generator witness, but the "local decl" still has it. This has heavy intersections with region anonymization and erasing. Luckily, it's not super common to find this unique set of circumstances. It only became apparently because of the first issue mentioned here. However, this is still a problem, so I'm leaving #83737 open.

r? @nikomatsakis

@jackh726 jackh726 added the WG-traits Working group: Traits, https://internals.rust-lang.org/t/announcing-traits-working-group/6804 label Apr 5, 2021
@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Apr 5, 2021
Copy link
Member Author

@jackh726 jackh726 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think ideally we want to always make sure that we have a TraitRefBoundary between a from_poly_trait_ref = true => from_poly_trait_ref = false scope change, to make things explicit. But I haven't been that strict here (much more focused on getting the ICEs off of nightly).

@@ -2982,6 +3021,7 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
self.have_bound_regions = true;
}
_ => {
// FIXME(jackh726): nested trait refs?
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I need to look into this, but I think there might be a bug here

@rust-log-analyzer

This comment has been minimized.

@Fishrock123
Copy link
Contributor

Luckily, it's not super common to find this unique set of circumstances.

To be clear, Tide (and a bunch of the rest of http-rs) cannot build it's docs due to this, since we also depend on the nightly feature(doc_cfg).

@jackh726
Copy link
Member Author

jackh726 commented Apr 5, 2021

Luckily, it's not super common to find this unique set of circumstances.

To be clear, Tide (and a bunch of the rest of http-rs) cannot build it's docs due to this, since we also depend on the nightly feature(doc_cfg).

There I'm referring to specifically the repro with in the OP with the defined but not used 'a. I'm not 100%, but I imagine that Tide's ICE will be fixed by this PR alone (Fuschia's will be, that's what I checked). Edit: and the repro that was generated from Tide's ICE is fixed.

The case that won't be fixed by this PR is when a type that has unused late-bound lifetimes ends up as an intermediate type in a Generator (e.g. an async function). And that might only be restricted to types in the output of a Fn, but I haven't been able to investigate that fully yet.

In summary: this PR alone doesn't fix the more difficult but "real" cause of the issue, but it does fix the issue that causes the ICE to be hit in many more places than it would be. Even more importantly, AFAICT there isn't a "fix" that someone could make to get around the issue without this PR but with this PR all you have to do is remove the unused lifetime. This downgrades the severity of the bug from P-critical to P-high imo.

@richkadel
Copy link
Contributor

richkadel commented Apr 6, 2021

Hey @jackh726 . I'm sorry to report that this fix didn't fix the error in Fuchsia. (It does fix some issues; see the bug report for details on an issue with -Zinstrument-coverage, which appears to be resolved by this PR), but I still get errors compiling brightness_manager:

$ /usr/local/google/home/richkadel/rust/install/fuchsia-rust/bin/rustc -Zverbose --color=always --crate-name brightness_manager ../../src/ui/bin/brightness_manager/src/main.rs --crate-type bin --emit=dep-info=x64-rustcoverage/brightness_manager.d,link -Zdep-info-omit-d-target -C link-args=--Map="x64-rustcoverage/exe.unstripped/brightness_manager.map" --cfg=rust_panic=\"abort\" --cfg=__rust_toolchain=\"1\" -L x64-rustcoverage/gen/zircon/public/sysroot/cpp/lib -Clinker=/usr/local/google/home/richkadel/fuchsia/prebuilt/third_party/clang/linux-x64/bin/lld -Clink-arg=--sysroot=x64-rustcoverage/gen/zircon/public/sysroot/cpp -Clink-arg=-L/usr/local/google/home/richkadel/fuchsia/prebuilt/third_party/clang/linux-x64/lib/clang/13.0.0/x86_64-fuchsia/lib -Clink-arg=--pack-dyn-relocs=relr -Clink-arg=-dynamic-linker=ld.so.1 -Clink-arg=--icf=all --remap-path-prefix /usr/local/google/home/richkadel/fuchsia/=../../ -Cforce-frame-pointers -Copt-level=0 -Cdebuginfo=2 --edition=2018 -Zallow-features= --target x86_64-fuchsia --cap-lints=deny -Wrust-2018-idioms -Dwarnings -Clink-args=-zstack-size=0x200000 -Cpanic=abort -Cforce-unwind-tables=yes -Zpanic_abort_tests -Clink-arg=-dynamic-linker=rustcoverage/ld.so.1 -Cprefer-dynamic -o "x64-rustcoverage/exe.unstripped/brightness_manager" -Ldependency=x64-rustcoverage/obj/sdk/fidl/fuchsia.hardware.backlight/fuchsia.hardware.backlight-rustc -Ldependency=x64-rustcoverage/obj/src/lib/fidl/rust/fidl -Ldependency=x64-rustcoverage/obj/src/lib/fuchsia-async -Ldependency=host_x64 -Ldependency=x64-rustcoverage/obj/src/lib/fuchsia-system-alloc -Ldependency=x64-rustcoverage/obj/src/lib/zircon/rust -Ldependency=x64-rustcoverage/obj/third_party/rust_crates -Ldependency=x64-rustcoverage/obj/src/lib/zerocopy -Ldependency=x64-rustcoverage/obj/zircon/vdso/zx/zx-rustc -Ldependency=x64-rustcoverage/obj/sdk/fidl/fuchsia.hardware.input/fuchsia.hardware.input-rustc -Ldependency=x64-rustcoverage/obj/sdk/fidl/fuchsia.ui.brightness/fuchsia.ui.brightness-rustc -Ldependency=x64-rustcoverage/obj/sdk/fidl/fuchsia.ui.input/fuchsia.ui.input-rustc -Ldependency=x64-rustcoverage/obj/sdk/fidl/fuchsia.ui.input2/fuchsia.ui.input2-rustc -Ldependency=x64-rustcoverage/obj/sdk/fidl/fuchsia.ui.views/fuchsia.ui.views-rustc -Ldependency=x64-rustcoverage/obj/sdk/fidl/fuchsia.ui.input3/fuchsia.ui.input3-rustc -Ldependency=x64-rustcoverage/obj/sdk/fidl/fuchsia.input/fuchsia.input-rustc -Ldependency=x64-rustcoverage/obj/src/lib/fdio/rust -Ldependency=x64-rustcoverage/obj/sdk/fidl/fuchsia.device/fuchsia.device-rustc -Ldependency=x64-rustcoverage/obj/sdk/fidl/fuchsia.hardware.power.statecontrol/fuchsia.hardware.power.statecontrol-rustc -Ldependency=x64-rustcoverage/obj/src/lib/fuchsia-runtime -Ldependency=x64-rustcoverage/obj/src/lib/fuchsia-component -Ldependency=x64-rustcoverage/obj/garnet/lib/rust/files_async -Ldependency=x64-rustcoverage/obj/sdk/fidl/fuchsia.io/fuchsia.io-rustc -Ldependency=x64-rustcoverage/obj/sdk/fidl/fuchsia.io2/fuchsia.io2-rustc -Ldependency=x64-rustcoverage/obj/sdk/fidl/fuchsia.mem/fuchsia.mem-rustc -Ldependency=x64-rustcoverage/obj/garnet/lib/rust/io_util -Ldependency=x64-rustcoverage/obj/sdk/fidl/fuchsia.sys/fuchsia.sys-rustc -Ldependency=x64-rustcoverage/obj/sdk/fidl/fuchsia.sys2/fuchsia.sys2-rustc -Ldependency=x64-rustcoverage/obj/sdk/fidl/fuchsia.component/fuchsia.component-rustc -Ldependency=x64-rustcoverage/obj/sdk/fidl/fuchsia.data/fuchsia.data-rustc -Ldependency=x64-rustcoverage/obj/sdk/fidl/fuchsia.url/fuchsia.url-rustc -Ldependency=x64-rustcoverage/obj/src/lib/syslog/rust -Ldependency=x64-rustcoverage/obj/sdk/fidl/fuchsia.logger/fuchsia.logger-rustc -Ldependency=x64-rustcoverage/obj/sdk/fidl/fuchsia.diagnostics/fuchsia.diagnostics-rustc -Ldependency=x64-rustcoverage/obj/src/lib/watch_handler -Lnative=x64-rustcoverage/obj/sdk/lib/syslog/cpp -Lnative=x64-rustcoverage/obj/out/core.x64-rustcoverage/fidling/gen/sdk/fidl/fuchsia.diagnostics.stream/fuchsia.diagnostics.stream/hlcpp/fuchsia/diagnostics/stream/cpp -Lnative=x64-rustcoverage/obj/out/core.x64-rustcoverage/fidling/gen/sdk/fidl/fuchsia.diagnostics.stream -Lnative=x64-rustcoverage/obj/out/core.x64-rustcoverage/fidling/gen/sdk/fidl/fuchsia.diagnostics/fuchsia.diagnostics/hlcpp/fuchsia/diagnostics/cpp -Lnative=x64-rustcoverage/obj/out/core.x64-rustcoverage/fidling/gen/sdk/fidl/fuchsia.diagnostics -Lnative=x64-rustcoverage/obj/out/core.x64-rustcoverage/fidling/gen/sdk/fidl/fuchsia.mem/fuchsia.mem/hlcpp/fuchsia/mem/cpp -Lnative=x64-rustcoverage/obj/out/core.x64-rustcoverage/fidling/gen/sdk/fidl/fuchsia.mem -Lnative=x64-rustcoverage/obj/out/core.x64-rustcoverage/fidling/gen/zircon/vdso/zx/zx/hlcpp/zx/cpp -Lnative=x64-rustcoverage/obj/out/core.x64-rustcoverage/fidling/gen/zircon/vdso/zx -Lnative=x64-rustcoverage/obj/sdk/lib/fidl/cpp/internal -Lnative=x64-rustcoverage/obj/sdk/lib/fidl/cpp -Lnative=x64-rustcoverage/obj/out/core.x64-rustcoverage/fidling/gen/sdk/fidl/fuchsia.logger/fuchsia.logger/hlcpp/fuchsia/logger/cpp -Lnative=x64-rustcoverage/obj/out/core.x64-rustcoverage/fidling/gen/sdk/fidl/fuchsia.logger -Lnative=x64-rustcoverage/obj/sdk/lib/syslog/streams/cpp -Lnative=user.libc_x64-rustcoverage/obj/zircon/system/ulib/c -Lnative=x64-rustcoverage-shared/lib.unstripped -Lnative=x64-rustcoverage/obj/sdk/lib/fit -Lnative=x64-rustcoverage/obj/sdk/lib/stdcompat -Lnative=x64-rustcoverage/obj/zircon/system/ulib/fidl -Lnative=x64-rustcoverage/obj/sdk/lib/fit-promise -Lnative=x64-rustcoverage/obj/zircon/system/ulib/zx -Lnative=x64-rustcoverage/obj/zircon/system/ulib/async -Lnative=user.libc_x64-rustcoverage -Clink-arg=x64-rustcoverage/obj/sdk/lib/syslog/cpp/cpp.log_settings.cc.o -Clink-arg=x64-rustcoverage/obj/sdk/lib/syslog/cpp/cpp.macros.cc.o -Clink-arg=x64-rustcoverage/obj/out/core.x64-rustcoverage/fidling/gen/sdk/fidl/fuchsia.diagnostics.stream/fuchsia.diagnostics.stream/hlcpp/fuchsia/diagnostics/stream/cpp/fuchsia.diagnostics.stream_hlcpp.fidl.cc.o -Clink-arg=x64-rustcoverage/obj/out/core.x64-rustcoverage/fidling/gen/sdk/fidl/fuchsia.diagnostics.stream/fuchsia.diagnostics.stream_tables.fuchsia.diagnostics.stream.fidl.tables.c.o -Clink-arg=x64-rustcoverage/obj/out/core.x64-rustcoverage/fidling/gen/sdk/fidl/fuchsia.diagnostics/fuchsia.diagnostics/hlcpp/fuchsia/diagnostics/cpp/fuchsia.diagnostics_hlcpp.fidl.cc.o -Clink-arg=x64-rustcoverage/obj/out/core.x64-rustcoverage/fidling/gen/sdk/fidl/fuchsia.diagnostics/fuchsia.diagnostics_tables.fuchsia.diagnostics.fidl.tables.c.o -Clink-arg=x64-rustcoverage/obj/out/core.x64-rustcoverage/fidling/gen/sdk/fidl/fuchsia.mem/fuchsia.mem/hlcpp/fuchsia/mem/cpp/fuchsia.mem_hlcpp.fidl.cc.o -Clink-arg=x64-rustcoverage/obj/out/core.x64-rustcoverage/fidling/gen/sdk/fidl/fuchsia.mem/fuchsia.mem_tables.fuchsia.mem.fidl.tables.c.o -Clink-arg=x64-rustcoverage/obj/out/core.x64-rustcoverage/fidling/gen/zircon/vdso/zx/zx/hlcpp/zx/cpp/zx_hlcpp.fidl.cc.o -Clink-arg=x64-rustcoverage/obj/out/core.x64-rustcoverage/fidling/gen/zircon/vdso/zx/zx_tables.zx.fidl.tables.c.o -Clink-arg=x64-rustcoverage/obj/sdk/lib/fidl/cpp/internal/cpp.message_handler.cc.o -Clink-arg=x64-rustcoverage/obj/sdk/lib/fidl/cpp/internal/cpp.message_reader.cc.o -Clink-arg=x64-rustcoverage/obj/sdk/lib/fidl/cpp/internal/cpp.pending_response.cc.o -Clink-arg=x64-rustcoverage/obj/sdk/lib/fidl/cpp/internal/cpp.proxy.cc.o -Clink-arg=x64-rustcoverage/obj/sdk/lib/fidl/cpp/internal/cpp.proxy_controller.cc.o -Clink-arg=x64-rustcoverage/obj/sdk/lib/fidl/cpp/internal/cpp.stub.cc.o -Clink-arg=x64-rustcoverage/obj/sdk/lib/fidl/cpp/internal/cpp.stub_controller.cc.o -Clink-arg=x64-rustcoverage/obj/sdk/lib/fidl/cpp/internal/cpp.weak_stub_controller.cc.o -Clink-arg=x64-rustcoverage/obj/sdk/lib/fidl/cpp/internal/cpp_sync.logging.cc.o -Clink-arg=x64-rustcoverage/obj/sdk/lib/fidl/cpp/internal/cpp_sync.message_sender.cc.o -Clink-arg=x64-rustcoverage/obj/sdk/lib/fidl/cpp/internal/cpp_sync.synchronous_proxy.cc.o -Clink-arg=x64-rustcoverage/obj/sdk/lib/fidl/cpp/cpp_base.builder.cc.o -Clink-arg=x64-rustcoverage/obj/sdk/lib/fidl/cpp/cpp_base.clone.cc.o -Clink-arg=x64-rustcoverage/obj/sdk/lib/fidl/cpp/cpp_base.decoder.cc.o -Clink-arg=x64-rustcoverage/obj/sdk/lib/fidl/cpp/cpp_base.encoder.cc.o -Clink-arg=x64-rustcoverage/obj/sdk/lib/fidl/cpp/cpp_base.message.cc.o -Clink-arg=x64-rustcoverage/obj/sdk/lib/fidl/cpp/cpp_base.message_buffer.cc.o -Clink-arg=x64-rustcoverage/obj/sdk/lib/fidl/cpp/cpp_base.message_builder.cc.o -Clink-arg=x64-rustcoverage/obj/out/core.x64-rustcoverage/fidling/gen/sdk/fidl/fuchsia.logger/fuchsia.logger/hlcpp/fuchsia/logger/cpp/fuchsia.logger_hlcpp.fidl.cc.o -Clink-arg=x64-rustcoverage/obj/out/core.x64-rustcoverage/fidling/gen/sdk/fidl/fuchsia.logger/fuchsia.logger_tables.fuchsia.logger.fidl.tables.c.o -Clink-arg=x64-rustcoverage/obj/sdk/lib/syslog/streams/cpp/streams-encoder.encode.cc.o -Clink-arg=user.libc_x64-rustcoverage/obj/zircon/system/ulib/c/crt1.Scrt1.cc.o -Clink-arg=x64-rustcoverage/obj/sdk/lib/syslog/cpp/libbackend_fuchsia_lib_rust.a -Clink-arg=x64-rustcoverage-shared/lib.unstripped/libbackend_fuchsia_globals.so -Clink-arg=x64-rustcoverage/obj/sdk/lib/fit/libfit.a -Clink-arg=x64-rustcoverage/obj/sdk/lib/stdcompat/libstdcompat.a -Clink-arg=x64-rustcoverage/obj/zircon/system/ulib/fidl/libfidl_base.a -Clink-arg=x64-rustcoverage/obj/sdk/lib/fit-promise/libfit-promise.a -Clink-arg=x64-rustcoverage/obj/zircon/system/ulib/fidl/libfidl.a -Clink-arg=x64-rustcoverage/obj/zircon/system/ulib/zx/libzx.a -Clink-arg=x64-rustcoverage/obj/zircon/system/ulib/async/libasync.a -Clink-arg=x64-rustcoverage-shared/lib.unstripped/libasync-default.so -Clink-arg=x64-rustcoverage-shared/lib.unstripped/libfdio.so -Clink-arg=x64-rustcoverage-shared/lib.unstripped/libsyslog.so -Clink-arg=user.libc_x64-rustcoverage/libc.so.debug -Lnative=../../build/config/zircon/libc-dummy -Clink-arg=x64-rustcoverage/libzircon.so --extern fidl_fuchsia_hardware_backlight=x64-rustcoverage/obj/sdk/fidl/fuchsia.hardware.backlight/fuchsia.hardware.backlight-rustc/libfidl_fuchsia_hardware_backlight.rlib --extern fidl_fuchsia_hardware_input=x64-rustcoverage/obj/sdk/fidl/fuchsia.hardware.input/fuchsia.hardware.input-rustc/libfidl_fuchsia_hardware_input.rlib --extern fidl_fuchsia_ui_brightness=x64-rustcoverage/obj/sdk/fidl/fuchsia.ui.brightness/fuchsia.ui.brightness-rustc/libfidl_fuchsia_ui_brightness.rlib --extern fidl_fuchsia_ui_input=x64-rustcoverage/obj/sdk/fidl/fuchsia.ui.input/fuchsia.ui.input-rustc/libfidl_fuchsia_ui_input.rlib --extern fdio=x64-rustcoverage/obj/src/lib/fdio/rust/libfdio.rlib --extern fidl=x64-rustcoverage/obj/src/lib/fidl/rust/fidl/libfidl.rlib --extern fuchsia_async=x64-rustcoverage/obj/src/lib/fuchsia-async/libfuchsia_async.rlib --extern fuchsia_component=x64-rustcoverage/obj/src/lib/fuchsia-component/libfuchsia_component.rlib --extern fuchsia_runtime=x64-rustcoverage/obj/src/lib/fuchsia-runtime/libfuchsia_runtime.rlib --extern fuchsia_syslog=x64-rustcoverage/obj/src/lib/syslog/rust/libfuchsia_syslog.rlib --extern watch_handler=x64-rustcoverage/obj/src/lib/watch_handler/libwatch_handler.rlib --extern fuchsia_zircon=x64-rustcoverage/obj/src/lib/zircon/rust/libfuchsia_zircon.rlib --extern anyhow=x64-rustcoverage/obj/third_party/rust_crates/libanyhow-34b5b8ef286e2000.rlib --extern async_trait=host_x64/libasync_trait-c6b6d222802967e6.so --extern byteorder=x64-rustcoverage/obj/third_party/rust_crates/libbyteorder-e4429ddc31d502a7.rlib --extern futures=x64-rustcoverage/obj/third_party/rust_crates/libfutures-3c827392713a33d4.rlib --extern futures_util=x64-rustcoverage/obj/third_party/rust_crates/libfutures_util-9cbfc1877c4fcb4.rlib --extern lazy_static=x64-rustcoverage/obj/third_party/rust_crates/liblazy_static-cdf593bd3fb3d68f.rlib --extern num_traits=x64-rustcoverage/obj/third_party/rust_crates/libnum_traits-a6e1ee504861eea7.rlib --extern parking_lot=x64-rustcoverage/obj/third_party/rust_crates/libparking_lot-6721767503fecbee.rlib --extern serde=x64-rustcoverage/obj/third_party/rust_crates/libserde-51abe0aa53b0d3ac.rlib --extern serde_json=x64-rustcoverage/obj/third_party/rust_crates/libserde_json-7635f31531fde4db.rlib --extern splines=x64-rustcoverage/obj/third_party/rust_crates/libsplines-d1b51f4ec5d923f7.rlib --extern thiserror=x64-rustcoverage/obj/third_party/rust_crates/libthiserror-dcdc66d3bbb690d3.rlib 
error: internal compiler error: compiler/rustc_mir/src/transform/generator.rs:751:13: Broken MIR: generator contains type Opaque(DefId(0:456 ~ brightness_manager[317d]::run_brightness_service::{opaque#0}), [for<'r> fn(fidl_fuchsia_ui_brightness::ControlRequestStream, std::sync::Arc<futures::lock::Mutex<(dyn control::ControlTrait + ReErased)>>) -> std::pin::Pin<std::boxed::Box<(dyn futures::Future<Output = std::result::Result<(), anyhow::Error>> + ReErased)>>]) in MIR, but typeck only knows about {ResumeTy, ServiceFs<ServiceObjLocal<ControlRequestStream>>, Opaque(DefId(0:111 ~ brightness_manager[317d]::backlight::{impl#0}::new::{opaque#0}), []), (), Backlight, Arc<futures::lock::Mutex<Backlight>>, Opaque(DefId(0:436 ~ brightness_manager[317d]::sensor::{impl#0}::new::{opaque#0}), []), Sensor, Arc<futures::lock::Mutex<Sensor>>, SenderChannel<f32>, Arc<futures::lock::Mutex<SenderChannel<f32>>>, SenderChannel<bool>, Arc<futures::lock::Mutex<SenderChannel<bool>>>, Arc<futures::lock::Mutex<(dyn SensorControl + ReErased)>>, Arc<futures::lock::Mutex<(dyn BacklightControl + ReErased)>>, Opaque(DefId(0:280 ~ brightness_manager[317d]::control::{impl#5}::new::{opaque#0}), []), Control, Arc<futures::lock::Mutex<Control>>, fn(ControlRequestStream, Arc<futures::lock::Mutex<(dyn ControlTrait + ReErased)>>) -> Pin<Box<(dyn futures::Future<Output = Result<(), anyhow::Error>> + ReErased)>>, Arc<futures::lock::Mutex<(dyn ControlTrait + ReErased)>>, Opaque(DefId(0:456 ~ brightness_manager[317d]::run_brightness_service::{opaque#0}), [fn(fidl_fuchsia_ui_brightness::ControlRequestStream, std::sync::Arc<futures::lock::Mutex<(dyn control::ControlTrait + ReErased)>>) -> std::pin::Pin<std::boxed::Box<(dyn futures::Future<Output = std::result::Result<(), anyhow::Error>> + ReErased)>>])} and []
   --> ../../src/ui/bin/brightness_manager/src/main.rs:154:10
    |
154 | async fn main() -> Result<(), Error> {
    |          ^^^^

thread 'rustc' panicked at 'Box<Any>', /usr/local/google/home/richkadel/rust/library/std/src/panic.rs:59:5
stack backtrace:
   0:     0x7fafecb9b6c0 - std::backtrace_rs::backtrace::libunwind::trace::h3070b301bb5ab74e
                               at /usr/local/google/home/richkadel/rust/library/std/src/../../backtrace/src/backtrace/libunwind.rs:90:5
   1:     0x7fafecb9b6c0 - std::backtrace_rs::backtrace::trace_unsynchronized::h7dc08349d0fccbdb
                               at /usr/local/google/home/richkadel/rust/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7fafecb9b6c0 - std::sys_common::backtrace::_print_fmt::hf0a8b45a4142c4c8
                               at /usr/local/google/home/richkadel/rust/library/std/src/sys_common/backtrace.rs:67:5
   3:     0x7fafecb9b6c0 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h9fcd8c5a937d304b
                               at /usr/local/google/home/richkadel/rust/library/std/src/sys_common/backtrace.rs:46:22
   4:     0x7fafecc162ef - core::fmt::write::h66ce6b9f5c3dd1ae
                               at /usr/local/google/home/richkadel/rust/library/core/src/fmt/mod.rs:1094:17
   5:     0x7fafecb8fd25 - std::io::Write::write_fmt::h73b66a0a6c7e21cb
                               at /usr/local/google/home/richkadel/rust/library/std/src/io/mod.rs:1578:15
   6:     0x7fafecb9f2fb - std::sys_common::backtrace::_print::h7235368ebf13bc36
                               at /usr/local/google/home/richkadel/rust/library/std/src/sys_common/backtrace.rs:49:5
   7:     0x7fafecb9f2fb - std::sys_common::backtrace::print::h6646fe3fd64eb87e
                               at /usr/local/google/home/richkadel/rust/library/std/src/sys_common/backtrace.rs:36:9
   8:     0x7fafecb9f2fb - std::panicking::default_hook::{{closure}}::h9d50014b1a836df3
                               at /usr/local/google/home/richkadel/rust/library/std/src/panicking.rs:208:50
   9:     0x7fafecb9eddd - std::panicking::default_hook::h0dc17d3ed8af201e
                               at /usr/local/google/home/richkadel/rust/library/std/src/panicking.rs:225:9
  10:     0x7fafedce54b8 - rustc_driver::report_ice::hf9ac142861742502
  11:     0x7fafc7634103 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h76ac0e733404f6ba
                               at /usr/local/google/home/richkadel/rust/library/alloc/src/boxed.rs:1560:9
  12:     0x7fafc7631146 - proc_macro::bridge::client::<impl proc_macro::bridge::Bridge>::enter::{{closure}}::{{closure}}::hbcde13bfc6eca3f3
                               at /usr/local/google/home/richkadel/rust/library/proc_macro/src/bridge/client.rs:320:21
  13:     0x7fafecb9fb80 - std::panicking::rust_panic_with_hook::h795bd5f87591701f
                               at /usr/local/google/home/richkadel/rust/library/std/src/panicking.rs:595:17
  14:     0x7fafef35af40 - std::panicking::begin_panic::{{closure}}::h67f28f272ba5b299
  15:     0x7fafef35ad59 - std::sys_common::backtrace::__rust_end_short_backtrace::h97fb83ee94bace97
  16:     0x7fafef35aec2 - std::panicking::begin_panic::h9467f1cbeb0680aa
  17:     0x7fafef22d290 - std::panic::panic_any::h47ac84098d20382f
  18:     0x7fafef225495 - rustc_errors::HandlerInner::span_bug::hd47e97195754211a
  19:     0x7fafef225953 - rustc_errors::Handler::span_bug::ha07d3f2efbc4b3d3
  20:     0x7fafef22a480 - rustc_middle::util::bug::opt_span_bug_fmt::{{closure}}::h12cd570e8acb76b4
  21:     0x7fafef22835b - rustc_middle::ty::context::tls::with_opt::{{closure}}::h7aa59fd781092bae
  22:     0x7fafef22830a - rustc_middle::ty::context::tls::with_opt::h0acb529f18cf2f6c
  23:     0x7fafef22a393 - rustc_middle::util::bug::opt_span_bug_fmt::hc86428558dc512b5
  24:     0x7fafef22a357 - rustc_middle::util::bug::span_bug_fmt::h9e46786f09ae7929
  25:     0x7fafef07b809 - <rustc_mir::transform::generator::StateTransform as rustc_mir::transform::MirPass>::run_pass::h35fb8f3bebb5fa76
  26:     0x7fafef081080 - rustc_mir::transform::run_passes::hadd0ed6897143b9e
  27:     0x7fafef0872c9 - rustc_mir::transform::optimized_mir::h39ed0b27b4aefc95
  28:     0x7fafeec67729 - rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl::hd2659dfa0ecf2f94
  29:     0x7fafeed25e6f - rustc_data_structures::stack::ensure_sufficient_stack::h005ce2d6bf554ae7
  30:     0x7fafee968fe8 - rustc_query_system::query::plumbing::force_query_with_job::h18c0a204e19f48b1
  31:     0x7fafee8eb169 - rustc_query_system::query::plumbing::get_query_impl::h7b8f88aa3b9abc9b
  32:     0x7fafeebdf72c - <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::optimized_mir::h6781c46c4fe79c1b
  33:     0x7fafeffdae57 - rustc_middle::ty::<impl rustc_middle::ty::context::TyCtxt>::generator_layout::h2c9a7f7e78ab7724
  34:     0x7faff00eb4e0 - rustc_middle::ty::layout::LayoutCx<rustc_middle::ty::context::TyCtxt>::layout_raw_uncached::h64afc7180f63c225
  35:     0x7faff00e72b3 - rustc_middle::ty::layout::layout_raw::h18811fb33f919669
  36:     0x7fafee9ffbd3 - rustc_query_impl::<impl rustc_query_system::query::config::QueryAccessors<rustc_query_impl::plumbing::QueryCtxt> for rustc_query_impl::queries::layout_raw>::compute::haa2138f32522ab2b
  37:     0x7fafeec559f6 - rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl::h9900c6a25fa944b2
  38:     0x7fafeed423de - rustc_data_structures::stack::ensure_sufficient_stack::had5614b0d10064a9
  39:     0x7fafee97fc42 - rustc_query_system::query::plumbing::force_query_with_job::h87be078355284b1c
  40:     0x7fafee8ce668 - rustc_query_system::query::plumbing::get_query_impl::h3efad482f5b7ac0d
  41:     0x7fafeebe486d - <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::layout_raw::h637bf42247bed6c9
  42:     0x7faff00f6df1 - <rustc_middle::ty::layout::LayoutCx<rustc_middle::ty::context::TyCtxt> as rustc_target::abi::LayoutOf>::layout_of::he37b273ad2a07ac3
  43:     0x7faff0026633 - <alloc::vec::Vec<T> as alloc::vec::spec_from_iter::SpecFromIter<T,I>>::from_iter::h0737e81a2d4725ad
  44:     0x7fafefff3561 - <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::try_fold::h0916a09c46063fdd
  45:     0x7faff0030781 - <alloc::vec::Vec<T> as alloc::vec::spec_from_iter::SpecFromIter<T,I>>::from_iter::hde16bed4df464c63
  46:     0x7faff00eb925 - rustc_middle::ty::layout::LayoutCx<rustc_middle::ty::context::TyCtxt>::layout_raw_uncached::h64afc7180f63c225
  47:     0x7faff00e72b3 - rustc_middle::ty::layout::layout_raw::h18811fb33f919669
  48:     0x7fafee9ffbd3 - rustc_query_impl::<impl rustc_query_system::query::config::QueryAccessors<rustc_query_impl::plumbing::QueryCtxt> for rustc_query_impl::queries::layout_raw>::compute::haa2138f32522ab2b
  49:     0x7fafeec559f6 - rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl::h9900c6a25fa944b2
  50:     0x7fafeed423de - rustc_data_structures::stack::ensure_sufficient_stack::had5614b0d10064a9
  51:     0x7fafee97fc42 - rustc_query_system::query::plumbing::force_query_with_job::h87be078355284b1c
  52:     0x7fafee8ce668 - rustc_query_system::query::plumbing::get_query_impl::h3efad482f5b7ac0d
  53:     0x7fafeebe486d - <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::layout_raw::h637bf42247bed6c9
  54:     0x7faff00f6df1 - <rustc_middle::ty::layout::LayoutCx<rustc_middle::ty::context::TyCtxt> as rustc_target::abi::LayoutOf>::layout_of::he37b273ad2a07ac3
  55:     0x7fafef0db3ed - <rustc_mir::transform::const_prop::ConstProp as rustc_mir::transform::MirPass>::run_pass::he6bd2716bb6efaf5
  56:     0x7fafef081080 - rustc_mir::transform::run_passes::hadd0ed6897143b9e
  57:     0x7fafef087320 - rustc_mir::transform::optimized_mir::h39ed0b27b4aefc95
  58:     0x7fafeec67729 - rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl::hd2659dfa0ecf2f94
  59:     0x7fafeed25e6f - rustc_data_structures::stack::ensure_sufficient_stack::h005ce2d6bf554ae7
  60:     0x7fafee968fe8 - rustc_query_system::query::plumbing::force_query_with_job::h18c0a204e19f48b1
  61:     0x7fafee8eb169 - rustc_query_system::query::plumbing::get_query_impl::h7b8f88aa3b9abc9b
  62:     0x7fafeebdf72c - <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::optimized_mir::h6781c46c4fe79c1b
  63:     0x7fafeffd9e5b - rustc_middle::ty::<impl rustc_middle::ty::context::TyCtxt>::instance_mir::h2adcb21a67bb16aa
  64:     0x7fafef1dbfc8 - rustc_mir::monomorphize::collector::collect_neighbours::h1bbe0e2725316449
  65:     0x7fafef1d5c0d - rustc_mir::monomorphize::collector::collect_items_rec::h43d412ee589f7bda
  66:     0x7fafef4c12d9 - rustc_session::utils::<impl rustc_session::session::Session>::time::h7a56f9b4149bfbea
  67:     0x7fafef1d4216 - rustc_mir::monomorphize::collector::collect_crate_mono_items::hf86b7fa3f70cb1f4
  68:     0x7fafef498c68 - rustc_mir::monomorphize::partitioning::collect_and_partition_mono_items::ha60093a41932fa60
  69:     0x7fafeea00419 - rustc_query_impl::<impl rustc_query_system::query::config::QueryAccessors<rustc_query_impl::plumbing::QueryCtxt> for rustc_query_impl::queries::collect_and_partition_mono_items>::compute::h6a07781687f36953
  70:     0x7fafeec6f49a - rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl::hf2ef1b6c3a448afe
  71:     0x7fafeed4a4cc - rustc_data_structures::stack::ensure_sufficient_stack::he2ad1d418c205690
  72:     0x7fafee9852ea - rustc_query_system::query::plumbing::force_query_with_job::ha07662fb9d448595
  73:     0x7fafee8f4c7d - rustc_query_system::query::plumbing::get_query_impl::h8c3d153258eb6b4b
  74:     0x7fafeebe7b10 - <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::collect_and_partition_mono_items::h45ac5f56bedc5b06
  75:     0x7fafedf905b8 - <rustc_codegen_llvm::LlvmCodegenBackend as rustc_codegen_ssa::traits::backend::CodegenBackend>::codegen_crate::h1b3edce9a41a8cd9
  76:     0x7fafede3e52f - rustc_interface::passes::QueryContext::enter::hd53f7e1828200bf7
  77:     0x7fafede4a1d3 - rustc_interface::queries::Queries::ongoing_codegen::h95a8778005c3b397
  78:     0x7fafedcf0bd3 - rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter::hc7b98d0ba93057dc
  79:     0x7fafedce740d - rustc_span::with_source_map::h681f81f772630eab
  80:     0x7fafedcf1b7b - rustc_interface::interface::create_compiler_and_run::h78eeee49dabc90f2
  81:     0x7fafedd15a30 - scoped_tls::ScopedKey<T>::set::hd80250aa98541d63
  82:     0x7fafedd18000 - std::sys_common::backtrace::__rust_begin_short_backtrace::h77920e05c4fb0f5a
  83:     0x7fafedd23283 - core::ops::function::FnOnce::call_once{{vtable.shim}}::hcac471670da73d1d
  84:     0x7fafecbb0573 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hfb93e846e02b3a24
                               at /usr/local/google/home/richkadel/rust/library/alloc/src/boxed.rs:1546:9
  85:     0x7fafecbb0573 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h1b4addec7ba447a1
                               at /usr/local/google/home/richkadel/rust/library/alloc/src/boxed.rs:1546:9
  86:     0x7fafecbb0573 - std::sys::unix::thread::Thread::new::thread_start::h48d9f3e91a2da8f4
                               at /usr/local/google/home/richkadel/rust/library/std/src/sys/unix/thread.rs:71:17
  87:     0x7fafe8de8ea7 - start_thread
  88:     0x7fafec9bedef - clone

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.53.0-nightly (6659bd214 2021-04-06) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z verbose -Z dep-info-omit-d-target -Z allow-features= -Z panic_abort_tests -C link-args=--Map=x64-rustcoverage/exe.unstripped/brightness_manager.map -C linker=/usr/local/google/home/richkadel/fuchsia/prebuilt/third_party/clang/linux-x64/bin/lld -C link-arg=--sysroot=x64-rustcoverage/gen/zircon/public/sysroot/cpp -C link-arg=-L/usr/local/google/home/richkadel/fuchsia/prebuilt/third_party/clang/linux-x64/lib/clang/13.0.0/x86_64-fuchsia/lib -C link-arg=--pack-dyn-relocs=relr -C link-arg=-dynamic-linker=ld.so.1 -C link-arg=--icf=all -C force-frame-pointers -C opt-level=0 -C debuginfo=2 -C link-args=-zstack-size=0x200000 -C panic=abort -C force-unwind-tables=yes -C link-arg=-dynamic-linker=rustcoverage/ld.so.1 -C prefer-dynamic -C link-arg=x64-rustcoverage/obj/sdk/lib/syslog/cpp/cpp.log_settings.cc.o -C link-arg=x64-rustcoverage/obj/sdk/lib/syslog/cpp/cpp.macros.cc.o -C link-arg=x64-rustcoverage/obj/out/core.x64-rustcoverage/fidling/gen/sdk/fidl/fuchsia.diagnostics.stream/fuchsia.diagnostics.stream/hlcpp/fuchsia/diagnostics/stream/cpp/fuchsia.diagnostics.stream_hlcpp.fidl.cc.o -C link-arg=x64-rustcoverage/obj/out/core.x64-rustcoverage/fidling/gen/sdk/fidl/fuchsia.diagnostics.stream/fuchsia.diagnostics.stream_tables.fuchsia.diagnostics.stream.fidl.tables.c.o -C link-arg=x64-rustcoverage/obj/out/core.x64-rustcoverage/fidling/gen/sdk/fidl/fuchsia.diagnostics/fuchsia.diagnostics/hlcpp/fuchsia/diagnostics/cpp/fuchsia.diagnostics_hlcpp.fidl.cc.o -C link-arg=x64-rustcoverage/obj/out/core.x64-rustcoverage/fidling/gen/sdk/fidl/fuchsia.diagnostics/fuchsia.diagnostics_tables.fuchsia.diagnostics.fidl.tables.c.o -C link-arg=x64-rustcoverage/obj/out/core.x64-rustcoverage/fidling/gen/sdk/fidl/fuchsia.mem/fuchsia.mem/hlcpp/fuchsia/mem/cpp/fuchsia.mem_hlcpp.fidl.cc.o -C link-arg=x64-rustcoverage/obj/out/core.x64-rustcoverage/fidling/gen/sdk/fidl/fuchsia.mem/fuchsia.mem_tables.fuchsia.mem.fidl.tables.c.o -C link-arg=x64-rustcoverage/obj/out/core.x64-rustcoverage/fidling/gen/zircon/vdso/zx/zx/hlcpp/zx/cpp/zx_hlcpp.fidl.cc.o -C link-arg=x64-rustcoverage/obj/out/core.x64-rustcoverage/fidling/gen/zircon/vdso/zx/zx_tables.zx.fidl.tables.c.o -C link-arg=x64-rustcoverage/obj/sdk/lib/fidl/cpp/internal/cpp.message_handler.cc.o -C link-arg=x64-rustcoverage/obj/sdk/lib/fidl/cpp/internal/cpp.message_reader.cc.o -C link-arg=x64-rustcoverage/obj/sdk/lib/fidl/cpp/internal/cpp.pending_response.cc.o -C link-arg=x64-rustcoverage/obj/sdk/lib/fidl/cpp/internal/cpp.proxy.cc.o -C link-arg=x64-rustcoverage/obj/sdk/lib/fidl/cpp/internal/cpp.proxy_controller.cc.o -C link-arg=x64-rustcoverage/obj/sdk/lib/fidl/cpp/internal/cpp.stub.cc.o -C link-arg=x64-rustcoverage/obj/sdk/lib/fidl/cpp/internal/cpp.stub_controller.cc.o -C link-arg=x64-rustcoverage/obj/sdk/lib/fidl/cpp/internal/cpp.weak_stub_controller.cc.o -C link-arg=x64-rustcoverage/obj/sdk/lib/fidl/cpp/internal/cpp_sync.logging.cc.o -C link-arg=x64-rustcoverage/obj/sdk/lib/fidl/cpp/internal/cpp_sync.message_sender.cc.o -C link-arg=x64-rustcoverage/obj/sdk/lib/fidl/cpp/internal/cpp_sync.synchronous_proxy.cc.o -C link-arg=x64-rustcoverage/obj/sdk/lib/fidl/cpp/cpp_base.builder.cc.o -C link-arg=x64-rustcoverage/obj/sdk/lib/fidl/cpp/cpp_base.clone.cc.o -C link-arg=x64-rustcoverage/obj/sdk/lib/fidl/cpp/cpp_base.decoder.cc.o -C link-arg=x64-rustcoverage/obj/sdk/lib/fidl/cpp/cpp_base.encoder.cc.o -C link-arg=x64-rustcoverage/obj/sdk/lib/fidl/cpp/cpp_base.message.cc.o -C link-arg=x64-rustcoverage/obj/sdk/lib/fidl/cpp/cpp_base.message_buffer.cc.o -C link-arg=x64-rustcoverage/obj/sdk/lib/fidl/cpp/cpp_base.message_builder.cc.o -C link-arg=x64-rustcoverage/obj/out/core.x64-rustcoverage/fidling/gen/sdk/fidl/fuchsia.logger/fuchsia.logger/hlcpp/fuchsia/logger/cpp/fuchsia.logger_hlcpp.fidl.cc.o -C link-arg=x64-rustcoverage/obj/out/core.x64-rustcoverage/fidling/gen/sdk/fidl/fuchsia.logger/fuchsia.logger_tables.fuchsia.logger.fidl.tables.c.o -C link-arg=x64-rustcoverage/obj/sdk/lib/syslog/streams/cpp/streams-encoder.encode.cc.o -C link-arg=user.libc_x64-rustcoverage/obj/zircon/system/ulib/c/crt1.Scrt1.cc.o -C link-arg=x64-rustcoverage/obj/sdk/lib/syslog/cpp/libbackend_fuchsia_lib_rust.a -C link-arg=x64-rustcoverage-shared/lib.unstripped/libbackend_fuchsia_globals.so -C link-arg=x64-rustcoverage/obj/sdk/lib/fit/libfit.a -C link-arg=x64-rustcoverage/obj/sdk/lib/stdcompat/libstdcompat.a -C link-arg=x64-rustcoverage/obj/zircon/system/ulib/fidl/libfidl_base.a -C link-arg=x64-rustcoverage/obj/sdk/lib/fit-promise/libfit-promise.a -C link-arg=x64-rustcoverage/obj/zircon/system/ulib/fidl/libfidl.a -C link-arg=x64-rustcoverage/obj/zircon/system/ulib/zx/libzx.a -C link-arg=x64-rustcoverage/obj/zircon/system/ulib/async/libasync.a -C link-arg=x64-rustcoverage-shared/lib.unstripped/libasync-default.so -C link-arg=x64-rustcoverage-shared/lib.unstripped/libfdio.so -C link-arg=x64-rustcoverage-shared/lib.unstripped/libsyslog.so -C link-arg=user.libc_x64-rustcoverage/libc.so.debug -C link-arg=x64-rustcoverage/libzircon.so --crate-type bin

query stack during panic:
#0 [optimized_mir] optimizing MIR for `main::func::{closure#0}` [optimized_mir]
#1 [layout_raw] computing layout of `[static main::func::{closure#0} upvar_tys=() for<'r, 's, 't0, 't1, 't2, 't3, 't4, 't5> {std::future::ResumeTy, fuchsia_component::server::ServiceFs<fuchsia_component::server::ServiceObjLocal<ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrNamed('r) }), fidl_fuchsia_ui_brightness::ControlRequestStream>>, std::future::from_generator::GenFuture<[static backlight::<impl at ../../src/ui/bin/brightness_manager/src/backlight.rs:29:1: 64:2>::new::{closure#0} upvar_tys=() {}]>, (), backlight::Backlight, std::sync::Arc<futures::lock::Mutex<backlight::Backlight>>, std::future::from_generator::GenFuture<[static sensor::<impl at ../../src/ui/bin/brightness_manager/src/sensor.rs:96:1: 115:2>::new::{closure#0} upvar_tys=() {std::future::ResumeTy, std::future::from_generator::GenFuture<[static sensor::open_sensor::{closure#0} upvar_tys=() for<'t6, 't7, 't8> {std::future::ResumeTy, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrNamed('t6) }) str, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrNamed('t7) }) std::path::Path, std::fs::ReadDir, std::result::Result<std::fs::DirEntry, std::io::Error>, std::fs::DirEntry, fidl_fuchsia_hardware_input::DeviceProxy, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 2, kind: BrNamed('t8) }) fidl_fuchsia_hardware_input::DeviceProxy, fidl::client::QueryResponseFut<std::vec::Vec<u8>>, ()}]>, ()}]>, sensor::Sensor, std::sync::Arc<futures::lock::Mutex<sensor::Sensor>>, sender_channel::SenderChannel<f32>, std::sync::Arc<futures::lock::Mutex<sender_channel::SenderChannel<f32>>>, sender_channel::SenderChannel<bool>, std::sync::Arc<futures::lock::Mutex<sender_channel::SenderChannel<bool>>>, std::sync::Arc<futures::lock::Mutex<(dyn sensor::SensorControl + ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrNamed('s) }))>>, std::sync::Arc<futures::lock::Mutex<(dyn backlight::BacklightControl + ReLateBound(DebruijnIndex(0), BoundRegion { var: 2, kind: BrNamed('t0) }))>>, std::future::from_generator::GenFuture<[static control::<impl at ../../src/ui/bin/brightness_manager/src/control.rs:154:1: 495:2>::new::{closure#0} upvar_tys=(std::sync::Arc<futures::lock::Mutex<(dyn sensor::SensorControl + ReErased)>>, std::sync::Arc<futures::lock::Mutex<(dyn backlight::BacklightControl + ReErased)>>, std::sync::Arc<futures::lock::Mutex<sender_channel::SenderChannel<f32>>>, std::sync::Arc<futures::lock::Mutex<sender_channel::SenderChannel<bool>>>, std::sync::Arc<futures::lock::Mutex<sender_channel::SenderChannel<f32>>>) for<'t6, 't7, 't8, 't9> {std::future::ResumeTy, std::sync::Arc<futures::lock::Mutex<(dyn sensor::SensorControl + ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrNamed('t6) }))>>, std::sync::Arc<futures::lock::Mutex<(dyn backlight::BacklightControl + ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrNamed('t7) }))>>, std::sync::Arc<futures::lock::Mutex<sender_channel::SenderChannel<f32>>>, std::sync::Arc<futures::lock::Mutex<sender_channel::SenderChannel<bool>>>, std::sync::Arc<futures::lock::Mutex<std::option::Option<futures::future::AbortHandle>>>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 2, kind: BrNamed('t8) }) futures::lock::Mutex<control::BrightnessTable>, control::BRIGHTNESS_TABLE, futures::lock::MutexLockFuture<ReLateBound(DebruijnIndex(0), BoundRegion { var: 3, kind: BrNamed('t9) }), control::BrightnessTable>, ()}]>, control::Control, std::sync::Arc<futures::lock::Mutex<control::Control>>, fn(fidl_fuchsia_ui_brightness::ControlRequestStream, std::sync::Arc<futures::lock::Mutex<(dyn control::ControlTrait + ReLateBound(DebruijnIndex(1), BoundRegion { var: 3, kind: BrNamed('t1) }))>>) -> std::pin::Pin<std::boxed::Box<(dyn futures::Future<Output = std::result::Result<(), anyhow::Error>> + ReLateBound(DebruijnIndex(1), BoundRegion { var: 4, kind: BrNamed('t2) }))>>, std::sync::Arc<futures::lock::Mutex<(dyn control::ControlTrait + ReLateBound(DebruijnIndex(0), BoundRegion { var: 5, kind: BrNamed('t3) }))>>, Opaque(DefId(0:456 ~ brightness_manager[317d]::run_brightness_service::{opaque#0}), [fn(fidl_fuchsia_ui_brightness::ControlRequestStream, std::sync::Arc<futures::lock::Mutex<(dyn control::ControlTrait + ReLateBound(DebruijnIndex(1), BoundRegion { var: 6, kind: BrNamed('t4) }))>>) -> std::pin::Pin<std::boxed::Box<(dyn futures::Future<Output = std::result::Result<(), anyhow::Error>> + ReLateBound(DebruijnIndex(1), BoundRegion { var: 7, kind: BrNamed('t5) }))>>])}]` [layout_raw]
#2 [layout_raw] computing layout of `std::future::from_generator::GenFuture<[static main::func::{closure#0} upvar_tys=() for<'r, 's, 't0, 't1, 't2, 't3, 't4, 't5> {std::future::ResumeTy, fuchsia_component::server::ServiceFs<fuchsia_component::server::ServiceObjLocal<ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrNamed('r) }), fidl_fuchsia_ui_brightness::ControlRequestStream>>, std::future::from_generator::GenFuture<[static backlight::<impl at ../../src/ui/bin/brightness_manager/src/backlight.rs:29:1: 64:2>::new::{closure#0} upvar_tys=() {}]>, (), backlight::Backlight, std::sync::Arc<futures::lock::Mutex<backlight::Backlight>>, std::future::from_generator::GenFuture<[static sensor::<impl at ../../src/ui/bin/brightness_manager/src/sensor.rs:96:1: 115:2>::new::{closure#0} upvar_tys=() {std::future::ResumeTy, std::future::from_generator::GenFuture<[static sensor::open_sensor::{closure#0} upvar_tys=() for<'t6, 't7, 't8> {std::future::ResumeTy, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrNamed('t6) }) str, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrNamed('t7) }) std::path::Path, std::fs::ReadDir, std::result::Result<std::fs::DirEntry, std::io::Error>, std::fs::DirEntry, fidl_fuchsia_hardware_input::DeviceProxy, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 2, kind: BrNamed('t8) }) fidl_fuchsia_hardware_input::DeviceProxy, fidl::client::QueryResponseFut<std::vec::Vec<u8>>, ()}]>, ()}]>, sensor::Sensor, std::sync::Arc<futures::lock::Mutex<sensor::Sensor>>, sender_channel::SenderChannel<f32>, std::sync::Arc<futures::lock::Mutex<sender_channel::SenderChannel<f32>>>, sender_channel::SenderChannel<bool>, std::sync::Arc<futures::lock::Mutex<sender_channel::SenderChannel<bool>>>, std::sync::Arc<futures::lock::Mutex<(dyn sensor::SensorControl + ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrNamed('s) }))>>, std::sync::Arc<futures::lock::Mutex<(dyn backlight::BacklightControl + ReLateBound(DebruijnIndex(0), BoundRegion { var: 2, kind: BrNamed('t0) }))>>, std::future::from_generator::GenFuture<[static control::<impl at ../../src/ui/bin/brightness_manager/src/control.rs:154:1: 495:2>::new::{closure#0} upvar_tys=(std::sync::Arc<futures::lock::Mutex<(dyn sensor::SensorControl + ReErased)>>, std::sync::Arc<futures::lock::Mutex<(dyn backlight::BacklightControl + ReErased)>>, std::sync::Arc<futures::lock::Mutex<sender_channel::SenderChannel<f32>>>, std::sync::Arc<futures::lock::Mutex<sender_channel::SenderChannel<bool>>>, std::sync::Arc<futures::lock::Mutex<sender_channel::SenderChannel<f32>>>) for<'t6, 't7, 't8, 't9> {std::future::ResumeTy, std::sync::Arc<futures::lock::Mutex<(dyn sensor::SensorControl + ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrNamed('t6) }))>>, std::sync::Arc<futures::lock::Mutex<(dyn backlight::BacklightControl + ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrNamed('t7) }))>>, std::sync::Arc<futures::lock::Mutex<sender_channel::SenderChannel<f32>>>, std::sync::Arc<futures::lock::Mutex<sender_channel::SenderChannel<bool>>>, std::sync::Arc<futures::lock::Mutex<std::option::Option<futures::future::AbortHandle>>>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 2, kind: BrNamed('t8) }) futures::lock::Mutex<control::BrightnessTable>, control::BRIGHTNESS_TABLE, futures::lock::MutexLockFuture<ReLateBound(DebruijnIndex(0), BoundRegion { var: 3, kind: BrNamed('t9) }), control::BrightnessTable>, ()}]>, control::Control, std::sync::Arc<futures::lock::Mutex<control::Control>>, fn(fidl_fuchsia_ui_brightness::ControlRequestStream, std::sync::Arc<futures::lock::Mutex<(dyn control::ControlTrait + ReLateBound(DebruijnIndex(1), BoundRegion { var: 3, kind: BrNamed('t1) }))>>) -> std::pin::Pin<std::boxed::Box<(dyn futures::Future<Output = std::result::Result<(), anyhow::Error>> + ReLateBound(DebruijnIndex(1), BoundRegion { var: 4, kind: BrNamed('t2) }))>>, std::sync::Arc<futures::lock::Mutex<(dyn control::ControlTrait + ReLateBound(DebruijnIndex(0), BoundRegion { var: 5, kind: BrNamed('t3) }))>>, Opaque(DefId(0:456 ~ brightness_manager[317d]::run_brightness_service::{opaque#0}), [fn(fidl_fuchsia_ui_brightness::ControlRequestStream, std::sync::Arc<futures::lock::Mutex<(dyn control::ControlTrait + ReLateBound(DebruijnIndex(1), BoundRegion { var: 6, kind: BrNamed('t4) }))>>) -> std::pin::Pin<std::boxed::Box<(dyn futures::Future<Output = std::result::Result<(), anyhow::Error>> + ReLateBound(DebruijnIndex(1), BoundRegion { var: 7, kind: BrNamed('t5) }))>>])}]>` [layout_raw]
#3 [optimized_mir] optimizing MIR for `main` [optimized_mir]
#4 [collect_and_partition_mono_items] collect_and_partition_mono_items [collect_and_partition_mono_items]
end of query stack
error: aborting due to previous error

@tmandry
Copy link
Member

tmandry commented Apr 6, 2021

The type in that error looks to be the case that @jackh726 was talking about: (note that 'r is not used)

for<'r> fn(fidl_fuchsia_ui_brightness::ControlRequestStream, std::sync::Arc<futures::lock::Mutex<(dyn control::ControlTrait + ReErased)>>) -> std::pin::Pin<std::boxed::Box<(dyn futures::Future<Output = std::result::Result<(), anyhow::Error>> + ReErased)>>

@tmandry
Copy link
Member

tmandry commented Apr 7, 2021

Found the code that was triggering this here. A closure was being coerced to a function pointer in an async fn. The unused for<'r> came out of that coercion somehow. Removing the type attribution on that binding fixed the ICE.

   let run_server: fn(
        stream: ControlRequestStream,
        control: Arc<Mutex<dyn ControlTrait>>,
    ) -> Pin<Box<dyn Future<Output = Result<(), Error>>>> =
        |stream, control| Box::pin(run_brightness_server(stream, control));

@richkadel
Copy link
Contributor

@jackh726 Based on our findings (as reported in the previous comment by @tmandry ) we hope this is the only case, or if there are others, we'll try the same workaround.

But we do need this fix to address the coverage issue, and I assume it also unblocks Tide.

@jackh726
Copy link
Member Author

jackh726 commented Apr 7, 2021

Okay, so interesting that a second issue popped up that this solves. Also have to think a bit about that annotation; I wonder if there's another bug lurking where the type annotation itself is getting an extra anon binder. Will look into it, but it's good removing it helps.

Just waiting for @nikomatsakis to review. I think he might have time tomorrow.

@nikomatsakis
Copy link
Contributor

So @jackh726 and I talked about this. r=me on this PR but I still think the code is not right, as we discussed on Zulip.

@jackh726
Copy link
Member Author

jackh726 commented Apr 8, 2021

@bors r=nikomatsakis

@bors
Copy link
Contributor

bors commented Apr 8, 2021

📌 Commit c1dc0b7 has been approved by nikomatsakis

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 8, 2021
@bors
Copy link
Contributor

bors commented Apr 9, 2021

⌛ Testing commit c1dc0b7 with merge cd56e25...

@bors
Copy link
Contributor

bors commented Apr 9, 2021

☀️ Test successful - checks-actions
Approved by: nikomatsakis
Pushing cd56e25 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Apr 9, 2021
@bors bors merged commit cd56e25 into rust-lang:master Apr 9, 2021
@rustbot rustbot added this to the 1.53.0 milestone Apr 9, 2021
@Fishrock123
Copy link
Contributor

To confirm, this fixed the Tide docs compile error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. WG-traits Working group: Traits, https://internals.rust-lang.org/t/announcing-traits-working-group/6804
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants