Commit graph

124447 commits

Author SHA1 Message Date
Jan Riemer
56daf63d10
docs: add derive for struct
Code blocks in doc comments are compiled and run, so we show `Copy` works in this example.

Co-authored-by: Poliorcetics <poliorcetics@users.noreply.github.com>
2020-08-16 22:25:59 +02:00
Jan Riemer
9061da2e14
add empty line above code block
Co-authored-by: Poliorcetics <poliorcetics@users.noreply.github.com>
2020-08-16 22:15:59 +02:00
Jan Riemer
dce864454c add back emojis that have been removed accidentally
Co-authored-by: Joshua Nelson <joshua@yottadb.com>
2020-08-16 20:48:44 +02:00
Jan Riemer
43dec0e171
rephrase: struct -> type
Co-authored-by: Joshua Nelson <joshua@yottadb.com>
2020-08-16 20:17:28 +02:00
Jan Riemer
a876b3d8aa
docs(marker/copy): provide example for &T being Copy
In the current documentation about the `Copy` marker trait, there is a section
with examples of structs that can implement `Copy`. Currently there is no example for
showing that shared references (`&T`) are also `Copy`.
It is worth to have a dedicated example for `&T` being `Copy`, because shared
references are an integral part of the language and it being `Copy` is not as
intuitive as other types that share this behaviour like `i32` or `bool`.

The example picks up on the previous non-`Copy` struct and shows that
structs can be `Copy`, even when they hold a shared reference to a non-`Copy` type.
2020-08-16 20:03:34 +02:00
Jan Riemer
7835c8c06c
docs(marker/copy): clarify that &T is also Copy
In the current documentation about the `Copy` marker trait, there is a section
about "additional implementors", which list additional implementors of the `Copy` trait.
The fact that shared references are also `Copy` is mixed with another point,
which makes it hard to recognize and make it seem not as important.

This clarifies the fact that shared references are also `Copy`, by mentioning it as a
separate item in the list of "additional implementors".
2020-08-02 14:57:19 +02:00
bors
1e99138078 Auto merge of #74972 - second-state:wasi-right-fix, r=KodrAus
Fix std::fs::File::metadata permission on WASI target

Previously `std::fs::File::metadata` on wasm32-wasi would call `fd_filestat_get`
to get metadata associated with fd, but that fd is opened without
RIGHTS_FD_FILESTAT_GET right, so it will failed on correctly implemented WASI
environment.

This change instead to add the missing rights when opening an fd.
2020-08-02 09:41:17 +00:00
bors
12799ad60c Auto merge of #74899 - sajattack:libc_0.2.74_bump, r=jonas-schievink
bump libc version to 0.2.74
2020-08-02 07:23:14 +00:00
bors
46cf80dc1a Auto merge of #75004 - Aaron1011:move-probably-equal, r=petrochenkov
Move 'probably equal' methods to librustc_parse

This is preparation for PR #73084
2020-08-02 05:34:40 +00:00
bors
8141873e6d Auto merge of #74785 - euclio:deprecation-kinds, r=petrochenkov
report kind of deprecated item in message

This is important for fields, which are incorrectly referred to as
"items".
2020-08-02 03:47:29 +00:00
Aaron Hill
183947f6ba
Move 'probably equal' methods to librustc_parse
This is preparation for PR #73084
2020-08-01 21:12:49 -04:00
bors
e18b56345f Auto merge of #75033 - Manishearth:rollup-d8afil1, r=Manishearth
Rollup of 5 pull requests

Successful merges:

 - #74602 (Clarify the doc for MaybeUninit::zeroed on incorrect use)
 - #74720 (Clean up E0728 explanation)
 - #74992 (fix rustdoc generic param order)
 - #75015 (Add Vec::spare_capacity_mut)
 - #75022 (Use a slice pattern instead of rchunks_exact(_).next())

Failed merges:

r? @ghost
2020-08-02 01:04:54 +00:00
Manish Goregaokar
82147885bb
Rollup merge of #75022 - cuviper:sliced-rchunk, r=lcnr
Use a slice pattern instead of rchunks_exact(_).next()

This is a minor cleanup, but trying a single-use `rchunks` iterator can
be more directly matched with a slice pattern, `[.., a, b]`.
2020-08-01 17:42:18 -07:00
Manish Goregaokar
d544e21dc3
Rollup merge of #75015 - Amanieu:vec_spare, r=sfackler
Add Vec::spare_capacity_mut

Returns the remaining spare capacity of the vector as a slice of `MaybeUninit<T>`.

As suggested by @sfackler in https://github.com/rust-lang/rust/pull/70967#issuecomment-612659006.

r? @sfackler
2020-08-01 17:42:16 -07:00
Manish Goregaokar
98a9397c2a
Rollup merge of #74992 - lcnr:fix-generic-param-order, r=GuillaumeGomez
fix rustdoc generic param order

fixes #61292

r? @varkor cc @GuillaumeGomez
2020-08-01 17:42:15 -07:00
Manish Goregaokar
fac959b570
Rollup merge of #74720 - GuillaumeGomez:cleanup-e0728, r=jyn514
Clean up E0728 explanation

r? @Dylan-DPC
2020-08-01 17:42:13 -07:00
Manish Goregaokar
39436ebe72
Rollup merge of #74602 - poliorcetics:maybe-uninit-zeroed-doc-clarification, r=jyn514
Clarify the doc for MaybeUninit::zeroed on incorrect use

Fixes #74343.

@rustbot modify labels: C-enhancement, T-doc
2020-08-01 17:42:11 -07:00
bors
5ef872f961 Auto merge of #74605 - rust-lang:vec-leak, r=Amanieu
Stabilize Vec::leak as a method

Closes https://github.com/rust-lang/rust/issues/62195

The signature is changed to a method rather than an associated function:

```diff
-pub fn leak<'a>(vec: Vec<T>) -> &'a mut [T]
+pub fn leak<'a>(self) -> &'a mut [T]
```

The reason for `Box::leak` not to be a method (`Deref` to an arbitrary `T` which might have its own, different `leak` method) does not apply.
2020-08-01 22:29:30 +00:00
bors
05762e3d6f Auto merge of #74726 - oli-obk:tracing, r=Mark-Simulacrum
Move from `log` to `tracing`

The only visible change is that we now get timestamps in our logs:

```
Jul 24 18:41:01.065 TRACE rustc_mir::transform::const_prop: skipping replace of Rvalue::Use(const () because it is already a const
Jul 24 18:41:01.065 TRACE rustc_mir::transform::const_prop: propagated into _2
Jul 24 18:41:01.065 TRACE rustc_mir::transform::const_prop: visit_constant: const ()
```

This PR was explicitly designed to be as low-impact as possible. We can now move to using the name `tracing` insteads of `log` on a crate-by-crate basis and use any of the other tracing features where desirable.

As far as I can tell this will allow tools to seamlessly keep working (since they are using `rustc_driver::init_log...`).

This is the first half of step 1 of the accepted `tracing` MCP (https://github.com/rust-lang/compiler-team/issues/331)
2020-08-01 20:43:12 +00:00
bors
de10abf50c Auto merge of #75016 - Manishearth:rollup-x553g7j, r=Manishearth
Rollup of 6 pull requests

Successful merges:

 - #74977 (Clean up E0741 error explanation)
 - #74981 (Some fixes for `plugin.md` in unstable-book)
 - #74983 (Replace a recursive algorithm with an iterative one and a stack.)
 - #74995 (Update the WASI libc build to LLVM 10.)
 - #74996 (submodules: update cargo from 974eb438d to 2d5c2381e)
 - #75007 (Clean up E0743 explanation)

Failed merges:

r? @ghost
2020-08-01 18:52:30 +00:00
Josh Stone
66a02ec2d6 Use a slice pattern instead of rchunks_exact(_).next()
This is a minor cleanup, but trying a single-use `rchunks` iterator can
be more directly matched with a slice pattern, `[.., a, b]`.
2020-08-01 11:41:59 -07:00
Alexis Bourget
54eb3768e0 Reword incorrect use of zeroed() 2020-08-01 19:28:19 +02:00
Amanieu d'Antras
df3a30aee4 Add Vec::spare_capacity_mut 2020-08-01 18:24:35 +01:00
Manish Goregaokar
2e53ac53e7
Rollup merge of #75007 - GuillaumeGomez:cleanup-e0743, r=pickfire
Clean up E0743 explanation

r? @Dylan-DPC
2020-08-01 09:30:19 -07:00
Manish Goregaokar
302dfbc567
Rollup merge of #74996 - matthiaskrgr:submodule_upd, r=ehuss
submodules: update cargo from 974eb438d to 2d5c2381e

Changes:
````
Use the same index location on nightly as beta
relax deprecated diagnostic message check
Don't print to raw stderr in test
Emit the `test` field in cargo metadata
````

r? @ehuss

Trying to get the fix to the registry-index-hash upstream soonish.
2020-08-01 09:30:18 -07:00
Manish Goregaokar
58df0a0473
Rollup merge of #74995 - sunfishcode:update-llvm, r=alexcrichton
Update the WASI libc build to LLVM 10.

Among other things, this brings in [the `__main_argc_argv`] patch,
which simplifies the interaction between the compiler and WASI libc's
startup code, which will help work on reactor support.

[the `__main_argc_argv` patch]: 00072c08c7

r? @alexcrichton
2020-08-01 09:30:16 -07:00
Manish Goregaokar
69515819b6
Rollup merge of #74983 - oli-obk:mir_opt_goto_chain, r=ecstatic-morse
Replace a recursive algorithm with an iterative one and a stack.

fixes #74931
2020-08-01 09:30:14 -07:00
Manish Goregaokar
e65d6ed80f
Rollup merge of #74981 - giraffate:fix_sample_codes_in_unstable_book_plugin, r=GuilliameGomez
Some fixes for `plugin.md` in unstable-book

- sample codes not working
I referred to https://github.com/rust-lang/rust/blob/master/src/test/ui-fulldeps/auxiliary/lint-plugin-test.rs and https://github.com/rust-lang/rust/blob/master/src/test/ui-fulldeps/lint-plugin.rs.

- broken link
https://github.com/rust-lang/rust/blob/master/src/librustc/lint/builtin.rs -> https://github.com/rust-lang/rust/blob/master/src/librustc_session/lint/builtin.rs
2020-08-01 09:30:13 -07:00
Manish Goregaokar
60bf83d215
Rollup merge of #74977 - GuillaumeGomez:cleanup-e0741, r=pickfire
Clean up E0741 error explanation

r? @Dylan-DPC
2020-08-01 09:30:11 -07:00
Oliver Scherer
c7290379be Remove chrono feature from tracing 2020-08-01 16:24:52 +02:00
Guillaume Gomez
4bd313fb0f Clean up E0743 explanation 2020-08-01 15:19:00 +02:00
bors
cfdf9d3355 Auto merge of #74993 - sunfishcode:update-wasi-libc, r=alexcrichton
Update the bundled wasi-libc with libstd

This just updates WASI libc, in preparation for WASI reactor support in
a separate change.

r? @alexcrichton
2020-08-01 11:25:31 +00:00
bors
dfe1e3b641 Auto merge of #74582 - Lezzz:rename-hair, r=nikomatsakis
Rename HAIR to THIR (Typed HIR).

r? @nikomatsakis

Originally suggested by @eddyb
2020-08-01 09:25:03 +00:00
bors
b5eae9c44d Auto merge of #74373 - lcnr:array_chunks, r=withoutboats
add `slice::array_chunks` to std

Now that #74113 has landed, these methods are suddenly usable. A rebirth of #72334

Tests are directly copied from `chunks_exact` and some additional tests for type inference.

r? @withoutboats as you are both part of t-libs and working on const generics. closes #60735
2020-08-01 06:54:14 +00:00
Bastian Kauschke
d51b71a35a add tracking issue 2020-08-01 07:49:24 +02:00
Oliver Scherer
aba0251c78 Replace a recursive algorithm with an iterative one and a stack. 2020-08-01 07:20:43 +02:00
bors
18e2a89199 Auto merge of #74945 - dingxiangfei2009:promote-static-ref-deref, r=oli-obk
[mir] Special treatment for dereferencing a borrow to a static definition

Fix #70584.

As suggested by @oli-obk in this [comment](https://github.com/rust-lang/rust/issues/70584#issuecomment-626009260), one can chase the definition of the local variable being de-referenced and check if it is a true static variable. If that is the case, `validate_place` will admit the promotion.

This is my first time to contribute to `rustc`, and I have two questions.
1. A generalization to some extent is applied to decide if the promotion is possible in the static context. In case that there are more projection operations preceding the de-referencing, `validate_place` recursively decent into inner projection operations. I have put thoughts into its correctness but I am not totally sure about it.
2. I have a hard time to find a good place for the test case. This patch has to do with MIR, but this test case would look out of place compared to other tests in `src/test/ui/mir` or `src/test/ui/borrowck` because it does not generate errors while others do. It is tentatively placed in `src/test/ui/statics` for now.

Thank you for any comments and suggestions!
2020-08-01 04:34:05 +00:00
bors
22e6099330 Auto merge of #74717 - davidtwco:issue-74636-polymorphized-closures-inherited-params, r=oli-obk
mir: add `used_generic_parameters_needs_subst`

Fixes #74636.

This PR adds a `used_generic_parameters_needs_subst` helper function which checks whether a type needs substitution, but only for parameters that the `unused_generic_params` query considers used. This is used in the MIR interpreter to make the check for some pointer casts and for reflection intrinsics more precise.

I've opened this as a draft PR because this might not be the approach we want to fix this issue and we have to decide what to do about the reflection case.

r? @eddyb
cc @lcnr @wesleywiser
2020-08-01 02:48:34 +00:00
bors
b544b43b10 Auto merge of #74994 - JohnTitor:rollup-eknaekv, r=JohnTitor
Rollup of 6 pull requests

Successful merges:

 - #74644 (Remove `linked_list_extras` methods.)
 - #74968 (Run all tests if have no specified tests)
 - #74982 (1.45.2 release notes)
 - #74984 (Miri: fix ICE when unwinding past topmost stack frame)
 - #74986 (fix part of comparison that would always evaluate to "true", probably an oversight)
 - #74991 (Fix Const-Generic Cycle ICE #74199)

Failed merges:

r? @ghost
2020-07-31 23:52:46 +00:00
Matthias Krüger
21cab87f08 submodules: update cargo from 974eb438d to 2d5c2381e
Changes:
````
Use the same index location on nightly as beta
relax deprecated diagnostic message check
Don't print to raw stderr in test
Emit the `test` field in cargo metadata
````
2020-08-01 01:41:36 +02:00
Dan Gohman
9ade8366c0 Update the WASI libc build to LLVM 10.
Among other things, this brings in [the `__main_argc_argv`] patch,
which simplifies the interaction between the compiler and WASI libc's
startup code, which will help work on reactor support.

[the `__main_argc_argv` patch]: 00072c08c7
2020-07-31 16:07:08 -07:00
Yuki Okushi
3ad6feda56
Rollup merge of #74991 - JulianKnodt:74199, r=lcnr
Fix Const-Generic Cycle ICE #74199

This PR intends to fix the bug in Issue #74199 by following the suggestion provided of ignoring the error that causes the ICE.

This does not fix the underlying cycle detection issue, but fixes the ICE.
Also adds a test to check that it doesn't causes an ICE but returns a valid error for now.

r? @lcnr

Edit: Also it's funny how this PR number is an anagram of the issue number
2020-08-01 08:02:12 +09:00
Yuki Okushi
ff5ccc82eb
Rollup merge of #74986 - matthiaskrgr:cmp_true, r=oli-obk
fix part of comparison that would always evaluate to "true", probably an oversight

cc  @jumbatm
2020-08-01 08:02:11 +09:00
Yuki Okushi
bb397c465c
Rollup merge of #74984 - RalfJung:miri-unwind-top, r=oli-obk
Miri: fix ICE when unwinding past topmost stack frame

Fixes https://github.com/rust-lang/miri/issues/1389
2020-08-01 08:02:09 +09:00
Yuki Okushi
5434142318
Rollup merge of #74982 - jonas-schievink:relnotes-1.45.2, r=Mark-Simulacrum
1.45.2 release notes

(for master)

cc https://github.com/rust-lang/rust/pull/74958
2020-08-01 08:02:07 +09:00
Yuki Okushi
ad8230f57d
Rollup merge of #74968 - lzutao:no-args, r=Mark-Simulacrum
Run all tests if have no specified tests

The behaviour was changed in https://github.com/rust-lang/rust/pull/74905#discussion_r463259562
cc @alex if you could check it again, thank you.
2020-08-01 08:02:06 +09:00
Yuki Okushi
ab4570eaf0
Rollup merge of #74644 - crlf0710:drop_old_stuff, r=Amanieu
Remove `linked_list_extras` methods.

Removing these in favor of the `Cursor` API in https://github.com/rust-lang/rust/issues/58533 .
Closes #27794.

r? @Amanieu
2020-08-01 08:02:04 +09:00
Valentin Lazureanu
40e6dccfb4 Rename HAIR to THIR (Typed HIR). 2020-07-31 22:15:12 +00:00
Bastian Kauschke
b90bc8d70b fix rustdoc generic param order 2020-07-31 23:51:19 +02:00
Dan Gohman
aaffb06c04 Update the bundled wasi-libc with libstd
This just updates WASI libc, in preparation for WASI reactor support in
a separate change.
2020-07-31 14:47:19 -07:00