repo string | pull_number int64 | instance_id string | issue_numbers list | base_commit string | patch string | test_patch string | problem_statement string | hints_text string | created_at string | version string | updated_at string | environment_setup_commit string | FAIL_TO_PASS list | PASS_TO_PASS list | FAIL_TO_FAIL list | PASS_TO_FAIL list | source_dir string |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
sagiegurari/cargo-make | 595 | sagiegurari__cargo-make-595 | [
"594"
] | ee4e8b40319532079750d26c7d2415c0c6fbc306 | diff --git a/docs/_includes/content.md b/docs/_includes/content.md
--- a/docs/_includes/content.md
+++ b/docs/_includes/content.md
@@ -2039,6 +2039,19 @@ rustc 1.32.0-nightly (451987d86 2018-11-01)
[cargo-make] INFO - Build Done in 2 seconds.
```
+It's also possible to assert a minimum required version of rustc wi... | diff --git a/src/lib/command_test.rs b/src/lib/command_test.rs
--- a/src/lib/command_test.rs
+++ b/src/lib/command_test.rs
@@ -110,7 +110,7 @@ fn run_command_for_toolchain() {
let mut task = Task::new();
task.command = Some("echo".to_string());
task.args = Some(vec!["test".to_string()]);
- ... | Let toolchain describe a minimal supported rust version
### Feature Description
```
[tasks.rustc-version-stable]
toolchain = "1.56" # required because we're using edition 2021
```
Unfortunately, by the time 1.57 stabilizes, the above will suddenly complain to devs using the latest stable release.
### Describe... | thanks a lot for the idea.
how about:
```toml
[tasks.rustc-version-stable]
toolchain = { channel = "stable", min_version = "1.56" }
```
this way
* we don't need to parse the version
* we are consistent with install_crate attribute which has min_version as well. so better do the same everywhere.
this sound... | 2021-10-06T17:31:32Z | 0.35 | 2021-11-08T14:10:09Z | b60232e120431d950bb772417f2a281a385eac9b | [
"cache::cache_test::load_from_path_not_exists",
"cache::cache_test::load_from_path_exists",
"cli_commands::list_steps::list_steps_test::run_empty",
"cli_commands::print_steps::print_steps_test::get_format_type_default",
"cli_commands::print_steps::print_steps_test::get_format_type_short_description",
"cli... | [] | [] | [] | auto_2025-06-12 |
sagiegurari/cargo-make | 1,109 | sagiegurari__cargo-make-1109 | [
"1108"
] | e3e93de01658a7a4fa8a62ff086582e69e712bc8 | diff --git a/CHANGELOG.md b/CHANGELOG.md
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,9 @@
## CHANGELOG
+### v0.37.14
+
+* Fix: fix the --skip-init-end-tasks argument #1108
+
### v0.37.13 (2024-07-07)
* Enhancement: New condition_script_runner_args attribute #1081
diff --git a/src/lib/cli.rs b/src/lib/cli.rs... | diff --git a/src/lib/cli_commands/diff_steps.rs b/src/lib/cli_commands/diff_steps.rs
--- a/src/lib/cli_commands/diff_steps.rs
+++ b/src/lib/cli_commands/diff_steps.rs
@@ -8,7 +8,7 @@
mod diff_steps_test;
use crate::command;
-use crate::execution_plan::create as create_execution_plan;
+use crate::execution_plan::Exe... | `--skip-init-end-tasks` doesn't seem to work
### Describe The Bug
With `tasks.init` defined, even if we call `cargo make --skip-init-end-tasks empty`, the init task will be called.
I am not sure if I am understanding the `--skip-init-end-tasks` argument incorrectly, or there is a bug. If it's a misunderstanding, I ... | instead of
cargo make empty --skip-init-end-tasks
do
cargo make --skip-init-end-tasks empty
> instead of cargo make empty --skip-init-end-tasks do cargo make --skip-init-end-tasks empty
The same:
```
$ cargo init hello-world && cd hello-world && echo "tasks.init.script = \"echo init\"" > Makefile.toml && car... | 2024-07-07T19:09:51Z | 0.37 | 2024-07-14T17:47:16Z | ef1f37051d1fba6118cf75492e5c5aec5ebbe704 | [
"cache::cache_test::load_from_path_not_exists",
"cli::cli_test::run_bad_subcommand - should panic",
"cli_commands::diff_steps::diff_steps_test::run_missing_task_in_first_config - should panic",
"cli_commands::list_steps::list_steps_test::run_all_public",
"cli_commands::list_steps::list_steps_test::run_empty... | [] | [] | [] | auto_2025-06-12 |
sagiegurari/cargo-make | 714 | sagiegurari__cargo-make-714 | [
"712"
] | 6f82c9ec41374598a4fda5dde232fda7a557865d | diff --git a/.gitignore b/.gitignore
--- a/.gitignore
+++ b/.gitignore
@@ -8,3 +8,5 @@ dump.rdb
/rs*.sh
/docs/_site
/core
+/src/**/Cargo.lock
+/examples/**/Cargo.lock
diff --git a/CHANGELOG.md b/CHANGELOG.md
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,11 @@
## CHANGELOG
+### v0.36.1
+
+* Enhancement: Support... | diff --git a/Makefile.toml b/Makefile.toml
--- a/Makefile.toml
+++ b/Makefile.toml
@@ -28,6 +28,26 @@ echo " Unstable Format Environment: ${CARGO_MAKE_TEMP_UNSTABLE_FMT_ENV}"
echo "*************************************"
'''
+[tasks.test-multi-phases-cleanup]
+script = '''
+#!@duckscript
+
+fn <scope> delete_all
... | Cargo make incompatible with Rust 1.64 Workspace Inheritance
### Describe The Bug
As of Rust 1.64, a package version can be set using `version.workspace = true`.
cargo-make expects PackageInfo.version to be an `Option<String>`, and is unable to parse the new map structure.
https://doc.rust-lang.org/cargo/refe... | oh... thanks for reporting. I'll handle that today
I also forgot to mention that this may also affect the parsing of inherited package deps, but I didn't get far enough to test if that was an issue or not for cargo-make. | 2022-09-23T14:25:19Z | 0.36 | 2022-09-27T09:08:25Z | 74e54adeefbd609c5d163c6df66b787e43740428 | [
"cache::cache_test::load_from_path_not_exists",
"cache::cache_test::load_from_path_exists",
"cli::cli_test::run_bad_subcommand - should panic",
"cli_commands::list_steps::list_steps_test::run_empty",
"cli_commands::list_steps::list_steps_test::run_all_private",
"cli_commands::print_steps::print_steps_test... | [
"tests::it_works"
] | [] | [] | auto_2025-06-12 |
mozilla/cbindgen | 401 | mozilla__cbindgen-401 | [
"397"
] | 5b4cda0d95690f00a1088f6b43726a197d03dad0 | diff --git a/src/bindgen/bindings.rs b/src/bindgen/bindings.rs
--- a/src/bindgen/bindings.rs
+++ b/src/bindgen/bindings.rs
@@ -2,10 +2,13 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+use std::cell::RefCell;
+use std::collec... | diff --git a/tests/expectations/associated_in_body.cpp b/tests/expectations/associated_in_body.cpp
--- a/tests/expectations/associated_in_body.cpp
+++ b/tests/expectations/associated_in_body.cpp
@@ -32,11 +32,11 @@ struct StyleAlignFlags {
static const StyleAlignFlags END;
static const StyleAlignFlags FLEX_START;... | Initialize struct literals with list-initializer
On cbindgen 0.9.1, Values of bitflags are converted to static const items with designated initializer.
But designated initializer is not available in C++11. Sadly, It is available in C++20. https://en.cppreference.com/w/cpp/language/aggregate_initialization#Designated... | 2019-10-12T13:18:55Z | 0.9 | 2019-11-18T02:03:42Z | 5b4cda0d95690f00a1088f6b43726a197d03dad0 | [
"test_struct_literal_order"
] | [
"bindgen::mangle::generics",
"test_no_includes",
"test_custom_header",
"test_include_guard",
"test_cfg_field",
"test_alias",
"test_cdecl",
"test_docstyle_doxy",
"test_docstyle_c99",
"test_assoc_constant",
"test_annotation",
"test_body",
"test_array",
"test_include_item",
"test_assoc_cons... | [
"test_expand_features",
"test_expand_default_features",
"test_expand_dep",
"test_expand",
"test_expand_no_default_features"
] | [] | auto_2025-06-12 | |
mozilla/cbindgen | 332 | mozilla__cbindgen-332 | [
"331"
] | 46aed0802ae6b3e766dfb3f36680221c29f9d2fc | diff --git a/src/bindgen/cargo/cargo.rs b/src/bindgen/cargo/cargo.rs
--- a/src/bindgen/cargo/cargo.rs
+++ b/src/bindgen/cargo/cargo.rs
@@ -6,9 +6,11 @@ use std::path::{Path, PathBuf};
use bindgen::cargo::cargo_expand;
use bindgen::cargo::cargo_lock::{self, Lock};
+pub(crate) use bindgen::cargo::cargo_metadata::Pack... | diff --git a/src/bindgen/cargo/cargo_metadata.rs b/src/bindgen/cargo/cargo_metadata.rs
--- a/src/bindgen/cargo/cargo_metadata.rs
+++ b/src/bindgen/cargo/cargo_metadata.rs
@@ -24,23 +26,28 @@ use serde_json;
/// Starting point for metadata returned by `cargo metadata`
pub struct Metadata {
/// A list of all crate... | Plan For Refactor: Ignore Extern Crates Completely
In Rust 2018 you're idiomatically supposed to avoid using `extern crate` as much as possible (not always possible). This means cbindgen cannot rely on `extern crate` being present.
At the same time, even if `extern crate` is present, that name might be a rename tha... | 2019-04-30T19:11:42Z | 0.8 | 2019-05-02T21:39:41Z | 46aed0802ae6b3e766dfb3f36680221c29f9d2fc | [
"bindgen::mangle::generics",
"test_no_includes",
"test_docstyle_doxy",
"test_inner_mod",
"test_global_attr",
"test_union",
"test_nonnull",
"test_lifetime_arg",
"test_typedef",
"test_prefixed_struct_literal",
"test_item_types",
"test_docstyle_auto",
"test_cfg_field",
"test_assoc_const_confl... | [] | [] | [] | auto_2025-06-12 | |
mozilla/cbindgen | 293 | mozilla__cbindgen-293 | [
"100"
] | e712cc42c759ace3e47a6ee9fdbff8c4f337cec1 | diff --git a/Cargo.lock b/Cargo.lock
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -34,6 +34,8 @@ version = "0.8.0"
dependencies = [
"clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
+ "proc-macro2 0.4.25 (registry+https://github.com/... | diff --git a/.travis.yml b/.travis.yml
--- a/.travis.yml
+++ b/.travis.yml
@@ -9,11 +9,11 @@ addons:
sources:
- ubuntu-toolchain-r-test
packages:
- - gcc-4.9
- - g++-4.9
-env:
- - MATRIX_EVAL="CC=gcc-4.9 && CXX=g++-4.9"
+ - gcc-7
+ - g++-7
script:
+ - export CC=gcc-... | Handle bitflags
It would be nice to be able to use [`bitflags!`](https://github.com/rust-lang-nursery/bitflags) and have nice output generated. Ideally the output of macro expansion would just naturally work.
Currently the output of a `bitflags!` macro is a struct containing an integer, some trait implementations, a... | I can confirm the expanded output does work outside of the associated constants. For instance, with macro expansion enabled, this
```rust
bitflags! {
#[repr(C)]
pub struct Flags: u32 {
const A = 0b00000001;
}
}
#[no_mangle]
pub extern "C" fn call_flag(value: &Flags) -> u32 {
value.... | 2019-02-24T02:01:02Z | 0.8 | 2019-02-26T05:39:16Z | 46aed0802ae6b3e766dfb3f36680221c29f9d2fc | [
"bindgen::mangle::generics"
] | [] | [] | [] | auto_2025-06-12 |
mozilla/cbindgen | 519 | mozilla__cbindgen-519 | [
"518"
] | b6b88f8c3024288287368b377e4d928ddcd2b9e2 | diff --git a/docs.md b/docs.md
--- a/docs.md
+++ b/docs.md
@@ -335,7 +348,6 @@ Given configuration in the cbindgen.toml, `cbindgen` can generate these attribut
This is controlled by the `swift_name_macro` option in the cbindgen.toml.
-
## cbindgen.toml
Most configuration happens through your cbindgen.toml file... | diff --git a/docs.md b/docs.md
--- a/docs.md
+++ b/docs.md
@@ -235,6 +235,19 @@ An annotation may be a bool, string (no quotes), or list of strings. If just the
Most annotations are just local overrides for identical settings in the cbindgen.toml, but a few are unique because they don't make sense in a global contex... | Exclude parsing of module paths in crate
Hello! I ran into an issue with cbindgen where I want to expose multiple C interfaces in a single static/dynamic library but want to avoid including one of these interfaces in the generated header file.
The reason for this is that our Wasm runtime has a C API but we also wan... | Can you post a concrete example so that I can wrap my head around it please?
You can conditionally import / define stuff using `#[cfg]`, but I understand that what you want is to completely ignore a module, right?
I wonder if something like:
```rust
#[cbindgen::ignore]
mod foo;
```
or such?
Sure, but the... | 2020-05-01T02:40:21Z | 0.14 | 2020-05-15T13:43:59Z | 6b4181540c146fff75efd500bfb75a2d60403b4c | [
"bindgen::mangle::generics",
"test_const_conflict",
"test_bitflags",
"test_no_includes",
"test_cfg_field",
"test_documentation_attr",
"test_cdecl",
"test_export_name",
"test_function_sort_name",
"test_docstyle_c99",
"test_function_sort_none",
"test_cfg",
"test_constant_constexpr",
"test_as... | [] | [] | [] | auto_2025-06-12 |
mozilla/cbindgen | 501 | mozilla__cbindgen-501 | [
"500"
] | 6fd245096dcd5c50c1065b4bd6ce62a09df0b39b | diff --git a/src/bindgen/library.rs b/src/bindgen/library.rs
--- a/src/bindgen/library.rs
+++ b/src/bindgen/library.rs
@@ -54,7 +54,6 @@ impl Library {
}
pub fn generate(mut self) -> Result<Bindings, Error> {
- self.remove_excluded();
self.transfer_annotations();
self.simplify_stand... | diff --git /dev/null b/tests/expectations/both/exclude_generic_monomorph.c
new file mode 100644
--- /dev/null
+++ b/tests/expectations/both/exclude_generic_monomorph.c
@@ -0,0 +1,15 @@
+#include <stdint.h>
+
+typedef uint64_t Option_Foo;
+
+
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <std... | Manually avoid declaring opaque structs
My code uses the following types on the FFI:
```rust
struct Foo(NonZeroU64);
struct Bar {
foo: Option<Foo>,
}
```
What I want here really is `foo: u64`.
What `cbindgen` ends up producing is:
```cpp
typedef struct Option_Foo Option_Foo;
```
It looks like this opa... | @emilio @Gankra could you post your thoughts on that?
We need to confer with the Rust devs to verify that `Option<NonZeroU64>` actually has the Integer type kind in rustc's ABI lowering (naively it is an Aggregate), and that this is guaranteed. As is, the libs docs only guarantee that it has the same size.
It's also... | 2020-03-31T15:44:12Z | 0.13 | 2020-04-01T09:46:05Z | 6fd245096dcd5c50c1065b4bd6ce62a09df0b39b | [
"test_exclude_generic_monomorph"
] | [
"bindgen::mangle::generics",
"test_include_guard",
"test_custom_header",
"test_no_includes",
"test_cell",
"test_assoc_constant",
"test_char",
"test_docstyle_auto",
"test_docstyle_doxy",
"test_const_transparent",
"test_bitflags",
"test_assoc_const_conflict",
"test_reserved",
"test_cfg_2",
... | [
"test_expand_no_default_features",
"test_expand_dep",
"test_expand_features",
"test_expand",
"test_expand_default_features",
"test_expand_dep_v2"
] | [] | auto_2025-06-12 |
mozilla/cbindgen | 494 | mozilla__cbindgen-494 | [
"493"
] | 17d7aad7d07dce8aa665aedbc75c39953afe1600 | diff --git a/src/bindgen/parser.rs b/src/bindgen/parser.rs
--- a/src/bindgen/parser.rs
+++ b/src/bindgen/parser.rs
@@ -707,11 +707,22 @@ impl Parse {
return;
}
};
- if ty.is_none() {
- return;
- }
- let impl_path = ty.unwrap().get_root_path().unwr... | diff --git /dev/null b/tests/expectations/associated_constant_panic.c
new file mode 100644
--- /dev/null
+++ b/tests/expectations/associated_constant_panic.c
@@ -0,0 +1,4 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
diff --git /dev/null b/tests/expectations/associated_constant... | Panics with parse_deps=true
When running cbindgen in [this](https://github.com/RazrFalcon/ttf-parser/tree/master/c-api) dir with such config:
```toml
language = "C"
include_guard = "TTFP_H"
braces = "SameLine"
tab_width = 4
documentation_style = "doxy"
[defines]
"feature = logging" = "ENABLE_LOGGING"
[fn... | I can't can't tell whether this is the same thing or not because I can't read it, but I got: https://gist.githubusercontent.com/rainhead/cdc303c498a0d7389671942f6028a215/raw/1266d49996d41dd557987611272a3b97462906f3/cbindgen.txt
It works for me with `0.13.0`... What am I missing?
Looks like it works on master now.
Th... | 2020-03-21T14:08:30Z | 0.13 | 2020-03-21T16:23:07Z | 6fd245096dcd5c50c1065b4bd6ce62a09df0b39b | [
"test_associated_constant_panic"
] | [
"bindgen::mangle::generics",
"test_include_guard",
"test_no_includes",
"test_custom_header",
"test_cfg_2",
"test_constant_constexpr",
"test_body",
"test_char",
"test_cdecl",
"test_cfg_field",
"test_inner_mod",
"test_extern_2",
"test_prefixed_struct_literal",
"test_annotation",
"test_expo... | [
"test_expand_no_default_features",
"test_expand_features",
"test_expand_default_features",
"test_expand_dep_v2",
"test_expand_dep",
"test_expand"
] | [] | auto_2025-06-12 |
mozilla/cbindgen | 489 | mozilla__cbindgen-489 | [
"488"
] | 6654f99251769e9e037824d471f9f39e8d536b90 | diff --git a/src/bindgen/ir/ty.rs b/src/bindgen/ir/ty.rs
--- a/src/bindgen/ir/ty.rs
+++ b/src/bindgen/ir/ty.rs
@@ -392,6 +392,7 @@ impl Type {
// FIXME(#223): This is not quite correct.
"Option" if generic.is_repr_ptr() => Some(generic),
"NonNull" => Some(Type::Ptr(Box::new(generi... | diff --git /dev/null b/tests/expectations/both/cell.c
new file mode 100644
--- /dev/null
+++ b/tests/expectations/both/cell.c
@@ -0,0 +1,14 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct NotReprC_RefCell_i32 NotReprC_RefCell_i32;
+
+typedef NotReprC_RefCell_i32... | Create opaque type for a generic specialization with `RefCell` etc.
I have:
```rust
bundle.rs:
pub type Memoizer = RefCell<IntlLangMemoizer>;
pub type FluentBundle<R> = bundle::FluentBundleBase<R, Memoizer>;
ffi.rs:
type FluentBundleRc = FluentBundle<Rc<FluentResource>>;
#[no_mangle]
pub unsafe extern... | Here's a reduced test-case:
```rust
pub struct NotReprC<T> { inner: T }
pub type Foo = NotReprC<std::cell::RefCell<i32>>;
#[no_mangle]
pub extern "C" fn root(node: &Foo) {}
```
I think instead we should forward-declare RefCell in this case. Right now cbindgen's output is:
```c++
#include <cstdarg>
#inc... | 2020-03-09T00:29:19Z | 0.13 | 2020-03-09T00:49:18Z | 6fd245096dcd5c50c1065b4bd6ce62a09df0b39b | [
"test_cell"
] | [
"bindgen::mangle::generics",
"test_custom_header",
"test_no_includes",
"test_include_guard",
"test_cfg_field",
"test_cdecl",
"test_nested_import",
"test_asserted_cast",
"test_bitflags",
"test_annotation",
"test_const_conflict",
"test_display_list",
"test_constant",
"test_static",
"test_g... | [
"test_expand_features",
"test_expand_dep_v2",
"test_expand_default_features",
"test_expand_no_default_features",
"test_expand",
"test_expand_dep"
] | [] | auto_2025-06-12 |
mozilla/cbindgen | 563 | mozilla__cbindgen-563 | [
"527"
] | 6b4181540c146fff75efd500bfb75a2d60403b4c | diff --git a/src/bindgen/ir/generic_path.rs b/src/bindgen/ir/generic_path.rs
--- a/src/bindgen/ir/generic_path.rs
+++ b/src/bindgen/ir/generic_path.rs
@@ -27,18 +27,13 @@ impl GenericParams {
.collect(),
)
}
-}
-
-impl Deref for GenericParams {
- type Target = [Path];
-
- fn deref(&... | diff --git /dev/null b/tests/expectations/both/opaque.c
new file mode 100644
--- /dev/null
+++ b/tests/expectations/both/opaque.c
@@ -0,0 +1,28 @@
+#ifdef __cplusplus
+// These could be added as opaque types I guess.
+template <typename T>
+struct BuildHasherDefault;
+
+struct DefaultHasher;
+#endif
+
+
+#include <stda... | panic: Result has 2 params but is being instantiated with 1 values
cbdingen version: `v0.14.2`
To reproduce the error, run `cbindgen --lang c --output test.h test.rs`, with the source of `test.rs` being:
```rust
use std::fmt;
// Result<(), T> seems to trip up cbindgen, here T=fmt::Error
// as it was how I ran ... | Heh, was just about to post a near-identical snippet to 206. CC'ing myself, mostly, but note that it doesn't have to be Result, explicitly. The following also breaks (but *not* without the `()` type parameter):
```
#[repr(C)]
pub struct CResultTempl<O, E> {
pub result_good: bool,
pub result: *const O,
pub er... | 2020-08-14T20:16:40Z | 0.14 | 2020-08-15T11:41:05Z | 6b4181540c146fff75efd500bfb75a2d60403b4c | [
"test_opaque"
] | [
"bindgen::mangle::generics",
"test_include_guard",
"test_no_includes",
"test_custom_header",
"test_assoc_const_conflict",
"test_alias",
"test_docstyle_auto",
"test_export_name",
"test_associated_in_body",
"test_nested_import",
"test_cell",
"test_extern_2",
"test_monomorph_2",
"test_ignore"... | [] | [] | auto_2025-06-12 |
mozilla/cbindgen | 556 | mozilla__cbindgen-556 | [
"555"
] | 6ba31b49f445290a4ac1d3141f2a783306b23a88 | diff --git a/src/bindgen/bitflags.rs b/src/bindgen/bitflags.rs
--- a/src/bindgen/bitflags.rs
+++ b/src/bindgen/bitflags.rs
@@ -43,7 +43,7 @@ impl Bitflags {
}
};
- let consts = flags.expand(name);
+ let consts = flags.expand(name, repr);
let impl_ = parse_quote! {
... | diff --git a/tests/expectations/associated_in_body.c b/tests/expectations/associated_in_body.c
--- a/tests/expectations/associated_in_body.c
+++ b/tests/expectations/associated_in_body.c
@@ -14,22 +14,22 @@ typedef struct {
/**
* 'auto'
*/
-#define StyleAlignFlags_AUTO (StyleAlignFlags){ .bits = 0 }
+#define Style... | Running cbindgen on a u32 bitflag with a 1<<31 entry produces C++ code that doesn't compile
Assuming you have a setup where `cargo +nightly test` passes everything, apply this patch:
```
diff --git a/tests/rust/bitflags.rs b/tests/rust/bitflags.rs
index 6c3fe4e..017104a 100644
--- a/tests/rust/bitflags.rs
+++ b/... | 2020-07-30T14:25:00Z | 0.14 | 2020-07-31T14:22:50Z | 6b4181540c146fff75efd500bfb75a2d60403b4c | [
"test_bitflags"
] | [
"bindgen::mangle::generics",
"test_no_includes",
"test_custom_header",
"test_include_guard",
"test_monomorph_3",
"test_include_item",
"test_lifetime_arg",
"test_layout_packed_opaque",
"test_namespace_constant",
"test_export_name",
"test_constant_big",
"test_display_list",
"test_alias",
"te... | [
"test_expand_no_default_features",
"test_expand_features",
"test_expand_dep_v2",
"test_expand_default_features",
"test_expand",
"test_expand_dep"
] | [] | auto_2025-06-12 | |
mozilla/cbindgen | 479 | mozilla__cbindgen-479 | [
"476"
] | dfa6e5f9824aac416d267420f8730225011d5c8f | diff --git a/src/bindgen/ir/global.rs b/src/bindgen/ir/global.rs
--- a/src/bindgen/ir/global.rs
+++ b/src/bindgen/ir/global.rs
@@ -6,6 +6,7 @@ use std::io::Write;
use syn;
+use crate::bindgen::cdecl;
use crate::bindgen::config::Config;
use crate::bindgen::declarationtyperesolver::DeclarationTypeResolver;
use cr... | diff --git /dev/null b/tests/expectations/both/global_variable.c
new file mode 100644
--- /dev/null
+++ b/tests/expectations/both/global_variable.c
@@ -0,0 +1,8 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+extern const char CONST_GLOBAL_ARRAY[128];
+
+extern char MUT_GLOBAL... | Wrong output for static arrays
```rust
#[no_mangle]
pub static mut MCRT_ERROR_TEXT: [c_char; 128] = [0; 128];
```
outputs this
```c
extern char[128] MCRT_ERROR_TEXT;
```
when it should be this:
```c
extern char MCRT_ERROR_TEXT[128];
```
| 2020-02-25T05:38:43Z | 0.13 | 2020-02-26T01:11:02Z | 6fd245096dcd5c50c1065b4bd6ce62a09df0b39b | [
"test_global_variable"
] | [
"bindgen::mangle::generics",
"test_custom_header",
"test_no_includes",
"test_include_guard",
"test_bitflags",
"test_cdecl",
"test_display_list",
"test_cfg_2",
"test_derive_eq",
"test_mod_attr",
"test_docstyle_doxy",
"test_array",
"test_assoc_constant",
"test_fns",
"test_cfg_field",
"te... | [
"test_expand",
"test_expand_no_default_features",
"test_expand_features",
"test_expand_dep",
"test_expand_dep_v2",
"test_expand_default_features"
] | [] | auto_2025-06-12 | |
mozilla/cbindgen | 466 | mozilla__cbindgen-466 | [
"461"
] | 4cb762ec8f24f8ef3e12fcd716326a1207a88018 | diff --git a/docs.md b/docs.md
--- a/docs.md
+++ b/docs.md
@@ -589,6 +589,13 @@ swift_name_macro = "CF_SWIFT_NAME"
# default: "None"
rename_args = "PascalCase"
+# This rule specifies if the order of functions will be sorted in some way.
+#
+# "Name": sort by the name of the function
+# "None": keep order in which t... | diff --git /dev/null b/tests/expectations/both/function_sort_name.c
new file mode 100644
--- /dev/null
+++ b/tests/expectations/both/function_sort_name.c
@@ -0,0 +1,12 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+void A(void);
+
+void B(void);
+
+void C(void);
+
+void D(voi... | Keep order of exported functions
Hi,
In my project all `extern "C" pub fn`'s are declared in a single file / module.
Is it possible to ensure that the order of the generated exported functions in the header keeps same as in the module?
To me it seems that the functions are ordered by the functions name. Am I cor... | That is:
https://github.com/eqrion/cbindgen/blob/eb9cce693438d2cc6fe3d74eb5a56aa50094f68f/src/bindgen/library.rs#L58
So there's no way to workaround it at the moment. But it would be reasonable to add a config switch to avoid this. If you want to send a PR for that I'd be happy to review it :) | 2020-01-26T12:45:53Z | 0.12 | 2020-01-27T15:27:36Z | 4cb762ec8f24f8ef3e12fcd716326a1207a88018 | [
"test_function_sort_none"
] | [
"bindgen::mangle::generics",
"test_include_guard",
"test_custom_header",
"test_no_includes",
"test_layout_packed_opaque",
"test_fns",
"test_global_attr",
"test_must_use",
"test_assoc_const_conflict",
"test_annotation",
"test_docstyle_c99",
"test_nested_import",
"test_const_transparent",
"t... | [
"test_expand_dep",
"test_expand",
"test_expand_features",
"test_expand_no_default_features",
"test_expand_default_features",
"test_expand_dep_v2"
] | [] | auto_2025-06-12 |
mozilla/cbindgen | 454 | mozilla__cbindgen-454 | [
"442"
] | ff8e5d591dc8bf91a7309c54f0deb67899eeea87 | diff --git a/src/bindgen/utilities.rs b/src/bindgen/utilities.rs
--- a/src/bindgen/utilities.rs
+++ b/src/bindgen/utilities.rs
@@ -272,8 +272,7 @@ impl SynAttributeHelpers for [syn::Attribute] {
})) = attr.parse_meta()
{
if path.is_ident("doc") {
- ... | diff --git /dev/null b/tests/expectations/both/documentation_attr.c
new file mode 100644
--- /dev/null
+++ b/tests/expectations/both/documentation_attr.c
@@ -0,0 +1,20 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+/**
+ *With doc attr, each attr contribute to one line of doc... | `doc` attribute doesn't behave like rustc does
Inputs
---
```rust
#[no_mangle]
#[doc = "a \n b"]
pub extern "C" fn example_a() {}
```
and
```rust
#[no_mangle]
#[doc = "a \n\n b"]
pub extern "C" fn example_b() {}
```
Rendered rustdoc
---
[rustdoc/the doc attribute](https://doc.rust-lang.org/rustdo... | Yeah, it'd be great to get this fixed :)
After some researching I got some questions. Should I implement this translation by myself or using other crate?
One thing that bother me is that the spec of markdown line break is a bit vague. The algorithm isn't obvious to me. It might works for most cases but I'm afraid th... | 2020-01-14T11:20:17Z | 0.12 | 2020-02-19T05:11:39Z | 4cb762ec8f24f8ef3e12fcd716326a1207a88018 | [
"test_documentation_attr"
] | [
"bindgen::mangle::generics",
"test_no_includes",
"test_include_guard",
"test_custom_header",
"test_assoc_constant",
"test_array",
"test_bitflags",
"test_export_name",
"test_asserted_cast",
"test_euclid",
"test_extern",
"test_char",
"test_annotation",
"test_reserved",
"test_monomorph_1",
... | [
"test_expand",
"test_expand_no_default_features",
"test_expand_dep",
"test_expand_default_features",
"test_expand_features",
"test_expand_dep_v2"
] | [] | auto_2025-06-12 |
mozilla/cbindgen | 452 | mozilla__cbindgen-452 | [
"448"
] | ac1a7d47e87658cf36cb7e56edad7fa5f935dddd | diff --git a/docs.md b/docs.md
--- a/docs.md
+++ b/docs.md
@@ -488,7 +488,16 @@ renaming_overrides_prefixing = true
"MyType" = "my_cool_type"
"my_function" = "BetterFunctionName"
-# Table of things to add to the body of any struct, union, or enum that has the
+# Table of things to prepend to the body of any struct,... | diff --git a/tests/expectations/body.c b/tests/expectations/body.c
--- a/tests/expectations/body.c
+++ b/tests/expectations/body.c
@@ -9,6 +9,12 @@ typedef enum {
Baz1,
} MyCLikeEnum;
+typedef enum {
+ Foo1_Prepended,
+ Bar1_Prepended,
+ Baz1_Prepended,
+} MyCLikeEnum_Prepended;
+
typedef struct {
int32_t ... | Mark non-pub fields as private in c++ headers
If I have the following Rust struct:
```rust
#[repr(C)]
pub struct MyStruct {
value1: i32,
pub value2: i32
}
```
It would be very useful for the generated struct to reflect the field's visibility:
```c++
struct MyStruct {
private:
int32_t value1;... | This would need to be opt-in as having private fields breaks the [standard layout](https://en.cppreference.com/w/cpp/named_req/StandardLayoutType) contract in C++.
But more to the point, if you want a type to be opaque, then you can just not mark it `#[repr(C)]`, and cbindgen should do the right thing and forward-de... | 2020-01-12T00:31:38Z | 0.12 | 2020-01-13T13:26:22Z | 4cb762ec8f24f8ef3e12fcd716326a1207a88018 | [
"test_body"
] | [
"bindgen::mangle::generics",
"test_include_guard",
"test_custom_header",
"test_no_includes",
"test_lifetime_arg",
"test_cfg_field",
"test_assoc_constant",
"test_docstyle_auto",
"test_char",
"test_static",
"test_const_transparent",
"test_docstyle_c99",
"test_inner_mod",
"test_nested_import"... | [
"test_expand",
"test_expand_default_features",
"test_expand_no_default_features",
"test_expand_dep",
"test_expand_features",
"test_expand_dep_v2"
] | [] | auto_2025-06-12 |
mozilla/cbindgen | 447 | mozilla__cbindgen-447 | [
"283"
] | f5d76c44c466b47d1c776acd9974df838f30d431 | diff --git a/src/bindgen/parser.rs b/src/bindgen/parser.rs
--- a/src/bindgen/parser.rs
+++ b/src/bindgen/parser.rs
@@ -17,7 +17,7 @@ use crate::bindgen::ir::{
AnnotationSet, Cfg, Constant, Documentation, Enum, Function, GenericParams, ItemMap,
OpaqueItem, Path, Static, Struct, Type, Typedef, Union,
};
-use c... | diff --git a/src/bindgen/utilities.rs b/src/bindgen/utilities.rs
--- a/src/bindgen/utilities.rs
+++ b/src/bindgen/utilities.rs
@@ -39,6 +39,24 @@ pub fn find_first_some<T>(slice: &[Option<T>]) -> Option<&T> {
None
}
+pub trait SynItemFnHelpers: SynItemHelpers {
+ fn exported_name(&self) -> Option<String>;
+}... | Should respect #[export_name]
Rust supports `#[export_name = "..."]` as an alternative to `#[no_mangle]` that allows to customise exported name of various items.
| Any progress on this? 🙏
This shouldn't be hard to fix, on functions at least. `src/bindgen/parser.rs` should be tweaked to look at this attribute on top of `no_mangle` (grep for `is_no_mangle`), and tweak the `Path` to be the value of the attribute rather than the function name if it's present.
I can take a look at t... | 2020-01-07T04:32:53Z | 0.12 | 2020-01-08T14:28:21Z | 4cb762ec8f24f8ef3e12fcd716326a1207a88018 | [
"bindgen::mangle::generics",
"test_include_guard",
"test_no_includes",
"test_cfg_2",
"test_monomorph_2",
"test_include_specific",
"test_docstyle_doxy",
"test_reserved",
"test_fns",
"test_assoc_constant",
"test_namespace_constant",
"test_typedef",
"test_struct_literal",
"test_docstyle_c99",... | [] | [] | [] | auto_2025-06-12 |
axodotdev/cargo-dist | 555 | axodotdev__cargo-dist-555 | [
"547"
] | ec189bb700f4356d39ed4da5427490772e32d745 | diff --git a/cargo-dist/templates/installer/installer.sh.j2 b/cargo-dist/templates/installer/installer.sh.j2
--- a/cargo-dist/templates/installer/installer.sh.j2
+++ b/cargo-dist/templates/installer/installer.sh.j2
@@ -48,7 +48,7 @@ then unpacks the binaries and installs them to {% if install_path.kind == "Cargo
{... | diff --git a/cargo-dist/tests/gallery/dist.rs b/cargo-dist/tests/gallery/dist.rs
--- a/cargo-dist/tests/gallery/dist.rs
+++ b/cargo-dist/tests/gallery/dist.rs
@@ -370,13 +370,18 @@ impl DistResult {
let app_home = tempdir.join(format!(".{app_name}"));
let _output = script.output_checked(|cmd| ... | Installer.sh sourcing ~/.cargo/bin in ~/.profile is not always sufficient
Hi folks! Love the project!
I'm excited to have released my latest Rust project, a passphrase generator called Phraze, with cargo-dist v0.4.2. [Here's the first release that uses cargo-dist](https://github.com/sts10/phraze/releases/tag/v0.3.3... | Thanks so much for the detailed report!
> automatically add ~/.cargo/bin to the user's PATH (maybe writing the end of ~/.bashrc)
We currently try to do this; if we install to a location that's not on the user's `PATH`, we drop something into `~/.profile`, which is read by certain shells. Can you confirm if that f... | 2023-11-08T00:12:33Z | 0.5 | 2023-12-04T22:26:03Z | a44c466fd12f10d42c1f5a11b8c96fbdfde928f6 | [
"axolotlsay_user_publish_job",
"install_path_env_subdir",
"akaikatana_repo_with_dot_git",
"axolotlsay_abyss",
"install_path_env_subdir_space",
"install_path_env_subdir_space_deeper",
"axolotlsay_basic",
"axolotlsay_musl",
"axolotlsay_ssldotcom_windows_sign",
"axolotlsay_no_homebrew_publish",
"ax... | [
"backend::installer::homebrew::tests::class_caps_after_numbers",
"backend::installer::homebrew::tests::handles_pluralization",
"backend::installer::homebrew::tests::multiple_periods",
"backend::installer::homebrew::tests::handles_dashes",
"backend::installer::homebrew::tests::handles_underscores",
"backen... | [] | [] | auto_2025-06-11 |
axodotdev/cargo-dist | 483 | axodotdev__cargo-dist-483 | [
"75"
] | 7544b23b5fa938f0bb6e2b46b1dece9a79ed157b | diff --git a/cargo-dist/src/backend/ci/github.rs b/cargo-dist/src/backend/ci/github.rs
--- a/cargo-dist/src/backend/ci/github.rs
+++ b/cargo-dist/src/backend/ci/github.rs
@@ -306,8 +306,13 @@ fn package_install_for_targets(
return Some(brew_bundle_command(&packages));
}
- "i68... | diff --git a/cargo-dist/tests/integration-tests.rs b/cargo-dist/tests/integration-tests.rs
--- a/cargo-dist/tests/integration-tests.rs
+++ b/cargo-dist/tests/integration-tests.rs
@@ -225,6 +225,37 @@ scope = "@axodotdev"
})
}
+#[test]
+fn axolotlsay_musl() -> Result<(), miette::Report> {
+ let test_name = _f... | musl support (prefer musl for linux?)
Prebuilt binaries for linux are a mess for various reasons (e.g. #73), and preferring musl over glibc fixes some of those issues (in exchange for other subtle problems that I'm assured are minor in comparison).
This requires some basic cross-compilation support to get the toolch... | In my experience, it is not always straightforward to get binary compiled against musl and/or static build. Just to name a few showstoppers:
* the features that require udev and dbus usually need to be feature-flagged and disabled in musl context
* openssl is another common problem for static linking
Thus, when we... | 2023-10-17T00:26:40Z | 4.0 | 2023-10-17T18:47:00Z | 7544b23b5fa938f0bb6e2b46b1dece9a79ed157b | [
"akaikatana_musl",
"axolotlsay_musl"
] | [
"akaikatana_basic",
"akaikatana_repo_with_dot_git",
"axoasset_basic - should panic",
"axolotlsay_basic",
"axolotlsay_edit_existing",
"axolotlsay_ssldotcom_windows_sign_prod",
"axolotlsay_ssldotcom_windows_sign",
"env_path_invalid - should panic",
"install_path_home_subdir_min",
"install_path_cargo... | [] | [] | auto_2025-06-11 |
axodotdev/cargo-dist | 1,655 | axodotdev__cargo-dist-1655 | [
"1355"
] | aa437ee6ed8b01bf28cfcac1d2fa1a7fe95979a6 | diff --git a/Cargo.lock b/Cargo.lock
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -216,9 +216,9 @@ dependencies = [
[[package]]
name = "axoupdater"
-version = "0.8.2"
+version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a70b7d3a9ea86ef8d17dada23f2c42518ed4b75dd6a8ff761f8988b448d... | diff --git a/cargo-dist/src/lib.rs b/cargo-dist/src/lib.rs
--- a/cargo-dist/src/lib.rs
+++ b/cargo-dist/src/lib.rs
@@ -255,7 +255,7 @@ fn run_build_step(
}
const AXOUPDATER_ASSET_ROOT: &str = "https://github.com/axodotdev/axoupdater/releases";
-const AXOUPDATER_MINIMUM_VERSION: &str = "0.7.0";
+const AXOUPDATER_MIN... | fix: Make RECEIPT_HOME variable XDG compliant
The setting of RECEIPT_HOME using "${HOME}/.config" will fail for users who move their config folder elsewhere using XDG_CONFIG_HOME. Both dash and bash (the usual interpreters for /bin/sh) both support parameter substitution.
| (failures are just needing to run `cargo test`, `cargo insta review --accept`, i can do that for you)
Oh haha, because this PR is from the `main` branch of your fork I'm not actually allowed to push to it 😅
I can move this to another branch, but I believe I would need to re-submit a PR? I don't think we can edit the... | 2024-12-18T22:29:30Z | 0.26 | 2024-12-20T00:00:15Z | aa437ee6ed8b01bf28cfcac1d2fa1a7fe95979a6 | [
"test_manifest",
"akaikatana_two_bin_aliases",
"akaikatana_basic",
"akaikatana_musl",
"akaikatana_updaters",
"akaikatana_one_alias_among_many_binaries",
"axolotlsay_abyss",
"axolotlsay_abyss_only",
"axolotlsay_alias",
"axolotlsay_basic_lies",
"axolotlsay_alias_ignores_missing_bins",
"axolotlsa... | [
"announce::tests::sort_platforms",
"backend::ci::github::tests::validator_catches_run_and_cwd - should panic",
"backend::ci::github::tests::validator_errors_with_id - should panic",
"backend::ci::github::tests::validator_catches_invalid_with - should panic",
"backend::ci::github::tests::validator_catches_ru... | [
"axolotlsay_basic"
] | [] | auto_2025-06-11 |
axodotdev/cargo-dist | 1,586 | axodotdev__cargo-dist-1586 | [
"1585"
] | 4c2cd562aac54b7a428a789a9f1c66388f024730 | diff --git a/cargo-dist/src/platform.rs b/cargo-dist/src/platform.rs
--- a/cargo-dist/src/platform.rs
+++ b/cargo-dist/src/platform.rs
@@ -246,7 +246,8 @@ use crate::{
};
use targets::{
- TARGET_ARM64_MAC, TARGET_ARM64_WINDOWS, TARGET_X64_MAC, TARGET_X64_WINDOWS, TARGET_X86_WINDOWS,
+ TARGET_ARM64_MAC, TARGET... | diff --git a/cargo-dist/tests/integration-tests.rs b/cargo-dist/tests/integration-tests.rs
--- a/cargo-dist/tests/integration-tests.rs
+++ b/cargo-dist/tests/integration-tests.rs
@@ -37,7 +37,7 @@ cargo-dist-version = "{dist_version}"
installers = ["shell", "powershell", "homebrew", "npm", "msi", "pkg"]
tap = "axodot... | PowerShell installer not generated for pc-windows-gnu
We've been improving support for `pc-windows-gnu` targets recently, but a major exception: the powershell installers skip all `pc-windows-gnu` builds. We should make sure this gets fixed.
| 2024-12-02T18:07:26Z | 1.70 | 2024-12-05T17:28:20Z | 4c2cd562aac54b7a428a789a9f1c66388f024730 | [
"akaikatana_basic",
"akaikatana_one_alias_among_many_binaries",
"axolotlsay_abyss_only",
"akaikatana_two_bin_aliases",
"axolotlsay_alias_ignores_missing_bins",
"akaikatana_updaters",
"axolotlsay_basic_lies",
"axolotlsay_alias",
"axolotlsay_abyss",
"axolotlsay_build_setup_steps",
"axolotlsay_cros... | [
"akaikatana_musl",
"axoasset_basic - should panic",
"axolotlsay_checksum_blake2s",
"axolotlsay_checksum_sha3_256",
"axolotlsay_checksum_sha3_512",
"axolotlsay_cross2",
"axolotlsay_custom_formula",
"axolotlsay_custom_github_runners",
"axolotlsay_dispatch",
"axolotlsay_dispatch_abyss",
"axolotlsay... | [
"axolotlsay_basic"
] | [
"axolotlsay_checksum_blake2b"
] | auto_2025-06-11 | |
axodotdev/cargo-dist | 1,465 | axodotdev__cargo-dist-1465 | [
"1321"
] | bba11f3423f7fd253b46ea8d7d3c47ea420508dc | diff --git a/cargo-dist-schema/src/lib.rs b/cargo-dist-schema/src/lib.rs
--- a/cargo-dist-schema/src/lib.rs
+++ b/cargo-dist-schema/src/lib.rs
@@ -501,6 +501,9 @@ pub enum ArtifactKind {
/// A checksum of another artifact
#[serde(rename = "checksum")]
Checksum,
+ /// The checksums of many artifacts
+ ... | diff --git a/cargo-dist/tests/gallery/dist.rs b/cargo-dist/tests/gallery/dist.rs
--- a/cargo-dist/tests/gallery/dist.rs
+++ b/cargo-dist/tests/gallery/dist.rs
@@ -104,6 +104,7 @@ pub struct AppResult {
homebrew_installer_path: Option<Utf8PathBuf>,
powershell_installer_path: Option<Utf8PathBuf>,
npm_insta... | add unified checksum file
We can/should generate a single checksum file instead of a dozen. The multiple files were necessary Long Ago and no longer are.
| 2024-10-17T21:26:43Z | 0.23 | 2024-10-23T17:43:15Z | bba11f3423f7fd253b46ea8d7d3c47ea420508dc | [
"test_manifest",
"akaikatana_basic",
"akaikatana_musl",
"akaikatana_one_alias_among_many_binaries",
"akaikatana_two_bin_aliases",
"akaikatana_updaters",
"axolotlsay_build_setup_steps",
"axolotlsay_abyss",
"axolotlsay_abyss_only",
"axolotlsay_alias",
"axolotlsay_basic",
"axolotlsay_checksum_bla... | [
"announce::tests::sort_platforms",
"backend::ci::github::tests::validator_catches_run_and_uses - should panic",
"backend::ci::github::tests::validator_works",
"backend::ci::github::tests::build_setup_with_if",
"backend::installer::homebrew::tests::class_caps_after_numbers",
"backend::installer::homebrew::... | [] | [] | auto_2025-06-11 | |
axodotdev/cargo-dist | 417 | axodotdev__cargo-dist-417 | [
"379"
] | 095cfcf7f5a02870aadac8a0d45c431c7b08373c | diff --git a/cargo-dist/src/backend/ci/github.rs b/cargo-dist/src/backend/ci/github.rs
--- a/cargo-dist/src/backend/ci/github.rs
+++ b/cargo-dist/src/backend/ci/github.rs
@@ -38,6 +38,8 @@ pub struct GithubCiInfo {
pub tap: Option<String>,
/// publish jobs
pub publish_jobs: Vec<String>,
+ /// user-spe... | diff --git a/cargo-dist/tests/integration-tests.rs b/cargo-dist/tests/integration-tests.rs
--- a/cargo-dist/tests/integration-tests.rs
+++ b/cargo-dist/tests/integration-tests.rs
@@ -194,6 +194,37 @@ path-guid = "BFD25009-65A4-4D1E-97F1-0030465D90D6"
})
}
+#[test]
+fn axolotlsay_user_publish_job() -> Result<(),... | release lifecycle plugins
This is the followup and ultimate payoff of #378
Expose/upgrade `publish-jobs = [...]` and `upload-jobs = [...]` so that users can refer to their own .yml files that cargo-dist embeds into release.yml and weaves into the dependency graph. This could be used for:
* Adding custom publish ... | Thinking about this a little more: I'm not sure we want the extra jobs to be YML we include in `release.yml`, because then we tie ourselves too specifically to GitHub. We've got plans to support other CI systems - I wouldn't want us to have ended up limiting ourselves there.
I figured the feature would be ci-backend-ge... | 2023-09-08T01:49:59Z | 4.0 | 2023-09-27T12:14:41Z | 7544b23b5fa938f0bb6e2b46b1dece9a79ed157b | [
"axolotlsay_user_publish_job"
] | [
"akaikatana_repo_with_dot_git",
"axolotlsay_basic",
"akaikatana_basic",
"axolotlsay_edit_existing",
"axolotlsay_no_homebrew_publish",
"axolotlsay_ssldotcom_windows_sign",
"axolotlsay_ssldotcom_windows_sign_prod",
"env_path_invalid - should panic",
"install_path_env_subdir",
"install_path_cargo_hom... | [] | [] | auto_2025-06-11 |
axodotdev/cargo-dist | 367 | axodotdev__cargo-dist-367 | [
"366"
] | b3c413953f319841c755dc9247035122f26918f3 | diff --git a/book/src/config.md b/book/src/config.md
--- a/book/src/config.md
+++ b/book/src/config.md
@@ -305,6 +305,24 @@ Prior to 0.1.0 we didn't set the correct flags in our CI scripts to do this, but
This flag was introduced to allow you to restore the old behaviour if you prefer.
+### create-release
+
+> sin... | diff --git a/cargo-dist/tests/integration-tests.rs b/cargo-dist/tests/integration-tests.rs
--- a/cargo-dist/tests/integration-tests.rs
+++ b/cargo-dist/tests/integration-tests.rs
@@ -89,6 +89,39 @@ scope = "@axodotdev"
})
}
+#[test]
+fn axolotlsay_edit_existing() -> Result<(), miette::Report> {
+ let test_na... | create way to turn off release creation
https://github.com/libsql/sqld/pull/625/commits/1c652b9daece08082485766227994bbdf72349db
- separate dist plan from release creation
- allow config that doesn't add the create-release job
| 2023-08-25T16:38:43Z | 4.0 | 2023-08-28T20:04:52Z | 7544b23b5fa938f0bb6e2b46b1dece9a79ed157b | [
"axolotlsay_edit_existing"
] | [
"akaikatana_repo_with_dot_git",
"axolotlsay_basic",
"akaikatana_basic",
"axolotlsay_no_homebrew_publish",
"install_path_cargo_home",
"env_path_invalid - should panic",
"install_path_env_no_subdir",
"install_path_env_subdir",
"install_path_env_subdir_space",
"install_path_env_subdir_space_deeper",
... | [] | [] | auto_2025-06-11 | |
axodotdev/cargo-dist | 275 | axodotdev__cargo-dist-275 | [
"205"
] | b9856c45e81d5996d691af60e96bc5f9bfe3d990 | diff --git a/book/src/config.md b/book/src/config.md
--- a/book/src/config.md
+++ b/book/src/config.md
@@ -67,17 +67,19 @@ If you delete the key, generate-ci will just use the version of cargo-dist that'
### rust-toolchain-version
-> since 0.0.3
+> since 0.0.3 (deprecated in 0.1.0)
Example: `rust-toolchain-vers... | diff --git a/cargo-dist-schema/cargo-dist-json-schema.json b/cargo-dist-schema/cargo-dist-json-schema.json
--- a/cargo-dist-schema/cargo-dist-json-schema.json
+++ b/cargo-dist-schema/cargo-dist-json-schema.json
@@ -320,6 +331,19 @@
}
}
}
+ },
+ "SystemInfo": {
+ "description": "Inf... | default to the version specified in `rust-toolchain.toml` when `rust-toolchain-version` not provided
I use cargo's `rust-toolchain.toml` to pin my rust version to a specific stable release.
This enforces that developers and CI all run the same version of rust.
It also allows me to set CI to fail if any rustc or clipp... | i think this is an interesting idea, @rukai - thanks for submitting! given that the project has a goal to fit well into rust workflows, respecting rustup configs makes sense to me.
when you get a sec, i'm curious what your thoughts are @Gankra?
oh whoops i forgot to reply but yes totally
This is now at the top of m... | 2023-07-17T19:44:23Z | 1.67 | 2023-07-18T21:21:38Z | 290112d4c8693266bf9e4f858d9a6424daa40585 | [
"emit",
"test_error_manifest",
"test_lib_manifest",
"test_manifest"
] | [
"tests::test_some_op",
"test_version",
"test_short_help",
"test_long_help",
"test_markdown_help"
] | [] | [] | auto_2025-06-11 |
axodotdev/cargo-dist | 1,189 | axodotdev__cargo-dist-1189 | [
"1187"
] | f18f6835769670a7ad9c6be221d42e9a6c8185e4 | diff --git a/cargo-dist/templates/installer/installer.sh.j2 b/cargo-dist/templates/installer/installer.sh.j2
--- a/cargo-dist/templates/installer/installer.sh.j2
+++ b/cargo-dist/templates/installer/installer.sh.j2
@@ -485,7 +485,7 @@ install() {
add_install_dir_to_ci_path "$_install_dir"
add_install_... | diff --git a/cargo-dist/tests/gallery/dist/shell.rs b/cargo-dist/tests/gallery/dist/shell.rs
--- a/cargo-dist/tests/gallery/dist/shell.rs
+++ b/cargo-dist/tests/gallery/dist/shell.rs
@@ -53,8 +53,8 @@ impl AppResult {
// Check that the script wrote files where we expected
let rcfiles = &[
+ ... | Installer Bash source injection is still insufficient on some distros (Fedora, RHEL-compatibles)
Related to #547 - on at least Fedora 40 and AlmaLinux 9, the current sourcing injection logic isn't sufficient for non-login Bash shells.
This seems to be due to the RPM family (?) having a `skel` like this:
```
.bash... | Oh interesting - good catch, thank you! I see you submitted a PR; I'll take a look. | 2024-07-08T02:31:04Z | 0.19 | 2024-07-22T23:30:59Z | f18f6835769670a7ad9c6be221d42e9a6c8185e4 | [
"akaikatana_musl",
"akaikatana_basic",
"akaikatana_one_alias_among_many_binaries",
"akaikatana_two_bin_aliases",
"akaikatana_updaters",
"axolotlsay_abyss",
"axolotlsay_abyss_only",
"axolotlsay_alias",
"axolotlsay_basic",
"axolotlsay_alias_ignores_missing_bins",
"axolotlsay_basic_lies",
"axolot... | [
"backend::installer::homebrew::tests::class_case_basic",
"backend::installer::homebrew::tests::ampersand_but_no_digit",
"backend::installer::homebrew::tests::class_caps_after_numbers",
"backend::installer::homebrew::tests::handles_dashes",
"backend::installer::homebrew::tests::ends_with_dash",
"backend::i... | [] | [] | auto_2025-06-11 |
axodotdev/cargo-dist | 1,067 | axodotdev__cargo-dist-1067 | [
"1056"
] | 51b6bd3138c92896fab7d62caad3285e0ca3fea6 | diff --git a/Cargo.lock b/Cargo.lock
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -308,6 +308,15 @@ version = "2.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1"
+[[package]]
+name = "blake2"
+version = "0.10.6"
+source = "re... | diff --git a/cargo-dist/tests/integration-tests.rs b/cargo-dist/tests/integration-tests.rs
--- a/cargo-dist/tests/integration-tests.rs
+++ b/cargo-dist/tests/integration-tests.rs
@@ -1560,3 +1560,119 @@ path-guid = "BFD25009-65A4-4D1E-97F1-0030465D90D6"
Ok(())
})
}
+
+#[test]
+fn axolotlsay_checksum_sha3... | Supports SHA-3 and BLAKE2 as checksum algorithms
Currently, it only supports SHA-2 (SHA-256 and SHA-512), but I think it would be useful to support SHA-3 and BLAKE2 as well.
- <https://crates.io/crates/blake2>
- <https://crates.io/crates/sha3>
| 2024-05-17T13:15:47Z | 4.5 | 2024-05-20T19:56:44Z | ff3d2ba9b0f0a25bb64dbf8d31e865fb32b9a2f1 | [
"axolotlsay_checksum_blake2b",
"axolotlsay_checksum_blake2s",
"axolotlsay_checksum_sha3_256",
"axolotlsay_checksum_sha3_512"
] | [
"akaikatana_one_alias_among_many_binaries",
"akaikatana_musl",
"akaikatana_basic",
"akaikatana_updaters",
"akaikatana_two_bin_aliases",
"axolotlsay_alias_ignores_missing_bins",
"axoasset_basic - should panic",
"axolotlsay_basic_lies",
"axolotlsay_alias",
"axolotlsay_abyss",
"axolotlsay_abyss_onl... | [] | [] | auto_2025-06-11 | |
axodotdev/cargo-dist | 1,024 | axodotdev__cargo-dist-1024 | [
"1020"
] | 19a6a16993acdc577c91955f1963c2838e9d1f42 | diff --git a/cargo-dist/src/host.rs b/cargo-dist/src/host.rs
--- a/cargo-dist/src/host.rs
+++ b/cargo-dist/src/host.rs
@@ -274,7 +274,7 @@ pub(crate) fn select_hosting(
let hosting_providers = hosting
.clone()
.or_else(|| Some(vec![ci.as_ref()?.first()?.native_hosting()?]))?;
- let repo_url = ... | diff --git a/cargo-dist/tests/gallery/dist.rs b/cargo-dist/tests/gallery/dist.rs
--- a/cargo-dist/tests/gallery/dist.rs
+++ b/cargo-dist/tests/gallery/dist.rs
@@ -38,7 +38,7 @@ pub static AXOLOTLSAY: TestContextLock<Tools> = TestContextLock::new(
&Repo {
repo_owner: "axodotdev",
repo_name: "axolo... | curl url issues-requested URL returned error: 404
## Description
Throwing error while installing released application using the mention url in the release not.
``` curl: (22) The requested URL returned error: 404 ``` this is due the extension of `.git` with the url.
current url `https://github.com/hugobyte/compos... | 2024-05-08T17:03:58Z | 0.14 | 2024-05-08T19:42:08Z | 19a6a16993acdc577c91955f1963c2838e9d1f42 | [
"axolotlsay_abyss",
"axolotlsay_custom_formula",
"axolotlsay_alias",
"axolotlsay_alias_ignores_missing_bins",
"axolotlsay_basic",
"axolotlsay_basic_lies",
"axolotlsay_custom_github_runners",
"axolotlsay_disable_source_tarball",
"axolotlsay_dispatch",
"axolotlsay_dispatch_abyss",
"axolotlsay_edit... | [
"backend::installer::homebrew::tests::ampersand_but_no_digit",
"backend::installer::homebrew::tests::class_caps_after_numbers",
"backend::installer::homebrew::tests::class_case_basic",
"backend::installer::homebrew::tests::ends_with_dash",
"backend::installer::homebrew::tests::handles_dashes",
"announce::... | [] | [] | auto_2025-06-11 | |
axodotdev/cargo-dist | 791 | axodotdev__cargo-dist-791 | [
"777"
] | 17c4a1aa16fd97c8518872795d14b793e0141476 | diff --git a/book/src/installers/homebrew.md b/book/src/installers/homebrew.md
--- a/book/src/installers/homebrew.md
+++ b/book/src/installers/homebrew.md
@@ -11,6 +11,26 @@ tap = "axodotdev/homebrew-formulae"
publish-jobs = ["homebrew"]
```
+Since 0.11.0, cargo-dist can, optionally, also customize your Homebrew fo... | diff --git a/cargo-dist/tests/gallery/dist.rs b/cargo-dist/tests/gallery/dist.rs
--- a/cargo-dist/tests/gallery/dist.rs
+++ b/cargo-dist/tests/gallery/dist.rs
@@ -209,21 +209,51 @@ impl<'a> TestContext<'a, Tools> {
// read/analyze installers
eprintln!("loading results...");
let app_name = &se... | Allow publishing under bin name instead of package name
Hello!
We want to publish our binary on homebrew under the binary name, but it is published under the crate name. Is there a way to do that?
| We don't currently support this, but we can look into adding it in the future.
Do you think there is a workaround in the meantime? Our issue is that we changed the crate name in our repo, and cargo dist added a new formula to our homebrew, with the new name, meaning that the official formula is not getting new releases... | 2024-02-13T17:58:55Z | 0.10 | 2024-02-22T20:59:33Z | 72bc61a2cb55117dda2522a77098e87fc336c7a0 | [
"backend::installer::homebrew::tests::ampersand_but_no_digit",
"backend::installer::homebrew::tests::class_caps_after_numbers",
"backend::installer::homebrew::tests::class_case_basic",
"backend::installer::homebrew::tests::handles_dashes",
"backend::installer::homebrew::tests::ends_with_dash",
"announce::... | [] | [] | [] | auto_2025-06-11 |
axodotdev/cargo-dist | 776 | axodotdev__cargo-dist-776 | [
"773"
] | 4bf34bcf55a95c67b0b56708e33826a550bb2f1d | diff --git a/cargo-dist/templates/installer/installer.ps1.j2 b/cargo-dist/templates/installer/installer.ps1.j2
--- a/cargo-dist/templates/installer/installer.ps1.j2
+++ b/cargo-dist/templates/installer/installer.ps1.j2
@@ -191,7 +191,7 @@ function Invoke-Installer($bin_paths) {
$dest_dir = Join-Path $root "bin"
... | diff --git a/cargo-dist/tests/gallery/dist.rs b/cargo-dist/tests/gallery/dist.rs
--- a/cargo-dist/tests/gallery/dist.rs
+++ b/cargo-dist/tests/gallery/dist.rs
@@ -382,6 +382,7 @@ impl DistResult {
tempdir.join(".bash_profile"),
tempdir.join(".zshrc"),
];
+ let r... | sed error in install script
I'm using `cargo-dist` in a project, and was testing out the install script and saw an error message.
```
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/ethankhall/scope/releases/download/v2024.2.4/dev-scope-installer.sh | sh
sed: 1: "s,"CARGO_DIST_BINS","sc ...": bad flag in ... | Ah shoot
```
RECEIPT="$(echo "$RECEIPT" | sed s,'"CARGO_DIST_BINS"',"$_bins_js_array",)"
```
This sed uses `,` instead of `/` to avoid the obvious problems of path separators, but then runs into the fact that we represent a list of binaries as `a,b`... which makes using `,` as a delimiter freak out.
This... | 2024-02-06T05:47:48Z | 0.9 | 2024-02-13T02:45:08Z | 4bf34bcf55a95c67b0b56708e33826a550bb2f1d | [
"akaikatana_basic",
"akaikatana_repo_with_dot_git",
"akaikatana_musl",
"axolotlsay_abyss",
"axolotlsay_edit_existing",
"axolotlsay_musl",
"axolotlsay_abyss_only",
"axolotlsay_musl_no_gnu",
"axolotlsay_basic",
"axolotlsay_no_homebrew_publish",
"axolotlsay_ssldotcom_windows_sign",
"axolotlsay_ss... | [
"backend::installer::homebrew::tests::class_caps_after_numbers",
"backend::installer::homebrew::tests::ampersand_but_no_digit",
"backend::installer::homebrew::tests::class_case_basic",
"backend::installer::homebrew::tests::handles_pluralization",
"backend::installer::homebrew::tests::handles_dashes",
"bac... | [] | [] | auto_2025-06-11 |
killercup/cargo-edit | 304 | killercup__cargo-edit-304 | [
"303"
] | 579f9497aee2757a6132d9fbde6fd6ef2fafa884 | diff --git a/src/dependency.rs b/src/dependency.rs
--- a/src/dependency.rs
+++ b/src/dependency.rs
@@ -44,6 +44,10 @@ impl Dependency {
/// Set dependency to a given version
pub fn set_version(mut self, version: &str) -> Dependency {
+ // versions might have semver metadata appended which we do not w... | diff --git a/tests/cargo-add.rs b/tests/cargo-add.rs
--- a/tests/cargo-add.rs
+++ b/tests/cargo-add.rs
@@ -493,6 +493,47 @@ fn adds_local_source_with_version_flag() {
assert_eq!(val["version"].as_str(), Some("0.4.3"));
}
+#[test]
+fn adds_local_source_with_version_flag_and_semver_metadata() {
+ let (_tmpdir,... | cargo-edit adds semver metadata
Currently if one adds `zstd` one ends up with `0.4.24+zstd.1.4.0` as version which causes a warning on compile:
warning: version requirement` 0.4.24+zstd.1.4.0` for dependency `zstd`
includes semver metadata which will be ignored, removing the metadata is
recommended to ... | 2019-06-03T17:21:04Z | 0.3 | 2019-06-03T19:17:56Z | 70b359b1c4c3e46f07c337215dc32a700a8557e1 | [
"adds_local_source_with_version_flag_and_semver_metadata",
"adds_git_source_without_flag"
] | [
"fetch::get_latest_version_from_json_test",
"fetch::get_latest_stable_version_from_json",
"fetch::get_latest_unstable_or_stable_version_from_json",
"fetch::get_no_latest_version_from_json_when_all_are_yanked",
"manifest::tests::remove_dependency_no_section",
"manifest::tests::add_remove_dependency",
"ma... | [
"args::tests::test_repo_as_arg_parsing"
] | [] | auto_2025-06-11 | |
killercup/cargo-edit | 290 | killercup__cargo-edit-290 | [
"211"
] | 26a641e71f1190d9a8764b538211396f71e6c0a0 | 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/bin/add/args.rs b/src/bin/add/args.rs
--- a/src/bin/add/args.rs
+++ b/src... | diff --git a/src/bin/add/args.rs b/src/bin/add/args.rs
--- a/src/bin/add/args.rs
+++ b/src/bin/add/args.rs
@@ -77,7 +79,9 @@ impl Args {
krate
} else {
get_latest_dependency(crate_name, self.flag_allow_prerelease)?
- ... | Add option to add `default-features = false`
Commonly used when working with no_std.
| 2019-05-06T14:51:05Z | 0.3 | 2019-05-07T19:57:36Z | 70b359b1c4c3e46f07c337215dc32a700a8557e1 | [
"fetch::get_latest_stable_version_from_json",
"fetch::get_latest_version_from_json_test",
"fetch::get_latest_unstable_or_stable_version_from_json",
"fetch::get_no_latest_version_from_json_when_all_are_yanked",
"manifest::tests::remove_dependency_no_section",
"manifest::tests::add_remove_dependency",
"ma... | [] | [] | [] | auto_2025-06-11 | |
killercup/cargo-edit | 289 | killercup__cargo-edit-289 | [
"284"
] | 26a641e71f1190d9a8764b538211396f71e6c0a0 | 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/README.md b/README.md
--- a/README.md
+++ b/README.md
@@ -125,6 +125,7 @@ $ c... | diff --git a/tests/cargo-rm.rs b/tests/cargo-rm.rs
--- a/tests/cargo-rm.rs
+++ b/tests/cargo-rm.rs
@@ -14,6 +14,19 @@ fn remove_existing_dependency() {
assert!(toml["dependencies"]["docopt"].is_none());
}
+#[test]
+fn remove_multiple_existing_dependencies() {
+ let (_tmpdir, manifest) = clone_out_test("tests... | `rm` subcommand does not support multiple crates
When adding crates, `add` allows me to add multiple crates at once:
```
cargo add serde serde_derive
```
I would expect `rm` to operate in the same fashion:
```
cargo rm serde serde_derive
```
Instead I get `Invalid arguments`, along with a usage statement.
... | Yes, that would be nice for consistency. Thanks for the suggestion!
The relevant code for `cargo add` is [here](https://github.com/killercup/cargo-edit/blob/26a641e71f1190d9a8764b538211396f71e6c0a0/src/bin/add/args.rs#L15-L16), [here](https://github.com/killercup/cargo-edit/blob/26a641e71f1190d9a8764b538211396f71e6c0a... | 2019-05-05T20:49:46Z | 0.3 | 2019-05-07T21:28:20Z | 70b359b1c4c3e46f07c337215dc32a700a8557e1 | [
"args::tests::test_repo_as_arg_parsing",
"no_argument",
"invalid_dependency_in_section",
"rm_prints_messages_for_multiple",
"remove_multiple_existing_dependencies",
"remove_section_after_removed_last_dependency",
"remove_multiple_existing_dependencies_from_specific_section"
] | [
"fetch::get_latest_version_from_json_test",
"fetch::get_latest_unstable_or_stable_version_from_json",
"fetch::get_latest_stable_version_from_json",
"fetch::get_no_latest_version_from_json_when_all_are_yanked",
"manifest::tests::remove_dependency_no_section",
"manifest::tests::remove_dependency_non_existen... | [
"adds_git_source_without_flag"
] | [] | auto_2025-06-11 |
killercup/cargo-edit | 558 | killercup__cargo-edit-558 | [
"557"
] | 59b5c040bce40f3df1a39de766176d4880110fa8 | diff --git a/Cargo.lock b/Cargo.lock
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -154,9 +154,9 @@ version = "0.8.0"
dependencies = [
"assert_cmd",
"assert_fs",
- "atty",
"cargo_metadata",
"clap",
+ "concolor-control",
"crates-index",
"dirs-next",
"dunce",
diff --git a/Cargo.toml b/Cargo.toml
--- a/Cargo.toml
++... | diff --git a/Cargo.toml b/Cargo.toml
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -92,7 +92,8 @@ add = ["cli"]
rm = ["cli"]
upgrade = ["cli"]
set-version = ["cli"]
-cli = ["atty", "clap"]
+cli = ["color", "clap"]
+color = ["concolor-control/auto"]
test-external-apis = []
vendored-openssl = ["git2/vendored-openssl"]
vendo... | dependency in atty is marked as optional while it's required
If you try to add a dependency on `cargo-edit` as following
```
cargo-edit = { version = "0.8.0", default-features = false, features = ["vendored-openssl", "vendored-libgit2"] }
```
it fails to compile:
```
--> cargo-edit-0.8.0/src/fetch.rs:96:26
... | 2022-01-10T13:46:24Z | 0.8 | 2022-01-10T16:36:39Z | e8ab2d031eabbad815e3c14d80663dd7e8b85966 | [
"dependency::tests::paths_with_forward_slashes_are_left_as_is",
"dependency::tests::to_toml_dep_from_alt_registry",
"dependency::tests::to_toml_dep_with_git_source",
"dependency::tests::to_toml_complex_dep",
"dependency::tests::to_toml_renamed_dep",
"dependency::tests::to_toml_dep_without_default_features... | [] | [] | [] | auto_2025-06-11 | |
killercup/cargo-edit | 545 | killercup__cargo-edit-545 | [
"474"
] | c85829043979c1d5ea1845d6657186d1c13a623f | diff --git a/src/bin/add/args.rs b/src/bin/add/args.rs
--- a/src/bin/add/args.rs
+++ b/src/bin/add/args.rs
@@ -307,7 +307,10 @@ impl Args {
}
/// Build dependencies from arguments
- pub fn parse_dependencies(&self) -> Result<Vec<Dependency>> {
+ pub fn parse_dependencies(
+ &self,
+ requ... | diff --git a/src/bin/add/args.rs b/src/bin/add/args.rs
--- a/src/bin/add/args.rs
+++ b/src/bin/add/args.rs
@@ -395,7 +398,7 @@ mod tests {
};
assert_eq!(
- args.parse_dependencies().unwrap(),
+ args.parse_dependencies(None).unwrap(),
vec, we also have logic for getting `Cargo.toml` from git repos and paths. The main issue is plugging all of this together to get the list of features to validate them.
#193 is related
The main grievance ... | 2021-11-18T16:58:46Z | 0.8 | 2021-11-18T20:15:14Z | e8ab2d031eabbad815e3c14d80663dd7e8b85966 | [
"dependency::tests::to_toml_optional_dep",
"dependency::tests::to_toml_dep_without_default_features",
"dependency::tests::to_toml_dep_with_path_source",
"dependency::tests::paths_with_forward_slashes_are_left_as_is",
"dependency::tests::to_toml_dep_with_git_source",
"dependency::tests::to_toml_dep_from_al... | [] | [] | [] | auto_2025-06-11 |
killercup/cargo-edit | 527 | killercup__cargo-edit-527 | [
"526"
] | 712aeb70a91322507bb785cfd6d25ffd8fca8fd1 | diff --git a/src/bin/add/main.rs b/src/bin/add/main.rs
--- a/src/bin/add/main.rs
+++ b/src/bin/add/main.rs
@@ -74,7 +74,7 @@ fn print_msg(dep: &Dependency, section: &[String], optional: bool) -> Result<()>
} else {
ColorChoice::Never
};
- let mut output = StandardStream::stdout(colorchoice);
+ ... | diff --git a/tests/cargo-add.rs b/tests/cargo-add.rs
--- a/tests/cargo-add.rs
+++ b/tests/cargo-add.rs
@@ -1441,7 +1441,7 @@ fn adds_dependency_normalized_name() {
&format!("--manifest-path={}", manifest),
])
.success()
- .stdout(predicates::str::contains(
+ .stderr(predicat... | User messages should be printed to stderr
Cargo seems to print programamtic messages to stdout and user messages to stderr. This came up in #524. We should do similar.
| 2021-10-11T13:46:23Z | 0.8 | 2021-10-11T14:06:16Z | e8ab2d031eabbad815e3c14d80663dd7e8b85966 | [
"add_prints_message_with_section",
"add_prints_message",
"add_prints_message_for_dev_deps",
"add_prints_message_for_features_deps",
"add_prints_message_for_build_deps",
"rm_prints_messages_for_multiple",
"rm_prints_message"
] | [
"fetch::test_gen_fuzzy_crate_names",
"version::test::increment::metadata",
"version::test::upgrade_requirement::tilde_minor",
"version::test::upgrade_requirement::equal_patch",
"version::test::upgrade_requirement::equal_minor",
"version::test::upgrade_requirement::caret_patch",
"version::test::upgrade_r... | [] | [
"adds_features_dependency"
] | auto_2025-06-11 | |
killercup/cargo-edit | 501 | killercup__cargo-edit-501 | [
"455"
] | 5e7db9e8adfa0f8d240c17d46ef0adeed9865f3e | diff --git a/src/bin/add/main.rs b/src/bin/add/main.rs
--- a/src/bin/add/main.rs
+++ b/src/bin/add/main.rs
@@ -20,6 +20,7 @@ use cargo_edit::{
};
use std::borrow::Cow;
use std::io::Write;
+use std::path::Path;
use std::process;
use structopt::StructOpt;
use termcolor::{Color, ColorChoice, ColorSpec, StandardStrea... | diff --git a/src/dependency.rs b/src/dependency.rs
--- a/src/dependency.rs
+++ b/src/dependency.rs
@@ -261,7 +274,7 @@ impl Dependency {
#[cfg(test)]
mod tests {
use crate::dependency::Dependency;
- use std::path::{Path, PathBuf};
+ use std::path::Path;
#[test]
fn to_toml_simple_dep() {
diff --... | Prevent from running "cargo add ." which causes circular dependency
I sometimes mistakenly run `cargo add .` instead of `git add .`. The command is accepted without warning and causes a cyclic package dependency to the crate itself. It'd be kind if `cargo add` does not accept `.` as the argument. (It is never useful... | 2021-09-21T13:46:56Z | 0.7 | 2021-09-21T14:25:35Z | 803528c4dc2625ca75be5fc7334ea835b175920c | [
"local_path_is_self"
] | [
"dependency::tests::to_toml_dep_with_path_source",
"dependency::tests::to_toml_dep_with_git_source",
"dependency::tests::to_toml_dep_from_alt_registry",
"dependency::tests::paths_with_forward_slashes_are_left_as_is",
"dependency::tests::to_toml_complex_dep",
"dependency::tests::to_toml_dep_without_default... | [] | [] | auto_2025-06-11 | |
killercup/cargo-edit | 734 | killercup__cargo-edit-734 | [
"552"
] | e5279e65c2664a01eb5ef26184743535824dac56 | diff --git a/README.md b/README.md
--- a/README.md
+++ b/README.md
@@ -154,7 +154,6 @@ OPTIONS:
--manifest-path <PATH> Path to the manifest to upgrade
--offline Run without accessing the network
-p, --package <PKGID> Package id of the crate to add this dependency to
- ... | diff --git a/src/bin/upgrade/upgrade.rs b/src/bin/upgrade/upgrade.rs
--- a/src/bin/upgrade/upgrade.rs
+++ b/src/bin/upgrade/upgrade.rs
@@ -263,7 +268,7 @@ fn exec(args: UpgradeArgs) -> CargoResult<()> {
}
}
let is_prerelease = old_version_re... | cargo upgrade should default to --skip-compatible
For library crates, updating all dependency requirements in `Cargo.toml` to the latest semver-compatible versions is harmful to the ecosystem, as this makes it harder to resolve versions in case of for example yanking. I was already using `--skip-compatible` for my proj... | Been thinking about this more and I think it makes sense to make it the default. The main question is how to present that to the user.
When looking at the behavior of `cargo upgrade`, I also realized the default behavior has a lot of overlap with `--to-lockfile`. We actually have `--skip-compatible` and `--to-lock... | 2022-07-14T19:22:41Z | 0.9 | 2022-07-14T19:29:01Z | e5279e65c2664a01eb5ef26184743535824dac56 | [
"dependency::tests::paths_with_forward_slashes_are_left_as_is",
"dependency::tests::to_toml_dep_with_git_source",
"dependency::tests::to_toml_dep_with_path_source",
"dependency::tests::to_toml_dep_from_alt_registry",
"dependency::tests::to_toml_complex_dep",
"dependency::tests::to_toml_dep_without_default... | [] | [] | [] | auto_2025-06-11 |
killercup/cargo-edit | 732 | killercup__cargo-edit-732 | [
"565"
] | 07c27ad3314463f97abdfd6690035aadf129d122 | diff --git a/src/bin/set-version/set_version.rs b/src/bin/set-version/set_version.rs
--- a/src/bin/set-version/set_version.rs
+++ b/src/bin/set-version/set_version.rs
@@ -3,8 +3,7 @@ use std::path::Path;
use std::path::PathBuf;
use cargo_edit::{
- colorize_stderr, find, manifest_from_pkgid, upgrade_requirement, ... | diff --git a/src/bin/upgrade/upgrade.rs b/src/bin/upgrade/upgrade.rs
--- a/src/bin/upgrade/upgrade.rs
+++ b/src/bin/upgrade/upgrade.rs
@@ -1,11 +1,11 @@
use std::collections::BTreeSet;
use std::io::Write;
-use std::path::{Path, PathBuf};
+use std::path::PathBuf;
use cargo_edit::{
- colorize_stderr, find, get_la... | `cargo upgrade --manifest-path` only works with absolute paths
We try to find the path in the `CargoMetadata` but it won't match.
`cargo-set-version` should have the needed logic for this. I guess an alternative to `dunce::canonicalize` is `same_file`.
When fixing this, we should copy `tests/cmd/upgrade/workspac... | 2022-07-14T19:05:34Z | 0.9 | 2022-07-14T19:11:57Z | e5279e65c2664a01eb5ef26184743535824dac56 | [
"dependency::tests::paths_with_forward_slashes_are_left_as_is",
"dependency::tests::to_toml_complex_dep",
"dependency::tests::to_toml_dep_with_git_source",
"dependency::tests::to_toml_dep_with_path_source",
"dependency::tests::to_toml_dep_from_alt_registry",
"dependency::tests::to_toml_dep_without_default... | [] | [] | [] | auto_2025-06-11 | |
killercup/cargo-edit | 390 | killercup__cargo-edit-390 | [
"231"
] | b8a8474db183f57e77e456e13ebe36d1b6e12e3f | diff --git a/src/bin/add/args.rs b/src/bin/add/args.rs
--- a/src/bin/add/args.rs
+++ b/src/bin/add/args.rs
@@ -83,9 +83,18 @@ pub struct Args {
pub optional: bool,
/// Path to the manifest to add a dependency to.
- #[structopt(long = "manifest-path", value_name = "path")]
+ #[structopt(long = "manifes... | diff --git a/src/bin/upgrade/main.rs b/src/bin/upgrade/main.rs
--- a/src/bin/upgrade/main.rs
+++ b/src/bin/upgrade/main.rs
@@ -16,8 +16,8 @@ extern crate error_chain;
use crate::errors::*;
use cargo_edit::{
- find, get_latest_dependency, registry_url, update_registry_index, CrateName, Dependency,
- LocalManif... | Feature request: "cargo add -p" in a workspace
`cargo add` doesn't work on a workspace:
> cargo add tokio
> Adding tokio v0.1.7 to dependencies
> Command failed due to unhandled error: Found virtual manifest, but this command requires running against an actual package in this workspace.
This works:
`ca... | Any progress?
Nope, or it would probably be noted here :)
If you want to help out, I think it might be a good idea to start by refactoring how we handle the manifests. Right now, cargo-add does not know anything about workspaces, but with help of `cargo metadata` we can probably figure it out. | 2020-03-19T05:28:47Z | 0.5 | 2020-03-19T15:29:39Z | a998f232e1cb76651c4ca4a9111c95168b49888d | [
"dependency::tests::to_toml_dep_without_default_features",
"dependency::tests::to_toml_dep_with_path_source",
"dependency::tests::to_toml_dep_with_git_source",
"dependency::tests::to_toml_dep_from_alt_registry",
"dependency::tests::to_toml_optional_dep",
"dependency::tests::to_toml_complex_dep",
"depend... | [] | [] | [] | auto_2025-06-11 |
killercup/cargo-edit | 342 | killercup__cargo-edit-342 | [
"273"
] | e8d8eebfa0733da112197a78dc793f68a5ab6441 | diff --git a/src/bin/upgrade/main.rs b/src/bin/upgrade/main.rs
--- a/src/bin/upgrade/main.rs
+++ b/src/bin/upgrade/main.rs
@@ -160,7 +160,13 @@ impl Manifests {
.iter()
.flat_map(|&(_, ref package)| package.dependencies.clone())
.filter(is_version_dep)
- ... | diff --git a/src/bin/upgrade/main.rs b/src/bin/upgrade/main.rs
--- a/src/bin/upgrade/main.rs
+++ b/src/bin/upgrade/main.rs
@@ -224,14 +235,14 @@ impl DesiredUpgrades {
fn get_upgraded(self, allow_prerelease: bool, manifest_path: &Path) -> Result<ActualUpgrades> {
self.0
.into_iter()
- ... | cargo edit should respect `package` flag on dependencies
With Rust 2018 and the ability to omit `extern crate` Cargo [gained](https://github.com/rust-lang/cargo/issues/5653) the ability to rename crates in the `Cargo.toml` file.
For a dependency like `bar = { package = "foo", version = "0.1" }`, `cargo upgrade` shou... | 2019-10-23T08:34:27Z | 0.4 | 2019-10-23T23:11:14Z | dbe862042c2c66e601417366885affba40d299aa | [
"fetch::get_latest_version_from_json_test",
"fetch::get_latest_unstable_or_stable_version_from_json",
"fetch::get_no_latest_version_from_json_when_all_are_yanked",
"fetch::get_latest_stable_version_from_json",
"fetch::test_summary_raw_path",
"manifest::tests::remove_dependency_no_section",
"fetch::test_... | [] | [] | [] | auto_2025-06-11 | |
killercup/cargo-edit | 725 | killercup__cargo-edit-725 | [
"719"
] | a221558e3b7b5b978965d31607ccfc1570a998f0 | diff --git a/README.md b/README.md
--- a/README.md
+++ b/README.md
@@ -160,6 +160,7 @@ OPTIONS:
manifest. "Pinned" refers to dependencies with a '=' or '<' or
'<=' version requirement
--to-lockfile Upgrade all packages to the ver... | diff --git a/src/bin/upgrade/upgrade.rs b/src/bin/upgrade/upgrade.rs
--- a/src/bin/upgrade/upgrade.rs
+++ b/src/bin/upgrade/upgrade.rs
@@ -3,13 +3,13 @@ use std::io::Write;
use std::path::{Path, PathBuf};
use cargo_edit::{
- colorize_stderr, find, get_latest_dependency, manifest_from_pkgid, registry_url, shell_w... | cargo upgrade deletes comments
It seems that cargo upgrade still removes some comments, e.g. in this file the commant of a specific package was removed
```toml
[dependencies]
# very useful comment remains
wasm-bindgen = "0.2.80" # very useful comment REMOVED!!!
```
Is there a way for the upgrade to just chang... | From https://github.com/killercup/cargo-edit/issues/717#issuecomment-1173006346
> I feel like the core of the problem here is how much code we share with `cargo add`. All we should be doing is assigning to the version field, regardless of the format involved. Instead, we extract a `Dependency` and then write back ou... | 2022-07-13T21:42:31Z | 0.9 | 2022-07-13T21:55:05Z | e5279e65c2664a01eb5ef26184743535824dac56 | [
"dependency::tests::paths_with_forward_slashes_are_left_as_is",
"dependency::tests::to_toml_complex_dep",
"dependency::tests::to_toml_dep_from_alt_registry",
"dependency::tests::to_toml_dep_with_git_source",
"dependency::tests::to_toml_dep_with_path_source",
"dependency::tests::to_toml_optional_dep",
"d... | [] | [] | [] | auto_2025-06-11 |
killercup/cargo-edit | 572 | killercup__cargo-edit-572 | [
"458"
] | 95ec0eedfec9bd9d5cbb1cb6076d8646abd29f81 | diff --git a/src/bin/add/args.rs b/src/bin/add/args.rs
--- a/src/bin/add/args.rs
+++ b/src/bin/add/args.rs
@@ -44,13 +44,17 @@ pub struct Args {
pub rename: Option<String>,
/// Add crate as development dependency.
- #[clap(long, short = 'D', conflicts_with = "build")]
+ #[clap(long, short = 'D', group... | diff --git a/src/dependency.rs b/src/dependency.rs
--- a/src/dependency.rs
+++ b/src/dependency.rs
@@ -346,7 +369,7 @@ mod tests {
fn to_toml_dep_with_git_source() {
let crate_root = dunce::canonicalize(Path::new("/")).expect("root exists");
let toml = Dependency::new("dep")
- .set_git... | Git Dependency Specify Commit Hash
I don't see a way to specify the commit hash (`rev` field) of Git deps. While setting it manually definitely gets the job done, it's a bit tedious, and it would be nice if there was to be another argument (like `--branch`) to set the `rev`.
| 2022-01-24T21:18:28Z | 0.8 | 2022-01-24T21:26:40Z | e8ab2d031eabbad815e3c14d80663dd7e8b85966 | [
"dependency::tests::paths_with_forward_slashes_are_left_as_is",
"dependency::tests::to_toml_dep_with_git_source",
"dependency::tests::to_toml_dep_from_alt_registry",
"dependency::tests::to_toml_complex_dep",
"dependency::tests::to_toml_dep_with_path_source",
"dependency::tests::to_toml_dep_without_default... | [] | [] | [] | auto_2025-06-11 | |
tokio-rs/bytes | 100 | tokio-rs__bytes-100 | [
"97"
] | 627864187c531af38c21aa44315a1b3204f9a175 | diff --git a/src/bytes.rs b/src/bytes.rs
--- a/src/bytes.rs
+++ b/src/bytes.rs
@@ -1890,8 +1890,8 @@ impl Inner {
#[inline]
fn is_shared(&mut self) -> bool {
match self.kind() {
- KIND_INLINE | KIND_ARC => true,
- _ => false,
+ KIND_VEC => false,
+ _ => tru... | diff --git a/tests/test_bytes.rs b/tests/test_bytes.rs
--- a/tests/test_bytes.rs
+++ b/tests/test_bytes.rs
@@ -363,6 +363,15 @@ fn extend() {
assert_eq!(*bytes, LONG[..]);
}
+#[test]
+fn from_static() {
+ let mut a = Bytes::from_static(b"ab");
+ let b = a.split_off(1);
+
+ assert_eq!(a, b"a"[..]);
+ ... | Debug assertion fails when splitting a Bytes created with from_static
```rust
extern crate bytes;
use bytes::Bytes;
fn main() {
let mut a = Bytes::from_static(b"ab");
let b = a.split_off(1);
println!("{:?}, {:?}", a, b);
}
```
In a debug build, this code results in the following:
```text
... | 2017-03-29T16:32:14Z | 0.4 | 2017-04-05T19:13:00Z | e0e30f00a1248b1de59405da66cd871ccace4f9f | [
"from_static"
] | [
"test_fresh_cursor_vec",
"test_bufs_vec",
"test_get_u8",
"test_get_u16",
"test_get_u16_buffer_underflow",
"test_clone",
"test_put_u16",
"test_vec_as_mut_buf",
"test_put_u8",
"test_bufs_vec_mut",
"inline_storage",
"reserve_allocates_at_least_original_capacity",
"fmt",
"len",
"split_off",
... | [] | [] | auto_2025-06-10 | |
tokio-rs/bytes | 316 | tokio-rs__bytes-316 | [
"170"
] | 59aea9e8719d8acff18b586f859011d3c52cfcde | diff --git a/src/buf/buf_mut.rs b/src/buf/buf_mut.rs
--- a/src/buf/buf_mut.rs
+++ b/src/buf/buf_mut.rs
@@ -270,7 +270,7 @@ pub trait BufMut {
fn put_slice(&mut self, src: &[u8]) {
let mut off = 0;
- assert!(self.remaining_mut() >= src.len(), "buffer overflow");
+ assert!(self.remaining_mut... | diff --git a/tests/test_buf_mut.rs b/tests/test_buf_mut.rs
--- a/tests/test_buf_mut.rs
+++ b/tests/test_buf_mut.rs
@@ -74,7 +74,7 @@ fn test_bufs_vec_mut() {
// with no capacity
let mut buf = BytesMut::new();
assert_eq!(buf.capacity(), 0);
- assert_eq!(0, buf.bytes_vectored_mut(&mut dst[..]));
+ as... | BytesMut should implicitly grow the internal storage in its `BufMut` implementation.
This will bring the implementation in line with that of `Vec`. This is a breaking change.
Relates to #131, #77.
| Can you explain why this is a breaking change? Are users relying on the fact that the buffer does _not_ grow implicitly?
Yes, users (well, I am at the very least) are relying on the fact that the buffer does not grow implicitly.
I'm very much in favor of this; or in providing another type (`BytesExt`) or a newtype wra... | 2019-11-20T08:38:10Z | 0.5 | 2019-11-27T20:06:21Z | 90e7e650c99b6d231017d9b831a01e95b8c06756 | [
"test_bufs_vec",
"test_fresh_cursor_vec",
"test_get_u16",
"test_get_u16_buffer_underflow",
"test_get_u8",
"test_vec_deque",
"test_vec_advance_mut",
"test_clone",
"test_put_u8",
"test_mut_slice",
"test_vec_as_mut_buf",
"test_put_u16",
"test_bufs_vec_mut",
"from_slice",
"from_iter_no_size_... | [] | [] | [] | auto_2025-06-10 |
tokio-rs/bytes | 286 | tokio-rs__bytes-286 | [
"139"
] | b6cb346adfaae89bce44bfa337652e6d218d38c4 | diff --git a/src/bytes.rs b/src/bytes.rs
--- a/src/bytes.rs
+++ b/src/bytes.rs
@@ -499,6 +499,11 @@ impl Bytes {
self.inner.is_inline()
}
+ ///Creates `Bytes` instance from slice, by copying it.
+ pub fn copy_from_slice(data: &[u8]) -> Self {
+ BytesMut::from(data).freeze()
+ }
+
//... | diff --git a/tests/test_bytes.rs b/tests/test_bytes.rs
--- a/tests/test_bytes.rs
+++ b/tests/test_bytes.rs
@@ -528,7 +528,7 @@ fn stress() {
for i in 0..ITERS {
let data = [i as u8; 256];
- let buf = Arc::new(Bytes::from(&data[..]));
+ let buf = Arc::new(Bytes::copy_from_slice(&data[..]));... | Change From<&'a [u8]> to an explicit function
Most of the `From` conversions to `Bytes` are shallow copies, just grabbing a pointer and pulling it in. There is also the `from_static` function to save copying a static set of bytes. However, the `From<&'a [u8]>` impl will copy the slice into a new buffer (either inline o... | Oh, this would be a breaking change, so would require (block?) 0.5.
Just to clarify,
`From<&'a [u8]> for BytesMut` can stay because static slices are not mutable, so a copy has to happen from the `'static` slice when creating BytesMut.
So only Bytes would have its `From<&'a [u8]>` removed.
Mentioned by @arthur... | 2019-08-16T07:01:13Z | 0.5 | 2019-08-27T20:17:31Z | 90e7e650c99b6d231017d9b831a01e95b8c06756 | [
"buf::vec_deque::tests::hello_world",
"bytes::test_original_capacity_from_repr",
"bytes::test_original_capacity_to_repr",
"test_bufs_vec",
"test_fresh_cursor_vec",
"test_get_u16",
"test_get_u8",
"test_get_u16_buffer_underflow",
"test_bufs_vec_mut",
"test_clone",
"test_mut_slice",
"test_put_u16... | [] | [] | [] | auto_2025-06-10 |
tokio-rs/bytes | 376 | tokio-rs__bytes-376 | [
"352",
"352"
] | fe6e67386451715c5d609c90a41e98ef80f0e1d1 | diff --git a/src/bytes_mut.rs b/src/bytes_mut.rs
--- a/src/bytes_mut.rs
+++ b/src/bytes_mut.rs
@@ -233,7 +233,9 @@ impl BytesMut {
let (off, _) = self.get_vec_pos();
let vec = rebuild_vec(self.ptr.as_ptr(), self.len, self.cap, off);
mem::forget(self);
- ... | diff --git a/tests/test_bytes.rs b/tests/test_bytes.rs
--- a/tests/test_bytes.rs
+++ b/tests/test_bytes.rs
@@ -342,6 +342,72 @@ fn freeze_clone_unique() {
assert_eq!(c, s);
}
+#[test]
+fn freeze_after_advance() {
+ let s = &b"abcdefgh"[..];
+ let mut b = BytesMut::from(s);
+ b.advance(1);
+ assert_e... | BytesMut::freeze ignores advance
Hi,
I created a `BytesBuf` with some data and removed the leading n bytes with `advance(n)`. After some more computations I converted the result to an immutable `Bytes` value. My expectation was that the content of the `BytesMut` and `Bytes` would be identical. Instead the `Bytes` stil... | Oh yea, that seems like a bug in `freeze`. Looking at the source, it seems to grab the original size so it can properly create a `Bytes`, but forgets to advance it forward if need be.
Oh yea, that seems like a bug in `freeze`. Looking at the source, it seems to grab the original size so it can properly create a `Bytes`... | 2020-03-13T17:41:22Z | 0.5 | 2020-03-24T18:14:17Z | 90e7e650c99b6d231017d9b831a01e95b8c06756 | [
"freeze_after_advance"
] | [
"test_get_u16_buffer_underflow",
"test_deref_buf_forwards",
"test_bufs_vec",
"test_get_u16",
"test_fresh_cursor_vec",
"test_get_u8",
"test_vec_deque",
"test_put_u16",
"test_mut_slice",
"test_put_u8",
"test_deref_bufmut_forwards",
"test_bufs_vec_mut",
"test_clone",
"test_vec_advance_mut",
... | [] | [] | auto_2025-06-10 |
tokio-rs/bytes | 361 | tokio-rs__bytes-361 | [
"360"
] | 729bc7c2084a42fda2c62da6933951fa7ac875aa | diff --git a/src/bytes.rs b/src/bytes.rs
--- a/src/bytes.rs
+++ b/src/bytes.rs
@@ -418,7 +418,15 @@ impl Bytes {
#[inline]
pub fn truncate(&mut self, len: usize) {
if len < self.len {
- self.len = len;
+ // The Vec "promotable" vtables do not store the capacity,
+ // ... | diff --git a/tests/test_bytes_odd_alloc.rs b/tests/test_bytes_odd_alloc.rs
--- a/tests/test_bytes_odd_alloc.rs
+++ b/tests/test_bytes_odd_alloc.rs
@@ -41,7 +41,7 @@ unsafe impl GlobalAlloc for Odd {
};
System.dealloc(ptr.offset(-1), new_layout);
} else {
- System.alloc(layo... | Bytes may recreate Vec incorrectly on drop
This example:
```
diff --git a/examples/rrr.rs b/examples/rrr.rs
index e69de29..60374de 100644
--- a/examples/rrr.rs
+++ b/examples/rrr.rs
@@ -0,0 +1,7 @@
+use bytes::Bytes;
+
+fn main() {
+ let mut bytes = Bytes::from(vec![10, 20, 30]);
+ bytes.truncate(2);... | Can verify that the layout is indeed incorrect, we need to use the capacity of the vector (rather than the truncated length). I put together a small [toy allocator](https://github.com/udoprog/checkers) to test this.
(this is the test I wrote)
```rust
use bytes::Bytes;
#[global_allocator]
static ALLOCATOR: chec... | 2020-01-20T20:05:19Z | 0.5 | 2020-01-23T00:37:55Z | 90e7e650c99b6d231017d9b831a01e95b8c06756 | [
"test_bytes_truncate",
"test_bytes_truncate_and_advance"
] | [
"test_bufs_vec",
"test_deref_buf_forwards",
"test_fresh_cursor_vec",
"test_get_u16",
"test_get_u8",
"test_get_u16_buffer_underflow",
"test_vec_deque",
"test_bufs_vec_mut",
"test_clone",
"test_deref_bufmut_forwards",
"test_mut_slice",
"test_put_u16",
"test_put_u8",
"test_vec_advance_mut",
... | [] | [] | auto_2025-06-10 |
tokio-rs/bytes | 346 | tokio-rs__bytes-346 | [
"343"
] | 8ae3bb2104fda9a02d55ac5635974ca1b5a49ebb | diff --git a/src/bytes.rs b/src/bytes.rs
--- a/src/bytes.rs
+++ b/src/bytes.rs
@@ -731,20 +731,23 @@ impl From<Vec<u8>> for Bytes {
let slice = vec.into_boxed_slice();
let len = slice.len();
let ptr = slice.as_ptr();
-
- assert!(
- ptr as usize & KIND_VEC == 0,
- ... | diff --git /dev/null b/tests/test_bytes_odd_alloc.rs
new file mode 100644
--- /dev/null
+++ b/tests/test_bytes_odd_alloc.rs
@@ -0,0 +1,67 @@
+//! Test using `Bytes` with an allocator that hands out "odd" pointers for
+//! vectors (pointers where the LSB is set).
+
+use std::alloc::{GlobalAlloc, Layout, System};
+use st... | Bytes assumes that Vec<u8>'s allocation is more than 1 byte aligned
It uses the low bit of the pointer to distinguish between KIND_VEC and KIND_ARC.
Folded over from #340
| As mentioned in https://github.com/tokio-rs/bytes/pull/342#issuecomment-565135102, we'll start by adding an assertion that the LSB isn't set, and perhaps fix if/when some allocator actually starts handing out odd pointers. | 2019-12-13T20:55:56Z | 0.5 | 2019-12-17T21:23:17Z | 90e7e650c99b6d231017d9b831a01e95b8c06756 | [
"test_bytes_clone_drop",
"test_bytes_from_vec_drop"
] | [
"test_deref_buf_forwards",
"test_get_u16",
"test_fresh_cursor_vec",
"test_bufs_vec",
"test_vec_deque",
"test_get_u8",
"test_get_u16_buffer_underflow",
"test_put_u8",
"test_vec_advance_mut",
"test_deref_bufmut_forwards",
"test_clone",
"test_put_u16",
"test_bufs_vec_mut",
"test_mut_slice",
... | [] | [] | auto_2025-06-10 |
tokio-rs/bytes | 265 | tokio-rs__bytes-265 | [
"167"
] | ed7c7b5c5845a4084eb65a364ddf259b1e17ca59 | diff --git a/.travis.yml b/.travis.yml
--- a/.travis.yml
+++ b/.travis.yml
@@ -19,7 +19,7 @@ matrix:
#
# This job will also build and deploy the docs to gh-pages.
- env: TARGET=x86_64-unknown-linux-gnu
- rust: 1.27.0
+ rust: 1.28.0
after_success:
- |
pip install 'tr... | diff --git a/tests/test_bytes.rs b/tests/test_bytes.rs
--- a/tests/test_bytes.rs
+++ b/tests/test_bytes.rs
@@ -98,22 +98,22 @@ fn index() {
fn slice() {
let a = Bytes::from(&b"hello world"[..]);
- let b = a.slice(3, 5);
+ let b = a.slice(3..5);
assert_eq!(b, b"lo"[..]);
- let b = a.slice(0, 0);
... | Add RangeArgument trait and use it for slice
A trait that mirrors [std::RangeArgument](https://doc.rust-lang.org/nightly/std/collections/range/trait.RangeArgument.html) can be introduced to avoid having to have `split_to`, `split_from`, `split` functions.
| 2019-06-07T23:32:54Z | 0.5 | 2019-06-10T16:39:32Z | 90e7e650c99b6d231017d9b831a01e95b8c06756 | [
"bytes::test_original_capacity_to_repr",
"buf::vec_deque::tests::hello_world",
"bytes::test_original_capacity_from_repr",
"test_get_u16",
"test_fresh_cursor_vec",
"test_get_u8",
"test_bufs_vec",
"test_get_u16_buffer_underflow",
"test_mut_slice",
"test_put_u16",
"test_vec_advance_mut",
"test_cl... | [] | [] | [] | auto_2025-06-10 | |
tokio-rs/bytes | 263 | tokio-rs__bytes-263 | [
"224"
] | ac4e8f2fc5de66eff982aac77f742de3d3930454 | diff --git a/.travis.yml b/.travis.yml
--- a/.travis.yml
+++ b/.travis.yml
@@ -3,7 +3,8 @@ dist: trusty
language: rust
services: docker
sudo: required
-rust: stable
+#rust: stable
+rust: beta # we need 1.36, which is still beta
env:
global:
diff --git a/.travis.yml b/.travis.yml
--- a/.travis.yml
+++ b/.travis... | diff --git a/tests/test_buf.rs b/tests/test_buf.rs
--- a/tests/test_buf.rs
+++ b/tests/test_buf.rs
@@ -1,9 +1,8 @@
extern crate bytes;
extern crate byteorder;
-extern crate iovec;
use bytes::Buf;
-use iovec::IoVec;
+use std::io::IoSlice;
#[test]
fn test_fresh_cursor_vec() {
diff --git a/tests/test_buf.rs b/tes... | Replace iovec with std::io::IoSlice
This would allow avoiding the additional dependencies.
| This would be in conflict with #63
[IoVec was stabilised as IoSlice in 1.36](https://doc.rust-lang.org/nightly/std/io/struct.IoSlice.html), so we can probably drop the `iovec` dependency and use the std types.
Yep, the plan with 0.5 is to switch to std's IoSlice. | 2019-06-07T20:11:41Z | 0.5 | 2019-06-11T18:58:47Z | 90e7e650c99b6d231017d9b831a01e95b8c06756 | [
"buf::vec_deque::tests::hello_world",
"bytes::test_original_capacity_from_repr",
"bytes::test_original_capacity_to_repr",
"test_bufs_vec",
"test_fresh_cursor_vec",
"test_get_u16",
"test_get_u8",
"test_get_u16_buffer_underflow",
"test_bufs_vec_mut",
"test_clone",
"test_put_u16",
"test_mut_slice... | [] | [] | [] | auto_2025-06-10 |
tokio-rs/bytes | 732 | tokio-rs__bytes-732 | [
"730"
] | 291df5acc94b82a48765e67eeb1c1a2074539e68 | diff --git a/src/buf/buf_impl.rs b/src/buf/buf_impl.rs
--- a/src/buf/buf_impl.rs
+++ b/src/buf/buf_impl.rs
@@ -66,6 +66,12 @@ macro_rules! buf_get_impl {
}};
}
+// https://en.wikipedia.org/wiki/Sign_extension
+fn sign_extend(val: u64, nbytes: usize) -> i64 {
+ let shift = (8 - nbytes) * 8;
+ (val << shift... | diff --git a/tests/test_buf.rs b/tests/test_buf.rs
--- a/tests/test_buf.rs
+++ b/tests/test_buf.rs
@@ -36,6 +36,19 @@ fn test_get_u16() {
assert_eq!(0x5421, buf.get_u16_le());
}
+#[test]
+fn test_get_int() {
+ let mut buf = &b"\xd6zomg"[..];
+ assert_eq!(-42, buf.get_int(1));
+ let mut buf = &b"\xd6zom... | `Buf::get_int()` implementation for `Bytes` returns positive number instead of negative when `nbytes` < 8.
**Steps to reproduce:**
Run the following program, using `bytes` version 1.7.1
```
use bytes::{BytesMut, Buf, BufMut};
fn main() {
const SOME_NEG_NUMBER: i64 = -42;
let mut buffer = BytesMut::wit... | It looks like this has been caused by 234d814122d6445bdfb15f635290bfc4dd36c2eb / #280, as demonstrated by the revert:
<details>
<summary>See the revert</summary>
```patch
From 4a9b9a4ea0538dff7d9ae57070c98f6ad4afd708 Mon Sep 17 00:00:00 2001
From: Paolo Barbolini <paolo.barbolini@m4ss.net>
Date: Mon, 19 Aug 2... | 2024-08-19T13:14:07Z | 1.7 | 2024-08-30T12:20:30Z | 291df5acc94b82a48765e67eeb1c1a2074539e68 | [
"test_get_int"
] | [
"bytes_mut::tests::test_original_capacity_to_repr",
"bytes_mut::tests::test_original_capacity_from_repr",
"copy_to_bytes_overflow - should panic",
"test_deref_buf_forwards",
"test_fresh_cursor_vec",
"test_bufs_vec",
"test_get_u8",
"test_get_u16_buffer_underflow - should panic",
"test_get_u16",
"co... | [] | [] | auto_2025-06-10 |
tokio-rs/bytes | 710 | tokio-rs__bytes-710 | [
"709"
] | caf520ac7f2c466d26bd88eca33ddc53c408e17e | diff --git a/src/bytes.rs b/src/bytes.rs
--- a/src/bytes.rs
+++ b/src/bytes.rs
@@ -525,32 +525,12 @@ impl Bytes {
/// ```
pub fn try_into_mut(self) -> Result<BytesMut, Bytes> {
if self.is_unique() {
- Ok(self.make_mut())
+ Ok(self.into())
} else {
Err(self)... | diff --git a/tests/test_bytes.rs b/tests/test_bytes.rs
--- a/tests/test_bytes.rs
+++ b/tests/test_bytes.rs
@@ -1174,29 +1174,29 @@ fn shared_is_unique() {
}
#[test]
-fn test_bytes_make_mut_static() {
+fn test_bytesmut_from_bytes_static() {
let bs = b"1b23exfcz3r";
// Test STATIC_VTABLE.to_mut
- let b... | Consider replacing Bytes::make_mut by impl From<Bytes> for BytesMut
`Bytes::make_mut` is a very good addition to the API but I think it would be better if it was instead exposed as `<BytesMut as From<Bytes>>::from`. Could this be done before the next bytes version is released? `Bytes::make_mut` isn't released yet.
| The reason for the current API is to support adding a fallible `Bytes::try_mut` method in the future (as I proposed in #611). See also #368
None of this mentions `From<_>` though. For some HTTP stuff I need to mutate bytes yielded by Hyper and I can do that in-place, but Hyper yields `Bytes` so I want to be able to do ... | 2024-05-26T10:32:14Z | 1.6 | 2024-07-09T12:12:07Z | 9965a04b5684079bb614addd750340ffc165a9f5 | [
"bytes_mut::tests::test_original_capacity_from_repr",
"bytes_mut::tests::test_original_capacity_to_repr",
"test_bufs_vec",
"copy_to_bytes_less",
"test_fresh_cursor_vec",
"test_deref_buf_forwards",
"copy_to_bytes_overflow - should panic",
"test_get_u16",
"test_get_u16_buffer_underflow - should panic"... | [] | [] | [] | auto_2025-06-10 |
tokio-rs/bytes | 686 | tokio-rs__bytes-686 | [
"680"
] | 7a5154ba8b54970b7bb07c4902bc8a7981f4e57c | diff --git a/src/bytes_mut.rs b/src/bytes_mut.rs
--- a/src/bytes_mut.rs
+++ b/src/bytes_mut.rs
@@ -589,12 +589,13 @@ impl BytesMut {
return;
}
- self.reserve_inner(additional);
+ // will always succeed
+ let _ = self.reserve_inner(additional, true);
}
- // In separ... | diff --git a/tests/test_bytes.rs b/tests/test_bytes.rs
--- a/tests/test_bytes.rs
+++ b/tests/test_bytes.rs
@@ -1283,3 +1283,73 @@ fn test_bytes_make_mut_promotable_even_arc_offset() {
assert_eq!(b2m, vec[20..]);
assert_eq!(b1m, vec[..20]);
}
+
+#[test]
+fn try_reclaim_empty() {
+ let mut buf = BytesMut::n... | Contradictory allocation behaviour compared to documentation
I hope I'm not just hopelessly confused, but I fail to see what kind of guarantees are made around allocations and using the APIs. For example, https://docs.rs/bytes/latest/bytes/buf/trait.BufMut.html#method.put_slice says that `self must have enough remainin... | The documentation on this could probably be improved, but the capacity that the `BufMut` trait talks about is for cases where the buffer cannot be resized at all. Types such as `Vec<u8>` pretend that they have infinite capacity in the `BufMut` trait.
I agree that the wording here is confusing, but I think it is the ... | 2024-03-31T08:27:02Z | 1.6 | 2024-06-28T19:54:54Z | 9965a04b5684079bb614addd750340ffc165a9f5 | [
"bytes_mut::tests::test_original_capacity_from_repr",
"bytes_mut::tests::test_original_capacity_to_repr",
"copy_to_bytes_less",
"test_bufs_vec",
"copy_to_bytes_overflow - should panic",
"test_deref_buf_forwards",
"test_fresh_cursor_vec",
"test_get_u16",
"test_get_u16_buffer_underflow - should panic"... | [] | [] | [] | auto_2025-06-10 |
tokio-rs/bytes | 450 | tokio-rs__bytes-450 | [
"447"
] | 54f5ced6c58c47f721836a9444654de4c8d687a1 | diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -11,6 +11,7 @@ on:
env:
RUSTFLAGS: -Dwarnings
RUST_BACKTRACE: 1
+ nightly: nightly-2020-12-17
defaults:
run:
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
--... | diff --git a/tests/test_buf.rs b/tests/test_buf.rs
--- a/tests/test_buf.rs
+++ b/tests/test_buf.rs
@@ -9,17 +9,17 @@ fn test_fresh_cursor_vec() {
let mut buf = &b"hello"[..];
assert_eq!(buf.remaining(), 5);
- assert_eq!(buf.bytes(), b"hello");
+ assert_eq!(buf.chunk(), b"hello");
buf.advance(2)... | Consider renaming `Buf::bytes()` and `BufMut::bytes_mut()`
These two functions are named in a way that implies they return the *entire* set of bytes represented by the `Buf`/`BufMut`.
Some options:
* `window()` / `window_mut()`
* `chunk()` / `chunk_mut()`.
* `fragment()` / `fragment_mut()`
| @tokio-rs/maintainers Anyone have thoughts? If there isn't any support for a change here, I am inclined to just let it be.
I agree that the current name could be misleading, and my knee-jerk reaction to `window` is positive--it's at least ambiguous enough to prompt careful examination.
I support changing it to `chunk`.... | 2020-12-18T05:15:21Z | 1.0 | 2020-12-18T19:04:33Z | 54f5ced6c58c47f721836a9444654de4c8d687a1 | [
"copy_to_bytes_less",
"test_bufs_vec",
"test_deref_buf_forwards",
"test_get_u16",
"test_get_u8",
"test_get_u16_buffer_underflow",
"copy_to_bytes_overflow",
"test_vec_deque",
"test_fresh_cursor_vec",
"test_mut_slice",
"write_byte_panics_if_out_of_bounds",
"test_put_u16",
"copy_from_slice_pani... | [] | [] | [] | auto_2025-06-10 |
tokio-rs/bytes | 432 | tokio-rs__bytes-432 | [
"329"
] | 94c543f74b111e894d16faa43e4ad361b97ee87d | diff --git a/src/buf/buf_mut.rs b/src/buf/buf_mut.rs
--- a/src/buf/buf_mut.rs
+++ b/src/buf/buf_mut.rs
@@ -30,7 +30,7 @@ use alloc::{boxed::Box, vec::Vec};
///
/// assert_eq!(buf, b"hello world");
/// ```
-pub trait BufMut {
+pub unsafe trait BufMut {
/// Returns the number of bytes that can be written from the... | diff --git a/tests/test_buf_mut.rs b/tests/test_buf_mut.rs
--- a/tests/test_buf_mut.rs
+++ b/tests/test_buf_mut.rs
@@ -75,7 +75,7 @@ fn test_mut_slice() {
fn test_deref_bufmut_forwards() {
struct Special;
- impl BufMut for Special {
+ unsafe impl BufMut for Special {
fn remaining_mut(&self) -> us... | Maybe `BufMut` trait should be `unsafe`?
I was thinking that it's likely that some `unsafe` code will rely on properties of `BufMut`. More specifically:
* That `remaining_mut` returns correct value
* `bytes_mut` always returns the same slice (apart from `advance()`)
* `has_remaining_mut` returns correct value
* `... | What does making the trait unsafe gain over making individual fns unsafe?
`unsafe trait` basically declares "this trait is `unsafe` to *implement*", thus other `unsafe` code might rely on it working properly. `unsafe fn` means "this function is unsafe to call"
They are different things and I believe making `BufMut` ... | 2020-10-16T22:38:56Z | 0.6 | 2020-10-16T22:45:41Z | 94c543f74b111e894d16faa43e4ad361b97ee87d | [
"test_bufs_vec",
"test_deref_buf_forwards",
"test_fresh_cursor_vec",
"test_get_u8",
"test_get_u16",
"test_get_u16_buffer_underflow",
"test_vec_deque",
"test_clone",
"test_deref_bufmut_forwards",
"test_mut_slice",
"test_put_u16",
"test_put_u8",
"test_vec_as_mut_buf",
"test_vec_advance_mut",... | [] | [] | [] | auto_2025-06-10 |
tokio-rs/bytes | 413 | tokio-rs__bytes-413 | [
"412"
] | 90e7e650c99b6d231017d9b831a01e95b8c06756 | diff --git a/src/bytes_mut.rs b/src/bytes_mut.rs
--- a/src/bytes_mut.rs
+++ b/src/bytes_mut.rs
@@ -559,9 +559,8 @@ impl BytesMut {
unsafe {
let (off, prev) = self.get_vec_pos();
- // Only reuse space if we stand to gain at least capacity/2
- // bytes of spac... | diff --git a/tests/test_bytes.rs b/tests/test_bytes.rs
--- a/tests/test_bytes.rs
+++ b/tests/test_bytes.rs
@@ -929,6 +929,22 @@ fn bytes_buf_mut_advance() {
}
}
+#[test]
+fn bytes_buf_mut_reuse_when_fully_consumed() {
+ use bytes::{Buf, BytesMut};
+ let mut buf = BytesMut::new();
+ buf.reserve(8192);
+... | BytesMut fails to reuse buffer in trivial case where all data has been consumed
The following test fails with bytes 0.5.5:
```rust
#[test]
fn bytes_mut_reuse() {
use bytes::{BytesMut, Buf};
let mut buf = BytesMut::new();
buf.reserve(8192);
buf.extend_from_slice(&[0u8;100... | Yea, this does seem wrong. In this test, `off` would be 100, and `additional` is 8192. We shouldn't be checking `100 > 8192`, but rather checking that `cap - (len - off) > additional`, I think. Does that sound right?
For the first half of the condition, we want to be checking if there's enough space to satisfy the allo... | 2020-07-08T20:41:16Z | 0.5 | 2020-08-27T21:25:46Z | 90e7e650c99b6d231017d9b831a01e95b8c06756 | [
"bytes_buf_mut_reuse_when_fully_consumed"
] | [
"test_bufs_vec",
"test_deref_buf_forwards",
"test_fresh_cursor_vec",
"test_get_u16",
"test_get_u8",
"test_get_u16_buffer_underflow",
"test_vec_deque",
"test_bufs_vec_mut",
"test_clone",
"test_mut_slice",
"test_deref_bufmut_forwards",
"test_put_u16",
"test_put_u8",
"test_vec_as_mut_buf",
... | [] | [] | auto_2025-06-10 |
tokio-rs/bytes | 377 | tokio-rs__bytes-377 | [
"354",
"354"
] | fe6e67386451715c5d609c90a41e98ef80f0e1d1 | diff --git a/src/buf/buf_mut.rs b/src/buf/buf_mut.rs
--- a/src/buf/buf_mut.rs
+++ b/src/buf/buf_mut.rs
@@ -990,11 +990,13 @@ impl BufMut for Vec<u8> {
unsafe fn advance_mut(&mut self, cnt: usize) {
let len = self.len();
let remaining = self.capacity() - len;
- if cnt > remaining {
- ... | diff --git a/tests/test_buf_mut.rs b/tests/test_buf_mut.rs
--- a/tests/test_buf_mut.rs
+++ b/tests/test_buf_mut.rs
@@ -45,13 +45,12 @@ fn test_put_u16() {
}
#[test]
+#[should_panic(expected = "cannot advance")]
fn test_vec_advance_mut() {
- // Regression test for carllerche/bytes#108.
+ // Verify fix for #35... | advance_mut implementation of BufMut for Vec<u8> seems inconsistent with documentation
The documentation of `BufMut::advance_mut` states the following about panics:
> # Panics
>
> This function **may** panic if `cnt > self.remaining_mut()`.
>
> # Implementer notes
>
> It is recommended for implementations of `... | 2020-03-13T21:55:43Z | 0.5 | 2020-03-28T01:30:52Z | 90e7e650c99b6d231017d9b831a01e95b8c06756 | [
"test_vec_advance_mut"
] | [
"test_bufs_vec",
"test_deref_buf_forwards",
"test_fresh_cursor_vec",
"test_get_u16",
"test_get_u8",
"test_get_u16_buffer_underflow",
"test_vec_deque",
"test_bufs_vec_mut",
"test_clone",
"test_deref_bufmut_forwards",
"test_mut_slice",
"test_put_u16",
"test_put_u8",
"test_vec_as_mut_buf",
... | [] | [] | auto_2025-06-10 | |
tokio-rs/bytes | 253 | tokio-rs__bytes-253 | [
"252"
] | e0e30f00a1248b1de59405da66cd871ccace4f9f | diff --git a/src/bytes.rs b/src/bytes.rs
--- a/src/bytes.rs
+++ b/src/bytes.rs
@@ -1265,6 +1265,8 @@ impl BytesMut {
///
/// Panics if `at > len`.
pub fn split_to(&mut self, at: usize) -> BytesMut {
+ assert!(at <= self.len());
+
BytesMut {
inner: self.inner.split_to(at),
... | diff --git a/tests/test_bytes.rs b/tests/test_bytes.rs
--- a/tests/test_bytes.rs
+++ b/tests/test_bytes.rs
@@ -258,15 +258,10 @@ fn split_to_oob_mut() {
}
#[test]
+#[should_panic]
fn split_to_uninitialized() {
let mut bytes = BytesMut::with_capacity(1024);
- let other = bytes.split_to(128);
-
- assert_e... | BytesMut::split_to doesn't panic as it should
The method's documentation says "Panics if `at > len`". But this test fails (the code doesn't panic):
```
#[test]
#[should_panic]
fn test_split_to() {
let mut buf = BytesMut::from(&b"hello world"[..]);
let len = buf.len();
let x = buf.split_to(len + 1);
... | ah... it probably should panic.. I'm not sure why the test checks that it doesn't... I would love a PR ❤️ | 2019-04-02T21:56:17Z | 0.4 | 2019-04-02T23:24:31Z | e0e30f00a1248b1de59405da66cd871ccace4f9f | [
"split_to_uninitialized"
] | [
"buf::vec_deque::tests::hello_world",
"bytes::test_original_capacity_from_repr",
"bytes::test_original_capacity_to_repr",
"test_bufs_vec",
"test_fresh_cursor_vec",
"test_get_u16",
"test_get_u16_buffer_underflow",
"test_get_u8",
"test_bufs_vec_mut",
"test_put_u8",
"test_clone",
"test_put_u16",
... | [] | [] | auto_2025-06-10 |
tokio-rs/bytes | 197 | tokio-rs__bytes-197 | [
"193"
] | d656d37180db722114f960609c3e6b934b242aee | diff --git a/src/bytes.rs b/src/bytes.rs
--- a/src/bytes.rs
+++ b/src/bytes.rs
@@ -2250,20 +2250,42 @@ impl Inner {
}
if kind == KIND_VEC {
- // Currently backed by a vector, so just use `Vector::reserve`.
+ // If there's enough free space before the start of the buffer, then
+... | diff --git a/tests/test_bytes.rs b/tests/test_bytes.rs
--- a/tests/test_bytes.rs
+++ b/tests/test_bytes.rs
@@ -378,6 +378,21 @@ fn reserve_max_original_capacity_value() {
assert_eq!(bytes.capacity(), 64 * 1024);
}
+// Without either looking at the internals of the BytesMut or doing weird stuff
+// with the memo... | BytesMut memory usage grows without bound
I'm working on a high-throughput network service with Tokio, and I'm running into an issue where the memory used by a `BytesMut` grows without bound as more and more messages are processed. After some debugging, I was able to come up with this minimal example:
extern cra... | I see what is going on. This is kind of the intended behavior as `advance` though I can see how the docs could be confusing.
That said, the case you are illustrating could be optimized by "resetting" the cursors when the read cursor and the write cursor line up.
Do you want to take a stab at implementing that? | 2018-05-04T02:06:16Z | 0.5 | 2018-05-24T21:50:32Z | 90e7e650c99b6d231017d9b831a01e95b8c06756 | [
"reserve_vec_recycling"
] | [
"bytes::test_original_capacity_from_repr",
"bytes::test_original_capacity_to_repr",
"test_bufs_vec",
"test_fresh_cursor_vec",
"test_get_u16",
"test_get_u8",
"test_get_u16_buffer_underflow",
"test_bufs_vec_mut",
"test_clone",
"test_put_u16",
"test_put_u8",
"test_vec_advance_mut",
"test_vec_as... | [] | [] | auto_2025-06-10 |
tokio-rs/bytes | 186 | tokio-rs__bytes-186 | [
"163"
] | 86c83959dc0f72c94bcb2b6aa57efc178f6a7fa2 | diff --git a/src/buf/buf.rs b/src/buf/buf.rs
--- a/src/buf/buf.rs
+++ b/src/buf/buf.rs
@@ -1,5 +1,5 @@
use super::{IntoBuf, Take, Reader, Iter, FromBuf, Chain};
-use byteorder::ByteOrder;
+use byteorder::{BigEndian, ByteOrder, LittleEndian};
use iovec::IoVec;
use std::{cmp, io, ptr};
diff --git a/src/buf/buf.rs b/... | diff --git a/tests/test_buf.rs b/tests/test_buf.rs
--- a/tests/test_buf.rs
+++ b/tests/test_buf.rs
@@ -33,15 +33,15 @@ fn test_get_u8() {
#[test]
fn test_get_u16() {
let buf = b"\x21\x54zomg";
- assert_eq!(0x2154, Cursor::new(buf).get_u16::<byteorder::BigEndian>());
- assert_eq!(0x5421, Cursor::new(buf).ge... | Object safety for traits
Currently, rust complains:
```
error[E0038]: the trait `bytes::Buf` cannot be made into an object
--> src/proto.rs:17:5
|
17 | buf: Option<Box<Buf>>,
| ^^^^^^^^^^^^^^^^^^^^^ the trait `bytes::Buf` cannot be made into an object
|
= note: method `get_u16` has generi... | One option is to add `where` clauses to all these fns, but then they would not be available as part of the trait object.
Adding `_be` and `_le` suffixes to the trait is the better option here.
Is adding `where` clauses a backward-compatible change? I.e. can we add `where` clauses deprecate the methods and add new on... | 2018-03-08T21:19:29Z | 0.4 | 2018-03-12T16:26:00Z | e0e30f00a1248b1de59405da66cd871ccace4f9f | [
"bytes::test_original_capacity_from_repr",
"bytes::test_original_capacity_to_repr",
"test_bufs_vec",
"test_fresh_cursor_vec",
"test_get_u16",
"test_get_u8",
"test_get_u16_buffer_underflow",
"test_bufs_vec_mut",
"test_put_u16",
"test_clone",
"test_put_u8",
"test_vec_advance_mut",
"test_vec_as... | [] | [] | [] | auto_2025-06-10 |
tokio-rs/bytes | 643 | tokio-rs__bytes-643 | [
"533"
] | 09214ba51bdace6f6cb91740cee9514fc08d55ce | diff --git a/src/bytes.rs b/src/bytes.rs
--- a/src/bytes.rs
+++ b/src/bytes.rs
@@ -112,6 +112,8 @@ pub(crate) struct Vtable {
///
/// takes `Bytes` to value
pub to_vec: unsafe fn(&AtomicPtr<()>, *const u8, usize) -> Vec<u8>,
+ /// fn(data)
+ pub is_unique: unsafe fn(&AtomicPtr<()>) -> bool,
//... | diff --git a/tests/test_bytes.rs b/tests/test_bytes.rs
--- a/tests/test_bytes.rs
+++ b/tests/test_bytes.rs
@@ -1208,3 +1208,36 @@ fn test_bytes_capacity_len() {
}
}
}
+
+#[test]
+fn static_is_unique() {
+ let b = Bytes::from_static(LONG);
+ assert!(!b.is_unique());
+}
+
+#[test]
+fn vec_is_unique()... | Add a way to tell if `Bytes` is unique
I would like to be able to tell if a `Bytes` object is the unique reference to the underlying data. The usecase is a cache, where I want to be able to evict an object from the cache only if it is not used elsewhere — otherwise, removing it from the cache would not free up any memo... | Seems reasonable enough to me.
@zyxw59 What about instances created using `Bytes::from_static`?
I think in that case it is probably correct to always say that it is not unique (since there always *might* be other copies)
I think this can be easily implemented by adding another function to `Vtable` of `Bytes`. | 2023-12-20T16:59:12Z | 1.5 | 2024-01-19T22:59:31Z | 09214ba51bdace6f6cb91740cee9514fc08d55ce | [
"copy_to_bytes_less",
"test_deref_buf_forwards",
"copy_to_bytes_overflow - should panic",
"test_bufs_vec",
"test_fresh_cursor_vec",
"test_get_u16",
"test_get_u16_buffer_underflow - should panic",
"test_get_u8",
"test_vec_deque",
"copy_from_slice_panics_if_different_length_1 - should panic",
"cop... | [] | [] | [] | auto_2025-06-10 |
tokio-rs/bytes | 560 | tokio-rs__bytes-560 | [
"559"
] | 38fd42acbaced11ff19f0a4ca2af44a308af5063 | diff --git a/src/bytes_mut.rs b/src/bytes_mut.rs
--- a/src/bytes_mut.rs
+++ b/src/bytes_mut.rs
@@ -670,7 +670,10 @@ impl BytesMut {
// Compare the condition in the `kind == KIND_VEC` case above
// for more details.
- if v_capacity >= new_cap && offset >= len {
+ ... | diff --git a/tests/test_bytes.rs b/tests/test_bytes.rs
--- a/tests/test_bytes.rs
+++ b/tests/test_bytes.rs
@@ -515,6 +515,34 @@ fn reserve_in_arc_unique_doubles() {
assert_eq!(2000, bytes.capacity());
}
+#[test]
+fn reserve_in_arc_unique_does_not_overallocate_after_split() {
+ let mut bytes = BytesMut::from(... | reserve_inner over allocates which can lead to a OOM conidition
# Summary
`reseve_inner` will double the size of the underlying shared vector instead of just extending the BytesMut buffer in place if a call to `BytesMut::reserve` would fit inside the current allocated shared buffer. If this happens repeatedly you wi... | 2022-07-29T23:42:13Z | 1.2 | 2022-07-30T16:42:55Z | 38fd42acbaced11ff19f0a4ca2af44a308af5063 | [
"reserve_in_arc_unique_does_not_overallocate_after_multiple_splits",
"reserve_in_arc_unique_does_not_overallocate_after_split"
] | [
"copy_to_bytes_less",
"test_bufs_vec",
"copy_to_bytes_overflow - should panic",
"test_deref_buf_forwards",
"test_fresh_cursor_vec",
"test_get_u16",
"test_get_u16_buffer_underflow - should panic",
"test_get_u8",
"test_vec_deque",
"test_deref_bufmut_forwards",
"test_clone",
"copy_from_slice_pani... | [] | [] | auto_2025-06-10 | |
tokio-rs/bytes | 547 | tokio-rs__bytes-547 | [
"427"
] | 068ed41bc02c21fe0a0a4d8e95af8a4668276f5d | diff --git a/src/bytes.rs b/src/bytes.rs
--- a/src/bytes.rs
+++ b/src/bytes.rs
@@ -109,6 +109,10 @@ pub(crate) struct Vtable {
/// fn(data, ptr, len)
pub clone: unsafe fn(&AtomicPtr<()>, *const u8, usize) -> Bytes,
/// fn(data, ptr, len)
+ ///
+ /// takes `Bytes` to value
+ pub to_vec: unsafe fn... | diff --git a/tests/test_bytes.rs b/tests/test_bytes.rs
--- a/tests/test_bytes.rs
+++ b/tests/test_bytes.rs
@@ -1065,3 +1065,73 @@ fn bytes_into_vec() {
let vec: Vec<u8> = bytes.into();
assert_eq!(&vec, prefix);
}
+
+#[test]
+fn test_bytes_into_vec() {
+ // Test STATIC_VTABLE.to_vec
+ let bs = b"1b23exf... | Conversion from Bytes to Vec<u8>?
According to this thread https://github.com/tokio-rs/bytes/pull/151/commits/824a986fec988eaa7f9313838a01c7ff6d0e85bb conversion from `Bytes` to `Vec<u8>` has ever existed but not found today. Is it deleted? but what reason? Is there some workaround today?
I want to use `Bytes` entir... | I think you should look into just using `Bytes` everywhere.
`Bytes` in the end is a type-erased buffer, and it may or may not contain a `Vec<u8>`. Depending on what it is - which might again depend on the current version of `Bytes` - the conversion might either be rather cheap or involve a full allocation and copy.... | 2022-05-01T12:23:57Z | 1.1 | 2022-07-13T07:04:28Z | 068ed41bc02c21fe0a0a4d8e95af8a4668276f5d | [
"copy_to_bytes_less",
"test_deref_buf_forwards",
"test_bufs_vec",
"copy_to_bytes_overflow - should panic",
"test_fresh_cursor_vec",
"test_get_u16",
"test_get_u16_buffer_underflow - should panic",
"test_get_u8",
"test_vec_deque",
"copy_from_slice_panics_if_different_length_2 - should panic",
"tes... | [] | [] | [] | auto_2025-06-10 |
tokio-rs/bytes | 543 | tokio-rs__bytes-543 | [
"427"
] | f514bd38dac85695e9053d990b251643e9e4ef92 | diff --git a/src/bytes_mut.rs b/src/bytes_mut.rs
--- a/src/bytes_mut.rs
+++ b/src/bytes_mut.rs
@@ -1540,6 +1540,43 @@ impl PartialEq<Bytes> for BytesMut {
}
}
+impl From<BytesMut> for Vec<u8> {
+ fn from(mut bytes: BytesMut) -> Self {
+ let kind = bytes.kind();
+
+ let mut vec = if kind == KIND... | diff --git a/tests/test_bytes.rs b/tests/test_bytes.rs
--- a/tests/test_bytes.rs
+++ b/tests/test_bytes.rs
@@ -1028,3 +1028,40 @@ fn box_slice_empty() {
let b = Bytes::from(empty);
assert!(b.is_empty());
}
+
+#[test]
+fn bytes_into_vec() {
+ // Test kind == KIND_VEC
+ let content = b"helloworld";
+
+ ... | Conversion from Bytes to Vec<u8>?
According to this thread https://github.com/tokio-rs/bytes/pull/151/commits/824a986fec988eaa7f9313838a01c7ff6d0e85bb conversion from `Bytes` to `Vec<u8>` has ever existed but not found today. Is it deleted? but what reason? Is there some workaround today?
I want to use `Bytes` entir... | I think you should look into just using `Bytes` everywhere.
`Bytes` in the end is a type-erased buffer, and it may or may not contain a `Vec<u8>`. Depending on what it is - which might again depend on the current version of `Bytes` - the conversion might either be rather cheap or involve a full allocation and copy.... | 2022-04-20T09:50:32Z | 1.1 | 2022-07-10T12:25:14Z | 068ed41bc02c21fe0a0a4d8e95af8a4668276f5d | [
"copy_to_bytes_less",
"test_deref_buf_forwards",
"copy_to_bytes_overflow - should panic",
"test_bufs_vec",
"test_fresh_cursor_vec",
"test_get_u16",
"test_get_u8",
"test_get_u16_buffer_underflow - should panic",
"test_vec_deque",
"test_deref_bufmut_forwards",
"copy_from_slice_panics_if_different_... | [] | [] | [] | auto_2025-06-10 |
chronotope/chrono | 991 | chronotope__chrono-991 | [
"295"
] | daa86a77d36d74f474913fd3b560a40f1424bd77 | diff --git a/src/naive/isoweek.rs b/src/naive/isoweek.rs
--- a/src/naive/isoweek.rs
+++ b/src/naive/isoweek.rs
@@ -46,7 +46,8 @@ pub(super) fn iso_week_from_yof(year: i32, of: Of) -> IsoWeek {
(year, rawweek)
}
};
- IsoWeek { ywf: (year << 10) | (week << 4) as DateImpl | DateImpl::from(of.... | diff --git a/src/naive/isoweek.rs b/src/naive/isoweek.rs
--- a/src/naive/isoweek.rs
+++ b/src/naive/isoweek.rs
@@ -164,4 +165,38 @@ mod tests {
assert_eq!(maxweek.week0(), 0);
assert_eq!(format!("{:?}", maxweek), NaiveDate::MAX.format("%G-W%V").to_string());
}
+
+ #[test]
+ fn test_iso_week... | IsoWeek comparisons seem off
Intuitively, this test should pass. Is this intentional behavior?
```
#[test]
fn iso_week_lt() {
use chrono::{Local,TimeZone,Datelike};
let week1 = Local.ymd(2018,12,31).iso_week();
let week2 = Local.ymd(2019,01,01).iso_week();
println!("{:?} < {:?}", week1, week2);... | 2023-03-15T16:09:26Z | 0.4 | 2023-03-16T13:21:19Z | d8a177e4f5cc7512b8cbe8a5d27e68d6cfcfb8fd | [
"naive::isoweek::tests::test_iso_week_equivalence_for_last_week",
"naive::isoweek::tests::test_iso_week_equivalence_for_first_week",
"naive::isoweek::tests::test_iso_week_ordering_for_first_week",
"naive::isoweek::tests::test_iso_week_ordering_for_last_week"
] | [
"date::tests::test_date_add_assign",
"date::tests::test_date_sub_assign",
"date::tests::test_years_elapsed",
"date::tests::test_date_add_assign_local",
"date::tests::test_date_sub_assign_local",
"datetime::rustc_serialize::test_encodable",
"datetime::rustc_serialize::test_decodable_timestamps",
"datet... | [] | [] | auto_2025-06-13 | |
chronotope/chrono | 375 | chronotope__chrono-375 | [
"354"
] | b9cd0ce8039a03db54de9049b574aedcad2269c1 | diff --git a/CHANGELOG.md b/CHANGELOG.md
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -14,6 +14,7 @@ Versions with only mechanical changes will be omitted from the following list.
* Support "negative UTC" in `parse_from_rfc2822` (@quodlibetor #368 reported in
#102)
+* Support comparisons of DateTimes with different t... | diff --git a/src/datetime.rs b/src/datetime.rs
--- a/src/datetime.rs
+++ b/src/datetime.rs
@@ -2032,6 +2047,9 @@ mod tests {
assert_eq!(d.date(), tz.ymd(2017, 8, 9));
assert_eq!(d.date().naive_local(), NaiveDate::from_ymd(2017, 8, 9));
assert_eq!(d.date().and_time(d.time()), Some(d));
+
+ ... | Implement comparison for DateTimes with different TimeZones
PartialEq is implemented for different timezones:
`impl<Tz: TimeZone, Tz2: TimeZone> PartialEq<DateTime<Tz2>> for DateTime<Tz>`
but PartialOrd is only implemented for the same timezone:
`impl<Tz: TimeZone> PartialOrd<DateTime<Tz>> for DateTime<Tz>`
Examp... | This should not be too hard to implement and I agree it would be a great feature! | 2019-12-16T11:59:50Z | 0.4 | 2019-12-30T22:16:07Z | d8a177e4f5cc7512b8cbe8a5d27e68d6cfcfb8fd | [
"datetime::rustc_serialize::test_encodable",
"datetime::serde::test_serde_bincode",
"datetime::rustc_serialize::test_decodable_timestamps",
"datetime::rustc_serialize::test_decodable",
"datetime::test_auto_conversion",
"datetime::tests::test_datetime_date_and_time",
"datetime::serde::test_serde_serializ... | [] | [] | [] | auto_2025-06-13 |
chronotope/chrono | 368 | chronotope__chrono-368 | [
"102"
] | 19dd051d22a223d908ed636d322ba2482adb216b | diff --git a/CHANGELOG.md b/CHANGELOG.md
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -10,6 +10,11 @@ Versions with only mechanical changes will be omitted from the following list.
## next
+### Improvements
+
+* Support "negative UTC" in `parse_from_rfc2822` (@quodlibetor #368 reported in
+ #102)
+
### Internal impr... | diff --git a/src/datetime.rs b/src/datetime.rs
--- a/src/datetime.rs
+++ b/src/datetime.rs
@@ -2051,6 +2051,8 @@ mod tests {
assert_eq!(DateTime::parse_from_rfc2822("Wed, 18 Feb 2015 23:16:09 +0000"),
Ok(FixedOffset::east(0).ymd(2015, 2, 18).and_hms(23, 16, 9)));
+ assert_eq!(DateT... | Bug in parse_from_rfc2822 with -0000 timezone
The following program:
``` rust
extern crate chrono;
use chrono::datetime::DateTime;
fn main() {
let minus = "Fri, 1 Feb 2013 13:51:20 -0000";
let plus = "Fri, 1 Feb 2013 13:51:20 +0000";
println!("{} -> {:?}",minus,DateTime::parse_from_rfc2822(minus));
... | My understanding is that [`-0000` indicates the absence of useful time zone information](https://tools.ietf.org/html/rfc2822#page-15). I'm less sure about what it actually means (especially in practice), however---is it a local time, a UTC without no local time offset (possible with a different interpretation of RFC 28... | 2019-11-30T21:48:59Z | 0.4 | 2019-11-30T22:59:24Z | d8a177e4f5cc7512b8cbe8a5d27e68d6cfcfb8fd | [
"datetime::tests::test_datetime_rfc2822_and_rfc3339"
] | [
"datetime::test_auto_conversion",
"datetime::tests::test_datetime_date_and_time",
"datetime::tests::test_datetime_format_alignment",
"datetime::tests::test_datetime_format_with_local",
"datetime::tests::test_datetime_is_copy",
"datetime::tests::test_datetime_from_str",
"datetime::tests::test_datetime_of... | [] | [] | auto_2025-06-13 |
chronotope/chrono | 508 | chronotope__chrono-508 | [
"495"
] | 2e0936bc3dfe4799f49fec6c0e237e0adb2aa2c5 | diff --git a/CHANGELOG.md b/CHANGELOG.md
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -15,6 +15,7 @@ Versions with only mechanical changes will be omitted from the following list.
* Add more formatting documentation and examples.
* Add support for microseconds timestamps serde serialization/deserialization (#304)
+* Fi... | diff --git a/src/round.rs b/src/round.rs
--- a/src/round.rs
+++ b/src/round.rs
@@ -395,6 +399,28 @@ mod tests {
dt.duration_round(Duration::days(1)).unwrap().to_string(),
"2012-12-13 00:00:00 UTC"
);
+
+ // timezone east
+ let dt = FixedOffset::east(1 * 3600).ymd(2020, 1... | chrono::DurationRound is not TZ aware
The functions implemented in the chrono::DurationRound trait return wrong values when a time zone is involved.
The TZ offset "leaks" into the time value.
[Example on Rust Playground.](https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=c3229ea84b66a4beae8817... | 2020-11-30T20:02:59Z | 0.4 | 2020-12-21T09:52:55Z | d8a177e4f5cc7512b8cbe8a5d27e68d6cfcfb8fd | [
"round::tests::test_duration_round",
"round::tests::test_duration_trunc"
] | [
"datetime::test_auto_conversion",
"datetime::tests::test_datetime_date_and_time",
"datetime::tests::test_datetime_format_alignment",
"datetime::tests::test_datetime_is_copy",
"datetime::tests::test_datetime_format_with_local",
"datetime::tests::test_datetime_is_send",
"datetime::tests::test_datetime_fro... | [
"src/lib.rs - (line 239)"
] | [] | auto_2025-06-13 | |
chronotope/chrono | 445 | chronotope__chrono-445 | [
"280"
] | e90050c852a8be1f1541dabb39294816d891239b | diff --git a/CHANGELOG.md b/CHANGELOG.md
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -10,6 +10,9 @@ Versions with only mechanical changes will be omitted from the following list.
## 0.4.13 (unreleased)
+### Features
+
+* Add `DurationRound` trait that allows rounding and truncating by `Duration` (@robyoung)
## 0.4... | diff --git a/src/round.rs b/src/round.rs
--- a/src/round.rs
+++ b/src/round.rs
@@ -1,8 +1,15 @@
// This is a part of Chrono.
// See README.md and LICENSE.txt for details.
+use core::cmp::Ordering;
+use core::fmt;
+use core::marker::Sized;
use core::ops::{Add, Sub};
+use datetime::DateTime;
use oldtime::Duration;
... | Add round/truncate functions for any specified Duration
It would be very useful for some use cases to have a round or truncate function for any specified Duration.
For now, I'm doing this to truncate some DateTime to a 5 minutes interval:
```rust
let dt = Utc::now();
let round_down = dt.timestamp() % (5 *... | https://docs.rs/chrono/0.4.11/chrono/trait.SubsecRound.html
Could be closed.
> https://docs.rs/chrono/0.4.11/chrono/trait.SubsecRound.html
>
> Could be closed.
Hi @gwik. Actually, this isn't the same as what I asked. The SubsecRound trait you linked does truncate or round a DateTime, but only by a specified ... | 2020-07-02T20:23:41Z | 0.4 | 2020-10-27T15:28:20Z | d8a177e4f5cc7512b8cbe8a5d27e68d6cfcfb8fd | [
"src/round.rs - round::RoundingError::DurationExceedsLimit (line 222)",
"src/round.rs - round::DurationRound::duration_trunc (line 131)",
"src/round.rs - round::RoundingError::DurationExceedsTimestamp (line 209)",
"src/round.rs - round::RoundingError::TimestampExceedsLimit (line 235)",
"src/round.rs - round... | [
"datetime::test_auto_conversion",
"datetime::tests::test_datetime_date_and_time",
"datetime::tests::test_datetime_format_with_local",
"datetime::tests::test_datetime_is_copy",
"datetime::tests::test_datetime_format_alignment",
"datetime::tests::test_datetime_is_send",
"datetime::tests::test_datetime_fro... | [] | [] | auto_2025-06-13 |
chronotope/chrono | 378 | chronotope__chrono-378 | [
"147"
] | b9cd0ce8039a03db54de9049b574aedcad2269c1 | diff --git a/CHANGELOG.md b/CHANGELOG.md
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -12,6 +12,9 @@ Versions with only mechanical changes will be omitted from the following list.
### Improvements
+* Support a space or `T` in `FromStr` for `DateTime<Tz>`, meaning that e.g.
+ `dt.to_string().parse::<DateTime<Utc>>()` ... | diff --git a/src/datetime.rs b/src/datetime.rs
--- a/src/datetime.rs
+++ b/src/datetime.rs
@@ -21,7 +21,7 @@ use offset::Local;
use offset::{TimeZone, Offset, Utc, FixedOffset};
use naive::{NaiveTime, NaiveDateTime, IsoWeek};
use Date;
-use format::{Item, Numeric, Pad, Fixed};
+use format::{Item, Fixed};
use format... | Consider including the `T` in Display of DateTime
Currently, you cannot roundtrip a DateTime to a String through `ToString` and back with `FromStr`, because `FromStr` rejects strings without the `T` between the date and time, and `ToString` does not include it. This is pretty surprising behavior IMO, and it doesn't see... | If you are talking about `DateTime` (instead of `NaiveDateTime`) this is much harder because it can display any string the `Offset` implementation chose to display. For example, `DateTime<UTC>` will print something like `2017-05-11 02:50:47 UTC` right now. | 2019-12-27T15:46:05Z | 0.4 | 2019-12-30T22:15:53Z | d8a177e4f5cc7512b8cbe8a5d27e68d6cfcfb8fd | [
"datetime::test_auto_conversion",
"datetime::rustc_serialize::test_encodable",
"datetime::serde::test_serde_serialize",
"datetime::serde::test_serde_bincode",
"datetime::tests::test_datetime_date_and_time",
"datetime::rustc_serialize::test_decodable_timestamps",
"datetime::tests::test_datetime_is_copy",... | [] | [] | [] | auto_2025-06-13 |
chronotope/chrono | 1,621 | chronotope__chrono-1621 | [
"1620"
] | d8a177e4f5cc7512b8cbe8a5d27e68d6cfcfb8fd | diff --git a/src/weekday.rs b/src/weekday.rs
--- a/src/weekday.rs
+++ b/src/weekday.rs
@@ -171,7 +171,7 @@ impl Weekday {
impl fmt::Display for Weekday {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
- f.write_str(match *self {
+ f.pad(match *self {
Weekday::Mon => "Mon",
... | diff --git a/src/weekday.rs b/src/weekday.rs
--- a/src/weekday.rs
+++ b/src/weekday.rs
@@ -331,6 +331,16 @@ mod tests {
}
}
+ #[test]
+ fn test_formatting_alignment() {
+ // No exhaustive testing here as we just delegate the
+ // implementation to Formatter::pad. Just some basic smok... | `std::fmt::Display` implementation of `Weekday` does not honour width, alignment or fill
## Summary
The `Display` implementation of `Weekday` uses `Formatter::write_str`, which doesn't honour [width](https://doc.rust-lang.org/std/fmt/index.html#width) or [alignment and fill](https://doc.rust-lang.org/std/fmt/index.h... | Looking further, seems like the easy way out is to use [`Formatter::pad`](https://doc.rust-lang.org/std/fmt/struct.Formatter.html#method.pad) instead of `write_str`.
Happy to review a PR for this! | 2024-10-14T10:47:56Z | 0.4 | 2024-10-14T10:58:54Z | d8a177e4f5cc7512b8cbe8a5d27e68d6cfcfb8fd | [
"weekday::tests::test_formatting_alignment"
] | [
"date::tests::test_date_add_assign",
"date::tests::test_date_sub_assign",
"date::tests::test_date_add_assign_local",
"date::tests::test_date_sub_assign_local",
"date::tests::test_years_elapsed",
"datetime::tests::nano_roundrip",
"datetime::tests::test_add_sub_months",
"datetime::tests::signed_duration... | [] | [] | auto_2025-06-13 |
chronotope/chrono | 320 | chronotope__chrono-320 | [
"233"
] | 96c451ec20f045eebcfb05dd770bd265cdd01c0e | diff --git a/src/format/mod.rs b/src/format/mod.rs
--- a/src/format/mod.rs
+++ b/src/format/mod.rs
@@ -334,9 +334,15 @@ const BAD_FORMAT: ParseError = ParseError(ParseErrorKind::BadFormat);
/// Tries to format given arguments with given formatting items.
/// Internally used by `DelayedFormat`.
-pub fn format<'a, ... | diff --git a/src/datetime.rs b/src/datetime.rs
--- a/src/datetime.rs
+++ b/src/datetime.rs
@@ -1721,4 +1721,34 @@ mod tests {
assert_eq!(SystemTime::from(epoch.with_timezone(&FixedOffset::east(32400))), UNIX_EPOCH);
assert_eq!(SystemTime::from(epoch.with_timezone(&FixedOffset::west(28800))), UNIX_EPOC... | DelayedFormat does not respect format items
[This code](https://play.rust-lang.org/?gist=b9a3b5a1faaf2042346d1c269022b6f9&version=stable):
```rust
extern crate chrono;
fn main() {
let date = chrono::Utc::now();
let tz = date.format("%Z");
println!("left {:>10} right", tz.to_string());
println... | 2019-06-21T20:48:49Z | 0.4 | 2019-06-25T01:36:10Z | d8a177e4f5cc7512b8cbe8a5d27e68d6cfcfb8fd | [
"datetime::tests::test_datetime_format_alignment"
] | [
"datetime::rustc_serialize::test_encodable",
"datetime::rustc_serialize::test_decodable_timestamps",
"datetime::serde::test_serde_bincode",
"datetime::serde::test_serde_serialize",
"datetime::test_auto_conversion",
"datetime::tests::test_datetime_date_and_time",
"datetime::rustc_serialize::test_decodabl... | [] | [] | auto_2025-06-13 | |
chronotope/chrono | 308 | chronotope__chrono-308 | [
"307"
] | 77110ffecbc9831210335e40b46b0f6d00d41cd7 | diff --git a/src/offset/mod.rs b/src/offset/mod.rs
--- a/src/offset/mod.rs
+++ b/src/offset/mod.rs
@@ -381,6 +381,28 @@ pub trait TimeZone: Sized + Clone {
self.timestamp_opt(secs, millis as u32 * 1_000_000)
}
+ /// Makes a new `DateTime` from the number of non-leap nanoseconds
+ /// since January... | diff --git a/src/offset/mod.rs b/src/offset/mod.rs
--- a/src/offset/mod.rs
+++ b/src/offset/mod.rs
@@ -466,4 +488,25 @@ mod tests {
let dt = Utc.timestamp_millis(-3600000);
assert_eq!(dt.to_string(), "1969-12-31 23:00:00 UTC");
}
+
+ #[test]
+ fn test_negative_nanos() {
+ let dt = Ut... | Creating a TimeZone from epoch nanosecond
We should be able to construct a `TimeZone` from a nanosecond timestamp produced by `DateTime::timestamp_nanos()`.
This is similar to #264 but for nanosecond.
| 2019-03-06T15:39:47Z | 0.4 | 2019-04-07T21:41:52Z | d8a177e4f5cc7512b8cbe8a5d27e68d6cfcfb8fd | [
"datetime::rustc_serialize::test_encodable",
"datetime::serde::test_serde_bincode",
"datetime::rustc_serialize::test_decodable_timestamps",
"datetime::tests::test_datetime_date_and_time",
"datetime::rustc_serialize::test_decodable",
"datetime::serde::test_serde_serialize",
"datetime::tests::test_datetim... | [] | [] | [] | auto_2025-06-13 | |
chronotope/chrono | 242 | chronotope__chrono-242 | [
"219"
] | 9276929c58d9e8434a57676967e34c1b58e31fca | diff --git a/src/format/mod.rs b/src/format/mod.rs
--- a/src/format/mod.rs
+++ b/src/format/mod.rs
@@ -213,29 +213,22 @@ pub enum Fixed {
}
/// An opaque type representing fixed-format item types for internal uses only.
+#[derive(Debug, Clone, PartialEq, Eq)]
pub struct InternalFixed {
- _dummy: Void,
-}
-
-imp... | diff --git a/src/format/parse.rs b/src/format/parse.rs
--- a/src/format/parse.rs
+++ b/src/format/parse.rs
@@ -570,6 +572,10 @@ fn test_parse() {
check!("zulu", [fix!(TimezoneOffsetZ), lit!("ulu")]; offset: 0);
check!("+1234ulu", [fix!(TimezoneOffsetZ), lit!("ulu")]; offset: 754 * 60);
check!("+12:... | supported timezone syntax for DateTime from string
I'm trying to accommodate the default timezone syntax returned from postgresql. It seems to provide an abbreviated form that chrono may not support-- it omits 00 minutes. Is there support for this in Chrono?
http://play.integer32.com/?gist=b6394d764deb6a4bcf7b1b... | Postgres returns the timezone as just the hours offset, not including the minutes? While I believe you, is that documented anywhere?
As per the gurus in #postgresql on Freenode, the minutes are explicitly optional in the iso spec
Yeah this is a bug.
Note that the pattern in the above example should not have a '-'... | 2018-04-25T02:19:18Z | 0.4 | 2018-07-10T13:58:22Z | d8a177e4f5cc7512b8cbe8a5d27e68d6cfcfb8fd | [
"datetime::serde::test_serde_bincode",
"datetime::rustc_serialize::test_encodable",
"datetime::tests::test_datetime_date_and_time",
"datetime::rustc_serialize::test_decodable_timestamps",
"datetime::serde::test_serde_deserialize",
"datetime::rustc_serialize::test_decodable",
"datetime::tests::test_datet... | [] | [] | [] | auto_2025-06-13 |
chronotope/chrono | 711 | chronotope__chrono-711 | [
"687"
] | 13e1d483657a2e4d0f06a8692432cb90c4e98e9a | diff --git a/CHANGELOG.md b/CHANGELOG.md
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -32,6 +32,7 @@ Versions with only mechanical changes will be omitted from the following list.
* Fix panicking when parsing a `DateTime` (@botahamec)
* Add support for getting week bounds based on a specific `NaiveDate` and a `Weekday` (... | diff --git a/src/naive/datetime/tests.rs b/src/naive/datetime/tests.rs
--- a/src/naive/datetime/tests.rs
+++ b/src/naive/datetime/tests.rs
@@ -1,7 +1,7 @@
use super::NaiveDateTime;
use crate::naive::{NaiveDate, MAX_DATE, MIN_DATE};
use crate::oldtime::Duration;
-use crate::Datelike;
+use crate::{Datelike, FixedOffse... | Make conversion from NaiveDateTime to DateTime easier
Hello,
I noticed that the conversion from a NaiveDateTime to a DateTime by supplying a TimeZone is not really as easy as it could be (or IDE-friendly).
Mostly, I think the problem is that you have the conversion method on the `TimeZone` trait, instead of on th... | I'll work on the first issue, but the second part of this should probably be moved to its own issue. Would you like to make a new one? It's a complicated problem that I think would require a breaking change. | 2022-06-15T23:11:05Z | 0.4 | 2022-06-21T12:22:00Z | d8a177e4f5cc7512b8cbe8a5d27e68d6cfcfb8fd | [
"date::tests::test_date_add_assign",
"date::tests::test_date_sub_assign",
"date::tests::test_years_elapsed",
"date::tests::test_date_add_assign_local",
"date::tests::test_date_sub_assign_local",
"datetime::rustc_serialize::test_encodable",
"datetime::rustc_serialize::test_decodable_timestamps",
"datet... | [] | [] | [] | auto_2025-06-13 |
chronotope/chrono | 686 | chronotope__chrono-686 | [
"645"
] | 752e69ae1ff600304250a5da117a3dd40f99581a | diff --git a/CHANGELOG.md b/CHANGELOG.md
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -27,6 +27,7 @@ Versions with only mechanical changes will be omitted from the following list.
* Add support for optional timestamps serde serialization for `NaiveDateTime`.
* Fix build for wasm32-unknown-emscripten (@yu-re-ka #593)
* I... | diff --git a/src/datetime/tests.rs b/src/datetime/tests.rs
--- a/src/datetime/tests.rs
+++ b/src/datetime/tests.rs
@@ -126,6 +126,7 @@ fn test_datetime_rfc2822_and_rfc3339() {
DateTime::parse_from_rfc2822("Wed, 18 Feb 2015 23:59:60 +0500"),
Ok(edt.ymd(2015, 2, 18).and_hms_milli(23, 59, 59, 1_000))
... | Panic in `parse_from_rfc2822` with overflowing date
```rust
#[test]
fn panic() {
chrono::DateTime::parse_from_rfc2822("31 DEC 262143 23:59 -2359");
}
```
| Sorry for the slow response -- would you be able to submit a PR for this, including this as a test?
I took a bit of a look at this. The panic seems to be caused by this function in `offset/mod.rs`
```rust
/// Converts the local `NaiveDateTime` to the timezone-aware `DateTime` if possible.
#[allow(clippy::wrong_sel... | 2022-05-05T20:08:42Z | 0.4 | 2022-06-09T20:21:59Z | d8a177e4f5cc7512b8cbe8a5d27e68d6cfcfb8fd | [
"datetime::tests::test_datetime_rfc2822_and_rfc3339"
] | [
"date::tests::test_years_elapsed",
"datetime::rustc_serialize::test_decodable_timestamps",
"datetime::rustc_serialize::test_encodable",
"datetime::serde::test_serde_bincode",
"datetime::test_auto_conversion",
"datetime::rustc_serialize::test_decodable",
"datetime::serde::test_serde_serialize",
"dateti... | [] | [] | auto_2025-06-13 |
chronotope/chrono | 1,403 | chronotope__chrono-1403 | [
"1375"
] | ef9a4c9539da5e463a0b8c9dd45920f3a265f421 | diff --git a/src/round.rs b/src/round.rs
--- a/src/round.rs
+++ b/src/round.rs
@@ -177,9 +177,6 @@ where
return Err(RoundingError::DurationExceedsLimit);
}
let stamp = naive.timestamp_nanos_opt().ok_or(RoundingError::TimestampExceedsLimit)?;
- if span > stamp.abs() {
- r... | diff --git a/src/round.rs b/src/round.rs
--- a/src/round.rs
+++ b/src/round.rs
@@ -769,4 +755,43 @@ mod tests {
let span = TimeDelta::nanoseconds(-9_223_372_036_854_771_421);
assert_eq!(dt.duration_round(span), Err(RoundingError::DurationExceedsLimit));
}
+
+ #[test]
+ fn test_duration_trun... | Truncating a timestamp close to EPOCH fails
Due to this check in `duration_truc`:
https://github.com/chronotope/chrono/blob/main/src/round.rs#L221-L223
Expected behaviour: I should be able to truncate the timestamp to 0
| I'd be happy to review a PR -- I probably won't have time to work on this myself.
It's not urgent for me but I think I will find time for it
To be honest in my opinion the API and approach in the `round` module is fundamentally flawed. A lot of the behavior doesn't make sense, especially for a library that tries to d... | 2024-02-02T12:55:03Z | 0.4 | 2024-02-07T13:14:57Z | d8a177e4f5cc7512b8cbe8a5d27e68d6cfcfb8fd | [
"round::tests::test_duration_round_close_to_epoch",
"round::tests::test_duration_round_close_to_min_max",
"round::tests::test_duration_trunc_close_to_epoch"
] | [
"date::tests::test_date_add_assign",
"date::tests::test_date_sub_assign",
"date::tests::test_years_elapsed",
"date::tests::test_date_add_assign_local",
"date::tests::test_date_sub_assign_local",
"datetime::tests::nano_roundrip",
"datetime::tests::signed_duration_since_autoref",
"datetime::tests::test_... | [] | [] | auto_2025-06-13 |
chronotope/chrono | 1,323 | chronotope__chrono-1323 | [
"1289"
] | ce4644f5df6878f3c08a8dc8785433f16c9055c3 | diff --git a/.github/dependabot.yml b/.github/dependabot.yml
--- a/.github/dependabot.yml
+++ b/.github/dependabot.yml
@@ -4,11 +4,14 @@ updates:
directory: "/"
schedule:
interval: "weekly"
+ target-branch: "0.4.x"
- package-ecosystem: "cargo"
directory: "/fuzz/"
schedule:
interv... | diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -74,7 +74,7 @@ jobs:
- uses: Swatinem/rust-cache@v2
- run: |
cargo hack check --feature-powerset --optional-deps serde,rkyv \
- --skip __internal_... | Utc nanoseconds do not always roundtrip
# Reproducer
## Code
```rust
#[test]
fn nano_roundrip() {
let nanos = i64::MIN + 2;
let dt = Utc.timestamp_nanos(nanos);
let nanos2 = dt.timestamp_nanos();
assert_eq!(nanos, nanos2);
}
```
## Expected Result
Test passes.
## Actual Result
Test p... | 2023-09-26T14:44:51Z | 1.57 | 2023-09-26T15:57:54Z | ce4644f5df6878f3c08a8dc8785433f16c9055c3 | [
"date::tests::test_date_sub_assign",
"date::tests::test_date_add_assign",
"date::tests::test_date_add_assign_local",
"date::tests::test_date_sub_assign_local",
"date::tests::test_years_elapsed",
"datetime::serde::tests::test_serde_bincode",
"datetime::serde::tests::test_serde_deserialize",
"datetime::... | [] | [] | [] | auto_2025-06-13 | |
chronotope/chrono | 1,294 | chronotope__chrono-1294 | [
"1289"
] | 46ad2c2b2c901eb20e43a7fca025aac02605bda4 | diff --git a/src/naive/datetime/mod.rs b/src/naive/datetime/mod.rs
--- a/src/naive/datetime/mod.rs
+++ b/src/naive/datetime/mod.rs
@@ -503,7 +503,26 @@ impl NaiveDateTime {
#[inline]
#[must_use]
pub fn timestamp_nanos_opt(&self) -> Option<i64> {
- self.timestamp().checked_mul(1_000_000_000)?.check... | diff --git a/src/datetime/tests.rs b/src/datetime/tests.rs
--- a/src/datetime/tests.rs
+++ b/src/datetime/tests.rs
@@ -1486,3 +1486,36 @@ fn locale_decimal_point() {
assert_eq!(dt.format_localized("%T%.6f", ar_SY).to_string(), "18:58:00.123456");
assert_eq!(dt.format_localized("%T%.9f", ar_SY).to_string(), "1... | Utc nanoseconds do not always roundtrip
# Reproducer
## Code
```rust
#[test]
fn nano_roundrip() {
let nanos = i64::MIN + 2;
let dt = Utc.timestamp_nanos(nanos);
let nanos2 = dt.timestamp_nanos();
assert_eq!(nanos, nanos2);
}
```
## Expected Result
Test passes.
## Actual Result
Test p... | @crepererum Excellent issue report.
As far as I can tell in this code the first `checked_mul` pushes the value beyond `i64::MIN`, and the following addition should bring it back in range. Which of course doesn't work...
```rust
pub fn timestamp_nanos(&self) -> i64 {
self.timestamp()
.chec... | 2023-09-15T08:37:09Z | 0.4 | 2023-09-15T12:51:11Z | d8a177e4f5cc7512b8cbe8a5d27e68d6cfcfb8fd | [
"datetime::tests::nano_roundrip"
] | [
"date::tests::test_date_add_assign",
"datetime::serde::tests::test_serde_no_offset_debug",
"datetime::tests::test_core_duration_max - should panic",
"date::tests::test_years_elapsed",
"date::tests::test_date_sub_assign",
"date::tests::test_date_add_assign_local",
"datetime::serde::tests::test_serde_seri... | [] | [] | auto_2025-06-13 |
chronotope/chrono | 1,285 | chronotope__chrono-1285 | [
"1284"
] | 21f9ccc5dc74004bf40f0fd79b92dd606a9cb670 | diff --git a/src/offset/mod.rs b/src/offset/mod.rs
--- a/src/offset/mod.rs
+++ b/src/offset/mod.rs
@@ -403,12 +403,10 @@ pub trait TimeZone: Sized + Clone {
/// };
/// ```
fn timestamp_millis_opt(&self, millis: i64) -> LocalResult<DateTime<Self>> {
- let (mut secs, mut millis) = (millis / 1000, mi... | diff --git a/src/offset/mod.rs b/src/offset/mod.rs
--- a/src/offset/mod.rs
+++ b/src/offset/mod.rs
@@ -558,4 +572,18 @@ mod tests {
Utc.timestamp_nanos(i64::default());
Utc.timestamp_nanos(i64::min_value());
}
+
+ #[test]
+ fn test_negative_micros() {
+ let dt = Utc.timestamp_micros(... | Add timestamp_micros to Utc
I wanted to know if there is a reason for having the functions `timestamp_millis` and `timestamp_nanos` in the trait `TimeZone` but not `timestamp_micros`.
If there is no reason not to have it, will it be possible to implement it?
| What's your use case for it?
I wanted to add support for processing microseconds in VRL, specifically in the following function:
https://github.com/vectordotdev/vrl/blob/000109385569314c6715300bfd84cba0971646c3/src/stdlib/from_unix_timestamp.rs#L5
I figured I might not be the only person interested in transforming mi... | 2023-09-12T18:36:39Z | 1.57 | 2023-09-13T14:21:46Z | ce4644f5df6878f3c08a8dc8785433f16c9055c3 | [
"date::tests::test_date_add_assign",
"date::tests::test_date_sub_assign",
"date::tests::test_date_add_assign_local",
"date::tests::test_date_sub_assign_local",
"date::tests::test_years_elapsed",
"datetime::serde::tests::test_serde_bincode",
"datetime::serde::tests::test_serde_no_offset_debug",
"dateti... | [] | [] | [] | auto_2025-06-13 |
chronotope/chrono | 1,157 | chronotope__chrono-1157 | [
"314"
] | ea9398eb0d8fa55fe0064093af32f45443e5c0e0 | diff --git a/src/format/mod.rs b/src/format/mod.rs
--- a/src/format/mod.rs
+++ b/src/format/mod.rs
@@ -420,7 +420,7 @@ impl Error for ParseError {
}
// to be used in this module and submodules
-const OUT_OF_RANGE: ParseError = ParseError(ParseErrorKind::OutOfRange);
+pub(crate) const OUT_OF_RANGE: ParseError = Pars... | diff --git a/src/offset/fixed.rs b/src/offset/fixed.rs
--- a/src/offset/fixed.rs
+++ b/src/offset/fixed.rs
@@ -246,6 +259,7 @@ impl<Tz: TimeZone> Sub<FixedOffset> for DateTime<Tz> {
mod tests {
use super::FixedOffset;
use crate::offset::TimeZone;
+ use std::str::FromStr;
#[test]
fn test_date_e... | Add a FixedOffset parser
In [my project](https://gitlab.com/xmpp-rs/xmpp-parsers), an [XMPP](https://xmpp.org) element parser, I need to be able to parse a timezone on its own, in order to implement [XEP-0202](https://xmpp.org/extensions/xep-0202.html).
I’m currently using [a super ugly workaround](https://gitlab.co... | 2023-06-28T15:39:06Z | 0.4 | 2023-06-29T11:02:31Z | d8a177e4f5cc7512b8cbe8a5d27e68d6cfcfb8fd | [
"date::tests::test_date_add_assign",
"date::tests::test_date_sub_assign",
"date::tests::test_date_add_assign_local",
"date::tests::test_years_elapsed",
"date::tests::test_date_sub_assign_local",
"datetime::rustc_serialize::tests::test_encodable",
"datetime::rustc_serialize::tests::test_decodable_timesta... | [] | [] | [] | auto_2025-06-13 | |
chronotope/chrono | 999 | chronotope__chrono-999 | [
"998"
] | 1f1e2f8ff0e166ffd80ae95218a80b54fe26e003 | diff --git a/src/month.rs b/src/month.rs
--- a/src/month.rs
+++ b/src/month.rs
@@ -27,7 +27,7 @@ use rkyv::{Archive, Deserialize, Serialize};
/// Allows mapping from and to month, from 1-January to 12-December.
/// Can be Serialized/Deserialized with serde
// Actual implementation is zero-indexed, API intended as 1-... | diff --git a/src/month.rs b/src/month.rs
--- a/src/month.rs
+++ b/src/month.rs
@@ -352,4 +352,13 @@ mod tests {
assert_eq!(Month::January.pred(), Month::December);
assert_eq!(Month::February.pred(), Month::January);
}
+
+ #[test]
+ fn test_month_partial_ord() {
+ assert!(Month::Janua... | Implement PartialOrd for Month
It would be nice if Month implemented PartialOrd.
For instance, I have a situation where I am aggregating data on a monthly basis, year by year. For that, I have a YearMonth struct like this:
```rust
struct YearMonth {
year: i32,
month: Month,
}
```
For the actual ca... | Makes sense, would you be able to submit a PR?
> Makes sense, would you be able to submit a PR?
Yes, I can do that. | 2023-03-24T14:49:34Z | 0.4 | 2023-06-05T10:44:34Z | d8a177e4f5cc7512b8cbe8a5d27e68d6cfcfb8fd | [
"date::tests::test_date_sub_assign",
"date::tests::test_date_add_assign",
"date::tests::test_date_add_assign_local",
"date::tests::test_date_sub_assign_local",
"date::tests::test_years_elapsed",
"datetime::rustc_serialize::test_encodable",
"datetime::rustc_serialize::test_decodable_timestamps",
"datet... | [] | [] | [] | auto_2025-06-13 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.