<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Trait on ErrorVault — Developer Error Code Dictionary</title>
    <link>https://errorvault.dev/tags/trait/</link>
    <description>Recent content in Trait on ErrorVault — Developer Error Code Dictionary</description>
    <generator>Hugo</generator>
    <language>en-us</language>
    <lastBuildDate>Fri, 31 Jul 2026 05:32:04 +0800</lastBuildDate>
    <atom:link href="https://errorvault.dev/tags/trait/feed.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Fix E0390: Rust Method Self Parameter Mismatch Between Trait and Implementation</title>
      <link>https://errorvault.dev/rust/rust-e0390-method-self-parameter-mismatch/</link>
      <pubDate>Fri, 31 Jul 2026 05:32:04 +0800</pubDate>
      <guid>https://errorvault.dev/rust/rust-e0390-method-self-parameter-mismatch/</guid>
      <description>&lt;h2 id=&#34;1-symptoms&#34;&gt;1. Symptoms&lt;/h2&gt;&#xA;&lt;p&gt;When the Rust compiler encounters error E0390, it produces a diagnostic message that clearly indicates a mismatch between the trait definition and its implementation. The compiler output typically appears as follows:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-mysql&#34; data-lang=&#34;mysql&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;error[E0390]: method &lt;span style=&#34;color:#ff79c6&#34;&gt;`&lt;/span&gt;method_name&lt;span style=&#34;color:#ff79c6&#34;&gt;`&lt;/span&gt; has a &lt;span style=&#34;color:#ff79c6&#34;&gt;`&amp;amp;&lt;/span&gt;self&lt;span style=&#34;color:#ff79c6&#34;&gt;`&lt;/span&gt; declaration &lt;span style=&#34;color:#ff79c6&#34;&gt;in&lt;/span&gt; the impl, but &lt;span style=&#34;color:#ff79c6&#34;&gt;not&lt;/span&gt; &lt;span style=&#34;color:#ff79c6&#34;&gt;in&lt;/span&gt; the trait&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#ff79c6&#34;&gt;--&amp;gt;&lt;/span&gt; src&lt;span style=&#34;color:#ff79c6&#34;&gt;/&lt;/span&gt;main.rs:&lt;span style=&#34;color:#bd93f9&#34;&gt;10&lt;/span&gt;:&lt;span style=&#34;color:#bd93f9&#34;&gt;1&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;   &lt;span style=&#34;color:#ff79c6&#34;&gt;|&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bd93f9&#34;&gt;5&lt;/span&gt;  &lt;span style=&#34;color:#ff79c6&#34;&gt;|&lt;/span&gt;     fn &lt;span style=&#34;color:#50fa7b&#34;&gt;method_name&lt;/span&gt;(&lt;span style=&#34;color:#ff79c6&#34;&gt;&amp;amp;&lt;/span&gt;self);&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;   &lt;span style=&#34;color:#ff79c6&#34;&gt;|&lt;/span&gt;     &lt;span style=&#34;color:#ff79c6&#34;&gt;-----------------&lt;/span&gt;&lt;span style=&#34;color:#6272a4&#34;&gt;-- the trait has no `&amp;amp;self` declaration&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;...&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bd93f9&#34;&gt;10&lt;/span&gt; &lt;span style=&#34;color:#ff79c6&#34;&gt;|&lt;/span&gt;     fn &lt;span style=&#34;color:#50fa7b&#34;&gt;method_name&lt;/span&gt;(&lt;span style=&#34;color:#ff79c6&#34;&gt;&amp;amp;&lt;/span&gt;self) { ... }&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;   &lt;span style=&#34;color:#ff79c6&#34;&gt;|&lt;/span&gt;     &lt;span style=&#34;color:#ff79c6&#34;&gt;^^^^^^^^^^^^^^^^^^^^^&lt;/span&gt; the impl has a &lt;span style=&#34;color:#ff79c6&#34;&gt;`&amp;amp;&lt;/span&gt;self&lt;span style=&#34;color:#ff79c6&#34;&gt;`&lt;/span&gt; declaration&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Alternatively, you may encounter the inverse situation where the trait declares &lt;code&gt;&amp;amp;self&lt;/code&gt; but the implementation does not:&lt;/p&gt;</description>
    </item>
    <item>
      <title>Fix E0398: Rust Compiler Error E0398 Explained</title>
      <link>https://errorvault.dev/rust/rust-e0398-impl-items-override/</link>
      <pubDate>Mon, 06 Jul 2026 07:56:04 +0800</pubDate>
      <guid>https://errorvault.dev/rust/rust-e0398-impl-items-override/</guid>
      <description>&lt;h2 id=&#34;1-symptoms&#34;&gt;1. Symptoms&lt;/h2&gt;&#xA;&lt;p&gt;The Rust compiler emits error E0398 when you attempt to implement an item that does not override anything from a trait definition. This error typically manifests during compilation and prevents the code from building successfully.&lt;/p&gt;&#xA;&lt;p&gt;When you encounter E0398, you will see output similar to the following:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;error&lt;span style=&#34;color:#ff79c6&#34;&gt;[&lt;/span&gt;E0398&lt;span style=&#34;color:#ff79c6&#34;&gt;]&lt;/span&gt;: &lt;span style=&#34;color:#f1fa8c&#34;&gt;`&lt;/span&gt;impl_item&lt;span style=&#34;color:#f1fa8c&#34;&gt;`&lt;/span&gt; is not a method from the trait&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; --&amp;gt; src/main.rs:3:5&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  |&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bd93f9&#34;&gt;3&lt;/span&gt; |     fn impl_item&lt;span style=&#34;color:#ff79c6&#34;&gt;(&lt;/span&gt;&amp;amp;self&lt;span style=&#34;color:#ff79c6&#34;&gt;)&lt;/span&gt; &lt;span style=&#34;color:#ff79c6&#34;&gt;{&lt;/span&gt; &lt;span style=&#34;color:#ff79c6&#34;&gt;}&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  |     ^^^^^^^^^^^^^^^^^^&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  |&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#ff79c6&#34;&gt;=&lt;/span&gt; note: this error &lt;span style=&#34;color:#ff79c6&#34;&gt;function&lt;/span&gt;&lt;span style=&#34;color:#f1fa8c&#34;&gt;&amp;#39;s name doesn&amp;#39;&lt;/span&gt;t follow the naming convention of its trait&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The error message indicates that the compiler has found an &lt;code&gt;impl&lt;/code&gt; block containing a method or associated item that does not correspond to any item defined in the target trait. This situation commonly arises when you rename a method in your trait definition but forget to update the corresponding implementation, or when you accidentally add an extra method to an impl block that should only contain trait implementations.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Fix E0514: Mismatched Return Type Between Trait Signature and Function Body</title>
      <link>https://errorvault.dev/rust/rust-e0514-mismatched-return-type/</link>
      <pubDate>Sun, 10 May 2026 19:56:04 +0800</pubDate>
      <guid>https://errorvault.dev/rust/rust-e0514-mismatched-return-type/</guid>
      <description>&lt;h1 id=&#34;fix-e0514-mismatched-return-type-between-trait-signature-and-function-body&#34;&gt;Fix E0514: Mismatched Return Type Between Trait Signature and Function Body&lt;/h1&gt;&#xA;&lt;p&gt;Rust&amp;rsquo;s compiler is strict about type consistency. Every function declares an expected return type, either explicitly via the return type annotation or implicitly through the function body. When the body of a function produces a value of a different type than what the signature promises, the compiler emits &lt;strong&gt;error E0514&lt;/strong&gt;. This error surfaces most frequently when working with traits, generics, and complex return type annotations.&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
