]> git.lizzy.rs Git - rust.git/log
rust.git
4 years agoAuto merge of #65874 - Nadrieril:clarify-usefulness, r=varkor
bors [Mon, 4 Nov 2019 21:06:50 +0000 (21:06 +0000)]
Auto merge of #65874 - Nadrieril:clarify-usefulness, r=varkor

Clarify pattern-matching usefulness algorithm

This PR clarifies a bit the usefulness algorithm by emphasizing that each row of the matrix can be seen as a sort of stack from which we pop constructors. It also moves code around to increase separation of concerns.

This is part of my splitting of https://github.com/rust-lang/rust/pull/65160 into smaller PRs.

4 years agoMinor style improvements
Daniel Henry-Mantilla [Sun, 3 Nov 2019 20:53:21 +0000 (21:53 +0100)]
Minor style improvements

Co-Authored-By: Ralf Jung <post@ralfj.de>
4 years agoUse any() in code shared between FreeBSD and NetBSD
nia [Mon, 4 Nov 2019 17:34:29 +0000 (17:34 +0000)]
Use any() in code shared between FreeBSD and NetBSD

4 years agoUse KERN_ARND syscall for random numbers on NetBSD, same as FreeBSD.
nia [Mon, 4 Nov 2019 17:16:11 +0000 (17:16 +0000)]
Use KERN_ARND syscall for random numbers on NetBSD, same as FreeBSD.

This system call is present on all supported NetBSD versions and
provides an endless stream of non-blocking random data from the
kernel's ChaCha20-based CSPRNG. It doesn't require a file descriptor
to be opened.

The system call is documented here (under kern.arandom):
https://netbsd.gw.com/cgi-bin/man-cgi?sysctl+7+NetBSD-7.0

And defined here:
https://nxr.netbsd.org/xref/src/sys/sys/sysctl.h#273

The semantics are the same as FreeBSD so reading 256 bytes per call
is fine.

Similar change for getrandom crate: rust-random/getrandom#115

4 years agoImplemented the home_dir for VxWorks
Umesh Kalappa [Wed, 30 Oct 2019 08:38:32 +0000 (01:38 -0700)]
Implemented the home_dir for VxWorks

4 years agobump smallvec to 1.0
Ralf Jung [Mon, 4 Nov 2019 14:59:09 +0000 (15:59 +0100)]
bump smallvec to 1.0

4 years agoDo not require extra LLVM backends for `x.py test` to pass
Vadim Petrochenkov [Mon, 4 Nov 2019 13:53:05 +0000 (16:53 +0300)]
Do not require extra LLVM backends for `x.py test` to pass

4 years agoalso test different integers
Ralf Jung [Mon, 4 Nov 2019 12:31:29 +0000 (13:31 +0100)]
also test different integers

4 years agotest offset_from with two integers
Ralf Jung [Mon, 4 Nov 2019 12:30:00 +0000 (13:30 +0100)]
test offset_from with two integers

4 years agoMiri: ptr_offset_from: support offset_from with twice the same non-null integer
Ralf Jung [Mon, 4 Nov 2019 12:24:27 +0000 (13:24 +0100)]
Miri: ptr_offset_from: support offset_from with twice the same non-null integer

4 years agoMiri: offset_from: do int-to-ptr casts when needed
Ralf Jung [Mon, 4 Nov 2019 12:07:36 +0000 (13:07 +0100)]
Miri: offset_from: do int-to-ptr casts when needed

4 years agoclean highlightSourceLines code
Guillaume Gomez [Mon, 4 Nov 2019 12:14:36 +0000 (13:14 +0100)]
clean highlightSourceLines code

4 years agoAuto merge of #66078 - petrochenkov:gateout, r=Centril
bors [Mon, 4 Nov 2019 12:16:00 +0000 (12:16 +0000)]
Auto merge of #66078 - petrochenkov:gateout, r=Centril

expand: Feature gate out-of-line modules in proc macro input

Extracted from https://github.com/rust-lang/rust/pull/64273.

We are currently gating attributes applied directly to `mod` items because there are unresolved questions about out-of-line modules and their behavior is very likely to change.

However, you can sneak an out-of-line module into an attribute macro input using modules nested into other items like
```rust
#[my_attr]
fn m() {
    #[path = "zzz.rs"]
    mod n; // what tokens does the `my_attr` macro see?
}
```
This PR prevents that and emits a feature gate error for this case as well.

r? @Centril
It would be great to land this before beta.

4 years agoexpand: Feature gate out-of-line modules in proc macro input
Vadim Petrochenkov [Sat, 7 Sep 2019 22:42:12 +0000 (01:42 +0300)]
expand: Feature gate out-of-line modules in proc macro input

4 years agolet caller of check_ptr_access_align control the error message
Ralf Jung [Mon, 4 Nov 2019 11:28:13 +0000 (12:28 +0100)]
let caller of check_ptr_access_align control the error message

4 years agoalso explain how to resolve MethodCall
Ralf Jung [Mon, 4 Nov 2019 09:16:16 +0000 (10:16 +0100)]
also explain how to resolve MethodCall

4 years agomore robust method checking through DefId and diagnostic_item
Ralf Jung [Mon, 4 Nov 2019 09:11:58 +0000 (10:11 +0100)]
more robust method checking through DefId and diagnostic_item

4 years agomore correct error msg
Ralf Jung [Mon, 4 Nov 2019 09:10:40 +0000 (10:10 +0100)]
more correct error msg

4 years agoavoid using nightly features
Ralf Jung [Mon, 4 Nov 2019 09:08:58 +0000 (10:08 +0100)]
avoid using nightly features

4 years agoAuto merge of #65835 - Mark-Simulacrum:lockless-lintbuffer, r=nikomatsakis
bors [Mon, 4 Nov 2019 09:00:39 +0000 (09:00 +0000)]
Auto merge of #65835 - Mark-Simulacrum:lockless-lintbuffer, r=nikomatsakis

Remove LintBuffer from Session

This moves the `LintBuffer` from `Session` into the `Resolver`, where it is used until lowering is done and then consumed by early lint passes. This also happily removes the failure mode of buffering lints too late where it would have previously lead to ICEs; it is statically no longer possible to do so.

I suspect that with a bit more work a similar move could be done for the lint buffer inside `ParseSess`, but this PR doesn't touch it (in part to keep itself small).

The last commit is the "interesting" commit -- the ones before it don't work (though they compile) as they sort of prepare the various crates for the lint buffer to be passed in rather than accessed through Session.

4 years agoQPath docs: mention how to resolve them
Ralf Jung [Mon, 4 Nov 2019 08:50:59 +0000 (09:50 +0100)]
QPath docs: mention how to resolve them

4 years agoAuto merge of #64878 - XAMPPRocky:relnotes-1.39.0, r=XAMPPRocky
bors [Mon, 4 Nov 2019 05:42:40 +0000 (05:42 +0000)]
Auto merge of #64878 - XAMPPRocky:relnotes-1.39.0, r=XAMPPRocky

Updated RELEASES.md for 1.39.0

### [Rendered](https://github.com/XAMPPRocky/rust/blob/relnotes-1.39.0/RELEASES.md)

r? @Mark-Simulacrum
cc @rust-lang/release

4 years agolibrustc_lexer: Make nth_char method private
Igor Aleksanov [Sun, 3 Nov 2019 09:57:59 +0000 (12:57 +0300)]
librustc_lexer: Make nth_char method private

4 years agolibrustc_lexer: Reorder imports in lib.rs
Igor Aleksanov [Sun, 3 Nov 2019 09:57:12 +0000 (12:57 +0300)]
librustc_lexer: Reorder imports in lib.rs

4 years agolibrustc_lexer: Simplify "lifetime_or_char" method
Igor Aleksanov [Sun, 3 Nov 2019 09:56:49 +0000 (12:56 +0300)]
librustc_lexer: Simplify "lifetime_or_char" method

4 years agouse silent emitter for rustdoc highlighting pass
Andy Russell [Sun, 3 Nov 2019 17:04:01 +0000 (12:04 -0500)]
use silent emitter for rustdoc highlighting pass

4 years agoDelete lint buffer from Session
Mark Rousskov [Fri, 25 Oct 2019 17:41:51 +0000 (13:41 -0400)]
Delete lint buffer from Session

4 years agoMove crate type checking later
Mark Rousskov [Fri, 25 Oct 2019 17:23:18 +0000 (13:23 -0400)]
Move crate type checking later

This allows us to directly pass in a lint buffer

4 years agoUtilize Resolver lint buffer during HIR lowering
Mark Rousskov [Fri, 25 Oct 2019 13:20:18 +0000 (09:20 -0400)]
Utilize Resolver lint buffer during HIR lowering

4 years agoMigrate resolver over to internal lint buffer
Mark Rousskov [Fri, 25 Oct 2019 13:15:33 +0000 (09:15 -0400)]
Migrate resolver over to internal lint buffer

4 years agoOnly permit taking buffered lints inside lint internals
Mark Rousskov [Fri, 25 Oct 2019 12:08:53 +0000 (08:08 -0400)]
Only permit taking buffered lints inside lint internals

4 years agoRemove unused get_any method
Mark Rousskov [Fri, 25 Oct 2019 12:06:01 +0000 (08:06 -0400)]
Remove unused get_any method

4 years agoAuto merge of #65838 - estebank:resilient-recovery, r=Centril
bors [Mon, 4 Nov 2019 02:30:45 +0000 (02:30 +0000)]
Auto merge of #65838 - estebank:resilient-recovery, r=Centril

Reduce amount of errors given unclosed delimiter

When in a file with a non-terminated item, catch the error and consume
the block instead of trying to recover it on a more granular way in order to
reduce the amount of unrelated errors that would be fixed after adding
the missing closing brace. Also point out the possible location of the
missing closing brace.

Fix #63690.

4 years agoAuto merge of #65780 - GuillaumeGomez:move-help-popup-generation-code, r=Mark-Simulacrum
bors [Sun, 3 Nov 2019 21:55:48 +0000 (21:55 +0000)]
Auto merge of #65780 - GuillaumeGomez:move-help-popup-generation-code, r=Mark-Simulacrum

Move help popup generation code

The first commit is just a small cleanup.

The idea behind this PR is to reduce a bit more the generated HTML files by moving the duplicated code into one place instead.

r? @kinnison

4 years agoDo not needlessly write-lock
Mark Rousskov [Sun, 3 Nov 2019 21:52:27 +0000 (16:52 -0500)]
Do not needlessly write-lock

4 years agoDon't extend lifetime of temp in `Repeat` expressions
Dylan MacKenzie [Wed, 23 Oct 2019 17:30:51 +0000 (10:30 -0700)]
Don't extend lifetime of temp in `Repeat` expressions

4 years agoTest that borrows of projections are promoted everywhere
Dylan MacKenzie [Wed, 23 Oct 2019 16:55:20 +0000 (09:55 -0700)]
Test that borrows of projections are promoted everywhere

Previously, this worked in `fn`s but not `const`s or `static`s.

4 years agoMark entire local as promoted even if only part is used
Dylan MacKenzie [Wed, 23 Oct 2019 16:46:52 +0000 (09:46 -0700)]
Mark entire local as promoted even if only part is used

4 years agoAuto merge of #65646 - Amanieu:foreign-exceptions, r=nikomatsakis
bors [Sun, 3 Nov 2019 18:36:59 +0000 (18:36 +0000)]
Auto merge of #65646 - Amanieu:foreign-exceptions, r=nikomatsakis

Allow foreign exceptions to unwind through Rust code and Rust panics to unwind through FFI

This PR fixes interactions between Rust panics and foreign (mainly C++) exceptions.

C++ exceptions (and other FFI exceptions) can now safely unwind through Rust code:
- The FFI function causing the unwind must be marked with `#[unwind(allowed)]`. If this is not the case then LLVM may optimize landing pads away with the assumption that they are unreachable.
- Drop code will be executed as the exception unwinds through the stack, as with a Rust panic.
- `catch_unwind` will *not* catch the exception, instead the exception will silently continue unwinding past it.

Rust panics can now safely unwind through C++ code:
- C++ destructors will be called as the stack unwinds.
- The Rust panic can only be caught with `catch (...)`, after which it can be either rethrown or discarded.
- C++ cannot name the type of the Rust exception object used for unwinding, which means that it can't be caught explicitly or have its contents inspected.

Tests have been added to ensure all of the above works correctly.

Some notes about non-C++ exceptions:
- `pthread_cancel` and `pthread_exit` use unwinding on glibc. This has the same behavior as a C++ exception: destructors are run but it cannot be caught by `catch_unwind`.
- `longjmp` on Windows is implemented using unwinding. Destructors are run on MSVC, but not on MinGW. In both cases the unwind cannot be caught by `catch_unwind`.
- As with C++ exceptions, you need to mark the relevant FFI functions with `#[unwind(allowed)]`, otherwise LLVM will optimize out the destructors since they seem unreachable.

I haven't updated any of the documentation, so officially unwinding through FFI is still UB. However this is a step towards making it well-defined.

Fixes #65441

cc @gnzlbg
r? @alexcrichton

4 years agoConfigure LLVM module PIC level
Samuel Holland [Sun, 3 Nov 2019 16:52:00 +0000 (10:52 -0600)]
Configure LLVM module PIC level

As of LLVM 9, this is required for 32-bit PowerPC to properly generate
PLT references. Previously, only BigPIC was supported; now LLVM supports
both BigPIC and SmallPIC, and there is no default value provided.

4 years agoAuto merge of #65759 - tmiasko:ui, r=petrochenkov
bors [Sun, 3 Nov 2019 15:14:09 +0000 (15:14 +0000)]
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

4 years agoFix macOS tests
Amanieu d'Antras [Sun, 3 Nov 2019 11:23:44 +0000 (11:23 +0000)]
Fix macOS tests

4 years agoMake Emscripten unwinding use a valid type_info
Amanieu d'Antras [Sun, 27 Oct 2019 22:33:16 +0000 (22:33 +0000)]
Make Emscripten unwinding use a valid type_info

This allows catch_panic to ignore C++ exceptions.

4 years agoMake SEH exceptions use a rust_panic type instead of unsigned __int64*
Amanieu d'Antras [Sun, 27 Oct 2019 22:33:25 +0000 (22:33 +0000)]
Make SEH exceptions use a rust_panic type instead of unsigned __int64*

4 years agoHack to make C++ exceptions test work on i686-pc-windows-gnu
Amanieu d'Antras [Sat, 26 Oct 2019 16:41:55 +0000 (17:41 +0100)]
Hack to make C++ exceptions test work on i686-pc-windows-gnu

4 years agoAllow foreign exceptions to unwind through Rust code
Amanieu d'Antras [Mon, 21 Oct 2019 01:46:04 +0000 (02:46 +0100)]
Allow foreign exceptions to unwind through Rust code

4 years agoEnable C++ exceptions on MSVC when building C++ tests
Amanieu d'Antras [Sat, 26 Oct 2019 01:47:06 +0000 (02:47 +0100)]
Enable C++ exceptions on MSVC when building C++ tests

4 years agoAdd -lstdc++ for run-make-fulldeps tests on MinGW
Amanieu d'Antras [Tue, 22 Oct 2019 13:12:33 +0000 (14:12 +0100)]
Add -lstdc++ for run-make-fulldeps tests on MinGW

4 years agoAttempt to clarify LTO and codegen-units.
Eric Huss [Sat, 2 Nov 2019 16:47:14 +0000 (09:47 -0700)]
Attempt to clarify LTO and codegen-units.

4 years agosyntax: Avoid span arithmetics for delimiter tokens
Vadim Petrochenkov [Sun, 3 Nov 2019 11:58:01 +0000 (14:58 +0300)]
syntax: Avoid span arithmetics for delimiter tokens

4 years agoAuto merge of #65827 - AnthonyMikh:out_of_the_loop, r=estebank
bors [Sun, 3 Nov 2019 11:51:44 +0000 (11:51 +0000)]
Auto merge of #65827 - AnthonyMikh:out_of_the_loop, r=estebank

Remove a loop which runs exactly once

Though the code seems to work properly, it is worth removing the loop entirely in order to not confuse the reader.

r? @estebank

4 years agodon't fail manifest creation if the toolstate file is missing or mal-formed
Ralf Jung [Sun, 3 Nov 2019 10:55:05 +0000 (11:55 +0100)]
don't fail manifest creation if the toolstate file is missing or mal-formed

4 years agowhen Miri tests are not passing, do not add Miri component
Ralf Jung [Sun, 3 Nov 2019 10:47:07 +0000 (11:47 +0100)]
when Miri tests are not passing, do not add Miri component

4 years agolibrustc_lexer: Simplify "raw_double_quoted_string" method
Igor Aleksanov [Sun, 3 Nov 2019 09:55:50 +0000 (12:55 +0300)]
librustc_lexer: Simplify "raw_double_quoted_string" method

4 years agolibrustc_lexer: Simplify "double_quoted_string" method
Igor Aleksanov [Sun, 3 Nov 2019 09:55:05 +0000 (12:55 +0300)]
librustc_lexer: Simplify "double_quoted_string" method

4 years agolibrustc_lexer: Simplify "single_quoted_string" method
Igor Aleksanov [Sun, 3 Nov 2019 09:54:23 +0000 (12:54 +0300)]
librustc_lexer: Simplify "single_quoted_string" method

4 years agoUse check-pass for never type tests
Tomasz Miąsko [Sat, 2 Nov 2019 00:00:00 +0000 (00:00 +0000)]
Use check-pass for never type tests

4 years agoAvoid matching type in huge-struct test error annotation
Tomasz Miąsko [Tue, 29 Oct 2019 00:00:00 +0000 (00:00 +0000)]
Avoid matching type in huge-struct test error annotation

The concrete type that will be too big is target dependent. Avoid
matching it in error annotation to make test work correctly across
different targets.

4 years agoUpdate error annotations in ui-fulldeps tests that successfully compile
Tomasz Miąsko [Thu, 24 Oct 2019 00:00:00 +0000 (00:00 +0000)]
Update error annotations in ui-fulldeps tests that successfully compile

4 years agoValidate error patterns and error annotation in ui tests when present
Tomasz Miąsko [Thu, 24 Oct 2019 00:00:00 +0000 (00:00 +0000)]
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.

4 years agoUpdate error annotations positions
Tomasz Miąsko [Thu, 24 Oct 2019 00:00:00 +0000 (00:00 +0000)]
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.

4 years agoAvoid mixing error patterns with error annotations
Tomasz Miąsko [Thu, 24 Oct 2019 00:00:00 +0000 (00:00 +0000)]
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.

4 years agolibrustc_lexer: Make "eat_float_exponent" return bool instead of result
Igor Aleksanov [Sun, 3 Nov 2019 08:43:47 +0000 (11:43 +0300)]
librustc_lexer: Make "eat_float_exponent" return bool instead of result

4 years agolibrustc_lexer: Introduce "eat_while" and "eat_identifier" methods
Igor Aleksanov [Sun, 3 Nov 2019 08:42:08 +0000 (11:42 +0300)]
librustc_lexer: Introduce "eat_while" and "eat_identifier" methods

4 years agolibrustc_lexer: Add methods "first" and "second" to the "Cursor"
Igor Aleksanov [Sun, 3 Nov 2019 08:39:39 +0000 (11:39 +0300)]
librustc_lexer: Add methods "first" and "second" to the "Cursor"

4 years agoAuto merge of #65779 - kevgrasso:E0308highlight, r=estebank
bors [Sun, 3 Nov 2019 08:01:29 +0000 (08:01 +0000)]
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)

4 years agorustc_codegen_ssa: rename FnTypeLlvmExt to FnAbiLlvmExt.
Eduard-Mihai Burtescu [Tue, 29 Oct 2019 17:30:31 +0000 (19:30 +0200)]
rustc_codegen_ssa: rename FnTypeLlvmExt to FnAbiLlvmExt.

4 years agorustc_codegen_ssa: rename ArgTypeMethods to ArgAbiMethods.
Eduard-Mihai Burtescu [Tue, 29 Oct 2019 17:29:42 +0000 (19:29 +0200)]
rustc_codegen_ssa: rename ArgTypeMethods to ArgAbiMethods.

4 years agorustc: rename {Fn,Arg}TypeExt to {Fn,Arg}AbiExt.
Eduard-Mihai Burtescu [Tue, 29 Oct 2019 17:17:16 +0000 (19:17 +0200)]
rustc: rename {Fn,Arg}TypeExt to {Fn,Arg}AbiExt.

4 years agorustc_target: rename {Fn,Arg}Type to {Fn,Arg}Abi.
Eduard-Mihai Burtescu [Tue, 29 Oct 2019 14:35:26 +0000 (16:35 +0200)]
rustc_target: rename {Fn,Arg}Type to {Fn,Arg}Abi.

4 years agoAuto merge of #63810 - oli-obk:const_offset_from, r=RalfJung,nikic
bors [Sat, 2 Nov 2019 22:26:54 +0000 (22:26 +0000)]
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

4 years agoadjust for missing spans on x86 test runner
Ralf Jung [Sat, 2 Nov 2019 22:13:00 +0000 (23:13 +0100)]
adjust for missing spans on x86 test runner

4 years agoDon't double-count `simd_shuffle` promotion candidates
Dylan MacKenzie [Sat, 2 Nov 2019 18:23:16 +0000 (11:23 -0700)]
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.

4 years agoAuto merge of #65429 - Timmmm:withoptions, r=Mark-Simulacrum
bors [Sat, 2 Nov 2019 18:22:32 +0000 (18:22 +0000)]
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.

4 years agoalso identiy MaybeUninit::uninit().assume_init() as dangerous
Ralf Jung [Sat, 2 Nov 2019 15:12:33 +0000 (16:12 +0100)]
also identiy MaybeUninit::uninit().assume_init() as dangerous

4 years agoAdd FFI bindings for Module::getInstructionCount()
Simon Heath [Wed, 23 Oct 2019 13:08:26 +0000 (09:08 -0400)]
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.

4 years agoRename SuperiorThanZero -> GreaterThanZero
Kevin Cox [Sat, 2 Nov 2019 13:12:07 +0000 (13:12 +0000)]
Rename SuperiorThanZero -> GreaterThanZero

4 years agouninit/zeroed lint: warn against NULL vtables
Ralf Jung [Sat, 2 Nov 2019 10:56:06 +0000 (11:56 +0100)]
uninit/zeroed lint: warn against NULL vtables

4 years agoSuggest more likely code when encountering an incorrect assoc item referencing the...
Ohad Ravid [Sat, 2 Nov 2019 08:49:05 +0000 (09:49 +0100)]
Suggest more likely code when encountering an incorrect assoc item referencing the current trait

4 years agoAuto merge of #66004 - eddyb:revert-early-gate, r=petrochenkov
bors [Sat, 2 Nov 2019 10:48:59 +0000 (10:48 +0000)]
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

4 years agoUpdate error annotations in tests that successfully compile
Tomasz Miąsko [Thu, 24 Oct 2019 00:00:00 +0000 (00:00 +0000)]
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.

4 years agoRemove erroneous error-pattern from run-pass test
Tomasz Miąsko [Thu, 24 Oct 2019 00:00:00 +0000 (00:00 +0000)]
Remove erroneous error-pattern from run-pass test

4 years agoSuggest correct code when encountering an incorrect trait bound referencing the curre...
Ohad Ravid [Fri, 1 Nov 2019 12:50:36 +0000 (13:50 +0100)]
Suggest correct code when encountering an incorrect trait bound referencing the current trait

4 years agoPrettify mismatched types error message in a special case
Dmitry Kadashev [Sat, 2 Nov 2019 07:51:10 +0000 (14:51 +0700)]
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.

4 years agoUpdate tests
Dmitry Kadashev [Fri, 1 Nov 2019 03:58:37 +0000 (10:58 +0700)]
Update tests

Update the tests to reflect changes to how type mismatch errors are
reported (two previous commits).

4 years agoShow type param definitions in type mismatch errors
Dmitry Kadashev [Thu, 31 Oct 2019 10:20:33 +0000 (17:20 +0700)]
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`
```

4 years agoAdd type parameter name to type mismatch error messages
Dmitry Kadashev [Thu, 31 Oct 2019 09:57:29 +0000 (16:57 +0700)]
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`
```

4 years agodoc(str): show example of chars().count() under len()
Jeff Dickey [Sat, 2 Nov 2019 02:42:33 +0000 (19:42 -0700)]
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

4 years agoMove has_panic_handler to query
Mark Rousskov [Mon, 28 Oct 2019 21:07:15 +0000 (17:07 -0400)]
Move has_panic_handler to query

4 years agoRemove the `AsRef` impl for `SymbolStr`.
Nicholas Nethercote [Tue, 22 Oct 2019 00:21:37 +0000 (11:21 +1100)]
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.

4 years agoSimplify various `Symbol` use points.
Nicholas Nethercote [Tue, 22 Oct 2019 00:04:25 +0000 (11:04 +1100)]
Simplify various `Symbol` use points.

Including removing a bunch of unnecessary `.as_str()` calls, and a bunch
of unnecessary sigils.

4 years agoConvert `x.as_str().to_string()` to `x.to_string()` where possible.
Nicholas Nethercote [Mon, 21 Oct 2019 21:31:37 +0000 (08:31 +1100)]
Convert `x.as_str().to_string()` to `x.to_string()` where possible.

4 years agoRemove some unnecessary renamings of constants.
Nicholas Nethercote [Mon, 21 Oct 2019 21:22:23 +0000 (08:22 +1100)]
Remove some unnecessary renamings of constants.

4 years agoAdd some explanatory comments.
Nicholas Nethercote [Tue, 22 Oct 2019 00:09:42 +0000 (11:09 +1100)]
Add some explanatory comments.

4 years agoRemove an erroneous comment.
Nicholas Nethercote [Mon, 21 Oct 2019 19:22:59 +0000 (06:22 +1100)]
Remove an erroneous comment.

4 years agoRename `LocalInternedString` as `SymbolStr`.
Nicholas Nethercote [Mon, 21 Oct 2019 19:20:51 +0000 (06:20 +1100)]
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`.

4 years ago`Span` cannot represent `span.hi < span.lo`
Vadim Petrochenkov [Fri, 1 Nov 2019 20:24:07 +0000 (23:24 +0300)]
`Span` cannot represent `span.hi < span.lo`

So we can remove the corresponding checks from various code

4 years agoAuto merge of #66021 - tmandry:rollup-y13l6n9, r=tmandry
bors [Fri, 1 Nov 2019 18:23:04 +0000 (18:23 +0000)]
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

4 years agoRollup merge of #66018 - pnkfelix:issue-64872-revert-64324, r=alexcrichton
Tyler Mandry [Fri, 1 Nov 2019 18:20:29 +0000 (11:20 -0700)]
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

4 years agoRollup merge of #66005 - Wind-River:master_base, r=alexcrichton
Tyler Mandry [Fri, 1 Nov 2019 18:20:28 +0000 (11:20 -0700)]
Rollup merge of #66005 - Wind-River:master_base, r=alexcrichton

vxWorks: remove code related unix socket

r? @alexcrichton