repo stringclasses 53
values | pull_number int64 2 17k | instance_id stringlengths 14 37 | issue_numbers listlengths 1 3 | base_commit stringlengths 40 40 | patch stringlengths 265 1.45M | test_patch stringlengths 254 1.33M | problem_statement stringlengths 26 44.3k | hints_text stringlengths 0 66.2k | created_at stringdate 2017-03-29 16:32:14 2024-12-29 18:55:13 | version stringclasses 84
values | updated_at stringdate 2017-04-05 19:13:00 2025-03-25 20:07:24 | environment_setup_commit stringlengths 40 40 | FAIL_TO_PASS listlengths 1 1.57k | PASS_TO_PASS listlengths 0 3.37k | FAIL_TO_FAIL listlengths 0 227 | PASS_TO_FAIL listlengths 0 3 | source_dir stringclasses 13
values |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
aya-rs/aya | 397 | aya-rs__aya-397 | [
"386"
] | 89df8c36d36584a506df50cdbbe8a3b0660337c2 | diff --git a/aya-log/src/lib.rs b/aya-log/src/lib.rs
--- a/aya-log/src/lib.rs
+++ b/aya-log/src/lib.rs
@@ -90,7 +90,7 @@ impl BpfLogger {
logger: T,
) -> Result<BpfLogger, Error> {
let logger = Arc::new(logger);
- let mut logs: AsyncPerfEventArray<_> = bpf.map_mut("AYA_LOGS")?.try_into()?;... | diff --git a/aya/src/maps/bloom_filter.rs b/aya/src/maps/bloom_filter.rs
--- a/aya/src/maps/bloom_filter.rs
+++ b/aya/src/maps/bloom_filter.rs
@@ -85,38 +72,6 @@ impl<T: Deref<Target = Map>, V: Pod> BloomFilter<T, V> {
}
}
-impl<V: Pod> TryFrom<MapRef> for BloomFilter<MapRef, V> {
- type Error = MapError;
-
... | Convert BPF maps to using enums
Following what we currenlty [do for EBPF Programs ](https://github.com/aya-rs/aya/blob/main/aya/src/programs/mod.rs#L221) convert aya's notion of bpf maps to be an Enum rather than having concrete types (HashMap, PerfEventArray etc) for every BPF map type.
Maps were initially design... | @dave-tucker You can assign me here :)
I've started this in https://github.com/astoycos/aya/tree/refactor-map Still have some to go but I'll keep updating with status here | 2022-09-29T18:54:50Z | 0.11 | 2023-02-23T10:03:39Z | 61608e64583f9dc599eef9b8db098f38a765b285 | [
"maps::bloom_filter::tests::test_insert_ok",
"maps::bloom_filter::tests::test_contains_syscall_error",
"maps::bloom_filter::tests::test_contains_not_found",
"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 | 387 | aya-rs__aya-387 | [
"385"
] | 98e25ca5e6550526d35f783d74e6276f7aaf8a71 | diff --git a/aya/src/bpf.rs b/aya/src/bpf.rs
--- a/aya/src/bpf.rs
+++ b/aya/src/bpf.rs
@@ -443,7 +443,7 @@ impl<'a> BpfLoader<'a> {
Err(_) => {
let fd = map.create(&name)?;
map.pin(&name, path).map_err(|error| MapError::PinError {
- ... | diff --git a/aya/src/maps/bloom_filter.rs b/aya/src/maps/bloom_filter.rs
--- a/aya/src/maps/bloom_filter.rs
+++ b/aya/src/maps/bloom_filter.rs
@@ -254,7 +250,7 @@ mod tests {
assert!(matches!(
bloom_filter.insert(1, 0),
- Err(MapError::SyscallError { call, code: -1, io_error }) if cal... | Allow the user to load pre-existing BPF maps from a pin point or a Raw FD
Similar to https://github.com/cilium/ebpf 's Map APIs https://pkg.go.dev/github.com/cilium/ebpf#LoadPinnedMap and https://pkg.go.dev/github.com/cilium/ebpf#NewMapFromFD I would like the ability to load and interact with Pre-existing BPF maps whi... | 2022-09-06T21:09:01Z | 0.11 | 2023-02-23T10:04:53Z | 61608e64583f9dc599eef9b8db098f38a765b285 | [
"maps::bloom_filter::tests::test_contains_not_found",
"maps::bloom_filter::tests::test_contains_syscall_error",
"maps::bloom_filter::tests::test_insert_syscall_error",
"maps::bloom_filter::tests::test_new_not_created",
"maps::bloom_filter::tests::test_insert_ok",
"maps::bloom_filter::tests::test_new_ok",
... | [] | [] | [] | auto_2025-06-07 | |
aya-rs/aya | 83 | aya-rs__aya-83 | [
"21"
] | f632f81db152fd1185047550ec819926a83b0eae | diff --git a/bpf/aya-bpf-macros/Cargo.toml b/bpf/aya-bpf-macros/Cargo.toml
--- a/bpf/aya-bpf-macros/Cargo.toml
+++ b/bpf/aya-bpf-macros/Cargo.toml
@@ -10,4 +10,7 @@ proc-macro = true
[dependencies]
proc-macro2 = "1.0"
quote = "1.0"
-syn = {version = "1.0", features = ["full"]}
\ No newline at end of file
+syn = {ver... | diff --git a/bpf/aya-bpf/src/programs/lsm.rs b/bpf/aya-bpf/src/programs/lsm.rs
--- a/bpf/aya-bpf/src/programs/lsm.rs
+++ b/bpf/aya-bpf/src/programs/lsm.rs
@@ -10,6 +10,49 @@ impl LsmContext {
pub fn new(ctx: *mut c_void) -> LsmContext {
LsmContext { ctx }
}
+
+ /// Returns the `n`th argument passe... | feat(bpf): add probe register utility methods
There is currently a lot of commented code in those methods because the code will panic on no_std, if possible a proper fix for assert and panic should be added, so we can write safer code when using specific arch
| 2021-10-28T14:42:44Z | 0.10 | 2022-01-11T16:42:21Z | b9a544831c5b4cd8728e9cca6580c14a623b7793 | [
"src/helpers.rs - helpers::bpf_get_current_pid_tgid (line 305) - compile",
"src/helpers.rs - helpers::bpf_probe_read (line 27) - compile",
"src/helpers.rs - helpers::bpf_probe_read_kernel (line 101) - compile",
"src/helpers.rs - helpers::bpf_probe_read_user_str (line 184) - compile",
"src/helpers.rs - helpe... | [] | [] | [] | auto_2025-06-07 | |
aya-rs/aya | 63 | aya-rs__aya-63 | [
"45"
] | a7f5b3775d27c89e226c49c4a2f21d0e90b08591 | diff --git a/aya/src/bpf.rs b/aya/src/bpf.rs
--- a/aya/src/bpf.rs
+++ b/aya/src/bpf.rs
@@ -2,7 +2,7 @@ use std::{
collections::HashMap,
error::Error,
fs, io,
- os::raw::c_int,
+ os::{raw::c_int, unix::io::RawFd},
path::{Path, PathBuf},
};
diff --git a/aya/src/bpf.rs b/aya/src/bpf.rs
--- a/a... | 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
@@ -182,6 +182,7 @@ mod tests {
let map = Map {
obj: new_obj_map("TEST"),
fd: None,
+ pinned: false,
}... | Add support for map and program pinning
Program pinning looks simple enough:
It should be possible to add `pub fn pin(&mut self, path: Path )` to the `Link` trait.
Where `Path` would be a relative path on `/sys/fs/bpf` or an absolute path to `/sys/fs/bpf`.
The implementation would call the `bpf` syscall and `BPF_OBJ... | 2021-09-24T16:32:32Z | 0.10 | 2022-01-11T16:44:13Z | 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_insert_syscall_error",
"maps::hash_map::hash_map::tests::test_get_syscall_error",
"maps::hash_map::hash_map::tests::test_iter",
"maps::hash_map::hash_map::tests:... | [] | [] | [] | auto_2025-06-07 | |
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 | 475 | aya-rs__aya-475 | [
"473"
] | c6f93b177511d3dfb0ab6cce4fa298d13707dedc | diff --git /dev/null b/aya-obj/Cargo.toml
new file mode 100644
--- /dev/null
+++ b/aya-obj/Cargo.toml
@@ -0,0 +1,27 @@
+[package]
+name = "aya-obj"
+version = "0.1.0"
+description = "An eBPF object file parsing library with BTF and relocation support."
+keywords = ["ebpf", "bpf", "btf", "elf", "object"]
+license = "MIT... | diff --git a/Cargo.toml b/Cargo.toml
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,12 +1,12 @@
[workspace]
members = [
- "aya", "aya-tool", "aya-log", "aya-log-common", "aya-log-parser", "test/integration-test", "test/integration-test-macros", "xtask",
+ "aya", "aya-obj", "aya-tool", "aya-log", "aya-log-common", "aya... | Feature Request: Make aya::obj API public to allow usage with different runtime
There exists some user-space runtime for eBPF programs, like [rbpf](https://github.com/qmonnet/rbpf). However, taking rbpf for an example, it only accepts fully relocated raw eBPF bytecode (similar to BPF_PROG_LOAD in `bpf(2)`) and does not... | This has come up a couple of times before. I think we could split the linking/relocation code as part of a separate `aya-obj` or something crate. I just don't want to commit to exposing it as part of the main `aya` crate. We're slowly refining the `aya` API towards releasing 1.0, and at this time I think we should focu... | 2022-12-28T08:34:06Z | 0.11 | 2023-03-10T14:43:06Z | 61608e64583f9dc599eef9b8db098f38a765b285 | [
"generate::test::test_extract_ctypes_prefix",
"generate::test::test_combine_flags"
] | [] | [] | [] | 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,070 | sharkdp__bat-1070 | [
"1046"
] | b09d245dea7e2f45cf461fda978f3256e7162465 | diff --git a/.gitmodules b/.gitmodules
--- a/.gitmodules
+++ b/.gitmodules
@@ -185,3 +185,6 @@
[submodule "assets/syntaxes/02_Extra/AsciiDoc"]
path = assets/syntaxes/02_Extra/AsciiDoc
url = https://github.com/asciidoctor/sublimetext-asciidoc.git
+[submodule "assets/syntaxes/02_Extra/GLSL"]
+ path = assets/syntaxes... | diff --git a/src/assets.rs b/src/assets.rs
--- a/src/assets.rs
+++ b/src/assets.rs
@@ -428,6 +428,7 @@ mod tests {
assert_eq!(test.syntax_for_file("test.h"), "C++");
assert_eq!(test.syntax_for_file("test.sass"), "Sass");
assert_eq!(test.syntax_for_file("test.js"), "JavaScript (Babel)");
+ ... | Add GLSL syntax
<!--
BEFORE YOU MAKE A REQUEST:
Are you looking to add a new syntax to use on one of your devices?
Bat supports locally-installed language definitions. See the link below:
https://github.com/sharkdp/bat#adding-new-syntaxes--language-definitions
If you think adding this syntax would help other... | Relevant package:
https://packagecontrol.io/packages/OpenGL%20Shading%20Language%20%28GLSL%29
| 2020-06-23T01:20:46Z | 0.15 | 2020-06-29T04:10:37Z | 2d1a92b7cc2af6c35f868cbefe9dbfe466c59fcb | [
"config::default_config_should_include_all_lines",
"config::default_config_should_highlight_no_lines",
"less::test_parse_less_version_487",
"less::test_parse_less_version_529",
"input::basic",
"less::test_parse_less_version_wrong_program",
"less::test_parse_less_version_551",
"input::utf16le",
"line... | [] | [] | [] | auto_2025-06-07 |
sharkdp/bat | 1,023 | sharkdp__bat-1023 | [
"978"
] | 1dae5bbc95c5f2297ebd1d12bc109f520c0351d2 | diff --git a/Cargo.toml b/Cargo.toml
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -76,6 +76,7 @@ default-features = false
[dev-dependencies]
tempdir = "0.3"
assert_cmd = "1.0.1"
+predicates = "1.0.4"
[build-dependencies]
clap = { version = "2.33", optional = true }
| diff --git /dev/null b/.github/workflows/CICD.yml
new file mode 100644
--- /dev/null
+++ b/.github/workflows/CICD.yml
@@ -0,0 +1,294 @@
+name: CICD
+
+env:
+ PROJECT_NAME: bat
+ PROJECT_DESC: "A `cat` clone with wings"
+ PROJECT_AUTH: "sharkdp"
+ RUST_MIN_SRV: "1.40.0"
+
+on: [push, pull_request]
+
+jobs:
+ min_ve... | Github actions integration
Is there any interest in using Github actions for this Project? I had a nice experience using them and I would set up one for testing and build automation.
| > Is there any interest in using Github actions for this Project?
Yes, there is! :smile:
@rivy has recently upgraded the CICD system to GitHub Actions in another Rust project of mine (https://github.com/sharkdp/pastel, https://github.com/sharkdp/pastel/pull/120), and I really like how it nicely integrates with t... | 2020-05-26T03:51:46Z | 0.15 | 2020-06-03T07:13:48Z | 2d1a92b7cc2af6c35f868cbefe9dbfe466c59fcb | [
"config::default_config_should_include_all_lines",
"config::default_config_should_highlight_no_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 | 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:**
)
```
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 | 1,135 | sharkdp__bat-1135 | [
"1076"
] | b3657aef2bc34ef09cd86e2ea044e6bdee0f8141 | diff --git a/CHANGELOG.md b/CHANGELOG.md
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,4 +1,5 @@
# unreleased
+- Handle file extension conflicts in --list-languages, see #1076 and #1135 (@Kienyew)
## Features
diff --git a/src/assets.rs b/src/assets.rs
--- a/src/assets.rs
+++ b/src/assets.rs
@@ -170,6 +170,21 @@ imp... | diff --git a/src/bin/bat/main.rs b/src/bin/bat/main.rs
--- a/src/bin/bat/main.rs
+++ b/src/bin/bat/main.rs
@@ -86,6 +86,26 @@ pub fn list_languages(config: &Config) -> Result<()> {
.filter(|syntax| !syntax.hidden && !syntax.file_extensions.is_empty())
.cloned()
.collect::<Vec<_>>();
+
+ //... | Improved handling of file-extension conflicts
With #1070 merged, we now have four known exceptions to the "no duplicate extensions" rule (see `tests/no_duplicate_extensions.rs`). We have a separate test (`syntax_detection_well_defined_mapping_for_duplicate_extensions`) that makes sure that these extensions are handled ... | 2020-08-08T04:45:38Z | 0.15 | 2020-09-20T10:40:39Z | 2d1a92b7cc2af6c35f868cbefe9dbfe466c59fcb | [
"config::default_config_should_include_all_lines",
"config::default_config_should_highlight_no_lines",
"input::basic",
"input::utf16le",
"less::test_parse_less_version_wrong_program",
"line_range::test_parse_full",
"less::test_parse_less_version_487",
"less::test_parse_less_version_529",
"less::test... | [] | [] | [] | 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 |
sharkdp/bat | 337 | sharkdp__bat-337 | [
"285"
] | e97095b724b763e6841c08d9b89b20089592d310 | diff --git a/Cargo.lock b/Cargo.lock
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -50,8 +50,9 @@ dependencies = [
"atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
"clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)",
"console 0.6.2 (registry+https://github.com/rust-lang/crates.io-in... | diff --git a/Cargo.lock b/Cargo.lock
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -166,6 +167,63 @@ dependencies = [
"winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
]
+[[package]]
+name = "encoding"
+version = "0.2.33"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+dependencies ... | bat shows BOM at the start of the line
when the source code has BOM at the begining of the line, its shown as "<U+FEFF>". I have now huge problem with this per se but it would be more user friendly to strip that piece away when showing the code and putting that info as interpreted value into same line as "File:" is, li... | Thank you for your feedback.
I have recently written a small library (https://crates.io/crates/content_inspector) that I plan to use within `bat`. It will be able to detect BOMs, which should make this feature request possible. I love the idea of showing the encoding within the header. I was always planning to put m... | 2018-10-07T14:46:12Z | 0.7 | 2018-10-07T15:56:30Z | e43d97dc15985258b03ade549e81ffdedce8c650 | [
"inputfile::utf16le"
] | [
"inputfile::basic",
"line_range::test_parse_full",
"line_range::test_parse_partial_max",
"line_range::test_parse_fail",
"line_range::test_parse_partial_min",
"snapshot::grid_header_numbers",
"snapshot::tabs_4_wrapped",
"snapshot::changes",
"snapshot::header",
"snapshot::tabs_8_wrapped",
"snapsho... | [] | [] | auto_2025-06-07 |
sharkdp/bat | 165 | sharkdp__bat-165 | [
"161"
] | 69c798eafd93d174d0340158794b7c1d5f4e598d | diff --git a/Cargo.lock b/Cargo.lock
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -51,6 +51,7 @@ dependencies = [
"git2 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"syntect 2.1.0 (registry+https://github.com/rust-lang/crates.... | diff --git a/tests/tester.rs b/tests/tester.rs
--- a/tests/tester.rs
+++ b/tests/tester.rs
@@ -1,16 +1,29 @@
use std::env;
use std::fs::{self, File};
-use std::io::Read;
-use std::path::PathBuf;
+use std::io::{self, Read};
+use std::path::{Path, PathBuf};
use std::process::Command;
+extern crate tempdir;
+use self... | cargo test thread panicked while panicking on 0.4.0 tarball
Hi I was just preparing to update the AUR package to 0.4.0. Part of the build process runs the tests via `cargo test`, which is failing. I tried a separate git checkout of the 0.4.0 tag and `cargo test` worked. I then tried downloading [the release tarball][ta... | Thank you for reporting this. I can reproduce this. Not sure what is going on (currently investigating).
Ok, this is due to the way we reset the `sample.rs` file after running the tests. It expects the current folder to be a Git repository:
```rust
fn undo_sample_file_modification() {
let output = Command::new("... | 2018-06-02T16:08:57Z | 0.4 | 2018-06-02T17:00:16Z | e5b8c4471a609991f82183ed6648ffa2b20b130c | [
"terminal::test_rgb2ansi_black_white",
"terminal::test_rgb2ansi_approx",
"terminal::test_rgb2ansi_gray",
"terminal::test_rgb2ansi_color",
"test_snapshots"
] | [] | [] | [] | auto_2025-06-07 |
cswinter/LocustDB | 138 | cswinter__LocustDB-138 | [
"101"
] | 3a180e58446d263dee73023275946ebdd6b16081 | diff --git a/src/engine/execution/query_task.rs b/src/engine/execution/query_task.rs
--- a/src/engine/execution/query_task.rs
+++ b/src/engine/execution/query_task.rs
@@ -80,15 +80,21 @@ impl QueryTask {
sender: SharedSender<QueryResult>) -> Result<QueryTask, QueryError> {
let start_time_ns = p... | diff --git a/src/syntax/parser.rs b/src/syntax/parser.rs
--- a/src/syntax/parser.rs
+++ b/src/syntax/parser.rs
@@ -341,13 +360,20 @@ mod tests {
fn test_select_star() {
assert_eq!(
format!("{:?}", parse_query("select * from default")),
- "Ok(Query { select: [ColName(\"*\")], table:... | Query planner chooses names for anonymous result columns that might be identical to existing ones
It should ensure that all output column names are unique.
| Can I pick this up? Also interested to know about your future plans related to this project.
Please do! I think it just needs some changes to this function: https://github.com/cswinter/LocustDB/blob/e3e53fa6ecd7a6c53337bd017c600fa2e6c18ff1/src/engine/planning/query.rs#L347
There's also a related issue https://github.c... | 2021-01-21T10:44:16Z | 0.1 | 2021-01-22T15:56:34Z | 3a180e58446d263dee73023275946ebdd6b16081 | [
"syntax::parser::tests::test_select_star",
"syntax::parser::tests::test_alias",
"syntax::parser::tests::test_to_year",
"test_colnames"
] | [
"engine::operators::top_n::tests::test_heap_replace",
"engine::operators::subpartition::tests::test_multipass_grouping",
"ingest::alias_method_fork::test_new_alias_table",
"mem_store::codec::tests::test_ensure_property",
"unit_fmt::tests::test_format",
"ingest::schema::tests::test_parse_schema",
"lt_fil... | [
"test_group_by_nullable"
] | [] | auto_2025-05-30 |
artichoke/artichoke | 2,497 | artichoke__artichoke-2497 | [
"2311"
] | 73f8bd2f4c30bd7057b7f471b8928d6312440d06 | diff --git a/Cargo.lock b/Cargo.lock
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -638,6 +638,10 @@ dependencies = [
name = "scolapasta-aref"
version = "0.1.0"
+[[package]]
+name = "scolapasta-fixable"
+version = "0.1.0"
+
[[package]]
name = "scolapasta-hex"
version = "0.2.0"
diff --git a/Cargo.toml b/Cargo.toml
--- a/C... | diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml
--- a/.github/workflows/ci.yaml
+++ b/.github/workflows/ci.yaml
@@ -296,6 +296,14 @@ jobs:
run: cargo check --verbose --all-features --all-targets --profile=test
working-directory: "scolapasta-aref"
+ - name: Compile scolapasta-... | Build Rust crate for truncating floats to ints aka `RB_FIXABLE`
With the recent stabilization of [`Duration::try_from_secs_f64`](https://doc.rust-lang.org/std/time/struct.Duration.html#method.try_from_secs_f64) in Rust 1.66.0, there is now an API in `std` that can losslessly truncate an `f64` to a `u64` like this:
`... | 2023-04-10T00:18:27Z | 0.21 | 2023-04-10T23:57:47Z | 73f8bd2f4c30bd7057b7f471b8928d6312440d06 | [
"src/lib.rs - readme (line 78)"
] | [
"tests::negative_index",
"tests::positive_index",
"tests::zero_index",
"src/lib.rs - readme (line 69)",
"src/lib.rs - offset_to_index (line 55)",
"src/lib.rs - (line 26)",
"radix::tests::default_is_radix_10",
"error::tests::argument_error_display_from_invalid_subject",
"error::tests::argument_error_... | [] | [] | auto_2025-06-03 | |
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 | 2,170 | artichoke__artichoke-2170 | [
"2111"
] | 0e9ae53a463274564554a84b04c749d137e51d8e | diff --git a/scolapasta-path/src/paths.rs b/scolapasta-path/src/paths.rs
--- a/scolapasta-path/src/paths.rs
+++ b/scolapasta-path/src/paths.rs
@@ -9,15 +9,15 @@
use std::path::{Path, PathBuf};
mod default;
-#[cfg(unix)]
-mod unix;
+#[cfg(any(unix, target_os = "wasi"))]
+mod unix_wasi;
#[cfg(windows)]
mod windows;... | diff --git a/scolapasta-path/src/paths/unix.rs b/scolapasta-path/src/paths/unix_wasi.rs
--- a/scolapasta-path/src/paths/unix.rs
+++ b/scolapasta-path/src/paths/unix_wasi.rs
@@ -18,7 +21,10 @@ pub fn normalize_slashes(path: PathBuf) -> Result<Vec<u8>, PathBuf> {
#[cfg(test)]
mod tests {
use std::ffi::{OsStr, OsSt... | Add `wasi` platform support to `scolapasta-path`
Path and platform string routines were extracted to `scolapasta-path` in https://github.com/artichoke/artichoke/pull/2105 and https://github.com/artichoke/artichoke/pull/2110.
Both modules in `scolapasta-path` define platform-specific implementations for:
- `cfg(wi... | 2022-09-04T02:45:13Z | 1.63 | 2022-09-04T23:21:13Z | 0e9ae53a463274564554a84b04c749d137e51d8e | [
"paths::default::tests::absolute",
"paths::default::tests::double_dot",
"paths::default::tests::double_dot_slash",
"paths::default::tests::explicit_relative",
"paths::default::tests::empty",
"paths::default::tests::invalid_utf8_explicit_relative_bytes",
"paths::default::tests::invalid_utf8_not_explicit_... | [] | [] | [] | auto_2025-06-03 | |
artichoke/artichoke | 2,102 | artichoke__artichoke-2102 | [
"1722"
] | 0a99f8a7aef3dd2b92a005c64f35435d90b2349c | diff --git a/spinoso-string/src/enc/ascii/mod.rs b/spinoso-string/src/enc/ascii/mod.rs
--- a/spinoso-string/src/enc/ascii/mod.rs
+++ b/spinoso-string/src/enc/ascii/mod.rs
@@ -198,7 +198,15 @@ impl AsciiString {
pub fn get_char_slice(&self, range: Range<usize>) -> Option<&'_ [u8]> {
let Range { start, end ... | diff --git a/spinoso-string/src/enc/ascii/mod.rs b/spinoso-string/src/enc/ascii/mod.rs
--- a/spinoso-string/src/enc/ascii/mod.rs
+++ b/spinoso-string/src/enc/ascii/mod.rs
@@ -517,4 +525,27 @@ mod tests {
s.make_uppercase();
assert_eq!(s, "�");
}
+
+ #[test]
+ fn get_char_slice_valid_range()... | Push fast paths in `String::char_len` down into encoded variants
I agree with your instinct here. It'd also allow us to only pay the branching cost once, for example we branch in `char_len` above in the short circuiting logic.
Happy for this to be addressed in a followup.
I think the short circuiting logic is mos... | 2022-08-24T07:22:27Z | 1.63 | 2022-09-07T01:23:44Z | 0e9ae53a463274564554a84b04c749d137e51d8e | [
"enc::ascii::tests::get_char_slice_invalid_range",
"enc::binary::tests::get_char_slice_invalid_range",
"enc::utf8::tests::get_char_slice_invalid_range",
"enc::utf8::tests::get_char_slice_valid_range"
] | [
"enc::ascii::inspect::tests::del",
"enc::ascii::inspect::tests::ascii_control",
"enc::ascii::inspect::tests::emoji",
"enc::ascii::inspect::tests::escape_inner_slash",
"enc::ascii::inspect::tests::escape_slash",
"enc::ascii::inspect::tests::empty",
"enc::ascii::inspect::tests::fred",
"enc::ascii::inspe... | [] | [] | auto_2025-06-03 | |
artichoke/artichoke | 1,925 | artichoke__artichoke-1925 | [
"1915"
] | 195acb5f898ec6eb303e64d2deebffe83691a2d4 | diff --git a/spinoso-string/src/enc/mod.rs b/spinoso-string/src/enc/mod.rs
--- a/spinoso-string/src/enc/mod.rs
+++ b/spinoso-string/src/enc/mod.rs
@@ -563,4 +563,13 @@ impl EncodedString {
EncodedString::Utf8(inner) => inner.ends_with(slice),
}
}
+
+ #[inline]
+ pub fn reverse(&mut self... | diff --git a/artichoke-backend/src/extn/core/string/string_test.rb b/artichoke-backend/src/extn/core/string/string_test.rb
--- a/artichoke-backend/src/extn/core/string/string_test.rb
+++ b/artichoke-backend/src/extn/core/string/string_test.rb
@@ -8,6 +8,7 @@ def spec
string_byteslice
string_scan
string_unary_m... | `String#reverse` and `String#reverse!` must be encoding-aware
## MRI
```console
[3.1.2] > "體黑正軟微".reverse
=> "微軟正黑體"
[3.1.2] > "體黑正軟微".encoding
=> #<Encoding:UTF-8>
```
## Artichoke
```console
$ cargo run --bin airb -q
artichoke 0.1.0-pre.0 (2022-06-25 revision 5659) [x86_64-apple-darwin]
[rustc 1.60.0... | 2022-06-28T19:09:18Z | 1.60 | 2022-06-28T22:03:09Z | 195acb5f898ec6eb303e64d2deebffe83691a2d4 | [
"enc::ascii::inspect::tests::del",
"enc::ascii::inspect::tests::emoji",
"enc::ascii::inspect::tests::empty",
"enc::ascii::inspect::tests::ascii_control",
"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 | 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 | |
ash-rs/ash | 341 | ash-rs__ash-341 | [
"277"
] | bfa0309c97000520edeabc0f90b32b322517a2cc | diff --git /dev/null b/ash/src/extensions/khr/acceleration_structure.rs
new file mode 100644
--- /dev/null
+++ b/ash/src/extensions/khr/acceleration_structure.rs
@@ -0,0 +1,321 @@
+#![allow(dead_code)]
+use crate::prelude::*;
+use crate::version::{DeviceV1_0, InstanceV1_0, InstanceV1_1};
+use crate::vk;
+use crate::Raw... | diff --git a/ash/src/vk/extensions.rs b/ash/src/vk/extensions.rs
--- a/ash/src/vk/extensions.rs
+++ b/ash/src/vk/extensions.rs
@@ -14865,7278 +14655,10284 @@ impl NvRayTracingFn {
width: u32,
height: u32,
depth: u32,
- ) -> c_void {
- (self.cmd_trace_rays_nv)(
- command_b... | Add support for the new VK_KHR_ray_tracing extension
See https://www.khronos.org/blog/ray-tracing-in-vulkan
* [ ] Generate vk.rs with the new xml
* [ ] Expose a "high level" extension for `VK_KHR_ray_tracing`
* I expect this to be a lot of work, a basic version would be good enough for now.
| Relevant PR for reference: https://github.com/MaikKlein/ash/pull/278
SOLVED: .as_slice() works, sorry. So the docs are wrong it's not the same as ```&s[..]```.
cmd_build_acceleration_structure() Takes a slice of slice and it's kinda hard to build one of those! Unless I'm missing some rust foo.
The goal here is ... | 2020-11-23T09:57:32Z | 0.31 | 2020-12-13T18:52:49Z | bfa0309c97000520edeabc0f90b32b322517a2cc | [
"tests::test_ptr_chains",
"assert_ffi_array_param_is_pointer",
"assert_struct_field_is_array",
"debug_enum",
"debug_flags",
"src/util.rs - util::read_spv (line 91)",
"src/lib.rs - (line 8)",
"src/entry_libloading.rs - entry_libloading::EntryCustom<Arc<Library>>::new (line 45)",
"src/entry.rs - entry... | [] | [] | [] | auto_2025-06-03 |
rinja-rs/askama | 673 | rinja-rs__askama-673 | [
"671"
] | 358f7cd07dc42ba4189d2661461ff0b43a27c304 | diff --git a/askama_shared/src/generator.rs b/askama_shared/src/generator.rs
--- a/askama_shared/src/generator.rs
+++ b/askama_shared/src/generator.rs
@@ -246,7 +246,7 @@ struct Generator<'a, S: std::hash::BuildHasher> {
next_ws: Option<&'a str>,
// Whitespace suppression from the previous non-literal. Will b... | diff --git a/askama_shared/src/lib.rs b/askama_shared/src/lib.rs
--- a/askama_shared/src/lib.rs
+++ b/askama_shared/src/lib.rs
@@ -701,5 +705,14 @@ mod tests {
)
.unwrap();
assert_eq!(config.whitespace, WhitespaceHandling::Preserve);
+
+ let config = Config::new(
+ r#"
+ ... | Trim all but 1 whitespace jinja condition
@vallentin suggested [here](https://github.com/djc/askama/pull/664#pullrequestreview-945253861) that we could extend the "trim_all_whitespace" feature to be able to trim all whitespace characters but one.
So currently, we have:
```jinja
<div> {%- if foo -%} blabla {%-... | I'm on board with all that, including the proposed operator.
Ok, then I'll make a PR soon. :)
I like that! For readability I'd like it best if a run of whitespaces becomes a single '\n' if it contains an '\n', or a space otherwise.
I'm fine with implementing it this way. Anyone else has an opinion maybe?
Yeah, I think ... | 2022-04-21T14:51:49Z | 0.11 | 2022-04-26T08:31:21Z | 7b6f1df433a7f11612608644342b898cd6be8ff5 | [
"filters::json::tests::test_json",
"filters::tests::test_abs",
"filters::tests::test_center",
"filters::tests::test_capitalize",
"filters::tests::test_filesizeformat",
"filters::tests::test_indent",
"filters::tests::test_into_f64",
"filters::tests::test_into_isize",
"filters::tests::test_join",
"f... | [] | [] | [] | auto_2025-06-03 |
rinja-rs/askama | 652 | rinja-rs__askama-652 | [
"651"
] | b14982f97ffd20039286171d56e6fcfab21f56bc | diff --git a/askama_shared/src/filters/mod.rs b/askama_shared/src/filters/mod.rs
--- a/askama_shared/src/filters/mod.rs
+++ b/askama_shared/src/filters/mod.rs
@@ -330,20 +330,14 @@ where
/// Capitalize a value. The first character will be uppercase, all others lowercase.
pub fn capitalize<T: fmt::Display>(s: T) -> ... | diff --git a/askama_shared/src/filters/mod.rs b/askama_shared/src/filters/mod.rs
--- a/askama_shared/src/filters/mod.rs
+++ b/askama_shared/src/filters/mod.rs
@@ -655,6 +649,9 @@ mod tests {
assert_eq!(capitalize(&"").unwrap(), "".to_string());
assert_eq!(capitalize(&"FoO").unwrap(), "Foo".to_string()... | Capitalize does not work with non ascii chars
Capitalize filter only works with ascii chars not chars like å, ä and ö.
| This custom filter does what i expected capitalize to do.
```rust
mod filters {
pub fn cap(s: &str) -> ::askama::Result<String> {
match s.chars().next() {
Some(c) => {
if c.is_lowercase() {
let mut replacement: String = c.to_uppercase().collect();
... | 2022-03-26T15:32:24Z | 0.11 | 2022-03-26T17:50:42Z | 7b6f1df433a7f11612608644342b898cd6be8ff5 | [
"filters::tests::test_capitalize"
] | [
"filters::tests::test_abs",
"filters::tests::test_center",
"filters::tests::test_filesizeformat",
"filters::json::tests::test_json",
"filters::tests::test_indent",
"filters::tests::test_into_f64",
"filters::tests::test_into_isize",
"filters::tests::test_join",
"filters::tests::test_linebreaks",
"f... | [
"filters::yaml::tests::test_yaml"
] | [] | auto_2025-06-03 |
rinja-rs/askama | 594 | rinja-rs__askama-594 | [
"592"
] | af552ee3744016ac1db741888318649a64dfee50 | diff --git a/askama/Cargo.toml b/askama/Cargo.toml
--- a/askama/Cargo.toml
+++ b/askama/Cargo.toml
@@ -31,12 +31,14 @@ with-rocket = ["askama_derive/rocket"]
with-tide = ["askama_derive/tide"]
with-warp = ["askama_derive/warp"]
+# deprecated
+mime = []
+mime_guess = []
+
[dependencies]
askama_derive = { version =... | diff --git a/askama/src/lib.rs b/askama/src/lib.rs
--- a/askama/src/lib.rs
+++ b/askama/src/lib.rs
@@ -184,6 +172,8 @@ mod tests {
const EXTENSION: Option<&'static str> = Some("txt");
const SIZE_HINT: usize = 4;
+
+ const MIME_TYPE: &'static str = "text/plain; charset=utf-8";
... | Why is there a runtime dependency for mime-guess?
I guess the MIME type could be "guessed" at compile time, and be stored in a field Template::MIMETYPE. Or am I overlooking something?
| No, that sounds about right! | 2022-01-05T17:09:39Z | 0.11 | 2022-01-07T15:31:46Z | 7b6f1df433a7f11612608644342b898cd6be8ff5 | [
"tests::dyn_template",
"test",
"filters::tests::test_abs",
"filters::tests::test_center",
"filters::tests::test_capitalize",
"filters::json::tests::test_json",
"filters::tests::test_filesizeformat",
"filters::tests::test_indent",
"filters::tests::test_into_f64",
"filters::tests::test_into_isize",
... | [] | [] | [] | auto_2025-06-03 |
rinja-rs/askama | 359 | rinja-rs__askama-359 | [
"357"
] | 17b9d06814cee84bfd57b73e1941b63187ec5f65 | diff --git a/askama_shared/src/filters/mod.rs b/askama_shared/src/filters/mod.rs
--- a/askama_shared/src/filters/mod.rs
+++ b/askama_shared/src/filters/mod.rs
@@ -249,7 +249,7 @@ pub fn indent(s: &dyn fmt::Display, width: &usize) -> Result<String> {
#[cfg(feature = "num-traits")]
/// Casts number to f64
-pub fn int... | diff --git a/askama_shared/src/filters/mod.rs b/askama_shared/src/filters/mod.rs
--- a/askama_shared/src/filters/mod.rs
+++ b/askama_shared/src/filters/mod.rs
@@ -460,22 +460,22 @@ mod tests {
#[test]
#[allow(clippy::float_cmp)]
fn test_into_f64() {
- assert_eq!(into_f64(1).unwrap(), 1.0 as f64);
... | into_f64, into_isize unusable
`{{ number | into_f64 }}` expands to `into_f64(&number)`, which doesn't compile, because borrowed number doesn't `impl NumCast`.
| Thanks for the report. Would you mind submitting a patch that adds the appropriate `*` operators?
Maybe it's better to have info_f64 take `&T`?
That's fine, too! Whatever works in the context of Askama filters. | 2020-09-16T01:05:50Z | 0.10 | 2020-09-16T09:49:22Z | 49252d2457f280026c020d0df46733578eb959a5 | [
"filters::tests::test_abs",
"filters::tests::test_filesizeformat",
"filters::tests::test_center",
"filters::tests::test_capitalize",
"filters::json::tests::test_json",
"filters::tests::test_into_f64",
"filters::tests::test_indent",
"filters::tests::test_into_isize",
"filters::tests::test_lower",
"... | [] | [] | [] | auto_2025-06-03 |
rinja-rs/askama | 304 | rinja-rs__askama-304 | [
"285",
"196"
] | cff49453a851029f87b35512f5234a999fea3e6c | diff --git a/askama_shared/src/generator.rs b/askama_shared/src/generator.rs
--- a/askama_shared/src/generator.rs
+++ b/askama_shared/src/generator.rs
@@ -909,7 +909,9 @@ impl<'a, S: std::hash::BuildHasher> Generator<'a, S> {
Expr::StrLit(s) => self.visit_str_lit(buf, s),
Expr::CharLit(s) => s... | diff --git a/askama_shared/src/parser.rs b/askama_shared/src/parser.rs
--- a/askama_shared/src/parser.rs
+++ b/askama_shared/src/parser.rs
@@ -1078,6 +1098,34 @@ mod tests {
super::parse("{{ strvar|e }}", &Syntax::default());
}
+ #[test]
+ fn test_parse_var_call() {
+ assert_eq!(
+ ... | Call methods on root context
Is there a syntax for calling methods implemented directly on the 'context'? A bare `function()` doesn't appear to do the trick
Static method call
Can I use static method in the template?
| I think you can call `self.function()`? Documentation patches welcome. 😊
Can you give a concrete example? Presumably you have tried it?
I tried like so:
`{% let a = crate::a() %}
`
Did you get an error? What was the error? Did you look at the generated code?
The print attribute is "all", but it shows only `message: ... | 2020-03-15T11:07:43Z | 0.9 | 2020-03-18T21:33:57Z | cff49453a851029f87b35512f5234a999fea3e6c | [
"filters::tests::test_capitalize",
"filters::tests::test_center",
"filters::tests::test_filesizeformat",
"filters::json::tests::test_json",
"filters::tests::test_indent",
"filters::tests::test_linebreaks",
"filters::tests::test_linebreaksbr",
"filters::tests::test_join",
"filters::tests::test_lower"... | [] | [] | [] | auto_2025-06-03 |
rinja-rs/askama | 103 | rinja-rs__askama-103 | [
"81"
] | 9d2c6115dc7e4ec2c24ce30581d3bf00f787e441 | diff --git a/askama/src/lib.rs b/askama/src/lib.rs
--- a/askama/src/lib.rs
+++ b/askama/src/lib.rs
@@ -393,7 +393,9 @@ fn visit_dirs(dir: &Path, cb: &Fn(&DirEntry)) -> io::Result<()> {
/// that have templates, to make sure the crate gets rebuilt when template
/// source code changes.
pub fn rerun_if_templates_change... | diff --git a/askama_shared/src/path.rs b/askama_shared/src/path.rs
--- a/askama_shared/src/path.rs
+++ b/askama_shared/src/path.rs
@@ -22,34 +33,75 @@ pub fn get_template_source(tpl_path: &Path) -> String {
}
pub fn find_template_from_path(path: &str, start_at: Option<&Path>) -> PathBuf {
- let root = template_d... | Forced template root dir
> The path is interpreted as relative to the templates dir in the directory where the originating crate's Cargo.toml resides.
Why? This forces me a 1 way structure, that works bad with my project tree. Please add an option to change the root dir, or better to add multiple ones.
| I built it this way because it's simple and fairly easy to use.
Can you explain more about how your project tree is laid out, and how you would like Askama to work in your context?
I use actix FW and have multiple apps attached to server. Each app with it's underlying logic lives in separate Directory, where I also ... | 2018-07-04T17:51:03Z | 0.7 | 2018-07-19T10:08:36Z | 9d2c6115dc7e4ec2c24ce30581d3bf00f787e441 | [
"filters::json::tests::test_json",
"escaping::tests::test_escape",
"filters::tests::test_lower",
"filters::tests::test_linebreaksbr",
"filters::tests::test_trim",
"filters::tests::test_linebreaks",
"filters::tests::test_join",
"filters::tests::test_upper",
"path::tests::find_relative",
"path::test... | [] | [] | [] | auto_2025-06-03 |
rinja-rs/askama | 861 | rinja-rs__askama-861 | [
"860"
] | 43e92aa3b6b9cd967a70bd0fd54d1f087d6ed76b | diff --git a/askama_parser/src/expr.rs b/askama_parser/src/expr.rs
--- a/askama_parser/src/expr.rs
+++ b/askama_parser/src/expr.rs
@@ -248,15 +248,15 @@ impl<'a> Suffix<'a> {
}
fn r#macro(i: &'a str) -> IResult<&'a str, Self> {
- fn nested_parenthesis(i: &str) -> IResult<&str, ()> {
+ fn neste... | diff --git a/askama_parser/src/tests.rs b/askama_parser/src/tests.rs
--- a/askama_parser/src/tests.rs
+++ b/askama_parser/src/tests.rs
@@ -788,3 +788,10 @@ fn test_parse_array() {
)],
);
}
+
+#[test]
+fn fuzzed_unicode_slice() {
+ let d = "{eeuuu{b&{!!&{!!11{{
+ 0!(!1q҄א!)!!!!!!n!";
+ as... | Fuzzing askama_parser results in panic
Hi, fuzzing `askama_parser` resulted in panic at following line.
https://github.com/djc/askama/blob/43e92aa3b6b9cd967a70bd0fd54d1f087d6ed76b/askama_parser/src/expr.rs#L290
I suppose it happens because crash input contains Cyrillic letters which are multi-byte and we need exact b... | 2023-09-11T09:42:00Z | 0.12 | 2023-09-11T10:19:21Z | 4dab5f91ba15e7c238ddf6223ec7b45eef32cab4 | [
"tests::fuzzed_unicode_slice"
] | [
"tests::change_delimiters_parse_filter",
"tests::test_missing_space_after_kw",
"tests::test_invalid_block - should panic",
"tests::test_parse_comments",
"tests::test_associativity",
"tests::test_parse_const",
"tests::test_parse_numbers",
"tests::test_odd_calls",
"tests::test_parse_root_path",
"tes... | [] | [] | auto_2025-06-03 | |
rinja-rs/askama | 837 | rinja-rs__askama-837 | [
"836"
] | 9de9af4a006021a63f705e420be4cdef3eb6af82 | diff --git a/askama_derive/src/generator.rs b/askama_derive/src/generator.rs
--- a/askama_derive/src/generator.rs
+++ b/askama_derive/src/generator.rs
@@ -1373,7 +1373,7 @@ impl<'a> Generator<'a> {
}
Expr::Group(ref inner) => self.visit_group(buf, inner)?,
Expr::Call(ref obj, ref ... | diff --git a/askama_derive/src/parser/tests.rs b/askama_derive/src/parser/tests.rs
--- a/askama_derive/src/parser/tests.rs
+++ b/askama_derive/src/parser/tests.rs
@@ -221,6 +221,51 @@ fn test_parse_root_path() {
);
}
+#[test]
+fn test_rust_macro() {
+ let syntax = Syntax::default();
+ assert_eq!(
+ ... | Parse error when using macro with expanded module path
I am making a crate that allows people to embed icons from Iconify at compile time, but I ran into a little snag.
Tried on main and 0.12. Only happens when using a macro, normal functions work fine.
The intended usage is:
```jsx
<body>
<h1>Hello</h1>
... | Huh, I guess there's some subtlety in the parser relating to the combination of a path, the macro call and the filter. Care to submit a PR?
Sure, I'll take a jab at it.
Macro invocations are parsed specially, but they should actually be simply suffix expressions, and be handled like normal function calls:
https://gi... | 2023-07-05T21:49:42Z | 0.12 | 2023-07-24T09:39:14Z | 4dab5f91ba15e7c238ddf6223ec7b45eef32cab4 | [
"config::tests::find_absolute",
"config::tests::find_relative",
"config::tests::add_syntax",
"config::tests::escape_modes",
"config::tests::add_syntax_two",
"config::tests::find_relative_sub",
"config::tests::get_source",
"config::tests::find_relative_nonexistent - should panic",
"config::tests::ill... | [] | [] | [] | auto_2025-06-03 |
rinja-rs/askama | 789 | rinja-rs__askama-789 | [
"785"
] | c795edfd8de5b77f27ad6c8a25568213dcc09bb6 | diff --git a/askama_derive/src/generator.rs b/askama_derive/src/generator.rs
--- a/askama_derive/src/generator.rs
+++ b/askama_derive/src/generator.rs
@@ -686,6 +686,11 @@ impl<'a> Generator<'a> {
}
if AstLevel::Top == level {
+ // Handle any pending whitespace.
+ if self.next_... | diff --git a/testing/tests/filters.rs b/testing/tests/filters.rs
--- a/testing/tests/filters.rs
+++ b/testing/tests/filters.rs
@@ -44,7 +44,8 @@ fn filter_opt_escaper_none() {
r#"<h1 class="title">Foo Bar</h1>
<h1 class="title">Foo Bar</h1>
<h1 class="title">Foo Bar</h1>
-<h1 class="tit... | Whitespace suppression ignored at start of template
While going deep into a rabbit hole of AST refactoring, I noticed a few test cases that, on their face, do not seem right:
This case uses the global setting `Minimize`:
https://github.com/djc/askama/blob/417cb924ae1f94d54e2eb13ebc7e9fab91b84588/testing/tests/white... | cc @GuillaumeGomez
Let me try to explain how I see the feature is supposed to worked: the feature removes whitespace characters **around** the `{% %}` and other "jinja controllers". The start and end of the template file are not jinja controllers and thus do not enter the "auto whitespace character removal". If you wa... | 2023-03-06T20:52:48Z | 0.12 | 2023-03-09T12:35:31Z | 4dab5f91ba15e7c238ddf6223ec7b45eef32cab4 | [
"filter_opt_escaper_html",
"filter_opt_escaper_none",
"test_minimize_whitespace",
"test_outer_whitespace",
"test_cond_ws",
"test_cond_ws_inverted"
] | [
"filter_fmt",
"filter_escape",
"filter_format",
"into_numbers_fmt",
"test_filter_let_filter",
"test_filter_truncate",
"test_join",
"test_json",
"test_json_attribute",
"test_json_attribute2",
"test_json_script",
"test_my_filter",
"test_nested_filter_ref",
"test_vec_join",
"test_extra_whit... | [] | [] | auto_2025-06-03 |
rinja-rs/askama | 788 | rinja-rs__askama-788 | [
"786"
] | 417cb924ae1f94d54e2eb13ebc7e9fab91b84588 | diff --git a/askama_derive/src/generator.rs b/askama_derive/src/generator.rs
--- a/askama_derive/src/generator.rs
+++ b/askama_derive/src/generator.rs
@@ -630,16 +630,16 @@ impl<'a> Generator<'a> {
self.write_let(buf, ws, var, val)?;
}
Node::Cond(ref conds, ws) => ... | diff --git /dev/null b/testing/templates/size-child-super.txt
new file mode 100644
--- /dev/null
+++ b/testing/templates/size-child-super.txt
@@ -0,0 +1,2 @@
+{% extends "size-parent.txt" %}
+{% block main %}{% call super() %}{% endblock %}
diff --git /dev/null b/testing/templates/size-child.txt
new file mode 100644
--... | Is write_cond trying to return a size_hint?
It looks like `write_cond` is accumulating a contribution to `size_hint`:
https://github.com/djc/askama/blob/417cb924ae1f94d54e2eb13ebc7e9fab91b84588/askama_derive/src/generator.rs#L760
But it seems to be dropped on the floor:
https://github.com/djc/askama/blob/417cb924a... | Same question for `write_match`, `write_loop`, `write_block`, maybe others? I'm starting to think there's more to accumulating the `size_hint` than it looks like at first glance? | 2023-03-06T20:45:26Z | 0.12 | 2023-03-07T09:53:22Z | 4dab5f91ba15e7c238ddf6223ec7b45eef32cab4 | [
"test_block_size_hint",
"test_loop_size_hint",
"test_cond_size_hint",
"test_match_size_hint",
"test_super_size_hint"
] | [] | [] | [] | auto_2025-06-03 |
rinja-rs/askama | 1,003 | rinja-rs__askama-1003 | [
"1002"
] | c6e767cbdf8037b606483b96611d98beff26c40d | diff --git a/askama/Cargo.toml b/askama/Cargo.toml
--- a/askama/Cargo.toml
+++ b/askama/Cargo.toml
@@ -20,10 +20,8 @@ maintenance = { status = "actively-developed" }
default = ["config", "humansize", "num-traits", "urlencode"]
config = ["askama_derive/config"]
humansize = ["askama_derive/humansize", "dep_humansize"]... | diff --git a/askama/src/error.rs b/askama/src/error.rs
--- a/askama/src/error.rs
+++ b/askama/src/error.rs
@@ -79,13 +71,6 @@ impl From<::serde_json::Error> for Error {
}
}
-#[cfg(feature = "serde_yaml")]
-impl From<::serde_yaml::Error> for Error {
- fn from(err: ::serde_yaml::Error) -> Self {
- Error... | Do we need a built-in yaml filter?
I don't really see a compelling use case for a built-in yaml filter. It's a serialization format widely used for input configurations, not for generated web output. The feature was asked for in #192, and it was added in #201.
The package serde_yaml is now marked as [deprecated and ... | I think it's "easy enough" to add your own `yaml` filter if needed. Seems to be out of scope of `askama`.
That's fair -- let's kill it.
Sending a PR to remove it then. :3 | 2024-04-06T20:38:40Z | 0.13 | 2024-07-10T15:12:14Z | 53b4b518f9a230665029560df038c318b2e55458 | [
"filters::json::tests::test_json",
"filters::tests::test_center",
"filters::tests::test_abs",
"filters::tests::test_capitalize",
"filters::tests::test_indent",
"filters::tests::test_filesizeformat",
"filters::tests::test_into_f64",
"filters::tests::test_into_isize",
"filters::tests::test_join",
"f... | [] | [] | [] | auto_2025-06-03 |
rinja-rs/askama | 965 | rinja-rs__askama-965 | [
"962",
"961"
] | 4dab5f91ba15e7c238ddf6223ec7b45eef32cab4 | diff --git a/askama/Cargo.toml b/askama/Cargo.toml
--- a/askama/Cargo.toml
+++ b/askama/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "askama"
-version = "0.12.1"
+version = "0.13.0"
description = "Type-safe, compiled Jinja-like templates for Rust"
documentation = "https://docs.rs/askama"
keywords = ["markup", "temp... | diff --git a/askama_derive/src/config.rs b/askama_derive/src/config.rs
--- a/askama_derive/src/config.rs
+++ b/askama_derive/src/config.rs
@@ -299,9 +299,9 @@ pub(crate) fn get_template_source(tpl_path: &Path) -> std::result::Result<String
static CONFIG_FILE_NAME: &str = "askama.toml";
static DEFAULT_SYNTAX_NAME: &st... | Remove the need to import askama itself when using integration crates
While wording on https://github.com/djc/askama/issues/961, I wandered off to find the cause for the need as the title goes. A rough scan reveals that askama_derive generates some uses of `::askama::`, for example, this:
https://github.com/djc/aska... | Well, I wouldn't want to do this in a way that requires adding another intermediate allocation, but perhaps a newtype with a `Display` implementation could do the job. I'd be open to reviewing such a PR.
How about checking for existence of `::askama::`, and if so, splitting the `&str` into head, prefix and tail, then 1... | 2024-02-13T14:31:39Z | 0.12 | 2024-03-05T10:34:46Z | 4dab5f91ba15e7c238ddf6223ec7b45eef32cab4 | [
"config::tests::find_absolute",
"config::tests::find_relative",
"config::tests::find_relative_sub",
"config::tests::add_syntax",
"config::tests::add_syntax_two",
"config::tests::get_source",
"config::tests::find_relative_nonexistent - should panic",
"config::tests::test_config_whitespace_error",
"co... | [] | [] | [] | auto_2025-06-03 |
rinja-rs/askama | 951 | rinja-rs__askama-951 | [
"924"
] | 29b25505b496510217a39606a5f72884867ef492 | diff --git a/askama_parser/src/lib.rs b/askama_parser/src/lib.rs
--- a/askama_parser/src/lib.rs
+++ b/askama_parser/src/lib.rs
@@ -349,9 +349,9 @@ fn path_or_identifier(i: &str) -> ParseResult<'_, PathOrIdentifier<'_>> {
let rest = rest.as_deref().unwrap_or_default();
// The returned identifier can be assum... | diff --git a/testing/tests/simple.rs b/testing/tests/simple.rs
--- a/testing/tests/simple.rs
+++ b/testing/tests/simple.rs
@@ -484,3 +484,23 @@ fn test_num_literals() {
"[90, -90, 90, 2, 56, 240, 10.5, 10.5, 100000000000, 105000000000]",
);
}
+
+#[allow(non_snake_case)]
+#[derive(askama::Template)]
+#[te... | 0.12.1 only allow lower-case variable name in template
I don't know if I asked a stupid question, but I spend one day to find it ! my rust version is 1.74.0, I run it on my win11 and WSL ubuntu 22.04, see the same error below
```rust
use askama::Template;
#[derive(Template)]
#[template(path = "hello.html")]
str... | I'm new to axum, I have learn the docs https://djc.github.io/askama/askama.html, but it seems not have the request of lower case
I suggest you get the macro expansion via Rust Analyzer or via the [debugging](https://djc.github.io/askama/debugging.html) features. I guess the code generator applies some heuristics that t... | 2024-01-18T09:50:05Z | 0.12 | 2024-01-18T10:23:22Z | 4dab5f91ba15e7c238ddf6223ec7b45eef32cab4 | [
"test_attr",
"test_comment",
"test_composition",
"test_constants",
"test_define_string_var",
"test_else",
"test_else_if",
"test_empty",
"test_escape",
"test_func_ref_call",
"test_generics",
"test_if",
"test_literals",
"test_index",
"test_literals_escape",
"test_minus",
"test_negation... | [] | [] | [] | auto_2025-06-03 |
rinja-rs/askama | 943 | rinja-rs__askama-943 | [
"330"
] | 84c2094e871b7ef16ab51c77b4a3568794c75638 | diff --git a/askama_derive/src/generator.rs b/askama_derive/src/generator.rs
--- a/askama_derive/src/generator.rs
+++ b/askama_derive/src/generator.rs
@@ -1210,6 +1210,20 @@ impl<'a> Generator<'a> {
Ok(DisplayWrap::Wrapped)
}
+ fn _visit_as_ref_filter(
+ &mut self,
+ buf: &mut Buffer,
+... | diff --git a/testing/tests/filters.rs b/testing/tests/filters.rs
--- a/testing/tests/filters.rs
+++ b/testing/tests/filters.rs
@@ -309,3 +309,17 @@ fn test_json_script() {
r#"<script>var user = "\u003c/script\u003e\u003cbutton\u003eHacked!\u003c/button\u003e"</script>"#
);
}
+
+#[derive(askama::Template)... | Add support for reference operator (i.e. `{% let x = &y %}`)
Sometimes while working with deeply nested structures, it would be useful to create an alias to a field, like say `{% let h = &parent.child.hash %}`
At the moment the `&` unary operator is not supported.
| Not supporting this has been a design goal from the start. If I remember correctly, your example should already work without `&`.
> If I remember correctly, your example should already work without `&`.
Unfortunately it doesn't (`hash` here is an owned `HashMap`, and all other structures are owned by `self`):
~~~~
... | 2024-01-10T14:11:35Z | 0.12 | 2024-01-12T10:10:23Z | 4dab5f91ba15e7c238ddf6223ec7b45eef32cab4 | [
"filter_escape",
"filter_format",
"filter_fmt",
"filter_opt_escaper_html",
"filter_opt_escaper_none",
"into_numbers_fmt",
"test_filter_let_filter",
"test_filter_truncate",
"test_join",
"test_json",
"test_json_attribute",
"test_json_attribute2",
"test_json_script",
"test_my_filter",
"test... | [] | [] | [] | auto_2025-06-03 |
rinja-rs/askama | 911 | rinja-rs__askama-911 | [
"904"
] | 6cbfde04514a90d4e24350c21ef490c40666d820 | diff --git a/askama_derive/src/generator.rs b/askama_derive/src/generator.rs
--- a/askama_derive/src/generator.rs
+++ b/askama_derive/src/generator.rs
@@ -1575,6 +1575,16 @@ impl<'a> Generator<'a> {
}
buf.write(name);
}
+ Target::OrChain(targets) => match target... | diff --git /dev/null b/testing/templates/match-enum-or.html
new file mode 100644
--- /dev/null
+++ b/testing/templates/match-enum-or.html
@@ -0,0 +1,8 @@
+The card is
+{%- match suit %}
+ {%- when Suit::Clubs or Suit::Spades -%}
+ {{ " black" }}
+ {%- when Suit::Diamonds or Suit::Hearts -%}
+ {{ " red" }}
+... | Feature request: enhance match to include multiple targets
This has previously been discussed at https://github.com/djc/askama/issues/711#issuecomment-1794340598 but I would like to move it to its own issue as it can be implemented separately.
The request is to enhance Askana's syntax for the `match` block (see http... | I'm happy to review a PR for this as proposed. | 2023-11-19T18:50:18Z | 0.12 | 2023-11-22T13:56:14Z | 4dab5f91ba15e7c238ddf6223ec7b45eef32cab4 | [
"test_match_custom_enum",
"test_match_literal_char",
"test_match_literal",
"test_match_literal_num",
"test_match_no_whitespace",
"test_match_option",
"test_match_option_bool",
"test_match_option_result_option",
"test_match_ref_deref",
"test_match_without_with_keyword",
"test_match_with_comment"
... | [] | [] | [] | auto_2025-06-03 |
rinja-rs/askama | 910 | rinja-rs__askama-910 | [
"885"
] | 80238d7f48fd86ef939e74df9fdc9678ee78a208 | diff --git a/askama_derive/src/generator.rs b/askama_derive/src/generator.rs
--- a/askama_derive/src/generator.rs
+++ b/askama_derive/src/generator.rs
@@ -727,7 +727,50 @@ impl<'a> Generator<'a> {
args.len()
)));
}
- for (expr, arg) in std::iter::zip(args, &def.args) {
+ ... | diff --git a/testing/tests/macro.rs b/testing/tests/macro.rs
--- a/testing/tests/macro.rs
+++ b/testing/tests/macro.rs
@@ -95,3 +95,31 @@ fn test_macro_self_arg() {
let t = MacroSelfArgTemplate { s: "foo" };
assert_eq!(t.render().unwrap(), "foo");
}
+
+#[derive(Template)]
+#[template(
+ source = "{%- macr... | Allow to have named arguments in macro
It'd pretty nice to be able to have named arguments. For example:
```
{% macro menu_link(href, text, target) %}
...
{% endmacro menu_link %}
```
Then to be able to call it like this:
```
{% menu_link(href="/something", text="link", target="_blank") %}
```
It make... | I worry that this would be a little foreign to users -- that is, I'm not sure it passes the design test of "it should be obvious how this gets compiled to Rust code".
Does it really matter? If this is a big enough concern, we can add a new entry in the askama book explaining how it is generated.
It matters to me -- I t... | 2023-11-17T13:50:00Z | 0.12 | 2023-11-28T10:54:25Z | 4dab5f91ba15e7c238ddf6223ec7b45eef32cab4 | [
"test_one_func",
"test_one_func_binop",
"test_one_func_self",
"test_one_func_index",
"test_coerce",
"test_path_ext_html",
"test_path_ext_html_and_ext_txt",
"test_path_ext_html_jinja",
"test_path_ext_html_jinja_and_ext_txt",
"test_path_ext_jinja",
"test_path_ext_jinja_and_ext_txt",
"filter_esca... | [] | [] | [] | auto_2025-06-03 |
rinja-rs/askama | 401 | rinja-rs__askama-401 | [
"333",
"221",
"107"
] | 5057b75e7752f2186157fb3e1f5e5d2d0c5ff880 | diff --git a/askama_shared/src/generator.rs b/askama_shared/src/generator.rs
--- a/askama_shared/src/generator.rs
+++ b/askama_shared/src/generator.rs
@@ -667,8 +667,26 @@ impl<'a, S: std::hash::BuildHasher> Generator<'a, S> {
", _loop_item) in ::askama::helpers::TemplateLoop::new({}) {{",
... | diff --git a/testing/tests/loops.rs b/testing/tests/loops.rs
--- a/testing/tests/loops.rs
+++ b/testing/tests/loops.rs
@@ -67,3 +67,39 @@ fn test_for_range() {
"foo (first)\nfoo (last)\nbar\nbar\nfoo\nbar\nbar\n"
);
}
+
+#[derive(Template)]
+#[template(source = "{% for i in [1, 2, 3] %}{{ i }}{% endfor %... | for-loop on values of a BTreeMap inside a template does not compile
Hi Askama team,
I'm hitting the an issue with for-loops inside template on `(some BTreeMap).values()`.
## Preliminary: what DOES work
Consider first the following piece of code, which works, demonstrating that the `values()` function of `BTreeMa... | Allocating a `Vec` just to appease `djc/askama` seems unfortunate. I wonder whether adding something like the `&`-syntax could improve things:
```
{% for &foo in map.values() %}
```
I encountered the same issue trying to iterate over a `BTreeMap` using `.rev()`:
```jinja
{% for (date, day_videos) in videos.video... | 2020-12-15T06:21:33Z | 0.10 | 2021-02-18T12:18:18Z | 49252d2457f280026c020d0df46733578eb959a5 | [
"test_for",
"test_for_range",
"test_precedence_for",
"test_nested_for"
] | [] | [] | [] | auto_2025-06-03 |
rinja-rs/askama | 399 | rinja-rs__askama-399 | [
"397",
"397"
] | 5b01e605914a49f0b9e71e7dbe7c17ef1de2c522 | diff --git a/askama_shared/src/generator.rs b/askama_shared/src/generator.rs
--- a/askama_shared/src/generator.rs
+++ b/askama_shared/src/generator.rs
@@ -444,8 +444,8 @@ impl<'a, S: std::hash::BuildHasher> Generator<'a, S> {
Node::Cond(ref conds, ws) => {
self.write_cond(ctx, buf,... | diff --git a/testing/tests/gen_ws_tests.py b/testing/tests/gen_ws_tests.py
--- a/testing/tests/gen_ws_tests.py
+++ b/testing/tests/gen_ws_tests.py
@@ -4,12 +4,23 @@
from itertools import product, chain, zip_longest, tee
+# The amount of branches to generate
+BRANCHES = 2 # branches
+
IF, ELSE_IF, ELSE, END_IF = 0... | Unwanted whitespace in match arm
For a Template struct containing a field `ver: Option<&'a str>` and the following template:
```jinja2
{% let suffix -%}
{% match ver -%}
{% when Some with (ver) -%}
{% let suffix = format!("-{}", ver) -%}
{% when None -%}
{% let suffix = String::new() -%}
{% endmat... | I'm wondering where the whitespace between the `match` and the first `when` should go. Whether it should go into the first match arm or before the match expression (thus "into" all match arms). The whitespace before `endmatch` is self-explanatory.
In short:
```jinja
{% match ... %}[this whitespace]{% when ... %}... | 2020-12-12T16:51:50Z | 0.10 | 2020-12-13T22:08:20Z | 49252d2457f280026c020d0df46733578eb959a5 | [
"test_match_custom_enum",
"test_match_literal_char",
"test_match_literal",
"test_match_literal_num",
"test_match_option",
"test_match_ref_deref",
"test_extra_whitespace",
"test_match_ws"
] | [
"test_match_no_whitespace",
"test_cond_ws"
] | [] | [] | auto_2025-06-03 |
rinja-rs/askama | 394 | rinja-rs__askama-394 | [
"377",
"378"
] | 810d5ad5067085cc5e4be19903b5804b1ff13430 | diff --git a/askama_shared/src/generator.rs b/askama_shared/src/generator.rs
--- a/askama_shared/src/generator.rs
+++ b/askama_shared/src/generator.rs
@@ -505,8 +505,9 @@ impl<'a, S: std::hash::BuildHasher> Generator<'a, S> {
let mut has_else = false;
for (i, &(cws, ref cond, ref nodes)) in conds.iter... | diff --git /dev/null b/testing/tests/gen_ws_tests.py
new file mode 100644
--- /dev/null
+++ b/testing/tests/gen_ws_tests.py
@@ -0,0 +1,112 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+from itertools import product, chain, zip_longest, tee
+
+
+IF, ELSE_IF, ELSE, END_IF = 0, 1, 2, 3
+
+NL = "\\n"
+dash = lambda... | Whitespace issue with if conditions
Askama seems to be including whitespace from inside an if condition even when the condition is not fulfilled. Here is my template file:
```jinja
{%- if some_condition -%}
# WARNING
{% endif -%}
# FILE START
```
What I expected is:
- When `some_condition` is `true`:
... | It sure sounds like a bug! Let me look at some code.
So the code generation for if statements is here:
https://github.com/djc/askama/blob/main/askama_shared/src/generator.rs#L502
I don't immediately see anything obviously wrong. Maybe you can contribute a test case and/or use the debugging facility (add `print = ... | 2020-12-03T18:13:39Z | 0.10 | 2020-12-03T21:14:33Z | 49252d2457f280026c020d0df46733578eb959a5 | [
"test_cond_ws"
] | [] | [] | [] | auto_2025-06-03 |
rinja-rs/askama | 393 | rinja-rs__askama-393 | [
"331",
"331"
] | a199defeca2dfc6aa3e972acca82c96db07f99e9 | diff --git a/askama_shared/src/parser.rs b/askama_shared/src/parser.rs
--- a/askama_shared/src/parser.rs
+++ b/askama_shared/src/parser.rs
@@ -1,7 +1,7 @@
use nom::branch::alt;
use nom::bytes::complete::{escaped, is_not, tag, take_until};
use nom::character::complete::{anychar, char, digit1};
-use nom::combinator::{... | diff --git a/askama_shared/src/parser.rs b/askama_shared/src/parser.rs
--- a/askama_shared/src/parser.rs
+++ b/askama_shared/src/parser.rs
@@ -1136,6 +1138,25 @@ mod tests {
);
}
+ #[test]
+ fn test_parse_root_path() {
+ let syntax = Syntax::default();
+ assert_eq!(
+ supe... | Allow paths to start with `::`
[Discovered while working on #315 and #327.]
At the moment `{{ std::string::String::new()}}` works but `{{ ::std::string::String::new() }}` doesn't.
Allow paths to start with `::`
[Discovered while working on #315 and #327.]
At the moment `{{ std::string::String::new()}}` works bu... | Alright, that should be fixed.
Alright, that should be fixed. | 2020-12-02T18:03:44Z | 0.10 | 2020-12-02T19:48:44Z | 49252d2457f280026c020d0df46733578eb959a5 | [
"parser::tests::test_parse_root_path",
"test_attr",
"test_composition",
"test_comment",
"test_define_string_var",
"test_else",
"test_else_if",
"test_empty",
"test_escape",
"test_func_ref_call",
"test_generics",
"test_if",
"test_literals_escape",
"test_index",
"test_literals",
"test_nes... | [
"filters::tests::test_abs",
"filters::json::tests::test_json",
"filters::tests::test_capitalize",
"filters::tests::test_center",
"filters::tests::test_filesizeformat",
"filters::tests::test_into_f64",
"filters::tests::test_into_isize",
"filters::tests::test_indent",
"filters::tests::test_join",
"f... | [] | [] | auto_2025-06-03 |
rinja-rs/askama | 391 | rinja-rs__askama-391 | [
"381"
] | f4065b09b91f5d00efa5644915cdd83bfb7d393a | diff --git a/askama_shared/src/parser.rs b/askama_shared/src/parser.rs
--- a/askama_shared/src/parser.rs
+++ b/askama_shared/src/parser.rs
@@ -573,36 +573,32 @@ fn expr_rust_macro(i: &[u8]) -> IResult<&[u8], Expr> {
macro_rules! expr_prec_layer {
( $name:ident, $inner:ident, $op:expr ) => {
fn $name(i: &... | diff --git a/askama_shared/src/parser.rs b/askama_shared/src/parser.rs
--- a/askama_shared/src/parser.rs
+++ b/askama_shared/src/parser.rs
@@ -1078,12 +1074,13 @@ pub fn parse<'a>(src: &'a str, syntax: &'a Syntax<'a>) -> Result<Vec<Node<'a>>,
#[cfg(test)]
mod tests {
+ use super::{Expr, Node, WS};
use crate... | The operator parser gets precedences wrong
Consider the expression `a + b == c`. If we changed the code generated from `{lhs} {op} {rhs}` to include parentheses around the entire thing, we get `(a + (b == c))`, which is incorrect, because _(i)_ the `+` and `==` operators combined are not associative (and I think that's... | So precedence is handled here:
https://github.com/djc/askama/blob/main/askama_shared/src/parser.rs#L610
I forgot how I wrote this code in the first place, but I'm guessing the associativity aspect is not handled correctly. | 2020-12-01T08:40:04Z | 0.10 | 2020-12-01T09:04:25Z | 49252d2457f280026c020d0df46733578eb959a5 | [
"parser::tests::test_associativity",
"parser::tests::test_precedence"
] | [
"filters::tests::test_abs",
"filters::tests::test_capitalize",
"filters::tests::test_center",
"filters::json::tests::test_json",
"filters::tests::test_filesizeformat",
"filters::tests::test_into_f64",
"filters::tests::test_into_isize",
"filters::tests::test_indent",
"filters::tests::test_linebreaks"... | [] | [] | auto_2025-06-03 |
rinja-rs/askama | 374 | rinja-rs__askama-374 | [
"368"
] | ac7d9e8031b4df489a0d58dc3459bc931f1ff870 | diff --git a/askama_derive/Cargo.toml b/askama_derive/Cargo.toml
--- a/askama_derive/Cargo.toml
+++ b/askama_derive/Cargo.toml
@@ -25,5 +25,4 @@ warp = []
[dependencies]
askama_shared = { version = "0.10.4", path = "../askama_shared", default-features = false }
proc-macro2 = "1"
-quote = "1"
syn = "1"
diff --git a/... | diff --git a/testing/Cargo.toml b/testing/Cargo.toml
--- a/testing/Cargo.toml
+++ b/testing/Cargo.toml
@@ -15,6 +15,7 @@ serde_json = { version = "1.0", optional = true }
[dev-dependencies]
criterion = "0.3"
+trybuild = "1.0"
[[bench]]
name = "all"
diff --git /dev/null b/testing/tests/ui.rs
new file mode 100644... | Consider using `compile_error!` instead of panicking
I just tried out askama for the first time and my IDE (using rust-analyzer) reported that my code failed to compile because `proc-macro derive panicked`. This error message is not very helpful as I had to go to the command line and ask cargo what the real problem was... | The simple approach using what syn provides is not enough because many of the potential panics originate from the template parser, which doesn't process Rust code as such. Still, it would surely be nice to use something better than `panic!()`, it just hasn't been much of a priority for me. In the same space, I've also ... | 2020-11-02T15:50:35Z | 0.10 | 2020-11-04T00:28:09Z | 49252d2457f280026c020d0df46733578eb959a5 | [
"ui"
] | [
"filter_escape",
"filter_fmt",
"filter_format",
"into_numbers_fmt",
"test_filter_let_filter",
"test_filter_truncate",
"test_join",
"test_nested_filter_ref",
"test_my_filter",
"test_vec_join",
"main",
"test_include",
"test_deep",
"test_different_module",
"test_empty_child",
"test_let_bl... | [] | [] | auto_2025-06-03 |
rinja-rs/askama | 500 | rinja-rs__askama-500 | [
"494"
] | 49252d2457f280026c020d0df46733578eb959a5 | diff --git a/askama_shared/src/generator.rs b/askama_shared/src/generator.rs
--- a/askama_shared/src/generator.rs
+++ b/askama_shared/src/generator.rs
@@ -658,6 +658,12 @@ impl<'a, S: std::hash::BuildHasher> Generator<'a, S> {
", _loop_item) in ::askama::helpers::TemplateLoop::new(((&{}).into_iter())) ... | diff --git a/testing/tests/loops.rs b/testing/tests/loops.rs
--- a/testing/tests/loops.rs
+++ b/testing/tests/loops.rs
@@ -1,3 +1,5 @@
+use std::ops::Range;
+
use askama::Template;
#[derive(Template)]
diff --git a/testing/tests/loops.rs b/testing/tests/loops.rs
--- a/testing/tests/loops.rs
+++ b/testing/tests/loops... | move occurs because `item1.list2` has type `Vec<Box<dyn MyTrait + Send>>`, which does not implement the `Copy` trait
I got this error with `main` but not with `0.10.5`.
```
error[E0507]: cannot move out of `item1.list2` which is behind a shared reference
--> src/main.rs:3:10
|
3 | #[derive(Template)]
| ... | As a workaround, it should work if you change `item1.list2` to `item1.list2.iter()`. However, I'll look into why that fails, as right now I don't recall the reason why it _would_ fail.
@vallentin would be great if you can look into this, thanks!
@djc I will. I've just been a bit busy the past week and this week, but ... | 2021-06-23T16:29:30Z | 0.10 | 2021-06-23T19:41:31Z | 49252d2457f280026c020d0df46733578eb959a5 | [
"test_for",
"test_for_array",
"test_for_method_call",
"test_for_index",
"test_for_range",
"test_for_path_call",
"test_for_zip_ranges",
"test_nested_for",
"test_precedence_for"
] | [] | [] | [] | auto_2025-06-03 |
rinja-rs/askama | 499 | rinja-rs__askama-499 | [
"498"
] | b318d7cbcded2c6dfc66bbe19687f1246a9a9eab | diff --git a/askama_shared/src/generator.rs b/askama_shared/src/generator.rs
--- a/askama_shared/src/generator.rs
+++ b/askama_shared/src/generator.rs
@@ -717,6 +717,7 @@ impl<'a, S: std::hash::BuildHasher> Generator<'a, S> {
let mut names = Buffer::new(0);
let mut values = Buffer::new(0);
+ ... | diff --git /dev/null b/testing/templates/nested-macro-args.html
new file mode 100644
--- /dev/null
+++ b/testing/templates/nested-macro-args.html
@@ -0,0 +1,9 @@
+{%- macro outer(first) -%}
+{%- call inner(first, "second") -%}
+{%- endmacro -%}
+
+{%- macro inner(first, second) -%}
+{{ first }} {{ second }}
+{%- endmac... | Error "proc-macro derive produced unparseable tokens" with nested macro call
I was working on updating [UniFFI](https://github.com/mozilla/uniffi-rs/) to the latest `main` branch of Askama, and ran into a case where the `#[derive(Template)]` seems to generate invalid code. Below is a reduced example:
```
use askama... | 2021-06-21T06:39:19Z | 0.10 | 2021-06-22T09:41:51Z | 49252d2457f280026c020d0df46733578eb959a5 | [
"test_deep_import",
"test_nested",
"test_macro",
"test_import",
"test_short_circuit"
] | [] | [] | [] | auto_2025-06-03 | |
rinja-rs/askama | 486 | rinja-rs__askama-486 | [
"245"
] | 92df4d1fe49e8fde5ca13f13b8236102bc16b969 | diff --git a/askama_escape/src/lib.rs b/askama_escape/src/lib.rs
--- a/askama_escape/src/lib.rs
+++ b/askama_escape/src/lib.rs
@@ -129,7 +129,6 @@ impl Escaper for Html {
b'&' => escaping_body!(start, i, fmt, bytes, "&"),
b'"' => escaping_body!(start, i, fmt, bytes, ""... | diff --git a/testing/tests/filters.rs b/testing/tests/filters.rs
--- a/testing/tests/filters.rs
+++ b/testing/tests/filters.rs
@@ -21,7 +21,7 @@ fn filter_escape() {
};
assert_eq!(
s.render().unwrap(),
- "// my <html> is "unsafe" & \
+ "// my <html> i... | askama_escape Why escape slashes?
Sorry, I just don't seem to understand what harm slashes can do in html.
[Why does it escape slashes?](https://github.com/djc/askama/blob/467f4ade19fa34983de7e6f6d81c6b4d5ff140fe/askama_escape/src/lib.rs#L134)
| Because the OWASP recommends doing so.
https://security.stackexchange.com/questions/49852/why-should-xss-filters-escape-forward-slash
[OWASP Cross Site Scripting Prevention Cheat Sheet](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Cross_Site_Scripting_Prevention_Cheat_Sheet.md#rule-1---html-esc... | 2021-05-16T20:39:00Z | 0.10 | 2021-05-17T19:33:59Z | 49252d2457f280026c020d0df46733578eb959a5 | [
"filter_escape"
] | [
"filter_format",
"filter_fmt",
"into_numbers_fmt",
"test_filter_let_filter",
"test_filter_truncate",
"test_join",
"test_my_filter",
"test_nested_filter_ref",
"test_vec_join",
"test_attr",
"test_comment",
"test_composition",
"test_constants",
"test_define_string_var",
"test_else",
"test... | [] | [] | auto_2025-06-03 |
rinja-rs/askama | 458 | rinja-rs__askama-458 | [
"457",
"457"
] | 96a4328d642191e4925a8f822c9d2cf311f2f9ec | diff --git a/askama_shared/src/generator.rs b/askama_shared/src/generator.rs
--- a/askama_shared/src/generator.rs
+++ b/askama_shared/src/generator.rs
@@ -156,10 +156,7 @@ impl<'a, S: std::hash::BuildHasher> Generator<'a, S> {
buf.writeln("}")?;
buf.writeln("fn extension(&self) -> Option<&'static st... | diff --git a/askama_shared/src/input.rs b/askama_shared/src/input.rs
--- a/askama_shared/src/input.rs
+++ b/askama_shared/src/input.rs
@@ -227,3 +242,51 @@ impl FromStr for Print {
})
}
}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+
+ #[test]
+ fn test_ext() {
+ assert_eq!(extension(Pat... | Proper file extension for templates for plugin integration?
First of all, let me congratulate you for your work. I'm developing an application with Askama and Rocket, and I'm very happy with the results. However, I recently hit an interesting bump. This was using VS Code as my development environment:
- As the templ... | 2021-03-09T05:45:50Z | 0.10 | 2021-03-10T12:09:59Z | 49252d2457f280026c020d0df46733578eb959a5 | [
"filters::tests::test_abs",
"filters::json::tests::test_json",
"filters::tests::test_capitalize",
"filters::tests::test_filesizeformat",
"filters::tests::test_center",
"filters::tests::test_indent",
"filters::tests::test_into_f64",
"filters::tests::test_into_isize",
"filters::tests::test_linebreaks"... | [] | [] | [] | auto_2025-06-03 | |
rinja-rs/askama | 436 | rinja-rs__askama-436 | [
"435"
] | 000aff4a18c90a5074afd1af5587ff94e915e7d1 | diff --git a/askama_escape/src/lib.rs b/askama_escape/src/lib.rs
--- a/askama_escape/src/lib.rs
+++ b/askama_escape/src/lib.rs
@@ -88,7 +93,7 @@ where
escaper: E,
}
-impl<'a, E> ::std::fmt::Display for Escaped<'a, E>
+impl<'a, E> Display for Escaped<'a, E>
where
E: Escaper,
{
| diff --git a/askama_escape/src/lib.rs b/askama_escape/src/lib.rs
--- a/askama_escape/src/lib.rs
+++ b/askama_escape/src/lib.rs
@@ -1,5 +1,10 @@
-use std::fmt::{self, Display, Formatter, Write};
-use std::str;
+#![no_std]
+
+#[cfg(test)]
+extern crate std;
+
+use core::fmt::{self, Display, Formatter, Write};
+use core::... | no-std support for askama_escape
Just taking a glance through the code, nothing that required `std` popped out to me, if you're happy to make this crate no-std compatible I can prepare a PR for it?
| 2021-01-15T22:04:25Z | 0.10 | 2021-01-15T22:35:34Z | 49252d2457f280026c020d0df46733578eb959a5 | [
"tests::test_escape"
] | [] | [] | [] | auto_2025-06-03 | |
rinja-rs/askama | 433 | rinja-rs__askama-433 | [
"432",
"291"
] | 560d219c269bbf291a4f78e8ef3ffeb0d02ffdef | diff --git a/askama_shared/src/generator.rs b/askama_shared/src/generator.rs
--- a/askama_shared/src/generator.rs
+++ b/askama_shared/src/generator.rs
@@ -1721,8 +1721,11 @@ impl MapChain<'_, &str, LocalMeta> {
}
fn resolve_or_self(&self, name: &str) -> String {
- self.resolve(name)
- .unw... | diff --git a/testing/tests/simple.rs b/testing/tests/simple.rs
--- a/testing/tests/simple.rs
+++ b/testing/tests/simple.rs
@@ -72,6 +72,36 @@ fn test_variables_no_escape() {
);
}
+#[derive(Template)]
+#[template(
+ source = "{{ foo }} {{ foo_bar }} {{ FOO }} {{ FOO_BAR }} {{ self::FOO }} {{ self::FOO_BAR }} ... | Updated book to include urlencode and urlencode_strict
Forgot to include these in #429.
Question: passing a const, not as a field.
I'm trying to reference a constant in my template, since I reuse it all over the place (including across templates) and it'd be a pain to have to update it everywhere it needs to change. ... |
As a workaround, try referencing it through a path, for example, from the crate root?
Askama tries not to use its knowledge of the context fields, and instead keeps track of local variables, such that everything non-local is treated as a context field. Maybe this can be improved, although I think there were some bene... | 2021-01-11T18:51:24Z | 0.10 | 2021-01-13T07:58:54Z | 49252d2457f280026c020d0df46733578eb959a5 | [
"test_attr",
"test_comment",
"test_composition",
"test_define_string_var",
"test_else",
"test_else_if",
"test_empty",
"test_escape",
"test_func_ref_call",
"test_generics",
"test_if",
"test_index",
"test_literals",
"test_minus",
"test_literals_escape",
"test_nested_attr",
"test_negati... | [] | [] | [] | auto_2025-06-03 |
rinja-rs/askama | 426 | rinja-rs__askama-426 | [
"424",
"424"
] | c29ecd68714bddf5e27a9e347c902faa23b2a545 | diff --git a/askama_shared/src/parser.rs b/askama_shared/src/parser.rs
--- a/askama_shared/src/parser.rs
+++ b/askama_shared/src/parser.rs
@@ -539,7 +539,7 @@ fn filter(i: &[u8]) -> IResult<&[u8], (&str, Option<Vec<Expr>>)> {
}
fn expr_filtered(i: &[u8]) -> IResult<&[u8], Expr> {
- let (i, (obj, filters)) = tupl... | diff --git a/askama_shared/src/parser.rs b/askama_shared/src/parser.rs
--- a/askama_shared/src/parser.rs
+++ b/askama_shared/src/parser.rs
@@ -1126,7 +1126,41 @@ mod tests {
#[test]
fn test_parse_filter() {
- super::parse("{{ strvar|e }}", &Syntax::default()).unwrap();
+ use Expr::*;
+ ... | Filters have precedence over unary operators
Performing e.g. `{{ -2|abs }}` is parsed as `{{ -(2|abs) }}` resulting in `-2` being rendered.
Filters have precedence over unary operators
Performing e.g. `{{ -2|abs }}` is parsed as `{{ -(2|abs) }}` resulting in `-2` being rendered.
| Oops -- we should fix that!
Oops -- we should fix that! | 2021-01-05T14:44:35Z | 0.10 | 2021-01-05T15:15:20Z | 49252d2457f280026c020d0df46733578eb959a5 | [
"parser::tests::test_parse_filter"
] | [
"filters::tests::test_abs",
"filters::tests::test_center",
"filters::json::tests::test_json",
"filters::tests::test_capitalize",
"filters::tests::test_filesizeformat",
"filters::tests::test_indent",
"filters::tests::test_into_isize",
"filters::tests::test_into_f64",
"filters::tests::test_lower",
"... | [] | [] | auto_2025-06-03 |
rinja-rs/askama | 423 | rinja-rs__askama-423 | [
"404",
"404"
] | c29ecd68714bddf5e27a9e347c902faa23b2a545 | diff --git a/askama_shared/src/filters/json.rs b/askama_shared/src/filters/json.rs
--- a/askama_shared/src/filters/json.rs
+++ b/askama_shared/src/filters/json.rs
@@ -8,8 +8,8 @@ use serde::Serialize;
///
/// This will panic if `S`'s implementation of `Serialize` decides to fail,
/// or if `T` contains a map with no... | diff --git a/askama_shared/src/filters/json.rs b/askama_shared/src/filters/json.rs
--- a/askama_shared/src/filters/json.rs
+++ b/askama_shared/src/filters/json.rs
@@ -22,6 +22,8 @@ mod tests {
#[test]
fn test_json() {
+ assert_eq!(json(Html, true).unwrap().to_string(), "true");
+ assert_eq!(js... | Version 0.10 places Copy value literals behind a reference where 0.9 did not
I have a large collection of templates that compiles perfectly fine with version 0.9 of askama, but when I try to upgrade to 0.10, I get a bunch of type errors because a bunch of `Copy` types that were previously passed as values now get place... | Sorry for breaking your templates! Are these types being passed to macros, or to custom filters? Can you give an example?
We have some things in the works that will hopefully fix this.
Just off the top of my head, boolean literals, i.e. `true` and `false` are both passed to functions as `&true` and `&false`, and sim... | 2021-01-02T22:39:30Z | 0.10 | 2021-01-05T15:17:19Z | 49252d2457f280026c020d0df46733578eb959a5 | [
"filters::tests::test_abs",
"filters::tests::test_center",
"filters::tests::test_capitalize",
"filters::json::tests::test_json",
"filters::tests::test_into_isize",
"filters::tests::test_into_f64",
"filters::tests::test_indent",
"filters::tests::test_filesizeformat",
"filters::tests::test_linebreaks"... | [] | [] | [] | auto_2025-06-03 |
rinja-rs/askama | 411 | rinja-rs__askama-411 | [
"329",
"329"
] | c7697cbd406dce0962618e99a6b78116b14fdb1c | diff --git a/askama_shared/src/generator.rs b/askama_shared/src/generator.rs
--- a/askama_shared/src/generator.rs
+++ b/askama_shared/src/generator.rs
@@ -876,16 +876,34 @@ impl<'a, S: std::hash::BuildHasher> Generator<'a, S> {
match *var {
Target::Name(name) => {
- if !self.local... | diff --git /dev/null b/testing/templates/let-shadow.html
new file mode 100644
--- /dev/null
+++ b/testing/templates/let-shadow.html
@@ -0,0 +1,22 @@
+{%- let a = 1 -%}
+{%- let b -%}
+
+{%- if cond -%}
+ {%- let b = 22 -%}
+ {{ b }}-
+
+ {%- let b = 33 -%}
+ {{ a }}-{{ b }}-
+{%- else -%}
+ {%- let b = 2... | Add support for redefining the same variable with `let` (just as Rust permits)
[Discovered while working on #315 and #327.]
The following statements, although allowed by Rust, are disallowed by `askama`:
~~~~
{% let x = 1 %}
{% let x = 2 %}
~~~~
The failure is:
~~~~
cannot assign twice to immutable variable... | I'm guessing this should be easy to fix.
Any news on this? It's very important when splitting template into small parts with ability to `include` them and setting some variables before include.
I haven't had a chance to work on it, and it's not much of a priority for me right now. I might be able to mentor you if you w... | 2020-12-23T14:44:36Z | 0.10 | 2020-12-25T21:42:49Z | 49252d2457f280026c020d0df46733578eb959a5 | [
"test_if_let",
"test_let",
"test_let_decl",
"test_self_iter",
"test_let_tuple"
] | [] | [] | [] | auto_2025-06-03 |
rinja-rs/askama | 1,097 | rinja-rs__askama-1097 | [
"1086"
] | 53b4b518f9a230665029560df038c318b2e55458 | diff --git a/askama_parser/src/expr.rs b/askama_parser/src/expr.rs
--- a/askama_parser/src/expr.rs
+++ b/askama_parser/src/expr.rs
@@ -270,7 +270,7 @@ impl<'a> Expr<'a> {
separated_list0(char(','), ws(move |i| Self::parse(i, level))),
Self::Array,
),
- ... | diff --git a/testing/tests/loops.rs b/testing/tests/loops.rs
--- a/testing/tests/loops.rs
+++ b/testing/tests/loops.rs
@@ -83,6 +83,16 @@ fn test_for_array() {
assert_eq!(t.render().unwrap(), "123");
}
+#[derive(Template)]
+#[template(source = "{% for i in [1, 2, 3, ] %}{{ i }}{% endfor %}", ext = "txt")]
+stru... | Allow Trailing Commas in Arrays Inside Template Expressions
Basically what the title says.
To give an example of what I mean, this here compiles just fine:
```html
<nav class="flex justify-between items-center max-w-7xl gap-x-12">
{% for (route, name) in [
("/about", "About"),
("/contact",... | Should be easy enough to implement, do you want to try submitting a PR? You'll want to start here:
https://github.com/djc/askama/blob/main/askama_parser/src/expr.rs#L263
Oh yeah sure! I'll see to it once I have the time. Doesn't look too complicated at first glance. | 2024-09-27T14:22:20Z | 0.13 | 2024-09-28T09:55:54Z | 53b4b518f9a230665029560df038c318b2e55458 | [
"test_for",
"test_for_array",
"test_for_cycle",
"test_for_cycle_dynamic",
"test_for_cycle_empty",
"test_for_destructoring_ref_tuple",
"test_for_enumerate",
"test_for_destructoring_tuple",
"test_for_in_if",
"test_for_index",
"test_for_method_call",
"test_for_path_call",
"test_for_range",
"t... | [] | [] | [] | auto_2025-06-03 |
rinja-rs/askama | 1,095 | rinja-rs__askama-1095 | [
"1081"
] | 96a4a46586aa10f2bebc6b892e7dc43d764a9999 | diff --git a/askama_derive/Cargo.toml b/askama_derive/Cargo.toml
--- a/askama_derive/Cargo.toml
+++ b/askama_derive/Cargo.toml
@@ -25,7 +25,7 @@ with-rocket = []
with-warp = []
[dependencies]
-parser = { package = "askama_parser", version = "0.3", path = "../askama_parser" }
+parser = { package = "askama_parser", v... | diff --git a/askama_derive/src/config.rs b/askama_derive/src/config.rs
--- a/askama_derive/src/config.rs
+++ b/askama_derive/src/config.rs
@@ -486,7 +490,7 @@ mod tests {
let config = Config::new(raw_config, None);
assert_eq!(
config.unwrap_err().msg,
- r#"delimiters must be at... | Template parsing issues when using double angle brackets as delimiters
With `expr` delimiters `<<` and `>>`, trying to use the template `<<a>> and <<b>>` complains about `and` not being a field. Here is a full example that produces the error "no field `and` on type `&HelloTemplate`":
```toml
[[syntax]]
name = "mwe"
... | 2024-09-19T08:12:12Z | 0.13 | 2024-09-19T08:47:53Z | 53b4b518f9a230665029560df038c318b2e55458 | [
"config::tests::illegal_delimiters"
] | [
"config::tests::find_absolute",
"config::tests::add_syntax_two",
"config::tests::find_relative",
"config::tests::add_syntax",
"config::tests::duplicated_syntax_name_on_list - should panic",
"config::tests::find_relative_sub",
"config::tests::find_relative_nonexistent - should panic",
"config::tests::g... | [
"config::tests::escape_modes",
"tests::check_if_let"
] | [] | auto_2025-06-03 | |
rinja-rs/askama | 1,093 | rinja-rs__askama-1093 | [
"1063"
] | 668bd6f2c1f60dc25143360976a5c775901af889 | diff --git a/askama_derive/src/generator.rs b/askama_derive/src/generator.rs
--- a/askama_derive/src/generator.rs
+++ b/askama_derive/src/generator.rs
@@ -822,6 +822,7 @@ impl<'a> Generator<'a> {
};
let locals = MapChain::with_parent(&self.locals);
let mut child = Self::new(self.input, self.c... | diff --git /dev/null b/testing/templates/fragment-include.html
new file mode 100644
--- /dev/null
+++ b/testing/templates/fragment-include.html
@@ -0,0 +1,9 @@
+{% extends "fragment-base.html" %}
+
+{% block body %}
+{% include "included.html" %}
+{% endblock %}
+
+{% block other_body %}
+<p>Don't render me.</p>
+{% en... | Include statement has no effect when used from a block fragment
When using a block fragment include statements don't seem to work.
See https://github.com/OscartGiles/askama/commit/74162b9453486a53a4de40bba905b4be31dcf3f0 for an example.
Is this intented behaviour or a bug?
| 2024-09-11T03:39:27Z | 0.13 | 2024-09-11T17:40:47Z | 53b4b518f9a230665029560df038c318b2e55458 | [
"test_fragment_include"
] | [
"test_fragment_nested_block",
"test_fragment_simple",
"test_fragment_nested_super",
"test_fragment_super",
"test_fragment_unused_expression",
"test_specific_block"
] | [] | [] | auto_2025-06-03 | |
rinja-rs/askama | 1,057 | rinja-rs__askama-1057 | [
"1056"
] | 627d58bc3b93c484f190d0711a4f9a9e26bc062c | diff --git a/askama_parser/src/node.rs b/askama_parser/src/node.rs
--- a/askama_parser/src/node.rs
+++ b/askama_parser/src/node.rs
@@ -369,24 +369,20 @@ pub struct Cond<'a> {
impl<'a> Cond<'a> {
fn parse(i: &'a str, s: &State<'_>) -> ParseResult<'a, Self> {
- let mut p = tuple((
+ let (i, (_, pws,... | diff --git /dev/null b/testing/tests/if.rs
new file mode 100644
--- /dev/null
+++ b/testing/tests/if.rs
@@ -0,0 +1,26 @@
+use askama::Template;
+
+#[derive(Template)]
+#[template(
+ source = r#"{%- if s == "" -%}
+empty
+{%- else if s == "b" -%}
+b
+{%- elif s == "c" -%}
+c
+{%- else -%}
+else
+{%- endif -%}"#,
+ ... | Add `elif` keyword
Hi,
we recently migrated from Tera to Askama and overall it was quite straightforward. One thing that did not work out of the box was the `elif` keyword, so it would be nice to include that. In addition, `elif` seems to be [supported by jinja](https://jinja.palletsprojects.com/en/3.1.x/templates/... | I guess I'm open to having that added as an alias for `else if`. Would you be able to submit a PR?
The code is here: https://github.com/djc/askama/blob/main/askama_parser/src/node.rs#L375.
Ah cool. :D | 2024-05-23T10:19:41Z | 0.13 | 2024-05-23T12:28:00Z | 53b4b518f9a230665029560df038c318b2e55458 | [
"test_if_let",
"test_if_let_else",
"test_if_let_shadowing",
"test_if_let_struct",
"test_if_let_struct_ref"
] | [] | [] | [] | auto_2025-06-03 |
rinja-rs/askama | 1,029 | rinja-rs__askama-1029 | [
"1022"
] | 03690ab46bbb9cc10f688ebfe003986f9cf4999c | diff --git a/askama_derive/src/generator.rs b/askama_derive/src/generator.rs
--- a/askama_derive/src/generator.rs
+++ b/askama_derive/src/generator.rs
@@ -705,7 +705,7 @@ impl<'a> Generator<'a> {
break;
}
}
- let current_buf = mem::take(&mut self.buf_writable);
+ let... | diff --git /dev/null b/testing/templates/blocks.txt
new file mode 100644
--- /dev/null
+++ b/testing/templates/blocks.txt
@@ -0,0 +1,11 @@
+{% block index %}
+Section: {{ s1 }}
+{% endblock %}
+
+{% block section -%}
+ [
+ {%- for value in values -%}
+ {{ value }}
+ {%- endfor -%}
+ ]
+{%- endblock %}
diff --gi... | Compilation error when using nested template blocks with in a single template file
Hello! I Encountered a compilation error when using[ block fragments](https://github.com/djc/askama/pull/824) with Vec<&str> in a single template file. The error does not occur when the template is split into separate files.
This is w... | I had the same issue, investigating what's going on. | 2024-05-02T15:40:27Z | 0.13 | 2024-05-16T12:07:05Z | 53b4b518f9a230665029560df038c318b2e55458 | [
"test_fragment_nested_block",
"test_fragment_simple",
"test_fragment_nested_super",
"test_fragment_super",
"test_fragment_unused_expression"
] | [
"test_deep",
"test_different_module",
"test_empty_child",
"test_flat_deep",
"test_let_block",
"test_named_end",
"test_nested_blocks",
"test_use_base_directly",
"test_simple_extends",
"test_attr",
"test_comment",
"test_constants",
"test_composition",
"test_else",
"test_define_string_var",... | [] | [] | auto_2025-06-03 |
rinja-rs/askama | 1,027 | rinja-rs__askama-1027 | [
"1026"
] | 8d3a3f73d4b06c4bfe7417bb4cee3b6c49c1a5fc | diff --git a/askama_parser/src/node.rs b/askama_parser/src/node.rs
--- a/askama_parser/src/node.rs
+++ b/askama_parser/src/node.rs
@@ -2,7 +2,7 @@ use std::borrow::Cow;
use std::str;
use nom::branch::alt;
-use nom::bytes::complete::{tag, take_until};
+use nom::bytes::complete::tag;
use nom::character::complete::ch... | diff --git a/askama_parser/src/tests.rs b/askama_parser/src/tests.rs
--- a/askama_parser/src/tests.rs
+++ b/askama_parser/src/tests.rs
@@ -918,3 +918,17 @@ fn fuzzed_unary_recursion() {
const TEMPLATE: &str = include_str!("../tests/unary-recursion.txt");
assert!(Ast::from_str(TEMPLATE, None, &Syntax::default(... | Nested comments causes parser to timeout
Hi,
Large nested comments like below(produced by fuzzing);
```
{{#{{#{{#{{#{{#{{#{{#{{#{{#{{#{{#{{#{{#{{#{{##}#}#}#}#}#}#}#}#}#}#}#}#}#}#}#}#}#}#}#}#}#}#
```
makes the parser get stuck at following lines.
https://github.com/djc/askama/blob/5955ba23c172ef6bbc0116b9ab0d6f0... | 2024-04-30T21:00:38Z | 0.13 | 2024-05-01T11:55:08Z | 53b4b518f9a230665029560df038c318b2e55458 | [
"tests::fuzzed_comment_depth"
] | [
"test::test_num_lit",
"test::test_char_lit",
"tests::change_delimiters_parse_filter",
"tests::fuzzed_macro_no_end",
"tests::fuzzed_unicode_slice",
"tests::test_invalid_block - should panic",
"tests::test_missing_space_after_kw",
"tests::test_associativity",
"tests::test_parse_const",
"tests::test_... | [
"test::test_strip_common"
] | [] | auto_2025-06-03 | |
rust-fuzz/cargo-fuzz | 388 | rust-fuzz__cargo-fuzz-388 | [
"386"
] | a608970259c3b0d575e70b0748c1c4cf79081031 | diff --git a/src/options.rs b/src/options.rs
--- a/src/options.rs
+++ b/src/options.rs
@@ -165,6 +165,20 @@ pub struct BuildOptions {
/// and the fuzzer can store an input to the corpus at each condition that it passes;
/// giving it a better chance of producing an input that reaches `res = 2;`.
pub disa... | diff --git a/src/options.rs b/src/options.rs
--- a/src/options.rs
+++ b/src/options.rs
@@ -265,6 +279,7 @@ mod test {
no_cfg_fuzzing: false,
no_trace_compares: false,
disable_branch_folding: None,
+ no_include_main_msvc: false,
};
let opts = vec![
| Fuzzing Windows DLL (cdylib) - Unresolved External Symbol Main
Hi cargo-fuzz devs! I am working on fuzzing a Windows DLL with cargo-fuzz and have been hitting a wall with a particular linker error. I've reproduced the problem in a small & simple Cargo project to demonstrate the issue.
## Problem Description
The i... | 2024-10-16T17:58:54Z | 0.12 | 2024-11-05T18:55:01Z | a608970259c3b0d575e70b0748c1c4cf79081031 | [
"rustc_version::tests::test_parsing_future_stable",
"rustc_version::tests::test_parsing_nightly",
"rustc_version::tests::test_parsing_stable",
"options::test::display_build_options",
"help",
"init_defines_correct_dependency",
"init_finds_parent_project",
"add_twice",
"init_twice",
"list",
"tmin"... | [] | [] | [] | auto_2025-06-12 | |
rust-fuzz/cargo-fuzz | 344 | rust-fuzz__cargo-fuzz-344 | [
"343"
] | abb7a67c5b2e1263c3e5c7abfa8c70bb4dec7796 | diff --git a/src/options.rs b/src/options.rs
--- a/src/options.rs
+++ b/src/options.rs
@@ -126,6 +126,13 @@ pub struct BuildOptions {
#[arg(long)]
pub no_cfg_fuzzing: bool,
+ #[arg(skip = false)]
+ /// Add the 'cfg(fuzzing-repro)' compilation configuration. This build
+ /// option will be automatic... | diff --git a/src/options.rs b/src/options.rs
--- a/src/options.rs
+++ b/src/options.rs
@@ -232,6 +239,7 @@ mod test {
coverage: false,
strip_dead_code: false,
no_cfg_fuzzing: false,
+ cfg_fuzzing_repro: false,
no_trace_compares: false,
};
diff --... | Detect when code is reproducing a crash vs when it is fuzzing
Hi all,
I have a lot of fun using `cargo fuzz` on my projects! It lowers the barrier enough that fuzzing becomes simple, so well done :+1:
When I find a crash, I often need to debug it by adding extra `dbg!` or `eprintln!` calls to my code. Is there a... | I would be in support of a `cfg(fuzz_repro)` or something. | 2023-06-16T13:28:04Z | 0.11 | 2023-06-18T17:12:28Z | abb7a67c5b2e1263c3e5c7abfa8c70bb4dec7796 | [
"options::test::display_build_options",
"help",
"init_finds_parent_project",
"init_twice",
"add_twice",
"list",
"tmin"
] | [] | [] | [] | auto_2025-06-12 |
rust-fuzz/cargo-fuzz | 339 | rust-fuzz__cargo-fuzz-339 | [
"331"
] | fa18f0d77aef036302d9f948e80aa12c6b95d57b | diff --git a/src/options.rs b/src/options.rs
--- a/src/options.rs
+++ b/src/options.rs
@@ -82,6 +82,20 @@ pub struct BuildOptions {
/// Use a specific sanitizer
pub sanitizer: Sanitizer,
+ #[arg(long = "build-std")]
+ /// Pass -Zbuild-std to Cargo, which will build the standard library with all the bu... | diff --git a/src/options.rs b/src/options.rs
--- a/src/options.rs
+++ b/src/options.rs
@@ -209,6 +223,8 @@ mod test {
no_default_features: false,
all_features: false,
features: None,
+ build_std: false,
+ careful_mode: false,
sanitizer: Sanitizer... | Integrate cargo-careful
cargo-careful enables debug assertions and some UB checks in libstd, I think it would be useful if we can fuzz under that configuration
https://github.com/RalfJung/cargo-careful
(@RalfJung Might be of interest to you)
| 2023-05-04T18:54:19Z | 0.11 | 2023-05-24T12:12:51Z | abb7a67c5b2e1263c3e5c7abfa8c70bb4dec7796 | [
"options::test::display_build_options",
"help",
"init_finds_parent_project",
"add_twice",
"init_twice",
"list"
] | [] | [] | [] | auto_2025-06-12 | |
rust-fuzz/cargo-fuzz | 264 | rust-fuzz__cargo-fuzz-264 | [
"263"
] | 2e496ca9cfe11de7cfb3d89b2299e93359ebc72f | diff --git a/src/project.rs b/src/project.rs
--- a/src/project.rs
+++ b/src/project.rs
@@ -822,6 +830,10 @@ impl FuzzProject {
targets: Vec::new(),
})
}
+
+ fn fuzz_dir_is_default_path(&self) -> bool {
+ self.fuzz_dir.ends_with(DEFAULT_FUZZ_DIR)
+ }
}
fn collect_targets(value... | diff --git a/src/project.rs b/src/project.rs
--- a/src/project.rs
+++ b/src/project.rs
@@ -459,14 +459,22 @@ impl FuzzProject {
eprintln!();
}
+ let fuzz_dir = if self.fuzz_dir_is_default_path() {
+ String::new()
+ } else {
+ format!(" ... | [`fuzz run`] Bad discovered input should display custom fuzz dir
Currently, when `fuzz run someTarget` discovers a bad input, it doesn't take into consideration custom `--fuzz-dir` directories.
Actual:
```
RUST_BACKTRACE=1 cargo fuzz run --fuzz-dir someDirectory someTarget
...
Reproduce with:
cargo fuzz... | 2021-05-23T01:27:42Z | 0.10 | 2021-05-25T17:16:22Z | 78965346c161a3800166c41304f61717e9d7e85c | [
"options::test::display_build_options",
"help",
"init_finds_parent_project",
"init_twice",
"add_twice",
"list"
] | [] | [] | [] | auto_2025-06-12 | |
rust-fuzz/cargo-fuzz | 262 | rust-fuzz__cargo-fuzz-262 | [
"238"
] | 089dfae55534ae29a6323b4e0368ae6ebe9b34f8 | diff --git a/src/options.rs b/src/options.rs
--- a/src/options.rs
+++ b/src/options.rs
@@ -13,8 +13,8 @@ pub use self::{
run::Run, tmin::Tmin,
};
-use std::fmt as stdfmt;
use std::str::FromStr;
+use std::{fmt as stdfmt, path::PathBuf};
use structopt::StructOpt;
#[derive(Debug, Clone, Copy, PartialEq)]
diff... | diff --git a/src/options.rs b/src/options.rs
--- a/src/options.rs
+++ b/src/options.rs
@@ -186,6 +186,23 @@ impl stdfmt::Display for BuildOptions {
}
}
+#[derive(Clone, Debug, StructOpt, PartialEq)]
+pub struct FuzzDirWrapper {
+ /// The path to the fuzz project directory.
+ #[structopt(long = "fuzz-dir")... | Support for non-standard project directories
`fuzz` is currently the only possible directory name and it would be nice to have something like `cargo fuzz run --path some_fuzz_project_dir someTarget`
| That the directory containing the fuzzing code _has to be_ called "fuzz" (and cannot be renamed nor moved deeper in the directory structure) is a limitation that is not documented anywhere. Is there a reason for it? | 2021-05-08T19:52:56Z | 0.10 | 2021-05-13T17:23:13Z | 78965346c161a3800166c41304f61717e9d7e85c | [
"options::test::display_build_options",
"help",
"init_finds_parent_project",
"list",
"init_twice",
"add_twice"
] | [] | [] | [] | auto_2025-06-12 |
rust-fuzz/cargo-fuzz | 234 | rust-fuzz__cargo-fuzz-234 | [
"228"
] | 9f2f36888d10504f0a219bf1a91b72837d9fba56 | diff --git a/src/options.rs b/src/options.rs
--- a/src/options.rs
+++ b/src/options.rs
@@ -15,7 +15,7 @@ use std::fmt as stdfmt;
use std::str::FromStr;
use structopt::StructOpt;
-#[derive(Debug, Clone, Copy)]
+#[derive(Debug, Clone, Copy, PartialEq)]
pub enum Sanitizer {
Address,
Leak,
diff --git a/src/o... | diff --git a/src/options.rs b/src/options.rs
--- a/src/options.rs
+++ b/src/options.rs
@@ -110,3 +110,125 @@ pub struct BuildOptions {
/// Unstable (nightly-only) flags to Cargo
pub unstable_flags: Vec<String>,
}
+
+impl stdfmt::Display for BuildOptions {
+ fn fmt(&self, f: &mut stdfmt::Formatter) -> stdf... | Recommended reproduction command ignores arguments
When running the fuzzer with specific sanitizer, time or memory settings and an issue is found then the output for reproduction is not complete. In particular the recommended command line for reproducing the issue misses any of these parameters as well as the used `car... | Thanks for reporting! Here's the code that needs to change:
https://github.com/rust-fuzz/cargo-fuzz/blob/2fb3bd85c0dd57ea7f3d5c29174c26a5550d0aa8/src/project.rs#L426-L436
We need to incorporate [the arguments](https://github.com/rust-fuzz/cargo-fuzz/blob/2fb3bd85c0dd57ea7f3d5c29174c26a5550d0aa8/src/options/run.rs... | 2020-07-02T12:19:45Z | 0.8 | 2020-07-06T18:55:01Z | 9f2f36888d10504f0a219bf1a91b72837d9fba56 | [
"help",
"init_finds_parent_project",
"add_twice",
"init_twice",
"list"
] | [] | [] | [] | auto_2025-06-12 |
rust-fuzz/cargo-fuzz | 231 | rust-fuzz__cargo-fuzz-231 | [
"230"
] | 87c36a1deee8ca9b550fe034623a7445d7e8c770 | diff --git a/src/main.rs b/src/main.rs
--- a/src/main.rs
+++ b/src/main.rs
@@ -40,7 +40,11 @@ fuzz/fuzz_targets/, i.e. the name picked when running `cargo fuzz add`.
This will run the script inside the fuzz target with varying inputs until it
finds a crash, at which point it will save the crash input to the artifact
... | diff --git a/src/project.rs b/src/project.rs
--- a/src/project.rs
+++ b/src/project.rs
@@ -182,7 +183,7 @@ impl FuzzProject {
// performance, we're taking a huge hit relative to actual release mode.
// Local tests have once showed this to be a ~3x faster runtime where
// otherwise functions l... | Fuzzing with default settings is much slower than it needs to be
`cargo fuzz run` currently defaults to debug mode with Address Sanitizer. Debug mode in Rust is needlessly slow, easily 20x slower than release mode, and for fuzzing performance is critical. It would be a much better idea to default to release mode, but w... | For reference, AFL already defaults to release mode with overflow checks and debug assertions: https://github.com/rust-fuzz/afl.rs/blob/d156adfb072aad655342a1a04cdbe4d9ac2ffc9e/src/bin/cargo-afl.rs#L294 | 2020-06-20T21:45:55Z | 0.7 | 2020-11-11T18:48:06Z | 87c36a1deee8ca9b550fe034623a7445d7e8c770 | [
"help",
"init_finds_parent_project",
"add_twice",
"init_twice",
"list"
] | [] | [] | [] | auto_2025-06-12 |
rust-fuzz/cargo-fuzz | 204 | rust-fuzz__cargo-fuzz-204 | [
"196"
] | f81f71edcb358e66cc8938fcf986fa3d42a89177 | diff --git a/src/main.rs b/src/main.rs
--- a/src/main.rs
+++ b/src/main.rs
@@ -6,8 +6,6 @@
// copied, modified, or distributed except according to those terms.
use anyhow::Result;
-use std::fmt;
-use std::str::FromStr;
use structopt::StructOpt;
#[macro_use]
diff --git a/src/main.rs b/src/main.rs
--- a/src/main.... | diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -15,4 +15,5 @@ jobs:
run: |
rustup install nightly
rustup default nightly
+ export RUST_BACKTRACE=1
cargo test --verbose
diff --git a/src/pro... | Support running fuzz targets over specific input files
libfuzzer allows one to run a fuzz target over specific existing inputs, *without* generating new inputs afterwards. You pass a list of files in on the command line. This is useful for running all the inputs in a corpus in CI for a pull request, for example.
How... | Ah, so one workaround is to pass `-- -runs=0`, which will make libFuzzer exit after re-running each of the corpus's seeds, without generating any new inputs.
We may still want to add a `--only-existing-corpus` flag to do this, since it isn't obvious.
I agree. I was trying to figure this out for a while with little s... | 2019-12-19T22:07:13Z | 0.5 | 2019-12-19T22:52:02Z | f81f71edcb358e66cc8938fcf986fa3d42a89177 | [
"help",
"init_finds_parent_project",
"init_twice",
"add_twice",
"list"
] | [] | [] | [] | auto_2025-06-12 |
rust-fuzz/cargo-fuzz | 288 | rust-fuzz__cargo-fuzz-288 | [
"287"
] | 63730da7f95cfb21f6f5a9b0a74532f98d3983a4 | diff --git a/CHANGELOG.md b/CHANGELOG.md
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,7 +4,13 @@ Released YYYY-MM-DD.
### Added
-* TODO (or remove section if none)
+* Added the `--no-trace-compares` flag which opts out of the
+ `-sanitizer-coverage-trace-compares` LLVM argument.
+
+ Using this may improve fuzzer ... | diff --git a/src/options.rs b/src/options.rs
--- a/src/options.rs
+++ b/src/options.rs
@@ -229,6 +238,7 @@ mod test {
coverage: false,
strip_dead_code: false,
no_cfg_fuzzing: false,
+ no_trace_compares: false,
};
let opts = vec![
| Targets built with cargo-fuzz always require POPCNT instruction
libFuzzer uses the `POPCNT` instruction for data-flow guided coverage and cargo-fuzz builds targets with it turned on. This causes the targets to mysteriously crash when the CPU doesn't support the instruction (like my ancient laptop). References:
- [ca... | Is there a particular subset that we can disable to avoid `popcnt`? If we disable all of them, I am pretty sure the fuzzer will give up and say that nothing is interesting.
If you can get a flag working, happy to merge it tho. | 2022-01-24T21:57:04Z | 0.11 | 2022-01-25T19:30:26Z | abb7a67c5b2e1263c3e5c7abfa8c70bb4dec7796 | [
"options::test::display_build_options",
"help",
"init_twice",
"add_twice",
"list",
"init_finds_parent_project"
] | [] | [] | [] | auto_2025-06-12 |
rust-fuzz/cargo-fuzz | 274 | rust-fuzz__cargo-fuzz-274 | [
"273"
] | a6dceae81e6977e19ccc9cf8e4008ae82102065c | diff --git a/src/options.rs b/src/options.rs
--- a/src/options.rs
+++ b/src/options.rs
@@ -128,6 +128,11 @@ pub struct BuildOptions {
/// optimized targets. This flag allows you to opt out of it.
#[structopt(long)]
pub strip_dead_code: bool,
+
+ /// By default the 'cfg(fuzzing)' compilation configurat... | diff --git a/src/options.rs b/src/options.rs
--- a/src/options.rs
+++ b/src/options.rs
@@ -223,6 +228,7 @@ mod test {
target_dir: None,
coverage: false,
strip_dead_code: false,
+ no_cfg_fuzzing: false,
};
let opts = vec![
| Allow to disable `--cfg fuzzing`
One of the dependencies of my project would deactivate some features on `#[cfg(fuzzing)]` which i'd like to keep.
Is there a way to opt out of `--cfg fuzzing`? If not would it be possible to add one?
| 2021-08-31T08:42:51Z | 0.10 | 2021-09-02T16:58:17Z | 78965346c161a3800166c41304f61717e9d7e85c | [
"options::test::display_build_options",
"help",
"init_finds_parent_project",
"init_twice",
"add_twice",
"list"
] | [] | [] | [] | auto_2025-06-12 | |
cargo-generate/cargo-generate | 785 | cargo-generate__cargo-generate-785 | [
"784"
] | 15b2143c1c5520cdd378c762769eacf55d2853e4 | diff --git a/Cargo.lock b/Cargo.lock
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -171,23 +171,21 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]]
name = "clap"
-version = "3.2.23"
+version = "4.0.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "... | diff --git a/src/args.rs b/src/args.rs
--- a/src/args.rs
+++ b/src/args.rs
@@ -42,8 +42,8 @@ pub struct GenerateArgs {
"bin",
"define",
"init",
- "template-values-file",
- "ssh-identity",
+ "template_values_file",
+ "ssh_identity",
... | chore(deps): bump clap from 3.2.23 to 4.0.19
Bumps [clap](https://github.com/clap-rs/clap) from 3.2.23 to 4.0.19.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/clap-rs/clap/releases">clap's releases</a>.</em></p>
<blockquote>
<h2>v4.0.19</h2>
<h2>[4.0.19] - 2022-11-04</h2>
<... | 2022-11-07T12:22:15Z | 0.16 | 2022-11-07T15:33:38Z | 15b2143c1c5520cdd378c762769eacf55d2853e4 | [
"basics::error_message_for_invalid_repo_or_user"
] | [
"config::tests::config_try_from_errors_on_invalid_keys",
"config::tests::locate_configs_returns_empty_upon_failure",
"config::tests::config_try_from_handles_empty",
"config::tests::locate_configs_doesnt_look_past_cargo_generate",
"config::tests::config_try_from_handles_placeholders",
"filenames::tests::sh... | [
"basics::it_processes_dot_github_directory_files",
"basics::it_provides_crate_type_lib",
"basics::it_allows_user_defined_projectname_when_passing_force_flag",
"basics::it_ignore_tags_inside_raw_block",
"basics::it_kebabcases_projectname_when_passed_to_flag",
"basics::it_removes_genignore_files_before_subs... | [] | auto_2025-06-12 | |
cargo-generate/cargo-generate | 729 | cargo-generate__cargo-generate-729 | [
"637"
] | ee0219e155f1b4d8961b2298e2b0c21daa52b912 | diff --git a/guide/src/SUMMARY.md b/guide/src/SUMMARY.md
--- a/guide/src/SUMMARY.md
+++ b/guide/src/SUMMARY.md
@@ -11,7 +11,10 @@
- [Include/Exclude](templates/include_exclude.md)
- [Require Version](templates/require_version.md)
- [Conditionals](templates/conditional.md)
- - [Pre/Post Scripts](templates/scri... | diff --git a/src/lib.rs b/src/lib.rs
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -120,41 +107,16 @@ fn internal_generate(mut args: GenerateArgs) -> Result<PathBuf> {
check_cargo_generate_version(&config)?;
- let project_name = resolve_project_name(&args)?;
- let project_dir = resolve_project_dir(&project_name, ... | feat: explain when pre/post scripts are run
## PRE
* Currently pre hooks are run after all placeholders mentioned in `cargo-generate.toml` has been resolved.
* The hooks are free to add aditional variables, but its too late to influence the conditional system.
This is a sideeffect of conditionals influencing the h... | 2022-08-09T22:42:01Z | 0.16 | 2022-10-12T17:34:13Z | 15b2143c1c5520cdd378c762769eacf55d2853e4 | [
"config::tests::config_try_from_handles_empty",
"config::tests::config_try_from_errors_on_invalid_keys",
"config::tests::config_try_from_handles_placeholders",
"git::utils::should_canonicalize",
"git::identity_path::tests::should_pretty_path",
"project_variables::tests::boolean_cant_have_choices",
"conf... | [] | [] | [] | auto_2025-06-12 | |
cargo-generate/cargo-generate | 712 | cargo-generate__cargo-generate-712 | [
"704"
] | 30daf37ddf12c25b8b94395aedecdd06686c5a3a | diff --git a/src/args.rs b/src/args.rs
--- a/src/args.rs
+++ b/src/args.rs
@@ -234,10 +234,10 @@ impl FromStr for Vcs {
}
impl Vcs {
- pub fn initialize(&self, project_dir: &Path, branch: String, force: bool) -> Result<()> {
+ pub fn initialize(&self, project_dir: &Path, branch: Option<&str>, force: bool) -> ... | diff --git a/src/lib.rs b/src/lib.rs
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -230,7 +230,7 @@ fn test_expanded_template(template_dir: &PathBuf, args: &GenerateArgs) -> Result
fn prepare_local_template(
source_template: &UserParsedInput,
-) -> Result<(TempDir, PathBuf, String), anyhow::Error> {
+) -> Result<(TempDi... | Git default branch is not honored when using --path
Here is [my template](https://github.com/chevdor/cargo-templates.git) in case this is relevant.
## The good case
using `cargo-generate` with the --git flag works fine:
```
cargo generate --destination /tmp --git https://github.com/chevdor/cargo-templates.git cli... | This is currently by design!
When using `--path`, `cargo-generate` doesn't look for or expect anything related to git from the template folder - the user has specified the source as a plain folder after all.
To work around this, just use `--git <path to repo>` instead.
Of course that may lead you to other disc... | 2022-08-01T14:19:40Z | 0.16 | 2022-08-09T13:24:28Z | 15b2143c1c5520cdd378c762769eacf55d2853e4 | [
"config::tests::config_try_from_handles_empty",
"config::tests::config_try_from_errors_on_invalid_keys",
"config::tests::config_try_from_handles_placeholders",
"git::utils::should_canonicalize",
"project_variables::tests::block_invalid_key_names",
"config::tests::locate_configs_doesnt_look_past_cargo_gene... | [] | [] | [] | auto_2025-06-12 |
cargo-generate/cargo-generate | 699 | cargo-generate__cargo-generate-699 | [
"455"
] | 9bdf3ab592e2431309929ff57d7a525a4182a8cf | diff --git a/Cargo.lock b/Cargo.lock
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -135,6 +135,7 @@ dependencies = [
"liquid-core",
"liquid-derive",
"liquid-lib",
+ "names",
"openssl",
"paste",
"path-absolutize",
diff --git a/Cargo.lock b/Cargo.lock
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -202,9 +203,9 @@ dependencies ... | diff --git a/src/args.rs b/src/args.rs
--- a/src/args.rs
+++ b/src/args.rs
@@ -43,7 +43,8 @@ pub struct GenerateArgs {
"define",
"init",
"template-values-file",
- "ssh-identity"
+ "ssh-identity",
+ "test",
])
)]
pub list_favorite... | `cargo test` shortcut for template authors
As a **template author**
I want to **have an easy way to test my template code**
So that **I save time to manually generate a project, run then cargo test in it and delete the generated project again**
I imagine something like
```sh
cd my-wonderful-template
cargo gener... | @sassman: I've got a prototype for this one running now.
It runs `cargo test --all-features -- --nocapture` instead of creating the files in the current folder as it normally would - thus running the test inside a tmp folder that is deleted upon exit.
This works very nicely, except for one caveat; I can see mysel... | 2022-07-14T22:01:26Z | 0.15 | 2022-07-25T17:50:32Z | 9bdf3ab592e2431309929ff57d7a525a4182a8cf | [
"config::tests::config_try_from_handles_empty",
"config::tests::config_try_from_errors_on_invalid_keys",
"config::tests::config_try_from_handles_placeholders",
"config::tests::locate_configs_doesnt_look_past_cargo_generate",
"git::utils::should_canonicalize",
"git::identity_path::tests::should_pretty_path... | [] | [] | [] | auto_2025-06-12 |
cargo-generate/cargo-generate | 693 | cargo-generate__cargo-generate-693 | [
"636"
] | 422da4742fdae5475206f588c5dbe45e1667527e | diff --git a/CHANGELOG.md b/CHANGELOG.md
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,13 +6,25 @@
- [fix(#514): boolean value being ignored](https://github.com/cargo-generate/cargo-generate/issues/514)
### ✨ Features
-- [Test for file existance from rhai scripts](https://github.com/cargo-generate/cargo-generate/pull... | diff --git a/src/config.rs b/src/config.rs
--- a/src/config.rs
+++ b/src/config.rs
@@ -89,30 +90,38 @@ impl Config {
}
}
-pub fn locate_template_configs(dir: &Path) -> Result<Vec<String>> {
- let mut result = vec![];
-
- for entry in WalkDir::new(dir) {
- let entry = entry?;
- if entry.file_... | Feat: when pointing to a multi-template repo, it should be possible to explicitly specify the default template
When using `cargo-generate` with a multi template repository, `cargo-generate` creates a `choice` prompt for the user to select a
template to expand.
It would help on usability if it was possible to influ... | > When using cargo-generate with a multi template repository, cargo-generate creates a choice prompt for the user to select a
template to expand.
The choices presented to the users, should be based on the first level of directories in the template repository?
Currently we find all sub-folders that has a `cargo-gene... | 2022-07-09T18:53:37Z | 0.15 | 2022-07-13T07:06:10Z | 9bdf3ab592e2431309929ff57d7a525a4182a8cf | [
"config::tests::config_try_from_handles_empty",
"config::tests::config_try_from_errors_on_invalid_keys",
"config::tests::config_try_from_handles_placeholders",
"git::utils::should_canonicalize",
"git::identity_path::tests::should_pretty_path",
"project_variables::tests::block_invalid_key_names",
"projec... | [] | [] | [] | auto_2025-06-12 |
cargo-generate/cargo-generate | 511 | cargo-generate__cargo-generate-511 | [
"391"
] | dbc133f2287b4b19f65facd6e7fcbbe94c73f101 | diff --git a/Cargo.lock b/Cargo.lock
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -130,6 +130,7 @@ version = "0.11.1"
dependencies = [
"anyhow",
"assert_cmd",
+ "cargo-husky",
"console",
"dialoguer",
"dirs",
diff --git a/Cargo.lock b/Cargo.lock
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -161,6 +162,12 @@ dependencies = [
... | diff --git a/Cargo.toml b/Cargo.toml
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -54,6 +54,11 @@ predicates = "2.1"
assert_cmd = "2.0"
indoc = "1.0"
+[dev-dependencies.cargo-husky]
+version = "1"
+default-features = false
+features = ["prepush-hook", "run-cargo-test", "run-cargo-clippy", "run-cargo-fmt"]
+
[features]
ve... | abbreviation support for gitlab and bitbucket users
At the moment I can point to a github repo like this:
```sh
cargo generate --git rustwasm/wasm-pack-template
# or even shorter:
cargo generate rustwasm/wasm-pack-template
```
In order to support also gitlab and bitbucket users I'm proposing a prefix that w... | 2022-01-04T13:25:19Z | 0.11 | 2022-01-04T18:16:12Z | dbc133f2287b4b19f65facd6e7fcbbe94c73f101 | [
"config::tests::config_try_from_handles_empty",
"config::tests::config_try_from_errors_on_invalid_keys",
"config::tests::config_try_from_handles_placeholders",
"git::should_canonicalize",
"git::tests::should_determine_repo_kind",
"git::tests::should_not_fail_for_ssh_remote_urls",
"git::should_pretty_pat... | [] | [] | [] | auto_2025-06-12 | |
cargo-generate/cargo-generate | 474 | cargo-generate__cargo-generate-474 | [
"473"
] | 86bd44b49a0b9acf0fa09bdbdd49db7fcc88abf8 | diff --git a/src/hooks/variable_mod.rs b/src/hooks/variable_mod.rs
--- a/src/hooks/variable_mod.rs
+++ b/src/hooks/variable_mod.rs
@@ -1,7 +1,7 @@
use liquid::{Object, ValueView};
use liquid_core::Value;
use regex::Regex;
-use rhai::{Dynamic, EvalAltResult, Module};
+use rhai::{Array, Dynamic, EvalAltResult, Module}... | diff --git a/src/hooks/variable_mod.rs b/src/hooks/variable_mod.rs
--- a/src/hooks/variable_mod.rs
+++ b/src/hooks/variable_mod.rs
@@ -203,3 +220,61 @@ impl GetNamedValue for Rc<RefCell<Object>> {
}
}
}
+
+fn rhai_to_liquid_value(val: Dynamic) -> Result<Value> {
+ val.as_bool()
+ .map(Into::int... | feature: in Rhai script, add support for array in variable::set
This feature is not an addition to the types of placeholders in general. Instead it aims only to allow the usage of arrays through Rhai scripts. Rhai already has support for arrays and so does Liquid, so the implementation is simple and minimal changes wou... | 2021-10-02T14:55:51Z | 0.10 | 2021-11-07T11:35:35Z | 86bd44b49a0b9acf0fa09bdbdd49db7fcc88abf8 | [
"config::tests::config_try_from_handles_empty",
"config::tests::config_try_from_errors_on_invalid_keys",
"git::should_canonicalize",
"config::tests::config_try_from_handles_placeholders",
"git::tests::should_determine_repo_kind",
"git::tests::should_not_fail_for_ssh_remote_urls",
"git::should_pretty_pat... | [] | [] | [] | auto_2025-06-12 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.