Skip to content

Commit

Permalink
auto merge of #11965 : alexcrichton/rust/issue-7385, r=alexcrichton
Browse files Browse the repository at this point in the history
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
  • Loading branch information
bors committed Feb 1, 2014
2 parents cc6afe1 + a67a3b7 commit 5c5d995
Show file tree
Hide file tree
Showing 41 changed files with 305 additions and 181 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ fetch snapshots, and an OS that can execute the available snapshot binaries.

Snapshot binaries are currently built and tested on several platforms:

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

You may find that other platforms work, but these are our officially
supported build environments that are most likely to work.
Expand Down
6 changes: 3 additions & 3 deletions doc/tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@ from the Internet on our supported platforms.

Snapshot binaries are currently built and tested on several platforms:

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

You may find that other platforms work, but these are our "tier 1"
supported build environments that are most likely to work.
Expand Down
4 changes: 2 additions & 2 deletions src/libextra/hex.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
Expand Down Expand Up @@ -60,7 +60,7 @@ pub trait FromHex {
pub enum FromHexError {
/// The input contained a character not part of the hex format
InvalidHexCharacter(char, uint),
/// The input had a invalid length
/// The input had an invalid length
InvalidHexLength,
}

Expand Down
4 changes: 2 additions & 2 deletions src/libextra/num/bigint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1292,7 +1292,7 @@ impl ToStrRadix for BigInt {
}

impl FromStrRadix for BigInt {
/// Creates and initializes an BigInt.
/// Creates and initializes a BigInt.
#[inline]
fn from_str_radix(s: &str, radix: uint) -> Option<BigInt> {
BigInt::parse_bytes(s.as_bytes(), radix)
Expand Down Expand Up @@ -1385,7 +1385,7 @@ impl<R: Rng> RandBigInt for R {
}

impl BigInt {
/// Creates and initializes an BigInt.
/// Creates and initializes a BigInt.
#[inline]
pub fn new(sign: Sign, v: ~[BigDigit]) -> BigInt {
BigInt::from_biguint(sign, BigUint::new(v))
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/middle/kind.rs
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ pub fn check_durable(tcx: ty::ctxt, ty: ty::t, sp: Span) -> bool {
}
}

/// This is rather subtle. When we are casting a value to a instantiated
/// This is rather subtle. When we are casting a value to an instantiated
/// trait like `a as trait<'r>`, regionck already ensures that any references
/// that appear in the type of `a` are bounded by `'r` (ed.: rem
/// FIXME(#5723)). However, it is possible that there are *type parameters*
Expand Down Expand Up @@ -516,7 +516,7 @@ pub fn check_cast_for_escaping_regions(
target_ty: ty::t,
source_span: Span)
{
// Determine what type we are casting to; if it is not an trait, then no
// Determine what type we are casting to; if it is not a trait, then no
// worries.
match ty::get(target_ty).sty {
ty::ty_trait(..) => {}
Expand Down
165 changes: 76 additions & 89 deletions src/librustc/middle/lang_items.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,41 +33,28 @@ use std::hashmap::HashMap;
use std::iter::Enumerate;
use std::vec;


// Get the last "argument" (has to be done recursively to avoid phoney local ambiguity error)
macro_rules! last {
( $first:expr, $( $remainder:expr, )+ ) => ( last!( $( $remainder, )+ ) );
( $first:expr, ) => ( $first )
}

// The actual lang items defined come at the end of this file in one handy table.
// So you probably just want to nip down to the end.
macro_rules! lets_do_this {
// secondary rule to allow us to use `$num` as both an expression
// and a pattern.
(
$( $num:tt, $variant:ident, $name:expr, $method:ident; )*
) => {
lets_do_this!(count = 1 + last!($($num,)*),
$($num, $variant, $name, $method; )*)
};

(
count = $num_lang_items:expr, $( $num:pat, $variant:ident, $name:expr, $method:ident; )*
$( $variant:ident, $name:expr, $method:ident; )*
) => {

#[deriving(FromPrimitive)]
pub enum LangItem {
$($variant),*
}

pub struct LanguageItems {
items: [Option<ast::DefId>, ..$num_lang_items]
items: ~[Option<ast::DefId>],
}

impl LanguageItems {
pub fn new() -> LanguageItems {
fn foo(_: LangItem) -> Option<ast::DefId> { None }

LanguageItems {
items: [ None, ..$num_lang_items ]
items: ~[$(foo($variant)),*]
}
}

Expand All @@ -76,9 +63,10 @@ impl LanguageItems {
}

pub fn item_name(index: uint) -> &'static str {
match index {
$( $num => $name, )*
_ => "???"
let item: Option<LangItem> = FromPrimitive::from_uint(index);
match item {
$( Some($variant) => $name, )*
None => "???"
}
}

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

pub fn collect_language_items(crate: &ast::Crate,
session: Session)
-> LanguageItems {
session: Session) -> @LanguageItems {
let mut collector = LanguageItemCollector::new(session);
collector.collect(crate);
let LanguageItemCollector { items, .. } = collector;
session.abort_if_errors();
items
@items
}

// End of the macro
}
}

lets_do_this! {
// ID, Variant name, Name, Method name;
0, FreezeTraitLangItem, "freeze", freeze_trait;
1, SendTraitLangItem, "send", send_trait;
2, SizedTraitLangItem, "sized", sized_trait;
3, PodTraitLangItem, "pod", pod_trait;

4, DropTraitLangItem, "drop", drop_trait;

5, AddTraitLangItem, "add", add_trait;
6, SubTraitLangItem, "sub", sub_trait;
7, MulTraitLangItem, "mul", mul_trait;
8, DivTraitLangItem, "div", div_trait;
9, RemTraitLangItem, "rem", rem_trait;
10, NegTraitLangItem, "neg", neg_trait;
11, NotTraitLangItem, "not", not_trait;
12, BitXorTraitLangItem, "bitxor", bitxor_trait;
13, BitAndTraitLangItem, "bitand", bitand_trait;
14, BitOrTraitLangItem, "bitor", bitor_trait;
15, ShlTraitLangItem, "shl", shl_trait;
16, ShrTraitLangItem, "shr", shr_trait;
17, IndexTraitLangItem, "index", index_trait;

18, EqTraitLangItem, "eq", eq_trait;
19, OrdTraitLangItem, "ord", ord_trait;

20, StrEqFnLangItem, "str_eq", str_eq_fn;
21, UniqStrEqFnLangItem, "uniq_str_eq", uniq_str_eq_fn;
22, FailFnLangItem, "fail_", fail_fn;
23, FailBoundsCheckFnLangItem, "fail_bounds_check", fail_bounds_check_fn;
24, ExchangeMallocFnLangItem, "exchange_malloc", exchange_malloc_fn;
25, ClosureExchangeMallocFnLangItem, "closure_exchange_malloc", closure_exchange_malloc_fn;
26, ExchangeFreeFnLangItem, "exchange_free", exchange_free_fn;
27, MallocFnLangItem, "malloc", malloc_fn;
28, FreeFnLangItem, "free", free_fn;
29, StrDupUniqFnLangItem, "strdup_uniq", strdup_uniq_fn;

30, StartFnLangItem, "start", start_fn;

31, TyDescStructLangItem, "ty_desc", ty_desc;
32, TyVisitorTraitLangItem, "ty_visitor", ty_visitor;
33, OpaqueStructLangItem, "opaque", opaque;

34, EventLoopFactoryLangItem, "event_loop_factory", event_loop_factory;

35, TypeIdLangItem, "type_id", type_id;

36, EhPersonalityLangItem, "eh_personality", eh_personality_fn;

37, ManagedHeapLangItem, "managed_heap", managed_heap;
38, ExchangeHeapLangItem, "exchange_heap", exchange_heap;
39, GcLangItem, "gc", gc;

40, CovariantTypeItem, "covariant_type", covariant_type;
41, ContravariantTypeItem, "contravariant_type", contravariant_type;
42, InvariantTypeItem, "invariant_type", invariant_type;

43, CovariantLifetimeItem, "covariant_lifetime", covariant_lifetime;
44, ContravariantLifetimeItem, "contravariant_lifetime", contravariant_lifetime;
45, InvariantLifetimeItem, "invariant_lifetime", invariant_lifetime;

46, NoFreezeItem, "no_freeze_bound", no_freeze_bound;
47, NoSendItem, "no_send_bound", no_send_bound;
48, NoPodItem, "no_pod_bound", no_pod_bound;
49, ManagedItem, "managed_bound", managed_bound;
// Variant name, Name, Method name;
FreezeTraitLangItem, "freeze", freeze_trait;
SendTraitLangItem, "send", send_trait;
SizedTraitLangItem, "sized", sized_trait;
PodTraitLangItem, "pod", pod_trait;

DropTraitLangItem, "drop", drop_trait;

AddTraitLangItem, "add", add_trait;
SubTraitLangItem, "sub", sub_trait;
MulTraitLangItem, "mul", mul_trait;
DivTraitLangItem, "div", div_trait;
RemTraitLangItem, "rem", rem_trait;
NegTraitLangItem, "neg", neg_trait;
NotTraitLangItem, "not", not_trait;
BitXorTraitLangItem, "bitxor", bitxor_trait;
BitAndTraitLangItem, "bitand", bitand_trait;
BitOrTraitLangItem, "bitor", bitor_trait;
ShlTraitLangItem, "shl", shl_trait;
ShrTraitLangItem, "shr", shr_trait;
IndexTraitLangItem, "index", index_trait;

EqTraitLangItem, "eq", eq_trait;
OrdTraitLangItem, "ord", ord_trait;

StrEqFnLangItem, "str_eq", str_eq_fn;
UniqStrEqFnLangItem, "uniq_str_eq", uniq_str_eq_fn;
FailFnLangItem, "fail_", fail_fn;
FailBoundsCheckFnLangItem, "fail_bounds_check", fail_bounds_check_fn;
ExchangeMallocFnLangItem, "exchange_malloc", exchange_malloc_fn;
ClosureExchangeMallocFnLangItem, "closure_exchange_malloc", closure_exchange_malloc_fn;
ExchangeFreeFnLangItem, "exchange_free", exchange_free_fn;
MallocFnLangItem, "malloc", malloc_fn;
FreeFnLangItem, "free", free_fn;
StrDupUniqFnLangItem, "strdup_uniq", strdup_uniq_fn;

StartFnLangItem, "start", start_fn;

TyDescStructLangItem, "ty_desc", ty_desc;
TyVisitorTraitLangItem, "ty_visitor", ty_visitor;
OpaqueStructLangItem, "opaque", opaque;

EventLoopFactoryLangItem, "event_loop_factory", event_loop_factory;

TypeIdLangItem, "type_id", type_id;

EhPersonalityLangItem, "eh_personality", eh_personality_fn;

ManagedHeapLangItem, "managed_heap", managed_heap;
ExchangeHeapLangItem, "exchange_heap", exchange_heap;
GcLangItem, "gc", gc;

CovariantTypeItem, "covariant_type", covariant_type;
ContravariantTypeItem, "contravariant_type", contravariant_type;
InvariantTypeItem, "invariant_type", invariant_type;

CovariantLifetimeItem, "covariant_lifetime", covariant_lifetime;
ContravariantLifetimeItem, "contravariant_lifetime", contravariant_lifetime;
InvariantLifetimeItem, "invariant_lifetime", invariant_lifetime;

NoFreezeItem, "no_freeze_bound", no_freeze_bound;
NoSendItem, "no_send_bound", no_send_bound;
NoPodItem, "no_pod_bound", no_pod_bound;
ManagedItem, "managed_bound", managed_bound;
}
2 changes: 1 addition & 1 deletion src/librustc/middle/lint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ static lint_table: &'static [(&'static str, LintSpec)] = &[
("unused_must_use",
LintSpec {
lint: UnusedMustUse,
desc: "unused result of an type flagged as #[must_use]",
desc: "unused result of a type flagged as #[must_use]",
default: warn,
}),

Expand Down
6 changes: 3 additions & 3 deletions src/librustc/middle/resolve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -765,7 +765,7 @@ fn namespace_error_to_str(ns: NamespaceError) -> &'static str {
}

fn Resolver(session: Session,
lang_items: LanguageItems,
lang_items: @LanguageItems,
crate_span: Span) -> Resolver {
let graph_root = @NameBindings();

Expand Down Expand Up @@ -823,7 +823,7 @@ fn Resolver(session: Session,
/// The main resolver class.
struct Resolver {
session: @Session,
lang_items: LanguageItems,
lang_items: @LanguageItems,

intr: @IdentInterner,

Expand Down Expand Up @@ -5550,7 +5550,7 @@ pub struct CrateMap {

/// Entry point to crate resolution.
pub fn resolve_crate(session: Session,
lang_items: LanguageItems,
lang_items: @LanguageItems,
crate: &Crate)
-> CrateMap {
let mut resolver = Resolver(session, lang_items, crate.span);
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/middle/trans/_match.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
Expand Down Expand Up @@ -244,7 +244,7 @@ pub enum VecLenOpt {
vec_len_ge(/* length of prefix */uint)
}

// An option identifying a branch (either a literal, a enum variant or a
// An option identifying a branch (either a literal, an enum variant or a
// range)
enum Opt {
lit(Lit),
Expand Down
8 changes: 4 additions & 4 deletions src/librustc/middle/ty.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
Expand Down Expand Up @@ -299,7 +299,7 @@ pub struct ctxt_ {
ty_param_defs: RefCell<HashMap<ast::NodeId, TypeParameterDef>>,
adjustments: RefCell<HashMap<ast::NodeId, @AutoAdjustment>>,
normalized_cache: RefCell<HashMap<t, t>>,
lang_items: middle::lang_items::LanguageItems,
lang_items: @middle::lang_items::LanguageItems,
// A mapping of fake provided method def_ids to the default implementation
provided_method_sources: RefCell<HashMap<ast::DefId, ast::DefId>>,
supertraits: RefCell<HashMap<ast::DefId, @~[@TraitRef]>>,
Expand Down Expand Up @@ -947,7 +947,7 @@ pub fn mk_ctxt(s: session::Session,
amap: ast_map::Map,
freevars: freevars::freevar_map,
region_maps: middle::region::RegionMaps,
lang_items: middle::lang_items::LanguageItems)
lang_items: @middle::lang_items::LanguageItems)
-> ctxt {
@ctxt_ {
named_region_map: named_region_map,
Expand Down Expand Up @@ -2591,7 +2591,7 @@ pub fn type_is_sized(cx: ctxt, ty: ty::t) -> bool {
}
}

// Whether a type is enum like, that is a enum type with only nullary
// Whether a type is enum like, that is an enum type with only nullary
// constructors
pub fn type_is_c_like_enum(cx: ctxt, ty: t) -> bool {
match get(ty).sty {
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/middle/typeck/astconv.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
Expand Down Expand Up @@ -385,7 +385,7 @@ pub fn ast_ty_to_ty<AC:AstConv, RS:RegionScope>(
}

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

0 comments on commit 5c5d995

Please sign in to comment.