Commit Graph

65746 Commits

Author SHA1 Message Date
Paul Faria
7a966b4328 Add empty MIR pass for non-lexical lifetimes 2017-07-19 07:55:53 -04: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
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
Mark Simulacrum
dc6606ead9 Rollup merge of #43315 - est31:stabilize_float_bits_conv, r=alexcrichton
float_bits_conv made it into 1.20

It seems that my PR to stabilize the `float_bits_conv` feature got merged before beta branched, which means I'm lucky, and the stabilization makes it into Rust 1.20. As it was against my expectations, the version number has to be corrected from 1.21 to 1.20.

Please also apply this PR to the beta branch.
2017-07-18 09:41:38 -06:00
Mark Simulacrum
21a7b26bb4 Rollup merge of #43314 - alexcrichton:fail-curl, r=aidanhs
travis: Switch `curl -s` to `curl -f`

I seem to have been a little too tired when I fixed up the container scripts,
applying the wrong flag!
2017-07-18 09:41:37 -06:00
Mark Simulacrum
fc7f0fd40a Rollup merge of #43312 - lu-zero:master, r=alexcrichton
powerpc: Ignore the stack-probes test

One little step further to have the test working fine on power8 :)
2017-07-18 09:41:36 -06:00
Mark Simulacrum
0d004c5141 Rollup merge of #43310 - lynn:rc-weak-doc-fix, r=apasel422
Fix erroneous reference to Arc instead of Rc in rc::Weak documentation

The docs for `rc::Weak` refer to `Arc` in one place, where they should obviously be referring to `Rc`; presumably this was erroneously copied over from the `arc::Weak` docs.
2017-07-18 09:41:35 -06:00
Mark Simulacrum
b43f58bc25 Rollup merge of #43304 - ids1024:path2, r=aturon
redox: handle multiple paths in PATH
2017-07-18 09:41:34 -06:00
Mark Simulacrum
f568249cca Rollup merge of #43294 - insaneinside:std-time-duration-docs, r=aturon
`std::time::Duration`: improve _precision_ of terminology in docs

Changed wording of docs on `std::time::Duration` for better clarity w.r.t. the contents of the type and the purpose of its methods.  (Specifically, removed the use of the word "precision" to describe the fractional part of the `Duration` because "precision" is more properly used to describe how _precise_ a value is, i.e. its granularity in this case.)
2017-07-18 09:41:33 -06:00
Mark Simulacrum
ac9e9e5075 Rollup merge of #43292 - kennytm:fix-quasi-quoting-warning-in-rustbuild, r=alexcrichton
Workaround "Quasi-quoting is inefficient" warning in incremental rustbuild introduced in #43252.

After #43252 is merged, building stage0 libcore with `-i` (`--incremental`) flag will cause 17 "Quasi-quoting might make incremental compilation very inefficient: NtExpr(..)" warnings, as in #40946.

```
warning: Quasi-quoting might make incremental compilation very inefficient: NtExpr(..)
   --> src/libcore/default.rs:133:21
    |
133 |             #[doc = $doc]
    |                     ^^^^
...
139 | default_impl! { (), (), "Returns the default value of `()`" }
    | ------------------------------------------------------------- in this macro invocation
(× 17)
```

True fix for #40946 will take at least 12 weeks from now to make into the next stage0, so it is quicker to workaround it in libcore instead.

cc @vbrandl @jseyfried
2017-07-18 09:41:32 -06:00
Mark Simulacrum
751c6e2b4c Rollup merge of #43290 - nodakai:fix-ref-path-new, r=Mark-Simulacrum
libstd: remove redundant & from &Path::new(...)

```rust
fn Path::new<S: AsRef ...>(s: &S) -> &Path
```

* https://doc.rust-lang.org/std/path/struct.Path.html#method.new
2017-07-18 09:41:32 -06:00
Mark Simulacrum
6a566710c5 Rollup merge of #43287 - kennytm:travis-ci-adjustments, r=alexcrichton
Change Travis CI job order.

Reorder the job matrix to take advantage of the order how Travis CI starts them in rust-lang/rust. Plus other refactoring of `.travis.yml`.

1. Move the `$ALLOW_PR` image to the top, so pull requests will start testing as immediately after the build is started. Previously the `$ALLOW_PR` image starts 6 minutes after the build was scheduled.

2. Move the slow macOS images near the top, so they share more time with the rest of the faster Linux builds, which should shorten total test time (actually not much, about 7 minutes at most if this change does work).

3. Merged the `install` section of both Linux and macOS to make the `env:` section a bit shorter, and enable change 4 below.

4. Do not download or install anything if `$SKIP_BUILD == true`, which further reduces chance of spurious failure in the PR-CI stage (avoid the red cross appearing even if CI passed).

(IMO `$SKIP_BUILD` should not even exist: those irrelevant jobs should not start at all, but that would require travis-ci/travis-ci#2778 which has been rejected)
2017-07-18 09:41:31 -06:00
Mark Simulacrum
413ef50884 Rollup merge of #43282 - feadoor:patch-1, r=nikomatsakis
Update merge queue link in CONTRIBUTING.md
2017-07-18 09:41:30 -06:00
Mark Simulacrum
b83285bd29 Rollup merge of #42837 - rthomas:29355-error, r=steveklabnik
Update docs on Error struct. #29355

This adds a pretty contrived example of the usage of fmt::Error. I am
very open to suggestions for a better one.

I have also highlighted the fmt::Error vs std::error::Error.

r? @steveklabnik
2017-07-18 09:41:29 -06:00
Alex Crichton
8340f74eb7 travis: Switch curl -s to curl -f
I seem to have been a little too tired when I fixed up the container scripts,
applying the wrong flag!
2017-07-18 07:42:32 -07:00
Aleksey Kladov
e3d052f30a Ignore pretty-test 2017-07-18 15:21:18 +03:00
bors
83c659ef65 Auto merge of #42492 - petrochenkov:methlife, r=nikomatsakis
Support generic lifetime arguments in method calls

Fixes https://github.com/rust-lang/rust/issues/42403
Fixes https://github.com/rust-lang/rust/issues/42115
Lifetimes in a method call `x.f::<'a, 'b, T, U>()` are treated exactly like lifetimes in the equivalent UFCS call `X::f::<'a, 'b, T, U>`.
In addition, if the method has late bound lifetime parameters (explicit or implicit), then explicitly specifying lifetime arguments is not permitted (guarded by a compatibility lint).
[breaking-change] because previously lifetimes in method calls were accepted unconditionally.

r? @eddyb
2017-07-18 10:20:13 +00:00
Lynn
de7decc055 Fix erroneous reference to Arc instead of Rc 2017-07-18 11:31:07 +02:00
Luca Barbato
e185c6c3d3 powerpc: Ignore the stack-probes test 2017-07-18 08:50:58 +00:00
kennytm
a7eb87e4fc
Change Travis CI job order.
Reorder the job matrix to take advantage of the order how Travis CI starts
them in rust-lang/rust. Plus other refactoring of `.travis.yml`.

1. Move the `$ALLOW_PR` image to the top, so users' PRs will start testing
   immediately. Previously the `$ALLOW_PR` image starts 6 minutes after the
   build was scheduled.

2. Move the slow macOS images near the top, so they share more time with
   the rest of the faster Linux builds, which should shorten total test
   time (actually not much, about 7 minutes at most if this change does
   work).

3. Merged the `install` section of both Linux and macOS to make the `env:`
   section a bit shorter, and enable change 4 below.

4. Do not download or install anything if `$SKIP_BUILD == true`, which
   further reduces chance of spurious failure in the PR-CI stage (avoid the
   red cross appearing even if CI passed).
2017-07-18 15:44:18 +08:00
bors
2e6334062e Auto merge of #43293 - alexcrichton:fail-curl, r=Mark-Simulacrum
travis: Make a few `curl` invocations more resilient

Use the `-f` flag to indicate that, for example, a 500 response code is to be
considered a failure, triggering the normal retry logic. Also ignore errors
where we check the date from google.com, as a failure there shouldn't fail the
build.
2017-07-18 04:36:12 +00:00
est31
ffefc9aa1c float_bits_conv made it into 1.20 2017-07-18 05:16:46 +02:00
Alex Crichton
c843661d9a travis: Make a few curl invocations more resilient
Use the `-f` flag to indicate that, for example, a 500 response code is to be
considered a failure, triggering the normal retry logic. Also ignore errors
where we check the date from google.com, as a failure there shouldn't fail the
build.
2017-07-17 20:11:24 -07:00
Ian Douglas Scott
6f80cd7bfc
redox: handle multiple paths in PATH 2017-07-17 19:17:48 -07:00
Aleksey Kladov
9a7cb9398d Catch expression does not require semicolon to be a statement 2017-07-18 03:42:21 +03:00
Aleksey Kladov
5e25dc9966 Unify rules about commas in match arms and semicolons in expressions 2017-07-18 03:42:21 +03:00
Johannes Löthberg
2161fb25ca Implement FromStr for RelroLevel rather than duplicating the match
Signed-off-by: Johannes Löthberg <johannes@kyriasis.com>
2017-07-18 01:27:55 +02:00
Johannes Löthberg
6a8328cfa3 Move relro_level from CodegenOptions to DebuggingOptions
Signed-off-by: Johannes Löthberg <johannes@kyriasis.com>
2017-07-18 00:18:00 +02:00
Vadim Petrochenkov
39114f9169 Make late_bound_lifetime_arguments lint warn-by-default 2017-07-18 00:33:44 +03:00
Vadim Petrochenkov
46f427bee9 Fix incorrect subst index
Fix treatment of lifetimes defined in nested types during detection of late bound regions in signatures.
Do not replace substs with inference variables when "cannot specify lifetime arguments explicitly..." is reported as a lint.
2017-07-18 00:12:48 +03:00
Vadim Petrochenkov
e40cedb393 Detect implicitly defined late bound lifetime parameters as well 2017-07-18 00:12:48 +03:00
Vadim Petrochenkov
7ca378b251 Prohibit lifetime arguments in path segments with late bound lifetime parameters 2017-07-18 00:12:48 +03:00
Vadim Petrochenkov
9967e9e3e9 Support generic lifetime arguments in method calls 2017-07-18 00:12:48 +03:00
Collin J. Sutton
1ac98ae307 std::time::Duration: improve _precision_ of terminology in docs
Changed wording of docs on `std::time::Duration` for better clarity
w.r.t. the contents of the type and the purpose of its methods.
2017-07-17 11:17:38 -07:00
kennytm
2d6c10f6f4
Fix "Quasi-quoting is inefficient" warning in incremental rustbuild.
After #43252 is merged, building stage0 libcore with -i (--incremental)
flag will cause 17 "Quasi-quoting might make incremental compilation very
inefficient: NtExpr(..)" warnings, as in #40946.

Fixing the warning in #40946 will take 12 weeks from now to make into the
next stage0, so it is quicker to workaround it in libcore instead.
2017-07-18 01:49:40 +08:00
bors
2652ce6771 Auto merge of #42711 - Firstyear:san-on-dylib, r=alexcrichton
Add support for dylibs with Address Sanitizer

Many applications use address sanitizer to assert correct behaviour of their programs. When using Rust with C, it's much more important to assert correct programs with tools like asan/lsan due to the unsafe nature of the access across an ffi boundary. However, previously only rust bin types could use asan. This posed a challenge for existing C applications that link or dlopen .so when the C application is compiled with asan.

This PR enables asan to be linked to the dylib and cdylib crate type. We alter the test to check the proc-macro crate does not work with -Z sanitizer=address. Finally, we add a test that compiles a shared object in rust, then another rust program links it and demonstrates a crash through the call to the library.

This PR is nearly complete, but I do require advice on the change to fix the -lasan that currently exists in the dylib test. This is required because the link statement is not being added correctly to the rustc build when -Z sanitizer=address is added (and I'm not 100% sure why)

Thanks,
2017-07-17 17:02:18 +00:00
NODA, Kai
2e8859ce4e
libstd: remove redundant & from &Path::new(...)
fn Path::new<S: AsRef ...>(s: &S) -> &Path

Signed-off-by: NODA, Kai <nodakai@gmail.com>
2017-07-18 00:07:09 +08:00
bors
028569ab1b Auto merge of #43266 - feadoor:issue-43253-exclusive-range-warning, r=nikomatsakis
Fix `range_covered_by_constructor` for exclusive ranges.

This resolves #43253
2017-07-17 13:31:37 +00:00
bors
5803f99bd4 Auto merge of #42033 - oli-obk:suggestions, r=petrochenkov
Change some notes into suggestions

r? @petrochenkov since you commented on the same edits in #39458
2017-07-17 10:58:08 +00:00
Sam Cappleman-Lynes
c329311b54 Update merge queue link 2017-07-17 11:57:26 +01:00
Oliver Schneider
eb7f429ea5 Move resolve diagnostic instability to compile-fail
The produced paths aren't stable between builds, since
reporting paths inside resolve, before resolve is finished
might produce paths resolved to type aliases instead of
the concrete type.

Compile-fail tests can match just parts of messages, so they
don't "suffer" from this issue.

This is just a workaround, the instability should be fixed
in the future.
2017-07-17 10:16:08 +02:00
Oliver Schneider
a9d9a4aab4
Change some helps to suggestions 2017-07-17 10:03:37 +02:00
Oliver Schneider
4a286639e8
Move some tests from compile-fail to ui 2017-07-17 08:38:54 +02:00
bors
88cf76a64e Auto merge of #42146 - nrc:rls-rust, r=alexcrichton
More Rust/RLS integration

r? @alexcrichton

cc https://github.com/rust-lang-nursery/rls/issues/310

closes #41199
closes #41197
2017-07-17 05:25:48 +00:00
Nick Cameron
04415dc64c Run RLS tests 2017-07-17 17:21:46 +12:00
Nick Cameron
25797938b0 Remove exception from license check for strings.rs 2017-07-17 17:21:46 +12:00
bors
08652ec957 Auto merge of #43258 - petrochenkov:cbabort, r=alexcrichton
Compile `compiler_builtins` with `abort` panic strategy

A workaround for https://github.com/rust-lang/rust/issues/43095

In case this causes unexpected consequences, I use a simpler workaround locally:
```diff
--- a/src/bootstrap/bin/rustc.rs
+++ b/src/bootstrap/bin/rustc.rs
@@ -175,7 +175,9 @@ fn main() {
         }

         if let Ok(s) = env::var("RUSTC_CODEGEN_UNITS") {
-            cmd.arg("-C").arg(format!("codegen-units={}", s));
+            if crate_name != "compiler_builtins" {
+                cmd.arg("-C").arg(format!("codegen-units={}", s));
+            }
         }

         // Emit save-analysis info.
```

r? @alexcrichton
2017-07-17 03:03:19 +00:00
bors
56071f6879 Auto merge of #43055 - est31:stabilize_float_bits_conv, r=sfackler
Stabilize float_bits_conv for Rust 1.21

Stabilizes the `float_bits_conv` lib feature for the 1.20 release of Rust. I've initially implemented the feature in #39271 and later made PR #43025 to output quiet NaNs even on platforms with different encodings, which seems to have been the only unresolved issue of the API.

Due to PR #43025 being only applied to master this stabilisation can't happen for Rust 1.19 through the usual "stabilisation on beta" system that is being done for library APIs.

r? @BurntSushi

closes #40470.
2017-07-17 00:19:43 +00:00