Commit Graph

24259 Commits

Author SHA1 Message Date
Corey Richardson
8a8cccd4b6 Explain potentially confusing string example.
Reported be @ElBaha
2013-12-10 07:28:24 -05:00
bors
e5f2021202 auto merge of #10874 : vadimcn/rust/integrated-as, r=alexcrichton
Last LLVM update seems to have fixed whatever prevented LLVM integrated assembler from generating correct unwind tables on Windows.   This PR switches Windows builds to use internal assembler by default.
Compilation via external assembler can still be requested via the newly added `-Z no-integrated-as` option.

Closes #8809
2013-12-09 01:01:43 -08:00
bors
09db61fb4f auto merge of #10867 : sfackler/rust/unsugared-doc, r=huonw
Closes #10853
2013-12-08 22:06:25 -08:00
Vadim Chugunov
c8498c1933 Disable failing test. 2013-12-08 21:19:55 -08:00
Vadim Chugunov
554c3c316e Use LLVM integrated assembler on Windows too. 2013-12-08 20:14:36 -08:00
Steven Fackler
4d688e8214 Accept unsugared docs in missing-doc lint
Closes #10853
2013-12-08 20:08:49 -08:00
bors
9f3be466e1 auto merge of #10866 : ktt3ja/rust/edit-doc, r=huonw
A comment that I previously added to ast::DefStruct is incorrect. Here's the modification.
2013-12-08 19:26:23 -08:00
Kiet Tran
1f80ec4fec Fix comment on ast::DefStruct 2013-12-08 21:21:15 -05:00
bors
898d2c33b7 auto merge of #10813 : dwrensha/rust/xcrate-lifetime-param, r=huonw
Before applying this patch, the included testcase fails with:
```
src/test/run-pass/xcrate-trait-lifetime-param.rs:20:10: 20:28 error: wrong number of lifetime parameters: expected 0 but found 1
src/test/run-pass/xcrate-trait-lifetime-param.rs:20 impl <'a> other::FromBuf<'a> for Reader<'a> {
                                                              ^~~~~~~~~~~~~~~~~~
```

There's another example in my comments to #10506.
2013-12-08 16:06:22 -08:00
David Renshaw
d99efe84df encode trait lifetime params in metadata to allow cross-crate usage 2013-12-08 18:09:31 -05:00
bors
a6310f6ad3 auto merge of #10477 : ktt3ja/rust/dead-code, r=alexcrichton
PR for issue #1749 mainly to get some feedback and suggestion. This adds a pass that warns if a function, struct, enum, or static item is never used. For the following code,

```rust
pub static pub_static: int = 0;
static priv_static: int = 0;
static used_static: int = 0;

pub fn pub_fn() { used_fn(); }
fn priv_fn() { let unused_struct = PrivStruct; }
fn used_fn() {}

pub struct PubStruct();
struct PrivStruct();
struct UsedStruct1 { x: int }
struct UsedStruct2(int);
struct UsedStruct3();

pub enum pub_enum { foo1, bar1 }
enum priv_enum { foo2, bar2 }
enum used_enum { foo3, bar3 }

fn foo() {
	bar();
	let unused_enum = foo2;
}

fn bar() {
	foo();
}

fn main() {
	let used_struct1 = UsedStruct1 { x: 1 };
	let used_struct2 = UsedStruct2(1);
	let used_struct3 = UsedStruct3;
	let t = used_static;
	let e = foo3;
}
```

it would add the following warnings:

```rust
/home/ktt3ja/test.rs:2:0: 2:28 warning: code is never used: `priv_static`, #[warn(dead_code)] on by default
/home/ktt3ja/test.rs:2 static priv_static: int = 0;
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/ktt3ja/test.rs:6:0: 6:48 warning: code is never used: `priv_fn`, #[warn(dead_code)] on by default
/home/ktt3ja/test.rs:6 fn priv_fn() { let unused_struct = PrivStruct; }
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/ktt3ja/test.rs:10:0: 10:20 warning: code is never used: `PrivStruct`, #[warn(dead_code)] on by default
/home/ktt3ja/test.rs:10 struct PrivStruct();
                        ^~~~~~~~~~~~~~~~~~~~
/home/ktt3ja/test.rs:16:0: 16:29 warning: code is never used: `priv_enum`, #[warn(dead_code)] on by default
/home/ktt3ja/test.rs:16 enum priv_enum { foo2, bar2 }
                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/ktt3ja/test.rs:19:0: 22:1 warning: code is never used: `foo`, #[warn(dead_code)] on by default
/home/ktt3ja/test.rs:19 fn foo() {
/home/ktt3ja/test.rs:20 	bar();
/home/ktt3ja/test.rs:21 	let unused_enum = foo2;
/home/ktt3ja/test.rs:22 }
/home/ktt3ja/test.rs:24:0: 26:1 warning: code is never used: `bar`, #[warn(dead_code)] on by default
/home/ktt3ja/test.rs:24 fn bar() {
/home/ktt3ja/test.rs:25 	foo();
/home/ktt3ja/test.rs:26 }
```

Furthermore, I would like to solicit some test cases since I haven't tested extensively and I'm still unclear about some of the things in here. For example, I'm not sure how reexports would affect this and just assumed that LiveContext (which is a copy of reachable::ReachableContext) does enough work to handle it. Also, the test case above doesn't include any impl or methods, etc.
2013-12-08 11:51:22 -08:00
bors
af6010ca0b auto merge of #10855 : alexcrichton/rust/snapshots, r=pcwalton
This transitions the snapshot dependency process to understand that our
snapshots are now a single static binary rather than an array of files.
2013-12-08 10:31:32 -08:00
Kiet Tran
1755408d1a Remove dead codes 2013-12-08 02:55:28 -05:00
Kiet Tran
c06dd0e0af Add dead-code warning pass 2013-12-08 02:55:27 -05:00
Alex Crichton
70273bb1d6 Register new snapshots
This transitions the snapshot dependency process to understand that our
snapshots are now a single static binary rather than an array of files.
2013-12-07 23:02:39 -08:00
bors
49b751dda1 auto merge of #10850 : alexcrichton/rust/fix-target, r=pcwalton
Right now multiple targets/hosts is broken because the libdir passed for all of
the LLVM libraries is for the wrong architecture. By using the right arch
(target, not host), everything is linked and assembled just fine.
2013-12-07 10:51:12 -08:00
Alex Crichton
f04d6241cb Fix the linked targets for rustc
Right now multiple targets/hosts is broken because the libdir passed for all of
the LLVM libraries is for the wrong architecture. By using the right arch
(target, not host), everything is linked and assembled just fine.
2013-12-07 10:38:32 -08:00
bors
67aca9c9af auto merge of #10844 : huonw/rust/deriving-expn-info, r=alexcrichton
Previously something like

    struct NotEq;

    #[deriving(Eq)]
    struct Error {
        foo: NotEq
    }

would just point to the `foo` field, with no mention of the
`deriving(Eq)`. With this patch, the compiler creates a note saying "in
expansion of #[deriving(Eq)]" pointing to the Eq.

(includes some cleanup/preparation; the commit view might be nicer, to filter out the noise of the first one.)
2013-12-07 05:11:10 -08:00
bors
7c719ec1bc auto merge of #10831 : luqmana/rust/9382, r=nikomatsakis
Fixes #9382.

r? @nikomatsakis
2013-12-07 03:41:12 -08:00
bors
5466462b85 auto merge of #10824 : huonw/rust/str-doc, r=alexcrichton
Fixes #10819.
2013-12-07 01:36:17 -08:00
bors
3abc350ea4 auto merge of #10797 : pradeep90/rust/rust-mode-changes, r=brson
+ Delete trailing whitespace.
2013-12-06 23:46:20 -08:00
bors
70d66ae085 auto merge of #10364 : Kimundi/rust/result_compose, r=alexcrichton
This implements parts of the changes to `Result` and `Option` I proposed and discussed in this thread: https://mail.mozilla.org/pipermail/rust-dev/2013-November/006254.html

This PR includes:
- Adding `ok()` and `err()` option adapters for both `Result` variants.
- Removing `get_ref`, `expect` and iterator constructors for `Result`, as they are reachable with the variant adapters.
- Removing `Result`s `ToStr` bound on the error type because of composability issues. (See https://mail.mozilla.org/pipermail/rust-dev/2013-November/006283.html)
- Some warning cleanups
2013-12-06 22:21:18 -08:00
bors
820271df1c auto merge of #10809 : alexcrichton/rust/static-snapshot, r=alexcrichton
Now that we have the necessary logic in rustc for windows, this is possible to land.
2013-12-06 21:01:32 -08:00
Alex Crichton
e91ffb0710 Link rustllvm statically, and distribute a static snapshot
In order to keep up to date with changes to the libraries that `llvm-config`
spits out, the dependencies to the LLVM are a dynamically generated rust file.
This file is now automatically updated whenever LLVM is updated to get kept
up-to-date.

At the same time, this cleans out some old cruft which isn't necessary in the
makefiles in terms of dependencies.

Closes #10745
Closes #10744
2013-12-06 20:51:17 -08:00
Huon Wilson
c629b1d9de std::str: Add examples to the StrSlice trait.
Fixes #10819.
2013-12-07 13:59:36 +11:00
Huon Wilson
0c0e73eed6 syntax::deriving: indicate from which trait type errors (etc) arise
using the expansion info.

Previously something like

    struct NotEq;

    #[deriving(Eq)]
    struct Error {
        foo: NotEq
    }

would just point to the `foo` field, with no mention of the
`deriving(Eq)`. With this patch, the compiler creates a note saying "in
expansion of #[deriving(Eq)]" pointing to the Eq.
2013-12-07 13:43:22 +11:00
Huon Wilson
3ef933647a syntax: print expansion info from #[attribute] macros in the correct
format.

Previously, any attempt to use this information from inside something
like #[deriving(Foo)] would result in it printing like `deriving(Foo)!`.
2013-12-07 13:41:11 +11:00
Huon Wilson
09a879460c syntax::deriving: add the cx and span to the TraitDef to reduce duplication. 2013-12-07 11:57:44 +11:00
Marvin Löbel
142eb685f9 Made Results API more composable 2013-12-06 22:29:02 +01:00
Luqman Aden
920ca61871 librustc: Pass the correct type when adding cleanups. 2013-12-06 15:47:14 -05:00
bors
aa4455e4c7 auto merge of #10832 : chris-morgan/rust/let's-lop-lang-item-line-count, r=alexcrichton
This should make maintenance of lang items simpler and also reduces the
line count by about 201 lines.
2013-12-06 01:11:18 -08:00
bors
2eb22ae2b4 auto merge of #10665 : cmr/rust/doc_lint, r=alexcrichton
Because the root module isn't actually an item, we need to do some hackish
handling of it.

Closes #10656.
2013-12-05 23:41:19 -08:00
Corey Richardson
30a5612830 Check crate root for docs in missing_doc lint.
Because the root module isn't actually an item, we need to do some hackish
handling of it.

Closes #10656.
2013-12-06 01:39:32 -05:00
bors
f9aecdb22a auto merge of #10758 : alexcrichton/rust/upgrade-llvm, r=alexcrichton
This upgrades LLVM in order to make progress on #10708, and it's also been awhile since we last upgraded!

The contentious point of this upgrade is that all JIT support has been removed because LLVM is changing it and we're not keeping up with it.
2013-12-05 21:26:19 -08:00
Chris Morgan
0b1bbc5fd6 Use a macro in lang_items to remove duplication.
This should make maintenance of lang items simpler and also reduces the
line count by about 201 lines.
2013-12-06 15:24:25 +11:00
bors
9fc48061d7 auto merge of #10721 : osa1/rust/intermediatestr, r=brson
as recommended by @huonw on this PR https://github.com/mozilla/rust/pull/10711 , I removed intermediate step that generates a string instead of directly writing to Writer without generating intermediate string.
2013-12-05 18:56:19 -08:00
bors
6e5c5a6ac1 auto merge of #10675 : LeoTestard/rust/lifetimes-no-keywords, r=brson
Fixes #10565.

`'self` is still allowed for the moment, as it is used everywhere in the codebase. And I'm not sure if it still has a special meaning currently or not.
2013-12-05 17:41:18 -08:00
Alex Crichton
17a951c7bf Remove unused upcalls
The main one removed is rust_upcall_reset_stack_limit (continuation of #10156),
and this also removes the upcall_trace function. The was hidden behind a
`-Z trace` flag, but if you attempt to use this now you'll get a linker error
because there is no implementation of the 'upcall_trace' function. Due to this
no longer working, I decided to remove it entirely from the compiler (I'm also a
little unsure on what it did in the first place).
2013-12-05 16:29:16 -08:00
bors
6708c297a8 auto merge of #10506 : nikomatsakis/rust/issue-10391-ICE-with-lifetimes, r=pnkfelix
Make trait lifetime parameters early bound in static fn type. Reasoning for this change is (hopefully) explained well enough in the comment, so I'll not duplicate it here. Fixes #10391.

r? @pnkfelix
2013-12-05 16:26:20 -08:00
Niko Matsakis
e9d364d1df Fix test for #10391 to have pub main 2013-12-05 18:25:01 -05:00
bors
55353137a6 auto merge of #10562 : ongardie/rust/master, r=brson
It's useful to allow users to get at the internal std::rc::comm::Port,
and other such fields, since they implement important traits like
Select.

See [rust-dev] "select on std::comm::Port and different types" at https://mail.mozilla.org/pipermail/rust-dev/2013-November/006735.html for background.
2013-12-05 15:16:27 -08:00
bors
ad6f6cb589 auto merge of #10817 : alexcrichton/rust/sched-fix, r=brson
Right now, as pointed out in #8132, it is very easy to introduce a subtle race
in the runtime. I believe that this is the cause of the current flakiness on the
bots.

I have taken the last idea mentioned in that issue which is to use a lock around
descheduling and context switching in order to solve this race.

Closes #8132
2013-12-05 14:01:46 -08:00
bors
3cc86d8ab3 auto merge of #10211 : ktt3ja/rust/add-lrucache, r=brson
There's an open issue ([Issue #4988](https://github.com/mozilla/rust/issues/4988?source=cc)) for adding an LRU Cache to the standard library. I'm new to this so I hope I didn't miss anything I'm supposed to do.
2013-12-05 12:32:12 -08:00
Léo Testard
74757af096 Forbid keywords as lifetime parameters names. 2013-12-05 21:06:00 +01:00
bors
617ce856db auto merge of #10825 : octurion/rust/master, r=alexcrichton 2013-12-05 09:46:29 -08:00
Alex Crichton
be0580b191 Solve some nasty deschedulinging races with a lock
Right now, as pointed out in #8132, it is very easy to introduce a subtle race
in the runtime. I believe that this is the cause of the current flakiness on the
bots.

I have taken the last idea mentioned in that issue which is to use a lock around
descheduling and context switching in order to solve this race.

Closes #8132
2013-12-05 09:40:06 -08:00
Alex Crichton
6b34ba242d Update LLVM and jettison jit support
LLVM's JIT has been updated numerous times, and we haven't been tracking it at
all. The existing LLVM glue code no longer compiles, and the JIT isn't used for
anything currently.

This also rebases out the FixedStackSegment support which we have added to LLVM.
None of this is still in use by the compiler, and there's no need to keep this
functionality around inside of LLVM.

This is needed to unblock #10708 (where we're tripping an LLVM assertion).
2013-12-05 09:15:54 -08:00
Alexandros Tasos
8257dbd2c6 Fix documentation typo (divison operator is not backslash) 2013-12-05 16:24:48 +02:00
bors
b5bab85c1a auto merge of #10796 : kballard/rust/revert-new-naming, r=alexcrichton
Rename the `*::init()` functions back to `*::new()`, since `new` is not
going to become a keyword.
2013-12-04 23:26:19 -08:00
Kevin Ballard
b1705714d5 Rename std::rt::deque::*::init() to *::new() 2013-12-04 22:33:53 -08:00