Commit Graph

94257 Commits

Author SHA1 Message Date
Esteban Küber
e275f2caf6 Extend docstring 2019-06-01 14:13:57 -07:00
bors
03ee55bb1c Auto merge of #61436 - Manishearth:clippyup, r=Manishearth
Update clippy

r? @ghost
2019-06-01 18:58:54 +00:00
Esteban Küber
0754c84611 Explain that impl Trait introduces an implicit type argument 2019-06-01 11:35:54 -07:00
Eduard-Mihai Burtescu
25d6834493 rustc_codegen_llvm: replace fn noname() with const UNNAMED. 2019-06-01 21:13:08 +03:00
Eduard-Mihai Burtescu
268e64641f rustc_codegen_llvm: pretty up a few builder methods with a macro. 2019-06-01 21:12:42 +03:00
Manish Goregaokar
16bc2c2c5e Update clippy 2019-06-01 10:50:55 -07:00
Eduard-Mihai Burtescu
f7a4c9d7b5 rustc: collect upvars from HIR, instead of during name resolution. 2019-06-01 20:44:05 +03:00
Esteban Küber
28859472f7 Point at individual type arguments on arg count mismatch 2019-06-01 10:35:31 -07:00
Eduard-Mihai Burtescu
648b4d884d rustc_resolve: never push ClosureRibKind to label_ribs. 2019-06-01 20:28:59 +03:00
Eduard-Mihai Burtescu
ed1bbbb545 rustc: remove Res::Upvar. 2019-06-01 20:28:48 +03:00
Eduard-Mihai Burtescu
340b91e2ff rustc: remove has_parent from hir::Upvar. 2019-06-01 19:17:23 +03:00
Eduard-Mihai Burtescu
a0ca2a2deb rustc: track the body owner in liveness. 2019-06-01 19:17:23 +03:00
Eduard-Mihai Burtescu
b13d0407d4 rustc: remove closure ID from Res::Upvar. 2019-06-01 19:17:23 +03:00
Eduard-Mihai Burtescu
1768030791 rustc: track the body owner DefId in MC and EUV. 2019-06-01 19:17:23 +03:00
Eduard-Mihai Burtescu
961fe5479f rustc: use indexmap instead of a plain vector for upvars. 2019-06-01 19:17:22 +03:00
bors
afaf976371 Auto merge of #61350 - RalfJung:alloc, r=oli-obk
light refactoring of global AllocMap

* rename AllocKind -> GlobalAlloc. This stores the allocation itself, not just its kind.
* rename the methods that allocate stuff to have consistent names.

Cc @oli-obk
2019-06-01 16:06:11 +00:00
Eduard-Mihai Burtescu
9fe0052e54 rustc: remove the closure ID from hir::Upvar's parent field. 2019-06-01 19:01:09 +03:00
Eduard-Mihai Burtescu
4b9670a245 rustc: remove the index field from Res::Upvar. 2019-06-01 19:01:09 +03:00
Eduard-Mihai Burtescu
26e61dd826 rustc: replace Res in hir::Upvar with only Local/Upvar data. 2019-06-01 19:01:09 +03:00
bors
cd3f21bc7d Auto merge of #61388 - Amanieu:hashbrown4, r=alexcrichton
Bump hashbrown to 0.4.0

Fixes #61357

This also includes rust-lang/hashbrown#80.
2019-06-01 11:10:11 +00:00
David Wood
e71f4665f6
codegen: change $6d$ to $u6d$
This changes a mistake introduced in #61195 where the mangling
workaround used was incorrect.
2019-06-01 11:37:11 +01:00
Amanieu d'Antras
a386a9edcc Bump hashbrown to 0.4.0
Fixes #61357
2019-06-01 10:29:23 +01:00
bors
885c7dfddc Auto merge of #61418 - Centril:rollup-yvj33a1, r=Centril
Rollup of 8 pull requests

Successful merges:

 - #60729 (Expand dynamic drop tests for cases in #47949)
 - #61263 (Don't generate div inside header (h4/h3/h...) elements)
 - #61364 (Stabilize reverse_bits feature)
 - #61375 (Make "panic did not include expected string" message consistent)
 - #61387 (Remove ty::BrFresh and RegionConstraintCollector::new_bound)
 - #61389 (Remove GlobalArenas and use Arena instead)
 - #61391 (Doc comment fixes for `rustc::mir::interpret::InterpretCx`)
 - #61403 (Remove unnecessary `-Z continue-parse-after-error` from tests)

Failed merges:

r? @ghost
2019-06-01 06:34:15 +00:00
Esteban Küber
8e595f5610 Make generics always have a valid span 2019-05-31 22:19:30 -07:00
Mazdak Farrokhzad
23de376572
Rollup merge of #61403 - estebank:test-cleanup, r=petrochenkov
Remove unnecessary `-Z continue-parse-after-error` from tests

r? @petrochenkov
2019-06-01 06:50:10 +02:00
Mazdak Farrokhzad
c081974845
Rollup merge of #61391 - wesleywiser:doc_comments_interpretcx, r=Centril
Doc comment fixes for `rustc::mir::interpret::InterpretCx`

Fixes some stuff I noticed while working in const-prop.
2019-06-01 06:50:09 +02:00
Mazdak Farrokhzad
760a98fb5e
Rollup merge of #61389 - Zoxc:arena-cleanup, r=eddyb
Remove GlobalArenas and use Arena instead

r? @eddyb
2019-06-01 06:50:07 +02:00
Mazdak Farrokhzad
93fc627c7d
Rollup merge of #61387 - JohnTitor:remove-unused, r=matthewjasper
Remove ty::BrFresh and RegionConstraintCollector::new_bound

Fixes #60957

r? @matthewjasper
2019-06-01 06:50:06 +02:00
Mazdak Farrokhzad
d0a0ba42d7
Rollup merge of #61375 - varkor:panic-contains-string-lowercase, r=Centril
Make "panic did not include expected string" message consistent

Note messages are typically lowercase.
2019-06-01 06:50:05 +02:00
Mazdak Farrokhzad
7d3a0dd2fb
Rollup merge of #61364 - lzutao:stabilize-reverse_bits, r=Centril
Stabilize reverse_bits feature

FCP done in https://github.com/rust-lang/rust/issues/48763#issuecomment-497349379

Closes #48763

r? @Centril
2019-06-01 06:50:03 +02:00
Mazdak Farrokhzad
525d7deb6d
Rollup merge of #61263 - GuillaumeGomez:valid-html, r=Manishearth
Don't generate div inside header (h4/h3/h...) elements

Fixes #60865.

According to the HTML spec, we're not supposed to put `div` elements inside heading elements (h4/h3/h...). It doesn't change the display as far as I could tell.

r? @QuietMisdreavus
2019-06-01 06:50:02 +02:00
Mazdak Farrokhzad
837df52d85
Rollup merge of #60729 - matthewjasper:leak-after-into, r=nikomatsakis
Expand dynamic drop tests for cases in #47949

Adds test cases for #47949
2019-06-01 06:50:00 +02:00
Esteban Küber
ebbe725dd0 Tweak wording 2019-05-31 20:48:09 -07:00
bors
8b40a188ce Auto merge of #60145 - little-dude:ip2, r=alexcrichton
std::net: Ipv4Addr and Ipv6Addr improvements

Picking this up again from my previous PR: https://github.com/rust-lang/rust/pull/56050
Related to: https://github.com/rust-lang/rust/issues/27709
Fixes: https://github.com/rust-lang/rust/issues/57558

- add `add Ipv4Addr::is_reserved()`
  - [X] implementation
  - [X] tests
- add `Ipv6Addr::is_unicast_link_local_strict()` and update `Ipv6Addr::is_unicast_link_local()` documentation
  - [X] implementation
  - [X] test
- add `Ipv4Addr::is_benchmarking()`
  - [X] implementation
  - [X] test
- add `Ipv4Addr::is_ietf_protocol_assignment()`
  - [X] implementation
  - [X] test
- add `Ipv4Addr::is_shared()`
  - [X] implementation
  - [x] test
- fix `Ipv4Addr:is_global()`
  - [X] implementation
  - [x] test
- [X] refactor the tests for IP properties. This makes the tests more verbose, but using macros have two advantages:
    - it will now be easier to add tests for all the new methods
    - we get clear error messages when a test is failing. For instance:

```
---- net::ip::tests::ip_properties stdout ----
thread '<unnamed>' panicked at 'assertion failed: !ip!("fec0::").is_global()', src/libstd/net/ip.rs:2036:9

```

Whereas previously it was something like

```
thread '<unnamed>' panicked at 'assertion failed: `(left == right)`
   left: `true`,
  right: `false`', libstd/net/ip.rs:1948:13
```

-----------------------

# Ongoing discussions:

## Should `Ipv4Addr::is_global()` return `true` or `false` for reserved addresses?

Reserved addresses are addresses that are matched by `Ipv4Addr::is_reserved()`.
@the8472 [pointed out](https://github.com/rust-lang/rust/pull/60145#issuecomment-485458319) that [RFC 4291](https://tools.ietf.org/html/rfc4291#section-2.4) says IPv6 reserved addresses should be considered global:

```
Future specifications may redefine one or more sub-ranges of the
Global Unicast space for other purposes, but unless and until that
happens, implementations must treat all addresses that do not start
with any of the above-listed prefixes as Global Unicast addresses.
```

We could extrapolate that this should also be the case for IPv4. However, it seems that [IANA considers them non global](https://www.iana.org/assignments/ipv4-address-space/ipv4-address-space.xhtml) (see [my comment](https://github.com/rust-lang/rust/pull/60145#issuecomment-485713270))

### Final decision

There seems to be a consensus that reserved addresses have a different meaning for IPv4 and IPv6 ([comment1](https://github.com/rust-lang/rust/pull/60145#issuecomment-485963789) [comment2](https://github.com/rust-lang/rust/pull/60145#issuecomment-485944582), so we can consider that RFC4291 does not apply to IPv4, and that reserved IPv4 addresses are _not_ global.

## Should `Ipv6Addr::is_unicast_site_local()` exist?

@pusateri [noted](https://github.com/rust-lang/rust/pull/60145#issuecomment-485507515) that site-local addresses have been deprecated for a while by [RFC 3879](https://tools.ietf.org/html/rfc3879) and new implementations _must not_ support them. However, since this method is stable, removing does not seem possible. This kind of situation is covered by the RFC which stated that existing implementation _may_ continue supporting site-local addresses.

### Final decision

Let's keep this method. It is stable already, and the RFC explicitly states that existing implementation may remain.

---------

Note: I'll be AFK from April 27th to May 11th. Anyone should feel free to pick this up if the PR hasn't been merged by then. Sorry for dragging that for so long already.
2019-06-01 03:46:13 +00:00
Esteban Küber
74fb3bbee4 On type inference errors use the type argument name when possible
```
error[E0282]: type annotations needed in `std::result::Result<i32, E>`
 --> file7.rs:3:13
  |
3 |     let b = Ok(4);
  |         -   ^^ cannot infer type for `E` in `std::result::Result<i32, E>`
  |         |
  |         consider giving `b` a type`
```
2019-05-31 18:33:59 -07:00
Esteban Küber
65c2a7b18b Alternative wording for inference failure 2019-05-31 18:33:59 -07:00
Esteban Küber
8bb094dac5 Add more detail to type inference error
When encountering code where type inference fails, add more actionable
information:

```
fn main() {
    let foo = Vec::new();
}
```

```
error[E0282]: type annotations needed for `std::vec::Vec<_>`
  --> $DIR/vector-no-ann.rs:2:16
   |
LL |     let foo = Vec::new();
   |         ---   ^^^^^^^^ cannot infer type for `T`
   |         |
   |         consider giving `foo` the type `std::vec::Vec<_>` with the type parameter `T` specified
```

We still need to modify type printing to optionally accept a
`TypeVariableTable` in order to properly print `std::vec::Vec<T>`.

CC #25633.
2019-05-31 18:33:59 -07:00
bors
84f729d0d4 Auto merge of #61394 - pietroalbini:rollup-lzugnb4, r=pietroalbini
Rollup of 11 pull requests

Successful merges:

 - #60897 (error: remove StringError from Debug output)
 - #61304 (Speed up Azure CI installing Windows dependencies)
 - #61319 (Swap order of `unsafe async fn` to `async unsafe fn`)
 - #61342 (Set ellipsis_inclusive_range_patterns lint to warn)
 - #61344 (Add regression test for const generics ICE)
 - #61359 (Fix links in Deref documentation)
 - #61363 (Stabilize iter_nth_back feature)
 - #61369 (Fixed lifetime misspelling)
 - #61372 (Migrate some books to mdbook version 0.2)
 - #61374 (Explicitly suggest 'type_ascription' feature)
 - #61382 (Fixed a typo in core::convert::AsMut)

Failed merges:

r? @ghost
2019-06-01 00:57:37 +00:00
bors
041bec87c0 Auto merge of #61300 - indygreg:upgrade-cross-make, r=sanxiyn
Update musl-cross-make to 0.9.8

This version uses musl 1.1.22 and GCC 6.4.0 by default. It also
contains support for newer binutils and GCC versions, should we
want to bump those as well. But I'm purposefully limiting this
patch in order to reduce the surface area for controversy.
2019-05-31 22:16:09 +00:00
Esteban Küber
d6ea6b972d fix tidy 2019-05-31 13:50:04 -07:00
bors
7840a0b753 Auto merge of #57967 - eddyb:rmangle, r=michaelwoerister
Introduce Rust symbol mangling scheme.

This is an implementation of a "feature-complete" Rust mangling scheme, in the vein of rust-lang/rfcs#2603 ~~- but with some differences, see https://github.com/rust-lang/rfcs/pull/2603#issuecomment-458410463 for details~~ (@michaelwoerister integrated my proposed changes into the RFC itself).

On nightly, you can now control the mangling scheme with `-Z symbol-mangling-version`, which can be:
* `legacy`: the older mangling version, still the default currently
* `v0`: the new RFC mangling version, as implemented by this PR

To test the new mangling, set `RUSTFLAGS=-Zsymbol-mangling-version=v0` (or change [`rustflags` in `.cargo/config.toml`](https://doc.rust-lang.org/cargo/reference/config.html#configuration-keys)). Please note that only symbols from crates built with that flag will use the new mangling, and that tool support (e.g. debuggers) will be limited initially, and it may take a while for everything to be upstreamed. However, `RUST_BACKTRACE` should work out of the box with either mangling version.

<hr/>

The demangling implementation PR is https://github.com/alexcrichton/rustc-demangle/pull/23
~~(this PR already uses it via a git dependency, to allow testing)~~.

Discussion of the *design* of the mangling scheme should still happen on the RFC, but this PR's specific implementation details can be reviewed in parallel.

*Notes for reviewers*:
* ~~only the last 6 commits are specific to this branch, if necessary I can open a separate PR for everything else (it was meant to be its own small refactoring, but it got a bit out of hand)~~
~~based on #58140~~
* the "harness" commit is only there because it does some extra validation (comparing the demangling from `rustc-demangle` to the compiler's pretty-printing, adjusted slightly to produce the same output), that I would like to try on crater
* ~~there is the question of whether we should turn on the new mangling now, wait for tools to support it (I'm working on that), and/or have it under a `-Z` flag for now~~ (we're gating this on `-Z symbol-mangling-version=v0`, see above)

r? @nikomatsakis / @michaelwoerister cc @rust-lang/compiler
2019-05-31 17:10:11 +00:00
Eduard-Mihai Burtescu
3652ea4594 test: add a more complex symbol-name testcase. 2019-05-31 19:24:15 +03:00
Eduard-Mihai Burtescu
9cf35bfbe7 rustc_codegen_utils: remove symbol name dumping/checking harness, and mw impl. 2019-05-31 18:24:55 +03:00
Eduard-Mihai Burtescu
6386a31c5b rustc_codegen_utils: update mw's symbol mangler implementation. 2019-05-31 18:24:54 +03:00
Eduard-Mihai Burtescu
0e5f27b169 rustc_codegen_utils: add harness for dumping/checking symbol names, and mw mangling impl. 2019-05-31 18:24:54 +03:00
Eduard-Mihai Burtescu
e3315075f9 test: force legacy mangling for run-make-fulldeps/a-b-a-linker-guard. 2019-05-31 18:24:54 +03:00
Eduard-Mihai Burtescu
5fd3e89d70 test: support both (legacy and v0) choices of mangling. 2019-05-31 18:24:53 +03:00
Eduard-Mihai Burtescu
408bf9de34 rustc_codegen_utils: don't ignore Ctor path components in symbols. 2019-05-31 18:24:53 +03:00
Eduard-Mihai Burtescu
2092963a18 rustc_codegen_utils: add new mangling scheme implementation. 2019-05-31 18:24:42 +03:00
Eduard-Mihai Burtescu
654d0596d3 rustc_codegen_utils: test demangler output, not just symbol names. 2019-05-31 18:23:03 +03:00