]> git.lizzy.rs Git - rust.git/log
rust.git
3 years agoDo not ICE on assoc type with bad placeholder
Yuki Okushi [Wed, 22 Jul 2020 05:42:45 +0000 (14:42 +0900)]
Do not ICE on assoc type with bad placeholder

3 years agoAuto merge of #74565 - pietroalbini:build-on-gha, r=Mark-Simulacrum
bors [Tue, 21 Jul 2020 23:29:22 +0000 (23:29 +0000)]
Auto merge of #74565 - pietroalbini:build-on-gha, r=Mark-Simulacrum

Upload builds from GHA instead of Azure Pipelines

This PR does two things:

* Enables RLA comments on PRs (needed after the switch to GHA in RLA).
* Switches GitHub Actions as the CI authorized to upload non-macOS builds.

Note that Docker/LLVM caches will likely be busted.

r? @Mark-Simulacrum

3 years agoAuto merge of #74075 - sunfishcode:wasi-prelude-rawfd, r=alexcrichton
bors [Tue, 21 Jul 2020 06:55:17 +0000 (06:55 +0000)]
Auto merge of #74075 - sunfishcode:wasi-prelude-rawfd, r=alexcrichton

Add `RawFd` to WASI's `std::os::wasi::prelude`.

Add `RawFd` to WASI's `std::os::wasi::prelude`, making it consistent
with all other platforms which also have `AsRawFd`, `FromRawFd`, and
`IntoRawFd` in their respective preludes.

3 years agoAuto merge of #69749 - davidtwco:issue-46477-polymorphization, r=eddyb
bors [Tue, 21 Jul 2020 03:09:04 +0000 (03:09 +0000)]
Auto merge of #69749 - davidtwco:issue-46477-polymorphization, r=eddyb

Polymorphization

This PR implements an analysis to detect when functions could remain polymorphic during code generation.

Fixes #46477

r? @eddyb
cc @rust-lang/wg-mir-opt @nikomatsakis @pnkfelix

3 years agoAuto merge of #74569 - Manishearth:rollup-hkn5ex9, r=Manishearth
bors [Mon, 20 Jul 2020 21:38:46 +0000 (21:38 +0000)]
Auto merge of #74569 - Manishearth:rollup-hkn5ex9, r=Manishearth

Rollup of 13 pull requests

Successful merges:

 - #72714 (Fix debug assertion in typeck)
 - #73197 (Impl Default for ranges)
 - #73323 (wf: check foreign fn decls for well-formedness)
 - #74051 (disallow non-static lifetimes in const generics)
 - #74376 (test caching opt_const_param_of on disc)
 - #74501 (Ayu theme: Use different background color for Run button)
 - #74505 (Fix search input focus in ayu theme)
 - #74522 (Update sanitizer docs)
 - #74546 (Fix duplicate maybe_uninit_extra attribute)
 - #74552 (Stabilize TAU constant.)
 - #74555 (Improve "important traits" popup display on mobile)
 - #74557 (Fix an ICE on an invalid `binding @ ...` in a tuple struct pattern)
 - #74561 (update backtrace-rs)

Failed merges:

r? @ghost

3 years agoRollup merge of #74561 - RalfJung:backtrace, r=alexcrichton
Manish Goregaokar [Mon, 20 Jul 2020 19:30:34 +0000 (12:30 -0700)]
Rollup merge of #74561 - RalfJung:backtrace, r=alexcrichton

update backtrace-rs

Hopefully fixes https://github.com/rust-lang/rust/issues/74484
r? @alexcrichton

3 years agoRollup merge of #74557 - jakubadamw:issue-74539, r=nagisa
Manish Goregaokar [Mon, 20 Jul 2020 19:30:32 +0000 (12:30 -0700)]
Rollup merge of #74557 - jakubadamw:issue-74539, r=nagisa

Fix an ICE on an invalid `binding @ ...` in a tuple struct pattern

Fixes #74539.

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 agoindex: introduce and use `FiniteBitSet`
David Wood [Fri, 17 Jul 2020 11:28:23 +0000 (12:28 +0100)]
index: introduce and use `FiniteBitSet`

This commit introduces a `FiniteBitSet` type which replaces the manual
bit manipulation which was being performed in polymorphization.

Signed-off-by: David Wood <david@davidtw.co>
3 years agomir: use attribute over `-Z polymorphize-errors`
David Wood [Thu, 16 Jul 2020 16:52:23 +0000 (17:52 +0100)]
mir: use attribute over `-Z polymorphize-errors`

This commit replaces the `-Z polymorphize-errors` debugging flag with a
`#[rustc_polymorphize_error]` attribute for use on functions.

Signed-off-by: David Wood <david@davidtw.co>
3 years agometadata: record `unused_generic_params`
David Wood [Mon, 22 Jun 2020 13:00:53 +0000 (14:00 +0100)]
metadata: record `unused_generic_params`

This commit records the results of `unused_generic_params` in crate
metadata, hopefully improving performance.

Signed-off-by: David Wood <david@davidtw.co>
3 years agoty: normalize fn sigs before subst
David Wood [Mon, 22 Jun 2020 13:00:27 +0000 (14:00 +0100)]
ty: normalize fn sigs before subst

This commit normalizes function signatures for instances before
substituting, a workaround for polymorphization considering
parameters unused when they show up in the signature, but not the
body (due to being normalized).

Unfortunately, this causes test output to change with the parallel
compiler only.

Signed-off-by: David Wood <david@davidtw.co>
3 years agomir: `unused_generic_params` query
David Wood [Mon, 22 Jun 2020 12:57:03 +0000 (13:57 +0100)]
mir: `unused_generic_params` query

This commit implements the `unused_generic_params` query, an initial
version of polymorphization which detects when an item does not use
generic parameters and is being needlessly monomorphized as a result.

Signed-off-by: David Wood <david@davidtw.co>
3 years agoFix an ICE on an invalid `binding @ ...` in a tuple struct pattern
Jakub Adam Wieczorek [Mon, 20 Jul 2020 13:13:00 +0000 (15:13 +0200)]
Fix an ICE on an invalid `binding @ ...` in a tuple struct pattern

3 years agoci: upload non-macOS from GHA instead of Azure Pipelines
Pietro Albini [Mon, 20 Jul 2020 15:43:48 +0000 (17:43 +0200)]
ci: upload non-macOS from GHA instead of Azure Pipelines

3 years agoci: allow RLA to pick the right PR number
Pietro Albini [Mon, 20 Jul 2020 15:11:30 +0000 (17:11 +0200)]
ci: allow RLA to pick the right PR number

3 years agoupdate backtrace-rs
Ralf Jung [Mon, 20 Jul 2020 14:44:46 +0000 (16:44 +0200)]
update backtrace-rs

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 agoshim: adjust valid shim asserts
David Wood [Mon, 22 Jun 2020 12:45:05 +0000 (13:45 +0100)]
shim: adjust valid shim asserts

This commit makes valid shim asserts more specific - checking for the
specific types that are valid for a given type of shim - and removes
asserts for types which require substitutions.

Signed-off-by: David Wood <david@davidtw.co>
3 years agodebuginfo: add type metadata for params
David Wood [Mon, 22 Jun 2020 12:36:53 +0000 (13:36 +0100)]
debuginfo: add type metadata for params

This commit adds type metadata for generic parameters (that arise from
polymorphization). Generic parameter metadata is considered zero-sized
and named after the generic parameter.

Signed-off-by: David Wood <david@davidtw.co>
3 years agodebuginfo: no type metadata if substs reqd
David Wood [Mon, 22 Jun 2020 12:33:17 +0000 (13:33 +0100)]
debuginfo: no type metadata if substs reqd

This commit skips generating debuginfo type metadata if substitutions
are required by the type. This avoids ICEs that result from layouts
of types with substitutions being computed.

Signed-off-by: David Wood <david@davidtw.co>
3 years agoty: add doc comments to `Generics` methods
David Wood [Mon, 22 Jun 2020 12:24:59 +0000 (13:24 +0100)]
ty: add doc comments to `Generics` methods

This commit adds doc comments to the `param_at`, `region_param` and
`const_param` methods on the `Generics` struct.

Signed-off-by: David Wood <david@davidtw.co>
3 years agotrait_sel: only test predicates w/ no substs
David Wood [Mon, 22 Jun 2020 12:22:45 +0000 (13:22 +0100)]
trait_sel: only test predicates w/ no substs

This commit modifies the `substitute_normalize_and_test_predicates`
query, renaming it to `impossible_predicates` and only checking
predicates which do not require substs. By making this change,
polymorphization doesn't have to explicitly support vtables.

Signed-off-by: David Wood <david@davidtw.co>
3 years agoty: `STILL_FURTHER_SPECIALIZABLE` w/out prnt subst
David Wood [Mon, 22 Jun 2020 12:07:05 +0000 (13:07 +0100)]
ty: `STILL_FURTHER_SPECIALIZABLE` w/out prnt subst

This commit modifies the `STILL_FURTHER_SPECIALIZABLE` flag so that the
flag isn't set by the parent substs of closures or generators.

Signed-off-by: David Wood <david@davidtw.co>
3 years agomir: rename `should_monomorphize_locally`
David Wood [Mon, 22 Jun 2020 12:02:32 +0000 (13:02 +0100)]
mir: rename `should_monomorphize_locally`

This commit renames `should_monomorphize_locally` to
`should_codegen_locally` which better describes what the function
determines once polymorphization is added.

Signed-off-by: David Wood <david@davidtw.co>
3 years agomir: avoid double substitution
David Wood [Mon, 22 Jun 2020 11:53:40 +0000 (12:53 +0100)]
mir: avoid double substitution

This commit avoids a natural, free-range double substitution error by
monomorphizing the projection element before getting the type.

Signed-off-by: David Wood <david@davidtw.co>
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