Commit Graph

28694 Commits

Author SHA1 Message Date
Dirk Leifeld
b43d7b024b Generalize stats from f64 to the Float trait 2014-05-03 10:04:33 +02:00
Brian Anderson
a5be12ce7e Replace most ~exprs with 'box'. #11779 2014-05-02 23:00:58 -07:00
Brian Anderson
a67307e2a5 emacs: Add 'box' to keywords 2014-05-02 23:00:10 -07:00
bors
3a321b001f auto merge of #13880 : TeXitoi/rust/biguint-always-use-u64, r=pcwalton
This change allow a speedup of ~1.5 on shootout-pidigits on a i32
system.  `MachineUint` is used to abstract the internal machine
unsigned integer to simplity future architecture specialization.
2014-05-02 20:56:52 -07:00
Patrick Walton
80b43de5ab libsyntax: Add box PAT to the pattern grammar. RFC #14. 2014-05-02 18:31:16 -07:00
Patrick Walton
7c64f03607 librustc: Implement the Box<T> type syntax. RFC #14. Issue #13885. 2014-05-02 18:27:50 -07:00
bors
e0d261e576 auto merge of #13579 : hirschenberger/rust/lint_unsigned_negate, r=alexcrichton
See #11273 and #13318
2014-05-02 16:51:50 -07:00
Alex Crichton
18ac26565f rustc: Crawl static initializers for reachability
This ensures that private functions exported through static initializers will
actually end up being public in the object file (so other objects can continue
to reference the function).

Closes #13620
2014-05-02 15:40:07 -07:00
Alex Crichton
825f6ace1d rustc: Remove the session building_library flag
This has long since not been too relevant since the introduction of many crate
type outputs. This commit removes the flag entirely, adjusting all logic to do
the most reasonable thing when building both a library and an executable.

Closes #13337
2014-05-02 15:26:45 -07:00
Falco Hirschenberger
6c26cbb602 Add lint check for negating uint literals and variables.
See #11273 and #13318
2014-05-03 00:13:26 +02:00
Kevin Butler
cb08cb8aef Provide a note if method lookup fails and there are static definitions with the same name. 2014-05-02 22:46:26 +01:00
Alex Crichton
f9c2d0ebfb rustc: Use the "real" realpath function
The logic of the custom realpath function in metadata::loader was incorrect, but
the logic in util::fs was correct.

Closes #13890
2014-05-02 13:50:24 -07:00
Brendan Zabarauskas
d0da4cfee7 Implement comparison operators for int and uint SIMD vectors 2014-05-02 12:04:44 -07:00
Adrien Tétar
5f0a426f65 rustdoc: escape shown input to prevent injection 2014-05-02 20:41:09 +02:00
Alex Crichton
a82f921775 rustc: Add some suppot for mixing rlibs and dylibs
Currently, rustc requires that a linkage be a product of 100% rlibs or 100%
dylibs. This is to satisfy the requirement that each object appear at most once
in the final output products. This is a bit limiting, and the upcoming libcore
library cannot exist as a dylib, so these rules must change.

The goal of this commit is to enable *some* use cases for mixing rlibs and
dylibs, primarily libcore's use case. It is not targeted at allowing an
exhaustive number of linkage flavors.

There is a new dependency_format module in rustc which calculates what format
each upstream library should be linked as in each output type of the current
unit of compilation. The module itself contains many gory details about what's
going on here.

cc #10729
2014-05-02 11:39:18 -07:00
Felix S. Klock II
4a122a3185 Updated maybe_owned_vec with review feedback.
Namely:

 * Added conversion traits both to and from the various vector types,
   analogous to how `str::MaybeOwned` works with `str::IntoMaybeOwned`
   and `str::Str`.  This led me to add the `FixedLen` variant of
   `MaybeOwnedVector` for interoperability with `std::slice`.

 * Revised client example code to make use of `into_maybe_owned`

 * Added implementations of `Show` and `CloneableVector` for
   `MaybeOwnedVector`.

 * As suggested by kballard, added `into_vec` method that is analogous
   to `CloneableVector::into_owned` except it produces a `Vec` rather
   than a `~[T]`.
2014-05-02 17:45:17 +02:00
Felix S. Klock II
b7374182f7 Add a graphviz crate for making .dot files to layout and render graphs. 2014-05-02 17:45:09 +02:00
bors
b5d6b07370 auto merge of #13879 : huonw/rust/more-re, r=alexcrichton
Commits for details.

This shouldn't change the generated code at all (except for switching to `LitBinary` from an explicit ExprVec of individual ExprLit bytes for `prefix_bytes`).
2014-05-02 07:06:50 -07:00
Huon Wilson
1ad0cba5e6 regex_macros: simplify using AstBuilder & the improved quoting.
char literals now work in a quotation.

There were several instances of duplicated functionality in regex_macros
compared to AstBuilder so refactor those out.
2014-05-02 22:54:55 +10:00
Huon Wilson
1d43a98dea syntax: implement ToSource for more things in the quasiquoter.
The last few primitive types were missing.
2014-05-02 22:54:55 +10:00
Huon Wilson
5c424ba34a syntax: store char literals/tokens as chars rather than u32s.
Clearly storing them as `char` is semantically nicer, but this also
fixes a bug whereby `quote_expr!(cx, 'a')` wasn't working, because the
code created by quotation was not matching the actual AST definitions.
2014-05-02 22:54:55 +10:00
Herman J. Radtke III
923a8f39ca Implement ToJson for Vec<T>
Now that ~[T] is obsolete, we need to allow to_json() to work for
vectors.
2014-05-02 00:02:15 -07:00
bors
e97d4e6c19 auto merge of #13789 : sfackler/rust/debug-assert, r=pcwalton
I switched the `assert!` calls in `RefCell` over to `debug_assert!`.
There are probably other instances that should be converted as well, but
I couldn't think of any off the top of my head.

RFC: 0015-assert
2014-05-01 23:41:46 -07:00
bors
adcbf53955 auto merge of #13886 : japaric/rust/fix-an-typos, r=alexcrichton
Found the first one in the rust reference docs. I was going to submit a PR with one fix, but figured I could look for more... This is the result.
2014-05-01 20:11:47 -07:00
Steven Fackler
ca84d79375 Remove useless assert! case 2014-05-01 19:07:41 -07:00
Steven Fackler
b0b7c252d7 Add debug_assert and debug_assert_eq macros
I also switched some `assert!` calls over to `debug_assert!`.

Closes #12049.

RFC: 0015-assert
2014-05-01 19:07:40 -07:00
Jorge Aparicio
e4bf643b99 Fix a/an typos 2014-05-01 20:02:11 -05:00
bors
9f836d5a53 auto merge of #13877 : thestinger/rust/de-tilde-str-vec, r=alexcrichton 2014-05-01 16:06:48 -07:00
Daniel Micay
e93cb04c4b fix error message for obsolete &"foo" literal 2014-05-01 17:43:00 -04:00
Daniel Micay
7852625b86 remove leftover obsolete string literals 2014-05-01 17:42:57 -04:00
Flavio Percoco
c39271e99c Allow built-in traits to be derived
[RFC #3]

cc #13231
2014-05-01 23:05:16 +02:00
bors
fb72d7cfea auto merge of #13881 : aochagavia/rust/pr, r=alexcrichton 2014-05-01 13:31:59 -07:00
bors
e4ad24f1b2 auto merge of #13878 : brutal-chaos/rust/tutorial_grammar, r=alexcrichton 2014-05-01 12:06:52 -07:00
Guillaume Pinot
593f6a42d0 BigUint always use u64 as the internal machine unsigned integer
This change allow a speedup of ~1.5 on shootout-pidigits on a i32
system.  `DoubleBigDigit` is used to abstract the internal
unsigned integer used in computation to simplity future
architecture specialization.

`BigDigit::from_uint` and `BigDigit::to_uint` become
`BigDigit::from_doublebigdigit` and `BigDigit::to_doublebigdigit`.

[breaking-change]
2014-05-01 20:10:16 +02:00
Brendan Zabarauskas
6dd7a56ed4 Add more comprehensive unit tests for SIMD binops 2014-05-01 10:51:33 -07:00
bors
ee03529fa9 auto merge of #13875 : hjr3/rust/serialize-strbuf, r=alexcrichton
- implement Encodable and Decodable for StrBuf
- implement to_json for StrBuf
2014-05-01 09:41:54 -07:00
Adolfo Ochagavía
b537028116 Fixed outdated note in the tutorial 2014-05-01 17:52:17 +02:00
bors
239557de6d auto merge of #13724 : nikomatsakis/rust/expr-use-visitor, r=pnkfelix
Pre-step towards issue #12624 and others: Introduce ExprUseVisitor, remove the
moves computation. ExprUseVisitor is a visitor that walks the AST for a
function and calls a delegate to inform it where borrows, copies, and moves
occur.

In this patch, I rewrite the gather_loans visitor to use ExprUseVisitor, but in
future patches, I think we could rewrite regionck, check_loans, and possibly
other passes to use it as well. This would refactor the repeated code between
those places that tries to determine where copies/moves/etc occur.

r? @alexcrichton
2014-05-01 04:36:50 -07:00
Justin Noah
000667158b rustdoc tutorial: grammar change in list comments 2014-05-01 01:16:30 -07:00
bors
5c0abead82 auto merge of #13873 : alexcrichton/rust/issue-13872, r=Aatch
This was just a typo in the decoder using the source crate's number rather than
the destination crate's number of a reexport.

Closes #13872
2014-05-01 00:56:48 -07:00
Herman J. Radtke III
fa6efedccf Add serialization support for StrBuf
- implement Encodable and Decodable for StrBuf
- implement to_json for StrBuf
2014-04-30 23:49:00 -07:00
Alex Crichton
8c87eff700 rustc: Fix def ids of xcrate-reexported items
This was just a typo in the decoder using the source crate's number rather than
the destination crate's number of a reexport.

Closes #13872
2014-04-30 19:24:21 -07:00
mdinger
b3d7aa3924 Merge pull request #1 from pnkfelix/clarify-omit-unit-vs-inference
Suggested revisions to PR 13676.
2014-04-30 20:40:03 -04:00
Niko Matsakis
b9af043879 Address nits from @pnkfelix 2014-04-30 20:22:36 -04:00
Patrick Walton
4baff4e15f librustc: Remove ~"string" and &"string" from the language 2014-04-30 16:49:12 -07:00
Flavio Percoco
a51be8ecd8 Allow manual implementations of built-in traits
[RFC #3]

cc #13231
2014-05-01 00:49:20 +02:00
bors
9f484e616e auto merge of #13648 : gereeter/rust/removed-rev, r=alexcrichton
In the process, `Splits` got changed to be more like `CharSplits` in `str` to present the DEI interface.

Note that `treemap` still has a `rev_iter` function because it seems like it would be a significant interface change to expose a DEI - the iterator would have to gain an extra pointer, the completion checks would be more complicated, and it isn't easy to check that such an implementation is correct due to the use of unsafety to subvert the aliasing properties of `&mut`.

This fixes #9391.
2014-04-30 15:46:47 -07:00
bors
3aadbed612 auto merge of #13864 : adrientetar/rust/fix-it-some-more, r=alexcrichton
Two selector fixes for rustdoc:

- links colored in blue (#13807) was also affecting headers, which are anchored to their respective ids
- the header unstyling from #13776 was being applied to all headers also

Additionally, remove a stray title in the documentation. This makes the crate title of prelude appear as header instead of an inline paragraph of text (all others work normally and do not have that header tag).

The design is unchanged from my previous template (e.g. [here](http://adrientetar.legtux.org/cached/rust-docs/struct.CChars.htm)), however it is now properly applied.  
The last fix remaining is to enable webfonts service from `static.rust-lang.org`, this is #13593.

r? @alexcrichton, @brson
2014-04-30 14:06:47 -07:00
Alex Crichton
8375a22b16 native: Always open a file with Open/Write modes
Previously, windows was using the CREATE_NEW flag which fails if the file
previously existed, which differed from the unix semantics. This alters the
opening to use the OPEN_ALWAYS flag to mirror the unix semantics.

Closes #13861
2014-04-30 11:37:01 -07:00
bors
a3f9f37014 auto merge of #13072 : bjz/rust/bitset, r=alexcrichton
The `bitflags!` macro generates a `struct` that holds a set of C-style bitmask flags. It is useful for creating typesafe wrappers for C APIs.

For example:

~~~rust
#[feature(phase)];
#[phase(syntax)] extern crate collections;

bitflags!(Flags: u32 {
    FlagA       = 0x00000001,
    FlagB       = 0x00000010,
    FlagC       = 0x00000100,
    FlagABC     = FlagA.bits
                | FlagB.bits
                | FlagC.bits
})

fn main() {
    let e1 = FlagA | FlagC;
    let e2 = FlagB | FlagC;
    assert!((e1 | e2) == FlagABC);   // union
    assert!((e1 & e2) == FlagC);     // intersection
    assert!((e1 - e2) == FlagA);     // set difference
}
~~~
2014-04-30 11:11:49 -07:00