Skip to content

Commit 5c5d995

Browse files
committed
auto merge of #11965 : alexcrichton/rust/issue-7385, r=alexcrichton
I've verified that it works on osx x86_64 Closes #7385 Rolled up PRs: Closes #11898 Closes #11934 Closes #11942 Closes #11952 Closes #11960 Closes #11966 Closes #11953 Closed issues: Closes #4063 Closes #7911
2 parents cc6afe1 + a67a3b7 commit 5c5d995

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+305
-181
lines changed

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,9 @@ fetch snapshots, and an OS that can execute the available snapshot binaries.
7171

7272
Snapshot binaries are currently built and tested on several platforms:
7373

74-
* Windows (7, Server 2008 R2), x86 only
75-
* Linux (various distributions), x86 and x86-64
76-
* OSX 10.6 ("Snow Leopard") or greater, x86 and x86-64
74+
* Windows (7, 8, Server 2008 R2), x86 only
75+
* Linux (2.6.18 or later, various distributions), x86 and x86-64
76+
* OSX 10.7 (Lion) or greater, x86 and x86-64
7777

7878
You may find that other platforms work, but these are our officially
7979
supported build environments that are most likely to work.

doc/tutorial.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,9 @@ from the Internet on our supported platforms.
7272

7373
Snapshot binaries are currently built and tested on several platforms:
7474

75-
* Windows (7, Server 2008 R2), x86 only
76-
* Linux (various distributions), x86 and x86-64
77-
* OSX 10.6 ("Snow Leopard") or greater, x86 and x86-64
75+
* Windows (7, 8, Server 2008 R2), x86 only
76+
* Linux (2.6.18 or later, various distributions), x86 and x86-64
77+
* OSX 10.7 (Lion) or greater, x86 and x86-64
7878

7979
You may find that other platforms work, but these are our "tier 1"
8080
supported build environments that are most likely to work.

src/libextra/hex.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
22
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//
@@ -60,7 +60,7 @@ pub trait FromHex {
6060
pub enum FromHexError {
6161
/// The input contained a character not part of the hex format
6262
InvalidHexCharacter(char, uint),
63-
/// The input had a invalid length
63+
/// The input had an invalid length
6464
InvalidHexLength,
6565
}
6666

src/libextra/num/bigint.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1292,7 +1292,7 @@ impl ToStrRadix for BigInt {
12921292
}
12931293
12941294
impl FromStrRadix for BigInt {
1295-
/// Creates and initializes an BigInt.
1295+
/// Creates and initializes a BigInt.
12961296
#[inline]
12971297
fn from_str_radix(s: &str, radix: uint) -> Option<BigInt> {
12981298
BigInt::parse_bytes(s.as_bytes(), radix)
@@ -1385,7 +1385,7 @@ impl<R: Rng> RandBigInt for R {
13851385
}
13861386
13871387
impl BigInt {
1388-
/// Creates and initializes an BigInt.
1388+
/// Creates and initializes a BigInt.
13891389
#[inline]
13901390
pub fn new(sign: Sign, v: ~[BigDigit]) -> BigInt {
13911391
BigInt::from_biguint(sign, BigUint::new(v))

src/librustc/middle/kind.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,7 @@ pub fn check_durable(tcx: ty::ctxt, ty: ty::t, sp: Span) -> bool {
485485
}
486486
}
487487

488-
/// This is rather subtle. When we are casting a value to a instantiated
488+
/// This is rather subtle. When we are casting a value to an instantiated
489489
/// trait like `a as trait<'r>`, regionck already ensures that any references
490490
/// that appear in the type of `a` are bounded by `'r` (ed.: rem
491491
/// FIXME(#5723)). However, it is possible that there are *type parameters*
@@ -516,7 +516,7 @@ pub fn check_cast_for_escaping_regions(
516516
target_ty: ty::t,
517517
source_span: Span)
518518
{
519-
// Determine what type we are casting to; if it is not an trait, then no
519+
// Determine what type we are casting to; if it is not a trait, then no
520520
// worries.
521521
match ty::get(target_ty).sty {
522522
ty::ty_trait(..) => {}

src/librustc/middle/lang_items.rs

+76-89
Original file line numberDiff line numberDiff line change
@@ -33,41 +33,28 @@ use std::hashmap::HashMap;
3333
use std::iter::Enumerate;
3434
use std::vec;
3535

36-
37-
// Get the last "argument" (has to be done recursively to avoid phoney local ambiguity error)
38-
macro_rules! last {
39-
( $first:expr, $( $remainder:expr, )+ ) => ( last!( $( $remainder, )+ ) );
40-
( $first:expr, ) => ( $first )
41-
}
42-
4336
// The actual lang items defined come at the end of this file in one handy table.
4437
// So you probably just want to nip down to the end.
4538
macro_rules! lets_do_this {
46-
// secondary rule to allow us to use `$num` as both an expression
47-
// and a pattern.
4839
(
49-
$( $num:tt, $variant:ident, $name:expr, $method:ident; )*
50-
) => {
51-
lets_do_this!(count = 1 + last!($($num,)*),
52-
$($num, $variant, $name, $method; )*)
53-
};
54-
55-
(
56-
count = $num_lang_items:expr, $( $num:pat, $variant:ident, $name:expr, $method:ident; )*
40+
$( $variant:ident, $name:expr, $method:ident; )*
5741
) => {
5842

43+
#[deriving(FromPrimitive)]
5944
pub enum LangItem {
6045
$($variant),*
6146
}
6247

6348
pub struct LanguageItems {
64-
items: [Option<ast::DefId>, ..$num_lang_items]
49+
items: ~[Option<ast::DefId>],
6550
}
6651

6752
impl LanguageItems {
6853
pub fn new() -> LanguageItems {
54+
fn foo(_: LangItem) -> Option<ast::DefId> { None }
55+
6956
LanguageItems {
70-
items: [ None, ..$num_lang_items ]
57+
items: ~[$(foo($variant)),*]
7158
}
7259
}
7360

@@ -76,9 +63,10 @@ impl LanguageItems {
7663
}
7764

7865
pub fn item_name(index: uint) -> &'static str {
79-
match index {
80-
$( $num => $name, )*
81-
_ => "???"
66+
let item: Option<LangItem> = FromPrimitive::from_uint(index);
67+
match item {
68+
$( Some($variant) => $name, )*
69+
None => "???"
8270
}
8371
}
8472

@@ -208,82 +196,81 @@ pub fn extract(attrs: &[ast::Attribute]) -> Option<@str> {
208196
}
209197

210198
pub fn collect_language_items(crate: &ast::Crate,
211-
session: Session)
212-
-> LanguageItems {
199+
session: Session) -> @LanguageItems {
213200
let mut collector = LanguageItemCollector::new(session);
214201
collector.collect(crate);
215202
let LanguageItemCollector { items, .. } = collector;
216203
session.abort_if_errors();
217-
items
204+
@items
218205
}
219206

220207
// End of the macro
221208
}
222209
}
223210

224211
lets_do_this! {
225-
// ID, Variant name, Name, Method name;
226-
0, FreezeTraitLangItem, "freeze", freeze_trait;
227-
1, SendTraitLangItem, "send", send_trait;
228-
2, SizedTraitLangItem, "sized", sized_trait;
229-
3, PodTraitLangItem, "pod", pod_trait;
230-
231-
4, DropTraitLangItem, "drop", drop_trait;
232-
233-
5, AddTraitLangItem, "add", add_trait;
234-
6, SubTraitLangItem, "sub", sub_trait;
235-
7, MulTraitLangItem, "mul", mul_trait;
236-
8, DivTraitLangItem, "div", div_trait;
237-
9, RemTraitLangItem, "rem", rem_trait;
238-
10, NegTraitLangItem, "neg", neg_trait;
239-
11, NotTraitLangItem, "not", not_trait;
240-
12, BitXorTraitLangItem, "bitxor", bitxor_trait;
241-
13, BitAndTraitLangItem, "bitand", bitand_trait;
242-
14, BitOrTraitLangItem, "bitor", bitor_trait;
243-
15, ShlTraitLangItem, "shl", shl_trait;
244-
16, ShrTraitLangItem, "shr", shr_trait;
245-
17, IndexTraitLangItem, "index", index_trait;
246-
247-
18, EqTraitLangItem, "eq", eq_trait;
248-
19, OrdTraitLangItem, "ord", ord_trait;
249-
250-
20, StrEqFnLangItem, "str_eq", str_eq_fn;
251-
21, UniqStrEqFnLangItem, "uniq_str_eq", uniq_str_eq_fn;
252-
22, FailFnLangItem, "fail_", fail_fn;
253-
23, FailBoundsCheckFnLangItem, "fail_bounds_check", fail_bounds_check_fn;
254-
24, ExchangeMallocFnLangItem, "exchange_malloc", exchange_malloc_fn;
255-
25, ClosureExchangeMallocFnLangItem, "closure_exchange_malloc", closure_exchange_malloc_fn;
256-
26, ExchangeFreeFnLangItem, "exchange_free", exchange_free_fn;
257-
27, MallocFnLangItem, "malloc", malloc_fn;
258-
28, FreeFnLangItem, "free", free_fn;
259-
29, StrDupUniqFnLangItem, "strdup_uniq", strdup_uniq_fn;
260-
261-
30, StartFnLangItem, "start", start_fn;
262-
263-
31, TyDescStructLangItem, "ty_desc", ty_desc;
264-
32, TyVisitorTraitLangItem, "ty_visitor", ty_visitor;
265-
33, OpaqueStructLangItem, "opaque", opaque;
266-
267-
34, EventLoopFactoryLangItem, "event_loop_factory", event_loop_factory;
268-
269-
35, TypeIdLangItem, "type_id", type_id;
270-
271-
36, EhPersonalityLangItem, "eh_personality", eh_personality_fn;
272-
273-
37, ManagedHeapLangItem, "managed_heap", managed_heap;
274-
38, ExchangeHeapLangItem, "exchange_heap", exchange_heap;
275-
39, GcLangItem, "gc", gc;
276-
277-
40, CovariantTypeItem, "covariant_type", covariant_type;
278-
41, ContravariantTypeItem, "contravariant_type", contravariant_type;
279-
42, InvariantTypeItem, "invariant_type", invariant_type;
280-
281-
43, CovariantLifetimeItem, "covariant_lifetime", covariant_lifetime;
282-
44, ContravariantLifetimeItem, "contravariant_lifetime", contravariant_lifetime;
283-
45, InvariantLifetimeItem, "invariant_lifetime", invariant_lifetime;
284-
285-
46, NoFreezeItem, "no_freeze_bound", no_freeze_bound;
286-
47, NoSendItem, "no_send_bound", no_send_bound;
287-
48, NoPodItem, "no_pod_bound", no_pod_bound;
288-
49, ManagedItem, "managed_bound", managed_bound;
212+
// Variant name, Name, Method name;
213+
FreezeTraitLangItem, "freeze", freeze_trait;
214+
SendTraitLangItem, "send", send_trait;
215+
SizedTraitLangItem, "sized", sized_trait;
216+
PodTraitLangItem, "pod", pod_trait;
217+
218+
DropTraitLangItem, "drop", drop_trait;
219+
220+
AddTraitLangItem, "add", add_trait;
221+
SubTraitLangItem, "sub", sub_trait;
222+
MulTraitLangItem, "mul", mul_trait;
223+
DivTraitLangItem, "div", div_trait;
224+
RemTraitLangItem, "rem", rem_trait;
225+
NegTraitLangItem, "neg", neg_trait;
226+
NotTraitLangItem, "not", not_trait;
227+
BitXorTraitLangItem, "bitxor", bitxor_trait;
228+
BitAndTraitLangItem, "bitand", bitand_trait;
229+
BitOrTraitLangItem, "bitor", bitor_trait;
230+
ShlTraitLangItem, "shl", shl_trait;
231+
ShrTraitLangItem, "shr", shr_trait;
232+
IndexTraitLangItem, "index", index_trait;
233+
234+
EqTraitLangItem, "eq", eq_trait;
235+
OrdTraitLangItem, "ord", ord_trait;
236+
237+
StrEqFnLangItem, "str_eq", str_eq_fn;
238+
UniqStrEqFnLangItem, "uniq_str_eq", uniq_str_eq_fn;
239+
FailFnLangItem, "fail_", fail_fn;
240+
FailBoundsCheckFnLangItem, "fail_bounds_check", fail_bounds_check_fn;
241+
ExchangeMallocFnLangItem, "exchange_malloc", exchange_malloc_fn;
242+
ClosureExchangeMallocFnLangItem, "closure_exchange_malloc", closure_exchange_malloc_fn;
243+
ExchangeFreeFnLangItem, "exchange_free", exchange_free_fn;
244+
MallocFnLangItem, "malloc", malloc_fn;
245+
FreeFnLangItem, "free", free_fn;
246+
StrDupUniqFnLangItem, "strdup_uniq", strdup_uniq_fn;
247+
248+
StartFnLangItem, "start", start_fn;
249+
250+
TyDescStructLangItem, "ty_desc", ty_desc;
251+
TyVisitorTraitLangItem, "ty_visitor", ty_visitor;
252+
OpaqueStructLangItem, "opaque", opaque;
253+
254+
EventLoopFactoryLangItem, "event_loop_factory", event_loop_factory;
255+
256+
TypeIdLangItem, "type_id", type_id;
257+
258+
EhPersonalityLangItem, "eh_personality", eh_personality_fn;
259+
260+
ManagedHeapLangItem, "managed_heap", managed_heap;
261+
ExchangeHeapLangItem, "exchange_heap", exchange_heap;
262+
GcLangItem, "gc", gc;
263+
264+
CovariantTypeItem, "covariant_type", covariant_type;
265+
ContravariantTypeItem, "contravariant_type", contravariant_type;
266+
InvariantTypeItem, "invariant_type", invariant_type;
267+
268+
CovariantLifetimeItem, "covariant_lifetime", covariant_lifetime;
269+
ContravariantLifetimeItem, "contravariant_lifetime", contravariant_lifetime;
270+
InvariantLifetimeItem, "invariant_lifetime", invariant_lifetime;
271+
272+
NoFreezeItem, "no_freeze_bound", no_freeze_bound;
273+
NoSendItem, "no_send_bound", no_send_bound;
274+
NoPodItem, "no_pod_bound", no_pod_bound;
275+
ManagedItem, "managed_bound", managed_bound;
289276
}

src/librustc/middle/lint.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ static lint_table: &'static [(&'static str, LintSpec)] = &[
371371
("unused_must_use",
372372
LintSpec {
373373
lint: UnusedMustUse,
374-
desc: "unused result of an type flagged as #[must_use]",
374+
desc: "unused result of a type flagged as #[must_use]",
375375
default: warn,
376376
}),
377377

src/librustc/middle/resolve.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -765,7 +765,7 @@ fn namespace_error_to_str(ns: NamespaceError) -> &'static str {
765765
}
766766

767767
fn Resolver(session: Session,
768-
lang_items: LanguageItems,
768+
lang_items: @LanguageItems,
769769
crate_span: Span) -> Resolver {
770770
let graph_root = @NameBindings();
771771

@@ -823,7 +823,7 @@ fn Resolver(session: Session,
823823
/// The main resolver class.
824824
struct Resolver {
825825
session: @Session,
826-
lang_items: LanguageItems,
826+
lang_items: @LanguageItems,
827827

828828
intr: @IdentInterner,
829829

@@ -5550,7 +5550,7 @@ pub struct CrateMap {
55505550

55515551
/// Entry point to crate resolution.
55525552
pub fn resolve_crate(session: Session,
5553-
lang_items: LanguageItems,
5553+
lang_items: @LanguageItems,
55545554
crate: &Crate)
55555555
-> CrateMap {
55565556
let mut resolver = Resolver(session, lang_items, crate.span);

src/librustc/middle/trans/_match.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
22
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//
@@ -244,7 +244,7 @@ pub enum VecLenOpt {
244244
vec_len_ge(/* length of prefix */uint)
245245
}
246246

247-
// An option identifying a branch (either a literal, a enum variant or a
247+
// An option identifying a branch (either a literal, an enum variant or a
248248
// range)
249249
enum Opt {
250250
lit(Lit),

src/librustc/middle/ty.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
22
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//
@@ -299,7 +299,7 @@ pub struct ctxt_ {
299299
ty_param_defs: RefCell<HashMap<ast::NodeId, TypeParameterDef>>,
300300
adjustments: RefCell<HashMap<ast::NodeId, @AutoAdjustment>>,
301301
normalized_cache: RefCell<HashMap<t, t>>,
302-
lang_items: middle::lang_items::LanguageItems,
302+
lang_items: @middle::lang_items::LanguageItems,
303303
// A mapping of fake provided method def_ids to the default implementation
304304
provided_method_sources: RefCell<HashMap<ast::DefId, ast::DefId>>,
305305
supertraits: RefCell<HashMap<ast::DefId, @~[@TraitRef]>>,
@@ -947,7 +947,7 @@ pub fn mk_ctxt(s: session::Session,
947947
amap: ast_map::Map,
948948
freevars: freevars::freevar_map,
949949
region_maps: middle::region::RegionMaps,
950-
lang_items: middle::lang_items::LanguageItems)
950+
lang_items: @middle::lang_items::LanguageItems)
951951
-> ctxt {
952952
@ctxt_ {
953953
named_region_map: named_region_map,
@@ -2591,7 +2591,7 @@ pub fn type_is_sized(cx: ctxt, ty: ty::t) -> bool {
25912591
}
25922592
}
25932593

2594-
// Whether a type is enum like, that is a enum type with only nullary
2594+
// Whether a type is enum like, that is an enum type with only nullary
25952595
// constructors
25962596
pub fn type_is_c_like_enum(cx: ctxt, ty: t) -> bool {
25972597
match get(ty).sty {

src/librustc/middle/typeck/astconv.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
22
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//
@@ -385,7 +385,7 @@ pub fn ast_ty_to_ty<AC:AstConv, RS:RegionScope>(
385385
}
386386

387387
// Handle @, ~, and & being able to mean strs and vecs.
388-
// If a_seq_ty is a str or a vec, make it an str/vec.
388+
// If a_seq_ty is a str or a vec, make it a str/vec.
389389
// Also handle first-class trait types.
390390
fn mk_pointer<AC:AstConv,
391391
RS:RegionScope>(

0 commit comments

Comments
 (0)