-
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
Fix incorrect mutable suggestion information for binding in ref pattern like: let &b = a;
#115595
Conversation
debug!("local_decl: {:?}", local_decl); | ||
let pat_span = match *local_decl.local_info() { | ||
LocalInfo::User(BindingForm::Var(mir::VarBindingForm { | ||
binding_mode: ty::BindingMode::BindByValue(Mutability::Not), |
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.
Probably not in scope for this PR, but we really should put a HirId
in here.
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.
Probably not in scope for this PR, but we really should put a
HirId
in here.
Thanks very much, since this will cause multiple changes when using LocalDecl
, I thought I could submit another pr to support this.
@bors r+ |
Fix incorrect mutable suggestion information for binding in ref pattern like: `let &b = a;` fixes rust-lang#114896 I find we have to get pat_span but not local_decl.source_info.span for suggestion. In `let &b = a;` pat_span is &b. I think check `let &b = a` in hir to make sure it is hir::Node::Local(hir::Local {pat: hir::Pat{kind: hir::PatKind::Ref(....... can distinguish it from other situation, but I'm not sure. If my processing method is not accurate, please guide me to modify it, thank you. r? `@davidtwco`
Rollup of 7 pull requests Successful merges: - rust-lang#115308 (suggest iter_mut() where trying to modify elements from .iter()) - rust-lang#115595 (Fix incorrect mutable suggestion information for binding in ref pattern like: `let &b = a;` ) - rust-lang#115702 (Update mailmap) - rust-lang#115708 (fix homogeneous_aggregate not ignoring some ZST) - rust-lang#115739 (Call `LateLintPass::check_attribute` from `with_lint_attrs`) - rust-lang#115743 (Point out if a local trait has no implementations) - rust-lang#115744 (Improve diagnostic for generic params from outer items (E0401)) r? `@ghost` `@rustbot` modify labels: rollup
☀️ Test successful - checks-actions |
Finished benchmarking commit (3ebb562): comparison URL. Overall result: no relevant changes - no action needed@rustbot label: -perf-regression Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)ResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 629.05s -> 629.503s (0.07%) |
fixes #114896
I find we have to get pat_span but not local_decl.source_info.span for suggestion. In
let &b = a;
pat_span is &b. I think checklet &b = a
in hir to make sure it is hir::Node::Local(hir::Local {pat: hir::Pat{kind: hir::PatKind::Ref(....... can distinguish it from other situation, but I'm not sure.If my processing method is not accurate, please guide me to modify it, thank you.
r? @davidtwco