Commit Graph

96349 Commits

Author SHA1 Message Date
Aaron Loucks
df5b32ee9b Clarify double-drop comment 2019-07-07 16:36:19 -04:00
David Wood
4b1bc2ded9
tests: Add tests that use const fns. 2019-07-07 20:23:31 +01:00
David Wood
a655438988
tests: Update and add tests for RFC 2203. 2019-07-07 20:23:28 +01:00
Mateusz Mikuła
2ac20e2be6 Update phf to get rid of rand 0.4 2019-07-07 21:08:49 +02:00
David Wood
813c994a75
rustc_mir: Re-use report_selection_error.
This commit replaces the new error that was being emitted in NLL type
check with a call to `report_selection_error` so that the same trait
error as before this PR is emitted.
2019-07-07 19:51:31 +01:00
David Wood
3cca4ceed8
syntax: Add feature gate.
This commit adds a `const_in_array_repeat_expressions` feature gate and
only create `Candidate::Repeat` if it is enabled.
2019-07-07 19:51:29 +01:00
David Wood
485a80255b
rustc/rustc_mir: Implement RFC 2203.
This commit implements RFC 2203, allowing constants in array repeat
expressions.

Firstly, the check that the array repeat expression implements `Copy` is
removed and re-implemented in `rustc_mir::borrow_check::nll::type_check`
by emitting an error when the MIR contains a `Operand::Move` and the
type does not implement `Copy`.

Next, the `qualify_consts` pass is modified to construct a
`Candidate::Repeat` when it would be correct to promote a array repeat
expression.

Finally, the `promote_consts` pass is modified to promote the candidates
previously identified.
2019-07-07 19:51:09 +01:00
Tim Vermeulen
98b54fbd7a Only call the closure parameter of Iterator::is_sorted_by_key once per item 2019-07-07 20:46:38 +02:00
bors
6e310f2aba 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 🙃
2019-07-07 18:37:08 +00:00
Scott McMurray
d6a9793722 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
2019-07-07 11:31:38 -07:00
Aaron Loucks
a4a6a67a01 Remove while loop in DrainFilter::drop and add additional docs 2019-07-07 13:44:21 -04:00
Tshepang Lekhonkhobe
8353007e56 cli: make help output for -l and -L consistent 2019-07-07 18:32:39 +02:00
Samy Kacimi
60a49384f5
normalize use of backticks in compiler messages for librustc_typecheck
https://github.com/rust-lang/rust/issues/60532
2019-07-07 18:27:21 +02:00
Dmitry Murzin
11a4d6ed9c
Prevent shrinking of "crate select" element on Firefox 2019-07-07 18:46:24 +03:00
bors
9210359b18 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
2019-07-07 15:00:47 +00:00
Mazdak Farrokhzad
a2500db858
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.
2019-07-07 17:00:20 +02:00
Mazdak Farrokhzad
fe807fcf3e
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
2019-07-07 17:00:18 +02:00
Mazdak Farrokhzad
3250b8ee59
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
2019-07-07 17:00:17 +02:00
Mazdak Farrokhzad
9cd75fb35f
Rollup merge of #61883 - zackmdavis:non_ascii_idents_lint, r=Manishearth
`non_ascii_idents` lint (part of RFC 2457)

RFC 2457 [declares](121bbeff50/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
2019-07-07 17:00:15 +02:00
Simon Ochsenreither
6f76da494b Implement Option::contains, Result::contains and Result::contains_err
This increases consistency with other common data structures.
2019-07-07 16:50:44 +02:00
Matthew Jasper
38306adf16 Add help message for mutation though overloaded place operators 2019-07-07 15:24:19 +01:00
Matthew Jasper
5b86c604f9 Move BorrowedContentSource from move_errors to error_reporting 2019-07-07 15:23:07 +01:00
Matthew Jasper
163c059354 Only omit StorageLive/Dead for variable that are never initialized
With `feature(never_type)`, it's not guaranteed that any variable with
type `!` isn't ever assigned to.
2019-07-07 15:04:43 +01:00
Matthew Jasper
89188815ed Give index temporaries a drop scope 2019-07-07 15:03:07 +01:00
Guillaume Gomez
4f1127a2bf Add missing urls for osstr 2019-07-07 15:38:53 +02:00
Yuki Okushi
559c3ec562 Document while keyword 2019-07-07 22:17:26 +09:00
Vadim Kaushan
f90d6d5144
Update LLVM: apply patch necessary for ThinLTO on RISC-V 2019-07-07 15:32:09 +03:00
bors
dd2e8040a3 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
2019-07-07 11:32:58 +00:00
Vadim Petrochenkov
941653b528 Address review comments + Fix rebase 2019-07-07 13:04:07 +03:00
Vadim Petrochenkov
b6d522a101 syntax: Pre-intern names of all built-in macros
They always end up interned anyway
2019-07-07 13:04:07 +03:00
Vadim Petrochenkov
1ee0ce82cb syntax: Migrate built-in macros to the regular stability checking 2019-07-07 13:04:07 +03:00
Vadim Petrochenkov
0817fc6c6c Support deprecation checking for macros 2019-07-07 13:04:07 +03:00
Vadim Petrochenkov
d9ee97e896 resolve: Use standard stability diagnostics for macros 2019-07-07 13:04:07 +03:00
Vadim Petrochenkov
3542995ff9 syntax: Keep full Stability in SyntaxExtension 2019-07-07 13:04:07 +03:00
Vadim Petrochenkov
73dec4a804 resolve: Check stability for local macros as well 2019-07-07 13:04:07 +03:00
Vadim Petrochenkov
290475e837 Collect library features from non-exported macros 2019-07-07 13:04:07 +03:00
Vadim Petrochenkov
3b6370b4ab resolve/expand: Move macro stability checking to an earlier point 2019-07-07 13:04:07 +03:00
Vadim Petrochenkov
03ac05338c syntax: Remove NodeId from SyntaxExtension 2019-07-07 13:04:06 +03:00
bors
dbeed58ade Auto merge of #62434 - Manishearth:clippyup, r=Manishearth
Update clippy

r? @ghost
2019-07-07 08:07:54 +00:00
Ralf Jung
076a5cdc35 format a bit 2019-07-07 09:32:36 +02:00
Valentin Tolmer
f5b30211c8 Handle null from LLVMRustGetSectionName 2019-07-07 09:31:41 +02:00
bors
927a3e873d 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
2019-07-07 04:42:58 +00:00
Manish Goregaokar
e2885eb656 Update clippy 2019-07-06 21:41:57 -07:00
Mazdak Farrokhzad
fb0117000a
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
2019-07-07 05:11:56 +02:00
Mazdak Farrokhzad
037f568f17
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
2019-07-07 05:11:55 +02:00
Mazdak Farrokhzad
c512829363
Rollup merge of #62379 - GuillaumeGomez:option-doc-links, r=QuietMisdreavus
Add missing links in Option documentation

r? @rust-lang/docs
2019-07-07 05:11:53 +02:00
Mazdak Farrokhzad
719eeb260b
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.
2019-07-07 05:11:51 +02:00
QuietMisdreavus
cff6ce667f force single-threaded text execution 2019-07-06 21:41:11 -05:00
QuietMisdreavus
bed54cf854 rustdoc: set cfg(doctest) when collecting doctests 2019-07-06 21:37:17 -05:00
John Kåre Alsaker
7198687bb2 Link compiler plugins to rustc_driver 2019-07-07 03:23:02 +02:00