1
Fork 0

Rollup merge of #104728 - WaffleLapkin:require-lang-items-politely, r=compiler-errors

Use `tcx.require_lang_item` instead of unwrapping lang items

I clearly remember esteban telling me that there is `require_lang_item` but he was from a phone atm and I couldn't find it, so I didn't use it. Stumbled on it today, so here we are :)
This commit is contained in:
Yuki Okushi 2022-11-23 06:40:24 +09:00 committed by GitHub
commit 3ec1ca0516
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 14 additions and 12 deletions

View file

@ -114,7 +114,7 @@ fn visit_implementation_of_copy(tcx: TyCtxt<'_>, impl_did: LocalDefId) {
traits::ObligationCause::dummy_with_span(field_ty_span),
param_env,
ty,
tcx.lang_items().copy_trait().unwrap(),
tcx.require_lang_item(LangItem::Copy, Some(span)),
) {
let error_predicate = error.obligation.predicate;
// Only note if it's not the root obligation, otherwise it's trivial and