Commit graph

139701 commits

Author SHA1 Message Date
Dylan DPC
4a4e3e667d
Rollup merge of #82415 - petrochenkov:modin3, r=davidtwco
expand: Refactor module loading

This is an accompanying PR to https://github.com/rust-lang/rust/pull/82399, but they can be landed independently.
See individual commits for more details.

Anyone should be able to review this equally well because all people actually familiar with this code left the project.
2021-03-08 13:13:19 +01:00
Dylan DPC
da74a77622
Rollup merge of #82047 - the8472:fast-rename, r=davidtwco
bypass auto_da_alloc for metadata files

This saves about 0.7% when rerunning the UI test suite. I.e. when the metadata files exist and will be overwritten. No improvements expected for a clean build. So it might show up in incr-patched perf results.
```
regular rename:

Benchmark #1: touch src/tools/compiletest/src/main.rs ; RUSTC_WRAPPER="" schedtool -B -e ./x.py test src/test/ui
  Time (mean ± σ):     47.305 s ±  0.170 s    [User: 1631.540 s, System: 412.648 s]
  Range (min … max):   47.125 s … 47.856 s    20 runs

non-durable rename:

Benchmark #1: touch src/tools/compiletest/src/main.rs ; RUSTC_WRAPPER="" schedtool -B -e ./x.py test src/test/ui
  Time (mean ± σ):     46.930 s ±  0.064 s    [User: 1634.344 s, System: 396.038 s]
  Range (min … max):   46.759 s … 47.043 s    20 runs
```

There are more places that trigger auto_da_alloc behavior by overwriting existing files with O_TRUNC, but those are much harder to locate because `O_TRUNC` is set on `open()` but the writeback is triggered on `close()`. The latter is the part which shows up in profiles.
2021-03-08 13:13:18 +01:00
bors
1d6b0f626a Auto merge of #82783 - nikic:llvm-ct-backports, r=nagisa
Backport some LLVM compile-time improvements

Pick up two LLVM patches that reduce number of alias analysis queries, to see whether that gives any visible improvement.

r? `@ghost`
2021-03-08 11:39:32 +00:00
bors
27885a94c6 Auto merge of #82727 - oli-obk:shrinkmem, r=pnkfelix
Test the effect of shrinking the size of Rvalue by 16 bytes

r? `@ghost`
2021-03-08 08:39:24 +00:00
Arnav Jindal
2aa28ad4f0
Grammar Fixes 2021-03-08 11:49:26 +05:30
Michael Howell
69a37a63fa Add documentation for string->Cow conversions
Mostly, it's just to reassure everyone that these functions don't allocate.

Part of #51430
2021-03-07 20:36:43 -07:00
bors
76c500ec6c Auto merge of #81635 - michaelwoerister:structured_def_path_hash, r=pnkfelix
Let a portion of DefPathHash uniquely identify the DefPath's crate.

This allows to directly map from a `DefPathHash` to the crate it originates from, without constructing side tables to do that mapping -- something that is useful for incremental compilation where we deal with `DefPathHash` instead of `DefId` a lot.

It also allows to reliably and cheaply check for `DefPathHash` collisions which allows the compiler to gracefully abort compilation instead of running into a subsequent ICE at some random place in the code.

The following new piece of documentation describes the most interesting aspects of the changes:

```rust
/// A `DefPathHash` is a fixed-size representation of a `DefPath` that is
/// stable across crate and compilation session boundaries. It consists of two
/// separate 64-bit hashes. The first uniquely identifies the crate this
/// `DefPathHash` originates from (see [StableCrateId]), and the second
/// uniquely identifies the corresponding `DefPath` within that crate. Together
/// they form a unique identifier within an entire crate graph.
///
/// There is a very small chance of hash collisions, which would mean that two
/// different `DefPath`s map to the same `DefPathHash`. Proceeding compilation
/// with such a hash collision would very probably lead to an ICE and, in the
/// worst case, to a silent mis-compilation. The compiler therefore actively
/// and exhaustively checks for such hash collisions and aborts compilation if
/// it finds one.
///
/// `DefPathHash` uses 64-bit hashes for both the crate-id part and the
/// crate-internal part, even though it is likely that there are many more
/// `LocalDefId`s in a single crate than there are individual crates in a crate
/// graph. Since we use the same number of bits in both cases, the collision
/// probability for the crate-local part will be quite a bit higher (though
/// still very small).
///
/// This imbalance is not by accident: A hash collision in the
/// crate-local part of a `DefPathHash` will be detected and reported while
/// compiling the crate in question. Such a collision does not depend on
/// outside factors and can be easily fixed by the crate maintainer (e.g. by
/// renaming the item in question or by bumping the crate version in a harmless
/// way).
///
/// A collision between crate-id hashes on the other hand is harder to fix
/// because it depends on the set of crates in the entire crate graph of a
/// compilation session. Again, using the same crate with a different version
/// number would fix the issue with a high probability -- but that might be
/// easier said then done if the crates in questions are dependencies of
/// third-party crates.
///
/// That being said, given a high quality hash function, the collision
/// probabilities in question are very small. For example, for a big crate like
/// `rustc_middle` (with ~50000 `LocalDefId`s as of the time of writing) there
/// is a probability of roughly 1 in 14,750,000,000 of a crate-internal
/// collision occurring. For a big crate graph with 1000 crates in it, there is
/// a probability of 1 in 36,890,000,000,000 of a `StableCrateId` collision.
```

Given the probabilities involved I hope that no one will ever actually see the error messages. Nonetheless, I'd be glad about some feedback on how to improve them. Should we create a GH issue describing the problem and possible solutions to point to? Or a page in the rustc book?

r? `@pnkfelix` (feel free to re-assign)
2021-03-07 23:45:57 +00:00
Aaron Hill
2550d5b15c
Update Cargo
Output of `git log --oneline  c68432f1e..970bc67c3`:

970bc67c3 (HEAD, origin/master, origin/auto-cargo, origin/HEAD) Auto merge of #9243 - wickerwaka:configurable-env-doc, r=ehuss
4d7a29b75 Document the configurable-env usntable option
f7a7a3f91 Auto merge of #9229 - alexcrichton:fix-borrow-mut, r=ehuss
3f2ece7a9 Fix a `BorrowMut` error when stdout is closed
7441e8c23 Auto merge of #8825 - Aaron1011:feature/report-future-incompat, r=ehuss
139ed73f5 Add future-incompat tracking issue number.
9ea350368 Fix some minor formatting issues.
f03d47ce4 Address review comments
6177c6584 Implement future incompatibility report support
c69409658 Auto merge of #9022 - nagisa:nagisa/manifest_path, r=alexcrichton
548300b20 Add the path to the manifest in json output
99e714c05 Auto merge of #9230 - kornelski:nobinaries, r=alexcrichton
61a31bc5f Auto merge of #9236 - kornelski:track-assert, r=Eh2406
3f7f0942c track_caller on custom assert functions
6977dee10 Explain `cargo install` is not for libraries
e4aebf0a0 Auto merge of #9231 - joshtriplett:clear-to-eol-if-color, r=alexcrichton
b219f0eb7 Auto merge of #9181 - jyn514:computer-says-no, r=ehuss
0b1816578 Remove unhelpful link to Cargo book
ea46f5ce3 Use ANSI clear-to-EOL if color is force-enabled
a6394bcc1 Remove unnecessary `config` argument to `Features::add`
3a86ecf2d Fix TODO about nightly features
09677c83c Be less unix-centric in error messages
ecfdced0d Fix test that assumed tests always were run on the stable channel
eba541994 Update comment in build_script_env
a5720117f Make `nightly_features_allowed` a field instead of a function
169b09ce7 Compute `enable_nightly_features` once instead of on each call
8fc86e155 Remove unused thread_locals
4b096beae Fix `masquerade_as_nightly_cargo` in work threads
e56417c8c Suggest RUSTC_BOOTSTRAP=crate instead of RUSTC_BOOTSTRAP=1
418129dae Downgrade error to a warning when `RUSTC_BOOTSTRAP` is set or this is the nightly channel
6c422a2c0 Restrict RUSTC_BOOTSTRAP in build.rs
2021-03-07 18:45:08 -05:00
Manish Goregaokar
0eeae1abfc diagnostics: Don't mention external crates when hitting import errors on crate imports in 2018 2021-03-07 15:15:19 -08:00
Esteban Küber
aa7ac6e957 Remove notes, increase S/N ratio 2021-03-07 15:03:46 -08:00
Erik Desjardins
938637033c add codegen tests for some issues closed by LLVM 12 2021-03-07 17:56:09 -05:00
Esteban Küber
63fb294a74 Add help for matches for if let in arm guard 2021-03-07 14:44:21 -08:00
Manish Goregaokar
9d5d669b77 diagnostics: Differentiate between edition meanings of ::foo in resolve diagnostics for ::foo::Bar 2021-03-07 14:24:47 -08:00
Manish Goregaokar
ac7f9ccb6f diagnostics: Differentiate between edition meanings of ::foo in resolve diagnostics (for bare ::foo) 2021-03-07 14:21:48 -08:00
Esteban Küber
23bcea4249 Add help suggesting matches to let_chains lint 2021-03-07 14:17:10 -08:00
Esteban Küber
e62a543344 Account for if (let pat = expr) {}
Partially address #82827.
2021-03-07 13:49:36 -08:00
bors
234781afe3 Auto merge of #82285 - nhwn:nonzero-debug, r=nagisa
Use u32 over Option<u32> in DebugLoc

~~Changes `Option<u32>` fields in `DebugLoc` to `Option<NonZeroU32>`. Since the respective fields (`line` and `col`) are guaranteed to be 1-based, this layout optimization is a freebie.~~

EDIT: Changes `Option<u32>` fields in `DebugLoc` to `u32`. As `@bugadani` pointed out, an `Option<NonZeroU32>` is probably an unnecessary layer of abstraction since the `None` variant is always used as `UNKNOWN_LINE_NUMBER` (which is just `0`).  Also, `SourceInfo` in `metadata.rs` already uses a `u32` instead of an `Option<u32>` to encode the same information, so I think this change is warranted.

Since `@jyn514` raised some concerns over measuring performance in a similar PR (#82255), does this need a perf run?
2021-03-07 20:23:23 +00:00
Julian Frimmel
c40ef91f76 Add note about the #[doc(no-inline)] usage
This is required to correctly build the documentation (including all
submodules, that are only available in certain targets).
2021-03-07 21:08:07 +01:00
Eric Huss
acdca316c3 Revert "use RWlock when accessing os::env #81850"
This reverts commit 354f19cf24, reversing
changes made to 0cfba2fd09.
2021-03-07 11:32:42 -08:00
Joel Höner
ab8995bbca Generalize Write impl for Vec<u8> to Vec<u8, A>
As discussed in the issue tracker for the wg-allocators working group[1], updating this implementation for allocator support was most likely just forgotten in the original PR.

[1]: https://github.com/rust-lang/wg-allocators/issues/86
2021-03-07 16:22:53 +01:00
pierwill
6b2eb0e6c6 Edit ructc_ast_lowering docs
Fixes some punctuation and formatting; also makes some small wording changes.
2021-03-06 22:07:38 -08:00
bors
66ec64ccf3 Auto merge of #82851 - JohnTitor:rollup-me5ko8g, r=JohnTitor
Rollup of 13 pull requests

Successful merges:

 - #77916 (Change built-in kernel targets to be os = none throughout)
 - #82130 (Make some Option, Result methods unstably const)
 - #82292 (Prevent specialized ZipImpl from calling `__iterator_get_unchecked` twice with the same index)
 - #82402 (Remove RefCell around `module_trait_cache`)
 - #82592 (Improve transmute docs with further clarifications)
 - #82651 (Cleanup rustdoc warnings)
 - #82720 (Fix diagnostic suggests adding type `[type error]`)
 - #82751 (improve offset_from docs)
 - #82793 (Move some tests to more suitable subdirs)
 - #82803 (rustdoc: Add an unstable option to print all unversioned files)
 - #82808 (Sync rustc_codegen_cranelift)
 - #82822 (Fix typo)
 - #82837 (tweak MaybeUninit docs)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-03-07 02:36:07 +00:00
Yuki Okushi
6220e00ea9
Rollup merge of #82837 - RalfJung:maybe-uninit, r=dtolnay
tweak MaybeUninit docs

Explain what "(no) fixed value" means.
2021-03-07 10:41:22 +09:00
Yuki Okushi
74ae20e2c6
Rollup merge of #82822 - henryboisdequin:fix-typo-rustc, r=oli-obk
Fix typo

we need to actually -> we actually need to

````@rustbot```` label +C-cleanup
2021-03-07 10:41:20 +09:00
Yuki Okushi
b6191d7c66
Rollup merge of #82808 - bjorn3:sync_cg_clif-2021-03-05, r=bjorn3
Sync rustc_codegen_cranelift

The main highlight of this sync is removal of support for the old x86 Cranelift backend. This made it possible to use native atomic instructions rather than hackishly using a global mutex. 128bit integer support has also seen a few bugfixes and performance improvements. And finally I have formatted everything using the same rustfmt config as the rest of this repo.

r? ````@ghost````

````@rustbot```` label +A-codegen +A-cranelift +T-compiler
2021-03-07 10:41:19 +09:00
Yuki Okushi
379679b913
Rollup merge of #82803 - jyn514:unversioned-files, r=GuillaumeGomez
rustdoc: Add an unstable option to print all unversioned files

This allows sharing those files between different doc invocations
without having to know their names ahead of time.

Helps with https://github.com/rust-lang/docs.rs/issues/1302.
r? ````@GuillaumeGomez```` cc ````@pietroalbini```` ````@Nemo157````
2021-03-07 10:41:18 +09:00
Yuki Okushi
a0dcfdfb76
Rollup merge of #82793 - JohnTitor:move-ui-tests, r=petrochenkov
Move some tests to more suitable subdirs

## The results from classifui

(The full results can be found here: https://gist.github.com/JohnTitor/c9e00840990b5e4a8fc562ec3571e427)

- [lint-expr-stmt-attrs-for-early-lints.rs](https://github.com/rust-lang/rust/blob/master/src/test/ui/lint-expr-stmt-attrs-for-early-lints.rs) <sup>unknown</sup>: lint (1.566), feature-gates (-0.632), numbers-arithmetic (-0.955)
- [try-block.rs](https://github.com/rust-lang/rust/blob/master/src/test/ui/try-block.rs) <sup>unknown</sup>: binding (1.385), try-block (-0.097), lint (-0.932)
- [backtrace-debuginfo.rs](https://github.com/rust-lang/rust/blob/master/src/test/ui/backtrace-debuginfo.rs) <sup>unknown</sup>: macros (1.365), cfg (-0.279), drop (-0.291)
- [issues/issue-3521.rs](https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-3521.rs) <sup>[issue](https://github.com/rust-lang/rust/issues/3521)</sup>: consts (1.298), enum (-0.872), in-band-lifetimes (-0.978)
- [impl-bounds-checking.rs](https://github.com/rust-lang/rust/blob/master/src/test/ui/impl-bounds-checking.rs) <sup>unknown</sup>: traits (1.243), for (-0.999), shadowed (-0.999)
- [issues/issue-17718.rs](https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-17718.rs) <sup>[issue](https://github.com/rust-lang/rust/issues/17718)</sup>: binding (1.236), consts (0.315), extern (-0.779)
- [issue-6157.rs](https://github.com/rust-lang/rust/blob/master/src/test/ui/issue-6157.rs) <sup>[issue](https://github.com/rust-lang/rust/issues/6157)</sup>: regions (1.213), unboxed-closures (-0.285), traits (-0.510)
- [issues/issue-44373.rs](https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-44373.rs) <sup>[issue](https://github.com/rust-lang/rust/issues/44373)</sup>: consts (1.187), nll (0.427), borrowck (-0.704)
- [nullable-pointer-ffi-compat.rs](https://github.com/rust-lang/rust/blob/master/src/test/ui/nullable-pointer-ffi-compat.rs) <sup>unknown</sup>: regions (1.184), consts (0.650), traits (-0.571)
- [issues/issue-52992.rs](https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-52992.rs) <sup>[issue](https://github.com/rust-lang/rust/issues/52992)</sup>: nll (1.132), associated-types (-0.628), parser (-0.893)
- [issues/issue-2330.rs](https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-2330.rs) <sup>[issue](https://github.com/rust-lang/rust/issues/2330)</sup>: traits (1.116), directory_ownership (-0.691), compare-method (-0.981)
- [issue-74047.rs](https://github.com/rust-lang/rust/blob/master/src/test/ui/issue-74047.rs) <sup>[issue](https://github.com/rust-lang/rust/issues/74047)</sup>: async-await (1.109), impl-trait (-0.629), resolve (-0.781)
- [issues/issue-33140.rs](https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-33140.rs) <sup>[issue](https://github.com/rust-lang/rust/issues/33140)</sup>: traits (1.063), coherence (-0.832), codemap_tests (-0.944)
- [issues/issue-28576.rs](https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-28576.rs) <sup>[issue](https://github.com/rust-lang/rust/issues/28576)</sup>: traits (1.062), associated-types (-0.333), impl-trait (-0.697)
- [issues/issue-7222.rs](https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-7222.rs) <sup>[issue](https://github.com/rust-lang/rust/issues/7222)</sup>: binding (1.062), consts (-0.226), numbers-arithmetic (-0.294)
- [tup.rs](https://github.com/rust-lang/rust/blob/master/src/test/ui/tup.rs) <sup>unknown</sup>: structs-enums (1.061), threads-sendsync (-0.550), moves (-0.790)
- [issues/issue-15261.rs](https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-15261.rs) <sup>[issue](https://github.com/rust-lang/rust/issues/15261)</sup>: consts (1.052), where-clauses (-0.833), macros (-0.862)
- [issues/issue-76179.rs](https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-76179.rs) <sup>[issue](https://github.com/rust-lang/rust/issues/76179)</sup>: associated-types (1.048), process (-0.887), rfc-2457 (-0.984)
- [issues/issue-42344.rs](https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-42344.rs) <sup>[issue](https://github.com/rust-lang/rust/issues/42344)</sup>: borrowck (1.043), macros (-0.481), specialization (-0.966)
- [issues/issue-18661.rs](https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-18661.rs) <sup>[issue](https://github.com/rust-lang/rust/issues/18661)</sup>: unboxed-closures (1.038), mir (-0.648), higher-rank-trait-bounds (-0.688)
- [issues/issue-2633.rs](https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-2633.rs) <sup>[issue](https://github.com/rust-lang/rust/issues/2633)</sup>: structs-enums (1.020), functions-closures (-0.722), lint (-0.967)

Some notes:
- If there are related tests (e.g. it's for the same issue), they are moved along with it.
- Moved try-block.rs to the `try-block` dir.
- Moved tup.rs to the `tuple` dir.
- Moved some tests that classified as consts to the `statics` dir, as it seems they have statics actually.
- Skipped backtrace-debuginfo.rs because I think classifui overrates their helper macros.

cc #73494
r? ```@petrochenkov```
2021-03-07 10:41:17 +09:00
Yuki Okushi
05a2366e82
Rollup merge of #82751 - RalfJung:offset_from, r=dtolnay
improve offset_from docs

`@thomcc` pointed out that the current docs leave it kind of unclear how one can satisfy the "no wrapping around `isize` or the address space" requirement of `offset_from`, so make the docs clearer about that.

FWIW, I don't think I entirely agree with that second paragraph about large objects (that I left mostly unchanged here). LLVM, to my knowledge, fundamentally assumes that all allocations fit into an `isize::MAX`. So in that sense creating a larger allocation is simply UB. I would expect a guarantee that Rust heap allocation methods will never return allocations larger than `isize::MAX` (or rather, Rust heap allocation methods should require that the `Layout` is no larger than `isize::MAX`). However, I cannot find any such requirement documented currently. Large allocations are not mentioned at all in the allocator docs, which is quite surprising -- even if we say that such allocations are not insta-UB (which I think is incompatible with LLVM), they are still extremely footgunny since `ptr::offset`/`ptr::add` do not support offsetting by more than `isize::MAX` bytes.

Furthermore, the allocator docs don't even say anything about allocations wrapping around the address space. But that is certainly something allocators must ensure never happens; we cannot expect clients to defend against this.

Cc `@rust-lang/wg-allocators`
2021-03-07 10:41:16 +09:00
Yuki Okushi
a5a825e6a3
Rollup merge of #82720 - henryboisdequin:fix-79040, r=oli-obk
Fix diagnostic suggests adding type `[type error]`

Fixes #79040

### Unresolved questions:

<del>Why does this change output the diagnostic twice (`src/test/ui/79040.rs`)?</del> Thanks `````@oli-obk`````
2021-03-07 10:41:15 +09:00
Yuki Okushi
f3218dfa57
Rollup merge of #82651 - jyn514:rustdoc-warnings, r=GuillaumeGomez
Cleanup rustdoc warnings

## Clean up error reporting for deprecated passes

Using `error!` here goes all the way back to the original commit, https://github.com/rust-lang/rust/pull/8540. I don't see any reason to use logging; rustdoc should use diagnostics wherever possible. See https://github.com/rust-lang/rust/pull/81932#issuecomment-785291244 for further context.

- Use spans for deprecated attributes
- Use a proper diagnostic for unknown passes, instead of error logging
- Add tests for unknown passes
- Improve some wording in diagnostics

##  Report that `doc(plugins)` doesn't work using diagnostics instead of `eprintln!`

This also adds a test for the output.

This was added in https://github.com/rust-lang/rust/pull/52194. I don't see any particular reason not to use diagnostics here, I think it was just missed in https://github.com/rust-lang/rust/pull/50541.
2021-03-07 10:41:13 +09:00
Yuki Okushi
817e58f38d
Rollup merge of #82592 - Lonami:patch-1, r=RalfJung
Improve transmute docs with further clarifications

Closes #82493.

Please let me know if any of the new wording sounds off, English is not my mother tongue.
2021-03-07 10:41:12 +09:00
Yuki Okushi
3d762a7f36
Rollup merge of #82402 - jyn514:module-cache-refcell, r=GuillaumeGomez
Remove RefCell around `module_trait_cache`

This builds on https://github.com/rust-lang/rust/pull/82018 and should not be merged before.

## Don't require a `DocContext` for `report_diagnostic`

This is needed for the next commit, which needs mutable access to the `cx` from
within the `decorate` closure.

- Change `as_local_hir_id` to an associated function, since it only
  needs a `TyCtxt`
- Change `source_span_for_markdown_range` to only take a `TyCtxt`

##  Remove RefCell around module_trait_cache

This is mostly just changing lots of functions from `&DocContext` to `&mut DocContext`.
2021-03-07 10:41:11 +09:00
Yuki Okushi
1d5b2dc945
Rollup merge of #82292 - SkiFire13:fix-issue-82291, r=m-ou-se
Prevent specialized ZipImpl from calling `__iterator_get_unchecked` twice with the same index

Fixes #82291

It's open for review, but conflicts with #82289, wait before merging. The conflict involves only the new test, so it should be rather trivial to fix.
2021-03-07 10:41:10 +09:00
Yuki Okushi
0adc196521
Rollup merge of #82130 - jhpratt:const-option-result, r=RalfJung
Make some Option, Result methods unstably const

The following methods are now unstably const:

- Option::transpose
- Option::flatten
- Result::flatten

While some methods for could likely be made `const` in the future, nearly all of them require something to be dropped at compile-time, which isn't currently supported. The functions listed above should have a trivial path to stabilization.
2021-03-07 10:41:09 +09:00
Yuki Okushi
d1dc16623f
Rollup merge of #77916 - QuiltOS:kernel-code-targets-os-none, r=joshtriplett
Change built-in kernel targets to be os = none throughout

Whether for Rust's own `target_os`, LLVM's triples, or GNU config's, the
OS-related have fields have been for code running *on* that OS, not code
hat is *part* of the OS.

The difference is huge, as syscall interfaces are nothing like
freestanding interfaces. Kernels are (hypervisors and other more exotic
situations aside) freestanding programs that use the interfaces provided
by the hardware. It's *those* interfaces, the ones external to the
program being built and its software dependencies, that are the content
of the target.

For the Linux Kernel in particular, `target_env: "gnu"` is removed for
the same reason: that `-gnu` refers to glibc or GNU/linux, neither of
which applies to the kernel itself.

Relates to #74247
2021-03-07 10:41:04 +09:00
Vadim Petrochenkov
5d27728141 rustc_builtin_macros: Share some more logic between derive and cfg_eval 2021-03-07 01:12:18 +03:00
Vadim Petrochenkov
10ed08f5b6 cfg_eval: Configure everything through mutable visitor methods
This is simpler and mirrors what invocation collector does
2021-03-07 00:23:02 +03:00
Vadim Petrochenkov
f9019b7086 Move full configuration logic from rustc_expand to rustc_builtin_macros
This logic is applicable to two specific macros and not to the expansion infrastructure in general.
2021-03-07 00:17:31 +03:00
bors
dfe519b344 Auto merge of #82738 - estebank:tail-expr-check-is-too-slow, r=oli-obk
Move check only relevant in error case out of critical path

Move the check for potentially forgotten `return` in a tail expression
of arbitrary expressions into the coercion error branch to avoid
computing unncessary coercion checks on successful code.

Follow up to #81458.
2021-03-06 21:02:53 +00:00
Rune Tynan
18841ec342
Revert fmt version, add rustdoc-json-types to bootstrap tests 2021-03-06 15:50:30 -05:00
Rune Tynan
70c9b370e8
x.py fmt 2021-03-06 15:50:29 -05:00
Rune Tynan
83cece468e
Move tests to own file 2021-03-06 15:50:29 -05:00
Rune Tynan
ca48d1566e
Add roundtrip testing and bump format version 2021-03-06 15:50:28 -05:00
Rune Tynan
cf5246915b
Remove Item::kind, use tagged enum. Rename variants to match 2021-03-06 15:50:20 -05:00
Vadim Petrochenkov
5dad6c2575 Implement built-in attribute macro #[cfg_eval] 2021-03-06 23:03:19 +03:00
Jacob Pratt
79c2b75e88
Make some Option, Result methods unstably const
The following functions are now unstably const:

- Option::transpose
- Option::flatten
- Result::transpose
2021-03-06 14:17:49 -05:00
Vadim Petrochenkov
069e612e73 rustc_ast: Replace AstLike::finalize_tokens with a getter tokens_mut 2021-03-06 21:19:31 +03:00
Harald van Dijk
95e096d623
Change x64 size checks to not apply to x32.
Rust contains various size checks conditional on target_arch = "x86_64",
but these checks were never intended to apply to
x86_64-unknown-linux-gnux32. Add target_pointer_width = "64" to the
conditions.
2021-03-06 16:02:48 +00:00
Ralf Jung
b75154897b tweak MaybeUninit docs 2021-03-06 16:59:39 +01:00
Lonami
fbc17410b2 Improve transmute docs with further clarifications
Closes #82493.
2021-03-06 16:01:01 +01:00