Skip to content

Conversation

JonathanBrouwer
Copy link
Contributor

@JonathanBrouwer JonathanBrouwer commented Jun 13, 2025

sugg_span here is the span of the call expression.
That span here is the <Self>::Assoc, which is exactly what we need here (even though I would expect it to include the arguments, but I guess it doesn't)

r? @WaffleLapkin
One commit with failing tests and one that fixes it for reviewability

closes #142473

@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 Jun 13, 2025
@rust-log-analyzer

This comment has been minimized.

@JonathanBrouwer JonathanBrouwer force-pushed the associated-type-suggestion branch from 5388992 to 1707d71 Compare June 13, 2025 21:42
@@ -0,0 +1,20 @@
//@ run-rustfix
#![allow(unused)]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ui tests have unused allowed by default iirc

Suggested change
#![allow(unused)]

Copy link
Contributor Author

@JonathanBrouwer JonathanBrouwer Jun 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm getting this if I remove the allow(unused), I think because this is a rustfix test

failures:

---- [ui] tests/ui/associated-types/associated-type-call.rs stdout ----
Saved the actual stderr to `/home/jonathan/Projects/rust/build/x86_64-unknown-linux-gnu/test/ui/associated-types/associated-type-call/associated-type-call.stderr`
Blessing the stderr of `/home/jonathan/Projects/rust/tests/ui/associated-types/associated-type-call.rs` as `/home/jonathan/Projects/rust/tests/ui/associated-types/associated-type-call.stderr`

The actual stderr differed from the expected stderr
Saved the actual fixed to `/home/jonathan/Projects/rust/build/x86_64-unknown-linux-gnu/test/ui/associated-types/associated-type-call/associated-type-call.fixed`
Blessing the fixed of `/home/jonathan/Projects/rust/tests/ui/associated-types/associated-type-call.rs` as `/home/jonathan/Projects/rust/tests/ui/associated-types/associated-type-call.fixed`

The actual fixed differed from the expected fixed

error: fixed code is still producing diagnostics
status: exit status: 0
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/home/jonathan/Projects/rust/build/x86_64-unknown-linux-gnu/stage1/bin/rustc" "/home/jonathan/Projects/rust/tests/ui/associated-types/associated-type-call.fixed" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/home/jonathan/.cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/home/jonathan/Projects/rust/vendor" "--sysroot" "/home/jonathan/Projects/rust/build/x86_64-unknown-linux-gnu/stage1" "--target=x86_64-unknown-linux-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" "-o" "/home/jonathan/Projects/rust/build/x86_64-unknown-linux-gnu/test/ui/associated-types/associated-type-call/a" "-A" "internal_features" "-Crpath" "-Cdebuginfo=0" "-Lnative=/home/jonathan/Projects/rust/build/x86_64-unknown-linux-gnu/native/rust-test-helpers"
stdout: none
--- stderr -------------------------------
warning: trait `Trait` is never used
  --> /home/jonathan/Projects/rust/tests/ui/associated-types/associated-type-call.fixed:6:7
   |
LL | trait Trait {
   |       ^^^^^
   |
   = note: `#[warn(dead_code)]` on by default

warning: 1 warning emitted
------------------------------------------



failures:
    [ui] tests/ui/associated-types/associated-type-call.rs

test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 19228 filtered out; finished in 49.37ms

@rustbot rustbot 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 Jun 13, 2025
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
…anchor

Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
@JonathanBrouwer JonathanBrouwer force-pushed the associated-type-suggestion branch from 1707d71 to 1d036f4 Compare June 13, 2025 22:08
Copy link
Member

@WaffleLapkin WaffleLapkin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

r=me with green ci

@WaffleLapkin
Copy link
Member

WaffleLapkin commented Jun 13, 2025

@bors rollup

@WaffleLapkin
Copy link
Member

@bors delegate+

@bors
Copy link
Collaborator

bors commented Jun 13, 2025

✌️ @JonathanBrouwer, you can now approve this pull request!

If @WaffleLapkin told you to "r=me" after making some further change, please make that change, then do @bors r=@WaffleLapkin

@JonathanBrouwer
Copy link
Contributor Author

@bors r=@WaffleLapkin

@bors
Copy link
Collaborator

bors commented Jun 14, 2025

📌 Commit 1d036f4 has been approved by WaffleLapkin

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 Jun 14, 2025
jhpratt added a commit to jhpratt/rust that referenced this pull request Jun 14, 2025
…ggestion, r=WaffleLapkin

Fix incorrect suggestion when calling an associated type with a type anchor

`sugg_span` here is the span of the call expression.
That span here is the `<Self>::Assoc`, which is exactly what we need here (even though I would expect it to include the arguments, but I guess it doesn't)

r? `@WaffleLapkin`
One commit with failing tests and one that fixes it for reviewability

closes rust-lang#142473
bors added a commit that referenced this pull request Jun 14, 2025
Rollup of 9 pull requests

Successful merges:

 - #140593 (Temporary lifetime extension through tuple struct and tuple variant constructors)
 - #141399 ([rustdoc] Give more information into extracted doctest information)
 - #141493 (Delegate `<SocketAddr as Debug>` to `ByteStr`)
 - #141811 (Unimplement unsized_locals)
 - #142243 (float tests: deduplicate min, max, and rounding tests)
 - #142464 (variadic functions: remove list of supported ABIs from error)
 - #142477 (Fix incorrect suggestion when calling an associated type with a type anchor)
 - #142484 (Remove unneeded lifetime bound from signature of BTreeSet::extract_if)
 - #142489 (Update the `compiler-builtins` subtree)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 4bf7765 into rust-lang:master Jun 14, 2025
10 checks passed
@rustbot rustbot added this to the 1.89.0 milestone Jun 14, 2025
rust-timer added a commit that referenced this pull request Jun 14, 2025
Rollup merge of #142477 - JonathanBrouwer:associated-type-suggestion, r=WaffleLapkin

Fix incorrect suggestion when calling an associated type with a type anchor

`sugg_span` here is the span of the call expression.
That span here is the `<Self>::Assoc`, which is exactly what we need here (even though I would expect it to include the arguments, but I guess it doesn't)

r? ``@WaffleLapkin``
One commit with failing tests and one that fixes it for reviewability

closes #142473
RalfJung pushed a commit to RalfJung/miri that referenced this pull request Jun 15, 2025
Rollup of 9 pull requests

Successful merges:

 - rust-lang/rust#140593 (Temporary lifetime extension through tuple struct and tuple variant constructors)
 - rust-lang/rust#141399 ([rustdoc] Give more information into extracted doctest information)
 - rust-lang/rust#141493 (Delegate `<SocketAddr as Debug>` to `ByteStr`)
 - rust-lang/rust#141811 (Unimplement unsized_locals)
 - rust-lang/rust#142243 (float tests: deduplicate min, max, and rounding tests)
 - rust-lang/rust#142464 (variadic functions: remove list of supported ABIs from error)
 - rust-lang/rust#142477 (Fix incorrect suggestion when calling an associated type with a type anchor)
 - rust-lang/rust#142484 (Remove unneeded lifetime bound from signature of BTreeSet::extract_if)
 - rust-lang/rust#142489 (Update the `compiler-builtins` subtree)

r? `@ghost`
`@rustbot` modify labels: rollup
github-actions bot pushed a commit to rust-lang/rustc-dev-guide that referenced this pull request Jun 16, 2025
Rollup of 9 pull requests

Successful merges:

 - rust-lang/rust#140593 (Temporary lifetime extension through tuple struct and tuple variant constructors)
 - rust-lang/rust#141399 ([rustdoc] Give more information into extracted doctest information)
 - rust-lang/rust#141493 (Delegate `<SocketAddr as Debug>` to `ByteStr`)
 - rust-lang/rust#141811 (Unimplement unsized_locals)
 - rust-lang/rust#142243 (float tests: deduplicate min, max, and rounding tests)
 - rust-lang/rust#142464 (variadic functions: remove list of supported ABIs from error)
 - rust-lang/rust#142477 (Fix incorrect suggestion when calling an associated type with a type anchor)
 - rust-lang/rust#142484 (Remove unneeded lifetime bound from signature of BTreeSet::extract_if)
 - rust-lang/rust#142489 (Update the `compiler-builtins` subtree)

r? `@ghost`
`@rustbot` modify labels: rollup
github-actions bot pushed a commit to rust-lang/compiler-builtins that referenced this pull request Jul 12, 2025
Rollup of 9 pull requests

Successful merges:

 - rust-lang/rust#140593 (Temporary lifetime extension through tuple struct and tuple variant constructors)
 - rust-lang/rust#141399 ([rustdoc] Give more information into extracted doctest information)
 - rust-lang/rust#141493 (Delegate `<SocketAddr as Debug>` to `ByteStr`)
 - rust-lang/rust#141811 (Unimplement unsized_locals)
 - rust-lang/rust#142243 (float tests: deduplicate min, max, and rounding tests)
 - rust-lang/rust#142464 (variadic functions: remove list of supported ABIs from error)
 - rust-lang/rust#142477 (Fix incorrect suggestion when calling an associated type with a type anchor)
 - rust-lang/rust#142484 (Remove unneeded lifetime bound from signature of BTreeSet::extract_if)
 - rust-lang/rust#142489 (Update the `compiler-builtins` subtree)

r? `@ghost`
`@rustbot` modify labels: rollup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. 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.

Incorrect suggestion when calling an associated type with a type ancor
5 participants