]> git.lizzy.rs Git - rust.git/log
rust.git
6 years agopacify the mercilous tidy
Niko Matsakis [Sat, 27 Jan 2018 01:51:40 +0000 (20:51 -0500)]
pacify the mercilous tidy

6 years agochange from `dirty_bit_vec` to `clean_bit_vec`
Niko Matsakis [Sat, 27 Jan 2018 01:13:51 +0000 (20:13 -0500)]
change from `dirty_bit_vec` to `clean_bit_vec`

Otherwise the vector is initially out of sync

6 years agoAdjust comment spacing
Niko Matsakis [Sat, 27 Jan 2018 00:58:54 +0000 (19:58 -0500)]
Adjust comment spacing

I suspect the lines would be long for tidy.

6 years agoMake region inference use a dirty list
Santiago Pastorino [Fri, 26 Jan 2018 05:14:54 +0000 (02:14 -0300)]
Make region inference use a dirty list

Fixes #47602

6 years agoAuto merge of #47252 - Zoxc:backtrace-win, r=alexcrichton
bors [Fri, 26 Jan 2018 12:18:00 +0000 (12:18 +0000)]
Auto merge of #47252 - Zoxc:backtrace-win, r=alexcrichton

Print inlined functions on Windows

Split from https://github.com/rust-lang/rust/pull/45637

r? @alexcrichton

6 years agoAuto merge of #47676 - topecongiro:update-rls, r=alexcrichton
bors [Fri, 26 Jan 2018 04:10:10 +0000 (04:10 +0000)]
Auto merge of #47676 - topecongiro:update-rls, r=alexcrichton

Update rls

Currently rls is missing from the latest nightly component. This PR brings it back.

6 years agoUpdate rls
topecongiro [Fri, 26 Jan 2018 03:55:22 +0000 (12:55 +0900)]
Update rls

6 years agoPrint inlined functions on Windows
John Kåre Alsaker [Wed, 15 Nov 2017 17:01:09 +0000 (18:01 +0100)]
Print inlined functions on Windows

6 years agoAuto merge of #47740 - GuillaumeGomez:rollup, r=GuillaumeGomez
bors [Thu, 25 Jan 2018 15:27:18 +0000 (15:27 +0000)]
Auto merge of #47740 - GuillaumeGomez:rollup, r=GuillaumeGomez

Rollup of 10 pull requests

- Successful merges: #47534, #47609, #47679, #47691, #47700, #47702, #47717, #47721, #47726, #47729
- Failed merges:

6 years agoRollup merge of #47729 - alexcrichton:update-cargo, r=sfackler
Guillaume Gomez [Thu, 25 Jan 2018 14:52:19 +0000 (15:52 +0100)]
Rollup merge of #47729 - alexcrichton:update-cargo, r=sfackler

Update Cargo submodule to master

Just a routine update

6 years agoRollup merge of #47726 - pietroalbini:fix-nested-empty-groups-span, r=petrochenkov
Guillaume Gomez [Thu, 25 Jan 2018 14:52:18 +0000 (15:52 +0100)]
Rollup merge of #47726 - pietroalbini:fix-nested-empty-groups-span, r=petrochenkov

Fix spans in unused import lint for nested groups

This fixes an inconsistency for empty nested groups, and adds a test for all the possible cases of the lint.

```
warning: unused imports: `*`, `Foo`, `baz::{}`, `foobar::*`
  --> test.rs:16:11
   |
16 | use foo::{Foo, bar::{baz::{}, foobar::*}, *};
   |           ^^^        ^^^^^^^  ^^^^^^^^^   ^
   |
   = note: #[warn(unused_imports)] on by default

warning: unused import: `*`
  --> test.rs:17:24
   |
17 | use foo::bar::baz::{*, *};
   |                        ^

warning: unused import: `use foo::{};`
  --> test.rs:18:1
   |
18 | use foo::{};
   | ^^^^^^^^^^^^
```

cc #44494

6 years agoRollup merge of #47721 - GuillaumeGomez:experimental-color, r=QuietMisdreavus
Guillaume Gomez [Thu, 25 Jan 2018 14:52:17 +0000 (15:52 +0100)]
Rollup merge of #47721 - GuillaumeGomez:experimental-color, r=QuietMisdreavus

Fix experimental text display on default theme

r? @QuietMisdreavus

6 years agoRollup merge of #47717 - evelynmitchell:47716-doc-fix, r=steveklabnik
Guillaume Gomez [Thu, 25 Jan 2018 14:52:16 +0000 (15:52 +0100)]
Rollup merge of #47717 - evelynmitchell:47716-doc-fix, r=steveklabnik

fix for documentation error issue 47716

Fix #47716

6 years agoRollup merge of #47702 - etaoins:fix-into-cast-paren-precedence, r=petrochenkov
Guillaume Gomez [Thu, 25 Jan 2018 14:52:15 +0000 (15:52 +0100)]
Rollup merge of #47702 - etaoins:fix-into-cast-paren-precedence, r=petrochenkov

Fix into() cast paren check precedence

As discussed in #47699 the logic for determining if an expression needs parenthesis when suggesting an `.into()` cast is incorrect. Two broken examples from nightly are:

```
error[E0308]: mismatched types
 --> main.rs:4:10
  |
4 |     test(foo as i8);
  |          ^^^^^^^^^ expected i32, found i8
help: you can cast an `i8` to `i32`, which will sign-extend the source value
  |
4 |     test(foo as i8.into());
  |
```

```
error[E0308]: mismatched types
 --> main.rs:4:10
  |
4 |     test(*foo);
  |          ^^^^ expected i32, found i8
help: you can cast an `i8` to `i32`, which will sign-extend the source value
  |
4 |     test(*foo.into());
  |
```

As suggested by @petrochenkov switch the precedence check to `PREC_POSTFIX`. This catches both `as` and unary operators. Fixes #47699.

r? @petrochenkov

6 years agoRollup merge of #47700 - EdSchouten:cc104, r=kennytm
Guillaume Gomez [Thu, 25 Jan 2018 14:52:15 +0000 (15:52 +0100)]
Rollup merge of #47700 - EdSchouten:cc104, r=kennytm

Remove workarounds for cc 1.0.3.

Now that the Rust codebase depends on cc 1.0.4, there is no longer any
need to specify a compiler for CloudABI manually. Cargo will
automatically call into the right compiler executable.

6 years agoRollup merge of #47691 - estebank:unknown-lang-item-sp, r=rkruppe
Guillaume Gomez [Thu, 25 Jan 2018 14:52:14 +0000 (15:52 +0100)]
Rollup merge of #47691 - estebank:unknown-lang-item-sp, r=rkruppe

Point at unknown lang item attribute

6 years agoRollup merge of #47679 - etaoins:remove-redundant-backtrace-hint, r=estebank
Guillaume Gomez [Thu, 25 Jan 2018 14:52:13 +0000 (15:52 +0100)]
Rollup merge of #47679 - etaoins:remove-redundant-backtrace-hint, r=estebank

Remove broken redundant backtrace hint

When the compiler driver panics it attempts to show a hint about using `RUST_BACKTRACE`. However, the logic is currently reversed to the hint is only shown if `RUST_BACKTRACE` is **already**   set:

```shell
> RUST_BACKTRACE=1 rustc /dev/null --crate-type proc-macro
error: internal compiler error: unexpected panic
...
note: run with `RUST_BACKTRACE=1` for a backtrace

thread 'rustc' panicked at 'attempt to subtract with overflow', librustc_errors/emitter.rs:287:49
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

> RUST_BACKTRACE=0 rustc /dev/null --crate-type proc-macro
error: internal compiler error: unexpected panic
...
thread 'rustc' panicked at 'attempt to subtract with overflow', librustc_errors/emitter.rs:287:49
note: Run with `RUST_BACKTRACE=1` for a backtrace.
```

As the `panic` itself already has a working `RUST_BACKTRACE` hint just remove the broken duplicate hint entirely.

6 years agoRollup merge of #47609 - ritiek:test-mutating-references, r=nikomatsakis
Guillaume Gomez [Thu, 25 Jan 2018 14:52:12 +0000 (15:52 +0100)]
Rollup merge of #47609 - ritiek:test-mutating-references, r=nikomatsakis

NLL test for mutating &mut references

As mentioned in #46361.

cc @nikomatsakis?

6 years agoRollup merge of #47534 - estebank:suggest-public-traits, r=petrochenkov
Guillaume Gomez [Thu, 25 Jan 2018 14:52:11 +0000 (15:52 +0100)]
Rollup merge of #47534 - estebank:suggest-public-traits, r=petrochenkov

On missing method do not suggest private traits

When encountering a method call for an ADT that doesn't have any
implementation of it, we search for traits that could be implemented
that do have that method. Filter out private non-local traits that would
not be able to be implemented.

This doesn't account for public traits that are in a private scope, but
works as a first approximation and is a more correct behavior than the
current one.

Fix #45781.

6 years agoAuto merge of #47686 - GuillaumeGomez:theme-fixes, r=QuietMisdreavus
bors [Thu, 25 Jan 2018 06:12:06 +0000 (06:12 +0000)]
Auto merge of #47686 - GuillaumeGomez:theme-fixes, r=QuietMisdreavus

Few fixes for multiple themes support feature

r? @QuietMisdreavus

Fixes #47695.

6 years agoUpdate Cargo submodule to master
Alex Crichton [Thu, 25 Jan 2018 04:01:42 +0000 (20:01 -0800)]
Update Cargo submodule to master

Just a routine update

6 years agoAuto merge of #47374 - topecongiro:issue-47096, r=nikomatsakis
bors [Thu, 25 Jan 2018 03:20:54 +0000 (03:20 +0000)]
Auto merge of #47374 - topecongiro:issue-47096, r=nikomatsakis

Simplify irrefutable slice patterns

Closes #47096.

6 years agoAuto merge of #47006 - bitshifter:stabilize-repr-align, r=eddyb
bors [Thu, 25 Jan 2018 00:26:17 +0000 (00:26 +0000)]
Auto merge of #47006 - bitshifter:stabilize-repr-align, r=eddyb

Stabilized `#[repr(align(x))]` attribute (RFC 1358)

Stabilzed `#[repr(align(x))]` with attr_literal syntax as proposed by @eddyb https://github.com/rust-lang/rust/issues/33626#issuecomment-348467804

6 years agoFix wrong span for nested empty groups
Pietro Albini [Wed, 24 Jan 2018 22:32:17 +0000 (23:32 +0100)]
Fix wrong span for nested empty groups

6 years agoFix experimental text display on default theme
Guillaume Gomez [Wed, 24 Jan 2018 18:15:41 +0000 (19:15 +0100)]
Fix experimental text display on default theme

6 years agofix for documentation error issue 47716
evelynmitchell [Wed, 24 Jan 2018 16:25:46 +0000 (09:25 -0700)]
fix for documentation error issue 47716

6 years agoFew fixes for multiple themes support feature
Guillaume Gomez [Tue, 23 Jan 2018 21:10:16 +0000 (22:10 +0100)]
Few fixes for multiple themes support feature

6 years agoAuto merge of #47300 - remexre:duration-constructors-as-const-fns, r=alexcrichton
bors [Wed, 24 Jan 2018 10:39:25 +0000 (10:39 +0000)]
Auto merge of #47300 - remexre:duration-constructors-as-const-fns, r=alexcrichton

Makes the constructors of Duration const fns.

This affects `Duration::new`, `Duration::from_secs`, `Duration::from_millis`, `Duration::from_micros`, and `Duration::from_nanos`.

6 years agoFix into() cast paren check precedence
Ryan Cumming [Wed, 24 Jan 2018 09:31:36 +0000 (20:31 +1100)]
Fix into() cast paren check precedence

As discussed in #47699 the logic for determining if an expression needs
parenthesis when suggesting an `.into()` cast is incorrect. Two broken
examples from nightly are:

```
error[E0308]: mismatched types
 --> main.rs:4:10
  |
4 |     test(foo as i8);
  |          ^^^^^^^^^ expected i32, found i8
help: you can cast an `i8` to `i32`, which will sign-extend the source value
  |
4 |     test(foo as i8.into());
  |
```

```
error[E0308]: mismatched types
 --> main.rs:4:10
  |
4 |     test(*foo);
  |          ^^^^ expected i32, found i8
help: you can cast an `i8` to `i32`, which will sign-extend the source value
  |
4 |     test(*foo.into());
  |
```

As suggested by @petrochenkov switch the precedence check to
PREC_POSTFIX. This catches both `as` and unary operators. Fixes #47699.

6 years agoRemove workarounds for cc 1.0.3.
Ed Schouten [Wed, 24 Jan 2018 07:30:17 +0000 (08:30 +0100)]
Remove workarounds for cc 1.0.3.

Now that the Rust codebase depends on cc 1.0.4, there is no longer any
need to specify a compiler for CloudABI manually. Cargo will
automatically call into the right compiler executable.

6 years agoAuto merge of #47299 - cramertj:unsafe-placer, r=alexcrichton
bors [Wed, 24 Jan 2018 07:22:22 +0000 (07:22 +0000)]
Auto merge of #47299 - cramertj:unsafe-placer, r=alexcrichton

Make core::ops::Place an unsafe trait

Consumers of `Place` would reasonably expect that the `pointer` function returns a valid pointer to memory that can actually be written to.

6 years agoPoint at unknown lang item attribute
Esteban Küber [Tue, 23 Jan 2018 23:34:16 +0000 (15:34 -0800)]
Point at unknown lang item attribute

6 years agoAuto merge of #46931 - clarcharr:float_bits_core, r=alexcrichton
bors [Wed, 24 Jan 2018 03:02:15 +0000 (03:02 +0000)]
Auto merge of #46931 - clarcharr:float_bits_core, r=alexcrichton

Expose float from_bits and to_bits in libcore.

These methods have no dependencies on libm and thus should be offered in libcore.

6 years agoAuto merge of #45337 - Zoxc:gen-static, r=nikomatsakis
bors [Tue, 23 Jan 2018 22:50:03 +0000 (22:50 +0000)]
Auto merge of #45337 - Zoxc:gen-static, r=nikomatsakis

Immovable generators

This adds support for immovable generators which allow you to borrow local values inside generator across suspension points. These are declared using a `static` keyword:
```rust
let mut generator = static || {
    let local = &Vec::new();
    yield;
    local.push(0i8);
};
generator.resume();

// ERROR moving the generator after it has resumed would invalidate the interior reference
// drop(generator);
```

Region inference is no longer affected by the types stored in generators so the regions inside should be similar to other code (and unaffected by the presence of `yield` expressions). The borrow checker is extended to pick up the slack so interior references still result in errors for movable generators. This fixes #44197, #45259 and #45093.

This PR depends on [PR #44917 (immovable types)](https://github.com/rust-lang/rust/pull/44917), I suggest potential reviewers ignore the first commit as it adds immovable types.

6 years agoRemove similar test that does not run the result
ritiek [Tue, 23 Jan 2018 17:15:10 +0000 (22:45 +0530)]
Remove similar test that does not run the result

6 years agoAuto merge of #47678 - kennytm:rollup, r=kennytm
bors [Tue, 23 Jan 2018 16:13:18 +0000 (16:13 +0000)]
Auto merge of #47678 - kennytm:rollup, r=kennytm

Rollup of 14 pull requests

- Successful merges: #47423, #47425, #47440, #47541, #47549, #47554, #47558, #47610, #47635, #47655, #47661, #47662, #47667, #47672
- Failed merges:

6 years agoRollup merge of #47672 - ollie27:rustdoc_auto_traits, r=GuillaumeGomez
kennytm [Tue, 23 Jan 2018 09:03:47 +0000 (17:03 +0800)]
Rollup merge of #47672 - ollie27:rustdoc_auto_traits, r=GuillaumeGomez

rustdoc: Show when traits are auto traits

6 years agoRollup merge of #47667 - GuillaumeGomez:fix-quoted-search, r=QuietMisdreavus
kennytm [Tue, 23 Jan 2018 09:03:46 +0000 (17:03 +0800)]
Rollup merge of #47667 - GuillaumeGomez:fix-quoted-search, r=QuietMisdreavus

Fix quoted search

r? @QuietMisdreavus

6 years agoRollup merge of #47662 - spastorino:add_test_to_nll, r=nikomatsakis
kennytm [Tue, 23 Jan 2018 09:03:45 +0000 (17:03 +0800)]
Rollup merge of #47662 - spastorino:add_test_to_nll, r=nikomatsakis

Add dynamic-drop test to nll tests also

r? @nikomatsakis

Fixes #47585

6 years agoRollup merge of #47661 - bjorn3:refactor_driver, r=michaelwoerister
kennytm [Tue, 23 Jan 2018 09:03:44 +0000 (17:03 +0800)]
Rollup merge of #47661 - bjorn3:refactor_driver, r=michaelwoerister

Inline some rustc_driver function

6 years agoRollup merge of #47655 - etaoins:fix-spurious-warning-on-empty-proc-macro-crate,...
kennytm [Tue, 23 Jan 2018 09:03:43 +0000 (17:03 +0800)]
Rollup merge of #47655 - etaoins:fix-spurious-warning-on-empty-proc-macro-crate, r=alexcrichton

Fix spurious warning on empty proc macro crates

While attempting to reproduce rust-lang/rust#47086 I noticed the following warning:

```shell
> rustc /dev/null --crate-type proc-macro
warning: unused variable: `registrar`
 --> /dev/null:0:1
```

As there are no macros to register the automatically generated registrar function for the crate has no body. As a result its `registrar` argument is unused triggering the above warning.

The warning is confusing and not easily actionable by the developer. It could also be triggered legitimately by e.g. having all of the macros in a crate #[cfg]'ed out.

Fix by naming the generated argument `_registrar` inside `mk_registrar()`. This suppresses the unused variable warning.

6 years agoRollup merge of #47635 - Zoxc:remove-attr, r=michaelwoerister
kennytm [Tue, 23 Jan 2018 09:03:42 +0000 (17:03 +0800)]
Rollup merge of #47635 - Zoxc:remove-attr, r=michaelwoerister

Remove the IGNORED_ATTR_NAMES thread local

6 years agoAuto merge of #47620 - GuillaumeGomez:multiple-themes, r=QuietMisdreavus
bors [Tue, 23 Jan 2018 13:23:58 +0000 (13:23 +0000)]
Auto merge of #47620 - GuillaumeGomez:multiple-themes, r=QuietMisdreavus

Multiple themes for rustdoc

r? @QuietMisdreavus

6 years agoRemove broken redundant backtrace hint
Ryan Cumming [Tue, 23 Jan 2018 08:42:46 +0000 (19:42 +1100)]
Remove broken redundant backtrace hint

When the compiler driver panics it attempts to show a hint about using
`RUST_BACKTRACE`. However, the logic is currently reversed to the hint
is only shown if `RUST_BACKTRACE` is *already* set:

```shell
> RUST_BACKTRACE=1 rustc /dev/null --crate-type proc-macro
error: internal compiler error: unexpected panic
...
note: run with `RUST_BACKTRACE=1` for a backtrace

thread 'rustc' panicked at 'attempt to subtract with overflow', librustc_errors/emitter.rs:287:49
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

> RUST_BACKTRACE=0 rustc /dev/null --crate-type proc-macro
error: internal compiler error: unexpected panic
...
thread 'rustc' panicked at 'attempt to subtract with overflow', librustc_errors/emitter.rs:287:49
note: Run with `RUST_BACKTRACE=1` for a backtrace.
```

As the `panic` itself already has a working `RUST_BACKTRACE` hint just
remove the broken duplicate hint entirely.

6 years agoRollup merge of #47610 - cuviper:captured-dwarf, r=eddyb
kennytm [Tue, 23 Jan 2018 09:03:40 +0000 (17:03 +0800)]
Rollup merge of #47610 - cuviper:captured-dwarf, r=eddyb

LLVM5: Update DW_OP_plus to DW_OP_plus_uconst

LLVM <= 4.0 used a non-standard interpretation of `DW_OP_plus`.  In the
DWARF standard, this adds two items on the expressions stack.  LLVM's
behavior was more like DWARF's `DW_OP_plus_uconst` -- adding a constant
that follows the op.  The patch series starting with [D33892] switched
to the standard DWARF interpretation, so we need to follow.

[D33892]: https://reviews.llvm.org/D33892

Fixes #47464
r? @eddyb

6 years agoRollup merge of #47558 - spastorino:rustc_args, r=nikomatsakis
kennytm [Tue, 23 Jan 2018 09:03:39 +0000 (17:03 +0800)]
Rollup merge of #47558 - spastorino:rustc_args, r=nikomatsakis

Add rustc-args option to test runner

r? @nikomatsakis

6 years agoRollup merge of #47554 - EdSchouten:cloudabi-jemalloc, r=nikomatsakis
kennytm [Tue, 23 Jan 2018 09:03:38 +0000 (17:03 +0800)]
Rollup merge of #47554 - EdSchouten:cloudabi-jemalloc, r=nikomatsakis

Make liballoc_jemalloc work on CloudABI.

The automated builds for CloudABI in dist-various-2 don't use
--disable-jemalloc, even though my original container image did. Instead
of setting that flag, let's go the extra mile of making jemalloc work.
CloudABI's C library already uses jemalloc and now exposes the API
extensions used by us.

This makes the CloudABI dist work out of the box.

6 years agoRollup merge of #47549 - Manishearth:29723-regression, r=nikomatsakis
kennytm [Tue, 23 Jan 2018 09:03:37 +0000 (17:03 +0800)]
Rollup merge of #47549 - Manishearth:29723-regression, r=nikomatsakis

Add regression test for #29723

cc #29723

r? @nikomatsakis

6 years agoRollup merge of #47541 - psumbera:master, r=eddyb
kennytm [Tue, 23 Jan 2018 09:03:36 +0000 (17:03 +0800)]
Rollup merge of #47541 - psumbera:master, r=eddyb

Fixes sparc64 cabi fixes.

Argument up to 16 bytes size is provided in registers.
Return value up to 32 bytes size is stored in registers.

Fixes: #46679
---

Firefox now (almost) build on sparc. Original rust issue seems to be gone. Note that I'm not rust expert and the fix was suggested in bug.

6 years agoRollup merge of #47440 - mark-i-m:zunpretty, r=nikomatsakis
kennytm [Tue, 23 Jan 2018 09:03:35 +0000 (17:03 +0800)]
Rollup merge of #47440 - mark-i-m:zunpretty, r=nikomatsakis

Change the --unpretty flag to -Z unpretty

First PR :smile: !

-Z unpretty no longer requires -Z unstable-options.

Also, I mildly changed the syntax of the flag to match the other -Z flags. All uses of the flag take the form `unpretty=something` where something can either `string` or `string=string` (see the help messages of the CLI).

Fix #47395

r? @nikomatsakis EDIT: apparently rust-highfive doesn't see edits...

6 years agoRollup merge of #47425 - EdSchouten:immutable-tls, r=nikomatsakis
kennytm [Tue, 23 Jan 2018 09:03:34 +0000 (17:03 +0800)]
Rollup merge of #47425 - EdSchouten:immutable-tls, r=nikomatsakis

Properly pass down immutability info for thread-locals.

For thread-locals we call into cat_rvalue_node() to create a CMT
(Category, Mutability, Type) that always has McDeclared. This is
incorrect for thread-locals that don't have the 'mut' keyword; we should
use McImmutable there.

Extend cat_rvalue_node() to have an additional mutability parameter. Fix
up all the callers to make use of that function. Also extend one of the
existing unit tests to cover this.

Fixes: #47053
6 years agoRollup merge of #47423 - est31:rustbook_checking, r=alexcrichton
kennytm [Tue, 23 Jan 2018 09:03:32 +0000 (17:03 +0800)]
Rollup merge of #47423 - est31:rustbook_checking, r=alexcrichton

Check for deadlinks from the summary during book generation

Previously, any deadlinks from a book's SUMMARY.md wouldn't
cause any errors or warnings or similar but mdbook would simply
create a page with blank content.

This has kept bug #47394 hidden. It should have been detected
back in the PR when those wrongly named files got added to the
book.

PR #47414 was one component of the solution. This change
is a second line of defense for the unstable book and a first
line of defense for any other book.

We also update mdbook to the most recent version.

6 years agoAuto merge of #47046 - Manishearth:intra-doc-links, r=eddyb,GuillaumeGomez,QuietMisdr...
bors [Tue, 23 Jan 2018 07:38:53 +0000 (07:38 +0000)]
Auto merge of #47046 - Manishearth:intra-doc-links, r=eddyb,GuillaumeGomez,QuietMisdreavus,Manishearth

Implement RFC 1946 - intra-rustdoc links

https://github.com/rust-lang/rfcs/pull/1946 https://github.com/rust-lang/rust/issues/43466

Note for reviewers: The plain line counts are a little inflated because of how the markdown link parsing was done. [Read the file diff with "whitespace only" changes removed](https://github.com/rust-lang/rust/pull/47046/files?w=1) to get a better view of what actually changed there.

This pulls the name/path resolution mechanisms out of the compiler and runs it on the markdown in a crate's docs, so that links can be made to `SomeStruct` directly rather than finding the folder path to `struct.SomeStruct.html`. Check the `src/test/rustdoc/intra-paths.rs` test in this PR for a demo. The change was... a little invasive, but unlocks a really powerful mechanism for writing documentation that doesn't care about where an item was written to on the hard disk.

Items included:

 - [x] Make work with the hoedown renderer
 - [x] Handle relative paths
 - [x] Parse out the "path ambiguities" qualifiers (`[crate foo]`, `[struct Foo]`, `[foo()]`, `[static FOO]`, `[foo!]`, etc)
 - [x] Resolve foreign macros
 - [x] Resolve local macros
 - [x] Handle the use of inner/outer attributes giving different resolution scopes (handling for non-modules pushed to different PR)

Items not included:

 - [ ] Make sure cross-crate inlining works (blocked on refactor described in https://github.com/rust-lang/rust/pull/47046#issuecomment-354824520)
 - [ ] Implied Shortcut Reference Links (where just doing `[::std::iter::Iterator][]` without a reference anchor will resolve using the reference name rather than the link target) (requires modifying the markdown parser - blocked on Hoedown/Pulldown switch and https://github.com/google/pulldown-cmark/issues/121)
 - [ ] Handle enum variants and UFCS methods (Enum variants link to the enum page, associated methods don't link at all)
 - [ ] Emit more warnings/errors when things fail to resolve (linking to a value-namespaced item without a qualifier will emit an error, otherwise the link is just treated as a url, not a rust path)
 - [ ] Give better spans for resolution errors (currently the span for the first doc comment is used)
 - [ ] Check for inner doc comments on things that aren't modules

I'm making the PR, but it should be noted that most of the work was done by Misdreavus :smile:

(Editor's note: This has become a lie, check that commit log, Manish did a ton of work after this PR was opened `>_>`)

6 years agoPort borrows across yield check to MIR borrowck
John Kåre Alsaker [Thu, 11 Jan 2018 18:50:40 +0000 (19:50 +0100)]
Port borrows across yield check to MIR borrowck

6 years agoAdd dropck test
John Kåre Alsaker [Thu, 11 Jan 2018 18:50:01 +0000 (19:50 +0100)]
Add dropck test

6 years agoFix yield-while-local-borrowed.rs test
John Kåre Alsaker [Thu, 11 Jan 2018 18:49:26 +0000 (19:49 +0100)]
Fix yield-while-local-borrowed.rs test

6 years agoUse delay_span_bug for things that should be errors
John Kåre Alsaker [Thu, 11 Jan 2018 18:46:51 +0000 (19:46 +0100)]
Use delay_span_bug for things that should be errors

6 years agoMake immovable generators unsafe
John Kåre Alsaker [Fri, 22 Dec 2017 21:12:27 +0000 (22:12 +0100)]
Make immovable generators unsafe

6 years agoAdds support for immovable generators. Move checking of invalid borrows across suspen...
John Kåre Alsaker [Sat, 7 Oct 2017 14:36:28 +0000 (16:36 +0200)]
Adds support for immovable generators. Move checking of invalid borrows across suspension points to borrowck. Fixes #44197, #45259 and #45093.

6 years agorustdoc: Show when traits are auto traits
Oliver Middleton [Tue, 23 Jan 2018 01:04:24 +0000 (01:04 +0000)]
rustdoc: Show when traits are auto traits

6 years agoFasten even more theme switch
Guillaume Gomez [Mon, 22 Jan 2018 23:45:34 +0000 (00:45 +0100)]
Fasten even more theme switch

6 years agoAuto merge of #47373 - wesleywiser:incr_cache_hashing, r=michaelwoerister
bors [Mon, 22 Jan 2018 23:32:16 +0000 (23:32 +0000)]
Auto merge of #47373 - wesleywiser:incr_cache_hashing, r=michaelwoerister

[Incremental] Cache hashes for AdDef and ty::Slice<T>

r? @michaelwoerister

6 years agodon't process code blocks when scanning for links
QuietMisdreavus [Mon, 22 Jan 2018 23:04:55 +0000 (17:04 -0600)]
don't process code blocks when scanning for links

6 years agoFasten up theme loading
Guillaume Gomez [Mon, 22 Jan 2018 22:44:08 +0000 (23:44 +0100)]
Fasten up theme loading

6 years agoFix quoted search
Guillaume Gomez [Mon, 22 Jan 2018 21:49:44 +0000 (22:49 +0100)]
Fix quoted search

6 years agoStabilized `#[repr(align(x))]` attribute (RFC 1358)
Cameron Hart [Mon, 25 Dec 2017 23:24:23 +0000 (10:24 +1100)]
Stabilized `#[repr(align(x))]` attribute (RFC 1358)

6 years agoChange theme icon
Guillaume Gomez [Mon, 22 Jan 2018 20:38:56 +0000 (21:38 +0100)]
Change theme icon

6 years agoAuto merge of #47507 - alexcrichton:rerun-bat-scripts, r=michaelwoerister
bors [Mon, 22 Jan 2018 20:30:14 +0000 (20:30 +0000)]
Auto merge of #47507 - alexcrichton:rerun-bat-scripts, r=michaelwoerister

rustc: Lower link args to `@`-files on Windows more

When spawning a linker rustc has historically been known to blow OS limits for
the command line being too large, notably on Windows. This is especially true of
incremental compilation where there can be dozens of object files per
compilation. The compiler currently has logic for detecting a failure to spawn
and instead passing arguments via a file instead, but this failure detection
only triggers if a process actually fails to spawn.

Unfortunately on Windows we've got something else to worry about which is
`cmd.exe`. The compiler may be running a linker through `cmd.exe` where
`cmd.exe` has a limit of 8192 on the command line vs 32k on `CreateProcess`.
Moreso rustc actually succeeds in spawning `cmd.exe` today, it's just that after
it's running `cmd.exe` fails to spawn its child, which rustc doesn't currently
detect.

Consequently this commit updates the logic for the spawning the linker on
Windows to instead have a heuristic to see if we need to pass arguments via a
file. This heuristic is an overly pessimistic and "inaccurate" calculation which
just calls `len` on a bunch of `OsString` instances (where `len` is not
precisely the length in u16 elements). This number, when exceeding the 6k
threshold, will force rustc to always pass arguments through a file.

This strategy should avoid us trying to parse the output on Windows of the
linker to see if it successfully spawned yet failed to actually sub-spawn the
linker. We may just be passing arguments through files a little more commonly
now...

The motivation for this commit was a recent bug in Gecko [1] when beta testing,
notably when incremental compilation was enabled it blew out the limit on
`cmd.exe`. This commit will also fix #46999 as well though as emscripten uses a
bat script as well (and we're blowing the limit there).

[1]: https://bugzilla.mozilla.org/show_bug.cgi?id=1430886

Closes #46999

6 years agotweak colors on dark theme
QuietMisdreavus [Mon, 22 Jan 2018 20:27:58 +0000 (14:27 -0600)]
tweak colors on dark theme

6 years agoAdd dynamic-drop test to nll tests also
Santiago Pastorino [Mon, 22 Jan 2018 18:08:57 +0000 (15:08 -0300)]
Add dynamic-drop test to nll tests also

6 years agoInline some rustc_driver function
bjorn3 [Mon, 22 Jan 2018 17:18:40 +0000 (18:18 +0100)]
Inline some rustc_driver function

6 years agoTemporary fix missing escape_href in hoedown_link by copying pulldown's code
Manish Goregaokar [Mon, 22 Jan 2018 16:53:08 +0000 (22:23 +0530)]
Temporary fix missing escape_href in hoedown_link by copying pulldown's code

6 years agoDo not suggest private traits that have missing method
Esteban Küber [Thu, 18 Jan 2018 04:15:13 +0000 (20:15 -0800)]
Do not suggest private traits that have missing method

When encountering a method call for an ADT that doesn't have any
implementation of it, we search for traits that could be implemented
that do have that method. Filter out private non-local traits that would
not be able to be implemented.

This doesn't account for public traits that are in a private scope, but
works as a first approximation and is a more correct behavior than the
current one.

6 years agoAuto merge of #47353 - nikomatsakis:nll-issue-47189, r=pnkfelix+nmatsakis
bors [Mon, 22 Jan 2018 11:11:47 +0000 (11:11 +0000)]
Auto merge of #47353 - nikomatsakis:nll-issue-47189, r=pnkfelix+nmatsakis

renumber regions in generators

This fixes #47189, but I think we still have to double check various things around how to treat generators in MIR type check + borrow check (e.g., what borrows should be invalidated by a `Suspend`? What consistency properties should type check be enforcing anyway around the "interior" type?)

Also fixes #47587 thanks to @spastorino's commit.

r? @pnkfelix

6 years agoUpdate to new commonmark arg
Manish Goregaokar [Mon, 22 Jan 2018 10:55:59 +0000 (16:25 +0530)]
Update to new commonmark arg

6 years agoFix spurious warning on empty proc macro crates
Ryan Cumming [Mon, 22 Jan 2018 09:58:21 +0000 (20:58 +1100)]
Fix spurious warning on empty proc macro crates

While attempting to reproduce rust-lang/rust#47086 I noticed the
following warning:

```shell
> rustc /dev/null --crate-type proc-macro
warning: unused variable: `registrar`
 --> /dev/null:0:1
```

As there are no macros to register the automatically generated registrar
function for the crate has no body. As a result its `registrar` argument
is unused triggering the above warning.

The warning is confusing and not easily actionable by the developer. It
could also be triggered legitimately by e.g. having all of the macros in
a crate #[cfg]'ed out.

Fix by naming the generated argument `_registrar` inside
`mk_registrar()`. This suppresses the unused variable warning.

6 years agoReview fixes
Manish Goregaokar [Mon, 22 Jan 2018 09:59:34 +0000 (15:29 +0530)]
Review fixes

6 years agoMove macro_resolve() into a function
Manish Goregaokar [Fri, 19 Jan 2018 12:43:50 +0000 (18:13 +0530)]
Move macro_resolve() into a function

6 years agoMove resolve() into a function
Manish Goregaokar [Fri, 19 Jan 2018 12:27:10 +0000 (17:57 +0530)]
Move resolve() into a function

6 years agoAdd ambiguity errors for macros
Manish Goregaokar [Fri, 19 Jan 2018 12:13:08 +0000 (17:43 +0530)]
Add ambiguity errors for macros

6 years agoMove the figuring out of the 'kind' of def out into functions
Manish Goregaokar [Fri, 19 Jan 2018 11:57:18 +0000 (17:27 +0530)]
Move the figuring out of the 'kind' of def out into functions

6 years agoAllow macros to be resolved with ambiguous idents too
Manish Goregaokar [Fri, 19 Jan 2018 11:49:01 +0000 (17:19 +0530)]
Allow macros to be resolved with ambiguous idents too

6 years agoAllow function@, value@, macro@
Manish Goregaokar [Fri, 19 Jan 2018 11:15:48 +0000 (16:45 +0530)]
Allow function@, value@, macro@

6 years agoError only in the case of overlap
Manish Goregaokar [Wed, 10 Jan 2018 05:36:51 +0000 (11:06 +0530)]
Error only in the case of overlap

6 years agoUse the registered def id (makes enum variants link to the enum page instead of not...
Manish Goregaokar [Tue, 9 Jan 2018 06:25:28 +0000 (11:55 +0530)]
Use the registered def id (makes enum variants link to the enum page instead of not at all)

6 years agoBetter error message
Manish Goregaokar [Tue, 9 Jan 2018 05:20:52 +0000 (10:50 +0530)]
Better error message

6 years agovalue-namespace items require a marker, so emit an error
QuietMisdreavus [Mon, 8 Jan 2018 19:20:19 +0000 (13:20 -0600)]
value-namespace items require a marker, so emit an error

6 years agoresolve module docs based on inner/outer attributes
QuietMisdreavus [Mon, 8 Jan 2018 17:10:50 +0000 (11:10 -0600)]
resolve module docs based on inner/outer attributes

6 years agoclean module docs while its module ID is still on the stack
QuietMisdreavus [Mon, 8 Jan 2018 16:07:16 +0000 (10:07 -0600)]
clean module docs while its module ID is still on the stack

6 years agoadd ambiguity markers to the intra-links test
QuietMisdreavus [Mon, 8 Jan 2018 15:33:27 +0000 (09:33 -0600)]
add ambiguity markers to the intra-links test

6 years agouse @ instead of space for link ambiguity markers
QuietMisdreavus [Mon, 8 Jan 2018 15:23:12 +0000 (09:23 -0600)]
use @ instead of space for link ambiguity markers

since spaces aren't allowed in link targets in commonmark, a new symbol
is needed to separate the marker from the rest of the path. hence, @

6 years agoadd a macro to the intra-links test
QuietMisdreavus [Sun, 7 Jan 2018 23:09:16 +0000 (17:09 -0600)]
add a macro to the intra-links test

6 years agoStore a list of local macros on the resolver; use for resolving intra-doc macro links
Manish Goregaokar [Sat, 6 Jan 2018 11:53:33 +0000 (17:23 +0530)]
Store a list of local macros on the resolver; use for resolving intra-doc macro links

6 years agoResolve foreign macros
Manish Goregaokar [Sat, 6 Jan 2018 08:31:54 +0000 (14:01 +0530)]
Resolve foreign macros

6 years agoRegister definitions
Manish Goregaokar [Sat, 6 Jan 2018 10:15:44 +0000 (15:45 +0530)]
Register definitions

6 years agoFix unit tests
Manish Goregaokar [Wed, 3 Jan 2018 08:41:54 +0000 (14:11 +0530)]
Fix unit tests

6 years agoFix tidy
Manish Goregaokar [Wed, 3 Jan 2018 06:03:04 +0000 (11:33 +0530)]
Fix tidy

6 years agoExit early for non-linky things
Manish Goregaokar [Mon, 1 Jan 2018 08:52:28 +0000 (14:22 +0530)]
Exit early for non-linky things

6 years agoHandle relative paths
Manish Goregaokar [Mon, 1 Jan 2018 07:31:19 +0000 (13:01 +0530)]
Handle relative paths

6 years agoUse correct item for links in modules
Manish Goregaokar [Mon, 1 Jan 2018 06:26:07 +0000 (11:56 +0530)]
Use correct item for links in modules