Commit Graph

61077 Commits

Author SHA1 Message Date
Oliver Middleton
9128f6100c Fix a few impl stability attributes
The versions show up in rustdoc.
2017-01-29 13:31:47 +00:00
Tatsuyuki Ishi
149242e519 Bootstrap: append libjemalloc_pic.a
Fix #35349
2017-01-29 20:35:11 +09:00
Wilfred Hughes
87bbb3c738 Minor grammar fix 'can not' -> 'cannot'
The previous version suggested that the compiler chooses not to check, rather than being unable to check.
2017-01-29 10:51:26 +00:00
bors
4be49e1937 Auto merge of #39378 - jtxx000:master, r=eddyb
Fix typo in librustc_trans/collector.rs
2017-01-29 09:05:53 +00:00
bors
b37edea656 Auto merge of #39380 - est31:remove_dead_peq, r=jseyfried
Remove dead recursive partial eq impl

Its nowhere used (if it had been used used, the rust stack would have overflown
due to the recursion). Its presence was confusing for mrustc.

cc @thepowersgang
2017-01-29 06:20:33 +00:00
Simonas Kazlauskas
d880bbb35f Remove the workaround for gh32959
This workaround is no longer necessary as Rust, and by extension MIR, now support uninhabited type
properly. This removes the workaround for the gh32959 that was introduced in gh33267.

Fixes #32959
2017-01-29 08:17:34 +02:00
Josh Stone
cb47d9ffc3 Fix the powerpc64 PATH 2017-01-28 22:02:49 -08:00
Josh Stone
c051d2c8ad Add a license to build-powerpc64le-toolchain.sh 2017-01-28 21:41:35 -08:00
Josh Stone
23e8f70b46 travis: move IBM backwards in time
Using Ubuntu's cross-toolchains for powerpc* and s390x meant they were
depending on glibc symbols from Ubuntu 16.04. And if that host is ever
updated to a new release, the toolchains would raise the bar too.

This switches powerpc, powerpc64, and s390x to use crosstool-ng
toolchains, configured approximately like RHEL6 with kernel 2.6.32 and
glibc 2.12. This ABI level should also be compatible with Debian 7
(wheezy) and Ubuntu 12.04 (precise).

For powerpc64le, the challenge was that only glibc-2.19 officially added
support, but RHEL7 backported those changes to glibc-2.17. The backport
patches are complex and numerous, so instead of trying to push those
into crosstool-ng, this just uses glibc binaries directly from CentOS 7
and builds the toolchain manually.

This is ported from rust-lang/rust-buildbot#149.

r? @alexcrichton
2017-01-28 21:25:11 -08:00
est31
7ed78fcbdf Remove dead recursive partial eq impl
Its nowhere used (if it had been used used, the rust stack would have overflown
due to the recursion). Its presence was confusing for mrustc.
2017-01-29 06:07:45 +01:00
Segev Finer
3f1d3948d6 Fix backtraces on i686-pc-windows-gnu by disabling FPO
This might have performance implications. But do note that MSVC
disables FPO by default nowadays and it's use is limited in exception
heavy languages like C++.

Closes: #28218
2017-01-29 06:46:42 +02:00
Caleb Reach
7e73884941 Fix typo in librustc_trans/collector.rs 2017-01-28 23:02:31 -05:00
Vadim Petrochenkov
d38a8ad488 Improve diagnostics for inaccessible constructors 2017-01-29 02:57:14 +03:00
Vadim Petrochenkov
c9788fdd5b Remove no longer necessary ctor checks in rustc_privacy 2017-01-29 02:57:14 +03:00
Vadim Petrochenkov
8b060e25ba Implement compatibility lint for legacy constructor visibilities 2017-01-29 02:57:14 +03:00
Vadim Petrochenkov
962d88b5ee Fix the fallout 2017-01-29 02:57:14 +03:00
Vadim Petrochenkov
18b96cf286 Privatize constructors of tuple structs with private fields 2017-01-29 02:57:14 +03:00
bors
f39f273826 Auto merge of #39375 - seeekr:patch-1, r=apasel422
Fix typo in liballoc/lib.rs
2017-01-28 23:14:22 +00:00
Michael Gattozzi
b54f593cff
Add clearer error message using &str + &str
This is the first part of #39018. One of the common things for new users
coming from more dynamic languages like JavaScript, Python or Ruby is to
use `+` to concatenate strings. However, this doesn't work that way in
Rust unless the first type is a `String`. This commit adds a check for
this use case and outputs a new error as well as a suggestion to guide
the user towards the desired behavior. It also adds a new test case to
test the output of the error.
2017-01-28 17:26:27 -05:00
Denis Andrejew
339bdc158f Fix typo in liballoc/lib.rs 2017-01-28 22:16:16 +00:00
Mark Simulacrum
95227a4dc1 Remove ToPrimitive trait.
It is no longer used.
2017-01-28 14:37:50 -07:00
bors
1491e04259 Auto merge of #39234 - segevfiner:fix-backtraces-on-windows-gnu, r=petrochenkov
Make backtraces work on Windows GNU targets again.

This is done by adding a function that can return a filename
to pass to backtrace_create_state. The filename is obtained in
a safe way by first getting the filename, locking the file so it can't
be moved, and then getting the filename again and making sure it's the same.

See: https://github.com/rust-lang/rust/pull/37359#issuecomment-260123399
Issue: #33985

Note though that this isn't that pretty...

I had to implement a `WideCharToMultiByte` wrapper function to convert to the ANSI code page. This will work better than only allowing ASCII provided that the ANSI code page is set to the user's local language, which is often the case.

Also, please make sure that I didn't break the Unix build.
2017-01-28 20:32:56 +00:00
Segev Finer
ab21314c3f Disable backtrace tests on i686-pc-windows-gnu since it's broken by FPO 2017-01-28 21:52:31 +02:00
Corey Farwell
b081872d5b Implement PartialEq<&[A]> for VecDeque<A>.
Fixes https://github.com/rust-lang/rust/issues/38625.
2017-01-28 09:38:17 -05:00
bors
c81c1d6a41 Auto merge of #39360 - osa1:typos, r=GuillaumeGomez
Fix typos in libsyntax/tokenstream.rs
2017-01-28 14:13:00 +00:00
Ömer Sinan Ağacan
15411fb0fa Fix typos in libsyntax/tokenstream.rs 2017-01-28 17:00:43 +03:00
bors
010c3e25c4 Auto merge of #39340 - GuillaumeGomez:empty_comment, r=frewsxcv
Don't generate doc if doc comments only filled with 'white' characters

Fixes #39339.

r? @steveklabnik

cc @rust-lang/docs
2017-01-28 09:41:40 +00:00
bors
0f49616a53 Auto merge of #39305 - eddyb:synelide, r=nikomatsakis
Perform lifetime elision (more) syntactically, before type-checking.

The *initial* goal of this patch was to remove the (contextual) `&RegionScope` argument passed around `rustc_typeck::astconv` and allow converting arbitrary (syntactic) `hir::Ty` to (semantic) `Ty`.
I've tried to closely match the existing behavior while moving the logic to the earlier `resolve_lifetime` pass, and [the crater report](https://gist.github.com/eddyb/4ac5b8516f87c1bfa2de528ed2b7779a) suggests none of the changes broke real code, but I will try to list everything:

There are few cases in lifetime elision that could trip users up due to "hidden knowledge":
```rust
type StaticStr = &'static str; // hides 'static
trait WithLifetime<'a> {
    type Output; // can hide 'a
}

// This worked because the type of the first argument contains
// 'static, although StaticStr doesn't even have parameters.
fn foo(x: StaticStr) -> &str { x }

// This worked because the compiler resolved the argument type
// to <T as WithLifetime<'a>>::Output which has the hidden 'a.
fn bar<'a, T: WithLifetime<'a>>(_: T::Output) -> &str { "baz" }
```

In the two examples above, elision wasn't using lifetimes that were in the source, not even *needed* by paths in the source, but rather *happened* to be part of the semantic representation of the types.
To me, this suggests they should have never worked through elision (and they don't with this PR).

Next we have an actual rule with a strange result, that is, the return type here elides to `&'x str`:
```rust
impl<'a, 'b> Trait for Foo<'a, 'b> {
    fn method<'x, 'y>(self: &'x Foo<'a, 'b>, _: Bar<'y>) -> &str {
        &self.name
    }
}
```
All 3 of `'a`, `'b` and `'y` are being ignored, because the `&self` elision rule only cares that the first argument is "`self` by reference". Due implementation considerations (elision running before typeck), I've limited it in this PR to a reference to a primitive/`struct`/`enum`/`union`, but not other types, but I am doing another crater run to assess the impact of limiting it to literally `&self` and `self: &Self` (they're identical in HIR).

It's probably ideal to keep an "implicit `Self` for `self`" type around and *only* apply the rule to `&self` itself, but that would result in more bikeshed, and #21400 suggests some people expect otherwise.
Another decent option is treating `self: X, ... -> Y` like `X -> Y` (one unique lifetime in `X` used for `Y`).

The remaining changes have to do with "object lifetime defaults" (see RFCs [599](https://github.com/rust-lang/rfcs/blob/master/text/0599-default-object-bound.md) and [1156](https://github.com/rust-lang/rfcs/blob/master/text/1156-adjust-default-object-bounds.md)):
```rust
trait Trait {}
struct Ref2<'a, 'b, T: 'a+'b>(&'a T, &'b T);

// These apply specifically within a (fn) body,
// which allows type and lifetime inference:
fn main() {
    // Used to be &'a mut (Trait+'a) - where 'a is one
    // inference variable - &'a mut (Trait+'b) in this PR.
    let _: &mut Trait;

    // Used to be an ambiguity error, but in this PR it's
    // Ref2<'a, 'b, Trait+'c> (3 inference variables).
    let _: Ref2<Trait>;
}
```
What's happening here is that inference variables are created on the fly by typeck whenever a lifetime has no resolution attached to it - while it would be possible to alter the implementation to reuse inference variables based on decisions made early by `resolve_lifetime`, not doing that is more flexible and works better - it can compile all testcases from #38624 by not ending up with `&'static mut (Trait+'static)`.

The ambiguity specifically cannot be an early error, because this is only the "default" (typeck can still pick something better based on the definition of `Trait` and whether it has any lifetime bounds), and having an error at all doesn't help anyone, as we can perfectly infer an appropriate lifetime inside the `fn` body.

**TODO**: write tests for the user-visible changes.

cc @nikomatsakis @arielb1
2017-01-28 06:21:23 +00:00
bors
0f8a296475 Auto merge of #39353 - alexcrichton:rollup, r=alexcrichton
Rollup of 21 pull requests

- Successful merges: #38617, #39284, #39285, #39290, #39302, #39305, #39306, #39307, #39311, #39313, #39314, #39321, #39325, #39332, #39335, #39344, #39345, #39346, #39348, #39350, #39351
- Failed merges:
2017-01-28 02:50:51 +00:00
Eduard-Mihai Burtescu
c0e474d9a6 test: add missing lifetime in recently added test. 2017-01-28 02:56:46 +02:00
Eduard-Mihai Burtescu
9a0af1638a rustc: remove unused bounds field from RegionParameterDef. 2017-01-28 02:56:46 +02:00
Eduard-Mihai Burtescu
4eac052a33 rustc: move object default lifetimes to resolve_lifetimes. 2017-01-28 02:56:46 +02:00
Eduard-Mihai Burtescu
c5befdc630 rustc: always keep an explicit lifetime in trait objects. 2017-01-28 02:56:46 +02:00
Eduard-Mihai Burtescu
41553d6fbc rustc: lower trait type paths as TyTraitObject. 2017-01-28 02:56:46 +02:00
Eduard-Mihai Burtescu
9783947c2a rustc_typeck: move impl Trait checks out of RegionScope. 2017-01-28 02:56:46 +02:00
Eduard-Mihai Burtescu
ba1849daec rustc: move most of lifetime elision to resolve_lifetimes. 2017-01-28 02:56:46 +02:00
Eduard-Mihai Burtescu
bbc341424c rustc: simplify scope-tracking in resolve_lifetime. 2017-01-28 02:56:46 +02:00
Eduard-Mihai Burtescu
0682a75f44 rustc: clean up the style of middle::resolve_lifetime. 2017-01-28 02:56:46 +02:00
Eduard-Mihai Burtescu
7a2a669bb7 rustc: always include elidable lifetimes in HIR types. 2017-01-28 02:56:46 +02:00
Eduard-Mihai Burtescu
f79feba205 rustc_typeck: pass all lifetimes through AstConv::opt_ast_region_to_region. 2017-01-28 02:55:37 +02:00
Eduard-Mihai Burtescu
4f559f8c33 rustc_typeck: force users of RegionScope to get anon_region's one by one. 2017-01-28 02:55:21 +02:00
Michał Krasnoborski
e74b55b9da use String::with_capacity in format! 2017-01-28 01:50:05 +01:00
Alex Crichton
1767d9715c Rollup merge of #39351 - nikomatsakis:incr-comp-skip-typeck-1, r=eddyb
move `cast_kinds` into `TypeckTables` where it belongs

r? @eddyb
2017-01-27 16:42:08 -08:00
Alex Crichton
9eb00687ac Rollup merge of #39350 - nagisa:i128-test-helpers-better-def, r=alexcrichton
Use __SIZEOF_INT128__ to test __int128 presence

Previously we tested whether a handful of preprocessor variables indicating certain 64 bit
platforms, but this does not work for other 64 bit targets which have support for __int128 in C
compiler.

Use the `__SIZEOF__INT128__` preprocessor variable instead. This variable gets set to 16 by gcc and
clang for every target where __int128 is supported.
2017-01-27 16:42:08 -08:00
Alex Crichton
ebe17b0c70 Rollup merge of #39348 - steveklabnik:cyryl-mailmap, r=alexcrichton
Fix cyryl's mailmap entry
2017-01-27 16:42:08 -08:00
Alex Crichton
86af9a19ec Rollup merge of #39346 - steveklabnik:jethro-mailmap, r=brson
Fix @jethrogb's mailmap entry

cc rust-lang-nursery/thanks#51
2017-01-27 16:42:07 -08:00
Alex Crichton
854690c0d8 Rollup merge of #39345 - steveklabnik:carol-mailmap, r=alexcrichton
Fix up @carols10cents' mailmap entry

The previous ways didn't work; this does.

cc rust-lang-nursery/thanks#45
2017-01-27 16:42:07 -08:00
Alex Crichton
7c75608cfb Rollup merge of #39344 - ollie27:links, r=steveklabnik
Fix a few links in the docs

r? @steveklabnik
2017-01-27 16:42:07 -08:00
Alex Crichton
915242af7a Rollup merge of #39335 - cramertj:cramertj/can_begin_expr_fix, r=petrochenkov
Fix can_begin_expr keyword behavior

Partial fix for #28784.
2017-01-27 16:42:07 -08:00
Alex Crichton
30ae115a1d Rollup merge of #39332 - nagisa:another-bigendian-128, r=eddyb
Fix another endianness issue in i128 trans

Apparently LLVMArbitraryPrecisionInteger demands integers to be in low-endian 64-bytes, rather than host-endian 64-bytes. This is weird, and obviously, not documented. And rustc now works a teeny bit more on big endians.

r? @eddyb
2017-01-27 16:42:07 -08:00