Skip to content

Commit 0930bfe

Browse files
author
The Miri Cronjob Bot
committed
Merge from rustc
2 parents 3313e9c + 7bae381 commit 0930bfe

File tree

199 files changed

+3354
-3247
lines changed

Some content is hidden

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

199 files changed

+3354
-3247
lines changed

Diff for: compiler/rustc_abi/src/extern_abi/mod.rs

+4
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,10 @@ pub fn is_enabled(
192192
s
193193
}
194194

195+
/// Returns whether the ABI is stable to use.
196+
///
197+
/// Note that there is a separate check determining whether the ABI is even supported
198+
/// on the current target; see `fn is_abi_supported` in `rustc_target::spec`.
195199
pub fn is_stable(name: &str) -> Result<(), AbiDisabled> {
196200
match name {
197201
// Stable

Diff for: compiler/rustc_ast/src/token.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -909,7 +909,8 @@ impl Token {
909909
self.is_keyword(kw)
910910
|| (case == Case::Insensitive
911911
&& self.is_non_raw_ident_where(|id| {
912-
id.name.as_str().to_lowercase() == kw.as_str().to_lowercase()
912+
// Do an ASCII case-insensitive match, because all keywords are ASCII.
913+
id.name.as_str().eq_ignore_ascii_case(kw.as_str())
913914
}))
914915
}
915916

Diff for: compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs

+25-34
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ use rustc_middle::bug;
2020
use rustc_middle::hir::nested_filter::OnlyBodies;
2121
use rustc_middle::mir::tcx::PlaceTy;
2222
use rustc_middle::mir::{
23-
self, AggregateKind, BindingForm, BorrowKind, CallSource, ClearCrossCrate, ConstraintCategory,
23+
self, AggregateKind, BindingForm, BorrowKind, ClearCrossCrate, ConstraintCategory,
2424
FakeBorrowKind, FakeReadCause, LocalDecl, LocalInfo, LocalKind, Location, MutBorrowKind,
2525
Operand, Place, PlaceRef, ProjectionElem, Rvalue, Statement, StatementKind, Terminator,
2626
TerminatorKind, VarBindingForm, VarDebugInfoContents,
@@ -30,13 +30,13 @@ use rustc_middle::ty::{
3030
self, PredicateKind, Ty, TyCtxt, TypeSuperVisitable, TypeVisitor, Upcast,
3131
suggest_constraining_type_params,
3232
};
33-
use rustc_middle::util::CallKind;
3433
use rustc_mir_dataflow::move_paths::{InitKind, MoveOutIndex, MovePathIndex};
3534
use rustc_span::def_id::{DefId, LocalDefId};
3635
use rustc_span::hygiene::DesugaringKind;
3736
use rustc_span::{BytePos, Ident, Span, Symbol, kw, sym};
3837
use rustc_trait_selection::error_reporting::InferCtxtErrorExt;
3938
use rustc_trait_selection::error_reporting::traits::FindExprBySpan;
39+
use rustc_trait_selection::error_reporting::traits::call_kind::CallKind;
4040
use rustc_trait_selection::infer::InferCtxtExt;
4141
use rustc_trait_selection::traits::query::evaluate_obligation::InferCtxtExt as _;
4242
use rustc_trait_selection::traits::{Obligation, ObligationCause, ObligationCtxt};
@@ -46,7 +46,7 @@ use super::explain_borrow::{BorrowExplanation, LaterUseKind};
4646
use super::{DescribePlaceOpt, RegionName, RegionNameSource, UseSpans};
4747
use crate::borrow_set::{BorrowData, TwoPhaseActivation};
4848
use crate::diagnostics::conflict_errors::StorageDeadOrDrop::LocalStorageDead;
49-
use crate::diagnostics::{CapturedMessageOpt, Instance, find_all_local_uses};
49+
use crate::diagnostics::{CapturedMessageOpt, call_kind, find_all_local_uses};
5050
use crate::prefixes::IsPrefixOf;
5151
use crate::{InitializationRequiringAction, MirBorrowckCtxt, WriteKind, borrowck_errors};
5252

@@ -305,7 +305,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
305305
}
306306

307307
if let UseSpans::FnSelfUse {
308-
kind: CallKind::DerefCoercion { deref_target, deref_target_ty, .. },
308+
kind: CallKind::DerefCoercion { deref_target_span, deref_target_ty, .. },
309309
..
310310
} = use_spans
311311
{
@@ -315,8 +315,10 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
315315
));
316316

317317
// Check first whether the source is accessible (issue #87060)
318-
if self.infcx.tcx.sess.source_map().is_span_accessible(deref_target) {
319-
err.span_note(deref_target, "deref defined here");
318+
if let Some(deref_target_span) = deref_target_span
319+
&& self.infcx.tcx.sess.source_map().is_span_accessible(deref_target_span)
320+
{
321+
err.span_note(deref_target_span, "deref defined here");
320322
}
321323
}
322324

@@ -3765,38 +3767,27 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
37653767

37663768
fn explain_deref_coercion(&mut self, loan: &BorrowData<'tcx>, err: &mut Diag<'_>) {
37673769
let tcx = self.infcx.tcx;
3768-
if let (
3769-
Some(Terminator {
3770-
kind: TerminatorKind::Call { call_source: CallSource::OverloadedOperator, .. },
3771-
..
3772-
}),
3773-
Some((method_did, method_args)),
3774-
) = (
3775-
&self.body[loan.reserve_location.block].terminator,
3776-
rustc_middle::util::find_self_call(
3770+
if let Some(Terminator { kind: TerminatorKind::Call { call_source, fn_span, .. }, .. }) =
3771+
&self.body[loan.reserve_location.block].terminator
3772+
&& let Some((method_did, method_args)) = rustc_middle::util::find_self_call(
37773773
tcx,
37783774
self.body,
37793775
loan.assigned_place.local,
37803776
loan.reserve_location.block,
3781-
),
3782-
) {
3783-
if tcx.is_diagnostic_item(sym::deref_method, method_did) {
3784-
let deref_target =
3785-
tcx.get_diagnostic_item(sym::deref_target).and_then(|deref_target| {
3786-
Instance::try_resolve(
3787-
tcx,
3788-
self.infcx.typing_env(self.infcx.param_env),
3789-
deref_target,
3790-
method_args,
3791-
)
3792-
.transpose()
3793-
});
3794-
if let Some(Ok(instance)) = deref_target {
3795-
let deref_target_ty =
3796-
instance.ty(tcx, self.infcx.typing_env(self.infcx.param_env));
3797-
err.note(format!("borrow occurs due to deref coercion to `{deref_target_ty}`"));
3798-
err.span_note(tcx.def_span(instance.def_id()), "deref defined here");
3799-
}
3777+
)
3778+
&& let CallKind::DerefCoercion { deref_target_span, deref_target_ty, .. } = call_kind(
3779+
self.infcx.tcx,
3780+
self.infcx.typing_env(self.infcx.param_env),
3781+
method_did,
3782+
method_args,
3783+
*fn_span,
3784+
call_source.from_hir_call(),
3785+
Some(self.infcx.tcx.fn_arg_names(method_did)[0]),
3786+
)
3787+
{
3788+
err.note(format!("borrow occurs due to deref coercion to `{deref_target_ty}`"));
3789+
if let Some(deref_target_span) = deref_target_span {
3790+
err.span_note(deref_target_span, "deref defined here");
38003791
}
38013792
}
38023793
}

Diff for: compiler/rustc_borrowck/src/diagnostics/explain_borrow.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ use rustc_middle::mir::{
1616
};
1717
use rustc_middle::ty::adjustment::PointerCoercion;
1818
use rustc_middle::ty::{self, RegionVid, Ty, TyCtxt};
19-
use rustc_middle::util::CallKind;
2019
use rustc_span::{DesugaringKind, Span, kw, sym};
2120
use rustc_trait_selection::error_reporting::traits::FindExprBySpan;
21+
use rustc_trait_selection::error_reporting::traits::call_kind::CallKind;
2222
use tracing::{debug, instrument};
2323

2424
use super::{RegionName, UseSpans, find_use};

Diff for: compiler/rustc_borrowck/src/diagnostics/mod.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@ use rustc_middle::mir::{
2020
StatementKind, Terminator, TerminatorKind,
2121
};
2222
use rustc_middle::ty::print::Print;
23-
use rustc_middle::ty::{self, Instance, Ty, TyCtxt};
24-
use rustc_middle::util::{CallDesugaringKind, call_kind};
23+
use rustc_middle::ty::{self, Ty, TyCtxt};
2524
use rustc_mir_dataflow::move_paths::{InitLocation, LookupResult, MoveOutIndex};
2625
use rustc_span::def_id::LocalDefId;
2726
use rustc_span::source_map::Spanned;
2827
use rustc_span::{DUMMY_SP, ErrorGuaranteed, Span, Symbol, sym};
2928
use rustc_trait_selection::error_reporting::InferCtxtErrorExt;
29+
use rustc_trait_selection::error_reporting::traits::call_kind::{CallDesugaringKind, call_kind};
3030
use rustc_trait_selection::infer::InferCtxtExt;
3131
use rustc_trait_selection::traits::{
3232
FulfillmentErrorCode, type_known_to_meet_bound_modulo_regions,
@@ -63,7 +63,7 @@ pub(crate) use mutability_errors::AccessKind;
6363
pub(crate) use outlives_suggestion::OutlivesSuggestionBuilder;
6464
pub(crate) use region_errors::{ErrorConstraintInfo, RegionErrorKind, RegionErrors};
6565
pub(crate) use region_name::{RegionName, RegionNameSource};
66-
pub(crate) use rustc_middle::util::CallKind;
66+
pub(crate) use rustc_trait_selection::error_reporting::traits::call_kind::CallKind;
6767

6868
pub(super) struct DescribePlaceOpt {
6969
including_downcast: bool,

Diff for: compiler/rustc_borrowck/src/type_check/opaque_types.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ pub(super) fn take_opaques_and_register_member_constraints<'tcx>(
2525
let opaque_types = infcx
2626
.take_opaque_types()
2727
.into_iter()
28-
.map(|(opaque_type_key, decl)| {
29-
let hidden_type = infcx.resolve_vars_if_possible(decl.hidden_type);
28+
.map(|(opaque_type_key, hidden_type)| {
29+
let hidden_type = infcx.resolve_vars_if_possible(hidden_type);
3030
register_member_constraints(
3131
typeck,
3232
&mut member_constraints,

Diff for: compiler/rustc_codegen_gcc/.github/workflows/ci.yml

+2-5
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ jobs:
2222
- { gcc: "gcc-13.deb" }
2323
- { gcc: "gcc-13-without-int128.deb" }
2424
commands: [
25-
"--mini-tests",
2625
"--std-tests",
2726
# FIXME: re-enable asm tests when GCC can emit in the right syntax.
2827
# "--asm-tests",
@@ -79,6 +78,7 @@ jobs:
7978
run: |
8079
./y.sh prepare --only-libcore
8180
./y.sh build --sysroot
81+
./y.sh test --mini-tests
8282
cargo test
8383
8484
- name: Run y.sh cargo build
@@ -87,17 +87,14 @@ jobs:
8787
8888
- name: Clean
8989
run: |
90-
./y.sh clean all
90+
./y.sh clean all
9191
9292
- name: Prepare dependencies
9393
run: |
9494
git config --global user.email "[email protected]"
9595
git config --global user.name "User"
9696
./y.sh prepare
9797
98-
- name: Add more failing tests because the sysroot is not compiled with LTO
99-
run: cat tests/failing-non-lto-tests.txt >> tests/failing-ui-tests.txt
100-
10198
- name: Run tests
10299
run: |
103100
./y.sh test --release --clean --build-sysroot ${{ matrix.commands }}

Diff for: compiler/rustc_codegen_gcc/.github/workflows/failures.yml

+2-5
Original file line numberDiff line numberDiff line change
@@ -90,23 +90,20 @@ jobs:
9090
if: matrix.libgccjit_version.gcc != 'libgccjit12.so'
9191
run: ./y.sh prepare
9292

93-
- name: Add more failing tests because the sysroot is not compiled with LTO
94-
run: cat tests/failing-non-lto-tests.txt >> tests/failing-ui-tests.txt
95-
9693
- name: Run tests
9794
# TODO: re-enable those tests for libgccjit 12.
9895
if: matrix.libgccjit_version.gcc != 'libgccjit12.so'
9996
id: tests
10097
run: |
101-
${{ matrix.libgccjit_version.env_extra }} ./y.sh test --release --clean --build-sysroot --test-failing-rustc ${{ matrix.libgccjit_version.extra }} | tee output_log
98+
${{ matrix.libgccjit_version.env_extra }} ./y.sh test --release --clean --build-sysroot --test-failing-rustc ${{ matrix.libgccjit_version.extra }} 2>&1 | tee output_log
10299
rg --text "test result" output_log >> $GITHUB_STEP_SUMMARY
103100
104101
- name: Run failing ui pattern tests for ICE
105102
# TODO: re-enable those tests for libgccjit 12.
106103
if: matrix.libgccjit_version.gcc != 'libgccjit12.so'
107104
id: ui-tests
108105
run: |
109-
${{ matrix.libgccjit_version.env_extra }} ./y.sh test --release --test-failing-ui-pattern-tests ${{ matrix.libgccjit_version.extra }} | tee output_log_ui
106+
${{ matrix.libgccjit_version.env_extra }} ./y.sh test --release --test-failing-ui-pattern-tests ${{ matrix.libgccjit_version.extra }} 2>&1 | tee output_log_ui
110107
if grep -q "the compiler unexpectedly panicked" output_log_ui; then
111108
echo "Error: 'the compiler unexpectedly panicked' found in output logs. CI Error!!"
112109
exit 1

Diff for: compiler/rustc_codegen_gcc/.github/workflows/gcc12.yml

-3
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,6 @@ jobs:
8282
#- name: Add more failing tests for GCC 12
8383
#run: cat tests/failing-ui-tests12.txt >> tests/failing-ui-tests.txt
8484

85-
#- name: Add more failing tests because the sysroot is not compiled with LTO
86-
#run: cat tests/failing-non-lto-tests.txt >> tests/failing-ui-tests.txt
87-
8885
#- name: Run tests
8986
#run: |
9087
#./y.sh test --release --clean --build-sysroot ${{ matrix.commands }} --no-default-features

Diff for: compiler/rustc_codegen_gcc/.github/workflows/m68k.yml

+1-4
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ jobs:
2323
fail-fast: false
2424
matrix:
2525
commands: [
26-
"--mini-tests",
2726
"--std-tests",
2827
# TODO(antoyo): fix those on m68k.
2928
#"--test-libcore",
@@ -93,6 +92,7 @@ jobs:
9392
run: |
9493
./y.sh prepare --only-libcore --cross
9594
./y.sh build --sysroot --features compiler_builtins/no-f16-f128 --target-triple m68k-unknown-linux-gnu
95+
./y.sh test --mini-tests
9696
CG_GCC_TEST_TARGET=m68k-unknown-linux-gnu cargo test
9797
./y.sh clean all
9898
@@ -102,9 +102,6 @@ jobs:
102102
git config --global user.name "User"
103103
./y.sh prepare --cross
104104
105-
- name: Add more failing tests because the sysroot is not compiled with LTO
106-
run: cat tests/failing-non-lto-tests.txt >> tests/failing-ui-tests.txt
107-
108105
- name: Run tests
109106
run: |
110107
./y.sh test --release --clean --build-sysroot --sysroot-features compiler_builtins/no-f16-f128 ${{ matrix.commands }}

Diff for: compiler/rustc_codegen_gcc/.github/workflows/release.yml

+8-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ env:
1313

1414
jobs:
1515
build:
16-
runs-on: ubuntu-latest
16+
runs-on: ubuntu-22.04
1717

1818
strategy:
1919
fail-fast: false
@@ -54,6 +54,7 @@ jobs:
5454
run: |
5555
./y.sh prepare --only-libcore
5656
EMBED_LTO_BITCODE=1 ./y.sh build --sysroot --release --release-sysroot
57+
./y.sh test --mini-tests
5758
cargo test
5859
./y.sh clean all
5960
@@ -70,4 +71,9 @@ jobs:
7071
run: |
7172
# FIXME(antoyo): we cannot enable LTO for stdarch tests currently because of some failing LTO tests using proc-macros.
7273
echo -n 'lto = "fat"' >> build_system/build_sysroot/Cargo.toml
73-
EMBED_LTO_BITCODE=1 ./y.sh test --release --clean --release-sysroot --build-sysroot ${{ matrix.commands }}
74+
EMBED_LTO_BITCODE=1 ./y.sh test --release --clean --release-sysroot --build-sysroot --keep-lto-tests ${{ matrix.commands }}
75+
76+
- name: Run y.sh cargo build
77+
run: |
78+
EMBED_LTO_BITCODE=1 CHANNEL="release" ./y.sh cargo build --release --manifest-path tests/hello-world/Cargo.toml
79+
# TODO: grep the asm output for "call my_func" and fail if it is found.

Diff for: compiler/rustc_codegen_gcc/.github/workflows/stdarch.yml

+1-4
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,6 @@ jobs:
7373
echo "LD_LIBRARY_PATH="$(./y.sh info | grep -v Using) >> $GITHUB_ENV
7474
echo "LIBRARY_PATH="$(./y.sh info | grep -v Using) >> $GITHUB_ENV
7575
76-
- name: Build (part 2)
77-
run: |
78-
cargo test
79-
8076
- name: Clean
8177
if: ${{ !matrix.cargo_runner }}
8278
run: |
@@ -92,6 +88,7 @@ jobs:
9288
if: ${{ !matrix.cargo_runner }}
9389
run: |
9490
./y.sh test --release --clean --release-sysroot --build-sysroot --mini-tests --std-tests --test-libcore
91+
cargo test
9592
9693
- name: Run stdarch tests
9794
if: ${{ !matrix.cargo_runner }}

Diff for: compiler/rustc_codegen_gcc/.rustfmt.toml

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1-
version = "Two"
1+
style_edition = "2024"
22
use_small_heuristics = "Max"
33
merge_derives = false
4+
group_imports = "StdExternalCrate"
5+
imports_granularity = "Module"

0 commit comments

Comments
 (0)