-
Notifications
You must be signed in to change notification settings - Fork 465
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
adapter: fix merge skew in vars declaration #18004
Conversation
src/adapter/src/session/vars.rs
Outdated
@@ -1193,7 +1193,7 @@ impl SystemVars { | |||
/// Returns an iterator over the configuration parameters and their current | |||
/// values on disk. | |||
pub fn iter(&self) -> impl Iterator<Item = &dyn Var> { | |||
let vars: [&dyn Var; 22] = [ | |||
let vars: [&dyn Var; 23] = [ |
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.
If there is a way to not declare the type or use some type inference magic please feel free to force-push!
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.
@parker-timmerman any thoughts?
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.
Ideally we could do let vars: [&dyn Var; _] = ...
and it would infer the length of the array, unfortunately that syntax is gated behind an unstable feature generic_arg_infer.
What we could do though is put &dyn Var
on the first element i.e.
let vars = [
&self.config_has_synced_once as &dyn Var,
&self.max_aws_privatelink_connections,
...
];
which tells the compiler that we want to treat these as &dyn Var
, and allows it to infer the length.
It doesn't look great, but it's the only way I know of to get the type inference 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.
tbh I'm surprised the compiler didn't complain about the array being the wrong length 🤔
jk, just realized this was the result of a merge skew
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 really like that suggestion. This is not the first time this exact merge skew issue has happened, and it probably won't be the last.
Fixes a merge skew regression in some declaration of a fixed sized array.
Motivation
There was a merge skew with #17526 and #17966.
Tips for reviewer
N/A
Checklist
$T ⇔ Proto$T
mapping (possibly in a backwards-incompatible way) and therefore is tagged with aT-proto
label.