Commit Graph

67311 Commits

Author SHA1 Message Date
Mark Simulacrum
fee0b67177 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.
2017-09-06 18:27:50 -06:00
Mark Simulacrum
5c79f6d05c Rollup merge of #44277 - mattico:test-33185, r=nikomatsakis
Add test for #33185

Closes #33185
2017-09-06 18:27:49 -06:00
Mark Simulacrum
2dabf35771 Rollup merge of #44276 - mattico:test-35376, r=alexcrichton
Add test for #35676

Closes #35676
2017-09-06 18:27:48 -06:00
Mark Simulacrum
da5e5ef4a2 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.
2017-09-06 18:27:47 -06:00
Mark Simulacrum
b8812a2179 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
2017-09-06 18:27:46 -06:00
Mark Simulacrum
44351edb64 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
2017-09-06 18:27:45 -06:00
bors
3681220877 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
2017-09-06 19:28:36 +00:00
bors
a209539060 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)
2017-09-06 11:24:18 +00:00
Zaki Manian
af3536dbbc Remove trailing white space 2017-09-05 18:46:21 -07:00
bors
f83d20eff7 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
```
2017-09-06 00:28:15 +00:00
Simon Sapin
f912d771ba 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.
2017-09-05 19:38:28 +02:00
Ralf Jung
13cf229037 disable gcc warnings 2017-09-05 18:46:26 +02:00
QuietMisdreavus
a9f0f6df94 add "Implementations on Foreign Types" to the sidebar 2017-09-05 11:21:18 -05:00
QuietMisdreavus
b357a9c09c if not showing default docs on an impl, autohide the items 2017-09-05 11:21:18 -05:00
QuietMisdreavus
30e526805d rustdoc: add new "Implementations on Foreign Types" section to traits 2017-09-05 11:21:14 -05:00
Niko Matsakis
37c9a60a7d factor out helper method 2017-09-05 12:19:36 -04:00
Masaki Hara
099bb1ba8a Fix misdetection of upstream intercrate ambiguity. 2017-09-05 12:19:35 -04:00
Masaki Hara
4d503b0c74 Add downstream tests for intercrate ambiguity hints. 2017-09-05 12:19:35 -04:00
Masaki Hara
d153ff3f79 Print more detailed trait-ref for intercrate ambiguity. 2017-09-05 12:19:35 -04:00
Masaki Hara
84bfc33fac Unify intercrate ambiguity emitters into a function. 2017-09-05 12:19:35 -04:00
Masaki Hara
043786dcdf Fix a very subtle mistake in a ui test. 2017-09-05 12:19:35 -04:00
Masaki Hara
a59cc32ed4 Add tests for intercrate ambiguity hints. 2017-09-05 12:19:35 -04:00
Masaki Hara
bebd622198 Slightly modify hint messages. 2017-09-05 12:19:35 -04:00
Masaki Hara
d49f278263 Add hints when intercrate ambiguity causes overlap. 2017-09-05 12:19:33 -04:00
bors
2f1ef9ef11 Auto merge of #44308 - eddyb:local-index, r=arielb1
[MIR] Restrict ProjectionElem::Index and Storage{Live,Dead} to Local.

(see #44285)

r? @nikomatsakis
2017-09-05 04:56:03 +00:00
Jacob Kiesel
b762283e57 Add panic unit tests 2017-09-04 21:39:46 -06:00
bors
2f681bf602 Auto merge of #44248 - oli-obk:spans, r=jseyfried
Produce expansion info for more builtin macros

r? @jseyfried

fixes #43268
2017-09-05 02:21:02 +00:00
bors
22d65983b9 Auto merge of #43067 - pornel:libdeps, r=nrc
Compact display of static lib dependencies

Fixes #33173

Instead of displaying one dependency per line, I've changed the format to display them all in one line.

As a bonus they're in format of linker flags (`-lfoo`), so the output can be copy&pasted if one is actually going to link as suggested.
2017-09-04 23:06:59 +00:00
Simon Sapin
9412fd7371 Only include git-commit-hash in tarballs when available
… instead of writing an empty file.
2017-09-04 16:30:36 +02:00
bors
088216fb99 Auto merge of #44194 - QuietMisdreavus:hey-how-do-i-use-this-new-fangled-thing, r=aturon
expand on using rustup custom toolchains in CONTRIBUTING.md

fixes #42484

Should i include more notes about how to use a local build *without* rustup? It can kinda feel like a cop-out otherwise. Other means that come to mind are setting `$RUSTC` directly and fully installing it.

cc @rust-lang/docs
2017-09-04 10:33:53 +00:00
Oliver Schneider
c4d5a1e17b
Produce expansion info for more builtin macros 2017-09-04 11:03:19 +02:00
bors
a36d93d383 Auto merge of #44300 - Manishearth:clippyup, r=oli-obk
Resync clippy to v0.0.156

None
2017-09-04 07:12:42 +00:00
Eduard-Mihai Burtescu
e74f96e43f rustc_mir: use Local instead of Lvalue in Storage{Live,Dead}. 2017-09-04 08:01:46 +03:00
bors
e22a3cf7e1 Auto merge of #44268 - kennytm:fix-python-bootstrap-test, r=Mark-Simulacrum
rustbuild: Remove invalid doctest from bootstrap.py
2017-09-04 04:30:12 +00:00
bors
a3beb8fe61 Auto merge of #44272 - Dushistov:master, r=alexcrichton
add test for not optimized `pow` with constant power

Closes #34947
2017-09-04 00:03:44 +00:00
Manish Goregaokar
9e644e2da6
Resync clippy to v0.0.156 2017-09-03 14:33:28 -07:00
bors
0006d3e01c Auto merge of #44263 - durka:stabilize-discriminant, r=dtolnay
stabilize mem::discriminant (closes #24263)
2017-09-03 21:32:29 +00:00
Zaki Manian
3333262f05 Minor documentation improvements for StmtKind 2017-09-03 12:27:31 -07:00
bors
981ce7d8dd Auto merge of #44261 - alexcrichton:u128-ffi-unsafe, r=eddyb
rustc: Flag {i,u}128 as unsafe for FFI

These don't appear to have a stable ABI as noted in #41799 and the work in
compiler-builtins definitely seems to be confirming it!
2017-09-03 18:57:21 +00:00
Eduard-Mihai Burtescu
2f42cd8489 rustc_mir: use Local in ProjectionElem::Index. 2017-09-03 21:55:41 +03:00
bors
c8642daf93 Auto merge of #44191 - arielb1:on-unimplemented-label, r=nikomatsakis
More general `on_unimplemented`, with uses in `Try`

Allow `on_unimplemented` directives to specify both the label and the primary message of the trait error, and allow them to be controlled by flags - currently only to be desugaring-sensitive.

e.g.
```Rust
#[rustc_on_unimplemented(
    on(all(direct, from_desugaring="?"),
        message="the `?` operator can only be used in a \
        function that returns `Result` \
        (or another type that implements `{Try}`)",
        label="cannot use the `?` operator in a function that returns `{Self}`"),
)]
```

r? @nikomatsakis
2017-09-03 16:25:46 +00:00
Eduard-Mihai Burtescu
c911925243 rustc_mir: implement visit_local instead/along visit_lvalue where possible. 2017-09-03 19:14:31 +03:00
bors
2f2b8b34c2 Auto merge of #44253 - eddyb:nice-scope, r=nikomatsakis
rustc: rename CodeExtent to Scope and RegionMaps to ScopeTree.

r? @nikomatsakis
2017-09-03 12:46:14 +00:00
Ariel Ben-Yehuda
291b4eddce add error message for the other case too 2017-09-03 13:10:54 +03:00
Ariel Ben-Yehuda
efa09ea554 on_unimplemented: add method-name checks and use them in Try 2017-09-03 13:10:54 +03:00
Ariel Ben-Yehuda
6dec953c5a address review comments 2017-09-03 13:10:54 +03:00
Ariel Ben-Yehuda
02b3ae63e2 enable desugaring-sensitive error messages and use them in Try
Maybe I should allow error messages to check the *specific* desugaring?
Thanks @huntiep for the idea!
2017-09-03 13:10:54 +03:00
Ariel Ben-Yehuda
6866aea5af implement improved on_unimplemented directives 2017-09-03 13:10:54 +03:00
Ariel Ben-Yehuda
cf07ebd2a2 move the on_unimplemented logic to its own file 2017-09-03 13:10:53 +03:00
Ariel Ben-Yehuda
243aa12d6e refactor and centralize on_unimplemented parsing 2017-09-03 13:10:53 +03:00