-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
remove the unused :: between trait and type to give user correct diag… #102421
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @lcnr (or someone else) soon. Please see the contribution instructions for more information. |
compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs
Outdated
Show resolved
Hide resolved
compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs
Outdated
Show resolved
Hide resolved
@lyming2007 Please link the corresponding issue to close in your PR descriptions (for all your PRs where applicable). Thanks. |
04f95de
to
14e8cab
Compare
compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs
Outdated
Show resolved
Hide resolved
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.
one nit, then r=me
…nostic information modified: compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs new file: src/test/ui/type/issue-101866.rs new file: src/test/ui/type/issue-101866.stderr
14e8cab
to
523a76a
Compare
@bors r+ rollup |
|
||
let mut suggestions = vec![( | ||
trait_path_segment.ident.span.shrink_to_lo(), | ||
format!("<{} as ", self.tcx.def_path(impl_def_id).to_string_no_crate_verbose()) |
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.
sidenote, using self.tcx.def_path(impl_def_id).to_string_no_crate_verbose()
here feels wrong, I would expect us to use self.tcx.type_of(impl_def_id)
here to print the self type. rn this is causing us to print ::StructA
instead of StructA
.
@lyming2007 would you be interested in changing this in a followup pr?
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.
both <::StructA as TraitA<i32>>::func()
and <StructA as TraitA<i32>>::func()
will work for the compiler.
Do we really need to change it from ::StructA
to StructA
?
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.
we don't need to do it, but it's a lot more idiomatic to use StructA
instead of ::StructA
. Using ::StructA
is pretty confusing to most people, so it's better to avoid imo
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.
remove the unused :: between trait and type to give user correct diag… …nostic information modified: compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs new file: src/test/ui/type/issue-101866.rs new file: src/test/ui/type/issue-101866.stderr
remove the unused :: between trait and type to give user correct diag… …nostic information modified: compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs new file: src/test/ui/type/issue-101866.rs new file: src/test/ui/type/issue-101866.stderr
…iaskrgr Rollup of 6 pull requests Successful merges: - rust-lang#102276 (Added more const_closure functionality) - rust-lang#102382 (Manually order `DefId` on 64-bit big-endian) - rust-lang#102421 (remove the unused :: between trait and type to give user correct diag…) - rust-lang#102495 (Reinstate `hir-stats.rs` test for stage 1.) - rust-lang#102505 (rustdoc: remove no-op CSS `h3.variant, .sub-variant h4 { border-bottom: none }`) - rust-lang#102506 (Specify `DynKind::Dyn`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
…nostic information