Skip to content

Commit

Permalink
auto merge of #9295 : alexcrichton/rust/fix-lang-items, r=thestinger
Browse files Browse the repository at this point in the history
Also add a test to help prevent this from getting out of sync again.
  • Loading branch information
bors committed Sep 19, 2013
2 parents 755f622 + 2f845a5 commit 85c0fb7
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 43 deletions.
85 changes: 42 additions & 43 deletions src/librustc/middle/lang_items.rs
Expand Up @@ -59,36 +59,36 @@ pub enum LangItem {

StrEqFnLangItem, // 19
UniqStrEqFnLangItem, // 20
FailFnLangItem, // 22
FailBoundsCheckFnLangItem, // 23
ExchangeMallocFnLangItem, // 24
ClosureExchangeMallocFnLangItem, // 25
ExchangeFreeFnLangItem, // 26
MallocFnLangItem, // 27
FreeFnLangItem, // 28
BorrowAsImmFnLangItem, // 29
BorrowAsMutFnLangItem, // 30
ReturnToMutFnLangItem, // 31
CheckNotBorrowedFnLangItem, // 32
StrDupUniqFnLangItem, // 33
RecordBorrowFnLangItem, // 34
UnrecordBorrowFnLangItem, // 35

StartFnLangItem, // 36

TyDescStructLangItem, // 37
TyVisitorTraitLangItem, // 38
OpaqueStructLangItem, // 39
FailFnLangItem, // 21
FailBoundsCheckFnLangItem, // 22
ExchangeMallocFnLangItem, // 23
ClosureExchangeMallocFnLangItem, // 24
ExchangeFreeFnLangItem, // 25
MallocFnLangItem, // 26
FreeFnLangItem, // 27
BorrowAsImmFnLangItem, // 28
BorrowAsMutFnLangItem, // 29
ReturnToMutFnLangItem, // 30
CheckNotBorrowedFnLangItem, // 31
StrDupUniqFnLangItem, // 32
RecordBorrowFnLangItem, // 33
UnrecordBorrowFnLangItem, // 34

StartFnLangItem, // 35

TyDescStructLangItem, // 36
TyVisitorTraitLangItem, // 37
OpaqueStructLangItem, // 38
}

pub struct LanguageItems {
items: [Option<DefId>, ..41]
items: [Option<DefId>, ..39]
}

impl LanguageItems {
pub fn new() -> LanguageItems {
LanguageItems {
items: [ None, ..41 ]
items: [ None, ..39 ]
}
}

Expand Down Expand Up @@ -122,27 +122,26 @@ impl LanguageItems {

19 => "str_eq",
20 => "uniq_str_eq",
21 => "log_type",
22 => "fail_",
23 => "fail_bounds_check",
24 => "exchange_malloc",
25 => "closure_exchange_malloc",
26 => "exchange_free",
27 => "malloc",
28 => "free",
29 => "borrow_as_imm",
30 => "borrow_as_mut",
31 => "return_to_mut",
32 => "check_not_borrowed",
33 => "strdup_uniq",
34 => "record_borrow",
35 => "unrecord_borrow",

36 => "start",

37 => "ty_desc",
38 => "ty_visitor",
39 => "opaque",
21 => "fail_",
22 => "fail_bounds_check",
23 => "exchange_malloc",
24 => "closure_exchange_malloc",
25 => "exchange_free",
26 => "malloc",
27 => "free",
28 => "borrow_as_imm",
29 => "borrow_as_mut",
30 => "return_to_mut",
31 => "check_not_borrowed",
32 => "strdup_uniq",
33 => "record_borrow",
34 => "unrecord_borrow",

35 => "start",

36 => "ty_desc",
37 => "ty_visitor",
38 => "opaque",

_ => "???"
}
Expand Down
15 changes: 15 additions & 0 deletions src/test/compile-fail/required-lang-item.rs
@@ -0,0 +1,15 @@
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#[no_std];

// error-pattern:requires `start` lang_item

fn main() {}

0 comments on commit 85c0fb7

Please sign in to comment.