Change:
<!-- 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. --The rustc compiler panics for being unable to check the type of an object. In the example, it's shown in the form of returning an Option, and being unable to take Option as a parameter type. This would be the expected compilation error for that snippet of code, but instead of that, the compiler just panics. This error only occurs on asynchronous functions and in nightly. It also only happens when not compiling with --release, only in debug. <!-- 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. --: <!-- Include a backtrace in the code block by setting in your environment. E.g. . --<details<summary<strongBacktrace</strong</summary </p</details
cc (likely due to - )
I can see why that could cause it. I've also seen that could be caused due to a similar issue. If it's the same issue, this issue should be kept as it provides a smaller example to reproduce and extra information in reproducing.
oh, sorry, my bad, investigating.
Kind of strange, this ice only triggered with , won't ice. here is a mcve: ICE: no-ICE:

Discussion:
) )] #[doc(alias = "?")] <ins> #[cfg_attr(not(bootstrap), lang = "try")] </ins> pub trait Try { /// The type of this value when viewed as successful. #[unstable(feature = "try_trait", issue = "42327")]

AlignOffsetLangItem,         "align_offset",       align_offset_fn,         Target::Fn; TerminationTraitLangItem,    "termination",        termination,             Target::Trait; <ins> TryTraitLangItem,            "try",                try_trait,               Target::Trait; </ins> }

self.suggest_remove_reference(&obligation, &mut err, &trait_ref); self.suggest_semicolon_removal(&obligation, &mut err, span, &trait_ref); self.note_version_mismatch(&mut err, &trait_ref); <del> self.suggest_await_before_try(&mut err, &obligation, &trait_ref, span); </del> <ins> if Some(trait_ref.def_id()) == tcx.lang_items().try_trait() { self.suggest_await_before_try(&mut err, &obligation, &trait_ref, span); } </ins> if self.suggest_impl_trait(&mut err, span, &obligation, &trait_ref) { err.emit(); return;

<ins> // edition:2018 // compile-flags:-Cincremental=tmp/issue-72442 use std::fs::File; use std::future::Future; use std::io::prelude::*; fn main() -> Result<(), Box<dyn std::error::Error>> { block_on(async { { let path = std::path::Path::new("."); let mut f = File::open(path.to_str())?; //~^ ERROR the trait bound let mut src = String::new(); f.read_to_string(&mut src)?; Ok(()) } }) } fn block_on<F>(f: F) -> F::Output where F: Future<Output = Result<(), Box<dyn std::error::Error>>>, { Ok(()) } </ins>

<ins> error[E0277]: the trait bound `std::option::Option<&str>: std::convert::AsRef<std::path::Path>` is not satisfied --> $DIR/issue-72442.rs:12:36 | LL |             let mut f = File::open(path.to_str())?; |                                    ^^^^^^^^^^^^^ the trait `std::convert::AsRef<std::path::Path>` is not implemented for `std::option::Option<&str>` | ::: $SRC_DIR/libstd/fs.rs:LL:COL | LL |     pub fn open<P: AsRef<Path>>(path: P) -> io::Result<File> { |                    ----------- required by this bound in `std::fs::File::open` error: aborting due to previous error For more information about this error, try `rustc --explain E0277`. </ins>