Skip to content

Account for type alias projections in E0308 "expected/found" shortening logic#159189

Open
estebank wants to merge 2 commits into
rust-lang:mainfrom
estebank:issue-159043
Open

Account for type alias projections in E0308 "expected/found" shortening logic#159189
estebank wants to merge 2 commits into
rust-lang:mainfrom
estebank:issue-159043

Conversation

@estebank

@estebank estebank commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

View all comments

When encountering a E0308 error involving ty::Projections, highlight only the sub-parts that are actually relevant:

error[E0308]: mismatched types
  --> tests/ui/associated-types/long-type-E0308.rs:19:5
   |
16 | fn foo<'a, T: FooBar>(value: T) -> <<<T::Wrapper<T> as FooBar>::Assoc as FooBar>::Assoc as FooBar>::Wrapper<<T::Assoc as FooBar>::Assoc> {
   |                                    ----------------------------------------------------------------------------------------------------- expected `<<<... as FooBar>::Assoc as FooBar>::Assoc as FooBar>::Wrapper<...>` because of return type
...
19 |     value.assoc().assoc().assoc().wrap(value.assoc().assoc())
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `really_really_really_long_module::FooBar::Wrapper`, found `really_really_really_long_module::FooBar::Assoc`
   |
   = note: expected associated type `<<<<_ as FooBar>::Wrapper<T> as FooBar>::Assoc as FooBar>::Assoc as FooBar>::Wrapper<_>`
              found associated type `<<<<_ as FooBar>::Assoc as FooBar>::Assoc as FooBar>::Assoc as FooBar>::Wrapper<_>`
   = note: an associated type was expected, but a different one was found
   = note: the full name for the type has been written to 'long-type-E0308.long-type-5396540309891820670.txt'
   = note: consider using `--verbose` to print the full type name to the console

Fix #159043, by including a textual type shortening logic that operates on the highlighted text on really narrow terminals:

error[E0308]: mismatched types
  --> $DIR/long-type-E0308.rs:30:5
   |
LL |   ) -> <
   |  ______-
LL | |     <
LL | |         <T::Wrapper<T> as FooBar>::Assoc as FooBar
LL | |     >::Assoc as FooBar
LL | | >::Wrapper<<T::Assoc as FooBar>::Assoc>
   | |_______________________________________- expected `<_ as FooBar>::Wrapper<_>` because of return type
...
LL |       value...oc())
   |       ^^^^^...^^^^^ expected `really_really_really_long_module::FooBar::Wrapper`, found `really_really_really_long_module::FooBar::Assoc`
   |
   = note: expected associated type `<<<<_ as FooBar>::Wrapper<_> as...pper<_>`
              found associated type `<<<<_ as FooBar>::Assoc as Fo...pper<_>`
   = note: an associated type was expected, but a different one was found
   = note: the full name for the type has been written to '$TEST_BUILD_DIR/long-type-E0308.long-type-$LONG_TYPE_HASH.txt'
   = note: consider using `--verbose` to print the full type name to the console

r? @chenyukang

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jul 12, 2026
@rust-log-analyzer

This comment has been minimized.

@estebank
estebank marked this pull request as ready for review July 12, 2026 20:29
@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jul 12, 2026
Comment thread compiler/rustc_trait_selection/src/error_reporting/infer/mod.rs Outdated
Comment thread compiler/rustc_trait_selection/src/error_reporting/infer/mod.rs
@rustbot

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment was marked as resolved.

@rust-log-analyzer

This comment has been minimized.

Comment thread compiler/rustc_trait_selection/src/error_reporting/infer/mod.rs Outdated
@rustbot

This comment has been minimized.

…ng logic

When encountering a E0308 error involving `ty::Projection`s, highlight only the sub-parts that are actually relevant:

```
error[E0308]: mismatched types
  --> tests/ui/associated-types/long-type-E0308.rs:19:5
   |
16 | fn foo<'a, T: FooBar>(value: T) -> <<<T::Wrapper<T> as FooBar>::Assoc as FooBar>::Assoc as FooBar>::Wrapper<<T::Assoc as FooBar>::Assoc> {
   |                                    ----------------------------------------------------------------------------------------------------- expected `<<<... as FooBar>::Assoc as FooBar>::Assoc as FooBar>::Wrapper<...>` because of return type
...
19 |     value.assoc().assoc().assoc().wrap(value.assoc().assoc())
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `really_really_really_long_module::FooBar::Wrapper`, found `really_really_really_long_module::FooBar::Assoc`
   |
   = note: expected associated type `<<<<_ as FooBar>::Wrapper<T> as FooBar>::Assoc as FooBar>::Assoc as FooBar>::Wrapper<_>`
              found associated type `<<<<_ as FooBar>::Assoc as FooBar>::Assoc as FooBar>::Assoc as FooBar>::Wrapper<_>`
   = note: an associated type was expected, but a different one was found
   = note: the full name for the type has been written to 'long-type-E0308.long-type-5396540309891820670.txt'
   = note: consider using `--verbose` to print the full type name to the console
```

Deduplicate param highlighting logic.

Account for type param difference in trait in E0308 highlighting.
@rustbot

rustbot commented Jul 17, 2026

Copy link
Copy Markdown
Collaborator

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

Comment thread compiler/rustc_trait_selection/src/error_reporting/infer/mod.rs Outdated
Comment thread compiler/rustc_errors/src/diagnostic.rs Outdated
@chenyukang

Copy link
Copy Markdown
Member

No other issues except two trivial one.
r=me after resolve it.

…e highlighted string instead

Introduce a mechanism to textually trim highlighted strings, so that we can print out "expected/found" note with shorter output while still keeping the highlighted inner parts.

```
error[E0308]: mismatched types
  --> $DIR/long-type-E0308.rs:30:5
   |
LL |   ) -> <
   |  ______-
LL | |     <
LL | |         <T::Wrapper<T> as FooBar>::Assoc as FooBar
LL | |     >::Assoc as FooBar
LL | | >::Wrapper<<T::Assoc as FooBar>::Assoc>
   | |_______________________________________- expected `<_ as FooBar>::Wrapper<_>` because of return type
...
LL |       value...oc())
   |       ^^^^^...^^^^^ expected `really_really_really_long_module::FooBar::Wrapper`, found `really_really_really_long_module::FooBar::Assoc`
   |
   = note: expected associated type `<<<<_ as FooBar>::Wrapper<_> as...pper<_>`
              found associated type `<<<<_ as FooBar>::Assoc as Fo...pper<_>`
   = note: an associated type was expected, but a different one was found
   = note: the full name for the type has been written to '$TEST_BUILD_DIR/long-type-E0308.long-type-$LONG_TYPE_HASH.txt'
   = note: consider using `--verbose` to print the full type name to the console
```
@estebank

Copy link
Copy Markdown
Contributor Author

@bors r=chenyukang

@rust-bors

rust-bors Bot commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 068c52f has been approved by chenyukang

It is now in the queue for this repository.

@rust-bors rust-bors Bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jul 18, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Jul 18, 2026
Account for type alias projections in E0308 "expected/found" shortening logic

When encountering a E0308 error involving `ty::Projection`s, highlight only the sub-parts that are actually relevant:

```
error[E0308]: mismatched types
  --> tests/ui/associated-types/long-type-E0308.rs:19:5
   |
16 | fn foo<'a, T: FooBar>(value: T) -> <<<T::Wrapper<T> as FooBar>::Assoc as FooBar>::Assoc as FooBar>::Wrapper<<T::Assoc as FooBar>::Assoc> {
   |                                    ----------------------------------------------------------------------------------------------------- expected `<<<... as FooBar>::Assoc as FooBar>::Assoc as FooBar>::Wrapper<...>` because of return type
...
19 |     value.assoc().assoc().assoc().wrap(value.assoc().assoc())
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `really_really_really_long_module::FooBar::Wrapper`, found `really_really_really_long_module::FooBar::Assoc`
   |
   = note: expected associated type `<<<<_ as FooBar>::Wrapper<T> as FooBar>::Assoc as FooBar>::Assoc as FooBar>::Wrapper<_>`
              found associated type `<<<<_ as FooBar>::Assoc as FooBar>::Assoc as FooBar>::Assoc as FooBar>::Wrapper<_>`
   = note: an associated type was expected, but a different one was found
   = note: the full name for the type has been written to 'long-type-E0308.long-type-5396540309891820670.txt'
   = note: consider using `--verbose` to print the full type name to the console
```

Fix rust-lang#159043, by including a textual type shortening logic that operates on the highlighted text on really narrow terminals:

```
error[E0308]: mismatched types
  --> $DIR/long-type-E0308.rs:30:5
   |
LL |   ) -> <
   |  ______-
LL | |     <
LL | |         <T::Wrapper<T> as FooBar>::Assoc as FooBar
LL | |     >::Assoc as FooBar
LL | | >::Wrapper<<T::Assoc as FooBar>::Assoc>
   | |_______________________________________- expected `<_ as FooBar>::Wrapper<_>` because of return type
...
LL |       value...oc())
   |       ^^^^^...^^^^^ expected `really_really_really_long_module::FooBar::Wrapper`, found `really_really_really_long_module::FooBar::Assoc`
   |
   = note: expected associated type `<<<<_ as FooBar>::Wrapper<_> as...pper<_>`
              found associated type `<<<<_ as FooBar>::Assoc as Fo...pper<_>`
   = note: an associated type was expected, but a different one was found
   = note: the full name for the type has been written to '$TEST_BUILD_DIR/long-type-E0308.long-type-$LONG_TYPE_HASH.txt'
   = note: consider using `--verbose` to print the full type name to the console
```

r? @chenyukang
rust-bors Bot pushed a commit that referenced this pull request Jul 18, 2026
…uwer

Rollup of 5 pull requests

Successful merges:

 - #159189 (Account for type alias projections in E0308 "expected/found" shortening logic)
 - #158545 (Move `std::io::read_to_string` to `alloc::io`)
 - #159328 (tests/assembly-llvm: pin frame pointer in issue-141649 aarch64 test)
 - #159470 (Fix string indexing in diagnostic format strings)
 - #159500 (Move compiletest CLI parsing to `cli.rs`)
@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Jul 18, 2026
Account for type alias projections in E0308 "expected/found" shortening logic

When encountering a E0308 error involving `ty::Projection`s, highlight only the sub-parts that are actually relevant:

```
error[E0308]: mismatched types
  --> tests/ui/associated-types/long-type-E0308.rs:19:5
   |
16 | fn foo<'a, T: FooBar>(value: T) -> <<<T::Wrapper<T> as FooBar>::Assoc as FooBar>::Assoc as FooBar>::Wrapper<<T::Assoc as FooBar>::Assoc> {
   |                                    ----------------------------------------------------------------------------------------------------- expected `<<<... as FooBar>::Assoc as FooBar>::Assoc as FooBar>::Wrapper<...>` because of return type
...
19 |     value.assoc().assoc().assoc().wrap(value.assoc().assoc())
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `really_really_really_long_module::FooBar::Wrapper`, found `really_really_really_long_module::FooBar::Assoc`
   |
   = note: expected associated type `<<<<_ as FooBar>::Wrapper<T> as FooBar>::Assoc as FooBar>::Assoc as FooBar>::Wrapper<_>`
              found associated type `<<<<_ as FooBar>::Assoc as FooBar>::Assoc as FooBar>::Assoc as FooBar>::Wrapper<_>`
   = note: an associated type was expected, but a different one was found
   = note: the full name for the type has been written to 'long-type-E0308.long-type-5396540309891820670.txt'
   = note: consider using `--verbose` to print the full type name to the console
```

Fix #159043, by including a textual type shortening logic that operates on the highlighted text on really narrow terminals:

```
error[E0308]: mismatched types
  --> $DIR/long-type-E0308.rs:30:5
   |
LL |   ) -> <
   |  ______-
LL | |     <
LL | |         <T::Wrapper<T> as FooBar>::Assoc as FooBar
LL | |     >::Assoc as FooBar
LL | | >::Wrapper<<T::Assoc as FooBar>::Assoc>
   | |_______________________________________- expected `<_ as FooBar>::Wrapper<_>` because of return type
...
LL |       value...oc())
   |       ^^^^^...^^^^^ expected `really_really_really_long_module::FooBar::Wrapper`, found `really_really_really_long_module::FooBar::Assoc`
   |
   = note: expected associated type `<<<<_ as FooBar>::Wrapper<_> as...pper<_>`
              found associated type `<<<<_ as FooBar>::Assoc as Fo...pper<_>`
   = note: an associated type was expected, but a different one was found
   = note: the full name for the type has been written to '$TEST_BUILD_DIR/long-type-E0308.long-type-$LONG_TYPE_HASH.txt'
   = note: consider using `--verbose` to print the full type name to the console
```

r? @chenyukang
@rust-log-analyzer

Copy link
Copy Markdown
Collaborator

The job aarch64-msvc-1 failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)

failures:

---- [ui] tests\ui\associated-types\long-type-E0308.rs#short-color stdout ----
Saved the actual windows.svg to `C:\a\rust\rust\build\aarch64-pc-windows-msvc\test\ui\associated-types\long-type-E0308.short-color\long-type-E0308.short-color.windows.svg`
normalized windows.svg:
<svg width="1583px" height="920px" xmlns="http://www.w3.org/2000/svg">
  <style>
    .fg { fill: #AAAAAA }
    .bg { fill: #000000 }
    .fg-bright-cyan { fill: #55FFFF }
    .fg-bright-red { fill: #FF5555 }
    .fg-bright-white { fill: #FFFFFF }
    .fg-magenta { fill: #AA00AA }
    .container {
      padding: 0 10px;
      line-height: 18px;
    }
    .bold { font-weight: bold; }
    tspan {
      font: 14px SFMono-Regular, Consolas, Liberation Mono, Menlo, monospace;
      white-space: pre;
      line-height: 18px;
    }
  </style>

  <rect width="100%" height="100%" y="0" rx="4.5" class="bg" />

  <text xml:space="preserve" class="container fg">
    <tspan x="10px" y="28px"><tspan class="fg-bright-red bold">error[E0308]</tspan><tspan class="fg-bright-white bold">: mismatched types</tspan>
</tspan>
    <tspan x="10px" y="46px"><tspan>  </tspan><tspan class="fg-bright-cyan bold">--&gt; </tspan><tspan>$DIR/long-type-E0308.rs:30:5</tspan>
</tspan>
    <tspan x="10px" y="64px"><tspan>   </tspan><tspan class="fg-bright-cyan bold">|</tspan>
</tspan>
    <tspan x="10px" y="82px"><tspan class="fg-bright-cyan bold">LL</tspan><tspan> </tspan><tspan class="fg-bright-cyan bold">|</tspan><tspan>   ) -&gt; &lt;</tspan>
</tspan>
    <tspan x="10px" y="100px"><tspan>   </tspan><tspan class="fg-bright-cyan bold">|</tspan><tspan> </tspan><tspan class="fg-bright-cyan bold"> ______-</tspan>
</tspan>
    <tspan x="10px" y="118px"><tspan class="fg-bright-cyan bold">LL</tspan><tspan> </tspan><tspan class="fg-bright-cyan bold">|</tspan><tspan> </tspan><tspan class="fg-bright-cyan bold">|</tspan><tspan>     &lt;</tspan>
</tspan>
    <tspan x="10px" y="136px"><tspan class="fg-bright-cyan bold">LL</tspan><tspan> </tspan><tspan class="fg-bright-cyan bold">|</tspan><tspan> </tspan><tspan class="fg-bright-cyan bold">|</tspan><tspan>         &lt;T::Wrapper&lt;T&gt; as FooBar&gt;::Assoc as FooBar</tspan>
</tspan>
    <tspan x="10px" y="154px"><tspan class="fg-bright-cyan bold">LL</tspan><tspan> </tspan><tspan class="fg-bright-cyan bold">|</tspan><tspan> </tspan><tspan class="fg-bright-cyan bold">|</tspan><tspan>     &gt;::Assoc as FooBar</tspan>
</tspan>
    <tspan x="10px" y="172px"><tspan class="fg-bright-cyan bold">LL</tspan><tspan> </tspan><tspan class="fg-bright-cyan bold">|</tspan><tspan> </tspan><tspan class="fg-bright-cyan bold">|</tspan><tspan> &gt;::Wrapper&lt;&lt;T::Assoc as FooBar&gt;::Assoc&gt;</tspan>
</tspan>
    <tspan x="10px" y="190px"><tspan>   </tspan><tspan class="fg-bright-cyan bold">|</tspan><tspan> </tspan><tspan class="fg-bright-cyan bold">|_______________________________________-</tspan><tspan> </tspan><tspan class="fg-bright-cyan bold">expected `&lt;&lt;_ as FooBar&gt;::Assoc as FooBar&gt;::Wrapper&lt;_&gt;` because of return type</tspan>
</tspan>
    <tspan x="10px" y="208px"><tspan class="fg-bright-cyan bold">...</tspan>
</tspan>
    <tspan x="10px" y="226px"><tspan class="fg-bright-cyan bold">LL</tspan><tspan> </tspan><tspan class="fg-bright-cyan bold">|</tspan><tspan>       value.assoc().assoc().assoc().wrap(value.assoc().assoc())</tspan>
</tspan>
    <tspan x="10px" y="244px"><tspan>   </tspan><tspan class="fg-bright-cyan bold">|</tspan><tspan>       </tspan><tspan class="fg-bright-red bold">^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^</tspan><tspan> </tspan><tspan class="fg-bright-red bold">expected `really_really_really_long_module::FooBar::Wrapper`, found `really_really_really_long_module::FooBar::Assoc`</tspan>
</tspan>
    <tspan x="10px" y="262px"><tspan>   </tspan><tspan class="fg-bright-cyan bold">|</tspan>
</tspan>
    <tspan x="10px" y="280px"><tspan>   </tspan><tspan class="fg-bright-cyan bold">= </tspan><tspan class="fg-bright-white bold">note</tspan><tspan>: expected associated type `&lt;&lt;&lt;&lt;_ as FooBar&gt;::</tspan><tspan class="fg-magenta bold">Wrapper</tspan><tspan>&lt;_&gt; as FooBar&gt;::Assoc as FooBar&gt;::Assoc as FooBar&gt;::Wrapper&lt;_&gt;`</tspan>
</tspan>
    <tspan x="10px" y="298px"><tspan>              found associated type `&lt;&lt;&lt;&lt;_ as FooBar&gt;::</tspan><tspan class="fg-magenta bold">Assoc</tspan><tspan> as FooBar&gt;::Assoc as FooBar&gt;::Assoc as FooBar&gt;::Wrapper&lt;_&gt;`</tspan>
</tspan>
    <tspan x="10px" y="316px"><tspan>   </tspan><tspan class="fg-bright-cyan bold">= </tspan><tspan class="fg-bright-white bold">note</tspan><tspan>: an associated type was expected, but a different one was found</tspan>
</tspan>
    <tspan x="10px" y="334px"><tspan>   </tspan><tspan class="fg-bright-cyan bold">= </tspan><tspan class="fg-bright-white bold">note</tspan><tspan>: the full name for the type has been written to '$TEST_BUILD_DIR/long-type-E0308.long-type-$LONG_TYPE_HASH.txt'</tspan>
</tspan>
    <tspan x="10px" y="352px"><tspan>   </tspan><tspan class="fg-bright-cyan bold">= </tspan><tspan class="fg-bright-white bold">note</tspan><tspan>: consider using `--verbose` to print the full type name to the console</tspan>
</tspan>
    <tspan x="10px" y="370px">
</tspan>
    <tspan x="10px" y="388px"><tspan class="fg-bright-red bold">error[E0308]</tspan><tspan class="fg-bright-white bold">: mismatched types</tspan>
</tspan>
    <tspan x="10px" y="406px"><tspan>  </tspan><tspan class="fg-bright-cyan bold">--&gt; </tspan><tspan>$DIR/long-type-E0308.rs:44:5</tspan>
</tspan>
    <tspan x="10px" y="424px"><tspan>   </tspan><tspan class="fg-bright-cyan bold">|</tspan>
</tspan>
    <tspan x="10px" y="442px"><tspan class="fg-bright-cyan bold">LL</tspan><tspan> </tspan><tspan class="fg-bright-cyan bold">|</tspan><tspan> fn bar&lt;T&gt;(x: &lt;T as Bar&lt;u8&gt;&gt;::Assoc) -&gt; &lt;T as Bar&lt;u16&gt;&gt;::Assoc</tspan>
</tspan>
    <tspan x="10px" y="460px"><tspan>   </tspan><tspan class="fg-bright-cyan bold">|</tspan><tspan>                                        </tspan><tspan class="fg-bright-cyan bold">----------------------</tspan><tspan> </tspan><tspan class="fg-bright-cyan bold">expected `&lt;T as Bar&lt;u16&gt;&gt;::Assoc` because of return type</tspan>
</tspan>
    <tspan x="10px" y="478px"><tspan class="fg-bright-cyan bold">...</tspan>
</tspan>
    <tspan x="10px" y="496px"><tspan class="fg-bright-cyan bold">LL</tspan><tspan> </tspan><tspan class="fg-bright-cyan bold">|</tspan><tspan>     x</tspan>
</tspan>
    <tspan x="10px" y="514px"><tspan>   </tspan><tspan class="fg-bright-cyan bold">|</tspan><tspan>     </tspan><tspan class="fg-bright-red bold">^</tspan><tspan> </tspan><tspan class="fg-bright-red bold">expected `u16`, found `u8`</tspan>
</tspan>
    <tspan x="10px" y="532px"><tspan>   </tspan><tspan class="fg-bright-cyan bold">|</tspan>
</tspan>
    <tspan x="10px" y="550px"><tspan>   </tspan><tspan class="fg-bright-cyan bold">= </tspan><tspan class="fg-bright-white bold">note</tspan><tspan>: expected associated type `&lt;_ as Bar&lt;</tspan><tspan class="fg-magenta bold">u16</tspan><tspan>&gt;&gt;::Assoc`</tspan>
</tspan>
    <tspan x="10px" y="568px"><tspan>              found associated type `&lt;_ as Bar&lt;</tspan><tspan class="fg-magenta bold">u8</tspan><tspan>&gt;&gt;::Assoc`</tspan>
</tspan>
    <tspan x="10px" y="586px"><tspan>   </tspan><tspan class="fg-bright-cyan bold">= </tspan><tspan class="fg-bright-white bold">note</tspan><tspan>: an associated type was expected, but a different one was found</tspan>
</tspan>
    <tspan x="10px" y="604px">
</tspan>
    <tspan x="10px" y="622px"><tspan class="fg-bright-red bold">error[E0308]</tspan><tspan class="fg-bright-white bold">: mismatched types</tspan>
</tspan>
    <tspan x="10px" y="640px"><tspan>  </tspan><tspan class="fg-bright-cyan bold">--&gt; </tspan><tspan>$DIR/long-type-E0308.rs:58:5</tspan>
</tspan>
    <tspan x="10px" y="658px"><tspan>   </tspan><tspan class="fg-bright-cyan bold">|</tspan>
</tspan>
    <tspan x="10px" y="676px"><tspan class="fg-bright-cyan bold">LL</tspan><tspan> </tspan><tspan class="fg-bright-cyan bold">|</tspan><tspan> fn qux&lt;T&gt;(x: &lt;T as Qux&gt;::Assoc&lt;u8&gt;) -&gt; &lt;T as Qux&gt;::Assoc&lt;u16&gt;</tspan>
</tspan>
    <tspan x="10px" y="694px"><tspan>   </tspan><tspan class="fg-bright-cyan bold">|</tspan><tspan>                                        </tspan><tspan class="fg-bright-cyan bold">----------------------</tspan><tspan> </tspan><tspan class="fg-bright-cyan bold">expected `&lt;T as Qux&gt;::Assoc&lt;u16&gt;` because of return type</tspan>
</tspan>
    <tspan x="10px" y="712px"><tspan class="fg-bright-cyan bold">...</tspan>
</tspan>
    <tspan x="10px" y="730px"><tspan class="fg-bright-cyan bold">LL</tspan><tspan> </tspan><tspan class="fg-bright-cyan bold">|</tspan><tspan>     x</tspan>
</tspan>
    <tspan x="10px" y="748px"><tspan>   </tspan><tspan class="fg-bright-cyan bold">|</tspan><tspan>     </tspan><tspan class="fg-bright-red bold">^</tspan><tspan> </tspan><tspan class="fg-bright-red bold">expected `u16`, found `u8`</tspan>
</tspan>
    <tspan x="10px" y="766px"><tspan>   </tspan><tspan class="fg-bright-cyan bold">|</tspan>
</tspan>
    <tspan x="10px" y="784px"><tspan>   </tspan><tspan class="fg-bright-cyan bold">= </tspan><tspan class="fg-bright-white bold">note</tspan><tspan>: expected associated type `&lt;_ as Qux&gt;::Assoc&lt;</tspan><tspan class="fg-magenta bold">u16</tspan><tspan>&gt;`</tspan>
</tspan>
    <tspan x="10px" y="802px"><tspan>              found associated type `&lt;_ as Qux&gt;::Assoc&lt;</tspan><tspan class="fg-magenta bold">u8</tspan><tspan>&gt;`</tspan>
</tspan>
    <tspan x="10px" y="820px"><tspan>   </tspan><tspan class="fg-bright-cyan bold">= </tspan><tspan class="fg-bright-white bold">note</tspan><tspan>: an associated type was expected, but a different one was found</tspan>
</tspan>
    <tspan x="10px" y="838px">
</tspan>
    <tspan x="10px" y="856px"><tspan class="fg-bright-red bold">error</tspan><tspan class="fg-bright-white bold">: aborting due to 3 previous errors</tspan>
</tspan>
    <tspan x="10px" y="874px">
</tspan>
    <tspan x="10px" y="892px"><tspan class="fg-bright-white bold">For more information about this error, try `rustc --explain E0308`.</tspan>
</tspan>
    <tspan x="10px" y="910px">
</tspan>
  </text>

</svg>



The actual windows.svg differed from the expected windows.svg
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args associated-types\long-type-E0308.rs`

error in revision `short-color`: 1 errors occurred comparing output.
status: exit code: 1
command: PATH="C:\a\rust\rust\build\aarch64-pc-windows-msvc\stage2\bin;C:\Program Files (x86)\Windows Kits\10\bin\arm64;C:\Program Files (x86)\Windows Kits\10\bin\10.0.26100.0\arm64;C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.44.35207\bin\HostARM64\arm64;C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.44.35207\bin\HostARM64\arm64;C:\Program Files\Git\clangarm64\bin;C:\Program Files\Git\usr\bin;C:\Users\runneradmin\bin;C:\a\rust\rust\ninja;C:\a\rust\rust\citools\clang-rust\bin;C:\a\rust\rust\sccache;C:\aliyun-cli;C:\vcpkg;C:\tools\zstd;C:\Program Files (x86)\NSIS;C:\Program Files\Mercurial;C:\hostedtoolcache\windows\stack\3.11.1\x64;C:\mingw64\bin;C:\Program Files\dotnet;C:\Program Files\MySQL\MySQL Server 8.0\bin;C:\Program Files (x86)\R\R-4.6.1\bin\x64;C:\SeleniumWebDrivers\GeckoDriver;C:\SeleniumWebDrivers\EdgeDriver;C:\SeleniumWebDrivers\ChromeDriver;C:\Program Files (x86)\sbt\bin;C:\Program Files (x86)\GitHub CLI;C:\Program Files\Git\usr\bin;C:\Program Files (x86)\pipx_bin;C:\npm\prefix;C:\hostedtoolcache\windows\go\1.24.13\arm64\bin;C:\hostedtoolcache\windows\Python\3.13.14\arm64\Scripts;C:\hostedtoolcache\windows\Python\3.13.14\arm64;C:\hostedtoolcache\windows\Ruby\3.4.10\aarch64\bin;C:\Program Files\LLVM\bin;C:\Program Files\OpenSSL\bin;C:\tools\kotlinc\bin;C:\hostedtoolcache\windows\Java_Temurin-Hotspot_jdk\21.0.11-10.0\aarch64\bin;C:\Tools\Ninja;C:\Program Files (x86)\ImageMagick-7.1.2-Q16-HDRI;C:\Program Files\Microsoft SDKs\Azure\CLI2\wbin;C:\ProgramData\kind;C:\ProgramData\Chocolatey\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Windows\System32\OpenSSH;C:\Program Files\PowerShell\7;C:\Program Files\Microsoft\Web Platform Installer;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn;C:\Program Files\Microsoft SQL Server\150\Tools\Binn;C:\Program Files\dotnet;C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit;C:\Program Files\Microsoft SQL Server\130\DTS\Binn;C:\Program Files\Microsoft SQL Server\140\DTS\Binn;C:\Program Files\Microsoft SQL Server\150\DTS\Binn;C:\Program Files\Microsoft SQL Server\160\DTS\Binn;C:\Program Files\Microsoft SQL Server\170\DTS\Binn;C:\Strawberry\c\bin;C:\Strawberry\perl\site\bin;C:\Strawberry\perl\bin;C:\ProgramData\chocolatey\lib\pulumi\tools\Pulumi\bin;C:\Program Files\CMake\bin;C:\ProgramData\chocolatey\lib\maven\apache-maven-3.9.16\bin;C:\Program Files\nodejs;C:\Program Files\Git\cmd;C:\Program Files\Git\clangarm64\bin;C:\Program Files\Git\usr\bin;C:\Program Files\GitHub CLI;C:\tools\php;C:\Program Files (x86)\sbt\bin;C:\Program Files\Amazon\AWSCLIV2;C:\Program Files\Amazon\SessionManagerPlugin\bin;C:\Program Files\Amazon\AWSSAMCLI\bin;C:\Program Files\Microsoft SQL Server\130\Tools\Binn;C:\Users\runneradmin\.dotnet\tools;C:\Users\runneradmin\.cargo\bin;C:\Users\runneradmin\AppData\Local\Microsoft\WindowsApps" "C:\\a\\rust\\rust\\build\\aarch64-pc-windows-msvc\\stage2\\bin\\rustc.exe" "C:\\a\\rust\\rust\\tests\\ui\\associated-types\\long-type-E0308.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=C:\\Users\\runneradmin\\.cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=C:\\a\\rust\\rust\\vendor" "--sysroot" "C:\\a\\rust\\rust\\build\\aarch64-pc-windows-msvc\\stage2" "--target=aarch64-pc-windows-msvc" "--cfg" "short_color" "--check-cfg" "cfg(test,FALSE,short,shortest,short_color,shortest_color)" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "C:\\a\\rust\\rust\\build\\aarch64-pc-windows-msvc\\test\\ui\\associated-types\\long-type-E0308.short-color" "-A" "unused" "-W" "unused_attributes" "-A" "internal_features" "-A" "incomplete_features" "-A" "unused_parens" "-A" "unused_braces" "-Crpath" "-Cdebuginfo=0" "-Lnative=C:\\a\\rust\\rust\\build\\aarch64-pc-windows-msvc\\native\\rust-test-helpers" "--diagnostic-width=100" "--error-format=human" "--color=always" "-Zwrite-long-types-to-disk=yes"
stdout: none
--- stderr -------------------------------
error[E0308]: mismatched types
  --> C:\a\rust\rust\tests\ui\associated-types\long-type-E0308.rs:30:5
   |
LL |   ) -> <
   |  ______-
LL | |     <
LL | |         <T::Wrapper<T> as FooBar>::Assoc as FooBar
LL | |     >::Assoc as FooBar
LL | | >::Wrapper<<T::Assoc as FooBar>::Assoc>
   | |_______________________________________- expected `<<_ as FooBar>::Assoc as FooBar>::Wrapper<_>` because of return type
...
LL |       value.assoc().assoc().assoc().wrap(value.assoc().assoc())
   |       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `really_really_really_long_module::FooBar::Wrapper`, found `really_really_really_long_module::FooBar::Assoc`
   |
   = note: expected associated type `<<<<_ as FooBar>::Wrapper<_> as FooBar>::Assoc as FooBar>::Assoc as FooBar>::Wrapper<_>`
              found associated type `<<<<_ as FooBar>::Assoc as FooBar>::Assoc as FooBar>::Assoc as FooBar>::Wrapper<_>`
   = note: an associated type was expected, but a different one was found
   = note: the full name for the type has been written to 'C:\a\rust\rust\build\aarch64-pc-windows-msvc\test\ui\associated-types\long-type-E0308.short-color\long-type-E0308.long-type-6318544785587209884.txt'
   = note: consider using `--verbose` to print the full type name to the console

error[E0308]: mismatched types
  --> C:\a\rust\rust\tests\ui\associated-types\long-type-E0308.rs:44:5
   |
LL | fn bar<T>(x: <T as Bar<u8>>::Assoc) -> <T as Bar<u16>>::Assoc
   |                                        ---------------------- expected `<T as Bar<u16>>::Assoc` because of return type
...
LL |     x
   |     ^ expected `u16`, found `u8`
   |
   = note: expected associated type `<_ as Bar<u16>>::Assoc`
              found associated type `<_ as Bar<u8>>::Assoc`
   = note: an associated type was expected, but a different one was found

error[E0308]: mismatched types
  --> C:\a\rust\rust\tests\ui\associated-types\long-type-E0308.rs:58:5
   |
LL | fn qux<T>(x: <T as Qux>::Assoc<u8>) -> <T as Qux>::Assoc<u16>
   |                                        ---------------------- expected `<T as Qux>::Assoc<u16>` because of return type
...
LL |     x
   |     ^ expected `u16`, found `u8`
   |
   = note: expected associated type `<_ as Qux>::Assoc<u16>`
              found associated type `<_ as Qux>::Assoc<u8>`
   = note: an associated type was expected, but a different one was found

error: aborting due to 3 previous errors

For more information about this error, try `rustc --explain E0308`.
------------------------------------------

---- [ui] tests\ui\associated-types\long-type-E0308.rs#short-color stdout end ----
---- [ui] tests\ui\associated-types\long-type-E0308.rs#shortest-color stdout ----
Saved the actual windows.svg to `C:\a\rust\rust\build\aarch64-pc-windows-msvc\test\ui\associated-types\long-type-E0308.shortest-color\long-type-E0308.shortest-color.windows.svg`
normalized windows.svg:
<svg width="1213px" height="920px" xmlns="http://www.w3.org/2000/svg">
  <style>
    .fg { fill: #AAAAAA }
    .bg { fill: #000000 }
    .fg-bright-cyan { fill: #55FFFF }
    .fg-bright-red { fill: #FF5555 }
    .fg-bright-white { fill: #FFFFFF }
    .fg-magenta { fill: #AA00AA }
    .container {
      padding: 0 10px;
      line-height: 18px;
    }
    .bold { font-weight: bold; }
    tspan {
      font: 14px SFMono-Regular, Consolas, Liberation Mono, Menlo, monospace;
      white-space: pre;
      line-height: 18px;
    }
  </style>

  <rect width="100%" height="100%" y="0" rx="4.5" class="bg" />

  <text xml:space="preserve" class="container fg">
    <tspan x="10px" y="28px"><tspan class="fg-bright-red bold">error[E0308]</tspan><tspan class="fg-bright-white bold">: mismatched types</tspan>
</tspan>
    <tspan x="10px" y="46px"><tspan>  </tspan><tspan class="fg-bright-cyan bold">--&gt; </tspan><tspan>$DIR/long-type-E0308.rs:30:5</tspan>
</tspan>
    <tspan x="10px" y="64px"><tspan>   </tspan><tspan class="fg-bright-cyan bold">|</tspan>
</tspan>
    <tspan x="10px" y="82px"><tspan class="fg-bright-cyan bold">LL</tspan><tspan> </tspan><tspan class="fg-bright-cyan bold">|</tspan><tspan>   ) -&gt; &lt;</tspan>
</tspan>
    <tspan x="10px" y="100px"><tspan>   </tspan><tspan class="fg-bright-cyan bold">|</tspan><tspan> </tspan><tspan class="fg-bright-cyan bold"> ______-</tspan>
</tspan>
    <tspan x="10px" y="118px"><tspan class="fg-bright-cyan bold">LL</tspan><tspan> </tspan><tspan class="fg-bright-cyan bold">|</tspan><tspan> </tspan><tspan class="fg-bright-cyan bold">|</tspan><tspan>     &lt;</tspan>
</tspan>
    <tspan x="10px" y="136px"><tspan class="fg-bright-cyan bold">LL</tspan><tspan> </tspan><tspan class="fg-bright-cyan bold">|</tspan><tspan> </tspan><tspan class="fg-bright-cyan bold">|</tspan><tspan>         &lt;T::Wrapper&lt;T&gt; as FooBar&gt;::Assoc as FooBar</tspan>
</tspan>
    <tspan x="10px" y="154px"><tspan class="fg-bright-cyan bold">LL</tspan><tspan> </tspan><tspan class="fg-bright-cyan bold">|</tspan><tspan> </tspan><tspan class="fg-bright-cyan bold">|</tspan><tspan>     &gt;::Assoc as FooBar</tspan>
</tspan>
    <tspan x="10px" y="172px"><tspan class="fg-bright-cyan bold">LL</tspan><tspan> </tspan><tspan class="fg-bright-cyan bold">|</tspan><tspan> </tspan><tspan class="fg-bright-cyan bold">|</tspan><tspan> &gt;::Wrapper&lt;&lt;T::Assoc as FooBar&gt;::Assoc&gt;</tspan>
</tspan>
    <tspan x="10px" y="190px"><tspan>   </tspan><tspan class="fg-bright-cyan bold">|</tspan><tspan> </tspan><tspan class="fg-bright-cyan bold">|_______________________________________-</tspan><tspan> </tspan><tspan class="fg-bright-cyan bold">expected `&lt;_ as FooBar&gt;::Wrapper&lt;_&gt;` because of return type</tspan>
</tspan>
    <tspan x="10px" y="208px"><tspan class="fg-bright-cyan bold">...</tspan>
</tspan>
    <tspan x="10px" y="226px"><tspan class="fg-bright-cyan bold">LL</tspan><tspan> </tspan><tspan class="fg-bright-cyan bold">|</tspan><tspan>       value</tspan><tspan class="fg-bright-cyan bold">...</tspan><tspan>oc())</tspan>
</tspan>
    <tspan x="10px" y="244px"><tspan>   </tspan><tspan class="fg-bright-cyan bold">|</tspan><tspan>       </tspan><tspan class="fg-bright-red bold">^^^^^</tspan><tspan class="fg-bright-cyan bold">...</tspan><tspan class="fg-bright-red bold">^^^^^</tspan><tspan> </tspan><tspan class="fg-bright-red bold">expected `really_really_really_long_module::FooBar::Wrapper`, found `really_really_really_long_module::FooBar::Assoc`</tspan>
</tspan>
    <tspan x="10px" y="262px"><tspan>   </tspan><tspan class="fg-bright-cyan bold">|</tspan>
</tspan>
    <tspan x="10px" y="280px"><tspan>   </tspan><tspan class="fg-bright-cyan bold">= </tspan><tspan class="fg-bright-white bold">note</tspan><tspan>: expected associated type `&lt;&lt;&lt;&lt;_ as FooBar&gt;::</tspan><tspan class="fg-magenta bold">Wrapper</tspan><tspan>&lt;_&gt; as...per&lt;_&gt;`</tspan>
</tspan>
    <tspan x="10px" y="298px"><tspan>              found associated type `&lt;&lt;&lt;&lt;_ as FooBar&gt;::</tspan><tspan class="fg-magenta bold">Assoc</tspan><tspan> as Fo...per&lt;_&gt;`</tspan>
</tspan>
    <tspan x="10px" y="316px"><tspan>   </tspan><tspan class="fg-bright-cyan bold">= </tspan><tspan class="fg-bright-white bold">note</tspan><tspan>: an associated type was expected, but a different one was found</tspan>
</tspan>
    <tspan x="10px" y="334px"><tspan>   </tspan><tspan class="fg-bright-cyan bold">= </tspan><tspan class="fg-bright-white bold">note</tspan><tspan>: the full name for the type has been written to '$TEST_BUILD_DIR/long-type-E0308.long-type-$LONG_TYPE_HASH.txt'</tspan>
</tspan>
    <tspan x="10px" y="352px"><tspan>   </tspan><tspan class="fg-bright-cyan bold">= </tspan><tspan class="fg-bright-white bold">note</tspan><tspan>: consider using `--verbose` to print the full type name to the console</tspan>
</tspan>
    <tspan x="10px" y="370px">
</tspan>
    <tspan x="10px" y="388px"><tspan class="fg-bright-red bold">error[E0308]</tspan><tspan class="fg-bright-white bold">: mismatched types</tspan>
</tspan>
    <tspan x="10px" y="406px"><tspan>  </tspan><tspan class="fg-bright-cyan bold">--&gt; </tspan><tspan>$DIR/long-type-E0308.rs:44:5</tspan>
</tspan>
    <tspan x="10px" y="424px"><tspan>   </tspan><tspan class="fg-bright-cyan bold">|</tspan>
</tspan>
    <tspan x="10px" y="442px"><tspan class="fg-bright-cyan bold">LL</tspan><tspan> </tspan><tspan class="fg-bright-cyan bold">|</tspan><tspan> fn bar&lt;T&gt;(x: &lt;T as Bar&lt;u8&gt;&gt;::Assoc) -&gt; &lt;T as</tspan><tspan class="fg-bright-cyan bold">...</tspan><tspan>Assoc</tspan>
</tspan>
    <tspan x="10px" y="460px"><tspan>   </tspan><tspan class="fg-bright-cyan bold">|</tspan><tspan>                                        </tspan><tspan class="fg-bright-cyan bold">-----...-----</tspan><tspan> </tspan><tspan class="fg-bright-cyan bold">expected `&lt;T as Bar&lt;u16&gt;&gt;::Assoc` because of return type</tspan>
</tspan>
    <tspan x="10px" y="478px"><tspan class="fg-bright-cyan bold">...</tspan>
</tspan>
    <tspan x="10px" y="496px"><tspan class="fg-bright-cyan bold">LL</tspan><tspan> </tspan><tspan class="fg-bright-cyan bold">|</tspan><tspan>     x</tspan>
</tspan>
    <tspan x="10px" y="514px"><tspan>   </tspan><tspan class="fg-bright-cyan bold">|</tspan><tspan>     </tspan><tspan class="fg-bright-red bold">^</tspan><tspan> </tspan><tspan class="fg-bright-red bold">expected `u16`, found `u8`</tspan>
</tspan>
    <tspan x="10px" y="532px"><tspan>   </tspan><tspan class="fg-bright-cyan bold">|</tspan>
</tspan>
    <tspan x="10px" y="550px"><tspan>   </tspan><tspan class="fg-bright-cyan bold">= </tspan><tspan class="fg-bright-white bold">note</tspan><tspan>: expected associated type `&lt;_ as Bar&lt;</tspan><tspan class="fg-magenta bold">u16</tspan><tspan>&gt;&gt;::Assoc`</tspan>
</tspan>
    <tspan x="10px" y="568px"><tspan>              found associated type `&lt;_ as Bar&lt;</tspan><tspan class="fg-magenta bold">u8</tspan><tspan>&gt;&gt;::Assoc`</tspan>
</tspan>
    <tspan x="10px" y="586px"><tspan>   </tspan><tspan class="fg-bright-cyan bold">= </tspan><tspan class="fg-bright-white bold">note</tspan><tspan>: an associated type was expected, but a different one was found</tspan>
</tspan>
    <tspan x="10px" y="604px">
</tspan>
    <tspan x="10px" y="622px"><tspan class="fg-bright-red bold">error[E0308]</tspan><tspan class="fg-bright-white bold">: mismatched types</tspan>
</tspan>
    <tspan x="10px" y="640px"><tspan>  </tspan><tspan class="fg-bright-cyan bold">--&gt; </tspan><tspan>$DIR/long-type-E0308.rs:58:5</tspan>
</tspan>
    <tspan x="10px" y="658px"><tspan>   </tspan><tspan class="fg-bright-cyan bold">|</tspan>
</tspan>
    <tspan x="10px" y="676px"><tspan class="fg-bright-cyan bold">LL</tspan><tspan> </tspan><tspan class="fg-bright-cyan bold">|</tspan><tspan> fn qux&lt;T&gt;(x: &lt;T as Qux&gt;::Assoc&lt;u8&gt;) -&gt; &lt;T as</tspan><tspan class="fg-bright-cyan bold">...</tspan><tspan>&lt;u16&gt;</tspan>
</tspan>
    <tspan x="10px" y="694px"><tspan>   </tspan><tspan class="fg-bright-cyan bold">|</tspan><tspan>                                        </tspan><tspan class="fg-bright-cyan bold">-----...-----</tspan><tspan> </tspan><tspan class="fg-bright-cyan bold">expected `&lt;T as Qux&gt;::Assoc&lt;u16&gt;` because of return type</tspan>
</tspan>
    <tspan x="10px" y="712px"><tspan class="fg-bright-cyan bold">...</tspan>
</tspan>
    <tspan x="10px" y="730px"><tspan class="fg-bright-cyan bold">LL</tspan><tspan> </tspan><tspan class="fg-bright-cyan bold">|</tspan><tspan>     x</tspan>
</tspan>
    <tspan x="10px" y="748px"><tspan>   </tspan><tspan class="fg-bright-cyan bold">|</tspan><tspan>     </tspan><tspan class="fg-bright-red bold">^</tspan><tspan> </tspan><tspan class="fg-bright-red bold">expected `u16`, found `u8`</tspan>
</tspan>
    <tspan x="10px" y="766px"><tspan>   </tspan><tspan class="fg-bright-cyan bold">|</tspan>
</tspan>
    <tspan x="10px" y="784px"><tspan>   </tspan><tspan class="fg-bright-cyan bold">= </tspan><tspan class="fg-bright-white bold">note</tspan><tspan>: expected associated type `&lt;_ as Qux&gt;::Assoc&lt;</tspan><tspan class="fg-magenta bold">u16</tspan><tspan>&gt;`</tspan>
</tspan>
    <tspan x="10px" y="802px"><tspan>              found associated type `&lt;_ as Qux&gt;::Assoc&lt;</tspan><tspan class="fg-magenta bold">u8</tspan><tspan>&gt;`</tspan>
</tspan>
    <tspan x="10px" y="820px"><tspan>   </tspan><tspan class="fg-bright-cyan bold">= </tspan><tspan class="fg-bright-white bold">note</tspan><tspan>: an associated type was expected, but a different one was found</tspan>
</tspan>
    <tspan x="10px" y="838px">
</tspan>
    <tspan x="10px" y="856px"><tspan class="fg-bright-red bold">error</tspan><tspan class="fg-bright-white bold">: aborting due to 3 previous errors</tspan>
</tspan>
    <tspan x="10px" y="874px">
</tspan>
    <tspan x="10px" y="892px"><tspan class="fg-bright-white bold">For more information about this error, try `rustc --explain E0308`.</tspan>
</tspan>
    <tspan x="10px" y="910px">
</tspan>
  </text>

</svg>



The actual windows.svg differed from the expected windows.svg
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args associated-types\long-type-E0308.rs`

error in revision `shortest-color`: 1 errors occurred comparing output.
status: exit code: 1
command: PATH="C:\a\rust\rust\build\aarch64-pc-windows-msvc\stage2\bin;C:\Program Files (x86)\Windows Kits\10\bin\arm64;C:\Program Files (x86)\Windows Kits\10\bin\10.0.26100.0\arm64;C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.44.35207\bin\HostARM64\arm64;C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.44.35207\bin\HostARM64\arm64;C:\Program Files\Git\clangarm64\bin;C:\Program Files\Git\usr\bin;C:\Users\runneradmin\bin;C:\a\rust\rust\ninja;C:\a\rust\rust\citools\clang-rust\bin;C:\a\rust\rust\sccache;C:\aliyun-cli;C:\vcpkg;C:\tools\zstd;C:\Program Files (x86)\NSIS;C:\Program Files\Mercurial;C:\hostedtoolcache\windows\stack\3.11.1\x64;C:\mingw64\bin;C:\Program Files\dotnet;C:\Program Files\MySQL\MySQL Server 8.0\bin;C:\Program Files (x86)\R\R-4.6.1\bin\x64;C:\SeleniumWebDrivers\GeckoDriver;C:\SeleniumWebDrivers\EdgeDriver;C:\SeleniumWebDrivers\ChromeDriver;C:\Program Files (x86)\sbt\bin;C:\Program Files (x86)\GitHub CLI;C:\Program Files\Git\usr\bin;C:\Program Files (x86)\pipx_bin;C:\npm\prefix;C:\hostedtoolcache\windows\go\1.24.13\arm64\bin;C:\hostedtoolcache\windows\Python\3.13.14\arm64\Scripts;C:\hostedtoolcache\windows\Python\3.13.14\arm64;C:\hostedtoolcache\windows\Ruby\3.4.10\aarch64\bin;C:\Program Files\LLVM\bin;C:\Program Files\OpenSSL\bin;C:\tools\kotlinc\bin;C:\hostedtoolcache\windows\Java_Temurin-Hotspot_jdk\21.0.11-10.0\aarch64\bin;C:\Tools\Ninja;C:\Program Files (x86)\ImageMagick-7.1.2-Q16-HDRI;C:\Program Files\Microsoft SDKs\Azure\CLI2\wbin;C:\ProgramData\kind;C:\ProgramData\Chocolatey\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Windows\System32\OpenSSH;C:\Program Files\PowerShell\7;C:\Program Files\Microsoft\Web Platform Installer;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn;C:\Program Files\Microsoft SQL Server\150\Tools\Binn;C:\Program Files\dotnet;C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit;C:\Program Files\Microsoft SQL Server\130\DTS\Binn;C:\Program Files\Microsoft SQL Server\140\DTS\Binn;C:\Program Files\Microsoft SQL Server\150\DTS\Binn;C:\Program Files\Microsoft SQL Server\160\DTS\Binn;C:\Program Files\Microsoft SQL Server\170\DTS\Binn;C:\Strawberry\c\bin;C:\Strawberry\perl\site\bin;C:\Strawberry\perl\bin;C:\ProgramData\chocolatey\lib\pulumi\tools\Pulumi\bin;C:\Program Files\CMake\bin;C:\ProgramData\chocolatey\lib\maven\apache-maven-3.9.16\bin;C:\Program Files\nodejs;C:\Program Files\Git\cmd;C:\Program Files\Git\clangarm64\bin;C:\Program Files\Git\usr\bin;C:\Program Files\GitHub CLI;C:\tools\php;C:\Program Files (x86)\sbt\bin;C:\Program Files\Amazon\AWSCLIV2;C:\Program Files\Amazon\SessionManagerPlugin\bin;C:\Program Files\Amazon\AWSSAMCLI\bin;C:\Program Files\Microsoft SQL Server\130\Tools\Binn;C:\Users\runneradmin\.dotnet\tools;C:\Users\runneradmin\.cargo\bin;C:\Users\runneradmin\AppData\Local\Microsoft\WindowsApps" "C:\\a\\rust\\rust\\build\\aarch64-pc-windows-msvc\\stage2\\bin\\rustc.exe" "C:\\a\\rust\\rust\\tests\\ui\\associated-types\\long-type-E0308.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=C:\\Users\\runneradmin\\.cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=C:\\a\\rust\\rust\\vendor" "--sysroot" "C:\\a\\rust\\rust\\build\\aarch64-pc-windows-msvc\\stage2" "--target=aarch64-pc-windows-msvc" "--cfg" "shortest_color" "--check-cfg" "cfg(test,FALSE,short,shortest,short_color,shortest_color)" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "C:\\a\\rust\\rust\\build\\aarch64-pc-windows-msvc\\test\\ui\\associated-types\\long-type-E0308.shortest-color" "-A" "unused" "-W" "unused_attributes" "-A" "internal_features" "-A" "incomplete_features" "-A" "unused_parens" "-A" "unused_braces" "-Crpath" "-Cdebuginfo=0" "-Lnative=C:\\a\\rust\\rust\\build\\aarch64-pc-windows-msvc\\native\\rust-test-helpers" "--diagnostic-width=12" "--error-format=human" "--color=always" "-Zwrite-long-types-to-disk=yes"
stdout: none
--- stderr -------------------------------
error[E0308]: mismatched types
  --> C:\a\rust\rust\tests\ui\associated-types\long-type-E0308.rs:30:5
   |
LL |   ) -> <
   |  ______-
LL | |     <
LL | |         <T::Wrapper<T> as FooBar>::Assoc as FooBar
LL | |     >::Assoc as FooBar
LL | | >::Wrapper<<T::Assoc as FooBar>::Assoc>
   | |_______________________________________- expected `<_ as FooBar>::Wrapper<_>` because of return type
...
LL |       value...oc())
   |       ^^^^^...^^^^^ expected `really_really_really_long_module::FooBar::Wrapper`, found `really_really_really_long_module::FooBar::Assoc`
   |
   = note: expected associated type `<<<<_ as FooBar>::Wrapper<_> as...per<_>`
              found associated type `<<<<_ as FooBar>::Assoc as Fo...per<_>`
   = note: an associated type was expected, but a different one was found
   = note: the full name for the type has been written to 'C:\a\rust\rust\build\aarch64-pc-windows-msvc\test\ui\associated-types\long-type-E0308.shortest-color\long-type-E0308.long-type-18108821858222180711.txt'
   = note: consider using `--verbose` to print the full type name to the console

error[E0308]: mismatched types
  --> C:\a\rust\rust\tests\ui\associated-types\long-type-E0308.rs:44:5
   |
LL | fn bar<T>(x: <T as Bar<u8>>::Assoc) -> <T as...Assoc
   |                                        -----...----- expected `<T as Bar<u16>>::Assoc` because of return type
...
LL |     x
   |     ^ expected `u16`, found `u8`
   |
   = note: expected associated type `<_ as Bar<u16>>::Assoc`
              found associated type `<_ as Bar<u8>>::Assoc`
   = note: an associated type was expected, but a different one was found

error[E0308]: mismatched types
  --> C:\a\rust\rust\tests\ui\associated-types\long-type-E0308.rs:58:5
   |
LL | fn qux<T>(x: <T as Qux>::Assoc<u8>) -> <T as...<u16>
   |                                        -----...----- expected `<T as Qux>::Assoc<u16>` because of return type
...
LL |     x
   |     ^ expected `u16`, found `u8`
   |
   = note: expected associated type `<_ as Qux>::Assoc<u16>`
              found associated type `<_ as Qux>::Assoc<u8>`
   = note: an associated type was expected, but a different one was found

error: aborting due to 3 previous errors

For more information about this error, try `rustc --explain E0308`.
---
Currently active steps:
test::Ui { test_compiler: Compiler { stage: 2, host: aarch64-pc-windows-msvc, forced_compiler: false }, target: aarch64-pc-windows-msvc } at src\bootstrap\src\core\build_steps\test.rs:1846
test::Compiletest { test_compiler: Compiler { stage: 2, host: aarch64-pc-windows-msvc, forced_compiler: false }, target: aarch64-pc-windows-msvc, mode: ui, suite: "ui", path: "tests/ui", compare_mode: None } at src\bootstrap\src\core\build_steps\test.rs:1846
Build completed unsuccessfully in 1:17:33
make: *** [Makefile:115: ci-msvc-py] Error 1
  local time: Sat Jul 18 11:02:04 CUT 2026
  network time: Sat, 18 Jul 2026 11:02:04 GMT
##[error]Process completed with exit code 2.
##[group]Run echo "disk usage:"
echo "disk usage:"

@rust-bors rust-bors Bot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Jul 18, 2026
@rust-bors

rust-bors Bot commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

💔 Test for b356d7c failed: CI. Failed job:

@JonathanBrouwer

Copy link
Copy Markdown
Contributor

💔 I suspect this PR failed tests as part of a rollup
@bors r-

After fixing the problem, consider running a try job for the failed job before re-approving.

Link to failure: #159501 (comment)

@rust-bors rust-bors Bot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jul 18, 2026
@rust-bors

rust-bors Bot commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

This PR was contained in a rollup (#159501), which was unapproved.

View changes since this unapproval

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

E0308 with complex types produces an unhelpful expected type vs found type note

5 participants