aboutsummaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2020-06-08 11:55:29 +0100
committerGitHub <[email protected]>2020-06-08 11:55:29 +0100
commit3623c1663f9135504c943c44212e99e5198b16a5 (patch)
tree3b4328644c290792a631002be1e5db248bbae11a /docs
parentd8552d114c3b2cedbc485ebe26d7b784c0845bd8 (diff)
parentcc07c82fefb2affc1772e12b8357471cccc8d578 (diff)
Merge #4792
4792: Document more knowledge r=matklad a=matklad bors r+ 🤖 Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'docs')
-rw-r--r--docs/dev/README.md27
1 files changed, 27 insertions, 0 deletions
diff --git a/docs/dev/README.md b/docs/dev/README.md
index 903cb4055..5a9c0a148 100644
--- a/docs/dev/README.md
+++ b/docs/dev/README.md
@@ -241,6 +241,26 @@ 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
244# Architecture Invariants 264# Architecture Invariants
245 265
246This section tries to document high-level design constraints, which are not 266This section tries to document high-level design constraints, which are not
@@ -268,6 +288,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. 288IDE should use only types from `ra_hir`, and should not depend on the underling compiler types.
269`ra_hir` is a facade. 289`ra_hir` is a facade.
270 290
291## IDE API
292
293The main IDE crate (`ra_ide`) uses "Plain Old Data" for the API.
294Rather than talking in definitions and references, it talks in Strings and textual offsets.
295In 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.
296The results are 100% Rust specific though.
297
271# Logging 298# Logging
272 299
273Logging is done by both rust-analyzer and VS Code, so it might be tricky to 300Logging is done by both rust-analyzer and VS Code, so it might be tricky to