Commit Graph

106008 Commits

Author SHA1 Message Date
bors
2480c9eac1 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
2020-01-17 09:17:18 +00:00
Dylan DPC
98347cdbff
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
2020-01-17 11:16:42 +05:30
Dylan DPC
5d5587795e
Rollup merge of #68292 - matthiaskrgr:clone_on_copy, r=eddyb
don't clone types that are copy

Found via clippy.

r? @eddyb
2020-01-17 11:16:40 +05:30
Dylan DPC
c411c22eb0
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
2020-01-17 11:16:39 +05:30
Dylan DPC
de01a29fbe
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.
2020-01-17 11:16:37 +05:30
Dylan DPC
ecf42a3d62
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
2020-01-17 11:16:36 +05:30
Dylan DPC
9f4b328da2
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.
2020-01-17 11:16:32 +05:30
bors
91ff7c689d 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.
2020-01-17 04:13:38 +00:00
Phoebe Bell
022a7de26f Add SAFETY comment for atomic example 2020-01-16 19:26:02 -08:00
Esteban Küber
03240e1359 review comments 2020-01-16 18:55:23 -08:00
Phoebe Bell
0f2ee495e9 Fix formatting: ./x.py fmt 2020-01-16 18:50:53 -08:00
Phoebe Bell
c103c284b9 Move comments for tidy 2020-01-16 18:38:04 -08:00
Phoebe Bell
ca2fae8edb Elaborate on SAFETY comments 2020-01-16 18:32:21 -08:00
Phoebe Bell
e0140ffeb0 Apply suggestions from code review
Co-Authored-By: Ralf Jung <post@ralfj.de>
2020-01-16 18:27:44 -08:00
Phoebe Bell
a93e99cae7 Fix typo "gurantees -> guarantees" 2020-01-16 18:27:08 -08:00
Phoebe Bell
19fdc6e091 Document unsafe blocks in core::{cell, str, sync} 2020-01-16 18:26:14 -08:00
Esteban Küber
10a9ea4c26 Do not ICE on malformed suggestion spans 2020-01-16 18:14:26 -08:00
Tyler Mandry
6246f7e1f9 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.
2020-01-16 16:54:00 -08:00
bors
8cacf50563 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, .. }",
 );
 ```
2020-01-17 00:20:48 +00:00
Stein Somers
4dbae1e8ba Allow added string.insert benchmarks to compile 2020-01-17 01:05:49 +01:00
Aaron Hill
171fe82efc
Filter and test predicates using normalize_and_test_predicates for const-prop
Fixes #68264

Previously, I attempted to use
`substitute_normalize_and_test_predicates` to detect unsatisfiable
bounds. Unfortunately, since const-prop runs in a generic environment
(we don't have any of the function's generic parameters substituted),
this could lead to cycle errors when attempting to normalize predicates.

This check is replaced with a more precise check. We now only call
`normalize_and_test_predicates` on predicates that have the possibility
of being proved unsatisfiable - that is, predicates that don't depend
on anything local to the function (e.g. generic parameters). This
ensures that we don't hit cycle errors when we normalize said
predicates, while still ensuring that we detect unsatisfiable
predicates.
2020-01-16 18:53:51 -05:00
Aaron Hill
d088d8a2c1
Revert previous attempt at detecting unsatisfiable predicates 2020-01-16 18:47:52 -05:00
Matthias Krüger
7fbd30b1ae don't clone types that are copy
found via clippy
2020-01-16 23:48:49 +01:00
bors
ecbc222855 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
2020-01-16 20:59:57 +00:00
Guillaume Gomez
3094c3792b Improve code readability 2020-01-16 21:36:39 +01:00
Richard Dodd
73124df6eb Rust ./x.py fmt 2020-01-16 20:11:16 +00:00
jumbatm
25a8f9473f Don't warn about snake case for field puns that don't introduce a new name. 2020-01-17 05:57:39 +10:00
Esteban Küber
029a9c6253 review comments 2020-01-16 11:32:50 -08:00
Vadim Petrochenkov
0b60f1f2ae Ignore some tests on platforms without libstd spans 2020-01-16 22:19:55 +03:00
Vadim Petrochenkov
c84efe9b6c resolve: Say "import" when reporting private imports 2020-01-16 21:59:11 +03:00
Vadim Petrochenkov
28c3f6eb40 resolve: Point at the private item definitions in privacy errors 2020-01-16 21:59:11 +03:00
Vadim Petrochenkov
0f70daa9b0 resolve: Move privacy error reporting into a separate method
Give named fields to `struct PrivacyError`
Move `fn report_ambiguity_error` to `diagnostics.rs`
2020-01-16 21:59:11 +03:00
Ralf Jung
c781d15da3 adjust Deref comment 2020-01-16 18:57:59 +01:00
Ralf Jung
3fd1af5fdb let rustfmt undo most of my edits :( 2020-01-16 18:57:58 +01:00
Esteban Küber
00e2626895 Account for object safety when suggesting Box<dyn Trait> 2020-01-16 09:49:14 -08:00
Esteban Küber
d7a6212401 review comments 2020-01-16 09:49:14 -08:00
Esteban Küber
c305ac31c0 Fix error index test 2020-01-16 09:49:13 -08:00
Esteban Küber
509cb33dbc review comments 2020-01-16 09:49:13 -08:00
Esteban Küber
5b36c187dc review comments 2020-01-16 09:49:13 -08:00
Esteban Küber
4a75ef91f3 fix error code index comment 2020-01-16 09:49:13 -08:00
Esteban Küber
00c8272612 Split librustc/traits/error_reporting.rs 2020-01-16 09:49:13 -08:00
Ralf Jung
9dee5d582f fix rustfmt fallout 2020-01-16 18:43:51 +01:00
bors
4884061838 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
2020-01-16 17:43:19 +00:00
Esteban Küber
4c13d2555c Add E0746 explanation to the index 2020-01-16 09:37:24 -08:00
Esteban Küber
93293c56e8 fmt 2020-01-16 09:37:24 -08:00
Esteban Küber
e1dd8a9095 When trait bounds are missing for return values, point at them 2020-01-16 09:37:24 -08:00
Esteban Küber
b4bbe784a9 Make impl Trait suggestion in E0746 MachineApplicable 2020-01-16 09:37:24 -08:00
Esteban Küber
ea7e885204 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.
2020-01-16 09:37:24 -08:00
Esteban Küber
75eabb17ae Account for diverging types in return impl Trait 2020-01-16 09:37:24 -08:00
Esteban Küber
6fd564112f Specific error for unsized dyn Trait return type
Suggest `impl Trait` when possible, and `Box<dyn Trait>` otherwise.
2020-01-16 09:37:24 -08:00