Skip to content

Commit

Permalink
Bump rustc version
Browse files Browse the repository at this point in the history
  • Loading branch information
Nadrieril committed May 28, 2024
1 parent 01137ce commit 33f143c
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 19 deletions.
7 changes: 3 additions & 4 deletions cli/driver/src/callbacks_wrapper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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)
}
}
2 changes: 1 addition & 1 deletion cli/driver/src/exporter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ impl From<ExtractionCallbacks> 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>,
Expand Down
2 changes: 1 addition & 1 deletion cli/driver/src/linter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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>,
Expand Down
20 changes: 10 additions & 10 deletions frontend/exporter/src/constant_utils.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use crate::prelude::*;
use rustc_middle::{mir, ty};

#[derive(
Clone, Debug, Serialize, Deserialize, JsonSchema, Hash, PartialEq, Eq, PartialOrd, Ord,
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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<S: UnderOwnerState<'tcx>>(&self, s: &S) -> Option<Self> {
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<S: UnderOwnerState<'tcx>>(&self, s: &S) -> Option<Self> {
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<S, ConstantExpr> for rustc_middle::ty::Const<'tcx> {
impl<'tcx, S: UnderOwnerState<'tcx>> SInto<S, ConstantExpr> 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) },
Expand Down Expand Up @@ -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))
Expand Down Expand Up @@ -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();
Expand Down
4 changes: 2 additions & 2 deletions frontend/exporter/src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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())),
Expand Down
1 change: 1 addition & 0 deletions frontend/exporter/src/types/copied.rs
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,7 @@ pub enum CanonicalVarInfo {
PlaceholderRegion(PlaceholderRegion),
Const(UniverseIndex, Ty),
PlaceholderConst(PlaceholderConst, Ty),
Effect,
}

/// Reflects [`rustc_middle::ty::UserSelfTy`]
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -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" ]

0 comments on commit 33f143c

Please sign in to comment.