diff options
Diffstat (limited to 'docs/dev')
-rw-r--r-- | docs/dev/README.md | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/docs/dev/README.md b/docs/dev/README.md index 903cb4055..46ee030fc 100644 --- a/docs/dev/README.md +++ b/docs/dev/README.md | |||
@@ -241,6 +241,34 @@ struct Foo { | |||
241 | For `.md` and `.adoc` files, prefer a sentence-per-line format, don't wrap lines. | 241 | For `.md` and `.adoc` files, prefer a sentence-per-line format, don't wrap lines. |
242 | If the line is too long, you want to split the sentence in two :-) | 242 | If the line is too long, you want to split the sentence in two :-) |
243 | 243 | ||
244 | ## Preconditions | ||
245 | |||
246 | Function preconditions should generally be expressed in types and provided by the caller (rather than checked by callee): | ||
247 | |||
248 | ```rust | ||
249 | // Good | ||
250 | fn frbonicate(walrus: Walrus) { | ||
251 | ... | ||
252 | } | ||
253 | |||
254 | // Not as good | ||
255 | fn frobnicate(walrus: Option<Walrus>) { | ||
256 | let walrus = match walrus { | ||
257 | Some(it) => it, | ||
258 | None => return, | ||
259 | }; | ||
260 | ... | ||
261 | } | ||
262 | ``` | ||
263 | |||
264 | ## Commit Style | ||
265 | |||
266 | We don't have specific rules around git history hygiene. | ||
267 | Maintaining clean git history is encouraged, but not enforced. | ||
268 | We use rebase workflow, it's OK to rewrite history during PR review process. | ||
269 | |||
270 | Avoid @mentioning people in commit messages, as such messages create a lot of duplicate notification traffic during rebases. | ||
271 | |||
244 | # Architecture Invariants | 272 | # Architecture Invariants |
245 | 273 | ||
246 | This section tries to document high-level design constraints, which are not | 274 | This section tries to document high-level design constraints, which are not |
@@ -268,6 +296,13 @@ IDE assumes that all information is available at all times. | |||
268 | IDE should use only types from `ra_hir`, and should not depend on the underling compiler types. | 296 | IDE should use only types from `ra_hir`, and should not depend on the underling compiler types. |
269 | `ra_hir` is a facade. | 297 | `ra_hir` is a facade. |
270 | 298 | ||
299 | ## IDE API | ||
300 | |||
301 | The main IDE crate (`ra_ide`) uses "Plain Old Data" for the API. | ||
302 | Rather than talking in definitions and references, it talks in Strings and textual offsets. | ||
303 | In general, API is centered around UI concerns -- the result of the call is what the user sees in the editor, and not what the compiler sees underneath. | ||
304 | The results are 100% Rust specific though. | ||
305 | |||
271 | # Logging | 306 | # Logging |
272 | 307 | ||
273 | Logging is done by both rust-analyzer and VS Code, so it might be tricky to | 308 | Logging is done by both rust-analyzer and VS Code, so it might be tricky to |