Commit Graph

105827 Commits

Author SHA1 Message Date
Tyler Mandry
c854aecd62
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.
2020-01-17 17:28:10 -08:00
Dylan MacKenzie
4743995ed3 Use named fields for hir::ItemKind::Impl 2020-01-17 16:14:29 -08:00
Jethro Beekman
766f6c5d0a Actually pass target LLVM args to LLVM 2020-01-17 16:11:52 -08:00
Dylan MacKenzie
d461e6d6cb Use named fields for ast::ItemKind::Impl 2020-01-17 15:59:07 -08:00
Vita Batrla
239a7d9124 refactor fix using cfg_if! (fix build) 2020-01-18 00:47:20 +01:00
Oliver Middleton
79061d0e02 rustdoc: Catch fatal errors when syntax highlighting
For some errors the lexer will unwind so we need to handle that in addition to handling `token::Unknown`.
2020-01-17 23:44:44 +00:00
Vita Batrla
dda32e4e53 refactor fix using cfg_if! 2020-01-17 22:46:32 +01:00
bors
d8dcb6345b 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 🎉

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
2020-01-17 21:43:23 +00:00
Vadim Petrochenkov
8fa8b81a77 Fix some tests failing in --pass check mode 2020-01-18 00:38:17 +03:00
Guillaume Gomez
e8a4b9319c Clean up E0199 explanation 2020-01-17 19:54:07 +01:00
Guillaume Gomez
482dc77dee formatting 2020-01-17 19:51:07 +01:00
Guillaume Gomez
298e8ad5dc Extend url in heading test a bit 2020-01-17 19:49:03 +01:00
Guillaume Gomez
9c6c2f16f0 Clean up E0198 explanation 2020-01-17 19:47:48 +01:00
varkor
a91f77ca26 Add regression test for integer literals in generic arguments in where clauses 2020-01-17 16:09:22 +00:00
Oliver Scherer
cdc828e7f9 Stop treating FalseEdges and FalseUnwind as having semantic value for const eval 2020-01-17 17:09:05 +01:00
bors
689fca01c5 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
2020-01-17 15:58:24 +00:00
Vita Batrla
34878d7b05 Options IP_MULTICAST_TTL and IP_MULTICAST_LOOP are 1 byte on BSD and Solaris
See ip(4P) man page:
 IP_MULTICAST_TTL     Time  to live for multicast datagrams. This option
                      takes an unsigned character as  an  argument.  Its
                      value  is  the TTL that IP uses on outgoing multi-
                      cast datagrams. The default is 1.

 IP_MULTICAST_LOOP    Loopback for multicast datagrams. Normally  multi-
                      cast  datagrams  are  delivered  to members on the
                      sending  host  (or  sending  zone).  Setting   the
                      unsigned  character argument to 0 causes the oppo-
                      site behavior, meaning that  when  multiple  zones
                      are  present,  the  datagrams are delivered to all
                      zones except the sending zone.

https://docs.oracle.com/cd/E88353_01/html/E37851/ip-4p.html
https://man.openbsd.org/ip.4
2020-01-17 16:01:42 +01:00
Dylan DPC
87a2896b0a
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
2020-01-17 18:53:44 +05:30
Dylan DPC
ed0e11a3cb
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
2020-01-17 18:53:42 +05:30
Dylan DPC
8c016c3c36
Rollup merge of #67791 - Zoxc:lift-interning, r=eddyb
Implement Lift using interners instead of in_arena

r? @eddyb
cc @cjgillot
2020-01-17 18:53:41 +05:30
Dylan DPC
d3589aa4ed
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
2020-01-17 18:53:38 +05:30
Aaron Hill
3fef3d8b76
Add @weiznich's regression test 2020-01-17 08:22:40 -05:00
Aaron Hill
c431cd751f
Fix typo
Co-Authored-By: Oliver Scherer <github35764891676564198441@oli-obk.de>
2020-01-17 08:13:04 -05:00
Markus Westerlind
917eb18790 perf: Only search the potentially changed constraints in lexical_region_resolve 2020-01-17 13:43:41 +01:00
Markus Westerlind
343eee6082 perf: Filter out and process fixed constraints first in region expansion
Should reduce the number of elements as well as branches in the
extremely hot loop and process_constraint in benchmarks such as
unicode_normalization
2020-01-17 13:43:13 +01:00
bors
71c6346aa1 Auto merge of #68285 - oli-obk:specialization_regression, r=davidtwco
Array repeat expression lengths must be monomorphic at MIR building time

fixes #67743
2020-01-17 12:25:07 +00:00
Wesley Wiser
b1d0c118ff [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.
2020-01-17 06:25:22 -05:00
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