Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent ICE on missing lang items. #72195

Closed
lcnr opened this issue May 14, 2020 · 2 comments · Fixed by #72216
Closed

Prevent ICE on missing lang items. #72195

lcnr opened this issue May 14, 2020 · 2 comments · Fixed by #72216
Assignees
Labels
A-lang-item Area: Language items C-enhancement Category: An issue proposing an enhancement or a PR with one. E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@lcnr
Copy link
Contributor

lcnr commented May 14, 2020

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.

@lcnr lcnr added the E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. label May 14, 2020
@jonas-schievink jonas-schievink added A-lang-item Area: Language items C-enhancement Category: An issue proposing an enhancement or a PR with one. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels May 14, 2020
@doctorn
Copy link
Contributor

doctorn commented May 14, 2020

Ah! This is my bad...

@doctorn
Copy link
Contributor

doctorn commented May 14, 2020

@rustbot claim

@rustbot rustbot self-assigned this May 14, 2020
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this issue May 15, 2020
Remove `lang_items\(\).*\.unwrap\(\)`

Follows up rust-lang#72170 to remove the remaining uses of `lang_items\(\).*\.unwrap\(\)` (avoids a bunch of potential ICEs when working in `#![no_core]`).

Resolves rust-lang#72195
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this issue May 15, 2020
Remove `lang_items\(\).*\.unwrap\(\)`

Follows up rust-lang#72170 to remove the remaining uses of `lang_items\(\).*\.unwrap\(\)` (avoids a bunch of potential ICEs when working in `#![no_core]`).

Resolves rust-lang#72195
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this issue May 15, 2020
Remove `lang_items\(\).*\.unwrap\(\)`

Follows up rust-lang#72170 to remove the remaining uses of `lang_items\(\).*\.unwrap\(\)` (avoids a bunch of potential ICEs when working in `#![no_core]`).

Resolves rust-lang#72195
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this issue May 15, 2020
Remove `lang_items\(\).*\.unwrap\(\)`

Follows up rust-lang#72170 to remove the remaining uses of `lang_items\(\).*\.unwrap\(\)` (avoids a bunch of potential ICEs when working in `#![no_core]`).

Resolves rust-lang#72195
@bors bors closed this as completed in 1be88e6 May 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lang-item Area: Language items C-enhancement Category: An issue proposing an enhancement or a PR with one. E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants