-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Fix incorrect suggestion when calling an associated type with a type anchor #142477
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix incorrect suggestion when calling an associated type with a type anchor #142477
Conversation
This comment has been minimized.
This comment has been minimized.
5388992
to
1707d71
Compare
@@ -0,0 +1,20 @@ | |||
//@ run-rustfix | |||
#![allow(unused)] |
There was a problem hiding this comment.
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
#![allow(unused)] |
There was a problem hiding this comment.
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
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
…anchor Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
1707d71
to
1d036f4
Compare
There was a problem hiding this 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
@bors rollup |
@bors delegate+ |
✌️ @JonathanBrouwer, you can now approve this pull request! If @WaffleLapkin told you to " |
…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
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
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
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
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