-
-
Notifications
You must be signed in to change notification settings - Fork 14.6k
Open
Labels
A-rustdoc-scrape-examplesArea: The (unstable) rustdoc scrape-examples feature described in RFC 3123Area: The (unstable) rustdoc scrape-examples feature described in RFC 3123C-bugCategory: This is a bug.Category: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️S-has-bisectionStatus: A bisection has been found for this issueStatus: A bisection has been found for this issueT-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.Relevant to the rustdoc team, which will review and decide on the PR/issue.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.Performance or correctness regression from one stable version to another.
Description
winit v0.30.13's documentation is failing to build on newer Rust versions, see docs.rs and rust-windowing/winit#4511.
Seems to be some weird interaction between Cargo features and macros? I'm not quite sure.
Code
https://github.com/madsmtm/rustdoc-winit-bug contains the full minification, reproduced here too:
src/lib.rs:
pub struct Window {}
impl Window {
pub fn id(&self) -> u64 {
todo!()
}
}examples/window.rs:
#![allow(dead_code)]
use rustdoc_winit_bug::Window;
use tracing::info;
struct WindowState {
window: Window,
}
impl WindowState {
fn takes_ref(&self) {
info!("{:?}", self.window.id());
}
fn takes_mut(&mut self) {
info!("{:?}", self.window.id());
}
}
fn main() {}Cargo.toml:
[workspace]
[package]
edition = "2024"
name = "rustdoc-winit-bug"
version = "0.1.0"
[dependencies]
tracing = { version = "0.1.40", default-features = false }
[dev-dependencies]
tracing = { version = "0.1.40", default-features = false, features = ["log"] }
[[example]]
doc-scrape-examples = true
name = "window"Run with:
cargo +nightly-2026-03-13 rustdoc -Zunstable-options -Zrustdoc-scrape-examplesBacktrace
Backtrace
thread 'rustc' panicked at src/librustdoc/html/highlight.rs:234:42:
`exit_elem` called on empty class stack parent
stack backtrace:
0: 0x114a88958 - <std[5e4cd47ac048545]::backtrace::Backtrace>::create
1: 0x1128f2854 - std[5e4cd47ac048545]::panicking::update_hook::<alloc[f0aa43b5a48e9af6]::boxed::Box<rustc_driver_impl[9810d8d61b400d2c]::install_ice_hook::{closure#1}>>::{closure#0}
2: 0x114a99f94 - std[5e4cd47ac048545]::panicking::panic_with_hook
3: 0x114a7debc - std[5e4cd47ac048545]::panicking::panic_handler::{closure#0}
4: 0x114a74860 - std[5e4cd47ac048545]::sys::backtrace::__rust_end_short_backtrace::<std[5e4cd47ac048545]::panicking::panic_handler::{closure#0}, !>
5: 0x114a7f48c - __rustc[528297b2bcb02c92]::rust_begin_unwind
6: 0x117aba5f0 - core[cc6e5097f7e6aa90]::panicking::panic_fmt
7: 0x117aba2f4 - core[cc6e5097f7e6aa90]::option::expect_failed
8: 0x104d8fc24 - rustdoc[455d8d6df7ffa9da]::html::highlight::write_code::<core[cc6e5097f7e6aa90]::fmt::Formatter>::{closure#2}
9: 0x104e95af8 - rustdoc[455d8d6df7ffa9da]::html::highlight::classify
10: 0x104cec7e8 - rustdoc[455d8d6df7ffa9da]::html::highlight::write_code::<core[cc6e5097f7e6aa90]::fmt::Formatter>
11: 0x104f2c884 - <&core[cc6e5097f7e6aa90]::fmt::builders::FromFn<rustdoc[455d8d6df7ffa9da]::html::sources::print_src<&mut core[cc6e5097f7e6aa90]::fmt::Formatter>::{closure#0}> as core[cc6e5097f7e6aa90]::fmt::Display>::fmt
12: 0x111c82c20 - core[cc6e5097f7e6aa90]::fmt::write
13: 0x104f2cc50 - <&askama[22ea555c962af5c5]::filters::escape::Safe<&core[cc6e5097f7e6aa90]::fmt::builders::FromFn<rustdoc[455d8d6df7ffa9da]::html::sources::print_src<&mut core[cc6e5097f7e6aa90]::fmt::Formatter>::{closure#0}>> as core[cc6e5097f7e6aa90]::fmt::Display>::fmt
14: 0x111c82c20 - core[cc6e5097f7e6aa90]::fmt::write
15: 0x104d8ebd4 - rustdoc[455d8d6df7ffa9da]::html::render::render_call_locations::<&mut core[cc6e5097f7e6aa90]::fmt::Formatter>::{closure#2}
16: 0x104f5d4a8 - <core[cc6e5097f7e6aa90]::fmt::builders::FromFn<rustdoc[455d8d6df7ffa9da]::html::render::document_full_inner::{closure#0}> as core[cc6e5097f7e6aa90]::fmt::Display>::fmt
17: 0x104c5d5a4 - rustdoc[455d8d6df7ffa9da]::html::render::render_impl::{closure#0}::doc_impl_item::<&mut alloc[f0aa43b5a48e9af6]::string::String, &mut alloc[f0aa43b5a48e9af6]::string::String>
18: 0x104f5a58c - <core[cc6e5097f7e6aa90]::fmt::builders::FromFn<rustdoc[455d8d6df7ffa9da]::html::render::render_impl::{closure#0}> as core[cc6e5097f7e6aa90]::fmt::Display>::fmt
19: 0x104e91814 - rustdoc[455d8d6df7ffa9da]::html::render::render_assoc_items_inner
20: 0x104f5ced8 - <core[cc6e5097f7e6aa90]::fmt::builders::FromFn<rustdoc[455d8d6df7ffa9da]::html::render::render_assoc_items::{closure#0}> as core[cc6e5097f7e6aa90]::fmt::Display>::fmt
21: 0x111c82c20 - core[cc6e5097f7e6aa90]::fmt::write
22: 0x104c45590 - <rustdoc[455d8d6df7ffa9da]::html::render::print_item::DisplayStruct>::render_into::<core[cc6e5097f7e6aa90]::fmt::Formatter>
23: 0x104f60c2c - <core[cc6e5097f7e6aa90]::fmt::builders::FromFn<rustdoc[455d8d6df7ffa9da]::html::render::print_item::item_struct::{closure#0}> as core[cc6e5097f7e6aa90]::fmt::Display>::fmt
24: 0x111c82c20 - core[cc6e5097f7e6aa90]::fmt::write
25: 0x104ce7c18 - rustdoc[455d8d6df7ffa9da]::html::layout::render::<core[cc6e5097f7e6aa90]::fmt::builders::FromFn<rustdoc[455d8d6df7ffa9da]::html::render::print_item::print_item::{closure#0}>, core[cc6e5097f7e6aa90]::fmt::builders::FromFn<<rustdoc[455d8d6df7ffa9da]::html::render::context::Context>::render_item::{closure#1}>>
26: 0x104df6a0c - <rustdoc[455d8d6df7ffa9da]::html::render::context::Context>::render_item
27: 0x104f44214 - <rustdoc[455d8d6df7ffa9da]::html::render::context::Context as rustdoc[455d8d6df7ffa9da]::formats::renderer::FormatRenderer>::item
28: 0x104ceea2c - rustdoc[455d8d6df7ffa9da]::formats::renderer::run_format_inner::<rustdoc[455d8d6df7ffa9da]::html::render::context::Context>
29: 0x104ceebf4 - rustdoc[455d8d6df7ffa9da]::formats::renderer::run_format_inner::<rustdoc[455d8d6df7ffa9da]::html::render::context::Context>
30: 0x104d94658 - rustdoc[455d8d6df7ffa9da]::main_args::{closure#2}::{closure#0}
31: 0x104d8bdfc - rustc_interface[96ebfdf40f9119ad]::interface::run_compiler::<(), rustdoc[455d8d6df7ffa9da]::main_args::{closure#2}>::{closure#1}
32: 0x104cf59c8 - std[5e4cd47ac048545]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[96ebfdf40f9119ad]::util::run_in_thread_with_globals<rustc_interface[96ebfdf40f9119ad]::util::run_in_thread_pool_with_globals<rustc_interface[96ebfdf40f9119ad]::interface::run_compiler<(), rustdoc[455d8d6df7ffa9da]::main_args::{closure#2}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
33: 0x104dbe64c - <std[5e4cd47ac048545]::thread::lifecycle::spawn_unchecked<rustc_interface[96ebfdf40f9119ad]::util::run_in_thread_with_globals<rustc_interface[96ebfdf40f9119ad]::util::run_in_thread_pool_with_globals<rustc_interface[96ebfdf40f9119ad]::interface::run_compiler<(), rustdoc[455d8d6df7ffa9da]::main_args::{closure#2}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[cc6e5097f7e6aa90]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
34: 0x114aa4c50 - <std[5e4cd47ac048545]::sys::thread::unix::Thread>::new::thread_start
35: 0x195e43bc8 - __pthread_cond_wait
rustc version: 1.96.0-nightly (3102493c7 2026-03-12)
platform: aarch64-apple-darwin
query stack during panic:
end of query stack
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
A-rustdoc-scrape-examplesArea: The (unstable) rustdoc scrape-examples feature described in RFC 3123Area: The (unstable) rustdoc scrape-examples feature described in RFC 3123C-bugCategory: This is a bug.Category: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️S-has-bisectionStatus: A bisection has been found for this issueStatus: A bisection has been found for this issueT-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.Relevant to the rustdoc team, which will review and decide on the PR/issue.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.Performance or correctness regression from one stable version to another.
Type
Fields
Give feedbackNo fields configured for issues without a type.