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

Remove deprecated lang items #44526

Merged
merged 5 commits into from
Sep 14, 2017

Conversation

leoyvens
Copy link
Contributor

@leoyvens leoyvens commented Sep 12, 2017

They have been deprecated for years and there is no trace left of them in the compiler. Also removed require_owned_box which is dead code and other small refactorings.

They have been deprecated for years and there is no trace left of them
in the compiler.
It's unused and unnecessary
Short and sweet

pub fn require_owned_box(&self) -> Result<DefId, String> {
self.require(OwnedBoxLangItem)
self.items[it as usize].ok_or(format!("requires `{}` lang_item", it.name()))
Copy link
Member

Choose a reason for hiding this comment

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

Please make this an ok_or_else since otherwise we allocate a String each name, and also go through a lookup table to get the name of the lang item, both of which are somewhat expensive operations to do for lang item lookup.

match Some(id) {
x if x == self.fn_trait() => Some(ty::ClosureKind::Fn),
x if x == self.fn_mut_trait() => Some(ty::ClosureKind::FnMut),
x if x == self.fn_once_trait() => Some(ty::ClosureKind::FnOnce),
Copy link
Member

Choose a reason for hiding this comment

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

nit: Extra space after the =>.

@Mark-Simulacrum
Copy link
Member

r? @nikomatsakis

@arielb1
Copy link
Contributor

arielb1 commented Sep 13, 2017

@bors r+

@bors
Copy link
Contributor

bors commented Sep 13, 2017

📌 Commit 9218e44 has been approved by arielb1

@aidanhs aidanhs added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Sep 13, 2017
@bors
Copy link
Contributor

bors commented Sep 14, 2017

⌛ Testing commit 9218e44 with merge 2b6bc58...

bors added a commit that referenced this pull request Sep 14, 2017
…ielb1

Remove deprecated lang items

They have been deprecated for years and there is no trace left of them in the compiler. Also removed `require_owned_box` which is dead code and other small refactorings.
@bors
Copy link
Contributor

bors commented Sep 14, 2017

☀️ Test successful - status-appveyor, status-travis
Approved by: arielb1
Pushing 2b6bc58 to master...

@bors bors merged commit 9218e44 into rust-lang:master Sep 14, 2017
@leoyvens leoyvens deleted the remove-deprecated-lang-items branch March 7, 2018 10:57
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.

6 participants