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: docs/dev/README.md
+27Lines changed: 27 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -241,6 +241,26 @@ struct Foo {
241
241
For `.md` and `.adoc` files, prefer a sentence-per-line format, don't wrap lines.
242
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
+
fnfrbonicate(walrus:Walrus) {
251
+
...
252
+
}
253
+
254
+
// Not as good
255
+
fnfrobnicate(walrus:Option<Walrus>) {
256
+
letwalrus=matchwalrus {
257
+
Some(it) =>it,
258
+
None=>return,
259
+
};
260
+
...
261
+
}
262
+
```
263
+
244
264
# Architecture Invariants
245
265
246
266
This 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.
268
288
IDE should use only types from `ra_hir`, and should not depend on the underling compiler types.
269
289
`ra_hir` is a facade.
270
290
291
+
## IDE API
292
+
293
+
The main IDE crate (`ra_ide`) uses "Plain Old Data" for the API.
294
+
Rather than talking in definitions and references, it talks in Strings and textual offsets.
295
+
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.
296
+
The results are 100% Rust specific though.
297
+
271
298
# Logging
272
299
273
300
Logging is done by both rust-analyzer and VS Code, so it might be tricky to
0 commit comments