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

Add Bitwise::{swap_bytes, rotate_left, rotate_right} methods #14866

Merged
merged 1 commit into from Jun 14, 2014

Conversation

brendanzab
Copy link
Member

No description provided.

@emberian
Copy link
Member

Travis failure seems spurious


#[inline]
fn rotate_right(&self, r: uint) -> $t {
(*self >> r) | (*self << ($bits - r))
Copy link
Member

Choose a reason for hiding this comment

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

Could you add a test for negative signed integers? The right shift may propagate the left-most bit. and corrupt things.

You might have to add a cast to an unsigned integer.

@brendanzab
Copy link
Member Author

Fixed the corruption issue.

Trying to think of come tests to include in uint_macros.rs and int_macros.rs. Any ideas?

@alexcrichton
Copy link
Member

I pointed out to @bjz on IRC that we have tests in the std macros, but not the core macros.

@brendanzab
Copy link
Member Author

Unit tests added!

bors added a commit that referenced this pull request Jun 14, 2014
@bors bors closed this Jun 14, 2014
@bors bors merged commit ffa4ae8 into rust-lang:master Jun 14, 2014
@brendanzab brendanzab deleted the bitwise branch June 14, 2014 03:11
bors added a commit to rust-lang-ci/rust that referenced this pull request Jun 5, 2023
…kdown, r=Veykril

[editors/code] add markdown syntax highlighting to doc comments

_This is a continuation of microsoft/vscode#169956 and dustypomerleau/rust-syntax#37 (that repo is no longer maintained: dustypomerleau/rust-syntax#39 (comment)). The VS Code team seemed to prefer this being inside of an extension._

This adds Markdown highlighting to doc comment lines and blocks. Currently it is thus regarded both as a comment and as Markdown which leads to normally foreground text being in the colour of the comment and the rest highlighted like Markdown or its own embedded languages in code blocks.

![image](https://github.com/rust-lang/rust-analyzer/assets/1593486/c84f2e83-faea-47ca-853d-3728a07b2b66)

![image](https://github.com/rust-lang/rust-analyzer/assets/1593486/f4191425-32cd-451c-ae3a-29a0970ce7a2)

Block comments are supported, but currently not when there is a `*` at the start of the line:
![image](https://github.com/rust-lang/rust-analyzer/assets/1593486/ce3b58d5-9dca-4376-bffe-4f5a54acbe37)
![image](https://github.com/rust-lang/rust-analyzer/assets/1593486/b73a5ee6-a178-4aef-a0e4-3d75e4e7d8e5)

I'm not entirely sure if I can easily fix this, I'd need to find a way to make the content ignore the `*`. Though I'm unsure if it's important as there are [conventions against using block comments](
https://rust-lang.github.io/rfcs/1574-more-api-documentation-conventions.html#use-line-comments) and using them without `*` does work. All of this TextMate grammar is so hard to find documentation on that _honestly_ I'd just not want to support this considering the effort.

Let me know what everyone thinks of this being in rust-analyzer. I've personally found it hard to write large amounts of Rust documentation due to the lack of Markdown syntax highlighting.

Also, thank you `@adenine-dev` as well for making this available in the interim and your enthousiasm. Wanted to get this PR out sooner, but life gets in the way.
lnicola pushed a commit to lnicola/rust that referenced this pull request Jun 19, 2023
Enables Markdown injection introduced in rust-lang#14866 but wasn't included in release due to it being ignored.
lnicola pushed a commit to lnicola/rust that referenced this pull request Jun 19, 2023
…nicola

fix: exclude Markdown injection grammar from .vscodeignore.

Enables Markdown injection introduced in rust-lang#14866 but wasn't included in release due to the grammar file being ignored by `.vscodeignore`. I verified the fix by doing `vsce package` and installing it manually:

<img width="779" alt="image" src="https://github.com/rust-lang/rust-analyzer/assets/1593486/bb3da211-a017-45bf-ba7b-4122335aa6e8">

<img width="780" alt="image" src="https://github.com/rust-lang/rust-analyzer/assets/1593486/aa0c4025-e72c-4b0c-9d40-44c33e7d45e6">
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.

None yet

4 participants