aboutsummaryrefslogtreecommitdiff
path: root/docs/dev
diff options
context:
space:
mode:
Diffstat (limited to 'docs/dev')
-rw-r--r--docs/dev/README.md35
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 {
241For `.md` and `.adoc` files, prefer a sentence-per-line format, don't wrap lines. 241For `.md` and `.adoc` files, prefer a sentence-per-line format, don't wrap lines.
242If the line is too long, you want to split the sentence in two :-) 242If the line is too long, you want to split the sentence in two :-)
243 243
244## Preconditions
245
246Function preconditions should generally be expressed in types and provided by the caller (rather than checked by callee):
247
248```rust
249// Good
250fn frbonicate(walrus: Walrus) {
251 ...
252}
253
254// Not as good
255fn 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
266We don't have specific rules around git history hygiene.
267Maintaining clean git history is encouraged, but not enforced.
268We use rebase workflow, it's OK to rewrite history during PR review process.
269
270Avoid @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
246This section tries to document high-level design constraints, which are not 274This 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.
268IDE should use only types from `ra_hir`, and should not depend on the underling compiler types. 296IDE 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
301The main IDE crate (`ra_ide`) uses "Plain Old Data" for the API.
302Rather than talking in definitions and references, it talks in Strings and textual offsets.
303In 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.
304The results are 100% Rust specific though.
305
271# Logging 306# Logging
272 307
273Logging is done by both rust-analyzer and VS Code, so it might be tricky to 308Logging is done by both rust-analyzer and VS Code, so it might be tricky to