Skip to content
Merged
Changes from 3 commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
0beba7c
fix: Fix incorrectly replacing references in macro invocation in "Con…
jinohkang-theori Nov 14, 2023
bf645be
Put copyright on a line by itself.
jonathanpallant Nov 22, 2023
11a70f6
also make 'core_intrinsics' internal
RalfJung Nov 22, 2023
5ef5e55
Use a u64 for the rmeta root position
saethlin Nov 27, 2023
76c972c
Rollup merge of #118123 - RalfJung:internal-lib-features, r=compiler-…
compiler-errors Dec 5, 2023
5f95765
fix: Fix fragment parser replacing matches with dummies on incomplete…
Veykril Dec 8, 2023
5285df4
remove redundant imports
surechen Nov 10, 2023
f9453e3
Apply suggestions from code review
saethlin Dec 11, 2023
f532576
Merge commit '457b966b171b09a7e57acb710fbca29a4b3526f0' into sync-fro…
lnicola Dec 11, 2023
71d98c5
Fix typo in cfg
lnicola Dec 11, 2023
be6d34b
Query for nearest parent block around the hint to resolve
SomeoneToIgnore Dec 11, 2023
8ae42b5
Search for parent blocks and items when resolving inlay hints
SomeoneToIgnore Dec 11, 2023
3aa6306
Auto merge of #16089 - SomeoneToIgnore:fix-parameter-inlay-hints-reso…
bors Dec 11, 2023
4e82988
Auto merge of #118344 - saethlin:rmeta-header-pos, r=WaffleLapkin
bors Dec 11, 2023
18591ae
Always render the path to be imported in the completion detail
Veykril Dec 11, 2023
801c0ea
Replace `doc_comments_and_attrs` with `collect_attrs`, 2nd round
HKalbasi Dec 11, 2023
8c3e28e
Auto merge of #16094 - HKalbasi:rustc-tests-fixup, r=HKalbasi
bors Dec 11, 2023
a254cc5
Rollup merge of #118445 - ferrocene:jp-support-reuse-in-submodules, r…
matthiaskrgr Dec 12, 2023
be035e8
Auto merge of #118817 - lnicola:sync-from-ra, r=lnicola
bors Dec 12, 2023
df7b428
Merge branch 'master' into sync-from-rust
lnicola Dec 12, 2023
54acf87
Fix formatting
lnicola Dec 12, 2023
13d4609
Merge remote-tracking branch 'upstream/master' into sync-from-rust
lnicola Dec 12, 2023
e004a5d
Auto merge of #16098 - lnicola:sync-from-rust, r=lnicola
bors Dec 12, 2023
34ec665
Simplify and improve perf of import_assets::import_for_item
Veykril Dec 12, 2023
1604ad1
Bump DEFAULT_QUERY_SEARCH_LIMIT from 40 to 100
Veykril Dec 12, 2023
d4accf8
Auto merge of #16099 - Veykril:flyimport, r=Veykril
bors Dec 12, 2023
ca995d7
fix: Fix `import_map::search_dependencies` getting confused by assoc …
Veykril Dec 12, 2023
dd42c14
Auto merge of #16101 - Veykril:search-depedencies-fix, r=Veykril
bors Dec 12, 2023
c30fd42
Publish line-index
lnicola Dec 12, 2023
785bccb
Auto merge of #16102 - lnicola:publish-libs, r=lnicola
bors Dec 12, 2023
3b23e9a
Bump line-index
lnicola Dec 12, 2023
98a8053
Auto merge of #16104 - lnicola:bump-line-index, r=lnicola
bors Dec 12, 2023
c209b5f
fix: Fix syntax bridge assigning invalid span to lifetime tokens
Veykril Dec 12, 2023
5d7453c
Auto merge of #16106 - Veykril:fix-lifetime-span-split, r=Veykril
bors Dec 12, 2023
7cc6b0f
Partially revert #16101
Veykril Dec 12, 2023
b3af191
Auto merge of #16107 - Veykril:rev-16101, r=Veykril
bors Dec 12, 2023
94af6c6
Auto merge of #16061 - Veykril:vec-completion, r=Veykril
bors Dec 13, 2023
6a40400
Update builtin attrs from rustc
HKalbasi Dec 13, 2023
f81bd0c
Auto merge of #16115 - HKalbasi:rustc-tests-fixup, r=lnicola
bors Dec 13, 2023
dd07f1f
Auto merge of #15887 - jinohkang-theori:fix/ide-assists/convert_tuple…
bors Dec 13, 2023
070cd4e
minor: Add messages to some asserts for better debugging
Veykril Dec 14, 2023
35e2f13
Auto merge of #16121 - Veykril:assert-messages, r=Veykril
bors Dec 14, 2023
9083017
Remove `ModuleId` from `TypeOwnerId`
Veykril Dec 14, 2023
7b9595a
Run rust-analyzer on rustc tests in metrics
HKalbasi Dec 14, 2023
96f6608
Auto merge of #16125 - HKalbasi:rustc-tests, r=HKalbasi
bors Dec 14, 2023
4c45d23
fix: Syntax fixup now removes subtrees with fake spans
Veykril Dec 15, 2023
34d572e
Auto merge of #16130 - Veykril:syntax-fixup, r=Veykril
bors Dec 15, 2023
a776419
Auto merge of #16123 - Veykril:simplify, r=Veykril
bors Dec 15, 2023
4f72216
Fix false positive type mismatch in const reference patterns
HKalbasi Dec 15, 2023
fa5a327
Use depth 1 in git clone
HKalbasi Dec 15, 2023
21b06c1
Auto merge of #16131 - HKalbasi:rustc-tests-fixup, r=HKalbasi
bors Dec 15, 2023
ebba9b3
Merge commit '21b06c1beb9bb59369ffd652f5d617bcf6952e05' into sync-fro…
lnicola Dec 18, 2023
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
31 changes: 18 additions & 13 deletions crates/proc-macro-api/src/version.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ fn read_section<'a>(dylib_binary: &'a [u8], section_name: &str) -> io::Result<&'
}

/// Check the version of rustc that was used to compile a proc macro crate's
///
/// binary file.
///
/// A proc macro crate binary's ".rustc" section has following byte layout:
/// * [b'r',b'u',b's',b't',0,0,0,5] is the first 8 bytes
/// * ff060000 734e6150 is followed, it's the snappy format magic bytes,
Expand All @@ -96,8 +96,8 @@ fn read_section<'a>(dylib_binary: &'a [u8], section_name: &str) -> io::Result<&'
/// The bytes you get after decompressing the snappy format portion has
/// following layout:
/// * [b'r',b'u',b's',b't',0,0,0,5] is the first 8 bytes(again)
/// * [crate root bytes] next 4 bytes is to store crate root position,
/// according to rustc's source code comment
/// * [crate root bytes] next 8 bytes (4 in old versions) is to store
/// crate root position, according to rustc's source code comment
/// * [length byte] next 1 byte tells us how many bytes we should read next
/// for the version string's utf8 bytes
/// * [version string bytes encoded in utf8] <- GET THIS BOI
Expand All @@ -119,14 +119,19 @@ pub fn read_version(dylib_path: &AbsPath) -> io::Result<String> {
}
let version = u32::from_be_bytes([dot_rustc[4], dot_rustc[5], dot_rustc[6], dot_rustc[7]]);
// Last supported version is:
// https://github.com/rust-lang/rust/commit/0696e79f2740ad89309269b460579e548a5cd632
let snappy_portion = match version {
5 | 6 => &dot_rustc[8..],
// https://github.com/rust-lang/rust/commit/b94cfefc860715fb2adf72a6955423d384c69318
let (snappy_portion, bytes_before_version) = match version {
5 | 6 => (&dot_rustc[8..], 13),
7 | 8 => {
let len_bytes = &dot_rustc[8..12];
let data_len = u32::from_be_bytes(len_bytes.try_into().unwrap()) as usize;
&dot_rustc[12..data_len + 12]
(&dot_rustc[12..data_len + 12], 13)
}
9 => {
let len_bytes = &dot_rustc[8..16];
let data_len = u64::from_le_bytes(len_bytes.try_into().unwrap()) as usize;
(&dot_rustc[16..data_len + 12], 17)
}
_ => {
return Err(io::Error::new(
io::ErrorKind::InvalidData,
Expand All @@ -142,15 +147,15 @@ pub fn read_version(dylib_path: &AbsPath) -> io::Result<String> {
Box::new(SnapDecoder::new(snappy_portion))
};

// the bytes before version string bytes, so this basically is:
// We're going to skip over the bytes before the version string, so basically:
// 8 bytes for [b'r',b'u',b's',b't',0,0,0,5]
// 4 bytes for [crate root bytes]
// 4 or 8 bytes for [crate root bytes]
// 1 byte for length of version string
// so 13 bytes in total, and we should check the 13th byte
// so 13 or 17 bytes in total, and we should check the last of those bytes
// to know the length
let mut bytes_before_version = [0u8; 13];
uncompressed.read_exact(&mut bytes_before_version)?;
let length = bytes_before_version[12];
let mut bytes = [0u8; 17];
uncompressed.read_exact(&mut bytes[..bytes_before_version])?;
let length = bytes[bytes_before_version - 1];

let mut version_string_utf8 = vec![0u8; length as usize];
uncompressed.read_exact(&mut version_string_utf8)?;
Expand Down