diff --git a/compiler/rustc_ast_lowering/src/expr.rs b/compiler/rustc_ast_lowering/src/expr.rs index 2be2fca87c3c5..c6f24c1a19b48 100644 --- a/compiler/rustc_ast_lowering/src/expr.rs +++ b/compiler/rustc_ast_lowering/src/expr.rs @@ -1771,8 +1771,14 @@ impl<'hir> LoweringContext<'_, 'hir> { let pat = self.lower_pat(pat); let for_span = self.mark_span_with_reason(DesugaringKind::ForLoop, self.lower_span(e.span), None); - let head_span = self.mark_span_with_reason(DesugaringKind::ForLoop, head.span, None); - let pat_span = self.mark_span_with_reason(DesugaringKind::ForLoop, pat.span, None); + let for_ctxt = for_span.ctxt(); + + // Try to point both the head and pat spans to their position in the for loop + // rather than inside a macro. + let head_span = + head.span.find_ancestor_in_same_ctxt(e.span).unwrap_or(head.span).with_ctxt(for_ctxt); + let pat_span = + pat.span.find_ancestor_in_same_ctxt(e.span).unwrap_or(pat.span).with_ctxt(for_ctxt); let loop_hir_id = self.lower_node_id(e.id); let label = self.lower_label(opt_label, e.id, loop_hir_id); diff --git a/compiler/rustc_hir_typeck/src/method/suggest.rs b/compiler/rustc_hir_typeck/src/method/suggest.rs index 1b8ecdbee579d..86ed7a0a5a28a 100644 --- a/compiler/rustc_hir_typeck/src/method/suggest.rs +++ b/compiler/rustc_hir_typeck/src/method/suggest.rs @@ -1079,6 +1079,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { } self.note_derefed_ty_has_method(&mut err, source, rcvr_ty, item_ident, expected); + self.suggest_bounds_for_range_to_method(&mut err, source, item_ident); err.emit() } @@ -3260,6 +3261,71 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { } } + fn suggest_bounds_for_range_to_method( + &self, + err: &mut Diag<'_>, + source: SelfSource<'tcx>, + item_ident: Ident, + ) { + let SelfSource::MethodCall(rcvr_expr) = source else { return }; + let hir::ExprKind::Struct(qpath, fields, _) = rcvr_expr.kind else { return }; + let Some(lang_item) = self.tcx.qpath_lang_item(*qpath) else { + return; + }; + let is_inclusive = match lang_item { + hir::LangItem::RangeTo => false, + hir::LangItem::RangeToInclusive | hir::LangItem::RangeInclusiveCopy => true, + _ => return, + }; + + let Some(iterator_trait) = self.tcx.get_diagnostic_item(sym::Iterator) else { return }; + let Some(_) = self + .tcx + .associated_items(iterator_trait) + .filter_by_name_unhygienic(item_ident.name) + .next() + else { + return; + }; + + let source_map = self.tcx.sess.source_map(); + let range_type = if is_inclusive { "RangeInclusive" } else { "Range" }; + let Some(end_field) = fields.iter().find(|f| f.ident.name == rustc_span::sym::end) else { + return; + }; + + let element_ty = self.typeck_results.borrow().expr_ty_opt(end_field.expr); + let is_integral = element_ty.is_some_and(|ty| ty.is_integral()); + let end_is_negative = is_integral + && matches!(end_field.expr.kind, hir::ExprKind::Unary(rustc_ast::UnOp::Neg, _)); + + let Ok(snippet) = source_map.span_to_snippet(rcvr_expr.span) else { return }; + + let offset = snippet + .chars() + .take_while(|&c| c == '(' || c.is_whitespace()) + .map(|c| c.len_utf8()) + .sum::(); + + let insert_span = rcvr_expr + .span + .with_lo(rcvr_expr.span.lo() + rustc_span::BytePos(offset as u32)) + .shrink_to_lo(); + + let (value, appl) = if is_integral && !end_is_negative { + ("0", Applicability::MachineApplicable) + } else { + ("/* start */", Applicability::HasPlaceholders) + }; + + err.span_suggestion_verbose( + insert_span, + format!("consider using a bounded `{range_type}` by adding a concrete starting value"), + value, + appl, + ); + } + /// Print out the type for use in value namespace. fn ty_to_value_string(&self, ty: Ty<'tcx>) -> String { match ty.kind() { diff --git a/compiler/rustc_target/src/spec/mod.rs b/compiler/rustc_target/src/spec/mod.rs index 08fae288c441c..c4e0e1eddc08f 100644 --- a/compiler/rustc_target/src/spec/mod.rs +++ b/compiler/rustc_target/src/spec/mod.rs @@ -3198,15 +3198,7 @@ impl Target { return load_file(&p); } - // Leave in a specialized error message for the removed target. - // FIXME: If you see this and it's been a few months after this has been released, - // you can probably remove it. - if target_tuple == "i586-pc-windows-msvc" { - Err("the `i586-pc-windows-msvc` target has been removed. Use the `i686-pc-windows-msvc` target instead.\n\ - Windows 10 (the minimum required OS version) requires a CPU baseline of at least i686 so you can safely switch".into()) - } else { - Err(format!("could not find specification for target {target_tuple:?}")) - } + Err(format!("could not find specification for target {target_tuple:?}")) } TargetTuple::TargetJson { ref contents, .. } => Target::from_json(contents), } diff --git a/src/build_helper/src/git.rs b/src/build_helper/src/git.rs index cbefb836c0044..42d9b00f004ae 100644 --- a/src/build_helper/src/git.rs +++ b/src/build_helper/src/git.rs @@ -143,14 +143,13 @@ pub fn check_path_modifications( /// Returns true if any of the passed `paths` have changed since the `base` commit. pub fn has_changed_since(git_dir: &Path, base: &str, paths: &[&str]) -> bool { - let mut git = Command::new("git"); - git.current_dir(git_dir); + run_git_diff_index(Some(git_dir), |cmd| { + cmd.args(["--quiet", base, "--"]).args(paths); - git.args(["diff-index", "--quiet", base, "--"]).args(paths); - - // Exit code 0 => no changes - // Exit code 1 => some changes were detected - !git.status().expect("cannot run git diff-index").success() + // Exit code 0 => no changes + // Exit code 1 => some changes were detected + !cmd.status().expect("cannot run git diff-index").success() + }) } /// Returns the latest upstream commit that modified `target_paths`, or `None` if no such commit @@ -267,31 +266,49 @@ pub fn get_git_modified_files( return Err("No upstream commit was found".to_string()); }; - let mut git = Command::new("git"); - if let Some(git_dir) = git_dir { - git.current_dir(git_dir); - } - let files = output_result(git.args(["diff-index", "--name-status", merge_base.trim()]))? - .lines() - .filter_map(|f| { - let (status, name) = f.trim().split_once(char::is_whitespace).unwrap(); - if status == "D" { - None - } else if Path::new(name).extension().map_or(extensions.is_empty(), |ext| { - // If there is no extension, we allow the path if `extensions` is empty - // If there is an extension, we allow it if `extension` is empty or it contains the - // extension. - extensions.is_empty() || extensions.contains(&ext.to_str().unwrap()) - }) { - Some(name.to_owned()) - } else { - None - } - }) - .collect(); + let files = run_git_diff_index(git_dir, |cmd| { + output_result(cmd.args(["--name-status", merge_base.trim()])) + })? + .lines() + .filter_map(|f| { + let (status, name) = f.trim().split_once(char::is_whitespace).unwrap(); + if status == "D" { + None + } else if Path::new(name).extension().map_or(extensions.is_empty(), |ext| { + // If there is no extension, we allow the path if `extensions` is empty + // If there is an extension, we allow it if `extension` is empty or it contains the + // extension. + extensions.is_empty() || extensions.contains(&ext.to_str().unwrap()) + }) { + Some(name.to_owned()) + } else { + None + } + }) + .collect(); Ok(files) } +/// diff-index can return outdated information, because it does not update the git index. +/// This function uses `update-index` to update the index first, and then provides `func` with a +/// command prepared to run `git diff-index`. +fn run_git_diff_index(git_dir: Option<&Path>, func: F) -> T +where + F: FnOnce(&mut Command) -> T, +{ + let git = || { + let mut git = Command::new("git"); + if let Some(git_dir) = git_dir { + git.current_dir(git_dir); + } + git + }; + + // We ignore the exit code, as it errors out when some files are modified. + let _ = output_result(git().args(["update-index", "--refresh", "-q"])); + func(git().arg("diff-index")) +} + /// Returns the files that haven't been added to git yet. pub fn get_git_untracked_files(git_dir: Option<&Path>) -> Result>, String> { let mut git = Command::new("git"); diff --git a/src/librustdoc/clean/inline.rs b/src/librustdoc/clean/inline.rs index b470af50f68fe..70ba02d3c8d88 100644 --- a/src/librustdoc/clean/inline.rs +++ b/src/librustdoc/clean/inline.rs @@ -227,6 +227,30 @@ pub(crate) fn item_relative_path(tcx: TyCtxt<'_>, def_id: DefId) -> Vec tcx.def_path(def_id).data.into_iter().filter_map(|elem| elem.data.get_opt_name()).collect() } +/// Get the public Rust path to an item. This is used to generate the URL to the item's page. +/// +/// In particular: we handle macro differently: if it's not a macro 2.0 oe a built-in macro, then +/// it is generated at the top-level of the crate and its path will be `[crate_name, macro_name]`. +pub(crate) fn get_item_path(tcx: TyCtxt<'_>, def_id: DefId, kind: ItemType) -> Vec { + let crate_name = tcx.crate_name(def_id.krate); + let relative = item_relative_path(tcx, def_id); + + if let ItemType::Macro = kind { + // Check to see if it is a macro 2.0 or built-in macro + // More information in . + if matches!( + CStore::from_tcx(tcx).load_macro_untracked(def_id, tcx), + LoadedMacro::MacroDef { def, .. } if !def.macro_rules + ) { + once(crate_name).chain(relative).collect() + } else { + vec![crate_name, *relative.last().expect("relative was empty")] + } + } else { + once(crate_name).chain(relative).collect() + } +} + /// Record an external fully qualified name in the external_paths cache. /// /// These names are used later on by HTML rendering to generate things like @@ -240,27 +264,12 @@ pub(crate) fn record_extern_fqn(cx: &mut DocContext<'_>, did: DefId, kind: ItemT return; } - let crate_name = cx.tcx.crate_name(did.krate); - - let relative = item_relative_path(cx.tcx, did); - let fqn = if let ItemType::Macro = kind { - // Check to see if it is a macro 2.0 or built-in macro - if matches!( - CStore::from_tcx(cx.tcx).load_macro_untracked(did, cx.tcx), - LoadedMacro::MacroDef { def, .. } if !def.macro_rules - ) { - once(crate_name).chain(relative).collect() - } else { - vec![crate_name, *relative.last().expect("relative was empty")] - } - } else { - once(crate_name).chain(relative).collect() - }; + let item_path = get_item_path(cx.tcx, did, kind); if did.is_local() { - cx.cache.exact_paths.insert(did, fqn); + cx.cache.exact_paths.insert(did, item_path); } else { - cx.cache.external_paths.insert(did, (fqn, kind)); + cx.cache.external_paths.insert(did, (item_path, kind)); } } diff --git a/src/librustdoc/clean/types.rs b/src/librustdoc/clean/types.rs index 73d0f40275404..6e4c65dc91273 100644 --- a/src/librustdoc/clean/types.rs +++ b/src/librustdoc/clean/types.rs @@ -40,6 +40,7 @@ use crate::clean::utils::{is_literal_expr, print_evaluated_const}; use crate::core::DocContext; use crate::formats::cache::Cache; use crate::formats::item_type::ItemType; +use crate::html::format::HrefInfo; use crate::html::render::Context; use crate::passes::collect_intra_doc_links::UrlFragment; @@ -519,16 +520,16 @@ impl Item { .iter() .filter_map(|ItemLink { link: s, link_text, page_id: id, fragment }| { debug!(?id); - if let Ok((mut href, ..)) = href(*id, cx) { - debug!(?href); + if let Ok(HrefInfo { mut url, .. }) = href(*id, cx) { + debug!(?url); if let Some(ref fragment) = *fragment { - fragment.render(&mut href, cx.tcx()) + fragment.render(&mut url, cx.tcx()) } Some(RenderedLink { original_text: s.clone(), new_text: link_text.clone(), tooltip: link_tooltip(*id, fragment, cx).to_string(), - href, + href: url, }) } else { None diff --git a/src/librustdoc/display.rs b/src/librustdoc/display.rs index d62ea4c368804..550be1ae89588 100644 --- a/src/librustdoc/display.rs +++ b/src/librustdoc/display.rs @@ -10,19 +10,18 @@ pub(crate) trait Joined: IntoIterator { /// /// The performance of `joined` is slightly better than `format`, since it doesn't need to use a `Cell` to keep track of whether [`fmt`](Display::fmt) /// was already called (`joined`'s API doesn't allow it be called more than once). - fn joined(self, sep: impl Display, f: &mut Formatter<'_>) -> fmt::Result; + fn joined(&mut self, sep: impl Display, f: &mut Formatter<'_>) -> fmt::Result; } impl Joined for I where - I: IntoIterator, + I: Iterator, T: Display, { - fn joined(self, sep: impl Display, f: &mut Formatter<'_>) -> fmt::Result { - let mut iter = self.into_iter(); - let Some(first) = iter.next() else { return Ok(()) }; + fn joined(&mut self, sep: impl Display, f: &mut Formatter<'_>) -> fmt::Result { + let Some(first) = self.next() else { return Ok(()) }; first.fmt(f)?; - for item in iter { + for item in self { sep.fmt(f)?; item.fmt(f)?; } diff --git a/src/librustdoc/html/format.rs b/src/librustdoc/html/format.rs index 337429a6248d9..4843c20c758e6 100644 --- a/src/librustdoc/html/format.rs +++ b/src/librustdoc/html/format.rs @@ -17,10 +17,10 @@ use rustc_abi::ExternAbi; use rustc_ast::join_path_syms; use rustc_data_structures::fx::FxHashSet; use rustc_hir as hir; -use rustc_hir::def::DefKind; +use rustc_hir::def::{DefKind, MacroKinds}; use rustc_hir::def_id::{DefId, LOCAL_CRATE}; use rustc_hir::{ConstStability, StabilityLevel, StableSince}; -use rustc_metadata::creader::{CStore, LoadedMacro}; +use rustc_metadata::creader::CStore; use rustc_middle::ty::{self, TyCtxt, TypingMode}; use rustc_span::symbol::kw; use rustc_span::{Symbol, sym}; @@ -349,38 +349,44 @@ pub(crate) enum HrefError { UnnamableItem, } +/// Type representing information of an `href` attribute. +pub(crate) struct HrefInfo { + /// URL to the item page. + pub(crate) url: String, + /// Kind of the item (used to generate the `title` attribute). + pub(crate) kind: ItemType, + /// Rust path to the item (used to generate the `title` attribute). + pub(crate) rust_path: Vec, +} + /// This function is to get the external macro path because they are not in the cache used in /// `href_with_root_path`. fn generate_macro_def_id_path( def_id: DefId, cx: &Context<'_>, root_path: Option<&str>, -) -> Result<(String, ItemType, Vec), HrefError> { +) -> Result { let tcx = cx.tcx(); let crate_name = tcx.crate_name(def_id.krate); let cache = cx.cache(); - let fqp = clean::inline::item_relative_path(tcx, def_id); - let mut relative = fqp.iter().copied(); let cstore = CStore::from_tcx(tcx); // We need this to prevent a `panic` when this function is used from intra doc links... if !cstore.has_crate_data(def_id.krate) { debug!("No data for crate {crate_name}"); return Err(HrefError::NotInExternalCache); } - // Check to see if it is a macro 2.0 or built-in macro. - // More information in . - let is_macro_2 = match cstore.load_macro_untracked(def_id, tcx) { - // If `def.macro_rules` is `true`, then it's not a macro 2.0. - LoadedMacro::MacroDef { def, .. } => !def.macro_rules, - _ => false, + let DefKind::Macro(kinds) = tcx.def_kind(def_id) else { + unreachable!(); }; - - let mut path = if is_macro_2 { - once(crate_name).chain(relative).collect() + let item_type = if kinds == MacroKinds::DERIVE { + ItemType::ProcDerive + } else if kinds == MacroKinds::ATTR { + ItemType::ProcAttribute } else { - vec![crate_name, relative.next_back().unwrap()] + ItemType::Macro }; + let mut path = clean::inline::get_item_path(tcx, def_id, item_type); if path.len() < 2 { // The minimum we can have is the crate name followed by the macro name. If shorter, then // it means that `relative` was empty, which is an error. @@ -388,8 +394,11 @@ fn generate_macro_def_id_path( return Err(HrefError::NotInExternalCache); } - if let Some(last) = path.last_mut() { - *last = Symbol::intern(&format!("macro.{last}.html")); + // FIXME: Try to use `iter().chain().once()` instead. + let mut prev = None; + if let Some(last) = path.pop() { + path.push(Symbol::intern(&format!("{}.{last}.html", item_type.as_str()))); + prev = Some(last); } let url = match cache.extern_locations[&def_id.krate] { @@ -410,7 +419,11 @@ fn generate_macro_def_id_path( return Err(HrefError::NotInExternalCache); } }; - Ok((url, ItemType::Macro, fqp)) + if let Some(prev) = prev { + path.pop(); + path.push(prev); + } + Ok(HrefInfo { url, kind: item_type, rust_path: path }) } fn generate_item_def_id_path( @@ -419,7 +432,7 @@ fn generate_item_def_id_path( cx: &Context<'_>, root_path: Option<&str>, original_def_kind: DefKind, -) -> Result<(String, ItemType, Vec), HrefError> { +) -> Result { use rustc_middle::traits::ObligationCause; use rustc_trait_selection::infer::TyCtxtInferExt; use rustc_trait_selection::traits::query::normalize::QueryNormalizeExt; @@ -455,7 +468,7 @@ fn generate_item_def_id_path( let kind = ItemType::from_def_kind(original_def_kind, Some(def_kind)); url_parts = format!("{url_parts}#{kind}.{}", tcx.item_name(original_def_id)) }; - Ok((url_parts, shortty, fqp)) + Ok(HrefInfo { url: url_parts, kind: shortty, rust_path: fqp }) } /// Checks if the given defid refers to an item that is unnamable, such as one defined in a const block. @@ -530,7 +543,7 @@ pub(crate) fn href_with_root_path( original_did: DefId, cx: &Context<'_>, root_path: Option<&str>, -) -> Result<(String, ItemType, Vec), HrefError> { +) -> Result { let tcx = cx.tcx(); let def_kind = tcx.def_kind(original_did); let did = match def_kind { @@ -596,14 +609,14 @@ pub(crate) fn href_with_root_path( } } }; - let url_parts = make_href(root_path, shortty, url_parts, fqp, is_remote); - Ok((url_parts, shortty, fqp.clone())) + Ok(HrefInfo { + url: make_href(root_path, shortty, url_parts, fqp, is_remote), + kind: shortty, + rust_path: fqp.clone(), + }) } -pub(crate) fn href( - did: DefId, - cx: &Context<'_>, -) -> Result<(String, ItemType, Vec), HrefError> { +pub(crate) fn href(did: DefId, cx: &Context<'_>) -> Result { href_with_root_path(did, cx, None) } @@ -690,12 +703,12 @@ fn resolved_path( } else { let path = fmt::from_fn(|f| { if use_absolute { - if let Ok((_, _, fqp)) = href(did, cx) { + if let Ok(HrefInfo { rust_path, .. }) = href(did, cx) { write!( f, "{path}::{anchor}", - path = join_path_syms(&fqp[..fqp.len() - 1]), - anchor = print_anchor(did, *fqp.last().unwrap(), cx) + path = join_path_syms(&rust_path[..rust_path.len() - 1]), + anchor = print_anchor(did, *rust_path.last().unwrap(), cx) ) } else { write!(f, "{}", last.name) @@ -824,12 +837,11 @@ fn print_higher_ranked_params_with_space( pub(crate) fn print_anchor(did: DefId, text: Symbol, cx: &Context<'_>) -> impl Display { fmt::from_fn(move |f| { - let parts = href(did, cx); - if let Ok((url, short_ty, fqp)) = parts { + if let Ok(HrefInfo { url, kind, rust_path }) = href(did, cx) { write!( f, - r#"{text}"#, - path = join_path_syms(fqp), + r#"{text}"#, + path = join_path_syms(rust_path), text = EscapeBodyText(text.as_str()), ) } else { @@ -1056,14 +1068,14 @@ fn print_qpath_data(qpath_data: &clean::QPathData, cx: &Context<'_>) -> impl Dis None => self_type.def_id(cx.cache()).and_then(|did| href(did, cx).ok()), }; - if let Some((url, _, path)) = parent_href { + if let Some(HrefInfo { url, rust_path, .. }) = parent_href { write!( f, "{name}", shortty = ItemType::AssocType, name = assoc.name, - path = join_path_syms(path), + path = join_path_syms(rust_path), ) } else { write!(f, "{}", assoc.name) diff --git a/src/librustdoc/html/highlight.rs b/src/librustdoc/html/highlight.rs index 798fbd284ca87..6f6345cd86664 100644 --- a/src/librustdoc/html/highlight.rs +++ b/src/librustdoc/html/highlight.rs @@ -21,6 +21,7 @@ use super::format; use crate::clean::PrimitiveType; use crate::display::Joined as _; use crate::html::escape::EscapeBodyText; +use crate::html::format::HrefInfo; use crate::html::macro_expansion::ExpandedCode; use crate::html::render::span_map::{DUMMY_SP, Span}; use crate::html::render::{Context, LinkFromSrc}; @@ -1357,7 +1358,7 @@ fn generate_link_to_def( LinkFromSrc::External(def_id) => { format::href_with_root_path(*def_id, context, Some(href_context.root_path)) .ok() - .map(|(url, _, _)| url) + .map(|HrefInfo { url, .. }| url) } LinkFromSrc::Primitive(prim) => format::href_with_root_path( PrimitiveType::primitive_locations(context.tcx())[prim], @@ -1365,11 +1366,11 @@ fn generate_link_to_def( Some(href_context.root_path), ) .ok() - .map(|(url, _, _)| url), + .map(|HrefInfo { url, .. }| url), LinkFromSrc::Doc(def_id) => { format::href_with_root_path(*def_id, context, Some(href_context.root_path)) .ok() - .map(|(doc_link, _, _)| doc_link) + .map(|HrefInfo { url, .. }| url) } } }) diff --git a/src/librustdoc/html/render/mod.rs b/src/librustdoc/html/render/mod.rs index 36990332b2fc8..871ed53bd3380 100644 --- a/src/librustdoc/html/render/mod.rs +++ b/src/librustdoc/html/render/mod.rs @@ -74,7 +74,7 @@ use crate::formats::cache::Cache; use crate::formats::item_type::ItemType; use crate::html::escape::Escape; use crate::html::format::{ - Ending, HrefError, PrintWithSpace, full_print_fn_decl, href, print_abi_with_space, + Ending, HrefError, HrefInfo, PrintWithSpace, full_print_fn_decl, href, print_abi_with_space, print_constness_with_space, print_default_space, print_generic_bounds, print_generics, print_impl, print_path, print_type, print_where_clause, visibility_print_with_space, }; @@ -982,7 +982,7 @@ fn assoc_href_attr( }; match href(did.expect_def_id(), cx) { - Ok((url, ..)) => Href::Url(url, item_type), + Ok(HrefInfo { url, .. }) => Href::Url(url, item_type), // The link is broken since it points to an external crate that wasn't documented. // Do not create any link in such case. This is better than falling back to a // dummy anchor like `#{item_type}.{name}` representing the `id` of *this* impl item diff --git a/tests/coverage/async_block.cov-map b/tests/coverage/async_block.cov-map index 07d4c0eb3cd60..08f5a7b5d79ee 100644 --- a/tests/coverage/async_block.cov-map +++ b/tests/coverage/async_block.cov-map @@ -1,5 +1,5 @@ Function name: async_block::main -Raw bytes (41): 0x[01, 01, 01, 05, 01, 07, 01, 07, 01, 00, 0a, 02, 01, 09, 00, 0a, 05, 00, 0e, 00, 13, 02, 01, 0d, 00, 13, 02, 07, 09, 00, 1b, 02, 00, 1c, 00, 22, 01, 02, 01, 00, 02] +Raw bytes (41): 0x[01, 01, 01, 05, 01, 07, 01, 07, 01, 00, 0a, 02, 01, 09, 00, 0a, 01, 00, 0e, 00, 13, 02, 01, 0d, 00, 13, 02, 07, 09, 00, 1b, 02, 00, 1c, 00, 22, 01, 02, 01, 00, 02] Number of files: 1 - file 0 => $DIR/async_block.rs Number of expressions: 1 @@ -8,7 +8,7 @@ Number of file 0 mappings: 7 - Code(Counter(0)) at (prev + 7, 1) to (start + 0, 10) - Code(Expression(0, Sub)) at (prev + 1, 9) to (start + 0, 10) = (c1 - c0) -- Code(Counter(1)) at (prev + 0, 14) to (start + 0, 19) +- Code(Counter(0)) at (prev + 0, 14) to (start + 0, 19) - Code(Expression(0, Sub)) at (prev + 1, 13) to (start + 0, 19) = (c1 - c0) - Code(Expression(0, Sub)) at (prev + 7, 9) to (start + 0, 27) @@ -16,7 +16,7 @@ Number of file 0 mappings: 7 - Code(Expression(0, Sub)) at (prev + 0, 28) to (start + 0, 34) = (c1 - c0) - Code(Counter(0)) at (prev + 2, 1) to (start + 0, 2) -Highest counter ID seen: c1 +Highest counter ID seen: c0 Function name: async_block::main::{closure#0} Raw bytes (31): 0x[01, 01, 01, 01, 05, 05, 01, 09, 1c, 00, 1d, 01, 01, 10, 00, 17, 05, 00, 18, 02, 0e, 02, 02, 14, 02, 0e, 01, 03, 09, 00, 0a] diff --git a/tests/coverage/continue.cov-map b/tests/coverage/continue.cov-map index 1a839f19a0f5b..05efd2707817a 100644 --- a/tests/coverage/continue.cov-map +++ b/tests/coverage/continue.cov-map @@ -1,5 +1,5 @@ Function name: continue::main -Raw bytes (241): 0x[01, 01, 1a, 05, 01, 05, 13, 01, 09, 05, 13, 01, 09, 0d, 01, 0d, 27, 01, 11, 0d, 27, 01, 11, 15, 01, 15, 33, 01, 19, 1d, 01, 1d, 47, 01, 21, 1d, 47, 01, 21, 25, 01, 25, 53, 01, 29, 25, 01, 2d, 01, 63, 2d, 01, 31, 2d, 01, 25, 01, 03, 01, 00, 0a, 01, 01, 09, 00, 10, 01, 00, 13, 00, 2e, 01, 02, 09, 00, 0e, 01, 00, 11, 00, 12, 05, 01, 0e, 00, 13, 02, 01, 0f, 00, 16, 09, 02, 11, 00, 19, 0e, 02, 12, 02, 0e, 0e, 04, 09, 00, 0e, 0d, 02, 0e, 00, 13, 16, 01, 0f, 00, 16, 22, 01, 16, 02, 0e, 11, 04, 11, 00, 19, 22, 03, 09, 00, 0e, 15, 02, 0e, 00, 13, 2a, 01, 0f, 00, 16, 19, 01, 15, 02, 0e, 2e, 04, 11, 00, 19, 19, 03, 09, 00, 0e, 1d, 02, 0e, 00, 13, 36, 01, 0c, 00, 13, 21, 01, 0d, 00, 15, 42, 01, 09, 00, 0a, 42, 01, 09, 00, 0e, 25, 02, 0e, 00, 13, 56, 01, 0f, 00, 16, 4e, 01, 16, 02, 0e, 29, 03, 12, 02, 0e, 56, 04, 09, 00, 0e, 2d, 02, 0e, 00, 13, 31, 01, 0f, 00, 16, 66, 01, 16, 02, 0e, 5e, 04, 11, 00, 16, 66, 03, 09, 00, 0e, 01, 02, 0d, 00, 0e, 01, 01, 01, 00, 02] +Raw bytes (241): 0x[01, 01, 1a, 05, 01, 05, 13, 01, 09, 05, 13, 01, 09, 0d, 01, 0d, 27, 01, 11, 0d, 27, 01, 11, 15, 01, 15, 33, 01, 19, 1d, 01, 1d, 47, 01, 21, 1d, 47, 01, 21, 25, 01, 25, 53, 01, 29, 25, 01, 31, 01, 63, 31, 01, 2d, 31, 01, 25, 01, 03, 01, 00, 0a, 01, 01, 09, 00, 10, 01, 00, 13, 00, 2e, 01, 02, 09, 00, 0e, 01, 00, 11, 00, 12, 01, 01, 0e, 00, 13, 02, 01, 0f, 00, 16, 09, 02, 11, 00, 19, 0e, 02, 12, 02, 0e, 0e, 04, 09, 00, 0e, 01, 02, 0e, 00, 13, 16, 01, 0f, 00, 16, 22, 01, 16, 02, 0e, 11, 04, 11, 00, 19, 22, 03, 09, 00, 0e, 01, 02, 0e, 00, 13, 2a, 01, 0f, 00, 16, 19, 01, 15, 02, 0e, 2e, 04, 11, 00, 19, 19, 03, 09, 00, 0e, 01, 02, 0e, 00, 13, 36, 01, 0c, 00, 13, 21, 01, 0d, 00, 15, 42, 01, 09, 00, 0a, 42, 01, 09, 00, 0e, 01, 02, 0e, 00, 13, 56, 01, 0f, 00, 16, 4e, 01, 16, 02, 0e, 29, 03, 12, 02, 0e, 56, 04, 09, 00, 0e, 01, 02, 0e, 00, 13, 2d, 01, 0f, 00, 16, 66, 01, 16, 02, 0e, 5e, 04, 11, 00, 16, 66, 03, 09, 00, 0e, 01, 02, 0d, 00, 0e, 01, 01, 01, 00, 02] Number of files: 1 - file 0 => $DIR/continue.rs Number of expressions: 26 @@ -25,17 +25,17 @@ Number of expressions: 26 - expression 19 operands: lhs = Counter(9), rhs = Expression(20, Add) - expression 20 operands: lhs = Counter(0), rhs = Counter(10) - expression 21 operands: lhs = Counter(9), rhs = Counter(0) -- expression 22 operands: lhs = Counter(11), rhs = Counter(0) -- expression 23 operands: lhs = Expression(24, Add), rhs = Counter(11) -- expression 24 operands: lhs = Counter(0), rhs = Counter(12) -- expression 25 operands: lhs = Counter(11), rhs = Counter(0) +- expression 22 operands: lhs = Counter(12), rhs = Counter(0) +- expression 23 operands: lhs = Expression(24, Add), rhs = Counter(12) +- expression 24 operands: lhs = Counter(0), rhs = Counter(11) +- expression 25 operands: lhs = Counter(12), rhs = Counter(0) Number of file 0 mappings: 37 - Code(Counter(0)) at (prev + 3, 1) to (start + 0, 10) - Code(Counter(0)) at (prev + 1, 9) to (start + 0, 16) - Code(Counter(0)) at (prev + 0, 19) to (start + 0, 46) - Code(Counter(0)) at (prev + 2, 9) to (start + 0, 14) - Code(Counter(0)) at (prev + 0, 17) to (start + 0, 18) -- Code(Counter(1)) at (prev + 1, 14) to (start + 0, 19) +- Code(Counter(0)) at (prev + 1, 14) to (start + 0, 19) - Code(Expression(0, Sub)) at (prev + 1, 15) to (start + 0, 22) = (c1 - c0) - Code(Counter(2)) at (prev + 2, 17) to (start + 0, 25) @@ -43,7 +43,7 @@ Number of file 0 mappings: 37 = (c1 - (c0 + c2)) - Code(Expression(3, Sub)) at (prev + 4, 9) to (start + 0, 14) = (c1 - (c0 + c2)) -- Code(Counter(3)) at (prev + 2, 14) to (start + 0, 19) +- Code(Counter(0)) at (prev + 2, 14) to (start + 0, 19) - Code(Expression(5, Sub)) at (prev + 1, 15) to (start + 0, 22) = (c3 - c0) - Code(Expression(8, Sub)) at (prev + 1, 22) to (start + 2, 14) @@ -51,14 +51,14 @@ Number of file 0 mappings: 37 - Code(Counter(4)) at (prev + 4, 17) to (start + 0, 25) - Code(Expression(8, Sub)) at (prev + 3, 9) to (start + 0, 14) = (c3 - (c0 + c4)) -- Code(Counter(5)) at (prev + 2, 14) to (start + 0, 19) +- Code(Counter(0)) at (prev + 2, 14) to (start + 0, 19) - Code(Expression(10, Sub)) at (prev + 1, 15) to (start + 0, 22) = (c5 - c0) - Code(Counter(6)) at (prev + 1, 21) to (start + 2, 14) - Code(Expression(11, Sub)) at (prev + 4, 17) to (start + 0, 25) = (c5 - (c0 + c6)) - Code(Counter(6)) at (prev + 3, 9) to (start + 0, 14) -- Code(Counter(7)) at (prev + 2, 14) to (start + 0, 19) +- Code(Counter(0)) at (prev + 2, 14) to (start + 0, 19) - Code(Expression(13, Sub)) at (prev + 1, 12) to (start + 0, 19) = (c7 - c0) - Code(Counter(8)) at (prev + 1, 13) to (start + 0, 21) @@ -66,7 +66,7 @@ Number of file 0 mappings: 37 = (c7 - (c0 + c8)) - Code(Expression(16, Sub)) at (prev + 1, 9) to (start + 0, 14) = (c7 - (c0 + c8)) -- Code(Counter(9)) at (prev + 2, 14) to (start + 0, 19) +- Code(Counter(0)) at (prev + 2, 14) to (start + 0, 19) - Code(Expression(21, Sub)) at (prev + 1, 15) to (start + 0, 22) = (c9 - c0) - Code(Expression(19, Sub)) at (prev + 1, 22) to (start + 2, 14) @@ -74,15 +74,15 @@ Number of file 0 mappings: 37 - Code(Counter(10)) at (prev + 3, 18) to (start + 2, 14) - Code(Expression(21, Sub)) at (prev + 4, 9) to (start + 0, 14) = (c9 - c0) -- Code(Counter(11)) at (prev + 2, 14) to (start + 0, 19) -- Code(Counter(12)) at (prev + 1, 15) to (start + 0, 22) +- Code(Counter(0)) at (prev + 2, 14) to (start + 0, 19) +- Code(Counter(11)) at (prev + 1, 15) to (start + 0, 22) - Code(Expression(25, Sub)) at (prev + 1, 22) to (start + 2, 14) - = (c11 - c0) + = (c12 - c0) - Code(Expression(23, Sub)) at (prev + 4, 17) to (start + 0, 22) - = ((c0 + c12) - c11) + = ((c0 + c11) - c12) - Code(Expression(25, Sub)) at (prev + 3, 9) to (start + 0, 14) - = (c11 - c0) + = (c12 - c0) - Code(Counter(0)) at (prev + 2, 13) to (start + 0, 14) - Code(Counter(0)) at (prev + 1, 1) to (start + 0, 2) -Highest counter ID seen: c12 +Highest counter ID seen: c11 diff --git a/tests/coverage/inline.cov-map b/tests/coverage/inline.cov-map index 4c67dd96ac2f5..55f4b8484c024 100644 --- a/tests/coverage/inline.cov-map +++ b/tests/coverage/inline.cov-map @@ -1,5 +1,5 @@ Function name: inline::display:: -Raw bytes (36): 0x[01, 01, 01, 05, 01, 06, 01, 29, 01, 00, 21, 02, 01, 09, 00, 0a, 05, 00, 0e, 00, 10, 02, 00, 11, 02, 06, 01, 03, 05, 00, 0d, 01, 01, 01, 00, 02] +Raw bytes (36): 0x[01, 01, 01, 05, 01, 06, 01, 29, 01, 00, 21, 02, 01, 09, 00, 0a, 01, 00, 0e, 00, 10, 02, 00, 11, 02, 06, 01, 03, 05, 00, 0d, 01, 01, 01, 00, 02] Number of files: 1 - file 0 => $DIR/inline.rs Number of expressions: 1 @@ -8,12 +8,12 @@ Number of file 0 mappings: 6 - Code(Counter(0)) at (prev + 41, 1) to (start + 0, 33) - Code(Expression(0, Sub)) at (prev + 1, 9) to (start + 0, 10) = (c1 - c0) -- Code(Counter(1)) at (prev + 0, 14) to (start + 0, 16) +- Code(Counter(0)) at (prev + 0, 14) to (start + 0, 16) - Code(Expression(0, Sub)) at (prev + 0, 17) to (start + 2, 6) = (c1 - c0) - Code(Counter(0)) at (prev + 3, 5) to (start + 0, 13) - Code(Counter(0)) at (prev + 1, 1) to (start + 0, 2) -Highest counter ID seen: c1 +Highest counter ID seen: c0 Function name: inline::error Raw bytes (14): 0x[01, 01, 00, 02, 01, 31, 01, 00, 0b, 01, 01, 05, 00, 0b] @@ -50,7 +50,7 @@ Number of file 0 mappings: 4 Highest counter ID seen: c0 Function name: inline::permutate:: -Raw bytes (142): 0x[01, 01, 0e, 01, 05, 0d, 09, 0d, 09, 0d, 09, 0d, 09, 0d, 09, 0d, 09, 0d, 09, 0d, 09, 0d, 09, 0d, 09, 0d, 09, 01, 37, 05, 09, 16, 01, 0f, 01, 00, 38, 01, 01, 09, 00, 0a, 01, 00, 0d, 00, 13, 01, 00, 14, 00, 16, 01, 01, 08, 00, 0e, 05, 00, 0f, 02, 06, 02, 02, 0f, 00, 14, 2e, 01, 0d, 00, 0e, 09, 00, 12, 00, 13, 09, 00, 15, 00, 16, 2e, 00, 17, 04, 0a, 2e, 01, 0d, 00, 11, 2e, 00, 12, 00, 14, 2e, 00, 16, 00, 17, 2e, 00, 19, 00, 1a, 2e, 01, 0d, 00, 16, 2e, 00, 17, 00, 19, 2e, 00, 1b, 00, 20, 2e, 01, 0d, 00, 11, 2e, 00, 12, 00, 14, 32, 02, 0c, 02, 06, 01, 03, 01, 00, 02] +Raw bytes (137): 0x[01, 01, 0e, 01, 05, 0d, 09, 0d, 09, 0d, 09, 0d, 09, 0d, 09, 0d, 09, 0d, 09, 0d, 09, 0d, 09, 0d, 09, 0d, 09, 01, 37, 05, 09, 15, 01, 0f, 01, 00, 38, 01, 01, 09, 00, 0a, 01, 00, 0d, 00, 13, 01, 00, 14, 00, 16, 01, 01, 08, 00, 0e, 05, 00, 0f, 02, 06, 02, 02, 0f, 00, 14, 2e, 01, 0d, 00, 0e, 09, 00, 12, 00, 16, 2e, 00, 17, 04, 0a, 2e, 01, 0d, 00, 11, 2e, 00, 12, 00, 14, 2e, 00, 16, 00, 17, 2e, 00, 19, 00, 1a, 2e, 01, 0d, 00, 16, 2e, 00, 17, 00, 19, 2e, 00, 1b, 00, 20, 2e, 01, 0d, 00, 11, 2e, 00, 12, 00, 14, 32, 02, 0c, 02, 06, 01, 03, 01, 00, 02] Number of files: 1 - file 0 => $DIR/inline.rs Number of expressions: 14 @@ -68,7 +68,7 @@ Number of expressions: 14 - expression 11 operands: lhs = Counter(3), rhs = Counter(2) - expression 12 operands: lhs = Counter(0), rhs = Expression(13, Add) - expression 13 operands: lhs = Counter(1), rhs = Counter(2) -Number of file 0 mappings: 22 +Number of file 0 mappings: 21 - Code(Counter(0)) at (prev + 15, 1) to (start + 0, 56) - Code(Counter(0)) at (prev + 1, 9) to (start + 0, 10) - Code(Counter(0)) at (prev + 0, 13) to (start + 0, 19) @@ -79,8 +79,7 @@ Number of file 0 mappings: 22 = (c0 - c1) - Code(Expression(11, Sub)) at (prev + 1, 13) to (start + 0, 14) = (c3 - c2) -- Code(Counter(2)) at (prev + 0, 18) to (start + 0, 19) -- Code(Counter(2)) at (prev + 0, 21) to (start + 0, 22) +- Code(Counter(2)) at (prev + 0, 18) to (start + 0, 22) - Code(Expression(11, Sub)) at (prev + 0, 23) to (start + 4, 10) = (c3 - c2) - Code(Expression(11, Sub)) at (prev + 1, 13) to (start + 0, 17) diff --git a/tests/coverage/loops_branches.cov-map b/tests/coverage/loops_branches.cov-map index 78fdaa53f46f1..96dd705044131 100644 --- a/tests/coverage/loops_branches.cov-map +++ b/tests/coverage/loops_branches.cov-map @@ -1,12 +1,13 @@ Function name: ::fmt -Raw bytes (137): 0x[01, 01, 04, 07, 0b, 01, 0d, 05, 09, 09, 0d, 19, 01, 09, 05, 00, 43, 01, 01, 0c, 00, 10, 01, 01, 10, 00, 15, 00, 01, 17, 00, 1b, 00, 00, 1c, 00, 1e, 01, 01, 0d, 00, 0e, 01, 01, 0d, 00, 13, 01, 00, 14, 00, 15, 01, 00, 17, 00, 1d, 05, 00, 1e, 00, 1f, 00, 01, 10, 01, 0a, 0d, 03, 0d, 00, 0e, 09, 00, 12, 00, 17, 0d, 01, 10, 00, 14, 0d, 01, 14, 00, 19, 00, 01, 1b, 00, 1f, 00, 00, 20, 00, 22, 0d, 01, 11, 00, 12, 0d, 01, 11, 00, 17, 0d, 00, 18, 00, 19, 0d, 00, 1b, 00, 21, 02, 00, 22, 00, 23, 00, 01, 14, 01, 0e, 0e, 03, 09, 00, 0f, 01, 01, 05, 00, 06] +Raw bytes (139): 0x[01, 01, 05, 01, 05, 0b, 0f, 01, 09, 05, 0d, 0d, 09, 19, 01, 09, 05, 00, 43, 01, 01, 0c, 00, 10, 01, 01, 10, 00, 15, 00, 01, 17, 00, 1b, 00, 00, 1c, 00, 1e, 01, 01, 0d, 00, 0e, 01, 01, 0d, 00, 13, 01, 00, 14, 00, 15, 01, 00, 17, 00, 1d, 05, 00, 1e, 00, 1f, 00, 01, 10, 01, 0a, 09, 03, 0d, 00, 0e, 02, 00, 12, 00, 17, 09, 01, 10, 00, 14, 09, 01, 14, 00, 19, 00, 01, 1b, 00, 1f, 00, 00, 20, 00, 22, 09, 01, 11, 00, 12, 09, 01, 11, 00, 17, 09, 00, 18, 00, 19, 09, 00, 1b, 00, 21, 06, 00, 22, 00, 23, 00, 01, 14, 01, 0e, 12, 03, 09, 00, 0f, 01, 01, 05, 00, 06] Number of files: 1 - file 0 => $DIR/loops_branches.rs -Number of expressions: 4 -- expression 0 operands: lhs = Expression(1, Add), rhs = Expression(2, Add) -- expression 1 operands: lhs = Counter(0), rhs = Counter(3) -- expression 2 operands: lhs = Counter(1), rhs = Counter(2) -- expression 3 operands: lhs = Counter(2), rhs = Counter(3) +Number of expressions: 5 +- expression 0 operands: lhs = Counter(0), rhs = Counter(1) +- expression 1 operands: lhs = Expression(2, Add), rhs = Expression(3, Add) +- expression 2 operands: lhs = Counter(0), rhs = Counter(2) +- expression 3 operands: lhs = Counter(1), rhs = Counter(3) +- expression 4 operands: lhs = Counter(3), rhs = Counter(2) Number of file 0 mappings: 25 - Code(Counter(0)) at (prev + 9, 5) to (start + 0, 67) - Code(Counter(0)) at (prev + 1, 12) to (start + 0, 16) @@ -19,33 +20,35 @@ Number of file 0 mappings: 25 - Code(Counter(0)) at (prev + 0, 23) to (start + 0, 29) - Code(Counter(1)) at (prev + 0, 30) to (start + 0, 31) - Code(Zero) at (prev + 1, 16) to (start + 1, 10) -- Code(Counter(3)) at (prev + 3, 13) to (start + 0, 14) -- Code(Counter(2)) at (prev + 0, 18) to (start + 0, 23) -- Code(Counter(3)) at (prev + 1, 16) to (start + 0, 20) -- Code(Counter(3)) at (prev + 1, 20) to (start + 0, 25) +- Code(Counter(2)) at (prev + 3, 13) to (start + 0, 14) +- Code(Expression(0, Sub)) at (prev + 0, 18) to (start + 0, 23) + = (c0 - c1) +- Code(Counter(2)) at (prev + 1, 16) to (start + 0, 20) +- Code(Counter(2)) at (prev + 1, 20) to (start + 0, 25) - Code(Zero) at (prev + 1, 27) to (start + 0, 31) - Code(Zero) at (prev + 0, 32) to (start + 0, 34) -- Code(Counter(3)) at (prev + 1, 17) to (start + 0, 18) -- Code(Counter(3)) at (prev + 1, 17) to (start + 0, 23) -- Code(Counter(3)) at (prev + 0, 24) to (start + 0, 25) -- Code(Counter(3)) at (prev + 0, 27) to (start + 0, 33) -- Code(Expression(0, Sub)) at (prev + 0, 34) to (start + 0, 35) - = ((c0 + c3) - (c1 + c2)) +- Code(Counter(2)) at (prev + 1, 17) to (start + 0, 18) +- Code(Counter(2)) at (prev + 1, 17) to (start + 0, 23) +- Code(Counter(2)) at (prev + 0, 24) to (start + 0, 25) +- Code(Counter(2)) at (prev + 0, 27) to (start + 0, 33) +- Code(Expression(1, Sub)) at (prev + 0, 34) to (start + 0, 35) + = ((c0 + c2) - (c1 + c3)) - Code(Zero) at (prev + 1, 20) to (start + 1, 14) -- Code(Expression(3, Sub)) at (prev + 3, 9) to (start + 0, 15) - = (c2 - c3) +- Code(Expression(4, Sub)) at (prev + 3, 9) to (start + 0, 15) + = (c3 - c2) - Code(Counter(0)) at (prev + 1, 5) to (start + 0, 6) -Highest counter ID seen: c3 +Highest counter ID seen: c2 Function name: ::fmt -Raw bytes (137): 0x[01, 01, 04, 07, 0b, 01, 09, 05, 0d, 05, 09, 19, 01, 22, 05, 00, 43, 01, 01, 0c, 00, 11, 00, 00, 12, 01, 0a, 01, 02, 10, 00, 15, 00, 01, 17, 00, 1b, 00, 00, 1c, 00, 1e, 01, 01, 0d, 00, 0e, 01, 01, 0d, 00, 13, 01, 00, 14, 00, 15, 01, 00, 17, 00, 1d, 0d, 00, 1e, 00, 1f, 09, 02, 0d, 00, 0e, 05, 00, 12, 00, 17, 09, 01, 10, 00, 15, 00, 00, 16, 01, 0e, 09, 02, 14, 00, 19, 00, 01, 1b, 00, 1f, 00, 00, 20, 00, 22, 09, 01, 11, 00, 12, 09, 01, 11, 00, 17, 09, 00, 18, 00, 19, 09, 00, 1b, 00, 21, 02, 00, 22, 00, 23, 0e, 03, 09, 00, 0f, 01, 01, 05, 00, 06] +Raw bytes (139): 0x[01, 01, 05, 01, 05, 0b, 0f, 01, 09, 0d, 05, 0d, 09, 19, 01, 22, 05, 00, 43, 01, 01, 0c, 00, 11, 00, 00, 12, 01, 0a, 01, 02, 10, 00, 15, 00, 01, 17, 00, 1b, 00, 00, 1c, 00, 1e, 01, 01, 0d, 00, 0e, 01, 01, 0d, 00, 13, 01, 00, 14, 00, 15, 01, 00, 17, 00, 1d, 05, 00, 1e, 00, 1f, 09, 02, 0d, 00, 0e, 02, 00, 12, 00, 17, 09, 01, 10, 00, 15, 00, 00, 16, 01, 0e, 09, 02, 14, 00, 19, 00, 01, 1b, 00, 1f, 00, 00, 20, 00, 22, 09, 01, 11, 00, 12, 09, 01, 11, 00, 17, 09, 00, 18, 00, 19, 09, 00, 1b, 00, 21, 06, 00, 22, 00, 23, 12, 03, 09, 00, 0f, 01, 01, 05, 00, 06] Number of files: 1 - file 0 => $DIR/loops_branches.rs -Number of expressions: 4 -- expression 0 operands: lhs = Expression(1, Add), rhs = Expression(2, Add) -- expression 1 operands: lhs = Counter(0), rhs = Counter(2) -- expression 2 operands: lhs = Counter(1), rhs = Counter(3) -- expression 3 operands: lhs = Counter(1), rhs = Counter(2) +Number of expressions: 5 +- expression 0 operands: lhs = Counter(0), rhs = Counter(1) +- expression 1 operands: lhs = Expression(2, Add), rhs = Expression(3, Add) +- expression 2 operands: lhs = Counter(0), rhs = Counter(2) +- expression 3 operands: lhs = Counter(3), rhs = Counter(1) +- expression 4 operands: lhs = Counter(3), rhs = Counter(2) Number of file 0 mappings: 25 - Code(Counter(0)) at (prev + 34, 5) to (start + 0, 67) - Code(Counter(0)) at (prev + 1, 12) to (start + 0, 17) @@ -57,9 +60,10 @@ Number of file 0 mappings: 25 - Code(Counter(0)) at (prev + 1, 13) to (start + 0, 19) - Code(Counter(0)) at (prev + 0, 20) to (start + 0, 21) - Code(Counter(0)) at (prev + 0, 23) to (start + 0, 29) -- Code(Counter(3)) at (prev + 0, 30) to (start + 0, 31) +- Code(Counter(1)) at (prev + 0, 30) to (start + 0, 31) - Code(Counter(2)) at (prev + 2, 13) to (start + 0, 14) -- Code(Counter(1)) at (prev + 0, 18) to (start + 0, 23) +- Code(Expression(0, Sub)) at (prev + 0, 18) to (start + 0, 23) + = (c0 - c1) - Code(Counter(2)) at (prev + 1, 16) to (start + 0, 21) - Code(Zero) at (prev + 0, 22) to (start + 1, 14) - Code(Counter(2)) at (prev + 2, 20) to (start + 0, 25) @@ -69,12 +73,12 @@ Number of file 0 mappings: 25 - Code(Counter(2)) at (prev + 1, 17) to (start + 0, 23) - Code(Counter(2)) at (prev + 0, 24) to (start + 0, 25) - Code(Counter(2)) at (prev + 0, 27) to (start + 0, 33) -- Code(Expression(0, Sub)) at (prev + 0, 34) to (start + 0, 35) - = ((c0 + c2) - (c1 + c3)) -- Code(Expression(3, Sub)) at (prev + 3, 9) to (start + 0, 15) - = (c1 - c2) +- Code(Expression(1, Sub)) at (prev + 0, 34) to (start + 0, 35) + = ((c0 + c2) - (c3 + c1)) +- Code(Expression(4, Sub)) at (prev + 3, 9) to (start + 0, 15) + = (c3 - c2) - Code(Counter(0)) at (prev + 1, 5) to (start + 0, 6) -Highest counter ID seen: c3 +Highest counter ID seen: c2 Function name: loops_branches::main Raw bytes (54): 0x[01, 01, 00, 0a, 01, 37, 01, 00, 0a, 01, 01, 09, 00, 13, 01, 00, 16, 00, 1f, 01, 01, 05, 00, 0d, 01, 00, 0e, 00, 14, 01, 01, 09, 00, 15, 01, 00, 18, 00, 23, 01, 01, 05, 00, 0d, 01, 00, 0e, 00, 12, 01, 01, 01, 00, 02] diff --git a/tests/coverage/nested_loops.cov-map b/tests/coverage/nested_loops.cov-map index 649c65d8590ba..598068714b9a1 100644 --- a/tests/coverage/nested_loops.cov-map +++ b/tests/coverage/nested_loops.cov-map @@ -1,26 +1,26 @@ Function name: nested_loops::main -Raw bytes (164): 0x[01, 01, 14, 07, 47, 05, 11, 01, 0d, 47, 05, 01, 0d, 47, 05, 01, 0d, 47, 05, 01, 0d, 47, 05, 01, 0d, 3f, 05, 01, 09, 4b, 3f, 05, 15, 01, 09, 47, 4b, 01, 0d, 05, 15, 05, 01, 18, 01, 01, 01, 00, 0a, 01, 01, 09, 00, 10, 01, 00, 13, 00, 2e, 01, 01, 09, 00, 16, 01, 00, 19, 00, 1b, 05, 02, 13, 00, 20, 09, 01, 0d, 00, 12, 09, 00, 15, 00, 18, 09, 01, 0d, 00, 12, 09, 00, 15, 00, 18, 0d, 01, 12, 00, 17, 11, 01, 10, 00, 16, 02, 01, 11, 00, 16, 26, 01, 0d, 00, 0e, 26, 01, 0d, 00, 13, 26, 01, 0d, 00, 13, 26, 01, 10, 00, 16, 15, 01, 11, 00, 18, 15, 01, 14, 00, 1b, 2e, 01, 15, 00, 21, 36, 01, 18, 02, 12, 42, 03, 0d, 00, 0e, 4e, 02, 09, 00, 17, 01, 02, 01, 00, 02] +Raw bytes (164): 0x[01, 01, 14, 07, 47, 05, 0d, 01, 11, 47, 05, 01, 11, 47, 05, 01, 11, 47, 05, 01, 11, 47, 05, 01, 11, 3f, 05, 01, 09, 4b, 3f, 05, 15, 01, 09, 47, 4b, 01, 11, 05, 15, 05, 01, 18, 01, 01, 01, 00, 0a, 01, 01, 09, 00, 10, 01, 00, 13, 00, 2e, 01, 01, 09, 00, 16, 01, 00, 19, 00, 1b, 05, 02, 13, 00, 20, 09, 01, 0d, 00, 12, 09, 00, 15, 00, 18, 09, 01, 0d, 00, 12, 09, 00, 15, 00, 18, 09, 01, 12, 00, 17, 0d, 01, 10, 00, 16, 02, 01, 11, 00, 16, 26, 01, 0d, 00, 0e, 26, 01, 0d, 00, 13, 26, 01, 0d, 00, 13, 26, 01, 10, 00, 16, 15, 01, 11, 00, 18, 15, 01, 14, 00, 1b, 2e, 01, 15, 00, 21, 36, 01, 18, 02, 12, 42, 03, 0d, 00, 0e, 4e, 02, 09, 00, 17, 01, 02, 01, 00, 02] Number of files: 1 - file 0 => $DIR/nested_loops.rs Number of expressions: 20 - expression 0 operands: lhs = Expression(1, Add), rhs = Expression(17, Add) -- expression 1 operands: lhs = Counter(1), rhs = Counter(4) -- expression 2 operands: lhs = Counter(0), rhs = Counter(3) +- expression 1 operands: lhs = Counter(1), rhs = Counter(3) +- expression 2 operands: lhs = Counter(0), rhs = Counter(4) - expression 3 operands: lhs = Expression(17, Add), rhs = Counter(1) -- expression 4 operands: lhs = Counter(0), rhs = Counter(3) +- expression 4 operands: lhs = Counter(0), rhs = Counter(4) - expression 5 operands: lhs = Expression(17, Add), rhs = Counter(1) -- expression 6 operands: lhs = Counter(0), rhs = Counter(3) +- expression 6 operands: lhs = Counter(0), rhs = Counter(4) - expression 7 operands: lhs = Expression(17, Add), rhs = Counter(1) -- expression 8 operands: lhs = Counter(0), rhs = Counter(3) +- expression 8 operands: lhs = Counter(0), rhs = Counter(4) - expression 9 operands: lhs = Expression(17, Add), rhs = Counter(1) -- expression 10 operands: lhs = Counter(0), rhs = Counter(3) +- expression 10 operands: lhs = Counter(0), rhs = Counter(4) - expression 11 operands: lhs = Expression(15, Add), rhs = Counter(1) - expression 12 operands: lhs = Counter(0), rhs = Counter(2) - expression 13 operands: lhs = Expression(18, Add), rhs = Expression(15, Add) - expression 14 operands: lhs = Counter(1), rhs = Counter(5) - expression 15 operands: lhs = Counter(0), rhs = Counter(2) - expression 16 operands: lhs = Expression(17, Add), rhs = Expression(18, Add) -- expression 17 operands: lhs = Counter(0), rhs = Counter(3) +- expression 17 operands: lhs = Counter(0), rhs = Counter(4) - expression 18 operands: lhs = Counter(1), rhs = Counter(5) - expression 19 operands: lhs = Counter(1), rhs = Counter(0) Number of file 0 mappings: 24 @@ -34,18 +34,18 @@ Number of file 0 mappings: 24 - Code(Counter(2)) at (prev + 0, 21) to (start + 0, 24) - Code(Counter(2)) at (prev + 1, 13) to (start + 0, 18) - Code(Counter(2)) at (prev + 0, 21) to (start + 0, 24) -- Code(Counter(3)) at (prev + 1, 18) to (start + 0, 23) -- Code(Counter(4)) at (prev + 1, 16) to (start + 0, 22) +- Code(Counter(2)) at (prev + 1, 18) to (start + 0, 23) +- Code(Counter(3)) at (prev + 1, 16) to (start + 0, 22) - Code(Expression(0, Sub)) at (prev + 1, 17) to (start + 0, 22) - = ((c1 + c4) - (c0 + c3)) + = ((c1 + c3) - (c0 + c4)) - Code(Expression(9, Sub)) at (prev + 1, 13) to (start + 0, 14) - = ((c0 + c3) - c1) + = ((c0 + c4) - c1) - Code(Expression(9, Sub)) at (prev + 1, 13) to (start + 0, 19) - = ((c0 + c3) - c1) + = ((c0 + c4) - c1) - Code(Expression(9, Sub)) at (prev + 1, 13) to (start + 0, 19) - = ((c0 + c3) - c1) + = ((c0 + c4) - c1) - Code(Expression(9, Sub)) at (prev + 1, 16) to (start + 0, 22) - = ((c0 + c3) - c1) + = ((c0 + c4) - c1) - Code(Counter(5)) at (prev + 1, 17) to (start + 0, 24) - Code(Counter(5)) at (prev + 1, 20) to (start + 0, 27) - Code(Expression(11, Sub)) at (prev + 1, 21) to (start + 0, 33) @@ -53,7 +53,7 @@ Number of file 0 mappings: 24 - Code(Expression(13, Sub)) at (prev + 1, 24) to (start + 2, 18) = ((c1 + c5) - (c0 + c2)) - Code(Expression(16, Sub)) at (prev + 3, 13) to (start + 0, 14) - = ((c0 + c3) - (c1 + c5)) + = ((c0 + c4) - (c1 + c5)) - Code(Expression(19, Sub)) at (prev + 2, 9) to (start + 0, 23) = (c1 - c0) - Code(Counter(0)) at (prev + 2, 1) to (start + 0, 2) diff --git a/tests/coverage/simple_match.cov-map b/tests/coverage/simple_match.cov-map index cbd6c7ca52fd1..bc5a7e7b4bef4 100644 --- a/tests/coverage/simple_match.cov-map +++ b/tests/coverage/simple_match.cov-map @@ -1,5 +1,5 @@ Function name: simple_match::main -Raw bytes (99): 0x[01, 01, 05, 01, 05, 09, 01, 09, 01, 09, 13, 01, 0d, 11, 01, 04, 01, 00, 0a, 01, 04, 09, 00, 10, 01, 00, 13, 00, 2e, 01, 02, 09, 00, 16, 01, 00, 19, 00, 1a, 01, 01, 08, 00, 0f, 05, 00, 10, 02, 06, 02, 02, 05, 00, 06, 09, 05, 09, 00, 0d, 0a, 05, 0d, 00, 16, 0d, 02, 0d, 00, 0e, 0a, 02, 11, 02, 12, 0d, 04, 0d, 07, 0e, 0d, 01, 11, 00, 1e, 0d, 02, 15, 00, 16, 0e, 07, 0d, 00, 0f, 01, 03, 01, 00, 02] +Raw bytes (99): 0x[01, 01, 05, 01, 05, 09, 01, 09, 01, 09, 13, 01, 0d, 11, 01, 04, 01, 00, 0a, 01, 04, 09, 00, 10, 01, 00, 13, 00, 2e, 01, 02, 09, 00, 16, 01, 00, 19, 00, 1a, 01, 01, 08, 00, 0f, 05, 00, 10, 02, 06, 02, 02, 05, 00, 06, 01, 05, 09, 00, 0d, 0a, 05, 0d, 00, 16, 0d, 02, 0d, 00, 0e, 0a, 02, 11, 02, 12, 0d, 04, 0d, 07, 0e, 0d, 01, 11, 00, 1e, 0d, 02, 15, 00, 16, 0e, 07, 0d, 00, 0f, 01, 03, 01, 00, 02] Number of files: 1 - file 0 => $DIR/simple_match.rs Number of expressions: 5 @@ -18,7 +18,7 @@ Number of file 0 mappings: 17 - Code(Counter(1)) at (prev + 0, 16) to (start + 2, 6) - Code(Expression(0, Sub)) at (prev + 2, 5) to (start + 0, 6) = (c0 - c1) -- Code(Counter(2)) at (prev + 5, 9) to (start + 0, 13) +- Code(Counter(0)) at (prev + 5, 9) to (start + 0, 13) - Code(Expression(2, Sub)) at (prev + 5, 13) to (start + 0, 22) = (c2 - c0) - Code(Counter(3)) at (prev + 2, 13) to (start + 0, 14) diff --git a/tests/coverage/try_error_result.cov-map b/tests/coverage/try_error_result.cov-map index e08f429615328..53757ef8a9bd6 100644 --- a/tests/coverage/try_error_result.cov-map +++ b/tests/coverage/try_error_result.cov-map @@ -62,77 +62,77 @@ Number of file 0 mappings: 8 Highest counter ID seen: c1 Function name: try_error_result::test1 -Raw bytes (82): 0x[01, 01, 04, 07, 05, 01, 09, 05, 01, 05, 09, 0e, 01, 0d, 01, 00, 1d, 01, 01, 09, 01, 12, 01, 01, 15, 00, 17, 05, 05, 09, 00, 0e, 09, 02, 09, 01, 11, 09, 04, 0d, 00, 1a, 02, 02, 0d, 00, 11, 02, 00, 29, 00, 2a, 00, 01, 0d, 00, 11, 00, 00, 2a, 00, 2b, 0a, 04, 0d, 00, 11, 00, 00, 2a, 00, 2b, 0e, 03, 05, 00, 0b, 01, 01, 01, 00, 02] +Raw bytes (82): 0x[01, 01, 04, 07, 09, 01, 05, 09, 01, 09, 05, 0e, 01, 0d, 01, 00, 1d, 01, 01, 09, 01, 12, 01, 01, 15, 00, 17, 01, 05, 09, 00, 0e, 05, 02, 09, 01, 11, 05, 04, 0d, 00, 1a, 02, 02, 0d, 00, 11, 02, 00, 29, 00, 2a, 00, 01, 0d, 00, 11, 00, 00, 2a, 00, 2b, 0a, 04, 0d, 00, 11, 00, 00, 2a, 00, 2b, 0e, 03, 05, 00, 0b, 01, 01, 01, 00, 02] Number of files: 1 - file 0 => $DIR/try_error_result.rs Number of expressions: 4 -- expression 0 operands: lhs = Expression(1, Add), rhs = Counter(1) -- expression 1 operands: lhs = Counter(0), rhs = Counter(2) -- expression 2 operands: lhs = Counter(1), rhs = Counter(0) -- expression 3 operands: lhs = Counter(1), rhs = Counter(2) +- expression 0 operands: lhs = Expression(1, Add), rhs = Counter(2) +- expression 1 operands: lhs = Counter(0), rhs = Counter(1) +- expression 2 operands: lhs = Counter(2), rhs = Counter(0) +- expression 3 operands: lhs = Counter(2), rhs = Counter(1) Number of file 0 mappings: 14 - Code(Counter(0)) at (prev + 13, 1) to (start + 0, 29) - Code(Counter(0)) at (prev + 1, 9) to (start + 1, 18) - Code(Counter(0)) at (prev + 1, 21) to (start + 0, 23) -- Code(Counter(1)) at (prev + 5, 9) to (start + 0, 14) -- Code(Counter(2)) at (prev + 2, 9) to (start + 1, 17) -- Code(Counter(2)) at (prev + 4, 13) to (start + 0, 26) +- Code(Counter(0)) at (prev + 5, 9) to (start + 0, 14) +- Code(Counter(1)) at (prev + 2, 9) to (start + 1, 17) +- Code(Counter(1)) at (prev + 4, 13) to (start + 0, 26) - Code(Expression(0, Sub)) at (prev + 2, 13) to (start + 0, 17) - = ((c0 + c2) - c1) + = ((c0 + c1) - c2) - Code(Expression(0, Sub)) at (prev + 0, 41) to (start + 0, 42) - = ((c0 + c2) - c1) + = ((c0 + c1) - c2) - Code(Zero) at (prev + 1, 13) to (start + 0, 17) - Code(Zero) at (prev + 0, 42) to (start + 0, 43) - Code(Expression(2, Sub)) at (prev + 4, 13) to (start + 0, 17) - = (c1 - c0) + = (c2 - c0) - Code(Zero) at (prev + 0, 42) to (start + 0, 43) - Code(Expression(3, Sub)) at (prev + 3, 5) to (start + 0, 11) - = (c1 - c2) + = (c2 - c1) - Code(Counter(0)) at (prev + 1, 1) to (start + 0, 2) -Highest counter ID seen: c2 +Highest counter ID seen: c1 Function name: try_error_result::test2 -Raw bytes (443): 0x[01, 01, 3d, 0d, 11, 0d, 57, 11, 15, 0d, 57, 11, 15, 0d, 57, 11, 15, 0d, 4f, 53, 1d, 57, 19, 11, 15, 0d, 57, 11, 15, 0d, 57, 11, 15, 0d, 53, 57, 19, 11, 15, 0d, 4f, 53, 1d, 57, 19, 11, 15, 41, 6b, 21, 25, 41, 21, 41, 6b, 21, 25, 09, 8f, 01, 93, 01, 2d, 0d, 29, 09, 0d, 09, 0d, 09, 93, 01, 0d, 29, 09, 8f, 01, 93, 01, 2d, 0d, 29, 45, a7, 01, 31, 35, 45, 31, 45, a7, 01, 31, 35, 49, bb, 01, 39, 3d, 49, 39, 49, bb, 01, 39, 3d, 05, 09, c7, 01, 09, cb, 01, 3d, cf, 01, 39, d3, 01, 35, d7, 01, 31, db, 01, 2d, df, 01, 29, e3, 01, 25, e7, 01, 21, eb, 01, 1d, ef, 01, 19, f3, 01, 15, 05, 11, 39, 01, 3d, 01, 00, 1d, 01, 01, 09, 00, 0f, 01, 00, 12, 00, 1a, 01, 01, 09, 01, 12, 01, 01, 15, 00, 17, 05, 05, 09, 00, 0e, 09, 02, 09, 01, 11, 09, 04, 0d, 00, 1a, 0d, 02, 0d, 00, 13, 0d, 00, 14, 00, 1f, 11, 00, 2f, 00, 30, 02, 00, 31, 00, 35, 02, 00, 45, 00, 4f, 02, 00, 50, 00, 62, 02, 01, 0d, 00, 13, 02, 02, 11, 00, 1c, 15, 01, 11, 00, 12, 36, 02, 11, 00, 15, 36, 02, 11, 00, 1b, 36, 01, 15, 00, 27, 4a, 02, 11, 00, 14, 36, 00, 17, 00, 1d, 36, 00, 1e, 00, 29, 19, 00, 41, 00, 42, 3e, 00, 43, 00, 47, 1d, 00, 5f, 00, 60, 4a, 01, 0d, 00, 17, 66, 01, 11, 00, 14, 41, 00, 17, 00, 1d, 41, 00, 1e, 00, 29, 21, 00, 41, 00, 42, 62, 00, 43, 00, 47, 25, 00, 60, 00, 61, 66, 01, 0d, 00, 17, 8a, 01, 04, 11, 00, 14, 7e, 00, 17, 00, 1d, 7e, 00, 1e, 00, 29, 29, 00, 42, 00, 43, 82, 01, 00, 44, 00, 48, 2d, 00, 61, 00, 62, 8a, 01, 01, 0d, 00, 17, a2, 01, 01, 11, 00, 14, 45, 00, 17, 00, 1d, 45, 01, 12, 00, 1d, 31, 00, 36, 00, 37, 9e, 01, 01, 12, 00, 16, 35, 00, 2f, 00, 30, a2, 01, 01, 0d, 00, 17, b6, 01, 01, 11, 00, 14, 49, 00, 17, 00, 1d, 49, 01, 12, 00, 1d, 39, 01, 11, 00, 12, b2, 01, 01, 12, 00, 16, 3d, 01, 11, 00, 12, b6, 01, 02, 0d, 00, 17, be, 01, 03, 05, 00, 0b, c2, 01, 01, 01, 00, 02] +Raw bytes (443): 0x[01, 01, 3d, 09, 0d, 09, 57, 0d, 15, 09, 57, 0d, 15, 09, 57, 0d, 15, 09, 4f, 53, 1d, 57, 19, 0d, 15, 09, 57, 0d, 15, 09, 57, 0d, 15, 09, 53, 57, 19, 0d, 15, 09, 4f, 53, 1d, 57, 19, 0d, 15, 41, 6b, 21, 25, 41, 21, 41, 6b, 21, 25, 05, 8f, 01, 93, 01, 2d, 09, 29, 05, 09, 05, 09, 05, 93, 01, 09, 29, 05, 8f, 01, 93, 01, 2d, 09, 29, 45, a7, 01, 31, 35, 45, 31, 45, a7, 01, 31, 35, 49, bb, 01, 39, 3d, 49, 39, 49, bb, 01, 39, 3d, 11, 05, c7, 01, 05, cb, 01, 3d, cf, 01, 39, d3, 01, 35, d7, 01, 31, db, 01, 2d, df, 01, 29, e3, 01, 25, e7, 01, 21, eb, 01, 1d, ef, 01, 19, f3, 01, 15, 11, 0d, 39, 01, 3d, 01, 00, 1d, 01, 01, 09, 00, 0f, 01, 00, 12, 00, 1a, 01, 01, 09, 01, 12, 01, 01, 15, 00, 17, 01, 05, 09, 00, 0e, 05, 02, 09, 01, 11, 05, 04, 0d, 00, 1a, 09, 02, 0d, 00, 13, 09, 00, 14, 00, 1f, 0d, 00, 2f, 00, 30, 02, 00, 31, 00, 35, 02, 00, 45, 00, 4f, 02, 00, 50, 00, 62, 02, 01, 0d, 00, 13, 02, 02, 11, 00, 1c, 15, 01, 11, 00, 12, 36, 02, 11, 00, 15, 36, 02, 11, 00, 1b, 36, 01, 15, 00, 27, 4a, 02, 11, 00, 14, 36, 00, 17, 00, 1d, 36, 00, 1e, 00, 29, 19, 00, 41, 00, 42, 3e, 00, 43, 00, 47, 1d, 00, 5f, 00, 60, 4a, 01, 0d, 00, 17, 66, 01, 11, 00, 14, 41, 00, 17, 00, 1d, 41, 00, 1e, 00, 29, 21, 00, 41, 00, 42, 62, 00, 43, 00, 47, 25, 00, 60, 00, 61, 66, 01, 0d, 00, 17, 8a, 01, 04, 11, 00, 14, 7e, 00, 17, 00, 1d, 7e, 00, 1e, 00, 29, 29, 00, 42, 00, 43, 82, 01, 00, 44, 00, 48, 2d, 00, 61, 00, 62, 8a, 01, 01, 0d, 00, 17, a2, 01, 01, 11, 00, 14, 45, 00, 17, 00, 1d, 45, 01, 12, 00, 1d, 31, 00, 36, 00, 37, 9e, 01, 01, 12, 00, 16, 35, 00, 2f, 00, 30, a2, 01, 01, 0d, 00, 17, b6, 01, 01, 11, 00, 14, 49, 00, 17, 00, 1d, 49, 01, 12, 00, 1d, 39, 01, 11, 00, 12, b2, 01, 01, 12, 00, 16, 3d, 01, 11, 00, 12, b6, 01, 02, 0d, 00, 17, be, 01, 03, 05, 00, 0b, c2, 01, 01, 01, 00, 02] Number of files: 1 - file 0 => $DIR/try_error_result.rs Number of expressions: 61 -- expression 0 operands: lhs = Counter(3), rhs = Counter(4) -- expression 1 operands: lhs = Counter(3), rhs = Expression(21, Add) -- expression 2 operands: lhs = Counter(4), rhs = Counter(5) -- expression 3 operands: lhs = Counter(3), rhs = Expression(21, Add) -- expression 4 operands: lhs = Counter(4), rhs = Counter(5) -- expression 5 operands: lhs = Counter(3), rhs = Expression(21, Add) -- expression 6 operands: lhs = Counter(4), rhs = Counter(5) -- expression 7 operands: lhs = Counter(3), rhs = Expression(19, Add) +- expression 0 operands: lhs = Counter(2), rhs = Counter(3) +- expression 1 operands: lhs = Counter(2), rhs = Expression(21, Add) +- expression 2 operands: lhs = Counter(3), rhs = Counter(5) +- expression 3 operands: lhs = Counter(2), rhs = Expression(21, Add) +- expression 4 operands: lhs = Counter(3), rhs = Counter(5) +- expression 5 operands: lhs = Counter(2), rhs = Expression(21, Add) +- expression 6 operands: lhs = Counter(3), rhs = Counter(5) +- expression 7 operands: lhs = Counter(2), rhs = Expression(19, Add) - expression 8 operands: lhs = Expression(20, Add), rhs = Counter(7) - expression 9 operands: lhs = Expression(21, Add), rhs = Counter(6) -- expression 10 operands: lhs = Counter(4), rhs = Counter(5) -- expression 11 operands: lhs = Counter(3), rhs = Expression(21, Add) -- expression 12 operands: lhs = Counter(4), rhs = Counter(5) -- expression 13 operands: lhs = Counter(3), rhs = Expression(21, Add) -- expression 14 operands: lhs = Counter(4), rhs = Counter(5) -- expression 15 operands: lhs = Counter(3), rhs = Expression(20, Add) +- expression 10 operands: lhs = Counter(3), rhs = Counter(5) +- expression 11 operands: lhs = Counter(2), rhs = Expression(21, Add) +- expression 12 operands: lhs = Counter(3), rhs = Counter(5) +- expression 13 operands: lhs = Counter(2), rhs = Expression(21, Add) +- expression 14 operands: lhs = Counter(3), rhs = Counter(5) +- expression 15 operands: lhs = Counter(2), rhs = Expression(20, Add) - expression 16 operands: lhs = Expression(21, Add), rhs = Counter(6) -- expression 17 operands: lhs = Counter(4), rhs = Counter(5) -- expression 18 operands: lhs = Counter(3), rhs = Expression(19, Add) +- expression 17 operands: lhs = Counter(3), rhs = Counter(5) +- expression 18 operands: lhs = Counter(2), rhs = Expression(19, Add) - expression 19 operands: lhs = Expression(20, Add), rhs = Counter(7) - expression 20 operands: lhs = Expression(21, Add), rhs = Counter(6) -- expression 21 operands: lhs = Counter(4), rhs = Counter(5) +- expression 21 operands: lhs = Counter(3), rhs = Counter(5) - expression 22 operands: lhs = Counter(16), rhs = Expression(26, Add) - expression 23 operands: lhs = Counter(8), rhs = Counter(9) - expression 24 operands: lhs = Counter(16), rhs = Counter(8) - expression 25 operands: lhs = Counter(16), rhs = Expression(26, Add) - expression 26 operands: lhs = Counter(8), rhs = Counter(9) -- expression 27 operands: lhs = Counter(2), rhs = Expression(35, Add) +- expression 27 operands: lhs = Counter(1), rhs = Expression(35, Add) - expression 28 operands: lhs = Expression(36, Add), rhs = Counter(11) -- expression 29 operands: lhs = Counter(3), rhs = Counter(10) -- expression 30 operands: lhs = Counter(2), rhs = Counter(3) -- expression 31 operands: lhs = Counter(2), rhs = Counter(3) -- expression 32 operands: lhs = Counter(2), rhs = Expression(36, Add) -- expression 33 operands: lhs = Counter(3), rhs = Counter(10) -- expression 34 operands: lhs = Counter(2), rhs = Expression(35, Add) +- expression 29 operands: lhs = Counter(2), rhs = Counter(10) +- expression 30 operands: lhs = Counter(1), rhs = Counter(2) +- expression 31 operands: lhs = Counter(1), rhs = Counter(2) +- expression 32 operands: lhs = Counter(1), rhs = Expression(36, Add) +- expression 33 operands: lhs = Counter(2), rhs = Counter(10) +- expression 34 operands: lhs = Counter(1), rhs = Expression(35, Add) - expression 35 operands: lhs = Expression(36, Add), rhs = Counter(11) -- expression 36 operands: lhs = Counter(3), rhs = Counter(10) +- expression 36 operands: lhs = Counter(2), rhs = Counter(10) - expression 37 operands: lhs = Counter(17), rhs = Expression(41, Add) - expression 38 operands: lhs = Counter(12), rhs = Counter(13) - expression 39 operands: lhs = Counter(17), rhs = Counter(12) @@ -143,8 +143,8 @@ Number of expressions: 61 - expression 44 operands: lhs = Counter(18), rhs = Counter(14) - expression 45 operands: lhs = Counter(18), rhs = Expression(46, Add) - expression 46 operands: lhs = Counter(14), rhs = Counter(15) -- expression 47 operands: lhs = Counter(1), rhs = Counter(2) -- expression 48 operands: lhs = Expression(49, Add), rhs = Counter(2) +- expression 47 operands: lhs = Counter(4), rhs = Counter(1) +- expression 48 operands: lhs = Expression(49, Add), rhs = Counter(1) - expression 49 operands: lhs = Expression(50, Add), rhs = Counter(15) - expression 50 operands: lhs = Expression(51, Add), rhs = Counter(14) - expression 51 operands: lhs = Expression(52, Add), rhs = Counter(13) @@ -156,48 +156,48 @@ Number of expressions: 61 - expression 57 operands: lhs = Expression(58, Add), rhs = Counter(7) - expression 58 operands: lhs = Expression(59, Add), rhs = Counter(6) - expression 59 operands: lhs = Expression(60, Add), rhs = Counter(5) -- expression 60 operands: lhs = Counter(1), rhs = Counter(4) +- expression 60 operands: lhs = Counter(4), rhs = Counter(3) Number of file 0 mappings: 57 - Code(Counter(0)) at (prev + 61, 1) to (start + 0, 29) - Code(Counter(0)) at (prev + 1, 9) to (start + 0, 15) - Code(Counter(0)) at (prev + 0, 18) to (start + 0, 26) - Code(Counter(0)) at (prev + 1, 9) to (start + 1, 18) - Code(Counter(0)) at (prev + 1, 21) to (start + 0, 23) -- Code(Counter(1)) at (prev + 5, 9) to (start + 0, 14) -- Code(Counter(2)) at (prev + 2, 9) to (start + 1, 17) -- Code(Counter(2)) at (prev + 4, 13) to (start + 0, 26) -- Code(Counter(3)) at (prev + 2, 13) to (start + 0, 19) -- Code(Counter(3)) at (prev + 0, 20) to (start + 0, 31) -- Code(Counter(4)) at (prev + 0, 47) to (start + 0, 48) +- Code(Counter(0)) at (prev + 5, 9) to (start + 0, 14) +- Code(Counter(1)) at (prev + 2, 9) to (start + 1, 17) +- Code(Counter(1)) at (prev + 4, 13) to (start + 0, 26) +- Code(Counter(2)) at (prev + 2, 13) to (start + 0, 19) +- Code(Counter(2)) at (prev + 0, 20) to (start + 0, 31) +- Code(Counter(3)) at (prev + 0, 47) to (start + 0, 48) - Code(Expression(0, Sub)) at (prev + 0, 49) to (start + 0, 53) - = (c3 - c4) + = (c2 - c3) - Code(Expression(0, Sub)) at (prev + 0, 69) to (start + 0, 79) - = (c3 - c4) + = (c2 - c3) - Code(Expression(0, Sub)) at (prev + 0, 80) to (start + 0, 98) - = (c3 - c4) + = (c2 - c3) - Code(Expression(0, Sub)) at (prev + 1, 13) to (start + 0, 19) - = (c3 - c4) + = (c2 - c3) - Code(Expression(0, Sub)) at (prev + 2, 17) to (start + 0, 28) - = (c3 - c4) + = (c2 - c3) - Code(Counter(5)) at (prev + 1, 17) to (start + 0, 18) - Code(Expression(13, Sub)) at (prev + 2, 17) to (start + 0, 21) - = (c3 - (c4 + c5)) + = (c2 - (c3 + c5)) - Code(Expression(13, Sub)) at (prev + 2, 17) to (start + 0, 27) - = (c3 - (c4 + c5)) + = (c2 - (c3 + c5)) - Code(Expression(13, Sub)) at (prev + 1, 21) to (start + 0, 39) - = (c3 - (c4 + c5)) + = (c2 - (c3 + c5)) - Code(Expression(18, Sub)) at (prev + 2, 17) to (start + 0, 20) - = (c3 - (((c4 + c5) + c6) + c7)) + = (c2 - (((c3 + c5) + c6) + c7)) - Code(Expression(13, Sub)) at (prev + 0, 23) to (start + 0, 29) - = (c3 - (c4 + c5)) + = (c2 - (c3 + c5)) - Code(Expression(13, Sub)) at (prev + 0, 30) to (start + 0, 41) - = (c3 - (c4 + c5)) + = (c2 - (c3 + c5)) - Code(Counter(6)) at (prev + 0, 65) to (start + 0, 66) - Code(Expression(15, Sub)) at (prev + 0, 67) to (start + 0, 71) - = (c3 - ((c4 + c5) + c6)) + = (c2 - ((c3 + c5) + c6)) - Code(Counter(7)) at (prev + 0, 95) to (start + 0, 96) - Code(Expression(18, Sub)) at (prev + 1, 13) to (start + 0, 23) - = (c3 - (((c4 + c5) + c6) + c7)) + = (c2 - (((c3 + c5) + c6) + c7)) - Code(Expression(25, Sub)) at (prev + 1, 17) to (start + 0, 20) = (c16 - (c8 + c9)) - Code(Counter(16)) at (prev + 0, 23) to (start + 0, 29) @@ -209,17 +209,17 @@ Number of file 0 mappings: 57 - Code(Expression(25, Sub)) at (prev + 1, 13) to (start + 0, 23) = (c16 - (c8 + c9)) - Code(Expression(34, Sub)) at (prev + 4, 17) to (start + 0, 20) - = (c2 - ((c3 + c10) + c11)) + = (c1 - ((c2 + c10) + c11)) - Code(Expression(31, Sub)) at (prev + 0, 23) to (start + 0, 29) - = (c2 - c3) + = (c1 - c2) - Code(Expression(31, Sub)) at (prev + 0, 30) to (start + 0, 41) - = (c2 - c3) + = (c1 - c2) - Code(Counter(10)) at (prev + 0, 66) to (start + 0, 67) - Code(Expression(32, Sub)) at (prev + 0, 68) to (start + 0, 72) - = (c2 - (c3 + c10)) + = (c1 - (c2 + c10)) - Code(Counter(11)) at (prev + 0, 97) to (start + 0, 98) - Code(Expression(34, Sub)) at (prev + 1, 13) to (start + 0, 23) - = (c2 - ((c3 + c10) + c11)) + = (c1 - ((c2 + c10) + c11)) - Code(Expression(40, Sub)) at (prev + 1, 17) to (start + 0, 20) = (c17 - (c12 + c13)) - Code(Counter(17)) at (prev + 0, 23) to (start + 0, 29) @@ -241,8 +241,8 @@ Number of file 0 mappings: 57 - Code(Expression(45, Sub)) at (prev + 2, 13) to (start + 0, 23) = (c18 - (c14 + c15)) - Code(Expression(47, Sub)) at (prev + 3, 5) to (start + 0, 11) - = (c1 - c2) + = (c4 - c1) - Code(Expression(48, Sub)) at (prev + 1, 1) to (start + 0, 2) - = (((((((((((((c1 + c4) + c5) + c6) + c7) + c8) + c9) + c10) + c11) + c12) + c13) + c14) + c15) - c2) + = (((((((((((((c4 + c3) + c5) + c6) + c7) + c8) + c9) + c10) + c11) + c12) + c13) + c14) + c15) - c1) Highest counter ID seen: c18 diff --git a/tests/coverage/unicode.cov-map b/tests/coverage/unicode.cov-map index bbfa8b940c6d7..b118c847e8fff 100644 --- a/tests/coverage/unicode.cov-map +++ b/tests/coverage/unicode.cov-map @@ -1,5 +1,5 @@ Function name: unicode::main -Raw bytes (58): 0x[01, 01, 02, 05, 01, 01, 0d, 0a, 01, 0e, 01, 00, 0a, 02, 01, 09, 00, 0c, 05, 00, 10, 00, 1b, 02, 00, 1c, 00, 28, 01, 02, 08, 00, 23, 09, 00, 29, 00, 44, 0d, 00, 47, 02, 06, 06, 02, 05, 00, 06, 01, 02, 05, 00, 0b, 01, 01, 01, 00, 02] +Raw bytes (58): 0x[01, 01, 02, 05, 01, 01, 0d, 0a, 01, 0e, 01, 00, 0a, 02, 01, 09, 00, 0c, 01, 00, 10, 00, 1b, 02, 00, 1c, 00, 28, 01, 02, 08, 00, 23, 09, 00, 29, 00, 44, 0d, 00, 47, 02, 06, 06, 02, 05, 00, 06, 01, 02, 05, 00, 0b, 01, 01, 01, 00, 02] Number of files: 1 - file 0 => $DIR/unicode.rs Number of expressions: 2 @@ -9,7 +9,7 @@ Number of file 0 mappings: 10 - Code(Counter(0)) at (prev + 14, 1) to (start + 0, 10) - Code(Expression(0, Sub)) at (prev + 1, 9) to (start + 0, 12) = (c1 - c0) -- Code(Counter(1)) at (prev + 0, 16) to (start + 0, 27) +- Code(Counter(0)) at (prev + 0, 16) to (start + 0, 27) - Code(Expression(0, Sub)) at (prev + 0, 28) to (start + 0, 40) = (c1 - c0) - Code(Counter(0)) at (prev + 2, 8) to (start + 0, 35) diff --git a/tests/rustdoc/jump-to-def/assoc-items.rs b/tests/rustdoc/jump-to-def/assoc-items.rs index 01beb8dd7618a..a434fa7e6053e 100644 --- a/tests/rustdoc/jump-to-def/assoc-items.rs +++ b/tests/rustdoc/jump-to-def/assoc-items.rs @@ -26,8 +26,9 @@ impl C { pub fn wat() {} } -//@ has - '//a[@href="{{channel}}/core/fmt/macros/macro.Debug.html"]' 'Debug' -//@ has - '//a[@href="{{channel}}/core/cmp/macro.PartialEq.html"]' 'PartialEq' +// These two links must not change and in particular must contain `/derive.`! +//@ has - '//a[@href="{{channel}}/core/fmt/macros/derive.Debug.html"]' 'Debug' +//@ has - '//a[@href="{{channel}}/core/cmp/derive.PartialEq.html"]' 'PartialEq' #[derive(Debug, PartialEq)] pub struct Bar; impl Trait for Bar { diff --git a/tests/rustdoc/jump-to-def/derive-macro.rs b/tests/rustdoc/jump-to-def/derive-macro.rs new file mode 100644 index 0000000000000..24deac047883c --- /dev/null +++ b/tests/rustdoc/jump-to-def/derive-macro.rs @@ -0,0 +1,24 @@ +// This test ensures that the same link is generated in both intra-doc links +// and in jump to def links. + +//@ compile-flags: -Zunstable-options --generate-link-to-definition + +#![crate_name = "foo"] + +// First we check intra-doc links. +//@ has 'foo/struct.Bar.html' +//@ has - '//a[@href="{{channel}}/core/fmt/macros/derive.Debug.html"]' 'Debug' +//@ has - '//a[@href="{{channel}}/core/cmp/derive.PartialEq.html"]' 'PartialEq' + +// We also check the "title" attributes. +//@ has - '//a[@href="{{channel}}/core/fmt/macros/derive.Debug.html"]/@title' 'derive core::fmt::macros::Debug' +//@ has - '//a[@href="{{channel}}/core/cmp/derive.PartialEq.html"]/@title' 'derive core::cmp::PartialEq' + +// Then we check that they are the same in jump to def. + +/// [Debug][derive@Debug] and [PartialEq][derive@PartialEq] +//@ has 'src/foo/derive-macro.rs.html' +//@ has - '//a[@href="{{channel}}/core/fmt/macros/derive.Debug.html"]' 'Debug' +//@ has - '//a[@href="{{channel}}/core/cmp/derive.PartialEq.html"]' 'PartialEq' +#[derive(Debug, PartialEq)] +pub struct Bar; diff --git a/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/c-variadic.rs b/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/c-variadic.rs index b3da4ff0120cc..d921f5cff627f 100644 --- a/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/c-variadic.rs +++ b/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/c-variadic.rs @@ -21,6 +21,11 @@ async unsafe extern "cmse-nonsecure-entry" fn async_and_c_variadic(_: ...) { //~| ERROR functions cannot be both `async` and C-variadic } +// Async on its own is also not allowed. +async unsafe extern "cmse-nonsecure-entry" fn async_is_not_allowed() { + //~^ ERROR `impl Trait` is not allowed in `extern "cmse-nonsecure-entry"` signatures +} + // Below are the lang items that are required for a program that defines an `async` function. // Without them, the ICE that is tested for here is not reached for this target. For now they are in // this file, but they may be moved into `minicore` if/when other `#[no_core]` tests want to use diff --git a/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/c-variadic.stderr b/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/c-variadic.stderr index 948f8f5747b0e..5b0924d6f2aff 100644 --- a/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/c-variadic.stderr +++ b/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/c-variadic.stderr @@ -24,5 +24,12 @@ LL | async unsafe extern "cmse-nonsecure-entry" fn async_and_c_variadic(_: ...) | = help: only `extern "C"` and `extern "C-unwind"` functions may have a C variable argument list -error: aborting due to 3 previous errors +error[E0798]: `impl Trait` is not allowed in `extern "cmse-nonsecure-entry"` signatures + --> $DIR/c-variadic.rs:25:1 + | +LL | async unsafe extern "cmse-nonsecure-entry" fn async_is_not_allowed() { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 4 previous errors +For more information about this error, try `rustc --explain E0798`. diff --git a/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/generics.rs b/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/generics.rs index 4b320ded79432..023f50d636bfe 100644 --- a/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/generics.rs +++ b/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/generics.rs @@ -89,3 +89,13 @@ extern "cmse-nonsecure-entry" fn identity_impl_trait_nested( //~^ ERROR `impl Trait` is not allowed in `extern "cmse-nonsecure-entry"` signatures v } + +const extern "cmse-nonsecure-entry" fn const_fn_works(x: u8) -> u8 { + x +} + +const CONST: u8 = const_fn_works(0); + +fn fn_ptr_works(f: extern "cmse-nonsecure-entry" fn(_: u8) -> u8) -> u8 { + f(0) +} diff --git a/tests/ui/for/iter_from_mac_call.rs b/tests/ui/for/iter_from_mac_call.rs new file mode 100644 index 0000000000000..8df21456222c4 --- /dev/null +++ b/tests/ui/for/iter_from_mac_call.rs @@ -0,0 +1,26 @@ +macro_rules! deref { + ($e:expr) => { *$e }; +} + +fn f1<'a>(mut iter: Box>) { + for item in deref!(iter) { *item = 0 } + //~^ ERROR `dyn Iterator` is not an iterator +} + +fn f2(x: &mut i32) { + for _item in deref!(x) {} + //~^ ERROR `i32` is not an iterator +} + +struct Wrapped(i32); + +macro_rules! borrow_deref { + ($e:expr) => { &mut *$e }; +} + +fn f3<'a>(mut iter: Box>) { + for Wrapped(item) in borrow_deref!(iter) { *item = 0 } + //~^ ERROR mismatched types +} + +fn main() {} diff --git a/tests/ui/for/iter_from_mac_call.stderr b/tests/ui/for/iter_from_mac_call.stderr new file mode 100644 index 0000000000000..e62efb250e299 --- /dev/null +++ b/tests/ui/for/iter_from_mac_call.stderr @@ -0,0 +1,35 @@ +error[E0277]: `dyn Iterator` is not an iterator + --> $DIR/iter_from_mac_call.rs:6:17 + | +LL | for item in deref!(iter) { *item = 0 } + | ^^^^^^^^^^^^ the trait `IntoIterator` is not implemented for `dyn Iterator` + | + = note: the trait bound `dyn Iterator: IntoIterator` is not satisfied + = note: required for `dyn Iterator` to implement `IntoIterator` +help: consider mutably borrowing here + | +LL | for item in &mut deref!(iter) { *item = 0 } + | ++++ + +error[E0277]: `i32` is not an iterator + --> $DIR/iter_from_mac_call.rs:11:18 + | +LL | for _item in deref!(x) {} + | ^^^^^^^^^ `i32` is not an iterator + | + = help: the trait `Iterator` is not implemented for `i32` + = note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end` + = note: required for `i32` to implement `IntoIterator` + +error[E0308]: mismatched types + --> $DIR/iter_from_mac_call.rs:22:9 + | +LL | for Wrapped(item) in borrow_deref!(iter) { *item = 0 } + | ^^^^^^^^^^^^^ ------------------- this is an iterator with items of type `&mut i32` + | | + | expected `i32`, found `Wrapped` + +error: aborting due to 3 previous errors + +Some errors have detailed explanations: E0277, E0308. +For more information about an error, try `rustc --explain E0277`. diff --git a/tests/ui/range/range-to-iterator-suggestion-issue-147749.rs b/tests/ui/range/range-to-iterator-suggestion-issue-147749.rs new file mode 100644 index 0000000000000..8bcdffc136872 --- /dev/null +++ b/tests/ui/range/range-to-iterator-suggestion-issue-147749.rs @@ -0,0 +1,38 @@ +fn main() { + for x in (..4).rev() { + //~^ ERROR `RangeTo<{integer}>` is not an iterator + //~| HELP consider using a bounded `Range` by adding a concrete starting value + let _ = x; + } + + for x in (..=4).rev() { + //~^ ERROR `std::ops::RangeToInclusive<{integer}>` is not an iterator + //~| HELP consider using a bounded `RangeInclusive` by adding a concrete starting value + let _ = x; + } + + // should not suggest for `iter` method + let _v: Vec<_> = (..5).iter().collect(); + //~^ ERROR no method named `iter` found + + for _x in (..'a').rev() {} + //~^ ERROR `RangeTo` is not an iterator + //~| HELP consider using a bounded `Range` by adding a concrete starting value + + for _x in (..='a').rev() {} + //~^ ERROR `std::ops::RangeToInclusive` is not an iterator + //~| HELP consider using a bounded `RangeInclusive` by adding a concrete starting value + + for _x in (..-10).rev() {} + //~^ ERROR `RangeTo<{integer}>` is not an iterator + //~| HELP consider using a bounded `Range` by adding a concrete starting value + + for _x in (..=-10).rev() {} + //~^ ERROR `std::ops::RangeToInclusive<{integer}>` is not an iterator + //~| HELP consider using a bounded `RangeInclusive` by adding a concrete starting value + + let end_val = 10; + for _x in (..-end_val).rev() {} + //~^ ERROR `RangeTo<{integer}>` is not an iterator + //~| HELP consider using a bounded `Range` by adding a concrete starting value +} diff --git a/tests/ui/range/range-to-iterator-suggestion-issue-147749.stderr b/tests/ui/range/range-to-iterator-suggestion-issue-147749.stderr new file mode 100644 index 0000000000000..cb109de20a06a --- /dev/null +++ b/tests/ui/range/range-to-iterator-suggestion-issue-147749.stderr @@ -0,0 +1,114 @@ +error[E0599]: `RangeTo<{integer}>` is not an iterator + --> $DIR/range-to-iterator-suggestion-issue-147749.rs:2:20 + | +LL | for x in (..4).rev() { + | ^^^ `RangeTo<{integer}>` is not an iterator + | + = note: the following trait bounds were not satisfied: + `RangeTo<{integer}>: Iterator` + which is required by `&mut RangeTo<{integer}>: Iterator` + = note: you might have meant to use a bounded `Range` +help: consider using a bounded `Range` by adding a concrete starting value + | +LL | for x in (0..4).rev() { + | + + +error[E0599]: `std::ops::RangeToInclusive<{integer}>` is not an iterator + --> $DIR/range-to-iterator-suggestion-issue-147749.rs:8:21 + | +LL | for x in (..=4).rev() { + | ^^^ `std::ops::RangeToInclusive<{integer}>` is not an iterator + | + = note: the following trait bounds were not satisfied: + `std::ops::RangeToInclusive<{integer}>: Iterator` + which is required by `&mut std::ops::RangeToInclusive<{integer}>: Iterator` + = note: you might have meant to use a bounded `RangeInclusive` +help: consider using a bounded `RangeInclusive` by adding a concrete starting value + | +LL | for x in (0..=4).rev() { + | + + +error[E0599]: no method named `iter` found for struct `RangeTo` in the current scope + --> $DIR/range-to-iterator-suggestion-issue-147749.rs:15:28 + | +LL | let _v: Vec<_> = (..5).iter().collect(); + | ^^^^ method not found in `RangeTo<{integer}>` + +error[E0599]: `RangeTo` is not an iterator + --> $DIR/range-to-iterator-suggestion-issue-147749.rs:18:23 + | +LL | for _x in (..'a').rev() {} + | ^^^ `RangeTo` is not an iterator + | + = note: the following trait bounds were not satisfied: + `RangeTo: Iterator` + which is required by `&mut RangeTo: Iterator` + = note: you might have meant to use a bounded `Range` +help: consider using a bounded `Range` by adding a concrete starting value + | +LL | for _x in (/* start */..'a').rev() {} + | +++++++++++ + +error[E0599]: `std::ops::RangeToInclusive` is not an iterator + --> $DIR/range-to-iterator-suggestion-issue-147749.rs:22:24 + | +LL | for _x in (..='a').rev() {} + | ^^^ `std::ops::RangeToInclusive` is not an iterator + | + = note: the following trait bounds were not satisfied: + `std::ops::RangeToInclusive: Iterator` + which is required by `&mut std::ops::RangeToInclusive: Iterator` + = note: you might have meant to use a bounded `RangeInclusive` +help: consider using a bounded `RangeInclusive` by adding a concrete starting value + | +LL | for _x in (/* start */..='a').rev() {} + | +++++++++++ + +error[E0599]: `RangeTo<{integer}>` is not an iterator + --> $DIR/range-to-iterator-suggestion-issue-147749.rs:26:23 + | +LL | for _x in (..-10).rev() {} + | ^^^ `RangeTo<{integer}>` is not an iterator + | + = note: the following trait bounds were not satisfied: + `RangeTo<{integer}>: Iterator` + which is required by `&mut RangeTo<{integer}>: Iterator` + = note: you might have meant to use a bounded `Range` +help: consider using a bounded `Range` by adding a concrete starting value + | +LL | for _x in (/* start */..-10).rev() {} + | +++++++++++ + +error[E0599]: `std::ops::RangeToInclusive<{integer}>` is not an iterator + --> $DIR/range-to-iterator-suggestion-issue-147749.rs:30:24 + | +LL | for _x in (..=-10).rev() {} + | ^^^ `std::ops::RangeToInclusive<{integer}>` is not an iterator + | + = note: the following trait bounds were not satisfied: + `std::ops::RangeToInclusive<{integer}>: Iterator` + which is required by `&mut std::ops::RangeToInclusive<{integer}>: Iterator` + = note: you might have meant to use a bounded `RangeInclusive` +help: consider using a bounded `RangeInclusive` by adding a concrete starting value + | +LL | for _x in (/* start */..=-10).rev() {} + | +++++++++++ + +error[E0599]: `RangeTo<{integer}>` is not an iterator + --> $DIR/range-to-iterator-suggestion-issue-147749.rs:35:28 + | +LL | for _x in (..-end_val).rev() {} + | ^^^ `RangeTo<{integer}>` is not an iterator + | + = note: the following trait bounds were not satisfied: + `RangeTo<{integer}>: Iterator` + which is required by `&mut RangeTo<{integer}>: Iterator` + = note: you might have meant to use a bounded `Range` +help: consider using a bounded `Range` by adding a concrete starting value + | +LL | for _x in (/* start */..-end_val).rev() {} + | +++++++++++ + +error: aborting due to 8 previous errors + +For more information about this error, try `rustc --explain E0599`. diff --git a/tests/ui/traits/suggest-dereferences/invalid-suggest-deref-issue-127590.rs b/tests/ui/traits/suggest-dereferences/invalid-suggest-deref-issue-127590.rs index a71657316ae60..ad1ff56190c2f 100644 --- a/tests/ui/traits/suggest-dereferences/invalid-suggest-deref-issue-127590.rs +++ b/tests/ui/traits/suggest-dereferences/invalid-suggest-deref-issue-127590.rs @@ -6,6 +6,7 @@ fn main() { for (src, dest) in std::iter::zip(fields.iter(), &variant.iter()) { //~^ ERROR `&std::slice::Iter<'_, {integer}>` is not an iterator //~| ERROR `&std::slice::Iter<'_, {integer}>` is not an iterator + //~| ERROR `&std::slice::Iter<'_, {integer}>` is not an iterator eprintln!("{} {}", src, dest); } @@ -13,6 +14,7 @@ fn main() { for (src, dest) in std::iter::zip(fields.iter(), &variant.iter().clone()) { //~^ ERROR `&std::slice::Iter<'_, {integer}>` is not an iterator //~| ERROR `&std::slice::Iter<'_, {integer}>` is not an iterator + //~| ERROR `&std::slice::Iter<'_, {integer}>` is not an iterator eprintln!("{} {}", src, dest); } } diff --git a/tests/ui/traits/suggest-dereferences/invalid-suggest-deref-issue-127590.stderr b/tests/ui/traits/suggest-dereferences/invalid-suggest-deref-issue-127590.stderr index 103fb7bbfe11c..07a54d574df49 100644 --- a/tests/ui/traits/suggest-dereferences/invalid-suggest-deref-issue-127590.stderr +++ b/tests/ui/traits/suggest-dereferences/invalid-suggest-deref-issue-127590.stderr @@ -30,7 +30,7 @@ help: the trait `Iterator` is implemented for `std::slice::Iter<'_, T>` = note: this error originates in the macro `iterator` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: `&std::slice::Iter<'_, {integer}>` is not an iterator - --> $DIR/invalid-suggest-deref-issue-127590.rs:13:54 + --> $DIR/invalid-suggest-deref-issue-127590.rs:14:54 | LL | for (src, dest) in std::iter::zip(fields.iter(), &variant.iter().clone()) { | -------------- ^^^^^^^^^^^^^^^^^^^^^^^ `&std::slice::Iter<'_, {integer}>` is not an iterator @@ -48,7 +48,7 @@ LL + for (src, dest) in std::iter::zip(fields.iter(), variant.iter().clone() | error[E0277]: `&std::slice::Iter<'_, {integer}>` is not an iterator - --> $DIR/invalid-suggest-deref-issue-127590.rs:13:24 + --> $DIR/invalid-suggest-deref-issue-127590.rs:14:24 | LL | for (src, dest) in std::iter::zip(fields.iter(), &variant.iter().clone()) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `&std::slice::Iter<'_, {integer}>` is not an iterator @@ -60,6 +60,30 @@ help: the trait `Iterator` is implemented for `std::slice::Iter<'_, T>` = note: required for `Zip, &std::slice::Iter<'_, {integer}>>` to implement `IntoIterator` = note: this error originates in the macro `iterator` (in Nightly builds, run with -Z macro-backtrace for more info) -error: aborting due to 4 previous errors +error[E0277]: `&std::slice::Iter<'_, {integer}>` is not an iterator + --> $DIR/invalid-suggest-deref-issue-127590.rs:6:24 + | +LL | for (src, dest) in std::iter::zip(fields.iter(), &variant.iter()) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `&std::slice::Iter<'_, {integer}>` is not an iterator + | + = help: the trait `Iterator` is not implemented for `&std::slice::Iter<'_, {integer}>` +help: the trait `Iterator` is implemented for `std::slice::Iter<'_, T>` + --> $SRC_DIR/core/src/slice/iter.rs:LL:COL + = note: required for `&std::slice::Iter<'_, {integer}>` to implement `IntoIterator` + = note: this error originates in the macro `iterator` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0277]: `&std::slice::Iter<'_, {integer}>` is not an iterator + --> $DIR/invalid-suggest-deref-issue-127590.rs:14:24 + | +LL | for (src, dest) in std::iter::zip(fields.iter(), &variant.iter().clone()) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `&std::slice::Iter<'_, {integer}>` is not an iterator + | + = help: the trait `Iterator` is not implemented for `&std::slice::Iter<'_, {integer}>` +help: the trait `Iterator` is implemented for `std::slice::Iter<'_, T>` + --> $SRC_DIR/core/src/slice/iter.rs:LL:COL + = note: required for `&std::slice::Iter<'_, {integer}>` to implement `IntoIterator` + = note: this error originates in the macro `iterator` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: aborting due to 6 previous errors For more information about this error, try `rustc --explain E0277`.