Commit Graph

53081 Commits

Author SHA1 Message Date
bors
1ec22171e6 Auto merge of #33130 - eddyb:mir-const, r=nikomatsakis
Implement constant support in MIR.

All of the intended features in `trans::consts` are now supported by `mir::constant`.
The implementation is considered a temporary measure until `miri` replaces it.

A `-Z orbit` bootstrap build will only translate LLVM IR from AST for `#[rustc_no_mir]` functions.

Furthermore, almost all checks of constant expressions have been moved to MIR.
In non-`const` functions, trees of temporaries are promoted, as per RFC 1414 (rvalue promotion).
Promotion before MIR borrowck would allow reasoning about promoted values' lifetimes.

The improved checking comes at the cost of four `[breaking-change]`s:
* repeat counts must contain a constant expression, e.g.:
`let arr = [0; { println!("foo"); 5 }];` used to be allowed (it behaved like `let arr = [0; 5];`)
* dereference of a reference to a `static` cannot be used in another `static`, e.g.:
`static X: [u8; 1] = [1]; static Y: u8 = (&X)[0];` was unintentionally allowed before
* the type of a `static` *must* be `Sync`, irrespective of the initializer, e.g.
`static FOO: *const T = &BAR;` worked as `&T` is `Sync`, but it shouldn't because `*const T` isn't
* a `static` cannot wrap `UnsafeCell` around a type that *may* need drop, e.g.
`static X: MakeSync<UnsafeCell<Option<String>>> = MakeSync(UnsafeCell::new(None));`
was previously allowed based on the fact `None` alone doesn't need drop, but in `UnsafeCell`
it can be later changed to `Some(String)` which *does* need dropping

The drop restrictions are relaxed by RFC 1440 (#33156), which is implemented, but feature-gated.
However, creating `UnsafeCell` from constants is unstable, so users can just enable the feature gate.
2016-05-08 00:31:40 -07:00
Eduard Burtescu
3b0e27cc74 trans: handle string literal reborrows. 2016-05-08 06:23:50 +03:00
Eduard Burtescu
3001626595 Always remove tmp/partitioning-tests before check-codegen-units to work around #33435. 2016-05-07 23:44:52 +03:00
bors
d91f8ab0f5 Auto merge of #33487 - steveklabnik:rollup, r=steveklabnik
Rollup of 20 pull requests

- Successful merges: #33256, #33283, #33313, #33314, #33326, #33336, #33382, #33384, #33402, #33409, #33410, #33412, #33428, #33430, #33437, #33438, #33439, #33442, #33456, #33459
- Failed merges:
2016-05-07 12:36:18 -07:00
Steve Klabnik
84e27738ef Rollup merge of #33459 - frewsxcv:patch-29, r=guillaumegomez
Indicate struct names are code-like in doc-comment.
2016-05-07 15:35:19 -04:00
Steve Klabnik
099e0879aa Rollup merge of #33456 - CryZe:barrier-wait-docs, r=GuillaumeGomez
Fix Typo in Barrier::wait documentation

This should be `have` instead of `has`.
2016-05-07 15:35:19 -04:00
Steve Klabnik
f4453bba95 Rollup merge of #33442 - tshepang:trim, r=steveklabnik
doc: trim some needless code
2016-05-07 15:35:19 -04:00
Steve Klabnik
b68254fbb8 Rollup merge of #33439 - birkenfeld:ip-rfc-refs, r=steveklabnik
doc: make RFC references consistent

Always add a space and end sentence with a full stop.
2016-05-07 15:35:19 -04:00
Steve Klabnik
aa63f54e37 Rollup merge of #33438 - birkenfeld:dup-words, r=steveklabnik
Fix some some duplicate words.
2016-05-07 15:35:19 -04:00
Steve Klabnik
1ce9405380 Rollup merge of #33437 - brson:trips, r=Manishearth
doc: Update reference with better description of target_env

The definition of this value recently changed slightly. It no
longer corresponds directly to the target triple.

Also shuffled things around to make the order of cfg descriptions more
logical and added text related them to the target triple.

cc #33403
2016-05-07 15:35:18 -04:00
Steve Klabnik
f569b59fdf Rollup merge of #33430 - phil-opp:patch-1, r=alexcrichton
[Doc] Default cpu is "generic" (and not "default")

See [line 305](a22ca2872e/src/librustc_back/target/mod.rs (L305)).
2016-05-07 15:35:18 -04:00
Steve Klabnik
aec36f61a0 Rollup merge of #33428 - fiveop:wrapping_example, r=steveklabnik
Add an example to Wrapping's documentation.

Such an example would have helped me understand `Wrapping` quicker.

r? @steveklabnik
2016-05-07 15:35:18 -04:00
Steve Klabnik
0b8a3d5187 Rollup merge of #33412 - cramertj:E0389, r=Manishearth
Add detailed error explanation for E0389

Part of #32777
2016-05-07 15:35:18 -04:00
Steve Klabnik
be61c6d828 Rollup merge of #33410 - GuillaumeGomez:explain, r=Manishearth
Remove rust flags from doc block

Fixes #33405

r? @Manishearth
2016-05-07 15:35:18 -04:00
Steve Klabnik
e09ad1deb7 Rollup merge of #33409 - kindlychung:patch-2, r=steveklabnik
errors in the doc
2016-05-07 15:35:17 -04:00
Steve Klabnik
769ec1e743 Rollup merge of #33402 - shepmaster:copied-variable-name, r=Manishearth
Replace copy-pasted variable name with relevant one
2016-05-07 15:35:17 -04:00
Steve Klabnik
04f2972d14 Rollup merge of #33384 - cramertj:E0506, r=arielb1
Add detailed error explanation for E0506

Part of #32777
2016-05-07 15:35:17 -04:00
Steve Klabnik
76d6030e80 Rollup merge of #33382 - birkenfeld:issue-30416, r=alexcrichton
rustdoc: add "src" links to individual impls

Since these impls can be scattered around quite a bit, it is nice to be able to jump to the location where individual methods and trait impls are defined.

NOTE: this needs an update to the CSS, which I'd like to leave for whoever is the "rustdoc frontend champion". The new [src] links are currently too large and bold. Also, the interaction with the "since version X" annotations is not good.

Fixes: #30416
2016-05-07 15:35:17 -04:00
Steve Klabnik
a8162171fd Rollup merge of #33336 - birkenfeld:issue-27361, r=sfackler
parser: do not try to continue with `unsafe` on foreign fns

The changed line makes it look like `unsafe` is allowed, but the first statement of `parse_item_foreign_fn` is:

```
self.expect_keyword(keywords::Fn)?;
```

So we get the strange "expected one of `fn`, `pub`, `static`, or `unsafe`, found `unsafe`".

Fixes: #27361
2016-05-07 15:35:17 -04:00
Steve Klabnik
b651b2c8af Rollup merge of #33326 - birkenfeld:issue-33321, r=GuillaumeGomez
std::thread docs: spawn() does not return a Thread anymore

Also move the "Thread type" section down a bit, since it is not so important anymore.

Fixes: #33321
2016-05-07 15:35:16 -04:00
Steve Klabnik
4e41e8bb48 Rollup merge of #33314 - alexcrichton:fix-enable-ccache, r=pnkfelix
mk: Fix building with --enable-ccache

We will no longer use `ccache` in the makefiles for our local dependencies like
miniz, but they're so small anyway it doesn't really matter.

Closes #33285
2016-05-07 15:35:16 -04:00
Steve Klabnik
9991be3ee4 Rollup merge of #33313 - birkenfeld:depgraph-panic, r=nikomatsakis
dep_graph: avoid panicking in thread when channel closed

On my system, when the processor is already loaded, and I try to
run the test suite, e.g. compile-fail/dep-graph-assoc-type-trans.rs
fails because of undecodable JSON.

Running the compiler manually, I can see that the dep graph thread
panics (and puts non-JSON on stderr) while `send`ing on `swap_out`,
presumably because the other end has already quit.  I think that in
this case, we can just gracefully exit the thread.
2016-05-07 15:35:16 -04:00
Steve Klabnik
93285f8adb Rollup merge of #33283 - GuillaumeGomez:process_doc, r=steveklabnik
Add process types documentation

Part of #29370.

r? @steveklabnik
2016-05-07 15:35:16 -04:00
Steve Klabnik
9e6141e369 Rollup merge of #33256 - pnkfelix:add-rustc-specific-tags-files, r=nikomatsakis
Add `TAGS.rustc.emacs`/`TAGS.rustc.vi` make targets

Add `TAGS.rustc.emacs`/`TAGS.rustc.vi` make targets, (re-)including rustc source.
2016-05-07 15:35:15 -04:00
Murarth
0d5f474f30 Add accessor methods to DiagnosticBuilder 2016-05-07 10:39:24 -07:00
Eduard Burtescu
5c42e694cb trans: support simd_shuffle using MIR constants for indices. 2016-05-07 19:14:33 +03:00
Eduard Burtescu
ed66fe48e9 Implement RFC 1440 "Allow Drop types in statics/const functions". 2016-05-07 19:14:33 +03:00
Eduard Burtescu
4f5900aefa test: adjust for the move to MIR-based const checking. 2016-05-07 19:14:32 +03:00
Eduard Burtescu
78884b7659 mir: qualify and promote constants. 2016-05-07 19:14:28 +03:00
Steven Fackler
a9779df188 Implement RFC 1542
cc #33417
2016-05-07 08:52:41 -07:00
bors
936b32a514 Auto merge of #33359 - tamird:consolidate-musl, r=alexcrichton
rustc_back: use a common musl base

extracted from #33327.

cc #33189.

r? @alexcrichton
2016-05-07 07:59:28 -07:00
Wang Xuerui
dcdf7618e3 trans: callee: normalize trait_ref before use
Fixes #33436 and #33461. Test case is from #33461.
2016-05-07 22:05:11 +08:00
Nerijus Arlauskas
ca03b81abb Check for both arm and armv7 android targets in runtest. 2016-05-07 13:36:13 +03:00
Nerijus Arlauskas
b6fc4abe44 Add armv7-linux-androideabi target. 2016-05-07 13:29:57 +03:00
bors
0d61bb3b49 Auto merge of #33333 - birkenfeld:issue-30318, r=Manishearth
parser: show a helpful note on unexpected inner comment

Fixes: #30318.
2016-05-07 03:01:44 -07:00
Georg Brandl
d75c079cde book: fixup code in error handling tutorial
A few oversights happened while porting the example from docopt to
getopts.  I retraced all the steps, fixing code and description as
necessary.

Fixes: #33422
2016-05-07 11:23:49 +02:00
bors
a9cc5b097e Auto merge of #33328 - nrc:highlight-api, r=alexcrichton
rustdoc: refactor rustdoc syntax highlighting for a more flexible API

Clients can now use the rustdoc syntax highlighter to classify tokens, then use that info to put together there own HTML (or whatever), rather than just having static HTML output.
2016-05-07 00:52:51 -07:00
bors
6478583cdb Auto merge of #33311 - birkenfeld:issue33262, r=nrc
parser: fix suppression of syntax errors in range RHS

Invalid expressions on the RHS were just swallowed without generating an error.  The new version more closely mirrors the code for parsing `..x` in the `parse_prefix_range_expr` method below, where no cancel is done either.

Fixes #33262.
2016-05-06 22:39:43 -07:00
Eduard Burtescu
14efbf1481 mir: prepare for rvalue promotion support. 2016-05-07 07:19:10 +03:00
Eduard Burtescu
e1eca0a110 Translate constants from MIR instead of going through trans::expr/consts. 2016-05-07 07:19:10 +03:00
Eduard Burtescu
4639128d40 test: avoid triggering an unsigned negation error from MIR building. 2016-05-07 07:19:10 +03:00
Eduard Burtescu
d434688516 mir: build MIR for constants and static initializers. 2016-05-07 07:15:01 +03:00
Eduard Burtescu
cde2f5f116 mir: factor out the parts of MIR building which are not fn-specific. 2016-05-07 07:14:54 +03:00
Eduard Burtescu
bbc41aa9a6 mir: remove the unused attribute logic in the MIR map construction. 2016-05-07 06:43:57 +03:00
bors
c95cda56a6 Auto merge of #33267 - nagisa:mir-temporary-32959, r=nikomatsakis
[MIR] Temporary hack for 32959

Gets rid of the warning. This is more elegant that I thought it would be, actually.

r? @nikomatsakis

cc #32959
2016-05-06 18:15:39 -07:00
bors
62e2b2fb7a Auto merge of #33228 - nikomatsakis:compiletest-gut, r=acrichto
Move auxiliary directories to live with the tests

This is a step for enabling testing of cross-crate incremental compilation. The idea is that instead of having a central auxiliary directory, when you have a `// aux-build:foo.rs` annotation in the test `run-pass/bar.rs`, it will look in (e.g.) `run-pass/aux/foo.rs`. In general, it looks for an `aux` directory in the same directory as the test. We also ignore the `aux` directories when enumerating the set of tests.

As part of this PR, also refactor `runtest.rs` to use methods on a context, which means we can stop passing around context everywhere.

r? @alexcrichton
2016-05-06 16:04:55 -07:00
Niko Matsakis
707012494d remove stray files in auxiliary directory 2016-05-06 16:24:48 -04:00
Niko Matsakis
8b1941a783 s/aux/auxiliary, because windows
For legacy reasons (presumably), Windows does not permit files name aux.
2016-05-06 16:24:48 -04:00
Niko Matsakis
cefc5b6468 add missing aux files 2016-05-06 16:24:48 -04:00
Niko Matsakis
47c8179bc2 remove unused aux-base argument 2016-05-06 16:24:48 -04:00