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

libsyntax: librustdoc: ignore utf-8 BOM in .rs files #12976

Closed
wants to merge 1 commit into from

Conversation

liigo
Copy link
Contributor

@liigo liigo commented Mar 17, 2014

Closes #12974

@@ -463,6 +463,14 @@ impl<'a> SourceCollector<'a> {
};
let contents = str::from_utf8_owned(contents).unwrap();

// Remove the utf-8 BOM bytes if any
let contents = if contents.len() > 2 && contents[0] == 0xefu8 &&
Copy link
Member

Choose a reason for hiding this comment

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

Better written as contents.starts_with("\ufeff") (or contents.as_bytes().starts_with([0xEF, 0xBB, 0xBF])).

@huonw
Copy link
Member

huonw commented Mar 17, 2014

This needs a rebase.

@liigo
Copy link
Contributor Author

liigo commented Mar 18, 2014

@huonw Comments addressed, and rebased.

let mut files = self.files.borrow_mut();
let start_pos = match files.get().last() {
None => 0,
Some(last) => last.deref().start_pos.to_uint() + last.deref().src.len(),
};

// Remove utf-8 BOM if any.
// FIXME: I haven't found an efficient way to remove it from ~vec/~str,
Copy link
Member

Choose a reason for hiding this comment

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

Better written as FIXME #12884: no efficient/safe way to remove from the start of a string and reuse the allocation.

@liigo
Copy link
Contributor Author

liigo commented Mar 18, 2014

@huonw Updated. r?

@bors bors closed this in 87e72c3 Mar 19, 2014
JohnTitor pushed a commit to JohnTitor/rust that referenced this pull request Aug 30, 2022
feat: emit SCIP from rust-analyzer

hi rust-analyzer team

I'm one of the engineers at Sourcegraph (and have done a few small changes related to the LSIF work done in rust-analyzer). Recently, we've moved to a new protocol as the primary way to interact with Sourcegraph (LSIF is still possible to upload, so existing jobs will not stop working any time soon). This new protocol is SCIP (I linked a blog post below with more information).

I've implemented SCIP support (based largely on the existing LSIF support). In addition to supporting the existing features that `rust-analyzer`'s LSIF support does, this PR adds the ability to move between crates on sourcegraph.com. So if both your project and a dependency are indexed, you would be able to hop to the particular version and view the source code. I'd be happy to record a demo of that on my local instance if you're interested.

There are a few TODO's left in the code (some that you might have insights on) which I'm happy to fix in this PR, but I just wanted to open this up for discussion first.

Thanks for your time :)

TJ

- [announcing scip](https://about.sourcegraph.com/blog/announcing-scip)
flip1995 pushed a commit to flip1995/rust that referenced this pull request Jul 11, 2024
…ednet

Fix some false-positive cases of `explicit_auto_deref`

changelog: [`explicit_auto_deref`] Fix some false-positive cases

Fix part of rust-lang#9841
Fix  rust-lang#12969

r? xFrednet
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.

Can't compile .rs files with utf-8 BOM
2 participants