Add lots of date-check annotations

Also added dates for things that previously said "as of now" or "as of
this writing" and cleaned up a couple of things along the way.
This commit is contained in:
Camelid 2021-01-20 16:42:10 -08:00 committed by Joshua Nelson
parent 5118b6b865
commit 5e57035110
24 changed files with 118 additions and 112 deletions

View File

@ -2,8 +2,9 @@
<!-- toc -->
As of January 2021, `rustc_codegen_ssa` provides an abstract interface for all backends to
implement, to allow other codegen backends (e.g. [Cranelift]).
As of January 2021 <!-- date: 2021-01 -->, `rustc_codegen_ssa` provides an
abstract interface for all backends to implement, to allow other codegen
backends (e.g. [Cranelift]).
[Cranelift]: https://github.com/bytecodealliance/wasmtime/tree/HEAD/cranelift

View File

@ -93,15 +93,13 @@ member constraints come in.
## Choices are always lifetime parameters
At present, the "choice" regions from a member constraint are always
lifetime parameters from the current function. As of January 2021,
this falls out from the placement of impl Trait, though in the future
it may not be the case.
We take some advantage of this fact, as it simplifies the current
code. In particular, we don't have to consider a case like `'0 member
of ['1, 'static]`, in which the value of both `'0` and `'1` are being
inferred and hence changing. See [rust-lang/rust#61773][#61773] for more
information.
At present, the "choice" regions from a member constraint are always lifetime
parameters from the current function. As of January 2021 <!-- date: 2021-01 -->,
this falls out from the placement of impl Trait, though in the future it may not
be the case. We take some advantage of this fact, as it simplifies the current
code. In particular, we don't have to consider a case like `'0 member of ['1,
'static]`, in which the value of both `'0` and `'1` are being inferred and hence
changing. See [rust-lang/rust#61773][#61773] for more information.
[#61773]: https://github.com/rust-lang/rust/issues/61773

View File

@ -7,8 +7,9 @@
> top-level directory has separate directories for the compiler, build-system,
> std libs, etc, rather than one huge `src/` directory.
>
> As of January 2021, the std libs have been moved to `library/` and the crates
> that make up the `rustc` compiler itself have been moved to `compiler/`
> As of January 2021 <!-- date: 2021-01 -->, the standard libraries have been
> moved to `library/` and the crates that make up the `rustc` compiler itself
> have been moved to `compiler/`.
Now that we have [seen what the compiler does](./overview.md), let's take a
look at the structure of the contents of the rust-lang/rust repo.
@ -20,9 +21,9 @@ containing the compiler, the standard libraries (`core`, `alloc`, `std`,
`proc_macro`, etc), and `rustdoc`, along with the build system and a bunch of
tools and submodules for building a full Rust distribution.
As of this writing, this structure is gradually undergoing some transformation
to make it a bit less monolithic and more approachable, especially to
newcomers.
As of August 2020 <!-- date: 2020-08 -->, this structure is gradually undergoing
some transformation to make it a bit less monolithic and more approachable,
especially to newcomers.
The repository consists of three main directories:

View File

@ -410,9 +410,13 @@ Just a few things to keep in mind:
Aim to provide a reasonable amount of context, possibly including but not limited to:
- A reason for why the data may be out of date other than "change", as change is a constant across
the project.
- A date the comment was added, e.g. instead of writing _"Currently, ..."_ consider writing
- The date the comment was added, e.g. instead of writing _"Currently, ..."_
or _"As of now, ..."_, consider writing
_"As of January 2021, ..."_.
Try to format the date as `<MONTH> <YEAR>` to ease search.
- Additionally, include a machine-readable comment of the form `<!-- date:
2021-01 -->` (if the current month is January 2021). We have an automated
tool that uses these (in `ci/date-check`).
- A link to a relevant WG, tracking issue, `rustc` rustdoc page, or similar, that may provide
further explanation for the change process or a way to verify that the information is not
outdated.

View File

@ -594,9 +594,9 @@ declare_lint! {
}
```
If you need a combination of options that's not supported by the
`declare_lint!` macro, you can always define your own static with a type of
`&Lint` but this is (as of January 2021) linted against in the compiler tree.
If you need a combination of options that's not supported by the `declare_lint!`
macro, you can always define your own static with a type of `&Lint` but this is
(as of January 2021 <!-- date: 2021-01 -->) linted against in the compiler tree.
<a id="future-incompatible"></a>
#### Guidelines for creating a future incompatibility lint

View File

@ -17,9 +17,10 @@ First, we have the lint declarations themselves: this is where the name and defa
other metadata come from. These are normally defined by way of the [`declare_lint!`] macro, which
boils down to a static with type `&rustc_session::lint::Lint`.
As of January 2021, we lint against direct declarations without the use of the macro today
(although this may change in the future, as the macro is somewhat unwieldy to add new fields to,
like all macros by example).
As of January 2021 <!-- date: 2021-01 -->, we lint against direct declarations
without the use of the macro today (although this may change in the future, as
the macro is somewhat unwieldy to add new fields to, like all macros by
example).
Lint declarations don't carry any "state" - they are merely global identifers and descriptions of
lints. We assert at runtime that they are not registered twice (by lint name).

View File

@ -144,12 +144,12 @@ Changes not staged for commit:
no changes added to commit (use "git add" and/or "git commit -a")
```
These changes are not changes to files: they are changes to submodules
(more on this [later](#git-submodules)). To get rid of those, run `git submodule update` (or run any
`x.py` command, which will automatically update the submodules).
Note that there is (as of January 2021) a bug if you use worktrees, submodules, and x.py in a commit
hook.
If you run into an error like:
These changes are not changes to files: they are changes to submodules (more on
this [later](#git-submodules)). To get rid of those, run `git submodule update`
(or run any `x.py` command, which will automatically update the submodules).
Note that there is (as of January 2021 <!-- date: 2021-01 -->) a bug if you use
worktrees, submodules, and x.py in a commit hook. If you run into an error
like:
```
error: failed to read `/home/joshua/rustc-worktree/src/tools/miri/cargo-miri/Cargo.toml`

View File

@ -221,16 +221,15 @@ properly-configured variables in LLVM IR, according to very specific
details of the [_LLVM Coverage Mapping Format_][coverage-mapping-format]
(Version 4).[^llvm-and-covmap-versions]
[^llvm-and-covmap-versions]: The Rust compiler (as of January 2021) supports
_LLVM Coverage Mapping Format_ Version 4 (the most up-to-date version
of the format, at the time of this writing) for improved compatibility
with other LLVM-based compilers (like _Clang_), and to take advantage
of some format optimizations. Version 4 was introduced in _LLVM 11_,
which is currently the default LLVM version for Rust. Note that the
Rust compiler optionally supports some earlier LLVM versions,
prior to _LLVM 11_. If `rustc` is configured to use an incompatible
version of LLVM, compiling with `-Z instrument-coverage` will
generate an error message.
[^llvm-and-covmap-versions]: The Rust compiler (as of January 2021 <!-- date:
2021-01 -->) supports _LLVM Coverage Mapping Format_ Version 4 (the most
up-to-date version of the format, at the time of this writing) for improved
compatibility with other LLVM-based compilers (like _Clang_), and to take
advantage of some format optimizations. Version 4 was introduced in _LLVM 11_,
which is currently the default LLVM version for Rust. Note that the Rust
compiler optionally supports some earlier LLVM versions, prior to _LLVM 11_. If
`rustc` is configured to use an incompatible version of LLVM, compiling with `-Z
instrument-coverage` will generate an error message.
```rust
pub fn finalize<'ll, 'tcx>(cx: &CodegenCx<'ll, 'tcx>) {

View File

@ -193,12 +193,13 @@ concrete integer.
However, a variable of pointer or reference *type*, such as `*const T` or `&T`,
does not have to have a pointer *value*: it could be obtaining by casting or
transmuting an integer to a pointer (as of January 2021 that is hard to do in const eval,
but eventually `transmute` will be stable as a `const fn`). And similarly, when
casting or transmuting a reference to some actual allocation to an integer, we
end up with a pointer *value* (`Scalar::Ptr`) at integer *type* (`usize`). This
is a problem because we cannot meaningfully perform integer operations such as
division on pointer values.
transmuting an integer to a pointer (as of January 2021 <!-- date: 2021-01 -->
that is hard to do in const eval, but eventually `transmute` will be stable as a
`const fn`). And similarly, when casting or transmuting a reference to some
actual allocation to an integer, we end up with a pointer *value*
(`Scalar::Ptr`) at integer *type* (`usize`). This is a problem because we
cannot meaningfully perform integer operations such as division on pointer
values.
## Interpretation

View File

@ -14,8 +14,9 @@ This declares an opaque type named `Foo`, of which the only information is that
it implements `Bar`. Therefore, any of `Bar`'s interface can be used on a `Foo`,
but nothing else (regardless of whether it implements any other traits).
Since there needs to be a concrete background type, you can (as of January 2021)
express that type by using the opaque type in a "defining use site".
Since there needs to be a concrete background type, you can (as of January 2021
<!-- date: 2021-01 -->) express that type by using the opaque type in a
"defining use site".
```rust,ignore
struct Struct;

View File

@ -247,12 +247,12 @@ to remain to ensure that unreachable functions still have their errors emitted.
[passes]: https://github.com/rust-lang/rust/blob/45ebd5808afd3df7ba842797c0fcd4447ddf30fb/src/librustc_interface/passes.rs#L824
Moreover, the compiler wasn't originally built to use a query system; the query
system has been retrofitted into the compiler, so parts of it are not
query-fied yet. Also, LLVM isn't our code, so that isn't querified
either. The plan is to eventually query-fy all of the steps listed in the
previous section, but as of this writing, only the steps between HIR and
LLVM-IR are query-fied. That is, lexing and parsing are done all at once for
the whole program.
system has been retrofitted into the compiler, so parts of it are not query-fied
yet. Also, LLVM isn't our code, so that isn't querified either. The plan is to
eventually query-fy all of the steps listed in the previous section, but as of
April 2020 <!-- date: 2020-04 -->, only the steps between HIR and LLVM-IR are
query-fied. That is, lexing and parsing are done all at once for the whole
program.
One other thing to mention here is the all-important "typing context",
[`TyCtxt`], which is a giant struct that is at the center of all things.

View File

@ -3,8 +3,9 @@
Most of the compiler is not parallel. This represents an opportunity for
improving compiler performance.
As of January 2021, work on explicitly parallelizing the compiler has stalled.
There is a lot of design and correctness work that needs to be done.
As of January 2021 <!-- date: 2021-01 -->, work on explicitly parallelizing the
compiler has stalled. There is a lot of design and correctness work that needs
to be done.
One can try out the current parallel compiler work by enabling it in the
`config.toml`.
@ -21,9 +22,9 @@ There are a few basic ideas in this effort:
[`rayon`]: https://crates.io/crates/rayon
As of this writing, much of this effort is on hold due to lack of manpower. We
have a working prototype with promising performance gains in many cases.
However, there are two blockers:
As of May 2020 <!-- date: 2020-05 -->, much of this effort is on hold due to
lack of manpower. We have a working prototype with promising performance gains
in many cases. However, there are two blockers:
- It's not clear what invariants need to be upheld that might not hold in the
face of concurrency. An auditing effort was underway, but seems to have

View File

@ -88,7 +88,7 @@ codegen-units = 0 # num_cpus
The llvm-lines output is affected by several options.
`optimize = false` increases it from 2.1GB to 3.5GB and `codegen-units = 0` to 4.1GB.
MIR optimizations have little impact. Compared to the default `RUSTFLAGS="-Z mir-opt-level=1"`,
level 0 adds 0.3GB and level 2 removes 0.2GB.
As of January 2021, inlining currently only happens in LLVM but this might change in the future.
MIR optimizations have little impact. Compared to the default `RUSTFLAGS="-Z
mir-opt-level=1"`, level 0 adds 0.3GB and level 2 removes 0.2GB. As of January
2021 <!-- date: 2021-01 -->, inlining currently only happens in LLVM but this
might change in the future.

View File

@ -89,8 +89,8 @@ The trace of the queries has a formal structure; see
We style this formal structure as follows:
- **Timed passes:** Green boxes, when present (via `-Z time-passes`), represent
_timed passes_ in the compiler. As of January 2021 these passes are not queries, but may be
replaced by queries in future versions.
_timed passes_ in the compiler. As of January 2021 <!-- date: 2021-01 -->
these passes are not queries, but may be replaced by queries in future versions.
- **Labels:** Some green and red boxes are labeled with text. Where they are
present, the labels give the following information:
- The [query's _provider_](#queries), sans its _key_ and its _result_, which

View File

@ -76,10 +76,11 @@ executed, no results are cached. But the context already provides access to
"input" data, i.e. pieces of immutable data that were computed before the
context was created and that queries can access to do their computations.
As of January 2021, this input data consists mainly of the HIR map, upstream crate metadata, and the
command-line options the compiler was invoked with; but in the future inputs will just consist of
command-line options and a list of source files -- the HIR map will itself be provided by a query
which processes these source files.
As of January 2021 <!-- date: 2021-01 -->, this input data consists mainly of
the HIR map, upstream crate metadata, and the command-line options the compiler
was invoked with; but in the future inputs will just consist of command-line
options and a list of source files -- the HIR map will itself be provided by a
query which processes these source files.
Without inputs, queries would live in a void without anything to compute their
result from (remember, query providers only have access to other queries and

View File

@ -1,16 +1,15 @@
# Queries: demand-driven compilation
As described in [the high-level overview of the compiler][hl], the
Rust compiler is still (as of January 2021) transitioning from a traditional "pass-based"
setup to a "demand-driven" system. **The Compiler Query System is the
key to our new demand-driven organization.** The idea is pretty
simple. You have various queries that compute things about the input
for example, there is a query called `type_of(def_id)` that, given
the [def-id] of some item, will compute the type of that item and return
it to you.
As described in [the high-level overview of the compiler][hl], the Rust compiler
is still (as of January 2021 <!-- date: 2021-01 -->) transitioning from a
traditional "pass-based" setup to a "demand-driven" system. **The Compiler Query
System is the key to our new demand-driven organization.** The idea is pretty
simple. You have various queries that compute things about the input for
example, there is a query called `type_of(def_id)` that, given the [def-id] of
some item, will compute the type of that item and return it to you.
[def-id]: appendix/glossary.md#def-id
[hl]: compiler-src.html
[hl]: ./compiler-src.md
Query execution is **memoized** so the first time you invoke a
query, it will go do the computation, but the next time, the result is

View File

@ -66,7 +66,7 @@ these passes, please let us know!)
[44136]: https://github.com/rust-lang/rust/issues/44136
Here is current (as of this writing) list of passes:
Here is the list of passes as of March 2018 <!-- date: 2018-03 -->:
- `propagate-doc-cfg` - propagates `#[doc(cfg(...))]` to child items.
- `collapse-docs` concatenates all document attributes into one document

View File

@ -9,10 +9,10 @@ want to watch [Salsa In More
Depth](https://www.youtube.com/watch?v=i_IhACacPRY), also by Niko
Matsakis.
> As of January 2021, although Salsa is inspired by (among other things) rustc's query system,
> it is not used directly in rustc.
> It _is_ used in chalk and extensively in `rust-analyzer`, but there are no medium or long-term
> concrete plans to integrate it into the compiler.
> As of January 2021 <!-- date: 2021-01 -->, although Salsa is inspired by
> (among other things) rustc's query system, it is not used directly in rustc.
> It _is_ used in chalk and extensively in `rust-analyzer`, but there are no
> medium or long-term concrete plans to integrate it into the compiler.
## What is Salsa?

View File

@ -333,17 +333,17 @@ The error levels that you can have are:
1. `ERROR`
2. `WARNING`
3. `NOTE`
4. `HELP` and `SUGGESTION`*
4. `HELP` and `SUGGESTION`[^sugg-placement]
\* **Note**: `SUGGESTION` must follow immediately after `HELP`.
[^sugg-placement]: **Note**: `SUGGESTION` must follow immediately after `HELP`.
## Revisions
Certain classes of tests support "revisions" (as of the time of this
writing, this includes compile-fail, run-fail, and
incremental, though incremental tests are somewhat
different). Revisions allow a single test file to be used for multiple
tests. This is done by adding a special header at the top of the file:
Certain classes of tests support "revisions" (as of February 2018 <!-- date:
2018-02 -->, this includes compile-fail, run-fail, and incremental, though
incremental tests are somewhat different). Revisions allow a single test file to
be used for multiple tests. This is done by adding a special header at the top
of the file:
```rust
// revisions: foo bar baz

View File

@ -124,13 +124,13 @@ launch a build that will run all tests on some configurations
(x86_64-gnu-llvm-8 linux. x86_64-gnu-tools linux, mingw-check linux). In
essence, it runs `./x.py test` after building for each of them.
The integration bot [bors] is used for coordinating merges to the master
branch. When a PR is approved, it goes into a [queue] where merges are tested
one at a time on a wide set of platforms using GitHub Actions (as of January 2021 over
50 different configurations). Due to the limit on the number of parallel jobs,
we run CI under the [rust-lang-ci] organization except for PRs.
Most platforms only run the build steps, some run a restricted set of tests,
only a subset run the full suite of tests (see Rust's [platform tiers]).
The integration bot [bors] is used for coordinating merges to the master branch.
When a PR is approved, it goes into a [queue] where merges are tested one at a
time on a wide set of platforms using GitHub Actions (as of January 2021 <!--
date: 2021-01 -->, over 50 different configurations). Due to the limit on the
number of parallel jobs, we run CI under the [rust-lang-ci] organization except
for PRs. Most platforms only run the build steps, some run a restricted set of
tests, only a subset run the full suite of tests (see Rust's [platform tiers]).
[GitHub Actions]: https://github.com/rust-lang/rust/actions
[rust-lang-ci]: https://github.com/rust-lang-ci/rust/actions

View File

@ -1,7 +1,7 @@
# Lexing and Parsing
As of January 2021, the lexer and parser are undergoing refactoring to allow
extracting them into libraries.
As of January 2021 <!-- date: 2021-01 -->, the lexer and parser are undergoing
refactoring to allow extracting them into libraries.
The very first thing the compiler does is take the program (in Unicode
characters) and turn it into something the compiler can work with more

View File

@ -1,12 +1,11 @@
# Chalk-based trait solving
[Chalk][chalk] is an experimental trait solver for rust that is (as of January 2021)
under development by the [Traits Working Group][wg]. Its goal is
to enable a lot of trait system features and bug fixes that are
hard to implement (e.g. GATs or specialization). If you
would like to help in hacking on the new solver, you will find
instructions for getting involved in the
[Traits Working Group tracking issue][wg].
[Chalk][chalk] is an experimental trait solver for Rust that is (as of January
2021 <!-- date: 2021-01 -->) under development by the [Traits Working
Group][wg]. Its goal is to enable a lot of trait system features and bug fixes
that are hard to implement (e.g. GATs or specialization). If you would like to
help in hacking on the new solver, you will find instructions for getting
involved in the [Traits Working Group tracking issue][wg].
[wg]: https://github.com/rust-lang/rust/issues/48416

View File

@ -118,11 +118,11 @@ candidate that is definitively applicable. In some cases, we may not
know whether an impl/where-clause applies or not this occurs when
the obligation contains unbound inference variables.
The subroutines that decide whether a particular impl/where-clause/etc
applies to a particular obligation are collectively referred to as the
process of _matching_. As of January 2021, this amounts to
unifying the `Self` types, but in the future we may also recursively
consider some of the nested obligations, in the case of an impl.
The subroutines that decide whether a particular impl/where-clause/etc applies
to a particular obligation are collectively referred to as the process of
_matching_. As of January 2021 <!-- date: 2021-01 -->, this amounts to unifying
the `Self` types, but in the future we may also recursively consider some of the
nested obligations, in the case of an impl.
**TODO**: what does "unifying the `Self` types" mean? The `Self` of the
obligation with that of an impl?

View File

@ -71,8 +71,8 @@ inference works, or perhaps this blog post on
[Unification in the Chalk project]: http://smallcultfollowing.com/babysteps/blog/2017/03/25/unification-in-chalk-part-1/
All told, the inference context stores four kinds of inference variables as of
this writing:
All told, the inference context stores four kinds of inference variables (as of
January 2018 <!-- date: 2018-01 -->):
- Type variables, which come in three varieties:
- General type variables (the most common). These can be unified with any