Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 8 pull requests #129393

Closed
wants to merge 21 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
68fb25e
Make use of raw strings in `core::fmt::builders`
tgross35 Jul 19, 2024
827970e
Implement `debug_more_non_exhaustive`
tgross35 Jul 19, 2024
803cbaf
Add f16 and f128 to tests/ui/consts/const-float-bits-conv.rs
rezwanahmedsami Aug 17, 2024
1687c55
bootstrap: fix clean's `remove_dir_all` implementation
jieyouxu Aug 17, 2024
9f39427
Added #[cfg(target_arch = x86_64)] to f16 and f128
rezwanahmedsami Aug 18, 2024
c7832b8
move `Build::update_submodule` to `Config::update_submodule`
onur-ozkan Aug 18, 2024
3d0f3b2
bypass `dry_run` if the command is `run_always`
onur-ozkan Aug 18, 2024
1ca2708
sync llvm submodule during config parse
onur-ozkan Aug 18, 2024
35752cf
Update `library/Cargo.toml` in weekly job
tgross35 Aug 19, 2024
d2d8fa4
fix broken bootstrap documentation
onur-ozkan Aug 19, 2024
75ed089
compiletest: use `std::fs::remove_dir_all` now that it is available
jieyouxu Aug 20, 2024
f5bae72
Point at explicit `'static` obligations on a trait
estebank Aug 12, 2024
40f1d9d
Add missing module flags for CFI and KCFI sanitizers
samitolvanen Aug 16, 2024
5d7ed27
Rollup merge of #127945 - tgross35:debug-more-non-exhaustive, r=Norat…
jieyouxu Aug 22, 2024
94a38fd
Rollup merge of #129070 - estebank:static-trait, r=davidtwco
jieyouxu Aug 22, 2024
0e92667
Rollup merge of #129187 - jieyouxu:squeaky-clean-windows-symlinks, r=…
jieyouxu Aug 22, 2024
b79cc36
Rollup merge of #129190 - rezwanahmedsami:master, r=tgross35
jieyouxu Aug 22, 2024
44cdda4
Rollup merge of #129231 - onur-ozkan:improve-submodule-updates, r=Mar…
jieyouxu Aug 22, 2024
360e826
Rollup merge of #129264 - tgross35:dependencies-ci-library, r=Kobzol
jieyouxu Aug 22, 2024
114d6b0
Rollup merge of #129302 - jieyouxu:compiletest-RAGEY, r=compiler-errors
jieyouxu Aug 22, 2024
a0428cb
Rollup merge of #129373 - samitolvanen:cfi-module-flags, r=compiler-e…
jieyouxu Aug 22, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion .github/workflows/dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ jobs:
- name: cargo update
# Remove first line that always just says "Updating crates.io index"
run: cargo update 2>&1 | sed '/crates.io index/d' | tee -a cargo_update.log
- name: cargo update library
run: |
echo -e "\nlibrary dependencies:" >> cargo_update.log
cargo update --manifest-path library/Cargo.toml 2>&1 | sed '/crates.io index/d' | tee -a cargo_update.log
- name: cargo update rustbook
run: |
echo -e "\nrustbook dependencies:" >> cargo_update.log
Expand All @@ -74,6 +78,7 @@ jobs:
name: Cargo-lock
path: |
Cargo.lock
library/Cargo.lock
src/tools/rustbook/Cargo.lock
retention-days: 1
- name: upload cargo-update log artifact for use in PR
Expand Down Expand Up @@ -119,7 +124,7 @@ jobs:
git config user.name github-actions
git config user.email [email protected]
git switch --force-create cargo_update
git add ./Cargo.lock ./src/tools/rustbook/Cargo.lock
git add ./Cargo.lock ./library/Cargo.lock ./src/tools/rustbook/Cargo.lock
git commit --no-verify --file=commit.txt

- name: push
Expand Down
31 changes: 31 additions & 0 deletions compiler/rustc_codegen_llvm/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ use rustc_data_structures::base_n::{ToBaseN, ALPHANUMERIC_ONLY};
use rustc_data_structures::fx::FxHashMap;
use rustc_data_structures::small_c_str::SmallCStr;
use rustc_hir::def_id::DefId;
use rustc_middle::middle::codegen_fn_attrs::PatchableFunctionEntry;
use rustc_middle::mir::mono::CodegenUnit;
use rustc_middle::ty::layout::{
FnAbiError, FnAbiOfHelpers, FnAbiRequest, HasParamEnv, LayoutError, LayoutOfHelpers,
Expand Down Expand Up @@ -226,6 +227,20 @@ pub unsafe fn create_module<'ll>(
}
}

// If we're normalizing integers with CFI, ensure LLVM generated functions do the same.
// See https://github.com/llvm/llvm-project/pull/104826
if sess.is_sanitizer_cfi_normalize_integers_enabled() {
let cfi_normalize_integers = c"cfi-normalize-integers".as_ptr().cast();
unsafe {
llvm::LLVMRustAddModuleFlagU32(
llmod,
llvm::LLVMModFlagBehavior::Override,
cfi_normalize_integers,
1,
);
}
}

// Enable LTO unit splitting if specified or if CFI is enabled. (See https://reviews.llvm.org/D53891.)
if sess.is_split_lto_unit_enabled() || sess.is_sanitizer_cfi_enabled() {
let enable_split_lto_unit = c"EnableSplitLTOUnit".as_ptr();
Expand All @@ -245,6 +260,22 @@ pub unsafe fn create_module<'ll>(
unsafe {
llvm::LLVMRustAddModuleFlagU32(llmod, llvm::LLVMModFlagBehavior::Override, kcfi, 1);
}

// Add "kcfi-offset" module flag with -Z patchable-function-entry (See
// https://reviews.llvm.org/D141172).
let pfe =
PatchableFunctionEntry::from_config(sess.opts.unstable_opts.patchable_function_entry);
if pfe.prefix() > 0 {
let kcfi_offset = c"kcfi-offset".as_ptr().cast();
unsafe {
llvm::LLVMRustAddModuleFlagU32(
llmod,
llvm::LLVMModFlagBehavior::Override,
kcfi_offset,
pfe.prefix().into(),
);
}
}
}

// Control Flow Guard is currently only supported by the MSVC linker on Windows.
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_hir_analysis/src/check/wfcheck.rs
Original file line number Diff line number Diff line change
Expand Up @@ -747,7 +747,7 @@ fn region_known_to_outlive<'tcx>(
region_b: ty::Region<'tcx>,
) -> bool {
test_region_obligations(tcx, id, param_env, wf_tys, |infcx| {
infcx.sub_regions(infer::RelateRegionParamBound(DUMMY_SP), region_b, region_a);
infcx.sub_regions(infer::RelateRegionParamBound(DUMMY_SP, None), region_b, region_a);
})
}

Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_infer/src/infer/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ impl<'tcx> InferCtxtLike for InferCtxt<'tcx> {
}

fn sub_regions(&self, sub: ty::Region<'tcx>, sup: ty::Region<'tcx>) {
self.sub_regions(SubregionOrigin::RelateRegionParamBound(DUMMY_SP), sub, sup)
self.sub_regions(SubregionOrigin::RelateRegionParamBound(DUMMY_SP, None), sub, sup)
}

fn register_ty_outlives(&self, ty: Ty<'tcx>, r: ty::Region<'tcx>) {
Expand Down
10 changes: 7 additions & 3 deletions compiler/rustc_infer/src/infer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ pub enum SubregionOrigin<'tcx> {

/// The given region parameter was instantiated with a region
/// that must outlive some other region.
RelateRegionParamBound(Span),
RelateRegionParamBound(Span, Option<Ty<'tcx>>),

/// Creating a pointer `b` to contents of another reference.
Reborrow(Span),
Expand Down Expand Up @@ -859,7 +859,7 @@ impl<'tcx> InferCtxt<'tcx> {
) {
self.enter_forall(predicate, |ty::OutlivesPredicate(r_a, r_b)| {
let origin = SubregionOrigin::from_obligation_cause(cause, || {
RelateRegionParamBound(cause.span)
RelateRegionParamBound(cause.span, None)
});
self.sub_regions(origin, r_b, r_a); // `b : a` ==> `a <= b`
})
Expand Down Expand Up @@ -1685,7 +1685,7 @@ impl<'tcx> SubregionOrigin<'tcx> {
Subtype(ref a) => a.span(),
RelateObjectBound(a) => a,
RelateParamBound(a, ..) => a,
RelateRegionParamBound(a) => a,
RelateRegionParamBound(a, _) => a,
Reborrow(a) => a,
ReferenceOutlivesReferent(_, a) => a,
CompareImplItemObligation { span, .. } => span,
Expand Down Expand Up @@ -1726,6 +1726,10 @@ impl<'tcx> SubregionOrigin<'tcx> {
SubregionOrigin::AscribeUserTypeProvePredicate(span)
}

traits::ObligationCauseCode::ObjectTypeBound(ty, _reg) => {
SubregionOrigin::RelateRegionParamBound(cause.span, Some(ty))
}

_ => default(),
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ impl<'tcx> NiceRegionError<'_, 'tcx> {
pub(super) fn try_report_placeholder_relation(&self) -> Option<Diag<'tcx>> {
match &self.error {
Some(RegionResolutionError::ConcreteFailure(
SubregionOrigin::RelateRegionParamBound(span),
SubregionOrigin::RelateRegionParamBound(span, _),
Region(Interned(
RePlaceholder(ty::Placeholder {
bound: ty::BoundRegion { kind: sub_name, .. },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
.add_to_diag(err);
}
}
infer::RelateRegionParamBound(span) => {
infer::RelateRegionParamBound(span, _) => {
RegionOriginNote::Plain { span, msg: fluent::infer_relate_region_param_bound }
.add_to_diag(err);
}
Expand Down Expand Up @@ -199,7 +199,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
note,
})
}
infer::RelateRegionParamBound(span) => {
infer::RelateRegionParamBound(span, _) => {
let param_instantiated = note_and_explain::RegionExplanation::new(
self.tcx,
generic_param_scope,
Expand Down
26 changes: 23 additions & 3 deletions compiler/rustc_trait_selection/src/error_reporting/infer/region.rs
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
.add_to_diag(err);
}
}
infer::RelateRegionParamBound(span) => {
infer::RelateRegionParamBound(span, _) => {
RegionOriginNote::Plain {
span,
msg: fluent::trait_selection_relate_region_param_bound,
Expand Down Expand Up @@ -410,7 +410,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
note,
})
}
infer::RelateRegionParamBound(span) => {
infer::RelateRegionParamBound(span, ty) => {
let param_instantiated = note_and_explain::RegionExplanation::new(
self.tcx,
generic_param_scope,
Expand All @@ -419,11 +419,31 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
note_and_explain::PrefixKind::LfParamInstantiatedWith,
note_and_explain::SuffixKind::Empty,
);
let mut alt_span = None;
if let Some(ty) = ty
&& sub.is_static()
&& let ty::Dynamic(preds, _, ty::DynKind::Dyn) = ty.kind()
&& let Some(def_id) = preds.principal_def_id()
{
for (clause, span) in
self.tcx.predicates_of(def_id).instantiate_identity(self.tcx)
{
if let ty::ClauseKind::TypeOutlives(ty::OutlivesPredicate(a, b)) =
clause.kind().skip_binder()
&& let ty::Param(param) = a.kind()
&& param.name == kw::SelfUpper
&& b.is_static()
{
// Point at explicit `'static` bound on the trait (`trait T: 'static`).
alt_span = Some(span);
}
}
}
let param_must_outlive = note_and_explain::RegionExplanation::new(
self.tcx,
generic_param_scope,
sub,
None,
alt_span,
note_and_explain::PrefixKind::LfParamMustOutlive,
note_and_explain::SuffixKind::Empty,
);
Expand Down
Loading
Loading