]> git.lizzy.rs Git - rust.git/log
rust.git
3 years agoAuto merge of #75654 - tmandry:rollup-ej0oezi, r=tmandry
bors [Tue, 18 Aug 2020 03:21:22 +0000 (03:21 +0000)]
Auto merge of #75654 - tmandry:rollup-ej0oezi, r=tmandry

Rollup of 3 pull requests

Successful merges:

 - #75548 (librustc_metadata::locator: Properly detect file type.)
 - #75603 (Use more compatible out-implib style)
 - #75637 (update stacker to 0.1.11 to unbreak build for wasm32-unknown-unknown)

Failed merges:

r? @ghost

3 years agoRollup merge of #75637 - ctaggart:wasm32build, r=Mark-Simulacrum
Tyler Mandry [Tue, 18 Aug 2020 03:20:29 +0000 (20:20 -0700)]
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.

3 years agoRollup merge of #75603 - mati865:mingw-out-implib-compat, r=oli-obk
Tyler Mandry [Tue, 18 Aug 2020 03:20:27 +0000 (20:20 -0700)]
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,{}`.

3 years agoRollup merge of #75548 - dancrossnyc:master, r=tmandry
Tyler Mandry [Tue, 18 Aug 2020 03:20:25 +0000 (20:20 -0700)]
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>
3 years agoAuto merge of #75653 - JohnTitor:rollup-0ejtdfo, r=JohnTitor
bors [Tue, 18 Aug 2020 01:11:43 +0000 (01:11 +0000)]
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

3 years agoRollup merge of #75634 - scileo:fix-75581, r=ehuss
Yuki Okushi [Tue, 18 Aug 2020 00:27:53 +0000 (09:27 +0900)]
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 :)

3 years agoRollup merge of #75629 - EllenNyan:ellen-intra-doc-links, r=jyn514
Yuki Okushi [Tue, 18 Aug 2020 00:27:51 +0000 (09:27 +0900)]
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.

3 years agoRollup merge of #75626 - GuillaumeGomez:cleanup-e0754, r=pickfire
Yuki Okushi [Tue, 18 Aug 2020 00:27:49 +0000 (09:27 +0900)]
Rollup merge of #75626 - GuillaumeGomez:cleanup-e0754, r=pickfire

Clean up E0754 explanation

r? @Dylan-DPC

cc @pickfire

3 years agoRollup merge of #75613 - estebank:explain-mut-method, r=petrochenkov
Yuki Okushi [Tue, 18 Aug 2020 00:27:47 +0000 (09:27 +0900)]
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

3 years agoRollup merge of #75578 - 5M1Sec:master, r=oli-obk
Yuki Okushi [Tue, 18 Aug 2020 00:27:45 +0000 (09:27 +0900)]
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

3 years agoRollup merge of #75464 - poliorcetics:intra-links-panic-and-ascii, r=jyn514
Yuki Okushi [Tue, 18 Aug 2020 00:27:43 +0000 (09:27 +0900)]
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.

3 years agoRollup merge of #75392 - TimDiekmann:non-null-uninit-slice, r=RalfJung
Yuki Okushi [Tue, 18 Aug 2020 00:27:42 +0000 (09:27 +0900)]
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

3 years agoRollup merge of #75389 - RalfJung:span_label, r=davidtwco
Yuki Okushi [Tue, 18 Aug 2020 00:27:39 +0000 (09:27 +0900)]
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.

3 years agoAuto merge of #75120 - JulianKnodt:rm_reps, r=oli-obk
bors [Mon, 17 Aug 2020 23:16:08 +0000 (23:16 +0000)]
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

3 years agoAuto merge of #75145 - davidtwco:issue-60607-preallocate-defid-for-lang-items, r...
bors [Mon, 17 Aug 2020 20:51:59 +0000 (20:51 +0000)]
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](https://github.com/matthewjasper/rust/commit/a227c706b7809ff07021baf3856b7540d5b57f8a#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](https://github.com/matthewjasper/rust/commit/a227c706b7809ff07021baf3856b7540d5b57f8a#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

3 years agorust_ast::ast => rustc_ast
Ujjwal Sharma [Mon, 27 Apr 2020 17:56:11 +0000 (23:26 +0530)]
rust_ast::ast => rustc_ast

3 years agoAuto merge of #74748 - simonvandel:simplify-discriminant-arm, r=wesleywiser
bors [Mon, 17 Aug 2020 18:33:24 +0000 (18:33 +0000)]
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.

3 years agolibrustc_metadata::locator: Properly detect file type.
Dan Cross [Sat, 15 Aug 2020 00:29:04 +0000 (20:29 -0400)]
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>
3 years agoupdate stacker to 0.1.11 to unbreak build for wasm32-unknown-unknown
Cameron Taggart [Mon, 17 Aug 2020 16:57:53 +0000 (10:57 -0600)]
update stacker to 0.1.11 to unbreak build for wasm32-unknown-unknown

3 years agoAuto merge of #75187 - pawanbisht62:feature/incorporate-tracing, r=oli-obk
bors [Mon, 17 Aug 2020 16:40:10 +0000 (16:40 +0000)]
Auto merge of #75187 - pawanbisht62:feature/incorporate-tracing, r=oli-obk

Incorporated Tracing Crate in some libraries

Issue #74747

3 years agoImprove display
Guillaume Gomez [Mon, 17 Aug 2020 15:22:53 +0000 (17:22 +0200)]
Improve display

3 years agoRemove unnecessary links in env.rs
Ellen [Mon, 17 Aug 2020 14:16:00 +0000 (15:16 +0100)]
Remove unnecessary links in env.rs

3 years agoAuto merge of #74940 - oli-obk:const_is_null, r=RalfJung
bors [Mon, 17 Aug 2020 14:13:13 +0000 (14:13 +0000)]
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

3 years agoSwitch to intra-doc links for std/src/alloc.rs
Ellen [Mon, 17 Aug 2020 13:42:40 +0000 (14:42 +0100)]
Switch to intra-doc links for std/src/alloc.rs

3 years agoSwitch to intra-doc links for std/src/env.rs
Ellen [Mon, 17 Aug 2020 13:42:23 +0000 (14:42 +0100)]
Switch to intra-doc links for std/src/env.rs

3 years agoSwitch to intra-doc links for std/src/error.rs
Ellen [Mon, 17 Aug 2020 13:41:57 +0000 (14:41 +0100)]
Switch to intra-doc links for std/src/error.rs

3 years agoMake a test platform independent
Oliver Scherer [Mon, 17 Aug 2020 13:31:48 +0000 (15:31 +0200)]
Make a test platform independent

3 years agoClean up E0754 explanation
Guillaume Gomez [Mon, 17 Aug 2020 13:14:53 +0000 (15:14 +0200)]
Clean up E0754 explanation

3 years agoclippy: support `QPath::LangItem`
David Wood [Tue, 4 Aug 2020 13:24:13 +0000 (14:24 +0100)]
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>
3 years agoAdd `as_uninit`-like methods to pointer types and unify documentation of `as_ref...
Tim Diekmann [Mon, 17 Aug 2020 12:22:59 +0000 (14:22 +0200)]
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`

3 years agoattempt to improve span_label docs
Ralf Jung [Tue, 11 Aug 2020 07:42:25 +0000 (09:42 +0200)]
attempt to improve span_label docs

3 years agoAuto merge of #75592 - RalfJung:miri-int-align, r=oli-obk
bors [Mon, 17 Aug 2020 12:11:41 +0000 (12:11 +0000)]
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

3 years agofix typo
Ralf Jung [Mon, 17 Aug 2020 12:11:03 +0000 (14:11 +0200)]
fix typo

Co-authored-by: Oliver Scherer <github35764891676564198441@oli-obk.de>
3 years agoMark x86_64-linux-kernel as *
Sasha [Mon, 17 Aug 2020 10:44:18 +0000 (12:44 +0200)]
Mark x86_64-linux-kernel as *

3 years agoAuto merge of #75535 - denisvasilik:intra-doc-links-any, r=jyn514
bors [Mon, 17 Aug 2020 08:00:45 +0000 (08:00 +0000)]
Auto merge of #75535 - denisvasilik:intra-doc-links-any, r=jyn514

Move to intra-doc links for /library/core/src/any.rs

Helps with #75080.

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

Known issues:

* Links from `core` to `std` (#74481):
    * `[Box]: ../../std/boxed/struct.Box.html`

3 years agoAuto merge of #75468 - poliorcetics:intra-links-fs, r=jyn514
bors [Mon, 17 Aug 2020 06:02:16 +0000 (06:02 +0000)]
Auto merge of #75468 - poliorcetics:intra-links-fs, r=jyn514

Move to intra doc links in std/src/fs.rs

Helps with #75080.

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

3 years agoAuto merge of #75568 - ehuss:cloudabi-tier3, r=Mark-Simulacrum
bors [Mon, 17 Aug 2020 03:52:46 +0000 (03:52 +0000)]
Auto merge of #75568 - ehuss:cloudabi-tier3, r=Mark-Simulacrum

Move CloudABI to tier 3.

The CloudABI target hasn't had much work done on it in a while, and it doesn't appear to be in active use. It has a fairly substantial amount of code, particularly in the [sys module](https://github.com/rust-lang/rust/tree/5addb135edc2653b07670482a430aac9b655a86b/library/std/src/sys/cloudabi) that requires actively supporting. I contacted @EdSchouten who indicated that many of the CloudABI concepts are now in WASI, and that they are OK with the target being moved to tier 3.

3 years agoAllowing raw ptr dereference in const fn
5M1Sec [Sun, 16 Aug 2020 03:39:09 +0000 (23:39 -0400)]
Allowing raw ptr dereference in const fn

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

Co-authored-by: lzutao <taolzu@gmail.com>
3 years agoAuto merge of #75014 - Amanieu:fix_asm_reg, r=nagisa
bors [Mon, 17 Aug 2020 01:57:50 +0000 (01:57 +0000)]
Auto merge of #75014 - Amanieu:fix_asm_reg, r=nagisa

Work around LLVM issues with explicit register in inline asm

Fixes #74658

3 years agoAdd explanation for `&mut self` method call when expecting `-> Self`
Esteban Küber [Mon, 17 Aug 2020 01:33:30 +0000 (18:33 -0700)]
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

3 years agoAuto merge of #74562 - pickfire:is_ascii_branchless, r=nagisa
bors [Sun, 16 Aug 2020 23:52:32 +0000 (23:52 +0000)]
Auto merge of #74562 - pickfire:is_ascii_branchless, r=nagisa

Remove branch in optimized is_ascii

Performs slightly better in short or medium bytes by eliminating
the last branch check on `byte_pos == len` and always check the
last byte as it is always at most one `usize`.

Benchmark, before `libcore`, after `libcore_new`. It improves
medium and short by 1ns but regresses unaligned_tail by 2ns,
either way we can get unaligned_tail have a tiny chance of 1/8
on a 64 bit machine. I don't think we should bet on that, the
probability is worse than dice.

```
test long::case00_libcore                     ... bench:          38 ns/iter (+/- 1) = 183947 MB/s
test long::case00_libcore_new                 ... bench:          38 ns/iter (+/- 1) = 183947 MB/s
test long::case01_iter_all                    ... bench:         227 ns/iter (+/- 6) = 30792 MB/s
test long::case02_align_to                    ... bench:          40 ns/iter (+/- 1) = 174750 MB/s
test long::case03_align_to_unrolled           ... bench:          19 ns/iter (+/- 1) = 367894 MB/s
test medium::case00_libcore                   ... bench:           5 ns/iter (+/- 0) = 6400 MB/s
test medium::case00_libcore_new               ... bench:           4 ns/iter (+/- 0) = 8000 MB/s
test medium::case01_iter_all                  ... bench:          20 ns/iter (+/- 1) = 1600 MB/s
test medium::case02_align_to                  ... bench:           6 ns/iter (+/- 0) = 5333 MB/s
test medium::case03_align_to_unrolled         ... bench:           5 ns/iter (+/- 0) = 6400 MB/s
test short::case00_libcore                    ... bench:           7 ns/iter (+/- 0) = 1000 MB/s
test short::case00_libcore_new                ... bench:           6 ns/iter (+/- 0) = 1166 MB/s
test short::case01_iter_all                   ... bench:           5 ns/iter (+/- 0) = 1400 MB/s
test short::case02_align_to                   ... bench:           5 ns/iter (+/- 0) = 1400 MB/s
test short::case03_align_to_unrolled          ... bench:           5 ns/iter (+/- 1) = 1400 MB/s
test unaligned_both::case00_libcore           ... bench:           4 ns/iter (+/- 0) = 7500 MB/s
test unaligned_both::case00_libcore_new       ... bench:           4 ns/iter (+/- 0) = 7500 MB/s
test unaligned_both::case01_iter_all          ... bench:          26 ns/iter (+/- 0) = 1153 MB/s
test unaligned_both::case02_align_to          ... bench:          13 ns/iter (+/- 2) = 2307 MB/s
test unaligned_both::case03_align_to_unrolled ... bench:          11 ns/iter (+/- 0) = 2727 MB/s
test unaligned_head::case00_libcore           ... bench:           5 ns/iter (+/- 0) = 6200 MB/s
test unaligned_head::case00_libcore_new       ... bench:           5 ns/iter (+/- 0) = 6200 MB/s
test unaligned_head::case01_iter_all          ... bench:          19 ns/iter (+/- 1) = 1631 MB/s
test unaligned_head::case02_align_to          ... bench:          10 ns/iter (+/- 0) = 3100 MB/s
test unaligned_head::case03_align_to_unrolled ... bench:          14 ns/iter (+/- 0) = 2214 MB/s
test unaligned_tail::case00_libcore           ... bench:           3 ns/iter (+/- 0) = 10333 MB/s
test unaligned_tail::case00_libcore_new       ... bench:           5 ns/iter (+/- 0) = 6200 MB/s
test unaligned_tail::case01_iter_all          ... bench:          19 ns/iter (+/- 0) = 1631 MB/s
test unaligned_tail::case02_align_to          ... bench:          10 ns/iter (+/- 0) = 3100 MB/s
test unaligned_tail::case03_align_to_unrolled ... bench:          13 ns/iter (+/- 0) = 2384 MB/s
```

Rough (unfair) maths on improvements for fun: 1ns * 7/8 - 2ns * 1/8 = 0.625ns

Inspired by fish and zsh clever trick to highlight missing linefeeds (⏎)
and branchless implementation of binary_search in rust.

cc @thomcc https://github.com/rust-lang/rust/pull/74066
r? @nagisa

3 years agoAuto merge of #75609 - tmandry:rollup-yrcmgke, r=tmandry
bors [Sun, 16 Aug 2020 22:00:29 +0000 (22:00 +0000)]
Auto merge of #75609 - tmandry:rollup-yrcmgke, r=tmandry

Rollup of 10 pull requests

Successful merges:

 - #74204 (Don't visit foreign function bodies when lowering ast to hir)
 - #74314 (rustc_typeck: construct {Closure,Generator}Substs more directly.)
 - #74346 (Use LocalDefId instead of HirId for reachable_set elements.)
 - #74399 (Move DelaySpanBugEmitted to ty::context)
 - #75177 (Add regression test for issue-66768)
 - #75223 (Add #[track_caller] to `Session::delay_span_bug`)
 - #75423 (Move to intra-doc links for /library/core/src/hint.rs)
 - #75485 (pin docs: add some forward references)
 - #75569 (Bump minor version of emsdk to 1.38.47)
 - #75596 (Switch to intra-doc links in /sys/windows/ext/{ffi,fs,process}.rs)

Failed merges:

r? @ghost

3 years agoRollup merge of #75596 - nixphix:docs/windows-ext, r=jyn514
Tyler Mandry [Sun, 16 Aug 2020 21:59:36 +0000 (14:59 -0700)]
Rollup merge of #75596 - nixphix:docs/windows-ext, r=jyn514

Switch to intra-doc links in /sys/windows/ext/{ffi,fs,process}.rs

Partial fix for #75080

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

r? @jyn514

3 years agoRollup merge of #75569 - tmiasko:emscripten, r=tlively
Tyler Mandry [Sun, 16 Aug 2020 21:59:34 +0000 (14:59 -0700)]
Rollup merge of #75569 - tmiasko:emscripten, r=tlively

Bump minor version of emsdk to 1.38.47

Release Notes:

```
v1.38.47: 10/02/2019
--------------------
 - Add support for FETCH API in WASM backend. This doesn't support FETCH in the
   main thread (`USE_FETCH_WORKER=0` is enforced). #9490
 - Redefine errno values to be consistent with wasi. This will let us avoid
   needing to convert the values back and forth as we use more wasi APIs.
   This is an ABI change, which should not be noticeable from user code
   unless you use errno defines (like EAGAIN) *and* keep around binaries
   compiled with an older version that you link against. In that case, you
   should rebuild them. See #9545.
 - Removed build option `-s ONLY_MY_CODE` as we now have much better solutions
   for that, like building to a wasm object file or using `STANDALONE_WASM`
   etc. (see
   https://github.com/emscripten-core/emscripten/wiki/WebAssembly-Standalone).
 - Emscripten now supports the config file (.emscripten) being placed in the
   emscripten directory rather that the current user's home directory.
   See #9543
```

Motivated by changes to errno values which are currently out of sync with those
in libc crate which uses wasi values already. Helps with #72808 and #75532.

3 years agoRollup merge of #75485 - RalfJung:pin, r=nagisa
Tyler Mandry [Sun, 16 Aug 2020 21:59:32 +0000 (14:59 -0700)]
Rollup merge of #75485 - RalfJung:pin, r=nagisa

pin docs: add some forward references

@nagisa had some questions about pinning that were answered in the docs, which they did not realize because that discussion is below the examples. I still think it makes sense to introduce the examples before that discussion, since it give the discussion something concrete to refer to, but this PR adds some forward references so people don't think the examples conclude the docs.

@nagisa do you think this would have helped?

3 years agoRollup merge of #75423 - denisvasilik:intra-doc-links-core-hint, r=dtolnay
Tyler Mandry [Sun, 16 Aug 2020 21:59:30 +0000 (14:59 -0700)]
Rollup merge of #75423 - denisvasilik:intra-doc-links-core-hint, r=dtolnay

Move to intra-doc links for /library/core/src/hint.rs

Helps with #75080.

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

3 years agoRollup merge of #75223 - Aaron1011:feature/session-track-caller, r=eddyb
Tyler Mandry [Sun, 16 Aug 2020 21:59:29 +0000 (14:59 -0700)]
Rollup merge of #75223 - Aaron1011:feature/session-track-caller, r=eddyb

Add #[track_caller] to `Session::delay_span_bug`

This forwards the caller span to `Handler::delay_span_bug`

3 years agoRollup merge of #75177 - JohnTitor:broken-mir-test, r=eddyb
Tyler Mandry [Sun, 16 Aug 2020 21:59:27 +0000 (14:59 -0700)]
Rollup merge of #75177 - JohnTitor:broken-mir-test, r=eddyb

Add regression test for issue-66768

Fixes #66768

This is fixed by #70452 (in particular, https://github.com/rust-lang/rust/pull/70452/files#diff-53aef089a36a8e2ed07627fc8915fe63R1763) and I'm not sure it's worth to add this test (i.e. the tests in #70452 are enough), so r? @eddyb to confirm it.

3 years agoRollup merge of #74399 - mark-i-m:ty-err-4, r=eddyb
Tyler Mandry [Sun, 16 Aug 2020 21:59:25 +0000 (14:59 -0700)]
Rollup merge of #74399 - mark-i-m:ty-err-4, r=eddyb

Move DelaySpanBugEmitted to ty::context

This makes it even hard to abuse.

r? @eddyb

cc @LeSeulArtichaut as this will probably conflict with your PR :/

3 years agoRollup merge of #74346 - eddyb:reachable-defs, r=nikomatsakis
Tyler Mandry [Sun, 16 Aug 2020 21:59:23 +0000 (14:59 -0700)]
Rollup merge of #74346 - eddyb:reachable-defs, r=nikomatsakis

Use LocalDefId instead of HirId for reachable_set elements.

The only `HirId`s being tracked there that don't have matching `DefId`s are local variables, and that's an accident from #44316 (where I preserved the old behavior, even if nothing relied on reachability tracking local variables).

3 years agoRollup merge of #74314 - eddyb:closure-substs-direct, r=nikomatsakis
Tyler Mandry [Sun, 16 Aug 2020 21:59:21 +0000 (14:59 -0700)]
Rollup merge of #74314 - eddyb:closure-substs-direct, r=nikomatsakis

rustc_typeck: construct {Closure,Generator}Substs more directly.

We've previously not had a way to create `{Closure,Generator}Substs` other than instantiating all generics as inference variables and unifying the inference types (extracted using the regular `{Closure,Generator}Substs` accessors), with the actual types.

With this PR, those hacks, and assumptions about the order of closure/generator-specific components, are replaced with a simple API where the base `Substs` are combined with the additional information into a `{Closure,Generator}Substs`.
This might also be faster than relying inference, although probably not by much.

r? @nikomatsakis cc #53488 @blitzerr

3 years agoRollup merge of #74204 - ayazhafiz:i/74120, r=eddyb
Tyler Mandry [Sun, 16 Aug 2020 21:59:20 +0000 (14:59 -0700)]
Rollup merge of #74204 - ayazhafiz:i/74120, r=eddyb

Don't visit foreign function bodies when lowering ast to hir

Previously the existence of bodies inside a foreign function block would
cause a panic in the hir `NodeCollector` during its collection of crate
bodies to compute a crate hash:

https://github.com/rust-lang/rust/blob/e59b08e62ea691916d2f063cac5aab4634128022/src/librustc_middle/hir/map/collector.rs#L154-L158

The collector walks the hir tree and creates a map of hir nodes, then
attaching bodies in the crate to their owner in the map. For a code like

```rust
extern "C" {
    fn f() {
        fn g() {}
    }
}
```

The crate bodies include the body of the function `g`. But foreign
functions cannot have bodies, and while the parser AST permits a foreign
function to have a body, the hir doesn't. This means that the body of
`f` is not present in the hir, and so neither is `g`. So when the
`NodeCollector` finishes the walking the hir, it has no record of `g`,
cannot find an owner for the body of `g` it sees in the crate bodies,
and blows up.

Why do the crate bodies include the body of `g`? The AST walker has a
need a for walking function bodies, and FFIs share the same AST node as
functions in other contexts.

There are at least two options to fix this:

- Don't unwrap the map entry for an hir node in the `NodeCollector`
- Modifier the ast->hir lowering visitor to ignore foreign function
  blocks

I don't think the first is preferrable, since we want to know when we
can't find a body for an hir node that we thought had one (dropping this
information may lead to an invalid hash). So this commit implements the
second option.

Closes #74120

3 years agoFix fortanix build
Mark Rousskov [Sun, 16 Aug 2020 20:34:39 +0000 (16:34 -0400)]
Fix fortanix build

3 years agoImplement 'considered equal' for statements, so that for example `_0 = _1` and `discr...
Simon Vandel Sillesen [Sat, 25 Jul 2020 15:46:11 +0000 (17:46 +0200)]
Implement 'considered equal' for statements, so that for example `_0 = _1` and `discriminant(_0) = discriminant(0)` are considered equal if 0 is a fieldless variant of an enum

3 years agoUse more compatible out-implib style
Mateusz Mikuła [Sun, 16 Aug 2020 19:54:37 +0000 (21:54 +0200)]
Use more compatible out-implib style

3 years agomove DelaySpanBugEmitted to ty::context
mark [Thu, 16 Jul 2020 15:21:10 +0000 (10:21 -0500)]
move DelaySpanBugEmitted to ty::context

3 years agoAuto merge of #73176 - LeSeulArtichaut:tyctxtat-err, r=eddyb
bors [Sun, 16 Aug 2020 18:48:26 +0000 (18:48 +0000)]
Auto merge of #73176 - LeSeulArtichaut:tyctxtat-err, r=eddyb

Add `TyCtxtAt::{ty_error, ty_error_with_message}`

~~Only e2d957d was added, the rest comes from #70551.~~
I was unsure where to put the implementation for those methods, please tell me if there is a better place for it.

Closes #72619, ~~blocked on #70551~~.

r? @eddyb cc @mark-i-m, maybe this should be part of #70551? If so feel free to cherry-pick or ask me to file a PR against your fork.

3 years agorustc_typeck: construct {Closure,Generator}Substs more directly.
Eduard-Mihai Burtescu [Mon, 13 Jul 2020 14:12:07 +0000 (17:12 +0300)]
rustc_typeck: construct {Closure,Generator}Substs more directly.

3 years agoUse LocalDefId instead of HirId for reachable_set elements.
Eduard-Mihai Burtescu [Tue, 14 Jul 2020 23:51:46 +0000 (02:51 +0300)]
Use LocalDefId instead of HirId for reachable_set elements.

3 years agoSwitch to intra-doc links in /sys/windows/ext/{ffi,fs,process}.rs
Prabakaran Kumaresshan [Sun, 16 Aug 2020 16:58:45 +0000 (22:28 +0530)]
Switch to intra-doc links in /sys/windows/ext/{ffi,fs,process}.rs

3 years agoAuto merge of #75472 - Mark-Simulacrum:mangling-config, r=eddyb
bors [Sun, 16 Aug 2020 16:58:13 +0000 (16:58 +0000)]
Auto merge of #75472 - Mark-Simulacrum:mangling-config, r=eddyb

Add option to use the new symbol mangling in rustc/std

I don't know if this causes problems in some cases -- maybe it should be on by default for at least rustc. I've never encountered problems with it other than tools not supporting it, though.

cc @nnethercote
r? @eddyb

3 years agomiri engine: add option to use force_int for alignment check
Ralf Jung [Sun, 16 Aug 2020 15:36:46 +0000 (17:36 +0200)]
miri engine: add option to use force_int for alignment check

3 years agorustdoc: clean `QPath::LangItem`
David Wood [Tue, 4 Aug 2020 13:22:16 +0000 (14:22 +0100)]
rustdoc: clean `QPath::LangItem`

This commit adds support for cleaning `QPath::LangItem` and
`hir::GenericBound::LangItemTrait` in rustdoc. `QPath::LangItem`
does not require lowering, and `hir::GenericBound::LangItemTrait`
is lowered to a `GenericBound::TraitBound`.

Signed-off-by: David Wood <david@davidtw.co>
3 years agoresolve: support `GenericBound::LangItemTrait`
David Wood [Tue, 4 Aug 2020 13:19:28 +0000 (14:19 +0100)]
resolve: support `GenericBound::LangItemTrait`

This commit modifies name resolution to ensure that new scopes are
introduced from lang-item generic bounds.

Co-authored-by: Matthew Jasper <mjjasper1@gmail.com>
Signed-off-by: David Wood <david@davidtw.co>
3 years agohir: simplify `is_range_literal`
David Wood [Tue, 4 Aug 2020 13:18:11 +0000 (14:18 +0100)]
hir: simplify `is_range_literal`

This commit simplifies `is_range_literal` by checking for
`QPath::LangItem` containing range-related lang items, rather than using
a heuristic.

Co-authored-by: Matthew Jasper <mjjasper1@gmail.com>
Signed-off-by: David Wood <david@davidtw.co>
3 years agosave_analysis: support `QPath::LangItem`
David Wood [Tue, 4 Aug 2020 13:36:09 +0000 (14:36 +0100)]
save_analysis: support `QPath::LangItem`

This commit implements support for `QPath::LangItem` and
`GenericBound::LangItemTrait` in save analysis.

Signed-off-by: David Wood <david@davidtw.co>
3 years agohir: introduce `QPath::LangItem`
David Wood [Tue, 4 Aug 2020 13:34:24 +0000 (14:34 +0100)]
hir: introduce `QPath::LangItem`

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

This might be better for performance, but is also much cleaner as the
previous approach is fragile. In addition, it resolves a bug (#61019)
where an extern crate imported as "std" would result in the paths
created during AST lowering being resolved incorrectly (or not at all).

Co-authored-by: Matthew Jasper <mjjasper1@gmail.com>
Signed-off-by: David Wood <david@davidtw.co>
3 years agohir: introduce lang items for AST lowering
David Wood [Tue, 4 Aug 2020 13:04:25 +0000 (14:04 +0100)]
hir: introduce lang items for AST lowering

This commit adds new lang items which will be used in AST lowering once
`QPath::LangItem` is introduced.

Co-authored-by: Matthew Jasper <mjjasper1@gmail.com>
Signed-off-by: David Wood <david@davidtw.co>
3 years agotests: add test for #61019's current behaviour
David Wood [Tue, 4 Aug 2020 09:47:07 +0000 (10:47 +0100)]
tests: add test for #61019's current behaviour

This commit adds a test for #61019 where a extern crate is imported as
`std` which results in name resolution to fail due to the uses of `std`
types introduced from lowering.

Signed-off-by: David Wood <david@davidtw.co>
3 years agolang_items: add support for lang items on variants
David Wood [Tue, 4 Aug 2020 09:27:35 +0000 (10:27 +0100)]
lang_items: add support for lang items on variants

This commit adds support for lang items (`#[lang = "..."]` attributes)
on enum variants.

Signed-off-by: David Wood <david@davidtw.co>
3 years agoAuto merge of #75567 - poliorcetics:intra-links-std-net, r=jyn514
bors [Sun, 16 Aug 2020 13:15:52 +0000 (13:15 +0000)]
Auto merge of #75567 - poliorcetics:intra-links-std-net, r=jyn514

Move to intra doc links in std::net

Helps with #75080.

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

The links for `true` and `false` had to stay else `rustdoc` complained, it is intended ?

3 years agoFix a link, improve method resolution
Alexis Bourget [Sun, 16 Aug 2020 12:41:12 +0000 (14:41 +0200)]
Fix a link, improve method resolution

3 years agoAuto merge of #75536 - estebank:e0255-suggestion, r=varkor
bors [Sun, 16 Aug 2020 11:16:44 +0000 (11:16 +0000)]
Auto merge of #75536 - estebank:e0255-suggestion, r=varkor

Tweak output of E0225

When encountering multiple non-auto trait bounds suggest creating a new
trait and explain what auto-traits are.

_Inspired by https://fasterthanli.me/articles/frustrated-its-not-you-its-rust_

3 years agoAuto merge of #75565 - nixphix:docs/vxworks-ext, r=jyn514
bors [Sun, 16 Aug 2020 08:45:52 +0000 (08:45 +0000)]
Auto merge of #75565 - nixphix:docs/vxworks-ext, r=jyn514

Switch to intra-doc links in std/src/sys/vxworks/ext/{fs,process}.rs

Partial fix for #75080

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

r? @jyn514

3 years agoAuto merge of #75561 - kornelski:stringcol, r=Dylan-DPC
bors [Sun, 16 Aug 2020 06:26:38 +0000 (06:26 +0000)]
Auto merge of #75561 - kornelski:stringcol, r=Dylan-DPC

Doc: String isn't a collection

On forums one user was confused by this text, interpreting it as saying that `String` is a `Vec<char>` literally, rather than figuratively for the purpose of collect. I've reworded that paragraph.

3 years agoAuto merge of #75553 - denisvasilik:intra-doc-links-convert, r=jyn514
bors [Sun, 16 Aug 2020 04:31:05 +0000 (04:31 +0000)]
Auto merge of #75553 - denisvasilik:intra-doc-links-convert, r=jyn514

Move to intra-doc links for /library/core/src/char/convert.rs

Helps with #75080.

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

3 years agoAuto merge of #75541 - camelid:intra-doc-links-for-core-option, r=jyn514
bors [Sun, 16 Aug 2020 02:39:21 +0000 (02:39 +0000)]
Auto merge of #75541 - camelid:intra-doc-links-for-core-option, r=jyn514

Switch to intra-doc links in `core::option`

Part of #75080.

I didn't change some of the links since they link into `std` and you can't link from `core` to `std` (#74481).

Also, at least one other link can't be switched to an intra-doc link because it's not supported yet (#74489).

3 years agoAuto merge of #75575 - marmeladema:only-measure-drop-ast, r=eddyb
bors [Sat, 15 Aug 2020 23:55:56 +0000 (23:55 +0000)]
Auto merge of #75575 - marmeladema:only-measure-drop-ast, r=eddyb

Only measure time spent dropping the AST

r? @eddyb

3 years agoOnly measure time spent dropping the AST
marmeladema [Sat, 15 Aug 2020 23:21:14 +0000 (00:21 +0100)]
Only measure time spent dropping the AST

3 years agoAuto merge of #75514 - gdhuper:gdhuper/replace_log_with_tracing, r=davidtwco
bors [Sat, 15 Aug 2020 22:00:06 +0000 (22:00 +0000)]
Auto merge of #75514 - gdhuper:gdhuper/replace_log_with_tracing, r=davidtwco

Replaced `log` with `tracing`

## Description

Replaced `log` with `tracing` in the following crates:
- [x] librustc_ast
- [x] librustc_driver
- [x]  librustc_errors
- [x] librustc_expand
- [x]  librustc_hir
- [x]  librustc_incremental
- [x]  librustc_infer
- [x]  librustc_interface
- [x]  librustc_lint
- [x]  librustc_metadata
- [x]  librustc_middle
- [x]  librustc_mir
- [x]  librustc_mir_build
- [x]  librustc_parse
- [x]  librustc_passes
- [x]  librustc_privacy
- [x]  librustc_query_system
- [x]  librustc_resolve
- [x]  librustc_save_analysis
- [x] librustc_session
- [x] librustc_span
- [x] librustc_symbol_mangling
- [x] librustc_target
- [x] librustc_trait_selection
- [x] librustc_traits
- [x] librustc_ty
- [x] librustc_typeck
- [x] compiletest

Fixes: #74747
## Checklist:
- [x] Code compiles / builds
- [x] run tidy
- [x] Cleanup any clippy warnings
- [x] Update/add docs

3 years agoBump minor version of emsdk to 1.38.47
Tomasz Miąsko [Sat, 15 Aug 2020 00:00:00 +0000 (00:00 +0000)]
Bump minor version of emsdk to 1.38.47

Release Notes:

```
v1.38.47: 10/02/2019
--------------------
 - Add support for FETCH API in WASM backend. This doesn't support FETCH in the
   main thread (`USE_FETCH_WORKER=0` is enforced). #9490
 - Redefine errno values to be consistent with wasi. This will let us avoid
   needing to convert the values back and forth as we use more wasi APIs.
   This is an ABI change, which should not be noticeable from user code
   unless you use errno defines (like EAGAIN) *and* keep around binaries
   compiled with an older version that you link against. In that case, you
   should rebuild them. See #9545.
 - Removed build option `-s ONLY_MY_CODE` as we now have much better solutions
   for that, like building to a wasm object file or using `STANDALONE_WASM`
   etc. (see
   https://github.com/emscripten-core/emscripten/wiki/WebAssembly-Standalone).
 - Emscripten now supports the config file (.emscripten) being placed in the
   emscripten directory rather that the current user's home directory.
   See #9543
```

3 years agoreplaced log with tracing
Gurpreet Singh [Fri, 14 Aug 2020 06:05:01 +0000 (23:05 -0700)]
replaced log with tracing

3 years agoAuto merge of #75246 - pickfire:patch-5, r=Amanieu
bors [Sat, 15 Aug 2020 19:51:44 +0000 (19:51 +0000)]
Auto merge of #75246 - pickfire:patch-5, r=Amanieu

Add more examples to Path ends_with

We faced a footgun when using ends_with to check extension,
showing an example could prevent that.

https://github.com/rust-dc/fish-manpage-completions/pull/106/commits/2c155e50b2d9e607174908b3f80f1dcf92693eee

3 years agoAuto merge of #75560 - Mark-Simulacrum:rustc-docs, r=matthiaskrgr
bors [Sat, 15 Aug 2020 18:01:06 +0000 (18:01 +0000)]
Auto merge of #75560 - Mark-Simulacrum:rustc-docs, r=matthiaskrgr

Add rustc-docs as a component

Previously it was listed as a package but wasn't available in the component
lists in rustup, so wasn't actually installable.

rustc-docs is also only present for x86_64-unknown-linux-gnu. Eventually it'll
also be shipped for aarch64-gnu with current CI configuration, but that builder
isn't quite up and running yet.

We probably want to ship compiler docs for other platforms as well, though, but
this commit doesn't enable that quite yet. A future PR may do so by adding
--enable-compiler-docs to the relevant builders (but it would also need to
decide the set of builders which we'd ship on).

r? @matthiaskrgr

3 years agoLink to primitive instead of module
Denis Vasilik [Sat, 15 Aug 2020 17:27:34 +0000 (19:27 +0200)]
Link to primitive instead of module

3 years agoMove to intra doc links in std::net
Alexis Bourget [Sat, 15 Aug 2020 17:17:19 +0000 (19:17 +0200)]
Move to intra doc links in std::net

3 years agoDoc: String isn't a collection
Kornel Lesiński [Sat, 15 Aug 2020 11:34:15 +0000 (12:34 +0100)]
Doc: String isn't a collection

3 years agoRemove unnecessary intra-doc link
Camelid [Sat, 15 Aug 2020 16:52:35 +0000 (09:52 -0700)]
Remove unnecessary intra-doc link

Co-authored-by: Joshua Nelson <joshua@yottadb.com>
3 years agoinline linking
Prabakaran Kumaresshan [Sat, 15 Aug 2020 16:41:09 +0000 (22:11 +0530)]
inline linking

3 years agoFix link
Camelid [Sat, 15 Aug 2020 16:31:14 +0000 (09:31 -0700)]
Fix link

Intra-doc links don't work yet in this case: #74489

3 years agoremove empty lines
Prabakaran Kumaresshan [Sat, 15 Aug 2020 16:23:02 +0000 (21:53 +0530)]
remove empty lines

3 years agoAuto merge of #75483 - mati865:mingw-lld-flags, r=petrochenkov
bors [Sat, 15 Aug 2020 15:51:55 +0000 (15:51 +0000)]
Auto merge of #75483 - mati865:mingw-lld-flags, r=petrochenkov

Add LLD flags for MinGW

Tested locally and this now works:
- `RUSTFLAGS="-Zlink-self-contained=yes -Clinker=rust-lld" cargo b`
- `RUSTFLAGS="-Zlink-self-contained=no -Clinker=rust-lld -Zpre-link-arg=-Ld:/msys64/mingw64/x86_64-w64-mingw32/lib -Zpre-link-arg=-Ld:/msys64/mingw64/lib/gcc/x86_64-w64-mingw32/10.2.0 -Zpre-link-arg=crt2.o" cargo b`

This is "harmless" part of the changes to make possible linking with bare LLD with windows-gnu target. More debatable changes should follow in next PRs soon.

3 years agoresolve comments
Prabakaran Kumaresshan [Sat, 15 Aug 2020 15:23:41 +0000 (20:53 +0530)]
resolve comments

3 years agoSwitch to intra-doc links in std/src/sys/vxworks/ext/{fs,process}.rs
Prabakaran Kumaresshan [Sat, 15 Aug 2020 13:19:52 +0000 (18:49 +0530)]
Switch to intra-doc links in std/src/sys/vxworks/ext/{fs,process}.rs

3 years agoAuto merge of #75537 - tmiasko:match-branch-simplify, r=oli-obk
bors [Sat, 15 Aug 2020 13:41:05 +0000 (13:41 +0000)]
Auto merge of #75537 - tmiasko:match-branch-simplify, r=oli-obk

MatchBranchSimplification: fix equal const bool assignments

The match branch simplification is applied when target blocks contain
statements that are either equal or perform a const bool assignment with
different values to the same place.

Previously, when constructing new statements, only statements from a
single block had been examined. This lead to a misoptimization when
statements are equal because the assign the *same* const bool value to
the same place.

Fix the issue by examining statements from both blocks when deciding on
replacement.

Additionally:

* Copy discriminant instead of moving it since it might be necessary to use its
  value more than once.
* Optimize when switching on copy operand

Based on #75508.

r? @oli-obk  / @JulianKnodt

3 years agoAuto merge of #74576 - myfreeweb:freebsd-sanitizers, r=oli-obk
bors [Sat, 15 Aug 2020 11:38:24 +0000 (11:38 +0000)]
Auto merge of #74576 - myfreeweb:freebsd-sanitizers, r=oli-obk

Add sanitizer support on FreeBSD

Restarting #47337. Everything is better now, no more weird llvm problems, well not everything:

Unfortunately, the sanitizers don't have proper support for versioned symbols (https://github.com/google/sanitizers/issues/628), so `libc`'s usage of `stat@FBSD_1.0` and so on explodes, e.g. in calling `std::fs::metadata`.

Building std (now easy thanks to cargo `-Zbuild-std`) and libc with `freebsd12/13` config via the `LIBC_CI=1` env variable is a good workaround…

```
LIBC_CI=1 RUSTFLAGS="-Z sanitizer=address" cargo +san-test -Zbuild-std run --target x86_64-unknown-freebsd --verbose
```

…*except* std won't build because there's no `st_lspare` in the ino64 version of the struct, so an std patch is required:

```diff
--- i/src/libstd/os/freebsd/fs.rs
+++ w/src/libstd/os/freebsd/fs.rs
@@ -66,8 +66,6 @@ pub trait MetadataExt {
     fn st_flags(&self) -> u32;
     #[stable(feature = "metadata_ext2", since = "1.8.0")]
     fn st_gen(&self) -> u32;
-    #[stable(feature = "metadata_ext2", since = "1.8.0")]
-    fn st_lspare(&self) -> u32;
 }

 #[stable(feature = "metadata_ext", since = "1.1.0")]
@@ -136,7 +134,4 @@ impl MetadataExt for Metadata {
     fn st_flags(&self) -> u32 {
         self.as_inner().as_inner().st_flags as u32
     }
-    fn st_lspare(&self) -> u32 {
-        self.as_inner().as_inner().st_lspare as u32
-    }
 }
```

I guess std could like.. detect that `libc` isn't built for the old ABI, and replace the implementation of `st_lspare` with a panic?

3 years agoAdd rustc-docs as a component
Mark Rousskov [Sat, 15 Aug 2020 11:06:18 +0000 (07:06 -0400)]
Add rustc-docs as a component

Previously it was listed as a package but wasn't available in the component
lists in rustup, so wasn't actually installable.

rustc-docs is also only present for x86_64-unknown-linux-gnu. Eventually it'll
also be shipped for aarch64-gnu with current CI configuration, but that builder
isn't quite up and running yet.

We probably want to ship compiler docs for other platforms as well, though, but
this commit doesn't enable that quite yet. A future PR may do so by adding
--enable-compiler-docs to the relevant builders (but it would also need to
decide the set of builders which we'd ship on).

3 years agoAuto merge of #75518 - davidtwco:issue-75326-polymorphization-symbol-mangling-v0...
bors [Sat, 15 Aug 2020 09:46:22 +0000 (09:46 +0000)]
Auto merge of #75518 - davidtwco:issue-75326-polymorphization-symbol-mangling-v0-predicates, r=lcnr

polymorphize: `I` used if `T` used in `I: Foo<T>`

Fixes #75326.

This PR adjusts polymorphization's handling of predicates so that after ensuring that `T` is used in `I: Foo<T>` if `I` is used, it now ensures that `I` is used if `T` is used in `I: Foo<T>`. This is necessary to mark generic parameters that only exist in impl parameters as used - thereby avoiding symbol clashes when using the new mangling scheme.

With this PR, rustc will now fully bootstrap with polymorphization and the new symbol mangling scheme enabled - not all tests pass, but I'm not sure how much of that is the interaction of the two features, I'll be looking into that soon. All tests pass with only polymorphization enabled.

r? @lcnr (this isn't sufficiently complex that I need to add to eddy's review queue)
cc @eddyb

3 years agoUse resolve.conf as example for Path ends_with
Ivan Tham [Sat, 15 Aug 2020 09:25:07 +0000 (17:25 +0800)]
Use resolve.conf as example for Path ends_with

3 years agoAuto merge of #75539 - ehuss:fix-crate-version-rustdoc-bootstrap, r=Mark-Simulacrum
bors [Sat, 15 Aug 2020 07:55:58 +0000 (07:55 +0000)]
Auto merge of #75539 - ehuss:fix-crate-version-rustdoc-bootstrap, r=Mark-Simulacrum

Fix crate-version with rustdoc in bootstrap.

Cargo will now automatically use the `--crate-version` flag (see https://github.com/rust-lang/cargo/pull/8509). Cargo has special handling to avoid passing the flag if it is passed in via RUSTDOCFLAGS, but the `rustdoc` wrapper circumvents that check. This causes a problem because rustdoc will fail if the flag is passed in twice. Fix this by using RUSTDOCFLAGS.

This will be necessary when 1.47 is promoted to beta, but should be safe to do now.