Commit Graph

65930 Commits

Author SHA1 Message Date
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
Ximin Luo
ffae5deaa7 configure: allow distros to disable debuginfo-only-std 2017-07-17 22:29:09 +02:00
gaurikholkar
26a8357f5c reorder span labels 2017-07-18 00:07:37 +05:30
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
Esteban Küber
faf90351b7 Add flag to hide code on inline suggestions
Now there's a way to add suggestions that hide the suggested code when
presented inline, to avoid weird wording when short code snippets are
added at the end.
2017-07-17 09:27:51 -07: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
Michael Woerister
226bc92b64 partitioning: Fix visibility of internalized symbols. 2017-07-17 15:59:22 +02: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
Mátyás Mustoha
bbdbb65467 Allow remote testing remotely when TEST_DEVICE_ADDR is set 2017-07-17 11:33:48 +02:00
Chris Wong
b525abb7b2 Add #[derive(Clone)] to TokenTreeIter 2017-07-17 20:34:13 +12: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
Cameron Hart
ebc2f7d6ed Support repr alignment on unions. 2017-07-17 07:55:49 +10:00
Vadim Petrochenkov
465ada623a Fix checking for missing stability annotations
Remove couple of unnecessary `#![feature(staged_api)]`.
2017-07-16 23:15:07 +03:00
Esteban Küber
7239d77171 Point at : when using it instead of ;
When triggering type ascription in such a way that we can infer a
statement end was intended, add a suggestion for the change. Always
point out the reason for the expectation of a type is due to type
ascription.
2017-07-16 11:49:10 -07:00
Sam Cappleman-Lynes
1b3c339560 Update function name to reflect reality 2017-07-16 18:05:03 +01:00
Sam Cappleman-Lynes
b11596867d Fix range_covered_by_constructor for exclusive ranges.
This resolves #43253
2017-07-16 17:34:09 +01:00
bors
8f1339af2e Auto merge of #43237 - zackmdavis:missing_sum_and_product_for_128_bit_integers, r=nagisa
add u128/i128 to sum/product implementors

Resolves #43235.
2017-07-16 12:42:56 +00:00
bors
be18613281 Auto merge of #43252 - vbrandl:doc/default-values, r=GuillaumeGomez
Document default values for primitive types

All primitive types implement the `Default` trait but the documentation just says `Returns the "default value" for a type.` and doesn't give a hint about the actual default value. I think it would be good to document the default values in a proper way.
I changed the `default_impl` macro to accept a doc string as a third parameter and use this string to overwrite the documentation of `default()` for each primitive type.
The generated documentation now looks like this:
![Documentation of default() on the bool primitive](https://i.imgur.com/nK6TApo.png)
2017-07-16 10:22:00 +00:00
Vadim Petrochenkov
5f37110e5e Compile compiler_builtins with abort panic strategy 2017-07-16 02:02:34 +03:00
Others
c458627230 Improve panic docs for Instant::duration_since
The docs for Instant::duration_since has a confusing section on panicking. It's
much more clear without the second two sentences of description.
2017-07-15 16:23:11 -04:00
Zack M. Davis
80c603fc65 path, not name, in sole-argument variant type mismatch suggestion
We want the suggested replacement (which IDE tooling and such might offer to
automatically swap in) to, like, actually be correct: suggesting `MyVariant(x)`
when the actual fix is `MyEnum::MyVariant(x)` might be better than nothing, but
Rust is supposed to be the future of computing: we're better than better than
nothing.

As an exceptional case, we excise the prelude path, preferring to suggest
`Some` or `Ok` rather than `std::prelude::v1::Some` and
`std::prelude::v2::Ok`. (It's not worth the effort to future-proof against
hypothetical preludes v2, v3, &c.: we trust our successors to grep—excuse me,
ripgrep—for that.)

Also, don't make this preëmpt the existing probe-for-return-type suggestions,
despite their being looked unfavorably upon, at least in this situation
(https://github.com/rust-lang/rust/issues/42764#issuecomment-311388958): Cody
Schafer pointed out that that's a separate issue
(https://github.com/rust-lang/rust/pull/43178#issuecomment-314953229).

This is in the matter of #42764.
2017-07-15 12:46:03 -07:00
bors
086eaa78ea Auto merge of #43224 - jseyfried:fix_macro_idents_regression, r=nrc
macros: fix regression involving identifiers in `macro_rules!` patterns.

Fixes #42019.
r? @nrc
2017-07-15 19:12:03 +00:00
Valentin Brandl
caf125f414 Rephrase the doc string 2017-07-15 17:34:37 +02:00
bors
a783fe2f77 Auto merge of #43246 - frewsxcv:rollup, r=frewsxcv
Rollup of 8 pull requests

- Successful merges: #43074, #43145, #43159, #43202, #43222, #43228, #43229, #43240
- Failed merges:
2017-07-15 14:51:02 +00:00
Valentin Brandl
db19bf0624 Document default values for primitive types 2017-07-15 15:35:03 +02:00
bors
c4373bd6a2 Auto merge of #43207 - alexcrichton:update-cargo, r=nikomatsakis
Update the `cargo` submodule

Notably pull in an update to the `jobserver` crate to have Cargo set the
`CARGO_MAKEFLAGS` environment variable instead of the `MAKEFLAGS` environment
variable.

cc https://github.com/rust-lang/rust/issues/42635
2017-07-15 11:02:35 +00:00
bors
70cd955277 Auto merge of #43179 - oli-obk:mark_all_the_expansions, r=jseyfried
Reintroduce expansion info for proc macros 1.1

r? @jseyfried
2017-07-15 08:36:27 +00:00
bors
8658908cf8 Auto merge of #43185 - durka:thread-local-pub-restricted, r=alexcrichton
support pub(restricted) in thread_local! (round 2)

Resurrected #40984 now that the issue blocking it was fixed. Original description:

`pub(restricted)` was stabilized in #40556 so let's go!

Here is a [playground](https://play.rust-lang.org/?gist=f55f32f164a6ed18c219fec8f8293b98&version=nightly&backtrace=1).

I changed the interface of `__thread_local_inner!`, which is supposedly unstable but this is not checked for macros (#34097 cc @petrochenkov @jseyfried), so this may be an issue.
2017-07-15 06:14:11 +00:00
Corey Farwell
e3825ecd4c Rollup merge of #43240 - steveklabnik:update-books, r=QuietMisdreavus
Update the books.

`python x.py test src\doc` passes on my machine.
2017-07-14 20:57:19 -07:00
Corey Farwell
09b3ea71db Rollup merge of #43229 - kennytm:return-false-if-path-is-relative-hahaha, r=steveklabnik
Fix minor typo in std::path documentation.

Fix minor typo in `std::path` documentation.

Replace all `'C' as u8` with `b'C'`.
2017-07-14 20:57:19 -07:00
Corey Farwell
57bc82d637 Rollup merge of #43228 - redox-os:backtrace_fix, r=alexcrichton
Fix backtrace on Redox

This fixes sys::backtrace on Redox
2017-07-14 20:57:18 -07:00
Corey Farwell
877e62e471 Rollup merge of #43222 - RalfJung:symlink, r=sfackler
windows::fs::symlink_dir: fix example to actually use symlink_dir

I don't have a windows machine, so I couldn't test if this doctest still works -- but it looks trivial enough. (I know, famous last words.)
2017-07-14 20:57:17 -07:00
Corey Farwell
351c476f6d Rollup merge of #43202 - jackpot51:patch-1, r=sfackler
Fix sys::redox::net::tcp

A change to the upper level API needed to be filtered down
2017-07-14 20:57:16 -07:00
Corey Farwell
721f736b1b Rollup merge of #43159 - cuviper:ptr-swap-simd, r=arielb1
Disable big-endian simd in swap_nonoverlapping_bytes

This is a workaround for #42778, which was git-bisected to #40454's
optimizations to `mem::swap`, later moved to `ptr` in #42819.  Natively
compiled rustc couldn't even compile stage1 libcore on powerpc64 and
s390x, but they work fine without this `repr(simd)`.  Since powerpc64le
works OK, it seems probably related to being big-endian.

The underlying problem is not yet known, but this at least makes those
architectures functional again in the meantime.

cc @arielb1
2017-07-14 20:57:15 -07:00
Corey Farwell
c3a8347349 Rollup merge of #43145 - GuillaumeGomez:build-error-if-nothing, r=Mark-Simulacrum
fail in case nothing to run was found

Fixes #43121.

r? @Mark-Simulacrum
2017-07-14 20:57:14 -07:00
Corey Farwell
e7a9f1b626 Rollup merge of #43074 - SimonSapin:iter, r=aturon
Forward more Iterator methods

This allows in more cases to take advantage of specific (possibly more optimized) impls of these methods, rather than the default one defined for all `Iterator`s.

I also wanted to do this for `&mut I` and `Box<I>`, but that didn’t compile for two reasons:

* To make the trait object-safe, generic methods (e.g. that take a closure parameter) have a `where Self: Sized` bound. But e.g. `Box<I>: Sized` does not imply `I: Sized`, and adding an additional bound in the impl is not allowed. Some for of specialization would be needed here.
* With e.g. a `F: FnMut(Self::Item) -> bool` bound and a `type Item = I::Item` associated types, I got errors like `F does not implement FnMut(I::Item) -> bool`. This looks like a limitation in the trait resolution system not recognizing that `Self::Item == I::Item` or "propagating" that fact to `FnMut` bounds.
2017-07-14 20:57:13 -07:00
est31
94fc09c68f 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.

Closes #43089
2017-07-15 05:53:58 +02:00
bors
b4502f7c0b Auto merge of #43184 - nikomatsakis:incr-comp-anonymize-trait-selection, r=michaelwoerister
integrate anon dep nodes into trait selection

Use anonymous nodes for trait selection. In all cases, we use the same basic "memoization" strategy:

- Store the `DepNodeIndex` in the slot along with value.
- If value is present, return it, and add a read of the dep-node-index.
- Else, start an anonymous task, and store resulting node.

We apply this strategy to a number of caches in trait selection:

- The "trans" caches of selection and projection
- The "evaluation" cache
- The "candidate selection" cache

In general, for our cache strategy to be "dep-correct", the computation of the value is permitted to rely on the *value in the key* but nothing else. The basic argument is this: in order to look something up, you have to produce the key, and to do that you must have whatever reads were needed to create the key. Then, you get whatever reads were further needed to produce the value. But if the "closure" that produced the value made use of *other* environmental data, not derivable from the key, that would be bad -- but that would **also** suggest that the cache is messed up (though it's not proof).

The structure of these caches do not obviously prove that the correctness criteria are met, and I aim to address that in further refactorings. But I *believe* it to be the case that, if we assume that the existing caches are correct, there are also no dependency failures (in other words, if there's a bug, it's a pre-existing one). Specifically:

- The trans caches: these take as input just a `tcx`, which is "by definition" not leaky, the `trait-ref` etc, which is part of the key, and sometimes a span (doesn't influence the result). So they seem fine.
- The evaluation cache:
    - This computation takes as input the "stack" and has access to the infcx.
    - The infcx is a problem -- would be better to take the tcx -- and this is exactly one of the things I plan to improve in later PRs. Let's ignore it for now. =)
    - The stack itself is also not great, in that the *key* only consists of the top-entry in the stack.
    - However, the stack can cause a problem in two ways:
        - overflow (we panic)
        - cycle check fails (we do not update the cache, I believe)
- The candidate selection cache:
    - as before, takes the "stack" and has access to the infcx.
    - here it is not as obvious that we avoid caching stack-dependent computations. However, to the extent that we do, this is a pre-existing bug, in that we are making cache entries we shouldn't.
    - I aim to resolve this by -- following the chalk-style of evaluation -- merging candidate selection and evaluation.
    - The infcx is a problem -- would be better to take the tcx -- and this is exactly one of the things I plan to improve in later PRs. Let's ignore it for now. =)
    - The stack itself is also not great, in that the *key* only consists of the top-entry in the stack.
    - Moreover, the stack would generally just introduce ambiguities and errors anyhow, so that lessens the risk.

Anyway, the existing approach to handle dependencies in the trait code carries the same risks or worse, so this seems like a strict improvement!

r? @michaelwoerister

cc @arielb1
2017-07-15 02:22:11 +00:00