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. --With a procmacro, an ICE occurs when generating an block (whether for a trait or not) that has an associated type that looks like this: The type needs to be a valid (in scope) type that takes a generic parameter, with a trait/lifetime bound. Both the generic parameter and the trait/lifetime bound don't actually need to be in scope - just syntactically valid. I only found this after a typo ( instead of ); this code shouldn't compile without the ICE anyway - the trait/lifetime bound is on a concrete type. As a result, I cannot foresee a situation where valid code that should compile would fail to compile as a result of this ICE. <!-- 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. --Occurs on latest stable, beta and nightly versions. : I have also tested this on a host running , and the ICE also occurs on that machine as well. <!-- Include a backtrace in the code block by setting in your environment. E.g. . --<details<summary<strongBacktrace</strong</summary<p</p</details
Assigning and removing .

Discussion:
} } <ins> let is_macro = base_span.from_expansion() && base_span.desugaring_kind().is_none(); </ins> if !self.type_ascription_suggestion(&mut err, base_span) { let mut fallback = false; if let ( PathSource::Trait(AliasPossibility::Maybe), Some(Res::Def(DefKind::Struct | DefKind::Enum | DefKind::Union, _)), <del> ) = (source, res) </del> <ins> false, ) = (source, res, is_macro) </ins> { if let Some(bounds @ [_, .., _]) = self.diagnostic_metadata.current_trait_object { fallback = true;

<ins> // force-host // no-prefer-dynamic #![crate_type = "proc-macro"] extern crate proc_macro; use proc_macro::TokenStream; #[proc_macro] pub fn dance_like_you_want_to_ice(_: TokenStream) -> TokenStream { r#" impl Foo { type Bar = Box<()> + Baz; } "# .parse() .unwrap() } </ins>

<ins> // aux-build: issue-83510.rs extern crate issue_83510; issue_83510::dance_like_you_want_to_ice!(); //~^ ERROR: cannot find type `Foo` in this scope //~| ERROR: expected trait, found struct `Box` //~| ERROR: cannot find trait `Baz` in this scope //~| ERROR: inherent associated types are unstable fn main() {} </ins>

<ins> error[E0412]: cannot find type `Foo` in this scope --> $DIR/issue-83510.rs:5:1 | LL | issue_83510::dance_like_you_want_to_ice!(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not found in this scope | = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) error[E0404]: expected trait, found struct `Box` --> $DIR/issue-83510.rs:5:1 | LL | issue_83510::dance_like_you_want_to_ice!(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not a trait | = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) error[E0405]: cannot find trait `Baz` in this scope --> $DIR/issue-83510.rs:5:1 | LL | issue_83510::dance_like_you_want_to_ice!(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not found in this scope | = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) error[E0658]: inherent associated types are unstable --> $DIR/issue-83510.rs:5:1 | LL | issue_83510::dance_like_you_want_to_ice!(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: see issue #8995 <https://github.com/rust-lang/rust/issues/8995> for more information = help: add `#![feature(inherent_associated_types)]` to the crate attributes to enable = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 4 previous errors Some errors have detailed explanations: E0404, E0405, E0412, E0658. For more information about an error, try `rustc --explain E0404`. </ins>