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

Upgrade toolchain to 2024-12-15 #3784

Merged
merged 1 commit into from
Dec 16, 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
10 changes: 10 additions & 0 deletions kani-compiler/src/codegen_cprover_gotoc/codegen/place.rs
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,16 @@ impl GotocCtx<'_> {
.member("direct_fields", &self.symbol_table)
.member(field_name, &self.symbol_table))
}
TyKind::RigidTy(RigidTy::CoroutineClosure(def, args)) => {
let typ = Ty::new_coroutine_closure(def, args);
let goto_typ = self.codegen_ty_stable(typ);
Err(UnimplementedData::new(
"Coroutine closures",
"https://github.com/model-checking/kani/issues/3783",
goto_typ,
*parent_expr.location(),
))
}
TyKind::RigidTy(RigidTy::Str)
| TyKind::RigidTy(RigidTy::Array(_, _))
| TyKind::RigidTy(RigidTy::Slice(_))
Expand Down
9 changes: 9 additions & 0 deletions kani-compiler/src/codegen_cprover_gotoc/codegen/rvalue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -729,6 +729,15 @@ impl GotocCtx<'_> {
}
}
AggregateKind::Coroutine(_, _, _) => self.codegen_rvalue_coroutine(&operands, res_ty),
AggregateKind::CoroutineClosure(_, _) => {
let ty = self.codegen_ty_stable(res_ty);
self.codegen_unimplemented_expr(
"CoroutineClosure",
ty,
loc,
"https://github.com/model-checking/kani/issues/3783",
)
}
}
}

Expand Down
11 changes: 5 additions & 6 deletions kani-compiler/src/codegen_cprover_gotoc/codegen/typ.rs
Original file line number Diff line number Diff line change
Expand Up @@ -590,6 +590,9 @@ impl<'tcx> GotocCtx<'tcx> {
}
ty::Closure(_, subst) => self.codegen_ty_closure(ty, subst),
ty::Coroutine(..) => self.codegen_ty_coroutine(ty),
ty::CoroutineClosure(..) => unimplemented!(
"Kani does not yet support coroutine closures. Please post your example at https://github.com/model-checking/kani/issues/3783"
),
ty::Never => self.ensure_struct(NEVER_TYPE_EMPTY_STRUCT_NAME, "!", |_, _| vec![]),
ty::Tuple(ts) => {
if ts.is_empty() {
Expand Down Expand Up @@ -619,11 +622,7 @@ impl<'tcx> GotocCtx<'tcx> {
ty::Bound(_, _) | ty::Param(_) => unreachable!("monomorphization bug"),

// type checking remnants which shouldn't be reachable
ty::CoroutineWitness(_, _)
| ty::CoroutineClosure(_, _)
| ty::Infer(_)
| ty::Placeholder(_)
| ty::Error(_) => {
ty::CoroutineWitness(_, _) | ty::Infer(_) | ty::Placeholder(_) | ty::Error(_) => {
unreachable!("remnants of type checking")
}
}
Expand Down Expand Up @@ -879,7 +878,7 @@ impl<'tcx> GotocCtx<'tcx> {

/// Generates a struct for a variant of the coroutine.
///
/// The field `discriminant_field` should be `Some(idx)` when generating the variant for the direct (top-[evel) fields of the coroutine.
/// The field `discriminant_field` should be `Some(idx)` when generating the variant for the direct (top-level) fields of the coroutine.
/// Then the field with the index `idx` will be treated as the discriminant and will be given a special name to work with the rest of the code.
/// The field `discriminant_field` should be `None` when generating an actual variant of the coroutine because those don't contain the discriminant as a field.
fn codegen_coroutine_variant_struct(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ impl<'tcx> Analysis<'tcx> for PointsToAnalysis<'_, 'tcx> {

/// Update current dataflow state based on the information we can infer from the given
/// statement.
fn apply_statement_effect(
fn apply_primary_statement_effect(
&mut self,
state: &mut Self::Domain,
statement: &Statement<'tcx>,
Expand Down Expand Up @@ -184,7 +184,7 @@ impl<'tcx> Analysis<'tcx> for PointsToAnalysis<'_, 'tcx> {
}
}

fn apply_terminator_effect<'mir>(
fn apply_primary_terminator_effect<'mir>(
&mut self,
state: &mut Self::Domain,
terminator: &'mir Terminator<'tcx>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,7 @@ fn data_bytes_for_ty(
| RigidTy::FnPtr(_)
| RigidTy::Closure(_, _)
| RigidTy::Coroutine(_, _, _)
| RigidTy::CoroutineClosure(_, _)
| RigidTy::CoroutineWitness(_, _)
| RigidTy::Foreign(_)
| RigidTy::Dynamic(_, _, _) => Err(LayoutComputationError::UnsupportedType(ty)),
Expand Down
2 changes: 2 additions & 0 deletions kani-compiler/src/kani_middle/transform/check_values.rs
Original file line number Diff line number Diff line change
Expand Up @@ -640,6 +640,7 @@ impl MirVisitor for CheckValueVisitor<'_, '_> {
AggregateKind::Array(_)
| AggregateKind::Closure(_, _)
| AggregateKind::Coroutine(_, _, _)
| AggregateKind::CoroutineClosure(_, _)
| AggregateKind::RawPtr(_, _)
| AggregateKind::Tuple => {}
},
Expand Down Expand Up @@ -981,6 +982,7 @@ pub fn ty_validity_per_offset(
| RigidTy::FnPtr(_)
| RigidTy::Closure(_, _)
| RigidTy::Coroutine(_, _, _)
| RigidTy::CoroutineClosure(_, _)
| RigidTy::CoroutineWitness(_, _)
| RigidTy::Foreign(_)
| RigidTy::Dynamic(_, _, _) => Err(format!("Unsupported {ty:?}")),
Expand Down
6 changes: 6 additions & 0 deletions kani-compiler/src/kani_middle/transform/internal_mir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@ impl RustcInternalMir for AggregateKind {
internal(tcx, generic_args),
)
}
AggregateKind::CoroutineClosure(coroutine_def, generic_args) => {
rustc_middle::mir::AggregateKind::CoroutineClosure(
internal(tcx, coroutine_def.0),
internal(tcx, generic_args),
)
}
AggregateKind::RawPtr(ty, mutability) => rustc_middle::mir::AggregateKind::RawPtr(
internal(tcx, ty),
internal(tcx, mutability),
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
# SPDX-License-Identifier: Apache-2.0 OR MIT

[toolchain]
channel = "nightly-2024-12-14"
channel = "nightly-2024-12-15"
components = ["llvm-tools", "rustc-dev", "rust-src", "rustfmt"]
Loading