# Footguns on stdlib renamings (\`containsAtLeastScalar\`)

**URL:** <https://ziggit.dev/t/footguns-on-stdlib-renamings-containsatleastscalar/17855>\
**Category:** Brainstorming\
**Tags:** standard-library\
**Created:** [October 5, 2026, 5:42pm UTC](https://ziggit.dev/t/footguns-on-stdlib-renamings-containsatleastscalar/17855 "2026-10-05T17:42:50Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![IntegratedQuantum](https://ziggit.dev/user_avatar/ziggit.dev/integratedquantum/32/782_2.png) [@IntegratedQuantum](https://ziggit.dev/u/IntegratedQuantum)\
**Post date:** [October 5, 2026, 5:42pm UTC](https://ziggit.dev/t/footguns-on-stdlib-renamings-containsatleastscalar/17855/1 "2026-10-05T17:42:50Z")

</div>

I just found a small footgun while working on updating my codebase to 0.17.0, and I thought I should make a post about it to save others from any trouble.  
Luckily, while doing the migration I decided to use search across all files to change it everywhere quickly, which allowed me to find it before it caused any issues.

Consider the following code:

```zig
const std = @import("std");

pub fn main() void {
	const data: []const u8 = ":";
	std.log.info("{}", .{std.mem.containsAtLeastScalar(u8, data, 1, ':')});
}

```

In compiles in both 0.16.0 and 0.17.0, yet in 0.16.0 it prints true, and in 0.17.0 it prints false.  
This is because the signature was changed, the last two parameters were swapped, and since both values here are numbers that fit into a u8, the compiler just silently accepts it.

I wonder if it’s worth adding an additional step to such renamings where the change wouldn’t cause compilation errors in all cases.

---

<div class="post-metadata">

**Author:** ![rpkak](https://ziggit.dev/letter_avatar_proxy/v4/letter/r/a4c791/32.png) [@rpkak](https://ziggit.dev/u/rpkak)\
**Post date:** [October 5, 2026, 5:50pm UTC](https://ziggit.dev/t/footguns-on-stdlib-renamings-containsatleastscalar/17855/2 "2026-10-05T17:50:35Z")

</div>

In 0.16.0 `containsAtLeastScalar` was already deprecated in favor of `containsAtLeastScalar2`. In the 0.17.0 release, the deprecated `containsAtLeastScalar` was removed and `containsAtLeastScalar2` was renamed to `containsAtLeastScalar` ([33d2e571c7](https://codeberg.org/ziglang/zig/commit/33d2e571c763ca1f0d2d97803ece92b49a54aac5) in [#35253](https://codeberg.org/ziglang/zig/pulls/35253)).

---

<div class="post-metadata">

**Author:** ![IntegratedQuantum](https://ziggit.dev/user_avatar/ziggit.dev/integratedquantum/32/782_2.png) [@IntegratedQuantum](https://ziggit.dev/u/IntegratedQuantum)\
**Post date:** [October 5, 2026, 5:54pm UTC](https://ziggit.dev/t/footguns-on-stdlib-renamings-containsatleastscalar/17855/3 "2026-10-05T17:54:41Z")

</div>

I didn’t even know it was deprecated (and I also just double-checked: it wasn’t even mentioned in the 0.16.0 release notes).  
It could have helped to have an additional step in-between where `containsAtLeastScalar` was removed but `containsAtLeastScalar2` was still named the same. (or a toggleable error for deprecated things)

---

<div class="post-metadata">

**Author:** ![rpkak](https://ziggit.dev/letter_avatar_proxy/v4/letter/r/a4c791/32.png) [@rpkak](https://ziggit.dev/u/rpkak)\
**Post date:** [October 5, 2026, 6:01pm UTC](https://ziggit.dev/t/footguns-on-stdlib-renamings-containsatleastscalar/17855/4 "2026-10-05T18:01:22Z")

</div>

> [@IntegratedQuantum](#):
>
> or a toggleable error for deprecated things

I agree. It would be nice if something like [#22822](https://github.com/ziglang/zig/issues/22822)/[36703](https://codeberg.org/ziglang/zig/issues/36703) would be implemented in a way, such that for changes like this you can choose between deprecated behavior, new behavior and a compiler error to see that something changed.

---

<div class="post-metadata">

**Author:** ![rpkak](https://ziggit.dev/letter_avatar_proxy/v4/letter/r/a4c791/32.png) [@rpkak](https://ziggit.dev/u/rpkak)\
**Post date:** [October 5, 2026, 6:07pm UTC](https://ziggit.dev/t/footguns-on-stdlib-renamings-containsatleastscalar/17855/5 "2026-10-05T18:07:11Z")

</div>

Someone already made an issue about this: [#35563](https://codeberg.org/ziglang/zig/issues/35563)

---

<div class="post-metadata">

**Author:** ![squeek502](https://ziggit.dev/user_avatar/ziggit.dev/squeek502/32/409_2.png) [@squeek502](https://ziggit.dev/u/squeek502)\
**Post date:** [October 5, 2026, 10:50pm UTC](https://ziggit.dev/t/footguns-on-stdlib-renamings-containsatleastscalar/17855/6 "2026-10-05T22:50:38Z")

</div>

Added a warning to the release notes: [https://codeberg.org/ziglang/ziglang.org/commit/fb214309b3dbb3a491c07b31bd19f88ae3879f15](https://codeberg.org/ziglang/ziglang.org/commit/fb214309b3dbb3a491c07b31bd19f88ae3879f15)

> **[Potential containsAtLeastScalar Footgun - 0.17.0 Release Notes ⚡ The Zig...](https://ziglang.org/download/0.17.0/release-notes.html#Potential-codecontainsAtLeastScalarcode-Footgun)**
>
> Download & Documentation
