Skip to content

Can not use argument impl Trait in type alias #139055

Closed
@LHolten

Description

@LHolten

I tried this code:

type X = [(); {
    
    fn hello(x: impl Clone) {
        
    }
    
    3
}];

I expect this to compile, but instead i get this error.

error[E0658]: `impl Trait` in type aliases is unstable
 --> src/lib.rs:3:17
  |
3 |     fn hello(x: impl Clone) {
  |                 ^^^^^^^^^^
  |

Meta

Bug also reproduces on nightly.

rustc --version --verbose:

rustc 1.85.1 (4eb161250 2025-03-15)
binary: rustc
commit-hash: 4eb161250e340c8f48f66e2b929ef4a5bed7c181
commit-date: 2025-03-15
host: x86_64-unknown-linux-gnu
release: 1.85.1
LLVM version: 19.1.7

Metadata

Metadata

Assignees

Labels

C-bugCategory: This is a bug.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