Commit graph

124405 commits

Author SHA1 Message Date
Mark Rousskov
13ad2322ca Cache non-exhaustive separately from attributes 2020-07-28 16:26:38 -04:00
bors
2caf854f7a Auto merge of #74471 - da-x:string-type-diagnostic-item, r=petrochenkov
librustc_typeck: use diag item instead of string compare
2020-07-28 20:00:37 +00:00
Mark Rousskov
6726ca2b28 Collect library features from library/ 2020-07-28 13:03:59 -05:00
mark
856f68fa14 reenable tests after moving std 2020-07-28 13:03:59 -05:00
bors
98efae8760 Auto merge of #74482 - alexcrichton:update-stdarch, r=hanna-kruppe
Update stdarch submodule

This commit updates the src/stdarch submodule primarily to include
rust-lang/stdarch#874 which updated and revamped WebAssembly SIMD
intrinsics and renamed WebAssembly atomics intrinsics. This is all
unstable surface area of the standard library so the changes should be
ok here. The SIMD updates also enable SIMD intrinsics to be used by any
program any any time, yay!

cc #74372, a tracking issue I've opened for the stabilization of SIMD
intrinsics
2020-07-28 17:39:39 +00:00
Oliver Scherer
7d67a1b871 Replace write-to-vec hack by introducing a display renderer for allocations 2020-07-28 19:16:09 +02:00
Alexis Bourget
90d00527d1 Add note to clearly mark the RFC as rejected 2020-07-28 18:53:35 +02:00
Alexis Bourget
dcce6cb511 Remove links to rejected errata 4406 for RFC 4291 2020-07-28 18:53:35 +02:00
Alex Crichton
83b493018a Update stdarch submodule
This commit updates the src/stdarch submodule primarily to include
rust-lang/stdarch#874 which updated and revamped WebAssembly SIMD
intrinsics and renamed WebAssembly atomics intrinsics. This is all
unstable surface area of the standard library so the changes should be
ok here. The SIMD updates also enable SIMD intrinsics to be used by any
program any any time, yay!

cc #74372, a tracking issue I've opened for the stabilization of SIMD
intrinsics
2020-07-28 09:41:09 -07:00
Oliver Scherer
5e96bb4593 Replace all uses of log::log_enabled with Debug printers 2020-07-28 16:15:40 +02:00
bors
7b3a781937 Auto merge of #73964 - jyn514:sane-defaults, r=Mark-Simulacrum
Improve defaults in x.py

- Make the default stage dependent on the subcommand
- Don't build stage1 rustc artifacts with x.py build --stage 1. If this is what you want, use x.py build --stage 2 instead, which gives you a working libstd.
- Change default debuginfo when debug = true from 2 to 1

I tried to fix CI to use `--stage 2` everywhere it currently has no stage, but I might have missed a spot.
This does not update much of the documentation - most of it is in https://github.com/rust-lang/rustc-dev-guide/ or https://github.com/rust-lang/rust-forge and will need a separate PR.

See individual commits for a detailed rationale of each change.
See also the MCP: https://github.com/rust-lang/compiler-team/issues/326

r? @Mark-Simulacrum , but anyone is free to give an opinion.
2020-07-28 13:56:32 +00:00
Joshua Nelson
da40cf81e6 Use --stage 2 in checktools
- Remove useless --stage 2 argument to checktools.sh
- Fix help text for expand-yaml-anchors (it had a typo)
2020-07-28 09:36:56 -04:00
Joshua Nelson
c4c6453b7b Fix bad rebase 2020-07-28 08:34:59 -04:00
Bastian Kauschke
4f28534138 symbol mangling: use ty::print::Print for consts 2020-07-28 14:34:18 +02:00
Yuki Okushi
b85dae00dc
Enable to ping RISC-V group via triagebot 2020-07-28 21:01:13 +09:00
David Sonder
b5d143b126
Enable docs on dist-x86_64-musl
Add the rust-docs component to toolchain x86_64-unknown-linux-musl, which allows
people using rustup on their musl-based linux distribution to download the
rust-docs.
2020-07-28 13:55:04 +02:00
bors
2c28244cf0 Auto merge of #74796 - infinity0:master, r=nikomatsakis
config.toml.example: Update remap-debuginfo doc to be more general & accurate

This makes it more obvious that the work-around to #74786 is actually correct, and a custom `--remap-path-prefix` isn't needed.

In fact the previous comment `/rustc/$hash/$crate` was wrong, it is not `$crate` but whatever path exists in the rustc source tree, so either `src/$crate` or `vendor/$crate`. I've fixed that as well to avoid future confusion.
2020-07-28 09:02:32 +00:00
Aleksey Kladov
6e9dc7d9ff Add str::[r]split_once
This is useful for quick&dirty parsing of key: value config pairs
2020-07-28 09:58:20 +02:00
Aleksey Kladov
ed1439cea4 Fix RefUnwindSafe & UnwinsSafe impls for lazy::SyncLazy
The logic here is the same as for Send&Sync impls.
2020-07-28 09:51:08 +02:00
Michal 'vorner' Vaner
ad6d63ef01
Don't use "weak count" around Weak::from_raw_ptr
As `Rc/Arc::weak_count` returns 0 when having no strong counts, this
could be confusing and it's better to avoid using that completely.

Closes #73840.
2020-07-28 08:30:32 +02:00
bors
1f5d69dacc Auto merge of #74855 - jyn514:separate-lints, r=Manishearth
Separate `missing_doc_code_examples` from intra-doc links

These two lints have no relation other than both being nightly-only.
This allows stabilizing intra-doc links without stabilizing `missing_doc_code_examples`.

Fixes one of the issues spotted by @ollie27 in https://github.com/rust-lang/rust/pull/74430#issuecomment-664693080.

r? @Manishearth
2020-07-28 05:49:59 +00:00
Lzu Tao
5faef5e00c ayu theme: Change doccomment color to #a1ac88
Co-authored-by: Cldfire <cldfire@3grid.net>
2020-07-28 05:12:12 +00:00
Ashley Mannix
9d4818c6f9 update stderr for polymorphic ui test 2020-07-28 14:37:31 +10:00
Tomasz Miąsko
0a51a9fb00 Add #[inline] to RawWaker::new 2020-07-28 06:14:52 +02:00
bors
1454bbd4fd Auto merge of #74841 - infinity0:fix-exec, r=Mark-Simulacrum
rustbuild: use Display for exit status instead of Debug, see #74832 for justification
2020-07-28 03:42:22 +00:00
Ashley Mannix
a99d2cbfe7 remove unstable const_type_id feature 2020-07-28 13:33:08 +10:00
Ashley Mannix
e3856616ee bump const type id stabilization to 1.46.0 2020-07-28 13:30:29 +10:00
Ashley Mannix
cac16c9793 stabilize const_type_id feature 2020-07-28 13:30:29 +10:00
Joshua Nelson
c3f5556c30 private_items_doc_tests -> doc_test_lints 2020-07-27 23:30:17 -04:00
Joshua Nelson
a5337d668c Use exhaustive match for assert 2020-07-27 23:19:43 -04:00
Joshua Nelson
7768eaa050 Add assert that tests happen with stage 2 in CI
- Use stage 2 for makefile
- Move assert to builder
- Don't add an assert for --help
- Allow --stage 0 if passed explicitly
- Don't assert defaults during tests

Otherwise it's impossible to test the defaults!
2020-07-27 23:19:31 -04:00
Joshua Nelson
4ee8d847e5 Use --stage 2 explicitly in CI
- expand yaml anchors
- don't use --stage 2 for dist; that's already the default
2020-07-27 23:19:16 -04:00
Joshua Nelson
cdca337547 Add tests for the new behavior
- Only set stage 2 in dist tests
- Add test for `x.py doc` without args
- Add test for `x.py build` without args
- Add test for `x.py build --stage 0`
2020-07-27 23:16:57 -04:00
Joshua Nelson
60c1729738 Move tests into a submodule 2020-07-27 23:16:01 -04:00
Joshua Nelson
74b373426a Fix most bootstrap tests
Uses --stage 2 for all the existing tests
2020-07-27 23:11:18 -04:00
Joshua Nelson
01c6256178 Change debuginfo to default to 1 if debug = true is set
From [a conversation in discord](https://discordapp.com/channels/442252698964721669/443151243398086667/719200989269327882):

> Linking seems to consume all available RAM, leading to the OS to swap memory to disk and slowing down everything in the process
Compiling itself doesn't seem to take up as much RAM, and I'm only looking to check whether a minimal testcase can be compiled by rustc, where the runtime performance isn't much of an issue

> do you have debug = true or debuginfo-level = 2 in config.toml?
> if so I think that results in over 2GB of debuginfo nowadays and is likely the culprit
> which might mean we're giving out bad advice :(

Anecdotally, this sped up my stage 1 build from 15 to 10 minutes.

This still adds line numbers, it only removes variable and type information.

- Improve wording for debuginfo description

Co-authored-by: Teymour Aldridge <42674621+teymour-aldridge@users.noreply.github.com>
2020-07-27 23:11:18 -04:00
Joshua Nelson
f7dcfcd45b Don't build rustc without std
- Set rustc to build only when explicitly asked for

This allows building the stage2 rustc artifacts, which nothing depends
on.

Previously the behavior was as follows (where stageN <-> stage(N-1) artifacts, except for stage0 libstd):

- `x.py build --stage 0`:
  - stage0 libstd
  - stage1 rustc (but without putting rustc in stage0/)

This leaves you without any rustc at all except for the beta compiler
(https://github.com/rust-lang/rust/issues/73519). This is never what you want.

- `x.py build --stage 1`:
  - stage0 libstd
  - stage1 rustc
  - stage1 libstd
  - stage1 rustdoc
  - stage2 rustc

This leaves you with a broken stage2 rustc which doesn't even have
libcore and is effectively useless. Additionally, it compiles rustc
twice, which is not normally what you want.

- `x.py build --stage 2`:
  - stage0 libstd
  - stage1 rustc
  - stage1 libstd
  - stage2 rustc
  - stage2 rustdoc and tools

This builds all tools in release mode. This is the correct usage for CI,
but takes far to long for development.

Now the behavior is as follows:

- `x.py build --stage 0`:
  - stage0 libstd

This is suitable for contributors only working on the standard library,
as it means rustc never has to be compiled.

- `x.py build --stage 1`:
  - stage0 libstd
  - stage1 rustc
  - stage1 libstd
  - stage1 rustdoc

This is suitable for contributors working on the compiler. It ensures
that you have a working rustc and libstd without having to pass
`src/libstd` in addition.

- `x.py build --stage 2`:
  - stage0 libstd
  - stage1 rustc
  - stage1 libstd
  - stage2 rustc
  - stage2 libstd
  - stage2 rustdoc

This is suitable for debugging errors which only appear with the stage2
compiler.

- `x.py build --stage 2 src/libstd src/rustc`
  - stage0 libstd
  - stage1 rustc
  - stage1 libstd
  - stage2 rustc
  - stage2 libstd
  - stage2 rustdoc, tools, etc.
  - stage2 rustc artifacts ('stage3')

This is suitable for CI, which wants all tools in release mode.
However, most of the use cases for this should use `x.py dist` instead,
which builds all the tools without each having to be named individually.
2020-07-27 23:11:18 -04:00
Joshua Nelson
0192fa4786 Make the default stage dependent on the subcommand
### x.py build/test: stage 1

I've seen very few people who actually use full stage 2 builds on purpose. These compile rustc and libstd twice and don't give you much more information than a stage 1 build (except in rare cases like https://github.com/rust-lang/rust/pull/68692#discussion_r376392145). For new contributors, this makes the build process even more daunting than it already is. As long as CI is changed to use `--stage 2` I see no downside here.

 ### x.py bench/dist/install: stage 2

These commands have to do with a finished, optimized version of rustc. It seems very rare to want to use these with a stage 1 build.

 ### x.py doc: stage 0

Normally when you document things you're just fixing a typo. In this case there is no need to build the whole rust compiler, since the documentation will usually be the same when generated with the beta compiler or with stage 1.

Note that for this release cycle only there will be a significant different between stage0 and stage1 docs: https://github.com/rust-lang/rust/pull/73101. However most of the time this will not be the case.
2020-07-27 23:11:17 -04:00
Joshua Nelson
d34a1b0c1b Don't duplicate builder code
- Add Builder::new_internal
2020-07-27 23:11:17 -04:00
Who? Me?!
62fd2c81e3
Update outdated readme 2020-07-27 22:05:34 -05:00
Joshua Nelson
def6177708 Move look_for_tests to private_items_doc_tests 2020-07-27 23:03:56 -04:00
Joshua Nelson
617d10975e Separate missing_doc_code_examples from intra-doc links
These two lints have no relation other than both being nightly-only.
This allows stabilizing intra-doc links without stabilizing
missing_doc_code_examples.
2020-07-27 22:54:14 -04:00
bors
ac48e62db8 Auto merge of #73265 - mark-i-m:mv-std, r=Mark-Simulacrum,mark-i-m
mv std libs to library/

This is the first step in refactoring the directory layout of this repository, with further followup steps planned (but not done yet).

Background: currently, all crates are under src/, without nested src directories and with the unconventional `lib*` prefixes (e.g., `src/libcore/lib.rs`). This directory structures is not idiomatic and makes the `src/` directory rather overwhelming. To improve contributor experience and make things a bit more approachable, we are reorganizing the repo a bit.

In this PR, we move the standard libs (basically anything that is "runtime", as opposed to part of the compiler, build system, or one of the tools, etc). The new layout moves these libraries to a new `library/` directory in the root of the repo. Additionally, we remove the `lib*` prefixes and add nested `src/` directories.  The other crates/tools in this repo are not touched. So in summary:

```
library/<crate>/src/*.rs
src/<all the rest>     // unchanged
```

where `<crate>` is:
- core
- alloc
- std
- test
- proc_macro
- panic_abort
- panic_unwind
- profiler_builtins
- term
- unwind
- rtstartup
- backtrace
- rustc-std-workspace-*

There was a lot of discussion about this and a few rounds of compiler team approvals, FCPs, MCPs, and nominations. The original MCP is https://github.com/rust-lang/compiler-team/issues/298. The final approval of the compiler team was given here: https://github.com/rust-lang/rust/pull/73265#issuecomment-659498446.

The name `library` was chosen to complement a later move of the compiler crates to a `compiler/` directory. There was a lot of discussion around adding the nested `src/` directories. Note that this does increase the nesting depth (plausibly important for manual traversal of the tree, e.g., through GitHub's UI or `cd`), but this is deemed to be better as it fits the standard layout of Rust crates throughout most of the ecosystem, though there is some debate about how much this should apply to multi-crate projects. Overall, there seem to be more people in favor of nested `src/` than against.

After this PR, there are no dependencies out of the `library/` directory except on the `build_helper` (or crates.io crates).
2020-07-28 00:51:53 +00:00
mark
2c31b45ae8 mv std libs to library/ 2020-07-27 19:51:13 -05:00
Tomasz Miąsko
821d50aa0c Make closures and generators a must use types
Warn about unused expressions with closure or generator type. This follows
existing precedence of must use annotations present on `FnOnce`, `FnMut`, `Fn`
traits, which already indirectly apply to closures in some cases, e.g.,:

```rust
fn f() -> impl FnOnce() {
    || {}
}

fn main() {
    // an existing warning: unused implementer of `std::ops::FnOnce` that must be used:
    f();

    // a new warning: unused closure that must be used:
    || {};
}
```
2020-07-28 00:00:00 +00:00
bors
9be8ffcb02 Auto merge of #73583 - anp:location-eq, r=dtolnay
Derive common traits for panic::Location.

Now that `#[track_caller]` is on track to stabilize, one of the roughest edges of working with it is the fact that you can't do much with `Location` except turn it back into a `(&str, u32, u32)`. Which makes sense because the type was defined around the panic machinery originally passing around that tuple (it has the same layout as Location even).

This PR derives common traits for the type in accordance with the [API guidelines](https://rust-lang.github.io/api-guidelines/interoperability.html#types-eagerly-implement-common-traits-c-common-traits) (those apply to core, right?).

There's a risk here, e.g. if we ever change the representation of `Location` in a way that makes it harder to implement `Ord`, we might not be able to make that change in a backwards-compatible way. I don't think there's any other compatibility hazard here, as the only changes we currently imagine for the type are to add end fields.

cc @rust-lang/libs
2020-07-27 22:38:25 +00:00
Joseph Ryan
cee8023c69
More requested changes 2020-07-27 17:34:17 -05:00
Nathaniel McCallum
25670749b4 Suppress debuginfo on naked function arguments
A function that has no prologue cannot be reasonably expected to support
debuginfo. In fact, the existing code (before this patch) would generate
invalid instructions that caused crashes. We can solve this easily by
just not emitting the debuginfo in this case.

Fixes https://github.com/rust-lang/rust/issues/42779
cc https://github.com/rust-lang/rust/issues/32408
2020-07-27 18:27:15 -04:00
Ximin Luo
e7089a97e7 rustbuild: refactor how the wrapper deals with exit codes 2020-07-27 23:22:07 +01:00
Ximin Luo
3dcab2922c rustbuild: format both Ok/Err separately, since Result doesn't do it 2020-07-27 22:44:48 +01:00