Skip to content

Conversation

estebank
Copy link
Contributor

error[E0277]: the trait bound `u32: Trait` is not satisfied
  --> $DIR/trait_objects_fail.rs:26:9
   |
LL |     foo(&10_u32);
   |         ^^^^^^^ the trait `Trait` is not implemented for `u32`
   |
help: the trait `Trait<12>` is not implemented for `u32`
      but trait `Trait<2>` is implemented for it
  --> $DIR/trait_objects_fail.rs:7:1
   |
LL | impl Trait<2> for u32 {}
   | ^^^^^^^^^^^^^^^^^^^^^
   = note: required for the cast from `&u32` to `&dyn Trait`

Pointing at the impl definition that could apply given a different self type is particularly useful when it has a blanket self type, as it might not be obvious and is not trivially greppable:

error[E0277]: the trait bound `RawImpl<_>: Raw<_>` is not satisfied
  --> $DIR/issue-62742.rs:4:5
   |
LL |     WrongImpl::foo(0i32);
   |     ^^^^^^^^^ unsatisfied trait bound
   |
help: the trait `Raw<_>` is not implemented for `RawImpl<_>`
      but trait `Raw<[_]>` is implemented for it
  --> $DIR/issue-62742.rs:29:1
   |
LL | impl<T> Raw<[T]> for RawImpl<T> {
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: required by a bound in `SafeImpl`
  --> $DIR/issue-62742.rs:33:35
   |
LL | pub struct SafeImpl<T: ?Sized, A: Raw<T>>(PhantomData<(A, T)>);
   |                                   ^^^^^^ required by this bound in `SafeImpl`

@rustbot
Copy link
Collaborator

rustbot commented Aug 20, 2025

r? @nnethercote

rustbot has assigned @nnethercote.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Aug 20, 2025
@rustbot
Copy link
Collaborator

rustbot commented Aug 20, 2025

rustc_errors::emitter was changed

cc @Muscraft

This PR modifies tests/ui/issues/. If this PR is adding new tests to tests/ui/issues/,
please refrain from doing so, and instead add it to more descriptive subdirectories.

@rust-log-analyzer

This comment has been minimized.

@estebank estebank force-pushed the point-at-impl-e0277 branch from 3967b4e to c6c62f4 Compare August 20, 2025 17:59
@rustbot rustbot added the WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver) label Aug 20, 2025
@rust-log-analyzer

This comment has been minimized.

@nnethercote
Copy link
Contributor

Looks fine, r=me once everything is green.

@nnethercote nnethercote 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 Aug 22, 2025
@estebank estebank force-pushed the point-at-impl-e0277 branch from c6c62f4 to a05bf52 Compare August 22, 2025 18:59
@rustbot

This comment has been minimized.

@bors

This comment was marked as resolved.

@estebank estebank force-pushed the point-at-impl-e0277 branch from a05bf52 to 3f07cda Compare August 23, 2025 16:12
@rustbot

This comment has been minimized.

@estebank
Copy link
Contributor Author

@bors r=nnethercote

@bors
Copy link
Collaborator

bors commented Aug 23, 2025

📌 Commit 3f07cda has been approved by nnethercote

It is now in the queue for this repository.

@bors bors 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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Aug 23, 2025
@jhpratt
Copy link
Member

jhpratt commented Aug 23, 2025

@bors r- (has merge conflicts)

@bors bors 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-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Aug 23, 2025
@bors
Copy link
Collaborator

bors commented Aug 24, 2025

☔ The latest upstream changes (presumably #145706) made this pull request unmergeable. Please resolve the merge conflicts.

…int at it:

```
error[E0277]: the trait bound `u32: Trait` is not satisfied
  --> $DIR/trait_objects_fail.rs:26:9
   |
LL |     foo(&10_u32);
   |         ^^^^^^^ the trait `Trait` is not implemented for `u32`
   |
help: the trait `Trait<12>` is not implemented for `u32`
      but trait `Trait<2>` is implemented for it
  --> $DIR/trait_objects_fail.rs:7:1
   |
LL | impl Trait<2> for u32 {}
   | ^^^^^^^^^^^^^^^^^^^^^
   = note: required for the cast from `&u32` to `&dyn Trait`
```

Pointing at the `impl` definition that *could* apply given a different self type is particularly useful when it has a blanket self type, as it might not be obvious and is not trivially greppable:

```
error[E0277]: the trait bound `RawImpl<_>: Raw<_>` is not satisfied
  --> $DIR/issue-62742.rs:4:5
   |
LL |     WrongImpl::foo(0i32);
   |     ^^^^^^^^^ unsatisfied trait bound
   |
help: the trait `Raw<_>` is not implemented for `RawImpl<_>`
      but trait `Raw<[_]>` is implemented for it
  --> $DIR/issue-62742.rs:29:1
   |
LL | impl<T> Raw<[T]> for RawImpl<T> {
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: required by a bound in `SafeImpl`
  --> $DIR/issue-62742.rs:33:35
   |
LL | pub struct SafeImpl<T: ?Sized, A: Raw<T>>(PhantomData<(A, T)>);
   |                                   ^^^^^^ required by this bound in `SafeImpl`
```
@estebank estebank force-pushed the point-at-impl-e0277 branch from 3f07cda to 898ddc3 Compare August 24, 2025 16:55
@rustbot
Copy link
Collaborator

rustbot commented Aug 24, 2025

This PR was rebased onto a different master 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.

@estebank
Copy link
Contributor Author

@bors r=nnethercote rollup=never

@bors
Copy link
Collaborator

bors commented Aug 24, 2025

📌 Commit 898ddc3 has been approved by nnethercote

It is now in the queue for this repository.

@bors bors 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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Aug 24, 2025
bors added a commit that referenced this pull request Aug 25, 2025
When a trait isn't implemented, but another similar impl is found, point at it

```
error[E0277]: the trait bound `u32: Trait` is not satisfied
  --> $DIR/trait_objects_fail.rs:26:9
   |
LL |     foo(&10_u32);
   |         ^^^^^^^ the trait `Trait` is not implemented for `u32`
   |
help: the trait `Trait<12>` is not implemented for `u32`
      but trait `Trait<2>` is implemented for it
  --> $DIR/trait_objects_fail.rs:7:1
   |
LL | impl Trait<2> for u32 {}
   | ^^^^^^^^^^^^^^^^^^^^^
   = note: required for the cast from `&u32` to `&dyn Trait`
```

Pointing at the `impl` definition that *could* apply given a different self type is *particularly* useful when it has a blanket self type, as it might not be obvious and is not trivially greppable:

```
error[E0277]: the trait bound `RawImpl<_>: Raw<_>` is not satisfied
  --> $DIR/issue-62742.rs:4:5
   |
LL |     WrongImpl::foo(0i32);
   |     ^^^^^^^^^ unsatisfied trait bound
   |
help: the trait `Raw<_>` is not implemented for `RawImpl<_>`
      but trait `Raw<[_]>` is implemented for it
  --> $DIR/issue-62742.rs:29:1
   |
LL | impl<T> Raw<[T]> for RawImpl<T> {
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: required by a bound in `SafeImpl`
  --> $DIR/issue-62742.rs:33:35
   |
LL | pub struct SafeImpl<T: ?Sized, A: Raw<T>>(PhantomData<(A, T)>);
   |                                   ^^^^^^ required by this bound in `SafeImpl`
```
@bors
Copy link
Collaborator

bors commented Aug 25, 2025

⌛ Testing commit 898ddc3 with merge 6bdc49a...

@rust-log-analyzer

This comment has been minimized.

@bors
Copy link
Collaborator

bors commented Aug 25, 2025

💔 Test failed - checks-actions

@bors bors 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 Aug 25, 2025
…them

```
error[E0277]: the trait bound `[[u16; 3]; 2]: Bar` is not satisfied
  --> $DIR/issue-67185-2.rs:21:6
   |
LL | impl Foo for FooImpl {}
   |      ^^^ the trait `Bar` is not implemented for `[[u16; 3]; 2]`
   |
help: the following other types implement trait `Bar`
  --> $DIR/issue-67185-2.rs:9:1
   |
LL | impl Bar for [u16; 4] {}
   | ^^^^^^^^^^^^^^^^^^^^^ `[u16; 4]`
LL | impl Bar for [[u16; 3]; 3] {}
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^ `[[u16; 3]; 3]`
note: required by a bound in `Foo`
  --> $DIR/issue-67185-2.rs:14:30
   |
LL | trait Foo
   |       --- required by a bound in this trait
LL | where
LL |     [<u8 as Baz>::Quaks; 2]: Bar,
   |                              ^^^ required by this bound in `Foo`
```
@estebank estebank force-pushed the point-at-impl-e0277 branch from 898ddc3 to c22331f Compare August 25, 2025 15:32
@estebank
Copy link
Contributor Author

@bors r=nnethercote

@bors
Copy link
Collaborator

bors commented Aug 25, 2025

📌 Commit c22331f has been approved by nnethercote

It is now in the queue for this repository.

@bors bors 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 Aug 25, 2025
bors added a commit that referenced this pull request Aug 25, 2025
When a trait isn't implemented, but another similar impl is found, point at it

```
error[E0277]: the trait bound `u32: Trait` is not satisfied
  --> $DIR/trait_objects_fail.rs:26:9
   |
LL |     foo(&10_u32);
   |         ^^^^^^^ the trait `Trait` is not implemented for `u32`
   |
help: the trait `Trait<12>` is not implemented for `u32`
      but trait `Trait<2>` is implemented for it
  --> $DIR/trait_objects_fail.rs:7:1
   |
LL | impl Trait<2> for u32 {}
   | ^^^^^^^^^^^^^^^^^^^^^
   = note: required for the cast from `&u32` to `&dyn Trait`
```

Pointing at the `impl` definition that *could* apply given a different self type is *particularly* useful when it has a blanket self type, as it might not be obvious and is not trivially greppable:

```
error[E0277]: the trait bound `RawImpl<_>: Raw<_>` is not satisfied
  --> $DIR/issue-62742.rs:4:5
   |
LL |     WrongImpl::foo(0i32);
   |     ^^^^^^^^^ unsatisfied trait bound
   |
help: the trait `Raw<_>` is not implemented for `RawImpl<_>`
      but trait `Raw<[_]>` is implemented for it
  --> $DIR/issue-62742.rs:29:1
   |
LL | impl<T> Raw<[T]> for RawImpl<T> {
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: required by a bound in `SafeImpl`
  --> $DIR/issue-62742.rs:33:35
   |
LL | pub struct SafeImpl<T: ?Sized, A: Raw<T>>(PhantomData<(A, T)>);
   |                                   ^^^^^^ required by this bound in `SafeImpl`
```
@bors
Copy link
Collaborator

bors commented Aug 25, 2025

⌛ Testing commit c22331f with merge 85abb89...

@rust-log-analyzer
Copy link
Collaborator

The job x86_64-mingw-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\linkage-attr\raw-dylib\windows\dlltool-failed.rs stdout ----
\a\rust\rust\mingw64\bin\dlltool.exe
\AppData\Local\Temp\rustcpbgK0C\foo.dll_imports.def
\AppData\Local\Temp\rustcpbgK0C\foo.dll_imports.lib
\AppData\Local\Temp\rustcpbgK0C\foo.dll
\a\rust\rust\mingw64\bin\dlltool.exe
\AppData\Local\Temp\rustcpbgK0C\foo.dll_imports.def
Saved the actual stderr to `D:\a\rust\rust\build\x86_64-pc-windows-gnu\test\ui\linkage-attr\raw-dylib\windows\dlltool-failed\dlltool-failed.stderr`
diff of stderr:

1 error: Dlltool could not create import library with $DLLTOOL -d $DEF_FILE -D foo.dll -l $LIB_FILE $TARGET_MACHINE $ASM_FLAGS --no-leading-underscore $TEMP_PREFIX:
2        
3        $DLLTOOL: Syntax error in def file $DEF_FILE:1␍
+        
4 
5 error: aborting due to 1 previous error
6 


The actual stderr differed from the expected stderr
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args linkage-attr\raw-dylib\windows\dlltool-failed.rs`

error: 1 errors occurred comparing output.
status: exit code: 1
command: PATH="D:\a\rust\rust\build\x86_64-pc-windows-gnu\stage2\bin;D:\a\rust\rust\build\x86_64-pc-windows-gnu\bootstrap-tools\x86_64-pc-windows-gnu\release\deps;D:\a\rust\rust\ninja;D:\a\rust\rust\mingw64\bin;C:\msys64\usr\bin;D:\a\rust\rust\sccache;C:\Program Files\MongoDB\Server\7.0\bin;C:\vcpkg;C:\tools\zstd;C:\hostedtoolcache\windows\stack\3.7.1\x64;C:\cabal\bin;C:\ghcup\bin;C:\mingw64\bin;C:\Program Files\dotnet;C:\Program Files\MySQL\MySQL Server 8.0\bin;C:\Program Files\R\R-4.4.2\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\bin;C:\Program Files (x86)\pipx_bin;C:\npm\prefix;C:\hostedtoolcache\windows\go\1.24.6\x64\bin;C:\hostedtoolcache\windows\Python\3.9.13\x64\Scripts;C:\hostedtoolcache\windows\Python\3.9.13\x64;C:\hostedtoolcache\windows\Ruby\3.3.9\x64\bin;C:\Program Files\OpenSSL\bin;C:\tools\kotlinc\bin;C:\hostedtoolcache\windows\Java_Temurin-Hotspot_jdk\17.0.16-8\x64\bin;C:\Program Files\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 (x86)\WiX Toolset v3.14\bin;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:\ProgramData\chocolatey\lib\pulumi\tools\Pulumi\bin;C:\Program Files\CMake\bin;C:\Strawberry\c\bin;C:\Strawberry\perl\site\bin;C:\Strawberry\perl\bin;C:\ProgramData\chocolatey\lib\maven\apache-maven-3.9.11\bin;C:\Program Files\Microsoft Service Fabric\bin\Fabric\Fabric.Code;C:\Program Files\Microsoft SDKs\Service Fabric\Tools\ServiceFabricLocalClusterManager;C:\Program Files\nodejs;C:\Program Files\Git\cmd;C:\Program Files\Git\mingw64\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:\Program Files\mongosh;C:\Program Files\LLVM\bin;C:\Program Files (x86)\LLVM\bin;C:\Users\runneradmin\.dotnet\tools;C:\Users\runneradmin\.cargo\bin;C:\Users\runneradmin\AppData\Local\Microsoft\WindowsApps" "D:\\a\\rust\\rust\\build\\x86_64-pc-windows-gnu\\stage2\\bin\\rustc.exe" "D:\\a\\rust\\rust\\tests\\ui\\linkage-attr\\raw-dylib\\windows\\dlltool-failed.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=D:\\a\\rust\\rust\\vendor" "--sysroot" "D:\\a\\rust\\rust\\build\\x86_64-pc-windows-gnu\\stage2" "--target=x86_64-pc-windows-gnu" "--check-cfg" "cfg(test,FALSE)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "D:\\a\\rust\\rust\\build\\x86_64-pc-windows-gnu\\test\\ui\\linkage-attr\\raw-dylib\\windows\\dlltool-failed" "-A" "unused" "-A" "internal_features" "-A" "unused_parens" "-A" "unused_braces" "-Crpath" "-Cdebuginfo=0" "-Lnative=D:\\a\\rust\\rust\\build\\x86_64-pc-windows-gnu\\native\\rust-test-helpers" "--crate-type" "lib" "--emit" "link"
stdout: none
--- stderr -------------------------------
error: Dlltool could not create import library with D:\a\rust\rust\mingw64\bin\dlltool.exe -d C:\Users\RUNNER~1\AppData\Local\Temp\rustcpbgK0C\foo.dll_imports.def -D foo.dll -l C:\Users\RUNNER~1\AppData\Local\Temp\rustcpbgK0C\foo.dll_imports.lib -m i386:x86-64 -f --64 --no-leading-underscore --temp-prefix C:\Users\RUNNER~1\AppData\Local\Temp\rustcpbgK0C\foo.dll:
       
       D:\a\rust\rust\mingw64\bin\dlltool.exe: Syntax error in def file C:\Users\RUNNER~1\AppData\Local\Temp\rustcpbgK0C\foo.dll_imports.def:1␍
       

error: aborting due to 1 previous error
------------------------------------------

---

Some tests failed in compiletest suite=ui mode=ui host=x86_64-pc-windows-gnu target=x86_64-pc-windows-gnu
Bootstrap failed while executing `test --stage 2 --skip=compiler --skip=src`
Build completed unsuccessfully in 1:45:06
make: *** [Makefile:123: ci-mingw-x] Error 1
  local time: Mon Aug 25 21:54:27 CUT 2025
  network time: Mon, 25 Aug 2025 21:54:28 GMT
##[error]Process completed with exit code 2.
Post job cleanup.
[command]"C:\Program Files\Git\bin\git.exe" version

@bors
Copy link
Collaborator

bors commented Aug 25, 2025

💔 Test failed - checks-actions

@bors bors 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 Aug 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants