Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rustc 1.84.0 #1385

Draft
wants to merge 10 commits into
base: main
Choose a base branch
from
Draft

Rustc 1.84.0 #1385

wants to merge 10 commits into from

Conversation

utaal
Copy link
Collaborator

@utaal utaal commented Jan 11, 2025

I think we now want to directly target 1.84, and skip 1.82 (#1330).

This is based on @ziqiaozhou's PR #1325 rebased after rustc-1.72.0 was merged, and on #1330.

  • fix interface changes
  • find proper solution to proof in consts with new const eval
  • add vargo fmt commit to list of ignored revs

By submitting this pull request, I confirm that my contribution is made under the terms of the MIT license.

tmp fix: conflict conflicting implementations of trait IntoIteratr in Box

wip: fix typo

wip: repalce preds_on
This is to fix
error: conflicting implementations of trait `T57_IntoIterator` for type `&mut std::boxed::Box<[_], _>`
/.rustup/toolchains/1.82.0-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/iter/traits/collect.rs:351:1
     |
/.rustup/toolchains/1.82.0-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/boxed.rs:2329:1

error: conflicting implementations of trait `T55_Iterator` for type `std::boxed::Box<[_], _>`

note: This error was found in Verus pass: ownership checking of tracked code
* Add new unit tests. test_const_eval1 and test_const_eval2 are the reason why the replace const-eval is wrong .
* Change expected errors for consts.
@utaal
Copy link
Collaborator Author

utaal commented Jan 11, 2025

We're going to need a solution to this:

#1330 (comment)

I rebased on top of main, where I added the test for

        #[verifier::opaque]
        spec fn f() -> int { 1 }
        proof fn e() -> (u: u64)
            ensures
                u == f(),
                u == 1
        {
            reveal(f);
            1
        }
        exec const E: u64 ensures E == f() {
            proof {
                let x = e();
                assert(x == f());
                assert(x == 1);
            }
            assert(1 == f());
            1
        }

which is something that projects use but was untested. We need a solution for that before merging (I'm open to alternative ideas to the const-eval hack).

@utaal
Copy link
Collaborator Author

utaal commented Jan 11, 2025

#1330 (comment)

We could restrict proof in consts and const fn to appear in a single block at the top of the function, and move it into a closure, like I did for the rest of the header. A bit limiting, but maybe good enough. /cc @Chris-Hawblitzel @tjhance

@utaal utaal mentioned this pull request Jan 11, 2025
@tjhance
Copy link
Collaborator

tjhance commented Jan 11, 2025

What about this? This code:

        exec const E: u64 ensures E == f() {
            proof {
                let x = e();
                assert(x == f());
                assert(x == 1);
            }
            assert(1 == f());
            1
        }

Could be translated by the syntax macro into:

const E: u64 = 1;

fn verus_proof_for_E() -> u64 {
    /* body with proof goes here */
}

(Though honestly, I'm tempted to try to solve this on the design level ... there's something really ugly about const items with proof blocks, even though I understand some people have found uses for them.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants