repo
string
pull_number
int64
instance_id
string
issue_numbers
list
base_commit
string
patch
string
test_patch
string
problem_statement
string
hints_text
string
created_at
string
version
string
updated_at
string
environment_setup_commit
string
FAIL_TO_PASS
list
PASS_TO_PASS
list
FAIL_TO_FAIL
list
PASS_TO_FAIL
list
source_dir
string
aya-rs/aya
774
aya-rs__aya-774
[ "636" ]
792f467d40dc4c6c543c62dda7a608863fc364dc
diff --git a/aya/src/maps/mod.rs b/aya/src/maps/mod.rs --- a/aya/src/maps/mod.rs +++ b/aya/src/maps/mod.rs @@ -291,9 +291,9 @@ macro_rules! impl_try_from_map { // rather than the repeated idents used later because the macro language does not allow one // repetition to be pasted inside another. ($ty_param...
diff --git a/aya/src/maps/hash_map/hash_map.rs b/aya/src/maps/hash_map/hash_map.rs --- a/aya/src/maps/hash_map/hash_map.rs +++ b/aya/src/maps/hash_map/hash_map.rs @@ -108,43 +108,22 @@ mod tests { use libc::{EFAULT, ENOENT}; use crate::{ - bpf_map_def, generated::{ bpf_attr, bpf...
cant' use LruHashMap in userspace the userspace HashMap try_from impl ```rust impl<'a, V: Pod, K: Pod> TryFrom<&'a mut Map> for HashMap<&'a mut MapData, V, K> { type Error = MapError; fn try_from(map: &'a mut Map) -> Result<HashMap<&'a mut MapData, V, K>, MapError> { match map { Ma...
https://docs.rs/aya/latest/src/aya/maps/hash_map/hash_map.rs.html#48 the crates.io version handled the lruhashmap maybe we can add a new type LruHashMap to fix this problem Do you have a test? I don't understand this issue. sorry for the late reply kernel space codes main.rs ```rust #[xdp(name = "lru_test")]...
2023-08-31T01:49:22Z
1.5
2023-09-01T15:30:33Z
1d272f38bd19f64652ac8a278948f61e66164856
[ "maps::hash_map::hash_map::tests::test_try_from_ok_lru", "maps::hash_map::per_cpu_hash_map::tests::test_try_from_ok_lru" ]
[ "maps::bloom_filter::tests::test_contains_not_found", "maps::bloom_filter::tests::test_contains_syscall_error", "maps::bloom_filter::tests::test_insert_ok", "maps::bloom_filter::tests::test_insert_syscall_error", "maps::bloom_filter::tests::test_new_ok", "maps::bloom_filter::tests::test_try_from_ok", "m...
[]
[]
auto_2025-06-07
aya-rs/aya
656
aya-rs__aya-656
[ "654" ]
61608e64583f9dc599eef9b8db098f38a765b285
diff --git a/Cargo.toml b/Cargo.toml --- a/Cargo.toml +++ b/Cargo.toml @@ -24,7 +24,6 @@ resolver = "2" default-members = [ "aya", - "aya-bpf-macros", "aya-log", "aya-log-common", "aya-log-parser", diff --git a/aya-obj/Cargo.toml b/aya-obj/Cargo.toml --- a/aya-obj/Cargo.toml +++ b/aya-obj/Carg...
diff --git a/aya-obj/src/obj.rs b/aya-obj/src/obj.rs --- a/aya-obj/src/obj.rs +++ b/aya-obj/src/obj.rs @@ -1486,7 +1486,7 @@ pub fn copy_instructions(data: &[u8]) -> Result<Vec<bpf_insn>, ParseError> { #[cfg(test)] mod tests { use alloc::vec; - use matches::assert_matches; + use assert_matches::assert_matc...
Kernel version detection is broken on WSL Using aya from with the yesterday's commit fails with ``` thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: ParseError(Parse("90.1", "patch"))', /home/debian/.cargo/git/checkouts/aya-c55fbc69175ac116/242d8c3/aya/src/maps/mod.rs:504:55 ``` when runnin...
2023-07-14T14:51:06Z
0.11
2023-07-15T03:18:35Z
61608e64583f9dc599eef9b8db098f38a765b285
[ "btf::btf::tests::parsing_older_ext_data", "btf::btf::tests::test_fixup_ptr", "btf::btf::tests::test_fixup_func_proto", "btf::btf::tests::test_fixup_datasec", "btf::btf::tests::test_parse_header", "btf::btf::tests::test_sanitize_datasec", "btf::btf::tests::test_parse_btf", "btf::btf::tests::test_sanit...
[ "tests::btf_relocations::relocate_enum64", "tests::btf_relocations::relocate_enum64_signed", "tests::btf_relocations::relocate_enum_signed", "tests::load::pin_lifecycle", "tests::smoke::xdp" ]
[ "tests::btf_relocations::relocate_pointer", "tests::elf::test_maps", "tests::btf_relocations::relocate_field", "tests::btf_relocations::relocate_struct_flavors", "tests::btf_relocations::relocate_enum", "tests::rbpf::use_map_with_rbpf", "tests::rbpf::run_with_rbpf", "tests::load::pin_lifecycle_kprobe"...
[]
auto_2025-06-07
aya-rs/aya
921
aya-rs__aya-921
[ "918" ]
1d272f38bd19f64652ac8a278948f61e66164856
diff --git a/aya/src/programs/cgroup_device.rs b/aya/src/programs/cgroup_device.rs --- a/aya/src/programs/cgroup_device.rs +++ b/aya/src/programs/cgroup_device.rs @@ -8,7 +8,7 @@ use crate::{ bpf_prog_get_fd_by_id, define_link_wrapper, load_program, query, CgroupAttachMode, FdLink, Link, ProgAttachLin...
diff --git a/aya/src/programs/links.rs b/aya/src/programs/links.rs --- a/aya/src/programs/links.rs +++ b/aya/src/programs/links.rs @@ -394,6 +397,125 @@ pub enum LinkError { SyscallError(#[from] SyscallError), } +#[derive(Debug)] +pub(crate) enum LinkRef { + Id(u32), + Fd(RawFd), +} + +bitflags::bitflags!...
Add TCX link support Following the recent addition of [link support for TC programs](https://lwn.net/Articles/938632/) we should add the necessary bits to support this in aya as well. The [commit adding support to the cilium ebpf library](https://github.com/cilium/ebpf/commit/417f8a264d2e691649ede9b995fb334e6c58ca...
2024-04-05T15:21:29Z
1.5
2024-10-09T09:31:40Z
1d272f38bd19f64652ac8a278948f61e66164856
[ "bpf::tests::test_adjust_to_page_size", "bpf::tests::test_max_entries_override", "maps::bloom_filter::tests::test_contains_syscall_error", "maps::bloom_filter::tests::test_contains_not_found", "maps::bloom_filter::tests::test_insert_ok", "maps::bloom_filter::tests::test_insert_syscall_error", "maps::blo...
[]
[]
[]
auto_2025-06-07
aya-rs/aya
897
aya-rs__aya-897
[ "896" ]
b6a84b658ae00f23d0f1721c30d11f2e57f99eab
diff --git a/aya-bpf-macros/src/cgroup_skb.rs b/aya-bpf-macros/src/cgroup_skb.rs --- a/aya-bpf-macros/src/cgroup_skb.rs +++ b/aya-bpf-macros/src/cgroup_skb.rs @@ -29,7 +29,7 @@ impl CgroupSkb { let section_name: Cow<'_, _> = if self.attach_type.is_some() { format!("cgroup_skb/{}", self.attach_type...
diff --git a/aya-bpf-macros/src/cgroup_skb.rs b/aya-bpf-macros/src/cgroup_skb.rs --- a/aya-bpf-macros/src/cgroup_skb.rs +++ b/aya-bpf-macros/src/cgroup_skb.rs @@ -66,7 +66,7 @@ mod tests { let expanded = prog.expand().unwrap(); let expected = quote! { #[no_mangle] - #[link_sect...
Error: error parsing BPF object: invalid program section `cgroup_skb` **My program code: ``` #[cgroup_skb] pub fn cg01(ctx: SkBuffContext) -> i32 { match try_cg02(ctx) { Ok(ret) => ret, Err(ret) => ret, } } fn try_cg01(ctx: SkBuffContext) -> Result<i32, i32> { info!(&ctx, "received...
Change ``` #[cgroup_skb] ``` to ``` #[cgroup_skb(ingress)] ``` if you want to hook to ingress or ``` #[cgroup_skb(egress)] ``` if you want to hook to egress @dave-tucker looks like this was broken in https://github.com/aya-rs/aya/commit/c72aab5f7b809b48273cd2fed4554ddff6b66bdf#diff-748602d38469...
2024-03-04T07:45:13Z
1.5
2024-03-04T08:53:45Z
1d272f38bd19f64652ac8a278948f61e66164856
[ "cgroup_skb::tests::cgroup_skb" ]
[ "cgroup_device::tests::test_cgroup_device", "btf_tracepoint::tests::test_btf_tracepoint", "cgroup_skb::tests::cgroup_skb_egress", "btf_tracepoint::tests::test_btf_tracepoint_with_function", "cgroup_skb::tests::cgroup_skb_ingress", "cgroup_skb::tests::priv_function", "cgroup_skb::tests::pub_crate_functio...
[]
[]
auto_2025-06-07
aya-rs/aya
431
aya-rs__aya-431
[ "427" ]
82773f46c8cff830b36b8b4f57100952eb6ec8d2
diff --git a/aya/src/maps/array/array.rs b/aya/src/maps/array/array.rs --- a/aya/src/maps/array/array.rs +++ b/aya/src/maps/array/array.rs @@ -1,4 +1,5 @@ use std::{ + borrow::Borrow, convert::{AsMut, AsRef}, marker::PhantomData, }; diff --git a/aya/src/maps/array/array.rs b/aya/src/maps/array/array.rs -...
diff --git a/aya/src/maps/hash_map/hash_map.rs b/aya/src/maps/hash_map/hash_map.rs --- a/aya/src/maps/hash_map/hash_map.rs +++ b/aya/src/maps/hash_map/hash_map.rs @@ -311,6 +317,27 @@ mod tests { assert!(hm.insert(1, 42, 0).is_ok()); } + #[test] + fn test_insert_boxed_ok() { + override_sysc...
API for updating maps with large Pod Although Rust is memory safe, it does not have any stack overflow protection. The default Rust stack is 2MB which is plenty for most applications. However, when dealing with Pod with large arrays embedded, it's possible to overflow the user space Rust stack. Here's an example: ...
We can change the insert() calls to take `AsRef<K>` and `AsRef<V>` so they work with both values and references (including boxes)
2022-11-01T20:35:41Z
0.11
2023-02-23T09:59:02Z
61608e64583f9dc599eef9b8db098f38a765b285
[ "maps::bloom_filter::tests::test_contains_syscall_error", "maps::bloom_filter::tests::test_contains_not_found", "maps::bloom_filter::tests::test_insert_ok", "maps::bloom_filter::tests::test_insert_syscall_error", "maps::bloom_filter::tests::test_new_not_created", "maps::bloom_filter::tests::test_new_ok", ...
[]
[]
[]
auto_2025-06-07
aya-rs/aya
90
aya-rs__aya-90
[ "88" ]
3a8e4fe9b91538a0fafd8c91ae96185c1a017651
diff --git a/aya/src/obj/mod.rs b/aya/src/obj/mod.rs --- a/aya/src/obj/mod.rs +++ b/aya/src/obj/mod.rs @@ -410,6 +410,7 @@ struct Section<'a> { address: u64, name: &'a str, data: &'a [u8], + size: u64, relocations: Vec<Relocation>, } diff --git a/aya/src/obj/mod.rs b/aya/src/obj/mod.rs --- a/a...
diff --git a/aya/src/obj/mod.rs b/aya/src/obj/mod.rs --- a/aya/src/obj/mod.rs +++ b/aya/src/obj/mod.rs @@ -607,6 +611,7 @@ mod tests { address: 0, name, data, + size: data.len() as u64, relocations: Vec::new(), } }
bpf(2) fails with invalid argument when creating .bss map I wanted to test out a simple example of using .data, .rodata, and .bss maps in Aya. It seems that .data and .rodata work just fine, but creating the .bss map always seems to fail with an invalid argument error. Inspecting the strace dump (shown below), the offe...
2021-10-31T00:02:13Z
0.10
2021-11-04T06:00:06Z
b9a544831c5b4cd8728e9cca6580c14a623b7793
[ "maps::hash_map::hash_map::tests::test_get_syscall_error", "maps::hash_map::hash_map::tests::test_insert_ok", "maps::hash_map::hash_map::tests::test_get_not_found", "maps::hash_map::hash_map::tests::test_insert_syscall_error", "maps::hash_map::hash_map::tests::test_iter", "maps::hash_map::hash_map::tests:...
[]
[]
[]
auto_2025-06-07
aya-rs/aya
85
aya-rs__aya-85
[ "84" ]
c4b6970774930540ece21df329a1abd8dcb4ceb7
diff --git a/aya/src/bpf.rs b/aya/src/bpf.rs --- a/aya/src/bpf.rs +++ b/aya/src/bpf.rs @@ -20,9 +20,9 @@ use crate::{ Object, ParseError, ProgramSection, }, programs::{ - CgroupSkb, CgroupSkbAttachType, KProbe, LircMode2, Lsm, PerfEvent, ProbeKind, Program, - ProgramData, ProgramError, ...
diff --git a/aya/src/obj/mod.rs b/aya/src/obj/mod.rs --- a/aya/src/obj/mod.rs +++ b/aya/src/obj/mod.rs @@ -1046,4 +1050,21 @@ mod tests { }) ); } + + #[test] + fn test_parse_section_btf_tracepoint() { + let mut obj = fake_obj(); + + assert_matches!( + obj.parse_...
Support BTF tracepoints (tp_btf/*, also called "BTF-enabled raw tracepoints") #68 added support for raw tracepoints (raw_tp/*). However, there's another variant of raw tracepoints which uses tp_btf/*. I don't fully understand how it work but I think it makes it so that you can access the arguments of the traced hook po...
2021-10-28T21:14:42Z
0.10
2021-10-29T16:37:08Z
b9a544831c5b4cd8728e9cca6580c14a623b7793
[ "maps::hash_map::hash_map::tests::test_get_syscall_error", "maps::hash_map::hash_map::tests::test_get_not_found", "maps::hash_map::hash_map::tests::test_insert_ok", "maps::hash_map::hash_map::tests::test_insert_syscall_error", "maps::hash_map::hash_map::tests::test_iter", "maps::hash_map::hash_map::tests:...
[]
[]
[]
auto_2025-06-07
aya-rs/aya
253
aya-rs__aya-253
[ "51" ]
b9a544831c5b4cd8728e9cca6580c14a623b7793
diff --git a/aya/src/programs/cgroup_skb.rs b/aya/src/programs/cgroup_skb.rs --- a/aya/src/programs/cgroup_skb.rs +++ b/aya/src/programs/cgroup_skb.rs @@ -9,7 +9,8 @@ use crate::{ bpf_prog_type::BPF_PROG_TYPE_CGROUP_SKB, }, programs::{ - define_link_wrapper, load_program, FdLink, Link, ProgAtt...
diff --git a/aya/src/programs/links.rs b/aya/src/programs/links.rs --- a/aya/src/programs/links.rs +++ b/aya/src/programs/links.rs @@ -153,7 +192,7 @@ pub(crate) use define_link_wrapper; mod tests { use std::{cell::RefCell, rc::Rc}; - use crate::programs::ProgramError; + use crate::programs::{OwnedLink, P...
lifecyle: Add a `forget()` API for `Link` Default behaviour is that the `Drop` trait calls `detach()` when the program is terminated (or panics). For some types of long running programs you may wish to intentionally `forget()` the fd wrapped by `Link`, so you can keep the program running after exit. Query and detach c...
I'm not sure it should be called `forget()`, but then again I am struggling to come up with a better name. Maybe something like `keep_program_attached()`, `disown()`, or `keep_attached()`. Maybe I'll come up with a better name.
2022-05-06T23:27:37Z
0.10
2022-05-12T18:56:36Z
b9a544831c5b4cd8728e9cca6580c14a623b7793
[ "maps::hash_map::hash_map::tests::test_insert_ok", "maps::hash_map::hash_map::tests::test_get_not_found", "maps::hash_map::hash_map::tests::test_get_syscall_error", "maps::hash_map::hash_map::tests::test_insert_syscall_error", "maps::hash_map::hash_map::tests::test_iter", "maps::hash_map::hash_map::tests:...
[]
[]
[]
auto_2025-06-07
fschutt/azul
2
fschutt__azul-2
[ "1" ]
af100e8cbddaeb26cf97cb9910518aaf6bd2ed3a
diff --git a/Cargo.toml b/Cargo.toml --- a/Cargo.toml +++ b/Cargo.toml @@ -4,7 +4,7 @@ version = "0.1.0" authors = ["Felix Schütt <felix.schuett@maps4print.com>"] [dependencies] -webrender = { git = "https://github.com/servo/webrender", rev = "9c9b97a5950899cdc57837e9237e9c020f1aee83" } +webrender = { git = "https:...
diff --git a/examples/test_content.css b/examples/test_content.css --- a/examples/test_content.css +++ b/examples/test_content.css @@ -3,7 +3,8 @@ color: #000000; border: 1px solid #b7b7b7; border-radius: 4px; - box-shadow: 0px 0px 3px #c5c5c5ad; + /*box-shadow: 0px 0px 3px #c5c5c5ad;*/ + box-sh...
"debug" example crashes I am not sure if it is expected on the current state of the project development, but I figured it would rather give some feedback: ``` $ env RUST_BACKTRACE=1 cargo run --example debug Finished dev [unoptimized + debuginfo] target(s) in 0.0 secs Running `target/debug/examples/debug...
2018-03-20T08:12:26Z
0.1
2018-03-20T08:28:37Z
56d6c2bac9b752264871afab1119a34365aceacb
[ "css_parser::test_parse_box_shadow_1", "css_parser::test_parse_box_shadow_10", "css_parser::test_parse_box_shadow_2", "css_parser::test_parse_box_shadow_5", "css_parser::test_parse_box_shadow_4", "css_parser::test_parse_box_shadow_3", "css_parser::test_parse_box_shadow_6", "css_parser::test_parse_box_...
[]
[]
[]
auto_2025-06-07
imsnif/bandwhich
23
imsnif__bandwhich-23
[ "16" ]
408ec397c81bb99d6727f01d5dc058e814012714
diff --git a/README.md b/README.md --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ Windows is not supported at the moment - if you'd like to contribute a windows p ### Usage ``` USAGE: - what [FLAGS] --interface <interface> + what [FLAGS] [OPTIONS] FLAGS: -h, --help Prints help information d...
diff --git a/README.md b/README.md --- a/README.md +++ b/README.md @@ -46,14 +46,14 @@ Note that since `what` sniffs network packets, it requires root privileges - so ### raw_mode `what` also supports an easier-to-parse mode that can be piped or redirected to a file. For example, try: ``` -what -i eth0 --raw | grep ...
Listen on all interfaces `what` now listens on the interface given by the `-i` flag. The default behaviour should probably be "listen on all interfaces", with the -i flag being an optional override. Things that are needed to do this: 1. The OS layer (eg. `os/linux.rs`) needs to be adjusted. 2. The `OsInputOutput` ...
2019-12-10T22:07:27Z
0.4
2019-12-22T09:53:02Z
408ec397c81bb99d6727f01d5dc058e814012714
[ "tests::cases::ui::basic_startup", "tests::cases::ui::layout_under_120_width_under_30_height", "tests::cases::ui::layout_under_150_width_under_30_height", "tests::cases::ui::layout_full_width_under_30_height", "tests::cases::ui::layout_under_120_width_full_height", "tests::cases::raw_mode::multiple_packet...
[]
[]
[]
auto_2025-06-07
imsnif/bandwhich
328
imsnif__bandwhich-328
[ "145", "213" ]
cf9b9f063420b153225d4e2ff49e22a2f97dbddf
diff --git a/Cargo.toml b/Cargo.toml --- a/Cargo.toml +++ b/Cargo.toml @@ -41,6 +41,7 @@ thiserror = "1.0.50" tokio = { version = "1.33", features = ["rt", "sync"] } trust-dns-resolver = "0.23.2" unicode-width = "0.1.11" +strum = { version = "0.25.0", features = ["derive"] } [target.'cfg(target_os = "linux")'.dep...
diff --git a/Cargo.lock b/Cargo.lock --- a/Cargo.lock +++ b/Cargo.lock @@ -187,6 +187,7 @@ dependencies = [ "resolv-conf", "rstest", "simplelog", + "strum", "sysinfo", "thiserror", "tokio", diff --git a/src/display/components/display_bandwidth.rs b/src/display/components/display_bandwidth.rs --- a/src/displ...
Units Hello, First of all thank you for this great utility. Is there any possibility to switch units to bps (bits per second) since bitrate is usually expressed this way? Thanks, Feature - bandwidth in Mbit/s Please add FLAGS -b, Bandwidth in Mbit/s
Hey - glad you like it. Well, this was modeled after the bandwidth measurement I've seen in other places (eg. when you download in firefox, you see "1.5 MB/s"). Do you have an example where the rate is represented in bits? Well, this is heavily used in video streaming. It makes sense if you are comparing measured ag...
2023-11-01T07:47:13Z
0.21
2024-04-15T07:09:23Z
cf9b9f063420b153225d4e2ff49e22a2f97dbddf
[ "tests::cases::ui::basic_only_connections", "tests::cases::ui::basic_only_addresses", "tests::cases::ui::basic_startup", "tests::cases::ui::two_windows_split_vertically", "tests::cases::ui::two_windows_split_horizontally", "tests::cases::ui::layout::case_3", "tests::cases::raw_mode::one_ip_packet_of_tra...
[]
[]
[]
auto_2025-06-07
imsnif/bandwhich
12
imsnif__bandwhich-12
[ "6" ]
c5d683078d0bb8727d26db6ce5e5563580d7f9d3
diff --git a/Cargo.lock b/Cargo.lock --- a/Cargo.lock +++ b/Cargo.lock @@ -34,6 +34,16 @@ name = "arc-swap" version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "async-trait" +version = "0.1.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +dep...
diff --git a/Cargo.lock b/Cargo.lock --- a/Cargo.lock +++ b/Cargo.lock @@ -1374,9 +1819,14 @@ dependencies = [ "checksum lock_api 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f8912e782533a93a167888781b836336a6ca5da6175c05944c86cf28c31104dc" "checksum log 0.3.9 (registry+https://github.com/rust-la...
Faster DNS resolution Right now we use just 1 background thread to resolve IPs into their hostnames with reverse dns. We could benefit from using a thread pool and doing this much quicker.
2019-11-20T21:03:55Z
0.3
2019-12-07T18:48:24Z
c5d683078d0bb8727d26db6ce5e5563580d7f9d3
[ "tests::cases::ui::basic_startup", "tests::cases::ui::layout_under_120_width_under_30_height", "tests::cases::ui::layout_under_150_width_under_30_height", "tests::cases::ui::layout_full_width_under_30_height", "tests::cases::ui::layout_under_120_width_full_height", "tests::cases::raw_mode::multiple_proces...
[]
[]
[]
auto_2025-06-07
imsnif/bandwhich
118
imsnif__bandwhich-118
[ "100" ]
e6bb39a5e992498e00bc3af47d92352865e3223d
diff --git a/.gitignore b/.gitignore --- a/.gitignore +++ b/.gitignore @@ -11,4 +11,4 @@ debian/* !debian/control !debian/copyright !debian/rules -!debian/source +!debian/source \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,9 @@ The format is ba...
diff --git a/src/tests/cases/snapshots/ui__basic_only_addresses.snap b/src/tests/cases/snapshots/ui__basic_only_addresses.snap --- a/src/tests/cases/snapshots/ui__basic_only_addresses.snap +++ b/src/tests/cases/snapshots/ui__basic_only_addresses.snap @@ -51,5 +51,5 @@ expression: "&terminal_draw_events_mirror[0]" │ ...
Option to change the default 'window' when terminal is small Is it possible to implement an option for default 'window' to display when the terminal size is small? I'd love to be able to get 'Utilization by connection' as default information, for example, instead of 'Utilization by process name'. And even more, an ...
I'd be open to adding `--connections`, `--remote-ips` and `--processes` flags. These would have to be mutually exclusive, and picking one of them would only display that window regardless of terminal size. If anyone wants to pick this up and is unsure how to proceed, give me a ping here or privately. Hello @imsni...
2020-01-14T23:51:55Z
0.14
2020-05-17T20:40:05Z
e6bb39a5e992498e00bc3af47d92352865e3223d
[ "tests::cases::ui::basic_processes_with_dns_queries", "tests::cases::ui::basic_startup", "tests::cases::ui::basic_only_connections", "tests::cases::ui::basic_only_processes", "tests::cases::ui::basic_only_addresses", "tests::cases::ui::two_windows_split_vertically", "tests::cases::ui::layout_under_120_w...
[ "tests::cases::raw_mode::bi_directional_traffic", "tests::cases::raw_mode::multiple_connections_from_remote_address", "tests::cases::raw_mode::multiple_packets_of_traffic_from_different_connections", "tests::cases::raw_mode::one_process_with_multiple_connections", "tests::cases::raw_mode::one_ip_packet_of_t...
[]
[]
auto_2025-06-07
imsnif/bandwhich
379
imsnif__bandwhich-379
[ "159" ]
23d187986ef2e835f144395b54cf05954aa99128
diff --git a/CHANGELOG.md b/CHANGELOG.md --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) ## Added * CI: include generated assets in release archive #359 - @cyqsimon +* Add PID column to the process table #379 - @notjedi ## Ch...
diff --git a/src/os/lsof_utils.rs b/src/os/lsof_utils.rs --- a/src/os/lsof_utils.rs +++ b/src/os/lsof_utils.rs @@ -259,6 +261,6 @@ com.apple 590 etoledom 204u IPv4 0x28ffb9c04111253f 0t0 TCP 192.168.1. } fn test_raw_connection_parse_process_name(raw_line: &str) { let connection = RawConnect...
Add PID column to processes table It would be useful to be able to toggle/flag into a process-level mode to group by pid and display more process-level information like the full command line. - For the "Utilization by process name" window, we could group by pid rather than process name so that it's easier to find sp...
Hey @llchan, thanks for the suggestion. I must admit I'm a little weary of adding stuff like this. I feel these sorts of features are something that could be implemented "on top" of bandwhich. Either requiring it as a library or using raw_mode. If you're looking for something to work on, I'd be happy to suggest some...
2024-03-15T04:06:26Z
0.22
2024-03-18T05:29:48Z
d9fa0894a34374394ea21f9d2aa9c26574d1506a
[ "display::components::display_bandwidth::tests::bandwidth_formatting", "tests::cases::ui::basic_startup", "tests::cases::ui::basic_only_addresses", "tests::cases::ui::basic_only_processes", "tests::cases::raw_mode::multiple_processes_with_multiple_connections", "tests::cases::ui::layout::case_3", "tests...
[]
[]
[]
auto_2025-06-07
sharkdp/bat
1,017
sharkdp__bat-1017
[ "1008" ]
d6abad908a51cf9396cc8521a5ec94b1fc9206ea
diff --git a/src/syntax_mapping.rs b/src/syntax_mapping.rs --- a/src/syntax_mapping.rs +++ b/src/syntax_mapping.rs @@ -42,6 +42,11 @@ impl<'a> SyntaxMapping<'a> { ) .unwrap(); + // See #1008 + mapping + .insert("rails", MappingTarget::MapToUnknown) + .unwr...
diff --git a/src/assets.rs b/src/assets.rs --- a/src/assets.rs +++ b/src/assets.rs @@ -481,4 +481,15 @@ mod tests { "Bourne Again Shell (bash)" ); } + + #[test] + fn issue_1008() { + let test = SyntaxDetectionTest::new(); + + assert_eq!( + test.syntax_for_file_w...
bin/rails script highlighted as HTML (Rails) instead of Ruby <!-- Hey there, thanks for creating an issue! In order to reproduce your issue, we might need to know a little bit more about the environment which you're running `bat` on. If you're on Linux or MacOS: Please run the script at https://github.com/sh...
Thank you for reporting this! We recently discussed whether first-line syntax detection should take precedence over the filename syntax detection: see #685 and https://github.com/sharkdp/bat/issues/891#issuecomment-604617183 Unfortunately, there are some cases where it's not favorable to rely on first-line detect...
2020-05-24T08:23:09Z
0.15
2020-05-24T09:27:48Z
2d1a92b7cc2af6c35f868cbefe9dbfe466c59fcb
[ "config::default_config_should_highlight_no_lines", "config::default_config_should_include_all_lines", "less::test_parse_less_version_487", "less::test_parse_less_version_551", "less::test_parse_less_version_529", "line_range::test_parse_partial_min", "less::test_parse_less_version_wrong_program", "li...
[]
[]
[]
auto_2025-06-07
sharkdp/bat
1,556
sharkdp__bat-1556
[ "1550" ]
c569774e1a8528fab91225dabdadf53fde3916ea
diff --git a/CHANGELOG.md b/CHANGELOG.md --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ - If `PAGER` (but not `BAT_PAGER` or `--pager`) is `more` or `most`, silently use `less` instead to ensure support for colors, see #1063 (@Enselic) - If `PAGER` is `bat`, silently use `less` to prevent recursion. For `BAT...
diff --git a/tests/integration_tests.rs b/tests/integration_tests.rs --- a/tests/integration_tests.rs +++ b/tests/integration_tests.rs @@ -652,6 +652,13 @@ fn config_location_test() { .assert() .success() .stdout("bat.conf\n"); + + bat_with_config() + .env("BAT_CONFIG_PATH", "not-ex...
BAT_CONFIG_PATH ignored by --generate-config-file <!-- Hey there, thank you for creating an issue! --> **What version of `bat` are you using?** <!-- Output of `bat --version` --> Newest **Describe the bug you encountered:** ![image](https://user-images.githubusercontent.com/55729509/108675764-3694ee80-7522-1...
Thank you for reporting this. Looks like a bug indeed. I can confirm this bug, which is generic. It is caused by ``` .filter(|config_path| config_path.is_file()) ``` in ``` pub fn config_file() -> PathBuf { env::var("BAT_CONFIG_PATH") .ok() .map(PathBuf::from) .filter(|conf...
2021-02-27T11:22:32Z
0.17
2021-02-28T14:19:15Z
c569774e1a8528fab91225dabdadf53fde3916ea
[ "config_location_test" ]
[ "line_range::test_ranges_open_low", "input::utf16le", "less::test_parse_less_version_487", "less::test_parse_less_version_551", "config::default_config_should_include_all_lines", "line_range::test_ranges_simple", "line_range::test_parse_full", "input::basic", "line_range::test_ranges_advanced", "p...
[]
[]
auto_2025-06-07
sharkdp/bat
1,522
sharkdp__bat-1522
[ "1521" ]
d36b091fd7c9050c80078c0fe286d09dbab0f45a
diff --git a/Cargo.lock b/Cargo.lock --- a/Cargo.lock +++ b/Cargo.lock @@ -17,9 +17,9 @@ dependencies = [ [[package]] name = "ansi_colours" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d0f302a81afc6a7f4350c04f0ba7cfab529cc009bca3324b3fb5764e6a...
diff --git a/Cargo.lock b/Cargo.lock --- a/Cargo.lock +++ b/Cargo.lock @@ -117,7 +106,7 @@ dependencies = [ "serial_test", "shell-words", "syntect", - "tempdir", + "tempfile", "unicode-width", "wait-timeout", "wild", diff --git a/Cargo.toml b/Cargo.toml --- a/Cargo.toml +++ b/Cargo.toml @@ -76,11 +73,11 @@ ...
RUSTSEC-2020-0053: dirs: dirs is unmaintained, use dirs-next instead When `cargo-audit` is run on any crate that depends directly or indirectly on bat, the following is output (for more info, see https://rustsec.org/advisories/RUSTSEC-2020-0053): ``` Crate: dirs Version: 3.0.1 Warning: unmaint...
2021-01-17T22:23:01Z
0.17
2021-02-16T16:42:31Z
c569774e1a8528fab91225dabdadf53fde3916ea
[ "config::default_config_should_highlight_no_lines", "config::default_config_should_include_all_lines", "less::test_parse_less_version_487", "input::utf16le", "input::basic", "less::test_parse_less_version_wrong_program", "less::test_parse_less_version_529", "line_range::test_parse_fail", "line_range...
[]
[]
[]
auto_2025-06-07
sharkdp/bat
1,518
sharkdp__bat-1518
[ "1503" ]
3af35492320077b2abf7cc70117ea02aa24389a3
diff --git a/Cargo.lock b/Cargo.lock --- a/Cargo.lock +++ b/Cargo.lock @@ -98,6 +98,7 @@ dependencies = [ "git2", "globset", "lazy_static", + "nix", "path_abs", "predicates", "semver", diff --git a/Cargo.lock b/Cargo.lock --- a/Cargo.lock +++ b/Cargo.lock @@ -213,12 +214,12 @@ dependencies = [ [[package]...
diff --git a/src/assets.rs b/src/assets.rs --- a/src/assets.rs +++ b/src/assets.rs @@ -329,7 +329,7 @@ mod tests { let input = Input::ordinary_file(file_path.as_os_str()); let dummy_stdin: &[u8] = &[]; - let mut opened_input = input.open(dummy_stdin).unwrap(); + let mut...
Can not run bat with input and output attached to /dev/null **Describe the bug you encountered:** ``` ▶ bat > /dev/null < /dev/null [bat error]: The output file is also an input! ``` **What did you expect to happen instead?** This is kind of a weird edge case, but running `bat` like this is actually useful ...
I looked into the `cat` source code again and I found that we missed a detail when this feature was sketched out for the first time. `cat` always checks, that the output is a "regular file", according to the filetype encoded in the `st_mode` field: ```c out_isreg = S_ISREG (stat_buf.st_mode) != 0; // ... /*...
2021-01-14T19:34:00Z
0.17
2021-02-28T22:04:49Z
c569774e1a8528fab91225dabdadf53fde3916ea
[ "input::basic", "preprocessor::test_try_parse_utf8_char", "line_range::test_ranges_all", "line_range::test_parse_partial_min", "line_range::test_ranges_advanced", "input::utf16le", "less::test_parse_less_version_wrong_program", "config::default_config_should_include_all_lines", "config::default_conf...
[]
[]
[]
auto_2025-06-07
sharkdp/bat
1,506
sharkdp__bat-1506
[ "1413" ]
b25713938d23b0ff59e82e3e969b56423028ce53
diff --git a/CHANGELOG.md b/CHANGELOG.md --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ - Print an 'Invalid syntax theme settings' error message if a custom theme is broken, see #614 (@Enselic) - If plain mode is set and wrap is not explicitly opted in, long lines will no be truncated, see #1426 - If `PAGER...
diff --git a/tests/integration_tests.rs b/tests/integration_tests.rs --- a/tests/integration_tests.rs +++ b/tests/integration_tests.rs @@ -499,6 +499,28 @@ fn pager_disable() { .stdout(predicate::eq("hello world\n").normalize()); } +#[test] +fn env_var_pager_value_bat() { + bat() + .env("PAGER", "...
Can't use `bat` at all! (Error: Use of bat as a pager is disallowed...) **What version of `bat` are you using?** bat 0.17.1 **Describe the bug you encountered:** Whenever I use `bat`, I'm shown the following error message: > [bat error]: Use of bat as a pager is disallowed in order to avoid infinite recursion...
That's intentional, see https://github.com/sharkdp/bat/pull/1343 Personally, I don't like this restriction too (but it's not hard to overcome). > That's intentional, see #1343 Hm. Kind of, but not to the extent documented here, actually. What we really want to avoid is infinite recursion (`bat` calls `bat` as pag...
2021-01-10T16:13:16Z
0.17
2021-08-20T04:48:10Z
c569774e1a8528fab91225dabdadf53fde3916ea
[ "env_var_pager_value_bat" ]
[ "config::default_config_should_include_all_lines", "less::test_parse_less_version_529", "config::default_config_should_highlight_no_lines", "less::test_parse_less_version_551", "input::basic", "input::utf16le", "less::test_parse_less_version_487", "less::test_parse_less_version_wrong_program", "line...
[]
[]
auto_2025-06-07
sharkdp/bat
1,889
sharkdp__bat-1889
[ "1703" ]
ed3246c423932561435d45c50fd8cd9e06add7f5
diff --git a/CHANGELOG.md b/CHANGELOG.md --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ - Python syntax highlighting no longer suffers from abysmal performance in specific scenarios. See #1688 (@keith-hall) - First line not shown in diff context. See #1891 (@divagant-martian) +- Do not ignore syntaxes that h...
diff --git a/src/assets.rs b/src/assets.rs --- a/src/assets.rs +++ b/src/assets.rs @@ -530,6 +554,42 @@ mod tests { assert_eq!(test.syntax_for_file("test.h"), "C"); } + #[test] + fn syntax_detection_with_extension_mapping_to_unknown() { + let mut test = SyntaxDetectionTest::new(); + + ...
Some *.conf files not highlighted I wanted to add syntax highlighting for for .tmux.conf file, so I add this file to `bat/syntaxes/` https://raw.githubusercontent.com/gerardroche/sublime-tmux/master/Tmux.sublime-syntax I then `bat cache -b` and try viewing my `.tmux.conf` file, but it is still plain with no synta...
I just realised that it works when I force it like this: `$ bat -l Tmux .tmux.conf` So why is it not detecting the file when it is named in the same way that the `bat -L` mentions? ie. `Tmux tmux.conf, tmux, .tmux.conf, .tmux` likely related: https://github.com/sharkdp/bat/...
2021-10-06T21:46:39Z
0.18
2021-10-25T15:59:13Z
8072d5a3e34494c80f10396481703a96997bb893
[ "assets::build_assets::tests::remove_explicit_context_sanity", "config::default_config_should_highlight_no_lines", "config::default_config_should_include_all_lines", "input::basic", "input::utf16le", "less::test_parse_less_version_487", "less::test_parse_less_version_529", "less::test_parse_less_versi...
[]
[]
[]
auto_2025-06-07
sharkdp/bat
1,440
sharkdp__bat-1440
[ "1438", "1438" ]
60e00d49a99f33eb90397c6932c770d82fd481ec
diff --git a/src/preprocessor.rs b/src/preprocessor.rs --- a/src/preprocessor.rs +++ b/src/preprocessor.rs @@ -72,7 +72,7 @@ pub fn replace_nonprintable(input: &[u8], tab_width: usize) -> String { } } // line feed - '\x0A' => output.push('␊'), + ...
diff --git a/CHANGELOG.md b/CHANGELOG.md --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,8 @@ ## Bugfixes -- only print themes hint in interactive mode (`bat --list-themes`), see #1439 (@rsteube) +- If the last line doesn't end with a newline character, don't add it if `--style=plain`, see #1438 (@Enselic) +- Onl...
Newline can be added even if --style=plain In #975 @sharkdp said this: > The fact that bat -p prints a trailing newline (even if there is no newline at the end of the file) should be considered a bug, I believe (but we should check older tickets, if there was a reason for this behavior). And I completely agree. T...
Thank you for taking the time to write this down in detail! Thank you for taking the time to write this down in detail!
2020-12-16T19:47:12Z
0.17
2021-01-06T21:41:06Z
c569774e1a8528fab91225dabdadf53fde3916ea
[ "plain_mode_does_not_add_nonexisting_newline" ]
[ "config::default_config_should_highlight_no_lines", "config::default_config_should_include_all_lines", "input::basic", "less::test_parse_less_version_487", "input::utf16le", "less::test_parse_less_version_529", "less::test_parse_less_version_wrong_program", "less::test_parse_less_version_551", "line...
[]
[]
auto_2025-06-07
sharkdp/bat
1,398
sharkdp__bat-1398
[ "1193" ]
8381945cb59aac45e4a60c597f114dbf0102cfcf
diff --git a/Cargo.lock b/Cargo.lock --- a/Cargo.lock +++ b/Cargo.lock @@ -99,6 +99,7 @@ dependencies = [ "assert_cmd", "atty", "clap", + "clircle", "console", "content_inspector", "dirs", diff --git a/Cargo.lock b/Cargo.lock --- a/Cargo.lock +++ b/Cargo.lock @@ -116,6 +117,7 @@ dependencies = [ "syntect"...
diff --git a/tests/integration_tests.rs b/tests/integration_tests.rs --- a/tests/integration_tests.rs +++ b/tests/integration_tests.rs @@ -1,11 +1,17 @@ -use assert_cmd::Command; +use assert_cmd::assert::OutputAssertExt; +use assert_cmd::cargo::CommandCargoExt; use predicates::{prelude::predicate, str::PredicateStrExt...
Infinite loop when "input file is output file" <!-- Hey there, thanks for creating an issue! In order to reproduce your issue, we might need to know a little bit more about the environment which you're running `bat` on. If you're on Linux or MacOS: Please run the script at https://github.com/sharkdp/bat/blob...
Thank you very much for reporting this! This should be fixed. I wonder how `cat` implements this feature? Apparently, it detects that file/inode behind the stdout file descriptor is the same as one of the input files. yes. it's comparing inodes: ```c if (out_isreg && stat_buf.st_dev == out_dev && ...
2020-11-24T23:38:38Z
0.17
2021-01-14T19:18:09Z
c569774e1a8528fab91225dabdadf53fde3916ea
[ "config::default_config_should_include_all_lines", "config::default_config_should_highlight_no_lines", "input::utf16le", "input::basic", "less::test_parse_less_version_487", "less::test_parse_less_version_529", "less::test_parse_less_version_wrong_program", "line_range::test_parse_partial_max", "lin...
[]
[]
[]
auto_2025-06-07
sharkdp/bat
1,276
sharkdp__bat-1276
[ "1163" ]
33128d75f22a7c029df17b1ee595865933551469
diff --git a/CHANGELOG.md b/CHANGELOG.md --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ ## Features - Adjust pager configuration to comply with `--wrap=never`, see #1255 (@gahag) +- Added a new `--style` value, `rule`, which adds a simple horizontal ruled line between files, see #1276 (@tommilligan) ## Bu...
diff --git a/tests/integration_tests.rs b/tests/integration_tests.rs --- a/tests/integration_tests.rs +++ b/tests/integration_tests.rs @@ -570,6 +570,18 @@ fn empty_file_leads_to_empty_output_with_grid_enabled() { .stdout(""); } +#[test] +fn empty_file_leads_to_empty_output_with_rule_enabled() { + bat() ...
Alternative to `grid` for style which only draws a line between files I'm not a fan of having my `cat`-alike draw a full-blown table, but I would like to have some visible "end of file, beginning of next file" separation. Unfortunately, `--style=header,grid` still draws the horizontal lines as if they were part of a...
Thank you for the feedback. Sounds good to me. Maybe we could also change the `grid` style whenever the sidebar is not visible? Instead of introducing a new style? > Maybe we could also change the grid style whenever the sidebar is not visible? Instead of introducing a new style? I considered that, but I proposed...
2020-10-06T16:29:46Z
0.16
2020-11-23T18:09:48Z
33128d75f22a7c029df17b1ee595865933551469
[ "grid_overrides_rule", "header_padding_rule", "empty_file_leads_to_empty_output_with_rule_enabled", "changes_header_rule", "changes_grid_header_numbers_rule", "header_numbers_rule", "rule", "changes_grid_header_rule", "changes_rule", "grid_header_rule", "grid_rule", "header_rule", "changes_g...
[ "config::default_config_should_highlight_no_lines", "config::default_config_should_include_all_lines", "input::basic", "input::utf16le", "less::test_parse_less_version_487", "less::test_parse_less_version_529", "less::test_parse_less_version_wrong_program", "less::test_parse_less_version_551", "line...
[]
[]
auto_2025-06-07
sharkdp/bat
562
sharkdp__bat-562
[ "557" ]
1ce0bc8e0d6364b3dbac07158ad6343f3d5769a3
diff --git a/Cargo.lock b/Cargo.lock --- a/Cargo.lock +++ b/Cargo.lock @@ -1,3 +1,5 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. [[package]] name = "adler32" version = "1.0.3" diff --git a/src/clap_app.rs b/src/clap_app.rs --- a/src/clap_app.rs +++ b/src/clap_app.rs...
diff --git /dev/null b/tests/examples/cache new file mode 100644 --- /dev/null +++ b/tests/examples/cache @@ -0,0 +1,1 @@ +test diff --git a/tests/integration_tests.rs b/tests/integration_tests.rs --- a/tests/integration_tests.rs +++ b/tests/integration_tests.rs @@ -448,3 +448,18 @@ fn utf16() { .success() ...
Bat is broken for filenames that are prefixes of "cache" The issue with files named "cache" was already identified in #245 and fixed in #275. However, the `clap` parser doesn't require an exact match: any prefix of the subcommand "cache" will do. So if you try `bat c` (or "ca", "cac", "cach"), one of the following will...
Which version of `bat` are you using? This should have been fixed and I can not reproduce this. I just discovered this myself. Version 0.10.0 I did `bat c` where c was a file and got the error ```bash ~ > bat c error: The following required arguments were not provided: <--build|--clear> USAGE: ...
2019-05-10T19:03:15Z
0.10
2019-05-10T22:55:52Z
1ce0bc8e0d6364b3dbac07158ad6343f3d5769a3
[ "does_not_print_unwanted_file_named_cache" ]
[ "config::empty", "config::comments", "config::multi_line", "config::quotes", "config::multiple", "inputfile::utf16le", "inputfile::basic", "config::single", "line_range::test_parse_fail", "line_range::test_parse_partial_max", "line_range::test_parse_full", "line_range::test_parse_partial_min",...
[]
[]
auto_2025-06-07
artichoke/artichoke
2,449
artichoke__artichoke-2449
[ "2361", "2361" ]
73f8bd2f4c30bd7057b7f471b8928d6312440d06
diff --git a/artichoke-backend/src/extn/core/string/mruby.rs b/artichoke-backend/src/extn/core/string/mruby.rs --- a/artichoke-backend/src/extn/core/string/mruby.rs +++ b/artichoke-backend/src/extn/core/string/mruby.rs @@ -23,6 +23,7 @@ pub fn init(interp: &mut Artichoke) -> InitializeResult<()> { .add_method(...
diff --git a/spinoso-string/src/lib.rs b/spinoso-string/src/lib.rs --- a/spinoso-string/src/lib.rs +++ b/spinoso-string/src/lib.rs @@ -2117,4 +2221,56 @@ mod tests { assert_eq!(utf8, binary); assert_eq!(binary, ascii); } + + #[test] + fn byteindex_supports_needle_and_haystack_of_different_e...
Add `byteindex` and `byterindex` methods to `spinoso-string` The existing `spinoso_string::String::index` and `spinoso_string::String::rindex` methods return byte indexes, but should operate on characters. Expose new methods `spinoso_string::String::byteindex` and `spinoso_string::String::byterindex` which preserve ...
2023-03-21T14:49:35Z
0.21
2023-04-11T03:32:01Z
73f8bd2f4c30bd7057b7f471b8928d6312440d06
[ "enc::ascii::inspect::tests::del", "enc::ascii::inspect::tests::emoji", "enc::ascii::inspect::tests::ascii_control", "enc::ascii::inspect::tests::empty", "enc::ascii::inspect::tests::escape_inner_slash", "enc::ascii::inspect::tests::escape_slash", "enc::ascii::inspect::tests::fred", "enc::ascii::inspe...
[]
[]
[]
auto_2025-06-03
artichoke/artichoke
2,416
artichoke__artichoke-2416
[ "2194" ]
2246959a46f627a455a1dc5ca0fff0d5c5f795e9
diff --git a/Cargo.lock b/Cargo.lock --- a/Cargo.lock +++ b/Cargo.lock @@ -748,7 +748,7 @@ dependencies = [ [[package]] name = "spinoso-time" -version = "0.7.0" +version = "0.7.1" dependencies = [ "once_cell", "regex", diff --git a/artichoke-backend/Cargo.toml b/artichoke-backend/Cargo.toml --- a/artichoke-bac...
diff --git a/spinoso-time/src/time/tzrs/math.rs b/spinoso-time/src/time/tzrs/math.rs --- a/spinoso-time/src/time/tzrs/math.rs +++ b/spinoso-time/src/time/tzrs/math.rs @@ -304,6 +304,15 @@ mod tests { } } + #[test] + fn add_out_of_fixnum_range_float_sec() { + let dt = datetime(); + dt...
`Time::checked_add_f64` and `Time::checked_sub_f64` panic on too large input ```rust use core::time::Duration; fn main() { dbg!(Duration::from_secs_f64(f64::MAX)); } ``` Output: ``` Compiling playground v0.0.1 (/playground) Finished dev [unoptimized + debuginfo] target(s) in 0.58s Running `...
I've put up a stabilization PR for this feature in Rust `std` here: https://github.com/rust-lang/rust/pull/102271. These functions were stabilized and released today in Rust 1.66.0: - https://doc.rust-lang.org/stable/std/time/struct.Duration.html#method.try_from_secs_f32 - https://blog.rust-lang.org/2022/12/15/Rust...
2023-02-19T19:20:14Z
4.1
2023-02-19T19:33:19Z
2246959a46f627a455a1dc5ca0fff0d5c5f795e9
[ "time::tzrs::math::tests::add_out_of_fixnum_range_float_sec", "time::tzrs::math::tests::sub_out_of_fixnum_range_float_sec" ]
[ "time::tzrs::math::tests::add_int_to_time", "time::tzrs::math::tests::add_float_to_time", "time::tzrs::math::tests::add_subsec_float_to_time", "time::tzrs::math::tests::rounding", "time::tzrs::math::tests::rounding_rollup", "time::tzrs::math::tests::sub_float_to_time", "time::tzrs::math::tests::sub_int_...
[]
[]
auto_2025-06-03
artichoke/artichoke
2,073
artichoke__artichoke-2073
[ "2072" ]
b3284a42fb0d175da1a822bda73bd300ddab72c3
diff --git a/spinoso-time/src/time/tzrs/parts.rs b/spinoso-time/src/time/tzrs/parts.rs --- a/spinoso-time/src/time/tzrs/parts.rs +++ b/spinoso-time/src/time/tzrs/parts.rs @@ -316,7 +316,7 @@ impl Time { self.inner.local_time_type().is_dst() } - /// Returns an integer representing the day of the week,...
diff --git a/spinoso-time/src/time/tzrs/parts.rs b/spinoso-time/src/time/tzrs/parts.rs --- a/spinoso-time/src/time/tzrs/parts.rs +++ b/spinoso-time/src/time/tzrs/parts.rs @@ -550,4 +550,29 @@ mod tests { assert_eq!("UTC", dt.time_zone()); assert!(dt.is_utc()); } + + #[test] + fn yday() { + ...
The doc of `spinoso_time::tzrs::Time::day_of_year()` is inconsistent with its implementation The doc of `spinoso_time::tzrs::Time::day_of_year()` is inconsistent with its implementation: https://github.com/artichoke/artichoke/blob/b3284a42fb0d175da1a822bda73bd300ddab72c3/spinoso-time/src/time/tzrs/parts.rs#L511-L533. ...
2022-08-11T15:52:40Z
1.62
2022-08-11T16:20:21Z
b3284a42fb0d175da1a822bda73bd300ddab72c3
[ "time::tzrs::parts::tests::yday" ]
[ "time::chrono::build::tests::time_at_with_max_i64_overflow", "time::chrono::build::tests::time_at_with_min_i64_overflow", "time::chrono::build::tests::time_at_with_negative_sub_second_nanos", "time::chrono::build::tests::time_at_with_overflowing_negative_sub_second_nanos", "time::chrono::build::tests::time_...
[]
[]
auto_2025-06-03
artichoke/artichoke
1,047
artichoke__artichoke-1047
[ "1046" ]
7b867a30a442cde8c3ab8fd0b585432f93f7fa1a
diff --git a/spinoso-string/src/lib.rs b/spinoso-string/src/lib.rs --- a/spinoso-string/src/lib.rs +++ b/spinoso-string/src/lib.rs @@ -32,7 +32,6 @@ extern crate std; use alloc::boxed::Box; use alloc::vec::{self, Vec}; -use core::char::REPLACEMENT_CHARACTER; use core::cmp::Ordering; use core::convert::TryFrom; u...
diff --git a/spinoso-string/src/lib.rs b/spinoso-string/src/lib.rs --- a/spinoso-string/src/lib.rs +++ b/spinoso-string/src/lib.rs @@ -1804,6 +1800,7 @@ fn conventionally_utf8_bytestring_len<T: AsRef<[u8]>>(bytes: T) -> usize { #[cfg(test)] #[allow(clippy::clippy::shadow_unrelated)] mod tests { + use alloc::strin...
String::make_capitalized removes invalid UTF-8 byte sequences and the Unicode replacement character from conventionally UTF-8 strings Introduced in #1045. Two branches in the `String::make_capitalized` implementation cause both invalid UTF-8 byte sequences and the Unicode replacement character to be stripped from th...
2021-01-14T16:08:28Z
0.4
2021-01-14T18:05:35Z
a3ec3b702a9ee559a85eb5f47ef6a707d547cd4b
[ "tests::make_capitalized_utf8_string_invalid_utf8", "tests::make_capitalized_utf8_string_unicode_replacement_character" ]
[ "tests::make_capitalized_binary_string_ascii", "tests::fuzz_char_len_utf8_contents_binary_string", "tests::fuzz_bytesize_binary_contents_utf8_string", "tests::fuzz_bytesize_utf8_contents_utf8_string", "tests::fuzz_char_len_binary_contents_utf8_string", "tests::fuzz_len_binary_contents_ascii_string", "te...
[]
[]
auto_2025-06-03
asciinema/asciinema
601
asciinema__asciinema-601
[ "598" ]
477bc8c0f48d9c22cc90f0b630c96d2ee110f17f
diff --git a/Cargo.lock b/Cargo.lock --- a/Cargo.lock +++ b/Cargo.lock @@ -89,14 +89,12 @@ dependencies = [ "anyhow", "clap", "config", - "mio", "nix", "reqwest", "rustyline", "serde", "serde_json", "signal-hook", - "signal-hook-mio", "termion", "uuid", ] diff --git a/Cargo.lock b/Cargo.lock --- ...
diff --git a/src/pty.rs b/src/pty.rs --- a/src/pty.rs +++ b/src/pty.rs @@ -310,6 +289,49 @@ fn write_all<W: Write>(sink: &mut W, data: &mut Vec<u8>) -> io::Result<usize> { Ok(left) } +struct SignalFd { + sigid: SigId, + rx: i32, +} + +impl SignalFd { + fn open(signal: libc::c_int) -> Result<Self> { + ...
Recording crashes on macOS - Invalid argument (os error 22) ```sh $ target/release/asciinema rec demo.cast Error: Invalid argument (os error 22) ``` Seems to be related to https://github.com/tokio-rs/mio/issues/1377
More on the problem: https://nathancraddock.com/blog/macos-dev-tty-polling/ The `select`+thread trick described here is something to consider: https://code.saghul.net/2016/05/libuv-internals-the-osx-select2-trick/
2024-01-06T15:31:14Z
1.0
2024-01-12T13:19:53Z
6dbc5219e56e34c1e347b2264ed315d33a6a1dc0
[ "format::asciicast::tests::accelerate", "format::asciicast::tests::limit_idle_time", "format::asciicast::tests::write_header", "format::asciicast::tests::open", "format::asciicast::tests::writer", "pty::tests::exec" ]
[]
[]
[]
auto_2025-06-03
ash-rs/ash
216
ash-rs__ash-216
[ "204" ]
19771a8200ea9f2aad8039644ee1b16e8522a034
diff --git a/ash/Cargo.toml b/ash/Cargo.toml --- a/ash/Cargo.toml +++ b/ash/Cargo.toml @@ -8,6 +8,7 @@ repository = "https://github.com/MaikKlein/ash" readme = "../README.md" keywords = ["vulkan", "graphic"] documentation = "https://docs.rs/ash" +edition = "2018" [dependencies] shared_library = "0.1.9" diff --gi...
diff --git a/ash/tests/constant_size_arrays.rs b/ash/tests/constant_size_arrays.rs --- a/ash/tests/constant_size_arrays.rs +++ b/ash/tests/constant_size_arrays.rs @@ -1,4 +1,4 @@ -extern crate ash; +use ash; use ash::vk::{PhysicalDeviceProperties, PipelineColorBlendStateCreateInfo}; diff --git a/ash/tests/display....
Migrate to edition 2018 We should probably migrate to 2018 and clean up old patterns. `rustfix` should fix most of the issues, but the generator would require a few manual changes.
2019-05-25T19:41:11Z
0.29
2019-05-26T21:28:09Z
19771a8200ea9f2aad8039644ee1b16e8522a034
[ "assert_ffi_array_param_is_pointer", "assert_struct_field_is_array", "debug_enum", "debug_flags" ]
[]
[]
[]
auto_2025-06-03
mozilla/cbindgen
401
mozilla__cbindgen-401
[ "397" ]
5b4cda0d95690f00a1088f6b43726a197d03dad0
diff --git a/src/bindgen/bindings.rs b/src/bindgen/bindings.rs --- a/src/bindgen/bindings.rs +++ b/src/bindgen/bindings.rs @@ -2,10 +2,13 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +use std::cell::RefCell; +use std::collec...
diff --git a/tests/expectations/associated_in_body.cpp b/tests/expectations/associated_in_body.cpp --- a/tests/expectations/associated_in_body.cpp +++ b/tests/expectations/associated_in_body.cpp @@ -32,11 +32,11 @@ struct StyleAlignFlags { static const StyleAlignFlags END; static const StyleAlignFlags FLEX_START;...
Initialize struct literals with list-initializer On cbindgen 0.9.1, Values of bitflags are converted to static const items with designated initializer. But designated initializer is not available in C++11. Sadly, It is available in C++20. https://en.cppreference.com/w/cpp/language/aggregate_initialization#Designated...
2019-10-12T13:18:55Z
0.9
2019-11-18T02:03:42Z
5b4cda0d95690f00a1088f6b43726a197d03dad0
[ "test_struct_literal_order" ]
[ "bindgen::mangle::generics", "test_no_includes", "test_custom_header", "test_include_guard", "test_cfg_field", "test_alias", "test_cdecl", "test_docstyle_doxy", "test_docstyle_c99", "test_assoc_constant", "test_annotation", "test_body", "test_array", "test_include_item", "test_assoc_cons...
[ "test_expand_features", "test_expand_default_features", "test_expand_dep", "test_expand", "test_expand_no_default_features" ]
[]
auto_2025-06-12
mozilla/cbindgen
332
mozilla__cbindgen-332
[ "331" ]
46aed0802ae6b3e766dfb3f36680221c29f9d2fc
diff --git a/src/bindgen/cargo/cargo.rs b/src/bindgen/cargo/cargo.rs --- a/src/bindgen/cargo/cargo.rs +++ b/src/bindgen/cargo/cargo.rs @@ -6,9 +6,11 @@ use std::path::{Path, PathBuf}; use bindgen::cargo::cargo_expand; use bindgen::cargo::cargo_lock::{self, Lock}; +pub(crate) use bindgen::cargo::cargo_metadata::Pack...
diff --git a/src/bindgen/cargo/cargo_metadata.rs b/src/bindgen/cargo/cargo_metadata.rs --- a/src/bindgen/cargo/cargo_metadata.rs +++ b/src/bindgen/cargo/cargo_metadata.rs @@ -24,23 +26,28 @@ use serde_json; /// Starting point for metadata returned by `cargo metadata` pub struct Metadata { /// A list of all crate...
Plan For Refactor: Ignore Extern Crates Completely In Rust 2018 you're idiomatically supposed to avoid using `extern crate` as much as possible (not always possible). This means cbindgen cannot rely on `extern crate` being present. At the same time, even if `extern crate` is present, that name might be a rename tha...
2019-04-30T19:11:42Z
0.8
2019-05-02T21:39:41Z
46aed0802ae6b3e766dfb3f36680221c29f9d2fc
[ "bindgen::mangle::generics", "test_no_includes", "test_docstyle_doxy", "test_inner_mod", "test_global_attr", "test_union", "test_nonnull", "test_lifetime_arg", "test_typedef", "test_prefixed_struct_literal", "test_item_types", "test_docstyle_auto", "test_cfg_field", "test_assoc_const_confl...
[]
[]
[]
auto_2025-06-12
mozilla/cbindgen
293
mozilla__cbindgen-293
[ "100" ]
e712cc42c759ace3e47a6ee9fdbff8c4f337cec1
diff --git a/Cargo.lock b/Cargo.lock --- a/Cargo.lock +++ b/Cargo.lock @@ -34,6 +34,8 @@ version = "0.8.0" dependencies = [ "clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.25 (registry+https://github.com/...
diff --git a/.travis.yml b/.travis.yml --- a/.travis.yml +++ b/.travis.yml @@ -9,11 +9,11 @@ addons: sources: - ubuntu-toolchain-r-test packages: - - gcc-4.9 - - g++-4.9 -env: - - MATRIX_EVAL="CC=gcc-4.9 && CXX=g++-4.9" + - gcc-7 + - g++-7 script: + - export CC=gcc-...
Handle bitflags It would be nice to be able to use [`bitflags!`](https://github.com/rust-lang-nursery/bitflags) and have nice output generated. Ideally the output of macro expansion would just naturally work. Currently the output of a `bitflags!` macro is a struct containing an integer, some trait implementations, a...
I can confirm the expanded output does work outside of the associated constants. For instance, with macro expansion enabled, this ```rust bitflags! { #[repr(C)] pub struct Flags: u32 { const A = 0b00000001; } } #[no_mangle] pub extern "C" fn call_flag(value: &Flags) -> u32 { value....
2019-02-24T02:01:02Z
0.8
2019-02-26T05:39:16Z
46aed0802ae6b3e766dfb3f36680221c29f9d2fc
[ "bindgen::mangle::generics" ]
[]
[]
[]
auto_2025-06-12
mozilla/cbindgen
519
mozilla__cbindgen-519
[ "518" ]
b6b88f8c3024288287368b377e4d928ddcd2b9e2
diff --git a/docs.md b/docs.md --- a/docs.md +++ b/docs.md @@ -335,7 +348,6 @@ Given configuration in the cbindgen.toml, `cbindgen` can generate these attribut This is controlled by the `swift_name_macro` option in the cbindgen.toml. - ## cbindgen.toml Most configuration happens through your cbindgen.toml file...
diff --git a/docs.md b/docs.md --- a/docs.md +++ b/docs.md @@ -235,6 +235,19 @@ An annotation may be a bool, string (no quotes), or list of strings. If just the Most annotations are just local overrides for identical settings in the cbindgen.toml, but a few are unique because they don't make sense in a global contex...
Exclude parsing of module paths in crate Hello! I ran into an issue with cbindgen where I want to expose multiple C interfaces in a single static/dynamic library but want to avoid including one of these interfaces in the generated header file. The reason for this is that our Wasm runtime has a C API but we also wan...
Can you post a concrete example so that I can wrap my head around it please? You can conditionally import / define stuff using `#[cfg]`, but I understand that what you want is to completely ignore a module, right? I wonder if something like: ```rust #[cbindgen::ignore] mod foo; ``` or such? Sure, but the...
2020-05-01T02:40:21Z
0.14
2020-05-15T13:43:59Z
6b4181540c146fff75efd500bfb75a2d60403b4c
[ "bindgen::mangle::generics", "test_const_conflict", "test_bitflags", "test_no_includes", "test_cfg_field", "test_documentation_attr", "test_cdecl", "test_export_name", "test_function_sort_name", "test_docstyle_c99", "test_function_sort_none", "test_cfg", "test_constant_constexpr", "test_as...
[]
[]
[]
auto_2025-06-12
mozilla/cbindgen
501
mozilla__cbindgen-501
[ "500" ]
6fd245096dcd5c50c1065b4bd6ce62a09df0b39b
diff --git a/src/bindgen/library.rs b/src/bindgen/library.rs --- a/src/bindgen/library.rs +++ b/src/bindgen/library.rs @@ -54,7 +54,6 @@ impl Library { } pub fn generate(mut self) -> Result<Bindings, Error> { - self.remove_excluded(); self.transfer_annotations(); self.simplify_stand...
diff --git /dev/null b/tests/expectations/both/exclude_generic_monomorph.c new file mode 100644 --- /dev/null +++ b/tests/expectations/both/exclude_generic_monomorph.c @@ -0,0 +1,15 @@ +#include <stdint.h> + +typedef uint64_t Option_Foo; + + +#include <stdarg.h> +#include <stdbool.h> +#include <stdint.h> +#include <std...
Manually avoid declaring opaque structs My code uses the following types on the FFI: ```rust struct Foo(NonZeroU64); struct Bar { foo: Option<Foo>, } ``` What I want here really is `foo: u64`. What `cbindgen` ends up producing is: ```cpp typedef struct Option_Foo Option_Foo; ``` It looks like this opa...
@emilio @Gankra could you post your thoughts on that? We need to confer with the Rust devs to verify that `Option<NonZeroU64>` actually has the Integer type kind in rustc's ABI lowering (naively it is an Aggregate), and that this is guaranteed. As is, the libs docs only guarantee that it has the same size. It's also...
2020-03-31T15:44:12Z
0.13
2020-04-01T09:46:05Z
6fd245096dcd5c50c1065b4bd6ce62a09df0b39b
[ "test_exclude_generic_monomorph" ]
[ "bindgen::mangle::generics", "test_include_guard", "test_custom_header", "test_no_includes", "test_cell", "test_assoc_constant", "test_char", "test_docstyle_auto", "test_docstyle_doxy", "test_const_transparent", "test_bitflags", "test_assoc_const_conflict", "test_reserved", "test_cfg_2", ...
[ "test_expand_no_default_features", "test_expand_dep", "test_expand_features", "test_expand", "test_expand_default_features", "test_expand_dep_v2" ]
[]
auto_2025-06-12
mozilla/cbindgen
494
mozilla__cbindgen-494
[ "493" ]
17d7aad7d07dce8aa665aedbc75c39953afe1600
diff --git a/src/bindgen/parser.rs b/src/bindgen/parser.rs --- a/src/bindgen/parser.rs +++ b/src/bindgen/parser.rs @@ -707,11 +707,22 @@ impl Parse { return; } }; - if ty.is_none() { - return; - } - let impl_path = ty.unwrap().get_root_path().unwr...
diff --git /dev/null b/tests/expectations/associated_constant_panic.c new file mode 100644 --- /dev/null +++ b/tests/expectations/associated_constant_panic.c @@ -0,0 +1,4 @@ +#include <stdarg.h> +#include <stdbool.h> +#include <stdint.h> +#include <stdlib.h> diff --git /dev/null b/tests/expectations/associated_constant...
Panics with parse_deps=true When running cbindgen in [this](https://github.com/RazrFalcon/ttf-parser/tree/master/c-api) dir with such config: ```toml language = "C" include_guard = "TTFP_H" braces = "SameLine" tab_width = 4 documentation_style = "doxy" [defines] "feature = logging" = "ENABLE_LOGGING" [fn...
I can't can't tell whether this is the same thing or not because I can't read it, but I got: https://gist.githubusercontent.com/rainhead/cdc303c498a0d7389671942f6028a215/raw/1266d49996d41dd557987611272a3b97462906f3/cbindgen.txt It works for me with `0.13.0`... What am I missing? Looks like it works on master now. Th...
2020-03-21T14:08:30Z
0.13
2020-03-21T16:23:07Z
6fd245096dcd5c50c1065b4bd6ce62a09df0b39b
[ "test_associated_constant_panic" ]
[ "bindgen::mangle::generics", "test_include_guard", "test_no_includes", "test_custom_header", "test_cfg_2", "test_constant_constexpr", "test_body", "test_char", "test_cdecl", "test_cfg_field", "test_inner_mod", "test_extern_2", "test_prefixed_struct_literal", "test_annotation", "test_expo...
[ "test_expand_no_default_features", "test_expand_features", "test_expand_default_features", "test_expand_dep_v2", "test_expand_dep", "test_expand" ]
[]
auto_2025-06-12
mozilla/cbindgen
489
mozilla__cbindgen-489
[ "488" ]
6654f99251769e9e037824d471f9f39e8d536b90
diff --git a/src/bindgen/ir/ty.rs b/src/bindgen/ir/ty.rs --- a/src/bindgen/ir/ty.rs +++ b/src/bindgen/ir/ty.rs @@ -392,6 +392,7 @@ impl Type { // FIXME(#223): This is not quite correct. "Option" if generic.is_repr_ptr() => Some(generic), "NonNull" => Some(Type::Ptr(Box::new(generi...
diff --git /dev/null b/tests/expectations/both/cell.c new file mode 100644 --- /dev/null +++ b/tests/expectations/both/cell.c @@ -0,0 +1,14 @@ +#include <stdarg.h> +#include <stdbool.h> +#include <stdint.h> +#include <stdlib.h> + +typedef struct NotReprC_RefCell_i32 NotReprC_RefCell_i32; + +typedef NotReprC_RefCell_i32...
Create opaque type for a generic specialization with `RefCell` etc. I have: ```rust bundle.rs: pub type Memoizer = RefCell<IntlLangMemoizer>; pub type FluentBundle<R> = bundle::FluentBundleBase<R, Memoizer>; ffi.rs: type FluentBundleRc = FluentBundle<Rc<FluentResource>>; #[no_mangle] pub unsafe extern...
Here's a reduced test-case: ```rust pub struct NotReprC<T> { inner: T } pub type Foo = NotReprC<std::cell::RefCell<i32>>; #[no_mangle] pub extern "C" fn root(node: &Foo) {} ``` I think instead we should forward-declare RefCell in this case. Right now cbindgen's output is: ```c++ #include <cstdarg> #inc...
2020-03-09T00:29:19Z
0.13
2020-03-09T00:49:18Z
6fd245096dcd5c50c1065b4bd6ce62a09df0b39b
[ "test_cell" ]
[ "bindgen::mangle::generics", "test_custom_header", "test_no_includes", "test_include_guard", "test_cfg_field", "test_cdecl", "test_nested_import", "test_asserted_cast", "test_bitflags", "test_annotation", "test_const_conflict", "test_display_list", "test_constant", "test_static", "test_g...
[ "test_expand_features", "test_expand_dep_v2", "test_expand_default_features", "test_expand_no_default_features", "test_expand", "test_expand_dep" ]
[]
auto_2025-06-12
mozilla/cbindgen
563
mozilla__cbindgen-563
[ "527" ]
6b4181540c146fff75efd500bfb75a2d60403b4c
diff --git a/src/bindgen/ir/generic_path.rs b/src/bindgen/ir/generic_path.rs --- a/src/bindgen/ir/generic_path.rs +++ b/src/bindgen/ir/generic_path.rs @@ -27,18 +27,13 @@ impl GenericParams { .collect(), ) } -} - -impl Deref for GenericParams { - type Target = [Path]; - - fn deref(&...
diff --git /dev/null b/tests/expectations/both/opaque.c new file mode 100644 --- /dev/null +++ b/tests/expectations/both/opaque.c @@ -0,0 +1,28 @@ +#ifdef __cplusplus +// These could be added as opaque types I guess. +template <typename T> +struct BuildHasherDefault; + +struct DefaultHasher; +#endif + + +#include <stda...
panic: Result has 2 params but is being instantiated with 1 values cbdingen version: `v0.14.2` To reproduce the error, run `cbindgen --lang c --output test.h test.rs`, with the source of `test.rs` being: ```rust use std::fmt; // Result<(), T> seems to trip up cbindgen, here T=fmt::Error // as it was how I ran ...
Heh, was just about to post a near-identical snippet to 206. CC'ing myself, mostly, but note that it doesn't have to be Result, explicitly. The following also breaks (but *not* without the `()` type parameter): ``` #[repr(C)] pub struct CResultTempl<O, E> { pub result_good: bool, pub result: *const O, pub er...
2020-08-14T20:16:40Z
0.14
2020-08-15T11:41:05Z
6b4181540c146fff75efd500bfb75a2d60403b4c
[ "test_opaque" ]
[ "bindgen::mangle::generics", "test_include_guard", "test_no_includes", "test_custom_header", "test_assoc_const_conflict", "test_alias", "test_docstyle_auto", "test_export_name", "test_associated_in_body", "test_nested_import", "test_cell", "test_extern_2", "test_monomorph_2", "test_ignore"...
[]
[]
auto_2025-06-12
mozilla/cbindgen
556
mozilla__cbindgen-556
[ "555" ]
6ba31b49f445290a4ac1d3141f2a783306b23a88
diff --git a/src/bindgen/bitflags.rs b/src/bindgen/bitflags.rs --- a/src/bindgen/bitflags.rs +++ b/src/bindgen/bitflags.rs @@ -43,7 +43,7 @@ impl Bitflags { } }; - let consts = flags.expand(name); + let consts = flags.expand(name, repr); let impl_ = parse_quote! { ...
diff --git a/tests/expectations/associated_in_body.c b/tests/expectations/associated_in_body.c --- a/tests/expectations/associated_in_body.c +++ b/tests/expectations/associated_in_body.c @@ -14,22 +14,22 @@ typedef struct { /** * 'auto' */ -#define StyleAlignFlags_AUTO (StyleAlignFlags){ .bits = 0 } +#define Style...
Running cbindgen on a u32 bitflag with a 1<<31 entry produces C++ code that doesn't compile Assuming you have a setup where `cargo +nightly test` passes everything, apply this patch: ``` diff --git a/tests/rust/bitflags.rs b/tests/rust/bitflags.rs index 6c3fe4e..017104a 100644 --- a/tests/rust/bitflags.rs +++ b/...
2020-07-30T14:25:00Z
0.14
2020-07-31T14:22:50Z
6b4181540c146fff75efd500bfb75a2d60403b4c
[ "test_bitflags" ]
[ "bindgen::mangle::generics", "test_no_includes", "test_custom_header", "test_include_guard", "test_monomorph_3", "test_include_item", "test_lifetime_arg", "test_layout_packed_opaque", "test_namespace_constant", "test_export_name", "test_constant_big", "test_display_list", "test_alias", "te...
[ "test_expand_no_default_features", "test_expand_features", "test_expand_dep_v2", "test_expand_default_features", "test_expand", "test_expand_dep" ]
[]
auto_2025-06-12
mozilla/cbindgen
479
mozilla__cbindgen-479
[ "476" ]
dfa6e5f9824aac416d267420f8730225011d5c8f
diff --git a/src/bindgen/ir/global.rs b/src/bindgen/ir/global.rs --- a/src/bindgen/ir/global.rs +++ b/src/bindgen/ir/global.rs @@ -6,6 +6,7 @@ use std::io::Write; use syn; +use crate::bindgen::cdecl; use crate::bindgen::config::Config; use crate::bindgen::declarationtyperesolver::DeclarationTypeResolver; use cr...
diff --git /dev/null b/tests/expectations/both/global_variable.c new file mode 100644 --- /dev/null +++ b/tests/expectations/both/global_variable.c @@ -0,0 +1,8 @@ +#include <stdarg.h> +#include <stdbool.h> +#include <stdint.h> +#include <stdlib.h> + +extern const char CONST_GLOBAL_ARRAY[128]; + +extern char MUT_GLOBAL...
Wrong output for static arrays ```rust #[no_mangle] pub static mut MCRT_ERROR_TEXT: [c_char; 128] = [0; 128]; ``` outputs this ```c extern char[128] MCRT_ERROR_TEXT; ``` when it should be this: ```c extern char MCRT_ERROR_TEXT[128]; ```
2020-02-25T05:38:43Z
0.13
2020-02-26T01:11:02Z
6fd245096dcd5c50c1065b4bd6ce62a09df0b39b
[ "test_global_variable" ]
[ "bindgen::mangle::generics", "test_custom_header", "test_no_includes", "test_include_guard", "test_bitflags", "test_cdecl", "test_display_list", "test_cfg_2", "test_derive_eq", "test_mod_attr", "test_docstyle_doxy", "test_array", "test_assoc_constant", "test_fns", "test_cfg_field", "te...
[ "test_expand", "test_expand_no_default_features", "test_expand_features", "test_expand_dep", "test_expand_dep_v2", "test_expand_default_features" ]
[]
auto_2025-06-12
mozilla/cbindgen
466
mozilla__cbindgen-466
[ "461" ]
4cb762ec8f24f8ef3e12fcd716326a1207a88018
diff --git a/docs.md b/docs.md --- a/docs.md +++ b/docs.md @@ -589,6 +589,13 @@ swift_name_macro = "CF_SWIFT_NAME" # default: "None" rename_args = "PascalCase" +# This rule specifies if the order of functions will be sorted in some way. +# +# "Name": sort by the name of the function +# "None": keep order in which t...
diff --git /dev/null b/tests/expectations/both/function_sort_name.c new file mode 100644 --- /dev/null +++ b/tests/expectations/both/function_sort_name.c @@ -0,0 +1,12 @@ +#include <stdarg.h> +#include <stdbool.h> +#include <stdint.h> +#include <stdlib.h> + +void A(void); + +void B(void); + +void C(void); + +void D(voi...
Keep order of exported functions Hi, In my project all `extern "C" pub fn`'s are declared in a single file / module. Is it possible to ensure that the order of the generated exported functions in the header keeps same as in the module? To me it seems that the functions are ordered by the functions name. Am I cor...
That is: https://github.com/eqrion/cbindgen/blob/eb9cce693438d2cc6fe3d74eb5a56aa50094f68f/src/bindgen/library.rs#L58 So there's no way to workaround it at the moment. But it would be reasonable to add a config switch to avoid this. If you want to send a PR for that I'd be happy to review it :)
2020-01-26T12:45:53Z
0.12
2020-01-27T15:27:36Z
4cb762ec8f24f8ef3e12fcd716326a1207a88018
[ "test_function_sort_none" ]
[ "bindgen::mangle::generics", "test_include_guard", "test_custom_header", "test_no_includes", "test_layout_packed_opaque", "test_fns", "test_global_attr", "test_must_use", "test_assoc_const_conflict", "test_annotation", "test_docstyle_c99", "test_nested_import", "test_const_transparent", "t...
[ "test_expand_dep", "test_expand", "test_expand_features", "test_expand_no_default_features", "test_expand_default_features", "test_expand_dep_v2" ]
[]
auto_2025-06-12
mozilla/cbindgen
454
mozilla__cbindgen-454
[ "442" ]
ff8e5d591dc8bf91a7309c54f0deb67899eeea87
diff --git a/src/bindgen/utilities.rs b/src/bindgen/utilities.rs --- a/src/bindgen/utilities.rs +++ b/src/bindgen/utilities.rs @@ -272,8 +272,7 @@ impl SynAttributeHelpers for [syn::Attribute] { })) = attr.parse_meta() { if path.is_ident("doc") { - ...
diff --git /dev/null b/tests/expectations/both/documentation_attr.c new file mode 100644 --- /dev/null +++ b/tests/expectations/both/documentation_attr.c @@ -0,0 +1,20 @@ +#include <stdarg.h> +#include <stdbool.h> +#include <stdint.h> +#include <stdlib.h> + +/** + *With doc attr, each attr contribute to one line of doc...
`doc` attribute doesn't behave like rustc does Inputs --- ```rust #[no_mangle] #[doc = "a \n b"] pub extern "C" fn example_a() {} ``` and ```rust #[no_mangle] #[doc = "a \n\n b"] pub extern "C" fn example_b() {} ``` Rendered rustdoc --- [rustdoc/the doc attribute](https://doc.rust-lang.org/rustdo...
Yeah, it'd be great to get this fixed :) After some researching I got some questions. Should I implement this translation by myself or using other crate? One thing that bother me is that the spec of markdown line break is a bit vague. The algorithm isn't obvious to me. It might works for most cases but I'm afraid th...
2020-01-14T11:20:17Z
0.12
2020-02-19T05:11:39Z
4cb762ec8f24f8ef3e12fcd716326a1207a88018
[ "test_documentation_attr" ]
[ "bindgen::mangle::generics", "test_no_includes", "test_include_guard", "test_custom_header", "test_assoc_constant", "test_array", "test_bitflags", "test_export_name", "test_asserted_cast", "test_euclid", "test_extern", "test_char", "test_annotation", "test_reserved", "test_monomorph_1", ...
[ "test_expand", "test_expand_no_default_features", "test_expand_dep", "test_expand_default_features", "test_expand_features", "test_expand_dep_v2" ]
[]
auto_2025-06-12
mozilla/cbindgen
452
mozilla__cbindgen-452
[ "448" ]
ac1a7d47e87658cf36cb7e56edad7fa5f935dddd
diff --git a/docs.md b/docs.md --- a/docs.md +++ b/docs.md @@ -488,7 +488,16 @@ renaming_overrides_prefixing = true "MyType" = "my_cool_type" "my_function" = "BetterFunctionName" -# Table of things to add to the body of any struct, union, or enum that has the +# Table of things to prepend to the body of any struct,...
diff --git a/tests/expectations/body.c b/tests/expectations/body.c --- a/tests/expectations/body.c +++ b/tests/expectations/body.c @@ -9,6 +9,12 @@ typedef enum { Baz1, } MyCLikeEnum; +typedef enum { + Foo1_Prepended, + Bar1_Prepended, + Baz1_Prepended, +} MyCLikeEnum_Prepended; + typedef struct { int32_t ...
Mark non-pub fields as private in c++ headers If I have the following Rust struct: ```rust #[repr(C)] pub struct MyStruct { value1: i32, pub value2: i32 } ``` It would be very useful for the generated struct to reflect the field's visibility: ```c++ struct MyStruct { private: int32_t value1;...
This would need to be opt-in as having private fields breaks the [standard layout](https://en.cppreference.com/w/cpp/named_req/StandardLayoutType) contract in C++. But more to the point, if you want a type to be opaque, then you can just not mark it `#[repr(C)]`, and cbindgen should do the right thing and forward-de...
2020-01-12T00:31:38Z
0.12
2020-01-13T13:26:22Z
4cb762ec8f24f8ef3e12fcd716326a1207a88018
[ "test_body" ]
[ "bindgen::mangle::generics", "test_include_guard", "test_custom_header", "test_no_includes", "test_lifetime_arg", "test_cfg_field", "test_assoc_constant", "test_docstyle_auto", "test_char", "test_static", "test_const_transparent", "test_docstyle_c99", "test_inner_mod", "test_nested_import"...
[ "test_expand", "test_expand_default_features", "test_expand_no_default_features", "test_expand_dep", "test_expand_features", "test_expand_dep_v2" ]
[]
auto_2025-06-12
mozilla/cbindgen
447
mozilla__cbindgen-447
[ "283" ]
f5d76c44c466b47d1c776acd9974df838f30d431
diff --git a/src/bindgen/parser.rs b/src/bindgen/parser.rs --- a/src/bindgen/parser.rs +++ b/src/bindgen/parser.rs @@ -17,7 +17,7 @@ use crate::bindgen::ir::{ AnnotationSet, Cfg, Constant, Documentation, Enum, Function, GenericParams, ItemMap, OpaqueItem, Path, Static, Struct, Type, Typedef, Union, }; -use c...
diff --git a/src/bindgen/utilities.rs b/src/bindgen/utilities.rs --- a/src/bindgen/utilities.rs +++ b/src/bindgen/utilities.rs @@ -39,6 +39,24 @@ pub fn find_first_some<T>(slice: &[Option<T>]) -> Option<&T> { None } +pub trait SynItemFnHelpers: SynItemHelpers { + fn exported_name(&self) -> Option<String>; +}...
Should respect #[export_name] Rust supports `#[export_name = "..."]` as an alternative to `#[no_mangle]` that allows to customise exported name of various items.
Any progress on this? 🙏 This shouldn't be hard to fix, on functions at least. `src/bindgen/parser.rs` should be tweaked to look at this attribute on top of `no_mangle` (grep for `is_no_mangle`), and tweak the `Path` to be the value of the attribute rather than the function name if it's present. I can take a look at t...
2020-01-07T04:32:53Z
0.12
2020-01-08T14:28:21Z
4cb762ec8f24f8ef3e12fcd716326a1207a88018
[ "bindgen::mangle::generics", "test_include_guard", "test_no_includes", "test_cfg_2", "test_monomorph_2", "test_include_specific", "test_docstyle_doxy", "test_reserved", "test_fns", "test_assoc_constant", "test_namespace_constant", "test_typedef", "test_struct_literal", "test_docstyle_c99",...
[]
[]
[]
auto_2025-06-12
tokio-rs/bytes
100
tokio-rs__bytes-100
[ "97" ]
627864187c531af38c21aa44315a1b3204f9a175
diff --git a/src/bytes.rs b/src/bytes.rs --- a/src/bytes.rs +++ b/src/bytes.rs @@ -1890,8 +1890,8 @@ impl Inner { #[inline] fn is_shared(&mut self) -> bool { match self.kind() { - KIND_INLINE | KIND_ARC => true, - _ => false, + KIND_VEC => false, + _ => tru...
diff --git a/tests/test_bytes.rs b/tests/test_bytes.rs --- a/tests/test_bytes.rs +++ b/tests/test_bytes.rs @@ -363,6 +363,15 @@ fn extend() { assert_eq!(*bytes, LONG[..]); } +#[test] +fn from_static() { + let mut a = Bytes::from_static(b"ab"); + let b = a.split_off(1); + + assert_eq!(a, b"a"[..]); + ...
Debug assertion fails when splitting a Bytes created with from_static ```rust extern crate bytes; use bytes::Bytes; fn main() { let mut a = Bytes::from_static(b"ab"); let b = a.split_off(1); println!("{:?}, {:?}", a, b); } ``` In a debug build, this code results in the following: ```text ...
2017-03-29T16:32:14Z
0.4
2017-04-05T19:13:00Z
e0e30f00a1248b1de59405da66cd871ccace4f9f
[ "from_static" ]
[ "test_fresh_cursor_vec", "test_bufs_vec", "test_get_u8", "test_get_u16", "test_get_u16_buffer_underflow", "test_clone", "test_put_u16", "test_vec_as_mut_buf", "test_put_u8", "test_bufs_vec_mut", "inline_storage", "reserve_allocates_at_least_original_capacity", "fmt", "len", "split_off", ...
[]
[]
auto_2025-06-10
tokio-rs/bytes
316
tokio-rs__bytes-316
[ "170" ]
59aea9e8719d8acff18b586f859011d3c52cfcde
diff --git a/src/buf/buf_mut.rs b/src/buf/buf_mut.rs --- a/src/buf/buf_mut.rs +++ b/src/buf/buf_mut.rs @@ -270,7 +270,7 @@ pub trait BufMut { fn put_slice(&mut self, src: &[u8]) { let mut off = 0; - assert!(self.remaining_mut() >= src.len(), "buffer overflow"); + assert!(self.remaining_mut...
diff --git a/tests/test_buf_mut.rs b/tests/test_buf_mut.rs --- a/tests/test_buf_mut.rs +++ b/tests/test_buf_mut.rs @@ -74,7 +74,7 @@ fn test_bufs_vec_mut() { // with no capacity let mut buf = BytesMut::new(); assert_eq!(buf.capacity(), 0); - assert_eq!(0, buf.bytes_vectored_mut(&mut dst[..])); + as...
BytesMut should implicitly grow the internal storage in its `BufMut` implementation. This will bring the implementation in line with that of `Vec`. This is a breaking change. Relates to #131, #77.
Can you explain why this is a breaking change? Are users relying on the fact that the buffer does _not_ grow implicitly? Yes, users (well, I am at the very least) are relying on the fact that the buffer does not grow implicitly. I'm very much in favor of this; or in providing another type (`BytesExt`) or a newtype wra...
2019-11-20T08:38:10Z
0.5
2019-11-27T20:06:21Z
90e7e650c99b6d231017d9b831a01e95b8c06756
[ "test_bufs_vec", "test_fresh_cursor_vec", "test_get_u16", "test_get_u16_buffer_underflow", "test_get_u8", "test_vec_deque", "test_vec_advance_mut", "test_clone", "test_put_u8", "test_mut_slice", "test_vec_as_mut_buf", "test_put_u16", "test_bufs_vec_mut", "from_slice", "from_iter_no_size_...
[]
[]
[]
auto_2025-06-10
tokio-rs/bytes
286
tokio-rs__bytes-286
[ "139" ]
b6cb346adfaae89bce44bfa337652e6d218d38c4
diff --git a/src/bytes.rs b/src/bytes.rs --- a/src/bytes.rs +++ b/src/bytes.rs @@ -499,6 +499,11 @@ impl Bytes { self.inner.is_inline() } + ///Creates `Bytes` instance from slice, by copying it. + pub fn copy_from_slice(data: &[u8]) -> Self { + BytesMut::from(data).freeze() + } + //...
diff --git a/tests/test_bytes.rs b/tests/test_bytes.rs --- a/tests/test_bytes.rs +++ b/tests/test_bytes.rs @@ -528,7 +528,7 @@ fn stress() { for i in 0..ITERS { let data = [i as u8; 256]; - let buf = Arc::new(Bytes::from(&data[..])); + let buf = Arc::new(Bytes::copy_from_slice(&data[..]));...
Change From<&'a [u8]> to an explicit function Most of the `From` conversions to `Bytes` are shallow copies, just grabbing a pointer and pulling it in. There is also the `from_static` function to save copying a static set of bytes. However, the `From<&'a [u8]>` impl will copy the slice into a new buffer (either inline o...
Oh, this would be a breaking change, so would require (block?) 0.5. Just to clarify, `From<&'a [u8]> for BytesMut` can stay because static slices are not mutable, so a copy has to happen from the `'static` slice when creating BytesMut. So only Bytes would have its `From<&'a [u8]>` removed. Mentioned by @arthur...
2019-08-16T07:01:13Z
0.5
2019-08-27T20:17:31Z
90e7e650c99b6d231017d9b831a01e95b8c06756
[ "buf::vec_deque::tests::hello_world", "bytes::test_original_capacity_from_repr", "bytes::test_original_capacity_to_repr", "test_bufs_vec", "test_fresh_cursor_vec", "test_get_u16", "test_get_u8", "test_get_u16_buffer_underflow", "test_bufs_vec_mut", "test_clone", "test_mut_slice", "test_put_u16...
[]
[]
[]
auto_2025-06-10
tokio-rs/bytes
376
tokio-rs__bytes-376
[ "352", "352" ]
fe6e67386451715c5d609c90a41e98ef80f0e1d1
diff --git a/src/bytes_mut.rs b/src/bytes_mut.rs --- a/src/bytes_mut.rs +++ b/src/bytes_mut.rs @@ -233,7 +233,9 @@ impl BytesMut { let (off, _) = self.get_vec_pos(); let vec = rebuild_vec(self.ptr.as_ptr(), self.len, self.cap, off); mem::forget(self); - ...
diff --git a/tests/test_bytes.rs b/tests/test_bytes.rs --- a/tests/test_bytes.rs +++ b/tests/test_bytes.rs @@ -342,6 +342,72 @@ fn freeze_clone_unique() { assert_eq!(c, s); } +#[test] +fn freeze_after_advance() { + let s = &b"abcdefgh"[..]; + let mut b = BytesMut::from(s); + b.advance(1); + assert_e...
BytesMut::freeze ignores advance Hi, I created a `BytesBuf` with some data and removed the leading n bytes with `advance(n)`. After some more computations I converted the result to an immutable `Bytes` value. My expectation was that the content of the `BytesMut` and `Bytes` would be identical. Instead the `Bytes` stil...
Oh yea, that seems like a bug in `freeze`. Looking at the source, it seems to grab the original size so it can properly create a `Bytes`, but forgets to advance it forward if need be. Oh yea, that seems like a bug in `freeze`. Looking at the source, it seems to grab the original size so it can properly create a `Bytes`...
2020-03-13T17:41:22Z
0.5
2020-03-24T18:14:17Z
90e7e650c99b6d231017d9b831a01e95b8c06756
[ "freeze_after_advance" ]
[ "test_get_u16_buffer_underflow", "test_deref_buf_forwards", "test_bufs_vec", "test_get_u16", "test_fresh_cursor_vec", "test_get_u8", "test_vec_deque", "test_put_u16", "test_mut_slice", "test_put_u8", "test_deref_bufmut_forwards", "test_bufs_vec_mut", "test_clone", "test_vec_advance_mut", ...
[]
[]
auto_2025-06-10
tokio-rs/bytes
361
tokio-rs__bytes-361
[ "360" ]
729bc7c2084a42fda2c62da6933951fa7ac875aa
diff --git a/src/bytes.rs b/src/bytes.rs --- a/src/bytes.rs +++ b/src/bytes.rs @@ -418,7 +418,15 @@ impl Bytes { #[inline] pub fn truncate(&mut self, len: usize) { if len < self.len { - self.len = len; + // The Vec "promotable" vtables do not store the capacity, + // ...
diff --git a/tests/test_bytes_odd_alloc.rs b/tests/test_bytes_odd_alloc.rs --- a/tests/test_bytes_odd_alloc.rs +++ b/tests/test_bytes_odd_alloc.rs @@ -41,7 +41,7 @@ unsafe impl GlobalAlloc for Odd { }; System.dealloc(ptr.offset(-1), new_layout); } else { - System.alloc(layo...
Bytes may recreate Vec incorrectly on drop This example: ``` diff --git a/examples/rrr.rs b/examples/rrr.rs index e69de29..60374de 100644 --- a/examples/rrr.rs +++ b/examples/rrr.rs @@ -0,0 +1,7 @@ +use bytes::Bytes; + +fn main() { + let mut bytes = Bytes::from(vec![10, 20, 30]); + bytes.truncate(2);...
Can verify that the layout is indeed incorrect, we need to use the capacity of the vector (rather than the truncated length). I put together a small [toy allocator](https://github.com/udoprog/checkers) to test this. (this is the test I wrote) ```rust use bytes::Bytes; #[global_allocator] static ALLOCATOR: chec...
2020-01-20T20:05:19Z
0.5
2020-01-23T00:37:55Z
90e7e650c99b6d231017d9b831a01e95b8c06756
[ "test_bytes_truncate", "test_bytes_truncate_and_advance" ]
[ "test_bufs_vec", "test_deref_buf_forwards", "test_fresh_cursor_vec", "test_get_u16", "test_get_u8", "test_get_u16_buffer_underflow", "test_vec_deque", "test_bufs_vec_mut", "test_clone", "test_deref_bufmut_forwards", "test_mut_slice", "test_put_u16", "test_put_u8", "test_vec_advance_mut", ...
[]
[]
auto_2025-06-10
tokio-rs/bytes
346
tokio-rs__bytes-346
[ "343" ]
8ae3bb2104fda9a02d55ac5635974ca1b5a49ebb
diff --git a/src/bytes.rs b/src/bytes.rs --- a/src/bytes.rs +++ b/src/bytes.rs @@ -731,20 +731,23 @@ impl From<Vec<u8>> for Bytes { let slice = vec.into_boxed_slice(); let len = slice.len(); let ptr = slice.as_ptr(); - - assert!( - ptr as usize & KIND_VEC == 0, - ...
diff --git /dev/null b/tests/test_bytes_odd_alloc.rs new file mode 100644 --- /dev/null +++ b/tests/test_bytes_odd_alloc.rs @@ -0,0 +1,67 @@ +//! Test using `Bytes` with an allocator that hands out "odd" pointers for +//! vectors (pointers where the LSB is set). + +use std::alloc::{GlobalAlloc, Layout, System}; +use st...
Bytes assumes that Vec<u8>'s allocation is more than 1 byte aligned It uses the low bit of the pointer to distinguish between KIND_VEC and KIND_ARC. Folded over from #340
As mentioned in https://github.com/tokio-rs/bytes/pull/342#issuecomment-565135102, we'll start by adding an assertion that the LSB isn't set, and perhaps fix if/when some allocator actually starts handing out odd pointers.
2019-12-13T20:55:56Z
0.5
2019-12-17T21:23:17Z
90e7e650c99b6d231017d9b831a01e95b8c06756
[ "test_bytes_clone_drop", "test_bytes_from_vec_drop" ]
[ "test_deref_buf_forwards", "test_get_u16", "test_fresh_cursor_vec", "test_bufs_vec", "test_vec_deque", "test_get_u8", "test_get_u16_buffer_underflow", "test_put_u8", "test_vec_advance_mut", "test_deref_bufmut_forwards", "test_clone", "test_put_u16", "test_bufs_vec_mut", "test_mut_slice", ...
[]
[]
auto_2025-06-10
tokio-rs/bytes
265
tokio-rs__bytes-265
[ "167" ]
ed7c7b5c5845a4084eb65a364ddf259b1e17ca59
diff --git a/.travis.yml b/.travis.yml --- a/.travis.yml +++ b/.travis.yml @@ -19,7 +19,7 @@ matrix: # # This job will also build and deploy the docs to gh-pages. - env: TARGET=x86_64-unknown-linux-gnu - rust: 1.27.0 + rust: 1.28.0 after_success: - | pip install 'tr...
diff --git a/tests/test_bytes.rs b/tests/test_bytes.rs --- a/tests/test_bytes.rs +++ b/tests/test_bytes.rs @@ -98,22 +98,22 @@ fn index() { fn slice() { let a = Bytes::from(&b"hello world"[..]); - let b = a.slice(3, 5); + let b = a.slice(3..5); assert_eq!(b, b"lo"[..]); - let b = a.slice(0, 0); ...
Add RangeArgument trait and use it for slice A trait that mirrors [std::RangeArgument](https://doc.rust-lang.org/nightly/std/collections/range/trait.RangeArgument.html) can be introduced to avoid having to have `split_to`, `split_from`, `split` functions.
2019-06-07T23:32:54Z
0.5
2019-06-10T16:39:32Z
90e7e650c99b6d231017d9b831a01e95b8c06756
[ "bytes::test_original_capacity_to_repr", "buf::vec_deque::tests::hello_world", "bytes::test_original_capacity_from_repr", "test_get_u16", "test_fresh_cursor_vec", "test_get_u8", "test_bufs_vec", "test_get_u16_buffer_underflow", "test_mut_slice", "test_put_u16", "test_vec_advance_mut", "test_cl...
[]
[]
[]
auto_2025-06-10
tokio-rs/bytes
263
tokio-rs__bytes-263
[ "224" ]
ac4e8f2fc5de66eff982aac77f742de3d3930454
diff --git a/.travis.yml b/.travis.yml --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,8 @@ dist: trusty language: rust services: docker sudo: required -rust: stable +#rust: stable +rust: beta # we need 1.36, which is still beta env: global: diff --git a/.travis.yml b/.travis.yml --- a/.travis.yml +++ b/.travis...
diff --git a/tests/test_buf.rs b/tests/test_buf.rs --- a/tests/test_buf.rs +++ b/tests/test_buf.rs @@ -1,9 +1,8 @@ extern crate bytes; extern crate byteorder; -extern crate iovec; use bytes::Buf; -use iovec::IoVec; +use std::io::IoSlice; #[test] fn test_fresh_cursor_vec() { diff --git a/tests/test_buf.rs b/tes...
Replace iovec with std::io::IoSlice This would allow avoiding the additional dependencies.
This would be in conflict with #63 [IoVec was stabilised as IoSlice in 1.36](https://doc.rust-lang.org/nightly/std/io/struct.IoSlice.html), so we can probably drop the `iovec` dependency and use the std types. Yep, the plan with 0.5 is to switch to std's IoSlice.
2019-06-07T20:11:41Z
0.5
2019-06-11T18:58:47Z
90e7e650c99b6d231017d9b831a01e95b8c06756
[ "buf::vec_deque::tests::hello_world", "bytes::test_original_capacity_from_repr", "bytes::test_original_capacity_to_repr", "test_bufs_vec", "test_fresh_cursor_vec", "test_get_u16", "test_get_u8", "test_get_u16_buffer_underflow", "test_bufs_vec_mut", "test_clone", "test_put_u16", "test_mut_slice...
[]
[]
[]
auto_2025-06-10
tokio-rs/bytes
732
tokio-rs__bytes-732
[ "730" ]
291df5acc94b82a48765e67eeb1c1a2074539e68
diff --git a/src/buf/buf_impl.rs b/src/buf/buf_impl.rs --- a/src/buf/buf_impl.rs +++ b/src/buf/buf_impl.rs @@ -66,6 +66,12 @@ macro_rules! buf_get_impl { }}; } +// https://en.wikipedia.org/wiki/Sign_extension +fn sign_extend(val: u64, nbytes: usize) -> i64 { + let shift = (8 - nbytes) * 8; + (val << shift...
diff --git a/tests/test_buf.rs b/tests/test_buf.rs --- a/tests/test_buf.rs +++ b/tests/test_buf.rs @@ -36,6 +36,19 @@ fn test_get_u16() { assert_eq!(0x5421, buf.get_u16_le()); } +#[test] +fn test_get_int() { + let mut buf = &b"\xd6zomg"[..]; + assert_eq!(-42, buf.get_int(1)); + let mut buf = &b"\xd6zom...
`Buf::get_int()` implementation for `Bytes` returns positive number instead of negative when `nbytes` < 8. **Steps to reproduce:** Run the following program, using `bytes` version 1.7.1 ``` use bytes::{BytesMut, Buf, BufMut}; fn main() { const SOME_NEG_NUMBER: i64 = -42; let mut buffer = BytesMut::wit...
It looks like this has been caused by 234d814122d6445bdfb15f635290bfc4dd36c2eb / #280, as demonstrated by the revert: <details> <summary>See the revert</summary> ```patch From 4a9b9a4ea0538dff7d9ae57070c98f6ad4afd708 Mon Sep 17 00:00:00 2001 From: Paolo Barbolini <paolo.barbolini@m4ss.net> Date: Mon, 19 Aug 2...
2024-08-19T13:14:07Z
1.7
2024-08-30T12:20:30Z
291df5acc94b82a48765e67eeb1c1a2074539e68
[ "test_get_int" ]
[ "bytes_mut::tests::test_original_capacity_to_repr", "bytes_mut::tests::test_original_capacity_from_repr", "copy_to_bytes_overflow - should panic", "test_deref_buf_forwards", "test_fresh_cursor_vec", "test_bufs_vec", "test_get_u8", "test_get_u16_buffer_underflow - should panic", "test_get_u16", "co...
[]
[]
auto_2025-06-10
tokio-rs/bytes
710
tokio-rs__bytes-710
[ "709" ]
caf520ac7f2c466d26bd88eca33ddc53c408e17e
diff --git a/src/bytes.rs b/src/bytes.rs --- a/src/bytes.rs +++ b/src/bytes.rs @@ -525,32 +525,12 @@ impl Bytes { /// ``` pub fn try_into_mut(self) -> Result<BytesMut, Bytes> { if self.is_unique() { - Ok(self.make_mut()) + Ok(self.into()) } else { Err(self)...
diff --git a/tests/test_bytes.rs b/tests/test_bytes.rs --- a/tests/test_bytes.rs +++ b/tests/test_bytes.rs @@ -1174,29 +1174,29 @@ fn shared_is_unique() { } #[test] -fn test_bytes_make_mut_static() { +fn test_bytesmut_from_bytes_static() { let bs = b"1b23exfcz3r"; // Test STATIC_VTABLE.to_mut - let b...
Consider replacing Bytes::make_mut by impl From<Bytes> for BytesMut `Bytes::make_mut` is a very good addition to the API but I think it would be better if it was instead exposed as `<BytesMut as From<Bytes>>::from`. Could this be done before the next bytes version is released? `Bytes::make_mut` isn't released yet.
The reason for the current API is to support adding a fallible `Bytes::try_mut` method in the future (as I proposed in #611). See also #368 None of this mentions `From<_>` though. For some HTTP stuff I need to mutate bytes yielded by Hyper and I can do that in-place, but Hyper yields `Bytes` so I want to be able to do ...
2024-05-26T10:32:14Z
1.6
2024-07-09T12:12:07Z
9965a04b5684079bb614addd750340ffc165a9f5
[ "bytes_mut::tests::test_original_capacity_from_repr", "bytes_mut::tests::test_original_capacity_to_repr", "test_bufs_vec", "copy_to_bytes_less", "test_fresh_cursor_vec", "test_deref_buf_forwards", "copy_to_bytes_overflow - should panic", "test_get_u16", "test_get_u16_buffer_underflow - should panic"...
[]
[]
[]
auto_2025-06-10
tokio-rs/bytes
686
tokio-rs__bytes-686
[ "680" ]
7a5154ba8b54970b7bb07c4902bc8a7981f4e57c
diff --git a/src/bytes_mut.rs b/src/bytes_mut.rs --- a/src/bytes_mut.rs +++ b/src/bytes_mut.rs @@ -589,12 +589,13 @@ impl BytesMut { return; } - self.reserve_inner(additional); + // will always succeed + let _ = self.reserve_inner(additional, true); } - // In separ...
diff --git a/tests/test_bytes.rs b/tests/test_bytes.rs --- a/tests/test_bytes.rs +++ b/tests/test_bytes.rs @@ -1283,3 +1283,73 @@ fn test_bytes_make_mut_promotable_even_arc_offset() { assert_eq!(b2m, vec[20..]); assert_eq!(b1m, vec[..20]); } + +#[test] +fn try_reclaim_empty() { + let mut buf = BytesMut::n...
Contradictory allocation behaviour compared to documentation I hope I'm not just hopelessly confused, but I fail to see what kind of guarantees are made around allocations and using the APIs. For example, https://docs.rs/bytes/latest/bytes/buf/trait.BufMut.html#method.put_slice says that `self must have enough remainin...
The documentation on this could probably be improved, but the capacity that the `BufMut` trait talks about is for cases where the buffer cannot be resized at all. Types such as `Vec<u8>` pretend that they have infinite capacity in the `BufMut` trait. I agree that the wording here is confusing, but I think it is the ...
2024-03-31T08:27:02Z
1.6
2024-06-28T19:54:54Z
9965a04b5684079bb614addd750340ffc165a9f5
[ "bytes_mut::tests::test_original_capacity_from_repr", "bytes_mut::tests::test_original_capacity_to_repr", "copy_to_bytes_less", "test_bufs_vec", "copy_to_bytes_overflow - should panic", "test_deref_buf_forwards", "test_fresh_cursor_vec", "test_get_u16", "test_get_u16_buffer_underflow - should panic"...
[]
[]
[]
auto_2025-06-10
tokio-rs/bytes
450
tokio-rs__bytes-450
[ "447" ]
54f5ced6c58c47f721836a9444654de4c8d687a1
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,6 +11,7 @@ on: env: RUSTFLAGS: -Dwarnings RUST_BACKTRACE: 1 + nightly: nightly-2020-12-17 defaults: run: diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml --...
diff --git a/tests/test_buf.rs b/tests/test_buf.rs --- a/tests/test_buf.rs +++ b/tests/test_buf.rs @@ -9,17 +9,17 @@ fn test_fresh_cursor_vec() { let mut buf = &b"hello"[..]; assert_eq!(buf.remaining(), 5); - assert_eq!(buf.bytes(), b"hello"); + assert_eq!(buf.chunk(), b"hello"); buf.advance(2)...
Consider renaming `Buf::bytes()` and `BufMut::bytes_mut()` These two functions are named in a way that implies they return the *entire* set of bytes represented by the `Buf`/`BufMut`. Some options: * `window()` / `window_mut()` * `chunk()` / `chunk_mut()`. * `fragment()` / `fragment_mut()`
@tokio-rs/maintainers Anyone have thoughts? If there isn't any support for a change here, I am inclined to just let it be. I agree that the current name could be misleading, and my knee-jerk reaction to `window` is positive--it's at least ambiguous enough to prompt careful examination. I support changing it to `chunk`....
2020-12-18T05:15:21Z
1.0
2020-12-18T19:04:33Z
54f5ced6c58c47f721836a9444654de4c8d687a1
[ "copy_to_bytes_less", "test_bufs_vec", "test_deref_buf_forwards", "test_get_u16", "test_get_u8", "test_get_u16_buffer_underflow", "copy_to_bytes_overflow", "test_vec_deque", "test_fresh_cursor_vec", "test_mut_slice", "write_byte_panics_if_out_of_bounds", "test_put_u16", "copy_from_slice_pani...
[]
[]
[]
auto_2025-06-10
tokio-rs/bytes
432
tokio-rs__bytes-432
[ "329" ]
94c543f74b111e894d16faa43e4ad361b97ee87d
diff --git a/src/buf/buf_mut.rs b/src/buf/buf_mut.rs --- a/src/buf/buf_mut.rs +++ b/src/buf/buf_mut.rs @@ -30,7 +30,7 @@ use alloc::{boxed::Box, vec::Vec}; /// /// assert_eq!(buf, b"hello world"); /// ``` -pub trait BufMut { +pub unsafe trait BufMut { /// Returns the number of bytes that can be written from the...
diff --git a/tests/test_buf_mut.rs b/tests/test_buf_mut.rs --- a/tests/test_buf_mut.rs +++ b/tests/test_buf_mut.rs @@ -75,7 +75,7 @@ fn test_mut_slice() { fn test_deref_bufmut_forwards() { struct Special; - impl BufMut for Special { + unsafe impl BufMut for Special { fn remaining_mut(&self) -> us...
Maybe `BufMut` trait should be `unsafe`? I was thinking that it's likely that some `unsafe` code will rely on properties of `BufMut`. More specifically: * That `remaining_mut` returns correct value * `bytes_mut` always returns the same slice (apart from `advance()`) * `has_remaining_mut` returns correct value * `...
What does making the trait unsafe gain over making individual fns unsafe? `unsafe trait` basically declares "this trait is `unsafe` to *implement*", thus other `unsafe` code might rely on it working properly. `unsafe fn` means "this function is unsafe to call" They are different things and I believe making `BufMut` ...
2020-10-16T22:38:56Z
0.6
2020-10-16T22:45:41Z
94c543f74b111e894d16faa43e4ad361b97ee87d
[ "test_bufs_vec", "test_deref_buf_forwards", "test_fresh_cursor_vec", "test_get_u8", "test_get_u16", "test_get_u16_buffer_underflow", "test_vec_deque", "test_clone", "test_deref_bufmut_forwards", "test_mut_slice", "test_put_u16", "test_put_u8", "test_vec_as_mut_buf", "test_vec_advance_mut",...
[]
[]
[]
auto_2025-06-10
tokio-rs/bytes
413
tokio-rs__bytes-413
[ "412" ]
90e7e650c99b6d231017d9b831a01e95b8c06756
diff --git a/src/bytes_mut.rs b/src/bytes_mut.rs --- a/src/bytes_mut.rs +++ b/src/bytes_mut.rs @@ -559,9 +559,8 @@ impl BytesMut { unsafe { let (off, prev) = self.get_vec_pos(); - // Only reuse space if we stand to gain at least capacity/2 - // bytes of spac...
diff --git a/tests/test_bytes.rs b/tests/test_bytes.rs --- a/tests/test_bytes.rs +++ b/tests/test_bytes.rs @@ -929,6 +929,22 @@ fn bytes_buf_mut_advance() { } } +#[test] +fn bytes_buf_mut_reuse_when_fully_consumed() { + use bytes::{Buf, BytesMut}; + let mut buf = BytesMut::new(); + buf.reserve(8192); +...
BytesMut fails to reuse buffer in trivial case where all data has been consumed The following test fails with bytes 0.5.5: ```rust #[test] fn bytes_mut_reuse() { use bytes::{BytesMut, Buf}; let mut buf = BytesMut::new(); buf.reserve(8192); buf.extend_from_slice(&[0u8;100...
Yea, this does seem wrong. In this test, `off` would be 100, and `additional` is 8192. We shouldn't be checking `100 > 8192`, but rather checking that `cap - (len - off) > additional`, I think. Does that sound right? For the first half of the condition, we want to be checking if there's enough space to satisfy the allo...
2020-07-08T20:41:16Z
0.5
2020-08-27T21:25:46Z
90e7e650c99b6d231017d9b831a01e95b8c06756
[ "bytes_buf_mut_reuse_when_fully_consumed" ]
[ "test_bufs_vec", "test_deref_buf_forwards", "test_fresh_cursor_vec", "test_get_u16", "test_get_u8", "test_get_u16_buffer_underflow", "test_vec_deque", "test_bufs_vec_mut", "test_clone", "test_mut_slice", "test_deref_bufmut_forwards", "test_put_u16", "test_put_u8", "test_vec_as_mut_buf", ...
[]
[]
auto_2025-06-10
tokio-rs/bytes
377
tokio-rs__bytes-377
[ "354", "354" ]
fe6e67386451715c5d609c90a41e98ef80f0e1d1
diff --git a/src/buf/buf_mut.rs b/src/buf/buf_mut.rs --- a/src/buf/buf_mut.rs +++ b/src/buf/buf_mut.rs @@ -990,11 +990,13 @@ impl BufMut for Vec<u8> { unsafe fn advance_mut(&mut self, cnt: usize) { let len = self.len(); let remaining = self.capacity() - len; - if cnt > remaining { - ...
diff --git a/tests/test_buf_mut.rs b/tests/test_buf_mut.rs --- a/tests/test_buf_mut.rs +++ b/tests/test_buf_mut.rs @@ -45,13 +45,12 @@ fn test_put_u16() { } #[test] +#[should_panic(expected = "cannot advance")] fn test_vec_advance_mut() { - // Regression test for carllerche/bytes#108. + // Verify fix for #35...
advance_mut implementation of BufMut for Vec<u8> seems inconsistent with documentation The documentation of `BufMut::advance_mut` states the following about panics: > # Panics > > This function **may** panic if `cnt > self.remaining_mut()`. > > # Implementer notes > > It is recommended for implementations of `...
2020-03-13T21:55:43Z
0.5
2020-03-28T01:30:52Z
90e7e650c99b6d231017d9b831a01e95b8c06756
[ "test_vec_advance_mut" ]
[ "test_bufs_vec", "test_deref_buf_forwards", "test_fresh_cursor_vec", "test_get_u16", "test_get_u8", "test_get_u16_buffer_underflow", "test_vec_deque", "test_bufs_vec_mut", "test_clone", "test_deref_bufmut_forwards", "test_mut_slice", "test_put_u16", "test_put_u8", "test_vec_as_mut_buf", ...
[]
[]
auto_2025-06-10
tokio-rs/bytes
253
tokio-rs__bytes-253
[ "252" ]
e0e30f00a1248b1de59405da66cd871ccace4f9f
diff --git a/src/bytes.rs b/src/bytes.rs --- a/src/bytes.rs +++ b/src/bytes.rs @@ -1265,6 +1265,8 @@ impl BytesMut { /// /// Panics if `at > len`. pub fn split_to(&mut self, at: usize) -> BytesMut { + assert!(at <= self.len()); + BytesMut { inner: self.inner.split_to(at), ...
diff --git a/tests/test_bytes.rs b/tests/test_bytes.rs --- a/tests/test_bytes.rs +++ b/tests/test_bytes.rs @@ -258,15 +258,10 @@ fn split_to_oob_mut() { } #[test] +#[should_panic] fn split_to_uninitialized() { let mut bytes = BytesMut::with_capacity(1024); - let other = bytes.split_to(128); - - assert_e...
BytesMut::split_to doesn't panic as it should The method's documentation says "Panics if `at > len`". But this test fails (the code doesn't panic): ``` #[test] #[should_panic] fn test_split_to() { let mut buf = BytesMut::from(&b"hello world"[..]); let len = buf.len(); let x = buf.split_to(len + 1); ...
ah... it probably should panic.. I'm not sure why the test checks that it doesn't... I would love a PR ❤️
2019-04-02T21:56:17Z
0.4
2019-04-02T23:24:31Z
e0e30f00a1248b1de59405da66cd871ccace4f9f
[ "split_to_uninitialized" ]
[ "buf::vec_deque::tests::hello_world", "bytes::test_original_capacity_from_repr", "bytes::test_original_capacity_to_repr", "test_bufs_vec", "test_fresh_cursor_vec", "test_get_u16", "test_get_u16_buffer_underflow", "test_get_u8", "test_bufs_vec_mut", "test_put_u8", "test_clone", "test_put_u16", ...
[]
[]
auto_2025-06-10
tokio-rs/bytes
197
tokio-rs__bytes-197
[ "193" ]
d656d37180db722114f960609c3e6b934b242aee
diff --git a/src/bytes.rs b/src/bytes.rs --- a/src/bytes.rs +++ b/src/bytes.rs @@ -2250,20 +2250,42 @@ impl Inner { } if kind == KIND_VEC { - // Currently backed by a vector, so just use `Vector::reserve`. + // If there's enough free space before the start of the buffer, then +...
diff --git a/tests/test_bytes.rs b/tests/test_bytes.rs --- a/tests/test_bytes.rs +++ b/tests/test_bytes.rs @@ -378,6 +378,21 @@ fn reserve_max_original_capacity_value() { assert_eq!(bytes.capacity(), 64 * 1024); } +// Without either looking at the internals of the BytesMut or doing weird stuff +// with the memo...
BytesMut memory usage grows without bound I'm working on a high-throughput network service with Tokio, and I'm running into an issue where the memory used by a `BytesMut` grows without bound as more and more messages are processed. After some debugging, I was able to come up with this minimal example: extern cra...
I see what is going on. This is kind of the intended behavior as `advance` though I can see how the docs could be confusing. That said, the case you are illustrating could be optimized by "resetting" the cursors when the read cursor and the write cursor line up. Do you want to take a stab at implementing that?
2018-05-04T02:06:16Z
0.5
2018-05-24T21:50:32Z
90e7e650c99b6d231017d9b831a01e95b8c06756
[ "reserve_vec_recycling" ]
[ "bytes::test_original_capacity_from_repr", "bytes::test_original_capacity_to_repr", "test_bufs_vec", "test_fresh_cursor_vec", "test_get_u16", "test_get_u8", "test_get_u16_buffer_underflow", "test_bufs_vec_mut", "test_clone", "test_put_u16", "test_put_u8", "test_vec_advance_mut", "test_vec_as...
[]
[]
auto_2025-06-10
tokio-rs/bytes
186
tokio-rs__bytes-186
[ "163" ]
86c83959dc0f72c94bcb2b6aa57efc178f6a7fa2
diff --git a/src/buf/buf.rs b/src/buf/buf.rs --- a/src/buf/buf.rs +++ b/src/buf/buf.rs @@ -1,5 +1,5 @@ use super::{IntoBuf, Take, Reader, Iter, FromBuf, Chain}; -use byteorder::ByteOrder; +use byteorder::{BigEndian, ByteOrder, LittleEndian}; use iovec::IoVec; use std::{cmp, io, ptr}; diff --git a/src/buf/buf.rs b/...
diff --git a/tests/test_buf.rs b/tests/test_buf.rs --- a/tests/test_buf.rs +++ b/tests/test_buf.rs @@ -33,15 +33,15 @@ fn test_get_u8() { #[test] fn test_get_u16() { let buf = b"\x21\x54zomg"; - assert_eq!(0x2154, Cursor::new(buf).get_u16::<byteorder::BigEndian>()); - assert_eq!(0x5421, Cursor::new(buf).ge...
Object safety for traits Currently, rust complains: ``` error[E0038]: the trait `bytes::Buf` cannot be made into an object --> src/proto.rs:17:5 | 17 | buf: Option<Box<Buf>>, | ^^^^^^^^^^^^^^^^^^^^^ the trait `bytes::Buf` cannot be made into an object | = note: method `get_u16` has generi...
One option is to add `where` clauses to all these fns, but then they would not be available as part of the trait object. Adding `_be` and `_le` suffixes to the trait is the better option here. Is adding `where` clauses a backward-compatible change? I.e. can we add `where` clauses deprecate the methods and add new on...
2018-03-08T21:19:29Z
0.4
2018-03-12T16:26:00Z
e0e30f00a1248b1de59405da66cd871ccace4f9f
[ "bytes::test_original_capacity_from_repr", "bytes::test_original_capacity_to_repr", "test_bufs_vec", "test_fresh_cursor_vec", "test_get_u16", "test_get_u8", "test_get_u16_buffer_underflow", "test_bufs_vec_mut", "test_put_u16", "test_clone", "test_put_u8", "test_vec_advance_mut", "test_vec_as...
[]
[]
[]
auto_2025-06-10
tokio-rs/bytes
643
tokio-rs__bytes-643
[ "533" ]
09214ba51bdace6f6cb91740cee9514fc08d55ce
diff --git a/src/bytes.rs b/src/bytes.rs --- a/src/bytes.rs +++ b/src/bytes.rs @@ -112,6 +112,8 @@ pub(crate) struct Vtable { /// /// takes `Bytes` to value pub to_vec: unsafe fn(&AtomicPtr<()>, *const u8, usize) -> Vec<u8>, + /// fn(data) + pub is_unique: unsafe fn(&AtomicPtr<()>) -> bool, //...
diff --git a/tests/test_bytes.rs b/tests/test_bytes.rs --- a/tests/test_bytes.rs +++ b/tests/test_bytes.rs @@ -1208,3 +1208,36 @@ fn test_bytes_capacity_len() { } } } + +#[test] +fn static_is_unique() { + let b = Bytes::from_static(LONG); + assert!(!b.is_unique()); +} + +#[test] +fn vec_is_unique()...
Add a way to tell if `Bytes` is unique I would like to be able to tell if a `Bytes` object is the unique reference to the underlying data. The usecase is a cache, where I want to be able to evict an object from the cache only if it is not used elsewhere — otherwise, removing it from the cache would not free up any memo...
Seems reasonable enough to me. @zyxw59 What about instances created using `Bytes::from_static`? I think in that case it is probably correct to always say that it is not unique (since there always *might* be other copies) I think this can be easily implemented by adding another function to `Vtable` of `Bytes`.
2023-12-20T16:59:12Z
1.5
2024-01-19T22:59:31Z
09214ba51bdace6f6cb91740cee9514fc08d55ce
[ "copy_to_bytes_less", "test_deref_buf_forwards", "copy_to_bytes_overflow - should panic", "test_bufs_vec", "test_fresh_cursor_vec", "test_get_u16", "test_get_u16_buffer_underflow - should panic", "test_get_u8", "test_vec_deque", "copy_from_slice_panics_if_different_length_1 - should panic", "cop...
[]
[]
[]
auto_2025-06-10
tokio-rs/bytes
560
tokio-rs__bytes-560
[ "559" ]
38fd42acbaced11ff19f0a4ca2af44a308af5063
diff --git a/src/bytes_mut.rs b/src/bytes_mut.rs --- a/src/bytes_mut.rs +++ b/src/bytes_mut.rs @@ -670,7 +670,10 @@ impl BytesMut { // Compare the condition in the `kind == KIND_VEC` case above // for more details. - if v_capacity >= new_cap && offset >= len { + ...
diff --git a/tests/test_bytes.rs b/tests/test_bytes.rs --- a/tests/test_bytes.rs +++ b/tests/test_bytes.rs @@ -515,6 +515,34 @@ fn reserve_in_arc_unique_doubles() { assert_eq!(2000, bytes.capacity()); } +#[test] +fn reserve_in_arc_unique_does_not_overallocate_after_split() { + let mut bytes = BytesMut::from(...
reserve_inner over allocates which can lead to a OOM conidition # Summary `reseve_inner` will double the size of the underlying shared vector instead of just extending the BytesMut buffer in place if a call to `BytesMut::reserve` would fit inside the current allocated shared buffer. If this happens repeatedly you wi...
2022-07-29T23:42:13Z
1.2
2022-07-30T16:42:55Z
38fd42acbaced11ff19f0a4ca2af44a308af5063
[ "reserve_in_arc_unique_does_not_overallocate_after_multiple_splits", "reserve_in_arc_unique_does_not_overallocate_after_split" ]
[ "copy_to_bytes_less", "test_bufs_vec", "copy_to_bytes_overflow - should panic", "test_deref_buf_forwards", "test_fresh_cursor_vec", "test_get_u16", "test_get_u16_buffer_underflow - should panic", "test_get_u8", "test_vec_deque", "test_deref_bufmut_forwards", "test_clone", "copy_from_slice_pani...
[]
[]
auto_2025-06-10
tokio-rs/bytes
547
tokio-rs__bytes-547
[ "427" ]
068ed41bc02c21fe0a0a4d8e95af8a4668276f5d
diff --git a/src/bytes.rs b/src/bytes.rs --- a/src/bytes.rs +++ b/src/bytes.rs @@ -109,6 +109,10 @@ pub(crate) struct Vtable { /// fn(data, ptr, len) pub clone: unsafe fn(&AtomicPtr<()>, *const u8, usize) -> Bytes, /// fn(data, ptr, len) + /// + /// takes `Bytes` to value + pub to_vec: unsafe fn...
diff --git a/tests/test_bytes.rs b/tests/test_bytes.rs --- a/tests/test_bytes.rs +++ b/tests/test_bytes.rs @@ -1065,3 +1065,73 @@ fn bytes_into_vec() { let vec: Vec<u8> = bytes.into(); assert_eq!(&vec, prefix); } + +#[test] +fn test_bytes_into_vec() { + // Test STATIC_VTABLE.to_vec + let bs = b"1b23exf...
Conversion from Bytes to Vec<u8>? According to this thread https://github.com/tokio-rs/bytes/pull/151/commits/824a986fec988eaa7f9313838a01c7ff6d0e85bb conversion from `Bytes` to `Vec<u8>` has ever existed but not found today. Is it deleted? but what reason? Is there some workaround today? I want to use `Bytes` entir...
I think you should look into just using `Bytes` everywhere. `Bytes` in the end is a type-erased buffer, and it may or may not contain a `Vec<u8>`. Depending on what it is - which might again depend on the current version of `Bytes` - the conversion might either be rather cheap or involve a full allocation and copy....
2022-05-01T12:23:57Z
1.1
2022-07-13T07:04:28Z
068ed41bc02c21fe0a0a4d8e95af8a4668276f5d
[ "copy_to_bytes_less", "test_deref_buf_forwards", "test_bufs_vec", "copy_to_bytes_overflow - should panic", "test_fresh_cursor_vec", "test_get_u16", "test_get_u16_buffer_underflow - should panic", "test_get_u8", "test_vec_deque", "copy_from_slice_panics_if_different_length_2 - should panic", "tes...
[]
[]
[]
auto_2025-06-10
tokio-rs/bytes
543
tokio-rs__bytes-543
[ "427" ]
f514bd38dac85695e9053d990b251643e9e4ef92
diff --git a/src/bytes_mut.rs b/src/bytes_mut.rs --- a/src/bytes_mut.rs +++ b/src/bytes_mut.rs @@ -1540,6 +1540,43 @@ impl PartialEq<Bytes> for BytesMut { } } +impl From<BytesMut> for Vec<u8> { + fn from(mut bytes: BytesMut) -> Self { + let kind = bytes.kind(); + + let mut vec = if kind == KIND...
diff --git a/tests/test_bytes.rs b/tests/test_bytes.rs --- a/tests/test_bytes.rs +++ b/tests/test_bytes.rs @@ -1028,3 +1028,40 @@ fn box_slice_empty() { let b = Bytes::from(empty); assert!(b.is_empty()); } + +#[test] +fn bytes_into_vec() { + // Test kind == KIND_VEC + let content = b"helloworld"; + + ...
Conversion from Bytes to Vec<u8>? According to this thread https://github.com/tokio-rs/bytes/pull/151/commits/824a986fec988eaa7f9313838a01c7ff6d0e85bb conversion from `Bytes` to `Vec<u8>` has ever existed but not found today. Is it deleted? but what reason? Is there some workaround today? I want to use `Bytes` entir...
I think you should look into just using `Bytes` everywhere. `Bytes` in the end is a type-erased buffer, and it may or may not contain a `Vec<u8>`. Depending on what it is - which might again depend on the current version of `Bytes` - the conversion might either be rather cheap or involve a full allocation and copy....
2022-04-20T09:50:32Z
1.1
2022-07-10T12:25:14Z
068ed41bc02c21fe0a0a4d8e95af8a4668276f5d
[ "copy_to_bytes_less", "test_deref_buf_forwards", "copy_to_bytes_overflow - should panic", "test_bufs_vec", "test_fresh_cursor_vec", "test_get_u16", "test_get_u8", "test_get_u16_buffer_underflow - should panic", "test_vec_deque", "test_deref_bufmut_forwards", "copy_from_slice_panics_if_different_...
[]
[]
[]
auto_2025-06-10
starkware-libs/cairo
3,132
starkware-libs__cairo-3132
[ "3130" ]
5c98cf17854f2bec359077daa610a72453f04b7f
diff --git a/Cargo.lock b/Cargo.lock --- a/Cargo.lock +++ b/Cargo.lock @@ -603,6 +603,7 @@ dependencies = [ "env_logger", "indoc", "itertools", + "num-bigint", "salsa", "serde_json", "smol_str", diff --git a/crates/cairo-lang-plugins/Cargo.toml b/crates/cairo-lang-plugins/Cargo.toml --- a/crates/cairo-lang-...
diff --git a/crates/cairo-lang-plugins/src/lib.rs b/crates/cairo-lang-plugins/src/lib.rs --- a/crates/cairo-lang-plugins/src/lib.rs +++ b/crates/cairo-lang-plugins/src/lib.rs @@ -13,6 +15,7 @@ mod test; /// Gets the list of default plugins to load into the Cairo compiler. pub fn get_default_plugins() -> Vec<Arc<dyn S...
feat: compile-time arithmetic for constants # Feature Request **Describe the Feature Request** The Cairo compiler should be able to calculate the compile-time value of constants, to make it easier to write such constants, e.g.: ``` const some_value = (256 * 1080) & 0xfaff + 1234; // should become 14336 const s...
2023-05-12T09:12:14Z
1.3
2023-06-13T14:38:53Z
2dca6e26696859c0e70910023110500d6bc2671b
[ "test::expand_plugin::config", "test::expand_plugin::derive", "test::expand_plugin::panicable", "test::expand_plugin::generate_trait" ]
[]
[]
[]
auto_2025-06-10
starkware-libs/cairo
5,683
starkware-libs__cairo-5683
[ "5680" ]
576ddd1b38abe25af1e204cb77ea039b7c46d05e
diff --git a/crates/cairo-lang-semantic/src/expr/compute.rs b/crates/cairo-lang-semantic/src/expr/compute.rs --- a/crates/cairo-lang-semantic/src/expr/compute.rs +++ b/crates/cairo-lang-semantic/src/expr/compute.rs @@ -1773,7 +1773,7 @@ fn maybe_compute_tuple_like_pattern_semantic( unexpected_pattern: fn(TypeId) -...
diff --git a/crates/cairo-lang-semantic/src/expr/compute.rs b/crates/cairo-lang-semantic/src/expr/compute.rs --- a/crates/cairo-lang-semantic/src/expr/compute.rs +++ b/crates/cairo-lang-semantic/src/expr/compute.rs @@ -2279,30 +2279,13 @@ fn member_access_expr( // Find MemberId. let member_name = expr_as_id...
bug: weak inference on simple type # Bug Report **Cairo version:** On commit `8d6b690cb1401e682a0aba7bcda3b40f00482572`. **Current behavior:** The inference of very simple types seems to not be supported anymore, at least on `LegacyMap` that we had into the storage. It this expected as `LegacyMap` should be...
2024-05-29T16:31:46Z
2.6
2024-06-10T16:00:00Z
a767ed09cf460ba70c689abc2cfd18c0a581fc6c
[ "diagnostic::test::test_missing_module_file", "diagnostic::test::test_inline_module_diagnostics", "resolve::test::test_resolve_path_super", "diagnostic::test::test_analyzer_diagnostics", "items::extern_type::test::test_extern_type", "items::extern_function::test::test_extern_function", "expr::test::test...
[]
[]
[]
auto_2025-06-10
starkware-libs/cairo
5,539
starkware-libs__cairo-5539
[ "5524" ]
2b8bd3da33176c38e92e660d8c94f8b6df05f0b1
diff --git a/crates/cairo-lang-lowering/src/graph_algorithms/feedback_set.rs b/crates/cairo-lang-lowering/src/graph_algorithms/feedback_set.rs --- a/crates/cairo-lang-lowering/src/graph_algorithms/feedback_set.rs +++ b/crates/cairo-lang-lowering/src/graph_algorithms/feedback_set.rs @@ -41,7 +41,7 @@ pub fn priv_functio...
diff --git a/crates/cairo-lang-utils/src/graph_algos/feedback_set.rs b/crates/cairo-lang-utils/src/graph_algos/feedback_set.rs --- a/crates/cairo-lang-utils/src/graph_algos/feedback_set.rs +++ b/crates/cairo-lang-utils/src/graph_algos/feedback_set.rs @@ -19,45 +21,55 @@ mod feedback_set_test; /// Context for the fee...
bug: gas computation / unexpected cycle in computation issue with recursive type definition # Bug Report **Cairo version:** At least on `2.5.4` and `2.6.3` **Current behavior:** For the Dojo project, we use the following types to define the layout of our data that will be stored in a dedicated smart contrac...
Tell me if you need more explanation, context or whatever ! Thank you for the report! managed to minimally recreate an example now as well. For your specific usecase you can even reorder your function definitions - and your code would fully compile. will be taking care of it soon.
2024-05-09T18:35:22Z
2.6
2024-05-20T04:05:02Z
a767ed09cf460ba70c689abc2cfd18c0a581fc6c
[ "bigint::test::serde::test_bigint_serde::zero", "bigint::test::serde::test_bigint_serde::negative", "bigint::test::serde::test_bigint_serde::positive", "bigint::test::parity_scale_codec::encode_bigint", "collection_arithmetics::test::test_add_map_and_sub_map", "graph_algos::feedback_set::feedback_set_test...
[]
[]
[]
auto_2025-06-10
starkware-libs/cairo
4,777
starkware-libs__cairo-4777
[ "4744" ]
75f779e8553d28e4bfff3b23f140ccc781c9dab0
diff --git a/crates/cairo-lang-sierra-generator/src/store_variables/known_stack.rs b/crates/cairo-lang-sierra-generator/src/store_variables/known_stack.rs --- a/crates/cairo-lang-sierra-generator/src/store_variables/known_stack.rs +++ b/crates/cairo-lang-sierra-generator/src/store_variables/known_stack.rs @@ -70,9 +70,...
diff --git a/crates/cairo-lang-sierra-generator/src/store_variables/test.rs b/crates/cairo-lang-sierra-generator/src/store_variables/test.rs --- a/crates/cairo-lang-sierra-generator/src/store_variables/test.rs +++ b/crates/cairo-lang-sierra-generator/src/store_variables/test.rs @@ -207,6 +207,11 @@ fn get_lib_func_sign...
bug: One of the arguments does not satisfy the requirements of the libfunc. # Bug Report **Cairo version: 2.3.0-rc0** <!-- Please specify commit or tag version. --> **Current behavior:** ```cairo fn g(ref v: Felt252Vec<u64>, a: usize, b: usize, c: usize, d: usize, x: u64, y: u64) { let mut v_a = v[a];...
I suggested a temporary workaround as you suggested to me last time @orizi, which is ```rust #[inline(never)] fn no_op() {} fn g(ref v: Felt252Vec<u64>, a: usize, b: usize, c: usize, d: usize, x: u64, y: u64) { let mut v_a = v[a]; let mut v_b = v[b]; let mut v_c = v[c]; let mut v_d = v[d];...
2024-01-10T09:30:48Z
2.4
2024-01-15T08:20:26Z
75f779e8553d28e4bfff3b23f140ccc781c9dab0
[ "store_variables::test::push_values_with_hole" ]
[ "store_variables::known_stack::test::merge_stacks", "resolve_labels::test::test_resolve_labels", "canonical_id_replacer::test::test_replacer", "store_variables::test::consecutive_push_values", "store_variables::test::push_values_temp_not_on_top", "store_variables::test::push_values_optimization", "store...
[]
[]
auto_2025-06-10
starkware-libs/cairo
4,391
starkware-libs__cairo-4391
[ "4375" ]
45f9bc8ad931e1568ad3704efa49419a99572e2a
diff --git a/Cargo.lock b/Cargo.lock --- a/Cargo.lock +++ b/Cargo.lock @@ -1065,7 +1066,7 @@ dependencies = [ "serde_json", "sha2", "sha3", - "starknet-crypto", + "starknet-crypto 0.5.2", "thiserror-no-std", ] diff --git a/Cargo.lock b/Cargo.lock --- a/Cargo.lock +++ b/Cargo.lock @@ -2884,6 +2885,26 @@ depen...
diff --git a/Cargo.lock b/Cargo.lock --- a/Cargo.lock +++ b/Cargo.lock @@ -708,6 +708,7 @@ dependencies = [ "num-bigint", "num-integer", "num-traits 0.2.17", + "starknet-crypto 0.6.1", "test-case", "thiserror", ] diff --git a/Cargo.toml b/Cargo.toml --- a/Cargo.toml +++ b/Cargo.toml @@ -105,6 +105,7 @@ serde...
bug: CASM runner assigns arbitrary contract addresses instead of using correct address computation # Bug Report **Cairo version:** 2.3.1 <!-- Please specify commit or tag version. --> **Current behavior:** Currently, the casm runner assigns arbitrary addresses to contracts deployed using `deploy_syscall`, incr...
If these are the specifications - feel free to open a PR. Make sure to include a test. @orizi am I allowed to use the `calculate_contract_address` function from the `starknet_api` crate? Or do you not want dependencies external to the compiler? In any case, I need access to pedersen hash which is available in `starkne...
2023-11-10T08:51:39Z
2.3
2023-11-19T18:53:57Z
02b6ce71cf1d0ca226ba615ce363d71eb2340df4
[ "casm_run::test::test_as_cairo_short_string_ex", "casm_run::test::test_as_cairo_short_string", "casm_run::test::test_runner::jumps", "casm_run::test::test_format_for_debug", "casm_run::test::test_allocate_segment", "casm_run::test::test_runner::divmod_hint", "casm_run::test::test_runner::fib_1_1_13_", ...
[]
[]
[]
auto_2025-06-10
starkware-libs/cairo
6,317
starkware-libs__cairo-6317
[ "6080" ]
d22835b5494e976dbff7b967f3027cc04a7a04a6
diff --git a/crates/cairo-lang-defs/src/db.rs b/crates/cairo-lang-defs/src/db.rs --- a/crates/cairo-lang-defs/src/db.rs +++ b/crates/cairo-lang-defs/src/db.rs @@ -114,6 +114,9 @@ pub trait DefsGroup: /// i.e. a type marked with this attribute is considered a phantom type. fn declared_phantom_type_attributes(&...
diff --git a/Cargo.lock b/Cargo.lock --- a/Cargo.lock +++ b/Cargo.lock @@ -580,14 +580,19 @@ dependencies = [ name = "cairo-lang-doc" version = "2.8.2" dependencies = [ + "anyhow", "cairo-lang-defs", + "cairo-lang-filesystem", "cairo-lang-formatter", "cairo-lang-parser", + "cairo-lang-semantic", "cairo-lang-...
Implement `//!` comments Add support for `//!` comments that are handled analogously to Rust ones. Follow implementation of `///` comments.
Hey @mkaput I'll like to take up this issue. Can you provide more context to this issue? like where can I find the implementation of `///` this is trivially greppable https://github.com/starkware-libs/cairo/blob/e60c298fd7a10c4e40a63a066f25e972417a6847/crates/cairo-lang-doc/src/db.rs#L25 you will need to test...
2024-08-30T08:46:14Z
2.8
2024-09-09T12:47:54Z
47fe5bf462ab3a388f2c03535846a8c3a7873337
[ "markdown::test::fenced_code_blocks" ]
[]
[]
[]
auto_2025-06-10
starkware-libs/cairo
4,909
starkware-libs__cairo-4909
[ "4897" ]
7e0dceb788114a0f7e201801a03c034b52c19679
diff --git a/crates/cairo-lang-plugins/src/plugins/config.rs b/crates/cairo-lang-plugins/src/plugins/config.rs --- a/crates/cairo-lang-plugins/src/plugins/config.rs +++ b/crates/cairo-lang-plugins/src/plugins/config.rs @@ -9,7 +9,7 @@ use cairo_lang_syntax::attribute::structured::{ Attribute, AttributeArg, Attribu...
diff --git a/crates/cairo-lang-starknet/src/plugin/starknet_module/contract.rs b/crates/cairo-lang-starknet/src/plugin/starknet_module/contract.rs --- a/crates/cairo-lang-starknet/src/plugin/starknet_module/contract.rs +++ b/crates/cairo-lang-starknet/src/plugin/starknet_module/contract.rs @@ -302,12 +310,13 @@ pub(sup...
bug: code annotated with cfg(test) included in build # Bug Report **Cairo version:** 2.5.0 (was fine in 2.2.0) **Current behavior:** Contract that includes implementation annotated with `#[cfg(test)]` doesn't compile. Works fine when running `scarb test` **Related code:** Code example: ``` #[cfg...
2024-01-24T18:05:48Z
2.5
2024-02-04T08:34:08Z
600553d34a1af93ff7fb038ac677efdd3fd07010
[ "contract::test::test_starknet_keccak", "allowed_libfuncs::test::all_list_includes_all_supported", "allowed_libfuncs::test::libfunc_lists_include_only_supported_libfuncs", "contract_class::test::test_serialization", "felt252_serde::test::test_long_ids", "felt252_serde::test::test_libfunc_serde", "casm_c...
[]
[]
[]
auto_2025-06-10
starkware-libs/cairo
6,649
starkware-libs__cairo-6649
[ "6540" ]
47fe5bf462ab3a388f2c03535846a8c3a7873337
diff --git a/crates/cairo-lang-language-server/src/ide/hover/render/definition.rs b/crates/cairo-lang-language-server/src/ide/hover/render/definition.rs --- a/crates/cairo-lang-language-server/src/ide/hover/render/definition.rs +++ b/crates/cairo-lang-language-server/src/ide/hover/render/definition.rs @@ -32,6 +32,17 @...
diff --git a/crates/cairo-lang-language-server/tests/e2e/hover.rs b/crates/cairo-lang-language-server/tests/e2e/hover.rs --- a/crates/cairo-lang-language-server/tests/e2e/hover.rs +++ b/crates/cairo-lang-language-server/tests/e2e/hover.rs @@ -17,7 +17,8 @@ cairo_lang_test_utils::test_file_test!( partial: "part...
LS: Incorrect hovers for path segments Path segments in import statements don't have hovers by themselves ![Image](https://github.com/user-attachments/assets/f0cdd5ff-380b-42f6-b882-1efc7200ed04) However, when they appear in e.g. function call context, they inherit hover of the called function: ![Image](https://github...
2024-11-13T11:29:13Z
2.8
2024-11-18T11:15:41Z
47fe5bf462ab3a388f2c03535846a8c3a7873337
[ "hover::hover::basic", "hover::hover::paths" ]
[ "lang::diagnostics::trigger::test::test_drop_receiver", "lang::diagnostics::trigger::test::test_sync", "project::project_manifest_path::project_manifest_path_test::discover_cairo_project_toml", "project::project_manifest_path::project_manifest_path_test::discover_no_manifest", "lang::lsp::ls_proto_group::te...
[]
[]
auto_2025-06-10
starkware-libs/cairo
6,632
starkware-libs__cairo-6632
[ "6537" ]
893838229215c21471d2e9deacab7a37bc13f02b
diff --git a/crates/cairo-lang-language-server/src/lang/inspect/defs.rs b/crates/cairo-lang-language-server/src/lang/inspect/defs.rs --- a/crates/cairo-lang-language-server/src/lang/inspect/defs.rs +++ b/crates/cairo-lang-language-server/src/lang/inspect/defs.rs @@ -3,7 +3,7 @@ use std::iter; use cairo_lang_defs::db::...
diff --git a/crates/cairo-lang-language-server/tests/e2e/hover.rs b/crates/cairo-lang-language-server/tests/e2e/hover.rs --- a/crates/cairo-lang-language-server/tests/e2e/hover.rs +++ b/crates/cairo-lang-language-server/tests/e2e/hover.rs @@ -17,6 +17,7 @@ cairo_lang_test_utils::test_file_test!( partial: "part...
LS: Incorrect hover when used on member of struct llteral ![image](https://github.com/user-attachments/assets/1bac8b92-2c3e-4604-836d-89e37dc5bd75) ![image](https://github.com/user-attachments/assets/cafb3270-80ce-46bf-bfcc-968cd4b0851a) But not always ![image](https://github.com/user-attachments/assets/ddc3e628...
2024-11-12T10:49:03Z
2.8
2024-11-18T09:44:11Z
47fe5bf462ab3a388f2c03535846a8c3a7873337
[ "hover::hover::structs", "hover::hover::basic" ]
[ "lang::diagnostics::trigger::test::test_drop_receiver", "lang::diagnostics::trigger::test::test_sync", "lang::lsp::ls_proto_group::test::file_url", "project::project_manifest_path::project_manifest_path_test::discover_no_manifest", "project::project_manifest_path::project_manifest_path_test::discover_cairo_...
[]
[]
auto_2025-06-10
starkware-libs/cairo
2,289
starkware-libs__cairo-2289
[ "1672" ]
8f433e752a78afc017d0f08c9e21b966acfe1c11
diff --git a/crates/cairo-lang-parser/src/colored_printer.rs b/crates/cairo-lang-parser/src/colored_printer.rs --- a/crates/cairo-lang-parser/src/colored_printer.rs +++ b/crates/cairo-lang-parser/src/colored_printer.rs @@ -50,6 +50,7 @@ pub fn is_empty_kind(kind: SyntaxKind) -> bool { | SyntaxKind::OptionT...
diff --git a/crates/cairo-lang-parser/src/parser_test.rs b/crates/cairo-lang-parser/src/parser_test.rs --- a/crates/cairo-lang-parser/src/parser_test.rs +++ b/crates/cairo-lang-parser/src/parser_test.rs @@ -62,14 +62,30 @@ const TEST_test2_tree_with_trivia: ParserTreeTestParams = ParserTreeTestParams { print_color...
dev: generics type syntax contains turbofish ``` fn main() -> Option::<felt> { fib(1, 1, 13) } /// Calculates fib... fn fib(a: felt, b: felt, n: felt) -> Option::<felt> { get_gas()?; match n { 0 => Option::<felt>::Some(a), _ => fib(b, a + b, n - 1), } } ``` I hate to bik...
If anyone wants to contribute in this matter, it would be helpful:) Would love to contribute to this, if no one picked it up yet. Am a bit new to this so will be a bit slow when working on this, so if its urgent then I'll leave it to someone else. Sure, you are more than welcome. Not urgent at all. The main issue r...
2023-02-26T20:22:22Z
1.3
2023-02-28T15:48:46Z
2dca6e26696859c0e70910023110500d6bc2671b
[ "parser::test::partial_parser_tree_with_trivia::path", "parser::test::parse_and_compare_tree::test3_tree_no_trivia", "parser::test::parse_and_compare_tree::test3_tree_with_trivia", "parser::test::parse_and_compare_tree::test1_tree_no_trivia", "parser::test::parse_and_compare_tree::test1_tree_with_trivia" ]
[ "lexer::test::test_bad_character", "lexer::test::test_cases", "lexer::test::test_lex_single_token", "db::db_test::test_parser", "parser::test::diagnostic::fn_", "parser::test::diagnostic::pattern", "parser::test::diagnostic::semicolon", "parser::test::diagnostic::module_diagnostics", "parser::test::...
[]
[]
auto_2025-06-10
starkware-libs/cairo
3,264
starkware-libs__cairo-3264
[ "3211" ]
fecc9dc533ba78bb333d8f444d86ad9dd9b61e82
diff --git a/crates/cairo-lang-lowering/src/optimizations/match_optimizer.rs b/crates/cairo-lang-lowering/src/optimizations/match_optimizer.rs --- a/crates/cairo-lang-lowering/src/optimizations/match_optimizer.rs +++ b/crates/cairo-lang-lowering/src/optimizations/match_optimizer.rs @@ -22,6 +23,7 @@ pub fn optimize_mat...
diff --git a/crates/cairo-lang-lowering/src/optimizations/match_optimizer.rs b/crates/cairo-lang-lowering/src/optimizations/match_optimizer.rs --- a/crates/cairo-lang-lowering/src/optimizations/match_optimizer.rs +++ b/crates/cairo-lang-lowering/src/optimizations/match_optimizer.rs @@ -2,13 +2,14 @@ #[path = "match_op...
bug: Multiple jumps to arm blocks are not allowed. # Bug Report **Cairo version:** bcebb2e3 <!-- Please specify commit or tag version. --> **Current behavior:** The compiler panics when trying to compile and run this test: ```rust impl U256TryIntoU64 of TryInto<u256, u64> { #[inline(always)] ...
this is definitely a bug - it also happens when we inline the code "by hand" .
2023-05-30T08:30:01Z
1.3
2023-06-28T05:25:25Z
2dca6e26696859c0e70910023110500d6bc2671b
[ "optimizations::match_optimizer::test::match_optimizer::arm_pattern_destructure", "test::lowering::implicits", "optimizations::match_optimizer::test::match_optimizer::option" ]
[ "test::lowering_phases::tests", "test::lowering::rebindings", "test::lowering::assignment", "test::lowering::tuple", "test::lowering::enums", "test::lowering::error_propagate", "test::lowering::constant", "optimizations::delay_var_def::test::delay_var_def::move_literals", "lower::usage::test::inlini...
[]
[]
auto_2025-06-10