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

Construct rocket_param_ idents from the function arguments #778

Closed
wants to merge 1 commit into from

Conversation

jebrosen
Copy link
Collaborator

...instead of the route string. Should fix #635.

The included test fails in current v0.3 but passes with this change. The test might also be useful in the master branch, but the bug may no longer be present once #[route] is re-implemented for #693.

None => {
self.missing_declared_err(ecx, param.inner());
continue;
}
};

let ty = strip_ty_lifetimes(arg.ty.clone());
let ident = arg.ident().expect("function argument ident").prepend(PARAM_PREFIX);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Is it correct to expect this? I didn't look too thoroughly, but I think only PatKind::Ident is valid for FromParam guards, in practice.

Copy link
Member

Choose a reason for hiding this comment

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

Yes; the find_input() method only returns Some if ident() here would return Some. Since we bailed on the None case above, this is safe.

@SergioBenitez
Copy link
Member

Merged in eb1ce54.

@SergioBenitez SergioBenitez added the pr: merged This pull request was merged manually. label Sep 25, 2018
@jebrosen jebrosen deleted the fix_route_param_ident branch October 10, 2018 06:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr: merged This pull request was merged manually.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants