Commit Graph

30931 Commits

Author SHA1 Message Date
Alex Crichton
82fb85a152 rustc: Mix extra-filename in temp outputs
When invoking the compiler in parallel, the intermediate output of the object
files and bytecode can stomp over one another if two crates with the same name
are being compiled.

The output file is already being disambiguated with `-C extra-filename`, so this
commit alters the naming of the temporary files to also mix in the extra
filename to ensure that file names don't clash.
2014-07-18 18:09:08 -07:00
Jakub Wieczorek
fba1194841 Add support for patterns referencing non-trivial statics
This is accomplished by rewriting static expressions into equivalent patterns.
This way, patterns referencing static variables can both participate
in exhaustiveness analysis as well as be compiled down into the appropriate
branch of the decision trees that match expressions are codegened to.

Fixes #6533.
Fixes #13626.
Fixes #13731.
Fixes #14576.
Fixes #15393.
2014-07-19 01:09:22 +02:00
Brian Anderson
a57e2a7f4d core: Stabliize core::cmp
Mark Eq, PartialEq, Ord, PartialOrd as unstable: they will change
slightly after trait reform. Equiv as experimental: better solutions
are desired. min/max stable.
2014-07-18 15:59:54 -07:00
root
4592164869 Write multibyte case for str Chars iterator in-line
Thanks to comments from @alexcrichton, write the next/next_back function
bodies without nested functions in a more top-to-bottom flow style.

Also improve comment style and motivate the unsafe blocks with comments.
2014-07-19 00:28:45 +02:00
root
bbb299ad98 Clarify str Chars iterator implementation
Thanks to comments from @huonw, clarify decoding details and use
statics for important constants for UTF-8 decoding. Convert some magic
numbers scattered in the same file to use the statics too.
2014-07-19 00:28:45 +02:00
bors
ef352faea8 auto merge of #15743 : Ryman/rust/mandelbrot_fix, r=alexcrichton
Matches the official sample output (N=200) again.

cc #15408
2014-07-18 21:46:32 +00:00
Björn Steinbrink
d368ffdb26 Remove the unneeded final parameter from call_visit_glue
call_visit_glue() is only ever called with None as its last argument, so
we can remove it as well.
2014-07-18 21:56:36 +02:00
Luqman Aden
61ded48fbc Ignore one test. 2014-07-18 11:58:45 -07:00
Luqman Aden
ad27e2625a librustc: Set enum discriminant only after field translation. 2014-07-18 11:58:45 -07:00
Luqman Aden
27748b09d8 librustc: Only emit constructor functions as necessary. 2014-07-18 11:58:45 -07:00
Luqman Aden
06bf73a646 librustc: Emit tuple struct constructor at callsite instead of via a call to a function. 2014-07-18 11:46:03 -07:00
Luqman Aden
cb404dd4fb librustc: Emit enum variant constructor at callsite instead of via a call to a function. 2014-07-18 11:46:03 -07:00
Jonas Hietala
820a55857a Special case for 0 arguments given in format! 2014-07-18 20:39:38 +02:00
bors
7502b4cd6b auto merge of #15742 : pnkfelix/rust/fsk-fix-15019, r=pcwalton
Removed `index_to_bitset` field and `_frozen` methods.

Drive-by: Added some missing docs on the `each_bit` method.

Drive-by: Put in a regular pattern: when calling `compute_id_range`, ensure `words_per_id > 0` by either asserting it or checking and returning early.  (The prior code did the latter in a few cases where necessary, but debugging is much aided by the asserts.)

Fix #15019.
2014-07-18 18:26:34 +00:00
Jakub Wieczorek
5274e997ab Assign more diagnostic codes 2014-07-18 20:13:19 +02:00
Jonas Hietala
18717fcf68 Correct plural of arguments in format_args! 2014-07-18 19:25:46 +02:00
bors
9c9bdfd1c5 auto merge of #14539 : pcwalton/rust/unboxed-closures, r=pnkfelix
@nikomatsakis r?
2014-07-18 16:46:33 +00:00
Björn Steinbrink
33a4dd824f Remove outdated unreachable check from call_visit_glue
`call_visit_glue` is only ever called from trans_intrinsic, and the
block won't be unreachable there. Also, the comment doesn't make sense
anymore. When the code was introduced in 38fee9526a the function was
also responsible for the cleanup glue, which is no longer the case.

While we're at it, also fixed the debug message to output the right
function name.
2014-07-18 18:16:18 +02:00
Patrick Walton
02adaca4dc librustc: Implement unboxed closures with mutable receivers 2014-07-18 09:01:37 -07:00
Alex Crichton
50868db351 rustc: #[crate_name] and --crate-name must match
Part of the original discussions around the `--crate-name` flag brought up that
mass confusion can arise when the flag specifies a different name than is
contained in the crate.

The current primary use case of the `--crate-name` flag is through cargo and
not requiring a `#[crate_name]` attribute, but if the `#[crate_name]` attribute
is specified it will likely go awry when the two names deviate from one another.
This commit requires that if both are provided they both match to prevent this
confusion.
2014-07-18 08:47:23 -07:00
Steve Klabnik
0c30e1faad Include Strings guide with the others.
Three small changes:

1. Re-organize headers in the Strings guide so they show up correctly.
2. build the strings guide with the other docs
3. include the strings guide in the list of guides
2014-07-18 10:48:24 -04:00
Jonas Hietala
01b6fd3e82 Remove examples from trait implementations. Unhide imports. 2014-07-18 16:34:07 +02:00
Alex Crichton
3419e20f3b sync: Fail with init semaphore count < 0
Semaphores are not currently designed to handle this case correctly, leading to
very strange behavior. Semaphores as written are intended to count *resources*
and it's not possible to have a negative number of resources.

This alters the behavior and documentation to note that the task will be failed
if the initial count is 0.

Closes #15758
2014-07-18 07:26:55 -07:00
bors
5ddc7b4a25 auto merge of #15737 : huonw/rust/lint-level-here, r=pnkfelix
This allows lint traversals to emit more information (when a lint is
non-allow), or avoid doing expensive computations (when a lint is
allow).
2014-07-18 13:31:22 +00:00
Jonas Hietala
b2a02b580d Fill in documentation for HashSet.
Example how to use the set with a custom type. Fill in examples for the missing methods.
2014-07-18 14:10:39 +02:00
bors
4418664177 auto merge of #15733 : sanxiyn/rust/use-from-type, r=alexcrichton
Importing from types was disallowed in #6462. Flag was set for paths whether it is a module or a type. Type flag was set when impl was seen. The problem is, for cross-crate situations, when reexport is involved, it is possible that impl is seen too late because metadata is loaded lazily.

Fix #15664.
2014-07-18 11:51:20 +00:00
Felix S. Klock II
8f50428432 Removed the _frozen methods from dataflow API.
Calls to methods like `each_bit_on_entry_frozen` and
`each_gen_bit_frozen` now go to the `each_bit_on_entry` and
`each_gen_bit` methods.
2014-07-18 13:48:53 +02:00
Felix S. Klock II
fc4f6eda96 Removed index_to_bitset from the dataflow context.
Part of addressing 15019.
2014-07-18 13:48:06 +02:00
bors
d9f1d6b7f6 auto merge of #15732 : bgamari/rust/to-tokens, r=alexcrichton
Here I add a `ToTokens` impl for `Attribute_` and `Option<T>`, as well as generalize the impl for `Vec<T>`
2014-07-18 09:31:22 +00:00
bors
5980aa0f22 auto merge of #15727 : fhahn/rust/remove-some-unwraps, r=alexcrichton
When looking through the `btree` code, I stumbled over a couple of `unwraps` that could be avoided.
2014-07-18 07:51:22 +00:00
bors
8067d03679 auto merge of #15726 : aturon/rust/macro-stability, r=alexcrichton
This small patch causes the stability lint to bail out when traversing
any AST produced via a macro expansion. Ultimately, we would like to
lint the contents of the macro at the place where the macro is defined,
but regardless we should not be linting it at the use site.

Closes #15703
2014-07-18 06:11:24 +00:00
bors
8a308b167f auto merge of #15725 : aochagavia/rust/vec, r=alexcrichton
* Deprecated `to_owned` in favor of `to_vec`
* Deprecated `into_owned` in favor of `into_vec`

[breaking-change]
2014-07-18 03:46:23 +00:00
nham
7ee45aa6e5 Add examples for DList methods rotate_forward, rotate_backward, append, prepend and insert_when 2014-07-17 22:49:04 -04:00
bors
cebed8ab92 auto merge of #15593 : steveklabnik/rust/string_guide, r=kballard
I decided to change it up a little today and hack out the beginning of the String guide. Strings are different enough in Rust that I think they deserve a specific guide, especially for those who are used to managed languages.

I decided to start with Strings because they get asked about a lot in IRC, and also based on discussions like this one on reddit: http://www.reddit.com/r/rust/comments/2ac390/generic_string_literals/

I blatantly stole bits from our other documentation on Strings. It's a little sparse at current, but I wanted to start somewhere.

I am not exactly sure what should go in "Best Practices," and would like the feedback from the team on this. Specifically due to comments like this one: http://www.reddit.com/r/rust/comments/2ac390/generic_string_literals/citmxb5
2014-07-18 01:46:24 +00:00
Alex Crichton
31eb00c022 sync: Ensure try_send() wakes up receivers
This branch of try_send() just forgot to wake up any receiver waiting for data.

Closes #15761
2014-07-17 18:32:25 -07:00
Steve Klabnik
226b7d1b72 Guide: strings 2014-07-17 20:50:14 -04:00
bors
f50e4ee559 auto merge of #15719 : michaelwoerister/rust/global_var_null_span_fix, r=alexcrichton
This should fix issue #15541. It would be good to have an test case for this would also be nice but I haven't had the time to write one. The change is very small though and it doesn't break anything in the existing test suite, so I guess we can add it without test for now.
2014-07-18 00:01:22 +00:00
root
9e59c76263 Add more tests for str Chars iterator
Test iterating (decoding) every codepoint.
2014-07-18 00:59:09 +02:00
bors
e288fc6a99 auto merge of #15515 : pcwalton/rust/cross-borrowing, r=alexcrichton
except where trait objects are involved.

Part of issue #15349, though I'm leaving it open for trait objects.
Cross borrowing for trait objects remains because it is needed until we
have DST.

This will break code like:

    fn foo(x: &int) { ... }

    let a = box 3i;
    foo(a);

Change this code to:

    fn foo(x: &int) { ... }

    let a = box 3i;
    foo(&*a);

[breaking-change]

r? @alexcrichton
2014-07-17 22:16:23 +00:00
Patrick Walton
de70d76373 librustc: Remove cross-borrowing of Box<T> to &T from the language,
except where trait objects are involved.

Part of issue #15349, though I'm leaving it open for trait objects.
Cross borrowing for trait objects remains because it is needed until we
have DST.

This will break code like:

    fn foo(x: &int) { ... }

    let a = box 3i;
    foo(a);

Change this code to:

    fn foo(x: &int) { ... }

    let a = box 3i;
    foo(&*a);

[breaking-change]
2014-07-17 14:05:36 -07:00
bors
36d6acc4ee auto merge of #15718 : treeman/rust/integer-doc, r=alexcrichton
Simple usage examples for Integer methods. Also group `div_rem` and `div_mod_floor` together at the bottom of the trait, to reflect the documentation rendering.
2014-07-17 20:36:19 +00:00
bors
ca24abd4d2 auto merge of #15716 : treeman/rust/bigint-doc, r=alexcrichton
Also use `///` for documentation instead of `/**`. End comments with `.`.
2014-07-17 18:56:22 +00:00
root
42357d772b core::str: Implement Chars iterator using slice::Items
Re-use the vector iterator to implement the chars iterator.

The iterator uses our guarantee that the string contains valid UTF-8,
but its only unsafe code is transmuting the decoded u32 into char.
2014-07-17 20:22:40 +02:00
root
d6b42c2463 str: Add better tests for string slice's Chars iterator
Test using for ch s.chars() { black_box(ch) } to have a test that should
force the iterator to run its full decoding computations.
2014-07-17 20:21:53 +02:00
bors
c4b1077dfb auto merge of #15706 : phi-gamma/rust/master, r=huonw
I kept changes to each file in a separate commit. Please let me know if you prefer them
squashed!
2014-07-17 17:16:23 +00:00
bors
92b5bf86b7 auto merge of #15705 : klutzy/rust/cross-ld-library, r=alexcrichton 2014-07-17 15:36:23 +00:00
Adolfo Ochagavía
8107ef77f0 Rename functions in the CloneableVector trait
* Deprecated `to_owned` in favor of `to_vec`
* Deprecated `into_owned` in favor of `into_vec`

[breaking-change]
2014-07-17 16:35:48 +02:00
Jonas Hietala
89e28d3df9 Small fixes for tutorial.
5.2 Simplify example to remove hidden #[deriving(Show)].
    Add example for constructing the enums.

8   Reference later sections describing rc, gc and send.
    Fix for #15293.

13  Simplify BananaMania example to remove hidden code.

17  Gave an example using the derived Rand trait.

Removed references to removed 'extra' crate.
2014-07-17 16:21:33 +02:00
bors
c0e6c4e650 auto merge of #15675 : errordeveloper/rust/json_docs, r=steveklabnik
- add one simple example of using `ToJson` trait
- make example code more readable
2014-07-17 13:56:19 +00:00
Ben Gamari
e4f8cec416 syntax: Add ToTokens impl for Method 2014-07-17 08:54:43 -04:00