]> git.lizzy.rs Git - rust.git/log
rust.git
3 years agomove const_eval error reporting logic into rustc_mir::const_eval::error
Ralf Jung [Sun, 9 Aug 2020 13:37:32 +0000 (15:37 +0200)]
move const_eval error reporting logic into rustc_mir::const_eval::error

3 years agoAdd comment about the lack of `ExpnData` serialization for proc-macro crates
Aaron Hill [Sun, 9 Aug 2020 12:42:41 +0000 (08:42 -0400)]
Add comment about the lack of `ExpnData` serialization for proc-macro crates

3 years agoGive precedence to primitives over modules
Joshua Nelson [Sun, 9 Aug 2020 04:02:08 +0000 (00:02 -0400)]
Give precedence to primitives over modules

This has less surprising behavior when there is a module with the same
name as a primitive in scope.

3 years agoAuto merge of #75293 - poliorcetics:intra-doc-links-std-path, r=jyn514
bors [Sun, 9 Aug 2020 12:31:03 +0000 (12:31 +0000)]
Auto merge of #75293 - poliorcetics:intra-doc-links-std-path, r=jyn514

Move to intra-doc links in library/std/src/path.rs

Helps with #75080.

@rustbot modify labels: T-doc, A-intra-doc-links, T-rustdoc

Known issue: The following links are broken (they are inside trait impls, undocumented in this file, inheriting from the original doc):

- [`Hasher`]
- [`Self`] (referencing `../primitive.slice.html`)
- [`Ordering`]

3 years agoAvoid deleting temporary files on error
Mark Rousskov [Sun, 9 Aug 2020 01:05:50 +0000 (21:05 -0400)]
Avoid deleting temporary files on error

Previously if the compiler error'd, fatally, then temporary directories which
should be preserved by -Csave-temps would be deleted due to fatal compiler
errors being implemented as panics.

3 years agoRemove E0749 from untested error codes
Guillaume Gomez [Sun, 9 Aug 2020 11:15:33 +0000 (13:15 +0200)]
Remove E0749 from untested error codes

3 years agoClean up E0749 explanation
Guillaume Gomez [Sun, 9 Aug 2020 11:13:56 +0000 (13:13 +0200)]
Clean up E0749 explanation

3 years agoBTreeMap: better distinguish the root holder from the root node
Stein Somers [Tue, 14 Jul 2020 09:32:50 +0000 (11:32 +0200)]
BTreeMap: better distinguish the root holder from the root node

3 years agoAuto merge of #75310 - petrochenkov:needwasm, r=Mark-Simulacrum
bors [Sun, 9 Aug 2020 08:52:53 +0000 (08:52 +0000)]
Auto merge of #75310 - petrochenkov:needwasm, r=Mark-Simulacrum

tests: Mark `ui/asm/bad-arch.rs` as requiring wasm llvm backend

So it doesn't fail when not all LLVM backends are built.

3 years agotests: Mark `ui/asm/bad-arch.rs` as requiring wasm llvm backend
Vadim Petrochenkov [Sat, 8 Aug 2020 22:09:23 +0000 (01:09 +0300)]
tests: Mark `ui/asm/bad-arch.rs` as requiring wasm llvm backend

3 years agoChange Ord impl for ParamKindOrd
kadmin [Thu, 6 Aug 2020 08:22:32 +0000 (08:22 +0000)]
Change Ord impl for ParamKindOrd

Updated tests and error msgs

Update stderr from test

Update w/ lcnr comments

Change some tests around, and also updated Ord implementation for ParamKindOrd

Update w/ nits from lcnr

3 years agoSwitched to unordered field in ParamKindOrd
kadmin [Thu, 6 Aug 2020 00:23:17 +0000 (00:23 +0000)]
Switched to unordered field in ParamKindOrd

Run fmt

3 years agoAdd ParamKindOrd::ConstUnordered variant
kadmin [Wed, 5 Aug 2020 22:36:47 +0000 (22:36 +0000)]
Add ParamKindOrd::ConstUnordered variant

3 years agoBlessed old test where error message had changed
kadmin [Thu, 30 Jul 2020 22:11:54 +0000 (22:11 +0000)]
Blessed old test where error message had changed

Added minor fmt change to ast_validation

3 years agoTest lifetimes after types after consts forbidden
kadmin [Thu, 30 Jul 2020 20:53:32 +0000 (20:53 +0000)]
Test lifetimes after types after consts forbidden

Added more complex test and changed error message

3 years agoAdded +1 test for only works w/ feat const gen
kadmin [Thu, 30 Jul 2020 18:43:44 +0000 (18:43 +0000)]
Added +1 test for only works w/ feat const gen

Added this test to ensure that reordering the parameters only works with the feature const
generics enabled.

Fixed nits

Also added another test to verify that intermixed lifetimes are forbidden

3 years agoadd allow unused_unsafe and allow dead_code
Ryan1729 [Sun, 9 Aug 2020 06:39:14 +0000 (00:39 -0600)]
add allow unused_unsafe and allow dead_code

3 years agofix unary minus on usize and unused variable errors in .fixed file
Ryan1729 [Sun, 9 Aug 2020 06:28:56 +0000 (00:28 -0600)]
fix unary minus on usize and unused variable errors in .fixed file

3 years agoadd a test example of where transmutes_expressible_as_ptr_casts should not suggest...
Ryan1729 [Sun, 9 Aug 2020 06:15:56 +0000 (00:15 -0600)]
add a test example of where transmutes_expressible_as_ptr_casts should not suggest anything

3 years agoDetect likely `for foo of bar` JS syntax
Esteban Küber [Sun, 9 Aug 2020 03:53:40 +0000 (20:53 -0700)]
Detect likely `for foo of bar` JS syntax

Fix #75311.

3 years agoAuto merge of #75280 - overdrivenpotato:psp-unwind, r=dtolnay
bors [Sun, 9 Aug 2020 03:07:00 +0000 (03:07 +0000)]
Auto merge of #75280 - overdrivenpotato:psp-unwind, r=dtolnay

Add back unwinding support for Sony PSP

This PR adds back unwinding support for the Sony PSP. The `mipsel-sony-psp` target works well with unwinding. In [rust-psp], we use the `panic_unwind` crate along with LLVM's libunwind to catch panics, run destructors, and print them to the debug screen without aborting all threads.

[rust-psp]: https://github.com/overdrivenpotato/rust-psp

3 years agoupdate stderr for transmutes_expressible_as_ptr_casts
Ryan1729 [Sun, 9 Aug 2020 03:03:41 +0000 (21:03 -0600)]
update stderr for transmutes_expressible_as_ptr_casts

3 years agoDon't try to use wasm intrinsics on vectors
Alex Crichton [Sun, 9 Aug 2020 01:09:40 +0000 (18:09 -0700)]
Don't try to use wasm intrinsics on vectors

This commit fixes an issue with #74695 where the fptosi and fptoui
specializations on wasm were accidentally used on vector types by the
`simd_cast` intrinsic. This issue showed up as broken CI for the stdsimd
crate. Here this commit simply skips the specialization on vector kinds
flowing into `fpto{s,u}i`.

3 years agoAuto merge of #75306 - Amanieu:hashbrown8, r=Mark-Simulacrum
bors [Sun, 9 Aug 2020 01:05:56 +0000 (01:05 +0000)]
Auto merge of #75306 - Amanieu:hashbrown8, r=Mark-Simulacrum

Update hashbrown to 0.8.2

Includes:
- Avoid closures to improve compile times (https://github.com/rust-lang/hashbrown/pull/183)
- Do not iterate to drop if empty (https://github.com/rust-lang/hashbrown/pull/182)

r? @Mark-Simulacrum

3 years agoAuto merge of #75308 - JohnTitor:rollup-vnnny43, r=JohnTitor
bors [Sat, 8 Aug 2020 23:05:49 +0000 (23:05 +0000)]
Auto merge of #75308 - JohnTitor:rollup-vnnny43, r=JohnTitor

Rollup of 15 pull requests

Successful merges:

 - #74712 (Update E0271 explanation)
 - #74842 (adjust remaining targets)
 - #75151 (Consistent variable name alloc for raw_vec)
 - #75162 (Fix the documentation for move about Fn traits implementations)
 - #75248 (Add `as_mut_ptr` to `NonNull<[T]>`)
 - #75262 (Show multi extension example for Path in doctests)
 - #75266 (Add safety section to `NonNull::as_*` method docs)
 - #75284 (Show relative example for Path ancestors)
 - #75285 (Separate example for Path strip_prefix)
 - #75287 (Show Path extension example change multi extension)
 - #75288 (Use assert! for Path exists example to check bool)
 - #75289 (Remove ambiguity from PathBuf pop example)
 - #75290 (fix `min_const_generics` version)
 - #75291 (Clean up E0750)
 - #75292 (Clean up E0502)

Failed merges:

r? @ghost

3 years agoRollup merge of #75292 - slanterns:cleanup-E0502, r=GuillaumeGomez
Yuki Okushi [Sat, 8 Aug 2020 21:41:39 +0000 (06:41 +0900)]
Rollup merge of #75292 - slanterns:cleanup-E0502, r=GuillaumeGomez

Clean up E0502

`ref` on an entire `let` pattern is discouraged, take a reference with `&` instead.

3 years agoRollup merge of #75291 - GuillaumeGomez:cleanup-e0750, r=pickfire
Yuki Okushi [Sat, 8 Aug 2020 21:41:37 +0000 (06:41 +0900)]
Rollup merge of #75291 - GuillaumeGomez:cleanup-e0750, r=pickfire

Clean up E0750

r? @Dylan-DPC

3 years agoRollup merge of #75290 - rust-lang:min_const_generics-version, r=jonas-schievink
Yuki Okushi [Sat, 8 Aug 2020 21:41:35 +0000 (06:41 +0900)]
Rollup merge of #75290 - rust-lang:min_const_generics-version, r=jonas-schievink

fix `min_const_generics` version

https://github.com/rust-lang/rust/pull/74877#discussion_r467451813

> This should be 1.47.0

3 years agoRollup merge of #75289 - pickfire:patch-12, r=jonas-schievink
Yuki Okushi [Sat, 8 Aug 2020 21:41:33 +0000 (06:41 +0900)]
Rollup merge of #75289 - pickfire:patch-12, r=jonas-schievink

Remove ambiguity from PathBuf pop example

3 years agoRollup merge of #75288 - pickfire:patch-11, r=jonas-schievink
Yuki Okushi [Sat, 8 Aug 2020 21:41:32 +0000 (06:41 +0900)]
Rollup merge of #75288 - pickfire:patch-11, r=jonas-schievink

Use assert! for Path exists example to check bool

3 years agoRollup merge of #75287 - pickfire:patch-10, r=jonas-schievink
Yuki Okushi [Sat, 8 Aug 2020 21:41:30 +0000 (06:41 +0900)]
Rollup merge of #75287 - pickfire:patch-10, r=jonas-schievink

Show Path extension example change multi extension

3 years agoRollup merge of #75285 - pickfire:patch-8, r=jonas-schievink
Yuki Okushi [Sat, 8 Aug 2020 21:41:28 +0000 (06:41 +0900)]
Rollup merge of #75285 - pickfire:patch-8, r=jonas-schievink

Separate example for Path strip_prefix

3 years agoRollup merge of #75284 - pickfire:patch-7, r=LukasKalbertodt
Yuki Okushi [Sat, 8 Aug 2020 21:41:27 +0000 (06:41 +0900)]
Rollup merge of #75284 - pickfire:patch-7, r=LukasKalbertodt

Show relative example for Path ancestors

3 years agoRollup merge of #75266 - aticu:master, r=RalfJung
Yuki Okushi [Sat, 8 Aug 2020 21:41:25 +0000 (06:41 +0900)]
Rollup merge of #75266 - aticu:master, r=RalfJung

Add safety section to `NonNull::as_*` method docs

This basically adds the safety section of `*mut T::as_{ref,mut}` to the
same methods on `NonNull` with minor modifications to fit the
differences.

Part of #48929.

3 years agoRollup merge of #75262 - pickfire:patch-6, r=jyn514
Yuki Okushi [Sat, 8 Aug 2020 21:41:23 +0000 (06:41 +0900)]
Rollup merge of #75262 - pickfire:patch-6, r=jyn514

Show multi extension example for Path in doctests

3 years agoRollup merge of #75248 - TimDiekmann:NonNull-as_mut_ptr, r=RalfJung
Yuki Okushi [Sat, 8 Aug 2020 21:41:22 +0000 (06:41 +0900)]
Rollup merge of #75248 - TimDiekmann:NonNull-as_mut_ptr, r=RalfJung

Add `as_mut_ptr` to `NonNull<[T]>`

Adds `as_mut_ptr` to shortcut converting a `NonNull<[T]>` to `*mut T` as proposed in https://github.com/rust-lang/rust/issues/74265#issuecomment-669702969.

r? @RalfJung

3 years agoRollup merge of #75162 - poliorcetics:move-documentation-fix, r=jyn514
Yuki Okushi [Sat, 8 Aug 2020 21:41:20 +0000 (06:41 +0900)]
Rollup merge of #75162 - poliorcetics:move-documentation-fix, r=jyn514

Fix the documentation for move about Fn traits implementations

Fixes #74997.

This uses the note from the [reference](https://doc.rust-lang.org/reference/types/closure.html#call-traits-and-coercions) but I can also just put a link to it or do both.

@rusbot modify labels: C-bug T-doc T-libs

3 years agoRollup merge of #75151 - pickfire:patch-4, r=LukasKalbertodt
Yuki Okushi [Sat, 8 Aug 2020 21:41:18 +0000 (06:41 +0900)]
Rollup merge of #75151 - pickfire:patch-4, r=LukasKalbertodt

Consistent variable name alloc for raw_vec

3 years agoRollup merge of #74842 - hermitcore:thread_local, r=Mark-Simulacrum
Yuki Okushi [Sat, 8 Aug 2020 21:41:16 +0000 (06:41 +0900)]
Rollup merge of #74842 - hermitcore:thread_local, r=Mark-Simulacrum

adjust remaining targets

- fix commit 7dc3886
- previous commit doesn't adjust all targets

3 years agoRollup merge of #74712 - strom-und-spiele:E0271-cleanup, r=Mark-Simulacrum
Yuki Okushi [Sat, 8 Aug 2020 21:41:14 +0000 (06:41 +0900)]
Rollup merge of #74712 - strom-und-spiele:E0271-cleanup, r=Mark-Simulacrum

Update E0271 explanation

When reading the explanation, I got confused by it. I hope the wording is clearer now.

3 years agoAuto merge of #75271 - cuviper:array-iter, r=LukasKalbertodt
bors [Sat, 8 Aug 2020 20:43:21 +0000 (20:43 +0000)]
Auto merge of #75271 - cuviper:array-iter, r=LukasKalbertodt

Simplify array::IntoIter

- Initialization can use `transmute_copy` to do the bitwise copy.
- `as_slice` can use `get_unchecked` and `MaybeUninit::slice_get_ref`,
  and `as_mut_slice` can do similar.
- `next` and `next_back` can use the corresponding `Range` methods.
- `Clone` doesn't need any unsafety, and we can dynamically update the
  new range to get partial drops if `T::clone` panics.

r? @LukasKalbertodt

3 years agoRemove E0750 from unchecked error codes
Guillaume Gomez [Sat, 8 Aug 2020 12:00:36 +0000 (14:00 +0200)]
Remove E0750 from unchecked error codes

3 years agoClean up E0750 explanation
Guillaume Gomez [Sat, 8 Aug 2020 11:59:54 +0000 (13:59 +0200)]
Clean up E0750 explanation

3 years agoAuto merge of #75163 - canova:map_into_keys_values, r=dtolnay
bors [Sat, 8 Aug 2020 18:15:50 +0000 (18:15 +0000)]
Auto merge of #75163 - canova:map_into_keys_values, r=dtolnay

Implement `into_keys` and `into_values` for associative maps

This PR implements `into_keys` and `into_values` for HashMap and BTreeMap types. They are implemented as unstable, under `map_into_keys_values` feature.
Fixes #55214.
r? @dtolnay

3 years agoAuto merge of #75260 - davidtwco:polymorphization-promoted-substs, r=lcnr
bors [Sat, 8 Aug 2020 15:57:12 +0000 (15:57 +0000)]
Auto merge of #75260 - davidtwco:polymorphization-promoted-substs, r=lcnr

polymorphize: unevaluated constants

This PR makes polymorphization visit the promoted MIR of unevaluated constants with available promoted MIR instead of visiting the substitutions of that constant - which will mark all of the generic parameters as used; in addition polymorphization will now visit non-promoted unevaluated constants rather than visit their substs.

r? @lcnr

3 years agoUpdate the tracking issue number of map_into_keys_values
Nazım Can Altınova [Sat, 8 Aug 2020 14:34:42 +0000 (16:34 +0200)]
Update the tracking issue number of map_into_keys_values

3 years agoAdd another test
Joshua Nelson [Sat, 8 Aug 2020 14:19:56 +0000 (10:19 -0400)]
Add another test

3 years agoUpdate hashbrown to 0.8.2
Amanieu d'Antras [Sat, 8 Aug 2020 14:03:47 +0000 (15:03 +0100)]
Update hashbrown to 0.8.2

3 years agoAdd an example about the behaviour of move and Fn* traits
Alexis Bourget [Sat, 8 Aug 2020 13:57:17 +0000 (15:57 +0200)]
Add an example about the behaviour of move and Fn* traits

3 years agoMiri: Renamed "undef" to "uninit"
Philippe Nadon [Sat, 8 Aug 2020 13:53:47 +0000 (07:53 -0600)]
Miri: Renamed "undef" to "uninit"

Renamed remaining references to "undef" to "uninit" when referring to Miri.

Impacted directories are:

- src/librustc_codegen_llvm/consts.rs
- src/librustc_middle/mir/interpret/
- src/librustc_middle/ty/print/pretty.rs
- src/librustc_mir/
- src/tools/clippy/clippy_lints/src/consts.rs

Upon building Miri based on the new changes it was verified that no changes needed to be made with the Miri project.

Related issue #71193

3 years agoRemove min/max values from IntoValues Iterator implementation
Nazım Can Altınova [Sat, 8 Aug 2020 13:39:26 +0000 (15:39 +0200)]
Remove min/max values from IntoValues Iterator implementation

3 years agoAuto merge of #74533 - nikic:issue-74425, r=eddyb
bors [Sat, 8 Aug 2020 13:33:53 +0000 (13:33 +0000)]
Auto merge of #74533 - nikic:issue-74425, r=eddyb

Emit == null instead of <= null for niche check

When the niche maximum is zero, emit a "== zero" check instead of a "<= zero" check. In particular, this avoids the awkward case of "<= null". While LLVM does canonicalize this to "== null", this apparently doesn't happen for constant expressions, leading to the issue in #74425. While that can be addressed on the LLVM side, it still seems prudent to emit sensible IR here, because this will allow null checks to be optimized earlier in the pipeline.

Fixes #74425.

3 years agoUse `&` instead of `let ref` in E0502
Slanterns [Sat, 8 Aug 2020 12:26:56 +0000 (20:26 +0800)]
Use `&` instead of `let ref` in E0502

`ref` on an entire `let` pattern is discouraged, take a reference with `&` instead.

3 years agoMove to intra-doc links in library/std/src/path.rs
Alexis Bourget [Sat, 8 Aug 2020 12:21:27 +0000 (14:21 +0200)]
Move to intra-doc links in library/std/src/path.rs

3 years agoAdd safety section to `NonNull::as_*` method docs
aticu [Fri, 7 Aug 2020 18:58:34 +0000 (20:58 +0200)]
Add safety section to `NonNull::as_*` method docs

This basically adds the safety section of `*mut T::as_{ref,mut}` to the
same methods on `NonNull` with minor modifications to fit the
differences.

Part of #48929.

3 years agofix `min_const_generics` version
Bastian Kauschke [Sat, 8 Aug 2020 11:35:42 +0000 (13:35 +0200)]
fix `min_const_generics` version

3 years agoAuto merge of #74289 - lzutao:unroll, r=LukasKalbertodt
bors [Sat, 8 Aug 2020 11:34:18 +0000 (11:34 +0000)]
Auto merge of #74289 - lzutao:unroll, r=LukasKalbertodt

Remove some redundant parts from `unrolled_find_u16s`

See each commit message for details.

r? @wesleywiser from old PR #67705 .

3 years agoRemove abmiguity from PathBuf pop example
Ivan Tham [Sat, 8 Aug 2020 10:28:55 +0000 (18:28 +0800)]
Remove abmiguity from PathBuf pop example

3 years agoUse assert! for Path exists example to check bool
Ivan Tham [Sat, 8 Aug 2020 10:23:18 +0000 (18:23 +0800)]
Use assert! for Path exists example to check bool

3 years agoShow Path extension example change multi extension
Ivan Tham [Sat, 8 Aug 2020 10:14:29 +0000 (18:14 +0800)]
Show Path extension example change multi extension

3 years agoAdd additonal case for Path starts with
Ivan Tham [Sat, 8 Aug 2020 10:06:04 +0000 (18:06 +0800)]
Add additonal case for Path starts with

Show what happens if there is an extra extension

3 years agoSeparate example for Path strip_prefix
Ivan Tham [Sat, 8 Aug 2020 10:01:34 +0000 (18:01 +0800)]
Separate example for Path strip_prefix

3 years agoShow relative example for Path ancestors
Ivan Tham [Sat, 8 Aug 2020 09:53:16 +0000 (17:53 +0800)]
Show relative example for Path ancestors

3 years agoAuto merge of #75282 - RalfJung:miri-black-box, r=oli-obk
bors [Sat, 8 Aug 2020 09:46:16 +0000 (09:46 +0000)]
Auto merge of #75282 - RalfJung:miri-black-box, r=oli-obk

do not call black_box on Miri

Helps with https://github.com/rust-lang/rust/issues/75274 (but https://github.com/rust-lang/rust/pull/74932 introduced unrelated breakage that will need a separate fix)
Cc @eggyal r? @Mark-Simulacrum

3 years agoUpdate E0271.md
strom-und-spiele [Fri, 24 Jul 2020 12:15:21 +0000 (14:15 +0200)]
Update E0271.md

remove references to non existing code,
expand solution suggestions
remove unneeded code in solution

3 years agomake black_box a NOP in Miri
Ralf Jung [Sat, 8 Aug 2020 08:36:16 +0000 (10:36 +0200)]
make black_box a NOP in Miri

3 years agoEmit == null instead of <= null
Nikita Popov [Sun, 19 Jul 2020 18:57:49 +0000 (20:57 +0200)]
Emit == null instead of <= null

When the niche maximum is zero, emit a "== zero" check instead of
a "<= zero" check. In particular, this avoid the awkward case of
"<= null". While LLVM does canonicalize this to "!= null", this
appently doesn't happen for constant expressions, leading to the
issue in #74425. While that can be addressed on the LLVM side, it
still seems prudent to emit sensible IR here, because this will
allow null checks to be optimized earlier in the pipeline.

Fixes #74425.

3 years agoAuto merge of #75257 - ssomers:btree_74762_again, r=Mark-Simulacrum
bors [Sat, 8 Aug 2020 07:46:04 +0000 (07:46 +0000)]
Auto merge of #75257 - ssomers:btree_74762_again, r=Mark-Simulacrum

BTreeMap: better way to postpone root access in DrainFilter

A slightly more elegant (in my opinion) adaptation of #74762. Benchmarks seem irrationally pleased to:
```
benchcmp old new --threshold 5
 name                                           old ns/iter  new ns/iter  diff ns/iter   diff %  speedup
 btree::map::clone_fat_100_and_remove_all       215,182      185,052           -30,130  -14.00%   x 1.16
 btree::map::clone_fat_100_and_remove_half      139,667      127,945           -11,722   -8.39%   x 1.09
 btree::map::clone_fat_val_100_and_remove_all   96,755       81,279            -15,476  -16.00%   x 1.19
 btree::map::clone_fat_val_100_and_remove_half  64,678       56,911             -7,767  -12.01%   x 1.14
 btree::map::find_rand_100                      18           17                     -1   -5.56%   x 1.06
 btree::map::first_and_last_0                   33           35                      2    6.06%   x 0.94
 btree::map::first_and_last_100                 40           54                     14   35.00%   x 0.74
 btree::map::insert_rand_100                    45           42                     -3   -6.67%   x 1.07
 btree::map::insert_rand_10_000                 45           41                     -4   -8.89%   x 1.10
 btree::map::iter_0                             2,010        1,759                -251  -12.49%   x 1.14
 btree::map::iter_100                           3,514        2,764                -750  -21.34%   x 1.27
 btree::map::iter_10k                           4,018        3,768                -250   -6.22%   x 1.07
 btree::map::range_unbounded_unbounded          37,269       28,929             -8,340  -22.38%   x 1.29
 btree::map::range_unbounded_vs_iter            31,518       28,814             -2,704   -8.58%   x 1.09
```

r? @Mark-Simulacrum

3 years agoAdd back unwinding support for Sony PSP
Marko Mijalkovic [Sat, 8 Aug 2020 06:14:40 +0000 (02:14 -0400)]
Add back unwinding support for Sony PSP

3 years agoAuto merge of #74932 - nnethercote:rm-ast-session-globals, r=petrochenkov
bors [Sat, 8 Aug 2020 05:58:57 +0000 (05:58 +0000)]
Auto merge of #74932 - nnethercote:rm-ast-session-globals, r=petrochenkov

Remove `librustc_ast` session globals

By moving the data onto `Session`.

r? @petrochenkov

3 years agoRm restriction on ord of default types w/ consts
kadmin [Thu, 30 Jul 2020 18:39:53 +0000 (18:39 +0000)]
Rm restriction on ord of default types w/ consts

3 years agoAllow types to come after consts in AST validation
julianknodt [Thu, 30 Jul 2020 07:40:50 +0000 (00:40 -0700)]
Allow types to come after consts in AST validation

3 years agoAuto merge of #75276 - JohnTitor:rollup-rz4hs0w, r=JohnTitor
bors [Sat, 8 Aug 2020 03:54:33 +0000 (03:54 +0000)]
Auto merge of #75276 - JohnTitor:rollup-rz4hs0w, r=JohnTitor

Rollup of 7 pull requests

Successful merges:

 - #75224 (Don't call a function in function-arguments-naked.rs)
 - #75237 (Display elided lifetime for non-reference type in doc)
 - #75250 (make MaybeUninit::as_(mut_)ptr const)
 - #75253 (clean up const-hacks in int endianess conversion functions)
 - #75259 (Add missing backtick)
 - #75267 (Small cleanup)
 - #75270 (fix a couple of clippy findings)

Failed merges:

r? @ghost

3 years agoRollup merge of #75270 - matthiaskrgr:clippy_aug_1, r=Dylan-DPC
Yuki Okushi [Sat, 8 Aug 2020 02:36:12 +0000 (11:36 +0900)]
Rollup merge of #75270 - matthiaskrgr:clippy_aug_1, r=Dylan-DPC

fix a couple of clippy findings

3 years agoRollup merge of #75267 - estebank:cleanup, r=Dylan-DPC
Yuki Okushi [Sat, 8 Aug 2020 02:36:10 +0000 (11:36 +0900)]
Rollup merge of #75267 - estebank:cleanup, r=Dylan-DPC

Small cleanup

* Add docstring to `Parser` field
* Remove unnecessary `unwrap`
* Remove unnecessary borrow
* Fix indentation of some `teach`text output

3 years agoRollup merge of #75259 - giraffate:add_missing_backtick, r=lcnr
Yuki Okushi [Sat, 8 Aug 2020 02:36:09 +0000 (11:36 +0900)]
Rollup merge of #75259 - giraffate:add_missing_backtick, r=lcnr

Add missing backtick

3 years agoRollup merge of #75253 - RalfJung:cleanup-const-hack, r=oli-obk
Yuki Okushi [Sat, 8 Aug 2020 02:36:07 +0000 (11:36 +0900)]
Rollup merge of #75253 - RalfJung:cleanup-const-hack, r=oli-obk

clean up const-hacks in int endianess conversion functions

Cleans up the const hacks added in https://github.com/rust-lang/rust/pull/69373.

r? @oli-obk

3 years agoRollup merge of #75250 - RalfJung:uninit-const-ptr, r=oli-obk
Yuki Okushi [Sat, 8 Aug 2020 02:36:05 +0000 (11:36 +0900)]
Rollup merge of #75250 - RalfJung:uninit-const-ptr, r=oli-obk

make MaybeUninit::as_(mut_)ptr const

I think it was just an oversight that they are not const yet.

I also changed their implementation as the old one created references to uninitialized memory.^^

3 years agoRollup merge of #75237 - nbdd0121:rustdoc, r=jyn514
Yuki Okushi [Sat, 8 Aug 2020 02:36:03 +0000 (11:36 +0900)]
Rollup merge of #75237 - nbdd0121:rustdoc, r=jyn514

Display elided lifetime for non-reference type in doc

In edition 2018 we encourage writing `<'_>` explicitly, so rustdoc should display like such as well.

Fixes #75225

~~Somehow when I run the compiled rustdoc using `cargo +stage2 doc` on other crates, it correctly produces `<'_>`, but I couldn't get the std doc to do the same with `./x.py doc --stage 2`. Might this be related to the recent change to x.py about how the doc is built?~~

3 years agoRollup merge of #75224 - Aaron1011:fix/function-arguments-naked, r=Amanieu
Yuki Okushi [Sat, 8 Aug 2020 02:36:02 +0000 (11:36 +0900)]
Rollup merge of #75224 - Aaron1011:fix/function-arguments-naked, r=Amanieu

Don't call a function in function-arguments-naked.rs

Fixes #75096

It's U.B. to use anything other than inline assmebling in a naked
function. Fortunately, the `#break` directive works fine without
anything in the function body.

3 years agoIncrease `recursion_limit` in `librustc_plugin_impl`.
Nicholas Nethercote [Sat, 8 Aug 2020 02:05:10 +0000 (12:05 +1000)]
Increase `recursion_limit` in `librustc_plugin_impl`.

To avoid rustdoc problems.

3 years agoEliminate `librustc_hir`'s dependency on `librustc_session`.
Nicholas Nethercote [Fri, 7 Aug 2020 01:11:44 +0000 (11:11 +1000)]
Eliminate `librustc_hir`'s dependency on `librustc_session`.

3 years agoEliminate the `SessionGlobals` from `librustc_ast`.
Nicholas Nethercote [Thu, 30 Jul 2020 01:27:50 +0000 (11:27 +1000)]
Eliminate the `SessionGlobals` from `librustc_ast`.

By moving `{known,used}_attrs` from `SessionGlobals` to `Session`. This
means they are accessed via the `Session`, rather than via TLS. A few
`Attr` methods and `librustc_ast` functions are now methods of
`Session`.

All of this required passing a `Session` to lots of functions that didn't
already have one. Some of these functions also had arguments removed, because
those arguments could be accessed directly via the `Session` argument.

`contains_feature_attr()` was dead, and is removed.

Some functions were moved from `librustc_ast` elsewhere because they now need
to access `Session`, which isn't available in that crate.
- `entry_point_type()` --> `librustc_builtin_macros`
- `global_allocator_spans()` --> `librustc_metadata`
- `is_proc_macro_attr()` --> `Session`

3 years agoRemove some unnecessary uses of `Option`.
Nicholas Nethercote [Thu, 30 Jul 2020 01:15:51 +0000 (11:15 +1000)]
Remove some unnecessary uses of `Option`.

These arguments are never `None`.

3 years agoAuto merge of #74877 - lcnr:min_const_generics, r=oli-obk
bors [Sat, 8 Aug 2020 01:48:35 +0000 (01:48 +0000)]
Auto merge of #74877 - lcnr:min_const_generics, r=oli-obk

Implement the `min_const_generics` feature gate

Implements both https://github.com/rust-lang/lang-team/issues/37 and https://github.com/rust-lang/compiler-team/issues/332.

Adds the new feature gate `#![feature(min_const_generics)]`.
This feature gate adds the following limitations to using const generics:
- generic parameters must only be used in types if they are trivial. (either `N` or `{ N }`)
- generic parameters must be either integers, `bool` or `char`.

We do allow arbitrary expressions in associated consts though, meaning that the following is allowed,
even if `<[u8; 0] as Foo>::ASSOC` is not const evaluatable.
```rust
trait Foo {
    const ASSOC: usize;
}

impl<const N: usize> Foo for [u8; N] {
    const ASSOC: usize = 64 / N;
}
```

r? @varkor cc @eddyb @withoutboats

3 years agoEXTREMELY hacky fix
Joshua Nelson [Sat, 8 Aug 2020 00:07:07 +0000 (20:07 -0400)]
EXTREMELY hacky fix

This runs _just_ enough of typeck that later queries don't panic.
Because this is in the same part of the compiler that errors on `impl
Trait`, this special-cases impl Trait for rustdoc and no one else.
Everything is fine.

3 years agoCross-crate doc inlining test case for elided lifetime
Gary Guo [Sat, 8 Aug 2020 00:07:43 +0000 (01:07 +0100)]
Cross-crate doc inlining test case for elided lifetime

3 years agoAuto merge of #75048 - eggyal:force-no-tco-start-backtrace-frame, r=Mark-Simulacrum
bors [Sat, 8 Aug 2020 00:00:52 +0000 (00:00 +0000)]
Auto merge of #75048 - eggyal:force-no-tco-start-backtrace-frame, r=Mark-Simulacrum

Prevent `__rust_begin_short_backtrace` frames from being tail-call optimised away

I've stumbled across some situations where there (unexpectedly) was no `__rust_begin_short_backtrace` frame on the stack during unwinding.

On closer examination, it appeared that the calls to that function had been tail-call optimised away.

This PR follows [@bjorn3's suggestion on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/Disabling.20tail.20call.20optimisation.3F/near/205699133), by adding calls to `black_box` that hint to rustc not to perform TCO.

Fixes #47429

3 years agofix clippy::needless_return: remove unneeded return statements
Matthias Krüger [Fri, 7 Aug 2020 22:39:38 +0000 (00:39 +0200)]
fix clippy::needless_return: remove unneeded return statements

3 years agofix clippy::clone_on_copy: don't clone types that are copy
Matthias Krüger [Fri, 7 Aug 2020 22:27:46 +0000 (00:27 +0200)]
fix clippy::clone_on_copy: don't clone types that are copy

3 years agofix clippy::map_clone: use .cloned() instead of .map(|x| x.clone())
Matthias Krüger [Fri, 7 Aug 2020 22:14:28 +0000 (00:14 +0200)]
fix clippy::map_clone: use .cloned() instead of .map(|x| x.clone())

3 years agofix clippy::into_iter_on_ref: use .iter() instead of into_iter() on references.
Matthias Krüger [Fri, 7 Aug 2020 22:07:01 +0000 (00:07 +0200)]
fix clippy::into_iter_on_ref: use .iter() instead of into_iter() on references.

3 years agofix clippy::while_let_loop: use while let{} instead of loop { if ... break; }
Matthias Krüger [Fri, 7 Aug 2020 21:59:59 +0000 (23:59 +0200)]
fix clippy::while_let_loop: use while let{} instead of loop { if ... break; }

3 years agofix clippy::redundant_closure: remove redundant closures and call functions directly
Matthias Krüger [Fri, 7 Aug 2020 21:45:19 +0000 (23:45 +0200)]
fix clippy::redundant_closure: remove redundant closures and call functions directly

3 years agoDisplay elided lifetime for external paths
Gary Guo [Fri, 7 Aug 2020 22:34:44 +0000 (23:34 +0100)]
Display elided lifetime for external paths

3 years agoDisplay elided lifetime for non-reference type in doc
Gary Guo [Thu, 6 Aug 2020 23:48:24 +0000 (00:48 +0100)]
Display elided lifetime for non-reference type in doc

3 years agoAuto merge of #75071 - ssomers:btree_cleanup_5, r=Mark-Simulacrum
bors [Fri, 7 Aug 2020 21:48:32 +0000 (21:48 +0000)]
Auto merge of #75071 - ssomers:btree_cleanup_5, r=Mark-Simulacrum

BTreeMap: enforce the panic rule imposed by `replace`

Also, reveal the unsafe parts in the closures fed to it.

r? @Mark-Simulacrum

3 years agoSimplify array::IntoIter
Josh Stone [Fri, 7 Aug 2020 20:51:46 +0000 (13:51 -0700)]
Simplify array::IntoIter

- Initialization can use `transmute_copy` to do the bitwise copy.
- `as_slice` can use `get_unchecked` and `MaybeUninit::slice_get_ref`,
  and `as_mut_slice` can do similar.
- `next` and `next_back` can use the corresponding `Range` methods.
- `Clone` doesn't need any unsafety, and we can dynamically update the
  new range to get partial drops if `T::clone` panics.

3 years agofix clippy::len_zero: use is_empty() instead of comparing .len() to zero
Matthias Krüger [Sat, 1 Aug 2020 17:20:44 +0000 (19:20 +0200)]
fix clippy::len_zero: use is_empty() instead of comparing .len() to zero

3 years agofix clippy::unneeded_wildcard_pattern: remove redundant wildcard pattern
Matthias Krüger [Sat, 1 Aug 2020 16:20:39 +0000 (18:20 +0200)]
fix clippy::unneeded_wildcard_pattern: remove redundant wildcard pattern