You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/const-generics.md
+4-3Lines changed: 4 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -111,14 +111,15 @@ The third point is also somewhat subtle, by not inheriting any of the where clau
111
111
112
112
This also makes it much more likely that the compiler will ICE or atleast incidentally emit some kind of error if we *do* accidentally allow generic parameters in an anon const, as the anon const will have none of the necessary information in its environment to properly handle the generic parameters.
113
113
114
+
#### Array repeat expressions
115
+
The one exception to all of the above is repeat counts of array expressions. As a *backwards compatibility hack* we allow the repeat count const argument to use generic parameters.
116
+
114
117
```rust
115
118
fnfoo<T:Sized>() {
116
-
leta= [1_u8; size_of::<*mutT>()];
119
+
leta= [1_u8; size_of::<T>()];
117
120
}
118
121
```
119
122
120
-
The one exception to all of the above is repeat counts of array expressions. As a *backwards compatibility hack* we allow the repeat count const argument to use generic parameters.
121
-
122
123
However, to avoid most of the problems involved in allowing generic parameters in anon const const arguments we require that the constant be evaluated before monomorphization (e.g. during type checking). In some sense we only allow generic parameters here when they are semantically unused.
123
124
124
125
In the previous example the anon const can be evaluated for any type parameter `T` because raw pointers to sized types always have the same size (e.g. `8` on 64bit platforms).
Copy file name to clipboardExpand all lines: src/external-repos.md
+33-26Lines changed: 33 additions & 26 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -29,9 +29,9 @@ The following external projects are managed using some form of a `subtree`:
29
29
30
30
In contrast to `submodule` dependencies
31
31
(see below for those), the `subtree` dependencies are just regular files and directories which can
32
-
be updated intree. However, if possible, enhancements, bug fixes, etc. specific
33
-
to these tools should be filed against the tools directly in their respective
34
-
upstream repositories. The exception is that when rustc changes are required to
32
+
be updated in-tree. However, if possible, enhancements, bug fixes, etc. specific
33
+
to these tools should be filed against the tools directly in their respective upstream repositories.
34
+
The exception is that when rustc changes are required to
35
35
implement a new tool feature or test, that should happen in one collective rustc PR.
36
36
37
37
`subtree` dependencies are currently managed by two distinct approaches:
@@ -51,7 +51,9 @@ implement a new tool feature or test, that should happen in one collective rustc
51
51
52
52
### Josh subtrees
53
53
54
-
The [josh] tool is an alternative to git subtrees, which manages git history in a different way and scales better to larger repositories. Specific tooling is required to work with josh. We provide a helper [`rustc-josh-sync`][josh-sync] tool to help with the synchronization, described [below](#synchronizing-a-josh-subtree).
54
+
The [josh] tool is an alternative to git subtrees, which manages git history in a different way and scales better to larger repositories.
55
+
Specific tooling is required to work with josh.
56
+
We provide a helper [`rustc-josh-sync`][josh-sync] tool to help with the synchronization, described [below](#synchronizing-a-josh-subtree).
55
57
56
58
### Synchronizing a Josh subtree
57
59
@@ -69,24 +71,24 @@ changes from the subtree to rust-lang/rust) are performed from the subtree repos
69
71
switch to its repository checkout directory in your terminal).
70
72
71
73
#### Performing pull
72
-
1) Checkout a new branch that will be used to create a PR into the subtree
73
-
2) Run the pull command
74
+
1. Checkout a new branch that will be used to create a PR into the subtree
75
+
2. Run the pull command
74
76
```
75
77
rustc-josh-sync pull
76
78
```
77
-
3) Push the branch to your fork and create a PR into the subtree repository
79
+
3. Push the branch to your fork and create a PR into the subtree repository
78
80
- If you have `gh` CLI installed, `rustc-josh-sync` can create the PR for you.
79
81
80
82
#### Performing push
81
83
82
84
> NOTE:
83
85
> Before you proceed, look at some guidance related to Git [on josh-sync README].
84
86
85
-
1) Run the push command to create a branch named `<branch-name>` in a `rustc` fork under the `<gh-username>` account
87
+
1. Run the push command to create a branch named `<branch-name>` in a `rustc` fork under the `<gh-username>` account
86
88
```
87
89
rustc-josh-sync push <branch-name> <gh-username>
88
90
```
89
-
2) Create a PR from `<branch-name>` into `rust-lang/rust`
91
+
2. Create a PR from `<branch-name>` into `rust-lang/rust`
90
92
91
93
### Creating a new Josh subtree dependency
92
94
@@ -97,7 +99,8 @@ If you want to migrate a repository dependency from `git subtree` or `git submod
97
99
Periodically the changes made to subtree based dependencies need to be synchronized between this
98
100
repository and the upstream tool repositories.
99
101
100
-
Subtree synchronizations are typically handled by the respective tool maintainers. Other users
102
+
Subtree synchronizations are typically handled by the respective tool maintainers.
103
+
Other users
101
104
are welcome to submit synchronization PRs, however, in order to do so you will need to modify
102
105
your local git installation and follow a very precise set of instructions.
103
106
These instructions are documented, along with several useful tips and tricks, in the
@@ -108,8 +111,8 @@ use the correct corresponding subtree directory and remote repository.
108
111
The synchronization process goes in two directions: `subtree push` and `subtree pull`.
109
112
110
113
A `subtree push` takes all the changes that happened to the copy in this repo and creates commits
111
-
on the remote repo that match the local changes. Every local
112
-
commit that touched the subtree causes a commit on the remote repo, but
114
+
on the remote repo that match the local changes.
115
+
Every local commit that touched the subtree causes a commit on the remote repo, but
113
116
is modified to move the files from the specified directory to the tool repo root.
114
117
115
118
A `subtree pull` takes all changes since the last `subtree pull`
@@ -119,14 +122,17 @@ the tool changes into the specified directory in the Rust repository.
119
122
It is recommended that you always do a push first and get that merged to the default branch of the tool.
120
123
Then, when you do a pull, the merge works without conflicts.
121
124
While it's definitely possible to resolve conflicts during a pull, you may have to redo the conflict
122
-
resolution if your PR doesn't get merged fast enough and there are new conflicts. Do not try to
123
-
rebase the result of a `git subtree pull`, rebasing merge commits is a bad idea in general.
125
+
resolution if your PR doesn't get merged fast enough and there are new conflicts.
126
+
Do not try to
127
+
rebase the result of a `git subtree pull`; rebasing merge commits is a bad idea in general.
124
128
125
129
You always need to specify the `-P` prefix to the subtree directory and the corresponding remote
126
-
repository. If you specify the wrong directory or repository
130
+
repository.
131
+
If you specify the wrong directory or repository
127
132
you'll get very fun merges that try to push the wrong directory to the wrong remote repository.
128
133
Luckily you can just abort this without any consequences by throwing away either the pulled commits
129
-
in rustc or the pushed branch on the remote and try again. It is usually fairly obvious
134
+
in rustc or the pushed branch on the remote and try again.
135
+
It is usually fairly obvious
130
136
that this is happening because you suddenly get thousands of commits that want to be synchronized.
0 commit comments