Commit Graph

99230 Commits

Author SHA1 Message Date
Mark Mansi
23db4504aa minor fixes 2019-09-12 17:42:10 -05:00
Mark Mansi
68b1a8741e Various refactorings to clean up nll diagnostics
- Create ErrorReportingCtx and ErrorConstraintInfo, vasting reducing the
  number of arguments passed around everywhere in the error reporting code
- Create RegionErrorNamingCtx, making a given lifetime have consistent
  numbering thoughout all error messages for that MIR def.
- Make the error reporting code return the DiagnosticBuilder rather than
  directly buffer the Diagnostic. This makes it easier to modify the
  diagnostic later, e.g. to add suggestions.
2019-09-12 16:43:36 -05:00
bors
a5e3de3437 Auto merge of #64360 - varkor:foreign-items-diagnostic-const-generics, r=cramertj
Correct the polymorphic extern fn error for const parameters

Before, any polymorphism on extern functions was assumed to be type polymorphism.
2019-09-12 21:20:06 +00:00
Santiago Pastorino
232a4a2881
Destructure instead of using split_at 2019-09-12 16:03:38 -03:00
Santiago Pastorino
9c0bbe09e9
Use fold 2019-09-12 15:25:33 -03:00
Eduard-Mihai Burtescu
e9214a147b codegen: be more explicit about setting giving names to allocas. 2019-09-12 19:04:30 +03:00
Aleksi Juvani
fe6d626abc Ignore linker env vars set for macOS on iOS targets 2019-09-12 17:14:54 +03:00
bors
eb48d6bdee Auto merge of #64359 - varkor:opaque-ty-in-extern, r=estebank
Forbid opaque types in `extern "C"` blocks

Fixes #64338.
2019-09-12 12:40:31 +00:00
Mateusz Mikuła
612c3947b4 Trim rustc-workspace-hack 2019-09-12 14:12:12 +02:00
Aleksi Juvani
e715d03275 Remove env vars instead of setting them to an empty string 2019-09-12 13:47:17 +03:00
bors
28e85d7ae7 Auto merge of #64328 - Mark-Simulacrum:rustdoc-find-rustc, r=GuillaumeGomez
rustdoc: change doctests locating rustc binary

We previously used the "naive" approach of replacing the `current_exe()`'s file name with rustc, but now load from the sysroot by default (`$sysroot/bin/rustc`). The functionality of locating the sysroot overlaps/is the same as the functionality used by codegen backend loading; this ensures that any failure cases we've introduced are not exceeding those, and that improvements to finding the sysroot for loading codegen backends likewise enhance rustdoc.

The second commit adds an unstable `--test-builder` flag to rustdoc, and is largely separate (I can split into separate PR, but it's a simple and related change). This is largely intended for "advanced" users at this point (I'm not sure if we'll ever stabilize it); it permits use of a different rustc binary for rustdoc compilation of doctests than the rustdoc binary used when loading. Note, that this may not be what you want as the parsers and such differ (and rustdoc uses its own libsyntax, etc.). However, I've been told that running doctests in miri may be assisted by this change, so I've implemented it; I'll file a tracking issue for it if there's interest in it (and we land this PR).
2019-09-12 08:29:55 +00:00
bors
f71826e8f2 Auto merge of #64303 - nnethercote:avoid-more-Symbol-to-string-operations, r=petrochenkov
Avoid more `Symbol`-to-string operations

These commits avoid various `Symbol`-to-string conversions, by doing more operations directly on `Symbol`s. This requires adding a few more static `Symbol`s to the binary.

r? @petrochenkov
2019-09-12 04:15:27 +00:00
Nicholas Nethercote
7f0637da51 Shrink SubregionOrigin.
It's currently 120 bytes on x86-64, due to one oversized variant
(`Subtype`). This commit boxes `Subtype`'s contents, reducing the size
of `SubregionOrigin` to 32 bytes.

The change speeds things up by avoiding lots of `memcpy` calls, mostly
relating to `RegionConstraintData::constraints`, which is a `BTreeMap`
with `SubregionOrigin` values.
2019-09-12 13:36:01 +10:00
Baoshan
08fa803946
Merge pull request #22 from Wind-River/master_002
declare EnvKey before use to fix build error
2019-09-11 19:34:23 -07:00
bors
c9edc02e83 Auto merge of #64334 - jyao1:i686-master, r=joshtriplett
Add i686-unknown-uefi target

This adds a new rustc target-configuration called 'i686-unknown_uefi'.
This is similar to existing x86_64-unknown_uefi target.

The i686-unknown-uefi target can be used to build Intel Architecture
32bit UEFI application. The ABI defined in UEFI environment (aka IA32)
is similar to cdecl.

We choose i686-unknown-uefi-gnu instead of i686-unknown-uefi to avoid
the intrinsics generated by LLVM. The detail of root-cause and solution
analysis is added as comment in the code.
For x86_64-unknown-uefi, we cannot use -gnu, because the ABI between
MSVC and GNU is totally different, and UEFI chooses ABI similar to MSVC.
For i686-unknown-uefi, the UEFI chooses cdecl ABI, which is same as
MSVC and GNU. According to LLVM code, the only differences between MSVC
and GNU are fmodf(f32), longjmp() and TLS, which have no impact to UEFI.
As such, using i686-unknown-uefi-gnu is the simplest way to pass the build.

Adding the undefined symbols, such as _aulldiv() to rust compiler-builtins
is out of scope. But it may be considered later.

The scope of this patch is limited to support target-configuration.

No standard library support is added in this patch. Such work can be
done in future enhancement.

Cc: Josh Triplett <josh.triplett@intel.com>
Reviewed-by: Josh Triplett <josh.triplett@intel.com>
2019-09-11 22:40:11 +00:00
Nicholas Nethercote
2fcd870711 Box DiagnosticBuilder.
It's a large type -- 176 bytes on 64-bit. And it's passed around and
returned from a lot of functions, including within PResult.

This commit boxes it, which reduces memory traffic. In particular,
`PResult` shrinks to 16 bytes in the best case; this reduces instruction
counts by up to 2% on various workloads.
2019-09-12 08:29:17 +10:00
Santiago Pastorino
87420cd1bc
Make Place Boxed on Statement to reduce size from 64 bytes to 32 bytes 2019-09-11 16:28:06 -03:00
Kornel
223600ac2c Guarantee vec.clear/truncate is O(1) for trivial types 2019-09-11 20:14:23 +01:00
bors
f0b58fcf03 Auto merge of #64271 - Centril:non-exhaustive-peel-refs, r=estebank
check_match: refactor + improve non-exhaustive diagnostics for default binding modes

Refactor `check_match` a bit with more code-reuse and improve the diagnostics for a non-exhaustive pattern match by peeling off any references from the scrutinee type so that the "defined here" label is added in more cases. For example:

```rust
error[E0004]: non-exhaustive patterns: `&mut &B` not covered
 --> foo.rs:4:11
  |
1 | enum E { A, B }
  | ---------------
  | |           |
  | |           not covered
  | `E` defined here
...
4 |     match x {
  |           ^ pattern `&mut &B` not covered
  |
  = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
```

Moreover, wrt. "defined here", we give irrefutable pattern matching (i.e. in `let`, `for`, and `fn` parameters) a more consistent treatment in line with `match`.

r? @estebank
2019-09-11 18:46:18 +00:00
Mateusz Mikuła
935394f4f8 Upgrade parking_lot and tempfile rustc dependencies 2019-09-11 19:15:32 +02:00
bors
fe6d05a8b3 Auto merge of #64154 - alexcrichton:std-backtrace, r=sfackler
std: Add a `backtrace` module

This commit adds a `backtrace` module to the standard library, as
designed in [RFC 2504]. The `Backtrace` type is intentionally very
conservative, effectively only allowing capturing it and printing it.

Additionally this commit also adds a `backtrace` method to the `Error`
trait which defaults to returning `None`, as specified in [RFC 2504].
More information about the design here can be found in [RFC 2504] and in
the [tracking issue].

Implementation-wise this is all based on the `backtrace` crate and very
closely mirrors the `backtrace::Backtrace` type on crates.io. Otherwise
it's pretty standard in how it handles everything internally.

[RFC 2504]: https://github.com/rust-lang/rfcs/blob/master/text/2504-fix-error.md
[tracking issue]: https://github.com/rust-lang/rust/issues/53487

cc #53487
2019-09-11 14:46:08 +00:00
Alex Crichton
b88bcf0f9d Update bundled OpenSSL to 1.1.1d
Brings in a few minor security fixes to the distributed Cargo/etc.
2019-09-11 06:55:40 -07:00
Tomasz Różański
a8c5f90b06 Fix inconsistent link formatting. 2019-09-11 14:03:40 +02:00
Baoshan Pang
b731e11d52 declare EnvKey before use to fix build error 2019-09-10 21:35:01 -07:00
Baoshan
5e8bf872f6
Merge pull request #21 from rust-lang/master
Sync with rust-lang/rust master branch
2019-09-10 21:21:48 -07:00
Nicholas Nethercote
8138efae16 Avoid two Symbol::as_str() calls. 2019-09-11 13:30:21 +10:00
Nicholas Nethercote
4fd18c9c06 Use Symbol in external_path(). 2019-09-11 11:31:38 +10:00
Nicholas Nethercote
5e5611ab43 Use Symbol in weak_lang_items!. 2019-09-11 11:31:38 +10:00
Nicholas Nethercote
fe08ac6da4 Use ast::Name in report_ambiguous_associated_type(). 2019-09-11 11:31:38 +10:00
Nicholas Nethercote
482d63673c Use Symbol in Linker. 2019-09-11 11:31:38 +10:00
Nicholas Nethercote
5a57f46cbc Store InternedStrings in AssertModuleSource::available_cgus. 2019-09-11 11:31:38 +10:00
Baoshan
83e7976c84
Merge pull request #20 from Wind-River/rand
use randSecure and randABytes
2019-09-10 17:53:54 -07:00
bors
74d5c70b17 Auto merge of #64369 - Centril:rollup-g875ozi, r=Centril
Rollup of 6 pull requests

Successful merges:

 - #64060 (Improve hygiene of `alloc::format!`)
 - #64072 (Replace file_stem by file_name in rustdoc markdown)
 - #64129 (vxWorks: set DEFAULT_MIN_STACK_SIZE to 256K and use min_stack to pass initial stack size to rtpSpawn)
 - #64188 (rustc: Allow the cdylib crate type with wasm32-wasi)
 - #64326 (Fixed documentation within c_str::from_ptr)
 - #64349 (documentation for AtomicPtr CAS operations)

Failed merges:

r? @ghost
2019-09-11 00:39:40 +00:00
Mazdak Farrokhzad
4f1d50e65f
Rollup merge of #64349 - arnohaase:pr_documentation_atomicptr, r=cramertj
documentation for AtomicPtr CAS operations

The examples in the documentation for AtomicPtr CAS operations only show code that does *not* perform the CAS operation. I suggest to change them so that they actually do exchange the AtomicPtr's value.
2019-09-11 02:38:10 +02:00
Mazdak Farrokhzad
57df63ce7d
Rollup merge of #64326 - hman523:master, r=joshtriplett
Fixed documentation within c_str::from_ptr

Fixed the documentation issue mentioned in #63590
2019-09-11 02:38:09 +02:00
Mazdak Farrokhzad
751aec8b47
Rollup merge of #64188 - alexcrichton:wasi-cdylib, r=varkor
rustc: Allow the cdylib crate type with wasm32-wasi

The wasm32-wasi target respects configuration around `crt-static` in
general, but is defaulted to being static. This interacted badly with
code which validated the `cdylib` crate type for `wasm32-wasi`,
erroneously saying that the `cdylib` crate type wasn't supported on
`wasm32-wasi` by default. This commit sets the appropriate flag in
`wasm32_wasi`'s target specification to indicate that the `cdylib` crate
type is supported regardless of `crt-static`

Closes #64187
2019-09-11 02:38:07 +02:00
Mazdak Farrokhzad
34f38d9809
Rollup merge of #64129 - Wind-River:master_003, r=alexcrichton
vxWorks: set DEFAULT_MIN_STACK_SIZE to 256K and use min_stack to pass initial stack size to rtpSpawn

vxWorks: set DEFAULT_MIN_STACK_SIZE to 256K and use min_stack to pass initial stack size to rtpSpawn

r? @alexcrichton
cc @n-salim
2019-09-11 02:38:06 +02:00
Mazdak Farrokhzad
ec06633e19
Rollup merge of #64072 - limira:patch-1, r=ollie27
Replace file_stem by file_name in rustdoc markdown

Before this PR, a file name like `some.file.md` will be output to a file named `some.html` with is not correct because the expected output file must be `some.file.html`
2019-09-11 02:38:04 +02:00
Mazdak Farrokhzad
e757d33e73
Rollup merge of #64060 - petrochenkov:unstdhyg, r=tmandry
Improve hygiene of `alloc::format!`

`format` now uses `format_args` though a `__export` module, as described in https://github.com/rust-lang/rust/issues/63687#issuecomment-526254208.

Fixes https://github.com/rust-lang/rust/issues/63687
2019-09-11 02:38:03 +02:00
varkor
ef62e05062 Make wording less confusing 2019-09-11 00:29:35 +01:00
Baoshan Pang
5287885481 use randSecure and randABytes 2019-09-10 15:11:34 -07:00
varkor
14e6947fa4 Correct the polymorphic extern fn error for const parameters 2019-09-10 22:30:46 +01:00
varkor
9d712177a3 Refactor "not FFI-safe" diagnostic 2019-09-10 22:29:31 +01:00
Mark Rousskov
093cbd60fc Add unstable --test-builder to rustdoc
This allows overriding the rustc binary used to build tests; it should
not generally be necessary as we fallback to the sysroot.
2019-09-10 16:59:31 -04:00
Mark Rousskov
2fc32b9e72 Locate rustc binary similarly to codegen backend loading
This ensures that the failure cases for finding the codegen backend and
for finding the rustc binary are essentially the same, and since we
almost always will load the codegen backend, this is essentially meaning
that the rustc change is not a regression.
2019-09-10 16:57:14 -04:00
Baoshan
665291cfa3
Merge pull request #19 from Wind-River/min_stack_size
remove Copyright notic
2019-09-10 13:39:12 -07:00
Eric Huss
02ff4524b5 Update cargo 2019-09-10 12:01:05 -07:00
varkor
79368db1ce Surround PhantomData in backticks 2019-09-10 19:52:35 +01:00
varkor
df7e496f85 Forbid opaque types in extern blocks 2019-09-10 18:16:35 +01:00
Baoshan Pang
5318f98c06 remove Copyright notic 2019-09-10 09:25:22 -07:00