Skip to content

Commit 30d4004

Browse files
---
yaml --- r: 271381 b: refs/heads/auto c: b2fd882 h: refs/heads/master i: 271379: e22db37
1 parent ed73057 commit 30d4004

File tree

3 files changed

+20
-5
lines changed

3 files changed

+20
-5
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
88
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
99
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1010
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
11-
refs/heads/auto: a2e4ab2ab276bbfbcd165b106da4159f68aff6e3
11+
refs/heads/auto: b2fd882972ff78a65356f489990c832dcefc9b58
1212
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
1313
refs/tags/0.1: b19db808c2793fe2976759b85a355c3ad8c8b336
1414
refs/tags/0.2: 1754d02027f2924bed83b0160ee340c7f41d5ea1

branches/auto/src/librustc/diagnostics.rs

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1962,6 +1962,23 @@ each method; it is not possible to annotate the entire impl with an `#[inline]`
19621962
attribute.
19631963
"##,
19641964

1965+
E0522: r##"
1966+
The lang attribute is intended for marking special items that are built-in to
1967+
Rust itself. This includes special traits (like `Copy` and `Sized`) that affect
1968+
how the compiler behaves, as well as special functions that may be automatically
1969+
invoked (such as the handler for out-of-bounds accesses when indexing a slice).
1970+
Erroneous code example:
1971+
1972+
```compile_fail
1973+
#![feature(lang_items)]
1974+
1975+
#[lang = "cookie"]
1976+
fn cookie() -> ! { // error: definition of an unknown language item: `cookie`
1977+
loop {}
1978+
}
1979+
```
1980+
"##,
1981+
19651982
}
19661983

19671984

@@ -2007,5 +2024,4 @@ register_diagnostics! {
20072024
E0490, // a value of type `..` is borrowed for too long
20082025
E0491, // in type `..`, reference has a longer lifetime than the data it...
20092026
E0495, // cannot infer an appropriate lifetime due to conflicting requirements
2010-
E0522, // creating new item lang is forbidden
20112027
}

branches/auto/src/librustc/middle/lang_items.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,10 +159,9 @@ impl<'a, 'v, 'tcx> Visitor<'v> for LanguageItemCollector<'a, 'tcx> {
159159
if let Some(item_index) = item_index {
160160
self.collect_item(item_index, self.ast_map.local_def_id(item.id))
161161
} else {
162-
let item_def_id = self.ast_map.local_def_id(item.id);
163-
let span = self.ast_map.span_if_local(item_def_id).unwrap();
162+
let span = self.ast_map.span(item.id);
164163
span_err!(self.session, span, E0522,
165-
"creating new item lang is forbidden: `{}`.",
164+
"definition of an unknown language item: `{}`.",
166165
&value[..]);
167166
}
168167
}

0 commit comments

Comments
 (0)