Commit Graph

125794 Commits

Author SHA1 Message Date
Tyler Mandry
14c0e4c9ea
Rollup merge of #75637 - ctaggart:wasm32build, r=Mark-Simulacrum
update stacker to 0.1.11 to unbreak build for wasm32-unknown-unknown

Like #72079, this updates stacker. The related problem is stacker is here https://github.com/rust-lang/stacker/issues/42. It was fixed by switching from `libc::c_void` to `std::ffi::c_void` https://github.com/rust-lang/stacker/pull/43/files.
2020-08-17 20:20:29 -07:00
Tyler Mandry
d70ae9bbb7
Rollup merge of #75603 - mati865:mingw-out-implib-compat, r=oli-obk
Use more compatible out-implib style

When calling `rust-lld` directly it accepts only `--out-implib {}` or `--out-implib={}` not `--out-implib,{}`.
2020-08-17 20:20:27 -07:00
Tyler Mandry
d6ff46c3be
Rollup merge of #75548 - dancrossnyc:master, r=tmandry
librustc_metadata::locator: Properly detect file type.

Make sure to test file types against the non-canonicalized name to
avoid detecting the wrong type.  Some systems save build artifacts
into associate file stores that do not preserve extensions, and
then link to those using conventionally-named symbolic links, that
are the arguments to `rustc` et al.  If we canonicalize before
testing the type, we resolve the symlink, the extension is
lost and we might treat rlibs and rmetas as dylibs.

The fix is to tntroduce a temporary to hold the canonicalized name,
compare against the non-canonical name, and add a comment
explaining what's going on for the would-be mainter who sees a
potential cleanup.

Signed-off-by: Dan Cross <dcross@google.com>
2020-08-17 20:20:25 -07:00
bors
d7dcae03c9 Auto merge of #75653 - JohnTitor:rollup-0ejtdfo, r=JohnTitor
Rollup of 8 pull requests

Successful merges:

 - #75389 (attempt to improve span_label docs)
 - #75392 (Add `as_uninit`-like methods to pointer types and unify documentation of `as_ref` methods)
 - #75464 (Move to intra doc links for ascii.rs and panic.rs)
 - #75578 (Allowing raw ptr dereference in const fn)
 - #75613 (Add explanation for `&mut self` method call when expecting `-> Self`)
 - #75626 (Clean up E0754 explanation)
 - #75629 (Use intra-doc links in `std::env`, `std::alloc` and `std::error`)
 - #75634 (Mark x86_64-linux-kernel as *)

Failed merges:

r? @ghost
2020-08-18 01:11:43 +00:00
Yuki Okushi
51154d8295
Rollup merge of #75634 - scileo:fix-75581, r=ehuss
Mark x86_64-linux-kernel as *

This should fix #75581.

This is my first contribution to the Rust organization. Please, feel free to tell me if I did anything wrong :)
2020-08-18 09:27:53 +09:00
Yuki Okushi
732bebd854
Rollup merge of #75629 - EllenNyan:ellen-intra-doc-links, r=jyn514
Use intra-doc links in `std::env`, `std::alloc` and `std::error`

This is partial fixes for #75080.
2020-08-18 09:27:51 +09:00
Yuki Okushi
791768e8f6
Rollup merge of #75626 - GuillaumeGomez:cleanup-e0754, r=pickfire
Clean up E0754 explanation

r? @Dylan-DPC

cc @pickfire
2020-08-18 09:27:49 +09:00
Yuki Okushi
48da6758e5
Rollup merge of #75613 - estebank:explain-mut-method, r=petrochenkov
Add explanation for `&mut self` method call when expecting `-> Self`

When a user tries to use a method as if it returned a new value of the
same type as its receiver, we will emit a type error. Try to detect this
and provide extra explanation that the method modifies the receiver
in-place.

This has confused people in the wild, like in
https://users.rust-lang.org/t/newbie-why-the-commented-line-stops-the-snippet-from-compiling/47322
2020-08-18 09:27:47 +09:00
Yuki Okushi
8eb805c55c
Rollup merge of #75578 - 5M1Sec:master, r=oli-obk
Allowing raw ptr dereference in const fn

Reflect on issue #75340
Discussion in previous PR  #75425

## Updates
Change `UnsafetyViolationKind::General` to `UnsafetyViolationKind::GeneralAndConstFn` in check_unsafety.rs

Remove `unsafe` in min_const_fn_unsafe_bad.rs

Bless min_const_fn

Add the test case from issue 75340
***
Sorry for the chaos. I messed up and ended up deleting the repo in the last PR. I have to create a new PR for the new repo. I will make a feature branch next time. I will edit the old PR once I receive the commends.

@RalfJung Thank you all for your replies. They are helpful!

r? @oli-obk
2020-08-18 09:27:45 +09:00
Yuki Okushi
d18719bbaf
Rollup merge of #75464 - poliorcetics:intra-links-panic-and-ascii, r=jyn514
Move to intra doc links for ascii.rs and panic.rs

Helps with #75080.

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

I also updated the doc to fix the wording in `AsciiExt` since it is now deprecated.
The two file are small changes so I bundled them together.

Some links could not be changed to make them work, I believe those are known issues with primitive types.
2020-08-18 09:27:43 +09:00
Yuki Okushi
5498367faf
Rollup merge of #75392 - TimDiekmann:non-null-uninit-slice, r=RalfJung
Add `as_uninit`-like methods to pointer types and unify documentation of `as_ref` methods

This adds a convenient method to retrieve a `&(mut) [MaybeUninit<T>]` from slice pointers (`*const [T]`, `*mut [T]`, `NonNull<[T]>`). See also https://github.com/rust-lang/wg-allocators/issues/66#issuecomment-671789105.

~I'll add a tracking issue as soon as it's reviewed and CI passed.~
Tracking Issue: #75402

r? @RalfJung
2020-08-18 09:27:42 +09:00
Yuki Okushi
381a841d8d
Rollup merge of #75389 - RalfJung:span_label, r=davidtwco
attempt to improve span_label docs

I was still confused by the `span_label` docs, so I did some more digging. However, this needs careful checking as I have no idea if any of this is correct.
2020-08-18 09:27:39 +09:00
Joshua Nelson
4f9cd74926 Resolve true and false as booleans 2020-08-17 20:13:58 -04:00
bors
668ef72f44 Auto merge of #75120 - JulianKnodt:rm_reps, r=oli-obk
rust_ast::ast => rustc_ast

Rework of #71199 which is a rework #70621

Still working on this but just made the PR to track progress

r? @Dylan-DPC
2020-08-17 23:16:08 +00:00
Aleksey Kladov
695d86f584 Make OnceCell<T> transparent to dropck
See the failed build in

https://github.com/rust-lang/rust/pull/75555#issuecomment-675016718

for an example where we need this in real life
2020-08-18 00:34:54 +02:00
Austin Lasher
28ac141b72 Update MIR tests with comment verbosity fix 2020-08-17 17:29:48 -04:00
Austin Lasher
bf1c024f99 Suppress verbose MIR comments for trivial types 2020-08-17 17:18:23 -04:00
bors
792c645ca7 Auto merge of #75145 - davidtwco:issue-60607-preallocate-defid-for-lang-items, r=petrochenkov
Reference lang items during AST lowering

Fixes #60607 and fixes #61019.

This PR introduces `QPath::LangItem` to the HIR and uses it in AST lowering instead of constructing a `hir::Path` from a slice of symbols:

- Credit for much of this work goes to @matthewjasper, I basically just [rebased their earlier work](a227c706b7 (diff-c0f791ead38d2d02916faaad0f56f41d)).
- ~~Changes to Clippy might not be correct, they compile but attempting to run tests through `./x.py` produced failures which appeared spurious, so I didn't run any clippy tests.~~
- Changes to save analysis might not be correct - tests pass but I don't have a lot of confidence in those changes being correct.
- I've used `GenericBounds::LangItemTrait` rather than changing `PolyTraitRef`, as suggested by @matthewjasper [in this comment](a227c706b7 (r40107992)) but I'd prefer that be left for a follow-up.
- I've split things into smaller commits fairly arbitrarily to make the diff easier to review, each commit should compile but might not pass tests until the final commit.

r? @oli-obk
cc @matthewjasper
2020-08-17 20:51:59 +00:00
Ujjwal Sharma
a888b02884 rust_ast::ast => rustc_ast 2020-08-17 20:32:32 +00:00
Alexis Bourget
431a465a8f Move to intra doc links for keyword documentation 2020-08-17 22:17:14 +02:00
bors
33c96b4d97 Auto merge of #74748 - simonvandel:simplify-discriminant-arm, r=wesleywiser
MIR-OPT: Make SimplifyBranchSame able to remove identity match with fieldless variant

Modifies SimplifyBranchSame so that it can see that the statements can be considered equal in the following example
`_0 = _1` and `discriminant(_0) = discriminant(0)` are considered equal if 0 is a fieldless variant of an enum.
2020-08-17 18:33:24 +00:00
Dan Cross
6ad6d8c25c librustc_metadata::locator: Properly detect file type.
Make sure to test for file types against the non-canonicalized name
to avoid detecting the wrong type.  Some systems save build artifacts
into associative file stores that do not preserve extensions, and
then link to those using conventionally-named symbolic links that
are the arguments to `rustc` et al.  If we canonicalize before
testing the type, we resolve the symlink, the extension is lost and
we might treat rlibs and rmetas as dylibs.

The fix is to introduce a temporary to hold the canonicalized name,
compare against the non-canonical name, and add a comment
explaining what's going on for the would-be maintainer who sees a
potential cleanup.

Signed-off-by: Dan Cross <dcross@google.com>
2020-08-17 13:23:29 -04:00
Cameron Taggart
2b1fc16153 update stacker to 0.1.11 to unbreak build for wasm32-unknown-unknown 2020-08-17 10:57:53 -06:00
bors
8d185cabbd Auto merge of #75187 - pawanbisht62:feature/incorporate-tracing, r=oli-obk
Incorporated Tracing Crate in some libraries

Issue #74747
2020-08-17 16:40:10 +00:00
jumbatm
bc15dd6dde Wrap recursion in ensure_sufficient_stack. 2020-08-18 02:01:05 +10:00
jumbatm
1321a2dce3 Also accept Refs for is_primitive_or_pointer 2020-08-18 02:01:05 +10:00
jumbatm
7708abbbef Avoid double hashset lookup.
Co-authored-by: Bastian Kauschke <bastian_kauschke@hotmail.de>
2020-08-18 02:01:04 +10:00
jumbatm
6c57de1166 Don't memoize seen types.
That cache is unlikely to be particularly useful within a single
invocation of structurally_same_type, especially compared to memoizing
results across _all_ invocations of that function.
2020-08-18 02:01:04 +10:00
jumbatm
bca48ad7ac Reduce indentation by replacing match arm w/ early return. 2020-08-18 02:01:04 +10:00
jumbatm
80c2c80d52 Remove structural equiv check for Array const. 2020-08-18 02:01:04 +10:00
jumbatm
a1fa4e05ac Remove unnecessary rebinding of def ids. 2020-08-18 02:01:04 +10:00
jumbatm
154b74e8f9 Actually introduce a cycle in Reffy test. 2020-08-18 02:01:04 +10:00
jumbatm
db753137a1 Fix stack overflow for recursive types.
Adds a seen set to structurally_same_type to avoid recursing
indefinitely when a reference or pointer member introduces a cycle in
the visited types.
2020-08-18 02:01:04 +10:00
jumbatm
b0eb55a092 Add test demonstrating the issue. 2020-08-18 02:01:04 +10:00
Guillaume Gomez
4fa69cb3ce Improve display 2020-08-17 17:22:53 +02:00
Ellen
e7a7279750 Remove unnecessary links in env.rs 2020-08-17 15:16:09 +01:00
Aleksey Kladov
0c33df9c77 ⬆️ rust-analyzer 2020-08-17 16:15:20 +02:00
bors
e8df0b8932 Auto merge of #74940 - oli-obk:const_is_null, r=RalfJung
Make `<*const T>::is_null` const fn

r? @RalfJung

cc @rust-lang/wg-const-eval

tracking issue: #74939
2020-08-17 14:13:13 +00:00
Ellen
a2dfc3ec78 Switch to intra-doc links for std/src/alloc.rs 2020-08-17 14:42:40 +01:00
Ellen
b6d2868caa Switch to intra-doc links for std/src/env.rs 2020-08-17 14:42:23 +01:00
Ellen
509cad7f2f Switch to intra-doc links for std/src/error.rs 2020-08-17 14:42:16 +01:00
Oliver Scherer
daf7a37510 Make a test platform independent 2020-08-17 15:31:48 +02:00
Guillaume Gomez
cbc13c5eb7 Clean up E0754 explanation 2020-08-17 15:14:53 +02:00
David Wood
5703b2863e
polymorphize: ∃ used param ∈ predicate → all used
This commit modifies polymorphization's handling of predicates so that
if any generic parameter is used in a predicate then all parameters in
that predicate are used.

Signed-off-by: David Wood <david@davidtw.co>
2020-08-17 14:13:58 +01:00
Tim Diekmann
c48f784418 Fix typo in comment 2020-08-17 15:05:19 +02:00
David Wood
f1ce2948db
clippy: support QPath::LangItem
This commit updates clippy with the introduction of `QPath::LangItem` so
that it still compiles.

Signed-off-by: David Wood <david@davidtw.co>
2020-08-17 13:55:05 +01:00
Tim Diekmann
93e074bc8a Add as_uninit-like methods to pointer types and unify documentation of as_ref methods
Fix example in `NonNull::as_uninit_slice`


Rename feature gate to "ptr_as_uninit"


Make methods more consistent with already stable methods


Make `pointer::as_uninit_slice` return an `Option`


Fix placement for `// SAFETY` section


Add `as_uninit_ref` and `as_uninit_mut` to pointers


Fix doctest


Update tracking issue


Fix doc links


Apply suggestions from review


Make wording about counterparts consistent


Fix doc links


Improve documentation

Fix doc-tests


Fix doc links ... again


Apply suggestions from review


Apply suggestions from Review


Apply suggestion from review to all affected files


Add missing words in safety sections in `as_uninit_slice_mut`


Fix safety-comment in `NonNull::as_uninit_slice_mut`
2020-08-17 14:23:14 +02:00
Ralf Jung
edb39c0d20 attempt to improve span_label docs 2020-08-17 14:15:47 +02:00
bors
8cdc94e840 Auto merge of #75592 - RalfJung:miri-int-align, r=oli-obk
miri engine: add option to use force_int for alignment check

This is needed for https://github.com/rust-lang/miri/issues/1074. The Miri-side patch is at https://github.com/rust-lang/miri/pull/1513.

r? @oli-obk
2020-08-17 12:11:41 +00:00
Ralf Jung
6da8503dff
fix typo
Co-authored-by: Oliver Scherer <github35764891676564198441@oli-obk.de>
2020-08-17 14:11:03 +02:00