-
Notifications
You must be signed in to change notification settings - Fork 13.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Default associated types are not typechecked, and can cause UB #62211
Labels
A-associated-items
Area: Associated items (types, constants & functions)
C-bug
Category: This is a bug.
F-associated_type_defaults
`#![feature(associated_type_defaults)]`
I-unsound
Issue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/Soundness
requires-nightly
This issue requires a nightly compiler in some way.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
T-lang
Relevant to the language team, which will review and decide on the PR/issue.
Comments
Also, if we call (the type used was Backtrace:
|
cc @jonas-schievink @nikomatsakis This should be fixed by #61812. |
Assigning myself to add tests to #61812 |
1 task
Can confirm that #61812 correctly rejects the default type. |
This has the same root cause as #33017, so this is still not quite solved at the root. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
A-associated-items
Area: Associated items (types, constants & functions)
C-bug
Category: This is a bug.
F-associated_type_defaults
`#![feature(associated_type_defaults)]`
I-unsound
Issue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/Soundness
requires-nightly
This issue requires a nightly compiler in some way.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
T-lang
Relevant to the language team, which will review and decide on the PR/issue.
Due to associated defaults not being type checked whether they indeed implement all traits specified by the associated type, you can create a program in safe Rust that will segfault:
Playground link: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=395dbcdd4da0d0b66de9fcda6e1deb13
The text was updated successfully, but these errors were encountered: