Commit Graph

205 Commits

Author SHA1 Message Date
Josh White
69075f065c Merge branch 'master' of https://github.com/jwhite927/rust into E0637 2020-02-07 23:56:44 -05:00
Josh White
8b77f8688e performed --bless of 15 ui tests affected 2020-02-07 12:44:31 -05:00
Eduard-Mihai Burtescu
4c7eb59e81 rustc_macros: don't limit the -Zmacro-backtrace suggestion to extern macros. 2020-02-06 21:46:38 +02:00
bors
5371ddf8c6 Auto merge of #68080 - varkor:declared-here, r=petrochenkov
Address inconsistency in using "is" with "declared here"

"is" was generally used for NLL diagnostics, but not other diagnostics. Using "is" makes the diagnostics sound more natural and readable, so it seems sensible to commit to them throughout.

r? @Centril
2020-01-31 15:13:51 +00:00
varkor
24a2929ed1 Normalise notes with the/is 2020-01-24 16:24:50 +00:00
varkor
50dd8eaeb9 Print constants in type_name for const generics 2020-01-24 16:23:32 +00:00
varkor
dd0507c054 Make TooGeneric error in WF checking a proper error
`TooGeneric` is encountered during WF checking when we cannot determine that a constant involving a generic parameter will always be evaluated successfully (rather than resulting in an error). In these cases, the burden of proof should be with the caller, so that we can avoid post-monomorphisation tim errors (which was the previous previous behaviour). This commit ensures that this situation produces a proper compiler error, rather than silently ignoring it or ICEing.
2020-01-21 01:03:15 +00:00
Tyler Mandry
9d9c8c69e3 Rollup merge of #68312 - varkor:issue-67753-regression, r=Centril
Add regression test for integer literals in generic arguments in where clauses

Closes https://github.com/rust-lang/rust/issues/67753.
2020-01-17 17:28:20 -08:00
varkor
a91f77ca26 Add regression test for integer literals in generic arguments in where clauses 2020-01-17 16:09:22 +00:00
Esteban Küber
5b36c187dc review comments 2020-01-16 09:49:13 -08:00
Esteban Küber
e1dd8a9095 When trait bounds are missing for return values, point at them 2020-01-16 09:37:24 -08:00
Ben Lewis
82b90bd993 Update test benchmark file 2020-01-12 20:41:03 +13:00
Ben Lewis
9e46ddc7a2 Added comment about behaviour. 2020-01-12 17:32:50 +13:00
Ben Lewis
b4fddf0f08 Forbid elided lifetimes within const generic parameter types. 2020-01-12 15:59:18 +13:00
Esteban Küber
2c5766f2d4 Unify output of "variant not found" errors 2020-01-08 08:05:31 -08:00
varkor
adb46fd0a4 Silence TooGeneric error
This error may be produced during intermediate failed attempts at evaluation of a generic const, which may nevertheless succeed later.
2020-01-05 23:00:47 +00:00
Mark Rousskov
48859db151 Relax bounds on HashSet to match hashbrown
No functional changes are made, and all APIs are moved to strictly less
restrictive bounds.

These APIs changed from the old bound listed to the new bound:

T: Hash + Eq -> T
* new
* with_capacity

T: Eq + Hash, S: BuildHasher -> T
* with_hasher
* with_capacity_and_hasher
* hasher

T: Eq + Hash + Debug -> T: Debug
S: BuildHasher -> S
<HashSet as Debug>

T: Eq + Hash -> T
S: BuildHasher + Default -> S: Default
<HashSet as Default>
2019-12-26 19:24:45 -05:00
Mazdak Farrokhzad
07effe18b0 Rollup merge of #67543 - JohnTitor:regression-tests, r=Centril
Add regression tests for fixed ICEs

Closes #61747 (fixed from 1.41.0-nightly (4007d4ef2 2019-12-01))
Closes #66205 (fixed from 1.41.0-nightly (4007d4ef2 2019-12-01))
Closes #66270 (fixed by #66246)
Closes #67424 (fixed by #67160)

Also picking a minor nit up from #67071 with 101dd7bad9

r? @Centril
2019-12-24 04:39:55 +01:00
Yuki Okushi
d918319bed Apply suggestion from Centril
Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
2019-12-24 01:05:09 +09:00
Mark Rousskov
c205f6a06a Remove mem::uninitalized from tests
This purges uses of uninitialized where possible from test cases. Some
are merely moved over to the equally bad pattern of
MaybeUninit::uninit().assume_init() but with an annotation that this is
"the best we can do".
2019-12-22 21:58:12 -05:00
Yuki Okushi
96253c2d15 Add test for issue-66205 2019-12-23 07:42:26 +09:00
Yuki Okushi
7c485ccfad Add test for issue-61747 2019-12-23 07:42:26 +09:00
Mazdak Farrokhzad
5a8083c665 Rollup merge of #67354 - VirrageS:blame-wrong-line, r=estebank
Fix pointing at arg when cause is outside of call

Follow up after: #66933

Closes: #66923

r? @estebank
2019-12-20 17:22:21 +01:00
Ohad Ravid
8a4632dec6 Indicate origin of where type parameter for uninferred types 2019-12-14 11:10:21 +01:00
Esteban Küber
da023c0c6f Add more context for type parameters 2019-12-11 17:18:43 -08:00
Janusz Marcinkiewicz
e305bf8bc8 Rename tests and add short test description 2019-12-07 08:55:09 +01:00
bors
ab21557501 Auto merge of #66682 - estebank:fn-type-err, r=davidtwco
Highlight parts of fn in type errors

When a type error arises between two fn items, fn pointers or tuples,
highlight only the differing parts of each.

Examples:

<img width="699" alt="" src="https://user-images.githubusercontent.com/1606434/69487597-ab561600-0e11-11ea-9b4e-d4fd9e91d5dc.png">
<img width="528" alt="" src="https://user-images.githubusercontent.com/1606434/69487207-9033d800-0e0a-11ea-93e3-8c4d002411a5.png">
<img width="468" alt="" src="https://user-images.githubusercontent.com/1606434/69487208-9033d800-0e0a-11ea-92e3-2b2cee120335.png">
<img width="775" alt="" src="https://user-images.githubusercontent.com/1606434/69487209-9033d800-0e0a-11ea-9e68-7f6ed5c8cb08.png">
2019-11-25 12:54:42 +00:00
Esteban Küber
d92355c1db Highlight parts of fn in type errors
When a type error arises between two fn items, fn pointers or tuples,
highlight only the differing parts of each.
2019-11-23 16:50:28 -08:00
Esteban Küber
34f03c01f6 Point at type in let assignment on type errors 2019-11-21 19:24:31 -08:00
bors
53712f8637 Auto merge of #66389 - estebank:type-err-labels, r=petrochenkov
Specific labels when referring to "expected" and "found" types
2019-11-21 17:53:19 +00:00
Gabriel Smith
eaf8fd0569 test: const-generics: Update tests removing unrequired braces
Braces were left in cases where generic args were in the generic const
paths.
2019-11-18 17:23:22 -05:00
Esteban Küber
6f8f70624b Surround types with backticks in type errors 2019-11-18 11:03:04 -08:00
Esteban Küber
94c6425464 Remove E0308 note when primary label has all info 2019-11-18 11:03:03 -08:00
Esteban Küber
83ffda5216 Specific labels when referring to "expected" and "found" types 2019-11-18 11:02:22 -08:00
Esteban Küber
52e8ec1432 Remove "here" from "expected one of X here" 2019-11-06 17:26:20 -08:00
bors
b43a682259 Auto merge of #65759 - tmiasko:ui, r=petrochenkov
Validate error patterns and error annotation in ui tests when present

Previously, when compilation succeeded, neither error patterns nor error
annotation would be validated. Additionally, when compilation failed,
only error patterns would be validated if both error patterns and error
annotation were present.

Now both error patterns and error annotation are validated when present,
regardless of compilation status. Furthermore, for test that should run,
the error patterns are matched against executable output, which is what
some of tests already expect to happen, and when #65506 is merged even
more ui tests will.

Fixes #56277
2019-11-03 15:14:09 +00:00
Tomasz Miąsko
dae4c6e722 Update error annotations in tests that successfully compile
Those annotation are silently ignored rather than begin validated
against compiler output. Update them before validation is enabled,
to avoid test failures.
2019-11-02 10:28:29 +01:00
Eduard-Mihai Burtescu
8f1eb345ea Revert "pre-expansion gate const_generics"
This reverts commit 49cbfa1a6f.
2019-10-31 19:08:12 +02:00
Esteban Küber
b26ddb8af3 Point at local similarly named element and tweak references to variants
Point at the span for the definition of ADTs internal to the current
crate.

Look at the leading char of the ident to determine whether we're
expecting a likely fn or any of a fn, a tuple struct or a tuple variant.

Turn fn `add_typo_suggestion` into a `Resolver` method.
2019-10-27 11:50:43 -07:00
Mazdak Farrokhzad
d6a18b6baf Rollup merge of #65742 - Centril:gate-pre-expansion-subset, r=davidtwco
Pre-expansion gate most of the things

This is a subset of https://github.com/rust-lang/rust/pull/64672. A crater run has already been done and this PR implements conclusions according to https://github.com/rust-lang/rust/pull/64672#issuecomment-542703363.

r? @davidtwco
cc @petrochenkov
2019-10-25 06:18:09 +02:00
Mazdak Farrokhzad
a302155344 Rollup merge of #62959 - LukasKalbertodt:array-value-iter, r=scottmcm
Add by-value iterator for arrays

This adds an iterator that can iterate over arrays by value, yielding all elements by value. However, **this PR does _not_ add a corresponding `IntoIterator` impl for arrays**. The `IntoIterator` impl needs some discussion about backwards-compatibility that should take place in a separate PR. With this patch, this code should work (but there is currently still a bug):

```rust
#![feature(array_value_iter)]
use std::array::IntoIter;

let arr = [1, 2, 3];
for x in IntoIter::new(arr) {
    println!("{}", x);
}
```

**TODO**:
- [x] Get initial feedback
- [x] Add tests
- [x] Figure out why stage1 produces weird bugs ([comment](https://github.com/rust-lang/rust/pull/62959#issuecomment-516016524))
- [x] Add UI tests as mentioned [here](https://github.com/rust-lang/rust/pull/62959#discussion_r307061894) (will do that soon-ish)
- [x] Fix [this new bug](https://github.com/rust-lang/rust/pull/62959#issuecomment-544732159)

**Notes for reviewers**
- Is the use of `MaybeUninit` correct here? I think it has to be used due to the `Clone` impl which has to fill the dead array elements with something, but cannot fill it with a correct instance.
- Are the unit tests sufficient?

CC #25725
2019-10-25 06:18:01 +02:00
Mazdak Farrokhzad
9c04bd1b4d Rollup merge of #65627 - varkor:const-generics-forbid-non-structural_match, r=petrochenkov
Forbid non-`structural_match` types in const generics

Fixes https://github.com/rust-lang/rust/issues/60286.
2019-10-24 20:20:01 +02:00
Lukas Kalbertodt
c36b9ddcb4 Add UI tests for array::IntoIter impls
This it to make sure traits are implemented for arrays with length 32
and below, while they are not implemented for >= 33.
2019-10-24 15:46:44 +02:00
Mazdak Farrokhzad
49cbfa1a6f pre-expansion gate const_generics 2019-10-24 00:32:03 +02:00
varkor
cc7294c751 Add regression test for #62579 2019-10-23 17:09:56 +01:00
varkor
51c687446d Add regression test for #65675 2019-10-22 15:49:43 +01:00
varkor
2dda8ad98a Use E0741 for structural match error 2019-10-22 12:28:23 +01:00
varkor
f0e6cd9f89 Remove "type parameter depends on const parameter" error from resolution 2019-10-22 12:26:32 +01:00
varkor
133cd2cfaf Search for generic parameters when finding non-structural_match types 2019-10-22 12:26:32 +01:00
varkor
bbd53deaeb Forbid non-structural_match types in const generics 2019-10-22 12:26:32 +01:00