Commit Graph

30673 Commits

Author SHA1 Message Date
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
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
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
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
bors
dd348b3ab0 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.
2014-07-17 12:11:19 +00:00
bors
9fc8394d3b 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.
2014-07-17 08:01:21 +00:00
bors
32cb44bfff auto merge of #14022 : pcwalton/rust/explicit-self, r=pnkfelix
r? @nikomatsakis
2014-07-17 06:21:21 +00:00
Patrick Walton
00c70d1a80 librustc: Allow the new UFCS explicit self in trait definitions, and
remove `~self` from the test suite.
2014-07-16 23:16:12 -07:00
Patrick Walton
fe49cbeb82 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.
2014-07-16 20:01:53 -07:00
Patrick Walton
357d5cd96c 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]
2014-07-16 20:01:52 -07:00
bors
459ffc2adc auto merge of #15652 : nick29581/rust/vec_index, r=acrichto 2014-07-17 01:16:19 +00:00
Nick Cameron
aa760a849e deprecate Vec::get 2014-07-17 12:08:31 +12:00
Steve Klabnik
ace3a77f74 Add TreeSet example. 2014-07-16 18:11:40 -04:00
bors
d3adccda4e 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.
2014-07-16 21:46:21 +00:00
Nick Cameron
b35d1a8368 Implement Index and IndexMut for Vec 2014-07-17 09:06:56 +12:00
bors
06c7ee9c56 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).
2014-07-16 18:56:18 +00:00
Ilya Dmitrichenko
7beb5507ff Improve docs on JSON.
- add one simple example of using `ToJson` trait
- make example code more readable
2014-07-16 19:30:54 +01:00
bors
175f113cba 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...
2014-07-16 17:16:20 +00:00
bors
316719e625 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.
2014-07-16 15:36:21 +00:00
Jonas Hietala
80ef6b83ef Extend HashSet documentation.
Add main example and simple examples for the methods.
2014-07-16 17:26:57 +02:00
Jonas Hietala
428c7bc129 Main example for bigint usage.
Also use `///` for documentation instead of `/**`. End comments with
`.`.

Show imports for bigint example.

They might be useful.
2014-07-16 17:16:00 +02:00
bors
058242141b auto merge of #15693 : steveklabnik/rust/guide_fix_cargo, r=cmr
Cargo now comes with Rust!
2014-07-16 12:06:15 +00:00
John Kåre Alsaker
036b9e8e3e 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.
2014-07-16 13:35:50 +02:00
bors
efbbb51ec0 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.
2014-07-16 10:26:16 +00:00
Michael Woerister
3b336b20ce 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.
2014-07-16 09:46:49 +02:00
Michael Woerister
c7f45a9458 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.
2014-07-16 09:46:31 +02:00
Michael Woerister
b56ef794a0 debuginfo: Remove atexit()-debugger shutdown from lldb_batchmode.py
The shutdown call would always result in an exception being printed to standard error.
2014-07-16 09:27:06 +02:00
Michael Woerister
ba287f6e31 debuginfo: Inject 'Rust-mode' LLDB prelude into debuginfo test scripts. 2014-07-16 09:27:06 +02:00
Michael Woerister
83fe455e3c debuginfo: Add python formatters that allow LLDB to print values with Rust syntax 2014-07-16 09:27:05 +02:00
Philipp Gesang
a1def0856e
complement-lang-faq.md: fix typos 2014-07-16 08:01:59 +02:00
Philipp Gesang
be1fe29ec4
rustc.1: fix typo
Uses the same wording as ``config.rs`` now.
2014-07-16 08:01:59 +02:00
Philipp Gesang
778529b13e
obsolete.rs: fix typo in message 2014-07-16 08:01:54 +02:00
bors
6c35d513ce 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.
2014-07-16 04:31:12 +00:00
bors
c523d86552 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`.
2014-07-16 02:11:14 +00:00
klutzy
711e43959a mk: Fix LD_LIBRARY_PATH_ENV_NAMES in cross build 2014-07-16 10:53:15 +09:00
bors
afbcbbc77f 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.
2014-07-16 00:31:15 +00:00
Ben Gamari
446f9373c0 Add test for crash in unsafe destructor check 2014-07-15 19:34:42 -04:00
Ben Gamari
d2c38aa6eb middle::typeck::collect: Add debug output for lifetimes 2014-07-15 19:34:42 -04:00
Ben Gamari
6867d91d20 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.
2014-07-15 19:34:42 -04:00
Ben Gamari
c6c1a22c56 middle::subst: Better handling of parameter lookup failure 2014-07-15 19:34:41 -04:00
Ben Gamari
741bb1a57e 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.
2014-07-15 19:34:41 -04:00
John Kåre Alsaker
0a31060815 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.
2014-07-15 23:21:22 +00:00
Ben Gamari
bdf5b6c3da middle: Derive Show impls
And change some uses of the `{:?}` format string to `{}`.
2014-07-15 18:54:47 -04:00
Ben Gamari
69ffcdcccf libsyntax::ast: Derive Show impls 2014-07-15 18:54:47 -04:00
bors
2692ae1ddd auto merge of #15619 : kwantam/rust/master, r=huonw
- `width()` computes the displayed width of a string, ignoring the width of control characters.
    - arguably we might do *something* else for control characters, but the question is, what?
    - users who want to do something else can iterate over chars()

- `graphemes()` returns a `Graphemes` struct, which implements an iterator over the grapheme clusters of a &str.
    - fully compliant with [UAX#29](http://www.unicode.org/reports/tr29/#Grapheme_Cluster_Boundaries)
    - passes all [Unicode-supplied tests](http://www.unicode.org/reports/tr41/tr41-15.html#Tests29)

- added code to generate additionial categories in `unicode.py`
    - `Cn` aka `Not_Assigned`
    - categories necessary for grapheme cluster breaking

- tidied up the exports from libunicode
  - all exports are exposed through a module rather than directly at crate root.
  - std::prelude imports UnicodeChar and UnicodeStrSlice from std::char and std::str rather than directly from libunicode

closes #7043
2014-07-15 22:51:17 +00:00
John Clements
ca05828cb7 change to new trait style for method field refs
Per @pnkfelix 's suggestion, using a trait to make these
field accesses more readable (and vastly more similar
to the original code.

oops fix new ast_map fix
2014-07-15 14:46:32 -07:00
John Clements
154ca08388 use trait rather than fns
please note the snapshot-waiting unpleasantness. I'm
unable to use the traditional #[cfg(stage0)] mechanism
to swap the new style in for later compiler stages,
because macros invocations in method positions cause
the parser to choke before cfg can strip it out.

Parenthetical note: this problem wouldn't arise with
an interleaved parsing/expansion....
2014-07-15 14:33:14 -07:00
bors
de111e69a8 auto merge of #15615 : jakub-/rust/diagnostics, r=brson 2014-07-15 21:06:12 +00:00
Alex Crichton
d2a08e9011 test: Try to fix a failing snapshot test
This test seems to yield a different error message on cross compiles, so just
ignore it when cross compiling.
2014-07-15 14:00:37 -07:00