Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 03c05c9

Browse files
committed
Also match on the lang item in confirmation
1 parent dd71427 commit 03c05c9

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

‎compiler/rustc_trait_selection/src/traits/select/confirmation.rs‎

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -252,16 +252,11 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
252252
let tcx = self.tcx();
253253
let obligations = if has_nested {
254254
let trait_def = obligation.predicate.def_id();
255-
let conditions = if tcx.is_lang_item(trait_def, LangItem::Sized) {
256-
self.sized_conditions(obligation)
257-
} else if tcx.is_lang_item(trait_def, LangItem::Copy) {
258-
self.copy_clone_conditions(obligation)
259-
} else if tcx.is_lang_item(trait_def, LangItem::Clone) {
260-
self.copy_clone_conditions(obligation)
261-
} else if tcx.is_lang_item(trait_def, LangItem::FusedIterator) {
262-
self.fused_iterator_conditions(obligation)
263-
} else {
264-
bug!("unexpected builtin trait {:?}", trait_def)
255+
let conditions = match tcx.as_lang_item(trait_def) {
256+
Some(LangItem::Sized) => self.sized_conditions(obligation),
257+
Some(LangItem::Copy | LangItem::Clone) => self.copy_clone_conditions(obligation),
258+
Some(LangItem::FusedIterator) => self.fused_iterator_conditions(obligation),
259+
other => bug!("unexpected builtin trait {trait_def:?} ({other:?})"),
265260
};
266261
let BuiltinImplConditions::Where(types) = conditions else {
267262
bug!("obligation {:?} had matched a builtin impl but now doesn't", obligation);

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /