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

Use the sugary syntax to print the Fn traits in error messages #19912

Merged
merged 1 commit into from
Dec 17, 2014

Conversation

ftxqxd
Copy link
Contributor

@ftxqxd ftxqxd commented Dec 16, 2014

This is to encourage the use of the sugary syntax instead of the <> syntax, which will not be usable post-1.0. Rustdoc still uses the <> syntax, so if a rustdoc wizard is looking for something to do, it would be nice to use the parenthetical syntax there as well. (I tried to patch rustdoc as well, but failed…)

let did = trait_def.trait_ref.def_id;
let is_fn_trait = cx.lang_items.fn_trait().map_or(false, |id| id == did)
|| cx.lang_items.fn_mut_trait().map_or(false, |id| id == did)
|| cx.lang_items.fn_once_trait().map_or(false, |id| id == did);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this logic for is_fn_trait be refactored into the parameterized function? You could just pass in the def_id and it could internally check for these traits.

@ftxqxd
Copy link
Contributor Author

ftxqxd commented Dec 16, 2014

@alexcrichton I found out about LanguageItems::fn_trait_kind, so I adjusted the code to use that, and addressed your comment. r?

@alexcrichton
Copy link
Member

Aha, nice catch!

bors added a commit that referenced this pull request Dec 17, 2014
Use the sugary syntax to print the `Fn` traits in error messages

Reviewed-by: alexcrichton
bors referenced this pull request Dec 17, 2014
Using a type alias for iterator implementations is fragile since this
exposes the implementation to users of the iterator, and any changes
could break existing code.

This commit changes the iterators of `VecMap` to use
proper new types, rather than type aliases.  However, since it is
fair-game to treat a type-alias as the aliased type, this is a:

[breaking-change].
alexcrichton added a commit to alexcrichton/rust that referenced this pull request Dec 17, 2014
This is to encourage the use of the sugary syntax instead of the `<>` syntax, which will not be usable post-1.0. Rustdoc [still uses the `<>` syntax](rust-lang#19909), so if a rustdoc wizard is looking for something to do, it would be nice to use the parenthetical syntax there as well. (I tried to patch rustdoc as well, but failed…)
@bors bors merged commit 570325d into rust-lang:master Dec 17, 2014
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

Successfully merging this pull request may close these issues.

3 participants