mirror of
https://github.com/rust-lang/rust.git
synced 2025-09-27 04:31:18 +00:00
Auto merge of #147074 - matthiaskrgr:rollup-sm3owsd, r=matthiaskrgr
Rollup of 10 pull requests Successful merges: - rust-lang/rust#145113 (resolve: Do not finalize shadowed bindings) - rust-lang/rust#146523 (Demote both armebv7r-none-* targets.) - rust-lang/rust#146704 (port `#[debugger_visualizer]` to the new attribute system) - rust-lang/rust#146758 (Stop linking rs{begin,end} objects on x86_64-*-windows-gnu) - rust-lang/rust#146778 (Use standard attribute logic for allocator shim) - rust-lang/rust#146849 (Reduce some uses of `LegacyBang`) - rust-lang/rust#147016 (fix doc comments to be more standard) - rust-lang/rust#147027 (Add new `tyalias` intra-doc link disambiguator) - rust-lang/rust#147031 (mbe: Simplify check_redundant_vis_repetition) - rust-lang/rust#147058 (Ignore more failing ui tests for GCC backend) Failed merges: - rust-lang/rust#147046 (Rename `rust.use-lld` to `rust.bootstrap-override-lld`) r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
commit
ec373938d6
60
compiler/rustc_attr_parsing/src/attributes/debugger.rs
Normal file
60
compiler/rustc_attr_parsing/src/attributes/debugger.rs
Normal file
@ -0,0 +1,60 @@
|
||||
use rustc_hir::attrs::{DebugVisualizer, DebuggerVisualizerType};
|
||||
|
||||
use super::prelude::*;
|
||||
|
||||
pub(crate) struct DebuggerViualizerParser;
|
||||
|
||||
impl<S: Stage> CombineAttributeParser<S> for DebuggerViualizerParser {
|
||||
const PATH: &[Symbol] = &[sym::debugger_visualizer];
|
||||
const ALLOWED_TARGETS: AllowedTargets =
|
||||
AllowedTargets::AllowList(&[Allow(Target::Mod), Allow(Target::Crate)]);
|
||||
const TEMPLATE: AttributeTemplate = template!(
|
||||
List: &[r#"natvis_file = "...", gdb_script_file = "...""#],
|
||||
"https://doc.rust-lang.org/reference/attributes/debugger.html#the-debugger_visualizer-attribute"
|
||||
);
|
||||
|
||||
type Item = DebugVisualizer;
|
||||
const CONVERT: ConvertFn<Self::Item> = |v, _| AttributeKind::DebuggerVisualizer(v);
|
||||
|
||||
fn extend<'c>(
|
||||
cx: &'c mut AcceptContext<'_, '_, S>,
|
||||
args: &'c ArgParser<'_>,
|
||||
) -> impl IntoIterator<Item = Self::Item> + 'c {
|
||||
let Some(l) = args.list() else {
|
||||
cx.expected_list(args.span().unwrap_or(cx.attr_span));
|
||||
return None;
|
||||
};
|
||||
let Some(single) = l.single() else {
|
||||
cx.expected_single_argument(l.span);
|
||||
return None;
|
||||
};
|
||||
let Some(mi) = single.meta_item() else {
|
||||
cx.expected_name_value(single.span(), None);
|
||||
return None;
|
||||
};
|
||||
let path = mi.path().word_sym();
|
||||
let visualizer_type = match path {
|
||||
Some(sym::natvis_file) => DebuggerVisualizerType::Natvis,
|
||||
Some(sym::gdb_script_file) => DebuggerVisualizerType::GdbPrettyPrinter,
|
||||
_ => {
|
||||
cx.expected_specific_argument(
|
||||
mi.path().span(),
|
||||
&[sym::natvis_file, sym::gdb_script_file],
|
||||
);
|
||||
return None;
|
||||
}
|
||||
};
|
||||
|
||||
let Some(path) = mi.args().name_value() else {
|
||||
cx.expected_name_value(single.span(), path);
|
||||
return None;
|
||||
};
|
||||
|
||||
let Some(path) = path.value_as_str() else {
|
||||
cx.expected_string_literal(path.value_span, Some(path.value_as_lit()));
|
||||
return None;
|
||||
};
|
||||
|
||||
Some(DebugVisualizer { span: mi.span(), visualizer_type, path })
|
||||
}
|
||||
}
|
@ -36,6 +36,7 @@ pub(crate) mod cfg_old;
|
||||
pub(crate) mod codegen_attrs;
|
||||
pub(crate) mod confusables;
|
||||
pub(crate) mod crate_level;
|
||||
pub(crate) mod debugger;
|
||||
pub(crate) mod deprecation;
|
||||
pub(crate) mod dummy;
|
||||
pub(crate) mod inline;
|
||||
|
@ -28,6 +28,7 @@ use crate::attributes::crate_level::{
|
||||
CrateNameParser, MoveSizeLimitParser, NoCoreParser, NoStdParser, PatternComplexityLimitParser,
|
||||
RecursionLimitParser, RustcCoherenceIsCoreParser, TypeLengthLimitParser,
|
||||
};
|
||||
use crate::attributes::debugger::DebuggerViualizerParser;
|
||||
use crate::attributes::deprecation::DeprecationParser;
|
||||
use crate::attributes::dummy::DummyParser;
|
||||
use crate::attributes::inline::{InlineParser, RustcForceInlineParser};
|
||||
@ -163,6 +164,7 @@ attribute_parsers!(
|
||||
// tidy-alphabetical-start
|
||||
Combine<AllowConstFnUnstableParser>,
|
||||
Combine<AllowInternalUnstableParser>,
|
||||
Combine<DebuggerViualizerParser>,
|
||||
Combine<ForceTargetFeatureParser>,
|
||||
Combine<LinkParser>,
|
||||
Combine<ReprParser>,
|
||||
|
@ -538,7 +538,13 @@ impl<'ll, 'tcx> FnAbiLlvmExt<'ll, 'tcx> for FnAbi<'tcx, Ty<'tcx>> {
|
||||
|
||||
// If the declaration has an associated instance, compute extra attributes based on that.
|
||||
if let Some(instance) = instance {
|
||||
llfn_attrs_from_instance(cx, llfn, instance);
|
||||
llfn_attrs_from_instance(
|
||||
cx,
|
||||
cx.tcx,
|
||||
llfn,
|
||||
&cx.tcx.codegen_instance_attrs(instance.def),
|
||||
Some(instance),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5,15 +5,16 @@ use rustc_ast::expand::allocator::{
|
||||
};
|
||||
use rustc_codegen_ssa::traits::BaseTypeCodegenMethods as _;
|
||||
use rustc_middle::bug;
|
||||
use rustc_middle::middle::codegen_fn_attrs::CodegenFnAttrs;
|
||||
use rustc_middle::ty::TyCtxt;
|
||||
use rustc_session::config::{DebugInfo, OomStrategy};
|
||||
use rustc_symbol_mangling::mangle_internal_symbol;
|
||||
use smallvec::SmallVec;
|
||||
|
||||
use crate::attributes::llfn_attrs_from_instance;
|
||||
use crate::builder::SBuilder;
|
||||
use crate::declare::declare_simple_fn;
|
||||
use crate::llvm::{self, FALSE, TRUE, Type, Value};
|
||||
use crate::{SimpleCx, attributes, debuginfo, llvm_util};
|
||||
use crate::{SimpleCx, attributes, debuginfo};
|
||||
|
||||
pub(crate) unsafe fn codegen(
|
||||
tcx: TyCtxt<'_>,
|
||||
@ -149,18 +150,8 @@ fn create_wrapper_function(
|
||||
ty,
|
||||
);
|
||||
|
||||
let mut attrs = SmallVec::<[_; 2]>::new();
|
||||
|
||||
let target_cpu = llvm_util::target_cpu(tcx.sess);
|
||||
let target_cpu_attr = llvm::CreateAttrStringValue(cx.llcx, "target-cpu", target_cpu);
|
||||
|
||||
let tune_cpu_attr = llvm_util::tune_cpu(tcx.sess)
|
||||
.map(|tune_cpu| llvm::CreateAttrStringValue(cx.llcx, "tune-cpu", tune_cpu));
|
||||
|
||||
attrs.push(target_cpu_attr);
|
||||
attrs.extend(tune_cpu_attr);
|
||||
|
||||
attributes::apply_to_llfn(llfn, llvm::AttributePlace::Function, &attrs);
|
||||
let attrs = CodegenFnAttrs::new();
|
||||
llfn_attrs_from_instance(cx, tcx, llfn, &attrs, None);
|
||||
|
||||
let no_return = if no_return {
|
||||
// -> ! DIFlagNoReturn
|
||||
@ -171,12 +162,6 @@ fn create_wrapper_function(
|
||||
None
|
||||
};
|
||||
|
||||
if tcx.sess.must_emit_unwind_tables() {
|
||||
let uwtable =
|
||||
attributes::uwtable_attr(cx.llcx, tcx.sess.opts.unstable_opts.use_sync_unwind);
|
||||
attributes::apply_to_llfn(llfn, llvm::AttributePlace::Function, &[uwtable]);
|
||||
}
|
||||
|
||||
let llbb = unsafe { llvm::LLVMAppendBasicBlockInContext(cx.llcx, llfn, c"entry".as_ptr()) };
|
||||
let mut bx = SBuilder::build(&cx, llbb);
|
||||
|
||||
|
@ -1,20 +1,21 @@
|
||||
//! Set and unset common attributes on LLVM values.
|
||||
use rustc_codegen_ssa::traits::*;
|
||||
use rustc_hir::attrs::{InlineAttr, InstructionSetAttr, OptimizeAttr};
|
||||
use rustc_hir::def_id::DefId;
|
||||
use rustc_middle::middle::codegen_fn_attrs::{CodegenFnAttrFlags, PatchableFunctionEntry};
|
||||
use rustc_middle::middle::codegen_fn_attrs::{
|
||||
CodegenFnAttrFlags, CodegenFnAttrs, PatchableFunctionEntry,
|
||||
};
|
||||
use rustc_middle::ty::{self, TyCtxt};
|
||||
use rustc_session::config::{BranchProtection, FunctionReturn, OptLevel, PAuthKey, PacRet};
|
||||
use rustc_symbol_mangling::mangle_internal_symbol;
|
||||
use rustc_target::spec::{FramePointer, SanitizerSet, StackProbeType, StackProtector};
|
||||
use smallvec::SmallVec;
|
||||
|
||||
use crate::context::CodegenCx;
|
||||
use crate::context::SimpleCx;
|
||||
use crate::errors::SanitizerMemtagRequiresMte;
|
||||
use crate::llvm::AttributePlace::Function;
|
||||
use crate::llvm::{self, AllocKindFlags, Attribute, AttributeKind, AttributePlace, MemoryEffects};
|
||||
use crate::value::Value;
|
||||
use crate::{attributes, llvm_util};
|
||||
use crate::{Session, attributes, llvm_util};
|
||||
|
||||
pub(crate) fn apply_to_llfn(llfn: &Value, idx: AttributePlace, attrs: &[&Attribute]) {
|
||||
if !attrs.is_empty() {
|
||||
@ -30,18 +31,19 @@ pub(crate) fn apply_to_callsite(callsite: &Value, idx: AttributePlace, attrs: &[
|
||||
|
||||
/// Get LLVM attribute for the provided inline heuristic.
|
||||
pub(crate) fn inline_attr<'ll, 'tcx>(
|
||||
cx: &CodegenCx<'ll, 'tcx>,
|
||||
cx: &SimpleCx<'ll>,
|
||||
tcx: TyCtxt<'tcx>,
|
||||
instance: ty::Instance<'tcx>,
|
||||
) -> Option<&'ll Attribute> {
|
||||
// `optnone` requires `noinline`
|
||||
let codegen_fn_attrs = cx.tcx.codegen_fn_attrs(instance.def_id());
|
||||
let codegen_fn_attrs = tcx.codegen_fn_attrs(instance.def_id());
|
||||
let inline = match (codegen_fn_attrs.inline, &codegen_fn_attrs.optimize) {
|
||||
(_, OptimizeAttr::DoNotOptimize) => InlineAttr::Never,
|
||||
(InlineAttr::None, _) if instance.def.requires_inline(cx.tcx) => InlineAttr::Hint,
|
||||
(InlineAttr::None, _) if instance.def.requires_inline(tcx) => InlineAttr::Hint,
|
||||
(inline, _) => inline,
|
||||
};
|
||||
|
||||
if !cx.tcx.sess.opts.unstable_opts.inline_llvm {
|
||||
if !tcx.sess.opts.unstable_opts.inline_llvm {
|
||||
// disable LLVM inlining
|
||||
return Some(AttributeKind::NoInline.create_attr(cx.llcx));
|
||||
}
|
||||
@ -51,7 +53,7 @@ pub(crate) fn inline_attr<'ll, 'tcx>(
|
||||
Some(AttributeKind::AlwaysInline.create_attr(cx.llcx))
|
||||
}
|
||||
InlineAttr::Never => {
|
||||
if cx.sess().target.arch != "amdgpu" {
|
||||
if tcx.sess.target.arch != "amdgpu" {
|
||||
Some(AttributeKind::NoInline.create_attr(cx.llcx))
|
||||
} else {
|
||||
None
|
||||
@ -63,12 +65,13 @@ pub(crate) fn inline_attr<'ll, 'tcx>(
|
||||
|
||||
#[inline]
|
||||
fn patchable_function_entry_attrs<'ll>(
|
||||
cx: &CodegenCx<'ll, '_>,
|
||||
cx: &SimpleCx<'ll>,
|
||||
sess: &Session,
|
||||
attr: Option<PatchableFunctionEntry>,
|
||||
) -> SmallVec<[&'ll Attribute; 2]> {
|
||||
let mut attrs = SmallVec::new();
|
||||
let patchable_spec = attr.unwrap_or_else(|| {
|
||||
PatchableFunctionEntry::from_config(cx.tcx.sess.opts.unstable_opts.patchable_function_entry)
|
||||
PatchableFunctionEntry::from_config(sess.opts.unstable_opts.patchable_function_entry)
|
||||
});
|
||||
let entry = patchable_spec.entry();
|
||||
let prefix = patchable_spec.prefix();
|
||||
@ -91,12 +94,13 @@ fn patchable_function_entry_attrs<'ll>(
|
||||
|
||||
/// Get LLVM sanitize attributes.
|
||||
#[inline]
|
||||
pub(crate) fn sanitize_attrs<'ll>(
|
||||
cx: &CodegenCx<'ll, '_>,
|
||||
pub(crate) fn sanitize_attrs<'ll, 'tcx>(
|
||||
cx: &SimpleCx<'ll>,
|
||||
tcx: TyCtxt<'tcx>,
|
||||
no_sanitize: SanitizerSet,
|
||||
) -> SmallVec<[&'ll Attribute; 4]> {
|
||||
let mut attrs = SmallVec::new();
|
||||
let enabled = cx.tcx.sess.opts.unstable_opts.sanitizer - no_sanitize;
|
||||
let enabled = tcx.sess.opts.unstable_opts.sanitizer - no_sanitize;
|
||||
if enabled.contains(SanitizerSet::ADDRESS) || enabled.contains(SanitizerSet::KERNELADDRESS) {
|
||||
attrs.push(llvm::AttributeKind::SanitizeAddress.create_attr(cx.llcx));
|
||||
}
|
||||
@ -114,11 +118,11 @@ pub(crate) fn sanitize_attrs<'ll>(
|
||||
}
|
||||
if enabled.contains(SanitizerSet::MEMTAG) {
|
||||
// Check to make sure the mte target feature is actually enabled.
|
||||
let features = cx.tcx.global_backend_features(());
|
||||
let features = tcx.global_backend_features(());
|
||||
let mte_feature =
|
||||
features.iter().map(|s| &s[..]).rfind(|n| ["+mte", "-mte"].contains(&&n[..]));
|
||||
if let None | Some("-mte") = mte_feature {
|
||||
cx.tcx.dcx().emit_err(SanitizerMemtagRequiresMte);
|
||||
tcx.dcx().emit_err(SanitizerMemtagRequiresMte);
|
||||
}
|
||||
|
||||
attrs.push(llvm::AttributeKind::SanitizeMemTag.create_attr(cx.llcx));
|
||||
@ -139,9 +143,12 @@ pub(crate) fn uwtable_attr(llcx: &llvm::Context, use_sync_unwind: Option<bool>)
|
||||
llvm::CreateUWTableAttr(llcx, async_unwind)
|
||||
}
|
||||
|
||||
pub(crate) fn frame_pointer_type_attr<'ll>(cx: &CodegenCx<'ll, '_>) -> Option<&'ll Attribute> {
|
||||
let mut fp = cx.sess().target.frame_pointer;
|
||||
let opts = &cx.sess().opts;
|
||||
pub(crate) fn frame_pointer_type_attr<'ll>(
|
||||
cx: &SimpleCx<'ll>,
|
||||
sess: &Session,
|
||||
) -> Option<&'ll Attribute> {
|
||||
let mut fp = sess.target.frame_pointer;
|
||||
let opts = &sess.opts;
|
||||
// "mcount" function relies on stack pointer.
|
||||
// See <https://sourceware.org/binutils/docs/gprof/Implementation.html>.
|
||||
if opts.unstable_opts.instrument_mcount {
|
||||
@ -156,8 +163,8 @@ pub(crate) fn frame_pointer_type_attr<'ll>(cx: &CodegenCx<'ll, '_>) -> Option<&'
|
||||
Some(llvm::CreateAttrStringValue(cx.llcx, "frame-pointer", attr_value))
|
||||
}
|
||||
|
||||
fn function_return_attr<'ll>(cx: &CodegenCx<'ll, '_>) -> Option<&'ll Attribute> {
|
||||
let function_return_attr = match cx.sess().opts.unstable_opts.function_return {
|
||||
fn function_return_attr<'ll>(cx: &SimpleCx<'ll>, sess: &Session) -> Option<&'ll Attribute> {
|
||||
let function_return_attr = match sess.opts.unstable_opts.function_return {
|
||||
FunctionReturn::Keep => return None,
|
||||
FunctionReturn::ThunkExtern => AttributeKind::FnRetThunkExtern,
|
||||
};
|
||||
@ -167,17 +174,20 @@ fn function_return_attr<'ll>(cx: &CodegenCx<'ll, '_>) -> Option<&'ll Attribute>
|
||||
|
||||
/// Tell LLVM what instrument function to insert.
|
||||
#[inline]
|
||||
fn instrument_function_attr<'ll>(cx: &CodegenCx<'ll, '_>) -> SmallVec<[&'ll Attribute; 4]> {
|
||||
fn instrument_function_attr<'ll>(
|
||||
cx: &SimpleCx<'ll>,
|
||||
sess: &Session,
|
||||
) -> SmallVec<[&'ll Attribute; 4]> {
|
||||
let mut attrs = SmallVec::new();
|
||||
if cx.sess().opts.unstable_opts.instrument_mcount {
|
||||
if sess.opts.unstable_opts.instrument_mcount {
|
||||
// Similar to `clang -pg` behavior. Handled by the
|
||||
// `post-inline-ee-instrument` LLVM pass.
|
||||
|
||||
// The function name varies on platforms.
|
||||
// See test/CodeGen/mcount.c in clang.
|
||||
let mcount_name = match &cx.sess().target.llvm_mcount_intrinsic {
|
||||
let mcount_name = match &sess.target.llvm_mcount_intrinsic {
|
||||
Some(llvm_mcount_intrinsic) => llvm_mcount_intrinsic.as_ref(),
|
||||
None => cx.sess().target.mcount.as_ref(),
|
||||
None => sess.target.mcount.as_ref(),
|
||||
};
|
||||
|
||||
attrs.push(llvm::CreateAttrStringValue(
|
||||
@ -186,7 +196,7 @@ fn instrument_function_attr<'ll>(cx: &CodegenCx<'ll, '_>) -> SmallVec<[&'ll Attr
|
||||
mcount_name,
|
||||
));
|
||||
}
|
||||
if let Some(options) = &cx.sess().opts.unstable_opts.instrument_xray {
|
||||
if let Some(options) = &sess.opts.unstable_opts.instrument_xray {
|
||||
// XRay instrumentation is similar to __cyg_profile_func_{enter,exit}.
|
||||
// Function prologue and epilogue are instrumented with NOP sleds,
|
||||
// a runtime library later replaces them with detours into tracing code.
|
||||
@ -217,20 +227,20 @@ fn instrument_function_attr<'ll>(cx: &CodegenCx<'ll, '_>) -> SmallVec<[&'ll Attr
|
||||
attrs
|
||||
}
|
||||
|
||||
fn nojumptables_attr<'ll>(cx: &CodegenCx<'ll, '_>) -> Option<&'ll Attribute> {
|
||||
if !cx.sess().opts.unstable_opts.no_jump_tables {
|
||||
fn nojumptables_attr<'ll>(cx: &SimpleCx<'ll>, sess: &Session) -> Option<&'ll Attribute> {
|
||||
if !sess.opts.unstable_opts.no_jump_tables {
|
||||
return None;
|
||||
}
|
||||
|
||||
Some(llvm::CreateAttrStringValue(cx.llcx, "no-jump-tables", "true"))
|
||||
}
|
||||
|
||||
fn probestack_attr<'ll>(cx: &CodegenCx<'ll, '_>) -> Option<&'ll Attribute> {
|
||||
fn probestack_attr<'ll, 'tcx>(cx: &SimpleCx<'ll>, tcx: TyCtxt<'tcx>) -> Option<&'ll Attribute> {
|
||||
// Currently stack probes seem somewhat incompatible with the address
|
||||
// sanitizer and thread sanitizer. With asan we're already protected from
|
||||
// stack overflow anyway so we don't really need stack probes regardless.
|
||||
if cx
|
||||
.sess()
|
||||
if tcx
|
||||
.sess
|
||||
.opts
|
||||
.unstable_opts
|
||||
.sanitizer
|
||||
@ -240,22 +250,22 @@ fn probestack_attr<'ll>(cx: &CodegenCx<'ll, '_>) -> Option<&'ll Attribute> {
|
||||
}
|
||||
|
||||
// probestack doesn't play nice either with `-C profile-generate`.
|
||||
if cx.sess().opts.cg.profile_generate.enabled() {
|
||||
if tcx.sess.opts.cg.profile_generate.enabled() {
|
||||
return None;
|
||||
}
|
||||
|
||||
let attr_value = match cx.sess().target.stack_probes {
|
||||
let attr_value = match tcx.sess.target.stack_probes {
|
||||
StackProbeType::None => return None,
|
||||
// Request LLVM to generate the probes inline. If the given LLVM version does not support
|
||||
// this, no probe is generated at all (even if the attribute is specified).
|
||||
StackProbeType::Inline => "inline-asm",
|
||||
// Flag our internal `__rust_probestack` function as the stack probe symbol.
|
||||
// This is defined in the `compiler-builtins` crate for each architecture.
|
||||
StackProbeType::Call => &mangle_internal_symbol(cx.tcx, "__rust_probestack"),
|
||||
StackProbeType::Call => &mangle_internal_symbol(tcx, "__rust_probestack"),
|
||||
// Pick from the two above based on the LLVM version.
|
||||
StackProbeType::InlineOrCall { min_llvm_version_for_inline } => {
|
||||
if llvm_util::get_version() < min_llvm_version_for_inline {
|
||||
&mangle_internal_symbol(cx.tcx, "__rust_probestack")
|
||||
&mangle_internal_symbol(tcx, "__rust_probestack")
|
||||
} else {
|
||||
"inline-asm"
|
||||
}
|
||||
@ -264,8 +274,8 @@ fn probestack_attr<'ll>(cx: &CodegenCx<'ll, '_>) -> Option<&'ll Attribute> {
|
||||
Some(llvm::CreateAttrStringValue(cx.llcx, "probe-stack", attr_value))
|
||||
}
|
||||
|
||||
fn stackprotector_attr<'ll>(cx: &CodegenCx<'ll, '_>) -> Option<&'ll Attribute> {
|
||||
let sspattr = match cx.sess().stack_protector() {
|
||||
fn stackprotector_attr<'ll>(cx: &SimpleCx<'ll>, sess: &Session) -> Option<&'ll Attribute> {
|
||||
let sspattr = match sess.stack_protector() {
|
||||
StackProtector::None => return None,
|
||||
StackProtector::All => AttributeKind::StackProtectReq,
|
||||
StackProtector::Strong => AttributeKind::StackProtectStrong,
|
||||
@ -275,33 +285,34 @@ fn stackprotector_attr<'ll>(cx: &CodegenCx<'ll, '_>) -> Option<&'ll Attribute> {
|
||||
Some(sspattr.create_attr(cx.llcx))
|
||||
}
|
||||
|
||||
fn backchain_attr<'ll>(cx: &CodegenCx<'ll, '_>) -> Option<&'ll Attribute> {
|
||||
if cx.sess().target.arch != "s390x" {
|
||||
fn backchain_attr<'ll>(cx: &SimpleCx<'ll>, sess: &Session) -> Option<&'ll Attribute> {
|
||||
if sess.target.arch != "s390x" {
|
||||
return None;
|
||||
}
|
||||
|
||||
let requested_features = cx.sess().opts.cg.target_feature.split(',');
|
||||
let requested_features = sess.opts.cg.target_feature.split(',');
|
||||
let found_positive = requested_features.clone().any(|r| r == "+backchain");
|
||||
|
||||
if found_positive { Some(llvm::CreateAttrString(cx.llcx, "backchain")) } else { None }
|
||||
}
|
||||
|
||||
pub(crate) fn target_cpu_attr<'ll>(cx: &CodegenCx<'ll, '_>) -> &'ll Attribute {
|
||||
let target_cpu = llvm_util::target_cpu(cx.tcx.sess);
|
||||
pub(crate) fn target_cpu_attr<'ll>(cx: &SimpleCx<'ll>, sess: &Session) -> &'ll Attribute {
|
||||
let target_cpu = llvm_util::target_cpu(sess);
|
||||
llvm::CreateAttrStringValue(cx.llcx, "target-cpu", target_cpu)
|
||||
}
|
||||
|
||||
pub(crate) fn tune_cpu_attr<'ll>(cx: &CodegenCx<'ll, '_>) -> Option<&'ll Attribute> {
|
||||
llvm_util::tune_cpu(cx.tcx.sess)
|
||||
pub(crate) fn tune_cpu_attr<'ll>(cx: &SimpleCx<'ll>, sess: &Session) -> Option<&'ll Attribute> {
|
||||
llvm_util::tune_cpu(sess)
|
||||
.map(|tune_cpu| llvm::CreateAttrStringValue(cx.llcx, "tune-cpu", tune_cpu))
|
||||
}
|
||||
|
||||
/// Get the `target-features` LLVM attribute.
|
||||
pub(crate) fn target_features_attr<'ll>(
|
||||
cx: &CodegenCx<'ll, '_>,
|
||||
pub(crate) fn target_features_attr<'ll, 'tcx>(
|
||||
cx: &SimpleCx<'ll>,
|
||||
tcx: TyCtxt<'tcx>,
|
||||
function_features: Vec<String>,
|
||||
) -> Option<&'ll Attribute> {
|
||||
let global_features = cx.tcx.global_backend_features(()).iter().map(String::as_str);
|
||||
let global_features = tcx.global_backend_features(()).iter().map(String::as_str);
|
||||
let function_features = function_features.iter().map(String::as_str);
|
||||
let target_features =
|
||||
global_features.chain(function_features).intersperse(",").collect::<String>();
|
||||
@ -311,22 +322,22 @@ pub(crate) fn target_features_attr<'ll>(
|
||||
|
||||
/// Get the `NonLazyBind` LLVM attribute,
|
||||
/// if the codegen options allow skipping the PLT.
|
||||
pub(crate) fn non_lazy_bind_attr<'ll>(cx: &CodegenCx<'ll, '_>) -> Option<&'ll Attribute> {
|
||||
pub(crate) fn non_lazy_bind_attr<'ll>(
|
||||
cx: &SimpleCx<'ll>,
|
||||
sess: &Session,
|
||||
) -> Option<&'ll Attribute> {
|
||||
// Don't generate calls through PLT if it's not necessary
|
||||
if !cx.sess().needs_plt() {
|
||||
Some(AttributeKind::NonLazyBind.create_attr(cx.llcx))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
if !sess.needs_plt() { Some(AttributeKind::NonLazyBind.create_attr(cx.llcx)) } else { None }
|
||||
}
|
||||
|
||||
/// Get the default optimizations attrs for a function.
|
||||
#[inline]
|
||||
pub(crate) fn default_optimisation_attrs<'ll>(
|
||||
cx: &CodegenCx<'ll, '_>,
|
||||
cx: &SimpleCx<'ll>,
|
||||
sess: &Session,
|
||||
) -> SmallVec<[&'ll Attribute; 2]> {
|
||||
let mut attrs = SmallVec::new();
|
||||
match cx.sess().opts.optimize {
|
||||
match sess.opts.optimize {
|
||||
OptLevel::Size => {
|
||||
attrs.push(llvm::AttributeKind::OptimizeForSize.create_attr(cx.llcx));
|
||||
}
|
||||
@ -347,17 +358,18 @@ fn create_alloc_family_attr(llcx: &llvm::Context) -> &llvm::Attribute {
|
||||
/// Composite function which sets LLVM attributes for function depending on its AST (`#[attribute]`)
|
||||
/// attributes.
|
||||
pub(crate) fn llfn_attrs_from_instance<'ll, 'tcx>(
|
||||
cx: &CodegenCx<'ll, 'tcx>,
|
||||
cx: &SimpleCx<'ll>,
|
||||
tcx: TyCtxt<'tcx>,
|
||||
llfn: &'ll Value,
|
||||
instance: ty::Instance<'tcx>,
|
||||
codegen_fn_attrs: &CodegenFnAttrs,
|
||||
instance: Option<ty::Instance<'tcx>>,
|
||||
) {
|
||||
let codegen_fn_attrs = cx.tcx.codegen_instance_attrs(instance.def);
|
||||
|
||||
let sess = tcx.sess;
|
||||
let mut to_add = SmallVec::<[_; 16]>::new();
|
||||
|
||||
match codegen_fn_attrs.optimize {
|
||||
OptimizeAttr::Default => {
|
||||
to_add.extend(default_optimisation_attrs(cx));
|
||||
to_add.extend(default_optimisation_attrs(cx, sess));
|
||||
}
|
||||
OptimizeAttr::DoNotOptimize => {
|
||||
to_add.push(llvm::AttributeKind::OptimizeNone.create_attr(cx.llcx));
|
||||
@ -369,21 +381,21 @@ pub(crate) fn llfn_attrs_from_instance<'ll, 'tcx>(
|
||||
OptimizeAttr::Speed => {}
|
||||
}
|
||||
|
||||
if cx.sess().must_emit_unwind_tables() {
|
||||
to_add.push(uwtable_attr(cx.llcx, cx.sess().opts.unstable_opts.use_sync_unwind));
|
||||
if sess.must_emit_unwind_tables() {
|
||||
to_add.push(uwtable_attr(cx.llcx, sess.opts.unstable_opts.use_sync_unwind));
|
||||
}
|
||||
|
||||
if cx.sess().opts.unstable_opts.profile_sample_use.is_some() {
|
||||
if sess.opts.unstable_opts.profile_sample_use.is_some() {
|
||||
to_add.push(llvm::CreateAttrString(cx.llcx, "use-sample-profile"));
|
||||
}
|
||||
|
||||
// FIXME: none of these functions interact with source level attributes.
|
||||
to_add.extend(frame_pointer_type_attr(cx));
|
||||
to_add.extend(function_return_attr(cx));
|
||||
to_add.extend(instrument_function_attr(cx));
|
||||
to_add.extend(nojumptables_attr(cx));
|
||||
to_add.extend(probestack_attr(cx));
|
||||
to_add.extend(stackprotector_attr(cx));
|
||||
to_add.extend(frame_pointer_type_attr(cx, sess));
|
||||
to_add.extend(function_return_attr(cx, sess));
|
||||
to_add.extend(instrument_function_attr(cx, sess));
|
||||
to_add.extend(nojumptables_attr(cx, sess));
|
||||
to_add.extend(probestack_attr(cx, tcx));
|
||||
to_add.extend(stackprotector_attr(cx, sess));
|
||||
|
||||
if codegen_fn_attrs.flags.contains(CodegenFnAttrFlags::NO_BUILTINS) {
|
||||
to_add.push(llvm::CreateAttrString(cx.llcx, "no-builtins"));
|
||||
@ -404,13 +416,13 @@ pub(crate) fn llfn_attrs_from_instance<'ll, 'tcx>(
|
||||
// not used.
|
||||
} else {
|
||||
// Do not set sanitizer attributes for naked functions.
|
||||
to_add.extend(sanitize_attrs(cx, codegen_fn_attrs.no_sanitize));
|
||||
to_add.extend(sanitize_attrs(cx, tcx, codegen_fn_attrs.no_sanitize));
|
||||
|
||||
// For non-naked functions, set branch protection attributes on aarch64.
|
||||
if let Some(BranchProtection { bti, pac_ret, gcs }) =
|
||||
cx.sess().opts.unstable_opts.branch_protection
|
||||
sess.opts.unstable_opts.branch_protection
|
||||
{
|
||||
assert!(cx.sess().target.arch == "aarch64");
|
||||
assert!(sess.target.arch == "aarch64");
|
||||
if bti {
|
||||
to_add.push(llvm::CreateAttrString(cx.llcx, "branch-target-enforcement"));
|
||||
}
|
||||
@ -438,14 +450,15 @@ pub(crate) fn llfn_attrs_from_instance<'ll, 'tcx>(
|
||||
|| codegen_fn_attrs.flags.contains(CodegenFnAttrFlags::ALLOCATOR_ZEROED)
|
||||
{
|
||||
to_add.push(create_alloc_family_attr(cx.llcx));
|
||||
if let Some(zv) =
|
||||
cx.tcx.get_attr(instance.def_id(), rustc_span::sym::rustc_allocator_zeroed_variant)
|
||||
if let Some(instance) = instance
|
||||
&& let Some(zv) =
|
||||
tcx.get_attr(instance.def_id(), rustc_span::sym::rustc_allocator_zeroed_variant)
|
||||
&& let Some(name) = zv.value_str()
|
||||
{
|
||||
to_add.push(llvm::CreateAttrStringValue(
|
||||
cx.llcx,
|
||||
"alloc-variant-zeroed",
|
||||
&mangle_internal_symbol(cx.tcx, name.as_str()),
|
||||
&mangle_internal_symbol(tcx, name.as_str()),
|
||||
));
|
||||
}
|
||||
// apply to argument place instead of function
|
||||
@ -490,18 +503,22 @@ pub(crate) fn llfn_attrs_from_instance<'ll, 'tcx>(
|
||||
if let Some(align) = codegen_fn_attrs.alignment {
|
||||
llvm::set_alignment(llfn, align);
|
||||
}
|
||||
if let Some(backchain) = backchain_attr(cx) {
|
||||
if let Some(backchain) = backchain_attr(cx, sess) {
|
||||
to_add.push(backchain);
|
||||
}
|
||||
to_add.extend(patchable_function_entry_attrs(cx, codegen_fn_attrs.patchable_function_entry));
|
||||
to_add.extend(patchable_function_entry_attrs(
|
||||
cx,
|
||||
sess,
|
||||
codegen_fn_attrs.patchable_function_entry,
|
||||
));
|
||||
|
||||
// Always annotate functions with the target-cpu they are compiled for.
|
||||
// Without this, ThinLTO won't inline Rust functions into Clang generated
|
||||
// functions (because Clang annotates functions this way too).
|
||||
to_add.push(target_cpu_attr(cx));
|
||||
to_add.push(target_cpu_attr(cx, sess));
|
||||
// tune-cpu is only conveyed through the attribute for our purpose.
|
||||
// The target doesn't care; the subtarget reads our attribute.
|
||||
to_add.extend(tune_cpu_attr(cx));
|
||||
to_add.extend(tune_cpu_attr(cx, sess));
|
||||
|
||||
let function_features =
|
||||
codegen_fn_attrs.target_features.iter().map(|f| f.name.as_str()).collect::<Vec<&str>>();
|
||||
@ -509,7 +526,9 @@ pub(crate) fn llfn_attrs_from_instance<'ll, 'tcx>(
|
||||
// Apply function attributes as per usual if there are no user defined
|
||||
// target features otherwise this will get applied at the callsite.
|
||||
if function_features.is_empty() {
|
||||
if let Some(inline_attr) = inline_attr(cx, instance) {
|
||||
if let Some(instance) = instance
|
||||
&& let Some(inline_attr) = inline_attr(cx, tcx, instance)
|
||||
{
|
||||
to_add.push(inline_attr);
|
||||
}
|
||||
}
|
||||
@ -517,7 +536,7 @@ pub(crate) fn llfn_attrs_from_instance<'ll, 'tcx>(
|
||||
let function_features = function_features
|
||||
.iter()
|
||||
// Convert to LLVMFeatures and filter out unavailable ones
|
||||
.flat_map(|feat| llvm_util::to_llvm_features(cx.tcx.sess, feat))
|
||||
.flat_map(|feat| llvm_util::to_llvm_features(sess, feat))
|
||||
// Convert LLVMFeatures & dependencies to +<feats>s
|
||||
.flat_map(|feat| feat.into_iter().map(|f| format!("+{f}")))
|
||||
.chain(codegen_fn_attrs.instruction_set.iter().map(|x| match x {
|
||||
@ -526,20 +545,22 @@ pub(crate) fn llfn_attrs_from_instance<'ll, 'tcx>(
|
||||
}))
|
||||
.collect::<Vec<String>>();
|
||||
|
||||
if cx.tcx.sess.target.is_like_wasm {
|
||||
if sess.target.is_like_wasm {
|
||||
// If this function is an import from the environment but the wasm
|
||||
// import has a specific module/name, apply them here.
|
||||
if let Some(module) = wasm_import_module(cx.tcx, instance.def_id()) {
|
||||
if let Some(instance) = instance
|
||||
&& let Some(module) = wasm_import_module(tcx, instance.def_id())
|
||||
{
|
||||
to_add.push(llvm::CreateAttrStringValue(cx.llcx, "wasm-import-module", module));
|
||||
|
||||
let name =
|
||||
codegen_fn_attrs.symbol_name.unwrap_or_else(|| cx.tcx.item_name(instance.def_id()));
|
||||
codegen_fn_attrs.symbol_name.unwrap_or_else(|| tcx.item_name(instance.def_id()));
|
||||
let name = name.as_str();
|
||||
to_add.push(llvm::CreateAttrStringValue(cx.llcx, "wasm-import-name", name));
|
||||
}
|
||||
}
|
||||
|
||||
to_add.extend(target_features_attr(cx, function_features));
|
||||
to_add.extend(target_features_attr(cx, tcx, function_features));
|
||||
|
||||
attributes::apply_to_llfn(llfn, Function, &to_add);
|
||||
}
|
||||
|
@ -105,7 +105,7 @@ pub(crate) fn compile_codegen_unit(
|
||||
if let Some(entry) =
|
||||
maybe_create_entry_wrapper::<Builder<'_, '_, '_>>(&cx, cx.codegen_unit)
|
||||
{
|
||||
let attrs = attributes::sanitize_attrs(&cx, SanitizerSet::empty());
|
||||
let attrs = attributes::sanitize_attrs(&cx, tcx, SanitizerSet::empty());
|
||||
attributes::apply_to_llfn(entry, llvm::AttributePlace::Function, &attrs);
|
||||
}
|
||||
|
||||
|
@ -1433,7 +1433,7 @@ impl<'a, 'll, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> {
|
||||
// If there is an inline attribute and a target feature that matches
|
||||
// we will add the attribute to the callsite otherwise we'll omit
|
||||
// this and not add the attribute to prevent soundness issues.
|
||||
&& let Some(inlining_rule) = attributes::inline_attr(&self.cx, instance)
|
||||
&& let Some(inlining_rule) = attributes::inline_attr(&self.cx, self.cx.tcx, instance)
|
||||
&& self.cx.tcx.is_target_feature_call_safe(
|
||||
&fn_call_attrs.target_features,
|
||||
&fn_defn_attrs.target_features,
|
||||
|
@ -876,7 +876,7 @@ impl<'ll, 'tcx> MiscCodegenMethods<'tcx> for CodegenCx<'ll, 'tcx> {
|
||||
} else {
|
||||
let fty = self.type_variadic_func(&[], self.type_i32());
|
||||
let llfn = self.declare_cfn(name, llvm::UnnamedAddr::Global, fty);
|
||||
let target_cpu = attributes::target_cpu_attr(self);
|
||||
let target_cpu = attributes::target_cpu_attr(self, self.sess());
|
||||
attributes::apply_to_llfn(llfn, llvm::AttributePlace::Function, &[target_cpu]);
|
||||
llfn
|
||||
}
|
||||
@ -891,15 +891,15 @@ impl<'ll, 'tcx> MiscCodegenMethods<'tcx> for CodegenCx<'ll, 'tcx> {
|
||||
}
|
||||
|
||||
fn set_frame_pointer_type(&self, llfn: &'ll Value) {
|
||||
if let Some(attr) = attributes::frame_pointer_type_attr(self) {
|
||||
if let Some(attr) = attributes::frame_pointer_type_attr(self, self.sess()) {
|
||||
attributes::apply_to_llfn(llfn, llvm::AttributePlace::Function, &[attr]);
|
||||
}
|
||||
}
|
||||
|
||||
fn apply_target_cpu_attr(&self, llfn: &'ll Value) {
|
||||
let mut attrs = SmallVec::<[_; 2]>::new();
|
||||
attrs.push(attributes::target_cpu_attr(self));
|
||||
attrs.extend(attributes::tune_cpu_attr(self));
|
||||
attrs.push(attributes::target_cpu_attr(self, self.sess()));
|
||||
attrs.extend(attributes::tune_cpu_attr(self, self.sess()));
|
||||
attributes::apply_to_llfn(llfn, llvm::AttributePlace::Function, &attrs);
|
||||
}
|
||||
|
||||
@ -918,7 +918,7 @@ impl<'ll, 'tcx> MiscCodegenMethods<'tcx> for CodegenCx<'ll, 'tcx> {
|
||||
attributes::apply_to_llfn(
|
||||
llfn,
|
||||
llvm::AttributePlace::Function,
|
||||
attributes::target_features_attr(self, vec![]).as_slice(),
|
||||
attributes::target_features_attr(self, self.tcx, vec![]).as_slice(),
|
||||
);
|
||||
Some(llfn)
|
||||
} else {
|
||||
|
@ -2,9 +2,9 @@
|
||||
|
||||
use rustc_codegen_ssa::base::collect_debugger_visualizers_transitive;
|
||||
use rustc_codegen_ssa::traits::*;
|
||||
use rustc_hir::attrs::DebuggerVisualizerType;
|
||||
use rustc_hir::def_id::LOCAL_CRATE;
|
||||
use rustc_middle::bug;
|
||||
use rustc_middle::middle::debugger_visualizer::DebuggerVisualizerType;
|
||||
use rustc_session::config::{CrateType, DebugInfo};
|
||||
|
||||
use crate::builder::Builder;
|
||||
|
@ -76,7 +76,7 @@ pub(crate) fn declare_raw_fn<'ll, 'tcx>(
|
||||
attrs.push(llvm::AttributeKind::NoRedZone.create_attr(cx.llcx));
|
||||
}
|
||||
|
||||
attrs.extend(attributes::non_lazy_bind_attr(cx));
|
||||
attrs.extend(attributes::non_lazy_bind_attr(cx, cx.tcx.sess));
|
||||
|
||||
attributes::apply_to_llfn(llfn, Function, &attrs);
|
||||
|
||||
|
@ -11,12 +11,12 @@ use rustc_data_structures::fx::{FxHashMap, FxIndexSet};
|
||||
use rustc_data_structures::profiling::{get_resident_set_size, print_time_passes_entry};
|
||||
use rustc_data_structures::sync::{IntoDynSyncSend, par_map};
|
||||
use rustc_data_structures::unord::UnordMap;
|
||||
use rustc_hir::attrs::OptimizeAttr;
|
||||
use rustc_hir::attrs::{DebuggerVisualizerType, OptimizeAttr};
|
||||
use rustc_hir::def_id::{DefId, LOCAL_CRATE};
|
||||
use rustc_hir::lang_items::LangItem;
|
||||
use rustc_hir::{ItemId, Target};
|
||||
use rustc_middle::middle::codegen_fn_attrs::CodegenFnAttrs;
|
||||
use rustc_middle::middle::debugger_visualizer::{DebuggerVisualizerFile, DebuggerVisualizerType};
|
||||
use rustc_middle::middle::debugger_visualizer::DebuggerVisualizerFile;
|
||||
use rustc_middle::middle::dependency_format::Dependencies;
|
||||
use rustc_middle::middle::exported_symbols::{self, SymbolExportKind};
|
||||
use rustc_middle::middle::lang_items;
|
||||
|
@ -324,16 +324,16 @@ pub trait BangProcMacro {
|
||||
|
||||
impl<F> BangProcMacro for F
|
||||
where
|
||||
F: Fn(TokenStream) -> TokenStream,
|
||||
F: Fn(&mut ExtCtxt<'_>, Span, TokenStream) -> Result<TokenStream, ErrorGuaranteed>,
|
||||
{
|
||||
fn expand<'cx>(
|
||||
&self,
|
||||
_ecx: &'cx mut ExtCtxt<'_>,
|
||||
_span: Span,
|
||||
ecx: &'cx mut ExtCtxt<'_>,
|
||||
span: Span,
|
||||
ts: TokenStream,
|
||||
) -> Result<TokenStream, ErrorGuaranteed> {
|
||||
// FIXME setup implicit context in TLS before calling self.
|
||||
Ok(self(ts))
|
||||
self(ecx, span, ts)
|
||||
}
|
||||
}
|
||||
|
||||
@ -999,17 +999,14 @@ impl SyntaxExtension {
|
||||
|
||||
/// A dummy bang macro `foo!()`.
|
||||
pub fn dummy_bang(edition: Edition) -> SyntaxExtension {
|
||||
fn expander<'cx>(
|
||||
cx: &'cx mut ExtCtxt<'_>,
|
||||
fn expand(
|
||||
ecx: &mut ExtCtxt<'_>,
|
||||
span: Span,
|
||||
_: TokenStream,
|
||||
) -> MacroExpanderResult<'cx> {
|
||||
ExpandResult::Ready(DummyResult::any(
|
||||
span,
|
||||
cx.dcx().span_delayed_bug(span, "expanded a dummy bang macro"),
|
||||
))
|
||||
_ts: TokenStream,
|
||||
) -> Result<TokenStream, ErrorGuaranteed> {
|
||||
Err(ecx.dcx().span_delayed_bug(span, "expanded a dummy bang macro"))
|
||||
}
|
||||
SyntaxExtension::default(SyntaxExtensionKind::LegacyBang(Arc::new(expander)), edition)
|
||||
SyntaxExtension::default(SyntaxExtensionKind::Bang(Arc::new(expand)), edition)
|
||||
}
|
||||
|
||||
/// A dummy derive macro `#[derive(Foo)]`.
|
||||
|
@ -971,7 +971,7 @@ impl<'a, 'b> MacroExpander<'a, 'b> {
|
||||
});
|
||||
}
|
||||
},
|
||||
SyntaxExtensionKind::LegacyBang(..) => {
|
||||
SyntaxExtensionKind::Bang(..) => {
|
||||
let msg = "expanded a dummy glob delegation";
|
||||
let guar = self.cx.dcx().span_delayed_bug(span, msg);
|
||||
return ExpandResult::Ready(fragment_kind.dummy(span, guar));
|
||||
|
@ -33,8 +33,8 @@ use super::diagnostics::{FailedMacro, failed_to_match_macro};
|
||||
use super::macro_parser::{NamedMatches, NamedParseResult};
|
||||
use super::{SequenceRepetition, diagnostics};
|
||||
use crate::base::{
|
||||
AttrProcMacro, DummyResult, ExpandResult, ExtCtxt, MacResult, MacroExpanderResult,
|
||||
SyntaxExtension, SyntaxExtensionKind, TTMacroExpander,
|
||||
AttrProcMacro, BangProcMacro, DummyResult, ExpandResult, ExtCtxt, MacResult,
|
||||
MacroExpanderResult, SyntaxExtension, SyntaxExtensionKind, TTMacroExpander,
|
||||
};
|
||||
use crate::errors;
|
||||
use crate::expand::{AstFragment, AstFragmentKind, ensure_complete_parse, parse_ast_fragment};
|
||||
@ -267,16 +267,16 @@ impl AttrProcMacro for MacroRulesMacroExpander {
|
||||
}
|
||||
}
|
||||
|
||||
struct DummyExpander(ErrorGuaranteed);
|
||||
struct DummyBang(ErrorGuaranteed);
|
||||
|
||||
impl TTMacroExpander for DummyExpander {
|
||||
impl BangProcMacro for DummyBang {
|
||||
fn expand<'cx>(
|
||||
&self,
|
||||
_: &'cx mut ExtCtxt<'_>,
|
||||
span: Span,
|
||||
_: Span,
|
||||
_: TokenStream,
|
||||
) -> ExpandResult<Box<dyn MacResult + 'cx>, ()> {
|
||||
ExpandResult::Ready(DummyResult::any(span, self.0))
|
||||
) -> Result<TokenStream, ErrorGuaranteed> {
|
||||
Err(self.0)
|
||||
}
|
||||
}
|
||||
|
||||
@ -664,7 +664,7 @@ pub fn compile_declarative_macro(
|
||||
SyntaxExtension::new(sess, kind, span, Vec::new(), edition, ident.name, attrs, is_local)
|
||||
};
|
||||
let dummy_syn_ext =
|
||||
|guar| (mk_syn_ext(SyntaxExtensionKind::LegacyBang(Arc::new(DummyExpander(guar)))), 0);
|
||||
|guar| (mk_syn_ext(SyntaxExtensionKind::Bang(Arc::new(DummyBang(guar)))), 0);
|
||||
|
||||
let macro_rules = macro_def.macro_rules;
|
||||
let exp_sep = if macro_rules { exp!(Semi) } else { exp!(Comma) };
|
||||
@ -894,12 +894,12 @@ fn check_redundant_vis_repetition(
|
||||
seq: &SequenceRepetition,
|
||||
span: &DelimSpan,
|
||||
) {
|
||||
let is_zero_or_one: bool = seq.kleene.op == KleeneOp::ZeroOrOne;
|
||||
let is_vis = seq.tts.first().map_or(false, |tt| {
|
||||
matches!(tt, mbe::TokenTree::MetaVarDecl { kind: NonterminalKind::Vis, .. })
|
||||
});
|
||||
|
||||
if is_vis && is_zero_or_one {
|
||||
if seq.kleene.op == KleeneOp::ZeroOrOne
|
||||
&& matches!(
|
||||
seq.tts.first(),
|
||||
Some(mbe::TokenTree::MetaVarDecl { kind: NonterminalKind::Vis, .. })
|
||||
)
|
||||
{
|
||||
err.note("a `vis` fragment can already be empty");
|
||||
err.multipart_suggestion(
|
||||
"remove the `$(` and `)?`",
|
||||
|
@ -363,6 +363,20 @@ pub struct LinkEntry {
|
||||
pub import_name_type: Option<(PeImportNameType, Span)>,
|
||||
}
|
||||
|
||||
#[derive(HashStable_Generic, PrintAttribute)]
|
||||
#[derive(Copy, PartialEq, PartialOrd, Clone, Ord, Eq, Hash, Debug, Encodable, Decodable)]
|
||||
pub enum DebuggerVisualizerType {
|
||||
Natvis,
|
||||
GdbPrettyPrinter,
|
||||
}
|
||||
|
||||
#[derive(Debug, Encodable, Decodable, Clone, HashStable_Generic, PrintAttribute)]
|
||||
pub struct DebugVisualizer {
|
||||
pub span: Span,
|
||||
pub visualizer_type: DebuggerVisualizerType,
|
||||
pub path: Symbol,
|
||||
}
|
||||
|
||||
/// Represents parsed *built-in* inert attributes.
|
||||
///
|
||||
/// ## Overview
|
||||
@ -485,7 +499,10 @@ pub enum AttributeKind {
|
||||
/// Represents `#[custom_mir]`.
|
||||
CustomMir(Option<(MirDialect, Span)>, Option<(MirPhase, Span)>, Span),
|
||||
|
||||
///Represents `#[rustc_deny_explicit_impl]`.
|
||||
/// Represents `#[debugger_visualizer]`.
|
||||
DebuggerVisualizer(ThinVec<DebugVisualizer>),
|
||||
|
||||
/// Represents `#[rustc_deny_explicit_impl]`.
|
||||
DenyExplicitImpl(Span),
|
||||
|
||||
/// Represents [`#[deprecated]`](https://doc.rust-lang.org/stable/reference/attributes/diagnostics.html#the-deprecated-attribute).
|
||||
|
@ -37,6 +37,7 @@ impl AttributeKind {
|
||||
Coverage(..) => No,
|
||||
CrateName { .. } => No,
|
||||
CustomMir(_, _, _) => Yes,
|
||||
DebuggerVisualizer(..) => No,
|
||||
DenyExplicitImpl(..) => No,
|
||||
Deprecation { .. } => Yes,
|
||||
DoNotImplementViaObject(..) => No,
|
||||
|
@ -5,7 +5,7 @@ use syn::punctuated::Punctuated;
|
||||
use syn::spanned::Spanned;
|
||||
use syn::{
|
||||
AttrStyle, Attribute, Block, Error, Expr, Ident, Pat, ReturnType, Token, Type, braced,
|
||||
parenthesized, parse_macro_input, parse_quote, token,
|
||||
parenthesized, parse_macro_input, token,
|
||||
};
|
||||
|
||||
mod kw {
|
||||
|
@ -1,15 +1,9 @@
|
||||
use std::path::PathBuf;
|
||||
use std::sync::Arc;
|
||||
|
||||
use rustc_hir::attrs::DebuggerVisualizerType;
|
||||
use rustc_macros::{Decodable, Encodable, HashStable};
|
||||
|
||||
#[derive(HashStable)]
|
||||
#[derive(Copy, PartialEq, PartialOrd, Clone, Ord, Eq, Hash, Debug, Encodable, Decodable)]
|
||||
pub enum DebuggerVisualizerType {
|
||||
Natvis,
|
||||
GdbPrettyPrinter,
|
||||
}
|
||||
|
||||
/// A single debugger visualizer file.
|
||||
#[derive(HashStable)]
|
||||
#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord, Encodable, Decodable)]
|
||||
|
@ -395,12 +395,10 @@ enum NeedsTemporary {
|
||||
Maybe,
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
/// The `BlockAnd` "monad" packages up the new basic block along with a
|
||||
/// produced value (sometimes just unit, of course). The `unpack!`
|
||||
/// macro (and methods below) makes working with `BlockAnd` much more
|
||||
/// convenient.
|
||||
|
||||
#[must_use = "if you don't use one of these results, you're leaving a dangling edge"]
|
||||
struct BlockAnd<T>(BasicBlock, T);
|
||||
|
||||
@ -438,9 +436,7 @@ macro_rules! unpack {
|
||||
}};
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
/// the main entry point for building MIR for a function
|
||||
|
||||
/// The main entry point for building MIR for a function.
|
||||
fn construct_fn<'tcx>(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
fn_def: LocalDefId,
|
||||
|
@ -93,15 +93,6 @@ passes_dead_codes =
|
||||
}
|
||||
} never {$participle}
|
||||
|
||||
passes_debug_visualizer_invalid =
|
||||
invalid argument
|
||||
.note_1 = expected: `natvis_file = "..."`
|
||||
.note_2 = OR
|
||||
.note_3 = expected: `gdb_script_file = "..."`
|
||||
|
||||
passes_debug_visualizer_placement =
|
||||
attribute should be applied to a module
|
||||
|
||||
passes_debug_visualizer_unreadable =
|
||||
couldn't read {$file}: {$error}
|
||||
|
||||
|
@ -282,6 +282,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
|
||||
| AttributeKind::ObjcClass { .. }
|
||||
| AttributeKind::ObjcSelector { .. }
|
||||
| AttributeKind::RustcCoherenceIsCore(..)
|
||||
| AttributeKind::DebuggerVisualizer(..)
|
||||
) => { /* do nothing */ }
|
||||
Attribute::Unparsed(attr_item) => {
|
||||
style = Some(attr_item.style);
|
||||
@ -302,7 +303,6 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
|
||||
&mut doc_aliases,
|
||||
),
|
||||
[sym::no_link, ..] => self.check_no_link(hir_id, attr, span, target),
|
||||
[sym::debugger_visualizer, ..] => self.check_debugger_visualizer(attr, target),
|
||||
[sym::rustc_no_implicit_autorefs, ..] => {
|
||||
self.check_applied_to_fn_or_method(hir_id, attr.span(), span, target)
|
||||
}
|
||||
@ -1783,20 +1783,6 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
|
||||
}
|
||||
}
|
||||
|
||||
/// Checks if the items on the `#[debugger_visualizer]` attribute are valid.
|
||||
fn check_debugger_visualizer(&self, attr: &Attribute, target: Target) {
|
||||
// Here we only check that the #[debugger_visualizer] attribute is attached
|
||||
// to nothing other than a module. All other checks are done in the
|
||||
// `debugger_visualizer` query where they need to be done for decoding
|
||||
// anyway.
|
||||
match target {
|
||||
Target::Mod => {}
|
||||
_ => {
|
||||
self.dcx().emit_err(errors::DebugVisualizerPlacement { span: attr.span() });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Outputs an error for `#[allow_internal_unstable]` which can only be applied to macros.
|
||||
/// (Allows proc_macro functions)
|
||||
fn check_rustc_allow_const_fn_unstable(
|
||||
|
@ -1,67 +1,60 @@
|
||||
//! Detecting usage of the `#[debugger_visualizer]` attribute.
|
||||
|
||||
use rustc_ast::Attribute;
|
||||
use rustc_ast::ast::NodeId;
|
||||
use rustc_ast::{HasNodeId, ItemKind, ast};
|
||||
use rustc_attr_parsing::AttributeParser;
|
||||
use rustc_expand::base::resolve_path;
|
||||
use rustc_middle::middle::debugger_visualizer::{DebuggerVisualizerFile, DebuggerVisualizerType};
|
||||
use rustc_hir::Attribute;
|
||||
use rustc_hir::attrs::{AttributeKind, DebugVisualizer};
|
||||
use rustc_middle::middle::debugger_visualizer::DebuggerVisualizerFile;
|
||||
use rustc_middle::query::{LocalCrate, Providers};
|
||||
use rustc_middle::ty::TyCtxt;
|
||||
use rustc_session::Session;
|
||||
use rustc_span::sym;
|
||||
use rustc_span::{DUMMY_SP, Span, sym};
|
||||
|
||||
use crate::errors::{DebugVisualizerInvalid, DebugVisualizerUnreadable};
|
||||
use crate::errors::DebugVisualizerUnreadable;
|
||||
|
||||
impl DebuggerVisualizerCollector<'_> {
|
||||
fn check_for_debugger_visualizer(&mut self, attr: &Attribute) {
|
||||
if attr.has_name(sym::debugger_visualizer) {
|
||||
let Some(hints) = attr.meta_item_list() else {
|
||||
self.sess.dcx().emit_err(DebugVisualizerInvalid { span: attr.span });
|
||||
return;
|
||||
};
|
||||
fn check_for_debugger_visualizer(
|
||||
&mut self,
|
||||
attrs: &[ast::Attribute],
|
||||
span: Span,
|
||||
node_id: NodeId,
|
||||
) {
|
||||
if let Some(Attribute::Parsed(AttributeKind::DebuggerVisualizer(visualizers))) =
|
||||
AttributeParser::parse_limited(
|
||||
&self.sess,
|
||||
attrs,
|
||||
sym::debugger_visualizer,
|
||||
span,
|
||||
node_id,
|
||||
None,
|
||||
)
|
||||
{
|
||||
for DebugVisualizer { span, visualizer_type, path } in visualizers {
|
||||
let file = match resolve_path(&self.sess, path.as_str(), span) {
|
||||
Ok(file) => file,
|
||||
Err(err) => {
|
||||
err.emit();
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
let [hint] = hints.as_slice() else {
|
||||
self.sess.dcx().emit_err(DebugVisualizerInvalid { span: attr.span });
|
||||
return;
|
||||
};
|
||||
|
||||
let Some(meta_item) = hint.meta_item() else {
|
||||
self.sess.dcx().emit_err(DebugVisualizerInvalid { span: attr.span });
|
||||
return;
|
||||
};
|
||||
|
||||
let (visualizer_type, visualizer_path) = match (meta_item.name(), meta_item.value_str())
|
||||
{
|
||||
(Some(sym::natvis_file), Some(value)) => (DebuggerVisualizerType::Natvis, value),
|
||||
(Some(sym::gdb_script_file), Some(value)) => {
|
||||
(DebuggerVisualizerType::GdbPrettyPrinter, value)
|
||||
}
|
||||
(_, _) => {
|
||||
self.sess.dcx().emit_err(DebugVisualizerInvalid { span: meta_item.span });
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
let file = match resolve_path(&self.sess, visualizer_path.as_str(), attr.span) {
|
||||
Ok(file) => file,
|
||||
Err(err) => {
|
||||
err.emit();
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
match self.sess.source_map().load_binary_file(&file) {
|
||||
Ok((source, _)) => {
|
||||
self.visualizers.push(DebuggerVisualizerFile::new(
|
||||
source,
|
||||
visualizer_type,
|
||||
file,
|
||||
));
|
||||
}
|
||||
Err(error) => {
|
||||
self.sess.dcx().emit_err(DebugVisualizerUnreadable {
|
||||
span: meta_item.span,
|
||||
file: &file,
|
||||
error,
|
||||
});
|
||||
match self.sess.source_map().load_binary_file(&file) {
|
||||
Ok((source, _)) => {
|
||||
self.visualizers.push(DebuggerVisualizerFile::new(
|
||||
source,
|
||||
visualizer_type,
|
||||
file,
|
||||
));
|
||||
}
|
||||
Err(error) => {
|
||||
self.sess.dcx().emit_err(DebugVisualizerUnreadable {
|
||||
span,
|
||||
file: &file,
|
||||
error,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -74,9 +67,15 @@ struct DebuggerVisualizerCollector<'a> {
|
||||
}
|
||||
|
||||
impl<'ast> rustc_ast::visit::Visitor<'ast> for DebuggerVisualizerCollector<'_> {
|
||||
fn visit_attribute(&mut self, attr: &'ast Attribute) {
|
||||
self.check_for_debugger_visualizer(attr);
|
||||
rustc_ast::visit::walk_attribute(self, attr);
|
||||
fn visit_item(&mut self, item: &'ast rustc_ast::Item) -> Self::Result {
|
||||
if let ItemKind::Mod(..) = item.kind {
|
||||
self.check_for_debugger_visualizer(&item.attrs, item.span, item.node_id());
|
||||
}
|
||||
rustc_ast::visit::walk_item(self, item);
|
||||
}
|
||||
fn visit_crate(&mut self, krate: &'ast ast::Crate) -> Self::Result {
|
||||
self.check_for_debugger_visualizer(&krate.attrs, DUMMY_SP, krate.id);
|
||||
rustc_ast::visit::walk_crate(self, krate);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -475,23 +475,6 @@ pub(crate) struct MacroOnlyAttribute {
|
||||
pub span: Span,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(passes_debug_visualizer_placement)]
|
||||
pub(crate) struct DebugVisualizerPlacement {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(passes_debug_visualizer_invalid)]
|
||||
#[note(passes_note_1)]
|
||||
#[note(passes_note_2)]
|
||||
#[note(passes_note_3)]
|
||||
pub(crate) struct DebugVisualizerInvalid {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(passes_debug_visualizer_unreadable)]
|
||||
pub(crate) struct DebugVisualizerUnreadable<'a> {
|
||||
|
@ -45,7 +45,7 @@ use tracing::debug;
|
||||
rustc_fluent_macro::fluent_messages! { "../messages.ftl" }
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// Generic infrastructure used to implement specific visitors below.
|
||||
// Generic infrastructure used to implement specific visitors below.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
struct LazyDefPathStr<'tcx> {
|
||||
@ -309,10 +309,7 @@ fn min(vis1: ty::Visibility, vis2: ty::Visibility, tcx: TyCtxt<'_>) -> ty::Visib
|
||||
if vis1.is_at_least(vis2, tcx) { vis2 } else { vis1 }
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// Visitor used to determine impl visibility and reachability.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
struct FindMin<'a, 'tcx, VL: VisibilityLike, const SHALLOW: bool> {
|
||||
tcx: TyCtxt<'tcx>,
|
||||
effective_visibilities: &'a EffectiveVisibilities,
|
||||
@ -387,10 +384,7 @@ impl VisibilityLike for EffectiveVisibility {
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// The embargo visitor, used to determine the exports of the AST.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
struct EmbargoVisitor<'tcx> {
|
||||
tcx: TyCtxt<'tcx>,
|
||||
|
||||
@ -849,9 +843,7 @@ impl<'tcx> DefIdVisitor<'tcx> for ReachEverythingInTheInterfaceVisitor<'_, 'tcx>
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// Visitor, used for EffectiveVisibilities table checking
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
pub struct TestReachabilityVisitor<'a, 'tcx> {
|
||||
tcx: TyCtxt<'tcx>,
|
||||
effective_visibilities: &'a EffectiveVisibilities,
|
||||
@ -909,13 +901,11 @@ impl<'a, 'tcx> TestReachabilityVisitor<'a, 'tcx> {
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////
|
||||
/// Name privacy visitor, checks privacy and reports violations.
|
||||
///
|
||||
/// Most of name privacy checks are performed during the main resolution phase,
|
||||
/// or later in type checking when field accesses and associated items are resolved.
|
||||
/// This pass performs remaining checks for fields in struct expressions and patterns.
|
||||
//////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
struct NamePrivacyVisitor<'tcx> {
|
||||
tcx: TyCtxt<'tcx>,
|
||||
maybe_typeck_results: Option<&'tcx ty::TypeckResults<'tcx>>,
|
||||
@ -1120,12 +1110,10 @@ impl<'tcx> Visitor<'tcx> for NamePrivacyVisitor<'tcx> {
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////
|
||||
/// Type privacy visitor, checks types for privacy and reports violations.
|
||||
///
|
||||
/// Both explicitly written types and inferred types of expressions and patterns are checked.
|
||||
/// Checks are performed on "semantic" types regardless of names and their hygiene.
|
||||
////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
struct TypePrivacyVisitor<'tcx> {
|
||||
tcx: TyCtxt<'tcx>,
|
||||
module_def_id: LocalModDefId,
|
||||
@ -1345,13 +1333,11 @@ impl<'tcx> DefIdVisitor<'tcx> for TypePrivacyVisitor<'tcx> {
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// SearchInterfaceForPrivateItemsVisitor traverses an item's interface and
|
||||
/// finds any private components in it.
|
||||
///
|
||||
/// PrivateItemsInPublicInterfacesVisitor ensures there are no private types
|
||||
/// and traits in public interfaces.
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
struct SearchInterfaceForPrivateItemsVisitor<'tcx> {
|
||||
tcx: TyCtxt<'tcx>,
|
||||
item_def_id: LocalDefId,
|
||||
|
@ -492,14 +492,13 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
|
||||
_ => Err(Determinacy::Determined),
|
||||
},
|
||||
Scope::Module(module, derive_fallback_lint_id) => {
|
||||
// FIXME: use `finalize_scope` here.
|
||||
let (adjusted_parent_scope, adjusted_finalize) =
|
||||
if matches!(scope_set, ScopeSet::ModuleAndExternPrelude(..)) {
|
||||
(parent_scope, finalize)
|
||||
(parent_scope, finalize_scope!())
|
||||
} else {
|
||||
(
|
||||
&ParentScope { module, ..*parent_scope },
|
||||
finalize.map(|f| Finalize { used: Used::Scope, ..f }),
|
||||
finalize_scope!().map(|f| Finalize { used: Used::Scope, ..f }),
|
||||
)
|
||||
};
|
||||
let binding = this.reborrow().resolve_ident_in_module_unadjusted(
|
||||
@ -557,8 +556,10 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
|
||||
None => Err(Determinacy::Determined),
|
||||
},
|
||||
Scope::ExternPreludeItems => {
|
||||
// FIXME: use `finalize_scope` here.
|
||||
match this.reborrow().extern_prelude_get_item(ident, finalize.is_some()) {
|
||||
match this
|
||||
.reborrow()
|
||||
.extern_prelude_get_item(ident, finalize_scope!().is_some())
|
||||
{
|
||||
Some(binding) => {
|
||||
extern_prelude_item_binding = Some(binding);
|
||||
Ok((binding, Flags::empty()))
|
||||
|
@ -93,10 +93,7 @@ pub(crate) fn opts() -> TargetOptions {
|
||||
binary_format: BinaryFormat::Coff,
|
||||
allows_weak_linkage: false,
|
||||
pre_link_args,
|
||||
pre_link_objects: crt_objects::pre_mingw(),
|
||||
post_link_objects: crt_objects::post_mingw(),
|
||||
pre_link_objects_self_contained: crt_objects::pre_mingw_self_contained(),
|
||||
post_link_objects_self_contained: crt_objects::post_mingw_self_contained(),
|
||||
link_self_contained: LinkSelfContainedDefault::InferredForMingw,
|
||||
late_link_args,
|
||||
late_link_args_dynamic,
|
||||
|
@ -85,6 +85,17 @@ pub(super) fn post_musl_self_contained() -> CrtObjects {
|
||||
}
|
||||
|
||||
pub(super) fn pre_mingw_self_contained() -> CrtObjects {
|
||||
new(&[
|
||||
(LinkOutputKind::DynamicNoPicExe, &["crt2.o"]),
|
||||
(LinkOutputKind::DynamicPicExe, &["crt2.o"]),
|
||||
(LinkOutputKind::StaticNoPicExe, &["crt2.o"]),
|
||||
(LinkOutputKind::StaticPicExe, &["crt2.o"]),
|
||||
(LinkOutputKind::DynamicDylib, &["dllcrt2.o"]),
|
||||
(LinkOutputKind::StaticDylib, &["dllcrt2.o"]),
|
||||
])
|
||||
}
|
||||
|
||||
pub(super) fn pre_i686_mingw_self_contained() -> CrtObjects {
|
||||
new(&[
|
||||
(LinkOutputKind::DynamicNoPicExe, &["crt2.o", "rsbegin.o"]),
|
||||
(LinkOutputKind::DynamicPicExe, &["crt2.o", "rsbegin.o"]),
|
||||
@ -95,15 +106,15 @@ pub(super) fn pre_mingw_self_contained() -> CrtObjects {
|
||||
])
|
||||
}
|
||||
|
||||
pub(super) fn post_mingw_self_contained() -> CrtObjects {
|
||||
pub(super) fn post_i686_mingw_self_contained() -> CrtObjects {
|
||||
all("rsend.o")
|
||||
}
|
||||
|
||||
pub(super) fn pre_mingw() -> CrtObjects {
|
||||
pub(super) fn pre_i686_mingw() -> CrtObjects {
|
||||
all("rsbegin.o")
|
||||
}
|
||||
|
||||
pub(super) fn post_mingw() -> CrtObjects {
|
||||
pub(super) fn post_i686_mingw() -> CrtObjects {
|
||||
all("rsend.o")
|
||||
}
|
||||
|
||||
|
@ -12,7 +12,7 @@ pub(crate) fn target() -> Target {
|
||||
llvm_target: "armebv7r-none-eabi".into(),
|
||||
metadata: TargetMetadata {
|
||||
description: Some("Bare Armv7-R, Big Endian".into()),
|
||||
tier: Some(2),
|
||||
tier: Some(3),
|
||||
host_tools: Some(false),
|
||||
std: Some(false),
|
||||
},
|
||||
|
@ -12,7 +12,7 @@ pub(crate) fn target() -> Target {
|
||||
llvm_target: "armebv7r-none-eabihf".into(),
|
||||
metadata: TargetMetadata {
|
||||
description: Some("Bare Armv7-R, Big Endian, hardfloat".into()),
|
||||
tier: Some(2),
|
||||
tier: Some(3),
|
||||
host_tools: Some(false),
|
||||
std: Some(false),
|
||||
},
|
||||
|
@ -1,4 +1,6 @@
|
||||
use crate::spec::{Cc, FramePointer, LinkerFlavor, Lld, RustcAbi, Target, TargetMetadata, base};
|
||||
use crate::spec::{
|
||||
Cc, FramePointer, LinkerFlavor, Lld, RustcAbi, Target, TargetMetadata, base, crt_objects,
|
||||
};
|
||||
|
||||
pub(crate) fn target() -> Target {
|
||||
let mut base = base::windows_gnu::opts();
|
||||
@ -15,6 +17,10 @@ pub(crate) fn target() -> Target {
|
||||
&["-m", "i386pe", "--large-address-aware"],
|
||||
);
|
||||
base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-Wl,--large-address-aware"]);
|
||||
base.pre_link_objects = crt_objects::pre_i686_mingw();
|
||||
base.post_link_objects = crt_objects::post_i686_mingw();
|
||||
base.pre_link_objects_self_contained = crt_objects::pre_i686_mingw_self_contained();
|
||||
base.post_link_objects_self_contained = crt_objects::post_i686_mingw_self_contained();
|
||||
|
||||
Target {
|
||||
llvm_target: "i686-pc-windows-gnu".into(),
|
||||
|
@ -47,7 +47,6 @@
|
||||
#![deny(unsafe_op_in_unsafe_fn)]
|
||||
|
||||
extern crate alloc;
|
||||
extern crate test;
|
||||
|
||||
use std::hash::{DefaultHasher, Hash, Hasher};
|
||||
|
||||
|
@ -72,7 +72,7 @@ mod imp {
|
||||
use crate::sync::OnceLock;
|
||||
use crate::sync::atomic::{Atomic, AtomicBool, AtomicPtr, AtomicUsize, Ordering};
|
||||
use crate::sys::pal::unix::os;
|
||||
use crate::{io, mem, panic, ptr};
|
||||
use crate::{io, mem, ptr};
|
||||
|
||||
// Signal handler for the SIGSEGV and SIGBUS handlers. We've got guard pages
|
||||
// (unmapped pages) at the end of every thread's stack, so if a thread ends
|
||||
|
@ -895,6 +895,8 @@ impl Step for StartupObjects {
|
||||
fn run(self, builder: &Builder<'_>) -> Vec<(PathBuf, DependencyType)> {
|
||||
let for_compiler = self.compiler;
|
||||
let target = self.target;
|
||||
// Even though no longer necessary on x86_64, they are kept for now to
|
||||
// avoid potential issues in downstream crates.
|
||||
if !target.is_windows_gnu() {
|
||||
return vec![];
|
||||
}
|
||||
|
@ -156,8 +156,6 @@ target | std | notes
|
||||
`arm-unknown-linux-musleabi` | ✓ | Armv6 Linux with musl 1.2.3
|
||||
`arm-unknown-linux-musleabihf` | ✓ | Armv6 Linux with musl 1.2.3, hardfloat
|
||||
[`arm64ec-pc-windows-msvc`](platform-support/arm64ec-pc-windows-msvc.md) | ✓ | Arm64EC Windows MSVC
|
||||
[`armebv7r-none-eabi`](platform-support/armebv7r-none-eabi.md) | * | Bare Armv7-R, Big Endian
|
||||
[`armebv7r-none-eabihf`](platform-support/armebv7r-none-eabi.md) | * | Bare Armv7-R, Big Endian, hardfloat
|
||||
[`armv5te-unknown-linux-gnueabi`](platform-support/armv5te-unknown-linux-gnueabi.md) | ✓ | Armv5TE Linux (kernel 4.4+, glibc 2.23)
|
||||
`armv5te-unknown-linux-musleabi` | ✓ | Armv5TE Linux with musl 1.2.3
|
||||
[`armv7-linux-androideabi`](platform-support/android.md) | ✓ | Armv7-A Android
|
||||
@ -283,6 +281,8 @@ target | std | host | notes
|
||||
[`arm64e-apple-ios`](platform-support/arm64e-apple-ios.md) | ✓ | | ARM64e Apple iOS
|
||||
[`arm64e-apple-tvos`](platform-support/arm64e-apple-tvos.md) | ✓ | | ARM64e Apple tvOS
|
||||
[`armeb-unknown-linux-gnueabi`](platform-support/armeb-unknown-linux-gnueabi.md) | ✓ | ? | Arm BE8 the default Arm big-endian architecture since [Armv6](https://developer.arm.com/documentation/101754/0616/armlink-Reference/armlink-Command-line-Options/--be8?lang=en).
|
||||
[`armebv7r-none-eabi`](platform-support/armebv7r-none-eabi.md) | * | Bare Armv7-R, Big Endian
|
||||
[`armebv7r-none-eabihf`](platform-support/armebv7r-none-eabi.md) | * | Bare Armv7-R, Big Endian, hardfloat
|
||||
[`armv4t-none-eabi`](platform-support/armv4t-none-eabi.md) | * | | Bare Armv4T
|
||||
`armv4t-unknown-linux-gnueabi` | ? | | Armv4T Linux
|
||||
[`armv5te-none-eabi`](platform-support/armv5te-none-eabi.md) | * | | Bare Armv5TE
|
||||
|
@ -1,6 +1,6 @@
|
||||
# `armebv7r-none-eabi` and `armebv7r-none-eabihf`
|
||||
|
||||
* **Tier: 2**
|
||||
* **Tier: 3**
|
||||
* **Library Support:** core and alloc (bare-metal, `#![no_std]`)
|
||||
|
||||
Bare-metal target for CPUs in the Armv7-R architecture family running in Big
|
||||
|
@ -90,7 +90,7 @@ fn Foo() {}
|
||||
These prefixes will be stripped when displayed in the documentation, so `[struct@Foo]` will be
|
||||
rendered as `Foo`. The following prefixes are available: `struct`, `enum`, `trait`, `union`,
|
||||
`mod`, `module`, `const`, `constant`, `fn`, `function`, `field`, `variant`, `method`, `derive`,
|
||||
`type`, `value`, `macro`, `prim` or `primitive`.
|
||||
`type`, `value`, `macro`, `tyalias`, `typealias`, `prim` or `primitive`.
|
||||
|
||||
You can also disambiguate for functions by adding `()` after the function name,
|
||||
or for macros by adding `!` after the macro name. The macro `!` can be followed by `()`, `{}`,
|
||||
|
@ -130,6 +130,7 @@ impl Res {
|
||||
DefKind::Static { .. } => "static",
|
||||
DefKind::Field => "field",
|
||||
DefKind::Variant | DefKind::Ctor(..) => "variant",
|
||||
DefKind::TyAlias => "tyalias",
|
||||
// Now handle things that don't have a specific disambiguator
|
||||
_ => match kind
|
||||
.ns()
|
||||
@ -1708,6 +1709,7 @@ impl Disambiguator {
|
||||
"value" => NS(Namespace::ValueNS),
|
||||
"macro" => NS(Namespace::MacroNS),
|
||||
"prim" | "primitive" => Primitive,
|
||||
"tyalias" | "typealias" => Kind(DefKind::TyAlias),
|
||||
_ => return Err((format!("unknown disambiguator `{prefix}`"), 0..idx)),
|
||||
};
|
||||
|
||||
|
@ -153,7 +153,7 @@ pub mod redundant_imports_issue {
|
||||
() => {};
|
||||
}
|
||||
|
||||
#[expect(redundant_imports)]
|
||||
#[expect(unused_imports)]
|
||||
pub(crate) use empty;
|
||||
|
||||
empty!();
|
||||
|
@ -153,7 +153,7 @@ pub mod redundant_imports_issue {
|
||||
() => {};
|
||||
}
|
||||
|
||||
#[expect(redundant_imports)]
|
||||
#[expect(unused_imports)]
|
||||
pub(crate) use empty;
|
||||
|
||||
empty!();
|
||||
|
@ -12,7 +12,7 @@ use tracing::debug;
|
||||
|
||||
use crate::{
|
||||
ExpandError, ExpandResult, MacroCallId,
|
||||
builtin::quote::{dollar_crate, quote},
|
||||
builtin::quote::dollar_crate,
|
||||
db::ExpandDatabase,
|
||||
hygiene::span_with_def_site_ctxt,
|
||||
name::{self, AsName, Name},
|
||||
|
@ -19,7 +19,7 @@ use syntax_bridge::syntax_node_to_token_tree;
|
||||
|
||||
use crate::{
|
||||
EditionedFileId, ExpandError, ExpandResult, Lookup as _, MacroCallId,
|
||||
builtin::quote::{WithDelimiter, dollar_crate, quote},
|
||||
builtin::quote::{WithDelimiter, dollar_crate},
|
||||
db::ExpandDatabase,
|
||||
hygiene::{span_with_call_site_ctxt, span_with_def_site_ctxt},
|
||||
name,
|
||||
|
@ -229,8 +229,6 @@ mod tests {
|
||||
use span::{Edition, ROOT_ERASED_FILE_AST_ID, SpanAnchor, SyntaxContext};
|
||||
use syntax::{TextRange, TextSize};
|
||||
|
||||
use super::quote;
|
||||
|
||||
const DUMMY: tt::Span = tt::Span {
|
||||
range: TextRange::empty(TextSize::new(0)),
|
||||
anchor: SpanAnchor {
|
||||
|
@ -516,7 +516,6 @@ mod test {
|
||||
#[allow(dead_code)]
|
||||
mod mock {
|
||||
use super::super::*;
|
||||
use crate::config_option_with_style_edition_default;
|
||||
use rustfmt_config_proc_macro::config_type;
|
||||
|
||||
#[config_type]
|
||||
|
@ -0,0 +1,21 @@
|
||||
// Ensure that no warning is emitted if the disambiguator is used for type alias.
|
||||
// Regression test for <https://github.com/rust-lang/rust/issues/146855>.
|
||||
|
||||
#![deny(rustdoc::broken_intra_doc_links)]
|
||||
|
||||
pub struct Foo;
|
||||
|
||||
#[allow(non_camel_case_types)]
|
||||
pub type f32 = Foo;
|
||||
|
||||
/// This function returns [`f32`].
|
||||
//~^ ERROR: `f32` is both a type alias and a primitive type
|
||||
//~| HELP: to link to the type alias, prefix with `tyalias@`
|
||||
//~| HELP: to link to the primitive type, prefix with `prim@`
|
||||
pub fn my_fn() -> f32 {}
|
||||
|
||||
/// This function returns [type@f32].
|
||||
//~^ ERROR: `f32` is both a type alias and a primitive type
|
||||
//~| HELP: to link to the type alias, prefix with `tyalias@`
|
||||
//~| HELP: to link to the primitive type, prefix with `prim@`
|
||||
pub fn my_fn2() -> f32 {}
|
@ -0,0 +1,39 @@
|
||||
error: `f32` is both a type alias and a primitive type
|
||||
--> $DIR/type-alias-primitive-suggestion.rs:11:29
|
||||
|
|
||||
LL | /// This function returns [`f32`].
|
||||
| ^^^ ambiguous link
|
||||
|
|
||||
note: the lint level is defined here
|
||||
--> $DIR/type-alias-primitive-suggestion.rs:4:9
|
||||
|
|
||||
LL | #![deny(rustdoc::broken_intra_doc_links)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
help: to link to the type alias, prefix with `tyalias@`
|
||||
|
|
||||
LL | /// This function returns [`tyalias@f32`].
|
||||
| ++++++++
|
||||
help: to link to the primitive type, prefix with `prim@`
|
||||
|
|
||||
LL | /// This function returns [`prim@f32`].
|
||||
| +++++
|
||||
|
||||
error: `f32` is both a type alias and a primitive type
|
||||
--> $DIR/type-alias-primitive-suggestion.rs:17:28
|
||||
|
|
||||
LL | /// This function returns [type@f32].
|
||||
| ^^^^^^^^ ambiguous link
|
||||
|
|
||||
help: to link to the type alias, prefix with `tyalias@`
|
||||
|
|
||||
LL - /// This function returns [type@f32].
|
||||
LL + /// This function returns [tyalias@f32].
|
||||
|
|
||||
help: to link to the primitive type, prefix with `prim@`
|
||||
|
|
||||
LL - /// This function returns [type@f32].
|
||||
LL + /// This function returns [prim@f32].
|
||||
|
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
14
tests/rustdoc-ui/intra-doc/type-alias-primitive.rs
Normal file
14
tests/rustdoc-ui/intra-doc/type-alias-primitive.rs
Normal file
@ -0,0 +1,14 @@
|
||||
// Ensure that no warning is emitted if the disambiguator is used for type alias.
|
||||
// Regression test for <https://github.com/rust-lang/rust/issues/146855>.
|
||||
|
||||
//@ check-pass
|
||||
|
||||
#![deny(rustdoc::broken_intra_doc_links)]
|
||||
|
||||
pub struct Foo;
|
||||
|
||||
#[allow(non_camel_case_types)]
|
||||
pub type f32 = Foo;
|
||||
|
||||
/// This function returns [`tyalias@f32`] and not [`prim@f32`].
|
||||
pub fn my_fn() -> f32 {}
|
21
tests/rustdoc/intra-doc/type-alias-primitive.rs
Normal file
21
tests/rustdoc/intra-doc/type-alias-primitive.rs
Normal file
@ -0,0 +1,21 @@
|
||||
// Ensure that no warning is emitted if the disambiguator is used for type alias.
|
||||
// Regression test for <https://github.com/rust-lang/rust/issues/146855>.
|
||||
|
||||
#![crate_name = "foo"]
|
||||
#![deny(rustdoc::broken_intra_doc_links)]
|
||||
|
||||
pub struct Foo;
|
||||
|
||||
#[allow(non_camel_case_types)]
|
||||
pub type f32 = Foo;
|
||||
|
||||
/// This function returns [`tyalias@f32`] and not [bla][`prim@f32`].
|
||||
//@ has 'foo/fn.my_fn.html'
|
||||
//@ has - '//a[@href="type.f32.html"]' "f32"
|
||||
//@ has - '//a[@href="{{channel}}/std/primitive.f32.html"]' "bla"
|
||||
pub fn my_fn() -> f32 { 0. }
|
||||
|
||||
/// This function returns [`typealias@f32`].
|
||||
//@ has 'foo/fn.my_other_fn.html'
|
||||
//@ has - '//a[@href="type.f32.html"]' "f32"
|
||||
pub fn my_other_fn() -> f32 { 0. }
|
@ -1,6 +1,7 @@
|
||||
//@ run-pass
|
||||
//@ needs-unwind
|
||||
//@ needs-threads
|
||||
//@ ignore-backends: gcc
|
||||
|
||||
#![allow(overflowing_literals)]
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
//@ run-pass
|
||||
//@ needs-unwind
|
||||
//@ needs-threads
|
||||
//@ ignore-backends: gcc
|
||||
|
||||
#![allow(overflowing_literals)]
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
//@ run-pass
|
||||
//@ needs-unwind
|
||||
//@ needs-threads
|
||||
//@ ignore-backends: gcc
|
||||
|
||||
#![allow(overflowing_literals)]
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
//@ run-pass
|
||||
//@ needs-unwind
|
||||
//@ needs-threads
|
||||
//@ ignore-backends: gcc
|
||||
|
||||
// Test that if a slicing expr[..] fails, the correct cleanups happen.
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
//@ run-pass
|
||||
//@ needs-unwind
|
||||
//@ needs-threads
|
||||
//@ ignore-backends: gcc
|
||||
|
||||
// Test that if a slicing expr[..] fails, the correct cleanups happen.
|
||||
|
||||
|
@ -18,6 +18,7 @@
|
||||
|
||||
//@ build-pass
|
||||
//@ needs-asm-support
|
||||
//@ ignore-backends: gcc
|
||||
|
||||
use std::arch::global_asm;
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
//@ only-x86_64
|
||||
//@ run-pass
|
||||
//@ needs-asm-support
|
||||
//@ ignore-backends: gcc
|
||||
|
||||
#![deny(unreachable_code)]
|
||||
#![feature(asm_goto_with_outputs)]
|
||||
|
@ -1,5 +1,5 @@
|
||||
warning: unreachable statement
|
||||
--> $DIR/goto.rs:143:9
|
||||
--> $DIR/goto.rs:144:9
|
||||
|
|
||||
LL | / asm!(
|
||||
LL | | "jmp {}",
|
||||
@ -13,7 +13,7 @@ LL | unreachable!();
|
||||
| ^^^^^^^^^^^^^^ unreachable statement
|
||||
|
|
||||
note: the lint level is defined here
|
||||
--> $DIR/goto.rs:133:8
|
||||
--> $DIR/goto.rs:134:8
|
||||
|
|
||||
LL | #[warn(unreachable_code)]
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
@ -1,6 +1,7 @@
|
||||
//@ only-x86_64
|
||||
//@ build-fail
|
||||
//@ compile-flags: -Ccodegen-units=1
|
||||
//@ ignore-backends: gcc
|
||||
|
||||
use std::arch::asm;
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
error: invalid instruction mnemonic 'invalid_instruction'
|
||||
--> $DIR/srcloc.rs:11:15
|
||||
--> $DIR/srcloc.rs:12:15
|
||||
|
|
||||
LL | asm!("invalid_instruction");
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
@ -11,7 +11,7 @@ LL | invalid_instruction
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: invalid instruction mnemonic 'invalid_instruction'
|
||||
--> $DIR/srcloc.rs:15:13
|
||||
--> $DIR/srcloc.rs:16:13
|
||||
|
|
||||
LL | invalid_instruction
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
@ -23,7 +23,7 @@ LL | invalid_instruction
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: invalid instruction mnemonic 'invalid_instruction'
|
||||
--> $DIR/srcloc.rs:20:13
|
||||
--> $DIR/srcloc.rs:21:13
|
||||
|
|
||||
LL | invalid_instruction
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
@ -35,7 +35,7 @@ LL | invalid_instruction
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: invalid instruction mnemonic 'invalid_instruction'
|
||||
--> $DIR/srcloc.rs:26:13
|
||||
--> $DIR/srcloc.rs:27:13
|
||||
|
|
||||
LL | invalid_instruction
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
@ -47,7 +47,7 @@ LL | invalid_instruction
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: invalid instruction mnemonic 'invalid_instruction'
|
||||
--> $DIR/srcloc.rs:33:13
|
||||
--> $DIR/srcloc.rs:34:13
|
||||
|
|
||||
LL | invalid_instruction
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
@ -59,7 +59,7 @@ LL | invalid_instruction
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: invalid instruction mnemonic 'invalid_instruction'
|
||||
--> $DIR/srcloc.rs:38:14
|
||||
--> $DIR/srcloc.rs:39:14
|
||||
|
|
||||
LL | asm!(concat!("invalid", "_", "instruction"));
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -71,7 +71,7 @@ LL | invalid_instruction
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
warning: scale factor without index register is ignored
|
||||
--> $DIR/srcloc.rs:41:15
|
||||
--> $DIR/srcloc.rs:42:15
|
||||
|
|
||||
LL | asm!("movaps %xmm3, (%esi, 2)", options(att_syntax));
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -83,7 +83,7 @@ LL | movaps %xmm3, (%esi, 2)
|
||||
| ^
|
||||
|
||||
error: invalid instruction mnemonic 'invalid_instruction'
|
||||
--> $DIR/srcloc.rs:45:14
|
||||
--> $DIR/srcloc.rs:46:14
|
||||
|
|
||||
LL | "invalid_instruction",
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
@ -95,7 +95,7 @@ LL | invalid_instruction
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: invalid instruction mnemonic 'invalid_instruction'
|
||||
--> $DIR/srcloc.rs:51:14
|
||||
--> $DIR/srcloc.rs:52:14
|
||||
|
|
||||
LL | "invalid_instruction",
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
@ -107,7 +107,7 @@ LL | invalid_instruction
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: invalid instruction mnemonic 'invalid_instruction'
|
||||
--> $DIR/srcloc.rs:58:14
|
||||
--> $DIR/srcloc.rs:59:14
|
||||
|
|
||||
LL | "invalid_instruction",
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
@ -119,7 +119,7 @@ LL | invalid_instruction
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: invalid instruction mnemonic 'invalid_instruction'
|
||||
--> $DIR/srcloc.rs:65:13
|
||||
--> $DIR/srcloc.rs:66:13
|
||||
|
|
||||
LL | concat!("invalid", "_", "instruction"),
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -131,7 +131,7 @@ LL | invalid_instruction
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: invalid instruction mnemonic 'invalid_instruction'
|
||||
--> $DIR/srcloc.rs:72:13
|
||||
--> $DIR/srcloc.rs:73:13
|
||||
|
|
||||
LL | concat!("invalid", "_", "instruction"),
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -143,7 +143,7 @@ LL | invalid_instruction
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: invalid instruction mnemonic 'invalid_instruction1'
|
||||
--> $DIR/srcloc.rs:79:14
|
||||
--> $DIR/srcloc.rs:80:14
|
||||
|
|
||||
LL | "invalid_instruction1",
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
@ -155,7 +155,7 @@ LL | invalid_instruction1
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: invalid instruction mnemonic 'invalid_instruction2'
|
||||
--> $DIR/srcloc.rs:80:14
|
||||
--> $DIR/srcloc.rs:81:14
|
||||
|
|
||||
LL | "invalid_instruction2",
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
@ -167,7 +167,7 @@ LL | invalid_instruction2
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: invalid instruction mnemonic 'invalid_instruction1'
|
||||
--> $DIR/srcloc.rs:86:13
|
||||
--> $DIR/srcloc.rs:87:13
|
||||
|
|
||||
LL | / concat!(
|
||||
LL | | "invalid", "_", "instruction1", "\n",
|
||||
@ -182,7 +182,7 @@ LL | invalid_instruction1
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: invalid instruction mnemonic 'invalid_instruction2'
|
||||
--> $DIR/srcloc.rs:86:13
|
||||
--> $DIR/srcloc.rs:87:13
|
||||
|
|
||||
LL | / concat!(
|
||||
LL | | "invalid", "_", "instruction1", "\n",
|
||||
@ -197,7 +197,7 @@ LL | invalid_instruction2
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: invalid instruction mnemonic 'invalid_instruction1'
|
||||
--> $DIR/srcloc.rs:95:13
|
||||
--> $DIR/srcloc.rs:96:13
|
||||
|
|
||||
LL | / concat!(
|
||||
LL | | "invalid", "_", "instruction1", "\n",
|
||||
@ -212,7 +212,7 @@ LL | invalid_instruction1
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: invalid instruction mnemonic 'invalid_instruction2'
|
||||
--> $DIR/srcloc.rs:95:13
|
||||
--> $DIR/srcloc.rs:96:13
|
||||
|
|
||||
LL | / concat!(
|
||||
LL | | "invalid", "_", "instruction1", "\n",
|
||||
@ -227,7 +227,7 @@ LL | invalid_instruction2
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: invalid instruction mnemonic 'invalid_instruction3'
|
||||
--> $DIR/srcloc.rs:99:13
|
||||
--> $DIR/srcloc.rs:100:13
|
||||
|
|
||||
LL | / concat!(
|
||||
LL | | "invalid", "_", "instruction3", "\n",
|
||||
@ -242,7 +242,7 @@ LL | invalid_instruction3
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: invalid instruction mnemonic 'invalid_instruction4'
|
||||
--> $DIR/srcloc.rs:99:13
|
||||
--> $DIR/srcloc.rs:100:13
|
||||
|
|
||||
LL | / concat!(
|
||||
LL | | "invalid", "_", "instruction3", "\n",
|
||||
@ -257,7 +257,7 @@ LL | invalid_instruction4
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: invalid instruction mnemonic 'invalid_instruction1'
|
||||
--> $DIR/srcloc.rs:110:13
|
||||
--> $DIR/srcloc.rs:111:13
|
||||
|
|
||||
LL | / concat!(
|
||||
LL | | "invalid", "_", "instruction1", "\n",
|
||||
@ -272,7 +272,7 @@ LL | invalid_instruction1
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: invalid instruction mnemonic 'invalid_instruction2'
|
||||
--> $DIR/srcloc.rs:110:13
|
||||
--> $DIR/srcloc.rs:111:13
|
||||
|
|
||||
LL | / concat!(
|
||||
LL | | "invalid", "_", "instruction1", "\n",
|
||||
@ -287,7 +287,7 @@ LL | invalid_instruction2
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: invalid instruction mnemonic 'invalid_instruction3'
|
||||
--> $DIR/srcloc.rs:114:13
|
||||
--> $DIR/srcloc.rs:115:13
|
||||
|
|
||||
LL | / concat!(
|
||||
LL | | "invalid", "_", "instruction3", "\n",
|
||||
@ -302,7 +302,7 @@ LL | invalid_instruction3
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: invalid instruction mnemonic 'invalid_instruction4'
|
||||
--> $DIR/srcloc.rs:114:13
|
||||
--> $DIR/srcloc.rs:115:13
|
||||
|
|
||||
LL | / concat!(
|
||||
LL | | "invalid", "_", "instruction3", "\n",
|
||||
@ -317,7 +317,7 @@ LL | invalid_instruction4
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: invalid instruction mnemonic 'invalid_instruction'
|
||||
--> $DIR/srcloc.rs:127:14
|
||||
--> $DIR/srcloc.rs:128:14
|
||||
|
|
||||
LL | "invalid_instruction"
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -1,5 +1,6 @@
|
||||
//@ run-pass
|
||||
//@ ignore-wasm32 aligning functions is not currently supported on wasm (#143368)
|
||||
//@ ignore-backends: gcc
|
||||
|
||||
// FIXME(#82232, #143834): temporarily renamed to mitigate `#[align]` nameres ambiguity
|
||||
#![feature(rustc_attrs)]
|
||||
|
@ -2,6 +2,7 @@
|
||||
//@ proc-macro: tokyo.rs
|
||||
//@ compile-flags:--extern tokyo
|
||||
//@ edition:2021
|
||||
//@ ignore-backends: gcc
|
||||
|
||||
use tokyo::main;
|
||||
|
||||
|
@ -185,8 +185,7 @@ extern "C" {
|
||||
#[forbid]
|
||||
//~^ ERROR malformed
|
||||
#[debugger_visualizer]
|
||||
//~^ ERROR invalid argument
|
||||
//~| ERROR malformed `debugger_visualizer` attribute input
|
||||
//~^ ERROR malformed `debugger_visualizer` attribute input
|
||||
#[automatically_derived = 18]
|
||||
//~^ ERROR malformed
|
||||
mod yooo {
|
||||
|
@ -22,7 +22,7 @@ LL | #[cfg_attr(condition, attribute, other_attribute, ...)]
|
||||
| ++++++++++++++++++++++++++++++++++++++++++++
|
||||
|
||||
error[E0463]: can't find crate for `wloop`
|
||||
--> $DIR/malformed-attrs.rs:210:1
|
||||
--> $DIR/malformed-attrs.rs:209:1
|
||||
|
|
||||
LL | extern crate wloop;
|
||||
| ^^^^^^^^^^^^^^^^^^^ can't find crate
|
||||
@ -156,22 +156,14 @@ LL | #[forbid(lint1, lint2, ...)]
|
||||
LL | #[forbid(lint1, lint2, lint3, reason = "...")]
|
||||
| +++++++++++++++++++++++++++++++++++++
|
||||
|
||||
error: malformed `debugger_visualizer` attribute input
|
||||
--> $DIR/malformed-attrs.rs:187:1
|
||||
|
|
||||
LL | #[debugger_visualizer]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#[debugger_visualizer(natvis_file = "...", gdb_script_file = "...")]`
|
||||
|
|
||||
= note: for more information, visit <https://doc.rust-lang.org/reference/attributes/debugger.html#the-debugger_visualizer-attribute>
|
||||
|
||||
error: malformed `thread_local` attribute input
|
||||
--> $DIR/malformed-attrs.rs:202:1
|
||||
--> $DIR/malformed-attrs.rs:201:1
|
||||
|
|
||||
LL | #[thread_local()]
|
||||
| ^^^^^^^^^^^^^^^^^ help: must be of the form: `#[thread_local]`
|
||||
|
||||
error: malformed `no_link` attribute input
|
||||
--> $DIR/malformed-attrs.rs:206:1
|
||||
--> $DIR/malformed-attrs.rs:205:1
|
||||
|
|
||||
LL | #[no_link()]
|
||||
| ^^^^^^^^^^^^ help: must be of the form: `#[no_link]`
|
||||
@ -197,7 +189,7 @@ LL | #[proc_macro_derive]
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0658]: allow_internal_unsafe side-steps the unsafe_code lint
|
||||
--> $DIR/malformed-attrs.rs:215:1
|
||||
--> $DIR/malformed-attrs.rs:214:1
|
||||
|
|
||||
LL | #[allow_internal_unsafe = 1]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -226,16 +218,6 @@ LL | #[doc]
|
||||
= note: for more information, see issue #57571 <https://github.com/rust-lang/rust/issues/57571>
|
||||
= note: for more information, visit <https://doc.rust-lang.org/rustdoc/write-documentation/the-doc-attribute.html>
|
||||
|
||||
error: invalid argument
|
||||
--> $DIR/malformed-attrs.rs:187:1
|
||||
|
|
||||
LL | #[debugger_visualizer]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: expected: `natvis_file = "..."`
|
||||
= note: OR
|
||||
= note: expected: `gdb_script_file = "..."`
|
||||
|
||||
error[E0539]: malformed `export_name` attribute input
|
||||
--> $DIR/malformed-attrs.rs:29:1
|
||||
|
|
||||
@ -685,8 +667,19 @@ LL | #[linkage = "external"]
|
||||
| ++++++++++++
|
||||
= and 5 other candidates
|
||||
|
||||
error[E0539]: malformed `debugger_visualizer` attribute input
|
||||
--> $DIR/malformed-attrs.rs:187:1
|
||||
|
|
||||
LL | #[debugger_visualizer]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||
| |
|
||||
| expected this to be a list
|
||||
| help: must be of the form: `#[debugger_visualizer(natvis_file = "...", gdb_script_file = "...")]`
|
||||
|
|
||||
= note: for more information, visit <https://doc.rust-lang.org/reference/attributes/debugger.html#the-debugger_visualizer-attribute>
|
||||
|
||||
error[E0565]: malformed `automatically_derived` attribute input
|
||||
--> $DIR/malformed-attrs.rs:190:1
|
||||
--> $DIR/malformed-attrs.rs:189:1
|
||||
|
|
||||
LL | #[automatically_derived = 18]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^----^
|
||||
@ -695,7 +688,7 @@ LL | #[automatically_derived = 18]
|
||||
| help: must be of the form: `#[automatically_derived]`
|
||||
|
||||
error[E0565]: malformed `non_exhaustive` attribute input
|
||||
--> $DIR/malformed-attrs.rs:196:1
|
||||
--> $DIR/malformed-attrs.rs:195:1
|
||||
|
|
||||
LL | #[non_exhaustive = 1]
|
||||
| ^^^^^^^^^^^^^^^^^---^
|
||||
@ -704,19 +697,19 @@ LL | #[non_exhaustive = 1]
|
||||
| help: must be of the form: `#[non_exhaustive]`
|
||||
|
||||
error: valid forms for the attribute are `#[macro_use(name1, name2, ...)]` and `#[macro_use]`
|
||||
--> $DIR/malformed-attrs.rs:208:1
|
||||
--> $DIR/malformed-attrs.rs:207:1
|
||||
|
|
||||
LL | #[macro_use = 1]
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
||||
error: valid forms for the attribute are `#![macro_export(local_inner_macros)]` and `#![macro_export]`
|
||||
--> $DIR/malformed-attrs.rs:213:1
|
||||
--> $DIR/malformed-attrs.rs:212:1
|
||||
|
|
||||
LL | #[macro_export = 18]
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0565]: malformed `allow_internal_unsafe` attribute input
|
||||
--> $DIR/malformed-attrs.rs:215:1
|
||||
--> $DIR/malformed-attrs.rs:214:1
|
||||
|
|
||||
LL | #[allow_internal_unsafe = 1]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^---^
|
||||
@ -800,7 +793,7 @@ LL | #[ignore()]
|
||||
= note: for more information, see issue #57571 <https://github.com/rust-lang/rust/issues/57571>
|
||||
|
||||
error: valid forms for the attribute are `#[ignore = "reason"]` and `#[ignore]`
|
||||
--> $DIR/malformed-attrs.rs:222:1
|
||||
--> $DIR/malformed-attrs.rs:221:1
|
||||
|
|
||||
LL | #[ignore = 1]
|
||||
| ^^^^^^^^^^^^^
|
||||
@ -819,7 +812,7 @@ LL | #[coroutine = 63] || {}
|
||||
= note: expected unit type `()`
|
||||
found coroutine `{coroutine@$DIR/malformed-attrs.rs:110:23: 110:25}`
|
||||
|
||||
error: aborting due to 77 previous errors; 3 warnings emitted
|
||||
error: aborting due to 76 previous errors; 3 warnings emitted
|
||||
|
||||
Some errors have detailed explanations: E0308, E0463, E0539, E0565, E0658, E0805.
|
||||
For more information about an error, try `rustc --explain E0308`.
|
||||
@ -871,7 +864,7 @@ LL | #[ignore()]
|
||||
|
||||
Future breakage diagnostic:
|
||||
error: valid forms for the attribute are `#[ignore = "reason"]` and `#[ignore]`
|
||||
--> $DIR/malformed-attrs.rs:222:1
|
||||
--> $DIR/malformed-attrs.rs:221:1
|
||||
|
|
||||
LL | #[ignore = 1]
|
||||
| ^^^^^^^^^^^^^
|
||||
|
@ -4,6 +4,7 @@
|
||||
//@ exec-env:RUST_BACKTRACE=0
|
||||
//@ needs-threads
|
||||
//@ needs-unwind
|
||||
//@ ignore-backends: gcc
|
||||
use std::thread;
|
||||
const PANIC_MESSAGE: &str = "oops oh no woe is me";
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
|
||||
thread '<unnamed>' ($TID) panicked at $DIR/synchronized-panic-handler.rs:11:5:
|
||||
thread '<unnamed>' ($TID) panicked at $DIR/synchronized-panic-handler.rs:12:5:
|
||||
oops oh no woe is me
|
||||
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
|
||||
|
||||
thread '<unnamed>' ($TID) panicked at $DIR/synchronized-panic-handler.rs:11:5:
|
||||
thread '<unnamed>' ($TID) panicked at $DIR/synchronized-panic-handler.rs:12:5:
|
||||
oops oh no woe is me
|
||||
|
@ -1,6 +1,7 @@
|
||||
//@ run-pass
|
||||
//@ needs-unwind
|
||||
//@ needs-threads
|
||||
//@ ignore-backends: gcc
|
||||
|
||||
use std::thread;
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
//@ run-pass
|
||||
//@ ignore-backends: gcc
|
||||
#![feature(c_variadic)]
|
||||
|
||||
#[repr(transparent)]
|
||||
|
@ -1,4 +1,5 @@
|
||||
//@ run-pass
|
||||
//@ ignore-backends: gcc
|
||||
#![feature(c_variadic)]
|
||||
|
||||
#[repr(transparent)]
|
||||
|
@ -1,4 +1,5 @@
|
||||
//@ run-pass
|
||||
//@ ignore-backends: gcc
|
||||
#![feature(c_variadic)]
|
||||
|
||||
// In rust (and C23 and above) `...` can be the only argument.
|
||||
|
@ -2,6 +2,7 @@
|
||||
//@ proc-macro: ver-cfg-rel.rs
|
||||
//@ revisions: assume no_assume
|
||||
//@ [assume]compile-flags: -Z assume-incomplete-release
|
||||
//@ ignore-backends: gcc
|
||||
|
||||
#![feature(cfg_version)]
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
//@ run-pass
|
||||
//@ compile-flags: -Ccodegen-units=1 -Cllvm-args=--inline-threshold=0 -Clink-dead-code -Copt-level=0 -Cdebuginfo=2
|
||||
//@ ignore-backends: gcc
|
||||
|
||||
// Make sure LLVM does not miscompile this.
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
//@ compile-flags: -Cllvm-args=-not-a-real-llvm-arg
|
||||
//@ normalize-stderr: "--help" -> "-help"
|
||||
//@ normalize-stderr: "\n(\n|.)*" -> ""
|
||||
//@ ignore-backends: gcc
|
||||
|
||||
// I'm seeing "--help" locally, but "-help" in CI, so I'm normalizing it to just "-help".
|
||||
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
//@ dont-check-compiler-stderr
|
||||
//@ dont-require-annotations: NOTE
|
||||
//@ ignore-backends: gcc
|
||||
|
||||
#[no_mangle]
|
||||
#[inline(never)]
|
||||
|
@ -2,6 +2,7 @@
|
||||
//@ compile-flags: -Zvirtual-function-elimination=true -Clto=true
|
||||
//@ only-x86_64
|
||||
//@ no-prefer-dynamic
|
||||
//@ ignore-backends: gcc
|
||||
|
||||
// issue #123955
|
||||
pub fn test0() {
|
||||
|
@ -1,6 +1,7 @@
|
||||
//@ edition: 2024
|
||||
//@ run-pass
|
||||
//@ needs-unwind
|
||||
//@ ignore-backends: gcc
|
||||
#![feature(gen_blocks)]
|
||||
|
||||
fn main() {
|
||||
|
@ -1,5 +1,5 @@
|
||||
warning: unreachable statement
|
||||
--> $DIR/gen_block_panic.rs:10:9
|
||||
--> $DIR/gen_block_panic.rs:11:9
|
||||
|
|
||||
LL | panic!("foo");
|
||||
| ------------- any code following this expression is unreachable
|
||||
|
@ -1,4 +1,5 @@
|
||||
//@ aux-crate:fn_header_aux=fn-header-aux.rs
|
||||
//@ ignore-backends: gcc
|
||||
|
||||
#![feature(c_variadic)]
|
||||
#![feature(fn_delegation)]
|
||||
|
@ -1,5 +1,5 @@
|
||||
error: delegation to C-variadic functions is not allowed
|
||||
--> $DIR/fn-header-variadic.rs:11:17
|
||||
--> $DIR/fn-header-variadic.rs:12:17
|
||||
|
|
||||
LL | pub unsafe extern "C" fn variadic_fn(n: usize, mut args: ...) {}
|
||||
| ------------------------------------------------------------- callee defined here
|
||||
@ -8,7 +8,7 @@ LL | reuse to_reuse::variadic_fn;
|
||||
| ^^^^^^^^^^^
|
||||
|
||||
error: delegation to C-variadic functions is not allowed
|
||||
--> $DIR/fn-header-variadic.rs:13:22
|
||||
--> $DIR/fn-header-variadic.rs:14:22
|
||||
|
|
||||
LL | reuse fn_header_aux::variadic_fn_extern;
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
|
@ -4,6 +4,7 @@
|
||||
#![allow(unused_variables)]
|
||||
//@ needs-threads
|
||||
//@ needs-unwind
|
||||
//@ ignore-backends: gcc
|
||||
|
||||
use std::thread;
|
||||
use std::sync::mpsc::{channel, Sender};
|
||||
|
@ -1,6 +1,7 @@
|
||||
//@ run-pass
|
||||
//@ needs-unwind
|
||||
//@ needs-threads
|
||||
//@ ignore-backends: gcc
|
||||
|
||||
// Issue #787
|
||||
// Don't try to clean up uninitialized locals
|
||||
|
@ -1,5 +1,6 @@
|
||||
//@ run-pass
|
||||
//@ ignore-pass
|
||||
//@ ignore-backends: gcc
|
||||
#![expect(incomplete_features)]
|
||||
#![feature(explicit_tail_calls)]
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
warning: tail calling a function marked with `#[track_caller]` has no special effect
|
||||
--> $DIR/callee_is_track_caller.rs:7:12
|
||||
--> $DIR/callee_is_track_caller.rs:8:12
|
||||
|
|
||||
LL | become b(x);
|
||||
| ^^^^
|
||||
|
@ -1,5 +1,6 @@
|
||||
//@ run-pass
|
||||
//@ ignore-pass
|
||||
//@ ignore-backends: gcc
|
||||
#![expect(incomplete_features)]
|
||||
#![feature(explicit_tail_calls)]
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
warning: tail calling a function marked with `#[track_caller]` has no special effect
|
||||
--> $DIR/callee_is_track_caller_polymorphic.rs:7:12
|
||||
--> $DIR/callee_is_track_caller_polymorphic.rs:8:12
|
||||
|
|
||||
LL | become T::f();
|
||||
| ^^^^^^
|
||||
|
@ -1,4 +1,5 @@
|
||||
//@ run-pass
|
||||
//@ ignore-backends: gcc
|
||||
#![expect(incomplete_features)]
|
||||
#![feature(explicit_tail_calls)]
|
||||
use std::cell::RefCell;
|
||||
|
@ -1,4 +1,5 @@
|
||||
//@ run-pass
|
||||
//@ ignore-backends: gcc
|
||||
// Indexing taken from
|
||||
// https://github.com/phi-go/rfcs/blob/guaranteed-tco/text%2F0000-explicit-tail-calls.md#tail-call-elimination
|
||||
// no other test has utilized the "function table"
|
||||
|
@ -1,4 +1,5 @@
|
||||
//@ run-pass
|
||||
//@ ignore-backends: gcc
|
||||
#![expect(incomplete_features)]
|
||||
#![feature(explicit_tail_calls)]
|
||||
|
||||
|
1
tests/ui/extern/extern-types-field-offset.rs
vendored
1
tests/ui/extern/extern-types-field-offset.rs
vendored
@ -2,6 +2,7 @@
|
||||
//@ check-run-results
|
||||
//@ exec-env:RUST_BACKTRACE=0
|
||||
//@ normalize-stderr: "(core/src/panicking\.rs):[0-9]+:[0-9]+" -> "$1:$$LINE:$$COL"
|
||||
//@ ignore-backends: gcc
|
||||
#![feature(extern_types)]
|
||||
|
||||
extern "C" {
|
||||
|
@ -21,6 +21,7 @@
|
||||
//@[no]compile-flags: -C lto=no
|
||||
//@[thin]compile-flags: -C lto=thin
|
||||
//@[fat]compile-flags: -C lto=fat
|
||||
//@ ignore-backends: gcc
|
||||
|
||||
#![feature(panic_internals)]
|
||||
|
||||
|
@ -48,6 +48,7 @@
|
||||
//@[fat1]compile-flags: -C opt-level=1 -C lto=fat
|
||||
//@[fat2]compile-flags: -C opt-level=2 -C lto=fat
|
||||
//@[fat3]compile-flags: -C opt-level=3 -C lto=fat
|
||||
//@ ignore-backends: gcc
|
||||
|
||||
fn main() {
|
||||
use std::sync::atomic::{AtomicUsize, Ordering};
|
||||
|
@ -1,4 +1,5 @@
|
||||
//@ proc-macro: format-string-proc-macro.rs
|
||||
//@ ignore-backends: gcc
|
||||
|
||||
extern crate format_string_proc_macro;
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
error: there is no argument named `x`
|
||||
--> $DIR/format-args-capture-from-pm-first-arg-macro.rs:6:5
|
||||
--> $DIR/format-args-capture-from-pm-first-arg-macro.rs:7:5
|
||||
|
|
||||
LL | format_string_proc_macro::bad_format_args_captures!();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -1,6 +1,7 @@
|
||||
//@ check-pass
|
||||
//@ proc-macro: makro.rs
|
||||
//@ edition: 2021
|
||||
//@ ignore-backends: gcc
|
||||
|
||||
// Check that a proc-macro doesn't try to parse frontmatter and instead treats
|
||||
// it as a regular Rust token sequence. See `auxiliary/makro.rs` for details.
|
||||
|
@ -1,5 +1,6 @@
|
||||
//@ build-pass
|
||||
//@ aux-build:def-site-async-await.rs
|
||||
//@ ignore-backends: gcc
|
||||
|
||||
// Regression test for issue #77523
|
||||
// Tests that we don't ICE when an unusual combination
|
||||
|
@ -6,6 +6,7 @@
|
||||
//@ aux-crate: no_use_macro=no-use-macro.rs
|
||||
//@ edition: 2024
|
||||
//@ check-pass
|
||||
//@ ignore-backends: gcc
|
||||
|
||||
no_use_pm::pm_rpit!{}
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
//@ build-fail
|
||||
//@ compile-flags: -Cpasses=unknown-pass
|
||||
//@ ignore-backends: gcc
|
||||
|
||||
fn main() {}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
//@ normalize-stderr: "foo.random:.*\(" -> "foo.random: $$FILE_NOT_FOUND_MSG ("
|
||||
//@ normalize-stderr: "os error \d+" -> "os error $$FILE_NOT_FOUND_CODE"
|
||||
|
||||
#![debugger_visualizer(random_file = "../foo.random")] //~ ERROR invalid argument
|
||||
#![debugger_visualizer(random_file = "../foo.random")] //~ ERROR malformed `debugger_visualizer` attribute input
|
||||
#![debugger_visualizer(natvis_file = "../foo.random")] //~ ERROR
|
||||
fn main() {}
|
||||
|
@ -1,18 +1,20 @@
|
||||
error: invalid argument
|
||||
--> $DIR/invalid-debugger-visualizer-option.rs:4:24
|
||||
|
|
||||
LL | #![debugger_visualizer(random_file = "../foo.random")]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: expected: `natvis_file = "..."`
|
||||
= note: OR
|
||||
= note: expected: `gdb_script_file = "..."`
|
||||
|
||||
error: couldn't read $DIR/../foo.random: $FILE_NOT_FOUND_MSG (os error $FILE_NOT_FOUND_CODE)
|
||||
--> $DIR/invalid-debugger-visualizer-option.rs:5:24
|
||||
|
|
||||
LL | #![debugger_visualizer(natvis_file = "../foo.random")]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0539]: malformed `debugger_visualizer` attribute input
|
||||
--> $DIR/invalid-debugger-visualizer-option.rs:4:1
|
||||
|
|
||||
LL | #![debugger_visualizer(random_file = "../foo.random")]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^-----------^^^^^^^^^^^^^^^^^^^^
|
||||
| | |
|
||||
| | valid arguments are `natvis_file` or `gdb_script_file`
|
||||
| help: must be of the form: `#![debugger_visualizer(natvis_file = "...", gdb_script_file = "...")]`
|
||||
|
|
||||
= note: for more information, visit <https://doc.rust-lang.org/reference/attributes/debugger.html#the-debugger_visualizer-attribute>
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0539`.
|
||||
|
@ -1,2 +1,3 @@
|
||||
#[debugger_visualizer(natvis_file = "./foo.natvis.xml")] //~ ERROR attribute should be applied to a module
|
||||
#[debugger_visualizer(natvis_file = "./foo.natvis.xml")]
|
||||
//~^ ERROR `#[debugger_visualizer]` attribute cannot be used on functions
|
||||
fn main() {}
|
||||
|
@ -1,8 +1,10 @@
|
||||
error: attribute should be applied to a module
|
||||
error: `#[debugger_visualizer]` attribute cannot be used on functions
|
||||
--> $DIR/invalid-debugger-visualizer-target.rs:1:1
|
||||
|
|
||||
LL | #[debugger_visualizer(natvis_file = "./foo.natvis.xml")]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: `#[debugger_visualizer]` can be applied to modules and crates
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
//@ run-pass
|
||||
//@ needs-unwind
|
||||
//@ needs-threads
|
||||
//@ ignore-backends: gcc
|
||||
|
||||
use std::thread;
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user