Skip to content

Commit 8d88d5b

Browse files
committed
fmt
1 parent d0a89b4 commit 8d88d5b

File tree

4 files changed

+26
-15
lines changed

4 files changed

+26
-15
lines changed

compiler/rustc_ast_lowering/src/item.rs

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -601,9 +601,12 @@ impl<'hir> LoweringContext<'_, 'hir> {
601601
hir::Constness::NotConst => Const::No,
602602
}
603603
}
604-
hir::ItemKind::Trait(_, _, _, _, _) => {
605-
parent_hir.attrs.get(parent_item.hir_id().local_id).iter().find(|attr| attr.has_name(sym::const_trait)).map_or(Const::No, |attr| Const::Yes(attr.span))
606-
},
604+
hir::ItemKind::Trait(_, _, _, _, _) => parent_hir
605+
.attrs
606+
.get(parent_item.hir_id().local_id)
607+
.iter()
608+
.find(|attr| attr.has_name(sym::const_trait))
609+
.map_or(Const::No, |attr| Const::Yes(attr.span)),
607610
kind => {
608611
span_bug!(item.span, "assoc item has unexpected kind of parent: {}", kind.descr())
609612
}
@@ -738,7 +741,11 @@ impl<'hir> LoweringContext<'_, 'hir> {
738741
}
739742
}
740743

741-
fn lower_trait_item(&mut self, i: &AssocItem, trait_constness: Const) -> &'hir hir::TraitItem<'hir> {
744+
fn lower_trait_item(
745+
&mut self,
746+
i: &AssocItem,
747+
trait_constness: Const,
748+
) -> &'hir hir::TraitItem<'hir> {
742749
let hir_id = self.lower_node_id(i.id);
743750
self.lower_attrs(hir_id, &i.attrs);
744751
let trait_item_def_id = hir_id.expect_owner();
@@ -864,7 +871,11 @@ impl<'hir> LoweringContext<'_, 'hir> {
864871
self.expr(span, hir::ExprKind::Err(guar))
865872
}
866873

867-
fn lower_impl_item(&mut self, i: &AssocItem, impl_constness: Const) -> &'hir hir::ImplItem<'hir> {
874+
fn lower_impl_item(
875+
&mut self,
876+
i: &AssocItem,
877+
impl_constness: Const,
878+
) -> &'hir hir::ImplItem<'hir> {
868879
// Since `default impl` is not yet implemented, this is always true in impls.
869880
let has_value = true;
870881
let (defaultness, _) = self.lower_defaultness(i.kind.defaultness(), has_value);
@@ -1317,7 +1328,8 @@ impl<'hir> LoweringContext<'_, 'hir> {
13171328
let header = self.lower_fn_header(sig.header);
13181329
// Don't pass along the user-provided constness of trait associated functions; we don't want to
13191330
// synthesize a host effect param for them. We reject `const` on them during AST validation.
1320-
let constness = if kind == FnDeclKind::Inherent { sig.header.constness } else { parent_constness };
1331+
let constness =
1332+
if kind == FnDeclKind::Inherent { sig.header.constness } else { parent_constness };
13211333
let itctx = ImplTraitContext::Universal;
13221334
let (generics, decl) = self.lower_generics(generics, constness, id, itctx, |this| {
13231335
this.lower_fn_decl(&sig.decl, id, sig.span, kind, coroutine_kind)

compiler/rustc_hir_analysis/src/astconv/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -733,7 +733,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
733733
args,
734734
trait_segment.infer_args,
735735
Some(self_ty),
736-
// RIP APART THIS!!!
736+
// TODO remove this
737737
ty::BoundConstness::NotConst,
738738
);
739739

compiler/rustc_hir_analysis/src/bounds.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,12 @@ impl<'tcx> Bounds<'tcx> {
6868
let assoc = tcx.associated_type_for_effects(trait_ref.def_id()).unwrap();
6969
let self_ty = Ty::new_projection(tcx, assoc, trait_ref.skip_binder().args);
7070
// make `<T as Tr>::Effects: Compat<runtime>`
71-
let new_trait_ref = ty::TraitRef::new(tcx, tcx.require_lang_item(LangItem::EffectsCompat, Some(span)), [ty::GenericArg::from(self_ty), compat_val.into()]);
72-
self.clauses.push((
73-
trait_ref
74-
.rebind(new_trait_ref)
75-
.to_predicate(tcx),
76-
span,
77-
));
71+
let new_trait_ref = ty::TraitRef::new(
72+
tcx,
73+
tcx.require_lang_item(LangItem::EffectsCompat, Some(span)),
74+
[ty::GenericArg::from(self_ty), compat_val.into()],
75+
);
76+
self.clauses.push((trait_ref.rebind(new_trait_ref).to_predicate(tcx), span));
7877
}
7978
}
8079

compiler/rustc_middle/src/ty/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1559,7 +1559,7 @@ impl<'tcx> TyCtxt<'tcx> {
15591559
}
15601560
}
15611561

1562-
/// If the `def_id`` is an associated type that was desugared from a
1562+
/// If the `def_id` is an associated type that was desugared from a
15631563
/// return-position `impl Trait` from a trait, then provide the source info
15641564
/// about where that RPITIT came from.
15651565
pub fn opt_rpitit_info(self, def_id: DefId) -> Option<ImplTraitInTraitData> {

0 commit comments

Comments
 (0)