Skip to content

use eii for bug! macro - #161873

Open
mejrs wants to merge 4 commits into
rust-lang:mainfrom
mejrs:bug
Open

use eii for bug! macro#161873
mejrs wants to merge 4 commits into
rust-lang:mainfrom
mejrs:bug

Conversation

@mejrs

@mejrs mejrs commented Aug 27, 2026

Copy link
Copy Markdown
Member

This allows it to be used without depending on rustc_middle.

r? @jdonszelmann @bjorn3

@rustbot

rustbot commented Aug 27, 2026

Copy link
Copy Markdown
Collaborator

Some changes occurred to the CTFE machinery

cc @RalfJung, @oli-obk, @lcnr

changes to the core type system

cc @lcnr

Some changes occurred to MIR optimizations

cc @rust-lang/wg-mir-opt

Some changes occurred to constck

cc @fee1-dead

Some changes occurred in coverage instrumentation.

cc @Zalathar

changes to the core type system

cc @lcnr

Some changes occurred in compiler/rustc_codegen_llvm/src/llvm/enzyme_ffi.rs

cc @ZuseZ4

Some changes occurred in compiler/rustc_codegen_llvm/src/builder/autodiff.rs

cc @ZuseZ4

Some changes occurred to the CTFE / Miri interpreter

cc @rust-lang/miri, @RalfJung, @oli-obk, @lcnr

Some changes occurred in match checking

cc @Nadrieril

Some changes occurred in match lowering

cc @Nadrieril

rustc_codegen_gcc is developed in its own repository. If possible, consider making this change to rust-lang/rustc_codegen_gcc instead.

cc @antoyo, @GuillaumeGomez

Some changes occurred to the CTFE / Miri interpreter

cc @rust-lang/miri

HIR ty lowering was modified

cc @fmease

@rustbot rustbot added the A-attributes Area: Attributes (`#[…]`, `#![…]`) label Aug 27, 2026
@rustbot rustbot added A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. F-autodiff `#![feature(autodiff)]` S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Aug 27, 2026
@rustbot

rustbot commented Aug 27, 2026

Copy link
Copy Markdown
Collaborator

jdonszelmann is currently at their maximum review capacity.
They may take a while to respond.

@GuillaumeGomez

Copy link
Copy Markdown
Member

Neat. :)

@rust-log-analyzer

Copy link
Copy Markdown
Collaborator

The job pr-check-2 failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)

error: cannot find macro `bug` in this scope
   --> compiler/rustc_codegen_cranelift/src/base.rs:705:34
    |
705 | ...                   _ => bug!("Unexpected `PtrToMetadata` operand: {operand:?}"),
    |                            ^^^
    |
help: consider importing this macro
    |
  3 + use rustc_span::bug;
    |

error: cannot find macro `bug` in this scope
   --> compiler/rustc_codegen_cranelift/src/base.rs:731:30
    |
731 |                         _ => bug!("Trying to ReifyFnPointer on non FnDef {:?}", from_ty),
    |                              ^^^
    |
help: consider importing this macro
    |
  3 + use rustc_span::bug;
    |

error: cannot find macro `bug` in this scope
   --> compiler/rustc_codegen_cranelift/src/base.rs:819:30
    |
819 |                         _ => bug!("{} cannot be cast to a fn ptr", operand.layout().ty),
    |                              ^^^
    |
help: consider importing this macro
    |
  3 + use rustc_span::bug;
    |

error: cannot find macro `bug` in this scope
   --> compiler/rustc_codegen_cranelift/src/base.rs:927:44
    |
927 |                 Rvalue::CopyForDeref(_) => bug!("`CopyForDeref` in codegen"),
    |                                            ^^^
    |
help: consider importing this macro
    |
  3 + use rustc_span::bug;
---

error: cannot find macro `bug` in this scope
   --> compiler/rustc_codegen_cranelift/src/base.rs:985:14
    |
985 |         _ => bug!("Rvalue::Len({:?})", place),
    |              ^^^
    |
help: consider importing this macro
    |
  3 + use rustc_span::bug;
    |

error: cannot find macro `bug` in this scope
    --> compiler/rustc_codegen_cranelift/src/base.rs:1000:42
     |
1000 |             PlaceElem::OpaqueCast(ty) => bug!("encountered OpaqueCast({ty}) in codegen"),
     |                                          ^^^
     |
help: consider importing this macro
     |
   3 + use rustc_span::bug;
     |

error: cannot find macro `bug` in this scope
  --> compiler/rustc_codegen_cranelift/src/common.rs:22:17
   |
22 |         bits => bug!("ptr_sized_integer: unknown pointer bit size {}", bits),
   |                 ^^^
   |
help: consider importing this macro
   |
 1 + use rustc_span::bug;
   |

error: cannot find macro `bug` in this scope
  --> compiler/rustc_codegen_cranelift/src/common.rs:80:25
   |
80 |         ty::Param(_) => bug!("ty param {:?}", ty),
   |                         ^^^
   |
help: consider importing this macro
   |
 1 + use rustc_span::bug;
   |

error: cannot find macro `bug` in this scope
   --> compiler/rustc_codegen_cranelift/src/debuginfo/mod.rs:310:74
    |
310 |         let DefKind::Static { nested, .. } = tcx.def_kind(def_id) else { bug!() };
    |                                                                          ^^^
    |
help: consider importing this macro
    |
 10 + use rustc_span::bug;
---

error: cannot find macro `bug` in this scope
   --> compiler/rustc_codegen_cranelift/src/intrinsics/llvm_x86.rs:205:22
    |
205 |                 _ => bug!("wrong number of args for intrinsic {intrinsic}"),
    |                      ^^^
    |
help: consider importing this macro
    |
  3 + use rustc_span::bug;
    |

error: cannot find macro `bug` in this scope
   --> compiler/rustc_codegen_cranelift/src/intrinsics/llvm_x86.rs:318:22
    |
318 |                 _ => bug!("wrong number of args for intrinsic {intrinsic}"),
    |                      ^^^
    |
help: consider importing this macro
    |
  3 + use rustc_span::bug;
    |

error: cannot find macro `bug` in this scope
   --> compiler/rustc_codegen_cranelift/src/intrinsics/llvm_x86.rs:371:22
    |
371 |                 _ => bug!("wrong number of args for intrinsic {intrinsic}"),
    |                      ^^^
    |
help: consider importing this macro
    |
  3 + use rustc_span::bug;
    |

error: cannot find macro `bug` in this scope
   --> compiler/rustc_codegen_cranelift/src/num.rs:303:14
    |
303 |         _ => bug!("binop {:?} on checked int/uint lhs: {:?} rhs: {:?}", bin_op, in_lhs, in_rhs),
    |              ^^^
    |
help: consider importing this macro
    |
  3 + use rustc_span::bug;
---

error: cannot find macro `bug` in this scope
  --> compiler/rustc_codegen_cranelift/src/unsize.rs:68:14
   |
68 |         _ => bug!("unsized_info: invalid unsizing {:?} -> {:?}", source, target),
   |              ^^^
   |
help: consider importing this macro
   |
 5 + use rustc_span::bug;
   |

error: cannot find macro `bug` in this scope
   --> compiler/rustc_codegen_cranelift/src/unsize.rs:109:14
    |
109 |         _ => bug!("unsize_ptr: called on bad types"),
    |              ^^^
    |
help: consider importing this macro
    |
  5 + use rustc_span::bug;
    |

error: cannot find macro `bug` in this scope
   --> compiler/rustc_codegen_cranelift/src/unsize.rs:161:14
    |
161 |         _ => bug!("coerce_unsized_into: invalid coercion {:?} -> {:?}", src_ty, dst_ty),
    |              ^^^
    |
help: consider importing this macro
    |
  5 + use rustc_span::bug;
    |

error: cannot find macro `bug` in this scope
   --> compiler/rustc_codegen_cranelift/src/unsize.rs:292:14
    |
292 |         _ => bug!("size_and_align_of_dst: {ty} not supported"),
    |              ^^^
    |
help: consider importing this macro
    |
  5 + use rustc_span::bug;
    |

error: cannot find macro `bug` in this scope
   --> compiler/rustc_codegen_cranelift/src/value_and_place.rs:478:46
    |
478 |             CPlaceInner::Addr(_, Some(_)) => bug!("Expected sized cplace, found {:?}", self),
    |                                              ^^^
    |
help: consider importing this macro
    |
  3 + use rustc_span::bug;
---

error: cannot find macro `bug` in this scope
   --> compiler/rustc_codegen_cranelift/src/value_and_place.rs:499:46
    |
499 |             CPlaceInner::Addr(_, Some(_)) => bug!("Expected sized cplace, found {:?}", self),
    |                                              ^^^
    |
help: consider importing this macro
    |
  3 + use rustc_span::bug;
    |

error: cannot find macro `bug` in this scope
   --> compiler/rustc_codegen_cranelift/src/value_and_place.rs:588:46
    |
588 |             CPlaceInner::Addr(_, Some(_)) => bug!("Can't write value to unsized place {:?}", self),
    |                                              ^^^
    |
help: consider importing this macro
    |
  3 + use rustc_span::bug;
---

error: cannot find macro `bug` in this scope
   --> compiler/rustc_codegen_cranelift/src/value_and_place.rs:797:56
    |
797 |                     | CPlaceInner::VarPair(_, _, _) => bug!("Can't index into {self:?}"),
    |                                                        ^^^
    |
help: consider importing this macro
    |
  3 + use rustc_span::bug;
    |

error: cannot find macro `bug` in this scope
   --> compiler/rustc_codegen_cranelift/src/value_and_place.rs:801:18
    |
801 |             _ => bug!("place_index({:?})", self.layout().ty),
    |                  ^^^
    |
help: consider importing this macro
    |
  3 + use rustc_span::bug;
---

error: cannot find macro `bug` in this scope
   --> compiler/rustc_codegen_cranelift/src/value_and_place.rs:187:30
    |
187 |                         _ => bug!("field should be 0 or 1"),
    |                              ^^^
    |
help: consider importing this macro
    |
  3 + use rustc_span::bug;
    |

error: cannot find macro `bug` in this scope
   --> compiler/rustc_codegen_cranelift/src/value_and_place.rs:169:38
    |
169 |             CValueInner::ByVal(_) => bug!("Please use load_scalar for ByVal"),
    |                                      ^^^
    |
help: consider importing this macro
    |
  3 + use rustc_span::bug;
---

error: cannot find macro `bug` in this scope
   --> compiler/rustc_codegen_cranelift/src/value_and_place.rs:144:45
    |
144 |             CValueInner::ByValPair(_, _) => bug!("Please use load_scalar_pair for ByValPair"),
    |                                             ^^^
    |
help: consider importing this macro
    |
  3 + use rustc_span::bug;
    |

error: cannot find macro `bug` in this scope
   --> compiler/rustc_codegen_cranelift/src/value_and_place.rs:143:47
    |
143 |             CValueInner::ByRef(_, Some(_)) => bug!("load_scalar for unsized value not allowed"),
    |                                               ^^^
    |
help: consider importing this macro
    |
  3 + use rustc_span::bug;
    |

error: cannot find macro `bug` in this scope
   --> compiler/rustc_codegen_cranelift/src/abi/mod.rs:542:18
    |
542 |             _ => bug!("argument to function with \"rust-call\" ABI is not a tuple"),
    |                  ^^^
    |
help: consider importing this macro
    |
  7 + use rustc_span::bug;
    |

error: cannot find macro `bug` in this scope
   --> compiler/rustc_codegen_cranelift/src/abi/mod.rs:306:26
    |
306 |                     _ => bug!("spread argument isn't a tuple?! but {:?}", arg_ty),
    |                          ^^^
    |
help: consider importing this macro
    |
  7 + use rustc_span::bug;
---

error: cannot find macro `bug` in this scope
   --> compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs:421:9
    |
421 |         bug!("wrong number of args for intrinsic {:?}", intrinsic);
    |         ^^^
    |
help: consider importing this macro
    |
 20 + use rustc_span::bug;
    |

error: cannot find macro `bug` in this scope
  --> compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs:37:5
   |
37 |     bug!("wrong number of args for intrinsic {}", intrinsic);
   |     ^^^
   |
help: consider importing this macro
   |
20 + use rustc_span::bug;
   |

error: cannot find macro `bug` in this scope
   --> compiler/rustc_codegen_cranelift/src/intrinsics/simd.rs:309:21
    |
309 |                     bug!("wrong number of args for intrinsic {intrinsic}");
    |                     ^^^
    |
help: consider importing this macro
    |
  3 + use rustc_span::bug;
    |

error: cannot find macro `bug` in this scope
   --> compiler/rustc_codegen_cranelift/src/intrinsics/simd.rs:264:21
    |
264 |                     bug!("wrong number of args for intrinsic {intrinsic}");
    |                     ^^^
    |
help: consider importing this macro
    |
  3 + use rustc_span::bug;
    |

error: cannot find macro `bug` in this scope
   --> compiler/rustc_codegen_cranelift/src/intrinsics/simd.rs:171:21
    |
171 |                     bug!("wrong number of args for intrinsic {intrinsic}");
    |                     ^^^
    |
help: consider importing this macro
    |
  3 + use rustc_span::bug;
    |

error: cannot find macro `bug` in this scope
   --> compiler/rustc_codegen_cranelift/src/intrinsics/simd.rs:126:17
    |
126 |                 bug!("wrong number of args for intrinsic {intrinsic}");
    |                 ^^^
    |
help: consider importing this macro
    |
  3 + use rustc_span::bug;
    |

error: cannot find macro `span_bug` in this scope
   --> compiler/rustc_codegen_cranelift/src/inline_asm.rs:219:17
    |
219 |                 span_bug!(span, "asm! label operands are not yet supported");
    |                 ^^^^^^^^
    |
help: consider importing this macro
    |
  3 + use rustc_span::span_bug;
    |

error: cannot find macro `span_bug` in this scope
   --> compiler/rustc_codegen_cranelift/src/inline_asm.rs:210:21
    |
210 |                     span_bug!(span, "invalid type for asm sym (fn)");
    |                     ^^^^^^^^
    |
help: consider importing this macro
    |
  3 + use rustc_span::span_bug;
---

error: cannot find macro `span_bug` in this scope
   --> compiler/rustc_codegen_cranelift/src/common.rs:463:21
    |
463 |                     span_bug!(span, "`fn_abi_of_fn_ptr({sig}, {extra_args:?})` failed: {err:?}");
    |                     ^^^^^^^^
    |
help: consider importing this macro
    |
  1 + use rustc_span::span_bug;
    |

error: cannot find macro `bug` in this scope
   --> compiler/rustc_codegen_cranelift/src/base.rs:885:25
    |
885 |                         bug!("RawPtr fields: {operands:?}");
    |                         ^^^
    |
help: consider importing this macro
    |
  3 + use rustc_span::bug;
---

error: cannot find macro `bug` in this scope
   --> compiler/rustc_codegen_cranelift/src/base.rs:596:17
    |
596 |                 bug!("shouldn't exist at codegen {:?}", bb_data.terminator());
    |                 ^^^
    |
help: consider importing this macro
    |
  3 + use rustc_span::bug;
---

error[E0308]: `else` clause of `let...else` does not diverge
   --> compiler/rustc_codegen_cranelift/src/base.rs:884:60
    |
884 |                       let [data, meta] = &*operands.raw else {
    |  ____________________________________________________________^
885 | |                         bug!("RawPtr fields: {operands:?}");
886 | |                     };
    | |_____________________^ expected `!`, found `()`
    |
    = note:   expected type `!`
            found unit type `()`
    = help: try adding a diverging expression, such as `return` or `panic!(..)`
    = help: ...or use `match` instead of `let...else`

error[E0308]: mismatched types
   --> compiler/rustc_codegen_cranelift/src/common.rs:462:62
    |
462 |                   FnAbiRequest::OfFnPtr { sig, extra_args } => {
    |  ______________________________________________________________^
463 | |                     span_bug!(span, "`fn_abi_of_fn_ptr({sig}, {extra_args:?})` failed: {err:?}");
464 | |                 }
    | |_________________^ expected `!`, found `()`
    |
    = note:   expected type `!`
            found unit type `()`

error[E0308]: mismatched types
   --> compiler/rustc_codegen_cranelift/src/common.rs:465:70
    |
465 |                   FnAbiRequest::OfInstance { instance, extra_args } => {
    |  ______________________________________________________________________^
466 | |                     span_bug!(
467 | |                         span,
468 | |                         "`fn_abi_of_instance({instance}, {extra_args:?})` failed: {err:?}"
469 | |                     );
470 | |                 }
    | |_________________^ expected `!`, found `()`
    |
    = note:   expected type `!`
            found unit type `()`

error[E0308]: `if` and `else` have incompatible types
   --> compiler/rustc_codegen_cranelift/src/inline_asm.rs:210:21
    |
175 | /                  if let ty::FnDef(def_id, args) = *const_.ty().kind() {
176 | |                      let instance = ty::Instance::resolve_for_fn_ptr(
177 | |                          fx.tcx,
178 | |                          ty::TypingEnv::fully_monomorphized(),
...   |
185 | |/                     if FullyMonomorphizedLayoutCx(fx.tcx)
186 | ||                         .fn_abi_of_instance(instance, ty::List::empty())
187 | ||                         .conv
188 | ||                         == CanonAbi::Custom
...   ||
207 | ||                         CInlineAsmOperand::Symbol { symbol: wrapper_name }
208 | ||                     }
    | ||_____________________- expected because of this
209 | |                  } else {
210 | |                      span_bug!(span, "invalid type for asm sym (fn)");
    | |                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `CInlineAsmOperand<'_>`, found `()`
211 | |                  }
    | |__________________- `if` and `else` have incompatible types

error[E0308]: `else` clause of `let...else` does not diverge
   --> compiler/rustc_codegen_cranelift/src/intrinsics/simd.rs:125:36
    |
125 |               let [x, y] = args else {
    |  ____________________________________^
126 | |                 bug!("wrong number of args for intrinsic {intrinsic}");
127 | |             };
    | |_____________^ expected `!`, found `()`
    |
    = note:   expected type `!`
            found unit type `()`
---
   --> compiler/rustc_codegen_cranelift/src/intrinsics/simd.rs:171:21
    |
168 |               let (x, y, idx) = match args {
    |  _______________________________-
169 | |                 [x, y, idx] => (x, y, idx),
    | |                                ----------- this is found to be of type `(&rustc_span::Spanned<rustc_middle::mir::Operand<'tcx>>, &rustc_span::Spanned<rustc_middle::mir::Operand<'tcx>>, &rustc_span::Spanned<rustc_middle::mir::Operand<'tcx>>)`
170 | |                 _ => {
171 | |                     bug!("wrong number of args for intrinsic {intrinsic}");
    | |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `(&Spanned<Operand<'_>>, &Spanned<_>, _)`, found `()`
172 | |                 }
173 | |             };
    | |_____________- `match` arms have incompatible types
    |
    = note:  expected tuple `(&Spanned<Operand<'tcx>>, &Spanned<Operand<'tcx>>, &Spanned<_>)`
            found unit type `()`
    = note: the full name for the type has been written to '/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-codegen/x86_64-unknown-linux-gnu/release/build/rustc_codegen_cranelift/2e3c7aea246ffd11/out/rustc_codegen_cranelift-2e3c7aea246ffd11.long-type-11666747019518501109.txt'
    = note: consider using `--verbose` to print the full type name to the console

error[E0308]: `match` arms have incompatible types
   --> compiler/rustc_codegen_cranelift/src/intrinsics/simd.rs:264:21
    |
261 |               let (base, idx, val) = match args {
    |  ____________________________________-
262 | |                 [base, idx, val] => (base, idx, val),
    | |                                     ---------------- this is found to be of type `(&rustc_span::Spanned<rustc_middle::mir::Operand<'tcx>>, &rustc_span::Spanned<rustc_middle::mir::Operand<'tcx>>, &rustc_span::Spanned<rustc_middle::mir::Operand<'tcx>>)`
263 | |                 _ => {
264 | |                     bug!("wrong number of args for intrinsic {intrinsic}");
    | |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `(&Spanned<Operand<'_>>, &Spanned<_>, _)`, found `()`
265 | |                 }
266 | |             };
    | |_____________- `match` arms have incompatible types
    |
    = note:  expected tuple `(&Spanned<Operand<'tcx>>, &Spanned<Operand<'tcx>>, &Spanned<_>)`
            found unit type `()`
    = note: the full name for the type has been written to '/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-codegen/x86_64-unknown-linux-gnu/release/build/rustc_codegen_cranelift/2e3c7aea246ffd11/out/rustc_codegen_cranelift-2e3c7aea246ffd11.long-type-14434995171231215182.txt'
    = note: consider using `--verbose` to print the full type name to the console

error[E0308]: `match` arms have incompatible types
   --> compiler/rustc_codegen_cranelift/src/intrinsics/simd.rs:309:21
    |
306 |               let (v, idx) = match args {
    |  ____________________________-
307 | |                 [v, idx] => (v, idx),
    | |                             -------- this is found to be of type `(&rustc_span::Spanned<rustc_middle::mir::Operand<'tcx>>, &rustc_span::Spanned<rustc_middle::mir::Operand<'tcx>>)`
308 | |                 _ => {
309 | |                     bug!("wrong number of args for intrinsic {intrinsic}");
    | |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `(&Spanned<Operand<'_>>, &Spanned<_>)`, found `()`
310 | |                 }
311 | |             };
    | |_____________- `match` arms have incompatible types
    |
    = note:  expected tuple `(&rustc_span::Spanned<rustc_middle::mir::Operand<'tcx>>, &rustc_span::Spanned<rustc_middle::mir::Operand<'tcx>>)`
            found unit type `()`

error[E0308]: mismatched types
  --> compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs:36:69
   |


#[eii(bug_handler)]
#[inline(never)]
pub fn bug_impl(_: Option<Span>, args: fmt::Arguments<'_>, location: &Location<'_>) -> ! {

@bjorn3 bjorn3 Aug 27, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Default impls for EIIs are not stable in the slightest. And EIIs without defaults will need #159843 before they can safely be used.

View changes since the review

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

For the time being using a static that is set by rustc_interface like all other callbacks is probably the best solution.

@RalfJung RalfJung Aug 27, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

If they are so unstable, maybe they should have a separate feature gate that's marked as incomplete. Or the entire extern_item_impls should be marked "incomplete".

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Putting EIIs with default impls behind an incomplete feature makes sense to me.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

For the time being using a static that is set by rustc_interface like all other callbacks is probably the best solution.

it looks like rustc_interface's callbacks doesn't support #[track_caller], so one gets backtraces starting like this:

thread 'rustc' (14300) panicked at compiler\rustc_interface\src\callbacks.rs:89:1:
Box<dyn Any>
stack backtrace:
   0: std::panicking::begin_panic<rustc_errors::ExplicitBug>                                                                                                                                                                                                                
             at /rustc/f47d5bb13648d5c859f5b438eb7dc834b9729961/library\std\src\panicking.rs:751
   1: std::panic::panic_any<rustc_errors::ExplicitBug>                                                                                                                                                                                                                      
             at /rustc/f47d5bb13648d5c859f5b438eb7dc834b9729961/library\std\src\panic.rs:260
   2: rustc_errors::diagnostic::impl$2::emit_producing_guarantee
             at .\compiler\rustc_errors\src\diagnostic.rs:58
   3: rustc_errors::diagnostic::Diag::emit<rustc_errors::diagnostic::BugAbort>                                                                                                                                                                                              
             at .\compiler\rustc_errors\src\diagnostic.rs:1319
   4: rustc_errors::DiagCtxtHandle::span_bug<rustc_span::span_encoding::Span,alloc::string::String>
             at .\compiler\rustc_errors\src\lib.rs:982
   5: rustc_interface::callbacks::bug_impl::closure$0
             at .\compiler\rustc_interface\src\callbacks.rs:95
   6: rustc_middle::ty::context::tls::with_opt::closure$0<rustc_interface::callbacks::bug_impl::closure_env$0,never$>
             at .\compiler\rustc_middle\src\ty\context\tls.rs:109
   7: rustc_middle::ty::context::tls::with_context_opt<rustc_middle::ty::context::tls::with_opt::closure_env$0<rustc_interface::callbacks::bug_impl::closure_env$0,never$>,never$>
             at .\compiler\rustc_middle\src\ty\context\tls.rs:75
   8: rustc_middle::ty::context::tls::with_opt<rustc_interface::callbacks::bug_impl::closure_env$0,never$>
             at .\compiler\rustc_middle\src\ty\context\tls.rs:107
   9: rustc_interface::callbacks::bug_impl
             at .\compiler\rustc_interface\src\callbacks.rs:90
  10: rustc_interface::callbacks::bug_impl
             at .\compiler\rustc_interface\src\callbacks.rs:89
  11: rustc_span::macros::bug_impl
             at .\compiler\rustc_span\src\macros.rs:43

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Try

unsafe extern "Rust" {
    #[lang = "panic_impl"]
    fn panic_impl(pi: &PanicInfo<'_>) -> !;
}
panic_impl(&PanicInfo::new(
    &fmt,
    location,
    /* can_unwind */ true,
    /* force_no_backtrace */ false,
))

You will need to enable some unstable features for it. This is based on the implementation of panic!() and by extension core::panicking::panic_fmt.

@bjorn3 bjorn3 added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 27, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Aug 28, 2026
Mark `extern_item_impls` feature as incomplete

context: rust-lang#161873 (comment)

> If they are so unstable, maybe they should have a separate feature gate that's marked as `incomplete`. Or the entire `extern_item_impls` should be marked "incomplete".

I think it's just best to mark the entire thing as incomplete for now. Later, when the implementation matures we can consider removing the incompleteness or splitting the feature in unstable and incomplete parts.

r? @bjorn3 @RalfJung
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Aug 28, 2026
Mark `extern_item_impls` feature as incomplete

context: rust-lang#161873 (comment)

> If they are so unstable, maybe they should have a separate feature gate that's marked as `incomplete`. Or the entire `extern_item_impls` should be marked "incomplete".

I think it's just best to mark the entire thing as incomplete for now. Later, when the implementation matures we can consider removing the incompleteness or splitting the feature in unstable and incomplete parts.

r? @bjorn3 @RalfJung
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Aug 28, 2026
Mark `extern_item_impls` feature as incomplete

context: rust-lang#161873 (comment)

> If they are so unstable, maybe they should have a separate feature gate that's marked as `incomplete`. Or the entire `extern_item_impls` should be marked "incomplete".

I think it's just best to mark the entire thing as incomplete for now. Later, when the implementation matures we can consider removing the incompleteness or splitting the feature in unstable and incomplete parts.

r? @bjorn3 @RalfJung
rust-bors Bot pushed a commit that referenced this pull request Aug 28, 2026
Rollup merge of #161891 - mejrs:eii_incomplete, r=RalfJung

Mark `extern_item_impls` feature as incomplete

context: #161873 (comment)

> If they are so unstable, maybe they should have a separate feature gate that's marked as `incomplete`. Or the entire `extern_item_impls` should be marked "incomplete".

I think it's just best to mark the entire thing as incomplete for now. Later, when the implementation matures we can consider removing the incompleteness or splitting the feature in unstable and incomplete parts.

r? @bjorn3 @RalfJung
@rust-bors

rust-bors Bot commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

☔ The latest upstream changes (presumably #161906) made this pull request unmergeable. Please resolve the merge conflicts by rebasing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-attributes Area: Attributes (`#[…]`, `#![…]`) A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. F-autodiff `#![feature(autodiff)]` S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants