Commit Graph

108589 Commits

Author SHA1 Message Date
Oliver Scherer
6e73a14234 Remove fn special casing in const printing 2020-03-12 13:35:44 +01:00
Guillaume Gomez
611cfd5f15 Clean up E0423 explanation 2020-03-12 13:11:07 +01:00
YI
d7100d6099 update outdated comment 2020-03-12 18:43:51 +08:00
Oliver Scherer
d0b12117c5 Comment nit 2020-03-12 11:06:14 +01:00
David Wood
bee151308d
codegen/mir: support polymorphic InstanceDefs
This commit modifies the use of `subst_and_normalize_erasing_regions` on
parts of the MIR bodies returned from `instance_mir`, so that
`InstanceDef::CloneShim` and `InstanceDef::DropGlue` (where there is a
type) do not perform substitutions. This avoids double substitutions and
enables polymorphic `InstanceDef`s.

Signed-off-by: David Wood <david@davidtw.co>
2020-03-12 09:32:15 +00:00
bors
23de8275c9 Auto merge of #68551 - Marwes:allocations_mir, r=ecstatic-morse
perf: Reuse a Vec in mir simplification

Just moves the vec out of the outer loop so it is reused every iteration
2020-03-12 09:16:53 +00:00
bors
e5e8ba4edc Auto merge of #68191 - simlay:add-tvSO-target, r=nagisa
Added tvOS as targets

This is a first attempt of adding support tvOS as described in #48862. It's got a lot of overlap with [src/librustc_target/spec/apple_ios_base.rs](31dd4f4acb/src/librustc_target/spec/apple_ios_base.rs).

I thought about refactoring `apple_ios_base.rs` to include this as well but that would require each of the ios and tvos targets to be of the something like the form `let base = opts(AppleOS::TV, Arch::Arm64)?;` I also did the same thing for watchOS because from what I can tell, all three targets (iOS, tvOS, and watchOS) have the same logic but have different parameters being sent to `xcrun`. Thoughts?

As far as the `data_layout` and other parameters to `Target`, I did as much research as I could but it really seems that processor in the [iPhone 11 is the same as the apple TV](https://en.wikipedia.org/wiki/Apple-designed_processors) so I didn't change any of those parameters.

I did get this to build and tested that it's actually running the the below logic (because the parameter to `xcrun` is `appletvos` not `tvos`).

I didn't manage to get it to actually compile a file with `fn main(){}` because I don't have the stdlib for `aarch64-apple-tvos` compiled it seems. Is there documentation for this?

Similar to the ending of https://github.com/rust-lang/rust/pull/63467, I'm not sure what to do next.
2020-03-12 04:01:02 +00:00
Ralf Jung
e219dd4a2d fmt 2020-03-11 20:32:39 +01:00
Vadim Petrochenkov
f4083c6455 Add the "consider importing it directly" label to public imports as well 2020-03-11 21:49:32 +03:00
Ralf Jung
93436d8fd7 make error message less confusing 2020-03-11 19:44:23 +01:00
Ralf Jung
9681422943 we are on 2018 edition, use try block 2020-03-11 19:44:23 +01:00
Ralf Jung
d8f81680a1 avoid boolean inversion 2020-03-11 19:44:23 +01:00
Ralf Jung
3e61442905 explain why we catch PointerUseAfterFree 2020-03-11 19:44:23 +01:00
Ralf Jung
2764d3d3e4 start Miri messages lower-case 2020-03-11 19:44:23 +01:00
Ralf Jung
3ebcd78b42 fmt, and fix rustfmt-induced rebase hickup 2020-03-11 19:44:23 +01:00
Ralf Jung
9a95b010e6 generalize InvalidNullPointerUsage to InvalidIntPointerUsage 2020-03-11 19:44:23 +01:00
Ralf Jung
d02543a453 fmt, tweak messages and bless 2020-03-11 19:44:23 +01:00
Ralf Jung
f5efb68a24 miri: categorize errors into "unsupported" and "UB"
Also slightly refactor pointer bounds checks to avoid creating unnecessary temporary Errors
2020-03-11 19:42:07 +01:00
Ralf Jung
c7eb0f2a40 fix expand-to-unstable test 2020-03-11 19:41:41 +01:00
Vadim Petrochenkov
580c6a29d4 resolve: Print import chains on privacy errors 2020-03-11 21:17:32 +03:00
Vadim Petrochenkov
71ebc61820 resolve: Simplify fn report_privacy_error
by factoring out `fn ctor_fields_span` into a separate function
2020-03-11 21:17:32 +03:00
Kinsey Favre
5099ab6e6b
Give LexError more descriptive Display impl 2020-03-11 11:57:58 -05:00
Kinsey Favre
f2b22a136c
Correct stability attribute for new LexError impls 2020-03-11 11:57:58 -05:00
Lena Wildervanck
2c90a37969 Reformat match statement to make the check pass 2020-03-11 17:55:14 +01:00
Lena Wildervanck
599cd683ea Format the match statement 2020-03-11 17:30:04 +01:00
Kinsey Favre
c0c526951c
Add Display and Error impls for proc_macro::LexError
This should allow LexError to play much nicer with the `?` operator.
2020-03-11 11:28:59 -05:00
Josh Stone
543832b06c Regenerate tables for Unicode 13.0.0 2020-03-11 09:24:08 -07:00
Esteban Küber
7ee1b47092 review comments 2020-03-11 09:17:55 -07:00
Oliver Scherer
74608c7f20 Rustfmt and adjust capitalization 2020-03-11 14:31:29 +01:00
Matthias Krüger
3244c84363 rustdoc: remove unused import 2020-03-11 14:24:07 +01:00
Ralf Jung
d49306da13 implement zeroed and uninitialized with MaybeUninit 2020-03-11 14:23:13 +01:00
bors
c20d7eecbc Auto merge of #69919 - Centril:rollup-fxo33zs, r=Centril
Rollup of 8 pull requests

Successful merges:

 - #66472 (--show-coverage json)
 - #69603 (tidy: replace `make check` with `./x.py test` in documentation)
 - #69760 (Improve expression & attribute parsing)
 - #69828 (fix memory leak when vec::IntoIter panics during drop)
 - #69850 (panic_bounds_check: use caller_location, like PanicFnLangItem)
 - #69876 (Add long error explanation for E0739)
 - #69888 ([Miri] Use a session variable instead of checking for an env var always)
 - #69893 (librustc_codegen_llvm: Use slices instead of 0-terminated strings)

Failed merges:

r? @ghost
2020-03-11 13:05:52 +00:00
Mazdak Farrokhzad
a77206fa4a
Rollup merge of #69893 - tmiasko:cstr, r=petrochenkov
librustc_codegen_llvm: Use slices instead of 0-terminated strings

Changed functions:
* LLVMRustGetOrInsertFunction
* LLVMRustGetNamedValue
* LLVMRustBuildCall (removed unused name argument)
* LLVMRustInlineAsm
* LLVMRustInlineAsmVerify
* LLVMRustAppendModuleInlineAsm
2020-03-11 14:03:54 +01:00
Mazdak Farrokhzad
b1471e0a26
Rollup merge of #69888 - wesleywiser:miri_exception_env_var_to_session_var, r=RalfJung
[Miri] Use a session variable instead of checking for an env var always

In CTFE heavy code, checking the env var everytime is inefficient. We
can do a lot better by using a `Session` variable instead.

r? @RalfJung

Part of #69297
2020-03-11 14:03:53 +01:00
Mazdak Farrokhzad
e838383ff8
Rollup merge of #69876 - ayushmishra2005:doc/61137-add-long-error-code-e0739, r=Dylan-DPC
Add long error explanation for E0739

Add long explanation for the E0739 error code
Part of #61137

r? @GuillaumeGomez
2020-03-11 14:03:51 +01:00
Mazdak Farrokhzad
3853da75cb
Rollup merge of #69850 - RalfJung:panic-bounds-check, r=eddyb
panic_bounds_check: use caller_location, like PanicFnLangItem

The `PanicFnLangItem` got switched to using `#[caller_location]` at some point, but `PanicBoundsCheckFnLangItem` was kept in the old style. For consistency, switch that one over to use `#[caller_location]` as well.

This is also helpful for Miri as it means the `assert_panic` machine hook never needs to know the current `Span`.
2020-03-11 14:03:49 +01:00
Mazdak Farrokhzad
080d41391d
Rollup merge of #69828 - RalfJung:vec-leak, r=kennytm
fix memory leak when vec::IntoIter panics during drop

Fixes https://github.com/rust-lang/rust/issues/69770
2020-03-11 14:03:47 +01:00
Mazdak Farrokhzad
9674c09ae9
Rollup merge of #69760 - Centril:parse-expr-improve, r=estebank
Improve expression & attribute parsing

This PR includes misc improvements to expression and attribute parsing.

1. Some code simplifications
2. Better recovery for various block forms, e.g. `loop statements }` (missing `{` after `loop`). (See e.g., `block-no-opening-brace.rs` among others for examples.)
3. Added recovery for e.g., `unsafe $b` where `$b` refers to a `block` macro fragment. (See `bad-interpolated-block.rs` for examples.)
4. ^--- These are done so that code sharing in block parsing is increased.
5. Added recovery for e.g., `'label: loop { ... }` (See `labeled-no-colon-expr.rs`.)
6. Added recovery for e.g., `&'lifetime expr` (See `regions-out-of-scope-slice.rs`.)
7. Added recovery for e.g., `fn foo() = expr;` (See `fn-body-eq-expr-semi.rs`.)
8. Simplified attribute parsing code & slightly improved diagnostics.
9. Added recovery for e.g., `Box<('a) + Trait>`.
10. Added recovery for e.g, `if true #[attr] {} else #[attr] {} else #[attr] if true {}`.

r? @estebank
2020-03-11 14:03:45 +01:00
Mazdak Farrokhzad
dde2484fce
Rollup merge of #69603 - chrissimpkins:tidy-docs-update, r=petrochenkov
tidy: replace `make check` with `./x.py test` in documentation

This PR includes a minor documentation update for tidy.  It replaces the `make check` approach with `./x.py test` and describes how to execute the tidy checks (only) with ~~`./x.py test src/tools/tidy`~~ `./x.py test tidy`.
2020-03-11 14:03:44 +01:00
Mazdak Farrokhzad
741d4ff713
Rollup merge of #66472 - GuillaumeGomez:show-coverage-json, r=ollie27
--show-coverage json

The purpose of this change is to be able to use it as a tool in docs.rs in order to provide some more stats to crates' owners. Eventually even create a badge or something along the line.

r? @QuietMisdreavus
2020-03-11 14:03:42 +01:00
Oliver Scherer
ec88ffa38c
Comment nits
Co-Authored-By: Ralf Jung <post@ralfj.de>
2020-03-11 13:57:54 +01:00
Oliver Scherer
cdc730457e Compute the correct layout for variants of uninhabited enums and readd a long lost assertion
This reverts part of commit 9712fa4059.
2020-03-11 13:55:20 +01:00
bors
303d8aff60 Auto merge of #69914 - Centril:rollup-wtmdinz, r=Centril
Rollup of 10 pull requests

Successful merges:

 - #66059 (mem::zeroed/uninit: panic on types that do not permit zero-initialization)
 - #69373 (Stabilize const for integer {to,from}_{be,le,ne}_bytes methods)
 - #69591 (Use TypeRelating for instantiating query responses)
 - #69625 (Implement nth, last, and count for iter::Copied)
 - #69645 (const forget tests)
 - #69766 (Make Point `Copy` in arithmetic documentation)
 - #69825 (make `mem::discriminant` const)
 - #69859 (fix #62456)
 - #69891 (Exhaustiveness checking, `Matrix::push`: recursively expand or-patterns)
 - #69896 (parse: Tweak the function parameter edition check)

Failed merges:

r? @ghost
2020-03-11 09:37:19 +00:00
Mazdak Farrokhzad
6a8683fcd0
Rollup merge of #69896 - petrochenkov:reqname2, r=Centril
parse: Tweak the function parameter edition check

Follow-up to https://github.com/rust-lang/rust/pull/69801.

Edition of a code fragment is inferred from "the place where the code is written".
For individual tokens like edition-specific keywords it may be the span of the token itself ("uninterpolated" span), but for larger code fragments it's probably not, in the test example the trait method is obviously written in "2015 edition code".

r? @Centril
2020-03-11 10:36:33 +01:00
Mazdak Farrokhzad
a05bab5925
Rollup merge of #69891 - Centril:fix-69875, r=varkor
Exhaustiveness checking, `Matrix::push`: recursively expand or-patterns

> There's an implicit invariant that there should be no or-patterns directly in the first column of the matrix, but this invariant is broken exactly when an or-pattern has a child that is itself an or-pattern.

Here we preserve this broken invariant by recursively expanding `PatKind::Or`s in `Matrix::push`.
Fixes https://github.com/rust-lang/rust/issues/69875.

r? @varkor
cc @Nadrieril
cc https://github.com/rust-lang/rust/issues/54883
2020-03-11 10:36:31 +01:00
Mazdak Farrokhzad
62e3daee3f
Rollup merge of #69859 - contrun:fix-62456, r=matthewjasper
fix #62456

closes https://github.com/rust-lang/rust/issues/62456
2020-03-11 10:36:29 +01:00
Mazdak Farrokhzad
dfbbd5d6ea
Rollup merge of #69825 - lcnr:discriminant, r=oli-obk
make `mem::discriminant` const

implements #69821, which could be used as a tracking issue for `const_discriminant`.

Should this be added to the meta tracking issue #57563?
@Lokathor
2020-03-11 10:36:28 +01:00
Mazdak Farrokhzad
452c147fba
Rollup merge of #69766 - skade:make-point-copy-in-add-documentation, r=shepmaster
Make Point `Copy` in arithmetic documentation

Small composite types like `Point { x: i32, y: i32}` are plain
old data and we should encourage users to derive `Copy` on them.

This changes the semantics of the edited examples slightly: instead
of consuming the operands during addition, it will copy them. This
is desired behaviour.
2020-03-11 10:36:26 +01:00
Mazdak Farrokhzad
ae122721dc
Rollup merge of #69645 - DutchGhost:const-forget-tests, r=Dylan-DPC
const forget tests

Adds tests for https://github.com/rust-lang/rust/pull/69617
2020-03-11 10:36:24 +01:00
Mazdak Farrokhzad
25091ed9b7
Rollup merge of #69625 - Stebalien:feat/iter-copy-specialize, r=KodrAus
Implement nth, last, and count for iter::Copied

Implement nth, last and count for iter::Copied.
2020-03-11 10:36:22 +01:00