What's Changed
Highlights
- Tuple element access via
t.0syntax. Tuple elements can now be accessed positionally with dot notation (t.0,t.1, …), including nested access, assignments,refarguments, 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 inconstcontext) 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.0syntax. #10111 #10153 - Deprecated the
#[panic_with]attribute; opt in with#[feature("deprecated-panic-with")]to silence the warning. #10096 - Warn (
E2201) when anexterntype or function is declared outside the core library; suppress with#[allow(extern_outside_corelib)]. #10147 - Support struct-update (
..base) syntax inconstexpressions. #10136 - Evaluate
!,&,|, and^onbooloperands inconstcontexts. #10212 - Populate
MacroPluginMetadata::allowed_featuresso 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
Felt252Dictconstruction for illegal value types. #10118 - Emit a diagnostic (
E2075) for glob (*)useitems 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
constDivRemto avoid a signedMIN/-1ICE. #10140 - Substitute the result of generic
constfunction calls with the concrete call-site types. #10143 - Include
captured_typesin the closure occurs-check. #10086 - Don't ICE on a
Derefimpl 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
usealias. #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
macroa valid recovery terminal and tree token. #10149 - Stop block recovery at a following control-flow statement. #10227
- Dedup
panic_destructcalls for a variable at a shared panic location. #10205 - Normalize
storage_base_address_from_felt252const 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 theFixedSizeArraytype short name. #10172 - Fixed a
from_tracepanic by profilingcoupon_calllikefunction_callin 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 selfconstructor. #10223 - Calling
meta_tx_v0no longer crashescairo 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 theu*_as_non_zerohelpers) in favor of the_try_*/.expect(...)equivalents. #10095 - Made
Encode::size_hintmore exact. #10108
Formatter
- Sort merged
useitems viacompare_names, and madeusemerging more consistent. #10123 #10150 - Don't glue a comment to
{in an empty block. #10188 - Made
cairofmt::skipwork 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
substitutefaster on empty substitutions. #10146 - Reduced intermediary string allocations across the compiler. #10124 #10125 #10126
Documentation
- Corrected corelib doc examples and comments:
DivRem,keccak_u256s_be_inputs,get_curve_size,egcd's# Panics,Iterator::sum, byte-array example, and misc doc-comment fixes. #10092 #10100 #10101 #10102 #10106 #10122 #10152 #10204
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
- @reflecttypefor made their first contribution in #10089
- @alaningtrump made their first contribution in #10185
Full Changelog: v2.19.0...v2.20.0