Some small fixes (#823)
* Fix some typos * Update from `typeck_tables_of` to `typeck` * Fix comment
This commit is contained in:
parent
5462868f4b
commit
463489182d
|
|
@ -58,7 +58,7 @@ multiple sentences are _needed_:
|
|||
error: the fobrulator needs to be krontrificated
|
||||
```
|
||||
|
||||
When code or an identifier must appear in an message or label, it should be
|
||||
When code or an identifier must appear in a message or label, it should be
|
||||
surrounded with single acute accents \`.
|
||||
|
||||
### Error explanations
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
# Diagnostic Codes
|
||||
We generally try assign each error message a unique code like `E0123`. These
|
||||
We generally try to assign each error message a unique code like `E0123`. These
|
||||
codes are defined in the compiler in the `diagnostics.rs` files found in each
|
||||
crate, which basically consist of macros. The codes come in two varieties: those
|
||||
that have an extended write-up, and those that do not. Whenever possible, if you
|
||||
|
|
|
|||
|
|
@ -367,7 +367,7 @@ For more details on bootstrapping, see
|
|||
- Guide: [Type Inference](https://rustc-dev-guide.rust-lang.org/type-inference.html)
|
||||
- Guide: [The ty Module: Representing Types](https://rustc-dev-guide.rust-lang.org/ty.html) (semantics)
|
||||
- Main entry point (type inference): [`InferCtxtBuilder::enter`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_infer/infer/struct.InferCtxtBuilder.html#method.enter)
|
||||
- Main entry point (type checking bodies): [the `typeck_tables_of` query](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/struct.TyCtxt.html#method.typeck_tables_of)
|
||||
- Main entry point (type checking bodies): [the `typeck` query](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/struct.TyCtxt.html#method.typeck)
|
||||
- These two functions can't be decoupled.
|
||||
- The Mid Level Intermediate Representation (MIR)
|
||||
- Guide: [The MIR (Mid level IR)](https://rustc-dev-guide.rust-lang.org/mir/index.html)
|
||||
|
|
|
|||
|
|
@ -282,7 +282,7 @@ We explain each term in more detail:
|
|||
providers may nest; see [trace of queries](#trace-of-queries) for more
|
||||
information about this nesting structure.
|
||||
_Example providers:_
|
||||
- `typeck_tables_of` -- Typecheck a Def ID; produce "tables" of type
|
||||
- `typeck` -- Typecheck a Def ID; produce "tables" of type
|
||||
information.
|
||||
- `borrowck` -- Borrow-check a Def ID.
|
||||
- `optimized_mir` -- Generate an optimized MIR for a Def ID; produce MIR.
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ rustc_interface::run_compiler(config, |compiler| {
|
|||
if let Some(expr) = local.init {
|
||||
let hir_id = expr.hir_id; // hir_id identifies the string "Hello, world!"
|
||||
let def_id = tcx.hir().local_def_id(item.hir_id); // def_id identifies the main function
|
||||
let ty = tcx.typeck_tables_of(def_id).node_type(hir_id);
|
||||
let ty = tcx.typeck(def_id).node_type(hir_id);
|
||||
println!("{:?}: {:?}", expr, ty); // prints expr(HirId { owner: DefIndex(3), local_id: 4 }: "Hello, world!"): &'static str
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -107,7 +107,7 @@ impl<X,F> Foo<X> for F
|
|||
}
|
||||
```
|
||||
|
||||
Now let's say we have a obligation `Baz: for<'a> Foo<&'a isize>` and we match
|
||||
Now let's say we have an obligation `Baz: for<'a> Foo<&'a isize>` and we match
|
||||
this impl. What obligation is generated as a result? We want to get
|
||||
`Baz: for<'a> Bar<&'a isize>`, but how does that happen?
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue