]> git.lizzy.rs Git - rust.git/log
rust.git
9 years agoauto merge of #15650 : jakub-/rust/patterns-statics, r=pcwalton
bors [Sat, 19 Jul 2014 21:46:37 +0000 (21:46 +0000)]
auto merge of #15650 : jakub-/rust/patterns-statics, r=pcwalton

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.

9 years agoauto merge of #15782 : steveklabnik/rust/string_guide_link, r=cmr
bors [Sat, 19 Jul 2014 18:36:37 +0000 (18:36 +0000)]
auto merge of #15782 : steveklabnik/rust/string_guide_link, r=cmr

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

9 years agoauto merge of #15772 : treeman/rust/hashset-doc, r=alexcrichton
bors [Sat, 19 Jul 2014 16:01:43 +0000 (16:01 +0000)]
auto merge of #15772 : treeman/rust/hashset-doc, r=alexcrichton

Example how to use the set with a custom type. Fill in examples for the missing methods. Also group implemented traits below `HashSet` method impl.

9 years agoauto merge of #15638 : blake2-ppc/rust/ptr-arithmetic-chars, r=huonw
bors [Sat, 19 Jul 2014 14:06:39 +0000 (14:06 +0000)]
auto merge of #15638 : blake2-ppc/rust/ptr-arithmetic-chars, r=huonw

Reimplement the string slice's `Iterator<char>` by wrapping the already efficient
slice 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`.

Benchmarks suggest that the runtime of `Chars` benchmarks are reduced by up to 30%,
runtime of `Chars` reversed reduced by up to 60%.

```
BEFORE
test str::bench::char_indicesator                          ... bench:       124 ns/iter (+/- 1)
test str::bench::char_indicesator_rev                      ... bench:       188 ns/iter (+/- 9)
test str::bench::char_iterator                             ... bench:       122 ns/iter (+/- 2)
test str::bench::char_iterator_ascii                       ... bench:       302 ns/iter (+/- 41)
test str::bench::char_iterator_for                         ... bench:       123 ns/iter (+/- 4)
test str::bench::char_iterator_rev                         ... bench:       189 ns/iter (+/- 14)
test str::bench::char_iterator_rev_for                     ... bench:       177 ns/iter (+/- 4)

AFTER
test str::bench::char_indicesator                          ... bench:        85 ns/iter (+/- 3)
test str::bench::char_indicesator_rev                      ... bench:        82 ns/iter (+/- 2)
test str::bench::char_iterator                             ... bench:       100 ns/iter (+/- 3)
test str::bench::char_iterator_ascii                       ... bench:       317 ns/iter (+/- 3)
test str::bench::char_iterator_for                         ... bench:        86 ns/iter (+/- 2)
test str::bench::char_iterator_rev                         ... bench:        80 ns/iter (+/- 6)
test str::bench::char_iterator_rev_for                     ... bench:        68 ns/iter (+/- 0)
```

Note: Branch name is no longer indicative of the implementation.

9 years agoSimplify str CharOffsets iterator
root [Sat, 19 Jul 2014 13:39:02 +0000 (15:39 +0200)]
Simplify str CharOffsets iterator

Only one uint is needed to keep track of the offset from the original
full string.

9 years agoauto merge of #15765 : luqmana/rust/iec, r=pcwalton
bors [Sat, 19 Jul 2014 12:26:39 +0000 (12:26 +0000)]
auto merge of #15765 : luqmana/rust/iec, r=pcwalton

Fixes #15400.

9 years agoauto merge of #15754 : jakub-/rust/diagnostics, r=alexcrichton
bors [Sat, 19 Jul 2014 08:51:34 +0000 (08:51 +0000)]
auto merge of #15754 : jakub-/rust/diagnostics, r=alexcrichton

9 years agoauto merge of #15752 : nham/rust/dlist_docs, r=alexcrichton
bors [Sat, 19 Jul 2014 07:11:33 +0000 (07:11 +0000)]
auto merge of #15752 : nham/rust/dlist_docs, r=alexcrichton

Someone rightfully complained in IRC that DList was lacking examples. Here are some.

9 years agoauto merge of #15686 : alexcrichton/rust/same-crate-name, r=kballard
bors [Sat, 19 Jul 2014 03:11:34 +0000 (03:11 +0000)]
auto merge of #15686 : alexcrichton/rust/same-crate-name, r=kballard

The first is to require that `#[crate_name]` and `--crate-name` always match (if both are specified). The second is to fix parallel compilation in cargo by mixing in `-C extra-filename` into the temporary outputs of the compiler.

9 years agorustc: Mix extra-filename in temp outputs
Alex Crichton [Tue, 15 Jul 2014 16:13:58 +0000 (09:13 -0700)]
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.

9 years agoAdd support for patterns referencing non-trivial statics
Jakub Wieczorek [Sun, 13 Jul 2014 13:12:47 +0000 (15:12 +0200)]
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.

9 years agoWrite multibyte case for str Chars iterator in-line
root [Fri, 18 Jul 2014 22:02:30 +0000 (00:02 +0200)]
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.

9 years agoClarify str Chars iterator implementation
root [Thu, 17 Jul 2014 22:59:49 +0000 (00:59 +0200)]
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.

9 years agoauto merge of #15743 : Ryman/rust/mandelbrot_fix, r=alexcrichton
bors [Fri, 18 Jul 2014 21:46:32 +0000 (21:46 +0000)]
auto merge of #15743 : Ryman/rust/mandelbrot_fix, r=alexcrichton

Matches the official sample output (N=200) again.

cc #15408

9 years agoIgnore one test.
Luqman Aden [Fri, 18 Jul 2014 00:17:27 +0000 (17:17 -0700)]
Ignore one test.

9 years agolibrustc: Set enum discriminant only after field translation.
Luqman Aden [Thu, 10 Jul 2014 22:09:21 +0000 (15:09 -0700)]
librustc: Set enum discriminant only after field translation.

9 years agolibrustc: Only emit constructor functions as necessary.
Luqman Aden [Thu, 10 Jul 2014 17:59:52 +0000 (10:59 -0700)]
librustc: Only emit constructor functions as necessary.

9 years agolibrustc: Emit tuple struct constructor at callsite instead of via a call to a function.
Luqman Aden [Thu, 10 Jul 2014 07:20:28 +0000 (00:20 -0700)]
librustc: Emit tuple struct constructor at callsite instead of via a call to a function.

9 years agolibrustc: Emit enum variant constructor at callsite instead of via a call to a function.
Luqman Aden [Thu, 10 Jul 2014 06:42:08 +0000 (23:42 -0700)]
librustc: Emit enum variant constructor at callsite instead of via a call to a function.

9 years agoauto merge of #15742 : pnkfelix/rust/fsk-fix-15019, r=pcwalton
bors [Fri, 18 Jul 2014 18:26:34 +0000 (18:26 +0000)]
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.

9 years agoAssign more diagnostic codes
Jakub Wieczorek [Thu, 17 Jul 2014 17:56:37 +0000 (19:56 +0200)]
Assign more diagnostic codes

9 years agoauto merge of #14539 : pcwalton/rust/unboxed-closures, r=pnkfelix
bors [Fri, 18 Jul 2014 16:46:33 +0000 (16:46 +0000)]
auto merge of #14539 : pcwalton/rust/unboxed-closures, r=pnkfelix

@nikomatsakis r?

9 years agolibrustc: Implement unboxed closures with mutable receivers
Patrick Walton [Thu, 29 May 2014 05:26:56 +0000 (22:26 -0700)]
librustc: Implement unboxed closures with mutable receivers

9 years agorustc: #[crate_name] and --crate-name must match
Alex Crichton [Tue, 15 Jul 2014 16:13:40 +0000 (09:13 -0700)]
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.

9 years agoInclude Strings guide with the others.
Steve Klabnik [Fri, 18 Jul 2014 14:48:24 +0000 (10:48 -0400)]
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

9 years agoRemove examples from trait implementations. Unhide imports.
Jonas Hietala [Fri, 18 Jul 2014 14:34:07 +0000 (16:34 +0200)]
Remove examples from trait implementations. Unhide imports.

9 years agoauto merge of #15737 : huonw/rust/lint-level-here, r=pnkfelix
bors [Fri, 18 Jul 2014 13:31:22 +0000 (13:31 +0000)]
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).

9 years agoFill in documentation for HashSet.
Jonas Hietala [Thu, 17 Jul 2014 18:40:39 +0000 (20:40 +0200)]
Fill in documentation for HashSet.

Example how to use the set with a custom type. Fill in examples for the missing methods.

9 years agoauto merge of #15733 : sanxiyn/rust/use-from-type, r=alexcrichton
bors [Fri, 18 Jul 2014 11:51:20 +0000 (11:51 +0000)]
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.

9 years agoRemoved the `_frozen` methods from dataflow API.
Felix S. Klock II [Thu, 17 Jul 2014 13:36:38 +0000 (15:36 +0200)]
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.

9 years agoRemoved `index_to_bitset` from the dataflow context.
Felix S. Klock II [Thu, 17 Jul 2014 12:28:03 +0000 (14:28 +0200)]
Removed `index_to_bitset` from the dataflow context.

Part of addressing 15019.

9 years agoauto merge of #15732 : bgamari/rust/to-tokens, r=alexcrichton
bors [Fri, 18 Jul 2014 09:31:22 +0000 (09:31 +0000)]
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>`

9 years agoauto merge of #15727 : fhahn/rust/remove-some-unwraps, r=alexcrichton
bors [Fri, 18 Jul 2014 07:51:22 +0000 (07:51 +0000)]
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.

9 years agoauto merge of #15726 : aturon/rust/macro-stability, r=alexcrichton
bors [Fri, 18 Jul 2014 06:11:24 +0000 (06:11 +0000)]
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

9 years agoauto merge of #15725 : aochagavia/rust/vec, r=alexcrichton
bors [Fri, 18 Jul 2014 03:46:23 +0000 (03:46 +0000)]
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]

9 years agoAdd examples for DList methods rotate_forward, rotate_backward, append, prepend and...
nham [Thu, 17 Jul 2014 20:46:27 +0000 (16:46 -0400)]
Add examples for DList methods rotate_forward, rotate_backward, append, prepend and insert_when

9 years agoauto merge of #15593 : steveklabnik/rust/string_guide, r=kballard
bors [Fri, 18 Jul 2014 01:46:24 +0000 (01:46 +0000)]
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

9 years agoGuide: strings
Steve Klabnik [Thu, 17 Jul 2014 23:24:12 +0000 (19:24 -0400)]
Guide: strings

9 years agoauto merge of #15719 : michaelwoerister/rust/global_var_null_span_fix, r=alexcrichton
bors [Fri, 18 Jul 2014 00:01:22 +0000 (00:01 +0000)]
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.

9 years agoAdd more tests for str Chars iterator
root [Thu, 17 Jul 2014 22:59:09 +0000 (00:59 +0200)]
Add more tests for str Chars iterator

Test iterating (decoding) every codepoint.

9 years agoauto merge of #15515 : pcwalton/rust/cross-borrowing, r=alexcrichton
bors [Thu, 17 Jul 2014 22:16:23 +0000 (22:16 +0000)]
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

9 years agolibrustc: Remove cross-borrowing of `Box<T>` to `&T` from the language,
Patrick Walton [Mon, 7 Jul 2014 23:35:15 +0000 (16:35 -0700)]
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]

9 years agoauto merge of #15718 : treeman/rust/integer-doc, r=alexcrichton
bors [Thu, 17 Jul 2014 20:36:19 +0000 (20:36 +0000)]
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.

9 years agoauto merge of #15716 : treeman/rust/bigint-doc, r=alexcrichton
bors [Thu, 17 Jul 2014 18:56:22 +0000 (18:56 +0000)]
auto merge of #15716 : treeman/rust/bigint-doc, r=alexcrichton

Also use `///` for documentation instead of `/**`. End comments with `.`.

9 years agocore::str: Implement Chars iterator using slice::Items
root [Thu, 17 Jul 2014 17:34:07 +0000 (19:34 +0200)]
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.

9 years agostr: Add better tests for string slice's Chars iterator
root [Thu, 17 Jul 2014 16:03:34 +0000 (18:03 +0200)]
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.

9 years agoauto merge of #15706 : phi-gamma/rust/master, r=huonw
bors [Thu, 17 Jul 2014 17:16:23 +0000 (17:16 +0000)]
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!

9 years agoauto merge of #15705 : klutzy/rust/cross-ld-library, r=alexcrichton
bors [Thu, 17 Jul 2014 15:36:23 +0000 (15:36 +0000)]
auto merge of #15705 : klutzy/rust/cross-ld-library, r=alexcrichton

9 years agoRename functions in the CloneableVector trait
Adolfo Ochagavía [Wed, 16 Jul 2014 20:37:28 +0000 (22:37 +0200)]
Rename functions in the CloneableVector trait

* Deprecated `to_owned` in favor of `to_vec`
* Deprecated `into_owned` in favor of `into_vec`

[breaking-change]

9 years agoauto merge of #15675 : errordeveloper/rust/json_docs, r=steveklabnik
bors [Thu, 17 Jul 2014 13:56:19 +0000 (13:56 +0000)]
auto merge of #15675 : errordeveloper/rust/json_docs, r=steveklabnik

- add one simple example of using `ToJson` trait
- make example code more readable

9 years agosyntax: Add ToTokens impl for Method
Ben Gamari [Thu, 17 Jul 2014 12:54:43 +0000 (08:54 -0400)]
syntax: Add ToTokens impl for Method

9 years agoauto merge of #15698 : Zoxc/rust/code-model, r=alexcrichton
bors [Thu, 17 Jul 2014 12:11:19 +0000 (12:11 +0000)]
auto merge of #15698 : Zoxc/rust/code-model, r=alexcrichton

The default code model is usually unsuitable for kernels,
so we add an option to specify which model we want.

Testing for this would be fragile and very architecture specific and is better left to LLVM.

9 years agolint: add method to get level of a specific lint.
Huon Wilson [Thu, 17 Jul 2014 10:07:43 +0000 (20:07 +1000)]
lint: add method to get level of a specific lint.

This allows lint traversals to emit more information (when a lint is
non-allow), or avoid doing expensive computations (when a lint is
allow).

10 years agoauto merge of #15668 : steveklabnik/rust/tree_set_example, r=alexcrichton
bors [Thu, 17 Jul 2014 08:01:21 +0000 (08:01 +0000)]
auto merge of #15668 : steveklabnik/rust/tree_set_example, r=alexcrichton

Someone asked for an example usage of this on IRC, so I tossed together the simplest one. Obviously, this isn't up to snuff, but it's better than nothing.

10 years agoauto merge of #14022 : pcwalton/rust/explicit-self, r=pnkfelix
bors [Thu, 17 Jul 2014 06:21:21 +0000 (06:21 +0000)]
auto merge of #14022 : pcwalton/rust/explicit-self, r=pnkfelix

r? @nikomatsakis

10 years agolibrustc: Allow the new UFCS explicit self in trait definitions, and
Patrick Walton [Tue, 8 Jul 2014 06:19:35 +0000 (23:19 -0700)]
librustc: Allow the new UFCS explicit self in trait definitions, and
remove `~self` from the test suite.

10 years agosyntax: Add quote_method!
Ben Gamari [Thu, 17 Jul 2014 05:02:27 +0000 (01:02 -0400)]
syntax: Add quote_method!

10 years agoDisallow importing from types when reexport is involved
Seo Sanghyeon [Thu, 17 Jul 2014 04:50:54 +0000 (13:50 +0900)]
Disallow importing from types when reexport is involved

10 years agolibsyntax: Remove `Send` from `PtrTy` in `deriving`.
Patrick Walton [Tue, 8 Jul 2014 04:52:28 +0000 (21:52 -0700)]
libsyntax: Remove `Send` from `PtrTy` in `deriving`.

It'll be complex to port to the new explicit-self regime and it seems to
be unused.

10 years agolibrustc: Implement the fully-expanded, UFCS form of explicit self.
Patrick Walton [Tue, 6 May 2014 23:37:32 +0000 (16:37 -0700)]
librustc: Implement the fully-expanded, UFCS form of explicit self.

This makes two changes to region inference: (1) it allows region
inference to relate early-bound regions; and (2) it allows regions to be
related before variance runs. The former is needed because there is no
relation between the two regions before region substitution happens,
while the latter is needed because type collection has to run before
variance. We assume that, before variance is inferred, that lifetimes
are invariant. This is a conservative overapproximation.

This relates to #13885. This does not remove `~self` from the language
yet, however.

[breaking-change]

10 years agosyntax: Generalize ToTokens impl for Vec<T>
Ben Gamari [Thu, 17 Jul 2014 02:24:42 +0000 (22:24 -0400)]
syntax: Generalize ToTokens impl for Vec<T>

It will now `flat_map` over the elements of a `Vec<T>` if
`T: ToTokens`

10 years agosyntax: Add ToTokens for Attribute_
Ben Gamari [Thu, 17 Jul 2014 02:17:16 +0000 (22:17 -0400)]
syntax: Add ToTokens for Attribute_

10 years agosyntax: Add ToTokens for Option<T>
Ben Gamari [Thu, 17 Jul 2014 02:16:55 +0000 (22:16 -0400)]
syntax: Add ToTokens for Option<T>

10 years agoauto merge of #15652 : nick29581/rust/vec_index, r=acrichto
bors [Thu, 17 Jul 2014 01:16:19 +0000 (01:16 +0000)]
auto merge of #15652 : nick29581/rust/vec_index, r=acrichto

10 years agodeprecate Vec::get
Nick Cameron [Mon, 14 Jul 2014 23:37:25 +0000 (11:37 +1200)]
deprecate Vec::get

10 years agoAdd TreeSet example.
Steve Klabnik [Wed, 16 Jul 2014 22:11:40 +0000 (18:11 -0400)]
Add TreeSet example.

10 years agoauto merge of #15696 : Zoxc/rust/redzone, r=alexcrichton
bors [Wed, 16 Jul 2014 21:46:21 +0000 (21:46 +0000)]
auto merge of #15696 : Zoxc/rust/redzone, r=alexcrichton

Disabling the redzone is required in x86-64's kernel mode to avoid interrupts trashing the stack.

I'm not sure if decl_fn is the right place to tag all functions with noredzone. It might have interactions with external functions when linking with bitcode built without -C no-redzone although I see no reason to do that.

I'm not sure how to write a test inspecting the bitcode output for noredzone attributes on all functions either.

10 years agobtree: use pattern matching instead of unwrap
Florian Hahn [Wed, 16 Jul 2014 21:22:14 +0000 (23:22 +0200)]
btree: use pattern matching instead of unwrap

10 years agoImplement Index and IndexMut for Vec
Nick Cameron [Sun, 13 Jul 2014 23:03:23 +0000 (11:03 +1200)]
Implement Index and IndexMut for Vec

10 years agostability lint: ignore code from macro expansion
Aaron Turon [Wed, 16 Jul 2014 20:50:33 +0000 (13:50 -0700)]
stability lint: ignore code from macro expansion

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

10 years agoauto merge of #15667 : treeman/rust/set-doc, r=alexcrichton
bors [Wed, 16 Jul 2014 18:56:18 +0000 (18:56 +0000)]
auto merge of #15667 : treeman/rust/set-doc, r=alexcrichton

Example code for HashSet, similar to the [HashMap example](http://doc.rust-lang.org/std/collections/hashmap/struct.HashMap.html).

10 years agoImprove docs on JSON.
Ilya Dmitrichenko [Mon, 14 Jul 2014 21:41:16 +0000 (22:41 +0100)]
Improve docs on JSON.

- add one simple example of using `ToJson` trait
- make example code more readable

10 years agoauto merge of #15573 : michaelwoerister/rust/lldb-tests-rebased-09-Jul, r=alexcrichton
bors [Wed, 16 Jul 2014 17:16:20 +0000 (17:16 +0000)]
auto merge of #15573 : michaelwoerister/rust/lldb-tests-rebased-09-Jul, r=alexcrichton

This PR adds the LLDB autotests to the debuginfo test suite so I don't have to keep rebasing them locally. They are still disabled by default in `tests.mk`. One of the commits also contains a Python pretty printer which can make LLDB print values with Rust syntax. This was mainly added to deal with output format differences between LLDB versions but you can also use it for your normal LLDB debugging sessions.
```
// The following LLDB commands will load and activate the Rust printers
command script import ./src/etc/lldb_rust_formatters.py
type summary add --no-value --python-function lldb_rust_formatters.print_val -x .* --category Rust
type category enable Rust
```
Expect some rough edges with these, they have not been tested apart from there use in the autotests...

10 years agoauto merge of #15476 : kballard/rust/more_vim_tweaks, r=chris
bors [Wed, 16 Jul 2014 15:36:21 +0000 (15:36 +0000)]
auto merge of #15476 : kballard/rust/more_vim_tweaks, r=chris

Tweak the text editing settings (softtabstop, textwidth, etc).

Add some settings to turn on folding and colorcolumn.

Add the undo_ftplugin changes that my previous patch forgot.

10 years agoExtend HashSet documentation.
Jonas Hietala [Mon, 14 Jul 2014 17:29:29 +0000 (19:29 +0200)]
Extend HashSet documentation.

Add main example and simple examples for the methods.

10 years agoMain example for bigint usage.
Jonas Hietala [Wed, 16 Jul 2014 13:51:51 +0000 (15:51 +0200)]
Main example for bigint usage.

Also use `///` for documentation instead of `/**`. End comments with
`.`.

Show imports for bigint example.

They might be useful.

10 years agoExamples for Integer trait methods.
Jonas Hietala [Wed, 16 Jul 2014 14:17:41 +0000 (16:17 +0200)]
Examples for Integer trait methods.

10 years agoauto merge of #15693 : steveklabnik/rust/guide_fix_cargo, r=cmr
bors [Wed, 16 Jul 2014 12:06:15 +0000 (12:06 +0000)]
auto merge of #15693 : steveklabnik/rust/guide_fix_cargo, r=cmr

Cargo now comes with Rust!

10 years agoAdd an option to disable the use of the redzone
John Kåre Alsaker [Wed, 16 Jul 2014 11:35:50 +0000 (13:35 +0200)]
Add an option to disable the use of the redzone

Disabling the redzone is required in x86-64's kernel mode to avoid interrupts trashing the stack.

10 years agoauto merge of #15691 : jbclements/rust/method-field-cleanup, r=alexcrichton
bors [Wed, 16 Jul 2014 10:26:16 +0000 (10:26 +0000)]
auto merge of #15691 : jbclements/rust/method-field-cleanup, r=alexcrichton

This patch applies the excellent suggestion of @pnkfelix to group the helper methods for method field access into a Trait, making the code much more readable, and much more similar to the way it was before.

10 years agodebuginfo: Don't crash when encountering global variable with unknown source span.
Michael Woerister [Thu, 10 Jul 2014 13:38:57 +0000 (15:38 +0200)]
debuginfo: Don't crash when encountering global variable with unknown source span.

10 years agodebuginfo: Make sure that only one LLDB test task is run at a time.
Michael Woerister [Wed, 9 Jul 2014 14:22:39 +0000 (16:22 +0200)]
debuginfo: Make sure that only one LLDB test task is run at a time.

Some older versions of LLDB have problems with multiple instances running in parallel. This commit makes sure we don't do that.

10 years agodebuginfo: Add LLDB autotests to debuginfo test suite.
Michael Woerister [Wed, 9 Jul 2014 12:46:09 +0000 (14:46 +0200)]
debuginfo: Add LLDB autotests to debuginfo test suite.

This commit adds LLDB autotests to the test suite but does not activate them by default yet.

10 years agodebuginfo: Remove atexit()-debugger shutdown from lldb_batchmode.py
Michael Woerister [Wed, 9 Jul 2014 12:16:50 +0000 (14:16 +0200)]
debuginfo: Remove atexit()-debugger shutdown from lldb_batchmode.py

The shutdown call would always result in an exception being printed to standard error.

10 years agodebuginfo: Inject 'Rust-mode' LLDB prelude into debuginfo test scripts.
Michael Woerister [Wed, 9 Jul 2014 09:33:48 +0000 (11:33 +0200)]
debuginfo: Inject 'Rust-mode' LLDB prelude into debuginfo test scripts.

10 years agodebuginfo: Add python formatters that allow LLDB to print values with Rust syntax
Michael Woerister [Wed, 9 Jul 2014 08:18:40 +0000 (10:18 +0200)]
debuginfo: Add python formatters that allow LLDB to print values with Rust syntax

10 years agocomplement-lang-faq.md: fix typos
Philipp Gesang [Tue, 15 Jul 2014 21:59:13 +0000 (23:59 +0200)]
complement-lang-faq.md: fix typos

10 years agorustc.1: fix typo
Philipp Gesang [Tue, 15 Jul 2014 18:20:08 +0000 (20:20 +0200)]
rustc.1: fix typo

Uses the same wording as ``config.rs`` now.

10 years agoobsolete.rs: fix typo in message
Philipp Gesang [Tue, 15 Jul 2014 18:08:37 +0000 (20:08 +0200)]
obsolete.rs: fix typo in message

10 years agoauto merge of #15656 : nick29581/rust/index-bck, r=pnkfelix
bors [Wed, 16 Jul 2014 04:31:12 +0000 (04:31 +0000)]
auto merge of #15656 : nick29581/rust/index-bck, r=pnkfelix

Closes #15525

The important bit of this are the changes from line 445 in mem_categorization.rs. Most of the other changes are about adding an Implicit PointerKind, and this is only necessary for getting a decent error message :-s An alternative would have been to add an implciti/explicit flag to cat_deref, which could be mostly ignored and so would mean much fewer changes. However, the implicit state would only be valid if the PointerKind was BorrowedPtr, so it felt like it ought to be another kind of PointerKind. I still don't know which is the better design.

10 years agoauto merge of #15585 : bgamari/rust/subst-bug, r=pnkfelix
bors [Wed, 16 Jul 2014 02:11:14 +0000 (02:11 +0000)]
auto merge of #15585 : bgamari/rust/subst-bug, r=pnkfelix

This branch has a fix for #15557 (a2bcef9) as well as a variety of patches I found useful while debugging this issue. These include adding `Show` impls to a variety of types, including the majority of `syntax::ast` and some of `middle::ty`.

10 years agomk: Fix LD_LIBRARY_PATH_ENV_NAMES in cross build
klutzy [Mon, 14 Jul 2014 08:45:06 +0000 (17:45 +0900)]
mk: Fix LD_LIBRARY_PATH_ENV_NAMES in cross build

10 years agoauto merge of #15695 : alexcrichton/rust/fix-snapshots, r=brson
bors [Wed, 16 Jul 2014 00:31:15 +0000 (00:31 +0000)]
auto merge of #15695 : alexcrichton/rust/fix-snapshots, r=brson

This test seems to yield a different error message on cross compiles, so just
ignore it when cross compiling.

10 years agoAdd test for crash in unsafe destructor check
Ben Gamari [Sat, 12 Jul 2014 14:00:49 +0000 (10:00 -0400)]
Add test for crash in unsafe destructor check

10 years agomiddle::typeck::collect: Add debug output for lifetimes
Ben Gamari [Thu, 10 Jul 2014 19:30:49 +0000 (15:30 -0400)]
middle::typeck::collect: Add debug output for lifetimes

10 years agomiddle::kind: Don't crash when checking safety of Drop
Ben Gamari [Thu, 10 Jul 2014 18:05:28 +0000 (14:05 -0400)]
middle::kind: Don't crash when checking safety of Drop

To verify that a type can satisfy Send
`check_struct_safe_for_destructor` attempts to construct a new `ty::t`
an empty substitution list.

Previously the function would verify that the function has no type
parameters before attempting this. Unfortunately this check would not
catch functions with only regions parameters. In this case, the type
would eventually find its way to the substition engine which would
attempt to perform a substitution on the region parameters. As the
constructed substitution list is empty, this would fail, leading to a
compiler crash.

We fix this by verifying that types have both no type and region
parameters.

10 years agomiddle::subst: Better handling of parameter lookup failure
Ben Gamari [Wed, 9 Jul 2014 19:47:55 +0000 (15:47 -0400)]
middle::subst: Better handling of parameter lookup failure

10 years agotypeck::check::_match: Better error handling
Ben Gamari [Tue, 8 Jul 2014 23:45:36 +0000 (19:45 -0400)]
typeck::check::_match: Better error handling

Previously this was an Option::unwrap() which failed for me.
Unfortunately I've since inadvertently worked around the bug and have
been unable to reproduce it. With this patch hopefully the next person
to encounter this will be in a slightly better position to debug it.

10 years agoSupport for specifying the code model
John Kåre Alsaker [Tue, 15 Jul 2014 23:14:02 +0000 (23:14 +0000)]
Support for specifying the code model

The default code model is usually unsuitable for kernels,
so we add an option to specify which model we want.

10 years agomiddle: Derive Show impls
Ben Gamari [Sat, 12 Jul 2014 04:51:55 +0000 (00:51 -0400)]
middle: Derive Show impls

And change some uses of the `{:?}` format string to `{}`.