<feed xmlns='http://www.w3.org/2005/Atom'>
<title>rust/tests/ui/traits/question-mark-result-err-mismatch.stderr, branch master</title>
<subtitle>https://github.com/rust-lang/rust
</subtitle>
<id>http://git.dreamy.place/mirrors/rust/atom?h=master</id>
<link rel='self' href='http://git.dreamy.place/mirrors/rust/atom?h=master'/>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/'/>
<updated>2025-02-18T17:34:16+00:00</updated>
<entry>
<title>Don't mention `FromResidual` on bad `?`</title>
<updated>2025-02-18T17:34:16+00:00</updated>
<author>
<name>Esteban Küber</name>
<email>esteban@kuber.com.ar</email>
</author>
<published>2025-02-18T17:34:16+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=6eb48824dac44b466ca03fe67760a63d8a45d1dc'/>
<id>urn:sha1:6eb48824dac44b466ca03fe67760a63d8a45d1dc</id>
<content type='text'>
Unless `try_trait_v2` is enabled, don't mention that `FromResidual` isn't implemented for a specific type when the implicit `From` conversion of a `?` fails. For the end user on stable, `?` might as well be a compiler intrinsic, so we remove that note to avoid further confusion and allowing other parts of the error to be more prominent.

```
error[E0277]: `?` couldn't convert the error to `u8`
  --&gt; $DIR/bad-interconversion.rs:4:20
   |
LL | fn result_to_result() -&gt; Result&lt;u64, u8&gt; {
   |                          --------------- expected `u8` because of this
LL |     Ok(Err(123_i32)?)
   |        ------------^ the trait `From&lt;i32&gt;` is not implemented for `u8`
   |        |
   |        this can't be annotated with `?` because it has type `Result&lt;_, i32&gt;`
   |
   = note: the question mark operation (`?`) implicitly performs a conversion on the error value using the `From` trait
   = help: the following other types implement trait `From&lt;T&gt;`:
             `u8` implements `From&lt;Char&gt;`
             `u8` implements `From&lt;bool&gt;`
```
</content>
</entry>
<entry>
<title>Remove detail from label/note that is already available in other note</title>
<updated>2024-10-29T16:26:57+00:00</updated>
<author>
<name>Esteban Küber</name>
<email>esteban@kuber.com.ar</email>
</author>
<published>2024-10-24T21:14:17+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=5b542866400ad4a294f468cfa7e059d95c27a079'/>
<id>urn:sha1:5b542866400ad4a294f468cfa7e059d95c27a079</id>
<content type='text'>
Remove the "which is required by `{root_obligation}`" post-script in
"the trait `X` is not implemented for `Y`" explanation in E0277. This
information is already conveyed in the notes explaining requirements,
making it redundant while making the text (particularly in labels)
harder to read.

```
error[E0277]: the trait bound `NotCopy: Copy` is not satisfied
  --&gt; $DIR/wf-static-type.rs:10:13
   |
LL | static FOO: IsCopy&lt;Option&lt;NotCopy&gt;&gt; = IsCopy { t: None };
   |             ^^^^^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `NotCopy`
   |
   = note: required for `Option&lt;NotCopy&gt;` to implement `Copy`
note: required by a bound in `IsCopy`
  --&gt; $DIR/wf-static-type.rs:7:17
   |
LL | struct IsCopy&lt;T:Copy&gt; { t: T }
   |                 ^^^^ required by this bound in `IsCopy`
```
vs the prior

```
error[E0277]: the trait bound `NotCopy: Copy` is not satisfied
  --&gt; $DIR/wf-static-type.rs:10:13
   |
LL | static FOO: IsCopy&lt;Option&lt;NotCopy&gt;&gt; = IsCopy { t: None };
   |             ^^^^^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `NotCopy`, which is required by `Option&lt;NotCopy&gt;: Copy`
   |
   = note: required for `Option&lt;NotCopy&gt;` to implement `Copy`
note: required by a bound in `IsCopy`
  --&gt; $DIR/wf-static-type.rs:7:17
   |
LL | struct IsCopy&lt;T:Copy&gt; { t: T }
   |                 ^^^^ required by this bound in `IsCopy`
```
</content>
</entry>
<entry>
<title>Don't call const normalize in error reporting</title>
<updated>2024-09-22T17:55:06+00:00</updated>
<author>
<name>Michael Goulet</name>
<email>michael@errs.io</email>
</author>
<published>2024-09-22T17:52:20+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=8f579497f7578de85dd33d585c1818e1a6d3176a'/>
<id>urn:sha1:8f579497f7578de85dd33d585c1818e1a6d3176a</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Spell out other trait diagnostic</title>
<updated>2024-06-12T12:34:47+00:00</updated>
<author>
<name>Alex Macleod</name>
<email>alex@macleod.io</email>
</author>
<published>2024-06-07T14:54:42+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=d0112c68498470fe2945956b7ed24c5053cbf182'/>
<id>urn:sha1:d0112c68498470fe2945956b7ed24c5053cbf182</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Use `TraitRef::to_string` sorting in favor of `TraitRef::ord`, as the latter compares `DefId`s which we need to avoid</title>
<updated>2024-03-27T14:02:15+00:00</updated>
<author>
<name>Oli Scherer</name>
<email>git-spam-no-reply9815368754983@oli-obk.de</email>
</author>
<published>2024-03-21T12:55:28+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=ae24fef028ca9b27c3209fca1229a99d45873774'/>
<id>urn:sha1:ae24fef028ca9b27c3209fca1229a99d45873774</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Provide more context on derived obligation error primary label</title>
<updated>2024-01-30T21:28:18+00:00</updated>
<author>
<name>Esteban Küber</name>
<email>esteban@kuber.com.ar</email>
</author>
<published>2024-01-29T18:31:02+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=6efddac288643c4b0bc85ea317ea275e6cb4739f'/>
<id>urn:sha1:6efddac288643c4b0bc85ea317ea275e6cb4739f</id>
<content type='text'>
Expand the primary span of E0277 when the immediate unmet bound is not what the user wrote:

```
error[E0277]: the trait bound `i32: Bar` is not satisfied
 --&gt; f100.rs:6:6
  |
6 |     &lt;i32 as Foo&gt;::foo();
  |      ^^^ the trait `Bar` is not implemented for `i32`, which is required by `i32: Foo`
  |
help: this trait has no implementations, consider adding one
 --&gt; f100.rs:2:1
  |
2 | trait Bar {}
  | ^^^^^^^^^
note: required for `i32` to implement `Foo`
 --&gt; f100.rs:3:14
  |
3 | impl&lt;T: Bar&gt; Foo for T {}
  |         ---  ^^^     ^
  |         |
  |         unsatisfied trait bound introduced here
```

Fix #40120.
</content>
</entry>
<entry>
<title>Reduce verbosity of error</title>
<updated>2023-12-05T22:24:33+00:00</updated>
<author>
<name>Esteban Küber</name>
<email>esteban@kuber.com.ar</email>
</author>
<published>2023-10-07T03:58:45+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=70fe624b3d82aee2d32908f3fe2216002a207846'/>
<id>urn:sha1:70fe624b3d82aee2d32908f3fe2216002a207846</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Detect incorrect `;` in `Option::ok_or_else` and `Result::map_err`</title>
<updated>2023-12-05T22:24:29+00:00</updated>
<author>
<name>Esteban Küber</name>
<email>esteban@kuber.com.ar</email>
</author>
<published>2023-10-07T03:47:02+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=98e5317173679763bd6f25e3d925d63dd644baee'/>
<id>urn:sha1:98e5317173679763bd6f25e3d925d63dd644baee</id>
<content type='text'>
Fix #72124.
</content>
</entry>
<entry>
<title>Point at fewer methods in the chain, only those that change the E type</title>
<updated>2023-12-05T22:22:13+00:00</updated>
<author>
<name>Esteban Küber</name>
<email>esteban@kuber.com.ar</email>
</author>
<published>2023-10-07T01:14:43+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=53817963ed8796b35f802d87866aea8de5d4caf6'/>
<id>urn:sha1:53817963ed8796b35f802d87866aea8de5d4caf6</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Provide context when `?` can't be called because of `Result&lt;_, E&gt;`</title>
<updated>2023-12-05T22:22:08+00:00</updated>
<author>
<name>Esteban Küber</name>
<email>esteban@kuber.com.ar</email>
</author>
<published>2023-10-06T19:07:05+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=6c3879d1f154bb6f18562d29aa30fbc03239c66f'/>
<id>urn:sha1:6c3879d1f154bb6f18562d29aa30fbc03239c66f</id>
<content type='text'>
When a method chain ending in `?` causes an E0277 because the
expression's `Result::Err` variant doesn't have a type that can be
converted to the `Result&lt;_, E&gt;` type parameter in the return type,
provide additional context of which parts of the chain can and can't
support the `?` operator.

```
error[E0277]: `?` couldn't convert the error to `String`
  --&gt; $DIR/question-mark-result-err-mismatch.rs:28:25
   |
LL | fn bar() -&gt; Result&lt;(), String&gt; {
   |             ------------------ expected `String` because of this
LL |     let x = foo();
   |             ----- this can be annotated with `?` because it has type `Result&lt;String, String&gt;`
LL |     let one = x
LL |         .map(|s| ())
   |          ----------- this can be annotated with `?` because it has type `Result&lt;(), String&gt;`
LL |         .map_err(|_| ())?;
   |          ---------------^ the trait `From&lt;()&gt;` is not implemented for `String`
   |          |
   |          this can't be annotated with `?` because it has type `Result&lt;(), ()&gt;`
   |
   = note: the question mark operation (`?`) implicitly performs a conversion on the error value using the `From` trait
   = help: the following other types implement trait `From&lt;T&gt;`:
             &lt;String as From&lt;char&gt;&gt;
             &lt;String as From&lt;Box&lt;str&gt;&gt;&gt;
             &lt;String as From&lt;Cow&lt;'a, str&gt;&gt;&gt;
             &lt;String as From&lt;&amp;str&gt;&gt;
             &lt;String as From&lt;&amp;mut str&gt;&gt;
             &lt;String as From&lt;&amp;String&gt;&gt;
   = note: required for `Result&lt;(), String&gt;` to implement `FromResidual&lt;Result&lt;Infallible, ()&gt;&gt;`
```

Fix #72124.
</content>
</entry>
</feed>
