Files
rust/tests
Jonathan Brouwer 5bc1fd171c Rollup merge of #156889 - onehr:fix-local-tuple-constructor-suggestion-144319, r=jieyouxu
Suggest function-local constructors without enclosing function path

Closes rust-lang/rust#144319

This fixes a mismatched-type wrapper suggestion for constructors defined inside
function-like scopes. The previous diagnostic used `def_path_str` directly, so a
function-local tuple struct could be suggested as `main::Foo(false)`, even though
`main` is not a module path that can name the constructor.

The suggestion now prints the constructor path under rustc's existing suggestion
printer mode. That mode omits path segments that cannot be written in source,
while preserving real path segments such as local modules and enum names.

The regression test covers:

- a function-local tuple struct constructor
- a function-local enum variant
- a tuple struct inside a function-local module
- a tuple struct inside a closure body
- a tuple struct inside an inline const block
2026-05-28 14:59:43 +02:00
..