]> git.lizzy.rs Git - rust.git/log
rust.git
3 years agoRollup merge of #74555 - GuillaumeGomez:important-traits-popup, r=Manishearth
Manish Goregaokar [Mon, 20 Jul 2020 19:30:31 +0000 (12:30 -0700)]
Rollup merge of #74555 - GuillaumeGomez:important-traits-popup, r=Manishearth

Improve "important traits" popup display on mobile

I implemented what @XAMPPRocky suggested in the [internals thread topic](https://internals.rust-lang.org/t/feedback-on-important-traits-rustdoc-feature/12752/18). I can confirm it works nicely.

r? @Manishearth

@Manishearth: By the way: I realized that when you click on the "i", you have to click again to make the popup disappear. Do you want me to extend the popup removal to any click outside the popup?

3 years agoRollup merge of #74552 - fusion-engineering-forks:stabilize-tau, r=dtolnay
Manish Goregaokar [Mon, 20 Jul 2020 19:30:29 +0000 (12:30 -0700)]
Rollup merge of #74552 - fusion-engineering-forks:stabilize-tau, r=dtolnay

Stabilize TAU constant.

Closes #66770.

3 years agoRollup merge of #74546 - jethrogb:jb/duplicate-attribute-maybe_uninit_extra, r=kennytm
Manish Goregaokar [Mon, 20 Jul 2020 19:30:27 +0000 (12:30 -0700)]
Rollup merge of #74546 - jethrogb:jb/duplicate-attribute-maybe_uninit_extra, r=kennytm

Fix duplicate maybe_uninit_extra attribute

Introduced in #72414

3 years agoRollup merge of #74522 - tmiasko:sanitizer-docs, r=nikomatsakis
Manish Goregaokar [Mon, 20 Jul 2020 19:30:25 +0000 (12:30 -0700)]
Rollup merge of #74522 - tmiasko:sanitizer-docs, r=nikomatsakis

Update sanitizer docs

* Document AddressSanitizer memory leak detection defaults.
* Remove CC & CFLAGS from MemorySanitizer example - they are now unnecessary for pure Rust projects (backtrace-rs moved away from libbacktrace).

3 years agoRollup merge of #74505 - Cldfire:fix-search-focus, r=GuillaumeGomez
Manish Goregaokar [Mon, 20 Jul 2020 19:30:24 +0000 (12:30 -0700)]
Rollup merge of #74505 - Cldfire:fix-search-focus, r=GuillaumeGomez

Fix search input focus in ayu theme

Closes #74496.

Before:

![image](https://user-images.githubusercontent.com/13814214/87868463-d0c8fe80-c963-11ea-9003-aa578d869e98.png)

After:

![image](https://user-images.githubusercontent.com/13814214/87868467-dc1c2a00-c963-11ea-89a8-1280f68ff9df.png)

3 years agoRollup merge of #74501 - lzutao:css_run_border, r=GuillaumeGomez
Manish Goregaokar [Mon, 20 Jul 2020 19:30:22 +0000 (12:30 -0700)]
Rollup merge of #74501 - lzutao:css_run_border, r=GuillaumeGomez

Ayu theme: Use different background color for Run button

Make it clearer that there is a button Run there.

Demo in https://github.com/rust-lang/rust/pull/74501#issuecomment-660597377 .

3 years agoRollup merge of #74376 - lcnr:type-dependent-path-cleanup, r=eddyb
Manish Goregaokar [Mon, 20 Jul 2020 19:30:20 +0000 (12:30 -0700)]
Rollup merge of #74376 - lcnr:type-dependent-path-cleanup, r=eddyb

test caching opt_const_param_of on disc

Followup to #74113, implements parts of #74360

Tried caching `opt_const_param_of` on disk and adding an early exit if `tcx.dep_kind(def_id) != DefKind::AnonConst`.

Ended up causing a perf regression instead, so we just remove the FIXME and a short note to `opt_const_param_of`.

r? @eddyb

3 years agoRollup merge of #74051 - yodaldevoid:issue_60814, r=nikomatsakis
Manish Goregaokar [Mon, 20 Jul 2020 19:30:18 +0000 (12:30 -0700)]
Rollup merge of #74051 - yodaldevoid:issue_60814, r=nikomatsakis

disallow non-static lifetimes in const generics

Disallow non-static lifetimes in const generics in order to to patch over an ICE caused when we encounter a non-static lifetime in a const generic during borrow checking. This restriction may be relaxed in the future, but we need more discussion before then, and in the meantime we should still deal with this ICE.

Fixes issue #60814

3 years agoRollup merge of #73323 - davidtwco:issue-73252-wfcheck-foreign-fn-decl, r=ecstatic...
Manish Goregaokar [Mon, 20 Jul 2020 19:30:16 +0000 (12:30 -0700)]
Rollup merge of #73323 - davidtwco:issue-73252-wfcheck-foreign-fn-decl, r=ecstatic-morse

wf: check foreign fn decls for well-formedness

Fixes #73252 and fixes #73253.

This PR extends current well-formedness checking to apply to foreign function declarations, re-using the existing machinery for regular functions. In doing this, later parts of the compiler (such as the `improper_ctypes` lint) can rely on being operations not failing as a result of invalid code which would normally be caught earlier.

3 years agoRollup merge of #73197 - c410-f3r:ranges, r=dtolnay
Manish Goregaokar [Mon, 20 Jul 2020 19:30:14 +0000 (12:30 -0700)]
Rollup merge of #73197 - c410-f3r:ranges, r=dtolnay

Impl Default for ranges

Couldn't find an issue about it.

`Range` and friends probably can implement `Default` if `Idx: Default`. For example, the following would be possible:

```rust
#[derive(Default)]
struct Foo(core::ops::RangeToInclusive<u64>);

let _ = [1, 2, 3].get(core::ops::Range::default());

core::ops::RangeFrom::<u8>::default().take(20).for_each(|x| { dbg!(x); });

fn stuff<T: Default>() { let instance = T::default(); ... more stuff }
stuff::<core::ops::RangeTo<f32>>();
```

Maybe there are some concerns about safety or misunderstandings?

3 years agoRollup merge of #72714 - JohnTitor:debug-assert, r=nikomatsakis
Manish Goregaokar [Mon, 20 Jul 2020 19:30:12 +0000 (12:30 -0700)]
Rollup merge of #72714 - JohnTitor:debug-assert, r=nikomatsakis

Fix debug assertion in typeck

Fixes #72410

3 years agoAuto merge of #74550 - matklad:rust-analyzer-2020-07-20, r=matklad
bors [Mon, 20 Jul 2020 13:42:20 +0000 (13:42 +0000)]
Auto merge of #74550 - matklad:rust-analyzer-2020-07-20, r=matklad

:arrow_up: rust-analyzer

r? @ghost

3 years agoImprove "important traits" popup display on mobile
Guillaume Gomez [Mon, 20 Jul 2020 12:37:47 +0000 (14:37 +0200)]
Improve "important traits" popup display on mobile

3 years agoStabilize TAU constant.
Mara Bos [Fri, 10 Jul 2020 10:08:32 +0000 (12:08 +0200)]
Stabilize TAU constant.

Closes #66770.

3 years ago:arrow_up: rust-analyzer
Aleksey Kladov [Mon, 20 Jul 2020 11:21:16 +0000 (13:21 +0200)]
:arrow_up: rust-analyzer

3 years agoFix duplicate maybe_uninit_extra attribute
Jethro Beekman [Mon, 20 Jul 2020 10:23:47 +0000 (12:23 +0200)]
Fix duplicate maybe_uninit_extra attribute

3 years agoAuto merge of #74010 - pierwill:pierwill-o-notation, r=GuillaumeGomez
bors [Mon, 20 Jul 2020 10:19:58 +0000 (10:19 +0000)]
Auto merge of #74010 - pierwill:pierwill-o-notation, r=GuillaumeGomez

Use italics for O notation

In documentation, I think it makes sense to italicize O notation (*O(n)*) as opposed to using back-ticks (`O(n)`). Visually, back-ticks focus the reader on the literal characters being used, making them ideal for representing code. Using italics, as far I can tell, more closely follows typographic conventions in mathematics and computer science.

Just a suggestion, of course! ðŸ˜‡

3 years agowf: check foreign fn decls for well-formedness
David Wood [Sat, 13 Jun 2020 18:37:25 +0000 (19:37 +0100)]
wf: check foreign fn decls for well-formedness

This commit extends current well-formedness checking to apply to foreign
function declarations, re-using the existing machinery for regular
functions. In doing this, later parts of the compiler (such as the
`improper_ctypes` lint) can rely on being operations not failing as a
result of invalid code which would normally be caught earlier.

Signed-off-by: David Wood <david@davidtw.co>
3 years agoAuto merge of #74540 - alexcrichton:std-no-backtrace, r=Mark-Simulacrum
bors [Mon, 20 Jul 2020 06:09:42 +0000 (06:09 +0000)]
Auto merge of #74540 - alexcrichton:std-no-backtrace, r=Mark-Simulacrum

std: Fix compilation without backtrace feature

This should hopefully handle #74484 but in any case fixes compilation of
the standard library without the `backtrace` feature. The need for this
feature is somewhat unclear now because the `backtrace` crate should
always compile (no more C code!) but we can handle that later if
necessary.

3 years agoUse italics for O notation
pierwill [Fri, 3 Jul 2020 19:13:01 +0000 (12:13 -0700)]
Use italics for O notation

Co-authored-by: Guillaume Gomez <guillaume1.gomez@gmail.com>
3 years agoAuto merge of #74543 - Manishearth:rollup-m5w6hyg, r=Manishearth
bors [Mon, 20 Jul 2020 02:43:31 +0000 (02:43 +0000)]
Auto merge of #74543 - Manishearth:rollup-m5w6hyg, r=Manishearth

Rollup of 9 pull requests

Successful merges:

 - #73618 (Documentation for the false keyword)
 - #74486 (Improve Read::read_exact documentation)
 - #74514 (Do not clobber RUSTDOCFLAGS)
 - #74516 (do not try fetching the ancestors of errored trait impls)
 - #74520 (include backtrace folder in rust-src component)
 - #74523 (Improve documentation for `core::fmt` internals)
 - #74527 (Add myself to toolstate change notifications for rustfmt)
 - #74534 (Only skip impls of foreign unstable traits)
 - #74536 (fix documentation surrounding the `in` and `for` keywords)

Failed merges:

r? @ghost

3 years agoRollup merge of #74536 - Nicholas-Baron:master, r=joshtriplett
Manish Goregaokar [Mon, 20 Jul 2020 02:12:45 +0000 (19:12 -0700)]
Rollup merge of #74536 - Nicholas-Baron:master, r=joshtriplett

fix documentation surrounding the `in` and `for` keywords

Addresses #74529

The `in` keyword incorrectly referenced the `Iterator` trait. This reference was changed to `IntoIterator` without changing the underlying link.

Additionally, the `IntoIterator` trait was referenced towards the end of the documentation for `for`. An additional reference was added earlier and broadened the existing documentation from any iterator to anything that can be turned into an iterator.

3 years agoRollup merge of #74534 - Mark-Simulacrum:rustdoc-stability, r=Manishearth
Manish Goregaokar [Mon, 20 Jul 2020 02:12:43 +0000 (19:12 -0700)]
Rollup merge of #74534 - Mark-Simulacrum:rustdoc-stability, r=Manishearth

Only skip impls of foreign unstable traits

Previously unstable impls were skipped, which meant that any impl with an unstable method would get skipped.

Fixes #74531.

3 years agoRollup merge of #74527 - calebcartwright:rustfmt-toolstate-maintainers, r=Mark-Simulacrum
Manish Goregaokar [Mon, 20 Jul 2020 02:12:42 +0000 (19:12 -0700)]
Rollup merge of #74527 - calebcartwright:rustfmt-toolstate-maintainers, r=Mark-Simulacrum

Add myself to toolstate change notifications for rustfmt

I'd like to get the toolstate change notifications for rustfmt as well so that I'll know when things break.

Have spoken with @topecongiro about this offline already.

3 years agoRollup merge of #74523 - sollyucko:patch-1, r=Mark-Simulacrum
Manish Goregaokar [Mon, 20 Jul 2020 02:12:40 +0000 (19:12 -0700)]
Rollup merge of #74523 - sollyucko:patch-1, r=Mark-Simulacrum

Improve documentation for `core::fmt` internals

The public interface of `core::fmt` is well-documented, but the internals have very minimal documentation.

3 years agoRollup merge of #74520 - RalfJung:backtrace-src, r=Mark-Simulacrum
Manish Goregaokar [Mon, 20 Jul 2020 02:12:38 +0000 (19:12 -0700)]
Rollup merge of #74520 - RalfJung:backtrace-src, r=Mark-Simulacrum

include backtrace folder in rust-src component

libstd has a [mandatory dependency on this code](https://github.com/rust-lang/rust/pull/73441/files#diff-242481015141f373dcb178e93cffa850), ergo we need to include it in rust-src.

r? @oli-obk
Fixes https://github.com/rust-lang/rust/issues/74506

3 years agoRollup merge of #74516 - lcnr:min-specialization-ice, r=matthewjasper
Manish Goregaokar [Mon, 20 Jul 2020 02:12:37 +0000 (19:12 -0700)]
Rollup merge of #74516 - lcnr:min-specialization-ice, r=matthewjasper

do not try fetching the ancestors of errored trait impls

fixes #74483

While building the specialization graph, we use `tcx.all_impls` which discards impls with incorrect self types,
we do however call `trait_def.ancestors` with these impls which caused an ICE as they aren't part of the
specialization graph.

3 years agoRollup merge of #74514 - Mark-Simulacrum:nightly-rustc-docs, r=ollie27
Manish Goregaokar [Mon, 20 Jul 2020 02:12:35 +0000 (19:12 -0700)]
Rollup merge of #74514 - Mark-Simulacrum:nightly-rustc-docs, r=ollie27

Do not clobber RUSTDOCFLAGS

We were setting these in both Builder::cargo and here, which ended up only setting the first of the two.

Fixes #74511

3 years agoRollup merge of #74486 - poliorcetics:read-exact-doc-point-to-read, r=Mark-Simulacrum
Manish Goregaokar [Mon, 20 Jul 2020 02:12:33 +0000 (19:12 -0700)]
Rollup merge of #74486 - poliorcetics:read-exact-doc-point-to-read, r=Mark-Simulacrum

Improve Read::read_exact documentation

Fixes #72186.

For now I simply added a link to `Read::read` and held off changing the text in `Read::read_exact`. I can do it if it is deemed necessary.

@rustbot modify labels: C-enhancement, T-libs

3 years agoRollup merge of #73618 - poliorcetics:false-keyword, r=jyn514
Manish Goregaokar [Mon, 20 Jul 2020 02:12:32 +0000 (19:12 -0700)]
Rollup merge of #73618 - poliorcetics:false-keyword, r=jyn514

Documentation for the false keyword

Partial fix of #34601.

Short documentation for the false keyword mainly pointing to the `true` keyword.

3 years agostd: Fix compilation without backtrace feature
Alex Crichton [Mon, 20 Jul 2020 00:30:29 +0000 (17:30 -0700)]
std: Fix compilation without backtrace feature

This should hopefully handle #74484 but in any case fixes compilation of
the standard library without the `backtrace` feature. The need for this
feature is somewhat unclear now because the `backtrace` crate should
always compile (no more C code!) but we can handle that later if
necessary.

3 years agoUpdate src/libstd/keyword_docs.rs
Nicholas Baron [Mon, 20 Jul 2020 00:01:36 +0000 (17:01 -0700)]
Update src/libstd/keyword_docs.rs

Clear up wording regarding the iterator and usage of `break`.

Co-authored-by: Josh Triplett <josh@joshtriplett.org>
3 years agoAuto merge of #74495 - shepmaster:bootstrap-dist-target-files, r=Mark-Simulacrum
bors [Sun, 19 Jul 2020 22:50:46 +0000 (22:50 +0000)]
Auto merge of #74495 - shepmaster:bootstrap-dist-target-files, r=Mark-Simulacrum

Teach bootstrap install and dist commands about TargetSelection

With this, we can now use a target JSON file to build a
cross-compiler:

```
x.py install --host ../aarch64-apple-darwin.json --target aarch64-apple-darwin
```

r? @Mark-Simulacrum

3 years agoLinked the earlier mention of IntoIterator in the keyword 'for' docs
Nicholas-Baron [Sun, 19 Jul 2020 21:06:55 +0000 (14:06 -0700)]
Linked the earlier mention of IntoIterator in the keyword 'for' docs

3 years agoMentioned IntoIterator in keyword 'in' docs
Nicholas-Baron [Sun, 19 Jul 2020 21:05:45 +0000 (14:05 -0700)]
Mentioned IntoIterator in keyword 'in' docs

3 years agoMentioned IntoIterator earlier in keyword 'for' docs
Nicholas-Baron [Sun, 19 Jul 2020 21:03:52 +0000 (14:03 -0700)]
Mentioned IntoIterator earlier in keyword 'for' docs

3 years agoOnly skip impls of foreign unstable traits
Mark Rousskov [Sun, 19 Jul 2020 20:39:20 +0000 (16:39 -0400)]
Only skip impls of foreign unstable traits

Previously unstable impls were skipped, which meant that any impl with an
unstable method would get skipped.

3 years agoFix merge conflict with recent PR
Alexis Bourget [Sun, 19 Jul 2020 20:15:44 +0000 (22:15 +0200)]
Fix merge conflict with recent PR

3 years agotools: update rustfmt toolstate maintainers
Caleb Cartwright [Sun, 19 Jul 2020 18:10:38 +0000 (13:10 -0500)]
tools: update rustfmt toolstate maintainers

3 years agoTeach bootstrap install and dist commands about TargetSelection
Jake Goulding [Sat, 18 Jul 2020 18:06:20 +0000 (14:06 -0400)]
Teach bootstrap install and dist commands about TargetSelection

With this, we can now use a target JSON file to build a
cross-compiler:

```
x.py install --host ../aarch64-apple-darwin.json --target aarch64-apple-darwin
```

3 years agoAdd test for an explicit non-'static lifetime in a const argument
Gabriel Smith [Sun, 19 Jul 2020 16:53:51 +0000 (12:53 -0400)]
Add test for an explicit non-'static lifetime in a const argument

3 years agodisallow non-static lifetimes in const generics
Gabriel Smith [Sun, 5 Jul 2020 03:43:48 +0000 (23:43 -0400)]
disallow non-static lifetimes in const generics

This has been put in place to patch over an ICE caused when we encounter
a non-static lifetime in a const generic during borrow checking. This
restriction may be relaxed in the future, but we need more discussion
before then, and in the meantime we should still deal with this ICE.

Fixes issue #60814

3 years agoDocument `core::fmt::rt::v1::Count`
Solomon Ucko [Sun, 19 Jul 2020 15:10:03 +0000 (11:10 -0400)]
Document `core::fmt::rt::v1::Count`

3 years agoDocument AddressSanitizer memory leak detection defaults
Tomasz MiÄ…sko [Sat, 18 Jul 2020 00:00:00 +0000 (00:00 +0000)]
Document AddressSanitizer memory leak detection defaults

3 years agoRemove CC & CFLAGS from MemorySanitizer example
Tomasz MiÄ…sko [Sat, 18 Jul 2020 00:00:00 +0000 (00:00 +0000)]
Remove CC & CFLAGS from MemorySanitizer example

They are now unnecessary for projects written in Rust, since
backtrace-rs used by the standard library has only Rust dependencies.

3 years agoinclude backtrace folder in rust-src component
Ralf Jung [Sun, 19 Jul 2020 14:53:53 +0000 (16:53 +0200)]
include backtrace folder in rust-src component

3 years agoDo not clobber RUSTDOCFLAGS
Mark Rousskov [Sun, 19 Jul 2020 13:18:32 +0000 (09:18 -0400)]
Do not clobber RUSTDOCFLAGS

We were setting these in both Builder::cargo and here, which ended up only
setting the first of the two.

3 years agoApply suggestions from review
Poliorcetics [Sun, 19 Jul 2020 14:28:18 +0000 (16:28 +0200)]
Apply suggestions from review

Co-authored-by: Joshua Nelson <joshua@yottadb.com>
3 years agoAuto merge of #74518 - Manishearth:rollup-jfmnh1r, r=Manishearth
bors [Sun, 19 Jul 2020 14:17:08 +0000 (14:17 +0000)]
Auto merge of #74518 - Manishearth:rollup-jfmnh1r, r=Manishearth

Rollup of 4 pull requests

Successful merges:

 - #74333 (Deny unsafe operations in unsafe functions in libstd/alloc.rs)
 - #74356 (Remove combine function)
 - #74419 (Add a thumbv4t-none-eabi target)
 - #74485 (More intra-doc links, add explicit exception list to linkchecker)

Failed merges:

 - #74486 (Improve Read::read_exact documentation)

r? @ghost

3 years agoRollup merge of #74485 - Manishearth:more-intra-doc, r=jyn514
Manish Goregaokar [Sun, 19 Jul 2020 14:02:27 +0000 (07:02 -0700)]
Rollup merge of #74485 - Manishearth:more-intra-doc, r=jyn514

More intra-doc links, add explicit exception list to linkchecker

Fixes the broken links behind #32553

Progress on #32130 and #32129 except for a small number of links. Instead of whitelisting entire files, I've changed the code to whitelist specific links in specific files, and added a comment requesting people explain the reasons they add exceptions. I'm not sure if we should close those issues in favor of the already filed intra-doc link issues.

3 years agoRollup merge of #74419 - Lokathor:gba-target, r=jonas-schievink
Manish Goregaokar [Sun, 19 Jul 2020 14:02:26 +0000 (07:02 -0700)]
Rollup merge of #74419 - Lokathor:gba-target, r=jonas-schievink

Add a thumbv4t-none-eabi target

(cc @ketsuban, one of the few other Rust users who programs for GBA.)

---

**EDIT:** This is now a more general `thumbv4t-none-eabi` PR! See [this comment](https://github.com/rust-lang/rust/pull/74419#issuecomment-660391579)

---

Now that the PSP officially has an official target within Rust, well as the lead of the `gba` crate I can't _not_ add a GBA target as well.

I know that the [target tier policy](https://github.com/rust-lang/rfcs/pull/2803) isn't ratified and official, but I'll use it as an outline (cc @joshtriplett):
* Designated Developer: Lokathor
* Naming consistent with any existing targets
* Doesn't create Rust project legal issues.
* No license issues
* Uses the standard Apache/mit license.
* Rust tooling users don't have to accept any new licensing requirements
* Does not support hosting rust tooling.
* Doesn't require linking in proprietary code to obtain a functional binary. However, you will need to do some post-build steps to turn the ELF file into a usable GBA ROM (either for an emulator or for the actual hardware).
* This is a `no_std` environment, without even a standard global allocator, so this adds no new code to `alloc` or `std`.
* The process of building for this target is documented in the `gba` crate ([link](https://rust-console.github.io/gba/development-setup.html)). Well, the docs there are currently a little out of date, they're back on using `cargo-xbuild`, but the crate docs there will get updated once this target is available.
* This places no new burden on any other targets
* Does not break any existing targets.

I'm not fully confident in specifying the same linker script for all possible projects, so I'm currently just not giving a linker script at all, and users can continue to select their own linker script by using `-C` to provide a linker arg.

I added the file, and added it to the `supported_targets!` macro usage, and I think that's all there is to do.

3 years agoRollup merge of #74356 - lzutao:rm_combine, r=LukasKalbertodt
Manish Goregaokar [Sun, 19 Jul 2020 14:02:24 +0000 (07:02 -0700)]
Rollup merge of #74356 - lzutao:rm_combine, r=LukasKalbertodt

Remove combine function

Comparing two array directly helps generate better assert message.
Resolve https://github.com/rust-lang/rust/pull/74271/files#r454538514

3 years agoRollup merge of #74333 - poliorcetics:std-alloc-unsafe-op-in-unsafe-fn, r=LukasKalbertodt
Manish Goregaokar [Sun, 19 Jul 2020 14:02:22 +0000 (07:02 -0700)]
Rollup merge of #74333 - poliorcetics:std-alloc-unsafe-op-in-unsafe-fn, r=LukasKalbertodt

Deny unsafe operations in unsafe functions in libstd/alloc.rs

Partial fix of #73904.

This encloses `unsafe` operations in `unsafe fn` in `libstd/alloc.rs`.

@rustbot modify labels: F-unsafe-block-in-unsafe-fn

3 years agoRemove useless link to bool primitive
Alexis Bourget [Sun, 19 Jul 2020 13:58:41 +0000 (15:58 +0200)]
Remove useless link to bool primitive

3 years agodo not try fetching the ancestors of errored trait impls
Bastian Kauschke [Sun, 19 Jul 2020 13:45:44 +0000 (15:45 +0200)]
do not try fetching the ancestors of errored trait impls

3 years agoFix small nit in the link to read
Alexis Bourget [Sun, 19 Jul 2020 13:30:32 +0000 (15:30 +0200)]
Fix small nit in the link to read

3 years agoAuto merge of #74163 - cuviper:debian6, r=Mark-Simulacrum
bors [Sun, 19 Jul 2020 10:46:34 +0000 (10:46 +0000)]
Auto merge of #74163 - cuviper:debian6, r=Mark-Simulacrum

ci: Update dist-{i686,x86_64}-linux to Debian 6

This increases the minimum `{i686,x86_64}-unknown-linux-gnu` platform
from RHEL/CentOS 5 (glibc 2.5 and kernel 2.6.18) to a slightly newer
Debian 6 `squeeze` (glibc 2.11 and kernel 2.6.32). While that release is
already EOL, it happens to match the minimum common versions of two
enterprise distros that do still need Rust support -- RHEL 6 (glibc 2.12
and kernel 2.6.32) and SLES 11 SP4 (glibc 2.11 and kernel 3.0).

Closes #62516.

3 years agoAyu: use different background color to make Run button easy-to-spot
Lzu Tao [Sun, 19 Jul 2020 09:09:06 +0000 (09:09 +0000)]
Ayu: use different background color to make Run button easy-to-spot

Co-authored-by: Cldfire <cldfire@3grid.net>
3 years agoAuto merge of #74091 - richkadel:llvm-coverage-map-gen-4, r=tmandry
bors [Sun, 19 Jul 2020 07:25:18 +0000 (07:25 +0000)]
Auto merge of #74091 - richkadel:llvm-coverage-map-gen-4, r=tmandry

Generating the coverage map

@tmandry @wesleywiser

rustc now generates the coverage map and can support (limited)
coverage report generation, at the function level.

Example commands to generate a coverage report:
```shell
$ BUILD=$HOME/rust/build/x86_64-unknown-linux-gnu
$ $BUILD/stage1/bin/rustc -Zinstrument-coverage \
$HOME/rust/src/test/run-make-fulldeps/instrument-coverage/main.rs
$ LLVM_PROFILE_FILE="main.profraw" ./main
called
$ $BUILD/llvm/bin/llvm-profdata merge -sparse main.profraw -o main.profdata
$ $BUILD/llvm/bin/llvm-cov show --instr-profile=main.profdata main
```
![rust coverage report only 20200706](https://user-images.githubusercontent.com/3827298/86697299-1cbe8f80-bfc3-11ea-8955-451b48626991.png)

r? @wesleywiser

Rust compiler MCP rust-lang/compiler-team#278
Relevant issue: #34701 - Implement support for LLVMs code coverage instrumentation

3 years agoFix search input focus in ayu theme
Jarek Samic [Sun, 19 Jul 2020 06:00:10 +0000 (02:00 -0400)]
Fix search input focus in ayu theme

3 years agoprimitive impls are weird
Manish Goregaokar [Sun, 19 Jul 2020 05:33:00 +0000 (22:33 -0700)]
primitive impls are weird

3 years agoClarify the literal string
Manish Goregaokar [Sun, 19 Jul 2020 05:32:42 +0000 (22:32 -0700)]
Clarify the literal string

3 years agoUpdate src/libstd/io/mod.rs
Manish Goregaokar [Sun, 19 Jul 2020 05:31:35 +0000 (22:31 -0700)]
Update src/libstd/io/mod.rs

Co-authored-by: Joshua Nelson <joshua@yottadb.com>
3 years agoUpdate src/tools/linkchecker/main.rs
Manish Goregaokar [Sun, 19 Jul 2020 05:30:25 +0000 (22:30 -0700)]
Update src/tools/linkchecker/main.rs

Co-authored-by: Joshua Nelson <joshua@yottadb.com>
3 years agoremove unused imports
Lokathor [Sun, 19 Jul 2020 05:01:01 +0000 (23:01 -0600)]
remove unused imports

3 years agoAdd an border around the Run button
Lzu Tao [Sun, 19 Jul 2020 04:31:01 +0000 (04:31 +0000)]
Add an border around the Run button

3 years agoAuto merge of #74493 - Manishearth:rollup-ust7yr4, r=Manishearth
bors [Sun, 19 Jul 2020 04:03:54 +0000 (04:03 +0000)]
Auto merge of #74493 - Manishearth:rollup-ust7yr4, r=Manishearth

Rollup of 7 pull requests

Successful merges:

 - #70817 (Add core::task::ready! macro)
 - #73762 (Document the trait keyword)
 - #74021 (impl Index<RangeFrom> for CStr)
 - #74071 (rustc_metadata: Make crate loading fully speculative)
 - #74445 (add test for #62878)
 - #74459 (Make unreachable_unchecked a const fn)
 - #74478 (Revert "Use an UTF-8 locale for the linker.")

Failed merges:

r? @ghost

3 years agoResolve https://github.com/rust-lang/rust/pull/74419#issuecomment-660518936
Lokathor [Sun, 19 Jul 2020 03:57:37 +0000 (21:57 -0600)]
Resolve https://github.com/rust-lang/rust/pull/74419#issuecomment-660518936

3 years agoRollup merge of #74478 - rust-lang:revert-74416-linker-locale-utf8, r=Mark-Simulacrum
Manish Goregaokar [Sat, 18 Jul 2020 23:51:01 +0000 (16:51 -0700)]
Rollup merge of #74478 - rust-lang:revert-74416-linker-locale-utf8, r=Mark-Simulacrum

Revert "Use an UTF-8 locale for the linker."

Reverts rust-lang/rust#74416

This is suspected to have caused significant compile time regressions: https://perf.rust-lang.org/compare.html?start=39d5a61f2e4e237123837f5162cc275c2fd7e625&end=d3df8512d2c2afc6d2e7d8b5b951dd7f2ad77b02&stat=instructions:u

3 years agoRollup merge of #74459 - canova:const-unreachable-unchecked, r=oli-obk
Manish Goregaokar [Sat, 18 Jul 2020 23:50:59 +0000 (16:50 -0700)]
Rollup merge of #74459 - canova:const-unreachable-unchecked, r=oli-obk

Make unreachable_unchecked a const fn

This PR makes `std::hint::unreachable_unchecked` a const fn so we can use it inside a const function.
r? @RalfJung
Fixes #53188.

3 years agoRollup merge of #74445 - lcnr:const-generic-ty-decl, r=Dylan-DPC
Manish Goregaokar [Sat, 18 Jul 2020 23:50:57 +0000 (16:50 -0700)]
Rollup merge of #74445 - lcnr:const-generic-ty-decl, r=Dylan-DPC

add test for #62878

forgot to push this as part of #74159

r? @Dylan-DPC

3 years agoRollup merge of #74071 - petrochenkov:cload3, r=matthewjasper
Manish Goregaokar [Sat, 18 Jul 2020 23:50:56 +0000 (16:50 -0700)]
Rollup merge of #74071 - petrochenkov:cload3, r=matthewjasper

rustc_metadata: Make crate loading fully speculative

Instead of reporting `span_err`s on the spot crate loading errors are now wrapped into the `CrateError` enum and returned, so they are reported only at the top level `resolve_crate` call, and not reported at all if we are resolving speculatively with `maybe_resolve_crate`.

As a result we can attempt loading crates for error recovery (e.g. import suggestions) without any risk of producing extra errors.
Also, this means better separation between error reporting and actual logic.

Fixes https://github.com/rust-lang/rust/issues/55103
Fixes https://github.com/rust-lang/rust/issues/56590

3 years agoRollup merge of #74021 - 1011X:master, r=dtolnay
Manish Goregaokar [Sat, 18 Jul 2020 23:50:54 +0000 (16:50 -0700)]
Rollup merge of #74021 - 1011X:master, r=dtolnay

impl Index<RangeFrom> for CStr

This change implements (partial) slicing for `CStr`.

Since a `CStr` must end in a null byte, it's not possible to trim from the right and still have a valid `CStr`. But, it *is* possible to trim from the left. This lets us be a bit more flexible and treat them more like strings.

```rust
let string = CStr::from_bytes_with_nul(b"Hello World!\0");
let result = CStr::from_bytes_with_nul(b"World!\0");
assert_eq!(&string[6..], result);
```

3 years agoRollup merge of #73762 - poliorcetics:trait-keyword, r=KodrAus
Manish Goregaokar [Sat, 18 Jul 2020 23:50:52 +0000 (16:50 -0700)]
Rollup merge of #73762 - poliorcetics:trait-keyword, r=KodrAus

Document the trait keyword

Partial fix of #34601.

This document the trait keyword. To avoid doing too much and forcing more updates as functionalities evolve, I put two links to the reference, especially for trait objects. This mainly documents the "big" parts, not so much the small details that might trip someone experimenting.

@rustbot modify labels: T-doc,C-enhancement

3 years agoRollup merge of #70817 - yoshuawuyts:task-ready, r=dtolnay
Manish Goregaokar [Sat, 18 Jul 2020 23:50:50 +0000 (16:50 -0700)]
Rollup merge of #70817 - yoshuawuyts:task-ready, r=dtolnay

Add core::task::ready! macro

This PR adds `ready!` as a top-level macro to `libcore` following the implementation of `futures_core::ready`, tracking issue https://github.com/rust-lang/rust/issues/70922. This macro is commonly used when implementing `Future`, `AsyncRead`, `AsyncWrite` and `Stream`. And being only 5 lines, it seems like a useful and straight forward addition to std.

## Example

```rust
use core::task::{Context, Poll};
use core::future::Future;
use core::pin::Pin;

async fn get_num() -> usize {
    42
}

pub fn do_poll(cx: &mut Context<'_>) -> Poll<()> {
    let mut f = get_num();
    let f = unsafe { Pin::new_unchecked(&mut f) };

    let num = ready!(f.poll(cx));
    // ... use num

    Poll::Ready(())
}
```

## Naming

In `async-std` we chose to nest the macro under the `task` module instead of having the macro at the top-level. This is a pattern that currently does not occur in std, mostly due to this not being possible prior to Rust 2018.

This PR proposes to add the `ready` macro as `core::ready`. But another option would be to introduce it as `core::task::ready` since it's really only useful when used in conjunction with `task::{Context, Poll}`.

## Implementation questions

I tried rendering the documentation locally but the macro didn't show up under `core`. I'm not sure if I quite got this right. I used the [`todo!` macro PR](https://github.com/rust-lang/rust/pull/56348/files) as a reference, and our approaches look similar.

## References

- [`futures::ready`](https://docs.rs/futures/0.3.4/futures/macro.ready.html)
- [`async_std::task::ready`](https://docs.rs/async-std/1.5.0/async_std/task/index.html)
- [`futures_core::ready`](https://docs.rs/futures-core/0.3.4/futures_core/macro.ready.html)

3 years agoAdd explicit exception list to linkchecker
Manish Goregaokar [Sat, 18 Jul 2020 20:36:27 +0000 (13:36 -0700)]
Add explicit exception list to linkchecker

3 years agoUse intra-doc links on HashSet
Manish Goregaokar [Sat, 18 Jul 2020 19:21:14 +0000 (12:21 -0700)]
Use intra-doc links on HashSet

3 years agoUse intra-doc links on HashMap
Manish Goregaokar [Sat, 18 Jul 2020 19:20:16 +0000 (12:20 -0700)]
Use intra-doc links on HashMap

3 years agoUse intra-doc links in std::io
Manish Goregaokar [Sat, 18 Jul 2020 19:02:03 +0000 (12:02 -0700)]
Use intra-doc links in std::io

3 years agoAdd a link to read in the read_exact doc about the guarantees
Alexis Bourget [Sat, 18 Jul 2020 21:20:58 +0000 (23:20 +0200)]
Add a link to read in the read_exact doc about the guarantees

3 years agoUpdate stability attribute for CStr indexing
David Tolnay [Sat, 18 Jul 2020 19:16:25 +0000 (12:16 -0700)]
Update stability attribute for CStr indexing

3 years agoimpl Index<RangeFrom<usize>> for CStr
1011X [Sat, 4 Jul 2020 02:11:10 +0000 (22:11 -0400)]
impl Index<RangeFrom<usize>> for CStr

3 years agoUse intra-doc links in BTreeMap
Manish Goregaokar [Sat, 18 Jul 2020 18:41:41 +0000 (11:41 -0700)]
Use intra-doc links in BTreeMap

3 years agoUse more intra-doc links in BTreeSet
Manish Goregaokar [Sat, 18 Jul 2020 18:21:22 +0000 (11:21 -0700)]
Use more intra-doc links in BTreeSet

3 years agoUse intra-doc links in alloc::String
Manish Goregaokar [Sat, 18 Jul 2020 17:14:00 +0000 (10:14 -0700)]
Use intra-doc links in alloc::String

3 years agoadd note to `opt_const_param_of`
Bastian Kauschke [Sat, 18 Jul 2020 17:22:12 +0000 (19:22 +0200)]
add note to `opt_const_param_of`

3 years agoMore links in std::str
Manish Goregaokar [Sat, 18 Jul 2020 16:43:39 +0000 (09:43 -0700)]
More links in std::str

3 years agoAuto merge of #73441 - alexcrichton:backtrace-gimli, r=Mark-Simulacrum
bors [Sat, 18 Jul 2020 16:08:23 +0000 (16:08 +0000)]
Auto merge of #73441 - alexcrichton:backtrace-gimli, r=Mark-Simulacrum

std: Switch from libbacktrace to gimli

This commit is a proof-of-concept for switching the standard library's
backtrace symbolication mechanism on most platforms from libbacktrace to
gimli. The standard library's support for `RUST_BACKTRACE=1` requires
in-process parsing of object files and DWARF debug information to
interpret it and print the filename/line number of stack frames as part
of a backtrace.

Historically this support in the standard library has come from a
library called "libbacktrace". The libbacktrace library seems to have
been extracted from gcc at some point and is written in C. We've had a
lot of issues with libbacktrace over time, unfortunately, though. The
library does not appear to be actively maintained since we've had
patches sit for months-to-years without comments. We have discovered a
good number of soundness issues with the library itself, both when
parsing valid DWARF as well as invalid DWARF. This is enough of an issue
that the libs team has previously decided that we cannot feed untrusted
inputs to libbacktrace. This also doesn't take into account the
portability of libbacktrace which has been difficult to manage and
maintain over time. While possible there are lots of exceptions and it's
the main C dependency of the standard library right now.

For years it's been the desire to switch over to a Rust-based solution
for symbolicating backtraces. It's been assumed that we'll be using the
Gimli family of crates for this purpose, which are targeted at safely
and efficiently parsing DWARF debug information. I've been working
recently to shore up the Gimli support in the `backtrace` crate. As of a
few weeks ago the `backtrace` crate, by default, uses Gimli when loaded
from crates.io. This transition has gone well enough that I figured it
was time to start talking seriously about this change to the standard
library.

This commit is a preview of what's probably the best way to integrate
the `backtrace` crate into the standard library with the Gimli feature
turned on. While today it's used as a crates.io dependency, this commit
switches the `backtrace` crate to a submodule of this repository which
will need to be updated manually. This is not done lightly, but is
thought to be the best solution. The primary reason for this is that the
`backtrace` crate needs to do some pretty nontrivial filesystem
interactions to locate debug information. Working without `std::fs` is
not an option, and while it might be possible to do some sort of
trait-based solution when prototyped it was found to be too unergonomic.
Using a submodule allows the `backtrace` crate to build as a submodule
of the `std` crate itself, enabling it to use `std::fs` and such.

Otherwise this adds new dependencies to the standard library. This step
requires extra attention because this means that these crates are now
going to be included with all Rust programs by default. It's important
to note, however, that we're already shipping libbacktrace with all Rust
programs by default and it has a bunch of C code implementing all of
this internally anyway, so we're basically already switching
already-shipping functionality to Rust from C.

* `object` - this crate is used to parse object file headers and
  contents. Very low-level support is used from this crate and almost
  all of it is disabled. Largely we're just using struct definitions as
  well as convenience methods internally to read bytes and such.

* `addr2line` - this is the main meat of the implementation for
  symbolication. This crate depends on `gimli` for DWARF parsing and
  then provides interfaces needed by the `backtrace` crate to turn an
  address into a filename / line number. This crate is actually pretty
  small (fits in a single file almost!) and mirrors most of what
  `dwarf.c` does for libbacktrace.

* `miniz_oxide` - the libbacktrace crate transparently handles
  compressed debug information which is compressed with zlib. This crate
  is used to decompress compressed debug sections.

* `gimli` - not actually used directly, but a dependency of `addr2line`.

* `adler32`- not used directly either, but a dependency of
  `miniz_oxide`.

The goal of this change is to improve the safety of backtrace
symbolication in the standard library, especially in the face of
possibly malformed DWARF debug information. Even to this day we're still
seeing segfaults in libbacktrace which could possibly become security
vulnerabilities. This change should almost entirely eliminate this
possibility whilc also paving the way forward to adding more features
like split debug information.

Some references for those interested are:

* Original addition of libbacktrace - #12602
* OOM with libbacktrace - #24231
* Backtrace failure due to use of uninitialized value - #28447
* Possibility to feed untrusted data to libbacktrace - #21889
* Soundness fix for libbacktrace - #33729
* Crash in libbacktrace - #39468
* Support for macOS, never merged - ianlancetaylor/libbacktrace#2
* Performance issues with libbacktrace - #29293, #37477
* Update procedure is quite complicated due to how many patches we
  need to carry - #50955
* Libbacktrace doesn't work on MinGW with dynamic libs - #71060
* Segfault in libbacktrace on macOS - #71397

Switching to Rust will not make us immune to all of these issues. The
crashes are expected to go away, but correctness and performance may
still have bugs arise. The gimli and `backtrace` crates, however, are
actively maintained unlike libbacktrace, so this should enable us to at
least efficiently apply fixes as situations come up.

---

I want to note that my purpose for creating a PR here is to start a conversation about this. I think that all the various pieces are in place that this is compelling enough that I think this transition should be talked about seriously. There are a number of items which still need to be addressed before actually merging this PR, however:

* [ ] `gimli` needs to be published to crates.io
* [ ] `addr2line` needs a publish
* [ ] `miniz_oxide` needs a publish
* [ ] Tests probably shouldn't recommend the `gimli` crate's traits for implementing
* [ ] The `backtrace` crate's branch changes need to be merged to the master branch (https://github.com/rust-lang/backtrace-rs/pull/349)
* [ ] The support for `libbacktrace` on some platforms needs to be audited to see if we should support more strategies in the gimli implementation - https://github.com/rust-lang/backtrace-rs/issues/325, https://github.com/rust-lang/backtrace-rs/issues/326, https://github.com/rust-lang/backtrace-rs/issues/350, https://github.com/rust-lang/backtrace-rs/issues/351

Most of the merging/publishing I'm not actively pushing on right now. It's a bit wonky for crates to support libstd so I'm holding off on pulling the trigger everywhere until there's a bit more discussion about how to go through with this. Namely https://github.com/rust-lang/backtrace-rs/pull/349 I'm going to hold off merging until we decide to go through with the submodule strategy.

In any case this is a pretty major change, so I suspect that the compiler team is likely going to be interested in this. I don't mean to force changes by dumping a bunch of code by any means. Integration of external crates into the standard library is so difficult I wanted to have a proof-of-concept to review while talking about whether to do this at all (hence the PR), but I'm more than happy to follow any processes needed to merge this. I must admit though that I'm not entirely sure myself at this time what the process would be to decide to merge this, so I'm hoping others can help me figure that out!

3 years agoRevert "Use an UTF-8 locale for the linker."
Jonas Schievink [Sat, 18 Jul 2020 14:59:16 +0000 (16:59 +0200)]
Revert "Use an UTF-8 locale for the linker."

3 years agoAuto merge of #74468 - Manishearth:rollup-5nhvz80, r=Manishearth
bors [Sat, 18 Jul 2020 13:00:50 +0000 (13:00 +0000)]
Auto merge of #74468 - Manishearth:rollup-5nhvz80, r=Manishearth

Rollup of 11 pull requests

Successful merges:

 - #72414 ( Add lazy initialization primitives to std)
 - #74069 (Compare tagged/niche-filling layout and pick the best one)
 - #74418 (ci: Set `shell: bash` as a default, remove duplicates)
 - #74441 (bootstrap.py: patch RPATH on NixOS to handle the new zlib dependency.)
 - #74444 (Add regression test for #69414)
 - #74448 (improper_ctypes_definitions: allow `Box`)
 - #74449 (Test codegen of compare_exchange operations)
 - #74450 (Fix `Safety` docs for `from_raw_parts_mut`)
 - #74453 (Use intra-doc links in `str` and `BTreeSet`)
 - #74457 (rustbuild: drop tool::should_install)
 - #74464 (Use pathdiff crate)

Failed merges:

r? @ghost

3 years agorustc_metadata: Make crate loading fully speculative
Vadim Petrochenkov [Sun, 5 Jul 2020 07:39:15 +0000 (10:39 +0300)]
rustc_metadata: Make crate loading fully speculative

3 years agorustc_metadata: Refactor away `CrateLocator::(dy,static)libname`
Vadim Petrochenkov [Sat, 4 Jul 2020 18:38:56 +0000 (21:38 +0300)]
rustc_metadata: Refactor away `CrateLocator::(dy,static)libname`

3 years agorustc_metadata: Remove some extra diagnostics for legacy plugins
Vadim Petrochenkov [Sat, 4 Jul 2020 17:47:06 +0000 (20:47 +0300)]
rustc_metadata: Remove some extra diagnostics for legacy plugins

They are deprecated so doing extra work for error recovery doesn't make sense

3 years agorustc_metadata: Remove a bit of ancient profiling
Vadim Petrochenkov [Sat, 4 Jul 2020 16:01:21 +0000 (19:01 +0300)]
rustc_metadata: Remove a bit of ancient profiling

3 years agoFix debug assertion in typeck
Yuki Okushi [Thu, 28 May 2020 23:27:59 +0000 (08:27 +0900)]
Fix debug assertion in typeck

3 years agoRollup merge of #74464 - FedericoPonzi:fix-#67108, r=Manishearth
Manish Goregaokar [Sat, 18 Jul 2020 01:13:55 +0000 (18:13 -0700)]
Rollup merge of #74464 - FedericoPonzi:fix-#67108, r=Manishearth

Use pathdiff crate

I wanted to tackle a simple issue, and stumbled upon #67108: this pr removes the function which was exported to the external crate as required in the todo/issue.
I've tested it with:
```
./x.py build --stage 1 --keep-stage 1 src/librustc_codegen_ssa
```
And it looks like it's compiling

3 years agoRollup merge of #74457 - Keruspe:install, r=Mark-Simulacrum
Manish Goregaokar [Sat, 18 Jul 2020 01:13:53 +0000 (18:13 -0700)]
Rollup merge of #74457 - Keruspe:install, r=Mark-Simulacrum

rustbuild: drop tool::should_install

Always install when the build succeeds

Fixes #74431

3 years agoRollup merge of #74453 - Manishearth:intra-doc-std, r=jyn514
Manish Goregaokar [Sat, 18 Jul 2020 01:13:52 +0000 (18:13 -0700)]
Rollup merge of #74453 - Manishearth:intra-doc-std, r=jyn514

Use intra-doc links in `str` and `BTreeSet`

Fixes #32129, fixes  #32130

A _slight_ degradation in quality is that the `#method.foo` links would previously link to the same page on `String`'s documentation, and now they will navigate to `str`. Not a big deal IMO, and we can also try to improve that.

3 years agoRollup merge of #74450 - aticu:master, r=jonas-schievink
Manish Goregaokar [Sat, 18 Jul 2020 01:13:50 +0000 (18:13 -0700)]
Rollup merge of #74450 - aticu:master, r=jonas-schievink

Fix `Safety` docs for `from_raw_parts_mut`

This aligns the wording more with the documentation of e.g. `drop_in_place`, `replace`, `swap` and `swap_nonoverlapping` from `core::ptr`.

Also if the pointer were really only valid for writes, it would be trivial to introduce UB from safe code, after calling `core::slice::from_raw_parts_mut`.

3 years agoRollup merge of #74449 - tmiasko:cmpxchg-test, r=nikomatsakis
Manish Goregaokar [Sat, 18 Jul 2020 01:13:48 +0000 (18:13 -0700)]
Rollup merge of #74449 - tmiasko:cmpxchg-test, r=nikomatsakis

Test codegen of compare_exchange operations

Add a codegen test for compare_exchange to verify that rustc emits expected LLVM IR.