fix a few more links
This commit is contained in:
parent
137ebb6521
commit
f0c9f6dca6
|
|
@ -120,7 +120,7 @@ future-compatibility warnings. These are a special category of lint warning.
|
|||
Adding a new future-compatibility warning can be done as follows.
|
||||
|
||||
```rust
|
||||
// 1. Define the lint in `src/librustc_middle/lint/builtin.rs`:
|
||||
// 1. Define the lint in `src/librustc/lint/builtin.rs`:
|
||||
declare_lint! {
|
||||
pub YOUR_ERROR_HERE,
|
||||
Warn,
|
||||
|
|
@ -230,12 +230,14 @@ lint name is mentioned (in the compiler, we use the upper-case name, and a macro
|
|||
automatically generates the lower-case string; so searching for
|
||||
`overlapping_inherent_impls` would not find much).
|
||||
|
||||
> NOTE: these exact files don't exist anymore, but the procedure is still the same.
|
||||
|
||||
#### Remove the lint.
|
||||
|
||||
The first reference you will likely find is the lint definition [in
|
||||
`librustc_middle/lint/builtin.rs` that resembles this][defsource]:
|
||||
`librustc/lint/builtin.rs` that resembles this][defsource]:
|
||||
|
||||
[defsource]: https://github.com/rust-lang/rust/blob/085d71c3efe453863739c1fb68fd9bd1beff214f/src/librustc_middle/lint/builtin.rs#L171-L175
|
||||
[defsource]: https://github.com/rust-lang/rust/blob/085d71c3efe453863739c1fb68fd9bd1beff214f/src/librustc/lint/builtin.rs#L171-L175
|
||||
|
||||
```rust
|
||||
declare_lint! {
|
||||
|
|
@ -249,7 +251,7 @@ This `declare_lint!` macro creates the relevant data structures. Remove it. You
|
|||
will also find that there is a mention of `OVERLAPPING_INHERENT_IMPLS` later in
|
||||
the file as [part of a `lint_array!`][lintarraysource]; remove it too,
|
||||
|
||||
[lintarraysource]: https://github.com/rust-lang/rust/blob/085d71c3efe453863739c1fb68fd9bd1beff214f/src/librustc_middle/lint/builtin.rs#L252-L290
|
||||
[lintarraysource]: https://github.com/rust-lang/rust/blob/085d71c3efe453863739c1fb68fd9bd1beff214f/src/librustc/lint/builtin.rs#L252-L290
|
||||
|
||||
Next, you see see [a reference to `OVERLAPPING_INHERENT_IMPLS` in
|
||||
`librustc_lint/lib.rs`][futuresource]. This defining the lint as a "future
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ types for equality: for each interned type `X`, we implemented [`PartialEq for
|
|||
X`][peqimpl], so we can just compare pointers. The [`CtxtInterners`] type
|
||||
contains a bunch of maps of interned types and the arena itself.
|
||||
|
||||
[peqimpl]: https://github.com/rust-lang/rust/blob/3ee936378662bd2e74be951d6a7011a95a6bd84d/src/librustc_middle/ty/mod.rs#L528-L534
|
||||
[peqimpl]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/struct.TyS.html#implementations
|
||||
[`CtxtInterners`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/struct.CtxtInterners.html#structfield.arena
|
||||
|
||||
### Example: `ty::TyS`
|
||||
|
|
|
|||
|
|
@ -93,13 +93,13 @@ defined
|
|||
[here](https://github.com/rust-lang/rust/blob/master/src/librustc_macros/src/type_foldable.rs).
|
||||
|
||||
**`subst`** In the case of substitutions the [actual
|
||||
folder](https://github.com/rust-lang/rust/blob/04e69e4f4234beb4f12cc76dcc53e2cc4247a9be/src/librustc_middle/ty/subst.rs#L467-L482)
|
||||
folder](https://github.com/rust-lang/rust/blob/75ff3110ac6d8a0259023b83fd20d7ab295f8dd6/src/librustc_middle/ty/subst.rs#L440-L451)
|
||||
is going to be doing the indexing we’ve already mentioned. There we define a `Folder` and call
|
||||
`fold_with` on the `TypeFoldable` to process yourself. Then
|
||||
[fold_ty](https://github.com/rust-lang/rust/blob/04e69e4f4234beb4f12cc76dcc53e2cc4247a9be/src/librustc_middle/ty/subst.rs#L545-L573)
|
||||
[fold_ty](https://github.com/rust-lang/rust/blob/75ff3110ac6d8a0259023b83fd20d7ab295f8dd6/src/librustc_middle/ty/subst.rs#L512-L536)
|
||||
the method that process each type it looks for a `ty::Param` and for those it replaces it for
|
||||
something from the list of substitutions, otherwise recursively process the type. To replace it,
|
||||
calls
|
||||
[ty_for_param](https://github.com/rust-lang/rust/blob/04e69e4f4234beb4f12cc76dcc53e2cc4247a9be/src/librustc_middle/ty/subst.rs#L589-L624)
|
||||
[ty_for_param](https://github.com/rust-lang/rust/blob/75ff3110ac6d8a0259023b83fd20d7ab295f8dd6/src/librustc_middle/ty/subst.rs#L552-L587)
|
||||
and all that does is index into the list of substitutions with the index of the `Param`.
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue