Skip to content

Commit 3444df7

Browse files
authored
Merge pull request #690 from Nadrieril/update-rustc
Bump rustc version
2 parents fda7c5e + 3d82650 commit 3444df7

File tree

15 files changed

+78
-68
lines changed

15 files changed

+78
-68
lines changed

cli/driver/src/callbacks_wrapper.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@ impl<'a> Callbacks for CallbacksWrapper<'a> {
2222
}));
2323
self.sub.config(config)
2424
}
25-
fn after_parsing<'tcx>(
25+
fn after_crate_root_parsing<'tcx>(
2626
&mut self,
2727
compiler: &interface::Compiler,
2828
queries: &'tcx Queries<'tcx>,
2929
) -> Compilation {
30-
self.sub.after_parsing(compiler, queries)
30+
self.sub.after_crate_root_parsing(compiler, queries)
3131
}
3232
fn after_expansion<'tcx>(
3333
&mut self,
@@ -38,10 +38,9 @@ impl<'a> Callbacks for CallbacksWrapper<'a> {
3838
}
3939
fn after_analysis<'tcx>(
4040
&mut self,
41-
early_handler: &rustc_session::EarlyErrorHandler,
4241
compiler: &interface::Compiler,
4342
queries: &'tcx Queries<'tcx>,
4443
) -> Compilation {
45-
self.sub.after_analysis(early_handler, compiler, queries)
44+
self.sub.after_analysis(compiler, queries)
4645
}
4746
}

cli/driver/src/exporter.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ impl From<ExtractionCallbacks> for hax_frontend_exporter_options::Options {
287287
}
288288

289289
impl Callbacks for ExtractionCallbacks {
290-
fn after_parsing<'tcx>(
290+
fn after_crate_root_parsing<'tcx>(
291291
&mut self,
292292
compiler: &Compiler,
293293
queries: &'tcx Queries<'tcx>,

cli/driver/src/linter.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ impl LinterCallbacks {
1616
}
1717

1818
impl Callbacks for LinterCallbacks {
19-
fn after_parsing<'tcx>(
19+
fn after_crate_root_parsing<'tcx>(
2020
&mut self,
2121
_compiler: &Compiler,
2222
queries: &'tcx Queries<'tcx>,

engine/lib/import_thir.ml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1064,7 +1064,7 @@ end) : EXPR = struct
10641064

10651065
let c_clause_kind span id (kind : Thir.clause_kind) : impl_ident option =
10661066
match kind with
1067-
| Trait { is_positive = true; is_const = _; trait_ref } ->
1067+
| Trait { is_positive = true; trait_ref } ->
10681068
let args = List.map ~f:(c_generic_value span) trait_ref.generic_args in
10691069
let trait = Concrete_ident.of_def_id Trait trait_ref.def_id in
10701070
Some { goal = { trait; args }; name = id }
@@ -1301,13 +1301,13 @@ and c_item_unwrapped ~ident ~drop_body (item : Thir.item) : item list =
13011301
let c_body = if drop_body then c_expr_drop_body else c_expr in
13021302
(* TODO: things might be unnamed (e.g. constants) *)
13031303
match (item.kind : Thir.item_kind) with
1304-
| Const (_, body) ->
1304+
| Const (_, generics, body) ->
13051305
mk
13061306
@@ Fn
13071307
{
13081308
name =
13091309
Concrete_ident.of_def_id Value (Option.value_exn item.def_id);
1310-
generics = { params = []; constraints = [] };
1310+
generics = c_generics generics;
13111311
body = c_body body;
13121312
params = [];
13131313
}

flake.lock

Lines changed: 24 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,11 @@
88
flake-utils.follows = "flake-utils";
99
};
1010
};
11-
rust-overlay.follows = "crane/rust-overlay";
11+
rust-overlay = {
12+
url = "github:oxalica/rust-overlay";
13+
inputs.flake-utils.follows = "flake-utils";
14+
inputs.nixpkgs.follows = "nixpkgs";
15+
};
1216
fstar = {
1317
url = "github:FStarLang/FStar/v2024.01.13";
1418
inputs = {

frontend/exporter/src/constant_utils.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use crate::prelude::*;
2+
use rustc_middle::{mir, ty};
23

34
#[derive(
45
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>>(
188189
x: rustc_middle::ty::ScalarInt,
189190
ty: rustc_middle::ty::Ty,
190191
) -> ConstantLiteral {
191-
use rustc_middle::ty;
192192
match ty.kind() {
193193
ty::Char => ConstantLiteral::Char(
194194
char::try_from(x)
@@ -222,7 +222,6 @@ pub(crate) fn scalar_to_constant_expr<'tcx, S: UnderOwnerState<'tcx>>(
222222
span: rustc_span::Span,
223223
) -> ConstantExpr {
224224
use rustc_middle::mir::Mutability;
225-
use rustc_middle::ty;
226225
let cspan = span.sinto(s);
227226
// The documentation explicitly says not to match on a scalar.
228227
// We match on the type and use it to convert the value.
@@ -388,21 +387,23 @@ pub trait ConstantExt<'tcx>: Sized + std::fmt::Debug {
388387
}
389388
}
390389
}
391-
impl<'tcx> ConstantExt<'tcx> for rustc_middle::ty::Const<'tcx> {
390+
impl<'tcx> ConstantExt<'tcx> for ty::Const<'tcx> {
392391
fn eval_constant<S: UnderOwnerState<'tcx>>(&self, s: &S) -> Option<Self> {
393-
let evaluated = self.eval(s.base().tcx, s.param_env());
392+
let evaluated = self.eval(s.base().tcx, s.param_env(), None).ok()?;
393+
let evaluated = ty::Const::new(s.base().tcx, ty::ConstKind::Value(evaluated), self.ty());
394394
(&evaluated != self).then_some(evaluated)
395395
}
396396
}
397-
impl<'tcx> ConstantExt<'tcx> for rustc_middle::mir::ConstantKind<'tcx> {
397+
impl<'tcx> ConstantExt<'tcx> for mir::ConstantKind<'tcx> {
398398
fn eval_constant<S: UnderOwnerState<'tcx>>(&self, s: &S) -> Option<Self> {
399-
let evaluated = self.eval(s.base().tcx, s.param_env());
399+
let evaluated = self.eval(s.base().tcx, s.param_env(), None).ok()?;
400+
let evaluated = mir::ConstantKind::Val(evaluated, self.ty());
400401
(&evaluated != self).then_some(evaluated)
401402
}
402403
}
403-
impl<'tcx, S: UnderOwnerState<'tcx>> SInto<S, ConstantExpr> for rustc_middle::ty::Const<'tcx> {
404+
impl<'tcx, S: UnderOwnerState<'tcx>> SInto<S, ConstantExpr> for ty::Const<'tcx> {
404405
fn sinto(&self, s: &S) -> ConstantExpr {
405-
use rustc_middle::{query::Key, ty};
406+
use rustc_middle::query::Key;
406407
let span = self.default_span(s.base().tcx);
407408
let kind = match self.kind() {
408409
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>>(
434435
ty: rustc_middle::ty::Ty<'tcx>,
435436
span: rustc_span::Span,
436437
) -> ConstantExpr {
437-
use rustc_middle::ty;
438438
let kind = match (valtree, ty.kind()) {
439439
(_, ty::Ref(_, inner_ty, _)) => {
440440
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>>(
537537
use rustc_middle::mir::interpret::ConstValue;
538538
match val {
539539
ConstValue::Scalar(scalar) => scalar_to_constant_expr(s, ty, &scalar, span),
540-
ConstValue::ByRef { .. } => const_value_reference_to_constant_expr(s, ty, val, span),
540+
ConstValue::Indirect { .. } => const_value_reference_to_constant_expr(s, ty, val, span),
541541
ConstValue::Slice { data, start, end } => {
542542
let start = start.try_into().unwrap();
543543
let end = end.try_into().unwrap();

frontend/exporter/src/state.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,8 @@ mod types {
143143
macro_infos: Rc::new(HashMap::new()),
144144
cached_thirs: Rc::new(HashMap::new()),
145145
options: Rc::new(options),
146-
/// Always prefer `s.owner_id()` to `s.base().opt_def_id`.
147-
/// `opt_def_id` is used in `utils` for error reporting
146+
// Always prefer `s.owner_id()` to `s.base().opt_def_id`.
147+
// `opt_def_id` is used in `utils` for error reporting
148148
opt_def_id: None,
149149
local_ctx: Rc::new(RefCell::new(LocalContextS::new())),
150150
exported_spans: Rc::new(RefCell::new(HashSet::new())),

frontend/exporter/src/traits.rs

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,8 @@ pub(crate) mod search_clause {
130130
let erase_and_norm =
131131
|x| tcx.erase_regions(tcx.try_normalize_erasing_regions(param_env, x).unwrap_or(x));
132132
// Lifetime and constantness are irrelevant when resolving instances
133-
let x = erase_and_norm(x).without_const(tcx);
134-
let y = erase_and_norm(y).without_const(tcx);
133+
let x = erase_and_norm(x);
134+
let y = erase_and_norm(y);
135135
let sx = format!("{:?}", x.kind().skip_binder());
136136
let sy = format!("{:?}", y.kind().skip_binder());
137137
let result = sx == sy;
@@ -324,7 +324,7 @@ impl<'tcx> IntoImplExpr<'tcx> for rustc_middle::ty::PolyTraitRef<'tcx> {
324324
generics: generics.sinto(s),
325325
}
326326
.with_args(impl_exprs(s, &nested), trait_ref),
327-
ImplSource::Param(nested, _constness) => {
327+
ImplSource::Param(nested) => {
328328
use search_clause::TraitPredicateExt;
329329
let tcx = s.base().tcx;
330330
let predicates = &tcx.predicates_defined_on_or_above(s.owner_id());
@@ -362,22 +362,19 @@ impl<'tcx> IntoImplExpr<'tcx> for rustc_middle::ty::PolyTraitRef<'tcx> {
362362
.with_args(impl_exprs(s, &nested), trait_ref)
363363
}
364364
}
365-
ImplSource::Object(data) => {
366-
ImplExprAtom::Dyn.with_args(impl_exprs(s, &data.nested), trait_ref)
367-
}
368365
// We ignore the contained obligations here. For example for `(): Send`, the
369366
// obligations contained would be `[(): Send]`, which leads to an infinite loop. There
370367
// might be important obligation shere inother cases; we'll have to see if that comes
371368
// up.
372-
ImplSource::Builtin(_ignored) => ImplExprAtom::Builtin {
373-
r#trait: self.skip_binder().sinto(s),
369+
ImplSource::Builtin(source, _ignored) => {
370+
let atom = match source {
371+
BuiltinImplSource::Object { .. } => ImplExprAtom::Dyn,
372+
_ => ImplExprAtom::Builtin {
373+
r#trait: self.skip_binder().sinto(s),
374+
},
375+
};
376+
atom.with_args(vec![], trait_ref)
374377
}
375-
.with_args(vec![], trait_ref),
376-
x => ImplExprAtom::Todo(format!(
377-
"ImplExprAtom::Todo(see https://github.com/hacspec/hax/issues/381) {:#?}\n\n{:#?}",
378-
x, self
379-
))
380-
.with_args(vec![], trait_ref),
381378
}
382379
}
383380
}

frontend/exporter/src/types/copied.rs

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -461,6 +461,7 @@ pub enum CanonicalVarInfo {
461461
PlaceholderRegion(PlaceholderRegion),
462462
Const(UniverseIndex, Ty),
463463
PlaceholderConst(PlaceholderConst, Ty),
464+
Effect,
464465
}
465466

466467
/// Reflects [`rustc_middle::ty::UserSelfTy`]
@@ -1031,18 +1032,6 @@ pub struct Stmt {
10311032
pub opt_destruction_scope: Option<Scope>,
10321033
}
10331034

1034-
/// Reflects [`rustc_ast::ast::MacDelimiter`]
1035-
#[derive(AdtInto)]
1036-
#[args(<S>, from: rustc_ast::ast::MacDelimiter, state: S as _s)]
1037-
#[derive(
1038-
Clone, Debug, Serialize, Deserialize, JsonSchema, Hash, PartialEq, Eq, PartialOrd, Ord,
1039-
)]
1040-
pub enum MacDelimiter {
1041-
Parenthesis,
1042-
Bracket,
1043-
Brace,
1044-
}
1045-
10461035
/// Reflects [`rustc_ast::token::Delimiter`]
10471036
#[derive(AdtInto)]
10481037
#[args(<S>, from: rustc_ast::token::Delimiter, state: S as _s)]
@@ -1164,7 +1153,7 @@ pub struct Token {
11641153
)]
11651154
pub struct DelimArgs {
11661155
pub dspan: DelimSpan,
1167-
pub delim: MacDelimiter,
1156+
pub delim: Delimiter,
11681157
pub tokens: TokenStream,
11691158
}
11701159

@@ -1602,7 +1591,8 @@ impl Alias {
16021591
// emit a warning with a lot of debugging information.
16031592
let poly_trait_ref = if trait_ref.has_escaping_bound_vars() {
16041593
let trait_ref_and_generics = alias_ty.trait_ref_and_own_args(tcx);
1605-
let rebased_generics = alias_ty.rebase_args_onto_impl(alias_ty.args, tcx);
1594+
let rebased_generics =
1595+
alias_ty.rebase_inherent_args_onto_impl(alias_ty.args, tcx);
16061596
let norm_rebased_generics = tcx.try_subst_and_normalize_erasing_regions(
16071597
rebased_generics,
16081598
s.param_env(),
@@ -2845,7 +2835,6 @@ pub struct Impl<Body: IsBody> {
28452835
pub polarity: ImplPolarity,
28462836
pub defaultness: Defaultness,
28472837
pub defaultness_span: Option<Span>,
2848-
pub constness: Constness,
28492838
pub generics: Generics<Body>,
28502839
#[map({
28512840
s.base().tcx.impl_trait_ref(s.owner_id()).sinto(s)
@@ -3031,7 +3020,7 @@ pub enum ItemKind<Body: IsBody> {
30313020
ExternCrate(Option<Symbol>),
30323021
Use(UsePath, UseKind),
30333022
Static(Ty, Mutability, Body),
3034-
Const(Ty, Body),
3023+
Const(Ty, Generics<Body>, Body),
30353024
#[custom_arm(
30363025
rustc_hir::ItemKind::Fn(sig, generics, body) => {
30373026
ItemKind::Fn(generics.sinto(s), make_fn_def::<Body, _>(sig, body, s))
@@ -3229,9 +3218,6 @@ pub struct TraitRef {
32293218
)]
32303219
pub struct TraitPredicate {
32313220
pub trait_ref: TraitRef,
3232-
#[from(constness)]
3233-
#[map(x.clone() == rustc_middle::ty::BoundConstness::ConstIfConst)]
3234-
pub is_const: bool,
32353221
#[map(x.clone() == rustc_middle::ty::ImplPolarity::Positive)]
32363222
#[from(polarity)]
32373223
pub is_positive: bool,

frontend/exporter/src/types/mir.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -529,8 +529,6 @@ pub enum TerminatorKind {
529529
discr: Operand,
530530
targets: SwitchTargets,
531531
},
532-
Resume,
533-
Terminate,
534532
Return,
535533
Unreachable,
536534
Drop {
@@ -581,6 +579,8 @@ pub enum TerminatorKind {
581579
real_target: BasicBlock,
582580
unwind: UnwindAction,
583581
},
582+
UnwindResume,
583+
UnwindTerminate(UnwindTerminateReason),
584584
InlineAsm {
585585
template: Vec<InlineAsmTemplatePiece>,
586586
operands: Vec<InlineAsmOperand>,
@@ -734,7 +734,7 @@ impl<'tcx, S: UnderOwnerState<'tcx> + HasMir<'tcx>> SInto<S, Place>
734734
// of the the state captured by a closure.
735735
use crate::rustc_index::Idx;
736736
let generics = generics.as_closure();
737-
let upvar_tys: Vec<_> = generics.upvar_tys().collect();
737+
let upvar_tys = generics.upvar_tys();
738738
current_ty = upvar_tys[index.sinto(s).index()].clone();
739739
ProjectionElem::Field(ProjectionElemFieldKind::ClosureState(
740740
index.sinto(s),

frontend/exporter/src/types/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// There's a conflict between `mir::ScalarInt`and `todo::ScalarInt` but it doesn't matter.
2+
#![allow(ambiguous_glob_reexports)]
3+
14
mod copied;
25
mod index;
36
mod mir;

frontend/exporter/src/types/todo.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ sinto_todo!(rustc_abi, IntegerType);
77
sinto_todo!(rustc_abi, ReprFlags);
88
sinto_todo!(rustc_abi, Align);
99
sinto_todo!(rustc_middle::mir::interpret, ConstAllocation<'a>);
10+
sinto_todo!(rustc_middle::mir, UnwindTerminateReason);
1011
sinto_todo!(rustc_ast::tokenstream, DelimSpan);
1112
sinto_todo!(rustc_hir::def, DefKind);
1213
sinto_todo!(rustc_hir, GenericArgs<'a> as HirGenericArgs);

rust-toolchain.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[toolchain]
2-
channel = "nightly-2023-07-15"
2+
channel = "nightly-2023-09-19"
33
components = [ "rustc-dev", "llvm-tools-preview" , "rust-analysis" , "rust-src" , "rustfmt" ]

0 commit comments

Comments
 (0)