Skip to content

Prevent ICE on missing lang items. #72195

Closed
@lcnr

Description

@lcnr
Contributor

There are currently quite a few locations in the compiler similar to the following:

let future_trait = self.tcx.lang_items().future_trait().unwrap();

This causes an internal compiler error in case the expected lang item is not defined,
for example when using #![no_core]. (see #72099)

A better way to deal with this is to use tcx.require_lang_item(FutureTraitLangItem, opt_span) instead, which cleanly stops compilation in case the lang item is missing.

See #72170, which already did this in some places.

This issue has been assigned to @doctorn via this comment.

Activity

added
E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.
on May 14, 2020
added
C-enhancementCategory: An issue proposing an enhancement or a PR with one.
T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
on May 14, 2020
cofibrant

cofibrant commented on May 14, 2020

@cofibrant
Contributor

Ah! This is my bad...

cofibrant

cofibrant commented on May 14, 2020

@cofibrant
Contributor

@rustbot claim

self-assigned this
on May 14, 2020
added 5 commits that reference this issue on May 15, 2020

Rollup merge of rust-lang#72216 - doctorn:require-lang-item, r=lcnr

af423c9

Rollup merge of rust-lang#72216 - doctorn:require-lang-item, r=lcnr

a671ffe

Rollup merge of rust-lang#72216 - doctorn:require-lang-item, r=lcnr

6105499

Rollup merge of rust-lang#72216 - doctorn:require-lang-item, r=lcnr

ccc62c8

Rollup merge of rust-lang#72216 - doctorn:require-lang-item, r=lcnr

1be88e6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

A-lang-itemArea: Language itemsC-enhancementCategory: An issue proposing an enhancement or a PR with one.E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

    Development

    Participants

    @jonas-schievink@cofibrant@lcnr@rustbot

    Issue actions

      Prevent ICE on missing lang items. · Issue #72195 · rust-lang/rust