Skip to content

Clean up E0754 explanation #75626

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 2 commits into from
Aug 18, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 5 additions & 9 deletions src/librustc_error_codes/error_codes/E0754.md
Original file line number Diff line number Diff line change
@@ -1,31 +1,27 @@
An non-ascii identifier was used in an invalid context.

Erroneous code example:
Erroneous code examples:

```compile_fail,E0754
# #![feature(non_ascii_idents)]

mod řųśť;
// ^ error!
fn main() {}
```

```compile_fail,E0754
# #![feature(non_ascii_idents)]

#[no_mangle]
fn řųśť() {}
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not make it error on the same line like ok on the same line as below?

// ^ error!
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not make it error on the same line like ok on the same line as below?

Suggested change
fn řųśť() {}
// ^ error!
fn řųśť() {} // error!


fn main() {}
```

Non-ascii can be used as module names if it is inline
or a #\[path\] attribute is specified. For example:
Non-ascii can be used as module names if it is inline or a `#[path]` attribute
Copy link
Contributor

@pickfire pickfire Aug 17, 2020

Choose a reason for hiding this comment

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

#[path] attribute? What is that, should we do a link to that page?

Suggested change
Non-ascii can be used as module names if it is inline or a `#[path]` attribute
Non-ascii can be used as module names if it is inlined or a `#[path]` attribute

Should it be "inlined" rather than "inline"?

Copy link
Member Author

Choose a reason for hiding this comment

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

Absolutely! As for the path attribute, it allows you to link to a file module by its system path and give it a different name.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, but should we link it to the reference to let the users know what is that? I feel like this is a less known item.

Copy link
Member Author

Choose a reason for hiding this comment

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

The problem with external links is that they might change (for example in this case, this is: https://doc.rust-lang.org/reference/items/modules.html#the-path-attribute), even if they're part of the rust book.

Copy link
Contributor

Choose a reason for hiding this comment

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

But don't we have link check?

Copy link
Member Author

Choose a reason for hiding this comment

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

Only when referring to items inside the docs scope (so relative paths, not absolute ones).

is specified. For example:

```
# #![feature(non_ascii_idents)]

mod řųśť {
mod řųśť { // ok!
const IS_GREAT: bool = true;
}

Expand Down