Skip to content
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

Ability to have *-pointers as arguments to MethodDefs #16781

Closed
Manishearth opened this issue Aug 27, 2014 · 3 comments
Closed

Ability to have *-pointers as arguments to MethodDefs #16781

Manishearth opened this issue Aug 27, 2014 · 3 comments

Comments

@Manishearth
Copy link
Member

I'm trying to write a syntax extension that works similar to #[deriving(Encodable)], where a trait JSTraceable can be applied to types where all subfields implement that JSTraceable, such that calling .trace() will simply call .trace() on all subfields with the same arguments (there is no output to be treed up like with Clone and PartialEq)

The signature I want is the following:

trait Traceable {
    fn trace(&self, trc: *mut JSTracer);
}

However, there's a problem here. Following the internal implementation, I need to supply a MethodDef, which includes an argument list of Tys

However,Ty doesn't support *-pointers, so I will probably have to work around this with a second trait and some transmutes (which I'd rather not do)

Could we get support for * pointers in MethodDef?

@huonw
Copy link
Member

huonw commented Aug 27, 2014

Pull requests accepted; this is a deeply unstable part of the compiler and so is free to change.

(I'm happy to mentor, but I think it should be as easy as adding the right thing to this enum and follow the compiler output to add the appropriate handling in the right places, i.e. converting to an syntax::ast::TyPtr.)

@Manishearth
Copy link
Member Author

Ooh, I'd love to fix it if it's just adding an enum and then doing a couple of conversions.

Raw(Mutability) seems like a way to start. Don't know how to test this without writing a bagful of libsyntax code, though :)

@Manishearth
Copy link
Member Author

Side note: ast::Ty_ and ext::build::AstBuilder need docs.

@bors bors closed this as completed in 2b312ec Aug 31, 2014
matthiaskrgr pushed a commit to matthiaskrgr/rust that referenced this issue Mar 10, 2024
…ing, r=Veykril

fix: Don't escape `\` and `$` in "Extract format expressions" assist

Fixes rust-lang#16745
matthiaskrgr pushed a commit to matthiaskrgr/rust that referenced this issue Mar 10, 2024
…nts, r=Veykril

fix: Preserve $ and \ in postfix format completions

`parse_format_exprs` doesn't escape these two as of rust-lang#16781, so they have to be escaped as a separate step.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants