1
Fork 0

Rollup merge of #107125 - WaffleLapkin:expect_an_item_in_your_hir_by_the_next_morning, r=Nilstrieb

Add and use expect methods to hir.

[The future has come](https://github.com/rust-lang/rust/pull/106090/files#r1070062462).

r? `@Nilstrieb`

tbh I'm not even sure if it's worth it
This commit is contained in:
Matthias Krüger 2023-01-30 17:50:08 +01:00 committed by GitHub
commit 4ac1796267
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 378 additions and 25 deletions

View file

@ -1348,8 +1348,7 @@ fn suggest_impl_trait<'tcx>(
fn impl_trait_ref(tcx: TyCtxt<'_>, def_id: DefId) -> Option<ty::EarlyBinder<ty::TraitRef<'_>>> {
let icx = ItemCtxt::new(tcx, def_id);
let item = tcx.hir().expect_item(def_id.expect_local());
let hir::ItemKind::Impl(impl_) = item.kind else { bug!() };
let impl_ = tcx.hir().expect_item(def_id.expect_local()).expect_impl();
impl_
.of_trait
.as_ref()