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

use require_lang_item over unwrap. #72170

Merged
merged 2 commits into from
May 14, 2020
Merged

use require_lang_item over unwrap. #72170

merged 2 commits into from
May 14, 2020

Conversation

lcnr
Copy link
Contributor

@lcnr lcnr commented May 13, 2020

Does not yet replace all uses of lang_items\(\)\.*\.unwrap\(\), as there are more
than I expected 😅

Fixes #72099

r? @RalfJung

edit: The goal of this this PR is to change ICE from missing lang items to a fatal error.

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 13, 2020
@RalfJung
Copy link
Member

Could you also cover the one that the issue was reported about?

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

@lcnr
Copy link
Contributor Author

lcnr commented May 13, 2020

done

Copy link
Member

@RalfJung RalfJung left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This LGTM. However, this is code that I am not familiar with, so I'd prefer if someone else also took a look. Cc @oli-obk @matthewjasper

@oli-obk
Copy link
Contributor

oli-obk commented May 14, 2020

Oh, that's a very good idea. I wonder if we can make lang_items private at some point and just have sensible wrappers like require_lang_item.

But we can address this in future work. For now:

@bors r+

@bors
Copy link
Contributor

bors commented May 14, 2020

📌 Commit 9001a64 has been approved by oli-obk

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 14, 2020
@jonas-schievink
Copy link
Contributor

This looks like a good E-easy contribution, so maybe open an issue for the follow-up work here?

@lcnr
Copy link
Contributor Author

lcnr commented May 14, 2020

@jonas-schievink Opened #72195 for this, not
sure what other labels apply there.

bors added a commit to rust-lang-ci/rust that referenced this pull request May 14, 2020
Rollup of 8 pull requests

Successful merges:

 - rust-lang#71910 (Fix unused_parens false positive when using binary operations)
 - rust-lang#72087 (Fix hang in lexical_region_resolve)
 - rust-lang#72126 (Change `WorkProduct::saved_files` to an `Option`.)
 - rust-lang#72127 (add long error explanation for E0228)
 - rust-lang#72141 (Warn against thread::sleep in async fn)
 - rust-lang#72170 (use `require_lang_item` over `unwrap`.)
 - rust-lang#72191 (Clean up E0589 explanation)
 - rust-lang#72194 (Don't ICE on missing `Unsize` impl)

Failed merges:

r? @ghost
@bors bors merged commit 62f1840 into rust-lang:master May 14, 2020
@lcnr lcnr deleted the lang_item branch May 15, 2020 11:01
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request 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 pull request 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 pull request 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 pull request 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 pull request May 16, 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Internal compiler error due to failed typecheck (on no_core)
6 participants