]> git.lizzy.rs Git - rust.git/log
rust.git
6 years agoMove TrustedLen and FusedIterator impl of Iter/IterMut into macro
Sebastian Dröge [Sun, 3 Jun 2018 14:33:49 +0000 (17:33 +0300)]
Move TrustedLen and FusedIterator impl of Iter/IterMut into macro

6 years agoAuto merge of #51144 - tmccombs:unix-epoch-stable, r=Mark-Simulacrum
bors [Tue, 29 May 2018 03:22:20 +0000 (03:22 +0000)]
Auto merge of #51144 - tmccombs:unix-epoch-stable, r=Mark-Simulacrum

Stabilize SystemTime::UNIX_EPOCH

Fixes #49502

6 years agoAuto merge of #50475 - csmoe:debr, r=nikomatsakis
bors [Tue, 29 May 2018 01:11:24 +0000 (01:11 +0000)]
Auto merge of #50475 - csmoe:debr, r=nikomatsakis

Refactor DebruijnIndex to be 0-based

Fixes #49813

6 years agoStabilize SystemTime::UNIX_EPOCH
Thayne McCombs [Tue, 29 May 2018 00:24:01 +0000 (18:24 -0600)]
Stabilize SystemTime::UNIX_EPOCH

6 years agochange to 0-based indices
Niko Matsakis [Mon, 28 May 2018 17:19:04 +0000 (13:19 -0400)]
change to 0-based indices

Co-authored-by: csmoe <35686186+csmoe@users.noreply.github.com>
6 years agomake depth private
Niko Matsakis [Mon, 28 May 2018 16:56:56 +0000 (12:56 -0400)]
make depth private

Co-authored-by: csmoe <35686186+csmoe@users.noreply.github.com>
6 years agoremove use of depth from `TyS` and replace with a debruijn index
Niko Matsakis [Mon, 28 May 2018 16:38:39 +0000 (12:38 -0400)]
remove use of depth from `TyS` and replace with a debruijn index

Co-authored-by: csmoe <35686186+csmoe@users.noreply.github.com>
6 years agoreplace `binder_depth` in `LateBoundRegionsDetector`
Niko Matsakis [Mon, 28 May 2018 14:43:54 +0000 (10:43 -0400)]
replace `binder_depth` in `LateBoundRegionsDetector`

Co-authored-by: csmoe <35686186+csmoe@users.noreply.github.com>
6 years agoconvert `LateBoundRegionsCollector` to track a debruijn index
Niko Matsakis [Mon, 28 May 2018 14:24:01 +0000 (10:24 -0400)]
convert `LateBoundRegionsCollector` to track a debruijn index

Co-authored-by: csmoe <35686186+csmoe@users.noreply.github.com>
6 years agoreplace use of DebruijnIndex in `for_each_free_region`
Niko Matsakis [Mon, 28 May 2018 14:13:21 +0000 (10:13 -0400)]
replace use of DebruijnIndex in `for_each_free_region`

Co-authored-by: csmoe <35686186+csmoe@users.noreply.github.com>
6 years agorefactor `resolve_lifetime` to track outer-index, not depth
Niko Matsakis [Mon, 28 May 2018 13:53:10 +0000 (09:53 -0400)]
refactor `resolve_lifetime` to track outer-index, not depth

Co-authored-by: csmoe <35686186+csmoe@users.noreply.github.com>
6 years agorewrite the hasher to not access `depth` field
Niko Matsakis [Mon, 28 May 2018 13:52:53 +0000 (09:52 -0400)]
rewrite the hasher to not access `depth` field

Co-authored-by: csmoe <35686186+csmoe@users.noreply.github.com>
6 years agoport `nice_region_error` code to not track depth but rather index
Niko Matsakis [Fri, 25 May 2018 15:12:38 +0000 (11:12 -0400)]
port `nice_region_error` code to not track depth but rather index

Co-authored-by: csmoe <35686186+csmoe@users.noreply.github.com>
6 years agostop invoking `DebruijnIndex::new` directly
Niko Matsakis [Fri, 25 May 2018 14:41:01 +0000 (10:41 -0400)]
stop invoking `DebruijnIndex::new` directly

Co-authored-by: csmoe <35686186+csmoe@users.noreply.github.com>
6 years agomake `shifted_in` and `shifted_out` const fns
Niko Matsakis [Fri, 25 May 2018 14:37:38 +0000 (10:37 -0400)]
make `shifted_in` and `shifted_out` const fns

Co-authored-by: csmoe <35686186+csmoe@users.noreply.github.com>
6 years agoport `fold_regions` and friends to use debruijn indices directly
Niko Matsakis [Fri, 25 May 2018 13:58:29 +0000 (09:58 -0400)]
port `fold_regions` and friends to use debruijn indices directly

They no longer talk about plain integers.

Co-authored-by: csmoe <35686186+csmoe@users.noreply.github.com>
6 years agoAuto merge of #50465 - clarcharr:wrapping, r=KodrAus
bors [Mon, 28 May 2018 22:28:43 +0000 (22:28 +0000)]
Auto merge of #50465 - clarcharr:wrapping, r=KodrAus

Add missing Wrapping methods, use doc_comment!

Re-opened version of #49393 . Finishing touches for #32463.

Note that this adds `Shl` and `Shr` implementations for `Wrapping<i128>` and `Wrapping<u128>`, which were previously missed. This is technically insta-stable, but I don't know why this would be a problem.

6 years agoAuto merge of #50929 - zackmdavis:hiridification_initiative, r=michaelwoerister
bors [Mon, 28 May 2018 19:16:27 +0000 (19:16 +0000)]
Auto merge of #50929 - zackmdavis:hiridification_initiative, r=michaelwoerister

operate on `HirId` instead of `NodeId` in `hir::Pat::each_binding`, and consequences of that

See #50928 for motivation.

Questions—

 * Is #50928 actually a good idea as a plan of record, or is there some reason to keep `NodeId`s?
 * Are the uses of `find_node_for_hir_id` in this initial submission OK (see the FIXME comments)?
 * Can we bikeshed a better method names `struct_span_lint_hir` _&c._? (Coined in analogy to the `struct_span_lint_node` and `NodeId`, but it feels kind of semantically clunky.)

r? @michaelwoerister

6 years agointroduce `shifted_in`, `shifted_out` and friends
Niko Matsakis [Fri, 25 May 2018 13:06:54 +0000 (09:06 -0400)]
introduce `shifted_in`, `shifted_out` and friends

Co-authored-by: csmoe <35686186+csmoe@users.noreply.github.com>
6 years agoAuto merge of #50521 - gnzlbg:simd_float, r=alexcrichton
bors [Mon, 28 May 2018 16:54:44 +0000 (16:54 +0000)]
Auto merge of #50521 - gnzlbg:simd_float, r=alexcrichton

Add simd math intrinsics and gather/scatter

This PR adds simd math intrinsics for floating-point vectors (sqrt, sin, cos, pow, exp, log, fma, abs, etc.) and the generic simd gather/scatter intrinsics.

6 years agoscrap `find_node_for_hir_id` in favor of `hir_to_node_id`
Zack M. Davis [Sun, 27 May 2018 00:30:26 +0000 (17:30 -0700)]
scrap `find_node_for_hir_id` in favor of `hir_to_node_id`

Michael Woerister pointed out that `hir_to_node_id` (introduced in
August 2017's 28ddd7a4e) supersedes the functionality of
`find_node_for_hir_id` (just a hash lookup compared to that linear
search).

6 years agoin which `NodeMap` and friends are macrotized!
Zack M. Davis [Mon, 21 May 2018 06:15:07 +0000 (23:15 -0700)]
in which `NodeMap` and friends are macrotized!

6 years agooperate on `HirId` in `hir::Pat::each_binding`, and consequences of that
Zack M. Davis [Mon, 21 May 2018 03:19:34 +0000 (20:19 -0700)]
operate on `HirId` in `hir::Pat::each_binding`, and consequences of that

Changing the `each_binding` utility method to take the `HirId` of a
binding pattern rather than its `NodeId` seems like a modest first step
in support of the `HirId`ification initiative #50928. (The inspiration
for choosing this in particular came from the present author's previous
work on diagnostics issued during liveness analysis, which is the most
greatly affected module in this change.)

6 years agoAuto merge of #51121 - Manishearth:rust-syntax, r=killercup
bors [Mon, 28 May 2018 14:45:46 +0000 (14:45 +0000)]
Auto merge of #51121 - Manishearth:rust-syntax, r=killercup

Mark .fixed files as Rust syntax for GitHub

r? @killercup

6 years agoAuto merge of #51118 - nrc:update, r=oli-obk
bors [Mon, 28 May 2018 12:39:03 +0000 (12:39 +0000)]
Auto merge of #51118 - nrc:update, r=oli-obk

Update RLS, Rustfmt, and Cargo

r? @Mark-Simulacrum

Should fix broken rustfmt and RLS builds - Cargo update is needed for compatibility with RLS

6 years agoAuto merge of #50724 - zackmdavis:applicability_rush, r=Manishearth
bors [Mon, 28 May 2018 10:11:26 +0000 (10:11 +0000)]
Auto merge of #50724 - zackmdavis:applicability_rush, r=Manishearth

add suggestion applicabilities to librustc and libsyntax

A down payment on #50723. Interested in feedback on whether my `MaybeIncorrect` vs. `MachineApplicable` judgement calls are well-calibrated (and that we have a consensus on what this means).

r? @Manishearth
cc @killercup @estebank

6 years agoMark .fixed files as Rust syntax for GitHub
Manish Goregaokar [Mon, 28 May 2018 09:36:13 +0000 (11:36 +0200)]
Mark .fixed files as Rust syntax for GitHub

6 years agoAuto merge of #50612 - Zoxc:thin-slice, r=michaelwoerister
bors [Mon, 28 May 2018 07:59:21 +0000 (07:59 +0000)]
Auto merge of #50612 - Zoxc:thin-slice, r=michaelwoerister

Make &Slice a thin pointer

Split out from https://github.com/rust-lang/rust/pull/50395

r? @michaelwoerister

6 years agoUpdate RLS, Rustfmt, and Cargo
Nick Cameron [Sun, 27 May 2018 22:16:42 +0000 (10:16 +1200)]
Update RLS, Rustfmt, and Cargo

6 years agoAuto merge of #50892 - davidtwco:issue-50004, r=alexcrichton
bors [Mon, 28 May 2018 01:28:14 +0000 (01:28 +0000)]
Auto merge of #50892 - davidtwco:issue-50004, r=alexcrichton

Added rustdoc documentation to compiler docs.

Fixes #50004.

r? @alexcrichton
(since you reviewed the last PR about compiler docs)

6 years agoAuto merge of #48309 - mark-i-m:anon_param_lint, r=nikomatsakis
bors [Sun, 27 May 2018 22:28:11 +0000 (22:28 +0000)]
Auto merge of #48309 - mark-i-m:anon_param_lint, r=nikomatsakis

Make anon params lint warn-by-default

This is intended as a followup on anonymous parameters deprecation.

Cross-posting from #41686:

> After having read a bit more of the discussion that I can find, I propose a more aggressive deprecation strategy:
> - We make the lint warn-by-default as soon as possible
> - We make anon parameters a hard error at the epoch boundary

cc @matklad @est31 @aturon

6 years agoAuto merge of #51062 - mati865:cargo_update, r=alexcrichton
bors [Sun, 27 May 2018 20:27:48 +0000 (20:27 +0000)]
Auto merge of #51062 - mati865:cargo_update, r=alexcrichton

Update cargo

There are few nice fixes waiting already.

6 years agoMake anon params lint warn-by-default
Mark Mansi [Sat, 17 Feb 2018 23:33:27 +0000 (17:33 -0600)]
Make anon params lint warn-by-default

6 years agoAuto merge of #51108 - simartin:issue_51022_follow-up, r=estebank
bors [Sun, 27 May 2018 18:08:26 +0000 (18:08 +0000)]
Auto merge of #51108 - simartin:issue_51022_follow-up, r=estebank

Address comments in pull request #51084.

This is a follow-up to https://github.com/rust-lang/rust/pull/51084, that's already been integrated into mainline.

6 years agoAuto merge of #51078 - GuillaumeGomez:stabilize-formatter, r=SimonSapin
bors [Sun, 27 May 2018 16:01:32 +0000 (16:01 +0000)]
Auto merge of #51078 - GuillaumeGomez:stabilize-formatter, r=SimonSapin

Stabilize Formatter alignment

Fixes #27726.

cc @SimonSapin

6 years agoAdd fields to Slice
John Kåre Alsaker [Thu, 24 May 2018 11:07:27 +0000 (13:07 +0200)]
Add fields to Slice

6 years agoAdd assertions for TyS and TypeVariants sizes
John Kåre Alsaker [Sun, 27 May 2018 15:13:15 +0000 (17:13 +0200)]
Add assertions for TyS and TypeVariants sizes

6 years agoMake &Slice a thin pointer
John Kåre Alsaker [Wed, 2 May 2018 06:02:57 +0000 (08:02 +0200)]
Make &Slice a thin pointer

6 years agoAddress comments in pull request #51084.
Simon Martin [Sun, 27 May 2018 15:04:27 +0000 (17:04 +0200)]
Address comments in pull request #51084.

6 years agoAuto merge of #51105 - uuttff8:master, r=GuillaumeGomez
bors [Sun, 27 May 2018 13:49:52 +0000 (13:49 +0000)]
Auto merge of #51105 - uuttff8:master, r=GuillaumeGomez

lib.rs don't beautiful

6 years agoStabilize Formatter alignment
Guillaume Gomez [Sat, 26 May 2018 08:41:48 +0000 (10:41 +0200)]
Stabilize Formatter alignment

6 years agoAuto merge of #51101 - 11Takanori:fix-typo, r=frewsxcv
bors [Sun, 27 May 2018 11:43:26 +0000 (11:43 +0000)]
Auto merge of #51101 - 11Takanori:fix-typo, r=frewsxcv

Fix typo in macro_parser.rs

innacurate -> inaccurate

6 years agoAuto merge of #51084 - simartin:issue_51022, r=estebank
bors [Sun, 27 May 2018 09:22:27 +0000 (09:22 +0000)]
Auto merge of #51084 - simartin:issue_51022, r=estebank

Issue #51022: Improve E0131 message when lifetimes are involved.

Fixes #51022

6 years agolib.rs don't beautiful
uuttff8 [Sun, 27 May 2018 08:53:43 +0000 (11:53 +0300)]
lib.rs don't beautiful

6 years agoAuto merge of #51090 - kennytm:tidy-check-missing-tracking-issue, r=alexcrichton
bors [Sun, 27 May 2018 07:02:17 +0000 (07:02 +0000)]
Auto merge of #51090 - kennytm:tidy-check-missing-tracking-issue, r=alexcrichton

Ensure every unstable language feature has a tracking issue.

Filled in the missing numbers:

* `abi_ptx` → #38788
* `generators` → #43122
* `global_allocator` → #27389

Reused existing tracking issues because they were decomposed from a larger feature

* `*_target_feature` → #44839 (reusing the old `target_feature` number)
* `proc_macros_*` → #38356 (reusing the to-be-stabilized `proc_macros` number)

Filed new issues

* `exhaustive_patterns` → #51085
* `pattern_parentheses` → #51087
* `wasm_custom_section` and `wasm_import_module` → #51088

6 years agoEnsure every unstable feature has a tracking issue.
kennytm [Sat, 26 May 2018 15:39:31 +0000 (23:39 +0800)]
Ensure every unstable feature has a tracking issue.

6 years agoAuto merge of #51075 - estebank:and_the_case_of_the_confusable_float_exponent, r...
bors [Sun, 27 May 2018 03:32:47 +0000 (03:32 +0000)]
Auto merge of #51075 - estebank:and_the_case_of_the_confusable_float_exponent, r=eddyb

Check for confusable Unicode chars in float literal exponent

Fixing tests for #49989. Resolves #49746.

6 years agoAuto merge of #51066 - est31:master, r=sfackler
bors [Sun, 27 May 2018 00:54:12 +0000 (00:54 +0000)]
Auto merge of #51066 - est31:master, r=sfackler

Point to the current box syntax tracking issue

The issue was used for both box syntax as well as placement new.
It got closed due to placement new being unapproved.
So a new one got created for box syntax, yet neither
the unstable book nor feature_gate.rs got updated.
We are doing this now.

r? @aidanhs

6 years agoinnacurate -> inaccurate
Takanori Ishibashi [Sun, 27 May 2018 00:47:04 +0000 (09:47 +0900)]
innacurate -> inaccurate

6 years agoIssue #51022: Improve E0131 message when lifetimes are involved.
Simon Martin [Sat, 26 May 2018 13:45:45 +0000 (15:45 +0200)]
Issue #51022: Improve E0131 message when lifetimes are involved.

6 years agoUpdate cargo
Mateusz Mikuła [Fri, 25 May 2018 16:38:04 +0000 (18:38 +0200)]
Update cargo

6 years agoAuto merge of #51094 - Mark-Simulacrum:rollup, r=Mark-Simulacrum
bors [Sat, 26 May 2018 19:05:39 +0000 (19:05 +0000)]
Auto merge of #51094 - Mark-Simulacrum:rollup, r=Mark-Simulacrum

Rollup of 3 pull requests

Successful merges:

 - #51049 (Fix behaviour of divergence in while loop conditions)
 - #51057 (make ui tests robust with respect to NLL)
 - #51092 ([master] Release notes for 1.26.1)

Failed merges:

6 years agoFix test
Esteban Küber [Sat, 26 May 2018 04:57:02 +0000 (21:57 -0700)]
Fix test

6 years agoPoint to the current box syntax tracking issue
est31 [Fri, 25 May 2018 20:37:25 +0000 (22:37 +0200)]
Point to the current box syntax tracking issue

The issue was used for both box syntax as well as placement new.
It got closed due to placement new being unapproved.
So a new one got created for box syntax, yet neither
the unstable book nor feature_gate.rs got updated.
We are doing this now.

6 years agoRollup merge of #51092 - Mark-Simulacrum:release-notes-master, r=Mark-Simulacrum
Mark Simulacrum [Sat, 26 May 2018 17:22:55 +0000 (11:22 -0600)]
Rollup merge of #51092 - Mark-Simulacrum:release-notes-master, r=Mark-Simulacrum

[master] Release notes for 1.26.1

None

6 years agoRollup merge of #51057 - pnkfelix:issue-51025-make-ui-tests-robust-wrt-nll, r=nikomat...
Mark Simulacrum [Sat, 26 May 2018 17:22:54 +0000 (11:22 -0600)]
Rollup merge of #51057 - pnkfelix:issue-51025-make-ui-tests-robust-wrt-nll, r=nikomatsakis

make ui tests robust with respect to NLL

This PR revises the `ui` tests that I could quickly identify that:
 1. previously had successful compilations under non-lexical lifetimes (NLL) because they assumed lexical lifetimes, but
 2. such assumption of lexical lifetimes was actually not necessarily part of the spirit of the original issue/bug we want to witness.

In many cases, this is simply a matter of adding a use of a borrow so that it gets extended long enough to observe a conflict.

(In some cases the revision was more subtle, such as adding a destructor, or revising the order of declaration of some variables.)

----

With these test revisions in place, I subsequently updated the expected stderr output under the NLL compiletest mode. So now we should get even more testing of NLL than we were before.

Fix #51025

6 years agoRollup merge of #51049 - varkor:break-while-condition, r=nikomatsakis
Mark Simulacrum [Sat, 26 May 2018 17:22:53 +0000 (11:22 -0600)]
Rollup merge of #51049 - varkor:break-while-condition, r=nikomatsakis

Fix behaviour of divergence in while loop conditions

This fixes `'a: while break 'a {};` being treated as diverging, by tracking break expressions in the same way as in `loop` expressions.

Fixes #50856.

r? @nikomatsakis

6 years agoCopy release notes from stable branch to master
Mark Simulacrum [Sat, 26 May 2018 17:19:21 +0000 (11:19 -0600)]
Copy release notes from stable branch to master

6 years agoAuto merge of #51072 - petrochenkov:ifield, r=eddyb
bors [Sat, 26 May 2018 16:56:22 +0000 (16:56 +0000)]
Auto merge of #51072 - petrochenkov:ifield, r=eddyb

Use `Ident`s for fields in HIR

Continuation of https://github.com/rust-lang/rust/pull/49718, part of https://github.com/rust-lang/rust/issues/49300

6 years agoAuto merge of #51052 - nikomatsakis:obsolete-arrow, r=petrochenkov
bors [Sat, 26 May 2018 14:30:30 +0000 (14:30 +0000)]
Auto merge of #51052 - nikomatsakis:obsolete-arrow, r=petrochenkov

restore emplacement syntax (obsolete)

Fix https://github.com/rust-lang/rust/issues/50832

r? @petrochenkov

6 years agoAdd `Ident::as_str` helper
Vadim Petrochenkov [Sat, 26 May 2018 12:12:38 +0000 (15:12 +0300)]
Add `Ident::as_str` helper

6 years agoAuto merge of #51082 - kennytm:rollup, r=kennytm
bors [Sat, 26 May 2018 12:03:28 +0000 (12:03 +0000)]
Auto merge of #51082 - kennytm:rollup, r=kennytm

Rollup of 11 pull requests

Successful merges:

 - #50987 (Underline multiple suggested replacements in the same line)
 - #51014 (Add documentation about env! second argument)
 - #51034 (Remove unused lowering field and method)
 - #51047 (Use AllFacts from polonius-engine)
 - #51048 (Add more missing examples for Formatter)
 - #51056 (Mention and use `Once::new` instead of `ONCE_INIT`)
 - #51059 (What does an expression look like, that consists only of special characters?)
 - #51065 (Update nomicon link in transmute docs)
 - #51067 (Add inner links in documentation)
 - #51070 (Fail typecheck if we encounter a bogus break)
 - #51073 (Rename TokenStream::empty to TokenStream::new)

Failed merges:

6 years agoUse `Ident`s for fields in HIR
Vadim Petrochenkov [Fri, 25 May 2018 23:50:15 +0000 (02:50 +0300)]
Use `Ident`s for fields in HIR

6 years agoRollup merge of #51073 - dtolnay:empty, r=alexcrichton
kennytm [Sat, 26 May 2018 11:32:33 +0000 (19:32 +0800)]
Rollup merge of #51073 - dtolnay:empty, r=alexcrichton

Rename TokenStream::empty to TokenStream::new

There is no precedent for the `empty` name -- we do not have `Vec::empty` or `HashMap::empty` etc.

I would propose landing this but reflecting it in a non-breaking release of proc-macro2 that provides both `new` and a deprecated `empty` constructor.

Tracking issue: #38356

r? @alexcrichton

6 years agoRollup merge of #51070 - est31:fix_break_const_ice, r=estebank
kennytm [Sat, 26 May 2018 11:32:32 +0000 (19:32 +0800)]
Rollup merge of #51070 - est31:fix_break_const_ice, r=estebank

Fail typecheck if we encounter a bogus break

Lone breaks outside of loops create errors in the
loop check pass but as they are not fatal,
compilation continues.

MIR building code assumes all HIR break statements
to point to valid locations and fires ICEs if this
assumption is violated. In normal compilation,
this causes no issues, as code apparently prevents
MIR from being built if errors are present.

However, before that, typecheck runs and with it
MIR const eval. Here we operate differently
from normal compilation: it doesn't check for any
errors except for type checker ones and then
directly builds the MIR.

This constellation causes an ICE-on-error if
bogus break statements are being put into array
length expressions.

This commit fixes this ICE by letting typecheck
fail if bogus break statements are encountered.
This way, MIR const eval fails cleanly with a
type check error.

Fixes #50576
Fixes #50581

6 years agoRollup merge of #51067 - mcarton:patch-1, r=steveklabnik
kennytm [Sat, 26 May 2018 11:32:30 +0000 (19:32 +0800)]
Rollup merge of #51067 - mcarton:patch-1, r=steveklabnik

Add inner links in documentation

From [this SO question](https://stackoverflow.com/q/50518757/2733851) it looks like this page isn't really clear.
I personally do think this page is quite clear, the only think I could think of was adding some references.

6 years agoRollup merge of #51065 - mbrubeck:docs, r=rkruppe
kennytm [Sat, 26 May 2018 11:32:29 +0000 (19:32 +0800)]
Rollup merge of #51065 - mbrubeck:docs, r=rkruppe

Update nomicon link in transmute docs

The list of "invalid primitive values" has moved to a different URL within the Rustonomicon.

6 years agoRollup merge of #51059 - oberien:patch-1, r=nikomatsakis
kennytm [Sat, 26 May 2018 11:32:25 +0000 (19:32 +0800)]
Rollup merge of #51059 - oberien:patch-1, r=nikomatsakis

What does an expression look like, that consists only of special characters?

I had a lot of fun creating this together with @CryZe

6 years agoRollup merge of #51056 - tbu-:pr_once_new, r=dtolnay
kennytm [Sat, 26 May 2018 11:32:24 +0000 (19:32 +0800)]
Rollup merge of #51056 - tbu-:pr_once_new, r=dtolnay

Mention and use `Once::new` instead of `ONCE_INIT`

6 years agoRollup merge of #51048 - GuillaumeGomez:formatter-examples, r=QuietMisdreavus
kennytm [Sat, 26 May 2018 11:32:23 +0000 (19:32 +0800)]
Rollup merge of #51048 - GuillaumeGomez:formatter-examples, r=QuietMisdreavus

Add more missing examples for Formatter

r? @QuietMisdreavus

6 years agoRollup merge of #51047 - spastorino:use_polonius_engine_facts, r=nikomatsakis
kennytm [Sat, 26 May 2018 11:32:22 +0000 (19:32 +0800)]
Rollup merge of #51047 - spastorino:use_polonius_engine_facts, r=nikomatsakis

Use AllFacts from polonius-engine

6 years agoRollup merge of #51034 - oli-obk:lowering, r=pnkfelix
kennytm [Sat, 26 May 2018 11:32:21 +0000 (19:32 +0800)]
Rollup merge of #51034 - oli-obk:lowering, r=pnkfelix

Remove unused lowering field and method

r? @nikomatsakis

So while trying to understand lowering better, I found out that there's something related to creating definitions. Analyzing that further, I realized that it is entirely dead code.

The `parent_def` field was only ever used for setting and resetting the field itself. The field was never read anywhere else and thus its value was entirely unused.

Maybe the `unused_field` lint should detect when the only use of a field is the field being read without using the read value other than writing back to the field?

The diff is best viewed without whitespace changes getting in the way: https://github.com/rust-lang/rust/pull/51034/files?w=1

6 years agoRollup merge of #51014 - GuillaumeGomez:env_docs, r=QuietMisdreavus
kennytm [Sat, 26 May 2018 11:32:20 +0000 (19:32 +0800)]
Rollup merge of #51014 - GuillaumeGomez:env_docs, r=QuietMisdreavus

Add documentation about env! second argument

Fixes #48044.

r? @QuietMisdreavus

6 years agoRollup merge of #50987 - estebank:underline-multiple-suggestions, r=petrochencov
kennytm [Sat, 26 May 2018 11:32:18 +0000 (19:32 +0800)]
Rollup merge of #50987 - estebank:underline-multiple-suggestions, r=petrochencov

Underline multiple suggested replacements in the same line

<img width="685" alt="screen shot 2018-05-22 at 21 06 48" src="https://user-images.githubusercontent.com/1606434/40403051-174f3180-5e04-11e8-86b6-261630c5ff80.png">

Follow up to #50943.

Fix #50977.

6 years agoAuto merge of #51041 - alexcrichton:better-unwind, r=nikomatsakis
bors [Sat, 26 May 2018 09:59:43 +0000 (09:59 +0000)]
Auto merge of #51041 - alexcrichton:better-unwind, r=nikomatsakis

std: Ensure OOM is classified as `nounwind`

OOM can't unwind today, and historically it's been optimized as if it can't
unwind. This accidentally regressed with recent changes to the OOM handler, so
this commit adds in a codegen test to assert that everything gets optimized away
after the OOM function is approrpiately classified as nounwind

Closes #50925

6 years agoAuto merge of #50364 - LukasKalbertodt:improve-duration-debug-impl, r=KodrAus
bors [Sat, 26 May 2018 07:33:06 +0000 (07:33 +0000)]
Auto merge of #50364 - LukasKalbertodt:improve-duration-debug-impl, r=KodrAus

Improve `Debug` impl of `time::Duration`

Hi there!

For a long time now, I was getting annoyed by the derived `Debug` impl of `Duration`. Usually, I use `Duration` to either do quick'n'dirty benchmarking or measuring the time of some operation in general. The output of the derived Debug impl is hard to parse for humans: is { secs: 0, nanos: 968360102 } or { secs: 0, nanos 98507324 } longer?

So after running into the annoyance several times (sometimes building my own function to print the Duration properly), I decided to tackle this. Now the output looks like this:

```
Duration::new(1, 0)                 => 1s
Duration::new(1, 1)                 => 1.000000001s
Duration::new(1, 300)               => 1.0000003s
Duration::new(1, 4000)              => 1.000004s
Duration::new(1, 600000)            => 1.0006s
Duration::new(1, 7000000)           => 1.007s
Duration::new(0, 0)                 => 0ns
Duration::new(0, 1)                 => 1ns
Duration::new(0, 300)               => 300ns
Duration::new(0, 4001)              => 4.001µs
Duration::new(0, 600300)            => 600.3µs
Duration::new(0, 7000000)           => 7ms
```

Note that I implemented the formatting manually and didn't use floats. No information is "lost" when printing. So `Duration::new(123_456_789_000, 900_000_001)` prints as `123456789000.900000001s`.

~~This is not yet finished~~, but I wanted to open the PR now already in order to get some feedback (maybe everyone likes the derived impl).

### Still ToDo:

- [x] Respect precision ~~and width~~ parameter of the formatter (see [this comment](https://github.com/rust-lang/rust/pull/50364#issuecomment-386107107))

### Alternatives/Decisions

- Should large durations displayed in minutes, hours, days, ...? For now, I decided not to because the current formatting is close the how a `Duration` is stored. From this new `Debug` output, you can still easily see what the values of `secs` and `nanos` are. A formatting like `3h 27m 12s 9ms` might be more appropriate for a `Display` impl?
- Should this rather be a `Display` impl and should `Debug` be derived? Maybe this formatting is too fancy for `Debug`? In my opinion it's not and, as already mentioned, from the current format one can still very easily determine the values for `secs` and `nanos`.
- Whitespace between the number and the unit?

### Notes for reviewers

- ~~The combined diff sucks. Rather review both commits individually.~~
- ~~In the unit test, I am building my own type implementing `fmt::Write` to test the output. Maybe there is already something like that which I can use?~~
- My `Debug` impl block is marked as `#[stable(...)]`... but that's fine since the derived Debug impl was stable already, right?

---

~~Apart from the main change, I moved all `time` unit tests into the `tests` directory. All other `libcore` tests are there, so I guess it was simply an oversight. Prior to this change, the `time` tests weren't run, so I guess this is kind of a bug fix. If my `Debug` impl is rejected, I can of course just send the fix as PR.~~ (this was already merged in #50466)

6 years agoin which we check for confusable Unicodepoints in float literal exponent
Zack M. Davis [Sun, 15 Apr 2018 21:30:23 +0000 (14:30 -0700)]
in which we check for confusable Unicodepoints in float literal exponent

The `FatalError.raise()` might seem unmotivated (in most places in
the compiler, `err.emit()` suffices), but it's actually used to
maintain behavior (viz., stop lexing, don't emit potentially spurious
errors looking for the next token after the bad Unicodepoint in the
exponent): the previous revision's `self.err_span_` ultimately calls
`Handler::emit`, which aborts if the `Handler`'s continue_after_error
flag is set, which seems to typically be true during lexing (see
`phase_1_parse_input` and and how `CompileController::basic` has
`continue_parse_after_error: false` in librustc_driver).

Also, let's avoid apostrophes in error messages (the present author
would argue that users expect a reassuringly detached, formal,
above-it-all tone from a Serious tool like a compiler), and use an
RLS-friendly structured suggestion.

Resolves #49746.

6 years agoAuto merge of #51035 - oli-obk:unsupported_crate_type, r=eddyb
bors [Sat, 26 May 2018 03:22:39 +0000 (03:22 +0000)]
Auto merge of #51035 - oli-obk:unsupported_crate_type, r=eddyb

Don't ICE if crate has no valid crate types left

fixes #50993

6 years agoRename TokenStream::empty to TokenStream::new
David Tolnay [Sat, 26 May 2018 02:44:07 +0000 (19:44 -0700)]
Rename TokenStream::empty to TokenStream::new

There is no precedent for the `empty` name -- we do not have
`Vec::empty` or `HashMap::empty` etc.

6 years agoFail typecheck if we encounter a bogus break
est31 [Sat, 26 May 2018 00:48:08 +0000 (02:48 +0200)]
Fail typecheck if we encounter a bogus break

Lone breaks outside of loops create errors in the
loop check pass but as they are not fatal,
compilation continues.

MIR building code assumes all HIR break statements
to point to valid locations and fires ICEs if this
assumption is violated. In normal compilation,
this causes no issues, as code apparently prevents
MIR from being built if errors are present.

However, before that, typecheck runs and with it
MIR const eval. Here we operate differently
from normal compilation: it doesn't check for any
errors except for type checker ones and then
directly builds the MIR.

This constellation causes an ICE-on-error if
bogus break statements are being put into array
length expressions.

This commit fixes this ICE by letting typecheck
fail if bogus break statements are encountered.
This way, MIR const eval fails cleanly with a
type check error.

Fixes #50576
Fixes #50581

6 years agoAuto merge of #50070 - toidiu:ak-2093-outlives, r=nikomatsakis
bors [Sat, 26 May 2018 01:09:02 +0000 (01:09 +0000)]
Auto merge of #50070 - toidiu:ak-2093-outlives, r=nikomatsakis

2093 infer outlives requirements

Tracking issue:  #44493
RFC: https://github.com/rust-lang/rfcs/pull/2093

- [x] add `rustc_attrs` flag
- [x] use `RequirePredicates` type
- [x]  handle explicit predicates on `dyn` Trait
- [x] handle explicit predicates on projections
- [x] more tests
- [x]  remove `unused`, `dead_code` and etc..
- [x]  documentation

6 years agoAuto merge of #51033 - coryshrmn:master, r=dtolnay
bors [Fri, 25 May 2018 22:18:27 +0000 (22:18 +0000)]
Auto merge of #51033 - coryshrmn:master, r=dtolnay

stabilize RangeBounds collections_range #30877

The FCP for #30877 closed last month, with the decision to:
1. move from `collections::range::RangeArgument` to `ops::RangeBounds`, and
2. rename `start()` and `end()` to `start_bounds()` and `end_bounds()`.

Simon Sapin already moved it to `ops::RangeBounds` in #49163.

I renamed the functions, and removed the old `collections::range::RangeArgument` alias.

This is my first Rust PR, please let me know if I can improve anything. This passes all tests for me, except the `clippy` tool (which uses `RangeArgument::start()`).

I considered deprecating `start()` and `end()` instead of removing them, but the contribution guidelines indicate we can break `clippy` temporarily. I thought it was best to remove the functions, since we're worried about name collisions with `Range::start` and `end`.

Closes #30877.

6 years agoAdd inner links in documentation
Martin Carton [Fri, 25 May 2018 20:55:33 +0000 (22:55 +0200)]
Add inner links in documentation

From [this SO question](https://stackoverflow.com/q/50518757/2733851) it looks like this page isn't really clear.
I personally do think this page is quite clear, the only think I could think of was adding some references.

6 years agoUpdate nomicon link in transmute docs
Matt Brubeck [Fri, 25 May 2018 18:47:48 +0000 (11:47 -0700)]
Update nomicon link in transmute docs

The list of "invalid primitive values" has moved to a different URL
within the Rustonomicon.

6 years ago--bless the tests
varkor [Fri, 25 May 2018 16:31:45 +0000 (17:31 +0100)]
--bless the tests

6 years agoAdd a test for returning inside a while loop
varkor [Fri, 25 May 2018 14:31:13 +0000 (15:31 +0100)]
Add a test for returning inside a while loop

6 years agoFix behaviour of divergence in while loop conditions
varkor [Thu, 24 May 2018 22:27:36 +0000 (23:27 +0100)]
Fix behaviour of divergence in while loop conditions

This fixes `'a: while break 'a {};` being treated as diverging, by tracking break expressions in the same way as in `loop` expressions.

6 years agoDon't use a char that's already used within the expr
Jaro Fietz [Fri, 25 May 2018 14:55:38 +0000 (16:55 +0200)]
Don't use a char that's already used within the expr

6 years agoCall it
Jaro Fietz [Fri, 25 May 2018 14:50:59 +0000 (16:50 +0200)]
Call it

6 years agoWhat does an expression look like, that consists only of special characters?
Jaro Fietz [Fri, 25 May 2018 14:48:55 +0000 (16:48 +0200)]
What does an expression look like, that consists only of special characters?

6 years agoAuto merge of #50967 - oli-obk:miri_api_refactor, r=eddyb
bors [Fri, 25 May 2018 13:59:48 +0000 (13:59 +0000)]
Auto merge of #50967 - oli-obk:miri_api_refactor, r=eddyb

Miri api refactor

r? @eddyb

cc @Zoxc

based on https://github.com/rust-lang/rust/pull/50916

6 years agoImplement outlives requirements inference for dyn and projections.
toidiu [Thu, 19 Apr 2018 02:26:21 +0000 (22:26 -0400)]
Implement outlives requirements inference for dyn and projections.
Add tests, documentation and attr for feature.

6 years agoAdjust test for 32 bit targets
Oliver Schneider [Fri, 25 May 2018 13:13:54 +0000 (15:13 +0200)]
Adjust test for 32 bit targets

6 years agorust-lang/rust#51025: improve test robustness so that they work under NLL too.
Felix S. Klock II [Fri, 25 May 2018 10:36:58 +0000 (12:36 +0200)]
rust-lang/rust#51025: improve test robustness so that they work under NLL too.

6 years agoSanity abort `to_bits` if used on zsts
Oliver Schneider [Fri, 25 May 2018 09:56:33 +0000 (11:56 +0200)]
Sanity abort `to_bits` if used on zsts

6 years agoAuto merge of #51051 - nikomatsakis:turbofish-impl-trait-method, r=eddyb
bors [Fri, 25 May 2018 09:01:11 +0000 (09:01 +0000)]
Auto merge of #51051 - nikomatsakis:turbofish-impl-trait-method, r=eddyb

prohibit turbofish in `impl Trait` methods

Fix #50950

6 years agopacify the mercilous tidy
Niko Matsakis [Fri, 25 May 2018 08:46:42 +0000 (04:46 -0400)]
pacify the mercilous tidy

6 years agoUpdate comment
Oliver Schneider [Fri, 25 May 2018 08:18:57 +0000 (10:18 +0200)]
Update comment

6 years agoAuto merge of #50998 - bobtwinkles:nll_facts_invalidate_followup, r=nikomatsakis
bors [Fri, 25 May 2018 06:26:26 +0000 (06:26 +0000)]
Auto merge of #50998 - bobtwinkles:nll_facts_invalidate_followup, r=nikomatsakis

NLL facts invalidate followup

Refactors to share code with the rest of borrow-check.

r? @nikomatsakis

6 years agoAuto merge of #50986 - estebank:main-start-span, r=nikomatsakis
bors [Fri, 25 May 2018 03:46:14 +0000 (03:46 +0000)]
Auto merge of #50986 - estebank:main-start-span, r=nikomatsakis

Tweak `main` type arguments and where clause spans

Tweak the spans for error when finding type arguments or where clauses
in main and start functions.