Skip to content

Commit 9a9b8da

Browse files
committed
document that this shares a Span with the crate root
1 parent 8ef1b64 commit 9a9b8da

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

text/3791-crate-attr.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,14 @@ Compiled on March 18 2025
122122
My awesome crate
123123
```
124124

125+
## Spans, modules, and editions
126+
127+
`file!`, `include!`, `include_str!`, and `module_path!` all behave the same as when written in source code.
128+
129+
`--crate-attr` shares an edition with the crate (i.e. it is affected by `--edition`). In practice this should not be observable.
130+
131+
The behavior of `file!` and `column!` are not specified; see "Unresolved questions".
132+
125133
# Drawbacks
126134
[drawbacks]: #drawbacks
127135

@@ -156,8 +164,6 @@ In the author's opinion, having source injected via this mechanism does not make
156164

157165
- How should macros that give information about source code behave when used in this attribute? For example, `line!` does not seem to have an obvious behavior, and `column!` could either include or not include the surrounding `#![]`.
158166

159-
Note this should not be construed to imply that `--crate-attr` uses a different file/module than the source or otherwise limits macros. `file!`, `include!`, `include_str!`, and `module_path!` should all behave the same as when written in source code.
160-
161167
# Future possibilities
162168
[future-possibilities]: #future-possibilities
163169

0 commit comments

Comments
 (0)