]> git.lizzy.rs Git - rust.git/log
rust.git
3 years agoreenable tests after moving std
mark [Tue, 28 Jul 2020 04:02:34 +0000 (23:02 -0500)]
reenable tests after moving std

3 years agoAuto merge of #73964 - jyn514:sane-defaults, r=Mark-Simulacrum
bors [Tue, 28 Jul 2020 13:56:32 +0000 (13:56 +0000)]
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.

3 years agoUse --stage 2 in checktools
Joshua Nelson [Tue, 28 Jul 2020 13:36:56 +0000 (09:36 -0400)]
Use --stage 2 in checktools

- Remove useless --stage 2 argument to checktools.sh
- Fix help text for expand-yaml-anchors (it had a typo)

3 years agoFix bad rebase
Joshua Nelson [Tue, 28 Jul 2020 12:34:59 +0000 (08:34 -0400)]
Fix bad rebase

3 years agoAuto merge of #74796 - infinity0:master, r=nikomatsakis
bors [Tue, 28 Jul 2020 09:02:32 +0000 (09:02 +0000)]
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.

3 years agoAuto merge of #74855 - jyn514:separate-lints, r=Manishearth
bors [Tue, 28 Jul 2020 05:49:59 +0000 (05:49 +0000)]
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

3 years agoAuto merge of #74841 - infinity0:fix-exec, r=Mark-Simulacrum
bors [Tue, 28 Jul 2020 03:42:22 +0000 (03:42 +0000)]
Auto merge of #74841 - infinity0:fix-exec, r=Mark-Simulacrum

rustbuild: use Display for exit status instead of Debug, see #74832 for justification

3 years agoprivate_items_doc_tests -> doc_test_lints
Joshua Nelson [Tue, 28 Jul 2020 03:05:01 +0000 (23:05 -0400)]
private_items_doc_tests -> doc_test_lints

3 years agoUse exhaustive match for assert
Joshua Nelson [Tue, 28 Jul 2020 01:53:10 +0000 (21:53 -0400)]
Use exhaustive match for assert

3 years agoAdd assert that tests happen with stage 2 in CI
Joshua Nelson [Mon, 27 Jul 2020 19:53:01 +0000 (15:53 -0400)]
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!

3 years agoUse --stage 2 explicitly in CI
Joshua Nelson [Tue, 14 Jul 2020 02:28:26 +0000 (22:28 -0400)]
Use --stage 2 explicitly in CI

- expand yaml anchors
- don't use --stage 2 for dist; that's already the default

3 years agoAdd tests for the new behavior
Joshua Nelson [Tue, 14 Jul 2020 00:25:21 +0000 (20:25 -0400)]
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`

3 years agoMove tests into a submodule
Joshua Nelson [Tue, 14 Jul 2020 00:20:42 +0000 (20:20 -0400)]
Move tests into a submodule

3 years agoFix most bootstrap tests
Joshua Nelson [Mon, 13 Jul 2020 23:55:33 +0000 (19:55 -0400)]
Fix most bootstrap tests

Uses --stage 2 for all the existing tests

3 years agoChange debuginfo to default to 1 if `debug = true` is set
Joshua Nelson [Thu, 2 Jul 2020 12:59:50 +0000 (08:59 -0400)]
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>
3 years agoDon't build rustc without std
Joshua Nelson [Thu, 2 Jul 2020 12:40:34 +0000 (08:40 -0400)]
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.

3 years agoMake the default stage dependent on the subcommand
Joshua Nelson [Thu, 2 Jul 2020 12:08:09 +0000 (08:08 -0400)]
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.

3 years agoDon't duplicate builder code
Joshua Nelson [Thu, 2 Jul 2020 12:07:56 +0000 (08:07 -0400)]
Don't duplicate builder code

- Add Builder::new_internal

3 years agoMove `look_for_tests` to `private_items_doc_tests`
Joshua Nelson [Tue, 28 Jul 2020 03:03:56 +0000 (23:03 -0400)]
Move `look_for_tests` to `private_items_doc_tests`

3 years agoSeparate `missing_doc_code_examples` from intra-doc links
Joshua Nelson [Tue, 28 Jul 2020 02:16:41 +0000 (22:16 -0400)]
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.

3 years agoAuto merge of #73265 - mark-i-m:mv-std, r=Mark-Simulacrum,mark-i-m
bors [Tue, 28 Jul 2020 00:51:53 +0000 (00:51 +0000)]
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).

3 years agomv std libs to library/
mark [Fri, 12 Jun 2020 02:31:49 +0000 (21:31 -0500)]
mv std libs to library/

3 years agoAuto merge of #73583 - anp:location-eq, r=dtolnay
bors [Mon, 27 Jul 2020 22:38:25 +0000 (22:38 +0000)]
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

3 years agorustbuild: refactor how the wrapper deals with exit codes
Ximin Luo [Mon, 27 Jul 2020 22:22:07 +0000 (23:22 +0100)]
rustbuild: refactor how the wrapper deals with exit codes

3 years agorustbuild: format both Ok/Err separately, since Result doesn't do it
Ximin Luo [Mon, 27 Jul 2020 21:44:48 +0000 (22:44 +0100)]
rustbuild: format both Ok/Err separately, since Result doesn't do it

3 years agorustbuild: use Display for exit status instead of Debug, see #74832 for justification
Ximin Luo [Mon, 27 Jul 2020 21:06:04 +0000 (22:06 +0100)]
rustbuild: use Display for exit status instead of Debug, see #74832 for justification

3 years agoAuto merge of #73503 - lcnr:forall-predicate-what-and-why-2, r=nikomatsakis
bors [Mon, 27 Jul 2020 20:16:36 +0000 (20:16 +0000)]
Auto merge of #73503 - lcnr:forall-predicate-what-and-why-2, r=nikomatsakis

convert higher ranked `Predicate`s to `PredicateKind::ForAll`

implements step 2 of https://github.com/rust-lang/compiler-team/issues/285
r? @nikomatsakis

3 years agoclippy
Bastian Kauschke [Mon, 27 Jul 2020 19:17:28 +0000 (21:17 +0200)]
clippy

3 years agocleanup
Bastian Kauschke [Tue, 21 Jul 2020 13:42:18 +0000 (15:42 +0200)]
cleanup

3 years agofix rustdoc
Bastian Kauschke [Sat, 18 Jul 2020 16:46:30 +0000 (18:46 +0200)]
fix rustdoc

3 years agoit works again :tada:
Bastian Kauschke [Sat, 18 Jul 2020 12:37:36 +0000 (14:37 +0200)]
it works again :tada:

3 years agofix rebase
Bastian Kauschke [Sat, 18 Jul 2020 10:06:47 +0000 (12:06 +0200)]
fix rebase

3 years agodirectly contain `PredicateAtom` in `PredicateKind::ForAll`
Bastian Kauschke [Sat, 18 Jul 2020 09:46:38 +0000 (11:46 +0200)]
directly contain `PredicateAtom` in `PredicateKind::ForAll`

3 years agointroduce PredicateAtom
Bastian Kauschke [Wed, 8 Jul 2020 22:35:55 +0000 (00:35 +0200)]
introduce PredicateAtom

3 years agoadd reuse_or_mk_predicate
Bastian Kauschke [Wed, 24 Jun 2020 16:06:04 +0000 (18:06 +0200)]
add reuse_or_mk_predicate

3 years agorefactor query_outlives_constraints_into_obligations
Bastian Kauschke [Wed, 24 Jun 2020 15:54:13 +0000 (17:54 +0200)]
refactor query_outlives_constraints_into_obligations

3 years agothis might be unqualified, but at least it's now quantified
Bastian Kauschke [Wed, 24 Jun 2020 15:40:28 +0000 (17:40 +0200)]
this might be unqualified, but at least it's now quantified

3 years agofix rustdoc
Bastian Kauschke [Sun, 21 Jun 2020 12:42:47 +0000 (14:42 +0200)]
fix rustdoc

3 years agosplit ignore_qualifiers
Bastian Kauschke [Sun, 21 Jun 2020 10:26:17 +0000 (12:26 +0200)]
split ignore_qualifiers

3 years agoreview
Bastian Kauschke [Fri, 19 Jun 2020 22:21:59 +0000 (00:21 +0200)]
review

3 years agofix elaborate for predicates with unbound variables
Bastian Kauschke [Fri, 19 Jun 2020 17:19:21 +0000 (19:19 +0200)]
fix elaborate for predicates with unbound variables

3 years agoclippy
Bastian Kauschke [Fri, 19 Jun 2020 08:22:25 +0000 (10:22 +0200)]
clippy

3 years agorustdoc
Bastian Kauschke [Fri, 19 Jun 2020 08:05:05 +0000 (10:05 +0200)]
rustdoc

3 years ago`PredicateKint` -> `PredicateKind`, the beginning of the end
Bastian Kauschke [Thu, 18 Jun 2020 18:41:43 +0000 (20:41 +0200)]
`PredicateKint` -> `PredicateKind`, the beginning of the end

3 years agoprogress
Bastian Kauschke [Thu, 18 Jun 2020 18:33:52 +0000 (20:33 +0200)]
progress

3 years agoelaborate
Bastian Kauschke [Thu, 18 Jun 2020 15:43:26 +0000 (17:43 +0200)]
elaborate

3 years agosubst_supertrait
Bastian Kauschke [Wed, 17 Jun 2020 22:18:58 +0000 (00:18 +0200)]
subst_supertrait

3 years agosomewhat related cleanup
Bastian Kauschke [Wed, 17 Jun 2020 21:20:17 +0000 (23:20 +0200)]
somewhat related cleanup

3 years agowf
Bastian Kauschke [Wed, 17 Jun 2020 20:50:28 +0000 (22:50 +0200)]
wf

3 years agoconvert trivial predicates
Bastian Kauschke [Wed, 17 Jun 2020 09:30:18 +0000 (11:30 +0200)]
convert trivial predicates

3 years agoquery_outlives_constraints_into_obligations
Bastian Kauschke [Wed, 17 Jun 2020 08:46:52 +0000 (10:46 +0200)]
query_outlives_constraints_into_obligations

3 years agoanonymize_predicate
Bastian Kauschke [Tue, 16 Jun 2020 22:13:00 +0000 (00:13 +0200)]
anonymize_predicate

3 years agoHandle trait/projection predicates with bound regions correctly
Matthew Jasper [Sun, 14 Jun 2020 12:22:51 +0000 (13:22 +0100)]
Handle trait/projection predicates with bound regions correctly

3 years agominimal
Bastian Kauschke [Sat, 13 Jun 2020 13:04:28 +0000 (15:04 +0200)]
minimal

3 years agoadd `PredicateKint`, because who doesn't like bodging
Bastian Kauschke [Thu, 11 Jun 2020 19:42:39 +0000 (21:42 +0200)]
add `PredicateKint`, because who doesn't like bodging

3 years agoAuto merge of #74831 - Manishearth:rollup-ugw4pt4, r=Manishearth
bors [Mon, 27 Jul 2020 16:21:09 +0000 (16:21 +0000)]
Auto merge of #74831 - Manishearth:rollup-ugw4pt4, r=Manishearth

Rollup of 4 pull requests

Successful merges:

 - #73858 (Make more primitive integer methods const)
 - #74487 (Forbid generic parameters in anon consts inside of type defaults)
 - #74803 (rustbuild: fix bad usage of UNIX exec() in rustc wrapper)
 - #74822 (More ensure stack to avoid segfault with increased `recursion_limit`)

Failed merges:

r? @ghost

3 years agoRollup merge of #74822 - JohnTitor:no-sigsegv, r=oli-obk
Manish Goregaokar [Mon, 27 Jul 2020 16:20:20 +0000 (09:20 -0700)]
Rollup merge of #74822 - JohnTitor:no-sigsegv, r=oli-obk

More ensure stack to avoid segfault with increased `recursion_limit`

Fixes #74711
I do not add the test here since the limit value depends on the machine and it's hard to test the output.
r? @oli-obk

3 years agoRollup merge of #74803 - infinity0:fix-exec, r=nagisa
Manish Goregaokar [Mon, 27 Jul 2020 16:20:18 +0000 (09:20 -0700)]
Rollup merge of #74803 - infinity0:fix-exec, r=nagisa

rustbuild: fix bad usage of UNIX exec() in rustc wrapper

exec never returns, it replaces the current process. so anything after it is unreachable. that's not how exec_cmd() is used in the surrounding code

We use `--on-fail env` on Debian. `env` always returns exit code 0. This means that the `rustc` bootstrap wrapper always returns exit code 0 even when it fails. However, the crossbeam-utils build process (due to autocfg) relies on `rustc` returning error exit codes when detecting CPU features, and ends up writing `cargo:rustc-cfg=has_atomic_u128` even when it's not detected, because the `rustc` wrapper is always giving exit code 0.

(This separately is causing our builds to try to compile rustc 40+ times, due to #74801.)

3 years agoRollup merge of #74487 - lcnr:const-in-ty-default, r=varkor
Manish Goregaokar [Mon, 27 Jul 2020 16:20:16 +0000 (09:20 -0700)]
Rollup merge of #74487 - lcnr:const-in-ty-default, r=varkor

Forbid generic parameters in anon consts inside of type defaults

Emit a resolution error for `struct Foo<T, U = [u8; std::mem::size_of::<T>()]>`.
We are unable to support this with the way `ty::Generics` is currently used,
so let's just forbid it entirely for now.

Fixes some ICE on stable, e.g.
```rust
struct Foo<T, U = [u8; std::mem::size_of::<*mut T>()]>(T, U);
```

r? @varkor @eddyb

3 years agoRollup merge of #73858 - tspiteri:const-methods, r=oli-obk
Manish Goregaokar [Mon, 27 Jul 2020 16:20:15 +0000 (09:20 -0700)]
Rollup merge of #73858 - tspiteri:const-methods, r=oli-obk

Make more primitive integer methods const

Now that #72437 has been merged and `const_if_match` is stable, these methods can be stabilized const. The methods are grouped in commits according to feature names:

* `const_nonzero_int_methods`
    - `NonZero*::new`
* some `const_checked_int_methods`
    - `{i*,u*}::checked_add`
    - `{i*,u*}::checked_sub`
    - `{i*,u*}::checked_mul`
    - `{i*,u*}::checked_neg`
    - `{i*,u*}::checked_shl`
    - `{i*,u*}::checked_shr`
    - `i*::checked_abs`
* `const_saturating_int_methods`
    - `{i*,u*}::saturating_add`
    - `{i*,u*}::saturating_sub`
    - `{i*,u*}::saturating_mul`
    - `i*::saturating_neg`
    - `i*::saturating_abs`
* `const_int_sign`
    - `i*::signum`
* `const_ascii_ctype_on_intrinsics`
    - `{char,u8}::is_ascii_alphabetic`
    - `{char,u8}::is_ascii_uppercase`
    - `{char,u8}::is_ascii_lowercase`
    - `{char,u8}::is_ascii_alphanumeric`
    - `{char,u8}::is_ascii_digit`
    - `{char,u8}::is_ascii_hexdigit`
    - `{char,u8}::is_ascii_punctuation`
    - `{char,u8}::is_ascii_graphic`
    - `{char,u8}::is_ascii_whitespace`
    - `{char,u8}::is_ascii_control`

3 years agoupdate tests
Bastian Kauschke [Mon, 27 Jul 2020 14:41:27 +0000 (16:41 +0200)]
update tests

3 years agoforbid generic params inside of anon consts in ty defaults
Bastian Kauschke [Sat, 18 Jul 2020 21:42:10 +0000 (23:42 +0200)]
forbid generic params inside of anon consts in ty defaults

3 years agoname `ParamInTyOfConstArg`
Bastian Kauschke [Sat, 18 Jul 2020 20:35:50 +0000 (22:35 +0200)]
name `ParamInTyOfConstArg`

3 years agoAuto merge of #74775 - RalfJung:miri-alloc-ids, r=oli-obk
bors [Mon, 27 Jul 2020 13:07:46 +0000 (13:07 +0000)]
Auto merge of #74775 - RalfJung:miri-alloc-ids, r=oli-obk

 Miri: replace canonical_alloc_id mechanism by extern_static_alloc_id

We only have to call `extern_static_alloc_id` when a `Pointer` is "imported" from the `tcx` to the machine, not on each access. Also drop the old hook for TLS handling, it is not needed any more.

The Miri side of this is at https://github.com/rust-lang/miri/pull/1489.

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

3 years agoMore ensure stack to avoid segfault with increased `recursion_limit`
Yuki Okushi [Mon, 27 Jul 2020 11:41:53 +0000 (20:41 +0900)]
More ensure stack to avoid segfault with increased `recursion_limit`

3 years agoAuto merge of #74817 - JohnTitor:rollup-0fchdye, r=JohnTitor
bors [Mon, 27 Jul 2020 11:07:32 +0000 (11:07 +0000)]
Auto merge of #74817 - JohnTitor:rollup-0fchdye, r=JohnTitor

Rollup of 6 pull requests

Successful merges:

 - #74088 (Avoid writes without any data in `Write::write_all_vectored`)
 - #74598 (Fix sync_once_cell_does_not_leak_partially_constructed_boxes)
 - #74750 (Clean up some uses of logging in ui tests)
 - #74783 (python codes cleanup)
 - #74790 (Don't italicize comments in ayu theme)
 - #74799 (Fixed typo in `closure`)

Failed merges:

r? @ghost

3 years agorename eval_const_to_op -> const_to_op
Ralf Jung [Mon, 27 Jul 2020 11:01:01 +0000 (13:01 +0200)]
rename eval_const_to_op -> const_to_op

3 years agoRollup merge of #74799 - Dhs92:master, r=joshtriplett
Yuki Okushi [Mon, 27 Jul 2020 10:32:02 +0000 (19:32 +0900)]
Rollup merge of #74799 - Dhs92:master, r=joshtriplett

Fixed typo in `closure`

3 years agoRollup merge of #74790 - Cldfire:ayu-no-italic-comments, r=GuillaumeGomez
Yuki Okushi [Mon, 27 Jul 2020 10:32:00 +0000 (19:32 +0900)]
Rollup merge of #74790 - Cldfire:ayu-no-italic-comments, r=GuillaumeGomez

Don't italicize comments in ayu theme

Closes #74770.

Before:

![image](https://user-images.githubusercontent.com/13814214/88486217-2bf18700-cf4a-11ea-896d-e7787b94e7a7.png)

After:

![image](https://user-images.githubusercontent.com/13814214/88486225-3a3fa300-cf4a-11ea-929f-90461799dc01.png)

3 years agoRollup merge of #74783 - jnozsc:python_cleanup, r=Mark-Simulacrum
Yuki Okushi [Mon, 27 Jul 2020 10:31:58 +0000 (19:31 +0900)]
Rollup merge of #74783 - jnozsc:python_cleanup, r=Mark-Simulacrum

python codes cleanup

3 years agoRollup merge of #74750 - oli-obk:logging_and_test_cleanups, r=JohnTitor
Yuki Okushi [Mon, 27 Jul 2020 10:31:56 +0000 (19:31 +0900)]
Rollup merge of #74750 - oli-obk:logging_and_test_cleanups, r=JohnTitor

Clean up some uses of logging in ui tests

The removed test can't possibly trigger anything today as we don't have logging in libstd.

The `exec-env` flag was mistakenly used for adding env vars to rustc invocations both in test and in the test suite and there were some accidental renames from RUST_LOG to RUSTC_LOG that I reverted.

3 years agoRollup merge of #74598 - mzohreva:mz/fix-test, r=KodrAus
Yuki Okushi [Mon, 27 Jul 2020 10:31:55 +0000 (19:31 +0900)]
Rollup merge of #74598 - mzohreva:mz/fix-test, r=KodrAus

Fix sync_once_cell_does_not_leak_partially_constructed_boxes

Spinning multiple threads in this test causes a deadlock in
SGX where thread scheduling is not preemptive.

cc @jethrogb @AdrianCX

3 years agoRollup merge of #74088 - tmiasko:write-all-vectored-empty, r=KodrAus
Yuki Okushi [Mon, 27 Jul 2020 10:31:53 +0000 (19:31 +0900)]
Rollup merge of #74088 - tmiasko:write-all-vectored-empty, r=KodrAus

Avoid writes without any data in `Write::write_all_vectored`

Previously, when non-empty sequence of empty IoSlices have been provided
to `Write::write_all_vectored`, the buffers would be written as is with
`Write::write_vectored` and subsequently the return value `Ok(0)` would
be misinterpreted as an error.

Avoid writes without any data by advancing the buffers first. This
matches the documented behaviour of `Write::write_all_vectored`
and is analogous to what happens in `Write::write_all`.

3 years agoAuto merge of #74737 - smmalis37:astconv-factor, r=davidtwco
bors [Mon, 27 Jul 2020 09:22:09 +0000 (09:22 +0000)]
Auto merge of #74737 - smmalis37:astconv-factor, r=davidtwco

Pull out some duplicated code into a new function

I debated pulling the actual struct_span_err calls into the new method, but I felt like having to pass in multiple arguments for it and wiring up string formatting outweighed the benefits.

Viewing the diff with whitespace ignored is recommended.

3 years agoAuto merge of #74653 - petrochenkov:pmenv, r=dtolnay
bors [Mon, 27 Jul 2020 05:50:29 +0000 (05:50 +0000)]
Auto merge of #74653 - petrochenkov:pmenv, r=dtolnay

proc_macro: Add API for tracked access to environment variables

Continuation of https://github.com/rust-lang/rust/pull/71858.

`proc_macro::tracked_env::var` is similar to regular `env::var` called from a proc macro, except that it also adds the accessed variable to depinfo.

3 years agoAuto merge of #74784 - anp:track-vtables, r=eddyb
bors [Mon, 27 Jul 2020 03:47:17 +0000 (03:47 +0000)]
Auto merge of #74784 - anp:track-vtables, r=eddyb

Fix #[track_caller] shims for trait objects.

We were missing an Instance::resolve_for_fn_ptr in resolve_for_vtable.

Closes #74764.

3 years agorustbuild: rename exec_cmd -> status_code for clarity
Ximin Luo [Mon, 27 Jul 2020 02:00:28 +0000 (03:00 +0100)]
rustbuild: rename exec_cmd -> status_code for clarity

3 years agoAuto merge of #72121 - Aaron1011:final-hygiene-rebase, r=petrochenkov
bors [Mon, 27 Jul 2020 01:54:27 +0000 (01:54 +0000)]
Auto merge of #72121 - Aaron1011:final-hygiene-rebase, r=petrochenkov

Serialize span hygiene data

Fixes #68686
Fixes #70963

This PR serializies global hygiene data into both the incremental compilation cache and the crate metadata. This allows hygiene information to be preserved across compilation sessions (both incremental and cross-crate).

When serializing a `SyntaxContext`, we simply write out the raw id from the current compilation session. Whenever we deserialize a `SyntaxContext`, we 'remap' the id to a fresh id in our current compilation session, and load the associated `SyntaxContextData`.

As a result, some 'upstream' `SyntaxContextData` will end up getting duplicated in 'downstream' crates. This only happens when we actually need to use an 'upstream' `SyntaxContext`, which occurs when we deserialize a `Span` that requires it.

We serialize an `ExpnData` into the metadata of the crate which generated it. An `ExpnId` is serialized as a reference into the crate which 'owns' the corresponding `ExpnData`, which avoids duplication in downstream crates.

I've included a macros 2.0 test which requires hygiene serialization to compile successfully.

TODO:

- [x] <strike>Determine how many additional `DefId`s we end up creating for `ExpnId`s - this may be significant for `libcore`, which uses macros heavily. Alternatively, we could try to compute a `DefPathHash` without making a corresponding `DefId` - however, this might significantly complicate the implementation.</strike> (We no longer create `DefId`s)
- [x] Investigate the overhead of duplicating `SyntaxContextData` in crate metadata.
- [x] Investigate how `resolve_crate_root` behaves with deserialized hygiene data - the current logic may be wrong.
- [x] Add additional tests. The effects of this PR are usually only noticeable when working with headache-inducing macro expansions (e.g. macros expanding to macros), so there are lots of corner cases to test.
- [x] Determine what to do about this:

https://github.com/rust-lang/rust/blob/4774f9b523c942cb5c0236542b5bcac76f6b6b9a/src/librustc_resolve/build_reduced_graph.rs#L892

- [x] Determine if we need to do anything here - I think the fact that `src/test/ui/hygiene/cross_crate_hygiene.rs` passes means that this is working.

https://github.com/rust-lang/rust/blob/3d5d0f898c2f3998e50c2180c6202f193c3acdbc/src/librustc_resolve/imports.rs#L1389-L1392

3 years agorustbuild: fix bad usage of UNIX exec() in rustc wrapper
Ximin Luo [Mon, 27 Jul 2020 01:42:02 +0000 (02:42 +0100)]
rustbuild: fix bad usage of UNIX exec() in rustc wrapper

exec never returns, it replaces the current process. so anything after it is
unreachable. that's not how exec_cmd() is used in the surrounding code

3 years agoFixed typo in `closure`
Alex [Mon, 27 Jul 2020 00:05:49 +0000 (17:05 -0700)]
Fixed typo in `closure`

3 years agoNormalize the test output of hygiene-related tests
Aaron Hill [Mon, 27 Jul 2020 00:00:35 +0000 (20:00 -0400)]
Normalize the test output of hygiene-related tests

A raw SyntaxContext id is implicitly dependent on the target platform,
since libstd and libcore have platform-dependent #[cfg]s which affect
which macros are invoked. As a result, we must strip out any
SyntaxContext ids from test output to ensure that the captured stdout is
not platform-dependent.

3 years agoRemove explicit `extern crate` from proc-macro test
Aaron Hill [Sun, 26 Jul 2020 20:49:55 +0000 (16:49 -0400)]
Remove explicit `extern crate` from proc-macro test

We only want to load this auxiliary crate from a proc-macro, so that it
only ever needs to get built for the host platform.

3 years agoShare serialization optimization between incr and metadata
Aaron Hill [Fri, 24 Jul 2020 07:01:07 +0000 (03:01 -0400)]
Share serialization optimization between incr and metadata

3 years agoProperly reset `orig_id` when loading from incremental cache
Aaron Hill [Thu, 23 Jul 2020 22:47:05 +0000 (18:47 -0400)]
Properly reset `orig_id` when loading from incremental cache

3 years agoAdd test for hygiene caching issue
Aaron Hill [Thu, 23 Jul 2020 21:45:30 +0000 (17:45 -0400)]
Add test for hygiene caching issue

3 years agoIgnore `orig_id` for stable hashing
Aaron Hill [Wed, 22 Jul 2020 19:11:25 +0000 (15:11 -0400)]
Ignore `orig_id` for stable hashing

This does not affect semantic equality, and was causing an enormous
number of Span hash invalidations.

3 years agoAdd test for serializing hygiene *into* a proc-macro crate
Aaron Hill [Tue, 21 Jul 2020 23:51:07 +0000 (19:51 -0400)]
Add test for serializing hygiene *into* a proc-macro crate

This is a very obscure corner case, and should never be hit in practice.

3 years agoAdd test for use of $crate in nested foreign macro_rules!
Aaron Hill [Wed, 15 Jul 2020 03:21:59 +0000 (23:21 -0400)]
Add test for use of $crate in nested foreign macro_rules!

3 years agoHygiene serialization implementation
Aaron Hill [Tue, 17 Mar 2020 15:45:02 +0000 (11:45 -0400)]
Hygiene serialization implementation

3 years agoAuto merge of #74708 - kanru:issue-74564, r=davidtwco
bors [Sun, 26 Jul 2020 22:35:13 +0000 (22:35 +0000)]
Auto merge of #74708 - kanru:issue-74564, r=davidtwco

Ensure stack when type checking and building MIR for large if expressions

Fixes #74564

3 years agoconfig.toml.example: Update remap-debuginfo doc to be more general & accurate
Ximin Luo [Sun, 26 Jul 2020 22:14:17 +0000 (23:14 +0100)]
config.toml.example: Update remap-debuginfo doc to be more general & accurate

3 years agoAuto merge of #74792 - flip1995:clippyup, r=Manishearth
bors [Sun, 26 Jul 2020 20:08:45 +0000 (20:08 +0000)]
Auto merge of #74792 - flip1995:clippyup, r=Manishearth

Update Clippy

Biweekly Clippy Sync

r? @Manishearth

3 years agoMerge commit 'da5a6fb1b65ec6581a67e942a3850f6bc15a552c' into clippyup
flip1995 [Sun, 26 Jul 2020 19:07:07 +0000 (21:07 +0200)]
Merge commit 'da5a6fb1b65ec6581a67e942a3850f6bc15a552c' into clippyup

3 years agoDon't italicize comments in ayu theme
Jarek Samic [Sun, 26 Jul 2020 18:11:10 +0000 (14:11 -0400)]
Don't italicize comments in ayu theme

3 years agoAuto merge of #5845 - giraffate:fix_fp_useless_conversion, r=yaahc
bors [Sun, 26 Jul 2020 17:50:54 +0000 (17:50 +0000)]
Auto merge of #5845 - giraffate:fix_fp_useless_conversion, r=yaahc

Fix FP `useless_conversion`

Fix #5833.

changelog: none

3 years agoFix #[track_caller] shims for trait objects.
Adam Perry [Sun, 26 Jul 2020 16:53:24 +0000 (09:53 -0700)]
Fix #[track_caller] shims for trait objects.

We were missing an Instance::resolve_for_fn_ptr in resolve_for_vtable.

Closes #74764.

3 years agopython codes cleanup
jnozsc [Sun, 26 Jul 2020 16:56:12 +0000 (09:56 -0700)]
python codes cleanup

3 years agoBless you
Oliver Scherer [Sun, 26 Jul 2020 15:03:38 +0000 (17:03 +0200)]
Bless you

3 years agoAuto merge of #74772 - JohnTitor:add-tests, r=lcnr
bors [Sun, 26 Jul 2020 14:09:36 +0000 (14:09 +0000)]
Auto merge of #74772 - JohnTitor:add-tests, r=lcnr

Add some regression tests

cc #56445
Fixes #72911

3 years agotypos + fmt
Ralf Jung [Sun, 26 Jul 2020 13:45:09 +0000 (15:45 +0200)]
typos + fmt