From b4efe584599e5b52d82678010f21538bce17fa58 Mon Sep 17 00:00:00 2001 From: Yuki Okushi Date: Thu, 22 Feb 2024 00:17:28 +0900 Subject: [PATCH] Fix more links (#1884) --- src/doc/rustc-dev-guide/book.toml | 4 +++- .../src/borrow_check/region_inference.md | 4 +--- .../src/bound-vars-and-params.md | 4 ++-- .../src/const-eval/interpret.md | 4 ++-- .../src/diagnostics/diagnostic-structs.md | 2 +- .../src/diagnostics/error-codes.md | 2 +- src/doc/rustc-dev-guide/src/generics.md | 18 +++++++++--------- src/doc/rustc-dev-guide/src/ty-fold.md | 2 +- src/doc/rustc-dev-guide/src/ty.md | 6 +++--- .../rustc-dev-guide/src/unsafety-checking.md | 3 +-- 10 files changed, 24 insertions(+), 25 deletions(-) diff --git a/src/doc/rustc-dev-guide/book.toml b/src/doc/rustc-dev-guide/book.toml index 203bfd61ea7c..68340d2d75d7 100644 --- a/src/doc/rustc-dev-guide/book.toml +++ b/src/doc/rustc-dev-guide/book.toml @@ -38,7 +38,9 @@ exclude = [ "www\\.amazon\\.com", "www\\.rustaceans\\.org", "play\\.rust-lang\\.org", - "tomlee\\.co" + "tomlee\\.co", + "marketplace\\.visualstudio\\.com", + "objects\\.githubusercontent\\.com" ] cache-timeout = 86400 warning-policy = "error" diff --git a/src/doc/rustc-dev-guide/src/borrow_check/region_inference.md b/src/doc/rustc-dev-guide/src/borrow_check/region_inference.md index 330c079b9601..5d06d8dd4082 100644 --- a/src/doc/rustc-dev-guide/src/borrow_check/region_inference.md +++ b/src/doc/rustc-dev-guide/src/borrow_check/region_inference.md @@ -112,9 +112,7 @@ common sorts of constraints are: (e.g. `'a: 'b`). Outlives constraints are generated by the [MIR type checker]. 2. Liveness constraints. Each region needs to be live at points where it can be - used. These constraints are collected by [`generate_constraints`]. - -[`generate_constraints`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_borrowck/constraint_generation/fn.generate_constraints.html + used. ## Inference Overview diff --git a/src/doc/rustc-dev-guide/src/bound-vars-and-params.md b/src/doc/rustc-dev-guide/src/bound-vars-and-params.md index 50d5cefb1f8c..bb6b27c5ff1d 100644 --- a/src/doc/rustc-dev-guide/src/bound-vars-and-params.md +++ b/src/doc/rustc-dev-guide/src/bound-vars-and-params.md @@ -3,7 +3,7 @@ ## Early-bound parameters Early-bound parameters in rustc are identified by an index, stored in the -[`ParamTy`] struct for types or the [`EarlyBoundRegion`] struct for lifetimes. +[`ParamTy`] struct for types or the [`EarlyParamRegion`] struct for lifetimes. The index counts from the outermost declaration in scope. This means that as you add more binders inside, the index doesn't change. @@ -24,7 +24,7 @@ In rustc, the [`Generics`] structure carries this information. So the in [this chapter](./generics.md). [`ParamTy`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/struct.ParamTy.html -[`EarlyBoundRegion`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/struct.EarlyBoundRegion.html +[`EarlyParamRegion`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/region/struct.EarlyParamRegion.html [`Generics`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/struct.Generics.html ## Late-bound parameters diff --git a/src/doc/rustc-dev-guide/src/const-eval/interpret.md b/src/doc/rustc-dev-guide/src/const-eval/interpret.md index fbf781b968bc..51a539de5cb6 100644 --- a/src/doc/rustc-dev-guide/src/const-eval/interpret.md +++ b/src/doc/rustc-dev-guide/src/const-eval/interpret.md @@ -99,9 +99,9 @@ further queries need to be executed in order to get at something as simple as a Future evaluations of the same constants will not actually invoke the interpreter, but just use the cached result. -[`Operand`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_const_eval/interpret/enum.Operand.html +[`Operand`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_const_eval/interpret/operand/enum.Operand.html [`Immediate`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_const_eval/interpret/enum.Immediate.html -[`ConstValue`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/mir/interpret/enum.ConstValue.html +[`ConstValue`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/mir/consts/enum.ConstValue.html [`Scalar`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/mir/interpret/enum.Scalar.html [`op_to_const`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_const_eval/const_eval/eval_queries/fn.op_to_const.html diff --git a/src/doc/rustc-dev-guide/src/diagnostics/diagnostic-structs.md b/src/doc/rustc-dev-guide/src/diagnostics/diagnostic-structs.md index b6ee5aba6895..8b813b9f3b63 100644 --- a/src/doc/rustc-dev-guide/src/diagnostics/diagnostic-structs.md +++ b/src/doc/rustc-dev-guide/src/diagnostics/diagnostic-structs.md @@ -1,7 +1,7 @@ # Diagnostic and subdiagnostic structs rustc has three diagnostic derives that can be used to create simple diagnostics, which are recommended to be used when they are applicable: -`#[derive(Diagnostic)]`, #[derive(LintDiagnostic)], and `#[derive(Subdiagnostic)]`. +`#[derive(Diagnostic)]`, `#[derive(LintDiagnostic)]`, and `#[derive(Subdiagnostic)]`. Diagnostics created with the derive macros can be translated into different languages and each has a slug that uniquely identifies the diagnostic. diff --git a/src/doc/rustc-dev-guide/src/diagnostics/error-codes.md b/src/doc/rustc-dev-guide/src/diagnostics/error-codes.md index 81abd62c8faf..fc2fe190c203 100644 --- a/src/doc/rustc-dev-guide/src/diagnostics/error-codes.md +++ b/src/doc/rustc-dev-guide/src/diagnostics/error-codes.md @@ -24,7 +24,7 @@ written, as always: ask your reviewer or ask around on the Rust Discord or Zulip [^new-explanations]: See the draft RFC [here][new-explanations-rfc]. -[`rustc_error_codes`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_error_codes/error_codes/index.html +[`rustc_error_codes`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_error_codes/index.html [CommonMark Spec]: https://spec.commonmark.org/current/ [RFC 1567]: https://github.com/rust-lang/rfcs/blob/master/text/1567-long-error-codes-explanation-normalization.md [new-explanations-rfc]: https://github.com/rust-lang/rfcs/pull/3370 diff --git a/src/doc/rustc-dev-guide/src/generics.md b/src/doc/rustc-dev-guide/src/generics.md index 6c61ab87fc02..fd5402d484c2 100644 --- a/src/doc/rustc-dev-guide/src/generics.md +++ b/src/doc/rustc-dev-guide/src/generics.md @@ -6,20 +6,20 @@ inference, type checking, and trait solving. Conceptually, during these routines that one type is equal to another type and want to swap one out for the other and then swap that out for another type and so on until we eventually get some concrete types (or an error). -In rustc this is done using [GenericArgsRef]. -Conceptually, you can think of `GenericArgsRef` as a list of types that are to be substituted for +In rustc this is done using [GenericArgs]. +Conceptually, you can think of `GenericArgs` as a list of types that are to be substituted for the generic type parameters of the ADT. -`GenericArgsRef` is a type alias of `&'tcx List>` (see [`List` rustdocs][list]). +`GenericArgs` is a type alias of `&'tcx List>` (see [`List` rustdocs][list]). [`GenericArg`] is essentially a space-efficient wrapper around [`GenericArgKind`], which is an enum indicating what kind of generic the type parameter is (type, lifetime, or const). -Thus, `GenericArgsRef` is conceptually like a `&'tcx [GenericArgKind<'tcx>]` slice (but it is +Thus, `GenericArgs` is conceptually like a `&'tcx [GenericArgKind<'tcx>]` slice (but it is actually a `List`). [list]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/struct.List.html [`GenericArg`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/struct.GenericArg.html [`GenericArgKind`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/enum.GenericArgKind.html -[GenericArgsRef]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/type.GenericArgsRef.html +[GenericArgs]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/type.GenericArgs.html So why do we use this `List` type instead of making it really a slice? It has the length "inline", so `&List` is only 32 bits. As a consequence, it cannot be "subsliced" (that only works if the @@ -37,10 +37,10 @@ struct MyStruct - There would be an `AdtDef` (and corresponding `DefId`) for `MyStruct`. - There would be a `TyKind::Param` (and corresponding `DefId`) for `T` (more later). -- There would be a `GenericArgsRef` containing the list `[GenericArgKind::Type(Ty(T))]` +- There would be a `GenericArgs` containing the list `[GenericArgKind::Type(Ty(T))]` - The `Ty(T)` here is my shorthand for entire other `ty::Ty` that has `TyKind::Param`, which we mentioned in the previous point. -- This is one `TyKind::Adt` containing the `AdtDef` of `MyStruct` with the `GenericArgsRef` above. +- This is one `TyKind::Adt` containing the `AdtDef` of `MyStruct` with the `GenericArgs` above. Finally, we will quickly mention the [`Generics`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/struct.Generics.html) type. It @@ -114,7 +114,7 @@ This example has a few different substitutions: Let’s look a bit more closely at that last substitution to see why we use indexes. If we want to find the type of `foo.x`, we can get generic type of `x`, which is `Vec`. Now we can take -the index `0` and use it to find the right type substitution: looking at `Foo`'s `GenericArgsRef`, +the index `0` and use it to find the right type substitution: looking at `Foo`'s `GenericArgs`, we have the list `[u32, f32]` , since we want to replace index `0`, we take the 0-th index of this list, which is `u32`. Voila! @@ -127,7 +127,7 @@ You may have a couple of followup questions… `MyStruct`: `Adt(Foo, &[Param(0), Param(1)])`. How do we actually do the substitutions? There is a function for that too! You -use [`instantiate`] to replace a `GenericArgsRef` with another list of types. +use [`instantiate`] to replace a `GenericArgs` with another list of types. [Here is an example of actually using `instantiate` in the compiler][instantiatex]. The exact details are not too important, but in this piece of code, we happen to be diff --git a/src/doc/rustc-dev-guide/src/ty-fold.md b/src/doc/rustc-dev-guide/src/ty-fold.md index dd76b80d452c..a5f82cf78dbd 100644 --- a/src/doc/rustc-dev-guide/src/ty-fold.md +++ b/src/doc/rustc-dev-guide/src/ty-fold.md @@ -35,7 +35,7 @@ So to reiterate: - `TypeFoldable` is a trait that is implemented by things that embed types. In the case of `subst`, we can see that it is implemented as a `TypeFolder`: -[`SubstFolder`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/subst/struct.SubstFolder.html). +[`ArgFolder`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/generic_args/struct.ArgFolder.html). Looking at its implementation, we see where the actual substitutions are happening. However, you might also notice that the implementation calls this `super_fold_with` method. What is diff --git a/src/doc/rustc-dev-guide/src/ty.md b/src/doc/rustc-dev-guide/src/ty.md index aaa195d0898c..80a72b1167e5 100644 --- a/src/doc/rustc-dev-guide/src/ty.md +++ b/src/doc/rustc-dev-guide/src/ty.md @@ -287,7 +287,7 @@ struct MyStruct { x: u32, y: T } The type `MyStruct` would be an instance of `TyKind::Adt`: ```rust,ignore -Adt(&'tcx AdtDef, GenericArgsRef<'tcx>) +Adt(&'tcx AdtDef, GenericArgs<'tcx>) // ------------ --------------- // (1) (2) // @@ -301,12 +301,12 @@ There are two parts: parameters. In our example, this is the `MyStruct` part *without* the argument `u32`. (Note that in the HIR, structs, enums and unions are represented differently, but in `ty::Ty`, they are all represented using `TyKind::Adt`.) -- The [`GenericArgsRef`][GenericArgsRef] is an interned list of values that are to be substituted +- The [`GenericArgs`][GenericArgs] is an interned list of values that are to be substituted for the generic parameters. In our example of `MyStruct`, we would end up with a list like `[u32]`. We’ll dig more into generics and substitutions in a little bit. [adtdef]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/struct.AdtDef.html -[GenericArgsRef]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/subst/type.GenericArgsRef.html +[GenericArgs]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/type.GenericArgs.html **`AdtDef` and `DefId`** diff --git a/src/doc/rustc-dev-guide/src/unsafety-checking.md b/src/doc/rustc-dev-guide/src/unsafety-checking.md index d68631f4f6f7..1130878944d2 100644 --- a/src/doc/rustc-dev-guide/src/unsafety-checking.md +++ b/src/doc/rustc-dev-guide/src/unsafety-checking.md @@ -75,5 +75,4 @@ the ast that searches for unsafe blocks, functions and implementations, as well as certain unsafe attributes. [Unsafe traits]: https://doc.rust-lang.org/reference/items/traits.html#unsafe-traits -[coherence]: /home/matthew/rust/compiler/rustc_hir_analysis/src/coherence/unsafety.rs - +[coherence]: https://github.com/rust-lang/rust/blob/master/compiler/rustc_hir_analysis/src/coherence/unsafety.rs