]> git.lizzy.rs Git - rust.git/log
rust.git
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 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 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 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 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 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.

4 years agorustdoc: HTML escape codeblocks which fail syntax highlighting
Oliver Middleton [Wed, 15 Jan 2020 22:42:04 +0000 (22:42 +0000)]
rustdoc: HTML escape codeblocks which fail syntax highlighting

4 years agoAuto merge of #68254 - Dylan-DPC:rollup-9vhc59u, r=Dylan-DPC
bors [Wed, 15 Jan 2020 19:40:45 +0000 (19:40 +0000)]
Auto merge of #68254 - Dylan-DPC:rollup-9vhc59u, r=Dylan-DPC

Rollup of 6 pull requests

Successful merges:

 - #68123 (Implement Cursor for linked lists. (RFC 2570).)
 - #68212 (Suggest to shorten temporary lifetime during method call inside generator)
 - #68232 (Optimize size/speed of Unicode datasets)
 - #68236 (Add some regression tests)
 - #68237 (Account for `Path`s in `is_suggestable_infer_ty`)
 - #68252 (remove redundant clones, found by clippy)

Failed merges:

r? @ghost

4 years agoupdate miri
Ralf Jung [Wed, 15 Jan 2020 19:03:22 +0000 (20:03 +0100)]
update miri

4 years agoUse 3.6 instead of 3.5 in float fract() documentation
SOFe [Tue, 14 Jan 2020 18:07:39 +0000 (02:07 +0800)]
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.

Co-Authored-By: Mateusz Mikuła <mati865@users.noreply.github.com>
4 years agoEnable leak sanitizer test case
Tomasz Miąsko [Wed, 15 Jan 2020 00:00:00 +0000 (00:00 +0000)]
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 agoRemove unused auxiliary file that was replaced with rust_test_helpers
Tomasz Miąsko [Wed, 15 Jan 2020 00:00:00 +0000 (00:00 +0000)]
Remove unused auxiliary file that was replaced with rust_test_helpers

4 years agoRollup merge of #68252 - matthiaskrgr:redundant_clones, r=oli-obk
Dylan DPC [Wed, 15 Jan 2020 17:19:32 +0000 (22:49 +0530)]
Rollup merge of #68252 - matthiaskrgr:redundant_clones, r=oli-obk

remove redundant clones, found by clippy

4 years agoRollup merge of #68237 - estebank:bad-bad-ice, r=petrochenkov
Dylan DPC [Wed, 15 Jan 2020 17:19:30 +0000 (22:49 +0530)]
Rollup merge of #68237 - estebank:bad-bad-ice, r=petrochenkov

Account for `Path`s in `is_suggestable_infer_ty`

Fix #68162.

4 years agoRollup merge of #68236 - JohnTitor:ice-tests, r=Centril
Dylan DPC [Wed, 15 Jan 2020 17:19:28 +0000 (22:49 +0530)]
Rollup merge of #68236 - JohnTitor:ice-tests, r=Centril

Add some regression tests

Closes #64848 (fixed by #67631)
Closes #65918 (ICE is hidden by #67000, no longer ICE)
Closes #66473 (fixed by #68084)
Closes #67550 (set mir-opt-level to 3)

r? @Centril

4 years agoRollup merge of #68232 - Mark-Simulacrum:unicode-tables, r=joshtriplett
Dylan DPC [Wed, 15 Jan 2020 17:19:27 +0000 (22:49 +0530)]
Rollup merge of #68232 - Mark-Simulacrum:unicode-tables, r=joshtriplett

Optimize size/speed of Unicode datasets

The overall implementation has the same general idea as the prior approach,
which was based on a compressed trie structure, but modified to use less space
(and, coincidentally, be an overall performance improvement).

Sizes | Old | New | New/current
-- | -- | -- | --
Alphabetic | 4616 | 2982 | 64.60%
Case_Ignorable | 3144 | 2112 | 67.18%
Cased | 2376 | 934 | 39.31%
Cc | 19 | 43 | 226.32%
Grapheme_Extend | 3072 | 1734 | 56.45%
Lowercase | 2328 | 985 | 42.31%
N | 2648 | 1239 | 46.79%
Uppercase | 1978 | 934 | 47.22%
White_Space | 241 | 140 | 58.09%
  |   |   |
Total | 20422 | 11103 | 54.37%

This table shows the size of the old and new tables in bytes. The most important
of these tables is "Grapheme_Extend", as it is present in essentially all Rust
programs due to being called from `str`'s Debug impl (`char::escape_debug`). In
a representative case given by this [blog post] for the embedded world, the
shrinking in this PR shrinks the final binary by 1,604 bytes, from 14,440 to
12,836.

The performance of these new tables, based on the (rough) benchmark of linearly
scanning the entire valid set of chars, querying for each `is_*`, is roughly
~50% better, though in some cases is either on par or slightly (3-5%) worse. In
practice, I believe the size benefits of this PR are the main concern. The new
implementation has been tested to be equivalent to the current nightly in terms
of returned values on the set of valid chars.

A (relatively) high-level explanation of the specific compression scheme used
can be found [in the generator].

This is split into three commits -- the first adds the generator which produces
the Rust code for the tables, the second adds support code for the lookup, and
the third actually swaps the current implementation out for the new one.

[blog post]: https://jamesmunns.com/blog/fmt-unreasonably-expensive/
[in the generator]: https://github.com/Mark-Simulacrum/rust/blob/unicode-tables/src/tools/unicode-table-generator/src/raw_emitter.rs

4 years agoRollup merge of #68212 - csmoe:temp, r=estebank
Dylan DPC [Wed, 15 Jan 2020 17:19:26 +0000 (22:49 +0530)]
Rollup merge of #68212 - csmoe:temp, r=estebank

Suggest to shorten temporary lifetime during method call inside generator

Closes https://github.com/rust-lang/rust/issues/67376
![image](https://user-images.githubusercontent.com/35686186/72364752-f6b1e400-3731-11ea-8ec9-8297ba4c6c77.png)

r? @estebank
cc @tmandry @nikomatsakis

4 years agoRollup merge of #68123 - crlf0710:linked_list_cursor, r=Amanieu
Dylan DPC [Wed, 15 Jan 2020 17:19:24 +0000 (22:49 +0530)]
Rollup merge of #68123 - crlf0710:linked_list_cursor, r=Amanieu

Implement Cursor for linked lists. (RFC 2570).

cc. #58533 cc. @Gankra

r? @Amanieu

4 years agoAuto merge of #67603 - oli-obk:no_mut_static_ref_from_const, r=RalfJung
bors [Wed, 15 Jan 2020 16:28:06 +0000 (16:28 +0000)]
Auto merge of #67603 - oli-obk:no_mut_static_ref_from_const, r=RalfJung

Promoteds can contain raw pointers, but these must still only point to immutable allocations

fixes #67601

r? @RalfJung

cc @wesleywiser in order to not change behaviour in this PR, const prop uses the constant rules for interning, but at least there's an explicit mode for it now that we can think about this in the future

4 years agoSet mir-opt-level to 3 to prevent regressions
Yuki Okushi [Tue, 14 Jan 2020 23:35:44 +0000 (08:35 +0900)]
Set mir-opt-level to 3 to prevent regressions

4 years agoAdd test for issue-66473
Yuki Okushi [Tue, 14 Jan 2020 23:34:51 +0000 (08:34 +0900)]
Add test for issue-66473

4 years agoAdd test for issue-65918
Yuki Okushi [Tue, 14 Jan 2020 23:34:33 +0000 (08:34 +0900)]
Add test for issue-65918

4 years agoAdd test for issue-64848
Yuki Okushi [Tue, 14 Jan 2020 23:34:20 +0000 (08:34 +0900)]
Add test for issue-64848

4 years agoremove redundant clones, found by clippy
Matthias Krüger [Wed, 15 Jan 2020 14:00:25 +0000 (15:00 +0100)]
remove redundant clones, found by clippy

4 years agoAuto merge of #68248 - JohnTitor:rollup-x0kml5f, r=JohnTitor
bors [Wed, 15 Jan 2020 13:00:43 +0000 (13:00 +0000)]
Auto merge of #68248 - JohnTitor:rollup-x0kml5f, r=JohnTitor

Rollup of 12 pull requests

Successful merges:

 - #67784 (Reset Formatter flags on exit from pad_integral)
 - #67914 (Don't run const propagation on items with inconsistent bounds)
 - #68141 (use winapi for non-stdlib Windows bindings)
 - #68211 (Add failing example for E0170 explanation)
 - #68219 (Untangle ZST validation from integer validation and generalize it to all zsts)
 - #68222 (Update the wasi-libc bundled with libstd)
 - #68226 (Avoid calling tcx.hir().get() on CRATE_HIR_ID)
 - #68227 (Update to a version of cmake with windows arm64 support)
 - #68229 (Update iovec to a version with no winapi dependency)
 - #68230 (Update libssh2-sys to a version that can build for aarch64-pc-windows…)
 - #68231 (Better support for cross compilation on Windows.)
 - #68233 (Update compiler_builtins with changes to fix 128 bit integer remainder for aarch64 windows.)

Failed merges:

r? @ghost

4 years agoRollup merge of #68233 - danielframpton:update-compiler-builtins, r=alexcrichton
Yuki Okushi [Wed, 15 Jan 2020 12:51:59 +0000 (21:51 +0900)]
Rollup merge of #68233 - danielframpton:update-compiler-builtins, r=alexcrichton

Update compiler_builtins with changes to fix 128 bit integer remainder for aarch64 windows.

I have been investigating enabling panic=unwind for aarch64-pc-windows-msvc (see #65313) and building rustc and cargo hosted on aarch64-pc-windows-msvc.

4 years agoRollup merge of #68231 - danielframpton:windows-crosscompile, r=alexcrichton
Yuki Okushi [Wed, 15 Jan 2020 12:51:58 +0000 (21:51 +0900)]
Rollup merge of #68231 - danielframpton:windows-crosscompile, r=alexcrichton

Better support for cross compilation on Windows.

I have been investigating enabling panic=unwind for aarch64-pc-windows-msvc (see #65313) and building rustc and cargo hosted on aarch64-pc-windows-msvc.

Without the libpath changes we were trying to link a mix of amd64 and arm64 binaries.

Without the cmake system name change, the llvm build was trying to run an arm64 build tool on the x86_64 build machine.

That said, I haven't tested all different combinations here and am very open to resolving this a different way.

4 years agoRollup merge of #68230 - danielframpton:update-libssh2-sys, r=alexcrichton
Yuki Okushi [Wed, 15 Jan 2020 12:51:57 +0000 (21:51 +0900)]
Rollup merge of #68230 - danielframpton:update-libssh2-sys, r=alexcrichton

Update libssh2-sys to a version that can build for aarch64-pc-windows…

I have been investigating enabling panic=unwind for aarch64-pc-windows-msvc (see #65313) and building rustc and cargo hosted on aarch64-pc-windows-msvc.

4 years agoRollup merge of #68229 - danielframpton:update-iovec, r=alexcrichton
Yuki Okushi [Wed, 15 Jan 2020 12:51:55 +0000 (21:51 +0900)]
Rollup merge of #68229 - danielframpton:update-iovec, r=alexcrichton

Update iovec to a version with no winapi dependency

I have been investigating enabling panic=unwind for aarch64-pc-windows-msvc (see #65313) and building rustc and cargo hosted on aarch64-pc-windows-msvc.

4 years agoRollup merge of #68227 - danielframpton:update-cmake, r=alexcrichton
Yuki Okushi [Wed, 15 Jan 2020 12:51:54 +0000 (21:51 +0900)]
Rollup merge of #68227 - danielframpton:update-cmake, r=alexcrichton

Update to a version of cmake with windows arm64 support

I have been investigating enabling panic=unwind for aarch64-pc-windows-msvc (see #65313) and building rustc and cargo hosted on aarch64-pc-windows-msvc.