Skip to content

Commit cf38b8e

Browse files
committed
Auto merge of #143157 - matthiaskrgr:rollup-90rtm3a, r=matthiaskrgr
Rollup of 9 pull requests Successful merges: - #123476 (std::net: adding `unix_socket_exclbind` feature for solaris/illumos.) - #142708 (Do not include NUL-terminator in computed length) - #142963 (Skip unnecessary components in x64 try builds) - #142987 (rustdoc: show attributes on enum variants) - #143031 (Add windows-gnullvm hosts to the manifest) - #143082 (update internal `send_signal` comment) - #143110 (Use tidy to sort `sym::*` items) - #143111 (BTreeSet: remove duplicated code by reusing `from_sorted_iter`) - #143114 (Minor Documentation Improvements) r? `@ghost` `@rustbot` modify labels: rollup try-job: dist-i586-gnu-i586-i686-musl
2 parents 11ad40b + a62de82 commit cf38b8e

File tree

24 files changed

+277
-128
lines changed

24 files changed

+277
-128
lines changed

compiler/rustc_const_eval/src/util/caller_location.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,14 @@ fn alloc_caller_location<'tcx>(
2121
assert!(!filename.as_str().as_bytes().contains(&0));
2222

2323
let loc_details = ecx.tcx.sess.opts.unstable_opts.location_detail;
24-
let file_wide_ptr = {
24+
let filename = {
2525
let filename = if loc_details.file { filename.as_str() } else { "<redacted>" };
2626
let filename_with_nul = filename.to_owned() + "\0";
2727
// This can fail if rustc runs out of memory right here. Trying to emit an error would be
2828
// pointless, since that would require allocating more memory than these short strings.
2929
let file_ptr = ecx.allocate_bytes_dedup(filename_with_nul.as_bytes()).unwrap();
30-
Immediate::new_slice(file_ptr.into(), filename_with_nul.len().try_into().unwrap(), ecx)
30+
let file_len = u64::try_from(filename.len()).unwrap();
31+
Immediate::new_slice(file_ptr.into(), file_len, ecx)
3132
};
3233
let line = if loc_details.line { Scalar::from_u32(line) } else { Scalar::from_u32(0) };
3334
let col = if loc_details.column { Scalar::from_u32(col) } else { Scalar::from_u32(0) };
@@ -41,11 +42,8 @@ fn alloc_caller_location<'tcx>(
4142
let location = ecx.allocate(loc_layout, MemoryKind::CallerLocation).unwrap();
4243

4344
// Initialize fields.
44-
ecx.write_immediate(
45-
file_wide_ptr,
46-
&ecx.project_field(&location, FieldIdx::from_u32(0)).unwrap(),
47-
)
48-
.expect("writing to memory we just allocated cannot fail");
45+
ecx.write_immediate(filename, &ecx.project_field(&location, FieldIdx::from_u32(0)).unwrap())
46+
.expect("writing to memory we just allocated cannot fail");
4947
ecx.write_scalar(line, &ecx.project_field(&location, FieldIdx::from_u32(1)).unwrap())
5048
.expect("writing to memory we just allocated cannot fail");
5149
ecx.write_scalar(col, &ecx.project_field(&location, FieldIdx::from_u32(2)).unwrap())

compiler/rustc_macros/src/symbols.rs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -190,17 +190,6 @@ fn symbols_with_errors(input: TokenStream) -> (TokenStream, Vec<syn::Error>) {
190190
let mut symbols_stream = quote! {};
191191
let mut prefill_stream = quote! {};
192192
let mut entries = Entries::with_capacity(input.keywords.len() + input.symbols.len() + 10);
193-
let mut prev_key: Option<(Span, String)> = None;
194-
195-
let mut check_order = |span: Span, s: &str, errors: &mut Errors| {
196-
if let Some((prev_span, ref prev_str)) = prev_key {
197-
if s < prev_str {
198-
errors.error(span, format!("Symbol `{s}` must precede `{prev_str}`"));
199-
errors.error(prev_span, format!("location of previous symbol `{prev_str}`"));
200-
}
201-
}
202-
prev_key = Some((span, s.to_string()));
203-
};
204193

205194
// Generate the listed keywords.
206195
for keyword in input.keywords.iter() {
@@ -219,7 +208,6 @@ fn symbols_with_errors(input: TokenStream) -> (TokenStream, Vec<syn::Error>) {
219208
// Generate the listed symbols.
220209
for symbol in input.symbols.iter() {
221210
let name = &symbol.name;
222-
check_order(symbol.name.span(), &name.to_string(), &mut errors);
223211

224212
let value = match &symbol.value {
225213
Value::SameAsName => name.to_string(),

compiler/rustc_macros/src/symbols/tests.rs

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -84,18 +84,3 @@ fn check_dup_symbol_and_keyword() {
8484
};
8585
test_symbols_macro(input, &["Symbol `splat` is duplicated", "location of previous definition"]);
8686
}
87-
88-
#[test]
89-
fn check_symbol_order() {
90-
let input = quote! {
91-
Keywords {}
92-
Symbols {
93-
zebra,
94-
aardvark,
95-
}
96-
};
97-
test_symbols_macro(
98-
input,
99-
&["Symbol `aardvark` must precede `zebra`", "location of previous symbol `zebra`"],
100-
);
101-
}

0 commit comments

Comments
 (0)