jamesmunns

Doing embedded stuff

Be nice, work hard. Build tools, tell stories. Start five year fights. Kein Ort für Nazis.


A list of all the other services I'm on around the internet


Posts with code highlighted with codehost by @wavebeem.


All posts licensed under CC-BY-SA 4.0, unless otherwise stated.


oli-obk
@oli-obk

TAITs have been troubled by obscure rules around when exactly you may register a hidden type for a while. Additionally the implementation was backwards out of concerns that query caching for the trait solver queries would regress in performance if we'd use a new magical where bound. We're now simplifying the impl and making the language rules clearer at the same time. The way we do that is by adding a #[defines(Foo)] attribute that you can slap on functions to allow them to actually register hidden types for Foo.

Anyway, what I actually wanted to share was this funny diagnostic that I saw because I typoed a lower case char as an upper case one:

error[E0412]: cannot find type `FooT` in this scope
  --> $DIR/nested_type_alias_impl_trait.rs:16:15
   |
LL |     pub type Foot = impl Debug;
   |     --------------------------- similarly named type alias `Foot` defined here
...
LL |     #[defines(FooT)]
   |               ^^^^ help: a type alias with a similar name exists: `Foot`

We can now have types in attributes. This is not even hacky and easy to reproduce for other cases. Bring me your worst proposals around that :D


You must log in to comment.