Skip to content

Commit

Permalink
Merge pull request rust-lang#4139 from rust-lang/rustup-2025-01-15
Browse files Browse the repository at this point in the history
Automatic Rustup
  • Loading branch information
RalfJung authored Jan 15, 2025
2 parents d40f2f7 + 0930bfe commit 5460fbe
Show file tree
Hide file tree
Showing 200 changed files with 3,355 additions and 3,248 deletions.
4 changes: 4 additions & 0 deletions compiler/rustc_abi/src/extern_abi/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,10 @@ pub fn is_enabled(
s
}

/// Returns whether the ABI is stable to use.
///
/// Note that there is a separate check determining whether the ABI is even supported
/// on the current target; see `fn is_abi_supported` in `rustc_target::spec`.
pub fn is_stable(name: &str) -> Result<(), AbiDisabled> {
match name {
// Stable
Expand Down
3 changes: 2 additions & 1 deletion compiler/rustc_ast/src/token.rs
Original file line number Diff line number Diff line change
Expand Up @@ -909,7 +909,8 @@ impl Token {
self.is_keyword(kw)
|| (case == Case::Insensitive
&& self.is_non_raw_ident_where(|id| {
id.name.as_str().to_lowercase() == kw.as_str().to_lowercase()
// Do an ASCII case-insensitive match, because all keywords are ASCII.
id.name.as_str().eq_ignore_ascii_case(kw.as_str())
}))
}

Expand Down
59 changes: 25 additions & 34 deletions compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use rustc_middle::bug;
use rustc_middle::hir::nested_filter::OnlyBodies;
use rustc_middle::mir::tcx::PlaceTy;
use rustc_middle::mir::{
self, AggregateKind, BindingForm, BorrowKind, CallSource, ClearCrossCrate, ConstraintCategory,
self, AggregateKind, BindingForm, BorrowKind, ClearCrossCrate, ConstraintCategory,
FakeBorrowKind, FakeReadCause, LocalDecl, LocalInfo, LocalKind, Location, MutBorrowKind,
Operand, Place, PlaceRef, ProjectionElem, Rvalue, Statement, StatementKind, Terminator,
TerminatorKind, VarBindingForm, VarDebugInfoContents,
Expand All @@ -30,13 +30,13 @@ use rustc_middle::ty::{
self, PredicateKind, Ty, TyCtxt, TypeSuperVisitable, TypeVisitor, Upcast,
suggest_constraining_type_params,
};
use rustc_middle::util::CallKind;
use rustc_mir_dataflow::move_paths::{InitKind, MoveOutIndex, MovePathIndex};
use rustc_span::def_id::{DefId, LocalDefId};
use rustc_span::hygiene::DesugaringKind;
use rustc_span::{BytePos, Ident, Span, Symbol, kw, sym};
use rustc_trait_selection::error_reporting::InferCtxtErrorExt;
use rustc_trait_selection::error_reporting::traits::FindExprBySpan;
use rustc_trait_selection::error_reporting::traits::call_kind::CallKind;
use rustc_trait_selection::infer::InferCtxtExt;
use rustc_trait_selection::traits::query::evaluate_obligation::InferCtxtExt as _;
use rustc_trait_selection::traits::{Obligation, ObligationCause, ObligationCtxt};
Expand All @@ -46,7 +46,7 @@ use super::explain_borrow::{BorrowExplanation, LaterUseKind};
use super::{DescribePlaceOpt, RegionName, RegionNameSource, UseSpans};
use crate::borrow_set::{BorrowData, TwoPhaseActivation};
use crate::diagnostics::conflict_errors::StorageDeadOrDrop::LocalStorageDead;
use crate::diagnostics::{CapturedMessageOpt, Instance, find_all_local_uses};
use crate::diagnostics::{CapturedMessageOpt, call_kind, find_all_local_uses};
use crate::prefixes::IsPrefixOf;
use crate::{InitializationRequiringAction, MirBorrowckCtxt, WriteKind, borrowck_errors};

Expand Down Expand Up @@ -305,7 +305,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
}

if let UseSpans::FnSelfUse {
kind: CallKind::DerefCoercion { deref_target, deref_target_ty, .. },
kind: CallKind::DerefCoercion { deref_target_span, deref_target_ty, .. },
..
} = use_spans
{
Expand All @@ -315,8 +315,10 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
));

// Check first whether the source is accessible (issue #87060)
if self.infcx.tcx.sess.source_map().is_span_accessible(deref_target) {
err.span_note(deref_target, "deref defined here");
if let Some(deref_target_span) = deref_target_span
&& self.infcx.tcx.sess.source_map().is_span_accessible(deref_target_span)
{
err.span_note(deref_target_span, "deref defined here");
}
}

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

fn explain_deref_coercion(&mut self, loan: &BorrowData<'tcx>, err: &mut Diag<'_>) {
let tcx = self.infcx.tcx;
if let (
Some(Terminator {
kind: TerminatorKind::Call { call_source: CallSource::OverloadedOperator, .. },
..
}),
Some((method_did, method_args)),
) = (
&self.body[loan.reserve_location.block].terminator,
rustc_middle::util::find_self_call(
if let Some(Terminator { kind: TerminatorKind::Call { call_source, fn_span, .. }, .. }) =
&self.body[loan.reserve_location.block].terminator
&& let Some((method_did, method_args)) = rustc_middle::util::find_self_call(
tcx,
self.body,
loan.assigned_place.local,
loan.reserve_location.block,
),
) {
if tcx.is_diagnostic_item(sym::deref_method, method_did) {
let deref_target =
tcx.get_diagnostic_item(sym::deref_target).and_then(|deref_target| {
Instance::try_resolve(
tcx,
self.infcx.typing_env(self.infcx.param_env),
deref_target,
method_args,
)
.transpose()
});
if let Some(Ok(instance)) = deref_target {
let deref_target_ty =
instance.ty(tcx, self.infcx.typing_env(self.infcx.param_env));
err.note(format!("borrow occurs due to deref coercion to `{deref_target_ty}`"));
err.span_note(tcx.def_span(instance.def_id()), "deref defined here");
}
)
&& let CallKind::DerefCoercion { deref_target_span, deref_target_ty, .. } = call_kind(
self.infcx.tcx,
self.infcx.typing_env(self.infcx.param_env),
method_did,
method_args,
*fn_span,
call_source.from_hir_call(),
Some(self.infcx.tcx.fn_arg_names(method_did)[0]),
)
{
err.note(format!("borrow occurs due to deref coercion to `{deref_target_ty}`"));
if let Some(deref_target_span) = deref_target_span {
err.span_note(deref_target_span, "deref defined here");
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_borrowck/src/diagnostics/explain_borrow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ use rustc_middle::mir::{
};
use rustc_middle::ty::adjustment::PointerCoercion;
use rustc_middle::ty::{self, RegionVid, Ty, TyCtxt};
use rustc_middle::util::CallKind;
use rustc_span::{DesugaringKind, Span, kw, sym};
use rustc_trait_selection::error_reporting::traits::FindExprBySpan;
use rustc_trait_selection::error_reporting::traits::call_kind::CallKind;
use tracing::{debug, instrument};

use super::{RegionName, UseSpans, find_use};
Expand Down
6 changes: 3 additions & 3 deletions compiler/rustc_borrowck/src/diagnostics/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ use rustc_middle::mir::{
StatementKind, Terminator, TerminatorKind,
};
use rustc_middle::ty::print::Print;
use rustc_middle::ty::{self, Instance, Ty, TyCtxt};
use rustc_middle::util::{CallDesugaringKind, call_kind};
use rustc_middle::ty::{self, Ty, TyCtxt};
use rustc_mir_dataflow::move_paths::{InitLocation, LookupResult, MoveOutIndex};
use rustc_span::def_id::LocalDefId;
use rustc_span::source_map::Spanned;
use rustc_span::{DUMMY_SP, ErrorGuaranteed, Span, Symbol, sym};
use rustc_trait_selection::error_reporting::InferCtxtErrorExt;
use rustc_trait_selection::error_reporting::traits::call_kind::{CallDesugaringKind, call_kind};
use rustc_trait_selection::infer::InferCtxtExt;
use rustc_trait_selection::traits::{
FulfillmentErrorCode, type_known_to_meet_bound_modulo_regions,
Expand Down Expand Up @@ -63,7 +63,7 @@ pub(crate) use mutability_errors::AccessKind;
pub(crate) use outlives_suggestion::OutlivesSuggestionBuilder;
pub(crate) use region_errors::{ErrorConstraintInfo, RegionErrorKind, RegionErrors};
pub(crate) use region_name::{RegionName, RegionNameSource};
pub(crate) use rustc_middle::util::CallKind;
pub(crate) use rustc_trait_selection::error_reporting::traits::call_kind::CallKind;

pub(super) struct DescribePlaceOpt {
including_downcast: bool,
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_borrowck/src/type_check/opaque_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ pub(super) fn take_opaques_and_register_member_constraints<'tcx>(
let opaque_types = infcx
.take_opaque_types()
.into_iter()
.map(|(opaque_type_key, decl)| {
let hidden_type = infcx.resolve_vars_if_possible(decl.hidden_type);
.map(|(opaque_type_key, hidden_type)| {
let hidden_type = infcx.resolve_vars_if_possible(hidden_type);
register_member_constraints(
typeck,
&mut member_constraints,
Expand Down
7 changes: 2 additions & 5 deletions compiler/rustc_codegen_gcc/.github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ jobs:
- { gcc: "gcc-13.deb" }
- { gcc: "gcc-13-without-int128.deb" }
commands: [
"--mini-tests",
"--std-tests",
# FIXME: re-enable asm tests when GCC can emit in the right syntax.
# "--asm-tests",
Expand Down Expand Up @@ -79,6 +78,7 @@ jobs:
run: |
./y.sh prepare --only-libcore
./y.sh build --sysroot
./y.sh test --mini-tests
cargo test
- name: Run y.sh cargo build
Expand All @@ -87,17 +87,14 @@ jobs:
- name: Clean
run: |
./y.sh clean all
./y.sh clean all
- name: Prepare dependencies
run: |
git config --global user.email "[email protected]"
git config --global user.name "User"
./y.sh prepare
- name: Add more failing tests because the sysroot is not compiled with LTO
run: cat tests/failing-non-lto-tests.txt >> tests/failing-ui-tests.txt

- name: Run tests
run: |
./y.sh test --release --clean --build-sysroot ${{ matrix.commands }}
Expand Down
7 changes: 2 additions & 5 deletions compiler/rustc_codegen_gcc/.github/workflows/failures.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,23 +90,20 @@ jobs:
if: matrix.libgccjit_version.gcc != 'libgccjit12.so'
run: ./y.sh prepare

- name: Add more failing tests because the sysroot is not compiled with LTO
run: cat tests/failing-non-lto-tests.txt >> tests/failing-ui-tests.txt

- name: Run tests
# TODO: re-enable those tests for libgccjit 12.
if: matrix.libgccjit_version.gcc != 'libgccjit12.so'
id: tests
run: |
${{ matrix.libgccjit_version.env_extra }} ./y.sh test --release --clean --build-sysroot --test-failing-rustc ${{ matrix.libgccjit_version.extra }} | tee output_log
${{ matrix.libgccjit_version.env_extra }} ./y.sh test --release --clean --build-sysroot --test-failing-rustc ${{ matrix.libgccjit_version.extra }} 2>&1 | tee output_log
rg --text "test result" output_log >> $GITHUB_STEP_SUMMARY
- name: Run failing ui pattern tests for ICE
# TODO: re-enable those tests for libgccjit 12.
if: matrix.libgccjit_version.gcc != 'libgccjit12.so'
id: ui-tests
run: |
${{ matrix.libgccjit_version.env_extra }} ./y.sh test --release --test-failing-ui-pattern-tests ${{ matrix.libgccjit_version.extra }} | tee output_log_ui
${{ matrix.libgccjit_version.env_extra }} ./y.sh test --release --test-failing-ui-pattern-tests ${{ matrix.libgccjit_version.extra }} 2>&1 | tee output_log_ui
if grep -q "the compiler unexpectedly panicked" output_log_ui; then
echo "Error: 'the compiler unexpectedly panicked' found in output logs. CI Error!!"
exit 1
Expand Down
3 changes: 0 additions & 3 deletions compiler/rustc_codegen_gcc/.github/workflows/gcc12.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,6 @@ jobs:
#- name: Add more failing tests for GCC 12
#run: cat tests/failing-ui-tests12.txt >> tests/failing-ui-tests.txt

#- name: Add more failing tests because the sysroot is not compiled with LTO
#run: cat tests/failing-non-lto-tests.txt >> tests/failing-ui-tests.txt

#- name: Run tests
#run: |
#./y.sh test --release --clean --build-sysroot ${{ matrix.commands }} --no-default-features
5 changes: 1 addition & 4 deletions compiler/rustc_codegen_gcc/.github/workflows/m68k.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ jobs:
fail-fast: false
matrix:
commands: [
"--mini-tests",
"--std-tests",
# TODO(antoyo): fix those on m68k.
#"--test-libcore",
Expand Down Expand Up @@ -93,6 +92,7 @@ jobs:
run: |
./y.sh prepare --only-libcore --cross
./y.sh build --sysroot --features compiler_builtins/no-f16-f128 --target-triple m68k-unknown-linux-gnu
./y.sh test --mini-tests
CG_GCC_TEST_TARGET=m68k-unknown-linux-gnu cargo test
./y.sh clean all
Expand All @@ -102,9 +102,6 @@ jobs:
git config --global user.name "User"
./y.sh prepare --cross
- name: Add more failing tests because the sysroot is not compiled with LTO
run: cat tests/failing-non-lto-tests.txt >> tests/failing-ui-tests.txt

- name: Run tests
run: |
./y.sh test --release --clean --build-sysroot --sysroot-features compiler_builtins/no-f16-f128 ${{ matrix.commands }}
10 changes: 8 additions & 2 deletions compiler/rustc_codegen_gcc/.github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ env:

jobs:
build:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04

strategy:
fail-fast: false
Expand Down Expand Up @@ -54,6 +54,7 @@ jobs:
run: |
./y.sh prepare --only-libcore
EMBED_LTO_BITCODE=1 ./y.sh build --sysroot --release --release-sysroot
./y.sh test --mini-tests
cargo test
./y.sh clean all
Expand All @@ -70,4 +71,9 @@ jobs:
run: |
# FIXME(antoyo): we cannot enable LTO for stdarch tests currently because of some failing LTO tests using proc-macros.
echo -n 'lto = "fat"' >> build_system/build_sysroot/Cargo.toml
EMBED_LTO_BITCODE=1 ./y.sh test --release --clean --release-sysroot --build-sysroot ${{ matrix.commands }}
EMBED_LTO_BITCODE=1 ./y.sh test --release --clean --release-sysroot --build-sysroot --keep-lto-tests ${{ matrix.commands }}
- name: Run y.sh cargo build
run: |
EMBED_LTO_BITCODE=1 CHANNEL="release" ./y.sh cargo build --release --manifest-path tests/hello-world/Cargo.toml
# TODO: grep the asm output for "call my_func" and fail if it is found.
5 changes: 1 addition & 4 deletions compiler/rustc_codegen_gcc/.github/workflows/stdarch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,6 @@ jobs:
echo "LD_LIBRARY_PATH="$(./y.sh info | grep -v Using) >> $GITHUB_ENV
echo "LIBRARY_PATH="$(./y.sh info | grep -v Using) >> $GITHUB_ENV
- name: Build (part 2)
run: |
cargo test
- name: Clean
if: ${{ !matrix.cargo_runner }}
run: |
Expand All @@ -92,6 +88,7 @@ jobs:
if: ${{ !matrix.cargo_runner }}
run: |
./y.sh test --release --clean --release-sysroot --build-sysroot --mini-tests --std-tests --test-libcore
cargo test
- name: Run stdarch tests
if: ${{ !matrix.cargo_runner }}
Expand Down
4 changes: 3 additions & 1 deletion compiler/rustc_codegen_gcc/.rustfmt.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
version = "Two"
style_edition = "2024"
use_small_heuristics = "Max"
merge_derives = false
group_imports = "StdExternalCrate"
imports_granularity = "Module"
Loading

0 comments on commit 5460fbe

Please sign in to comment.