Skip to content

Conversation

@ShoyuVanilla
Copy link
Contributor

I found this while working on model-checking/verify-rust-std#382.

When you try to add #[proof_for_contract(Rc::<MaybeUninit<T>, A>::assume_init)] to a proof for this function https://doc.rust-lang.org/1.90.0/src/alloc/rc.rs.html#1211, kani fails to resolve Rc::<MaybeUninit<T>, A>::assume_init, as it compares the last two parts of the path string,

fn last_two_items_of_path_match(item_path: &str, generic_args: &str, name: &str) -> bool {
let parts: Vec<&str> = item_path.split("::").collect();
if parts.len() < 2 {
return false;
}
let actual_last_two =
format!("{}{}{}{}", "::", parts[parts.len() - 2], "::", parts[parts.len() - 1]);
let last_two = format!("{}{}{}", generic_args, "::", name);
// The last two components of the item_path should be the same as ::{generic_args}::{name}
last_two == actual_last_two
}

But rustc's TyCtxt::def_path_str emits the path rc::Rc::<core::mem::MaybeUninit<T>, A>::assmue_init even if there's use core::mem::MaybeUninit in scope. So the last two parts of it is ::MaybeUninit<T>, A>::assmue_init, instead of being ::<core::mem::MaybeUninit<T>, A>::assmue_init, and the resolution fails.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 and MIT licenses.

@ShoyuVanilla ShoyuVanilla requested a review from a team as a code owner October 25, 2025 05:28
@github-actions github-actions bot added Z-EndToEndBenchCI Tag a PR to run benchmark CI Z-CompilerBenchCI Tag a PR to run benchmark CI labels Oct 25, 2025
@ShoyuVanilla
Copy link
Contributor Author

Could this be reviewed or should I follow some extra policies I might be missing? This is needed to write contracts for Rc::<_>::assume_init 😅

@tautschnig tautschnig enabled auto-merge November 11, 2025 14:22
@tautschnig tautschnig added this pull request to the merge queue Nov 11, 2025
Merged via the queue into model-checking:main with commit 8b99b4d Nov 11, 2025
34 checks passed
@ShoyuVanilla ShoyuVanilla deleted the segmented-param-res branch November 12, 2025 00:28
github-merge-queue bot pushed a commit that referenced this pull request Jan 15, 2026
0.67.0 Kani release

Raw release notes:
```
## What's Changed
* Upgrade Rust toolchain to 2025-11-06 by @tautschnig in #4451
* Upgrade Rust toolchain to 2025-11-07 by @tautschnig in #4454
* Automatic toolchain upgrade to nightly-2025-11-08 by @github-actions[bot] in #4456
* Automatic toolchain upgrade to nightly-2025-11-09 by @github-actions[bot] in #4457
* Automatic cargo update to 2025-11-10 by @github-actions[bot] in #4459
* Gracefully fail when compiling structs with too large array by @tautschnig in #4461
* Upgrade Rust toolchain to 2025-11-10 by @tautschnig in #4460
* Bump tests/perf/s2n-quic from `e726f08` to `cf77e2b` by @dependabot[bot] in #4462
* Automatic toolchain upgrade to nightly-2025-11-11 by @github-actions[bot] in #4463
* fix: Make kani attribute nameres work with generic args having `::` by @ShoyuVanilla in #4427
* NixOS: patch binaries if the dynamic linker is a stub by @GrigorenkoPV in #4413
* Update charon submodule by 15 commits by @tautschnig in #4464
* Arrays with more than 64 elements no longer cause spurious failures by @tautschnig in #4470
* Upgrade Rust toolchain to 2025-11-12 by @tautschnig in #4469
* Upgrade Rust toolchain to 2025-11-13 by @tautschnig in #4473
* Automatic cargo update to 2025-11-17 by @github-actions[bot] in #4476
* Upgrade Rust toolchain to 2025-11-16 by @tautschnig in #4477
* Automatic toolchain upgrade to nightly-2025-11-18 by @github-actions[bot] in #4478
* Upgrade Rust toolchain to 2025-11-19 by @tautschnig in #4482
* Automatic toolchain upgrade to nightly-2025-11-20 by @github-actions[bot] in #4483
* Automatic cargo update to 2025-11-24 by @github-actions[bot] in #4487
* Bump tests/perf/s2n-quic from `cf77e2b` to `25d7f4e` by @dependabot[bot] in #4489
* Bump actions/checkout from 5 to 6 by @dependabot[bot] in #4488
* Automatic cargo update to 2025-12-01 by @github-actions[bot] in #4491
* Bump tests/perf/s2n-quic from `25d7f4e` to `77f104c` by @dependabot[bot] in #4492
* Automatic cargo update to 2025-12-08 by @github-actions[bot] in #4493
* Bump tests/perf/s2n-quic from `77f104c` to `1ac1364` by @dependabot[bot] in #4494
* docs: Correct `default-unwind` Cargo.toml examples by @hashcatHitman in #4496
* Automatic cargo update to 2025-12-15 by @github-actions[bot] in #4497
* Bump peter-evans/create-pull-request from 7 to 8 by @dependabot[bot] in #4498
* Bump actions/download-artifact from 6 to 7 by @dependabot[bot] in #4499
* Bump tests/perf/s2n-quic from `1ac1364` to `8445d10` by @dependabot[bot] in #4500
* Bump mdbook version by @zhassan-aws in #4503
* Bump tests/perf/s2n-quic from `8445d10` to `112439c` by @dependabot[bot] in #4502
* Automatic cargo update to 2025-12-22 by @github-actions[bot] in #4501
* Bump tests/perf/s2n-quic from `112439c` to `dce0a3c` by @dependabot[bot] in #4506
* Automatic cargo update to 2025-12-29 by @github-actions[bot] in #4505
* Automatic cargo update to 2026-01-05 by @github-actions[bot] in #4508
* Add a section with recommended setup for Rust Analyzer by @zhassan-aws in #4504
* Automatic cargo update to 2026-01-12 by @github-actions[bot] in #4509
* Bump tests/perf/s2n-quic from `dce0a3c` to `058783f` by @dependabot[bot] in #4510
* Upgrade Rust toolchain to 2025-11-21 by @tautschnig in #4486

## New Contributors
* @hashcatHitman made their first contribution in #4496

**Full Changelog**: kani-0.66.0...kani-0.67.0
```

By submitting this pull request, I confirm that my contribution is made
under the terms of the Apache 2.0 and MIT licenses.

---------

Co-authored-by: Michael Tautschnig <mt@debian.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Z-CompilerBenchCI Tag a PR to run benchmark CI Z-EndToEndBenchCI Tag a PR to run benchmark CI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants