Commit Graph

107219 Commits

Author SHA1 Message Date
Mazdak Farrokhzad b01c1e2092 parser: tweak item kind wording 2020-02-24 00:59:38 +01:00
Mazdak Farrokhzad ab84914fe4 parser: tweak unmatched wording 2020-02-24 00:59:38 +01:00
Mazdak Farrokhzad d446c73e6a parser: refactor away at_end 2020-02-24 00:59:38 +01:00
Mazdak Farrokhzad abc46a579b parse: harden `default` test. 2020-02-24 00:59:38 +01:00
Mazdak Farrokhzad a3b0829414 parse: move token hack into `parse_item_common`. 2020-02-24 00:59:38 +01:00
Mazdak Farrokhzad a05c83b2eb parse: use `parse_item_common` in `parse_assoc_item_`. 2020-02-24 00:59:38 +01:00
Mazdak Farrokhzad a63f35daee parse: use `parse_item_common` in `parse_foreign_item`. 2020-02-24 00:59:38 +01:00
Mazdak Farrokhzad a920a05603 parse: recover `default` on free items. 2020-02-24 00:59:38 +01:00
Mazdak Farrokhzad 9ed4c09983 parse: extract `error_on_unmatched_vis`. 2020-02-24 00:59:38 +01:00
Mazdak Farrokhzad 7017058e6b ast: add `Defaultness` to `Item`, making `AssocItem` an alias. 2020-02-24 00:59:38 +01:00
Mazdak Farrokhzad d41fc138bf `parse_defaultness`: avoid hardcoded list of keywords. 2020-02-24 00:59:38 +01:00
Mazdak Farrokhzad fa2a792491 add `Span` to `ast::Defaultness::Default`. 2020-02-24 00:59:38 +01:00
bors 6d0e58bff8 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
2020-02-23 19:26:35 +00:00
bors b1f395de64 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
2020-02-23 16:09:41 +00:00
bors 87b0d83745 Auto merge of #69351 - mati865:mingw-ultimate-fix, r=cramertj
Improve external MinGW detection

Fixes #68872
2020-02-23 12:52:48 +00:00
bors 9c230f39c1 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?
2020-02-23 09:40:18 +00:00
Dylan DPC d6414f5f8c
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
2020-02-23 09:57:45 +01:00
Dylan DPC bdd275de2a
Rollup merge of #69375 - Menschenkindlein:master, r=Dylan-DPC
Rename CodeMap to SourceMap follow up

See https://github.com/rust-lang/rust/issues/51574
2020-02-23 09:57:44 +01:00
Dylan DPC ae50725dc3
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
2020-02-23 09:57:43 +01:00
Dylan DPC cec00033a7
Rollup merge of #69351 - mati865:mingw-ultimate-fix, r=cramertj
Improve external MinGW detection

Fixes #68872
2020-02-23 09:57:40 +01:00
Dylan DPC b76099429b
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?
2020-02-23 09:57:38 +01:00
bors 1484196358 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
2020-02-23 06:27:07 +00:00
Jane Lusby 09bc5e3d96 rustfmt darnit 2020-02-22 15:29:03 -08:00
Jane Lusby 40c67221e2 make doc comments regular comments 2020-02-22 15:13:22 -08:00
bors 436494b8f8 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)
2020-02-22 18:07:03 +00:00
Jane Lusby 494dd0b719 Remove trait 2020-02-22 08:28:56 -08:00
bors 3eeefc21f1 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
2020-02-22 14:36:14 +00:00
Vadim Petrochenkov 4356d18e4a parser: Cleanup `Parser::bump_with` and its uses 2020-02-22 17:28:10 +03:00
Maxim Zholobak 20c9a40fec Rename CodeMap to SourceMap follow up 2020-02-22 16:17:31 +02:00
Dylan DPC e5fb1291a0
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
2020-02-22 18:43:08 +05:30
Dylan DPC 4f71270d7b
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.
2020-02-22 18:43:07 +05:30
Dylan DPC 541b407c14
Rollup merge of #69349 - spastorino:mir-not-an-experiment, r=Dylan-DPC
MIR is not an experiment anymore

At least I hope is not 😝

r? @oli-obk
2020-02-22 18:43:05 +05:30
Dylan DPC 8ab4060057
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
2020-02-22 18:43:04 +05:30
Dylan DPC 1cb9fb5e16
Rollup merge of #69346 - GuillaumeGomez:clean-up-e032x-explanations, r=Dylan-DPC
Clean up E0323, E0324, E0325 and E0326 explanations

r? @Dylan-DPC
2020-02-22 18:43:03 +05:30
Dylan DPC 3d9b68a5c3
Rollup merge of #69339 - wesleywiser:test_for_69312, r=Centril
Add test for #69312

This bug was fixed by #67501.

Closes #69312
2020-02-22 18:43:01 +05:30
Dylan DPC c261ff1a77
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
2020-02-22 18:42:59 +05:30
Ralf Jung 88d6ab84c9 move const_eval.rs into the module folder 2020-02-22 12:24:05 +01:00
bors 07534591ff 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
2020-02-22 11:11:47 +00:00
bors 03d2f5cd6c 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
2020-02-22 07:26:58 +00:00
bors 87e494c4cd 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`?
2020-02-22 03:54:50 +00:00
Jane Lusby b44b4ca602 rustfmt you cruel mistress 2020-02-21 16:46:14 -08:00
bors d735ede6eb 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
2020-02-22 00:10:57 +00:00
Jane Lusby fa73b617c2 clean things up 2020-02-21 16:01:48 -08:00
Mazdak Farrokhzad 9f3dfd29a2 parse: allow `type Foo: Ord` syntactically. 2020-02-22 00:19:27 +01:00
LeSeulArtichaut 38a22b8130 Fix error message
Bless tests
2020-02-21 22:43:51 +01:00
Eric Huss 11530ded32 Update cargo 2020-02-21 13:17:19 -08:00
bors 1d7e818747 Auto merge of #69242 - cjgillot:object_violations, r=Zoxc
Querify object_safety_violations.

Split from #69076

r? @Zoxc
2020-02-21 20:25:50 +00:00
Mazdak Farrokhzad 14442e0ebb print vis & defaultness for nested items 2020-02-21 18:30:56 +01:00
bors 8aa9d2014f Auto merge of #69347 - matthiaskrgr:submodule_upd, r=Xanewok
submodules: update rls from 0100ac8 to 10bf331

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

r? @Xanewok
2020-02-21 16:57:24 +00:00
Michael Mc Donnell e1c8c8cf63 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.
2020-02-21 08:04:16 -08:00