Rust: Prevent ICE on missing lang items.

Created on 14 May 2020  路  2Comments  路  Source: rust-lang/rust

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

https://github.com/rust-lang/rust/blob/7c34d8d6629506a596215886e5fc4bb2b04b00ae/src/librustc_typeck/check/mod.rs#L5301

This causes an internal compiler error in case the expected lang item is not defined,
for example when using #![no_core]. (see https://github.com/rust-lang/rust/issues/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 https://github.com/rust-lang/rust/pull/72170, which already did this in some places.


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


A-lang-item C-enhancement E-easy T-compiler

Most helpful comment

@rustbot claim

All 2 comments

Ah! This is my bad...

@rustbot claim

Was this page helpful?
0 / 5 - 0 ratings