<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>第12章 深入 std 之下 on 编程那些事儿</title><link>https://before80.github.io/prgms/Rust/rustonomicon/beneath-std/</link><description>Recent content in 第12章 深入 std 之下 on 编程那些事儿</description><generator>Hugo</generator><language>zh-cn</language><lastBuildDate>Tue, 11 Aug 2026 23:57:44 +0800</lastBuildDate><atom:link href="https://before80.github.io/prgms/Rust/rustonomicon/beneath-std/index.xml" rel="self" type="application/rss+xml"/><item><title>12.1 #[panic_handler]</title><link>https://before80.github.io/prgms/Rust/rustonomicon/beneath-std/01-panic-handler/</link><pubDate>Thu, 06 Aug 2026 17:08:00 +0800</pubDate><guid>https://before80.github.io/prgms/Rust/rustonomicon/beneath-std/01-panic-handler/</guid><description>&lt;blockquote&gt;
&lt;p&gt;译文 · 基于 &lt;a href="https://doc.rust-lang.org/nomicon/"&gt;The Rustonomicon&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h1 id="panic_handler"&gt;#[panic_handler]&lt;/h1&gt;
&lt;blockquote&gt;
&lt;p&gt;原文链接: &lt;a href="https://doc.rust-lang.org/nomicon/panic-handler.html"&gt;https://doc.rust-lang.org/nomicon/panic-handler.html&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;　　&lt;code&gt;#[panic_handler]&lt;/code&gt; 用于定义 &lt;code&gt;#![no_std]&lt;/code&gt; 应用中 &lt;code&gt;panic!&lt;/code&gt; 的行为。&lt;code&gt;#[panic_handler]&lt;/code&gt; 必须应用于签名为 &lt;code&gt;fn(&amp;amp;PanicInfo) -&amp;gt; !&lt;/code&gt; 的函数，且二进制 / dylib / cdylib crate 的依赖图中该函数必须&lt;em&gt;恰好出现一次&lt;/em&gt;。&lt;code&gt;PanicInfo&lt;/code&gt; 的 API 见 [API 文档]。&lt;/p&gt;</description></item></channel></rss>