introing one-time diagnostics: only emit "lint level defined here" once
This is a revised resubmission of PR #34084 (which was closed due to inactivity on account of time constraints on the author's part).
---
We introduce a new `one_time_diagnostics` field on
`rustc::session::Session` to hold a hashset of diagnostic messages we've
set once but don't want to see again (as uniquified by span and message
text), "lint level defined here" being the motivating example dealt with
here.
This is in the matter of #24690.
---
r? @nikomatsakis
This commit is an implementation of [RFC 1665] which adds support for the
`#![windows_subsystem]` attribute. This attribute allows specifying either the
"windows" or "console" subsystems on Windows to the linker.
[RFC 1665]: https://github.com/rust-lang/rfcs/blob/master/text/1665-windows-subsystem.md
Previously all Rust executables were compiled as the "console" subsystem which
meant that if you wanted a graphical application it would erroneously pop up a
console whenever opened. When compiling an application, however, this is
undesired behavior and the "windows" subsystem is used instead to have control
over user interactions.
This attribute is validated, but ignored on all non-Windows platforms.
cc #37499
Add E0532 error explanation
This resolves one of the error list in https://github.com/rust-lang/rust/issues/35347 - just because I stumbled over it today.
I assumed the error code should be removed from `register_diagnostics!` because it's now defined above.
Since that is my first code contribution, please check that all is in order. It would be helpful to know how to run the test for the `compile_fail,E0532` part. I did `make check-stage1-cfail NO_REBUILD=1` but that doesn't test the inlined example.
r? @GuillaumeGomez
Remove outdated fixme comment.
Linked issue has been closed, but the comment was not removed.
If this is still an issue, then the comment should probably be updated.
r? @petrochenkov
improve docs for Index and IndexMut
This mainly changes the boring example of Foo/Bar of `IndexMut` into a better one.
Also added explanations about syntactic sugar for `v[index]`.
Closes#36329
Replace all uses of SHA-256 with BLAKE2b.
Removes the SHA-256 implementation and replaces all uses of it with BLAKE2b, which we already use for debuginfo type guids and incremental compilation hashes. It doesn't make much sense to have two different cryptographic hash implementations in the compiler and Blake has a few advantages over SHA-2 (computationally less expensive, hashes of up to 512 bits).
Shrink Expr_::ExprInlineAsm.
On 64-bit this reduces the size of `Expr_` from 144 to 64 bytes, and
reduces the size of `Expr` from 176 to 96 bytes.
For the workload in #36799 this reduces the RSS for the "lowering ast -> hir" phase and all subsequent phases by 50 MiB, which reduces the peak RSS for that workload by about 1%. Not huge, but it's a very easy improvement.
r? @eddyb
Move `CrateConfig` from `Crate` to `ParseSess`
This is a syntax-[breaking-change]. Most breakage can be fixed by removing a `CrateConfig` argument.
r? @eddyb
I followed the "Testing" chapter using Rust 1.12.1 but there are some differences. By default the `tests` module is now also generated by `cargo new`, and the console output is updated.
Disable jemalloc on aarch64/powerpc
Sounds like jemalloc is broken on systems which differ in page size than the
host it was compiled on (unless an option was passed). This unfortunately
reduces the portability of binaries created and can often make Rust segfault by
default. For now let's patch over this by disabling jemalloc until we can figure
out a better solution.
Closes#36994Closes#37320
cc jemalloc/jemalloc#467
armv7l is armv7 architecture and CFG_CPUTYPE should be armv7 in order to end up
with armv7-unknown-linux-gnueabihf.mk rather than
arm-unknown-linux-gnueabihf.mk
[2/n] rustc_metadata: move is_extern_item to trans.
*This is part of a series ([prev](https://github.com/rust-lang/rust/pull/37400) | [next](https://github.com/rust-lang/rust/pull/37402)) of patches designed to rework rustc into an out-of-order on-demand pipeline model for both better feature support (e.g. [MIR-based](https://github.com/solson/miri) early constant evaluation) and incremental execution of compiler passes (e.g. type-checking), with beneficial consequences to IDE support as well.
If any motivation is unclear, please ask for additional PR description clarifications or code comments.*
<hr>
Minor cleanup missed by #36551: `is_extern_item` is one of, if not the only `CrateStore` method who takes a `TyCtxt` but doesn't produce something cached in it, and such methods are going away.
[1/n] Move the MIR map into the type context.
*This is part of a series ([prev]() | [next](https://github.com/rust-lang/rust/pull/37401)) of patches designed to rework rustc into an out-of-order on-demand pipeline model for both better feature support (e.g. [MIR-based](https://github.com/solson/miri) early constant evaluation) and incremental execution of compiler passes (e.g. type-checking), with beneficial consequences to IDE support as well.
If any motivation is unclear, please ask for additional PR description clarifications or code comments.*
<hr>
The first commit reorganizes the `rustc::mir` module to contain the MIR types directly without an extraneous `repr` module which serves no practical purpose but is rather an eyesore.
The second commit performs the actual move of the MIR map into the type context, for the purposes of future integration with requesting analysis/lowering by-products through `TyCtxt`.
Local `Mir` bodies need to be mutated by passes (hence `RefCell`), and at least one pass (`qualify_consts`) needs simultaneous access to multiple `Mir` bodies (hence arena-allocation).
`Mir` bodies loaded from other crates appear as if immutably borrowed (by `.borrow()`-ing one `Ref` and subsequently "leaking" it) to avoid, at least dynamically, *any* possibility of their local mutation.
One caveat is that lint passes can now snoop at the MIR (helpful) or even mutate it (dangerous).
However, lints are unstable anyway and we can find a way to deal with this in due time.
Future work will result in a tighter API, potentially hiding mutation *completely* outside of MIR passes.
Print out the error when HeapFree failures do occur
cc https://github.com/rust-lang/rust/issues/37395
I'd prefer to use `assert!` instead of `debug_assert!` if the cost is acceptable.
r? @alexcrichton
Fix various sentence fragments, missing articles, and other grammatical
issues in the documentation for write! and writeln!.
Also fix the links (and link names) for common return types.
rustc_typeck: Allow reification from fn item to unsafe ptr
See https://github.com/rust-lang/rfcs/issues/1762.
I've never contributed to the compiler internals before-- apologies if I'm not going about this the right way.
Do not intern filemap to entry w/ mismatched length.
Do not intern filemap to entry w/ mismatched length.
Fix#37274 (I think).
Beta-nominated; note that only the second commit needs to be cherry picked to beta branch. (The first just adds some debug instrumentation that I wish had been present.)
Support for aarch64 architecture on Fuchsia
This patch adds support for the aarch64-unknown-fuchsia target. Also
updates src/liblibc submodule to include required libc change.