Skip to content

Commit 0806201

Browse files
committed
Update rustc pin
1 parent ed3966f commit 0806201

21 files changed

+142
-72
lines changed

engine/lib/concrete_ident/concrete_ident.ml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -702,7 +702,7 @@ let map_path_strings ~(f : string -> string) (did : t) : t =
702702
|> List.map ~f:(fun (chunk : Types.disambiguated_def_path_item) ->
703703
let data =
704704
match chunk.data with
705-
| TypeNs s -> Types.TypeNs (Option.map ~f s)
705+
| TypeNs s -> Types.TypeNs (f s)
706706
| ValueNs s -> ValueNs (f s)
707707
| MacroNs s -> MacroNs (f s)
708708
| LifetimeNs s -> LifetimeNs (f s)
@@ -726,8 +726,7 @@ let matches_namespace (ns : Types.namespace) (did : t) : bool =
726726
@ List.map
727727
~f:(fun (chunk : Types.disambiguated_def_path_item) ->
728728
match chunk.data with
729-
| TypeNs s -> s
730-
| ValueNs s | MacroNs s | LifetimeNs s -> Some s
729+
| TypeNs s | ValueNs s | MacroNs s | LifetimeNs s -> Some s
731730
| _ -> None)
732731
did.path
733732
in

engine/lib/concrete_ident/concrete_ident_view.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ module Assert = struct
2121
let type_ns (did : Explicit_def_id.t) =
2222
match List.last (Explicit_def_id.to_def_id did).path with
2323
(* This can be `None` for the anonymous types generated for `-> impl Trait` in traits. *)
24-
| Some { data = TypeNs (Some data); disambiguator } ->
24+
| Some { data = TypeNs data; disambiguator } ->
2525
DisambiguatedString.{ data; disambiguator }
2626
| _ -> broken_invariant "last path chunk to exist and be of type TypeNs" did
2727

@@ -191,7 +191,7 @@ let of_def_id (did : Explicit_def_id.t) : t =
191191
:: List.map
192192
~f:(fun (m : Explicit_def_id.t) ->
193193
match (Explicit_def_id.to_def_id m).path |> List.last_exn with
194-
| Types.{ disambiguator; data = TypeNs (Some data) } ->
194+
| Types.{ disambiguator; data = TypeNs data } ->
195195
DisambiguatedString.{ data; disambiguator }
196196
| _ ->
197197
broken_invariant

engine/lib/import_thir.ml

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,18 @@ end) : EXPR = struct
353353
in
354354
U.call' (`Concrete name) [ lhs; rhs ] span typ
355355

356+
let binop_of_assignop : Thir.assign_op -> Thir.bin_op = function
357+
| AddAssign -> Add
358+
| SubAssign -> Sub
359+
| MulAssign -> Mul
360+
| DivAssign -> Div
361+
| RemAssign -> Rem
362+
| BitXorAssign -> BitXor
363+
| BitAndAssign -> BitAnd
364+
| BitOrAssign -> BitOr
365+
| ShlAssign -> Shl
366+
| ShrAssign -> Shr
367+
356368
let rec c_expr (e : Thir.decorated_for__expr_kind) : expr =
357369
try c_expr_unwrapped e
358370
with Diagnostics.SpanFreeError.Exn (Data (ctx, kind)) ->
@@ -596,7 +608,8 @@ end) : EXPR = struct
596608
c_expr_assign lhs rhs
597609
| AssignOp { lhs; op; rhs } ->
598610
let lhs = c_expr lhs in
599-
c_expr_assign lhs @@ c_binop op lhs (c_expr rhs) span lhs.typ
611+
c_expr_assign lhs
612+
@@ c_binop (binop_of_assignop op) lhs (c_expr rhs) span lhs.typ
600613
| VarRef { id } -> LocalVar (local_ident Expr id)
601614
| Field { lhs; field } ->
602615
let lhs = c_expr lhs in
@@ -876,7 +889,7 @@ end) : EXPR = struct
876889
let typ = c_ty pat.span pat.ty in
877890
let v =
878891
match pat.contents with
879-
| Wild -> PWild
892+
| Wild | Missing -> PWild
880893
| AscribeUserType { ascription = { annotation; _ }; subpattern } ->
881894
let typ, typ_span = c_canonical_user_type_annotation annotation in
882895
let pat = c_pat subpattern in
@@ -1045,8 +1058,8 @@ end) : EXPR = struct
10451058
TOpaque (Concrete_ident.of_def_id ~value:false def_id)
10461059
| Alias { kind = Inherent; _ } ->
10471060
assertion_failure [ span ] "Ty::Alias with AliasTyKind::Inherent"
1048-
| Alias { kind = Weak; _ } ->
1049-
assertion_failure [ span ] "Ty::Alias with AliasTyKind::Weak"
1061+
| Alias { kind = Free; _ } ->
1062+
assertion_failure [ span ] "Ty::Alias with AliasTyKind::Free"
10501063
| Param { index; name } ->
10511064
(* TODO: [id] might not unique *)
10521065
TParam

engine/names/extract/build.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ fn disambiguator_to_str(disambiguator: u32) -> String {
5555

5656
fn def_path_item_to_str(path_item: DefPathItem) -> String {
5757
match path_item {
58-
DefPathItem::TypeNs(Some(s))
58+
DefPathItem::TypeNs(s)
5959
| DefPathItem::ValueNs(s)
6060
| DefPathItem::MacroNs(s)
6161
| DefPathItem::LifetimeNs(s) => s,
@@ -68,7 +68,11 @@ fn def_path_item_to_str(path_item: DefPathItem) -> String {
6868
DefPathItem::Ctor => "Ctor".into(),
6969
DefPathItem::AnonConst => "AnonConst".into(),
7070
DefPathItem::PromotedConst => "PromotedConst".into(),
71-
DefPathItem::TypeNs(None) | DefPathItem::OpaqueTy => "OpaqueTy".into(),
71+
DefPathItem::OpaqueTy => "OpaqueTy".into(),
72+
DefPathItem::OpaqueLifetime(..) => "OpaqueLifetime".into(),
73+
DefPathItem::AnonAssocTy(..) => "AnonAssocTy".into(),
74+
DefPathItem::SyntheticCoroutineBody => "SyntheticCoroutineBody".into(),
75+
DefPathItem::NestedStatic => "NestedStatic".into(),
7276
}
7377
}
7478

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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ pub fn translate_constant_reference<'tcx>(
113113
let kind = if let Some(assoc) = s.base().tcx.opt_associated_item(ucv.def) {
114114
if assoc.trait_item_def_id.is_some() || assoc.container == ty::AssocItemContainer::Trait {
115115
// This is an associated constant in a trait.
116-
let name = assoc.name.to_string();
116+
let name = assoc.name().to_string();
117117
let impl_expr = self_clause_for_item(s, ucv.def, ucv.args).unwrap();
118118
ConstantExprKind::TraitConst { impl_expr, name }
119119
} else {

frontend/exporter/src/traits/resolution.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ impl<'tcx> PredicateSearcher<'tcx> {
429429
let types = tcx
430430
.associated_items(trait_def_id)
431431
.in_definition_order()
432-
.filter(|assoc| matches!(assoc.kind, AssocKind::Type))
432+
.filter(|assoc| matches!(assoc.kind, AssocKind::Type { .. }))
433433
.filter_map(|assoc| {
434434
let ty =
435435
Ty::new_projection(tcx, assoc.def_id, erased_tref.skip_binder().args);

frontend/exporter/src/types/def_id.rs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -343,10 +343,10 @@ impl std::convert::From<DefId> for Path {
343343
fn from(v: DefId) -> Vec<String> {
344344
std::iter::once(&v.krate)
345345
.chain(v.path.iter().filter_map(|item| match &item.data {
346-
DefPathItem::TypeNs(s) => s.as_ref(),
347-
DefPathItem::ValueNs(s) | DefPathItem::MacroNs(s) | DefPathItem::LifetimeNs(s) => {
348-
Some(s)
349-
}
346+
DefPathItem::TypeNs(s)
347+
| DefPathItem::ValueNs(s)
348+
| DefPathItem::MacroNs(s)
349+
| DefPathItem::LifetimeNs(s) => Some(s),
350350
_ => None,
351351
}))
352352
.cloned()
@@ -378,7 +378,7 @@ pub enum DefPathItem {
378378
ForeignMod,
379379
Use,
380380
GlobalAsm,
381-
TypeNs(Option<Symbol>),
381+
TypeNs(Symbol),
382382
ValueNs(Symbol),
383383
MacroNs(Symbol),
384384
LifetimeNs(Symbol),
@@ -388,6 +388,10 @@ pub enum DefPathItem {
388388
#[cfg_attr(not(feature = "extract_names_mode"), disable_mapping)]
389389
PromotedConst,
390390
OpaqueTy,
391+
OpaqueLifetime(Symbol),
392+
AnonAssocTy(Symbol),
393+
SyntheticCoroutineBody,
394+
NestedStatic,
391395
}
392396

393397
#[derive_group(Serializers)]

frontend/exporter/src/types/mir.rs

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -981,7 +981,7 @@ make_idx_wrapper!(rustc_abi, FieldIdx);
981981
/// Reflects [`rustc_middle::mir::UnOp`]
982982
#[derive_group(Serializers)]
983983
#[derive(AdtInto, Copy, Clone, Debug, JsonSchema)]
984-
#[args(<'slt, S: UnderOwnerState<'slt>>, from: rustc_middle::mir::UnOp, state: S as _s)]
984+
#[args(<'slt, S: UnderOwnerState<'slt>>, from: mir::UnOp, state: S as _s)]
985985
pub enum UnOp {
986986
Not,
987987
Neg,
@@ -991,7 +991,7 @@ pub enum UnOp {
991991
/// Reflects [`rustc_middle::mir::BinOp`]
992992
#[derive_group(Serializers)]
993993
#[derive(AdtInto, Copy, Clone, Debug, JsonSchema)]
994-
#[args(<'slt, S: UnderOwnerState<'slt>>, from: rustc_middle::mir::BinOp, state: S as _s)]
994+
#[args(<'slt, S: UnderOwnerState<'slt>>, from: mir::BinOp, state: S as _s)]
995995
pub enum BinOp {
996996
// We merge the checked and unchecked variants because in either case overflow is failure.
997997
#[custom_arm(
@@ -1032,9 +1032,26 @@ pub enum BinOp {
10321032
Offset,
10331033
}
10341034

1035+
/// Reflects [`rustc_middle::mir::AssignOp`]
1036+
#[derive_group(Serializers)]
1037+
#[derive(AdtInto, Copy, Clone, Debug, JsonSchema)]
1038+
#[args(<'tcx, S: BaseState<'tcx>>, from: mir::AssignOp, state: S as _s)]
1039+
pub enum AssignOp {
1040+
AddAssign,
1041+
SubAssign,
1042+
MulAssign,
1043+
DivAssign,
1044+
RemAssign,
1045+
BitXorAssign,
1046+
BitAndAssign,
1047+
BitOrAssign,
1048+
ShlAssign,
1049+
ShrAssign,
1050+
}
1051+
10351052
/// Reflects [`rustc_middle::mir::BorrowKind`]
10361053
#[derive(AdtInto)]
1037-
#[args(<S>, from: rustc_middle::mir::BorrowKind, state: S as gstate)]
1054+
#[args(<S>, from: mir::BorrowKind, state: S as gstate)]
10381055
#[derive_group(Serializers)]
10391056
#[derive(Copy, Clone, Debug, JsonSchema, Hash, PartialEq, Eq, PartialOrd, Ord)]
10401057
pub enum BorrowKind {

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

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,8 @@ pub enum FullDefKind<Body> {
476476
#[derive_group(Serializers)]
477477
#[derive(Clone, Debug, JsonSchema)]
478478
pub struct ImplAssocItem<Body> {
479-
pub name: Symbol,
479+
/// This is `None` for RPTITs.
480+
pub name: Option<Symbol>,
480481
/// The definition of the item from the trait declaration. This is `AssocTy`, `AssocFn` or
481482
/// `AssocConst`.
482483
pub decl_def: Arc<FullDef<Body>>,
@@ -571,11 +572,11 @@ impl<Body> FullDef<Body> {
571572
.collect(),
572573
FullDefKind::InherentImpl { items, .. } | FullDefKind::Trait { items, .. } => items
573574
.iter()
574-
.map(|(item, _)| (item.name.clone(), item.def_id.clone()))
575+
.filter_map(|(item, _)| Some((item.name.clone()?, item.def_id.clone())))
575576
.collect(),
576577
FullDefKind::TraitImpl { items, .. } => items
577578
.iter()
578-
.map(|item| (item.name.clone(), item.def().def_id.clone()))
579+
.filter_map(|item| Some((item.name.clone()?, item.def().def_id.clone())))
579580
.collect(),
580581
_ => vec![],
581582
};
@@ -586,7 +587,7 @@ impl<Body> FullDef<Body> {
586587
children.extend(
587588
tcx.associated_items(impl_def_id)
588589
.in_definition_order()
589-
.map(|assoc| (assoc.name, assoc.def_id).sinto(s)),
590+
.filter_map(|assoc| Some((assoc.opt_name()?, assoc.def_id).sinto(s))),
590591
);
591592
}
592593
}
@@ -605,11 +606,17 @@ impl<Body> ImplAssocItem<Body> {
605606
}
606607

607608
/// The kind of item this is.
608-
pub fn assoc_kind(&self) -> AssocKind {
609+
pub fn assoc_kind(&self) -> &AssocKind {
609610
match self.def().kind() {
610-
FullDefKind::AssocTy { .. } => AssocKind::Type,
611-
FullDefKind::AssocFn { .. } => AssocKind::Fn,
612-
FullDefKind::AssocConst { .. } => AssocKind::Const,
611+
FullDefKind::AssocTy {
612+
associated_item, ..
613+
}
614+
| FullDefKind::AssocFn {
615+
associated_item, ..
616+
}
617+
| FullDefKind::AssocConst {
618+
associated_item, ..
619+
} => &associated_item.kind,
613620
_ => unreachable!(),
614621
}
615622
}
@@ -804,21 +811,23 @@ where
804811
vec![]
805812
};
806813
match decl_assoc.kind {
807-
ty::AssocKind::Type => {
814+
ty::AssocKind::Type { .. } => {
808815
let ty = tcx
809816
.type_of(decl_def_id)
810817
.instantiate(tcx, trait_ref.args)
811818
.sinto(s);
812819
ImplAssocItemValue::DefaultedTy { ty }
813820
}
814-
ty::AssocKind::Fn => ImplAssocItemValue::DefaultedFn {},
815-
ty::AssocKind::Const => ImplAssocItemValue::DefaultedConst {},
821+
ty::AssocKind::Fn { .. } => ImplAssocItemValue::DefaultedFn {},
822+
ty::AssocKind::Const { .. } => {
823+
ImplAssocItemValue::DefaultedConst {}
824+
}
816825
}
817826
}
818827
};
819828

820829
ImplAssocItem {
821-
name: decl_assoc.name.sinto(s),
830+
name: decl_assoc.opt_name().sinto(s),
822831
value,
823832
required_impl_exprs,
824833
decl_def,

0 commit comments

Comments
 (0)