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

Lang item #32264

Merged
merged 2 commits into from
Mar 22, 2016
Merged

Lang item #32264

merged 2 commits into from
Mar 22, 2016

Conversation

GuillaumeGomez
Copy link
Member

Fixes #32033

@rust-highfive
Copy link
Collaborator

r? @nikomatsakis

(rust_highfive has picked a reviewer for you, use r? to override)

let item_def_id = self.ast_map.local_def_id(item.id);
let span = self.ast_map.span_if_local(item_def_id).unwrap();
span_err!(self.session, span, E0522,
"creating new item lang is forbidden: `{}`.",
Copy link
Member

Choose a reason for hiding this comment

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

Why not just, uh, “definition of a unknown language item”?

Copy link
Member Author

Choose a reason for hiding this comment

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

Indeed, way better.

The lang attribute is intended for marking special items that are built-in to
Rust itself. This includes special traits (like `Copy` and `Sized`) that affect
how the compiler behaves, as well as special functions that may be automatically
invoked (such as the handker for out-of-bounds accesses when indexing a slice).
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: s/handker/handler/

@GuillaumeGomez
Copy link
Member Author

Updated.

@nikomatsakis
Copy link
Contributor

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Mar 21, 2016

📌 Commit b2fd882 has been approved by nikomatsakis

@bors
Copy link
Contributor

bors commented Mar 22, 2016

⌛ Testing commit b2fd882 with merge 2ae05d3...

bors added a commit that referenced this pull request Mar 22, 2016
@bors bors merged commit b2fd882 into rust-lang:master Mar 22, 2016
@GuillaumeGomez GuillaumeGomez deleted the lang_item branch March 22, 2016 13:30
hannobraun added a commit to hannobraun/embedded that referenced this pull request Mar 24, 2016
The Rust version is now at:
```
rustc 1.9.0-nightly (0dcc413e4 2016-03-22)
```

This includes a fix for the following build error that the new version
produced:
```
src/rust_base.rs:17:1: 19:2 error: definition of an unknown language
item: `stack_exhausted`. [E0522]
src/rust_base.rs:17 pub extern fn stack_exhausted() {
src/rust_base.rs:18     panic!("Stack exhausted");
src/rust_base.rs:19 }
src/rust_base.rs:17:1: 19:2 help: run `rustc --explain E0522` to see a
detailed explanation
```

It looks like the `stack_exhausted item was removed last year:
rust-lang/rust#27338

This didn't cause an error so far, because the compiler didn't complain
about defining lang items that don't exist. This seems to have changed
in this pull request:
rust-lang/rust#32264
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants