# traits working group

**URL:** https://internals.rust-lang.org/c/compiler/wg-traits/33.md

[Latest](https://internals.rust-lang.org/latest.md) · [Categories](https://internals.rust-lang.org/categories.md)

---

## [About the traits working group category](https://internals.rust-lang.org/t/about-the-traits-working-group-category/6856)

<div class="topic-metadata">

**Author:** [@nikomatsakis](https://internals.rust-lang.org/u/nikomatsakis)\
**Replies:** 0\
**Last updated:** [February 28, 2018, 2:59pm UTC](https://internals.rust-lang.org/t/about-the-traits-working-group-category/6856 "2018-02-28T14:59:40Z")

</div>

Home of topics specific to the Traits Working Group.

---

## [Could borrow checking with origins unblock sound specialization](https://internals.rust-lang.org/t/could-borrow-checking-with-origins-unblock-sound-specialization/24079)

<div class="topic-metadata">

**Author:** [@Serhii](https://internals.rust-lang.org/u/Serhii)\
**Replies:** 7\
**Last updated:** [March 16, 2026, 2:21pm UTC](https://internals.rust-lang.org/t/could-borrow-checking-with-origins-unblock-sound-specialization/24079 "2026-03-16T14:21:39Z")

</div>

A while ago I posted a question about whether Niko's borrow checking without lifetimes could help with specialization soundness. After some pondering, I believe the origins model could lead to a sound specialization impl…

---

## [Borrow checking without lifetimes and specialization soundness](https://internals.rust-lang.org/t/borrow-checking-without-lifetimes-and-specialization-soundness/23207)

<div class="topic-metadata">

**Author:** [@Serhii](https://internals.rust-lang.org/u/Serhii)\
**Replies:** 2\
**Last updated:** [July 11, 2025, 9:16am UTC](https://internals.rust-lang.org/t/borrow-checking-without-lifetimes-and-specialization-soundness/23207 "2025-07-11T09:16:46Z")

</div>

After reading a blog post borrow checking without lifetimes it made me wonder whether this could be a solution to the specialization unsoundness issue. For example in shipping specialization: a story of soundness the …

---

## [Replace dyn object with enum dispatch](https://internals.rust-lang.org/t/replace-dyn-object-with-enum-dispatch/22644)

<div class="topic-metadata">

**Author:** [@cathaysia](https://internals.rust-lang.org/u/cathaysia)\
**Replies:** 14\
**Last updated:** [April 1, 2025, 5:08pm UTC](https://internals.rust-lang.org/t/replace-dyn-object-with-enum-dispatch/22644 "2025-04-01T17:08:15Z")

</div>

Is it possible to perform a more aggressive optimization to replace the dyn trait with enum dispatch? I guess the following scenarios are possible: The trait is not public. There is no unsafe code involving the dyn tr…

---

## [Why isn't trait specialization a higher priority for Rust development?](https://internals.rust-lang.org/t/why-isnt-trait-specialization-a-higher-priority-for-rust-development/22031)

<div class="topic-metadata">

**Author:** [@Serhii](https://internals.rust-lang.org/u/Serhii)\
**Replies:** 13\
**Last updated:** [December 20, 2024, 9:14am UTC](https://internals.rust-lang.org/t/why-isnt-trait-specialization-a-higher-priority-for-rust-development/22031 "2024-12-20T09:14:17Z")

</div>

From reviewing #31844, it appears that there has been little progress on trait specialization, even though implementing this feature could unlock numerous use cases in scientific computing. With trait specialization, it …

---

## [Idea: Change trait implied bounds to use a fix-point algorithm to support cycles](https://internals.rust-lang.org/t/idea-change-trait-implied-bounds-to-use-a-fix-point-algorithm-to-support-cycles/21276)

<div class="topic-metadata">

**Author:** [@programmerjake](https://internals.rust-lang.org/u/programmerjake)\
**Replies:** 1\
**Last updated:** [July 29, 2024, 9:42am UTC](https://internals.rust-lang.org/t/idea-change-trait-implied-bounds-to-use-a-fix-point-algorithm-to-support-cycles/21276 "2024-07-29T09:42:03Z")

</div>

pub trait Tr1 { type Ty: Tr2\<Ty = Self\>; type Ty2: Tr1\<Ty2 = Self::Ty2\>; } pub trait Tr2 { type Ty: Tr1\<Ty = Self\>; } pub trait Tr3: Tr1\<Ty2: Tr3\> {} I think it would be nice for the trait implied bounds…

---

## [How to get predicates bound to their types in ImplHeader?](https://internals.rust-lang.org/t/how-to-get-predicates-bound-to-their-types-in-implheader/21244)

<div class="topic-metadata">

**Author:** [@10takla](https://internals.rust-lang.org/u/10takla)\
**Replies:** 1\
**Last updated:** [July 24, 2024, 10:28pm UTC](https://internals.rust-lang.org/t/how-to-get-predicates-bound-to-their-types-in-implheader/21244 "2024-07-24T22:28:44Z")

</div>

The following code: impl\<R, K, T: LikeOne\> Of\<T\> for (K, R, i32) where K: LikeTwo { } contains ImplHeader: ImplHeader { impl\_def\_id: DefId(0:8 ~ marker\_with\_items\[5448\]::{impl#1}), impl\_args: \[ …

---

## [Downcast a Box\<dyn Any\> to a concrete type](https://internals.rust-lang.org/t/downcast-a-box-dyn-any-to-a-concrete-type/21144)

<div class="topic-metadata">

**Author:** [@rasheedmhd](https://internals.rust-lang.org/u/rasheedmhd)\
**Replies:** 2\
**Last updated:** [July 8, 2024, 7:02pm UTC](https://internals.rust-lang.org/t/downcast-a-box-dyn-any-to-a-concrete-type/21144 "2024-07-08T19:02:16Z")

</div>

I have a couple of functions that all return a different type and I decided to go with a Box as the return type. I have sort of coded myself into a corner in the sense that there are several other functions that need to…

---

## [How to skip/disable unit test cases while rustc testing using the package Cargo.toml file](https://internals.rust-lang.org/t/how-to-skip-disable-unit-test-cases-while-rustc-testing-using-the-package-cargo-toml-file/20831)

<div class="topic-metadata">

**Author:** [@r\_leran](https://internals.rust-lang.org/u/r_leran)\
**Replies:** 5\
**Last updated:** [May 17, 2024, 6:10am UTC](https://internals.rust-lang.org/t/how-to-skip-disable-unit-test-cases-while-rustc-testing-using-the-package-cargo-toml-file/20831 "2024-05-17T06:10:05Z")

</div>

I see the following tidy package's unit test failures when running rust tests: python3 src/bootstrap/bootstrap.py test --exclude src/tools/tidy --no-fail-fast --bless --target x86\_64-unknown-linux-gnu I am executing ru…

---

## [Compiler complain about conflicting implementations but code is not](https://internals.rust-lang.org/t/compiler-complain-about-conflicting-implementations-but-code-is-not/20756)

<div class="topic-metadata">

**Author:** [@Ticsmtc](https://internals.rust-lang.org/u/Ticsmtc)\
**Replies:** 1\
**Last updated:** [May 1, 2024, 9:36pm UTC](https://internals.rust-lang.org/t/compiler-complain-about-conflicting-implementations-but-code-is-not/20756 "2024-05-01T21:36:55Z")

</div>

use actix::{Actor, Context, StreamHandler}; #\[actix::main\] async fn main() { P::\<S1,S2\> { t1: S1, t2: S2 }; } pub struct P\<TT1,TT2\> where TT1: T1+ Unpin + 'static , TT2: T2+ Unpin + 'static { …

---

## [Trait implementation among incompatible version but within same path results in confusing error](https://internals.rust-lang.org/t/trait-implementation-among-incompatible-version-but-within-same-path-results-in-confusing-error/19666)

<div class="topic-metadata">

**Author:** [@KisaragiEffective](https://internals.rust-lang.org/u/KisaragiEffective)\
**Replies:** 1\
**Last updated:** [October 8, 2023, 7:57am UTC](https://internals.rust-lang.org/t/trait-implementation-among-incompatible-version-but-within-same-path-results-in-confusing-error/19666 "2023-10-08T07:57:19Z")

</div>

I have pulled serde-xml@=0.9.1, which depends on serde@^0.8. But it will solved as serde@=0.8.23 which (probably) is not considered as compatible with serde@^1.0 (modern releases). Here is minimized example. However, I…

---

## [Feature request: trait support #\[refuse\_impl\] attribute, refuse outside implement](https://internals.rust-lang.org/t/feature-request-trait-support-refuse-impl-attribute-refuse-outside-implement/19328)

<div class="topic-metadata">

**Author:** [@tu6ge](https://internals.rust-lang.org/u/tu6ge)\
**Replies:** 7\
**Last updated:** [August 14, 2023, 6:43am UTC](https://internals.rust-lang.org/t/feature-request-trait-support-refuse-impl-attribute-refuse-outside-implement/19328 "2023-08-14T06:43:45Z")

</div>

When we release some traits, due to lack of consideration, the structure may change in the future. In this case, a break change will occur, and we usually need to make it inherit a private trait to prevent other users fr…

---

## [Improve HRTB compatibility for "lifetime not general enough" cases, or provide better help/notes + update language tutorials](https://internals.rust-lang.org/t/improve-hrtb-compatibility-for-lifetime-not-general-enough-cases-or-provide-better-help-notes-update-language-tutorials/19127)

<div class="topic-metadata">

**Author:** [@Sunshine](https://internals.rust-lang.org/u/Sunshine)\
**Replies:** 0\
**Last updated:** [July 11, 2023, 9:54am UTC](https://internals.rust-lang.org/t/improve-hrtb-compatibility-for-lifetime-not-general-enough-cases-or-provide-better-help-notes-update-language-tutorials/19127 "2023-07-11T09:54:53Z")

</div>

Continuing the discussion from Idea: aliasing the \`'static\` lifetime for lifetime parameters / trait bounds, e.g., \`'auto\`: It became clear that there're misunderstandings included in my original post, and after we disc…

---

## [Better error when trait not implemented because of different crate version](https://internals.rust-lang.org/t/better-error-when-trait-not-implemented-because-of-different-crate-version/18808)

<div class="topic-metadata">

**Author:** [@Allen-Webb](https://internals.rust-lang.org/u/Allen-Webb)\
**Replies:** 2\
**Last updated:** [May 10, 2023, 2:32pm UTC](https://internals.rust-lang.org/t/better-error-when-trait-not-implemented-because-of-different-crate-version/18808 "2023-05-10T14:32:51Z")

</div>

Someone asked me for help debugging a compilation error and although it didn't take me too long to figure out what was going on, I figure there is some room for improvement with the error message (though the work require…

---

## [Overly strict coherence for constrained blanket implementations?](https://internals.rust-lang.org/t/overly-strict-coherence-for-constrained-blanket-implementations/18204)

<div class="topic-metadata">

**Author:** [@djc](https://internals.rust-lang.org/u/djc)\
**Replies:** 7\
**Last updated:** [January 25, 2023, 7:01pm UTC](https://internals.rust-lang.org/t/overly-strict-coherence-for-constrained-blanket-implementations/18204 "2023-01-25T19:01:09Z")

</div>

Just making sure I understand coherence correctly. This restriction conceptually doesn't make sense, right? struct LocalType; impl\<I\> LocalTrait for I where I: IntoIterator\<Item = LocalType\> {} trait LocalTrait {} im…

---

## [Add support for restricting trait implementation for local typesa](https://internals.rust-lang.org/t/add-support-for-restricting-trait-implementation-for-local-typesa/17388)

<div class="topic-metadata">

**Author:** [@irfan-hossain-bhuiya](https://internals.rust-lang.org/u/irfan-hossain-bhuiya)\
**Replies:** 1\
**Last updated:** [September 14, 2022, 2:58pm UTC](https://internals.rust-lang.org/t/add-support-for-restricting-trait-implementation-for-local-typesa/17388 "2022-09-14T14:58:30Z")

</div>

As the orphan rule suggest I could implement a local trait to a foreign type,so sometimes people could implement it accidentally,like I want to create a newtype trait trait newtype{ type output; fn get(&self)-\>self::ou…

---

## [Will we be able to return impl Trait from default trait methods?](https://internals.rust-lang.org/t/will-we-be-able-to-return-impl-trait-from-default-trait-methods/16179)

<div class="topic-metadata">

**Author:** [@mankinskin](https://internals.rust-lang.org/u/mankinskin)\
**Replies:** 3\
**Last updated:** [February 19, 2022, 11:13pm UTC](https://internals.rust-lang.org/t/will-we-be-able-to-return-impl-trait-from-default-trait-methods/16179 "2022-02-19T23:13:09Z")

</div>

This seems not possible currently: trait MyTrait { fn foo() -\> impl Trait; } However this is possible: trait MyTrait { fn foo\<T: Trait\>() -\> T; } But is only really useful when you have some way of returning …

---

## [Chalk progress (and where to follow it)](https://internals.rust-lang.org/t/chalk-progress-and-where-to-follow-it/15143)

<div class="topic-metadata">

**Author:** [@ShadowJonathan](https://internals.rust-lang.org/u/ShadowJonathan)\
**Replies:** 2\
**Last updated:** [August 5, 2021, 10:18pm UTC](https://internals.rust-lang.org/t/chalk-progress-and-where-to-follow-it/15143 "2021-08-05T22:18:44Z")

</div>

Heya, partially as per the push to stabilise GATs blogpost, I realised I have not seen much movement around Chalk. This may be because I’m occasionally only taking a look into the rust compiler intrinsics community, but…

---

## [\`impl Trait\` for local variables](https://internals.rust-lang.org/t/impl-trait-for-local-variables/14660)

<div class="topic-metadata">

**Author:** [@smessmer](https://internals.rust-lang.org/u/smessmer)\
**Replies:** 1\
**Last updated:** [May 9, 2021, 8:10pm UTC](https://internals.rust-lang.org/t/impl-trait-for-local-variables/14660 "2021-05-09T20:10:29Z")

</div>

Annotating variables with "impl Trait" could be helpful to annotate futures or streams that you don't know the exact type of: fn process\_stream(stream: impl Stream\<Item = u64\>) -\> impl Stream\<Item = String\> { let inte…

---

## [Same trait bounds for multiple type parameters](https://internals.rust-lang.org/t/same-trait-bounds-for-multiple-type-parameters/14101)

<div class="topic-metadata">

**Author:** [@mankinskin](https://internals.rust-lang.org/u/mankinskin)\
**Replies:** 31\
**Last updated:** [February 25, 2021, 1:54pm UTC](https://internals.rust-lang.org/t/same-trait-bounds-for-multiple-type-parameters/14101 "2021-02-25T13:54:20Z")

</div>

(reposting https://users.rust-lang.org/t/same-trait-bounds-for-multiple-type-parameters/55918/3) Hi there, I just came across this situation: fn my\_fn\< 'a, I, A: Really\<Item=I\> + ALot\<'a, I\> + ToType, B…

---

## [Idea: New feature flag to produce type-only crates to solve the orphan rule](https://internals.rust-lang.org/t/idea-new-feature-flag-to-produce-type-only-crates-to-solve-the-orphan-rule/13529)

<div class="topic-metadata">

**Author:** [@ckaran](https://internals.rust-lang.org/u/ckaran)\
**Replies:** 2\
**Last updated:** [December 8, 2020, 5:43pm UTC](https://internals.rust-lang.org/t/idea-new-feature-flag-to-produce-type-only-crates-to-solve-the-orphan-rule/13529 "2020-12-08T17:43:40Z")

</div>

I'm struggling with the topic name, and even what forum is the best place to put this, if someone can give me a better idea of what to call this and where to put it, I'm all ears! Problem outline: I'm creating a new cra…

---

## [Type parameter not used on enums](https://internals.rust-lang.org/t/type-parameter-not-used-on-enums/13342)

<div class="topic-metadata">

**Author:** [@mankinskin](https://internals.rust-lang.org/u/mankinskin)\
**Replies:** 24\
**Last updated:** [November 18, 2020, 5:18pm UTC](https://internals.rust-lang.org/t/type-parameter-not-used-on-enums/13342 "2020-11-18T17:18:19Z")

</div>

Currently there are some problems with type parameters on enums: enum Msg\<R: Route, P: Page\<R\>\> { Page(\<P as Component\>::Msg), UrlChanged(subs::UrlChanged), } throws R: parameter is never used, but it is requir…

---

## [Casting families for fast dynamic trait object casts and multi-trait objects](https://internals.rust-lang.org/t/casting-families-for-fast-dynamic-trait-object-casts-and-multi-trait-objects/12195)

<div class="topic-metadata">

**Author:** [@JeffBurdges](https://internals.rust-lang.org/u/JeffBurdges)\
**Replies:** 6\
**Last updated:** [April 22, 2020, 11:13am UTC](https://internals.rust-lang.org/t/casting-families-for-fast-dynamic-trait-object-casts-and-multi-trait-objects/12195 "2020-04-22T11:13:59Z")

</div>

In https://github.com/rust-lang/rfcs/issues/349#issuecomment-615934675 I briefly described a mechanism for casts between dyn Trait types that resembles vorner's suggestions in https://internals.rust-lang.org/t/wheres-the…

---

## [Generics are not zero cost?](https://internals.rust-lang.org/t/generics-are-not-zero-cost/11688)

<div class="topic-metadata">

**Author:** [@rsnakard-r7](https://internals.rust-lang.org/u/rsnakard-r7)\
**Replies:** 7\
**Last updated:** [January 23, 2020, 4:59pm UTC](https://internals.rust-lang.org/t/generics-are-not-zero-cost/11688 "2020-01-23T16:59:22Z")

</div>

Hey compiler team, I came across this post from a while back and decided to take off with it. It started out as a quest to see whether the dynamic dispatch really had a that huge of an overhead but I ended up finding so…

---

## [Traits working group meeting minutes](https://internals.rust-lang.org/t/traits-working-group-meeting-minutes/9519)

<div class="topic-metadata">

**Author:** [@nikomatsakis](https://internals.rust-lang.org/u/nikomatsakis)\
**Replies:** 3\
**Last updated:** [March 11, 2019, 7:51pm UTC](https://internals.rust-lang.org/t/traits-working-group-meeting-minutes/9519 "2019-03-11T19:51:41Z")

</div>

Hello, world! :heart: We’re trying to get this traits working group going full steam, and this thread is a place for us to note down the results from our meetings. Our meetings are typically held on Zulip and you can fi…

---

## [Getting traits WG up and going](https://internals.rust-lang.org/t/getting-traits-wg-up-and-going/6858)

<div class="topic-metadata">

**Author:** [@nikomatsakis](https://internals.rust-lang.org/u/nikomatsakis)\
**Replies:** 10\
**Last updated:** [October 5, 2018, 6:38pm UTC](https://internals.rust-lang.org/t/getting-traits-wg-up-and-going/6858 "2018-10-05T18:38:18Z")

</div>

Hi all, First off, I want to apologize for the radio silence on this working group. It's been harder than I anticipated to come up get a good crop of "start issues" and so forth. In general, I feel like we're still tryi…

---

## [WG-Traits Minutes and General Discussion](https://internals.rust-lang.org/t/wg-traits-minutes-and-general-discussion/6928)

<div class="topic-metadata">

**Author:** [@nikomatsakis](https://internals.rust-lang.org/u/nikomatsakis)\
**Replies:** 41\
**Last updated:** [April 30, 2018, 7:48pm UTC](https://internals.rust-lang.org/t/wg-traits-minutes-and-general-discussion/6928 "2018-04-30T19:48:04Z")

</div>

This is a running thread devoted to the goal of spiking a chalk-style trait solver in rustc. As not everyone is able to attend the meetings, I intend to post updates in here for asynchronous consumption and further discu…

---

## [Short-lived inference contexts](https://internals.rust-lang.org/t/short-lived-inference-contexts/7066)

<div class="topic-metadata">

**Author:** [@nikomatsakis](https://internals.rust-lang.org/u/nikomatsakis)\
**Replies:** 0\
**Last updated:** [March 16, 2018, 9:16am UTC](https://internals.rust-lang.org/t/short-lived-inference-contexts/7066 "2018-03-16T09:16:20Z")

</div>

So as part of the effort to “spike” a chalk-based solver, I’ve been investigating how to integrate Chalk’s SLG solver into Rust’s inference contexts. I’ve now opened up a PR on the Chalk repo that takes a particular appr…
