Skip to content

Commit 6fc8c7f

Browse files
anpnikomatsakisCentril
authored
Apply suggestions from code review
Co-Authored-By: Niko Matsakis <[email protected]> Co-Authored-By: Mazdak Farrokhzad <[email protected]>
1 parent b89b445 commit 6fc8c7f

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/codegen/implicit-caller-location.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ Previously, `panic!` made use of the `file!()`, `line!()`, and `column!()` macro
4444
location, so functions which intentionally invoked `panic!` couldn't provide their own location,
4545
hiding the actual source of error.
4646

47-
Internally, `panic!()` now calls [`core::panid::Location::caller()`][wrapper] to find out where it
47+
Internally, `panic!()` now calls [`core::panic::Location::caller()`][wrapper] to find out where it
4848
was expanded. This function is itself annotated with `#[track_caller]` and wraps the
4949
[`caller_location`][intrinsic] compiler intrinsic implemented by rustc. This intrinsic is easiest
5050
explained in terms of how it works in a `const` context.
@@ -67,7 +67,7 @@ return the span of the *previous* frame which was the "topmost" tracked function
6767

6868
### Allocating a static `Location`
6969

70-
Once we have a `Span` we need to allocate static memory for the `Location`, which is performed by
70+
Once we have a `Span`, we need to allocate static memory for the `Location`, which is performed by
7171
the [`TyCtxt::const_caller_location()`][const-location-query] query. Internally this calls
7272
[`InterpCx::alloc_caller_location()`][alloc-location] and results in a unique
7373
[memory kind][location-memory-kind]. The SSA codegen backend is able to emit code for these same
@@ -77,7 +77,7 @@ Once our `Location` has been allocated in static memory, our intrinsic returns a
7777

7878
## Generating code for `#[track_caller]` callees
7979

80-
To generate efficient code for a tracked function and its callers we need to provide the same
80+
To generate efficient code for a tracked function and its callers, we need to provide the same
8181
behavior from the intrinsic's point of view without having a stack to walk up at runtime. We invert
8282
the approach: as we grow the stack down we pass an additional argument to calls of tracked functions
8383
rather than walking up the stack when the intrinsic is called. That additional argument can be
@@ -157,8 +157,8 @@ probably the best we can do without modifying fully-stabilized type signatures.
157157

158158
The `#[track_caller]` attribute is checked alongside other codegen attrs to ensure the function:
159159

160-
* has `"Rust"` ABI (as opposed to `"C"`, etc...)
161-
* is not a foreign import (e.g. in an `extern {...}` block)
160+
* has the `"Rust"` ABI (as opposed to e.g., `"C"`)
161+
* is not a foreign import (e.g., in an `extern {...}` block)
162162
* is not a closure
163163
* is not `#[naked]`
164164

0 commit comments

Comments
 (0)