Skip to content

Commit fb53283

Browse files
Auto merge of #148380 - Zalathar:rollup-r3ebicy, r=<try>
Rollup of 6 pull requests try-job: armhf-gnu
2 parents bd3ac03 + 642e09c commit fb53283

File tree

508 files changed

+477
-1541
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

508 files changed

+477
-1541
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,10 @@ node_modules
9090
## Rustdoc GUI tests
9191
tests/rustdoc-gui/src/**.lock
9292

93+
## Test dashboard
94+
.citool-cache/
95+
test-dashboard/
96+
9397
## direnv
9498
/.envrc
9599
/.direnv/

compiler/rustc_codegen_ssa/src/back/symbol_export.rs

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -51,15 +51,7 @@ fn reachable_non_generics_provider(tcx: TyCtxt<'_>, _: LocalCrate) -> DefIdMap<S
5151
return Default::default();
5252
}
5353

54-
// Check to see if this crate is a "special runtime crate". These
55-
// crates, implementation details of the standard library, typically
56-
// have a bunch of `pub extern` and `#[no_mangle]` functions as the
57-
// ABI between them. We don't want their symbols to have a `C`
58-
// export level, however, as they're just implementation details.
59-
// Down below we'll hardwire all of the symbols to the `Rust` export
60-
// level instead.
61-
let special_runtime_crate =
62-
tcx.is_panic_runtime(LOCAL_CRATE) || tcx.is_compiler_builtins(LOCAL_CRATE);
54+
let is_compiler_builtins = tcx.is_compiler_builtins(LOCAL_CRATE);
6355

6456
let mut reachable_non_generics: DefIdMap<_> = tcx
6557
.reachable_set(())
@@ -104,11 +96,12 @@ fn reachable_non_generics_provider(tcx: TyCtxt<'_>, _: LocalCrate) -> DefIdMap<S
10496
if tcx.cross_crate_inlinable(def_id) { None } else { Some(def_id) }
10597
})
10698
.map(|def_id| {
107-
// We won't link right if this symbol is stripped during LTO.
108-
let name = tcx.symbol_name(Instance::mono(tcx, def_id.to_def_id())).name;
109-
let used = name == "rust_eh_personality";
110-
111-
let export_level = if special_runtime_crate {
99+
let export_level = if is_compiler_builtins {
100+
// We don't want to export compiler-builtins symbols from any
101+
// dylibs, even rust dylibs. Unlike all other crates it gets
102+
// duplicated in every linker invocation and it may otherwise
103+
// unintentionally override definitions of these symbols by
104+
// libgcc or compiler-rt for C code.
112105
SymbolExportLevel::Rust
113106
} else {
114107
symbol_export_level(tcx, def_id.to_def_id())
@@ -131,8 +124,7 @@ fn reachable_non_generics_provider(tcx: TyCtxt<'_>, _: LocalCrate) -> DefIdMap<S
131124
SymbolExportKind::Text
132125
},
133126
used: codegen_attrs.flags.contains(CodegenFnAttrFlags::USED_COMPILER)
134-
|| codegen_attrs.flags.contains(CodegenFnAttrFlags::USED_LINKER)
135-
|| used,
127+
|| codegen_attrs.flags.contains(CodegenFnAttrFlags::USED_LINKER),
136128
rustc_std_internal_symbol: codegen_attrs
137129
.flags
138130
.contains(CodegenFnAttrFlags::RUSTC_STD_INTERNAL_SYMBOL),

compiler/rustc_hir_analysis/src/collect/generics_of.rs

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -77,20 +77,6 @@ pub(super) fn generics_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::Generics {
7777
// stable enough and does not need a feature gate anymore.
7878
Node::AnonConst(_) => {
7979
let parent_did = tcx.parent(def_id.to_def_id());
80-
81-
// We don't do this unconditionally because the `DefId` parent of an anon const
82-
// might be an implicitly created closure during `async fn` desugaring. This would
83-
// have the wrong generics.
84-
//
85-
// i.e. `async fn foo<'a>() { let a = [(); { 1 + 2 }]; bar().await() }`
86-
// would implicitly have a closure in its body that would be the parent of
87-
// the `{ 1 + 2 }` anon const. This closure's generics is simply a witness
88-
// instead of `['a]`.
89-
let parent_did = if let DefKind::AnonConst = tcx.def_kind(parent_did) {
90-
parent_did
91-
} else {
92-
tcx.hir_get_parent_item(hir_id).to_def_id()
93-
};
9480
debug!(?parent_did);
9581

9682
let mut in_param_ty = false;

compiler/rustc_lint/messages.ftl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -193,11 +193,11 @@ lint_confusable_identifier_pair = found both `{$existing_sym}` and `{$sym}` as i
193193
.current_use = this identifier can be confused with `{$existing_sym}`
194194
.other_use = other identifier used here
195195
196-
lint_dangling_pointers_from_locals = a dangling pointer will be produced because the local variable `{$local_var_name}` will be dropped
197-
.ret_ty = return type of the {$fn_kind} is `{$ret_ty}`
198-
.local_var = `{$local_var_name}` is part the {$fn_kind} and will be dropped at the end of the {$fn_kind}
196+
lint_dangling_pointers_from_locals = {$fn_kind} returns a dangling pointer to dropped local variable `{$local_var_name}`
197+
.ret_ty = return type is `{$ret_ty}`
198+
.local_var = local variable `{$local_var_name}` is dropped at the end of the {$fn_kind}
199199
.created_at = dangling pointer created here
200-
.note = pointers do not have a lifetime; after returning, the `{$local_var_ty}` will be deallocated at the end of the {$fn_kind} because nothing is referencing it as far as the type system is concerned
200+
.note = a dangling pointer is safe, but dereferencing one is undefined behavior
201201
202202
lint_dangling_pointers_from_temporaries = a dangling pointer will be produced because the temporary `{$ty}` will be dropped
203203
.label_ptr = this pointer will immediately be invalid

compiler/rustc_middle/src/query/mod.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,10 @@ rustc_queries! {
397397
/// The root query triggering all analysis passes like typeck or borrowck.
398398
query analysis(key: ()) {
399399
eval_always
400-
desc { "running analysis passes on this crate" }
400+
desc { |tcx|
401+
"running analysis passes on crate `{}`",
402+
tcx.crate_name(LOCAL_CRATE),
403+
}
401404
}
402405

403406
/// This query checks the fulfillment of collected lint expectations.

compiler/rustc_mir_build/src/thir/constant.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,12 @@ pub(crate) fn lit_to_const<'tcx>(
5858
(ast::LitKind::Byte(n), ty::Uint(ty::UintTy::U8)) => {
5959
ty::ValTree::from_scalar_int(tcx, n.into())
6060
}
61-
(ast::LitKind::CStr(byte_sym, _), ty::Ref(_, inner_ty, _)) if matches!(inner_ty.kind(), ty::Adt(def, _) if tcx.is_lang_item(def.did(), LangItem::CStr)) => {
62-
ty::ValTree::from_raw_bytes(tcx, byte_sym.as_byte_str())
61+
(ast::LitKind::CStr(byte_sym, _), ty::Ref(_, inner_ty, _)) if matches!(inner_ty.kind(), ty::Adt(def, _) if tcx.is_lang_item(def.did(), LangItem::CStr)) =>
62+
{
63+
// A CStr is a newtype around a byte slice, so we create the inner slice here.
64+
// We need a branch for each "level" of the data structure.
65+
let bytes = ty::ValTree::from_raw_bytes(tcx, byte_sym.as_byte_str());
66+
ty::ValTree::from_branches(tcx, [bytes])
6367
}
6468
(ast::LitKind::Int(n, _), ty::Uint(ui)) if !neg => {
6569
let scalar_int = trunc(n.get(), *ui);

src/tools/miri/.github/workflows/ci.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ jobs:
3131
os: ubuntu-24.04-arm
3232
multiarch: armhf
3333
gcc_cross: arm-linux-gnueabihf
34-
# Disabled due to Ubuntu repo trouble
34+
# Ubuntu mirrors are not reliable enough for these architectures
35+
# (see <https://bugs.launchpad.net/ubuntu/+bug/2130309>).
3536
# - host_target: riscv64gc-unknown-linux-gnu
3637
# os: ubuntu-latest
3738
# multiarch: riscv64
@@ -68,7 +69,7 @@ jobs:
6869
- name: install multiarch
6970
if: ${{ matrix.multiarch != '' }}
7071
run: |
71-
# s390x, ppc64el, riscv64 need Ubuntu Ports to be in the mirror list
72+
# armhf, s390x, ppc64el, riscv64 need Ubuntu Ports to be in the mirror list
7273
sudo bash -c "echo 'https://ports.ubuntu.com/ priority:4' >> /etc/apt/apt-mirrors.txt"
7374
# Add architecture
7475
sudo dpkg --add-architecture ${{ matrix.multiarch }}

src/tools/miri/README.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,9 @@ Try running `cargo miri clean`.
292292
Miri adds its own set of `-Z` flags, which are usually set via the `MIRIFLAGS`
293293
environment variable. We first document the most relevant and most commonly used flags:
294294

295+
* `-Zmiri-backtrace=<0|1|full>` configures how Miri prints backtraces: `1` is the default,
296+
where backtraces are printed in pruned form; `full` prints backtraces without pruning, and `0`
297+
disables backtraces entirely.
295298
* `-Zmiri-deterministic-concurrency` makes Miri's concurrency-related behavior fully deterministic.
296299
Strictly speaking, Miri is always fully deterministic when isolation is enabled (the default
297300
mode), but this determinism is achieved by using an RNG with a fixed seed. Seemingly harmless
@@ -373,6 +376,12 @@ environment variable. We first document the most relevant and most commonly used
373376
ensure alignment. (The standard library `align_to` method works fine in both modes; under
374377
symbolic alignment it only fills the middle slice when the allocation guarantees sufficient
375378
alignment.)
379+
* `-Zmiri-user-relevant-crates=<crate>,<crate>,...` extends the list of crates that Miri considers
380+
"user-relevant". This affects the rendering of backtraces (for user-relevant crates, Miri shows
381+
not just the function name but the actual code) and it affects the spans collected for data races
382+
and aliasing violations (where Miri will show the span of the topmost non-`#[track_caller]` frame
383+
in a user-relevant crate). When using `cargo miri`, the crates in the local workspace are always
384+
considered user-relevant.
376385

377386
The remaining flags are for advanced use only, and more likely to change or be removed.
378387
Some of these are **unsound**, which means they can lead
@@ -474,7 +483,8 @@ to Miri failing to detect cases of undefined behavior in a program.
474483
* `-Zmiri-track-alloc-id=<id1>,<id2>,...` shows a backtrace when the given allocations are
475484
being allocated or freed. This helps in debugging memory leaks and
476485
use after free bugs. Specifying this argument multiple times does not overwrite the previous
477-
values, instead it appends its values to the list. Listing an id multiple times has no effect.
486+
values, instead it appends its values to the list. Listing an ID multiple times has no effect.
487+
You can also add IDs at runtime using `miri_track_alloc`.
478488
* `-Zmiri-track-pointer-tag=<tag1>,<tag2>,...` shows a backtrace when a given pointer tag
479489
is created and when (if ever) it is popped from a borrow stack (which is where the tag becomes invalid
480490
and any future use of it will error). This helps you in finding out why UB is

src/tools/miri/cargo-miri/src/util.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,11 @@ fn cargo_extra_flags() -> Vec<String> {
213213

214214
pub fn get_cargo_metadata() -> Metadata {
215215
// This will honor the `CARGO` env var the same way our `cargo()` does.
216-
MetadataCommand::new().no_deps().other_options(cargo_extra_flags()).exec().unwrap()
216+
MetadataCommand::new()
217+
.no_deps()
218+
.other_options(cargo_extra_flags())
219+
.exec()
220+
.unwrap_or_else(|err| show_error!("{}", err))
217221
}
218222

219223
/// Pulls all the crates in this workspace from the cargo metadata.

src/tools/miri/rust-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
28d0a4a205f9e511ad2f51ee79a4aa19a704a455
1+
292be5c7c05138d753bbd4b30db7a3f1a5c914f7

0 commit comments

Comments
 (0)