101933 Commits

Author SHA1 Message Date
Tomasz Miąsko
f6c2c4dc43 Update error annotations positions
Since 8ec9d7242c3352fbc617d907bec3632215811356, in the case of a local
macro expansion, the errors are now matched to macro definition
location. Update test cases accordingly.
2019-11-03 10:20:11 +01:00
Tomasz Miąsko
23ada9495f Avoid mixing error patterns with error annotations
When both error patterns and error annotations are present in an ui
test, only error patterns are validated against the output.

Replace the error pattern with an error annotation to avoid silently
ignoring the other error annotation.
2019-11-03 10:20:11 +01:00
Igor Aleksanov
e0c45f7ee7 librustc_lexer: Make "eat_float_exponent" return bool instead of result 2019-11-03 11:43:47 +03:00
Igor Aleksanov
72767a8056 librustc_lexer: Introduce "eat_while" and "eat_identifier" methods 2019-11-03 11:42:08 +03:00
Igor Aleksanov
0825b357d8 librustc_lexer: Add methods "first" and "second" to the "Cursor" 2019-11-03 11:39:39 +03:00
Eduard-Mihai Burtescu
d594fc2562 rustc_metadata: don't encode an empty slice for inferred_outlives. 2019-11-03 10:17:25 +02:00
Eduard-Mihai Burtescu
cd7cbaa38d rustc_metadata: replace predicates_defined_on with explicit_predicates_of and inferred_outlives_of. 2019-11-03 10:17:25 +02:00
Eduard-Mihai Burtescu
71eacef414 rustc_metadata: remove predicates_of and rely on predicates_defined_on alone. 2019-11-03 10:17:25 +02:00
Eduard-Mihai Burtescu
9e528ffe9c Revert "Greatly improve generics handling in rustdoc search"
This reverts commit 64382f4b78bdca6bea1dd06e4a1039646b04ae93.
2019-11-03 10:17:06 +02:00
Eduard-Mihai Burtescu
9b19cc0c21 Revert "Fix invalid bounds string generation in rustdoc"
This reverts commit ddd034aa6f04e7f452bca398e3982c4a5ef6c0bc.
2019-11-03 10:17:06 +02:00
bors
aa51f04073 Auto merge of #65779 - kevgrasso:E0308highlight, r=estebank
Highlight only relevant parts of type path in type errors

Resolves #57413.

Unfortunately the current Rust UI testing setup can't test that the correct colors are being used in a given output, so here's a screenshot of a small test program I wrote:
![image](https://user-images.githubusercontent.com/480789/67530063-f272af00-f68b-11e9-9f96-a211fc7666d4.png)
2019-11-03 08:01:29 +00:00
Eduard-Mihai Burtescu
8b06209c28 rustc_codegen_ssa: rename FnTypeLlvmExt to FnAbiLlvmExt. 2019-11-03 09:23:50 +02:00
Eduard-Mihai Burtescu
0ea40ec76a rustc_codegen_ssa: rename ArgTypeMethods to ArgAbiMethods. 2019-11-03 09:23:50 +02:00
Eduard-Mihai Burtescu
89c8f3abca rustc: rename {Fn,Arg}TypeExt to {Fn,Arg}AbiExt. 2019-11-03 09:23:50 +02:00
Eduard-Mihai Burtescu
6567154ede rustc_target: rename {Fn,Arg}Type to {Fn,Arg}Abi. 2019-11-03 09:23:43 +02:00
bors
6c1b220fd7 Auto merge of #63810 - oli-obk:const_offset_from, r=RalfJung,nikic
Make <*const/mut T>::offset_from `const fn`

This reenables offset_of cc @mjbshaw 	after https://github.com/rust-lang/rust/pull/63075 broke it
2019-11-02 22:26:54 +00:00
Ralf Jung
18089689c0 also adjust ignore in generated tests 2019-11-02 23:20:28 +01:00
Ralf Jung
05c07916ed consistent handling of missing sysroot spans 2019-11-02 23:15:45 +01:00
Ralf Jung
b93f48f71a adjust for missing spans on x86 test runner 2019-11-02 23:13:00 +01:00
Dylan MacKenzie
981e11e8ce Don't double-count simd_shuffle promotion candidates
The proper attribute was added to `simd_shuffle*` in
rust-lang/stdarch#825. This caused `promote_consts` to double-count its
second argument when recording promotion candidates, which caused
the promotion candidate compatibility check to fail.
2019-11-02 11:26:08 -07:00
bors
91fd6283e6 Auto merge of #65429 - Timmmm:withoptions, r=Mark-Simulacrum
Add File::with_options

This provides a more fluent API to create files with options, and also avoids the need to import OpenOptions.

This implements @aldanor's [suggestion](https://github.com/rust-lang/rfcs/pull/2615#issuecomment-448591304) which was popular.
2019-11-02 18:22:32 +00:00
Ralf Jung
7ff57edb93 also identiy MaybeUninit::uninit().assume_init() as dangerous 2019-11-02 17:52:57 +01:00
Simon Heath
567962d220 Add FFI bindings for Module::getInstructionCount()
Just to make it useable for profiling and such inside
rustc itself.  It was vaguely useful in
https://wiki.alopex.li/WhereRustcSpendsItsTime and I figured
I might as well upstream it; I may or may not ever get around
to doing more with it (hopefully I will), but it may be useful
for others.
2019-11-02 10:28:05 -04:00
Kevin Cox
e7fd580e7c
Rename SuperiorThanZero -> GreaterThanZero 2019-11-02 13:12:07 +00:00
Ralf Jung
df4e12d889 uninit/zeroed lint: warn against NULL vtables 2019-11-02 11:56:06 +01:00
Ohad Ravid
8c909344ed Suggest more likely code when encountering an incorrect assoc item referencing the current trait 2019-11-02 11:53:38 +01:00
bors
f39205b5d9 Auto merge of #66004 - eddyb:revert-early-gate, r=petrochenkov
Partially revert the early feature-gatings added in #65742.

The intent here is to address #65860 ASAP (in time for beta, ideally), while leaving as much of #65742 around as possible, to make it easier to re-enable later.

Therefore, I've only kept the parts of the revert that re-add the old (i.e. non-early) feature-gating checks that were removed in #65742, and the test reverts.

I've disabled the new early feature-gating checks from #65742 entirely for now, but it would be easy to put them behind a `-Z` flag, or turn them into warnings, which would allow us to keep tests for both the early and late versions of the checks - assuming that's desirable.

cc @nikomatsakis @Mark-Simulacrum @Centril
2019-11-02 10:48:59 +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
Tomasz Miąsko
b10f75ca64 Remove erroneous error-pattern from run-pass test 2019-11-02 10:28:28 +01:00
Ohad Ravid
5558fe8a92 Suggest correct code when encountering an incorrect trait bound referencing the current trait 2019-11-02 10:26:17 +01:00
Dmitry Kadashev
774e60b0c1 Prettify mismatched types error message in a special case
Type parameters are referenced in the error message after the previous
few commits (using span label). But when the main error message already
references the very same type parameter it becomes clumsy. Do not show
the additional label in this case as per code review comment by
@estebank.

Also this contains a small style fix.
2019-11-02 14:55:03 +07:00
Dmitry Kadashev
4e10b75951 Update tests
Update the tests to reflect changes to how type mismatch errors are
reported (two previous commits).
2019-11-02 13:23:28 +07:00
Dmitry Kadashev
036f182804 Show type param definitions in type mismatch errors
Fixes #47319.

Shows the type parameter definition(s) on type mismatch errors so the
context is clearer. Pretty much changes the following:

```
LL |     bar1(t);
   |          ^
   |          |
   |          expected enum `std::option::Option`, found type parameter `T`
```

into:

```
LL | fn foo1<T>(t: T) {
   |         - this type parameter
LL |     bar1(t);
   |          ^
   |          |
   |          expected enum `std::option::Option`, found type parameter `T`
```
2019-11-02 12:48:24 +07:00
Dmitry Kadashev
6a30ce639f Add type parameter name to type mismatch error messages
Part of #47319.

This just adds type parameter name to type mismatch error message, so
e.g. the following:

```
expected enum `std::option::Option`, found type parameter
```

becomes

```
expected enum `std::option::Option`, found type parameter `T`
```
2019-11-02 12:48:23 +07:00
Jeff Dickey
d9ec5fa88c doc(str): show example of chars().count() under len()
the docs are great at explaining that .len() isn't like in other
languages but stops short of explaining how to get the character length.

r? @steveklabnik
2019-11-01 20:18:33 -07:00
Mark Rousskov
692ae3d9fb Move has_panic_handler to query 2019-11-01 22:24:43 -04:00
Nicholas Nethercote
d0db290039 Remove the AsRef impl for SymbolStr.
Because it's highly magical, which goes against the goal of keeping
`SymbolStr` simple. Plus it's only used in a handful of places that
only require minor changes.
2019-11-02 09:01:02 +11:00
Nicholas Nethercote
b9cef6984b Simplify various Symbol use points.
Including removing a bunch of unnecessary `.as_str()` calls, and a bunch
of unnecessary sigils.
2019-11-02 09:01:02 +11:00
Nicholas Nethercote
5bc7084f7e Convert x.as_str().to_string() to x.to_string() where possible. 2019-11-02 09:01:00 +11:00
Nicholas Nethercote
9cf59b5178 Remove some unnecessary renamings of constants. 2019-11-02 09:00:28 +11:00
Nicholas Nethercote
e6d541a60a Add some explanatory comments. 2019-11-02 09:00:28 +11:00
Nicholas Nethercote
2f7d7c2ca4 Remove an erroneous comment. 2019-11-02 09:00:28 +11:00
Nicholas Nethercote
1b154a31cd Rename LocalInternedString as SymbolStr.
It makes the relationship with `Symbol` clearer. The `Str` suffix
matches the existing `Symbol::as_str()` method nicely, and is also
consistent with it being a wrapper of `&str`.
2019-11-02 09:00:27 +11:00
Vadim Petrochenkov
ecaa96418b Span cannot represent span.hi < span.lo
So we can remove the corresponding checks from various code
2019-11-01 23:40:07 +03:00
bors
87cbf0a547 Auto merge of #66021 - tmandry:rollup-y13l6n9, r=tmandry
Rollup of 16 pull requests

Successful merges:

 - #65112 (Add lint and tests for unnecessary parens around types)
 - #65470 (Don't hide ICEs from previous incremental compiles)
 - #65471 (Add long error explanation for E0578)
 - #65857 (rustdoc: Resolve module-level doc references more locally)
 - #65902 (Make ItemContext available for better diagnositcs)
 - #65914 (Use structured suggestion for unnecessary bounds in type aliases)
 - #65946 (Make `promote_consts` emit the errors when required promotion fails)
 - #65960 (doc: reword iter module example and mention other methods)
 - #65963 (update submodules to rust-lang)
 - #65972 (Fix libunwind build: Define __LITTLE_ENDIAN__ for LE targets)
 - #65977 (Fix incorrect diagnostics for expected type in E0271 with an associated type)
 - #65995 (Add error code E0743 for "C-variadic has been used on a non-foreign function")
 - #65997 (Fix outdated rustdoc of Once::init_locking function)
 - #66002 (Stabilize float_to_from_bytes feature)
 - #66005 (vxWorks: remove code related unix socket)
 - #66018 (Revert PR 64324: dylibs export generics again (for now))

Failed merges:

r? @ghost
2019-11-01 18:23:04 +00:00
Tyler Mandry
d6e35d1334
Rollup merge of #66018 - pnkfelix:issue-64872-revert-64324, r=alexcrichton
Revert PR 64324: dylibs export generics again (for now)

As discussed on PR #65781, this is a targeted attempt to undo the main semantic change from PR #64324, by putting `dylib` back in the set of crate types that export generic symbols.

The main reason to do this is that PR #64324 had unanticipated side-effects that caused bugs like #64872, and in the opinion of @alexcrichton and myself, the impact of #64872 is worse than #64319.

In other words, it is better for us, in the short term, to reopen #64319 as currently unfixed for now than to introduce new bugs like #64872.

Fix #64872

Reopen #64319
2019-11-01 11:20:29 -07:00
Tyler Mandry
81505e7fdc
Rollup merge of #66005 - Wind-River:master_base, r=alexcrichton
vxWorks: remove code related unix socket

r? @alexcrichton
2019-11-01 11:20:28 -07:00
Tyler Mandry
5b707f8ca9
Rollup merge of #66002 - lzutao:stablilize-float_to_from_bytes, r=SimonSapin
Stabilize float_to_from_bytes feature

FCP completed in https://github.com/rust-lang/rust/issues/60446#issuecomment-548440175
Closes #60446
2019-11-01 11:20:26 -07:00
Tyler Mandry
665d6479c4
Rollup merge of #65997 - spastorino:fix-init_locking-rustdoc, r=Mark-Simulacrum
Fix outdated rustdoc of Once::init_locking function

r? @Mark-Simulacrum

related to https://github.com/rust-lang/rust/pull/65979
2019-11-01 11:20:25 -07:00
Tyler Mandry
1ea66850af
Rollup merge of #65995 - GuillaumeGomez:add-err-code-E0743, r=estebank
Add error code E0743 for "C-variadic has been used on a non-foreign function"

Fixes https://github.com/rust-lang/rust/issues/65967
2019-11-01 11:20:24 -07:00