Commit Graph

65805 Commits

Author SHA1 Message Date
Simon Sapin
938552a228 Use checked NonZero constructor instead of explicit null check in btree 2017-07-22 20:38:40 +02:00
Simon Sapin
a4edae95ad Add conversions from references to NonZero pointers, Unique, and Shared 2017-07-22 20:38:40 +02:00
Simon Sapin
cbd2b6b484 Add Box::into_unique 2017-07-22 20:38:40 +02:00
Simon Sapin
1ef24bb3e2 Implement From<Unique<T>> for Shared<T> 2017-07-22 20:38:40 +02:00
Simon Sapin
ddaf9b24f0 Rename {NonZero,Shared,Unique}::new_checked to new 2017-07-22 20:38:39 +02:00
Simon Sapin
0a08ad0443 Rename {NonZero,Shared,Unique}::new to new_unchecked 2017-07-22 20:38:16 +02:00
Simon Sapin
e9af03a222 Add new_checked(…) -> Option<Self> to NonZero, Unique, and Shared. 2017-07-22 20:37:52 +02:00
bors
f8d485f53d Auto merge of #43367 - alexcrichton:remove-inline-always, r=sfackler
std: Cut down #[inline] annotations where not necessary

This PR cuts down on a large number of `#[inline(always)]` and `#[inline]`
annotations in libcore for various core functions. The `#[inline(always)]`
annotation is almost never needed and is detrimental to debug build times as it
forces LLVM to perform inlining when it otherwise wouldn't need to in debug
builds. Additionally `#[inline]` is an unnecessary annoation on almost all
generic functions because the function will already be monomorphized into other
codegen units and otherwise rarely needs the extra "help" from us to tell LLVM
to inline something.

Overall this PR cut the compile time of a [microbenchmark][1] by 30% from 1s to
0.7s.

[1]: https://gist.github.com/alexcrichton/a7d70319a45aa60cf36a6a7bf540dd3a
2017-07-22 16:06:12 +00:00
bors
35f64996ad Auto merge of #43352 - estebank:macro-span-replacement, r=petrochenkov
Use the macro structure spans instead of the invocation

Fix #42104, CC #2887.
2017-07-22 13:30:19 +00:00
bors
e49a9483de Auto merge of #43344 - tlively:wasm-debug, r=alexcrichton
Pass debugging arguments to emcc

Tells emcc to enable assertions and debugging information for
wasm32-experimental-emscripten. This makes the codegen issues caused by
LLVM bug 33824 manifest more frequently at runtime and improves the wasm
debugging experience.
2017-07-22 11:02:49 +00:00
bors
066a0ae99b Auto merge of #43343 - petrochenkov:methlife3, r=estebank
Add an extra note to `late_bound_lifetime_arguments` error/lint

Fixes https://github.com/rust-lang/rust/issues/42868#issuecomment-316368538
2017-07-22 08:36:11 +00:00
bors
f0b07cac2f Auto merge of #43323 - perryprog:master, r=estebank
Less verbose output for unused arguments

Closes #37718

This is my first contribution to rust, so sorry if I'm missing anything!

The output now looks like this:
<img width="831" alt="screen shot 2017-07-18 at 5 01 32 pm" src="https://user-images.githubusercontent.com/12972285/28347566-dbfa9962-6c05-11e7-8730-c2e8062a04cc.png">

It's not the prettiest, but whenever #41850 gets resolved, this should be able to be improved.

**EDIT:** This also does not seem
r? @Mark-Simulacrum
2017-07-22 04:41:10 +00:00
bors
68be86d032 Auto merge of #42973 - zackmdavis:json_byte_position_to_start_at_top_of_file, r=nrc
make JSON error byte position start at top of file

The `hi` and `lo` offsets in a span are relative to a `CodeMap`, but this
doesn't seem to be terribly useful for tool consumers who don't have the
codemap, but might want the byte offset within an actual file?

I couldn't get @killercup's [example](https://github.com/rust-lang/rust/issues/35164#issuecomment-301436519) to run, perhaps due to the limitations of the merely-stage-1 compiler that I built (error was `libproc_macro-456500c7095d8fbe.so: cannot open shared object file: No such file or directory`)??—but a dummy project confirms that the byte offsets have successfully been changed to be file-relative—

**Before:**

```
$ cargo run --message-format json
   Compiling byte_json v0.1.0 (file:///home/ubuntu/byte_json)
{"message":{"children":[{"children":[],"code":null,"level":"note","message":"#[warn(dead_code)] on by default","rendered":null,"spans":[]}],"code":null,"level":"warning","message":"function is never used: `rah`","rendered":null,"spans":[{"byte_end":100,"byte_start":67,"column_end":2,"column_start":1,"expansion":null,"file_name":"src/foo.rs","is_primary":true,"label":null,"line_end":5,"line_start":3,"suggested_replacement":null,"text":[{"highlight_end":11,"highlight_start":1,"text":"fn rah() {"},{"highlight_end":21,"highlight_start":1,"text":"    println!(\"rah!\")"},{"highlight_end":2,"highlight_start":1,"text":"}"}]}]},"package_id":"byte_json 0.1.0 (path+file:///home/ubuntu/byte_json)","reason":"compiler-message","target":{"crate_types":["bin"],"kind":["bin"],"name":"byte_json","src_path":"/home/ubuntu/byte_json/src/main.rs"}}
{"message":{"children":[{"children":[],"code":null,"level":"note","message":"#[warn(dead_code)] on by default","rendered":null,"spans":[]}],"code":null,"level":"warning","message":"function is never used: `alas`","rendered":null,"spans":[{"byte_end":137,"byte_start":102,"column_end":2,"column_start":1,"expansion":null,"file_name":"src/bar.rs","is_primary":true,"label":null,"line_end":3,"line_start":1,"suggested_replacement":null,"text":[{"highlight_end":12,"highlight_start":1,"text":"fn alas() {"},{"highlight_end":22,"highlight_start":1,"text":"    println!(\"alas\");"},{"highlight_end":2,"highlight_start":1,"text":"}"}]}]},"package_id":"byte_json 0.1.0 (path+file:///home/ubuntu/byte_json)","reason":"compiler-message","target":{"crate_types":["bin"],"kind":["bin"],"name":"byte_json","src_path":"/home/ubuntu/byte_json/src/main.rs"}}
{"features":[],"filenames":["/home/ubuntu/byte_json/target/debug/byte_json"],"fresh":false,"package_id":"byte_json 0.1.0 (path+file:///home/ubuntu/byte_json)","profile":{"debug_assertions":true,"debuginfo":2,"opt_level":"0","overflow_checks":true,"test":false},"reason":"compiler-artifact","target":{"crate_types":["bin"],"kind":["bin"],"name":"byte_json","src_path":"/home/ubuntu/byte_json/src/main.rs"}}
    Finished dev [unoptimized + debuginfo] target(s) in 0.36 secs
     Running `target/debug/byte_json`
Hello, world!
```

**After:**

```
$ RUSTC=../rust/build/x86_64-unknown-linux-gnu/stage1/bin/rustc cargo run --message-format json
   Compiling byte_json v0.1.0 (file:///home/ubuntu/byte_json)
{"message":{"children":[{"children":[],"code":null,"level":"note","message":"#[warn(dead_code)] on by default","rendered":null,"spans":[]}],"code":null,"level":"warning","message":"function is never used: `rah`","rendered":null,"spans":[{"byte_end":35,"byte_start":2,"column_end":2,"column_start":1,"expansion":null,"file_name":"src/foo.rs","is_primary":true,"label":null,"line_end":5,"line_start":3,"suggested_replacement":null,"text":[{"highlight_end":11,"highlight_start":1,"text":"fn rah() {"},{"highlight_end":21,"highlight_start":1,"text":"    println!(\"rah!\")"},{"highlight_end":2,"highlight_start":1,"text":"}"}]}]},"package_id":"byte_json 0.1.0 (path+file:///home/ubuntu/byte_json)","reason":"compiler-message","target":{"crate_types":["bin"],"kind":["bin"],"name":"byte_json","src_path":"/home/ubuntu/byte_json/src/main.rs"}}
{"message":{"children":[{"children":[],"code":null,"level":"note","message":"#[warn(dead_code)] on by default","rendered":null,"spans":[]}],"code":null,"level":"warning","message":"function is never used: `alas`","rendered":null,"spans":[{"byte_end":35,"byte_start":0,"column_end":2,"column_start":1,"expansion":null,"file_name":"src/bar.rs","is_primary":true,"label":null,"line_end":3,"line_start":1,"suggested_replacement":null,"text":[{"highlight_end":12,"highlight_start":1,"text":"fn alas() {"},{"highlight_end":22,"highlight_start":1,"text":"    println!(\"alas\");"},{"highlight_end":2,"highlight_start":1,"text":"}"}]}]},"package_id":"byte_json 0.1.0 (path+file:///home/ubuntu/byte_json)","reason":"compiler-message","target":{"crate_types":["bin"],"kind":["bin"],"name":"byte_json","src_path":"/home/ubuntu/byte_json/src/main.rs"}}
{"features":[],"filenames":["/home/ubuntu/byte_json/target/debug/byte_json"],"fresh":false,"package_id":"byte_json 0.1.0 (path+file:///home/ubuntu/byte_json)","profile":{"debug_assertions":true,"debuginfo":2,"opt_level":"0","overflow_checks":true,"test":false},"reason":"compiler-artifact","target":{"crate_types":["bin"],"kind":["bin"],"name":"byte_json","src_path":"/home/ubuntu/byte_json/src/main.rs"}}
    Finished dev [unoptimized + debuginfo] target(s) in 2.59 secs
     Running `target/debug/byte_json`
Hello, world!
```

Resolves #35164.

r? @jonathandturner
2017-07-22 02:16:00 +00:00
Zack M. Davis
bb2b8630f5 run-make test for JSON error byte start/end
This is in the matter of #35164.
2017-07-21 16:50:44 -07:00
Zack M. Davis
6043ce9f75 make JSON error byte position start at top of file
The `hi` and `lo` offsets in a span are relative to a `CodeMap`, but this
doesn't seem to be terribly useful for tool consumers who don't have the
codemap, but might want the byte offset within an actual file?

Resolves #35164.
2017-07-21 16:50:44 -07:00
Esteban Küber
6772661f37 Review comments 2017-07-21 16:49:09 -07:00
bors
504328a31a Auto merge of #43274 - bitshifter:union-align, r=petrochenkov
Support repr alignment on unions.

Requested as part of RFC 1358 https://github.com/rust-lang/rust/issues/33626#issuecomment-309137284.
2017-07-21 23:46:05 +00:00
Perry Fraser
5c10db3f94 More tests 2017-07-21 18:11:44 -04:00
bors
15aa15b03f Auto merge of #43319 - SimonSapin:cargoup, r=alexcrichton
Update Cargo to ffab51954ec32d55631c37a8730bb24915fc090b

https://github.com/rust-lang/cargo/pull/4123 added the `[patch]` section of the manifest
2017-07-21 20:57:37 +00:00
bors
6c949655de Auto merge of #43313 - pftbest:fix_asm, r=alexcrichton
[LLVM] Fix an assertion when a weak symbol is defined in global_asm.

This change will fix the issue from
https://github.com/japaric/svd2rust/pull/130

cc @japaric
r? @alexcrichton
2017-07-21 15:42:17 +00:00
Simon Sapin
b77ff24060 Update Cargo to ffab51954ec32d55631c37a8730bb24915fc090b
https://github.com/rust-lang/cargo/pull/4123 added the [patch] section of the manifest
2017-07-21 11:13:18 +02:00
bors
d361efac26 Auto merge of #43318 - jhjourdan:jh/fix_weak_cound_MAX, r=alexcrichton
Fix in weak_count in Arc in the case the weak count is locked.

In the case the weak count was locked, the weak_count function could
return usize::MAX. We need to test this condition manually.
2017-07-21 04:49:00 +00:00
Esteban Küber
09c712dae3 Fix test 2017-07-20 21:28:53 -07:00
Esteban Küber
e99d309c56 Use the macro structure spans instead of the invocation 2017-07-20 21:27:22 -07:00
bors
e3c8433ebb Auto merge of #43183 - michaelwoerister:internalize-symbols-without-llvm, r=eddyb
trans: Internalize symbols without relying on LLVM

This PR makes the compiler use the information gather by the trans collector in order to determine which symbols/trans-items can be made internal. This has the advantages:
+ of being LLVM independent,
+ of also working in incremental mode, and
+ of allowing to not keep all LLVM modules in memory at the same time.

This is in preparation for fixing issue #39280.

cc @rust-lang/compiler
2017-07-21 02:24:18 +00:00
bors
cc800531cc Auto merge of #43368 - Aaronepower:patch-3, r=alexcrichton
Update release notes for 1.19.0

This is just #42503 there is some problems with submodules I can't seem to fix so I just created a new PR.
2017-07-20 23:41:31 +00:00
Michael Woerister
f6e5416a2f trans: Make the collector search const fn invocations. 2017-07-20 22:10:36 +02:00
Alex Crichton
53d8b1d051 std: Cut down #[inline] annotations where not necessary
This PR cuts down on a large number of `#[inline(always)]` and `#[inline]`
annotations in libcore for various core functions. The `#[inline(always)]`
annotation is almost never needed and is detrimental to debug build times as it
forces LLVM to perform inlining when it otherwise wouldn't need to in debug
builds. Additionally `#[inline]` is an unnecessary annoation on almost all
generic functions because the function will already be monomorphized into other
codegen units and otherwise rarely needs the extra "help" from us to tell LLVM
to inline something.

Overall this PR cut the compile time of a [microbenchmark][1] by 30% from 1s to
0.7s.

[1]: https://gist.github.com/alexcrichton/a7d70319a45aa60cf36a6a7bf540dd3a
2017-07-20 12:01:32 -07:00
Aaron Power
077deadb85 Update release notes for 1.19.0 2017-07-20 19:42:15 +01:00
bors
ae98ebfcb9 Auto merge of #43281 - mmatyas:remotetest_env, r=alexcrichton
Allow remote testing remotely when `TEST_DEVICE_ADDR` is set

Remote testing was added in #41268, but at the moment it's only enabled if QEMU is also available or we're testing Android. This patch also allows remote testing if the environment variable `TEST_DEVICE_ADDR` is set, as required by `remote-test-client` [[1](https://github.com/rust-lang/rust/blob/master/src/tools/remote-test-client/src/main.rs#L28), [2](https://github.com/rust-lang/rust/blob/master/src/tools/remote-test-client/src/main.rs#L61)]
2017-07-20 13:58:03 +00:00
bors
9d54ebe550 Auto merge of #43271 - Nashenas88:nll, r=nikomatsakis
Add empty MIR pass for non-lexical lifetimes

This is the first step for #43234.
2017-07-20 11:31:30 +00:00
bors
1edbc3df0d Auto merge of #43270 - petrochenkov:fixstab, r=alexcrichton
Fix checking for missing stability annotations

This was a regression from https://github.com/rust-lang/rust/pull/37676 causing "unmarked API" ICEs like https://github.com/rust-lang/rust/issues/43027.

r? @alexcrichton
2017-07-20 09:01:58 +00:00
bors
381d51dc49 Auto merge of #43260 - zackmdavis:print_target_spec_json_unstable_options_error, r=arielb1
explanatory error on `--print target-spec-json` without unstable options

![unstable_target_spec](https://user-images.githubusercontent.com/1076988/28243342-9731a45c-697a-11e7-9852-bad7ca1802b7.png)

Resolves #41683.
2017-07-20 06:38:41 +00:00
bors
1beaea26ff Auto merge of #43251 - gaurikholkar:span_reorder, r=nikomatsakis
Reorder span suggestions to appear below main labels

A fix to #41698

r? @nikomatsakis
2017-07-20 03:36:14 +00:00
bors
28486e7f90 Auto merge of #43247 - est31:master, r=alexcrichton
Tidy: allow common lang+lib features

This allows changes to the Rust language that have both library
and language components share one feature gate.

The feature gates need to be "about the same change", so that both
library and language components must either be both unstable, or
both stable, and share the tracking issue.

Removes the ugly "proc_macro" exception added by #40939.

Closes #43089
2017-07-20 00:11:40 +00:00
Jacques-Henri Jourdan
8416713240 Add test test_weak_count_locked 2017-07-20 01:59:01 +02:00
Zack M. Davis
c6a23996ca explanatory error on --print target-spec-json without unstable options
Resolves #41683.
2017-07-19 13:27:35 -07:00
Vadim Petrochenkov
18d9701645 Add an extra note to late_bound_lifetime_arguments error/lint 2017-07-19 23:12:58 +03:00
bors
582af6e1ad Auto merge of #43178 - zackmdavis:some_suggestion, r=eddyb
suggest one-argument enum variant to fix type mismatch when applicable

Following @est31's [suggestion](https://github.com/rust-lang/rust/issues/42764#issuecomment-309680886).

![some_suggestion](https://user-images.githubusercontent.com/1076988/28101064-ee83f51e-667a-11e7-9e4f-d8f9eb2fb6c3.png)

Resolves #42764.
2017-07-19 20:12:56 +00:00
Thomas Lively
6a3e32267e Pass debugging arguments to emcc
Tells emcc to enable assertions and debugging information for
wasm32-experimental-emscripten. This makes the codegen issues caused by
LLVM bug 33824 manifest more frequently at runtime and improves the wasm
debugging experience.
2017-07-19 10:55:12 -07:00
bors
9bbbd29e82 Auto merge of #42859 - eddyb:const-size-and-align-of, r=nikomatsakis
Implement const fn {size,align}_of.

Fixes #34078.

r? @nikomatsakis
2017-07-19 16:58:02 +00:00
bors
344f01cf13 Auto merge of #43333 - Mark-Simulacrum:appveyor-fix, r=alexcrichton
Attempt to fix appveyor

This will fix the problem, I think, but I don't know that this is a good idea (potentially leaving ourselves open to attackers, I guess, if a cert was revoked...). Of course, it may not. I don't actually have windows to check on..

r? @alexcrichton
2017-07-19 14:01:45 +00:00
Mark Simulacrum
3fe5721764 Attempt to fix appveyor 2017-07-19 07:01:23 -07:00
Paul Faria
7a966b4328 Add empty MIR pass for non-lexical lifetimes 2017-07-19 07:55:53 -04:00
Eduard-Mihai Burtescu
148718b4f3 Implement const fn {size,align}_of. 2017-07-19 14:46:54 +03:00
bors
4e56bbeb19 Auto merge of #43170 - kyrias:full-relro, r=alexcrichton
Add support for full RELRO

This commit adds support for full RELRO, and enables it for the
platforms I know have support for it.

Full RELRO makes the PLT+GOT data read-only on startup, preventing it
from being overwritten.

http://tk-blog.blogspot.com/2009/02/relro-not-so-well-known-memory.html

Fixes rust-lang/rust#29877.

---

I'm not entirely certain if this is the best way to do it, but I figured mimicking the way it's done for PIE seemed like a good start at least.  I'm not sure whether we want to have it enabled by default globally and then disabling it explicitly for targets that don't support it though.  I'm also not sure whether the `full_relro` function should call `bug!()` or something like it for linkers that don't support it rather than no-opping.
2017-07-19 05:39:14 +00:00
bors
88e2c396a4 Auto merge of #43168 - pnkfelix:check-attr-gating, r=aturon
Slew of builtin-attribute gating tests

Slew of builtin-attribute "gating" tests for issue #43106.

Some stray observations:

 * I don't know if its a good thing that so many attributes allow inputs which are silently discarded. (I  made heavy use of that in writing my tests, but that was more out of curiosity than necessity.)
 * The difference between crate-level and non-crate-level behavior is quite significant in some cases. Definitely worth making sure one has tests for both cases. (Not as clear whether it was worthwhile trying the various other AST forms like `fn f()` vs `struct S;`)
 * `#[no_builtins]` and `#[no_mangle]` occur twice on the `BUILTIN_ATTRIBUTES` list. Thats almost certainly a bug. (Filed as #43148)
 * We are maximally liberal in what we allow for `#[test]` and `#[bench]` when one compiles without `--test`.
 * We allow `#[no_mangle]` on arbitrary AST nodes, but only warn about potential misuse on `fn`
 * We allow `#[cold]`, `#[must_use]`, `#[windows_subsystem]`, and `#[no_builtins]` on arbitrary AST nodes. I don't know off-hand what the semantics are for e.g. a `#[cold] type T = ...;`
 * We allow crate-level `#![inline]`. That's probably a bug since its otherwise restricted to `fn` items
2017-07-19 03:06:21 +00:00
Perry Fraser
0fcb4fca19 Change the error message for multiple unused print params 2017-07-18 22:06:24 -04:00
bors
83c3621910 Auto merge of #40989 - matklad:comma-arms, r=petrochenkov
Unify rules about commas in match arms and semicolons in expressions

Original discussion: https://internals.rust-lang.org/t/syntax-of-block-like-expressions-in-match-arms/5025/7.

Currently, rust uses different rules to determine if `,` is needed after an expression in a match arm and if `;` is needed in an expression statement:

```Rust
fn stmt() {
    # no need for semicolons
    { () }
    if true { () } else { () }
    loop {}
    while true {}
}

fn match_arm(n: i32) {
    match n {
        1 => { () } # can omit comma here
        2 => if true { () } else { () }, # but all other cases do need commas.
        3 => loop { },
        4 => while true {},
        _ => ()
    }
}
```

This seems weird: why would you want to require `,` after and `if`?

This PR unifies the rules. It is backwards compatible because it allows strictly more programs.
2017-07-19 00:35:33 +00:00
bors
af049cd08b Auto merge of #43316 - Mark-Simulacrum:rollup, r=Mark-Simulacrum
Rollup of 11 pull requests

- Successful merges: #42837, #43282, #43287, #43290, #43292, #43294, #43304, #43310, #43312, #43314, #43315
- Failed merges:
2017-07-18 21:59:01 +00:00