Skip to content

Commit 254fd5a

Browse files
authored
Merge pull request #1482 from Nadrieril/update-rustc
Update rustc pin
2 parents 95c3941 + b98632b commit 254fd5a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+292
-228
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
@@ -465,7 +465,7 @@ impl<'tcx> PredicateSearcher<'tcx> {
465465
let types = tcx
466466
.associated_items(trait_def_id)
467467
.in_definition_order()
468-
.filter(|assoc| matches!(assoc.kind, AssocKind::Type))
468+
.filter(|assoc| matches!(assoc.kind, AssocKind::Type { .. }))
469469
.filter_map(|assoc| {
470470
let ty =
471471
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
@@ -1021,7 +1021,7 @@ make_idx_wrapper!(rustc_abi, FieldIdx);
10211021
/// Reflects [`rustc_middle::mir::UnOp`]
10221022
#[derive_group(Serializers)]
10231023
#[derive(AdtInto, Copy, Clone, Debug, JsonSchema)]
1024-
#[args(<'slt, S: UnderOwnerState<'slt>>, from: rustc_middle::mir::UnOp, state: S as _s)]
1024+
#[args(<'slt, S: UnderOwnerState<'slt>>, from: mir::UnOp, state: S as _s)]
10251025
pub enum UnOp {
10261026
Not,
10271027
Neg,
@@ -1031,7 +1031,7 @@ pub enum UnOp {
10311031
/// Reflects [`rustc_middle::mir::BinOp`]
10321032
#[derive_group(Serializers)]
10331033
#[derive(AdtInto, Copy, Clone, Debug, JsonSchema)]
1034-
#[args(<'slt, S: UnderOwnerState<'slt>>, from: rustc_middle::mir::BinOp, state: S as _s)]
1034+
#[args(<'slt, S: UnderOwnerState<'slt>>, from: mir::BinOp, state: S as _s)]
10351035
pub enum BinOp {
10361036
// We merge the checked and unchecked variants because in either case overflow is failure.
10371037
#[custom_arm(
@@ -1072,9 +1072,26 @@ pub enum BinOp {
10721072
Offset,
10731073
}
10741074

1075+
/// Reflects [`rustc_middle::mir::AssignOp`]
1076+
#[derive_group(Serializers)]
1077+
#[derive(AdtInto, Copy, Clone, Debug, JsonSchema)]
1078+
#[args(<'tcx, S: BaseState<'tcx>>, from: mir::AssignOp, state: S as _s)]
1079+
pub enum AssignOp {
1080+
AddAssign,
1081+
SubAssign,
1082+
MulAssign,
1083+
DivAssign,
1084+
RemAssign,
1085+
BitXorAssign,
1086+
BitAndAssign,
1087+
BitOrAssign,
1088+
ShlAssign,
1089+
ShrAssign,
1090+
}
1091+
10751092
/// Reflects [`rustc_middle::mir::BorrowKind`]
10761093
#[derive(AdtInto)]
1077-
#[args(<S>, from: rustc_middle::mir::BorrowKind, state: S as gstate)]
1094+
#[args(<S>, from: mir::BorrowKind, state: S as gstate)]
10781095
#[derive_group(Serializers)]
10791096
#[derive(Copy, Clone, Debug, JsonSchema, Hash, PartialEq, Eq, PartialOrd, Ord)]
10801097
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
@@ -487,7 +487,8 @@ pub enum FullDefKind<Body> {
487487
#[derive_group(Serializers)]
488488
#[derive(Clone, Debug, JsonSchema)]
489489
pub struct ImplAssocItem<Body> {
490-
pub name: Symbol,
490+
/// This is `None` for RPTITs.
491+
pub name: Option<Symbol>,
491492
/// The definition of the item from the trait declaration. This is `AssocTy`, `AssocFn` or
492493
/// `AssocConst`.
493494
pub decl_def: Arc<FullDef<Body>>,
@@ -583,11 +584,11 @@ impl<Body> FullDef<Body> {
583584
.collect(),
584585
FullDefKind::InherentImpl { items, .. } | FullDefKind::Trait { items, .. } => items
585586
.iter()
586-
.map(|(item, _)| (item.name.clone(), item.def_id.clone()))
587+
.filter_map(|(item, _)| Some((item.name.clone()?, item.def_id.clone())))
587588
.collect(),
588589
FullDefKind::TraitImpl { items, .. } => items
589590
.iter()
590-
.map(|item| (item.name.clone(), item.def().def_id.clone()))
591+
.filter_map(|item| Some((item.name.clone()?, item.def().def_id.clone())))
591592
.collect(),
592593
_ => vec![],
593594
};
@@ -598,7 +599,7 @@ impl<Body> FullDef<Body> {
598599
children.extend(
599600
tcx.associated_items(impl_def_id)
600601
.in_definition_order()
601-
.map(|assoc| (assoc.name, assoc.def_id).sinto(s)),
602+
.filter_map(|assoc| Some((assoc.opt_name()?, assoc.def_id).sinto(s))),
602603
);
603604
}
604605
}
@@ -617,11 +618,17 @@ impl<Body> ImplAssocItem<Body> {
617618
}
618619

619620
/// The kind of item this is.
620-
pub fn assoc_kind(&self) -> AssocKind {
621+
pub fn assoc_kind(&self) -> &AssocKind {
621622
match self.def().kind() {
622-
FullDefKind::AssocTy { .. } => AssocKind::Type,
623-
FullDefKind::AssocFn { .. } => AssocKind::Fn,
624-
FullDefKind::AssocConst { .. } => AssocKind::Const,
623+
FullDefKind::AssocTy {
624+
associated_item, ..
625+
}
626+
| FullDefKind::AssocFn {
627+
associated_item, ..
628+
}
629+
| FullDefKind::AssocConst {
630+
associated_item, ..
631+
} => &associated_item.kind,
625632
_ => unreachable!(),
626633
}
627634
}
@@ -827,21 +834,23 @@ where
827834
vec![]
828835
};
829836
match decl_assoc.kind {
830-
ty::AssocKind::Type => {
837+
ty::AssocKind::Type { .. } => {
831838
let ty = tcx
832839
.type_of(decl_def_id)
833840
.instantiate(tcx, trait_ref.args)
834841
.sinto(s);
835842
ImplAssocItemValue::DefaultedTy { ty }
836843
}
837-
ty::AssocKind::Fn => ImplAssocItemValue::DefaultedFn {},
838-
ty::AssocKind::Const => ImplAssocItemValue::DefaultedConst {},
844+
ty::AssocKind::Fn { .. } => ImplAssocItemValue::DefaultedFn {},
845+
ty::AssocKind::Const { .. } => {
846+
ImplAssocItemValue::DefaultedConst {}
847+
}
839848
}
840849
}
841850
};
842851

843852
ImplAssocItem {
844-
name: decl_assoc.name.sinto(s),
853+
name: decl_assoc.opt_name().sinto(s),
845854
value,
846855
required_impl_exprs,
847856
decl_def,

0 commit comments

Comments
 (0)