]> git.lizzy.rs Git - rust.git/log
rust.git
5 years agoAuto merge of #62221 - jonas-schievink:normalize-impl-trait, r=nikomatsakis
bors [Tue, 9 Jul 2019 18:35:12 +0000 (18:35 +0000)]
Auto merge of #62221 - jonas-schievink:normalize-impl-trait, r=nikomatsakis

Normalize projections appearing in `impl Trait`

Fixes #60414

This does not try to do the same for `existential type`s (which have the same bug), since that always seems to lead to cycle errors.

5 years agoAuto merge of #62233 - matthewjasper:exit-arm-scopes, r=pnkfelix
bors [Tue, 9 Jul 2019 13:10:31 +0000 (13:10 +0000)]
Auto merge of #62233 - matthewjasper:exit-arm-scopes, r=pnkfelix

Exit arm scopes

Due to a bug in the HIR CFG construction, borrows for arm scopes were incorrectly leaking into other arms.
This PR also includes some drive-by improvements to `-Zunpretty=hir,identified` that would have been helpful while investigating this.

Closes #62107

5 years agorewrite the test to workaround #51525
Niko Matsakis [Tue, 9 Jul 2019 10:57:52 +0000 (06:57 -0400)]
rewrite the test to workaround #51525

5 years agoAuto merge of #62463 - Disasm:riscv-lto, r=alexcrichton
bors [Tue, 9 Jul 2019 09:50:51 +0000 (09:50 +0000)]
Auto merge of #62463 - Disasm:riscv-lto, r=alexcrichton

Update LLVM: apply patch necessary for ThinLTO on RISC-V

This patch allows [using inlined assembly operations](https://github.com/rust-embedded/cortex-m/issues/139) on stable Rust with the help of ThinLTO.

5 years agoAuto merge of #62460 - RalfJung:llvm-null, r=eddyb
bors [Tue, 9 Jul 2019 06:20:44 +0000 (06:20 +0000)]
Auto merge of #62460 - RalfJung:llvm-null, r=eddyb

 Handle null from LLVMRustGetSectionName

As part of https://github.com/rust-lang/rust/pull/58783 and https://github.com/rust-lang/rust/pull/62103, this incorrect use of a NULL pointer was found in the interface to LLVM. That PR is stuck with some linker issues, but there is no reason the soundness fix should have to wait for that.

5 years agoAuto merge of #62511 - Centril:rollup-ojzb35x, r=Centril
bors [Tue, 9 Jul 2019 02:53:20 +0000 (02:53 +0000)]
Auto merge of #62511 - Centril:rollup-ojzb35x, r=Centril

Rollup of 4 pull requests

Successful merges:

 - #60458 (Add key and value methods to DebugMap)
 - #62090 (typeck: merge opaque type inference logic)
 - #62403 (Replace SliceConcatExt trait with inherent methods and SliceConcat helper trait)
 - #62494 (Remove unused dependencies)

Failed merges:

r? @ghost

5 years agoRollup merge of #62494 - sinkuu:unused_deps, r=alexcrichton
Mazdak Farrokhzad [Tue, 9 Jul 2019 02:52:40 +0000 (04:52 +0200)]
Rollup merge of #62494 - sinkuu:unused_deps, r=alexcrichton

Remove unused dependencies

5 years agoRollup merge of #62403 - SimonSapin:concat, r=alexcrichton
Mazdak Farrokhzad [Tue, 9 Jul 2019 02:52:38 +0000 (04:52 +0200)]
Rollup merge of #62403 - SimonSapin:concat, r=alexcrichton

Replace SliceConcatExt trait with inherent methods and SliceConcat helper trait

Before this change `SliceConcatExt` was an unstable extension trait with stable methods. It was in the libstd prelude, so that its methods could be used on the stable channel.

This replaces it with inherent methods, which can be used without any addition to the prelude. Since the methods are stable and very generic (with for example a return type that depends on the types of parameters), an helper trait is still needed. But now that trait does not need to be in scope for the methods to be used.

Removing this depedency on the libstd prelude allows the methods to be used in `#![no_std]` crate that use liballoc, which does not have its own implicitly-imported prelude.

5 years agoRollup merge of #62090 - davidtwco:ice-async-await-out-of-range-substitution, r=nikom...
Mazdak Farrokhzad [Tue, 9 Jul 2019 02:52:37 +0000 (04:52 +0200)]
Rollup merge of #62090 - davidtwco:ice-async-await-out-of-range-substitution, r=nikomatsakis

typeck: merge opaque type inference logic

Fixes #55872. See [relevant Zulip topic](https://rust-lang.zulipchat.com/#narrow/stream/187312-wg-async-foundations/topic/type.20parameter.20out.20of.20range.20.2355872).

r? @nikomatsakis

5 years agoRollup merge of #60458 - KodrAus:debug_map_entry, r=alexcrichton
Mazdak Farrokhzad [Tue, 9 Jul 2019 02:52:35 +0000 (04:52 +0200)]
Rollup merge of #60458 - KodrAus:debug_map_entry, r=alexcrichton

Add key and value methods to DebugMap

Implementation PR for an active (not approved) RFC: https://github.com/rust-lang/rfcs/pull/2696.

Add two new methods to `std::fmt::DebugMap` for writing the key and value part of a map entry separately:

```rust
impl<'a, 'b: 'a> DebugMap<'a, 'b> {
    pub fn key(&mut self, key: &dyn Debug) -> &mut Self;
    pub fn value(&mut self, value: &dyn Debug) -> &mut Self;
}
```

I want to do this so that I can write a `serde::Serializer` that forwards to our format builders, so that any `T: Serialize` can also be treated like a `T: Debug`.

5 years agoadd feature to docs
Ashley Mannix [Mon, 8 Jul 2019 22:30:20 +0000 (08:30 +1000)]
add feature to docs

5 years agoAuto merge of #61224 - aloucks:drain_filter, r=Gankro
bors [Mon, 8 Jul 2019 22:03:26 +0000 (22:03 +0000)]
Auto merge of #61224 - aloucks:drain_filter, r=Gankro

Prevent Vec::drain_filter from double dropping on panic

Fixes: #60977
The changes in this PR prevent leaking and double-panicking in addition to double-drop.

Tracking issue: #43244

5 years agoRemove unused dependencies
Shotaro Yamada [Mon, 8 Jul 2019 15:17:42 +0000 (00:17 +0900)]
Remove unused dependencies

5 years agoAuto merge of #62473 - timvermeulen:is_sorted_by_key, r=scottmcm
bors [Mon, 8 Jul 2019 12:03:06 +0000 (12:03 +0000)]
Auto merge of #62473 - timvermeulen:is_sorted_by_key, r=scottmcm

Only call the closure parameter of Iterator::is_sorted_by_key once per item

See https://github.com/rust-lang/rust/issues/53485#issuecomment-472314004.

This changes `Iterator::is_sorted_by_key` to only call the given closure once for each item, which allows us to pass the items to the closure by value instead of by reference.

**Important**: `is_sorted_by_key` for slices and slice iterators is now no longer implemented in terms of the custom `slice::Iter::is_sorted_by` implementation. It's a trade-off: we could forward `slice::Iter::is_sorted_by_key` to it directly for potential SIMD benefits, but that would mean that the closure is potentially called twice for (almost) every element of the slice.

5 years agoAuto merge of #62366 - lzutao:feature/float-from-to-bytes, r=SimonSapin
bors [Mon, 8 Jul 2019 08:39:56 +0000 (08:39 +0000)]
Auto merge of #62366 - lzutao:feature/float-from-to-bytes, r=SimonSapin

Add float conversions to and from bytes

Rework of #58756. Address https://github.com/rust-lang/rust/pull/58756#issuecomment-488385889.

Fixes #57492.

r? @SimonSapin

5 years agoAdd documentation to float conversion methods
Lzu Tao [Thu, 4 Jul 2019 09:11:15 +0000 (09:11 +0000)]
Add documentation to float conversion methods

5 years agoAdd float conversions to and from bytes
Tobias Bucher [Tue, 26 Feb 2019 15:47:33 +0000 (16:47 +0100)]
Add float conversions to and from bytes

Use the same API as for integers.

Fixes #57492.

5 years agoAuto merge of #62485 - Centril:rollup-gg3it1u, r=Centril
bors [Mon, 8 Jul 2019 01:32:50 +0000 (01:32 +0000)]
Auto merge of #62485 - Centril:rollup-gg3it1u, r=Centril

Rollup of 5 pull requests

Successful merges:

 - #62356 (Implement Option::contains and Result::contains)
 - #62462 (Document `while` keyword)
 - #62472 (Normalize use of backticks in compiler messages p2)
 - #62477 (Re-add bootstrap attribute to libunwind for llvm-libunwind feature)
 - #62478 (normalize use of backticks for compiler messages in librustc_codegen)

Failed merges:

r? @ghost

5 years agoRollup merge of #62478 - fakenine:normalize_use_of_backticks_compiler_messages_p3...
Mazdak Farrokhzad [Mon, 8 Jul 2019 00:40:58 +0000 (02:40 +0200)]
Rollup merge of #62478 - fakenine:normalize_use_of_backticks_compiler_messages_p3, r=Centril

normalize use of backticks for compiler messages in librustc_codegen

https://github.com/rust-lang/rust/issues/60532

5 years agoRollup merge of #62477 - petrhosek:unwind-bootstrap, r=cramertj
Mazdak Farrokhzad [Mon, 8 Jul 2019 00:40:57 +0000 (02:40 +0200)]
Rollup merge of #62477 - petrhosek:unwind-bootstrap, r=cramertj

Re-add bootstrap attribute to libunwind for llvm-libunwind feature

This was removed in 8a7dded, but since #62286 hasn't yet made it into
beta, this is breaking the build with llvm-libunwind feature enabled.

Furthemore, restrict the link attribute to Fuchsia and Linux, matching
the logic in build.rs since llvm-libunwind feature isn't yet supported
on other systems.

5 years agoRollup merge of #62472 - fakenine:normalize_use_of_backticks_compiler_messages_p2...
Mazdak Farrokhzad [Mon, 8 Jul 2019 00:40:56 +0000 (02:40 +0200)]
Rollup merge of #62472 - fakenine:normalize_use_of_backticks_compiler_messages_p2, r=Centril

Normalize use of backticks in compiler messages p2

normalize use of backticks in compiler messages for librustc_typecheck

https://github.com/rust-lang/rust/issues/60532

5 years agoRollup merge of #62462 - JohnTitor:document-while, r=Centril
Mazdak Farrokhzad [Mon, 8 Jul 2019 00:40:54 +0000 (02:40 +0200)]
Rollup merge of #62462 - JohnTitor:document-while, r=Centril

Document `while` keyword

This is a rework of #60761.
Closes #60736

r? @dtolnay

5 years agoRollup merge of #62356 - soc:topic/contains, r=Centril
Mazdak Farrokhzad [Mon, 8 Jul 2019 00:40:53 +0000 (02:40 +0200)]
Rollup merge of #62356 - soc:topic/contains, r=Centril

Implement Option::contains and Result::contains

This increases consistency with other common data structures.

5 years agoadd key and value methods to DebugMap
Ashley Mannix [Wed, 1 May 2019 07:19:41 +0000 (17:19 +1000)]
add key and value methods to DebugMap

5 years agonormalize use of backticks for compiler messages in librustc_codegen
Samy Kacimi [Sun, 7 Jul 2019 21:14:41 +0000 (23:14 +0200)]
normalize use of backticks for compiler messages in librustc_codegen

https://github.com/rust-lang/rust/issues/60532

5 years agoRe-add bootstrap attribute to libunwind for llvm-libunwind feature
Petr Hosek [Sun, 7 Jul 2019 22:45:04 +0000 (15:45 -0700)]
Re-add bootstrap attribute to libunwind for llvm-libunwind feature

This was removed in 8a7dded, but since #62286 hasn't yet made it into
beta, this is breaking the build with llvm-libunwind feature enabled.

Furthemore, restrict the link attribute to Fuchsia and Linux, matching
the logic in build.rs since llvm-libunwind feature isn't yet supported
on other systems.

5 years agoAuto merge of #62026 - mati865:deps, r=alexcrichton
bors [Sun, 7 Jul 2019 22:03:54 +0000 (22:03 +0000)]
Auto merge of #62026 - mati865:deps, r=alexcrichton

Final nail in `rand 0.4` coffin

Closes https://github.com/rust-lang/rust/issues/57724

5 years agoClarify double-drop comment
Aaron Loucks [Sun, 7 Jul 2019 20:36:19 +0000 (16:36 -0400)]
Clarify double-drop comment

5 years agoUpdate phf to get rid of rand 0.4
Mateusz Mikuła [Fri, 21 Jun 2019 11:14:56 +0000 (13:14 +0200)]
Update phf to get rid of rand 0.4

5 years agoOnly call the closure parameter of Iterator::is_sorted_by_key once per item
Tim Vermeulen [Sun, 7 Jul 2019 18:46:38 +0000 (20:46 +0200)]
Only call the closure parameter of Iterator::is_sorted_by_key once per item

5 years agoAuto merge of #62435 - scottmcm:constrained-array-impls, r=centril
bors [Sun, 7 Jul 2019 18:37:08 +0000 (18:37 +0000)]
Auto merge of #62435 - scottmcm:constrained-array-impls, r=centril

Use const generics for array impls [part 1]

Part 1 of #61415, following the plan in https://github.com/rust-lang/rust/issues/61415#issuecomment-497922482

Found a way that works 🙃

5 years agoUse const generics for array impls, restricted to 0..=32
Scott McMurray [Sat, 6 Jul 2019 06:59:59 +0000 (23:59 -0700)]
Use const generics for array impls, restricted to 0..=32

- uses a never-stable core::array::LengthAtMost32 to bound the impls
- includes a custom error message to avoid mentioning LengthAtMost32 too often
- doesn't use macros for the slice implementations to avoid #62433

5 years agoRemove while loop in DrainFilter::drop and add additional docs
Aaron Loucks [Sun, 7 Jul 2019 17:26:06 +0000 (13:26 -0400)]
Remove while loop in DrainFilter::drop and add additional docs

5 years agonormalize use of backticks in compiler messages for librustc_typecheck
Samy Kacimi [Sun, 7 Jul 2019 09:37:34 +0000 (11:37 +0200)]
normalize use of backticks in compiler messages for librustc_typecheck

https://github.com/rust-lang/rust/issues/60532

5 years agoAuto merge of #62467 - Centril:rollup-083tn7t, r=Centril
bors [Sun, 7 Jul 2019 15:00:47 +0000 (15:00 +0000)]
Auto merge of #62467 - Centril:rollup-083tn7t, r=Centril

Rollup of 4 pull requests

Successful merges:

 - #61883 (`non_ascii_idents` lint (part of RFC 2457))
 - #62042 (Support stability and deprecation checking for all macros)
 - #62213 (rustdoc: set cfg(doctest) when collecting doctests)
 - #62286 (Check if the archive has already been added to avoid duplicates)

Failed merges:

r? @ghost

5 years agoRollup merge of #62286 - petrhosek:rustc-no-duplicate-archives, r=cramertj
Mazdak Farrokhzad [Sun, 7 Jul 2019 15:00:20 +0000 (17:00 +0200)]
Rollup merge of #62286 - petrhosek:rustc-no-duplicate-archives, r=cramertj

Check if the archive has already been added to avoid duplicates

This avoids adding archives multiple times, which results in duplicate
objects in the resulting rlib, leading to symbol collision and link
failures. This could happen when crate contains multiple link attributes
that all reference the same archive.

5 years agoRollup merge of #62213 - QuietMisdreavus:cfg-doctest, r=GuillaumeGomez
Mazdak Farrokhzad [Sun, 7 Jul 2019 15:00:18 +0000 (17:00 +0200)]
Rollup merge of #62213 - QuietMisdreavus:cfg-doctest, r=GuillaumeGomez

rustdoc: set cfg(doctest) when collecting doctests

Note: This PR builds on top of https://github.com/rust-lang/rust/pull/61199; only the last commit is specific to this PR.

As discussed in https://github.com/rust-lang/rust/pull/61199, we want the ability to isolate items to only when rustdoc is collecting doctests, but we can't use `cfg(test)` because of libcore's `#![cfg(not(test))]`. This PR proposes a new cfg flag, `cfg(doctest)`, specific to this situation, rather than reusing an existing flag. I've isolated it behind a feature gate so that we can contain the effects to nightly only. (A stable workaround that can be used in lieu of `#[cfg(doctest)]` is `#[cfg(rustdoc)] #[doc(hidden)]`, at least once https://github.com/rust-lang/rust/pull/61351 lands.)

Tracking issue: https://github.com/rust-lang/rust/issues/62210

5 years agoRollup merge of #62042 - petrochenkov:macstab, r=matthewjasper
Mazdak Farrokhzad [Sun, 7 Jul 2019 15:00:17 +0000 (17:00 +0200)]
Rollup merge of #62042 - petrochenkov:macstab, r=matthewjasper

Support stability and deprecation checking for all macros

RELNOTES: Deprecation attributes on macros now have effect.

Fixes https://github.com/rust-lang/rust/issues/34079
Fixes https://github.com/rust-lang/rust/issues/49912
Unblocks https://github.com/rust-lang/rust/pull/62086
Unblocks https://github.com/rust-lang/rust/pull/61000

5 years agoRollup merge of #61883 - zackmdavis:non_ascii_idents_lint, r=Manishearth
Mazdak Farrokhzad [Sun, 7 Jul 2019 15:00:15 +0000 (17:00 +0200)]
Rollup merge of #61883 - zackmdavis:non_ascii_idents_lint, r=Manishearth

`non_ascii_idents` lint (part of RFC 2457)

RFC 2457 [declares](https://github.com/rust-lang/rfcs/blob/121bbeff500c3274cea22c7e0ca176274d592646/text/2457-non-ascii-idents.md): "A `non_ascii_idents` lint is added to the compiler. This lint is allow by default."

(Part of #55467.)

r? @Manishearth

5 years agoImplement Option::contains, Result::contains and Result::contains_err
Simon Ochsenreither [Wed, 3 Jul 2019 23:38:22 +0000 (01:38 +0200)]
Implement Option::contains, Result::contains and Result::contains_err

This increases consistency with other common data structures.

5 years agoDocument `while` keyword
Yuki Okushi [Sun, 7 Jul 2019 12:06:47 +0000 (21:06 +0900)]
Document `while` keyword

5 years agoUpdate LLVM: apply patch necessary for ThinLTO on RISC-V
Vadim Kaushan [Sun, 7 Jul 2019 12:32:09 +0000 (15:32 +0300)]
Update LLVM: apply patch necessary for ThinLTO on RISC-V

5 years agoAuto merge of #59800 - Zoxc:less-dylibs, r=alexcrichton
bors [Sun, 7 Jul 2019 11:32:58 +0000 (11:32 +0000)]
Auto merge of #59800 - Zoxc:less-dylibs, r=alexcrichton

rustc: Remove `dylib` crate type from most rustc crates

Revival of https://github.com/rust-lang/rust/pull/56987

cc @alexcrichton
r? @michaelwoerister

5 years agoAddress review comments + Fix rebase
Vadim Petrochenkov [Fri, 5 Jul 2019 22:58:52 +0000 (01:58 +0300)]
Address review comments + Fix rebase

5 years agosyntax: Pre-intern names of all built-in macros
Vadim Petrochenkov [Sun, 23 Jun 2019 11:59:42 +0000 (14:59 +0300)]
syntax: Pre-intern names of all built-in macros

They always end up interned anyway

5 years agosyntax: Migrate built-in macros to the regular stability checking
Vadim Petrochenkov [Sat, 22 Jun 2019 13:18:05 +0000 (16:18 +0300)]
syntax: Migrate built-in macros to the regular stability checking

5 years agoSupport deprecation checking for macros
Vadim Petrochenkov [Fri, 21 Jun 2019 23:44:45 +0000 (02:44 +0300)]
Support deprecation checking for macros

5 years agoresolve: Use standard stability diagnostics for macros
Vadim Petrochenkov [Fri, 21 Jun 2019 21:18:09 +0000 (00:18 +0300)]
resolve: Use standard stability diagnostics for macros

5 years agosyntax: Keep full `Stability` in `SyntaxExtension`
Vadim Petrochenkov [Fri, 21 Jun 2019 08:50:30 +0000 (11:50 +0300)]
syntax: Keep full `Stability` in `SyntaxExtension`

5 years agoresolve: Check stability for local macros as well
Vadim Petrochenkov [Thu, 20 Jun 2019 22:59:30 +0000 (01:59 +0300)]
resolve: Check stability for local macros as well

5 years agoCollect library features from non-exported macros
Vadim Petrochenkov [Thu, 20 Jun 2019 22:55:40 +0000 (01:55 +0300)]
Collect library features from non-exported macros

5 years agoresolve/expand: Move macro stability checking to an earlier point
Vadim Petrochenkov [Thu, 20 Jun 2019 19:00:47 +0000 (22:00 +0300)]
resolve/expand: Move macro stability checking to an earlier point

5 years agosyntax: Remove `NodeId` from `SyntaxExtension`
Vadim Petrochenkov [Thu, 20 Jun 2019 08:52:31 +0000 (11:52 +0300)]
syntax: Remove `NodeId` from `SyntaxExtension`

5 years agoAuto merge of #62434 - Manishearth:clippyup, r=Manishearth
bors [Sun, 7 Jul 2019 08:07:54 +0000 (08:07 +0000)]
Auto merge of #62434 - Manishearth:clippyup, r=Manishearth

Update clippy

r? @ghost

5 years agoformat a bit
Ralf Jung [Mon, 24 Jun 2019 21:15:37 +0000 (23:15 +0200)]
format a bit

5 years agoHandle null from LLVMRustGetSectionName
Valentin Tolmer [Wed, 27 Mar 2019 14:57:14 +0000 (15:57 +0100)]
Handle null from LLVMRustGetSectionName

5 years agoAuto merge of #62458 - Centril:rollup-j6o2sqj, r=Centril
bors [Sun, 7 Jul 2019 04:42:58 +0000 (04:42 +0000)]
Auto merge of #62458 - Centril:rollup-j6o2sqj, r=Centril

Rollup of 4 pull requests

Successful merges:

 - #61990 (First question mark in doctest)
 - #62379 (Add missing links in Option documentation)
 - #62438 (rustbuild: Cleanup global lint settings)
 - #62455 (name the trait in ambiguous-associated-items fully qualified suggestion)

Failed merges:

r? @ghost

5 years agoUpdate clippy
Manish Goregaokar [Sat, 6 Jul 2019 07:06:36 +0000 (00:06 -0700)]
Update clippy

5 years agoRollup merge of #62455 - zackmdavis:name_trait_for_ambiguous_assoc_item, r=petrochenkov
Mazdak Farrokhzad [Sun, 7 Jul 2019 03:11:56 +0000 (05:11 +0200)]
Rollup merge of #62455 - zackmdavis:name_trait_for_ambiguous_assoc_item, r=petrochenkov

name the trait in ambiguous-associated-items fully qualified suggestion

We have the trait at this point, so we can name it in the error message, rather than using "Trait" as a (potentially confusing) placeholder.

Thanks to Yuki "@JohnTitor" Okushi for pointing out where to look (in the same file) for a closely related issue for ambiguous associated types (as opposed to items; that was #59225, except that one won't be
quite as easy to resolve, because we actually don't have the trait `DefId` at that point).

r? @petrochenkov

5 years agoRollup merge of #62438 - petrochenkov:buildwarn, r=Mark-Simulacrum
Mazdak Farrokhzad [Sun, 7 Jul 2019 03:11:55 +0000 (05:11 +0200)]
Rollup merge of #62438 - petrochenkov:buildwarn, r=Mark-Simulacrum

rustbuild: Cleanup global lint settings

Lint settings do not depend on `if let Some(target) = target` in any way, so they are moved out of that clause.

Internal lints now respect `RUSTC_DENY_WARNINGS`.

Crate name treatment is cleaned up a bit.

cc https://github.com/rust-lang/rust/pull/61545 @flip1995
r? @Mark-Simulacrum

5 years agoRollup merge of #62379 - GuillaumeGomez:option-doc-links, r=QuietMisdreavus
Mazdak Farrokhzad [Sun, 7 Jul 2019 03:11:53 +0000 (05:11 +0200)]
Rollup merge of #62379 - GuillaumeGomez:option-doc-links, r=QuietMisdreavus

Add missing links in Option documentation

r? @rust-lang/docs

5 years agoRollup merge of #61990 - llogiq:questionmark-test, r=QuietMisdreavus
Mazdak Farrokhzad [Sun, 7 Jul 2019 03:11:51 +0000 (05:11 +0200)]
Rollup merge of #61990 - llogiq:questionmark-test, r=QuietMisdreavus

First question mark in doctest

We have had `?` for `Result`s in doctests for some time, but so far haven't used them in doctests. With this PR, I want to start the de-`unwrap`ping of doctests – and the discussion on where to do so.

There is one downside, which is that the code can no longer be copied into a plain `main()` method, on the other hand, there should be a workable error if one does this.

5 years agoforce single-threaded text execution
QuietMisdreavus [Tue, 2 Jul 2019 18:30:54 +0000 (13:30 -0500)]
force single-threaded text execution

5 years agorustdoc: set cfg(doctest) when collecting doctests
QuietMisdreavus [Fri, 28 Jun 2019 15:31:27 +0000 (10:31 -0500)]
rustdoc: set cfg(doctest) when collecting doctests

5 years agoLink compiler plugins to rustc_driver
John Kåre Alsaker [Sat, 6 Jul 2019 17:56:20 +0000 (19:56 +0200)]
Link compiler plugins to rustc_driver

5 years agoUpdate Cargo.lock
John Kåre Alsaker [Fri, 5 Jul 2019 10:23:51 +0000 (12:23 +0200)]
Update Cargo.lock

5 years agoRemove some dummy dependencies
John Kåre Alsaker [Tue, 9 Apr 2019 08:03:02 +0000 (10:03 +0200)]
Remove some dummy dependencies

5 years agorustc: Remove `dylib` crate type from most rustc crates
Alex Crichton [Wed, 19 Dec 2018 17:11:31 +0000 (18:11 +0100)]
rustc: Remove `dylib` crate type from most rustc crates

Now that procedural macros no longer link transitively to libsyntax,
this shouldn't be needed any more! This commit is an experiment in
removing all dynamic libraries from rustc except for librustc_driver
itself. Let's see how far we can get with that!

5 years agoAuto merge of #62281 - Disasm:riscv-pic, r=nagisa
bors [Sun, 7 Jul 2019 01:14:42 +0000 (01:14 +0000)]
Auto merge of #62281 - Disasm:riscv-pic, r=nagisa

Add support for pc-relative addressing on 64-bit RISC-V

These changes allow Rust to generate position-independent code on `riscv64` targets with code model `medium`.

Closes: https://github.com/rust-lang/rust/issues/59802
See also: https://github.com/rust-embedded/riscv-rt/issues/25, https://github.com/rust-embedded/wg/issues/218

5 years agoin which the `non_ascii_idents` lint appears (RFC 2457)
Zack M. Davis [Sun, 16 Jun 2019 03:22:07 +0000 (20:22 -0700)]
in which the `non_ascii_idents` lint appears (RFC 2457)

RFC 2457 declares: "A `non_ascii_idents` lint is added to the
compiler. This lint is allow by default."

5 years agoname the trait in ambiguous-associated-items fully qualified suggestion
Zack M. Davis [Sat, 6 Jul 2019 23:47:43 +0000 (16:47 -0700)]
name the trait in ambiguous-associated-items fully qualified suggestion

We have the trait at this point, so we can name it in the error
message, rather than using "Trait" as a (potentially confusing)
placeholder.

Thanks to Yuki "@JohnTitor" Okushi for pointing out where to look (in
the same file) for a closely related issue for ambiguous associated
types (as opposed to items; that was #59225, except that one won't be
quite as easy to resolve, because we actually don't have the trait
`DefId` at that point).

5 years agoAddress review comments
Vadim Petrochenkov [Sat, 6 Jul 2019 22:18:29 +0000 (01:18 +0300)]
Address review comments

5 years agoAuto merge of #62452 - Centril:rollup-5jww3h7, r=Centril
bors [Sat, 6 Jul 2019 21:47:45 +0000 (21:47 +0000)]
Auto merge of #62452 - Centril:rollup-5jww3h7, r=Centril

Rollup of 5 pull requests

Successful merges:

 - #60081 (Refactor unicode.py script)
 - #61862 (Make the Weak::{into,as}_raw methods)
 - #62243 (Improve documentation for built-in macros)
 - #62422 (Remove some uses of mem::uninitialized)
 - #62436 (normalize use of backticks/lowercase in compiler messages for librustc_mir)

Failed merges:

r? @ghost

5 years agoExit arm scopes correctly in the HIR CFG
Matthew Jasper [Sat, 29 Jun 2019 14:38:20 +0000 (15:38 +0100)]
Exit arm scopes correctly in the HIR CFG

When a match evaluates to false we jump to the next arm, when we do so
we need to make sure that we exit the scope for that arm.

5 years agoAdd arm ids for -Zunpretty=hir,identified
Matthew Jasper [Sat, 29 Jun 2019 14:31:43 +0000 (15:31 +0100)]
Add arm ids for -Zunpretty=hir,identified

5 years agoRollup merge of #62436 - fakenine:normalize_use_of_backticks_compiler_messages_1...
Mazdak Farrokhzad [Sat, 6 Jul 2019 20:14:39 +0000 (22:14 +0200)]
Rollup merge of #62436 - fakenine:normalize_use_of_backticks_compiler_messages_1, r=Centril

normalize use of backticks/lowercase in compiler messages for librustc_mir

normalize use of backticks/lowercase in compiler messages for librustc_mir

https://github.com/rust-lang/rust/issues/60532

r? @alexreg

5 years agoRollup merge of #62422 - lzutao:remove-some-mem-uinit, r=alexcrichton
Mazdak Farrokhzad [Sat, 6 Jul 2019 20:14:38 +0000 (22:14 +0200)]
Rollup merge of #62422 - lzutao:remove-some-mem-uinit, r=alexcrichton

Remove some uses of mem::uninitialized

cc #62397
r? @RalfJung

5 years agoRollup merge of #62243 - petrochenkov:macrodoc, r=eddyb
Mazdak Farrokhzad [Sat, 6 Jul 2019 20:14:36 +0000 (22:14 +0200)]
Rollup merge of #62243 - petrochenkov:macrodoc, r=eddyb

Improve documentation for built-in macros

This is the `libcore` part of https://github.com/rust-lang/rust/pull/62086.
Right now the only effect is improved documentation.

The changes in the last few commits are required to make the `libcore` change compile successfully.

5 years agoRollup merge of #61862 - vorner:weak-into-raw-methods, r=sfackler
Mazdak Farrokhzad [Sat, 6 Jul 2019 20:14:35 +0000 (22:14 +0200)]
Rollup merge of #61862 - vorner:weak-into-raw-methods, r=sfackler

Make the Weak::{into,as}_raw methods

Because Weak doesn't Deref, so there's no reason for them to be only
associated methods.

As kindly pointed out here https://github.com/rust-lang/rust/pull/60766#issuecomment-501706422 by @chpio.

5 years agoRollup merge of #60081 - pawroman:cleanup_unicode_script, r=varkor
Mazdak Farrokhzad [Sat, 6 Jul 2019 20:14:33 +0000 (22:14 +0200)]
Rollup merge of #60081 - pawroman:cleanup_unicode_script, r=varkor

Refactor unicode.py script

Hi, I noticed that the `unicode.py` script used some deprecated escapes in regular expressions. E.g. `\d`, `\w`, `\.` will be illegal in the future without "raw strings". This is now fixed. I have also cleaned up the script quite a bit.

## Escape deprecation

OK (note the `r`):
`re.compile(r"\d")`

Deprecated (from Python 3.6 onwards, see [here][link1] and [here][link2]):
`re.compile("\d")`.

[link1]: https://docs.python.org/3.6/whatsnew/3.6.html#deprecated-python-behavior
[link2]: https://bugs.python.org/issue27364

This was evident running the script using Python 3.7 like so:

```
$ python3 -Wall unicode.py
unicode.py:227: DeprecationWarning: invalid escape sequence \w
  re1 = re.compile("^ *([0-9A-F]+) *; *(\w+)")
unicode.py:228: DeprecationWarning: invalid escape sequence \.
  re2 = re.compile("^ *([0-9A-F]+)\.\.([0-9A-F]+) *; *(\w+)")
unicode.py:453: DeprecationWarning: invalid escape sequence \d
  pattern = "for Version (\d+)\.(\d+)\.(\d+) of the Unicode"
```

The documentation states that
> A backslash-character pair that is not a valid escape sequence now generates a DeprecationWarning. Although this will eventually become a SyntaxError, that will not be for several Python releases.

## Testing

To test my changes, I had to add support for choosing the Unicode version to use. The script will default to latest release (which is 12.0.0 at the moment, repo has 11.0.0 checked in).

The script generates the exact same output for version 11.0.0 with Python 2.7 and 3.7 and no longer generates any deprecation warnings:

```
$ python3 -Wall unicode.py -v 11.0.0
Using Unicode version: 11.0.0
Regenerated tables.rs.
$ git diff tables.rs
$ python2 -Wall unicode.py -v 11.0.0
Using Unicode version: 11.0.0
Regenerated tables.rs.
$ git diff tables.rs
$ python2 --version
Python 2.7.16
$ python3 --version
Python 3.7.3
```

## Extra functionality

Furthermore, the script will check and download the latest Unicode version by default (without the `-v` argument). The `--help` is below:

```
$ ./unicode.py --help
usage: unicode.py [-h] [-v VERSION]

Regenerate Unicode tables (tables.rs).

optional arguments:
  -h, --help            show this help message and exit
  -v VERSION, --version VERSION
                        Unicode version to use (if not specified, defaults to
                        latest available final release).
```

## Cleanups

I have cleaned up the code quite a bit, with Python best practices and code style in mind. I'm happy to provide more details and rationale for all my changes if the reviewers so desire.

One externally visible change is that the Unicode data will now be downloaded into `src/libcore/unicode/downloaded` directory suffixed by Unicode version:

```
$ pwd
.../rust/src/libcore/unicode
$ exa -T downloaded/
downloaded
├── 11.0.0
│  ├── DerivedCoreProperties.txt
│  ├── DerivedNormalizationProps.txt
│  ├── PropList.txt
│  ├── ReadMe.txt
│  ├── Scripts.txt
│  ├── SpecialCasing.txt
│  └── UnicodeData.txt
└── 12.0.0
   ├── DerivedCoreProperties.txt
   ├── DerivedNormalizationProps.txt
   ├── PropList.txt
   ├── ReadMe.txt
   ├── Scripts.txt
   ├── SpecialCasing.txt
   └── UnicodeData.txt
```

5 years agonormalize use of backticks/lowercase in compiler messages for librustc_mir
Samy Kacimi [Sat, 6 Jul 2019 07:48:03 +0000 (09:48 +0200)]
normalize use of backticks/lowercase in compiler messages for librustc_mir

https://github.com/rust-lang/rust/issues/60532

r? @alexreg

5 years agoAuto merge of #59772 - andrehjr:add-rustc-guide-to-toolstate, r=mark-i-m
bors [Sat, 6 Jul 2019 18:19:01 +0000 (18:19 +0000)]
Auto merge of #59772 - andrehjr:add-rustc-guide-to-toolstate, r=mark-i-m

Add rustc guide to toolstate

Closes #59597

5 years agoresolve: Reserve cfg/cfg_attr/derive only in attribute sub-namespace
Vadim Petrochenkov [Sat, 29 Jun 2019 22:24:34 +0000 (01:24 +0300)]
resolve: Reserve cfg/cfg_attr/derive only in attribute sub-namespace

5 years agoDon't return an error from linkcheck when it's not supported'
André Luis Leal Cardoso Junior [Fri, 5 Jul 2019 17:36:24 +0000 (14:36 -0300)]
Don't return an error from linkcheck when it's not supported'

5 years agoIgnore unused variable for non-linux builds
André Luis Leal Cardoso Junior [Fri, 5 Jul 2019 14:57:33 +0000 (11:57 -0300)]
Ignore unused variable for non-linux builds

5 years agofix macos build
Mark Mansi [Fri, 5 Jul 2019 01:20:14 +0000 (20:20 -0500)]
fix macos build

5 years agocfg: linkcheck only on x86-64 linux
Mark Mansi [Tue, 25 Jun 2019 00:07:32 +0000 (19:07 -0500)]
cfg: linkcheck only on x86-64 linux

5 years agoadd missing libssl-dev dependency to docker images on travis
André Luis Leal Cardoso Junior [Sat, 18 May 2019 20:33:52 +0000 (17:33 -0300)]
add missing libssl-dev dependency to docker images on travis

5 years agoAdd 'Apache-2.0 OR MIT' license variation to tidy/tools check
André Luis Leal Cardoso Junior [Sat, 4 May 2019 19:20:24 +0000 (16:20 -0300)]
Add 'Apache-2.0 OR MIT' license variation to tidy/tools check

5 years agoMove installing of deps to the docker container, instead of installing on the host...
André Luis Leal Cardoso Junior [Mon, 8 Apr 2019 23:59:06 +0000 (20:59 -0300)]
Move installing of deps to the docker container, instead of installing on the host machine on travis

5 years agoAdd linkcheck command to rustbook tool
André Luis Leal Cardoso Junior [Sun, 7 Apr 2019 12:59:33 +0000 (09:59 -0300)]
Add linkcheck command to rustbook tool

5 years agoTrack rustc-guide on toolstate
André Luis Leal Cardoso Junior [Thu, 4 Apr 2019 16:06:05 +0000 (13:06 -0300)]
Track rustc-guide on toolstate

5 years agoadd ./x.py test src/doc/rustc-guide
André Luis Leal Cardoso Junior [Thu, 4 Apr 2019 16:05:22 +0000 (13:05 -0300)]
add ./x.py test src/doc/rustc-guide

5 years agoprivacy: Only opaque macros leak private things
Vadim Petrochenkov [Sat, 29 Jun 2019 22:12:04 +0000 (01:12 +0300)]
privacy: Only opaque macros leak private things

5 years agoFix tidy issues
Vadim Petrochenkov [Sat, 29 Jun 2019 22:09:59 +0000 (01:09 +0300)]
Fix tidy issues

5 years agoImprove documentation for built-in macros
Vadim Petrochenkov [Sat, 29 Jun 2019 14:51:20 +0000 (17:51 +0300)]
Improve documentation for built-in macros

5 years ago`#[rustc_transparent_macro]` -> `#[rustc_macro_transparency = ...]`
Vadim Petrochenkov [Sun, 23 Jun 2019 13:37:28 +0000 (16:37 +0300)]
`#[rustc_transparent_macro]` -> `#[rustc_macro_transparency = ...]`

5 years ago`#[rustc_doc_only_macro]` -> `#[rustc_builtin_macro]`
Vadim Petrochenkov [Sat, 29 Jun 2019 14:30:51 +0000 (17:30 +0300)]
`#[rustc_doc_only_macro]` -> `#[rustc_builtin_macro]`

5 years agorustbuild: Cleanup global lint settings
Vadim Petrochenkov [Sat, 6 Jul 2019 00:15:04 +0000 (03:15 +0300)]
rustbuild: Cleanup global lint settings

5 years agoAuto merge of #61988 - Centril:there-is-only-loop, r=matthewjasper
bors [Sat, 6 Jul 2019 06:15:44 +0000 (06:15 +0000)]
Auto merge of #61988 - Centril:there-is-only-loop, r=matthewjasper

[let_chains, 3/6] And then there was only Loop

Here we remove `hir::ExprKind::While`.
Instead, we desugar: `'label: while $cond $body` into:

```rust
'label: loop {
    match DropTemps($cond) {
        true => $body,
        _ => break,
    }
}
```

Per https://github.com/rust-lang/rust/issues/53667#issuecomment-471583239.
This is a follow up to https://github.com/rust-lang/rust/pull/59288 which did the same for `if` expressions.

r? @matthewjasper