]> git.lizzy.rs Git - rust.git/log
rust.git
5 years agoAuto merge of #54813 - petrochenkov:uilocale, r=alexcrichton
bors [Sun, 7 Oct 2018 11:10:39 +0000 (11:10 +0000)]
Auto merge of #54813 - petrochenkov:uilocale, r=alexcrichton

Fix two UI tests with locale-dependent output

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

5 years agoAuto merge of #54823 - euclio:needs-test, r=alexcrichton
bors [Sun, 7 Oct 2018 08:32:19 +0000 (08:32 +0000)]
Auto merge of #54823 - euclio:needs-test, r=alexcrichton

Add tests for some E-needstest issues

Fixes #28134.
Fixes #24338.
Fixes #29743.

5 years agoAuto merge of #54451 - alexcrichton:no-mangle-extern-linkage, r=michaelwoerister
bors [Sun, 7 Oct 2018 03:07:16 +0000 (03:07 +0000)]
Auto merge of #54451 - alexcrichton:no-mangle-extern-linkage, r=michaelwoerister

rustc: Allow `#[no_mangle]` anywhere in a crate

This commit updates the compiler to allow the `#[no_mangle]` (and
`#[export_name]` attributes) to be located anywhere within a crate.
These attributes are unconditionally processed, causing the compiler to
always generate an exported symbol with the appropriate name.

After some discussion on #54135 it was found that not a great reason
this hasn't been allowed already, and it seems to match the behavior
that many expect! Previously the compiler would only export a
`#[no_mangle]` symbol if it were *publicly reachable*, meaning that it
itself is `pub` and it's otherwise publicly reachable from the root of
the crate. This new definition is that `#[no_mangle]` *is always
reachable*, no matter where it is in a crate or whether it has `pub` or
not.

This should make it much easier to declare an exported symbol with a
known and unique name, even when it's an internal implementation detail
of the crate itself. Note that these symbols will persist beyond LTO as
well, always making their way to the linker.

Along the way this commit removes the `private_no_mangle_functions` lint
(also for statics) as there's no longer any need to lint these
situations. Furthermore a good number of tests were updated now that
symbol visibility has been changed.

Closes #54135

5 years agoAuto merge of #54782 - pnkfelix:issue-54556-semi-on-tail-diagnostic, r=nikomatsakis
bors [Sun, 7 Oct 2018 00:28:26 +0000 (00:28 +0000)]
Auto merge of #54782 - pnkfelix:issue-54556-semi-on-tail-diagnostic, r=nikomatsakis

NLL: temps in block tail expression diagnostic

This change adds a diagnostic that explains when temporaries in a block tail expression live longer than block local variables that they borrow, and attempts to suggest turning the tail expresion into a statement (either by adding a semicolon at the end, when its result value is clearly unused, or by introducing a `let`-binding for the result value and then returning that).

Fix #54556

5 years agorustc: Allow `#[no_mangle]` anywhere in a crate
Alex Crichton [Fri, 21 Sep 2018 22:58:11 +0000 (15:58 -0700)]
rustc: Allow `#[no_mangle]` anywhere in a crate

This commit updates the compiler to allow the `#[no_mangle]` (and
`#[export_name]` attributes) to be located anywhere within a crate.
These attributes are unconditionally processed, causing the compiler to
always generate an exported symbol with the appropriate name.

After some discussion on #54135 it was found that not a great reason
this hasn't been allowed already, and it seems to match the behavior
that many expect! Previously the compiler would only export a
`#[no_mangle]` symbol if it were *publicly reachable*, meaning that it
itself is `pub` and it's otherwise publicly reachable from the root of
the crate. This new definition is that `#[no_mangle]` *is always
reachable*, no matter where it is in a crate or whether it has `pub` or
not.

This should make it much easier to declare an exported symbol with a
known and unique name, even when it's an internal implementation detail
of the crate itself. Note that these symbols will persist beyond LTO as
well, always making their way to the linker.

Along the way this commit removes the `private_no_mangle_functions` lint
(also for statics) as there's no longer any need to lint these
situations. Furthermore a good number of tests were updated now that
symbol visibility has been changed.

Closes #54135

5 years agoAuto merge of #54756 - ljedrz:cleanup_middle, r=michaelwoerister
bors [Sat, 6 Oct 2018 20:04:18 +0000 (20:04 +0000)]
Auto merge of #54756 - ljedrz:cleanup_middle, r=michaelwoerister

Cleanup rustc/middle

- improve allocations
- use `Cow<'static, str>` where applicable
- improve some patterns
- whitespace & formatting fixes

5 years agoAuto merge of #54854 - matthiaskrgr:clippy_update, r=Manishearth
bors [Sat, 6 Oct 2018 15:40:13 +0000 (15:40 +0000)]
Auto merge of #54854 - matthiaskrgr:clippy_update, r=Manishearth

 submodules: update clippy to 22d37b53af5b to fix tests.

Should fix clippy toolstate.

5 years agoAuto merge of #54766 - alexcrichton:wasm-all-symbols, r=michaelwoerister
bors [Sat, 6 Oct 2018 10:44:11 +0000 (10:44 +0000)]
Auto merge of #54766 - alexcrichton:wasm-all-symbols, r=michaelwoerister

wasm: Explicitly export all symbols with LLD

This commit fixes an oddity on the wasm target where LTO can produce
working executables but plain old optimizations doesn't. The compiler
already knows what set of symbols it would like to export, but LLD only
discovers this list transitively through symbol visibilities. LLD may
not, however, always find all the symbols that we'd like to export.

For example if you depend on an rlib with a `#[no_mangle]` symbol, then
if you don't actually use anything from the rlib then the symbol won't
appear in the final artifact! It will appear, however, with LTO. This
commit attempts to rectify this situation by ensuring that all symbols
rustc would otherwise preserve through LTO are also preserved through
the linking process with LLD by default.

5 years agorustc/middle: whitespace & formatting fixes
ljedrz [Tue, 2 Oct 2018 16:29:48 +0000 (18:29 +0200)]
rustc/middle: whitespace & formatting fixes

5 years agorustc/middle: improve allocations
ljedrz [Tue, 2 Oct 2018 16:21:39 +0000 (18:21 +0200)]
rustc/middle: improve allocations

5 years agorustc/middle: use Cow<'static, str> where applicable
ljedrz [Tue, 2 Oct 2018 16:16:01 +0000 (18:16 +0200)]
rustc/middle: use Cow<'static, str> where applicable

5 years agorustc/middle: improve some patterns
ljedrz [Tue, 2 Oct 2018 16:05:06 +0000 (18:05 +0200)]
rustc/middle: improve some patterns

5 years agosubmodules: update clippy to 32b1d1fc157f71ed2f10b60fe28abe087a743618 to fix tests.
Matthias Krüger [Fri, 5 Oct 2018 16:46:40 +0000 (18:46 +0200)]
submodules: update clippy to 32b1d1fc157f71ed2f10b60fe28abe087a743618 to fix tests.

5 years agoAuto merge of #54859 - pietroalbini:rollup, r=pietroalbini
bors [Sat, 6 Oct 2018 00:44:11 +0000 (00:44 +0000)]
Auto merge of #54859 - pietroalbini:rollup, r=pietroalbini

Rollup of 11 pull requests

Successful merges:

 - #54078 (Expand the documentation for the `std::sync` module)
 - #54717 (Cleanup rustc/ty part 1)
 - #54781 (Add examples to `TyKind::FnDef` and `TyKind::FnPtr` docs)
 - #54787 (Only warn about unused `mut` in user-written code)
 - #54804 (add suggestion for inverted function parameters)
 - #54812 (Regression test for #32382.)
 - #54833 (make `Parser::parse_foreign_item()` return a foreign item or error)
 - #54834 (rustdoc: overflow:auto doesn't work nicely on small screens)
 - #54838 (Fix typo in src/libsyntax/parse/parser.rs)
 - #54851 (Fix a regression in 1.30 by reverting #53564)
 - #54853 (Remove unneccessary error from test, revealing NLL error.)

Failed merges:

r? @ghost

5 years agoRollup merge of #54853 - davidtwco:issue-52663-missing-lifetime-suggestion-test,...
Pietro Albini [Fri, 5 Oct 2018 20:33:22 +0000 (22:33 +0200)]
Rollup merge of #54853 - davidtwco:issue-52663-missing-lifetime-suggestion-test, r=nikomatsakis

Remove unneccessary error from test, revealing NLL error.

Part of #52663.

Removes unnecessary type mismatch error from test that was hiding
borrow check error from NLL stderr.

r? @nikomatsakis

5 years agoRollup merge of #54851 - alexcrichton:revert-optimize, r=sfackler
Pietro Albini [Fri, 5 Oct 2018 20:33:21 +0000 (22:33 +0200)]
Rollup merge of #54851 - alexcrichton:revert-optimize, r=sfackler

Fix a regression in 1.30 by reverting #53564

Investigation on #54477 revealed https://github.com/rust-lang/rust/pull/53564 as the culprit in the regression for that crate. I've reproduced the regression with the [detailed test cases provided](https://github.com/rust-lang/rust/issues/54477#issuecomment-427398456). While we figure out how to fix the regression this commit reverts the current culprit.

5 years agoRollup merge of #54838 - 11Takanori:fix-typo, r=petrochenkov
Pietro Albini [Fri, 5 Oct 2018 20:33:19 +0000 (22:33 +0200)]
Rollup merge of #54838 - 11Takanori:fix-typo, r=petrochenkov

Fix typo in src/libsyntax/parse/parser.rs

contast -> contrast

5 years agoRollup merge of #54834 - kzys:fix-small-screen, r=GuillaumeGomez
Pietro Albini [Fri, 5 Oct 2018 20:33:18 +0000 (22:33 +0200)]
Rollup merge of #54834 - kzys:fix-small-screen, r=GuillaumeGomez

rustdoc: overflow:auto doesn't work nicely on small screens

This property was introduced by 3f92ff34b5, but looks it doesn't
overwrap even without the property.

Fixes #54672.

5 years agoRollup merge of #54833 - abonander:issue-54441, r=petrochenkov
Pietro Albini [Fri, 5 Oct 2018 20:33:17 +0000 (22:33 +0200)]
Rollup merge of #54833 - abonander:issue-54441, r=petrochenkov

make `Parser::parse_foreign_item()` return a foreign item or error

Fixes `Parser::parse_foreign_item()` to follow the convention of `parse_trait_item()` and `parse_impl_item()` in that it *must* parse an item or return an error, and then the caller is responsible for detecting the closing delimiter.

This prevents it from looping endlessly on an unexpected token in `ext/expand.rs` where it was also leaking memory by continually pushing to `Parser::expected_tokens` via `Parser::check_keyword()`.

closes #54441

r? @petrochenkov
cc @dtolnay

5 years agoRollup merge of #54812 - pnkfelix:issue-32382-index-assoc-type-with-lifetime, r=nikom...
Pietro Albini [Fri, 5 Oct 2018 20:33:16 +0000 (22:33 +0200)]
Rollup merge of #54812 - pnkfelix:issue-32382-index-assoc-type-with-lifetime, r=nikomatsakis

Regression test for #32382.

5 years agoRollup merge of #54804 - euclio:inverted-parameters, r=estebank
Pietro Albini [Fri, 5 Oct 2018 20:33:15 +0000 (22:33 +0200)]
Rollup merge of #54804 - euclio:inverted-parameters, r=estebank

add suggestion for inverted function parameters

Fixes #54065.

5 years agoRollup merge of #54787 - varkor:unused-mut-in-desugaring, r=nikomatsakis
Pietro Albini [Fri, 5 Oct 2018 20:33:13 +0000 (22:33 +0200)]
Rollup merge of #54787 - varkor:unused-mut-in-desugaring, r=nikomatsakis

Only warn about unused `mut` in user-written code

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

r? @pnkfelix
cc @blitzerr

5 years agoRollup merge of #54781 - phansch:master, r=varkor
Pietro Albini [Fri, 5 Oct 2018 20:33:12 +0000 (22:33 +0200)]
Rollup merge of #54781 - phansch:master, r=varkor

Add examples to `TyKind::FnDef` and `TyKind::FnPtr` docs

This adds two examples to the docs of `TyKind::FnDef` and `TyKind::FnPtr`.

I found these two types a bit confusing when I learned about them and I think adding these examples might help others.

5 years agoRollup merge of #54717 - ljedrz:cleanup_ty_p1, r=davidtwco
Pietro Albini [Fri, 5 Oct 2018 20:33:11 +0000 (22:33 +0200)]
Rollup merge of #54717 - ljedrz:cleanup_ty_p1, r=davidtwco

Cleanup rustc/ty part 1

Part 2 will follow soon; I wouldn't want these changes to rot too quickly.

- improve stack shifting and remove related allocations
- move a faster early return up
- improve allocations
- use Cow<str> where applicable
- simplify common patterns
- whitespace fixes

5 years agoRollup merge of #54078 - GabrielMajeri:expand-sync-docs, r=steveklabnik
Pietro Albini [Fri, 5 Oct 2018 20:33:10 +0000 (22:33 +0200)]
Rollup merge of #54078 - GabrielMajeri:expand-sync-docs, r=steveklabnik

Expand the documentation for the `std::sync` module

I've tried to expand the documentation for Rust's synchronization primitives. The module level documentation explains why synchronization is required when working with a multiprocessor system,
and then links to the appropiate structure in this module.

Fixes #29377, since this should be the last item on the checklist (documentation for `Atomic*` was fixed in #44854, but not ticked off the checklist).

5 years agoAuto merge of #54743 - ljedrz:cleanup_ty_p2, r=zackmdavis
bors [Fri, 5 Oct 2018 19:32:14 +0000 (19:32 +0000)]
Auto merge of #54743 - ljedrz:cleanup_ty_p2, r=zackmdavis

Cleanup rustc/ty part 2

The second part of cleanups and minor improvements for rustc/ty.
- improve allocations
- calculate span after a possible early continue
- simplify some patterns
- mark a comment as FIXME
- whitespace fixes

The PR is independent from from the first part.

5 years agoSimplify test.
David Wood [Fri, 5 Oct 2018 16:35:23 +0000 (18:35 +0200)]
Simplify test.

Removes unnecessary type mismatch error from test that was hiding
borrow check error from NLL stderr.

5 years agoRevert "Slightly refactor VecDeque implementation"
Alex Crichton [Fri, 5 Oct 2018 16:15:57 +0000 (09:15 -0700)]
Revert "Slightly refactor VecDeque implementation"

This reverts commit 6ce76acae455a32113116cd2f95f8076388fc2d3.

5 years agoRevert "Optimize VecDeque::append"
Alex Crichton [Fri, 5 Oct 2018 16:15:52 +0000 (09:15 -0700)]
Revert "Optimize VecDeque::append"

This reverts commit 11e488b64fed181820280d494d4fcc157ee1adc5.

5 years agoRevert "Add docs and debug asserts"
Alex Crichton [Fri, 5 Oct 2018 16:15:48 +0000 (09:15 -0700)]
Revert "Add docs and debug asserts"

This reverts commit 1a1a7f6167edf18b8a0ab488e651f7748cc2e9d3.

5 years agoRevert "Fix tidy"
Alex Crichton [Fri, 5 Oct 2018 16:15:44 +0000 (09:15 -0700)]
Revert "Fix tidy"

This reverts commit 1908892d3f60008f265dfc25ac46db387c0ad6a0.

5 years agoRevert "Add another assert"
Alex Crichton [Fri, 5 Oct 2018 16:15:39 +0000 (09:15 -0700)]
Revert "Add another assert"

This reverts commit 21d2a6c9868541ec9829ced9a5bae936b18741c5.

5 years agoAuto merge of #54741 - oli-obk:impl_trait_hierarchy, r=cramertj
bors [Fri, 5 Oct 2018 15:32:19 +0000 (15:32 +0000)]
Auto merge of #54741 - oli-obk:impl_trait_hierarchy, r=cramertj

Nest the `impl Trait` existential item inside the return type

fixes #54045

r? @cramertj

5 years agoadd suggestion for inverted function parameters
Andy Russell [Thu, 4 Oct 2018 02:21:05 +0000 (22:21 -0400)]
add suggestion for inverted function parameters

Fixes #54065.

5 years agoAuto merge of #54336 - petrochenkov:preuni, r=alexcrichton
bors [Fri, 5 Oct 2018 12:52:53 +0000 (12:52 +0000)]
Auto merge of #54336 - petrochenkov:preuni, r=alexcrichton

resolve: Some refactorings in preparation for uniform paths 2.0

The main result is that in-scope resolution performed during macro expansion / import resolution is now consolidated in a single function (`fn early_resolve_ident_in_lexical_scope`), which can now be used for resolving first import segments as well when uniform paths are enabled.

r? @ghost

5 years agoAdd doc comment explaining what `BlockTailInfo` is.
Felix S. Klock II [Fri, 5 Oct 2018 10:26:29 +0000 (12:26 +0200)]
Add doc comment explaining what `BlockTailInfo` is.

5 years agoAuto merge of #52121 - jebrosen:macros2_feature, r=petrochenkov
bors [Fri, 5 Oct 2018 10:08:01 +0000 (10:08 +0000)]
Auto merge of #52121 - jebrosen:macros2_feature, r=petrochenkov

Merge `proc_macro_` expansion feature gates as `proc_macro_hygiene`

Merges `proc_macro_mod`, `proc_macro_expr`, `proc_macro_non_items`, and `proc_macro_gen` into a single feature: `proc_macro_hygiene`. These features are not all blocked on implementing macro hygiene *per se*, but rather on interactions with hygiene that have not been entirely resolved.

5 years agoUnit tests for issue #54556. Some were also taken from issues #21114, #46413.
Felix S. Klock II [Wed, 3 Oct 2018 15:47:23 +0000 (17:47 +0200)]
Unit tests for issue #54556. Some were also taken from issues #21114, #46413.

5 years agoUpdates to .stderr output in ui tests from earlier changes.
Felix S. Klock II [Sat, 29 Sep 2018 21:30:43 +0000 (23:30 +0200)]
Updates to .stderr output in ui tests from earlier changes.

5 years agoImprove diagnostics for borrow-check errors that result from drops of temporary r...
Felix S. Klock II [Fri, 28 Sep 2018 13:25:02 +0000 (15:25 +0200)]
Improve diagnostics for borrow-check errors that result from drops of temporary r-values.

Changed `BorrowExplanation::UsedLaterWhenDropped` to handle both named
locals and also unnamed (aka temporaries).

If the dropped temporary does not implement `Drop`, then we print its
full type; but when the dropped temporary is itself an ADT `D` that
implements `Drop`, then diagnostic points the user directly at `D`.

5 years agoReplaced `String` with `&str` in API for `add_explanation_to_diagnostic`.
Felix S. Klock II [Fri, 5 Oct 2018 09:00:05 +0000 (11:00 +0200)]
Replaced `String` with `&str` in API for `add_explanation_to_diagnostic`.

5 years agomake `Parser::parse_foreign_item()` return a foreign item or error
Austin Bonander [Wed, 3 Oct 2018 21:24:31 +0000 (14:24 -0700)]
make `Parser::parse_foreign_item()` return a foreign item or error

closes #54441

5 years agocontast -> contrast
Takanori Ishibashi [Fri, 5 Oct 2018 09:47:37 +0000 (18:47 +0900)]
contast -> contrast

5 years agoHave `add_explanation_to_diagnostic` also take `Mir` as parameter.
Felix S. Klock II [Fri, 28 Sep 2018 10:23:40 +0000 (12:23 +0200)]
Have `add_explanation_to_diagnostic` also take `Mir` as parameter.

This is preparation for allowing the `BorrowExplanation` carry things
like `mir::Location` or `mir::Local` and still be able to generate
usable diagnostic text.

5 years agoAlpha-rename `BorrowExplanation::emit` to `BorrowExplanation::add_explanation_to_diag...
Felix S. Klock II [Fri, 28 Sep 2018 10:19:28 +0000 (12:19 +0200)]
Alpha-rename `BorrowExplanation::emit` to `BorrowExplanation::add_explanation_to_diagnostic`.

(I found it confusing to have calls to an `emit` method in our
error_reporting module where that `emit` method *wasn't* the
`DiagnosticBuffer::emit` method.)

5 years agoFix `debug!` to reflect rename of `explain_why_borrow_contains_point`.
Felix S. Klock II [Fri, 28 Sep 2018 09:50:26 +0000 (11:50 +0200)]
Fix `debug!` to reflect rename of `explain_why_borrow_contains_point`.

5 years agoUpdate doc for `explain_why_borrow_contains_point` to reflect its newer API.
Felix S. Klock II [Fri, 28 Sep 2018 09:50:05 +0000 (11:50 +0200)]
Update doc for `explain_why_borrow_contains_point` to reflect its newer API.

5 years agoAdd flag to `mir::LocalDecl` to track whether its a temp from some subexpr a block...
Felix S. Klock II [Fri, 21 Sep 2018 22:51:48 +0000 (00:51 +0200)]
Add flag to `mir::LocalDecl` to track whether its a temp from some subexpr a block tail expression.

Slightly refactored the `LocalDecl` construction API in the process.

5 years agoReapply the macro_rules disambiguation changes from master
Vadim Petrochenkov [Thu, 4 Oct 2018 10:41:58 +0000 (14:41 +0400)]
Reapply the macro_rules disambiguation changes from master

5 years agoReapply the derive helper changes from master
Vadim Petrochenkov [Wed, 26 Sep 2018 10:11:34 +0000 (13:11 +0300)]
Reapply the derive helper changes from master

5 years agoexpansion: Remove restriction on use of macro attributes with test/bench
Vadim Petrochenkov [Tue, 18 Sep 2018 22:46:18 +0000 (01:46 +0300)]
expansion: Remove restriction on use of macro attributes with test/bench

The restrictions were introduced in https://github.com/rust-lang/rust/pull/54277 and no longer necessary now because legacy plugins are now expanded in usual left-to-right order

5 years agoresolve: Keep more precise traces for expanded macro resolutions
Vadim Petrochenkov [Tue, 18 Sep 2018 22:01:09 +0000 (01:01 +0300)]
resolve: Keep more precise traces for expanded macro resolutions

`NameBinding`s instead of `Def`s

5 years agoresolve: Merge resolution for `macro_rules` into the common early in-scope resolution...
Vadim Petrochenkov [Tue, 18 Sep 2018 00:19:26 +0000 (03:19 +0300)]
resolve: Merge resolution for `macro_rules` into the common early in-scope resolution function

`fn resolve_legacy_scope`/`fn resolve_lexical_macro_path_segment` -> `fn early_resolve_ident_in_lexical_scope`

5 years agoAuto merge of #54703 - davidtwco:issue-52086, r=nikomatsakis
bors [Fri, 5 Oct 2018 07:40:36 +0000 (07:40 +0000)]
Auto merge of #54703 - davidtwco:issue-52086, r=nikomatsakis

error message when trying to move from an Rc or Arc is ungreat

Fixes #52086.

r? @nikomatsakis

5 years agoresolve: Support value namespace in `fn resolve_lexical_macro_path_segment`
Vadim Petrochenkov [Sun, 16 Sep 2018 22:56:15 +0000 (01:56 +0300)]
resolve: Support value namespace in `fn resolve_lexical_macro_path_segment`

5 years agoexpansion: Expand attribute macros registered by legacy plugins in usual left-to...
Vadim Petrochenkov [Sat, 15 Sep 2018 20:57:07 +0000 (23:57 +0300)]
expansion: Expand attribute macros registered by legacy plugins in usual left-to-right order

5 years agoresolve: Integrate inert attributes registererd by legacy plugins into macro resolution
Vadim Petrochenkov [Sat, 15 Sep 2018 20:46:54 +0000 (23:46 +0300)]
resolve: Integrate inert attributes registererd by legacy plugins into macro resolution

5 years agoFix two UI tests with locale-dependent output
Vadim Petrochenkov [Thu, 4 Oct 2018 13:31:35 +0000 (17:31 +0400)]
Fix two UI tests with locale-dependent output

5 years agorustc/ty: improve stack shifting and remove related allocations
ljedrz [Mon, 1 Oct 2018 13:47:47 +0000 (15:47 +0200)]
rustc/ty: improve stack shifting and remove related allocations

5 years agorustc/ty: move a faster early return up
ljedrz [Mon, 1 Oct 2018 13:44:23 +0000 (15:44 +0200)]
rustc/ty: move a faster early return up

5 years agorustc/ty: improve allocations
ljedrz [Mon, 1 Oct 2018 13:39:17 +0000 (15:39 +0200)]
rustc/ty: improve allocations

5 years agorustc/ty: simplify common patterns
ljedrz [Mon, 1 Oct 2018 13:37:14 +0000 (15:37 +0200)]
rustc/ty: simplify common patterns

5 years agorustc/ty: use Cow<str> where applicable
ljedrz [Mon, 1 Oct 2018 13:31:27 +0000 (15:31 +0200)]
rustc/ty: use Cow<str> where applicable

5 years agorustc/ty: whitespace fixes
ljedrz [Mon, 1 Oct 2018 13:26:53 +0000 (15:26 +0200)]
rustc/ty: whitespace fixes

5 years agoAddress review comments
Gabriel Majeri [Fri, 5 Oct 2018 05:50:17 +0000 (08:50 +0300)]
Address review comments

5 years agorustdoc: overflow:auto doesn't work nicely on small screens
Kazuyoshi Kato [Fri, 5 Oct 2018 04:31:16 +0000 (21:31 -0700)]
rustdoc: overflow:auto doesn't work nicely on small screens

This property was introduced by 3f92ff34b5, but looks it doesn't
overwrap even without the property.

Fixes #54672.

5 years agoAuto merge of #54017 - alexcrichton:wasm-atomics2, r=sfackler
bors [Fri, 5 Oct 2018 01:57:01 +0000 (01:57 +0000)]
Auto merge of #54017 - alexcrichton:wasm-atomics2, r=sfackler

std: Start implementing wasm32 atomics

This commit is an initial start at implementing the standard library for
wasm32-unknown-unknown with the experimental `atomics` feature enabled. None of
these changes will be visible to users of the wasm32-unknown-unknown target
because they all require recompiling the standard library. The hope with this is
that we can get this support into the standard library and start iterating on it
in-tree to enable experimentation.

Currently there's a few components in this PR:

* Atomic fences are disabled on wasm as there's no corresponding atomic op and
  it's not clear yet what the convention should be, but this will change in the
  future!
* Implementations of `Mutex`, `Condvar`, and `RwLock` were all added based on
  the atomic intrinsics that wasm has.
* The `ReentrantMutex` and thread-local-storage implementations panic currently
  as there's no great way to get a handle on the current thread's "id" yet.

Right now the wasm32 target with atomics is unfortunately pretty unusable,
requiring a lot of manual things here and there to actually get it operational.
This will likely continue to evolve as the story for atomics and wasm unfolds,
but we also need more LLVM support for some operations like custom `global`
directives for this to work best.

5 years agoAuto merge of #54649 - nikomatsakis:universes-refactor-1, r=scalexm
bors [Thu, 4 Oct 2018 20:28:57 +0000 (20:28 +0000)]
Auto merge of #54649 - nikomatsakis:universes-refactor-1, r=scalexm

adopt "placeholders" to represent universally quantified regions

This does a few preliminary refactorings that lay some groundwork for moving towards universe integration. Two things, primarily:

- Rename from "skolemized" to "placeholder"
- When instantiating `for<'a, 'b, 'c>`, just create one universe for all 3 regions, and distinguish them from one another using the `BoundRegion`.
    - This is more accurate, and I think that in general we'll be moving towards a model of separating "binder" (universe, debruijn index) from "index within binder" in a number of places.
    - In principle, it feels the current setup of making lots of universes could lead to us doing the wrong thing, but I've actually not been able to come up with an example where this is so.

r? @scalexm
cc @arielb1

5 years agoadd test for #29743
Andy Russell [Thu, 4 Oct 2018 19:50:23 +0000 (15:50 -0400)]
add test for #29743

5 years agoadd test for #24338
Andy Russell [Thu, 4 Oct 2018 19:50:01 +0000 (15:50 -0400)]
add test for #24338

5 years agoadd test for #28134
Andy Russell [Thu, 4 Oct 2018 19:49:29 +0000 (15:49 -0400)]
add test for #28134

5 years agoFurther improve docs for `FnDef` and `FnPtr`
Philipp Hansch [Thu, 4 Oct 2018 18:27:53 +0000 (20:27 +0200)]
Further improve docs for `FnDef` and `FnPtr`

5 years agoAuto merge of #54666 - matthewjasper:mir-function-spans, r=pnkfelix
bors [Thu, 4 Oct 2018 16:34:27 +0000 (16:34 +0000)]
Auto merge of #54666 - matthewjasper:mir-function-spans, r=pnkfelix

[NLL] Improve "borrow later used here" messages

* In the case of two conflicting borrows, the later used message says which borrow it's referring to
* If the later use is a function call (from the users point of view) say that the later use is for the call. Point just to the function.

r? @pnkfelix
Closes #48643

5 years agos/skol_predicate/placeholder_predicate
Niko Matsakis [Wed, 3 Oct 2018 00:10:40 +0000 (20:10 -0400)]
s/skol_predicate/placeholder_predicate

5 years agofix typo: s/tained/tainted/
Niko Matsakis [Wed, 3 Oct 2018 00:10:16 +0000 (20:10 -0400)]
fix typo: s/tained/tainted/

5 years agoremove occurences of `skolemization`
Niko Matsakis [Wed, 3 Oct 2018 00:09:32 +0000 (20:09 -0400)]
remove occurences of `skolemization`

5 years agoremove all occurences of `skolemize`
Niko Matsakis [Tue, 2 Oct 2018 20:50:20 +0000 (16:50 -0400)]
remove all occurences of `skolemize`

5 years agobuild up the placeholder indices as we go
Niko Matsakis [Fri, 28 Sep 2018 18:35:43 +0000 (14:35 -0400)]
build up the placeholder indices as we go

Avoids a linear walk over the regions at the end.

5 years agoextend NLL universe code to have >1 placeholder within one universe
Niko Matsakis [Thu, 27 Sep 2018 21:57:35 +0000 (17:57 -0400)]
extend NLL universe code to have >1 placeholder within one universe

5 years agocreate just one subuniverse per binder -- no need for more, really
Niko Matsakis [Fri, 7 Sep 2018 20:58:35 +0000 (16:58 -0400)]
create just one subuniverse per binder -- no need for more, really

5 years agoreorder the placeholders and inference variables in hr::sub
Niko Matsakis [Fri, 7 Sep 2018 14:00:01 +0000 (10:00 -0400)]
reorder the placeholders and inference variables in hr::sub

5 years agorename skolemized to placeholder
Niko Matsakis [Fri, 7 Sep 2018 13:46:53 +0000 (09:46 -0400)]
rename skolemized to placeholder

5 years agoselect.rs: rustfmt
Niko Matsakis [Fri, 7 Sep 2018 13:34:09 +0000 (09:34 -0400)]
select.rs: rustfmt

5 years agoAuto merge of #54784 - Manishearth:clippyup, r=oli-obk
bors [Thu, 4 Oct 2018 14:08:12 +0000 (14:08 +0000)]
Auto merge of #54784 - Manishearth:clippyup, r=oli-obk

Update clippy

None

5 years agoIgnore desugarings when comparing duplicate trait error messages
varkor [Thu, 4 Oct 2018 13:48:32 +0000 (14:48 +0100)]
Ignore desugarings when comparing duplicate trait error messages

5 years agoAuto merge of #54809 - pietroalbini:rollup, r=pietroalbini
bors [Thu, 4 Oct 2018 11:39:50 +0000 (11:39 +0000)]
Auto merge of #54809 - pietroalbini:rollup, r=pietroalbini

Rollup of 10 pull requests

Successful merges:

 - #53523 (Add doc for impl From for Std Error)
 - #54746 (simplify some unused lints code)
 - #54761 (Make spec_extend use for_each())
 - #54769 (Fix typo in CONTRIBUTING.md)
 - #54773 (Update a FIXME in memory.rs)
 - #54777 (abolish ICE when pretty-printing async block)
 - #54780 (Remove duplicate predicates in `explicit_predicates_of`)
 - #54788 (A handful of cleanups for rustc/mir)
 - #54789 (Introduce `TyKind::UnnormalizedProjection`)
 - #54795 (remove padding from multiline format string label)

Failed merges:

r? @ghost

5 years agoRegression test for #32382.
Felix S. Klock II [Thu, 4 Oct 2018 11:03:24 +0000 (13:03 +0200)]
Regression test for #32382.

5 years agoUpdate Cargo.lock
Oliver Schneider [Thu, 4 Oct 2018 10:51:58 +0000 (12:51 +0200)]
Update Cargo.lock

5 years agoAdd features to the workspace hack
Oliver S̶c̶h̶n̶e̶i̶d̶e̶r Scherer [Thu, 4 Oct 2018 10:40:04 +0000 (12:40 +0200)]
Add features to the workspace hack

5 years agoRollup merge of #54795 - euclio:ifmt-bad-arg, r=estebank
Pietro Albini [Thu, 4 Oct 2018 10:20:17 +0000 (12:20 +0200)]
Rollup merge of #54795 - euclio:ifmt-bad-arg, r=estebank

remove padding from multiline format string label

Fixes #53836.

5 years agoRollup merge of #54789 - scalexm:unnormalized, r=nikomatsakis
Pietro Albini [Thu, 4 Oct 2018 10:20:16 +0000 (12:20 +0200)]
Rollup merge of #54789 - scalexm:unnormalized, r=nikomatsakis

Introduce `TyKind::UnnormalizedProjection`

Introduce a new variant used for lazy normalization in chalk integration. Mostly `bug!` everywhere.

r? @nikomatsakis

5 years agoRollup merge of #54788 - ljedrz:cleanup_rustc_mir, r=oli-obk
Pietro Albini [Thu, 4 Oct 2018 10:20:15 +0000 (12:20 +0200)]
Rollup merge of #54788 - ljedrz:cleanup_rustc_mir, r=oli-obk

A handful of cleanups for rustc/mir

- use the "regular" `into()` instead of `graphviz::IntoCow` in `mod.rs`
- `format!("{}", x)` > `x.to_string()`
- remove one unnecessary `String` allocation
- shorten the logic of one loop
- `assert!(x == y)` > `assert_eq!(x, y)`
- whitespace & formatting fixes

r? @oli-obk

5 years agoRollup merge of #54780 - scalexm:dup-predicates, r=nikomatsakis
Pietro Albini [Thu, 4 Oct 2018 10:20:13 +0000 (12:20 +0200)]
Rollup merge of #54780 - scalexm:dup-predicates, r=nikomatsakis

Remove duplicate predicates in `explicit_predicates_of`

I took a more brutal approach than described in #52187. I could have used the `linked_hash_map` crate but this seems overkill, especially as we need a vec storage in the end.

r? @nikomatsakis

5 years agoRollup merge of #54777 - zackmdavis:async_pretty_ice, r=cramertj
Pietro Albini [Thu, 4 Oct 2018 10:20:12 +0000 (12:20 +0200)]
Rollup merge of #54777 - zackmdavis:async_pretty_ice, r=cramertj

abolish ICE when pretty-printing async block

@jnetterf reported an ICE when the unused-parentheses lint triggered around an async block (#54752). In order to compose an autofixable suggestion, the lint invokes the pretty-printer on the unnecessarily-parenthesized expression. (One wonders why the lint doesn't just use `SourceMap::span_to_snippet` instead, to preserve the formatting of the original source?—but to answer that, you'd have to ask the author of 5c9f806d.)

But then the pretty-printer panics when trying to call `<pprust::State as PrintState>::end` when `State.boxes` is empty. Empirically, the problem would seem to be solved if we start some "boxes" beforehand in the `ast::ExprKind::Async` arm of the big match in `print_expr_outer_attr_style`, exactly like we do in the immediately-preceding match arm for `ast::ExprKind::Block`—it would seem pretty ("pretty") reasonable for the pretty-printing of async blocks to work a lot like the pretty-printing of ordinary non-async blocks, right??

Of course, it would be shamefully cargo-culty to commit code on the basis of this kind of mere reasoning-by-analogy (in contrast to understanding the design of the pretty-printer in such detail that the correctness of the patch is comprehended with all the lucid certainty of mathematical proof, rather than being merely surmised by intuition). But maybe we care more about fixing the bug with high probability today, than with certainty in some indefinite hypothetical future?  Maybe the effort is worth [a fifth of a shirt](https://hacktoberfest.digitalocean.com/stats/zackmdavis)??

Humbly resolves #54752.

r? @cramertj

5 years agoRollup merge of #54773 - rust-lang:wesleywiser-patch-1, r=oli-obk
Pietro Albini [Thu, 4 Oct 2018 10:20:11 +0000 (12:20 +0200)]
Rollup merge of #54773 - rust-lang:wesleywiser-patch-1, r=oli-obk

Update a FIXME in memory.rs

In  #51833, I improved the performance of `copy_undef_mask()`. As such, the old FIXME wasn't appropriate anymore. The main remaining thing left to do is to implement a fast path for non-overlapping copies (per @oli-obk).

r? @oli-obk

5 years agoRollup merge of #54769 - jacobherrington:patch-1, r=kennytm
Pietro Albini [Thu, 4 Oct 2018 10:20:10 +0000 (12:20 +0200)]
Rollup merge of #54769 - jacobherrington:patch-1, r=kennytm

Fix typo in CONTRIBUTING.md

I noticed a small typo while reading over this document.

5 years agoRollup merge of #54761 - Lucretiel:patch-1, r=cramertj
Pietro Albini [Thu, 4 Oct 2018 10:20:08 +0000 (12:20 +0200)]
Rollup merge of #54761 - Lucretiel:patch-1, r=cramertj

Make spec_extend use for_each()

`for_each` will use an iterator's own implementation of `try_fold`, which I understand to be generally preferable (because nested iterator adapter's will use each other's `try_fold` and be designed for the specific adaptation in a way that promotes performance and inlining.

5 years agoRollup merge of #54746 - llogiq:simplify-unused-lints, r=michaelwoerister
Pietro Albini [Thu, 4 Oct 2018 10:20:07 +0000 (12:20 +0200)]
Rollup merge of #54746 - llogiq:simplify-unused-lints, r=michaelwoerister

simplify some unused lints code

Those are but small simplifications for readability.

5 years agoRollup merge of #53523 - phungleson:fix-impl-from-for-std-error, r=GuillaumeGomez
Pietro Albini [Thu, 4 Oct 2018 10:20:05 +0000 (12:20 +0200)]
Rollup merge of #53523 - phungleson:fix-impl-from-for-std-error, r=GuillaumeGomez

Add doc for impl From for Std Error

As part of issue #51430 (cc @skade).

I am not sure if it is going to a correct direction so put up here so that people can comment.

5 years agoAuto merge of #54638 - christianpoveda:master, r=kennytm
bors [Thu, 4 Oct 2018 09:17:47 +0000 (09:17 +0000)]
Auto merge of #54638 - christianpoveda:master, r=kennytm

Add checking for tool distribution in Tier 1

This fixes https://github.com/rust-lang/rust/issues/54483
r? @kennytm