Skip to content

Add 5 more error explanations. Update E0015's explanation. Add an error code. #25873

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

Merged
merged 5 commits into from
May 30, 2015

Conversation

nham
Copy link
Contributor

@nham nham commented May 29, 2015

The E0397 explanation, as I've written it, isn't really an explanation, but I'm not sure what to put here. I will happily take suggestions.

Partially addresses #25851

@rust-highfive
Copy link
Contributor

r? @Aatch

(rust_highfive has picked a reviewer for you, use r? to override)

@Aatch
Copy link
Contributor

Aatch commented May 29, 2015

I think it makes more sense to link to the text of the RFC rather than the PR.

variant constructors or struct constructors (for unit or tuple structs). This
is because Rust currently does not support compile-time function execution.
The only function calls allowed in static or constant expressions are
constructors for enum variants and structs, or `const fn`s. Rust currently does
Copy link
Contributor

Choose a reason for hiding this comment

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

The fact that enum variants and tuple structs are function calls is just confusing here. Now const fn is a thing, it's probably better to just say "only const fns can be called in static or constant expressions, since they obviously would have seen this error by using a non-const fn call.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, good point.

@nham
Copy link
Contributor Author

nham commented May 29, 2015

@Aatch I agree, but I don't know of a way to wrap URLs in Markdown, and the lines have to be <= 80 chars. I can do this if I don't set the URL out separately, but generally this is less readable when printed out on the command line. For example, it would look like this:

The only function calls allowed in static or constant expressions are
constructors for enum variants and structs, or `const fn`s. Rust currently does
not support more general compile-time function execution.

See [RFC 911](https://github.com/rust-lang/rfcs/blob/master/text/0911-const-fn
.md) for more details on the design of `const fn`s.

Edit: Now that I think about it, I'm not sure that this works either. Github renders the URL here as https://github.com/rust-lang/rfcs/blob/master/text/0911-const-fn%0A.md

@nham
Copy link
Contributor Author

nham commented May 29, 2015

Ahh, I didn't see that the url for the text of RFC 911 is actually short enough to link to here. I've changed that. RFC 246's url is still too long

@Aatch
Copy link
Contributor

Aatch commented May 29, 2015

While I'd still prefer a link to the RFC text, I can see the issue. It's not too big of problem though.

@Aatch
Copy link
Contributor

Aatch commented May 29, 2015

@bors r+ fdf3ce7 rollup

steveklabnik added a commit to steveklabnik/rust that referenced this pull request May 29, 2015
The E0397 explanation, as I've written it, isn't really an explanation, but I'm not sure what to put here. I will happily take suggestions.

Partially addresses rust-lang#25851
steveklabnik added a commit to steveklabnik/rust that referenced this pull request May 29, 2015
The E0397 explanation, as I've written it, isn't really an explanation, but I'm not sure what to put here. I will happily take suggestions.

Partially addresses rust-lang#25851
bors added a commit that referenced this pull request May 29, 2015
@bors bors merged commit fdf3ce7 into rust-lang:master May 30, 2015
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.

4 participants