From 1e98f34547fcca4dabf5d9721da55fc6644164d4 Mon Sep 17 00:00:00 2001 From: Tshepang Mbambo Date: Sun, 12 Mar 2023 12:06:43 +0200 Subject: [PATCH 1/2] first mention of type, and add a link --- src/generics.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/generics.md b/src/generics.md index cbfd01e84..36d1c72c5 100644 --- a/src/generics.md +++ b/src/generics.md @@ -6,7 +6,7 @@ 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 the `SubstsRef` that we mentioned above (“substs” = “substitutions”). +In rustc this is done using [SubstsRef] (“substs” = “substitutions”). Conceptually, you can think of `SubstsRef` as a list of types that are to be substituted for the generic type parameters of the ADT. @@ -18,6 +18,7 @@ is conceptually like a `&'tcx [GenericArgKind<'tcx>]` slice (but it is actually [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/subst/struct.GenericArg.html [`GenericArgKind`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/subst/enum.GenericArgKind.html +[SubstsRef]: https://doc.rust-lang.org/stable/nightly-rustc/rustc_middle/ty/subst/type.SubstsRef.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 From 04fabdd3aa965468960970fa0978cfc893031357 Mon Sep 17 00:00:00 2001 From: Yuki Okushi Date: Tue, 21 Mar 2023 17:51:11 +0900 Subject: [PATCH 2/2] Update src/generics.md --- src/generics.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/generics.md b/src/generics.md index 36d1c72c5..7512b3b47 100644 --- a/src/generics.md +++ b/src/generics.md @@ -18,7 +18,7 @@ is conceptually like a `&'tcx [GenericArgKind<'tcx>]` slice (but it is actually [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/subst/struct.GenericArg.html [`GenericArgKind`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/subst/enum.GenericArgKind.html -[SubstsRef]: https://doc.rust-lang.org/stable/nightly-rustc/rustc_middle/ty/subst/type.SubstsRef.html +[SubstsRef]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/subst/type.SubstsRef.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