-
Notifications
You must be signed in to change notification settings - Fork 9
bump!: 🚀 cargo upgrades, nix pins, and the reedline API they broke #1746
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
Changes from all commits
61d8a96
5416960
b416546
21287fc
262f733
fb0d327
877a79d
08b8a4c
5acbc9e
ba5bcca
38ed97e
fef1ad0
aa7bb5c
dd98d78
f880786
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -287,11 +287,17 @@ fn expand(input: &DeriveInput) -> syn::Result<TokenStream2> { | |
| } | ||
| }) | ||
| .collect::<syn::Result<_>>()?; | ||
| // The `FixedSize` predicates pushed above are what let a wrapper field carry a | ||
| // non-`FixedSize` parameter, but on a non-generic key every one of them names a | ||
| // concrete type. A trivial bound in an item's param-env stops rustc evaluating | ||
| // `<Self as MatchKey>::KEY_SIZE` in `as_key`'s array length (E0284), so this impl | ||
| // takes the key's own generics and leaves the added predicates behind. | ||
| let (key_impl_generics, key_ty_generics, key_where_clause) = input.generics.split_for_impl(); | ||
| let as_key_impl = if is_generic { | ||
| quote! {} | ||
| } else { | ||
| quote! { | ||
| impl #impl_generics #key_ident #ty_generics #where_clause { | ||
| impl #key_impl_generics #key_ident #key_ty_generics #key_where_clause { | ||
|
Comment on lines
+290
to
+300
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -eu
printf '%s\n' '--- relevant source ---'
sed -n '60,170p;260,330p' match-action-derive/src/lib.rs
printf '%s\n' '--- candidate tests and usages ---'
rg -n --glob '*.rs' 'derive\(.*Match|MatchKey|FixedSize|Wrapper' .Repository: githedgehog/dataplane Length of output: 24705 🏁 Script executed: #!/bin/bash
set -eu
printf '%s\n' '--- macro expansion context ---'
sed -n '170,360p' match-action-derive/src/lib.rs
printf '%s\n' '--- generic derive tests ---'
sed -n '190,410p' match-action/tests/derive_roundtrip.rs
printf '%s\n' '--- FixedSize definition and implementations ---'
sed -n '1,120p' fixed-size/src/lib.rs
printf '%s\n' '--- tool availability ---'
command -v rustc || true
rustc --version 2>/dev/null || trueRepository: githedgehog/dataplane Length of output: 18240 🏁 Script executed: #!/bin/bash
set -eu
tmp="$(mktemp)"
trap 'rm -f "$tmp" "$tmp.stderr"' EXIT
cat >"$tmp" <<'RS'
trait FixedSize: Copy {
const SIZE: usize;
fn write_be(&self, out: &mut [u8]);
}
trait MatchKey: Sized {
const KEY_SIZE: usize;
fn as_key_into(&self, out: &mut [u8]);
}
#[derive(Copy, Clone)]
struct Wrapper<'a>(&'a u8);
/* The field type is FixedSize only for a restricted lifetime. */
impl<'a> FixedSize for Wrapper<'a>
where
'a: 'static,
{
const SIZE: usize = 1;
fn write_be(&self, out: &mut [u8]) {
out[0] = *self.0;
}
}
struct Key<'a> {
field: Wrapper<'a>,
}
/* This is the derive's MatchKey impl with the generated field predicate. */
impl<'a> MatchKey for Key<'a>
where
Wrapper<'a>: FixedSize,
{
const KEY_SIZE: usize = <Wrapper<'a> as FixedSize>::SIZE;
fn as_key_into(&self, out: &mut [u8]) {
<Wrapper<'a> as FixedSize>::write_be(&self.field, out);
}
}
/* This is the non-generic branch: it keeps input.generics but omits
the generated Wrapper<'a>: FixedSize predicate. */
impl<'a> Key<'a> {
fn as_key(&self) -> [u8; <Self as MatchKey>::KEY_SIZE] {
let mut buf = [0u8; <Self as MatchKey>::KEY_SIZE];
<Self as MatchKey>::as_key_into(self, &mut buf);
buf
}
}
fn main() {}
RS
rustc --edition=2021 --crate-type=bin "$tmp" 2>"$tmp.stderr" || true
cat "$tmp.stderr"Repository: githedgehog/dataplane Length of output: 406 🏁 Script executed: #!/bin/bash
set -eu
printf '%s\n' '--- rust toolchains ---'
rustup toolchain list 2>&1 || true
printf '%s\n' '--- compiler binaries ---'
find /usr /opt -type f -name rustc -perm -111 2>/dev/null | head -20 || true
printf '%s\n' '--- generated impl dependencies ---'
sed -n '330,430p' match-action-derive/src/lib.rs
printf '%s\n' '--- workspace manifests ---'
fd -i 'Cargo.toml' . -x sh -c 'echo --- "$1"; sed -n "1,120p" "$1"' sh {} \;Repository: githedgehog/dataplane Length of output: 49717 🏁 Script executed: #!/bin/bash
set -eu
rustc_bin=/usr/local/rustup/toolchains/1.97.1-x86_64-unknown-linux-gnu/bin/rustc
tmp="$(mktemp)"
trap 'rm -f "$tmp" "$tmp.stderr" "$tmp.fixed" "$tmp.fixed.stderr"' EXIT
cat >"$tmp" <<'RS'
trait FixedSize: Copy {
const SIZE: usize;
fn write_be(&self, out: &mut [u8]);
}
trait MatchKey: Sized {
const KEY_SIZE: usize;
fn as_key_into(&self, out: &mut [u8]);
}
#[derive(Copy, Clone)]
struct Wrapper<'a>(&'a u8);
impl<'a> FixedSize for Wrapper<'a> where 'a: 'static {
const SIZE: usize = 1;
fn write_be(&self, out: &mut [u8]) { out[0] = *self.0; }
}
struct Key<'a> { field: Wrapper<'a> }
impl<'a> MatchKey for Key<'a> where Wrapper<'a>: FixedSize {
const KEY_SIZE: usize = <Wrapper<'a> as FixedSize>::SIZE;
fn as_key_into(&self, out: &mut [u8]) {
<Wrapper<'a> as FixedSize>::write_be(&self.field, out);
}
}
impl<'a> Key<'a> {
fn as_key(&self) -> [u8; <Self as MatchKey>::KEY_SIZE] {
let mut buf = [0u8; <Self as MatchKey>::KEY_SIZE];
<Self as MatchKey>::as_key_into(self, &mut buf);
buf
}
}
fn main() {}
RS
set +e
"$rustc_bin" --edition=2024 --crate-type=bin "$tmp" -o /tmp/match-key-probe 2>"$tmp.stderr"
status=$?
set -e
printf '%s\n' "--- omitted-predicate branch (exit $status) ---"
cat "$tmp.stderr"
cat >"$tmp.fixed" <<'RS'
trait FixedSize: Copy { const SIZE: usize; fn write_be(&self, out: &mut [u8]); }
trait MatchKey: Sized { const KEY_SIZE: usize; fn as_key_into(&self, out: &mut [u8]); }
#[derive(Copy, Clone)]
struct Wrapper<'a>(&'a u8);
impl<'a> FixedSize for Wrapper<'a> where 'a: 'static {
const SIZE: usize = 1;
fn write_be(&self, out: &mut [u8]) { out[0] = *self.0; }
}
struct Key<'a> { field: Wrapper<'a> }
impl<'a> MatchKey for Key<'a> where Wrapper<'a>: FixedSize {
const KEY_SIZE: usize = <Wrapper<'a> as FixedSize>::SIZE;
fn as_key_into(&self, out: &mut [u8]) {
<Wrapper<'a> as FixedSize>::write_be(&self.field, out);
}
}
impl<'a> Key<'a>
where
Wrapper<'a>: FixedSize,
{
fn as_key(&self) -> [u8; <Self as MatchKey>::KEY_SIZE] {
let mut buf = [0u8; <Self as MatchKey>::KEY_SIZE];
<Self as MatchKey>::as_key_into(self, &mut buf);
buf
}
}
fn main() {
let value = 1u8;
let key = Key { field: Wrapper(&value) };
let _ = key.as_key();
}
RS
"$rustc_bin" --edition=2024 --crate-type=bin "$tmp.fixed" -o /tmp/match-key-probe-fixed 2>"$tmp.fixed.stderr"
printf '%s\n' '--- predicate-preserved branch ---'
cat "$tmp.fixed.stderr"
rm -f /tmp/match-key-probe /tmp/match-key-probe-fixedRepository: githedgehog/dataplane Length of output: 957 🏁 Script executed: #!/bin/bash
set -u
rustc_bin=/usr/local/rustup/toolchains/1.97.1-x86_64-unknown-linux-gnu/bin/rustc
dir="$(mktemp -d)"
trap 'rm -rf "$dir"' EXIT
cat >"$dir/unconditional.rs" <<'RS'
trait FixedSize: Copy { const SIZE: usize; fn write_be(&self, out: &mut [u8]); }
trait MatchKey: Sized { const KEY_SIZE: usize; fn as_key_into(&self, out: &mut [u8]); }
#[derive(Copy, Clone)]
struct Wrapper<'a>(&'a u8);
impl<'a> FixedSize for Wrapper<'a> {
const SIZE: usize = 1;
fn write_be(&self, out: &mut [u8]) { out[0] = *self.0; }
}
struct Key<'a> { field: Wrapper<'a> }
impl<'a> MatchKey for Key<'a> where Wrapper<'a>: FixedSize {
const KEY_SIZE: usize = <Wrapper<'a> as FixedSize>::SIZE;
fn as_key_into(&self, out: &mut [u8]) {
<Wrapper<'a> as FixedSize>::write_be(&self.field, out);
}
}
impl<'a> Key<'a> {
fn as_key(&self) -> [u8; <Self as MatchKey>::KEY_SIZE] {
let mut buf = [0u8; <Self as MatchKey>::KEY_SIZE];
<Self as MatchKey>::as_key_into(self, &mut buf);
buf
}
}
fn main() {}
RS
cat >"$dir/no_helper.rs" <<'RS'
trait FixedSize: Copy { const SIZE: usize; fn write_be(&self, out: &mut [u8]); }
trait MatchKey: Sized { const KEY_SIZE: usize; fn as_key_into(&self, out: &mut [u8]); }
#[derive(Copy, Clone)]
struct Wrapper<'a>(&'a u8);
impl<'a> FixedSize for Wrapper<'a> {
const SIZE: usize = 1;
fn write_be(&self, out: &mut [u8]) { out[0] = *self.0; }
}
struct Key<'a> { field: Wrapper<'a> }
impl<'a> MatchKey for Key<'a> where Wrapper<'a>: FixedSize {
const KEY_SIZE: usize = <Wrapper<'a> as FixedSize>::SIZE;
fn as_key_into(&self, out: &mut [u8]) {
<Wrapper<'a> as FixedSize>::write_be(&self.field, out);
}
}
fn main() {
let value = 1u8;
let key = Key { field: Wrapper(&value) };
let mut out = [0u8; 1];
key.as_key_into(&mut out);
}
RS
for case in unconditional no_helper; do
set +e
"$rustc_bin" --edition=2024 --crate-type=bin "$dir/$case.rs" -o "$dir/$case" >"$dir/$case.out" 2>&1
status=$?
set -e
printf '%s\n' "--- $case (exit $status) ---"
cat "$dir/$case.out"
doneRepository: githedgehog/dataplane Length of output: 1306 Classify lifetime-only keys as generic.
🤖 Prompt for AI Agents |
||
| #[must_use] | ||
| pub fn as_key(&self) -> [u8; <Self as #crate_path::MatchKey>::KEY_SIZE] { | ||
| let mut buf = [0u8; <Self as #crate_path::MatchKey>::KEY_SIZE]; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| sha256-QMISme7dq/dDuFbaqEPST51KAnEwZxzUWzshd2/ZqyY= | ||
| sha256-WAU9p2Zyu+tbClRBAhxYM4cHBS4Q+B13cUDKh5vUkc4= |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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.
🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
Repository: githedgehog/dataplane
Length of output: 839
🏁 Script executed:
Repository: githedgehog/dataplane
Length of output: 27011
🏁 Script executed:
Repository: githedgehog/dataplane
Length of output: 9339
🏁 Script executed:
Repository: githedgehog/dataplane
Length of output: 37522
🏁 Script executed:
Repository: githedgehog/dataplane
Length of output: 5603
Return an error when the netlink receiver fails.
When
messages.recv()returnsErr,runlogs the error, breaks, and returnsOk(()). Return anstd::io::Errorinstead.spawn_fatal_on_exitalready treats normal task exit as fatal, but direct callers still receive a false success. Add a test for this path.🤖 Prompt for AI Agents
Source: Coding guidelines