]> git.lizzy.rs Git - rust.git/log
rust.git
4 years agoslice_patterns: adjust error codes
Mazdak Farrokhzad [Sun, 29 Dec 2019 23:31:35 +0000 (00:31 +0100)]
slice_patterns: adjust error codes

4 years agostabilize slice_patterns
Mazdak Farrokhzad [Sun, 29 Dec 2019 23:16:16 +0000 (00:16 +0100)]
stabilize slice_patterns

4 years agoAuto merge of #68170 - wesleywiser:stop_const_prop_ref_taking, r=oli-obk
bors [Sat, 18 Jan 2020 11:36:47 +0000 (11:36 +0000)]
Auto merge of #68170 - wesleywiser:stop_const_prop_ref_taking, r=oli-obk

Turn off const propagation of ref taking

Fixes #67529
Fixes #67640
Fixes #67641
Fixes #67862

r? @oli-obk

4 years agoAuto merge of #68037 - msizanoen1:riscv-ci, r=alexcrichton
bors [Sat, 18 Jan 2020 08:18:44 +0000 (08:18 +0000)]
Auto merge of #68037 - msizanoen1:riscv-ci, r=alexcrichton

Distribution CI for riscv64gc-unknown-linux-gnu

This modifies `dist-various-1` to build the standard library for RISC-V GNU/Linux.

r? @alexcrichton

4 years agoAuto merge of #67940 - JohnTitor:rustc-guide, r=JohnTitor
bors [Sat, 18 Jan 2020 04:45:21 +0000 (04:45 +0000)]
Auto merge of #67940 - JohnTitor:rustc-guide, r=JohnTitor

Update rustc-guide

r? @ghost

CC: @rust-lang/wg-learning
4 years agoAuto merge of #68330 - tmandry:rollup-5v29y9r, r=tmandry
bors [Sat, 18 Jan 2020 01:29:28 +0000 (01:29 +0000)]
Auto merge of #68330 - tmandry:rollup-5v29y9r, r=tmandry

Rollup of 9 pull requests

Successful merges:

 - #66660 (Don't warn about snake case for field puns.)
 - #68093 (Fix deref impl typedef)
 - #68204 (Use named fields for `{ast,hir}::ItemKind::Impl`)
 - #68256 (Do not ICE on malformed suggestion spans)
 - #68279 (Clean up E0198 explanation)
 - #68291 (Update sanitizer tests)
 - #68312 (Add regression test for integer literals in generic arguments in where clauses)
 - #68314 (Stop treating `FalseEdges` and `FalseUnwind` as having semantic value for const eval)
 - #68317 (Clean up E0199 explanation)

Failed merges:

r? @ghost

4 years agoRollup merge of #68317 - GuillaumeGomez:clean-up-e0199, r=Dylan-DPC
Tyler Mandry [Sat, 18 Jan 2020 01:28:23 +0000 (17:28 -0800)]
Rollup merge of #68317 - GuillaumeGomez:clean-up-e0199, r=Dylan-DPC

Clean up E0199 explanation

r? @Dylan-DPC

4 years agoRollup merge of #68314 - oli-obk:true_unwind, r=eddyb
Tyler Mandry [Sat, 18 Jan 2020 01:28:22 +0000 (17:28 -0800)]
Rollup merge of #68314 - oli-obk:true_unwind, r=eddyb

Stop treating `FalseEdges` and `FalseUnwind` as having semantic value for const eval

This change does not expose loops or conditions to stable const fns because we check those at the HIR level and in the regular const validity checks.

cc @ecstatic-morse

r? @eddyb

4 years agoRollup merge of #68312 - varkor:issue-67753-regression, r=Centril
Tyler Mandry [Sat, 18 Jan 2020 01:28:20 +0000 (17:28 -0800)]
Rollup merge of #68312 - varkor:issue-67753-regression, r=Centril

Add regression test for integer literals in generic arguments in where clauses

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

4 years agoRollup merge of #68291 - tmiasko:sanitizer-tests, r=nikomatsakis
Tyler Mandry [Sat, 18 Jan 2020 01:28:18 +0000 (17:28 -0800)]
Rollup merge of #68291 - tmiasko:sanitizer-tests, r=nikomatsakis

Update sanitizer tests

* Move tests from src/test/run-make-fulldeps to src/test/ui.
* Fix memory sanitizer test to detect the intended issue rather than
  an unrelated one caused by the use of an uninstrumented std.

4 years agoRollup merge of #68279 - GuillaumeGomez:clean-up-e0198, r=Dylan-DPC
Tyler Mandry [Sat, 18 Jan 2020 01:28:17 +0000 (17:28 -0800)]
Rollup merge of #68279 - GuillaumeGomez:clean-up-e0198, r=Dylan-DPC

Clean up E0198 explanation

r? @Dylan-DPC

4 years agoRollup merge of #68256 - estebank:bad-sugg-span, r=petrochenkov
Tyler Mandry [Sat, 18 Jan 2020 01:28:15 +0000 (17:28 -0800)]
Rollup merge of #68256 - estebank:bad-sugg-span, r=petrochenkov

Do not ICE on malformed suggestion spans

Under the assumption that suggestions are by their very nature always "best effort", it is ok if we don't display them instead of having an ICE. The underlying issue of the malformed span being _created_ is left unaddressed.

Fix #67567.

r? @petrochenkov

4 years agoRollup merge of #68204 - ecstatic-morse:item-kind-impl, r=oli-obk
Tyler Mandry [Sat, 18 Jan 2020 01:28:14 +0000 (17:28 -0800)]
Rollup merge of #68204 - ecstatic-morse:item-kind-impl, r=oli-obk

Use named fields for `{ast,hir}::ItemKind::Impl`

Currently, the widely used `ItemKind::Impl` variant is a tuple with seven fields. I want to add an eighth in #68140, which means I have to update most matches on this variant anyways. Giving a name to each field improves readability and makes future changes of this nature much simpler.

This change will cause several tools to break. I will fix them once this is merged.

4 years agoRollup merge of #68093 - GuillaumeGomez:fix-deref-impl-typedef, r=oli-obk
Tyler Mandry [Sat, 18 Jan 2020 01:28:12 +0000 (17:28 -0800)]
Rollup merge of #68093 - GuillaumeGomez:fix-deref-impl-typedef, r=oli-obk

Fix deref impl typedef

Fixes #35295.

r? @kinnison

4 years agoRollup merge of #66660 - jumbatm:dont_warn_about_snake_case_in_patterns, r=centril
Tyler Mandry [Sat, 18 Jan 2020 01:28:10 +0000 (17:28 -0800)]
Rollup merge of #66660 - jumbatm:dont_warn_about_snake_case_in_patterns, r=centril

Don't warn about snake case for field puns.

Closes #66362.

4 years agoUse named fields for `hir::ItemKind::Impl`
Dylan MacKenzie [Sat, 18 Jan 2020 00:14:29 +0000 (16:14 -0800)]
Use named fields for `hir::ItemKind::Impl`

4 years agoUse named fields for `ast::ItemKind::Impl`
Dylan MacKenzie [Tue, 14 Jan 2020 04:30:20 +0000 (20:30 -0800)]
Use named fields for `ast::ItemKind::Impl`

4 years agoAuto merge of #67476 - mark-i-m:simplify-borrow_check-5, r=matthewjasper
bors [Fri, 17 Jan 2020 21:43:23 +0000 (21:43 +0000)]
Auto merge of #67476 - mark-i-m:simplify-borrow_check-5, r=matthewjasper

Region naming refactoring [6/N]

Followup to #67474

EDIT: this PR is probably best read commit-by-commit...

The major changes in this PR include:
- moving many functions around to modules that better suit them. In particular, a lot of methods were moved from `borrow_check::diagnostics::region_errors` to `borrow_check::region_infer`, and `report_region_errors` was moved from `borrow_check` to `borrow_check::diagnostics::region_errors`.
- `borrow_check::diagnostics::{region_errors, region_name}` are now most comprised of methods on `MirBorrowckCtxt` instead of `RegionInferenceContext`, allowing us to get rid of the annoying `pub(in crate::borrow_check)` on most of the fields of the latter, along with a number of method arguments on many methods.
- I renamed `MirBorrowckCtxt.nonlexical_regioncx` to just `regioncx` because their is no lexical lifetimes any more, and the old name was annoyingly verbose, causing many lines to wrap unnecessarily.
- I got rid of `ErrorRegionNamingContext`. Region naming is implemented as inherent methods on `MirBorrowckCtxt`, so we just move the naming stuff into that struct.

The PR is rather large, but the commits are fairly self-contained (though they don't all compile). There was one minor output change to one test with `compare-mode=nll`, which I think is acceptable.

Between this PR and the last one, a net of 200 lines are removed, most of which was function parameters and context structs :tada:

Some samples:

```diff
-                        self.nonlexical_regioncx.free_region_constraint_info(
-                            &self.body,
-                            &self.local_names,
-                            &self.upvars,
-                            self.mir_def_id,
-                            self.infcx,
-                            borrow_region_vid,
-                            region,
-                        );
+                        self.free_region_constraint_info(borrow_region_vid, region);
```

```diff
-            .or_else(|| {
-                self.give_name_if_anonymous_region_appears_in_yield_ty(
-                    infcx,
-                    body,
-                    *mir_def_id,
-                    fr,
-                    renctx,
-                )
-            });
+            .or_else(|| self.give_name_if_anonymous_region_appears_in_arguments(fr))
```

r? @matthewjasper

cc @eddyb

4 years agoClean up E0199 explanation
Guillaume Gomez [Fri, 17 Jan 2020 18:54:07 +0000 (19:54 +0100)]
Clean up E0199 explanation

4 years agoformatting
Guillaume Gomez [Fri, 17 Jan 2020 18:51:07 +0000 (19:51 +0100)]
formatting

4 years agoClean up E0198 explanation
Guillaume Gomez [Thu, 16 Jan 2020 13:35:37 +0000 (14:35 +0100)]
Clean up E0198 explanation

4 years agoAdd regression test for integer literals in generic arguments in where clauses
varkor [Fri, 17 Jan 2020 14:21:14 +0000 (14:21 +0000)]
Add regression test for integer literals in generic arguments in where clauses

4 years agoStop treating `FalseEdges` and `FalseUnwind` as having semantic value for const eval
Oliver Scherer [Fri, 17 Jan 2020 16:09:05 +0000 (17:09 +0100)]
Stop treating `FalseEdges` and `FalseUnwind` as having semantic value for const eval

4 years agoAuto merge of #68311 - Dylan-DPC:rollup-wzgqw9t, r=Dylan-DPC
bors [Fri, 17 Jan 2020 15:58:24 +0000 (15:58 +0000)]
Auto merge of #68311 - Dylan-DPC:rollup-wzgqw9t, r=Dylan-DPC

Rollup of 4 pull requests

Successful merges:

 - #66564 (Document unsafe blocks in core::{cell, str, sync})
 - #67791 (Implement Lift using interners instead of in_arena)
 - #68278 ([self-profiler] Add example to `-Z help` to turn on query key recording)
 - #68300 (Allow added string.insert benchmarks to compile)

Failed merges:

r? @ghost

4 years agoRollup merge of #68300 - ssomers:67281_take_2, r=Dylan-DPC
Dylan DPC [Fri, 17 Jan 2020 13:23:44 +0000 (18:53 +0530)]
Rollup merge of #68300 - ssomers:67281_take_2, r=Dylan-DPC

Allow added string.insert benchmarks to compile

Allow the code added by #67281 to compile.

(symptons listed [in internals forum](https://internals.rust-lang.org/t/x-py-how-to-benchmark-liballoc/11635))
r? @llogiq

4 years agoRollup merge of #68278 - wesleywiser:doc_query_key_recording, r=michaelwoerister
Dylan DPC [Fri, 17 Jan 2020 13:23:42 +0000 (18:53 +0530)]
Rollup merge of #68278 - wesleywiser:doc_query_key_recording, r=michaelwoerister

[self-profiler] Add example to `-Z help` to turn on query key recording

Also add the `default` option so that it's easy to add query key
recording to the default.

r? @michaelwoerister

4 years agoRollup merge of #67791 - Zoxc:lift-interning, r=eddyb
Dylan DPC [Fri, 17 Jan 2020 13:23:41 +0000 (18:53 +0530)]
Rollup merge of #67791 - Zoxc:lift-interning, r=eddyb

Implement Lift using interners instead of in_arena

r? @eddyb
cc @cjgillot

4 years agoRollup merge of #66564 - foeb:66219-document-unsafe-sync-cell-str, r=Amanieu
Dylan DPC [Fri, 17 Jan 2020 13:23:38 +0000 (18:53 +0530)]
Rollup merge of #66564 - foeb:66219-document-unsafe-sync-cell-str, r=Amanieu

Document unsafe blocks in core::{cell, str, sync}

Split from #66506 (issue #66219). Hopefully doing a chunk at a time is more manageable!

r? @RalfJung

4 years agoAuto merge of #68285 - oli-obk:specialization_regression, r=davidtwco
bors [Fri, 17 Jan 2020 12:25:07 +0000 (12:25 +0000)]
Auto merge of #68285 - oli-obk:specialization_regression, r=davidtwco

Array repeat expression lengths must be monomorphic at MIR building time

fixes #67743

4 years ago[self-profiler] Add example to `-Z help` to turn on query key recording
Wesley Wiser [Thu, 16 Jan 2020 13:24:34 +0000 (08:24 -0500)]
[self-profiler] Add example to `-Z help` to turn on query key recording

Also add the `default` option so that it's easy to add query key
recording to the default.

4 years agoAuto merge of #68305 - Dylan-DPC:rollup-aoohsz8, r=Dylan-DPC
bors [Fri, 17 Jan 2020 09:17:18 +0000 (09:17 +0000)]
Auto merge of #68305 - Dylan-DPC:rollup-aoohsz8, r=Dylan-DPC

Rollup of 6 pull requests

Successful merges:

 - #67956 (Detail transitive containment in E0588 diagnostic)
 - #68153 (resolve: Point at the private item definitions in privacy errors)
 - #68195 (Account for common `impl Trait`/`dyn Trait` return type errors)
 - #68288 (Fix some of the rustfmt fallout in Miri)
 - #68292 (don't clone types that are copy)
 - #68301 (Don't propagate __RUST_TEST_INVOKE to subprocess)

Failed merges:

r? @ghost

4 years agoRollup merge of #68301 - tmandry:dont-propagate-test-invoke, r=alexcrichton
Dylan DPC [Fri, 17 Jan 2020 05:46:42 +0000 (11:16 +0530)]
Rollup merge of #68301 - tmandry:dont-propagate-test-invoke, r=alexcrichton

Don't propagate __RUST_TEST_INVOKE to subprocess

When -Z panic_abort_tests is enabled, we use an environment variable to
tell the subprocess which test to invoke. If that subprocess then
invokes another Rust test binary, chaos ensues.

r? @alexcrichton

4 years agoRollup merge of #68292 - matthiaskrgr:clone_on_copy, r=eddyb
Dylan DPC [Fri, 17 Jan 2020 05:46:40 +0000 (11:16 +0530)]
Rollup merge of #68292 - matthiaskrgr:clone_on_copy, r=eddyb

don't clone types that are copy

Found via clippy.

r? @eddyb

4 years agoRollup merge of #68288 - RalfJung:fmt, r=oli-obk
Dylan DPC [Fri, 17 Jan 2020 05:46:39 +0000 (11:16 +0530)]
Rollup merge of #68288 - RalfJung:fmt, r=oli-obk

Fix some of the rustfmt fallout in Miri

re-post of https://github.com/rust-lang/rust/pull/67833 without the `rustfmt::skip`

r? @oli-obk

4 years agoRollup merge of #68195 - estebank:impl-trait-2000, r=Centril
Dylan DPC [Fri, 17 Jan 2020 05:46:37 +0000 (11:16 +0530)]
Rollup merge of #68195 - estebank:impl-trait-2000, r=Centril

Account for common `impl Trait`/`dyn Trait` return type errors

- When all return paths have the same type, suggest `impl Trait`.
- When all return paths implement the expected `trait`, suggest `Box<dyn Trait>` and mention using an `enum`.
- When multiple different types are returned and `impl Trait` is expected, extend the explanation.
- When return type is `impl Trait` and the return paths do not implement `Trait`, point at the returned values.
- Split `src/librustc/traits/error_reporting.rs` into multiple files to keep size under control.

Fix #68110, cc #66523.

4 years agoRollup merge of #68153 - petrochenkov:privdiag, r=estebank
Dylan DPC [Fri, 17 Jan 2020 05:46:36 +0000 (11:16 +0530)]
Rollup merge of #68153 - petrochenkov:privdiag, r=estebank

resolve: Point at the private item definitions in privacy errors

A basic version of https://github.com/rust-lang/rust/pull/67951.
r? @estebank

4 years agoRollup merge of #67956 - varkor:E0588-provide-context, r=estebank
Dylan DPC [Fri, 17 Jan 2020 05:46:32 +0000 (11:16 +0530)]
Rollup merge of #67956 - varkor:E0588-provide-context, r=estebank

Detail transitive containment in E0588 diagnostic

Fixes https://github.com/rust-lang/rust/issues/67383.

4 years agoAuto merge of #67731 - matthewjasper:drop-in-place-reclimit, r=eddyb
bors [Fri, 17 Jan 2020 04:13:38 +0000 (04:13 +0000)]
Auto merge of #67731 - matthewjasper:drop-in-place-reclimit, r=eddyb

Handle recursive instantiation of drop shims

The compiler used to hang because the recursion limit was never hit.

4 years agoAdd SAFETY comment for atomic example
Phoebe Bell [Fri, 17 Jan 2020 03:26:02 +0000 (19:26 -0800)]
Add SAFETY comment for atomic example

4 years agoreview comments
Esteban Küber [Fri, 17 Jan 2020 02:27:18 +0000 (18:27 -0800)]
review comments

4 years agoFix formatting: ./x.py fmt
Phoebe Bell [Fri, 17 Jan 2020 02:50:53 +0000 (18:50 -0800)]
Fix formatting: ./x.py fmt

4 years agoMove comments for tidy
Phoebe Bell [Fri, 17 Jan 2020 02:38:04 +0000 (18:38 -0800)]
Move comments for tidy

4 years agoElaborate on SAFETY comments
Phoebe Bell [Thu, 26 Dec 2019 20:56:34 +0000 (12:56 -0800)]
Elaborate on SAFETY comments

4 years agoApply suggestions from code review
Phoebe Bell [Thu, 26 Dec 2019 19:57:57 +0000 (11:57 -0800)]
Apply suggestions from code review

Co-Authored-By: Ralf Jung <post@ralfj.de>
4 years agoFix typo "gurantees -> guarantees"
Phoebe Bell [Wed, 20 Nov 2019 02:39:36 +0000 (18:39 -0800)]
Fix typo "gurantees -> guarantees"

4 years agoDocument unsafe blocks in core::{cell, str, sync}
Phoebe Bell [Wed, 20 Nov 2019 02:28:32 +0000 (18:28 -0800)]
Document unsafe blocks in core::{cell, str, sync}

4 years agoDo not ICE on malformed suggestion spans
Esteban Küber [Wed, 15 Jan 2020 17:57:06 +0000 (09:57 -0800)]
Do not ICE on malformed suggestion spans

4 years agoDon't propagate __RUST_TEST_INVOKE to subprocess
Tyler Mandry [Fri, 17 Jan 2020 00:29:32 +0000 (16:29 -0800)]
Don't propagate __RUST_TEST_INVOKE to subprocess

When -Z panic_abort_tests is enabled, we use an environment variable to
tell the subprocess which test to invoke. If that subprocess then
invokes another Rust test binary, chaos ensues.

4 years agoAuto merge of #66716 - derekdreery:debug_non_exhaustive, r=dtolnay
bors [Fri, 17 Jan 2020 00:20:48 +0000 (00:20 +0000)]
Auto merge of #66716 - derekdreery:debug_non_exhaustive, r=dtolnay

Implement `DebugStruct::non_exhaustive`.

This patch adds a function (finish_non_exhaustive) to add ellipsis before the closing brace when formatting using `DebugStruct`.

 ## Example

 ```rust
 #![feature(debug_non_exhaustive)]
 use std::fmt;

 struct Bar {
     bar: i32,
     hidden: f32,
 }

 impl fmt::Debug for Bar {
     fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
         fmt.debug_struct("Bar")
            .field("bar", &self.bar)
            .non_exhaustive(true) // Show that some other field(s) exist.
            .finish()
     }
 }

 assert_eq!(
     format!("{:?}", Bar { bar: 10, hidden: 1.0 }),
     "Bar { bar: 10, .. }",
 );
 ```

4 years agoAllow added string.insert benchmarks to compile
Stein Somers [Fri, 17 Jan 2020 00:05:49 +0000 (01:05 +0100)]
Allow added string.insert benchmarks to compile

4 years agodon't clone types that are copy
Matthias Krüger [Thu, 16 Jan 2020 22:15:52 +0000 (23:15 +0100)]
don't clone types that are copy

found via clippy

4 years agoAuto merge of #68287 - flip1995:clippyup, r=oli-obk
bors [Thu, 16 Jan 2020 20:59:57 +0000 (20:59 +0000)]
Auto merge of #68287 - flip1995:clippyup, r=oli-obk

Update Clippy

cc rust-lang/rust-clippy#5054

No issue were opened for this.

r? @Manishearth

4 years agoImprove code readability
Guillaume Gomez [Thu, 16 Jan 2020 20:36:39 +0000 (21:36 +0100)]
Improve code readability

4 years agoRust ./x.py fmt
Richard Dodd [Thu, 16 Jan 2020 20:11:16 +0000 (20:11 +0000)]
Rust ./x.py fmt

4 years agoDon't warn about snake case for field puns that don't introduce a new name.
jumbatm [Sat, 23 Nov 2019 04:52:40 +0000 (14:52 +1000)]
Don't warn about snake case for field puns that don't introduce a new name.

4 years agoreview comments
Esteban Küber [Thu, 16 Jan 2020 19:32:50 +0000 (11:32 -0800)]
review comments

4 years agoIgnore some tests on platforms without libstd spans
Vadim Petrochenkov [Thu, 16 Jan 2020 19:19:55 +0000 (22:19 +0300)]
Ignore some tests on platforms without libstd spans

4 years agoresolve: Say "import" when reporting private imports
Vadim Petrochenkov [Sun, 12 Jan 2020 13:20:57 +0000 (16:20 +0300)]
resolve: Say "import" when reporting private imports

4 years agoresolve: Point at the private item definitions in privacy errors
Vadim Petrochenkov [Sun, 12 Jan 2020 13:04:03 +0000 (16:04 +0300)]
resolve: Point at the private item definitions in privacy errors

4 years agoresolve: Move privacy error reporting into a separate method
Vadim Petrochenkov [Sun, 12 Jan 2020 10:29:00 +0000 (13:29 +0300)]
resolve: Move privacy error reporting into a separate method

Give named fields to `struct PrivacyError`
Move `fn report_ambiguity_error` to `diagnostics.rs`

4 years agoadjust Deref comment
Ralf Jung [Mon, 6 Jan 2020 10:35:55 +0000 (11:35 +0100)]
adjust Deref comment

4 years agolet rustfmt undo most of my edits :(
Ralf Jung [Fri, 3 Jan 2020 12:33:28 +0000 (13:33 +0100)]
let rustfmt undo most of my edits :(

4 years agoAccount for object safety when suggesting `Box<dyn Trait>`
Esteban Küber [Wed, 15 Jan 2020 23:49:54 +0000 (15:49 -0800)]
Account for object safety when suggesting `Box<dyn Trait>`

4 years agoreview comments
Esteban Küber [Wed, 15 Jan 2020 19:14:05 +0000 (11:14 -0800)]
review comments

4 years agoFix error index test
Esteban Küber [Wed, 15 Jan 2020 17:55:56 +0000 (09:55 -0800)]
Fix error index test

4 years agoreview comments
Esteban Küber [Tue, 14 Jan 2020 22:49:30 +0000 (14:49 -0800)]
review comments

4 years agoreview comments
Esteban Küber [Tue, 14 Jan 2020 21:18:06 +0000 (13:18 -0800)]
review comments

4 years agofix error code index comment
Esteban Küber [Tue, 14 Jan 2020 18:29:13 +0000 (10:29 -0800)]
fix error code index comment

4 years agoSplit `librustc/traits/error_reporting.rs`
Esteban Küber [Tue, 14 Jan 2020 02:27:42 +0000 (18:27 -0800)]
Split `librustc/traits/error_reporting.rs`

4 years agofix rustfmt fallout
Ralf Jung [Fri, 3 Jan 2020 12:31:56 +0000 (13:31 +0100)]
fix rustfmt fallout

4 years agoAuto merge of #68286 - Dylan-DPC:rollup-x7ssgov, r=Dylan-DPC
bors [Thu, 16 Jan 2020 17:43:19 +0000 (17:43 +0000)]
Auto merge of #68286 - Dylan-DPC:rollup-x7ssgov, r=Dylan-DPC

Rollup of 5 pull requests

Successful merges:

 - #68033 (Don't use f64 shims for f32 cmath functions on non 32-bit x86 MSVC)
 - #68244 (Enable leak sanitizer test case)
 - #68255 (Remove unused auxiliary file that was replaced with rust_test_helpers)
 - #68263 (rustdoc: HTML escape codeblocks which fail syntax highlighting)
 - #68274 (remove dead code)

Failed merges:

r? @ghost

4 years agoAdd E0746 explanation to the index
Esteban Küber [Tue, 14 Jan 2020 01:21:31 +0000 (17:21 -0800)]
Add E0746 explanation to the index

4 years agofmt
Esteban Küber [Tue, 14 Jan 2020 01:20:28 +0000 (17:20 -0800)]
fmt

4 years agoWhen trait bounds are missing for return values, point at them
Esteban Küber [Tue, 14 Jan 2020 01:19:52 +0000 (17:19 -0800)]
When trait bounds are missing for return values, point at them

4 years agoMake `impl Trait` suggestion in E0746 `MachineApplicable`
Esteban Küber [Tue, 14 Jan 2020 00:13:51 +0000 (16:13 -0800)]
Make `impl Trait` suggestion in E0746 `MachineApplicable`

4 years agoElide E0308 errors in favor of E0746
Esteban Küber [Tue, 14 Jan 2020 00:12:44 +0000 (16:12 -0800)]
Elide E0308 errors in favor of E0746

When a type error involves a `dyn Trait` as the return type, do not emit
the type error, as the "return type is not `Sized`" error will provide
enough information to the user.

4 years agoAccount for diverging types in return `impl Trait`
Esteban Küber [Mon, 13 Jan 2020 21:14:11 +0000 (13:14 -0800)]
Account for diverging types in return `impl Trait`

4 years agoSpecific error for unsized `dyn Trait` return type
Esteban Küber [Mon, 13 Jan 2020 21:13:12 +0000 (13:13 -0800)]
Specific error for unsized `dyn Trait` return type

Suggest `impl Trait` when possible, and `Box<dyn Trait>` otherwise.

4 years agoRollup merge of #68274 - matthiaskrgr:dead_code, r=Dylan-DPC
Dylan DPC [Thu, 16 Jan 2020 15:23:32 +0000 (20:53 +0530)]
Rollup merge of #68274 - matthiaskrgr:dead_code, r=Dylan-DPC

remove dead code

The condition
`if obligation.recursion_depth >= 0`
is always true since `recursion_depth` is `usize`.

The else branch is dead code and can be removed.

Found by Clippy.

Fixes #68251

4 years agoRollup merge of #68263 - ollie27:rustdoc_invalid_syntax_highlight_escape, r=Guillaume...
Dylan DPC [Thu, 16 Jan 2020 15:23:30 +0000 (20:53 +0530)]
Rollup merge of #68263 - ollie27:rustdoc_invalid_syntax_highlight_escape, r=GuillaumeGomez

rustdoc: HTML escape codeblocks which fail syntax highlighting

r? @GuillaumeGomez

4 years agoRollup merge of #68255 - tmiasko:unused-aux, r=Dylan-DPC
Dylan DPC [Thu, 16 Jan 2020 15:23:29 +0000 (20:53 +0530)]
Rollup merge of #68255 - tmiasko:unused-aux, r=Dylan-DPC

Remove unused auxiliary file that was replaced with rust_test_helpers

4 years agoRollup merge of #68244 - tmiasko:leak, r=Centril
Dylan DPC [Thu, 16 Jan 2020 15:23:27 +0000 (20:53 +0530)]
Rollup merge of #68244 - tmiasko:leak, r=Centril

Enable leak sanitizer test case

* Use `black_box` to avoid memory leak removal during optimization.
* Leak multiple objects to make test case more robust.

4 years agoRollup merge of #68033 - ollie27:win_f32, r=dtolnay
Dylan DPC [Thu, 16 Jan 2020 15:23:26 +0000 (20:53 +0530)]
Rollup merge of #68033 - ollie27:win_f32, r=dtolnay

Don't use f64 shims for f32 cmath functions on non 32-bit x86 MSVC

These shims are only needed on 32-bit x86. Additionally since https://reviews.llvm.org/rL268875 LLVM handles adding the shims itself for the intrinsics.

4 years agoArray repeat expression lengths must be monomorphic at MIR building time
Oliver Scherer [Thu, 16 Jan 2020 15:18:08 +0000 (16:18 +0100)]
Array repeat expression lengths must be monomorphic at MIR building time

4 years agoUpdate Clippy
flip1995 [Thu, 16 Jan 2020 15:07:54 +0000 (16:07 +0100)]
Update Clippy

4 years agoAuto merge of #68258 - RalfJung:miri, r=RalfJung
bors [Thu, 16 Jan 2020 14:16:54 +0000 (14:16 +0000)]
Auto merge of #68258 - RalfJung:miri, r=RalfJung

update miri

Fixes https://github.com/rust-lang/rust/issues/68081

r? @ghost Cc @oli-obk

4 years agoremove dead code
Matthias Krüger [Thu, 16 Jan 2020 07:27:41 +0000 (08:27 +0100)]
remove dead code

The condition
if obligation.recursion_depth >= 0
is always true since recursion_depth is usize.

The else branch is dead code and can be removed.

Found by Clippy.

Fixes #68251

4 years agoAuto merge of #68272 - Dylan-DPC:rollup-vrb90gu, r=Dylan-DPC
bors [Thu, 16 Jan 2020 07:20:52 +0000 (07:20 +0000)]
Auto merge of #68272 - Dylan-DPC:rollup-vrb90gu, r=Dylan-DPC

Rollup of 5 pull requests

Successful merges:

 - #67780 (Move some queries from rustc::ty to librustc_ty.)
 - #68096 (Clean up some diagnostics by making them more consistent)
 - #68223 (Use 3.6 instead of 3.5 in float fract() documentation)
 - #68265 (Fix some issue numbers of unstable features)
 - #68266 (Changed docs for f32 and f64.)

Failed merges:

 - #68204 (Use named fields for `{ast,hir}::ItemKind::Impl`)

r? @ghost

4 years agoRollup merge of #68266 - Stromberg90:patch-2, r=Dylan-DPC
Dylan DPC [Thu, 16 Jan 2020 06:28:07 +0000 (11:58 +0530)]
Rollup merge of #68266 - Stromberg90:patch-2, r=Dylan-DPC

Changed docs for f32 and f64.

4 years agoRollup merge of #68265 - JohnTitor:fix-issue-number, r=Dylan-DPC
Dylan DPC [Thu, 16 Jan 2020 06:28:05 +0000 (11:58 +0530)]
Rollup merge of #68265 - JohnTitor:fix-issue-number, r=Dylan-DPC

Fix some issue numbers of unstable features

Looking into the unstable book, some issue numbers are outdated.

4 years agoRollup merge of #68223 - SOF3:float-fract-doc, r=varkor
Dylan DPC [Thu, 16 Jan 2020 06:28:04 +0000 (11:58 +0530)]
Rollup merge of #68223 - SOF3:float-fract-doc, r=varkor

Use 3.6 instead of 3.5 in float fract() documentation

It is not self-explanatory whether the fract() function inverts the fractional part of negative numbers. This change clarifies this possible question (so that it is `.6` not `.4`)

4 years agoRollup merge of #68096 - varkor:diagnostic-cleanup, r=Centril
Dylan DPC [Thu, 16 Jan 2020 06:28:02 +0000 (11:58 +0530)]
Rollup merge of #68096 - varkor:diagnostic-cleanup, r=Centril

Clean up some diagnostics by making them more consistent

In general:

- Diagnostic should start with a lowercase letter.
- Diagnostics should not end with a full stop.
- Ellipses contain three dots.
- Backticks should encode Rust code.

I also reworded a couple of messages to make them read more clearly.

It might be sensible to create a style guide for diagnostics, so these informal conventions are written down somewhere, after which we could audit the existing diagnostics.

r? @Centril

4 years agoRollup merge of #67780 - cjgillot:passes-ty, r=Zoxc
Dylan DPC [Thu, 16 Jan 2020 06:28:00 +0000 (11:58 +0530)]
Rollup merge of #67780 - cjgillot:passes-ty, r=Zoxc

Move some queries from rustc::ty to librustc_ty.

cc #65031

4 years agoFix issue number of `infer_static_outlives_requirements`
Yuki Okushi [Thu, 16 Jan 2020 02:59:04 +0000 (11:59 +0900)]
Fix issue number of `infer_static_outlives_requirements`

4 years agoFix issue number of `repr128`
Yuki Okushi [Thu, 16 Jan 2020 02:58:28 +0000 (11:58 +0900)]
Fix issue number of `repr128`

4 years agoUpdate f32.rs
Strømberg [Thu, 16 Jan 2020 02:35:31 +0000 (03:35 +0100)]
Update f32.rs

4 years agoUpdate f64.rs
Strømberg [Thu, 16 Jan 2020 02:34:23 +0000 (03:34 +0100)]
Update f64.rs

4 years agoUpdate f32.rs
Strømberg [Thu, 16 Jan 2020 02:30:27 +0000 (03:30 +0100)]
Update f32.rs

4 years agoFix issue number of `member_constraints`
Yuki Okushi [Thu, 16 Jan 2020 01:55:29 +0000 (10:55 +0900)]
Fix issue number of `member_constraints`

4 years agoAuto merge of #67339 - CAD97:rc-provenance, r=sfackler
bors [Thu, 16 Jan 2020 00:47:45 +0000 (00:47 +0000)]
Auto merge of #67339 - CAD97:rc-provenance, r=sfackler

Use pointer offset instead of deref for A/Rc::into_raw

Internals thread: https://internals.rust-lang.org/t/rc-and-internal-mutability/11463/2?u=cad97

The current implementation of (`A`)`Rc::into_raw` uses the `Deref::deref` implementation to get the pointer-to-data that is returned. This is problematic in the proposed Stacked Borrow rules, as this only gets shared provenance over the data location. (Note that the strong/weak counts are `UnsafeCell` (`Cell`/`Atomic`) so shared provenance can still mutate them, but the data itself is not.) When promoted back to a real reference counted pointer, the restored pointer can be used for mutation through `::get_mut` (if it is the only surviving reference). However, this mutates through a pointer ultimately derived from a `&T` borrow, violating the Stacked Borrow rules.

There are three known potential solutions to this issue:

- Stacked Borrows is wrong, liballoc is correct.
- Fully admit (`A`)`Rc` as an "internal mutability" type and store the data payload in an `UnsafeCell` like the strong/weak counts are. (Note: this is not needed generally since the `RcBox`/`ArcInner` is stored behind a shared `NonNull` which maintains shared write provenance as a raw pointer.)
- Adjust `into_raw` to do direct manipulation of the pointer (like `from_raw`) so that it maintains write provenance and doesn't derive the pointer from a reference.

This PR implements the third option, as recommended by @RalfJung.

Potential future work: provide `as_raw` and `clone_raw` associated functions to allow the [`&T` -> (`A`)`Rc<T>` pattern](https://internals.rust-lang.org/t/rc-and-internal-mutability/11463/2?u=cad97) to be used soundly without creating (`A`)`Rc` from references.