Skip to content

fail and fail_bounds_checks lang items should take &'static str not *u8 #12378

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

Closed
huonw opened this issue Feb 19, 2014 · 1 comment
Closed

fail and fail_bounds_checks lang items should take &'static str not *u8 #12378

huonw opened this issue Feb 19, 2014 · 1 comment
Labels
C-cleanup Category: PRs that clean code up or issues documenting cleanup.

Comments

@huonw
Copy link
Member

huonw commented Feb 19, 2014

These lang items are currently defined as

pub fn fail_(expr: *u8, file: *u8, line: uint) -> !
pub fn fail_bounds_check(file: *u8, line: uint, index: uint, len: uint) -> !

We convert the expr and file arguments to &'static str via unsafe internally, but we could just avoid this and have the compiler emit them as slices rather than C strings.

cc #12357.

@treeman
Copy link
Contributor

treeman commented Aug 23, 2014

This has been fixed, they are now

fn fail_(expr_file_line: &(&'static str, &'static str, uint)) -> !
fn fail_bounds_check(file_line: &(&'static str, uint), index: uint, len: uint) -> !

Can close this issue.

matthiaskrgr pushed a commit to matthiaskrgr/rust that referenced this issue Mar 21, 2024
…xyas

Add new `duplicated_attributes` lint

It's a lint idea that `@llogiq` gave me while reviewing another PR.

There are some limitations, in particular for the "output". Initially I wanted to make it possible for directly lint against the whole attribute if its parts were all duplicated, but then I realized that the output would be chaotic if the duplicates were coming from different attributes, so I preferred to go to the simplest way and simply emit a warning for each entry. Not the best, but makes the implementation much easier.

Another limitation is that `cfg_attr` would be a bit more tricky to implement because we need to check if two `cfg` sets are exactly the same. I added a FIXME and will likely come back to it later.

And finally, I updated the `cargo dev update_lints` command because the generated `tests/ui/rename.rs` file was emitting the `duplicated_attributes` lint, so I allowed this lint inside it to prevent it from working.

changelog: Add new `duplicated_attributes` lint
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-cleanup Category: PRs that clean code up or issues documenting cleanup.
Projects
None yet
Development

No branches or pull requests

3 participants