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.79.0 #1173

Merged
merged 10 commits into from
Oct 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[toolchain]
channel = "1.76.0"
# channel = "nightly-2023-09-29" # (not officially supported)
channel = "1.79.0"
# channel = "nightly-2023-09-29" # TODO update to match 1.79.0 (not officially supported)
components = [ "rustc", "rust-std", "cargo", "rustfmt", "rustc-dev", "llvm-tools" ]
48 changes: 30 additions & 18 deletions source/builtin/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,9 +167,7 @@ pub fn no_unwind_when(_b: bool) {
#[cfg(verus_keep_ghost)]
#[rustc_diagnostic_item = "verus::builtin::reveal_hide"]
#[verifier::proof]
pub fn reveal_hide_(_f: fn(), _n: u32) {
unimplemented!();
}
pub const fn reveal_hide_(_f: fn(), _n: u32) {}

#[cfg(verus_keep_ghost)]
#[rustc_diagnostic_item = "verus::builtin::reveal_hide_internal_path"]
Expand Down Expand Up @@ -377,14 +375,15 @@ impl<A> Ghost<A> {
#[rustc_diagnostic_item = "verus::builtin::Ghost::view"]
#[verifier::spec]
pub fn view(self) -> A {
unimplemented!()
unsafe { core::mem::MaybeUninit::uninit().assume_init() }
}

#[cfg(verus_keep_ghost)]
#[rustc_diagnostic_item = "verus::builtin::Ghost::new"]
#[verifier::spec]
#[verifier::external_body]
pub fn new(_a: A) -> Ghost<A> {
pub const fn new(_a: A) -> Ghost<A> {
core::mem::forget(_a);
Ghost { phantom: PhantomData }
}

Expand All @@ -411,7 +410,10 @@ impl<A> Ghost<A> {
#[verifier::spec]
#[verifier::external_body]
pub fn borrow(&self) -> &A {
unimplemented!()
#[allow(deref_nullptr)]
unsafe {
&*(0 as *const A)
}
}

// note that because we return #[verifier::spec], not #[verifier::exec], we do not implement the BorrowMut trait
Expand All @@ -420,7 +422,10 @@ impl<A> Ghost<A> {
#[verifier::proof]
#[verifier::external]
pub fn borrow_mut(#[verifier::proof] &mut self) -> &mut A {
unimplemented!()
#[allow(deref_nullptr)]
unsafe {
&mut *(0 as *mut A)
}
}
}

Expand All @@ -429,14 +434,15 @@ impl<A> Tracked<A> {
#[rustc_diagnostic_item = "verus::builtin::Tracked::view"]
#[verifier::spec]
pub fn view(self) -> A {
unimplemented!()
unsafe { core::mem::MaybeUninit::uninit().assume_init() }
}

#[cfg(verus_keep_ghost)]
#[rustc_diagnostic_item = "verus::builtin::Tracked::new"]
#[verifier::proof]
#[verifier::external_body]
pub fn new(#[verifier::proof] _a: A) -> Tracked<A> {
pub const fn new(#[verifier::proof] _a: A) -> Tracked<A> {
core::mem::forget(_a);
Tracked { phantom: PhantomData }
}

Expand All @@ -459,8 +465,8 @@ impl<A> Tracked<A> {
#[verifier::proof]
#[verifier::external_body]
#[verifier::returns(proof)]
pub fn get(#[verifier::proof] self) -> A {
unimplemented!()
pub const fn get(#[verifier::proof] self) -> A {
unsafe { core::mem::MaybeUninit::uninit().assume_init() }
}

// note that because we return #[verifier::proof], not #[verifier::exec], we do not implement the Borrow trait
Expand All @@ -470,7 +476,10 @@ impl<A> Tracked<A> {
#[verifier::external_body]
#[verifier::returns(proof)]
pub fn borrow(#[verifier::proof] &self) -> &A {
unimplemented!()
#[allow(deref_nullptr)]
unsafe {
&*(0 as *const A)
}
}

// note that because we return #[verifier::proof], not #[verifier::exec], we do not implement the BorrowMut trait
Expand All @@ -480,7 +489,10 @@ impl<A> Tracked<A> {
#[verifier::external_body]
#[verifier::returns(proof)]
pub fn borrow_mut(#[verifier::proof] &mut self) -> &mut A {
unimplemented!()
#[allow(deref_nullptr)]
unsafe {
&mut *(0 as *mut A)
}
}
}

Expand All @@ -507,14 +519,16 @@ impl<A: Copy> Copy for Tracked<A> {}
#[cfg(verus_keep_ghost)]
#[rustc_diagnostic_item = "verus::builtin::ghost_exec"]
#[verifier::external_body]
pub fn ghost_exec<A>(#[verifier::spec] _a: A) -> Ghost<A> {
pub const fn ghost_exec<A>(#[verifier::spec] _a: A) -> Ghost<A> {
core::mem::forget(_a);
Ghost::assume_new()
}

#[cfg(verus_keep_ghost)]
#[rustc_diagnostic_item = "verus::builtin::tracked_exec"]
#[verifier::external_body]
pub fn tracked_exec<A>(#[verifier::proof] _a: A) -> Tracked<A> {
pub const fn tracked_exec<A>(#[verifier::proof] _a: A) -> Tracked<A> {
core::mem::forget(_a);
Tracked::assume_new()
}

Expand Down Expand Up @@ -1466,9 +1480,7 @@ pub fn infer_spec_for_loop_iter<A>(_: A, _print_hint: bool) -> Option<A> {
#[cfg(verus_keep_ghost)]
#[rustc_diagnostic_item = "verus::builtin::global_size_of"]
#[verifier::spec]
pub const fn global_size_of<T>(_bytes: usize) {
unimplemented!()
}
pub const fn global_size_of<T>(_bytes: usize) {}

#[cfg(verus_keep_ghost)]
#[rustc_diagnostic_item = "verus::builtin::inline_air_stmt"]
Expand Down
1 change: 1 addition & 0 deletions source/builtin_macros/src/attr_block_trait.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use syn::{
};

pub trait AnyAttrBlock {
#[allow(dead_code)]
fn attrs_mut(&mut self) -> &mut Vec<Attribute>;
fn block_mut(&mut self) -> Option<&mut Block>;
}
Expand Down
Loading