ruff/crates
David Peter 387076d212
[red-knot] Use track_caller for expect_ methods (#13884)
## Summary

A minor quality-of-life improvement: add
[`#[track_caller]`](https://doc.rust-lang.org/reference/attributes/codegen.html#the-track_caller-attribute)
attribute to `Type::expect_xyz()` methods and some `TypeInference` methods such that the panic-location
is reported one level higher up in the stack trace.

before: reports location inside the `Type::expect_class_literal()`
method. Not very useful.
```
thread 'types::infer::tests::deferred_annotation_builtin' panicked at crates/red_knot_python_semantic/src/types.rs:304:14:
Expected a Type::ClassLiteral variant
```

after: reports location at the `Type::expect_class_literal()` call site,
where the error was made.
```
thread 'types::infer::tests::deferred_annotation_builtin' panicked at crates/red_knot_python_semantic/src/types/infer.rs:4302:14:
Expected a Type::ClassLiteral variant
```

## Test Plan

Called `expect_class_literal()` on something that's not a
`Type::ClassLiteral` and saw that the error was reported at the call
site.
2024-10-23 12:48:19 +02:00
..
red_knot Upgrade salsa (#13757) 2024-10-15 11:06:32 +00:00
red_knot_python_semantic [red-knot] Use track_caller for expect_ methods (#13884) 2024-10-23 12:48:19 +02:00
red_knot_server Upgrade to Rust 1.82 (#13816) 2024-10-19 16:05:50 +02:00
red_knot_test [red-knot] Report line numbers in mdtest relative to the markdown file, not the test snippet (#13804) 2024-10-22 07:42:40 +00:00
red_knot_vendored Modernize build scripts (#13837) 2024-10-20 22:35:35 +01:00
red_knot_wasm Use backticks for code in red-knot messages (#13599) 2024-10-02 03:14:28 +00:00
red_knot_workspace [red-knot] rename {Class,Module,Function} => {Class,Module,Function}Literal (#13873) 2024-10-22 22:10:53 +02:00
ruff Modernize build scripts (#13837) 2024-10-20 22:35:35 +01:00
ruff_benchmark Bump MSRV to Rust 1.80 (#13826) 2024-10-20 10:55:36 +02:00
ruff_cache Fix cache key collisions for paths with separators (#12159) 2024-07-03 07:36:46 -05:00
ruff_db Speed up mdtests (#13832) 2024-10-21 20:06:41 +01:00
ruff_dev Alternate quotes for strings inside f-strings in preview (#13860) 2024-10-23 07:57:53 +02:00
ruff_diagnostics [Minor typo] Fix article in "an fix" (#12797) 2024-08-10 21:22:00 -04:00
ruff_formatter Use backticks for code in red-knot messages (#13599) 2024-10-02 03:14:28 +00:00
ruff_graph Bump MSRV to Rust 1.80 (#13826) 2024-10-20 10:55:36 +02:00
ruff_index [red-knot] small efficiency improvements and bugfixes to use-def map building (#12373) 2024-07-18 09:24:58 -07:00
ruff_linter Fix D204's documentation to correctly mention the conventions when it is enabled (#13867) 2024-10-22 16:51:57 +02:00
ruff_macros Upgrade to Rust 1.82 (#13816) 2024-10-19 16:05:50 +02:00
ruff_notebook Bump MSRV to Rust 1.80 (#13826) 2024-10-20 10:55:36 +02:00
ruff_python_ast Alternate quotes for strings inside f-strings in preview (#13860) 2024-10-23 07:57:53 +02:00
ruff_python_ast_integration_tests [internal] ComparableExpr (f)strings and bytes made invariant under concatenation (#13301) 2024-09-25 16:58:57 +02:00
ruff_python_codegen Simplify iteration idioms (#13834) 2024-10-20 22:25:27 +01:00
ruff_python_formatter Alternate quotes for strings inside f-strings in preview (#13860) 2024-10-23 07:57:53 +02:00
ruff_python_index Enable token-based rules on source with syntax errors (#11950) 2024-07-02 08:57:46 +00:00
ruff_python_literal Remove some unused pub functions (#11576) 2024-05-28 09:56:51 -04:00
ruff_python_parser Short circuit lex_identifier if the name is longer or shorter than any known keyword (#13815) 2024-10-19 11:07:15 +00:00
ruff_python_resolver chore(deps): update rust crate insta to v1.38.0 (#10701) 2024-04-01 15:44:30 +00:00
ruff_python_semantic Simplify iteration idioms (#13834) 2024-10-20 22:25:27 +01:00
ruff_python_stdlib Harmonise methods for distinguishing different Python source types (#13682) 2024-10-09 13:18:52 +00:00
ruff_python_trivia [red-knot] Report line numbers in mdtest relative to the markdown file, not the test snippet (#13804) 2024-10-22 07:42:40 +00:00
ruff_python_trivia_integration_tests Build CommentRanges outside the parser (#11792) 2024-06-09 09:55:17 +00:00
ruff_server Upgrade to Rust 1.82 (#13816) 2024-10-19 16:05:50 +02:00
ruff_source_file [red-knot] Report line numbers in mdtest relative to the markdown file, not the test snippet (#13804) 2024-10-22 07:42:40 +00:00
ruff_text_size [red-knot] type inference/checking test framework (#13636) 2024-10-08 12:33:19 -07:00
ruff_wasm Changelog for Ruff v0.7 (#13794) 2024-10-17 16:14:21 +00:00
ruff_workspace Simplify iteration idioms (#13834) 2024-10-20 22:25:27 +01:00