Auto merge of #127665 - workingjubilee:rollup-g90yr21, r=workingjubilee

Rollup of 11 pull requests

Successful merges:

 - #126502 (Ignore allocation bytes in some mir-opt tests)
 - #126922 (add lint for inline asm labels that look like binary)
 - #127209 (Added the `xop` target-feature and the `xop_target_feature` feature gate)
 - #127310 (Fix import suggestion ice)
 - #127338 (Migrate `extra-filename-with-temp-outputs` and `issue-85019-moved-src-dir` `run-make` tests to rmake)
 - #127381 (Migrate `issue-83045`, `rustc-macro-dep-files` and `env-dep-info` `run-make` tests to rmake)
 - #127535 (Fire unsafe_code lint on unsafe extern blocks)
 - #127619 (Suggest using precise capturing for hidden type that captures region)
 - #127631 (Remove `fully_normalize`)
 - #127632 (Implement `precise_capturing` support for rustdoc)
 - #127660 (Rename the internal `const_strlen` to just `strlen`)

r? `@ghost`
`@rustbot` modify labels: rollup
This commit is contained in:
bors 2024-07-12 22:59:30 +00:00
commit 336e89bd15
140 changed files with 1310 additions and 712 deletions

View File

@ -81,6 +81,7 @@ pub fn from_target_feature(
Some(sym::lahfsahf_target_feature) => rust_features.lahfsahf_target_feature,
Some(sym::prfchw_target_feature) => rust_features.prfchw_target_feature,
Some(sym::x86_amx_intrinsics) => rust_features.x86_amx_intrinsics,
Some(sym::xop_target_feature) => rust_features.xop_target_feature,
Some(name) => bug!("unknown target feature gate {}", name),
None => true,
};

View File

@ -642,6 +642,8 @@ declare_features! (
(unstable, used_with_arg, "1.60.0", Some(93798)),
/// Allows use of x86 `AMX` target-feature attributes and intrinsics
(unstable, x86_amx_intrinsics, "CURRENT_RUSTC_VERSION", Some(126622)),
/// Allows use of the `xop` target-feature
(unstable, xop_target_feature, "CURRENT_RUSTC_VERSION", Some(127208)),
/// Allows `do yeet` expressions
(unstable, yeet_expr, "1.62.0", Some(96373)),
// !!!! !!!! !!!! !!!! !!!! !!!! !!!! !!!! !!!! !!!! !!!!

View File

@ -2708,6 +2708,13 @@ impl PreciseCapturingArg<'_> {
PreciseCapturingArg::Param(param) => param.hir_id,
}
}
pub fn name(self) -> Symbol {
match self {
PreciseCapturingArg::Lifetime(lt) => lt.ident.name,
PreciseCapturingArg::Param(param) => param.ident.name,
}
}
}
/// We need to have a [`Node`] for the [`HirId`] that we attach the type/const param

View File

@ -221,6 +221,10 @@ infer_opaque_hidden_type =
infer_outlives_bound = lifetime of the source pointer does not outlive lifetime bound of the object type
infer_outlives_content = lifetime of reference outlives lifetime of borrowed content...
infer_precise_capturing_existing = add `{$new_lifetime}` to the `use<...>` bound to explicitly capture it
infer_precise_capturing_new = add a `use<...>` bound to explicitly capture `{$new_lifetime}`
infer_prlf_defined_with_sub = the lifetime `{$sub_symbol}` defined here...
infer_prlf_defined_without_sub = the lifetime defined here...
infer_prlf_known_limitation = this is a known limitation that will be removed in the future (see issue #100013 <https://github.com/rust-lang/rust/issues/100013> for more information)

View File

@ -1581,3 +1581,32 @@ pub enum ObligationCauseFailureCode {
subdiags: Vec<TypeErrorAdditionalDiags>,
},
}
#[derive(Subdiagnostic)]
pub enum AddPreciseCapturing {
#[suggestion(
infer_precise_capturing_new,
style = "verbose",
code = " + use<{concatenated_bounds}>",
applicability = "machine-applicable"
)]
New {
#[primary_span]
span: Span,
new_lifetime: Symbol,
concatenated_bounds: String,
},
#[suggestion(
infer_precise_capturing_existing,
style = "verbose",
code = "{pre}{new_lifetime}{post}",
applicability = "machine-applicable"
)]
Existing {
#[primary_span]
span: Span,
new_lifetime: Symbol,
pre: &'static str,
post: &'static str,
},
}

View File

@ -1,5 +1,6 @@
use std::iter;
use rustc_data_structures::fx::FxIndexSet;
use rustc_errors::{
struct_span_code_err, Applicability, Diag, Subdiagnostic, E0309, E0310, E0311, E0495,
};
@ -12,7 +13,7 @@ use rustc_middle::traits::ObligationCauseCode;
use rustc_middle::ty::error::TypeError;
use rustc_middle::ty::{self, IsSuggestable, Region, Ty, TyCtxt, TypeVisitableExt as _};
use rustc_span::symbol::kw;
use rustc_span::{ErrorGuaranteed, Span};
use rustc_span::{BytePos, ErrorGuaranteed, Span, Symbol};
use rustc_type_ir::Upcast as _;
use super::nice_region_error::find_anon_type;
@ -1201,17 +1202,21 @@ pub fn unexpected_hidden_region_diagnostic<'a, 'tcx>(
"",
);
if let Some(reg_info) = tcx.is_suitable_region(generic_param_scope, hidden_region) {
let fn_returns = tcx.return_type_impl_or_dyn_traits(reg_info.def_id);
nice_region_error::suggest_new_region_bound(
tcx,
&mut err,
fn_returns,
hidden_region.to_string(),
None,
format!("captures `{hidden_region}`"),
None,
Some(reg_info.def_id),
)
if infcx.tcx.features().precise_capturing {
suggest_precise_capturing(tcx, opaque_ty_key.def_id, hidden_region, &mut err);
} else {
let fn_returns = tcx.return_type_impl_or_dyn_traits(reg_info.def_id);
nice_region_error::suggest_new_region_bound(
tcx,
&mut err,
fn_returns,
hidden_region.to_string(),
None,
format!("captures `{hidden_region}`"),
None,
Some(reg_info.def_id),
)
}
}
}
ty::RePlaceholder(_) => {
@ -1257,3 +1262,95 @@ pub fn unexpected_hidden_region_diagnostic<'a, 'tcx>(
err
}
fn suggest_precise_capturing<'tcx>(
tcx: TyCtxt<'tcx>,
opaque_def_id: LocalDefId,
captured_lifetime: ty::Region<'tcx>,
diag: &mut Diag<'_>,
) {
let hir::OpaqueTy { bounds, .. } =
tcx.hir_node_by_def_id(opaque_def_id).expect_item().expect_opaque_ty();
let new_lifetime = Symbol::intern(&captured_lifetime.to_string());
if let Some((args, span)) = bounds.iter().find_map(|bound| match bound {
hir::GenericBound::Use(args, span) => Some((args, span)),
_ => None,
}) {
let last_lifetime_span = args.iter().rev().find_map(|arg| match arg {
hir::PreciseCapturingArg::Lifetime(lt) => Some(lt.ident.span),
_ => None,
});
let first_param_span = args.iter().find_map(|arg| match arg {
hir::PreciseCapturingArg::Param(p) => Some(p.ident.span),
_ => None,
});
let (span, pre, post) = if let Some(last_lifetime_span) = last_lifetime_span {
(last_lifetime_span.shrink_to_hi(), ", ", "")
} else if let Some(first_param_span) = first_param_span {
(first_param_span.shrink_to_lo(), "", ", ")
} else {
// If we have no args, then have `use<>` and need to fall back to using
// span math. This sucks, but should be reliable due to the construction
// of the `use<>` span.
(span.with_hi(span.hi() - BytePos(1)).shrink_to_hi(), "", "")
};
diag.subdiagnostic(errors::AddPreciseCapturing::Existing { span, new_lifetime, pre, post });
} else {
let mut captured_lifetimes = FxIndexSet::default();
let mut captured_non_lifetimes = FxIndexSet::default();
let variances = tcx.variances_of(opaque_def_id);
let mut generics = tcx.generics_of(opaque_def_id);
loop {
for param in &generics.own_params {
if variances[param.index as usize] == ty::Bivariant {
continue;
}
match param.kind {
ty::GenericParamDefKind::Lifetime => {
captured_lifetimes.insert(param.name);
}
ty::GenericParamDefKind::Type { synthetic: true, .. } => {
// FIXME: We can't provide a good suggestion for
// `use<...>` if we have an APIT. Bail for now.
return;
}
ty::GenericParamDefKind::Type { .. }
| ty::GenericParamDefKind::Const { .. } => {
captured_non_lifetimes.insert(param.name);
}
}
}
if let Some(parent) = generics.parent {
generics = tcx.generics_of(parent);
} else {
break;
}
}
if !captured_lifetimes.insert(new_lifetime) {
// Uh, strange. This lifetime appears to already be captured...
return;
}
let concatenated_bounds = captured_lifetimes
.into_iter()
.chain(captured_non_lifetimes)
.map(|sym| sym.to_string())
.collect::<Vec<_>>()
.join(", ");
diag.subdiagnostic(errors::AddPreciseCapturing::New {
span: tcx.def_span(opaque_def_id).shrink_to_hi(),
new_lifetime,
concatenated_bounds,
});
}
}

View File

@ -691,6 +691,7 @@ fn test_unstable_options_tracking_hash() {
untracked!(dump_mir, Some(String::from("abc")));
untracked!(dump_mir_dataflow, true);
untracked!(dump_mir_dir, String::from("abc"));
untracked!(dump_mir_exclude_alloc_bytes, true);
untracked!(dump_mir_exclude_pass_number, true);
untracked!(dump_mir_graphviz, true);
untracked!(dump_mono_stats, SwitchWithOptPath::Enabled(Some("mono-items-dir/".into())));

View File

@ -52,10 +52,6 @@ lint_builtin_allow_internal_unsafe =
lint_builtin_anonymous_params = anonymous parameters are deprecated and will be removed in the next edition
.suggestion = try naming the parameter or explicitly ignoring it
lint_builtin_asm_labels = avoid using named labels in inline assembly
.help = only local labels of the form `<number>:` should be used in inline asm
.note = see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information
lint_builtin_clashing_extern_diff_name = `{$this}` redeclares `{$orig}` with a different signature
.previous_decl_label = `{$orig}` previously declared here
.mismatch_label = this signature doesn't match the previous declaration
@ -163,6 +159,8 @@ lint_builtin_unreachable_pub = unreachable `pub` {$what}
lint_builtin_unsafe_block = usage of an `unsafe` block
lint_builtin_unsafe_extern_block = usage of an `unsafe extern` block
lint_builtin_unsafe_impl = implementation of an `unsafe` trait
lint_builtin_unsafe_trait = declaration of an `unsafe` trait
@ -403,6 +401,19 @@ lint_incomplete_include =
lint_inner_macro_attribute_unstable = inner macro attributes are unstable
lint_invalid_asm_label_binary = avoid using labels containing only the digits `0` and `1` in inline assembly
.label = use a different label that doesn't start with `0` or `1`
.note = an LLVM bug makes these labels ambiguous with a binary literal number
.note = see <https://bugs.llvm.org/show_bug.cgi?id=36144> for more information
lint_invalid_asm_label_format_arg = avoid using named labels in inline assembly
.help = only local labels of the form `<number>:` should be used in inline asm
.note1 = format arguments may expand to a non-numeric value
.note2 = see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information
lint_invalid_asm_label_named = avoid using named labels in inline assembly
.help = only local labels of the form `<number>:` should be used in inline asm
.note = see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information
lint_invalid_asm_label_no_span = the label may be declared in the expansion of a macro
lint_invalid_crate_type_value = invalid `crate_type` value
.suggestion = did you mean

View File

@ -30,13 +30,13 @@ use crate::{
BuiltinExplicitOutlivesSuggestion, BuiltinFeatureIssueNote, BuiltinIncompleteFeatures,
BuiltinIncompleteFeaturesHelp, BuiltinInternalFeatures, BuiltinKeywordIdents,
BuiltinMissingCopyImpl, BuiltinMissingDebugImpl, BuiltinMissingDoc,
BuiltinMutablesTransmutes, BuiltinNamedAsmLabel, BuiltinNoMangleGeneric,
BuiltinNonShorthandFieldPatterns, BuiltinSpecialModuleNameUsed, BuiltinTrivialBounds,
BuiltinTypeAliasGenericBounds, BuiltinTypeAliasGenericBoundsSuggestion,
BuiltinTypeAliasWhereClause, BuiltinUngatedAsyncFnTrackCaller, BuiltinUnpermittedTypeInit,
BuiltinMutablesTransmutes, BuiltinNoMangleGeneric, BuiltinNonShorthandFieldPatterns,
BuiltinSpecialModuleNameUsed, BuiltinTrivialBounds, BuiltinTypeAliasGenericBounds,
BuiltinTypeAliasGenericBoundsSuggestion, BuiltinTypeAliasWhereClause,
BuiltinUngatedAsyncFnTrackCaller, BuiltinUnpermittedTypeInit,
BuiltinUnpermittedTypeInitSub, BuiltinUnreachablePub, BuiltinUnsafe,
BuiltinUnstableFeatures, BuiltinUnusedDocComment, BuiltinUnusedDocCommentSub,
BuiltinWhileTrue, SuggestChangingAssocTypes,
BuiltinWhileTrue, InvalidAsmLabel, SuggestChangingAssocTypes,
},
EarlyContext, EarlyLintPass, LateContext, LateLintPass, Level, LintContext,
};
@ -45,7 +45,7 @@ use rustc_ast::tokenstream::{TokenStream, TokenTree};
use rustc_ast::visit::{FnCtxt, FnKind};
use rustc_ast::{self as ast, *};
use rustc_ast_pretty::pprust::{self, expr_to_string};
use rustc_errors::{Applicability, LintDiagnostic, MultiSpan};
use rustc_errors::{Applicability, LintDiagnostic};
use rustc_feature::{deprecated_attributes, AttributeGate, BuiltinAttribute, GateIssue, Stability};
use rustc_hir as hir;
use rustc_hir::def::{DefKind, Res};
@ -69,7 +69,6 @@ use rustc_target::abi::Abi;
use rustc_trait_selection::infer::{InferCtxtExt, TyCtxtInferExt};
use rustc_trait_selection::traits::query::evaluate_obligation::InferCtxtExt as _;
use rustc_trait_selection::traits::{self, misc::type_allowed_to_implement_copy};
use tracing::debug;
use crate::nonstandard_style::{method_context, MethodLateContext};
@ -326,6 +325,12 @@ impl EarlyLintPass for UnsafeCode {
self.report_unsafe(cx, it.span, BuiltinUnsafe::GlobalAsm);
}
ast::ItemKind::ForeignMod(ForeignMod { safety, .. }) => {
if let Safety::Unsafe(_) = safety {
self.report_unsafe(cx, it.span, BuiltinUnsafe::UnsafeExternBlock);
}
}
_ => {}
}
}
@ -2728,10 +2733,52 @@ declare_lint! {
"named labels in inline assembly",
}
declare_lint_pass!(NamedAsmLabels => [NAMED_ASM_LABELS]);
declare_lint! {
/// The `binary_asm_labels` lint detects the use of numeric labels containing only binary
/// digits in the inline `asm!` macro.
///
/// ### Example
///
/// ```rust,compile_fail
/// # #![feature(asm_experimental_arch)]
/// use std::arch::asm;
///
/// fn main() {
/// unsafe {
/// asm!("0: jmp 0b");
/// }
/// }
/// ```
///
/// {{produces}}
///
/// ### Explanation
///
/// A [LLVM bug] causes this code to fail to compile because it interprets the `0b` as a binary
/// literal instead of a reference to the previous local label `0`. Note that even though the
/// bug is marked as fixed, it only fixes a specific usage of intel syntax within standalone
/// files, not inline assembly. To work around this bug, don't use labels that could be
/// confused with a binary literal.
///
/// See the explanation in [Rust By Example] for more details.
///
/// [LLVM bug]: https://bugs.llvm.org/show_bug.cgi?id=36144
/// [Rust By Example]: https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels
pub BINARY_ASM_LABELS,
Deny,
"labels in inline assembly containing only 0 or 1 digits",
}
impl<'tcx> LateLintPass<'tcx> for NamedAsmLabels {
#[allow(rustc::diagnostic_outside_of_impl)]
declare_lint_pass!(AsmLabels => [NAMED_ASM_LABELS, BINARY_ASM_LABELS]);
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
enum AsmLabelKind {
Named,
FormatArg,
Binary,
}
impl<'tcx> LateLintPass<'tcx> for AsmLabels {
fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx hir::Expr<'tcx>) {
if let hir::Expr {
kind: hir::ExprKind::InlineAsm(hir::InlineAsm { template_strs, options, .. }),
@ -2759,7 +2806,8 @@ impl<'tcx> LateLintPass<'tcx> for NamedAsmLabels {
None
};
let mut found_labels = Vec::new();
// diagnostics are emitted per-template, so this is created here as opposed to the outer loop
let mut spans = Vec::new();
// A semicolon might not actually be specified as a separator for all targets, but
// it seems like LLVM accepts it always.
@ -2782,16 +2830,21 @@ impl<'tcx> LateLintPass<'tcx> for NamedAsmLabels {
// Whether a { bracket has been seen and its } hasn't been found yet.
let mut in_bracket = false;
let mut label_kind = AsmLabelKind::Named;
// A label starts with an ASCII alphabetic character or . or _
// A label can also start with a format arg, if it's not a raw asm block.
if !raw && start == '{' {
in_bracket = true;
label_kind = AsmLabelKind::FormatArg;
} else if matches!(start, '0' | '1') {
// Binary labels have only the characters `0` or `1`.
label_kind = AsmLabelKind::Binary;
} else if !(start.is_ascii_alphabetic() || matches!(start, '.' | '_')) {
// Named labels start with ASCII letters, `.` or `_`.
// anything else is not a label
break 'label_loop;
}
// Labels continue with ASCII alphanumeric characters, _, or $
for c in chars {
// Inside a template format arg, any character is permitted for the
// puproses of label detection because we assume that it can be
@ -2812,8 +2865,18 @@ impl<'tcx> LateLintPass<'tcx> for NamedAsmLabels {
} else if !raw && c == '{' {
// Start of a format arg.
in_bracket = true;
label_kind = AsmLabelKind::FormatArg;
} else {
if !(c.is_ascii_alphanumeric() || matches!(c, '_' | '$')) {
let can_continue = match label_kind {
// Format arg labels are considered to be named labels for the purposes
// of continuing outside of their {} pair.
AsmLabelKind::Named | AsmLabelKind::FormatArg => {
c.is_ascii_alphanumeric() || matches!(c, '_' | '$')
}
AsmLabelKind::Binary => matches!(c, '0' | '1'),
};
if !can_continue {
// The potential label had an invalid character inside it, it
// cannot be a label.
break 'label_loop;
@ -2821,25 +2884,41 @@ impl<'tcx> LateLintPass<'tcx> for NamedAsmLabels {
}
}
// If all characters passed the label checks, this is likely a label.
found_labels.push(possible_label);
// If all characters passed the label checks, this is a label.
spans.push((find_label_span(possible_label), label_kind));
start_idx = idx + 1;
}
}
debug!("NamedAsmLabels::check_expr(): found_labels: {:#?}", &found_labels);
if found_labels.len() > 0 {
let spans = found_labels
.into_iter()
.filter_map(|label| find_label_span(label))
.collect::<Vec<Span>>();
// If there were labels but we couldn't find a span, combine the warnings and
// use the template span.
let target_spans: MultiSpan =
if spans.len() > 0 { spans.into() } else { (*template_span).into() };
cx.emit_span_lint(NAMED_ASM_LABELS, target_spans, BuiltinNamedAsmLabel);
for (span, label_kind) in spans {
let missing_precise_span = span.is_none();
let span = span.unwrap_or(*template_span);
match label_kind {
AsmLabelKind::Named => {
cx.emit_span_lint(
NAMED_ASM_LABELS,
span,
InvalidAsmLabel::Named { missing_precise_span },
);
}
AsmLabelKind::FormatArg => {
cx.emit_span_lint(
NAMED_ASM_LABELS,
span,
InvalidAsmLabel::FormatArg { missing_precise_span },
);
}
AsmLabelKind::Binary => {
// the binary asm issue only occurs when using intel syntax
if !options.contains(InlineAsmOptions::ATT_SYNTAX) {
cx.emit_span_lint(
BINARY_ASM_LABELS,
span,
InvalidAsmLabel::Binary { missing_precise_span, span },
)
}
}
};
}
}
}

View File

@ -225,7 +225,7 @@ late_lint_methods!(
NoopMethodCall: NoopMethodCall,
EnumIntrinsicsNonEnums: EnumIntrinsicsNonEnums,
InvalidAtomicOrdering: InvalidAtomicOrdering,
NamedAsmLabels: NamedAsmLabels,
AsmLabels: AsmLabels,
OpaqueHiddenInferredBound: OpaqueHiddenInferredBound,
MultipleSupertraitUpcastable: MultipleSupertraitUpcastable,
MapUnitFn: MapUnitFn,

View File

@ -81,6 +81,8 @@ pub enum BuiltinUnsafe {
AllowInternalUnsafe,
#[diag(lint_builtin_unsafe_block)]
UnsafeBlock,
#[diag(lint_builtin_unsafe_extern_block)]
UnsafeExternBlock,
#[diag(lint_builtin_unsafe_trait)]
UnsafeTrait,
#[diag(lint_builtin_unsafe_impl)]
@ -2047,10 +2049,32 @@ pub struct UnitBindingsDiag {
}
#[derive(LintDiagnostic)]
#[diag(lint_builtin_asm_labels)]
#[help]
#[note]
pub struct BuiltinNamedAsmLabel;
pub enum InvalidAsmLabel {
#[diag(lint_invalid_asm_label_named)]
#[help]
#[note]
Named {
#[note(lint_invalid_asm_label_no_span)]
missing_precise_span: bool,
},
#[diag(lint_invalid_asm_label_format_arg)]
#[help]
#[note(lint_note1)]
#[note(lint_note2)]
FormatArg {
#[note(lint_invalid_asm_label_no_span)]
missing_precise_span: bool,
},
#[diag(lint_invalid_asm_label_binary)]
#[note]
Binary {
#[note(lint_invalid_asm_label_no_span)]
missing_precise_span: bool,
// hack to get a label on the whole span, must match the emitted span
#[label]
span: Span,
},
}
#[derive(Subdiagnostic)]
pub enum UnexpectedCfgCargoHelp {

View File

@ -5,8 +5,7 @@ use rustc_middle::ty::print::{PrintTraitPredicateExt as _, TraitPredPrintModifie
use rustc_middle::ty::{self, fold::BottomUpFolder, Ty, TypeFoldable};
use rustc_session::{declare_lint, declare_lint_pass};
use rustc_span::{symbol::kw, Span};
use rustc_trait_selection::traits;
use rustc_trait_selection::traits::query::evaluate_obligation::InferCtxtExt;
use rustc_trait_selection::traits::{self, ObligationCtxt};
use crate::{LateContext, LateLintPass, LintContext};
@ -130,24 +129,26 @@ impl<'tcx> LateLintPass<'tcx> for OpaqueHiddenInferredBound {
.iter_instantiated_copied(cx.tcx, proj.projection_term.args)
{
let assoc_pred = assoc_pred.fold_with(proj_replacer);
let Ok(assoc_pred) = traits::fully_normalize(
infcx,
traits::ObligationCause::dummy(),
cx.param_env,
assoc_pred,
) else {
continue;
};
// If that predicate doesn't hold modulo regions (but passed during type-check),
// then we must've taken advantage of the hack in `project_and_unify_types` where
// we replace opaques with inference vars. Emit a warning!
if !infcx.predicate_must_hold_modulo_regions(&traits::Obligation::new(
let ocx = ObligationCtxt::new(infcx);
let assoc_pred =
ocx.normalize(&traits::ObligationCause::dummy(), cx.param_env, assoc_pred);
if !ocx.select_all_or_error().is_empty() {
// Can't normalize for some reason...?
continue;
}
ocx.register_obligation(traits::Obligation::new(
cx.tcx,
traits::ObligationCause::dummy(),
cx.param_env,
assoc_pred,
)) {
));
// If that predicate doesn't hold modulo regions (but passed during type-check),
// then we must've taken advantage of the hack in `project_and_unify_types` where
// we replace opaques with inference vars. Emit a warning!
if !ocx.select_all_or_error().is_empty() {
// If it's a trait bound and an opaque that doesn't satisfy it,
// then we can emit a suggestion to add the bound.
let add_bound = match (proj_term.kind(), assoc_pred.kind().skip_binder()) {

View File

@ -1545,6 +1545,9 @@ impl<'a, 'tcx, Prov: Provenance, Extra, Bytes: AllocBytes> std::fmt::Display
// We are done.
return write!(w, " {{}}");
}
if tcx.sess.opts.unstable_opts.dump_mir_exclude_alloc_bytes {
return write!(w, " {{ .. }}");
}
// Write allocation bytes.
writeln!(w, " {{")?;
write_allocation_bytes(tcx, alloc, w, " ")?;

View File

@ -1992,12 +1992,12 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
if let Some(candidate) = candidates.get(0) {
let path = {
// remove the possible common prefix of the path
let start_index = (0..failed_segment_idx)
.find(|&i| path[i].ident != candidate.path.segments[i].ident)
let len = candidate.path.segments.len();
let start_index = (0..=failed_segment_idx.min(len - 1))
.find(|&i| path[i].ident.name != candidate.path.segments[i].ident.name)
.unwrap_or_default();
let segments = (start_index..=failed_segment_idx)
.map(|s| candidate.path.segments[s].clone())
.collect();
let segments =
(start_index..len).map(|s| candidate.path.segments[s].clone()).collect();
Path { segments, span: Span::default(), tokens: None }
};
(

View File

@ -1687,6 +1687,8 @@ options! {
(default: no)"),
dump_mir_dir: String = ("mir_dump".to_string(), parse_string, [UNTRACKED],
"the directory the MIR is dumped into (default: `mir_dump`)"),
dump_mir_exclude_alloc_bytes: bool = (false, parse_bool, [UNTRACKED],
"exclude the raw bytes of allocations when dumping MIR (used in tests) (default: no)"),
dump_mir_exclude_pass_number: bool = (false, parse_bool, [UNTRACKED],
"exclude the pass number when dumping MIR (used in tests) (default: no)"),
dump_mir_graphviz: bool = (false, parse_bool, [UNTRACKED],

View File

@ -2076,6 +2076,7 @@ symbols! {
x87_reg,
xer,
xmm_reg,
xop_target_feature,
yeet_desugar_details,
yeet_expr,
yes,

View File

@ -246,6 +246,7 @@ const X86_ALLOWED_FEATURES: &[(&str, Stability)] = &[
("tbm", Unstable(sym::tbm_target_feature)),
("vaes", Unstable(sym::avx512_target_feature)),
("vpclmulqdq", Unstable(sym::avx512_target_feature)),
("xop", Unstable(sym::xop_target_feature)),
("xsave", Stable),
("xsavec", Stable),
("xsaveopt", Stable),

View File

@ -271,13 +271,14 @@ fn do_normalize_predicates<'tcx>(
// them here too, and we will remove this function when
// we move over to lazy normalization *anyway*.
let infcx = tcx.infer_ctxt().ignoring_regions().build();
let predicates = match fully_normalize(&infcx, cause, elaborated_env, predicates) {
Ok(predicates) => predicates,
Err(errors) => {
let reported = infcx.err_ctxt().report_fulfillment_errors(errors);
return Err(reported);
}
};
let ocx = ObligationCtxt::new_with_diagnostics(&infcx);
let predicates = ocx.normalize(&cause, elaborated_env, predicates);
let errors = ocx.select_all_or_error();
if !errors.is_empty() {
let reported = infcx.err_ctxt().report_fulfillment_errors(errors);
return Err(reported);
}
debug!("do_normalize_predicates: normalized predicates = {:?}", predicates);
@ -465,37 +466,6 @@ pub fn normalize_param_env_or_error<'tcx>(
ty::ParamEnv::new(tcx.mk_clauses(&predicates), unnormalized_env.reveal())
}
/// Normalize a type and process all resulting obligations, returning any errors.
///
/// FIXME(-Znext-solver): This should be replaced by `At::deeply_normalize`
/// which has the same behavior with the new solver. Because using a separate
/// fulfillment context worsens caching in the old solver, `At::deeply_normalize`
/// is still lazy with the old solver as it otherwise negatively impacts perf.
#[instrument(skip_all)]
pub fn fully_normalize<'tcx, T>(
infcx: &InferCtxt<'tcx>,
cause: ObligationCause<'tcx>,
param_env: ty::ParamEnv<'tcx>,
value: T,
) -> Result<T, Vec<FulfillmentError<'tcx>>>
where
T: TypeFoldable<TyCtxt<'tcx>>,
{
let ocx = ObligationCtxt::new_with_diagnostics(infcx);
debug!(?value);
let normalized_value = ocx.normalize(&cause, param_env, value);
debug!(?normalized_value);
debug!("select_all_or_error start");
let errors = ocx.select_all_or_error();
if !errors.is_empty() {
return Err(errors);
}
debug!("select_all_or_error complete");
let resolved_value = infcx.resolve_vars_if_possible(normalized_value);
debug!(?resolved_value);
Ok(resolved_value)
}
/// Normalizes the predicates and checks whether they hold in an empty environment. If this
/// returns true, then either normalize encountered an error or one of the predicates did not
/// hold. Used when creating vtables to check for unsatisfiable methods.

View File

@ -42,11 +42,9 @@ impl<'tcx> At<'_, 'tcx> {
/// same goals in both a temporary and the shared context which negatively impacts
/// performance as these don't share caching.
///
/// FIXME(-Znext-solver): This has the same behavior as `traits::fully_normalize`
/// in the new solver, but because of performance reasons, we currently reuse an
/// existing fulfillment context in the old solver. Once we also eagerly prove goals with
/// the old solver or have removed the old solver, remove `traits::fully_normalize` and
/// rename this function to `At::fully_normalize`.
/// FIXME(-Znext-solver): For performance reasons, we currently reuse an existing
/// fulfillment context in the old solver. Once we have removed the old solver, we
/// can remove the `fulfill_cx` parameter on this function.
fn deeply_normalize<T, E>(
self,
value: T,

View File

@ -18,9 +18,7 @@ use crate::error_reporting::traits::to_pretty_impl_header;
use crate::errors::NegativePositiveConflict;
use crate::infer::{InferCtxt, InferOk, TyCtxtInferExt};
use crate::traits::select::IntercrateAmbiguityCause;
use crate::traits::{
self, coherence, FutureCompatOverlapErrorKind, ObligationCause, ObligationCtxt,
};
use crate::traits::{coherence, FutureCompatOverlapErrorKind, ObligationCause, ObligationCtxt};
use rustc_data_structures::fx::FxIndexSet;
use rustc_errors::{codes::*, Diag, EmissionGuarantee};
use rustc_hir::def_id::{DefId, LocalDefId};
@ -219,19 +217,17 @@ fn fulfill_implication<'tcx>(
param_env, source_trait_ref, target_impl
);
let source_trait_ref =
match traits::fully_normalize(infcx, ObligationCause::dummy(), param_env, source_trait_ref)
{
Ok(source_trait_ref) => source_trait_ref,
Err(_errors) => {
infcx.dcx().span_delayed_bug(
infcx.tcx.def_span(source_impl),
format!("failed to fully normalize {source_trait_ref}"),
);
source_trait_ref
}
};
let ocx = ObligationCtxt::new(infcx);
let source_trait_ref = ocx.normalize(&ObligationCause::dummy(), param_env, source_trait_ref);
if !ocx.select_all_or_error().is_empty() {
infcx.dcx().span_delayed_bug(
infcx.tcx.def_span(source_impl),
format!("failed to fully normalize {source_trait_ref}"),
);
}
let source_trait_ref = infcx.resolve_vars_if_possible(source_trait_ref);
let source_trait = ImplSubject::Trait(source_trait_ref);
let selcx = SelectionContext::new(infcx);
@ -253,9 +249,6 @@ fn fulfill_implication<'tcx>(
return Err(());
};
// Needs to be `in_snapshot` because this function is used to rebase
// generic parameters, which may happen inside of a select within a probe.
let ocx = ObligationCtxt::new(infcx);
// attempt to prove all of the predicates for impl2 given those for impl1
// (which are packed up in penv)
ocx.register_obligations(obligations.chain(more_obligations));

View File

@ -282,7 +282,7 @@ impl CStr {
pub const unsafe fn from_ptr<'a>(ptr: *const c_char) -> &'a CStr {
// SAFETY: The caller has provided a pointer that points to a valid C
// string with a NUL terminator less than `isize::MAX` from `ptr`.
let len = unsafe { const_strlen(ptr) };
let len = unsafe { strlen(ptr) };
// SAFETY: The caller has provided a valid pointer with length less than
// `isize::MAX`, so `from_raw_parts` is safe. The content remains valid
@ -743,7 +743,7 @@ impl AsRef<CStr> for CStr {
#[unstable(feature = "cstr_internals", issue = "none")]
#[rustc_const_stable(feature = "const_cstr_from_ptr", since = "CURRENT_RUSTC_VERSION")]
#[rustc_allow_const_fn_unstable(const_eval_select)]
const unsafe fn const_strlen(ptr: *const c_char) -> usize {
const unsafe fn strlen(ptr: *const c_char) -> usize {
const fn strlen_ct(s: *const c_char) -> usize {
let mut len = 0;

View File

@ -22,6 +22,8 @@ ignore = [
"/tests/rustdoc-ui/", # Some have syntax errors, some are whitespace-sensitive.
"/tests/ui/", # Some have syntax errors, some are whitespace-sensitive.
"/tests/ui-fulldeps/", # Some are whitespace-sensitive (e.g. `// ~ERROR` comments).
# #[cfg(bootstrap)] so that t-release sees this when they search for it
"/tests/rustdoc-json/impl-trait-precise-capturing.rs",
# Do not format submodules.
# FIXME: sync submodule list with tidy/bootstrap/etc

View File

@ -228,8 +228,9 @@ fn clean_generic_bound<'tcx>(
GenericBound::TraitBound(clean_poly_trait_ref(t, cx), modifier)
}
// FIXME(precise_capturing): Implement rustdoc support
hir::GenericBound::Use(..) => return None,
hir::GenericBound::Use(args, ..) => {
GenericBound::Use(args.iter().map(|arg| arg.name()).collect())
}
})
}

View File

@ -79,7 +79,7 @@ pub(crate) fn merge_bounds(
!bounds.iter_mut().any(|b| {
let trait_ref = match *b {
clean::GenericBound::TraitBound(ref mut tr, _) => tr,
clean::GenericBound::Outlives(..) => return false,
clean::GenericBound::Outlives(..) | clean::GenericBound::Use(_) => return false,
};
// If this QPath's trait `trait_did` is the same as, or a supertrait
// of, the bound's trait `did` then we can keep going, otherwise

View File

@ -1244,6 +1244,8 @@ impl Eq for Attributes {}
pub(crate) enum GenericBound {
TraitBound(PolyTrait, hir::TraitBoundModifier),
Outlives(Lifetime),
/// `use<'a, T>` precise-capturing bound syntax
Use(Vec<Symbol>),
}
impl GenericBound {

View File

@ -412,6 +412,20 @@ impl clean::GenericBound {
})?;
ty.print(cx).fmt(f)
}
clean::GenericBound::Use(args) => {
if f.alternate() {
f.write_str("use<")?;
} else {
f.write_str("use&lt;")?;
}
for (i, arg) in args.iter().enumerate() {
if i > 0 {
write!(f, ", ")?;
}
arg.fmt(f)?;
}
if f.alternate() { f.write_str(">") } else { f.write_str("&gt;") }
}
})
}
}

View File

@ -542,6 +542,7 @@ impl FromWithTcx<clean::GenericBound> for GenericBound {
}
}
Outlives(lifetime) => GenericBound::Outlives(convert_lifetime(lifetime)),
Use(args) => GenericBound::Use(args.into_iter().map(|arg| arg.to_string()).collect()),
}
}
}

View File

@ -8,7 +8,7 @@ use serde::{Deserialize, Serialize};
use std::path::PathBuf;
/// rustdoc format-version.
pub const FORMAT_VERSION: u32 = 31;
pub const FORMAT_VERSION: u32 = 32;
/// A `Crate` is the root of the emitted JSON blob. It contains all type/documentation information
/// about the language items in the local crate, as well as info about external items to allow
@ -538,6 +538,8 @@ pub enum GenericBound {
modifier: TraitBoundModifier,
},
Outlives(String),
/// `use<'a, T>` precise-capturing bound syntax
Use(Vec<String>),
}
#[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]

View File

@ -298,6 +298,7 @@ impl<'a> Validator<'a> {
generic_params.iter().for_each(|gpd| self.check_generic_param_def(gpd));
}
GenericBound::Outlives(_) => {}
GenericBound::Use(_) => {}
}
}

View File

@ -303,6 +303,11 @@ pub fn filename_not_in_denylist<P: AsRef<Path>, V: AsRef<[String]>>(path: P, exp
.is_some_and(|name| !expected.contains(&name.to_str().unwrap().to_owned()))
}
/// Returns true if the filename at `path` ends with `suffix`.
pub fn has_suffix<P: AsRef<Path>>(path: P, suffix: &str) -> bool {
path.as_ref().file_name().is_some_and(|name| name.to_str().unwrap().ends_with(suffix))
}
/// Gathers all files in the current working directory that have the extension `ext`, and counts
/// the number of lines within that contain a match with the regex pattern `re`.
pub fn count_regex_matches_in_files_with_extension(re: &regex::Regex, ext: &str) -> usize {

View File

@ -4,13 +4,15 @@ use std::path::Path;
use crate::{command, cwd, env_var, set_host_rpath};
/// Construct a new `rustc` invocation.
/// Construct a new `rustc` invocation. This will automatically set the library
/// search path as `-L cwd()`. Use [`bare_rustc`] to avoid this.
#[track_caller]
pub fn rustc() -> Rustc {
Rustc::new()
}
/// Construct a plain `rustc` invocation with no flags set.
/// Construct a plain `rustc` invocation with no flags set. Note that [`set_host_rpath`]
/// still presets the environment variable `HOST_RPATH_DIR` by default.
#[track_caller]
pub fn bare_rustc() -> Rustc {
Rustc::bare()
@ -42,7 +44,8 @@ fn setup_common() -> Command {
impl Rustc {
// `rustc` invocation constructor methods
/// Construct a new `rustc` invocation.
/// Construct a new `rustc` invocation. This will automatically set the library
/// search path as `-L cwd()`. Use [`bare_rustc`] to avoid this.
#[track_caller]
pub fn new() -> Self {
let mut cmd = setup_common();

View File

@ -23,7 +23,6 @@ run-make/dep-info/Makefile
run-make/dump-ice-to-disk/Makefile
run-make/dump-mono-stats/Makefile
run-make/emit-to-stdout/Makefile
run-make/env-dep-info/Makefile
run-make/export-executable-symbols/Makefile
run-make/extern-diff-internal-name/Makefile
run-make/extern-flag-disambiguates/Makefile
@ -37,7 +36,6 @@ run-make/extern-fn-with-packed-struct/Makefile
run-make/extern-fn-with-union/Makefile
run-make/extern-multiple-copies/Makefile
run-make/extern-multiple-copies2/Makefile
run-make/extra-filename-with-temp-outputs/Makefile
run-make/fmt-write-bloat/Makefile
run-make/foreign-double-unwind/Makefile
run-make/foreign-exceptions/Makefile
@ -58,9 +56,7 @@ run-make/issue-35164/Makefile
run-make/issue-36710/Makefile
run-make/issue-47551/Makefile
run-make/issue-69368/Makefile
run-make/issue-83045/Makefile
run-make/issue-84395-lto-embed-bitcode/Makefile
run-make/issue-85019-moved-src-dir/Makefile
run-make/issue-85401-static-mir/Makefile
run-make/issue-88756-default-output/Makefile
run-make/issue-97463-abi-param-passing/Makefile
@ -116,7 +112,6 @@ run-make/return-non-c-like-enum-from-c/Makefile
run-make/rlib-format-packed-bundled-libs-2/Makefile
run-make/rlib-format-packed-bundled-libs-3/Makefile
run-make/rlib-format-packed-bundled-libs/Makefile
run-make/rustc-macro-dep-files/Makefile
run-make/sanitizer-cdylib-link/Makefile
run-make/sanitizer-dylib-link/Makefile
run-make/sanitizer-staticlib-link/Makefile

View File

@ -119,11 +119,7 @@
}
}
ALLOC0 (size: 8, align: 4) {
20 00 00 00 20 00 00 00 │ ... ...
}
ALLOC0 (size: 8, align: 4) { .. }
ALLOC1 (size: 4, align: 2) {
01 00 63 00 │ ..c.
}
ALLOC1 (size: 4, align: 2) { .. }

View File

@ -1,5 +1,5 @@
//@ test-mir-pass: SingleUseConsts
//@ compile-flags: -C overflow-checks=no -Zmir-enable-passes=+GVN
//@ compile-flags: -C overflow-checks=no -Zmir-enable-passes=+GVN -Zdump-mir-exclude-alloc-bytes
#![allow(unused)]

View File

@ -44,9 +44,7 @@
StorageDead(_2);
return;
}
+ }
+
+ ALLOC0 (size: 8, align: 4) {
+ 01 00 00 00 00 __ __ __ │ .....░░░
}
+
+ ALLOC0 (size: 8, align: 4) { .. }

View File

@ -1,4 +1,5 @@
//@ test-mir-pass: GVN
//@ compile-flags: -Zdump-mir-exclude-alloc-bytes
// EMIT_MIR address_of_pair.fn0.GVN.diff
pub fn fn0() -> bool {

View File

@ -24,9 +24,7 @@
StorageDead(_1);
return;
}
+ }
+
+ ALLOC0 (size: 8, align: 4) {
+ 02 00 00 00 00 __ __ __ │ .....░░░
}
+
+ ALLOC0 (size: 8, align: 4) { .. }

View File

@ -24,9 +24,7 @@
StorageDead(_1);
return;
}
+ }
+
+ ALLOC0 (size: 8, align: 4) {
+ 02 00 00 00 00 __ __ __ │ .....░░░
}
+
+ ALLOC0 (size: 8, align: 4) { .. }

View File

@ -1,6 +1,6 @@
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
//@ test-mir-pass: GVN
//@ compile-flags: -C overflow-checks=on
//@ compile-flags: -C overflow-checks=on -Zdump-mir-exclude-alloc-bytes
// EMIT_MIR checked_add.main.GVN.diff
fn main() {

View File

@ -24,9 +24,7 @@
StorageDead(_1);
return;
}
+ }
+
+ ALLOC0 (size: 8, align: 4) {
+ 2a 00 00 00 2b 00 00 00 │ *...+...
}
+
+ ALLOC0 (size: 8, align: 4) { .. }

View File

@ -1,4 +1,5 @@
//@ test-mir-pass: GVN
//@ compile-flags: -Zdump-mir-exclude-alloc-bytes
// EMIT_MIR mutable_variable_aggregate.main.GVN.diff
fn main() {

View File

@ -31,9 +31,7 @@
StorageDead(_1);
return;
}
+ }
+
+ ALLOC0 (size: 8, align: 4) {
+ 2a 00 00 00 2b 00 00 00 │ *...+...
}
+
+ ALLOC0 (size: 8, align: 4) { .. }

View File

@ -1,4 +1,5 @@
//@ test-mir-pass: GVN
//@ compile-flags: -Zdump-mir-exclude-alloc-bytes
// EMIT_MIR mutable_variable_aggregate_mut_ref.main.GVN.diff
fn main() {

View File

@ -48,9 +48,7 @@
+ nop;
return;
}
+ }
+
+ ALLOC0 (size: 8, align: 4) {
+ 01 00 00 00 02 00 00 00 │ ........
}
+
+ ALLOC0 (size: 8, align: 4) { .. }

View File

@ -48,9 +48,7 @@
+ nop;
return;
}
+ }
+
+ ALLOC0 (size: 8, align: 4) {
+ 01 00 00 00 02 00 00 00 │ ........
}
+
+ ALLOC0 (size: 8, align: 4) { .. }

View File

@ -1,5 +1,6 @@
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
//@ test-mir-pass: GVN
//@ compile-flags: -Zdump-mir-exclude-alloc-bytes
// EMIT_MIR mutable_variable_unprop_assign.main.GVN.diff
fn main() {

View File

@ -17,9 +17,7 @@
+ _0 = const 4_u32;
return;
}
+ }
+
+ ALLOC0 (size: 8, align: 4) {
+ 04 00 00 00 00 __ __ __ │ .....░░░
}
+
+ ALLOC0 (size: 8, align: 4) { .. }

View File

@ -17,9 +17,7 @@
+ _0 = const 4_u32;
return;
}
+ }
+
+ ALLOC0 (size: 8, align: 4) {
+ 04 00 00 00 00 __ __ __ │ .....░░░
}
+
+ ALLOC0 (size: 8, align: 4) { .. }

View File

@ -15,6 +15,4 @@ fn add() -> u32 {
}
}
ALLOC0 (size: 8, align: 4) {
04 00 00 00 00 __ __ __ .....
}
ALLOC0 (size: 8, align: 4) { .. }

View File

@ -15,6 +15,4 @@ fn add() -> u32 {
}
}
ALLOC0 (size: 8, align: 4) {
04 00 00 00 00 __ __ __ .....
}
ALLOC0 (size: 8, align: 4) { .. }

View File

@ -1,6 +1,6 @@
//@ test-mir-pass: GVN
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
//@ compile-flags: -C overflow-checks=on
//@ compile-flags: -C overflow-checks=on -Zdump-mir-exclude-alloc-bytes
// EMIT_MIR return_place.add.GVN.diff
// EMIT_MIR return_place.add.PreCodegen.before.mir

View File

@ -49,9 +49,7 @@
StorageDead(_1);
return;
}
+ }
+
+ ALLOC0 (size: 12, align: 4) {
+ 01 00 00 00 02 00 00 00 03 00 00 00 │ ............
}
+
+ ALLOC0 (size: 12, align: 4) { .. }

View File

@ -49,9 +49,7 @@
StorageDead(_1);
return;
}
+ }
+
+ ALLOC0 (size: 12, align: 4) {
+ 01 00 00 00 02 00 00 00 03 00 00 00 │ ............
}
+
+ ALLOC0 (size: 12, align: 4) { .. }

View File

@ -49,9 +49,7 @@
StorageDead(_1);
return;
}
+ }
+
+ ALLOC0 (size: 12, align: 4) {
+ 01 00 00 00 02 00 00 00 03 00 00 00 │ ............
}
+
+ ALLOC0 (size: 12, align: 4) { .. }

View File

@ -49,9 +49,7 @@
StorageDead(_1);
return;
}
+ }
+
+ ALLOC0 (size: 12, align: 4) {
+ 01 00 00 00 02 00 00 00 03 00 00 00 │ ............
}
+
+ ALLOC0 (size: 12, align: 4) { .. }

View File

@ -1,5 +1,5 @@
//@ test-mir-pass: GVN
//@ compile-flags: -Zmir-enable-passes=+InstSimplify
//@ compile-flags: -Zmir-enable-passes=+InstSimplify -Zdump-mir-exclude-alloc-bytes
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// EMIT_MIR_FOR_EACH_BIT_WIDTH

View File

@ -31,9 +31,7 @@
+ nop;
return;
}
+ }
+
+ ALLOC0 (size: 8, align: 4) {
+ 01 00 00 00 02 00 00 00 │ ........
}
+
+ ALLOC0 (size: 8, align: 4) { .. }

View File

@ -31,9 +31,7 @@
+ nop;
return;
}
+ }
+
+ ALLOC0 (size: 8, align: 4) {
+ 01 00 00 00 02 00 00 00 │ ........
}
+
+ ALLOC0 (size: 8, align: 4) { .. }

View File

@ -1,4 +1,5 @@
//@ test-mir-pass: GVN
//@ compile-flags: -Zdump-mir-exclude-alloc-bytes
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// EMIT_MIR tuple_literal_propagation.main.GVN.diff

View File

@ -76,13 +76,9 @@
StorageDead(_1);
return;
}
+ }
+
+ ALLOC0 (size: 8, align: 4) {
+ 00 00 00 80 01 __ __ __ │ .....░░░
+ }
+
+ ALLOC1 (size: 8, align: 4) {
+ 03 00 00 00 00 __ __ __ │ .....░░░
}
+
+ ALLOC0 (size: 8, align: 4) { .. }
+
+ ALLOC1 (size: 8, align: 4) { .. }

View File

@ -76,13 +76,9 @@
StorageDead(_1);
return;
}
+ }
+
+ ALLOC0 (size: 8, align: 4) {
+ 00 00 00 80 01 __ __ __ │ .....░░░
+ }
+
+ ALLOC1 (size: 8, align: 4) {
+ 03 00 00 00 00 __ __ __ │ .....░░░
}
+
+ ALLOC0 (size: 8, align: 4) { .. }
+
+ ALLOC1 (size: 8, align: 4) { .. }

View File

@ -1,5 +1,5 @@
//@ test-mir-pass: DataflowConstProp
//@ compile-flags: -Coverflow-checks=on
//@ compile-flags: -Coverflow-checks=on -Zdump-mir-exclude-alloc-bytes
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// EMIT_MIR checked.main.DataflowConstProp.diff

View File

@ -94,15 +94,9 @@
}
}
ALLOC2 (size: 8, align: 4) {
01 00 00 00 00 00 00 00 │ ........
}
ALLOC2 (size: 8, align: 4) { .. }
ALLOC1 (size: 8, align: 4) {
01 00 00 00 00 00 00 00 │ ........
}
ALLOC1 (size: 8, align: 4) { .. }
ALLOC0 (size: 8, align: 4) {
01 00 00 00 00 00 00 00 │ ........
}
ALLOC0 (size: 8, align: 4) { .. }

View File

@ -98,15 +98,9 @@
}
}
ALLOC2 (size: 8, align: 4) {
01 00 00 00 00 00 00 00 │ ........
}
ALLOC2 (size: 8, align: 4) { .. }
ALLOC1 (size: 8, align: 4) {
01 00 00 00 00 00 00 00 │ ........
}
ALLOC1 (size: 8, align: 4) { .. }
ALLOC0 (size: 8, align: 4) {
01 00 00 00 00 00 00 00 │ ........
}
ALLOC0 (size: 8, align: 4) { .. }

View File

@ -94,15 +94,9 @@
}
}
ALLOC2 (size: 16, align: 8) {
01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
}
ALLOC2 (size: 16, align: 8) { .. }
ALLOC1 (size: 16, align: 8) {
01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
}
ALLOC1 (size: 16, align: 8) { .. }
ALLOC0 (size: 16, align: 8) {
01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
}
ALLOC0 (size: 16, align: 8) { .. }

View File

@ -98,15 +98,9 @@
}
}
ALLOC2 (size: 16, align: 8) {
01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
}
ALLOC2 (size: 16, align: 8) { .. }
ALLOC1 (size: 16, align: 8) {
01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
}
ALLOC1 (size: 16, align: 8) { .. }
ALLOC0 (size: 16, align: 8) {
01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
}
ALLOC0 (size: 16, align: 8) { .. }

View File

@ -102,17 +102,11 @@
_0 = const ();
drop(_1) -> [return: bb1, unwind unreachable];
}
+ }
+
+ ALLOC2 (size: 8, align: 4) {
+ 01 00 00 00 00 00 00 00 │ ........
+ }
+
+ ALLOC1 (size: 8, align: 4) {
+ 01 00 00 00 00 00 00 00 │ ........
+ }
+
+ ALLOC0 (size: 8, align: 4) {
+ 01 00 00 00 00 00 00 00 │ ........
}
+
+ ALLOC2 (size: 8, align: 4) { .. }
+
+ ALLOC1 (size: 8, align: 4) { .. }
+
+ ALLOC0 (size: 8, align: 4) { .. }

View File

@ -106,17 +106,11 @@
_0 = const ();
drop(_1) -> [return: bb1, unwind: bb2];
}
+ }
+
+ ALLOC2 (size: 8, align: 4) {
+ 01 00 00 00 00 00 00 00 │ ........
+ }
+
+ ALLOC1 (size: 8, align: 4) {
+ 01 00 00 00 00 00 00 00 │ ........
+ }
+
+ ALLOC0 (size: 8, align: 4) {
+ 01 00 00 00 00 00 00 00 │ ........
}
+
+ ALLOC2 (size: 8, align: 4) { .. }
+
+ ALLOC1 (size: 8, align: 4) { .. }
+
+ ALLOC0 (size: 8, align: 4) { .. }

View File

@ -102,17 +102,11 @@
_0 = const ();
drop(_1) -> [return: bb1, unwind unreachable];
}
+ }
+
+ ALLOC2 (size: 16, align: 8) {
+ 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
+ }
+
+ ALLOC1 (size: 16, align: 8) {
+ 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
+ }
+
+ ALLOC0 (size: 16, align: 8) {
+ 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
}
+
+ ALLOC2 (size: 16, align: 8) { .. }
+
+ ALLOC1 (size: 16, align: 8) { .. }
+
+ ALLOC0 (size: 16, align: 8) { .. }

View File

@ -106,17 +106,11 @@
_0 = const ();
drop(_1) -> [return: bb1, unwind: bb2];
}
+ }
+
+ ALLOC2 (size: 16, align: 8) {
+ 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
+ }
+
+ ALLOC1 (size: 16, align: 8) {
+ 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
+ }
+
+ ALLOC0 (size: 16, align: 8) {
+ 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
}
+
+ ALLOC2 (size: 16, align: 8) { .. }
+
+ ALLOC1 (size: 16, align: 8) { .. }
+
+ ALLOC0 (size: 16, align: 8) { .. }

View File

@ -1,5 +1,5 @@
//@ test-mir-pass: DataflowConstProp
//@ compile-flags: -Zmir-enable-passes=+GVN,+Inline
//@ compile-flags: -Zmir-enable-passes=+GVN,+Inline -Zdump-mir-exclude-alloc-bytes
// EMIT_MIR_FOR_EACH_BIT_WIDTH
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY

View File

@ -1,4 +1,5 @@
//@ test-mir-pass: DataflowConstProp
//@ compile-flags: -Zdump-mir-exclude-alloc-bytes
// EMIT_MIR_FOR_EACH_BIT_WIDTH
#![feature(custom_mir, core_intrinsics, rustc_attrs)]

View File

@ -60,9 +60,7 @@
StorageDead(_1);
return;
}
+ }
+
+ ALLOC0 (size: 8, align: 4) {
+ 00 00 00 00 00 00 00 00 │ ........
}
+
+ ALLOC0 (size: 8, align: 4) { .. }

View File

@ -60,9 +60,7 @@
StorageDead(_1);
return;
}
+ }
+
+ ALLOC0 (size: 8, align: 4) {
+ 00 00 00 00 00 00 00 00 │ ........
}
+
+ ALLOC0 (size: 8, align: 4) { .. }

View File

@ -43,7 +43,7 @@
bb0: {
StorageLive(_1);
StorageLive(_2);
_2 = const {ALLOC1: &E};
_2 = const {ALLOC0: &E};
- _1 = (*_2);
+ _1 = const E::V1(0_i32);
StorageDead(_2);
@ -79,7 +79,7 @@
bb4: {
StorageLive(_7);
StorageLive(_8);
_8 = const {ALLOC2: &&E};
_8 = const {ALLOC1: &&E};
_7 = (*_8);
StorageDead(_8);
StorageLive(_9);
@ -111,21 +111,14 @@
StorageDead(_1);
return;
}
+ }
}
+ ALLOC2 (size: 8, align: 4) { .. }
+
+ ALLOC3 (size: 8, align: 4) {
+ 00 00 00 00 00 00 00 00 │ ........
}
ALLOC1 (static: RC, size: 4, align: 4) { .. }
ALLOC2 (static: RC, size: 4, align: 4) {
╾ALLOC0<imm>╼ │ ╾──╼
}
- ALLOC2 (size: 8, align: 4) { .. }
+ ALLOC3 (size: 8, align: 4) { .. }
ALLOC0 (size: 8, align: 4) {
01 00 00 00 04 00 00 00 │ ........
}
ALLOC1 (static: statics::C, size: 8, align: 4) {
00 00 00 00 00 00 00 00 │ ........
}
ALLOC0 (static: statics::C, size: 8, align: 4) { .. }

View File

@ -43,7 +43,7 @@
bb0: {
StorageLive(_1);
StorageLive(_2);
_2 = const {ALLOC1: &E};
_2 = const {ALLOC0: &E};
- _1 = (*_2);
+ _1 = const E::V1(0_i32);
StorageDead(_2);
@ -79,7 +79,7 @@
bb4: {
StorageLive(_7);
StorageLive(_8);
_8 = const {ALLOC2: &&E};
_8 = const {ALLOC1: &&E};
_7 = (*_8);
StorageDead(_8);
StorageLive(_9);
@ -111,21 +111,14 @@
StorageDead(_1);
return;
}
+ }
}
+ ALLOC2 (size: 8, align: 4) { .. }
+
+ ALLOC3 (size: 8, align: 4) {
+ 00 00 00 00 00 00 00 00 │ ........
}
ALLOC1 (static: RC, size: 8, align: 8) { .. }
ALLOC2 (static: RC, size: 8, align: 8) {
╾ALLOC0<imm>╼ │ ╾──────╼
}
- ALLOC2 (size: 8, align: 4) { .. }
+ ALLOC3 (size: 8, align: 4) { .. }
ALLOC0 (size: 8, align: 4) {
01 00 00 00 04 00 00 00 │ ........
}
ALLOC1 (static: statics::C, size: 8, align: 4) {
00 00 00 00 00 00 00 00 │ ........
}
ALLOC0 (static: statics::C, size: 8, align: 4) { .. }

View File

@ -112,7 +112,7 @@
_9 = (_10.2: &[f32]);
StorageDead(_10);
StorageLive(_14);
_14 = const {ALLOC4: &&SmallStruct};
_14 = const {ALLOC0: &&SmallStruct};
_31 = deref_copy (*_14);
StorageLive(_11);
_32 = deref_copy (*_14);
@ -149,7 +149,7 @@
_21 = (_22.2: &[f32]);
StorageDead(_22);
StorageLive(_26);
_26 = const {ALLOC5: &&BigStruct};
_26 = const {ALLOC1: &&BigStruct};
_35 = deref_copy (*_26);
StorageLive(_23);
_36 = deref_copy (*_26);
@ -197,51 +197,31 @@
StorageDead(_1);
return;
}
+ }
}
+ ALLOC2 (size: 8, align: 4) { .. }
+
+ ALLOC6 (size: 8, align: 4) {
+ 01 00 00 00 23 00 00 00 │ ....#...
+ }
+ ALLOC3 (size: 8, align: 4) { .. }
+
+ ALLOC7 (size: 8, align: 4) {
+ 01 00 00 00 23 00 00 00 │ ....#...
+ }
+ ALLOC4 (size: 8, align: 4) { .. }
+
+ ALLOC8 (size: 8, align: 4) {
+ 01 00 00 00 23 00 00 00 │ ....#...
+ }
+ ALLOC5 (size: 8, align: 4) { .. }
+
+ ALLOC9 (size: 8, align: 4) {
+ 01 00 00 00 01 00 00 00 │ ........
+ }
+ ALLOC6 (size: 4, align: 4) { .. }
+
+ ALLOC10 (size: 4, align: 4) {
+ 01 00 00 00 │ ....
}
ALLOC1 (static: BIG_STAT, size: 4, align: 4) { .. }
ALLOC5 (static: BIG_STAT, size: 4, align: 4) {
╾ALLOC0<imm>╼ │ ╾──╼
}
- ALLOC2 (size: 20, align: 4) { .. }
+ ALLOC7 (size: 20, align: 4) { .. }
ALLOC0 (size: 20, align: 4) {
0x00 │ 01 00 00 00 23 00 00 00 ╾ALLOC1<imm>╼ 02 00 00 00 │ ....#...╾──╼....
0x10 │ 00 00 a4 42 │ ...B
}
- ALLOC3 (size: 8, align: 4) { .. }
+ ALLOC8 (size: 8, align: 4) { .. }
ALLOC1 (size: 8, align: 4) {
00 00 34 42 00 00 90 42 │ ..4B...B
}
ALLOC0 (static: SMALL_STAT, size: 4, align: 4) { .. }
ALLOC4 (static: SMALL_STAT, size: 4, align: 4) {
╾ALLOC2<imm>╼ │ ╾──╼
}
- ALLOC4 (size: 20, align: 4) { .. }
+ ALLOC9 (size: 20, align: 4) { .. }
ALLOC2 (size: 20, align: 4) {
0x00 │ 00 00 00 00 __ __ __ __ ╾ALLOC3<imm>╼ 01 00 00 00 │ ....░░░░╾──╼....
0x10 │ 00 00 10 41 │ ...A
}
ALLOC3 (size: 4, align: 4) {
00 00 50 41 │ ..PA
}
- ALLOC5 (size: 4, align: 4) { .. }
+ ALLOC10 (size: 4, align: 4) { .. }

View File

@ -112,7 +112,7 @@
_9 = (_10.2: &[f32]);
StorageDead(_10);
StorageLive(_14);
_14 = const {ALLOC4: &&SmallStruct};
_14 = const {ALLOC0: &&SmallStruct};
_31 = deref_copy (*_14);
StorageLive(_11);
_32 = deref_copy (*_14);
@ -149,7 +149,7 @@
_21 = (_22.2: &[f32]);
StorageDead(_22);
StorageLive(_26);
_26 = const {ALLOC5: &&BigStruct};
_26 = const {ALLOC1: &&BigStruct};
_35 = deref_copy (*_26);
StorageLive(_23);
_36 = deref_copy (*_26);
@ -197,51 +197,31 @@
StorageDead(_1);
return;
}
+ }
}
+ ALLOC2 (size: 8, align: 4) { .. }
+
+ ALLOC6 (size: 8, align: 4) {
+ 01 00 00 00 23 00 00 00 │ ....#...
+ }
+ ALLOC3 (size: 8, align: 4) { .. }
+
+ ALLOC7 (size: 8, align: 4) {
+ 01 00 00 00 23 00 00 00 │ ....#...
+ }
+ ALLOC4 (size: 8, align: 4) { .. }
+
+ ALLOC8 (size: 8, align: 4) {
+ 01 00 00 00 23 00 00 00 │ ....#...
+ }
+ ALLOC5 (size: 8, align: 4) { .. }
+
+ ALLOC9 (size: 8, align: 4) {
+ 01 00 00 00 01 00 00 00 │ ........
+ }
+ ALLOC6 (size: 4, align: 4) { .. }
+
+ ALLOC10 (size: 4, align: 4) {
+ 01 00 00 00 │ ....
}
ALLOC1 (static: BIG_STAT, size: 8, align: 8) { .. }
ALLOC5 (static: BIG_STAT, size: 8, align: 8) {
╾ALLOC0<imm>╼ │ ╾──────╼
}
- ALLOC2 (size: 32, align: 8) { .. }
+ ALLOC7 (size: 32, align: 8) { .. }
ALLOC0 (size: 32, align: 8) {
0x00 │ 01 00 00 00 23 00 00 00 ╾ALLOC1<imm>╼ │ ....#...╾──────╼
0x10 │ 02 00 00 00 00 00 00 00 00 00 a4 42 __ __ __ __ │ ...........B░░░░
}
- ALLOC3 (size: 8, align: 4) { .. }
+ ALLOC8 (size: 8, align: 4) { .. }
ALLOC1 (size: 8, align: 4) {
00 00 34 42 00 00 90 42 │ ..4B...B
}
ALLOC0 (static: SMALL_STAT, size: 8, align: 8) { .. }
ALLOC4 (static: SMALL_STAT, size: 8, align: 8) {
╾ALLOC2<imm>╼ │ ╾──────╼
}
- ALLOC4 (size: 32, align: 8) { .. }
+ ALLOC9 (size: 32, align: 8) { .. }
ALLOC2 (size: 32, align: 8) {
0x00 │ 00 00 00 00 __ __ __ __ ╾ALLOC3<imm>╼ │ ....░░░░╾──────╼
0x10 │ 01 00 00 00 00 00 00 00 00 00 10 41 __ __ __ __ │ ...........A░░░░
}
ALLOC3 (size: 4, align: 4) {
00 00 50 41 │ ..PA
}
- ALLOC5 (size: 4, align: 4) { .. }
+ ALLOC10 (size: 4, align: 4) { .. }

View File

@ -1,4 +1,5 @@
//@ test-mir-pass: DataflowConstProp
//@ compile-flags: -Zdump-mir-exclude-alloc-bytes
// EMIT_MIR_FOR_EACH_BIT_WIDTH
#[derive(Copy, Clone)]

View File

@ -92,21 +92,13 @@
StorageDead(_1);
return;
}
+ }
+
+ ALLOC0 (size: 8, align: 4) {
+ 02 00 00 00 03 00 00 00 │ ........
+ }
+
+ ALLOC1 (size: 8, align: 4) {
+ 02 00 00 00 03 00 00 00 │ ........
+ }
+
+ ALLOC2 (size: 8, align: 4) {
+ 02 00 00 00 03 00 00 00 │ ........
+ }
+
+ ALLOC3 (size: 8, align: 4) {
+ 01 00 00 00 02 00 00 00 │ ........
}
+
+ ALLOC0 (size: 8, align: 4) { .. }
+
+ ALLOC1 (size: 8, align: 4) { .. }
+
+ ALLOC2 (size: 8, align: 4) { .. }
+
+ ALLOC3 (size: 8, align: 4) { .. }

View File

@ -92,21 +92,13 @@
StorageDead(_1);
return;
}
+ }
+
+ ALLOC0 (size: 8, align: 4) {
+ 02 00 00 00 03 00 00 00 │ ........
+ }
+
+ ALLOC1 (size: 8, align: 4) {
+ 02 00 00 00 03 00 00 00 │ ........
+ }
+
+ ALLOC2 (size: 8, align: 4) {
+ 02 00 00 00 03 00 00 00 │ ........
+ }
+
+ ALLOC3 (size: 8, align: 4) {
+ 01 00 00 00 02 00 00 00 │ ........
}
+
+ ALLOC0 (size: 8, align: 4) { .. }
+
+ ALLOC1 (size: 8, align: 4) { .. }
+
+ ALLOC2 (size: 8, align: 4) { .. }
+
+ ALLOC3 (size: 8, align: 4) { .. }

View File

@ -1,4 +1,5 @@
//@ test-mir-pass: DataflowConstProp
//@ compile-flags: -Zdump-mir-exclude-alloc-bytes
// EMIT_MIR_FOR_EACH_BIT_WIDTH
// EMIT_MIR tuple.main.DataflowConstProp.diff

View File

@ -64,9 +64,7 @@
StorageDead(_1);
return;
}
+ }
+
+ ALLOC0 (size: 8, align: 4) {
+ 02 00 00 00 05 20 00 00 │ ..... ..
}
+
+ ALLOC0 (size: 8, align: 4) { .. }

View File

@ -64,9 +64,7 @@
StorageDead(_1);
return;
}
+ }
+
+ ALLOC0 (size: 16, align: 8) {
+ 02 00 00 00 00 00 00 00 05 20 00 00 00 00 00 00 │ ......... ......
}
+
+ ALLOC0 (size: 16, align: 8) { .. }

View File

@ -1,7 +1,7 @@
// skip-filecheck
//@ test-mir-pass: EnumSizeOpt
// EMIT_MIR_FOR_EACH_BIT_WIDTH
//@ compile-flags: -Zunsound-mir-opts
//@ compile-flags: -Zunsound-mir-opts -Zdump-mir-exclude-alloc-bytes
#![feature(arbitrary_enum_discriminant, repr128)]

View File

@ -64,9 +64,7 @@
StorageDead(_1);
return;
}
+ }
+
+ ALLOC0 (size: 8, align: 4) {
+ 05 20 00 00 01 00 00 00 │ . ......
}
+
+ ALLOC0 (size: 8, align: 4) { .. }

View File

@ -64,9 +64,7 @@
StorageDead(_1);
return;
}
+ }
+
+ ALLOC0 (size: 16, align: 8) {
+ 05 20 00 00 00 00 00 00 01 00 00 00 00 00 00 00 │ . ..............
}
+
+ ALLOC0 (size: 16, align: 8) { .. }

View File

@ -140,9 +140,7 @@
_0 = const ();
return;
}
+ }
+
+ ALLOC0 (size: 16, align: 8) {
+ 00 00 00 00 00 00 00 00 00 __ __ __ __ __ __ __ │ .........░░░░░░░
}
+
+ ALLOC0 (size: 16, align: 8) { .. }

View File

@ -140,9 +140,7 @@
_0 = const ();
return;
}
+ }
+
+ ALLOC0 (size: 16, align: 8) {
+ 00 00 00 00 00 00 00 00 00 __ __ __ __ __ __ __ │ .........░░░░░░░
}
+
+ ALLOC0 (size: 16, align: 8) { .. }

View File

@ -8,10 +8,10 @@
let mut _3: fn(u8) -> u8;
let _5: ();
let mut _6: fn(u8) -> u8;
let mut _9: {closure@$DIR/gvn.rs:614:19: 614:21};
let mut _9: {closure@$DIR/gvn.rs:615:19: 615:21};
let _10: ();
let mut _11: fn();
let mut _13: {closure@$DIR/gvn.rs:614:19: 614:21};
let mut _13: {closure@$DIR/gvn.rs:615:19: 615:21};
let _14: ();
let mut _15: fn();
scope 1 {
@ -19,7 +19,7 @@
let _4: fn(u8) -> u8;
scope 2 {
debug g => _4;
let _7: {closure@$DIR/gvn.rs:614:19: 614:21};
let _7: {closure@$DIR/gvn.rs:615:19: 615:21};
scope 3 {
debug closure => _7;
let _8: fn();
@ -62,16 +62,16 @@
StorageDead(_6);
StorageDead(_5);
- StorageLive(_7);
- _7 = {closure@$DIR/gvn.rs:614:19: 614:21};
- _7 = {closure@$DIR/gvn.rs:615:19: 615:21};
- StorageLive(_8);
+ nop;
+ _7 = const ZeroSized: {closure@$DIR/gvn.rs:614:19: 614:21};
+ _7 = const ZeroSized: {closure@$DIR/gvn.rs:615:19: 615:21};
+ nop;
StorageLive(_9);
- _9 = _7;
- _8 = move _9 as fn() (PointerCoercion(ClosureFnPointer(Safe)));
+ _9 = const ZeroSized: {closure@$DIR/gvn.rs:614:19: 614:21};
+ _8 = const ZeroSized: {closure@$DIR/gvn.rs:614:19: 614:21} as fn() (PointerCoercion(ClosureFnPointer(Safe)));
+ _9 = const ZeroSized: {closure@$DIR/gvn.rs:615:19: 615:21};
+ _8 = const ZeroSized: {closure@$DIR/gvn.rs:615:19: 615:21} as fn() (PointerCoercion(ClosureFnPointer(Safe)));
StorageDead(_9);
StorageLive(_10);
StorageLive(_11);
@ -88,8 +88,8 @@
StorageLive(_13);
- _13 = _7;
- _12 = move _13 as fn() (PointerCoercion(ClosureFnPointer(Safe)));
+ _13 = const ZeroSized: {closure@$DIR/gvn.rs:614:19: 614:21};
+ _12 = const ZeroSized: {closure@$DIR/gvn.rs:614:19: 614:21} as fn() (PointerCoercion(ClosureFnPointer(Safe)));
+ _13 = const ZeroSized: {closure@$DIR/gvn.rs:615:19: 615:21};
+ _12 = const ZeroSized: {closure@$DIR/gvn.rs:615:19: 615:21} as fn() (PointerCoercion(ClosureFnPointer(Safe)));
StorageDead(_13);
StorageLive(_14);
StorageLive(_15);

View File

@ -8,10 +8,10 @@
let mut _3: fn(u8) -> u8;
let _5: ();
let mut _6: fn(u8) -> u8;
let mut _9: {closure@$DIR/gvn.rs:614:19: 614:21};
let mut _9: {closure@$DIR/gvn.rs:615:19: 615:21};
let _10: ();
let mut _11: fn();
let mut _13: {closure@$DIR/gvn.rs:614:19: 614:21};
let mut _13: {closure@$DIR/gvn.rs:615:19: 615:21};
let _14: ();
let mut _15: fn();
scope 1 {
@ -19,7 +19,7 @@
let _4: fn(u8) -> u8;
scope 2 {
debug g => _4;
let _7: {closure@$DIR/gvn.rs:614:19: 614:21};
let _7: {closure@$DIR/gvn.rs:615:19: 615:21};
scope 3 {
debug closure => _7;
let _8: fn();
@ -62,16 +62,16 @@
StorageDead(_6);
StorageDead(_5);
- StorageLive(_7);
- _7 = {closure@$DIR/gvn.rs:614:19: 614:21};
- _7 = {closure@$DIR/gvn.rs:615:19: 615:21};
- StorageLive(_8);
+ nop;
+ _7 = const ZeroSized: {closure@$DIR/gvn.rs:614:19: 614:21};
+ _7 = const ZeroSized: {closure@$DIR/gvn.rs:615:19: 615:21};
+ nop;
StorageLive(_9);
- _9 = _7;
- _8 = move _9 as fn() (PointerCoercion(ClosureFnPointer(Safe)));
+ _9 = const ZeroSized: {closure@$DIR/gvn.rs:614:19: 614:21};
+ _8 = const ZeroSized: {closure@$DIR/gvn.rs:614:19: 614:21} as fn() (PointerCoercion(ClosureFnPointer(Safe)));
+ _9 = const ZeroSized: {closure@$DIR/gvn.rs:615:19: 615:21};
+ _8 = const ZeroSized: {closure@$DIR/gvn.rs:615:19: 615:21} as fn() (PointerCoercion(ClosureFnPointer(Safe)));
StorageDead(_9);
StorageLive(_10);
StorageLive(_11);
@ -88,8 +88,8 @@
StorageLive(_13);
- _13 = _7;
- _12 = move _13 as fn() (PointerCoercion(ClosureFnPointer(Safe)));
+ _13 = const ZeroSized: {closure@$DIR/gvn.rs:614:19: 614:21};
+ _12 = const ZeroSized: {closure@$DIR/gvn.rs:614:19: 614:21} as fn() (PointerCoercion(ClosureFnPointer(Safe)));
+ _13 = const ZeroSized: {closure@$DIR/gvn.rs:615:19: 615:21};
+ _12 = const ZeroSized: {closure@$DIR/gvn.rs:615:19: 615:21} as fn() (PointerCoercion(ClosureFnPointer(Safe)));
StorageDead(_13);
StorageLive(_14);
StorageLive(_15);

View File

@ -13,7 +13,5 @@
}
}
ALLOC0 (static: A, size: 2, align: 1) {
00 __ │ .░
}
ALLOC0 (static: A, size: 2, align: 1) { .. }

View File

@ -13,7 +13,5 @@
}
}
ALLOC0 (static: A, size: 2, align: 1) {
00 __ │ .░
}
ALLOC0 (static: A, size: 2, align: 1) { .. }

View File

@ -1,4 +1,5 @@
//@ test-mir-pass: GVN
//@ compile-flags: -Zdump-mir-exclude-alloc-bytes
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
//@ only-64bit

View File

@ -176,13 +176,9 @@
+ nop;
return;
}
+ }
+
+ ALLOC1 (size: 16, align: 8) {
+ 01 00 00 00 00 00 00 00 02 00 00 00 00 00 00 00 │ ................
+ }
+
+ ALLOC0 (size: 16, align: 8) {
+ 01 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 │ ................
}
+
+ ALLOC1 (size: 16, align: 8) { .. }
+
+ ALLOC0 (size: 16, align: 8) { .. }

View File

@ -176,13 +176,9 @@
+ nop;
return;
}
+ }
+
+ ALLOC1 (size: 16, align: 8) {
+ 01 00 00 00 00 00 00 00 02 00 00 00 00 00 00 00 │ ................
+ }
+
+ ALLOC0 (size: 16, align: 8) {
+ 01 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 │ ................
}
+
+ ALLOC1 (size: 16, align: 8) { .. }
+
+ ALLOC0 (size: 16, align: 8) { .. }

View File

@ -61,9 +61,7 @@
StorageDead(_1);
return;
}
+ }
+
+ ALLOC0 (size: 8, align: 4) {
+ 04 00 00 00 00 __ __ __ │ .....░░░
}
+
+ ALLOC0 (size: 8, align: 4) { .. }

View File

@ -61,9 +61,7 @@
StorageDead(_1);
return;
}
+ }
+
+ ALLOC0 (size: 8, align: 4) {
+ 04 00 00 00 00 __ __ __ │ .....░░░
}
+
+ ALLOC0 (size: 8, align: 4) { .. }

View File

@ -61,9 +61,7 @@
StorageDead(_1);
return;
}
+ }
+
+ ALLOC0 (size: 8, align: 4) {
+ 04 00 00 00 00 __ __ __ │ .....░░░
}
+
+ ALLOC0 (size: 8, align: 4) { .. }

View File

@ -61,9 +61,7 @@
StorageDead(_1);
return;
}
+ }
+
+ ALLOC0 (size: 8, align: 4) {
+ 04 00 00 00 00 __ __ __ │ .....░░░
}
+
+ ALLOC0 (size: 8, align: 4) { .. }

Some files were not shown because too many files have changed in this diff Show More