Skip to content

Some drop order tests are needlessly confusing #141604

Open
@jieyouxu

Description

@jieyouxu

Suggestion (not for this PR): #2735 refers to

"let _ = foo();" is differently effectful from just "foo();"

This test (tests/ui/drop/issue-2735-2.rs) exercising let _ = <expr>; vs <expr>; drop order does not need to allow non_camel_case_types, just change defer struct to use the canonical name, this is needlessly confusing:

  • In the struct decl, defer-the-struct is in type namespace, defer-the-struct-constructor is in value namespace
  • In this function decl, defer (fn) is in the value namespace, defer<'_> is in the type namespace
  • In the usage in main, defer is the value namespace struct constructor

Same for

  • tests/ui/drop/issue-2735-3.rs
  • tests/ui/drop/issue-979.rs

Originally posted by @jieyouxu in #138677 (comment)

Metadata

Metadata

Assignees

Labels

A-testsuiteArea: The testsuite used to check the correctness of rustcC-cleanupCategory: PRs that clean code up or issues documenting cleanup.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions