Commit Graph

46214 Commits

Author SHA1 Message Date
bors
86156ac606 Auto merge of #28175 - christopherdumas:master, r=nrc
per #28168. This is my first contribution. I don't know who to "r?" for source code changes.
2015-09-07 01:16:38 +00:00
bors
f6aac80375 Auto merge of #28270 - arielb1:raw-fat-ops, r=nrc
r? @nrc 

Fixes #17736
Fixes #18829
Fixes #23888
Fixes #28236
2015-09-06 23:24:11 +00:00
bors
3dd1a48f3f Auto merge of #27893 - nikomatsakis:mir, r=nrc
This PR contains a new crate, `rustc_mir`, which implements the MIR as specified in the RFC (more or less). There are no targeted unit tests at the moment, as I didn't decide what kind of infrastructure would be best and didn't take the time to implement it. 

~~NB: In packaging up this PR, I realized that MIR construction code is not triggering for methods right now, I think it's only for fixed fns. I'll push a fix for this soon. Hopefully it doesn't stop any crates from building. :)~~ Fixed. Everything still seems to work.

However, the MIR construction code (`librustc_mir/build`) is intentionally quite distinct from the code which munges the compiler's data structures (`librustc_mir/tcx`). The interface between the two is the `HIR` trait (`librustc_mir/hir`). To avoid confusion with @nrc's work, perhaps a better name for this trait is warranted, although ultimately this trait *will* be connected to the HIR, I imagine, so in a way the name is perfect. Anyway, I'm open to suggestions. The initial motivation for this split was to allow for the MIR construction code to be unit-tested. But while I didn't end up writing unit tests (yet), I did find the split made the code immensely easier to think about, since the messiness of our existing system, with its myriad hashtables, punning, and so forth, is confined to one part, which simply transforms to a more fully explicit AST-like form. I tried to separate out the commits somewhat, but since this mostly new code, it mostly winds up coming in one fell swoop in the MIR commit.

Quick guide to the MIR crate:

- `repr.rs` defines the MIR itself; each MIR instance is parameterized by some HIR `H`
- `build/` is the MIR construction code, parameterized by a particular HIR
- `hir/` is the definition of the HIR interface
- `tcx/` is the impl of the HIR interface for the tcx
- `dump.rs` is the minimal compiler pass that invokes the HIR

One open question:

- In the HIR trait, I used exclusively struct-like variants. I found I like this more, since things have names. Should I convert the repr code?
2015-09-06 21:31:26 +00:00
Niko Matsakis
c8a661838e enable slice patterns and enable building rustdoc 2015-09-06 16:48:57 -04:00
bors
01b9cc58ba Auto merge of #28269 - petrochenkov:docorder, r=steveklabnik
This is what I was talking about in https://github.com/rust-lang/rust/pull/26462#issuecomment-113883744

r? @steveklabnik
2015-09-06 19:43:06 +00:00
bors
a269e31a30 Auto merge of #28265 - boblehest:master, r=bluss
In the last code snippet on the following page there is a bug in the
implementation of Vec::drain().

https://doc.rust-lang.org/nightly/nomicon/vec-drain.html

```rust
pub fn drain(&mut self) -> Drain<T> {
    // Oops, setting it to 0 while we still need the old value!
    self.len = 0;

    unsafe {
        Drain {
            // len is used to create a &[T] from &self here,
            // so we end up always creating an empty slice.
            iter: RawValIter::new(&self),
            vec: PhantomData,
        }
    }
}
```

A simple test to verify that Drain is broken can be found here:
https://play.rust-lang.org/?gist=30f579565e4bbf4836ce&version=nightly

And here's one with a fixed implementation:
https://play.rust-lang.org/?gist=2ec0c1a6dcf5defd7a53&version=nightly
2015-09-06 17:55:04 +00:00
Jørn Lode
97dd25094c Rustonomicon: Reword potentially confusing comment in Vec::drain. 2015-09-06 18:21:57 +02:00
christopherdumas
cd9c9f048f functional structure update syntax -> structure update syntax 2015-09-06 09:13:20 -07:00
Ariel Ben-Yehuda
34bc99f860 implement raw fat pointer ops 2015-09-06 16:11:38 +03:00
Vadim Petrochenkov
c34f350664 Further tweaks to doc/index.md 2015-09-06 16:07:55 +03:00
Vadim Petrochenkov
201bfbe55e Reorder sections in doc/index.md 2015-09-06 15:25:01 +03:00
Niko Matsakis
99f3bfc20c convert TODOs to FIXMEs 2015-09-06 07:27:23 -04:00
Niko Matsakis
013c37a692 fix EUV delegate to take advantage of defaults. This also
works around a stage0 bug that has since been fixed.
2015-09-06 07:27:23 -04:00
Niko Matsakis
9b45874445 plumbing to automatically run MIR for crates where it works;
this serves as a poor man's unit test infrastructure until
MIR is more built up
2015-09-06 07:27:23 -04:00
Niko Matsakis
faa9ec81b5 add MIR crate and link it into the driver 2015-09-06 07:27:23 -04:00
Niko Matsakis
6a2ca37f1b add -Z always-build-mir option 2015-09-06 07:27:23 -04:00
Niko Matsakis
9bd35c07c2 add MIR code (unused thus far) 2015-09-06 07:27:23 -04:00
Niko Matsakis
0e764ec5ce extract autoderef type adjustment code into a reusable
helper
2015-09-06 07:27:22 -04:00
Niko Matsakis
714f2a8921 move fnv hashing support into librustc_data_structures 2015-09-06 07:27:22 -04:00
Niko Matsakis
4f5267dba3 add a few accessors to Graph 2015-09-06 07:27:22 -04:00
Niko Matsakis
004d70212a track, for each upvar, its index in list of upvars 2015-09-06 07:27:22 -04:00
Niko Matsakis
9b52c5bfff generalize graphviz library to handle HTML tags and other such things 2015-09-06 07:27:22 -04:00
Jørn Lode
c08deef982 Rustonomicon: Fix bug in implementation of Vec::drain()
In the last code snippet on the following page there is a bug in the
implementation of Vec::drain().

https://doc.rust-lang.org/nightly/nomicon/vec-drain.html

```rust
pub fn drain(&mut self) -> Drain<T> {
    // Oops, setting it to 0 while we still need the old value!
    self.len = 0;

    unsafe {
        Drain {
            // len is used to create a &[T] from &self here,
            // so we end up always creating an empty slice.
            iter: RawValIter::new(&self),
            vec: PhantomData,
        }
    }
}
```

A simple test to verify that Drain is broken can be found here:
https://play.rust-lang.org/?gist=30f579565e4bbf4836ce&version=nightly

And here's one with a fixed implementation:
https://play.rust-lang.org/?gist=2ec0c1a6dcf5defd7a53&version=nightly
2015-09-06 03:44:13 +02:00
bors
f84d53ca0a Auto merge of #28259 - christopherdumas:fix_empty_link, r=Manishearth 2015-09-06 01:01:38 +00:00
bors
53e694e19b Auto merge of #28190 - arielb1:generic-key-entry, r=eddyb
Fixes #28181
This may fix #28151

r? @pnkfelix
2015-09-05 22:15:40 +00:00
christopherdumas
3fa1ee4677 Added link for hygenic macro system in macros.md 2015-09-05 06:04:15 -07:00
bors
205c356ace Auto merge of #28249 - stepancheg:get-num-cpus, r=huonw
No need to export this symbol. `rust_get_num_cpus` is exported.
2015-09-05 12:47:47 +00:00
bors
5c2cfdfb79 Auto merge of #28258 - Manishearth:rollup, r=Manishearth
- Successful merges: #28225, #28231, #28234, #28253
- Failed merges:
2015-09-05 11:01:42 +00:00
Manish Goregaokar
1bf060ffb3 Rollup merge of #28253 - murarth:prelude-typo, r=steveklabnik 2015-09-05 16:16:02 +05:30
Manish Goregaokar
d7afefcbd1 Rollup merge of #28234 - AlisdairO:diagnostics247, r=Manishearth
As title :-)
Part of #24407.

r? @Manishearth
2015-09-05 16:16:01 +05:30
Manish Goregaokar
6ed1c590d2 Rollup merge of #28231 - GuillaumeGomez:help_note, r=Manishearth
r? @Manishearth
2015-09-05 16:16:01 +05:30
Manish Goregaokar
3610c731f3 Rollup merge of #28225 - jackwilsonv:patch-3, r=steveklabnik
r? @steveklabnik
2015-09-05 16:16:01 +05:30
Guillaume Gomez
771ab35c3d Add erroneous code example for E0010 2015-09-05 11:23:50 +02:00
bors
6b36e921f4 Auto merge of #28242 - Diggsey:msvc-backtrace, r=alexcrichton
Currently LLVM does not generate the debug info required to get complete backtraces even when functions are inlined, so that part of the `run-pass/backtrace-debuginfo.rs` test is disabled when targetting MSVC. At worst this results in missing stack frames where functions have been inlined.
2015-09-05 07:21:01 +00:00
Murarth
f7ffd502e5 Fix typo in prelude docs 2015-09-04 21:27:55 -07:00
bors
973da4fe6f Auto merge of #28240 - nhowell:master, r=steveklabnik
The Introduction page generated by rustbook used weird relative links
like "./getting-started.html" instead of just "getting-started.html"
like on the other pages. This adversely affected Windows builds the
worst, since it generated links like ".\getting-started.html" (note the
backslash). If you then try to upload the generated book to a webserver,
you end up with 404's. See this example of what is going on with the
Introduction page links and why this PR should fix it:
http://is.gd/fRUTXk

Compare the links on these two pages, for instance:
https://doc.rust-lang.org/nightly/book/
https://doc.rust-lang.org/nightly/book/getting-started.html

Also, fix a few whitespace issues in build.rs.
2015-09-05 04:03:34 +00:00
bors
7ee876cb8e Auto merge of #28221 - huonw:simd, r=alexcrichton
The ARM equivalents of the AArch64 are annoyingly more complicated (and some of the AArch64 ones are too).

I think I've got exposed all the x86 intrinsics from SSE to AVX2 now (at least, the ones that LLVM implements as callable intrinsics).
2015-09-05 02:15:41 +00:00
Stepan Koltsov
6ca5d52bd2 get_num_cpus function should be static
No need to export this symbol. `rust_get_num_cpus` is exported.
2015-09-05 05:03:48 +03:00
Diggory Blake
9a83842849 Add line numbers to MSVC backtrace
Add comments
2015-09-05 00:56:53 +01:00
bors
779b2a9847 Auto merge of #28161 - nrc:fmt, r=brson 2015-09-04 23:32:35 +00:00
Nick Cameron
6a127e95c7 fixup 2015-09-05 09:45:35 +12:00
Nick Cameron
edca8f73d6 rustfmt librustc_trans/save 2015-09-05 09:45:35 +12:00
Nick Howell
0f0c48b0b1 rustbook: Fix relative links on the Introduction page
The Introduction page generated by rustbook used weird relative links
like "./getting-started.html" instead of just "getting-started.html"
like on the other pages. This adversely affected Windows builds the
worst, since it generated links like ".\getting-started.html" (note the
backslash). If you then try to upload the generated book to a webserver,
you end up with 404's. See this example of what is going on with the
Introduction page links and why this PR should fix it:
http://is.gd/fRUTXk

Compare the links on these two pages, for instance:
https://doc.rust-lang.org/nightly/book/
https://doc.rust-lang.org/nightly/book/getting-started.html

Also, fix a few whitespace issues in build.rs.
2015-09-04 17:00:33 -04:00
bors
1110f1e873 Auto merge of #28197 - petrochenkov:borrow, r=alexcrichton 2015-09-04 20:23:51 +00:00
Alisdair Owens
8175dce517 Add long diagnostics for E0247 2015-09-04 19:22:11 +01:00
bors
668dac477e Auto merge of #28035 - Diggsey:msvc-escaping, r=alexcrichton
This fixes #28018 with the exception of the point about cmake, but that's really a limitation of `./configure` builds.
2015-09-04 17:58:35 +00:00
bors
62c45f4f25 Auto merge of #28227 - birkenfeld:use_filter_map, r=alexcrichton 2015-09-04 16:16:09 +00:00
Huon Wilson
67aa4c775a Add some fancier AArch64 load/store instructions. 2015-09-04 09:14:13 -07:00
Huon Wilson
7241ae9112 Support return aggregates in platform intrinsics.
This also involved adding `[TYPE;N]` syntax and aggregate indexing
support to the generator script: it's the only way to be able to have a
parameterised intrinsic that returns an aggregate, since one can't refer
to previous elements of the current aggregate (and that was harder to
implement).
2015-09-04 09:14:13 -07:00
Huon Wilson
c19e7b629b Add various pointer & void-using x86 intrinsics. 2015-09-04 09:14:13 -07:00