remove the unused :: between trait and type to give user correct diag…#102421
remove the unused :: between trait and type to give user correct diag…#102421bors merged 1 commit intorust-lang:masterfrom
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
…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.
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.
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.
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
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