Auto merge of #114637 - matthiaskrgr:rollup-544y8p5, r=matthiaskrgr
Rollup of 11 pull requests Successful merges: - #106425 (Make ExitStatus implement Default) - #113480 (add aarch64-unknown-teeos target) - #113586 (Mention style for new syntax in tracking issue template) - #113593 (CFI: Fix error compiling core with LLVM CFI enabled) - #114612 (update llvm-wrapper include to silence deprecation warning) - #114613 (Prevent constant rebuilds of `rustc-main` (and thus everything else)) - #114615 (interpret: remove incomplete protection against invalid where clauses) - #114628 (Allowing re-implementation of mir_drops_elaborated query) - #114629 (tests: Uncomment now valid GAT code behind FIXME) - #114630 (Migrate GUI colors test to original CSS color format) - #114631 (add provisional cache test for new solver) r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
commit
e3590fccfb
46 changed files with 451 additions and 217 deletions
3
.github/ISSUE_TEMPLATE/tracking_issue.md
vendored
3
.github/ISSUE_TEMPLATE/tracking_issue.md
vendored
|
@ -39,10 +39,13 @@ for larger features an implementation could be broken up into multiple PRs.
|
||||||
- [ ] Implement the RFC (cc @rust-lang/XXX -- can anyone write up mentoring
|
- [ ] Implement the RFC (cc @rust-lang/XXX -- can anyone write up mentoring
|
||||||
instructions?)
|
instructions?)
|
||||||
- [ ] Adjust documentation ([see instructions on rustc-dev-guide][doc-guide])
|
- [ ] Adjust documentation ([see instructions on rustc-dev-guide][doc-guide])
|
||||||
|
- [ ] Formatting for new syntax has been added to the [Style Guide] ([nightly-style-procedure])
|
||||||
- [ ] Stabilization PR ([see instructions on rustc-dev-guide][stabilization-guide])
|
- [ ] Stabilization PR ([see instructions on rustc-dev-guide][stabilization-guide])
|
||||||
|
|
||||||
[stabilization-guide]: https://rustc-dev-guide.rust-lang.org/stabilization_guide.html#stabilization-pr
|
[stabilization-guide]: https://rustc-dev-guide.rust-lang.org/stabilization_guide.html#stabilization-pr
|
||||||
[doc-guide]: https://rustc-dev-guide.rust-lang.org/stabilization_guide.html#documentation-prs
|
[doc-guide]: https://rustc-dev-guide.rust-lang.org/stabilization_guide.html#documentation-prs
|
||||||
|
[nightly-style-procedure]: https://github.com/rust-lang/style-team/blob/master/nightly-style-procedure.md
|
||||||
|
[Style Guide]: https://github.com/rust-lang/rust/tree/master/src/doc/style-guide
|
||||||
|
|
||||||
### Unresolved Questions
|
### Unresolved Questions
|
||||||
<!--
|
<!--
|
||||||
|
|
|
@ -472,6 +472,8 @@ pub(crate) unsafe fn llvm_optimize(
|
||||||
Some(llvm::SanitizerOptions {
|
Some(llvm::SanitizerOptions {
|
||||||
sanitize_address: config.sanitizer.contains(SanitizerSet::ADDRESS),
|
sanitize_address: config.sanitizer.contains(SanitizerSet::ADDRESS),
|
||||||
sanitize_address_recover: config.sanitizer_recover.contains(SanitizerSet::ADDRESS),
|
sanitize_address_recover: config.sanitizer_recover.contains(SanitizerSet::ADDRESS),
|
||||||
|
sanitize_cfi: config.sanitizer.contains(SanitizerSet::CFI),
|
||||||
|
sanitize_kcfi: config.sanitizer.contains(SanitizerSet::KCFI),
|
||||||
sanitize_memory: config.sanitizer.contains(SanitizerSet::MEMORY),
|
sanitize_memory: config.sanitizer.contains(SanitizerSet::MEMORY),
|
||||||
sanitize_memory_recover: config.sanitizer_recover.contains(SanitizerSet::MEMORY),
|
sanitize_memory_recover: config.sanitizer_recover.contains(SanitizerSet::MEMORY),
|
||||||
sanitize_memory_track_origins: config.sanitizer_memory_track_origins as c_int,
|
sanitize_memory_track_origins: config.sanitizer_memory_track_origins as c_int,
|
||||||
|
@ -507,6 +509,7 @@ pub(crate) unsafe fn llvm_optimize(
|
||||||
&*module.module_llvm.tm,
|
&*module.module_llvm.tm,
|
||||||
to_pass_builder_opt_level(opt_level),
|
to_pass_builder_opt_level(opt_level),
|
||||||
opt_stage,
|
opt_stage,
|
||||||
|
cgcx.opts.cg.linker_plugin_lto.enabled(),
|
||||||
config.no_prepopulate_passes,
|
config.no_prepopulate_passes,
|
||||||
config.verify_llvm_ir,
|
config.verify_llvm_ir,
|
||||||
using_thin_buffers,
|
using_thin_buffers,
|
||||||
|
|
|
@ -1512,9 +1512,9 @@ impl<'a, 'll, 'tcx> Builder<'a, 'll, 'tcx> {
|
||||||
fn_abi: Option<&FnAbi<'tcx, Ty<'tcx>>>,
|
fn_abi: Option<&FnAbi<'tcx, Ty<'tcx>>>,
|
||||||
llfn: &'ll Value,
|
llfn: &'ll Value,
|
||||||
) {
|
) {
|
||||||
let is_indirect_call = unsafe { llvm::LLVMIsAFunction(llfn).is_none() };
|
let is_indirect_call = unsafe { llvm::LLVMRustIsNonGVFunctionPointerTy(llfn) };
|
||||||
if is_indirect_call && fn_abi.is_some() && self.tcx.sess.is_sanitizer_cfi_enabled() {
|
if self.tcx.sess.is_sanitizer_cfi_enabled() && let Some(fn_abi) = fn_abi && is_indirect_call {
|
||||||
if fn_attrs.is_some() && fn_attrs.unwrap().no_sanitize.contains(SanitizerSet::CFI) {
|
if let Some(fn_attrs) = fn_attrs && fn_attrs.no_sanitize.contains(SanitizerSet::CFI) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1526,7 +1526,7 @@ impl<'a, 'll, 'tcx> Builder<'a, 'll, 'tcx> {
|
||||||
options.insert(TypeIdOptions::NORMALIZE_INTEGERS);
|
options.insert(TypeIdOptions::NORMALIZE_INTEGERS);
|
||||||
}
|
}
|
||||||
|
|
||||||
let typeid = typeid_for_fnabi(self.tcx, fn_abi.unwrap(), options);
|
let typeid = typeid_for_fnabi(self.tcx, fn_abi, options);
|
||||||
let typeid_metadata = self.cx.typeid_metadata(typeid).unwrap();
|
let typeid_metadata = self.cx.typeid_metadata(typeid).unwrap();
|
||||||
|
|
||||||
// Test whether the function pointer is associated with the type identifier.
|
// Test whether the function pointer is associated with the type identifier.
|
||||||
|
@ -1550,25 +1550,26 @@ impl<'a, 'll, 'tcx> Builder<'a, 'll, 'tcx> {
|
||||||
fn_abi: Option<&FnAbi<'tcx, Ty<'tcx>>>,
|
fn_abi: Option<&FnAbi<'tcx, Ty<'tcx>>>,
|
||||||
llfn: &'ll Value,
|
llfn: &'ll Value,
|
||||||
) -> Option<llvm::OperandBundleDef<'ll>> {
|
) -> Option<llvm::OperandBundleDef<'ll>> {
|
||||||
let is_indirect_call = unsafe { llvm::LLVMIsAFunction(llfn).is_none() };
|
let is_indirect_call = unsafe { llvm::LLVMRustIsNonGVFunctionPointerTy(llfn) };
|
||||||
let kcfi_bundle = if is_indirect_call && self.tcx.sess.is_sanitizer_kcfi_enabled() {
|
let kcfi_bundle =
|
||||||
if fn_attrs.is_some() && fn_attrs.unwrap().no_sanitize.contains(SanitizerSet::KCFI) {
|
if self.tcx.sess.is_sanitizer_kcfi_enabled() && let Some(fn_abi) = fn_abi && is_indirect_call {
|
||||||
return None;
|
if let Some(fn_attrs) = fn_attrs && fn_attrs.no_sanitize.contains(SanitizerSet::KCFI) {
|
||||||
}
|
return None;
|
||||||
|
}
|
||||||
|
|
||||||
let mut options = TypeIdOptions::empty();
|
let mut options = TypeIdOptions::empty();
|
||||||
if self.tcx.sess.is_sanitizer_cfi_generalize_pointers_enabled() {
|
if self.tcx.sess.is_sanitizer_cfi_generalize_pointers_enabled() {
|
||||||
options.insert(TypeIdOptions::GENERALIZE_POINTERS);
|
options.insert(TypeIdOptions::GENERALIZE_POINTERS);
|
||||||
}
|
}
|
||||||
if self.tcx.sess.is_sanitizer_cfi_normalize_integers_enabled() {
|
if self.tcx.sess.is_sanitizer_cfi_normalize_integers_enabled() {
|
||||||
options.insert(TypeIdOptions::NORMALIZE_INTEGERS);
|
options.insert(TypeIdOptions::NORMALIZE_INTEGERS);
|
||||||
}
|
}
|
||||||
|
|
||||||
let kcfi_typeid = kcfi_typeid_for_fnabi(self.tcx, fn_abi.unwrap(), options);
|
let kcfi_typeid = kcfi_typeid_for_fnabi(self.tcx, fn_abi, options);
|
||||||
Some(llvm::OperandBundleDef::new("kcfi", &[self.const_u32(kcfi_typeid)]))
|
Some(llvm::OperandBundleDef::new("kcfi", &[self.const_u32(kcfi_typeid)]))
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
};
|
};
|
||||||
kcfi_bundle
|
kcfi_bundle
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -475,6 +475,8 @@ pub enum OptStage {
|
||||||
pub struct SanitizerOptions {
|
pub struct SanitizerOptions {
|
||||||
pub sanitize_address: bool,
|
pub sanitize_address: bool,
|
||||||
pub sanitize_address_recover: bool,
|
pub sanitize_address_recover: bool,
|
||||||
|
pub sanitize_cfi: bool,
|
||||||
|
pub sanitize_kcfi: bool,
|
||||||
pub sanitize_memory: bool,
|
pub sanitize_memory: bool,
|
||||||
pub sanitize_memory_recover: bool,
|
pub sanitize_memory_recover: bool,
|
||||||
pub sanitize_memory_track_origins: c_int,
|
pub sanitize_memory_track_origins: c_int,
|
||||||
|
@ -894,6 +896,7 @@ extern "C" {
|
||||||
pub fn LLVMRustGlobalAddMetadata<'a>(Val: &'a Value, KindID: c_uint, Metadata: &'a Metadata);
|
pub fn LLVMRustGlobalAddMetadata<'a>(Val: &'a Value, KindID: c_uint, Metadata: &'a Metadata);
|
||||||
pub fn LLVMValueAsMetadata(Node: &Value) -> &Metadata;
|
pub fn LLVMValueAsMetadata(Node: &Value) -> &Metadata;
|
||||||
pub fn LLVMIsAFunction(Val: &Value) -> Option<&Value>;
|
pub fn LLVMIsAFunction(Val: &Value) -> Option<&Value>;
|
||||||
|
pub fn LLVMRustIsNonGVFunctionPointerTy(Val: &Value) -> bool;
|
||||||
|
|
||||||
// Operations on constants of any type
|
// Operations on constants of any type
|
||||||
pub fn LLVMConstNull(Ty: &Type) -> &Value;
|
pub fn LLVMConstNull(Ty: &Type) -> &Value;
|
||||||
|
@ -2138,6 +2141,7 @@ extern "C" {
|
||||||
TM: &'a TargetMachine,
|
TM: &'a TargetMachine,
|
||||||
OptLevel: PassBuilderOptLevel,
|
OptLevel: PassBuilderOptLevel,
|
||||||
OptStage: OptStage,
|
OptStage: OptStage,
|
||||||
|
IsLinkerPluginLTO: bool,
|
||||||
NoPrepopulatePasses: bool,
|
NoPrepopulatePasses: bool,
|
||||||
VerifyIR: bool,
|
VerifyIR: bool,
|
||||||
UseThinLTOBuffers: bool,
|
UseThinLTOBuffers: bool,
|
||||||
|
|
|
@ -303,8 +303,6 @@ const_eval_remainder_overflow =
|
||||||
overflow in signed remainder (dividing MIN by -1)
|
overflow in signed remainder (dividing MIN by -1)
|
||||||
const_eval_scalar_size_mismatch =
|
const_eval_scalar_size_mismatch =
|
||||||
scalar size mismatch: expected {$target_size} bytes but got {$data_size} bytes instead
|
scalar size mismatch: expected {$target_size} bytes but got {$data_size} bytes instead
|
||||||
const_eval_size_of_unsized =
|
|
||||||
size_of called on unsized type `{$ty}`
|
|
||||||
const_eval_size_overflow =
|
const_eval_size_overflow =
|
||||||
overflow computing total size of `{$name}`
|
overflow computing total size of `{$name}`
|
||||||
|
|
||||||
|
|
|
@ -862,7 +862,6 @@ impl<'tcx> ReportErrorExt for InvalidProgramInfo<'tcx> {
|
||||||
InvalidProgramInfo::FnAbiAdjustForForeignAbi(_) => {
|
InvalidProgramInfo::FnAbiAdjustForForeignAbi(_) => {
|
||||||
rustc_middle::error::middle_adjust_for_foreign_abi_error
|
rustc_middle::error::middle_adjust_for_foreign_abi_error
|
||||||
}
|
}
|
||||||
InvalidProgramInfo::SizeOfUnsizedType(_) => const_eval_size_of_unsized,
|
|
||||||
InvalidProgramInfo::ConstPropNonsense => {
|
InvalidProgramInfo::ConstPropNonsense => {
|
||||||
panic!("We had const-prop nonsense, this should never be printed")
|
panic!("We had const-prop nonsense, this should never be printed")
|
||||||
}
|
}
|
||||||
|
@ -890,9 +889,6 @@ impl<'tcx> ReportErrorExt for InvalidProgramInfo<'tcx> {
|
||||||
builder.set_arg("arch", arch);
|
builder.set_arg("arch", arch);
|
||||||
builder.set_arg("abi", abi.name());
|
builder.set_arg("abi", abi.name());
|
||||||
}
|
}
|
||||||
InvalidProgramInfo::SizeOfUnsizedType(ty) => {
|
|
||||||
builder.set_arg("ty", ty);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -269,13 +269,10 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
|
||||||
let ty = self.subst_from_current_frame_and_normalize_erasing_regions(ty)?;
|
let ty = self.subst_from_current_frame_and_normalize_erasing_regions(ty)?;
|
||||||
let layout = self.layout_of(ty)?;
|
let layout = self.layout_of(ty)?;
|
||||||
if let mir::NullOp::SizeOf | mir::NullOp::AlignOf = null_op && layout.is_unsized() {
|
if let mir::NullOp::SizeOf | mir::NullOp::AlignOf = null_op && layout.is_unsized() {
|
||||||
// FIXME: This should be a span_bug, but const generics can run MIR
|
span_bug!(
|
||||||
// that is not properly type-checked yet (#97477).
|
|
||||||
self.tcx.sess.delay_span_bug(
|
|
||||||
self.frame().current_span(),
|
self.frame().current_span(),
|
||||||
format!("{null_op:?} MIR operator called for unsized type {ty}"),
|
"{null_op:?} MIR operator called for unsized type {ty}",
|
||||||
);
|
);
|
||||||
throw_inval!(SizeOfUnsizedType(ty));
|
|
||||||
}
|
}
|
||||||
let val = match null_op {
|
let val = match null_op {
|
||||||
mir::NullOp::SizeOf => layout.size.bytes(),
|
mir::NullOp::SizeOf => layout.size.bytes(),
|
||||||
|
|
|
@ -15,7 +15,6 @@
|
||||||
#include "llvm/Support/DynamicLibrary.h"
|
#include "llvm/Support/DynamicLibrary.h"
|
||||||
#include "llvm/Support/FormattedStream.h"
|
#include "llvm/Support/FormattedStream.h"
|
||||||
#include "llvm/Support/JSON.h"
|
#include "llvm/Support/JSON.h"
|
||||||
#include "llvm/Support/Host.h"
|
|
||||||
#include "llvm/Support/Memory.h"
|
#include "llvm/Support/Memory.h"
|
||||||
#include "llvm/Support/SourceMgr.h"
|
#include "llvm/Support/SourceMgr.h"
|
||||||
#include "llvm/Support/TargetSelect.h"
|
#include "llvm/Support/TargetSelect.h"
|
||||||
|
|
|
@ -25,11 +25,11 @@
|
||||||
#if LLVM_VERSION_GE(17, 0)
|
#if LLVM_VERSION_GE(17, 0)
|
||||||
#include "llvm/Support/VirtualFileSystem.h"
|
#include "llvm/Support/VirtualFileSystem.h"
|
||||||
#endif
|
#endif
|
||||||
#include "llvm/Support/Host.h"
|
|
||||||
#include "llvm/Target/TargetMachine.h"
|
#include "llvm/Target/TargetMachine.h"
|
||||||
#include "llvm/Transforms/IPO/AlwaysInliner.h"
|
#include "llvm/Transforms/IPO/AlwaysInliner.h"
|
||||||
#include "llvm/Transforms/IPO/FunctionImport.h"
|
#include "llvm/Transforms/IPO/FunctionImport.h"
|
||||||
#include "llvm/Transforms/IPO/Internalize.h"
|
#include "llvm/Transforms/IPO/Internalize.h"
|
||||||
|
#include "llvm/Transforms/IPO/LowerTypeTests.h"
|
||||||
#include "llvm/Transforms/IPO/ThinLTOBitcodeWriter.h"
|
#include "llvm/Transforms/IPO/ThinLTOBitcodeWriter.h"
|
||||||
#include "llvm/Transforms/Utils/AddDiscriminators.h"
|
#include "llvm/Transforms/Utils/AddDiscriminators.h"
|
||||||
#include "llvm/Transforms/Utils/FunctionImportUtils.h"
|
#include "llvm/Transforms/Utils/FunctionImportUtils.h"
|
||||||
|
@ -609,6 +609,8 @@ enum class LLVMRustOptStage {
|
||||||
struct LLVMRustSanitizerOptions {
|
struct LLVMRustSanitizerOptions {
|
||||||
bool SanitizeAddress;
|
bool SanitizeAddress;
|
||||||
bool SanitizeAddressRecover;
|
bool SanitizeAddressRecover;
|
||||||
|
bool SanitizeCFI;
|
||||||
|
bool SanitizeKCFI;
|
||||||
bool SanitizeMemory;
|
bool SanitizeMemory;
|
||||||
bool SanitizeMemoryRecover;
|
bool SanitizeMemoryRecover;
|
||||||
int SanitizeMemoryTrackOrigins;
|
int SanitizeMemoryTrackOrigins;
|
||||||
|
@ -625,6 +627,7 @@ LLVMRustOptimize(
|
||||||
LLVMTargetMachineRef TMRef,
|
LLVMTargetMachineRef TMRef,
|
||||||
LLVMRustPassBuilderOptLevel OptLevelRust,
|
LLVMRustPassBuilderOptLevel OptLevelRust,
|
||||||
LLVMRustOptStage OptStage,
|
LLVMRustOptStage OptStage,
|
||||||
|
bool IsLinkerPluginLTO,
|
||||||
bool NoPrepopulatePasses, bool VerifyIR, bool UseThinLTOBuffers,
|
bool NoPrepopulatePasses, bool VerifyIR, bool UseThinLTOBuffers,
|
||||||
bool MergeFunctions, bool UnrollLoops, bool SLPVectorize, bool LoopVectorize,
|
bool MergeFunctions, bool UnrollLoops, bool SLPVectorize, bool LoopVectorize,
|
||||||
bool DisableSimplifyLibCalls, bool EmitLifetimeMarkers,
|
bool DisableSimplifyLibCalls, bool EmitLifetimeMarkers,
|
||||||
|
@ -736,6 +739,18 @@ LLVMRustOptimize(
|
||||||
std::vector<std::function<void(ModulePassManager &, OptimizationLevel)>>
|
std::vector<std::function<void(ModulePassManager &, OptimizationLevel)>>
|
||||||
OptimizerLastEPCallbacks;
|
OptimizerLastEPCallbacks;
|
||||||
|
|
||||||
|
if (!IsLinkerPluginLTO
|
||||||
|
&& SanitizerOptions && SanitizerOptions->SanitizeCFI
|
||||||
|
&& !NoPrepopulatePasses) {
|
||||||
|
PipelineStartEPCallbacks.push_back(
|
||||||
|
[](ModulePassManager &MPM, OptimizationLevel Level) {
|
||||||
|
MPM.addPass(LowerTypeTestsPass(/*ExportSummary=*/nullptr,
|
||||||
|
/*ImportSummary=*/nullptr,
|
||||||
|
/*DropTypeTests=*/false));
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if (VerifyIR) {
|
if (VerifyIR) {
|
||||||
PipelineStartEPCallbacks.push_back(
|
PipelineStartEPCallbacks.push_back(
|
||||||
[VerifyIR](ModulePassManager &MPM, OptimizationLevel Level) {
|
[VerifyIR](ModulePassManager &MPM, OptimizationLevel Level) {
|
||||||
|
|
|
@ -2033,3 +2033,14 @@ extern "C" int32_t LLVMRustGetElementTypeArgIndex(LLVMValueRef CallSite) {
|
||||||
extern "C" bool LLVMRustIsBitcode(char *ptr, size_t len) {
|
extern "C" bool LLVMRustIsBitcode(char *ptr, size_t len) {
|
||||||
return identify_magic(StringRef(ptr, len)) == file_magic::bitcode;
|
return identify_magic(StringRef(ptr, len)) == file_magic::bitcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern "C" bool LLVMRustIsNonGVFunctionPointerTy(LLVMValueRef V) {
|
||||||
|
if (unwrap<Value>(V)->getType()->isPointerTy()) {
|
||||||
|
if (auto *GV = dyn_cast<GlobalValue>(unwrap<Value>(V))) {
|
||||||
|
if (GV->getValueType()->isFunctionTy())
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
|
@ -184,8 +184,6 @@ pub enum InvalidProgramInfo<'tcx> {
|
||||||
/// (which unfortunately typeck does not reject).
|
/// (which unfortunately typeck does not reject).
|
||||||
/// Not using `FnAbiError` as that contains a nested `LayoutError`.
|
/// Not using `FnAbiError` as that contains a nested `LayoutError`.
|
||||||
FnAbiAdjustForForeignAbi(call::AdjustForForeignAbiError),
|
FnAbiAdjustForForeignAbi(call::AdjustForForeignAbiError),
|
||||||
/// SizeOf of unsized type was requested.
|
|
||||||
SizeOfUnsizedType(Ty<'tcx>),
|
|
||||||
/// We are runnning into a nonsense situation due to ConstProp violating our invariants.
|
/// We are runnning into a nonsense situation due to ConstProp violating our invariants.
|
||||||
ConstPropNonsense,
|
ConstPropNonsense,
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,7 +75,7 @@ mod errors;
|
||||||
mod ffi_unwind_calls;
|
mod ffi_unwind_calls;
|
||||||
mod function_item_references;
|
mod function_item_references;
|
||||||
mod generator;
|
mod generator;
|
||||||
mod inline;
|
pub mod inline;
|
||||||
mod instsimplify;
|
mod instsimplify;
|
||||||
mod large_enums;
|
mod large_enums;
|
||||||
mod lower_intrinsics;
|
mod lower_intrinsics;
|
||||||
|
@ -431,7 +431,9 @@ fn mir_drops_elaborated_and_const_checked(tcx: TyCtxt<'_>, def: LocalDefId) -> &
|
||||||
tcx.alloc_steal_mir(body)
|
tcx.alloc_steal_mir(body)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run_analysis_to_runtime_passes<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
|
// Made public such that `mir_drops_elaborated_and_const_checked` can be overridden
|
||||||
|
// by custom rustc drivers, running all the steps by themselves.
|
||||||
|
pub fn run_analysis_to_runtime_passes<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
|
||||||
assert!(body.phase == MirPhase::Analysis(AnalysisPhase::Initial));
|
assert!(body.phase == MirPhase::Analysis(AnalysisPhase::Initial));
|
||||||
let did = body.source.def_id();
|
let did = body.source.def_id();
|
||||||
|
|
||||||
|
|
|
@ -89,7 +89,9 @@ session_sanitizer_cfi_generalize_pointers_requires_cfi = `-Zsanitizer-cfi-genera
|
||||||
|
|
||||||
session_sanitizer_cfi_normalize_integers_requires_cfi = `-Zsanitizer-cfi-normalize-integers` requires `-Zsanitizer=cfi` or `-Zsanitizer=kcfi`
|
session_sanitizer_cfi_normalize_integers_requires_cfi = `-Zsanitizer-cfi-normalize-integers` requires `-Zsanitizer=cfi` or `-Zsanitizer=kcfi`
|
||||||
|
|
||||||
session_sanitizer_cfi_requires_lto = `-Zsanitizer=cfi` requires `-Clto`, `-Clto=thin`, or `-Clinker-plugin-lto`
|
session_sanitizer_cfi_requires_lto = `-Zsanitizer=cfi` requires `-Clto` or `-Clinker-plugin-lto`
|
||||||
|
|
||||||
|
session_sanitizer_cfi_requires_single_codegen_unit = `-Zsanitizer=cfi` with `-Clto` requires `-Ccodegen-units=1`
|
||||||
|
|
||||||
session_sanitizer_not_supported = {$us} sanitizer is not supported for this target
|
session_sanitizer_not_supported = {$us} sanitizer is not supported for this target
|
||||||
|
|
||||||
|
|
|
@ -114,6 +114,10 @@ pub struct CannotEnableCrtStaticLinux;
|
||||||
#[diag(session_sanitizer_cfi_requires_lto)]
|
#[diag(session_sanitizer_cfi_requires_lto)]
|
||||||
pub struct SanitizerCfiRequiresLto;
|
pub struct SanitizerCfiRequiresLto;
|
||||||
|
|
||||||
|
#[derive(Diagnostic)]
|
||||||
|
#[diag(session_sanitizer_cfi_requires_single_codegen_unit)]
|
||||||
|
pub struct SanitizerCfiRequiresSingleCodegenUnit;
|
||||||
|
|
||||||
#[derive(Diagnostic)]
|
#[derive(Diagnostic)]
|
||||||
#[diag(session_sanitizer_cfi_canonical_jump_tables_requires_cfi)]
|
#[diag(session_sanitizer_cfi_canonical_jump_tables_requires_cfi)]
|
||||||
pub struct SanitizerCfiCanonicalJumpTablesRequiresCfi;
|
pub struct SanitizerCfiCanonicalJumpTablesRequiresCfi;
|
||||||
|
|
|
@ -1619,13 +1619,19 @@ fn validate_commandline_args_with_session_available(sess: &Session) {
|
||||||
|
|
||||||
// LLVM CFI requires LTO.
|
// LLVM CFI requires LTO.
|
||||||
if sess.is_sanitizer_cfi_enabled()
|
if sess.is_sanitizer_cfi_enabled()
|
||||||
&& !(sess.lto() == config::Lto::Fat
|
&& !(sess.lto() == config::Lto::Fat || sess.opts.cg.linker_plugin_lto.enabled())
|
||||||
|| sess.lto() == config::Lto::Thin
|
|
||||||
|| sess.opts.cg.linker_plugin_lto.enabled())
|
|
||||||
{
|
{
|
||||||
sess.emit_err(errors::SanitizerCfiRequiresLto);
|
sess.emit_err(errors::SanitizerCfiRequiresLto);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// LLVM CFI using rustc LTO requires a single codegen unit.
|
||||||
|
if sess.is_sanitizer_cfi_enabled()
|
||||||
|
&& sess.lto() == config::Lto::Fat
|
||||||
|
&& !(sess.codegen_units().as_usize() == 1)
|
||||||
|
{
|
||||||
|
sess.emit_err(errors::SanitizerCfiRequiresSingleCodegenUnit);
|
||||||
|
}
|
||||||
|
|
||||||
// LLVM CFI is incompatible with LLVM KCFI.
|
// LLVM CFI is incompatible with LLVM KCFI.
|
||||||
if sess.is_sanitizer_cfi_enabled() && sess.is_sanitizer_kcfi_enabled() {
|
if sess.is_sanitizer_cfi_enabled() && sess.is_sanitizer_kcfi_enabled() {
|
||||||
sess.emit_err(errors::CannotMixAndMatchSanitizers {
|
sess.emit_err(errors::CannotMixAndMatchSanitizers {
|
||||||
|
|
16
compiler/rustc_target/src/spec/aarch64_unknown_teeos.rs
Normal file
16
compiler/rustc_target/src/spec/aarch64_unknown_teeos.rs
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
use crate::spec::Target;
|
||||||
|
|
||||||
|
pub fn target() -> Target {
|
||||||
|
let mut base = super::teeos_base::opts();
|
||||||
|
base.features = "+strict-align,+neon,+fp-armv8".into();
|
||||||
|
base.max_atomic_width = Some(128);
|
||||||
|
base.linker = Some("aarch64-linux-gnu-ld".into());
|
||||||
|
|
||||||
|
Target {
|
||||||
|
llvm_target: "aarch64-unknown-none".into(),
|
||||||
|
pointer_width: 64,
|
||||||
|
data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".into(),
|
||||||
|
arch: "aarch64".into(),
|
||||||
|
options: base,
|
||||||
|
}
|
||||||
|
}
|
|
@ -83,6 +83,7 @@ mod openbsd_base;
|
||||||
mod redox_base;
|
mod redox_base;
|
||||||
mod solaris_base;
|
mod solaris_base;
|
||||||
mod solid_base;
|
mod solid_base;
|
||||||
|
mod teeos_base;
|
||||||
mod thumb_base;
|
mod thumb_base;
|
||||||
mod uefi_msvc_base;
|
mod uefi_msvc_base;
|
||||||
mod unikraft_linux_musl_base;
|
mod unikraft_linux_musl_base;
|
||||||
|
@ -1494,6 +1495,8 @@ supported_targets! {
|
||||||
|
|
||||||
("x86_64-unknown-none", x86_64_unknown_none),
|
("x86_64-unknown-none", x86_64_unknown_none),
|
||||||
|
|
||||||
|
("aarch64-unknown-teeos", aarch64_unknown_teeos),
|
||||||
|
|
||||||
("mips64-openwrt-linux-musl", mips64_openwrt_linux_musl),
|
("mips64-openwrt-linux-musl", mips64_openwrt_linux_musl),
|
||||||
|
|
||||||
("aarch64-unknown-nto-qnx710", aarch64_unknown_nto_qnx_710),
|
("aarch64-unknown-nto-qnx710", aarch64_unknown_nto_qnx_710),
|
||||||
|
|
29
compiler/rustc_target/src/spec/teeos_base.rs
Normal file
29
compiler/rustc_target/src/spec/teeos_base.rs
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
use super::{Cc, LinkerFlavor, Lld, PanicStrategy};
|
||||||
|
use crate::spec::{RelroLevel, TargetOptions};
|
||||||
|
|
||||||
|
pub fn opts() -> TargetOptions {
|
||||||
|
let lld_args = &["-zmax-page-size=4096", "-znow", "-ztext", "--execute-only"];
|
||||||
|
let cc_args = &["-Wl,-zmax-page-size=4096", "-Wl,-znow", "-Wl,-ztext", "-mexecute-only"];
|
||||||
|
|
||||||
|
let mut pre_link_args = TargetOptions::link_args(LinkerFlavor::Gnu(Cc::No, Lld::No), lld_args);
|
||||||
|
super::add_link_args(&mut pre_link_args, LinkerFlavor::Gnu(Cc::Yes, Lld::No), cc_args);
|
||||||
|
|
||||||
|
TargetOptions {
|
||||||
|
os: "teeos".into(),
|
||||||
|
vendor: "unknown".into(),
|
||||||
|
dynamic_linking: true,
|
||||||
|
linker_flavor: LinkerFlavor::Gnu(Cc::Yes, Lld::No),
|
||||||
|
// rpath hardcodes -Wl, so it can't be used together with ld.lld.
|
||||||
|
// C TAs also don't support rpath, so this is fine.
|
||||||
|
has_rpath: false,
|
||||||
|
// Note: Setting has_thread_local to true causes an error when
|
||||||
|
// loading / dyn-linking the TA
|
||||||
|
has_thread_local: false,
|
||||||
|
position_independent_executables: true,
|
||||||
|
relro_level: RelroLevel::Full,
|
||||||
|
crt_static_respected: true,
|
||||||
|
pre_link_args,
|
||||||
|
panic_strategy: PanicStrategy::Abort,
|
||||||
|
..Default::default()
|
||||||
|
}
|
||||||
|
}
|
|
@ -1528,7 +1528,7 @@ impl From<fs::File> for Stdio {
|
||||||
// vs `_exit`. Naming of Unix system calls is not standardised across Unices, so terminology is a
|
// vs `_exit`. Naming of Unix system calls is not standardised across Unices, so terminology is a
|
||||||
// matter of convention and tradition. For clarity we usually speak of `exit`, even when we might
|
// matter of convention and tradition. For clarity we usually speak of `exit`, even when we might
|
||||||
// mean an underlying system call such as `_exit`.
|
// mean an underlying system call such as `_exit`.
|
||||||
#[derive(PartialEq, Eq, Clone, Copy, Debug)]
|
#[derive(PartialEq, Eq, Clone, Copy, Debug, Default)]
|
||||||
#[stable(feature = "process", since = "1.0.0")]
|
#[stable(feature = "process", since = "1.0.0")]
|
||||||
pub struct ExitStatus(imp::ExitStatus);
|
pub struct ExitStatus(imp::ExitStatus);
|
||||||
|
|
||||||
|
|
|
@ -235,7 +235,7 @@ impl Process {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(PartialEq, Eq, Clone, Copy, Debug)]
|
#[derive(PartialEq, Eq, Clone, Copy, Debug, Default)]
|
||||||
pub struct ExitStatus(i64);
|
pub struct ExitStatus(i64);
|
||||||
|
|
||||||
impl ExitStatus {
|
impl ExitStatus {
|
||||||
|
|
|
@ -800,7 +800,7 @@ impl Process {
|
||||||
//
|
//
|
||||||
// This is not actually an "exit status" in Unix terminology. Rather, it is a "wait status".
|
// This is not actually an "exit status" in Unix terminology. Rather, it is a "wait status".
|
||||||
// See the discussion in comments and doc comments for `std::process::ExitStatus`.
|
// See the discussion in comments and doc comments for `std::process::ExitStatus`.
|
||||||
#[derive(PartialEq, Eq, Clone, Copy)]
|
#[derive(PartialEq, Eq, Clone, Copy, Default)]
|
||||||
pub struct ExitStatus(c_int);
|
pub struct ExitStatus(c_int);
|
||||||
|
|
||||||
impl fmt::Debug for ExitStatus {
|
impl fmt::Debug for ExitStatus {
|
||||||
|
|
|
@ -55,7 +55,7 @@ impl Process {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(PartialEq, Eq, Clone, Copy, Debug)]
|
#[derive(PartialEq, Eq, Clone, Copy, Debug, Default)]
|
||||||
pub struct ExitStatus(c_int);
|
pub struct ExitStatus(c_int);
|
||||||
|
|
||||||
impl ExitStatus {
|
impl ExitStatus {
|
||||||
|
|
|
@ -179,7 +179,7 @@ impl Process {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Unix exit statuses
|
/// Unix exit statuses
|
||||||
#[derive(PartialEq, Eq, Clone, Copy, Debug)]
|
#[derive(PartialEq, Eq, Clone, Copy, Debug, Default)]
|
||||||
pub struct ExitStatus(c_int);
|
pub struct ExitStatus(c_int);
|
||||||
|
|
||||||
impl ExitStatus {
|
impl ExitStatus {
|
||||||
|
|
|
@ -99,58 +99,59 @@ impl fmt::Debug for Command {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct ExitStatus(!);
|
#[derive(PartialEq, Eq, Clone, Copy, Debug, Default)]
|
||||||
|
#[non_exhaustive]
|
||||||
|
pub struct ExitStatus();
|
||||||
|
|
||||||
impl ExitStatus {
|
impl ExitStatus {
|
||||||
pub fn exit_ok(&self) -> Result<(), ExitStatusError> {
|
pub fn exit_ok(&self) -> Result<(), ExitStatusError> {
|
||||||
self.0
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn code(&self) -> Option<i32> {
|
pub fn code(&self) -> Option<i32> {
|
||||||
self.0
|
Some(0)
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Clone for ExitStatus {
|
|
||||||
fn clone(&self) -> ExitStatus {
|
|
||||||
self.0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Copy for ExitStatus {}
|
|
||||||
|
|
||||||
impl PartialEq for ExitStatus {
|
|
||||||
fn eq(&self, _other: &ExitStatus) -> bool {
|
|
||||||
self.0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Eq for ExitStatus {}
|
|
||||||
|
|
||||||
impl fmt::Debug for ExitStatus {
|
|
||||||
fn fmt(&self, _f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
|
||||||
self.0
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl fmt::Display for ExitStatus {
|
impl fmt::Display for ExitStatus {
|
||||||
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
|
write!(f, "<dummy exit status>")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct ExitStatusError(!);
|
||||||
|
|
||||||
|
impl Clone for ExitStatusError {
|
||||||
|
fn clone(&self) -> ExitStatusError {
|
||||||
|
self.0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Copy for ExitStatusError {}
|
||||||
|
|
||||||
|
impl PartialEq for ExitStatusError {
|
||||||
|
fn eq(&self, _other: &ExitStatusError) -> bool {
|
||||||
|
self.0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Eq for ExitStatusError {}
|
||||||
|
|
||||||
|
impl fmt::Debug for ExitStatusError {
|
||||||
fn fmt(&self, _f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
fn fmt(&self, _f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
self.0
|
self.0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(PartialEq, Eq, Clone, Copy, Debug)]
|
|
||||||
pub struct ExitStatusError(ExitStatus);
|
|
||||||
|
|
||||||
impl Into<ExitStatus> for ExitStatusError {
|
impl Into<ExitStatus> for ExitStatusError {
|
||||||
fn into(self) -> ExitStatus {
|
fn into(self) -> ExitStatus {
|
||||||
self.0.0
|
self.0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ExitStatusError {
|
impl ExitStatusError {
|
||||||
pub fn code(self) -> Option<NonZeroI32> {
|
pub fn code(self) -> Option<NonZeroI32> {
|
||||||
self.0.0
|
self.0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -652,7 +652,7 @@ impl Process {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(PartialEq, Eq, Clone, Copy, Debug)]
|
#[derive(PartialEq, Eq, Clone, Copy, Debug, Default)]
|
||||||
pub struct ExitStatus(c::DWORD);
|
pub struct ExitStatus(c::DWORD);
|
||||||
|
|
||||||
impl ExitStatus {
|
impl ExitStatus {
|
||||||
|
|
|
@ -31,6 +31,7 @@ use crate::util::get_clang_cl_resource_dir;
|
||||||
use crate::util::{exe, is_debug_info, is_dylib, output, symlink_dir, t, up_to_date};
|
use crate::util::{exe, is_debug_info, is_dylib, output, symlink_dir, t, up_to_date};
|
||||||
use crate::LLVM_TOOLS;
|
use crate::LLVM_TOOLS;
|
||||||
use crate::{CLang, Compiler, DependencyType, GitRepo, Mode};
|
use crate::{CLang, Compiler, DependencyType, GitRepo, Mode};
|
||||||
|
use filetime::FileTime;
|
||||||
|
|
||||||
#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||||
pub struct Std {
|
pub struct Std {
|
||||||
|
@ -904,19 +905,12 @@ impl Step for Rustc {
|
||||||
// our LLVM wrapper. Unless we're explicitly requesting `librustc_driver` to be built with
|
// our LLVM wrapper. Unless we're explicitly requesting `librustc_driver` to be built with
|
||||||
// debuginfo (via the debuginfo level of the executables using it): strip this debuginfo
|
// debuginfo (via the debuginfo level of the executables using it): strip this debuginfo
|
||||||
// away after the fact.
|
// away after the fact.
|
||||||
// FIXME: to make things simpler for now, limit this to the host and target where we know
|
|
||||||
// `strip -g` is both available and will fix the issue, i.e. on a x64 linux host that is not
|
|
||||||
// cross-compiling. Expand this to other appropriate targets in the future.
|
|
||||||
if builder.config.rust_debuginfo_level_rustc == DebuginfoLevel::None
|
if builder.config.rust_debuginfo_level_rustc == DebuginfoLevel::None
|
||||||
&& builder.config.rust_debuginfo_level_tools == DebuginfoLevel::None
|
&& builder.config.rust_debuginfo_level_tools == DebuginfoLevel::None
|
||||||
&& target == "x86_64-unknown-linux-gnu"
|
|
||||||
&& target == builder.config.build
|
|
||||||
{
|
{
|
||||||
let target_root_dir = stamp.parent().unwrap();
|
let target_root_dir = stamp.parent().unwrap();
|
||||||
let rustc_driver = target_root_dir.join("librustc_driver.so");
|
let rustc_driver = target_root_dir.join("librustc_driver.so");
|
||||||
if rustc_driver.exists() {
|
strip_debug(builder, target, &rustc_driver);
|
||||||
output(Command::new("strip").arg("--strip-debug").arg(rustc_driver));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
builder.ensure(RustcLink::from_rustc(
|
builder.ensure(RustcLink::from_rustc(
|
||||||
|
@ -1974,3 +1968,30 @@ pub enum CargoMessage<'a> {
|
||||||
success: bool,
|
success: bool,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn strip_debug(builder: &Builder<'_>, target: TargetSelection, path: &Path) {
|
||||||
|
// FIXME: to make things simpler for now, limit this to the host and target where we know
|
||||||
|
// `strip -g` is both available and will fix the issue, i.e. on a x64 linux host that is not
|
||||||
|
// cross-compiling. Expand this to other appropriate targets in the future.
|
||||||
|
if target != "x86_64-unknown-linux-gnu" || target != builder.config.build || !path.exists() {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
let previous_mtime = FileTime::from_last_modification_time(&path.metadata().unwrap());
|
||||||
|
// Note: `output` will propagate any errors here.
|
||||||
|
output(Command::new("strip").arg("--strip-debug").arg(path));
|
||||||
|
|
||||||
|
// After running `strip`, we have to set the file modification time to what it was before,
|
||||||
|
// otherwise we risk Cargo invalidating its fingerprint and rebuilding the world next time
|
||||||
|
// bootstrap is invoked.
|
||||||
|
//
|
||||||
|
// An example of this is if we run this on librustc_driver.so. In the first invocation:
|
||||||
|
// - Cargo will build librustc_driver.so (mtime of 1)
|
||||||
|
// - Cargo will build rustc-main (mtime of 2)
|
||||||
|
// - Bootstrap will strip librustc_driver.so (changing the mtime to 3).
|
||||||
|
//
|
||||||
|
// In the second invocation of bootstrap, Cargo will see that the mtime of librustc_driver.so
|
||||||
|
// is greater than the mtime of rustc-main, and will rebuild rustc-main. That will then cause
|
||||||
|
// everything else (standard library, future stages...) to be rebuilt.
|
||||||
|
t!(filetime::set_file_mtime(path, previous_mtime));
|
||||||
|
}
|
||||||
|
|
|
@ -133,7 +133,7 @@ const EXTRA_CHECK_CFGS: &[(Option<Mode>, &'static str, Option<&[&'static str]>)]
|
||||||
// #[cfg(bootstrap)]
|
// #[cfg(bootstrap)]
|
||||||
(Some(Mode::Std), "target_vendor", Some(&["unikraft"])),
|
(Some(Mode::Std), "target_vendor", Some(&["unikraft"])),
|
||||||
(Some(Mode::Std), "target_env", Some(&["libnx"])),
|
(Some(Mode::Std), "target_env", Some(&["libnx"])),
|
||||||
// (Some(Mode::Std), "target_os", Some(&[])),
|
(Some(Mode::Std), "target_os", Some(&["teeos"])),
|
||||||
// #[cfg(bootstrap)] mips32r6, mips64r6
|
// #[cfg(bootstrap)] mips32r6, mips64r6
|
||||||
(
|
(
|
||||||
Some(Mode::Std),
|
Some(Mode::Std),
|
||||||
|
|
|
@ -512,27 +512,21 @@ impl Step for Llvm {
|
||||||
// When building LLVM as a shared library on linux, it can contain unexpected debuginfo:
|
// When building LLVM as a shared library on linux, it can contain unexpected debuginfo:
|
||||||
// some can come from the C++ standard library. Unless we're explicitly requesting LLVM to
|
// some can come from the C++ standard library. Unless we're explicitly requesting LLVM to
|
||||||
// be built with debuginfo, strip it away after the fact, to make dist artifacts smaller.
|
// be built with debuginfo, strip it away after the fact, to make dist artifacts smaller.
|
||||||
// FIXME: to make things simpler for now, limit this to the host and target where we know
|
|
||||||
// `strip -g` is both available and will fix the issue, i.e. on a x64 linux host that is not
|
|
||||||
// cross-compiling. Expand this to other appropriate targets in the future.
|
|
||||||
if builder.llvm_link_shared()
|
if builder.llvm_link_shared()
|
||||||
&& builder.config.llvm_optimize
|
&& builder.config.llvm_optimize
|
||||||
&& !builder.config.llvm_release_debuginfo
|
&& !builder.config.llvm_release_debuginfo
|
||||||
&& target == "x86_64-unknown-linux-gnu"
|
|
||||||
&& target == builder.config.build
|
|
||||||
{
|
{
|
||||||
// Find the name of the LLVM shared library that we just built.
|
// Find the name of the LLVM shared library that we just built.
|
||||||
let lib_name = find_llvm_lib_name("so");
|
let lib_name = find_llvm_lib_name("so");
|
||||||
|
|
||||||
// If the shared library exists in LLVM's `/build/lib/` or `/lib/` folders, strip its
|
// If the shared library exists in LLVM's `/build/lib/` or `/lib/` folders, strip its
|
||||||
// debuginfo. Note: `output` will propagate any errors here.
|
// debuginfo.
|
||||||
let strip_if_possible = |path: PathBuf| {
|
crate::compile::strip_debug(builder, target, &out_dir.join("lib").join(&lib_name));
|
||||||
if path.exists() {
|
crate::compile::strip_debug(
|
||||||
output(Command::new("strip").arg("--strip-debug").arg(path));
|
builder,
|
||||||
}
|
target,
|
||||||
};
|
&out_dir.join("build").join("lib").join(&lib_name),
|
||||||
strip_if_possible(out_dir.join("lib").join(&lib_name));
|
);
|
||||||
strip_if_possible(out_dir.join("build").join("lib").join(&lib_name));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
t!(stamp.write());
|
t!(stamp.write());
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
- [armv7-unknown-linux-uclibceabihf](platform-support/armv7-unknown-linux-uclibceabihf.md)
|
- [armv7-unknown-linux-uclibceabihf](platform-support/armv7-unknown-linux-uclibceabihf.md)
|
||||||
- [\*-android and \*-androideabi](platform-support/android.md)
|
- [\*-android and \*-androideabi](platform-support/android.md)
|
||||||
- [\*-linux-ohos](platform-support/openharmony.md)
|
- [\*-linux-ohos](platform-support/openharmony.md)
|
||||||
|
- [aarch64-unknown-teeos](platform-support/aarch64-unknown-teeos.md)
|
||||||
- [\*-esp-espidf](platform-support/esp-idf.md)
|
- [\*-esp-espidf](platform-support/esp-idf.md)
|
||||||
- [\*-unknown-fuchsia](platform-support/fuchsia.md)
|
- [\*-unknown-fuchsia](platform-support/fuchsia.md)
|
||||||
- [\*-kmc-solid_\*](platform-support/kmc-solid.md)
|
- [\*-kmc-solid_\*](platform-support/kmc-solid.md)
|
||||||
|
|
|
@ -221,6 +221,7 @@ target | std | host | notes
|
||||||
[`aarch64-nintendo-switch-freestanding`](platform-support/aarch64-nintendo-switch-freestanding.md) | * | | ARM64 Nintendo Switch, Horizon
|
[`aarch64-nintendo-switch-freestanding`](platform-support/aarch64-nintendo-switch-freestanding.md) | * | | ARM64 Nintendo Switch, Horizon
|
||||||
[`aarch64-pc-windows-gnullvm`](platform-support/pc-windows-gnullvm.md) | ✓ | ✓ |
|
[`aarch64-pc-windows-gnullvm`](platform-support/pc-windows-gnullvm.md) | ✓ | ✓ |
|
||||||
[`aarch64-unknown-linux-ohos`](platform-support/openharmony.md) | ✓ | | ARM64 OpenHarmony |
|
[`aarch64-unknown-linux-ohos`](platform-support/openharmony.md) | ✓ | | ARM64 OpenHarmony |
|
||||||
|
[`aarch64-unknown-teeos`](platform-support/aarch64-unknown-teeos.md) | ? | | ARM64 TEEOS |
|
||||||
[`aarch64-unknown-nto-qnx710`](platform-support/nto-qnx.md) | ✓ | | ARM64 QNX Neutrino 7.1 RTOS |
|
[`aarch64-unknown-nto-qnx710`](platform-support/nto-qnx.md) | ✓ | | ARM64 QNX Neutrino 7.1 RTOS |
|
||||||
`aarch64-unknown-freebsd` | ✓ | ✓ | ARM64 FreeBSD
|
`aarch64-unknown-freebsd` | ✓ | ✓ | ARM64 FreeBSD
|
||||||
[`aarch64-unknown-hermit`](platform-support/hermit.md) | ✓ | | ARM64 Hermit
|
[`aarch64-unknown-hermit`](platform-support/hermit.md) | ✓ | | ARM64 Hermit
|
||||||
|
|
100
src/doc/rustc/src/platform-support/aarch64-unknown-teeos.md
Normal file
100
src/doc/rustc/src/platform-support/aarch64-unknown-teeos.md
Normal file
|
@ -0,0 +1,100 @@
|
||||||
|
# `aarch64-unknown-teeos`
|
||||||
|
|
||||||
|
**Tier: 3**
|
||||||
|
|
||||||
|
Target for the TEEOS operating system.
|
||||||
|
|
||||||
|
TEEOS is a mini os run in TrustZone, for trusted/security apps. The kernel of TEEOS is HongMeng/ChCore micro kernel. The libc for TEEOS is a part of musl.
|
||||||
|
It's very small that there is no RwLock, no network, no stdin, and no file system for apps in TEEOS.
|
||||||
|
|
||||||
|
Some abbreviation:
|
||||||
|
| Abbreviation | The full text | Description |
|
||||||
|
| ---- | ---- | ---- |
|
||||||
|
| TEE | Trusted Execution Environment | ARM TrustZone devide the system into two worlds/modes -- the secure world/mode and the normal world/mode. TEE is in the secure world/mode. |
|
||||||
|
| REE | Rich Execution Environment | The normal world. for example, Linux for Android phone is in REE side. |
|
||||||
|
| TA | Trusted Application | The app run in TEE side system. |
|
||||||
|
| CA | Client Application | The progress run in REE side system. |
|
||||||
|
|
||||||
|
TEEOS is open source in progress. [MORE about](https://gitee.com/opentrustee-group)
|
||||||
|
|
||||||
|
## Target maintainers
|
||||||
|
|
||||||
|
- Petrochenkov Vadim
|
||||||
|
- Sword-Destiny
|
||||||
|
|
||||||
|
## Setup
|
||||||
|
We use OpenHarmony SDK for TEEOS.
|
||||||
|
|
||||||
|
The OpenHarmony SDK doesn't currently support Rust compilation directly, so
|
||||||
|
some setup is required.
|
||||||
|
|
||||||
|
First, you must obtain the OpenHarmony SDK from [this page](https://gitee.com/openharmony/docs/tree/master/en/release-notes).
|
||||||
|
Select the version of OpenHarmony you are developing for and download the "Public SDK package for the standard system".
|
||||||
|
|
||||||
|
Create the following shell scripts that wrap Clang from the OpenHarmony SDK:
|
||||||
|
|
||||||
|
`aarch64-unknown-teeos-clang.sh`
|
||||||
|
|
||||||
|
```sh
|
||||||
|
#!/bin/sh
|
||||||
|
exec /path/to/ohos-sdk/linux/native/llvm/bin/clang \
|
||||||
|
--target aarch64-linux-gnu \
|
||||||
|
"$@"
|
||||||
|
```
|
||||||
|
|
||||||
|
`aarch64-unknown-teeos-clang++.sh`
|
||||||
|
|
||||||
|
```sh
|
||||||
|
#!/bin/sh
|
||||||
|
exec /path/to/ohos-sdk/linux/native/llvm/bin/clang++ \
|
||||||
|
--target aarch64-linux-gnu \
|
||||||
|
"$@"
|
||||||
|
```
|
||||||
|
|
||||||
|
## Building the target
|
||||||
|
|
||||||
|
To build a rust toolchain, create a `config.toml` with the following contents:
|
||||||
|
|
||||||
|
```toml
|
||||||
|
profile = "compiler"
|
||||||
|
changelog-seen = 2
|
||||||
|
|
||||||
|
[build]
|
||||||
|
sanitizers = true
|
||||||
|
profiler = true
|
||||||
|
target = ["x86_64-unknown-linux-gnu", "aarch64-unknown-teeos"]
|
||||||
|
submodules = false
|
||||||
|
compiler-docs = false
|
||||||
|
extended = true
|
||||||
|
|
||||||
|
[install]
|
||||||
|
bindir = "bin"
|
||||||
|
libdir = "lib"
|
||||||
|
|
||||||
|
[target.aarch64-unknown-teeos]
|
||||||
|
cc = "/path/to/scripts/aarch64-unknown-teeos-clang.sh"
|
||||||
|
cxx = "/path/to/scripts/aarch64-unknown-teeos-clang.sh"
|
||||||
|
linker = "/path/to/scripts/aarch64-unknown-teeos-clang.sh"
|
||||||
|
ar = "/path/to/ohos-sdk/linux/native/llvm/bin/llvm-ar"
|
||||||
|
ranlib = "/path/to/ohos-sdk/linux/native/llvm/bin/llvm-ranlib"
|
||||||
|
llvm-config = "/path/to/ohos-sdk/linux/native/llvm/bin/llvm-config"
|
||||||
|
```
|
||||||
|
|
||||||
|
## Building Rust programs
|
||||||
|
|
||||||
|
Rust does not yet ship pre-compiled artifacts for this target. To compile for
|
||||||
|
this target, you will either need to build Rust with the target enabled (see
|
||||||
|
"Building the target" above), or build your own copy of `core` by using
|
||||||
|
`build-std` or similar.
|
||||||
|
|
||||||
|
You will need to configure the linker to use in `~/.cargo/config`:
|
||||||
|
```toml
|
||||||
|
[target.aarch64-unknown-teeos]
|
||||||
|
linker = "/path/to/aarch64-unknown-teeos-clang.sh"
|
||||||
|
```
|
||||||
|
|
||||||
|
## Testing
|
||||||
|
|
||||||
|
Running the Rust testsuite is not possible now.
|
||||||
|
|
||||||
|
More information about how to test CA/TA. [See here](https://gitee.com/openharmony-sig/tee_tee_dev_kit/tree/master/docs)
|
|
@ -1645,7 +1645,7 @@ impl<'test> TestCx<'test> {
|
||||||
if self.props.known_bug {
|
if self.props.known_bug {
|
||||||
if !expected_errors.is_empty() {
|
if !expected_errors.is_empty() {
|
||||||
self.fatal_proc_rec(
|
self.fatal_proc_rec(
|
||||||
"`known_bug` tests should not have an expected errors",
|
"`known_bug` tests should not have an expected error",
|
||||||
proc_res,
|
proc_res,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,53 +46,53 @@ call-function: (
|
||||||
"check-colors",
|
"check-colors",
|
||||||
{
|
{
|
||||||
"theme": "ayu",
|
"theme": "ayu",
|
||||||
"mod": "rgb(57, 175, 215)",
|
"mod": "#39afd7",
|
||||||
"macro": "rgb(163, 122, 204)",
|
"macro": "#a37acc",
|
||||||
"struct": "rgb(255, 160, 165)",
|
"struct": "#ffa0a5",
|
||||||
"enum": "rgb(255, 160, 165)",
|
"enum": "#ffa0a5",
|
||||||
"trait": "rgb(57, 175, 215)",
|
"trait": "#39afd7",
|
||||||
"fn": "rgb(253, 214, 135)",
|
"fn": "#fdd687",
|
||||||
"type": "rgb(255, 160, 165)",
|
"type": "#ffa0a5",
|
||||||
"union": "rgb(255, 160, 165)",
|
"union": "#ffa0a5",
|
||||||
"keyword": "rgb(57, 175, 215)",
|
"keyword": "#39afd7",
|
||||||
"sidebar": "rgb(83, 177, 219)",
|
"sidebar": "#53b1db",
|
||||||
"sidebar_current": "rgb(255, 180, 76)",
|
"sidebar_current": "#ffb44c",
|
||||||
"sidebar_current_background": "rgba(0, 0, 0, 0)",
|
"sidebar_current_background": "transparent",
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
call-function: (
|
call-function: (
|
||||||
"check-colors",
|
"check-colors",
|
||||||
{
|
{
|
||||||
"theme": "dark",
|
"theme": "dark",
|
||||||
"mod": "rgb(210, 153, 29)",
|
"mod": "#d2991d",
|
||||||
"macro": "rgb(9, 189, 0)",
|
"macro": "#09bd00",
|
||||||
"struct": "rgb(45, 191, 184)",
|
"struct": "#2dbfb8",
|
||||||
"enum": "rgb(45, 191, 184)",
|
"enum": "#2dbfb8",
|
||||||
"trait": "rgb(183, 140, 242)",
|
"trait": "#b78cf2",
|
||||||
"fn": "rgb(43, 171, 99)",
|
"fn": "#2bab63",
|
||||||
"type": "rgb(45, 191, 184)",
|
"type": "#2dbfb8",
|
||||||
"union": "rgb(45, 191, 184)",
|
"union": "#2dbfb8",
|
||||||
"keyword": "rgb(210, 153, 29)",
|
"keyword": "#d2991d",
|
||||||
"sidebar": "rgb(253, 191, 53)",
|
"sidebar": "#fdbf35",
|
||||||
"sidebar_current": "rgb(253, 191, 53)",
|
"sidebar_current": "#fdbf35",
|
||||||
"sidebar_current_background": "rgb(68, 68, 68)",
|
"sidebar_current_background": "#444",
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
call-function: (
|
call-function: (
|
||||||
"check-colors",
|
"check-colors",
|
||||||
{
|
{
|
||||||
"theme": "light",
|
"theme": "light",
|
||||||
"mod": "rgb(56, 115, 173)",
|
"mod": "#3873ad",
|
||||||
"macro": "rgb(6, 128, 0)",
|
"macro": "#068000",
|
||||||
"struct": "rgb(173, 55, 138)",
|
"struct": "#ad378a",
|
||||||
"enum": "rgb(173, 55, 138)",
|
"enum": "#ad378a",
|
||||||
"trait": "rgb(110, 79, 201)",
|
"trait": "#6e4fc9",
|
||||||
"fn": "rgb(173, 124, 55)",
|
"fn": "#ad7c37",
|
||||||
"type": "rgb(173, 55, 138)",
|
"type": "#ad378a",
|
||||||
"union": "rgb(173, 55, 138)",
|
"union": "#ad378a",
|
||||||
"keyword": "rgb(56, 115, 173)",
|
"keyword": "#3873ad",
|
||||||
"sidebar": "rgb(53, 109, 164)",
|
"sidebar": "#356da4",
|
||||||
"sidebar_current": "rgb(53, 109, 164)",
|
"sidebar_current": "#356da4",
|
||||||
"sidebar_current_background": "rgb(255, 255, 255)",
|
"sidebar_current_background": "#fff",
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
|
@ -6,7 +6,7 @@ LL | #[cfg(target_os = "linuz")]
|
||||||
| |
|
| |
|
||||||
| help: there is a expected value with a similar name: `"linux"`
|
| help: there is a expected value with a similar name: `"linux"`
|
||||||
|
|
|
|
||||||
= note: expected values for `target_os` are: `aix`, `android`, `cuda`, `dragonfly`, `emscripten`, `ericos`, `espidf`, `freebsd`, `fuchsia`, `haiku`, `hermit`, `horizon`, `illumos`, `ios`, `l4re`, `linux`, `macos`, `netbsd`, `none`, `nto`, `openbsd`, `psp`, `redox`, `solaris`, `solid_asp3`, `tvos`, `uefi`, `unknown`, `vita`, `vxworks`, `wasi`, `watchos`, `windows`, `xous`
|
= note: expected values for `target_os` are: `aix`, `android`, `cuda`, `dragonfly`, `emscripten`, `ericos`, `espidf`, `freebsd`, `fuchsia`, `haiku`, `hermit`, `horizon`, `illumos`, `ios`, `l4re`, `linux`, `macos`, `netbsd`, `none`, `nto`, `openbsd`, `psp`, `redox`, `solaris`, `solid_asp3`, `teeos`, `tvos`, `uefi`, `unknown`, `vita`, `vxworks`, `wasi`, `watchos`, `windows`, `xous`
|
||||||
= note: `#[warn(unexpected_cfgs)]` on by default
|
= note: `#[warn(unexpected_cfgs)]` on by default
|
||||||
|
|
||||||
warning: 1 warning emitted
|
warning: 1 warning emitted
|
||||||
|
|
|
@ -6,7 +6,7 @@ LL | #[cfg(target_os = "linuz")]
|
||||||
| |
|
| |
|
||||||
| help: there is a expected value with a similar name: `"linux"`
|
| help: there is a expected value with a similar name: `"linux"`
|
||||||
|
|
|
|
||||||
= note: expected values for `target_os` are: `aix`, `android`, `cuda`, `dragonfly`, `emscripten`, `espidf`, `freebsd`, `fuchsia`, `haiku`, `hermit`, `horizon`, `illumos`, `ios`, `l4re`, `linux`, `macos`, `netbsd`, `none`, `nto`, `openbsd`, `psp`, `redox`, `solaris`, `solid_asp3`, `tvos`, `uefi`, `unknown`, `vita`, `vxworks`, `wasi`, `watchos`, `windows`, `xous`
|
= note: expected values for `target_os` are: `aix`, `android`, `cuda`, `dragonfly`, `emscripten`, `espidf`, `freebsd`, `fuchsia`, `haiku`, `hermit`, `horizon`, `illumos`, `ios`, `l4re`, `linux`, `macos`, `netbsd`, `none`, `nto`, `openbsd`, `psp`, `redox`, `solaris`, `solid_asp3`, `teeos`, `tvos`, `uefi`, `unknown`, `vita`, `vxworks`, `wasi`, `watchos`, `windows`, `xous`
|
||||||
= note: `#[warn(unexpected_cfgs)]` on by default
|
= note: `#[warn(unexpected_cfgs)]` on by default
|
||||||
|
|
||||||
warning: unexpected `cfg` condition value
|
warning: unexpected `cfg` condition value
|
||||||
|
|
|
@ -1,4 +1,9 @@
|
||||||
// check-fail
|
// check-fail
|
||||||
|
// known-bug: #97477
|
||||||
|
// failure-status: 101
|
||||||
|
// normalize-stderr-test "note: .*\n\n" -> ""
|
||||||
|
// normalize-stderr-test "thread 'rustc' panicked.*\n" -> ""
|
||||||
|
// rustc-env:RUST_BACKTRACE=0
|
||||||
|
|
||||||
// This test used to cause an ICE in rustc_mir::interpret::step::eval_rvalue_into_place
|
// This test used to cause an ICE in rustc_mir::interpret::step::eval_rvalue_into_place
|
||||||
|
|
||||||
|
@ -27,6 +32,5 @@ where
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let dst = Inline::<dyn Debug>::new(0); //~ ERROR
|
let dst = Inline::<dyn Debug>::new(0);
|
||||||
//~^ ERROR
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,71 +1,10 @@
|
||||||
error[E0080]: evaluation of `Inline::<dyn Debug>::{constant#0}` failed
|
error: internal compiler error: compiler/rustc_const_eval/src/interpret/step.rs:272:21: SizeOf MIR operator called for unsized type dyn Debug
|
||||||
--> $SRC_DIR/core/src/mem/mod.rs:LL:COL
|
--> $SRC_DIR/core/src/mem/mod.rs:LL:COL
|
||||||
|
|
|
||||||
= note: size_of called on unsized type `dyn Debug`
|
|
||||||
|
|
|
||||||
note: inside `std::mem::size_of::<dyn Debug>`
|
|
||||||
--> $SRC_DIR/core/src/mem/mod.rs:LL:COL
|
|
||||||
note: inside `Inline::<dyn Debug>::{constant#0}`
|
|
||||||
--> $DIR/issue-80742.rs:22:10
|
|
||||||
|
|
|
||||||
LL | [u8; size_of::<T>() + 1]: ,
|
|
||||||
| ^^^^^^^^^^^^^^
|
|
||||||
|
|
||||||
error[E0599]: the function or associated item `new` exists for struct `Inline<dyn Debug>`, but its trait bounds were not satisfied
|
Box<dyn Any>
|
||||||
--> $DIR/issue-80742.rs:30:36
|
query stack during panic:
|
||||||
|
|
#0 [eval_to_allocation_raw] const-evaluating + checking `<impl at $DIR/issue-80742.rs:25:1: 25:18>::{constant#0}`
|
||||||
LL | struct Inline<T>
|
#1 [eval_to_valtree] evaluating type-level constant
|
||||||
| ---------------- function or associated item `new` not found for this struct
|
end of query stack
|
||||||
...
|
error: aborting due to previous error
|
||||||
LL | let dst = Inline::<dyn Debug>::new(0);
|
|
||||||
| ^^^ function or associated item cannot be called on `Inline<dyn Debug>` due to unsatisfied trait bounds
|
|
||||||
--> $SRC_DIR/core/src/fmt/mod.rs:LL:COL
|
|
||||||
|
|
|
||||||
= note: doesn't satisfy `dyn Debug: Sized`
|
|
||||||
|
|
|
||||||
note: trait bound `dyn Debug: Sized` was not satisfied
|
|
||||||
--> $DIR/issue-80742.rs:20:6
|
|
||||||
|
|
|
||||||
LL | impl<T> Inline<T>
|
|
||||||
| ^ ---------
|
|
||||||
| |
|
|
||||||
| unsatisfied trait bound introduced here
|
|
||||||
help: consider relaxing the type parameter's implicit `Sized` bound
|
|
||||||
|
|
|
||||||
LL | impl<T: ?Sized> Inline<T>
|
|
||||||
| ++++++++
|
|
||||||
|
|
||||||
error[E0080]: evaluation of `Inline::<dyn Debug>::{constant#0}` failed
|
|
||||||
--> $SRC_DIR/core/src/mem/mod.rs:LL:COL
|
|
||||||
|
|
|
||||||
= note: size_of called on unsized type `dyn Debug`
|
|
||||||
|
|
|
||||||
note: inside `std::mem::size_of::<dyn Debug>`
|
|
||||||
--> $SRC_DIR/core/src/mem/mod.rs:LL:COL
|
|
||||||
note: inside `Inline::<dyn Debug>::{constant#0}`
|
|
||||||
--> $DIR/issue-80742.rs:14:10
|
|
||||||
|
|
|
||||||
LL | [u8; size_of::<T>() + 1]: ,
|
|
||||||
| ^^^^^^^^^^^^^^
|
|
||||||
|
|
||||||
error[E0277]: the size for values of type `dyn Debug` cannot be known at compilation time
|
|
||||||
--> $DIR/issue-80742.rs:30:15
|
|
||||||
|
|
|
||||||
LL | let dst = Inline::<dyn Debug>::new(0);
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
|
||||||
|
|
|
||||||
= help: the trait `Sized` is not implemented for `dyn Debug`
|
|
||||||
note: required by a bound in `Inline`
|
|
||||||
--> $DIR/issue-80742.rs:12:15
|
|
||||||
|
|
|
||||||
LL | struct Inline<T>
|
|
||||||
| ^ required by this bound in `Inline`
|
|
||||||
help: consider relaxing the implicit `Sized` restriction
|
|
||||||
|
|
|
||||||
LL | struct Inline<T: ?Sized>
|
|
||||||
| ++++++++
|
|
||||||
|
|
||||||
error: aborting due to 4 previous errors
|
|
||||||
|
|
||||||
Some errors have detailed explanations: E0080, E0277, E0599.
|
|
||||||
For more information about an error, try `rustc --explain E0080`.
|
|
||||||
|
|
|
@ -15,8 +15,7 @@ struct Foo<T: StreamingIterator + 'static> {
|
||||||
|
|
||||||
// Users can bound parameters by the type constructed by that trait's associated type constructor
|
// Users can bound parameters by the type constructed by that trait's associated type constructor
|
||||||
// of a trait using HRTB. Both type equality bounds and trait bounds of this kind are valid:
|
// of a trait using HRTB. Both type equality bounds and trait bounds of this kind are valid:
|
||||||
//FIXME(#44265): This next line should parse and be valid
|
fn _bar<T: for<'a> StreamingIterator<Item<'a>=&'a [i32]>>(_iter: T) { /* ... */ }
|
||||||
//fn foo<T: for<'a> StreamingIterator<Item<'a>=&'a [i32]>>(_iter: T) { /* ... */ }
|
|
||||||
fn _foo<T>(_iter: T) where T: StreamingIterator, for<'a> T::Item<'a>: Display { /* ... */ }
|
fn _foo<T>(_iter: T) where T: StreamingIterator, for<'a> T::Item<'a>: Display { /* ... */ }
|
||||||
|
|
||||||
// Full example of enumerate iterator
|
// Full example of enumerate iterator
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// run-pass
|
// build-pass
|
||||||
// needs-sanitizer-cfi
|
// needs-sanitizer-cfi
|
||||||
// compile-flags: -Clto -Ctarget-feature=-crt-static -Zsanitizer=cfi
|
// compile-flags: -Ccodegen-units=1 -Clto -Ctarget-feature=-crt-static -Zsanitizer=cfi
|
||||||
// no-prefer-dynamic
|
// no-prefer-dynamic
|
||||||
// only-x86_64-unknown-linux-gnu
|
// only-x86_64-unknown-linux-gnu
|
||||||
|
|
||||||
|
|
|
@ -2,10 +2,10 @@
|
||||||
// encode_ty and caused the compiler to ICE.
|
// encode_ty and caused the compiler to ICE.
|
||||||
//
|
//
|
||||||
// needs-sanitizer-cfi
|
// needs-sanitizer-cfi
|
||||||
// compile-flags: -Clto -Ctarget-feature=-crt-static -Zsanitizer=cfi --edition=2021
|
// compile-flags: -Ccodegen-units=1 -Clto -Ctarget-feature=-crt-static -Zsanitizer=cfi --edition=2021
|
||||||
// no-prefer-dynamic
|
// no-prefer-dynamic
|
||||||
// only-x86_64-unknown-linux-gnu
|
// only-x86_64-unknown-linux-gnu
|
||||||
// run-pass
|
// build-pass
|
||||||
|
|
||||||
use std::future::Future;
|
use std::future::Future;
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Verifies that `-Zsanitizer=cfi` requires `-Clto`, `-Clto=thin`, or `-Clinker-plugin-lto`.
|
// Verifies that `-Zsanitizer=cfi` requires `-Clto` or `-Clinker-plugin-lto`.
|
||||||
//
|
//
|
||||||
// needs-sanitizer-cfi
|
// needs-sanitizer-cfi
|
||||||
// compile-flags: -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zsanitizer=cfi
|
// compile-flags: -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zsanitizer=cfi
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
error: `-Zsanitizer=cfi` requires `-Clto`, `-Clto=thin`, or `-Clinker-plugin-lto`
|
error: `-Zsanitizer=cfi` requires `-Clto` or `-Clinker-plugin-lto`
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
// Verifies that `-Zsanitizer=cfi` with `-Clto` or `-Clto=thin` requires `-Ccodegen-units=1`.
|
||||||
|
//
|
||||||
|
// needs-sanitizer-cfi
|
||||||
|
// compile-flags: -Ccodegen-units=2 -Clto -Ctarget-feature=-crt-static -Zsanitizer=cfi
|
||||||
|
|
||||||
|
#![feature(no_core)]
|
||||||
|
#![no_core]
|
||||||
|
#![no_main]
|
|
@ -0,0 +1,4 @@
|
||||||
|
error: `-Zsanitizer=cfi` with `-Clto` requires `-Ccodegen-units=1`
|
||||||
|
|
||||||
|
error: aborting due to previous error
|
||||||
|
|
46
tests/ui/traits/new-solver/cycles/inductive-not-on-stack.rs
Normal file
46
tests/ui/traits/new-solver/cycles/inductive-not-on-stack.rs
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
// compile-flags: -Ztrait-solver=next
|
||||||
|
#![feature(rustc_attrs, trivial_bounds)]
|
||||||
|
|
||||||
|
// We have to be careful here:
|
||||||
|
//
|
||||||
|
// We either have the provisional result of `A -> B -> A` on the
|
||||||
|
// stack, which is a fully coinductive cycle. Accessing the
|
||||||
|
// provisional result for `B` as part of the `A -> C -> B -> A` cycle
|
||||||
|
// has to make sure we don't just use the result of `A -> B -> A` as the
|
||||||
|
// new cycle is inductive.
|
||||||
|
//
|
||||||
|
// Alternatively, if we have `A -> C -> A` first, then `A -> B -> A` has
|
||||||
|
// a purely inductive stack, so something could also go wrong here.
|
||||||
|
|
||||||
|
#[rustc_coinductive]
|
||||||
|
trait A {}
|
||||||
|
#[rustc_coinductive]
|
||||||
|
trait B {}
|
||||||
|
trait C {}
|
||||||
|
|
||||||
|
impl<T: B + C> A for T {}
|
||||||
|
impl<T: A> B for T {}
|
||||||
|
impl<T: B> C for T {}
|
||||||
|
|
||||||
|
fn impls_a<T: A>() {}
|
||||||
|
|
||||||
|
// The same test with reordered where clauses to make sure we're actually testing anything.
|
||||||
|
#[rustc_coinductive]
|
||||||
|
trait AR {}
|
||||||
|
#[rustc_coinductive]
|
||||||
|
trait BR {}
|
||||||
|
trait CR {}
|
||||||
|
|
||||||
|
impl<T: CR + BR> AR for T {}
|
||||||
|
impl<T: AR> BR for T {}
|
||||||
|
impl<T: BR> CR for T {}
|
||||||
|
|
||||||
|
fn impls_ar<T: AR>() {}
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
impls_a::<()>();
|
||||||
|
//~^ ERROR overflow evaluating the requirement `(): A`
|
||||||
|
|
||||||
|
impls_ar::<()>();
|
||||||
|
//~^ ERROR overflow evaluating the requirement `(): AR`
|
||||||
|
}
|
|
@ -0,0 +1,29 @@
|
||||||
|
error[E0275]: overflow evaluating the requirement `(): A`
|
||||||
|
--> $DIR/inductive-not-on-stack.rs:41:5
|
||||||
|
|
|
||||||
|
LL | impls_a::<()>();
|
||||||
|
| ^^^^^^^^^^^^^
|
||||||
|
|
|
||||||
|
= help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`inductive_not_on_stack`)
|
||||||
|
note: required by a bound in `impls_a`
|
||||||
|
--> $DIR/inductive-not-on-stack.rs:25:15
|
||||||
|
|
|
||||||
|
LL | fn impls_a<T: A>() {}
|
||||||
|
| ^ required by this bound in `impls_a`
|
||||||
|
|
||||||
|
error[E0275]: overflow evaluating the requirement `(): AR`
|
||||||
|
--> $DIR/inductive-not-on-stack.rs:44:5
|
||||||
|
|
|
||||||
|
LL | impls_ar::<()>();
|
||||||
|
| ^^^^^^^^^^^^^^
|
||||||
|
|
|
||||||
|
= help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`inductive_not_on_stack`)
|
||||||
|
note: required by a bound in `impls_ar`
|
||||||
|
--> $DIR/inductive-not-on-stack.rs:38:16
|
||||||
|
|
|
||||||
|
LL | fn impls_ar<T: AR>() {}
|
||||||
|
| ^^ required by this bound in `impls_ar`
|
||||||
|
|
||||||
|
error: aborting due to 2 previous errors
|
||||||
|
|
||||||
|
For more information about this error, try `rustc --explain E0275`.
|
Loading…
Add table
Add a link
Reference in a new issue