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
If you want line numbers for the stack trace, you can enable `debuginfo-lines=true` or `debuginfo=true` in your config.toml and rebuild the compiler. Then the backtrace will look like this:
42
+
If you want line numbers for the stack trace, you can enable
43
+
`debuginfo-lines=true` or `debuginfo=true` in your config.toml and rebuild the
@@ -190,18 +201,28 @@ However, there are still a few concerns that you might care about:
190
201
### Expensive operations in logs
191
202
192
203
A note of caution: the expressions *within* the `debug!` call are run
193
-
whenever RUST_LOG is set, even if the filter would exclude the log. This means that if in the module `rustc::foo` you have a statement
204
+
whenever RUST_LOG is set, even if the filter would exclude the log. This means
205
+
that if in the module `rustc::foo` you have a statement
194
206
195
207
```Rust
196
208
debug!("{:?}", random_operation(tcx));
197
209
```
198
210
199
-
Then if someone runs a debug `rustc` with `RUST_LOG=rustc::bar`, then `random_operation()` will still run - even while it's output will never be needed!
211
+
Then if someone runs a debug `rustc` with `RUST_LOG=rustc::bar`, then
212
+
`random_operation()` will still run - even while it's output will never be
213
+
needed!
200
214
201
215
This means that you should not put anything too expensive or likely
202
-
to crash there - that would annoy anyone who wants to use logging for their own module. Note that if `RUST_LOG` is unset (the default), then the code will not run - this means that if your logging code panics, then no-one will know it until someone tries to use logging to find *another* bug.
216
+
to crash there - that would annoy anyone who wants to use logging for their own
217
+
module. Note that if `RUST_LOG` is unset (the default), then the code will not
218
+
run - this means that if your logging code panics, then no-one will know it
219
+
until someone tries to use logging to find *another* bug.
203
220
204
-
If you *need* to do an expensive operation in a log, be aware that while log expressions are *evaluated* even if logging is not enabled in your module, they are not *formatted* unless it *is*. This means you can put your expensive/crashy operations inside an `fmt::Debug` impl, and they will not be run unless your log is enabled:
221
+
If you *need* to do an expensive operation in a log, be aware that while log
222
+
expressions are *evaluated* even if logging is not enabled in your module,
223
+
they are not *formatted* unless it *is*. This means you can put your
224
+
expensive/crashy operations inside an `fmt::Debug` impl, and they will not be
0 commit comments