Commit Graph

107407 Commits

Author SHA1 Message Date
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
varkor
bead79ebc6 Add note regarding argument ordering 2020-02-22 11:34:29 +00:00
varkor
e372ad4800 Expand the documentation for E0747 2020-02-22 11:34:29 +00:00
varkor
76fb26b8c2 Add invalid argument spans to GenericArgCountMismatch 2020-02-22 11:34:29 +00:00
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
varkor
33143fd756 Be explicit about whether GenericArgCountMismatch arose from a fatal error 2020-02-22 00:28:49 +00:00
varkor
104131c9d4 Use Result instead of bool throughout 2020-02-22 00:28:49 +00:00
varkor
dff64eb4b6 Make return value of check_generic_arg_count semantically clearer 2020-02-22 00:28:49 +00:00
varkor
c9b7b1f73b Refactor create_substs_for_generic_args a little 2020-02-22 00:28:48 +00:00
varkor
039045c49b Move generic arg / param validation to create_substs_for_generic_args 2020-02-22 00:28:18 +00:00
varkor
750e673491 Report late-bound region lint as error in check_generic_arg_count 2020-02-22 00:27:45 +00:00
varkor
9939de24ac Correct passing of generic_args to create_substs_for_generic_args 2020-02-22 00:27:44 +00:00
varkor
d232acdb39 Report all errors in check_generic_arg_count 2020-02-22 00:27:44 +00:00
varkor
2a504878c3 Return whether check_generic_arg_count finds an error 2020-02-22 00:27:44 +00: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
Jonas Schievink
6cc268b9ef Mark E0399.md as obsolete 2020-02-21 21:46:30 +01:00
Jonas Schievink
c60583163a Fix rebase fallout 2020-02-21 21:46:22 +01: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
Ralf Jung
1a0e2001bc fix miri and bootstrap interaction 2020-02-21 20:45:16 +01:00
Jonas Schievink
af2931bdfe Mark E0399 test as obsolete 2020-02-21 19:43:03 +01:00
Jonas Schievink
4d4da926f2 Fix rebase damage 2020-02-21 19:42:28 +01:00
Jonas Schievink
9930e1ff0a Fix tests that fail with --emit metadata 2020-02-21 19:42:28 +01:00
Jonas Schievink
232c1f331c Format code 2020-02-21 19:42:28 +01:00
Jonas Schievink
ec50190399 Bless test output 2020-02-21 19:41:22 +01:00
Jonas Schievink
a01846f0c3 appease tidy 2020-02-21 19:41:22 +01:00
Jonas Schievink
708f053807 Add test for #65774
Closes #65774
2020-02-21 19:41:22 +01:00
Jonas Schievink
f94eaeaf73 Fix rebase damage 2020-02-21 19:41:22 +01:00
Jonas Schievink
24ec364713 Test mixed default and non-default 2020-02-21 19:41:22 +01:00
Jonas Schievink
c8da9ee50a Improve specialization test 2020-02-21 19:41:22 +01:00
Jonas Schievink
fbcd136b65 Improve the cycle tests 2020-02-21 19:41:22 +01:00
Jonas Schievink
f40879408c Improve defaults-in-other-trait-items-pass 2020-02-21 19:41:22 +01:00
Jonas Schievink
3f03d95bb0 Improve associated-types-overridden-default.rs
Check that the resulting assoc. types are as expected
2020-02-21 19:41:22 +01:00
Jonas Schievink
c964520740 Update tests after compiletest changes 2020-02-21 19:41:22 +01:00
Jonas Schievink
fd28614cb7 Add regression test for #26681 2020-02-21 19:41:22 +01:00
Jonas Schievink
1f61f36849 Add comment about the shallow subst rule 2020-02-21 19:41:22 +01:00
Jonas Schievink
485111c48e Add regression tests for issues 2020-02-21 19:41:22 +01:00
Jonas Schievink
fead45815c Fix tests after rebase 2020-02-21 19:41:22 +01:00
Jonas Schievink
07ad64f70f Add tests for #62211 2020-02-21 19:41:22 +01:00
Jonas Schievink
ff5d11e043 Add comments and tests explaining the shallow substitution rule 2020-02-21 19:41:22 +01:00
Jonas Schievink
5e9317a023 Put the check into its own function 2020-02-21 19:41:22 +01:00