From 2c8b1125804b5666d0cc0139c205a6aa0be95eaa Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Fri, 31 Jan 2014 16:54:45 -0800 Subject: [PATCH 01/12] Un-xfail test for 7385 I've verified that it works on osx x86_64 Closes #7385 --- src/test/run-pass/const-vec-of-fns.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/test/run-pass/const-vec-of-fns.rs b/src/test/run-pass/const-vec-of-fns.rs index fa6633121c840..45ba9f1cab5e3 100644 --- a/src/test/run-pass/const-vec-of-fns.rs +++ b/src/test/run-pass/const-vec-of-fns.rs @@ -8,9 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// xfail-test -// FIXME: #7385: hits a codegen bug on OS X x86_64 - /*! * Try to double-check that static fns have the right size (with or * without dummy env ptr, as appropriate) by iterating a size-2 array. @@ -25,5 +22,8 @@ static closures: &'static [S<'static>] = &[S(f), S(f)]; pub fn main() { for &bare_fn in bare_fns.iter() { bare_fn() } - for &closure in closures.iter() { (*closure)() } + for closure in closures.iter() { + let S(ref closure) = *closure; + (*closure)() + } } From b9a026afba1513ab7847dcb19446463895b6cd3e Mon Sep 17 00:00:00 2001 From: Virgile Andreani Date: Thu, 30 Jan 2014 19:29:35 +0100 Subject: [PATCH 02/12] Fix minor doc typos --- src/libextra/hex.rs | 4 ++-- src/libextra/num/bigint.rs | 4 ++-- src/librustc/middle/kind.rs | 4 ++-- src/librustc/middle/lint.rs | 2 +- src/librustc/middle/trans/_match.rs | 4 ++-- src/librustc/middle/ty.rs | 4 ++-- src/librustc/middle/typeck/astconv.rs | 4 ++-- src/librustc/middle/typeck/check/mod.rs | 4 ++-- src/librustc/middle/typeck/collect.rs | 4 ++-- src/librustc/util/sha2.rs | 4 ++-- src/librustdoc/html/render.rs | 4 ++-- src/libstd/any.rs | 4 ++-- src/libstd/ascii.rs | 10 +++++----- src/libstd/io/mod.rs | 2 +- src/libstd/iter.rs | 2 +- src/libstd/num/f32.rs | 8 ++++---- src/libstd/num/f64.rs | 8 ++++---- src/libstd/num/strconv.rs | 4 ++-- src/libstd/option.rs | 2 +- src/libstd/result.rs | 4 ++-- src/libstd/send_str.rs | 4 ++-- src/libstd/str.rs | 4 ++-- src/libstd/vec.rs | 2 +- src/libsyntax/ast.rs | 4 ++-- src/libsyntax/ext/deriving/generic.rs | 4 ++-- src/test/compile-fail/borrowck-anon-fields-struct.rs | 2 +- src/test/run-pass/expr-match-fail-all.rs | 4 ++-- 27 files changed, 55 insertions(+), 55 deletions(-) diff --git a/src/libextra/hex.rs b/src/libextra/hex.rs index 343d6aac437a0..4fd59bb3aa503 100644 --- a/src/libextra/hex.rs +++ b/src/libextra/hex.rs @@ -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. // @@ -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, } diff --git a/src/libextra/num/bigint.rs b/src/libextra/num/bigint.rs index 6dfe036d207b9..c1959843d598b 100644 --- a/src/libextra/num/bigint.rs +++ b/src/libextra/num/bigint.rs @@ -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::parse_bytes(s.as_bytes(), radix) @@ -1385,7 +1385,7 @@ impl 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)) diff --git a/src/librustc/middle/kind.rs b/src/librustc/middle/kind.rs index 880074256c02b..c05ca3e876950 100644 --- a/src/librustc/middle/kind.rs +++ b/src/librustc/middle/kind.rs @@ -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* @@ -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(..) => {} diff --git a/src/librustc/middle/lint.rs b/src/librustc/middle/lint.rs index 825509d539ed2..7cb549d91a8a1 100644 --- a/src/librustc/middle/lint.rs +++ b/src/librustc/middle/lint.rs @@ -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, }), diff --git a/src/librustc/middle/trans/_match.rs b/src/librustc/middle/trans/_match.rs index 2fabc44d0e4b2..7bc37d4e69512 100644 --- a/src/librustc/middle/trans/_match.rs +++ b/src/librustc/middle/trans/_match.rs @@ -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. // @@ -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), diff --git a/src/librustc/middle/ty.rs b/src/librustc/middle/ty.rs index f26d94327941d..317df481335cc 100644 --- a/src/librustc/middle/ty.rs +++ b/src/librustc/middle/ty.rs @@ -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. // @@ -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 { diff --git a/src/librustc/middle/typeck/astconv.rs b/src/librustc/middle/typeck/astconv.rs index 565ff4a734585..9f44aa1a0237e 100644 --- a/src/librustc/middle/typeck/astconv.rs +++ b/src/librustc/middle/typeck/astconv.rs @@ -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. // @@ -385,7 +385,7 @@ pub fn ast_ty_to_ty( } // 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( diff --git a/src/librustc/middle/typeck/check/mod.rs b/src/librustc/middle/typeck/check/mod.rs index 31dc0063ad606..7e8fa4e66713c 100644 --- a/src/librustc/middle/typeck/check/mod.rs +++ b/src/librustc/middle/typeck/check/mod.rs @@ -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. // @@ -2008,7 +2008,7 @@ pub fn check_expr_with_unifier(fcx: @FnCtxt, } } - // could be either a expr_binop or an expr_assign_binop + // could be either an expr_binop or an expr_assign_binop fn check_binop(fcx: @FnCtxt, callee_id: ast::NodeId, expr: &ast::Expr, diff --git a/src/librustc/middle/typeck/collect.rs b/src/librustc/middle/typeck/collect.rs index 1077454039def..d9a9d9f8fe123 100644 --- a/src/librustc/middle/typeck/collect.rs +++ b/src/librustc/middle/typeck/collect.rs @@ -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. // @@ -737,7 +737,7 @@ pub fn instantiate_trait_ref(ccx: &CrateCtxt, /*! * Instantiates the path for the given trait reference, assuming that * it's bound to a valid trait type. Returns the def_id for the defining - * trait. Fails if the type is a type other than an trait type. + * trait. Fails if the type is a type other than a trait type. */ // FIXME(#5121) -- distinguish early vs late lifetime params diff --git a/src/librustc/util/sha2.rs b/src/librustc/util/sha2.rs index b0695bc0128eb..74fefe4168369 100644 --- a/src/librustc/util/sha2.rs +++ b/src/librustc/util/sha2.rs @@ -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. // @@ -476,7 +476,7 @@ pub struct Sha256 { } impl Sha256 { - /// Construct an new instance of a SHA-256 digest. + /// Construct a new instance of a SHA-256 digest. pub fn new() -> Sha256 { Sha256 { engine: Engine256::new(&H256) diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs index 90ed4a4c744c5..2885d05a5bd5c 100644 --- a/src/librustdoc/html/render.rs +++ b/src/librustdoc/html/render.rs @@ -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. // @@ -101,7 +101,7 @@ pub enum ExternalLocation { enum Implementor { /// Paths are displayed specially by omitting the `impl XX for` cruft PathType(clean::Type), - /// This is the generic representation of an trait implementor, used for + /// This is the generic representation of a trait implementor, used for /// primitive types and otherwise non-path types. OtherType(clean::Generics, /* trait */ clean::Type, /* for */ clean::Type), } diff --git a/src/libstd/any.rs b/src/libstd/any.rs index 814cf3287717b..72ccf6be023ea 100644 --- a/src/libstd/any.rs +++ b/src/libstd/any.rs @@ -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. // @@ -118,7 +118,7 @@ impl<'a> AnyMutRefExt<'a> for &'a mut Any { } } -/// Extension methods for a owning `Any` trait object +/// Extension methods for an owning `Any` trait object pub trait AnyOwnExt { /// Returns the boxed value if it is of type `T`, or /// `Err(Self)` if it isn't. diff --git a/src/libstd/ascii.rs b/src/libstd/ascii.rs index 546f555038756..83aec9d0aa639 100644 --- a/src/libstd/ascii.rs +++ b/src/libstd/ascii.rs @@ -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. // @@ -27,13 +27,13 @@ use option::{Option, Some, None}; pub struct Ascii { priv chr: u8 } impl Ascii { - /// Converts a ascii character into a `u8`. + /// Converts an ascii character into a `u8`. #[inline] pub fn to_byte(self) -> u8 { self.chr } - /// Converts a ascii character into a `char`. + /// Converts an ascii character into a `char`. #[inline] pub fn to_char(self) -> char { self.chr as char @@ -314,9 +314,9 @@ impl IterBytes for Ascii { } } -/// Trait to convert to a owned byte array by consuming self +/// Trait to convert to an owned byte array by consuming self pub trait IntoBytes { - /// Converts to a owned byte array by consuming self + /// Converts to an owned byte array by consuming self fn into_bytes(self) -> ~[u8]; } diff --git a/src/libstd/io/mod.rs b/src/libstd/io/mod.rs index cadcbdd51f57b..69f0cf96ffc34 100644 --- a/src/libstd/io/mod.rs +++ b/src/libstd/io/mod.rs @@ -83,7 +83,7 @@ Some examples of obvious things you might want to do let lines: ~[~str] = file.lines().collect(); ``` -* Make an simple HTTP request +* Make a simple HTTP request FIXME This needs more improvement: TcpStream constructor taking &str, `write_str` and `write_line` methods. diff --git a/src/libstd/iter.rs b/src/libstd/iter.rs index 5a38b7cb2e196..df7b04dcd1976 100644 --- a/src/libstd/iter.rs +++ b/src/libstd/iter.rs @@ -213,7 +213,7 @@ pub trait Iterator { /// Creates an iterator that has a `.peek()` method - /// that returns a optional reference to the next element. + /// that returns an optional reference to the next element. /// /// # Example /// diff --git a/src/libstd/num/f32.rs b/src/libstd/num/f32.rs index 8acfd197618c5..a4b6aca86f7f1 100644 --- a/src/libstd/num/f32.rs +++ b/src/libstd/num/f32.rs @@ -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. // @@ -812,7 +812,7 @@ impl num::ToStrRadix for f32 { } /// Convert a string in base 16 to a float. -/// Accepts a optional binary exponent. +/// Accepts an optional binary exponent. /// /// This function accepts strings such as /// @@ -844,7 +844,7 @@ pub fn from_str_hex(num: &str) -> Option { impl FromStr for f32 { /// Convert a string in base 10 to a float. - /// Accepts a optional decimal exponent. + /// Accepts an optional decimal exponent. /// /// This function accepts strings such as /// @@ -876,7 +876,7 @@ impl FromStr for f32 { } impl num::FromStrRadix for f32 { - /// Convert a string in an given base to a float. + /// Convert a string in a given base to a float. /// /// Due to possible conflicts, this function does **not** accept /// the special values `inf`, `-inf`, `+inf` and `NaN`, **nor** diff --git a/src/libstd/num/f64.rs b/src/libstd/num/f64.rs index 6bb7bf6c5637f..d51f6b602d72b 100644 --- a/src/libstd/num/f64.rs +++ b/src/libstd/num/f64.rs @@ -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. // @@ -814,7 +814,7 @@ impl num::ToStrRadix for f64 { } /// Convert a string in base 16 to a float. -/// Accepts a optional binary exponent. +/// Accepts an optional binary exponent. /// /// This function accepts strings such as /// @@ -846,7 +846,7 @@ pub fn from_str_hex(num: &str) -> Option { impl FromStr for f64 { /// Convert a string in base 10 to a float. - /// Accepts a optional decimal exponent. + /// Accepts an optional decimal exponent. /// /// This function accepts strings such as /// @@ -878,7 +878,7 @@ impl FromStr for f64 { } impl num::FromStrRadix for f64 { - /// Convert a string in an given base to a float. + /// Convert a string in a given base to a float. /// /// Due to possible conflicts, this function does **not** accept /// the special values `inf`, `-inf`, `+inf` and `NaN`, **nor** diff --git a/src/libstd/num/strconv.rs b/src/libstd/num/strconv.rs index 67f6d006b5787..1ecabff875872 100644 --- a/src/libstd/num/strconv.rs +++ b/src/libstd/num/strconv.rs @@ -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. // @@ -517,7 +517,7 @@ static DIGIT_E_RADIX: uint = ('e' as uint) - ('a' as uint) + 11u; * - `ExpBin`: Accepts numbers with a binary exponent like `42P-8` or * `FFp128`. The exponent string itself is always base 10. * Can conflict with `radix`, see Failure. - * - `empty_zero` - Whether to accept a empty `buf` as a 0 or not. + * - `empty_zero` - Whether to accept an empty `buf` as a 0 or not. * - `ignore_underscores` - Whether all underscores within the string should * be ignored. * diff --git a/src/libstd/option.rs b/src/libstd/option.rs index 833f20210434b..fd5f3a233e6bf 100644 --- a/src/libstd/option.rs +++ b/src/libstd/option.rs @@ -121,7 +121,7 @@ impl Option { // Getting to contained values ///////////////////////////////////////////////////////////////////////// - /// Unwraps a option, yielding the content of a `Some` + /// Unwraps an option, yielding the content of a `Some` /// Fails if the value is a `None` with a custom failure message provided by `msg`. #[inline] pub fn expect(self, msg: M) -> T { diff --git a/src/libstd/result.rs b/src/libstd/result.rs index c3618bad18ec4..4783c983d00f9 100644 --- a/src/libstd/result.rs +++ b/src/libstd/result.rs @@ -102,7 +102,7 @@ impl Result { // Transforming contained values ///////////////////////////////////////////////////////////////////////// - /// Maps an `Result` to `Result` by applying a function to an + /// Maps a `Result` to `Result` by applying a function to an /// contained `Ok` value, leaving an `Err` value untouched. /// /// This function can be used to compose the results of two functions. @@ -120,7 +120,7 @@ impl Result { } } - /// Maps an `Result` to `Result` by applying a function to an + /// Maps a `Result` to `Result` by applying a function to an /// contained `Err` value, leaving an `Ok` value untouched. /// /// This function can be used to pass through a successful result while handling diff --git a/src/libstd/send_str.rs b/src/libstd/send_str.rs index b6c9acd26723d..2599a74a748cb 100644 --- a/src/libstd/send_str.rs +++ b/src/libstd/send_str.rs @@ -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. // @@ -38,7 +38,7 @@ impl SendStr { } } - /// Returns `true` if this `SendStr` wraps an static string + /// Returns `true` if this `SendStr` wraps a static string #[inline] pub fn is_static(&self) -> bool { match *self { diff --git a/src/libstd/str.rs b/src/libstd/str.rs index 9cc9799d0c017..16af8367edf3d 100644 --- a/src/libstd/str.rs +++ b/src/libstd/str.rs @@ -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. // @@ -417,7 +417,7 @@ pub struct CharSplitsN<'a, Sep> { priv invert: bool, } -/// An iterator over the words of a string, separated by an sequence of whitespace +/// An iterator over the words of a string, separated by a sequence of whitespace pub type Words<'a> = Filter<'a, &'a str, CharSplits<'a, extern "Rust" fn(char) -> bool>>; diff --git a/src/libstd/vec.rs b/src/libstd/vec.rs index bdb6077f984bf..8e73368647271 100644 --- a/src/libstd/vec.rs +++ b/src/libstd/vec.rs @@ -804,7 +804,7 @@ pub trait CloneableVector { /// Copy `self` into a new owned vector fn to_owned(&self) -> ~[T]; - /// Convert `self` into a owned vector, not making a copy if possible. + /// Convert `self` into an owned vector, not making a copy if possible. fn into_owned(self) -> ~[T]; } diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index 40ae98791efbd..1513946e401d3 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -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. // @@ -680,7 +680,7 @@ pub enum TokenTree { // // As a final, horrifying aside, note that macro-by-example's input is // also matched by one of these matchers. Holy self-referential! It is matched -// by an MatchSeq, specifically this one: +// by a MatchSeq, specifically this one: // // $( $lhs:matchers => $rhs:tt );+ // diff --git a/src/libsyntax/ext/deriving/generic.rs b/src/libsyntax/ext/deriving/generic.rs index 9ebb771f5da5b..6449d0aab5e54 100644 --- a/src/libsyntax/ext/deriving/generic.rs +++ b/src/libsyntax/ext/deriving/generic.rs @@ -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. // @@ -42,7 +42,7 @@ arguments: the same variant (e.g. `None`, `Some(1)` and `None`). If `const_nonmatching` is true, this will contain an empty list. - `StaticEnum` and `StaticStruct` for static methods, where the type - being derived upon is either a enum or struct respectively. (Any + being derived upon is either an enum or struct respectively. (Any argument with type Self is just grouped among the non-self arguments.) diff --git a/src/test/compile-fail/borrowck-anon-fields-struct.rs b/src/test/compile-fail/borrowck-anon-fields-struct.rs index bcaa3b9086cf3..46215d6b16436 100644 --- a/src/test/compile-fail/borrowck-anon-fields-struct.rs +++ b/src/test/compile-fail/borrowck-anon-fields-struct.rs @@ -1,5 +1,5 @@ // Tests that we are able to distinguish when loans borrow different -// anonymous fields of an tuple vs the same anonymous field. +// anonymous fields of a tuple vs the same anonymous field. struct Y(uint, uint); diff --git a/src/test/run-pass/expr-match-fail-all.rs b/src/test/run-pass/expr-match-fail-all.rs index aef11a78e0dbb..5c83e81d8be2c 100644 --- a/src/test/run-pass/expr-match-fail-all.rs +++ b/src/test/run-pass/expr-match-fail-all.rs @@ -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. // @@ -11,7 +11,7 @@ -// When all branches of an match expression result in fail, the entire +// When all branches of a match expression result in fail, the entire // match expression results in fail. pub fn main() { let _x = From 4f24caae110b712e02f058d9ff88ef35f568ef2d Mon Sep 17 00:00:00 2001 From: JeremyLetang Date: Tue, 28 Jan 2014 19:54:19 -0500 Subject: [PATCH 03/12] Add test case for issue 7911 --- src/test/run-pass/issue-7911.rs | 48 +++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 src/test/run-pass/issue-7911.rs diff --git a/src/test/run-pass/issue-7911.rs b/src/test/run-pass/issue-7911.rs new file mode 100644 index 0000000000000..a21e6e04abcd5 --- /dev/null +++ b/src/test/run-pass/issue-7911.rs @@ -0,0 +1,48 @@ +// Copyright 2012 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// xfail-pretty + +// (Closes #7911) Test that we can use the same self expression +// with different mutability in macro in two methods + +#[allow(unused_variable)]; // unused foobar_immut + foobar_mut +#[feature(macro_rules)]; + +trait FooBar {} +struct Bar(i32); +struct Foo { bar: Bar } + +impl FooBar for Bar {} + +trait Test { + fn get_immut<'r>(&'r self) -> &'r FooBar; + fn get_mut<'r>(&'r mut self) -> &'r mut FooBar; +} + +macro_rules! generate_test(($type_:path, $field:expr) => ( + impl Test for $type_ { + fn get_immut<'r>(&'r self) -> &'r FooBar { + &$field as &FooBar + } + + fn get_mut<'r>(&'r mut self) -> &'r mut FooBar { + &mut $field as &mut FooBar + } + } +)) + +generate_test!(Foo, self.bar) + +pub fn main() { + let mut foo: Foo = Foo { bar: Bar(42) }; + { let foobar_immut = foo.get_immut(); } + { let foobar_mut = foo.get_mut(); } +} From d2445126263c4938cd95d59dffff9f77fc2b42b0 Mon Sep 17 00:00:00 2001 From: Daniel Micay Date: Fri, 31 Jan 2014 09:50:44 -0500 Subject: [PATCH 04/12] bump minimum supported OS X version to 10.7 Closes #11927 Closes #10842 Closes #2024 --- README.md | 2 +- doc/tutorial.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 207daa61155ab..251f68be3d804 100644 --- a/README.md +++ b/README.md @@ -73,7 +73,7 @@ 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 +* 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. diff --git a/doc/tutorial.md b/doc/tutorial.md index ef1a9f8cab5f1..d8ee110679541 100644 --- a/doc/tutorial.md +++ b/doc/tutorial.md @@ -74,7 +74,7 @@ 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 +* 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. From c9dd1ce89a7ecd5aee37332e454516bb0b06846a Mon Sep 17 00:00:00 2001 From: Daniel Micay Date: Fri, 31 Jan 2014 09:53:17 -0500 Subject: [PATCH 05/12] mark Windows 8 as supported --- README.md | 2 +- doc/tutorial.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 251f68be3d804..224593eb9152f 100644 --- a/README.md +++ b/README.md @@ -71,7 +71,7 @@ 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 +* Windows (7, 8, Server 2008 R2), x86 only * Linux (various distributions), x86 and x86-64 * OSX 10.7 (Lion) or greater, x86 and x86-64 diff --git a/doc/tutorial.md b/doc/tutorial.md index d8ee110679541..08ce6e2a69f3a 100644 --- a/doc/tutorial.md +++ b/doc/tutorial.md @@ -72,7 +72,7 @@ from the Internet on our supported platforms. Snapshot binaries are currently built and tested on several platforms: -* Windows (7, Server 2008 R2), x86 only +* Windows (7, 8, Server 2008 R2), x86 only * Linux (various distributions), x86 and x86-64 * OSX 10.7 (Lion) or greater, x86 and x86-64 From b5334b3c0d4ec51713d0aff1a95c4e79b6770f11 Mon Sep 17 00:00:00 2001 From: Daniel Micay Date: Fri, 31 Jan 2014 09:58:00 -0500 Subject: [PATCH 06/12] mark the minimum supported Linux kernel version This is just taken from the binary itself. It would be nice to mark the minimum glibc version too, and the corresponding RHEL/CentOS version. --- README.md | 2 +- doc/tutorial.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 224593eb9152f..6fa264a99d1c1 100644 --- a/README.md +++ b/README.md @@ -72,7 +72,7 @@ fetch snapshots, and an OS that can execute the available snapshot binaries. Snapshot binaries are currently built and tested on several platforms: * Windows (7, 8, Server 2008 R2), x86 only -* Linux (various distributions), x86 and x86-64 +* 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 diff --git a/doc/tutorial.md b/doc/tutorial.md index 08ce6e2a69f3a..ff36511a31942 100644 --- a/doc/tutorial.md +++ b/doc/tutorial.md @@ -73,7 +73,7 @@ from the Internet on our supported platforms. Snapshot binaries are currently built and tested on several platforms: * Windows (7, 8, Server 2008 R2), x86 only -* Linux (various distributions), x86 and x86-64 +* 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" From ed5b897899bbf3442b47ff3aaa55f7842cc645b7 Mon Sep 17 00:00:00 2001 From: OGINO Masanori Date: Thu, 30 Jan 2014 01:04:14 +0900 Subject: [PATCH 07/12] Add test cases for #4063. Signed-off-by: OGINO Masanori --- .../non-constant-enum-for-vec-repeat.rs | 15 +++++++++++++++ src/test/run-pass/const-enum-vec-repeat.rs | 15 +++++++++++++++ src/test/run-pass/vec-repeat-with-cast.rs | 11 +++++++++++ 3 files changed, 41 insertions(+) create mode 100644 src/test/compile-fail/non-constant-enum-for-vec-repeat.rs create mode 100644 src/test/run-pass/const-enum-vec-repeat.rs create mode 100644 src/test/run-pass/vec-repeat-with-cast.rs diff --git a/src/test/compile-fail/non-constant-enum-for-vec-repeat.rs b/src/test/compile-fail/non-constant-enum-for-vec-repeat.rs new file mode 100644 index 0000000000000..883ba5b0eaa67 --- /dev/null +++ b/src/test/compile-fail/non-constant-enum-for-vec-repeat.rs @@ -0,0 +1,15 @@ +// Copyright 2014 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +enum State { ST_NULL, ST_WHITESPACE } + +fn main() { + ~[ST_NULL, ..(ST_WHITESPACE as uint)]; //~ ERROR expected constant integer for repeat count but found variable +} diff --git a/src/test/run-pass/const-enum-vec-repeat.rs b/src/test/run-pass/const-enum-vec-repeat.rs new file mode 100644 index 0000000000000..4ad4bbc4a8a57 --- /dev/null +++ b/src/test/run-pass/const-enum-vec-repeat.rs @@ -0,0 +1,15 @@ +// Copyright 2014 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +enum State { ST_NULL, ST_WHITESPACE = 1 } + +fn main() { + ~[ST_NULL, ..(ST_WHITESPACE as uint)]; +} diff --git a/src/test/run-pass/vec-repeat-with-cast.rs b/src/test/run-pass/vec-repeat-with-cast.rs new file mode 100644 index 0000000000000..c28ddd2bcb511 --- /dev/null +++ b/src/test/run-pass/vec-repeat-with-cast.rs @@ -0,0 +1,11 @@ +// Copyright 2014 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +fn main() { let _a = [0, ..1 as uint]; } From 6c52e72214fbcebee4a216aefa8dea3ec3cacbdc Mon Sep 17 00:00:00 2001 From: Huon Wilson Date: Sat, 1 Feb 2014 00:42:02 +1100 Subject: [PATCH 08/12] Add test for sensible #[start] error message. Fixes #9575. --- src/test/compile-fail/issue-9575.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 src/test/compile-fail/issue-9575.rs diff --git a/src/test/compile-fail/issue-9575.rs b/src/test/compile-fail/issue-9575.rs new file mode 100644 index 0000000000000..cc03361ee27e1 --- /dev/null +++ b/src/test/compile-fail/issue-9575.rs @@ -0,0 +1,15 @@ +// Copyright 2014 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#[start] +fn start(argc: int, argv: **u8, crate_map: *u8) -> int { + //~^ ERROR start function expects type: `fn(int, **u8) -> int` + 0 +} From a9f73b5e3d947c3b8ef8c3a8fbd30823ba099886 Mon Sep 17 00:00:00 2001 From: Huon Wilson Date: Sat, 1 Feb 2014 01:46:30 +1100 Subject: [PATCH 09/12] Remove the obsolete handler for `impl A;`. This is has been obsolete for quite a while now (including a release), so removing the special handling seems fine. (The error message is quite good still anyway.) Fixes #9580. --- src/libsyntax/parse/obsolete.rs | 5 ----- src/libsyntax/parse/parser.rs | 22 +++++++------------ src/test/compile-fail/empty-impl-semicolon.rs | 11 ++++++++++ 3 files changed, 19 insertions(+), 19 deletions(-) create mode 100644 src/test/compile-fail/empty-impl-semicolon.rs diff --git a/src/libsyntax/parse/obsolete.rs b/src/libsyntax/parse/obsolete.rs index 6aa1afee206eb..c4887d55e2a29 100644 --- a/src/libsyntax/parse/obsolete.rs +++ b/src/libsyntax/parse/obsolete.rs @@ -36,7 +36,6 @@ pub enum ObsoleteSyntax { ObsoleteUnsafeExternFn, ObsoleteTraitFuncVisibility, ObsoleteConstPointer, - ObsoleteEmptyImpl, ObsoleteLoopAsContinue, ObsoleteEnumWildcard, ObsoleteStructWildcard, @@ -110,10 +109,6 @@ impl ParserObsoleteMethods for Parser { "instead of `&const Foo` or `@const Foo`, write `&Foo` or \ `@Foo`" ), - ObsoleteEmptyImpl => ( - "empty implementation", - "instead of `impl A;`, write `impl A {}`" - ), ObsoleteLoopAsContinue => ( "`loop` instead of `continue`", "`loop` is now only used for loops and `continue` is used for \ diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 04a984ba95d92..642624adfb2b5 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -3926,21 +3926,15 @@ impl Parser { }; let mut meths = ~[]; - let inner_attrs = if self.eat(&token::SEMI) { - self.obsolete(self.last_span, ObsoleteEmptyImpl); - None - } else { - self.expect(&token::LBRACE); - let (inner_attrs, next) = self.parse_inner_attrs_and_next(); - let mut method_attrs = Some(next); - while !self.eat(&token::RBRACE) { - meths.push(self.parse_method(method_attrs)); - method_attrs = None; - } - Some(inner_attrs) - }; + self.expect(&token::LBRACE); + let (inner_attrs, next) = self.parse_inner_attrs_and_next(); + let mut method_attrs = Some(next); + while !self.eat(&token::RBRACE) { + meths.push(self.parse_method(method_attrs)); + method_attrs = None; + } - (ident, ItemImpl(generics, opt_trait, ty, meths), inner_attrs) + (ident, ItemImpl(generics, opt_trait, ty, meths), Some(inner_attrs)) } // parse a::B<~str,int> diff --git a/src/test/compile-fail/empty-impl-semicolon.rs b/src/test/compile-fail/empty-impl-semicolon.rs new file mode 100644 index 0000000000000..1a8751cb91aeb --- /dev/null +++ b/src/test/compile-fail/empty-impl-semicolon.rs @@ -0,0 +1,11 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +impl Foo; //~ ERROR expected `{` but found `;` From cad4fcd21b0e620830b818037101e523323746ea Mon Sep 17 00:00:00 2001 From: Kevin Ballard Date: Thu, 30 Jan 2014 15:29:36 -0800 Subject: [PATCH 10/12] Test for null buffer in CString.len()/.iter() and fail Also change .as_str() to fail on null buffer. --- src/libstd/c_str.rs | 39 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 36 insertions(+), 3 deletions(-) diff --git a/src/libstd/c_str.rs b/src/libstd/c_str.rs index ded80d0700320..b7374b6f15d08 100644 --- a/src/libstd/c_str.rs +++ b/src/libstd/c_str.rs @@ -162,17 +162,25 @@ impl CString { } /// Converts the CString into a `&str` without copying. - /// Returns None if the CString is not UTF-8 or is null. + /// Returns None if the CString is not UTF-8. + /// + /// # Failure + /// + /// Fails if the CString is null. #[inline] pub fn as_str<'a>(&'a self) -> Option<&'a str> { - if self.buf.is_null() { return None; } let buf = self.as_bytes(); let buf = buf.slice_to(buf.len()-1); // chop off the trailing NUL str::from_utf8(buf) } /// Return a CString iterator. + /// + /// # Failure + /// + /// Fails if the CString is null. pub fn iter<'a>(&'a self) -> CChars<'a> { + if self.buf.is_null() { fail!("CString is null!"); } CChars { ptr: self.buf, marker: marker::ContravariantLifetime, @@ -191,8 +199,14 @@ impl Drop for CString { } impl Container for CString { + /// Return the number of bytes in the CString (not including the NUL terminator). + /// + /// # Failure + /// + /// Fails if the CString is null. #[inline] fn len(&self) -> uint { + if self.buf.is_null() { fail!("CString is null!"); } unsafe { ptr::position(self.buf, |c| *c == 0) } @@ -562,8 +576,27 @@ mod tests { assert_eq!(c_str.as_str(), Some("")); let c_str = bytes!("foo", 0xff).to_c_str(); assert_eq!(c_str.as_str(), None); + } + + #[test] + #[should_fail] + fn test_as_str_fail() { let c_str = unsafe { CString::new(ptr::null(), false) }; - assert_eq!(c_str.as_str(), None); + c_str.as_str(); + } + + #[test] + #[should_fail] + fn test_len_fail() { + let c_str = unsafe { CString::new(ptr::null(), false) }; + c_str.len(); + } + + #[test] + #[should_fail] + fn test_iter_fail() { + let c_str = unsafe { CString::new(ptr::null(), false) }; + c_str.iter(); } } From b59895847ea7decdd979dc3d67c3d0c7e0bf119d Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Tue, 7 Jan 2014 20:39:15 -0800 Subject: [PATCH 11/12] Remove the need to count lang items This solves horrible diffs where all you do is renumber literally everything. --- src/librustc/middle/lang_items.rs | 165 ++++++++++++++---------------- src/librustc/middle/resolve.rs | 6 +- src/librustc/middle/ty.rs | 4 +- 3 files changed, 81 insertions(+), 94 deletions(-) diff --git a/src/librustc/middle/lang_items.rs b/src/librustc/middle/lang_items.rs index aed35c6075e19..82c927a1c2d58 100644 --- a/src/librustc/middle/lang_items.rs +++ b/src/librustc/middle/lang_items.rs @@ -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, ..$num_lang_items] + items: ~[Option], } impl LanguageItems { pub fn new() -> LanguageItems { + fn foo(_: LangItem) -> Option { None } + LanguageItems { - items: [ None, ..$num_lang_items ] + items: ~[$(foo($variant)),*] } } @@ -76,9 +63,10 @@ impl LanguageItems { } pub fn item_name(index: uint) -> &'static str { - match index { - $( $num => $name, )* - _ => "???" + let item: Option = FromPrimitive::from_uint(index); + match item { + $( Some($variant) => $name, )* + None => "???" } } @@ -208,13 +196,12 @@ 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 @@ -222,68 +209,68 @@ pub fn collect_language_items(crate: &ast::Crate, } 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; } diff --git a/src/librustc/middle/resolve.rs b/src/librustc/middle/resolve.rs index e235e914689e8..c28306a7aaca3 100644 --- a/src/librustc/middle/resolve.rs +++ b/src/librustc/middle/resolve.rs @@ -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(); @@ -823,7 +823,7 @@ fn Resolver(session: Session, /// The main resolver class. struct Resolver { session: @Session, - lang_items: LanguageItems, + lang_items: @LanguageItems, intr: @IdentInterner, @@ -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); diff --git a/src/librustc/middle/ty.rs b/src/librustc/middle/ty.rs index 317df481335cc..9062949b000d9 100644 --- a/src/librustc/middle/ty.rs +++ b/src/librustc/middle/ty.rs @@ -299,7 +299,7 @@ pub struct ctxt_ { ty_param_defs: RefCell>, adjustments: RefCell>, normalized_cache: RefCell>, - 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>, supertraits: RefCell>, @@ -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, From a67a3b7749c9a0544b2fe69338c17c6314be935d Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Fri, 31 Jan 2014 22:11:18 -0800 Subject: [PATCH 12/12] Fixing tests --- src/test/run-pass/const-enum-vec-repeat.rs | 2 +- src/test/run-pass/vec-repeat-with-cast.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/test/run-pass/const-enum-vec-repeat.rs b/src/test/run-pass/const-enum-vec-repeat.rs index 4ad4bbc4a8a57..44b91fcee3c71 100644 --- a/src/test/run-pass/const-enum-vec-repeat.rs +++ b/src/test/run-pass/const-enum-vec-repeat.rs @@ -10,6 +10,6 @@ enum State { ST_NULL, ST_WHITESPACE = 1 } -fn main() { +pub fn main() { ~[ST_NULL, ..(ST_WHITESPACE as uint)]; } diff --git a/src/test/run-pass/vec-repeat-with-cast.rs b/src/test/run-pass/vec-repeat-with-cast.rs index c28ddd2bcb511..f5d09e308ba88 100644 --- a/src/test/run-pass/vec-repeat-with-cast.rs +++ b/src/test/run-pass/vec-repeat-with-cast.rs @@ -8,4 +8,4 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -fn main() { let _a = [0, ..1 as uint]; } +pub fn main() { let _a = [0, ..1 as uint]; }