diff --git a/cli/driver/src/callbacks_wrapper.rs b/cli/driver/src/callbacks_wrapper.rs index 6cd97895e..3fa124373 100644 --- a/cli/driver/src/callbacks_wrapper.rs +++ b/cli/driver/src/callbacks_wrapper.rs @@ -22,12 +22,12 @@ impl<'a> Callbacks for CallbacksWrapper<'a> { })); self.sub.config(config) } - fn after_parsing<'tcx>( + fn after_crate_root_parsing<'tcx>( &mut self, compiler: &interface::Compiler, queries: &'tcx Queries<'tcx>, ) -> Compilation { - self.sub.after_parsing(compiler, queries) + self.sub.after_crate_root_parsing(compiler, queries) } fn after_expansion<'tcx>( &mut self, @@ -38,10 +38,9 @@ impl<'a> Callbacks for CallbacksWrapper<'a> { } fn after_analysis<'tcx>( &mut self, - early_handler: &rustc_session::EarlyErrorHandler, compiler: &interface::Compiler, queries: &'tcx Queries<'tcx>, ) -> Compilation { - self.sub.after_analysis(early_handler, compiler, queries) + self.sub.after_analysis(compiler, queries) } } diff --git a/cli/driver/src/exporter.rs b/cli/driver/src/exporter.rs index 4e023d31a..948fbf5b5 100644 --- a/cli/driver/src/exporter.rs +++ b/cli/driver/src/exporter.rs @@ -287,7 +287,7 @@ impl From for hax_frontend_exporter_options::Options { } impl Callbacks for ExtractionCallbacks { - fn after_parsing<'tcx>( + fn after_crate_root_parsing<'tcx>( &mut self, compiler: &Compiler, queries: &'tcx Queries<'tcx>, diff --git a/cli/driver/src/linter.rs b/cli/driver/src/linter.rs index beb286f07..ba82517f8 100644 --- a/cli/driver/src/linter.rs +++ b/cli/driver/src/linter.rs @@ -16,7 +16,7 @@ impl LinterCallbacks { } impl Callbacks for LinterCallbacks { - fn after_parsing<'tcx>( + fn after_crate_root_parsing<'tcx>( &mut self, _compiler: &Compiler, queries: &'tcx Queries<'tcx>, diff --git a/frontend/exporter/src/constant_utils.rs b/frontend/exporter/src/constant_utils.rs index a02f4c86f..6c99bb3d9 100644 --- a/frontend/exporter/src/constant_utils.rs +++ b/frontend/exporter/src/constant_utils.rs @@ -1,4 +1,5 @@ use crate::prelude::*; +use rustc_middle::{mir, ty}; #[derive( Clone, Debug, Serialize, Deserialize, JsonSchema, Hash, PartialEq, Eq, PartialOrd, Ord, @@ -188,7 +189,6 @@ pub(crate) fn scalar_int_to_constant_literal<'tcx, S: UnderOwnerState<'tcx>>( x: rustc_middle::ty::ScalarInt, ty: rustc_middle::ty::Ty, ) -> ConstantLiteral { - use rustc_middle::ty; match ty.kind() { ty::Char => ConstantLiteral::Char( char::try_from(x) @@ -222,7 +222,6 @@ pub(crate) fn scalar_to_constant_expr<'tcx, S: UnderOwnerState<'tcx>>( span: rustc_span::Span, ) -> ConstantExpr { use rustc_middle::mir::Mutability; - use rustc_middle::ty; let cspan = span.sinto(s); // The documentation explicitly says not to match on a scalar. // We match on the type and use it to convert the value. @@ -388,21 +387,23 @@ pub trait ConstantExt<'tcx>: Sized + std::fmt::Debug { } } } -impl<'tcx> ConstantExt<'tcx> for rustc_middle::ty::Const<'tcx> { +impl<'tcx> ConstantExt<'tcx> for ty::Const<'tcx> { fn eval_constant>(&self, s: &S) -> Option { - let evaluated = self.eval(s.base().tcx, s.param_env()); + let evaluated = self.eval(s.base().tcx, s.param_env(), None).ok()?; + let evaluated = ty::Const::new(s.base().tcx, ty::ConstKind::Value(evaluated), self.ty()); (&evaluated != self).then_some(evaluated) } } -impl<'tcx> ConstantExt<'tcx> for rustc_middle::mir::ConstantKind<'tcx> { +impl<'tcx> ConstantExt<'tcx> for mir::ConstantKind<'tcx> { fn eval_constant>(&self, s: &S) -> Option { - let evaluated = self.eval(s.base().tcx, s.param_env()); + let evaluated = self.eval(s.base().tcx, s.param_env(), None).ok()?; + let evaluated = mir::ConstantKind::Val(evaluated, self.ty()); (&evaluated != self).then_some(evaluated) } } -impl<'tcx, S: UnderOwnerState<'tcx>> SInto for rustc_middle::ty::Const<'tcx> { +impl<'tcx, S: UnderOwnerState<'tcx>> SInto for ty::Const<'tcx> { fn sinto(&self, s: &S) -> ConstantExpr { - use rustc_middle::{query::Key, ty}; + use rustc_middle::query::Key; let span = self.default_span(s.base().tcx); let kind = match self.kind() { ty::ConstKind::Param(p) => ConstantExprKind::ConstRef { id: p.sinto(s) }, @@ -434,7 +435,6 @@ pub(crate) fn valtree_to_constant_expr<'tcx, S: UnderOwnerState<'tcx>>( ty: rustc_middle::ty::Ty<'tcx>, span: rustc_span::Span, ) -> ConstantExpr { - use rustc_middle::ty; let kind = match (valtree, ty.kind()) { (_, ty::Ref(_, inner_ty, _)) => { ConstantExprKind::Borrow(valtree_to_constant_expr(s, valtree, *inner_ty, span)) @@ -537,7 +537,7 @@ pub fn const_value_to_constant_expr<'tcx, S: UnderOwnerState<'tcx>>( use rustc_middle::mir::interpret::ConstValue; match val { ConstValue::Scalar(scalar) => scalar_to_constant_expr(s, ty, &scalar, span), - ConstValue::ByRef { .. } => const_value_reference_to_constant_expr(s, ty, val, span), + ConstValue::Indirect { .. } => const_value_reference_to_constant_expr(s, ty, val, span), ConstValue::Slice { data, start, end } => { let start = start.try_into().unwrap(); let end = end.try_into().unwrap(); diff --git a/frontend/exporter/src/state.rs b/frontend/exporter/src/state.rs index 71b4ae887..2b70d4df9 100644 --- a/frontend/exporter/src/state.rs +++ b/frontend/exporter/src/state.rs @@ -143,8 +143,8 @@ mod types { macro_infos: Rc::new(HashMap::new()), cached_thirs: Rc::new(HashMap::new()), options: Rc::new(options), - /// Always prefer `s.owner_id()` to `s.base().opt_def_id`. - /// `opt_def_id` is used in `utils` for error reporting + // Always prefer `s.owner_id()` to `s.base().opt_def_id`. + // `opt_def_id` is used in `utils` for error reporting opt_def_id: None, local_ctx: Rc::new(RefCell::new(LocalContextS::new())), exported_spans: Rc::new(RefCell::new(HashSet::new())), diff --git a/frontend/exporter/src/types/copied.rs b/frontend/exporter/src/types/copied.rs index baaf214c3..7b61f17bb 100644 --- a/frontend/exporter/src/types/copied.rs +++ b/frontend/exporter/src/types/copied.rs @@ -461,6 +461,7 @@ pub enum CanonicalVarInfo { PlaceholderRegion(PlaceholderRegion), Const(UniverseIndex, Ty), PlaceholderConst(PlaceholderConst, Ty), + Effect, } /// Reflects [`rustc_middle::ty::UserSelfTy`] diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 28fe18908..bde5ecc3c 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,3 +1,3 @@ [toolchain] -channel = "nightly-2023-09-01" +channel = "nightly-2023-09-15" components = [ "rustc-dev", "llvm-tools-preview" , "rust-analysis" , "rust-src" , "rustfmt" ]