Skip to content

Commit 6cee56a

Browse files
committed
Update rustc
1 parent cf49ec3 commit 6cee56a

25 files changed

+133
-72
lines changed

cli/driver/src/driver.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#![feature(rustc_private)]
22
#![feature(box_patterns)]
3-
#![feature(concat_idents)]
43
#![feature(trait_alias)]
54
#![allow(unused_imports)]
65
#![allow(unused_variables)]

engine/lib/import_thir.ml

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1513,7 +1513,7 @@ and c_item_unwrapped ~ident ~type_only (item : Thir.item) : item list =
15131513
in
15141514
(* TODO: things might be unnamed (e.g. constants) *)
15151515
match (item.kind : Thir.item_kind) with
1516-
| Const (_, _, generics, body) ->
1516+
| Const (_, generics, _, body) ->
15171517
mk
15181518
@@ Fn
15191519
{
@@ -1523,14 +1523,14 @@ and c_item_unwrapped ~ident ~type_only (item : Thir.item) : item list =
15231523
params = [];
15241524
safety = Safe;
15251525
}
1526-
| Static (_, _, true, _) ->
1526+
| Static (true, _, _, _) ->
15271527
unimplemented ~issue_id:1343 [ item.span ]
15281528
"Mutable static items are not supported."
1529-
| Static (_, _ty, false, body) ->
1529+
| Static (false, _, _ty, body) ->
15301530
let name = Concrete_ident.of_def_id ~value:true (assert_item_def_id ()) in
15311531
let generics = { params = []; constraints = [] } in
15321532
mk (Fn { name; generics; body = c_body body; params = []; safety = Safe })
1533-
| TyAlias (_, ty, generics) ->
1533+
| TyAlias (_, generics, ty) ->
15341534
mk
15351535
@@ TyAlias
15361536
{
@@ -1549,13 +1549,13 @@ and c_item_unwrapped ~ident ~type_only (item : Thir.item) : item list =
15491549
params = c_fn_params item.span params;
15501550
safety = c_header_safety safety;
15511551
}
1552-
| (Enum (_, _, generics, _) | Struct (_, _, generics)) when erased ->
1552+
| (Enum (_, generics, _, _) | Struct (_, generics, _)) when erased ->
15531553
let generics = c_generics generics in
15541554
let is_struct = match item.kind with Struct _ -> true | _ -> false in
15551555
let def_id = assert_item_def_id () in
15561556
let name = Concrete_ident.of_def_id ~value:false def_id in
15571557
mk @@ Type { name; generics; variants = []; is_struct }
1558-
| Enum (_, variants, generics, repr) ->
1558+
| Enum (_, generics, variants, repr) ->
15591559
let def_id = assert_item_def_id () in
15601560
let generics = c_generics generics in
15611561
let is_struct = false in
@@ -1613,7 +1613,7 @@ and c_item_unwrapped ~ident ~type_only (item : Thir.item) : item list =
16131613
mk_one (Type { name; generics; variants; is_struct }) :: discs
16141614
in
16151615
if is_primitive then cast_fun :: result else result
1616-
| Struct (_, v, generics) ->
1616+
| Struct (_, generics, v) ->
16171617
let generics = c_generics generics in
16181618
let def_id = assert_item_def_id () in
16191619
let is_struct = true in
@@ -1808,7 +1808,9 @@ and c_item_unwrapped ~ident ~type_only (item : Thir.item) : item list =
18081808
{
18091809
path = List.map ~f:(fun x -> fst x.ident) segments;
18101810
is_external =
1811-
List.exists ~f:(function Err -> true | _ -> false) res;
1811+
List.exists
1812+
~f:(function None | Some Err -> true | _ -> false)
1813+
res;
18121814
(* TODO: this should represent local/external? *)
18131815
rename;
18141816
}

flake.lock

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

frontend/exporter/src/constant_utils/uneval.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ impl<'tcx, S: UnderOwnerState<'tcx>> SInto<S, ConstantExpr> for ty::Const<'tcx>
154154
let span = self.default_span(s.base().tcx);
155155
match self.kind() {
156156
ty::ConstKind::Param(p) => {
157-
let ty = p.find_ty_from_env(s.param_env());
157+
let ty = p.find_const_ty_from_env(s.param_env());
158158
let kind = ConstantExprKind::ConstRef { id: p.sinto(s) };
159159
kind.decorate(ty.sinto(s), span.sinto(s))
160160
}
@@ -279,7 +279,7 @@ fn op_to_const<'tcx, S: UnderOwnerState<'tcx>>(
279279
// Helper for struct-likes.
280280
let read_fields = |of: rustc_const_eval::interpret::OpTy<'tcx>, field_count| {
281281
(0..field_count).map(move |i| {
282-
let field_op = ecx.project_field(&of, i)?;
282+
let field_op = ecx.project_field(&of, rustc_abi::FieldIdx::from_usize(i))?;
283283
op_to_const(s, span, &ecx, field_op)
284284
})
285285
};

frontend/exporter/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
#![allow(rustdoc::private_intra_doc_links)]
2-
#![cfg_attr(feature = "rustc", feature(concat_idents))]
32
#![cfg_attr(feature = "rustc", feature(if_let_guard))]
43
#![cfg_attr(feature = "rustc", feature(let_chains))]
54
#![cfg_attr(feature = "rustc", feature(macro_metavar_expr))]
65
#![cfg_attr(feature = "rustc", feature(rustc_private))]
6+
#![cfg_attr(feature = "rustc", feature(sized_hierarchy))]
77
#![cfg_attr(feature = "rustc", feature(trait_alias))]
88
#![cfg_attr(feature = "rustc", feature(type_changing_struct_update))]
99

frontend/exporter/src/sinto.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
11
use crate::prelude::{derive_group, JsonSchema};
22

3+
#[cfg(not(feature = "rustc"))]
34
pub trait SInto<S, To> {
45
fn sinto(&self, s: &S) -> To;
56
}
67

8+
#[cfg(feature = "rustc")]
9+
pub trait SInto<S, To>: std::marker::PointeeSized {
10+
fn sinto(&self, s: &S) -> To;
11+
}
12+
713
#[macro_export]
814
macro_rules! sinto_todo {
915
($($mod:ident)::+, $type:ident$(<$($lts:lifetime),*$(,)?>)? as $renamed:ident) => {

frontend/exporter/src/traits/resolution.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -677,7 +677,7 @@ pub fn shallow_resolve_trait_ref<'tcx>(
677677
use rustc_middle::traits::CodegenObligationError;
678678
use rustc_middle::ty::TypeVisitableExt;
679679
use rustc_trait_selection::traits::{
680-
Obligation, ObligationCause, ObligationCtxt, SelectionContext, Unimplemented,
680+
Obligation, ObligationCause, ObligationCtxt, SelectionContext, SelectionError,
681681
};
682682
// Do the initial selection for the obligation. This yields the
683683
// shallow result we are looking for -- that is, what specific impl.
@@ -693,7 +693,7 @@ pub fn shallow_resolve_trait_ref<'tcx>(
693693
let selection = match selcx.poly_select(&obligation) {
694694
Ok(Some(selection)) => selection,
695695
Ok(None) => return Err(CodegenObligationError::Ambiguity),
696-
Err(Unimplemented) => return Err(CodegenObligationError::Unimplemented),
696+
Err(SelectionError::Unimplemented) => return Err(CodegenObligationError::Unimplemented),
697697
Err(_) => return Err(CodegenObligationError::Ambiguity),
698698
};
699699

frontend/exporter/src/types/hir.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -535,7 +535,7 @@ pub struct Variant<Body: IsBody> {
535535
pub struct UsePath {
536536
pub span: Span,
537537
#[map(x.iter().map(|res| res.sinto(s)).collect())]
538-
pub res: Vec<Res>,
538+
pub res: Vec<Option<Res>>,
539539
pub segments: Vec<PathSegment>,
540540
#[value(self.segments.iter().last().and_then(|segment| {
541541
match s.base().tcx.hir_node_by_def_id(segment.hir_id.owner.def_id) {
@@ -620,8 +620,8 @@ pub struct PathSegment {
620620
pub enum ItemKind<Body: IsBody> {
621621
ExternCrate(Option<Symbol>, Ident),
622622
Use(UsePath, UseKind),
623-
Static(Ident, Ty, Mutability, Body),
624-
Const(Ident, Ty, Generics<Body>, Body),
623+
Static(Mutability, Ident, Ty, Body),
624+
Const(Ident, Generics<Body>, Ty, Body),
625625
#[custom_arm(
626626
hir::ItemKind::Fn{ ident, sig, generics, body, .. } => {
627627
ItemKind::Fn {
@@ -648,6 +648,7 @@ pub enum ItemKind<Body: IsBody> {
648648
},
649649
TyAlias(
650650
Ident,
651+
Generics<Body>,
651652
#[map({
652653
let s = &State {
653654
base: Base {ty_alias_mode: true, ..s.base()},
@@ -659,20 +660,19 @@ pub enum ItemKind<Body: IsBody> {
659660
x.sinto(s)
660661
})]
661662
Ty,
662-
Generics<Body>,
663663
),
664664
Enum(
665665
Ident,
666-
EnumDef<Body>,
667666
Generics<Body>,
667+
EnumDef<Body>,
668668
#[value({
669669
let tcx = s.base().tcx;
670670
tcx.repr_options_of_def(s.owner_id().expect_local()).sinto(s)
671671
})]
672672
ReprOptions,
673673
),
674-
Struct(Ident, VariantData, Generics<Body>),
675-
Union(Ident, VariantData, Generics<Body>),
674+
Struct(Ident, Generics<Body>, VariantData),
675+
Union(Ident, Generics<Body>, VariantData),
676676
Trait(
677677
IsAuto,
678678
Safety,
@@ -916,7 +916,7 @@ impl<'tcx, S: BaseState<'tcx>, Body: IsBody> SInto<S, Item<Body>> for hir::Item<
916916
let name = match self.kind {
917917
ExternCrate(_, i)
918918
| Use(_, hir::UseKind::Single(i))
919-
| Static(i, ..)
919+
| Static(_, i, ..)
920920
| Const(i, ..)
921921
| Fn { ident: i, .. }
922922
| Macro(i, ..)

frontend/exporter/src/types/new/full_def.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ pub enum FullDefKind<Body> {
217217
/// `Some` if the item is in the local crate.
218218
#[value(s.base().tcx.hir_get_if_local(s.owner_id()).map(|node| {
219219
let rustc_hir::Node::Item(item) = node else { unreachable!() };
220-
let rustc_hir::ItemKind::TyAlias(_, ty, _generics) = &item.kind else { unreachable!() };
220+
let rustc_hir::ItemKind::TyAlias(_, _generics, ty) = &item.kind else { unreachable!() };
221221
let mut s = State::from_under_owner(s);
222222
s.base.ty_alias_mode = true;
223223
ty.sinto(&s)
@@ -981,7 +981,8 @@ fn closure_once_shim<'tcx>(
981981

982982
#[cfg(feature = "rustc")]
983983
fn drop_glue_shim<'tcx>(tcx: ty::TyCtxt<'tcx>, def_id: RDefId) -> Option<mir::Body<'tcx>> {
984-
let drop_in_place = tcx.require_lang_item(rustc_hir::LangItem::DropInPlace, None);
984+
let drop_in_place =
985+
tcx.require_lang_item(rustc_hir::LangItem::DropInPlace, rustc_span::DUMMY_SP);
985986
if !tcx.generics_of(def_id).is_empty() {
986987
// Hack: layout code panics if it can't fully normalize types, which can happen e.g. with a
987988
// trait associated type. For now we only translate the glue for monomorphic types.

frontend/exporter/src/types/ty.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -544,14 +544,14 @@ impl std::ops::Deref for ItemRef {
544544
#[cfg(feature = "rustc")]
545545
impl<'tcx, S: UnderOwnerState<'tcx>> SInto<S, GenericArg> for ty::GenericArg<'tcx> {
546546
fn sinto(&self, s: &S) -> GenericArg {
547-
self.unpack().sinto(s)
547+
self.kind().sinto(s)
548548
}
549549
}
550550

551551
#[cfg(feature = "rustc")]
552552
impl<'tcx, S: UnderOwnerState<'tcx>> SInto<S, Vec<GenericArg>> for ty::GenericArgsRef<'tcx> {
553553
fn sinto(&self, s: &S) -> Vec<GenericArg> {
554-
self.iter().map(|v| v.unpack().sinto(s)).collect()
554+
self.iter().map(|v| v.kind().sinto(s)).collect()
555555
}
556556
}
557557

@@ -1169,7 +1169,7 @@ pub enum Term {
11691169
impl<'tcx, S: UnderOwnerState<'tcx>> SInto<S, Term> for ty::Term<'tcx> {
11701170
fn sinto(&self, s: &S) -> Term {
11711171
use ty::TermKind;
1172-
match self.unpack() {
1172+
match self.kind() {
11731173
TermKind::Ty(ty) => Term::Ty(ty.sinto(s)),
11741174
TermKind::Const(c) => Term::Const(c.sinto(s)),
11751175
}

0 commit comments

Comments
 (0)