Auto merge of #136350 - matthiaskrgr:rollup-6eqfyvh, r=matthiaskrgr
Rollup of 9 pull requests Successful merges: - #134531 ([rustdoc] Add `--extract-doctests` command-line flag) - #135860 (Compiler: Finalize dyn compatibility renaming) - #135992 (Improve documentation when adding a new target) - #136194 (Support clobber_abi in BPF inline assembly) - #136325 (Delay a bug when indexing unsized slices) - #136326 (Replace our `LLVMRustDIBuilderRef` with LLVM-C's `LLVMDIBuilderRef`) - #136330 (Remove unnecessary hooks) - #136336 (Overhaul `rustc_middle::util`) - #136341 (Remove myself from vacation) r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
commit
854f22563c
148 changed files with 838 additions and 512 deletions
|
@ -3777,7 +3777,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
|
|||
let tcx = self.infcx.tcx;
|
||||
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(
|
||||
&& let Some((method_did, method_args)) = mir::find_self_call(
|
||||
tcx,
|
||||
self.body,
|
||||
loan.assigned_place.local,
|
||||
|
|
|
@ -17,7 +17,7 @@ use rustc_middle::mir::tcx::PlaceTy;
|
|||
use rustc_middle::mir::{
|
||||
AggregateKind, CallSource, ConstOperand, ConstraintCategory, FakeReadCause, Local, LocalInfo,
|
||||
LocalKind, Location, Operand, Place, PlaceRef, ProjectionElem, Rvalue, Statement,
|
||||
StatementKind, Terminator, TerminatorKind,
|
||||
StatementKind, Terminator, TerminatorKind, find_self_call,
|
||||
};
|
||||
use rustc_middle::ty::print::Print;
|
||||
use rustc_middle::ty::{self, Ty, TyCtxt};
|
||||
|
@ -1016,12 +1016,9 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
|
|||
kind: TerminatorKind::Call { fn_span, call_source, .. }, ..
|
||||
}) = &self.body[location.block].terminator
|
||||
{
|
||||
let Some((method_did, method_args)) = rustc_middle::util::find_self_call(
|
||||
self.infcx.tcx,
|
||||
self.body,
|
||||
target_temp,
|
||||
location.block,
|
||||
) else {
|
||||
let Some((method_did, method_args)) =
|
||||
find_self_call(self.infcx.tcx, self.body, target_temp, location.block)
|
||||
else {
|
||||
return normal_ret;
|
||||
};
|
||||
|
||||
|
|
|
@ -634,7 +634,12 @@ impl<'tcx> Visitor<'tcx> for Checker<'_, 'tcx> {
|
|||
Rvalue::RawPtr(RawPtrKind::FakeForPtrMetadata, place) => {
|
||||
// These are only inserted for slice length, so the place must already be indirect.
|
||||
// This implies we do not have to worry about whether the borrow escapes.
|
||||
assert!(place.is_indirect(), "fake borrows are always indirect");
|
||||
if !place.is_indirect() {
|
||||
self.tcx.dcx().span_delayed_bug(
|
||||
self.body.source_info(location).span,
|
||||
"fake borrows are always indirect",
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Rvalue::Cast(
|
||||
|
|
|
@ -76,6 +76,7 @@ pub mod sync;
|
|||
pub mod tagged_ptr;
|
||||
pub mod temp_dir;
|
||||
pub mod thinvec;
|
||||
pub mod thousands;
|
||||
pub mod transitive_relation;
|
||||
pub mod unhash;
|
||||
pub mod unord;
|
||||
|
|
16
compiler/rustc_data_structures/src/thousands/mod.rs
Normal file
16
compiler/rustc_data_structures/src/thousands/mod.rs
Normal file
|
@ -0,0 +1,16 @@
|
|||
//! This is an extremely bare-bones alternative to the `thousands` crate on
|
||||
//! crates.io, for printing large numbers in a readable fashion.
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests;
|
||||
|
||||
// Converts the number to a string, with underscores as the thousands separator.
|
||||
pub fn format_with_underscores(n: usize) -> String {
|
||||
let mut s = n.to_string();
|
||||
let mut i = s.len();
|
||||
while i > 3 {
|
||||
i -= 3;
|
||||
s.insert(i, '_');
|
||||
}
|
||||
s
|
||||
}
|
14
compiler/rustc_data_structures/src/thousands/tests.rs
Normal file
14
compiler/rustc_data_structures/src/thousands/tests.rs
Normal file
|
@ -0,0 +1,14 @@
|
|||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn test_format_with_underscores() {
|
||||
assert_eq!("0", format_with_underscores(0));
|
||||
assert_eq!("1", format_with_underscores(1));
|
||||
assert_eq!("99", format_with_underscores(99));
|
||||
assert_eq!("345", format_with_underscores(345));
|
||||
assert_eq!("1_000", format_with_underscores(1_000));
|
||||
assert_eq!("12_001", format_with_underscores(12_001));
|
||||
assert_eq!("999_999", format_with_underscores(999_999));
|
||||
assert_eq!("1_000_000", format_with_underscores(1_000_000));
|
||||
assert_eq!("12_345_678", format_with_underscores(12_345_678));
|
||||
}
|
|
@ -7,6 +7,7 @@ use rustc_ast_pretty::pprust as pprust_ast;
|
|||
use rustc_middle::bug;
|
||||
use rustc_middle::mir::{write_mir_graphviz, write_mir_pretty};
|
||||
use rustc_middle::ty::{self, TyCtxt};
|
||||
use rustc_mir_build::thir::print::{thir_flat, thir_tree};
|
||||
use rustc_session::Session;
|
||||
use rustc_session::config::{OutFileName, PpHirMode, PpMode, PpSourceMode};
|
||||
use rustc_smir::rustc_internal::pretty::write_smir_pretty;
|
||||
|
@ -313,7 +314,7 @@ pub fn print<'tcx>(sess: &Session, ppm: PpMode, ex: PrintExtra<'tcx>) {
|
|||
tcx.dcx().abort_if_errors();
|
||||
debug!("pretty printing THIR tree");
|
||||
for did in tcx.hir().body_owners() {
|
||||
let _ = writeln!(out, "{:?}:\n{}\n", did, tcx.thir_tree(did));
|
||||
let _ = writeln!(out, "{:?}:\n{}\n", did, thir_tree(tcx, did));
|
||||
}
|
||||
out
|
||||
}
|
||||
|
@ -324,7 +325,7 @@ pub fn print<'tcx>(sess: &Session, ppm: PpMode, ex: PrintExtra<'tcx>) {
|
|||
tcx.dcx().abort_if_errors();
|
||||
debug!("pretty printing THIR flat");
|
||||
for did in tcx.hir().body_owners() {
|
||||
let _ = writeln!(out, "{:?}:\n{}\n", did, tcx.thir_flat(did));
|
||||
let _ = writeln!(out, "{:?}:\n{}\n", did, thir_flat(tcx, did));
|
||||
}
|
||||
out
|
||||
}
|
||||
|
|
|
@ -199,10 +199,9 @@ fn check_object_overlap<'tcx>(
|
|||
|
||||
for component_def_id in component_def_ids {
|
||||
if !tcx.is_dyn_compatible(component_def_id) {
|
||||
// FIXME(dyn_compat_renaming): Rename test and update comment.
|
||||
// Without the 'dyn_compatible_for_dispatch' feature this is an error
|
||||
// which will be reported by wfcheck. Ignore it here.
|
||||
// This is tested by `coherence-impl-trait-for-trait-object-safe.rs`.
|
||||
// This is tested by `coherence-impl-trait-for-trait-dyn-compatible.rs`.
|
||||
// With the feature enabled, the trait is not implemented automatically,
|
||||
// so this is valid.
|
||||
} else {
|
||||
|
|
|
@ -37,7 +37,7 @@ declare_lint_pass!(MultipleSupertraitUpcastable => [MULTIPLE_SUPERTRAIT_UPCASTAB
|
|||
impl<'tcx> LateLintPass<'tcx> for MultipleSupertraitUpcastable {
|
||||
fn check_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx hir::Item<'tcx>) {
|
||||
let def_id = item.owner_id.to_def_id();
|
||||
// NOTE(nbdd0121): use `object_safety_violations` instead of `is_dyn_compatible` because
|
||||
// NOTE(nbdd0121): use `dyn_compatibility_violations` instead of `is_dyn_compatible` because
|
||||
// the latter will report `where_clause_object_safety` lint.
|
||||
if let hir::ItemKind::Trait(_, _, _, _, _) = item.kind
|
||||
&& cx.tcx.is_dyn_compatible(def_id)
|
||||
|
|
|
@ -677,8 +677,6 @@ extern "C" bool LLVMRustInlineAsmVerify(LLVMTypeRef Ty, char *Constraints,
|
|||
unwrap<FunctionType>(Ty), StringRef(Constraints, ConstraintsLen)));
|
||||
}
|
||||
|
||||
typedef DIBuilder *LLVMRustDIBuilderRef;
|
||||
|
||||
template <typename DIT> DIT *unwrapDIPtr(LLVMMetadataRef Ref) {
|
||||
return (DIT *)(Ref ? unwrap<MDNode>(Ref) : nullptr);
|
||||
}
|
||||
|
@ -687,12 +685,6 @@ template <typename DIT> DIT *unwrapDIPtr(LLVMMetadataRef Ref) {
|
|||
#define DIArray DINodeArray
|
||||
#define unwrapDI unwrapDIPtr
|
||||
|
||||
// FIXME(Zalathar): This is a temporary typedef to avoid churning dozens of
|
||||
// bindings that are going to be deleted and replaced with their LLVM-C
|
||||
// equivalents, as part of #134009. After that happens, the remaining bindings
|
||||
// can be adjusted to use `LLVMDIFlags` instead of relying on this typedef.
|
||||
typedef LLVMDIFlags LLVMRustDIFlags;
|
||||
|
||||
// Statically assert that `LLVMDIFlags` (C) and `DIFlags` (C++) have the same
|
||||
// layout, at least for the flags we know about. This isn't guaranteed, but is
|
||||
// likely to remain true, and as long as it is true it makes conversions easy.
|
||||
|
@ -1003,34 +995,34 @@ extern "C" void LLVMRustGlobalAddMetadata(LLVMValueRef Global, unsigned Kind,
|
|||
unwrap<GlobalObject>(Global)->addMetadata(Kind, *unwrap<MDNode>(MD));
|
||||
}
|
||||
|
||||
extern "C" LLVMRustDIBuilderRef LLVMRustDIBuilderCreate(LLVMModuleRef M) {
|
||||
return new DIBuilder(*unwrap(M));
|
||||
extern "C" LLVMDIBuilderRef LLVMRustDIBuilderCreate(LLVMModuleRef M) {
|
||||
return wrap(new DIBuilder(*unwrap(M)));
|
||||
}
|
||||
|
||||
extern "C" void LLVMRustDIBuilderDispose(LLVMRustDIBuilderRef Builder) {
|
||||
delete Builder;
|
||||
extern "C" void LLVMRustDIBuilderDispose(LLVMDIBuilderRef Builder) {
|
||||
delete unwrap(Builder);
|
||||
}
|
||||
|
||||
extern "C" void LLVMRustDIBuilderFinalize(LLVMRustDIBuilderRef Builder) {
|
||||
Builder->finalize();
|
||||
extern "C" void LLVMRustDIBuilderFinalize(LLVMDIBuilderRef Builder) {
|
||||
unwrap(Builder)->finalize();
|
||||
}
|
||||
|
||||
extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateCompileUnit(
|
||||
LLVMRustDIBuilderRef Builder, unsigned Lang, LLVMMetadataRef FileRef,
|
||||
LLVMDIBuilderRef Builder, unsigned Lang, LLVMMetadataRef FileRef,
|
||||
const char *Producer, size_t ProducerLen, bool isOptimized,
|
||||
const char *Flags, unsigned RuntimeVer, const char *SplitName,
|
||||
size_t SplitNameLen, LLVMRustDebugEmissionKind Kind, uint64_t DWOId,
|
||||
bool SplitDebugInlining, LLVMRustDebugNameTableKind TableKind) {
|
||||
auto *File = unwrapDI<DIFile>(FileRef);
|
||||
|
||||
return wrap(Builder->createCompileUnit(
|
||||
return wrap(unwrap(Builder)->createCompileUnit(
|
||||
Lang, File, StringRef(Producer, ProducerLen), isOptimized, Flags,
|
||||
RuntimeVer, StringRef(SplitName, SplitNameLen), fromRust(Kind), DWOId,
|
||||
SplitDebugInlining, false, fromRust(TableKind)));
|
||||
}
|
||||
|
||||
extern "C" LLVMMetadataRef
|
||||
LLVMRustDIBuilderCreateFile(LLVMRustDIBuilderRef Builder, const char *Filename,
|
||||
LLVMRustDIBuilderCreateFile(LLVMDIBuilderRef Builder, const char *Filename,
|
||||
size_t FilenameLen, const char *Directory,
|
||||
size_t DirectoryLen, LLVMRustChecksumKind CSKind,
|
||||
const char *Checksum, size_t ChecksumLen,
|
||||
|
@ -1043,29 +1035,29 @@ LLVMRustDIBuilderCreateFile(LLVMRustDIBuilderRef Builder, const char *Filename,
|
|||
std::optional<StringRef> oSource{};
|
||||
if (Source)
|
||||
oSource = StringRef(Source, SourceLen);
|
||||
return wrap(Builder->createFile(StringRef(Filename, FilenameLen),
|
||||
StringRef(Directory, DirectoryLen), CSInfo,
|
||||
oSource));
|
||||
return wrap(unwrap(Builder)->createFile(StringRef(Filename, FilenameLen),
|
||||
StringRef(Directory, DirectoryLen),
|
||||
CSInfo, oSource));
|
||||
}
|
||||
|
||||
extern "C" LLVMMetadataRef
|
||||
LLVMRustDIBuilderCreateSubroutineType(LLVMRustDIBuilderRef Builder,
|
||||
LLVMRustDIBuilderCreateSubroutineType(LLVMDIBuilderRef Builder,
|
||||
LLVMMetadataRef ParameterTypes) {
|
||||
return wrap(Builder->createSubroutineType(
|
||||
return wrap(unwrap(Builder)->createSubroutineType(
|
||||
DITypeRefArray(unwrap<MDTuple>(ParameterTypes))));
|
||||
}
|
||||
|
||||
extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateFunction(
|
||||
LLVMRustDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name,
|
||||
LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name,
|
||||
size_t NameLen, const char *LinkageName, size_t LinkageNameLen,
|
||||
LLVMMetadataRef File, unsigned LineNo, LLVMMetadataRef Ty,
|
||||
unsigned ScopeLine, LLVMRustDIFlags Flags, LLVMRustDISPFlags SPFlags,
|
||||
unsigned ScopeLine, LLVMDIFlags Flags, LLVMRustDISPFlags SPFlags,
|
||||
LLVMValueRef MaybeFn, LLVMMetadataRef TParam, LLVMMetadataRef Decl) {
|
||||
DITemplateParameterArray TParams =
|
||||
DITemplateParameterArray(unwrap<MDTuple>(TParam));
|
||||
DISubprogram::DISPFlags llvmSPFlags = fromRust(SPFlags);
|
||||
DINode::DIFlags llvmFlags = fromRust(Flags);
|
||||
DISubprogram *Sub = Builder->createFunction(
|
||||
DISubprogram *Sub = unwrap(Builder)->createFunction(
|
||||
unwrapDI<DIScope>(Scope), StringRef(Name, NameLen),
|
||||
StringRef(LinkageName, LinkageNameLen), unwrapDI<DIFile>(File), LineNo,
|
||||
unwrapDI<DISubroutineType>(Ty), ScopeLine, llvmFlags, llvmSPFlags,
|
||||
|
@ -1076,15 +1068,15 @@ extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateFunction(
|
|||
}
|
||||
|
||||
extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateMethod(
|
||||
LLVMRustDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name,
|
||||
LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name,
|
||||
size_t NameLen, const char *LinkageName, size_t LinkageNameLen,
|
||||
LLVMMetadataRef File, unsigned LineNo, LLVMMetadataRef Ty,
|
||||
LLVMRustDIFlags Flags, LLVMRustDISPFlags SPFlags, LLVMMetadataRef TParam) {
|
||||
LLVMDIFlags Flags, LLVMRustDISPFlags SPFlags, LLVMMetadataRef TParam) {
|
||||
DITemplateParameterArray TParams =
|
||||
DITemplateParameterArray(unwrap<MDTuple>(TParam));
|
||||
DISubprogram::DISPFlags llvmSPFlags = fromRust(SPFlags);
|
||||
DINode::DIFlags llvmFlags = fromRust(Flags);
|
||||
DISubprogram *Sub = Builder->createMethod(
|
||||
DISubprogram *Sub = unwrap(Builder)->createMethod(
|
||||
unwrapDI<DIScope>(Scope), StringRef(Name, NameLen),
|
||||
StringRef(LinkageName, LinkageNameLen), unwrapDI<DIFile>(File), LineNo,
|
||||
unwrapDI<DISubroutineType>(Ty), 0, 0,
|
||||
|
@ -1094,39 +1086,39 @@ extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateMethod(
|
|||
}
|
||||
|
||||
extern "C" LLVMMetadataRef
|
||||
LLVMRustDIBuilderCreateBasicType(LLVMRustDIBuilderRef Builder, const char *Name,
|
||||
LLVMRustDIBuilderCreateBasicType(LLVMDIBuilderRef Builder, const char *Name,
|
||||
size_t NameLen, uint64_t SizeInBits,
|
||||
unsigned Encoding) {
|
||||
return wrap(
|
||||
Builder->createBasicType(StringRef(Name, NameLen), SizeInBits, Encoding));
|
||||
return wrap(unwrap(Builder)->createBasicType(StringRef(Name, NameLen),
|
||||
SizeInBits, Encoding));
|
||||
}
|
||||
|
||||
extern "C" LLVMMetadataRef
|
||||
LLVMRustDIBuilderCreateTypedef(LLVMRustDIBuilderRef Builder,
|
||||
LLVMMetadataRef Type, const char *Name,
|
||||
size_t NameLen, LLVMMetadataRef File,
|
||||
unsigned LineNo, LLVMMetadataRef Scope) {
|
||||
return wrap(Builder->createTypedef(
|
||||
LLVMRustDIBuilderCreateTypedef(LLVMDIBuilderRef Builder, LLVMMetadataRef Type,
|
||||
const char *Name, size_t NameLen,
|
||||
LLVMMetadataRef File, unsigned LineNo,
|
||||
LLVMMetadataRef Scope) {
|
||||
return wrap(unwrap(Builder)->createTypedef(
|
||||
unwrap<DIType>(Type), StringRef(Name, NameLen), unwrap<DIFile>(File),
|
||||
LineNo, unwrapDIPtr<DIScope>(Scope)));
|
||||
}
|
||||
|
||||
extern "C" LLVMMetadataRef LLVMRustDIBuilderCreatePointerType(
|
||||
LLVMRustDIBuilderRef Builder, LLVMMetadataRef PointeeTy,
|
||||
uint64_t SizeInBits, uint32_t AlignInBits, unsigned AddressSpace,
|
||||
const char *Name, size_t NameLen) {
|
||||
return wrap(Builder->createPointerType(unwrapDI<DIType>(PointeeTy),
|
||||
SizeInBits, AlignInBits, AddressSpace,
|
||||
LLVMDIBuilderRef Builder, LLVMMetadataRef PointeeTy, uint64_t SizeInBits,
|
||||
uint32_t AlignInBits, unsigned AddressSpace, const char *Name,
|
||||
size_t NameLen) {
|
||||
return wrap(unwrap(Builder)->createPointerType(
|
||||
unwrapDI<DIType>(PointeeTy), SizeInBits, AlignInBits, AddressSpace,
|
||||
StringRef(Name, NameLen)));
|
||||
}
|
||||
|
||||
extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateStructType(
|
||||
LLVMRustDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name,
|
||||
LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name,
|
||||
size_t NameLen, LLVMMetadataRef File, unsigned LineNumber,
|
||||
uint64_t SizeInBits, uint32_t AlignInBits, LLVMRustDIFlags Flags,
|
||||
uint64_t SizeInBits, uint32_t AlignInBits, LLVMDIFlags Flags,
|
||||
LLVMMetadataRef DerivedFrom, LLVMMetadataRef Elements, unsigned RunTimeLang,
|
||||
LLVMMetadataRef VTableHolder, const char *UniqueId, size_t UniqueIdLen) {
|
||||
return wrap(Builder->createStructType(
|
||||
return wrap(unwrap(Builder)->createStructType(
|
||||
unwrapDI<DIDescriptor>(Scope), StringRef(Name, NameLen),
|
||||
unwrapDI<DIFile>(File), LineNumber, SizeInBits, AlignInBits,
|
||||
fromRust(Flags), unwrapDI<DIType>(DerivedFrom),
|
||||
|
@ -1135,12 +1127,12 @@ extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateStructType(
|
|||
}
|
||||
|
||||
extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateVariantPart(
|
||||
LLVMRustDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name,
|
||||
LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name,
|
||||
size_t NameLen, LLVMMetadataRef File, unsigned LineNumber,
|
||||
uint64_t SizeInBits, uint32_t AlignInBits, LLVMRustDIFlags Flags,
|
||||
uint64_t SizeInBits, uint32_t AlignInBits, LLVMDIFlags Flags,
|
||||
LLVMMetadataRef Discriminator, LLVMMetadataRef Elements,
|
||||
const char *UniqueId, size_t UniqueIdLen) {
|
||||
return wrap(Builder->createVariantPart(
|
||||
return wrap(unwrap(Builder)->createVariantPart(
|
||||
unwrapDI<DIDescriptor>(Scope), StringRef(Name, NameLen),
|
||||
unwrapDI<DIFile>(File), LineNumber, SizeInBits, AlignInBits,
|
||||
fromRust(Flags), unwrapDI<DIDerivedType>(Discriminator),
|
||||
|
@ -1149,36 +1141,36 @@ extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateVariantPart(
|
|||
}
|
||||
|
||||
extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateMemberType(
|
||||
LLVMRustDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name,
|
||||
LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name,
|
||||
size_t NameLen, LLVMMetadataRef File, unsigned LineNo, uint64_t SizeInBits,
|
||||
uint32_t AlignInBits, uint64_t OffsetInBits, LLVMRustDIFlags Flags,
|
||||
uint32_t AlignInBits, uint64_t OffsetInBits, LLVMDIFlags Flags,
|
||||
LLVMMetadataRef Ty) {
|
||||
return wrap(Builder->createMemberType(
|
||||
return wrap(unwrap(Builder)->createMemberType(
|
||||
unwrapDI<DIDescriptor>(Scope), StringRef(Name, NameLen),
|
||||
unwrapDI<DIFile>(File), LineNo, SizeInBits, AlignInBits, OffsetInBits,
|
||||
fromRust(Flags), unwrapDI<DIType>(Ty)));
|
||||
}
|
||||
|
||||
extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateVariantMemberType(
|
||||
LLVMRustDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name,
|
||||
LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name,
|
||||
size_t NameLen, LLVMMetadataRef File, unsigned LineNo, uint64_t SizeInBits,
|
||||
uint32_t AlignInBits, uint64_t OffsetInBits, LLVMValueRef Discriminant,
|
||||
LLVMRustDIFlags Flags, LLVMMetadataRef Ty) {
|
||||
LLVMDIFlags Flags, LLVMMetadataRef Ty) {
|
||||
llvm::ConstantInt *D = nullptr;
|
||||
if (Discriminant) {
|
||||
D = unwrap<llvm::ConstantInt>(Discriminant);
|
||||
}
|
||||
return wrap(Builder->createVariantMemberType(
|
||||
return wrap(unwrap(Builder)->createVariantMemberType(
|
||||
unwrapDI<DIDescriptor>(Scope), StringRef(Name, NameLen),
|
||||
unwrapDI<DIFile>(File), LineNo, SizeInBits, AlignInBits, OffsetInBits, D,
|
||||
fromRust(Flags), unwrapDI<DIType>(Ty)));
|
||||
}
|
||||
|
||||
extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateStaticMemberType(
|
||||
LLVMRustDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name,
|
||||
LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name,
|
||||
size_t NameLen, LLVMMetadataRef File, unsigned LineNo, LLVMMetadataRef Ty,
|
||||
LLVMRustDIFlags Flags, LLVMValueRef val, uint32_t AlignInBits) {
|
||||
return wrap(Builder->createStaticMemberType(
|
||||
LLVMDIFlags Flags, LLVMValueRef val, uint32_t AlignInBits) {
|
||||
return wrap(unwrap(Builder)->createStaticMemberType(
|
||||
unwrapDI<DIDescriptor>(Scope), StringRef(Name, NameLen),
|
||||
unwrapDI<DIFile>(File), LineNo, unwrapDI<DIType>(Ty), fromRust(Flags),
|
||||
unwrap<llvm::ConstantInt>(val), llvm::dwarf::DW_TAG_member, AlignInBits));
|
||||
|
@ -1192,21 +1184,21 @@ LLVMRustDIBuilderCreateQualifiedType(LLVMDIBuilderRef Builder, unsigned Tag,
|
|||
}
|
||||
|
||||
extern "C" LLVMMetadataRef
|
||||
LLVMRustDIBuilderCreateLexicalBlock(LLVMRustDIBuilderRef Builder,
|
||||
LLVMRustDIBuilderCreateLexicalBlock(LLVMDIBuilderRef Builder,
|
||||
LLVMMetadataRef Scope, LLVMMetadataRef File,
|
||||
unsigned Line, unsigned Col) {
|
||||
return wrap(Builder->createLexicalBlock(unwrapDI<DIDescriptor>(Scope),
|
||||
unwrapDI<DIFile>(File), Line, Col));
|
||||
return wrap(unwrap(Builder)->createLexicalBlock(
|
||||
unwrapDI<DIDescriptor>(Scope), unwrapDI<DIFile>(File), Line, Col));
|
||||
}
|
||||
|
||||
extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateLexicalBlockFile(
|
||||
LLVMRustDIBuilderRef Builder, LLVMMetadataRef Scope, LLVMMetadataRef File) {
|
||||
return wrap(Builder->createLexicalBlockFile(unwrapDI<DIDescriptor>(Scope),
|
||||
unwrapDI<DIFile>(File)));
|
||||
LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, LLVMMetadataRef File) {
|
||||
return wrap(unwrap(Builder)->createLexicalBlockFile(
|
||||
unwrapDI<DIDescriptor>(Scope), unwrapDI<DIFile>(File)));
|
||||
}
|
||||
|
||||
extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateStaticVariable(
|
||||
LLVMRustDIBuilderRef Builder, LLVMMetadataRef Context, const char *Name,
|
||||
LLVMDIBuilderRef Builder, LLVMMetadataRef Context, const char *Name,
|
||||
size_t NameLen, const char *LinkageName, size_t LinkageNameLen,
|
||||
LLVMMetadataRef File, unsigned LineNo, LLVMMetadataRef Ty,
|
||||
bool IsLocalToUnit, LLVMValueRef V, LLVMMetadataRef Decl = nullptr,
|
||||
|
@ -1215,16 +1207,16 @@ extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateStaticVariable(
|
|||
|
||||
llvm::DIExpression *InitExpr = nullptr;
|
||||
if (llvm::ConstantInt *IntVal = llvm::dyn_cast<llvm::ConstantInt>(InitVal)) {
|
||||
InitExpr = Builder->createConstantValueExpression(
|
||||
InitExpr = unwrap(Builder)->createConstantValueExpression(
|
||||
IntVal->getValue().getSExtValue());
|
||||
} else if (llvm::ConstantFP *FPVal =
|
||||
llvm::dyn_cast<llvm::ConstantFP>(InitVal)) {
|
||||
InitExpr = Builder->createConstantValueExpression(
|
||||
InitExpr = unwrap(Builder)->createConstantValueExpression(
|
||||
FPVal->getValueAPF().bitcastToAPInt().getZExtValue());
|
||||
}
|
||||
|
||||
llvm::DIGlobalVariableExpression *VarExpr =
|
||||
Builder->createGlobalVariableExpression(
|
||||
unwrap(Builder)->createGlobalVariableExpression(
|
||||
unwrapDI<DIDescriptor>(Context), StringRef(Name, NameLen),
|
||||
StringRef(LinkageName, LinkageNameLen), unwrapDI<DIFile>(File),
|
||||
LineNo, unwrapDI<DIType>(Ty), IsLocalToUnit,
|
||||
|
@ -1237,17 +1229,17 @@ extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateStaticVariable(
|
|||
}
|
||||
|
||||
extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateVariable(
|
||||
LLVMRustDIBuilderRef Builder, unsigned Tag, LLVMMetadataRef Scope,
|
||||
LLVMDIBuilderRef Builder, unsigned Tag, LLVMMetadataRef Scope,
|
||||
const char *Name, size_t NameLen, LLVMMetadataRef File, unsigned LineNo,
|
||||
LLVMMetadataRef Ty, bool AlwaysPreserve, LLVMRustDIFlags Flags,
|
||||
unsigned ArgNo, uint32_t AlignInBits) {
|
||||
LLVMMetadataRef Ty, bool AlwaysPreserve, LLVMDIFlags Flags, unsigned ArgNo,
|
||||
uint32_t AlignInBits) {
|
||||
if (Tag == 0x100) { // DW_TAG_auto_variable
|
||||
return wrap(Builder->createAutoVariable(
|
||||
return wrap(unwrap(Builder)->createAutoVariable(
|
||||
unwrapDI<DIDescriptor>(Scope), StringRef(Name, NameLen),
|
||||
unwrapDI<DIFile>(File), LineNo, unwrapDI<DIType>(Ty), AlwaysPreserve,
|
||||
fromRust(Flags), AlignInBits));
|
||||
} else {
|
||||
return wrap(Builder->createParameterVariable(
|
||||
return wrap(unwrap(Builder)->createParameterVariable(
|
||||
unwrapDI<DIDescriptor>(Scope), StringRef(Name, NameLen), ArgNo,
|
||||
unwrapDI<DIFile>(File), LineNo, unwrapDI<DIType>(Ty), AlwaysPreserve,
|
||||
fromRust(Flags)));
|
||||
|
@ -1255,53 +1247,56 @@ extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateVariable(
|
|||
}
|
||||
|
||||
extern "C" LLVMMetadataRef
|
||||
LLVMRustDIBuilderCreateArrayType(LLVMRustDIBuilderRef Builder, uint64_t Size,
|
||||
LLVMRustDIBuilderCreateArrayType(LLVMDIBuilderRef Builder, uint64_t Size,
|
||||
uint32_t AlignInBits, LLVMMetadataRef Ty,
|
||||
LLVMMetadataRef Subscripts) {
|
||||
return wrap(
|
||||
Builder->createArrayType(Size, AlignInBits, unwrapDI<DIType>(Ty),
|
||||
return wrap(unwrap(Builder)->createArrayType(
|
||||
Size, AlignInBits, unwrapDI<DIType>(Ty),
|
||||
DINodeArray(unwrapDI<MDTuple>(Subscripts))));
|
||||
}
|
||||
|
||||
extern "C" LLVMMetadataRef
|
||||
LLVMRustDIBuilderGetOrCreateSubrange(LLVMRustDIBuilderRef Builder, int64_t Lo,
|
||||
LLVMRustDIBuilderGetOrCreateSubrange(LLVMDIBuilderRef Builder, int64_t Lo,
|
||||
int64_t Count) {
|
||||
return wrap(Builder->getOrCreateSubrange(Lo, Count));
|
||||
return wrap(unwrap(Builder)->getOrCreateSubrange(Lo, Count));
|
||||
}
|
||||
|
||||
extern "C" LLVMMetadataRef
|
||||
LLVMRustDIBuilderGetOrCreateArray(LLVMRustDIBuilderRef Builder,
|
||||
LLVMRustDIBuilderGetOrCreateArray(LLVMDIBuilderRef Builder,
|
||||
LLVMMetadataRef *Ptr, unsigned Count) {
|
||||
Metadata **DataValue = unwrap(Ptr);
|
||||
return wrap(
|
||||
Builder->getOrCreateArray(ArrayRef<Metadata *>(DataValue, Count)).get());
|
||||
return wrap(unwrap(Builder)
|
||||
->getOrCreateArray(ArrayRef<Metadata *>(DataValue, Count))
|
||||
.get());
|
||||
}
|
||||
|
||||
extern "C" void LLVMRustDIBuilderInsertDeclareAtEnd(
|
||||
LLVMRustDIBuilderRef Builder, LLVMValueRef V, LLVMMetadataRef VarInfo,
|
||||
uint64_t *AddrOps, unsigned AddrOpsCount, LLVMMetadataRef DL,
|
||||
extern "C" void
|
||||
LLVMRustDIBuilderInsertDeclareAtEnd(LLVMDIBuilderRef Builder, LLVMValueRef V,
|
||||
LLVMMetadataRef VarInfo, uint64_t *AddrOps,
|
||||
unsigned AddrOpsCount, LLVMMetadataRef DL,
|
||||
LLVMBasicBlockRef InsertAtEnd) {
|
||||
Builder->insertDeclare(unwrap(V), unwrap<DILocalVariable>(VarInfo),
|
||||
Builder->createExpression(
|
||||
unwrap(Builder)->insertDeclare(
|
||||
unwrap(V), unwrap<DILocalVariable>(VarInfo),
|
||||
unwrap(Builder)->createExpression(
|
||||
llvm::ArrayRef<uint64_t>(AddrOps, AddrOpsCount)),
|
||||
DebugLoc(cast<MDNode>(unwrap(DL))),
|
||||
unwrap(InsertAtEnd));
|
||||
DebugLoc(cast<MDNode>(unwrap(DL))), unwrap(InsertAtEnd));
|
||||
}
|
||||
|
||||
extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateEnumerator(
|
||||
LLVMRustDIBuilderRef Builder, const char *Name, size_t NameLen,
|
||||
const uint64_t Value[2], unsigned SizeInBits, bool IsUnsigned) {
|
||||
return wrap(Builder->createEnumerator(
|
||||
extern "C" LLVMMetadataRef
|
||||
LLVMRustDIBuilderCreateEnumerator(LLVMDIBuilderRef Builder, const char *Name,
|
||||
size_t NameLen, const uint64_t Value[2],
|
||||
unsigned SizeInBits, bool IsUnsigned) {
|
||||
return wrap(unwrap(Builder)->createEnumerator(
|
||||
StringRef(Name, NameLen),
|
||||
APSInt(APInt(SizeInBits, ArrayRef<uint64_t>(Value, 2)), IsUnsigned)));
|
||||
}
|
||||
|
||||
extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateEnumerationType(
|
||||
LLVMRustDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name,
|
||||
LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name,
|
||||
size_t NameLen, LLVMMetadataRef File, unsigned LineNumber,
|
||||
uint64_t SizeInBits, uint32_t AlignInBits, LLVMMetadataRef Elements,
|
||||
LLVMMetadataRef ClassTy, bool IsScoped) {
|
||||
return wrap(Builder->createEnumerationType(
|
||||
return wrap(unwrap(Builder)->createEnumerationType(
|
||||
unwrapDI<DIDescriptor>(Scope), StringRef(Name, NameLen),
|
||||
unwrapDI<DIFile>(File), LineNumber, SizeInBits, AlignInBits,
|
||||
DINodeArray(unwrapDI<MDTuple>(Elements)), unwrapDI<DIType>(ClassTy),
|
||||
|
@ -1309,12 +1304,12 @@ extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateEnumerationType(
|
|||
}
|
||||
|
||||
extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateUnionType(
|
||||
LLVMRustDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name,
|
||||
LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name,
|
||||
size_t NameLen, LLVMMetadataRef File, unsigned LineNumber,
|
||||
uint64_t SizeInBits, uint32_t AlignInBits, LLVMRustDIFlags Flags,
|
||||
uint64_t SizeInBits, uint32_t AlignInBits, LLVMDIFlags Flags,
|
||||
LLVMMetadataRef Elements, unsigned RunTimeLang, const char *UniqueId,
|
||||
size_t UniqueIdLen) {
|
||||
return wrap(Builder->createUnionType(
|
||||
return wrap(unwrap(Builder)->createUnionType(
|
||||
unwrapDI<DIDescriptor>(Scope), StringRef(Name, NameLen),
|
||||
unwrapDI<DIFile>(File), LineNumber, SizeInBits, AlignInBits,
|
||||
fromRust(Flags), DINodeArray(unwrapDI<MDTuple>(Elements)), RunTimeLang,
|
||||
|
@ -1322,27 +1317,27 @@ extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateUnionType(
|
|||
}
|
||||
|
||||
extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateTemplateTypeParameter(
|
||||
LLVMRustDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name,
|
||||
LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name,
|
||||
size_t NameLen, LLVMMetadataRef Ty) {
|
||||
bool IsDefault = false; // FIXME: should we ever set this true?
|
||||
return wrap(Builder->createTemplateTypeParameter(
|
||||
return wrap(unwrap(Builder)->createTemplateTypeParameter(
|
||||
unwrapDI<DIDescriptor>(Scope), StringRef(Name, NameLen),
|
||||
unwrapDI<DIType>(Ty), IsDefault));
|
||||
}
|
||||
|
||||
extern "C" LLVMMetadataRef
|
||||
LLVMRustDIBuilderCreateNameSpace(LLVMRustDIBuilderRef Builder,
|
||||
LLVMRustDIBuilderCreateNameSpace(LLVMDIBuilderRef Builder,
|
||||
LLVMMetadataRef Scope, const char *Name,
|
||||
size_t NameLen, bool ExportSymbols) {
|
||||
return wrap(Builder->createNameSpace(
|
||||
return wrap(unwrap(Builder)->createNameSpace(
|
||||
unwrapDI<DIDescriptor>(Scope), StringRef(Name, NameLen), ExportSymbols));
|
||||
}
|
||||
|
||||
extern "C" void LLVMRustDICompositeTypeReplaceArrays(
|
||||
LLVMRustDIBuilderRef Builder, LLVMMetadataRef CompositeTy,
|
||||
LLVMDIBuilderRef Builder, LLVMMetadataRef CompositeTy,
|
||||
LLVMMetadataRef Elements, LLVMMetadataRef Params) {
|
||||
DICompositeType *Tmp = unwrapDI<DICompositeType>(CompositeTy);
|
||||
Builder->replaceArrays(Tmp, DINodeArray(unwrap<MDTuple>(Elements)),
|
||||
unwrap(Builder)->replaceArrays(Tmp, DINodeArray(unwrap<MDTuple>(Elements)),
|
||||
DINodeArray(unwrap<MDTuple>(Params)));
|
||||
}
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@ use rustc_data_structures::fx::{FxIndexMap, FxIndexSet};
|
|||
use rustc_data_structures::memmap::{Mmap, MmapMut};
|
||||
use rustc_data_structures::sync::{Lrc, join, par_for_each_in};
|
||||
use rustc_data_structures::temp_dir::MaybeTempDir;
|
||||
use rustc_data_structures::thousands::format_with_underscores;
|
||||
use rustc_feature::Features;
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::def_id::{CRATE_DEF_ID, CRATE_DEF_INDEX, LOCAL_CRATE, LocalDefId, LocalDefIdSet};
|
||||
|
@ -22,7 +23,6 @@ use rustc_middle::traits::specialization_graph;
|
|||
use rustc_middle::ty::codec::TyEncoder;
|
||||
use rustc_middle::ty::fast_reject::{self, TreatParams};
|
||||
use rustc_middle::ty::{AssocItemContainer, SymbolName};
|
||||
use rustc_middle::util::common::to_readable_str;
|
||||
use rustc_middle::{bug, span_bug};
|
||||
use rustc_serialize::{Decodable, Decoder, Encodable, Encoder, opaque};
|
||||
use rustc_session::config::{CrateType, OptLevel};
|
||||
|
@ -782,7 +782,7 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
|
|||
"{} {:<23}{:>10} ({:4.1}%)",
|
||||
prefix,
|
||||
label,
|
||||
to_readable_str(size),
|
||||
format_with_underscores(size),
|
||||
perc(size)
|
||||
);
|
||||
}
|
||||
|
@ -791,7 +791,7 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
|
|||
"{} {:<23}{:>10} (of which {:.1}% are zero bytes)",
|
||||
prefix,
|
||||
"Total",
|
||||
to_readable_str(total_bytes),
|
||||
format_with_underscores(total_bytes),
|
||||
perc(zero_bytes)
|
||||
);
|
||||
eprintln!("{prefix}");
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//! "Hooks" provide a way for `tcx` functionality to be provided by some downstream crate without
|
||||
//! everything in rustc having to depend on that crate. This is somewhat similar to queries, but
|
||||
//! queries come with a lot of machinery for caching and incremental compilation, whereas hooks are
|
||||
//! just plain function pointers without any of the query magic.
|
||||
//! "Hooks" let you write `tcx` methods in downstream crates and call them in this crate, reducing
|
||||
//! the amount of code that needs to be in this crate (which is already very big). This is somewhat
|
||||
//! similar to queries, but queries come with a lot of machinery for caching and incremental
|
||||
//! compilation, whereas hooks are just plain function pointers without any of the query magic.
|
||||
|
||||
use rustc_hir::def_id::{DefId, DefPathHash};
|
||||
use rustc_session::StableCrateId;
|
||||
|
@ -75,12 +75,6 @@ declare_hooks! {
|
|||
/// (Eligible functions might nevertheless be skipped for other reasons.)
|
||||
hook is_eligible_for_coverage(key: LocalDefId) -> bool;
|
||||
|
||||
/// Create the MIR for a given `DefId` - this includes
|
||||
/// unreachable code.
|
||||
/// You do not want to call this yourself, instead use the cached version
|
||||
/// via `mir_built`
|
||||
hook build_mir(key: LocalDefId) -> mir::Body<'tcx>;
|
||||
|
||||
/// Imports all `SourceFile`s from the given crate into the current session.
|
||||
/// This normally happens automatically when we decode a `Span` from
|
||||
/// that crate's metadata - however, the incr comp cache needs
|
||||
|
@ -99,14 +93,11 @@ declare_hooks! {
|
|||
/// Will fetch a DefId from a DefPathHash for a foreign crate.
|
||||
hook def_path_hash_to_def_id_extern(hash: DefPathHash, stable_crate_id: StableCrateId) -> DefId;
|
||||
|
||||
/// Create a THIR tree for debugging.
|
||||
hook thir_tree(key: LocalDefId) -> String;
|
||||
|
||||
/// Create a list-like THIR representation for debugging.
|
||||
hook thir_flat(key: LocalDefId) -> String;
|
||||
|
||||
/// Returns `true` if we should codegen an instance in the local crate, or returns `false` if we
|
||||
/// can just link to the upstream crate and therefore don't need a mono item.
|
||||
///
|
||||
/// Note: this hook isn't called within `rustc_middle` but #127779 suggests it's a hook instead
|
||||
/// of a normal function because external tools might want to override it.
|
||||
hook should_codegen_locally(instance: crate::ty::Instance<'tcx>) -> bool;
|
||||
|
||||
hook alloc_self_profile_query_strings() -> ();
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
///
|
||||
/// If you have a span available, you should use [`span_bug`] instead.
|
||||
///
|
||||
/// If the bug should only be emitted when compilation didn't fail, [`DiagCtxtHandle::span_delayed_bug`]
|
||||
/// may be useful.
|
||||
/// If the bug should only be emitted when compilation didn't fail,
|
||||
/// [`DiagCtxtHandle::span_delayed_bug`] may be useful.
|
||||
///
|
||||
/// [`DiagCtxtHandle::span_delayed_bug`]: rustc_errors::DiagCtxtHandle::span_delayed_bug
|
||||
/// [`span_bug`]: crate::span_bug
|
||||
|
@ -14,14 +14,8 @@ macro_rules! bug {
|
|||
() => (
|
||||
$crate::bug!("impossible case reached")
|
||||
);
|
||||
($msg:expr) => (
|
||||
$crate::util::bug::bug_fmt(::std::format_args!($msg))
|
||||
);
|
||||
($msg:expr,) => (
|
||||
$crate::bug!($msg)
|
||||
);
|
||||
($fmt:expr, $($arg:tt)+) => (
|
||||
$crate::util::bug::bug_fmt(::std::format_args!($fmt, $($arg)+))
|
||||
($($arg:tt)+) => (
|
||||
$crate::util::bug::bug_fmt(::std::format_args!($($arg)+))
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -30,20 +24,14 @@ macro_rules! bug {
|
|||
/// at the code the compiler was compiling when it ICEd. This is the preferred way to trigger
|
||||
/// ICEs.
|
||||
///
|
||||
/// If the bug should only be emitted when compilation didn't fail, [`DiagCtxtHandle::span_delayed_bug`]
|
||||
/// may be useful.
|
||||
/// If the bug should only be emitted when compilation didn't fail,
|
||||
/// [`DiagCtxtHandle::span_delayed_bug`] may be useful.
|
||||
///
|
||||
/// [`DiagCtxtHandle::span_delayed_bug`]: rustc_errors::DiagCtxtHandle::span_delayed_bug
|
||||
#[macro_export]
|
||||
macro_rules! span_bug {
|
||||
($span:expr, $msg:expr) => (
|
||||
$crate::util::bug::span_bug_fmt($span, ::std::format_args!($msg))
|
||||
);
|
||||
($span:expr, $msg:expr,) => (
|
||||
$crate::span_bug!($span, $msg)
|
||||
);
|
||||
($span:expr, $fmt:expr, $($arg:tt)+) => (
|
||||
$crate::util::bug::span_bug_fmt($span, ::std::format_args!($fmt, $($arg)+))
|
||||
($span:expr, $($arg:tt)+) => (
|
||||
$crate::util::bug::span_bug_fmt($span, ::std::format_args!($($arg)+))
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -53,7 +41,6 @@ macro_rules! span_bug {
|
|||
// When possible, use one of these (relatively) convenient macros to write
|
||||
// the impls for you.
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! TrivialLiftImpls {
|
||||
($($ty:ty),+ $(,)?) => {
|
||||
$(
|
||||
|
@ -69,7 +56,6 @@ macro_rules! TrivialLiftImpls {
|
|||
|
||||
/// Used for types that are `Copy` and which **do not care about arena
|
||||
/// allocated data** (i.e., don't need to be folded).
|
||||
#[macro_export]
|
||||
macro_rules! TrivialTypeTraversalImpls {
|
||||
($($ty:ty),+ $(,)?) => {
|
||||
$(
|
||||
|
@ -104,7 +90,6 @@ macro_rules! TrivialTypeTraversalImpls {
|
|||
};
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! TrivialTypeTraversalAndLiftImpls {
|
||||
($($t:tt)*) => {
|
||||
TrivialTypeTraversalImpls! { $($t)* }
|
||||
|
|
|
@ -27,7 +27,7 @@ use rustc_macros::{HashStable, TyDecodable, TyEncodable, TypeFoldable, TypeVisit
|
|||
use rustc_serialize::{Decodable, Encodable};
|
||||
use rustc_span::source_map::Spanned;
|
||||
use rustc_span::{DUMMY_SP, Span, Symbol};
|
||||
use tracing::trace;
|
||||
use tracing::{debug, trace};
|
||||
|
||||
pub use self::query::*;
|
||||
use self::visit::TyContext;
|
||||
|
@ -1796,6 +1796,47 @@ impl DefLocation {
|
|||
}
|
||||
}
|
||||
|
||||
/// Checks if the specified `local` is used as the `self` parameter of a method call
|
||||
/// in the provided `BasicBlock`. If it is, then the `DefId` of the called method is
|
||||
/// returned.
|
||||
pub fn find_self_call<'tcx>(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
body: &Body<'tcx>,
|
||||
local: Local,
|
||||
block: BasicBlock,
|
||||
) -> Option<(DefId, GenericArgsRef<'tcx>)> {
|
||||
debug!("find_self_call(local={:?}): terminator={:?}", local, body[block].terminator);
|
||||
if let Some(Terminator { kind: TerminatorKind::Call { func, args, .. }, .. }) =
|
||||
&body[block].terminator
|
||||
&& let Operand::Constant(box ConstOperand { const_, .. }) = func
|
||||
&& let ty::FnDef(def_id, fn_args) = *const_.ty().kind()
|
||||
&& let Some(ty::AssocItem { fn_has_self_parameter: true, .. }) =
|
||||
tcx.opt_associated_item(def_id)
|
||||
&& let [Spanned { node: Operand::Move(self_place) | Operand::Copy(self_place), .. }, ..] =
|
||||
**args
|
||||
{
|
||||
if self_place.as_local() == Some(local) {
|
||||
return Some((def_id, fn_args));
|
||||
}
|
||||
|
||||
// Handle the case where `self_place` gets reborrowed.
|
||||
// This happens when the receiver is `&T`.
|
||||
for stmt in &body[block].statements {
|
||||
if let StatementKind::Assign(box (place, rvalue)) = &stmt.kind
|
||||
&& let Some(reborrow_local) = place.as_local()
|
||||
&& self_place.as_local() == Some(reborrow_local)
|
||||
&& let Rvalue::Ref(_, _, deref_place) = rvalue
|
||||
&& let PlaceRef { local: deref_local, projection: [ProjectionElem::Deref] } =
|
||||
deref_place.as_ref()
|
||||
&& deref_local == local
|
||||
{
|
||||
return Some((def_id, fn_args));
|
||||
}
|
||||
}
|
||||
}
|
||||
None
|
||||
}
|
||||
|
||||
// Some nodes are used a lot. Make sure they don't unintentionally get bigger.
|
||||
#[cfg(target_pointer_width = "64")]
|
||||
mod size_asserts {
|
||||
|
|
|
@ -428,7 +428,7 @@ pub enum IsConstable {
|
|||
Ctor,
|
||||
}
|
||||
|
||||
crate::TrivialTypeTraversalAndLiftImpls! {
|
||||
TrivialTypeTraversalAndLiftImpls! {
|
||||
IsConstable,
|
||||
}
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ use crate::ty::{self, ExistentialPredicateStableCmpExt, TyCtxt};
|
|||
|
||||
impl<'tcx> TyCtxt<'tcx> {
|
||||
/// Given a `def_id` of a trait or impl method, compute whether that method needs to
|
||||
/// have an RPITIT shim applied to it for it to be object safe. If so, return the
|
||||
/// have an RPITIT shim applied to it for it to be dyn compatible. If so, return the
|
||||
/// `def_id` of the RPITIT, and also the args of trait method that returns the RPITIT.
|
||||
///
|
||||
/// NOTE that these args are not, in general, the same as than the RPITIT's args. They
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// These functions are used by macro expansion for bug! and span_bug!
|
||||
// These functions are used by macro expansion for `bug!` and `span_bug!`.
|
||||
|
||||
use std::fmt;
|
||||
use std::panic::{Location, panic_any};
|
||||
|
@ -8,15 +8,15 @@ use rustc_span::Span;
|
|||
|
||||
use crate::ty::{TyCtxt, tls};
|
||||
|
||||
// This wrapper makes for more compact code at callsites than calling `opt_span_buf_fmt` directly.
|
||||
#[cold]
|
||||
#[inline(never)]
|
||||
#[track_caller]
|
||||
pub fn bug_fmt(args: fmt::Arguments<'_>) -> ! {
|
||||
// this wrapper mostly exists so I don't have to write a fully
|
||||
// qualified path of None::<Span> inside the bug!() macro definition
|
||||
opt_span_bug_fmt(None::<Span>, args, Location::caller());
|
||||
}
|
||||
|
||||
// This wrapper makes for more compact code at callsites than calling `opt_span_buf_fmt` directly.
|
||||
#[cold]
|
||||
#[inline(never)]
|
||||
#[track_caller]
|
||||
|
|
|
@ -1,22 +0,0 @@
|
|||
#[cfg(test)]
|
||||
mod tests;
|
||||
|
||||
pub fn to_readable_str(mut val: usize) -> String {
|
||||
let mut groups = vec![];
|
||||
loop {
|
||||
let group = val % 1000;
|
||||
|
||||
val /= 1000;
|
||||
|
||||
if val == 0 {
|
||||
groups.push(group.to_string());
|
||||
break;
|
||||
} else {
|
||||
groups.push(format!("{group:03}"));
|
||||
}
|
||||
}
|
||||
|
||||
groups.reverse();
|
||||
|
||||
groups.join("_")
|
||||
}
|
|
@ -1,14 +0,0 @@
|
|||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn test_to_readable_str() {
|
||||
assert_eq!("0", to_readable_str(0));
|
||||
assert_eq!("1", to_readable_str(1));
|
||||
assert_eq!("99", to_readable_str(99));
|
||||
assert_eq!("999", to_readable_str(999));
|
||||
assert_eq!("1_000", to_readable_str(1_000));
|
||||
assert_eq!("1_001", to_readable_str(1_001));
|
||||
assert_eq!("999_999", to_readable_str(999_999));
|
||||
assert_eq!("1_000_000", to_readable_str(1_000_000));
|
||||
assert_eq!("1_234_567", to_readable_str(1_234_567));
|
||||
}
|
|
@ -1,47 +0,0 @@
|
|||
use rustc_span::def_id::DefId;
|
||||
use rustc_span::source_map::Spanned;
|
||||
use tracing::debug;
|
||||
|
||||
use crate::mir::*;
|
||||
use crate::ty::{self, GenericArgsRef, TyCtxt};
|
||||
|
||||
/// Checks if the specified `local` is used as the `self` parameter of a method call
|
||||
/// in the provided `BasicBlock`. If it is, then the `DefId` of the called method is
|
||||
/// returned.
|
||||
pub fn find_self_call<'tcx>(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
body: &Body<'tcx>,
|
||||
local: Local,
|
||||
block: BasicBlock,
|
||||
) -> Option<(DefId, GenericArgsRef<'tcx>)> {
|
||||
debug!("find_self_call(local={:?}): terminator={:?}", local, body[block].terminator);
|
||||
if let Some(Terminator { kind: TerminatorKind::Call { func, args, .. }, .. }) =
|
||||
&body[block].terminator
|
||||
&& let Operand::Constant(box ConstOperand { const_, .. }) = func
|
||||
&& let ty::FnDef(def_id, fn_args) = *const_.ty().kind()
|
||||
&& let Some(ty::AssocItem { fn_has_self_parameter: true, .. }) =
|
||||
tcx.opt_associated_item(def_id)
|
||||
&& let [Spanned { node: Operand::Move(self_place) | Operand::Copy(self_place), .. }, ..] =
|
||||
**args
|
||||
{
|
||||
if self_place.as_local() == Some(local) {
|
||||
return Some((def_id, fn_args));
|
||||
}
|
||||
|
||||
// Handle the case where `self_place` gets reborrowed.
|
||||
// This happens when the receiver is `&T`.
|
||||
for stmt in &body[block].statements {
|
||||
if let StatementKind::Assign(box (place, rvalue)) = &stmt.kind
|
||||
&& let Some(reborrow_local) = place.as_local()
|
||||
&& self_place.as_local() == Some(reborrow_local)
|
||||
&& let Rvalue::Ref(_, _, deref_place) = rvalue
|
||||
&& let PlaceRef { local: deref_local, projection: [ProjectionElem::Deref] } =
|
||||
deref_place.as_ref()
|
||||
&& deref_local == local
|
||||
{
|
||||
return Some((def_id, fn_args));
|
||||
}
|
||||
}
|
||||
}
|
||||
None
|
||||
}
|
|
@ -1,8 +1,4 @@
|
|||
pub mod bug;
|
||||
pub mod common;
|
||||
pub mod find_self_call;
|
||||
|
||||
pub use find_self_call::find_self_call;
|
||||
|
||||
#[derive(Default, Copy, Clone)]
|
||||
pub struct Providers {
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
//! present, and if so we branch off into this module, which implements the attribute by
|
||||
//! implementing a custom lowering from THIR to MIR.
|
||||
//!
|
||||
//! The result of this lowering is returned "normally" from the `build_mir` hook, with the only
|
||||
//! The result of this lowering is returned "normally" from `build_mir`, with the only
|
||||
//! notable difference being that the `injected` field in the body is set. Various components of the
|
||||
//! MIR pipeline, like borrowck and the pass manager will then consult this field (via
|
||||
//! `body.should_skip()`) to skip the parts of the MIR pipeline that precede the MIR phase the user
|
||||
|
|
|
@ -20,7 +20,6 @@ use rustc_infer::infer::{InferCtxt, TyCtxtInferExt};
|
|||
use rustc_middle::hir::place::PlaceBase as HirPlaceBase;
|
||||
use rustc_middle::middle::region;
|
||||
use rustc_middle::mir::*;
|
||||
use rustc_middle::query::TyCtxtAt;
|
||||
use rustc_middle::thir::{self, ExprId, LintLevel, LocalVarId, Param, ParamId, PatKind, Thir};
|
||||
use rustc_middle::ty::{self, ScalarInt, Ty, TyCtxt, TypeVisitableExt, TypingMode};
|
||||
use rustc_middle::{bug, span_bug};
|
||||
|
@ -45,9 +44,9 @@ pub(crate) fn closure_saved_names_of_captured_variables<'tcx>(
|
|||
.collect()
|
||||
}
|
||||
|
||||
/// Construct the MIR for a given `DefId`.
|
||||
pub(crate) fn build_mir<'tcx>(tcx: TyCtxtAt<'tcx>, def: LocalDefId) -> Body<'tcx> {
|
||||
let tcx = tcx.tcx;
|
||||
/// Create the MIR for a given `DefId`, including unreachable code. Do not call
|
||||
/// this directly; instead use the cached version via `mir_built`.
|
||||
pub fn build_mir<'tcx>(tcx: TyCtxt<'tcx>, def: LocalDefId) -> Body<'tcx> {
|
||||
tcx.ensure_with_value().thir_abstract_const(def);
|
||||
if let Err(e) = tcx.check_match(def) {
|
||||
return construct_error(tcx, def, e);
|
||||
|
|
|
@ -14,11 +14,11 @@
|
|||
// The `builder` module used to be named `build`, but that was causing GitHub's
|
||||
// "Go to file" feature to silently ignore all files in the module, probably
|
||||
// because it assumes that "build" is a build-output directory. See #134365.
|
||||
mod builder;
|
||||
pub mod builder;
|
||||
mod check_tail_calls;
|
||||
mod check_unsafety;
|
||||
mod errors;
|
||||
mod thir;
|
||||
pub mod thir;
|
||||
|
||||
use rustc_middle::util::Providers;
|
||||
|
||||
|
@ -27,12 +27,9 @@ rustc_fluent_macro::fluent_messages! { "../messages.ftl" }
|
|||
pub fn provide(providers: &mut Providers) {
|
||||
providers.check_match = thir::pattern::check_match;
|
||||
providers.lit_to_const = thir::constant::lit_to_const;
|
||||
providers.hooks.build_mir = builder::build_mir;
|
||||
providers.closure_saved_names_of_captured_variables =
|
||||
builder::closure_saved_names_of_captured_variables;
|
||||
providers.check_unsafety = check_unsafety::check_unsafety;
|
||||
providers.check_tail_calls = check_tail_calls::check_tail_calls;
|
||||
providers.thir_body = thir::cx::thir_body;
|
||||
providers.hooks.thir_tree = thir::print::thir_tree;
|
||||
providers.hooks.thir_flat = thir::print::thir_flat;
|
||||
}
|
||||
|
|
|
@ -7,5 +7,5 @@
|
|||
pub(crate) mod constant;
|
||||
pub(crate) mod cx;
|
||||
pub(crate) mod pattern;
|
||||
pub(crate) mod print;
|
||||
pub mod print;
|
||||
mod util;
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
use std::fmt::{self, Write};
|
||||
|
||||
use rustc_middle::query::TyCtxtAt;
|
||||
use rustc_middle::thir::*;
|
||||
use rustc_middle::ty;
|
||||
use rustc_middle::ty::TyCtxt;
|
||||
use rustc_span::def_id::LocalDefId;
|
||||
|
||||
pub(crate) fn thir_tree(tcx: TyCtxtAt<'_>, owner_def: LocalDefId) -> String {
|
||||
match super::cx::thir_body(*tcx, owner_def) {
|
||||
/// Create a THIR tree for debugging.
|
||||
pub fn thir_tree(tcx: TyCtxt<'_>, owner_def: LocalDefId) -> String {
|
||||
match super::cx::thir_body(tcx, owner_def) {
|
||||
Ok((thir, _)) => {
|
||||
let thir = thir.steal();
|
||||
let mut printer = ThirPrinter::new(&thir);
|
||||
|
@ -17,8 +18,9 @@ pub(crate) fn thir_tree(tcx: TyCtxtAt<'_>, owner_def: LocalDefId) -> String {
|
|||
}
|
||||
}
|
||||
|
||||
pub(crate) fn thir_flat(tcx: TyCtxtAt<'_>, owner_def: LocalDefId) -> String {
|
||||
match super::cx::thir_body(*tcx, owner_def) {
|
||||
/// Create a list-like THIR representation for debugging.
|
||||
pub fn thir_flat(tcx: TyCtxt<'_>, owner_def: LocalDefId) -> String {
|
||||
match super::cx::thir_body(tcx, owner_def) {
|
||||
Ok((thir, _)) => format!("{:#?}", thir.steal()),
|
||||
Err(_) => "error".into(),
|
||||
}
|
||||
|
|
|
@ -133,7 +133,7 @@ impl<'tcx> Visitor<'tcx> for ConstMutationChecker<'_, 'tcx> {
|
|||
// the `self` parameter of a method call (as the terminator of our current
|
||||
// BasicBlock). If so, we emit a more specific lint.
|
||||
let method_did = self.target_local.and_then(|target_local| {
|
||||
rustc_middle::util::find_self_call(self.tcx, self.body, target_local, loc.block)
|
||||
find_self_call(self.tcx, self.body, target_local, loc.block)
|
||||
});
|
||||
let lint_loc =
|
||||
if method_did.is_some() { self.body.terminator_loc(loc.block) } else { loc };
|
||||
|
|
|
@ -33,6 +33,7 @@ use rustc_middle::mir::{
|
|||
use rustc_middle::ty::{self, TyCtxt, TypeVisitableExt};
|
||||
use rustc_middle::util::Providers;
|
||||
use rustc_middle::{bug, query, span_bug};
|
||||
use rustc_mir_build::builder::build_mir;
|
||||
use rustc_span::source_map::Spanned;
|
||||
use rustc_span::{DUMMY_SP, sym};
|
||||
use tracing::debug;
|
||||
|
@ -370,7 +371,7 @@ fn mir_const_qualif(tcx: TyCtxt<'_>, def: LocalDefId) -> ConstQualifs {
|
|||
}
|
||||
|
||||
fn mir_built(tcx: TyCtxt<'_>, def: LocalDefId) -> &Steal<Body<'_>> {
|
||||
let mut body = tcx.build_mir(def);
|
||||
let mut body = build_mir(tcx, def);
|
||||
|
||||
pass_manager::dump_mir_for_phase_change(tcx, &body);
|
||||
|
||||
|
|
|
@ -5,10 +5,10 @@
|
|||
use rustc_ast::visit::BoundKind;
|
||||
use rustc_ast::{self as ast, NodeId, visit as ast_visit};
|
||||
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
|
||||
use rustc_data_structures::thousands::format_with_underscores;
|
||||
use rustc_hir::{self as hir, AmbigArg, HirId, intravisit as hir_visit};
|
||||
use rustc_middle::hir::map::Map;
|
||||
use rustc_middle::ty::TyCtxt;
|
||||
use rustc_middle::util::common::to_readable_str;
|
||||
use rustc_span::Span;
|
||||
use rustc_span::def_id::LocalDefId;
|
||||
|
||||
|
@ -144,10 +144,10 @@ impl<'k> StatCollector<'k> {
|
|||
"{} {:<18}{:>10} ({:4.1}%){:>14}{:>14}",
|
||||
prefix,
|
||||
label,
|
||||
to_readable_str(size),
|
||||
format_with_underscores(size),
|
||||
percent(size, total_size),
|
||||
to_readable_str(node.stats.count),
|
||||
to_readable_str(node.stats.size)
|
||||
format_with_underscores(node.stats.count),
|
||||
format_with_underscores(node.stats.size)
|
||||
);
|
||||
if !node.subnodes.is_empty() {
|
||||
// We will soon sort, so the initial order does not matter.
|
||||
|
@ -163,9 +163,9 @@ impl<'k> StatCollector<'k> {
|
|||
"{} - {:<18}{:>10} ({:4.1}%){:>14}",
|
||||
prefix,
|
||||
label,
|
||||
to_readable_str(size),
|
||||
format_with_underscores(size),
|
||||
percent(size, total_size),
|
||||
to_readable_str(subnode.count),
|
||||
format_with_underscores(subnode.count),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -175,8 +175,8 @@ impl<'k> StatCollector<'k> {
|
|||
"{} {:<18}{:>10} {:>14}",
|
||||
prefix,
|
||||
"Total",
|
||||
to_readable_str(total_size),
|
||||
to_readable_str(total_count),
|
||||
format_with_underscores(total_size),
|
||||
format_with_underscores(total_count),
|
||||
);
|
||||
eprintln!("{prefix}");
|
||||
}
|
||||
|
|
|
@ -934,6 +934,7 @@ pub enum InlineAsmClobberAbi {
|
|||
LoongArch,
|
||||
PowerPC,
|
||||
S390x,
|
||||
Bpf,
|
||||
Msp430,
|
||||
}
|
||||
|
||||
|
@ -1003,6 +1004,10 @@ impl InlineAsmClobberAbi {
|
|||
"C" | "system" => Ok(InlineAsmClobberAbi::S390x),
|
||||
_ => Err(&["C", "system"]),
|
||||
},
|
||||
InlineAsmArch::Bpf => match name {
|
||||
"C" | "system" => Ok(InlineAsmClobberAbi::Bpf),
|
||||
_ => Err(&["C", "system"]),
|
||||
},
|
||||
InlineAsmArch::Msp430 => match name {
|
||||
"C" | "system" => Ok(InlineAsmClobberAbi::Msp430),
|
||||
_ => Err(&["C", "system"]),
|
||||
|
@ -1278,6 +1283,14 @@ impl InlineAsmClobberAbi {
|
|||
a8, a9, a10, a11, a12, a13, a14, a15,
|
||||
}
|
||||
},
|
||||
InlineAsmClobberAbi::Bpf => clobbered_regs! {
|
||||
Bpf BpfInlineAsmReg {
|
||||
// Refs: Section 1.1 "Registers and calling convention" in BPF ABI Recommended Conventions and Guidelines v1.0
|
||||
// https://www.kernel.org/doc/html/latest/bpf/standardization/abi.html#registers-and-calling-convention
|
||||
|
||||
r0, r1, r2, r3, r4, r5,
|
||||
}
|
||||
},
|
||||
InlineAsmClobberAbi::Msp430 => clobbered_regs! {
|
||||
Msp430 Msp430InlineAsmReg {
|
||||
r11, r12, r13, r14, r15,
|
||||
|
|
|
@ -482,11 +482,10 @@ pub fn report_dyn_incompatibility<'tcx>(
|
|||
for (span, msg) in iter::zip(multi_span, messages) {
|
||||
note_span.push_span_label(span, msg);
|
||||
}
|
||||
// FIXME(dyn_compat_renaming): Update the URL.
|
||||
err.span_note(
|
||||
note_span,
|
||||
"for a trait to be dyn compatible it needs to allow building a vtable\n\
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>",
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>",
|
||||
);
|
||||
|
||||
// Only provide the help if its a local trait, otherwise it's not actionable.
|
||||
|
|
|
@ -64,7 +64,7 @@ fn is_dyn_compatible(tcx: TyCtxt<'_>, trait_def_id: DefId) -> bool {
|
|||
}
|
||||
|
||||
/// We say a method is *vtable safe* if it can be invoked on a trait
|
||||
/// object. Note that object-safe traits can have some
|
||||
/// object. Note that dyn-compatible traits can have some
|
||||
/// non-vtable-safe methods, so long as they require `Self: Sized` or
|
||||
/// otherwise ensure that they cannot be used when `Self = Trait`.
|
||||
pub fn is_vtable_safe_method(tcx: TyCtxt<'_>, trait_def_id: DefId, method: ty::AssocItem) -> bool {
|
||||
|
@ -421,7 +421,7 @@ fn virtual_call_violations_for_method<'tcx>(
|
|||
let receiver_ty = tcx.liberate_late_bound_regions(method.def_id, sig.input(0));
|
||||
|
||||
// Until `unsized_locals` is fully implemented, `self: Self` can't be dispatched on.
|
||||
// However, this is already considered object-safe. We allow it as a special case here.
|
||||
// However, this is already considered dyn compatible. We allow it as a special case here.
|
||||
// FIXME(mikeyhew) get rid of this `if` statement once `receiver_is_dispatchable` allows
|
||||
// `Receiver: Unsize<Receiver[Self => dyn Trait]>`.
|
||||
if receiver_ty != tcx.types.self_param {
|
||||
|
@ -631,7 +631,7 @@ fn object_ty_for_trait<'tcx>(
|
|||
/// - `self: Pin<Box<Self>>` requires `Pin<Box<Self>>: DispatchFromDyn<Pin<Box<dyn Trait>>>`.
|
||||
///
|
||||
/// The only case where the receiver is not dispatchable, but is still a valid receiver
|
||||
/// type (just not object-safe), is when there is more than one level of pointer indirection.
|
||||
/// type (just not dyn compatible), is when there is more than one level of pointer indirection.
|
||||
/// E.g., `self: &&Self`, `self: &Rc<Self>`, `self: Box<Box<Self>>`. In these cases, there
|
||||
/// is no way, or at least no inexpensive way, to coerce the receiver from the version where
|
||||
/// `Self = dyn Trait` to the version where `Self = T`, where `T` is the unknown erased type
|
||||
|
|
|
@ -25,7 +25,7 @@ use tracing::debug;
|
|||
/// trait Bar {}
|
||||
/// trait Foo = Bar + Bar;
|
||||
///
|
||||
/// let not_object_safe: dyn Foo; // bad, two `Bar` principals.
|
||||
/// let dyn_incompatible: dyn Foo; // bad, two `Bar` principals.
|
||||
/// ```
|
||||
pub fn expand_trait_aliases<'tcx>(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
|
|
|
@ -4,8 +4,13 @@ These are a set of steps to add support for a new target. There are
|
|||
numerous end states and paths to get there, so not all sections may be
|
||||
relevant to your desired goal.
|
||||
|
||||
See also the associated documentation in the
|
||||
[target tier policy][target_tier_policy_add].
|
||||
|
||||
<!-- toc -->
|
||||
|
||||
[target_tier_policy_add]: https://doc.rust-lang.org/rustc/target-tier-policy.html#adding-a-new-target
|
||||
|
||||
## Specifying a new LLVM
|
||||
|
||||
For very new targets, you may need to use a different fork of LLVM
|
||||
|
|
|
@ -122,12 +122,23 @@ To propose addition of a new target, open a pull request on [`rust-lang/rust`]:
|
|||
r? compiler
|
||||
```
|
||||
|
||||
See also the documentation in the `rustc-dev-guide` on [adding a new target to
|
||||
`rustc`][rustc_dev_guide_add_target].
|
||||
|
||||
Note that adding a new target that wants to support `std` would transitively
|
||||
require `cc` and `libc` support. However, these would like to know about the
|
||||
target from `rustc` as well. To break this cycle, you are strongly encouraged
|
||||
to add a _minimal_ `#![no_core]` target spec first to teach `rustc` about the
|
||||
target's existence, and add `std` support as a follow-up once you've added
|
||||
support for the target in `cc` and `libc`.
|
||||
|
||||
[tier3example]: https://github.com/rust-lang/rust/pull/94872
|
||||
[platform_template]: https://github.com/rust-lang/rust/blob/master/src/doc/rustc/src/platform-support/TEMPLATE.md
|
||||
[summary]: https://github.com/rust-lang/rust/blob/master/src/doc/rustc/src/SUMMARY.md
|
||||
[platformsupport]: https://github.com/rust-lang/rust/blob/master/src/doc/rustc/src/platform-support.md
|
||||
[rust_compiler_team]: https://www.rust-lang.org/governance/teams/compiler
|
||||
[`rust-lang/rust`]: https://github.com/rust-lang/rust
|
||||
[rustc_dev_guide_add_target]: https://rustc-dev-guide.rust-lang.org/building/new-target.html
|
||||
|
||||
## Tier 3 target policy
|
||||
|
||||
|
|
|
@ -524,6 +524,8 @@ use `-o -`.
|
|||
|
||||
## `-w`/`--output-format`: output format
|
||||
|
||||
### json
|
||||
|
||||
`--output-format json` emits documentation in the experimental
|
||||
[JSON format](https://doc.rust-lang.org/nightly/nightly-rustc/rustdoc_json_types/). `--output-format html` has no effect,
|
||||
and is also accepted on stable toolchains.
|
||||
|
@ -542,6 +544,68 @@ It can also be used with `--show-coverage`. Take a look at its
|
|||
[documentation](#--show-coverage-calculate-the-percentage-of-items-with-documentation) for more
|
||||
information.
|
||||
|
||||
### doctest
|
||||
|
||||
`--output-format doctest` emits JSON on stdout which gives you information about doctests in the
|
||||
provided crate.
|
||||
|
||||
Tracking issue: [#134529](https://github.com/rust-lang/rust/issues/134529)
|
||||
|
||||
You can use this option like this:
|
||||
|
||||
```bash
|
||||
rustdoc -Zunstable-options --output-format=doctest src/lib.rs
|
||||
```
|
||||
|
||||
For this rust code:
|
||||
|
||||
```rust
|
||||
/// ```
|
||||
/// let x = 12;
|
||||
/// ```
|
||||
pub trait Trait {}
|
||||
```
|
||||
|
||||
The generated output (formatted) will look like this:
|
||||
|
||||
```json
|
||||
{
|
||||
"format_version": 1,
|
||||
"doctests": [
|
||||
{
|
||||
"file": "foo.rs",
|
||||
"line": 1,
|
||||
"doctest_attributes": {
|
||||
"original": "",
|
||||
"should_panic": false,
|
||||
"no_run": false,
|
||||
"ignore": "None",
|
||||
"rust": true,
|
||||
"test_harness": false,
|
||||
"compile_fail": false,
|
||||
"standalone_crate": false,
|
||||
"error_codes": [],
|
||||
"edition": null,
|
||||
"added_css_classes": [],
|
||||
"unknown": []
|
||||
},
|
||||
"original_code": "let x = 12;",
|
||||
"doctest_code": "#![allow(unused)]\nfn main() {\nlet x = 12;\n}",
|
||||
"name": "foo.rs - Trait (line 1)"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
* `format_version` gives you the current version of the generated JSON. If we change the output in any way, the number will increase.
|
||||
* `doctests` contains the list of doctests present in the crate.
|
||||
* `file` is the file path where the doctest is located.
|
||||
* `line` is the line where the doctest starts (so where the \`\`\` is located in the current code).
|
||||
* `doctest_attributes` contains computed information about the attributes used on the doctests. For more information about doctest attributes, take a look [here](write-documentation/documentation-tests.html#attributes).
|
||||
* `original_code` is the code as written in the source code before rustdoc modifies it.
|
||||
* `doctest_code` is the code modified by rustdoc that will be run. If there is a fatal syntax error, this field will not be present.
|
||||
* `name` is the name generated by rustdoc which represents this doctest.
|
||||
|
||||
## `--enable-per-target-ignores`: allow `ignore-foo` style filters for doctests
|
||||
|
||||
* Tracking issue: [#64245](https://github.com/rust-lang/rust/issues/64245)
|
||||
|
|
|
@ -33,6 +33,7 @@ pub(crate) enum OutputFormat {
|
|||
Json,
|
||||
#[default]
|
||||
Html,
|
||||
Doctest,
|
||||
}
|
||||
|
||||
impl OutputFormat {
|
||||
|
@ -48,6 +49,7 @@ impl TryFrom<&str> for OutputFormat {
|
|||
match value {
|
||||
"json" => Ok(OutputFormat::Json),
|
||||
"html" => Ok(OutputFormat::Html),
|
||||
"doctest" => Ok(OutputFormat::Doctest),
|
||||
_ => Err(format!("unknown output format `{value}`")),
|
||||
}
|
||||
}
|
||||
|
@ -445,15 +447,43 @@ impl Options {
|
|||
}
|
||||
}
|
||||
|
||||
let show_coverage = matches.opt_present("show-coverage");
|
||||
let output_format_s = matches.opt_str("output-format");
|
||||
let output_format = match output_format_s {
|
||||
Some(ref s) => match OutputFormat::try_from(s.as_str()) {
|
||||
Ok(out_fmt) => out_fmt,
|
||||
Err(e) => dcx.fatal(e),
|
||||
},
|
||||
None => OutputFormat::default(),
|
||||
};
|
||||
|
||||
// check for `--output-format=json`
|
||||
if !matches!(matches.opt_str("output-format").as_deref(), None | Some("html"))
|
||||
&& !matches.opt_present("show-coverage")
|
||||
&& !nightly_options::is_unstable_enabled(matches)
|
||||
{
|
||||
match (
|
||||
output_format_s.as_ref().map(|_| output_format),
|
||||
show_coverage,
|
||||
nightly_options::is_unstable_enabled(matches),
|
||||
) {
|
||||
(None | Some(OutputFormat::Json), true, _) => {}
|
||||
(_, true, _) => {
|
||||
dcx.fatal(format!(
|
||||
"`--output-format={}` is not supported for the `--show-coverage` option",
|
||||
output_format_s.unwrap_or_default(),
|
||||
));
|
||||
}
|
||||
// If `-Zunstable-options` is used, nothing to check after this point.
|
||||
(_, false, true) => {}
|
||||
(None | Some(OutputFormat::Html), false, _) => {}
|
||||
(Some(OutputFormat::Json), false, false) => {
|
||||
dcx.fatal(
|
||||
"the -Z unstable-options flag must be passed to enable --output-format for documentation generation (see https://github.com/rust-lang/rust/issues/76578)",
|
||||
);
|
||||
}
|
||||
(Some(OutputFormat::Doctest), false, false) => {
|
||||
dcx.fatal(
|
||||
"the -Z unstable-options flag must be passed to enable --output-format for documentation generation (see https://github.com/rust-lang/rust/issues/134529)",
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
let to_check = matches.opt_strs("check-theme");
|
||||
if !to_check.is_empty() {
|
||||
|
@ -704,8 +734,6 @@ impl Options {
|
|||
})
|
||||
.collect();
|
||||
|
||||
let show_coverage = matches.opt_present("show-coverage");
|
||||
|
||||
let crate_types = match parse_crate_types_from_list(matches.opt_strs("crate-type")) {
|
||||
Ok(types) => types,
|
||||
Err(e) => {
|
||||
|
@ -713,20 +741,6 @@ impl Options {
|
|||
}
|
||||
};
|
||||
|
||||
let output_format = match matches.opt_str("output-format") {
|
||||
Some(s) => match OutputFormat::try_from(s.as_str()) {
|
||||
Ok(out_fmt) => {
|
||||
if !out_fmt.is_json() && show_coverage {
|
||||
dcx.fatal(
|
||||
"html output format isn't supported for the --show-coverage option",
|
||||
);
|
||||
}
|
||||
out_fmt
|
||||
}
|
||||
Err(e) => dcx.fatal(e),
|
||||
},
|
||||
None => OutputFormat::default(),
|
||||
};
|
||||
let crate_name = matches.opt_str("crate-name");
|
||||
let bin_crate = crate_types.contains(&CrateType::Executable);
|
||||
let proc_macro_crate = crate_types.contains(&CrateType::ProcMacro);
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
mod extracted;
|
||||
mod make;
|
||||
mod markdown;
|
||||
mod runner;
|
||||
|
@ -30,7 +31,7 @@ use tempfile::{Builder as TempFileBuilder, TempDir};
|
|||
use tracing::debug;
|
||||
|
||||
use self::rust::HirCollector;
|
||||
use crate::config::Options as RustdocOptions;
|
||||
use crate::config::{Options as RustdocOptions, OutputFormat};
|
||||
use crate::html::markdown::{ErrorCodes, Ignore, LangString, MdRelLine};
|
||||
use crate::lint::init_lints;
|
||||
|
||||
|
@ -209,15 +210,8 @@ pub(crate) fn run(dcx: DiagCtxtHandle<'_>, input: Input, options: RustdocOptions
|
|||
let args_path = temp_dir.path().join("rustdoc-cfgs");
|
||||
crate::wrap_return(dcx, generate_args_file(&args_path, &options));
|
||||
|
||||
let CreateRunnableDocTests {
|
||||
standalone_tests,
|
||||
mergeable_tests,
|
||||
rustdoc_options,
|
||||
opts,
|
||||
unused_extern_reports,
|
||||
compiling_test_count,
|
||||
..
|
||||
} = interface::run_compiler(config, |compiler| {
|
||||
let extract_doctests = options.output_format == OutputFormat::Doctest;
|
||||
let result = interface::run_compiler(config, |compiler| {
|
||||
let krate = rustc_interface::passes::parse(&compiler.sess);
|
||||
|
||||
let collector = rustc_interface::create_and_enter_global_ctxt(compiler, krate, |tcx| {
|
||||
|
@ -226,22 +220,53 @@ pub(crate) fn run(dcx: DiagCtxtHandle<'_>, input: Input, options: RustdocOptions
|
|||
let opts = scrape_test_config(crate_name, crate_attrs, args_path);
|
||||
let enable_per_target_ignores = options.enable_per_target_ignores;
|
||||
|
||||
let mut collector = CreateRunnableDocTests::new(options, opts);
|
||||
let hir_collector = HirCollector::new(
|
||||
ErrorCodes::from(compiler.sess.opts.unstable_features.is_nightly_build()),
|
||||
enable_per_target_ignores,
|
||||
tcx,
|
||||
);
|
||||
let tests = hir_collector.collect_crate();
|
||||
if extract_doctests {
|
||||
let mut collector = extracted::ExtractedDocTests::new();
|
||||
tests.into_iter().for_each(|t| collector.add_test(t, &opts, &options));
|
||||
|
||||
let stdout = std::io::stdout();
|
||||
let mut stdout = stdout.lock();
|
||||
if let Err(error) = serde_json::ser::to_writer(&mut stdout, &collector) {
|
||||
eprintln!();
|
||||
Err(format!("Failed to generate JSON output for doctests: {error:?}"))
|
||||
} else {
|
||||
Ok(None)
|
||||
}
|
||||
} else {
|
||||
let mut collector = CreateRunnableDocTests::new(options, opts);
|
||||
tests.into_iter().for_each(|t| collector.add_test(t));
|
||||
|
||||
collector
|
||||
Ok(Some(collector))
|
||||
}
|
||||
});
|
||||
compiler.sess.dcx().abort_if_errors();
|
||||
|
||||
collector
|
||||
});
|
||||
|
||||
let CreateRunnableDocTests {
|
||||
standalone_tests,
|
||||
mergeable_tests,
|
||||
rustdoc_options,
|
||||
opts,
|
||||
unused_extern_reports,
|
||||
compiling_test_count,
|
||||
..
|
||||
} = match result {
|
||||
Ok(Some(collector)) => collector,
|
||||
Ok(None) => return,
|
||||
Err(error) => {
|
||||
eprintln!("{error}");
|
||||
std::process::exit(1);
|
||||
}
|
||||
};
|
||||
|
||||
run_tests(opts, &rustdoc_options, &unused_extern_reports, standalone_tests, mergeable_tests);
|
||||
|
||||
let compiling_test_count = compiling_test_count.load(Ordering::SeqCst);
|
||||
|
|
141
src/librustdoc/doctest/extracted.rs
Normal file
141
src/librustdoc/doctest/extracted.rs
Normal file
|
@ -0,0 +1,141 @@
|
|||
//! Rustdoc's doctest extraction.
|
||||
//!
|
||||
//! This module contains the logic to extract doctests and output a JSON containing this
|
||||
//! information.
|
||||
|
||||
use serde::Serialize;
|
||||
|
||||
use super::{DocTestBuilder, ScrapedDocTest};
|
||||
use crate::config::Options as RustdocOptions;
|
||||
use crate::html::markdown;
|
||||
|
||||
/// The version of JSON output that this code generates.
|
||||
///
|
||||
/// This integer is incremented with every breaking change to the API,
|
||||
/// and is returned along with the JSON blob into the `format_version` root field.
|
||||
/// Consuming code should assert that this value matches the format version(s) that it supports.
|
||||
const FORMAT_VERSION: u32 = 1;
|
||||
|
||||
#[derive(Serialize)]
|
||||
pub(crate) struct ExtractedDocTests {
|
||||
format_version: u32,
|
||||
doctests: Vec<ExtractedDocTest>,
|
||||
}
|
||||
|
||||
impl ExtractedDocTests {
|
||||
pub(crate) fn new() -> Self {
|
||||
Self { format_version: FORMAT_VERSION, doctests: Vec::new() }
|
||||
}
|
||||
|
||||
pub(crate) fn add_test(
|
||||
&mut self,
|
||||
scraped_test: ScrapedDocTest,
|
||||
opts: &super::GlobalTestOptions,
|
||||
options: &RustdocOptions,
|
||||
) {
|
||||
let edition = scraped_test.edition(&options);
|
||||
|
||||
let ScrapedDocTest { filename, line, langstr, text, name } = scraped_test;
|
||||
|
||||
let doctest = DocTestBuilder::new(
|
||||
&text,
|
||||
Some(&opts.crate_name),
|
||||
edition,
|
||||
false,
|
||||
None,
|
||||
Some(&langstr),
|
||||
);
|
||||
let (full_test_code, size) = doctest.generate_unique_doctest(
|
||||
&text,
|
||||
langstr.test_harness,
|
||||
&opts,
|
||||
Some(&opts.crate_name),
|
||||
);
|
||||
self.doctests.push(ExtractedDocTest {
|
||||
file: filename.prefer_remapped_unconditionaly().to_string(),
|
||||
line,
|
||||
doctest_attributes: langstr.into(),
|
||||
doctest_code: if size != 0 { Some(full_test_code) } else { None },
|
||||
original_code: text,
|
||||
name,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Serialize)]
|
||||
pub(crate) struct ExtractedDocTest {
|
||||
file: String,
|
||||
line: usize,
|
||||
doctest_attributes: LangString,
|
||||
original_code: String,
|
||||
/// `None` if the code syntax is invalid.
|
||||
doctest_code: Option<String>,
|
||||
name: String,
|
||||
}
|
||||
|
||||
#[derive(Serialize)]
|
||||
pub(crate) enum Ignore {
|
||||
All,
|
||||
None,
|
||||
Some(Vec<String>),
|
||||
}
|
||||
|
||||
impl From<markdown::Ignore> for Ignore {
|
||||
fn from(original: markdown::Ignore) -> Self {
|
||||
match original {
|
||||
markdown::Ignore::All => Self::All,
|
||||
markdown::Ignore::None => Self::None,
|
||||
markdown::Ignore::Some(values) => Self::Some(values),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Serialize)]
|
||||
struct LangString {
|
||||
pub(crate) original: String,
|
||||
pub(crate) should_panic: bool,
|
||||
pub(crate) no_run: bool,
|
||||
pub(crate) ignore: Ignore,
|
||||
pub(crate) rust: bool,
|
||||
pub(crate) test_harness: bool,
|
||||
pub(crate) compile_fail: bool,
|
||||
pub(crate) standalone_crate: bool,
|
||||
pub(crate) error_codes: Vec<String>,
|
||||
pub(crate) edition: Option<String>,
|
||||
pub(crate) added_css_classes: Vec<String>,
|
||||
pub(crate) unknown: Vec<String>,
|
||||
}
|
||||
|
||||
impl From<markdown::LangString> for LangString {
|
||||
fn from(original: markdown::LangString) -> Self {
|
||||
let markdown::LangString {
|
||||
original,
|
||||
should_panic,
|
||||
no_run,
|
||||
ignore,
|
||||
rust,
|
||||
test_harness,
|
||||
compile_fail,
|
||||
standalone_crate,
|
||||
error_codes,
|
||||
edition,
|
||||
added_classes,
|
||||
unknown,
|
||||
} = original;
|
||||
|
||||
Self {
|
||||
original,
|
||||
should_panic,
|
||||
no_run,
|
||||
ignore: ignore.into(),
|
||||
rust,
|
||||
test_harness,
|
||||
compile_fail,
|
||||
standalone_crate,
|
||||
error_codes,
|
||||
edition: edition.map(|edition| edition.to_string()),
|
||||
added_css_classes: added_classes,
|
||||
unknown,
|
||||
}
|
||||
}
|
||||
}
|
|
@ -814,7 +814,12 @@ fn main_args(early_dcx: &mut EarlyDiagCtxt, at_args: &[String]) {
|
|||
}
|
||||
};
|
||||
|
||||
match (options.should_test, config::markdown_input(&input)) {
|
||||
let output_format = options.output_format;
|
||||
|
||||
match (
|
||||
options.should_test || output_format == config::OutputFormat::Doctest,
|
||||
config::markdown_input(&input),
|
||||
) {
|
||||
(true, Some(_)) => return wrap_return(dcx, doctest::test_markdown(&input, options)),
|
||||
(true, None) => return doctest::run(dcx, input, options),
|
||||
(false, Some(md_input)) => {
|
||||
|
@ -849,7 +854,6 @@ fn main_args(early_dcx: &mut EarlyDiagCtxt, at_args: &[String]) {
|
|||
// plug/cleaning passes.
|
||||
let crate_version = options.crate_version.clone();
|
||||
|
||||
let output_format = options.output_format;
|
||||
let scrape_examples_options = options.scrape_examples_options.clone();
|
||||
let bin_crate = options.bin_crate;
|
||||
|
||||
|
@ -899,6 +903,8 @@ fn main_args(early_dcx: &mut EarlyDiagCtxt, at_args: &[String]) {
|
|||
config::OutputFormat::Json => sess.time("render_json", || {
|
||||
run_renderer::<json::JsonRenderer<'_>>(krate, render_opts, cache, tcx)
|
||||
}),
|
||||
// Already handled above with doctest runners.
|
||||
config::OutputFormat::Doctest => unreachable!(),
|
||||
}
|
||||
})
|
||||
})
|
||||
|
|
31
tests/codegen/asm/bpf-clobbers.rs
Normal file
31
tests/codegen/asm/bpf-clobbers.rs
Normal file
|
@ -0,0 +1,31 @@
|
|||
//@ add-core-stubs
|
||||
//@ compile-flags: --target bpfel-unknown-none
|
||||
//@ needs-llvm-components: bpf
|
||||
|
||||
#![crate_type = "rlib"]
|
||||
#![feature(no_core, asm_experimental_arch)]
|
||||
#![no_core]
|
||||
|
||||
extern crate minicore;
|
||||
use minicore::*;
|
||||
|
||||
// CHECK-LABEL: @flags_clobber
|
||||
// CHECK: call void asm sideeffect "", ""()
|
||||
#[no_mangle]
|
||||
pub unsafe fn flags_clobber() {
|
||||
asm!("", options(nostack, nomem));
|
||||
}
|
||||
|
||||
// CHECK-LABEL: @no_clobber
|
||||
// CHECK: call void asm sideeffect "", ""()
|
||||
#[no_mangle]
|
||||
pub unsafe fn no_clobber() {
|
||||
asm!("", options(nostack, nomem, preserves_flags));
|
||||
}
|
||||
|
||||
// CHECK-LABEL: @clobber_abi
|
||||
// CHECK: asm sideeffect "", "={r0},={r1},={r2},={r3},={r4},={r5}"()
|
||||
#[no_mangle]
|
||||
pub unsafe fn clobber_abi() {
|
||||
asm!("", clobber_abi("C"), options(nostack, nomem, preserves_flags));
|
||||
}
|
|
@ -1,2 +1,2 @@
|
|||
error: html output format isn't supported for the --show-coverage option
|
||||
error: `--output-format=html` is not supported for the `--show-coverage` option
|
||||
|
||||
|
|
1
tests/rustdoc-ui/doctest-output.rs
Normal file
1
tests/rustdoc-ui/doctest-output.rs
Normal file
|
@ -0,0 +1 @@
|
|||
//@ compile-flags:-Z unstable-options --show-coverage --output-format=doctest
|
2
tests/rustdoc-ui/doctest-output.stderr
Normal file
2
tests/rustdoc-ui/doctest-output.stderr
Normal file
|
@ -0,0 +1,2 @@
|
|||
error: `--output-format=doctest` is not supported for the `--show-coverage` option
|
||||
|
15
tests/rustdoc-ui/extract-doctests.rs
Normal file
15
tests/rustdoc-ui/extract-doctests.rs
Normal file
|
@ -0,0 +1,15 @@
|
|||
// Test to ensure that it generates expected output for `--output-format=doctest` command-line
|
||||
// flag.
|
||||
|
||||
//@ compile-flags:-Z unstable-options --output-format=doctest
|
||||
//@ normalize-stdout: "tests/rustdoc-ui" -> "$$DIR"
|
||||
//@ check-pass
|
||||
|
||||
//! ```ignore (checking attributes)
|
||||
//! let x = 12;
|
||||
//! let y = 14;
|
||||
//! ```
|
||||
//!
|
||||
//! ```edition2018,compile_fail
|
||||
//! let
|
||||
//! ```
|
1
tests/rustdoc-ui/extract-doctests.stdout
Normal file
1
tests/rustdoc-ui/extract-doctests.stdout
Normal file
|
@ -0,0 +1 @@
|
|||
{"format_version":1,"doctests":[{"file":"$DIR/extract-doctests.rs","line":8,"doctest_attributes":{"original":"ignore (checking attributes)","should_panic":false,"no_run":false,"ignore":"All","rust":true,"test_harness":false,"compile_fail":false,"standalone_crate":false,"error_codes":[],"edition":null,"added_css_classes":[],"unknown":[]},"original_code":"let x = 12;\nlet y = 14;","doctest_code":"#![allow(unused)]\nfn main() {\nlet x = 12;\nlet y = 14;\n}","name":"$DIR/extract-doctests.rs - (line 8)"},{"file":"$DIR/extract-doctests.rs","line":13,"doctest_attributes":{"original":"edition2018,compile_fail","should_panic":false,"no_run":true,"ignore":"None","rust":true,"test_harness":false,"compile_fail":true,"standalone_crate":false,"error_codes":[],"edition":"2018","added_css_classes":[],"unknown":[]},"original_code":"let","doctest_code":"#![allow(unused)]\nfn main() {\nlet\n}","name":"$DIR/extract-doctests.rs - (line 13)"}]}
|
|
@ -99,7 +99,7 @@ LL | fn f<'a>(arg : Box<dyn X<Y<1> = &'a ()>>) {}
|
|||
| ^^^^^^^^^^^^^^^^^^^^ `X` is not dyn compatible
|
||||
|
|
||||
note: for a trait to be dyn compatible it needs to allow building a vtable
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
|
||||
--> $DIR/invalid_const_in_lifetime_position.rs:2:10
|
||||
|
|
||||
LL | trait X {
|
||||
|
|
|
@ -301,7 +301,7 @@ LL | pub fn next<'a, T>(s: &'a mut dyn SVec<Item = T, Output = T>) {
|
|||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ `SVec` is not dyn compatible
|
||||
|
|
||||
note: for a trait to be dyn compatible it needs to allow building a vtable
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
|
||||
--> $DIR/ice-generic-type-alias-105742.rs:15:17
|
||||
|
|
||||
LL | pub trait SVec: Index<
|
||||
|
|
|
@ -5,7 +5,7 @@ LL | impl dyn Trait {
|
|||
| ^^^^^^^^^ `Trait` is not dyn compatible
|
||||
|
|
||||
note: for a trait to be dyn compatible it needs to allow building a vtable
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
|
||||
--> $DIR/associated-const-in-trait.rs:4:11
|
||||
|
|
||||
LL | trait Trait {
|
||||
|
@ -21,7 +21,7 @@ LL | const fn n() -> usize { Self::N }
|
|||
| ^^^^ `Trait` is not dyn compatible
|
||||
|
|
||||
note: for a trait to be dyn compatible it needs to allow building a vtable
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
|
||||
--> $DIR/associated-const-in-trait.rs:4:11
|
||||
|
|
||||
LL | trait Trait {
|
||||
|
|
|
@ -5,7 +5,7 @@ LL | impl dyn Bar {}
|
|||
| ^^^^^^^ `Bar` is not dyn compatible
|
||||
|
|
||||
note: for a trait to be dyn compatible it needs to allow building a vtable
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
|
||||
--> $DIR/issue-48027.rs:2:11
|
||||
|
|
||||
LL | trait Bar {
|
||||
|
|
|
@ -5,7 +5,7 @@ LL | fn foo(x: &dyn AsyncFn()) {}
|
|||
| ^^^^^^^^^ `AsyncFnMut` is not dyn compatible
|
||||
|
|
||||
note: for a trait to be dyn compatible it needs to allow building a vtable
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
|
||||
--> $SRC_DIR/core/src/ops/async_function.rs:LL:COL
|
||||
|
|
||||
= note: the trait is not dyn compatible because it contains the generic associated type `CallRefFuture`
|
||||
|
|
|
@ -5,7 +5,7 @@ LL | let x: &dyn Foo = todo!();
|
|||
| ^^^^^^^^ `Foo` is not dyn compatible
|
||||
|
|
||||
note: for a trait to be dyn compatible it needs to allow building a vtable
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
|
||||
--> $DIR/dyn-compatibility.rs:5:14
|
||||
|
|
||||
LL | trait Foo {
|
||||
|
|
|
@ -14,7 +14,7 @@ LL | async fn foo(self: &dyn Foo) {
|
|||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `Foo` is not dyn compatible
|
||||
|
|
||||
note: for a trait to be dyn compatible it needs to allow building a vtable
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
|
||||
--> $DIR/inference_var_self_argument.rs:5:14
|
||||
|
|
||||
LL | trait Foo {
|
||||
|
|
|
@ -5,7 +5,7 @@ LL | impl DynIncompatible for dyn DynIncompatible { }
|
|||
| ^^^^^^^^^^^^^^^^^^^ `DynIncompatible` is not dyn compatible
|
||||
|
|
||||
note: for a trait to be dyn compatible it needs to allow building a vtable
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
|
||||
--> $DIR/coherence-impl-trait-for-trait-dyn-compatible.rs:6:45
|
||||
|
|
||||
LL | trait DynIncompatible { fn eq(&self, other: Self); }
|
||||
|
|
|
@ -5,7 +5,7 @@ LL | fn foo(a: &dyn ConstParamTy_) {}
|
|||
| ^^^^^^^^^^^^^ `ConstParamTy_` is not dyn compatible
|
||||
|
|
||||
note: for a trait to be dyn compatible it needs to allow building a vtable
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
|
||||
--> $SRC_DIR/core/src/cmp.rs:LL:COL
|
||||
|
|
||||
= note: the trait is not dyn compatible because it uses `Self` as a type parameter
|
||||
|
@ -21,7 +21,7 @@ LL | fn bar(a: &dyn UnsizedConstParamTy) {}
|
|||
| ^^^^^^^^^^^^^^^^^^^ `UnsizedConstParamTy` is not dyn compatible
|
||||
|
|
||||
note: for a trait to be dyn compatible it needs to allow building a vtable
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
|
||||
--> $SRC_DIR/core/src/cmp.rs:LL:COL
|
||||
|
|
||||
= note: the trait is not dyn compatible because it uses `Self` as a type parameter
|
||||
|
|
|
@ -5,7 +5,7 @@ LL | fn use_dyn(v: &dyn Foo) {
|
|||
| ^^^^^^^ `Foo` is not dyn compatible
|
||||
|
|
||||
note: for a trait to be dyn compatible it needs to allow building a vtable
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
|
||||
--> $DIR/dyn-compatibility-err-ret.rs:8:8
|
||||
|
|
||||
LL | trait Foo {
|
||||
|
@ -24,7 +24,7 @@ LL | v.test();
|
|||
| ^^^^^^^^ `Foo` is not dyn compatible
|
||||
|
|
||||
note: for a trait to be dyn compatible it needs to allow building a vtable
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
|
||||
--> $DIR/dyn-compatibility-err-ret.rs:8:8
|
||||
|
|
||||
LL | trait Foo {
|
||||
|
|
|
@ -5,7 +5,7 @@ LL | fn use_dyn(v: &dyn Foo) {
|
|||
| ^^^^^^^ `Foo` is not dyn compatible
|
||||
|
|
||||
note: for a trait to be dyn compatible it needs to allow building a vtable
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
|
||||
--> $DIR/dyn-compatibility-err-where-bounds.rs:8:8
|
||||
|
|
||||
LL | trait Foo {
|
||||
|
@ -22,7 +22,7 @@ LL | v.test();
|
|||
| ^^^^^^^^ `Foo` is not dyn compatible
|
||||
|
|
||||
note: for a trait to be dyn compatible it needs to allow building a vtable
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
|
||||
--> $DIR/dyn-compatibility-err-where-bounds.rs:8:8
|
||||
|
|
||||
LL | trait Foo {
|
||||
|
|
|
@ -99,7 +99,7 @@ LL | fn f2<'a>(arg: Box<dyn X<Y<1> = &'a ()>>) {}
|
|||
| ^^^^^^^^^^^^^^^^^^^^ `X` is not dyn compatible
|
||||
|
|
||||
note: for a trait to be dyn compatible it needs to allow building a vtable
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
|
||||
--> $DIR/issue-102768.rs:5:10
|
||||
|
|
||||
LL | trait X {
|
||||
|
|
9
tests/ui/consts/const-slice-array-deref.rs
Normal file
9
tests/ui/consts/const-slice-array-deref.rs
Normal file
|
@ -0,0 +1,9 @@
|
|||
const ONE: [u16] = [1];
|
||||
//~^ ERROR the size for values of type `[u16]` cannot be known at compilation time
|
||||
//~| ERROR the size for values of type `[u16]` cannot be known at compilation time
|
||||
//~| ERROR mismatched types
|
||||
|
||||
const TWO: &'static u16 = &ONE[0];
|
||||
//~^ ERROR cannot move a value of type `[u16]`
|
||||
|
||||
fn main() {}
|
33
tests/ui/consts/const-slice-array-deref.stderr
Normal file
33
tests/ui/consts/const-slice-array-deref.stderr
Normal file
|
@ -0,0 +1,33 @@
|
|||
error[E0277]: the size for values of type `[u16]` cannot be known at compilation time
|
||||
--> $DIR/const-slice-array-deref.rs:1:12
|
||||
|
|
||||
LL | const ONE: [u16] = [1];
|
||||
| ^^^^^ doesn't have a size known at compile-time
|
||||
|
|
||||
= help: the trait `Sized` is not implemented for `[u16]`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/const-slice-array-deref.rs:1:20
|
||||
|
|
||||
LL | const ONE: [u16] = [1];
|
||||
| ^^^ expected `[u16]`, found `[u16; 1]`
|
||||
|
||||
error[E0277]: the size for values of type `[u16]` cannot be known at compilation time
|
||||
--> $DIR/const-slice-array-deref.rs:1:20
|
||||
|
|
||||
LL | const ONE: [u16] = [1];
|
||||
| ^^^ doesn't have a size known at compile-time
|
||||
|
|
||||
= help: the trait `Sized` is not implemented for `[u16]`
|
||||
= note: constant expressions must have a statically known size
|
||||
|
||||
error[E0161]: cannot move a value of type `[u16]`
|
||||
--> $DIR/const-slice-array-deref.rs:6:28
|
||||
|
|
||||
LL | const TWO: &'static u16 = &ONE[0];
|
||||
| ^^^ the size of `[u16]` cannot be statically determined
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0161, E0277, E0308.
|
||||
For more information about an error, try `rustc --explain E0161`.
|
|
@ -28,7 +28,7 @@ LL | let _: &Copy + 'static;
|
|||
|
|
||||
= note: the trait is not dyn compatible because it requires `Self: Sized`
|
||||
= note: for a trait to be dyn compatible it needs to allow building a vtable
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ LL | impl<T, U> Dyn for dyn Foo<T, U> + '_ {
|
|||
| ^^^^^^^^^^^^^^^^^^ `Foo` is not dyn compatible
|
||||
|
|
||||
note: for a trait to be dyn compatible it needs to allow building a vtable
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
|
||||
--> $DIR/almost-supertrait-associated-type.rs:33:34
|
||||
|
|
||||
LL | trait Foo<T, U>: Super<ActuallySuper, Assoc = T>
|
||||
|
@ -22,7 +22,7 @@ LL | (&PhantomData::<T> as &dyn Foo<T, U>).transmute(t)
|
|||
| ^^^^^^^^^^^^^^ `Foo` is not dyn compatible
|
||||
|
|
||||
note: for a trait to be dyn compatible it needs to allow building a vtable
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
|
||||
--> $DIR/almost-supertrait-associated-type.rs:33:34
|
||||
|
|
||||
LL | trait Foo<T, U>: Super<ActuallySuper, Assoc = T>
|
||||
|
@ -39,7 +39,7 @@ LL | (&PhantomData::<T> as &dyn Foo<T, U>).transmute(t)
|
|||
| ^^^^^^^^^^^^^^^^^ `Foo` is not dyn compatible
|
||||
|
|
||||
note: for a trait to be dyn compatible it needs to allow building a vtable
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
|
||||
--> $DIR/almost-supertrait-associated-type.rs:33:34
|
||||
|
|
||||
LL | trait Foo<T, U>: Super<ActuallySuper, Assoc = T>
|
||||
|
|
|
@ -5,7 +5,7 @@ LL | fn make_bar<T:Bar>(t: &T) -> &dyn Bar {
|
|||
| ^^^^^^^ `Bar` is not dyn compatible
|
||||
|
|
||||
note: for a trait to be dyn compatible it needs to allow building a vtable
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
|
||||
--> $DIR/associated-consts.rs:9:11
|
||||
|
|
||||
LL | trait Bar {
|
||||
|
@ -21,7 +21,7 @@ LL | t
|
|||
| ^ `Bar` is not dyn compatible
|
||||
|
|
||||
note: for a trait to be dyn compatible it needs to allow building a vtable
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
|
||||
--> $DIR/associated-consts.rs:9:11
|
||||
|
|
||||
LL | trait Bar {
|
||||
|
|
|
@ -5,7 +5,7 @@ LL | t
|
|||
| ^ `Bar` is not dyn compatible
|
||||
|
|
||||
note: for a trait to be dyn compatible it needs to allow building a vtable
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
|
||||
--> $DIR/associated-consts.rs:9:11
|
||||
|
|
||||
LL | trait Bar {
|
||||
|
|
|
@ -34,7 +34,7 @@ LL | fn id<F>(f: Copy) -> usize {
|
|||
|
|
||||
= note: the trait is not dyn compatible because it requires `Self: Sized`
|
||||
= note: for a trait to be dyn compatible it needs to allow building a vtable
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
|
||||
|
||||
error[E0618]: expected function, found `(dyn Copy + 'static)`
|
||||
--> $DIR/avoid-ice-on-warning-2.rs:12:5
|
||||
|
|
|
@ -72,7 +72,7 @@ LL | trait B { fn f(a: A) -> A; }
|
|||
| ^ `A` is not dyn compatible
|
||||
|
|
||||
note: for a trait to be dyn compatible it needs to allow building a vtable
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
|
||||
--> $DIR/avoid-ice-on-warning-3.rs:14:14
|
||||
|
|
||||
LL | trait A { fn g(b: B) -> B; }
|
||||
|
@ -109,7 +109,7 @@ LL | trait A { fn g(b: B) -> B; }
|
|||
| ^ `B` is not dyn compatible
|
||||
|
|
||||
note: for a trait to be dyn compatible it needs to allow building a vtable
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
|
||||
--> $DIR/avoid-ice-on-warning-3.rs:4:14
|
||||
|
|
||||
LL | trait B { fn f(a: A) -> A; }
|
||||
|
|
|
@ -23,7 +23,7 @@ LL | fn ord_prefer_dot(s: String) -> Ord {
|
|||
| ^^^ `Ord` is not dyn compatible
|
||||
|
|
||||
note: for a trait to be dyn compatible it needs to allow building a vtable
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
|
||||
--> $SRC_DIR/core/src/cmp.rs:LL:COL
|
||||
|
|
||||
= note: the trait is not dyn compatible because it uses `Self` as a type parameter
|
||||
|
|
|
@ -5,7 +5,7 @@ LL | fn f() -> Box<dyn X<U = u32>> {
|
|||
| ^^^^^^^^^^^^^^ `X` is not dyn compatible
|
||||
|
|
||||
note: for a trait to be dyn compatible it needs to allow building a vtable
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
|
||||
--> $DIR/bounds.rs:4:13
|
||||
|
|
||||
LL | trait X {
|
||||
|
|
|
@ -5,7 +5,7 @@ LL | fn take_dyn(_: &dyn Child) {}
|
|||
| ^^^^^ `Super` is not dyn compatible
|
||||
|
|
||||
note: for a trait to be dyn compatible it needs to allow building a vtable
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
|
||||
--> $DIR/gat-incompatible-supertrait.rs:10:10
|
||||
|
|
||||
LL | trait Super {
|
||||
|
|
|
@ -5,7 +5,7 @@ LL | fn make_bar<T:Bar>(t: &T) -> &dyn Bar {
|
|||
| ^^^^^^^ `Bar` is not dyn compatible
|
||||
|
|
||||
note: for a trait to be dyn compatible it needs to allow building a vtable
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
|
||||
--> $DIR/generics.rs:10:8
|
||||
|
|
||||
LL | trait Bar {
|
||||
|
@ -21,7 +21,7 @@ LL | fn make_bar_explicit<T:Bar>(t: &T) -> &dyn Bar {
|
|||
| ^^^^^^^ `Bar` is not dyn compatible
|
||||
|
|
||||
note: for a trait to be dyn compatible it needs to allow building a vtable
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
|
||||
--> $DIR/generics.rs:10:8
|
||||
|
|
||||
LL | trait Bar {
|
||||
|
@ -37,7 +37,7 @@ LL | t
|
|||
| ^ `Bar` is not dyn compatible
|
||||
|
|
||||
note: for a trait to be dyn compatible it needs to allow building a vtable
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
|
||||
--> $DIR/generics.rs:10:8
|
||||
|
|
||||
LL | trait Bar {
|
||||
|
@ -54,7 +54,7 @@ LL | t as &dyn Bar
|
|||
| ^^^^^^^^ `Bar` is not dyn compatible
|
||||
|
|
||||
note: for a trait to be dyn compatible it needs to allow building a vtable
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
|
||||
--> $DIR/generics.rs:10:8
|
||||
|
|
||||
LL | trait Bar {
|
||||
|
@ -70,7 +70,7 @@ LL | t as &dyn Bar
|
|||
| ^ `Bar` is not dyn compatible
|
||||
|
|
||||
note: for a trait to be dyn compatible it needs to allow building a vtable
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
|
||||
--> $DIR/generics.rs:10:8
|
||||
|
|
||||
LL | trait Bar {
|
||||
|
|
|
@ -5,7 +5,7 @@ LL | t
|
|||
| ^ `Bar` is not dyn compatible
|
||||
|
|
||||
note: for a trait to be dyn compatible it needs to allow building a vtable
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
|
||||
--> $DIR/generics.rs:10:8
|
||||
|
|
||||
LL | trait Bar {
|
||||
|
@ -22,7 +22,7 @@ LL | t as &dyn Bar
|
|||
| ^ `Bar` is not dyn compatible
|
||||
|
|
||||
note: for a trait to be dyn compatible it needs to allow building a vtable
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
|
||||
--> $DIR/generics.rs:10:8
|
||||
|
|
||||
LL | trait Bar {
|
||||
|
|
|
@ -5,7 +5,7 @@ LL | let test: &mut dyn Bar = &mut thing;
|
|||
| ^^^^^^^^^^^^ `Bar` is not dyn compatible
|
||||
|
|
||||
note: for a trait to be dyn compatible it needs to allow building a vtable
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
|
||||
--> $DIR/mention-correct-dyn-incompatible-trait.rs:4:8
|
||||
|
|
||||
LL | fn foo<T>(&self, val: T);
|
||||
|
@ -23,7 +23,7 @@ LL | let test: &mut dyn Bar = &mut thing;
|
|||
| ^^^^^^^^^^ `Bar` is not dyn compatible
|
||||
|
|
||||
note: for a trait to be dyn compatible it needs to allow building a vtable
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
|
||||
--> $DIR/mention-correct-dyn-incompatible-trait.rs:4:8
|
||||
|
|
||||
LL | fn foo<T>(&self, val: T);
|
||||
|
|
|
@ -5,7 +5,7 @@ LL | elements: Vec<Box<dyn Expr + 'x>>,
|
|||
| ^^^^ `Expr` is not dyn compatible
|
||||
|
|
||||
note: for a trait to be dyn compatible it needs to allow building a vtable
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
|
||||
--> $DIR/mentions-Self-in-super-predicates.rs:5:21
|
||||
|
|
||||
LL | trait Expr: Debug + PartialEq {
|
||||
|
@ -20,7 +20,7 @@ LL | let a: Box<dyn Expr> = Box::new(SExpr::new());
|
|||
| ^^^^ `Expr` is not dyn compatible
|
||||
|
|
||||
note: for a trait to be dyn compatible it needs to allow building a vtable
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
|
||||
--> $DIR/mentions-Self-in-super-predicates.rs:5:21
|
||||
|
|
||||
LL | trait Expr: Debug + PartialEq {
|
||||
|
@ -35,7 +35,7 @@ LL | let b: Box<dyn Expr> = Box::new(SExpr::new());
|
|||
| ^^^^ `Expr` is not dyn compatible
|
||||
|
|
||||
note: for a trait to be dyn compatible it needs to allow building a vtable
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
|
||||
--> $DIR/mentions-Self-in-super-predicates.rs:5:21
|
||||
|
|
||||
LL | trait Expr: Debug + PartialEq {
|
||||
|
|
|
@ -5,7 +5,7 @@ LL | fn make_bar<T:Bar>(t: &T) -> &dyn Bar {
|
|||
| ^^^^^^^ `Bar` is not dyn compatible
|
||||
|
|
||||
note: for a trait to be dyn compatible it needs to allow building a vtable
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
|
||||
--> $DIR/mentions-Self.rs:11:22
|
||||
|
|
||||
LL | trait Bar {
|
||||
|
@ -21,7 +21,7 @@ LL | fn make_baz<T:Baz>(t: &T) -> &dyn Baz {
|
|||
| ^^^^^^^ `Baz` is not dyn compatible
|
||||
|
|
||||
note: for a trait to be dyn compatible it needs to allow building a vtable
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
|
||||
--> $DIR/mentions-Self.rs:15:22
|
||||
|
|
||||
LL | trait Baz {
|
||||
|
@ -37,7 +37,7 @@ LL | t
|
|||
| ^ `Bar` is not dyn compatible
|
||||
|
|
||||
note: for a trait to be dyn compatible it needs to allow building a vtable
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
|
||||
--> $DIR/mentions-Self.rs:11:22
|
||||
|
|
||||
LL | trait Bar {
|
||||
|
@ -54,7 +54,7 @@ LL | t
|
|||
| ^ `Baz` is not dyn compatible
|
||||
|
|
||||
note: for a trait to be dyn compatible it needs to allow building a vtable
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
|
||||
--> $DIR/mentions-Self.rs:15:22
|
||||
|
|
||||
LL | trait Baz {
|
||||
|
|
|
@ -5,7 +5,7 @@ LL | t
|
|||
| ^ `Bar` is not dyn compatible
|
||||
|
|
||||
note: for a trait to be dyn compatible it needs to allow building a vtable
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
|
||||
--> $DIR/mentions-Self.rs:11:22
|
||||
|
|
||||
LL | trait Bar {
|
||||
|
@ -22,7 +22,7 @@ LL | t
|
|||
| ^ `Baz` is not dyn compatible
|
||||
|
|
||||
note: for a trait to be dyn compatible it needs to allow building a vtable
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
|
||||
--> $DIR/mentions-Self.rs:15:22
|
||||
|
|
||||
LL | trait Baz {
|
||||
|
|
|
@ -5,7 +5,7 @@ LL | fn bar(x: &dyn Foo) {}
|
|||
| ^^^ `Foo` is not dyn compatible
|
||||
|
|
||||
note: for a trait to be dyn compatible it needs to allow building a vtable
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
|
||||
--> $DIR/missing-assoc-type.rs:2:10
|
||||
|
|
||||
LL | trait Foo {
|
||||
|
|
|
@ -5,7 +5,7 @@ LL | fn diverges() -> Box<dyn Foo> {
|
|||
| ^^^^^^^ `Foo` is not dyn compatible
|
||||
|
|
||||
note: for a trait to be dyn compatible it needs to allow building a vtable
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
|
||||
--> $DIR/no-static.rs:9:8
|
||||
|
|
||||
LL | trait Foo {
|
||||
|
@ -29,7 +29,7 @@ LL | let b: Box<dyn Foo> = Box::new(Bar);
|
|||
| ^^^^^^^^^^^^ `Foo` is not dyn compatible
|
||||
|
|
||||
note: for a trait to be dyn compatible it needs to allow building a vtable
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
|
||||
--> $DIR/no-static.rs:9:8
|
||||
|
|
||||
LL | trait Foo {
|
||||
|
@ -53,7 +53,7 @@ LL | let b: Box<dyn Foo> = Box::new(Bar);
|
|||
| ^^^^^^^^^^^^^ `Foo` is not dyn compatible
|
||||
|
|
||||
note: for a trait to be dyn compatible it needs to allow building a vtable
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
|
||||
--> $DIR/no-static.rs:9:8
|
||||
|
|
||||
LL | trait Foo {
|
||||
|
|
|
@ -5,7 +5,7 @@ LL | let b: Box<dyn Foo> = Box::new(Bar);
|
|||
| ^^^^^^^^^^^^^ `Foo` is not dyn compatible
|
||||
|
|
||||
note: for a trait to be dyn compatible it needs to allow building a vtable
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
|
||||
--> $DIR/no-static.rs:9:8
|
||||
|
|
||||
LL | trait Foo {
|
||||
|
|
|
@ -5,7 +5,7 @@ LL | fn make_bar<T:Bar>(t: &T) -> &dyn Bar {
|
|||
| ^^^^^^^ `Bar` is not dyn compatible
|
||||
|
|
||||
note: for a trait to be dyn compatible it needs to allow building a vtable
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
|
||||
--> $DIR/sized-2.rs:9:18
|
||||
|
|
||||
LL | trait Bar
|
||||
|
@ -20,7 +20,7 @@ LL | t
|
|||
| ^ `Bar` is not dyn compatible
|
||||
|
|
||||
note: for a trait to be dyn compatible it needs to allow building a vtable
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
|
||||
--> $DIR/sized-2.rs:9:18
|
||||
|
|
||||
LL | trait Bar
|
||||
|
|
|
@ -5,7 +5,7 @@ LL | t
|
|||
| ^ `Bar` is not dyn compatible
|
||||
|
|
||||
note: for a trait to be dyn compatible it needs to allow building a vtable
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
|
||||
--> $DIR/sized-2.rs:9:18
|
||||
|
|
||||
LL | trait Bar
|
||||
|
|
|
@ -5,7 +5,7 @@ LL | fn make_bar<T: Bar>(t: &T) -> &dyn Bar {
|
|||
| ^^^^^^^ `Bar` is not dyn compatible
|
||||
|
|
||||
note: for a trait to be dyn compatible it needs to allow building a vtable
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
|
||||
--> $DIR/sized.rs:8:12
|
||||
|
|
||||
LL | trait Bar: Sized {
|
||||
|
@ -20,7 +20,7 @@ LL | t
|
|||
| ^ `Bar` is not dyn compatible
|
||||
|
|
||||
note: for a trait to be dyn compatible it needs to allow building a vtable
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
|
||||
--> $DIR/sized.rs:8:12
|
||||
|
|
||||
LL | trait Bar: Sized {
|
||||
|
|
|
@ -5,7 +5,7 @@ LL | t
|
|||
| ^ `Bar` is not dyn compatible
|
||||
|
|
||||
note: for a trait to be dyn compatible it needs to allow building a vtable
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
|
||||
--> $DIR/sized.rs:8:12
|
||||
|
|
||||
LL | trait Bar: Sized {
|
||||
|
|
|
@ -27,7 +27,7 @@ LL | fn c(&self) -> dyn SuperTrait<T>;
|
|||
| ^^^^^^^^^^^^^^^^^ `SuperTrait` is not dyn compatible
|
||||
|
|
||||
note: for a trait to be dyn compatible it needs to allow building a vtable
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
|
||||
--> $DIR/supertrait-mentions-GAT.rs:4:10
|
||||
|
|
||||
LL | type Gat<'a>
|
||||
|
|
|
@ -25,7 +25,7 @@ LL | fn make_baz<T:Baz>(t: &T) -> &dyn Baz {
|
|||
| ^^^ `Baz` is not dyn compatible
|
||||
|
|
||||
note: for a trait to be dyn compatible it needs to allow building a vtable
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
|
||||
--> $DIR/supertrait-mentions-Self.rs:8:13
|
||||
|
|
||||
LL | trait Baz : Bar<Self> {
|
||||
|
|
|
@ -5,7 +5,7 @@ LL | static FOO: &(dyn Qux + Sync) = "desc";
|
|||
| ^^^^^^^^^^^^^^ `Qux` is not dyn compatible
|
||||
|
|
||||
note: for a trait to be dyn compatible it needs to allow building a vtable
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
|
||||
--> $DIR/taint-const-eval.rs:8:8
|
||||
|
|
||||
LL | trait Qux {
|
||||
|
@ -28,7 +28,7 @@ LL | static FOO: &(dyn Qux + Sync) = "desc";
|
|||
| ^^^^^^ `Qux` is not dyn compatible
|
||||
|
|
||||
note: for a trait to be dyn compatible it needs to allow building a vtable
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
|
||||
--> $DIR/taint-const-eval.rs:8:8
|
||||
|
|
||||
LL | trait Qux {
|
||||
|
@ -52,7 +52,7 @@ LL | static FOO: &(dyn Qux + Sync) = "desc";
|
|||
| ^^^^^^^^^^^^^^ `Qux` is not dyn compatible
|
||||
|
|
||||
note: for a trait to be dyn compatible it needs to allow building a vtable
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
|
||||
--> $DIR/taint-const-eval.rs:8:8
|
||||
|
|
||||
LL | trait Qux {
|
||||
|
|
|
@ -5,7 +5,7 @@ LL | static FOO: &(dyn Qux + Sync) = "desc";
|
|||
| ^^^^^^ `Qux` is not dyn compatible
|
||||
|
|
||||
note: for a trait to be dyn compatible it needs to allow building a vtable
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
|
||||
--> $DIR/taint-const-eval.rs:8:8
|
||||
|
|
||||
LL | trait Qux {
|
||||
|
|
|
@ -8,7 +8,7 @@ LL | fn fetcher() -> Box<dyn Fetcher> {
|
|||
| ^^^^^^^^^^^ `Fetcher` is not dyn compatible
|
||||
|
|
||||
note: for a trait to be dyn compatible it needs to allow building a vtable
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
|
||||
--> $DIR/undispatchable-receiver-and-wc-references-Self.rs:11:22
|
||||
|
|
||||
LL | pub trait Fetcher: Send + Sync {
|
||||
|
@ -26,7 +26,7 @@ LL | let fetcher = fetcher();
|
|||
| ^^^^^^^^^ `Fetcher` is not dyn compatible
|
||||
|
|
||||
note: for a trait to be dyn compatible it needs to allow building a vtable
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
|
||||
--> $DIR/undispatchable-receiver-and-wc-references-Self.rs:11:22
|
||||
|
|
||||
LL | pub trait Fetcher: Send + Sync {
|
||||
|
@ -44,7 +44,7 @@ LL | let _ = fetcher.get();
|
|||
| ^^^^^^^^^^^^^ `Fetcher` is not dyn compatible
|
||||
|
|
||||
note: for a trait to be dyn compatible it needs to allow building a vtable
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
|
||||
--> $DIR/undispatchable-receiver-and-wc-references-Self.rs:11:22
|
||||
|
|
||||
LL | pub trait Fetcher: Send + Sync {
|
||||
|
|
|
@ -5,7 +5,7 @@ LL | fn call_foo(x: Box<dyn Trait>) {
|
|||
| ^^^^^^^^^ `Trait` is not dyn compatible
|
||||
|
|
||||
note: for a trait to be dyn compatible it needs to allow building a vtable
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
|
||||
--> $DIR/E0038.rs:2:22
|
||||
|
|
||||
LL | trait Trait {
|
||||
|
@ -21,7 +21,7 @@ LL | let y = x.foo();
|
|||
| ^^^^^^^ `Trait` is not dyn compatible
|
||||
|
|
||||
note: for a trait to be dyn compatible it needs to allow building a vtable
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
|
||||
--> $DIR/E0038.rs:2:22
|
||||
|
|
||||
LL | trait Trait {
|
||||
|
|
|
@ -5,7 +5,7 @@ LL | async fn takes_dyn_trait(x: &dyn Foo) {
|
|||
| ^^^^^^^ `Foo` is not dyn compatible
|
||||
|
|
||||
note: for a trait to be dyn compatible it needs to allow building a vtable
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
|
||||
--> $DIR/feature-gate-async-fn-in-dyn-trait.rs:4:14
|
||||
|
|
||||
LL | trait Foo {
|
||||
|
@ -21,7 +21,7 @@ LL | x.bar().await;
|
|||
| ^^^ `Foo` is not dyn compatible
|
||||
|
|
||||
note: for a trait to be dyn compatible it needs to allow building a vtable
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
|
||||
--> $DIR/feature-gate-async-fn-in-dyn-trait.rs:4:14
|
||||
|
|
||||
LL | trait Foo {
|
||||
|
@ -37,7 +37,7 @@ LL | x.bar().await;
|
|||
| ^^^^^^^ `Foo` is not dyn compatible
|
||||
|
|
||||
note: for a trait to be dyn compatible it needs to allow building a vtable
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
|
||||
--> $DIR/feature-gate-async-fn-in-dyn-trait.rs:4:14
|
||||
|
|
||||
LL | trait Foo {
|
||||
|
|
|
@ -8,7 +8,7 @@ LL | Ptr(Box::new(4)) as Ptr<dyn Trait>;
|
|||
| ^^^^^^^^^^^^^^ `Trait` is not dyn compatible
|
||||
|
|
||||
note: for a trait to be dyn compatible it needs to allow building a vtable
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
|
||||
--> $DIR/feature-gate-dispatch-from-dyn-missing-impl.rs:25:18
|
||||
|
|
||||
LL | trait Trait {
|
||||
|
@ -27,7 +27,7 @@ LL | Ptr(Box::new(4)) as Ptr<dyn Trait>;
|
|||
| ^^^^^^^^^^^^^^^^ `Trait` is not dyn compatible
|
||||
|
|
||||
note: for a trait to be dyn compatible it needs to allow building a vtable
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
|
||||
--> $DIR/feature-gate-dispatch-from-dyn-missing-impl.rs:25:18
|
||||
|
|
||||
LL | trait Trait {
|
||||
|
|
|
@ -5,7 +5,7 @@ LL | fn takes_dyn_incompatible_ref<T>(obj: &dyn DynIncompatible1) {
|
|||
| ^^^^^^^^^^^^^^^^^^^^ `DynIncompatible1` is not dyn compatible
|
||||
|
|
||||
note: for a trait to be dyn compatible it needs to allow building a vtable
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
|
||||
--> $DIR/feature-gate-dyn_compatible_for_dispatch.rs:4:25
|
||||
|
|
||||
LL | trait DynIncompatible1: Sized {}
|
||||
|
@ -20,7 +20,7 @@ LL | fn return_dyn_incompatible_ref() -> &'static dyn DynIncompatible2 {
|
|||
| ^^^^^^^^^^^^^^^^^^^^ `DynIncompatible2` is not dyn compatible
|
||||
|
|
||||
note: for a trait to be dyn compatible it needs to allow building a vtable
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
|
||||
--> $DIR/feature-gate-dyn_compatible_for_dispatch.rs:7:8
|
||||
|
|
||||
LL | trait DynIncompatible2 {
|
||||
|
@ -43,7 +43,7 @@ LL | fn takes_dyn_incompatible_box(obj: Box<dyn DynIncompatible3>) {
|
|||
| ^^^^^^^^^^^^^^^^^^^^ `DynIncompatible3` is not dyn compatible
|
||||
|
|
||||
note: for a trait to be dyn compatible it needs to allow building a vtable
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
|
||||
--> $DIR/feature-gate-dyn_compatible_for_dispatch.rs:11:8
|
||||
|
|
||||
LL | trait DynIncompatible3 {
|
||||
|
@ -59,7 +59,7 @@ LL | fn return_dyn_incompatible_rc() -> std::rc::Rc<dyn DynIncompatible4> {
|
|||
| ^^^^^^^^^^^^^^^^^^^^ `DynIncompatible4` is not dyn compatible
|
||||
|
|
||||
note: for a trait to be dyn compatible it needs to allow building a vtable
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
|
||||
--> $DIR/feature-gate-dyn_compatible_for_dispatch.rs:15:22
|
||||
|
|
||||
LL | trait DynIncompatible4 {
|
||||
|
@ -75,7 +75,7 @@ LL | impl Trait for dyn DynIncompatible1 {}
|
|||
| ^^^^^^^^^^^^^^^^^^^^ `DynIncompatible1` is not dyn compatible
|
||||
|
|
||||
note: for a trait to be dyn compatible it needs to allow building a vtable
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
|
||||
--> $DIR/feature-gate-dyn_compatible_for_dispatch.rs:4:25
|
||||
|
|
||||
LL | trait DynIncompatible1: Sized {}
|
||||
|
|
|
@ -43,7 +43,7 @@ LL | fn _f(arg : Box<dyn for<'a> X<Y<'x> = &'a [u32]>>) {}
|
|||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `X` is not dyn compatible
|
||||
|
|
||||
note: for a trait to be dyn compatible it needs to allow building a vtable
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
|
||||
--> $DIR/gat-in-trait-path-undeclared-lifetime.rs:2:8
|
||||
|
|
||||
LL | trait X {
|
||||
|
|
|
@ -5,7 +5,7 @@ LL | fn f(_arg : Box<dyn for<'a> Foo<A<'a> = &'a ()>>) {}
|
|||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `Foo` is not dyn compatible
|
||||
|
|
||||
note: for a trait to be dyn compatible it needs to allow building a vtable
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
|
||||
--> $DIR/gat-in-trait-path.rs:6:10
|
||||
|
|
||||
LL | trait Foo {
|
||||
|
@ -21,7 +21,7 @@ LL | f(Box::new(foo));
|
|||
| ^^^^^^^^^^^^^ `Foo` is not dyn compatible
|
||||
|
|
||||
note: for a trait to be dyn compatible it needs to allow building a vtable
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
|
||||
--> $DIR/gat-in-trait-path.rs:6:10
|
||||
|
|
||||
LL | trait Foo {
|
||||
|
@ -37,7 +37,7 @@ LL | f(Box::new(foo));
|
|||
| ^^^^^^^^^^^^^ `Foo` is not dyn compatible
|
||||
|
|
||||
note: for a trait to be dyn compatible it needs to allow building a vtable
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
|
||||
--> $DIR/gat-in-trait-path.rs:6:10
|
||||
|
|
||||
LL | trait Foo {
|
||||
|
|
|
@ -130,7 +130,7 @@ LL | fn foo<'a>(arg: Box<dyn X<Y('a) = &'a ()>>) {}
|
|||
| ^^^^^^^^^^^^^^^^^^^^^ `X` is not dyn compatible
|
||||
|
|
||||
note: for a trait to be dyn compatible it needs to allow building a vtable
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
|
||||
--> $DIR/gat-trait-path-parenthesised-args.rs:2:8
|
||||
|
|
||||
LL | trait X {
|
||||
|
@ -196,7 +196,7 @@ LL | fn bar<'a>(arg: Box<dyn X<Y() = ()>>) {}
|
|||
| ^^^^^^^^^^^^^^^ `X` is not dyn compatible
|
||||
|
|
||||
note: for a trait to be dyn compatible it needs to allow building a vtable
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
|
||||
--> $DIR/gat-trait-path-parenthesised-args.rs:2:8
|
||||
|
|
||||
LL | trait X {
|
||||
|
|
|
@ -5,7 +5,7 @@ LL | fn _func1<'a>(_x: Box<dyn X<Y<'a>=&'a ()>>) {}
|
|||
| ^^^^^^^^^^^^^^^^^^^ `X` is not dyn compatible
|
||||
|
|
||||
note: for a trait to be dyn compatible it needs to allow building a vtable
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
|
||||
--> $DIR/issue-67510-pass.rs:4:10
|
||||
|
|
||||
LL | trait X {
|
||||
|
|
|
@ -36,7 +36,7 @@ LL | fn f(x: Box<dyn X<Y<'a> = &'a ()>>) {}
|
|||
| ^^^^^^^^^^^^^^^^^^^^^ `X` is not dyn compatible
|
||||
|
|
||||
note: for a trait to be dyn compatible it needs to allow building a vtable
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
|
||||
--> $DIR/issue-67510.rs:2:10
|
||||
|
|
||||
LL | trait X {
|
||||
|
|
|
@ -55,7 +55,7 @@ LL | inner: Box<dyn Provider<A = B>>,
|
|||
| ^^^^^^^^^^^^^^^^^^^ `Provider` is not dyn compatible
|
||||
|
|
||||
note: for a trait to be dyn compatible it needs to allow building a vtable
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
|
||||
--> $DIR/issue-71176.rs:2:10
|
||||
|
|
||||
LL | trait Provider {
|
||||
|
@ -72,7 +72,7 @@ LL | inner: Box::new(()),
|
|||
| ^^^^^^^^^^^^ `Provider` is not dyn compatible
|
||||
|
|
||||
note: for a trait to be dyn compatible it needs to allow building a vtable
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
|
||||
--> $DIR/issue-71176.rs:2:10
|
||||
|
|
||||
LL | trait Provider {
|
||||
|
@ -89,7 +89,7 @@ LL | inner: Box::new(()),
|
|||
| ^^^^^^^^^^^^ `Provider` is not dyn compatible
|
||||
|
|
||||
note: for a trait to be dyn compatible it needs to allow building a vtable
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
|
||||
--> $DIR/issue-71176.rs:2:10
|
||||
|
|
||||
LL | trait Provider {
|
||||
|
|
|
@ -21,7 +21,7 @@ LL | let sub: Box<dyn SuperTrait<SubType = SubStruct>> = Box::new(SuperStruc
|
|||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `SuperTrait` is not dyn compatible
|
||||
|
|
||||
note: for a trait to be dyn compatible it needs to allow building a vtable
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
|
||||
--> $DIR/issue-76535.rs:4:10
|
||||
|
|
||||
LL | pub trait SuperTrait {
|
||||
|
@ -39,7 +39,7 @@ LL | let sub: Box<dyn SuperTrait<SubType = SubStruct>> = Box::new(SuperStruc
|
|||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `SuperTrait` is not dyn compatible
|
||||
|
|
||||
note: for a trait to be dyn compatible it needs to allow building a vtable
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
|
||||
--> $DIR/issue-76535.rs:4:10
|
||||
|
|
||||
LL | pub trait SuperTrait {
|
||||
|
|
|
@ -21,7 +21,7 @@ LL | Box::new(Family) as &dyn CollectionFamily<Member=usize>
|
|||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `CollectionFamily` is not dyn compatible
|
||||
|
|
||||
note: for a trait to be dyn compatible it needs to allow building a vtable
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
|
||||
--> $DIR/issue-78671.rs:2:10
|
||||
|
|
||||
LL | trait CollectionFamily {
|
||||
|
|
|
@ -21,7 +21,7 @@ LL | as Box<dyn MapLike<u8, u8, VRefCont = dyn RefCont<'_, u8>>>;
|
|||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `MapLike` is not dyn compatible
|
||||
|
|
||||
note: for a trait to be dyn compatible it needs to allow building a vtable
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
|
||||
--> $DIR/issue-79422.rs:18:10
|
||||
|
|
||||
LL | trait MapLike<K, V> {
|
||||
|
@ -37,7 +37,7 @@ LL | let m = Box::new(std::collections::BTreeMap::<u8, u8>::new())
|
|||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `MapLike` is not dyn compatible
|
||||
|
|
||||
note: for a trait to be dyn compatible it needs to allow building a vtable
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
|
||||
--> $DIR/issue-79422.rs:18:10
|
||||
|
|
||||
LL | trait MapLike<K, V> {
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue