]> git.lizzy.rs Git - rust.git/log
rust.git
6 years agoUpdate comment to properly describe static promotion restrictions
Aaron Hill [Mon, 11 Sep 2017 14:51:28 +0000 (10:51 -0400)]
Update comment to properly describe static promotion restrictions

6 years agoDon't promote references to statics that occur in non-static locations
Aaron Hill [Sat, 9 Sep 2017 20:01:45 +0000 (16:01 -0400)]
Don't promote references to statics that occur in non-static locations

6 years agoFix regression in promotion of rvalues referencing a static
Aaron Hill [Sat, 9 Sep 2017 00:22:50 +0000 (20:22 -0400)]
Fix regression in promotion of rvalues referencing a static

This commit makes librustc_passes::consts::CheckCrateVisitor properly
mark expressions as promotable if they reference a static, as it's
perfectly fine for one static to reference another. It fixes a
regression that prevented a temporary rvalue from referencing a static
if it was itself declared within a static.

Prior to commit https://github.com/rust-lang/rust/commit/b8c05fe90bc,
`region::ScopeTree` would only register a 'terminating scope' for function
bodies. Thus, while rvalues in a static that referenced a static would be marked
unpromotable, the lack of enclosing scope would cause
mem_categorization::MemCategorizationContext::cat_rvalue_node
to compute a 'temporary scope' of `ReStatic`. Since this had the same
effect as explicitly selecting a scope of `ReStatic`
due to the rvalue being marked by CheckCrateVisitor as promotable,
no issue occurred.

However, commit https://github.com/rust-lang/rust/commit/b8c05fe90bc
made ScopeTree unconditionally register a 'terminating scope'
Since mem_categorization would now compute a non-static 'temporary scope', the
aforementioned rvalues would be erroneously marked as living for too
short a time.

By fixing the behavior of CheckCrateVisitor, this commit avoids changing
mem_categorization's behavior, while ensuring that temporary values in
statics are still allowed to reference other statics.

Fixes issue #44373

6 years agoAuto merge of #44142 - alexcrichton:dllimport-query, r=nikomatsakis
bors [Fri, 8 Sep 2017 09:47:58 +0000 (09:47 +0000)]
Auto merge of #44142 - alexcrichton:dllimport-query, r=nikomatsakis

Migrate a slew of metadata methods to queries

This PR intends to make more progress on #41417, knocking off some low-hanging fruit.

Closes #44190
cc #44137

6 years agoAuto merge of #43742 - epdtry:pprust-expr-fix, r=petrochenkov
bors [Fri, 8 Sep 2017 06:56:09 +0000 (06:56 +0000)]
Auto merge of #43742 - epdtry:pprust-expr-fix, r=petrochenkov

pprust: fix parenthesization of exprs

The pretty printer in `syntax::print::pprust` currently relies on the presence of `ExprKind::Paren` hints in order to correctly parenthesize expressions in its output.  If `Paren` nodes are missing, it sometimes produces wrong output, such as printing `1 - (2 - 3)` as `1 - 2 - 3`.  This PR fixes `pprust` to correctly print expressions regardless of the presence or absence of `Paren` nodes.  This should make `pprust` easier to use with programmatically constructed ASTs.

A few notes:

 * I added a function for assigning precedence values to exprs in `syntax::util::parser`, since there is already code there for assigning precedence values to binops.  Let me know if I should move this somewhere more `pprust`-specific.

 * I also moved the `contains_exterior_struct_lit` function from `rustc_lint::unused::UnusedParens` into `syntax::util::parser`, since it's needed for determining the correct parenthesization of `if`/`while` conditional expressions.

 * I couldn't find a good way to compare two exprs for equivalence while ignoring semantically-irrelevant details like spans.  So the test for the new behavior relies on a slight hack: it adds `Paren` nodes everywhere, so that the pretty-printed version exactly reflects the structure of the AST, and then compares the printed strings.  This works, but let me know if there's a better way.

6 years agoAuto merge of #44399 - alexcrichton:tmp-travis-downgrade, r=alexcrichton
bors [Thu, 7 Sep 2017 22:45:48 +0000 (22:45 +0000)]
Auto merge of #44399 - alexcrichton:tmp-travis-downgrade, r=alexcrichton

travis: Downgrade to previous images temporarily

Travis is in the process of [rolling out an update][update] but looks like our
tests are breaking, let's temporarily roll back to get the queue moving again.

[update]: https://blog.travis-ci.com/2017-08-29-trusty-image-updates

6 years agotravis: Downgrade to previous images temporarily
Alex Crichton [Thu, 7 Sep 2017 20:48:35 +0000 (13:48 -0700)]
travis: Downgrade to previous images temporarily

Travis is in the process of [rolling out an update][update] but looks like our
tests are breaking, let's temporarily roll back to get the queue moving again.

[update]: https://blog.travis-ci.com/2017-08-29-trusty-image-updates

6 years agorustc: Remove `CrateStore::crates` as a method
Alex Crichton [Thu, 7 Sep 2017 15:13:41 +0000 (08:13 -0700)]
rustc: Remove `CrateStore::crates` as a method

This commit moves the `crates` method to a query and then migrates all callers
to use a query instead of the now-renamed `crates_untracked` method where
possible.

Closes #41417

6 years agoAdd some more with_ignore to get tests passing
Alex Crichton [Thu, 7 Sep 2017 14:21:49 +0000 (07:21 -0700)]
Add some more with_ignore to get tests passing

6 years agopprust: increase precedence of block-like exprs
Stuart Pernsteiner [Thu, 7 Sep 2017 14:28:31 +0000 (10:28 -0400)]
pprust: increase precedence of block-like exprs

6 years agoAuto merge of #44249 - pnkfelix:debugflag-emit-end-regions, r=arielb1
bors [Thu, 7 Sep 2017 13:06:12 +0000 (13:06 +0000)]
Auto merge of #44249 - pnkfelix:debugflag-emit-end-regions, r=arielb1

Debugflag: -Z emit-end-regions

 Skip EndRegion emission by default. Use `-Z emit-end-regions` to reenable it.

The main intent is to fix cases where `EndRegion` emission is believed to be causing excess peak memory pressure.

It may also be a welcome change to people inspecting the MIR output who find the EndRegions to be a distraction.

(In later follow-up PR's I will put in safe-guards against using the current mir-borrowck without enabling `EndRegion` emission. But I wanted this PR to be minimal, in part because we may wish to backport it to the beta channel if we find that it reduces peak memory usage significantly.)

6 years agoAuto merge of #43931 - eddyb:const-local-key, r=alexcrichton
bors [Thu, 7 Sep 2017 06:52:05 +0000 (06:52 +0000)]
Auto merge of #43931 - eddyb:const-local-key, r=alexcrichton

Make the LocalKey facade of thread_local! inlineable cross-crate.

Fixes (almost*) #25088 by changing the `LocalKey` `static` `thread_local!` generates to a `const`.
This can be done because a `LocalKey` value holds no actual TLS data, only function pointers to get at said data, and it could even be made `Copy` without any negative consequences.
The recent stabilization of rvalue promotion to `'static` allows doing this without changing the API.
r? @alexcrichton

*almost because we can't yet inline `__getit` because it breaks on MSVC, see https://github.com/rust-lang/rust/pull/43931#issuecomment-323534214

6 years agoAuto merge of #44094 - alexcrichton:long-linkers, r=michaelwoerister
bors [Thu, 7 Sep 2017 04:07:09 +0000 (04:07 +0000)]
Auto merge of #44094 - alexcrichton:long-linkers, r=michaelwoerister

rustc: Attempt to handle super long linker invocations

This commit adds logic to the compiler to attempt to handle super long linker
invocations by falling back to the `@`-file syntax if the invoked command is too
large. Each OS has a limit on how many arguments and how large the arguments can
be when spawning a new process, and linkers tend to be one of those programs
that can hit the limit!

The logic implemented here is to unconditionally attempt to spawn a linker and
then if it fails to spawn with an error from the OS that indicates the command
line is too big we attempt a fallback. The fallback is roughly the same for all
linkers where an argument pointing to a file, prepended with `@`, is passed.
This file then contains all the various arguments that we want to pass to the
linker.

Closes #41190

6 years agoAuto merge of #44380 - Mark-Simulacrum:rollup, r=Mark-Simulacrum
bors [Thu, 7 Sep 2017 01:04:34 +0000 (01:04 +0000)]
Auto merge of #44380 - Mark-Simulacrum:rollup, r=Mark-Simulacrum

Rollup of 23 pull requests

- Successful merges: #44097, #44206, #44218, #44276, #44277, #44296, #44303, #44313, #44315, #44317, #44319, #44321, #44325, #44326, #44327, #44328, #44330, #44351, #44353, #44354, #44361, #44362, #44377
- Failed merges:

6 years agoRollup merge of #44377 - mathstuf:config.toml-typos, r=alexcrichton
Mark Simulacrum [Thu, 7 Sep 2017 00:28:08 +0000 (18:28 -0600)]
Rollup merge of #44377 - mathstuf:config.toml-typos, r=alexcrichton

config.toml.example: fix some typos

6 years agoRollup merge of #44362 - oli-obk:patch-7, r=eddyb
Mark Simulacrum [Thu, 7 Sep 2017 00:28:07 +0000 (18:28 -0600)]
Rollup merge of #44362 - oli-obk:patch-7, r=eddyb

Fix a bug in the inliner

r? @eddyb

6 years agoRollup merge of #44361 - oli-obk:lit_sugg, r=nikomatsakis
Mark Simulacrum [Thu, 7 Sep 2017 00:28:06 +0000 (18:28 -0600)]
Rollup merge of #44361 - oli-obk:lit_sugg, r=nikomatsakis

Suggest changing literals instead of calling methods (fixes #44307)

6 years agoRollup merge of #44354 - jakllsch:jakllsch-85453197-a0cc-43f6-8c55-7bce6c4a4ebf,...
Mark Simulacrum [Thu, 7 Sep 2017 00:28:05 +0000 (18:28 -0600)]
Rollup merge of #44354 - jakllsch:jakllsch-85453197-a0cc-43f6-8c55-7bce6c4a4ebf, r=Mark-Simulacrum

bootstrap: openssl for NetBSD/sparc64 in extended build

r? @Mark-Simulacrum

6 years agoRollup merge of #44353 - cuviper:install-rustc, r=Mark-Simulacrum
Mark Simulacrum [Thu, 7 Sep 2017 00:28:04 +0000 (18:28 -0600)]
Rollup merge of #44353 - cuviper:install-rustc, r=Mark-Simulacrum

Include rustc in the default `./x.py install`

The default install used to include rustc, rust-std, and rust-docs, but
the refactoring in commit 6b3413d825fa6 make rustc only default in
extended builds.  This commit makes rustc installed by default again.

6 years agoRollup merge of #44351 - lu-zero:master, r=nikomatsakis
Mark Simulacrum [Thu, 7 Sep 2017 00:28:03 +0000 (18:28 -0600)]
Rollup merge of #44351 - lu-zero:master, r=nikomatsakis

More PowerPC Altivec intrinsics

6 years agoRollup merge of #44330 - WiSaGaN:patch-1, r=aturon
Mark Simulacrum [Thu, 7 Sep 2017 00:28:02 +0000 (18:28 -0600)]
Rollup merge of #44330 - WiSaGaN:patch-1, r=aturon

Fix link typo in 1.20.0 release notes

Should have been included in https://github.com/rust-lang/rust/pull/44230

6 years agoRollup merge of #44328 - mcomstock:from-str-doc-fix, r=steveklabnik
Mark Simulacrum [Thu, 7 Sep 2017 00:28:00 +0000 (18:28 -0600)]
Rollup merge of #44328 - mcomstock:from-str-doc-fix, r=steveklabnik

Removed the incorrect documentation for from_str

Fixes #44242.

6 years agoRollup merge of #44327 - Eh2406:FIXME#12808, r=aturon
Mark Simulacrum [Thu, 7 Sep 2017 00:27:59 +0000 (18:27 -0600)]
Rollup merge of #44327 - Eh2406:FIXME#12808, r=aturon

#12808 is closed remove the FIXME

let's see if this can be cleaned up.

https://github.com/rust-lang/rust/issues/12808#issuecomment-326852052

6 years agoRollup merge of #44326 - Eh2406:FIXME#44590, r=arielb1
Mark Simulacrum [Thu, 7 Sep 2017 00:27:58 +0000 (18:27 -0600)]
Rollup merge of #44326 - Eh2406:FIXME#44590, r=arielb1

#33490 is closed remove the FIXME

let's see if this can be cleaned up.

https://github.com/rust-lang/rust/issues/33490#issuecomment-326851930

6 years agoRollup merge of #44325 - nielsegberts:master, r=steveklabnik
Mark Simulacrum [Thu, 7 Sep 2017 00:27:57 +0000 (18:27 -0600)]
Rollup merge of #44325 - nielsegberts:master, r=steveklabnik

Make slice::split_at_mut example demonstrate mutability

Moved the examples from split_at_mut to split_at so the example at
split_at_mut can just demonstrate mutability.

See #44314

r? @steveklabnik

6 years agoRollup merge of #44321 - jakllsch:jakllsch-4f2d6c87-2674-43e4-9c5f-2415136e6bdc,...
Mark Simulacrum [Thu, 7 Sep 2017 00:27:56 +0000 (18:27 -0600)]
Rollup merge of #44321 - jakllsch:jakllsch-4f2d6c87-2674-43e4-9c5f-2415136e6bdc, r=Mark-Simulacrum

bootstrap: only include docs in extended distribution if enabled

Fixes #44163

6 years agoRollup merge of #44319 - est31:master, r=eddyb
Mark Simulacrum [Thu, 7 Sep 2017 00:27:55 +0000 (18:27 -0600)]
Rollup merge of #44319 - est31:master, r=eddyb

Improve DefIndex formatting to be more semantic

Fixes #44318

r? @eddyb

6 years agoRollup merge of #44317 - Dushistov:master, r=arielb1
Mark Simulacrum [Thu, 7 Sep 2017 00:27:54 +0000 (18:27 -0600)]
Rollup merge of #44317 - Dushistov:master, r=arielb1

Add test for #22706

Closes #22706

6 years agoRollup merge of #44315 - kallisti5:epoch-doc-example-squashed, r=GuillaumeGomez
Mark Simulacrum [Thu, 7 Sep 2017 00:27:53 +0000 (18:27 -0600)]
Rollup merge of #44315 - kallisti5:epoch-doc-example-squashed, r=GuillaumeGomez

std/time: Give an example to get UNIX_EPOCH in seconds

6 years agoRollup merge of #44313 - RalfJung:book, r=nikomatsakis
Mark Simulacrum [Thu, 7 Sep 2017 00:27:52 +0000 (18:27 -0600)]
Rollup merge of #44313 - RalfJung:book, r=nikomatsakis

rustbook: remove dead test functions

There is no "test" subcommand added to the `clap::App`, so this is all dead code.

Cc @steveklabnik -- your [commit](https://github.com/RalfJung/rust/commit/a076961fd0e3d8a68f8b047460b8f5191d203b08) introducing this stated the intention of having both commands, but it seems nobody has missed the `test` command since February.

6 years agoRollup merge of #44303 - clarcharr:debugs, r=alexcrichton
Mark Simulacrum [Thu, 7 Sep 2017 00:27:51 +0000 (18:27 -0600)]
Rollup merge of #44303 - clarcharr:debugs, r=alexcrichton

impl Debug for SplitWhitespace.

This one got missed because `libstd_unicode` doesn't have a `deny(missing_debug_implementations)` like `libstd` and `libcore`. I think that perhaps this lint should check for items exported from other crates too.

6 years agoRollup merge of #44296 - zmanian:patch-1, r=steveklabnik
Mark Simulacrum [Thu, 7 Sep 2017 00:27:50 +0000 (18:27 -0600)]
Rollup merge of #44296 - zmanian:patch-1, r=steveklabnik

Minor documentation improvements for StmtKind

Documentation for Semi and Marco StmtKinds.

Wasn't obvious to me what these were when writing a lint recently.

6 years agoRollup merge of #44277 - mattico:test-33185, r=nikomatsakis
Mark Simulacrum [Thu, 7 Sep 2017 00:27:49 +0000 (18:27 -0600)]
Rollup merge of #44277 - mattico:test-33185, r=nikomatsakis

Add test for #33185

Closes #33185

6 years agoRollup merge of #44276 - mattico:test-35376, r=alexcrichton
Mark Simulacrum [Thu, 7 Sep 2017 00:27:48 +0000 (18:27 -0600)]
Rollup merge of #44276 - mattico:test-35376, r=alexcrichton

Add test for #35676

Closes #35676

6 years agoRollup merge of #44218 - SimonSapin:commit-hash, r=alexcrichton
Mark Simulacrum [Thu, 7 Sep 2017 00:27:47 +0000 (18:27 -0600)]
Rollup merge of #44218 - SimonSapin:commit-hash, r=alexcrichton

Add full git commit hash to release channel manifests

The full hash is necessary to build the download URL for "alternate" compiler builds. This is a first step for https://github.com/rust-lang-nursery/rustup.rs/issues/1099.

6 years agoRollup merge of #44206 - MarkMcCaskey:master, r=steveklabnik
Mark Simulacrum [Thu, 7 Sep 2017 00:27:46 +0000 (18:27 -0600)]
Rollup merge of #44206 - MarkMcCaskey:master, r=steveklabnik

update unimplemented! docs

For #42628 (updating docs from changes from #42155).

Initial changes made to make `unimplemented!` doc comments look more like `unreachable!` and remove statement about the panic message.

r? @steveklabnik

6 years agoRollup merge of #44097 - Xaeroxe:clamp, r=burntsushi
Mark Simulacrum [Thu, 7 Sep 2017 00:27:45 +0000 (18:27 -0600)]
Rollup merge of #44097 - Xaeroxe:clamp, r=burntsushi

Add clamp functions

Implementation of clamp feature:

Tracking issue: https://github.com/rust-lang/rust/issues/44095
RFC: https://github.com/rust-lang/rfcs/pull/1961

6 years agoconfig.toml.example: fix some typos
Ben Boeckel [Wed, 6 Sep 2017 22:22:32 +0000 (18:22 -0400)]
config.toml.example: fix some typos

6 years agoAuto merge of #43975 - RalfJung:gcc, r=alexcrichton
bors [Wed, 6 Sep 2017 19:28:36 +0000 (19:28 +0000)]
Auto merge of #43975 - RalfJung:gcc, r=alexcrichton

use gcc::Build rather than deprecated gcc::Config

I did `cargo update -p gcc` to upgrade only this package. Is there further process that should be follwoed when updating a build dependency from crates.io?

r? @alexcrichton
Fixes #43973

6 years agohir::print: fix parenthesization of exprs
Stuart Pernsteiner [Mon, 14 Aug 2017 22:27:20 +0000 (18:27 -0400)]
hir::print: fix parenthesization of exprs

6 years agobetter explanatory comment for the pprust-expr-roundtrip test
Stuart Pernsteiner [Mon, 14 Aug 2017 22:26:55 +0000 (18:26 -0400)]
better explanatory comment for the pprust-expr-roundtrip test

6 years agopprust: fix parenthesization of exprs
Stuart Pernsteiner [Thu, 20 Jul 2017 20:53:56 +0000 (16:53 -0400)]
pprust: fix parenthesization of exprs

6 years agoAuto merge of #43849 - QuietMisdreavus:foreign-impls, r=steveklabnik
bors [Wed, 6 Sep 2017 11:24:18 +0000 (11:24 +0000)]
Auto merge of #43849 - QuietMisdreavus:foreign-impls, r=steveklabnik

rustdoc: add new "Implementations on Foreign Types" section to traits

Demo screenshot:

![image](https://user-images.githubusercontent.com/5217170/29281219-c547f758-80e3-11e7-808f-49f592c65c5b.png)

Full demo available at https://tonberry.quietmisdreavus.net/foreign-test/foreign_test/trait.CheckIt.html

This PR splits the "Implementors" section on trait pages into two: First, for impls on types local to the crate, their impls are kept as-is, printing one line for the impl line, and any additional lines for associated types. However, for types external to the crate, they are now pulled up over the others and are printed (almost) like the summary impl on the type page itself. This gives any doc comments on these impls or methods to be exposed in the documentation.

There's just one small problem, though: [libstd docs apparently surface impls for libc and rand, possibly among others](https://tonberry.quietmisdreavus.net/foreign-std/std/marker/trait.Copy.html#foreign-impls). This adds this section to pages in the std docs where we might not want them to show up in the first place. I think this is a bug distinct from this PR, but it does make it drastically apparent.

~~My question, then, is this: Do we want this here? Taking it out involves fixing which impls are visible to rustdoc, possibly specifically when rendering the std facade. I'm convinced this is fine to land as-is, since it adds a feature specifically for non-std crates (i'm thinking of things like `num` or related crates that implement things on primitives or std types as part of their functionality).~~ (EDIT: I have an open PR to fix this: https://github.com/rust-lang/rust/pull/44026)

6 years agoReintroduce the early returns
Oliver Schneider [Wed, 6 Sep 2017 10:25:46 +0000 (12:25 +0200)]
Reintroduce the early returns

6 years agoFix a bug in the inliner
Oliver Schneider [Wed, 6 Sep 2017 08:33:53 +0000 (10:33 +0200)]
Fix a bug in the inliner

6 years agoSuggest changing literals instead of calling methods (fixes #44307)
Oliver Schneider [Wed, 6 Sep 2017 08:09:25 +0000 (10:09 +0200)]
Suggest changing literals instead of calling methods (fixes #44307)

6 years agorustc: Attempt to handle super long linker invocations
Alex Crichton [Sat, 26 Aug 2017 03:16:51 +0000 (20:16 -0700)]
rustc: Attempt to handle super long linker invocations

This commit adds logic to the compiler to attempt to handle super long linker
invocations by falling back to the `@`-file syntax if the invoked command is too
large. Each OS has a limit on how many arguments and how large the arguments can
be when spawning a new process, and linkers tend to be one of those programs
that can hit the limit!

The logic implemented here is to unconditionally attempt to spawn a linker and
then if it fails to spawn with an error from the OS that indicates the command
line is too big we attempt a fallback. The fallback is roughly the same for all
linkers where an argument pointing to a file, prepended with `@`, is passed.
This file then contains all the various arguments that we want to pass to the
linker.

Closes #41190

6 years agoRemove trailing white space
Zaki Manian [Wed, 6 Sep 2017 01:46:21 +0000 (18:46 -0700)]
Remove trailing white space

6 years agoAuto merge of #43426 - qnighy:intercrate-ambiguity-hints, r=nikomatsakis
bors [Wed, 6 Sep 2017 00:28:15 +0000 (00:28 +0000)]
Auto merge of #43426 - qnighy:intercrate-ambiguity-hints, r=nikomatsakis

Add hints when intercrate ambiguity causes overlap.

I'm going to tackle #23980.

# Examples

## Trait impl overlap caused by possible downstream impl

```rust
trait Foo<X> {}
trait Bar<X> {}
impl<X, T> Foo<X> for T where T: Bar<X> {}
impl<X> Foo<X> for i32 {}

fn main() {}
```

```
error[E0119]: conflicting implementations of trait `Foo<_>` for type `i32`:
 --> test1.rs:4:1
  |
3 | impl<X, T> Foo<X> for T where T: Bar<X> {}
  | ------------------------------------------ first implementation here
4 | impl<X> Foo<X> for i32 {}
  | ^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `i32`
  |
  = note: downstream crates may implement Bar

error: aborting due to previous error
```

## Trait impl overlap caused by possible upstream update

```rust
trait Foo {}
impl<T> Foo for T where T: ::std::fmt::Octal {}
impl Foo for () {}

fn main() {}
```

```
error[E0119]: conflicting implementations of trait `Foo` for type `()`:
 --> test2.rs:3:1
  |
2 | impl<T> Foo for T where T: ::std::fmt::Octal {}
  | ----------------------------------------------- first implementation here
3 | impl Foo for () {}
  | ^^^^^^^^^^^^^^^^^^ conflicting implementation for `()`
  |
  = note: upstream crates may add new impl for std::fmt::Octal in future versions

error: aborting due to previous error
```

## Inherent impl overlap caused by possible downstream impl

```rust
trait Bar<X> {}

struct A<T, X>(T, X);
impl<X, T> A<T, X> where T: Bar<X> { fn f(&self) {} }
impl<X> A<i32, X> { fn f(&self) {} }

fn main() {}
```

```
error[E0592]: duplicate definitions with name `f`
 --> test3.rs:4:38
  |
4 | impl<X, T> A<T, X> where T: Bar<X> { fn f(&self) {} }
  |                                      ^^^^^^^^^^^^^^ duplicate definitions for `f`
5 | impl<X> A<i32, X> { fn f(&self) {} }
  |                     -------------- other definition for `f`
  |
  = note: downstream crates may implement Bar

error: aborting due to previous error
```

## Inherent impl overlap caused by possible upstream update

```rust
struct A<T>(T);

impl<T> A<T> where T: ::std::fmt::Octal { fn f(&self) {} }
impl A<()> { fn f(&self) {} }

fn main() {}
```

```
error[E0592]: duplicate definitions with name `f`
 --> test4.rs:3:43
  |
3 | impl<T> A<T> where T: ::std::fmt::Octal { fn f(&self) {} }
  |                                           ^^^^^^^^^^^^^^ duplicate definitions for `f`
4 | impl A<()> { fn f(&self) {} }
  |              -------------- other definition for `f`
  |
  = note: upstream crates may add new impl for std::fmt::Octal in future versions

error: aborting due to previous error
```

6 years agobootstrap: avoid m4 -B for NetBSD-built sparc64 OpenSSL
Jonathan A. Kollasch [Thu, 31 Aug 2017 14:36:10 +0000 (09:36 -0500)]
bootstrap: avoid m4 -B for NetBSD-built sparc64 OpenSSL

6 years agobootstrap: add openssl config for sparc64-unknown-netbsd
Jonathan A. Kollasch [Thu, 31 Aug 2017 14:34:03 +0000 (09:34 -0500)]
bootstrap: add openssl config for sparc64-unknown-netbsd

6 years agoInclude rustc in the default `./x.py install`
Josh Stone [Tue, 5 Sep 2017 21:19:22 +0000 (14:19 -0700)]
Include rustc in the default `./x.py install`

The default install used to include rustc, rust-std, and rust-docs, but
the refactoring in commit 6b3413d825fa6 make rustc only default in
extended builds.  This commit makes rustc installed by default again.

6 years agoAdd support for Vector Sum Saturated on PowerPC
Luca Barbato [Fri, 4 Aug 2017 00:19:58 +0000 (00:19 +0000)]
Add support for Vector Sum Saturated on PowerPC

6 years agoAdd support for Vector Sum Across Partial 1/4 Saturated on PowerPC
Luca Barbato [Fri, 4 Aug 2017 00:19:58 +0000 (00:19 +0000)]
Add support for Vector Sum Across Partial 1/4 Saturated on PowerPC

6 years agoAdd support for Vector Sum Across Partial 1/2 Saturated on PowerPC
Luca Barbato [Fri, 4 Aug 2017 00:19:58 +0000 (00:19 +0000)]
Add support for Vector Sum Across Partial 1/2 Saturated on PowerPC

6 years agoClarify failure condition on tests
Alex Crichton [Tue, 5 Sep 2017 18:55:01 +0000 (11:55 -0700)]
Clarify failure condition on tests

6 years agoMake git commit info optional and per-package in channel manifests
Simon Sapin [Mon, 4 Sep 2017 15:31:29 +0000 (17:31 +0200)]
Make git commit info optional and per-package in channel manifests

At the moment it is always missing for Cargo and RLS.
Their respective build systems need to be modified to include
`git-commit-hash` files in their "dist" tarballs.

6 years agodisable gcc warnings
Ralf Jung [Tue, 5 Sep 2017 15:48:47 +0000 (17:48 +0200)]
disable gcc warnings

6 years agoadd "Implementations on Foreign Types" to the sidebar
QuietMisdreavus [Tue, 15 Aug 2017 21:05:03 +0000 (16:05 -0500)]
add "Implementations on Foreign Types" to the sidebar

6 years agoif not showing default docs on an impl, autohide the items
QuietMisdreavus [Mon, 14 Aug 2017 15:59:03 +0000 (10:59 -0500)]
if not showing default docs on an impl, autohide the items

6 years agorustdoc: add new "Implementations on Foreign Types" section to traits
QuietMisdreavus [Tue, 8 Aug 2017 20:22:04 +0000 (15:22 -0500)]
rustdoc: add new "Implementations on Foreign Types" section to traits

6 years agofactor out helper method
Niko Matsakis [Mon, 28 Aug 2017 20:50:41 +0000 (16:50 -0400)]
factor out helper method

6 years agoFix misdetection of upstream intercrate ambiguity.
Masaki Hara [Tue, 1 Aug 2017 08:07:11 +0000 (12:37 +0430)]
Fix misdetection of upstream intercrate ambiguity.

6 years agoAdd downstream tests for intercrate ambiguity hints.
Masaki Hara [Tue, 1 Aug 2017 06:53:02 +0000 (11:23 +0430)]
Add downstream tests for intercrate ambiguity hints.

6 years agoPrint more detailed trait-ref for intercrate ambiguity.
Masaki Hara [Tue, 1 Aug 2017 05:57:25 +0000 (10:27 +0430)]
Print more detailed trait-ref for intercrate ambiguity.

6 years agoUnify intercrate ambiguity emitters into a function.
Masaki Hara [Tue, 25 Jul 2017 07:52:36 +0000 (16:52 +0900)]
Unify intercrate ambiguity emitters into a function.

6 years agoFix a very subtle mistake in a ui test.
Masaki Hara [Tue, 25 Jul 2017 07:50:49 +0000 (16:50 +0900)]
Fix a very subtle mistake in a ui test.

6 years agoAdd tests for intercrate ambiguity hints.
Masaki Hara [Tue, 25 Jul 2017 06:46:26 +0000 (15:46 +0900)]
Add tests for intercrate ambiguity hints.

6 years agoSlightly modify hint messages.
Masaki Hara [Tue, 25 Jul 2017 03:17:51 +0000 (12:17 +0900)]
Slightly modify hint messages.

6 years agoAdd hints when intercrate ambiguity causes overlap.
Masaki Hara [Sun, 23 Jul 2017 13:30:47 +0000 (22:30 +0900)]
Add hints when intercrate ambiguity causes overlap.

6 years agorustc: Store InternedString in `DefPathData`
Alex Crichton [Fri, 1 Sep 2017 16:24:02 +0000 (09:24 -0700)]
rustc: Store InternedString in `DefPathData`

Previously a `Symbol` was stored there, but this ended up causing hash
collisions in situations that otherwise shouldn't have a hash collision. Only
the symbol's string value was hashed, but it was possible for distinct symbols
to have the same string value, fooling various calcuations into thinking that
these paths *didn't* need disambiguating data when in fact they did!

By storing `InternedString` instead we're hopefully triggering all the exising
logic to disambiguate paths with same-name `Symbol` but actually distinct
locations.

6 years agorustc: Move stability functionality into queries
Alex Crichton [Thu, 31 Aug 2017 22:08:34 +0000 (15:08 -0700)]
rustc: Move stability functionality into queries

This commit primarily removes the `stability` field from `TyCtxt` as well as its
internal mutable state, instead using a query to build the stability index as
well as primarily using queries for other related lookups.

Like previous commits the calculation of the stability index is wrapped in a
`with_ignore` node to avoid regressing the current tests, and otherwise this
commit also introduces #44232 but somewhat intentionally so.

6 years agorustc: Rename item_body query to extern_const_body
Alex Crichton [Thu, 31 Aug 2017 22:10:58 +0000 (15:10 -0700)]
rustc: Rename item_body query to extern_const_body

Should hopefully more accurately reflect what's happening! This commit also
removes the cache in the cstore implementation as it's already cached through
the query infrastructure.

6 years agorustc: Hide `maybe_unused_*` fields in queries
Alex Crichton [Thu, 31 Aug 2017 20:19:33 +0000 (13:19 -0700)]
rustc: Hide `maybe_unused_*` fields in queries

This commit makes the `maybe_unused_extern_crates` and
`maybe_unused_trait_imports` fields of `TyCtxt` private and ensures that they're
accessed with queries so the values and results can be tracked.

6 years agorustc: Convert `freevars` to a query
Alex Crichton [Thu, 31 Aug 2017 19:30:25 +0000 (12:30 -0700)]
rustc: Convert `freevars` to a query

This removes a public mutable (but not actually used mutably) field from the
`TyCtxt`, moving it over to a query to ensure that it's tracked over time.

6 years agorustc: Remove `CrateStore::used_crate*`
Alex Crichton [Thu, 31 Aug 2017 19:08:29 +0000 (12:08 -0700)]
rustc: Remove `CrateStore::used_crate*`

This commit removes the `use_crates` and `used_crate_source` methods in favor of
a mix of queries and helper methods being used now instead.

6 years agorustc: Classify two more CrateStore methods untracked
Alex Crichton [Thu, 31 Aug 2017 18:39:32 +0000 (11:39 -0700)]
rustc: Classify two more CrateStore methods untracked

These are only called pre-TyCtxt (e.g. lowering/resolve), so make it explicit in
the name that they're untracked and therefore unsuitable to called elsewhere.

6 years agorustc: Migrate `visible_parent_map` to a query
Alex Crichton [Thu, 31 Aug 2017 18:30:22 +0000 (11:30 -0700)]
rustc: Migrate `visible_parent_map` to a query

Turns out it was basically already a query if you squinted hard enough!

6 years agorustc: Migrate `CrateStore::item_body` to a query
Alex Crichton [Thu, 31 Aug 2017 18:12:05 +0000 (11:12 -0700)]
rustc: Migrate `CrateStore::item_body` to a query

This commit migrates the `item_body` method on `CrateStore` to a query instead
to enable better tracking of dependencies and whatnot.

6 years agorustc: Remove lang item methods from CrateStore
Alex Crichton [Thu, 31 Aug 2017 16:19:33 +0000 (09:19 -0700)]
rustc: Remove lang item methods from CrateStore

Given the previous commit, these are now trivially representable as queries!

6 years agorustc: Migrate lang items to a query
Alex Crichton [Thu, 31 Aug 2017 15:57:41 +0000 (08:57 -0700)]
rustc: Migrate lang items to a query

This commit moves the calculation of the `LanguageItems` structure into a
query rather than being calculated before the `TyCtxt` exists, with the eventual
end goal of removing some `CrateStore` methods.

6 years agorustc: Flag some CrateStore methods as "untracked"
Alex Crichton [Thu, 31 Aug 2017 15:07:39 +0000 (08:07 -0700)]
rustc: Flag some CrateStore methods as "untracked"

The main use of `CrateStore` *before* the `TyCtxt` is created is during
resolution, but we want to be sure that any methods used before resolution are
not used after the `TyCtxt` is created. This commit starts moving the methods
used by resolve to all be named `{name}_untracked` where the rest of the
compiler uses just `{name}` as a query.

During this transition a number of new queries were added to account for
post-resolve usage of these methods.

6 years agorustc: Hide the `named_region_map` behind queries
Alex Crichton [Wed, 30 Aug 2017 16:31:14 +0000 (09:31 -0700)]
rustc: Hide the `named_region_map` behind queries

This commit makes the `named_region_map` field of `GlobalCtxt` private by
encapsulating the fields behind new queries, and the new queries are also
targeted at particular `HirId` nodes instead of accessing the entire map.

6 years agorustc: Remove a number of mutable fields in cstore
Alex Crichton [Wed, 30 Aug 2017 21:48:57 +0000 (14:48 -0700)]
rustc: Remove a number of mutable fields in cstore

This commit started by moving methods from `CrateStore` to queries, but it ended
up necessitating some deeper refactorings to move more items in general to
queries.

Before this commit the *resolver* would walk over the AST and process foreign
modules (`extern { .. }` blocks) and collect `#[link]` annotations. It would
then also process the command line `-l` directives and such. This information
was then stored as precalculated lists in the `CrateStore` object for iterating
over later.

After this, commit, however, this pass no longer happens during resolution but
now instead happens through queries. A query for the linked libraries of a crate
will crawl the crate for `extern` blocks and then process the linkage
annotations at that time.

6 years agoIgnore failing tests harder
Alex Crichton [Wed, 30 Aug 2017 19:46:33 +0000 (12:46 -0700)]
Ignore failing tests harder

6 years agorustc: Move implementations_of_trait to a query
Alex Crichton [Wed, 30 Aug 2017 18:40:02 +0000 (11:40 -0700)]
rustc: Move implementations_of_trait to a query

While we're at it, make it two separate queries so one's for rustdoc and one's
for the compiler, hopefully being a bit more targeted.

6 years agorustc: Fix a borrow mut error with debug assertions
Alex Crichton [Wed, 30 Aug 2017 18:53:57 +0000 (11:53 -0700)]
rustc: Fix a borrow mut error with debug assertions

6 years agoIgnore failing incremental tests
Alex Crichton [Tue, 29 Aug 2017 22:22:19 +0000 (15:22 -0700)]
Ignore failing incremental tests

These should hopefully get fixed with red/green, but until that time alas!

6 years agorustc: Move original_crate_name to a query
Alex Crichton [Tue, 29 Aug 2017 00:30:27 +0000 (17:30 -0700)]
rustc: Move original_crate_name to a query

6 years agorustc: Move crate_hash to a query
Alex Crichton [Tue, 29 Aug 2017 00:30:27 +0000 (17:30 -0700)]
rustc: Move crate_hash to a query

6 years agorustc: Move crate_disambiguator to queries
Alex Crichton [Tue, 29 Aug 2017 00:30:27 +0000 (17:30 -0700)]
rustc: Move crate_disambiguator to queries

6 years agorustc: Move {plugin,derive}_registrar_fn to queries
Alex Crichton [Tue, 29 Aug 2017 00:30:27 +0000 (17:30 -0700)]
rustc: Move {plugin,derive}_registrar_fn to queries

6 years agorustc: Migrate `CStore::native_libraries` to a query
Alex Crichton [Tue, 29 Aug 2017 00:06:03 +0000 (17:06 -0700)]
rustc: Migrate `CStore::native_libraries` to a query

6 years agorustc: Migrate `CStore::expored_symbols` to a query
Alex Crichton [Tue, 29 Aug 2017 00:06:03 +0000 (17:06 -0700)]
rustc: Migrate `CStore::expored_symbols` to a query

6 years agorustc: Move `impl_defaultness` to a query
Alex Crichton [Mon, 28 Aug 2017 23:50:25 +0000 (16:50 -0700)]
rustc: Move `impl_defaultness` to a query

6 years agorustc: Move a few more cstore methods to queries
Alex Crichton [Mon, 28 Aug 2017 22:55:32 +0000 (15:55 -0700)]
rustc: Move a few more cstore methods to queries

This comit applies the following changes:

* Deletes the `is_allocator` query as it's no longer used
* Moves the `is_sanitizer_runtime` method to a query
* Moves the `is_profiler_runtime` method to a query
* Moves the `panic_strategy` method to a query
* Moves the `is_no_builtins` method to a query
* Deletes the cstore method of `is_compiler_builtins`. The query was added in
  #42588 but the `CrateStore` method was not deleted

A good bit of these methods were used late in linking during trans so a new
dedicated structure was created to ship a calculated form of this information
over to the linker rather than having to ship the whole of `TyCtxt` over to
linking.

6 years agoEmit `EndRegion` statements when given `-Z mir-emit-validate=N` (for N > 0).
Felix S. Klock II [Tue, 5 Sep 2017 13:28:08 +0000 (15:28 +0200)]
Emit `EndRegion` statements when given `-Z mir-emit-validate=N` (for N > 0).

This way the miri test suite does not have to be updated to explcitly
request `-Z emit-end-regions`.

6 years agoUpdate regression test to explicit enable `EndRegion` emission.
Felix S. Klock II [Fri, 1 Sep 2017 14:02:56 +0000 (16:02 +0200)]
Update regression test to explicit enable `EndRegion` emission.

6 years agoUpdate `mir-opt/end_region_*.rs` tests to explicit enable `EndRegion` emission.
Felix S. Klock II [Fri, 1 Sep 2017 14:02:30 +0000 (16:02 +0200)]
Update `mir-opt/end_region_*.rs` tests to explicit enable `EndRegion` emission.

6 years agoSkip EndRegion emission by default. Use `-Z emit-end-regions` to reenable it.
Felix S. Klock II [Thu, 31 Aug 2017 10:04:19 +0000 (12:04 +0200)]
Skip EndRegion emission by default. Use `-Z emit-end-regions` to reenable it.

The main intent is to fix cases where EndRegion emission is believed
to be causing excess peak memory pressure.

It may also be a welcome change to people inspecting the MIR output
who find the EndRegions to be a distraction.