<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Rust Errors on ErrorVault — Developer Error Code Dictionary</title><link>https://errorvault.dev/rust/</link><description>Recent content in Rust Errors on ErrorVault — Developer Error Code Dictionary</description><generator>Hugo</generator><language>en-us</language><lastBuildDate>Wed, 29 Apr 2026 03:08:04 +0800</lastBuildDate><atom:link href="https://errorvault.dev/rust/feed.xml" rel="self" type="application/rss+xml"/><item><title>Fix E0524: Rust Compiler Error - Variable Previously Captured</title><link>https://errorvault.dev/rust/rust-e0524-variable-previously-captured/</link><pubDate>Wed, 29 Apr 2026 03:08:04 +0800</pubDate><guid>https://errorvault.dev/rust/rust-e0524-variable-previously-captured/</guid><description>&lt;h2 id="1-symptoms">1. Symptoms&lt;/h2>
&lt;p>The Rust compiler emits error E0524 when attempting to use a variable that has already been captured by a closure. This error manifests in several distinct patterns that Rust developers commonly encounter.&lt;/p>
&lt;p>&lt;strong>Primary Error Message:&lt;/strong>&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-rust" data-lang="rust">&lt;span style="display:flex;">&lt;span>error[E0524]: `x` was previously captured by this closure
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff79c6">-&lt;/span>-&amp;gt; &lt;span style="color:#50fa7b">src&lt;/span>&lt;span style="color:#ff79c6">/&lt;/span>main.rs:&lt;span style="color:#bd93f9">6&lt;/span>:&lt;span style="color:#bd93f9">5&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff79c6">|&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#bd93f9">3&lt;/span> &lt;span style="color:#ff79c6">|&lt;/span> &lt;span style="color:#8be9fd;font-style:italic">let&lt;/span> c2 &lt;span style="color:#ff79c6">=&lt;/span> &lt;span style="color:#ff79c6">||&lt;/span> {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff79c6">|&lt;/span> &lt;span style="color:#ff79c6">--&lt;/span> first capture is here
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#bd93f9">4&lt;/span> &lt;span style="color:#ff79c6">|&lt;/span> println!(&lt;span style="color:#f1fa8c">&amp;#34;&lt;/span>&lt;span style="color:#f1fa8c">{:?}&lt;/span>&lt;span style="color:#f1fa8c">&amp;#34;&lt;/span>, x);
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff79c6">|&lt;/span> &lt;span style="color:#ff79c6">-&lt;/span> &lt;span style="color:#ff79c6">^&lt;/span> first borrow is here
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#bd93f9">5&lt;/span> &lt;span style="color:#ff79c6">|&lt;/span> };
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#bd93f9">6&lt;/span> &lt;span style="color:#ff79c6">|&lt;/span> &lt;span style="color:#8be9fd;font-style:italic">drop&lt;/span>(x);
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff79c6">|&lt;/span> &lt;span style="color:#ff79c6">^&lt;/span> second &lt;span style="color:#ff79c6">move&lt;/span> into this closure
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff79c6">|&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff79c6">=&lt;/span> note: &lt;span style="color:#50fa7b">closure&lt;/span> cannot be invoked once a variable from the outer scope has been moved out of
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff79c6">=&lt;/span> note: &lt;span style="color:#50fa7b">this&lt;/span> error originates &lt;span style="color:#ff79c6">in&lt;/span> the &lt;span style="color:#ff79c6">macro&lt;/span> `&lt;span style="color:#ff79c6">$crate&lt;/span>:: &lt;span style="color:#50fa7b">println&lt;/span> :: &lt;span style="color:#50fa7b">macro&lt;/span> :: &lt;span style="color:#50fa7b">_____&lt;/span> &lt;span style="color:#ff79c6">$&lt;/span>`
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ff79c6">---&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ff79c6">**&lt;/span>Additional Error Manifestations:&lt;span style="color:#ff79c6">**&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>```rust
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#6272a4">// Example 1: Double move error
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#6272a4">&lt;/span>&lt;span style="color:#8be9fd;font-style:italic">let&lt;/span> x &lt;span style="color:#ff79c6">=&lt;/span> vec![&lt;span style="color:#bd93f9">1&lt;/span>, &lt;span style="color:#bd93f9">2&lt;/span>, &lt;span style="color:#bd93f9">3&lt;/span>];
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8be9fd;font-style:italic">let&lt;/span> closure1 &lt;span style="color:#ff79c6">=&lt;/span> &lt;span style="color:#ff79c6">||&lt;/span> {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#8be9fd;font-style:italic">let&lt;/span> _y &lt;span style="color:#ff79c6">=&lt;/span> x; &lt;span style="color:#6272a4">// x is moved here
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#6272a4">&lt;/span>};
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8be9fd;font-style:italic">let&lt;/span> closure2 &lt;span style="color:#ff79c6">=&lt;/span> &lt;span style="color:#ff79c6">||&lt;/span> {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#8be9fd;font-style:italic">let&lt;/span> _z &lt;span style="color:#ff79c6">=&lt;/span> x; &lt;span style="color:#6272a4">// E0524: x was already moved
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#6272a4">&lt;/span>};
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#6272a4">// Example 2: Move after borrow
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#6272a4">&lt;/span>&lt;span style="color:#8be9fd;font-style:italic">let&lt;/span> &lt;span style="color:#ff79c6">mut&lt;/span> data &lt;span style="color:#ff79c6">=&lt;/span> &lt;span style="color:#8be9fd;font-style:italic">String&lt;/span>::from(&lt;span style="color:#f1fa8c">&amp;#34;hello&amp;#34;&lt;/span>);
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8be9fd;font-style:italic">let&lt;/span> print_fn &lt;span style="color:#ff79c6">=&lt;/span> &lt;span style="color:#ff79c6">||&lt;/span> println!(&lt;span style="color:#f1fa8c">&amp;#34;&lt;/span>&lt;span style="color:#f1fa8c">{}&lt;/span>&lt;span style="color:#f1fa8c">&amp;#34;&lt;/span>, data); &lt;span style="color:#6272a4">// borrowed here
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#6272a4">&lt;/span>&lt;span style="color:#8be9fd;font-style:italic">let&lt;/span> modify_fn &lt;span style="color:#ff79c6">=&lt;/span> &lt;span style="color:#ff79c6">||&lt;/span> {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> data.push_str(&lt;span style="color:#f1fa8c">&amp;#34; world&amp;#34;&lt;/span>); &lt;span style="color:#6272a4">// E0524: cannot move after borrow
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#6272a4">&lt;/span>};
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#6272a4">// Example 3: Complex closure scenario
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#6272a4">&lt;/span>&lt;span style="color:#ff79c6">fn&lt;/span> &lt;span style="color:#50fa7b">main&lt;/span>() {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#8be9fd;font-style:italic">let&lt;/span> value &lt;span style="color:#ff79c6">=&lt;/span> &lt;span style="color:#bd93f9">42&lt;/span>;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#8be9fd;font-style:italic">let&lt;/span> closure_a &lt;span style="color:#ff79c6">=&lt;/span> &lt;span style="color:#ff79c6">||&lt;/span> {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#8be9fd;font-style:italic">let&lt;/span> _captured &lt;span style="color:#ff79c6">=&lt;/span> value;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> println!(&lt;span style="color:#f1fa8c">&amp;#34;closure_a took ownership&amp;#34;&lt;/span>);
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> };
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#8be9fd;font-style:italic">let&lt;/span> closure_b &lt;span style="color:#ff79c6">=&lt;/span> &lt;span style="color:#ff79c6">||&lt;/span> {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> println!(&lt;span style="color:#f1fa8c">&amp;#34;value is still needed here: &lt;/span>&lt;span style="color:#f1fa8c">{}&lt;/span>&lt;span style="color:#f1fa8c">&amp;#34;&lt;/span>, value); &lt;span style="color:#6272a4">// E0524
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#6272a4">&lt;/span> };
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> closure_a();
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> closure_b();
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>The compiler error always indicates which closure performed the first capture and which line attempted the second capture, making it relatively straightforward to identify the conflict point.&lt;/p></description></item><item><title>Fix E0067: illegal erase coercion</title><link>https://errorvault.dev/rust/rust-e0067-illegal-erase-coercion/</link><pubDate>Sun, 26 Apr 2026 05:32:04 +0800</pubDate><guid>https://errorvault.dev/rust/rust-e0067-illegal-erase-coercion/</guid><description>&lt;h1 id="fix-e0067-illegal-erase-coercion">Fix E0067: illegal erase coercion&lt;/h1>
&lt;p>Error &lt;code>E0067&lt;/code> is a Rust compiler error that signals an attempt to perform an illegal &amp;ldquo;erase&amp;rdquo; coercion. In Rust&amp;rsquo;s type system, certain type conversions are allowed implicitly (coercions), but others are not. This error occurs when you try to erase a lifetime or otherwise remove type information in a way that Rust&amp;rsquo;s coercion system does not permit.&lt;/p>
&lt;h2 id="1-symptoms">1. Symptoms&lt;/h2>
&lt;h2 id="when-e0067-occurs-you-will-see-output-similar-to-this">When &lt;code>E0067&lt;/code> occurs, you will see output similar to this:&lt;/h2>
&lt;p>error[E0067]: illegal erase coercion
&amp;ndash;&amp;gt; src/main.rs:10:12
|
10 | let g: fn() = f;
| ^^^^
|
= note: this error was previously described as &amp;ldquo;illegal erase coercion&amp;rdquo;&lt;/p></description></item><item><title>Fix E0519: Private Type in Function Return Type</title><link>https://errorvault.dev/rust/rust-e0519-private-type-in-return-type/</link><pubDate>Sun, 26 Apr 2026 03:08:04 +0800</pubDate><guid>https://errorvault.dev/rust/rust-e0519-private-type-in-return-type/</guid><description>&lt;h2 id="1-symptoms">1. Symptoms&lt;/h2>
&lt;p>Error E0519 is a Rust compiler error that appears when you define a public function but the function&amp;rsquo;s return type references a type that is not accessible outside its defining module. The compiler prevents this because it would create an unusable API—callers would have no way to use the return value if they cannot see its type.&lt;/p>
&lt;p>The error message in Rust looks like this:&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-mysql" data-lang="mysql">&lt;span style="display:flex;">&lt;span>error[E0519]: private type &lt;span style="color:#ff79c6">`&lt;/span>InnerStruct&lt;span style="color:#ff79c6">`&lt;/span> &lt;span style="color:#ff79c6">in&lt;/span> &lt;span style="color:#ff79c6">return&lt;/span> type of this function
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff79c6">--&amp;gt;&lt;/span> src&lt;span style="color:#ff79c6">/&lt;/span>lib.rs:&lt;span style="color:#bd93f9">9&lt;/span>:&lt;span style="color:#bd93f9">5&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff79c6">|&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#bd93f9">9&lt;/span> &lt;span style="color:#ff79c6">|&lt;/span> pub fn &lt;span style="color:#50fa7b">get_inner&lt;/span>() &lt;span style="color:#ff79c6">-&amp;gt;&lt;/span> InnerStruct {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff79c6">|&lt;/span> &lt;span style="color:#ff79c6">^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^&lt;/span> private type &lt;span style="color:#ff79c6">in&lt;/span> &lt;span style="color:#ff79c6">return&lt;/span> type
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff79c6">|&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>note: &lt;span style="color:#ff79c6">`&lt;/span>InnerStruct&lt;span style="color:#ff79c6">`&lt;/span> &lt;span style="color:#ff79c6">is&lt;/span> private &lt;span style="color:#ff79c6">to&lt;/span> this module
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff79c6">--&amp;gt;&lt;/span> src&lt;span style="color:#ff79c6">/&lt;/span>lib.rs:&lt;span style="color:#bd93f9">1&lt;/span>:&lt;span style="color:#bd93f9">1&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff79c6">|&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#bd93f9">1&lt;/span> &lt;span style="color:#ff79c6">|&lt;/span> struct InnerStruct {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff79c6">|&lt;/span> &lt;span style="color:#ff79c6">^^^^^^^^^^^^^^^^^^&lt;/span> private struct
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>The compiler explicitly tells you which type is private and where it is defined. In this example, &lt;code>InnerStruct&lt;/code> is marked &lt;code>struct&lt;/code> (implicitly private) at line 1, but &lt;code>get_inner()&lt;/code> is marked &lt;code>pub fn&lt;/code> at line 9. This combination is invalid because external code cannot construct or interact with the return value.&lt;/p></description></item><item><title>Fix E0772: Function pointer called with wrong number of arguments</title><link>https://errorvault.dev/rust/rust-e0772-function-pointer-wrong-argument-count/</link><pubDate>Sat, 25 Apr 2026 17:32:04 +0800</pubDate><guid>https://errorvault.dev/rust/rust-e0772-function-pointer-wrong-argument-count/</guid><description>&lt;h2 id="1-symptoms">1. Symptoms&lt;/h2>
&lt;h2 id="the-rust-compiler-emits-error-e0772-when-attempting-to-invoke-a-function-pointer-with-a-mismatched-argument-count-this-error-occurs-during-the-type-checking-phase-of-compilation">The Rust compiler emits error E0772 when attempting to invoke a function pointer with a mismatched argument count. This error occurs during the type-checking phase of compilation.&lt;/h2>
&lt;p>error[E0772]: this function takes 2 argument(s) but 3 argument(s) were supplied
&amp;ndash;&amp;gt; src/main.rs:5:17
|
5 | let result = func_ptr(arg1, arg2, arg3);
| ^^^^^^^^^ &amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;-
| |
| unexpected argument&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>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>The compiler clearly indicates the discrepancy between the expected argument count and the actual number provided. In this case, the function pointer expects 2 arguments, but 3 were supplied.
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>**Additional symptom patterns:**
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>```rust
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>// Example 1: Too few arguments
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>error[E0772]: this function takes 3 argument(s) but 1 argument(s) were supplied
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> --&amp;gt; src/main.rs:10:20
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> |
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>10 | let result = func_ptr(arg1);
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> | ^^^^^^^^^ -- expected 2 more argument(s)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>// Example 2: Calling with zero arguments when one is expected
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>error[E0772]: this function takes 1 argument(s) but 0 argument(s) were supplied
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> --&amp;gt; src/main.rs:15:5
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> |
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>15 | func_ptr();
&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>// Example 3: With closures and function pointers
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>error[E0772]: this function takes 2 argument(s) but 3 argument(s) were supplied
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> --&amp;gt; src/main.rs:20:14
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> |
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>20 | (func_ptr)(1, 2, 3);
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> | ^^^^^^^^ ---------
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>The error message always follows the pattern: &lt;code>this function takes N argument(s) but M argument(s) were supplied&lt;/code>, where N is the expected count and M is the actual count.&lt;/p></description></item><item><title>Fix E0137: More Than One Trait Bound for Type</title><link>https://errorvault.dev/rust/rust-e0137-more-than-one-trait-bound/</link><pubDate>Fri, 24 Apr 2026 00:44:04 +0800</pubDate><guid>https://errorvault.dev/rust/rust-e0137-more-than-one-trait-bound/</guid><description>&lt;h2 id="1-symptoms">1. Symptoms&lt;/h2>
&lt;p>When you attempt to compile Rust code that specifies multiple trait bounds incorrectly for a single type parameter, the compiler halts with error E0137. This error manifests with a clear diagnostic message that identifies the problematic type and indicates that only one trait bound is allowed.&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-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>error&lt;span style="color:#ff79c6">[&lt;/span>E0137&lt;span style="color:#ff79c6">]&lt;/span>: more than one trait bound &lt;span style="color:#ff79c6">for&lt;/span> &lt;span style="color:#f1fa8c">`&lt;/span>TypeName&lt;span style="color:#f1fa8c">`&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> --&amp;gt; src/main.rs:5:20
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> |
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#bd93f9">5&lt;/span> | fn process&amp;lt;T: Clone + Display&amp;gt;&lt;span style="color:#ff79c6">(&lt;/span>value: T&lt;span style="color:#ff79c6">)&lt;/span> &lt;span style="color:#ff79c6">{}&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> | ^^^^^^^ help: consider joining the trait bounds with a &lt;span style="color:#f1fa8c">`&lt;/span>+&lt;span style="color:#f1fa8c">`&lt;/span>: &lt;span style="color:#f1fa8c">`&lt;/span>Clone + Display&lt;span style="color:#f1fa8c">`&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> |
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff79c6">=&lt;/span> note: this error is being displayed to you because of user-facing &lt;span style="color:#f1fa8c">`&lt;/span>.into_iter&lt;span style="color:#ff79c6">()&lt;/span>&lt;span style="color:#f1fa8c">`&lt;/span> &lt;span style="color:#8be9fd;font-style:italic">calls&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff79c6">=&lt;/span> note: rustc 1.75.0 &lt;span style="color:#ff79c6">(&lt;/span>firm version 3&lt;span style="color:#ff79c6">)&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>The compiler output explicitly points to the offending type parameter and shows the duplicate trait bounds. In most cases, the compiler helpfully suggests using the &lt;code>+&lt;/code> operator to combine multiple trait bounds properly.&lt;/p></description></item><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>