Commit Graph

123797 Commits

Author SHA1 Message Date
Manish Goregaokar
d527c7db67
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.
2020-07-19 19:12:32 -07:00
Alex Crichton
028f8d7b85 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.
2020-07-19 17:30:29 -07:00
Nicholas Baron
09d55292ed
Update src/libstd/keyword_docs.rs
Clear up wording regarding the iterator and usage of `break`.

Co-authored-by: Josh Triplett <josh@joshtriplett.org>
2020-07-19 17:01:36 -07:00
bors
2c21a6f3a8 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
2020-07-19 22:50:46 +00:00
Nicholas-Baron
f268525d96 Linked the earlier mention of IntoIterator in the keyword 'for' docs 2020-07-19 14:06:55 -07:00
Nicholas-Baron
6c493df0f8 Mentioned IntoIterator in keyword 'in' docs 2020-07-19 14:05:45 -07:00
Nicholas-Baron
940ceb1a43 Mentioned IntoIterator earlier in keyword 'for' docs 2020-07-19 14:03:52 -07:00
Mark Rousskov
e24a0172b0 Only skip impls of foreign unstable traits
Previously unstable impls were skipped, which meant that any impl with an
unstable method would get skipped.
2020-07-19 16:39:20 -04:00
Alexis Bourget
471dd52d77 Fix merge conflict with recent PR 2020-07-19 22:15:44 +02:00
Caleb Cartwright
7dba34fd6b tools: update rustfmt toolstate maintainers 2020-07-19 13:10:38 -05:00
Jake Goulding
57614da715 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
```
2020-07-19 13:04:33 -04:00
Gabriel Smith
c60a035658 Add test for an explicit non-'static lifetime in a const argument 2020-07-19 12:53:51 -04:00
Gabriel Smith
69d5dd6a50 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
2020-07-19 12:52:36 -04:00
Solomon Ucko
a462e7c1d0 Document core::fmt::rt::v1::Count 2020-07-19 11:24:24 -04:00
Tomasz Miąsko
58b862072c Document AddressSanitizer memory leak detection defaults 2020-07-19 17:12:44 +02:00
Tomasz Miąsko
251878ebc4 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.
2020-07-19 17:11:33 +02:00
Ralf Jung
d7a36d8964 include backtrace folder in rust-src component 2020-07-19 16:53:53 +02:00
Mark Rousskov
be43319b17 Do not clobber RUSTDOCFLAGS
We were setting these in both Builder::cargo and here, which ended up only
setting the first of the two.
2020-07-19 10:42:06 -04:00
Poliorcetics
a459fc4e31
Apply suggestions from review
Co-authored-by: Joshua Nelson <joshua@yottadb.com>
2020-07-19 16:28:18 +02:00
bors
d7f9451634 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
2020-07-19 14:17:08 +00:00
Manish Goregaokar
1636961a0e
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.
2020-07-19 07:02:27 -07:00
Manish Goregaokar
90164587dc
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.
2020-07-19 07:02:26 -07:00
Manish Goregaokar
cc4e880c62
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
2020-07-19 07:02:24 -07:00
Manish Goregaokar
2f3d64fc2f
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
2020-07-19 07:02:22 -07:00
Alexis Bourget
b7bf3c83c4 Remove useless link to bool primitive 2020-07-19 15:58:41 +02:00
Bastian Kauschke
455e6140d8 do not try fetching the ancestors of errored trait impls 2020-07-19 15:45:44 +02:00
Alexis Bourget
e88220f867 Fix small nit in the link to read 2020-07-19 15:30:32 +02:00
bors
48036804d2 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.
2020-07-19 10:46:34 +00:00
Lzu Tao
0eff3d5d88 Ayu: use different background color to make Run button easy-to-spot
Co-authored-by: Cldfire <cldfire@3grid.net>
2020-07-19 09:09:06 +00:00
bors
47ea6d90b0 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
2020-07-19 07:25:18 +00:00
Jarek Samic
dec70767e5 Fix search input focus in ayu theme 2020-07-19 02:00:10 -04:00
Manish Goregaokar
ec966ae13d primitive impls are weird 2020-07-18 22:42:11 -07:00
Manish Goregaokar
ea70cc0ae6 Clarify the literal string 2020-07-18 22:42:11 -07:00
Manish Goregaokar
8d470b5796
Update src/libstd/io/mod.rs
Co-authored-by: Joshua Nelson <joshua@yottadb.com>
2020-07-18 22:31:35 -07:00
Manish Goregaokar
4a324b8117
Update src/tools/linkchecker/main.rs
Co-authored-by: Joshua Nelson <joshua@yottadb.com>
2020-07-18 22:30:25 -07:00
Lokathor
ec9c8d81f6 remove unused imports 2020-07-18 23:01:01 -06:00
Lzu Tao
174abeb6cb Add an border around the Run button 2020-07-19 04:31:01 +00:00
bors
0701419e96 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
2020-07-19 04:03:54 +00:00
Lokathor
4c8e62b433 Resolve https://github.com/rust-lang/rust/pull/74419#issuecomment-660518936 2020-07-18 21:57:37 -06:00
Manish Goregaokar
a83e294f77
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
2020-07-18 16:51:01 -07:00
Manish Goregaokar
2fad396368
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.
2020-07-18 16:50:59 -07:00
Manish Goregaokar
1a54b61e39
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
2020-07-18 16:50:57 -07:00
Manish Goregaokar
43ba8409d7
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
2020-07-18 16:50:56 -07:00
Manish Goregaokar
f305b200df
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);
```
2020-07-18 16:50:54 -07:00
Manish Goregaokar
a6266e2d60
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
2020-07-18 16:50:52 -07:00
Manish Goregaokar
479c8ad17c
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)
2020-07-18 16:50:50 -07:00
Manish Goregaokar
a9680938d0 Add explicit exception list to linkchecker 2020-07-18 16:13:04 -07:00
Manish Goregaokar
9392a5ed94 Use intra-doc links on HashSet 2020-07-18 16:13:04 -07:00
Manish Goregaokar
e53fea7e06 Use intra-doc links on HashMap 2020-07-18 16:13:04 -07:00
Manish Goregaokar
26ba0e12e8 Use intra-doc links in std::io 2020-07-18 16:13:04 -07:00