Skip to content

[EXPERIMENT] Outline some panics with constant messages - #163766

Draft
hanna-kruppe wants to merge 1 commit into
rust-lang:mainfrom
hanna-kruppe:outline-panic-literals
Draft

hanna-kruppe wants to merge 1 commit into
rust-lang:mainfrom
hanna-kruppe:outline-panic-literals

Conversation

@hanna-kruppe

@hanna-kruppe hanna-kruppe commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

Inspired by #163657

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Oct 4, 2026
@hanna-kruppe

Copy link
Copy Markdown
Contributor Author

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Oct 4, 2026
@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Oct 4, 2026
[EXPERIMENT] Outline some panics with constant messages
@rust-log-analyzer

Copy link
Copy Markdown
Collaborator

The job test-aarch64-gnu-llvm-22-1 failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
---- [ui] tests/ui/proc-macro/quote/debug.rs stdout ----
Saved the actual stdout to `/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/proc-macro/quote/debug/debug.stdout`
diff of stdout:

34                                 (iter.next(), iter.next()) {
35                             lit.set_span(crate::Span::recover_proc_macro_span(2));
36                             lit
-                         } else {
-                             ::core::panicking::panic("internal error: entered unreachable code")
-                         }
+                         } else { ::core::panic::unreachable_noargs() }
40                     }), &mut ts);
41         crate::ToTokens::to_tokens(&crate::TokenTree::Punct(crate::Punct::new(';',
42                         crate::Spacing::Alone)), &mut ts);

53                                 (iter.next(), iter.next()) {
54                             lit.set_span(crate::Span::recover_proc_macro_span(5));
55                             lit
-                         } else {
-                             ::core::panicking::panic("internal error: entered unreachable code")
-                         }
+                         } else { ::core::panic::unreachable_noargs() }
59                     }), &mut ts);
60         crate::ToTokens::to_tokens(&crate::TokenTree::Punct(crate::Punct::new(';',
61                         crate::Spacing::Alone)), &mut ts);


The actual stdout differed from the expected stdout
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args proc-macro/quote/debug.rs`

error: 1 errors occurred comparing output.
status: exit status: 0
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/proc-macro/quote/debug.rs" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2" "--target=aarch64-unknown-linux-gnu" "--check-cfg" "cfg(test,FALSE)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "--out-dir" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/proc-macro/quote/debug" "-Znext-solver=coherence" "-A" "unused" "-W" "unused_attributes" "-A" "internal_features" "-A" "incomplete_features" "-A" "unused_parens" "-A" "unused_braces" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/aarch64-unknown-linux-gnu/native/rust-test-helpers" "--edition=2015" "-Z" "unpretty=expanded"
--- stdout -------------------------------
#![feature(prelude_import)]
#![no_std]
//@ check-pass
//@ force-host
---
extern crate proc_macro;

fn main() {
    {
        let mut ts = crate::TokenStream::new();
        crate::ToTokens::to_tokens(&crate::TokenTree::Ident(crate::Ident::new("let",
                        crate::Span::recover_proc_macro_span(0))), &mut ts);
        crate::ToTokens::to_tokens(&crate::TokenTree::Ident(crate::Ident::new("hello",
                        crate::Span::recover_proc_macro_span(1))), &mut ts);
        crate::ToTokens::to_tokens(&crate::TokenTree::Punct(crate::Punct::new('=',
                        crate::Spacing::Alone)), &mut ts);
        crate::ToTokens::to_tokens(&crate::TokenTree::Literal({
                        let mut iter =
                            "\"world\"".parse::<crate::TokenStream>().unwrap().into_iter();
                        if let (Some(crate::TokenTree::Literal(mut lit)), None) =
                                (iter.next(), iter.next()) {
                            lit.set_span(crate::Span::recover_proc_macro_span(2));
                            lit
                        } else { ::core::panic::unreachable_noargs() }
                    }), &mut ts);
        crate::ToTokens::to_tokens(&crate::TokenTree::Punct(crate::Punct::new(';',
                        crate::Spacing::Alone)), &mut ts);
        crate::ToTokens::to_tokens(&crate::TokenTree::Ident(crate::Ident::new("let",
                        crate::Span::recover_proc_macro_span(3))), &mut ts);
        crate::ToTokens::to_tokens(&crate::TokenTree::Ident(crate::Ident::new_raw("raw_ident",
                        crate::Span::recover_proc_macro_span(4))), &mut ts);
        crate::ToTokens::to_tokens(&crate::TokenTree::Punct(crate::Punct::new('=',
                        crate::Spacing::Alone)), &mut ts);
        crate::ToTokens::to_tokens(&crate::TokenTree::Literal({
                        let mut iter =
                            "r#\"raw\"literal\"#".parse::<crate::TokenStream>().unwrap().into_iter();
                        if let (Some(crate::TokenTree::Literal(mut lit)), None) =
                                (iter.next(), iter.next()) {
                            lit.set_span(crate::Span::recover_proc_macro_span(5));
                            lit
                        } else { ::core::panic::unreachable_noargs() }
                    }), &mut ts);
        crate::ToTokens::to_tokens(&crate::TokenTree::Punct(crate::Punct::new(';',
                        crate::Spacing::Alone)), &mut ts);
        ts
    }
}
const _: () =
    {
        extern crate proc_macro;
        #[rustc_proc_macro_decls]
        #[used]
        #[allow(deprecated)]
        static _DECLS: &[proc_macro::bridge::client::Client] = &[];
    };
------------------------------------------
stderr: none

---- [ui] tests/ui/proc-macro/quote/debug.rs stdout end ----

@rust-bors

rust-bors Bot commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: caa37fb (caa37fb206c657fa2ce3b0adc2fe67084eaee0a8)
Base parent: f48b3e6 (f48b3e61eeece268609bd920fcca1ded047db7ca)

@rust-timer

This comment has been minimized.

@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (caa37fb): comparison URL.

Overall result: ❌✅ regressions and improvements - no action needed

Benchmarking means the PR may be perf-sensitive. Consider adding rollup=never if this change is not fit for rolling up.

@rustbot label: -S-waiting-on-perf -perf-regression

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

mean range count
Regressions ❌
(primary)
0.1% [0.1%, 0.1%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.1% [-0.1%, -0.1%] 1
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.0% [-0.1%, 0.1%] 2

Max RSS (memory usage)

Results (secondary 1.4%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
4.1% [2.1%, 6.1%] 2
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-4.1% [-4.1%, -4.1%] 1
All ❌✅ (primary) - - 0

Cycles

Results (secondary 0.8%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
6.7% [6.7%, 6.7%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-2.1% [-2.4%, -1.9%] 2
All ❌✅ (primary) - - 0

Binary size

Results (primary -0.2%, secondary -0.4%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.2% [-0.3%, -0.2%] 11
Improvements ✅
(secondary)
-0.4% [-0.6%, -0.2%] 13
All ❌✅ (primary) -0.2% [-0.3%, -0.2%] 11

Bootstrap: 490.122s -> 490.205s (0.02%)
Artifact size: 408.65 MiB -> 408.94 MiB (0.07%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Oct 4, 2026

This branch has not been deployed

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

Labels

S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-libs Relevant to the library team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants