<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Compiler Errors on ErrorVault — Developer Error Code Dictionary</title><link>https://errorvault.dev/tags/compiler-errors/</link><description>Recent content in Compiler Errors on ErrorVault — Developer Error Code Dictionary</description><generator>Hugo</generator><language>en-us</language><lastBuildDate>Tue, 21 Apr 2026 17:32:04 +0800</lastBuildDate><atom:link href="https://errorvault.dev/tags/compiler-errors/feed.xml" rel="self" type="application/rss+xml"/><item><title>Fix E0730: Type Parameter Defaults Only Allowed in Function Items</title><link>https://errorvault.dev/rust/rust-e0730-type-param-defaults-fn-items/</link><pubDate>Tue, 21 Apr 2026 17:32:04 +0800</pubDate><guid>https://errorvault.dev/rust/rust-e0730-type-param-defaults-fn-items/</guid><description>&lt;h2 id="1-symptoms">1. Symptoms&lt;/h2>
&lt;p>When compiling Rust code with default type parameters in invalid contexts, you will encounter the E0730 error. The compiler produces a clear message indicating the restriction.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-fallback" data-lang="fallback">&lt;span style="display:flex;">&lt;span>error[E0730]: default type parameters are only allowed in function items
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> --&amp;gt; src/main.rs:5:1
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> |
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>5 | impl&amp;lt;T = i32&amp;gt; Trait for Foo&amp;lt;T&amp;gt; {}
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>error: aborting due to 1 previous error
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>The error specifically states that &lt;strong>default type parameters are only allowed in function items&lt;/strong>. This means you cannot use the &lt;code>= DefaultValue&lt;/code> syntax for type parameters in &lt;code>impl&lt;/code> blocks, &lt;code>type&lt;/code> aliases, or other non-function contexts.&lt;/p></description></item></channel></rss>