Skip to content

v2.20.0

Latest

Choose a tag to compare

@github-actions github-actions released this 23 Jul 11:34
eea264f

What's Changed

Highlights

  • Tuple element access via t.0 syntax. Tuple elements can now be accessed positionally with dot notation (t.0, t.1, …), including nested access, assignments, ref arguments, and access through snapshots. #10111 #10153
  • #[panic_with] is deprecated. Using the attribute without opting in via #[feature("deprecated-panic-with")] now emits a warning; prefer plain calculations (now supported in const context) or explicit .expect(...) calls. As part of this, the generated wrapper functions were removed from the corelib — see the breaking change under Corelib below. #10096
  • Faster incremental recompilation. Syntax node ids are now kept stable across reparses and plugin-generated files are cached, restoring salsa early cutoff so a structure-preserving edit no longer re-walks the rest of the file — noticeably speeding up the language server. #10105 #10164

Features

  • Support tuple element access via t.0 syntax. #10111 #10153
  • Deprecated the #[panic_with] attribute; opt in with #[feature("deprecated-panic-with")] to silence the warning. #10096
  • Warn (E2201) when an extern type or function is declared outside the core library; suppress with #[allow(extern_outside_corelib)]. #10147
  • Support struct-update (..base) syntax in const expressions. #10136
  • Evaluate !, &, |, and ^ on bool operands in const contexts. #10212
  • Populate MacroPluginMetadata::allowed_features so macro plugins can honor #[feature(...)]. #10094

Bug Fixes

  • Reject types that are (or transitively contain) a phantom type when used as values, in signatures, or as array elements, including nested and cyclic cases (E2019), instead of silently compiling or hitting an ICE. #10120 #10169 #10171 #10175
  • Disable Felt252Dict construction for illegal value types. #10118
  • Emit a diagnostic (E2075) for glob (*) use items in statement position instead of silently accepting them. #10148
  • Reject #[default] on a struct member instead of silently ignoring it. #10228
  • Fixed derive(Hash)/derive(Serde) codegen for enums, and sanitized the generated hash/serde implementations. #10080 #10117
  • Emit derive member bounds for associated-type-path members. #10176
  • Validate the quotient in const DivRem to avoid a signed MIN/-1 ICE. #10140
  • Substitute the result of generic const function calls with the concrete call-site types. #10143
  • Include captured_types in the closure occurs-check. #10086
  • Don't ICE on a Deref impl with the wrong number of associated types. #10183
  • Don't ICE when an impl provides an associated item of the wrong kind. #10206
  • Report every invalid associated-item constraint, not just the first. #10207
  • Don't ICE on a wrong generic-argument count reached through a local use alias. #10211
  • Report a glob name collision of non-visible items as not-visible rather than ambiguous. #10209
  • Apply feature/visibility gating to glob re-exports of generic items. #10217
  • Enforce the fixed-size-array size cap on the type form. #10218
  • Attribute format!/print! bracket errors to the right macro. #10222
  • writeln!(f) with no format string now writes a newline. #10182
  • Apply full type-based diagnostics to all parts of a function signature. #10170
  • Removed an extra diagnostic emitted for type mismatches on missing. #10121
  • Fixed punctuation/newline of bare crate-root diagnostics. #10087
  • Skipped-token diagnostic now spans the token, not its leading comment. #10088
  • Validate the literal in a negative const generic argument, and anchor literal-validation diagnostics at the token text. #10091 #10103
  • Treat //// as a regular comment, not a doc comment. #10107
  • Make macro a valid recovery terminal and tree token. #10149
  • Stop block recovery at a following control-flow statement. #10227
  • Dedup panic_destruct calls for a variable at a shared panic location. #10205
  • Normalize storage_base_address_from_felt252 const folding. #10210
  • Prune usage after change promotion in loop usage finalization. #10201
  • Name macro-call modules by macro name and offset instead of raw call text. #10197
  • Close the ] in the FixedSizeArray type short name. #10172
  • Fixed a from_trace panic by profiling coupon_call like function_call in the runner. #10081
  • Make inline doc links with markup point to their URL. #10151
  • Collect executables from modules generated by macro calls. by @integraledelebesgue in #10184

Starknet

  • Fully-qualify prelude types in contract codegen. #10137
  • Clearer error for a non-ref self constructor. #10223
  • Calling meta_tx_v0 no longer crashes cairo test. #10219
  • Fixed test-deployment hygiene issues in the Starknet plugin. #10173
  • Reject crafted out-of-range type ids instead of panicking when building a Starknet class. #10224
  • Validate entry-point signatures before compilation in class-to-casm. #10221
  • Validate that entry-point builtins are in canonical order in class-to-casm. #10213

Corelib

  • Breaking: removed the generated #[panic_with] wrapper functions (e.g. array_at, u128_from_felt252, u128_sub, u256_sub, and the u*_as_non_zero helpers) in favor of the _try_*/.expect(...) equivalents. #10095
  • Made Encode::size_hint more exact. #10108

Formatter

  • Sort merged use items via compare_names, and made use merging more consistent. #10123 #10150
  • Don't glue a comment to { in an empty block. #10188
  • Made cairofmt::skip work properly for additional items. #10220

Optimizations

  • Stream the lexer with a lookahead window instead of cloning all tokens up front, reducing peak memory during parsing. #10141
  • Keep syntax node ids stable across reparses (canonical roots, kind-keyed child index, parent-relative offsets), restoring salsa early cutoff for structure-preserving edits. #10105 #10190 #10191
  • Cache external (plugin-generated) file content in the defs cache. #10164
  • Track arrays as a bounded suffix behind a forgotten prefix in equality analysis, and keep tracking remainders popped through it. #10076 #10085
  • Avoid cloning blocks and analysis info in inlining and dataflow. #10127
  • Made substitute faster on empty substitutions. #10146
  • Reduced intermediary string allocations across the compiler. #10124 #10125 #10126

Documentation

Other

  • Debug info: added parameter information to functions' debug info, and stabilized ids in the debug replacer. by @piotmag769 in #10225 #10187
  • Dependency updates, including salsa. #10195 #10196

New Contributors

Full Changelog: v2.19.0...v2.20.0