]> git.lizzy.rs Git - rust.git/log
rust.git
4 years agoAuto merge of #69344 - RalfJung:miri, r=oli-obk
bors [Mon, 24 Feb 2020 14:54:39 +0000 (14:54 +0000)]
Auto merge of #69344 - RalfJung:miri, r=oli-obk

bump Miri

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

r? @ghost Cc @oli-obk

4 years agolibrustc_macros: remove redundant single component path import
Matthias Krüger [Mon, 24 Feb 2020 13:53:55 +0000 (14:53 +0100)]
librustc_macros: remove redundant single component path import

4 years agolibrustc{, codegen_ssa,infer,mir_build}: don't clone types that are copy
Matthias Krüger [Mon, 24 Feb 2020 13:48:40 +0000 (14:48 +0100)]
librustc{, codegen_ssa,infer,mir_build}: don't clone types that are copy

4 years agoremove redundant clones in librustc_mir_build and librustc_data_structures
Matthias Krüger [Mon, 24 Feb 2020 13:42:14 +0000 (14:42 +0100)]
remove redundant clones in librustc_mir_build and librustc_data_structures

4 years agosubmodules: update rls from 10bf331 to 5fde462
Matthias Krüger [Mon, 24 Feb 2020 12:47:20 +0000 (13:47 +0100)]
submodules: update rls from 10bf331 to 5fde462

Changes:
````
Update cargo.
````

Fixes #69383
Fixes #69286

r? @Xanewok

4 years agobump Miri once more
Ralf Jung [Mon, 24 Feb 2020 12:08:24 +0000 (13:08 +0100)]
bump Miri once more

4 years agoClean up E0368 and E0369 explanations
Guillaume Gomez [Mon, 24 Feb 2020 11:55:49 +0000 (12:55 +0100)]
Clean up E0368 and E0369 explanations

4 years agoAuto merge of #69424 - pietroalbini:rollup-3oelogm, r=pietroalbini
bors [Mon, 24 Feb 2020 11:41:30 +0000 (11:41 +0000)]
Auto merge of #69424 - pietroalbini:rollup-3oelogm, r=pietroalbini

Rollup of 5 pull requests

Successful merges:

 - #69372 (Updates links in various Compiler Error Index entries)
 - #69385 (Relax str::get_unchecked precondition to permit empty slicing)
 - #69386 (Fix minor error in `MaybeUninit::get_mut()` doc example)
 - #69394 (Clean up E0367 explanation)
 - #69405 (docs: Stdin::read_line: mention the appending)

Failed merges:

r? @ghost

4 years agoAddress method comments
Andreas Molzer [Mon, 24 Feb 2020 10:23:47 +0000 (11:23 +0100)]
Address method comments

4 years agoRollup merge of #69405 - NieDzejkob:docs-readline-appends, r=joshtriplett
Pietro Albini [Mon, 24 Feb 2020 10:15:36 +0000 (11:15 +0100)]
Rollup merge of #69405 - NieDzejkob:docs-readline-appends, r=joshtriplett

docs: Stdin::read_line: mention the appending

The fact that `stdin().read_line()` is an [unpleasant](https://twitter.com/Michcioperz/status/1231646797661167617?s=20) [footgun](https://rustbattle.net/battle/straight-finch-8-e4f4). Let's make it clearer in the documentation.

4 years agoRollup merge of #69394 - GuillaumeGomez:clean-up-0367, r=Dylan-DPC
Pietro Albini [Mon, 24 Feb 2020 10:15:34 +0000 (11:15 +0100)]
Rollup merge of #69394 - GuillaumeGomez:clean-up-0367, r=Dylan-DPC

Clean up E0367 explanation

r? @Dylan-DPC

4 years agoRollup merge of #69386 - danielhenrymantilla:maybe_uninit_docs_replace_chunk_with_win...
Pietro Albini [Mon, 24 Feb 2020 10:15:33 +0000 (11:15 +0100)]
Rollup merge of #69386 - danielhenrymantilla:maybe_uninit_docs_replace_chunk_with_windows, r=Dylan-DPC

Fix minor error in `MaybeUninit::get_mut()` doc example

In the `MaybeUninit::get_mut()` example I wanted to assert that the slice was sorted and mistakenly used `.chunks(2)` rather than `.windows(2)` to assert it, as @ametisf pointed out in https://github.com/rust-lang/rust/pull/65948#issuecomment-589988183 .

This fixes it.

4 years agoRollup merge of #69385 - ridiculousfish:relax_get_unchecked, r=nagisa
Pietro Albini [Mon, 24 Feb 2020 10:15:31 +0000 (11:15 +0100)]
Rollup merge of #69385 - ridiculousfish:relax_get_unchecked, r=nagisa

Relax str::get_unchecked precondition to permit empty slicing

Prior to this commit, `str` documented that `get_unchecked` had
the precondition that "`begin` must come before `end`". This would appear
to prohibit empty slices (i.e. begin == end).

In practice, get_unchecked is called often with empty slices. Let's relax
the precondition so as to allow them.

4 years agoRollup merge of #69372 - yawpitch:master, r=varkor
Pietro Albini [Mon, 24 Feb 2020 10:15:30 +0000 (11:15 +0100)]
Rollup merge of #69372 - yawpitch:master, r=varkor

Updates links in various Compiler Error Index entries

Currently many of the links in the online https://doc.rust-lang.org/error-index.html are not clickable, and many of them don't resolve correctly as they point to older versions of rustbyexample and the reference.

4 years agoparser: `token` -> `normalized_token`, `nonnormalized_token` -> `token`
Vadim Petrochenkov [Mon, 24 Feb 2020 10:04:13 +0000 (13:04 +0300)]
parser: `token` -> `normalized_token`, `nonnormalized_token` -> `token`

4 years agoAdd some missing support for `NtIdent`
Vadim Petrochenkov [Sat, 22 Feb 2020 17:19:49 +0000 (20:19 +0300)]
Add some missing support for `NtIdent`

4 years agoUpdate Clippy
flip1995 [Mon, 24 Feb 2020 08:13:13 +0000 (09:13 +0100)]
Update Clippy

4 years agoBump core::primitive to 1.43
David Tolnay [Mon, 24 Feb 2020 07:59:39 +0000 (23:59 -0800)]
Bump core::primitive to 1.43

4 years agoAuto merge of #69366 - Centril:unified-items, r=petrochenkov
bors [Mon, 24 Feb 2020 00:31:01 +0000 (00:31 +0000)]
Auto merge of #69366 - Centril:unified-items, r=petrochenkov

parse: unify item parsing & filter illegal item kinds

This PR fully unifies item parsing into a single `fn parse_item_common` method which produces `Option<Item>`. The `Item` is then mapped into `ForeignItem` and `AssocItem` as necessary by transforming the `*Kind` and converting contextually bad variants into `None`, thereby filtering them away.

The PR does not yet unmerge the definition of `ForeignItemKind` from `AssocItemKind`. I've left that as future work as it didn't feel like this parser-focused PR would be the best one to deal with it. Changes to the AST data structures are instead kept to a reasonable minimum.

Based on https://github.com/rust-lang/rust/pull/69361.

Fixes https://github.com/rust-lang/rust/issues/48137.
RELNOTES: Now, `item` macro fragments can be interpolated into `impl`, `trait`, and `extern` contexts. See `src/test/ui/parser/issue-48137-macros-cannot-interpolate-impl-items.rs` for the relevant test.

r? @petrochenkov
cc @estebank

4 years agoparse: test bad variants wrt. issue 48137.
Mazdak Farrokhzad [Sun, 23 Feb 2020 12:04:46 +0000 (13:04 +0100)]
parse: test bad variants wrt. issue 48137.

4 years agoparse: tweak diagnostic wordings
Mazdak Farrokhzad [Sun, 23 Feb 2020 11:54:00 +0000 (12:54 +0100)]
parse: tweak diagnostic wordings

4 years agoparse: tweak `parse_item_` for more reuse.
Mazdak Farrokhzad [Sun, 23 Feb 2020 10:52:57 +0000 (11:52 +0100)]
parse: tweak `parse_item_` for more reuse.

4 years agoparse/ast: move `Defaultness` into variants.
Mazdak Farrokhzad [Sun, 23 Feb 2020 09:24:30 +0000 (10:24 +0100)]
parse/ast: move `Defaultness` into variants.

4 years agoparse: `NtItem` -> `parse_item_common`.
Mazdak Farrokhzad [Sun, 23 Feb 2020 05:53:59 +0000 (06:53 +0100)]
parse: `NtItem` -> `parse_item_common`.

4 years agoparser: tweak item kind wording
Mazdak Farrokhzad [Sun, 23 Feb 2020 05:04:37 +0000 (06:04 +0100)]
parser: tweak item kind wording

4 years agoparser: tweak unmatched wording
Mazdak Farrokhzad [Sun, 23 Feb 2020 03:49:26 +0000 (04:49 +0100)]
parser: tweak unmatched wording

4 years agoparser: refactor away at_end
Mazdak Farrokhzad [Sat, 22 Feb 2020 09:03:10 +0000 (10:03 +0100)]
parser: refactor away at_end

4 years agoparse: harden `default` test.
Mazdak Farrokhzad [Sat, 22 Feb 2020 07:55:01 +0000 (08:55 +0100)]
parse: harden `default` test.

4 years agoparse: move token hack into `parse_item_common`.
Mazdak Farrokhzad [Sat, 22 Feb 2020 07:34:24 +0000 (08:34 +0100)]
parse: move token hack into `parse_item_common`.

4 years agoparse: use `parse_item_common` in `parse_assoc_item_`.
Mazdak Farrokhzad [Sat, 22 Feb 2020 07:16:39 +0000 (08:16 +0100)]
parse: use `parse_item_common` in `parse_assoc_item_`.

4 years agoparse: use `parse_item_common` in `parse_foreign_item`.
Mazdak Farrokhzad [Sat, 22 Feb 2020 05:57:31 +0000 (06:57 +0100)]
parse: use `parse_item_common` in `parse_foreign_item`.

4 years agoparse: recover `default` on free items.
Mazdak Farrokhzad [Sat, 22 Feb 2020 03:53:02 +0000 (04:53 +0100)]
parse: recover `default` on free items.

4 years agoparse: extract `error_on_unmatched_vis`.
Mazdak Farrokhzad [Sat, 22 Feb 2020 02:44:24 +0000 (03:44 +0100)]
parse: extract `error_on_unmatched_vis`.

4 years agoast: add `Defaultness` to `Item`, making `AssocItem` an alias.
Mazdak Farrokhzad [Sat, 22 Feb 2020 02:29:17 +0000 (03:29 +0100)]
ast: add `Defaultness` to `Item`, making `AssocItem` an alias.

4 years ago`parse_defaultness`: avoid hardcoded list of keywords.
Mazdak Farrokhzad [Sat, 22 Feb 2020 01:32:02 +0000 (02:32 +0100)]
`parse_defaultness`: avoid hardcoded list of keywords.

4 years agoadd `Span` to `ast::Defaultness::Default`.
Mazdak Farrokhzad [Sat, 22 Feb 2020 01:01:53 +0000 (02:01 +0100)]
add `Span` to `ast::Defaultness::Default`.

4 years agodocs: Stdin::read_line: mention the appending
Jakub Kądziołka [Sun, 23 Feb 2020 20:19:25 +0000 (21:19 +0100)]
docs: Stdin::read_line: mention the appending

4 years agoAuto merge of #69393 - Dylan-DPC:rollup-rxbd1zg, r=Dylan-DPC
bors [Sun, 23 Feb 2020 19:26:35 +0000 (19:26 +0000)]
Auto merge of #69393 - Dylan-DPC:rollup-rxbd1zg, r=Dylan-DPC

Rollup of 5 pull requests

Successful merges:

 - #69336 (Do not ping the infrastructure team on toolstate changes)
 - #69351 (Improve external MinGW detection)
 - #69361 (parse: allow `type Foo: Ord` syntactically)
 - #69375 (Rename CodeMap to SourceMap follow up)
 - #69376 (parser: Cleanup `Parser::bump_with` and its uses)

Failed merges:

r? @ghost

4 years agoUpdate RELEASES.md
XAMPPRocky [Sun, 23 Feb 2020 17:04:48 +0000 (18:04 +0100)]
Update RELEASES.md

Co-Authored-By: Jonas Schievink <jonasschievink@gmail.com>
Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
4 years agoAuto merge of #69084 - yaahc:delayed-doc-lint, r=petrochenkov
bors [Sun, 23 Feb 2020 16:09:41 +0000 (16:09 +0000)]
Auto merge of #69084 - yaahc:delayed-doc-lint, r=petrochenkov

Split non macro portion of unused_doc_comment from macro part into two passes/lints

## Motivation

This change is motivated by the needs of the [spandoc library](https://github.com/yaahc/spandoc). The specific use case is that my macro is removing doc comments when an attribute is applied to a fn with doc comments, but I would like the lint to still appear when I forget to add the `#[spandoc]` attribute to a fn, so I don't want to have to silence the lint globally.

## Approach

This change splits the `unused _doc_comment` lint into two lints, `unused_macro_doc_comment` and `unused_doc_comment`. The non macro portion is moved into an `early_lint_pass` rather than a pre_expansion_pass. This allows proc macros to silence `unused_doc_comment` warnings by either adding an attribute to silence it or by removing the doc comment before the early_pass runs.

The `unused_macro_doc_comment` lint however will still be impossible for proc-macros to silence, but the only alternative that I can see is to remove this lint entirely, which I don't think is acceptable / is a decision I'm not comfortable making personally, so instead I opted to split the macro portion of the check into a separate lint so that it can be silenced globally with an attribute if necessary without needing to globally silence the `unused_doc_comment` lint as well, which is still desireable.

fixes https://github.com/rust-lang/rust/issues/67838

4 years agoDeduplicate identifier printing a bit
Vadim Petrochenkov [Sat, 22 Feb 2020 22:29:36 +0000 (01:29 +0300)]
Deduplicate identifier printing a bit

4 years agoAuto merge of #69351 - mati865:mingw-ultimate-fix, r=cramertj
bors [Sun, 23 Feb 2020 12:52:48 +0000 (12:52 +0000)]
Auto merge of #69351 - mati865:mingw-ultimate-fix, r=cramertj

Improve external MinGW detection

Fixes #68872

4 years agoUpdate links
Michael Morehouse [Sat, 22 Feb 2020 11:49:52 +0000 (11:49 +0000)]
Update links

Formatting fixes

Now that I can actually run `python x.py test src/tools/tidy` locally
... my god it takes a long time to compile when you're on a cellular
connection.

Removing unnecessary whitespaces

Updates src/test/ui/json-short.stderr golden test file

Fixes test failure by updating the golden file for changes
in src/librustc_error_codes/error_codes/E0601.md

Update src/librustc_error_codes/error_codes/E0080.md

Co-Authored-By: varkor <github@varkor.com>
Update src/librustc_error_codes/error_codes/E0080.md

Co-Authored-By: varkor <github@varkor.com>
Update src/librustc_error_codes/error_codes/E0080.md

Co-Authored-By: varkor <github@varkor.com>
Update src/librustc_error_codes/error_codes/E0154.md

Co-Authored-By: varkor <github@varkor.com>
Update src/librustc_error_codes/error_codes/E0154.md

Co-Authored-By: varkor <github@varkor.com>
Update src/librustc_error_codes/error_codes/E0661.md

Co-Authored-By: varkor <github@varkor.com>
Update src/librustc_error_codes/error_codes/E0662.md

Co-Authored-By: varkor <github@varkor.com>
Update src/librustc_error_codes/error_codes/E0663.md

Co-Authored-By: varkor <github@varkor.com>
Update src/librustc_error_codes/error_codes/E0664.md

Co-Authored-By: varkor <github@varkor.com>
Update src/test/ui/json-short.stderr

Co-Authored-By: varkor <github@varkor.com>
Update src/librustc_error_codes/error_codes/E0260.md

Co-Authored-By: varkor <github@varkor.com>
Update src/librustc_error_codes/error_codes/E0154.md

Co-Authored-By: varkor <github@varkor.com>
Update src/librustc_error_codes/error_codes/E0260.md

Co-Authored-By: varkor <github@varkor.com>
Apply suggestions from code review

Co-Authored-By: varkor <github@varkor.com>
Fixing 1 character over 80 cascade

4 years agoClean up E0367 explanation
Guillaume Gomez [Sun, 23 Feb 2020 11:02:32 +0000 (12:02 +0100)]
Clean up E0367 explanation

4 years agoAuto merge of #69336 - Mark-Simulacrum:no-infra-toolstate, r=Dylan-DPC
bors [Sun, 23 Feb 2020 09:40:18 +0000 (09:40 +0000)]
Auto merge of #69336 - Mark-Simulacrum:no-infra-toolstate, r=Dylan-DPC

Do not ping the infrastructure team on toolstate changes

To my knowledge, there is essentially never any particular action that the infra team needs to take on these pings, and they are currently relatively annoying.

cc rust-lang/infra -- does anyone *want* these notifications?

4 years agoRollup merge of #69376 - petrochenkov:bumpwith, r=Centril
Dylan DPC [Sun, 23 Feb 2020 08:57:45 +0000 (09:57 +0100)]
Rollup merge of #69376 - petrochenkov:bumpwith, r=Centril

parser: Cleanup `Parser::bump_with` and its uses

Follow-up to https://github.com/rust-lang/rust/pull/69006.
r? @Centril

4 years agoRollup merge of #69375 - Menschenkindlein:master, r=Dylan-DPC
Dylan DPC [Sun, 23 Feb 2020 08:57:44 +0000 (09:57 +0100)]
Rollup merge of #69375 - Menschenkindlein:master, r=Dylan-DPC

Rename CodeMap to SourceMap follow up

See https://github.com/rust-lang/rust/issues/51574

4 years agoRollup merge of #69361 - Centril:free-ty-alias, r=petrochenkov
Dylan DPC [Sun, 23 Feb 2020 08:57:43 +0000 (09:57 +0100)]
Rollup merge of #69361 - Centril:free-ty-alias, r=petrochenkov

parse: allow `type Foo: Ord` syntactically

This addresses:
> (Work still remains to fuse this with free type aliases, but this can be done later.)

in https://github.com/rust-lang/rust/pull/69194.

r? @petrochenkov

4 years agoRollup merge of #69351 - mati865:mingw-ultimate-fix, r=cramertj
Dylan DPC [Sun, 23 Feb 2020 08:57:40 +0000 (09:57 +0100)]
Rollup merge of #69351 - mati865:mingw-ultimate-fix, r=cramertj

Improve external MinGW detection

Fixes #68872

4 years agoRollup merge of #69336 - Mark-Simulacrum:no-infra-toolstate, r=Dylan-DPC
Dylan DPC [Sun, 23 Feb 2020 08:57:38 +0000 (09:57 +0100)]
Rollup merge of #69336 - Mark-Simulacrum:no-infra-toolstate, r=Dylan-DPC

Do not ping the infrastructure team on toolstate changes

To my knowledge, there is essentially never any particular action that the infra team needs to take on these pings, and they are currently relatively annoying.

cc rust-lang/infra -- does anyone *want* these notifications?

4 years agoAuto merge of #69334 - Centril:nested-item-vis-def, r=petrochenkov
bors [Sun, 23 Feb 2020 06:27:07 +0000 (06:27 +0000)]
Auto merge of #69334 - Centril:nested-item-vis-def, r=petrochenkov

print vis & defaultness for nested items

Fixes https://github.com/rust-lang/rust/issues/69315 which was injected by https://github.com/rust-lang/rust/pull/69194.

r? @petrochenkov
cc @alexcrichton

4 years agoAdd rustdoc aliases to `ptr::copy` and `ptr::copy_nonoverlapping`
memoryruins [Sun, 23 Feb 2020 03:25:47 +0000 (22:25 -0500)]
Add rustdoc aliases to `ptr::copy` and `ptr::copy_nonoverlapping`

4 years agoMark attributes consumed by `check_mod_attrs` as normal
Tomasz Miąsko [Sun, 23 Feb 2020 00:00:00 +0000 (00:00 +0000)]
Mark attributes consumed by `check_mod_attrs` as normal

Take advantage of the fact that `check_mod_attrs` marks attributes as
used and change their type to normal, so that any remaining uses will be
warned about by the unused attribute lint.

4 years agorustfmt darnit
Jane Lusby [Sat, 22 Feb 2020 23:29:03 +0000 (15:29 -0800)]
rustfmt darnit

4 years agomake doc comments regular comments
Jane Lusby [Sat, 22 Feb 2020 23:13:22 +0000 (15:13 -0800)]
make doc comments regular comments

4 years agoFix doc example for `MaybeUninit::get_mut()`
Daniel Henry-Mantilla [Sat, 22 Feb 2020 22:19:05 +0000 (23:19 +0100)]
Fix doc example for `MaybeUninit::get_mut()`

Suggested by @ametisf in https://github.com/rust-lang/rust/pull/65948#issuecomment-589988183

Co-Authored-By: Frantisek Fladung <fladufra@fel.cvut.cz>
4 years agoupdate some tests
Mark Mansi [Sat, 22 Feb 2020 22:14:14 +0000 (16:14 -0600)]
update some tests

4 years agoRelax str::get_unchecked precondition to permit empty slicing
ridiculousfish [Sat, 22 Feb 2020 21:28:53 +0000 (13:28 -0800)]
Relax str::get_unchecked precondition to permit empty slicing

Prior to this commit, `str` documented that `get_unchecked` had
the precondition that "`begin` must come before `end`". This would appear
to prohibit empty slices (i.e. begin == end).

In practice, get_unchecked is called often with empty slices. Let's relax
the precondition so as to allow them.

4 years agoAllow getting `no_std` from the config file
John Ericson [Sat, 22 Feb 2020 19:38:38 +0000 (14:38 -0500)]
Allow getting `no_std` from the config file

Currently, it is only set correctly in the sanity checking implicit
default fallback code. Having a config file at all will for force
`no_std = false`.

4 years agoremove unneeded fn
mark [Sat, 22 Feb 2020 19:09:54 +0000 (13:09 -0600)]
remove unneeded fn

4 years agoget rid of lazy
mark [Sat, 22 Feb 2020 19:05:32 +0000 (13:05 -0600)]
get rid of lazy

4 years agoaddress some review comments/bugs
mark [Sat, 8 Feb 2020 22:33:50 +0000 (16:33 -0600)]
address some review comments/bugs

4 years agoarticle and descr for closures
Mark Mansi [Sun, 26 Jan 2020 01:31:38 +0000 (19:31 -0600)]
article and descr for closures

4 years agoadd generator_kind query
Mark Mansi [Sun, 26 Jan 2020 01:09:23 +0000 (19:09 -0600)]
add generator_kind query

4 years agosome fixes
Mark Mansi [Fri, 24 Jan 2020 18:13:45 +0000 (12:13 -0600)]
some fixes

4 years agominor cleanup
Mark Mansi [Fri, 24 Jan 2020 18:02:33 +0000 (12:02 -0600)]
minor cleanup

4 years agoGeneralized article_and_description
Mark Mansi [Tue, 31 Dec 2019 01:46:30 +0000 (19:46 -0600)]
Generalized article_and_description

4 years agoAuto merge of #69358 - ehuss:update-cargo, r=ehuss
bors [Sat, 22 Feb 2020 18:07:03 +0000 (18:07 +0000)]
Auto merge of #69358 - ehuss:update-cargo, r=ehuss

Update cargo

11 commits in e02974078a692d7484f510eaec0e88d1b6cc0203..e57bd02999c9f40d52116e0beca7d1dccb0643de
2020-02-18 15:24:43 +0000 to 2020-02-21 20:20:10 +0000
- fix most remaining clippy findings (mostly redundant imports) (rust-lang/cargo#7912)
- Add -Zfeatures tracking issues. (rust-lang/cargo#7917)
- Use rust-lang/rust linkchecker on CI. (rust-lang/cargo#7913)
- Clean up code mostly based on clippy suggestions (rust-lang/cargo#7911)
- Add an option to include crate versions to the generated docs (rust-lang/cargo#7903)
- Better support for license-file. (rust-lang/cargo#7905)
- Add new feature resolver. (rust-lang/cargo#7820)
- Switch azure to macOS 10.15. (rust-lang/cargo#7906)
- Modified the help information of cargo-rustc (rust-lang/cargo#7892)
- Update for nightly rustfmt. (rust-lang/cargo#7904)
- Support `--config path_to_config.toml` cli syntax. (rust-lang/cargo#7901)

4 years agoRemove trait
Jane Lusby [Sat, 22 Feb 2020 16:28:56 +0000 (08:28 -0800)]
Remove trait

4 years agoFail on multiple declarations of `main`.
jumbatm [Sat, 22 Feb 2020 15:43:47 +0000 (01:43 +1000)]
Fail on multiple declarations of `main`.

Previously, when inserting the entry function, we only checked for
duplicate _definitions_ of `main`.  However, it's possible to cause
problems even only having a duplicate _declaration_. For example,
shadowing `main` using an extern block isn't caught by the current
check, and causes an assertion failure down the line in in LLVM code.

4 years agoAuto merge of #69374 - Dylan-DPC:rollup-x7mjd5z, r=Dylan-DPC
bors [Sat, 22 Feb 2020 14:36:14 +0000 (14:36 +0000)]
Auto merge of #69374 - Dylan-DPC:rollup-x7mjd5z, r=Dylan-DPC

Rollup of 7 pull requests

Successful merges:

 - #68984 (Make `u8::is_ascii` a stable `const fn`)
 - #69339 (Add test for #69312)
 - #69346 (Clean up E0323, E0324, E0325 and E0326 explanations)
 - #69348 (Wrong error message for move_ref_pattern)
 - #69349 (MIR is not an experiment anymore)
 - #69354 (Test `Duration::new` panics on overflow)
 - #69370 (move const_eval.rs into the module folder)

Failed merges:

r? @ghost

4 years agoparser: Cleanup `Parser::bump_with` and its uses
Vadim Petrochenkov [Sat, 22 Feb 2020 13:22:38 +0000 (16:22 +0300)]
parser: Cleanup `Parser::bump_with` and its uses

4 years agoRename CodeMap to SourceMap follow up
Maxim Zholobak [Sat, 22 Feb 2020 14:07:05 +0000 (16:07 +0200)]
Rename CodeMap to SourceMap follow up

4 years agoRollup merge of #69370 - RalfJung:const-eval-mod, r=oli-obk
Dylan DPC [Sat, 22 Feb 2020 13:13:08 +0000 (18:43 +0530)]
Rollup merge of #69370 - RalfJung:const-eval-mod, r=oli-obk

move const_eval.rs into the module folder

This groups the file together with the other `const_eval` files in editors, diff views, etc.

r? @oli-obk

4 years agoRollup merge of #69354 - MichaelMcDonnell:duration_overflow_test, r=Centril
Dylan DPC [Sat, 22 Feb 2020 13:13:07 +0000 (18:43 +0530)]
Rollup merge of #69354 - MichaelMcDonnell:duration_overflow_test, r=Centril

Test `Duration::new` panics on overflow

A `Duration` is created from a second and nanoseconds variable. The
documentation says: "This constructor will panic if the carry from the
nanoseconds overflows the seconds counter". This was, however, not tested
in the tests. I doubt the behavior will ever regress, but it is usually a
good idea to test all documented behavior.

4 years agoRollup merge of #69349 - spastorino:mir-not-an-experiment, r=Dylan-DPC
Dylan DPC [Sat, 22 Feb 2020 13:13:05 +0000 (18:43 +0530)]
Rollup merge of #69349 - spastorino:mir-not-an-experiment, r=Dylan-DPC

MIR is not an experiment anymore

At least I hope is not :stuck_out_tongue_closed_eyes:

r? @oli-obk

4 years agoRollup merge of #69348 - LeSeulArtichaut:patch-1, r=Centril
Dylan DPC [Sat, 22 Feb 2020 13:13:04 +0000 (18:43 +0530)]
Rollup merge of #69348 - LeSeulArtichaut:patch-1, r=Centril

Wrong error message for move_ref_pattern

The current error message states that move occurs *because of `Copy`*:
```Rust
"move occurs because `{}` has type `{}` which does implement the `Copy` trait."
```
I found this randomly when surfing through the sources. This means, I don't have any context and might be completely wrong.

r? @Centril

4 years agoRollup merge of #69346 - GuillaumeGomez:clean-up-e032x-explanations, r=Dylan-DPC
Dylan DPC [Sat, 22 Feb 2020 13:13:03 +0000 (18:43 +0530)]
Rollup merge of #69346 - GuillaumeGomez:clean-up-e032x-explanations, r=Dylan-DPC

Clean up E0323, E0324, E0325 and E0326 explanations

r? @Dylan-DPC

4 years agoRollup merge of #69339 - wesleywiser:test_for_69312, r=Centril
Dylan DPC [Sat, 22 Feb 2020 13:13:01 +0000 (18:43 +0530)]
Rollup merge of #69339 - wesleywiser:test_for_69312, r=Centril

Add test for #69312

This bug was fixed by #67501.

Closes #69312

4 years agoRollup merge of #68984 - ecstatic-morse:const-u8-is-ascii, r=sfackler
Dylan DPC [Sat, 22 Feb 2020 13:12:59 +0000 (18:42 +0530)]
Rollup merge of #68984 - ecstatic-morse:const-u8-is-ascii, r=sfackler

Make `u8::is_ascii` a stable `const fn`

`char::is_ascii` was already stabilized as `const fn` in #55278, so there is no reason for `u8::is_ascii` to go through an unstable period.

cc @rust-lang/libs

4 years agoAdd note regarding argument ordering
varkor [Sat, 22 Feb 2020 02:35:24 +0000 (02:35 +0000)]
Add note regarding argument ordering

4 years agoExpand the documentation for E0747
varkor [Sat, 22 Feb 2020 01:56:05 +0000 (01:56 +0000)]
Expand the documentation for E0747

4 years agoAdd invalid argument spans to `GenericArgCountMismatch`
varkor [Sat, 22 Feb 2020 01:55:35 +0000 (01:55 +0000)]
Add invalid argument spans to `GenericArgCountMismatch`

4 years agomove const_eval.rs into the module folder
Ralf Jung [Sat, 22 Feb 2020 11:24:05 +0000 (12:24 +0100)]
move const_eval.rs into the module folder

4 years agoAuto merge of #69333 - ecstatic-morse:revert-simd-shuffle, r=petrochenkov
bors [Sat, 22 Feb 2020 11:11:47 +0000 (11:11 +0000)]
Auto merge of #69333 - ecstatic-morse:revert-simd-shuffle, r=petrochenkov

Revert #69280

Resolves #69313 by reverting #69280.

After #69280, `#[rustc_args_required_const(2)]` is required on the declaration of `simd_shuffle` intrinsics. This is allowed breakage, since you can't define platform intrinsics on stable. However, the latest release of the widely used `packed_simd` crate defines these intrinsics without the requisite attribute. Since there's no urgency to merge #69280, let's revert it. We can reconsider when rust-lang/packed_simd#278 is included in a point release of `packed_simd`.

r? @petrochenkov

4 years agoAuto merge of #69332 - nnethercote:revert-u8to64_le-changes, r=michaelwoerister
bors [Sat, 22 Feb 2020 07:26:58 +0000 (07:26 +0000)]
Auto merge of #69332 - nnethercote:revert-u8to64_le-changes, r=michaelwoerister

Revert `u8to64_le` changes from #68914.

`SipHasher128`'s `u8to64_le` function was simplified in #68914.
Unfortunately, the new version is slower, because it introduces `memcpy`
calls with non-statically-known lengths.

This commit reverts the change, and adds an explanatory comment (which
is also added to `libcore/hash/sip.rs`). This barely affects
`SipHasher128`'s speed because it doesn't use `u8to64_le` much, but it
does result in `SipHasher128` once again being consistent with
`libcore/hash/sip.rs`.

r? @michaelwoerister

4 years agoAuto merge of #67330 - golddranks:split_inclusive, r=kodraus
bors [Sat, 22 Feb 2020 03:54:50 +0000 (03:54 +0000)]
Auto merge of #67330 - golddranks:split_inclusive, r=kodraus

Implement split_inclusive for slice and str

# Overview
* Implement `split_inclusive` for `slice` and `str` and `split_inclusive_mut` for `slice`
* `split_inclusive` is a substring/subslice splitting iterator that includes the matched part in the iterated substrings as a terminator.
* EDIT: The behaviour has now changed, as per @KodrAus 's input, to the same semantics with the `split_terminator` function. I updated the examples below.
* Two examples below:
```Rust
    let data = "\nMäry häd ä little lämb\nLittle lämb\n";
    let split: Vec<&str> = data.split_inclusive('\n').collect();
    assert_eq!(split, ["\n", "Märy häd ä little lämb\n", "Little lämb\n"]);
```

```Rust
    let uppercase_separated = "SheePSharKTurtlECaT";
    let mut first_char = true;
    let split: Vec<&str> = uppercase_separated.split_inclusive(|c: char| {
        let split = !first_char && c.is_uppercase();
        first_char = split;
        split
    }).collect();
    assert_eq!(split, ["SheeP", "SharK", "TurtlE", "CaT"]);
```

# Justification for the API
* I was surprised to find that stdlib currently only has splitting iterators that leave out the matched part. In my experience, wanting to leave a substring terminator as a part of the substring is a pretty common usecase.
* This API is strictly more expressive than the standard `split` API: it's easy to get the behaviour of `split` by mapping a subslicing operation that drops the terminator. On the other hand it's impossible to derive this behaviour from `split` without using hacky and brittle `unsafe` code. The normal way to achieve this functionality would be implementing the iterator yourself.
* Especially when dealing with mutable slices, the only way currently is to use `split_at_mut`. This API provides an ergonomic alternative that plays to the strengths of the iterating capabilities of Rust. (Using `split_at_mut` iteratively used to be a real pain before NLL, fortunately the situation is a bit better now.)

# Discussion items
* <s>Does it make sense to mimic `split_terminator` in that the final empty slice would be left off in case of the string/slice ending with a terminator? It might do, as this use case is naturally geared towards considering the matching part as a terminator instead of a separator.</s>
  * EDIT: The behaviour was changed to mimic `split_terminator`.
* Does it make sense to have `split_inclusive_mut` for `&mut str`?

4 years agorustfmt you cruel mistress
Jane Lusby [Sat, 22 Feb 2020 00:46:14 +0000 (16:46 -0800)]
rustfmt you cruel mistress

4 years agoBe explicit about whether `GenericArgCountMismatch` arose from a fatal error
varkor [Sat, 25 Jan 2020 22:28:31 +0000 (22:28 +0000)]
Be explicit about whether `GenericArgCountMismatch` arose from a fatal error

4 years agoUse `Result` instead of `bool` throughout
varkor [Sat, 25 Jan 2020 00:49:43 +0000 (00:49 +0000)]
Use `Result` instead of `bool` throughout

4 years agoMake return value of `check_generic_arg_count` semantically clearer
varkor [Thu, 23 Jan 2020 00:41:33 +0000 (00:41 +0000)]
Make return value of `check_generic_arg_count` semantically clearer

4 years agoRefactor `create_substs_for_generic_args` a little
varkor [Wed, 22 Jan 2020 01:43:24 +0000 (01:43 +0000)]
Refactor `create_substs_for_generic_args` a little

4 years agoMove generic arg / param validation to `create_substs_for_generic_args`
varkor [Tue, 21 Jan 2020 23:07:07 +0000 (23:07 +0000)]
Move generic arg / param validation to `create_substs_for_generic_args`

4 years agoReport late-bound region lint as error in `check_generic_arg_count`
varkor [Tue, 21 Jan 2020 22:36:17 +0000 (22:36 +0000)]
Report late-bound region lint as error in `check_generic_arg_count`

4 years agoCorrect passing of `generic_args` to `create_substs_for_generic_args`
varkor [Tue, 21 Jan 2020 20:46:21 +0000 (20:46 +0000)]
Correct passing of `generic_args` to `create_substs_for_generic_args`

4 years agoReport all errors in `check_generic_arg_count`
varkor [Mon, 20 Jan 2020 23:59:17 +0000 (23:59 +0000)]
Report all errors in `check_generic_arg_count`

4 years agoReturn whether `check_generic_arg_count` finds an error
varkor [Mon, 20 Jan 2020 22:16:42 +0000 (22:16 +0000)]
Return whether `check_generic_arg_count` finds an error

4 years agoAuto merge of #69302 - jonas-schievink:yield-needs-storage, r=Zoxc
bors [Sat, 22 Feb 2020 00:10:57 +0000 (00:10 +0000)]
Auto merge of #69302 - jonas-schievink:yield-needs-storage, r=Zoxc

Fix generator miscompilations

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

r? @Zoxc

4 years agoclean things up
Jane Lusby [Sat, 22 Feb 2020 00:01:48 +0000 (16:01 -0800)]
clean things up

4 years agoparse: allow `type Foo: Ord` syntactically.
Mazdak Farrokhzad [Fri, 21 Feb 2020 22:00:27 +0000 (23:00 +0100)]
parse: allow `type Foo: Ord` syntactically.