Auto merge of #89179 - the8472:rollup-moxrtaj, r=the8472
Rollup of 8 pull requests Successful merges: - #89036 (Fix missing `no_global_oom_handling` cfg-gating) - #89041 (Work around invalid DWARF bugs for fat LTO) - #89046 ("Fix" an overflow in byte position math) - #89127 (Re-enable the `src/test/debuginfo/mutex.rs` test on Windows) - #89133 (Fix ICE with `--cap-lints=allow` and `-Zfuel=...=0`) - #89162 (rustc_index: Add some map-like APIs to `IndexVec`) - #89164 (Document `--show-type-layout` in the rustdoc book) - #89170 (Disable the leak sanitizer on Macos aarch64 for now) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
commit
308dffd25c
@ -474,9 +474,10 @@ impl<'hir> LoweringContext<'_, 'hir> {
|
||||
res
|
||||
} else {
|
||||
// Associate an HirId to both ids even if there is no resolution.
|
||||
self.node_id_to_hir_id.ensure_contains_elem(new_node_id, || None);
|
||||
debug_assert!(self.node_id_to_hir_id[new_node_id].is_none());
|
||||
self.node_id_to_hir_id[new_node_id] = Some(hir::HirId::make_owner(new_id));
|
||||
let _old = self
|
||||
.node_id_to_hir_id
|
||||
.insert(new_node_id, hir::HirId::make_owner(new_id));
|
||||
debug_assert!(_old.is_none());
|
||||
continue;
|
||||
};
|
||||
let ident = *ident;
|
||||
|
@ -469,11 +469,8 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
|
||||
let def_id = self.resolver.local_def_id(owner);
|
||||
|
||||
// Always allocate the first `HirId` for the owner itself.
|
||||
self.node_id_to_hir_id.ensure_contains_elem(owner, || None);
|
||||
if let Some(_lowered) = self.node_id_to_hir_id[owner] {
|
||||
panic!("with_hir_id_owner must not be called multiple times on owner {:?}", def_id);
|
||||
}
|
||||
self.node_id_to_hir_id[owner] = Some(hir::HirId::make_owner(def_id));
|
||||
let _old = self.node_id_to_hir_id.insert(owner, hir::HirId::make_owner(def_id));
|
||||
debug_assert_eq!(_old, None);
|
||||
|
||||
let current_owner = std::mem::replace(&mut self.current_hir_id_owner, def_id);
|
||||
let current_local_counter =
|
||||
@ -484,8 +481,8 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
|
||||
self.current_hir_id_owner = current_owner;
|
||||
self.item_local_id_counter = current_local_counter;
|
||||
|
||||
self.owners.ensure_contains_elem(def_id, || None);
|
||||
self.owners[def_id] = Some(item);
|
||||
let _old = self.owners.insert(def_id, item);
|
||||
debug_assert!(_old.is_none());
|
||||
|
||||
def_id
|
||||
}
|
||||
@ -499,18 +496,13 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
|
||||
fn lower_node_id(&mut self, ast_node_id: NodeId) -> hir::HirId {
|
||||
assert_ne!(ast_node_id, DUMMY_NODE_ID);
|
||||
|
||||
self.node_id_to_hir_id.ensure_contains_elem(ast_node_id, || None);
|
||||
if let Some(existing_hir_id) = self.node_id_to_hir_id[ast_node_id] {
|
||||
existing_hir_id
|
||||
} else {
|
||||
*self.node_id_to_hir_id.get_or_insert_with(ast_node_id, || {
|
||||
// Generate a new `HirId`.
|
||||
let owner = self.current_hir_id_owner;
|
||||
let local_id = self.item_local_id_counter;
|
||||
self.item_local_id_counter.increment_by(1);
|
||||
let hir_id = hir::HirId { owner, local_id };
|
||||
self.node_id_to_hir_id[ast_node_id] = Some(hir_id);
|
||||
hir_id
|
||||
}
|
||||
hir::HirId { owner, local_id }
|
||||
})
|
||||
}
|
||||
|
||||
fn next_id(&mut self) -> hir::HirId {
|
||||
|
@ -325,6 +325,20 @@ fn fat_lto(
|
||||
drop(linker);
|
||||
save_temp_bitcode(&cgcx, &module, "lto.input");
|
||||
|
||||
// Fat LTO also suffers from the invalid DWARF issue similar to Thin LTO.
|
||||
// Here we rewrite all `DICompileUnit` pointers if there is only one `DICompileUnit`.
|
||||
// This only works around the problem when codegen-units = 1.
|
||||
// Refer to the comments in the `optimize_thin_module` function for more details.
|
||||
let mut cu1 = ptr::null_mut();
|
||||
let mut cu2 = ptr::null_mut();
|
||||
unsafe { llvm::LLVMRustLTOGetDICompileUnit(llmod, &mut cu1, &mut cu2) };
|
||||
if !cu2.is_null() {
|
||||
let _timer =
|
||||
cgcx.prof.generic_activity_with_arg("LLVM_fat_lto_patch_debuginfo", &*module.name);
|
||||
unsafe { llvm::LLVMRustLTOPatchDICompileUnit(llmod, cu1) };
|
||||
save_temp_bitcode(cgcx, &module, "fat-lto-after-patch");
|
||||
}
|
||||
|
||||
// Internalize everything below threshold to help strip out more modules and such.
|
||||
unsafe {
|
||||
let ptr = symbols_below_threshold.as_ptr();
|
||||
@ -748,7 +762,7 @@ pub unsafe fn optimize_thin_module(
|
||||
// an error.
|
||||
let mut cu1 = ptr::null_mut();
|
||||
let mut cu2 = ptr::null_mut();
|
||||
llvm::LLVMRustThinLTOGetDICompileUnit(llmod, &mut cu1, &mut cu2);
|
||||
llvm::LLVMRustLTOGetDICompileUnit(llmod, &mut cu1, &mut cu2);
|
||||
if !cu2.is_null() {
|
||||
let msg = "multiple source DICompileUnits found";
|
||||
return Err(write::llvm_err(&diag_handler, msg));
|
||||
@ -847,7 +861,7 @@ pub unsafe fn optimize_thin_module(
|
||||
let _timer = cgcx
|
||||
.prof
|
||||
.generic_activity_with_arg("LLVM_thin_lto_patch_debuginfo", thin_module.name());
|
||||
llvm::LLVMRustThinLTOPatchDICompileUnit(llmod, cu1);
|
||||
llvm::LLVMRustLTOPatchDICompileUnit(llmod, cu1);
|
||||
save_temp_bitcode(cgcx, &module, "thin-lto-after-patch");
|
||||
}
|
||||
|
||||
|
@ -2377,12 +2377,8 @@ extern "C" {
|
||||
len: usize,
|
||||
out_len: &mut usize,
|
||||
) -> *const u8;
|
||||
pub fn LLVMRustThinLTOGetDICompileUnit(
|
||||
M: &Module,
|
||||
CU1: &mut *mut c_void,
|
||||
CU2: &mut *mut c_void,
|
||||
);
|
||||
pub fn LLVMRustThinLTOPatchDICompileUnit(M: &Module, CU: *mut c_void);
|
||||
pub fn LLVMRustLTOGetDICompileUnit(M: &Module, CU1: &mut *mut c_void, CU2: &mut *mut c_void);
|
||||
pub fn LLVMRustLTOPatchDICompileUnit(M: &Module, CU: *mut c_void);
|
||||
|
||||
pub fn LLVMRustLinkerNew(M: &'a Module) -> &'a mut Linker<'a>;
|
||||
pub fn LLVMRustLinkerAdd(
|
||||
|
@ -13,9 +13,11 @@
|
||||
#[macro_use]
|
||||
extern crate rustc_macros;
|
||||
|
||||
#[macro_use]
|
||||
extern crate tracing;
|
||||
|
||||
pub use emitter::ColorConfig;
|
||||
|
||||
use tracing::debug;
|
||||
use Level::*;
|
||||
|
||||
use emitter::{is_case_difference, Emitter, EmitterWriter};
|
||||
|
@ -1072,13 +1072,9 @@ impl<R: Idx, C: Idx> SparseBitMatrix<R, C> {
|
||||
}
|
||||
|
||||
fn ensure_row(&mut self, row: R) -> &mut HybridBitSet<C> {
|
||||
// Instantiate any missing rows up to and including row `row` with an
|
||||
// empty HybridBitSet.
|
||||
self.rows.ensure_contains_elem(row, || None);
|
||||
|
||||
// Instantiate any missing rows up to and including row `row` with an empty HybridBitSet.
|
||||
// Then replace row `row` with a full HybridBitSet if necessary.
|
||||
let num_columns = self.num_columns;
|
||||
self.rows[row].get_or_insert_with(|| HybridBitSet::new_empty(num_columns))
|
||||
self.rows.get_or_insert_with(row, || HybridBitSet::new_empty(self.num_columns))
|
||||
}
|
||||
|
||||
/// Sets the cell at `(row, column)` to true. Put another way, insert
|
||||
|
@ -720,6 +720,21 @@ impl<I: Idx, T> IndexVec<I, T> {
|
||||
}
|
||||
}
|
||||
|
||||
/// `IndexVec` is often used as a map, so it provides some map-like APIs.
|
||||
impl<I: Idx, T> IndexVec<I, Option<T>> {
|
||||
#[inline]
|
||||
pub fn insert(&mut self, index: I, value: T) -> Option<T> {
|
||||
self.ensure_contains_elem(index, || None);
|
||||
self[index].replace(value)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn get_or_insert_with(&mut self, index: I, value: impl FnOnce() -> T) -> &mut T {
|
||||
self.ensure_contains_elem(index, || None);
|
||||
self[index].get_or_insert_with(value)
|
||||
}
|
||||
}
|
||||
|
||||
impl<I: Idx, T: Clone> IndexVec<I, T> {
|
||||
#[inline]
|
||||
pub fn resize(&mut self, new_len: usize, value: T) {
|
||||
|
@ -1747,7 +1747,7 @@ LLVMRustGetBitcodeSliceFromObjectData(const char *data,
|
||||
// Rewrite all `DICompileUnit` pointers to the `DICompileUnit` specified. See
|
||||
// the comment in `back/lto.rs` for why this exists.
|
||||
extern "C" void
|
||||
LLVMRustThinLTOGetDICompileUnit(LLVMModuleRef Mod,
|
||||
LLVMRustLTOGetDICompileUnit(LLVMModuleRef Mod,
|
||||
DICompileUnit **A,
|
||||
DICompileUnit **B) {
|
||||
Module *M = unwrap(Mod);
|
||||
@ -1765,7 +1765,7 @@ LLVMRustThinLTOGetDICompileUnit(LLVMModuleRef Mod,
|
||||
// Rewrite all `DICompileUnit` pointers to the `DICompileUnit` specified. See
|
||||
// the comment in `back/lto.rs` for why this exists.
|
||||
extern "C" void
|
||||
LLVMRustThinLTOPatchDICompileUnit(LLVMModuleRef Mod, DICompileUnit *Unit) {
|
||||
LLVMRustLTOPatchDICompileUnit(LLVMModuleRef Mod, DICompileUnit *Unit) {
|
||||
Module *M = unwrap(Mod);
|
||||
|
||||
// If the original source module didn't have a `DICompileUnit` then try to
|
||||
|
@ -6,6 +6,9 @@
|
||||
#![feature(box_patterns)]
|
||||
#![recursion_limit = "256"]
|
||||
|
||||
#[macro_use]
|
||||
extern crate tracing;
|
||||
|
||||
use rustc_ast as ast;
|
||||
use rustc_ast::token::{self, Nonterminal, Token, TokenKind};
|
||||
use rustc_ast::tokenstream::{self, AttributesData, CanSynthesizeMissingTokens, LazyTokenStream};
|
||||
|
@ -1084,6 +1084,7 @@ impl<'a> Parser<'a> {
|
||||
|
||||
/// If we encounter a parser state that looks like the user has written a `struct` literal with
|
||||
/// parentheses instead of braces, recover the parser state and provide suggestions.
|
||||
#[instrument(skip(self, seq, snapshot), level = "trace")]
|
||||
fn maybe_recover_struct_lit_bad_delims(
|
||||
&mut self,
|
||||
lo: Span,
|
||||
|
@ -902,7 +902,12 @@ impl Session {
|
||||
let mut fuel = self.optimization_fuel.lock();
|
||||
ret = fuel.remaining != 0;
|
||||
if fuel.remaining == 0 && !fuel.out_of_fuel {
|
||||
self.warn(&format!("optimization-fuel-exhausted: {}", msg()));
|
||||
if self.diagnostic().can_emit_warnings() {
|
||||
// We only call `msg` in case we can actually emit warnings.
|
||||
// Otherwise, this could cause a `delay_good_path_bug` to
|
||||
// trigger (issue #79546).
|
||||
self.warn(&format!("optimization-fuel-exhausted: {}", msg()));
|
||||
}
|
||||
fuel.out_of_fuel = true;
|
||||
} else if fuel.remaining > 0 {
|
||||
fuel.remaining -= 1;
|
||||
|
@ -25,6 +25,9 @@
|
||||
#[macro_use]
|
||||
extern crate rustc_macros;
|
||||
|
||||
#[macro_use]
|
||||
extern crate tracing;
|
||||
|
||||
use rustc_data_structures::AtomicRef;
|
||||
use rustc_macros::HashStable_Generic;
|
||||
use rustc_serialize::{Decodable, Decoder, Encodable, Encoder};
|
||||
@ -782,13 +785,30 @@ impl Span {
|
||||
/// ^^^^^^^^^^^^^^^^^
|
||||
/// ```
|
||||
pub fn until(self, end: Span) -> Span {
|
||||
let span = self.data();
|
||||
let end = end.data();
|
||||
// Most of this function's body is copied from `to`.
|
||||
// We can't just do `self.to(end.shrink_to_lo())`,
|
||||
// because to also does some magic where it uses min/max so
|
||||
// it can handle overlapping spans. Some advanced mis-use of
|
||||
// `until` with different ctxts makes this visible.
|
||||
let span_data = self.data();
|
||||
let end_data = end.data();
|
||||
// FIXME(jseyfried): `self.ctxt` should always equal `end.ctxt` here (cf. issue #23480).
|
||||
// Return the macro span on its own to avoid weird diagnostic output. It is preferable to
|
||||
// have an incomplete span than a completely nonsensical one.
|
||||
if span_data.ctxt != end_data.ctxt {
|
||||
if span_data.ctxt == SyntaxContext::root() {
|
||||
return end;
|
||||
} else if end_data.ctxt == SyntaxContext::root() {
|
||||
return self;
|
||||
}
|
||||
// Both spans fall within a macro.
|
||||
// FIXME(estebank): check if it is the *same* macro.
|
||||
}
|
||||
Span::new(
|
||||
span.lo,
|
||||
end.lo,
|
||||
if end.ctxt == SyntaxContext::root() { end.ctxt } else { span.ctxt },
|
||||
if span.parent == end.parent { span.parent } else { None },
|
||||
span_data.lo,
|
||||
end_data.lo,
|
||||
if end_data.ctxt == SyntaxContext::root() { end_data.ctxt } else { span_data.ctxt },
|
||||
if span_data.parent == end_data.parent { span_data.parent } else { None },
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -474,11 +474,12 @@ impl SourceMap {
|
||||
f.lookup_line(sp.lo()) != f.lookup_line(sp.hi())
|
||||
}
|
||||
|
||||
#[instrument(skip(self), level = "trace")]
|
||||
pub fn is_valid_span(&self, sp: Span) -> Result<(Loc, Loc), SpanLinesError> {
|
||||
let lo = self.lookup_char_pos(sp.lo());
|
||||
debug!("span_to_lines: lo={:?}", lo);
|
||||
trace!(?lo);
|
||||
let hi = self.lookup_char_pos(sp.hi());
|
||||
debug!("span_to_lines: hi={:?}", hi);
|
||||
trace!(?hi);
|
||||
if lo.file.start_pos != hi.file.start_pos {
|
||||
return Err(SpanLinesError::DistinctSources(DistinctSources {
|
||||
begin: (lo.file.name.clone(), lo.file.start_pos),
|
||||
|
@ -4,7 +4,9 @@ pub fn target() -> Target {
|
||||
let mut base = super::apple_base::opts("macos");
|
||||
base.cpu = "apple-a12".to_string();
|
||||
base.max_atomic_width = Some(128);
|
||||
base.supported_sanitizers = SanitizerSet::ADDRESS | SanitizerSet::LEAK | SanitizerSet::THREAD;
|
||||
|
||||
// FIXME: The leak sanitizer currently fails the tests, see #88132.
|
||||
base.supported_sanitizers = SanitizerSet::ADDRESS | SanitizerSet::THREAD;
|
||||
|
||||
base.pre_link_args.insert(LinkerFlavor::Gcc, vec!["-arch".to_string(), "arm64".to_string()]);
|
||||
base.link_env_remove.extend(super::apple_base::macos_link_env_remove());
|
||||
|
@ -1086,6 +1086,7 @@ unsafe impl<#[may_dangle] T: ?Sized, A: Allocator> Drop for Box<T, A> {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(no_global_oom_handling))]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<T: Default> Default for Box<T> {
|
||||
/// Creates a `Box<T>`, with the `Default` value for T.
|
||||
@ -1394,6 +1395,7 @@ impl<A: Allocator> From<Box<str, A>> for Box<[u8], A> {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(no_global_oom_handling))]
|
||||
#[stable(feature = "box_from_array", since = "1.45.0")]
|
||||
impl<T, const N: usize> From<[T; N]> for Box<[T]> {
|
||||
/// Converts a `[T; N]` into a `Box<[T]>`
|
||||
|
@ -2841,6 +2841,7 @@ impl<T: Clone> From<&mut [T]> for Vec<T> {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(no_global_oom_handling))]
|
||||
#[stable(feature = "vec_from_array", since = "1.44.0")]
|
||||
impl<T, const N: usize> From<[T; N]> for Vec<T> {
|
||||
#[cfg(not(test))]
|
||||
|
@ -209,6 +209,22 @@ some consideration for their stability, and names that end in a number). Giving
|
||||
`rustdoc` will disable this sorting and instead make it print the items in the order they appear in
|
||||
the source.
|
||||
|
||||
### `--show-type-layout`: add a section to each type's docs describing its memory layout
|
||||
|
||||
Using this flag looks like this:
|
||||
|
||||
```bash
|
||||
$ rustdoc src/lib.rs -Z unstable-options --show-type-layout
|
||||
```
|
||||
|
||||
When this flag is passed, rustdoc will add a "Layout" section at the bottom of
|
||||
each type's docs page that includes a summary of the type's memory layout as
|
||||
computed by rustc. For example, rustdoc will show the size in bytes that a value
|
||||
of that type will take in memory.
|
||||
|
||||
Note that most layout information is **completely unstable** and may even differ
|
||||
between compilations.
|
||||
|
||||
### `--resource-suffix`: modifying the name of CSS/JavaScript in crate docs
|
||||
|
||||
Using this flag looks like this:
|
||||
@ -333,7 +349,7 @@ Some methodology notes about what rustdoc counts in this metric:
|
||||
Public items that are not documented can be seen with the built-in `missing_docs` lint. Private
|
||||
items that are not documented can be seen with Clippy's `missing_docs_in_private_items` lint.
|
||||
|
||||
## `-w`/`--output-format`: output format
|
||||
### `-w`/`--output-format`: output format
|
||||
|
||||
When using
|
||||
[`--show-coverage`](https://doc.rust-lang.org/nightly/rustdoc/unstable-features.html#--show-coverage-get-statistics-about-code-documentation-coverage),
|
||||
|
@ -1663,7 +1663,7 @@ fn document_type_layout(w: &mut Buffer, cx: &Context<'_>, ty_def_id: DefId) {
|
||||
writeln!(
|
||||
w,
|
||||
"<div class=\"warning\"><p><strong>Note:</strong> Most layout information is \
|
||||
completely unstable and may be different between compiler versions and platforms. \
|
||||
<strong>completely unstable</strong> and may even differ between compilations. \
|
||||
The only exception is types with certain <code>repr(...)</code> attributes. \
|
||||
Please see the Rust Reference’s \
|
||||
<a href=\"https://doc.rust-lang.org/reference/type-layout.html\">“Type Layout”</a> \
|
||||
|
@ -3,8 +3,6 @@
|
||||
// cdb-only
|
||||
// min-cdb-version: 10.0.21287.1005
|
||||
// compile-flags:-g
|
||||
// FIXME: Failed on update to 10.0.22000.1
|
||||
// ignore-windows
|
||||
|
||||
// === CDB TESTS ==================================================================================
|
||||
//
|
||||
@ -14,17 +12,17 @@
|
||||
// cdb-check:m,d [Type: std::sync::mutex::Mutex<i32>]
|
||||
// cdb-check: [...] inner [Type: std::sys_common::mutex::MovableMutex]
|
||||
// cdb-check: [...] poison [Type: std::sync::poison::Flag]
|
||||
// cdb-check: [...] data [Type: core::cell::UnsafeCell<i32>]
|
||||
// cdb-check: [...] data : 0 [Type: core::cell::UnsafeCell<i32>]
|
||||
|
||||
//
|
||||
// cdb-command:dx m.data,d
|
||||
// cdb-check:m.data,d [Type: core::cell::UnsafeCell<i32>]
|
||||
// cdb-check: [...] value : 0 [Type: int]
|
||||
// cdb-check:m.data,d : 0 [Type: core::cell::UnsafeCell<i32>]
|
||||
// cdb-check: [<Raw View>] [Type: core::cell::UnsafeCell<i32>]
|
||||
|
||||
//
|
||||
// cdb-command:dx lock,d
|
||||
// cdb-check:lock,d : Ok [Type: enum$<core::result::Result<std::sync::mutex::MutexGuard<i32>, enum$<std::sync::poison::TryLockError<std::sync::mutex::MutexGuard<i32> >, 0, 1, Poisoned> > >]
|
||||
// cdb-check: [...] variant$ : Ok (0) [Type: core::result::Result]
|
||||
// cdb-check:lock,d : Ok [Type: enum$<core::result::Result<std::sync::mutex::MutexGuard<i32>,enum$<std::sync::poison::TryLockError<std::sync::mutex::MutexGuard<i32> >, 0, 1, Poisoned> > >]
|
||||
// cdb-check: [variant] : Ok
|
||||
// cdb-check: [...] __0 [Type: std::sync::mutex::MutexGuard<i32>]
|
||||
|
||||
use std::sync::Mutex;
|
||||
|
8
src/test/ui/lint/issue-79546-fuel-ice.rs
Normal file
8
src/test/ui/lint/issue-79546-fuel-ice.rs
Normal file
@ -0,0 +1,8 @@
|
||||
// Regression test for the ICE described in #79546.
|
||||
|
||||
// compile-flags: --cap-lints=allow -Zfuel=issue79546=0
|
||||
// check-pass
|
||||
#![crate_name="issue79546"]
|
||||
|
||||
struct S;
|
||||
fn main() {}
|
@ -26,7 +26,7 @@ LL | bar { }
|
||||
help: if `bar` is a function, use the arguments directly
|
||||
|
|
||||
LL - bar(baz: $rest)
|
||||
LL + bar(true);
|
||||
LL + bar(: $rest)
|
||||
|
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
@ -96,7 +96,8 @@ pub const ASAN_SUPPORTED_TARGETS: &[&str] = &[
|
||||
];
|
||||
|
||||
pub const LSAN_SUPPORTED_TARGETS: &[&str] = &[
|
||||
"aarch64-apple-darwin",
|
||||
// FIXME: currently broken, see #88132
|
||||
// "aarch64-apple-darwin",
|
||||
"aarch64-unknown-linux-gnu",
|
||||
"x86_64-apple-darwin",
|
||||
"x86_64-unknown-linux-gnu",
|
||||
|
Loading…
x
Reference in New Issue
Block a user