From 7c89cc4a6f68a9c544ff1b000c8f7ef1c3535278 Mon Sep 17 00:00:00 2001 From: Joshua Nelson Date: Thu, 25 Mar 2021 11:40:32 -0400 Subject: [PATCH 01/21] Add SharedResource abstraction and use it in write_shared This cleans up the code quite a bit, and also makes the next commit much easier. --- src/librustdoc/html/render/context.rs | 13 +- src/librustdoc/html/render/write_shared.rs | 217 +++++++++++---------- 2 files changed, 115 insertions(+), 115 deletions(-) diff --git a/src/librustdoc/html/render/context.rs b/src/librustdoc/html/render/context.rs index 64d413a5f3119..468bd9997a64a 100644 --- a/src/librustdoc/html/render/context.rs +++ b/src/librustdoc/html/render/context.rs @@ -79,17 +79,6 @@ crate struct Context<'tcx> { rustc_data_structures::static_assert_size!(Context<'_>, 152); impl<'tcx> Context<'tcx> { - pub(super) fn path(&self, filename: &str) -> PathBuf { - // We use splitn vs Path::extension here because we might get a filename - // like `style.min.css` and we want to process that into - // `style-suffix.min.css`. Path::extension would just return `css` - // which would result in `style.min-suffix.css` which isn't what we - // want. - let (base, ext) = filename.split_once('.').unwrap(); - let filename = format!("{}{}.{}", base, self.shared.resource_suffix, ext); - self.dst.join(&filename) - } - pub(super) fn tcx(&self) -> TyCtxt<'tcx> { self.shared.tcx } @@ -487,7 +476,7 @@ impl<'tcx> FormatRenderer<'tcx> for Context<'tcx> { |buf: &mut Buffer| all.print(buf), &self.shared.style_files, ); - self.shared.fs.write(&final_file, v.as_bytes())?; + self.shared.fs.write(final_file, v.as_bytes())?; // Generating settings page. page.title = "Rustdoc settings"; diff --git a/src/librustdoc/html/render/write_shared.rs b/src/librustdoc/html/render/write_shared.rs index 501d8e8e02e84..2ab423c238c40 100644 --- a/src/librustdoc/html/render/write_shared.rs +++ b/src/librustdoc/html/render/write_shared.rs @@ -14,7 +14,7 @@ use serde::Serialize; use super::{collect_paths_for_type, ensure_trailing_slash, Context, BASIC_KEYWORDS}; use crate::clean::Crate; use crate::config::RenderOptions; -use crate::docfs::{DocFS, PathError}; +use crate::docfs::PathError; use crate::error::Error; use crate::formats::FormatRenderer; use crate::html::{layout, static_files}; @@ -40,6 +40,81 @@ crate static FILES_UNVERSIONED: Lazy> = Lazy::new(|| { } }); +enum SharedResource<'a> { + /// This file will never change, no matter what toolchain is used to build it. + /// + /// It does not have a resource suffix. + Unversioned { name: &'a str }, + /// This file may change depending on the toolchain. + /// + /// It has a resource suffix. + ToolchainSpecific { basename: &'a str }, + /// This file may change for any crate within a build. + /// + /// This differs from normal crate-specific files because it has a resource suffix. + CrateSpecific { basename: &'a str }, +} + +impl SharedResource<'_> { + fn extension(&self) -> Option<&OsStr> { + use SharedResource::*; + match self { + Unversioned { name } + | ToolchainSpecific { basename: name } + | CrateSpecific { basename: name } => Path::new(name).extension(), + } + } + + fn path(&self, cx: &Context<'_>) -> PathBuf { + match self { + SharedResource::Unversioned { name } => cx.dst.join(name), + SharedResource::ToolchainSpecific { basename } => cx.suffix_path(basename), + SharedResource::CrateSpecific { basename } => cx.suffix_path(basename), + } + } +} + +impl Context<'_> { + fn suffix_path(&self, filename: &str) -> PathBuf { + // We use splitn vs Path::extension here because we might get a filename + // like `style.min.css` and we want to process that into + // `style-suffix.min.css`. Path::extension would just return `css` + // which would result in `style.min-suffix.css` which isn't what we + // want. + let (base, ext) = filename.split_once('.').unwrap(); + let filename = format!("{}{}.{}", base, self.shared.resource_suffix, ext); + self.dst.join(&filename) + } + + fn write_shared>(&self, resource: SharedResource<'_>, contents: C) -> Result<(), Error> + { + self.shared.fs.write(resource.path(self), contents) + } + + fn write_minify( + &self, + resource: SharedResource<'_>, + contents: &str, + minify: bool, + ) -> Result<(), Error> { + let tmp; + let contents = if minify { + tmp = if resource.extension() == Some(&OsStr::new("css")) { + minifier::css::minify(contents).map_err(|e| { + Error::new(format!("failed to minify CSS file: {}", e), resource.path(self)) + })? + } else { + minifier::js::minify(contents) + }; + tmp.as_bytes() + } else { + contents.as_bytes() + }; + + self.write_shared(resource, contents) + } +} + pub(super) fn write_shared( cx: &Context<'_>, krate: &Crate, @@ -52,27 +127,22 @@ pub(super) fn write_shared( let lock_file = cx.dst.join(".lock"); let _lock = try_err!(flock::Lock::new(&lock_file, true, true, true), &lock_file); + // The weird `: &_` is to work around a borrowck bug: https://github.com/rust-lang/rust/issues/41078#issuecomment-293646723 + let write_minify = |p, c: &_| { + cx.write_minify( + SharedResource::ToolchainSpecific { basename: p }, + c, + options.enable_minification, + ) + }; + let write_toolchain = + |p: &_, c: &_| cx.write_shared(SharedResource::ToolchainSpecific { basename: p }, c); + // Add all the static files. These may already exist, but we just // overwrite them anyway to make sure that they're fresh and up-to-date. - - write_minify( - &cx.shared.fs, - cx.path("rustdoc.css"), - static_files::RUSTDOC_CSS, - options.enable_minification, - )?; - write_minify( - &cx.shared.fs, - cx.path("settings.css"), - static_files::SETTINGS_CSS, - options.enable_minification, - )?; - write_minify( - &cx.shared.fs, - cx.path("noscript.css"), - static_files::NOSCRIPT_CSS, - options.enable_minification, - )?; + write_minify("rustdoc.css", static_files::RUSTDOC_CSS)?; + write_minify("settings.css", static_files::SETTINGS_CSS)?; + write_minify("noscript.css", static_files::NOSCRIPT_CSS)?; // To avoid "light.css" to be overwritten, we'll first run over the received themes and only // then we'll run over the "official" styles. @@ -85,106 +155,66 @@ pub(super) fn write_shared( // Handle the official themes match theme { - "light" => write_minify( - &cx.shared.fs, - cx.path("light.css"), - static_files::themes::LIGHT, - options.enable_minification, - )?, - "dark" => write_minify( - &cx.shared.fs, - cx.path("dark.css"), - static_files::themes::DARK, - options.enable_minification, - )?, - "ayu" => write_minify( - &cx.shared.fs, - cx.path("ayu.css"), - static_files::themes::AYU, - options.enable_minification, - )?, + "light" => write_minify("light.css", static_files::themes::LIGHT)?, + "dark" => write_minify("dark.css", static_files::themes::DARK)?, + "ayu" => write_minify("ayu.css", static_files::themes::AYU)?, _ => { // Handle added third-party themes let content = try_err!(fs::read(&entry.path), &entry.path); - cx.shared - .fs - .write(cx.path(&format!("{}.{}", theme, extension)), content.as_slice())?; + // This is not exactly right: if compiled a second time with the same toolchain but different CLI args, the file could be different. + // But docs.rs doesn't use this, so hopefully the issue doesn't come up. + write_toolchain(&format!("{}.{}", theme, extension), content.as_slice())?; } }; themes.insert(theme.to_owned()); } - let write = |p, c| cx.shared.fs.write(p, c); if (*cx.shared).layout.logo.is_empty() { - write(cx.path("rust-logo.png"), static_files::RUST_LOGO)?; + write_toolchain("rust-logo.png", static_files::RUST_LOGO)?; } if (*cx.shared).layout.favicon.is_empty() { - write(cx.path("favicon.svg"), static_files::RUST_FAVICON_SVG)?; - write(cx.path("favicon-16x16.png"), static_files::RUST_FAVICON_PNG_16)?; - write(cx.path("favicon-32x32.png"), static_files::RUST_FAVICON_PNG_32)?; + write_toolchain("favicon.svg", static_files::RUST_FAVICON_SVG)?; + write_toolchain("favicon-16x16.png", static_files::RUST_FAVICON_PNG_16)?; + write_toolchain("favicon-32x32.png", static_files::RUST_FAVICON_PNG_32)?; } - write(cx.path("brush.svg"), static_files::BRUSH_SVG)?; - write(cx.path("wheel.svg"), static_files::WHEEL_SVG)?; - write(cx.path("down-arrow.svg"), static_files::DOWN_ARROW_SVG)?; + write_toolchain("brush.svg", static_files::BRUSH_SVG)?; + write_toolchain("wheel.svg", static_files::WHEEL_SVG)?; + write_toolchain("down-arrow.svg", static_files::DOWN_ARROW_SVG)?; let mut themes: Vec<&String> = themes.iter().collect(); themes.sort(); write_minify( - &cx.shared.fs, - cx.path("main.js"), + "main.js", &static_files::MAIN_JS.replace( "/* INSERT THEMES HERE */", &format!(" = {}", serde_json::to_string(&themes).unwrap()), ), - options.enable_minification, - )?; - write_minify( - &cx.shared.fs, - cx.path("settings.js"), - static_files::SETTINGS_JS, - options.enable_minification, )?; + write_minify("settings.js", static_files::SETTINGS_JS)?; if cx.shared.include_sources { - write_minify( - &cx.shared.fs, - cx.path("source-script.js"), - static_files::sidebar::SOURCE_SCRIPT, - options.enable_minification, - )?; + write_minify("source-script.js", static_files::sidebar::SOURCE_SCRIPT)?; } { write_minify( - &cx.shared.fs, - cx.path("storage.js"), + "storage.js", &format!( "var resourcesSuffix = \"{}\";{}", cx.shared.resource_suffix, static_files::STORAGE_JS ), - options.enable_minification, )?; } if let Some(ref css) = cx.shared.layout.css_file_extension { - let out = cx.path("theme.css"); let buffer = try_err!(fs::read_to_string(css), css); - if !options.enable_minification { - cx.shared.fs.write(&out, &buffer)?; - } else { - write_minify(&cx.shared.fs, out, &buffer, options.enable_minification)?; - } + write_minify("theme.css", &buffer)?; } - write_minify( - &cx.shared.fs, - cx.path("normalize.css"), - static_files::NORMALIZE_CSS, - options.enable_minification, - )?; - for (file, contents) in &*FILES_UNVERSIONED { - write(cx.dst.join(file), contents)?; + write_minify("normalize.css", static_files::NORMALIZE_CSS)?; + for (name, contents) in &*FILES_UNVERSIONED { + cx.write_shared(SharedResource::Unversioned { name }, contents)?; } fn collect(path: &Path, krate: &str, key: &str) -> io::Result<(Vec, Vec)> { @@ -324,7 +354,7 @@ pub(super) fn write_shared( "var N = null;var sourcesIndex = {{}};\n{}\ncreateSourceSidebar();\n", all_sources.join("\n") ); - cx.shared.fs.write(&dst, v.as_bytes())?; + cx.write_shared(SharedResource::CrateSpecific { basename: "source-files.js" }, v)?; } // Update the search index and crate list. @@ -341,13 +371,12 @@ pub(super) fn write_shared( let mut v = String::from("var searchIndex = JSON.parse('{\\\n"); v.push_str(&all_indexes.join(",\\\n")); v.push_str("\\\n}');\ninitSearch(searchIndex);"); - cx.shared.fs.write(&dst, &v)?; + cx.write_shared(SharedResource::CrateSpecific { basename: "search-index.js" }, v)?; } - let crate_list_dst = cx.dst.join(&format!("crates{}.js", cx.shared.resource_suffix)); let crate_list = format!("window.ALL_CRATES = [{}];", krates.iter().map(|k| format!("\"{}\"", k)).join(",")); - cx.shared.fs.write(&crate_list_dst, &crate_list)?; + cx.write_shared(SharedResource::CrateSpecific { basename: "crates.js" }, crate_list)?; if options.enable_index_page { if let Some(index_page) = options.index_page.clone() { @@ -481,21 +510,3 @@ pub(super) fn write_shared( } Ok(()) } - -fn write_minify( - fs: &DocFS, - dst: PathBuf, - contents: &str, - enable_minification: bool, -) -> Result<(), Error> { - if enable_minification { - if dst.extension() == Some(&OsStr::new("css")) { - let res = try_none!(minifier::css::minify(contents).ok(), &dst); - fs.write(dst, res.as_bytes()) - } else { - fs.write(dst, minifier::js::minify(contents).as_bytes()) - } - } else { - fs.write(dst, contents.as_bytes()) - } -} From f77ebd4ffaea7fc5af49425cafefe141e7458cc3 Mon Sep 17 00:00:00 2001 From: Joshua Nelson Date: Thu, 25 Mar 2021 12:46:35 -0400 Subject: [PATCH 02/21] Add unstable option to only emit shared/crate-specific files The intended use case is for docs.rs, which can now copy exactly the files it cares about, rather than having to guess based on whether they have a resource suffix or not. In particular, some files have a resource suffix but cannot be shared between crates: https://github.com/rust-lang/docs.rs/pull/1312#issuecomment-798783688 The end goal is to fix https://github.com/rust-lang/docs.rs/issues/1327 by reverting https://github.com/rust-lang/docs.rs/pull/1324. This obsoletes `--print=unversioned-files`, which I plan to remove as soon as docs.rs stops using it. --- src/librustdoc/config.rs | 43 ++++++++++++++++++ src/librustdoc/formats/renderer.rs | 5 +++ src/librustdoc/html/render/context.rs | 5 ++- src/librustdoc/html/render/write_shared.rs | 47 +++++++++++++++----- src/librustdoc/lib.rs | 8 ++++ src/test/run-make/emit-shared-files/Makefile | 32 +++++++++++++ src/test/run-make/emit-shared-files/x.rs | 1 + 7 files changed, 129 insertions(+), 12 deletions(-) create mode 100644 src/test/run-make/emit-shared-files/Makefile create mode 100644 src/test/run-make/emit-shared-files/x.rs diff --git a/src/librustdoc/config.rs b/src/librustdoc/config.rs index ecb6378f31fb4..a7a2db6210005 100644 --- a/src/librustdoc/config.rs +++ b/src/librustdoc/config.rs @@ -3,6 +3,7 @@ use std::convert::TryFrom; use std::ffi::OsStr; use std::fmt; use std::path::PathBuf; +use std::str::FromStr; use rustc_data_structures::fx::FxHashMap; use rustc_session::config::{self, parse_crate_types_from_list, parse_externs, CrateType}; @@ -266,6 +267,34 @@ crate struct RenderOptions { /// If `true`, generate a JSON file in the crate folder instead of HTML redirection files. crate generate_redirect_map: bool, crate unstable_features: rustc_feature::UnstableFeatures, + crate emit: Vec, +} + +#[derive(Copy, Clone, Debug, PartialEq, Eq)] +crate enum EmitType { + Unversioned, + Toolchain, + CrateSpecific, +} + +impl FromStr for EmitType { + type Err = (); + + fn from_str(s: &str) -> Result { + use EmitType::*; + match s { + "unversioned-shared-resources" => Ok(Unversioned), + "toolchain-shared-resources" => Ok(Toolchain), + "crate-specific" => Ok(CrateSpecific), + _ => Err(()), + } + } +} + +impl RenderOptions { + crate fn should_emit_crate(&self) -> bool { + self.emit.is_empty() || self.emit.contains(&EmitType::CrateSpecific) + } } impl Options { @@ -334,6 +363,19 @@ impl Options { // check for deprecated options check_deprecated_options(&matches, &diag); + let mut emit = Vec::new(); + for list in matches.opt_strs("emit") { + for kind in list.split(',') { + match kind.parse() { + Ok(kind) => emit.push(kind), + Err(()) => { + diag.err(&format!("unrecognized emission type: {}", kind)); + return Err(1); + } + } + } + } + let to_check = matches.opt_strs("check-theme"); if !to_check.is_empty() { let paths = theme::load_css_paths(static_files::themes::LIGHT.as_bytes()); @@ -641,6 +683,7 @@ impl Options { unstable_features: rustc_feature::UnstableFeatures::from_environment( crate_name.as_deref(), ), + emit, }, crate_name, output_format, diff --git a/src/librustdoc/formats/renderer.rs b/src/librustdoc/formats/renderer.rs index 9dcef3a20d6c0..f0b390add73d5 100644 --- a/src/librustdoc/formats/renderer.rs +++ b/src/librustdoc/formats/renderer.rs @@ -58,10 +58,15 @@ crate fn run_format<'tcx, T: FormatRenderer<'tcx>>( ) -> Result<(), Error> { let prof = &tcx.sess.prof; + let emit_crate = options.should_emit_crate(); let (mut format_renderer, krate) = prof .extra_verbose_generic_activity("create_renderer", T::descr()) .run(|| T::init(krate, options, edition, cache, tcx))?; + if !emit_crate { + return Ok(()); + } + // Render the crate documentation let crate_name = krate.name; let mut work = vec![(format_renderer.make_child_renderer(), krate.module)]; diff --git a/src/librustdoc/html/render/context.rs b/src/librustdoc/html/render/context.rs index 468bd9997a64a..17cedeb5a511a 100644 --- a/src/librustdoc/html/render/context.rs +++ b/src/librustdoc/html/render/context.rs @@ -288,6 +288,7 @@ impl<'tcx> FormatRenderer<'tcx> for Context<'tcx> { ) -> Result<(Self, clean::Crate), Error> { // need to save a copy of the options for rendering the index page let md_opts = options.clone(); + let emit_crate = options.should_emit_crate(); let RenderOptions { output, external_html, @@ -393,7 +394,9 @@ impl<'tcx> FormatRenderer<'tcx> for Context<'tcx> { let dst = output; scx.ensure_dir(&dst)?; - krate = sources::render(&dst, &mut scx, krate)?; + if emit_crate { + krate = sources::render(&dst, &mut scx, krate)?; + } // Build our search index let index = build_index(&krate, &mut cache, tcx); diff --git a/src/librustdoc/html/render/write_shared.rs b/src/librustdoc/html/render/write_shared.rs index 2ab423c238c40..af346bb82256e 100644 --- a/src/librustdoc/html/render/write_shared.rs +++ b/src/librustdoc/html/render/write_shared.rs @@ -13,7 +13,7 @@ use serde::Serialize; use super::{collect_paths_for_type, ensure_trailing_slash, Context, BASIC_KEYWORDS}; use crate::clean::Crate; -use crate::config::RenderOptions; +use crate::config::{EmitType, RenderOptions}; use crate::docfs::PathError; use crate::error::Error; use crate::formats::FormatRenderer; @@ -72,6 +72,18 @@ impl SharedResource<'_> { SharedResource::CrateSpecific { basename } => cx.suffix_path(basename), } } + + fn should_emit(&self, emit: &[EmitType]) -> bool { + if emit.is_empty() { + return true; + } + let kind = match self { + SharedResource::Unversioned { .. } => EmitType::Unversioned, + SharedResource::ToolchainSpecific { .. } => EmitType::Toolchain, + SharedResource::CrateSpecific { .. } => EmitType::CrateSpecific, + }; + emit.contains(&kind) + } } impl Context<'_> { @@ -86,9 +98,17 @@ impl Context<'_> { self.dst.join(&filename) } - fn write_shared>(&self, resource: SharedResource<'_>, contents: C) -> Result<(), Error> - { - self.shared.fs.write(resource.path(self), contents) + fn write_shared>( + &self, + resource: SharedResource<'_>, + contents: C, + emit: &[EmitType], + ) -> Result<(), Error> { + if resource.should_emit(emit) { + self.shared.fs.write(resource.path(self), contents) + } else { + Ok(()) + } } fn write_minify( @@ -96,6 +116,7 @@ impl Context<'_> { resource: SharedResource<'_>, contents: &str, minify: bool, + emit: &[EmitType], ) -> Result<(), Error> { let tmp; let contents = if minify { @@ -111,7 +132,7 @@ impl Context<'_> { contents.as_bytes() }; - self.write_shared(resource, contents) + self.write_shared(resource, contents, emit) } } @@ -133,10 +154,14 @@ pub(super) fn write_shared( SharedResource::ToolchainSpecific { basename: p }, c, options.enable_minification, + &options.emit, ) }; - let write_toolchain = - |p: &_, c: &_| cx.write_shared(SharedResource::ToolchainSpecific { basename: p }, c); + let write_toolchain = |p: &_, c: &_| { + cx.write_shared(SharedResource::ToolchainSpecific { basename: p }, c, &options.emit) + }; + let write_crate = + |p, c: &_| cx.write_shared(SharedResource::CrateSpecific { basename: p }, c, &options.emit); // Add all the static files. These may already exist, but we just // overwrite them anyway to make sure that they're fresh and up-to-date. @@ -214,7 +239,7 @@ pub(super) fn write_shared( } write_minify("normalize.css", static_files::NORMALIZE_CSS)?; for (name, contents) in &*FILES_UNVERSIONED { - cx.write_shared(SharedResource::Unversioned { name }, contents)?; + cx.write_shared(SharedResource::Unversioned { name }, contents, &options.emit)?; } fn collect(path: &Path, krate: &str, key: &str) -> io::Result<(Vec, Vec)> { @@ -354,7 +379,7 @@ pub(super) fn write_shared( "var N = null;var sourcesIndex = {{}};\n{}\ncreateSourceSidebar();\n", all_sources.join("\n") ); - cx.write_shared(SharedResource::CrateSpecific { basename: "source-files.js" }, v)?; + write_crate("source-files.js", &v)?; } // Update the search index and crate list. @@ -371,12 +396,12 @@ pub(super) fn write_shared( let mut v = String::from("var searchIndex = JSON.parse('{\\\n"); v.push_str(&all_indexes.join(",\\\n")); v.push_str("\\\n}');\ninitSearch(searchIndex);"); - cx.write_shared(SharedResource::CrateSpecific { basename: "search-index.js" }, v)?; + write_crate("search-index.js", &v)?; } let crate_list = format!("window.ALL_CRATES = [{}];", krates.iter().map(|k| format!("\"{}\"", k)).join(",")); - cx.write_shared(SharedResource::CrateSpecific { basename: "crates.js" }, crate_list)?; + write_crate("crates.js", &crate_list)?; if options.enable_index_page { if let Some(index_page) = options.index_page.clone() { diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs index dabc21e3a447c..ebdd56611db71 100644 --- a/src/librustdoc/lib.rs +++ b/src/librustdoc/lib.rs @@ -527,6 +527,14 @@ fn opts() -> Vec { unstable("print", |o| { o.optmulti("", "print", "Rustdoc information to print on stdout", "[unversioned-files]") }), + unstable("emit", |o| { + o.optmulti( + "", + "emit", + "Comma separated list of types of output for rustdoc to emit", + "[unversioned-shared-resources,toolchain-shared-resources,crate-specific]", + ) + }), ] } diff --git a/src/test/run-make/emit-shared-files/Makefile b/src/test/run-make/emit-shared-files/Makefile new file mode 100644 index 0000000000000..06358f6eb2c98 --- /dev/null +++ b/src/test/run-make/emit-shared-files/Makefile @@ -0,0 +1,32 @@ +-include ../../run-make-fulldeps/tools.mk + +CRATE_ONLY = $(TMPDIR)/crate-only +TOOLCHAIN_ONLY = $(TMPDIR)/toolchain-only +ALL_SHARED = $(TMPDIR)/all-shared + +all: crate-only toolchain-only all-shared + +crate-only: + $(RUSTDOC) -Z unstable-options --emit=crate-specific --output $(CRATE_ONLY) --resource-suffix=-xxx x.rs + [ -e $(CRATE_ONLY)/search-index-xxx.js ] + [ -e $(CRATE_ONLY)/settings.html ] + [ -e $(CRATE_ONLY)/x/all.html ] + [ -e $(CRATE_ONLY)/x/index.html ] + ! [ -e $(CRATE_ONLY)/storage-xxx.js ] + ! [ -e $(CRATE_ONLY)/SourceSerifPro-It.ttf.woff ] + +toolchain-only: + $(RUSTDOC) -Z unstable-options --emit=toolchain-shared-resources --output $(TOOLCHAIN_ONLY) --resource-suffix=-xxx x.rs + [ -e $(TOOLCHAIN_ONLY)/storage-xxx.js ] + ! [ -e $(TOOLCHAIN_ONLY)/SourceSerifPro-It.ttf.woff ] + ! [ -e $(TOOLCHAIN_ONLY)/search-index-xxx.js ] + ! [ -e $(TOOLCHAIN_ONLY)/x/index.html ] + +all-shared: + $(RUSTDOC) -Z unstable-options --emit=toolchain-shared-resources,unversioned-shared-resources --output $(ALL_SHARED) --resource-suffix=-xxx x.rs + [ -e $(ALL_SHARED)/storage-xxx.js ] + [ -e $(ALL_SHARED)/SourceSerifPro-It.ttf.woff ] + ! [ -e $(ALL_SHARED)/search-index-xxx.js ] + ! [ -e $(ALL_SHARED)/settings.html ] + ! [ -e $(ALL_SHARED)/x ] + ! [ -e $(ALL_SHARED)/src ] diff --git a/src/test/run-make/emit-shared-files/x.rs b/src/test/run-make/emit-shared-files/x.rs new file mode 100644 index 0000000000000..5df7576133a68 --- /dev/null +++ b/src/test/run-make/emit-shared-files/x.rs @@ -0,0 +1 @@ +// nothing to see here From 0dbed6161a94aeb84fdae332f5b93476b6626515 Mon Sep 17 00:00:00 2001 From: Christiaan Dirkx Date: Fri, 12 Mar 2021 21:32:44 +0100 Subject: [PATCH 03/21] Rework `std::sys::windows::alloc` Add documentation to the system functions and `SAFETY` comments. Refactored helper functions, fixing the correctness of `get_header`. --- library/std/src/sys/windows/alloc.rs | 189 ++++++++++++++++++--- library/std/src/sys/windows/alloc/tests.rs | 9 + library/std/src/sys/windows/c.rs | 7 - 3 files changed, 173 insertions(+), 32 deletions(-) create mode 100644 library/std/src/sys/windows/alloc/tests.rs diff --git a/library/std/src/sys/windows/alloc.rs b/library/std/src/sys/windows/alloc.rs index 99b4d6c72a0e3..8ef256a06d4ac 100644 --- a/library/std/src/sys/windows/alloc.rs +++ b/library/std/src/sys/windows/alloc.rs @@ -1,51 +1,179 @@ +#![deny(unsafe_op_in_unsafe_fn)] + use crate::alloc::{GlobalAlloc, Layout, System}; +use crate::ptr; use crate::sys::c; use crate::sys_common::alloc::{realloc_fallback, MIN_ALIGN}; -#[repr(C)] -struct Header(*mut u8); +#[cfg(test)] +mod tests; -unsafe fn get_header<'a>(ptr: *mut u8) -> &'a mut Header { - &mut *(ptr as *mut Header).offset(-1) -} +// Heap memory management on Windows is done by using the system Heap API (heapapi.h) +// See https://docs.microsoft.com/windows/win32/api/heapapi/ + +// Flag to indicate that the memory returned by `HeapAlloc` should be zeroed. +const HEAP_ZERO_MEMORY: c::DWORD = 0x00000008; + +extern "system" { + // Get a handle to the default heap of the current process, or null if the operation fails. + // + // See https://docs.microsoft.com/windows/win32/api/heapapi/nf-heapapi-getprocessheap + fn GetProcessHeap() -> c::HANDLE; + + // Allocate a block of `dwBytes` bytes of memory from a given heap `hHeap`. + // The allocated memory may be uninitialized, or zeroed if `dwFlags` is + // set to `HEAP_ZERO_MEMORY`. + // + // Returns a pointer to the newly-allocated memory or null if the operation fails. + // The returned pointer will be aligned to at least `MIN_ALIGN`. + // + // SAFETY: + // - `hHeap` must be a non-null handle returned by `GetProcessHeap`. + // - `dwFlags` must be set to either zero or `HEAP_ZERO_MEMORY`. + // + // Note that `dwBytes` is allowed to be zero, contrary to some other allocators. + // + // See https://docs.microsoft.com/windows/win32/api/heapapi/nf-heapapi-heapalloc + fn HeapAlloc(hHeap: c::HANDLE, dwFlags: c::DWORD, dwBytes: c::SIZE_T) -> c::LPVOID; -unsafe fn align_ptr(ptr: *mut u8, align: usize) -> *mut u8 { - let aligned = ptr.add(align - (ptr as usize & (align - 1))); - *get_header(aligned) = Header(ptr); - aligned + // Reallocate a block of memory behind a given pointer `lpMem` from a given heap `hHeap`, + // to a block of at least `dwBytes` bytes, either shrinking the block in place, + // or allocating at a new location, copying memory, and freeing the original location. + // + // Returns a pointer to the reallocated memory or null if the operation fails. + // The returned pointer will be aligned to at least `MIN_ALIGN`. + // If the operation fails the given block will never have been freed. + // + // SAFETY: + // - `hHeap` must be a non-null handle returned by `GetProcessHeap`. + // - `dwFlags` must be set to zero. + // - `lpMem` must be a non-null pointer to an allocated block returned by `HeapAlloc` or + // `HeapReAlloc`, that has not already been freed. + // If the block was successfully reallocated at a new location, pointers pointing to + // the freed memory, such as `lpMem`, must not be dereferenced ever again. + // + // Note that `dwBytes` is allowed to be zero, contrary to some other allocators. + // + // See https://docs.microsoft.com/windows/win32/api/heapapi/nf-heapapi-heaprealloc + fn HeapReAlloc( + hHeap: c::HANDLE, + dwFlags: c::DWORD, + lpMem: c::LPVOID, + dwBytes: c::SIZE_T, + ) -> c::LPVOID; + + // Free a block of memory behind a given pointer `lpMem` from a given heap `hHeap`. + // Returns a nonzero value if the operation is successful, and zero if the operation fails. + // + // SAFETY: + // - `dwFlags` must be set to zero. + // - `lpMem` must be a pointer to an allocated block returned by `HeapAlloc` or `HeapReAlloc`, + // that has not already been freed. + // If the block was successfully freed, pointers pointing to the freed memory, such as `lpMem`, + // must not be dereferenced ever again. + // + // Note that both `hHeap` is allowed to be any value, and `lpMem` is allowed to be null, + // both of which will not cause the operation to fail. + // + // See https://docs.microsoft.com/windows/win32/api/heapapi/nf-heapapi-heapfree + fn HeapFree(hHeap: c::HANDLE, dwFlags: c::DWORD, lpMem: c::LPVOID) -> c::BOOL; } +// Header containing a pointer to the start of an allocated block. +// SAFETY: size and alignment must be <= `MIN_ALIGN`. +#[repr(C)] +struct Header(*mut u8); + +// Allocates a block of optionally zeroed memory for a given `layout`. +// Returns a pointer satisfying the guarantees of `System` about allocated pointers. #[inline] -unsafe fn allocate_with_flags(layout: Layout, flags: c::DWORD) -> *mut u8 { - if layout.align() <= MIN_ALIGN { - return c::HeapAlloc(c::GetProcessHeap(), flags, layout.size()) as *mut u8; +unsafe fn allocate(layout: Layout, zeroed: bool) -> *mut u8 { + let heap = unsafe { GetProcessHeap() }; + if heap.is_null() { + // Allocation has failed, could not get the current process heap. + return ptr::null_mut(); } - let size = layout.size() + layout.align(); - let ptr = c::HeapAlloc(c::GetProcessHeap(), flags, size); - if ptr.is_null() { ptr as *mut u8 } else { align_ptr(ptr as *mut u8, layout.align()) } + // Allocated memory will be either zeroed or uninitialized. + let flags = if zeroed { HEAP_ZERO_MEMORY } else { 0 }; + + if layout.align() <= MIN_ALIGN { + // SAFETY: `heap` is a non-null handle returned by `GetProcessHeap`. + // The returned pointer points to the start of an allocated block. + unsafe { HeapAlloc(heap, flags, layout.size()) as *mut u8 } + } else { + // Allocate extra padding in order to be able to satisfy the alignment. + let total = layout.align() + layout.size(); + + // SAFETY: `heap` is a non-null handle returned by `GetProcessHeap`. + let ptr = unsafe { HeapAlloc(heap, flags, total) as *mut u8 }; + if ptr.is_null() { + // Allocation has failed. + return ptr::null_mut(); + } + + // Create a correctly aligned pointer offset from the start of the allocated block, + // and write a header before it. + + let offset = layout.align() - (ptr as usize & (layout.align() - 1)); + // SAFETY: `MIN_ALIGN` <= `offset` <= `layout.align()` and the size of the allocated + // block is `layout.align() + layout.size()`. `aligned` will thus be a correctly aligned + // pointer inside the allocated block with at least `layout.size()` bytes after it and at + // least `MIN_ALIGN` bytes of padding before it. + let aligned = unsafe { ptr.add(offset) }; + // SAFETY: Because the size and alignment of a header is <= `MIN_ALIGN` and `aligned` + // is aligned to at least `MIN_ALIGN` and has at least `MIN_ALIGN` bytes of padding before + // it, it is safe to write a header directly before it. + unsafe { ptr::write((aligned as *mut Header).offset(-1), Header(ptr)) }; + + // SAFETY: The returned pointer does not point to the to the start of an allocated block, + // but there is a header readable directly before it containing the location of the start + // of the block. + aligned + } } +// All pointers returned by this allocator have, in addition to the guarantees of `GlobalAlloc`, the +// following properties: +// +// If the pointer was allocated or reallocated with a `layout` specifying an alignment <= `MIN_ALIGN` +// the pointer will be aligned to at least `MIN_ALIGN` and point to the start of the allocated block. +// +// If the pointer was allocated or reallocated with a `layout` specifying an alignment > `MIN_ALIGN` +// the pointer will be aligned to the specified alignment and not point to the start of the allocated block. +// Instead there will be a header readable directly before the returned pointer, containing the actual +// location of the start of the block. #[stable(feature = "alloc_system_type", since = "1.28.0")] unsafe impl GlobalAlloc for System { #[inline] unsafe fn alloc(&self, layout: Layout) -> *mut u8 { - allocate_with_flags(layout, 0) + // SAFETY: pointers returned by `allocate` satisfy the guarantees of `System` + unsafe { allocate(layout, false) } } #[inline] unsafe fn alloc_zeroed(&self, layout: Layout) -> *mut u8 { - allocate_with_flags(layout, c::HEAP_ZERO_MEMORY) + // SAFETY: pointers returned by `allocate` satisfy the guarantees of `System` + unsafe { allocate(layout, true) } } #[inline] unsafe fn dealloc(&self, ptr: *mut u8, layout: Layout) { - if layout.align() <= MIN_ALIGN { - let err = c::HeapFree(c::GetProcessHeap(), 0, ptr as c::LPVOID); - debug_assert!(err != 0, "Failed to free heap memory: {}", c::GetLastError()); - } else { - let header = get_header(ptr); - let err = c::HeapFree(c::GetProcessHeap(), 0, header.0 as c::LPVOID); + let block = { + if layout.align() <= MIN_ALIGN { + ptr + } else { + // The location of the start of the block is stored in the padding before `ptr`. + + // SAFETY: Because of the contract of `System`, `ptr` is guaranteed to be non-null + // and have a header readable directly before it. + unsafe { ptr::read((ptr as *mut Header).offset(-1)).0 } + } + }; + + // SAFETY: `block` is a pointer to the start of an allocated block. + unsafe { + let err = HeapFree(GetProcessHeap(), 0, block as c::LPVOID); debug_assert!(err != 0, "Failed to free heap memory: {}", c::GetLastError()); } } @@ -53,9 +181,20 @@ unsafe impl GlobalAlloc for System { #[inline] unsafe fn realloc(&self, ptr: *mut u8, layout: Layout, new_size: usize) -> *mut u8 { if layout.align() <= MIN_ALIGN { - c::HeapReAlloc(c::GetProcessHeap(), 0, ptr as c::LPVOID, new_size) as *mut u8 + let heap = unsafe { GetProcessHeap() }; + if heap.is_null() { + // Reallocation has failed, could not get the current process heap. + return ptr::null_mut(); + } + + // SAFETY: `heap` is a non-null handle returned by `GetProcessHeap`, + // `ptr` is a pointer to the start of an allocated block. + // The returned pointer points to the start of an allocated block. + unsafe { HeapReAlloc(heap, 0, ptr as c::LPVOID, new_size) as *mut u8 } } else { - realloc_fallback(self, ptr, layout, new_size) + // SAFETY: `realloc_fallback` is implemented using `dealloc` and `alloc`, which will + // correctly handle `ptr` and return a pointer satisfying the guarantees of `System` + unsafe { realloc_fallback(self, ptr, layout, new_size) } } } } diff --git a/library/std/src/sys/windows/alloc/tests.rs b/library/std/src/sys/windows/alloc/tests.rs new file mode 100644 index 0000000000000..674a3e1d92d17 --- /dev/null +++ b/library/std/src/sys/windows/alloc/tests.rs @@ -0,0 +1,9 @@ +use super::{Header, MIN_ALIGN}; +use crate::mem; + +#[test] +fn alloc_header() { + // Header must fit in the padding before an aligned pointer + assert!(mem::size_of::
() <= MIN_ALIGN); + assert!(mem::align_of::
() <= MIN_ALIGN); +} diff --git a/library/std/src/sys/windows/c.rs b/library/std/src/sys/windows/c.rs index 9789ed085e29d..3e4176ef7f8fe 100644 --- a/library/std/src/sys/windows/c.rs +++ b/library/std/src/sys/windows/c.rs @@ -285,8 +285,6 @@ pub const FD_SETSIZE: usize = 64; pub const STACK_SIZE_PARAM_IS_A_RESERVATION: DWORD = 0x00010000; -pub const HEAP_ZERO_MEMORY: DWORD = 0x00000008; - pub const STATUS_SUCCESS: NTSTATUS = 0x00000000; #[repr(C)] @@ -1017,11 +1015,6 @@ extern "system" { timeout: *const timeval, ) -> c_int; - pub fn GetProcessHeap() -> HANDLE; - pub fn HeapAlloc(hHeap: HANDLE, dwFlags: DWORD, dwBytes: SIZE_T) -> LPVOID; - pub fn HeapReAlloc(hHeap: HANDLE, dwFlags: DWORD, lpMem: LPVOID, dwBytes: SIZE_T) -> LPVOID; - pub fn HeapFree(hHeap: HANDLE, dwFlags: DWORD, lpMem: LPVOID) -> BOOL; - // >= Vista / Server 2008 // https://docs.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-createsymboliclinkw pub fn CreateSymbolicLinkW( From b01bf0e9d311332d7942619845281af4b9da54bb Mon Sep 17 00:00:00 2001 From: CDirkx Date: Mon, 22 Mar 2021 04:22:11 +0100 Subject: [PATCH 04/21] Apply suggestions from code review Co-authored-by: David Tolnay --- library/std/src/sys/windows/alloc.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/library/std/src/sys/windows/alloc.rs b/library/std/src/sys/windows/alloc.rs index 8ef256a06d4ac..3f810ffa8ca59 100644 --- a/library/std/src/sys/windows/alloc.rs +++ b/library/std/src/sys/windows/alloc.rs @@ -148,13 +148,15 @@ unsafe impl GlobalAlloc for System { #[inline] unsafe fn alloc(&self, layout: Layout) -> *mut u8 { // SAFETY: pointers returned by `allocate` satisfy the guarantees of `System` - unsafe { allocate(layout, false) } + let zeroed = false; + unsafe { allocate(layout, zeroed) } } #[inline] unsafe fn alloc_zeroed(&self, layout: Layout) -> *mut u8 { // SAFETY: pointers returned by `allocate` satisfy the guarantees of `System` - unsafe { allocate(layout, true) } + let zeroed = true; + unsafe { allocate(layout, zeroed) } } #[inline] From 4cce9e3db2d8a93fe72994e0a39e15e69cdbc7c2 Mon Sep 17 00:00:00 2001 From: Christiaan Dirkx Date: Fri, 26 Mar 2021 14:47:25 +0100 Subject: [PATCH 05/21] Cache `GetProcessHeap` --- library/std/src/sys/windows/alloc.rs | 70 +++++++++++++++++++++------- 1 file changed, 54 insertions(+), 16 deletions(-) diff --git a/library/std/src/sys/windows/alloc.rs b/library/std/src/sys/windows/alloc.rs index 3f810ffa8ca59..bc4725dfc7b39 100644 --- a/library/std/src/sys/windows/alloc.rs +++ b/library/std/src/sys/windows/alloc.rs @@ -1,7 +1,9 @@ #![deny(unsafe_op_in_unsafe_fn)] use crate::alloc::{GlobalAlloc, Layout, System}; +use crate::ffi::c_void; use crate::ptr; +use crate::sync::atomic::{AtomicPtr, Ordering}; use crate::sys::c; use crate::sys_common::alloc::{realloc_fallback, MIN_ALIGN}; @@ -17,6 +19,9 @@ const HEAP_ZERO_MEMORY: c::DWORD = 0x00000008; extern "system" { // Get a handle to the default heap of the current process, or null if the operation fails. // + // SAFETY: Successful calls to this function within the same process are assumed to + // always return the same handle, which remains valid for the entire lifetime of the process. + // // See https://docs.microsoft.com/windows/win32/api/heapapi/nf-heapapi-getprocessheap fn GetProcessHeap() -> c::HANDLE; @@ -66,29 +71,59 @@ extern "system" { // Returns a nonzero value if the operation is successful, and zero if the operation fails. // // SAFETY: + // - `hHeap` must be a non-null handle returned by `GetProcessHeap`. // - `dwFlags` must be set to zero. // - `lpMem` must be a pointer to an allocated block returned by `HeapAlloc` or `HeapReAlloc`, // that has not already been freed. // If the block was successfully freed, pointers pointing to the freed memory, such as `lpMem`, // must not be dereferenced ever again. // - // Note that both `hHeap` is allowed to be any value, and `lpMem` is allowed to be null, - // both of which will not cause the operation to fail. + // Note that `lpMem` is allowed to be null, which will not cause the operation to fail. // // See https://docs.microsoft.com/windows/win32/api/heapapi/nf-heapapi-heapfree fn HeapFree(hHeap: c::HANDLE, dwFlags: c::DWORD, lpMem: c::LPVOID) -> c::BOOL; } +// Cached handle to the default heap of the current process. +// Either a non-null handle returned by `GetProcessHeap`, or null when not yet initialized or `GetProcessHeap` failed. +static HEAP: AtomicPtr = AtomicPtr::new(ptr::null_mut()); + +// Get a handle to the default heap of the current process, or null if the operation fails. +// SAFETY: If this operation is successful, `HEAP` will be successfully initialized and contain +// a non-null handle returned by `GetProcessHeap`. +#[inline] +unsafe fn init_or_get_process_heap() -> c::HANDLE { + let heap = HEAP.load(Ordering::Relaxed); + if heap.is_null() { + // `HEAP` has not yet been successfully initialized + let heap = unsafe { GetProcessHeap() }; + if !heap.is_null() { + // SAFETY: No locking is needed because within the same process, + // successful calls to `GetProcessHeap` will always return the same value, even on different threads. + HEAP.store(heap, Ordering::Relaxed); + + // SAFETY: `HEAP` contains a non-null handle returned by `GetProcessHeap` + heap + } else { + // Could not get the current process heap. + ptr::null_mut() + } + } else { + // SAFETY: `HEAP` contains a non-null handle returned by `GetProcessHeap` + heap + } +} + // Header containing a pointer to the start of an allocated block. -// SAFETY: size and alignment must be <= `MIN_ALIGN`. +// SAFETY: Size and alignment must be <= `MIN_ALIGN`. #[repr(C)] struct Header(*mut u8); -// Allocates a block of optionally zeroed memory for a given `layout`. -// Returns a pointer satisfying the guarantees of `System` about allocated pointers. +// Allocate a block of optionally zeroed memory for a given `layout`. +// SAFETY: Returns a pointer satisfying the guarantees of `System` about allocated pointers. #[inline] unsafe fn allocate(layout: Layout, zeroed: bool) -> *mut u8 { - let heap = unsafe { GetProcessHeap() }; + let heap = unsafe { init_or_get_process_heap() }; if heap.is_null() { // Allocation has failed, could not get the current process heap. return ptr::null_mut(); @@ -147,14 +182,14 @@ unsafe fn allocate(layout: Layout, zeroed: bool) -> *mut u8 { unsafe impl GlobalAlloc for System { #[inline] unsafe fn alloc(&self, layout: Layout) -> *mut u8 { - // SAFETY: pointers returned by `allocate` satisfy the guarantees of `System` + // SAFETY: Pointers returned by `allocate` satisfy the guarantees of `System` let zeroed = false; unsafe { allocate(layout, zeroed) } } #[inline] unsafe fn alloc_zeroed(&self, layout: Layout) -> *mut u8 { - // SAFETY: pointers returned by `allocate` satisfy the guarantees of `System` + // SAFETY: Pointers returned by `allocate` satisfy the guarantees of `System` let zeroed = true; unsafe { allocate(layout, zeroed) } } @@ -173,9 +208,14 @@ unsafe impl GlobalAlloc for System { } }; + // SAFETY: because `ptr` has been successfully allocated with this allocator, + // `HEAP` must have been successfully initialized and contain a non-null handle + // returned by `GetProcessHeap`. + let heap = HEAP.load(Ordering::Relaxed); + // SAFETY: `block` is a pointer to the start of an allocated block. unsafe { - let err = HeapFree(GetProcessHeap(), 0, block as c::LPVOID); + let err = HeapFree(heap, 0, block as c::LPVOID); debug_assert!(err != 0, "Failed to free heap memory: {}", c::GetLastError()); } } @@ -183,14 +223,12 @@ unsafe impl GlobalAlloc for System { #[inline] unsafe fn realloc(&self, ptr: *mut u8, layout: Layout, new_size: usize) -> *mut u8 { if layout.align() <= MIN_ALIGN { - let heap = unsafe { GetProcessHeap() }; - if heap.is_null() { - // Reallocation has failed, could not get the current process heap. - return ptr::null_mut(); - } + // SAFETY: because `ptr` has been successfully allocated with this allocator, + // `HEAP` must have been successfully initialized and contain a non-null handle + // returned by `GetProcessHeap`. + let heap = HEAP.load(Ordering::Relaxed); - // SAFETY: `heap` is a non-null handle returned by `GetProcessHeap`, - // `ptr` is a pointer to the start of an allocated block. + // SAFETY: `ptr` is a pointer to the start of an allocated block. // The returned pointer points to the start of an allocated block. unsafe { HeapReAlloc(heap, 0, ptr as c::LPVOID, new_size) as *mut u8 } } else { From fa89c0fbcfa8f4d44f153b1195ec5a305540ffc4 Mon Sep 17 00:00:00 2001 From: The8472 Date: Mon, 29 Mar 2021 04:22:34 +0200 Subject: [PATCH 06/21] add testcase for double-drop during Vec in-place collection --- library/alloc/tests/vec.rs | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/library/alloc/tests/vec.rs b/library/alloc/tests/vec.rs index c142536cd2dfb..b926c697d58ab 100644 --- a/library/alloc/tests/vec.rs +++ b/library/alloc/tests/vec.rs @@ -1027,7 +1027,7 @@ fn test_from_iter_specialization_head_tail_drop() { } #[test] -fn test_from_iter_specialization_panic_drop() { +fn test_from_iter_specialization_panic_during_iteration_drops() { let drop_count: Vec<_> = (0..=2).map(|_| Rc::new(())).collect(); let src: Vec<_> = drop_count.iter().cloned().collect(); let iter = src.into_iter(); @@ -1050,6 +1050,42 @@ fn test_from_iter_specialization_panic_drop() { ); } +#[test] +fn test_from_iter_specialization_panic_during_drop_leaks() { + static mut DROP_COUNTER: usize = 0; + + #[derive(Debug)] + enum Droppable { + DroppedTwice(Box), + PanicOnDrop, + } + + impl Drop for Droppable { + fn drop(&mut self) { + match self { + Droppable::DroppedTwice(_) => { + unsafe { + DROP_COUNTER += 1; + } + println!("Dropping!") + } + Droppable::PanicOnDrop => { + if !std::thread::panicking() { + panic!(); + } + } + } + } + } + + let _ = std::panic::catch_unwind(AssertUnwindSafe(|| { + let v = vec![Droppable::DroppedTwice(Box::new(123)), Droppable::PanicOnDrop]; + let _ = v.into_iter().take(0).collect::>(); + })); + + assert_eq!(unsafe { DROP_COUNTER }, 1); +} + #[test] fn test_cow_from() { let borrowed: &[_] = &["borrowed", "(slice)"]; From 421f5d282a51e130d3ca7c4524d8ad6753437da9 Mon Sep 17 00:00:00 2001 From: The8472 Date: Mon, 29 Mar 2021 04:22:48 +0200 Subject: [PATCH 07/21] fix double-drop in in-place collect specialization --- library/alloc/src/vec/into_iter.rs | 27 ++++++++++++++------- library/alloc/src/vec/source_iter_marker.rs | 4 +-- 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/library/alloc/src/vec/into_iter.rs b/library/alloc/src/vec/into_iter.rs index bcbdffabc7fbe..324e894bafd23 100644 --- a/library/alloc/src/vec/into_iter.rs +++ b/library/alloc/src/vec/into_iter.rs @@ -85,20 +85,29 @@ impl IntoIter { ptr::slice_from_raw_parts_mut(self.ptr as *mut T, self.len()) } - pub(super) fn drop_remaining(&mut self) { - unsafe { - ptr::drop_in_place(self.as_mut_slice()); - } - self.ptr = self.end; - } + /// Drops remaining elements and relinquishes the backing allocation. + /// + /// This is roughly equivalent to the following, but more efficient + /// + /// ``` + /// # let mut into_iter = Vec::::with_capacity(10).into_iter(); + /// (&mut into_iter).for_each(core::mem::drop); + /// unsafe { core::ptr::write(&mut into_iter, Vec::new().into_iter()); } + /// ``` + pub(super) fn forget_allocation_drop_remaining(&mut self) { + let remaining = self.as_raw_mut_slice(); - /// Relinquishes the backing allocation, equivalent to - /// `ptr::write(&mut self, Vec::new().into_iter())` - pub(super) fn forget_allocation(&mut self) { + // overwrite the individual fields instead of creating a new + // struct and then overwriting &mut self. + // this creates less assembly self.cap = 0; self.buf = unsafe { NonNull::new_unchecked(RawVec::NEW.ptr()) }; self.ptr = self.buf.as_ptr(); self.end = self.buf.as_ptr(); + + unsafe { + ptr::drop_in_place(remaining); + } } } diff --git a/library/alloc/src/vec/source_iter_marker.rs b/library/alloc/src/vec/source_iter_marker.rs index 50882fc17673e..e857d284d3ab6 100644 --- a/library/alloc/src/vec/source_iter_marker.rs +++ b/library/alloc/src/vec/source_iter_marker.rs @@ -69,9 +69,9 @@ where } // drop any remaining values at the tail of the source - src.drop_remaining(); // but prevent drop of the allocation itself once IntoIter goes out of scope - src.forget_allocation(); + // if the drop panics then we also leak any elements collected into dst_buf + src.forget_allocation_drop_remaining(); let vec = unsafe { Vec::from_raw_parts(dst_buf, len, cap) }; From f2e52fffc28e18c7896f05792843d1cdd18c7ecb Mon Sep 17 00:00:00 2001 From: Aman Arora Date: Mon, 29 Mar 2021 19:52:59 -0400 Subject: [PATCH 08/21] 2229: Produce a rustfix migration suggestion --- compiler/rustc_typeck/src/check/upvar.rs | 32 ++++++++++++++++++++---- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/compiler/rustc_typeck/src/check/upvar.rs b/compiler/rustc_typeck/src/check/upvar.rs index 91021b3f6f589..fd4186e802571 100644 --- a/compiler/rustc_typeck/src/check/upvar.rs +++ b/compiler/rustc_typeck/src/check/upvar.rs @@ -34,6 +34,7 @@ use super::FnCtxt; use crate::expr_use_visitor as euv; use rustc_data_structures::fx::FxIndexMap; +use rustc_errors::Applicability; use rustc_hir as hir; use rustc_hir::def_id::DefId; use rustc_hir::def_id::LocalDefId; @@ -91,7 +92,7 @@ impl<'a, 'tcx> Visitor<'tcx> for InferBorrowKindVisitor<'a, 'tcx> { if let hir::ExprKind::Closure(cc, _, body_id, _, _) = expr.kind { let body = self.fcx.tcx.hir().body(body_id); self.visit_body(body); - self.fcx.analyze_closure(expr.hir_id, expr.span, body, cc); + self.fcx.analyze_closure(expr.hir_id, expr.span, body_id, body, cc); } intravisit::walk_expr(self, expr); @@ -104,6 +105,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { &self, closure_hir_id: hir::HirId, span: Span, + body_id: hir::BodyId, body: &'tcx hir::Body<'tcx>, capture_clause: hir::CaptureBy, ) { @@ -167,7 +169,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { let closure_hir_id = self.tcx.hir().local_def_id_to_hir_id(local_def_id); if should_do_migration_analysis(self.tcx, closure_hir_id) { - self.perform_2229_migration_anaysis(closure_def_id, capture_clause, span); + self.perform_2229_migration_anaysis(closure_def_id, body_id, capture_clause, span); } // We now fake capture information for all variables that are mentioned within the closure @@ -465,6 +467,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { fn perform_2229_migration_anaysis( &self, closure_def_id: DefId, + body_id: hir::BodyId, capture_clause: hir::CaptureBy, span: Span, ) { @@ -488,7 +491,22 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { let mut diagnostics_builder = lint.build( "drop order affected for closure because of `capture_disjoint_fields`", ); - diagnostics_builder.note(&migrations_text); + let closure_body_span = self.tcx.hir().span(body_id.hir_id); + let (sugg, app) = + match self.tcx.sess.source_map().span_to_snippet(closure_body_span) { + Ok(s) => ( + format!("{{ {} {} }}", migrations_text, s), + Applicability::MachineApplicable, + ), + Err(_) => (migrations_text.clone(), Applicability::HasPlaceholders), + }; + + diagnostics_builder.span_suggestion( + closure_body_span, + &format!("You can restore original behavior adding `{}` to the closure/generator", migrations_text), + sugg, + app, + ); diagnostics_builder.emit(); }, ); @@ -1517,10 +1535,14 @@ fn should_do_migration_analysis(tcx: TyCtxt<'_>, closure_id: hir::HirId) -> bool fn migration_suggestion_for_2229(tcx: TyCtxt<'_>, need_migrations: &Vec) -> String { let need_migrations_strings = - need_migrations.iter().map(|v| format!("{}", var_name(tcx, *v))).collect::>(); + need_migrations.iter().map(|v| format!("&{}", var_name(tcx, *v))).collect::>(); let migrations_list_concat = need_migrations_strings.join(", "); - format!("drop(&({}));", migrations_list_concat) + if 1 == need_migrations.len() { + format!("let _ = {};", migrations_list_concat) + } else { + format!("let _ = ({});", migrations_list_concat) + } } /// Helper function to determine if we need to escalate CaptureKind from From 8f7735624924e3399a1abee68615a99072347cc9 Mon Sep 17 00:00:00 2001 From: hi-rustin Date: Tue, 30 Mar 2021 17:56:39 +0800 Subject: [PATCH 09/21] give full path of constraint in suggest_constraining_type_param revert file bless with nll mode --- .../src/traits/error_reporting/suggestions.rs | 4 ++- .../defaults-suitability.stderr | 8 +++--- .../issue-27675-unchecked-bounds.stderr | 4 +-- .../issue-43784-associated-type.stderr | 4 +-- src/test/ui/async-await/issue-70818.stderr | 4 +-- .../ui/bad/bad-method-typaram-kind.stderr | 4 +-- src/test/ui/bound-suggestions.fixed | 12 ++++----- src/test/ui/bound-suggestions.stderr | 24 ++++++++--------- ...builtin-superkinds-double-superkind.stderr | 8 +++--- .../builtin-superkinds-in-metadata.stderr | 4 +-- ...builtin-superkinds-typaram-not-send.stderr | 4 +-- ...ds-cant-promote-superkind-in-struct.stderr | 4 +-- .../ui/closures/closure-bounds-subtype.stderr | 4 +-- .../const-argument-if-length.full.stderr | 4 +-- .../const-argument-if-length.min.stderr | 2 +- .../issues/issue-61336-2.full.stderr | 4 +-- .../issues/issue-61336-2.min.stderr | 4 +-- .../issues/issue-61336.full.stderr | 4 +-- .../issues/issue-61336.min.stderr | 4 +-- .../dst/dst-object-from-unsized-type.stderr | 4 +-- ...ature-gate-generic_associated_types.stderr | 4 +-- .../impl_bounds.stderr | 4 +-- .../issue-68641-check-gat-bounds.stderr | 4 +-- .../issue-68642-broken-llvm-ir.stderr | 4 +-- .../issue-68643-broken-mir.stderr | 4 +-- .../issue-68644-codegen-selection.stderr | 4 +-- .../issue-68645-codegen-fulfillment.stderr | 4 +-- .../issue-74824.stderr | 4 +-- .../impl-trait/issue-55872-1.full_tait.stderr | 8 +++--- .../impl-trait/issue-55872-1.min_tait.stderr | 8 +++--- src/test/ui/issues/issue-27060-2.stderr | 2 +- .../ui/issues/issue-43784-supertrait.stderr | 4 +-- .../kindck/kindck-impl-type-params.nll.stderr | 16 ++++++------ .../ui/kindck/kindck-impl-type-params.stderr | 16 ++++++------ src/test/ui/phantom-auto-trait.stderr | 8 +++--- ...afult-generic-associated-type-bound.stderr | 4 +-- .../defaultimpl/specialization-wfcheck.stderr | 4 +-- ...adt-param-with-implicit-sized-bound.stderr | 2 +- .../suggestions/restrict-type-argument.stderr | 24 ++++++++--------- .../ui/trait-impl-bound-suggestions.fixed | 2 +- .../ui/trait-impl-bound-suggestions.stderr | 4 +-- .../inductive-overflow/two-traits.stderr | 4 +-- .../ui/traits/suggest-where-clause.stderr | 4 +-- .../bounds-are-checked-2.full_tait.stderr | 4 +-- .../bounds-are-checked-2.min_tait.stderr | 4 +-- ...eric_duplicate_param_use5.full_tait.stderr | 8 +++--- ...neric_duplicate_param_use5.min_tait.stderr | 8 +++--- ...eric_duplicate_param_use6.full_tait.stderr | 4 +-- ...neric_duplicate_param_use6.min_tait.stderr | 4 +-- ...eric_duplicate_param_use8.full_tait.stderr | 4 +-- ...neric_duplicate_param_use8.min_tait.stderr | 4 +-- ...eric_duplicate_param_use9.full_tait.stderr | 8 +++--- ...neric_duplicate_param_use9.min_tait.stderr | 8 +++--- ...generic_underconstrained2.full_tait.stderr | 8 +++--- .../generic_underconstrained2.min_tait.stderr | 8 +++--- .../issue-52843.full_tait.stderr | 4 +-- .../issue-52843.min_tait.stderr | 4 +-- src/test/ui/type/type-check-defaults.stderr | 4 +-- ...ypeck-default-trait-impl-send-param.stderr | 4 +-- src/test/ui/union/union-sized-field.stderr | 6 ++--- .../ui/unsized/unsized-bare-typaram.stderr | 2 +- src/test/ui/unsized/unsized-enum.stderr | 2 +- src/test/ui/unsized/unsized-enum2.stderr | 8 +++--- .../unsized-inherent-impl-self-type.stderr | 2 +- src/test/ui/unsized/unsized-struct.stderr | 4 +-- .../unsized-trait-impl-self-type.stderr | 2 +- .../unsized-trait-impl-trait-arg.stderr | 2 +- src/test/ui/unsized3.stderr | 12 ++++----- src/test/ui/unsized5.stderr | 8 +++--- src/test/ui/unsized6.stderr | 26 +++++++++---------- src/test/ui/unsized7.stderr | 2 +- src/test/ui/wf/wf-enum-bound.stderr | 4 +-- .../wf/wf-enum-fields-struct-variant.stderr | 4 +-- src/test/ui/wf/wf-enum-fields.stderr | 4 +-- src/test/ui/wf/wf-fn-where-clause.stderr | 4 +-- src/test/ui/wf/wf-in-fn-arg.stderr | 4 +-- src/test/ui/wf/wf-in-fn-ret.stderr | 4 +-- src/test/ui/wf/wf-in-fn-type-arg.stderr | 4 +-- src/test/ui/wf/wf-in-fn-type-ret.stderr | 4 +-- src/test/ui/wf/wf-in-fn-where-clause.stderr | 4 +-- src/test/ui/wf/wf-in-obj-type-trait.stderr | 4 +-- ...f-inherent-impl-method-where-clause.stderr | 4 +-- .../wf/wf-inherent-impl-where-clause.stderr | 4 +-- src/test/ui/wf/wf-struct-bound.stderr | 4 +-- src/test/ui/wf/wf-struct-field.stderr | 4 +-- .../wf/wf-trait-associated-type-bound.stderr | 4 +-- src/test/ui/wf/wf-trait-bound.stderr | 4 +-- src/test/ui/wf/wf-trait-superbound.stderr | 4 +-- ...traints-are-local-for-inherent-impl.stderr | 4 +-- ...onstraints-are-local-for-trait-impl.stderr | 4 +-- 90 files changed, 249 insertions(+), 247 deletions(-) diff --git a/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs b/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs index c1b105f1d8489..32f8a16908af9 100644 --- a/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs +++ b/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs @@ -28,6 +28,7 @@ use std::fmt; use super::InferCtxtPrivExt; use crate::traits::query::evaluate_obligation::InferCtxtExt as _; +use rustc_middle::ty::print::with_no_trimmed_paths; #[derive(Debug)] pub enum GeneratorInteriorOrUpvar { @@ -440,7 +441,8 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> { { // Missing generic type parameter bound. let param_name = self_ty.to_string(); - let constraint = trait_ref.print_only_trait_path().to_string(); + let constraint = + with_no_trimmed_paths(|| trait_ref.print_only_trait_path().to_string()); if suggest_constraining_type_param( self.tcx, generics, diff --git a/src/test/ui/associated-types/defaults-suitability.stderr b/src/test/ui/associated-types/defaults-suitability.stderr index 274d09fd09c86..af4e6f0a5c161 100644 --- a/src/test/ui/associated-types/defaults-suitability.stderr +++ b/src/test/ui/associated-types/defaults-suitability.stderr @@ -31,8 +31,8 @@ LL | type Bar: Clone = Vec; = note: required because of the requirements on the impl of `Clone` for `Vec` help: consider restricting type parameter `T` | -LL | trait Foo { - | ^^^^^^^ +LL | trait Foo { + | ^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `(): Foo` is not satisfied --> $DIR/defaults-suitability.rs:34:5 @@ -99,8 +99,8 @@ LL | type Baz = T; | help: consider further restricting type parameter `T` | -LL | Self::Baz: Clone, T: Clone - | ^^^^^^^^^^ +LL | Self::Baz: Clone, T: std::clone::Clone + | ^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 8 previous errors diff --git a/src/test/ui/associated-types/issue-27675-unchecked-bounds.stderr b/src/test/ui/associated-types/issue-27675-unchecked-bounds.stderr index 02396bd00a59d..b6122bd54d162 100644 --- a/src/test/ui/associated-types/issue-27675-unchecked-bounds.stderr +++ b/src/test/ui/associated-types/issue-27675-unchecked-bounds.stderr @@ -9,8 +9,8 @@ LL | copy::>(t) | help: consider restricting type parameter `T` | -LL | pub fn copy_any(t: &T) -> T { - | ^^^^^^ +LL | pub fn copy_any(t: &T) -> T { + | ^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/associated-types/issue-43784-associated-type.stderr b/src/test/ui/associated-types/issue-43784-associated-type.stderr index d5105ae3b5815..0e653a7d3b22f 100644 --- a/src/test/ui/associated-types/issue-43784-associated-type.stderr +++ b/src/test/ui/associated-types/issue-43784-associated-type.stderr @@ -9,8 +9,8 @@ LL | type Assoc = T; | help: consider restricting type parameter `T` | -LL | impl Complete for T { - | ^^^^^^ +LL | impl Complete for T { + | ^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/async-await/issue-70818.stderr b/src/test/ui/async-await/issue-70818.stderr index 11fca2dd8ef4c..5f39cf6dde125 100644 --- a/src/test/ui/async-await/issue-70818.stderr +++ b/src/test/ui/async-await/issue-70818.stderr @@ -11,8 +11,8 @@ LL | async { (ty, ty1) } | ^^^ has type `U` which is not `Send` help: consider restricting type parameter `U` | -LL | fn foo(ty: T, ty1: U) -> impl Future + Send { - | ^^^^^^ +LL | fn foo(ty: T, ty1: U) -> impl Future + Send { + | ^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/bad/bad-method-typaram-kind.stderr b/src/test/ui/bad/bad-method-typaram-kind.stderr index 5b68d97a9ea55..fd3999ae6fbec 100644 --- a/src/test/ui/bad/bad-method-typaram-kind.stderr +++ b/src/test/ui/bad/bad-method-typaram-kind.stderr @@ -6,8 +6,8 @@ LL | 1.bar::(); | help: consider further restricting this bound | -LL | fn foo() { - | ^^^^^^ +LL | fn foo() { + | ^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/bound-suggestions.fixed b/src/test/ui/bound-suggestions.fixed index be61b7dda256a..31fdd2b67e294 100644 --- a/src/test/ui/bound-suggestions.fixed +++ b/src/test/ui/bound-suggestions.fixed @@ -5,37 +5,37 @@ use std::fmt::Debug; // Rustfix should add this, or use `std::fmt::Debug` instead. #[allow(dead_code)] -fn test_impl(t: impl Sized + Debug) { +fn test_impl(t: impl Sized + std::fmt::Debug) { println!("{:?}", t); //~^ ERROR doesn't implement } #[allow(dead_code)] -fn test_no_bounds(t: T) { +fn test_no_bounds(t: T) { println!("{:?}", t); //~^ ERROR doesn't implement } #[allow(dead_code)] -fn test_one_bound(t: T) { +fn test_one_bound(t: T) { println!("{:?}", t); //~^ ERROR doesn't implement } #[allow(dead_code)] -fn test_no_bounds_where(x: X, y: Y) where X: std::fmt::Debug, Y: Debug { +fn test_no_bounds_where(x: X, y: Y) where X: std::fmt::Debug, Y: std::fmt::Debug { println!("{:?} {:?}", x, y); //~^ ERROR doesn't implement } #[allow(dead_code)] -fn test_one_bound_where(x: X) where X: Sized + Debug { +fn test_one_bound_where(x: X) where X: Sized + std::fmt::Debug { println!("{:?}", x); //~^ ERROR doesn't implement } #[allow(dead_code)] -fn test_many_bounds_where(x: X) where X: Sized, X: Sized, X: Debug { +fn test_many_bounds_where(x: X) where X: Sized, X: Sized, X: std::fmt::Debug { println!("{:?}", x); //~^ ERROR doesn't implement } diff --git a/src/test/ui/bound-suggestions.stderr b/src/test/ui/bound-suggestions.stderr index 12e67e90265ab..ebf43bdb2717c 100644 --- a/src/test/ui/bound-suggestions.stderr +++ b/src/test/ui/bound-suggestions.stderr @@ -8,8 +8,8 @@ LL | println!("{:?}", t); = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) help: consider further restricting this bound | -LL | fn test_impl(t: impl Sized + Debug) { - | ^^^^^^^ +LL | fn test_impl(t: impl Sized + std::fmt::Debug) { + | ^^^^^^^^^^^^^^^^^ error[E0277]: `T` doesn't implement `Debug` --> $DIR/bound-suggestions.rs:15:22 @@ -21,8 +21,8 @@ LL | println!("{:?}", t); = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) help: consider restricting type parameter `T` | -LL | fn test_no_bounds(t: T) { - | ^^^^^^^ +LL | fn test_no_bounds(t: T) { + | ^^^^^^^^^^^^^^^^^ error[E0277]: `T` doesn't implement `Debug` --> $DIR/bound-suggestions.rs:21:22 @@ -34,8 +34,8 @@ LL | println!("{:?}", t); = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) help: consider further restricting this bound | -LL | fn test_one_bound(t: T) { - | ^^^^^^^ +LL | fn test_one_bound(t: T) { + | ^^^^^^^^^^^^^^^^^ error[E0277]: `Y` doesn't implement `Debug` --> $DIR/bound-suggestions.rs:27:30 @@ -47,8 +47,8 @@ LL | println!("{:?} {:?}", x, y); = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) help: consider further restricting type parameter `Y` | -LL | fn test_no_bounds_where(x: X, y: Y) where X: std::fmt::Debug, Y: Debug { - | ^^^^^^^^^^ +LL | fn test_no_bounds_where(x: X, y: Y) where X: std::fmt::Debug, Y: std::fmt::Debug { + | ^^^^^^^^^^^^^^^^^^^^ error[E0277]: `X` doesn't implement `Debug` --> $DIR/bound-suggestions.rs:33:22 @@ -60,8 +60,8 @@ LL | println!("{:?}", x); = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) help: consider further restricting this bound | -LL | fn test_one_bound_where(x: X) where X: Sized + Debug { - | ^^^^^^^ +LL | fn test_one_bound_where(x: X) where X: Sized + std::fmt::Debug { + | ^^^^^^^^^^^^^^^^^ error[E0277]: `X` doesn't implement `Debug` --> $DIR/bound-suggestions.rs:39:22 @@ -73,8 +73,8 @@ LL | println!("{:?}", x); = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) help: consider further restricting type parameter `X` | -LL | fn test_many_bounds_where(x: X) where X: Sized, X: Sized, X: Debug { - | ^^^^^^^^^^ +LL | fn test_many_bounds_where(x: X) where X: Sized, X: Sized, X: std::fmt::Debug { + | ^^^^^^^^^^^^^^^^^^^^ error[E0277]: the size for values of type `Self` cannot be known at compilation time --> $DIR/bound-suggestions.rs:44:46 diff --git a/src/test/ui/builtin-superkinds/builtin-superkinds-double-superkind.stderr b/src/test/ui/builtin-superkinds/builtin-superkinds-double-superkind.stderr index 7e8ac113b4871..7ff986ec38109 100644 --- a/src/test/ui/builtin-superkinds/builtin-superkinds-double-superkind.stderr +++ b/src/test/ui/builtin-superkinds/builtin-superkinds-double-superkind.stderr @@ -10,8 +10,8 @@ LL | impl Foo for (T,) { } = note: required because it appears within the type `(T,)` help: consider further restricting this bound | -LL | impl Foo for (T,) { } - | ^^^^^^ +LL | impl Foo for (T,) { } + | ^^^^^^^^^^^^^^^^^^^ error[E0277]: `T` cannot be shared between threads safely --> $DIR/builtin-superkinds-double-superkind.rs:9:16 @@ -25,8 +25,8 @@ LL | impl Foo for (T,T) { } = note: required because it appears within the type `(T, T)` help: consider further restricting this bound | -LL | impl Foo for (T,T) { } - | ^^^^^^ +LL | impl Foo for (T,T) { } + | ^^^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/builtin-superkinds/builtin-superkinds-in-metadata.stderr b/src/test/ui/builtin-superkinds/builtin-superkinds-in-metadata.stderr index 2b4b6e548b881..133508d39c105 100644 --- a/src/test/ui/builtin-superkinds/builtin-superkinds-in-metadata.stderr +++ b/src/test/ui/builtin-superkinds/builtin-superkinds-in-metadata.stderr @@ -12,8 +12,8 @@ LL | pub trait RequiresRequiresShareAndSend : RequiresShare + Send { } = note: required because it appears within the type `X` help: consider further restricting this bound | -LL | impl RequiresRequiresShareAndSend for X { } - | ^^^^^^ +LL | impl RequiresRequiresShareAndSend for X { } + | ^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/builtin-superkinds/builtin-superkinds-typaram-not-send.stderr b/src/test/ui/builtin-superkinds/builtin-superkinds-typaram-not-send.stderr index ff2cd1c4c8c75..ad80b3fa8d11f 100644 --- a/src/test/ui/builtin-superkinds/builtin-superkinds-typaram-not-send.stderr +++ b/src/test/ui/builtin-superkinds/builtin-superkinds-typaram-not-send.stderr @@ -9,8 +9,8 @@ LL | impl Foo for T { } | help: consider further restricting this bound | -LL | impl Foo for T { } - | ^^^^^^ +LL | impl Foo for T { } + | ^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/closures/closure-bounds-cant-promote-superkind-in-struct.stderr b/src/test/ui/closures/closure-bounds-cant-promote-superkind-in-struct.stderr index 48f18b1ebe957..273eae995538a 100644 --- a/src/test/ui/closures/closure-bounds-cant-promote-superkind-in-struct.stderr +++ b/src/test/ui/closures/closure-bounds-cant-promote-superkind-in-struct.stderr @@ -9,8 +9,8 @@ LL | fn foo(blk: F) -> X where F: FnOnce() + 'static { | help: consider further restricting this bound | -LL | fn foo(blk: F) -> X where F: FnOnce() + 'static + Send { - | ^^^^^^ +LL | fn foo(blk: F) -> X where F: FnOnce() + 'static + std::marker::Send { + | ^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/closures/closure-bounds-subtype.stderr b/src/test/ui/closures/closure-bounds-subtype.stderr index d649eeccb8cc9..7df29d5a098a0 100644 --- a/src/test/ui/closures/closure-bounds-subtype.stderr +++ b/src/test/ui/closures/closure-bounds-subtype.stderr @@ -9,8 +9,8 @@ LL | take_const_owned(f); | help: consider further restricting this bound | -LL | fn give_owned(f: F) where F: FnOnce() + Send + Sync { - | ^^^^^^ +LL | fn give_owned(f: F) where F: FnOnce() + Send + std::marker::Sync { + | ^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/const-generics/const-argument-if-length.full.stderr b/src/test/ui/const-generics/const-argument-if-length.full.stderr index 5dca01f0dc078..c6088e665a232 100644 --- a/src/test/ui/const-generics/const-argument-if-length.full.stderr +++ b/src/test/ui/const-generics/const-argument-if-length.full.stderr @@ -2,7 +2,7 @@ error[E0277]: the size for values of type `T` cannot be known at compilation tim --> $DIR/const-argument-if-length.rs:7:28 | LL | pub const fn is_zst() -> usize { - | - this type parameter needs to be `Sized` + | - this type parameter needs to be `std::marker::Sized` LL | if std::mem::size_of::() == 0 { | ^ doesn't have a size known at compile-time | @@ -15,7 +15,7 @@ error[E0277]: the size for values of type `T` cannot be known at compilation tim --> $DIR/const-argument-if-length.rs:16:12 | LL | pub struct AtLeastByte { - | - this type parameter needs to be `Sized` + | - this type parameter needs to be `std::marker::Sized` LL | value: T, | ^ doesn't have a size known at compile-time | diff --git a/src/test/ui/const-generics/const-argument-if-length.min.stderr b/src/test/ui/const-generics/const-argument-if-length.min.stderr index ea177c1974619..bc06e8d7fb123 100644 --- a/src/test/ui/const-generics/const-argument-if-length.min.stderr +++ b/src/test/ui/const-generics/const-argument-if-length.min.stderr @@ -11,7 +11,7 @@ error[E0277]: the size for values of type `T` cannot be known at compilation tim --> $DIR/const-argument-if-length.rs:16:12 | LL | pub struct AtLeastByte { - | - this type parameter needs to be `Sized` + | - this type parameter needs to be `std::marker::Sized` LL | value: T, | ^ doesn't have a size known at compile-time | diff --git a/src/test/ui/const-generics/issues/issue-61336-2.full.stderr b/src/test/ui/const-generics/issues/issue-61336-2.full.stderr index 9f8e68d211dec..ef0cafcb9bb7c 100644 --- a/src/test/ui/const-generics/issues/issue-61336-2.full.stderr +++ b/src/test/ui/const-generics/issues/issue-61336-2.full.stderr @@ -16,8 +16,8 @@ LL | [x; { N }] = note: the `Copy` trait is required because the repeated element will be copied help: consider restricting type parameter `T` | -LL | fn g(x: T) -> [T; N] { - | ^^^^^^ +LL | fn g(x: T) -> [T; N] { + | ^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error; 1 warning emitted diff --git a/src/test/ui/const-generics/issues/issue-61336-2.min.stderr b/src/test/ui/const-generics/issues/issue-61336-2.min.stderr index 82d17a87e0af8..e5fe50513aaf7 100644 --- a/src/test/ui/const-generics/issues/issue-61336-2.min.stderr +++ b/src/test/ui/const-generics/issues/issue-61336-2.min.stderr @@ -7,8 +7,8 @@ LL | [x; { N }] = note: the `Copy` trait is required because the repeated element will be copied help: consider restricting type parameter `T` | -LL | fn g(x: T) -> [T; N] { - | ^^^^^^ +LL | fn g(x: T) -> [T; N] { + | ^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/const-generics/issues/issue-61336.full.stderr b/src/test/ui/const-generics/issues/issue-61336.full.stderr index 974e2af6fd2cf..fcfd39387c293 100644 --- a/src/test/ui/const-generics/issues/issue-61336.full.stderr +++ b/src/test/ui/const-generics/issues/issue-61336.full.stderr @@ -16,8 +16,8 @@ LL | [x; N] = note: the `Copy` trait is required because the repeated element will be copied help: consider restricting type parameter `T` | -LL | fn g(x: T) -> [T; N] { - | ^^^^^^ +LL | fn g(x: T) -> [T; N] { + | ^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error; 1 warning emitted diff --git a/src/test/ui/const-generics/issues/issue-61336.min.stderr b/src/test/ui/const-generics/issues/issue-61336.min.stderr index 19c7153582cb9..91580313e1e83 100644 --- a/src/test/ui/const-generics/issues/issue-61336.min.stderr +++ b/src/test/ui/const-generics/issues/issue-61336.min.stderr @@ -7,8 +7,8 @@ LL | [x; N] = note: the `Copy` trait is required because the repeated element will be copied help: consider restricting type parameter `T` | -LL | fn g(x: T) -> [T; N] { - | ^^^^^^ +LL | fn g(x: T) -> [T; N] { + | ^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/dst/dst-object-from-unsized-type.stderr b/src/test/ui/dst/dst-object-from-unsized-type.stderr index 49940112a9f63..2d12265df98ed 100644 --- a/src/test/ui/dst/dst-object-from-unsized-type.stderr +++ b/src/test/ui/dst/dst-object-from-unsized-type.stderr @@ -2,7 +2,7 @@ error[E0277]: the size for values of type `T` cannot be known at compilation tim --> $DIR/dst-object-from-unsized-type.rs:8:23 | LL | fn test1(t: &T) { - | - this type parameter needs to be `Sized` + | - this type parameter needs to be `std::marker::Sized` LL | let u: &dyn Foo = t; | ^ doesn't have a size known at compile-time | @@ -12,7 +12,7 @@ error[E0277]: the size for values of type `T` cannot be known at compilation tim --> $DIR/dst-object-from-unsized-type.rs:13:23 | LL | fn test2(t: &T) { - | - this type parameter needs to be `Sized` + | - this type parameter needs to be `std::marker::Sized` LL | let v: &dyn Foo = t as &dyn Foo; | ^ doesn't have a size known at compile-time | diff --git a/src/test/ui/feature-gates/feature-gate-generic_associated_types.stderr b/src/test/ui/feature-gates/feature-gate-generic_associated_types.stderr index 266008cc0def4..4afbde5021f91 100644 --- a/src/test/ui/feature-gates/feature-gate-generic_associated_types.stderr +++ b/src/test/ui/feature-gates/feature-gate-generic_associated_types.stderr @@ -69,8 +69,8 @@ LL | type Pointer2 = Box; | help: consider restricting type parameter `U32` | -LL | type Pointer2 = Box; - | ^^^^^^^ +LL | type Pointer2 = Box; + | ^^^^^^^^^^^^^^^^^^^ error: aborting due to 8 previous errors diff --git a/src/test/ui/generic-associated-types/impl_bounds.stderr b/src/test/ui/generic-associated-types/impl_bounds.stderr index 645d292714562..e3d3de8bf9417 100644 --- a/src/test/ui/generic-associated-types/impl_bounds.stderr +++ b/src/test/ui/generic-associated-types/impl_bounds.stderr @@ -51,8 +51,8 @@ LL | type C where Self: Copy = String; = note: the requirement `Fooy: Copy` appears on the associated impl type but not on the corresponding associated trait type help: consider restricting type parameter `T` | -LL | impl Foo for Fooy { - | ^^^^^^ +LL | impl Foo for Fooy { + | ^^^^^^^^^^^^^^^^^^^ error: aborting due to 4 previous errors diff --git a/src/test/ui/generic-associated-types/issue-68641-check-gat-bounds.stderr b/src/test/ui/generic-associated-types/issue-68641-check-gat-bounds.stderr index b380f0da2ea40..c92800c3746ad 100644 --- a/src/test/ui/generic-associated-types/issue-68641-check-gat-bounds.stderr +++ b/src/test/ui/generic-associated-types/issue-68641-check-gat-bounds.stderr @@ -18,8 +18,8 @@ LL | type Item<'a> = T; | help: consider restricting type parameter `T` | -LL | impl UnsafeCopy for T { - | ^^^^^^ +LL | impl UnsafeCopy for T { + | ^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error; 1 warning emitted diff --git a/src/test/ui/generic-associated-types/issue-68642-broken-llvm-ir.stderr b/src/test/ui/generic-associated-types/issue-68642-broken-llvm-ir.stderr index 61950478c32a8..e44547b10c17b 100644 --- a/src/test/ui/generic-associated-types/issue-68642-broken-llvm-ir.stderr +++ b/src/test/ui/generic-associated-types/issue-68642-broken-llvm-ir.stderr @@ -19,8 +19,8 @@ LL | type F<'a> = Self; = note: wrap the `T` in a closure with no arguments: `|| { /* code */ }` help: consider restricting type parameter `T` | -LL | impl> Fun for T { - | ^^^^^^^^ +LL | impl> Fun for T { + | ^^^^^^^^^^^^^^^^^^ error: aborting due to previous error; 1 warning emitted diff --git a/src/test/ui/generic-associated-types/issue-68643-broken-mir.stderr b/src/test/ui/generic-associated-types/issue-68643-broken-mir.stderr index 13980618987be..fd0b4733d9359 100644 --- a/src/test/ui/generic-associated-types/issue-68643-broken-mir.stderr +++ b/src/test/ui/generic-associated-types/issue-68643-broken-mir.stderr @@ -19,8 +19,8 @@ LL | type F<'a> = Self; = note: wrap the `T` in a closure with no arguments: `|| { /* code */ }` help: consider restricting type parameter `T` | -LL | impl> Fun for T { - | ^^^^^^^^ +LL | impl> Fun for T { + | ^^^^^^^^^^^^^^^^^^ error: aborting due to previous error; 1 warning emitted diff --git a/src/test/ui/generic-associated-types/issue-68644-codegen-selection.stderr b/src/test/ui/generic-associated-types/issue-68644-codegen-selection.stderr index 8112425146959..0c23c870f0106 100644 --- a/src/test/ui/generic-associated-types/issue-68644-codegen-selection.stderr +++ b/src/test/ui/generic-associated-types/issue-68644-codegen-selection.stderr @@ -19,8 +19,8 @@ LL | type F<'a> = Self; = note: wrap the `T` in a closure with no arguments: `|| { /* code */ }` help: consider restricting type parameter `T` | -LL | impl> Fun for T { - | ^^^^^^^^ +LL | impl> Fun for T { + | ^^^^^^^^^^^^^^^^^^ error: aborting due to previous error; 1 warning emitted diff --git a/src/test/ui/generic-associated-types/issue-68645-codegen-fulfillment.stderr b/src/test/ui/generic-associated-types/issue-68645-codegen-fulfillment.stderr index 22f50b3949828..85d8d3f8e936e 100644 --- a/src/test/ui/generic-associated-types/issue-68645-codegen-fulfillment.stderr +++ b/src/test/ui/generic-associated-types/issue-68645-codegen-fulfillment.stderr @@ -19,8 +19,8 @@ LL | type F<'a> = Self; = note: wrap the `T` in a closure with no arguments: `|| { /* code */ }` help: consider restricting type parameter `T` | -LL | impl> Fun for T { - | ^^^^^^^^ +LL | impl> Fun for T { + | ^^^^^^^^^^^^^^^^^^ error: aborting due to previous error; 1 warning emitted diff --git a/src/test/ui/generic-associated-types/issue-74824.stderr b/src/test/ui/generic-associated-types/issue-74824.stderr index 34a2c1932ebcc..7a7b5fd4f1c55 100644 --- a/src/test/ui/generic-associated-types/issue-74824.stderr +++ b/src/test/ui/generic-associated-types/issue-74824.stderr @@ -19,8 +19,8 @@ LL | type Copy: Copy = Box; = note: required because of the requirements on the impl of `Clone` for `Box` help: consider restricting type parameter `T` | -LL | type Copy: Copy = Box; - | ^^^^^^^ +LL | type Copy: Copy = Box; + | ^^^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/impl-trait/issue-55872-1.full_tait.stderr b/src/test/ui/impl-trait/issue-55872-1.full_tait.stderr index 5195333884a83..67a500f34d8e7 100644 --- a/src/test/ui/impl-trait/issue-55872-1.full_tait.stderr +++ b/src/test/ui/impl-trait/issue-55872-1.full_tait.stderr @@ -25,8 +25,8 @@ LL | type E = impl Copy; = note: required because it appears within the type `(S, T)` help: consider further restricting this bound | -LL | impl Bar for S { - | ^^^^^^ +LL | impl Bar for S { + | ^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `T: Copy` is not satisfied in `(S, T)` --> $DIR/issue-55872-1.rs:14:14 @@ -37,8 +37,8 @@ LL | type E = impl Copy; = note: required because it appears within the type `(S, T)` help: consider further restricting this bound | -LL | fn foo() -> Self::E { - | ^^^^^^ +LL | fn foo() -> Self::E { + | ^^^^^^^^^^^^^^^^^^^ error: type parameter `T` is part of concrete type but not used in parameter list for the `impl Trait` type alias --> $DIR/issue-55872-1.rs:18:37 diff --git a/src/test/ui/impl-trait/issue-55872-1.min_tait.stderr b/src/test/ui/impl-trait/issue-55872-1.min_tait.stderr index 26fc200c2a2d5..90225d249d759 100644 --- a/src/test/ui/impl-trait/issue-55872-1.min_tait.stderr +++ b/src/test/ui/impl-trait/issue-55872-1.min_tait.stderr @@ -16,8 +16,8 @@ LL | type E = impl Copy; = note: required because it appears within the type `(S, T)` help: consider further restricting this bound | -LL | impl Bar for S { - | ^^^^^^ +LL | impl Bar for S { + | ^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `T: Copy` is not satisfied in `(S, T)` --> $DIR/issue-55872-1.rs:14:14 @@ -28,8 +28,8 @@ LL | type E = impl Copy; = note: required because it appears within the type `(S, T)` help: consider further restricting this bound | -LL | fn foo() -> Self::E { - | ^^^^^^ +LL | fn foo() -> Self::E { + | ^^^^^^^^^^^^^^^^^^^ error: type parameter `T` is part of concrete type but not used in parameter list for the `impl Trait` type alias --> $DIR/issue-55872-1.rs:18:37 diff --git a/src/test/ui/issues/issue-27060-2.stderr b/src/test/ui/issues/issue-27060-2.stderr index c4faecbdf2f9e..5dbcc96e87488 100644 --- a/src/test/ui/issues/issue-27060-2.stderr +++ b/src/test/ui/issues/issue-27060-2.stderr @@ -2,7 +2,7 @@ error[E0277]: the size for values of type `T` cannot be known at compilation tim --> $DIR/issue-27060-2.rs:3:11 | LL | pub struct Bad { - | - this type parameter needs to be `Sized` + | - this type parameter needs to be `std::marker::Sized` LL | data: T, | ^ doesn't have a size known at compile-time | diff --git a/src/test/ui/issues/issue-43784-supertrait.stderr b/src/test/ui/issues/issue-43784-supertrait.stderr index c73536ba97332..45a2350ddfd0e 100644 --- a/src/test/ui/issues/issue-43784-supertrait.stderr +++ b/src/test/ui/issues/issue-43784-supertrait.stderr @@ -9,8 +9,8 @@ LL | impl Complete for T {} | help: consider restricting type parameter `T` | -LL | impl Complete for T {} - | ^^^^^^ +LL | impl Complete for T {} + | ^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/kindck/kindck-impl-type-params.nll.stderr b/src/test/ui/kindck/kindck-impl-type-params.nll.stderr index b01b8258e735f..e9002ec36f43d 100644 --- a/src/test/ui/kindck/kindck-impl-type-params.nll.stderr +++ b/src/test/ui/kindck/kindck-impl-type-params.nll.stderr @@ -8,8 +8,8 @@ LL | let a = &t as &dyn Gettable; = note: required for the cast to the object type `dyn Gettable` help: consider restricting type parameter `T` | -LL | fn f(val: T) { - | ^^^^^^ +LL | fn f(val: T) { + | ^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `T: Copy` is not satisfied --> $DIR/kindck-impl-type-params.rs:18:13 @@ -21,8 +21,8 @@ LL | let a = &t as &dyn Gettable; = note: required for the cast to the object type `dyn Gettable` help: consider restricting type parameter `T` | -LL | fn f(val: T) { - | ^^^^^^ +LL | fn f(val: T) { + | ^^^^^^^^^^^^^^^^^^^ error[E0277]: `T` cannot be sent between threads safely --> $DIR/kindck-impl-type-params.rs:25:31 @@ -34,8 +34,8 @@ LL | let a: &dyn Gettable = &t; = note: required for the cast to the object type `dyn Gettable` help: consider restricting type parameter `T` | -LL | fn g(val: T) { - | ^^^^^^ +LL | fn g(val: T) { + | ^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `T: Copy` is not satisfied --> $DIR/kindck-impl-type-params.rs:25:31 @@ -47,8 +47,8 @@ LL | let a: &dyn Gettable = &t; = note: required for the cast to the object type `dyn Gettable` help: consider restricting type parameter `T` | -LL | fn g(val: T) { - | ^^^^^^ +LL | fn g(val: T) { + | ^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `String: Copy` is not satisfied --> $DIR/kindck-impl-type-params.rs:38:13 diff --git a/src/test/ui/kindck/kindck-impl-type-params.stderr b/src/test/ui/kindck/kindck-impl-type-params.stderr index ddf8adf3637b3..472a6bcafa273 100644 --- a/src/test/ui/kindck/kindck-impl-type-params.stderr +++ b/src/test/ui/kindck/kindck-impl-type-params.stderr @@ -8,8 +8,8 @@ LL | let a = &t as &dyn Gettable; = note: required for the cast to the object type `dyn Gettable` help: consider restricting type parameter `T` | -LL | fn f(val: T) { - | ^^^^^^ +LL | fn f(val: T) { + | ^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `T: Copy` is not satisfied --> $DIR/kindck-impl-type-params.rs:18:13 @@ -21,8 +21,8 @@ LL | let a = &t as &dyn Gettable; = note: required for the cast to the object type `dyn Gettable` help: consider restricting type parameter `T` | -LL | fn f(val: T) { - | ^^^^^^ +LL | fn f(val: T) { + | ^^^^^^^^^^^^^^^^^^^ error[E0277]: `T` cannot be sent between threads safely --> $DIR/kindck-impl-type-params.rs:25:31 @@ -34,8 +34,8 @@ LL | let a: &dyn Gettable = &t; = note: required for the cast to the object type `dyn Gettable` help: consider restricting type parameter `T` | -LL | fn g(val: T) { - | ^^^^^^ +LL | fn g(val: T) { + | ^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `T: Copy` is not satisfied --> $DIR/kindck-impl-type-params.rs:25:31 @@ -47,8 +47,8 @@ LL | let a: &dyn Gettable = &t; = note: required for the cast to the object type `dyn Gettable` help: consider restricting type parameter `T` | -LL | fn g(val: T) { - | ^^^^^^ +LL | fn g(val: T) { + | ^^^^^^^^^^^^^^^^^^^ error[E0477]: the type `&'a isize` does not fulfill the required lifetime --> $DIR/kindck-impl-type-params.rs:32:13 diff --git a/src/test/ui/phantom-auto-trait.stderr b/src/test/ui/phantom-auto-trait.stderr index 779919f9d643f..5a2ad637e4204 100644 --- a/src/test/ui/phantom-auto-trait.stderr +++ b/src/test/ui/phantom-auto-trait.stderr @@ -12,8 +12,8 @@ LL | is_zen(x) = note: required because it appears within the type `Guard<'_, T>` help: consider restricting type parameter `T` | -LL | fn not_sync(x: Guard) { - | ^^^^^^ +LL | fn not_sync(x: Guard) { + | ^^^^^^^^^^^^^^^^^^^ error[E0277]: `T` cannot be shared between threads safely --> $DIR/phantom-auto-trait.rs:26:12 @@ -30,8 +30,8 @@ LL | is_zen(x) = note: required because it appears within the type `Nested>` help: consider restricting type parameter `T` | -LL | fn nested_not_sync(x: Nested>) { - | ^^^^^^ +LL | fn nested_not_sync(x: Nested>) { + | ^^^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/specialization/deafult-generic-associated-type-bound.stderr b/src/test/ui/specialization/deafult-generic-associated-type-bound.stderr index b5a1877ea1931..eb5d80bc4dda6 100644 --- a/src/test/ui/specialization/deafult-generic-associated-type-bound.stderr +++ b/src/test/ui/specialization/deafult-generic-associated-type-bound.stderr @@ -28,8 +28,8 @@ LL | default type U<'a> = &'a T; = note: required because of the requirements on the impl of `PartialEq` for `&'a T` help: consider further restricting this bound | -LL | impl X for T { - | ^^^^^^^^^^^ +LL | impl X for T { + | ^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error; 2 warnings emitted diff --git a/src/test/ui/specialization/defaultimpl/specialization-wfcheck.stderr b/src/test/ui/specialization/defaultimpl/specialization-wfcheck.stderr index 57b90c457cb77..e416f30cb415d 100644 --- a/src/test/ui/specialization/defaultimpl/specialization-wfcheck.stderr +++ b/src/test/ui/specialization/defaultimpl/specialization-wfcheck.stderr @@ -19,8 +19,8 @@ LL | default impl Foo<'static, U> for () {} | help: consider restricting type parameter `U` | -LL | default impl Foo<'static, U> for () {} - | ^^^^ +LL | default impl Foo<'static, U> for () {} + | ^^^^^^^^^^^^^^ error: aborting due to previous error; 1 warning emitted diff --git a/src/test/ui/suggestions/adt-param-with-implicit-sized-bound.stderr b/src/test/ui/suggestions/adt-param-with-implicit-sized-bound.stderr index 9437fbe61cc7e..5cb3a404037a7 100644 --- a/src/test/ui/suggestions/adt-param-with-implicit-sized-bound.stderr +++ b/src/test/ui/suggestions/adt-param-with-implicit-sized-bound.stderr @@ -5,7 +5,7 @@ LL | struct X(T); | - required by this bound in `X` ... LL | struct Struct5{ - | - this type parameter needs to be `Sized` + | - this type parameter needs to be `std::marker::Sized` LL | _t: X, | ^^^^ doesn't have a size known at compile-time | diff --git a/src/test/ui/suggestions/restrict-type-argument.stderr b/src/test/ui/suggestions/restrict-type-argument.stderr index 7a7242a6369df..33af13d943f74 100644 --- a/src/test/ui/suggestions/restrict-type-argument.stderr +++ b/src/test/ui/suggestions/restrict-type-argument.stderr @@ -9,8 +9,8 @@ LL | is_send(val); | help: consider further restricting this bound | -LL | fn use_impl_sync(val: impl Sync + Send) { - | ^^^^^^ +LL | fn use_impl_sync(val: impl Sync + std::marker::Send) { + | ^^^^^^^^^^^^^^^^^^^ error[E0277]: `S` cannot be sent between threads safely --> $DIR/restrict-type-argument.rs:8:13 @@ -23,8 +23,8 @@ LL | is_send(val); | help: consider further restricting this bound | -LL | fn use_where(val: S) where S: Sync + Send { - | ^^^^^^ +LL | fn use_where(val: S) where S: Sync + std::marker::Send { + | ^^^^^^^^^^^^^^^^^^^ error[E0277]: `S` cannot be sent between threads safely --> $DIR/restrict-type-argument.rs:12:13 @@ -37,8 +37,8 @@ LL | is_send(val); | help: consider further restricting this bound | -LL | fn use_bound(val: S) { - | ^^^^^^ +LL | fn use_bound(val: S) { + | ^^^^^^^^^^^^^^^^^^^ error[E0277]: `S` cannot be sent between threads safely --> $DIR/restrict-type-argument.rs:20:13 @@ -51,8 +51,8 @@ LL | is_send(val); | help: consider further restricting this bound | -LL | Sync + Send - | ^^^^^^ +LL | Sync + std::marker::Send + | ^^^^^^^^^^^^^^^^^^^ error[E0277]: `S` cannot be sent between threads safely --> $DIR/restrict-type-argument.rs:24:13 @@ -65,8 +65,8 @@ LL | is_send(val); | help: consider further restricting this bound | -LL | fn use_bound_and_where(val: S) where S: std::fmt::Debug + Send { - | ^^^^^^ +LL | fn use_bound_and_where(val: S) where S: std::fmt::Debug + std::marker::Send { + | ^^^^^^^^^^^^^^^^^^^ error[E0277]: `S` cannot be sent between threads safely --> $DIR/restrict-type-argument.rs:28:13 @@ -79,8 +79,8 @@ LL | is_send(val); | help: consider restricting type parameter `S` | -LL | fn use_unbound(val: S) { - | ^^^^^^ +LL | fn use_unbound(val: S) { + | ^^^^^^^^^^^^^^^^^^^ error: aborting due to 6 previous errors diff --git a/src/test/ui/trait-impl-bound-suggestions.fixed b/src/test/ui/trait-impl-bound-suggestions.fixed index db3a95f5c4f61..744e7bef04e97 100644 --- a/src/test/ui/trait-impl-bound-suggestions.fixed +++ b/src/test/ui/trait-impl-bound-suggestions.fixed @@ -10,7 +10,7 @@ struct ConstrainedStruct { } #[allow(dead_code)] -trait InsufficientlyConstrainedGeneric where X: Copy { +trait InsufficientlyConstrainedGeneric where X: std::marker::Copy { fn return_the_constrained_type(&self, x: X) -> ConstrainedStruct { //~^ ERROR the trait bound `X: Copy` is not satisfied ConstrainedStruct { x } diff --git a/src/test/ui/trait-impl-bound-suggestions.stderr b/src/test/ui/trait-impl-bound-suggestions.stderr index 3a21e9c6b2ad4..110ca79908079 100644 --- a/src/test/ui/trait-impl-bound-suggestions.stderr +++ b/src/test/ui/trait-impl-bound-suggestions.stderr @@ -9,8 +9,8 @@ LL | fn return_the_constrained_type(&self, x: X) -> ConstrainedStruct { | help: consider further restricting type parameter `X` | -LL | trait InsufficientlyConstrainedGeneric where X: Copy { - | ^^^^^^^^^^^^^ +LL | trait InsufficientlyConstrainedGeneric where X: std::marker::Copy { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/traits/inductive-overflow/two-traits.stderr b/src/test/ui/traits/inductive-overflow/two-traits.stderr index d3f2931f25d47..508a12d859a62 100644 --- a/src/test/ui/traits/inductive-overflow/two-traits.stderr +++ b/src/test/ui/traits/inductive-overflow/two-traits.stderr @@ -9,8 +9,8 @@ LL | type X = Self; | help: consider further restricting this bound | -LL | impl Magic for T { - | ^^^^^^ +LL | impl Magic for T { + | ^^^^^^^^^^^^^^^^^^^ error[E0275]: overflow evaluating the requirement `*mut (): Magic` --> $DIR/two-traits.rs:20:5 diff --git a/src/test/ui/traits/suggest-where-clause.stderr b/src/test/ui/traits/suggest-where-clause.stderr index 86d589ffa9e31..efab64205f3af 100644 --- a/src/test/ui/traits/suggest-where-clause.stderr +++ b/src/test/ui/traits/suggest-where-clause.stderr @@ -2,7 +2,7 @@ error[E0277]: the size for values of type `U` cannot be known at compilation tim --> $DIR/suggest-where-clause.rs:7:20 | LL | fn check() { - | - this type parameter needs to be `Sized` + | - this type parameter needs to be `std::marker::Sized` LL | // suggest a where-clause, if needed LL | mem::size_of::(); | ^ doesn't have a size known at compile-time @@ -16,7 +16,7 @@ error[E0277]: the size for values of type `U` cannot be known at compilation tim --> $DIR/suggest-where-clause.rs:10:5 | LL | fn check() { - | - this type parameter needs to be `Sized` + | - this type parameter needs to be `std::marker::Sized` ... LL | mem::size_of::>(); | ^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time diff --git a/src/test/ui/type-alias-impl-trait/bounds-are-checked-2.full_tait.stderr b/src/test/ui/type-alias-impl-trait/bounds-are-checked-2.full_tait.stderr index 871ef22f3ebcf..cfb1fe9c19a8b 100644 --- a/src/test/ui/type-alias-impl-trait/bounds-are-checked-2.full_tait.stderr +++ b/src/test/ui/type-alias-impl-trait/bounds-are-checked-2.full_tait.stderr @@ -15,8 +15,8 @@ LL | type X = impl Clone; | help: consider restricting type parameter `T` | -LL | type X = impl Clone; - | ^^^^^^^ +LL | type X = impl Clone; + | ^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error; 1 warning emitted diff --git a/src/test/ui/type-alias-impl-trait/bounds-are-checked-2.min_tait.stderr b/src/test/ui/type-alias-impl-trait/bounds-are-checked-2.min_tait.stderr index 20656e5e55320..735b96d5df98e 100644 --- a/src/test/ui/type-alias-impl-trait/bounds-are-checked-2.min_tait.stderr +++ b/src/test/ui/type-alias-impl-trait/bounds-are-checked-2.min_tait.stderr @@ -6,8 +6,8 @@ LL | type X = impl Clone; | help: consider restricting type parameter `T` | -LL | type X = impl Clone; - | ^^^^^^^ +LL | type X = impl Clone; + | ^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/type-alias-impl-trait/generic_duplicate_param_use5.full_tait.stderr b/src/test/ui/type-alias-impl-trait/generic_duplicate_param_use5.full_tait.stderr index 8a0c411c7754a..aab64e72b7bca 100644 --- a/src/test/ui/type-alias-impl-trait/generic_duplicate_param_use5.full_tait.stderr +++ b/src/test/ui/type-alias-impl-trait/generic_duplicate_param_use5.full_tait.stderr @@ -28,8 +28,8 @@ LL | type Two = impl Debug; = note: required because of the requirements on the impl of `Debug` for `(T, U)` help: consider restricting type parameter `T` | -LL | type Two = impl Debug; - | ^^^^^^^ +LL | type Two = impl Debug; + | ^^^^^^^^^^^^^^^^^ error[E0277]: `U` doesn't implement `Debug` --> $DIR/generic_duplicate_param_use5.rs:11:18 @@ -40,8 +40,8 @@ LL | type Two = impl Debug; = note: required because of the requirements on the impl of `Debug` for `(T, U)` help: consider restricting type parameter `U` | -LL | type Two = impl Debug; - | ^^^^^^^ +LL | type Two = impl Debug; + | ^^^^^^^^^^^^^^^^^ error: aborting due to 3 previous errors; 1 warning emitted diff --git a/src/test/ui/type-alias-impl-trait/generic_duplicate_param_use5.min_tait.stderr b/src/test/ui/type-alias-impl-trait/generic_duplicate_param_use5.min_tait.stderr index 35115ccb2d678..5c8c5b8977906 100644 --- a/src/test/ui/type-alias-impl-trait/generic_duplicate_param_use5.min_tait.stderr +++ b/src/test/ui/type-alias-impl-trait/generic_duplicate_param_use5.min_tait.stderr @@ -19,8 +19,8 @@ LL | type Two = impl Debug; = note: required because of the requirements on the impl of `Debug` for `(T, U)` help: consider restricting type parameter `T` | -LL | type Two = impl Debug; - | ^^^^^^^ +LL | type Two = impl Debug; + | ^^^^^^^^^^^^^^^^^ error[E0277]: `U` doesn't implement `Debug` --> $DIR/generic_duplicate_param_use5.rs:11:18 @@ -31,8 +31,8 @@ LL | type Two = impl Debug; = note: required because of the requirements on the impl of `Debug` for `(T, U)` help: consider restricting type parameter `U` | -LL | type Two = impl Debug; - | ^^^^^^^ +LL | type Two = impl Debug; + | ^^^^^^^^^^^^^^^^^ error: aborting due to 3 previous errors diff --git a/src/test/ui/type-alias-impl-trait/generic_duplicate_param_use6.full_tait.stderr b/src/test/ui/type-alias-impl-trait/generic_duplicate_param_use6.full_tait.stderr index 8f72c333e817c..a69e99bf8b05f 100644 --- a/src/test/ui/type-alias-impl-trait/generic_duplicate_param_use6.full_tait.stderr +++ b/src/test/ui/type-alias-impl-trait/generic_duplicate_param_use6.full_tait.stderr @@ -28,8 +28,8 @@ LL | type Two = impl Debug; = note: required because of the requirements on the impl of `Debug` for `(T, T)` help: consider restricting type parameter `T` | -LL | type Two = impl Debug; - | ^^^^^^^ +LL | type Two = impl Debug; + | ^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors; 1 warning emitted diff --git a/src/test/ui/type-alias-impl-trait/generic_duplicate_param_use6.min_tait.stderr b/src/test/ui/type-alias-impl-trait/generic_duplicate_param_use6.min_tait.stderr index 922c9a7420848..a377ef2d87322 100644 --- a/src/test/ui/type-alias-impl-trait/generic_duplicate_param_use6.min_tait.stderr +++ b/src/test/ui/type-alias-impl-trait/generic_duplicate_param_use6.min_tait.stderr @@ -19,8 +19,8 @@ LL | type Two = impl Debug; = note: required because of the requirements on the impl of `Debug` for `(T, T)` help: consider restricting type parameter `T` | -LL | type Two = impl Debug; - | ^^^^^^^ +LL | type Two = impl Debug; + | ^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/type-alias-impl-trait/generic_duplicate_param_use8.full_tait.stderr b/src/test/ui/type-alias-impl-trait/generic_duplicate_param_use8.full_tait.stderr index a93321d4d0508..e73ac88500e03 100644 --- a/src/test/ui/type-alias-impl-trait/generic_duplicate_param_use8.full_tait.stderr +++ b/src/test/ui/type-alias-impl-trait/generic_duplicate_param_use8.full_tait.stderr @@ -28,8 +28,8 @@ LL | type Two = impl Debug; = note: required because of the requirements on the impl of `Debug` for `(T, u32)` help: consider restricting type parameter `T` | -LL | type Two = impl Debug; - | ^^^^^^^ +LL | type Two = impl Debug; + | ^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors; 1 warning emitted diff --git a/src/test/ui/type-alias-impl-trait/generic_duplicate_param_use8.min_tait.stderr b/src/test/ui/type-alias-impl-trait/generic_duplicate_param_use8.min_tait.stderr index 25ac60799f668..d7edce7a491de 100644 --- a/src/test/ui/type-alias-impl-trait/generic_duplicate_param_use8.min_tait.stderr +++ b/src/test/ui/type-alias-impl-trait/generic_duplicate_param_use8.min_tait.stderr @@ -19,8 +19,8 @@ LL | type Two = impl Debug; = note: required because of the requirements on the impl of `Debug` for `(T, u32)` help: consider restricting type parameter `T` | -LL | type Two = impl Debug; - | ^^^^^^^ +LL | type Two = impl Debug; + | ^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/type-alias-impl-trait/generic_duplicate_param_use9.full_tait.stderr b/src/test/ui/type-alias-impl-trait/generic_duplicate_param_use9.full_tait.stderr index 098be7929d6f2..0b3d72d67b242 100644 --- a/src/test/ui/type-alias-impl-trait/generic_duplicate_param_use9.full_tait.stderr +++ b/src/test/ui/type-alias-impl-trait/generic_duplicate_param_use9.full_tait.stderr @@ -40,8 +40,8 @@ LL | type Two = impl Debug; = note: required because of the requirements on the impl of `Debug` for `(A, B, ::Bar)` help: consider restricting type parameter `A` | -LL | type Two = impl Debug; - | ^^^^^^^ +LL | type Two = impl Debug; + | ^^^^^^^^^^^^^^^^^ error[E0277]: `B` doesn't implement `Debug` --> $DIR/generic_duplicate_param_use9.rs:10:18 @@ -52,8 +52,8 @@ LL | type Two = impl Debug; = note: required because of the requirements on the impl of `Debug` for `(A, B, ::Bar)` help: consider restricting type parameter `B` | -LL | type Two = impl Debug; - | ^^^^^^^ +LL | type Two = impl Debug; + | ^^^^^^^^^^^^^^^^^ error: aborting due to 4 previous errors; 1 warning emitted diff --git a/src/test/ui/type-alias-impl-trait/generic_duplicate_param_use9.min_tait.stderr b/src/test/ui/type-alias-impl-trait/generic_duplicate_param_use9.min_tait.stderr index b59e10c1b06f1..fd1081d7b71de 100644 --- a/src/test/ui/type-alias-impl-trait/generic_duplicate_param_use9.min_tait.stderr +++ b/src/test/ui/type-alias-impl-trait/generic_duplicate_param_use9.min_tait.stderr @@ -31,8 +31,8 @@ LL | type Two = impl Debug; = note: required because of the requirements on the impl of `Debug` for `(A, B, ::Bar)` help: consider restricting type parameter `A` | -LL | type Two = impl Debug; - | ^^^^^^^ +LL | type Two = impl Debug; + | ^^^^^^^^^^^^^^^^^ error[E0277]: `B` doesn't implement `Debug` --> $DIR/generic_duplicate_param_use9.rs:10:18 @@ -43,8 +43,8 @@ LL | type Two = impl Debug; = note: required because of the requirements on the impl of `Debug` for `(A, B, ::Bar)` help: consider restricting type parameter `B` | -LL | type Two = impl Debug; - | ^^^^^^^ +LL | type Two = impl Debug; + | ^^^^^^^^^^^^^^^^^ error: aborting due to 4 previous errors diff --git a/src/test/ui/type-alias-impl-trait/generic_underconstrained2.full_tait.stderr b/src/test/ui/type-alias-impl-trait/generic_underconstrained2.full_tait.stderr index ca263ba4f5b41..7ab73d24274ce 100644 --- a/src/test/ui/type-alias-impl-trait/generic_underconstrained2.full_tait.stderr +++ b/src/test/ui/type-alias-impl-trait/generic_underconstrained2.full_tait.stderr @@ -30,8 +30,8 @@ LL | fn underconstrained(_: U) -> Underconstrained { | help: consider restricting type parameter `U` | -LL | fn underconstrained(_: U) -> Underconstrained { - | ^^^^^^^ +LL | fn underconstrained(_: U) -> Underconstrained { + | ^^^^^^^^^^^^^^^^^ error[E0277]: `V` doesn't implement `Debug` --> $DIR/generic_underconstrained2.rs:21:43 @@ -44,8 +44,8 @@ LL | fn underconstrained2(_: U, _: V) -> Underconstrained2 { | help: consider restricting type parameter `V` | -LL | fn underconstrained2(_: U, _: V) -> Underconstrained2 { - | ^^^^^^^ +LL | fn underconstrained2(_: U, _: V) -> Underconstrained2 { + | ^^^^^^^^^^^^^^^^^ error: aborting due to 4 previous errors; 1 warning emitted diff --git a/src/test/ui/type-alias-impl-trait/generic_underconstrained2.min_tait.stderr b/src/test/ui/type-alias-impl-trait/generic_underconstrained2.min_tait.stderr index 6ce32f457e3ec..a4f5f4b8645b1 100644 --- a/src/test/ui/type-alias-impl-trait/generic_underconstrained2.min_tait.stderr +++ b/src/test/ui/type-alias-impl-trait/generic_underconstrained2.min_tait.stderr @@ -21,8 +21,8 @@ LL | fn underconstrained(_: U) -> Underconstrained { | help: consider restricting type parameter `U` | -LL | fn underconstrained(_: U) -> Underconstrained { - | ^^^^^^^ +LL | fn underconstrained(_: U) -> Underconstrained { + | ^^^^^^^^^^^^^^^^^ error[E0277]: `V` doesn't implement `Debug` --> $DIR/generic_underconstrained2.rs:21:43 @@ -35,8 +35,8 @@ LL | fn underconstrained2(_: U, _: V) -> Underconstrained2 { | help: consider restricting type parameter `V` | -LL | fn underconstrained2(_: U, _: V) -> Underconstrained2 { - | ^^^^^^^ +LL | fn underconstrained2(_: U, _: V) -> Underconstrained2 { + | ^^^^^^^^^^^^^^^^^ error: aborting due to 4 previous errors diff --git a/src/test/ui/type-alias-impl-trait/issue-52843.full_tait.stderr b/src/test/ui/type-alias-impl-trait/issue-52843.full_tait.stderr index 14f4f62d7a5f7..35ac0993b29ca 100644 --- a/src/test/ui/type-alias-impl-trait/issue-52843.full_tait.stderr +++ b/src/test/ui/type-alias-impl-trait/issue-52843.full_tait.stderr @@ -15,8 +15,8 @@ LL | type Foo = impl Default; | help: consider restricting type parameter `T` | -LL | type Foo = impl Default; - | ^^^^^^^^^ +LL | type Foo = impl Default; + | ^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error; 1 warning emitted diff --git a/src/test/ui/type-alias-impl-trait/issue-52843.min_tait.stderr b/src/test/ui/type-alias-impl-trait/issue-52843.min_tait.stderr index 6dda27f515e79..9fb760f34c19a 100644 --- a/src/test/ui/type-alias-impl-trait/issue-52843.min_tait.stderr +++ b/src/test/ui/type-alias-impl-trait/issue-52843.min_tait.stderr @@ -6,8 +6,8 @@ LL | type Foo = impl Default; | help: consider restricting type parameter `T` | -LL | type Foo = impl Default; - | ^^^^^^^^^ +LL | type Foo = impl Default; + | ^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/type/type-check-defaults.stderr b/src/test/ui/type/type-check-defaults.stderr index d8c7f595e62ef..ddfa31cf62448 100644 --- a/src/test/ui/type/type-check-defaults.stderr +++ b/src/test/ui/type/type-check-defaults.stderr @@ -56,8 +56,8 @@ LL | trait Base: Super { } | help: consider further restricting type parameter `T` | -LL | trait Base: Super where T: Copy { } - | ^^^^^^^^^^^^^ +LL | trait Base: Super where T: std::marker::Copy { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: cannot add `u8` to `i32` --> $DIR/type-check-defaults.rs:24:66 diff --git a/src/test/ui/typeck/typeck-default-trait-impl-send-param.stderr b/src/test/ui/typeck/typeck-default-trait-impl-send-param.stderr index 4fb423b9a2c38..7398b48a238d1 100644 --- a/src/test/ui/typeck/typeck-default-trait-impl-send-param.stderr +++ b/src/test/ui/typeck/typeck-default-trait-impl-send-param.stderr @@ -9,8 +9,8 @@ LL | fn is_send() { | help: consider restricting type parameter `T` | -LL | fn foo() { - | ^^^^^^ +LL | fn foo() { + | ^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/union/union-sized-field.stderr b/src/test/ui/union/union-sized-field.stderr index cebeeb59a7829..b916bbe8ad10a 100644 --- a/src/test/ui/union/union-sized-field.stderr +++ b/src/test/ui/union/union-sized-field.stderr @@ -2,7 +2,7 @@ error[E0277]: the size for values of type `T` cannot be known at compilation tim --> $DIR/union-sized-field.rs:4:12 | LL | union Foo { - | - this type parameter needs to be `Sized` + | - this type parameter needs to be `std::marker::Sized` LL | value: T, | ^ doesn't have a size known at compile-time | @@ -21,7 +21,7 @@ error[E0277]: the size for values of type `T` cannot be known at compilation tim --> $DIR/union-sized-field.rs:9:12 | LL | struct Foo2 { - | - this type parameter needs to be `Sized` + | - this type parameter needs to be `std::marker::Sized` LL | value: T, | ^ doesn't have a size known at compile-time | @@ -40,7 +40,7 @@ error[E0277]: the size for values of type `T` cannot be known at compilation tim --> $DIR/union-sized-field.rs:15:11 | LL | enum Foo3 { - | - this type parameter needs to be `Sized` + | - this type parameter needs to be `std::marker::Sized` LL | Value(T), | ^ doesn't have a size known at compile-time | diff --git a/src/test/ui/unsized/unsized-bare-typaram.stderr b/src/test/ui/unsized/unsized-bare-typaram.stderr index b2ff3159c9591..19978ae24cacb 100644 --- a/src/test/ui/unsized/unsized-bare-typaram.stderr +++ b/src/test/ui/unsized/unsized-bare-typaram.stderr @@ -6,7 +6,7 @@ LL | fn bar() { } LL | fn foo() { bar::() } | - ^ doesn't have a size known at compile-time | | - | this type parameter needs to be `Sized` + | this type parameter needs to be `std::marker::Sized` error: aborting due to previous error diff --git a/src/test/ui/unsized/unsized-enum.stderr b/src/test/ui/unsized/unsized-enum.stderr index 3057d4789bd81..601db7d1cd983 100644 --- a/src/test/ui/unsized/unsized-enum.stderr +++ b/src/test/ui/unsized/unsized-enum.stderr @@ -7,7 +7,7 @@ LL | fn foo1() { not_sized::>() } // Hunky dory. LL | fn foo2() { not_sized::>() } | - ^^^^^^ doesn't have a size known at compile-time | | - | this type parameter needs to be `Sized` + | this type parameter needs to be `std::marker::Sized` | help: you could relax the implicit `Sized` bound on `U` if it were used through indirection like `&U` or `Box` --> $DIR/unsized-enum.rs:4:10 diff --git a/src/test/ui/unsized/unsized-enum2.stderr b/src/test/ui/unsized/unsized-enum2.stderr index 0a0896638e072..79f690e8d1a83 100644 --- a/src/test/ui/unsized/unsized-enum2.stderr +++ b/src/test/ui/unsized/unsized-enum2.stderr @@ -2,7 +2,7 @@ error[E0277]: the size for values of type `W` cannot be known at compilation tim --> $DIR/unsized-enum2.rs:23:8 | LL | enum E { - | - this type parameter needs to be `Sized` + | - this type parameter needs to be `std::marker::Sized` LL | // parameter LL | VA(W), | ^ doesn't have a size known at compile-time @@ -22,7 +22,7 @@ error[E0277]: the size for values of type `X` cannot be known at compilation tim --> $DIR/unsized-enum2.rs:25:11 | LL | enum E { - | - this type parameter needs to be `Sized` + | - this type parameter needs to be `std::marker::Sized` ... LL | VB{x: X}, | ^ doesn't have a size known at compile-time @@ -42,7 +42,7 @@ error[E0277]: the size for values of type `Y` cannot be known at compilation tim --> $DIR/unsized-enum2.rs:27:15 | LL | enum E { - | - this type parameter needs to be `Sized` + | - this type parameter needs to be `std::marker::Sized` ... LL | VC(isize, Y), | ^ doesn't have a size known at compile-time @@ -62,7 +62,7 @@ error[E0277]: the size for values of type `Z` cannot be known at compilation tim --> $DIR/unsized-enum2.rs:29:21 | LL | enum E { - | - this type parameter needs to be `Sized` + | - this type parameter needs to be `std::marker::Sized` ... LL | VD{u: isize, x: Z}, | ^ doesn't have a size known at compile-time diff --git a/src/test/ui/unsized/unsized-inherent-impl-self-type.stderr b/src/test/ui/unsized/unsized-inherent-impl-self-type.stderr index 9d8a1c67734a4..9d072eda4e81c 100644 --- a/src/test/ui/unsized/unsized-inherent-impl-self-type.stderr +++ b/src/test/ui/unsized/unsized-inherent-impl-self-type.stderr @@ -7,7 +7,7 @@ LL | LL | impl S5 { | - ^^^^^ doesn't have a size known at compile-time | | - | this type parameter needs to be `Sized` + | this type parameter needs to be `std::marker::Sized` | help: you could relax the implicit `Sized` bound on `Y` if it were used through indirection like `&Y` or `Box` --> $DIR/unsized-inherent-impl-self-type.rs:5:11 diff --git a/src/test/ui/unsized/unsized-struct.stderr b/src/test/ui/unsized/unsized-struct.stderr index 6661cf358b3ab..52cf1cbb81d7f 100644 --- a/src/test/ui/unsized/unsized-struct.stderr +++ b/src/test/ui/unsized/unsized-struct.stderr @@ -7,7 +7,7 @@ LL | fn foo1() { not_sized::>() } // Hunky dory. LL | fn foo2() { not_sized::>() } | - ^^^^^^ doesn't have a size known at compile-time | | - | this type parameter needs to be `Sized` + | this type parameter needs to be `std::marker::Sized` | help: you could relax the implicit `Sized` bound on `T` if it were used through indirection like `&T` or `Box` --> $DIR/unsized-struct.rs:4:12 @@ -26,7 +26,7 @@ LL | fn is_sized() { } LL | fn bar2() { is_sized::>() } | - ^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | | - | this type parameter needs to be `Sized` + | this type parameter needs to be `std::marker::Sized` | = note: required because it appears within the type `Bar` diff --git a/src/test/ui/unsized/unsized-trait-impl-self-type.stderr b/src/test/ui/unsized/unsized-trait-impl-self-type.stderr index d1b590d813307..aef0d0cbb8395 100644 --- a/src/test/ui/unsized/unsized-trait-impl-self-type.stderr +++ b/src/test/ui/unsized/unsized-trait-impl-self-type.stderr @@ -7,7 +7,7 @@ LL | LL | impl T3 for S5 { | - ^^^^^ doesn't have a size known at compile-time | | - | this type parameter needs to be `Sized` + | this type parameter needs to be `std::marker::Sized` | help: you could relax the implicit `Sized` bound on `Y` if it were used through indirection like `&Y` or `Box` --> $DIR/unsized-trait-impl-self-type.rs:8:11 diff --git a/src/test/ui/unsized/unsized-trait-impl-trait-arg.stderr b/src/test/ui/unsized/unsized-trait-impl-trait-arg.stderr index 17fe16ed4fc05..f48d4ef9f1461 100644 --- a/src/test/ui/unsized/unsized-trait-impl-trait-arg.stderr +++ b/src/test/ui/unsized/unsized-trait-impl-trait-arg.stderr @@ -7,7 +7,7 @@ LL | trait T2 { LL | impl T2 for S4 { | - ^^^^^ doesn't have a size known at compile-time | | - | this type parameter needs to be `Sized` + | this type parameter needs to be `std::marker::Sized` | help: consider relaxing the implicit `Sized` restriction | diff --git a/src/test/ui/unsized3.stderr b/src/test/ui/unsized3.stderr index 7ed43c38f1d38..ddddae4eaba57 100644 --- a/src/test/ui/unsized3.stderr +++ b/src/test/ui/unsized3.stderr @@ -2,7 +2,7 @@ error[E0277]: the size for values of type `X` cannot be known at compilation tim --> $DIR/unsized3.rs:7:13 | LL | fn f1(x: &X) { - | - this type parameter needs to be `Sized` + | - this type parameter needs to be `std::marker::Sized` LL | f2::(x); | ^ doesn't have a size known at compile-time ... @@ -18,7 +18,7 @@ error[E0277]: the size for values of type `X` cannot be known at compilation tim --> $DIR/unsized3.rs:18:13 | LL | fn f3(x: &X) { - | - this type parameter needs to be `Sized` + | - this type parameter needs to be `std::marker::Sized` LL | f4::(x); | ^ doesn't have a size known at compile-time ... @@ -37,7 +37,7 @@ LL | fn f5(x: &Y) {} | - required by this bound in `f5` ... LL | fn f8(x1: &S, x2: &S) { - | - this type parameter needs to be `Sized` + | - this type parameter needs to be `std::marker::Sized` LL | f5(x1); | ^^ doesn't have a size known at compile-time | @@ -51,7 +51,7 @@ error[E0277]: the size for values of type `X` cannot be known at compilation tim --> $DIR/unsized3.rs:40:8 | LL | fn f9(x1: Box>) { - | - this type parameter needs to be `Sized` + | - this type parameter needs to be `std::marker::Sized` LL | f5(&(*x1, 34)); | ^^^^^^^^^^ doesn't have a size known at compile-time | @@ -62,7 +62,7 @@ error[E0277]: the size for values of type `X` cannot be known at compilation tim --> $DIR/unsized3.rs:45:9 | LL | fn f10(x1: Box>) { - | - this type parameter needs to be `Sized` + | - this type parameter needs to be `std::marker::Sized` LL | f5(&(32, *x1)); | ^^^^^^^^^ doesn't have a size known at compile-time | @@ -77,7 +77,7 @@ LL | fn f5(x: &Y) {} | - required by this bound in `f5` ... LL | fn f10(x1: Box>) { - | - this type parameter needs to be `Sized` + | - this type parameter needs to be `std::marker::Sized` LL | f5(&(32, *x1)); | ^^^^^^^^^^ doesn't have a size known at compile-time | diff --git a/src/test/ui/unsized5.stderr b/src/test/ui/unsized5.stderr index a7539b0672afe..0bfd4565529aa 100644 --- a/src/test/ui/unsized5.stderr +++ b/src/test/ui/unsized5.stderr @@ -2,7 +2,7 @@ error[E0277]: the size for values of type `X` cannot be known at compilation tim --> $DIR/unsized5.rs:4:9 | LL | struct S1 { - | - this type parameter needs to be `Sized` + | - this type parameter needs to be `std::marker::Sized` LL | f1: X, | ^ doesn't have a size known at compile-time | @@ -21,7 +21,7 @@ error[E0277]: the size for values of type `X` cannot be known at compilation tim --> $DIR/unsized5.rs:10:8 | LL | struct S2 { - | - this type parameter needs to be `Sized` + | - this type parameter needs to be `std::marker::Sized` LL | f: isize, LL | g: X, | ^ doesn't have a size known at compile-time @@ -77,7 +77,7 @@ error[E0277]: the size for values of type `X` cannot be known at compilation tim --> $DIR/unsized5.rs:25:8 | LL | enum E { - | - this type parameter needs to be `Sized` + | - this type parameter needs to be `std::marker::Sized` LL | V1(X, isize), | ^ doesn't have a size known at compile-time | @@ -96,7 +96,7 @@ error[E0277]: the size for values of type `X` cannot be known at compilation tim --> $DIR/unsized5.rs:29:12 | LL | enum F { - | - this type parameter needs to be `Sized` + | - this type parameter needs to be `std::marker::Sized` LL | V2{f1: X, f: isize}, | ^ doesn't have a size known at compile-time | diff --git a/src/test/ui/unsized6.stderr b/src/test/ui/unsized6.stderr index 71dac236fa316..f9f7877d5426a 100644 --- a/src/test/ui/unsized6.stderr +++ b/src/test/ui/unsized6.stderr @@ -2,7 +2,7 @@ error[E0277]: the size for values of type `Y` cannot be known at compilation tim --> $DIR/unsized6.rs:9:9 | LL | fn f1(x: &X) { - | - this type parameter needs to be `Sized` + | - this type parameter needs to be `std::marker::Sized` ... LL | let y: Y; | ^ doesn't have a size known at compile-time @@ -14,7 +14,7 @@ error[E0277]: the size for values of type `X` cannot be known at compilation tim --> $DIR/unsized6.rs:7:12 | LL | fn f1(x: &X) { - | - this type parameter needs to be `Sized` + | - this type parameter needs to be `std::marker::Sized` LL | let _: W; // <-- this is OK, no bindings created, no initializer. LL | let _: (isize, (X, isize)); | ^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time @@ -25,7 +25,7 @@ error[E0277]: the size for values of type `Z` cannot be known at compilation tim --> $DIR/unsized6.rs:11:12 | LL | fn f1(x: &X) { - | - this type parameter needs to be `Sized` + | - this type parameter needs to be `std::marker::Sized` ... LL | let y: (isize, (Z, usize)); | ^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time @@ -36,7 +36,7 @@ error[E0277]: the size for values of type `X` cannot be known at compilation tim --> $DIR/unsized6.rs:15:9 | LL | fn f2(x: &X) { - | - this type parameter needs to be `Sized` + | - this type parameter needs to be `std::marker::Sized` LL | let y: X; | ^ doesn't have a size known at compile-time | @@ -47,7 +47,7 @@ error[E0277]: the size for values of type `Y` cannot be known at compilation tim --> $DIR/unsized6.rs:17:12 | LL | fn f2(x: &X) { - | - this type parameter needs to be `Sized` + | - this type parameter needs to be `std::marker::Sized` ... LL | let y: (isize, (Y, isize)); | ^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time @@ -58,7 +58,7 @@ error[E0277]: the size for values of type `X` cannot be known at compilation tim --> $DIR/unsized6.rs:22:9 | LL | fn f3(x1: Box, x2: Box, x3: Box) { - | - this type parameter needs to be `Sized` + | - this type parameter needs to be `std::marker::Sized` LL | let y: X = *x1; | ^ doesn't have a size known at compile-time | @@ -69,7 +69,7 @@ error[E0277]: the size for values of type `X` cannot be known at compilation tim --> $DIR/unsized6.rs:24:9 | LL | fn f3(x1: Box, x2: Box, x3: Box) { - | - this type parameter needs to be `Sized` + | - this type parameter needs to be `std::marker::Sized` ... LL | let y = *x2; | ^ doesn't have a size known at compile-time @@ -81,7 +81,7 @@ error[E0277]: the size for values of type `X` cannot be known at compilation tim --> $DIR/unsized6.rs:26:10 | LL | fn f3(x1: Box, x2: Box, x3: Box) { - | - this type parameter needs to be `Sized` + | - this type parameter needs to be `std::marker::Sized` ... LL | let (y, z) = (*x3, 4); | ^ doesn't have a size known at compile-time @@ -93,7 +93,7 @@ error[E0277]: the size for values of type `X` cannot be known at compilation tim --> $DIR/unsized6.rs:30:9 | LL | fn f4(x1: Box, x2: Box, x3: Box) { - | - this type parameter needs to be `Sized` + | - this type parameter needs to be `std::marker::Sized` LL | let y: X = *x1; | ^ doesn't have a size known at compile-time | @@ -104,7 +104,7 @@ error[E0277]: the size for values of type `X` cannot be known at compilation tim --> $DIR/unsized6.rs:32:9 | LL | fn f4(x1: Box, x2: Box, x3: Box) { - | - this type parameter needs to be `Sized` + | - this type parameter needs to be `std::marker::Sized` ... LL | let y = *x2; | ^ doesn't have a size known at compile-time @@ -116,7 +116,7 @@ error[E0277]: the size for values of type `X` cannot be known at compilation tim --> $DIR/unsized6.rs:34:10 | LL | fn f4(x1: Box, x2: Box, x3: Box) { - | - this type parameter needs to be `Sized` + | - this type parameter needs to be `std::marker::Sized` ... LL | let (y, z) = (*x3, 4); | ^ doesn't have a size known at compile-time @@ -130,7 +130,7 @@ error[E0277]: the size for values of type `X` cannot be known at compilation tim LL | fn g1(x: X) {} | - ^ doesn't have a size known at compile-time | | - | this type parameter needs to be `Sized` + | this type parameter needs to be `std::marker::Sized` | = help: unsized fn params are gated as an unstable feature help: function arguments must have a statically known size, borrowed types always have a known size @@ -144,7 +144,7 @@ error[E0277]: the size for values of type `X` cannot be known at compilation tim LL | fn g2(x: X) {} | - ^ doesn't have a size known at compile-time | | - | this type parameter needs to be `Sized` + | this type parameter needs to be `std::marker::Sized` | = help: unsized fn params are gated as an unstable feature help: function arguments must have a statically known size, borrowed types always have a known size diff --git a/src/test/ui/unsized7.stderr b/src/test/ui/unsized7.stderr index 5f9a2604ed5b0..7dbddd4ed2443 100644 --- a/src/test/ui/unsized7.stderr +++ b/src/test/ui/unsized7.stderr @@ -7,7 +7,7 @@ LL | trait T1 { LL | impl T1 for S3 { | - ^^^^^ doesn't have a size known at compile-time | | - | this type parameter needs to be `Sized` + | this type parameter needs to be `std::marker::Sized` | help: consider relaxing the implicit `Sized` restriction | diff --git a/src/test/ui/wf/wf-enum-bound.stderr b/src/test/ui/wf/wf-enum-bound.stderr index e7bc858225139..7819110dd98b5 100644 --- a/src/test/ui/wf/wf-enum-bound.stderr +++ b/src/test/ui/wf/wf-enum-bound.stderr @@ -9,8 +9,8 @@ LL | where T: ExtraCopy | help: consider further restricting type parameter `U` | -LL | where T: ExtraCopy, U: Copy - | ^^^^^^^^^ +LL | where T: ExtraCopy, U: std::marker::Copy + | ^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/wf/wf-enum-fields-struct-variant.stderr b/src/test/ui/wf/wf-enum-fields-struct-variant.stderr index c97ce53885b72..4bfb2413fe99f 100644 --- a/src/test/ui/wf/wf-enum-fields-struct-variant.stderr +++ b/src/test/ui/wf/wf-enum-fields-struct-variant.stderr @@ -9,8 +9,8 @@ LL | f: IsCopy | help: consider restricting type parameter `A` | -LL | enum AnotherEnum { - | ^^^^^^ +LL | enum AnotherEnum { + | ^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/wf/wf-enum-fields.stderr b/src/test/ui/wf/wf-enum-fields.stderr index 85da1bf5839a3..c8a75afbab7cb 100644 --- a/src/test/ui/wf/wf-enum-fields.stderr +++ b/src/test/ui/wf/wf-enum-fields.stderr @@ -9,8 +9,8 @@ LL | SomeVariant(IsCopy) | help: consider restricting type parameter `A` | -LL | enum SomeEnum { - | ^^^^^^ +LL | enum SomeEnum { + | ^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/wf/wf-fn-where-clause.stderr b/src/test/ui/wf/wf-fn-where-clause.stderr index 22598e58bd744..e463e3db887a5 100644 --- a/src/test/ui/wf/wf-fn-where-clause.stderr +++ b/src/test/ui/wf/wf-fn-where-clause.stderr @@ -9,8 +9,8 @@ LL | fn foo() where T: ExtraCopy | help: consider further restricting type parameter `U` | -LL | fn foo() where T: ExtraCopy, U: Copy - | ^^^^^^^^^ +LL | fn foo() where T: ExtraCopy, U: std::marker::Copy + | ^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the size for values of type `(dyn Copy + 'static)` cannot be known at compilation time --> $DIR/wf-fn-where-clause.rs:12:16 diff --git a/src/test/ui/wf/wf-in-fn-arg.stderr b/src/test/ui/wf/wf-in-fn-arg.stderr index d6010d1d79e93..9687658feba43 100644 --- a/src/test/ui/wf/wf-in-fn-arg.stderr +++ b/src/test/ui/wf/wf-in-fn-arg.stderr @@ -9,8 +9,8 @@ LL | fn bar(_: &MustBeCopy) | help: consider restricting type parameter `T` | -LL | fn bar(_: &MustBeCopy) - | ^^^^^^ +LL | fn bar(_: &MustBeCopy) + | ^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/wf/wf-in-fn-ret.stderr b/src/test/ui/wf/wf-in-fn-ret.stderr index c22252657f12e..f9a962578e650 100644 --- a/src/test/ui/wf/wf-in-fn-ret.stderr +++ b/src/test/ui/wf/wf-in-fn-ret.stderr @@ -9,8 +9,8 @@ LL | fn bar() -> MustBeCopy | help: consider restricting type parameter `T` | -LL | fn bar() -> MustBeCopy - | ^^^^^^ +LL | fn bar() -> MustBeCopy + | ^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/wf/wf-in-fn-type-arg.stderr b/src/test/ui/wf/wf-in-fn-type-arg.stderr index 6d249f5f918d3..33300b3964258 100644 --- a/src/test/ui/wf/wf-in-fn-type-arg.stderr +++ b/src/test/ui/wf/wf-in-fn-type-arg.stderr @@ -9,8 +9,8 @@ LL | x: fn(MustBeCopy) | help: consider restricting type parameter `T` | -LL | struct Bar { - | ^^^^^^ +LL | struct Bar { + | ^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/wf/wf-in-fn-type-ret.stderr b/src/test/ui/wf/wf-in-fn-type-ret.stderr index 30ff365b116ec..1ffc47e6d826c 100644 --- a/src/test/ui/wf/wf-in-fn-type-ret.stderr +++ b/src/test/ui/wf/wf-in-fn-type-ret.stderr @@ -9,8 +9,8 @@ LL | x: fn() -> MustBeCopy | help: consider restricting type parameter `T` | -LL | struct Foo { - | ^^^^^^ +LL | struct Foo { + | ^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/wf/wf-in-fn-where-clause.stderr b/src/test/ui/wf/wf-in-fn-where-clause.stderr index 64e9694c0e16b..7cb9af11d799b 100644 --- a/src/test/ui/wf/wf-in-fn-where-clause.stderr +++ b/src/test/ui/wf/wf-in-fn-where-clause.stderr @@ -9,8 +9,8 @@ LL | where T: MustBeCopy | help: consider further restricting type parameter `U` | -LL | where T: MustBeCopy, U: Copy - | ^^^^^^^^^ +LL | where T: MustBeCopy, U: std::marker::Copy + | ^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/wf/wf-in-obj-type-trait.stderr b/src/test/ui/wf/wf-in-obj-type-trait.stderr index 55ea08ccbe7ff..8606eabf59c14 100644 --- a/src/test/ui/wf/wf-in-obj-type-trait.stderr +++ b/src/test/ui/wf/wf-in-obj-type-trait.stderr @@ -9,8 +9,8 @@ LL | x: dyn Object> | help: consider restricting type parameter `T` | -LL | struct Bar { - | ^^^^^^ +LL | struct Bar { + | ^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/wf/wf-inherent-impl-method-where-clause.stderr b/src/test/ui/wf/wf-inherent-impl-method-where-clause.stderr index 7bbdd4bcf2428..8e0ce557e6b43 100644 --- a/src/test/ui/wf/wf-inherent-impl-method-where-clause.stderr +++ b/src/test/ui/wf/wf-inherent-impl-method-where-clause.stderr @@ -9,8 +9,8 @@ LL | fn foo(self) where T: ExtraCopy | help: consider restricting type parameter `U` | -LL | impl Foo { - | ^^^^^^ +LL | impl Foo { + | ^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/wf/wf-inherent-impl-where-clause.stderr b/src/test/ui/wf/wf-inherent-impl-where-clause.stderr index 2a44e1cdc7162..bf8077ba88f6b 100644 --- a/src/test/ui/wf/wf-inherent-impl-where-clause.stderr +++ b/src/test/ui/wf/wf-inherent-impl-where-clause.stderr @@ -9,8 +9,8 @@ LL | impl Foo where T: ExtraCopy | help: consider further restricting type parameter `U` | -LL | impl Foo where T: ExtraCopy, U: Copy - | ^^^^^^^^^ +LL | impl Foo where T: ExtraCopy, U: std::marker::Copy + | ^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/wf/wf-struct-bound.stderr b/src/test/ui/wf/wf-struct-bound.stderr index 948693ac6f87d..e85f3591438a9 100644 --- a/src/test/ui/wf/wf-struct-bound.stderr +++ b/src/test/ui/wf/wf-struct-bound.stderr @@ -9,8 +9,8 @@ LL | where T: ExtraCopy | help: consider further restricting type parameter `U` | -LL | where T: ExtraCopy, U: Copy - | ^^^^^^^^^ +LL | where T: ExtraCopy, U: std::marker::Copy + | ^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/wf/wf-struct-field.stderr b/src/test/ui/wf/wf-struct-field.stderr index 04e62a7fcb776..62ef6bb60c7a2 100644 --- a/src/test/ui/wf/wf-struct-field.stderr +++ b/src/test/ui/wf/wf-struct-field.stderr @@ -9,8 +9,8 @@ LL | data: IsCopy | help: consider restricting type parameter `A` | -LL | struct SomeStruct { - | ^^^^^^ +LL | struct SomeStruct { + | ^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/wf/wf-trait-associated-type-bound.stderr b/src/test/ui/wf/wf-trait-associated-type-bound.stderr index 166e3626f094e..51adfdb6bd2a9 100644 --- a/src/test/ui/wf/wf-trait-associated-type-bound.stderr +++ b/src/test/ui/wf/wf-trait-associated-type-bound.stderr @@ -9,8 +9,8 @@ LL | type Type1: ExtraCopy; | help: consider restricting type parameter `T` | -LL | trait SomeTrait { - | ^^^^^^ +LL | trait SomeTrait { + | ^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/wf/wf-trait-bound.stderr b/src/test/ui/wf/wf-trait-bound.stderr index abb97adcfd4cd..c9e818f8e7dc8 100644 --- a/src/test/ui/wf/wf-trait-bound.stderr +++ b/src/test/ui/wf/wf-trait-bound.stderr @@ -9,8 +9,8 @@ LL | where T: ExtraCopy | help: consider further restricting type parameter `U` | -LL | where T: ExtraCopy, U: Copy - | ^^^^^^^^^ +LL | where T: ExtraCopy, U: std::marker::Copy + | ^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/wf/wf-trait-superbound.stderr b/src/test/ui/wf/wf-trait-superbound.stderr index db337a7c6d0fd..6926983527178 100644 --- a/src/test/ui/wf/wf-trait-superbound.stderr +++ b/src/test/ui/wf/wf-trait-superbound.stderr @@ -9,8 +9,8 @@ LL | trait SomeTrait: ExtraCopy { | help: consider restricting type parameter `T` | -LL | trait SomeTrait: ExtraCopy { - | ^^^^^^ +LL | trait SomeTrait: ExtraCopy { + | ^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/where-clauses/where-clause-constraints-are-local-for-inherent-impl.stderr b/src/test/ui/where-clauses/where-clause-constraints-are-local-for-inherent-impl.stderr index 916c6dc6d53a4..356ba347cc36a 100644 --- a/src/test/ui/where-clauses/where-clause-constraints-are-local-for-inherent-impl.stderr +++ b/src/test/ui/where-clauses/where-clause-constraints-are-local-for-inherent-impl.stderr @@ -9,8 +9,8 @@ LL | require_copy(self.x); | help: consider restricting type parameter `T` | -LL | impl Foo { - | ^^^^^^ +LL | impl Foo { + | ^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/where-clauses/where-clause-constraints-are-local-for-trait-impl.stderr b/src/test/ui/where-clauses/where-clause-constraints-are-local-for-trait-impl.stderr index 8814018964aa6..d84242cfe12b8 100644 --- a/src/test/ui/where-clauses/where-clause-constraints-are-local-for-trait-impl.stderr +++ b/src/test/ui/where-clauses/where-clause-constraints-are-local-for-trait-impl.stderr @@ -9,8 +9,8 @@ LL | require_copy(self.x); | help: consider restricting type parameter `T` | -LL | impl Foo for Bar { - | ^^^^^^ +LL | impl Foo for Bar { + | ^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error From e78fac56015ca2d926237704b02e555604a99e9d Mon Sep 17 00:00:00 2001 From: Aman Arora Date: Wed, 31 Mar 2021 04:40:31 -0400 Subject: [PATCH 10/21] Handle the case of partially captured drop type --- compiler/rustc_typeck/src/check/upvar.rs | 42 +++++++++++++----------- 1 file changed, 23 insertions(+), 19 deletions(-) diff --git a/compiler/rustc_typeck/src/check/upvar.rs b/compiler/rustc_typeck/src/check/upvar.rs index fd4186e802571..124076a889b6f 100644 --- a/compiler/rustc_typeck/src/check/upvar.rs +++ b/compiler/rustc_typeck/src/check/upvar.rs @@ -639,7 +639,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { /// `w[c]`. /// Notation: /// - Ty(place): Type of place - /// - `(a, b)`: Represents the function parameters `base_path_ty` and `captured_projs` + /// - `(a, b)`: Represents the function parameters `base_path_ty` and `captured_by_move_projs` /// respectively. /// ``` /// (Ty(w), [ &[p, x], &[c] ]) @@ -700,7 +700,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { closure_def_id: DefId, closure_span: Span, base_path_ty: Ty<'tcx>, - captured_projs: Vec<&[Projection<'tcx>]>, + captured_by_move_projs: Vec<&[Projection<'tcx>]>, ) -> bool { let needs_drop = |ty: Ty<'tcx>| { ty.needs_drop(self.tcx, self.tcx.param_env(closure_def_id.expect_local())) @@ -725,9 +725,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { // // eg. If `a.b` is captured and we are processing `a.b`, then we can't have the closure also // capture `a.b.c`, because that voilates min capture. - let is_completely_captured = captured_projs.iter().any(|projs| projs.is_empty()); + let is_completely_captured = captured_by_move_projs.iter().any(|projs| projs.is_empty()); - assert!(!is_completely_captured || (captured_projs.len() == 1)); + assert!(!is_completely_captured || (captured_by_move_projs.len() == 1)); if is_completely_captured { // The place is captured entirely, so doesn't matter if needs dtor, it will be drop @@ -735,23 +735,27 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { return false; } + if captured_by_move_projs.is_empty() { + return needs_drop(base_path_ty); + } + if is_drop_defined_for_ty { // If drop is implemented for this type then we need it to be fully captured, - // which we know it is not because of the previous check. Therefore we need to - // do migrate. - return true; - } + // and we know it is not completely captured because of the previous checks. - if captured_projs.is_empty() { - return needs_drop(base_path_ty); + // Note that this is a bug in the user code that will be reported by the + // borrow checker, since we can't move out of drop types. + + // The bug exists in the user's code pre-migration, and we don't migrate here. + return false; } match base_path_ty.kind() { // Observations: - // - `captured_projs` is not empty. Therefore we can call - // `captured_projs.first().unwrap()` safely. - // - All entries in `captured_projs` have atleast one projection. - // Therefore we can call `captured_projs.first().unwrap().first().unwrap()` safely. + // - `captured_by_move_projs` is not empty. Therefore we can call + // `captured_by_move_projs.first().unwrap()` safely. + // - All entries in `captured_by_move_projs` have atleast one projection. + // Therefore we can call `captured_by_move_projs.first().unwrap().first().unwrap()` safely. // We don't capture derefs in case of move captures, which would have be applied to // access any further paths. @@ -761,19 +765,19 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { ty::Adt(def, substs) => { // Multi-varaint enums are captured in entirety, - // which would've been handled in the case of single empty slice in `captured_projs`. + // which would've been handled in the case of single empty slice in `captured_by_move_projs`. assert_eq!(def.variants.len(), 1); // Only Field projections can be applied to a non-box Adt. assert!( - captured_projs.iter().all(|projs| matches!( + captured_by_move_projs.iter().all(|projs| matches!( projs.first().unwrap().kind, ProjectionKind::Field(..) )) ); def.variants.get(VariantIdx::new(0)).unwrap().fields.iter().enumerate().any( |(i, field)| { - let paths_using_field = captured_projs + let paths_using_field = captured_by_move_projs .iter() .filter_map(|projs| { if let ProjectionKind::Field(field_idx, _) = @@ -800,14 +804,14 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { ty::Tuple(..) => { // Only Field projections can be applied to a tuple. assert!( - captured_projs.iter().all(|projs| matches!( + captured_by_move_projs.iter().all(|projs| matches!( projs.first().unwrap().kind, ProjectionKind::Field(..) )) ); base_path_ty.tuple_fields().enumerate().any(|(i, element_ty)| { - let paths_using_field = captured_projs + let paths_using_field = captured_by_move_projs .iter() .filter_map(|projs| { if let ProjectionKind::Field(field_idx, _) = projs.first().unwrap().kind From d4f3f91c48dd244357a439a234a44d5f0e99f014 Mon Sep 17 00:00:00 2001 From: Joshua Nelson Date: Wed, 31 Mar 2021 11:13:51 -0400 Subject: [PATCH 11/21] Enforce that Toolchain files are static and Crate files are dynamic This also changes custom themes from Toolchain to Crate files. --- src/librustdoc/html/render/write_shared.rs | 63 +++++++++++--------- src/test/run-make/emit-shared-files/Makefile | 6 +- 2 files changed, 40 insertions(+), 29 deletions(-) diff --git a/src/librustdoc/html/render/write_shared.rs b/src/librustdoc/html/render/write_shared.rs index af346bb82256e..b19b29d2fa0d8 100644 --- a/src/librustdoc/html/render/write_shared.rs +++ b/src/librustdoc/html/render/write_shared.rs @@ -44,11 +44,11 @@ enum SharedResource<'a> { /// This file will never change, no matter what toolchain is used to build it. /// /// It does not have a resource suffix. - Unversioned { name: &'a str }, + Unversioned { name: &'static str }, /// This file may change depending on the toolchain. /// /// It has a resource suffix. - ToolchainSpecific { basename: &'a str }, + ToolchainSpecific { basename: &'static str }, /// This file may change for any crate within a build. /// /// This differs from normal crate-specific files because it has a resource suffix. @@ -157,11 +157,16 @@ pub(super) fn write_shared( &options.emit, ) }; - let write_toolchain = |p: &_, c: &_| { + // Toolchain resources should never be dynamic. + let write_toolchain = |p: &'static _, c: &'static _| { cx.write_shared(SharedResource::ToolchainSpecific { basename: p }, c, &options.emit) }; - let write_crate = - |p, c: &_| cx.write_shared(SharedResource::CrateSpecific { basename: p }, c, &options.emit); + + // Crate resources should always be dynamic. + let write_crate = |p: &_, make_content: &dyn Fn() -> Result, Error>| { + let content = make_content()?; + cx.write_shared(SharedResource::CrateSpecific { basename: p }, content, &options.emit) + }; // Add all the static files. These may already exist, but we just // overwrite them anyway to make sure that they're fresh and up-to-date. @@ -185,10 +190,8 @@ pub(super) fn write_shared( "ayu" => write_minify("ayu.css", static_files::themes::AYU)?, _ => { // Handle added third-party themes - let content = try_err!(fs::read(&entry.path), &entry.path); - // This is not exactly right: if compiled a second time with the same toolchain but different CLI args, the file could be different. - // But docs.rs doesn't use this, so hopefully the issue doesn't come up. - write_toolchain(&format!("{}.{}", theme, extension), content.as_slice())?; + let filename = format!("{}.{}", theme, extension); + write_crate(&filename, &|| Ok(try_err!(fs::read(&entry.path), &entry.path)))?; } }; @@ -367,19 +370,22 @@ pub(super) fn write_shared( } let dst = cx.dst.join(&format!("source-files{}.js", cx.shared.resource_suffix)); - let (mut all_sources, _krates) = - try_err!(collect(&dst, &krate.name.as_str(), "sourcesIndex"), &dst); - all_sources.push(format!( - "sourcesIndex[\"{}\"] = {};", - &krate.name, - hierarchy.to_json_string() - )); - all_sources.sort(); - let v = format!( - "var N = null;var sourcesIndex = {{}};\n{}\ncreateSourceSidebar();\n", - all_sources.join("\n") - ); - write_crate("source-files.js", &v)?; + let make_sources = || { + let (mut all_sources, _krates) = + try_err!(collect(&dst, &krate.name.as_str(), "sourcesIndex"), &dst); + all_sources.push(format!( + "sourcesIndex[\"{}\"] = {};", + &krate.name, + hierarchy.to_json_string() + )); + all_sources.sort(); + Ok(format!( + "var N = null;var sourcesIndex = {{}};\n{}\ncreateSourceSidebar();\n", + all_sources.join("\n") + ) + .into_bytes()) + }; + write_crate("source-files.js", &make_sources)?; } // Update the search index and crate list. @@ -392,16 +398,17 @@ pub(super) fn write_shared( // Sort the indexes by crate so the file will be generated identically even // with rustdoc running in parallel. all_indexes.sort(); - { + write_crate("search-index.js", &|| { let mut v = String::from("var searchIndex = JSON.parse('{\\\n"); v.push_str(&all_indexes.join(",\\\n")); v.push_str("\\\n}');\ninitSearch(searchIndex);"); - write_crate("search-index.js", &v)?; - } + Ok(v.into_bytes()) + })?; - let crate_list = - format!("window.ALL_CRATES = [{}];", krates.iter().map(|k| format!("\"{}\"", k)).join(",")); - write_crate("crates.js", &crate_list)?; + write_crate("crates.js", &|| { + let krates = krates.iter().map(|k| format!("\"{}\"", k)).join(","); + Ok(format!("window.ALL_CRATES = [{}];", krates).into_bytes()) + })?; if options.enable_index_page { if let Some(index_page) = options.index_page.clone() { diff --git a/src/test/run-make/emit-shared-files/Makefile b/src/test/run-make/emit-shared-files/Makefile index 06358f6eb2c98..952c3aaf5602d 100644 --- a/src/test/run-make/emit-shared-files/Makefile +++ b/src/test/run-make/emit-shared-files/Makefile @@ -7,17 +7,20 @@ ALL_SHARED = $(TMPDIR)/all-shared all: crate-only toolchain-only all-shared crate-only: - $(RUSTDOC) -Z unstable-options --emit=crate-specific --output $(CRATE_ONLY) --resource-suffix=-xxx x.rs + $(RUSTDOC) -Z unstable-options --emit=crate-specific --output $(CRATE_ONLY) --resource-suffix=-xxx --theme y.css x.rs [ -e $(CRATE_ONLY)/search-index-xxx.js ] [ -e $(CRATE_ONLY)/settings.html ] [ -e $(CRATE_ONLY)/x/all.html ] [ -e $(CRATE_ONLY)/x/index.html ] + # FIXME: this probably shouldn't have a suffix + [ -e $(CRATE_ONLY)/y-xxx.css ] ! [ -e $(CRATE_ONLY)/storage-xxx.js ] ! [ -e $(CRATE_ONLY)/SourceSerifPro-It.ttf.woff ] toolchain-only: $(RUSTDOC) -Z unstable-options --emit=toolchain-shared-resources --output $(TOOLCHAIN_ONLY) --resource-suffix=-xxx x.rs [ -e $(TOOLCHAIN_ONLY)/storage-xxx.js ] + ! [ -e $(TOOLCHAIN_ONLY)/y-xxx.css ] ! [ -e $(TOOLCHAIN_ONLY)/SourceSerifPro-It.ttf.woff ] ! [ -e $(TOOLCHAIN_ONLY)/search-index-xxx.js ] ! [ -e $(TOOLCHAIN_ONLY)/x/index.html ] @@ -26,6 +29,7 @@ all-shared: $(RUSTDOC) -Z unstable-options --emit=toolchain-shared-resources,unversioned-shared-resources --output $(ALL_SHARED) --resource-suffix=-xxx x.rs [ -e $(ALL_SHARED)/storage-xxx.js ] [ -e $(ALL_SHARED)/SourceSerifPro-It.ttf.woff ] + ! [ -e $(ALL_SHARED)/y-xxx.css ] ! [ -e $(ALL_SHARED)/search-index-xxx.js ] ! [ -e $(ALL_SHARED)/settings.html ] ! [ -e $(ALL_SHARED)/x ] From 1086d9b7b58fea8f15b1f10bc2e527b6fcb0e382 Mon Sep 17 00:00:00 2001 From: Joshua Nelson Date: Wed, 31 Mar 2021 11:35:57 -0400 Subject: [PATCH 12/21] Rename CrateSpecific -> InvocationSpecific --- src/librustdoc/config.rs | 6 +++--- src/librustdoc/html/render/write_shared.rs | 14 ++++++------- src/librustdoc/lib.rs | 2 +- src/test/run-make/emit-shared-files/Makefile | 22 ++++++++++---------- 4 files changed, 22 insertions(+), 22 deletions(-) diff --git a/src/librustdoc/config.rs b/src/librustdoc/config.rs index a7a2db6210005..246e0ebbb2ba0 100644 --- a/src/librustdoc/config.rs +++ b/src/librustdoc/config.rs @@ -274,7 +274,7 @@ crate struct RenderOptions { crate enum EmitType { Unversioned, Toolchain, - CrateSpecific, + InvocationSpecific, } impl FromStr for EmitType { @@ -285,7 +285,7 @@ impl FromStr for EmitType { match s { "unversioned-shared-resources" => Ok(Unversioned), "toolchain-shared-resources" => Ok(Toolchain), - "crate-specific" => Ok(CrateSpecific), + "invocation-specific" => Ok(InvocationSpecific), _ => Err(()), } } @@ -293,7 +293,7 @@ impl FromStr for EmitType { impl RenderOptions { crate fn should_emit_crate(&self) -> bool { - self.emit.is_empty() || self.emit.contains(&EmitType::CrateSpecific) + self.emit.is_empty() || self.emit.contains(&EmitType::InvocationSpecific) } } diff --git a/src/librustdoc/html/render/write_shared.rs b/src/librustdoc/html/render/write_shared.rs index b19b29d2fa0d8..34994097812c2 100644 --- a/src/librustdoc/html/render/write_shared.rs +++ b/src/librustdoc/html/render/write_shared.rs @@ -49,10 +49,10 @@ enum SharedResource<'a> { /// /// It has a resource suffix. ToolchainSpecific { basename: &'static str }, - /// This file may change for any crate within a build. + /// This file may change for any crate within a build, or based on the CLI arguments. /// - /// This differs from normal crate-specific files because it has a resource suffix. - CrateSpecific { basename: &'a str }, + /// This differs from normal invocation-specific files because it has a resource suffix. + InvocationSpecific { basename: &'a str }, } impl SharedResource<'_> { @@ -61,7 +61,7 @@ impl SharedResource<'_> { match self { Unversioned { name } | ToolchainSpecific { basename: name } - | CrateSpecific { basename: name } => Path::new(name).extension(), + | InvocationSpecific { basename: name } => Path::new(name).extension(), } } @@ -69,7 +69,7 @@ impl SharedResource<'_> { match self { SharedResource::Unversioned { name } => cx.dst.join(name), SharedResource::ToolchainSpecific { basename } => cx.suffix_path(basename), - SharedResource::CrateSpecific { basename } => cx.suffix_path(basename), + SharedResource::InvocationSpecific { basename } => cx.suffix_path(basename), } } @@ -80,7 +80,7 @@ impl SharedResource<'_> { let kind = match self { SharedResource::Unversioned { .. } => EmitType::Unversioned, SharedResource::ToolchainSpecific { .. } => EmitType::Toolchain, - SharedResource::CrateSpecific { .. } => EmitType::CrateSpecific, + SharedResource::InvocationSpecific { .. } => EmitType::InvocationSpecific, }; emit.contains(&kind) } @@ -165,7 +165,7 @@ pub(super) fn write_shared( // Crate resources should always be dynamic. let write_crate = |p: &_, make_content: &dyn Fn() -> Result, Error>| { let content = make_content()?; - cx.write_shared(SharedResource::CrateSpecific { basename: p }, content, &options.emit) + cx.write_shared(SharedResource::InvocationSpecific { basename: p }, content, &options.emit) }; // Add all the static files. These may already exist, but we just diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs index ebdd56611db71..54a6fc625a615 100644 --- a/src/librustdoc/lib.rs +++ b/src/librustdoc/lib.rs @@ -532,7 +532,7 @@ fn opts() -> Vec { "", "emit", "Comma separated list of types of output for rustdoc to emit", - "[unversioned-shared-resources,toolchain-shared-resources,crate-specific]", + "[unversioned-shared-resources,toolchain-shared-resources,invocation-specific]", ) }), ] diff --git a/src/test/run-make/emit-shared-files/Makefile b/src/test/run-make/emit-shared-files/Makefile index 952c3aaf5602d..66a36dae9d370 100644 --- a/src/test/run-make/emit-shared-files/Makefile +++ b/src/test/run-make/emit-shared-files/Makefile @@ -1,21 +1,21 @@ -include ../../run-make-fulldeps/tools.mk -CRATE_ONLY = $(TMPDIR)/crate-only +INVOCATION_ONLY = $(TMPDIR)/invocation-only TOOLCHAIN_ONLY = $(TMPDIR)/toolchain-only ALL_SHARED = $(TMPDIR)/all-shared -all: crate-only toolchain-only all-shared +all: invocation-only toolchain-only all-shared -crate-only: - $(RUSTDOC) -Z unstable-options --emit=crate-specific --output $(CRATE_ONLY) --resource-suffix=-xxx --theme y.css x.rs - [ -e $(CRATE_ONLY)/search-index-xxx.js ] - [ -e $(CRATE_ONLY)/settings.html ] - [ -e $(CRATE_ONLY)/x/all.html ] - [ -e $(CRATE_ONLY)/x/index.html ] +invocation-only: + $(RUSTDOC) -Z unstable-options --emit=invocation-specific --output $(INVOCATION_ONLY) --resource-suffix=-xxx --theme y.css x.rs + [ -e $(INVOCATION_ONLY)/search-index-xxx.js ] + [ -e $(INVOCATION_ONLY)/settings.html ] + [ -e $(INVOCATION_ONLY)/x/all.html ] + [ -e $(INVOCATION_ONLY)/x/index.html ] # FIXME: this probably shouldn't have a suffix - [ -e $(CRATE_ONLY)/y-xxx.css ] - ! [ -e $(CRATE_ONLY)/storage-xxx.js ] - ! [ -e $(CRATE_ONLY)/SourceSerifPro-It.ttf.woff ] + [ -e $(INVOCATION_ONLY)/y-xxx.css ] + ! [ -e $(INVOCATION_ONLY)/storage-xxx.js ] + ! [ -e $(INVOCATION_ONLY)/SourceSerifPro-It.ttf.woff ] toolchain-only: $(RUSTDOC) -Z unstable-options --emit=toolchain-shared-resources --output $(TOOLCHAIN_ONLY) --resource-suffix=-xxx x.rs From 413938d7a9df4efe800552fa03ce1a5866539cbc Mon Sep 17 00:00:00 2001 From: Joshua Nelson Date: Wed, 31 Mar 2021 17:23:32 -0400 Subject: [PATCH 13/21] Fix `--external-css` to be invocation-specific and note main.js should be invocation specific --- src/librustdoc/html/render/write_shared.rs | 11 ++++++++- src/test/run-make/emit-shared-files/Makefile | 24 ++++++++++++++------ src/test/run-make/emit-shared-files/y.css | 0 src/test/run-make/emit-shared-files/z.css | 0 4 files changed, 27 insertions(+), 8 deletions(-) create mode 100644 src/test/run-make/emit-shared-files/y.css create mode 100644 src/test/run-make/emit-shared-files/z.css diff --git a/src/librustdoc/html/render/write_shared.rs b/src/librustdoc/html/render/write_shared.rs index 34994097812c2..b2f2283c177df 100644 --- a/src/librustdoc/html/render/write_shared.rs +++ b/src/librustdoc/html/render/write_shared.rs @@ -213,6 +213,9 @@ pub(super) fn write_shared( let mut themes: Vec<&String> = themes.iter().collect(); themes.sort(); + // FIXME: this should probably not be a toolchain file since it depends on `--theme`. + // But it seems a shame to copy it over and over when it's almost always the same. + // Maybe we can change the representation to move this out of main.js? write_minify( "main.js", &static_files::MAIN_JS.replace( @@ -238,7 +241,13 @@ pub(super) fn write_shared( if let Some(ref css) = cx.shared.layout.css_file_extension { let buffer = try_err!(fs::read_to_string(css), css); - write_minify("theme.css", &buffer)?; + // This varies based on the invocation, so it can't go through the write_minify wrapper. + cx.write_minify( + SharedResource::InvocationSpecific { basename: "theme.css" }, + &buffer, + options.enable_minification, + &options.emit, + )?; } write_minify("normalize.css", static_files::NORMALIZE_CSS)?; for (name, contents) in &*FILES_UNVERSIONED { diff --git a/src/test/run-make/emit-shared-files/Makefile b/src/test/run-make/emit-shared-files/Makefile index 66a36dae9d370..5c4825ae66c87 100644 --- a/src/test/run-make/emit-shared-files/Makefile +++ b/src/test/run-make/emit-shared-files/Makefile @@ -7,30 +7,40 @@ ALL_SHARED = $(TMPDIR)/all-shared all: invocation-only toolchain-only all-shared invocation-only: - $(RUSTDOC) -Z unstable-options --emit=invocation-specific --output $(INVOCATION_ONLY) --resource-suffix=-xxx --theme y.css x.rs + $(RUSTDOC) -Z unstable-options --emit=invocation-specific --output $(INVOCATION_ONLY) --resource-suffix=-xxx --theme y.css --extend-css z.css x.rs [ -e $(INVOCATION_ONLY)/search-index-xxx.js ] [ -e $(INVOCATION_ONLY)/settings.html ] [ -e $(INVOCATION_ONLY)/x/all.html ] [ -e $(INVOCATION_ONLY)/x/index.html ] - # FIXME: this probably shouldn't have a suffix - [ -e $(INVOCATION_ONLY)/y-xxx.css ] + [ -e $(INVOCATION_ONLY)/theme-xxx.css ] # generated from z.css ! [ -e $(INVOCATION_ONLY)/storage-xxx.js ] ! [ -e $(INVOCATION_ONLY)/SourceSerifPro-It.ttf.woff ] + # FIXME: this probably shouldn't have a suffix + [ -e $(INVOCATION_ONLY)/y-xxx.css ] + # FIXME: this is technically incorrect (see `write_shared`) + ! [ -e $(INVOCATION_ONLY)/main-xxx.js ] + toolchain-only: - $(RUSTDOC) -Z unstable-options --emit=toolchain-shared-resources --output $(TOOLCHAIN_ONLY) --resource-suffix=-xxx x.rs + $(RUSTDOC) -Z unstable-options --emit=toolchain-shared-resources --output $(TOOLCHAIN_ONLY) --resource-suffix=-xxx --extend-css z.css x.rs [ -e $(TOOLCHAIN_ONLY)/storage-xxx.js ] - ! [ -e $(TOOLCHAIN_ONLY)/y-xxx.css ] ! [ -e $(TOOLCHAIN_ONLY)/SourceSerifPro-It.ttf.woff ] ! [ -e $(TOOLCHAIN_ONLY)/search-index-xxx.js ] ! [ -e $(TOOLCHAIN_ONLY)/x/index.html ] + ! [ -e $(TOOLCHAIN_ONLY)/theme.css ] + + [ -e $(TOOLCHAIN_ONLY)/main-xxx.js ] + ! [ -e $(TOOLCHAIN_ONLY)/y-xxx.css ] all-shared: - $(RUSTDOC) -Z unstable-options --emit=toolchain-shared-resources,unversioned-shared-resources --output $(ALL_SHARED) --resource-suffix=-xxx x.rs + $(RUSTDOC) -Z unstable-options --emit=toolchain-shared-resources,unversioned-shared-resources --output $(ALL_SHARED) --resource-suffix=-xxx --extend-css z.css x.rs [ -e $(ALL_SHARED)/storage-xxx.js ] [ -e $(ALL_SHARED)/SourceSerifPro-It.ttf.woff ] - ! [ -e $(ALL_SHARED)/y-xxx.css ] ! [ -e $(ALL_SHARED)/search-index-xxx.js ] ! [ -e $(ALL_SHARED)/settings.html ] ! [ -e $(ALL_SHARED)/x ] ! [ -e $(ALL_SHARED)/src ] + ! [ -e $(ALL_SHARED)/theme.css ] + + [ -e $(ALL_SHARED)/main-xxx.js ] + ! [ -e $(ALL_SHARED)/y-xxx.css ] diff --git a/src/test/run-make/emit-shared-files/y.css b/src/test/run-make/emit-shared-files/y.css new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/src/test/run-make/emit-shared-files/z.css b/src/test/run-make/emit-shared-files/z.css new file mode 100644 index 0000000000000..e69de29bb2d1d From 18af989c063efd759e03d6eebb7b18e2b03349a4 Mon Sep 17 00:00:00 2001 From: Aman Arora Date: Thu, 1 Apr 2021 16:49:05 -0400 Subject: [PATCH 14/21] Update lint message --- compiler/rustc_typeck/src/check/upvar.rs | 43 +++++++++++++++++------- 1 file changed, 31 insertions(+), 12 deletions(-) diff --git a/compiler/rustc_typeck/src/check/upvar.rs b/compiler/rustc_typeck/src/check/upvar.rs index 124076a889b6f..cd93cbbe965a1 100644 --- a/compiler/rustc_typeck/src/check/upvar.rs +++ b/compiler/rustc_typeck/src/check/upvar.rs @@ -479,7 +479,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { ); if !need_migrations.is_empty() { - let migrations_text = migration_suggestion_for_2229(self.tcx, &need_migrations); + let (migration_string, migrated_variables_concat) = + migration_suggestion_for_2229(self.tcx, &need_migrations); let local_def_id = closure_def_id.expect_local(); let closure_hir_id = self.tcx.hir().local_def_id_to_hir_id(local_def_id); @@ -495,15 +496,20 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { let (sugg, app) = match self.tcx.sess.source_map().span_to_snippet(closure_body_span) { Ok(s) => ( - format!("{{ {} {} }}", migrations_text, s), + format!("{{ {}; {} }}", migration_string, s), Applicability::MachineApplicable, ), - Err(_) => (migrations_text.clone(), Applicability::HasPlaceholders), + Err(_) => (migration_string.clone(), Applicability::HasPlaceholders), }; + let diagnostic_msg = format!( + "`{}` causes {} to be fully captured", + migration_string, migrated_variables_concat + ); + diagnostics_builder.span_suggestion( closure_body_span, - &format!("You can restore original behavior adding `{}` to the closure/generator", migrations_text), + &diagnostic_msg, sugg, app, ); @@ -1537,16 +1543,29 @@ fn should_do_migration_analysis(tcx: TyCtxt<'_>, closure_id: hir::HirId) -> bool !matches!(level, lint::Level::Allow) } -fn migration_suggestion_for_2229(tcx: TyCtxt<'_>, need_migrations: &Vec) -> String { - let need_migrations_strings = - need_migrations.iter().map(|v| format!("&{}", var_name(tcx, *v))).collect::>(); - let migrations_list_concat = need_migrations_strings.join(", "); +/// Return a two string tuple (s1, s2) +/// - s1: Line of code that is needed for the migration: eg: `let _ = (&x, ...)`. +/// - s2: Comma separated names of the variables being migrated. +fn migration_suggestion_for_2229( + tcx: TyCtxt<'_>, + need_migrations: &Vec, +) -> (String, String) { + let need_migrations_variables = + need_migrations.iter().map(|v| var_name(tcx, *v)).collect::>(); + + let migration_ref_concat = + need_migrations_variables.iter().map(|v| format!("&{}", v)).collect::>().join(", "); - if 1 == need_migrations.len() { - format!("let _ = {};", migrations_list_concat) + let migration_string = if 1 == need_migrations.len() { + format!("let _ = {}", migration_ref_concat) } else { - format!("let _ = ({});", migrations_list_concat) - } + format!("let _ = ({})", migration_ref_concat) + }; + + let migrated_variables_concat = + need_migrations_variables.iter().map(|v| format!("`{}`", v)).collect::>().join(", "); + + (migration_string, migrated_variables_concat) } /// Helper function to determine if we need to escalate CaptureKind from From da863487072bf94273862e7eb48bcc392c900234 Mon Sep 17 00:00:00 2001 From: Aman Arora Date: Thu, 1 Apr 2021 16:32:25 -0400 Subject: [PATCH 15/21] Update test cases --- .../migrations/insignificant_drop.fixed | 133 +++++++++++++++++ .../migrations/insignificant_drop.rs | 31 ++-- .../migrations/insignificant_drop.stderr | 88 +++++++++--- .../migrations/precise.fixed | 56 ++++++++ .../migrations/precise.rs | 34 +---- .../migrations/precise.stderr | 39 ++--- .../migrations/significant_drop.fixed | 136 ++++++++++++++++++ .../migrations/significant_drop.rs | 31 ++-- .../migrations/significant_drop.stderr | 82 +++++++++-- 9 files changed, 522 insertions(+), 108 deletions(-) create mode 100644 src/test/ui/closures/2229_closure_analysis/migrations/insignificant_drop.fixed create mode 100644 src/test/ui/closures/2229_closure_analysis/migrations/precise.fixed create mode 100644 src/test/ui/closures/2229_closure_analysis/migrations/significant_drop.fixed diff --git a/src/test/ui/closures/2229_closure_analysis/migrations/insignificant_drop.fixed b/src/test/ui/closures/2229_closure_analysis/migrations/insignificant_drop.fixed new file mode 100644 index 0000000000000..3e3460789152c --- /dev/null +++ b/src/test/ui/closures/2229_closure_analysis/migrations/insignificant_drop.fixed @@ -0,0 +1,133 @@ +// run-rustfix + +#![deny(disjoint_capture_drop_reorder)] +//~^ NOTE: the lint level is defined here + +// Test cases for types that implement a insignificant drop (stlib defined) + +// `t` needs Drop because one of its elements needs drop, +// therefore precise capture might affect drop ordering +fn test1_all_need_migration() { + let t = (String::new(), String::new()); + let t1 = (String::new(), String::new()); + let t2 = (String::new(), String::new()); + + let c = || { let _ = (&t, &t1, &t2); { + //~^ ERROR: drop order affected for closure because of `capture_disjoint_fields` + //~| HELP:` let _ = (&t, &t1, &t2)` causes `t`, `t1`, `t2` to be fully captured + + let _t = t.0; + let _t1 = t1.0; + let _t2 = t2.0; + } }; + + c(); +} + +// String implements drop and therefore should be migrated. +// But in this test cases, `t2` is completely captured and when it is dropped won't be affected +fn test2_only_precise_paths_need_migration() { + let t = (String::new(), String::new()); + let t1 = (String::new(), String::new()); + let t2 = (String::new(), String::new()); + + let c = || { let _ = (&t, &t1); { + //~^ ERROR: drop order affected for closure because of `capture_disjoint_fields` + //~| HELP:` let _ = (&t, &t1)` causes `t`, `t1` to be fully captured + let _t = t.0; + let _t1 = t1.0; + let _t2 = t2; + } }; + + c(); +} + +// If a variable would've not been captured by value then it would've not been +// dropped with the closure and therefore doesn't need migration. +fn test3_only_by_value_need_migration() { + let t = (String::new(), String::new()); + let t1 = (String::new(), String::new()); + let c = || { let _ = &t; { + //~^ ERROR: drop order affected for closure because of `capture_disjoint_fields` + //~| HELP: `let _ = &t` causes `t` to be fully captured + let _t = t.0; + println!("{}", t1.1); + } }; + + c(); +} + +// Copy types get copied into the closure instead of move. Therefore we don't need to +// migrate then as their drop order isn't tied to the closure. +fn test4_only_non_copy_types_need_migration() { + let t = (String::new(), String::new()); + + // `t1` is Copy because all of its elements are Copy + let t1 = (0i32, 0i32); + + let c = || { let _ = &t; { + //~^ ERROR: drop order affected for closure because of `capture_disjoint_fields` + //~| HELP: `let _ = &t` causes `t` to be fully captured + let _t = t.0; + let _t1 = t1.0; + } }; + + c(); +} + +fn test5_only_drop_types_need_migration() { + struct S(i32, i32); + + let t = (String::new(), String::new()); + + // `s` doesn't implement Drop or any elements within it, and doesn't need migration + let s = S(0i32, 0i32); + + let c = || { let _ = &t; { + //~^ ERROR: drop order affected for closure because of `capture_disjoint_fields` + //~| HELP: `let _ = &t` causes `t` to be fully captured + let _t = t.0; + let _s = s.0; + } }; + + c(); +} + +// Since we are using a move closure here, both `t` and `t1` get moved +// even though they are being used by ref inside the closure. +fn test6_move_closures_non_copy_types_might_need_migration() { + let t = (String::new(), String::new()); + let t1 = (String::new(), String::new()); + let c = move || { let _ = (&t1, &t); { + //~^ ERROR: drop order affected for closure because of `capture_disjoint_fields` + //~| HELP: `let _ = (&t1, &t)` causes `t1`, `t` to be fully captured + println!("{} {}", t1.1, t.1); + } }; + + c(); +} + +// Test migration analysis in case of Drop + Non Drop aggregates. +// Note we need migration here only because the non-copy (because Drop type) is captured, +// otherwise we won't need to, since we can get away with just by ref capture in that case. +fn test7_drop_non_drop_aggregate_need_migration() { + let t = (String::new(), String::new(), 0i32); + + let c = || { let _ = &t; { + //~^ ERROR: drop order affected for closure because of `capture_disjoint_fields` + //~| HELP: `let _ = &t` causes `t` to be fully captured + let _t = t.0; + } }; + + c(); +} + +fn main() { + test1_all_need_migration(); + test2_only_precise_paths_need_migration(); + test3_only_by_value_need_migration(); + test4_only_non_copy_types_need_migration(); + test5_only_drop_types_need_migration(); + test6_move_closures_non_copy_types_might_need_migration(); + test7_drop_non_drop_aggregate_need_migration(); +} diff --git a/src/test/ui/closures/2229_closure_analysis/migrations/insignificant_drop.rs b/src/test/ui/closures/2229_closure_analysis/migrations/insignificant_drop.rs index 02b373620966e..2472c8afc8729 100644 --- a/src/test/ui/closures/2229_closure_analysis/migrations/insignificant_drop.rs +++ b/src/test/ui/closures/2229_closure_analysis/migrations/insignificant_drop.rs @@ -1,3 +1,5 @@ +// run-rustfix + #![deny(disjoint_capture_drop_reorder)] //~^ NOTE: the lint level is defined here @@ -11,8 +13,9 @@ fn test1_all_need_migration() { let t2 = (String::new(), String::new()); let c = || { - //~^ERROR: drop order affected for closure because of `capture_disjoint_fields` - //~| NOTE: drop(&(t, t1, t2)); + //~^ ERROR: drop order affected for closure because of `capture_disjoint_fields` + //~| HELP:` let _ = (&t, &t1, &t2)` causes `t`, `t1`, `t2` to be fully captured + let _t = t.0; let _t1 = t1.0; let _t2 = t2.0; @@ -29,8 +32,8 @@ fn test2_only_precise_paths_need_migration() { let t2 = (String::new(), String::new()); let c = || { - //~^ERROR: drop order affected for closure because of `capture_disjoint_fields` - //~| NOTE: drop(&(t, t1)); + //~^ ERROR: drop order affected for closure because of `capture_disjoint_fields` + //~| HELP:` let _ = (&t, &t1)` causes `t`, `t1` to be fully captured let _t = t.0; let _t1 = t1.0; let _t2 = t2; @@ -45,8 +48,8 @@ fn test3_only_by_value_need_migration() { let t = (String::new(), String::new()); let t1 = (String::new(), String::new()); let c = || { - //~^ERROR: drop order affected for closure because of `capture_disjoint_fields` - //~| NOTE: drop(&(t)); + //~^ ERROR: drop order affected for closure because of `capture_disjoint_fields` + //~| HELP: `let _ = &t` causes `t` to be fully captured let _t = t.0; println!("{}", t1.1); }; @@ -63,8 +66,8 @@ fn test4_only_non_copy_types_need_migration() { let t1 = (0i32, 0i32); let c = || { - //~^ERROR: drop order affected for closure because of `capture_disjoint_fields` - //~| NOTE: drop(&(t)); + //~^ ERROR: drop order affected for closure because of `capture_disjoint_fields` + //~| HELP: `let _ = &t` causes `t` to be fully captured let _t = t.0; let _t1 = t1.0; }; @@ -81,8 +84,8 @@ fn test5_only_drop_types_need_migration() { let s = S(0i32, 0i32); let c = || { - //~^ERROR: drop order affected for closure because of `capture_disjoint_fields` - //~| NOTE: drop(&(t)); + //~^ ERROR: drop order affected for closure because of `capture_disjoint_fields` + //~| HELP: `let _ = &t` causes `t` to be fully captured let _t = t.0; let _s = s.0; }; @@ -96,8 +99,8 @@ fn test6_move_closures_non_copy_types_might_need_migration() { let t = (String::new(), String::new()); let t1 = (String::new(), String::new()); let c = move || { - //~^ERROR: drop order affected for closure because of `capture_disjoint_fields` - //~| NOTE: drop(&(t1, t)); + //~^ ERROR: drop order affected for closure because of `capture_disjoint_fields` + //~| HELP: `let _ = (&t1, &t)` causes `t1`, `t` to be fully captured println!("{} {}", t1.1, t.1); }; @@ -111,8 +114,8 @@ fn test7_drop_non_drop_aggregate_need_migration() { let t = (String::new(), String::new(), 0i32); let c = || { - //~^ERROR: drop order affected for closure because of `capture_disjoint_fields` - //~| NOTE: drop(&(t)); + //~^ ERROR: drop order affected for closure because of `capture_disjoint_fields` + //~| HELP: `let _ = &t` causes `t` to be fully captured let _t = t.0; }; diff --git a/src/test/ui/closures/2229_closure_analysis/migrations/insignificant_drop.stderr b/src/test/ui/closures/2229_closure_analysis/migrations/insignificant_drop.stderr index 656c132c12dee..925df1160c8a0 100644 --- a/src/test/ui/closures/2229_closure_analysis/migrations/insignificant_drop.stderr +++ b/src/test/ui/closures/2229_closure_analysis/migrations/insignificant_drop.stderr @@ -1,25 +1,33 @@ error: drop order affected for closure because of `capture_disjoint_fields` - --> $DIR/insignificant_drop.rs:13:13 + --> $DIR/insignificant_drop.rs:15:13 | LL | let c = || { | _____________^ LL | | LL | | -LL | | let _t = t.0; -LL | | let _t1 = t1.0; +LL | | +... | LL | | let _t2 = t2.0; LL | | }; | |_____^ | note: the lint level is defined here - --> $DIR/insignificant_drop.rs:1:9 + --> $DIR/insignificant_drop.rs:3:9 | LL | #![deny(disjoint_capture_drop_reorder)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = note: drop(&(t, t1, t2)); +help: `let _ = (&t, &t1, &t2)` causes `t`, `t1`, `t2` to be fully captured + | +LL | let c = || { let _ = (&t, &t1, &t2); { +LL | +LL | +LL | +LL | let _t = t.0; +LL | let _t1 = t1.0; + ... error: drop order affected for closure because of `capture_disjoint_fields` - --> $DIR/insignificant_drop.rs:31:13 + --> $DIR/insignificant_drop.rs:34:13 | LL | let c = || { | _____________^ @@ -31,10 +39,18 @@ LL | | let _t2 = t2; LL | | }; | |_____^ | - = note: drop(&(t, t1)); +help: `let _ = (&t, &t1)` causes `t`, `t1` to be fully captured + | +LL | let c = || { let _ = (&t, &t1); { +LL | +LL | +LL | let _t = t.0; +LL | let _t1 = t1.0; +LL | let _t2 = t2; + ... error: drop order affected for closure because of `capture_disjoint_fields` - --> $DIR/insignificant_drop.rs:47:13 + --> $DIR/insignificant_drop.rs:50:13 | LL | let c = || { | _____________^ @@ -45,10 +61,18 @@ LL | | println!("{}", t1.1); LL | | }; | |_____^ | - = note: drop(&(t)); +help: `let _ = &t` causes `t` to be fully captured + | +LL | let c = || { let _ = &t; { +LL | +LL | +LL | let _t = t.0; +LL | println!("{}", t1.1); +LL | } }; + | error: drop order affected for closure because of `capture_disjoint_fields` - --> $DIR/insignificant_drop.rs:65:13 + --> $DIR/insignificant_drop.rs:68:13 | LL | let c = || { | _____________^ @@ -59,10 +83,18 @@ LL | | let _t1 = t1.0; LL | | }; | |_____^ | - = note: drop(&(t)); +help: `let _ = &t` causes `t` to be fully captured + | +LL | let c = || { let _ = &t; { +LL | +LL | +LL | let _t = t.0; +LL | let _t1 = t1.0; +LL | } }; + | error: drop order affected for closure because of `capture_disjoint_fields` - --> $DIR/insignificant_drop.rs:83:13 + --> $DIR/insignificant_drop.rs:86:13 | LL | let c = || { | _____________^ @@ -73,10 +105,18 @@ LL | | let _s = s.0; LL | | }; | |_____^ | - = note: drop(&(t)); +help: `let _ = &t` causes `t` to be fully captured + | +LL | let c = || { let _ = &t; { +LL | +LL | +LL | let _t = t.0; +LL | let _s = s.0; +LL | } }; + | error: drop order affected for closure because of `capture_disjoint_fields` - --> $DIR/insignificant_drop.rs:98:13 + --> $DIR/insignificant_drop.rs:101:13 | LL | let c = move || { | _____________^ @@ -86,10 +126,17 @@ LL | | println!("{} {}", t1.1, t.1); LL | | }; | |_____^ | - = note: drop(&(t1, t)); +help: `let _ = (&t1, &t)` causes `t1`, `t` to be fully captured + | +LL | let c = move || { let _ = (&t1, &t); { +LL | +LL | +LL | println!("{} {}", t1.1, t.1); +LL | } }; + | error: drop order affected for closure because of `capture_disjoint_fields` - --> $DIR/insignificant_drop.rs:113:13 + --> $DIR/insignificant_drop.rs:116:13 | LL | let c = || { | _____________^ @@ -99,7 +146,14 @@ LL | | let _t = t.0; LL | | }; | |_____^ | - = note: drop(&(t)); +help: `let _ = &t` causes `t` to be fully captured + | +LL | let c = || { let _ = &t; { +LL | +LL | +LL | let _t = t.0; +LL | } }; + | error: aborting due to 7 previous errors diff --git a/src/test/ui/closures/2229_closure_analysis/migrations/precise.fixed b/src/test/ui/closures/2229_closure_analysis/migrations/precise.fixed new file mode 100644 index 0000000000000..53793be8a6916 --- /dev/null +++ b/src/test/ui/closures/2229_closure_analysis/migrations/precise.fixed @@ -0,0 +1,56 @@ +// run-rustfix + +#![deny(disjoint_capture_drop_reorder)] + +#[derive(Debug)] +struct Foo(i32); +impl Drop for Foo { + fn drop(&mut self) { + println!("{:?} dropped", self.0); + } +} + +struct ConstainsDropField(Foo, Foo); + +// Test that lint is triggered if a path that implements Drop is not captured by move +fn test_precise_analysis_drop_paths_not_captured_by_move() { + let t = ConstainsDropField(Foo(10), Foo(20)); + + let c = || { let _ = &t; { + //~^ ERROR: drop order affected for closure because of `capture_disjoint_fields` + //~| HELP: `let _ = &t` causes `t` to be fully captured + let _t = t.0; + let _t = &t.1; + } }; + + c(); +} + +struct S; +impl Drop for S { + fn drop(&mut self) { + } +} + +struct T(S, S); +struct U(T, T); + +// Test precise analysis for the lint works with paths longer than one. +fn test_precise_analysis_long_path_missing() { + let u = U(T(S, S), T(S, S)); + + let c = || { let _ = &u; { + //~^ ERROR: drop order affected for closure because of `capture_disjoint_fields` + //~| HELP: `let _ = &u` causes `u` to be fully captured + let _x = u.0.0; + let _x = u.0.1; + let _x = u.1.0; + } }; + + c(); +} + +fn main() { + test_precise_analysis_drop_paths_not_captured_by_move(); + test_precise_analysis_long_path_missing(); +} diff --git a/src/test/ui/closures/2229_closure_analysis/migrations/precise.rs b/src/test/ui/closures/2229_closure_analysis/migrations/precise.rs index 79702cc6b56f3..3661c2ca7ed17 100644 --- a/src/test/ui/closures/2229_closure_analysis/migrations/precise.rs +++ b/src/test/ui/closures/2229_closure_analysis/migrations/precise.rs @@ -1,5 +1,6 @@ +// run-rustfix + #![deny(disjoint_capture_drop_reorder)] -//~^ NOTE: the lint level is defined here #[derive(Debug)] struct Foo(i32); @@ -11,35 +12,13 @@ impl Drop for Foo { struct ConstainsDropField(Foo, Foo); -#[derive(Debug)] -struct ContainsAndImplsDrop(Foo); -impl Drop for ContainsAndImplsDrop { - fn drop(&mut self) { - println!("{:?} dropped", self.0); - } -} - -// Test that even if all paths starting at root variable that implement Drop are captured, -// the lint is triggered if the root variable implements drop and isn't captured. -fn test_precise_analysis_parent_root_impl_drop_not_captured() { - let t = ContainsAndImplsDrop(Foo(10)); - - let c = || { - //~^ERROR: drop order affected for closure because of `capture_disjoint_fields` - //~| NOTE: drop(&(t)); - let _t = t.0; - }; - - c(); -} - // Test that lint is triggered if a path that implements Drop is not captured by move fn test_precise_analysis_drop_paths_not_captured_by_move() { let t = ConstainsDropField(Foo(10), Foo(20)); let c = || { - //~^ERROR: drop order affected for closure because of `capture_disjoint_fields` - //~| NOTE: drop(&(t)); + //~^ ERROR: drop order affected for closure because of `capture_disjoint_fields` + //~| HELP: `let _ = &t` causes `t` to be fully captured let _t = t.0; let _t = &t.1; }; @@ -61,8 +40,8 @@ fn test_precise_analysis_long_path_missing() { let u = U(T(S, S), T(S, S)); let c = || { - //~^ERROR: drop order affected for closure because of `capture_disjoint_fields` - //~| NOTE: drop(&(u)); + //~^ ERROR: drop order affected for closure because of `capture_disjoint_fields` + //~| HELP: `let _ = &u` causes `u` to be fully captured let _x = u.0.0; let _x = u.0.1; let _x = u.1.0; @@ -72,7 +51,6 @@ fn test_precise_analysis_long_path_missing() { } fn main() { - test_precise_analysis_parent_root_impl_drop_not_captured(); test_precise_analysis_drop_paths_not_captured_by_move(); test_precise_analysis_long_path_missing(); } diff --git a/src/test/ui/closures/2229_closure_analysis/migrations/precise.stderr b/src/test/ui/closures/2229_closure_analysis/migrations/precise.stderr index 968ca395f946e..4cd75a15adb1a 100644 --- a/src/test/ui/closures/2229_closure_analysis/migrations/precise.stderr +++ b/src/test/ui/closures/2229_closure_analysis/migrations/precise.stderr @@ -1,37 +1,32 @@ error: drop order affected for closure because of `capture_disjoint_fields` - --> $DIR/precise.rs:27:13 + --> $DIR/precise.rs:19:13 | LL | let c = || { | _____________^ LL | | LL | | LL | | let _t = t.0; +LL | | let _t = &t.1; LL | | }; | |_____^ | note: the lint level is defined here - --> $DIR/precise.rs:1:9 + --> $DIR/precise.rs:3:9 | LL | #![deny(disjoint_capture_drop_reorder)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = note: drop(&(t)); - -error: drop order affected for closure because of `capture_disjoint_fields` - --> $DIR/precise.rs:40:13 +help: `let _ = &t` causes `t` to be fully captured | -LL | let c = || { - | _____________^ -LL | | -LL | | -LL | | let _t = t.0; -LL | | let _t = &t.1; -LL | | }; - | |_____^ +LL | let c = || { let _ = &t; { +LL | +LL | +LL | let _t = t.0; +LL | let _t = &t.1; +LL | } }; | - = note: drop(&(t)); error: drop order affected for closure because of `capture_disjoint_fields` - --> $DIR/precise.rs:63:13 + --> $DIR/precise.rs:42:13 | LL | let c = || { | _____________^ @@ -43,7 +38,15 @@ LL | | let _x = u.1.0; LL | | }; | |_____^ | - = note: drop(&(u)); +help: `let _ = &u` causes `u` to be fully captured + | +LL | let c = || { let _ = &u; { +LL | +LL | +LL | let _x = u.0.0; +LL | let _x = u.0.1; +LL | let _x = u.1.0; + ... -error: aborting due to 3 previous errors +error: aborting due to 2 previous errors diff --git a/src/test/ui/closures/2229_closure_analysis/migrations/significant_drop.fixed b/src/test/ui/closures/2229_closure_analysis/migrations/significant_drop.fixed new file mode 100644 index 0000000000000..82b9299c1f437 --- /dev/null +++ b/src/test/ui/closures/2229_closure_analysis/migrations/significant_drop.fixed @@ -0,0 +1,136 @@ +// run-rustfix +#![deny(disjoint_capture_drop_reorder)] +//~^ NOTE: the lint level is defined here + +// Test cases for types that implement a significant drop (user defined) + +#[derive(Debug)] +struct Foo(i32); +impl Drop for Foo { + fn drop(&mut self) { + println!("{:?} dropped", self.0); + } +} + +#[derive(Debug)] +struct ConstainsDropField(Foo, Foo); + +// `t` needs Drop because one of its elements needs drop, +// therefore precise capture might affect drop ordering +fn test1_all_need_migration() { + let t = (Foo(0), Foo(0)); + let t1 = (Foo(0), Foo(0)); + let t2 = (Foo(0), Foo(0)); + + let c = || { let _ = (&t, &t1, &t2); { + //~^ ERROR: drop order affected for closure because of `capture_disjoint_fields` + //~| HELP:` let _ = (&t, &t1, &t2)` causes `t`, `t1`, `t2` to be fully captured + let _t = t.0; + let _t1 = t1.0; + let _t2 = t2.0; + } }; + + c(); +} + +// String implements drop and therefore should be migrated. +// But in this test cases, `t2` is completely captured and when it is dropped won't be affected +fn test2_only_precise_paths_need_migration() { + let t = (Foo(0), Foo(0)); + let t1 = (Foo(0), Foo(0)); + let t2 = (Foo(0), Foo(0)); + + let c = || { let _ = (&t, &t1); { + //~^ ERROR: drop order affected for closure because of `capture_disjoint_fields` + //~| HELP:` let _ = (&t, &t1)` causes `t`, `t1` to be fully captured + let _t = t.0; + let _t1 = t1.0; + let _t2 = t2; + } }; + + c(); +} + +// If a variable would've not been captured by value then it would've not been +// dropped with the closure and therefore doesn't need migration. +fn test3_only_by_value_need_migration() { + let t = (Foo(0), Foo(0)); + let t1 = (Foo(0), Foo(0)); + let c = || { let _ = &t; { + //~^ ERROR: drop order affected for closure because of `capture_disjoint_fields` + //~| HELP: `let _ = &t` causes `t` to be fully captured + let _t = t.0; + println!("{:?}", t1.1); + } }; + + c(); +} + +// The root variable might not implement drop themselves but some path starting +// at the root variable might implement Drop. +// +// If this path isn't captured we need to migrate for the root variable. +fn test4_type_contains_drop_need_migration() { + let t = ConstainsDropField(Foo(0), Foo(0)); + + let c = || { let _ = &t; { + //~^ ERROR: drop order affected for closure because of `capture_disjoint_fields` + //~| HELP: `let _ = &t` causes `t` to be fully captured + let _t = t.0; + } }; + + c(); +} + +// Test migration analysis in case of Drop + Non Drop aggregates. +// Note we need migration here only because the non-copy (because Drop type) is captured, +// otherwise we won't need to, since we can get away with just by ref capture in that case. +fn test5_drop_non_drop_aggregate_need_migration() { + let t = (Foo(0), Foo(0), 0i32); + + let c = || { let _ = &t; { + //~^ ERROR: drop order affected for closure because of `capture_disjoint_fields` + //~| HELP: `let _ = &t` causes `t` to be fully captured + let _t = t.0; + } }; + + c(); +} + +// Test migration analysis in case of Significant and Insignificant Drop aggregates. +fn test6_significant_insignificant_drop_aggregate_need_migration() { + let t = (Foo(0), String::new()); + + let c = || { let _ = &t; { + //~^ ERROR: drop order affected for closure because of `capture_disjoint_fields` + //~| HELP: `let _ = &t` causes `t` to be fully captured + let _t = t.1; + } }; + + c(); +} + +// Since we are using a move closure here, both `t` and `t1` get moved +// even though they are being used by ref inside the closure. +fn test7_move_closures_non_copy_types_might_need_migration() { + let t = (Foo(0), Foo(0)); + let t1 = (Foo(0), Foo(0), Foo(0)); + + let c = move || { let _ = (&t1, &t); { + //~^ ERROR: drop order affected for closure because of `capture_disjoint_fields` + //~| HELP: `let _ = (&t1, &t)` causes `t1`, `t` to be fully captured + println!("{:?} {:?}", t1.1, t.1); + } }; + + c(); +} + +fn main() { + test1_all_need_migration(); + test2_only_precise_paths_need_migration(); + test3_only_by_value_need_migration(); + test4_type_contains_drop_need_migration(); + test5_drop_non_drop_aggregate_need_migration(); + test6_significant_insignificant_drop_aggregate_need_migration(); + test7_move_closures_non_copy_types_might_need_migration(); +} diff --git a/src/test/ui/closures/2229_closure_analysis/migrations/significant_drop.rs b/src/test/ui/closures/2229_closure_analysis/migrations/significant_drop.rs index ed5e4ea8be011..5cb2f611bc1e5 100644 --- a/src/test/ui/closures/2229_closure_analysis/migrations/significant_drop.rs +++ b/src/test/ui/closures/2229_closure_analysis/migrations/significant_drop.rs @@ -1,3 +1,4 @@ +// run-rustfix #![deny(disjoint_capture_drop_reorder)] //~^ NOTE: the lint level is defined here @@ -22,8 +23,8 @@ fn test1_all_need_migration() { let t2 = (Foo(0), Foo(0)); let c = || { - //~^ERROR: drop order affected for closure because of `capture_disjoint_fields` - //~| NOTE: drop(&(t, t1, t2)); + //~^ ERROR: drop order affected for closure because of `capture_disjoint_fields` + //~| HELP:` let _ = (&t, &t1, &t2)` causes `t`, `t1`, `t2` to be fully captured let _t = t.0; let _t1 = t1.0; let _t2 = t2.0; @@ -40,8 +41,8 @@ fn test2_only_precise_paths_need_migration() { let t2 = (Foo(0), Foo(0)); let c = || { - //~^ERROR: drop order affected for closure because of `capture_disjoint_fields` - //~| NOTE: drop(&(t, t1)); + //~^ ERROR: drop order affected for closure because of `capture_disjoint_fields` + //~| HELP:` let _ = (&t, &t1)` causes `t`, `t1` to be fully captured let _t = t.0; let _t1 = t1.0; let _t2 = t2; @@ -56,8 +57,8 @@ fn test3_only_by_value_need_migration() { let t = (Foo(0), Foo(0)); let t1 = (Foo(0), Foo(0)); let c = || { - //~^ERROR: drop order affected for closure because of `capture_disjoint_fields` - //~| NOTE: drop(&(t)); + //~^ ERROR: drop order affected for closure because of `capture_disjoint_fields` + //~| HELP: `let _ = &t` causes `t` to be fully captured let _t = t.0; println!("{:?}", t1.1); }; @@ -73,8 +74,8 @@ fn test4_type_contains_drop_need_migration() { let t = ConstainsDropField(Foo(0), Foo(0)); let c = || { - //~^ERROR: drop order affected for closure because of `capture_disjoint_fields` - //~| NOTE: drop(&(t)); + //~^ ERROR: drop order affected for closure because of `capture_disjoint_fields` + //~| HELP: `let _ = &t` causes `t` to be fully captured let _t = t.0; }; @@ -88,8 +89,8 @@ fn test5_drop_non_drop_aggregate_need_migration() { let t = (Foo(0), Foo(0), 0i32); let c = || { - //~^ERROR: drop order affected for closure because of `capture_disjoint_fields` - //~| NOTE: drop(&(t)); + //~^ ERROR: drop order affected for closure because of `capture_disjoint_fields` + //~| HELP: `let _ = &t` causes `t` to be fully captured let _t = t.0; }; @@ -98,13 +99,11 @@ fn test5_drop_non_drop_aggregate_need_migration() { // Test migration analysis in case of Significant and Insignificant Drop aggregates. fn test6_significant_insignificant_drop_aggregate_need_migration() { - struct S(i32, i32); - let t = (Foo(0), String::new()); let c = || { - //~^ERROR: drop order affected for closure because of `capture_disjoint_fields` - //~| NOTE: drop(&(t)); + //~^ ERROR: drop order affected for closure because of `capture_disjoint_fields` + //~| HELP: `let _ = &t` causes `t` to be fully captured let _t = t.1; }; @@ -118,8 +117,8 @@ fn test7_move_closures_non_copy_types_might_need_migration() { let t1 = (Foo(0), Foo(0), Foo(0)); let c = move || { - //~^ERROR: drop order affected for closure because of `capture_disjoint_fields` - //~| NOTE: drop(&(t1, t)); + //~^ ERROR: drop order affected for closure because of `capture_disjoint_fields` + //~| HELP: `let _ = (&t1, &t)` causes `t1`, `t` to be fully captured println!("{:?} {:?}", t1.1, t.1); }; diff --git a/src/test/ui/closures/2229_closure_analysis/migrations/significant_drop.stderr b/src/test/ui/closures/2229_closure_analysis/migrations/significant_drop.stderr index 6c21b27b493ba..fcf734020ce9d 100644 --- a/src/test/ui/closures/2229_closure_analysis/migrations/significant_drop.stderr +++ b/src/test/ui/closures/2229_closure_analysis/migrations/significant_drop.stderr @@ -1,5 +1,5 @@ error: drop order affected for closure because of `capture_disjoint_fields` - --> $DIR/significant_drop.rs:24:13 + --> $DIR/significant_drop.rs:25:13 | LL | let c = || { | _____________^ @@ -12,14 +12,22 @@ LL | | }; | |_____^ | note: the lint level is defined here - --> $DIR/significant_drop.rs:1:9 + --> $DIR/significant_drop.rs:2:9 | LL | #![deny(disjoint_capture_drop_reorder)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = note: drop(&(t, t1, t2)); +help: `let _ = (&t, &t1, &t2)` causes `t`, `t1`, `t2` to be fully captured + | +LL | let c = || { let _ = (&t, &t1, &t2); { +LL | +LL | +LL | let _t = t.0; +LL | let _t1 = t1.0; +LL | let _t2 = t2.0; + ... error: drop order affected for closure because of `capture_disjoint_fields` - --> $DIR/significant_drop.rs:42:13 + --> $DIR/significant_drop.rs:43:13 | LL | let c = || { | _____________^ @@ -31,10 +39,18 @@ LL | | let _t2 = t2; LL | | }; | |_____^ | - = note: drop(&(t, t1)); +help: `let _ = (&t, &t1)` causes `t`, `t1` to be fully captured + | +LL | let c = || { let _ = (&t, &t1); { +LL | +LL | +LL | let _t = t.0; +LL | let _t1 = t1.0; +LL | let _t2 = t2; + ... error: drop order affected for closure because of `capture_disjoint_fields` - --> $DIR/significant_drop.rs:58:13 + --> $DIR/significant_drop.rs:59:13 | LL | let c = || { | _____________^ @@ -45,10 +61,18 @@ LL | | println!("{:?}", t1.1); LL | | }; | |_____^ | - = note: drop(&(t)); +help: `let _ = &t` causes `t` to be fully captured + | +LL | let c = || { let _ = &t; { +LL | +LL | +LL | let _t = t.0; +LL | println!("{:?}", t1.1); +LL | } }; + | error: drop order affected for closure because of `capture_disjoint_fields` - --> $DIR/significant_drop.rs:75:13 + --> $DIR/significant_drop.rs:76:13 | LL | let c = || { | _____________^ @@ -58,10 +82,17 @@ LL | | let _t = t.0; LL | | }; | |_____^ | - = note: drop(&(t)); +help: `let _ = &t` causes `t` to be fully captured + | +LL | let c = || { let _ = &t; { +LL | +LL | +LL | let _t = t.0; +LL | } }; + | error: drop order affected for closure because of `capture_disjoint_fields` - --> $DIR/significant_drop.rs:90:13 + --> $DIR/significant_drop.rs:91:13 | LL | let c = || { | _____________^ @@ -71,10 +102,17 @@ LL | | let _t = t.0; LL | | }; | |_____^ | - = note: drop(&(t)); +help: `let _ = &t` causes `t` to be fully captured + | +LL | let c = || { let _ = &t; { +LL | +LL | +LL | let _t = t.0; +LL | } }; + | error: drop order affected for closure because of `capture_disjoint_fields` - --> $DIR/significant_drop.rs:105:13 + --> $DIR/significant_drop.rs:104:13 | LL | let c = || { | _____________^ @@ -84,10 +122,17 @@ LL | | let _t = t.1; LL | | }; | |_____^ | - = note: drop(&(t)); +help: `let _ = &t` causes `t` to be fully captured + | +LL | let c = || { let _ = &t; { +LL | +LL | +LL | let _t = t.1; +LL | } }; + | error: drop order affected for closure because of `capture_disjoint_fields` - --> $DIR/significant_drop.rs:120:13 + --> $DIR/significant_drop.rs:119:13 | LL | let c = move || { | _____________^ @@ -97,7 +142,14 @@ LL | | println!("{:?} {:?}", t1.1, t.1); LL | | }; | |_____^ | - = note: drop(&(t1, t)); +help: `let _ = (&t1, &t)` causes `t1`, `t` to be fully captured + | +LL | let c = move || { let _ = (&t1, &t); { +LL | +LL | +LL | println!("{:?} {:?}", t1.1, t.1); +LL | } }; + | error: aborting due to 7 previous errors From a721957a3d019f26e709546f27a4048eb8b9621b Mon Sep 17 00:00:00 2001 From: Aman Arora Date: Thu, 1 Apr 2021 21:08:04 -0400 Subject: [PATCH 16/21] Don't introduce a block if a block exists --- compiler/rustc_typeck/src/check/upvar.rs | 16 ++++++-- .../migrations/insignificant_drop.fixed | 28 ++++++------- .../migrations/insignificant_drop.stderr | 24 +++++------ .../migrations/migrations_rustfix.fixed | 40 +++++++++++++++++++ .../migrations/migrations_rustfix.rs | 40 +++++++++++++++++++ .../migrations/migrations_rustfix.stderr | 38 ++++++++++++++++++ .../migrations/precise.fixed | 8 ++-- .../migrations/precise.stderr | 6 +-- .../migrations/significant_drop.fixed | 28 ++++++------- .../migrations/significant_drop.stderr | 24 +++++------ 10 files changed, 189 insertions(+), 63 deletions(-) create mode 100644 src/test/ui/closures/2229_closure_analysis/migrations/migrations_rustfix.fixed create mode 100644 src/test/ui/closures/2229_closure_analysis/migrations/migrations_rustfix.rs create mode 100644 src/test/ui/closures/2229_closure_analysis/migrations/migrations_rustfix.stderr diff --git a/compiler/rustc_typeck/src/check/upvar.rs b/compiler/rustc_typeck/src/check/upvar.rs index cd93cbbe965a1..bbe843f468b03 100644 --- a/compiler/rustc_typeck/src/check/upvar.rs +++ b/compiler/rustc_typeck/src/check/upvar.rs @@ -495,10 +495,18 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { let closure_body_span = self.tcx.hir().span(body_id.hir_id); let (sugg, app) = match self.tcx.sess.source_map().span_to_snippet(closure_body_span) { - Ok(s) => ( - format!("{{ {}; {} }}", migration_string, s), - Applicability::MachineApplicable, - ), + Ok(s) => { + let trimmed = s.trim_start(); + + // If the closure contains a block then replace the opening brace + // with "{ let _ = (..); " + let sugg = if let Some('{') = trimmed.chars().next() { + format!("{{ {}; {}", migration_string, &trimmed[1..]) + } else { + format!("{{ {}; {} }}", migration_string, s) + }; + (sugg, Applicability::MachineApplicable) + } Err(_) => (migration_string.clone(), Applicability::HasPlaceholders), }; diff --git a/src/test/ui/closures/2229_closure_analysis/migrations/insignificant_drop.fixed b/src/test/ui/closures/2229_closure_analysis/migrations/insignificant_drop.fixed index 3e3460789152c..0f4c7dcb0df1c 100644 --- a/src/test/ui/closures/2229_closure_analysis/migrations/insignificant_drop.fixed +++ b/src/test/ui/closures/2229_closure_analysis/migrations/insignificant_drop.fixed @@ -12,14 +12,14 @@ fn test1_all_need_migration() { let t1 = (String::new(), String::new()); let t2 = (String::new(), String::new()); - let c = || { let _ = (&t, &t1, &t2); { + let c = || { let _ = (&t, &t1, &t2); //~^ ERROR: drop order affected for closure because of `capture_disjoint_fields` //~| HELP:` let _ = (&t, &t1, &t2)` causes `t`, `t1`, `t2` to be fully captured let _t = t.0; let _t1 = t1.0; let _t2 = t2.0; - } }; + }; c(); } @@ -31,13 +31,13 @@ fn test2_only_precise_paths_need_migration() { let t1 = (String::new(), String::new()); let t2 = (String::new(), String::new()); - let c = || { let _ = (&t, &t1); { + let c = || { let _ = (&t, &t1); //~^ ERROR: drop order affected for closure because of `capture_disjoint_fields` //~| HELP:` let _ = (&t, &t1)` causes `t`, `t1` to be fully captured let _t = t.0; let _t1 = t1.0; let _t2 = t2; - } }; + }; c(); } @@ -47,12 +47,12 @@ fn test2_only_precise_paths_need_migration() { fn test3_only_by_value_need_migration() { let t = (String::new(), String::new()); let t1 = (String::new(), String::new()); - let c = || { let _ = &t; { + let c = || { let _ = &t; //~^ ERROR: drop order affected for closure because of `capture_disjoint_fields` //~| HELP: `let _ = &t` causes `t` to be fully captured let _t = t.0; println!("{}", t1.1); - } }; + }; c(); } @@ -65,12 +65,12 @@ fn test4_only_non_copy_types_need_migration() { // `t1` is Copy because all of its elements are Copy let t1 = (0i32, 0i32); - let c = || { let _ = &t; { + let c = || { let _ = &t; //~^ ERROR: drop order affected for closure because of `capture_disjoint_fields` //~| HELP: `let _ = &t` causes `t` to be fully captured let _t = t.0; let _t1 = t1.0; - } }; + }; c(); } @@ -83,12 +83,12 @@ fn test5_only_drop_types_need_migration() { // `s` doesn't implement Drop or any elements within it, and doesn't need migration let s = S(0i32, 0i32); - let c = || { let _ = &t; { + let c = || { let _ = &t; //~^ ERROR: drop order affected for closure because of `capture_disjoint_fields` //~| HELP: `let _ = &t` causes `t` to be fully captured let _t = t.0; let _s = s.0; - } }; + }; c(); } @@ -98,11 +98,11 @@ fn test5_only_drop_types_need_migration() { fn test6_move_closures_non_copy_types_might_need_migration() { let t = (String::new(), String::new()); let t1 = (String::new(), String::new()); - let c = move || { let _ = (&t1, &t); { + let c = move || { let _ = (&t1, &t); //~^ ERROR: drop order affected for closure because of `capture_disjoint_fields` //~| HELP: `let _ = (&t1, &t)` causes `t1`, `t` to be fully captured println!("{} {}", t1.1, t.1); - } }; + }; c(); } @@ -113,11 +113,11 @@ fn test6_move_closures_non_copy_types_might_need_migration() { fn test7_drop_non_drop_aggregate_need_migration() { let t = (String::new(), String::new(), 0i32); - let c = || { let _ = &t; { + let c = || { let _ = &t; //~^ ERROR: drop order affected for closure because of `capture_disjoint_fields` //~| HELP: `let _ = &t` causes `t` to be fully captured let _t = t.0; - } }; + }; c(); } diff --git a/src/test/ui/closures/2229_closure_analysis/migrations/insignificant_drop.stderr b/src/test/ui/closures/2229_closure_analysis/migrations/insignificant_drop.stderr index 925df1160c8a0..253a906a0ec46 100644 --- a/src/test/ui/closures/2229_closure_analysis/migrations/insignificant_drop.stderr +++ b/src/test/ui/closures/2229_closure_analysis/migrations/insignificant_drop.stderr @@ -18,7 +18,7 @@ LL | #![deny(disjoint_capture_drop_reorder)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: `let _ = (&t, &t1, &t2)` causes `t`, `t1`, `t2` to be fully captured | -LL | let c = || { let _ = (&t, &t1, &t2); { +LL | let c = || { let _ = (&t, &t1, &t2); LL | LL | LL | @@ -41,7 +41,7 @@ LL | | }; | help: `let _ = (&t, &t1)` causes `t`, `t1` to be fully captured | -LL | let c = || { let _ = (&t, &t1); { +LL | let c = || { let _ = (&t, &t1); LL | LL | LL | let _t = t.0; @@ -63,12 +63,12 @@ LL | | }; | help: `let _ = &t` causes `t` to be fully captured | -LL | let c = || { let _ = &t; { +LL | let c = || { let _ = &t; LL | LL | LL | let _t = t.0; LL | println!("{}", t1.1); -LL | } }; +LL | }; | error: drop order affected for closure because of `capture_disjoint_fields` @@ -85,12 +85,12 @@ LL | | }; | help: `let _ = &t` causes `t` to be fully captured | -LL | let c = || { let _ = &t; { +LL | let c = || { let _ = &t; LL | LL | LL | let _t = t.0; LL | let _t1 = t1.0; -LL | } }; +LL | }; | error: drop order affected for closure because of `capture_disjoint_fields` @@ -107,12 +107,12 @@ LL | | }; | help: `let _ = &t` causes `t` to be fully captured | -LL | let c = || { let _ = &t; { +LL | let c = || { let _ = &t; LL | LL | LL | let _t = t.0; LL | let _s = s.0; -LL | } }; +LL | }; | error: drop order affected for closure because of `capture_disjoint_fields` @@ -128,11 +128,11 @@ LL | | }; | help: `let _ = (&t1, &t)` causes `t1`, `t` to be fully captured | -LL | let c = move || { let _ = (&t1, &t); { +LL | let c = move || { let _ = (&t1, &t); LL | LL | LL | println!("{} {}", t1.1, t.1); -LL | } }; +LL | }; | error: drop order affected for closure because of `capture_disjoint_fields` @@ -148,11 +148,11 @@ LL | | }; | help: `let _ = &t` causes `t` to be fully captured | -LL | let c = || { let _ = &t; { +LL | let c = || { let _ = &t; LL | LL | LL | let _t = t.0; -LL | } }; +LL | }; | error: aborting due to 7 previous errors diff --git a/src/test/ui/closures/2229_closure_analysis/migrations/migrations_rustfix.fixed b/src/test/ui/closures/2229_closure_analysis/migrations/migrations_rustfix.fixed new file mode 100644 index 0000000000000..f17fab8e81f6d --- /dev/null +++ b/src/test/ui/closures/2229_closure_analysis/migrations/migrations_rustfix.fixed @@ -0,0 +1,40 @@ +// run-rustfix +#![deny(disjoint_capture_drop_reorder)] +//~^ NOTE: the lint level is defined here + +// Test the two possible cases for automated migartion using rustfix +// - Closure contains a block i.e. `|| { .. };` +// - Closure contains just an expr `|| ..;` + +#[derive(Debug)] +struct Foo(i32); +impl Drop for Foo { + fn drop(&mut self) { + println!("{:?} dropped", self.0); + } +} + +fn closure_contains_block() { + let t = (Foo(0), Foo(0)); + let c = || { let _ = &t; + //~^ ERROR: drop order affected for closure because of `capture_disjoint_fields` + //~| HELP: `let _ = &t` causes `t` to be fully captured + let _t = t.0; + }; + + c(); +} + +fn closure_doesnt_contain_block() { + let t = (Foo(0), Foo(0)); + let c = || { let _ = &t; t.0 }; + //~^ ERROR: drop order affected for closure because of `capture_disjoint_fields` + //~| HELP: `let _ = &t` causes `t` to be fully captured + + c(); +} + +fn main() { + closure_contains_block(); + closure_doesnt_contain_block(); +} diff --git a/src/test/ui/closures/2229_closure_analysis/migrations/migrations_rustfix.rs b/src/test/ui/closures/2229_closure_analysis/migrations/migrations_rustfix.rs new file mode 100644 index 0000000000000..33aff10c520ac --- /dev/null +++ b/src/test/ui/closures/2229_closure_analysis/migrations/migrations_rustfix.rs @@ -0,0 +1,40 @@ +// run-rustfix +#![deny(disjoint_capture_drop_reorder)] +//~^ NOTE: the lint level is defined here + +// Test the two possible cases for automated migartion using rustfix +// - Closure contains a block i.e. `|| { .. };` +// - Closure contains just an expr `|| ..;` + +#[derive(Debug)] +struct Foo(i32); +impl Drop for Foo { + fn drop(&mut self) { + println!("{:?} dropped", self.0); + } +} + +fn closure_contains_block() { + let t = (Foo(0), Foo(0)); + let c = || { + //~^ ERROR: drop order affected for closure because of `capture_disjoint_fields` + //~| HELP: `let _ = &t` causes `t` to be fully captured + let _t = t.0; + }; + + c(); +} + +fn closure_doesnt_contain_block() { + let t = (Foo(0), Foo(0)); + let c = || t.0; + //~^ ERROR: drop order affected for closure because of `capture_disjoint_fields` + //~| HELP: `let _ = &t` causes `t` to be fully captured + + c(); +} + +fn main() { + closure_contains_block(); + closure_doesnt_contain_block(); +} diff --git a/src/test/ui/closures/2229_closure_analysis/migrations/migrations_rustfix.stderr b/src/test/ui/closures/2229_closure_analysis/migrations/migrations_rustfix.stderr new file mode 100644 index 0000000000000..611fbc4fff347 --- /dev/null +++ b/src/test/ui/closures/2229_closure_analysis/migrations/migrations_rustfix.stderr @@ -0,0 +1,38 @@ +error: drop order affected for closure because of `capture_disjoint_fields` + --> $DIR/migrations_rustfix.rs:19:13 + | +LL | let c = || { + | _____________^ +LL | | +LL | | +LL | | let _t = t.0; +LL | | }; + | |_____^ + | +note: the lint level is defined here + --> $DIR/migrations_rustfix.rs:2:9 + | +LL | #![deny(disjoint_capture_drop_reorder)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +help: `let _ = &t` causes `t` to be fully captured + | +LL | let c = || { let _ = &t; +LL | +LL | +LL | let _t = t.0; +LL | }; + | + +error: drop order affected for closure because of `capture_disjoint_fields` + --> $DIR/migrations_rustfix.rs:30:13 + | +LL | let c = || t.0; + | ^^^^^^ + | +help: `let _ = &t` causes `t` to be fully captured + | +LL | let c = || { let _ = &t; t.0 }; + | ^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/closures/2229_closure_analysis/migrations/precise.fixed b/src/test/ui/closures/2229_closure_analysis/migrations/precise.fixed index 53793be8a6916..06932c1ae64ad 100644 --- a/src/test/ui/closures/2229_closure_analysis/migrations/precise.fixed +++ b/src/test/ui/closures/2229_closure_analysis/migrations/precise.fixed @@ -16,12 +16,12 @@ struct ConstainsDropField(Foo, Foo); fn test_precise_analysis_drop_paths_not_captured_by_move() { let t = ConstainsDropField(Foo(10), Foo(20)); - let c = || { let _ = &t; { + let c = || { let _ = &t; //~^ ERROR: drop order affected for closure because of `capture_disjoint_fields` //~| HELP: `let _ = &t` causes `t` to be fully captured let _t = t.0; let _t = &t.1; - } }; + }; c(); } @@ -39,13 +39,13 @@ struct U(T, T); fn test_precise_analysis_long_path_missing() { let u = U(T(S, S), T(S, S)); - let c = || { let _ = &u; { + let c = || { let _ = &u; //~^ ERROR: drop order affected for closure because of `capture_disjoint_fields` //~| HELP: `let _ = &u` causes `u` to be fully captured let _x = u.0.0; let _x = u.0.1; let _x = u.1.0; - } }; + }; c(); } diff --git a/src/test/ui/closures/2229_closure_analysis/migrations/precise.stderr b/src/test/ui/closures/2229_closure_analysis/migrations/precise.stderr index 4cd75a15adb1a..fcfd08d61e0e4 100644 --- a/src/test/ui/closures/2229_closure_analysis/migrations/precise.stderr +++ b/src/test/ui/closures/2229_closure_analysis/migrations/precise.stderr @@ -17,12 +17,12 @@ LL | #![deny(disjoint_capture_drop_reorder)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: `let _ = &t` causes `t` to be fully captured | -LL | let c = || { let _ = &t; { +LL | let c = || { let _ = &t; LL | LL | LL | let _t = t.0; LL | let _t = &t.1; -LL | } }; +LL | }; | error: drop order affected for closure because of `capture_disjoint_fields` @@ -40,7 +40,7 @@ LL | | }; | help: `let _ = &u` causes `u` to be fully captured | -LL | let c = || { let _ = &u; { +LL | let c = || { let _ = &u; LL | LL | LL | let _x = u.0.0; diff --git a/src/test/ui/closures/2229_closure_analysis/migrations/significant_drop.fixed b/src/test/ui/closures/2229_closure_analysis/migrations/significant_drop.fixed index 82b9299c1f437..b44624be5f991 100644 --- a/src/test/ui/closures/2229_closure_analysis/migrations/significant_drop.fixed +++ b/src/test/ui/closures/2229_closure_analysis/migrations/significant_drop.fixed @@ -22,13 +22,13 @@ fn test1_all_need_migration() { let t1 = (Foo(0), Foo(0)); let t2 = (Foo(0), Foo(0)); - let c = || { let _ = (&t, &t1, &t2); { + let c = || { let _ = (&t, &t1, &t2); //~^ ERROR: drop order affected for closure because of `capture_disjoint_fields` //~| HELP:` let _ = (&t, &t1, &t2)` causes `t`, `t1`, `t2` to be fully captured let _t = t.0; let _t1 = t1.0; let _t2 = t2.0; - } }; + }; c(); } @@ -40,13 +40,13 @@ fn test2_only_precise_paths_need_migration() { let t1 = (Foo(0), Foo(0)); let t2 = (Foo(0), Foo(0)); - let c = || { let _ = (&t, &t1); { + let c = || { let _ = (&t, &t1); //~^ ERROR: drop order affected for closure because of `capture_disjoint_fields` //~| HELP:` let _ = (&t, &t1)` causes `t`, `t1` to be fully captured let _t = t.0; let _t1 = t1.0; let _t2 = t2; - } }; + }; c(); } @@ -56,12 +56,12 @@ fn test2_only_precise_paths_need_migration() { fn test3_only_by_value_need_migration() { let t = (Foo(0), Foo(0)); let t1 = (Foo(0), Foo(0)); - let c = || { let _ = &t; { + let c = || { let _ = &t; //~^ ERROR: drop order affected for closure because of `capture_disjoint_fields` //~| HELP: `let _ = &t` causes `t` to be fully captured let _t = t.0; println!("{:?}", t1.1); - } }; + }; c(); } @@ -73,11 +73,11 @@ fn test3_only_by_value_need_migration() { fn test4_type_contains_drop_need_migration() { let t = ConstainsDropField(Foo(0), Foo(0)); - let c = || { let _ = &t; { + let c = || { let _ = &t; //~^ ERROR: drop order affected for closure because of `capture_disjoint_fields` //~| HELP: `let _ = &t` causes `t` to be fully captured let _t = t.0; - } }; + }; c(); } @@ -88,11 +88,11 @@ fn test4_type_contains_drop_need_migration() { fn test5_drop_non_drop_aggregate_need_migration() { let t = (Foo(0), Foo(0), 0i32); - let c = || { let _ = &t; { + let c = || { let _ = &t; //~^ ERROR: drop order affected for closure because of `capture_disjoint_fields` //~| HELP: `let _ = &t` causes `t` to be fully captured let _t = t.0; - } }; + }; c(); } @@ -101,11 +101,11 @@ fn test5_drop_non_drop_aggregate_need_migration() { fn test6_significant_insignificant_drop_aggregate_need_migration() { let t = (Foo(0), String::new()); - let c = || { let _ = &t; { + let c = || { let _ = &t; //~^ ERROR: drop order affected for closure because of `capture_disjoint_fields` //~| HELP: `let _ = &t` causes `t` to be fully captured let _t = t.1; - } }; + }; c(); } @@ -116,11 +116,11 @@ fn test7_move_closures_non_copy_types_might_need_migration() { let t = (Foo(0), Foo(0)); let t1 = (Foo(0), Foo(0), Foo(0)); - let c = move || { let _ = (&t1, &t); { + let c = move || { let _ = (&t1, &t); //~^ ERROR: drop order affected for closure because of `capture_disjoint_fields` //~| HELP: `let _ = (&t1, &t)` causes `t1`, `t` to be fully captured println!("{:?} {:?}", t1.1, t.1); - } }; + }; c(); } diff --git a/src/test/ui/closures/2229_closure_analysis/migrations/significant_drop.stderr b/src/test/ui/closures/2229_closure_analysis/migrations/significant_drop.stderr index fcf734020ce9d..2ca2baa9cbc07 100644 --- a/src/test/ui/closures/2229_closure_analysis/migrations/significant_drop.stderr +++ b/src/test/ui/closures/2229_closure_analysis/migrations/significant_drop.stderr @@ -18,7 +18,7 @@ LL | #![deny(disjoint_capture_drop_reorder)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: `let _ = (&t, &t1, &t2)` causes `t`, `t1`, `t2` to be fully captured | -LL | let c = || { let _ = (&t, &t1, &t2); { +LL | let c = || { let _ = (&t, &t1, &t2); LL | LL | LL | let _t = t.0; @@ -41,7 +41,7 @@ LL | | }; | help: `let _ = (&t, &t1)` causes `t`, `t1` to be fully captured | -LL | let c = || { let _ = (&t, &t1); { +LL | let c = || { let _ = (&t, &t1); LL | LL | LL | let _t = t.0; @@ -63,12 +63,12 @@ LL | | }; | help: `let _ = &t` causes `t` to be fully captured | -LL | let c = || { let _ = &t; { +LL | let c = || { let _ = &t; LL | LL | LL | let _t = t.0; LL | println!("{:?}", t1.1); -LL | } }; +LL | }; | error: drop order affected for closure because of `capture_disjoint_fields` @@ -84,11 +84,11 @@ LL | | }; | help: `let _ = &t` causes `t` to be fully captured | -LL | let c = || { let _ = &t; { +LL | let c = || { let _ = &t; LL | LL | LL | let _t = t.0; -LL | } }; +LL | }; | error: drop order affected for closure because of `capture_disjoint_fields` @@ -104,11 +104,11 @@ LL | | }; | help: `let _ = &t` causes `t` to be fully captured | -LL | let c = || { let _ = &t; { +LL | let c = || { let _ = &t; LL | LL | LL | let _t = t.0; -LL | } }; +LL | }; | error: drop order affected for closure because of `capture_disjoint_fields` @@ -124,11 +124,11 @@ LL | | }; | help: `let _ = &t` causes `t` to be fully captured | -LL | let c = || { let _ = &t; { +LL | let c = || { let _ = &t; LL | LL | LL | let _t = t.1; -LL | } }; +LL | }; | error: drop order affected for closure because of `capture_disjoint_fields` @@ -144,11 +144,11 @@ LL | | }; | help: `let _ = (&t1, &t)` causes `t1`, `t` to be fully captured | -LL | let c = move || { let _ = (&t1, &t); { +LL | let c = move || { let _ = (&t1, &t); LL | LL | LL | println!("{:?} {:?}", t1.1, t.1); -LL | } }; +LL | }; | error: aborting due to 7 previous errors From 1b9620d75f75aad6629bb8815344a1a2f14a2081 Mon Sep 17 00:00:00 2001 From: Aman Arora Date: Thu, 1 Apr 2021 21:33:11 -0400 Subject: [PATCH 17/21] Make the diagnostic message more readable --- compiler/rustc_typeck/src/check/upvar.rs | 4 ++-- .../migrations/insignificant_drop.fixed | 14 +++++++------- .../migrations/insignificant_drop.rs | 14 +++++++------- .../migrations/insignificant_drop.stderr | 14 +++++++------- .../migrations/migrations_rustfix.fixed | 4 ++-- .../migrations/migrations_rustfix.rs | 4 ++-- .../migrations/migrations_rustfix.stderr | 4 ++-- .../2229_closure_analysis/migrations/precise.fixed | 4 ++-- .../2229_closure_analysis/migrations/precise.rs | 4 ++-- .../migrations/precise.stderr | 4 ++-- .../migrations/significant_drop.fixed | 14 +++++++------- .../migrations/significant_drop.rs | 14 +++++++------- .../migrations/significant_drop.stderr | 14 +++++++------- 13 files changed, 56 insertions(+), 56 deletions(-) diff --git a/compiler/rustc_typeck/src/check/upvar.rs b/compiler/rustc_typeck/src/check/upvar.rs index bbe843f468b03..6f8dd39958c04 100644 --- a/compiler/rustc_typeck/src/check/upvar.rs +++ b/compiler/rustc_typeck/src/check/upvar.rs @@ -511,8 +511,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { }; let diagnostic_msg = format!( - "`{}` causes {} to be fully captured", - migration_string, migrated_variables_concat + "add a dummy let to cause {} to be fully captured", + migrated_variables_concat ); diagnostics_builder.span_suggestion( diff --git a/src/test/ui/closures/2229_closure_analysis/migrations/insignificant_drop.fixed b/src/test/ui/closures/2229_closure_analysis/migrations/insignificant_drop.fixed index 0f4c7dcb0df1c..300f67e8b1e81 100644 --- a/src/test/ui/closures/2229_closure_analysis/migrations/insignificant_drop.fixed +++ b/src/test/ui/closures/2229_closure_analysis/migrations/insignificant_drop.fixed @@ -14,7 +14,7 @@ fn test1_all_need_migration() { let c = || { let _ = (&t, &t1, &t2); //~^ ERROR: drop order affected for closure because of `capture_disjoint_fields` - //~| HELP:` let _ = (&t, &t1, &t2)` causes `t`, `t1`, `t2` to be fully captured + //~| HELP: add a dummy let to cause `t`, `t1`, `t2` to be fully captured let _t = t.0; let _t1 = t1.0; @@ -33,7 +33,7 @@ fn test2_only_precise_paths_need_migration() { let c = || { let _ = (&t, &t1); //~^ ERROR: drop order affected for closure because of `capture_disjoint_fields` - //~| HELP:` let _ = (&t, &t1)` causes `t`, `t1` to be fully captured + //~| HELP: add a dummy let to cause `t`, `t1` to be fully captured let _t = t.0; let _t1 = t1.0; let _t2 = t2; @@ -49,7 +49,7 @@ fn test3_only_by_value_need_migration() { let t1 = (String::new(), String::new()); let c = || { let _ = &t; //~^ ERROR: drop order affected for closure because of `capture_disjoint_fields` - //~| HELP: `let _ = &t` causes `t` to be fully captured + //~| HELP: add a dummy let to cause `t` to be fully captured let _t = t.0; println!("{}", t1.1); }; @@ -67,7 +67,7 @@ fn test4_only_non_copy_types_need_migration() { let c = || { let _ = &t; //~^ ERROR: drop order affected for closure because of `capture_disjoint_fields` - //~| HELP: `let _ = &t` causes `t` to be fully captured + //~| HELP: add a dummy let to cause `t` to be fully captured let _t = t.0; let _t1 = t1.0; }; @@ -85,7 +85,7 @@ fn test5_only_drop_types_need_migration() { let c = || { let _ = &t; //~^ ERROR: drop order affected for closure because of `capture_disjoint_fields` - //~| HELP: `let _ = &t` causes `t` to be fully captured + //~| HELP: add a dummy let to cause `t` to be fully captured let _t = t.0; let _s = s.0; }; @@ -100,7 +100,7 @@ fn test6_move_closures_non_copy_types_might_need_migration() { let t1 = (String::new(), String::new()); let c = move || { let _ = (&t1, &t); //~^ ERROR: drop order affected for closure because of `capture_disjoint_fields` - //~| HELP: `let _ = (&t1, &t)` causes `t1`, `t` to be fully captured + //~| HELP: add a dummy let to cause `t1`, `t` to be fully captured println!("{} {}", t1.1, t.1); }; @@ -115,7 +115,7 @@ fn test7_drop_non_drop_aggregate_need_migration() { let c = || { let _ = &t; //~^ ERROR: drop order affected for closure because of `capture_disjoint_fields` - //~| HELP: `let _ = &t` causes `t` to be fully captured + //~| HELP: add a dummy let to cause `t` to be fully captured let _t = t.0; }; diff --git a/src/test/ui/closures/2229_closure_analysis/migrations/insignificant_drop.rs b/src/test/ui/closures/2229_closure_analysis/migrations/insignificant_drop.rs index 2472c8afc8729..a17c70d3e2877 100644 --- a/src/test/ui/closures/2229_closure_analysis/migrations/insignificant_drop.rs +++ b/src/test/ui/closures/2229_closure_analysis/migrations/insignificant_drop.rs @@ -14,7 +14,7 @@ fn test1_all_need_migration() { let c = || { //~^ ERROR: drop order affected for closure because of `capture_disjoint_fields` - //~| HELP:` let _ = (&t, &t1, &t2)` causes `t`, `t1`, `t2` to be fully captured + //~| HELP: add a dummy let to cause `t`, `t1`, `t2` to be fully captured let _t = t.0; let _t1 = t1.0; @@ -33,7 +33,7 @@ fn test2_only_precise_paths_need_migration() { let c = || { //~^ ERROR: drop order affected for closure because of `capture_disjoint_fields` - //~| HELP:` let _ = (&t, &t1)` causes `t`, `t1` to be fully captured + //~| HELP: add a dummy let to cause `t`, `t1` to be fully captured let _t = t.0; let _t1 = t1.0; let _t2 = t2; @@ -49,7 +49,7 @@ fn test3_only_by_value_need_migration() { let t1 = (String::new(), String::new()); let c = || { //~^ ERROR: drop order affected for closure because of `capture_disjoint_fields` - //~| HELP: `let _ = &t` causes `t` to be fully captured + //~| HELP: add a dummy let to cause `t` to be fully captured let _t = t.0; println!("{}", t1.1); }; @@ -67,7 +67,7 @@ fn test4_only_non_copy_types_need_migration() { let c = || { //~^ ERROR: drop order affected for closure because of `capture_disjoint_fields` - //~| HELP: `let _ = &t` causes `t` to be fully captured + //~| HELP: add a dummy let to cause `t` to be fully captured let _t = t.0; let _t1 = t1.0; }; @@ -85,7 +85,7 @@ fn test5_only_drop_types_need_migration() { let c = || { //~^ ERROR: drop order affected for closure because of `capture_disjoint_fields` - //~| HELP: `let _ = &t` causes `t` to be fully captured + //~| HELP: add a dummy let to cause `t` to be fully captured let _t = t.0; let _s = s.0; }; @@ -100,7 +100,7 @@ fn test6_move_closures_non_copy_types_might_need_migration() { let t1 = (String::new(), String::new()); let c = move || { //~^ ERROR: drop order affected for closure because of `capture_disjoint_fields` - //~| HELP: `let _ = (&t1, &t)` causes `t1`, `t` to be fully captured + //~| HELP: add a dummy let to cause `t1`, `t` to be fully captured println!("{} {}", t1.1, t.1); }; @@ -115,7 +115,7 @@ fn test7_drop_non_drop_aggregate_need_migration() { let c = || { //~^ ERROR: drop order affected for closure because of `capture_disjoint_fields` - //~| HELP: `let _ = &t` causes `t` to be fully captured + //~| HELP: add a dummy let to cause `t` to be fully captured let _t = t.0; }; diff --git a/src/test/ui/closures/2229_closure_analysis/migrations/insignificant_drop.stderr b/src/test/ui/closures/2229_closure_analysis/migrations/insignificant_drop.stderr index 253a906a0ec46..69c12d2bb56c0 100644 --- a/src/test/ui/closures/2229_closure_analysis/migrations/insignificant_drop.stderr +++ b/src/test/ui/closures/2229_closure_analysis/migrations/insignificant_drop.stderr @@ -16,7 +16,7 @@ note: the lint level is defined here | LL | #![deny(disjoint_capture_drop_reorder)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -help: `let _ = (&t, &t1, &t2)` causes `t`, `t1`, `t2` to be fully captured +help: add a dummy let to cause `t`, `t1`, `t2` to be fully captured | LL | let c = || { let _ = (&t, &t1, &t2); LL | @@ -39,7 +39,7 @@ LL | | let _t2 = t2; LL | | }; | |_____^ | -help: `let _ = (&t, &t1)` causes `t`, `t1` to be fully captured +help: add a dummy let to cause `t`, `t1` to be fully captured | LL | let c = || { let _ = (&t, &t1); LL | @@ -61,7 +61,7 @@ LL | | println!("{}", t1.1); LL | | }; | |_____^ | -help: `let _ = &t` causes `t` to be fully captured +help: add a dummy let to cause `t` to be fully captured | LL | let c = || { let _ = &t; LL | @@ -83,7 +83,7 @@ LL | | let _t1 = t1.0; LL | | }; | |_____^ | -help: `let _ = &t` causes `t` to be fully captured +help: add a dummy let to cause `t` to be fully captured | LL | let c = || { let _ = &t; LL | @@ -105,7 +105,7 @@ LL | | let _s = s.0; LL | | }; | |_____^ | -help: `let _ = &t` causes `t` to be fully captured +help: add a dummy let to cause `t` to be fully captured | LL | let c = || { let _ = &t; LL | @@ -126,7 +126,7 @@ LL | | println!("{} {}", t1.1, t.1); LL | | }; | |_____^ | -help: `let _ = (&t1, &t)` causes `t1`, `t` to be fully captured +help: add a dummy let to cause `t1`, `t` to be fully captured | LL | let c = move || { let _ = (&t1, &t); LL | @@ -146,7 +146,7 @@ LL | | let _t = t.0; LL | | }; | |_____^ | -help: `let _ = &t` causes `t` to be fully captured +help: add a dummy let to cause `t` to be fully captured | LL | let c = || { let _ = &t; LL | diff --git a/src/test/ui/closures/2229_closure_analysis/migrations/migrations_rustfix.fixed b/src/test/ui/closures/2229_closure_analysis/migrations/migrations_rustfix.fixed index f17fab8e81f6d..a3e51a2b8e91a 100644 --- a/src/test/ui/closures/2229_closure_analysis/migrations/migrations_rustfix.fixed +++ b/src/test/ui/closures/2229_closure_analysis/migrations/migrations_rustfix.fixed @@ -18,7 +18,7 @@ fn closure_contains_block() { let t = (Foo(0), Foo(0)); let c = || { let _ = &t; //~^ ERROR: drop order affected for closure because of `capture_disjoint_fields` - //~| HELP: `let _ = &t` causes `t` to be fully captured + //~| HELP: add a dummy let to cause `t` to be fully captured let _t = t.0; }; @@ -29,7 +29,7 @@ fn closure_doesnt_contain_block() { let t = (Foo(0), Foo(0)); let c = || { let _ = &t; t.0 }; //~^ ERROR: drop order affected for closure because of `capture_disjoint_fields` - //~| HELP: `let _ = &t` causes `t` to be fully captured + //~| HELP: add a dummy let to cause `t` to be fully captured c(); } diff --git a/src/test/ui/closures/2229_closure_analysis/migrations/migrations_rustfix.rs b/src/test/ui/closures/2229_closure_analysis/migrations/migrations_rustfix.rs index 33aff10c520ac..0eb837b688835 100644 --- a/src/test/ui/closures/2229_closure_analysis/migrations/migrations_rustfix.rs +++ b/src/test/ui/closures/2229_closure_analysis/migrations/migrations_rustfix.rs @@ -18,7 +18,7 @@ fn closure_contains_block() { let t = (Foo(0), Foo(0)); let c = || { //~^ ERROR: drop order affected for closure because of `capture_disjoint_fields` - //~| HELP: `let _ = &t` causes `t` to be fully captured + //~| HELP: add a dummy let to cause `t` to be fully captured let _t = t.0; }; @@ -29,7 +29,7 @@ fn closure_doesnt_contain_block() { let t = (Foo(0), Foo(0)); let c = || t.0; //~^ ERROR: drop order affected for closure because of `capture_disjoint_fields` - //~| HELP: `let _ = &t` causes `t` to be fully captured + //~| HELP: add a dummy let to cause `t` to be fully captured c(); } diff --git a/src/test/ui/closures/2229_closure_analysis/migrations/migrations_rustfix.stderr b/src/test/ui/closures/2229_closure_analysis/migrations/migrations_rustfix.stderr index 611fbc4fff347..e6173217edc2f 100644 --- a/src/test/ui/closures/2229_closure_analysis/migrations/migrations_rustfix.stderr +++ b/src/test/ui/closures/2229_closure_analysis/migrations/migrations_rustfix.stderr @@ -14,7 +14,7 @@ note: the lint level is defined here | LL | #![deny(disjoint_capture_drop_reorder)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -help: `let _ = &t` causes `t` to be fully captured +help: add a dummy let to cause `t` to be fully captured | LL | let c = || { let _ = &t; LL | @@ -29,7 +29,7 @@ error: drop order affected for closure because of `capture_disjoint_fields` LL | let c = || t.0; | ^^^^^^ | -help: `let _ = &t` causes `t` to be fully captured +help: add a dummy let to cause `t` to be fully captured | LL | let c = || { let _ = &t; t.0 }; | ^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/closures/2229_closure_analysis/migrations/precise.fixed b/src/test/ui/closures/2229_closure_analysis/migrations/precise.fixed index 06932c1ae64ad..b739035c78422 100644 --- a/src/test/ui/closures/2229_closure_analysis/migrations/precise.fixed +++ b/src/test/ui/closures/2229_closure_analysis/migrations/precise.fixed @@ -18,7 +18,7 @@ fn test_precise_analysis_drop_paths_not_captured_by_move() { let c = || { let _ = &t; //~^ ERROR: drop order affected for closure because of `capture_disjoint_fields` - //~| HELP: `let _ = &t` causes `t` to be fully captured + //~| HELP: add a dummy let to cause `t` to be fully captured let _t = t.0; let _t = &t.1; }; @@ -41,7 +41,7 @@ fn test_precise_analysis_long_path_missing() { let c = || { let _ = &u; //~^ ERROR: drop order affected for closure because of `capture_disjoint_fields` - //~| HELP: `let _ = &u` causes `u` to be fully captured + //~| HELP: add a dummy let to cause `u` to be fully captured let _x = u.0.0; let _x = u.0.1; let _x = u.1.0; diff --git a/src/test/ui/closures/2229_closure_analysis/migrations/precise.rs b/src/test/ui/closures/2229_closure_analysis/migrations/precise.rs index 3661c2ca7ed17..e1f29c9d0e9d8 100644 --- a/src/test/ui/closures/2229_closure_analysis/migrations/precise.rs +++ b/src/test/ui/closures/2229_closure_analysis/migrations/precise.rs @@ -18,7 +18,7 @@ fn test_precise_analysis_drop_paths_not_captured_by_move() { let c = || { //~^ ERROR: drop order affected for closure because of `capture_disjoint_fields` - //~| HELP: `let _ = &t` causes `t` to be fully captured + //~| HELP: add a dummy let to cause `t` to be fully captured let _t = t.0; let _t = &t.1; }; @@ -41,7 +41,7 @@ fn test_precise_analysis_long_path_missing() { let c = || { //~^ ERROR: drop order affected for closure because of `capture_disjoint_fields` - //~| HELP: `let _ = &u` causes `u` to be fully captured + //~| HELP: add a dummy let to cause `u` to be fully captured let _x = u.0.0; let _x = u.0.1; let _x = u.1.0; diff --git a/src/test/ui/closures/2229_closure_analysis/migrations/precise.stderr b/src/test/ui/closures/2229_closure_analysis/migrations/precise.stderr index fcfd08d61e0e4..7135ded13c256 100644 --- a/src/test/ui/closures/2229_closure_analysis/migrations/precise.stderr +++ b/src/test/ui/closures/2229_closure_analysis/migrations/precise.stderr @@ -15,7 +15,7 @@ note: the lint level is defined here | LL | #![deny(disjoint_capture_drop_reorder)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -help: `let _ = &t` causes `t` to be fully captured +help: add a dummy let to cause `t` to be fully captured | LL | let c = || { let _ = &t; LL | @@ -38,7 +38,7 @@ LL | | let _x = u.1.0; LL | | }; | |_____^ | -help: `let _ = &u` causes `u` to be fully captured +help: add a dummy let to cause `u` to be fully captured | LL | let c = || { let _ = &u; LL | diff --git a/src/test/ui/closures/2229_closure_analysis/migrations/significant_drop.fixed b/src/test/ui/closures/2229_closure_analysis/migrations/significant_drop.fixed index b44624be5f991..e1b212153f431 100644 --- a/src/test/ui/closures/2229_closure_analysis/migrations/significant_drop.fixed +++ b/src/test/ui/closures/2229_closure_analysis/migrations/significant_drop.fixed @@ -24,7 +24,7 @@ fn test1_all_need_migration() { let c = || { let _ = (&t, &t1, &t2); //~^ ERROR: drop order affected for closure because of `capture_disjoint_fields` - //~| HELP:` let _ = (&t, &t1, &t2)` causes `t`, `t1`, `t2` to be fully captured + //~| HELP: add a dummy let to cause `t`, `t1`, `t2` to be fully captured let _t = t.0; let _t1 = t1.0; let _t2 = t2.0; @@ -42,7 +42,7 @@ fn test2_only_precise_paths_need_migration() { let c = || { let _ = (&t, &t1); //~^ ERROR: drop order affected for closure because of `capture_disjoint_fields` - //~| HELP:` let _ = (&t, &t1)` causes `t`, `t1` to be fully captured + //~| HELP: add a dummy let to cause `t`, `t1` to be fully captured let _t = t.0; let _t1 = t1.0; let _t2 = t2; @@ -58,7 +58,7 @@ fn test3_only_by_value_need_migration() { let t1 = (Foo(0), Foo(0)); let c = || { let _ = &t; //~^ ERROR: drop order affected for closure because of `capture_disjoint_fields` - //~| HELP: `let _ = &t` causes `t` to be fully captured + //~| HELP: add a dummy let to cause `t` to be fully captured let _t = t.0; println!("{:?}", t1.1); }; @@ -75,7 +75,7 @@ fn test4_type_contains_drop_need_migration() { let c = || { let _ = &t; //~^ ERROR: drop order affected for closure because of `capture_disjoint_fields` - //~| HELP: `let _ = &t` causes `t` to be fully captured + //~| HELP: add a dummy let to cause `t` to be fully captured let _t = t.0; }; @@ -90,7 +90,7 @@ fn test5_drop_non_drop_aggregate_need_migration() { let c = || { let _ = &t; //~^ ERROR: drop order affected for closure because of `capture_disjoint_fields` - //~| HELP: `let _ = &t` causes `t` to be fully captured + //~| HELP: add a dummy let to cause `t` to be fully captured let _t = t.0; }; @@ -103,7 +103,7 @@ fn test6_significant_insignificant_drop_aggregate_need_migration() { let c = || { let _ = &t; //~^ ERROR: drop order affected for closure because of `capture_disjoint_fields` - //~| HELP: `let _ = &t` causes `t` to be fully captured + //~| HELP: add a dummy let to cause `t` to be fully captured let _t = t.1; }; @@ -118,7 +118,7 @@ fn test7_move_closures_non_copy_types_might_need_migration() { let c = move || { let _ = (&t1, &t); //~^ ERROR: drop order affected for closure because of `capture_disjoint_fields` - //~| HELP: `let _ = (&t1, &t)` causes `t1`, `t` to be fully captured + //~| HELP: add a dummy let to cause `t1`, `t` to be fully captured println!("{:?} {:?}", t1.1, t.1); }; diff --git a/src/test/ui/closures/2229_closure_analysis/migrations/significant_drop.rs b/src/test/ui/closures/2229_closure_analysis/migrations/significant_drop.rs index 5cb2f611bc1e5..106b293351515 100644 --- a/src/test/ui/closures/2229_closure_analysis/migrations/significant_drop.rs +++ b/src/test/ui/closures/2229_closure_analysis/migrations/significant_drop.rs @@ -24,7 +24,7 @@ fn test1_all_need_migration() { let c = || { //~^ ERROR: drop order affected for closure because of `capture_disjoint_fields` - //~| HELP:` let _ = (&t, &t1, &t2)` causes `t`, `t1`, `t2` to be fully captured + //~| HELP: add a dummy let to cause `t`, `t1`, `t2` to be fully captured let _t = t.0; let _t1 = t1.0; let _t2 = t2.0; @@ -42,7 +42,7 @@ fn test2_only_precise_paths_need_migration() { let c = || { //~^ ERROR: drop order affected for closure because of `capture_disjoint_fields` - //~| HELP:` let _ = (&t, &t1)` causes `t`, `t1` to be fully captured + //~| HELP: add a dummy let to cause `t`, `t1` to be fully captured let _t = t.0; let _t1 = t1.0; let _t2 = t2; @@ -58,7 +58,7 @@ fn test3_only_by_value_need_migration() { let t1 = (Foo(0), Foo(0)); let c = || { //~^ ERROR: drop order affected for closure because of `capture_disjoint_fields` - //~| HELP: `let _ = &t` causes `t` to be fully captured + //~| HELP: add a dummy let to cause `t` to be fully captured let _t = t.0; println!("{:?}", t1.1); }; @@ -75,7 +75,7 @@ fn test4_type_contains_drop_need_migration() { let c = || { //~^ ERROR: drop order affected for closure because of `capture_disjoint_fields` - //~| HELP: `let _ = &t` causes `t` to be fully captured + //~| HELP: add a dummy let to cause `t` to be fully captured let _t = t.0; }; @@ -90,7 +90,7 @@ fn test5_drop_non_drop_aggregate_need_migration() { let c = || { //~^ ERROR: drop order affected for closure because of `capture_disjoint_fields` - //~| HELP: `let _ = &t` causes `t` to be fully captured + //~| HELP: add a dummy let to cause `t` to be fully captured let _t = t.0; }; @@ -103,7 +103,7 @@ fn test6_significant_insignificant_drop_aggregate_need_migration() { let c = || { //~^ ERROR: drop order affected for closure because of `capture_disjoint_fields` - //~| HELP: `let _ = &t` causes `t` to be fully captured + //~| HELP: add a dummy let to cause `t` to be fully captured let _t = t.1; }; @@ -118,7 +118,7 @@ fn test7_move_closures_non_copy_types_might_need_migration() { let c = move || { //~^ ERROR: drop order affected for closure because of `capture_disjoint_fields` - //~| HELP: `let _ = (&t1, &t)` causes `t1`, `t` to be fully captured + //~| HELP: add a dummy let to cause `t1`, `t` to be fully captured println!("{:?} {:?}", t1.1, t.1); }; diff --git a/src/test/ui/closures/2229_closure_analysis/migrations/significant_drop.stderr b/src/test/ui/closures/2229_closure_analysis/migrations/significant_drop.stderr index 2ca2baa9cbc07..ee29fe1306059 100644 --- a/src/test/ui/closures/2229_closure_analysis/migrations/significant_drop.stderr +++ b/src/test/ui/closures/2229_closure_analysis/migrations/significant_drop.stderr @@ -16,7 +16,7 @@ note: the lint level is defined here | LL | #![deny(disjoint_capture_drop_reorder)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -help: `let _ = (&t, &t1, &t2)` causes `t`, `t1`, `t2` to be fully captured +help: add a dummy let to cause `t`, `t1`, `t2` to be fully captured | LL | let c = || { let _ = (&t, &t1, &t2); LL | @@ -39,7 +39,7 @@ LL | | let _t2 = t2; LL | | }; | |_____^ | -help: `let _ = (&t, &t1)` causes `t`, `t1` to be fully captured +help: add a dummy let to cause `t`, `t1` to be fully captured | LL | let c = || { let _ = (&t, &t1); LL | @@ -61,7 +61,7 @@ LL | | println!("{:?}", t1.1); LL | | }; | |_____^ | -help: `let _ = &t` causes `t` to be fully captured +help: add a dummy let to cause `t` to be fully captured | LL | let c = || { let _ = &t; LL | @@ -82,7 +82,7 @@ LL | | let _t = t.0; LL | | }; | |_____^ | -help: `let _ = &t` causes `t` to be fully captured +help: add a dummy let to cause `t` to be fully captured | LL | let c = || { let _ = &t; LL | @@ -102,7 +102,7 @@ LL | | let _t = t.0; LL | | }; | |_____^ | -help: `let _ = &t` causes `t` to be fully captured +help: add a dummy let to cause `t` to be fully captured | LL | let c = || { let _ = &t; LL | @@ -122,7 +122,7 @@ LL | | let _t = t.1; LL | | }; | |_____^ | -help: `let _ = &t` causes `t` to be fully captured +help: add a dummy let to cause `t` to be fully captured | LL | let c = || { let _ = &t; LL | @@ -142,7 +142,7 @@ LL | | println!("{:?} {:?}", t1.1, t.1); LL | | }; | |_____^ | -help: `let _ = (&t1, &t)` causes `t1`, `t` to be fully captured +help: add a dummy let to cause `t1`, `t` to be fully captured | LL | let c = move || { let _ = (&t1, &t); LL | From ca14abbab1821d20d4d326af2acec916ccc0806e Mon Sep 17 00:00:00 2001 From: Alan Somers Date: Sat, 27 Mar 2021 11:12:38 -0600 Subject: [PATCH 18/21] Fix stack overflow detection on FreeBSD 11.1+ Beginning with FreeBSD 10.4 and 11.1, there is one guard page by default. And the stack autoresizes, so if Rust allocates its own guard page, then FreeBSD's will simply move up one page. The best solution is to just use the OS's guard page. --- library/std/src/sys/unix/thread.rs | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/library/std/src/sys/unix/thread.rs b/library/std/src/sys/unix/thread.rs index 01a12dcf5a2af..b8f43caec32a3 100644 --- a/library/std/src/sys/unix/thread.rs +++ b/library/std/src/sys/unix/thread.rs @@ -343,6 +343,20 @@ pub mod guard { // it can eventually grow to. It cannot be used to determine // the position of kernel's stack guard. None + } else if cfg!(target_os = "freebsd") { + // FreeBSD's stack autogrows, and optionally includes a guard page + // at the bottom. If we try to remap the bottom of the stack + // ourselves, FreeBSD's guard page moves upwards. So we'll just use + // the builtin guard page. + let stackaddr = get_stack_start_aligned()?; + let guardaddr = stackaddr as usize; + // Technically the number of guard pages is tunable and controlled + // by the security.bsd.stack_guard_page sysctl, but there are + // few reasons to change it from the default. The default value has + // been 1 ever since FreeBSD 11.1 and 10.4. + const GUARD_PAGES: usize = 1; + let guard = guardaddr..guardaddr + GUARD_PAGES * page_size; + Some(guard) } else { // Reallocate the last page of the stack. // This ensures SIGBUS will be raised on @@ -371,9 +385,8 @@ pub mod guard { } let guardaddr = stackaddr as usize; - let offset = if cfg!(target_os = "freebsd") { 2 } else { 1 }; - Some(guardaddr..guardaddr + offset * page_size) + Some(guardaddr..guardaddr + page_size) } } @@ -417,11 +430,7 @@ pub mod guard { assert_eq!(libc::pthread_attr_getstack(&attr, &mut stackaddr, &mut size), 0); let stackaddr = stackaddr as usize; - ret = if cfg!(target_os = "freebsd") { - // FIXME does freebsd really fault *below* the guard addr? - let guardaddr = stackaddr - guardsize; - Some(guardaddr - PAGE_SIZE.load(Ordering::Relaxed)..guardaddr) - } else if cfg!(target_os = "netbsd") { + ret = if cfg!(any(target_os = "freebsd", target_os = "netbsd")) { Some(stackaddr - guardsize..stackaddr) } else if cfg!(all(target_os = "linux", target_env = "musl")) { Some(stackaddr - guardsize..stackaddr) From fad53880394f0cb4a8e2367fcc218c1fa55539d6 Mon Sep 17 00:00:00 2001 From: Rich Kadel Date: Thu, 1 Apr 2021 12:25:45 -0700 Subject: [PATCH 19/21] Simplify coverage tests This change reduces the risk of impacting coverage tests on unrelated changes (such as MIR and Span changes), and reduces the burden when blessing coverage changes in case it is necessary. * Remove all spanview tests. The spanview tests were useful during development, but they can be generated as needed, via compiler command line flags. They aren't critical to confirming coverage results. (The coverage report tests are sufficient.) When spanview regeneration was necessary, the diffs were way too hard to read to be useful anyway. So I'm removing them to reduce friction from a feature that is no longer useful. * Remove the requirement for `llvm-cov show --debug` when blessing tests. The `--debug` flag is, unfortunately, only available if LLVM is built with `optimize = false` (in Rust's config.toml). This adds significant time and resource burdens to the contributor's build. As it turns out, for other reasons in the past, I wasn't actually using the debug output (counter info) to validate coverage anymore either, so it was required for no reason, I now realize. --- .../coverage-reports/Makefile | 80 - .../coverage-spanview/Makefile | 92 - .../coverage-spanview/escape_url.py | 12 - ...ort.main.-------.InstrumentCoverage.0.html | 106 - ...ht_abort.-------.InstrumentCoverage.0.html | 163 - ...ert.main.-------.InstrumentCoverage.0.html | 102 - ...l_assert.-------.InstrumentCoverage.0.html | 97 - ...osure#0}.-------.InstrumentCoverage.0.html | 82 - .../async.c.-------.InstrumentCoverage.0.html | 80 - ...osure#0}.-------.InstrumentCoverage.0.html | 75 - .../async.d.-------.InstrumentCoverage.0.html | 74 - ...osure#0}.-------.InstrumentCoverage.0.html | 75 - .../async.e.-------.InstrumentCoverage.0.html | 74 - ...osure#0}.-------.InstrumentCoverage.0.html | 84 - ...osure#1}.-------.InstrumentCoverage.0.html | 84 - ...osure#2}.-------.InstrumentCoverage.0.html | 84 - ...osure#3}.-------.InstrumentCoverage.0.html | 75 - ...block_on.-------.InstrumentCoverage.0.html | 239 - ...osure#0}.-------.InstrumentCoverage.0.html | 75 - .../async.f.-------.InstrumentCoverage.0.html | 74 - ...osure#0}.-------.InstrumentCoverage.0.html | 75 - ...sync.foo.-------.InstrumentCoverage.0.html | 74 - ...osure#0}.-------.InstrumentCoverage.0.html | 82 - .../async.g.-------.InstrumentCoverage.0.html | 80 - ...osure#0}.-------.InstrumentCoverage.0.html | 82 - .../async.h.-------.InstrumentCoverage.0.html | 81 - ...osure#0}.-------.InstrumentCoverage.0.html | 89 - .../async.i.-------.InstrumentCoverage.0.html | 83 - ...sync.j-c.-------.InstrumentCoverage.0.html | 90 - ...sync.j-d.-------.InstrumentCoverage.0.html | 75 - ...sync.j-f.-------.InstrumentCoverage.0.html | 75 - .../async.j.-------.InstrumentCoverage.0.html | 106 - .../async.k.-------.InstrumentCoverage.0.html | 80 - .../async.l.-------.InstrumentCoverage.0.html | 80 - ...osure#0}.-------.InstrumentCoverage.0.html | 78 - .../async.m.-------.InstrumentCoverage.0.html | 74 - ...ync.main.-------.InstrumentCoverage.0.html | 190 - ...osure#0}.-------.InstrumentCoverage.0.html | 96 - ...sure#10}.-------.InstrumentCoverage.0.html | 96 - ...sure#11}.-------.InstrumentCoverage.0.html | 96 - ...osure#1}.-------.InstrumentCoverage.0.html | 96 - ...osure#2}.-------.InstrumentCoverage.0.html | 128 - ...osure#3}.-------.InstrumentCoverage.0.html | 91 - ...osure#4}.-------.InstrumentCoverage.0.html | 76 - ...osure#5}.-------.InstrumentCoverage.0.html | 115 - ...osure#6}.-------.InstrumentCoverage.0.html | 87 - ...osure#7}.-------.InstrumentCoverage.0.html | 115 - ...osure#8}.-------.InstrumentCoverage.0.html | 89 - ...osure#9}.-------.InstrumentCoverage.0.html | 89 - ...ure.main.-------.InstrumentCoverage.0.html | 10921 ---------------- ...ons.main.-------.InstrumentCoverage.0.html | 307 - ...ode.main.-------.InstrumentCoverage.0.html | 143 - ...nused_fn.-------.InstrumentCoverage.0.html | 143 - ..._library.-------.InstrumentCoverage.0.html | 143 - ...est.main.-------.InstrumentCoverage.0.html | 96 - ...doctests.-------.InstrumentCoverage.0.html | 113 - ...ait.main.-------.InstrumentCoverage.0.html | 152 - ...#0}-drop.-------.InstrumentCoverage.0.html | 133 - ...ics.main.-------.InstrumentCoverage.0.html | 237 - ...strength.-------.InstrumentCoverage.0.html | 85 - ...#1}-drop.-------.InstrumentCoverage.0.html | 133 - .../if.main.-------.InstrumentCoverage.0.html | 238 - ...lse.main.-------.InstrumentCoverage.0.html | 195 - ....display.-------.InstrumentCoverage.0.html | 161 - ...ne.error.-------.InstrumentCoverage.0.html | 79 - ...e.length.-------.InstrumentCoverage.0.html | 82 - ...ine.main.-------.InstrumentCoverage.0.html | 94 - ...ermutate.-------.InstrumentCoverage.0.html | 183 - ...utations.-------.InstrumentCoverage.0.html | 113 - ...ine.swap.-------.InstrumentCoverage.0.html | 173 - ...ait_func.-------.InstrumentCoverage.0.html | 93 - ...-in_func.-------.InstrumentCoverage.0.html | 203 - ...ait_func.-------.InstrumentCoverage.0.html | 101 - ...ems.main.-------.InstrumentCoverage.0.html | 189 - ...ean.main.-------.InstrumentCoverage.0.html | 259 - ...lue.main.-------.InstrumentCoverage.0.html | 128 - ...hes.main.-------.InstrumentCoverage.0.html | 161 - ...l#0}-fmt.-------.InstrumentCoverage.0.html | 100 - ...ern.main.-------.InstrumentCoverage.0.html | 259 - ...ops.main.-------.InstrumentCoverage.0.html | 166 - ...low.main.-------.InstrumentCoverage.0.html | 258 - ...overflow.-------.InstrumentCoverage.0.html | 394 - ...ind.main.-------.InstrumentCoverage.0.html | 102 - ...ht_panic.-------.InstrumentCoverage.0.html | 163 - ..._eq.main.-------.InstrumentCoverage.0.html | 295 - ...l#0}-new.-------.InstrumentCoverage.0.html | 108 - ...l#1}-cmp.-------.InstrumentCoverage.0.html | 74 - ...tial_cmp.-------.InstrumentCoverage.0.html | 74 - ...total_eq.-------.InstrumentCoverage.0.html | 75 - ...pl#6}-eq.-------.InstrumentCoverage.0.html | 74 - ...pl#6}-ne.-------.InstrumentCoverage.0.html | 74 - ...l#7}-fmt.-------.InstrumentCoverage.0.html | 110 - ...8}-clone.-------.InstrumentCoverage.0.html | 88 - ...oop.main.-------.InstrumentCoverage.0.html | 193 - ...tch.main.-------.InstrumentCoverage.0.html | 222 - ...oop.main.-------.InstrumentCoverage.0.html | 81 - ...ult.call.-------.InstrumentCoverage.0.html | 82 - ...ult.main.-------.InstrumentCoverage.0.html | 129 - ...used.foo.-------.InstrumentCoverage.0.html | 87 - ...sed.main.-------.InstrumentCoverage.0.html | 98 - ...sed_func.-------.InstrumentCoverage.0.html | 86 - ...ed_func2.-------.InstrumentCoverage.0.html | 86 - ...ed_func3.-------.InstrumentCoverage.0.html | 86 - ...ate_func.-------.InstrumentCoverage.0.html | 87 - ...function.-------.InstrumentCoverage.0.html | 115 - ...function.-------.InstrumentCoverage.0.html | 133 - ...function.-------.InstrumentCoverage.0.html | 115 - ...ib_crate.-------.InstrumentCoverage.0.html | 190 - ...function.-------.InstrumentCoverage.0.html | 133 - ...function.-------.InstrumentCoverage.0.html | 110 - ...function.-------.InstrumentCoverage.0.html | 133 - ...function.-------.InstrumentCoverage.0.html | 133 - ...function.-------.InstrumentCoverage.0.html | 133 - ...function.-------.InstrumentCoverage.0.html | 115 - ...function.-------.InstrumentCoverage.0.html | 133 - ...function.-------.InstrumentCoverage.0.html | 115 - ...ib_crate.-------.InstrumentCoverage.0.html | 190 - ...function.-------.InstrumentCoverage.0.html | 133 - ...function.-------.InstrumentCoverage.0.html | 110 - ...function.-------.InstrumentCoverage.0.html | 110 - ...function.-------.InstrumentCoverage.0.html | 133 - ...function.-------.InstrumentCoverage.0.html | 133 - ...function.-------.InstrumentCoverage.0.html | 133 - ...ate.main.-------.InstrumentCoverage.0.html | 193 - ...ate.main.-------.InstrumentCoverage.0.html | 249 - ...ile.main.-------.InstrumentCoverage.0.html | 82 - ...ret.main.-------.InstrumentCoverage.0.html | 130 - ...osure#0}.-------.InstrumentCoverage.0.html | 79 - ...osure#1}.-------.InstrumentCoverage.0.html | 81 - ...eld.main.-------.InstrumentCoverage.0.html | 138 - .../coverage/coverage_tools.mk | 8 - 131 files changed, 26664 deletions(-) delete mode 100644 src/test/run-make-fulldeps/coverage-spanview/Makefile delete mode 100644 src/test/run-make-fulldeps/coverage-spanview/escape_url.py delete mode 100644 src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.abort/abort.main.-------.InstrumentCoverage.0.html delete mode 100644 src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.abort/abort.might_abort.-------.InstrumentCoverage.0.html delete mode 100644 src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.assert/assert.main.-------.InstrumentCoverage.0.html delete mode 100644 src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.assert/assert.might_fail_assert.-------.InstrumentCoverage.0.html delete mode 100644 src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.c-{closure#0}.-------.InstrumentCoverage.0.html delete mode 100644 src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.c.-------.InstrumentCoverage.0.html delete mode 100644 src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.d-{closure#0}.-------.InstrumentCoverage.0.html delete mode 100644 src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.d.-------.InstrumentCoverage.0.html delete mode 100644 src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.e-{closure#0}.-------.InstrumentCoverage.0.html delete mode 100644 src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.e.-------.InstrumentCoverage.0.html delete mode 100644 src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.executor-block_on-VTABLE-{closure#0}.-------.InstrumentCoverage.0.html delete mode 100644 src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.executor-block_on-VTABLE-{closure#1}.-------.InstrumentCoverage.0.html delete mode 100644 src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.executor-block_on-VTABLE-{closure#2}.-------.InstrumentCoverage.0.html delete mode 100644 src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.executor-block_on-VTABLE-{closure#3}.-------.InstrumentCoverage.0.html delete mode 100644 src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.executor-block_on.-------.InstrumentCoverage.0.html delete mode 100644 src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.f-{closure#0}.-------.InstrumentCoverage.0.html delete mode 100644 src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.f.-------.InstrumentCoverage.0.html delete mode 100644 src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.foo-{closure#0}.-------.InstrumentCoverage.0.html delete mode 100644 src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.foo.-------.InstrumentCoverage.0.html delete mode 100644 src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.g-{closure#0}.-------.InstrumentCoverage.0.html delete mode 100644 src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.g.-------.InstrumentCoverage.0.html delete mode 100644 src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.h-{closure#0}.-------.InstrumentCoverage.0.html delete mode 100644 src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.h.-------.InstrumentCoverage.0.html delete mode 100644 src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.i-{closure#0}.-------.InstrumentCoverage.0.html delete mode 100644 src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.i.-------.InstrumentCoverage.0.html delete mode 100644 src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.j-c.-------.InstrumentCoverage.0.html delete mode 100644 src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.j-d.-------.InstrumentCoverage.0.html delete mode 100644 src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.j-f.-------.InstrumentCoverage.0.html delete mode 100644 src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.j.-------.InstrumentCoverage.0.html delete mode 100644 src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.k.-------.InstrumentCoverage.0.html delete mode 100644 src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.l.-------.InstrumentCoverage.0.html delete mode 100644 src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.m-{closure#0}.-------.InstrumentCoverage.0.html delete mode 100644 src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.m.-------.InstrumentCoverage.0.html delete mode 100644 src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.main.-------.InstrumentCoverage.0.html delete mode 100644 src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.closure/closure.main-{closure#0}.-------.InstrumentCoverage.0.html delete mode 100644 src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.closure/closure.main-{closure#10}.-------.InstrumentCoverage.0.html delete mode 100644 src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.closure/closure.main-{closure#11}.-------.InstrumentCoverage.0.html delete mode 100644 src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.closure/closure.main-{closure#1}.-------.InstrumentCoverage.0.html delete mode 100644 src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.closure/closure.main-{closure#2}.-------.InstrumentCoverage.0.html delete mode 100644 src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.closure/closure.main-{closure#3}.-------.InstrumentCoverage.0.html delete mode 100644 src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.closure/closure.main-{closure#4}.-------.InstrumentCoverage.0.html delete mode 100644 src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.closure/closure.main-{closure#5}.-------.InstrumentCoverage.0.html delete mode 100644 src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.closure/closure.main-{closure#6}.-------.InstrumentCoverage.0.html delete mode 100644 src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.closure/closure.main-{closure#7}.-------.InstrumentCoverage.0.html delete mode 100644 src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.closure/closure.main-{closure#8}.-------.InstrumentCoverage.0.html delete mode 100644 src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.closure/closure.main-{closure#9}.-------.InstrumentCoverage.0.html delete mode 100644 src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.closure/closure.main.-------.InstrumentCoverage.0.html delete mode 100644 src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.conditions/conditions.main.-------.InstrumentCoverage.0.html delete mode 100644 src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.dead_code/dead_code.main.-------.InstrumentCoverage.0.html delete mode 100644 src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.dead_code/dead_code.unused_fn.-------.InstrumentCoverage.0.html delete mode 100644 src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.dead_code/dead_code.unused_pub_fn_not_in_library.-------.InstrumentCoverage.0.html delete mode 100644 src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.doctest/doctest.main.-------.InstrumentCoverage.0.html delete mode 100644 src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.doctest_crate/doctest_crate.fn_run_in_doctests.-------.InstrumentCoverage.0.html delete mode 100644 src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.drop_trait/drop_trait.main.-------.InstrumentCoverage.0.html delete mode 100644 src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.drop_trait/drop_trait.{impl#0}-drop.-------.InstrumentCoverage.0.html delete mode 100644 src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.generics/generics.main.-------.InstrumentCoverage.0.html delete mode 100644 src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.generics/generics.{impl#0}-set_strength.-------.InstrumentCoverage.0.html delete mode 100644 src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.generics/generics.{impl#1}-drop.-------.InstrumentCoverage.0.html delete mode 100644 src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.if/if.main.-------.InstrumentCoverage.0.html delete mode 100644 src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.if_else/if_else.main.-------.InstrumentCoverage.0.html delete mode 100644 src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.inline/inline.display.-------.InstrumentCoverage.0.html delete mode 100644 src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.inline/inline.error.-------.InstrumentCoverage.0.html delete mode 100644 src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.inline/inline.length.-------.InstrumentCoverage.0.html delete mode 100644 src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.inline/inline.main.-------.InstrumentCoverage.0.html delete mode 100644 src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.inline/inline.permutate.-------.InstrumentCoverage.0.html delete mode 100644 src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.inline/inline.permutations.-------.InstrumentCoverage.0.html delete mode 100644 src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.inline/inline.swap.-------.InstrumentCoverage.0.html delete mode 100644 src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.inner_items/inner_items.main-InTrait-default_trait_func.-------.InstrumentCoverage.0.html delete mode 100644 src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.inner_items/inner_items.main-in_func.-------.InstrumentCoverage.0.html delete mode 100644 src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.inner_items/inner_items.main-{impl#0}-trait_func.-------.InstrumentCoverage.0.html delete mode 100644 src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.inner_items/inner_items.main.-------.InstrumentCoverage.0.html delete mode 100644 src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.lazy_boolean/lazy_boolean.main.-------.InstrumentCoverage.0.html delete mode 100644 src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.loop_break_value/loop_break_value.main.-------.InstrumentCoverage.0.html delete mode 100644 src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.loops_branches/loops_branches.main.-------.InstrumentCoverage.0.html delete mode 100644 src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.loops_branches/loops_branches.{impl#0}-fmt.-------.InstrumentCoverage.0.html delete mode 100644 src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.match_or_pattern/match_or_pattern.main.-------.InstrumentCoverage.0.html delete mode 100644 src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.nested_loops/nested_loops.main.-------.InstrumentCoverage.0.html delete mode 100644 src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.overflow/overflow.main.-------.InstrumentCoverage.0.html delete mode 100644 src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.overflow/overflow.might_overflow.-------.InstrumentCoverage.0.html delete mode 100644 src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.panic_unwind/panic_unwind.main.-------.InstrumentCoverage.0.html delete mode 100644 src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.panic_unwind/panic_unwind.might_panic.-------.InstrumentCoverage.0.html delete mode 100644 src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.partial_eq/partial_eq.main.-------.InstrumentCoverage.0.html delete mode 100644 src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.partial_eq/partial_eq.{impl#0}-new.-------.InstrumentCoverage.0.html delete mode 100644 src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.partial_eq/partial_eq.{impl#1}-cmp.-------.InstrumentCoverage.0.html delete mode 100644 src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.partial_eq/partial_eq.{impl#2}-partial_cmp.-------.InstrumentCoverage.0.html delete mode 100644 src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.partial_eq/partial_eq.{impl#4}-assert_receiver_is_total_eq.-------.InstrumentCoverage.0.html delete mode 100644 src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.partial_eq/partial_eq.{impl#6}-eq.-------.InstrumentCoverage.0.html delete mode 100644 src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.partial_eq/partial_eq.{impl#6}-ne.-------.InstrumentCoverage.0.html delete mode 100644 src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.partial_eq/partial_eq.{impl#7}-fmt.-------.InstrumentCoverage.0.html delete mode 100644 src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.partial_eq/partial_eq.{impl#8}-clone.-------.InstrumentCoverage.0.html delete mode 100644 src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.simple_loop/simple_loop.main.-------.InstrumentCoverage.0.html delete mode 100644 src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.simple_match/simple_match.main.-------.InstrumentCoverage.0.html delete mode 100644 src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.tight_inf_loop/tight_inf_loop.main.-------.InstrumentCoverage.0.html delete mode 100644 src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.try_error_result/try_error_result.call.-------.InstrumentCoverage.0.html delete mode 100644 src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.try_error_result/try_error_result.main.-------.InstrumentCoverage.0.html delete mode 100644 src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.unused/unused.foo.-------.InstrumentCoverage.0.html delete mode 100644 src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.unused/unused.main.-------.InstrumentCoverage.0.html delete mode 100644 src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.unused/unused.unused_func.-------.InstrumentCoverage.0.html delete mode 100644 src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.unused/unused.unused_func2.-------.InstrumentCoverage.0.html delete mode 100644 src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.unused/unused.unused_func3.-------.InstrumentCoverage.0.html delete mode 100644 src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.unused/unused.unused_template_func.-------.InstrumentCoverage.0.html delete mode 100644 src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.used_crate/used_crate.unused_function.-------.InstrumentCoverage.0.html delete mode 100644 src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.used_crate/used_crate.unused_generic_function.-------.InstrumentCoverage.0.html delete mode 100644 src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.used_crate/used_crate.unused_private_function.-------.InstrumentCoverage.0.html delete mode 100644 src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.used_crate/used_crate.use_this_lib_crate.-------.InstrumentCoverage.0.html delete mode 100644 src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.used_crate/used_crate.used_from_bin_crate_and_lib_crate_generic_function.-------.InstrumentCoverage.0.html delete mode 100644 src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.used_crate/used_crate.used_function.-------.InstrumentCoverage.0.html delete mode 100644 src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.used_crate/used_crate.used_only_from_bin_crate_generic_function.-------.InstrumentCoverage.0.html delete mode 100644 src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.used_crate/used_crate.used_only_from_this_lib_crate_generic_function.-------.InstrumentCoverage.0.html delete mode 100644 src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.used_crate/used_crate.used_with_same_type_from_bin_crate_and_lib_crate_generic_function.-------.InstrumentCoverage.0.html delete mode 100644 src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.used_inline_crate/used_inline_crate.unused_function.-------.InstrumentCoverage.0.html delete mode 100644 src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.used_inline_crate/used_inline_crate.unused_generic_function.-------.InstrumentCoverage.0.html delete mode 100644 src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.used_inline_crate/used_inline_crate.unused_private_function.-------.InstrumentCoverage.0.html delete mode 100644 src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.used_inline_crate/used_inline_crate.use_this_lib_crate.-------.InstrumentCoverage.0.html delete mode 100644 src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.used_inline_crate/used_inline_crate.used_from_bin_crate_and_lib_crate_generic_function.-------.InstrumentCoverage.0.html delete mode 100644 src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.used_inline_crate/used_inline_crate.used_function.-------.InstrumentCoverage.0.html delete mode 100644 src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.used_inline_crate/used_inline_crate.used_inline_function.-------.InstrumentCoverage.0.html delete mode 100644 src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.used_inline_crate/used_inline_crate.used_only_from_bin_crate_generic_function.-------.InstrumentCoverage.0.html delete mode 100644 src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.used_inline_crate/used_inline_crate.used_only_from_this_lib_crate_generic_function.-------.InstrumentCoverage.0.html delete mode 100644 src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.used_inline_crate/used_inline_crate.used_with_same_type_from_bin_crate_and_lib_crate_generic_function.-------.InstrumentCoverage.0.html delete mode 100644 src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.uses_crate/uses_crate.main.-------.InstrumentCoverage.0.html delete mode 100644 src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.uses_inline_crate/uses_inline_crate.main.-------.InstrumentCoverage.0.html delete mode 100644 src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.while/while.main.-------.InstrumentCoverage.0.html delete mode 100644 src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.while_early_ret/while_early_ret.main.-------.InstrumentCoverage.0.html delete mode 100644 src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.yield/yield.main-{closure#0}.-------.InstrumentCoverage.0.html delete mode 100644 src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.yield/yield.main-{closure#1}.-------.InstrumentCoverage.0.html delete mode 100644 src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.yield/yield.main.-------.InstrumentCoverage.0.html diff --git a/src/test/run-make-fulldeps/coverage-reports/Makefile b/src/test/run-make-fulldeps/coverage-reports/Makefile index dd5e28b449cd4..d3d398f1fac29 100644 --- a/src/test/run-make-fulldeps/coverage-reports/Makefile +++ b/src/test/run-make-fulldeps/coverage-reports/Makefile @@ -61,13 +61,6 @@ endif LLVM_COV_IGNORE_FILES=\ --ignore-filename-regex='(uses_crate.rs|uses_inline_crate.rs)' -# When generating `expected_*` results (using `x.py test --bless`), the `--debug` flag is forced. -# If assertions are disabled, the command will fail with an error, rather than attempt to generate -# only partial results. -ifdef RUSTC_BLESS_TEST -DEBUG_FLAG=--debug -endif - all: $(patsubst $(SOURCEDIR)/lib/%.rs,%,$(wildcard $(SOURCEDIR)/lib/*.rs)) $(patsubst $(SOURCEDIR)/%.rs,%,$(wildcard $(SOURCEDIR)/*.rs)) # Ensure there are no `expected` results for tests that may have been removed or renamed @@ -177,76 +170,3 @@ else false \ ) endif - -#################################################################################################### - -# The following Makefile content was used to copy the generated `counters` files -# to `expected_` files (when `--bless`ed) and to compare them via `diff`; but for -# multiple reasons, these files cannot easily be used for test validation: -# -# * Output lines can be produced in non-deterministic order (depending on the -# target platform, and sometimes on unrelated codegen changes). -# * Some lines include demangled function names, making them more challenging -# to interpret and compare. -# -# The files are still generated (in `$(TMPDIR)`) to support developers wanting -# to inspect the counters, for debugging purposes. -# -# ifdef RUSTC_BLESS_TEST -# cp "$(TMPDIR)"/actual_show_coverage_counters.$@.txt \ -# expected_show_coverage_counters.$@.txt -# else -# -# ifdef DEBUG_FLAG -# $(DIFF) expected_show_coverage_counters.$@.txt "$(TMPDIR)"/actual_show_coverage_counters.$@.txt || \ -# ( grep -q '^\/\/ ignore-llvm-cov-show-diffs' $(SOURCEDIR)/$@.rs && \ -# >&2 echo 'diff failed, but suppressed with `// ignore-llvm-cov-show-diffs` in $(SOURCEDIR)/$@.rs' \ -# ) || \ -# ( >&2 echo 'diff failed, and not suppressed without `// ignore-llvm-cov-show-diffs` in $(SOURCEDIR)/$@.rs'; \ -# >&2 echo '(Ignore anyway until mangled function names in "counters" files are demangled.)' \ -# ) -# endif -# -# endif - -#################################################################################################### - -# The following Makefile content, and short JSON script, were used to generate -# coverage reports in JSON when the `llvm-cov show` reports were less reliable for -# testing. At the present time, however, the `llvm-cov show` results, and methods -# for comparing them, are working for all tests, making the JSON reports redundant. -# -# If this changes in the future, the scripts are left here, commented out, but can -# be resurrected if desired. This could be used to compare *only* the JSON files; -# and in that case, the `llvm-cov show` reports can be ignored by inserting -# `// ignore-llvm-cov-show-diffs` at the top of the source file. -# -# # Generate a coverage report in JSON, using `llvm-cov export`, and fail if -# # there are differences from the expected output. -# "$(LLVM_BIN_DIR)"/llvm-cov export \ -# $(LLVM_COV_IGNORE_FILES) \ -# --summary-only \ -# --instr-profile="$(TMPDIR)"/$@.profdata \ -# $(call BIN,"$(TMPDIR)"/$@) \ -# | "$(PYTHON)" $(BASEDIR)/prettify_json.py \ -# > "$(TMPDIR)"/actual_export_coverage.$@.json -# -# ifdef RUSTC_BLESS_TEST -# cp "$(TMPDIR)"/actual_export_coverage.$@.json expected_export_coverage.$@.json -# else -# # Check that exported JSON coverage data matches what we expect (`--bless` refreshes `expected`) -# $(DIFF) expected_export_coverage.$@.json "$(TMPDIR)"/actual_export_coverage.$@.json -# endif -# -# # # If generating coverage reports in JSON, this Makefile is accompanied by -# # # a Python script, `prettify_json.py`, which is defined: -# # -# # #!/usr/bin/env python -# # -# # import sys -# # import json -# # -# # # Try to decode line in order to ensure it is a valid JSON document -# # for line in sys.stdin: -# # parsed = json.loads(line) -# # print (json.dumps(parsed, indent=2, separators=(',', ': '), sort_keys=True)) diff --git a/src/test/run-make-fulldeps/coverage-spanview/Makefile b/src/test/run-make-fulldeps/coverage-spanview/Makefile deleted file mode 100644 index b3d1009dbd092..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview/Makefile +++ /dev/null @@ -1,92 +0,0 @@ -# needs-profiler-support -# min-llvm-version: 11.0 - --include ../coverage/coverage_tools.mk - -BASEDIR=../coverage-spanview -SOURCEDIR=../coverage - -define SPANVIEW_HEADER - - -endef -export SPANVIEW_HEADER - -all: $(patsubst $(SOURCEDIR)/lib/%.rs,%,$(wildcard $(SOURCEDIR)/lib/*.rs)) $(patsubst $(SOURCEDIR)/%.rs,%,$(wildcard $(SOURCEDIR)/*.rs)) - -# Ensure there are no `expected` results for tests that may have been removed or renamed -.PHONY: clear_expected_if_blessed -clear_expected_if_blessed: -ifdef RUSTC_BLESS_TEST - rm -rf expected_mir_dump.*/ -endif - --include clear_expected_if_blessed - -# FIXME(richkadel): The actions for these two types of targets (libraries and binaries) should be -# combined. - -%: $(SOURCEDIR)/lib/%.rs - # Compile the test library with coverage instrumentation - $(RUSTC) $(SOURCEDIR)/lib/$@.rs \ - $$( sed -n 's/^\/\/ compile-flags: \([^#]*\).*/\1/p' $(SOURCEDIR)/lib/$@.rs ) \ - --crate-type rlib \ - -Ztrim-diagnostic-paths=no \ - -Zdump-mir=InstrumentCoverage -Zdump-mir-spanview -Zdump-mir-dir="$(TMPDIR)"/mir_dump.$@ \ - -Zinstrument-coverage - - for path in "$(TMPDIR)"/mir_dump.$@/*; do \ - file="$$(basename "$$path")"; \ - urlescaped="$$("$(PYTHON)" $(BASEDIR)/escape_url.py $$file)" || exit $$?; \ - printf "$$SPANVIEW_HEADER\n" "$@" "$$urlescaped" > "$$path".modified; \ - tail -n +2 "$$path" >> "$$path".modified; \ - mv "$$path".modified "$$path"; \ - done && true # for/done ends in non-zero status - -ifdef RUSTC_BLESS_TEST - mkdir -p expected_mir_dump.$@ - cp "$(TMPDIR)"/mir_dump.$@/*InstrumentCoverage.0.html expected_mir_dump.$@/ -else - # Check that the selected `mir_dump` files match what we expect (`--bless` refreshes `expected`) - mkdir -p "$(TMPDIR)"/actual_mir_dump.$@ - rm -f "$(TMPDIR)"/actual_mir_dump.$@/* - cp "$(TMPDIR)"/mir_dump.$@/*InstrumentCoverage.0.html "$(TMPDIR)"/actual_mir_dump.$@/ - $(DIFF) -r expected_mir_dump.$@/ "$(TMPDIR)"/actual_mir_dump.$@/ -endif - -%: $(SOURCEDIR)/%.rs - # Compile the test program with coverage instrumentation - $(RUSTC) $(SOURCEDIR)/$@.rs \ - $$( sed -n 's/^\/\/ compile-flags: \([^#]*\).*/\1/p' $(SOURCEDIR)/$@.rs ) \ - -L "$(TMPDIR)" \ - -Ztrim-diagnostic-paths=no \ - -Zdump-mir=InstrumentCoverage -Zdump-mir-spanview -Zdump-mir-dir="$(TMPDIR)"/mir_dump.$@ \ - -Zinstrument-coverage - - for path in "$(TMPDIR)"/mir_dump.$@/*; do \ - file="$$(basename "$$path")"; \ - urlescaped="$$("$(PYTHON)" $(BASEDIR)/escape_url.py $$file)" || exit $$?; \ - printf "$$SPANVIEW_HEADER\n" "$@" "$$urlescaped" > "$$path".modified; \ - tail -n +2 "$$path" >> "$$path".modified; \ - mv "$$path".modified "$$path"; \ - done && true # for/done ends in non-zero status - -ifdef RUSTC_BLESS_TEST - mkdir -p expected_mir_dump.$@ - cp "$(TMPDIR)"/mir_dump.$@/*InstrumentCoverage.0.html expected_mir_dump.$@/ -else - # Check that the selected `mir_dump` files match what we expect (`--bless` refreshes `expected`) - mkdir -p "$(TMPDIR)"/actual_mir_dump.$@ - rm -f "$(TMPDIR)"/actual_mir_dump.$@/* - cp "$(TMPDIR)"/mir_dump.$@/*InstrumentCoverage.0.html "$(TMPDIR)"/actual_mir_dump.$@/ - $(DIFF) -r expected_mir_dump.$@/ "$(TMPDIR)"/actual_mir_dump.$@/ -endif diff --git a/src/test/run-make-fulldeps/coverage-spanview/escape_url.py b/src/test/run-make-fulldeps/coverage-spanview/escape_url.py deleted file mode 100644 index b725ed4630302..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview/escape_url.py +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env python - -import sys - -# Support python 2 or 3 -try: - from urllib.parse import quote -except ImportError: - from urllib import quote - -# Converts the input string into a valid URL parameter string. -print (quote(' '.join(sys.argv[1:]))) diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.abort/abort.main.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.abort/abort.main.-------.InstrumentCoverage.0.html deleted file mode 100644 index 176587af25be0..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.abort/abort.main.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,106 +0,0 @@ - - - - -abort.main - Coverage Spans - - - -
@0⦊fn main() -> Result<(), u8> { - let mut countdown = 10⦉@0; - while @1,2⦊countdown > 0⦉@1,2 { - if @3,5⦊countdown < 5⦉@3,5 @6,8⦊{ - might_abort(false); - }⦉@6,8@7⦊⦉@7 - // See discussion (below the `Notes` section) on coverage results for the closing brace. - if @9⦊countdown < 5⦉@9 @10,12⦊{ might_abort(false); }⦉@10,12@11⦊⦉@11 // Counts for different regions on one line. - // For the following example, the closing brace is the last character on the line. - // This shows the character after the closing brace is highlighted, even if that next - // character is a newline. - if @13⦊countdown < 5⦉@13 @14,16⦊{ might_abort(false); }⦉@14,16@15⦊⦉@15 - @17,18⦊countdown -= 1⦉@17,18; - } - @4⦊Ok(()) -}⦉@4
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.abort/abort.might_abort.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.abort/abort.might_abort.-------.InstrumentCoverage.0.html deleted file mode 100644 index a302b974ae1d2..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.abort/abort.might_abort.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,163 +0,0 @@ - - - - -abort.might_abort - Coverage Spans - - - -
@0⦊fn might_abort(should_abort: bool) ⦉@0{ - if @0⦊should_abort⦉@0 { - @1,3,4⦊println!("aborting..."); - panic!("panics and aborts");⦉@1,3,4 - } else @2,5,6⦊{ - println!("Don't Panic"); - } -}⦉@2,5,6
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.assert/assert.main.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.assert/assert.main.-------.InstrumentCoverage.0.html deleted file mode 100644 index 365e94cd31e50..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.assert/assert.main.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,102 +0,0 @@ - - - - -assert.main - Coverage Spans - - - -
@0⦊fn main() -> Result<(),u8> { - let mut countdown = 10⦉@0; - while @1,2⦊countdown > 0⦉@1,2 { - if @3,5⦊countdown == 1⦉@3,5 @6,8⦊{ - might_fail_assert(3); - }⦉@6,8 else if @7⦊countdown < 5⦉@7 @9,11⦊{ - might_fail_assert(2); - }⦉@9,11@10⦊⦉@10 - @13,14⦊countdown -= 1⦉@13,14; - } - @4⦊Ok(()) -}⦉@4
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.assert/assert.might_fail_assert.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.assert/assert.might_fail_assert.-------.InstrumentCoverage.0.html deleted file mode 100644 index db72a5306ff70..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.assert/assert.might_fail_assert.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,97 +0,0 @@ - - - - -assert.might_fail_assert - Coverage Spans - - - -
@0,1,2,3,4⦊fn might_fail_assert(one_plus_one: u32) ⦉@0,1,2,3,4{ - @0,1,2,3,4⦊println!("does 1 + 1 = {}?", one_plus_one);⦉@0,1,2,3,4 - assert_eq!(@0,1,2,3,4⦊1 + 1⦉@0,1,2,3,4, one_plus_one, @5,7⦊"the argument was wrong"⦉@5,7); -}@6⦊⦉@6
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.c-{closure#0}.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.c-{closure#0}.-------.InstrumentCoverage.0.html deleted file mode 100644 index 21bfce701fe6e..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.c-{closure#0}.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,82 +0,0 @@ - - - - -async.c-{closure#0} - Coverage Spans - - - -
@0⦊{ - if x == 8⦉@0 { - @1⦊1⦉@1 - } else { - @2⦊0⦉@2 - } -}@3⦊⦉@3
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.c.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.c.-------.InstrumentCoverage.0.html deleted file mode 100644 index 3eee0dd4100ed..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.c.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,80 +0,0 @@ - - - - -async.c - Coverage Spans - - - -
@0,1⦊async fn c(x: u8) -> u8 ⦉@0,1{ - if x == 8 { - 1 - } else { - 0 - } -}
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.d-{closure#0}.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.d-{closure#0}.-------.InstrumentCoverage.0.html deleted file mode 100644 index 7cf34f077954f..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.d-{closure#0}.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,75 +0,0 @@ - - - - -async.d-{closure#0} - Coverage Spans - - - -
@0⦊⦉@0{ 1 }
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.d.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.d.-------.InstrumentCoverage.0.html deleted file mode 100644 index 5c7f6e00224a0..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.d.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,74 +0,0 @@ - - - - -async.d - Coverage Spans - - - -
@0,1⦊async fn d() -> u8 ⦉@0,1{ 1 }
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.e-{closure#0}.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.e-{closure#0}.-------.InstrumentCoverage.0.html deleted file mode 100644 index 1f95a7d35af88..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.e-{closure#0}.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,75 +0,0 @@ - - - - -async.e-{closure#0} - Coverage Spans - - - -
@0⦊⦉@0{ 1 }
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.e.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.e.-------.InstrumentCoverage.0.html deleted file mode 100644 index ee3b7b1d7ffc7..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.e.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,74 +0,0 @@ - - - - -async.e - Coverage Spans - - - -
@0,1⦊async fn e() -> u8 ⦉@0,1{ 1 }
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.executor-block_on-VTABLE-{closure#0}.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.executor-block_on-VTABLE-{closure#0}.-------.InstrumentCoverage.0.html deleted file mode 100644 index 64fc1568b0085..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.executor-block_on-VTABLE-{closure#0}.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,84 +0,0 @@ - - - - -async.executor-block_on-VTABLE-{closure#0} - Coverage Spans - - - -
@0,1,2,3⦊⦉@0,1,2,3$crate::panicking::panic_fmt($crate::format_args!($fmt, $($arg)+))
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.executor-block_on-VTABLE-{closure#1}.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.executor-block_on-VTABLE-{closure#1}.-------.InstrumentCoverage.0.html deleted file mode 100644 index 1bbcfa5744b6b..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.executor-block_on-VTABLE-{closure#1}.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,84 +0,0 @@ - - - - -async.executor-block_on-VTABLE-{closure#1} - Coverage Spans - - - -
@0,1,2,3⦊⦉@0,1,2,3$crate::panicking::panic_fmt($crate::format_args!($fmt, $($arg)+))
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.executor-block_on-VTABLE-{closure#2}.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.executor-block_on-VTABLE-{closure#2}.-------.InstrumentCoverage.0.html deleted file mode 100644 index 14cb98d20c988..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.executor-block_on-VTABLE-{closure#2}.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,84 +0,0 @@ - - - - -async.executor-block_on-VTABLE-{closure#2} - Coverage Spans - - - -
@0,1,2,3⦊⦉@0,1,2,3$crate::panicking::panic_fmt($crate::format_args!($fmt, $($arg)+))
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.executor-block_on-VTABLE-{closure#3}.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.executor-block_on-VTABLE-{closure#3}.-------.InstrumentCoverage.0.html deleted file mode 100644 index ef2fe7d06825d..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.executor-block_on-VTABLE-{closure#3}.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,75 +0,0 @@ - - - - -async.executor-block_on-VTABLE-{closure#3} - Coverage Spans - - - -
|_| @0⦊()⦉@0
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.executor-block_on.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.executor-block_on.-------.InstrumentCoverage.0.html deleted file mode 100644 index 9a5bd6e42cd37..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.executor-block_on.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,239 +0,0 @@ - - - - -async.executor-block_on - Coverage Spans - - - -
@0,1,2,3,4,5⦊pub fn block_on<F: Future>(mut future: F) -> F::Output { - let mut future = unsafe { Pin::new_unchecked(&mut future) }; - - static VTABLE: RawWakerVTable = RawWakerVTable::new( - |_| unimplemented!("clone"), - |_| unimplemented!("wake"), - |_| unimplemented!("wake_by_ref"), - |_| (), - ); - let waker = unsafe { Waker::from_raw(RawWaker::new(core::ptr::null(), &VTABLE)) }; - let mut context = Context::from_waker(&waker)⦉@0,1,2,3,4,5; - - loop { - if let Poll::Ready(@10,12,14,15,16,17⦊val⦉@10,12,14,15,16,17) = @6,7,8,9⦊future.as_mut().poll(&mut context)⦉@6,7,8,9 { - break @10,12,14,15,16,17⦊val⦉@10,12,14,15,16,17; - }@11,13⦊⦉@11,13 - } - }@10,12,14,15,16,17⦊⦉@10,12,14,15,16,17
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.f-{closure#0}.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.f-{closure#0}.-------.InstrumentCoverage.0.html deleted file mode 100644 index 74b62673ac94b..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.f-{closure#0}.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,75 +0,0 @@ - - - - -async.f-{closure#0} - Coverage Spans - - - -
@0⦊⦉@0{ 1 }
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.f.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.f.-------.InstrumentCoverage.0.html deleted file mode 100644 index a31bca54df2e5..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.f.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,74 +0,0 @@ - - - - -async.f - Coverage Spans - - - -
@0,1⦊async fn f() -> u8 ⦉@0,1{ 1 }
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.foo-{closure#0}.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.foo-{closure#0}.-------.InstrumentCoverage.0.html deleted file mode 100644 index b8c53cccabda1..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.foo-{closure#0}.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,75 +0,0 @@ - - - - -async.foo-{closure#0} - Coverage Spans - - - -
@0⦊⦉@0{ [false; 10] }
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.foo.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.foo.-------.InstrumentCoverage.0.html deleted file mode 100644 index cf72a9d532c79..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.foo.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,74 +0,0 @@ - - - - -async.foo - Coverage Spans - - - -
@0,1⦊async fn foo() -> [bool; 10] ⦉@0,1{ [false; 10] }
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.g-{closure#0}.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.g-{closure#0}.-------.InstrumentCoverage.0.html deleted file mode 100644 index b10012621b7dd..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.g-{closure#0}.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,82 +0,0 @@ - - - - -async.g-{closure#0} - Coverage Spans - - - -
@0,3,4⦊{ - match x⦉@0,3,4 { - @17⦊y⦉@17 if @0,3,4⦊e()⦉@0,3,4.await == @10,13,15,16⦊y⦉@10,13,15,16 => @17⦊()⦉@17, - @33⦊y⦉@33 if @1,19,20⦊f()⦉@1,19,20.await == @26,29,31,32⦊y⦉@26,29,31,32 => @33⦊()⦉@33, - _ => @2⦊()⦉@2, - } -}@35,36⦊⦉@35,36
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.g.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.g.-------.InstrumentCoverage.0.html deleted file mode 100644 index 973995477b9aa..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.g.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,80 +0,0 @@ - - - - -async.g - Coverage Spans - - - -
@0,1⦊pub async fn g(x: u8) ⦉@0,1{ - match x { - y if e().await == y => (), - y if f().await == y => (), - _ => (), - } -}
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.h-{closure#0}.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.h-{closure#0}.-------.InstrumentCoverage.0.html deleted file mode 100644 index 6b4b43f836580..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.h-{closure#0}.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,82 +0,0 @@ - - - - -async.h-{closure#0} - Coverage Spans - - - -
@0,2,3⦊{ // The function signature is counted when called, but the body is not - // executed (not awaited) so the open brace has a `0` count (at least when - // displayed with `llvm-cov show` in color-mode). - match x⦉@0,2,3 { - @17⦊y⦉@17 if @0,2,3⦊foo()⦉@0,2,3.await[@9,12,14,15,16⦊y⦉@9,12,14,15,16] => @17⦊()⦉@17, - _ => @1⦊()⦉@1, - } -}@19,20⦊⦉@19,20
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.h.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.h.-------.InstrumentCoverage.0.html deleted file mode 100644 index f2ea01281fe1e..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.h.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,81 +0,0 @@ - - - - -async.h - Coverage Spans - - - -
@0,1⦊async fn h(x: usize) ⦉@0,1{ // The function signature is counted when called, but the body is not - // executed (not awaited) so the open brace has a `0` count (at least when - // displayed with `llvm-cov show` in color-mode). - match x { - y if foo().await[y] => (), - _ => (), - } -}
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.i-{closure#0}.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.i-{closure#0}.-------.InstrumentCoverage.0.html deleted file mode 100644 index 1c63875a8be9b..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.i-{closure#0}.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,89 +0,0 @@ - - - - -async.i-{closure#0} - Coverage Spans - - - -
@0,3,4⦊{ // line coverage is 1, but there are 2 regions: - // (a) the function signature, counted when the function is called; and - // (b) the open brace for the function body, counted once when the body is - // executed asynchronously. - match x⦉@0,3,4 { - @17,19⦊y⦉@17,19 if @0,3,4⦊c(x)⦉@0,3,4.await == @10,13,15,16⦊y + 1⦉@10,13,15,16 => { @17,19⦊d()⦉@17,19.await; } - @46⦊y⦉@46 if @1,32,33⦊f()⦉@1,32,33.await == @39,42,44,45⦊y + 1⦉@39,42,44,45 => @46⦊()⦉@46, - _ => @2⦊()⦉@2, - } -}@48,49⦊⦉@48,49
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.i.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.i.-------.InstrumentCoverage.0.html deleted file mode 100644 index e5dc6ecd4eb63..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.i.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,83 +0,0 @@ - - - - -async.i - Coverage Spans - - - -
@0,1⦊async fn i(x: u8) ⦉@0,1{ // line coverage is 1, but there are 2 regions: - // (a) the function signature, counted when the function is called; and - // (b) the open brace for the function body, counted once when the body is - // executed asynchronously. - match x { - y if c(x).await == y + 1 => { d().await; } - y if f().await == y + 1 => (), - _ => (), - } -}
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.j-c.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.j-c.-------.InstrumentCoverage.0.html deleted file mode 100644 index e6384b7598fc2..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.j-c.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,90 +0,0 @@ - - - - -async.j-c - Coverage Spans - - - -
@0⦊fn c(x: u8) -> u8 { - if x == 8⦉@0 { - @1⦊1⦉@1 // This line appears covered, but the 1-character expression span covering the `1` - // is not executed. (`llvm-cov show` displays a `^0` below the `1` ). This is because - // `fn j()` executes the open brace for the funciton body, followed by the function's - // first executable statement, `match x`. Inner function declarations are not - // "visible" to the MIR for `j()`, so the code region counts all lines between the - // open brace and the first statement as executed, which is, in a sense, true. - // `llvm-cov show` overcomes this kind of situation by showing the actual counts - // of the enclosed coverages, (that is, the `1` expression was not executed, and - // accurately displays a `0`). - } else { - @2⦊0⦉@2 - } - }@3⦊⦉@3
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.j-d.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.j-d.-------.InstrumentCoverage.0.html deleted file mode 100644 index 4eed8ee60dd64..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.j-d.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,75 +0,0 @@ - - - - -async.j-d - Coverage Spans - - - -
@0⦊fn d() -> u8 { 1 }⦉@0
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.j-f.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.j-f.-------.InstrumentCoverage.0.html deleted file mode 100644 index 6e80c8c786ecb..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.j-f.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,75 +0,0 @@ - - - - -async.j-f - Coverage Spans - - - -
@0⦊fn f() -> u8 { 1 }⦉@0
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.j.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.j.-------.InstrumentCoverage.0.html deleted file mode 100644 index 2b43c7bd25d90..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.j.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,106 +0,0 @@ - - - - -async.j - Coverage Spans - - - -
@0,3,4⦊fn j(x: u8) { - // non-async versions of `c()`, `d()`, and `f()` to make it similar to async `i()`. - fn c(x: u8) -> u8 { - if x == 8 { - 1 // This line appears covered, but the 1-character expression span covering the `1` - // is not executed. (`llvm-cov show` displays a `^0` below the `1` ). This is because - // `fn j()` executes the open brace for the funciton body, followed by the function's - // first executable statement, `match x`. Inner function declarations are not - // "visible" to the MIR for `j()`, so the code region counts all lines between the - // open brace and the first statement as executed, which is, in a sense, true. - // `llvm-cov show` overcomes this kind of situation by showing the actual counts - // of the enclosed coverages, (that is, the `1` expression was not executed, and - // accurately displays a `0`). - } else { - 0 - } - } - fn d() -> u8 { 1 } - fn f() -> u8 { 1 } - match x⦉@0,3,4 { - @5,7⦊y⦉@5,7 if @0,3,4⦊c(x) == y + 1⦉@0,3,4 => @5,7⦊{ d(); }⦉@5,7 - @10⦊y⦉@10 if @1,8,9⦊f() == y + 1⦉@1,8,9 => @10⦊()⦉@10, - _ => @2⦊()⦉@2, - } -}@12⦊⦉@12
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.k.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.k.-------.InstrumentCoverage.0.html deleted file mode 100644 index 5792521bb2c57..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.k.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,80 +0,0 @@ - - - - -async.k - Coverage Spans - - - -
@0⦊fn k(x: u8) { // unused function - match x⦉@0 { - 1 => @1,4⦊()⦉@1,4, - 2 => @2,5⦊()⦉@2,5, - _ => @3⦊()⦉@3, - } -}@6⦊⦉@6
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.l.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.l.-------.InstrumentCoverage.0.html deleted file mode 100644 index cd92b88c24cbb..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.l.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,80 +0,0 @@ - - - - -async.l - Coverage Spans - - - -
@0⦊fn l(x: u8) { - match x⦉@0 { - 1 => @1,4⦊()⦉@1,4, - 2 => @2,5⦊()⦉@2,5, - _ => @3⦊()⦉@3, - } -}@6⦊⦉@6
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.m-{closure#0}.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.m-{closure#0}.-------.InstrumentCoverage.0.html deleted file mode 100644 index 5cec484a964da..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.m-{closure#0}.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,78 +0,0 @@ - - - - -async.m-{closure#0} - Coverage Spans - - - -
@0⦊{ x - 1 }⦉@0
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.m.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.m.-------.InstrumentCoverage.0.html deleted file mode 100644 index 04412c1d99427..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.m.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,74 +0,0 @@ - - - - -async.m - Coverage Spans - - - -
@0,1⦊async fn m(x: u8) -> u8 ⦉@0,1{ x - 1 }
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.main.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.main.-------.InstrumentCoverage.0.html deleted file mode 100644 index b892af0ed37d5..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.main.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,190 +0,0 @@ - - - - -async.main - Coverage Spans - - - -
@0,1,2,3,4,5,6,7,8,9,10,11,12,13⦊fn main() { - let _ = g(10); - let _ = h(9); - let mut future = Box::pin(i(8)); - j(7); - l(6); - let _ = m(5); - executor::block_on(future.as_mut()); -}⦉@0,1,2,3,4,5,6,7,8,9,10,11,12,13
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.closure/closure.main-{closure#0}.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.closure/closure.main-{closure#0}.-------.InstrumentCoverage.0.html deleted file mode 100644 index 3998295a0525e..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.closure/closure.main-{closure#0}.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,96 +0,0 @@ - - - - -closure.main-{closure#0} - Coverage Spans - - - -
|| - @0⦊{ - let mut countdown = 0; - if is_false⦉@0 @1⦊{ - countdown = 10; - }⦉@1@2⦊⦉@2 - @3,4⦊"alt string 2".to_owned() - }⦉@3,4
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.closure/closure.main-{closure#10}.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.closure/closure.main-{closure#10}.-------.InstrumentCoverage.0.html deleted file mode 100644 index 3bdfe71b48c27..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.closure/closure.main-{closure#10}.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,96 +0,0 @@ - - - - -closure.main-{closure#10} - Coverage Spans - - - -
|| - @0⦊{ - let mut countdown = 0; - if is_false⦉@0 @1⦊{ - countdown = 10; - }⦉@1@2⦊⦉@2 - @3,4⦊"alt string 1".to_owned() - }⦉@3,4
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.closure/closure.main-{closure#11}.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.closure/closure.main-{closure#11}.-------.InstrumentCoverage.0.html deleted file mode 100644 index 4b3f04b5a0c7e..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.closure/closure.main-{closure#11}.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,96 +0,0 @@ - - - - -closure.main-{closure#11} - Coverage Spans - - - -
|| - @0⦊{ - let mut countdown = 0; - if is_false⦉@0 @1⦊{ - countdown = 10; - }⦉@1@2⦊⦉@2 - @3,4⦊"alt string 3".to_owned() - }⦉@3,4
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.closure/closure.main-{closure#1}.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.closure/closure.main-{closure#1}.-------.InstrumentCoverage.0.html deleted file mode 100644 index 8ae494178f70b..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.closure/closure.main-{closure#1}.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,96 +0,0 @@ - - - - -closure.main-{closure#1} - Coverage Spans - - - -
|| - @0⦊{ - let mut countdown = 0; - if is_false⦉@0 @1⦊{ - countdown = 10; - }⦉@1@2⦊⦉@2 - @3,4⦊"alt string 4".to_owned() - }⦉@3,4
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.closure/closure.main-{closure#2}.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.closure/closure.main-{closure#2}.-------.InstrumentCoverage.0.html deleted file mode 100644 index ad40ba57d69be..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.closure/closure.main-{closure#2}.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,128 +0,0 @@ - - - - -closure.main-{closure#2} - Coverage Spans - - - -
|val| - @0⦊{ - let mut countdown = 0; - if is_false⦉@0 @1⦊{ - countdown = 10; - }⦉@1@2⦊⦉@2 - @3,4,5,6,7⦊format!("'{}'", val) - }⦉@3,4,5,6,7
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.closure/closure.main-{closure#3}.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.closure/closure.main-{closure#3}.-------.InstrumentCoverage.0.html deleted file mode 100644 index 23101d76a8ef4..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.closure/closure.main-{closure#3}.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,91 +0,0 @@ - - - - -closure.main-{closure#3} - Coverage Spans - - - -
| - mut countdown - | - @0⦊{ - if is_false⦉@0 @1⦊{ - countdown = 10; - }⦉@1@2⦊⦉@2 - @3,4⦊"closure should be unused".to_owned() - }⦉@3,4
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.closure/closure.main-{closure#4}.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.closure/closure.main-{closure#4}.-------.InstrumentCoverage.0.html deleted file mode 100644 index 420135e143dbf..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.closure/closure.main-{closure#4}.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,76 +0,0 @@ - - - - -closure.main-{closure#4} - Coverage Spans - - - -
| _unused_arg: u8 | @0⦊countdown += 1⦉@0
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.closure/closure.main-{closure#5}.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.closure/closure.main-{closure#5}.-------.InstrumentCoverage.0.html deleted file mode 100644 index 1c19aa8eeefaa..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.closure/closure.main-{closure#5}.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,115 +0,0 @@ - - - - -closure.main-{closure#5} - Coverage Spans - - - -
@0,1,2⦊{ - $crate::io::_print($crate::format_args_nl!($($arg)*)); - }⦉@0,1,2
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.closure/closure.main-{closure#6}.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.closure/closure.main-{closure#6}.-------.InstrumentCoverage.0.html deleted file mode 100644 index 74c75c6c46ca2..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.closure/closure.main-{closure#6}.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,87 +0,0 @@ - - - - -closure.main-{closure#6} - Coverage Spans - - - -
| _unused_arg: u8 | @0,1,2⦊{ println!("not called") }⦉@0,1,2
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.closure/closure.main-{closure#7}.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.closure/closure.main-{closure#7}.-------.InstrumentCoverage.0.html deleted file mode 100644 index 386fb1b9e6f95..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.closure/closure.main-{closure#7}.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,115 +0,0 @@ - - - - -closure.main-{closure#7} - Coverage Spans - - - -
| _unused_arg: u8 | @0,1,2⦊{ - println!("not called") - }⦉@0,1,2
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.closure/closure.main-{closure#8}.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.closure/closure.main-{closure#8}.-------.InstrumentCoverage.0.html deleted file mode 100644 index f9da6ac9dfc34..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.closure/closure.main-{closure#8}.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,89 +0,0 @@ - - - - -closure.main-{closure#8} - Coverage Spans - - - -
| - _unused_arg: u8 - | @0,1,2⦊{ println!("not called") }⦉@0,1,2
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.closure/closure.main-{closure#9}.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.closure/closure.main-{closure#9}.-------.InstrumentCoverage.0.html deleted file mode 100644 index e259fc9bb67e7..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.closure/closure.main-{closure#9}.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,89 +0,0 @@ - - - - -closure.main-{closure#9} - Coverage Spans - - - -
| - _unused_arg: u8 - | @0,1,2⦊{ println!("not called") }⦉@0,1,2
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.closure/closure.main.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.closure/closure.main.-------.InstrumentCoverage.0.html deleted file mode 100644 index a7d1728114ec9..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.closure/closure.main.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,10921 +0,0 @@ - - - - -closure.main - Coverage Spans - - - -
@0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42⦊fn main() { - // Initialize test constants in a way that cannot be determined at compile time, to ensure - // rustc and LLVM cannot optimize out statements (or coverage counters) downstream from - // dependent conditions. - let is_true = std::env::args().len() == 1; - let is_false = ! is_true; - - let mut some_string = Some(String::from("the string content")); - println!( - "The string or alt: {}" - , - some_string - . - unwrap_or_else - ( - ⦉@0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42|| - { - let mut countdown = 0; - if is_false { - countdown = 10; - } - "alt string 1".to_owned() - }@0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42⦊ - ) - ); - - some_string = Some(String::from("the string content")); - let - a - = - ⦉@0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42|| - { - let mut countdown = 0; - if is_false { - countdown = 10; - } - "alt string 2".to_owned() - }@0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42⦊; - println!( - "The string or alt: {}" - , - some_string - . - unwrap_or_else - ( - a - ) - ); - - some_string = None; - println!( - "The string or alt: {}" - , - some_string - . - unwrap_or_else - ( - ⦉@0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42|| - { - let mut countdown = 0; - if is_false { - countdown = 10; - } - "alt string 3".to_owned() - }@0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42⦊ - ) - ); - - some_string = None; - let - a - = - ⦉@0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42|| - { - let mut countdown = 0; - if is_false { - countdown = 10; - } - "alt string 4".to_owned() - }@0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42⦊; - println!( - "The string or alt: {}" - , - some_string - . - unwrap_or_else - ( - a - ) - ); - - let - quote_closure - = - ⦉@0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42|val| - { - let mut countdown = 0; - if is_false { - countdown = 10; - } - format!("'{}'", val) - }@0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42⦊; - println!( - "Repeated, quoted string: {:?}" - , - std::iter::repeat("repeat me") - .take(5) - .map - ( - quote_closure - ) - .collect::<Vec<_>>() - ); - - let - _unused_closure - = - ⦉@0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42| - mut countdown - | - { - if is_false { - countdown = 10; - } - "closure should be unused".to_owned() - }@0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42⦊; - - let mut countdown = 10; - let _short_unused_closure = ⦉@0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42| _unused_arg: u8 | countdown += 1@0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42⦊; - - // Macros can sometimes confuse the coverage results. Compare this next assignment, with an - // unused closure that invokes the `println!()` macro, with the closure assignment above, that - // does not use a macro. The closure above correctly shows `0` executions. - let _short_unused_closure = ⦉@0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42| _unused_arg: u8 | println!("not called")@0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42⦊; - // The closure assignment above is executed, with a line count of `1`, but the `println!()` - // could not have been called, and yet, there is no indication that it wasn't... - - // ...but adding block braces gives the expected result, showing the block was not executed. - let _short_unused_closure_block = ⦉@0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42| _unused_arg: u8 | { println!("not called") }@0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42⦊; - - let _shortish_unused_closure = ⦉@0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42| _unused_arg: u8 | { - println!("not called") - }@0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42⦊; - - let _as_short_unused_closure = ⦉@0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42| - _unused_arg: u8 - | { println!("not called") }@0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42⦊; - - let _almost_as_short_unused_closure = ⦉@0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42| - _unused_arg: u8 - | { println!("not called") }@0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42⦊ - ; -}⦉@0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.conditions/conditions.main.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.conditions/conditions.main.-------.InstrumentCoverage.0.html deleted file mode 100644 index 3d1b737ec2d7e..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.conditions/conditions.main.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,307 +0,0 @@ - - - - -conditions.main - Coverage Spans - - - -
@0⦊fn main() ⦉@0{ - let @0⦊mut countdown = 0; - if true⦉@0 @1⦊{ - countdown = 10; - }⦉@1@2⦊⦉@2 - - const B: u32 = 100; - let @19⦊x⦉@19 = if @3⦊countdown > 7⦉@3 { - @4,6⦊countdown -= 4; - B⦉@4,6 - } else if @5⦊countdown > 2⦉@5 { - if @7⦊countdown < 1⦉@7 || @13⦊countdown > 5⦉@13 || @10⦊countdown != 9⦉@10 @15⦊{ - countdown = 0; - }⦉@15@16⦊⦉@16 - @17,18⦊countdown -= 5; - countdown⦉@17,18 - } else { - @8⦊return⦉@8; - }; - - let @19⦊mut countdown = 0; - if true⦉@19 @20⦊{ - countdown = 10; - }⦉@20@21⦊⦉@21 - - if @22⦊countdown > 7⦉@22 @23,25⦊{ - countdown -= 4; - }⦉@23,25 else if @24⦊countdown > 2⦉@24 { - if @26⦊countdown < 1⦉@26 || @32⦊countdown > 5⦉@32 || @29⦊countdown != 9⦉@29 @34⦊{ - countdown = 0; - }⦉@34@35⦊⦉@35 - @36,37⦊countdown -= 5⦉@36,37; - } else { - @27⦊return⦉@27; - } - - if @38⦊true⦉@38 { - let @39⦊mut countdown = 0; - if true⦉@39 @41⦊{ - countdown = 10; - }⦉@41@42⦊⦉@42 - - if @43⦊countdown > 7⦉@43 @44,46⦊{ - countdown -= 4; - }⦉@44,46 - else if @45⦊countdown > 2⦉@45 { - if @47⦊countdown < 1⦉@47 || @53⦊countdown > 5⦉@53 || @50⦊countdown != 9⦉@50 @55⦊{ - countdown = 0; - }⦉@55@56⦊⦉@56 - @57,58⦊countdown -= 5⦉@57,58; - } else { - @48⦊return⦉@48; - } - }@40⦊⦉@40 // Note: closing brace shows uncovered (vs. `0` for implicit else) because condition literal - // `true` was const-evaluated. The compiler knows the `if` block will be executed. - - let @60⦊mut countdown = 0; - if true⦉@60 @61⦊{ - countdown = 1; - }⦉@61@62⦊⦉@62 - - let @81⦊z⦉@81 = if @63⦊countdown > 7⦉@63 @64,66⦊{ - countdown -= 4; - }⦉@64,66 else if @65⦊countdown > 2⦉@65 { - if @67⦊countdown < 1⦉@67 || @73⦊countdown > 5⦉@73 || @70⦊countdown != 9⦉@70 @75⦊{ - countdown = 0; - }⦉@75@76⦊⦉@76 - @77,78⦊countdown -= 5⦉@77,78; - } else { - let @68,79,80⦊should_be_reachable = countdown; - println!("reached"); - return⦉@68,79,80; - }; - - let @97⦊w⦉@97 = if @81⦊countdown > 7⦉@81 @82,84⦊{ - countdown -= 4; - }⦉@82,84 else if @83⦊countdown > 2⦉@83 { - if @85⦊countdown < 1⦉@85 || @91⦊countdown > 5⦉@91 || @88⦊countdown != 9⦉@88 @93⦊{ - countdown = 0; - }⦉@93@94⦊⦉@94 - @95,96⦊countdown -= 5⦉@95,96; - } else { - @86⦊return⦉@86; - }; -}@101⦊⦉@101
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.dead_code/dead_code.main.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.dead_code/dead_code.main.-------.InstrumentCoverage.0.html deleted file mode 100644 index be06ddd126da9..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.dead_code/dead_code.main.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,143 +0,0 @@ - - - - -dead_code.main - Coverage Spans - - - -
@0,1,2,3⦊fn main() { - // Initialize test constants in a way that cannot be determined at compile time, to ensure - // rustc and LLVM cannot optimize out statements (or coverage counters) downstream from - // dependent conditions. - let is_true = std::env::args().len() == 1; - - let mut countdown = 0; - if is_true⦉@0,1,2,3 @4⦊{ - countdown = 10; - }⦉@4@5⦊⦉@5 -}@6⦊⦉@6
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.dead_code/dead_code.unused_fn.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.dead_code/dead_code.unused_fn.-------.InstrumentCoverage.0.html deleted file mode 100644 index 7f2d8d3c8ec1e..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.dead_code/dead_code.unused_fn.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,143 +0,0 @@ - - - - -dead_code.unused_fn - Coverage Spans - - - -
@0,1,2,3⦊fn unused_fn() { - // Initialize test constants in a way that cannot be determined at compile time, to ensure - // rustc and LLVM cannot optimize out statements (or coverage counters) downstream from - // dependent conditions. - let is_true = std::env::args().len() == 1; - - let mut countdown = 0; - if is_true⦉@0,1,2,3 @4⦊{ - countdown = 10; - }⦉@4@5⦊⦉@5 -}@6⦊⦉@6
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.dead_code/dead_code.unused_pub_fn_not_in_library.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.dead_code/dead_code.unused_pub_fn_not_in_library.-------.InstrumentCoverage.0.html deleted file mode 100644 index be44f71348c17..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.dead_code/dead_code.unused_pub_fn_not_in_library.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,143 +0,0 @@ - - - - -dead_code.unused_pub_fn_not_in_library - Coverage Spans - - - -
@0,1,2,3⦊pub fn unused_pub_fn_not_in_library() { - // Initialize test constants in a way that cannot be determined at compile time, to ensure - // rustc and LLVM cannot optimize out statements (or coverage counters) downstream from - // dependent conditions. - let is_true = std::env::args().len() == 1; - - let mut countdown = 0; - if is_true⦉@0,1,2,3 @4⦊{ - countdown = 10; - }⦉@4@5⦊⦉@5 -}@6⦊⦉@6
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.doctest/doctest.main.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.doctest/doctest.main.-------.InstrumentCoverage.0.html deleted file mode 100644 index 95813decf9f6a..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.doctest/doctest.main.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,96 +0,0 @@ - - - - -doctest.main - Coverage Spans - - - -
@0⦊fn main() ⦉@0{ - if @0⦊true⦉@0 { - @4⦊@3⦊assert_eq!(1, 1);⦉@3⦉@4 - } else { - @6⦊@5⦊assert_eq!(1, 2);⦉@5⦉@6 - } -}@7⦊⦉@7
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.doctest_crate/doctest_crate.fn_run_in_doctests.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.doctest_crate/doctest_crate.fn_run_in_doctests.-------.InstrumentCoverage.0.html deleted file mode 100644 index 3a41d3482b0b9..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.doctest_crate/doctest_crate.fn_run_in_doctests.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,113 +0,0 @@ - - - - -doctest_crate.fn_run_in_doctests - Coverage Spans - - - -
@0⦊pub fn fn_run_in_doctests(conditional: usize) ⦉@0{ - match @0⦊conditional⦉@0 { - 1 => @7⦊@6⦊assert_eq!(1, 1)⦉@6⦉@7, // this is run, - 2 => @10⦊@9⦊assert_eq!(1, 1)⦉@9⦉@10, // this, - 3 => @13⦊@12⦊assert_eq!(1, 1)⦉@12⦉@13, // and this too - _ => @15⦊@14⦊assert_eq!(1, 2)⦉@14⦉@15, // however this is not - } -}@16⦊⦉@16
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.drop_trait/drop_trait.main.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.drop_trait/drop_trait.main.-------.InstrumentCoverage.0.html deleted file mode 100644 index 66a6e776a0622..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.drop_trait/drop_trait.main.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,152 +0,0 @@ - - - - -drop_trait.main - Coverage Spans - - - -
@0⦊fn main() -> Result<(),u8> { - let _firecracker = Firework { strength: 1 }; - - let _tnt = Firework { strength: 100 }; - - if true⦉@0 { - @1,3,4,8,9⦊println!("Exiting with error..."); - return Err(1)⦉@1,3,4,8,9; - }@2,5,6,7⦊ - - let _ = Firework { strength: 1000 }; - - Ok(())⦉@2,5,6,7 -}@10⦊⦉@10
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.drop_trait/drop_trait.{impl#0}-drop.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.drop_trait/drop_trait.{impl#0}-drop.-------.InstrumentCoverage.0.html deleted file mode 100644 index 57d56c5cf7369..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.drop_trait/drop_trait.{impl#0}-drop.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,133 +0,0 @@ - - - - -drop_trait.{impl#0}-drop - Coverage Spans - - - -
@0,1,2,3⦊fn drop(&mut self) { - println!("BOOM times {}!!!", self.strength); - }⦉@0,1,2,3
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.generics/generics.main.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.generics/generics.main.-------.InstrumentCoverage.0.html deleted file mode 100644 index 098c140425160..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.generics/generics.main.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,237 +0,0 @@ - - - - -generics.main - Coverage Spans - - - -
@0,1,2,3⦊fn main() -> Result<(),u8> { - let mut firecracker = Firework { strength: 1 }; - firecracker.set_strength(2); - - let mut tnt = Firework { strength: 100.1 }; - tnt.set_strength(200.1); - tnt.set_strength(300.3); - - if true⦉@0,1,2,3 { - @4,6,7,11,12⦊println!("Exiting with error..."); - return Err(1)⦉@4,6,7,11,12; - }@5,8,9,10⦊ // The remaining lines below have no coverage because `if true` (with the constant literal - // `true`) is guaranteed to execute the `then` block, which is also guaranteed to `return`. - // Thankfully, in the normal case, conditions are not guaranteed ahead of time, and as shown - // in other tests, the lines below would have coverage (which would show they had `0` - // executions, assuming the condition still evaluated to `true`). - - let _ = Firework { strength: 1000 }; - - Ok(())⦉@5,8,9,10 -}@13⦊⦉@13
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.generics/generics.{impl#0}-set_strength.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.generics/generics.{impl#0}-set_strength.-------.InstrumentCoverage.0.html deleted file mode 100644 index 329641d47bdbc..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.generics/generics.{impl#0}-set_strength.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,85 +0,0 @@ - - - - -generics.{impl#0}-set_strength - Coverage Spans - - - -
@0⦊fn set_strength(&mut self, new_strength: T) { - self.strength = new_strength; - }⦉@0
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.generics/generics.{impl#1}-drop.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.generics/generics.{impl#1}-drop.-------.InstrumentCoverage.0.html deleted file mode 100644 index 4908bc7b4a772..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.generics/generics.{impl#1}-drop.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,133 +0,0 @@ - - - - -generics.{impl#1}-drop - Coverage Spans - - - -
@0,1,2,3⦊fn drop(&mut self) { - println!("BOOM times {}!!!", self.strength); - }⦉@0,1,2,3
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.if/if.main.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.if/if.main.-------.InstrumentCoverage.0.html deleted file mode 100644 index d6eccf57846ef..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.if/if.main.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,238 +0,0 @@ - - - - -if.main - Coverage Spans - - - -
@0,1,2,3⦊fn main() { - // Initialize test constants in a way that cannot be determined at compile time, to ensure - // rustc and LLVM cannot optimize out statements (or coverage counters) downstream from - // dependent conditions. - let - is_true - = - std::env::args().len() - == - 1 - ; - let - mut - countdown - = - 0 - ; - if - is_true⦉@0,1,2,3 - @4⦊{ - countdown - = - 10 - ; - }⦉@4@5⦊⦉@5 -}@6⦊⦉@6
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.if_else/if_else.main.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.if_else/if_else.main.-------.InstrumentCoverage.0.html deleted file mode 100644 index e0f0ac4020594..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.if_else/if_else.main.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,195 +0,0 @@ - - - - -if_else.main - Coverage Spans - - - -
@0,1,2,3⦊fn main() { - // Initialize test constants in a way that cannot be determined at compile time, to ensure - // rustc and LLVM cannot optimize out statements (or coverage counters) downstream from - // dependent conditions. - let is_true = std::env::args().len() == 1; - - let mut countdown = 0; - if - is_true⦉@0,1,2,3 - @4⦊{ - countdown - = - 10 - ; - }⦉@4 - else // Note coverage region difference without semicolon - { - @5⦊countdown - = - 100⦉@5 - } - - if - @6⦊is_true⦉@6 - @7⦊{ - countdown - = - 10 - ; - }⦉@7 - else - @8⦊{ - countdown - = - 100 - ; - }⦉@8 -}@9⦊⦉@9
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.inline/inline.display.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.inline/inline.display.-------.InstrumentCoverage.0.html deleted file mode 100644 index 6287516636ea9..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.inline/inline.display.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,161 +0,0 @@ - - - - -inline.display - Coverage Spans - - - -
@0,1⦊fn display<T: Display>(xs: &[T]) ⦉@0,1{ - for @6,8,9,10,11⦊x⦉@6,8,9,10,11 in @6,8,9,10,11⦊xs { - print!("{}", x); - }⦉@6,8,9,10,11 - @5,12,13⦊println!(); -}⦉@5,12,13
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.inline/inline.error.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.inline/inline.error.-------.InstrumentCoverage.0.html deleted file mode 100644 index bbf19c3e446f9..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.inline/inline.error.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,79 +0,0 @@ - - - - -inline.error - Coverage Spans - - - -
@0,1⦊fn error() { - panic!("error"); -}⦉@0,1
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.inline/inline.length.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.inline/inline.length.-------.InstrumentCoverage.0.html deleted file mode 100644 index 8e8efb6d9f6b1..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.inline/inline.length.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,82 +0,0 @@ - - - - -inline.length - Coverage Spans - - - -
@0,1⦊fn length<T>(xs: &[T]) -> usize { - xs.len() -}⦉@0,1
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.inline/inline.main.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.inline/inline.main.-------.InstrumentCoverage.0.html deleted file mode 100644 index 4ec2e9beede30..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.inline/inline.main.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,94 +0,0 @@ - - - - -inline.main - Coverage Spans - - - -
@0,1⦊fn main() { - permutations(&['a', 'b', 'c']); -}⦉@0,1
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.inline/inline.permutate.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.inline/inline.permutate.-------.InstrumentCoverage.0.html deleted file mode 100644 index fd72973ccd076..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.inline/inline.permutate.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,183 +0,0 @@ - - - - -inline.permutate - Coverage Spans - - - -
@0,1⦊fn permutate<T: Copy + Display>(xs: &mut [T], k: usize) { - let n = length(xs); - if k == n⦉@0,1 @2,4⦊{ - display(xs); - }⦉@2,4 else if @3⦊k < n⦉@3 { - for @12,14,15,16,17,18⦊i⦉@12,14,15,16,17,18 in @5,7⦊k..n⦉@5,7 @12,14,15,16,17,18⦊{ - swap(xs, i, k); - permutate(xs, k + 1); - swap(xs, i, k); - }⦉@12,14,15,16,17,18 - } else @6,19⦊{ - error(); - }⦉@6,19 -}@21⦊⦉@21
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.inline/inline.permutations.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.inline/inline.permutations.-------.InstrumentCoverage.0.html deleted file mode 100644 index 4bfd22f3cd903..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.inline/inline.permutations.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,113 +0,0 @@ - - - - -inline.permutations - Coverage Spans - - - -
@0,1,2,3,4⦊fn permutations<T: Copy + Display>(xs: &[T]) { - let mut ys = xs.to_owned(); - permutate(&mut ys, 0); -}⦉@0,1,2,3,4
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.inline/inline.swap.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.inline/inline.swap.-------.InstrumentCoverage.0.html deleted file mode 100644 index 4c3f63093d30e..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.inline/inline.swap.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,173 +0,0 @@ - - - - -inline.swap - Coverage Spans - - - -
@0,1,2,3,4⦊fn swap<T: Copy>(xs: &mut [T], i: usize, j: usize) { - let t = xs[i]; - xs[i] = xs[j]; - xs[j] = t; -}⦉@0,1,2,3,4
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.inner_items/inner_items.main-InTrait-default_trait_func.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.inner_items/inner_items.main-InTrait-default_trait_func.-------.InstrumentCoverage.0.html deleted file mode 100644 index 1dc5bb64e0bc3..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.inner_items/inner_items.main-InTrait-default_trait_func.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,93 +0,0 @@ - - - - -inner_items.main-InTrait-default_trait_func - Coverage Spans - - - -
@0,1,2⦊fn default_trait_func(&mut self) { - in_func(IN_CONST); - self.trait_func(IN_CONST); - }⦉@0,1,2
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.inner_items/inner_items.main-in_func.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.inner_items/inner_items.main-in_func.-------.InstrumentCoverage.0.html deleted file mode 100644 index 82724e5e86517..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.inner_items/inner_items.main-in_func.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,203 +0,0 @@ - - - - -inner_items.main-in_func - Coverage Spans - - - -
@0,1,2,3,4⦊fn in_func(a: u32) { - let b = 1; - let c = a + b; - println!("c = {}", c) - }⦉@0,1,2,3,4
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.inner_items/inner_items.main-{impl#0}-trait_func.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.inner_items/inner_items.main-{impl#0}-trait_func.-------.InstrumentCoverage.0.html deleted file mode 100644 index b00a781a0a74c..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.inner_items/inner_items.main-{impl#0}-trait_func.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,101 +0,0 @@ - - - - -inner_items.main-{impl#0}-trait_func - Coverage Spans - - - -
@0,1,2⦊fn trait_func(&mut self, incr: u32) { - self.in_struct_field += incr; - in_func(self.in_struct_field); - }⦉@0,1,2
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.inner_items/inner_items.main.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.inner_items/inner_items.main.-------.InstrumentCoverage.0.html deleted file mode 100644 index 4a1003dfbed32..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.inner_items/inner_items.main.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,189 +0,0 @@ - - - - -inner_items.main - Coverage Spans - - - -
@0,1,2,3⦊fn main() ⦉@0,1,2,3{ - // Initialize test constants in a way that cannot be determined at compile time, to ensure - // rustc and LLVM cannot optimize out statements (or coverage counters) downstream from - // dependent conditions. - let @0,1,2,3⦊is_true = std::env::args().len() == 1; - - let mut countdown = 0; - if is_true⦉@0,1,2,3 @4⦊{ - countdown = 10; - }⦉@4@5⦊⦉@5 - - mod in_mod { - const IN_MOD_CONST: u32 = 1000; - } - - fn in_func(a: u32) { - let b = 1; - let c = a + b; - println!("c = {}", c) - } - - struct InStruct { - in_struct_field: u32, - } - - const IN_CONST: u32 = 1234; - - trait InTrait { - fn trait_func(&mut self, incr: u32); - - fn default_trait_func(&mut self) { - in_func(IN_CONST); - self.trait_func(IN_CONST); - } - } - - impl InTrait for InStruct { - fn trait_func(&mut self, incr: u32) { - self.in_struct_field += incr; - in_func(self.in_struct_field); - } - } - - type InType = String; - - if @6⦊is_true⦉@6 @7,9⦊{ - in_func(countdown); - }⦉@7,9@8⦊⦉@8 - - let @10,11⦊mut val = InStruct { - in_struct_field: 101, - }; - - val.default_trait_func(); -}⦉@10,11
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.lazy_boolean/lazy_boolean.main.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.lazy_boolean/lazy_boolean.main.-------.InstrumentCoverage.0.html deleted file mode 100644 index a6f8d500065fa..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.lazy_boolean/lazy_boolean.main.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,259 +0,0 @@ - - - - -lazy_boolean.main - Coverage Spans - - - -
@0,1,2,3⦊fn main() { - // Initialize test constants in a way that cannot be determined at compile time, to ensure - // rustc and LLVM cannot optimize out statements (or coverage counters) downstream from - // dependent conditions. - let is_true = std::env::args().len() == 1; - - let (mut a, mut b, mut c) = (0, 0, 0); - if is_true⦉@0,1,2,3 @4⦊{ - a = 1; - b = 10; - c = 100; - }⦉@4@5⦊⦉@5 - let - @9⦊somebool⦉@9 - = - @6⦊a < b⦉@6 - || - @8⦊b < c⦉@8 - ; - let - @12⦊somebool⦉@12 - = - @9⦊b < a⦉@9 - || - @11⦊b < c⦉@11 - ; - let @15⦊somebool⦉@15 = @12⦊a < b⦉@12 && @14⦊b < c⦉@14; - let @18⦊somebool⦉@18 = @15⦊b < a⦉@15 && @17⦊b < c⦉@17; - - if - @18⦊! - is_true⦉@18 - @19⦊{ - a = 2 - ; - }⦉@19@20⦊⦉@20 - - if - @21⦊is_true⦉@21 - @22⦊{ - b = 30 - ; - }⦉@22 - else - @23⦊{ - c = 400 - ; - }⦉@23 - - if @24⦊!is_true⦉@24 @25⦊{ - a = 2; - }⦉@25@26⦊⦉@26 - - if @27⦊is_true⦉@27 @28⦊{ - b = 30; - }⦉@28 else @29⦊{ - c = 400; - }⦉@29 -}@30⦊⦉@30
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.loop_break_value/loop_break_value.main.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.loop_break_value/loop_break_value.main.-------.InstrumentCoverage.0.html deleted file mode 100644 index 076d036c2aff7..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.loop_break_value/loop_break_value.main.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,128 +0,0 @@ - - - - -loop_break_value.main - Coverage Spans - - - -
@0,1⦊fn main() { - let result - = - loop - { - break - 10 - ; - } - ; -}⦉@0,1
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.loops_branches/loops_branches.main.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.loops_branches/loops_branches.main.-------.InstrumentCoverage.0.html deleted file mode 100644 index 95e8f0b71eab8..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.loops_branches/loops_branches.main.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,161 +0,0 @@ - - - - -loops_branches.main - Coverage Spans - - - -
@0,1,2,3⦊fn main() { - let debug_test = DebugTest; - println!("{:?}", debug_test); -}⦉@0,1,2,3
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.loops_branches/loops_branches.{impl#0}-fmt.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.loops_branches/loops_branches.{impl#0}-fmt.-------.InstrumentCoverage.0.html deleted file mode 100644 index f6f08b6a7704b..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.loops_branches/loops_branches.{impl#0}-fmt.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,100 +0,0 @@ - - - - -loops_branches.{impl#0}-fmt - Coverage Spans - - - -
@0⦊fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - if true⦉@0 { - if @1⦊false⦉@1 { - while @4,5⦊true⦉@4,5 @6,8⦊{ - }⦉@6,8 - }@3⦊⦉@3 - @9,10,11,12⦊write!(f, "error")⦉@9,10,11,12@14,16,17,18⦊?⦉@14,16,17,18; - } else @2⦊{ - }⦉@2 - @19⦊Ok(())⦉@19 - }@20⦊⦉@20
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.match_or_pattern/match_or_pattern.main.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.match_or_pattern/match_or_pattern.main.-------.InstrumentCoverage.0.html deleted file mode 100644 index 013c292ce9a43..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.match_or_pattern/match_or_pattern.main.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,259 +0,0 @@ - - - - -match_or_pattern.main - Coverage Spans - - - -
@0,1,2,3⦊fn main() { - // Initialize test constants in a way that cannot be determined at compile time, to ensure - // rustc and LLVM cannot optimize out statements (or coverage counters) downstream from - // dependent conditions. - let is_true = std::env::args().len() == 1; - - let mut a: u8 = 0; - let mut b: u8 = 0; - if is_true⦉@0,1,2,3 @4⦊{ - a = 2; - b = 0; - }⦉@4@5⦊⦉@5 - match @6⦊(a, b)⦉@6 { - // Or patterns generate MIR `SwitchInt` with multiple targets to the same `BasicBlock`. - // This test confirms a fix for Issue #79569. - (0 | 1, 2 | 3) => @9,10⦊{}⦉@9,10 - _ => @7⦊{}⦉@7 - } - if @11⦊is_true⦉@11 @12⦊{ - a = 0; - b = 0; - }⦉@12@13⦊⦉@13 - match @14⦊(a, b)⦉@14 { - (0 | 1, 2 | 3) => @17,18⦊{}⦉@17,18 - _ => @15⦊{}⦉@15 - } - if @19⦊is_true⦉@19 @20⦊{ - a = 2; - b = 2; - }⦉@20@21⦊⦉@21 - match @22⦊(a, b)⦉@22 { - (0 | 1, 2 | 3) => @25,26⦊{}⦉@25,26 - _ => @23⦊{}⦉@23 - } - if @27⦊is_true⦉@27 @28⦊{ - a = 0; - b = 2; - }⦉@28@29⦊⦉@29 - match @30⦊(a, b)⦉@30 { - (0 | 1, 2 | 3) => @33,34⦊{}⦉@33,34 - _ => @31⦊{}⦉@31 - } -}@35⦊⦉@35
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.nested_loops/nested_loops.main.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.nested_loops/nested_loops.main.-------.InstrumentCoverage.0.html deleted file mode 100644 index 1abc24156d9c3..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.nested_loops/nested_loops.main.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,166 +0,0 @@ - - - - -nested_loops.main - Coverage Spans - - - -
@0,1,2,3⦊fn main() { - let is_true = std::env::args().len() == 1; - let mut countdown = 10⦉@0,1,2,3; - - 'outer: while @4,5⦊countdown > 0⦉@4,5 { - let @6,8,9⦊mut a = 100; - let mut b = 100⦉@6,8,9; - for @14,16⦊_⦉@14,16 in @10,11,12⦊0..50⦉@10,11,12 { - if @14,16⦊a < 30⦉@14,16 { - @17⦊break⦉@17; - }@18,19,20⦊ - a -= 5; - b -= 5; - if b < 90⦉@18,19,20 { - @21,23⦊a -= 10; - if is_true⦉@21,23 { - @24⦊break 'outer⦉@24; - } else @25,26⦊{ - a -= 2; - }⦉@25,26 - }@22⦊⦉@22 - } - @28,29⦊countdown -= 1⦉@28,29; - } -}@30⦊⦉@30
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.overflow/overflow.main.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.overflow/overflow.main.-------.InstrumentCoverage.0.html deleted file mode 100644 index 2a9b1b10efcd2..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.overflow/overflow.main.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,258 +0,0 @@ - - - - -overflow.main - Coverage Spans - - - -
@0⦊fn main() -> Result<(),u8> { - let mut countdown = 10⦉@0; - while @1,2⦊countdown > 0⦉@1,2 { - if @3,5⦊countdown == 1⦉@3,5 @6,8,9,10,11⦊{ - let result = might_overflow(10); - println!("Result: {}", result); - }⦉@6,8,9,10,11 else if @7⦊countdown < 5⦉@7 @12,14,15,16,17⦊{ - let result = might_overflow(1); - println!("Result: {}", result); - }⦉@12,14,15,16,17@13⦊⦉@13 - @19,20⦊countdown -= 1⦉@19,20; - } - @4⦊Ok(()) -}⦉@4
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.overflow/overflow.might_overflow.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.overflow/overflow.might_overflow.-------.InstrumentCoverage.0.html deleted file mode 100644 index c6043f0bd07fe..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.overflow/overflow.might_overflow.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,394 +0,0 @@ - - - - -overflow.might_overflow - Coverage Spans - - - -
@0⦊fn might_overflow(to_add: u32) -> u32 { - if to_add > 5⦉@0 @1,3,4⦊{ - println!("this will probably overflow"); - }⦉@1,3,4@2⦊⦉@2 - let @5,6,7,8,9,10,11,12,13⦊add_to = u32::MAX - 5; - println!("does {} + {} overflow?", add_to, to_add); - let result = to_add + add_to; - println!("continuing after overflow check"); - result -}⦉@5,6,7,8,9,10,11,12,13
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.panic_unwind/panic_unwind.main.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.panic_unwind/panic_unwind.main.-------.InstrumentCoverage.0.html deleted file mode 100644 index 5b097f118e3a8..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.panic_unwind/panic_unwind.main.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,102 +0,0 @@ - - - - -panic_unwind.main - Coverage Spans - - - -
@0⦊fn main() -> Result<(), u8> { - let mut countdown = 10⦉@0; - while @1,2⦊countdown > 0⦉@1,2 { - if @3,5⦊countdown == 1⦉@3,5 @6,8⦊{ - might_panic(true); - }⦉@6,8 else if @7⦊countdown < 5⦉@7 @9,11⦊{ - might_panic(false); - }⦉@9,11@10⦊⦉@10 - @13,14⦊countdown -= 1⦉@13,14; - } - @4⦊Ok(()) -}⦉@4
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.panic_unwind/panic_unwind.might_panic.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.panic_unwind/panic_unwind.might_panic.-------.InstrumentCoverage.0.html deleted file mode 100644 index 32988629ba0eb..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.panic_unwind/panic_unwind.might_panic.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,163 +0,0 @@ - - - - -panic_unwind.might_panic - Coverage Spans - - - -
@0⦊fn might_panic(should_panic: bool) ⦉@0{ - if @0⦊should_panic⦉@0 { - @1,3,4⦊println!("panicking..."); - panic!("panics");⦉@1,3,4 - } else @2,5,6⦊{ - println!("Don't Panic"); - } -}⦉@2,5,6
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.partial_eq/partial_eq.main.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.partial_eq/partial_eq.main.-------.InstrumentCoverage.0.html deleted file mode 100644 index 3e307c4f460d5..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.partial_eq/partial_eq.main.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,295 +0,0 @@ - - - - -partial_eq.main - Coverage Spans - - - -
@0,1,2,3,4,5,6,7,8⦊fn main() { - let version_3_2_1 = Version::new(3, 2, 1); - let version_3_3_0 = Version::new(3, 3, 0); - - println!("{:?} < {:?} = {}", version_3_2_1, version_3_3_0, version_3_2_1 < version_3_3_0); -}⦉@0,1,2,3,4,5,6,7,8
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.partial_eq/partial_eq.{impl#0}-new.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.partial_eq/partial_eq.{impl#0}-new.-------.InstrumentCoverage.0.html deleted file mode 100644 index 820ccf74d1b9e..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.partial_eq/partial_eq.{impl#0}-new.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,108 +0,0 @@ - - - - -partial_eq.{impl#0}-new - Coverage Spans - - - -
@0⦊pub fn new(major: usize, minor: usize, patch: usize) -> Self { - Self { - major, - minor, - patch, - } - }⦉@0
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.partial_eq/partial_eq.{impl#1}-cmp.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.partial_eq/partial_eq.{impl#1}-cmp.-------.InstrumentCoverage.0.html deleted file mode 100644 index ee4c10afd8b89..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.partial_eq/partial_eq.{impl#1}-cmp.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,74 +0,0 @@ - - - - -partial_eq.{impl#1}-cmp - Coverage Spans - - - -
@0,1⦊⦉@0,1Ord@15⦊⦉@15
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.partial_eq/partial_eq.{impl#2}-partial_cmp.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.partial_eq/partial_eq.{impl#2}-partial_cmp.-------.InstrumentCoverage.0.html deleted file mode 100644 index 2f5092bd51f0a..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.partial_eq/partial_eq.{impl#2}-partial_cmp.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,74 +0,0 @@ - - - - -partial_eq.{impl#2}-partial_cmp - Coverage Spans - - - -
@0,1⦊⦉@0,1PartialOrd@18⦊⦉@18
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.partial_eq/partial_eq.{impl#4}-assert_receiver_is_total_eq.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.partial_eq/partial_eq.{impl#4}-assert_receiver_is_total_eq.-------.InstrumentCoverage.0.html deleted file mode 100644 index ebb8b1c15ce08..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.partial_eq/partial_eq.{impl#4}-assert_receiver_is_total_eq.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,75 +0,0 @@ - - - - -partial_eq.{impl#4}-assert_receiver_is_total_eq - Coverage Spans - - - -
@0⦊⦉@0Eq
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.partial_eq/partial_eq.{impl#6}-eq.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.partial_eq/partial_eq.{impl#6}-eq.-------.InstrumentCoverage.0.html deleted file mode 100644 index 9858b270d7ef9..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.partial_eq/partial_eq.{impl#6}-eq.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,74 +0,0 @@ - - - - -partial_eq.{impl#6}-eq - Coverage Spans - - - -
@0⦊⦉@0PartialEq@3⦊⦉@3
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.partial_eq/partial_eq.{impl#6}-ne.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.partial_eq/partial_eq.{impl#6}-ne.-------.InstrumentCoverage.0.html deleted file mode 100644 index bf94e5cbf739b..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.partial_eq/partial_eq.{impl#6}-ne.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,74 +0,0 @@ - - - - -partial_eq.{impl#6}-ne - Coverage Spans - - - -
@0⦊⦉@0PartialEq@3⦊⦉@3
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.partial_eq/partial_eq.{impl#7}-fmt.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.partial_eq/partial_eq.{impl#7}-fmt.-------.InstrumentCoverage.0.html deleted file mode 100644 index 930492f24841f..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.partial_eq/partial_eq.{impl#7}-fmt.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,110 +0,0 @@ - - - - -partial_eq.{impl#7}-fmt - Coverage Spans - - - -
@0,1,2,3,4,5⦊Debug⦉@0,1,2,3,4,5
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.partial_eq/partial_eq.{impl#8}-clone.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.partial_eq/partial_eq.{impl#8}-clone.-------.InstrumentCoverage.0.html deleted file mode 100644 index f1c983933432c..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.partial_eq/partial_eq.{impl#8}-clone.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,88 +0,0 @@ - - - - -partial_eq.{impl#8}-clone - Coverage Spans - - - -
@0,1,2,3⦊Clone⦉@0,1,2,3
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.simple_loop/simple_loop.main.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.simple_loop/simple_loop.main.-------.InstrumentCoverage.0.html deleted file mode 100644 index 6b911eea34121..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.simple_loop/simple_loop.main.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,193 +0,0 @@ - - - - -simple_loop.main - Coverage Spans - - - -
@0,1,2,3⦊fn main() { - // Initialize test constants in a way that cannot be determined at compile time, to ensure - // rustc and LLVM cannot optimize out statements (or coverage counters) downstream from - // dependent conditions. - let is_true = std::env::args().len() == 1; - - let mut countdown = 0; - - if - is_true⦉@0,1,2,3 - @4⦊{ - countdown - = - 10 - ; - }⦉@4@5⦊⦉@5 - - loop - { - if - @7,8⦊countdown - == - 0⦉@7,8 - { - @9⦊break⦉@9 - ; - }@10,11⦊ - countdown - -= - 1⦉@10,11 - ; - } -}@9⦊⦉@9
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.simple_match/simple_match.main.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.simple_match/simple_match.main.-------.InstrumentCoverage.0.html deleted file mode 100644 index a56692d9c2a48..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.simple_match/simple_match.main.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,222 +0,0 @@ - - - - -simple_match.main - Coverage Spans - - - -
@0,1,2,3⦊fn main() { - // Initialize test constants in a way that cannot be determined at compile time, to ensure - // rustc and LLVM cannot optimize out statements (or coverage counters) downstream from - // dependent conditions. - let is_true = std::env::args().len() == 1; - - let mut countdown = 1; - if is_true⦉@0,1,2,3 @4⦊{ - countdown = 0; - }⦉@4@5⦊⦉@5 - - for - @12,14,16⦊_⦉@12,14,16 - in - @8,9,10⦊0..2⦉@8,9,10 - { - let z - ; - match - @12,14,16⦊countdown⦉@12,14,16 - { - @17⦊x⦉@17 - if - @12,14,16⦊x - < - 1⦉@12,14,16 - => - @17⦊{ - z = countdown - ; - let y = countdown - ; - countdown = 10 - ; - }⦉@17 - _ - => - @15⦊{}⦉@15 - } - } -}@11⦊⦉@11
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.tight_inf_loop/tight_inf_loop.main.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.tight_inf_loop/tight_inf_loop.main.-------.InstrumentCoverage.0.html deleted file mode 100644 index 8cbd265c6a01c..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.tight_inf_loop/tight_inf_loop.main.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,81 +0,0 @@ - - - - -tight_inf_loop.main - Coverage Spans - - - -
@0⦊fn main() { - if false⦉@0 { - @3,4⦊loop {}⦉@3,4 - }@2⦊ -}⦉@2
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.try_error_result/try_error_result.call.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.try_error_result/try_error_result.call.-------.InstrumentCoverage.0.html deleted file mode 100644 index a8a3139334c96..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.try_error_result/try_error_result.call.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,82 +0,0 @@ - - - - -try_error_result.call - Coverage Spans - - - -
@0⦊fn call(return_error: bool) -> Result<(),()> { - if return_error⦉@0 { - @1⦊Err(())⦉@1 - } else { - @2⦊Ok(())⦉@2 - } -}@3⦊⦉@3
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.try_error_result/try_error_result.main.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.try_error_result/try_error_result.main.-------.InstrumentCoverage.0.html deleted file mode 100644 index 5b0c5cb072f04..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.try_error_result/try_error_result.main.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,129 +0,0 @@ - - - - -try_error_result.main - Coverage Spans - - - -
@0,1⦊fn main() -> Result<(),()> { - let mut - countdown = 10⦉@0,1 - ; - for - @6,8,9⦊_⦉@6,8,9 - in - @2,3,4⦊0..10⦉@2,3,4 - { - @6,8,9⦊countdown - -= 1 - ; - if - countdown < 5⦉@6,8,9 - { - @10,12,13⦊call(/*return_error=*/ true)⦉@10,12,13@15,17,18,19⦊?⦉@15,17,18,19; - @14,20,21⦊call(/*return_error=*/ false)⦉@14,20,21@23,25,26,27⦊?⦉@23,25,26,27; - } - else - { - @11,28,29⦊call(/*return_error=*/ false)⦉@11,28,29@31,33,34,35⦊?⦉@31,33,34,35; - } - } - @5⦊Ok(())⦉@5 -}@38⦊⦉@38
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.unused/unused.foo.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.unused/unused.foo.-------.InstrumentCoverage.0.html deleted file mode 100644 index ef431a356c250..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.unused/unused.foo.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,87 +0,0 @@ - - - - -unused.foo - Coverage Spans - - - -
@0⦊fn foo<T>(x: T) { - let mut i = 0⦉@0; - while @1,2⦊i < 10⦉@1,2 { - @3,5⦊i != 0⦉@3,5 || @7⦊i != 0⦉@7; - @8,9⦊i += 1⦉@8,9; - } -}@4,10⦊⦉@4,10
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.unused/unused.main.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.unused/unused.main.-------.InstrumentCoverage.0.html deleted file mode 100644 index 864f6c4feb152..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.unused/unused.main.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,98 +0,0 @@ - - - - -unused.main - Coverage Spans - - - -
@0,1,2⦊fn main() -> Result<(), u8> { - foo::<u32>(0); - foo::<f32>(0.0); - Ok(()) -}⦉@0,1,2
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.unused/unused.unused_func.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.unused/unused.unused_func.-------.InstrumentCoverage.0.html deleted file mode 100644 index 52beea080232e..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.unused/unused.unused_func.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,86 +0,0 @@ - - - - -unused.unused_func - Coverage Spans - - - -
@0⦊fn unused_func(mut a: u32) { - if a != 0⦉@0 @1,3⦊{ - a += 1; - }⦉@1,3@2⦊⦉@2 -}@4⦊⦉@4
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.unused/unused.unused_func2.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.unused/unused.unused_func2.-------.InstrumentCoverage.0.html deleted file mode 100644 index 816ef73ea6b06..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.unused/unused.unused_func2.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,86 +0,0 @@ - - - - -unused.unused_func2 - Coverage Spans - - - -
@0⦊fn unused_func2(mut a: u32) { - if a != 0⦉@0 @1,3⦊{ - a += 1; - }⦉@1,3@2⦊⦉@2 -}@4⦊⦉@4
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.unused/unused.unused_func3.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.unused/unused.unused_func3.-------.InstrumentCoverage.0.html deleted file mode 100644 index 739f9f42db359..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.unused/unused.unused_func3.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,86 +0,0 @@ - - - - -unused.unused_func3 - Coverage Spans - - - -
@0⦊fn unused_func3(mut a: u32) { - if a != 0⦉@0 @1,3⦊{ - a += 1; - }⦉@1,3@2⦊⦉@2 -}@4⦊⦉@4
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.unused/unused.unused_template_func.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.unused/unused.unused_template_func.-------.InstrumentCoverage.0.html deleted file mode 100644 index be4f5efc5dbf1..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.unused/unused.unused_template_func.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,87 +0,0 @@ - - - - -unused.unused_template_func - Coverage Spans - - - -
@0⦊fn unused_template_func<T>(x: T) { - let mut i = 0⦉@0; - while @1,2⦊i < 10⦉@1,2 { - @3,5⦊i != 0⦉@3,5 || @7⦊i != 0⦉@7; - @8,9⦊i += 1⦉@8,9; - } -}@4,10⦊⦉@4,10
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.used_crate/used_crate.unused_function.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.used_crate/used_crate.unused_function.-------.InstrumentCoverage.0.html deleted file mode 100644 index 65e21ecef13bd..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.used_crate/used_crate.unused_function.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,115 +0,0 @@ - - - - -used_crate.unused_function - Coverage Spans - - - -
@0,1,2,3⦊pub fn unused_function() { - let is_true = std::env::args().len() == 1; - let mut countdown = 2; - if !is_true⦉@0,1,2,3 @4⦊{ - countdown = 20; - }⦉@4@5⦊⦉@5 -}@6⦊⦉@6
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.used_crate/used_crate.unused_generic_function.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.used_crate/used_crate.unused_generic_function.-------.InstrumentCoverage.0.html deleted file mode 100644 index 02154a2268b75..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.used_crate/used_crate.unused_generic_function.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,133 +0,0 @@ - - - - -used_crate.unused_generic_function - Coverage Spans - - - -
@0,1,2,3,4⦊pub fn unused_generic_function<T: Debug>(arg: T) { - println!("unused_generic_function with {:?}", arg); -}⦉@0,1,2,3,4
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.used_crate/used_crate.unused_private_function.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.used_crate/used_crate.unused_private_function.-------.InstrumentCoverage.0.html deleted file mode 100644 index 78228594e3753..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.used_crate/used_crate.unused_private_function.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,115 +0,0 @@ - - - - -used_crate.unused_private_function - Coverage Spans - - - -
@0,1,2,3⦊fn unused_private_function() { - let is_true = std::env::args().len() == 1; - let mut countdown = 2; - if !is_true⦉@0,1,2,3 @4⦊{ - countdown = 20; - }⦉@4@5⦊⦉@5 -}@6⦊⦉@6
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.used_crate/used_crate.use_this_lib_crate.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.used_crate/used_crate.use_this_lib_crate.-------.InstrumentCoverage.0.html deleted file mode 100644 index 8f618d2e24954..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.used_crate/used_crate.use_this_lib_crate.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,190 +0,0 @@ - - - - -used_crate.use_this_lib_crate - Coverage Spans - - - -
@0,1,2,3,4,5,6,7,8⦊fn use_this_lib_crate() { - used_from_bin_crate_and_lib_crate_generic_function("used from library used_crate.rs"); - used_with_same_type_from_bin_crate_and_lib_crate_generic_function( - "used from library used_crate.rs", - ); - let some_vec = vec![5, 6, 7, 8]; - used_only_from_this_lib_crate_generic_function(some_vec); - used_only_from_this_lib_crate_generic_function("used ONLY from library used_crate.rs"); -}⦉@0,1,2,3,4,5,6,7,8
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.used_crate/used_crate.used_from_bin_crate_and_lib_crate_generic_function.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.used_crate/used_crate.used_from_bin_crate_and_lib_crate_generic_function.-------.InstrumentCoverage.0.html deleted file mode 100644 index 61a709c4729f2..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.used_crate/used_crate.used_from_bin_crate_and_lib_crate_generic_function.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,133 +0,0 @@ - - - - -used_crate.used_from_bin_crate_and_lib_crate_generic_function - Coverage Spans - - - -
@0,1,2,3,4⦊pub fn used_from_bin_crate_and_lib_crate_generic_function<T: Debug>(arg: T) { - println!("used_from_bin_crate_and_lib_crate_generic_function with {:?}", arg); -}⦉@0,1,2,3,4
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.used_crate/used_crate.used_function.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.used_crate/used_crate.used_function.-------.InstrumentCoverage.0.html deleted file mode 100644 index 974a24b2c6d44..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.used_crate/used_crate.used_function.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,110 +0,0 @@ - - - - -used_crate.used_function - Coverage Spans - - - -
@0,1,2,3⦊pub fn used_function() ⦉@0,1,2,3{ - // Initialize test constants in a way that cannot be determined at compile time, to ensure - // rustc and LLVM cannot optimize out statements (or coverage counters) downstream from - // dependent conditions. - let @0,1,2,3⦊is_true = std::env::args().len() == 1; - let mut countdown = 0; - if is_true⦉@0,1,2,3 @4⦊{ - countdown = 10; - }⦉@4@5⦊⦉@5 - @6,7⦊use_this_lib_crate(); -}⦉@6,7
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.used_crate/used_crate.used_only_from_bin_crate_generic_function.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.used_crate/used_crate.used_only_from_bin_crate_generic_function.-------.InstrumentCoverage.0.html deleted file mode 100644 index 68035339fe4a8..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.used_crate/used_crate.used_only_from_bin_crate_generic_function.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,133 +0,0 @@ - - - - -used_crate.used_only_from_bin_crate_generic_function - Coverage Spans - - - -
@0,1,2,3,4⦊pub fn used_only_from_bin_crate_generic_function<T: Debug>(arg: T) { - println!("used_only_from_bin_crate_generic_function with {:?}", arg); -}⦉@0,1,2,3,4
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.used_crate/used_crate.used_only_from_this_lib_crate_generic_function.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.used_crate/used_crate.used_only_from_this_lib_crate_generic_function.-------.InstrumentCoverage.0.html deleted file mode 100644 index 63944eb9ab38e..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.used_crate/used_crate.used_only_from_this_lib_crate_generic_function.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,133 +0,0 @@ - - - - -used_crate.used_only_from_this_lib_crate_generic_function - Coverage Spans - - - -
@0,1,2,3,4⦊pub fn used_only_from_this_lib_crate_generic_function<T: Debug>(arg: T) { - println!("used_only_from_this_lib_crate_generic_function with {:?}", arg); -}⦉@0,1,2,3,4
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.used_crate/used_crate.used_with_same_type_from_bin_crate_and_lib_crate_generic_function.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.used_crate/used_crate.used_with_same_type_from_bin_crate_and_lib_crate_generic_function.-------.InstrumentCoverage.0.html deleted file mode 100644 index b146180fbd155..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.used_crate/used_crate.used_with_same_type_from_bin_crate_and_lib_crate_generic_function.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,133 +0,0 @@ - - - - -used_crate.used_with_same_type_from_bin_crate_and_lib_crate_generic_function - Coverage Spans - - - -
@0,1,2,3,4⦊pub fn used_with_same_type_from_bin_crate_and_lib_crate_generic_function<T: Debug>(arg: T) { - println!("used_with_same_type_from_bin_crate_and_lib_crate_generic_function with {:?}", arg); -}⦉@0,1,2,3,4
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.used_inline_crate/used_inline_crate.unused_function.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.used_inline_crate/used_inline_crate.unused_function.-------.InstrumentCoverage.0.html deleted file mode 100644 index 322eaf07677f4..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.used_inline_crate/used_inline_crate.unused_function.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,115 +0,0 @@ - - - - -used_inline_crate.unused_function - Coverage Spans - - - -
@0,1,2,3⦊pub fn unused_function() { - let is_true = std::env::args().len() == 1; - let mut countdown = 2; - if !is_true⦉@0,1,2,3 @4⦊{ - countdown = 20; - }⦉@4@5⦊⦉@5 -}@6⦊⦉@6
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.used_inline_crate/used_inline_crate.unused_generic_function.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.used_inline_crate/used_inline_crate.unused_generic_function.-------.InstrumentCoverage.0.html deleted file mode 100644 index 9e3052ccac155..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.used_inline_crate/used_inline_crate.unused_generic_function.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,133 +0,0 @@ - - - - -used_inline_crate.unused_generic_function - Coverage Spans - - - -
@0,1,2,3,4⦊pub fn unused_generic_function<T: Debug>(arg: T) { - println!("unused_generic_function with {:?}", arg); -}⦉@0,1,2,3,4
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.used_inline_crate/used_inline_crate.unused_private_function.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.used_inline_crate/used_inline_crate.unused_private_function.-------.InstrumentCoverage.0.html deleted file mode 100644 index e9c381db94025..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.used_inline_crate/used_inline_crate.unused_private_function.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,115 +0,0 @@ - - - - -used_inline_crate.unused_private_function - Coverage Spans - - - -
@0,1,2,3⦊fn unused_private_function() { - let is_true = std::env::args().len() == 1; - let mut countdown = 2; - if !is_true⦉@0,1,2,3 @4⦊{ - countdown = 20; - }⦉@4@5⦊⦉@5 -}@6⦊⦉@6
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.used_inline_crate/used_inline_crate.use_this_lib_crate.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.used_inline_crate/used_inline_crate.use_this_lib_crate.-------.InstrumentCoverage.0.html deleted file mode 100644 index 056f618a403c9..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.used_inline_crate/used_inline_crate.use_this_lib_crate.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,190 +0,0 @@ - - - - -used_inline_crate.use_this_lib_crate - Coverage Spans - - - -
@0,1,2,3,4,5,6,7,8⦊fn use_this_lib_crate() { - used_from_bin_crate_and_lib_crate_generic_function("used from library used_crate.rs"); - used_with_same_type_from_bin_crate_and_lib_crate_generic_function( - "used from library used_crate.rs", - ); - let some_vec = vec![5, 6, 7, 8]; - used_only_from_this_lib_crate_generic_function(some_vec); - used_only_from_this_lib_crate_generic_function("used ONLY from library used_crate.rs"); -}⦉@0,1,2,3,4,5,6,7,8
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.used_inline_crate/used_inline_crate.used_from_bin_crate_and_lib_crate_generic_function.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.used_inline_crate/used_inline_crate.used_from_bin_crate_and_lib_crate_generic_function.-------.InstrumentCoverage.0.html deleted file mode 100644 index 0d88b0bc60e34..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.used_inline_crate/used_inline_crate.used_from_bin_crate_and_lib_crate_generic_function.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,133 +0,0 @@ - - - - -used_inline_crate.used_from_bin_crate_and_lib_crate_generic_function - Coverage Spans - - - -
@0,1,2,3,4⦊pub fn used_from_bin_crate_and_lib_crate_generic_function<T: Debug>(arg: T) { - println!("used_from_bin_crate_and_lib_crate_generic_function with {:?}", arg); -}⦉@0,1,2,3,4
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.used_inline_crate/used_inline_crate.used_function.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.used_inline_crate/used_inline_crate.used_function.-------.InstrumentCoverage.0.html deleted file mode 100644 index d722d9f46ecff..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.used_inline_crate/used_inline_crate.used_function.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,110 +0,0 @@ - - - - -used_inline_crate.used_function - Coverage Spans - - - -
@0,1,2,3⦊pub fn used_function() ⦉@0,1,2,3{ - // Initialize test constants in a way that cannot be determined at compile time, to ensure - // rustc and LLVM cannot optimize out statements (or coverage counters) downstream from - // dependent conditions. - let @0,1,2,3⦊is_true = std::env::args().len() == 1; - let mut countdown = 0; - if is_true⦉@0,1,2,3 @4⦊{ - countdown = 10; - }⦉@4@5⦊⦉@5 - @6,7⦊use_this_lib_crate(); -}⦉@6,7
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.used_inline_crate/used_inline_crate.used_inline_function.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.used_inline_crate/used_inline_crate.used_inline_function.-------.InstrumentCoverage.0.html deleted file mode 100644 index a15c31bb13fd0..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.used_inline_crate/used_inline_crate.used_inline_function.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,110 +0,0 @@ - - - - -used_inline_crate.used_inline_function - Coverage Spans - - - -
@0,1,2,3⦊pub fn used_inline_function() ⦉@0,1,2,3{ - // Initialize test constants in a way that cannot be determined at compile time, to ensure - // rustc and LLVM cannot optimize out statements (or coverage counters) downstream from - // dependent conditions. - let @0,1,2,3⦊is_true = std::env::args().len() == 1; - let mut countdown = 0; - if is_true⦉@0,1,2,3 @4⦊{ - countdown = 10; - }⦉@4@5⦊⦉@5 - @6,7⦊use_this_lib_crate(); -}⦉@6,7
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.used_inline_crate/used_inline_crate.used_only_from_bin_crate_generic_function.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.used_inline_crate/used_inline_crate.used_only_from_bin_crate_generic_function.-------.InstrumentCoverage.0.html deleted file mode 100644 index 252ff76d41696..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.used_inline_crate/used_inline_crate.used_only_from_bin_crate_generic_function.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,133 +0,0 @@ - - - - -used_inline_crate.used_only_from_bin_crate_generic_function - Coverage Spans - - - -
@0,1,2,3,4⦊pub fn used_only_from_bin_crate_generic_function<T: Debug>(arg: T) { - println!("used_only_from_bin_crate_generic_function with {:?}", arg); -}⦉@0,1,2,3,4
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.used_inline_crate/used_inline_crate.used_only_from_this_lib_crate_generic_function.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.used_inline_crate/used_inline_crate.used_only_from_this_lib_crate_generic_function.-------.InstrumentCoverage.0.html deleted file mode 100644 index f8fb4990ad9a6..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.used_inline_crate/used_inline_crate.used_only_from_this_lib_crate_generic_function.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,133 +0,0 @@ - - - - -used_inline_crate.used_only_from_this_lib_crate_generic_function - Coverage Spans - - - -
@0,1,2,3,4⦊pub fn used_only_from_this_lib_crate_generic_function<T: Debug>(arg: T) { - println!("used_only_from_this_lib_crate_generic_function with {:?}", arg); -}⦉@0,1,2,3,4
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.used_inline_crate/used_inline_crate.used_with_same_type_from_bin_crate_and_lib_crate_generic_function.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.used_inline_crate/used_inline_crate.used_with_same_type_from_bin_crate_and_lib_crate_generic_function.-------.InstrumentCoverage.0.html deleted file mode 100644 index db5e24d9b1dd6..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.used_inline_crate/used_inline_crate.used_with_same_type_from_bin_crate_and_lib_crate_generic_function.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,133 +0,0 @@ - - - - -used_inline_crate.used_with_same_type_from_bin_crate_and_lib_crate_generic_function - Coverage Spans - - - -
@0,1,2,3,4⦊pub fn used_with_same_type_from_bin_crate_and_lib_crate_generic_function<T: Debug>(arg: T) { - println!("used_with_same_type_from_bin_crate_and_lib_crate_generic_function with {:?}", arg); -}⦉@0,1,2,3,4
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.uses_crate/uses_crate.main.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.uses_crate/uses_crate.main.-------.InstrumentCoverage.0.html deleted file mode 100644 index 28cf051ecf873..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.uses_crate/uses_crate.main.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,193 +0,0 @@ - - - - -uses_crate.main - Coverage Spans - - - -
@0,1,2,3,4,5,6,7,8,9⦊fn main() { - used_crate::used_function(); - let some_vec = vec![1, 2, 3, 4]; - used_crate::used_only_from_bin_crate_generic_function(&some_vec); - used_crate::used_only_from_bin_crate_generic_function("used from bin uses_crate.rs"); - used_crate::used_from_bin_crate_and_lib_crate_generic_function(some_vec); - used_crate::used_with_same_type_from_bin_crate_and_lib_crate_generic_function("interesting?"); -}⦉@0,1,2,3,4,5,6,7,8,9
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.uses_inline_crate/uses_inline_crate.main.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.uses_inline_crate/uses_inline_crate.main.-------.InstrumentCoverage.0.html deleted file mode 100644 index 179940f6bd5b7..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.uses_inline_crate/uses_inline_crate.main.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,249 +0,0 @@ - - - - -uses_inline_crate.main - Coverage Spans - - - -
@0,1,2,3,4,5,6,7,8,9,10⦊fn main() { - used_inline_crate::used_function(); - used_inline_crate::used_inline_function(); - let some_vec = vec![1, 2, 3, 4]; - used_inline_crate::used_only_from_bin_crate_generic_function(&some_vec); - used_inline_crate::used_only_from_bin_crate_generic_function("used from bin uses_crate.rs"); - used_inline_crate::used_from_bin_crate_and_lib_crate_generic_function(some_vec); - used_inline_crate::used_with_same_type_from_bin_crate_and_lib_crate_generic_function( - "interesting?", - ); -}⦉@0,1,2,3,4,5,6,7,8,9,10
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.while/while.main.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.while/while.main.-------.InstrumentCoverage.0.html deleted file mode 100644 index f037a8ee5c52f..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.while/while.main.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,82 +0,0 @@ - - - - -while.main - Coverage Spans - - - -
@0⦊fn main() { - let num = 9⦉@0; - while @1,2⦊num >= 10⦉@1,2 @3,5⦊{ - }⦉@3,5 -}@4⦊⦉@4
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.while_early_ret/while_early_ret.main.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.while_early_ret/while_early_ret.main.-------.InstrumentCoverage.0.html deleted file mode 100644 index fcb5418e1d0cf..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.while_early_ret/while_early_ret.main.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,130 +0,0 @@ - - - - -while_early_ret.main - Coverage Spans - - - -
@0⦊fn main() -> Result<(),u8> { - let mut countdown = 10⦉@0; - while - @1,2⦊countdown - > - 0⦉@1,2 - { - if - @3,5⦊countdown - < - 5⦉@3,5 - { - return - if - @6⦊countdown - > - 8⦉@6 - { - @8⦊Ok(())⦉@8 - } - else - { - @9⦊Err(1)⦉@9 - } - ; - }@7,11⦊ - countdown - -= - 1⦉@7,11 - ; - } - @4⦊Ok(())⦉@4 -}@12⦊⦉@12
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.yield/yield.main-{closure#0}.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.yield/yield.main-{closure#0}.-------.InstrumentCoverage.0.html deleted file mode 100644 index 1e68c345f849b..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.yield/yield.main-{closure#0}.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,79 +0,0 @@ - - - - -yield.main-{closure#0} - Coverage Spans - - - -
|| @0⦊{ - yield 1⦉@0; - return @1⦊"foo" - }⦉@1
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.yield/yield.main-{closure#1}.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.yield/yield.main-{closure#1}.-------.InstrumentCoverage.0.html deleted file mode 100644 index 842d7823bfd12..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.yield/yield.main-{closure#1}.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,81 +0,0 @@ - - - - -yield.main-{closure#1} - Coverage Spans - - - -
|| @0⦊{ - yield 1⦉@0; - @1⦊yield 2⦉@1; - @2⦊yield 3⦉@2; - return @3⦊"foo" - }⦉@3
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.yield/yield.main.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.yield/yield.main.-------.InstrumentCoverage.0.html deleted file mode 100644 index 4c0c0d562b840..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.yield/yield.main.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,138 +0,0 @@ - - - - -yield.main - Coverage Spans - - - -
@0,1,2⦊fn main() ⦉@0,1,2{ - let @0,1,2⦊mut generator⦉@0,1,2 = || { - yield 1; - return "foo" - }; - - match @0,1,2⦊Pin::new(&mut generator).resume(()) { - GeneratorState::Yielded(1)⦉@0,1,2 => @4,6,7,8⦊{}⦉@4,6,7,8 - _ => @5⦊panic!("unexpected value from resume")⦉@5, - } - match @4,6,7,8⦊Pin::new(&mut generator).resume(())⦉@4,6,7,8 { - GeneratorState::Complete(@10,11⦊"foo"⦉@10,11) => @12,13,14,15⦊{}⦉@12,13,14,15 - _ => @9⦊panic!("unexpected value from resume")⦉@9, - } - - let @12,13,14,15⦊mut generator⦉@12,13,14,15 = || { - yield 1; - yield 2; - yield 3; - return "foo" - }; - - match @12,13,14,15⦊Pin::new(&mut generator).resume(()) { - GeneratorState::Yielded(1)⦉@12,13,14,15 => @17,19,20,21⦊{}⦉@17,19,20,21 - _ => @18⦊panic!("unexpected value from resume")⦉@18, - } - match @17,19,20,21⦊Pin::new(&mut generator).resume(()) { - GeneratorState::Yielded(2)⦉@17,19,20,21 => @23,25⦊{}⦉@23,25 - _ => @24⦊panic!("unexpected value from resume")⦉@24, - } -}@23,25⦊⦉@23,25
- - diff --git a/src/test/run-make-fulldeps/coverage/coverage_tools.mk b/src/test/run-make-fulldeps/coverage/coverage_tools.mk index 38643aaf9021e..aa1dc7b91ce94 100644 --- a/src/test/run-make-fulldeps/coverage/coverage_tools.mk +++ b/src/test/run-make-fulldeps/coverage/coverage_tools.mk @@ -4,11 +4,3 @@ # -include ../coverage/coverage_tools.mk -include ../tools.mk - -# ISSUE(76038): When targeting MSVC, Rust binaries built with both `-Z instrument-coverage` and -# `-C link-dead-code` typically crash (with a seg-fault) or at best generate an empty `*.profraw` -# file, required for coverage reports. -# -# Enabling `-C link-dead-code` is not necessary when compiling with `-Z instrument-coverage`, -# due to improvements in the coverage map generation, to add unreachable functions known to Rust. -# Therefore, `-C link-dead-code` is no longer automatically enabled. From c86e0985f91d4b824370d3c4e015cd51460bf7dc Mon Sep 17 00:00:00 2001 From: Christiaan Dirkx Date: Fri, 2 Apr 2021 17:37:52 +0200 Subject: [PATCH 20/21] Introduce `get_process_heap` and fix atomic ordering. --- library/std/src/sys/windows/alloc.rs | 35 +++++++++++++++++----------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/library/std/src/sys/windows/alloc.rs b/library/std/src/sys/windows/alloc.rs index bc4725dfc7b39..182743998d62f 100644 --- a/library/std/src/sys/windows/alloc.rs +++ b/library/std/src/sys/windows/alloc.rs @@ -89,10 +89,10 @@ extern "system" { static HEAP: AtomicPtr = AtomicPtr::new(ptr::null_mut()); // Get a handle to the default heap of the current process, or null if the operation fails. -// SAFETY: If this operation is successful, `HEAP` will be successfully initialized and contain +// If this operation is successful, `HEAP` will be successfully initialized and contain // a non-null handle returned by `GetProcessHeap`. #[inline] -unsafe fn init_or_get_process_heap() -> c::HANDLE { +fn init_or_get_process_heap() -> c::HANDLE { let heap = HEAP.load(Ordering::Relaxed); if heap.is_null() { // `HEAP` has not yet been successfully initialized @@ -100,7 +100,7 @@ unsafe fn init_or_get_process_heap() -> c::HANDLE { if !heap.is_null() { // SAFETY: No locking is needed because within the same process, // successful calls to `GetProcessHeap` will always return the same value, even on different threads. - HEAP.store(heap, Ordering::Relaxed); + HEAP.store(heap, Ordering::Release); // SAFETY: `HEAP` contains a non-null handle returned by `GetProcessHeap` heap @@ -114,16 +114,25 @@ unsafe fn init_or_get_process_heap() -> c::HANDLE { } } +// Get a non-null handle to the default heap of the current process. +// SAFETY: `HEAP` must have been successfully initialized. +#[inline] +unsafe fn get_process_heap() -> c::HANDLE { + HEAP.load(Ordering::Acquire) +} + // Header containing a pointer to the start of an allocated block. // SAFETY: Size and alignment must be <= `MIN_ALIGN`. #[repr(C)] struct Header(*mut u8); // Allocate a block of optionally zeroed memory for a given `layout`. -// SAFETY: Returns a pointer satisfying the guarantees of `System` about allocated pointers. +// SAFETY: Returns a pointer satisfying the guarantees of `System` about allocated pointers, +// or null if the operation fails. If this returns non-null `HEAP` will have been successfully +// initialized. #[inline] unsafe fn allocate(layout: Layout, zeroed: bool) -> *mut u8 { - let heap = unsafe { init_or_get_process_heap() }; + let heap = init_or_get_process_heap(); if heap.is_null() { // Allocation has failed, could not get the current process heap. return ptr::null_mut(); @@ -209,11 +218,11 @@ unsafe impl GlobalAlloc for System { }; // SAFETY: because `ptr` has been successfully allocated with this allocator, - // `HEAP` must have been successfully initialized and contain a non-null handle - // returned by `GetProcessHeap`. - let heap = HEAP.load(Ordering::Relaxed); + // `HEAP` must have been successfully initialized. + let heap = unsafe { get_process_heap() }; - // SAFETY: `block` is a pointer to the start of an allocated block. + // SAFETY: `heap` is a non-null handle returned by `GetProcessHeap`, + // `block` is a pointer to the start of an allocated block. unsafe { let err = HeapFree(heap, 0, block as c::LPVOID); debug_assert!(err != 0, "Failed to free heap memory: {}", c::GetLastError()); @@ -224,11 +233,11 @@ unsafe impl GlobalAlloc for System { unsafe fn realloc(&self, ptr: *mut u8, layout: Layout, new_size: usize) -> *mut u8 { if layout.align() <= MIN_ALIGN { // SAFETY: because `ptr` has been successfully allocated with this allocator, - // `HEAP` must have been successfully initialized and contain a non-null handle - // returned by `GetProcessHeap`. - let heap = HEAP.load(Ordering::Relaxed); + // `HEAP` must have been successfully initialized. + let heap = unsafe { get_process_heap() }; - // SAFETY: `ptr` is a pointer to the start of an allocated block. + // SAFETY: `heap` is a non-null handle returned by `GetProcessHeap`, + // `ptr` is a pointer to the start of an allocated block. // The returned pointer points to the start of an allocated block. unsafe { HeapReAlloc(heap, 0, ptr as c::LPVOID, new_size) as *mut u8 } } else { From db1d003de1657e31174fac2bfa016000294ea266 Mon Sep 17 00:00:00 2001 From: Christiaan Dirkx Date: Fri, 2 Apr 2021 17:50:23 +0200 Subject: [PATCH 21/21] Remove `debug_assert` --- library/std/src/sys/windows/alloc.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/library/std/src/sys/windows/alloc.rs b/library/std/src/sys/windows/alloc.rs index 182743998d62f..af93cd7a3e27d 100644 --- a/library/std/src/sys/windows/alloc.rs +++ b/library/std/src/sys/windows/alloc.rs @@ -223,10 +223,7 @@ unsafe impl GlobalAlloc for System { // SAFETY: `heap` is a non-null handle returned by `GetProcessHeap`, // `block` is a pointer to the start of an allocated block. - unsafe { - let err = HeapFree(heap, 0, block as c::LPVOID); - debug_assert!(err != 0, "Failed to free heap memory: {}", c::GetLastError()); - } + unsafe { HeapFree(heap, 0, block as c::LPVOID) }; } #[inline]