-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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 diagnostic when using = instead of : in let binding #136869
Fix diagnostic when using = instead of : in let binding #136869
Conversation
if err.code == Some(E0423) | ||
&& let Some((let_span, _, _)) = self.diag_metadata.current_let_binding | ||
&& let span = let_span.shrink_to_hi().to(ident_span.shrink_to_lo()) | ||
&& let Ok(code) = self.r.tcx.sess.source_map().span_to_snippet(span) | ||
&& code.trim() == "=" |
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.
Is there no alternative way of doing this? We don't have info on the expression/AST node? Wouldn't self.diag_metadata.current_let_binding.2
point at the space after the =
, which could be compared against the span you already have?
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.
you means checking the ident_span
is starting point of current_let_binding.2.span
?
I updated the code.
fc05d76
to
86548fc
Compare
86548fc
to
a917fd5
Compare
@bors r+ |
…inding, r=estebank Fix diagnostic when using = instead of : in let binding Fixes rust-lang#133713 r? `@estebank`
sequences with another PR @bors p=1 |
…kingjubilee Rollup of 11 pull requests Successful merges: - rust-lang#136863 (rework rigid alias handling ) - rust-lang#136869 (Fix diagnostic when using = instead of : in let binding) - rust-lang#136895 (debuginfo: Set bitwidth appropriately in enum variant tags) - rust-lang#136928 (eagerly prove WF when resolving fully qualified paths) - rust-lang#136941 (Move `llvm.ccache` to `build.ccache`) - rust-lang#136950 (rustdoc: use better, consistent SVG icons for scraped examples) - rust-lang#136957 (coverage: Eliminate more counters by giving them to unreachable nodes) - rust-lang#136960 (Compiletest should not inherit all host RUSTFLAGS) - rust-lang#136962 (unify LLVM version finding logic) - rust-lang#136970 (ci: move `x86_64-gnu-debug` job to the free runner) - rust-lang#136973 (Fix `x test --stage 1 ui-fulldeps` on macOS (until the next beta bump)) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#136869 - chenyukang:yukang-fix-133713-let-binding, r=estebank Fix diagnostic when using = instead of : in let binding Fixes rust-lang#133713 r? ``@estebank``
Fixes #133713
r? @estebank