mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-01 19:23:50 +00:00
Auto merge of #105531 - matthiaskrgr:rollup-7y7zbgl, r=matthiaskrgr
Rollup of 6 pull requests Successful merges: - #104460 (Migrate parts of `rustc_expand` to session diagnostics) - #105192 (Point at LHS on binop type err if relevant) - #105234 (Remove unneeded field from `SwitchTargets`) - #105239 (Avoid heap allocation when truncating thread names) - #105410 (Consider `parent_count` for const param defaults) - #105482 (Fix invalid codegen during debuginfo lowering) Failed merges: - #105411 (Introduce `with_forced_trimmed_paths`) r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
commit
32da230588
@ -106,7 +106,7 @@ impl<'cx, 'tcx> Visitor<'tcx> for InvalidationGenerator<'cx, 'tcx> {
|
||||
self.check_activations(location);
|
||||
|
||||
match &terminator.kind {
|
||||
TerminatorKind::SwitchInt { discr, switch_ty: _, targets: _ } => {
|
||||
TerminatorKind::SwitchInt { discr, targets: _ } => {
|
||||
self.consume_operand(location, discr);
|
||||
}
|
||||
TerminatorKind::Drop { place: drop_place, target: _, unwind: _ } => {
|
||||
|
@ -644,7 +644,7 @@ impl<'cx, 'tcx> rustc_mir_dataflow::ResultsVisitor<'cx, 'tcx> for MirBorrowckCtx
|
||||
self.check_activations(loc, span, flow_state);
|
||||
|
||||
match &term.kind {
|
||||
TerminatorKind::SwitchInt { discr, switch_ty: _, targets: _ } => {
|
||||
TerminatorKind::SwitchInt { discr, targets: _ } => {
|
||||
self.consume_operand(loc, (discr, span), flow_state);
|
||||
}
|
||||
TerminatorKind::Drop { place, target: _, unwind: _ } => {
|
||||
|
@ -1360,25 +1360,10 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
|
||||
);
|
||||
}
|
||||
}
|
||||
TerminatorKind::SwitchInt { discr, switch_ty, .. } => {
|
||||
TerminatorKind::SwitchInt { discr, .. } => {
|
||||
self.check_operand(discr, term_location);
|
||||
|
||||
let discr_ty = discr.ty(body, tcx);
|
||||
if let Err(terr) = self.sub_types(
|
||||
discr_ty,
|
||||
*switch_ty,
|
||||
term_location.to_locations(),
|
||||
ConstraintCategory::Assignment,
|
||||
) {
|
||||
span_mirbug!(
|
||||
self,
|
||||
term,
|
||||
"bad SwitchInt ({:?} on {:?}): {:?}",
|
||||
switch_ty,
|
||||
discr_ty,
|
||||
terr
|
||||
);
|
||||
}
|
||||
let switch_ty = discr.ty(body, tcx);
|
||||
if !switch_ty.is_integral() && !switch_ty.is_char() && !switch_ty.is_bool() {
|
||||
span_mirbug!(self, term, "bad SwitchInt discr ty {:?}", switch_ty);
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ pub fn expand_concat(
|
||||
sp: rustc_span::Span,
|
||||
tts: TokenStream,
|
||||
) -> Box<dyn base::MacResult + 'static> {
|
||||
let Some(es) = base::get_exprs_from_tts(cx, sp, tts) else {
|
||||
let Some(es) = base::get_exprs_from_tts(cx, tts) else {
|
||||
return DummyResult::any(sp);
|
||||
};
|
||||
let mut accumulator = String::new();
|
||||
|
@ -137,7 +137,7 @@ pub fn expand_concat_bytes(
|
||||
sp: rustc_span::Span,
|
||||
tts: TokenStream,
|
||||
) -> Box<dyn base::MacResult + 'static> {
|
||||
let Some(es) = base::get_exprs_from_tts(cx, sp, tts) else {
|
||||
let Some(es) = base::get_exprs_from_tts(cx, tts) else {
|
||||
return DummyResult::any(sp);
|
||||
};
|
||||
let mut accumulator = Vec::new();
|
||||
|
@ -52,7 +52,7 @@ pub fn expand_env<'cx>(
|
||||
sp: Span,
|
||||
tts: TokenStream,
|
||||
) -> Box<dyn base::MacResult + 'cx> {
|
||||
let mut exprs = match get_exprs_from_tts(cx, sp, tts) {
|
||||
let mut exprs = match get_exprs_from_tts(cx, tts) {
|
||||
Some(exprs) if exprs.is_empty() => {
|
||||
cx.span_err(sp, "env! takes 1 or 2 arguments");
|
||||
return DummyResult::any(sp);
|
||||
|
@ -372,8 +372,10 @@ fn codegen_fn_body(fx: &mut FunctionCx<'_, '_, '_>, start_block: Block) {
|
||||
}
|
||||
}
|
||||
|
||||
TerminatorKind::SwitchInt { discr, switch_ty, targets } => {
|
||||
let discr = codegen_operand(fx, discr).load_scalar(fx);
|
||||
TerminatorKind::SwitchInt { discr, targets } => {
|
||||
let discr = codegen_operand(fx, discr);
|
||||
let switch_ty = discr.layout().ty;
|
||||
let discr = discr.load_scalar(fx);
|
||||
|
||||
let use_bool_opt = switch_ty.kind() == fx.tcx.types.bool.kind()
|
||||
|| (targets.iter().count() == 1 && targets.iter().next().unwrap().0 == 0);
|
||||
|
@ -307,12 +307,10 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
|
||||
helper: TerminatorCodegenHelper<'tcx>,
|
||||
bx: &mut Bx,
|
||||
discr: &mir::Operand<'tcx>,
|
||||
switch_ty: Ty<'tcx>,
|
||||
targets: &SwitchTargets,
|
||||
) {
|
||||
let discr = self.codegen_operand(bx, &discr);
|
||||
// `switch_ty` is redundant, sanity-check that.
|
||||
assert_eq!(discr.layout.ty, switch_ty);
|
||||
let switch_ty = discr.layout.ty;
|
||||
let mut target_iter = targets.iter();
|
||||
if target_iter.len() == 1 {
|
||||
// If there are two targets (one conditional, one fallback), emit `br` instead of
|
||||
@ -1293,8 +1291,8 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
|
||||
helper.funclet_br(self, bx, target, mergeable_succ())
|
||||
}
|
||||
|
||||
mir::TerminatorKind::SwitchInt { ref discr, switch_ty, ref targets } => {
|
||||
self.codegen_switchint_terminator(helper, bx, discr, switch_ty, targets);
|
||||
mir::TerminatorKind::SwitchInt { ref discr, ref targets } => {
|
||||
self.codegen_switchint_terminator(helper, bx, discr, targets);
|
||||
MergingSucc::False
|
||||
}
|
||||
|
||||
|
@ -3,12 +3,12 @@ use rustc_index::vec::IndexVec;
|
||||
use rustc_middle::middle::codegen_fn_attrs::CodegenFnAttrFlags;
|
||||
use rustc_middle::mir;
|
||||
use rustc_middle::ty;
|
||||
use rustc_middle::ty::layout::TyAndLayout;
|
||||
use rustc_middle::ty::layout::{HasTyCtxt, LayoutOf};
|
||||
use rustc_session::config::DebugInfo;
|
||||
use rustc_span::symbol::{kw, Symbol};
|
||||
use rustc_span::{BytePos, Span};
|
||||
use rustc_target::abi::Abi;
|
||||
use rustc_target::abi::Size;
|
||||
use rustc_target::abi::{Abi, Size, VariantIdx};
|
||||
|
||||
use super::operand::{OperandRef, OperandValue};
|
||||
use super::place::PlaceRef;
|
||||
@ -76,6 +76,106 @@ impl<'tcx, S: Copy, L: Copy> DebugScope<S, L> {
|
||||
}
|
||||
}
|
||||
|
||||
trait DebugInfoOffsetLocation<'tcx, Bx> {
|
||||
fn deref(&self, bx: &mut Bx) -> Self;
|
||||
fn layout(&self) -> TyAndLayout<'tcx>;
|
||||
fn project_field(&self, bx: &mut Bx, field: mir::Field) -> Self;
|
||||
fn downcast(&self, bx: &mut Bx, variant: VariantIdx) -> Self;
|
||||
}
|
||||
|
||||
impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> DebugInfoOffsetLocation<'tcx, Bx>
|
||||
for PlaceRef<'tcx, Bx::Value>
|
||||
{
|
||||
fn deref(&self, bx: &mut Bx) -> Self {
|
||||
bx.load_operand(*self).deref(bx.cx())
|
||||
}
|
||||
|
||||
fn layout(&self) -> TyAndLayout<'tcx> {
|
||||
self.layout
|
||||
}
|
||||
|
||||
fn project_field(&self, bx: &mut Bx, field: mir::Field) -> Self {
|
||||
PlaceRef::project_field(*self, bx, field.index())
|
||||
}
|
||||
|
||||
fn downcast(&self, bx: &mut Bx, variant: VariantIdx) -> Self {
|
||||
self.project_downcast(bx, variant)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> DebugInfoOffsetLocation<'tcx, Bx>
|
||||
for TyAndLayout<'tcx>
|
||||
{
|
||||
fn deref(&self, bx: &mut Bx) -> Self {
|
||||
bx.cx().layout_of(
|
||||
self.ty.builtin_deref(true).unwrap_or_else(|| bug!("cannot deref `{}`", self.ty)).ty,
|
||||
)
|
||||
}
|
||||
|
||||
fn layout(&self) -> TyAndLayout<'tcx> {
|
||||
*self
|
||||
}
|
||||
|
||||
fn project_field(&self, bx: &mut Bx, field: mir::Field) -> Self {
|
||||
self.field(bx.cx(), field.index())
|
||||
}
|
||||
|
||||
fn downcast(&self, bx: &mut Bx, variant: VariantIdx) -> Self {
|
||||
self.for_variant(bx.cx(), variant)
|
||||
}
|
||||
}
|
||||
|
||||
struct DebugInfoOffset<T> {
|
||||
/// Offset from the `base` used to calculate the debuginfo offset.
|
||||
direct_offset: Size,
|
||||
/// Each offset in this vector indicates one level of indirection from the base or previous
|
||||
/// indirect offset plus a dereference.
|
||||
indirect_offsets: Vec<Size>,
|
||||
/// The final location debuginfo should point to.
|
||||
result: T,
|
||||
}
|
||||
|
||||
fn calculate_debuginfo_offset<
|
||||
'a,
|
||||
'tcx,
|
||||
Bx: BuilderMethods<'a, 'tcx>,
|
||||
L: DebugInfoOffsetLocation<'tcx, Bx>,
|
||||
>(
|
||||
bx: &mut Bx,
|
||||
local: mir::Local,
|
||||
var: &PerLocalVarDebugInfo<'tcx, Bx::DIVariable>,
|
||||
base: L,
|
||||
) -> DebugInfoOffset<L> {
|
||||
let mut direct_offset = Size::ZERO;
|
||||
// FIXME(eddyb) use smallvec here.
|
||||
let mut indirect_offsets = vec![];
|
||||
let mut place = base;
|
||||
|
||||
for elem in &var.projection[..] {
|
||||
match *elem {
|
||||
mir::ProjectionElem::Deref => {
|
||||
indirect_offsets.push(Size::ZERO);
|
||||
place = place.deref(bx);
|
||||
}
|
||||
mir::ProjectionElem::Field(field, _) => {
|
||||
let offset = indirect_offsets.last_mut().unwrap_or(&mut direct_offset);
|
||||
*offset += place.layout().fields.offset(field.index());
|
||||
place = place.project_field(bx, field);
|
||||
}
|
||||
mir::ProjectionElem::Downcast(_, variant) => {
|
||||
place = place.downcast(bx, variant);
|
||||
}
|
||||
_ => span_bug!(
|
||||
var.source_info.span,
|
||||
"unsupported var debuginfo place `{:?}`",
|
||||
mir::Place { local, projection: var.projection },
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
DebugInfoOffset { direct_offset, indirect_offsets, result: place }
|
||||
}
|
||||
|
||||
impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
|
||||
pub fn set_debug_loc(&self, bx: &mut Bx, source_info: mir::SourceInfo) {
|
||||
bx.set_span(source_info.span);
|
||||
@ -262,33 +362,8 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
|
||||
let Some(dbg_var) = var.dbg_var else { continue };
|
||||
let Some(dbg_loc) = self.dbg_loc(var.source_info) else { continue };
|
||||
|
||||
let mut direct_offset = Size::ZERO;
|
||||
// FIXME(eddyb) use smallvec here.
|
||||
let mut indirect_offsets = vec![];
|
||||
let mut place = base;
|
||||
|
||||
for elem in &var.projection[..] {
|
||||
match *elem {
|
||||
mir::ProjectionElem::Deref => {
|
||||
indirect_offsets.push(Size::ZERO);
|
||||
place = bx.load_operand(place).deref(bx.cx());
|
||||
}
|
||||
mir::ProjectionElem::Field(field, _) => {
|
||||
let i = field.index();
|
||||
let offset = indirect_offsets.last_mut().unwrap_or(&mut direct_offset);
|
||||
*offset += place.layout.fields.offset(i);
|
||||
place = place.project_field(bx, i);
|
||||
}
|
||||
mir::ProjectionElem::Downcast(_, variant) => {
|
||||
place = place.project_downcast(bx, variant);
|
||||
}
|
||||
_ => span_bug!(
|
||||
var.source_info.span,
|
||||
"unsupported var debuginfo place `{:?}`",
|
||||
mir::Place { local, projection: var.projection },
|
||||
),
|
||||
}
|
||||
}
|
||||
let DebugInfoOffset { direct_offset, indirect_offsets, result: _ } =
|
||||
calculate_debuginfo_offset(bx, local, &var, base.layout);
|
||||
|
||||
// When targeting MSVC, create extra allocas for arguments instead of pointing multiple
|
||||
// dbg_var_addr() calls into the same alloca with offsets. MSVC uses CodeView records
|
||||
@ -306,6 +381,9 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
|
||||
|| !matches!(&indirect_offsets[..], [Size::ZERO] | []));
|
||||
|
||||
if should_create_individual_allocas {
|
||||
let DebugInfoOffset { direct_offset: _, indirect_offsets: _, result: place } =
|
||||
calculate_debuginfo_offset(bx, local, &var, base);
|
||||
|
||||
// Create a variable which will be a pointer to the actual value
|
||||
let ptr_ty = bx.tcx().mk_ty(ty::RawPtr(ty::TypeAndMut {
|
||||
mutbl: mir::Mutability::Mut,
|
||||
|
@ -29,10 +29,9 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
|
||||
|
||||
Goto { target } => self.go_to_block(target),
|
||||
|
||||
SwitchInt { ref discr, ref targets, switch_ty } => {
|
||||
SwitchInt { ref discr, ref targets } => {
|
||||
let discr = self.read_immediate(&self.eval_operand(discr, None)?)?;
|
||||
trace!("SwitchInt({:?})", *discr);
|
||||
assert_eq!(discr.layout.ty, switch_ty);
|
||||
|
||||
// Branch to the `otherwise` case by default, if no match is found.
|
||||
let mut target_block = targets.otherwise();
|
||||
|
@ -686,17 +686,8 @@ impl<'a, 'tcx> Visitor<'tcx> for TypeChecker<'a, 'tcx> {
|
||||
TerminatorKind::Goto { target } => {
|
||||
self.check_edge(location, *target, EdgeKind::Normal);
|
||||
}
|
||||
TerminatorKind::SwitchInt { targets, switch_ty, discr } => {
|
||||
let ty = discr.ty(&self.body.local_decls, self.tcx);
|
||||
if ty != *switch_ty {
|
||||
self.fail(
|
||||
location,
|
||||
format!(
|
||||
"encountered `SwitchInt` terminator with type mismatch: {:?} != {:?}",
|
||||
ty, switch_ty,
|
||||
),
|
||||
);
|
||||
}
|
||||
TerminatorKind::SwitchInt { targets, discr } => {
|
||||
let switch_ty = discr.ty(&self.body.local_decls, self.tcx);
|
||||
|
||||
let target_width = self.tcx.sess.target.pointer_width;
|
||||
|
||||
|
@ -20,3 +20,110 @@ expand_var_still_repeating =
|
||||
variable '{$ident}' is still repeating at this depth
|
||||
|
||||
expand_meta_var_dif_seq_matchers = {$msg}
|
||||
|
||||
expand_macro_const_stability =
|
||||
macros cannot have const stability attributes
|
||||
.label = invalid const stability attribute
|
||||
.label2 = const stability attribute affects this macro
|
||||
|
||||
expand_macro_body_stability =
|
||||
macros cannot have body stability attributes
|
||||
.label = invalid body stability attribute
|
||||
.label2 = body stability attribute affects this macro
|
||||
|
||||
expand_resolve_relative_path =
|
||||
cannot resolve relative path in non-file source `{$path}`
|
||||
|
||||
expand_attr_no_arguments =
|
||||
attribute must have either one or two arguments
|
||||
|
||||
expand_not_a_meta_item =
|
||||
not a meta item
|
||||
|
||||
expand_only_one_word =
|
||||
must only be one word
|
||||
|
||||
expand_cannot_be_name_of_macro =
|
||||
`{$trait_ident}` cannot be a name of {$macro_type} macro
|
||||
|
||||
expand_arg_not_attributes =
|
||||
second argument must be `attributes`
|
||||
|
||||
expand_attributes_wrong_form =
|
||||
attribute must be of form: `attributes(foo, bar)`
|
||||
|
||||
expand_attribute_meta_item =
|
||||
attribute must be a meta item, not a literal
|
||||
|
||||
expand_attribute_single_word =
|
||||
attribute must only be a single word
|
||||
|
||||
expand_helper_attribute_name_invalid =
|
||||
`{$name}` cannot be a name of derive helper attribute
|
||||
|
||||
expand_expected_comma_in_list =
|
||||
expected token: `,`
|
||||
|
||||
expand_only_one_argument =
|
||||
{$name} takes 1 argument
|
||||
|
||||
expand_takes_no_arguments =
|
||||
{$name} takes no arguments
|
||||
|
||||
expand_feature_included_in_edition =
|
||||
the feature `{$feature}` is included in the Rust {$edition} edition
|
||||
|
||||
expand_feature_removed =
|
||||
feature has been removed
|
||||
.label = feature has been removed
|
||||
.reason = {$reason}
|
||||
|
||||
expand_feature_not_allowed =
|
||||
the feature `{$name}` is not in the list of allowed features
|
||||
|
||||
expand_recursion_limit_reached =
|
||||
recursion limit reached while expanding `{$descr}`
|
||||
.help = consider increasing the recursion limit by adding a `#![recursion_limit = "{$suggested_limit}"]` attribute to your crate (`{$crate_name}`)
|
||||
|
||||
expand_malformed_feature_attribute =
|
||||
malformed `feature` attribute input
|
||||
.expected = expected just one word
|
||||
|
||||
expand_remove_expr_not_supported =
|
||||
removing an expression is not supported in this position
|
||||
|
||||
expand_invalid_cfg_no_parens = `cfg` is not followed by parentheses
|
||||
expand_invalid_cfg_no_predicate = `cfg` predicate is not specified
|
||||
expand_invalid_cfg_multiple_predicates = multiple `cfg` predicates are specified
|
||||
expand_invalid_cfg_predicate_literal = `cfg` predicate key cannot be a literal
|
||||
expand_invalid_cfg_expected_syntax = expected syntax is
|
||||
|
||||
expand_wrong_fragment_kind =
|
||||
non-{$kind} macro in {$kind} position: {$name}
|
||||
|
||||
expand_unsupported_key_value =
|
||||
key-value macro attributes are not supported
|
||||
|
||||
expand_incomplete_parse =
|
||||
macro expansion ignores token `{$token}` and any following
|
||||
.label = caused by the macro expansion here
|
||||
.note = the usage of `{$macro_path}!` is likely invalid in {$kind_name} context
|
||||
.suggestion_add_semi = you might be missing a semicolon here
|
||||
|
||||
expand_remove_node_not_supported =
|
||||
removing {$descr} is not supported in this position
|
||||
|
||||
expand_module_circular =
|
||||
circular modules: {$modules}
|
||||
|
||||
expand_module_in_block =
|
||||
cannot declare a non-inline module inside a block unless it has a path attribute
|
||||
.note = maybe `use` the module `{$name}` instead of redeclaring it
|
||||
|
||||
expand_module_file_not_found =
|
||||
file not found for module `{$name}`
|
||||
.help = to create the module `{$name}`, create file "{$default_path}" or "{$secondary_path}"
|
||||
|
||||
expand_module_multiple_candidates =
|
||||
file for module `{$name}` found at both "{$default_path}" and "{$secondary_path}"
|
||||
.help = delete or rename one of them to remove the ambiguity
|
||||
|
@ -152,6 +152,12 @@ impl IntoDiagnosticArg for ast::Path {
|
||||
}
|
||||
}
|
||||
|
||||
impl IntoDiagnosticArg for &ast::Path {
|
||||
fn into_diagnostic_arg(self) -> DiagnosticArgValue<'static> {
|
||||
DiagnosticArgValue::Str(Cow::Owned(pprust::path_to_string(self)))
|
||||
}
|
||||
}
|
||||
|
||||
impl IntoDiagnosticArg for ast::token::Token {
|
||||
fn into_diagnostic_arg(self) -> DiagnosticArgValue<'static> {
|
||||
DiagnosticArgValue::Str(pprust::token_to_string(&self))
|
||||
|
@ -1,3 +1,11 @@
|
||||
#![deny(rustc::untranslatable_diagnostic)]
|
||||
|
||||
use crate::errors::{
|
||||
ArgumentNotAttributes, AttrNoArguments, AttributeMetaItem, AttributeSingleWord,
|
||||
AttributesWrongForm, CannotBeNameOfMacro, ExpectedCommaInList, HelperAttributeNameInvalid,
|
||||
MacroBodyStability, MacroConstStability, NotAMetaItem, OnlyOneArgument, OnlyOneWord,
|
||||
ResolveRelativePath, TakesNoArguments,
|
||||
};
|
||||
use crate::expand::{self, AstFragment, Invocation};
|
||||
use crate::module::DirOwnership;
|
||||
|
||||
@ -789,26 +797,16 @@ impl SyntaxExtension {
|
||||
.unwrap_or_else(|| (None, helper_attrs));
|
||||
let (stability, const_stability, body_stability) = attr::find_stability(&sess, attrs, span);
|
||||
if let Some((_, sp)) = const_stability {
|
||||
sess.parse_sess
|
||||
.span_diagnostic
|
||||
.struct_span_err(sp, "macros cannot have const stability attributes")
|
||||
.span_label(sp, "invalid const stability attribute")
|
||||
.span_label(
|
||||
sess.source_map().guess_head_span(span),
|
||||
"const stability attribute affects this macro",
|
||||
)
|
||||
.emit();
|
||||
sess.emit_err(MacroConstStability {
|
||||
span: sp,
|
||||
head_span: sess.source_map().guess_head_span(span),
|
||||
});
|
||||
}
|
||||
if let Some((_, sp)) = body_stability {
|
||||
sess.parse_sess
|
||||
.span_diagnostic
|
||||
.struct_span_err(sp, "macros cannot have body stability attributes")
|
||||
.span_label(sp, "invalid body stability attribute")
|
||||
.span_label(
|
||||
sess.source_map().guess_head_span(span),
|
||||
"body stability attribute affects this macro",
|
||||
)
|
||||
.emit();
|
||||
sess.emit_err(MacroBodyStability {
|
||||
span: sp,
|
||||
head_span: sess.source_map().guess_head_span(span),
|
||||
});
|
||||
}
|
||||
|
||||
SyntaxExtension {
|
||||
@ -1200,13 +1198,11 @@ pub fn resolve_path(
|
||||
.expect("attempting to resolve a file path in an external file"),
|
||||
FileName::DocTest(path, _) => path,
|
||||
other => {
|
||||
return Err(parse_sess.span_diagnostic.struct_span_err(
|
||||
return Err(ResolveRelativePath {
|
||||
span,
|
||||
&format!(
|
||||
"cannot resolve relative path in non-file source `{}`",
|
||||
parse_sess.source_map().filename_for_diagnostics(&other)
|
||||
),
|
||||
));
|
||||
path: parse_sess.source_map().filename_for_diagnostics(&other).to_string(),
|
||||
}
|
||||
.into_diagnostic(&parse_sess.span_diagnostic));
|
||||
}
|
||||
};
|
||||
result.pop();
|
||||
@ -1222,6 +1218,8 @@ pub fn resolve_path(
|
||||
/// The returned bool indicates whether an applicable suggestion has already been
|
||||
/// added to the diagnostic to avoid emitting multiple suggestions. `Err(None)`
|
||||
/// indicates that an ast error was encountered.
|
||||
// FIXME(Nilstrieb) Make this function setup translatable
|
||||
#[allow(rustc::untranslatable_diagnostic)]
|
||||
pub fn expr_to_spanned_string<'a>(
|
||||
cx: &'a mut ExtCtxt<'_>,
|
||||
expr: P<ast::Expr>,
|
||||
@ -1280,9 +1278,9 @@ pub fn expr_to_string(
|
||||
/// compilation should call
|
||||
/// `cx.parse_sess.span_diagnostic.abort_if_errors()` (this should be
|
||||
/// done as rarely as possible).
|
||||
pub fn check_zero_tts(cx: &ExtCtxt<'_>, sp: Span, tts: TokenStream, name: &str) {
|
||||
pub fn check_zero_tts(cx: &ExtCtxt<'_>, span: Span, tts: TokenStream, name: &str) {
|
||||
if !tts.is_empty() {
|
||||
cx.span_err(sp, &format!("{} takes no arguments", name));
|
||||
cx.emit_err(TakesNoArguments { span, name });
|
||||
}
|
||||
}
|
||||
|
||||
@ -1304,31 +1302,27 @@ pub fn parse_expr(p: &mut parser::Parser<'_>) -> Option<P<ast::Expr>> {
|
||||
/// expect exactly one string literal, or emit an error and return `None`.
|
||||
pub fn get_single_str_from_tts(
|
||||
cx: &mut ExtCtxt<'_>,
|
||||
sp: Span,
|
||||
span: Span,
|
||||
tts: TokenStream,
|
||||
name: &str,
|
||||
) -> Option<Symbol> {
|
||||
let mut p = cx.new_parser_from_tts(tts);
|
||||
if p.token == token::Eof {
|
||||
cx.span_err(sp, &format!("{} takes 1 argument", name));
|
||||
cx.emit_err(OnlyOneArgument { span, name });
|
||||
return None;
|
||||
}
|
||||
let ret = parse_expr(&mut p)?;
|
||||
let _ = p.eat(&token::Comma);
|
||||
|
||||
if p.token != token::Eof {
|
||||
cx.span_err(sp, &format!("{} takes 1 argument", name));
|
||||
cx.emit_err(OnlyOneArgument { span, name });
|
||||
}
|
||||
expr_to_string(cx, ret, "argument must be a string literal").map(|(s, _)| s)
|
||||
}
|
||||
|
||||
/// Extracts comma-separated expressions from `tts`.
|
||||
/// On error, emit it, and return `None`.
|
||||
pub fn get_exprs_from_tts(
|
||||
cx: &mut ExtCtxt<'_>,
|
||||
sp: Span,
|
||||
tts: TokenStream,
|
||||
) -> Option<Vec<P<ast::Expr>>> {
|
||||
pub fn get_exprs_from_tts(cx: &mut ExtCtxt<'_>, tts: TokenStream) -> Option<Vec<P<ast::Expr>>> {
|
||||
let mut p = cx.new_parser_from_tts(tts);
|
||||
let mut es = Vec::new();
|
||||
while p.token != token::Eof {
|
||||
@ -1343,7 +1337,7 @@ pub fn get_exprs_from_tts(
|
||||
continue;
|
||||
}
|
||||
if p.token != token::Eof {
|
||||
cx.span_err(sp, "expected token: `,`");
|
||||
cx.emit_err(ExpectedCommaInList { span: p.token.span });
|
||||
return None;
|
||||
}
|
||||
}
|
||||
@ -1353,64 +1347,58 @@ pub fn get_exprs_from_tts(
|
||||
pub fn parse_macro_name_and_helper_attrs(
|
||||
diag: &rustc_errors::Handler,
|
||||
attr: &Attribute,
|
||||
descr: &str,
|
||||
macro_type: &str,
|
||||
) -> Option<(Symbol, Vec<Symbol>)> {
|
||||
// Once we've located the `#[proc_macro_derive]` attribute, verify
|
||||
// that it's of the form `#[proc_macro_derive(Foo)]` or
|
||||
// `#[proc_macro_derive(Foo, attributes(A, ..))]`
|
||||
let list = attr.meta_item_list()?;
|
||||
if list.len() != 1 && list.len() != 2 {
|
||||
diag.span_err(attr.span, "attribute must have either one or two arguments");
|
||||
diag.emit_err(AttrNoArguments { span: attr.span });
|
||||
return None;
|
||||
}
|
||||
let Some(trait_attr) = list[0].meta_item() else {
|
||||
diag.span_err(list[0].span(), "not a meta item");
|
||||
diag.emit_err(NotAMetaItem {span: list[0].span()});
|
||||
return None;
|
||||
};
|
||||
let trait_ident = match trait_attr.ident() {
|
||||
Some(trait_ident) if trait_attr.is_word() => trait_ident,
|
||||
_ => {
|
||||
diag.span_err(trait_attr.span, "must only be one word");
|
||||
diag.emit_err(OnlyOneWord { span: trait_attr.span });
|
||||
return None;
|
||||
}
|
||||
};
|
||||
|
||||
if !trait_ident.name.can_be_raw() {
|
||||
diag.span_err(
|
||||
trait_attr.span,
|
||||
&format!("`{}` cannot be a name of {} macro", trait_ident, descr),
|
||||
);
|
||||
diag.emit_err(CannotBeNameOfMacro { span: trait_attr.span, trait_ident, macro_type });
|
||||
}
|
||||
|
||||
let attributes_attr = list.get(1);
|
||||
let proc_attrs: Vec<_> = if let Some(attr) = attributes_attr {
|
||||
if !attr.has_name(sym::attributes) {
|
||||
diag.span_err(attr.span(), "second argument must be `attributes`");
|
||||
diag.emit_err(ArgumentNotAttributes { span: attr.span() });
|
||||
}
|
||||
attr.meta_item_list()
|
||||
.unwrap_or_else(|| {
|
||||
diag.span_err(attr.span(), "attribute must be of form: `attributes(foo, bar)`");
|
||||
diag.emit_err(AttributesWrongForm { span: attr.span() });
|
||||
&[]
|
||||
})
|
||||
.iter()
|
||||
.filter_map(|attr| {
|
||||
let Some(attr) = attr.meta_item() else {
|
||||
diag.span_err(attr.span(), "not a meta item");
|
||||
diag.emit_err(AttributeMetaItem { span: attr.span() });
|
||||
return None;
|
||||
};
|
||||
|
||||
let ident = match attr.ident() {
|
||||
Some(ident) if attr.is_word() => ident,
|
||||
_ => {
|
||||
diag.span_err(attr.span, "must only be one word");
|
||||
diag.emit_err(AttributeSingleWord { span: attr.span });
|
||||
return None;
|
||||
}
|
||||
};
|
||||
if !ident.name.can_be_raw() {
|
||||
diag.span_err(
|
||||
attr.span,
|
||||
&format!("`{}` cannot be a name of derive helper attribute", ident),
|
||||
);
|
||||
diag.emit_err(HelperAttributeNameInvalid { span: attr.span, name: ident });
|
||||
}
|
||||
|
||||
Some(ident.name)
|
||||
|
@ -1,5 +1,9 @@
|
||||
//! Conditional compilation stripping.
|
||||
|
||||
use crate::errors::{
|
||||
FeatureIncludedInEdition, FeatureNotAllowed, FeatureRemoved, FeatureRemovedReason, InvalidCfg,
|
||||
MalformedFeatureAttribute, MalformedFeatureAttributeHelp, RemoveExprNotSupported,
|
||||
};
|
||||
use rustc_ast::ptr::P;
|
||||
use rustc_ast::token::{Delimiter, Token, TokenKind};
|
||||
use rustc_ast::tokenstream::{AttrTokenStream, AttrTokenTree};
|
||||
@ -10,7 +14,6 @@ use rustc_ast::{self as ast, AttrStyle, Attribute, HasAttrs, HasTokens, MetaItem
|
||||
use rustc_attr as attr;
|
||||
use rustc_data_structures::fx::FxHashMap;
|
||||
use rustc_data_structures::map_in_place::MapInPlace;
|
||||
use rustc_errors::{error_code, struct_span_err, Applicability, Handler};
|
||||
use rustc_feature::{Feature, Features, State as FeatureState};
|
||||
use rustc_feature::{
|
||||
ACCEPTED_FEATURES, ACTIVE_FEATURES, REMOVED_FEATURES, STABLE_REMOVED_FEATURES,
|
||||
@ -33,18 +36,12 @@ pub struct StripUnconfigured<'a> {
|
||||
pub lint_node_id: NodeId,
|
||||
}
|
||||
|
||||
fn get_features(
|
||||
sess: &Session,
|
||||
span_handler: &Handler,
|
||||
krate_attrs: &[ast::Attribute],
|
||||
) -> Features {
|
||||
fn feature_removed(span_handler: &Handler, span: Span, reason: Option<&str>) {
|
||||
let mut err = struct_span_err!(span_handler, span, E0557, "feature has been removed");
|
||||
err.span_label(span, "feature has been removed");
|
||||
if let Some(reason) = reason {
|
||||
err.note(reason);
|
||||
}
|
||||
err.emit();
|
||||
fn get_features(sess: &Session, krate_attrs: &[ast::Attribute]) -> Features {
|
||||
fn feature_removed(sess: &Session, span: Span, reason: Option<&str>) {
|
||||
sess.emit_err(FeatureRemoved {
|
||||
span,
|
||||
reason: reason.map(|reason| FeatureRemovedReason { reason }),
|
||||
});
|
||||
}
|
||||
|
||||
fn active_features_up_to(edition: Edition) -> impl Iterator<Item = &'static Feature> {
|
||||
@ -117,34 +114,34 @@ fn get_features(
|
||||
continue;
|
||||
};
|
||||
|
||||
let bad_input = |span| {
|
||||
struct_span_err!(span_handler, span, E0556, "malformed `feature` attribute input")
|
||||
};
|
||||
|
||||
for mi in list {
|
||||
let name = match mi.ident() {
|
||||
Some(ident) if mi.is_word() => ident.name,
|
||||
Some(ident) => {
|
||||
bad_input(mi.span())
|
||||
.span_suggestion(
|
||||
mi.span(),
|
||||
"expected just one word",
|
||||
ident.name,
|
||||
Applicability::MaybeIncorrect,
|
||||
)
|
||||
.emit();
|
||||
sess.emit_err(MalformedFeatureAttribute {
|
||||
span: mi.span(),
|
||||
help: MalformedFeatureAttributeHelp::Suggestion {
|
||||
span: mi.span(),
|
||||
suggestion: ident.name,
|
||||
},
|
||||
});
|
||||
continue;
|
||||
}
|
||||
None => {
|
||||
bad_input(mi.span()).span_label(mi.span(), "expected just one word").emit();
|
||||
sess.emit_err(MalformedFeatureAttribute {
|
||||
span: mi.span(),
|
||||
help: MalformedFeatureAttributeHelp::Label { span: mi.span() },
|
||||
});
|
||||
continue;
|
||||
}
|
||||
};
|
||||
|
||||
if let Some(edition) = edition_enabled_features.get(&name) {
|
||||
let msg =
|
||||
&format!("the feature `{}` is included in the Rust {} edition", name, edition);
|
||||
span_handler.struct_span_warn_with_code(mi.span(), msg, error_code!(E0705)).emit();
|
||||
if let Some(&edition) = edition_enabled_features.get(&name) {
|
||||
sess.emit_warning(FeatureIncludedInEdition {
|
||||
span: mi.span(),
|
||||
feature: name,
|
||||
edition,
|
||||
});
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -159,7 +156,7 @@ fn get_features(
|
||||
if let FeatureState::Removed { reason } | FeatureState::Stabilized { reason } =
|
||||
state
|
||||
{
|
||||
feature_removed(span_handler, mi.span(), *reason);
|
||||
feature_removed(sess, mi.span(), *reason);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@ -173,14 +170,7 @@ fn get_features(
|
||||
|
||||
if let Some(allowed) = sess.opts.unstable_opts.allow_features.as_ref() {
|
||||
if allowed.iter().all(|f| name.as_str() != f) {
|
||||
struct_span_err!(
|
||||
span_handler,
|
||||
mi.span(),
|
||||
E0725,
|
||||
"the feature `{}` is not in the list of allowed features",
|
||||
name
|
||||
)
|
||||
.emit();
|
||||
sess.emit_err(FeatureNotAllowed { span: mi.span(), name });
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@ -221,7 +211,7 @@ pub fn features(
|
||||
}
|
||||
Some(attrs) => {
|
||||
krate.attrs = attrs;
|
||||
let features = get_features(sess, diag, &krate.attrs);
|
||||
let features = get_features(sess, &krate.attrs);
|
||||
if err_count == diag.err_count() {
|
||||
// Avoid reconfiguring malformed `cfg_attr`s.
|
||||
strip_unconfigured.features = Some(&features);
|
||||
@ -503,8 +493,7 @@ impl<'a> StripUnconfigured<'a> {
|
||||
// N.B., this is intentionally not part of the visit_expr() function
|
||||
// in order for filter_map_expr() to be able to avoid this check
|
||||
if let Some(attr) = expr.attrs().iter().find(|a| is_cfg(*a)) {
|
||||
let msg = "removing an expression is not supported in this position";
|
||||
self.sess.parse_sess.span_diagnostic.span_err(attr.span, msg);
|
||||
self.sess.emit_err(RemoveExprNotSupported { span: attr.span });
|
||||
}
|
||||
|
||||
self.process_cfg_attrs(expr);
|
||||
@ -513,27 +502,26 @@ impl<'a> StripUnconfigured<'a> {
|
||||
}
|
||||
|
||||
pub fn parse_cfg<'a>(meta_item: &'a MetaItem, sess: &Session) -> Option<&'a MetaItem> {
|
||||
let error = |span, msg, suggestion: &str| {
|
||||
let mut err = sess.parse_sess.span_diagnostic.struct_span_err(span, msg);
|
||||
if !suggestion.is_empty() {
|
||||
err.span_suggestion(
|
||||
span,
|
||||
"expected syntax is",
|
||||
suggestion,
|
||||
Applicability::HasPlaceholders,
|
||||
);
|
||||
}
|
||||
err.emit();
|
||||
None
|
||||
};
|
||||
let span = meta_item.span;
|
||||
match meta_item.meta_item_list() {
|
||||
None => error(span, "`cfg` is not followed by parentheses", "cfg(/* predicate */)"),
|
||||
Some([]) => error(span, "`cfg` predicate is not specified", ""),
|
||||
Some([_, .., l]) => error(l.span(), "multiple `cfg` predicates are specified", ""),
|
||||
None => {
|
||||
sess.emit_err(InvalidCfg::NotFollowedByParens { span });
|
||||
None
|
||||
}
|
||||
Some([]) => {
|
||||
sess.emit_err(InvalidCfg::NoPredicate { span });
|
||||
None
|
||||
}
|
||||
Some([_, .., l]) => {
|
||||
sess.emit_err(InvalidCfg::MultiplePredicates { span: l.span() });
|
||||
None
|
||||
}
|
||||
Some([single]) => match single.meta_item() {
|
||||
Some(meta_item) => Some(meta_item),
|
||||
None => error(single.span(), "`cfg` predicate key cannot be a literal", ""),
|
||||
None => {
|
||||
sess.emit_err(InvalidCfg::PredicateLiteral { span: single.span() });
|
||||
None
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,10 @@
|
||||
use rustc_ast::ast;
|
||||
use rustc_macros::Diagnostic;
|
||||
use rustc_span::symbol::MacroRulesNormalizedIdent;
|
||||
use rustc_span::Span;
|
||||
use rustc_session::Limit;
|
||||
use rustc_span::edition::Edition;
|
||||
use rustc_span::symbol::{Ident, MacroRulesNormalizedIdent};
|
||||
use rustc_span::{Span, Symbol};
|
||||
use std::borrow::Cow;
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(expand_expr_repeat_no_syntax_vars)]
|
||||
@ -46,3 +50,321 @@ pub(crate) struct MetaVarsDifSeqMatchers {
|
||||
pub span: Span,
|
||||
pub msg: String,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(expand_resolve_relative_path)]
|
||||
pub(crate) struct ResolveRelativePath {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
pub path: String,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(expand_macro_const_stability)]
|
||||
pub(crate) struct MacroConstStability {
|
||||
#[primary_span]
|
||||
#[label]
|
||||
pub span: Span,
|
||||
#[label(label2)]
|
||||
pub head_span: Span,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(expand_macro_body_stability)]
|
||||
pub(crate) struct MacroBodyStability {
|
||||
#[primary_span]
|
||||
#[label]
|
||||
pub span: Span,
|
||||
#[label(label2)]
|
||||
pub head_span: Span,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(expand_attr_no_arguments)]
|
||||
pub(crate) struct AttrNoArguments {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(expand_not_a_meta_item)]
|
||||
pub(crate) struct NotAMetaItem {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(expand_only_one_word)]
|
||||
pub(crate) struct OnlyOneWord {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(expand_cannot_be_name_of_macro)]
|
||||
pub(crate) struct CannotBeNameOfMacro<'a> {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
pub trait_ident: Ident,
|
||||
pub macro_type: &'a str,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(expand_arg_not_attributes)]
|
||||
pub(crate) struct ArgumentNotAttributes {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(expand_attributes_wrong_form)]
|
||||
pub(crate) struct AttributesWrongForm {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(expand_attribute_meta_item)]
|
||||
pub(crate) struct AttributeMetaItem {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(expand_attribute_single_word)]
|
||||
pub(crate) struct AttributeSingleWord {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(expand_helper_attribute_name_invalid)]
|
||||
pub(crate) struct HelperAttributeNameInvalid {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
pub name: Ident,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(expand_expected_comma_in_list)]
|
||||
pub(crate) struct ExpectedCommaInList {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(expand_only_one_argument)]
|
||||
pub(crate) struct OnlyOneArgument<'a> {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
pub name: &'a str,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(expand_takes_no_arguments)]
|
||||
pub(crate) struct TakesNoArguments<'a> {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
pub name: &'a str,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(expand_feature_included_in_edition, code = "E0705")]
|
||||
pub(crate) struct FeatureIncludedInEdition {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
pub feature: Symbol,
|
||||
pub edition: Edition,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(expand_feature_removed, code = "E0557")]
|
||||
pub(crate) struct FeatureRemoved<'a> {
|
||||
#[primary_span]
|
||||
#[label]
|
||||
pub span: Span,
|
||||
#[subdiagnostic]
|
||||
pub reason: Option<FeatureRemovedReason<'a>>,
|
||||
}
|
||||
|
||||
#[derive(Subdiagnostic)]
|
||||
#[note(reason)]
|
||||
pub(crate) struct FeatureRemovedReason<'a> {
|
||||
pub reason: &'a str,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(expand_feature_not_allowed, code = "E0725")]
|
||||
pub(crate) struct FeatureNotAllowed {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
pub name: Symbol,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(expand_recursion_limit_reached)]
|
||||
#[help]
|
||||
pub(crate) struct RecursionLimitReached<'a> {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
pub descr: String,
|
||||
pub suggested_limit: Limit,
|
||||
pub crate_name: &'a str,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(expand_malformed_feature_attribute, code = "E0556")]
|
||||
pub(crate) struct MalformedFeatureAttribute {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
#[subdiagnostic]
|
||||
pub help: MalformedFeatureAttributeHelp,
|
||||
}
|
||||
|
||||
#[derive(Subdiagnostic)]
|
||||
pub(crate) enum MalformedFeatureAttributeHelp {
|
||||
#[label(expected)]
|
||||
Label {
|
||||
#[primary_span]
|
||||
span: Span,
|
||||
},
|
||||
#[suggestion(expected, code = "{suggestion}", applicability = "maybe-incorrect")]
|
||||
Suggestion {
|
||||
#[primary_span]
|
||||
span: Span,
|
||||
suggestion: Symbol,
|
||||
},
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(expand_remove_expr_not_supported)]
|
||||
pub(crate) struct RemoveExprNotSupported {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
pub(crate) enum InvalidCfg {
|
||||
#[diag(expand_invalid_cfg_no_parens)]
|
||||
NotFollowedByParens {
|
||||
#[primary_span]
|
||||
#[suggestion(
|
||||
expand_invalid_cfg_expected_syntax,
|
||||
code = "cfg(/* predicate */)",
|
||||
applicability = "has-placeholders"
|
||||
)]
|
||||
span: Span,
|
||||
},
|
||||
#[diag(expand_invalid_cfg_no_predicate)]
|
||||
NoPredicate {
|
||||
#[primary_span]
|
||||
#[suggestion(
|
||||
expand_invalid_cfg_expected_syntax,
|
||||
code = "cfg(/* predicate */)",
|
||||
applicability = "has-placeholders"
|
||||
)]
|
||||
span: Span,
|
||||
},
|
||||
#[diag(expand_invalid_cfg_multiple_predicates)]
|
||||
MultiplePredicates {
|
||||
#[primary_span]
|
||||
span: Span,
|
||||
},
|
||||
#[diag(expand_invalid_cfg_predicate_literal)]
|
||||
PredicateLiteral {
|
||||
#[primary_span]
|
||||
span: Span,
|
||||
},
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(expand_wrong_fragment_kind)]
|
||||
pub(crate) struct WrongFragmentKind<'a> {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
pub kind: &'a str,
|
||||
pub name: &'a ast::Path,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(expand_unsupported_key_value)]
|
||||
pub(crate) struct UnsupportedKeyValue {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(expand_incomplete_parse)]
|
||||
#[note]
|
||||
pub(crate) struct IncompleteParse<'a> {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
pub token: Cow<'a, str>,
|
||||
#[label]
|
||||
pub label_span: Span,
|
||||
pub macro_path: &'a ast::Path,
|
||||
pub kind_name: &'a str,
|
||||
|
||||
#[suggestion(
|
||||
suggestion_add_semi,
|
||||
style = "verbose",
|
||||
code = ";",
|
||||
applicability = "maybe-incorrect"
|
||||
)]
|
||||
pub add_semicolon: Option<Span>,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(expand_remove_node_not_supported)]
|
||||
pub(crate) struct RemoveNodeNotSupported {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
pub descr: &'static str,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(expand_module_circular)]
|
||||
pub(crate) struct ModuleCircular {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
pub modules: String,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(expand_module_in_block)]
|
||||
pub(crate) struct ModuleInBlock {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
#[subdiagnostic]
|
||||
pub name: Option<ModuleInBlockName>,
|
||||
}
|
||||
|
||||
#[derive(Subdiagnostic)]
|
||||
#[note(note)]
|
||||
pub(crate) struct ModuleInBlockName {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
pub name: Ident,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(expand_module_file_not_found, code = "E0583")]
|
||||
#[help]
|
||||
pub(crate) struct ModuleFileNotFound {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
pub name: Ident,
|
||||
pub default_path: String,
|
||||
pub secondary_path: String,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(expand_module_multiple_candidates, code = "E0761")]
|
||||
#[help]
|
||||
pub(crate) struct ModuleMultipleCandidates {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
pub name: Ident,
|
||||
pub default_path: String,
|
||||
pub secondary_path: String,
|
||||
}
|
||||
|
@ -1,5 +1,9 @@
|
||||
use crate::base::*;
|
||||
use crate::config::StripUnconfigured;
|
||||
use crate::errors::{
|
||||
IncompleteParse, RecursionLimitReached, RemoveExprNotSupported, RemoveNodeNotSupported,
|
||||
UnsupportedKeyValue, WrongFragmentKind,
|
||||
};
|
||||
use crate::hygiene::SyntaxContext;
|
||||
use crate::mbe::diagnostics::annotate_err_with_kind;
|
||||
use crate::module::{mod_dir_path, parse_external_mod, DirOwnership, ParsedExternalMod};
|
||||
@ -18,7 +22,7 @@ use rustc_ast::{NestedMetaItem, NodeId, PatKind, StmtKind, TyKind};
|
||||
use rustc_ast_pretty::pprust;
|
||||
use rustc_data_structures::map_in_place::MapInPlace;
|
||||
use rustc_data_structures::sync::Lrc;
|
||||
use rustc_errors::{Applicability, PResult};
|
||||
use rustc_errors::PResult;
|
||||
use rustc_feature::Features;
|
||||
use rustc_parse::parser::{
|
||||
AttemptLocalParseRecovery, CommaRecoveryMode, ForceCollect, Parser, RecoverColon, RecoverComma,
|
||||
@ -606,29 +610,22 @@ impl<'a, 'b> MacroExpander<'a, 'b> {
|
||||
Limit(0) => Limit(2),
|
||||
limit => limit * 2,
|
||||
};
|
||||
self.cx
|
||||
.struct_span_err(
|
||||
expn_data.call_site,
|
||||
&format!("recursion limit reached while expanding `{}`", expn_data.kind.descr()),
|
||||
)
|
||||
.help(&format!(
|
||||
"consider increasing the recursion limit by adding a \
|
||||
`#![recursion_limit = \"{}\"]` attribute to your crate (`{}`)",
|
||||
suggested_limit, self.cx.ecfg.crate_name,
|
||||
))
|
||||
.emit();
|
||||
|
||||
self.cx.emit_err(RecursionLimitReached {
|
||||
span: expn_data.call_site,
|
||||
descr: expn_data.kind.descr(),
|
||||
suggested_limit,
|
||||
crate_name: &self.cx.ecfg.crate_name,
|
||||
});
|
||||
|
||||
self.cx.trace_macros_diag();
|
||||
}
|
||||
|
||||
/// A macro's expansion does not fit in this fragment kind.
|
||||
/// For example, a non-type macro in a type position.
|
||||
fn error_wrong_fragment_kind(&mut self, kind: AstFragmentKind, mac: &ast::MacCall, span: Span) {
|
||||
let msg = format!(
|
||||
"non-{kind} macro in {kind} position: {path}",
|
||||
kind = kind.name(),
|
||||
path = pprust::path_to_string(&mac.path),
|
||||
);
|
||||
self.cx.span_err(span, &msg);
|
||||
self.cx.emit_err(WrongFragmentKind { span, kind: kind.name(), name: &mac.path });
|
||||
|
||||
self.cx.trace_macros_diag();
|
||||
}
|
||||
|
||||
@ -707,7 +704,7 @@ impl<'a, 'b> MacroExpander<'a, 'b> {
|
||||
};
|
||||
let attr_item = attr.unwrap_normal_item();
|
||||
if let AttrArgs::Eq(..) = attr_item.args {
|
||||
self.cx.span_err(span, "key-value macro attributes are not supported");
|
||||
self.cx.emit_err(UnsupportedKeyValue { span });
|
||||
}
|
||||
let inner_tokens = attr_item.args.inner_tokens();
|
||||
let Ok(tok_result) = expander.expand(self.cx, span, inner_tokens, tokens) else {
|
||||
@ -729,9 +726,7 @@ impl<'a, 'b> MacroExpander<'a, 'b> {
|
||||
}
|
||||
};
|
||||
if fragment_kind == AstFragmentKind::Expr && items.is_empty() {
|
||||
let msg =
|
||||
"removing an expression is not supported in this position";
|
||||
self.cx.span_err(span, msg);
|
||||
self.cx.emit_err(RemoveExprNotSupported { span });
|
||||
fragment_kind.dummy(span)
|
||||
} else {
|
||||
fragment_kind.expect_from_annotatables(items)
|
||||
@ -939,38 +934,32 @@ pub fn parse_ast_fragment<'a>(
|
||||
}
|
||||
|
||||
pub fn ensure_complete_parse<'a>(
|
||||
this: &mut Parser<'a>,
|
||||
parser: &mut Parser<'a>,
|
||||
macro_path: &ast::Path,
|
||||
kind_name: &str,
|
||||
span: Span,
|
||||
) {
|
||||
if this.token != token::Eof {
|
||||
let token = pprust::token_to_string(&this.token);
|
||||
let msg = format!("macro expansion ignores token `{}` and any following", token);
|
||||
if parser.token != token::Eof {
|
||||
let token = pprust::token_to_string(&parser.token);
|
||||
// Avoid emitting backtrace info twice.
|
||||
let def_site_span = this.token.span.with_ctxt(SyntaxContext::root());
|
||||
let mut err = this.struct_span_err(def_site_span, &msg);
|
||||
err.span_label(span, "caused by the macro expansion here");
|
||||
let msg = format!(
|
||||
"the usage of `{}!` is likely invalid in {} context",
|
||||
pprust::path_to_string(macro_path),
|
||||
kind_name,
|
||||
);
|
||||
err.note(&msg);
|
||||
let def_site_span = parser.token.span.with_ctxt(SyntaxContext::root());
|
||||
|
||||
let semi_span = this.sess.source_map().next_point(span);
|
||||
match this.sess.source_map().span_to_snippet(semi_span) {
|
||||
let semi_span = parser.sess.source_map().next_point(span);
|
||||
let add_semicolon = match parser.sess.source_map().span_to_snippet(semi_span) {
|
||||
Ok(ref snippet) if &snippet[..] != ";" && kind_name == "expression" => {
|
||||
err.span_suggestion(
|
||||
span.shrink_to_hi(),
|
||||
"you might be missing a semicolon here",
|
||||
";",
|
||||
Applicability::MaybeIncorrect,
|
||||
);
|
||||
Some(span.shrink_to_hi())
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
err.emit();
|
||||
_ => None,
|
||||
};
|
||||
|
||||
parser.sess.emit_err(IncompleteParse {
|
||||
span: def_site_span,
|
||||
token,
|
||||
label_span: span,
|
||||
macro_path,
|
||||
kind_name,
|
||||
add_semicolon,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -1766,9 +1755,8 @@ impl<'a, 'b> InvocationCollector<'a, 'b> {
|
||||
if self.expand_cfg_true(node, attr, pos) {
|
||||
continue;
|
||||
}
|
||||
let msg =
|
||||
format!("removing {} is not supported in this position", Node::descr());
|
||||
self.cx.span_err(span, &msg);
|
||||
|
||||
self.cx.emit_err(RemoveNodeNotSupported { span, descr: Node::descr() });
|
||||
continue;
|
||||
}
|
||||
sym::cfg_attr => {
|
||||
|
@ -10,6 +10,7 @@
|
||||
#![feature(rustc_attrs)]
|
||||
#![feature(try_blocks)]
|
||||
#![recursion_limit = "256"]
|
||||
#![deny(rustc::untranslatable_diagnostic)]
|
||||
|
||||
#[macro_use]
|
||||
extern crate rustc_macros;
|
||||
@ -31,8 +32,13 @@ pub mod config;
|
||||
pub mod errors;
|
||||
pub mod expand;
|
||||
pub mod module;
|
||||
|
||||
// FIXME(Nilstrieb) Translate proc_macro diagnostics
|
||||
#[allow(rustc::untranslatable_diagnostic)]
|
||||
pub mod proc_macro;
|
||||
|
||||
// FIXME(Nilstrieb) Translate macro_rules diagnostics
|
||||
#[allow(rustc::untranslatable_diagnostic)]
|
||||
pub(crate) mod mbe;
|
||||
|
||||
// HACK(Centril, #64197): These shouldn't really be here.
|
||||
|
@ -1,13 +1,17 @@
|
||||
use crate::base::ModuleData;
|
||||
use crate::errors::{
|
||||
ModuleCircular, ModuleFileNotFound, ModuleInBlock, ModuleInBlockName, ModuleMultipleCandidates,
|
||||
};
|
||||
use rustc_ast::ptr::P;
|
||||
use rustc_ast::{token, AttrVec, Attribute, Inline, Item, ModSpans};
|
||||
use rustc_errors::{struct_span_err, DiagnosticBuilder, ErrorGuaranteed};
|
||||
use rustc_errors::{DiagnosticBuilder, ErrorGuaranteed};
|
||||
use rustc_parse::new_parser_from_file;
|
||||
use rustc_parse::validate_attr;
|
||||
use rustc_session::parse::ParseSess;
|
||||
use rustc_session::Session;
|
||||
use rustc_span::symbol::{sym, Ident};
|
||||
use rustc_span::Span;
|
||||
use std::iter::once;
|
||||
|
||||
use std::path::{self, Path, PathBuf};
|
||||
|
||||
@ -242,57 +246,41 @@ pub fn default_submod_path<'a>(
|
||||
|
||||
impl ModError<'_> {
|
||||
fn report(self, sess: &Session, span: Span) -> ErrorGuaranteed {
|
||||
let diag = &sess.parse_sess.span_diagnostic;
|
||||
match self {
|
||||
ModError::CircularInclusion(file_paths) => {
|
||||
let mut msg = String::from("circular modules: ");
|
||||
for file_path in &file_paths {
|
||||
msg.push_str(&file_path.display().to_string());
|
||||
msg.push_str(" -> ");
|
||||
}
|
||||
msg.push_str(&file_paths[0].display().to_string());
|
||||
diag.struct_span_err(span, &msg)
|
||||
let path_to_string = |path: &PathBuf| path.display().to_string();
|
||||
|
||||
let paths = file_paths
|
||||
.iter()
|
||||
.map(path_to_string)
|
||||
.chain(once(path_to_string(&file_paths[0])))
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
let modules = paths.join(" -> ");
|
||||
|
||||
sess.emit_err(ModuleCircular { span, modules })
|
||||
}
|
||||
ModError::ModInBlock(ident) => {
|
||||
let msg = "cannot declare a non-inline module inside a block unless it has a path attribute";
|
||||
let mut err = diag.struct_span_err(span, msg);
|
||||
if let Some(ident) = ident {
|
||||
let note =
|
||||
format!("maybe `use` the module `{}` instead of redeclaring it", ident);
|
||||
err.span_note(span, ¬e);
|
||||
}
|
||||
err
|
||||
}
|
||||
ModError::FileNotFound(ident, default_path, secondary_path) => {
|
||||
let mut err = struct_span_err!(
|
||||
diag,
|
||||
ModError::ModInBlock(ident) => sess.emit_err(ModuleInBlock {
|
||||
span,
|
||||
name: ident.map(|name| ModuleInBlockName { span, name }),
|
||||
}),
|
||||
ModError::FileNotFound(name, default_path, secondary_path) => {
|
||||
sess.emit_err(ModuleFileNotFound {
|
||||
span,
|
||||
E0583,
|
||||
"file not found for module `{}`",
|
||||
ident,
|
||||
);
|
||||
err.help(&format!(
|
||||
"to create the module `{}`, create file \"{}\" or \"{}\"",
|
||||
ident,
|
||||
default_path.display(),
|
||||
secondary_path.display(),
|
||||
));
|
||||
err
|
||||
name,
|
||||
default_path: default_path.display().to_string(),
|
||||
secondary_path: secondary_path.display().to_string(),
|
||||
})
|
||||
}
|
||||
ModError::MultipleCandidates(ident, default_path, secondary_path) => {
|
||||
let mut err = struct_span_err!(
|
||||
diag,
|
||||
ModError::MultipleCandidates(name, default_path, secondary_path) => {
|
||||
sess.emit_err(ModuleMultipleCandidates {
|
||||
span,
|
||||
E0761,
|
||||
"file for module `{}` found at both \"{}\" and \"{}\"",
|
||||
ident,
|
||||
default_path.display(),
|
||||
secondary_path.display(),
|
||||
);
|
||||
err.help("delete or rename one of them to remove the ambiguity");
|
||||
err
|
||||
name,
|
||||
default_path: default_path.display().to_string(),
|
||||
secondary_path: secondary_path.display().to_string(),
|
||||
})
|
||||
}
|
||||
ModError::ParserError(err) => err,
|
||||
}.emit()
|
||||
ModError::ParserError(mut err) => err.emit(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -154,6 +154,7 @@ fn test_harness(file_text: &str, span_labels: Vec<SpanLabel>, expected_output: &
|
||||
false,
|
||||
);
|
||||
let handler = Handler::with_emitter(true, None, Box::new(emitter));
|
||||
#[allow(rustc::untranslatable_diagnostic)]
|
||||
handler.span_err(msp, "foo");
|
||||
|
||||
assert!(
|
||||
|
@ -78,7 +78,7 @@ pub(super) fn generics_of(tcx: TyCtxt<'_>, def_id: DefId) -> ty::Generics {
|
||||
let generics = tcx.generics_of(parent_def_id.to_def_id());
|
||||
let param_def_idx = generics.param_def_id_to_index[¶m_id.to_def_id()];
|
||||
// In the above example this would be .params[..N#0]
|
||||
let params = generics.params[..param_def_idx as usize].to_owned();
|
||||
let params = generics.params_to(param_def_idx as usize, tcx).to_owned();
|
||||
let param_def_id_to_index =
|
||||
params.iter().map(|param| (param.def_id, param.index)).collect();
|
||||
|
||||
|
@ -189,7 +189,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
&self,
|
||||
err: &mut Diagnostic,
|
||||
expr: &hir::Expr<'_>,
|
||||
error: Option<TypeError<'_>>,
|
||||
error: Option<TypeError<'tcx>>,
|
||||
) {
|
||||
let parent = self.tcx.hir().get_parent_node(expr.hir_id);
|
||||
match (self.tcx.hir().find(parent), error) {
|
||||
@ -286,6 +286,16 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
err.downgrade_to_delayed_bug();
|
||||
}
|
||||
}
|
||||
(
|
||||
Some(hir::Node::Expr(hir::Expr {
|
||||
kind: hir::ExprKind::Binary(_, lhs, rhs), ..
|
||||
})),
|
||||
Some(TypeError::Sorts(ExpectedFound { expected, .. })),
|
||||
) if rhs.hir_id == expr.hir_id
|
||||
&& self.typeck_results.borrow().expr_ty_adjusted_opt(lhs) == Some(expected) =>
|
||||
{
|
||||
err.span_label(lhs.span, &format!("expected because this is `{expected}`"));
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
|
@ -526,12 +526,6 @@ pub enum TerminatorKind<'tcx> {
|
||||
SwitchInt {
|
||||
/// The discriminant value being tested.
|
||||
discr: Operand<'tcx>,
|
||||
|
||||
/// The type of value being tested.
|
||||
/// This is always the same as the type of `discr`.
|
||||
/// FIXME: remove this redundant information. Currently, it is relied on by pretty-printing.
|
||||
switch_ty: Ty<'tcx>,
|
||||
|
||||
targets: SwitchTargets,
|
||||
},
|
||||
|
||||
|
@ -1,6 +1,3 @@
|
||||
use crate::mir;
|
||||
use crate::mir::interpret::Scalar;
|
||||
use crate::ty::{self, Ty, TyCtxt};
|
||||
use smallvec::{smallvec, SmallVec};
|
||||
|
||||
use super::{BasicBlock, InlineAsmOperand, Operand, SourceInfo, TerminatorKind};
|
||||
@ -131,17 +128,8 @@ impl<'tcx> Terminator<'tcx> {
|
||||
}
|
||||
|
||||
impl<'tcx> TerminatorKind<'tcx> {
|
||||
pub fn if_(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
cond: Operand<'tcx>,
|
||||
t: BasicBlock,
|
||||
f: BasicBlock,
|
||||
) -> TerminatorKind<'tcx> {
|
||||
TerminatorKind::SwitchInt {
|
||||
discr: cond,
|
||||
switch_ty: tcx.types.bool,
|
||||
targets: SwitchTargets::static_if(0, f, t),
|
||||
}
|
||||
pub fn if_(cond: Operand<'tcx>, t: BasicBlock, f: BasicBlock) -> TerminatorKind<'tcx> {
|
||||
TerminatorKind::SwitchInt { discr: cond, targets: SwitchTargets::static_if(0, f, t) }
|
||||
}
|
||||
|
||||
pub fn successors(&self) -> Successors<'_> {
|
||||
@ -264,11 +252,9 @@ impl<'tcx> TerminatorKind<'tcx> {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn as_switch(&self) -> Option<(&Operand<'tcx>, Ty<'tcx>, &SwitchTargets)> {
|
||||
pub fn as_switch(&self) -> Option<(&Operand<'tcx>, &SwitchTargets)> {
|
||||
match self {
|
||||
TerminatorKind::SwitchInt { discr, switch_ty, targets } => {
|
||||
Some((discr, *switch_ty, targets))
|
||||
}
|
||||
TerminatorKind::SwitchInt { discr, targets } => Some((discr, targets)),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
@ -403,21 +389,12 @@ impl<'tcx> TerminatorKind<'tcx> {
|
||||
match *self {
|
||||
Return | Resume | Abort | Unreachable | GeneratorDrop => vec![],
|
||||
Goto { .. } => vec!["".into()],
|
||||
SwitchInt { ref targets, switch_ty, .. } => ty::tls::with(|tcx| {
|
||||
let param_env = ty::ParamEnv::empty();
|
||||
let switch_ty = tcx.lift(switch_ty).unwrap();
|
||||
let size = tcx.layout_of(param_env.and(switch_ty)).unwrap().size;
|
||||
targets
|
||||
.values
|
||||
.iter()
|
||||
.map(|&u| {
|
||||
mir::ConstantKind::from_scalar(tcx, Scalar::from_uint(u, size), switch_ty)
|
||||
.to_string()
|
||||
.into()
|
||||
})
|
||||
.chain(iter::once("otherwise".into()))
|
||||
.collect()
|
||||
}),
|
||||
SwitchInt { ref targets, .. } => targets
|
||||
.values
|
||||
.iter()
|
||||
.map(|&u| Cow::Owned(u.to_string()))
|
||||
.chain(iter::once("otherwise".into()))
|
||||
.collect(),
|
||||
Call { target: Some(_), cleanup: Some(_), .. } => {
|
||||
vec!["return".into(), "unwind".into()]
|
||||
}
|
||||
|
@ -477,11 +477,9 @@ macro_rules! make_mir_visitor {
|
||||
|
||||
TerminatorKind::SwitchInt {
|
||||
discr,
|
||||
switch_ty,
|
||||
targets: _
|
||||
} => {
|
||||
self.visit_operand(discr, location);
|
||||
self.visit_ty($(& $mutability)? *switch_ty, TyContext::Location(location));
|
||||
}
|
||||
|
||||
TerminatorKind::Drop {
|
||||
|
@ -234,6 +234,15 @@ impl<'tcx> Generics {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn params_to(&'tcx self, param_index: usize, tcx: TyCtxt<'tcx>) -> &'tcx [GenericParamDef] {
|
||||
if let Some(index) = param_index.checked_sub(self.parent_count) {
|
||||
&self.params[..index]
|
||||
} else {
|
||||
tcx.generics_of(self.parent.expect("parent_count > 0 but no parent?"))
|
||||
.params_to(param_index, tcx)
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns the `GenericParamDef` associated with this `EarlyBoundRegion`.
|
||||
pub fn region_param(
|
||||
&'tcx self,
|
||||
|
@ -183,7 +183,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
||||
LogicalOp::And => (else_block, shortcircuit_block),
|
||||
LogicalOp::Or => (shortcircuit_block, else_block),
|
||||
};
|
||||
let term = TerminatorKind::if_(this.tcx, lhs, blocks.0, blocks.1);
|
||||
let term = TerminatorKind::if_(lhs, blocks.0, blocks.1);
|
||||
this.cfg.terminate(block, source_info, term);
|
||||
|
||||
this.cfg.push_assign_constant(
|
||||
|
@ -95,7 +95,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
||||
|
||||
let then_block = this.cfg.start_new_block();
|
||||
let else_block = this.cfg.start_new_block();
|
||||
let term = TerminatorKind::if_(this.tcx, operand, then_block, else_block);
|
||||
let term = TerminatorKind::if_(operand, then_block, else_block);
|
||||
|
||||
let source_info = this.source_info(expr_span);
|
||||
this.cfg.terminate(block, source_info, term);
|
||||
|
@ -203,7 +203,6 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
||||
self.source_info(match_start_span),
|
||||
TerminatorKind::SwitchInt {
|
||||
discr: Operand::Move(discr),
|
||||
switch_ty: discr_ty,
|
||||
targets: switch_targets,
|
||||
},
|
||||
);
|
||||
@ -221,7 +220,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
||||
0 => (second_bb, first_bb),
|
||||
v => span_bug!(test.span, "expected boolean value but got {:?}", v),
|
||||
};
|
||||
TerminatorKind::if_(self.tcx, Operand::Copy(place), true_bb, false_bb)
|
||||
TerminatorKind::if_(Operand::Copy(place), true_bb, false_bb)
|
||||
} else {
|
||||
// The switch may be inexhaustive so we have a catch all block
|
||||
debug_assert_eq!(options.len() + 1, target_blocks.len());
|
||||
@ -232,7 +231,6 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
||||
);
|
||||
TerminatorKind::SwitchInt {
|
||||
discr: Operand::Copy(place),
|
||||
switch_ty,
|
||||
targets: switch_targets,
|
||||
}
|
||||
};
|
||||
@ -378,7 +376,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
||||
self.cfg.terminate(
|
||||
block,
|
||||
source_info,
|
||||
TerminatorKind::if_(self.tcx, Operand::Move(result), success_block, fail_block),
|
||||
TerminatorKind::if_(Operand::Move(result), success_block, fail_block),
|
||||
);
|
||||
}
|
||||
|
||||
@ -482,7 +480,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
||||
self.cfg.terminate(
|
||||
eq_block,
|
||||
source_info,
|
||||
TerminatorKind::if_(self.tcx, Operand::Move(eq_result), success_block, fail_block),
|
||||
TerminatorKind::if_(Operand::Move(eq_result), success_block, fail_block),
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -596,7 +596,6 @@ where
|
||||
source_info: self.source_info,
|
||||
kind: TerminatorKind::SwitchInt {
|
||||
discr: Operand::Move(discr),
|
||||
switch_ty: discr_ty,
|
||||
targets: SwitchTargets::new(
|
||||
values.iter().copied().zip(blocks.iter().copied()),
|
||||
*blocks.last().unwrap(),
|
||||
@ -716,7 +715,7 @@ where
|
||||
is_cleanup: unwind.is_cleanup(),
|
||||
terminator: Some(Terminator {
|
||||
source_info: self.source_info,
|
||||
kind: TerminatorKind::if_(tcx, move_(can_go), succ, drop_block),
|
||||
kind: TerminatorKind::if_(move_(can_go), succ, drop_block),
|
||||
}),
|
||||
};
|
||||
let loop_block = self.elaborator.patch().new_block(loop_block);
|
||||
@ -781,7 +780,6 @@ where
|
||||
source_info: self.source_info,
|
||||
kind: TerminatorKind::SwitchInt {
|
||||
discr: move_(elem_size),
|
||||
switch_ty: tcx.types.usize,
|
||||
targets: SwitchTargets::static_if(
|
||||
0,
|
||||
self.drop_loop_pair(ety, false, len),
|
||||
@ -1021,7 +1019,7 @@ where
|
||||
DropStyle::Static => on_set,
|
||||
DropStyle::Conditional | DropStyle::Open => {
|
||||
let flag = self.elaborator.get_drop_flag(self.path).unwrap();
|
||||
let term = TerminatorKind::if_(self.tcx(), flag, on_set, on_unset);
|
||||
let term = TerminatorKind::if_(flag, on_set, on_unset);
|
||||
self.new_block(unwind, term)
|
||||
}
|
||||
}
|
||||
|
@ -261,7 +261,7 @@ impl Direction for Backward {
|
||||
propagate(pred, &tmp);
|
||||
}
|
||||
|
||||
mir::TerminatorKind::SwitchInt { targets: _, ref discr, switch_ty: _ } => {
|
||||
mir::TerminatorKind::SwitchInt { targets: _, ref discr } => {
|
||||
let mut applier = BackwardSwitchIntEdgeEffectsApplier {
|
||||
body,
|
||||
pred,
|
||||
@ -577,7 +577,7 @@ impl Direction for Forward {
|
||||
}
|
||||
}
|
||||
|
||||
SwitchInt { ref targets, ref discr, switch_ty: _ } => {
|
||||
SwitchInt { ref targets, ref discr } => {
|
||||
let mut applier = ForwardSwitchIntEdgeEffectsApplier {
|
||||
exit_state,
|
||||
targets,
|
||||
|
@ -82,8 +82,9 @@ impl<'tcx> Visitor<'tcx> for ConstGotoOptimizationFinder<'_, 'tcx> {
|
||||
}
|
||||
|
||||
let target_bb_terminator = target_bb.terminator();
|
||||
let (discr, switch_ty, targets) = target_bb_terminator.kind.as_switch()?;
|
||||
let (discr, targets) = target_bb_terminator.kind.as_switch()?;
|
||||
if discr.place() == Some(*place) {
|
||||
let switch_ty = place.ty(self.body.local_decls(), self.tcx).ty;
|
||||
// We now know that the Switch matches on the const place, and it is statementless
|
||||
// Now find which value in the Switch matches the const value.
|
||||
let const_value =
|
||||
|
@ -37,7 +37,7 @@ use rustc_data_structures::graph::WithSuccessors;
|
||||
use rustc_index::vec::{Idx, IndexVec};
|
||||
use rustc_middle::mir::coverage::CoverageKind;
|
||||
use rustc_middle::mir::*;
|
||||
use rustc_middle::ty::{self, Ty, TyCtxt};
|
||||
use rustc_middle::ty;
|
||||
use rustc_span::{self, BytePos, Pos, Span, DUMMY_SP};
|
||||
|
||||
// All `TEMP_BLOCK` targets should be replaced before calling `to_body() -> mir::Body`.
|
||||
@ -47,7 +47,6 @@ struct MockBlocks<'tcx> {
|
||||
blocks: IndexVec<BasicBlock, BasicBlockData<'tcx>>,
|
||||
dummy_place: Place<'tcx>,
|
||||
next_local: usize,
|
||||
bool_ty: Ty<'tcx>,
|
||||
}
|
||||
|
||||
impl<'tcx> MockBlocks<'tcx> {
|
||||
@ -56,7 +55,6 @@ impl<'tcx> MockBlocks<'tcx> {
|
||||
blocks: IndexVec::new(),
|
||||
dummy_place: Place { local: RETURN_PLACE, projection: ty::List::empty() },
|
||||
next_local: 0,
|
||||
bool_ty: TyCtxt::BOOL_TY_FOR_UNIT_TESTING,
|
||||
}
|
||||
}
|
||||
|
||||
@ -157,7 +155,6 @@ impl<'tcx> MockBlocks<'tcx> {
|
||||
fn switchint(&mut self, some_from_block: Option<BasicBlock>) -> BasicBlock {
|
||||
let switchint_kind = TerminatorKind::SwitchInt {
|
||||
discr: Operand::Move(Place::from(self.new_temp())),
|
||||
switch_ty: self.bool_ty, // just a dummy value
|
||||
targets: SwitchTargets::static_if(0, TEMP_BLOCK, TEMP_BLOCK),
|
||||
};
|
||||
self.add_block_from(some_from_block, switchint_kind)
|
||||
|
@ -121,7 +121,6 @@ impl<'tcx> MirPass<'tcx> for EarlyOtherwiseBranch {
|
||||
|
||||
let TerminatorKind::SwitchInt {
|
||||
discr: parent_op,
|
||||
switch_ty: parent_ty,
|
||||
targets: parent_targets
|
||||
} = &bbs[parent].terminator().kind else {
|
||||
unreachable!()
|
||||
@ -132,6 +131,7 @@ impl<'tcx> MirPass<'tcx> for EarlyOtherwiseBranch {
|
||||
Operand::Copy(x) => Operand::Copy(*x),
|
||||
Operand::Constant(x) => Operand::Constant(x.clone()),
|
||||
};
|
||||
let parent_ty = parent_op.ty(body.local_decls(), tcx);
|
||||
let statements_before = bbs[parent].statements.len();
|
||||
let parent_end = Location { block: parent, statement_index: statements_before };
|
||||
|
||||
@ -153,7 +153,7 @@ impl<'tcx> MirPass<'tcx> for EarlyOtherwiseBranch {
|
||||
// create temp to store inequality comparison between the two discriminants, `_t` in
|
||||
// example above
|
||||
let nequal = BinOp::Ne;
|
||||
let comp_res_type = nequal.ty(tcx, *parent_ty, opt_data.child_ty);
|
||||
let comp_res_type = nequal.ty(tcx, parent_ty, opt_data.child_ty);
|
||||
let comp_temp = patch.new_temp(comp_res_type, opt_data.child_source.span);
|
||||
patch.add_statement(parent_end, StatementKind::StorageLive(comp_temp));
|
||||
|
||||
@ -181,7 +181,6 @@ impl<'tcx> MirPass<'tcx> for EarlyOtherwiseBranch {
|
||||
kind: TerminatorKind::SwitchInt {
|
||||
// switch on the first discriminant, so we can mark the second one as dead
|
||||
discr: parent_op,
|
||||
switch_ty: opt_data.child_ty,
|
||||
targets: eq_targets,
|
||||
},
|
||||
}));
|
||||
@ -193,12 +192,7 @@ impl<'tcx> MirPass<'tcx> for EarlyOtherwiseBranch {
|
||||
let false_case = eq_bb;
|
||||
patch.patch_terminator(
|
||||
parent,
|
||||
TerminatorKind::if_(
|
||||
tcx,
|
||||
Operand::Move(Place::from(comp_temp)),
|
||||
true_case,
|
||||
false_case,
|
||||
),
|
||||
TerminatorKind::if_(Operand::Move(Place::from(comp_temp)), true_case, false_case),
|
||||
);
|
||||
|
||||
// generate StorageDead for the second_discriminant_temp not in use anymore
|
||||
@ -319,11 +313,11 @@ fn evaluate_candidate<'tcx>(
|
||||
let bbs = &body.basic_blocks;
|
||||
let TerminatorKind::SwitchInt {
|
||||
targets,
|
||||
switch_ty: parent_ty,
|
||||
..
|
||||
discr: parent_discr,
|
||||
} = &bbs[parent].terminator().kind else {
|
||||
return None
|
||||
};
|
||||
let parent_ty = parent_discr.ty(body.local_decls(), tcx);
|
||||
let parent_dest = {
|
||||
let poss = targets.otherwise();
|
||||
// If the fallthrough on the parent is trivially unreachable, we can let the
|
||||
@ -339,12 +333,12 @@ fn evaluate_candidate<'tcx>(
|
||||
let (_, child) = targets.iter().next()?;
|
||||
let child_terminator = &bbs[child].terminator();
|
||||
let TerminatorKind::SwitchInt {
|
||||
switch_ty: child_ty,
|
||||
targets: child_targets,
|
||||
..
|
||||
discr: child_discr,
|
||||
} = &child_terminator.kind else {
|
||||
return None
|
||||
};
|
||||
let child_ty = child_discr.ty(body.local_decls(), tcx);
|
||||
if child_ty != parent_ty {
|
||||
return None;
|
||||
}
|
||||
@ -372,7 +366,7 @@ fn evaluate_candidate<'tcx>(
|
||||
Some(OptimizationData {
|
||||
destination,
|
||||
child_place: *child_place,
|
||||
child_ty: *child_ty,
|
||||
child_ty,
|
||||
child_source: child_terminator.source_info,
|
||||
})
|
||||
}
|
||||
|
@ -877,11 +877,7 @@ fn insert_switch<'tcx>(
|
||||
let (assign, discr) = transform.get_discr(body);
|
||||
let switch_targets =
|
||||
SwitchTargets::new(cases.iter().map(|(i, bb)| ((*i) as u128, *bb)), default_block);
|
||||
let switch = TerminatorKind::SwitchInt {
|
||||
discr: Operand::Move(discr),
|
||||
switch_ty: transform.discr_ty,
|
||||
targets: switch_targets,
|
||||
};
|
||||
let switch = TerminatorKind::SwitchInt { discr: Operand::Move(discr), targets: switch_targets };
|
||||
|
||||
let source_info = SourceInfo::outermost(body.span);
|
||||
body.basic_blocks_mut().raw.insert(
|
||||
|
@ -55,10 +55,9 @@ impl<'tcx> MirPass<'tcx> for MatchBranchSimplification {
|
||||
continue;
|
||||
}
|
||||
|
||||
let (discr, val, switch_ty, first, second) = match bbs[bb_idx].terminator().kind {
|
||||
let (discr, val, first, second) = match bbs[bb_idx].terminator().kind {
|
||||
TerminatorKind::SwitchInt {
|
||||
discr: ref discr @ (Operand::Copy(_) | Operand::Move(_)),
|
||||
switch_ty,
|
||||
ref targets,
|
||||
..
|
||||
} if targets.iter().len() == 1 => {
|
||||
@ -66,7 +65,7 @@ impl<'tcx> MirPass<'tcx> for MatchBranchSimplification {
|
||||
if target == targets.otherwise() {
|
||||
continue;
|
||||
}
|
||||
(discr, value, switch_ty, target, targets.otherwise())
|
||||
(discr, value, target, targets.otherwise())
|
||||
}
|
||||
// Only optimize switch int statements
|
||||
_ => continue,
|
||||
@ -105,10 +104,11 @@ impl<'tcx> MirPass<'tcx> for MatchBranchSimplification {
|
||||
}
|
||||
// Take ownership of items now that we know we can optimize.
|
||||
let discr = discr.clone();
|
||||
let discr_ty = discr.ty(&body.local_decls, tcx);
|
||||
|
||||
// Introduce a temporary for the discriminant value.
|
||||
let source_info = bbs[bb_idx].terminator().source_info;
|
||||
let discr_local = body.local_decls.push(LocalDecl::new(switch_ty, source_info.span));
|
||||
let discr_local = body.local_decls.push(LocalDecl::new(discr_ty, source_info.span));
|
||||
|
||||
// We already checked that first and second are different blocks,
|
||||
// and bb_idx has a different terminator from both of them.
|
||||
@ -130,10 +130,10 @@ impl<'tcx> MirPass<'tcx> for MatchBranchSimplification {
|
||||
(*f).clone()
|
||||
} else {
|
||||
// Different value between blocks. Make value conditional on switch condition.
|
||||
let size = tcx.layout_of(param_env.and(switch_ty)).unwrap().size;
|
||||
let size = tcx.layout_of(param_env.and(discr_ty)).unwrap().size;
|
||||
let const_cmp = Operand::const_from_scalar(
|
||||
tcx,
|
||||
switch_ty,
|
||||
discr_ty,
|
||||
rustc_const_eval::interpret::Scalar::from_uint(val, size),
|
||||
rustc_span::DUMMY_SP,
|
||||
);
|
||||
|
@ -548,7 +548,6 @@ impl<'tcx> CloneShimBuilder<'tcx> {
|
||||
statements.push(statement);
|
||||
*kind = TerminatorKind::SwitchInt {
|
||||
discr: Operand::Move(temp),
|
||||
switch_ty: discr_ty,
|
||||
targets: SwitchTargets::new(cases.into_iter(), unreachable),
|
||||
};
|
||||
}
|
||||
|
@ -24,12 +24,9 @@ impl<'tcx> MirPass<'tcx> for SimplifyConstCondition {
|
||||
let terminator = block.terminator_mut();
|
||||
terminator.kind = match terminator.kind {
|
||||
TerminatorKind::SwitchInt {
|
||||
discr: Operand::Constant(ref c),
|
||||
switch_ty,
|
||||
ref targets,
|
||||
..
|
||||
discr: Operand::Constant(ref c), ref targets, ..
|
||||
} => {
|
||||
let constant = c.literal.try_eval_bits(tcx, param_env, switch_ty);
|
||||
let constant = c.literal.try_eval_bits(tcx, param_env, c.ty());
|
||||
if let Some(constant) = constant {
|
||||
let target = targets.target_for_value(constant);
|
||||
TerminatorKind::Goto { target }
|
||||
|
@ -127,11 +127,8 @@ impl<'tcx> MirPass<'tcx> for SimplifyComparisonIntegral {
|
||||
let targets = SwitchTargets::new(iter::once((new_value, bb_cond)), bb_otherwise);
|
||||
|
||||
let terminator = bb.terminator_mut();
|
||||
terminator.kind = TerminatorKind::SwitchInt {
|
||||
discr: Operand::Move(opt.to_switch_on),
|
||||
switch_ty: opt.branch_value_ty,
|
||||
targets,
|
||||
};
|
||||
terminator.kind =
|
||||
TerminatorKind::SwitchInt { discr: Operand::Move(opt.to_switch_on), targets };
|
||||
}
|
||||
|
||||
for (idx, bb_idx) in storage_deads_to_remove {
|
||||
|
@ -76,7 +76,7 @@ where
|
||||
let terminator = match terminator_kind {
|
||||
// This will unconditionally run into an unreachable and is therefore unreachable as well.
|
||||
TerminatorKind::Goto { target } if is_unreachable(*target) => TerminatorKind::Unreachable,
|
||||
TerminatorKind::SwitchInt { targets, discr, switch_ty } => {
|
||||
TerminatorKind::SwitchInt { targets, discr } => {
|
||||
let otherwise = targets.otherwise();
|
||||
|
||||
// If all targets are unreachable, we can be unreachable as well.
|
||||
@ -110,11 +110,7 @@ where
|
||||
return None;
|
||||
}
|
||||
|
||||
TerminatorKind::SwitchInt {
|
||||
discr: discr.clone(),
|
||||
switch_ty: *switch_ty,
|
||||
targets: new_targets,
|
||||
}
|
||||
TerminatorKind::SwitchInt { discr: discr.clone(), targets: new_targets }
|
||||
} else {
|
||||
// If the otherwise branch is reachable, we don't want to delete any unreachable branches.
|
||||
return None;
|
||||
|
@ -136,7 +136,7 @@ impl Thread {
|
||||
|
||||
unsafe {
|
||||
// Available since glibc 2.12, musl 1.1.16, and uClibc 1.0.20.
|
||||
let name = truncate_cstr(name, TASK_COMM_LEN);
|
||||
let name = truncate_cstr::<{ TASK_COMM_LEN }>(name);
|
||||
let res = libc::pthread_setname_np(libc::pthread_self(), name.as_ptr());
|
||||
// We have no good way of propagating errors here, but in debug-builds let's check that this actually worked.
|
||||
debug_assert_eq!(res, 0);
|
||||
@ -153,7 +153,7 @@ impl Thread {
|
||||
#[cfg(any(target_os = "macos", target_os = "ios", target_os = "watchos"))]
|
||||
pub fn set_name(name: &CStr) {
|
||||
unsafe {
|
||||
let name = truncate_cstr(name, libc::MAXTHREADNAMESIZE);
|
||||
let name = truncate_cstr::<{ libc::MAXTHREADNAMESIZE }>(name);
|
||||
let res = libc::pthread_setname_np(name.as_ptr());
|
||||
// We have no good way of propagating errors here, but in debug-builds let's check that this actually worked.
|
||||
debug_assert_eq!(res, 0);
|
||||
@ -285,17 +285,12 @@ impl Drop for Thread {
|
||||
}
|
||||
|
||||
#[cfg(any(target_os = "linux", target_os = "macos", target_os = "ios", target_os = "watchos"))]
|
||||
fn truncate_cstr(cstr: &CStr, max_with_nul: usize) -> crate::borrow::Cow<'_, CStr> {
|
||||
use crate::{borrow::Cow, ffi::CString};
|
||||
|
||||
if cstr.to_bytes_with_nul().len() > max_with_nul {
|
||||
let bytes = cstr.to_bytes()[..max_with_nul - 1].to_vec();
|
||||
// SAFETY: the non-nul bytes came straight from a CStr.
|
||||
// (CString will add the terminating nul.)
|
||||
Cow::Owned(unsafe { CString::from_vec_unchecked(bytes) })
|
||||
} else {
|
||||
Cow::Borrowed(cstr)
|
||||
fn truncate_cstr<const MAX_WITH_NUL: usize>(cstr: &CStr) -> [libc::c_char; MAX_WITH_NUL] {
|
||||
let mut result = [0; MAX_WITH_NUL];
|
||||
for (src, dst) in cstr.to_bytes().iter().zip(&mut result[..MAX_WITH_NUL - 1]) {
|
||||
*dst = *src as libc::c_char;
|
||||
}
|
||||
result
|
||||
}
|
||||
|
||||
pub fn available_parallelism() -> io::Result<NonZeroUsize> {
|
||||
|
22
src/test/codegen/issue-105386-ub-in-debuginfo.rs
Normal file
22
src/test/codegen/issue-105386-ub-in-debuginfo.rs
Normal file
@ -0,0 +1,22 @@
|
||||
// compile-flags: --crate-type=lib -O -Cdebuginfo=2 -Cno-prepopulate-passes
|
||||
// min-llvm-version: 15.0 # this test uses opaque pointer notation
|
||||
#![feature(stmt_expr_attributes)]
|
||||
|
||||
pub struct S([usize; 8]);
|
||||
|
||||
#[no_mangle]
|
||||
pub fn outer_function(x: S, y: S) -> usize {
|
||||
(#[inline(always)]|| {
|
||||
let _z = x;
|
||||
y.0[0]
|
||||
})()
|
||||
}
|
||||
|
||||
// Check that we do not attempt to load from the spilled arg before it is assigned to
|
||||
// when generating debuginfo.
|
||||
// CHECK-LABEL: @outer_function
|
||||
// CHECK: [[spill:%.*]] = alloca %"[closure@{{.*.rs}}:9:23: 9:25]"
|
||||
// CHECK-NOT: [[ptr_tmp:%.*]] = getelementptr inbounds %"[closure@{{.*.rs}}:9:23: 9:25]", ptr [[spill]]
|
||||
// CHECK-NOT: [[load:%.*]] = load ptr, ptr
|
||||
// CHECK: call void @llvm.lifetime.start{{.*}}({{.*}}, ptr [[spill]])
|
||||
// CHECK: call void @llvm.memcpy{{.*}}(ptr {{align .*}} [[spill]], ptr {{align .*}} %x
|
@ -8,7 +8,7 @@
|
||||
|
||||
bb0: {
|
||||
_2 = discriminant(_1); // scope 0 at $DIR/76803_regression.rs:+1:11: +1:12
|
||||
switchInt(move _2) -> [0_isize: bb2, otherwise: bb1]; // scope 0 at $DIR/76803_regression.rs:+1:5: +1:12
|
||||
switchInt(move _2) -> [0: bb2, otherwise: bb1]; // scope 0 at $DIR/76803_regression.rs:+1:5: +1:12
|
||||
}
|
||||
|
||||
bb1: {
|
||||
|
@ -14,7 +14,7 @@
|
||||
- _2 = Ne(move _3, const true); // scope 0 at $DIR/bool_compare.rs:+1:8: +1:17
|
||||
+ _2 = Not(move _3); // scope 0 at $DIR/bool_compare.rs:+1:8: +1:17
|
||||
StorageDead(_3); // scope 0 at $DIR/bool_compare.rs:+1:16: +1:17
|
||||
switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/bool_compare.rs:+1:8: +1:17
|
||||
switchInt(move _2) -> [0: bb2, otherwise: bb1]; // scope 0 at $DIR/bool_compare.rs:+1:8: +1:17
|
||||
}
|
||||
|
||||
bb1: {
|
||||
|
@ -14,7 +14,7 @@
|
||||
- _2 = Ne(const true, move _3); // scope 0 at $DIR/bool_compare.rs:+1:8: +1:17
|
||||
+ _2 = Not(move _3); // scope 0 at $DIR/bool_compare.rs:+1:8: +1:17
|
||||
StorageDead(_3); // scope 0 at $DIR/bool_compare.rs:+1:16: +1:17
|
||||
switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/bool_compare.rs:+1:8: +1:17
|
||||
switchInt(move _2) -> [0: bb2, otherwise: bb1]; // scope 0 at $DIR/bool_compare.rs:+1:8: +1:17
|
||||
}
|
||||
|
||||
bb1: {
|
||||
|
@ -14,7 +14,7 @@
|
||||
- _2 = Eq(move _3, const false); // scope 0 at $DIR/bool_compare.rs:+1:8: +1:18
|
||||
+ _2 = Not(move _3); // scope 0 at $DIR/bool_compare.rs:+1:8: +1:18
|
||||
StorageDead(_3); // scope 0 at $DIR/bool_compare.rs:+1:17: +1:18
|
||||
switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/bool_compare.rs:+1:8: +1:18
|
||||
switchInt(move _2) -> [0: bb2, otherwise: bb1]; // scope 0 at $DIR/bool_compare.rs:+1:8: +1:18
|
||||
}
|
||||
|
||||
bb1: {
|
||||
|
@ -14,7 +14,7 @@
|
||||
- _2 = Eq(const false, move _3); // scope 0 at $DIR/bool_compare.rs:+1:8: +1:18
|
||||
+ _2 = Not(move _3); // scope 0 at $DIR/bool_compare.rs:+1:8: +1:18
|
||||
StorageDead(_3); // scope 0 at $DIR/bool_compare.rs:+1:17: +1:18
|
||||
switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/bool_compare.rs:+1:8: +1:18
|
||||
switchInt(move _2) -> [0: bb2, otherwise: bb1]; // scope 0 at $DIR/bool_compare.rs:+1:8: +1:18
|
||||
}
|
||||
|
||||
bb1: {
|
||||
|
@ -27,7 +27,7 @@ fn main() -> () {
|
||||
StorageLive(_5); // scope 1 at $DIR/issue_101867.rs:+2:14: +2:15
|
||||
FakeRead(ForMatchedPlace(None), _1); // scope 1 at $DIR/issue_101867.rs:+2:19: +2:20
|
||||
_6 = discriminant(_1); // scope 1 at $DIR/issue_101867.rs:+2:19: +2:20
|
||||
switchInt(move _6) -> [1_isize: bb4, otherwise: bb3]; // scope 1 at $DIR/issue_101867.rs:+2:9: +2:16
|
||||
switchInt(move _6) -> [1: bb4, otherwise: bb3]; // scope 1 at $DIR/issue_101867.rs:+2:9: +2:16
|
||||
}
|
||||
|
||||
bb1: {
|
||||
|
@ -25,7 +25,7 @@ fn main() -> () {
|
||||
StorageLive(_3); // scope 0 at $DIR/issue_49232.rs:+3:19: +3:23
|
||||
_3 = const true; // scope 0 at $DIR/issue_49232.rs:+3:19: +3:23
|
||||
FakeRead(ForMatchedPlace(None), _3); // scope 0 at $DIR/issue_49232.rs:+3:19: +3:23
|
||||
switchInt(_3) -> [false: bb3, otherwise: bb4]; // scope 0 at $DIR/issue_49232.rs:+3:13: +3:23
|
||||
switchInt(_3) -> [0: bb3, otherwise: bb4]; // scope 0 at $DIR/issue_49232.rs:+3:13: +3:23
|
||||
}
|
||||
|
||||
bb3: {
|
||||
|
@ -28,7 +28,7 @@ fn full_tested_match() -> () {
|
||||
_2 = Option::<i32>::Some(const 42_i32); // scope 0 at $DIR/match_false_edges.rs:+1:19: +1:27
|
||||
FakeRead(ForMatchedPlace(None), _2); // scope 0 at $DIR/match_false_edges.rs:+1:19: +1:27
|
||||
_3 = discriminant(_2); // scope 0 at $DIR/match_false_edges.rs:+1:19: +1:27
|
||||
switchInt(move _3) -> [0_isize: bb1, 1_isize: bb2, otherwise: bb4]; // scope 0 at $DIR/match_false_edges.rs:+1:13: +1:27
|
||||
switchInt(move _3) -> [0: bb1, 1: bb2, otherwise: bb4]; // scope 0 at $DIR/match_false_edges.rs:+1:13: +1:27
|
||||
}
|
||||
|
||||
bb1: {
|
||||
@ -60,7 +60,7 @@ fn full_tested_match() -> () {
|
||||
}
|
||||
|
||||
bb6: {
|
||||
switchInt(move _7) -> [false: bb8, otherwise: bb7]; // scope 0 at $DIR/match_false_edges.rs:+2:20: +2:27
|
||||
switchInt(move _7) -> [0: bb8, otherwise: bb7]; // scope 0 at $DIR/match_false_edges.rs:+2:20: +2:27
|
||||
}
|
||||
|
||||
bb7: {
|
||||
|
@ -28,7 +28,7 @@ fn full_tested_match2() -> () {
|
||||
_2 = Option::<i32>::Some(const 42_i32); // scope 0 at $DIR/match_false_edges.rs:+1:19: +1:27
|
||||
FakeRead(ForMatchedPlace(None), _2); // scope 0 at $DIR/match_false_edges.rs:+1:19: +1:27
|
||||
_3 = discriminant(_2); // scope 0 at $DIR/match_false_edges.rs:+1:19: +1:27
|
||||
switchInt(move _3) -> [0_isize: bb1, 1_isize: bb2, otherwise: bb4]; // scope 0 at $DIR/match_false_edges.rs:+1:13: +1:27
|
||||
switchInt(move _3) -> [0: bb1, 1: bb2, otherwise: bb4]; // scope 0 at $DIR/match_false_edges.rs:+1:13: +1:27
|
||||
}
|
||||
|
||||
bb1: {
|
||||
@ -66,7 +66,7 @@ fn full_tested_match2() -> () {
|
||||
}
|
||||
|
||||
bb6: {
|
||||
switchInt(move _7) -> [false: bb8, otherwise: bb7]; // scope 0 at $DIR/match_false_edges.rs:+2:20: +2:27
|
||||
switchInt(move _7) -> [0: bb8, otherwise: bb7]; // scope 0 at $DIR/match_false_edges.rs:+2:20: +2:27
|
||||
}
|
||||
|
||||
bb7: {
|
||||
|
@ -39,7 +39,7 @@ fn main() -> () {
|
||||
_2 = Option::<i32>::Some(const 1_i32); // scope 0 at $DIR/match_false_edges.rs:+1:19: +1:26
|
||||
FakeRead(ForMatchedPlace(None), _2); // scope 0 at $DIR/match_false_edges.rs:+1:19: +1:26
|
||||
_4 = discriminant(_2); // scope 0 at $DIR/match_false_edges.rs:+1:19: +1:26
|
||||
switchInt(move _4) -> [1_isize: bb2, otherwise: bb1]; // scope 0 at $DIR/match_false_edges.rs:+1:13: +1:26
|
||||
switchInt(move _4) -> [1: bb2, otherwise: bb1]; // scope 0 at $DIR/match_false_edges.rs:+1:13: +1:26
|
||||
}
|
||||
|
||||
bb1: {
|
||||
@ -56,7 +56,7 @@ fn main() -> () {
|
||||
|
||||
bb4: {
|
||||
_3 = discriminant(_2); // scope 0 at $DIR/match_false_edges.rs:+1:19: +1:26
|
||||
switchInt(move _3) -> [1_isize: bb6, otherwise: bb5]; // scope 0 at $DIR/match_false_edges.rs:+1:13: +1:26
|
||||
switchInt(move _3) -> [1: bb6, otherwise: bb5]; // scope 0 at $DIR/match_false_edges.rs:+1:13: +1:26
|
||||
}
|
||||
|
||||
bb5: {
|
||||
@ -87,7 +87,7 @@ fn main() -> () {
|
||||
}
|
||||
|
||||
bb9: {
|
||||
switchInt(move _8) -> [false: bb11, otherwise: bb10]; // scope 0 at $DIR/match_false_edges.rs:+2:21: +2:28
|
||||
switchInt(move _8) -> [0: bb11, otherwise: bb10]; // scope 0 at $DIR/match_false_edges.rs:+2:21: +2:28
|
||||
}
|
||||
|
||||
bb10: {
|
||||
@ -134,7 +134,7 @@ fn main() -> () {
|
||||
}
|
||||
|
||||
bb15: {
|
||||
switchInt(move _12) -> [false: bb17, otherwise: bb16]; // scope 0 at $DIR/match_false_edges.rs:+4:20: +4:29
|
||||
switchInt(move _12) -> [0: bb17, otherwise: bb16]; // scope 0 at $DIR/match_false_edges.rs:+4:20: +4:29
|
||||
}
|
||||
|
||||
bb16: {
|
||||
|
@ -6,7 +6,7 @@ fn match_bool(_1: bool) -> usize {
|
||||
|
||||
bb0: {
|
||||
FakeRead(ForMatchedPlace(None), _1); // scope 0 at $DIR/simple_match.rs:+1:11: +1:12
|
||||
switchInt(_1) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/simple_match.rs:+1:5: +1:12
|
||||
switchInt(_1) -> [0: bb2, otherwise: bb1]; // scope 0 at $DIR/simple_match.rs:+1:5: +1:12
|
||||
}
|
||||
|
||||
bb1: {
|
||||
|
@ -11,9 +11,9 @@
|
||||
bb0: {
|
||||
- StorageLive(_2); // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
|
||||
- _3 = discriminant(_1); // scope 0 at $DIR/const_goto.rs:+1:17: +1:20
|
||||
- switchInt(move _3) -> [1_isize: bb2, 2_isize: bb2, otherwise: bb1]; // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
|
||||
- switchInt(move _3) -> [1: bb2, 2: bb2, otherwise: bb1]; // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
|
||||
+ _2 = discriminant(_1); // scope 0 at $DIR/const_goto.rs:+1:17: +1:20
|
||||
+ switchInt(move _2) -> [1_isize: bb2, 2_isize: bb2, otherwise: bb1]; // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
|
||||
+ switchInt(move _2) -> [1: bb2, 2: bb2, otherwise: bb1]; // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
|
||||
}
|
||||
|
||||
bb1: {
|
||||
@ -29,7 +29,7 @@
|
||||
- }
|
||||
-
|
||||
- bb3: {
|
||||
- switchInt(move _2) -> [false: bb5, otherwise: bb4]; // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
|
||||
- switchInt(move _2) -> [0: bb5, otherwise: bb4]; // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
|
||||
- }
|
||||
-
|
||||
- bb4: {
|
||||
|
@ -10,7 +10,7 @@
|
||||
StorageLive(_1); // scope 0 at $DIR/const_goto_const_eval_fail.rs:+1:11: +6:6
|
||||
StorageLive(_2); // scope 0 at $DIR/const_goto_const_eval_fail.rs:+2:15: +2:16
|
||||
_2 = const A; // scope 0 at $DIR/const_goto_const_eval_fail.rs:+2:15: +2:16
|
||||
switchInt(_2) -> [1_i32: bb2, 2_i32: bb2, 3_i32: bb2, otherwise: bb1]; // scope 0 at $DIR/const_goto_const_eval_fail.rs:+2:9: +2:16
|
||||
switchInt(_2) -> [1: bb2, 2: bb2, 3: bb2, otherwise: bb1]; // scope 0 at $DIR/const_goto_const_eval_fail.rs:+2:9: +2:16
|
||||
}
|
||||
|
||||
bb1: {
|
||||
@ -21,11 +21,11 @@
|
||||
bb2: {
|
||||
_1 = const B; // scope 0 at $DIR/const_goto_const_eval_fail.rs:+3:26: +3:27
|
||||
- goto -> bb3; // scope 0 at $DIR/const_goto_const_eval_fail.rs:+3:26: +3:27
|
||||
+ switchInt(_1) -> [false: bb4, otherwise: bb3]; // scope 0 at $DIR/const_goto_const_eval_fail.rs:+1:5: +6:6
|
||||
+ switchInt(_1) -> [0: bb4, otherwise: bb3]; // scope 0 at $DIR/const_goto_const_eval_fail.rs:+1:5: +6:6
|
||||
}
|
||||
|
||||
bb3: {
|
||||
- switchInt(_1) -> [false: bb5, otherwise: bb4]; // scope 0 at $DIR/const_goto_const_eval_fail.rs:+1:5: +6:6
|
||||
- switchInt(_1) -> [0: bb5, otherwise: bb4]; // scope 0 at $DIR/const_goto_const_eval_fail.rs:+1:5: +6:6
|
||||
- }
|
||||
-
|
||||
- bb4: {
|
||||
|
@ -23,10 +23,10 @@
|
||||
- StorageLive(_5); // scope 0 at $DIR/const_goto_storage.rs:+2:21: +2:52
|
||||
- StorageLive(_6); // scope 0 at $DIR/const_goto_storage.rs:+2:24: +2:28
|
||||
- _6 = const true; // scope 0 at $DIR/const_goto_storage.rs:+2:24: +2:28
|
||||
- switchInt(move _6) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/const_goto_storage.rs:+2:24: +2:28
|
||||
- switchInt(move _6) -> [0: bb2, otherwise: bb1]; // scope 0 at $DIR/const_goto_storage.rs:+2:24: +2:28
|
||||
+ StorageLive(_2); // scope 0 at $DIR/const_goto_storage.rs:+2:24: +2:28
|
||||
+ _2 = const true; // scope 0 at $DIR/const_goto_storage.rs:+2:24: +2:28
|
||||
+ switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/const_goto_storage.rs:+2:24: +2:28
|
||||
+ switchInt(move _2) -> [0: bb2, otherwise: bb1]; // scope 0 at $DIR/const_goto_storage.rs:+2:24: +2:28
|
||||
}
|
||||
|
||||
bb1: {
|
||||
@ -41,7 +41,7 @@
|
||||
-
|
||||
- bb3: {
|
||||
- StorageDead(_6); // scope 0 at $DIR/const_goto_storage.rs:+2:51: +2:52
|
||||
- switchInt(move _5) -> [false: bb5, otherwise: bb4]; // scope 0 at $DIR/const_goto_storage.rs:+2:21: +2:52
|
||||
- switchInt(move _5) -> [0: bb5, otherwise: bb4]; // scope 0 at $DIR/const_goto_storage.rs:+2:21: +2:52
|
||||
- }
|
||||
-
|
||||
- bb4: {
|
||||
@ -56,7 +56,7 @@
|
||||
-
|
||||
- bb6: {
|
||||
- StorageDead(_5); // scope 0 at $DIR/const_goto_storage.rs:+2:75: +2:76
|
||||
- switchInt(move _4) -> [false: bb8, otherwise: bb7]; // scope 0 at $DIR/const_goto_storage.rs:+2:18: +2:76
|
||||
- switchInt(move _4) -> [0: bb8, otherwise: bb7]; // scope 0 at $DIR/const_goto_storage.rs:+2:18: +2:76
|
||||
- }
|
||||
-
|
||||
- bb7: {
|
||||
@ -70,7 +70,7 @@
|
||||
- }
|
||||
-
|
||||
- bb9: {
|
||||
- switchInt(move _3) -> [false: bb11, otherwise: bb10]; // scope 0 at $DIR/const_goto_storage.rs:+2:15: +6:10
|
||||
- switchInt(move _3) -> [0: bb11, otherwise: bb10]; // scope 0 at $DIR/const_goto_storage.rs:+2:15: +6:10
|
||||
- }
|
||||
-
|
||||
- bb10: {
|
||||
|
@ -9,8 +9,8 @@
|
||||
bb0: {
|
||||
StorageLive(_1); // scope 0 at $DIR/control_flow_simplification.rs:+1:8: +1:21
|
||||
_1 = const _; // scope 0 at $DIR/control_flow_simplification.rs:+1:8: +1:21
|
||||
- switchInt(move _1) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/control_flow_simplification.rs:+1:8: +1:21
|
||||
+ switchInt(const false) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/control_flow_simplification.rs:+1:8: +1:21
|
||||
- switchInt(move _1) -> [0: bb2, otherwise: bb1]; // scope 0 at $DIR/control_flow_simplification.rs:+1:8: +1:21
|
||||
+ switchInt(const false) -> [0: bb2, otherwise: bb1]; // scope 0 at $DIR/control_flow_simplification.rs:+1:8: +1:21
|
||||
}
|
||||
|
||||
bb1: {
|
||||
|
@ -21,13 +21,13 @@
|
||||
((_3 as Some).0: bool) = const true; // scope 2 at $DIR/discriminant.rs:+1:34: +1:44
|
||||
discriminant(_3) = 1; // scope 2 at $DIR/discriminant.rs:+1:34: +1:44
|
||||
- _4 = discriminant(_3); // scope 2 at $DIR/discriminant.rs:+1:21: +1:31
|
||||
- switchInt(move _4) -> [1_isize: bb1, otherwise: bb3]; // scope 2 at $DIR/discriminant.rs:+1:21: +1:31
|
||||
- switchInt(move _4) -> [1: bb1, otherwise: bb3]; // scope 2 at $DIR/discriminant.rs:+1:21: +1:31
|
||||
+ _4 = const 1_isize; // scope 2 at $DIR/discriminant.rs:+1:21: +1:31
|
||||
+ switchInt(const 1_isize) -> [1_isize: bb1, otherwise: bb3]; // scope 2 at $DIR/discriminant.rs:+1:21: +1:31
|
||||
+ switchInt(const 1_isize) -> [1: bb1, otherwise: bb3]; // scope 2 at $DIR/discriminant.rs:+1:21: +1:31
|
||||
}
|
||||
|
||||
bb1: {
|
||||
switchInt(((_3 as Some).0: bool)) -> [false: bb3, otherwise: bb2]; // scope 2 at $DIR/discriminant.rs:+1:21: +1:31
|
||||
switchInt(((_3 as Some).0: bool)) -> [0: bb3, otherwise: bb2]; // scope 2 at $DIR/discriminant.rs:+1:21: +1:31
|
||||
}
|
||||
|
||||
bb2: {
|
||||
|
@ -21,13 +21,13 @@
|
||||
((_3 as Some).0: bool) = const true; // scope 2 at $DIR/discriminant.rs:+1:34: +1:44
|
||||
discriminant(_3) = 1; // scope 2 at $DIR/discriminant.rs:+1:34: +1:44
|
||||
- _4 = discriminant(_3); // scope 2 at $DIR/discriminant.rs:+1:21: +1:31
|
||||
- switchInt(move _4) -> [1_isize: bb1, otherwise: bb3]; // scope 2 at $DIR/discriminant.rs:+1:21: +1:31
|
||||
- switchInt(move _4) -> [1: bb1, otherwise: bb3]; // scope 2 at $DIR/discriminant.rs:+1:21: +1:31
|
||||
+ _4 = const 1_isize; // scope 2 at $DIR/discriminant.rs:+1:21: +1:31
|
||||
+ switchInt(const 1_isize) -> [1_isize: bb1, otherwise: bb3]; // scope 2 at $DIR/discriminant.rs:+1:21: +1:31
|
||||
+ switchInt(const 1_isize) -> [1: bb1, otherwise: bb3]; // scope 2 at $DIR/discriminant.rs:+1:21: +1:31
|
||||
}
|
||||
|
||||
bb1: {
|
||||
switchInt(((_3 as Some).0: bool)) -> [false: bb3, otherwise: bb2]; // scope 2 at $DIR/discriminant.rs:+1:21: +1:31
|
||||
switchInt(((_3 as Some).0: bool)) -> [0: bb3, otherwise: bb2]; // scope 2 at $DIR/discriminant.rs:+1:21: +1:31
|
||||
}
|
||||
|
||||
bb2: {
|
||||
|
@ -8,8 +8,8 @@
|
||||
bb0: {
|
||||
StorageLive(_1); // scope 0 at $DIR/switch_int.rs:+1:11: +1:12
|
||||
_1 = const 1_i32; // scope 0 at $DIR/switch_int.rs:+1:11: +1:12
|
||||
- switchInt(_1) -> [1_i32: bb2, otherwise: bb1]; // scope 0 at $DIR/switch_int.rs:+1:5: +1:12
|
||||
+ switchInt(const 1_i32) -> [1_i32: bb2, otherwise: bb1]; // scope 0 at $DIR/switch_int.rs:+1:5: +1:12
|
||||
- switchInt(_1) -> [1: bb2, otherwise: bb1]; // scope 0 at $DIR/switch_int.rs:+1:5: +1:12
|
||||
+ switchInt(const 1_i32) -> [1: bb2, otherwise: bb1]; // scope 0 at $DIR/switch_int.rs:+1:5: +1:12
|
||||
}
|
||||
|
||||
bb1: {
|
||||
|
@ -8,7 +8,7 @@
|
||||
bb0: {
|
||||
StorageLive(_1); // scope 0 at $DIR/switch_int.rs:+1:11: +1:12
|
||||
_1 = const 1_i32; // scope 0 at $DIR/switch_int.rs:+1:11: +1:12
|
||||
- switchInt(const 1_i32) -> [1_i32: bb2, otherwise: bb1]; // scope 0 at $DIR/switch_int.rs:+1:5: +1:12
|
||||
- switchInt(const 1_i32) -> [1: bb2, otherwise: bb1]; // scope 0 at $DIR/switch_int.rs:+1:5: +1:12
|
||||
+ goto -> bb2; // scope 0 at $DIR/switch_int.rs:+1:5: +1:12
|
||||
}
|
||||
|
||||
|
@ -7,7 +7,7 @@ digraph Cov_0_3 {
|
||||
bcb1__Cov_0_3 [shape="none", label=<<table border="0" cellborder="1" cellspacing="0"><tr><td bgcolor="gray" align="center" colspan="1">bcb1</td></tr><tr><td align="left" balign="left">Expression(bcb0 + bcb3) at 10:5-11:17<br align="left"/> 11:12-11:17: @2.Call: _2 = bar() -> [return: bb3, unwind: bb6]</td></tr><tr><td align="left" balign="left">bb1: FalseUnwind<br align="left"/>bb2: Call</td></tr><tr><td align="left" balign="left">bb3: SwitchInt</td></tr></table>>];
|
||||
bcb0__Cov_0_3 [shape="none", label=<<table border="0" cellborder="1" cellspacing="0"><tr><td bgcolor="gray" align="center" colspan="1">bcb0</td></tr><tr><td align="left" balign="left"></td></tr><tr><td align="left" balign="left">Counter(bcb0) at 9:1-9:11<br align="left"/> </td></tr><tr><td align="left" balign="left">bb0: Goto</td></tr></table>>];
|
||||
bcb3__Cov_0_3 -> bcb1__Cov_0_3 [label=<>];
|
||||
bcb1__Cov_0_3 -> bcb3__Cov_0_3 [label=<false>];
|
||||
bcb1__Cov_0_3 -> bcb3__Cov_0_3 [label=<0>];
|
||||
bcb1__Cov_0_3 -> bcb2__Cov_0_3 [label=<otherwise>];
|
||||
bcb0__Cov_0_3 -> bcb1__Cov_0_3 [label=<>];
|
||||
}
|
||||
|
@ -28,7 +28,7 @@
|
||||
discriminant(_1) = 0; // scope 0 at $DIR/enum.rs:+1:13: +1:21
|
||||
StorageLive(_2); // scope 1 at $DIR/enum.rs:+2:9: +2:10
|
||||
_3 = discriminant(_1); // scope 1 at $DIR/enum.rs:+2:19: +2:20
|
||||
switchInt(move _3) -> [0_isize: bb3, 1_isize: bb1, otherwise: bb2]; // scope 1 at $DIR/enum.rs:+2:13: +2:20
|
||||
switchInt(move _3) -> [0: bb3, 1: bb1, otherwise: bb2]; // scope 1 at $DIR/enum.rs:+2:13: +2:20
|
||||
}
|
||||
|
||||
bb1: {
|
||||
|
@ -42,8 +42,8 @@
|
||||
+ _4 = const 1_i32; // scope 1 at $DIR/if.rs:+2:16: +2:17
|
||||
+ _3 = const true; // scope 1 at $DIR/if.rs:+2:16: +2:22
|
||||
StorageDead(_4); // scope 1 at $DIR/if.rs:+2:21: +2:22
|
||||
- switchInt(move _3) -> [false: bb2, otherwise: bb1]; // scope 1 at $DIR/if.rs:+2:16: +2:22
|
||||
+ switchInt(const true) -> [false: bb2, otherwise: bb1]; // scope 1 at $DIR/if.rs:+2:16: +2:22
|
||||
- switchInt(move _3) -> [0: bb2, otherwise: bb1]; // scope 1 at $DIR/if.rs:+2:16: +2:22
|
||||
+ switchInt(const true) -> [0: bb2, otherwise: bb1]; // scope 1 at $DIR/if.rs:+2:16: +2:22
|
||||
}
|
||||
|
||||
bb1: {
|
||||
@ -73,8 +73,8 @@
|
||||
+ _9 = const 1_i32; // scope 3 at $DIR/if.rs:+5:16: +5:17
|
||||
+ _8 = const true; // scope 3 at $DIR/if.rs:+5:16: +5:22
|
||||
StorageDead(_9); // scope 3 at $DIR/if.rs:+5:21: +5:22
|
||||
- switchInt(move _8) -> [false: bb5, otherwise: bb4]; // scope 3 at $DIR/if.rs:+5:16: +5:22
|
||||
+ switchInt(const true) -> [false: bb5, otherwise: bb4]; // scope 3 at $DIR/if.rs:+5:16: +5:22
|
||||
- switchInt(move _8) -> [0: bb5, otherwise: bb4]; // scope 3 at $DIR/if.rs:+5:16: +5:22
|
||||
+ switchInt(const true) -> [0: bb5, otherwise: bb4]; // scope 3 at $DIR/if.rs:+5:16: +5:22
|
||||
}
|
||||
|
||||
bb4: {
|
||||
|
@ -10,8 +10,8 @@
|
||||
StorageLive(_1); // scope 0 at $DIR/issue_81605.rs:+1:9: +1:33
|
||||
StorageLive(_2); // scope 0 at $DIR/issue_81605.rs:+1:12: +1:16
|
||||
_2 = const true; // scope 0 at $DIR/issue_81605.rs:+1:12: +1:16
|
||||
- switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/issue_81605.rs:+1:12: +1:16
|
||||
+ switchInt(const true) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/issue_81605.rs:+1:12: +1:16
|
||||
- switchInt(move _2) -> [0: bb2, otherwise: bb1]; // scope 0 at $DIR/issue_81605.rs:+1:12: +1:16
|
||||
+ switchInt(const true) -> [0: bb2, otherwise: bb1]; // scope 0 at $DIR/issue_81605.rs:+1:12: +1:16
|
||||
}
|
||||
|
||||
bb1: {
|
||||
|
@ -37,8 +37,8 @@
|
||||
}
|
||||
|
||||
bb2: {
|
||||
- switchInt(move _5) -> [false: bb4, otherwise: bb3]; // scope 0 at $DIR/cycle.rs:+3:11: +3:17
|
||||
+ switchInt(move _4) -> [false: bb4, otherwise: bb3]; // scope 0 at $DIR/cycle.rs:+3:11: +3:17
|
||||
- switchInt(move _5) -> [0: bb4, otherwise: bb3]; // scope 0 at $DIR/cycle.rs:+3:11: +3:17
|
||||
+ switchInt(move _4) -> [0: bb4, otherwise: bb3]; // scope 0 at $DIR/cycle.rs:+3:11: +3:17
|
||||
}
|
||||
|
||||
bb3: {
|
||||
|
@ -12,7 +12,7 @@
|
||||
bb0: {
|
||||
StorageLive(_3); // scope 0 at $DIR/deaggregator_test_enum_2.rs:+1:8: +1:9
|
||||
_3 = _1; // scope 0 at $DIR/deaggregator_test_enum_2.rs:+1:8: +1:9
|
||||
switchInt(move _3) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/deaggregator_test_enum_2.rs:+1:8: +1:9
|
||||
switchInt(move _3) -> [0: bb2, otherwise: bb1]; // scope 0 at $DIR/deaggregator_test_enum_2.rs:+1:8: +1:9
|
||||
}
|
||||
|
||||
bb1: {
|
||||
|
@ -28,44 +28,44 @@
|
||||
_7 = Len((*_2)); // scope 0 at $DIR/deduplicate_blocks.rs:+2:9: +2:37
|
||||
_8 = const 4_usize; // scope 0 at $DIR/deduplicate_blocks.rs:+2:9: +2:37
|
||||
_9 = Ge(move _7, move _8); // scope 0 at $DIR/deduplicate_blocks.rs:+2:9: +2:37
|
||||
switchInt(move _9) -> [false: bb6, otherwise: bb2]; // scope 0 at $DIR/deduplicate_blocks.rs:+2:9: +2:37
|
||||
switchInt(move _9) -> [0: bb6, otherwise: bb2]; // scope 0 at $DIR/deduplicate_blocks.rs:+2:9: +2:37
|
||||
}
|
||||
|
||||
bb2: {
|
||||
switchInt((*_2)[0 of 4]) -> [47_u8: bb3, otherwise: bb6]; // scope 0 at $DIR/deduplicate_blocks.rs:+1:5: +1:23
|
||||
switchInt((*_2)[0 of 4]) -> [47: bb3, otherwise: bb6]; // scope 0 at $DIR/deduplicate_blocks.rs:+1:5: +1:23
|
||||
}
|
||||
|
||||
bb3: {
|
||||
switchInt((*_2)[1 of 4]) -> [47_u8: bb4, otherwise: bb6]; // scope 0 at $DIR/deduplicate_blocks.rs:+1:5: +1:23
|
||||
switchInt((*_2)[1 of 4]) -> [47: bb4, otherwise: bb6]; // scope 0 at $DIR/deduplicate_blocks.rs:+1:5: +1:23
|
||||
}
|
||||
|
||||
bb4: {
|
||||
switchInt((*_2)[2 of 4]) -> [47_u8: bb5, otherwise: bb6]; // scope 0 at $DIR/deduplicate_blocks.rs:+1:5: +1:23
|
||||
switchInt((*_2)[2 of 4]) -> [47: bb5, otherwise: bb6]; // scope 0 at $DIR/deduplicate_blocks.rs:+1:5: +1:23
|
||||
}
|
||||
|
||||
bb5: {
|
||||
- switchInt((*_2)[3 of 4]) -> [47_u8: bb11, otherwise: bb6]; // scope 0 at $DIR/deduplicate_blocks.rs:+1:5: +1:23
|
||||
+ switchInt((*_2)[3 of 4]) -> [47_u8: bb10, otherwise: bb6]; // scope 0 at $DIR/deduplicate_blocks.rs:+1:5: +1:23
|
||||
- switchInt((*_2)[3 of 4]) -> [47: bb11, otherwise: bb6]; // scope 0 at $DIR/deduplicate_blocks.rs:+1:5: +1:23
|
||||
+ switchInt((*_2)[3 of 4]) -> [47: bb10, otherwise: bb6]; // scope 0 at $DIR/deduplicate_blocks.rs:+1:5: +1:23
|
||||
}
|
||||
|
||||
bb6: {
|
||||
_4 = Len((*_2)); // scope 0 at $DIR/deduplicate_blocks.rs:+3:9: +3:31
|
||||
_5 = const 3_usize; // scope 0 at $DIR/deduplicate_blocks.rs:+3:9: +3:31
|
||||
_6 = Ge(move _4, move _5); // scope 0 at $DIR/deduplicate_blocks.rs:+3:9: +3:31
|
||||
switchInt(move _6) -> [false: bb10, otherwise: bb7]; // scope 0 at $DIR/deduplicate_blocks.rs:+3:9: +3:31
|
||||
switchInt(move _6) -> [0: bb10, otherwise: bb7]; // scope 0 at $DIR/deduplicate_blocks.rs:+3:9: +3:31
|
||||
}
|
||||
|
||||
bb7: {
|
||||
switchInt((*_2)[0 of 3]) -> [47_u8: bb8, otherwise: bb10]; // scope 0 at $DIR/deduplicate_blocks.rs:+1:5: +1:23
|
||||
switchInt((*_2)[0 of 3]) -> [47: bb8, otherwise: bb10]; // scope 0 at $DIR/deduplicate_blocks.rs:+1:5: +1:23
|
||||
}
|
||||
|
||||
bb8: {
|
||||
switchInt((*_2)[1 of 3]) -> [47_u8: bb9, otherwise: bb10]; // scope 0 at $DIR/deduplicate_blocks.rs:+1:5: +1:23
|
||||
switchInt((*_2)[1 of 3]) -> [47: bb9, otherwise: bb10]; // scope 0 at $DIR/deduplicate_blocks.rs:+1:5: +1:23
|
||||
}
|
||||
|
||||
bb9: {
|
||||
- switchInt((*_2)[2 of 3]) -> [47_u8: bb12, 33_u8: bb13, otherwise: bb10]; // scope 0 at $DIR/deduplicate_blocks.rs:+1:5: +1:23
|
||||
+ switchInt((*_2)[2 of 3]) -> [47_u8: bb11, 33_u8: bb11, otherwise: bb10]; // scope 0 at $DIR/deduplicate_blocks.rs:+1:5: +1:23
|
||||
- switchInt((*_2)[2 of 3]) -> [47: bb12, 33: bb13, otherwise: bb10]; // scope 0 at $DIR/deduplicate_blocks.rs:+1:5: +1:23
|
||||
+ switchInt((*_2)[2 of 3]) -> [47: bb11, 33: bb11, otherwise: bb10]; // scope 0 at $DIR/deduplicate_blocks.rs:+1:5: +1:23
|
||||
}
|
||||
|
||||
bb10: {
|
||||
|
@ -17,7 +17,7 @@ fn foo(_1: Option<String>) -> i32 {
|
||||
_7 = const false; // scope 0 at $DIR/string.rs:+1:11: +1:12
|
||||
_7 = const true; // scope 0 at $DIR/string.rs:+1:11: +1:12
|
||||
_5 = discriminant(_1); // scope 0 at $DIR/string.rs:+1:11: +1:12
|
||||
switchInt(move _5) -> [1_isize: bb2, otherwise: bb1]; // scope 0 at $DIR/string.rs:+1:5: +1:12
|
||||
switchInt(move _5) -> [1: bb2, otherwise: bb1]; // scope 0 at $DIR/string.rs:+1:5: +1:12
|
||||
}
|
||||
|
||||
bb1: {
|
||||
@ -47,7 +47,7 @@ fn foo(_1: Option<String>) -> i32 {
|
||||
}
|
||||
|
||||
bb4: {
|
||||
switchInt(move _4) -> [false: bb1, otherwise: bb5]; // scope 0 at $DIR/string.rs:+2:14: +2:17
|
||||
switchInt(move _4) -> [0: bb1, otherwise: bb5]; // scope 0 at $DIR/string.rs:+2:14: +2:17
|
||||
}
|
||||
|
||||
bb5: {
|
||||
@ -69,6 +69,6 @@ fn foo(_1: Option<String>) -> i32 {
|
||||
}
|
||||
|
||||
bb9: {
|
||||
switchInt(_7) -> [false: bb7, otherwise: bb8]; // scope 0 at $DIR/string.rs:+5:1: +5:2
|
||||
switchInt(_7) -> [0: bb7, otherwise: bb8]; // scope 0 at $DIR/string.rs:+5:1: +5:2
|
||||
}
|
||||
}
|
||||
|
@ -62,7 +62,7 @@
|
||||
bb3: {
|
||||
StorageDead(_8); // scope 1 at $DIR/derefer_complex_case.rs:+1:25: +1:26
|
||||
_10 = discriminant(_7); // scope 1 at $DIR/derefer_complex_case.rs:+1:17: +1:26
|
||||
switchInt(move _10) -> [0_isize: bb6, 1_isize: bb4, otherwise: bb5]; // scope 1 at $DIR/derefer_complex_case.rs:+1:17: +1:26
|
||||
switchInt(move _10) -> [0: bb6, 1: bb4, otherwise: bb5]; // scope 1 at $DIR/derefer_complex_case.rs:+1:17: +1:26
|
||||
}
|
||||
|
||||
bb4: {
|
||||
|
@ -54,11 +54,11 @@
|
||||
_6 = &_7; // scope 2 at $DIR/derefer_terminator_test.rs:+3:18: +3:21
|
||||
_5 = &_6; // scope 2 at $DIR/derefer_terminator_test.rs:+3:17: +3:21
|
||||
_4 = &_5; // scope 2 at $DIR/derefer_terminator_test.rs:+3:15: +3:22
|
||||
- switchInt((*(*(*(*_4))))) -> [false: bb3, otherwise: bb4]; // scope 2 at $DIR/derefer_terminator_test.rs:+3:5: +3:22
|
||||
- switchInt((*(*(*(*_4))))) -> [0: bb3, otherwise: bb4]; // scope 2 at $DIR/derefer_terminator_test.rs:+3:5: +3:22
|
||||
+ _10 = deref_copy (*_4); // scope 2 at $DIR/derefer_terminator_test.rs:+3:5: +3:22
|
||||
+ _11 = deref_copy (*_10); // scope 2 at $DIR/derefer_terminator_test.rs:+3:5: +3:22
|
||||
+ _12 = deref_copy (*_11); // scope 2 at $DIR/derefer_terminator_test.rs:+3:5: +3:22
|
||||
+ switchInt((*_12)) -> [false: bb3, otherwise: bb4]; // scope 2 at $DIR/derefer_terminator_test.rs:+3:5: +3:22
|
||||
+ switchInt((*_12)) -> [0: bb3, otherwise: bb4]; // scope 2 at $DIR/derefer_terminator_test.rs:+3:5: +3:22
|
||||
}
|
||||
|
||||
bb3: {
|
||||
|
@ -37,7 +37,7 @@
|
||||
}
|
||||
|
||||
bb2: {
|
||||
switchInt(move _3) -> [false: bb4, otherwise: bb3]; // scope 1 at $DIR/branch.rs:+3:16: +3:22
|
||||
switchInt(move _3) -> [0: bb4, otherwise: bb3]; // scope 1 at $DIR/branch.rs:+3:16: +3:22
|
||||
}
|
||||
|
||||
bb3: {
|
||||
|
@ -31,13 +31,13 @@
|
||||
StorageDead(_5); // scope 0 at $DIR/early_otherwise_branch.rs:+1:16: +1:17
|
||||
StorageDead(_4); // scope 0 at $DIR/early_otherwise_branch.rs:+1:16: +1:17
|
||||
_7 = discriminant((_3.0: std::option::Option<u32>)); // scope 0 at $DIR/early_otherwise_branch.rs:+1:11: +1:17
|
||||
- switchInt(move _7) -> [1_isize: bb2, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch.rs:+1:5: +1:17
|
||||
- switchInt(move _7) -> [1: bb2, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch.rs:+1:5: +1:17
|
||||
+ StorageLive(_10); // scope 0 at $DIR/early_otherwise_branch.rs:+1:5: +1:17
|
||||
+ _10 = discriminant((_3.1: std::option::Option<u32>)); // scope 0 at $DIR/early_otherwise_branch.rs:+1:5: +1:17
|
||||
+ StorageLive(_11); // scope 0 at $DIR/early_otherwise_branch.rs:+1:5: +1:17
|
||||
+ _11 = Ne(_7, move _10); // scope 0 at $DIR/early_otherwise_branch.rs:+1:5: +1:17
|
||||
+ StorageDead(_10); // scope 0 at $DIR/early_otherwise_branch.rs:+1:5: +1:17
|
||||
+ switchInt(move _11) -> [false: bb4, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch.rs:+1:5: +1:17
|
||||
+ switchInt(move _11) -> [0: bb4, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch.rs:+1:5: +1:17
|
||||
}
|
||||
|
||||
bb1: {
|
||||
@ -49,7 +49,7 @@
|
||||
|
||||
bb2: {
|
||||
- _6 = discriminant((_3.1: std::option::Option<u32>)); // scope 0 at $DIR/early_otherwise_branch.rs:+1:11: +1:17
|
||||
- switchInt(move _6) -> [1_isize: bb3, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch.rs:+1:5: +1:17
|
||||
- switchInt(move _6) -> [1: bb3, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch.rs:+1:5: +1:17
|
||||
- }
|
||||
-
|
||||
- bb3: {
|
||||
@ -72,7 +72,7 @@
|
||||
+
|
||||
+ bb4: {
|
||||
+ StorageDead(_11); // scope 0 at $DIR/early_otherwise_branch.rs:+1:5: +1:17
|
||||
+ switchInt(_7) -> [1_isize: bb2, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch.rs:+1:5: +1:17
|
||||
+ switchInt(_7) -> [1: bb2, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch.rs:+1:5: +1:17
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -32,18 +32,18 @@
|
||||
StorageDead(_5); // scope 0 at $DIR/early_otherwise_branch.rs:+1:16: +1:17
|
||||
StorageDead(_4); // scope 0 at $DIR/early_otherwise_branch.rs:+1:16: +1:17
|
||||
_8 = discriminant((_3.0: std::option::Option<u32>)); // scope 0 at $DIR/early_otherwise_branch.rs:+1:11: +1:17
|
||||
- switchInt(move _8) -> [0_isize: bb1, 1_isize: bb3, otherwise: bb2]; // scope 0 at $DIR/early_otherwise_branch.rs:+1:5: +1:17
|
||||
- switchInt(move _8) -> [0: bb1, 1: bb3, otherwise: bb2]; // scope 0 at $DIR/early_otherwise_branch.rs:+1:5: +1:17
|
||||
+ StorageLive(_11); // scope 0 at $DIR/early_otherwise_branch.rs:+1:5: +1:17
|
||||
+ _11 = discriminant((_3.1: std::option::Option<u32>)); // scope 0 at $DIR/early_otherwise_branch.rs:+1:5: +1:17
|
||||
+ StorageLive(_12); // scope 0 at $DIR/early_otherwise_branch.rs:+1:5: +1:17
|
||||
+ _12 = Ne(_8, move _11); // scope 0 at $DIR/early_otherwise_branch.rs:+1:5: +1:17
|
||||
+ StorageDead(_11); // scope 0 at $DIR/early_otherwise_branch.rs:+1:5: +1:17
|
||||
+ switchInt(move _12) -> [false: bb5, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch.rs:+1:5: +1:17
|
||||
+ switchInt(move _12) -> [0: bb5, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch.rs:+1:5: +1:17
|
||||
}
|
||||
|
||||
bb1: {
|
||||
- _6 = discriminant((_3.1: std::option::Option<u32>)); // scope 0 at $DIR/early_otherwise_branch.rs:+1:11: +1:17
|
||||
- switchInt(move _6) -> [0_isize: bb5, otherwise: bb2]; // scope 0 at $DIR/early_otherwise_branch.rs:+1:5: +1:17
|
||||
- switchInt(move _6) -> [0: bb5, otherwise: bb2]; // scope 0 at $DIR/early_otherwise_branch.rs:+1:5: +1:17
|
||||
- }
|
||||
-
|
||||
- bb2: {
|
||||
@ -55,7 +55,7 @@
|
||||
|
||||
- bb3: {
|
||||
- _7 = discriminant((_3.1: std::option::Option<u32>)); // scope 0 at $DIR/early_otherwise_branch.rs:+1:11: +1:17
|
||||
- switchInt(move _7) -> [1_isize: bb4, otherwise: bb2]; // scope 0 at $DIR/early_otherwise_branch.rs:+1:5: +1:17
|
||||
- switchInt(move _7) -> [1: bb4, otherwise: bb2]; // scope 0 at $DIR/early_otherwise_branch.rs:+1:5: +1:17
|
||||
- }
|
||||
-
|
||||
- bb4: {
|
||||
@ -86,7 +86,7 @@
|
||||
+
|
||||
+ bb5: {
|
||||
+ StorageDead(_12); // scope 0 at $DIR/early_otherwise_branch.rs:+1:5: +1:17
|
||||
+ switchInt(_8) -> [0_isize: bb3, 1_isize: bb2, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch.rs:+1:5: +1:17
|
||||
+ switchInt(_8) -> [0: bb3, 1: bb2, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch.rs:+1:5: +1:17
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -31,13 +31,13 @@
|
||||
StorageDead(_5); // scope 0 at $DIR/early_otherwise_branch.rs:+1:16: +1:17
|
||||
StorageDead(_4); // scope 0 at $DIR/early_otherwise_branch.rs:+1:16: +1:17
|
||||
_7 = discriminant((_3.0: std::option::Option<u32>)); // scope 0 at $DIR/early_otherwise_branch.rs:+1:11: +1:17
|
||||
- switchInt(move _7) -> [1_isize: bb2, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch.rs:+1:5: +1:17
|
||||
- switchInt(move _7) -> [1: bb2, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch.rs:+1:5: +1:17
|
||||
+ StorageLive(_10); // scope 0 at $DIR/early_otherwise_branch.rs:+1:5: +1:17
|
||||
+ _10 = discriminant((_3.1: std::option::Option<bool>)); // scope 0 at $DIR/early_otherwise_branch.rs:+1:5: +1:17
|
||||
+ StorageLive(_11); // scope 0 at $DIR/early_otherwise_branch.rs:+1:5: +1:17
|
||||
+ _11 = Ne(_7, move _10); // scope 0 at $DIR/early_otherwise_branch.rs:+1:5: +1:17
|
||||
+ StorageDead(_10); // scope 0 at $DIR/early_otherwise_branch.rs:+1:5: +1:17
|
||||
+ switchInt(move _11) -> [false: bb4, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch.rs:+1:5: +1:17
|
||||
+ switchInt(move _11) -> [0: bb4, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch.rs:+1:5: +1:17
|
||||
}
|
||||
|
||||
bb1: {
|
||||
@ -49,7 +49,7 @@
|
||||
|
||||
bb2: {
|
||||
- _6 = discriminant((_3.1: std::option::Option<bool>)); // scope 0 at $DIR/early_otherwise_branch.rs:+1:11: +1:17
|
||||
- switchInt(move _6) -> [1_isize: bb3, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch.rs:+1:5: +1:17
|
||||
- switchInt(move _6) -> [1: bb3, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch.rs:+1:5: +1:17
|
||||
- }
|
||||
-
|
||||
- bb3: {
|
||||
@ -72,7 +72,7 @@
|
||||
+
|
||||
+ bb4: {
|
||||
+ StorageDead(_11); // scope 0 at $DIR/early_otherwise_branch.rs:+1:5: +1:17
|
||||
+ switchInt(_7) -> [1_isize: bb2, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch.rs:+1:5: +1:17
|
||||
+ switchInt(_7) -> [1: bb2, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch.rs:+1:5: +1:17
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -42,13 +42,13 @@
|
||||
StorageDead(_6); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:+1:19: +1:20
|
||||
StorageDead(_5); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:+1:19: +1:20
|
||||
_10 = discriminant((_4.0: std::option::Option<u32>)); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:+1:11: +1:20
|
||||
- switchInt(move _10) -> [1_isize: bb2, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:+1:5: +1:20
|
||||
- switchInt(move _10) -> [1: bb2, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:+1:5: +1:20
|
||||
+ StorageLive(_14); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:+1:5: +1:20
|
||||
+ _14 = discriminant((_4.1: std::option::Option<u32>)); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:+1:5: +1:20
|
||||
+ StorageLive(_15); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:+1:5: +1:20
|
||||
+ _15 = Ne(_10, move _14); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:+1:5: +1:20
|
||||
+ StorageDead(_14); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:+1:5: +1:20
|
||||
+ switchInt(move _15) -> [false: bb5, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:+1:5: +1:20
|
||||
+ switchInt(move _15) -> [0: bb5, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:+1:5: +1:20
|
||||
}
|
||||
|
||||
bb1: {
|
||||
@ -61,13 +61,13 @@
|
||||
|
||||
bb2: {
|
||||
- _9 = discriminant((_4.1: std::option::Option<u32>)); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:+1:11: +1:20
|
||||
- switchInt(move _9) -> [1_isize: bb3, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:+1:5: +1:20
|
||||
- switchInt(move _9) -> [1: bb3, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:+1:5: +1:20
|
||||
- }
|
||||
-
|
||||
- bb3: {
|
||||
_8 = discriminant((_4.2: std::option::Option<u32>)); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:+1:11: +1:20
|
||||
- switchInt(move _8) -> [1_isize: bb4, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:+1:5: +1:20
|
||||
+ switchInt(move _8) -> [1_isize: bb3, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:+1:5: +1:20
|
||||
- switchInt(move _8) -> [1: bb4, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:+1:5: +1:20
|
||||
+ switchInt(move _8) -> [1: bb3, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:+1:5: +1:20
|
||||
}
|
||||
|
||||
- bb4: {
|
||||
@ -94,7 +94,7 @@
|
||||
+
|
||||
+ bb5: {
|
||||
+ StorageDead(_15); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:+1:5: +1:20
|
||||
+ switchInt(_10) -> [1_isize: bb2, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:+1:5: +1:20
|
||||
+ switchInt(_10) -> [1: bb2, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:+1:5: +1:20
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -80,13 +80,13 @@
|
||||
StorageDead(_5); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:23: +5:24
|
||||
_34 = deref_copy (_4.0: &ViewportPercentageLength); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:14: +5:24
|
||||
_11 = discriminant((*_34)); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:14: +5:24
|
||||
switchInt(move _11) -> [0_isize: bb1, 1_isize: bb3, 2_isize: bb4, 3_isize: bb5, otherwise: bb2]; // scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:8: +5:24
|
||||
switchInt(move _11) -> [0: bb1, 1: bb3, 2: bb4, 3: bb5, otherwise: bb2]; // scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:8: +5:24
|
||||
}
|
||||
|
||||
bb1: {
|
||||
_35 = deref_copy (_4.1: &ViewportPercentageLength); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:14: +5:24
|
||||
_7 = discriminant((*_35)); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:14: +5:24
|
||||
switchInt(move _7) -> [0_isize: bb6, otherwise: bb2]; // scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:8: +5:24
|
||||
switchInt(move _7) -> [0: bb6, otherwise: bb2]; // scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:8: +5:24
|
||||
}
|
||||
|
||||
bb2: {
|
||||
@ -104,19 +104,19 @@
|
||||
bb3: {
|
||||
_36 = deref_copy (_4.1: &ViewportPercentageLength); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:14: +5:24
|
||||
_8 = discriminant((*_36)); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:14: +5:24
|
||||
switchInt(move _8) -> [1_isize: bb7, otherwise: bb2]; // scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:8: +5:24
|
||||
switchInt(move _8) -> [1: bb7, otherwise: bb2]; // scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:8: +5:24
|
||||
}
|
||||
|
||||
bb4: {
|
||||
_37 = deref_copy (_4.1: &ViewportPercentageLength); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:14: +5:24
|
||||
_9 = discriminant((*_37)); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:14: +5:24
|
||||
switchInt(move _9) -> [2_isize: bb8, otherwise: bb2]; // scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:8: +5:24
|
||||
switchInt(move _9) -> [2: bb8, otherwise: bb2]; // scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:8: +5:24
|
||||
}
|
||||
|
||||
bb5: {
|
||||
_38 = deref_copy (_4.1: &ViewportPercentageLength); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:14: +5:24
|
||||
_10 = discriminant((*_38)); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:14: +5:24
|
||||
switchInt(move _10) -> [3_isize: bb9, otherwise: bb2]; // scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:8: +5:24
|
||||
switchInt(move _10) -> [3: bb9, otherwise: bb2]; // scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:8: +5:24
|
||||
}
|
||||
|
||||
bb6: {
|
||||
|
@ -38,12 +38,12 @@
|
||||
StorageDead(_5); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:+1:16: +1:17
|
||||
StorageDead(_4); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:+1:16: +1:17
|
||||
_8 = discriminant((_3.0: std::option::Option<u32>)); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:+1:11: +1:17
|
||||
switchInt(move _8) -> [0_isize: bb1, 1_isize: bb4, otherwise: bb3]; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:+1:5: +1:17
|
||||
switchInt(move _8) -> [0: bb1, 1: bb4, otherwise: bb3]; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:+1:5: +1:17
|
||||
}
|
||||
|
||||
bb1: {
|
||||
_6 = discriminant((_3.1: std::option::Option<u32>)); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:+1:11: +1:17
|
||||
switchInt(move _6) -> [0_isize: bb2, 1_isize: bb7, otherwise: bb3]; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:+1:5: +1:17
|
||||
switchInt(move _6) -> [0: bb2, 1: bb7, otherwise: bb3]; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:+1:5: +1:17
|
||||
}
|
||||
|
||||
bb2: {
|
||||
@ -57,7 +57,7 @@
|
||||
|
||||
bb4: {
|
||||
_7 = discriminant((_3.1: std::option::Option<u32>)); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:+1:11: +1:17
|
||||
switchInt(move _7) -> [0_isize: bb6, 1_isize: bb5, otherwise: bb3]; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:+1:5: +1:17
|
||||
switchInt(move _7) -> [0: bb6, 1: bb5, otherwise: bb3]; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:+1:5: +1:17
|
||||
}
|
||||
|
||||
bb5: {
|
||||
|
@ -14,7 +14,7 @@
|
||||
|
||||
bb0: {
|
||||
_3 = discriminant(_1); // scope 0 at $DIR/early_otherwise_branch_soundness.rs:+1:11: +1:12
|
||||
switchInt(move _3) -> [1_isize: bb2, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch_soundness.rs:+1:5: +1:12
|
||||
switchInt(move _3) -> [1: bb2, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch_soundness.rs:+1:5: +1:12
|
||||
}
|
||||
|
||||
bb1: {
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
bb2: {
|
||||
_4 = discriminant((*_2)); // scope 0 at $DIR/early_otherwise_branch_soundness.rs:+3:26: +3:28
|
||||
switchInt(move _4) -> [1_isize: bb4, otherwise: bb3]; // scope 0 at $DIR/early_otherwise_branch_soundness.rs:+3:20: +3:28
|
||||
switchInt(move _4) -> [1: bb4, otherwise: bb3]; // scope 0 at $DIR/early_otherwise_branch_soundness.rs:+3:20: +3:28
|
||||
}
|
||||
|
||||
bb3: {
|
||||
|
@ -12,13 +12,13 @@
|
||||
|
||||
bb0: {
|
||||
_3 = discriminant((*_1)); // scope 1 at $DIR/early_otherwise_branch_soundness.rs:+1:12: +1:31
|
||||
switchInt(move _3) -> [1_isize: bb1, otherwise: bb3]; // scope 1 at $DIR/early_otherwise_branch_soundness.rs:+1:12: +1:31
|
||||
switchInt(move _3) -> [1: bb1, otherwise: bb3]; // scope 1 at $DIR/early_otherwise_branch_soundness.rs:+1:12: +1:31
|
||||
}
|
||||
|
||||
bb1: {
|
||||
_4 = deref_copy (((*_1) as Some).0: &E<'_>); // scope 1 at $DIR/early_otherwise_branch_soundness.rs:+1:12: +1:31
|
||||
_2 = discriminant((*_4)); // scope 1 at $DIR/early_otherwise_branch_soundness.rs:+1:12: +1:31
|
||||
switchInt(move _2) -> [1_isize: bb2, otherwise: bb3]; // scope 1 at $DIR/early_otherwise_branch_soundness.rs:+1:12: +1:31
|
||||
switchInt(move _2) -> [1: bb2, otherwise: bb3]; // scope 1 at $DIR/early_otherwise_branch_soundness.rs:+1:12: +1:31
|
||||
}
|
||||
|
||||
bb2: {
|
||||
|
@ -14,7 +14,7 @@
|
||||
- _2 = Eq(move _3, const true); // scope 0 at $DIR/equal_true.rs:+1:8: +1:17
|
||||
+ _2 = move _3; // scope 0 at $DIR/equal_true.rs:+1:8: +1:17
|
||||
StorageDead(_3); // scope 0 at $DIR/equal_true.rs:+1:16: +1:17
|
||||
switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/equal_true.rs:+1:8: +1:17
|
||||
switchInt(move _2) -> [0: bb2, otherwise: bb1]; // scope 0 at $DIR/equal_true.rs:+1:8: +1:17
|
||||
}
|
||||
|
||||
bb1: {
|
||||
|
@ -19,7 +19,7 @@ fn match_tuple(_1: (u32, bool, Option<i32>, u32)) -> u32 {
|
||||
|
||||
bb0: {
|
||||
FakeRead(ForMatchedPlace(None), _1); // scope 0 at $DIR/exponential_or.rs:+1:11: +1:12
|
||||
switchInt((_1.0: u32)) -> [1_u32: bb2, 4_u32: bb2, otherwise: bb1]; // scope 0 at $DIR/exponential_or.rs:+2:15: +2:20
|
||||
switchInt((_1.0: u32)) -> [1: bb2, 4: bb2, otherwise: bb1]; // scope 0 at $DIR/exponential_or.rs:+2:15: +2:20
|
||||
}
|
||||
|
||||
bb1: {
|
||||
@ -29,31 +29,31 @@ fn match_tuple(_1: (u32, bool, Option<i32>, u32)) -> u32 {
|
||||
|
||||
bb2: {
|
||||
_2 = discriminant((_1.2: std::option::Option<i32>)); // scope 0 at $DIR/exponential_or.rs:+2:37: +2:55
|
||||
switchInt(move _2) -> [0_isize: bb4, 1_isize: bb3, otherwise: bb1]; // scope 0 at $DIR/exponential_or.rs:+2:37: +2:55
|
||||
switchInt(move _2) -> [0: bb4, 1: bb3, otherwise: bb1]; // scope 0 at $DIR/exponential_or.rs:+2:37: +2:55
|
||||
}
|
||||
|
||||
bb3: {
|
||||
switchInt((((_1.2: std::option::Option<i32>) as Some).0: i32)) -> [1_i32: bb4, 8_i32: bb4, otherwise: bb1]; // scope 0 at $DIR/exponential_or.rs:+2:37: +2:55
|
||||
switchInt((((_1.2: std::option::Option<i32>) as Some).0: i32)) -> [1: bb4, 8: bb4, otherwise: bb1]; // scope 0 at $DIR/exponential_or.rs:+2:37: +2:55
|
||||
}
|
||||
|
||||
bb4: {
|
||||
_5 = Le(const 6_u32, (_1.3: u32)); // scope 0 at $DIR/exponential_or.rs:+2:62: +2:67
|
||||
switchInt(move _5) -> [false: bb6, otherwise: bb5]; // scope 0 at $DIR/exponential_or.rs:+2:62: +2:67
|
||||
switchInt(move _5) -> [0: bb6, otherwise: bb5]; // scope 0 at $DIR/exponential_or.rs:+2:62: +2:67
|
||||
}
|
||||
|
||||
bb5: {
|
||||
_6 = Le((_1.3: u32), const 9_u32); // scope 0 at $DIR/exponential_or.rs:+2:62: +2:67
|
||||
switchInt(move _6) -> [false: bb6, otherwise: bb8]; // scope 0 at $DIR/exponential_or.rs:+2:62: +2:67
|
||||
switchInt(move _6) -> [0: bb6, otherwise: bb8]; // scope 0 at $DIR/exponential_or.rs:+2:62: +2:67
|
||||
}
|
||||
|
||||
bb6: {
|
||||
_3 = Le(const 13_u32, (_1.3: u32)); // scope 0 at $DIR/exponential_or.rs:+2:70: +2:77
|
||||
switchInt(move _3) -> [false: bb1, otherwise: bb7]; // scope 0 at $DIR/exponential_or.rs:+2:70: +2:77
|
||||
switchInt(move _3) -> [0: bb1, otherwise: bb7]; // scope 0 at $DIR/exponential_or.rs:+2:70: +2:77
|
||||
}
|
||||
|
||||
bb7: {
|
||||
_4 = Le((_1.3: u32), const 16_u32); // scope 0 at $DIR/exponential_or.rs:+2:70: +2:77
|
||||
switchInt(move _4) -> [false: bb1, otherwise: bb8]; // scope 0 at $DIR/exponential_or.rs:+2:70: +2:77
|
||||
switchInt(move _4) -> [0: bb1, otherwise: bb8]; // scope 0 at $DIR/exponential_or.rs:+2:70: +2:77
|
||||
}
|
||||
|
||||
bb8: {
|
||||
|
@ -47,7 +47,7 @@
|
||||
bb1: {
|
||||
StorageDead(_5); // scope 0 at $DIR/funky_arms.rs:+4:36: +4:37
|
||||
StorageLive(_6); // scope 1 at $DIR/funky_arms.rs:+8:9: +8:13
|
||||
switchInt(_4) -> [false: bb3, otherwise: bb2]; // scope 1 at $DIR/funky_arms.rs:+8:16: +8:32
|
||||
switchInt(_4) -> [0: bb3, otherwise: bb2]; // scope 1 at $DIR/funky_arms.rs:+8:16: +8:32
|
||||
}
|
||||
|
||||
bb2: {
|
||||
@ -75,7 +75,7 @@
|
||||
bb5: {
|
||||
StorageDead(_8); // scope 3 at $DIR/funky_arms.rs:+13:44: +13:45
|
||||
_9 = discriminant(_7); // scope 3 at $DIR/funky_arms.rs:+13:12: +13:27
|
||||
switchInt(move _9) -> [1_isize: bb6, otherwise: bb8]; // scope 3 at $DIR/funky_arms.rs:+13:12: +13:27
|
||||
switchInt(move _9) -> [1: bb6, otherwise: bb8]; // scope 3 at $DIR/funky_arms.rs:+13:12: +13:27
|
||||
}
|
||||
|
||||
bb6: {
|
||||
|
@ -29,7 +29,7 @@ fn main::{closure#0}(_1: *mut [generator@$DIR/generator_drop_cleanup.rs:10:15: 1
|
||||
|
||||
bb0: {
|
||||
_8 = discriminant((*_1)); // scope 0 at $DIR/generator_drop_cleanup.rs:+0:15: +3:6
|
||||
switchInt(move _8) -> [0_u32: bb7, 3_u32: bb10, otherwise: bb11]; // scope 0 at $DIR/generator_drop_cleanup.rs:+0:15: +3:6
|
||||
switchInt(move _8) -> [0: bb7, 3: bb10, otherwise: bb11]; // scope 0 at $DIR/generator_drop_cleanup.rs:+0:15: +3:6
|
||||
}
|
||||
|
||||
bb1: {
|
||||
|
@ -32,7 +32,7 @@ fn main::{closure#0}(_1: Pin<&mut [generator@$DIR/generator_tiny.rs:19:16: 19:24
|
||||
|
||||
bb0: {
|
||||
_11 = discriminant((*(_1.0: &mut [generator@$DIR/generator_tiny.rs:19:16: 19:24]))); // scope 0 at $DIR/generator_tiny.rs:+0:16: +6:6
|
||||
switchInt(move _11) -> [0_u32: bb1, 3_u32: bb5, otherwise: bb6]; // scope 0 at $DIR/generator_tiny.rs:+0:16: +6:6
|
||||
switchInt(move _11) -> [0: bb1, 3: bb5, otherwise: bb6]; // scope 0 at $DIR/generator_tiny.rs:+0:16: +6:6
|
||||
}
|
||||
|
||||
bb1: {
|
||||
|
@ -9,7 +9,7 @@
|
||||
bb0: {
|
||||
StorageLive(_2); // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:9
|
||||
_2 = _1; // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:9
|
||||
switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:9
|
||||
switchInt(move _2) -> [0: bb2, otherwise: bb1]; // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:9
|
||||
}
|
||||
|
||||
bb1: {
|
||||
|
@ -13,7 +13,7 @@
|
||||
_3 = _1; // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:9
|
||||
_2 = Eq(move _3, const -42f32); // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:18
|
||||
StorageDead(_3); // scope 0 at $DIR/if_condition_int.rs:+1:17: +1:18
|
||||
switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:18
|
||||
switchInt(move _2) -> [0: bb2, otherwise: bb1]; // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:18
|
||||
}
|
||||
|
||||
bb1: {
|
||||
|
@ -20,10 +20,10 @@
|
||||
_3 = _1; // scope 0 at $DIR/if_condition_int.rs:+1:13: +1:14
|
||||
- _2 = Eq(move _3, const 17_i8); // scope 0 at $DIR/if_condition_int.rs:+1:13: +1:20
|
||||
- StorageDead(_3); // scope 0 at $DIR/if_condition_int.rs:+1:19: +1:20
|
||||
- switchInt(_2) -> [false: bb2, otherwise: bb1]; // scope 1 at $DIR/if_condition_int.rs:+2:5: +2:12
|
||||
- switchInt(_2) -> [0: bb2, otherwise: bb1]; // scope 1 at $DIR/if_condition_int.rs:+2:5: +2:12
|
||||
+ _2 = Eq(_3, const 17_i8); // scope 0 at $DIR/if_condition_int.rs:+1:13: +1:20
|
||||
+ nop; // scope 0 at $DIR/if_condition_int.rs:+1:19: +1:20
|
||||
+ switchInt(move _3) -> [17_i8: bb1, otherwise: bb2]; // scope 1 at $DIR/if_condition_int.rs:+2:5: +2:12
|
||||
+ switchInt(move _3) -> [17: bb1, otherwise: bb2]; // scope 1 at $DIR/if_condition_int.rs:+2:5: +2:12
|
||||
}
|
||||
|
||||
bb1: {
|
||||
|
@ -13,10 +13,10 @@
|
||||
_3 = _1; // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:9
|
||||
- _2 = Eq(move _3, const 'x'); // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:16
|
||||
- StorageDead(_3); // scope 0 at $DIR/if_condition_int.rs:+1:15: +1:16
|
||||
- switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:16
|
||||
- switchInt(move _2) -> [0: bb2, otherwise: bb1]; // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:16
|
||||
+ nop; // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:16
|
||||
+ nop; // scope 0 at $DIR/if_condition_int.rs:+1:15: +1:16
|
||||
+ switchInt(move _3) -> ['x': bb1, otherwise: bb2]; // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:16
|
||||
+ switchInt(move _3) -> [120: bb1, otherwise: bb2]; // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:16
|
||||
}
|
||||
|
||||
bb1: {
|
||||
|
@ -13,10 +13,10 @@
|
||||
_3 = _1; // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:9
|
||||
- _2 = Eq(move _3, const 42_i8); // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:15
|
||||
- StorageDead(_3); // scope 0 at $DIR/if_condition_int.rs:+1:14: +1:15
|
||||
- switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:15
|
||||
- switchInt(move _2) -> [0: bb2, otherwise: bb1]; // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:15
|
||||
+ nop; // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:15
|
||||
+ nop; // scope 0 at $DIR/if_condition_int.rs:+1:14: +1:15
|
||||
+ switchInt(move _3) -> [42_i8: bb1, otherwise: bb2]; // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:15
|
||||
+ switchInt(move _3) -> [42: bb1, otherwise: bb2]; // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:15
|
||||
}
|
||||
|
||||
bb1: {
|
||||
|
@ -15,10 +15,10 @@
|
||||
_3 = _1; // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:9
|
||||
- _2 = Eq(move _3, const 42_u32); // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:15
|
||||
- StorageDead(_3); // scope 0 at $DIR/if_condition_int.rs:+1:14: +1:15
|
||||
- switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:15
|
||||
- switchInt(move _2) -> [0: bb2, otherwise: bb1]; // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:15
|
||||
+ nop; // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:15
|
||||
+ nop; // scope 0 at $DIR/if_condition_int.rs:+1:14: +1:15
|
||||
+ switchInt(move _3) -> [42_u32: bb1, otherwise: bb2]; // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:15
|
||||
+ switchInt(move _3) -> [42: bb1, otherwise: bb2]; // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:15
|
||||
}
|
||||
|
||||
bb1: {
|
||||
@ -34,10 +34,10 @@
|
||||
_5 = _1; // scope 0 at $DIR/if_condition_int.rs:+3:15: +3:16
|
||||
- _4 = Ne(move _5, const 21_u32); // scope 0 at $DIR/if_condition_int.rs:+3:15: +3:22
|
||||
- StorageDead(_5); // scope 0 at $DIR/if_condition_int.rs:+3:21: +3:22
|
||||
- switchInt(move _4) -> [false: bb4, otherwise: bb3]; // scope 0 at $DIR/if_condition_int.rs:+3:15: +3:22
|
||||
- switchInt(move _4) -> [0: bb4, otherwise: bb3]; // scope 0 at $DIR/if_condition_int.rs:+3:15: +3:22
|
||||
+ nop; // scope 0 at $DIR/if_condition_int.rs:+3:15: +3:22
|
||||
+ nop; // scope 0 at $DIR/if_condition_int.rs:+3:21: +3:22
|
||||
+ switchInt(move _5) -> [21_u32: bb4, otherwise: bb3]; // scope 0 at $DIR/if_condition_int.rs:+3:15: +3:22
|
||||
+ switchInt(move _5) -> [21: bb4, otherwise: bb3]; // scope 0 at $DIR/if_condition_int.rs:+3:15: +3:22
|
||||
}
|
||||
|
||||
bb3: {
|
||||
|
@ -13,10 +13,10 @@
|
||||
_3 = _1; // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:9
|
||||
- _2 = Eq(move _3, const -42_i32); // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:16
|
||||
- StorageDead(_3); // scope 0 at $DIR/if_condition_int.rs:+1:15: +1:16
|
||||
- switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:16
|
||||
- switchInt(move _2) -> [0: bb2, otherwise: bb1]; // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:16
|
||||
+ nop; // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:16
|
||||
+ nop; // scope 0 at $DIR/if_condition_int.rs:+1:15: +1:16
|
||||
+ switchInt(move _3) -> [-42_i32: bb1, otherwise: bb2]; // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:16
|
||||
+ switchInt(move _3) -> [4294967254: bb1, otherwise: bb2]; // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:16
|
||||
}
|
||||
|
||||
bb1: {
|
||||
|
@ -13,10 +13,10 @@
|
||||
_3 = _1; // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:9
|
||||
- _2 = Eq(move _3, const 42_u32); // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:15
|
||||
- StorageDead(_3); // scope 0 at $DIR/if_condition_int.rs:+1:14: +1:15
|
||||
- switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:15
|
||||
- switchInt(move _2) -> [0: bb2, otherwise: bb1]; // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:15
|
||||
+ nop; // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:15
|
||||
+ nop; // scope 0 at $DIR/if_condition_int.rs:+1:14: +1:15
|
||||
+ switchInt(move _3) -> [42_u32: bb1, otherwise: bb2]; // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:15
|
||||
+ switchInt(move _3) -> [42: bb1, otherwise: bb2]; // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:15
|
||||
}
|
||||
|
||||
bb1: {
|
||||
|
@ -19,7 +19,7 @@
|
||||
_3 = _1; // scope 0 at $DIR/inline_diverging.rs:+1:8: +1:9
|
||||
_2 = Gt(move _3, const 0_i32); // scope 0 at $DIR/inline_diverging.rs:+1:8: +1:13
|
||||
StorageDead(_3); // scope 0 at $DIR/inline_diverging.rs:+1:12: +1:13
|
||||
switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/inline_diverging.rs:+1:8: +1:13
|
||||
switchInt(move _2) -> [0: bb2, otherwise: bb1]; // scope 0 at $DIR/inline_diverging.rs:+1:8: +1:13
|
||||
}
|
||||
|
||||
bb1: {
|
||||
|
@ -72,7 +72,7 @@
|
||||
+ _7 = const false; // scope 0 at $DIR/inline_generator.rs:+1:14: +1:46
|
||||
+ _10 = deref_copy (_2.0: &mut [generator@$DIR/inline_generator.rs:15:5: 15:8]); // scope 6 at $DIR/inline_generator.rs:15:5: 15:41
|
||||
+ _9 = discriminant((*_10)); // scope 6 at $DIR/inline_generator.rs:15:5: 15:41
|
||||
+ switchInt(move _9) -> [0_u32: bb3, 1_u32: bb8, 3_u32: bb7, otherwise: bb9]; // scope 6 at $DIR/inline_generator.rs:15:5: 15:41
|
||||
+ switchInt(move _9) -> [0: bb3, 1: bb8, 3: bb7, otherwise: bb9]; // scope 6 at $DIR/inline_generator.rs:15:5: 15:41
|
||||
}
|
||||
|
||||
- bb3: {
|
||||
@ -92,7 +92,7 @@
|
||||
+
|
||||
+ bb3: {
|
||||
+ StorageLive(_8); // scope 6 at $DIR/inline_generator.rs:15:17: 15:39
|
||||
+ switchInt(move _7) -> [false: bb5, otherwise: bb4]; // scope 6 at $DIR/inline_generator.rs:15:20: 15:21
|
||||
+ switchInt(move _7) -> [0: bb5, otherwise: bb4]; // scope 6 at $DIR/inline_generator.rs:15:20: 15:21
|
||||
+ }
|
||||
+
|
||||
+ bb4: {
|
||||
|
@ -39,7 +39,7 @@
|
||||
+ StorageLive(_6); // scope 2 at $DIR/inline_shims.rs:+2:14: +2:40
|
||||
+ StorageLive(_7); // scope 2 at $DIR/inline_shims.rs:+2:14: +2:40
|
||||
+ _6 = discriminant((*_5)); // scope 3 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL
|
||||
+ switchInt(move _6) -> [0_isize: bb2, otherwise: bb3]; // scope 3 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL
|
||||
+ switchInt(move _6) -> [0: bb2, otherwise: bb3]; // scope 3 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL
|
||||
}
|
||||
|
||||
bb2: {
|
||||
|
@ -26,7 +26,7 @@
|
||||
}
|
||||
|
||||
bb3: {
|
||||
switchInt(move _2) -> [false: bb5, otherwise: bb4]; // scope 0 at /the/src/instrument_coverage.rs:+2:12: +2:17
|
||||
switchInt(move _2) -> [0: bb5, otherwise: bb4]; // scope 0 at /the/src/instrument_coverage.rs:+2:12: +2:17
|
||||
}
|
||||
|
||||
bb4: {
|
||||
|
@ -26,7 +26,7 @@ fn main() -> () {
|
||||
StorageLive(_3); // scope 1 at $DIR/issue_38669.rs:+3:9: +5:10
|
||||
StorageLive(_4); // scope 1 at $DIR/issue_38669.rs:+3:12: +3:24
|
||||
_4 = _1; // scope 1 at $DIR/issue_38669.rs:+3:12: +3:24
|
||||
switchInt(move _4) -> [false: bb4, otherwise: bb3]; // scope 1 at $DIR/issue_38669.rs:+3:12: +3:24
|
||||
switchInt(move _4) -> [0: bb4, otherwise: bb3]; // scope 1 at $DIR/issue_38669.rs:+3:12: +3:24
|
||||
}
|
||||
|
||||
bb3: {
|
||||
|
@ -65,6 +65,6 @@ fn main() -> () {
|
||||
}
|
||||
|
||||
bb8 (cleanup): {
|
||||
switchInt(_5) -> [false: bb6, otherwise: bb7]; // scope 0 at $DIR/issue_41110.rs:+1:27: +1:28
|
||||
switchInt(_5) -> [0: bb6, otherwise: bb7]; // scope 0 at $DIR/issue_41110.rs:+1:27: +1:28
|
||||
}
|
||||
}
|
||||
|
@ -96,6 +96,6 @@ fn test() -> () {
|
||||
}
|
||||
|
||||
bb14 (cleanup): {
|
||||
switchInt(_6) -> [false: bb10, otherwise: bb13]; // scope 0 at $DIR/issue_41110.rs:+5:1: +5:2
|
||||
switchInt(_6) -> [0: bb10, otherwise: bb13]; // scope 0 at $DIR/issue_41110.rs:+5:1: +5:2
|
||||
}
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user