Repository: rust
Issue: rustc error in fixed crate
Labels: I-ICE,T-compiler,C-bug,E-needs-mcve

<!--
Thank you for finding an Internal Compiler Error! 🧊  If possible, try to provide
a minimal verifiable example. You can read "Rust Bug Minimization Patterns" for
how to create smaller examples.
http://blog.pnkfx.org/blog/2019/11/18/rust-bug-minimization-patterns/
-->

### Code

This compilation error occurred while compiling crate 'fixed' v1.23.1. This is a dependency for a crate I would like to use, 'sgp40' which is an implementation of 'embedded-hal'. I am developing the program to run on an Arduino Uno.

Neither of these crates are used in the code as it was compiled, but nonetheless see the code below.

```
#![no_std]
#![no_main]

use core::panic::PanicInfo;

#[panic_handler]
fn panic(_info: &PanicInfo) -> ! {
    loop {}
}
#[arduino_hal::entry]
fn main() -> ! {
    let dp = arduino_hal::Peripherals::take().unwrap();
    let pins = arduino_hal::pins!(dp);
    let mut serial = arduino_hal::default_serial!(dp, pins, 57600);

    /*
     * For examples (and inspiration), head to
     *
     *     https://github.com/Rahix/avr-hal/tree/main/examples
     *
     * NOTE: Not all examples were ported to all boards!  There is a good chance though, that code
     * for a different board can be adapted for yours.  The Arduino Uno currently has the most
     * examples available.
     */

    let mut led = pins.d13.into_output();

    loop {
        ufmt::uwriteln!(&mut serial, "Hello from Arduino!\r").void_unwrap();
        led.toggle();
        arduino_hal::delay_ms(1000);
    }
}

```


### Meta
<!--
If you're using the stable version of the compiler, you should also check if the
bug also exists in the beta or nightly versions.
-->

`rustc --version --verbose`:
```
rustc 1.64.0-nightly (6dba4ed21 2022-07-09)
binary: rustc
commit-hash: 6dba4ed215e7a60f0a2a19c04f3f73691f89c509
commit-date: 2022-07-09
host: x86_64-unknown-linux-gnu
release: 1.64.0-nightly
LLVM version: 14.0.6
```

### Error output
 
There is no error output beyond the backtrace below.


<!--
Include a backtrace in the code block by setting `RUST_BACKTRACE=1` in your
environment. E.g. `RUST_BACKTRACE=1 cargo build`.
-->
<details><summary><strong>Backtrace</strong></summary>
<p>

```
  Compiling fixed v1.23.1
thread 'rustc' panicked at 'region_obligations not empty: [
    RegionObligation(sub_region=ReStatic, sup_type=Frac),
]', compiler/rustc_infer/src/infer/mod.rs:1275:13
stack backtrace:
   0:     0x7fec14ca1d10 - std::backtrace_rs::backtrace::libunwind::trace::hb53aac3d336d1fad
                               at /rustc/6dba4ed215e7a60f0a2a19c04f3f73691f89c509/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   1:     0x7fec14ca1d10 - std::backtrace_rs::backtrace::trace_unsynchronized::h2b89c60e39223848
                               at /rustc/6dba4ed215e7a60f0a2a19c04f3f73691f89c509/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7fec14ca1d10 - std::sys_common::backtrace::_print_fmt::ha83d8c3b142603a7
                               at /rustc/6dba4ed215e7a60f0a2a19c04f3f73691f89c509/library/std/src/sys_common/backtrace.rs:66:5
   3:     0x7fec14ca1d10 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h7edd48b34363f851
                               at /rustc/6dba4ed215e7a60f0a2a19c04f3f73691f89c509/library/std/src/sys_common/backtrace.rs:45:22
   4:     0x7fec14cfa9cc - core::fmt::write::h9c8e13f530df256d
                               at /rustc/6dba4ed215e7a60f0a2a19c04f3f73691f89c509/library/core/src/fmt/mod.rs:1198:17
   5:     0x7fec14c93495 - std::io::Write::write_fmt::h8a84ef622e30c946
                               at /rustc/6dba4ed215e7a60f0a2a19c04f3f73691f89c509/library/std/src/io/mod.rs:1672:15
   6:     0x7fec14ca4901 - std::sys_common::backtrace::_print::hc6d8f40c8d4cddc5
                               at /rustc/6dba4ed215e7a60f0a2a19c04f3f73691f89c509/library/std/src/sys_common/backtrace.rs:48:5
   7:     0x7fec14ca4901 - std::sys_common::backtrace::print::hfa3ab1eae32513ba
                               at /rustc/6dba4ed215e7a60f0a2a19c04f3f73691f89c509/library/std/src/sys_common/backtrace.rs:35:9
   8:     0x7fec14ca4901 - std::panicking::default_hook::{{closure}}::h29642d56aa1e0456
                               at /rustc/6dba4ed215e7a60f0a2a19c04f3f73691f89c509/library/std/src/panicking.rs:295:22
   9:     0x7fec14ca45d3 - std::panicking::default_hook::h19e1d1b7254ba904
                               at /rustc/6dba4ed215e7a60f0a2a19c04f3f73691f89c509/library/std/src/panicking.rs:314:9
  10:     0x7fec15548ef4 - rustc_driver[616ada5c32451fbf]::DEFAULT_HOOK::{closure#0}::{closure#0}
  11:     0x7fec14ca50d6 - std::panicking::rust_panic_with_hook::h68361a65be4499f2
                               at /rustc/6dba4ed215e7a60f0a2a19c04f3f73691f89c509/library/std/src/panicking.rs:702:17
  12:     0x7fec14ca4f27 - std::panicking::begin_panic_handler::{{closure}}::hc0bea9f2f298a257
                               at /rustc/6dba4ed215e7a60f0a2a19c04f3f73691f89c509/library/std/src/panicking.rs:588:13
  13:     0x7fec14ca21e4 - std::sys_common::backtrace::__rust_end_short_backtrace::hacf2708e3da81420
                               at /rustc/6dba4ed215e7a60f0a2a19c04f3f73691f89c509/library/std/src/sys_common/backtrace.rs:138:18
  14:     0x7fec14ca4c52 - rust_begin_unwind
                               at /rustc/6dba4ed215e7a60f0a2a19c04f3f73691f89c509/library/std/src/panicking.rs:584:5
  15:     0x7fec14c69ab3 - core::panicking::panic_fmt::hb17eb509c1ccdbd0
                               at /rustc/6dba4ed215e7a60f0a2a19c04f3f73691f89c509/library/core/src/panicking.rs:142:14
  16:     0x7fec174815d3 - <rustc_infer[fbf1ea830413c938]::infer::InferCtxt>::resolve_regions_and_report_errors
  17:     0x7fec1799dc68 - <rustc_infer[fbf1ea830413c938]::infer::InferCtxtBuilder>::enter::<(), rustc_typeck[39ed81b2b252dd86]::check::compare_method::compare_const_impl::{closure#0}>
  18:     0x7fec16af3d65 - rustc_typeck[39ed81b2b252dd86]::check::check::check_item_type
  19:     0x7fec16afc14e - rustc_typeck[39ed81b2b252dd86]::check::check::check_mod_item_types
  20:     0x7fec170c935b - rustc_query_system[c883115ac686e7d2]::query::plumbing::try_execute_query::<rustc_query_impl[40bfb61a2c99054a]::plumbing::QueryCtxt, rustc_query_system[c883115ac686e7d2]::query::caches::DefaultCache<rustc_span[da4f9274250b4d15]::def_id::LocalDefId, ()>>
  21:     0x7fec17c7fba3 - rustc_query_system[c883115ac686e7d2]::query::plumbing::get_query::<rustc_query_impl[40bfb61a2c99054a]::queries::check_mod_item_types, rustc_query_impl[40bfb61a2c99054a]::plumbing::QueryCtxt>
  22:     0x7fec179ab52f - <rustc_middle[c2682fd3d21511ad]::hir::map::Map>::for_each_module::<rustc_typeck[39ed81b2b252dd86]::check_crate::{closure#6}::{closure#0}>
  23:     0x7fec179bd5cd - rustc_typeck[39ed81b2b252dd86]::check_crate
  24:     0x7fec176ef487 - rustc_interface[a1b86a5a47c76e01]::passes::analysis
  25:     0x7fec17c3fdb5 - rustc_query_system[c883115ac686e7d2]::query::plumbing::try_execute_query::<rustc_query_impl[40bfb61a2c99054a]::plumbing::QueryCtxt, rustc_query_system[c883115ac686e7d2]::query::caches::DefaultCache<(), core[a5f99d2df8cc51f6]::result::Result<(), rustc_errors[479781eff26fab26]::ErrorGuaranteed>>>
  26:     0x7fec17c9e65e - rustc_query_system[c883115ac686e7d2]::query::plumbing::get_query::<rustc_query_impl[40bfb61a2c99054a]::queries::analysis, rustc_query_impl[40bfb61a2c99054a]::plumbing::QueryCtxt>
  27:     0x7fec176d34ce - <rustc_interface[a1b86a5a47c76e01]::passes::QueryContext>::enter::<rustc_driver[616ada5c32451fbf]::run_compiler::{closure#1}::{closure#2}::{closure#3}, core[a5f99d2df8cc51f6]::result::Result<(), rustc_errors[479781eff26fab26]::ErrorGuaranteed>>
  28:     0x7fec176b860e - <rustc_interface[a1b86a5a47c76e01]::interface::Compiler>::enter::<rustc_driver[616ada5c32451fbf]::run_compiler::{closure#1}::{closure#2}, core[a5f99d2df8cc51f6]::result::Result<core[a5f99d2df8cc51f6]::option::Option<rustc_interface[a1b86a5a47c76e01]::queries::Linker>, rustc_errors[479781eff26fab26]::ErrorGuaranteed>>
  29:     0x7fec176b47df - rustc_span[da4f9274250b4d15]::with_source_map::<core[a5f99d2df8cc51f6]::result::Result<(), rustc_errors[479781eff26fab26]::ErrorGuaranteed>, rustc_interface[a1b86a5a47c76e01]::interface::create_compiler_and_run<core[a5f99d2df8cc51f6]::result::Result<(), rustc_errors[479781eff26fab26]::ErrorGuaranteed>, rustc_driver[616ada5c32451fbf]::run_compiler::{closure#1}>::{closure#1}>
  30:     0x7fec176b93c2 - rustc_interface[a1b86a5a47c76e01]::interface::create_compiler_and_run::<core[a5f99d2df8cc51f6]::result::Result<(), rustc_errors[479781eff26fab26]::ErrorGuaranteed>, rustc_driver[616ada5c32451fbf]::run_compiler::{closure#1}>
  31:     0x7fec176e2e32 - <scoped_tls[96925c77913c8c23]::ScopedKey<rustc_span[da4f9274250b4d15]::SessionGlobals>>::set::<rustc_interface[a1b86a5a47c76e01]::interface::run_compiler<core[a5f99d2df8cc51f6]::result::Result<(), rustc_errors[479781eff26fab26]::ErrorGuaranteed>, rustc_driver[616ada5c32451fbf]::run_compiler::{closure#1}>::{closure#0}, core[a5f99d2df8cc51f6]::result::Result<(), rustc_errors[479781eff26fab26]::ErrorGuaranteed>>
  32:     0x7fec176b6d0f - std[26f91124698ed936]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[a1b86a5a47c76e01]::util::run_in_thread_pool_with_globals<rustc_interface[a1b86a5a47c76e01]::interface::run_compiler<core[a5f99d2df8cc51f6]::result::Result<(), rustc_errors[479781eff26fab26]::ErrorGuaranteed>, rustc_driver[616ada5c32451fbf]::run_compiler::{closure#1}>::{closure#0}, core[a5f99d2df8cc51f6]::result::Result<(), rustc_errors[479781eff26fab26]::ErrorGuaranteed>>::{closure#0}, core[a5f99d2df8cc51f6]::result::Result<(), rustc_errors[479781eff26fab26]::ErrorGuaranteed>>
  33:     0x7fec176cfcd9 - <<std[26f91124698ed936]::thread::Builder>::spawn_unchecked_<rustc_interface[a1b86a5a47c76e01]::util::run_in_thread_pool_with_globals<rustc_interface[a1b86a5a47c76e01]::interface::run_compiler<core[a5f99d2df8cc51f6]::result::Result<(), rustc_errors[479781eff26fab26]::ErrorGuaranteed>, rustc_driver[616ada5c32451fbf]::run_compiler::{closure#1}>::{closure#0}, core[a5f99d2df8cc51f6]::result::Result<(), rustc_errors[479781eff26fab26]::ErrorGuaranteed>>::{closure#0}, core[a5f99d2df8cc51f6]::result::Result<(), rustc_errors[479781eff26fab26]::ErrorGuaranteed>>::{closure#1} as core[a5f99d2df8cc51f6]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  34:     0x7fec14caea33 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h15443ab208d0c585
                               at /rustc/6dba4ed215e7a60f0a2a19c04f3f73691f89c509/library/alloc/src/boxed.rs:1934:9
  35:     0x7fec14caea33 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hcbe0c49ed8c2ce6e
                               at /rustc/6dba4ed215e7a60f0a2a19c04f3f73691f89c509/library/alloc/src/boxed.rs:1934:9
  36:     0x7fec14caea33 - std::sys::unix::thread::Thread::new::thread_start::h5319e90905b6efc8
                               at /rustc/6dba4ed215e7a60f0a2a19c04f3f73691f89c509/library/std/src/sys/unix/thread.rs:108:17
  37:     0x7fec14a6cb43 - start_thread
                               at ./nptl/./nptl/pthread_create.c:442:8
  38:     0x7fec14afea00 - clone3
                               at ./misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
  39:                0x0 - <unknown>

error: internal compiler error: unexpected panic

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.64.0-nightly (6dba4ed21 2022-07-09) running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type lib -C opt-level=s -C panic=abort -C linker-plugin-lto -C debuginfo=2 -C debug-assertions=on -Z unstable-options

note: some of the compiler flags provided by cargo are hidden
```

</p>
</details>