diff options
Diffstat (limited to 'src')
629 files changed, 4047 insertions, 2594 deletions
diff --git a/src/bootstrap/Cargo.toml b/src/bootstrap/Cargo.toml index f5d9e46f9e2..ed5c59a2595 100644 --- a/src/bootstrap/Cargo.toml +++ b/src/bootstrap/Cargo.toml @@ -51,6 +51,7 @@ ignore = "0.4.10" opener = "0.5" once_cell = "1.7.2" xz2 = "0.1" +walkdir = "2" # Dependencies needed by the build-metrics feature sysinfo = { version = "0.24.1", optional = true } diff --git a/src/bootstrap/bootstrap.py b/src/bootstrap/bootstrap.py index 635e4f3703b..3b2b507b062 100644 --- a/src/bootstrap/bootstrap.py +++ b/src/bootstrap/bootstrap.py @@ -1043,7 +1043,7 @@ def bootstrap(help_triggered): build.checksums_sha256 = data["checksums_sha256"] build.stage0_compiler = Stage0Toolchain(data["compiler"]) - build.set_dist_environment(data["dist_server"]) + build.set_dist_environment(data["config"]["dist_server"]) build.build = args.build or build.build_triple() diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs index 38d4f15d3c8..62b5416cee8 100644 --- a/src/bootstrap/builder.rs +++ b/src/bootstrap/builder.rs @@ -91,7 +91,7 @@ pub trait Step: 'static + Clone + Debug + PartialEq + Eq + Hash { pub struct RunConfig<'a> { pub builder: &'a Builder<'a>, pub target: TargetSelection, - pub path: PathBuf, + pub paths: Vec<PathSet>, } impl RunConfig<'_> { @@ -150,11 +150,16 @@ impl Debug for TaskPath { /// Collection of paths used to match a task rule. #[derive(Debug, Clone, PartialOrd, Ord, PartialEq, Eq)] pub enum PathSet { - /// A collection of individual paths. + /// A collection of individual paths or aliases. /// /// These are generally matched as a path suffix. For example, a - /// command-line value of `libstd` will match if `src/libstd` is in the + /// command-line value of `std` will match if `library/std` is in the /// set. + /// + /// NOTE: the paths within a set should always be aliases of one another. + /// For example, `src/librustdoc` and `src/tools/rustdoc` should be in the same set, + /// but `library/core` and `library/std` generally should not, unless there's no way (for that Step) + /// to build them separately. Set(BTreeSet<TaskPath>), /// A "suite" of paths. /// @@ -177,26 +182,65 @@ impl PathSet { } fn has(&self, needle: &Path, module: Option<Kind>) -> bool { - let check = |p: &TaskPath| { - if let (Some(p_kind), Some(kind)) = (&p.kind, module) { - p.path.ends_with(needle) && *p_kind == kind - } else { - p.path.ends_with(needle) + match self { + PathSet::Set(set) => set.iter().any(|p| Self::check(p, needle, module)), + PathSet::Suite(suite) => Self::check(suite, needle, module), + } + } + + // internal use only + fn check(p: &TaskPath, needle: &Path, module: Option<Kind>) -> bool { + if let (Some(p_kind), Some(kind)) = (&p.kind, module) { + p.path.ends_with(needle) && *p_kind == kind + } else { + p.path.ends_with(needle) + } + } + + /// Return all `TaskPath`s in `Self` that contain any of the `needles`, removing the + /// matched needles. + /// + /// This is used for `StepDescription::krate`, which passes all matching crates at once to + /// `Step::make_run`, rather than calling it many times with a single crate. + /// See `tests.rs` for examples. + fn intersection_removing_matches( + &self, + needles: &mut Vec<&Path>, + module: Option<Kind>, + ) -> PathSet { + let mut check = |p| { + for (i, n) in needles.iter().enumerate() { + let matched = Self::check(p, n, module); + if matched { + needles.remove(i); + return true; + } } + false }; - match self { - PathSet::Set(set) => set.iter().any(check), - PathSet::Suite(suite) => check(suite), + PathSet::Set(set) => PathSet::Set(set.iter().filter(|&p| check(p)).cloned().collect()), + PathSet::Suite(suite) => { + if check(suite) { + self.clone() + } else { + PathSet::empty() + } + } } } - fn path(&self, builder: &Builder<'_>) -> PathBuf { + /// A convenience wrapper for Steps which know they have no aliases and all their sets contain only a single path. + /// + /// This can be used with [`ShouldRun::krate`], [`ShouldRun::path`], or [`ShouldRun::alias`]. + #[track_caller] + pub fn assert_single_path(&self) -> &TaskPath { match self { PathSet::Set(set) => { - set.iter().next().map(|p| &p.path).unwrap_or(&builder.build.src).clone() + assert_eq!(set.len(), 1, "called assert_single_path on multiple paths"); + set.iter().next().unwrap() } - PathSet::Suite(path) => path.path.clone(), + PathSet::Suite(_) => unreachable!("called assert_single_path on a Suite path"), } } } @@ -213,8 +257,8 @@ impl StepDescription { } } - fn maybe_run(&self, builder: &Builder<'_>, pathset: &PathSet) { - if self.is_excluded(builder, pathset) { + fn maybe_run(&self, builder: &Builder<'_>, pathsets: Vec<PathSet>) { + if pathsets.iter().any(|set| self.is_excluded(builder, set)) { return; } @@ -222,7 +266,7 @@ impl StepDescription { let targets = if self.only_hosts { &builder.hosts } else { &builder.targets }; for target in targets { - let run = RunConfig { builder, path: pathset.path(builder), target: *target }; + let run = RunConfig { builder, paths: pathsets.clone(), target: *target }; (self.make_run)(run); } } @@ -261,46 +305,55 @@ impl StepDescription { for (desc, should_run) in v.iter().zip(&should_runs) { if desc.default && should_run.is_really_default() { for pathset in &should_run.paths { - desc.maybe_run(builder, pathset); + desc.maybe_run(builder, vec![pathset.clone()]); } } } } - for path in paths { - // strip CurDir prefix if present - let path = match path.strip_prefix(".") { - Ok(p) => p, - Err(_) => path, - }; + // strip CurDir prefix if present + let mut paths: Vec<_> = + paths.into_iter().map(|p| p.strip_prefix(".").unwrap_or(p)).collect(); - let mut attempted_run = false; + // Handle all test suite paths. + // (This is separate from the loop below to avoid having to handle multiple paths in `is_suite_path` somehow.) + paths.retain(|path| { for (desc, should_run) in v.iter().zip(&should_runs) { - if let Some(suite) = should_run.is_suite_path(path) { - attempted_run = true; - desc.maybe_run(builder, suite); - } else if let Some(pathset) = should_run.pathset_for_path(path, desc.kind) { - attempted_run = true; - desc.maybe_run(builder, pathset); + if let Some(suite) = should_run.is_suite_path(&path) { + desc.maybe_run(builder, vec![suite.clone()]); + return false; } } + true + }); - if !attempted_run { - eprintln!( - "error: no `{}` rules matched '{}'", - builder.kind.as_str(), - path.display() - ); - eprintln!( - "help: run `x.py {} --help --verbose` to show a list of available paths", - builder.kind.as_str() - ); - eprintln!( - "note: if you are adding a new Step to bootstrap itself, make sure you register it with `describe!`" - ); - std::process::exit(1); + if paths.is_empty() { + return; + } + + // Handle all PathSets. + for (desc, should_run) in v.iter().zip(&should_runs) { + let pathsets = should_run.pathset_for_paths_removing_matches(&mut paths, desc.kind); + if !pathsets.is_empty() { + desc.maybe_run(builder, pathsets); } } + + if !paths.is_empty() { + eprintln!("error: no `{}` rules matched {:?}", builder.kind.as_str(), paths,); + eprintln!( + "help: run `x.py {} --help --verbose` to show a list of available paths", + builder.kind.as_str() + ); + eprintln!( + "note: if you are adding a new Step to bootstrap itself, make sure you register it with `describe!`" + ); + #[cfg(not(test))] + std::process::exit(1); + #[cfg(test)] + // so we can use #[should_panic] + panic!() + } } } @@ -370,7 +423,7 @@ impl<'a> ShouldRun<'a> { /// Indicates it should run if the command-line selects the given crate or /// any of its (local) dependencies. /// - /// `make_run` will be called separately for each matching command-line path. + /// `make_run` will be called a single time with all matching command-line paths. pub fn krate(mut self, name: &str) -> Self { for krate in self.builder.in_tree_crates(name, None) { let path = krate.local_path(self.builder); @@ -417,9 +470,10 @@ impl<'a> ShouldRun<'a> { self } - pub fn is_suite_path(&self, path: &Path) -> Option<&PathSet> { + /// Handles individual files (not directories) within a test suite. + fn is_suite_path(&self, requested_path: &Path) -> Option<&PathSet> { self.paths.iter().find(|pathset| match pathset { - PathSet::Suite(p) => path.starts_with(&p.path), + PathSet::Suite(suite) => requested_path.starts_with(&suite.path), PathSet::Set(_) => false, }) } @@ -435,8 +489,28 @@ impl<'a> ShouldRun<'a> { self } - fn pathset_for_path(&self, path: &Path, kind: Kind) -> Option<&PathSet> { - self.paths.iter().find(|pathset| pathset.has(path, Some(kind))) + /// Given a set of requested paths, return the subset which match the Step for this `ShouldRun`, + /// removing the matches from `paths`. + /// + /// NOTE: this returns multiple PathSets to allow for the possibility of multiple units of work + /// within the same step. For example, `test::Crate` allows testing multiple crates in the same + /// cargo invocation, which are put into separate sets because they aren't aliases. + /// + /// The reason we return PathSet instead of PathBuf is to allow for aliases that mean the same thing + /// (for now, just `all_krates` and `paths`, but we may want to add an `aliases` function in the future?) + fn pathset_for_paths_removing_matches( + &self, + paths: &mut Vec<&Path>, + kind: Kind, + ) -> Vec<PathSet> { + let mut sets = vec![]; + for pathset in &self.paths { + let subset = pathset.intersection_removing_matches(paths, Some(kind)); + if subset != PathSet::empty() { + sets.push(subset); + } + } + sets } } @@ -870,20 +944,23 @@ impl<'a> Builder<'a> { self.try_run(patchelf.arg(fname)); } - pub(crate) fn download_component( - &self, - base: &str, - url: &str, - dest_path: &Path, - help_on_error: &str, - ) { + pub(crate) fn download_component(&self, url: &str, dest_path: &Path, help_on_error: &str) { // Use a temporary file in case we crash while downloading, to avoid a corrupt download in cache/. let tempfile = self.tempdir().join(dest_path.file_name().unwrap()); - self.download_with_retries(&tempfile, &format!("{}/{}", base, url), help_on_error); + // While bootstrap itself only supports http and https downloads, downstream forks might + // need to download components from other protocols. The match allows them adding more + // protocols without worrying about merge conficts if we change the HTTP implementation. + match url.split_once("://").map(|(proto, _)| proto) { + Some("http") | Some("https") => { + self.download_http_with_retries(&tempfile, url, help_on_error) + } + Some(other) => panic!("unsupported protocol {other} in {url}"), + None => panic!("no protocol in {url}"), + } t!(std::fs::rename(&tempfile, dest_path)); } - fn download_with_retries(&self, tempfile: &Path, url: &str, help_on_error: &str) { + fn download_http_with_retries(&self, tempfile: &Path, url: &str, help_on_error: &str) { println!("downloading {}", url); // Try curl. If that fails and we are on windows, fallback to PowerShell. let mut curl = Command::new("curl"); diff --git a/src/bootstrap/builder/tests.rs b/src/bootstrap/builder/tests.rs index 4ab502e9052..70cb0de7cce 100644 --- a/src/bootstrap/builder/tests.rs +++ b/src/bootstrap/builder/tests.rs @@ -3,7 +3,11 @@ use crate::config::{Config, TargetSelection}; use std::thread; fn configure(cmd: &str, host: &[&str], target: &[&str]) -> Config { - let mut config = Config::parse(&[cmd.to_owned()]); + configure_with_args(&[cmd.to_owned()], host, target) +} + +fn configure_with_args(cmd: &[String], host: &[&str], target: &[&str]) -> Config { + let mut config = Config::parse(cmd); // don't save toolstates config.save_toolstates = None; config.dry_run = true; @@ -46,6 +50,41 @@ fn run_build(paths: &[PathBuf], config: Config) -> Cache { builder.cache } +fn check_cli<const N: usize>(paths: [&str; N]) { + run_build( + &paths.map(PathBuf::from), + configure_with_args(&paths.map(String::from), &["A"], &["A"]), + ); +} + +#[test] +fn test_valid() { + // make sure multi suite paths are accepted + check_cli(["test", "src/test/ui/attr-start.rs", "src/test/ui/attr-shebang.rs"]); +} + +#[test] +#[should_panic] +fn test_invalid() { + // make sure that invalid paths are caught, even when combined with valid paths + check_cli(["test", "library/std", "x"]); +} + +#[test] +fn test_intersection() { + let set = PathSet::Set( + ["library/core", "library/alloc", "library/std"].into_iter().map(TaskPath::parse).collect(), + ); + let mut command_paths = + vec![Path::new("library/core"), Path::new("library/alloc"), Path::new("library/stdarch")]; + let subset = set.intersection_removing_matches(&mut command_paths, None); + assert_eq!( + subset, + PathSet::Set(["library/core", "library/alloc"].into_iter().map(TaskPath::parse).collect()) + ); + assert_eq!(command_paths, vec![Path::new("library/stdarch")]); +} + #[test] fn test_exclude() { let mut config = configure("test", &["A"], &["A"]); @@ -539,7 +578,7 @@ mod dist { target: host, mode: Mode::Std, test_kind: test::TestKind::Test, - krate: INTERNER.intern_str("std"), + crates: vec![INTERNER.intern_str("std")], },] ); } diff --git a/src/bootstrap/cache.rs b/src/bootstrap/cache.rs index fac5d8db511..97f0bfdc484 100644 --- a/src/bootstrap/cache.rs +++ b/src/bootstrap/cache.rs @@ -270,7 +270,7 @@ impl Cache { #[cfg(test)] impl Cache { - pub fn all<S: Ord + Copy + Step>(&mut self) -> Vec<(S, S::Output)> { + pub fn all<S: Ord + Clone + Step>(&mut self) -> Vec<(S, S::Output)> { let cache = self.0.get_mut(); let type_id = TypeId::of::<S>(); let mut v = cache @@ -278,7 +278,7 @@ impl Cache { .map(|b| b.downcast::<HashMap<S, S::Output>>().expect("correct type")) .map(|m| m.into_iter().collect::<Vec<_>>()) .unwrap_or_default(); - v.sort_by_key(|&(a, _)| a); + v.sort_by_key(|(s, _)| s.clone()); v } diff --git a/src/bootstrap/compile.rs b/src/bootstrap/compile.rs index 9958fc26be7..b4807d1ab3a 100644 --- a/src/bootstrap/compile.rs +++ b/src/bootstrap/compile.rs @@ -730,6 +730,7 @@ pub fn rustc_cargo_env(builder: &Builder<'_>, cargo: &mut Cargo, target: TargetS && !target.contains("freebsd") && !target.contains("msvc") && !target.contains("apple") + && !target.contains("solaris") { let file = compiler_file( builder, diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs index 28663af135c..14607741932 100644 --- a/src/bootstrap/config.rs +++ b/src/bootstrap/config.rs @@ -20,7 +20,6 @@ use crate::channel::GitInfo; pub use crate::flags::Subcommand; use crate::flags::{Color, Flags}; use crate::util::{exe, output, program_out_of_date, t}; -use crate::RustfmtMetadata; use once_cell::sync::OnceCell; use serde::{Deserialize, Deserializer}; @@ -73,6 +72,7 @@ pub struct Config { pub test_compare_mode: bool, pub color: Color, pub patch_binaries_for_nix: bool, + pub stage0_metadata: Stage0Metadata, pub on_fail: Option<String>, pub stage: u32, @@ -212,6 +212,28 @@ pub struct Config { pub out: PathBuf, } +#[derive(Default, Deserialize)] +#[cfg_attr(test, derive(Clone))] +pub struct Stage0Metadata { + pub config: Stage0Config, + pub checksums_sha256: HashMap<String, String>, + pub rustfmt: Option<RustfmtMetadata>, +} +#[derive(Default, Deserialize)] +#[cfg_attr(test, derive(Clone))] +pub struct Stage0Config { + pub dist_server: String, + pub artifacts_server: String, + pub artifacts_with_llvm_assertions_server: String, + pub git_merge_commit_email: String, +} +#[derive(Default, Deserialize)] +#[cfg_attr(test, derive(Clone))] +pub struct RustfmtMetadata { + pub date: String, + pub version: String, +} + #[derive(Clone, Debug)] pub enum RustfmtState { SystemToolchain(PathBuf), @@ -776,6 +798,9 @@ impl Config { config.llvm_profile_use = flags.llvm_profile_use; config.llvm_profile_generate = flags.llvm_profile_generate; + let stage0_json = t!(std::fs::read(&config.src.join("src").join("stage0.json"))); + config.stage0_metadata = t!(serde_json::from_slice::<Stage0Metadata>(&stage0_json)); + #[cfg(test)] let get_toml = |_| TomlConfig::default(); #[cfg(not(test))] @@ -1103,8 +1128,11 @@ impl Config { config.rust_codegen_units_std = rust.codegen_units_std.map(threads_from_config); config.rust_profile_use = flags.rust_profile_use.or(rust.profile_use); config.rust_profile_generate = flags.rust_profile_generate.or(rust.profile_generate); - config.download_rustc_commit = - download_ci_rustc_commit(rust.download_rustc, config.verbose > 0); + config.download_rustc_commit = download_ci_rustc_commit( + &config.stage0_metadata, + rust.download_rustc, + config.verbose > 0, + ); } else { config.rust_profile_use = flags.rust_profile_use; config.rust_profile_generate = flags.rust_profile_generate; @@ -1424,7 +1452,11 @@ fn threads_from_config(v: u32) -> u32 { } /// Returns the commit to download, or `None` if we shouldn't download CI artifacts. -fn download_ci_rustc_commit(download_rustc: Option<StringOrBool>, verbose: bool) -> Option<String> { +fn download_ci_rustc_commit( + stage0_metadata: &Stage0Metadata, + download_rustc: Option<StringOrBool>, + verbose: bool, +) -> Option<String> { // If `download-rustc` is not set, default to rebuilding. let if_unchanged = match download_rustc { None | Some(StringOrBool::Bool(false)) => return None, @@ -1443,13 +1475,12 @@ fn download_ci_rustc_commit(download_rustc: Option<StringOrBool>, verbose: bool) // Look for a version to compare to based on the current commit. // Only commits merged by bors will have CI artifacts. - let merge_base = output(Command::new("git").args(&[ - "rev-list", - "--author=bors@rust-lang.org", - "-n1", - "--first-parent", - "HEAD", - ])); + let merge_base = output( + Command::new("git") + .arg("rev-list") + .arg(format!("--author={}", stage0_metadata.config.git_merge_commit_email)) + .args(&["-n1", "--first-parent", "HEAD"]), + ); let commit = merge_base.trim_end(); if commit.is_empty() { println!("error: could not find commit hash for downloading rustc"); @@ -1484,7 +1515,7 @@ fn download_ci_rustc_commit(download_rustc: Option<StringOrBool>, verbose: bool) } fn maybe_download_rustfmt(builder: &Builder<'_>) -> Option<PathBuf> { - let RustfmtMetadata { date, version } = builder.stage0_metadata.rustfmt.as_ref()?; + let RustfmtMetadata { date, version } = builder.config.stage0_metadata.rustfmt.as_ref()?; let channel = format!("{version}-{date}"); let host = builder.config.build; @@ -1568,13 +1599,13 @@ fn download_component( let tarball = cache_dir.join(&filename); let (base_url, url, should_verify) = match mode { DownloadSource::CI => ( - "https://ci-artifacts.rust-lang.org/rustc-builds".to_string(), + builder.config.stage0_metadata.config.artifacts_server.clone(), format!("{key}/{filename}"), false, ), DownloadSource::Dist => { let dist_server = env::var("RUSTUP_DIST_SERVER") - .unwrap_or(builder.stage0_metadata.dist_server.to_string()); + .unwrap_or(builder.config.stage0_metadata.config.dist_server.to_string()); // NOTE: make `dist` part of the URL because that's how it's stored in src/stage0.json (dist_server, format!("dist/{key}/{filename}"), true) } @@ -1590,7 +1621,7 @@ fn download_component( target at this time, see https://doc.rust-lang.org/nightly\ /rustc/platform-support.html for more information." ); - let sha256 = builder.stage0_metadata.checksums_sha256.get(&url).expect(&error); + let sha256 = builder.config.stage0_metadata.checksums_sha256.get(&url).expect(&error); if tarball.exists() { if builder.verify(&tarball, sha256) { builder.unpack(&tarball, &bin_root, prefix); @@ -1610,7 +1641,7 @@ fn download_component( None }; - builder.download_component(&base_url, &url, &tarball, ""); + builder.download_component(&format!("{base_url}/{url}"), &tarball, ""); if let Some(sha256) = checksum { if !builder.verify(&tarball, sha256) { panic!("failed to verify {}", tarball.display()); diff --git a/src/bootstrap/dist.rs b/src/bootstrap/dist.rs index b5901ce6f74..b1fae356d89 100644 --- a/src/bootstrap/dist.rs +++ b/src/bootstrap/dist.rs @@ -845,7 +845,12 @@ impl Step for PlainSourceTarball { /// Creates the plain source tarball fn run(self, builder: &Builder<'_>) -> GeneratedTarball { - let tarball = Tarball::new(builder, "rustc", "src"); + // NOTE: This is a strange component in a lot of ways. It uses `src` as the target, which + // means neither rustup nor rustup-toolchain-install-master know how to download it. + // It also contains symbolic links, unlike other any other dist tarball. + // It's used for distros building rustc from source in a pre-vendored environment. + let mut tarball = Tarball::new(builder, "rustc", "src"); + tarball.permit_symlinks(true); let plain_dst_src = tarball.image_dir(); // This is the set of root paths which will become part of the source package @@ -1847,7 +1852,6 @@ fn add_env(builder: &Builder<'_>, cmd: &mut Command, target: TargetSelection) { /// Maybe add LLVM object files to the given destination lib-dir. Allows either static or dynamic linking. /// - /// Returns whether the files were actually copied. fn maybe_install_llvm(builder: &Builder<'_>, target: TargetSelection, dst_libdir: &Path) -> bool { if let Some(config) = builder.config.target_config.get(&target) { @@ -1957,6 +1961,8 @@ impl Step for LlvmTools { } } + builder.ensure(crate::native::Llvm { target }); + let mut tarball = Tarball::new(builder, "llvm-tools", &target.triple); tarball.set_overlay(OverlayKind::LLVM); tarball.is_preview(true); diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs index b4333566f07..4ac857b470e 100644 --- a/src/bootstrap/lib.rs +++ b/src/bootstrap/lib.rs @@ -118,7 +118,6 @@ use std::os::windows::fs::symlink_file; use filetime::FileTime; use once_cell::sync::OnceCell; -use serde::Deserialize; use crate::builder::Kind; use crate::config::{LlvmLibunwind, TargetSelection}; @@ -171,6 +170,7 @@ mod job { pub unsafe fn setup(_build: &mut crate::Build) {} } +pub use crate::builder::PathSet; use crate::cache::{Interned, INTERNER}; pub use crate::config::Config; pub use crate::flags::Subcommand; @@ -294,8 +294,6 @@ pub struct Build { hosts: Vec<TargetSelection>, targets: Vec<TargetSelection>, - // Stage 0 (downloaded) compiler, lld and cargo or their local rust equivalents - stage0_metadata: Stage0Metadata, initial_rustc: PathBuf, initial_cargo: PathBuf, initial_lld: PathBuf, @@ -322,18 +320,6 @@ pub struct Build { metrics: metrics::BuildMetrics, } -#[derive(Deserialize)] -struct Stage0Metadata { - dist_server: String, - checksums_sha256: HashMap<String, String>, - rustfmt: Option<RustfmtMetadata>, -} -#[derive(Deserialize)] -struct RustfmtMetadata { - date: String, - version: String, -} - #[derive(Debug)] struct Crate { name: Interned<String>, @@ -482,11 +468,7 @@ impl Build { bootstrap_out }; - let stage0_json = t!(std::fs::read_to_string(&src.join("src").join("stage0.json"))); - let stage0_metadata = t!(serde_json::from_str::<Stage0Metadata>(&stage0_json)); - let mut build = Build { - stage0_metadata, initial_rustc: config.initial_rustc.clone(), initial_cargo: config.initial_cargo.clone(), initial_lld, @@ -1445,6 +1427,10 @@ impl Build { /// Copies a file from `src` to `dst` pub fn copy(&self, src: &Path, dst: &Path) { + self.copy_internal(src, dst, false); + } + + fn copy_internal(&self, src: &Path, dst: &Path, dereference_symlinks: bool) { if self.config.dry_run { return; } @@ -1454,15 +1440,22 @@ impl Build { } let _ = fs::remove_file(&dst); let metadata = t!(src.symlink_metadata()); + let mut src = src.to_path_buf(); if metadata.file_type().is_symlink() { - let link = t!(fs::read_link(src)); - t!(symlink_file(link, dst)); - } else if let Ok(()) = fs::hard_link(src, dst) { + if dereference_symlinks { + src = t!(fs::canonicalize(src)); + } else { + let link = t!(fs::read_link(src)); + t!(symlink_file(link, dst)); + return; + } + } + if let Ok(()) = fs::hard_link(&src, dst) { // Attempt to "easy copy" by creating a hard link // (symlinks don't work on windows), but if that fails // just fall back to a slow `copy` operation. } else { - if let Err(e) = fs::copy(src, dst) { + if let Err(e) = fs::copy(&src, dst) { panic!("failed to copy `{}` to `{}`: {}", src.display(), dst.display(), e) } t!(fs::set_permissions(dst, metadata.permissions())); @@ -1534,20 +1527,10 @@ impl Build { let dst = dstdir.join(src.file_name().unwrap()); self.verbose_than(1, &format!("Install {:?} to {:?}", src, dst)); t!(fs::create_dir_all(dstdir)); - drop(fs::remove_file(&dst)); - { - if !src.exists() { - panic!("Error: File \"{}\" not found!", src.display()); - } - let metadata = t!(src.symlink_metadata()); - if let Err(e) = fs::copy(&src, &dst) { - panic!("failed to copy `{}` to `{}`: {}", src.display(), dst.display(), e) - } - t!(fs::set_permissions(&dst, metadata.permissions())); - let atime = FileTime::from_last_access_time(&metadata); - let mtime = FileTime::from_last_modification_time(&metadata); - t!(filetime::set_file_times(&dst, atime, mtime)); + if !src.exists() { + panic!("Error: File \"{}\" not found!", src.display()); } + self.copy_internal(src, &dst, true); chmod(&dst, perms); } diff --git a/src/bootstrap/native.rs b/src/bootstrap/native.rs index e23498873f3..329bb68672e 100644 --- a/src/bootstrap/native.rs +++ b/src/bootstrap/native.rs @@ -121,7 +121,7 @@ pub(crate) fn maybe_download_ci_llvm(builder: &Builder<'_>) { let mut rev_list = Command::new("git"); rev_list.args(&[ PathBuf::from("rev-list"), - "--author=bors@rust-lang.org".into(), + format!("--author={}", builder.config.stage0_metadata.config.git_merge_commit_email).into(), "-n1".into(), "--first-parent".into(), "HEAD".into(), @@ -170,11 +170,10 @@ fn download_ci_llvm(builder: &Builder<'_>, llvm_sha: &str) { if !rustc_cache.exists() { t!(fs::create_dir_all(&rustc_cache)); } - let base = "https://ci-artifacts.rust-lang.org"; - let url = if llvm_assertions { - format!("rustc-builds-alt/{}", llvm_sha) + let base = if llvm_assertions { + &builder.config.stage0_metadata.config.artifacts_with_llvm_assertions_server } else { - format!("rustc-builds/{}", llvm_sha) + &builder.config.stage0_metadata.config.artifacts_server }; let filename = format!("rust-dev-nightly-{}.tar.xz", builder.build.build.triple); let tarball = rustc_cache.join(&filename); @@ -187,7 +186,11 @@ help: if trying to compile an old commit of rustc, disable `download-ci-llvm` in [llvm] download-ci-llvm = false "; - builder.download_component(base, &format!("{}/{}", url, filename), &tarball, help_on_error); + builder.download_component( + &format!("{base}/{llvm_sha}/{filename}"), + &tarball, + help_on_error, + ); } let llvm_root = builder.config.ci_llvm_root(); builder.unpack(&tarball, &llvm_root, "rust-dev"); @@ -655,7 +658,7 @@ fn configure_cmake( // For distribution we want the LLVM tools to be *statically* linked to libstdc++. // We also do this if the user explicitly requested static libstdc++. if builder.config.llvm_static_stdcpp { - if !target.contains("msvc") && !target.contains("netbsd") { + if !target.contains("msvc") && !target.contains("netbsd") && !target.contains("solaris") { if target.contains("apple") || target.contains("windows") { ldflags.push_all("-static-libstdc++"); } else { diff --git a/src/bootstrap/tarball.rs b/src/bootstrap/tarball.rs index 689b4819cdd..7b0c029c191 100644 --- a/src/bootstrap/tarball.rs +++ b/src/bootstrap/tarball.rs @@ -102,6 +102,7 @@ pub(crate) struct Tarball<'a> { include_target_in_component_name: bool, is_preview: bool, + permit_symlinks: bool, } impl<'a> Tarball<'a> { @@ -141,6 +142,7 @@ impl<'a> Tarball<'a> { include_target_in_component_name: false, is_preview: false, + permit_symlinks: false, } } @@ -160,6 +162,10 @@ impl<'a> Tarball<'a> { self.is_preview = is; } + pub(crate) fn permit_symlinks(&mut self, flag: bool) { + self.permit_symlinks = flag; + } + pub(crate) fn image_dir(&self) -> &Path { t!(std::fs::create_dir_all(&self.image_dir)); &self.image_dir @@ -316,6 +322,18 @@ impl<'a> Tarball<'a> { } self.builder.run(&mut cmd); + // Ensure there are no symbolic links in the tarball. In particular, + // rustup-toolchain-install-master and most versions of Windows can't handle symbolic links. + let decompressed_output = self.temp_dir.join(&package_name); + if !self.builder.config.dry_run && !self.permit_symlinks { + for entry in walkdir::WalkDir::new(&decompressed_output) { + let entry = t!(entry); + if entry.path_is_symlink() { + panic!("generated a symlink in a tarball: {}", entry.path().display()); + } + } + } + // Use either the first compression format defined, or "gz" as the default. let ext = self .builder @@ -328,7 +346,7 @@ impl<'a> Tarball<'a> { GeneratedTarball { path: crate::dist::distdir(self.builder).join(format!("{}.tar.{}", package_name, ext)), - decompressed_output: self.temp_dir.join(package_name), + decompressed_output, work: self.temp_dir, } } diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs index fdce078bbed..9958306b576 100644 --- a/src/bootstrap/test.rs +++ b/src/bootstrap/test.rs @@ -1856,12 +1856,12 @@ impl Step for RustcGuide { } } -#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] +#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct CrateLibrustc { compiler: Compiler, target: TargetSelection, test_kind: TestKind, - krate: Interned<String>, + crates: Vec<Interned<String>>, } impl Step for CrateLibrustc { @@ -1877,10 +1877,14 @@ impl Step for CrateLibrustc { let builder = run.builder; let host = run.build_triple(); let compiler = builder.compiler_for(builder.top_stage, host, host); - let krate = builder.crate_paths[&run.path]; + let crates = run + .paths + .iter() + .map(|p| builder.crate_paths[&p.assert_single_path().path].clone()) + .collect(); let test_kind = builder.kind.into(); - builder.ensure(CrateLibrustc { compiler, target: run.target, test_kind, krate }); + builder.ensure(CrateLibrustc { compiler, target: run.target, test_kind, crates }); } fn run(self, builder: &Builder<'_>) { @@ -1889,18 +1893,18 @@ impl Step for CrateLibrustc { target: self.target, mode: Mode::Rustc, test_kind: self.test_kind, - krate: self.krate, + crates: self.crates, }); } } -#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] +#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] pub struct Crate { pub compiler: Compiler, pub target: TargetSelection, pub mode: Mode, pub test_kind: TestKind, - pub krate: Interned<String>, + pub crates: Vec<Interned<String>>, } impl Step for Crate { @@ -1916,9 +1920,13 @@ impl Step for Crate { let host = run.build_triple(); let compiler = builder.compiler_for(builder.top_stage, host, host); let test_kind = builder.kind.into(); - let krate = builder.crate_paths[&run.path]; + let crates = run + .paths + .iter() + .map(|p| builder.crate_paths[&p.assert_single_path().path].clone()) + .collect(); - builder.ensure(Crate { compiler, target: run.target, mode: Mode::Std, test_kind, krate }); + builder.ensure(Crate { compiler, target: run.target, mode: Mode::Std, test_kind, crates }); } /// Runs all unit tests plus documentation tests for a given crate defined @@ -1934,7 +1942,6 @@ impl Step for Crate { let target = self.target; let mode = self.mode; let test_kind = self.test_kind; - let krate = self.krate; builder.ensure(compile::Std { compiler, target }); builder.ensure(RemoteCopyLibs { compiler, target }); @@ -1975,7 +1982,9 @@ impl Step for Crate { DocTests::Yes => {} } - cargo.arg("-p").arg(krate); + for krate in &self.crates { + cargo.arg("-p").arg(krate); + } // The tests are going to run with the *target* libraries, so we need to // ensure that those libraries show up in the LD_LIBRARY_PATH equivalent. @@ -2011,8 +2020,8 @@ impl Step for Crate { } builder.info(&format!( - "{} {} stage{} ({} -> {})", - test_kind, krate, compiler.stage, &compiler.host, target + "{} {:?} stage{} ({} -> {})", + test_kind, self.crates, compiler.stage, &compiler.host, target )); let _time = util::timeit(&builder); try_run(builder, &mut cargo.into()); diff --git a/src/bootstrap/tool.rs b/src/bootstrap/tool.rs index b7abf6cc78d..905fa431d29 100644 --- a/src/bootstrap/tool.rs +++ b/src/bootstrap/tool.rs @@ -692,6 +692,7 @@ macro_rules! tool_extended { stable = $stable:expr, $(in_tree = $in_tree:expr,)? $(submodule = $submodule:literal,)? + $(tool_std = $tool_std:literal,)? $extra_deps:block;)+) => { $( #[derive(Debug, Clone, Hash, PartialEq, Eq)] @@ -740,7 +741,7 @@ macro_rules! tool_extended { compiler: $sel.compiler, target: $sel.target, tool: $tool_name, - mode: Mode::ToolRustc, + mode: if false $(|| $tool_std)? { Mode::ToolStd } else { Mode::ToolRustc }, path: $path, extra_features: $sel.extra_features, is_optional_tool: true, @@ -774,7 +775,10 @@ tool_extended!((self, builder), }); self.extra_features.push("clippy".to_owned()); }; - RustDemangler, rust_demangler, "src/tools/rust-demangler", "rust-demangler", stable=false, in_tree=true, {}; + // FIXME: tool_std is not quite right, we shouldn't allow nightly features. + // But `builder.cargo` doesn't know how to handle ToolBootstrap in stages other than 0, + // and this is close enough for now. + RustDemangler, rust_demangler, "src/tools/rust-demangler", "rust-demangler", stable=false, in_tree=true, tool_std=true, {}; Rustfmt, rustfmt, "src/tools/rustfmt", "rustfmt", stable=true, in_tree=true, {}; RustAnalyzer, rust_analyzer, "src/tools/rust-analyzer/crates/rust-analyzer", "rust-analyzer", stable=false, submodule="rust-analyzer", {}; ); diff --git a/src/ci/docker/host-x86_64/dist-various-2/Dockerfile b/src/ci/docker/host-x86_64/dist-various-2/Dockerfile index a045666ca8a..6f9980dbc86 100644 --- a/src/ci/docker/host-x86_64/dist-various-2/Dockerfile +++ b/src/ci/docker/host-x86_64/dist-various-2/Dockerfile @@ -52,9 +52,9 @@ ENV \ CFLAGS_x86_64_fortanix_unknown_sgx="-D__ELF__ -isystem/usr/include/x86_64-linux-gnu -mlvi-hardening -mllvm -x86-experimental-lvi-inline-asm-hardening" \ CXX_x86_64_fortanix_unknown_sgx=clang++-11 \ CXXFLAGS_x86_64_fortanix_unknown_sgx="-D__ELF__ -isystem/usr/include/x86_64-linux-gnu -mlvi-hardening -mllvm -x86-experimental-lvi-inline-asm-hardening" \ - AR_i686_unknown_freebsd=i686-unknown-freebsd11-ar \ - CC_i686_unknown_freebsd=i686-unknown-freebsd11-clang \ - CXX_i686_unknown_freebsd=i686-unknown-freebsd11-clang++ \ + AR_i686_unknown_freebsd=i686-unknown-freebsd12-ar \ + CC_i686_unknown_freebsd=i686-unknown-freebsd12-clang \ + CXX_i686_unknown_freebsd=i686-unknown-freebsd12-clang++ \ CC=gcc-8 \ CXX=g++-8 diff --git a/src/ci/docker/host-x86_64/dist-x86_64-freebsd/Dockerfile b/src/ci/docker/host-x86_64/dist-x86_64-freebsd/Dockerfile index 121dd3f455a..f9b1fa8951a 100644 --- a/src/ci/docker/host-x86_64/dist-x86_64-freebsd/Dockerfile +++ b/src/ci/docker/host-x86_64/dist-x86_64-freebsd/Dockerfile @@ -27,9 +27,9 @@ COPY scripts/cmake.sh /scripts/ RUN /scripts/cmake.sh ENV \ - AR_x86_64_unknown_freebsd=x86_64-unknown-freebsd11-ar \ - CC_x86_64_unknown_freebsd=x86_64-unknown-freebsd11-clang \ - CXX_x86_64_unknown_freebsd=x86_64-unknown-freebsd11-clang++ + AR_x86_64_unknown_freebsd=x86_64-unknown-freebsd12-ar \ + CC_x86_64_unknown_freebsd=x86_64-unknown-freebsd12-clang \ + CXX_x86_64_unknown_freebsd=x86_64-unknown-freebsd12-clang++ ENV HOSTS=x86_64-unknown-freebsd diff --git a/src/ci/docker/scripts/freebsd-toolchain.sh b/src/ci/docker/scripts/freebsd-toolchain.sh index 2f7c57bcdc4..4a4cac1b723 100755 --- a/src/ci/docker/scripts/freebsd-toolchain.sh +++ b/src/ci/docker/scripts/freebsd-toolchain.sh @@ -5,8 +5,8 @@ set -eux arch=$1 binutils_version=2.25.1 -freebsd_version=11.4 -triple=$arch-unknown-freebsd11 +freebsd_version=12.3 +triple=$arch-unknown-freebsd12 sysroot=/usr/local/$triple hide_output() { @@ -59,7 +59,7 @@ done # Originally downloaded from: # URL=https://download.freebsd.org/ftp/releases/${freebsd_arch}/${freebsd_version}-RELEASE/base.txz -URL=https://ci-mirrors.rust-lang.org/rustc/2020-08-09-freebsd-${freebsd_arch}-${freebsd_version}-RELEASE-base.txz +URL=https://ci-mirrors.rust-lang.org/rustc/2022-05-06-freebsd-${freebsd_version}-${freebsd_arch}-base.txz curl "$URL" | tar xJf - -C "$sysroot" --wildcards "${files_to_extract[@]}" # Clang can do cross-builds out of the box, if we give it the right @@ -68,7 +68,7 @@ curl "$URL" | tar xJf - -C "$sysroot" --wildcards "${files_to_extract[@]}" # there might be other problems.) # # The --target option is last because the cross-build of LLVM uses -# --target without an OS version ("-freebsd" vs. "-freebsd11"). This +# --target without an OS version ("-freebsd" vs. "-freebsd12"). This # makes Clang default to libstdc++ (which no longer exists), and also # controls other features, like GNU-style symbol table hashing and # anything predicated on the version number in the __FreeBSD__ diff --git a/src/ci/init_repo.sh b/src/ci/init_repo.sh index ec45d9e8bc6..e8c1e2b0f59 100755 --- a/src/ci/init_repo.sh +++ b/src/ci/init_repo.sh @@ -48,7 +48,10 @@ function fetch_github_commit_archive { rm $cached } -included="src/llvm-project src/doc/book src/doc/rust-by-example" +# Archive downloads are temporarily disabled due to sudden 504 +# gateway timeout errors. +# included="src/llvm-project src/doc/book src/doc/rust-by-example" +included="" modules="$(git config --file .gitmodules --get-regexp '\.path$' | cut -d' ' -f2)" modules=($modules) use_git="" @@ -71,10 +74,10 @@ for i in ${!modules[@]}; do done retry sh -c "git submodule deinit -f $use_git && \ git submodule sync && \ - git submodule update -j 16 --init --recursive $use_git" -STATUS=0 -for pid in ${bg_pids[*]} -do - wait $pid || STATUS=1 -done -exit ${STATUS} + git submodule update -j 16 --init --recursive --depth 1 $use_git" +# STATUS=0 +# for pid in ${bg_pids[*]} +# do +# wait $pid || STATUS=1 +# done +# exit ${STATUS} diff --git a/src/doc/unstable-book/src/compiler-flags/extern-options.md b/src/doc/unstable-book/src/compiler-flags/extern-options.md new file mode 100644 index 00000000000..858eee5d2c2 --- /dev/null +++ b/src/doc/unstable-book/src/compiler-flags/extern-options.md @@ -0,0 +1,22 @@ +# `--extern` Options + +The behavior of the `--extern` flag can be modified with `noprelude`, `priv` or `nounused` options. + +This is unstable feature, so you have to provide `-Zunstable-options` to enable it. + +## Examples + +Use your own build of the `core` crate. + +`rustc main.rs -Z unstable-options --extern noprelude:core=libcore.rlib` + +To use multiple options, separate them with a comma: + +`rustc main.rs -Z unstable-options --extern noprelude,priv,nounused:mydep=mydep.rlib` + +## Options + +* `noprelude`: Do not add the crate to the external prelude. If used, it will need to be imported using `extern crate`. + This is used by the [build-std project](https://github.com/rust-lang/wg-cargo-std-aware/) to simulate compatibility with sysroot-only crates. +* `priv`: Mark the crate as a private dependency for the [`exported_private_dependencies`](../../rustc/lints/listing/warn-by-default.html#exported-private-dependencies) lint. +* `nounused`: Suppress [`unused-crate-dependencies`](../../rustc/lints/listing/allowed-by-default.html#unused-crate-dependencies) warnings for the crate. diff --git a/src/doc/unstable-book/src/language-features/lang-items.md b/src/doc/unstable-book/src/language-features/lang-items.md index 86bedb51538..39238dffa10 100644 --- a/src/doc/unstable-book/src/language-features/lang-items.md +++ b/src/doc/unstable-book/src/language-features/lang-items.md @@ -23,8 +23,10 @@ use core::panic::PanicInfo; extern crate libc; +struct Unique<T>(*mut T); + #[lang = "owned_box"] -pub struct Box<T>(*mut T); +pub struct Box<T>(Unique<T>); #[lang = "exchange_malloc"] unsafe fn allocate(size: usize, _align: usize) -> *mut u8 { diff --git a/src/etc/cpu-usage-over-time-plot.sh b/src/etc/cpu-usage-over-time-plot.sh index 0905789079a..1c342559194 100755 --- a/src/etc/cpu-usage-over-time-plot.sh +++ b/src/etc/cpu-usage-over-time-plot.sh @@ -7,13 +7,21 @@ # commit SHA of the build you're interested in, and the second is the name of # the builder. For example: # -# ./src/etc/cpu-usage-over-time-plot.sh e699ea096fcc2fc9ce8e8bcf884e11496a31cc9f i686-mingw-1 +# ./src/etc/cpu-usage-over-time-plot.sh 7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c x86_64-gnu # # That will generate `$builder.png` in the current directory which you can open # up to see a hopefully pretty graph. # # Improvements to this script are greatly appreciated! +if [[ $# != 2 ]]; then + echo "expected 2 arguments, recieved $#" + echo "example usage: './src/etc/cpu-usage-over-time-plot.sh \ +7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c \ +x86_64-gnu'" + exit 1 +fi + set -ex bucket=rust-lang-ci2 @@ -30,7 +38,7 @@ set ylabel "CPU Usage %" set xlabel "Time" set datafile sep ',' set term png size 3000,1000 -set output "$builder.png" +set output "$builder-$commit-cpu-usage-plot.png" set grid f(x) = mean_y @@ -43,7 +51,9 @@ set ytics 10 set boxwidth 0.5 plot \\ - mean_y with lines linetype 1 linecolor rgb "#ff0000" title "average", \\ - "cpu-$builder.csv" using 1:(100-\$2) with points pointtype 7 pointsize 0.4 title "$builder", \\ - "" using 1:(100-\$2) smooth bezier linewidth 3 title "bezier" + mean_y with lines linetype 1 linecolor rgb "#ff0000" title "average", "cpu-$builder.csv" \\ + using 1:(100-\$2) with points pointtype 7 pointsize 0.4 title "$builder", "" \\ + using 1:(100-\$2) smooth bezier linewidth 3 title "bezier" EOF + +rm "cpu-$builder.csv" diff --git a/src/etc/htmldocck.py b/src/etc/htmldocck.py index f762e389005..70b6af717cd 100644 --- a/src/etc/htmldocck.py +++ b/src/etc/htmldocck.py @@ -417,7 +417,7 @@ def check_snapshot(snapshot_name, actual_tree, normalize_to_text): snapshot_path = '{}.{}.{}'.format(rust_test_path[:-3], snapshot_name, 'html') try: with open(snapshot_path, 'r') as snapshot_file: - expected_str = snapshot_file.read() + expected_str = snapshot_file.read().replace("{{channel}}", channel) except FileNotFoundError: if bless: expected_str = None @@ -429,8 +429,6 @@ def check_snapshot(snapshot_name, actual_tree, normalize_to_text): else: actual_str = flatten(actual_tree) - expected_str = expected_str.replace("{{channel}}", channel) - # Conditions: # 1. Is --bless # 2. Are actual and expected tree different diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index fd30691c324..9e5c4afc717 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -222,10 +222,15 @@ impl<'tcx> Clean<'tcx, Option<Lifetime>> for ty::Region<'tcx> { match **self { ty::ReStatic => Some(Lifetime::statik()), ty::ReLateBound(_, ty::BoundRegion { kind: ty::BrNamed(_, name), .. }) => { - Some(Lifetime(name)) + if name != kw::UnderscoreLifetime { Some(Lifetime(name)) } else { None } + } + ty::ReEarlyBound(ref data) => { + if data.name != kw::UnderscoreLifetime { + Some(Lifetime(data.name)) + } else { + None + } } - ty::ReEarlyBound(ref data) => Some(Lifetime(data.name)), - ty::ReLateBound(..) | ty::ReFree(..) | ty::ReVar(..) @@ -530,29 +535,25 @@ fn clean_generic_param<'tcx>( GenericParamDef { name, kind } } +/// Synthetic type-parameters are inserted after normal ones. +/// In order for normal parameters to be able to refer to synthetic ones, +/// scans them first. +fn is_impl_trait(param: &hir::GenericParam<'_>) -> bool { + match param.kind { + hir::GenericParamKind::Type { synthetic, .. } => synthetic, + _ => false, + } +} + +/// This can happen for `async fn`, e.g. `async fn f<'_>(&'_ self)`. +/// +/// See `lifetime_to_generic_param` in `rustc_ast_lowering` for more information. +fn is_elided_lifetime(param: &hir::GenericParam<'_>) -> bool { + matches!(param.kind, hir::GenericParamKind::Lifetime { kind: hir::LifetimeParamKind::Elided }) +} + impl<'tcx> Clean<'tcx, Generics> for hir::Generics<'tcx> { fn clean(&self, cx: &mut DocContext<'tcx>) -> Generics { - // Synthetic type-parameters are inserted after normal ones. - // In order for normal parameters to be able to refer to synthetic ones, - // scans them first. - fn is_impl_trait(param: &hir::GenericParam<'_>) -> bool { - match param.kind { - hir::GenericParamKind::Type { synthetic, .. } => synthetic, - _ => false, - } - } - /// This can happen for `async fn`, e.g. `async fn f<'_>(&'_ self)`. - /// - /// See [`lifetime_to_generic_param`] in [`rustc_ast_lowering`] for more information. - /// - /// [`lifetime_to_generic_param`]: rustc_ast_lowering::LoweringContext::lifetime_to_generic_param - fn is_elided_lifetime(param: &hir::GenericParam<'_>) -> bool { - matches!( - param.kind, - hir::GenericParamKind::Lifetime { kind: hir::LifetimeParamKind::Elided } - ) - } - let impl_trait_params = self .params .iter() @@ -991,6 +992,7 @@ impl<'tcx> Clean<'tcx, PolyTrait> for hir::PolyTraitRef<'tcx> { generic_params: self .bound_generic_params .iter() + .filter(|p| !is_elided_lifetime(p)) .map(|x| clean_generic_param(cx, None, x)) .collect(), } @@ -1865,8 +1867,12 @@ impl<'tcx> Clean<'tcx, BareFunctionDecl> for hir::BareFnTy<'tcx> { fn clean(&self, cx: &mut DocContext<'tcx>) -> BareFunctionDecl { let (generic_params, decl) = enter_impl_trait(cx, |cx| { // NOTE: generics must be cleaned before args - let generic_params = - self.generic_params.iter().map(|x| clean_generic_param(cx, None, x)).collect(); + let generic_params = self + .generic_params + .iter() + .filter(|p| !is_elided_lifetime(p)) + .map(|x| clean_generic_param(cx, None, x)) + .collect(); let args = clean_args_from_types_and_names(cx, self.decl.inputs, self.param_names); let decl = clean_fn_decl_with_args(cx, self.decl, args); (generic_params, decl) diff --git a/src/librustdoc/clean/types.rs b/src/librustdoc/clean/types.rs index 83ab9acd300..2762d5e8502 100644 --- a/src/librustdoc/clean/types.rs +++ b/src/librustdoc/clean/types.rs @@ -1,10 +1,10 @@ use std::cell::RefCell; use std::default::Default; use std::hash::Hash; -use std::lazy::SyncOnceCell as OnceCell; use std::path::PathBuf; use std::rc::Rc; use std::sync::Arc; +use std::sync::OnceLock as OnceCell; use std::{cmp, fmt, iter}; use arrayvec::ArrayVec; diff --git a/src/librustdoc/clean/utils.rs b/src/librustdoc/clean/utils.rs index 41ab0e9377d..16574f94c00 100644 --- a/src/librustdoc/clean/utils.rs +++ b/src/librustdoc/clean/utils.rs @@ -84,12 +84,9 @@ pub(crate) fn substs_to_args<'tcx>( let mut ret_val = Vec::with_capacity(substs.len().saturating_sub(if skip_first { 1 } else { 0 })); ret_val.extend(substs.iter().filter_map(|kind| match kind.unpack() { - GenericArgKind::Lifetime(lt) => match *lt { - ty::ReLateBound(_, ty::BoundRegion { kind: ty::BrAnon(_), .. }) => { - Some(GenericArg::Lifetime(Lifetime::elided())) - } - _ => lt.clean(cx).map(GenericArg::Lifetime), - }, + GenericArgKind::Lifetime(lt) => { + Some(GenericArg::Lifetime(lt.clean(cx).unwrap_or(Lifetime::elided()))) + } GenericArgKind::Type(_) if skip_first => { skip_first = false; None diff --git a/src/librustdoc/core.rs b/src/librustdoc/core.rs index 53281bfde2e..51b245e36ba 100644 --- a/src/librustdoc/core.rs +++ b/src/librustdoc/core.rs @@ -21,9 +21,9 @@ use rustc_span::symbol::sym; use rustc_span::{source_map, Span, Symbol}; use std::cell::RefCell; -use std::lazy::SyncLazy; use std::mem; use std::rc::Rc; +use std::sync::LazyLock; use crate::clean::inline::build_external_trait; use crate::clean::{self, ItemId, TraitWithExtraInfo}; @@ -293,8 +293,8 @@ pub(crate) fn create_config( providers.typeck_item_bodies = |_, _| {}; // hack so that `used_trait_imports` won't try to call typeck providers.used_trait_imports = |_, _| { - static EMPTY_SET: SyncLazy<FxHashSet<LocalDefId>> = - SyncLazy::new(FxHashSet::default); + static EMPTY_SET: LazyLock<FxHashSet<LocalDefId>> = + LazyLock::new(FxHashSet::default); &EMPTY_SET }; // In case typeck does end up being called, don't ICE in case there were name resolution errors diff --git a/src/librustdoc/doctest.rs b/src/librustdoc/doctest.rs index 86c58cd79dc..ab72f4a3f50 100644 --- a/src/librustdoc/doctest.rs +++ b/src/librustdoc/doctest.rs @@ -365,8 +365,8 @@ fn run_test( } compiler.arg("--target").arg(match target { TargetTriple::TargetTriple(s) => s, - TargetTriple::TargetPath(path) => { - path.to_str().expect("target path must be valid unicode").to_string() + TargetTriple::TargetJson { path_for_rustdoc, .. } => { + path_for_rustdoc.to_str().expect("target path must be valid unicode").to_string() } }); if let ErrorOutputType::HumanReadable(kind) = rustdoc_options.error_format { diff --git a/src/librustdoc/html/format.rs b/src/librustdoc/html/format.rs index 0c0920ae63e..5baa53d5554 100644 --- a/src/librustdoc/html/format.rs +++ b/src/librustdoc/html/format.rs @@ -23,6 +23,8 @@ use rustc_span::symbol::kw; use rustc_span::{sym, Symbol}; use rustc_target::spec::abi::Abi; +use itertools::Itertools; + use crate::clean::{ self, types::ExternalLocation, utils::find_nearest_parent_module, ExternalCrate, ItemId, PrimitiveType, @@ -874,20 +876,42 @@ fn fmt_type<'cx>( match &typs[..] { &[] => primitive_link(f, PrimitiveType::Unit, "()", cx), &[ref one] => { - primitive_link(f, PrimitiveType::Tuple, "(", cx)?; - // Carry `f.alternate()` into this display w/o branching manually. - fmt::Display::fmt(&one.print(cx), f)?; - primitive_link(f, PrimitiveType::Tuple, ",)", cx) + if let clean::Generic(name) = one { + primitive_link(f, PrimitiveType::Tuple, &format!("({name},)"), cx) + } else { + write!(f, "(")?; + // Carry `f.alternate()` into this display w/o branching manually. + fmt::Display::fmt(&one.print(cx), f)?; + write!(f, ",)") + } } many => { - primitive_link(f, PrimitiveType::Tuple, "(", cx)?; - for (i, item) in many.iter().enumerate() { - if i != 0 { - write!(f, ", ")?; + let generic_names: Vec<Symbol> = many + .iter() + .filter_map(|t| match t { + clean::Generic(name) => Some(*name), + _ => None, + }) + .collect(); + let is_generic = generic_names.len() == many.len(); + if is_generic { + primitive_link( + f, + PrimitiveType::Tuple, + &format!("({})", generic_names.iter().map(|s| s.as_str()).join(", ")), + cx, + ) + } else { + write!(f, "(")?; + for (i, item) in many.iter().enumerate() { + if i != 0 { + write!(f, ", ")?; + } + // Carry `f.alternate()` into this display w/o branching manually. + fmt::Display::fmt(&item.print(cx), f)?; } - fmt::Display::fmt(&item.print(cx), f)?; + write!(f, ")") } - primitive_link(f, PrimitiveType::Tuple, ")", cx) } } } diff --git a/src/librustdoc/html/layout.rs b/src/librustdoc/html/layout.rs index de54347a0f7..7d6d4b71e2e 100644 --- a/src/librustdoc/html/layout.rs +++ b/src/librustdoc/html/layout.rs @@ -31,8 +31,6 @@ pub(crate) struct Page<'a> { pub(crate) description: &'a str, pub(crate) keywords: &'a str, pub(crate) resource_suffix: &'a str, - pub(crate) extra_scripts: &'a [&'a str], - pub(crate) static_extra_scripts: &'a [&'a str], } impl<'a> Page<'a> { diff --git a/src/librustdoc/html/render/context.rs b/src/librustdoc/html/render/context.rs index 68e2f0cf9c0..bfdc44c7e45 100644 --- a/src/librustdoc/html/render/context.rs +++ b/src/librustdoc/html/render/context.rs @@ -211,8 +211,6 @@ impl<'tcx> Context<'tcx> { description: &desc, keywords: &keywords, resource_suffix: &clone_shared.resource_suffix, - extra_scripts: &[], - static_extra_scripts: &[], }; let mut page_buffer = Buffer::html(); print_item(self, it, &mut page_buffer, &page); @@ -568,8 +566,6 @@ impl<'tcx> FormatRenderer<'tcx> for Context<'tcx> { description: "List of all items in this crate", keywords: BASIC_KEYWORDS, resource_suffix: &shared.resource_suffix, - extra_scripts: &[], - static_extra_scripts: &[], }; let sidebar = if shared.cache.crate_version.is_some() { format!("<h2 class=\"location\">Crate {}</h2>", crate_name) @@ -693,7 +689,7 @@ impl<'tcx> FormatRenderer<'tcx> for Context<'tcx> { else { unreachable!() }; let items = self.build_sidebar_items(module); let js_dst = self.dst.join(&format!("sidebar-items{}.js", self.shared.resource_suffix)); - let v = format!("initSidebarItems({});", serde_json::to_string(&items).unwrap()); + let v = format!("window.SIDEBAR_ITEMS = {};", serde_json::to_string(&items).unwrap()); self.shared.fs.write(js_dst, v)?; } Ok(()) diff --git a/src/librustdoc/html/render/mod.rs b/src/librustdoc/html/render/mod.rs index cb887d16906..3f426ee93e7 100644 --- a/src/librustdoc/html/render/mod.rs +++ b/src/librustdoc/html/render/mod.rs @@ -56,7 +56,7 @@ use rustc_middle::middle::stability; use rustc_middle::ty; use rustc_middle::ty::TyCtxt; use rustc_span::{ - symbol::{kw, sym, Symbol}, + symbol::{sym, Symbol}, BytePos, FileName, RealFileName, }; use serde::ser::SerializeSeq; @@ -1738,8 +1738,6 @@ pub(crate) fn render_impl_summary( } fn print_sidebar(cx: &Context<'_>, it: &clean::Item, buffer: &mut Buffer) { - let parentlen = cx.current.len() - if it.is_mod() { 1 } else { 0 }; - if it.is_struct() || it.is_trait() || it.is_primitive() @@ -1800,21 +1798,6 @@ fn print_sidebar(cx: &Context<'_>, it: &clean::Item, buffer: &mut Buffer) { write!(buffer, "<h2 class=\"location\"><a href=\"index.html\">In {}</a></h2>", path); } - // Sidebar refers to the enclosing module, not this module. - let relpath = if it.is_mod() && parentlen != 0 { "./" } else { "" }; - write!( - buffer, - "<div id=\"sidebar-vars\" data-name=\"{name}\" data-ty=\"{ty}\" data-relpath=\"{path}\">\ - </div>", - name = it.name.unwrap_or(kw::Empty), - ty = it.type_(), - path = relpath - ); - write!( - buffer, - "<script defer src=\"{}sidebar-items{}.js\"></script>", - relpath, cx.shared.resource_suffix - ); // Closes sidebar-elems div. buffer.write_str("</div>"); } diff --git a/src/librustdoc/html/render/write_shared.rs b/src/librustdoc/html/render/write_shared.rs index 8f08ff2ece3..27ad91d09e0 100644 --- a/src/librustdoc/html/render/write_shared.rs +++ b/src/librustdoc/html/render/write_shared.rs @@ -3,9 +3,9 @@ use std::fmt::Write; use std::fs::{self, File}; use std::io::prelude::*; use std::io::{self, BufReader}; -use std::lazy::SyncLazy as Lazy; use std::path::{Component, Path, PathBuf}; use std::rc::Rc; +use std::sync::LazyLock as Lazy; use itertools::Itertools; use rustc_data_structures::flock; @@ -475,8 +475,6 @@ if (typeof exports !== 'undefined') {exports.searchIndex = searchIndex}; description: "List of crates", keywords: BASIC_KEYWORDS, resource_suffix: &shared.resource_suffix, - extra_scripts: &[], - static_extra_scripts: &[], }; let content = format!( diff --git a/src/librustdoc/html/sources.rs b/src/librustdoc/html/sources.rs index 524c90e1f4d..1971d08e5be 100644 --- a/src/librustdoc/html/sources.rs +++ b/src/librustdoc/html/sources.rs @@ -203,8 +203,6 @@ impl SourceCollector<'_, '_> { description: &desc, keywords: BASIC_KEYWORDS, resource_suffix: &shared.resource_suffix, - extra_scripts: &[&format!("source-files{}", shared.resource_suffix)], - static_extra_scripts: &[&format!("source-script{}", shared.resource_suffix)], }; let v = layout::render( &shared.layout, diff --git a/src/librustdoc/html/static/.eslintrc.js b/src/librustdoc/html/static/.eslintrc.js index fc8b5678080..2817a8fe144 100644 --- a/src/librustdoc/html/static/.eslintrc.js +++ b/src/librustdoc/html/static/.eslintrc.js @@ -89,5 +89,7 @@ module.exports = { "no-multi-assign": "error", "no-return-assign": "error", "no-script-url": "error", + "no-sequences": "error", + "no-throw-literal": "error", } }; diff --git a/src/librustdoc/html/static/js/main.js b/src/librustdoc/html/static/js/main.js index 414bca850e3..b320db91046 100644 --- a/src/librustdoc/html/static/js/main.js +++ b/src/librustdoc/html/static/js/main.js @@ -66,26 +66,18 @@ function showMain() { (function() { window.rootPath = getVar("root-path"); window.currentCrate = getVar("current-crate"); - window.searchJS = resourcePath("search", ".js"); - window.searchIndexJS = resourcePath("search-index", ".js"); - window.settingsJS = resourcePath("settings", ".js"); - const sidebarVars = document.getElementById("sidebar-vars"); - if (sidebarVars) { - window.sidebarCurrent = { - name: sidebarVars.attributes["data-name"].value, - ty: sidebarVars.attributes["data-ty"].value, - relpath: sidebarVars.attributes["data-relpath"].value, - }; - // FIXME: It would be nicer to generate this text content directly in HTML, - // but with the current code it's hard to get the right information in the right place. - const mobileLocationTitle = document.querySelector(".mobile-topbar h2.location"); - const locationTitle = document.querySelector(".sidebar h2.location"); - if (mobileLocationTitle && locationTitle) { - mobileLocationTitle.innerHTML = locationTitle.innerHTML; - } - } }()); +function setMobileTopbar() { + // FIXME: It would be nicer to generate this text content directly in HTML, + // but with the current code it's hard to get the right information in the right place. + const mobileLocationTitle = document.querySelector(".mobile-topbar h2.location"); + const locationTitle = document.querySelector(".sidebar h2.location"); + if (mobileLocationTitle && locationTitle) { + mobileLocationTitle.innerHTML = locationTitle.innerHTML; + } +} + // Gets the human-readable string for the virtual-key code of the // given KeyboardEvent, ev. // @@ -227,7 +219,7 @@ function loadCss(cssFileName) { // Sending request for the CSS and the JS files at the same time so it will // hopefully be loaded when the JS will generate the settings content. loadCss("settings"); - loadScript(window.settingsJS); + loadScript(resourcePath("settings", ".js")); }; window.searchState = { @@ -304,8 +296,8 @@ function loadCss(cssFileName) { function loadSearch() { if (!searchLoaded) { searchLoaded = true; - loadScript(window.searchJS); - loadScript(window.searchIndexJS); + loadScript(resourcePath("search", ".js")); + loadScript(resourcePath("search-index", ".js")); } } @@ -485,40 +477,11 @@ function loadCss(cssFileName) { document.addEventListener("keypress", handleShortcut); document.addEventListener("keydown", handleShortcut); - // delayed sidebar rendering. - window.initSidebarItems = items => { - const sidebar = document.getElementsByClassName("sidebar-elems")[0]; - let others; - const current = window.sidebarCurrent; - - function addSidebarCrates(crates) { - if (!hasClass(document.body, "crate")) { - // We only want to list crates on the crate page. - return; - } - // Draw a convenient sidebar of known crates if we have a listing - const div = document.createElement("div"); - div.className = "block crate"; - div.innerHTML = "<h3>Crates</h3>"; - const ul = document.createElement("ul"); - div.appendChild(ul); - - for (const crate of crates) { - let klass = "crate"; - if (window.rootPath !== "./" && crate === window.currentCrate) { - klass += " current"; - } - const link = document.createElement("a"); - link.href = window.rootPath + crate + "/index.html"; - link.className = klass; - link.textContent = crate; - - const li = document.createElement("li"); - li.appendChild(link); - ul.appendChild(li); - } - others.appendChild(div); + function addSidebarItems() { + if (!window.SIDEBAR_ITEMS) { + return; } + const sidebar = document.getElementsByClassName("sidebar-elems")[0]; /** * Append to the sidebar a "block" of links - a heading along with a list (`<ul>`) of items. @@ -529,7 +492,7 @@ function loadCss(cssFileName) { * "Modules", or "Macros". */ function block(shortty, id, longty) { - const filtered = items[shortty]; + const filtered = window.SIDEBAR_ITEMS[shortty]; if (!filtered) { return; } @@ -546,17 +509,18 @@ function loadCss(cssFileName) { const desc = item[1]; // can be null let klass = shortty; - if (name === current.name && shortty === current.ty) { - klass += " current"; - } let path; if (shortty === "mod") { path = name + "/index.html"; } else { path = shortty + "." + name + ".html"; } + const current_page = document.location.href.split("/").pop(); + if (path === current_page) { + klass += " current"; + } const link = document.createElement("a"); - link.href = current.relpath + path; + link.href = path; link.title = desc; link.className = klass; link.textContent = name; @@ -565,14 +529,10 @@ function loadCss(cssFileName) { ul.appendChild(li); } div.appendChild(ul); - others.appendChild(div); + sidebar.appendChild(div); } if (sidebar) { - others = document.createElement("div"); - others.className = "others"; - sidebar.appendChild(others); - const isModule = hasClass(document.body, "mod"); if (!isModule) { block("primitive", "primitives", "Primitive Types"); @@ -590,12 +550,8 @@ function loadCss(cssFileName) { block("keyword", "keywords", "Keywords"); block("traitalias", "trait-aliases", "Trait Aliases"); } - - // `crates{version}.js` should always be loaded before this script, so we can use - // it safely. - addSidebarCrates(window.ALL_CRATES); } - }; + } window.register_implementors = imp => { const implementors = document.getElementById("implementors-list"); @@ -680,6 +636,39 @@ function loadCss(cssFileName) { window.register_implementors(window.pending_implementors); } + function addSidebarCrates() { + if (!window.ALL_CRATES) { + return; + } + const sidebarElems = document.getElementsByClassName("sidebar-elems")[0]; + if (!sidebarElems) { + return; + } + // Draw a convenient sidebar of known crates if we have a listing + const div = document.createElement("div"); + div.className = "block crate"; + div.innerHTML = "<h3>Crates</h3>"; + const ul = document.createElement("ul"); + div.appendChild(ul); + + for (const crate of window.ALL_CRATES) { + let klass = "crate"; + if (window.rootPath !== "./" && crate === window.currentCrate) { + klass += " current"; + } + const link = document.createElement("a"); + link.href = window.rootPath + crate + "/index.html"; + link.className = klass; + link.textContent = crate; + + const li = document.createElement("li"); + li.appendChild(link); + ul.appendChild(li); + } + sidebarElems.appendChild(div); + } + + function labelForToggleButton(sectionIsCollapsed) { if (sectionIsCollapsed) { // button will expand the section @@ -924,6 +913,9 @@ function loadCss(cssFileName) { buildHelperPopup = () => {}; }; + setMobileTopbar(); + addSidebarItems(); + addSidebarCrates(); onHashChange(null); window.addEventListener("hashchange", onHashChange); searchState.setup(); diff --git a/src/librustdoc/html/static/js/search.js b/src/librustdoc/html/static/js/search.js index c726aeeff47..cb1609d4983 100644 --- a/src/librustdoc/html/static/js/search.js +++ b/src/librustdoc/html/static/js/search.js @@ -1333,10 +1333,7 @@ function initSearch(rawSearchIndex) { if (searchWord.indexOf(elem.pathLast) > -1 || row.normalizedName.indexOf(elem.pathLast) > -1 ) { - // filter type: ... queries - if (!results_others[fullId] !== undefined) { - index = row.normalizedName.indexOf(elem.pathLast); - } + index = row.normalizedName.indexOf(elem.pathLast); } lev = levenshtein(searchWord, elem.pathLast); if (lev > 0 && elem.pathLast.length > 2 && searchWord.indexOf(elem.pathLast) > -1) { @@ -1722,10 +1719,11 @@ function initSearch(rawSearchIndex) { } let crates = ""; - if (window.ALL_CRATES.length > 1) { + const crates_list = Object.keys(rawSearchIndex); + if (crates_list.length > 1) { crates = " in <select id=\"crate-search\"><option value=\"All crates\">" + "All crates</option>"; - for (const c of window.ALL_CRATES) { + for (const c of crates_list) { crates += `<option value="${c}" ${c === filterCrates && "selected"}>${c}</option>`; } crates += "</select>"; diff --git a/src/librustdoc/html/static/js/source-script.js b/src/librustdoc/html/static/js/source-script.js index 14d8a942977..10f93a1c058 100644 --- a/src/librustdoc/html/static/js/source-script.js +++ b/src/librustdoc/html/static/js/source-script.js @@ -9,33 +9,19 @@ (function() { -function getCurrentFilePath() { - const parts = window.location.pathname.split("/"); - const rootPathParts = window.rootPath.split("/"); +const rootPath = document.getElementById("rustdoc-vars").attributes["data-root-path"].value; - for (const rootPathPart of rootPathParts) { - if (rootPathPart === "..") { - parts.pop(); - } - } - let file = window.location.pathname.substring(parts.join("/").length); - if (file.startsWith("/")) { - file = file.substring(1); - } - return file.substring(0, file.length - 5); -} - -function createDirEntry(elem, parent, fullPath, currentFile, hasFoundFile) { +function createDirEntry(elem, parent, fullPath, hasFoundFile) { const name = document.createElement("div"); name.className = "name"; fullPath += elem["name"] + "/"; - name.onclick = () => { - if (hasClass(name, "expand")) { - removeClass(name, "expand"); + name.onclick = ev => { + if (hasClass(ev.target, "expand")) { + removeClass(ev.target, "expand"); } else { - addClass(name, "expand"); + addClass(ev.target, "expand"); } }; name.innerText = elem["name"]; @@ -46,7 +32,7 @@ function createDirEntry(elem, parent, fullPath, currentFile, hasFoundFile) { folders.className = "folders"; if (elem.dirs) { for (const dir of elem.dirs) { - if (createDirEntry(dir, folders, fullPath, currentFile, hasFoundFile)) { + if (createDirEntry(dir, folders, fullPath, hasFoundFile)) { addClass(name, "expand"); hasFoundFile = true; } @@ -60,8 +46,9 @@ function createDirEntry(elem, parent, fullPath, currentFile, hasFoundFile) { for (const file_text of elem.files) { const file = document.createElement("a"); file.innerText = file_text; - file.href = window.rootPath + "src/" + fullPath + file_text + ".html"; - if (!hasFoundFile && currentFile === fullPath + file_text) { + file.href = rootPath + "src/" + fullPath + file_text + ".html"; + const w = window.location.href.split("#")[0]; + if (!hasFoundFile && w === file.href) { file.className = "selected"; addClass(name, "expand"); hasFoundFile = true; @@ -72,7 +59,7 @@ function createDirEntry(elem, parent, fullPath, currentFile, hasFoundFile) { children.appendChild(files); parent.appendChild(name); parent.appendChild(children); - return hasFoundFile && currentFile.startsWith(fullPath); + return hasFoundFile; } function toggleSidebar() { @@ -109,9 +96,6 @@ function createSidebarToggle() { // This function is called from "source-files.js", generated in `html/render/mod.rs`. // eslint-disable-next-line no-unused-vars function createSourceSidebar() { - if (!window.rootPath.endsWith("/")) { - window.rootPath += "/"; - } const container = document.querySelector("nav.sidebar"); const sidebarToggle = createSidebarToggle(); @@ -125,7 +109,6 @@ function createSourceSidebar() { container.classList.add("expanded"); } - const currentFile = getCurrentFilePath(); let hasFoundFile = false; const title = document.createElement("div"); @@ -135,7 +118,7 @@ function createSourceSidebar() { Object.keys(sourcesIndex).forEach(key => { sourcesIndex[key].name = key; hasFoundFile = createDirEntry(sourcesIndex[key], sidebar, "", - currentFile, hasFoundFile); + hasFoundFile); }); container.appendChild(sidebar); diff --git a/src/librustdoc/html/templates/page.html b/src/librustdoc/html/templates/page.html index cd672aadd7e..c4999e2c74f 100644 --- a/src/librustdoc/html/templates/page.html +++ b/src/librustdoc/html/templates/page.html @@ -34,17 +34,18 @@ {%- endfor -%} ></script> {#- -#} <script src="{{static_root_path|safe}}storage{{page.resource_suffix}}.js"></script> {#- -#} - <script src="{{page.root_path|safe}}crates{{page.resource_suffix}}.js"></script> {#- -#} + {%- if page.css_class.contains("crate") -%} + <script defer src="{{page.root_path|safe}}crates{{page.resource_suffix}}.js"></script> {#- -#} + {%- else if page.css_class == "source" -%} + <script defer src="{{static_root_path|safe}}source-script{{page.resource_suffix}}.js"></script> {#- -#} + <script defer src="{{page.root_path|safe}}source-files{{page.resource_suffix}}.js"></script> {#- -#} + {%- else -%} + <script defer src="sidebar-items{{page.resource_suffix}}.js"></script> {#- -#} + {%- endif -%} <script defer src="{{static_root_path|safe}}main{{page.resource_suffix}}.js"></script> {#- -#} - {%- for script in page.static_extra_scripts -%} - <script defer src="{{static_root_path|safe}}{{script}}.js"></script> {#- -#} - {% endfor %} {%- if layout.scrape_examples_extension -%} <script defer src="{{page.root_path|safe}}scrape-examples{{page.resource_suffix}}.js"></script> {#- -#} {%- endif -%} - {%- for script in page.extra_scripts -%} - <script defer src="{{page.root_path|safe}}{{script}}.js"></script> {#- -#} - {% endfor %} <noscript> {#- -#} <link rel="stylesheet" {# -#} href="{{static_root_path|safe}}noscript{{page.resource_suffix}}.css"> {#- -#} diff --git a/src/librustdoc/json/mod.rs b/src/librustdoc/json/mod.rs index 0964b757e74..c7251b51152 100644 --- a/src/librustdoc/json/mod.rs +++ b/src/librustdoc/json/mod.rs @@ -201,7 +201,8 @@ impl<'tcx> FormatRenderer<'tcx> for JsonRenderer<'tcx> { types::ItemEnum::Method(_) | types::ItemEnum::AssocConst { .. } - | types::ItemEnum::AssocType { .. } => true, + | types::ItemEnum::AssocType { .. } + | types::ItemEnum::PrimitiveType(_) => true, types::ItemEnum::Module(_) | types::ItemEnum::ExternCrate { .. } | types::ItemEnum::Import(_) @@ -216,8 +217,7 @@ impl<'tcx> FormatRenderer<'tcx> for JsonRenderer<'tcx> { | types::ItemEnum::Static(_) | types::ItemEnum::ForeignType | types::ItemEnum::Macro(_) - | types::ItemEnum::ProcMacro(_) - | types::ItemEnum::PrimitiveType(_) => false, + | types::ItemEnum::ProcMacro(_) => false, }; let removed = self .index diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs index ea842a85070..54b85166041 100644 --- a/src/librustdoc/lib.rs +++ b/src/librustdoc/lib.rs @@ -36,7 +36,6 @@ extern crate tracing; // Dependencies listed in Cargo.toml do not need `extern crate`. extern crate rustc_ast; -extern crate rustc_ast_lowering; extern crate rustc_ast_pretty; extern crate rustc_attr; extern crate rustc_const_eval; diff --git a/src/librustdoc/lint.rs b/src/librustdoc/lint.rs index 08a1a868521..240aec52cff 100644 --- a/src/librustdoc/lint.rs +++ b/src/librustdoc/lint.rs @@ -3,7 +3,7 @@ use rustc_lint::LintStore; use rustc_lint_defs::{declare_tool_lint, Lint, LintId}; use rustc_session::{lint, Session}; -use std::lazy::SyncLazy as Lazy; +use std::sync::LazyLock as Lazy; /// This function is used to setup the lint initialization. By default, in rustdoc, everything /// is "allowed". Depending if we run in test mode or not, we want some of them to be at their diff --git a/src/librustdoc/passes/bare_urls.rs b/src/librustdoc/passes/bare_urls.rs index e9e810658ef..392e26ea6ac 100644 --- a/src/librustdoc/passes/bare_urls.rs +++ b/src/librustdoc/passes/bare_urls.rs @@ -9,8 +9,8 @@ use core::ops::Range; use pulldown_cmark::{Event, Parser, Tag}; use regex::Regex; use rustc_errors::Applicability; -use std::lazy::SyncLazy; use std::mem; +use std::sync::LazyLock; pub(crate) const CHECK_BARE_URLS: Pass = Pass { name: "check-bare-urls", @@ -18,7 +18,7 @@ pub(crate) const CHECK_BARE_URLS: Pass = Pass { description: "detects URLs that are not hyperlinks", }; -static URL_REGEX: SyncLazy<Regex> = SyncLazy::new(|| { +static URL_REGEX: LazyLock<Regex> = LazyLock::new(|| { Regex::new(concat!( r"https?://", // url scheme r"([-a-zA-Z0-9@:%._\+~#=]{2,256}\.)+", // one or more subdomains diff --git a/src/librustdoc/passes/collect_intra_doc_links/early.rs b/src/librustdoc/passes/collect_intra_doc_links/early.rs index a38c44bc888..38cfd7a27dd 100644 --- a/src/librustdoc/passes/collect_intra_doc_links/early.rs +++ b/src/librustdoc/passes/collect_intra_doc_links/early.rs @@ -5,7 +5,6 @@ use crate::passes::collect_intra_doc_links::{Disambiguator, PreprocessedMarkdown use rustc_ast::visit::{self, AssocCtxt, Visitor}; use rustc_ast::{self as ast, ItemKind}; -use rustc_ast_lowering::ResolverAstLowering; use rustc_data_structures::fx::FxHashMap; use rustc_hir::def::Namespace::*; use rustc_hir::def::{DefKind, Namespace, Res}; diff --git a/src/librustdoc/scrape_examples.rs b/src/librustdoc/scrape_examples.rs index da09ae9dd06..f6c599297fc 100644 --- a/src/librustdoc/scrape_examples.rs +++ b/src/librustdoc/scrape_examples.rs @@ -18,7 +18,7 @@ use rustc_middle::hir::nested_filter; use rustc_middle::ty::{self, TyCtxt}; use rustc_serialize::{ opaque::{FileEncoder, MemDecoder}, - Decodable, Encodable, Encoder, + Decodable, Encodable, }; use rustc_session::getopts; use rustc_span::{ diff --git a/src/stage0.json b/src/stage0.json index 6371b9eae59..b6b502f4cf0 100644 --- a/src/stage0.json +++ b/src/stage0.json @@ -1,6 +1,20 @@ { - "__comment": "Generated by `./x.py run src/tools/bump-stage0`. Run that command again to update the bootstrap compiler.", - "dist_server": "https://static.rust-lang.org", + "config": { + "dist_server": "https://static.rust-lang.org", + "artifacts_server": "https://ci-artifacts.rust-lang.org/rustc-builds", + "artifacts_with_llvm_assertions_server": "https://ci-artifacts.rust-lang.org/rustc-builds-alt", + "git_merge_commit_email": "bors@rust-lang.org" + }, + "__comments": [ + "The configuration above this comment is editable, and can be changed", + "by forks of the repository if they have alternate values.", + "", + "The section below is generated by `./x.py run src/tools/bump-stage0`,", + "run that command again to update the bootstrap compiler.", + "", + "All changes below this comment will be overridden the next time the", + "tool is executed." + ], "compiler": { "date": "2022-05-20", "version": "beta" diff --git a/src/test/codegen/loads.rs b/src/test/codegen/loads.rs index 07de385193f..f448306ba1b 100644 --- a/src/test/codegen/loads.rs +++ b/src/test/codegen/loads.rs @@ -28,93 +28,93 @@ pub fn ptr_alignment_helper(x: &&()) {} // CHECK-LABEL: @load_ref #[no_mangle] pub fn load_ref<'a>(x: &&'a i32) -> &'a i32 { -// CHECK: load {{i32\*|ptr}}, {{i32\*\*|ptr}} %x, align [[PTR_ALIGNMENT]], !nonnull !{{[0-9]+}}, !align ![[ALIGN_4_META:[0-9]+]], !noundef !{{[0-9]+}} + // CHECK: load {{i32\*|ptr}}, {{i32\*\*|ptr}} %x, align [[PTR_ALIGNMENT]], !nonnull !{{[0-9]+}}, !align ![[ALIGN_4_META:[0-9]+]], !noundef !{{[0-9]+}} *x } // CHECK-LABEL: @load_ref_higher_alignment #[no_mangle] pub fn load_ref_higher_alignment<'a>(x: &&'a Align16) -> &'a Align16 { -// CHECK: load {{%Align16\*|i128\*|ptr}}, {{%Align16\*\*|i128\*\*|ptr}} %x, align [[PTR_ALIGNMENT]], !nonnull !{{[0-9]+}}, !align ![[ALIGN_16_META:[0-9]+]], !noundef !{{[0-9]+}} + // CHECK: load {{%Align16\*|i128\*|ptr}}, {{%Align16\*\*|i128\*\*|ptr}} %x, align [[PTR_ALIGNMENT]], !nonnull !{{[0-9]+}}, !align ![[ALIGN_16_META:[0-9]+]], !noundef !{{[0-9]+}} *x } // CHECK-LABEL: @load_scalar_pair #[no_mangle] pub fn load_scalar_pair<'a>(x: &(&'a i32, &'a Align16)) -> (&'a i32, &'a Align16) { -// CHECK: load {{i32\*|ptr}}, {{i32\*\*|ptr}} %{{.+}}, align [[PTR_ALIGNMENT]], !nonnull !{{[0-9]+}}, !align ![[ALIGN_4_META]], !noundef !{{[0-9]+}} -// CHECK: load {{i64\*|ptr}}, {{i64\*\*|ptr}} %{{.+}}, align [[PTR_ALIGNMENT]], !nonnull !{{[0-9]+}}, !align ![[ALIGN_16_META]], !noundef !{{[0-9]+}} + // CHECK: load {{i32\*|ptr}}, {{i32\*\*|ptr}} %{{.+}}, align [[PTR_ALIGNMENT]], !nonnull !{{[0-9]+}}, !align ![[ALIGN_4_META]], !noundef !{{[0-9]+}} + // CHECK: load {{i64\*|ptr}}, {{i64\*\*|ptr}} %{{.+}}, align [[PTR_ALIGNMENT]], !nonnull !{{[0-9]+}}, !align ![[ALIGN_16_META]], !noundef !{{[0-9]+}} *x } // CHECK-LABEL: @load_raw_pointer #[no_mangle] pub fn load_raw_pointer<'a>(x: &*const i32) -> *const i32 { -// loaded raw pointer should not have !nonnull, !align, or !noundef metadata -// CHECK: load {{i32\*|ptr}}, {{i32\*\*|ptr}} %x, align [[PTR_ALIGNMENT]]{{$}} + // loaded raw pointer should not have !nonnull, !align, or !noundef metadata + // CHECK: load {{i32\*|ptr}}, {{i32\*\*|ptr}} %x, align [[PTR_ALIGNMENT]]{{$}} *x } // CHECK-LABEL: @load_box #[no_mangle] pub fn load_box<'a>(x: Box<Box<i32>>) -> Box<i32> { -// CHECK: load {{i32\*|ptr}}, {{i32\*\*|ptr}} %x, align [[PTR_ALIGNMENT]], !nonnull !{{[0-9]+}}, !align ![[ALIGN_4_META]], !noundef !{{[0-9]+}} + // CHECK: load {{i32\*|ptr}}, {{i32\*\*|ptr}} %{{.*}}, align [[PTR_ALIGNMENT]], !nonnull !{{[0-9]+}}, !align ![[ALIGN_4_META]], !noundef !{{[0-9]+}} *x } // CHECK-LABEL: @load_bool #[no_mangle] pub fn load_bool(x: &bool) -> bool { -// CHECK: load i8, {{i8\*|ptr}} %x, align 1, !range ![[BOOL_RANGE:[0-9]+]], !noundef !{{[0-9]+}} + // CHECK: load i8, {{i8\*|ptr}} %x, align 1, !range ![[BOOL_RANGE:[0-9]+]], !noundef !{{[0-9]+}} *x } // CHECK-LABEL: @load_maybeuninit_bool #[no_mangle] pub fn load_maybeuninit_bool(x: &MaybeUninit<bool>) -> MaybeUninit<bool> { -// CHECK: load i8, {{i8\*|ptr}} %x, align 1{{$}} + // CHECK: load i8, {{i8\*|ptr}} %x, align 1{{$}} *x } // CHECK-LABEL: @load_enum_bool #[no_mangle] pub fn load_enum_bool(x: &MyBool) -> MyBool { -// CHECK: load i8, {{i8\*|ptr}} %x, align 1, !range ![[BOOL_RANGE]], !noundef !{{[0-9]+}} + // CHECK: load i8, {{i8\*|ptr}} %x, align 1, !range ![[BOOL_RANGE]], !noundef !{{[0-9]+}} *x } // CHECK-LABEL: @load_maybeuninit_enum_bool #[no_mangle] pub fn load_maybeuninit_enum_bool(x: &MaybeUninit<MyBool>) -> MaybeUninit<MyBool> { -// CHECK: load i8, {{i8\*|ptr}} %x, align 1{{$}} + // CHECK: load i8, {{i8\*|ptr}} %x, align 1{{$}} *x } // CHECK-LABEL: @load_int #[no_mangle] pub fn load_int(x: &u16) -> u16 { -// CHECK: load i16, {{i16\*|ptr}} %x, align 2{{$}} + // CHECK: load i16, {{i16\*|ptr}} %x, align 2{{$}} *x } // CHECK-LABEL: @load_nonzero_int #[no_mangle] pub fn load_nonzero_int(x: &NonZeroU16) -> NonZeroU16 { -// CHECK: load i16, {{i16\*|ptr}} %x, align 2, !range ![[NONZEROU16_RANGE:[0-9]+]], !noundef !{{[0-9]+}} + // CHECK: load i16, {{i16\*|ptr}} %x, align 2, !range ![[NONZEROU16_RANGE:[0-9]+]], !noundef !{{[0-9]+}} *x } // CHECK-LABEL: @load_option_nonzero_int #[no_mangle] pub fn load_option_nonzero_int(x: &Option<NonZeroU16>) -> Option<NonZeroU16> { -// CHECK: load i16, {{i16\*|ptr}} %x, align 2{{$}} + // CHECK: load i16, {{i16\*|ptr}} %x, align 2{{$}} *x } // CHECK-LABEL: @borrow #[no_mangle] pub fn borrow(x: &i32) -> &i32 { -// CHECK: load {{i32\*|ptr}}, {{i32\*\*|ptr}} %x{{.*}}, !nonnull + // CHECK: load {{i32\*|ptr}}, {{i32\*\*|ptr}} %x{{.*}}, !nonnull &x; // keep variable in an alloca x } @@ -122,7 +122,7 @@ pub fn borrow(x: &i32) -> &i32 { // CHECK-LABEL: @_box #[no_mangle] pub fn _box(x: Box<i32>) -> i32 { -// CHECK: load {{i32\*|ptr}}, {{i32\*\*|ptr}} %x{{.*}}, !nonnull + // CHECK: load {{i32\*|ptr}}, {{i32\*\*|ptr}} %x{{.*}}, align [[PTR_ALIGNMENT]] *x } @@ -131,8 +131,8 @@ pub fn _box(x: Box<i32>) -> i32 { // dependent alignment #[no_mangle] pub fn small_array_alignment(x: [i8; 4]) -> [i8; 4] { -// CHECK: [[VAR:%[0-9]+]] = load i32, {{i32\*|ptr}} %{{.*}}, align 1 -// CHECK: ret i32 [[VAR]] + // CHECK: [[VAR:%[0-9]+]] = load i32, {{i32\*|ptr}} %{{.*}}, align 1 + // CHECK: ret i32 [[VAR]] x } @@ -141,8 +141,8 @@ pub fn small_array_alignment(x: [i8; 4]) -> [i8; 4] { // dependent alignment #[no_mangle] pub fn small_struct_alignment(x: Bytes) -> Bytes { -// CHECK: [[VAR:%[0-9]+]] = load i32, {{i32\*|ptr}} %{{.*}}, align 1 -// CHECK: ret i32 [[VAR]] + // CHECK: [[VAR:%[0-9]+]] = load i32, {{i32\*|ptr}} %{{.*}}, align 1 + // CHECK: ret i32 [[VAR]] x } diff --git a/src/test/debuginfo/lexical-scope-in-if-let.rs b/src/test/debuginfo/lexical-scope-in-if-let.rs new file mode 100644 index 00000000000..cdc37ce48fb --- /dev/null +++ b/src/test/debuginfo/lexical-scope-in-if-let.rs @@ -0,0 +1,100 @@ +// compile-flags:-g + +// === GDB TESTS ================================================================================== + +// gdb-command:run +// gdb-command:info locals +// gdb-check:a = 123 + +// gdb-command:continue +// gdb-command:info locals +// gdb-check:x = 42 +// gdb-check:a = 123 + +// gdb-command:continue +// gdb-command:info locals +// gdb-check:y = true +// gdb-check:b = 456 +// gdb-check:x = 42 +// gdb-check:a = 123 + +// gdb-command:continue +// gdb-command:info locals +// gdb-check:z = 10 +// gdb-check:c = 789 +// gdb-check:y = true +// gdb-check:b = 456 +// gdb-check:x = 42 +// gdb-check:a = 123 + +// === LLDB TESTS ================================================================================= + +// lldb-command:run +// lldb-command:frame variable +// lldb-check:(int) a = 123 + +// lldb-command:continue +// lldb-command:frame variable +// lldb-check:(int) a = 123 (int) x = 42 + +// lldb-command:continue +// lldb-command:frame variable +// lldb-check:(int) a = 123 (int) x = 42 (int) b = 456 (bool) y = true + +// lldb-command:continue +// lldb-command:frame variable +// lldb-check:(int) a = 123 (int) x = 42 (int) b = 456 (bool) y = true (int) c = 789 (int) z = 10 + +// === CDB TESTS ================================================================================== + +// cdb-command: g +// cdb-command: dv +// cdb-check:[...]a = 0n123 + +// cdb-command: g +// cdb-command: dv +// cdb-check:[...]a = 0n123 +// cdb-check:[...]x = 0n42 + +// cdb-command: g +// cdb-command: dv +// cdb-check:[...]y = true +// cdb-check:[...]b = 0n456 +// cdb-check:[...]a = 0n123 +// cdb-check:[...]x = 0n42 + +// cdb-command: g +// cdb-command: dv +// cdb-check:[...]z = 0n10 +// cdb-check:[...]c = 0n789 +// cdb-check:[...]y = true +// cdb-check:[...]b = 0n456 +// cdb-check:[...]a = 0n123 +// cdb-check:[...]x = 0n42 + +fn main() { + let a = id(123); + + zzz(); // #break + + if let Some(x) = id(Some(42)) { + zzz(); // #break + + let b = id(456); + + if let Ok(y) = id::<Result<bool, ()>>(Ok(true)) { + zzz(); // #break + + let c = id(789); + + if let (z, 42) = id((10, 42)) { + zzz(); // #break + } + } + } +} + +#[inline(never)] +fn id<T>(value: T) -> T { value } + +fn zzz() { } diff --git a/src/test/mir-opt/const_prop/boxes.main.ConstProp.diff b/src/test/mir-opt/const_prop/boxes.main.ConstProp.diff index 342c987343e..87302424914 100644 --- a/src/test/mir-opt/const_prop/boxes.main.ConstProp.diff +++ b/src/test/mir-opt/const_prop/boxes.main.ConstProp.diff @@ -10,6 +10,10 @@ let mut _5: usize; // in scope 0 at $DIR/boxes.rs:12:14: 12:22 let mut _6: *mut u8; // in scope 0 at $DIR/boxes.rs:12:14: 12:22 let mut _7: std::boxed::Box<i32>; // in scope 0 at $DIR/boxes.rs:12:14: 12:22 + let mut _8: *const i32; // in scope 0 at $DIR/boxes.rs:12:14: 12:22 + let mut _9: *const i32; // in scope 0 at $DIR/boxes.rs:12:14: 12:22 + let mut _10: *const i32; // in scope 0 at $DIR/boxes.rs:12:14: 12:22 + let mut _11: *const i32; // in scope 0 at $DIR/boxes.rs:12:14: 12:22 scope 1 { debug x => _1; // in scope 1 at $DIR/boxes.rs:12:9: 12:10 } @@ -34,10 +38,16 @@ bb1: { StorageLive(_7); // scope 0 at $DIR/boxes.rs:12:14: 12:22 _7 = ShallowInitBox(move _6, i32); // scope 0 at $DIR/boxes.rs:12:14: 12:22 - (*_7) = const 42_i32; // scope 0 at $DIR/boxes.rs:12:19: 12:21 + StorageLive(_8); // scope 0 at $DIR/boxes.rs:12:19: 12:21 + _8 = (((_7.0: std::ptr::Unique<i32>).0: std::ptr::NonNull<i32>).0: *const i32); // scope 0 at $DIR/boxes.rs:12:19: 12:21 + (*_8) = const 42_i32; // scope 0 at $DIR/boxes.rs:12:19: 12:21 + StorageDead(_8); // scope 0 at $DIR/boxes.rs:12:14: 12:22 _3 = move _7; // scope 0 at $DIR/boxes.rs:12:14: 12:22 StorageDead(_7); // scope 0 at $DIR/boxes.rs:12:21: 12:22 - _2 = (*_3); // scope 0 at $DIR/boxes.rs:12:13: 12:22 + StorageLive(_9); // scope 0 at $DIR/boxes.rs:12:13: 12:22 + _9 = (((_3.0: std::ptr::Unique<i32>).0: std::ptr::NonNull<i32>).0: *const i32); // scope 0 at $DIR/boxes.rs:12:13: 12:22 + _2 = (*_9); // scope 0 at $DIR/boxes.rs:12:13: 12:22 + StorageDead(_9); // scope 0 at $DIR/boxes.rs:12:13: 12:26 _1 = Add(move _2, const 0_i32); // scope 0 at $DIR/boxes.rs:12:13: 12:26 StorageDead(_2); // scope 0 at $DIR/boxes.rs:12:25: 12:26 drop(_3) -> [return: bb2, unwind: bb3]; // scope 0 at $DIR/boxes.rs:12:26: 12:27 diff --git a/src/test/mir-opt/const_prop/discriminant.main.ConstProp.32bit.diff b/src/test/mir-opt/const_prop/discriminant.main.ConstProp.32bit.diff index 445732f7022..047853696f2 100644 --- a/src/test/mir-opt/const_prop/discriminant.main.ConstProp.32bit.diff +++ b/src/test/mir-opt/const_prop/discriminant.main.ConstProp.32bit.diff @@ -10,26 +10,28 @@ scope 1 { debug x => _1; // in scope 1 at $DIR/discriminant.rs:11:9: 11:10 } + scope 2 { + } bb0: { StorageLive(_1); // scope 0 at $DIR/discriminant.rs:11:9: 11:10 StorageLive(_2); // scope 0 at $DIR/discriminant.rs:11:13: 11:64 - StorageLive(_3); // scope 0 at $DIR/discriminant.rs:11:34: 11:44 - Deinit(_3); // scope 0 at $DIR/discriminant.rs:11:34: 11:44 - ((_3 as Some).0: bool) = const true; // scope 0 at $DIR/discriminant.rs:11:34: 11:44 - discriminant(_3) = 1; // scope 0 at $DIR/discriminant.rs:11:34: 11:44 -- _4 = discriminant(_3); // scope 0 at $DIR/discriminant.rs:11:21: 11:31 -- switchInt(move _4) -> [1_isize: bb1, otherwise: bb3]; // scope 0 at $DIR/discriminant.rs:11:21: 11:31 -+ _4 = const 1_isize; // scope 0 at $DIR/discriminant.rs:11:21: 11:31 -+ switchInt(const 1_isize) -> [1_isize: bb1, otherwise: bb3]; // scope 0 at $DIR/discriminant.rs:11:21: 11:31 + StorageLive(_3); // scope 2 at $DIR/discriminant.rs:11:34: 11:44 + Deinit(_3); // scope 2 at $DIR/discriminant.rs:11:34: 11:44 + ((_3 as Some).0: bool) = const true; // scope 2 at $DIR/discriminant.rs:11:34: 11:44 + discriminant(_3) = 1; // scope 2 at $DIR/discriminant.rs:11:34: 11:44 +- _4 = discriminant(_3); // scope 2 at $DIR/discriminant.rs:11:21: 11:31 +- switchInt(move _4) -> [1_isize: bb1, otherwise: bb3]; // scope 2 at $DIR/discriminant.rs:11:21: 11:31 ++ _4 = const 1_isize; // scope 2 at $DIR/discriminant.rs:11:21: 11:31 ++ switchInt(const 1_isize) -> [1_isize: bb1, otherwise: bb3]; // scope 2 at $DIR/discriminant.rs:11:21: 11:31 } bb1: { - switchInt(((_3 as Some).0: bool)) -> [false: bb3, otherwise: bb2]; // scope 0 at $DIR/discriminant.rs:11:21: 11:31 + switchInt(((_3 as Some).0: bool)) -> [false: bb3, otherwise: bb2]; // scope 2 at $DIR/discriminant.rs:11:21: 11:31 } bb2: { - _2 = const 42_i32; // scope 0 at $DIR/discriminant.rs:11:47: 11:49 + _2 = const 42_i32; // scope 2 at $DIR/discriminant.rs:11:47: 11:49 goto -> bb4; // scope 0 at $DIR/discriminant.rs:11:13: 11:64 } diff --git a/src/test/mir-opt/const_prop/discriminant.main.ConstProp.64bit.diff b/src/test/mir-opt/const_prop/discriminant.main.ConstProp.64bit.diff index 445732f7022..047853696f2 100644 --- a/src/test/mir-opt/const_prop/discriminant.main.ConstProp.64bit.diff +++ b/src/test/mir-opt/const_prop/discriminant.main.ConstProp.64bit.diff @@ -10,26 +10,28 @@ scope 1 { debug x => _1; // in scope 1 at $DIR/discriminant.rs:11:9: 11:10 } + scope 2 { + } bb0: { StorageLive(_1); // scope 0 at $DIR/discriminant.rs:11:9: 11:10 StorageLive(_2); // scope 0 at $DIR/discriminant.rs:11:13: 11:64 - StorageLive(_3); // scope 0 at $DIR/discriminant.rs:11:34: 11:44 - Deinit(_3); // scope 0 at $DIR/discriminant.rs:11:34: 11:44 - ((_3 as Some).0: bool) = const true; // scope 0 at $DIR/discriminant.rs:11:34: 11:44 - discriminant(_3) = 1; // scope 0 at $DIR/discriminant.rs:11:34: 11:44 -- _4 = discriminant(_3); // scope 0 at $DIR/discriminant.rs:11:21: 11:31 -- switchInt(move _4) -> [1_isize: bb1, otherwise: bb3]; // scope 0 at $DIR/discriminant.rs:11:21: 11:31 -+ _4 = const 1_isize; // scope 0 at $DIR/discriminant.rs:11:21: 11:31 -+ switchInt(const 1_isize) -> [1_isize: bb1, otherwise: bb3]; // scope 0 at $DIR/discriminant.rs:11:21: 11:31 + StorageLive(_3); // scope 2 at $DIR/discriminant.rs:11:34: 11:44 + Deinit(_3); // scope 2 at $DIR/discriminant.rs:11:34: 11:44 + ((_3 as Some).0: bool) = const true; // scope 2 at $DIR/discriminant.rs:11:34: 11:44 + discriminant(_3) = 1; // scope 2 at $DIR/discriminant.rs:11:34: 11:44 +- _4 = discriminant(_3); // scope 2 at $DIR/discriminant.rs:11:21: 11:31 +- switchInt(move _4) -> [1_isize: bb1, otherwise: bb3]; // scope 2 at $DIR/discriminant.rs:11:21: 11:31 ++ _4 = const 1_isize; // scope 2 at $DIR/discriminant.rs:11:21: 11:31 ++ switchInt(const 1_isize) -> [1_isize: bb1, otherwise: bb3]; // scope 2 at $DIR/discriminant.rs:11:21: 11:31 } bb1: { - switchInt(((_3 as Some).0: bool)) -> [false: bb3, otherwise: bb2]; // scope 0 at $DIR/discriminant.rs:11:21: 11:31 + switchInt(((_3 as Some).0: bool)) -> [false: bb3, otherwise: bb2]; // scope 2 at $DIR/discriminant.rs:11:21: 11:31 } bb2: { - _2 = const 42_i32; // scope 0 at $DIR/discriminant.rs:11:47: 11:49 + _2 = const 42_i32; // scope 2 at $DIR/discriminant.rs:11:47: 11:49 goto -> bb4; // scope 0 at $DIR/discriminant.rs:11:13: 11:64 } diff --git a/src/test/mir-opt/early_otherwise_branch_soundness.no_downcast.EarlyOtherwiseBranch.diff b/src/test/mir-opt/early_otherwise_branch_soundness.no_downcast.EarlyOtherwiseBranch.diff index 1efaba044ec..982dd7a27bc 100644 --- a/src/test/mir-opt/early_otherwise_branch_soundness.no_downcast.EarlyOtherwiseBranch.diff +++ b/src/test/mir-opt/early_otherwise_branch_soundness.no_downcast.EarlyOtherwiseBranch.diff @@ -7,22 +7,24 @@ let mut _2: isize; // in scope 0 at $DIR/early_otherwise_branch_soundness.rs:13:20: 13:30 let mut _3: isize; // in scope 0 at $DIR/early_otherwise_branch_soundness.rs:13:12: 13:31 let mut _4: &E; // in scope 0 at $DIR/early_otherwise_branch_soundness.rs:12:16: 12:17 + scope 1 { + } bb0: { - _3 = discriminant((*_1)); // scope 0 at $DIR/early_otherwise_branch_soundness.rs:13:12: 13:31 - switchInt(move _3) -> [1_isize: bb1, otherwise: bb3]; // scope 0 at $DIR/early_otherwise_branch_soundness.rs:13:12: 13:31 + _3 = discriminant((*_1)); // scope 1 at $DIR/early_otherwise_branch_soundness.rs:13:12: 13:31 + switchInt(move _3) -> [1_isize: bb1, otherwise: bb3]; // scope 1 at $DIR/early_otherwise_branch_soundness.rs:13:12: 13:31 } bb1: { - StorageLive(_4); // scope 0 at $DIR/early_otherwise_branch_soundness.rs:13:12: 13:31 - _4 = move (((*_1) as Some).0: &E); // scope 0 at $DIR/early_otherwise_branch_soundness.rs:13:12: 13:31 - _2 = discriminant((*_4)); // scope 0 at $DIR/early_otherwise_branch_soundness.rs:13:12: 13:31 - StorageDead(_4); // scope 0 at $DIR/early_otherwise_branch_soundness.rs:13:12: 13:31 - switchInt(move _2) -> [1_isize: bb2, otherwise: bb3]; // scope 0 at $DIR/early_otherwise_branch_soundness.rs:13:12: 13:31 + StorageLive(_4); // scope 1 at $DIR/early_otherwise_branch_soundness.rs:13:12: 13:31 + _4 = move (((*_1) as Some).0: &E); // scope 1 at $DIR/early_otherwise_branch_soundness.rs:13:12: 13:31 + _2 = discriminant((*_4)); // scope 1 at $DIR/early_otherwise_branch_soundness.rs:13:12: 13:31 + StorageDead(_4); // scope 1 at $DIR/early_otherwise_branch_soundness.rs:13:12: 13:31 + switchInt(move _2) -> [1_isize: bb2, otherwise: bb3]; // scope 1 at $DIR/early_otherwise_branch_soundness.rs:13:12: 13:31 } bb2: { - _0 = const 1_u32; // scope 0 at $DIR/early_otherwise_branch_soundness.rs:13:38: 13:39 + _0 = const 1_u32; // scope 1 at $DIR/early_otherwise_branch_soundness.rs:13:38: 13:39 goto -> bb4; // scope 0 at $DIR/early_otherwise_branch_soundness.rs:13:5: 13:52 } diff --git a/src/test/mir-opt/funky_arms.float_to_exponential_common.ConstProp.diff b/src/test/mir-opt/funky_arms.float_to_exponential_common.ConstProp.diff index f22fbec03d0..15409fa0dd2 100644 --- a/src/test/mir-opt/funky_arms.float_to_exponential_common.ConstProp.diff +++ b/src/test/mir-opt/funky_arms.float_to_exponential_common.ConstProp.diff @@ -27,9 +27,9 @@ let _6: core::num::flt2dec::Sign; // in scope 1 at $DIR/funky_arms.rs:19:9: 19:13 scope 2 { debug sign => _6; // in scope 2 at $DIR/funky_arms.rs:19:9: 19:13 - let _10: usize; // in scope 2 at $DIR/funky_arms.rs:24:17: 24:26 scope 3 { debug precision => _10; // in scope 3 at $DIR/funky_arms.rs:24:17: 24:26 + let _10: usize; // in scope 3 at $DIR/funky_arms.rs:24:17: 24:26 } } } @@ -63,52 +63,52 @@ } bb4: { - StorageLive(_7); // scope 2 at $DIR/funky_arms.rs:24:30: 24:45 - StorageLive(_8); // scope 2 at $DIR/funky_arms.rs:24:30: 24:45 - _8 = &(*_1); // scope 2 at $DIR/funky_arms.rs:24:30: 24:45 - _7 = Formatter::precision(move _8) -> bb5; // scope 2 at $DIR/funky_arms.rs:24:30: 24:45 + StorageLive(_7); // scope 3 at $DIR/funky_arms.rs:24:30: 24:45 + StorageLive(_8); // scope 3 at $DIR/funky_arms.rs:24:30: 24:45 + _8 = &(*_1); // scope 3 at $DIR/funky_arms.rs:24:30: 24:45 + _7 = Formatter::precision(move _8) -> bb5; // scope 3 at $DIR/funky_arms.rs:24:30: 24:45 // mir::Constant // + span: $DIR/funky_arms.rs:24:34: 24:43 // + literal: Const { ty: for<'r> fn(&'r Formatter) -> Option<usize> {Formatter::precision}, val: Value(Scalar(<ZST>)) } } bb5: { - StorageDead(_8); // scope 2 at $DIR/funky_arms.rs:24:44: 24:45 - _9 = discriminant(_7); // scope 2 at $DIR/funky_arms.rs:24:12: 24:27 - switchInt(move _9) -> [1_isize: bb6, otherwise: bb8]; // scope 2 at $DIR/funky_arms.rs:24:12: 24:27 + StorageDead(_8); // scope 3 at $DIR/funky_arms.rs:24:44: 24:45 + _9 = discriminant(_7); // scope 3 at $DIR/funky_arms.rs:24:12: 24:27 + switchInt(move _9) -> [1_isize: bb6, otherwise: bb8]; // scope 3 at $DIR/funky_arms.rs:24:12: 24:27 } bb6: { - StorageLive(_10); // scope 2 at $DIR/funky_arms.rs:24:17: 24:26 - _10 = ((_7 as Some).0: usize); // scope 2 at $DIR/funky_arms.rs:24:17: 24:26 - StorageLive(_11); // scope 2 at $DIR/funky_arms.rs:26:43: 26:46 - _11 = &mut (*_1); // scope 2 at $DIR/funky_arms.rs:26:43: 26:46 - StorageLive(_12); // scope 2 at $DIR/funky_arms.rs:26:48: 26:51 - _12 = _2; // scope 2 at $DIR/funky_arms.rs:26:48: 26:51 - StorageLive(_13); // scope 2 at $DIR/funky_arms.rs:26:53: 26:57 - _13 = _6; // scope 2 at $DIR/funky_arms.rs:26:53: 26:57 - StorageLive(_14); // scope 2 at $DIR/funky_arms.rs:26:59: 26:79 - StorageLive(_15); // scope 2 at $DIR/funky_arms.rs:26:59: 26:75 - StorageLive(_16); // scope 2 at $DIR/funky_arms.rs:26:59: 26:68 - _16 = _10; // scope 2 at $DIR/funky_arms.rs:26:59: 26:68 - _15 = move _16 as u32 (Misc); // scope 2 at $DIR/funky_arms.rs:26:59: 26:75 - StorageDead(_16); // scope 2 at $DIR/funky_arms.rs:26:74: 26:75 - _14 = Add(move _15, const 1_u32); // scope 2 at $DIR/funky_arms.rs:26:59: 26:79 - StorageDead(_15); // scope 2 at $DIR/funky_arms.rs:26:78: 26:79 - StorageLive(_17); // scope 2 at $DIR/funky_arms.rs:26:81: 26:86 - _17 = _3; // scope 2 at $DIR/funky_arms.rs:26:81: 26:86 - _0 = float_to_exponential_common_exact::<T>(move _11, move _12, move _13, move _14, move _17) -> bb7; // scope 2 at $DIR/funky_arms.rs:26:9: 26:87 + StorageLive(_10); // scope 3 at $DIR/funky_arms.rs:24:17: 24:26 + _10 = ((_7 as Some).0: usize); // scope 3 at $DIR/funky_arms.rs:24:17: 24:26 + StorageLive(_11); // scope 3 at $DIR/funky_arms.rs:26:43: 26:46 + _11 = &mut (*_1); // scope 3 at $DIR/funky_arms.rs:26:43: 26:46 + StorageLive(_12); // scope 3 at $DIR/funky_arms.rs:26:48: 26:51 + _12 = _2; // scope 3 at $DIR/funky_arms.rs:26:48: 26:51 + StorageLive(_13); // scope 3 at $DIR/funky_arms.rs:26:53: 26:57 + _13 = _6; // scope 3 at $DIR/funky_arms.rs:26:53: 26:57 + StorageLive(_14); // scope 3 at $DIR/funky_arms.rs:26:59: 26:79 + StorageLive(_15); // scope 3 at $DIR/funky_arms.rs:26:59: 26:75 + StorageLive(_16); // scope 3 at $DIR/funky_arms.rs:26:59: 26:68 + _16 = _10; // scope 3 at $DIR/funky_arms.rs:26:59: 26:68 + _15 = move _16 as u32 (Misc); // scope 3 at $DIR/funky_arms.rs:26:59: 26:75 + StorageDead(_16); // scope 3 at $DIR/funky_arms.rs:26:74: 26:75 + _14 = Add(move _15, const 1_u32); // scope 3 at $DIR/funky_arms.rs:26:59: 26:79 + StorageDead(_15); // scope 3 at $DIR/funky_arms.rs:26:78: 26:79 + StorageLive(_17); // scope 3 at $DIR/funky_arms.rs:26:81: 26:86 + _17 = _3; // scope 3 at $DIR/funky_arms.rs:26:81: 26:86 + _0 = float_to_exponential_common_exact::<T>(move _11, move _12, move _13, move _14, move _17) -> bb7; // scope 3 at $DIR/funky_arms.rs:26:9: 26:87 // mir::Constant // + span: $DIR/funky_arms.rs:26:9: 26:42 // + literal: Const { ty: for<'r, 's, 't0> fn(&'r mut Formatter<'s>, &'t0 T, Sign, u32, bool) -> Result<(), std::fmt::Error> {float_to_exponential_common_exact::<T>}, val: Value(Scalar(<ZST>)) } } bb7: { - StorageDead(_17); // scope 2 at $DIR/funky_arms.rs:26:86: 26:87 - StorageDead(_14); // scope 2 at $DIR/funky_arms.rs:26:86: 26:87 - StorageDead(_13); // scope 2 at $DIR/funky_arms.rs:26:86: 26:87 - StorageDead(_12); // scope 2 at $DIR/funky_arms.rs:26:86: 26:87 - StorageDead(_11); // scope 2 at $DIR/funky_arms.rs:26:86: 26:87 + StorageDead(_17); // scope 3 at $DIR/funky_arms.rs:26:86: 26:87 + StorageDead(_14); // scope 3 at $DIR/funky_arms.rs:26:86: 26:87 + StorageDead(_13); // scope 3 at $DIR/funky_arms.rs:26:86: 26:87 + StorageDead(_12); // scope 3 at $DIR/funky_arms.rs:26:86: 26:87 + StorageDead(_11); // scope 3 at $DIR/funky_arms.rs:26:86: 26:87 StorageDead(_10); // scope 2 at $DIR/funky_arms.rs:27:5: 27:6 goto -> bb10; // scope 2 at $DIR/funky_arms.rs:24:5: 29:6 } diff --git a/src/test/mir-opt/inline/inline_into_box_place.main.Inline.32bit.diff b/src/test/mir-opt/inline/inline_into_box_place.main.Inline.32bit.diff index 5b2b9f7e3a9..89414574898 100644 --- a/src/test/mir-opt/inline/inline_into_box_place.main.Inline.32bit.diff +++ b/src/test/mir-opt/inline/inline_into_box_place.main.Inline.32bit.diff @@ -9,14 +9,16 @@ let mut _4: *mut u8; // in scope 0 at $DIR/inline-into-box-place.rs:8:29: 8:43 let mut _5: std::boxed::Box<std::vec::Vec<u32>>; // in scope 0 at $DIR/inline-into-box-place.rs:8:29: 8:43 let mut _6: (); // in scope 0 at $DIR/inline-into-box-place.rs:8:42: 8:43 -+ let mut _7: &mut std::vec::Vec<u32>; // in scope 0 at $DIR/inline-into-box-place.rs:8:33: 8:43 + let mut _7: *const std::vec::Vec<u32>; // in scope 0 at $DIR/inline-into-box-place.rs:8:29: 8:43 + let mut _8: *const std::vec::Vec<u32>; // in scope 0 at $DIR/inline-into-box-place.rs:8:29: 8:43 ++ let mut _9: &mut std::vec::Vec<u32>; // in scope 0 at $DIR/inline-into-box-place.rs:8:33: 8:43 scope 1 { debug _x => _1; // in scope 1 at $DIR/inline-into-box-place.rs:8:9: 8:11 } scope 2 { } + scope 3 (inlined Vec::<u32>::new) { // at $DIR/inline-into-box-place.rs:8:33: 8:43 -+ let mut _8: alloc::raw_vec::RawVec<u32>; // in scope 3 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL ++ let mut _10: alloc::raw_vec::RawVec<u32>; // in scope 3 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + } bb0: { @@ -32,11 +34,13 @@ bb1: { StorageLive(_5); // scope 0 at $DIR/inline-into-box-place.rs:8:29: 8:43 _5 = ShallowInitBox(move _4, std::vec::Vec<u32>); // scope 0 at $DIR/inline-into-box-place.rs:8:29: 8:43 -- (*_5) = Vec::<u32>::new() -> [return: bb2, unwind: bb5]; // scope 0 at $DIR/inline-into-box-place.rs:8:33: 8:43 -+ StorageLive(_7); // scope 0 at $DIR/inline-into-box-place.rs:8:33: 8:43 -+ _7 = &mut (*_5); // scope 0 at $DIR/inline-into-box-place.rs:8:33: 8:43 -+ StorageLive(_8); // scope 3 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL -+ _8 = const alloc::raw_vec::RawVec::<u32>::NEW; // scope 3 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + StorageLive(_7); // scope 0 at $DIR/inline-into-box-place.rs:8:33: 8:43 + _7 = (((_5.0: std::ptr::Unique<std::vec::Vec<u32>>).0: std::ptr::NonNull<std::vec::Vec<u32>>).0: *const std::vec::Vec<u32>); // scope 0 at $DIR/inline-into-box-place.rs:8:33: 8:43 +- (*_7) = Vec::<u32>::new() -> [return: bb2, unwind: bb4]; // scope 0 at $DIR/inline-into-box-place.rs:8:33: 8:43 ++ StorageLive(_9); // scope 0 at $DIR/inline-into-box-place.rs:8:33: 8:43 ++ _9 = &mut (*_7); // scope 0 at $DIR/inline-into-box-place.rs:8:33: 8:43 ++ StorageLive(_10); // scope 3 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL ++ _10 = const alloc::raw_vec::RawVec::<u32>::NEW; // scope 3 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL // mir::Constant - // + span: $DIR/inline-into-box-place.rs:8:33: 8:41 - // + user_ty: UserType(1) @@ -47,15 +51,16 @@ + // + span: $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + // + user_ty: UserType(0) + // + literal: Const { ty: alloc::raw_vec::RawVec<u32>, val: Unevaluated(alloc::raw_vec::RawVec::<T>::NEW, [u32], None) } -+ Deinit((*_7)); // scope 3 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL -+ ((*_7).0: alloc::raw_vec::RawVec<u32>) = move _8; // scope 3 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL -+ ((*_7).1: usize) = const 0_usize; // scope 3 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL -+ StorageDead(_8); // scope 3 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL -+ StorageDead(_7); // scope 0 at $DIR/inline-into-box-place.rs:8:33: 8:43 ++ Deinit((*_9)); // scope 3 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL ++ ((*_9).0: alloc::raw_vec::RawVec<u32>) = move _10; // scope 3 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL ++ ((*_9).1: usize) = const 0_usize; // scope 3 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL ++ StorageDead(_10); // scope 3 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL ++ StorageDead(_9); // scope 0 at $DIR/inline-into-box-place.rs:8:33: 8:43 + StorageDead(_7); // scope 0 at $DIR/inline-into-box-place.rs:8:33: 8:43 _1 = move _5; // scope 0 at $DIR/inline-into-box-place.rs:8:29: 8:43 StorageDead(_5); // scope 0 at $DIR/inline-into-box-place.rs:8:42: 8:43 _0 = const (); // scope 0 at $DIR/inline-into-box-place.rs:7:11: 9:2 -- drop(_1) -> [return: bb3, unwind: bb4]; // scope 0 at $DIR/inline-into-box-place.rs:9:1: 9:2 +- drop(_1) -> [return: bb3, unwind: bb5]; // scope 0 at $DIR/inline-into-box-place.rs:9:1: 9:2 + drop(_1) -> [return: bb2, unwind: bb3]; // scope 0 at $DIR/inline-into-box-place.rs:9:1: 9:2 } @@ -66,15 +71,16 @@ } - bb4 (cleanup): { -+ bb3 (cleanup): { - resume; // scope 0 at $DIR/inline-into-box-place.rs:7:1: 9:2 -- } -- -- bb5 (cleanup): { -- _6 = alloc::alloc::box_free::<Vec<u32>, std::alloc::Global>(move (_5.0: std::ptr::Unique<std::vec::Vec<u32>>), move (_5.1: std::alloc::Global)) -> bb4; // scope 0 at $DIR/inline-into-box-place.rs:8:42: 8:43 +- StorageDead(_7); // scope 0 at $DIR/inline-into-box-place.rs:8:33: 8:43 +- _6 = alloc::alloc::box_free::<Vec<u32>, std::alloc::Global>(move (_5.0: std::ptr::Unique<std::vec::Vec<u32>>), move (_5.1: std::alloc::Global)) -> bb5; // scope 0 at $DIR/inline-into-box-place.rs:8:42: 8:43 - // mir::Constant - // + span: $DIR/inline-into-box-place.rs:8:42: 8:43 - // + literal: Const { ty: unsafe fn(Unique<Vec<u32>>, std::alloc::Global) {alloc::alloc::box_free::<Vec<u32>, std::alloc::Global>}, val: Value(Scalar(<ZST>)) } +- } +- +- bb5 (cleanup): { ++ bb3 (cleanup): { + resume; // scope 0 at $DIR/inline-into-box-place.rs:7:1: 9:2 } } diff --git a/src/test/mir-opt/inline/inline_into_box_place.main.Inline.64bit.diff b/src/test/mir-opt/inline/inline_into_box_place.main.Inline.64bit.diff index 5b2b9f7e3a9..89414574898 100644 --- a/src/test/mir-opt/inline/inline_into_box_place.main.Inline.64bit.diff +++ b/src/test/mir-opt/inline/inline_into_box_place.main.Inline.64bit.diff @@ -9,14 +9,16 @@ let mut _4: *mut u8; // in scope 0 at $DIR/inline-into-box-place.rs:8:29: 8:43 let mut _5: std::boxed::Box<std::vec::Vec<u32>>; // in scope 0 at $DIR/inline-into-box-place.rs:8:29: 8:43 let mut _6: (); // in scope 0 at $DIR/inline-into-box-place.rs:8:42: 8:43 -+ let mut _7: &mut std::vec::Vec<u32>; // in scope 0 at $DIR/inline-into-box-place.rs:8:33: 8:43 + let mut _7: *const std::vec::Vec<u32>; // in scope 0 at $DIR/inline-into-box-place.rs:8:29: 8:43 + let mut _8: *const std::vec::Vec<u32>; // in scope 0 at $DIR/inline-into-box-place.rs:8:29: 8:43 ++ let mut _9: &mut std::vec::Vec<u32>; // in scope 0 at $DIR/inline-into-box-place.rs:8:33: 8:43 scope 1 { debug _x => _1; // in scope 1 at $DIR/inline-into-box-place.rs:8:9: 8:11 } scope 2 { } + scope 3 (inlined Vec::<u32>::new) { // at $DIR/inline-into-box-place.rs:8:33: 8:43 -+ let mut _8: alloc::raw_vec::RawVec<u32>; // in scope 3 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL ++ let mut _10: alloc::raw_vec::RawVec<u32>; // in scope 3 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + } bb0: { @@ -32,11 +34,13 @@ bb1: { StorageLive(_5); // scope 0 at $DIR/inline-into-box-place.rs:8:29: 8:43 _5 = ShallowInitBox(move _4, std::vec::Vec<u32>); // scope 0 at $DIR/inline-into-box-place.rs:8:29: 8:43 -- (*_5) = Vec::<u32>::new() -> [return: bb2, unwind: bb5]; // scope 0 at $DIR/inline-into-box-place.rs:8:33: 8:43 -+ StorageLive(_7); // scope 0 at $DIR/inline-into-box-place.rs:8:33: 8:43 -+ _7 = &mut (*_5); // scope 0 at $DIR/inline-into-box-place.rs:8:33: 8:43 -+ StorageLive(_8); // scope 3 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL -+ _8 = const alloc::raw_vec::RawVec::<u32>::NEW; // scope 3 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + StorageLive(_7); // scope 0 at $DIR/inline-into-box-place.rs:8:33: 8:43 + _7 = (((_5.0: std::ptr::Unique<std::vec::Vec<u32>>).0: std::ptr::NonNull<std::vec::Vec<u32>>).0: *const std::vec::Vec<u32>); // scope 0 at $DIR/inline-into-box-place.rs:8:33: 8:43 +- (*_7) = Vec::<u32>::new() -> [return: bb2, unwind: bb4]; // scope 0 at $DIR/inline-into-box-place.rs:8:33: 8:43 ++ StorageLive(_9); // scope 0 at $DIR/inline-into-box-place.rs:8:33: 8:43 ++ _9 = &mut (*_7); // scope 0 at $DIR/inline-into-box-place.rs:8:33: 8:43 ++ StorageLive(_10); // scope 3 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL ++ _10 = const alloc::raw_vec::RawVec::<u32>::NEW; // scope 3 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL // mir::Constant - // + span: $DIR/inline-into-box-place.rs:8:33: 8:41 - // + user_ty: UserType(1) @@ -47,15 +51,16 @@ + // + span: $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + // + user_ty: UserType(0) + // + literal: Const { ty: alloc::raw_vec::RawVec<u32>, val: Unevaluated(alloc::raw_vec::RawVec::<T>::NEW, [u32], None) } -+ Deinit((*_7)); // scope 3 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL -+ ((*_7).0: alloc::raw_vec::RawVec<u32>) = move _8; // scope 3 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL -+ ((*_7).1: usize) = const 0_usize; // scope 3 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL -+ StorageDead(_8); // scope 3 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL -+ StorageDead(_7); // scope 0 at $DIR/inline-into-box-place.rs:8:33: 8:43 ++ Deinit((*_9)); // scope 3 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL ++ ((*_9).0: alloc::raw_vec::RawVec<u32>) = move _10; // scope 3 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL ++ ((*_9).1: usize) = const 0_usize; // scope 3 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL ++ StorageDead(_10); // scope 3 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL ++ StorageDead(_9); // scope 0 at $DIR/inline-into-box-place.rs:8:33: 8:43 + StorageDead(_7); // scope 0 at $DIR/inline-into-box-place.rs:8:33: 8:43 _1 = move _5; // scope 0 at $DIR/inline-into-box-place.rs:8:29: 8:43 StorageDead(_5); // scope 0 at $DIR/inline-into-box-place.rs:8:42: 8:43 _0 = const (); // scope 0 at $DIR/inline-into-box-place.rs:7:11: 9:2 -- drop(_1) -> [return: bb3, unwind: bb4]; // scope 0 at $DIR/inline-into-box-place.rs:9:1: 9:2 +- drop(_1) -> [return: bb3, unwind: bb5]; // scope 0 at $DIR/inline-into-box-place.rs:9:1: 9:2 + drop(_1) -> [return: bb2, unwind: bb3]; // scope 0 at $DIR/inline-into-box-place.rs:9:1: 9:2 } @@ -66,15 +71,16 @@ } - bb4 (cleanup): { -+ bb3 (cleanup): { - resume; // scope 0 at $DIR/inline-into-box-place.rs:7:1: 9:2 -- } -- -- bb5 (cleanup): { -- _6 = alloc::alloc::box_free::<Vec<u32>, std::alloc::Global>(move (_5.0: std::ptr::Unique<std::vec::Vec<u32>>), move (_5.1: std::alloc::Global)) -> bb4; // scope 0 at $DIR/inline-into-box-place.rs:8:42: 8:43 +- StorageDead(_7); // scope 0 at $DIR/inline-into-box-place.rs:8:33: 8:43 +- _6 = alloc::alloc::box_free::<Vec<u32>, std::alloc::Global>(move (_5.0: std::ptr::Unique<std::vec::Vec<u32>>), move (_5.1: std::alloc::Global)) -> bb5; // scope 0 at $DIR/inline-into-box-place.rs:8:42: 8:43 - // mir::Constant - // + span: $DIR/inline-into-box-place.rs:8:42: 8:43 - // + literal: Const { ty: unsafe fn(Unique<Vec<u32>>, std::alloc::Global) {alloc::alloc::box_free::<Vec<u32>, std::alloc::Global>}, val: Value(Scalar(<ZST>)) } +- } +- +- bb5 (cleanup): { ++ bb3 (cleanup): { + resume; // scope 0 at $DIR/inline-into-box-place.rs:7:1: 9:2 } } diff --git a/src/test/mir-opt/inline/issue_58867_inline_as_ref_as_mut.b.Inline.after.mir b/src/test/mir-opt/inline/issue_58867_inline_as_ref_as_mut.b.Inline.after.mir index 0bb3445a2d0..11a205eb415 100644 --- a/src/test/mir-opt/inline/issue_58867_inline_as_ref_as_mut.b.Inline.after.mir +++ b/src/test/mir-opt/inline/issue_58867_inline_as_ref_as_mut.b.Inline.after.mir @@ -11,6 +11,7 @@ fn b(_1: &mut Box<T>) -> &mut T { let mut _5: &mut T; // in scope 1 at $SRC_DIR/alloc/src/boxed.rs:LL:COL let mut _6: &mut T; // in scope 1 at $SRC_DIR/alloc/src/boxed.rs:LL:COL let mut _7: std::boxed::Box<T>; // in scope 1 at $SRC_DIR/alloc/src/boxed.rs:LL:COL + let mut _8: *const T; // in scope 1 at $SRC_DIR/alloc/src/boxed.rs:LL:COL } bb0: { @@ -22,7 +23,10 @@ fn b(_1: &mut Box<T>) -> &mut T { StorageLive(_6); // scope 1 at $SRC_DIR/alloc/src/boxed.rs:LL:COL StorageLive(_7); // scope 1 at $SRC_DIR/alloc/src/boxed.rs:LL:COL _7 = move (*_4); // scope 1 at $SRC_DIR/alloc/src/boxed.rs:LL:COL - _6 = &mut (*_7); // scope 1 at $SRC_DIR/alloc/src/boxed.rs:LL:COL + StorageLive(_8); // scope 1 at $SRC_DIR/alloc/src/boxed.rs:LL:COL + _8 = (((_7.0: std::ptr::Unique<T>).0: std::ptr::NonNull<T>).0: *const T); // scope 1 at $SRC_DIR/alloc/src/boxed.rs:LL:COL + _6 = &mut (*_8); // scope 1 at $SRC_DIR/alloc/src/boxed.rs:LL:COL + StorageDead(_8); // scope 1 at $SRC_DIR/alloc/src/boxed.rs:LL:COL StorageDead(_7); // scope 1 at $SRC_DIR/alloc/src/boxed.rs:LL:COL _5 = &mut (*_6); // scope 1 at $SRC_DIR/alloc/src/boxed.rs:LL:COL _3 = &mut (*_5); // scope 1 at $SRC_DIR/alloc/src/boxed.rs:LL:COL diff --git a/src/test/mir-opt/inline/issue_58867_inline_as_ref_as_mut.d.Inline.after.mir b/src/test/mir-opt/inline/issue_58867_inline_as_ref_as_mut.d.Inline.after.mir index c22852b99f4..b04a91d7c95 100644 --- a/src/test/mir-opt/inline/issue_58867_inline_as_ref_as_mut.d.Inline.after.mir +++ b/src/test/mir-opt/inline/issue_58867_inline_as_ref_as_mut.d.Inline.after.mir @@ -8,6 +8,7 @@ fn d(_1: &Box<T>) -> &T { scope 1 (inlined <Box<T> as AsRef<T>>::as_ref) { // at $DIR/issue-58867-inline-as-ref-as-mut.rs:18:5: 18:15 debug self => _3; // in scope 1 at $SRC_DIR/alloc/src/boxed.rs:LL:COL let mut _4: std::boxed::Box<T>; // in scope 1 at $SRC_DIR/alloc/src/boxed.rs:LL:COL + let mut _5: *const T; // in scope 1 at $SRC_DIR/alloc/src/boxed.rs:LL:COL } bb0: { @@ -16,7 +17,10 @@ fn d(_1: &Box<T>) -> &T { _3 = &(*_1); // scope 0 at $DIR/issue-58867-inline-as-ref-as-mut.rs:18:5: 18:15 StorageLive(_4); // scope 1 at $SRC_DIR/alloc/src/boxed.rs:LL:COL _4 = move (*_3); // scope 1 at $SRC_DIR/alloc/src/boxed.rs:LL:COL - _2 = &(*_4); // scope 1 at $SRC_DIR/alloc/src/boxed.rs:LL:COL + StorageLive(_5); // scope 1 at $SRC_DIR/alloc/src/boxed.rs:LL:COL + _5 = (((_4.0: std::ptr::Unique<T>).0: std::ptr::NonNull<T>).0: *const T); // scope 1 at $SRC_DIR/alloc/src/boxed.rs:LL:COL + _2 = &(*_5); // scope 1 at $SRC_DIR/alloc/src/boxed.rs:LL:COL + StorageDead(_5); // scope 1 at $SRC_DIR/alloc/src/boxed.rs:LL:COL StorageDead(_4); // scope 1 at $SRC_DIR/alloc/src/boxed.rs:LL:COL _0 = &(*_2); // scope 0 at $DIR/issue-58867-inline-as-ref-as-mut.rs:18:5: 18:15 StorageDead(_3); // scope 0 at $DIR/issue-58867-inline-as-ref-as-mut.rs:18:14: 18:15 diff --git a/src/test/mir-opt/issue_41888.main.ElaborateDrops.after.mir b/src/test/mir-opt/issue_41888.main.ElaborateDrops.after.mir index 54930937c91..ce7ca20358e 100644 --- a/src/test/mir-opt/issue_41888.main.ElaborateDrops.after.mir +++ b/src/test/mir-opt/issue_41888.main.ElaborateDrops.after.mir @@ -14,9 +14,9 @@ fn main() -> () { let mut _11: isize; // in scope 0 at $DIR/issue-41888.rs:15:1: 15:2 scope 1 { debug e => _1; // in scope 1 at $DIR/issue-41888.rs:7:9: 7:10 - let _6: K; // in scope 1 at $DIR/issue-41888.rs:10:21: 10:23 scope 2 { debug _k => _6; // in scope 2 at $DIR/issue-41888.rs:10:21: 10:23 + let _6: K; // in scope 2 at $DIR/issue-41888.rs:10:21: 10:23 } } @@ -51,15 +51,15 @@ fn main() -> () { bb4: { StorageDead(_3); // scope 1 at $DIR/issue-41888.rs:9:19: 9:20 - _5 = discriminant(_1); // scope 1 at $DIR/issue-41888.rs:10:16: 10:24 - switchInt(move _5) -> [0_isize: bb5, otherwise: bb6]; // scope 1 at $DIR/issue-41888.rs:10:16: 10:24 + _5 = discriminant(_1); // scope 2 at $DIR/issue-41888.rs:10:16: 10:24 + switchInt(move _5) -> [0_isize: bb5, otherwise: bb6]; // scope 2 at $DIR/issue-41888.rs:10:16: 10:24 } bb5: { - StorageLive(_6); // scope 1 at $DIR/issue-41888.rs:10:21: 10:23 - _9 = const false; // scope 1 at $DIR/issue-41888.rs:10:21: 10:23 - _6 = move ((_1 as F).0: K); // scope 1 at $DIR/issue-41888.rs:10:21: 10:23 - _0 = const (); // scope 1 at $DIR/issue-41888.rs:10:29: 13:10 + StorageLive(_6); // scope 2 at $DIR/issue-41888.rs:10:21: 10:23 + _9 = const false; // scope 2 at $DIR/issue-41888.rs:10:21: 10:23 + _6 = move ((_1 as F).0: K); // scope 2 at $DIR/issue-41888.rs:10:21: 10:23 + _0 = const (); // scope 2 at $DIR/issue-41888.rs:10:29: 13:10 StorageDead(_6); // scope 1 at $DIR/issue-41888.rs:13:9: 13:10 goto -> bb8; // scope 1 at $DIR/issue-41888.rs:10:9: 13:10 } diff --git a/src/test/mir-opt/issues/issue_75439.foo.MatchBranchSimplification.diff b/src/test/mir-opt/issues/issue_75439.foo.MatchBranchSimplification.diff index 299529ec649..b8023a6a8e6 100644 --- a/src/test/mir-opt/issues/issue_75439.foo.MatchBranchSimplification.diff +++ b/src/test/mir-opt/issues/issue_75439.foo.MatchBranchSimplification.diff @@ -10,11 +10,11 @@ let mut _6: u32; // in scope 0 at $DIR/issue-75439.rs:10:33: 10:35 scope 1 { debug dwords => _2; // in scope 1 at $DIR/issue-75439.rs:7:9: 7:15 - let _4: u32; // in scope 1 at $DIR/issue-75439.rs:9:27: 9:29 scope 3 { debug ip => _4; // in scope 3 at $DIR/issue-75439.rs:9:27: 9:29 - } - scope 4 { + let _4: u32; // in scope 3 at $DIR/issue-75439.rs:9:27: 9:29 + scope 4 { + } } } scope 2 { @@ -32,19 +32,19 @@ bb1: { StorageDead(_3); // scope 2 at $DIR/issue-75439.rs:7:52: 7:53 - switchInt(_2[0 of 4]) -> [0_u32: bb2, otherwise: bb8]; // scope 1 at $DIR/issue-75439.rs:9:12: 9:30 + switchInt(_2[0 of 4]) -> [0_u32: bb2, otherwise: bb8]; // scope 3 at $DIR/issue-75439.rs:9:12: 9:30 } bb2: { - switchInt(_2[1 of 4]) -> [0_u32: bb3, otherwise: bb8]; // scope 1 at $DIR/issue-75439.rs:9:12: 9:30 + switchInt(_2[1 of 4]) -> [0_u32: bb3, otherwise: bb8]; // scope 3 at $DIR/issue-75439.rs:9:12: 9:30 } bb3: { - switchInt(_2[2 of 4]) -> [0_u32: bb5, 4294901760_u32: bb6, otherwise: bb8]; // scope 1 at $DIR/issue-75439.rs:9:12: 9:30 + switchInt(_2[2 of 4]) -> [0_u32: bb5, 4294901760_u32: bb6, otherwise: bb8]; // scope 3 at $DIR/issue-75439.rs:9:12: 9:30 } bb4: { - StorageLive(_5); // scope 1 at $DIR/issue-75439.rs:10:14: 10:38 + StorageLive(_5); // scope 3 at $DIR/issue-75439.rs:10:14: 10:38 StorageLive(_6); // scope 4 at $DIR/issue-75439.rs:10:33: 10:35 _6 = _4; // scope 4 at $DIR/issue-75439.rs:10:33: 10:35 _5 = transmute::<u32, [u8; 4]>(move _6) -> bb7; // scope 4 at $DIR/issue-75439.rs:10:23: 10:36 @@ -54,23 +54,23 @@ } bb5: { - StorageLive(_4); // scope 1 at $DIR/issue-75439.rs:9:27: 9:29 - _4 = _2[3 of 4]; // scope 1 at $DIR/issue-75439.rs:9:27: 9:29 - goto -> bb4; // scope 1 at $DIR/issue-75439.rs:9:12: 9:30 + StorageLive(_4); // scope 3 at $DIR/issue-75439.rs:9:27: 9:29 + _4 = _2[3 of 4]; // scope 3 at $DIR/issue-75439.rs:9:27: 9:29 + goto -> bb4; // scope 3 at $DIR/issue-75439.rs:9:12: 9:30 } bb6: { - StorageLive(_4); // scope 1 at $DIR/issue-75439.rs:9:27: 9:29 - _4 = _2[3 of 4]; // scope 1 at $DIR/issue-75439.rs:9:27: 9:29 - goto -> bb4; // scope 1 at $DIR/issue-75439.rs:9:12: 9:30 + StorageLive(_4); // scope 3 at $DIR/issue-75439.rs:9:27: 9:29 + _4 = _2[3 of 4]; // scope 3 at $DIR/issue-75439.rs:9:27: 9:29 + goto -> bb4; // scope 3 at $DIR/issue-75439.rs:9:12: 9:30 } bb7: { StorageDead(_6); // scope 4 at $DIR/issue-75439.rs:10:35: 10:36 - Deinit(_0); // scope 1 at $DIR/issue-75439.rs:10:9: 10:39 - ((_0 as Some).0: [u8; 4]) = move _5; // scope 1 at $DIR/issue-75439.rs:10:9: 10:39 - discriminant(_0) = 1; // scope 1 at $DIR/issue-75439.rs:10:9: 10:39 - StorageDead(_5); // scope 1 at $DIR/issue-75439.rs:10:38: 10:39 + Deinit(_0); // scope 3 at $DIR/issue-75439.rs:10:9: 10:39 + ((_0 as Some).0: [u8; 4]) = move _5; // scope 3 at $DIR/issue-75439.rs:10:9: 10:39 + discriminant(_0) = 1; // scope 3 at $DIR/issue-75439.rs:10:9: 10:39 + StorageDead(_5); // scope 3 at $DIR/issue-75439.rs:10:38: 10:39 StorageDead(_4); // scope 1 at $DIR/issue-75439.rs:11:5: 11:6 goto -> bb9; // scope 1 at $DIR/issue-75439.rs:9:5: 13:6 } diff --git a/src/test/mir-opt/simplify_locals_fixedpoint.foo.SimplifyLocals.diff b/src/test/mir-opt/simplify_locals_fixedpoint.foo.SimplifyLocals.diff index a8cc61f0526..075fe8d0908 100644 --- a/src/test/mir-opt/simplify_locals_fixedpoint.foo.SimplifyLocals.diff +++ b/src/test/mir-opt/simplify_locals_fixedpoint.foo.SimplifyLocals.diff @@ -8,44 +8,44 @@ let mut _3: std::option::Option<T>; // in scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:51: 4:68 let mut _4: isize; // in scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:22: 4:26 let mut _5: isize; // in scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:13: 4:20 - let _6: u8; // in scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:18: 4:19 - let mut _7: bool; // in scope 0 at $DIR/simplify-locals-fixedpoint.rs:5:12: 5:20 - let mut _8: u8; // in scope 0 at $DIR/simplify-locals-fixedpoint.rs:5:12: 5:13 scope 1 { debug a => _6; // in scope 1 at $DIR/simplify-locals-fixedpoint.rs:4:18: 4:19 + let _6: u8; // in scope 1 at $DIR/simplify-locals-fixedpoint.rs:4:18: 4:19 } bb0: { - StorageLive(_1); // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:30: 4:69 - StorageLive(_2); // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:31: 4:49 - Deinit(_2); // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:31: 4:49 - discriminant(_2) = 0; // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:31: 4:49 - StorageLive(_3); // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:51: 4:68 - Deinit(_3); // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:51: 4:68 - discriminant(_3) = 0; // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:51: 4:68 - Deinit(_1); // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:30: 4:69 - (_1.0: std::option::Option<u8>) = move _2; // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:30: 4:69 - (_1.1: std::option::Option<T>) = move _3; // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:30: 4:69 - StorageDead(_3); // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:68: 4:69 - StorageDead(_2); // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:68: 4:69 - _5 = discriminant((_1.0: std::option::Option<u8>)); // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:12: 4:27 - switchInt(move _5) -> [1_isize: bb1, otherwise: bb3]; // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:12: 4:27 + StorageLive(_1); // scope 1 at $DIR/simplify-locals-fixedpoint.rs:4:30: 4:69 + StorageLive(_2); // scope 1 at $DIR/simplify-locals-fixedpoint.rs:4:31: 4:49 + Deinit(_2); // scope 1 at $DIR/simplify-locals-fixedpoint.rs:4:31: 4:49 + discriminant(_2) = 0; // scope 1 at $DIR/simplify-locals-fixedpoint.rs:4:31: 4:49 + StorageLive(_3); // scope 1 at $DIR/simplify-locals-fixedpoint.rs:4:51: 4:68 + Deinit(_3); // scope 1 at $DIR/simplify-locals-fixedpoint.rs:4:51: 4:68 + discriminant(_3) = 0; // scope 1 at $DIR/simplify-locals-fixedpoint.rs:4:51: 4:68 + Deinit(_1); // scope 1 at $DIR/simplify-locals-fixedpoint.rs:4:30: 4:69 + (_1.0: std::option::Option<u8>) = move _2; // scope 1 at $DIR/simplify-locals-fixedpoint.rs:4:30: 4:69 + (_1.1: std::option::Option<T>) = move _3; // scope 1 at $DIR/simplify-locals-fixedpoint.rs:4:30: 4:69 + StorageDead(_3); // scope 1 at $DIR/simplify-locals-fixedpoint.rs:4:68: 4:69 + StorageDead(_2); // scope 1 at $DIR/simplify-locals-fixedpoint.rs:4:68: 4:69 + _5 = discriminant((_1.0: std::option::Option<u8>)); // scope 1 at $DIR/simplify-locals-fixedpoint.rs:4:12: 4:27 + switchInt(move _5) -> [1_isize: bb1, otherwise: bb3]; // scope 1 at $DIR/simplify-locals-fixedpoint.rs:4:12: 4:27 } bb1: { - _4 = discriminant((_1.1: std::option::Option<T>)); // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:12: 4:27 - switchInt(move _4) -> [0_isize: bb2, otherwise: bb3]; // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:12: 4:27 + _4 = discriminant((_1.1: std::option::Option<T>)); // scope 1 at $DIR/simplify-locals-fixedpoint.rs:4:12: 4:27 + switchInt(move _4) -> [0_isize: bb2, otherwise: bb3]; // scope 1 at $DIR/simplify-locals-fixedpoint.rs:4:12: 4:27 } bb2: { - StorageLive(_6); // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:18: 4:19 - _6 = (((_1.0: std::option::Option<u8>) as Some).0: u8); // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:18: 4:19 -- StorageLive(_7); // scope 0 at $DIR/simplify-locals-fixedpoint.rs:5:12: 5:20 -- StorageLive(_8); // scope 0 at $DIR/simplify-locals-fixedpoint.rs:5:12: 5:13 -- _8 = _6; // scope 0 at $DIR/simplify-locals-fixedpoint.rs:5:12: 5:13 -- _7 = Gt(move _8, const 42_u8); // scope 0 at $DIR/simplify-locals-fixedpoint.rs:5:12: 5:20 -- StorageDead(_8); // scope 0 at $DIR/simplify-locals-fixedpoint.rs:5:19: 5:20 -- StorageDead(_7); // scope 0 at $DIR/simplify-locals-fixedpoint.rs:7:9: 7:10 + StorageLive(_6); // scope 1 at $DIR/simplify-locals-fixedpoint.rs:4:18: 4:19 + _6 = (((_1.0: std::option::Option<u8>) as Some).0: u8); // scope 1 at $DIR/simplify-locals-fixedpoint.rs:4:18: 4:19 +- StorageLive(_7); // scope 1 at $DIR/simplify-locals-fixedpoint.rs:5:12: 5:20 +- StorageLive(_8); // scope 1 at $DIR/simplify-locals-fixedpoint.rs:5:12: 5:13 +- _8 = _6; // scope 1 at $DIR/simplify-locals-fixedpoint.rs:5:12: 5:13 +- _7 = Gt(move _8, const 42_u8); // scope 1 at $DIR/simplify-locals-fixedpoint.rs:5:12: 5:20 +- StorageDead(_8); // scope 1 at $DIR/simplify-locals-fixedpoint.rs:5:19: 5:20 +- StorageDead(_7); // scope 1 at $DIR/simplify-locals-fixedpoint.rs:7:9: 7:10 StorageDead(_6); // scope 0 at $DIR/simplify-locals-fixedpoint.rs:8:5: 8:6 goto -> bb3; // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:5: 8:6 } diff --git a/src/test/mir-opt/unreachable.main.UnreachablePropagation.diff b/src/test/mir-opt/unreachable.main.UnreachablePropagation.diff index 08312bde20f..70486f546d7 100644 --- a/src/test/mir-opt/unreachable.main.UnreachablePropagation.diff +++ b/src/test/mir-opt/unreachable.main.UnreachablePropagation.diff @@ -5,36 +5,36 @@ let mut _0: (); // return place in scope 0 at $DIR/unreachable.rs:8:11: 8:11 let mut _1: std::option::Option<Empty>; // in scope 0 at $DIR/unreachable.rs:9:23: 9:30 let mut _2: isize; // in scope 0 at $DIR/unreachable.rs:9:12: 9:20 - let _3: Empty; // in scope 0 at $DIR/unreachable.rs:9:17: 9:19 - let mut _4: i32; // in scope 0 at $DIR/unreachable.rs:10:13: 10:19 let _5: (); // in scope 0 at $DIR/unreachable.rs:12:9: 16:10 let mut _6: bool; // in scope 0 at $DIR/unreachable.rs:12:12: 12:16 let mut _7: !; // in scope 0 at $DIR/unreachable.rs:18:9: 18:21 scope 1 { debug _x => _3; // in scope 1 at $DIR/unreachable.rs:9:17: 9:19 - } - scope 2 { - debug _y => _4; // in scope 2 at $DIR/unreachable.rs:10:13: 10:19 + let _3: Empty; // in scope 1 at $DIR/unreachable.rs:9:17: 9:19 + let mut _4: i32; // in scope 1 at $DIR/unreachable.rs:10:13: 10:19 + scope 2 { + debug _y => _4; // in scope 2 at $DIR/unreachable.rs:10:13: 10:19 + } } bb0: { - StorageLive(_1); // scope 0 at $DIR/unreachable.rs:9:23: 9:30 - _1 = empty() -> bb1; // scope 0 at $DIR/unreachable.rs:9:23: 9:30 + StorageLive(_1); // scope 1 at $DIR/unreachable.rs:9:23: 9:30 + _1 = empty() -> bb1; // scope 1 at $DIR/unreachable.rs:9:23: 9:30 // mir::Constant // + span: $DIR/unreachable.rs:9:23: 9:28 // + literal: Const { ty: fn() -> Option<Empty> {empty}, val: Value(Scalar(<ZST>)) } } bb1: { - _2 = discriminant(_1); // scope 0 at $DIR/unreachable.rs:9:12: 9:20 -- switchInt(move _2) -> [1_isize: bb2, otherwise: bb6]; // scope 0 at $DIR/unreachable.rs:9:12: 9:20 -+ goto -> bb2; // scope 0 at $DIR/unreachable.rs:9:12: 9:20 + _2 = discriminant(_1); // scope 1 at $DIR/unreachable.rs:9:12: 9:20 +- switchInt(move _2) -> [1_isize: bb2, otherwise: bb6]; // scope 1 at $DIR/unreachable.rs:9:12: 9:20 ++ goto -> bb2; // scope 1 at $DIR/unreachable.rs:9:12: 9:20 } bb2: { -- StorageLive(_3); // scope 0 at $DIR/unreachable.rs:9:17: 9:19 -- _3 = move ((_1 as Some).0: Empty); // scope 0 at $DIR/unreachable.rs:9:17: 9:19 -- StorageLive(_4); // scope 0 at $DIR/unreachable.rs:10:13: 10:19 +- StorageLive(_3); // scope 1 at $DIR/unreachable.rs:9:17: 9:19 +- _3 = move ((_1 as Some).0: Empty); // scope 1 at $DIR/unreachable.rs:9:17: 9:19 +- StorageLive(_4); // scope 1 at $DIR/unreachable.rs:10:13: 10:19 - StorageLive(_5); // scope 2 at $DIR/unreachable.rs:12:9: 16:10 - StorageLive(_6); // scope 2 at $DIR/unreachable.rs:12:12: 12:16 - _6 = const true; // scope 2 at $DIR/unreachable.rs:12:12: 12:16 diff --git a/src/test/mir-opt/unreachable_diverging.main.UnreachablePropagation.diff b/src/test/mir-opt/unreachable_diverging.main.UnreachablePropagation.diff index e5867ccfc5c..d9f2681d145 100644 --- a/src/test/mir-opt/unreachable_diverging.main.UnreachablePropagation.diff +++ b/src/test/mir-opt/unreachable_diverging.main.UnreachablePropagation.diff @@ -11,56 +11,56 @@ let mut _7: !; // in scope 0 at $DIR/unreachable_diverging.rs:18:9: 18:22 scope 1 { debug x => _1; // in scope 1 at $DIR/unreachable_diverging.rs:13:9: 13:10 - let _4: Empty; // in scope 1 at $DIR/unreachable_diverging.rs:14:17: 14:21 scope 2 { debug bomb => _4; // in scope 2 at $DIR/unreachable_diverging.rs:14:17: 14:21 + let _4: Empty; // in scope 2 at $DIR/unreachable_diverging.rs:14:17: 14:21 } } bb0: { StorageLive(_1); // scope 0 at $DIR/unreachable_diverging.rs:13:9: 13:10 _1 = const true; // scope 0 at $DIR/unreachable_diverging.rs:13:13: 13:17 - StorageLive(_2); // scope 1 at $DIR/unreachable_diverging.rs:14:25: 14:32 - _2 = empty() -> bb1; // scope 1 at $DIR/unreachable_diverging.rs:14:25: 14:32 + StorageLive(_2); // scope 2 at $DIR/unreachable_diverging.rs:14:25: 14:32 + _2 = empty() -> bb1; // scope 2 at $DIR/unreachable_diverging.rs:14:25: 14:32 // mir::Constant // + span: $DIR/unreachable_diverging.rs:14:25: 14:30 // + literal: Const { ty: fn() -> Option<Empty> {empty}, val: Value(Scalar(<ZST>)) } } bb1: { - _3 = discriminant(_2); // scope 1 at $DIR/unreachable_diverging.rs:14:12: 14:22 -- switchInt(move _3) -> [1_isize: bb2, otherwise: bb6]; // scope 1 at $DIR/unreachable_diverging.rs:14:12: 14:22 -+ switchInt(move _3) -> [1_isize: bb2, otherwise: bb5]; // scope 1 at $DIR/unreachable_diverging.rs:14:12: 14:22 + _3 = discriminant(_2); // scope 2 at $DIR/unreachable_diverging.rs:14:12: 14:22 +- switchInt(move _3) -> [1_isize: bb2, otherwise: bb6]; // scope 2 at $DIR/unreachable_diverging.rs:14:12: 14:22 ++ switchInt(move _3) -> [1_isize: bb2, otherwise: bb5]; // scope 2 at $DIR/unreachable_diverging.rs:14:12: 14:22 } bb2: { - StorageLive(_4); // scope 1 at $DIR/unreachable_diverging.rs:14:17: 14:21 - _4 = move ((_2 as Some).0: Empty); // scope 1 at $DIR/unreachable_diverging.rs:14:17: 14:21 - StorageLive(_5); // scope 1 at $DIR/unreachable_diverging.rs:15:9: 17:10 - StorageLive(_6); // scope 1 at $DIR/unreachable_diverging.rs:15:12: 15:13 - _6 = _1; // scope 1 at $DIR/unreachable_diverging.rs:15:12: 15:13 -- switchInt(move _6) -> [false: bb4, otherwise: bb3]; // scope 1 at $DIR/unreachable_diverging.rs:15:12: 15:13 -+ goto -> bb3; // scope 1 at $DIR/unreachable_diverging.rs:15:12: 15:13 + StorageLive(_4); // scope 2 at $DIR/unreachable_diverging.rs:14:17: 14:21 + _4 = move ((_2 as Some).0: Empty); // scope 2 at $DIR/unreachable_diverging.rs:14:17: 14:21 + StorageLive(_5); // scope 2 at $DIR/unreachable_diverging.rs:15:9: 17:10 + StorageLive(_6); // scope 2 at $DIR/unreachable_diverging.rs:15:12: 15:13 + _6 = _1; // scope 2 at $DIR/unreachable_diverging.rs:15:12: 15:13 +- switchInt(move _6) -> [false: bb4, otherwise: bb3]; // scope 2 at $DIR/unreachable_diverging.rs:15:12: 15:13 ++ goto -> bb3; // scope 2 at $DIR/unreachable_diverging.rs:15:12: 15:13 } bb3: { -- _5 = loop_forever() -> bb5; // scope 1 at $DIR/unreachable_diverging.rs:16:13: 16:27 -+ _5 = loop_forever() -> bb4; // scope 1 at $DIR/unreachable_diverging.rs:16:13: 16:27 +- _5 = loop_forever() -> bb5; // scope 2 at $DIR/unreachable_diverging.rs:16:13: 16:27 ++ _5 = loop_forever() -> bb4; // scope 2 at $DIR/unreachable_diverging.rs:16:13: 16:27 // mir::Constant // + span: $DIR/unreachable_diverging.rs:16:13: 16:25 // + literal: Const { ty: fn() {loop_forever}, val: Value(Scalar(<ZST>)) } } bb4: { -- _5 = const (); // scope 1 at $DIR/unreachable_diverging.rs:17:10: 17:10 -- goto -> bb5; // scope 1 at $DIR/unreachable_diverging.rs:15:9: 17:10 +- _5 = const (); // scope 2 at $DIR/unreachable_diverging.rs:17:10: 17:10 +- goto -> bb5; // scope 2 at $DIR/unreachable_diverging.rs:15:9: 17:10 - } - - bb5: { - StorageDead(_6); // scope 1 at $DIR/unreachable_diverging.rs:17:9: 17:10 - StorageDead(_5); // scope 1 at $DIR/unreachable_diverging.rs:17:9: 17:10 - StorageLive(_7); // scope 1 at $DIR/unreachable_diverging.rs:18:9: 18:22 - unreachable; // scope 1 at $DIR/unreachable_diverging.rs:18:15: 18:19 + StorageDead(_6); // scope 2 at $DIR/unreachable_diverging.rs:17:9: 17:10 + StorageDead(_5); // scope 2 at $DIR/unreachable_diverging.rs:17:9: 17:10 + StorageLive(_7); // scope 2 at $DIR/unreachable_diverging.rs:18:9: 18:22 + unreachable; // scope 2 at $DIR/unreachable_diverging.rs:18:15: 18:19 } - bb6: { diff --git a/src/test/mir-opt/while_let_loops.change_loop_body.ConstProp.32bit.diff b/src/test/mir-opt/while_let_loops.change_loop_body.ConstProp.32bit.diff index 0529b15522e..f8b41d7b4c5 100644 --- a/src/test/mir-opt/while_let_loops.change_loop_body.ConstProp.32bit.diff +++ b/src/test/mir-opt/while_let_loops.change_loop_body.ConstProp.32bit.diff @@ -13,28 +13,30 @@ let mut _8: !; // in scope 0 at $DIR/while_let_loops.rs:7:5: 10:6 scope 1 { debug _x => _1; // in scope 1 at $DIR/while_let_loops.rs:6:9: 6:15 + scope 2 { + } } bb0: { StorageLive(_1); // scope 0 at $DIR/while_let_loops.rs:6:9: 6:15 _1 = const 0_i32; // scope 0 at $DIR/while_let_loops.rs:6:18: 6:19 - StorageLive(_3); // scope 1 at $DIR/while_let_loops.rs:7:28: 7:32 - Deinit(_3); // scope 1 at $DIR/while_let_loops.rs:7:28: 7:32 - discriminant(_3) = 0; // scope 1 at $DIR/while_let_loops.rs:7:28: 7:32 -- _4 = discriminant(_3); // scope 1 at $DIR/while_let_loops.rs:7:15: 7:25 -- switchInt(move _4) -> [1_isize: bb1, otherwise: bb3]; // scope 1 at $DIR/while_let_loops.rs:7:15: 7:25 -+ _4 = const 0_isize; // scope 1 at $DIR/while_let_loops.rs:7:15: 7:25 -+ switchInt(const 0_isize) -> [1_isize: bb1, otherwise: bb3]; // scope 1 at $DIR/while_let_loops.rs:7:15: 7:25 + StorageLive(_3); // scope 2 at $DIR/while_let_loops.rs:7:28: 7:32 + Deinit(_3); // scope 2 at $DIR/while_let_loops.rs:7:28: 7:32 + discriminant(_3) = 0; // scope 2 at $DIR/while_let_loops.rs:7:28: 7:32 +- _4 = discriminant(_3); // scope 2 at $DIR/while_let_loops.rs:7:15: 7:25 +- switchInt(move _4) -> [1_isize: bb1, otherwise: bb3]; // scope 2 at $DIR/while_let_loops.rs:7:15: 7:25 ++ _4 = const 0_isize; // scope 2 at $DIR/while_let_loops.rs:7:15: 7:25 ++ switchInt(const 0_isize) -> [1_isize: bb1, otherwise: bb3]; // scope 2 at $DIR/while_let_loops.rs:7:15: 7:25 } bb1: { - switchInt(((_3 as Some).0: u32)) -> [0_u32: bb2, otherwise: bb3]; // scope 1 at $DIR/while_let_loops.rs:7:15: 7:25 + switchInt(((_3 as Some).0: u32)) -> [0_u32: bb2, otherwise: bb3]; // scope 2 at $DIR/while_let_loops.rs:7:15: 7:25 } bb2: { - _1 = const 1_i32; // scope 1 at $DIR/while_let_loops.rs:8:9: 8:15 - nop; // scope 1 at $DIR/while_let_loops.rs:9:9: 9:14 - goto -> bb4; // scope 1 at $DIR/while_let_loops.rs:9:9: 9:14 + _1 = const 1_i32; // scope 2 at $DIR/while_let_loops.rs:8:9: 8:15 + nop; // scope 2 at $DIR/while_let_loops.rs:9:9: 9:14 + goto -> bb4; // scope 2 at $DIR/while_let_loops.rs:9:9: 9:14 } bb3: { diff --git a/src/test/mir-opt/while_let_loops.change_loop_body.ConstProp.64bit.diff b/src/test/mir-opt/while_let_loops.change_loop_body.ConstProp.64bit.diff index 0529b15522e..f8b41d7b4c5 100644 --- a/src/test/mir-opt/while_let_loops.change_loop_body.ConstProp.64bit.diff +++ b/src/test/mir-opt/while_let_loops.change_loop_body.ConstProp.64bit.diff @@ -13,28 +13,30 @@ let mut _8: !; // in scope 0 at $DIR/while_let_loops.rs:7:5: 10:6 scope 1 { debug _x => _1; // in scope 1 at $DIR/while_let_loops.rs:6:9: 6:15 + scope 2 { + } } bb0: { StorageLive(_1); // scope 0 at $DIR/while_let_loops.rs:6:9: 6:15 _1 = const 0_i32; // scope 0 at $DIR/while_let_loops.rs:6:18: 6:19 - StorageLive(_3); // scope 1 at $DIR/while_let_loops.rs:7:28: 7:32 - Deinit(_3); // scope 1 at $DIR/while_let_loops.rs:7:28: 7:32 - discriminant(_3) = 0; // scope 1 at $DIR/while_let_loops.rs:7:28: 7:32 -- _4 = discriminant(_3); // scope 1 at $DIR/while_let_loops.rs:7:15: 7:25 -- switchInt(move _4) -> [1_isize: bb1, otherwise: bb3]; // scope 1 at $DIR/while_let_loops.rs:7:15: 7:25 -+ _4 = const 0_isize; // scope 1 at $DIR/while_let_loops.rs:7:15: 7:25 -+ switchInt(const 0_isize) -> [1_isize: bb1, otherwise: bb3]; // scope 1 at $DIR/while_let_loops.rs:7:15: 7:25 + StorageLive(_3); // scope 2 at $DIR/while_let_loops.rs:7:28: 7:32 + Deinit(_3); // scope 2 at $DIR/while_let_loops.rs:7:28: 7:32 + discriminant(_3) = 0; // scope 2 at $DIR/while_let_loops.rs:7:28: 7:32 +- _4 = discriminant(_3); // scope 2 at $DIR/while_let_loops.rs:7:15: 7:25 +- switchInt(move _4) -> [1_isize: bb1, otherwise: bb3]; // scope 2 at $DIR/while_let_loops.rs:7:15: 7:25 ++ _4 = const 0_isize; // scope 2 at $DIR/while_let_loops.rs:7:15: 7:25 ++ switchInt(const 0_isize) -> [1_isize: bb1, otherwise: bb3]; // scope 2 at $DIR/while_let_loops.rs:7:15: 7:25 } bb1: { - switchInt(((_3 as Some).0: u32)) -> [0_u32: bb2, otherwise: bb3]; // scope 1 at $DIR/while_let_loops.rs:7:15: 7:25 + switchInt(((_3 as Some).0: u32)) -> [0_u32: bb2, otherwise: bb3]; // scope 2 at $DIR/while_let_loops.rs:7:15: 7:25 } bb2: { - _1 = const 1_i32; // scope 1 at $DIR/while_let_loops.rs:8:9: 8:15 - nop; // scope 1 at $DIR/while_let_loops.rs:9:9: 9:14 - goto -> bb4; // scope 1 at $DIR/while_let_loops.rs:9:9: 9:14 + _1 = const 1_i32; // scope 2 at $DIR/while_let_loops.rs:8:9: 8:15 + nop; // scope 2 at $DIR/while_let_loops.rs:9:9: 9:14 + goto -> bb4; // scope 2 at $DIR/while_let_loops.rs:9:9: 9:14 } bb3: { diff --git a/src/test/mir-opt/while_let_loops.change_loop_body.PreCodegen.after.32bit.mir b/src/test/mir-opt/while_let_loops.change_loop_body.PreCodegen.after.32bit.mir index 3c94fbddc44..5657f9413a1 100644 --- a/src/test/mir-opt/while_let_loops.change_loop_body.PreCodegen.after.32bit.mir +++ b/src/test/mir-opt/while_let_loops.change_loop_body.PreCodegen.after.32bit.mir @@ -5,6 +5,8 @@ fn change_loop_body() -> () { let mut _1: i32; // in scope 0 at $DIR/while_let_loops.rs:6:9: 6:15 scope 1 { debug _x => _1; // in scope 1 at $DIR/while_let_loops.rs:6:9: 6:15 + scope 2 { + } } bb0: { diff --git a/src/test/mir-opt/while_let_loops.change_loop_body.PreCodegen.after.64bit.mir b/src/test/mir-opt/while_let_loops.change_loop_body.PreCodegen.after.64bit.mir index 3c94fbddc44..5657f9413a1 100644 --- a/src/test/mir-opt/while_let_loops.change_loop_body.PreCodegen.after.64bit.mir +++ b/src/test/mir-opt/while_let_loops.change_loop_body.PreCodegen.after.64bit.mir @@ -5,6 +5,8 @@ fn change_loop_body() -> () { let mut _1: i32; // in scope 0 at $DIR/while_let_loops.rs:6:9: 6:15 scope 1 { debug _x => _1; // in scope 1 at $DIR/while_let_loops.rs:6:9: 6:15 + scope 2 { + } } bb0: { diff --git a/src/test/pretty/where-clauses.rs b/src/test/pretty/where-clauses.rs index 5614a81b0eb..4183799457b 100644 --- a/src/test/pretty/where-clauses.rs +++ b/src/test/pretty/where-clauses.rs @@ -2,4 +2,7 @@ fn f<'a, 'b, T>(t: T) -> isize where T: 'a, 'a: 'b, T: Eq { 0 } +// This is legal syntax, sometimes generated by macros. `where T: $($bound+)*` +fn zero_bounds<'a, T>() where 'a:, T: {} + fn main() {} diff --git a/src/test/run-make/libtest-thread-limit/test.rs b/src/test/run-make/libtest-thread-limit/test.rs index d899411a49e..26bc29216cf 100644 --- a/src/test/run-make/libtest-thread-limit/test.rs +++ b/src/test/run-make/libtest-thread-limit/test.rs @@ -1,8 +1,12 @@ #![feature(once_cell)] -use std::{io::ErrorKind, lazy::SyncOnceCell, thread::{self, Builder, ThreadId}}; +use std::{ + io::ErrorKind, + sync::OnceLock, + thread::{self, Builder, ThreadId}, +}; -static THREAD_ID: SyncOnceCell<ThreadId> = SyncOnceCell::new(); +static THREAD_ID: OnceLock<ThreadId> = OnceLock::new(); #[test] fn spawn_thread_would_block() { diff --git a/src/test/run-pass-valgrind/cast-enum-with-dtor.rs b/src/test/run-pass-valgrind/cast-enum-with-dtor.rs index 93c47d32f92..998d202b117 100644 --- a/src/test/run-pass-valgrind/cast-enum-with-dtor.rs +++ b/src/test/run-pass-valgrind/cast-enum-with-dtor.rs @@ -1,4 +1,4 @@ -#![allow(dead_code)] +#![allow(dead_code, cenum_impl_drop_cast)] // check dtor calling order when casting enums. diff --git a/src/test/rustdoc-gui/duplicate-macro-reexport.goml b/src/test/rustdoc-gui/duplicate-macro-reexport.goml index c79b3a220c4..9ea5990622a 100644 --- a/src/test/rustdoc-gui/duplicate-macro-reexport.goml +++ b/src/test/rustdoc-gui/duplicate-macro-reexport.goml @@ -1,14 +1,14 @@ // This test ensures that there is no macro duplicates in the sidebar. goto: file://|DOC_PATH|/test_docs/macro.a.html // Waiting for the elements in the sidebar to be rendered. -wait-for: ".sidebar-elems .others .macro" +wait-for: ".sidebar-elems .macro" // Check there is only one macro named "a" listed in the sidebar. assert-count: ( - "//*[@class='sidebar-elems']//*[@class='others']/*[@class='block macro']//li/a[text()='a']", + "//*[@class='sidebar-elems']//*[@class='block macro']//li/a[text()='a']", 1, ) // Check there is only one macro named "b" listed in the sidebar. assert-count: ( - "//*[@class='sidebar-elems']//*[@class='others']/*[@class='block macro']//li/a[text()='b']", + "//*[@class='sidebar-elems']//*[@class='block macro']//li/a[text()='b']", 1, ) diff --git a/src/test/rustdoc-gui/headings.goml b/src/test/rustdoc-gui/headings.goml index 8f126d98fe4..67e97eb686e 100644 --- a/src/test/rustdoc-gui/headings.goml +++ b/src/test/rustdoc-gui/headings.goml @@ -106,8 +106,8 @@ assert-css: ("h6#sub-heading-for-enum-impl-item-doc", {"border-bottom-width": "0 assert-css: ("h6#sub-sub-heading-for-enum-impl-item-doc", {"font-size": "14px"}) assert-css: ("h6#sub-sub-heading-for-enum-impl-item-doc", {"border-bottom-width": "0px"}) -assert-text: (".sidebar .others h3", "Modules") -assert-css: (".sidebar .others h3", {"border-bottom-width": "0px"}, ALL) +assert-text: (".sidebar .mod h3", "Modules") +assert-css: (".sidebar .mod h3", {"border-bottom-width": "0px"}, ALL) goto: file://|DOC_PATH|/test_docs/union.HeavilyDocumentedUnion.html diff --git a/src/test/rustdoc-json/primitive_overloading.rs b/src/test/rustdoc-json/primitive_overloading.rs new file mode 100644 index 00000000000..a10d5a83795 --- /dev/null +++ b/src/test/rustdoc-json/primitive_overloading.rs @@ -0,0 +1,17 @@ +// compile-flags: --document-private-items + +// Regression test for <https://github.com/rust-lang/rust/issues/98006>. + +#![feature(rustdoc_internals)] +#![feature(no_core)] + +#![no_core] + +// @has primitive_overloading.json +// @has - "$.index[*][?(@.name=='usize')]" +// @has - "$.index[*][?(@.name=='prim')]" + +#[doc(primitive = "usize")] +/// This is the built-in type `usize`. +mod prim { +} diff --git a/src/test/rustdoc-ui/display-output.stdout b/src/test/rustdoc-ui/display-output.stdout index 51d638b31a8..ad25d1ce541 100644 --- a/src/test/rustdoc-ui/display-output.stdout +++ b/src/test/rustdoc-ui/display-output.stdout @@ -24,7 +24,7 @@ warning: unused variable: `x` LL | fn foo(x: &dyn std::fmt::Display) {} | ^ help: if this is intentional, prefix it with an underscore: `_x` -warning: function is never used: `foo` +warning: function `foo` is never used --> $DIR/display-output.rs:13:4 | LL | fn foo(x: &dyn std::fmt::Display) {} diff --git a/src/test/rustdoc-ui/intra-doc/disambiguator-mismatch.stderr b/src/test/rustdoc-ui/intra-doc/disambiguator-mismatch.stderr index ad9102c506f..ee35749ce7f 100644 --- a/src/test/rustdoc-ui/intra-doc/disambiguator-mismatch.stderr +++ b/src/test/rustdoc-ui/intra-doc/disambiguator-mismatch.stderr @@ -68,7 +68,7 @@ help: to link to the macro, add an exclamation mark | LL - /// Link to [derive@m] LL + /// Link to [m!] - | + | error: unresolved link to `m` --> $DIR/disambiguator-mismatch.rs:46:14 @@ -124,7 +124,7 @@ help: to link to the constant, prefix with `const@` | LL - /// Link to [c()] LL + /// Link to [const@c] - | + | error: incompatible link kind for `f` --> $DIR/disambiguator-mismatch.rs:72:14 @@ -136,7 +136,7 @@ help: to link to the function, add parentheses | LL - /// Link to [const@f] LL + /// Link to [f()] - | + | error: unresolved link to `std` --> $DIR/disambiguator-mismatch.rs:77:14 diff --git a/src/test/rustdoc-ui/intra-doc/errors.stderr b/src/test/rustdoc-ui/intra-doc/errors.stderr index e1ff3740bf6..9a1896fb0cd 100644 --- a/src/test/rustdoc-ui/intra-doc/errors.stderr +++ b/src/test/rustdoc-ui/intra-doc/errors.stderr @@ -98,7 +98,7 @@ help: to link to the associated function, add parentheses | LL - /// [type@Vec::into_iter] LL + /// [Vec::into_iter()] - | + | error: unresolved link to `S` --> $DIR/errors.rs:68:6 @@ -110,7 +110,7 @@ help: to link to the struct, prefix with `struct@` | LL - /// [S!] LL + /// [struct@S] - | + | error: unresolved link to `S::h` --> $DIR/errors.rs:78:6 @@ -122,7 +122,7 @@ help: to link to the associated function, add parentheses | LL - /// [type@S::h] LL + /// [S::h()] - | + | error: unresolved link to `T::g` --> $DIR/errors.rs:86:6 @@ -134,7 +134,7 @@ help: to link to the associated function, add parentheses | LL - /// [type@T::g] LL + /// [T::g()] - | + | error: unresolved link to `T::h` --> $DIR/errors.rs:91:6 diff --git a/src/test/rustdoc-ui/test-compile-fail1.stderr b/src/test/rustdoc-ui/test-compile-fail1.stderr index 2b38ba9e973..72915e46bec 100644 --- a/src/test/rustdoc-ui/test-compile-fail1.stderr +++ b/src/test/rustdoc-ui/test-compile-fail1.stderr @@ -3,7 +3,7 @@ error[E0428]: the name `f` is defined multiple times | 6 | pub fn f() {} | ---------- previous definition of the value `f` here -7 | +7 | 8 | pub fn f() {} | ^^^^^^^^^^ `f` redefined here | diff --git a/src/test/rustdoc/tuples.link1_i32.html b/src/test/rustdoc/tuples.link1_i32.html new file mode 100644 index 00000000000..4efde28ed52 --- /dev/null +++ b/src/test/rustdoc/tuples.link1_i32.html @@ -0,0 +1 @@ +<code>pub fn tuple1(x: (<a class="primitive" href="{{channel}}/std/primitive.i32.html">i32</a>,)) -> (<a class="primitive" href="{{channel}}/std/primitive.i32.html">i32</a>,)</code> \ No newline at end of file diff --git a/src/test/rustdoc/tuples.link1_t.html b/src/test/rustdoc/tuples.link1_t.html new file mode 100644 index 00000000000..1cbaec05733 --- /dev/null +++ b/src/test/rustdoc/tuples.link1_t.html @@ -0,0 +1 @@ +<code>pub fn tuple1_t<T>(x: <a class="primitive" href="{{channel}}/std/primitive.tuple.html">(T,)</a>) -> <a class="primitive" href="{{channel}}/std/primitive.tuple.html">(T,)</a></code> \ No newline at end of file diff --git a/src/test/rustdoc/tuples.link2_i32.html b/src/test/rustdoc/tuples.link2_i32.html new file mode 100644 index 00000000000..77c8d81b842 --- /dev/null +++ b/src/test/rustdoc/tuples.link2_i32.html @@ -0,0 +1 @@ +<code>pub fn tuple2(x: (<a class="primitive" href="{{channel}}/std/primitive.i32.html">i32</a>, <a class="primitive" href="{{channel}}/std/primitive.i32.html">i32</a>)) -> (<a class="primitive" href="{{channel}}/std/primitive.i32.html">i32</a>, <a class="primitive" href="{{channel}}/std/primitive.i32.html">i32</a>)</code> \ No newline at end of file diff --git a/src/test/rustdoc/tuples.link2_t.html b/src/test/rustdoc/tuples.link2_t.html new file mode 100644 index 00000000000..2477aa6be9d --- /dev/null +++ b/src/test/rustdoc/tuples.link2_t.html @@ -0,0 +1 @@ +<code>pub fn tuple2_t<T>(x: <a class="primitive" href="{{channel}}/std/primitive.tuple.html">(T, T)</a>) -> <a class="primitive" href="{{channel}}/std/primitive.tuple.html">(T, T)</a></code> \ No newline at end of file diff --git a/src/test/rustdoc/tuples.link2_tu.html b/src/test/rustdoc/tuples.link2_tu.html new file mode 100644 index 00000000000..b02f8dd8d65 --- /dev/null +++ b/src/test/rustdoc/tuples.link2_tu.html @@ -0,0 +1 @@ +<code>pub fn tuple2_tu<T, U>(x: <a class="primitive" href="{{channel}}/std/primitive.tuple.html">(T, U)</a>) -> <a class="primitive" href="{{channel}}/std/primitive.tuple.html">(T, U)</a></code> \ No newline at end of file diff --git a/src/test/rustdoc/tuples.link_unit.html b/src/test/rustdoc/tuples.link_unit.html new file mode 100644 index 00000000000..839990e1587 --- /dev/null +++ b/src/test/rustdoc/tuples.link_unit.html @@ -0,0 +1 @@ +<code>pub fn tuple0(x: <a class="primitive" href="{{channel}}/std/primitive.unit.html">()</a>)</code> \ No newline at end of file diff --git a/src/test/rustdoc/tuples.rs b/src/test/rustdoc/tuples.rs index 53654abff2a..62e2f9e7ef2 100644 --- a/src/test/rustdoc/tuples.rs +++ b/src/test/rustdoc/tuples.rs @@ -1,8 +1,20 @@ #![crate_name = "foo"] // @has foo/fn.tuple0.html //pre 'pub fn tuple0(x: ())' +// @snapshot link_unit - '//pre[@class="rust fn"]/code' pub fn tuple0(x: ()) -> () { x } // @has foo/fn.tuple1.html //pre 'pub fn tuple1(x: (i32,)) -> (i32,)' +// @snapshot link1_i32 - '//pre[@class="rust fn"]/code' pub fn tuple1(x: (i32,)) -> (i32,) { x } // @has foo/fn.tuple2.html //pre 'pub fn tuple2(x: (i32, i32)) -> (i32, i32)' +// @snapshot link2_i32 - '//pre[@class="rust fn"]/code' pub fn tuple2(x: (i32, i32)) -> (i32, i32) { x } +// @has foo/fn.tuple1_t.html //pre 'pub fn tuple1_t<T>(x: (T,)) -> (T,)' +// @snapshot link1_t - '//pre[@class="rust fn"]/code' +pub fn tuple1_t<T>(x: (T,)) -> (T,) { x } +// @has foo/fn.tuple2_t.html //pre 'pub fn tuple2_t<T>(x: (T, T)) -> (T, T)' +// @snapshot link2_t - '//pre[@class="rust fn"]/code' +pub fn tuple2_t<T>(x: (T, T)) -> (T, T) { x } +// @has foo/fn.tuple2_tu.html //pre 'pub fn tuple2_tu<T, U>(x: (T, U)) -> (T, U)' +// @snapshot link2_tu - '//pre[@class="rust fn"]/code' +pub fn tuple2_tu<T, U>(x: (T, U)) -> (T, U) { x } diff --git a/src/test/ui-fulldeps/deriving-encodable-decodable-box.rs b/src/test/ui-fulldeps/deriving-encodable-decodable-box.rs index 4ad4ef60a52..a4b911878e0 100644 --- a/src/test/ui-fulldeps/deriving-encodable-decodable-box.rs +++ b/src/test/ui-fulldeps/deriving-encodable-decodable-box.rs @@ -20,7 +20,7 @@ fn main() { let mut encoder = MemEncoder::new(); obj.encode(&mut encoder); - let data = encoder.finish().unwrap(); + let data = encoder.finish(); let mut decoder = MemDecoder::new(&data, 0); let obj2 = A::decode(&mut decoder); diff --git a/src/test/ui-fulldeps/deriving-encodable-decodable-cell-refcell.rs b/src/test/ui-fulldeps/deriving-encodable-decodable-cell-refcell.rs index 3ac3abae692..580c85f9b78 100644 --- a/src/test/ui-fulldeps/deriving-encodable-decodable-cell-refcell.rs +++ b/src/test/ui-fulldeps/deriving-encodable-decodable-cell-refcell.rs @@ -29,7 +29,7 @@ fn main() { let mut encoder = MemEncoder::new(); obj.encode(&mut encoder); - let data = encoder.finish().unwrap(); + let data = encoder.finish(); let mut decoder = MemDecoder::new(&data, 0); let obj2 = B::decode(&mut decoder); diff --git a/src/test/ui-fulldeps/issue-14021.rs b/src/test/ui-fulldeps/issue-14021.rs index b7b6e1b860d..215dfaed7ab 100644 --- a/src/test/ui-fulldeps/issue-14021.rs +++ b/src/test/ui-fulldeps/issue-14021.rs @@ -19,7 +19,7 @@ pub fn main() { let mut encoder = MemEncoder::new(); obj.encode(&mut encoder); - let data = encoder.finish().unwrap(); + let data = encoder.finish(); let mut decoder = MemDecoder::new(&data, 0); let obj2 = UnitLikeStruct::decode(&mut decoder); diff --git a/src/test/ui/argument-suggestions/basic.stderr b/src/test/ui/argument-suggestions/basic.stderr index b44e77b43f8..dd4812b5b25 100644 --- a/src/test/ui/argument-suggestions/basic.stderr +++ b/src/test/ui/argument-suggestions/basic.stderr @@ -41,8 +41,8 @@ LL | fn missing(_i: u32) {} | ^^^^^^^ ------- help: provide the argument | -LL | missing({u32}); - | ~~~~~~~~~~~~~~ +LL | missing(/* u32 */); + | ~~~~~~~~~~~~~~~~~~ error[E0308]: arguments to this function are incorrect --> $DIR/basic.rs:23:5 @@ -94,8 +94,8 @@ LL | let closure = |x| x; | ^^^ help: provide the argument | -LL | closure({_}); - | ~~~~~~~~~~~~ +LL | closure(/* value */); + | ~~~~~~~~~~~~~~~~~~~~ error: aborting due to 6 previous errors diff --git a/src/test/ui/argument-suggestions/complex.stderr b/src/test/ui/argument-suggestions/complex.stderr index c628f7dff34..fa030a8f49d 100644 --- a/src/test/ui/argument-suggestions/complex.stderr +++ b/src/test/ui/argument-suggestions/complex.stderr @@ -11,8 +11,8 @@ LL | fn complex(_i: u32, _s: &str, _e: E, _f: F, _g: G, _x: X, _y: Y, _z: Z ) {} | ^^^^^^^ ------- -------- ----- ----- ----- ----- ----- ------ help: did you mean | -LL | complex({u32}, &"", {E}, F::X2, G{}, X {}, Y {}, Z {}); - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL | complex(/* u32 */, &"", /* E */, F::X2, G{}, X {}, Y {}, Z {}); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to previous error diff --git a/src/test/ui/argument-suggestions/issue-96638.stderr b/src/test/ui/argument-suggestions/issue-96638.stderr index 35190e2ca0d..8af31b8b751 100644 --- a/src/test/ui/argument-suggestions/issue-96638.stderr +++ b/src/test/ui/argument-suggestions/issue-96638.stderr @@ -11,8 +11,8 @@ LL | fn f(_: usize, _: &usize, _: usize) {} | ^ -------- --------- -------- help: provide the argument | -LL | f({usize}, &x, {usize}); - | ~~~~~~~~~~~~~~~~~~~~~~~ +LL | f(/* usize */, &x, /* usize */); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to previous error diff --git a/src/test/ui/argument-suggestions/issue-97197.stderr b/src/test/ui/argument-suggestions/issue-97197.stderr index 10689d50957..ac54adc5eeb 100644 --- a/src/test/ui/argument-suggestions/issue-97197.stderr +++ b/src/test/ui/argument-suggestions/issue-97197.stderr @@ -11,8 +11,8 @@ LL | pub fn g(a1: (), a2: bool, a3: bool, a4: bool, a5: bool, a6: ()) -> () {} | ^ ------ -------- -------- -------- -------- ------ help: provide the arguments | -LL | g((), {bool}, {bool}, {bool}, {bool}, ()); - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL | g((), /* bool */, /* bool */, /* bool */, /* bool */, ()); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to previous error diff --git a/src/test/ui/argument-suggestions/issue-97484.stderr b/src/test/ui/argument-suggestions/issue-97484.stderr index 4c461633121..2af24d521f3 100644 --- a/src/test/ui/argument-suggestions/issue-97484.stderr +++ b/src/test/ui/argument-suggestions/issue-97484.stderr @@ -16,11 +16,11 @@ help: consider removing the `` | LL - foo(&&A, B, C, D, E, F, G); LL + foo(&&A, B, C, D, E, F, G); - | + | help: remove the extra arguments | -LL | foo(&&A, D, {&E}, G); - | ~~~~~~~~~~~~~~~~~~~~ +LL | foo(&&A, D, /* &E */, G); + | ~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to previous error diff --git a/src/test/ui/argument-suggestions/missing_arguments.stderr b/src/test/ui/argument-suggestions/missing_arguments.stderr index 5236d15b945..2509d22d7ff 100644 --- a/src/test/ui/argument-suggestions/missing_arguments.stderr +++ b/src/test/ui/argument-suggestions/missing_arguments.stderr @@ -11,8 +11,8 @@ LL | fn one_arg(_a: i32) {} | ^^^^^^^ ------- help: provide the argument | -LL | one_arg({i32}); - | ~~~~~~~~~~~~~~ +LL | one_arg(/* i32 */); + | ~~~~~~~~~~~~~~~~~~ error[E0061]: this function takes 2 arguments but 0 arguments were supplied --> $DIR/missing_arguments.rs:14:3 @@ -27,8 +27,8 @@ LL | fn two_same(_a: i32, _b: i32) {} | ^^^^^^^^ ------- ------- help: provide the arguments | -LL | two_same({i32}, {i32}); - | ~~~~~~~~~~~~~~~~~~~~~~ +LL | two_same(/* i32 */, /* i32 */); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error[E0061]: this function takes 2 arguments but 1 argument was supplied --> $DIR/missing_arguments.rs:15:3 @@ -43,8 +43,8 @@ LL | fn two_same(_a: i32, _b: i32) {} | ^^^^^^^^ ------- ------- help: provide the argument | -LL | two_same(1, {i32}); - | ~~~~~~~~~~~~~~~~~~ +LL | two_same(1, /* i32 */); + | ~~~~~~~~~~~~~~~~~~~~~~ error[E0061]: this function takes 2 arguments but 0 arguments were supplied --> $DIR/missing_arguments.rs:16:3 @@ -59,8 +59,8 @@ LL | fn two_diff(_a: i32, _b: f32) {} | ^^^^^^^^ ------- ------- help: provide the arguments | -LL | two_diff({i32}, {f32}); - | ~~~~~~~~~~~~~~~~~~~~~~ +LL | two_diff(/* i32 */, /* f32 */); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error[E0061]: this function takes 2 arguments but 1 argument was supplied --> $DIR/missing_arguments.rs:17:3 @@ -75,8 +75,8 @@ LL | fn two_diff(_a: i32, _b: f32) {} | ^^^^^^^^ ------- ------- help: provide the argument | -LL | two_diff(1, {f32}); - | ~~~~~~~~~~~~~~~~~~ +LL | two_diff(1, /* f32 */); + | ~~~~~~~~~~~~~~~~~~~~~~ error[E0061]: this function takes 2 arguments but 1 argument was supplied --> $DIR/missing_arguments.rs:18:3 @@ -91,8 +91,8 @@ LL | fn two_diff(_a: i32, _b: f32) {} | ^^^^^^^^ ------- ------- help: provide the argument | -LL | two_diff({i32}, 1.0); - | ~~~~~~~~~~~~~~~~~~~~ +LL | two_diff(/* i32 */, 1.0); + | ~~~~~~~~~~~~~~~~~~~~~~~~ error[E0061]: this function takes 3 arguments but 0 arguments were supplied --> $DIR/missing_arguments.rs:21:3 @@ -107,8 +107,8 @@ LL | fn three_same(_a: i32, _b: i32, _c: i32) {} | ^^^^^^^^^^ ------- ------- ------- help: provide the arguments | -LL | three_same({i32}, {i32}, {i32}); - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL | three_same(/* i32 */, /* i32 */, /* i32 */); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error[E0061]: this function takes 3 arguments but 1 argument was supplied --> $DIR/missing_arguments.rs:22:3 @@ -123,8 +123,8 @@ LL | fn three_same(_a: i32, _b: i32, _c: i32) {} | ^^^^^^^^^^ ------- ------- ------- help: provide the arguments | -LL | three_same(1, {i32}, {i32}); - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL | three_same(1, /* i32 */, /* i32 */); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error[E0061]: this function takes 3 arguments but 2 arguments were supplied --> $DIR/missing_arguments.rs:23:3 @@ -139,8 +139,8 @@ LL | fn three_same(_a: i32, _b: i32, _c: i32) {} | ^^^^^^^^^^ ------- ------- ------- help: provide the argument | -LL | three_same(1, 1, {i32}); - | ~~~~~~~~~~~~~~~~~~~~~~~ +LL | three_same(1, 1, /* i32 */); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ error[E0061]: this function takes 3 arguments but 2 arguments were supplied --> $DIR/missing_arguments.rs:26:3 @@ -155,8 +155,8 @@ LL | fn three_diff(_a: i32, _b: f32, _c: &str) {} | ^^^^^^^^^^ ------- ------- -------- help: provide the argument | -LL | three_diff({i32}, 1.0, ""); - | ~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL | three_diff(/* i32 */, 1.0, ""); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error[E0061]: this function takes 3 arguments but 2 arguments were supplied --> $DIR/missing_arguments.rs:27:3 @@ -171,8 +171,8 @@ LL | fn three_diff(_a: i32, _b: f32, _c: &str) {} | ^^^^^^^^^^ ------- ------- -------- help: provide the argument | -LL | three_diff(1, {f32}, ""); - | ~~~~~~~~~~~~~~~~~~~~~~~~ +LL | three_diff(1, /* f32 */, ""); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error[E0061]: this function takes 3 arguments but 2 arguments were supplied --> $DIR/missing_arguments.rs:28:3 @@ -187,8 +187,8 @@ LL | fn three_diff(_a: i32, _b: f32, _c: &str) {} | ^^^^^^^^^^ ------- ------- -------- help: provide the argument | -LL | three_diff(1, 1.0, {&str}); - | ~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL | three_diff(1, 1.0, /* &str */); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error[E0061]: this function takes 3 arguments but 1 argument was supplied --> $DIR/missing_arguments.rs:29:3 @@ -203,8 +203,8 @@ LL | fn three_diff(_a: i32, _b: f32, _c: &str) {} | ^^^^^^^^^^ ------- ------- -------- help: provide the arguments | -LL | three_diff({i32}, {f32}, ""); - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL | three_diff(/* i32 */, /* f32 */, ""); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error[E0061]: this function takes 3 arguments but 1 argument was supplied --> $DIR/missing_arguments.rs:30:3 @@ -222,8 +222,8 @@ LL | fn three_diff(_a: i32, _b: f32, _c: &str) {} | ^^^^^^^^^^ ------- ------- -------- help: provide the arguments | -LL | three_diff({i32}, 1.0, {&str}); - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL | three_diff(/* i32 */, 1.0, /* &str */); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error[E0061]: this function takes 3 arguments but 1 argument was supplied --> $DIR/missing_arguments.rs:31:3 @@ -238,8 +238,8 @@ LL | fn three_diff(_a: i32, _b: f32, _c: &str) {} | ^^^^^^^^^^ ------- ------- -------- help: provide the arguments | -LL | three_diff(1, {f32}, {&str}); - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL | three_diff(1, /* f32 */, /* &str */); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error[E0061]: this function takes 4 arguments but 0 arguments were supplied --> $DIR/missing_arguments.rs:34:3 @@ -254,8 +254,8 @@ LL | fn four_repeated(_a: i32, _b: f32, _c: f32, _d: &str) {} | ^^^^^^^^^^^^^ ------- ------- ------- -------- help: provide the arguments | -LL | four_repeated({i32}, {f32}, {f32}, {&str}); - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL | four_repeated(/* i32 */, /* f32 */, /* f32 */, /* &str */); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error[E0061]: this function takes 4 arguments but 2 arguments were supplied --> $DIR/missing_arguments.rs:35:3 @@ -270,8 +270,8 @@ LL | fn four_repeated(_a: i32, _b: f32, _c: f32, _d: &str) {} | ^^^^^^^^^^^^^ ------- ------- ------- -------- help: provide the arguments | -LL | four_repeated(1, {f32}, {f32}, ""); - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL | four_repeated(1, /* f32 */, /* f32 */, ""); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error[E0061]: this function takes 5 arguments but 0 arguments were supplied --> $DIR/missing_arguments.rs:38:3 @@ -286,8 +286,8 @@ LL | fn complex(_a: i32, _b: f32, _c: i32, _d: f32, _e: &str) {} | ^^^^^^^ ------- ------- ------- ------- -------- help: provide the arguments | -LL | complex({i32}, {f32}, {i32}, {f32}, {&str}); - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL | complex(/* i32 */, /* f32 */, /* i32 */, /* f32 */, /* &str */); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error[E0061]: this function takes 5 arguments but 2 arguments were supplied --> $DIR/missing_arguments.rs:39:3 @@ -302,8 +302,8 @@ LL | fn complex(_a: i32, _b: f32, _c: i32, _d: f32, _e: &str) {} | ^^^^^^^ ------- ------- ------- ------- -------- help: provide the arguments | -LL | complex(1, {f32}, {i32}, {f32}, ""); - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL | complex(1, /* f32 */, /* i32 */, /* f32 */, ""); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 19 previous errors diff --git a/src/test/ui/argument-suggestions/mixed_cases.stderr b/src/test/ui/argument-suggestions/mixed_cases.stderr index 78765335c02..3fe4473a594 100644 --- a/src/test/ui/argument-suggestions/mixed_cases.stderr +++ b/src/test/ui/argument-suggestions/mixed_cases.stderr @@ -13,8 +13,8 @@ LL | fn two_args(_a: i32, _b: f32) {} | ^^^^^^^^ ------- ------- help: remove the extra argument | -LL | two_args(1, {f32}); - | ~~~~~~~~~~~~~~~~~~ +LL | two_args(1, /* f32 */); + | ~~~~~~~~~~~~~~~~~~~~~~ error[E0061]: this function takes 3 arguments but 4 arguments were supplied --> $DIR/mixed_cases.rs:11:3 @@ -32,8 +32,8 @@ LL | fn three_args(_a: i32, _b: f32, _c: &str) {} | ^^^^^^^^^^ ------- ------- -------- help: did you mean | -LL | three_args(1, {f32}, ""); - | ~~~~~~~~~~~~~~~~~~~~~~~~ +LL | three_args(1, /* f32 */, ""); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error[E0061]: this function takes 3 arguments but 2 arguments were supplied --> $DIR/mixed_cases.rs:14:3 @@ -51,8 +51,8 @@ LL | fn three_args(_a: i32, _b: f32, _c: &str) {} | ^^^^^^^^^^ ------- ------- -------- help: provide the argument | -LL | three_args(1, {f32}, {&str}); - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL | three_args(1, /* f32 */, /* &str */); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error[E0308]: arguments to this function are incorrect --> $DIR/mixed_cases.rs:17:3 @@ -69,8 +69,8 @@ LL | fn three_args(_a: i32, _b: f32, _c: &str) {} | ^^^^^^^^^^ ------- ------- -------- help: did you mean | -LL | three_args(1, {f32}, ""); - | ~~~~~~~~~~~~~~~~~~~~~~~~ +LL | three_args(1, /* f32 */, ""); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error[E0308]: arguments to this function are incorrect --> $DIR/mixed_cases.rs:20:3 @@ -88,8 +88,8 @@ LL | fn three_args(_a: i32, _b: f32, _c: &str) {} | ^^^^^^^^^^ ------- ------- -------- help: swap these arguments | -LL | three_args(1, {f32}, ""); - | ~~~~~~~~~~~~~~~~~~~~~~~~ +LL | three_args(1, /* f32 */, ""); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error[E0061]: this function takes 3 arguments but 2 arguments were supplied --> $DIR/mixed_cases.rs:23:3 @@ -108,8 +108,8 @@ LL | fn three_args(_a: i32, _b: f32, _c: &str) {} | ^^^^^^^^^^ ------- ------- -------- help: did you mean | -LL | three_args(1, {f32}, ""); - | ~~~~~~~~~~~~~~~~~~~~~~~~ +LL | three_args(1, /* f32 */, ""); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 6 previous errors diff --git a/src/test/ui/asm/type-check-1.stderr b/src/test/ui/asm/type-check-1.stderr index 52d814ce682..5a997b47d73 100644 --- a/src/test/ui/asm/type-check-1.stderr +++ b/src/test/ui/asm/type-check-1.stderr @@ -58,7 +58,7 @@ help: consider removing the borrow | LL - asm!("{}", const &0); LL + asm!("{}", const 0); - | + | error: invalid asm output --> $DIR/type-check-1.rs:15:29 diff --git a/src/test/ui/associated-consts/associated-const-dead-code.rs b/src/test/ui/associated-consts/associated-const-dead-code.rs index e659bdb83f9..f7b676418ff 100644 --- a/src/test/ui/associated-consts/associated-const-dead-code.rs +++ b/src/test/ui/associated-consts/associated-const-dead-code.rs @@ -4,7 +4,7 @@ struct MyFoo; impl MyFoo { const BAR: u32 = 1; - //~^ ERROR associated constant is never used: `BAR` + //~^ ERROR associated constant `BAR` is never used } fn main() { diff --git a/src/test/ui/associated-consts/associated-const-dead-code.stderr b/src/test/ui/associated-consts/associated-const-dead-code.stderr index 9b6bbb68a71..7a4dbfe087b 100644 --- a/src/test/ui/associated-consts/associated-const-dead-code.stderr +++ b/src/test/ui/associated-consts/associated-const-dead-code.stderr @@ -1,4 +1,4 @@ -error: associated constant is never used: `BAR` +error: associated constant `BAR` is never used --> $DIR/associated-const-dead-code.rs:6:5 | LL | const BAR: u32 = 1; diff --git a/src/test/ui/associated-consts/issue-93835.stderr b/src/test/ui/associated-consts/issue-93835.stderr index 12df0e4381d..0406a16a397 100644 --- a/src/test/ui/associated-consts/issue-93835.stderr +++ b/src/test/ui/associated-consts/issue-93835.stderr @@ -19,11 +19,10 @@ help: you might have meant to write a `struct` literal | LL ~ fn e() { SomeStruct { LL | p:a<p:p<e=6>> -LL | -LL | -LL | -LL | ... +LL | +LL ~ }} + | help: maybe you meant to write a path separator here | LL | p::a<p:p<e=6>> diff --git a/src/test/ui/associated-type-bounds/type-alias.stderr b/src/test/ui/associated-type-bounds/type-alias.stderr index 6bde9d1a50d..c22b80b889e 100644 --- a/src/test/ui/associated-type-bounds/type-alias.stderr +++ b/src/test/ui/associated-type-bounds/type-alias.stderr @@ -9,7 +9,7 @@ help: the clause will not be checked when the type alias is used, and should be | LL - type _TaWhere1<T> where T: Iterator<Item: Copy> = T; LL + type _TaWhere1<T> = T; - | + | warning: where clauses are not enforced in type aliases --> $DIR/type-alias.rs:6:25 @@ -21,7 +21,7 @@ help: the clause will not be checked when the type alias is used, and should be | LL - type _TaWhere2<T> where T: Iterator<Item: 'static> = T; LL + type _TaWhere2<T> = T; - | + | warning: where clauses are not enforced in type aliases --> $DIR/type-alias.rs:7:25 @@ -33,7 +33,7 @@ help: the clause will not be checked when the type alias is used, and should be | LL - type _TaWhere3<T> where T: Iterator<Item: 'static> = T; LL + type _TaWhere3<T> = T; - | + | warning: where clauses are not enforced in type aliases --> $DIR/type-alias.rs:8:25 @@ -45,7 +45,7 @@ help: the clause will not be checked when the type alias is used, and should be | LL - type _TaWhere4<T> where T: Iterator<Item: 'static + Copy + Send> = T; LL + type _TaWhere4<T> = T; - | + | warning: where clauses are not enforced in type aliases --> $DIR/type-alias.rs:9:25 @@ -57,7 +57,7 @@ help: the clause will not be checked when the type alias is used, and should be | LL - type _TaWhere5<T> where T: Iterator<Item: for<'a> Into<&'a u8>> = T; LL + type _TaWhere5<T> = T; - | + | warning: where clauses are not enforced in type aliases --> $DIR/type-alias.rs:10:25 @@ -69,7 +69,7 @@ help: the clause will not be checked when the type alias is used, and should be | LL - type _TaWhere6<T> where T: Iterator<Item: Iterator<Item: Copy>> = T; LL + type _TaWhere6<T> = T; - | + | warning: bounds on generic parameters are not enforced in type aliases --> $DIR/type-alias.rs:12:20 @@ -81,7 +81,7 @@ help: the bound will not be checked when the type alias is used, and should be r | LL - type _TaInline1<T: Iterator<Item: Copy>> = T; LL + type _TaInline1<T> = T; - | + | warning: bounds on generic parameters are not enforced in type aliases --> $DIR/type-alias.rs:13:20 @@ -93,7 +93,7 @@ help: the bound will not be checked when the type alias is used, and should be r | LL - type _TaInline2<T: Iterator<Item: 'static>> = T; LL + type _TaInline2<T> = T; - | + | warning: bounds on generic parameters are not enforced in type aliases --> $DIR/type-alias.rs:14:20 @@ -105,7 +105,7 @@ help: the bound will not be checked when the type alias is used, and should be r | LL - type _TaInline3<T: Iterator<Item: 'static>> = T; LL + type _TaInline3<T> = T; - | + | warning: bounds on generic parameters are not enforced in type aliases --> $DIR/type-alias.rs:15:20 @@ -117,7 +117,7 @@ help: the bound will not be checked when the type alias is used, and should be r | LL - type _TaInline4<T: Iterator<Item: 'static + Copy + Send>> = T; LL + type _TaInline4<T> = T; - | + | warning: bounds on generic parameters are not enforced in type aliases --> $DIR/type-alias.rs:16:20 @@ -129,7 +129,7 @@ help: the bound will not be checked when the type alias is used, and should be r | LL - type _TaInline5<T: Iterator<Item: for<'a> Into<&'a u8>>> = T; LL + type _TaInline5<T> = T; - | + | warning: bounds on generic parameters are not enforced in type aliases --> $DIR/type-alias.rs:17:20 @@ -141,7 +141,7 @@ help: the bound will not be checked when the type alias is used, and should be r | LL - type _TaInline6<T: Iterator<Item: Iterator<Item: Copy>>> = T; LL + type _TaInline6<T> = T; - | + | warning: 12 warnings emitted diff --git a/src/test/ui/associated-types/defaults-specialization.stderr b/src/test/ui/associated-types/defaults-specialization.stderr index aa8841fbaae..2d61b2a647b 100644 --- a/src/test/ui/associated-types/defaults-specialization.stderr +++ b/src/test/ui/associated-types/defaults-specialization.stderr @@ -30,7 +30,7 @@ error[E0053]: method `make` has an incompatible type for trait | LL | default type Ty = bool; | ----------------------- expected this associated type -LL | +LL | LL | fn make() -> bool { true } | ^^^^ | | @@ -50,7 +50,7 @@ error[E0308]: mismatched types | LL | type Ty = u8; | ------------- associated type defaults can't be assumed inside the trait defining them -LL | +LL | LL | fn make() -> Self::Ty { | -------- expected `<Self as Tr>::Ty` because of return type LL | 0u8 @@ -77,7 +77,7 @@ error[E0308]: mismatched types | LL | default type Ty = bool; | ----------------------- expected this associated type -LL | +LL | LL | fn make() -> Self::Ty { true } | -------- ^^^^ expected associated type, found `bool` | | diff --git a/src/test/ui/associated-types/impl-trait-return-missing-constraint.stderr b/src/test/ui/associated-types/impl-trait-return-missing-constraint.stderr index bd8c8a4414c..fbd76a64c1e 100644 --- a/src/test/ui/associated-types/impl-trait-return-missing-constraint.stderr +++ b/src/test/ui/associated-types/impl-trait-return-missing-constraint.stderr @@ -6,6 +6,9 @@ LL | fn bar() -> impl Bar { ... LL | fn baz() -> impl Bar<Item = i32> { | ^^^^^^^^^^^^^^^^^^^^ expected associated type, found `i32` +LL | +LL | bar() + | ----- return type was inferred to be `impl Bar` here | = note: expected associated type `<impl Bar as Foo>::Item` found type `i32` diff --git a/src/test/ui/associated-types/issue-22560.stderr b/src/test/ui/associated-types/issue-22560.stderr index c5c70f226fd..71655d54baa 100644 --- a/src/test/ui/associated-types/issue-22560.stderr +++ b/src/test/ui/associated-types/issue-22560.stderr @@ -5,7 +5,7 @@ LL | / trait Sub<Rhs=Self> { LL | | type Output; LL | | } | |_- type parameter `Rhs` must be specified for this -LL | +LL | LL | type Test = dyn Add + Sub; | ^^^ help: set the type parameter to the desired type: `Sub<Rhs>` | diff --git a/src/test/ui/associated-types/issue-36499.stderr b/src/test/ui/associated-types/issue-36499.stderr index 610798d880f..80e42b61d20 100644 --- a/src/test/ui/associated-types/issue-36499.stderr +++ b/src/test/ui/associated-types/issue-36499.stderr @@ -8,7 +8,7 @@ help: try removing the `+` | LL - 2 + +2; LL + 2 + 2; - | + | error: aborting due to previous error diff --git a/src/test/ui/issues/issue-47139-2.rs b/src/test/ui/associated-types/issue-47139-2.rs index d2ef8942530..d2ef8942530 100644 --- a/src/test/ui/issues/issue-47139-2.rs +++ b/src/test/ui/associated-types/issue-47139-2.rs diff --git a/src/test/ui/async-await/issue-67765-async-diagnostic.stderr b/src/test/ui/async-await/issue-67765-async-diagnostic.stderr index 832b736ad86..492e06fbbc0 100644 --- a/src/test/ui/async-await/issue-67765-async-diagnostic.stderr +++ b/src/test/ui/async-await/issue-67765-async-diagnostic.stderr @@ -3,7 +3,7 @@ error[E0515]: cannot return value referencing local variable `s` | LL | let b = &s[..]; | - `s` is borrowed here -LL | +LL | LL | Err(b)?; | ^^^^^^^ returns a value referencing data owned by the current function diff --git a/src/test/ui/async-await/issue-68112.stderr b/src/test/ui/async-await/issue-68112.stderr index 28d94b14ac9..b8d3e1540d8 100644 --- a/src/test/ui/async-await/issue-68112.stderr +++ b/src/test/ui/async-await/issue-68112.stderr @@ -42,15 +42,27 @@ LL | require_send(send_fut); | = help: the trait `Sync` is not implemented for `RefCell<i32>` = note: required because of the requirements on the impl of `Send` for `Arc<RefCell<i32>>` - = note: required because it appears within the type `[static generator@$DIR/issue-68112.rs:47:31: 47:36]` - = note: required because it appears within the type `std::future::from_generator::GenFuture<[static generator@$DIR/issue-68112.rs:47:31: 47:36]>` - = note: required because it appears within the type `impl Future<Output = Arc<RefCell<i32>>>` - = note: required because it appears within the type `impl Future<Output = Arc<RefCell<i32>>>` - = note: required because it appears within the type `impl Future<Output = Arc<RefCell<i32>>>` - = note: required because it appears within the type `{ResumeTy, impl Future<Output = Arc<RefCell<i32>>>, (), i32, Ready<i32>}` - = note: required because it appears within the type `[static generator@$DIR/issue-68112.rs:55:26: 59:6]` - = note: required because it appears within the type `std::future::from_generator::GenFuture<[static generator@$DIR/issue-68112.rs:55:26: 59:6]>` - = note: required because it appears within the type `impl Future<Output = ()>` +note: required because it's used within this async block + --> $DIR/issue-68112.rs:47:31 + | +LL | async fn ready2<T>(t: T) -> T { t } + | ^^^^^ +note: required because it appears within the type `impl Future<Output = Arc<RefCell<i32>>>` + --> $DIR/issue-68112.rs:48:31 + | +LL | fn make_non_send_future2() -> impl Future<Output = Arc<RefCell<i32>>> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: required because it captures the following types: `ResumeTy`, `impl Future<Output = Arc<RefCell<i32>>>`, `()`, `i32`, `Ready<i32>` +note: required because it's used within this async block + --> $DIR/issue-68112.rs:55:26 + | +LL | let send_fut = async { + | __________________________^ +LL | | let non_send_fut = make_non_send_future2(); +LL | | let _ = non_send_fut.await; +LL | | ready(0).await; +LL | | }; + | |_____^ note: required by a bound in `require_send` --> $DIR/issue-68112.rs:11:25 | diff --git a/src/test/ui/async-await/issue-70594.stderr b/src/test/ui/async-await/issue-70594.stderr index a159edd5118..a88bce6cc99 100644 --- a/src/test/ui/async-await/issue-70594.stderr +++ b/src/test/ui/async-await/issue-70594.stderr @@ -31,7 +31,7 @@ help: remove the `.await` | LL - [1; ().await]; LL + [1; ()]; - | + | error: aborting due to 4 previous errors diff --git a/src/test/ui/async-await/issue-70935-complex-spans.drop_tracking.stderr b/src/test/ui/async-await/issue-70935-complex-spans.drop_tracking.stderr new file mode 100644 index 00000000000..19fd5eb7c73 --- /dev/null +++ b/src/test/ui/async-await/issue-70935-complex-spans.drop_tracking.stderr @@ -0,0 +1,40 @@ +error[E0277]: `Sender<i32>` cannot be shared between threads safely + --> $DIR/issue-70935-complex-spans.rs:13:45 + | +LL | fn foo(tx: std::sync::mpsc::Sender<i32>) -> impl Future + Send { + | ^^^^^^^^^^^^^^^^^^ `Sender<i32>` cannot be shared between threads safely + | + = help: the trait `Sync` is not implemented for `Sender<i32>` + = note: required because of the requirements on the impl of `Send` for `&Sender<i32>` +note: required because it's used within this closure + --> $DIR/issue-70935-complex-spans.rs:25:13 + | +LL | baz(|| async{ + | _____________^ +LL | | foo(tx.clone()); +LL | | }).await; + | |_________^ +note: required because it's used within this async block + --> $DIR/issue-70935-complex-spans.rs:9:67 + | +LL | async fn baz<T>(_c: impl FnMut() -> T) where T: Future<Output=()> { + | ___________________________________________________________________^ +LL | | +LL | | } + | |_^ + = note: required because it captures the following types: `ResumeTy`, `impl Future<Output = ()>`, `()` +note: required because it's used within this async block + --> $DIR/issue-70935-complex-spans.rs:23:16 + | +LL | async move { + | ________________^ +LL | | +LL | | baz(|| async{ +LL | | foo(tx.clone()); +LL | | }).await; +LL | | } + | |_____^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/async-await/issue-70935-complex-spans.stderr b/src/test/ui/async-await/issue-70935-complex-spans.normal.stderr index db309938119..2174f260a71 100644 --- a/src/test/ui/async-await/issue-70935-complex-spans.stderr +++ b/src/test/ui/async-await/issue-70935-complex-spans.normal.stderr @@ -1,12 +1,12 @@ error: future cannot be sent between threads safely - --> $DIR/issue-70935-complex-spans.rs:10:45 + --> $DIR/issue-70935-complex-spans.rs:13:45 | LL | fn foo(tx: std::sync::mpsc::Sender<i32>) -> impl Future + Send { | ^^^^^^^^^^^^^^^^^^ future created by async block is not `Send` | = help: the trait `Sync` is not implemented for `Sender<i32>` note: future is not `Send` as this value is used across an await - --> $DIR/issue-70935-complex-spans.rs:15:11 + --> $DIR/issue-70935-complex-spans.rs:27:11 | LL | baz(|| async{ | _____________- @@ -14,9 +14,9 @@ LL | | foo(tx.clone()); LL | | }).await; | | - ^^^^^^ await occurs here, with the value maybe used later | |_________| - | has type `[closure@$DIR/issue-70935-complex-spans.rs:13:13: 15:10]` which is not `Send` + | has type `[closure@$DIR/issue-70935-complex-spans.rs:25:13: 27:10]` which is not `Send` note: the value is later dropped here - --> $DIR/issue-70935-complex-spans.rs:15:17 + --> $DIR/issue-70935-complex-spans.rs:27:17 | LL | }).await; | ^ diff --git a/src/test/ui/async-await/issue-70935-complex-spans.rs b/src/test/ui/async-await/issue-70935-complex-spans.rs index 2965a7e0654..4bf94fe342c 100644 --- a/src/test/ui/async-await/issue-70935-complex-spans.rs +++ b/src/test/ui/async-await/issue-70935-complex-spans.rs @@ -1,16 +1,28 @@ // edition:2018 +// revisions: normal drop_tracking +// [drop_tracking]compile-flags:-Zdrop-tracking // #70935: Check if we do not emit snippet // with newlines which lead complex diagnostics. use std::future::Future; async fn baz<T>(_c: impl FnMut() -> T) where T: Future<Output=()> { +//[drop_tracking]~^ within this async block } fn foo(tx: std::sync::mpsc::Sender<i32>) -> impl Future + Send { - //~^ ERROR: future cannot be sent between threads safely + //[normal]~^ ERROR: future cannot be sent between threads safely + //[drop_tracking]~^^ ERROR: `Sender<i32>` cannot be shared + //[drop_tracking]~| NOTE: cannot be shared + //[drop_tracking]~| NOTE: requirements on the impl of `Send` + //[drop_tracking]~| NOTE: captures the following types + //[drop_tracking]~| NOTE: in this expansion + //[drop_tracking]~| NOTE: in this expansion + //[drop_tracking]~| NOTE: in this expansion + //[drop_tracking]~| NOTE: in this expansion async move { - baz(|| async{ + //[drop_tracking]~^ within this async block + baz(|| async{ //[drop_tracking]~ NOTE: used within this closure foo(tx.clone()); }).await; } diff --git a/src/test/ui/async-await/issues/issue-54752-async-block.stderr b/src/test/ui/async-await/issues/issue-54752-async-block.stderr index e3ed0b53356..8cc849dd985 100644 --- a/src/test/ui/async-await/issues/issue-54752-async-block.stderr +++ b/src/test/ui/async-await/issues/issue-54752-async-block.stderr @@ -9,7 +9,7 @@ help: remove these parentheses | LL - fn main() { let _a = (async { }); } LL + fn main() { let _a = async { }; } - | + | warning: 1 warning emitted diff --git a/src/test/ui/async-await/issues/issue-62009-1.stderr b/src/test/ui/async-await/issues/issue-62009-1.stderr index 3d80c34942c..ccdd9c57a0f 100644 --- a/src/test/ui/async-await/issues/issue-62009-1.stderr +++ b/src/test/ui/async-await/issues/issue-62009-1.stderr @@ -37,7 +37,7 @@ help: remove the `.await` | LL - (|_| 2333).await; LL + (|_| 2333); - | + | error: aborting due to 4 previous errors diff --git a/src/test/ui/async-await/partial-drop-partial-reinit.rs b/src/test/ui/async-await/partial-drop-partial-reinit.rs index 73f0ca8153c..4fcfacea3f8 100644 --- a/src/test/ui/async-await/partial-drop-partial-reinit.rs +++ b/src/test/ui/async-await/partial-drop-partial-reinit.rs @@ -5,9 +5,15 @@ fn main() { gimme_send(foo()); //~^ ERROR cannot be sent between threads safely + //~| NOTE cannot be sent + //~| NOTE bound introduced by + //~| NOTE appears within the type + //~| NOTE captures the following types } fn gimme_send<T: Send>(t: T) { +//~^ NOTE required by this bound +//~| NOTE required by a bound drop(t); } @@ -20,6 +26,8 @@ impl Drop for NotSend { impl !Send for NotSend {} async fn foo() { +//~^ NOTE used within this async block +//~| NOTE within this `impl Future let mut x = (NotSend {},); drop(x.0); x.0 = NotSend {}; diff --git a/src/test/ui/async-await/partial-drop-partial-reinit.stderr b/src/test/ui/async-await/partial-drop-partial-reinit.stderr index a1c4957e984..96d0c71f103 100644 --- a/src/test/ui/async-await/partial-drop-partial-reinit.stderr +++ b/src/test/ui/async-await/partial-drop-partial-reinit.stderr @@ -11,13 +11,21 @@ LL | async fn foo() { | = help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `NotSend` = note: required because it appears within the type `(NotSend,)` - = note: required because it appears within the type `{ResumeTy, (NotSend,), impl Future<Output = ()>, ()}` - = note: required because it appears within the type `[static generator@$DIR/partial-drop-partial-reinit.rs:22:16: 27:2]` - = note: required because it appears within the type `std::future::from_generator::GenFuture<[static generator@$DIR/partial-drop-partial-reinit.rs:22:16: 27:2]>` - = note: required because it appears within the type `impl Future<Output = ()>` - = note: required because it appears within the type `impl Future<Output = ()>` + = note: required because it captures the following types: `ResumeTy`, `(NotSend,)`, `impl Future<Output = ()>`, `()` +note: required because it's used within this async block + --> $DIR/partial-drop-partial-reinit.rs:28:16 + | +LL | async fn foo() { + | ________________^ +LL | | +LL | | +LL | | let mut x = (NotSend {},); +... | +LL | | bar().await; +LL | | } + | |_^ note: required by a bound in `gimme_send` - --> $DIR/partial-drop-partial-reinit.rs:10:18 + --> $DIR/partial-drop-partial-reinit.rs:14:18 | LL | fn gimme_send<T: Send>(t: T) { | ^^^^ required by this bound in `gimme_send` diff --git a/src/test/ui/async-await/unnecessary-await.stderr b/src/test/ui/async-await/unnecessary-await.stderr index c3d2a6e7b1e..e7e61c2baaf 100644 --- a/src/test/ui/async-await/unnecessary-await.stderr +++ b/src/test/ui/async-await/unnecessary-await.stderr @@ -13,7 +13,7 @@ help: remove the `.await` | LL - boo().await; LL + boo(); - | + | help: alternatively, consider making `fn boo` asynchronous | LL | async fn boo() {} diff --git a/src/test/ui/blind/blind-item-item-shadow.stderr b/src/test/ui/blind/blind-item-item-shadow.stderr index 12b583ea3e9..7f9e8008929 100644 --- a/src/test/ui/blind/blind-item-item-shadow.stderr +++ b/src/test/ui/blind/blind-item-item-shadow.stderr @@ -3,7 +3,7 @@ error[E0255]: the name `foo` is defined multiple times | LL | mod foo { pub mod foo { } } | ------- previous definition of the module `foo` here -LL | +LL | LL | use foo::foo; | ^^^^^^^^ `foo` reimported here | diff --git a/src/test/ui/block-result/issue-5500.stderr b/src/test/ui/block-result/issue-5500.stderr index 7081b5106ff..211a6052864 100644 --- a/src/test/ui/block-result/issue-5500.stderr +++ b/src/test/ui/block-result/issue-5500.stderr @@ -12,7 +12,7 @@ help: consider removing the borrow | LL - &panic!() LL + panic!() - | + | error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrow-raw-address-of-borrowed.stderr b/src/test/ui/borrowck/borrow-raw-address-of-borrowed.stderr index ff461b748be..6f7b7e08070 100644 --- a/src/test/ui/borrowck/borrow-raw-address-of-borrowed.stderr +++ b/src/test/ui/borrowck/borrow-raw-address-of-borrowed.stderr @@ -3,10 +3,10 @@ error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immuta | LL | let y = &x; | -- immutable borrow occurs here -LL | +LL | LL | let q = &raw mut x; | ^^^^^^^^^^ mutable borrow occurs here -LL | +LL | LL | drop(y); | - immutable borrow later used here @@ -15,7 +15,7 @@ error[E0502]: cannot borrow `x` as immutable because it is also borrowed as muta | LL | let y = &mut x; | ------ mutable borrow occurs here -LL | +LL | LL | let p = &raw const x; | ^^^^^^^^^^^^ immutable borrow occurs here ... @@ -30,7 +30,7 @@ LL | let y = &mut x; ... LL | let q = &raw mut x; | ^^^^^^^^^^ second mutable borrow occurs here -LL | +LL | LL | drop(y); | - first borrow later used here diff --git a/src/test/ui/borrowck/borrow-raw-address-of-deref-mutability.stderr b/src/test/ui/borrowck/borrow-raw-address-of-deref-mutability.stderr index 31af38507c7..5963dab9f4a 100644 --- a/src/test/ui/borrowck/borrow-raw-address-of-deref-mutability.stderr +++ b/src/test/ui/borrowck/borrow-raw-address-of-deref-mutability.stderr @@ -3,7 +3,7 @@ error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference | LL | let x = &0; | -- help: consider changing this to be a mutable reference: `&mut 0` -LL | +LL | LL | let q = &raw mut *x; | ^^^^^^^^^^^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable @@ -12,7 +12,7 @@ error[E0596]: cannot borrow `*x` as mutable, as it is behind a `*const` pointer | LL | let x = &0 as *const i32; | -- help: consider changing this to be a mutable pointer: `&mut 0` -LL | +LL | LL | let q = &raw mut *x; | ^^^^^^^^^^^ `x` is a `*const` pointer, so the data it refers to cannot be borrowed as mutable diff --git a/src/test/ui/borrowck/borrow-tuple-fields.stderr b/src/test/ui/borrowck/borrow-tuple-fields.stderr index ad628abcbfc..befa751a600 100644 --- a/src/test/ui/borrowck/borrow-tuple-fields.stderr +++ b/src/test/ui/borrowck/borrow-tuple-fields.stderr @@ -5,7 +5,7 @@ LL | let r = &x.0; | ---- borrow of `x.0` occurs here LL | let y = x; | ^ move out of `x` occurs here -LL | +LL | LL | r.use_ref(); | ----------- borrow later used here diff --git a/src/test/ui/borrowck/borrowck-assign-comp-idx.stderr b/src/test/ui/borrowck/borrowck-assign-comp-idx.stderr index 93f1d8c5258..b80174ae687 100644 --- a/src/test/ui/borrowck/borrowck-assign-comp-idx.stderr +++ b/src/test/ui/borrowck/borrowck-assign-comp-idx.stderr @@ -3,10 +3,10 @@ error[E0502]: cannot borrow `p` as mutable because it is also borrowed as immuta | LL | let q: &isize = &p[0]; | - immutable borrow occurs here -LL | +LL | LL | p[0] = 5; | ^ mutable borrow occurs here -LL | +LL | LL | println!("{}", *q); | -- immutable borrow later used here diff --git a/src/test/ui/borrowck/borrowck-loan-rcvr-overloaded-op.stderr b/src/test/ui/borrowck/borrowck-loan-rcvr-overloaded-op.stderr index 1d8d04c9181..24cc4933ef1 100644 --- a/src/test/ui/borrowck/borrowck-loan-rcvr-overloaded-op.stderr +++ b/src/test/ui/borrowck/borrowck-loan-rcvr-overloaded-op.stderr @@ -3,7 +3,7 @@ error[E0503]: cannot use `p` because it was mutably borrowed | LL | let q = &mut p; | ------ borrow of `p` occurs here -LL | +LL | LL | p + 3; | ^ use of borrowed `p` ... @@ -18,7 +18,7 @@ LL | let q = &mut p; ... LL | p.times(3); | ^^^^^^^^^^ immutable borrow occurs here -LL | +LL | LL | *q + 3; // OK to use the new alias `q` | -- mutable borrow later used here diff --git a/src/test/ui/borrowck/borrowck-loan-rcvr.stderr b/src/test/ui/borrowck/borrowck-loan-rcvr.stderr index 74cad575d27..1d6bd4e2ec8 100644 --- a/src/test/ui/borrowck/borrowck-loan-rcvr.stderr +++ b/src/test/ui/borrowck/borrowck-loan-rcvr.stderr @@ -18,7 +18,7 @@ LL | let l = &mut p; | ------ mutable borrow occurs here LL | p.impurem(); | ^^^^^^^^^^^ immutable borrow occurs here -LL | +LL | LL | l.x += 1; | -------- mutable borrow later used here diff --git a/src/test/ui/borrowck/borrowck-move-from-subpath-of-borrowed-path.stderr b/src/test/ui/borrowck/borrowck-move-from-subpath-of-borrowed-path.stderr index b305e3c0a16..f833abcc02a 100644 --- a/src/test/ui/borrowck/borrowck-move-from-subpath-of-borrowed-path.stderr +++ b/src/test/ui/borrowck/borrowck-move-from-subpath-of-borrowed-path.stderr @@ -3,7 +3,7 @@ error[E0505]: cannot move out of `*a` because it is borrowed | LL | let b = &a; | -- borrow of `a` occurs here -LL | +LL | LL | let z = *a; | ^^ move out of `*a` occurs here LL | b.use_ref(); diff --git a/src/test/ui/borrowck/borrowck-move-moved-value-into-closure.stderr b/src/test/ui/borrowck/borrowck-move-moved-value-into-closure.stderr index edd597fe30b..9509ebb7cde 100644 --- a/src/test/ui/borrowck/borrowck-move-moved-value-into-closure.stderr +++ b/src/test/ui/borrowck/borrowck-move-moved-value-into-closure.stderr @@ -3,7 +3,7 @@ error[E0382]: use of moved value: `t` | LL | let t: Box<_> = Box::new(3); | - move occurs because `t` has type `Box<isize>`, which does not implement the `Copy` trait -LL | +LL | LL | call_f(move|| { *t + 1 }); | ------ -- variable moved due to use in closure | | diff --git a/src/test/ui/borrowck/borrowck-overloaded-index-move-index.stderr b/src/test/ui/borrowck/borrowck-overloaded-index-move-index.stderr index bacad399ebe..e01c26adcfc 100644 --- a/src/test/ui/borrowck/borrowck-overloaded-index-move-index.stderr +++ b/src/test/ui/borrowck/borrowck-overloaded-index-move-index.stderr @@ -3,7 +3,7 @@ error[E0505]: cannot move out of `s` because it is borrowed | LL | let rs = &mut s; | ------ borrow of `s` occurs here -LL | +LL | LL | println!("{}", f[s]); | ^ move out of `s` occurs here ... diff --git a/src/test/ui/borrowck/borrowck-slice-pattern-element-loan-array.stderr b/src/test/ui/borrowck/borrowck-slice-pattern-element-loan-array.stderr index 0432aaf51d2..b8ac7a3a446 100644 --- a/src/test/ui/borrowck/borrowck-slice-pattern-element-loan-array.stderr +++ b/src/test/ui/borrowck/borrowck-slice-pattern-element-loan-array.stderr @@ -23,7 +23,7 @@ error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as im | LL | let [.., _, ref from_end4, ref from_end3, _, ref from_end1] = *s; | ------------- immutable borrow occurs here -LL | +LL | LL | let [_, _, ref mut from_begin2, ..] = *s; | ^^^^^^^^^^^^^^^^^^^ mutable borrow occurs here LL | nop(&[from_begin2, from_end1, from_end3, from_end4]); @@ -45,7 +45,7 @@ error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as im | LL | let [ref from_begin0, ref from_begin1, _, ref from_begin3, _, ..] = *s; | --------------- immutable borrow occurs here -LL | +LL | LL | let [.., ref mut from_end3, _, _] = *s; | ^^^^^^^^^^^^^^^^^ mutable borrow occurs here LL | nop(&[from_begin0, from_begin1, from_begin3, from_end3]); diff --git a/src/test/ui/borrowck/borrowck-union-borrow.stderr b/src/test/ui/borrowck/borrowck-union-borrow.stderr index 395cd0b4855..090c7b6b51a 100644 --- a/src/test/ui/borrowck/borrowck-union-borrow.stderr +++ b/src/test/ui/borrowck/borrowck-union-borrow.stderr @@ -99,7 +99,7 @@ LL | let ra = &mut u.a; | -------- borrow of `u.a` occurs here LL | let b = u.b; | ^^^ use of borrowed `u.a` -LL | +LL | LL | drop(ra); | -- borrow later used here diff --git a/src/test/ui/borrowck/copy-suggestion-region-vid.stderr b/src/test/ui/borrowck/copy-suggestion-region-vid.stderr index f03cdd84d75..1685acf8718 100644 --- a/src/test/ui/borrowck/copy-suggestion-region-vid.stderr +++ b/src/test/ui/borrowck/copy-suggestion-region-vid.stderr @@ -3,7 +3,7 @@ error[E0382]: borrow of moved value: `helpers` | LL | let helpers = [vec![], vec![]]; | ------- move occurs because `helpers` has type `[Vec<&i64>; 2]`, which does not implement the `Copy` trait -LL | +LL | LL | HelperStruct { helpers, is_empty: helpers[0].is_empty() } | ------- ^^^^^^^^^^^^^^^^^^^^^ value borrowed here after move | | diff --git a/src/test/ui/borrowck/issue-58776-borrowck-scans-children.stderr b/src/test/ui/borrowck/issue-58776-borrowck-scans-children.stderr index 9b1d6fa7d35..57803247ba8 100644 --- a/src/test/ui/borrowck/issue-58776-borrowck-scans-children.stderr +++ b/src/test/ui/borrowck/issue-58776-borrowck-scans-children.stderr @@ -5,7 +5,7 @@ LL | let res = (|| (|| &greeting)())(); | -- -------- borrow occurs due to use in closure | | | borrow of `greeting` occurs here -LL | +LL | LL | greeting = "DEALLOCATED".to_string(); | ^^^^^^^^ assignment to borrowed `greeting` occurs here ... diff --git a/src/test/ui/borrowck/mut-borrow-of-mut-ref.stderr b/src/test/ui/borrowck/mut-borrow-of-mut-ref.stderr index 2ffe7ff6413..7782047574c 100644 --- a/src/test/ui/borrowck/mut-borrow-of-mut-ref.stderr +++ b/src/test/ui/borrowck/mut-borrow-of-mut-ref.stderr @@ -13,7 +13,7 @@ help: try removing `&mut` here | LL - h(&mut b); LL + h(b); - | + | error[E0596]: cannot borrow `b` as mutable, as it is not declared as mutable --> $DIR/mut-borrow-of-mut-ref.rs:11:12 @@ -30,7 +30,7 @@ help: try removing `&mut` here | LL - g(&mut &mut b); LL + g(&mut b); - | + | error[E0596]: cannot borrow `b` as mutable, as it is not declared as mutable --> $DIR/mut-borrow-of-mut-ref.rs:18:12 @@ -47,7 +47,7 @@ help: try removing `&mut` here | LL - h(&mut &mut b); LL + h(&mut b); - | + | error[E0596]: cannot borrow `f` as mutable, as it is not declared as mutable --> $DIR/mut-borrow-of-mut-ref.rs:35:5 diff --git a/src/test/ui/borrowck/two-phase-allow-access-during-reservation.nll_target.stderr b/src/test/ui/borrowck/two-phase-allow-access-during-reservation.nll_target.stderr index a6c65421d91..a57ceb84739 100644 --- a/src/test/ui/borrowck/two-phase-allow-access-during-reservation.nll_target.stderr +++ b/src/test/ui/borrowck/two-phase-allow-access-during-reservation.nll_target.stderr @@ -3,7 +3,7 @@ error[E0503]: cannot use `i` because it was mutably borrowed | LL | /*1*/ let p = &mut i; // (reservation of `i` starts here) | ------ borrow of `i` occurs here -LL | +LL | LL | /*2*/ let j = i; // OK: `i` is only reserved here | ^ use of borrowed `i` ... diff --git a/src/test/ui/borrowck/two-phase-reservation-sharing-interference-2.stderr b/src/test/ui/borrowck/two-phase-reservation-sharing-interference-2.stderr index e4dc4dc5999..9e0f68b6543 100644 --- a/src/test/ui/borrowck/two-phase-reservation-sharing-interference-2.stderr +++ b/src/test/ui/borrowck/two-phase-reservation-sharing-interference-2.stderr @@ -3,7 +3,7 @@ error[E0502]: cannot borrow `v` as mutable because it is also borrowed as immuta | LL | let shared = &v; | -- immutable borrow occurs here -LL | +LL | LL | v.extend(shared); | ^^------^^^^^^^^ | | | diff --git a/src/test/ui/borrowck/two-phase-sneaky.stderr b/src/test/ui/borrowck/two-phase-sneaky.stderr index 0dbed98b841..117d7ceaeef 100644 --- a/src/test/ui/borrowck/two-phase-sneaky.stderr +++ b/src/test/ui/borrowck/two-phase-sneaky.stderr @@ -5,7 +5,7 @@ LL | v[0].push_str({ | - -------- first borrow later used by call | | | first mutable borrow occurs here -LL | +LL | LL | v.push(format!("foo")); | ^^^^^^^^^^^^^^^^^^^^^^ second mutable borrow occurs here diff --git a/src/test/ui/c-variadic/variadic-ffi-1.stderr b/src/test/ui/c-variadic/variadic-ffi-1.stderr index 9acf1e93b07..176bec819d6 100644 --- a/src/test/ui/c-variadic/variadic-ffi-1.stderr +++ b/src/test/ui/c-variadic/variadic-ffi-1.stderr @@ -17,8 +17,8 @@ LL | fn foo(f: isize, x: u8, ...); | ^^^ help: provide the arguments | -LL | foo({isize}, {u8}); - | ~~~~~~~~~~~~~~~~~~ +LL | foo(/* isize */, /* u8 */); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~ error[E0060]: this function takes at least 2 arguments but 1 argument was supplied --> $DIR/variadic-ffi-1.rs:21:9 @@ -33,8 +33,8 @@ LL | fn foo(f: isize, x: u8, ...); | ^^^ help: provide the argument | -LL | foo(1, {u8}); - | ~~~~~~~~~~~~ +LL | foo(1, /* u8 */); + | ~~~~~~~~~~~~~~~~ error[E0308]: mismatched types --> $DIR/variadic-ffi-1.rs:23:56 diff --git a/src/test/ui/issues/issue-10991.rs b/src/test/ui/cast/issue-10991.rs index c36829fdf5b..c36829fdf5b 100644 --- a/src/test/ui/issues/issue-10991.rs +++ b/src/test/ui/cast/issue-10991.rs diff --git a/src/test/ui/issues/issue-10991.stderr b/src/test/ui/cast/issue-10991.stderr index 5b8a1823386..5b8a1823386 100644 --- a/src/test/ui/issues/issue-10991.stderr +++ b/src/test/ui/cast/issue-10991.stderr diff --git a/src/test/ui/cast/issue-89497.stderr b/src/test/ui/cast/issue-89497.stderr index 3726f8a4101..bf3c3537fad 100644 --- a/src/test/ui/cast/issue-89497.stderr +++ b/src/test/ui/cast/issue-89497.stderr @@ -8,7 +8,7 @@ help: consider borrowing the value | LL - let _reference: &'static i32 = unsafe { pointer as *const i32 as &'static i32 }; LL + let _reference: &'static i32 = unsafe { &*(pointer as *const i32) }; - | + | error: aborting due to previous error diff --git a/src/test/ui/cenum_impl_drop_cast.stderr b/src/test/ui/cenum_impl_drop_cast.stderr index 8d847a0c80b..98c33105733 100644 --- a/src/test/ui/cenum_impl_drop_cast.stderr +++ b/src/test/ui/cenum_impl_drop_cast.stderr @@ -14,3 +14,18 @@ LL | #![deny(cenum_impl_drop_cast)] error: aborting due to previous error +Future incompatibility report: Future breakage diagnostic: +error: cannot cast enum `E` into integer `u32` because it implements `Drop` + --> $DIR/cenum_impl_drop_cast.rs:15:13 + | +LL | let i = e as u32; + | ^^^^^^^^ + | +note: the lint level is defined here + --> $DIR/cenum_impl_drop_cast.rs:1:9 + | +LL | #![deny(cenum_impl_drop_cast)] + | ^^^^^^^^^^^^^^^^^^^^ + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #73333 <https://github.com/rust-lang/rust/issues/73333> + diff --git a/src/test/ui/closures/2229_closure_analysis/diagnostics/mut_ref.stderr b/src/test/ui/closures/2229_closure_analysis/diagnostics/mut_ref.stderr index dbf8523a3ba..481d7e58529 100644 --- a/src/test/ui/closures/2229_closure_analysis/diagnostics/mut_ref.stderr +++ b/src/test/ui/closures/2229_closure_analysis/diagnostics/mut_ref.stderr @@ -3,7 +3,7 @@ error[E0596]: cannot borrow `**ref_mref_x` as mutable, as it is behind a `&` ref | LL | let ref_mref_x = &mref_x; | ------- help: consider changing this to be a mutable reference: `&mut mref_x` -LL | +LL | LL | let c = || { | ^^ `ref_mref_x` is a `&` reference, so the data it refers to cannot be borrowed as mutable LL | diff --git a/src/test/ui/closures/2229_closure_analysis/issue-87987.rs b/src/test/ui/closures/2229_closure_analysis/issue-87987.rs index d4f243ee347..d26343c33cf 100644 --- a/src/test/ui/closures/2229_closure_analysis/issue-87987.rs +++ b/src/test/ui/closures/2229_closure_analysis/issue-87987.rs @@ -2,16 +2,13 @@ // edition:2021 struct Props { - field_1: u32, //~ WARNING: field is never read: `field_1` - field_2: u32, //~ WARNING: field is never read: `field_2` + field_1: u32, //~ WARNING: fields `field_1` and `field_2` are never read + field_2: u32, } fn main() { // Test 1 - let props_2 = Props { - field_1: 1, - field_2: 1, - }; + let props_2 = Props { field_1: 1, field_2: 1 }; let _ = || { let _: Props = props_2; @@ -23,7 +20,7 @@ fn main() { let mref = &mut arr; let _c = || match arr { - [_, _, _, _] => println!("A") + [_, _, _, _] => println!("A"), }; println!("{:#?}", mref); diff --git a/src/test/ui/closures/2229_closure_analysis/issue-87987.stderr b/src/test/ui/closures/2229_closure_analysis/issue-87987.stderr index 5828295fae3..57b8f7ae609 100644 --- a/src/test/ui/closures/2229_closure_analysis/issue-87987.stderr +++ b/src/test/ui/closures/2229_closure_analysis/issue-87987.stderr @@ -1,16 +1,14 @@ -warning: field is never read: `field_1` +warning: fields `field_1` and `field_2` are never read --> $DIR/issue-87987.rs:5:5 | +LL | struct Props { + | ----- fields in this struct LL | field_1: u32, | ^^^^^^^^^^^^ - | - = note: `#[warn(dead_code)]` on by default - -warning: field is never read: `field_2` - --> $DIR/issue-87987.rs:6:5 - | LL | field_2: u32, | ^^^^^^^^^^^^ + | + = note: `#[warn(dead_code)]` on by default -warning: 2 warnings emitted +warning: 1 warning emitted diff --git a/src/test/ui/closures/2229_closure_analysis/match/issue-87097.rs b/src/test/ui/closures/2229_closure_analysis/match/issue-87097.rs index 241ddcb83e1..815fc0a719c 100644 --- a/src/test/ui/closures/2229_closure_analysis/match/issue-87097.rs +++ b/src/test/ui/closures/2229_closure_analysis/match/issue-87097.rs @@ -3,7 +3,7 @@ enum Variant { A, - B, //~ WARNING: variant is never constructed: `B` + B, //~ WARNING: variant `B` is never constructed } struct A { diff --git a/src/test/ui/closures/2229_closure_analysis/match/issue-87097.stderr b/src/test/ui/closures/2229_closure_analysis/match/issue-87097.stderr index 38f2929a05f..2a49ed4b5ff 100644 --- a/src/test/ui/closures/2229_closure_analysis/match/issue-87097.stderr +++ b/src/test/ui/closures/2229_closure_analysis/match/issue-87097.stderr @@ -1,6 +1,9 @@ -warning: variant is never constructed: `B` +warning: variant `B` is never constructed --> $DIR/issue-87097.rs:6:5 | +LL | enum Variant { + | ------- variant in this enum +LL | A, LL | B, | ^ | diff --git a/src/test/ui/closures/2229_closure_analysis/migrations/auto_traits.stderr b/src/test/ui/closures/2229_closure_analysis/migrations/auto_traits.stderr index a8367766ae1..a3c43690f1f 100644 --- a/src/test/ui/closures/2229_closure_analysis/migrations/auto_traits.stderr +++ b/src/test/ui/closures/2229_closure_analysis/migrations/auto_traits.stderr @@ -17,11 +17,10 @@ help: add a dummy let to cause `fptr` to be fully captured | LL ~ thread::spawn(move || { let _ = &fptr; unsafe { LL | -LL | -LL | -LL | -LL | *fptr.0 = 20; ... +LL | +LL ~ } }); + | error: changes to closure capture in Rust 2021 will affect which traits the closure implements --> $DIR/auto_traits.rs:42:19 @@ -40,11 +39,10 @@ help: add a dummy let to cause `fptr` to be fully captured | LL ~ thread::spawn(move || { let _ = &fptr; unsafe { LL | -LL | -LL | -LL | -LL | ... +LL | +LL ~ } }); + | error: changes to closure capture in Rust 2021 will affect drop order and which traits the closure implements --> $DIR/auto_traits.rs:67:13 diff --git a/src/test/ui/closures/2229_closure_analysis/migrations/multi_diagnostics.stderr b/src/test/ui/closures/2229_closure_analysis/migrations/multi_diagnostics.stderr index 483eae6bb4b..fa6082cbb59 100644 --- a/src/test/ui/closures/2229_closure_analysis/migrations/multi_diagnostics.stderr +++ b/src/test/ui/closures/2229_closure_analysis/migrations/multi_diagnostics.stderr @@ -109,11 +109,10 @@ help: add a dummy let to cause `fptr1`, `fptr2` to be fully captured | LL ~ thread::spawn(move || { let _ = (&fptr1, &fptr2); unsafe { LL | -LL | -LL | -LL | -LL | ... +LL | +LL ~ } }); + | error: aborting due to 5 previous errors diff --git a/src/test/ui/closures/closure-move-sync.stderr b/src/test/ui/closures/closure-move-sync.stderr index 618c9a17247..cbc4e2e5231 100644 --- a/src/test/ui/closures/closure-move-sync.stderr +++ b/src/test/ui/closures/closure-move-sync.stderr @@ -6,7 +6,15 @@ LL | let t = thread::spawn(|| { | = help: the trait `Sync` is not implemented for `std::sync::mpsc::Receiver<()>` = note: required because of the requirements on the impl of `Send` for `&std::sync::mpsc::Receiver<()>` - = note: required because it appears within the type `[closure@$DIR/closure-move-sync.rs:6:27: 9:6]` +note: required because it's used within this closure + --> $DIR/closure-move-sync.rs:6:27 + | +LL | let t = thread::spawn(|| { + | ___________________________^ +LL | | recv.recv().unwrap(); +LL | | +LL | | }); + | |_____^ note: required by a bound in `spawn` --> $SRC_DIR/std/src/thread/mod.rs:LL:COL | @@ -21,7 +29,11 @@ LL | thread::spawn(|| tx.send(()).unwrap()); | = help: the trait `Sync` is not implemented for `Sender<()>` = note: required because of the requirements on the impl of `Send` for `&Sender<()>` - = note: required because it appears within the type `[closure@$DIR/closure-move-sync.rs:18:19: 18:42]` +note: required because it's used within this closure + --> $DIR/closure-move-sync.rs:18:19 + | +LL | thread::spawn(|| tx.send(()).unwrap()); + | ^^^^^^^^^^^^^^^^^^^^^^^ note: required by a bound in `spawn` --> $SRC_DIR/std/src/thread/mod.rs:LL:COL | diff --git a/src/test/ui/closures/issue-6801.stderr b/src/test/ui/closures/issue-6801.stderr index 48c6acd1f49..6a40db0d51d 100644 --- a/src/test/ui/closures/issue-6801.stderr +++ b/src/test/ui/closures/issue-6801.stderr @@ -5,7 +5,7 @@ LL | let sq = || { *x * *x }; | -- -- borrow occurs due to use in closure | | | borrow of `x` occurs here -LL | +LL | LL | twice(x); | ^ move out of `x` occurs here LL | invoke(sq); diff --git a/src/test/ui/closures/issue-82438-mut-without-upvar.stderr b/src/test/ui/closures/issue-82438-mut-without-upvar.stderr index 06e2b5d0c1b..802284b2658 100644 --- a/src/test/ui/closures/issue-82438-mut-without-upvar.stderr +++ b/src/test/ui/closures/issue-82438-mut-without-upvar.stderr @@ -3,7 +3,7 @@ error[E0596]: cannot borrow `c` as mutable, as it is not declared as mutable | LL | let c = |a, b, c, d| {}; | - help: consider changing this to be mutable: `mut c` -LL | +LL | LL | A.f(participant_name, &mut c); | ^^^^^^ cannot borrow as mutable diff --git a/src/test/ui/issues/issue-28950.rs b/src/test/ui/codegen/issue-28950.rs index 8b55f42f3f4..8b55f42f3f4 100644 --- a/src/test/ui/issues/issue-28950.rs +++ b/src/test/ui/codegen/issue-28950.rs diff --git a/src/test/ui/issues/issue-63787.rs b/src/test/ui/codegen/issue-63787.rs index cba079b2315..cba079b2315 100644 --- a/src/test/ui/issues/issue-63787.rs +++ b/src/test/ui/codegen/issue-63787.rs diff --git a/src/test/ui/coherence/coherence-conflicting-negative-trait-impl.stderr b/src/test/ui/coherence/coherence-conflicting-negative-trait-impl.stderr index 5295170cd8b..1110197734f 100644 --- a/src/test/ui/coherence/coherence-conflicting-negative-trait-impl.stderr +++ b/src/test/ui/coherence/coherence-conflicting-negative-trait-impl.stderr @@ -3,7 +3,7 @@ error[E0751]: found both positive and negative implementation of trait `std::mar | LL | unsafe impl<T: MyTrait + 'static> Send for TestType<T> {} | ------------------------------------------------------ positive implementation here -LL | +LL | LL | impl<T: MyTrait> !Send for TestType<T> {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ negative implementation here diff --git a/src/test/ui/coherence/coherence-fn-implied-bounds.stderr b/src/test/ui/coherence/coherence-fn-implied-bounds.stderr index c8accc99747..8612ce60d18 100644 --- a/src/test/ui/coherence/coherence-fn-implied-bounds.stderr +++ b/src/test/ui/coherence/coherence-fn-implied-bounds.stderr @@ -3,7 +3,7 @@ error: conflicting implementations of trait `Trait` for type `for<'a, 'b> fn(&'a | LL | impl Trait for for<'a, 'b> fn(&'a &'b u32, &'b &'a u32) -> &'b u32 {} | ------------------------------------------------------------------ first implementation here -LL | +LL | LL | impl Trait for for<'c> fn(&'c &'c u32, &'c &'c u32) -> &'c u32 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `for<'a, 'b> fn(&'a &'b u32, &'b &'a u32) -> &'b u32` | diff --git a/src/test/ui/coherence/coherence-free-vs-bound-region.stderr b/src/test/ui/coherence/coherence-free-vs-bound-region.stderr index c249fa43c3b..af18655b06f 100644 --- a/src/test/ui/coherence/coherence-free-vs-bound-region.stderr +++ b/src/test/ui/coherence/coherence-free-vs-bound-region.stderr @@ -3,7 +3,7 @@ error: conflicting implementations of trait `TheTrait` for type `fn(&u8)` | LL | impl<'a> TheTrait for fn(&'a u8) {} | -------------------------------- first implementation here -LL | +LL | LL | impl TheTrait for fn(&u8) { | ^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `fn(&u8)` | diff --git a/src/test/ui/coherence/coherence-projection-conflict-orphan.stderr b/src/test/ui/coherence/coherence-projection-conflict-orphan.stderr index 9efb5dc75f4..8e7d4589e61 100644 --- a/src/test/ui/coherence/coherence-projection-conflict-orphan.stderr +++ b/src/test/ui/coherence/coherence-projection-conflict-orphan.stderr @@ -3,7 +3,7 @@ error[E0119]: conflicting implementations of trait `Foo<i32>` for type `i32` | LL | impl Foo<i32> for i32 { } | --------------------- first implementation here -LL | +LL | LL | impl<A:Iterator> Foo<A::Item> for A { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `i32` | diff --git a/src/test/ui/coherence/coherence-projection-conflict-ty-param.stderr b/src/test/ui/coherence/coherence-projection-conflict-ty-param.stderr index 85d3d358f83..6492747bb26 100644 --- a/src/test/ui/coherence/coherence-projection-conflict-ty-param.stderr +++ b/src/test/ui/coherence/coherence-projection-conflict-ty-param.stderr @@ -3,7 +3,7 @@ error[E0119]: conflicting implementations of trait `Foo<_>` for type `std::optio | LL | impl <P, T: Foo<P>> Foo<P> for Option<T> {} | ---------------------------------------- first implementation here -LL | +LL | LL | impl<T, U> Foo<T> for Option<U> { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `std::option::Option<_>` diff --git a/src/test/ui/coherence/coherence-projection-conflict.stderr b/src/test/ui/coherence/coherence-projection-conflict.stderr index e7d1fb29346..7d2c584c370 100644 --- a/src/test/ui/coherence/coherence-projection-conflict.stderr +++ b/src/test/ui/coherence/coherence-projection-conflict.stderr @@ -3,7 +3,7 @@ error[E0119]: conflicting implementations of trait `Foo<i32>` for type `i32` | LL | impl Foo<i32> for i32 { } | --------------------- first implementation here -LL | +LL | LL | impl<A:Bar> Foo<A::Output> for A { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `i32` diff --git a/src/test/ui/coherence/coherence-subtyping.stderr b/src/test/ui/coherence/coherence-subtyping.stderr index 6f95f0a06b5..25d8c875653 100644 --- a/src/test/ui/coherence/coherence-subtyping.stderr +++ b/src/test/ui/coherence/coherence-subtyping.stderr @@ -3,7 +3,7 @@ warning: conflicting implementations of trait `TheTrait` for type `for<'a, 'b> f | LL | impl TheTrait for for<'a, 'b> fn(&'a u8, &'b u8) -> &'a u8 {} | ---------------------------------------------------------- first implementation here -LL | +LL | LL | impl TheTrait for for<'a> fn(&'a u8, &'a u8) -> &'a u8 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `for<'a, 'b> fn(&'a u8, &'b u8) -> &'a u8` | 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 8c5c3b17b5c..2ceba59cf05 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 @@ -12,7 +12,7 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - pub struct AtLeastByte<T: ?Sized> { LL + pub struct AtLeastByte<T> { - | + | help: borrowed types always have a statically known size | LL | value: &T, 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 b123036bf25..f85e60f63fb 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 @@ -21,7 +21,7 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - pub struct AtLeastByte<T: ?Sized> { LL + pub struct AtLeastByte<T> { - | + | help: borrowed types always have a statically known size | LL | value: &T, diff --git a/src/test/ui/const-generics/defaults/rp_impl_trait_fail.stderr b/src/test/ui/const-generics/defaults/rp_impl_trait_fail.stderr index cbe4a4ac0d6..cbc7b93f3a9 100644 --- a/src/test/ui/const-generics/defaults/rp_impl_trait_fail.stderr +++ b/src/test/ui/const-generics/defaults/rp_impl_trait_fail.stderr @@ -3,6 +3,9 @@ error[E0277]: the trait bound `Uwu<10_u32, 12_u32>: Trait` is not satisfied | LL | fn rawr() -> impl Trait { | ^^^^^^^^^^ the trait `Trait` is not implemented for `Uwu<10_u32, 12_u32>` +LL | +LL | Uwu::<10, 12> + | ------------- return type was inferred to be `Uwu<10_u32, 12_u32>` here | = help: the trait `Trait` is implemented for `Uwu<N>` @@ -11,6 +14,9 @@ error[E0277]: the trait bound `u32: Traitor<N>` is not satisfied | LL | fn uwu<const N: u8>() -> impl Traitor<N> { | ^^^^^^^^^^^^^^^ the trait `Traitor<N>` is not implemented for `u32` +LL | +LL | 1_u32 + | ----- return type was inferred to be `u32` here | = help: the following other types implement trait `Traitor<N, M>`: <u32 as Traitor<N, 2_u8>> @@ -21,6 +27,9 @@ error[E0277]: the trait bound `u64: Traitor` is not satisfied | LL | fn owo() -> impl Traitor { | ^^^^^^^^^^^^ the trait `Traitor` is not implemented for `u64` +LL | +LL | 1_u64 + | ----- return type was inferred to be `u64` here | = help: the following other types implement trait `Traitor<N, M>`: <u32 as Traitor<N, 2_u8>> diff --git a/src/test/ui/const-generics/min_const_generics/static-reference-array-const-param.stderr b/src/test/ui/const-generics/issues/issue-73727-static-reference-array-const-param.min.stderr index f30693221a5..0a7db62472a 100644 --- a/src/test/ui/const-generics/min_const_generics/static-reference-array-const-param.stderr +++ b/src/test/ui/const-generics/issues/issue-73727-static-reference-array-const-param.min.stderr @@ -1,5 +1,5 @@ error: `&'static [u32]` is forbidden as the type of a const generic parameter - --> $DIR/static-reference-array-const-param.rs:1:15 + --> $DIR/issue-73727-static-reference-array-const-param.rs:9:15 | LL | fn a<const X: &'static [u32]>() {} | ^^^^^^^^^^^^^^ diff --git a/src/test/ui/const-generics/issues/issue-73727-static-reference-array-const-param.rs b/src/test/ui/const-generics/issues/issue-73727-static-reference-array-const-param.rs new file mode 100644 index 00000000000..f0d604835cb --- /dev/null +++ b/src/test/ui/const-generics/issues/issue-73727-static-reference-array-const-param.rs @@ -0,0 +1,14 @@ +// Regression test for #73727 + +// revisions: full min +//[full]check-pass + +#![cfg_attr(full, feature(adt_const_params))] +#![cfg_attr(full, allow(incomplete_features))] + +fn a<const X: &'static [u32]>() {} +//[min]~^ ERROR `&'static [u32]` is forbidden as the type of a const generic parameter + +fn main() { + a::<{&[]}>(); +} diff --git a/src/test/ui/const-generics/min_const_generics/static-reference-array-const-param.rs b/src/test/ui/const-generics/min_const_generics/static-reference-array-const-param.rs deleted file mode 100644 index 7518dc59e59..00000000000 --- a/src/test/ui/const-generics/min_const_generics/static-reference-array-const-param.rs +++ /dev/null @@ -1,6 +0,0 @@ -fn a<const X: &'static [u32]>() {} -//~^ ERROR `&'static [u32]` is forbidden as the type of a const generic parameter - -fn main() { - a::<{&[]}>(); -} diff --git a/src/test/ui/const-generics/parser-error-recovery/issue-89013-no-assoc.stderr b/src/test/ui/const-generics/parser-error-recovery/issue-89013-no-assoc.stderr index ddddd86ab9c..1de24bff469 100644 --- a/src/test/ui/const-generics/parser-error-recovery/issue-89013-no-assoc.stderr +++ b/src/test/ui/const-generics/parser-error-recovery/issue-89013-no-assoc.stderr @@ -8,7 +8,7 @@ help: the `const` keyword is only needed in the definition of the type | LL - impl Foo<const 3> for Bar { LL + impl Foo<3> for Bar { - | + | error: aborting due to previous error diff --git a/src/test/ui/const-generics/parser-error-recovery/issue-89013.stderr b/src/test/ui/const-generics/parser-error-recovery/issue-89013.stderr index d2d58c496df..583749a8573 100644 --- a/src/test/ui/const-generics/parser-error-recovery/issue-89013.stderr +++ b/src/test/ui/const-generics/parser-error-recovery/issue-89013.stderr @@ -8,7 +8,7 @@ help: the `const` keyword is only needed in the definition of the type | LL - impl Foo<N = const 3> for Bar { LL + impl Foo<N = 3> for Bar { - | + | error[E0658]: associated const equality is incomplete --> $DIR/issue-89013.rs:9:10 diff --git a/src/test/ui/const-generics/unused_braces.stderr b/src/test/ui/const-generics/unused_braces.stderr index 533fcabd418..553a3a0f88e 100644 --- a/src/test/ui/const-generics/unused_braces.stderr +++ b/src/test/ui/const-generics/unused_braces.stderr @@ -13,7 +13,7 @@ help: remove these braces | LL - let _: A<{ 7 }>; LL + let _: A<7>; - | + | warning: 1 warning emitted diff --git a/src/test/ui/consts/const-eval/format.rs b/src/test/ui/consts/const-eval/format.rs new file mode 100644 index 00000000000..e43633da3cc --- /dev/null +++ b/src/test/ui/consts/const-eval/format.rs @@ -0,0 +1,21 @@ +const fn failure() { + panic!("{:?}", 0); + //~^ ERROR cannot call non-const formatting macro in constant functions + //~| ERROR erroneous constant used + //~| ERROR erroneous constant used + //~| WARN this was previously accepted by the compiler + //~| WARN this was previously accepted by the compiler +} + +const fn print() { + println!("{:?}", 0); + //~^ ERROR cannot call non-const formatting macro in constant functions + //~| ERROR `Arguments::<'a>::new_v1` is not yet stable as a const fn + //~| ERROR cannot call non-const fn `_print` in constant functions + //~| ERROR erroneous constant used + //~| ERROR erroneous constant used + //~| WARN this was previously accepted by the compiler + //~| WARN this was previously accepted by the compiler +} + +fn main() {} diff --git a/src/test/ui/consts/const-eval/format.stderr b/src/test/ui/consts/const-eval/format.stderr new file mode 100644 index 00000000000..44f436ae4e3 --- /dev/null +++ b/src/test/ui/consts/const-eval/format.stderr @@ -0,0 +1,78 @@ +error[E0015]: cannot call non-const formatting macro in constant functions + --> $DIR/format.rs:2:20 + | +LL | panic!("{:?}", 0); + | ^ + | + = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants + = note: this error originates in the macro `$crate::const_format_args` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0015]: cannot call non-const formatting macro in constant functions + --> $DIR/format.rs:11:22 + | +LL | println!("{:?}", 0); + | ^ + | + = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants + = note: this error originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: `Arguments::<'a>::new_v1` is not yet stable as a const fn + --> $DIR/format.rs:11:5 + | +LL | println!("{:?}", 0); + | ^^^^^^^^^^^^^^^^^^^ + | + = help: add `#![feature(const_fmt_arguments_new)]` to the crate attributes to enable + = note: this error originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0015]: cannot call non-const fn `_print` in constant functions + --> $DIR/format.rs:11:5 + | +LL | println!("{:?}", 0); + | ^^^^^^^^^^^^^^^^^^^ + | + = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants + = note: this error originates in the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: erroneous constant used + --> $DIR/format.rs:2:12 + | +LL | panic!("{:?}", 0); + | ^^^^^^ referenced constant has errors + | + = note: `#[deny(const_err)]` on by default + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> + +error: erroneous constant used + --> $DIR/format.rs:2:20 + | +LL | panic!("{:?}", 0); + | ^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> + = note: this error originates in the macro `$crate::const_format_args` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: erroneous constant used + --> $DIR/format.rs:11:14 + | +LL | println!("{:?}", 0); + | ^^^^^^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> + +error: erroneous constant used + --> $DIR/format.rs:11:22 + | +LL | println!("{:?}", 0); + | ^ referenced constant has errors + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> + = note: this error originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: aborting due to 8 previous errors + +For more information about this error, try `rustc --explain E0015`. diff --git a/src/test/ui/consts/const-eval/validate_uninhabited_zsts.32bit.stderr b/src/test/ui/consts/const-eval/validate_uninhabited_zsts.32bit.stderr index 65ab1b02b35..acb9bda31d1 100644 --- a/src/test/ui/consts/const-eval/validate_uninhabited_zsts.32bit.stderr +++ b/src/test/ui/consts/const-eval/validate_uninhabited_zsts.32bit.stderr @@ -1,3 +1,15 @@ +warning: the type `!` does not permit zero-initialization + --> $DIR/validate_uninhabited_zsts.rs:4:14 + | +LL | unsafe { std::mem::transmute(()) } + | ^^^^^^^^^^^^^^^^^^^^^^^ + | | + | this code causes undefined behavior when executed + | help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done + | + = note: `#[warn(invalid_value)]` on by default + = note: the `!` type has no valid value + error[E0080]: evaluation of constant value failed --> $DIR/validate_uninhabited_zsts.rs:4:14 | @@ -19,18 +31,6 @@ LL | const BAR: [empty::Empty; 3] = [unsafe { std::mem::transmute(()) }; 3]; = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 0, align: 1) {} -warning: the type `!` does not permit zero-initialization - --> $DIR/validate_uninhabited_zsts.rs:4:14 - | -LL | unsafe { std::mem::transmute(()) } - | ^^^^^^^^^^^^^^^^^^^^^^^ - | | - | this code causes undefined behavior when executed - | help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done - | - = note: `#[warn(invalid_value)]` on by default - = note: the `!` type has no valid value - warning: the type `empty::Empty` does not permit zero-initialization --> $DIR/validate_uninhabited_zsts.rs:23:42 | diff --git a/src/test/ui/consts/const-eval/validate_uninhabited_zsts.64bit.stderr b/src/test/ui/consts/const-eval/validate_uninhabited_zsts.64bit.stderr index 65ab1b02b35..acb9bda31d1 100644 --- a/src/test/ui/consts/const-eval/validate_uninhabited_zsts.64bit.stderr +++ b/src/test/ui/consts/const-eval/validate_uninhabited_zsts.64bit.stderr @@ -1,3 +1,15 @@ +warning: the type `!` does not permit zero-initialization + --> $DIR/validate_uninhabited_zsts.rs:4:14 + | +LL | unsafe { std::mem::transmute(()) } + | ^^^^^^^^^^^^^^^^^^^^^^^ + | | + | this code causes undefined behavior when executed + | help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done + | + = note: `#[warn(invalid_value)]` on by default + = note: the `!` type has no valid value + error[E0080]: evaluation of constant value failed --> $DIR/validate_uninhabited_zsts.rs:4:14 | @@ -19,18 +31,6 @@ LL | const BAR: [empty::Empty; 3] = [unsafe { std::mem::transmute(()) }; 3]; = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 0, align: 1) {} -warning: the type `!` does not permit zero-initialization - --> $DIR/validate_uninhabited_zsts.rs:4:14 - | -LL | unsafe { std::mem::transmute(()) } - | ^^^^^^^^^^^^^^^^^^^^^^^ - | | - | this code causes undefined behavior when executed - | help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done - | - = note: `#[warn(invalid_value)]` on by default - = note: the `!` type has no valid value - warning: the type `empty::Empty` does not permit zero-initialization --> $DIR/validate_uninhabited_zsts.rs:23:42 | diff --git a/src/test/ui/consts/recursive-zst-static.default.stderr b/src/test/ui/consts/recursive-zst-static.default.stderr index 2a4ad5825ec..104899f4900 100644 --- a/src/test/ui/consts/recursive-zst-static.default.stderr +++ b/src/test/ui/consts/recursive-zst-static.default.stderr @@ -10,7 +10,15 @@ note: ...which requires const-evaluating + checking `FOO`... LL | static FOO: () = FOO; | ^^^ = note: ...which again requires const-evaluating + checking `FOO`, completing the cycle - = note: cycle used when running analysis passes on this crate +note: cycle used when linting top-level module + --> $DIR/recursive-zst-static.rs:10:1 + | +LL | / static FOO: () = FOO; +LL | | +LL | | fn main() { +LL | | FOO +LL | | } + | |_^ error: aborting due to previous error diff --git a/src/test/ui/consts/recursive-zst-static.unleash.stderr b/src/test/ui/consts/recursive-zst-static.unleash.stderr index 2a4ad5825ec..104899f4900 100644 --- a/src/test/ui/consts/recursive-zst-static.unleash.stderr +++ b/src/test/ui/consts/recursive-zst-static.unleash.stderr @@ -10,7 +10,15 @@ note: ...which requires const-evaluating + checking `FOO`... LL | static FOO: () = FOO; | ^^^ = note: ...which again requires const-evaluating + checking `FOO`, completing the cycle - = note: cycle used when running analysis passes on this crate +note: cycle used when linting top-level module + --> $DIR/recursive-zst-static.rs:10:1 + | +LL | / static FOO: () = FOO; +LL | | +LL | | fn main() { +LL | | FOO +LL | | } + | |_^ error: aborting due to previous error diff --git a/src/test/ui/consts/write-to-static-mut-in-static.stderr b/src/test/ui/consts/write-to-static-mut-in-static.stderr index ab4b8844e5b..8d5113cbfd9 100644 --- a/src/test/ui/consts/write-to-static-mut-in-static.stderr +++ b/src/test/ui/consts/write-to-static-mut-in-static.stderr @@ -16,7 +16,17 @@ note: ...which requires const-evaluating + checking `C`... LL | pub static mut C: u32 = unsafe { C = 1; 0 }; | ^^^^^ = note: ...which again requires const-evaluating + checking `C`, completing the cycle - = note: cycle used when running analysis passes on this crate +note: cycle used when linting top-level module + --> $DIR/write-to-static-mut-in-static.rs:1:1 + | +LL | / pub static mut A: u32 = 0; +LL | | pub static mut B: () = unsafe { A = 1; }; +LL | | +LL | | +... | +LL | | +LL | | fn main() {} + | |____________^ error: aborting due to 2 previous errors diff --git a/src/test/ui/deprecation/try-macro-suggestion.stderr b/src/test/ui/deprecation/try-macro-suggestion.stderr index c7dde7eeac3..63c8a6eef7f 100644 --- a/src/test/ui/deprecation/try-macro-suggestion.stderr +++ b/src/test/ui/deprecation/try-macro-suggestion.stderr @@ -21,7 +21,7 @@ help: you can use the `?` operator instead | LL - Ok(try!(Ok(()))) LL + Ok(Ok(())?) - | + | help: alternatively, you can still access the deprecated `try!()` macro using the "raw identifier" syntax | LL | Ok(r#try!(Ok(()))) diff --git a/src/test/ui/derive-uninhabited-enum-38885.rs b/src/test/ui/derive-uninhabited-enum-38885.rs index 35c3065ea81..0089453ef0f 100644 --- a/src/test/ui/derive-uninhabited-enum-38885.rs +++ b/src/test/ui/derive-uninhabited-enum-38885.rs @@ -10,7 +10,7 @@ enum Void {} #[derive(Debug)] enum Foo { Bar(u8), - Void(Void), //~ WARN never constructed + Void(Void), //~ WARN variant `Void` is never constructed } fn main() { diff --git a/src/test/ui/derive-uninhabited-enum-38885.stderr b/src/test/ui/derive-uninhabited-enum-38885.stderr index 58aaf978dc7..4feaf3ac961 100644 --- a/src/test/ui/derive-uninhabited-enum-38885.stderr +++ b/src/test/ui/derive-uninhabited-enum-38885.stderr @@ -1,6 +1,9 @@ -warning: variant is never constructed: `Void` +warning: variant `Void` is never constructed --> $DIR/derive-uninhabited-enum-38885.rs:13:5 | +LL | enum Foo { + | --- variant in this enum +LL | Bar(u8), LL | Void(Void), | ^^^^^^^^^^ | diff --git a/src/test/ui/derives/clone-debug-dead-code-in-the-same-struct.rs b/src/test/ui/derives/clone-debug-dead-code-in-the-same-struct.rs new file mode 100644 index 00000000000..15d06817577 --- /dev/null +++ b/src/test/ui/derives/clone-debug-dead-code-in-the-same-struct.rs @@ -0,0 +1,12 @@ +#![forbid(dead_code)] + +#[derive(Debug)] +pub struct Whatever { + pub field0: (), + field1: (), //~ ERROR fields `field1`, `field2`, `field3` and `field4` are never read + field2: (), + field3: (), + field4: (), +} + +fn main() {} diff --git a/src/test/ui/derives/clone-debug-dead-code-in-the-same-struct.stderr b/src/test/ui/derives/clone-debug-dead-code-in-the-same-struct.stderr new file mode 100644 index 00000000000..383e0b4b725 --- /dev/null +++ b/src/test/ui/derives/clone-debug-dead-code-in-the-same-struct.stderr @@ -0,0 +1,24 @@ +error: fields `field1`, `field2`, `field3` and `field4` are never read + --> $DIR/clone-debug-dead-code-in-the-same-struct.rs:6:5 + | +LL | pub struct Whatever { + | -------- fields in this struct +LL | pub field0: (), +LL | field1: (), + | ^^^^^^^^^^ +LL | field2: (), + | ^^^^^^^^^^ +LL | field3: (), + | ^^^^^^^^^^ +LL | field4: (), + | ^^^^^^^^^^ + | +note: the lint level is defined here + --> $DIR/clone-debug-dead-code-in-the-same-struct.rs:1:11 + | +LL | #![forbid(dead_code)] + | ^^^^^^^^^ + = note: `Whatever` has a derived impl for the trait `Debug`, but this is intentionally ignored during dead code analysis + +error: aborting due to previous error + diff --git a/src/test/ui/derives/clone-debug-dead-code.rs b/src/test/ui/derives/clone-debug-dead-code.rs index 80e91320939..ab49260c01b 100644 --- a/src/test/ui/derives/clone-debug-dead-code.rs +++ b/src/test/ui/derives/clone-debug-dead-code.rs @@ -4,22 +4,22 @@ #![forbid(dead_code)] struct A { f: () } -//~^ ERROR: field is never read: `f` +//~^ ERROR: field `f` is never read #[derive(Clone)] struct B { f: () } -//~^ ERROR: field is never read: `f` +//~^ ERROR: field `f` is never read #[derive(Debug)] struct C { f: () } -//~^ ERROR: field is never read: `f` +//~^ ERROR: field `f` is never read #[derive(Debug,Clone)] struct D { f: () } -//~^ ERROR: field is never read: `f` +//~^ ERROR: field `f` is never read struct E { f: () } -//~^ ERROR: field is never read: `f` +//~^ ERROR: field `f` is never read // Custom impl, still doesn't read f impl Clone for E { fn clone(&self) -> Self { diff --git a/src/test/ui/derives/clone-debug-dead-code.stderr b/src/test/ui/derives/clone-debug-dead-code.stderr index 031b8ce713e..73a00251188 100644 --- a/src/test/ui/derives/clone-debug-dead-code.stderr +++ b/src/test/ui/derives/clone-debug-dead-code.stderr @@ -1,8 +1,10 @@ -error: field is never read: `f` +error: field `f` is never read --> $DIR/clone-debug-dead-code.rs:6:12 | LL | struct A { f: () } - | ^^^^^ + | - ^^^^^ + | | + | field in this struct | note: the lint level is defined here --> $DIR/clone-debug-dead-code.rs:4:11 @@ -10,35 +12,43 @@ note: the lint level is defined here LL | #![forbid(dead_code)] | ^^^^^^^^^ -error: field is never read: `f` +error: field `f` is never read --> $DIR/clone-debug-dead-code.rs:10:12 | LL | struct B { f: () } - | ^^^^^ + | - ^^^^^ + | | + | field in this struct | = note: `B` has a derived impl for the trait `Clone`, but this is intentionally ignored during dead code analysis -error: field is never read: `f` +error: field `f` is never read --> $DIR/clone-debug-dead-code.rs:14:12 | LL | struct C { f: () } - | ^^^^^ + | - ^^^^^ + | | + | field in this struct | = note: `C` has a derived impl for the trait `Debug`, but this is intentionally ignored during dead code analysis -error: field is never read: `f` +error: field `f` is never read --> $DIR/clone-debug-dead-code.rs:18:12 | LL | struct D { f: () } - | ^^^^^ + | - ^^^^^ + | | + | field in this struct | = note: `D` has derived impls for the traits `Clone` and `Debug`, but these are intentionally ignored during dead code analysis -error: field is never read: `f` +error: field `f` is never read --> $DIR/clone-debug-dead-code.rs:21:12 | LL | struct E { f: () } - | ^^^^^ + | - ^^^^^ + | | + | field in this struct error: aborting due to 5 previous errors diff --git a/src/test/ui/derives/issue-91550.stderr b/src/test/ui/derives/issue-91550.stderr index 1b26d754984..c94d566f5df 100644 --- a/src/test/ui/derives/issue-91550.stderr +++ b/src/test/ui/derives/issue-91550.stderr @@ -23,7 +23,7 @@ error[E0599]: the method `use_eq` exists for struct `Object<NoDerives>`, but its | LL | pub struct NoDerives; | --------------------- doesn't satisfy `NoDerives: Eq` -LL | +LL | LL | struct Object<T>(T); | -------------------- method `use_eq` not found for this ... @@ -42,7 +42,7 @@ error[E0599]: the method `use_ord` exists for struct `Object<NoDerives>`, but it | LL | pub struct NoDerives; | --------------------- doesn't satisfy `NoDerives: Ord` -LL | +LL | LL | struct Object<T>(T); | -------------------- method `use_ord` not found for this ... @@ -64,7 +64,7 @@ LL | pub struct NoDerives; | | | doesn't satisfy `NoDerives: Ord` | doesn't satisfy `NoDerives: PartialOrd` -LL | +LL | LL | struct Object<T>(T); | -------------------- method `use_ord_and_partial_ord` not found for this ... diff --git a/src/test/ui/derives/issue-97343.stderr b/src/test/ui/derives/issue-97343.stderr index ac797a8f501..e83bbb5b60d 100644 --- a/src/test/ui/derives/issue-97343.stderr +++ b/src/test/ui/derives/issue-97343.stderr @@ -4,7 +4,7 @@ error[E0109]: type arguments are not allowed on type parameter `Irrelevant` LL | #[derive(Debug)] | ----- | | - | not allowed on this + | not allowed on type parameter `Irrelevant` | in this derive macro expansion LL | pub struct Irrelevant<Irrelevant> { | ^^^^^^^^^^ type argument not allowed diff --git a/src/test/ui/issues/issue-6341.rs b/src/test/ui/deriving/issue-6341.rs index 1be1394dfae..1be1394dfae 100644 --- a/src/test/ui/issues/issue-6341.rs +++ b/src/test/ui/deriving/issue-6341.rs diff --git a/src/test/ui/destructure-trait-ref.stderr b/src/test/ui/destructure-trait-ref.stderr index 1291517928e..18a889837df 100644 --- a/src/test/ui/destructure-trait-ref.stderr +++ b/src/test/ui/destructure-trait-ref.stderr @@ -30,7 +30,7 @@ help: consider removing `&` from the pattern | LL - let &&x = &1isize as &dyn T; LL + let &x = &1isize as &dyn T; - | + | error[E0308]: mismatched types --> $DIR/destructure-trait-ref.rs:36:11 @@ -46,7 +46,7 @@ help: consider removing `&` from the pattern | LL - let &&&x = &(&1isize as &dyn T); LL + let &&x = &(&1isize as &dyn T); - | + | error[E0308]: mismatched types --> $DIR/destructure-trait-ref.rs:40:13 diff --git a/src/test/ui/did_you_mean/compatible-variants.stderr b/src/test/ui/did_you_mean/compatible-variants.stderr index a8cb5d6d3e8..a16cdee4462 100644 --- a/src/test/ui/did_you_mean/compatible-variants.stderr +++ b/src/test/ui/did_you_mean/compatible-variants.stderr @@ -71,7 +71,7 @@ help: try removing this `?` | LL - c()? LL + c() - | + | help: try adding an expression at the end of the block | LL ~ c()?; diff --git a/src/test/ui/did_you_mean/issue-34126.stderr b/src/test/ui/did_you_mean/issue-34126.stderr index 0503fac4a66..5343acea4ad 100644 --- a/src/test/ui/did_you_mean/issue-34126.stderr +++ b/src/test/ui/did_you_mean/issue-34126.stderr @@ -13,7 +13,7 @@ help: try removing `&mut` here | LL - self.run(&mut self); LL + self.run(self); - | + | error[E0502]: cannot borrow `self` as mutable because it is also borrowed as immutable --> $DIR/issue-34126.rs:6:18 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 b7824c027ec..5bd47736626 100644 --- a/src/test/ui/dst/dst-object-from-unsized-type.stderr +++ b/src/test/ui/dst/dst-object-from-unsized-type.stderr @@ -11,7 +11,7 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - fn test1<T: ?Sized + Foo>(t: &T) { LL + fn test1<T: Foo>(t: &T) { - | + | error[E0277]: the size for values of type `T` cannot be known at compilation time --> $DIR/dst-object-from-unsized-type.rs:13:23 @@ -26,7 +26,7 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - fn test2<T: ?Sized + Foo>(t: &T) { LL + fn test2<T: Foo>(t: &T) { - | + | error[E0277]: the size for values of type `str` cannot be known at compilation time --> $DIR/dst-object-from-unsized-type.rs:18:28 diff --git a/src/test/ui/dyn-keyword/dyn-2018-edition-lint.stderr b/src/test/ui/dyn-keyword/dyn-2018-edition-lint.stderr index b8e4942dfef..34699bb2658 100644 --- a/src/test/ui/dyn-keyword/dyn-2018-edition-lint.stderr +++ b/src/test/ui/dyn-keyword/dyn-2018-edition-lint.stderr @@ -15,7 +15,7 @@ help: use `dyn` | LL - fn function(x: &SomeTrait, y: Box<SomeTrait>) { LL + fn function(x: &dyn SomeTrait, y: Box<SomeTrait>) { - | + | error: trait objects without an explicit `dyn` are deprecated --> $DIR/dyn-2018-edition-lint.rs:4:35 @@ -29,7 +29,7 @@ help: use `dyn` | LL - fn function(x: &SomeTrait, y: Box<SomeTrait>) { LL + fn function(x: &SomeTrait, y: Box<dyn SomeTrait>) { - | + | error: trait objects without an explicit `dyn` are deprecated --> $DIR/dyn-2018-edition-lint.rs:17:14 @@ -43,7 +43,7 @@ help: use `dyn` | LL - let _x: &SomeTrait = todo!(); LL + let _x: &dyn SomeTrait = todo!(); - | + | error: trait objects without an explicit `dyn` are deprecated --> $DIR/dyn-2018-edition-lint.rs:4:17 @@ -57,7 +57,7 @@ help: use `dyn` | LL - fn function(x: &SomeTrait, y: Box<SomeTrait>) { LL + fn function(x: &dyn SomeTrait, y: Box<SomeTrait>) { - | + | error: trait objects without an explicit `dyn` are deprecated --> $DIR/dyn-2018-edition-lint.rs:4:17 @@ -71,7 +71,7 @@ help: use `dyn` | LL - fn function(x: &SomeTrait, y: Box<SomeTrait>) { LL + fn function(x: &dyn SomeTrait, y: Box<SomeTrait>) { - | + | error: trait objects without an explicit `dyn` are deprecated --> $DIR/dyn-2018-edition-lint.rs:4:35 @@ -85,7 +85,7 @@ help: use `dyn` | LL - fn function(x: &SomeTrait, y: Box<SomeTrait>) { LL + fn function(x: &SomeTrait, y: Box<dyn SomeTrait>) { - | + | error: trait objects without an explicit `dyn` are deprecated --> $DIR/dyn-2018-edition-lint.rs:4:35 @@ -99,7 +99,7 @@ help: use `dyn` | LL - fn function(x: &SomeTrait, y: Box<SomeTrait>) { LL + fn function(x: &SomeTrait, y: Box<dyn SomeTrait>) { - | + | error: aborting due to 7 previous errors diff --git a/src/test/ui/dyn-keyword/dyn-2021-edition-error.stderr b/src/test/ui/dyn-keyword/dyn-2021-edition-error.stderr index b5bc359d716..9e212c77dc7 100644 --- a/src/test/ui/dyn-keyword/dyn-2021-edition-error.stderr +++ b/src/test/ui/dyn-keyword/dyn-2021-edition-error.stderr @@ -8,7 +8,7 @@ help: add `dyn` keyword before this trait | LL - fn function(x: &SomeTrait, y: Box<SomeTrait>) { LL + fn function(x: &dyn SomeTrait, y: Box<SomeTrait>) { - | + | error[E0782]: trait objects must include the `dyn` keyword --> $DIR/dyn-2021-edition-error.rs:3:35 @@ -20,7 +20,7 @@ help: add `dyn` keyword before this trait | LL - fn function(x: &SomeTrait, y: Box<SomeTrait>) { LL + fn function(x: &SomeTrait, y: Box<dyn SomeTrait>) { - | + | error: aborting due to 2 previous errors diff --git a/src/test/ui/dyn-keyword/dyn-angle-brackets.stderr b/src/test/ui/dyn-keyword/dyn-angle-brackets.stderr index fd4030e9622..9bc603fba54 100644 --- a/src/test/ui/dyn-keyword/dyn-angle-brackets.stderr +++ b/src/test/ui/dyn-keyword/dyn-angle-brackets.stderr @@ -15,7 +15,7 @@ help: use `dyn` | LL - <fmt::Debug>::fmt(self, f) LL + <dyn fmt::Debug>::fmt(self, f) - | + | error: aborting due to previous error diff --git a/src/test/ui/empty/empty-struct-unit-expr.stderr b/src/test/ui/empty/empty-struct-unit-expr.stderr index 81651c5bf6f..c15253ba9cd 100644 --- a/src/test/ui/empty/empty-struct-unit-expr.stderr +++ b/src/test/ui/empty/empty-struct-unit-expr.stderr @@ -24,7 +24,7 @@ help: `E::Empty4` is a unit variant, you need to write it without the parenthese | LL - let e4 = E::Empty4(); LL + let e4 = E::Empty4; - | + | error[E0618]: expected function, found `empty_struct::XEmpty2` --> $DIR/empty-struct-unit-expr.rs:18:15 @@ -46,7 +46,7 @@ help: `XE::XEmpty4` is a unit variant, you need to write it without the parenthe | LL - let xe4 = XE::XEmpty4(); LL + let xe4 = XE::XEmpty4; - | + | error: aborting due to 4 previous errors diff --git a/src/test/ui/error-codes/E0057.stderr b/src/test/ui/error-codes/E0057.stderr index 4b4d30a8387..3697b5fcf15 100644 --- a/src/test/ui/error-codes/E0057.stderr +++ b/src/test/ui/error-codes/E0057.stderr @@ -11,8 +11,8 @@ LL | let f = |x| x * 3; | ^^^ help: provide the argument | -LL | let a = f({_}); - | ~~~~~~ +LL | let a = f(/* value */); + | ~~~~~~~~~~~~~~ error[E0057]: this function takes 1 argument but 2 arguments were supplied --> $DIR/E0057.rs:5:13 diff --git a/src/test/ui/error-codes/E0060.stderr b/src/test/ui/error-codes/E0060.stderr index 9dd649239e2..644fd598338 100644 --- a/src/test/ui/error-codes/E0060.stderr +++ b/src/test/ui/error-codes/E0060.stderr @@ -11,8 +11,8 @@ LL | fn printf(_: *const u8, ...) -> u32; | ^^^^^^ help: provide the argument | -LL | unsafe { printf({*const u8}); } - | ~~~~~~~~~~~~~~~~~~~ +LL | unsafe { printf(/* *const u8 */); } + | ~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0061.stderr b/src/test/ui/error-codes/E0061.stderr index f92c548f2de..fa55db0924d 100644 --- a/src/test/ui/error-codes/E0061.stderr +++ b/src/test/ui/error-codes/E0061.stderr @@ -11,8 +11,8 @@ LL | fn f(a: u16, b: &str) {} | ^ ------ ------- help: provide the argument | -LL | f(0, {&str}); - | ~~~~~~~~~~~~ +LL | f(0, /* &str */); + | ~~~~~~~~~~~~~~~~ error[E0061]: this function takes 1 argument but 0 arguments were supplied --> $DIR/E0061.rs:9:5 @@ -27,8 +27,8 @@ LL | fn f2(a: u16) {} | ^^ ------ help: provide the argument | -LL | f2({u16}); - | ~~~~~~~~~ +LL | f2(/* u16 */); + | ~~~~~~~~~~~~~ error: aborting due to 2 previous errors diff --git a/src/test/ui/error-codes/E0109.stderr b/src/test/ui/error-codes/E0109.stderr index e0e437e18ae..8f4cb86de99 100644 --- a/src/test/ui/error-codes/E0109.stderr +++ b/src/test/ui/error-codes/E0109.stderr @@ -1,16 +1,16 @@ -error[E0109]: type arguments are not allowed on this type +error[E0109]: type arguments are not allowed on builtin type `u32` --> $DIR/E0109.rs:1:14 | LL | type X = u32<i32>; | --- ^^^ type argument not allowed | | - | not allowed on this + | not allowed on builtin type `u32` | help: primitive type `u32` doesn't have generic parameters | LL - type X = u32<i32>; LL + type X = u32; - | + | error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0110.stderr b/src/test/ui/error-codes/E0110.stderr index 15e1b959193..4ce2a0a410c 100644 --- a/src/test/ui/error-codes/E0110.stderr +++ b/src/test/ui/error-codes/E0110.stderr @@ -1,16 +1,16 @@ -error[E0109]: lifetime arguments are not allowed on this type +error[E0109]: lifetime arguments are not allowed on builtin type `u32` --> $DIR/E0110.rs:1:14 | LL | type X = u32<'static>; | --- ^^^^^^^ lifetime argument not allowed | | - | not allowed on this + | not allowed on builtin type `u32` | help: primitive type `u32` doesn't have generic parameters | LL - type X = u32<'static>; LL + type X = u32; - | + | error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0255.stderr b/src/test/ui/error-codes/E0255.stderr index b5c09499276..352c5ba5be0 100644 --- a/src/test/ui/error-codes/E0255.stderr +++ b/src/test/ui/error-codes/E0255.stderr @@ -3,7 +3,7 @@ error[E0255]: the name `foo` is defined multiple times | LL | use bar::foo; | -------- previous import of the value `foo` here -LL | +LL | LL | fn foo() {} | ^^^^^^^^ `foo` redefined here | diff --git a/src/test/ui/error-codes/E0259.stderr b/src/test/ui/error-codes/E0259.stderr index 4a48a4d5541..06cbc5b4fb5 100644 --- a/src/test/ui/error-codes/E0259.stderr +++ b/src/test/ui/error-codes/E0259.stderr @@ -3,7 +3,7 @@ error[E0259]: the name `alloc` is defined multiple times | LL | extern crate alloc; | ------------------- previous import of the extern crate `alloc` here -LL | +LL | LL | extern crate libc as alloc; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ `alloc` reimported here | diff --git a/src/test/ui/error-codes/E0260.stderr b/src/test/ui/error-codes/E0260.stderr index 737b20b91ec..2d3305bd15b 100644 --- a/src/test/ui/error-codes/E0260.stderr +++ b/src/test/ui/error-codes/E0260.stderr @@ -3,7 +3,7 @@ error[E0260]: the name `alloc` is defined multiple times | LL | extern crate alloc; | ------------------- previous import of the extern crate `alloc` here -LL | +LL | LL | mod alloc { | ^^^^^^^^^ `alloc` redefined here | diff --git a/src/test/ui/error-codes/E0393.stderr b/src/test/ui/error-codes/E0393.stderr index 7771bacc9ed..8aadf5c8b47 100644 --- a/src/test/ui/error-codes/E0393.stderr +++ b/src/test/ui/error-codes/E0393.stderr @@ -3,7 +3,7 @@ error[E0393]: the type parameter `T` must be explicitly specified | LL | trait A<T=Self> {} | ------------------ type parameter `T` must be specified for this -LL | +LL | LL | fn together_we_will_rule_the_galaxy(son: &dyn A) {} | ^ help: set the type parameter to the desired type: `A<T>` | diff --git a/src/test/ui/error-codes/E0411.stderr b/src/test/ui/error-codes/E0411.stderr index c1c25e835c1..4c99f9fcbf1 100644 --- a/src/test/ui/error-codes/E0411.stderr +++ b/src/test/ui/error-codes/E0411.stderr @@ -1,6 +1,8 @@ error[E0411]: cannot find type `Self` in this scope --> $DIR/E0411.rs:2:6 | +LL | fn main() { + | ---- `Self` not allowed in a function LL | <Self>::foo; | ^^^^ `Self` is only available in impls, traits, and type definitions diff --git a/src/test/ui/error-codes/E0423.stderr b/src/test/ui/error-codes/E0423.stderr index 5f251527e77..8f2ef8c8e6b 100644 --- a/src/test/ui/error-codes/E0423.stderr +++ b/src/test/ui/error-codes/E0423.stderr @@ -31,7 +31,7 @@ error[E0423]: expected function, tuple struct or tuple variant, found struct `Fo | LL | struct Foo { a: bool }; | ---------------------- `Foo` defined here -LL | +LL | LL | let f = Foo(); | ^^^^^ ... diff --git a/src/test/ui/error-codes/E0429.stderr b/src/test/ui/error-codes/E0429.stderr index 0b786ab1e2f..08b99232ee2 100644 --- a/src/test/ui/error-codes/E0429.stderr +++ b/src/test/ui/error-codes/E0429.stderr @@ -8,7 +8,7 @@ help: consider importing the module directly | LL - use std::fmt::self; LL + use std::fmt; - | + | help: alternatively, use the multi-path `use` syntax to import `self` | LL | use std::fmt::{self}; diff --git a/src/test/ui/error-codes/E0446.stderr b/src/test/ui/error-codes/E0446.stderr index 73b6ba3c50e..35e79e448d5 100644 --- a/src/test/ui/error-codes/E0446.stderr +++ b/src/test/ui/error-codes/E0446.stderr @@ -3,7 +3,7 @@ error[E0446]: private type `Bar` in public interface | LL | struct Bar(u32); | ---------------- `Bar` declared as private -LL | +LL | LL | pub fn bar() -> Bar { | ^^^^^^^^^^^^^^^^^^^ can't leak private type diff --git a/src/test/ui/error-codes/E0453.stderr b/src/test/ui/error-codes/E0453.stderr index 6d60dc84c21..f982ed26f5c 100644 --- a/src/test/ui/error-codes/E0453.stderr +++ b/src/test/ui/error-codes/E0453.stderr @@ -3,7 +3,7 @@ error[E0453]: allow(non_snake_case) incompatible with previous forbid | LL | #![forbid(non_snake_case)] | -------------- `forbid` level set here -LL | +LL | LL | #[allow(non_snake_case)] | ^^^^^^^^^^^^^^ overruled by previous forbid @@ -12,7 +12,7 @@ error[E0453]: allow(non_snake_case) incompatible with previous forbid | LL | #![forbid(non_snake_case)] | -------------- `forbid` level set here -LL | +LL | LL | #[allow(non_snake_case)] | ^^^^^^^^^^^^^^ overruled by previous forbid diff --git a/src/test/ui/error-codes/E0504.stderr b/src/test/ui/error-codes/E0504.stderr index 04811721aa5..e677e891615 100644 --- a/src/test/ui/error-codes/E0504.stderr +++ b/src/test/ui/error-codes/E0504.stderr @@ -3,7 +3,7 @@ error[E0505]: cannot move out of `fancy_num` because it is borrowed | LL | let fancy_ref = &fancy_num; | ---------- borrow of `fancy_num` occurs here -LL | +LL | LL | let x = move || { | ^^^^^^^ move out of `fancy_num` occurs here LL | println!("child function: {}", fancy_num.num); diff --git a/src/test/ui/error-codes/E0506.stderr b/src/test/ui/error-codes/E0506.stderr index 17f883f84b8..d70406b750a 100644 --- a/src/test/ui/error-codes/E0506.stderr +++ b/src/test/ui/error-codes/E0506.stderr @@ -5,7 +5,7 @@ LL | let fancy_ref = &fancy_num; | ---------- borrow of `fancy_num` occurs here LL | fancy_num = FancyNum { num: 6 }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ assignment to borrowed `fancy_num` occurs here -LL | +LL | LL | println!("Num: {}, Ref: {}", fancy_num.num, fancy_ref.num); | ------------- borrow later used here diff --git a/src/test/ui/error-codes/E0605.stderr b/src/test/ui/error-codes/E0605.stderr index d082b6c10cc..e385b339402 100644 --- a/src/test/ui/error-codes/E0605.stderr +++ b/src/test/ui/error-codes/E0605.stderr @@ -14,7 +14,7 @@ help: consider borrowing the value | LL - v as &u8; LL + &*v; - | + | error: aborting due to 2 previous errors diff --git a/src/test/ui/error-codes/E0618.stderr b/src/test/ui/error-codes/E0618.stderr index a3a90968df7..fcee6b47c1d 100644 --- a/src/test/ui/error-codes/E0618.stderr +++ b/src/test/ui/error-codes/E0618.stderr @@ -13,7 +13,7 @@ help: `X::Entry` is a unit variant, you need to write it without the parentheses | LL - X::Entry(); LL + X::Entry; - | + | error[E0618]: expected function, found `i32` --> $DIR/E0618.rs:9:5 diff --git a/src/test/ui/expr/if/if-no-match-bindings.stderr b/src/test/ui/expr/if/if-no-match-bindings.stderr index 31937172071..737a5d60448 100644 --- a/src/test/ui/expr/if/if-no-match-bindings.stderr +++ b/src/test/ui/expr/if/if-no-match-bindings.stderr @@ -30,7 +30,7 @@ help: consider removing the borrow | LL - if &true {} LL + if true {} - | + | error[E0308]: mismatched types --> $DIR/if-no-match-bindings.rs:21:8 @@ -42,7 +42,7 @@ help: consider removing the borrow | LL - if &mut true {} LL + if true {} - | + | error[E0308]: mismatched types --> $DIR/if-no-match-bindings.rs:24:11 @@ -76,7 +76,7 @@ help: consider removing the borrow | LL - while &true {} LL + while true {} - | + | error[E0308]: mismatched types --> $DIR/if-no-match-bindings.rs:27:11 @@ -88,7 +88,7 @@ help: consider removing the borrow | LL - while &mut true {} LL + while true {} - | + | error: aborting due to 8 previous errors diff --git a/src/test/ui/feature-gates/feature-gate-with_negative_coherence.stderr b/src/test/ui/feature-gates/feature-gate-with_negative_coherence.stderr index 05007dafa37..d4c201b5d3e 100644 --- a/src/test/ui/feature-gates/feature-gate-with_negative_coherence.stderr +++ b/src/test/ui/feature-gates/feature-gate-with_negative_coherence.stderr @@ -3,7 +3,7 @@ error[E0119]: conflicting implementations of trait `Foo` for type `&_` | LL | impl<T: std::ops::DerefMut> Foo for T { } | ------------------------------------- first implementation here -LL | +LL | LL | impl<T> Foo for &T { } | ^^^^^^^^^^^^^^^^^^ conflicting implementation for `&_` diff --git a/src/test/ui/fmt/format-string-error.stderr b/src/test/ui/fmt/format-string-error.stderr index 8b018480fb0..8a32c225485 100644 --- a/src/test/ui/fmt/format-string-error.stderr +++ b/src/test/ui/fmt/format-string-error.stderr @@ -93,7 +93,7 @@ error: invalid format string: expected `'}'` but string was terminated | LL | { | - because of this opening brace -LL | +LL | LL | "###); | ^ expected `'}'` in format string | diff --git a/src/test/ui/generator/issue-68112.rs b/src/test/ui/generator/issue-68112.rs index feb07c9bf88..3fcef773b68 100644 --- a/src/test/ui/generator/issue-68112.rs +++ b/src/test/ui/generator/issue-68112.rs @@ -20,6 +20,10 @@ pub fn make_gen1<T>(t: T) -> Ready<T> { } fn require_send(_: impl Send) {} +//~^ NOTE required by a bound +//~| NOTE required by a bound +//~| NOTE required by this bound +//~| NOTE required by this bound fn make_non_send_generator() -> impl Generator<Return = Arc<RefCell<i32>>> { make_gen1(Arc::new(RefCell::new(0))) @@ -28,29 +32,39 @@ fn make_non_send_generator() -> impl Generator<Return = Arc<RefCell<i32>>> { fn test1() { let send_gen = || { let _non_send_gen = make_non_send_generator(); + //~^ NOTE not `Send` yield; - }; + //~^ NOTE yield occurs here + //~| NOTE value is used across a yield + }; //~ NOTE later dropped here require_send(send_gen); //~^ ERROR generator cannot be sent between threads + //~| NOTE not `Send` } pub fn make_gen2<T>(t: T) -> impl Generator<Return = T> { - || { +//~^ NOTE appears within the type +//~| NOTE expansion of desugaring + || { //~ NOTE used within this generator yield; t } } -fn make_non_send_generator2() -> impl Generator<Return = Arc<RefCell<i32>>> { +fn make_non_send_generator2() -> impl Generator<Return = Arc<RefCell<i32>>> { //~ NOTE appears within the type +//~^ NOTE expansion of desugaring make_gen2(Arc::new(RefCell::new(0))) } fn test2() { - let send_gen = || { + let send_gen = || { //~ NOTE used within this generator let _non_send_gen = make_non_send_generator2(); yield; }; require_send(send_gen); //~^ ERROR `RefCell<i32>` cannot be shared between threads safely + //~| NOTE `RefCell<i32>` cannot be shared between threads safely + //~| NOTE requirements on the impl + //~| NOTE captures the following types } fn main() {} diff --git a/src/test/ui/generator/issue-68112.stderr b/src/test/ui/generator/issue-68112.stderr index a7d7a732548..83f068c2076 100644 --- a/src/test/ui/generator/issue-68112.stderr +++ b/src/test/ui/generator/issue-68112.stderr @@ -1,17 +1,19 @@ error: generator cannot be sent between threads safely - --> $DIR/issue-68112.rs:33:5 + --> $DIR/issue-68112.rs:40:5 | LL | require_send(send_gen); | ^^^^^^^^^^^^ generator is not `Send` | = help: the trait `Sync` is not implemented for `RefCell<i32>` note: generator is not `Send` as this value is used across a yield - --> $DIR/issue-68112.rs:31:9 + --> $DIR/issue-68112.rs:36:9 | LL | let _non_send_gen = make_non_send_generator(); | ------------- has type `impl Generator<Return = Arc<RefCell<i32>>>` which is not `Send` +LL | LL | yield; | ^^^^^ yield occurs here, with `_non_send_gen` maybe used later +... LL | }; | - `_non_send_gen` is later dropped here note: required by a bound in `require_send` @@ -21,18 +23,41 @@ LL | fn require_send(_: impl Send) {} | ^^^^ required by this bound in `require_send` error[E0277]: `RefCell<i32>` cannot be shared between threads safely - --> $DIR/issue-68112.rs:52:5 + --> $DIR/issue-68112.rs:63:5 | LL | require_send(send_gen); | ^^^^^^^^^^^^ `RefCell<i32>` cannot be shared between threads safely | = help: the trait `Sync` is not implemented for `RefCell<i32>` = note: required because of the requirements on the impl of `Send` for `Arc<RefCell<i32>>` - = note: required because it appears within the type `[generator@$DIR/issue-68112.rs:38:5: 41:6]` - = note: required because it appears within the type `impl Generator<Return = Arc<RefCell<i32>>>` - = note: required because it appears within the type `impl Generator<Return = Arc<RefCell<i32>>>` - = note: required because it appears within the type `{impl Generator<Return = Arc<RefCell<i32>>>, ()}` - = note: required because it appears within the type `[generator@$DIR/issue-68112.rs:48:20: 51:6]` +note: required because it's used within this generator + --> $DIR/issue-68112.rs:48:5 + | +LL | / || { +LL | | yield; +LL | | t +LL | | } + | |_____^ +note: required because it appears within the type `impl Generator<Return = Arc<RefCell<i32>>>` + --> $DIR/issue-68112.rs:45:30 + | +LL | pub fn make_gen2<T>(t: T) -> impl Generator<Return = T> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ +note: required because it appears within the type `impl Generator<Return = Arc<RefCell<i32>>>` + --> $DIR/issue-68112.rs:53:34 + | +LL | fn make_non_send_generator2() -> impl Generator<Return = Arc<RefCell<i32>>> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: required because it captures the following types: `impl Generator<Return = Arc<RefCell<i32>>>`, `()` +note: required because it's used within this generator + --> $DIR/issue-68112.rs:59:20 + | +LL | let send_gen = || { + | ____________________^ +LL | | let _non_send_gen = make_non_send_generator2(); +LL | | yield; +LL | | }; + | |_____^ note: required by a bound in `require_send` --> $DIR/issue-68112.rs:22:25 | diff --git a/src/test/ui/generator/not-send-sync.stderr b/src/test/ui/generator/not-send-sync.stderr index 4d2faa198f1..edf9ee628a2 100644 --- a/src/test/ui/generator/not-send-sync.stderr +++ b/src/test/ui/generator/not-send-sync.stderr @@ -6,7 +6,16 @@ LL | assert_send(|| { | = help: the trait `Sync` is not implemented for `Cell<i32>` = note: required because of the requirements on the impl of `Send` for `&Cell<i32>` - = note: required because it appears within the type `[generator@$DIR/not-send-sync.rs:16:17: 20:6]` +note: required because it's used within this generator + --> $DIR/not-send-sync.rs:16:17 + | +LL | assert_send(|| { + | _________________^ +LL | | +LL | | drop(&a); +LL | | yield; +LL | | }); + | |_____^ note: required by a bound in `assert_send` --> $DIR/not-send-sync.rs:7:23 | diff --git a/src/test/ui/generator/print/generator-print-verbose-1.stderr b/src/test/ui/generator/print/generator-print-verbose-1.stderr index 2f7faf520d9..3ee4c1458ba 100644 --- a/src/test/ui/generator/print/generator-print-verbose-1.stderr +++ b/src/test/ui/generator/print/generator-print-verbose-1.stderr @@ -28,11 +28,34 @@ LL | require_send(send_gen); | = help: the trait `Sync` is not implemented for `RefCell<i32>` = note: required because of the requirements on the impl of `Send` for `Arc<RefCell<i32>>` - = note: required because it appears within the type `[make_gen2<Arc<RefCell<i32>>>::{closure#0} upvar_tys=(Arc<RefCell<i32>>) {()}]` - = note: required because it appears within the type `Opaque(DefId(0:39 ~ generator_print_verbose_1[749a]::make_gen2::{opaque#0}), [std::sync::Arc<std::cell::RefCell<i32>>])` - = note: required because it appears within the type `Opaque(DefId(0:42 ~ generator_print_verbose_1[749a]::make_non_send_generator2::{opaque#0}), [])` - = note: required because it appears within the type `{Opaque(DefId(0:42 ~ generator_print_verbose_1[749a]::make_non_send_generator2::{opaque#0}), []), ()}` - = note: required because it appears within the type `[test2::{closure#0} upvar_tys=() {Opaque(DefId(0:42 ~ generator_print_verbose_1[749a]::make_non_send_generator2::{opaque#0}), []), ()}]` +note: required because it's used within this generator + --> $DIR/generator-print-verbose-1.rs:42:5 + | +LL | / || { +LL | | yield; +LL | | t +LL | | } + | |_____^ +note: required because it appears within the type `Opaque(DefId(0:39 ~ generator_print_verbose_1[749a]::make_gen2::{opaque#0}), [std::sync::Arc<std::cell::RefCell<i32>>])` + --> $DIR/generator-print-verbose-1.rs:41:30 + | +LL | pub fn make_gen2<T>(t: T) -> impl Generator<Return = T> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ +note: required because it appears within the type `Opaque(DefId(0:42 ~ generator_print_verbose_1[749a]::make_non_send_generator2::{opaque#0}), [])` + --> $DIR/generator-print-verbose-1.rs:47:34 + | +LL | fn make_non_send_generator2() -> impl Generator<Return = Arc<RefCell<i32>>> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: required because it captures the following types: `Opaque(DefId(0:42 ~ generator_print_verbose_1[749a]::make_non_send_generator2::{opaque#0}), [])`, `()` +note: required because it's used within this generator + --> $DIR/generator-print-verbose-1.rs:52:20 + | +LL | let send_gen = || { + | ____________________^ +LL | | let _non_send_gen = make_non_send_generator2(); +LL | | yield; +LL | | }; + | |_____^ note: required by a bound in `require_send` --> $DIR/generator-print-verbose-1.rs:26:25 | diff --git a/src/test/ui/generator/print/generator-print-verbose-2.stderr b/src/test/ui/generator/print/generator-print-verbose-2.stderr index fb2a5754dd3..1356fa5f152 100644 --- a/src/test/ui/generator/print/generator-print-verbose-2.stderr +++ b/src/test/ui/generator/print/generator-print-verbose-2.stderr @@ -6,7 +6,16 @@ LL | assert_send(|| { | = help: the trait `Sync` is not implemented for `Cell<i32>` = note: required because of the requirements on the impl of `Send` for `&'_#4r Cell<i32>` - = note: required because it appears within the type `[main::{closure#1} upvar_tys=(&'_#4r Cell<i32>) _#17t]` +note: required because it's used within this generator + --> $DIR/generator-print-verbose-2.rs:19:17 + | +LL | assert_send(|| { + | _________________^ +LL | | +LL | | drop(&a); +LL | | yield; +LL | | }); + | |_____^ note: required by a bound in `assert_send` --> $DIR/generator-print-verbose-2.rs:10:23 | diff --git a/src/test/ui/generic-associated-types/equality-bound.stderr b/src/test/ui/generic-associated-types/equality-bound.stderr index 27432641958..d78f7a7fbce 100644 --- a/src/test/ui/generic-associated-types/equality-bound.stderr +++ b/src/test/ui/generic-associated-types/equality-bound.stderr @@ -9,7 +9,7 @@ help: if `Iterator::Item` is an associated type you're trying to set, use the as | LL - fn sum<I: Iterator<Item = ()>>(i: I) -> i32 where I::Item = i32 { LL + fn sum<I: Iterator<Item = (), Item = i32>>(i: I) -> i32 where { - | + | error: equality constraints are not yet supported in `where` clauses --> $DIR/equality-bound.rs:5:41 @@ -22,7 +22,7 @@ help: if `Iterator::Item` is an associated type you're trying to set, use the as | LL - fn sum2<I: Iterator>(i: I) -> i32 where I::Item = i32 { LL + fn sum2<I: Iterator<Item = i32>>(i: I) -> i32 where { - | + | error: equality constraints are not yet supported in `where` clauses --> $DIR/equality-bound.rs:9:41 diff --git a/src/test/ui/generic-associated-types/issue-70304.rs b/src/test/ui/generic-associated-types/issue-70304.rs index 1c3d166a1af..c9fd7248a80 100644 --- a/src/test/ui/generic-associated-types/issue-70304.rs +++ b/src/test/ui/generic-associated-types/issue-70304.rs @@ -45,7 +45,7 @@ where } fn create_doc() -> impl Document<Cursor<'_> = DocCursorImpl<'_>> { - //~^ ERROR: missing lifetime specifier + //~^ ERROR `'_` cannot be used here [E0637] //~| ERROR: missing lifetime specifier DocumentImpl {} } diff --git a/src/test/ui/generic-associated-types/issue-70304.stderr b/src/test/ui/generic-associated-types/issue-70304.stderr index 08efc82c886..b3881ccb099 100644 --- a/src/test/ui/generic-associated-types/issue-70304.stderr +++ b/src/test/ui/generic-associated-types/issue-70304.stderr @@ -1,14 +1,8 @@ -error[E0106]: missing lifetime specifier +error[E0637]: `'_` cannot be used here --> $DIR/issue-70304.rs:47:41 | LL | fn create_doc() -> impl Document<Cursor<'_> = DocCursorImpl<'_>> { - | ^^ expected named lifetime parameter - | - = help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from -help: consider using the `'static` lifetime - | -LL | fn create_doc() -> impl Document<Cursor<'static> = DocCursorImpl<'_>> { - | ~~~~~~~ + | ^^ `'_` is a reserved lifetime name error[E0106]: missing lifetime specifier --> $DIR/issue-70304.rs:47:61 @@ -24,4 +18,5 @@ LL | fn create_doc() -> impl Document<Cursor<'_> = DocCursorImpl<'static>> { error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0106`. +Some errors have detailed explanations: E0106, E0637. +For more information about an error, try `rustc --explain E0106`. diff --git a/src/test/ui/generic-associated-types/issue-95305.rs b/src/test/ui/generic-associated-types/issue-95305.rs index 9ead347984b..2365daada11 100644 --- a/src/test/ui/generic-associated-types/issue-95305.rs +++ b/src/test/ui/generic-associated-types/issue-95305.rs @@ -9,7 +9,7 @@ trait Foo { } fn foo(x: &impl Foo<Item<'_> = u32>) { } - //~^ ERROR missing lifetime specifier + //~^ ERROR `'_` cannot be used here [E0637] fn bar(x: &impl for<'a> Foo<Item<'a> = &'_ u32>) { } //~^ ERROR missing lifetime specifier diff --git a/src/test/ui/generic-associated-types/issue-95305.stderr b/src/test/ui/generic-associated-types/issue-95305.stderr index 2b48378dc43..8624d880d4e 100644 --- a/src/test/ui/generic-associated-types/issue-95305.stderr +++ b/src/test/ui/generic-associated-types/issue-95305.stderr @@ -1,13 +1,8 @@ -error[E0106]: missing lifetime specifier +error[E0637]: `'_` cannot be used here --> $DIR/issue-95305.rs:11:26 | LL | fn foo(x: &impl Foo<Item<'_> = u32>) { } - | ^^ expected named lifetime parameter - | -help: consider introducing a named lifetime parameter - | -LL | fn foo<'a>(x: &impl Foo<Item<'a> = u32>) { } - | ++++ ~~ + | ^^ `'_` is a reserved lifetime name error[E0106]: missing lifetime specifier --> $DIR/issue-95305.rs:14:41 @@ -22,4 +17,5 @@ LL | fn bar(x: &impl for<'a> Foo<Item<'a> = &'a u32>) { } error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0106`. +Some errors have detailed explanations: E0106, E0637. +For more information about an error, try `rustc --explain E0106`. diff --git a/src/test/ui/generic-associated-types/parameter_number_and_kind_impl.stderr b/src/test/ui/generic-associated-types/parameter_number_and_kind_impl.stderr index 76d39c88b61..1458bf0c4a4 100644 --- a/src/test/ui/generic-associated-types/parameter_number_and_kind_impl.stderr +++ b/src/test/ui/generic-associated-types/parameter_number_and_kind_impl.stderr @@ -8,7 +8,7 @@ LL | type A = u32; | ^ lifetimes do not match type in trait error[E0049]: type `B` has 1 type parameter but its trait declaration has 0 type parameters - --> $DIR/parameter_number_and_kind_impl.rs:17:16 + --> $DIR/parameter_number_and_kind_impl.rs:17:12 | LL | type B<'a, 'b>; | -- -- @@ -16,7 +16,9 @@ LL | type B<'a, 'b>; | expected 0 type parameters ... LL | type B<'a, T> = Vec<T>; - | ^ found 1 type parameter + | ^^ ^ + | | + | found 1 type parameter error[E0195]: lifetime parameters or bounds on type `C` do not match the trait declaration --> $DIR/parameter_number_and_kind_impl.rs:19:11 diff --git a/src/test/ui/half-open-range-patterns/half-open-range-pats-exhaustive-fail.stderr b/src/test/ui/half-open-range-patterns/half-open-range-pats-exhaustive-fail.stderr index 7a2441047b5..d429b4e8eff 100644 --- a/src/test/ui/half-open-range-patterns/half-open-range-pats-exhaustive-fail.stderr +++ b/src/test/ui/half-open-range-patterns/half-open-range-pats-exhaustive-fail.stderr @@ -7,9 +7,8 @@ LL | m!(0f32, f32::NEG_INFINITY..); = note: the matched value is of type `f32` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ match $s { $($t)+ => {} -LL ~ _ => todo!() } - | +LL | match $s { $($t)+ => {}, _ => todo!() } + | ++++++++++++++ error[E0004]: non-exhaustive patterns: `_` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:17:8 @@ -20,9 +19,8 @@ LL | m!(0f32, ..f32::INFINITY); = note: the matched value is of type `f32` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ match $s { $($t)+ => {} -LL ~ _ => todo!() } - | +LL | match $s { $($t)+ => {}, _ => todo!() } + | ++++++++++++++ error[E0004]: non-exhaustive patterns: `'\u{10ffff}'` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:26:8 @@ -33,9 +31,8 @@ LL | m!('a', ..core::char::MAX); = note: the matched value is of type `char` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ match $s { $($t)+ => {} -LL ~ '\u{10ffff}' => todo!() } - | +LL | match $s { $($t)+ => {}, '\u{10ffff}' => todo!() } + | +++++++++++++++++++++++++ error[E0004]: non-exhaustive patterns: `'\u{10fffe}'..='\u{10ffff}'` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:27:8 @@ -46,9 +43,8 @@ LL | m!('a', ..ALMOST_MAX); = note: the matched value is of type `char` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ match $s { $($t)+ => {} -LL ~ '\u{10fffe}'..='\u{10ffff}' => todo!() } - | +LL | match $s { $($t)+ => {}, '\u{10fffe}'..='\u{10ffff}' => todo!() } + | ++++++++++++++++++++++++++++++++++++++++ error[E0004]: non-exhaustive patterns: `'\0'` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:28:8 @@ -59,9 +55,8 @@ LL | m!('a', ALMOST_MIN..); = note: the matched value is of type `char` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ match $s { $($t)+ => {} -LL ~ '\0' => todo!() } - | +LL | match $s { $($t)+ => {}, '\0' => todo!() } + | +++++++++++++++++ error[E0004]: non-exhaustive patterns: `'\u{10ffff}'` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:29:8 @@ -72,9 +67,8 @@ LL | m!('a', ..=ALMOST_MAX); = note: the matched value is of type `char` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ match $s { $($t)+ => {} -LL ~ '\u{10ffff}' => todo!() } - | +LL | match $s { $($t)+ => {}, '\u{10ffff}' => todo!() } + | +++++++++++++++++++++++++ error[E0004]: non-exhaustive patterns: `'b'` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:30:8 @@ -85,9 +79,8 @@ LL | m!('a', ..=VAL | VAL_2..); = note: the matched value is of type `char` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ match $s { $($t)+ => {} -LL ~ 'b' => todo!() } - | +LL | match $s { $($t)+ => {}, 'b' => todo!() } + | ++++++++++++++++ error[E0004]: non-exhaustive patterns: `'b'` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:31:8 @@ -98,9 +91,8 @@ LL | m!('a', ..VAL_1 | VAL_2..); = note: the matched value is of type `char` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ match $s { $($t)+ => {} -LL ~ 'b' => todo!() } - | +LL | match $s { $($t)+ => {}, 'b' => todo!() } + | ++++++++++++++++ error[E0004]: non-exhaustive patterns: `u8::MAX` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:41:12 @@ -111,9 +103,8 @@ LL | m!(0, ..u8::MAX); = note: the matched value is of type `u8` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ match $s { $($t)+ => {} -LL ~ u8::MAX => todo!() } - | +LL | match $s { $($t)+ => {}, u8::MAX => todo!() } + | ++++++++++++++++++++ error[E0004]: non-exhaustive patterns: `254_u8..=u8::MAX` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:42:12 @@ -124,9 +115,8 @@ LL | m!(0, ..ALMOST_MAX); = note: the matched value is of type `u8` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ match $s { $($t)+ => {} -LL ~ 254_u8..=u8::MAX => todo!() } - | +LL | match $s { $($t)+ => {}, 254_u8..=u8::MAX => todo!() } + | +++++++++++++++++++++++++++++ error[E0004]: non-exhaustive patterns: `0_u8` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:43:12 @@ -137,9 +127,8 @@ LL | m!(0, ALMOST_MIN..); = note: the matched value is of type `u8` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ match $s { $($t)+ => {} -LL ~ 0_u8 => todo!() } - | +LL | match $s { $($t)+ => {}, 0_u8 => todo!() } + | +++++++++++++++++ error[E0004]: non-exhaustive patterns: `u8::MAX` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:44:12 @@ -150,9 +139,8 @@ LL | m!(0, ..=ALMOST_MAX); = note: the matched value is of type `u8` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ match $s { $($t)+ => {} -LL ~ u8::MAX => todo!() } - | +LL | match $s { $($t)+ => {}, u8::MAX => todo!() } + | ++++++++++++++++++++ error[E0004]: non-exhaustive patterns: `43_u8` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:45:12 @@ -163,9 +151,8 @@ LL | m!(0, ..=VAL | VAL_2..); = note: the matched value is of type `u8` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ match $s { $($t)+ => {} -LL ~ 43_u8 => todo!() } - | +LL | match $s { $($t)+ => {}, 43_u8 => todo!() } + | ++++++++++++++++++ error[E0004]: non-exhaustive patterns: `43_u8` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:46:12 @@ -176,9 +163,8 @@ LL | m!(0, ..VAL_1 | VAL_2..); = note: the matched value is of type `u8` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ match $s { $($t)+ => {} -LL ~ 43_u8 => todo!() } - | +LL | match $s { $($t)+ => {}, 43_u8 => todo!() } + | ++++++++++++++++++ error[E0004]: non-exhaustive patterns: `u16::MAX` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:54:12 @@ -189,9 +175,8 @@ LL | m!(0, ..u16::MAX); = note: the matched value is of type `u16` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ match $s { $($t)+ => {} -LL ~ u16::MAX => todo!() } - | +LL | match $s { $($t)+ => {}, u16::MAX => todo!() } + | +++++++++++++++++++++ error[E0004]: non-exhaustive patterns: `65534_u16..=u16::MAX` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:55:12 @@ -202,9 +187,8 @@ LL | m!(0, ..ALMOST_MAX); = note: the matched value is of type `u16` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ match $s { $($t)+ => {} -LL ~ 65534_u16..=u16::MAX => todo!() } - | +LL | match $s { $($t)+ => {}, 65534_u16..=u16::MAX => todo!() } + | +++++++++++++++++++++++++++++++++ error[E0004]: non-exhaustive patterns: `0_u16` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:56:12 @@ -215,9 +199,8 @@ LL | m!(0, ALMOST_MIN..); = note: the matched value is of type `u16` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ match $s { $($t)+ => {} -LL ~ 0_u16 => todo!() } - | +LL | match $s { $($t)+ => {}, 0_u16 => todo!() } + | ++++++++++++++++++ error[E0004]: non-exhaustive patterns: `u16::MAX` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:57:12 @@ -228,9 +211,8 @@ LL | m!(0, ..=ALMOST_MAX); = note: the matched value is of type `u16` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ match $s { $($t)+ => {} -LL ~ u16::MAX => todo!() } - | +LL | match $s { $($t)+ => {}, u16::MAX => todo!() } + | +++++++++++++++++++++ error[E0004]: non-exhaustive patterns: `43_u16` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:58:12 @@ -241,9 +223,8 @@ LL | m!(0, ..=VAL | VAL_2..); = note: the matched value is of type `u16` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ match $s { $($t)+ => {} -LL ~ 43_u16 => todo!() } - | +LL | match $s { $($t)+ => {}, 43_u16 => todo!() } + | +++++++++++++++++++ error[E0004]: non-exhaustive patterns: `43_u16` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:59:12 @@ -254,9 +235,8 @@ LL | m!(0, ..VAL_1 | VAL_2..); = note: the matched value is of type `u16` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ match $s { $($t)+ => {} -LL ~ 43_u16 => todo!() } - | +LL | match $s { $($t)+ => {}, 43_u16 => todo!() } + | +++++++++++++++++++ error[E0004]: non-exhaustive patterns: `u32::MAX` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:67:12 @@ -267,9 +247,8 @@ LL | m!(0, ..u32::MAX); = note: the matched value is of type `u32` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ match $s { $($t)+ => {} -LL ~ u32::MAX => todo!() } - | +LL | match $s { $($t)+ => {}, u32::MAX => todo!() } + | +++++++++++++++++++++ error[E0004]: non-exhaustive patterns: `4294967294_u32..=u32::MAX` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:68:12 @@ -280,9 +259,8 @@ LL | m!(0, ..ALMOST_MAX); = note: the matched value is of type `u32` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ match $s { $($t)+ => {} -LL ~ 4294967294_u32..=u32::MAX => todo!() } - | +LL | match $s { $($t)+ => {}, 4294967294_u32..=u32::MAX => todo!() } + | ++++++++++++++++++++++++++++++++++++++ error[E0004]: non-exhaustive patterns: `0_u32` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:69:12 @@ -293,9 +271,8 @@ LL | m!(0, ALMOST_MIN..); = note: the matched value is of type `u32` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ match $s { $($t)+ => {} -LL ~ 0_u32 => todo!() } - | +LL | match $s { $($t)+ => {}, 0_u32 => todo!() } + | ++++++++++++++++++ error[E0004]: non-exhaustive patterns: `u32::MAX` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:70:12 @@ -306,9 +283,8 @@ LL | m!(0, ..=ALMOST_MAX); = note: the matched value is of type `u32` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ match $s { $($t)+ => {} -LL ~ u32::MAX => todo!() } - | +LL | match $s { $($t)+ => {}, u32::MAX => todo!() } + | +++++++++++++++++++++ error[E0004]: non-exhaustive patterns: `43_u32` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:71:12 @@ -319,9 +295,8 @@ LL | m!(0, ..=VAL | VAL_2..); = note: the matched value is of type `u32` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ match $s { $($t)+ => {} -LL ~ 43_u32 => todo!() } - | +LL | match $s { $($t)+ => {}, 43_u32 => todo!() } + | +++++++++++++++++++ error[E0004]: non-exhaustive patterns: `43_u32` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:72:12 @@ -332,9 +307,8 @@ LL | m!(0, ..VAL_1 | VAL_2..); = note: the matched value is of type `u32` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ match $s { $($t)+ => {} -LL ~ 43_u32 => todo!() } - | +LL | match $s { $($t)+ => {}, 43_u32 => todo!() } + | +++++++++++++++++++ error[E0004]: non-exhaustive patterns: `u64::MAX` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:80:12 @@ -345,9 +319,8 @@ LL | m!(0, ..u64::MAX); = note: the matched value is of type `u64` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ match $s { $($t)+ => {} -LL ~ u64::MAX => todo!() } - | +LL | match $s { $($t)+ => {}, u64::MAX => todo!() } + | +++++++++++++++++++++ error[E0004]: non-exhaustive patterns: `18446744073709551614_u64..=u64::MAX` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:81:12 @@ -358,9 +331,8 @@ LL | m!(0, ..ALMOST_MAX); = note: the matched value is of type `u64` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ match $s { $($t)+ => {} -LL ~ 18446744073709551614_u64..=u64::MAX => todo!() } - | +LL | match $s { $($t)+ => {}, 18446744073709551614_u64..=u64::MAX => todo!() } + | ++++++++++++++++++++++++++++++++++++++++++++++++ error[E0004]: non-exhaustive patterns: `0_u64` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:82:12 @@ -371,9 +343,8 @@ LL | m!(0, ALMOST_MIN..); = note: the matched value is of type `u64` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ match $s { $($t)+ => {} -LL ~ 0_u64 => todo!() } - | +LL | match $s { $($t)+ => {}, 0_u64 => todo!() } + | ++++++++++++++++++ error[E0004]: non-exhaustive patterns: `u64::MAX` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:83:12 @@ -384,9 +355,8 @@ LL | m!(0, ..=ALMOST_MAX); = note: the matched value is of type `u64` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ match $s { $($t)+ => {} -LL ~ u64::MAX => todo!() } - | +LL | match $s { $($t)+ => {}, u64::MAX => todo!() } + | +++++++++++++++++++++ error[E0004]: non-exhaustive patterns: `43_u64` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:84:12 @@ -397,9 +367,8 @@ LL | m!(0, ..=VAL | VAL_2..); = note: the matched value is of type `u64` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ match $s { $($t)+ => {} -LL ~ 43_u64 => todo!() } - | +LL | match $s { $($t)+ => {}, 43_u64 => todo!() } + | +++++++++++++++++++ error[E0004]: non-exhaustive patterns: `43_u64` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:85:12 @@ -410,9 +379,8 @@ LL | m!(0, ..VAL_1 | VAL_2..); = note: the matched value is of type `u64` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ match $s { $($t)+ => {} -LL ~ 43_u64 => todo!() } - | +LL | match $s { $($t)+ => {}, 43_u64 => todo!() } + | +++++++++++++++++++ error[E0004]: non-exhaustive patterns: `u128::MAX` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:93:12 @@ -423,9 +391,8 @@ LL | m!(0, ..u128::MAX); = note: the matched value is of type `u128` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ match $s { $($t)+ => {} -LL ~ u128::MAX => todo!() } - | +LL | match $s { $($t)+ => {}, u128::MAX => todo!() } + | ++++++++++++++++++++++ error[E0004]: non-exhaustive patterns: `340282366920938463463374607431768211454_u128..=u128::MAX` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:94:12 @@ -436,9 +403,8 @@ LL | m!(0, ..ALMOST_MAX); = note: the matched value is of type `u128` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ match $s { $($t)+ => {} -LL ~ 340282366920938463463374607431768211454_u128..=u128::MAX => todo!() } - | +LL | match $s { $($t)+ => {}, 340282366920938463463374607431768211454_u128..=u128::MAX => todo!() } + | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ error[E0004]: non-exhaustive patterns: `0_u128` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:95:12 @@ -449,9 +415,8 @@ LL | m!(0, ALMOST_MIN..); = note: the matched value is of type `u128` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ match $s { $($t)+ => {} -LL ~ 0_u128 => todo!() } - | +LL | match $s { $($t)+ => {}, 0_u128 => todo!() } + | +++++++++++++++++++ error[E0004]: non-exhaustive patterns: `u128::MAX` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:96:12 @@ -462,9 +427,8 @@ LL | m!(0, ..=ALMOST_MAX); = note: the matched value is of type `u128` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ match $s { $($t)+ => {} -LL ~ u128::MAX => todo!() } - | +LL | match $s { $($t)+ => {}, u128::MAX => todo!() } + | ++++++++++++++++++++++ error[E0004]: non-exhaustive patterns: `43_u128` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:97:12 @@ -475,9 +439,8 @@ LL | m!(0, ..=VAL | VAL_2..); = note: the matched value is of type `u128` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ match $s { $($t)+ => {} -LL ~ 43_u128 => todo!() } - | +LL | match $s { $($t)+ => {}, 43_u128 => todo!() } + | ++++++++++++++++++++ error[E0004]: non-exhaustive patterns: `43_u128` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:98:12 @@ -488,9 +451,8 @@ LL | m!(0, ..VAL_1 | VAL_2..); = note: the matched value is of type `u128` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ match $s { $($t)+ => {} -LL ~ 43_u128 => todo!() } - | +LL | match $s { $($t)+ => {}, 43_u128 => todo!() } + | ++++++++++++++++++++ error[E0004]: non-exhaustive patterns: `i8::MAX` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:109:12 @@ -501,9 +463,8 @@ LL | m!(0, ..i8::MAX); = note: the matched value is of type `i8` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ match $s { $($t)+ => {} -LL ~ i8::MAX => todo!() } - | +LL | match $s { $($t)+ => {}, i8::MAX => todo!() } + | ++++++++++++++++++++ error[E0004]: non-exhaustive patterns: `126_i8..=i8::MAX` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:110:12 @@ -514,9 +475,8 @@ LL | m!(0, ..ALMOST_MAX); = note: the matched value is of type `i8` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ match $s { $($t)+ => {} -LL ~ 126_i8..=i8::MAX => todo!() } - | +LL | match $s { $($t)+ => {}, 126_i8..=i8::MAX => todo!() } + | +++++++++++++++++++++++++++++ error[E0004]: non-exhaustive patterns: `i8::MIN` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:111:12 @@ -527,9 +487,8 @@ LL | m!(0, ALMOST_MIN..); = note: the matched value is of type `i8` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ match $s { $($t)+ => {} -LL ~ i8::MIN => todo!() } - | +LL | match $s { $($t)+ => {}, i8::MIN => todo!() } + | ++++++++++++++++++++ error[E0004]: non-exhaustive patterns: `i8::MAX` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:112:12 @@ -540,9 +499,8 @@ LL | m!(0, ..=ALMOST_MAX); = note: the matched value is of type `i8` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ match $s { $($t)+ => {} -LL ~ i8::MAX => todo!() } - | +LL | match $s { $($t)+ => {}, i8::MAX => todo!() } + | ++++++++++++++++++++ error[E0004]: non-exhaustive patterns: `43_i8` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:113:12 @@ -553,9 +511,8 @@ LL | m!(0, ..=VAL | VAL_2..); = note: the matched value is of type `i8` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ match $s { $($t)+ => {} -LL ~ 43_i8 => todo!() } - | +LL | match $s { $($t)+ => {}, 43_i8 => todo!() } + | ++++++++++++++++++ error[E0004]: non-exhaustive patterns: `43_i8` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:114:12 @@ -566,9 +523,8 @@ LL | m!(0, ..VAL_1 | VAL_2..); = note: the matched value is of type `i8` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ match $s { $($t)+ => {} -LL ~ 43_i8 => todo!() } - | +LL | match $s { $($t)+ => {}, 43_i8 => todo!() } + | ++++++++++++++++++ error[E0004]: non-exhaustive patterns: `i16::MAX` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:122:12 @@ -579,9 +535,8 @@ LL | m!(0, ..i16::MAX); = note: the matched value is of type `i16` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ match $s { $($t)+ => {} -LL ~ i16::MAX => todo!() } - | +LL | match $s { $($t)+ => {}, i16::MAX => todo!() } + | +++++++++++++++++++++ error[E0004]: non-exhaustive patterns: `32766_i16..=i16::MAX` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:123:12 @@ -592,9 +547,8 @@ LL | m!(0, ..ALMOST_MAX); = note: the matched value is of type `i16` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ match $s { $($t)+ => {} -LL ~ 32766_i16..=i16::MAX => todo!() } - | +LL | match $s { $($t)+ => {}, 32766_i16..=i16::MAX => todo!() } + | +++++++++++++++++++++++++++++++++ error[E0004]: non-exhaustive patterns: `i16::MIN` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:124:12 @@ -605,9 +559,8 @@ LL | m!(0, ALMOST_MIN..); = note: the matched value is of type `i16` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ match $s { $($t)+ => {} -LL ~ i16::MIN => todo!() } - | +LL | match $s { $($t)+ => {}, i16::MIN => todo!() } + | +++++++++++++++++++++ error[E0004]: non-exhaustive patterns: `i16::MAX` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:125:12 @@ -618,9 +571,8 @@ LL | m!(0, ..=ALMOST_MAX); = note: the matched value is of type `i16` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ match $s { $($t)+ => {} -LL ~ i16::MAX => todo!() } - | +LL | match $s { $($t)+ => {}, i16::MAX => todo!() } + | +++++++++++++++++++++ error[E0004]: non-exhaustive patterns: `43_i16` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:126:12 @@ -631,9 +583,8 @@ LL | m!(0, ..=VAL | VAL_2..); = note: the matched value is of type `i16` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ match $s { $($t)+ => {} -LL ~ 43_i16 => todo!() } - | +LL | match $s { $($t)+ => {}, 43_i16 => todo!() } + | +++++++++++++++++++ error[E0004]: non-exhaustive patterns: `43_i16` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:127:12 @@ -644,9 +595,8 @@ LL | m!(0, ..VAL_1 | VAL_2..); = note: the matched value is of type `i16` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ match $s { $($t)+ => {} -LL ~ 43_i16 => todo!() } - | +LL | match $s { $($t)+ => {}, 43_i16 => todo!() } + | +++++++++++++++++++ error[E0004]: non-exhaustive patterns: `i32::MAX` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:135:12 @@ -657,9 +607,8 @@ LL | m!(0, ..i32::MAX); = note: the matched value is of type `i32` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ match $s { $($t)+ => {} -LL ~ i32::MAX => todo!() } - | +LL | match $s { $($t)+ => {}, i32::MAX => todo!() } + | +++++++++++++++++++++ error[E0004]: non-exhaustive patterns: `2147483646_i32..=i32::MAX` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:136:12 @@ -670,9 +619,8 @@ LL | m!(0, ..ALMOST_MAX); = note: the matched value is of type `i32` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ match $s { $($t)+ => {} -LL ~ 2147483646_i32..=i32::MAX => todo!() } - | +LL | match $s { $($t)+ => {}, 2147483646_i32..=i32::MAX => todo!() } + | ++++++++++++++++++++++++++++++++++++++ error[E0004]: non-exhaustive patterns: `i32::MIN` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:137:12 @@ -683,9 +631,8 @@ LL | m!(0, ALMOST_MIN..); = note: the matched value is of type `i32` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ match $s { $($t)+ => {} -LL ~ i32::MIN => todo!() } - | +LL | match $s { $($t)+ => {}, i32::MIN => todo!() } + | +++++++++++++++++++++ error[E0004]: non-exhaustive patterns: `i32::MAX` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:138:12 @@ -696,9 +643,8 @@ LL | m!(0, ..=ALMOST_MAX); = note: the matched value is of type `i32` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ match $s { $($t)+ => {} -LL ~ i32::MAX => todo!() } - | +LL | match $s { $($t)+ => {}, i32::MAX => todo!() } + | +++++++++++++++++++++ error[E0004]: non-exhaustive patterns: `43_i32` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:139:12 @@ -709,9 +655,8 @@ LL | m!(0, ..=VAL | VAL_2..); = note: the matched value is of type `i32` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ match $s { $($t)+ => {} -LL ~ 43_i32 => todo!() } - | +LL | match $s { $($t)+ => {}, 43_i32 => todo!() } + | +++++++++++++++++++ error[E0004]: non-exhaustive patterns: `43_i32` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:140:12 @@ -722,9 +667,8 @@ LL | m!(0, ..VAL_1 | VAL_2..); = note: the matched value is of type `i32` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ match $s { $($t)+ => {} -LL ~ 43_i32 => todo!() } - | +LL | match $s { $($t)+ => {}, 43_i32 => todo!() } + | +++++++++++++++++++ error[E0004]: non-exhaustive patterns: `i64::MAX` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:148:12 @@ -735,9 +679,8 @@ LL | m!(0, ..i64::MAX); = note: the matched value is of type `i64` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ match $s { $($t)+ => {} -LL ~ i64::MAX => todo!() } - | +LL | match $s { $($t)+ => {}, i64::MAX => todo!() } + | +++++++++++++++++++++ error[E0004]: non-exhaustive patterns: `9223372036854775806_i64..=i64::MAX` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:149:12 @@ -748,9 +691,8 @@ LL | m!(0, ..ALMOST_MAX); = note: the matched value is of type `i64` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ match $s { $($t)+ => {} -LL ~ 9223372036854775806_i64..=i64::MAX => todo!() } - | +LL | match $s { $($t)+ => {}, 9223372036854775806_i64..=i64::MAX => todo!() } + | +++++++++++++++++++++++++++++++++++++++++++++++ error[E0004]: non-exhaustive patterns: `i64::MIN` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:150:12 @@ -761,9 +703,8 @@ LL | m!(0, ALMOST_MIN..); = note: the matched value is of type `i64` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ match $s { $($t)+ => {} -LL ~ i64::MIN => todo!() } - | +LL | match $s { $($t)+ => {}, i64::MIN => todo!() } + | +++++++++++++++++++++ error[E0004]: non-exhaustive patterns: `i64::MAX` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:151:12 @@ -774,9 +715,8 @@ LL | m!(0, ..=ALMOST_MAX); = note: the matched value is of type `i64` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ match $s { $($t)+ => {} -LL ~ i64::MAX => todo!() } - | +LL | match $s { $($t)+ => {}, i64::MAX => todo!() } + | +++++++++++++++++++++ error[E0004]: non-exhaustive patterns: `43_i64` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:152:12 @@ -787,9 +727,8 @@ LL | m!(0, ..=VAL | VAL_2..); = note: the matched value is of type `i64` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ match $s { $($t)+ => {} -LL ~ 43_i64 => todo!() } - | +LL | match $s { $($t)+ => {}, 43_i64 => todo!() } + | +++++++++++++++++++ error[E0004]: non-exhaustive patterns: `43_i64` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:153:12 @@ -800,9 +739,8 @@ LL | m!(0, ..VAL_1 | VAL_2..); = note: the matched value is of type `i64` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ match $s { $($t)+ => {} -LL ~ 43_i64 => todo!() } - | +LL | match $s { $($t)+ => {}, 43_i64 => todo!() } + | +++++++++++++++++++ error[E0004]: non-exhaustive patterns: `i128::MAX` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:161:12 @@ -813,9 +751,8 @@ LL | m!(0, ..i128::MAX); = note: the matched value is of type `i128` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ match $s { $($t)+ => {} -LL ~ i128::MAX => todo!() } - | +LL | match $s { $($t)+ => {}, i128::MAX => todo!() } + | ++++++++++++++++++++++ error[E0004]: non-exhaustive patterns: `170141183460469231731687303715884105726_i128..=i128::MAX` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:162:12 @@ -826,9 +763,8 @@ LL | m!(0, ..ALMOST_MAX); = note: the matched value is of type `i128` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ match $s { $($t)+ => {} -LL ~ 170141183460469231731687303715884105726_i128..=i128::MAX => todo!() } - | +LL | match $s { $($t)+ => {}, 170141183460469231731687303715884105726_i128..=i128::MAX => todo!() } + | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ error[E0004]: non-exhaustive patterns: `i128::MIN` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:163:12 @@ -839,9 +775,8 @@ LL | m!(0, ALMOST_MIN..); = note: the matched value is of type `i128` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ match $s { $($t)+ => {} -LL ~ i128::MIN => todo!() } - | +LL | match $s { $($t)+ => {}, i128::MIN => todo!() } + | ++++++++++++++++++++++ error[E0004]: non-exhaustive patterns: `i128::MAX` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:164:12 @@ -852,9 +787,8 @@ LL | m!(0, ..=ALMOST_MAX); = note: the matched value is of type `i128` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ match $s { $($t)+ => {} -LL ~ i128::MAX => todo!() } - | +LL | match $s { $($t)+ => {}, i128::MAX => todo!() } + | ++++++++++++++++++++++ error[E0004]: non-exhaustive patterns: `43_i128` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:165:12 @@ -865,9 +799,8 @@ LL | m!(0, ..=VAL | VAL_2..); = note: the matched value is of type `i128` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ match $s { $($t)+ => {} -LL ~ 43_i128 => todo!() } - | +LL | match $s { $($t)+ => {}, 43_i128 => todo!() } + | ++++++++++++++++++++ error[E0004]: non-exhaustive patterns: `43_i128` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:166:12 @@ -878,9 +811,8 @@ LL | m!(0, ..VAL_1 | VAL_2..); = note: the matched value is of type `i128` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ match $s { $($t)+ => {} -LL ~ 43_i128 => todo!() } - | +LL | match $s { $($t)+ => {}, 43_i128 => todo!() } + | ++++++++++++++++++++ error: aborting due to 68 previous errors diff --git a/src/test/ui/hashmap/hashmap-iter-value-lifetime.stderr b/src/test/ui/hashmap/hashmap-iter-value-lifetime.stderr index 0724fec9055..d6e7a1d45f0 100644 --- a/src/test/ui/hashmap/hashmap-iter-value-lifetime.stderr +++ b/src/test/ui/hashmap/hashmap-iter-value-lifetime.stderr @@ -3,10 +3,10 @@ error[E0502]: cannot borrow `my_stuff` as mutable because it is also borrowed as | LL | let (_, thing) = my_stuff.iter().next().unwrap(); | --------------- immutable borrow occurs here -LL | +LL | LL | my_stuff.clear(); | ^^^^^^^^^^^^^^^^ mutable borrow occurs here -LL | +LL | LL | println!("{}", *thing); | ------ immutable borrow later used here diff --git a/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-71955.stderr b/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-71955.stderr index 1e2575116a8..0bfa7b3cc7c 100644 --- a/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-71955.stderr +++ b/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-71955.stderr @@ -23,7 +23,7 @@ error[E0308]: mismatched types LL | foo(bar, "string", |s| s.len() == 5); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other | - = note: expected trait `FnOnce<(&&str,)>` + = note: expected trait `for<'r, 's> FnOnce<(&'r &'s str,)>` found trait `for<'r> FnOnce<(&'r &str,)>` note: this closure does not fulfill the lifetime requirements --> $DIR/issue-71955.rs:45:24 @@ -61,7 +61,7 @@ error[E0308]: mismatched types LL | foo(baz, "string", |s| s.0.len() == 5); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other | - = note: expected trait `FnOnce<(&Wrapper<'_>,)>` + = note: expected trait `for<'r, 's> FnOnce<(&'r Wrapper<'s>,)>` found trait `for<'r> FnOnce<(&'r Wrapper<'_>,)>` note: this closure does not fulfill the lifetime requirements --> $DIR/issue-71955.rs:48:24 diff --git a/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-85455.rs b/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-85455.rs index fe319e6c851..172bf218c0d 100644 --- a/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-85455.rs +++ b/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-85455.rs @@ -6,8 +6,8 @@ trait SomeTrait<'a> { fn give_me_ice<T>() { callee::<fn(&()) -> <T as SomeTrait<'_>>::Associated>(); - //~^ ERROR the trait bound `T: SomeTrait<'_>` is not satisfied [E0277] - //~| ERROR the trait bound `T: SomeTrait<'_>` is not satisfied [E0277] + //~^ ERROR the trait bound `for<'r> T: SomeTrait<'r>` is not satisfied [E0277] + //~| ERROR the trait bound `for<'r> T: SomeTrait<'r>` is not satisfied [E0277] } fn callee<T: Fn<(&'static (),)>>() { diff --git a/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-85455.stderr b/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-85455.stderr index 13b68b07240..ecca4b999e7 100644 --- a/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-85455.stderr +++ b/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-85455.stderr @@ -1,24 +1,24 @@ -error[E0277]: the trait bound `T: SomeTrait<'_>` is not satisfied +error[E0277]: the trait bound `for<'r> T: SomeTrait<'r>` is not satisfied --> $DIR/issue-85455.rs:8:5 | LL | callee::<fn(&()) -> <T as SomeTrait<'_>>::Associated>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `SomeTrait<'_>` is not implemented for `T` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `for<'r> SomeTrait<'r>` is not implemented for `T` | help: consider restricting type parameter `T` | -LL | fn give_me_ice<T: SomeTrait<'_>>() { - | +++++++++++++++ +LL | fn give_me_ice<T: for<'r> SomeTrait<'r>>() { + | +++++++++++++++++++++++ -error[E0277]: the trait bound `T: SomeTrait<'_>` is not satisfied +error[E0277]: the trait bound `for<'r> T: SomeTrait<'r>` is not satisfied --> $DIR/issue-85455.rs:8:14 | LL | callee::<fn(&()) -> <T as SomeTrait<'_>>::Associated>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `SomeTrait<'_>` is not implemented for `T` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `for<'r> SomeTrait<'r>` is not implemented for `T` | help: consider restricting type parameter `T` | -LL | fn give_me_ice<T: SomeTrait<'_>>() { - | +++++++++++++++ +LL | fn give_me_ice<T: for<'r> SomeTrait<'r>>() { + | +++++++++++++++++++++++ error: aborting due to 2 previous errors diff --git a/src/test/ui/hrtb/hrtb-just-for-static.stderr b/src/test/ui/hrtb/hrtb-just-for-static.stderr index a5770431eaf..b4312091edb 100644 --- a/src/test/ui/hrtb/hrtb-just-for-static.stderr +++ b/src/test/ui/hrtb/hrtb-just-for-static.stderr @@ -2,7 +2,7 @@ error: implementation of `Foo` is not general enough --> $DIR/hrtb-just-for-static.rs:24:5 | LL | want_hrtb::<StaticInt>() - | ^^^^^^^^^^^^^^^^^^^^^^^^ implementation of `Foo` is not general enough + | ^^^^^^^^^^^^^^^^^^^^^^ implementation of `Foo` is not general enough | = note: `StaticInt` must implement `Foo<&'0 isize>`, for any lifetime `'0`... = note: ...but it actually implements `Foo<&'static isize>` diff --git a/src/test/ui/hrtb/issue-58451.stderr b/src/test/ui/hrtb/issue-58451.stderr index d2b3b1c2aa0..22ba63c3e86 100644 --- a/src/test/ui/hrtb/issue-58451.stderr +++ b/src/test/ui/hrtb/issue-58451.stderr @@ -11,8 +11,8 @@ LL | fn f<I>(i: I) | ^ ---- help: provide the argument | -LL | f(&[f({_})]); - | ~~~~~~ +LL | f(&[f(/* value */)]); + | ~~~~~~~~~~~~~~ error: aborting due to previous error diff --git a/src/test/ui/impl-header-lifetime-elision/dyn-trait.rs b/src/test/ui/impl-header-lifetime-elision/dyn-trait.rs index c508c0ac9d5..359c08c98d1 100644 --- a/src/test/ui/impl-header-lifetime-elision/dyn-trait.rs +++ b/src/test/ui/impl-header-lifetime-elision/dyn-trait.rs @@ -13,6 +13,10 @@ impl StaticTrait for Box<dyn Debug> { } trait NotStaticTrait { } impl NotStaticTrait for Box<dyn Debug + '_> { } +// Check that we don't err when the trait has a lifetime parameter. +trait TraitWithLifetime<'a> { } +impl NotStaticTrait for &dyn TraitWithLifetime<'_> { } + fn static_val<T: StaticTrait>(_: T) { } diff --git a/src/test/ui/impl-header-lifetime-elision/dyn-trait.stderr b/src/test/ui/impl-header-lifetime-elision/dyn-trait.stderr index 88c260b18cb..762698c4fc1 100644 --- a/src/test/ui/impl-header-lifetime-elision/dyn-trait.stderr +++ b/src/test/ui/impl-header-lifetime-elision/dyn-trait.stderr @@ -1,5 +1,5 @@ error[E0521]: borrowed data escapes outside of function - --> $DIR/dyn-trait.rs:20:5 + --> $DIR/dyn-trait.rs:24:5 | LL | fn with_dyn_debug_static<'a>(x: Box<dyn Debug + 'a>) { | -- - `x` is a reference that is only valid in the function body diff --git a/src/test/ui/impl-trait/auto-trait-leak2.rs b/src/test/ui/impl-trait/auto-trait-leak2.rs index a464f576dc7..09450089ada 100644 --- a/src/test/ui/impl-trait/auto-trait-leak2.rs +++ b/src/test/ui/impl-trait/auto-trait-leak2.rs @@ -3,23 +3,37 @@ use std::rc::Rc; // Fast path, main can see the concrete type returned. fn before() -> impl Fn(i32) { +//~^ NOTE within this `impl Fn +//~| NOTE within the type `impl Fn +//~| NOTE expansion of desugaring let p = Rc::new(Cell::new(0)); - move |x| p.set(x) + move |x| p.set(x) //~ NOTE used within this closure } fn send<T: Send>(_: T) {} +//~^ NOTE required by a bound +//~| NOTE required by a bound +//~| NOTE required by this bound +//~| NOTE required by this bound fn main() { send(before()); //~^ ERROR `Rc<Cell<i32>>` cannot be sent between threads safely + //~| NOTE `Rc<Cell<i32>>` cannot be sent between threads safely + //~| NOTE required by a bound send(after()); //~^ ERROR `Rc<Cell<i32>>` cannot be sent between threads safely + //~| NOTE `Rc<Cell<i32>>` cannot be sent between threads safely + //~| NOTE required by a bound } // Deferred path, main has to wait until typeck finishes, // to check if the return type of after is Send. fn after() -> impl Fn(i32) { +//~^ NOTE within this `impl Fn(i32)` +//~| NOTE in this expansion +//~| NOTE appears within the type let p = Rc::new(Cell::new(0)); - move |x| p.set(x) + move |x| p.set(x) //~ NOTE used within this closure } diff --git a/src/test/ui/impl-trait/auto-trait-leak2.stderr b/src/test/ui/impl-trait/auto-trait-leak2.stderr index 37ae3c68029..d825843492d 100644 --- a/src/test/ui/impl-trait/auto-trait-leak2.stderr +++ b/src/test/ui/impl-trait/auto-trait-leak2.stderr @@ -1,5 +1,5 @@ error[E0277]: `Rc<Cell<i32>>` cannot be sent between threads safely - --> $DIR/auto-trait-leak2.rs:13:10 + --> $DIR/auto-trait-leak2.rs:20:10 | LL | fn before() -> impl Fn(i32) { | ------------ within this `impl Fn(i32)` @@ -10,16 +10,24 @@ LL | send(before()); | required by a bound introduced by this call | = help: within `impl Fn(i32)`, the trait `Send` is not implemented for `Rc<Cell<i32>>` - = note: required because it appears within the type `[closure@$DIR/auto-trait-leak2.rs:7:5: 7:22]` - = note: required because it appears within the type `impl Fn(i32)` +note: required because it's used within this closure + --> $DIR/auto-trait-leak2.rs:10:5 + | +LL | move |x| p.set(x) + | ^^^^^^^^^^^^^^^^^ +note: required because it appears within the type `impl Fn(i32)` + --> $DIR/auto-trait-leak2.rs:5:16 + | +LL | fn before() -> impl Fn(i32) { + | ^^^^^^^^^^^^ note: required by a bound in `send` - --> $DIR/auto-trait-leak2.rs:10:12 + --> $DIR/auto-trait-leak2.rs:13:12 | LL | fn send<T: Send>(_: T) {} | ^^^^ required by this bound in `send` error[E0277]: `Rc<Cell<i32>>` cannot be sent between threads safely - --> $DIR/auto-trait-leak2.rs:16:10 + --> $DIR/auto-trait-leak2.rs:25:10 | LL | send(after()); | ---- ^^^^^^^ `Rc<Cell<i32>>` cannot be sent between threads safely @@ -30,10 +38,18 @@ LL | fn after() -> impl Fn(i32) { | ------------ within this `impl Fn(i32)` | = help: within `impl Fn(i32)`, the trait `Send` is not implemented for `Rc<Cell<i32>>` - = note: required because it appears within the type `[closure@$DIR/auto-trait-leak2.rs:24:5: 24:22]` - = note: required because it appears within the type `impl Fn(i32)` +note: required because it's used within this closure + --> $DIR/auto-trait-leak2.rs:38:5 + | +LL | move |x| p.set(x) + | ^^^^^^^^^^^^^^^^^ +note: required because it appears within the type `impl Fn(i32)` + --> $DIR/auto-trait-leak2.rs:33:15 + | +LL | fn after() -> impl Fn(i32) { + | ^^^^^^^^^^^^ note: required by a bound in `send` - --> $DIR/auto-trait-leak2.rs:10:12 + --> $DIR/auto-trait-leak2.rs:13:12 | LL | fn send<T: Send>(_: T) {} | ^^^^ required by this bound in `send` diff --git a/src/test/ui/impl-trait/bound-normalization-fail.stderr b/src/test/ui/impl-trait/bound-normalization-fail.stderr index eac7e6b315e..bd8d3d3d24e 100644 --- a/src/test/ui/impl-trait/bound-normalization-fail.stderr +++ b/src/test/ui/impl-trait/bound-normalization-fail.stderr @@ -3,6 +3,9 @@ error[E0271]: type mismatch resolving `<Foo<()> as FooLike>::Output == <T as imp | LL | fn foo_fail<T: Trait>() -> impl FooLike<Output = T::Assoc> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type mismatch resolving `<Foo<()> as FooLike>::Output == <T as impl_trait::Trait>::Assoc` +LL | +LL | Foo(()) + | ------- return type was inferred to be `Foo<()>` here | note: expected this to be `()` --> $DIR/bound-normalization-fail.rs:14:19 @@ -27,6 +30,9 @@ error[E0271]: type mismatch resolving `<Foo<()> as FooLike>::Output == <T as lif | LL | fn foo2_fail<'a, T: Trait<'a>>() -> impl FooLike<Output = T::Assoc> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type mismatch resolving `<Foo<()> as FooLike>::Output == <T as lifetimes::Trait<'static>>::Assoc` +... +LL | Foo(()) + | ------- return type was inferred to be `Foo<()>` here | note: expected this to be `()` --> $DIR/bound-normalization-fail.rs:14:19 diff --git a/src/test/ui/impl-trait/impl-generic-mismatch.stderr b/src/test/ui/impl-trait/impl-generic-mismatch.stderr index d1a04af0706..489afd7615f 100644 --- a/src/test/ui/impl-trait/impl-generic-mismatch.stderr +++ b/src/test/ui/impl-trait/impl-generic-mismatch.stderr @@ -11,7 +11,7 @@ help: try removing the generic parameter and using `impl Trait` instead | LL - fn foo<U: Debug>(&self, _: &U) { } LL + fn foo(&self, _: &impl Debug) { } - | + | error[E0643]: method `bar` has incompatible signature for trait --> $DIR/impl-generic-mismatch.rs:17:23 diff --git a/src/test/ui/impl-trait/recursive-impl-trait-type-through-non-recursive.stderr b/src/test/ui/impl-trait/recursive-impl-trait-type-through-non-recursive.stderr index fbc58837a8e..b514e9fef4d 100644 --- a/src/test/ui/impl-trait/recursive-impl-trait-type-through-non-recursive.stderr +++ b/src/test/ui/impl-trait/recursive-impl-trait-type-through-non-recursive.stderr @@ -3,7 +3,7 @@ error[E0720]: cannot resolve opaque type | LL | fn id<T>(t: T) -> impl Sized { t } | ---------- returning this opaque type `impl Sized` -LL | +LL | LL | fn recursive_id() -> impl Sized { | ^^^^^^^^^^ recursive opaque type LL | id(recursive_id2()) @@ -25,7 +25,7 @@ error[E0720]: cannot resolve opaque type | LL | fn wrap<T>(t: T) -> impl Sized { (t,) } | ---------- returning this opaque type `impl Sized` -LL | +LL | LL | fn recursive_wrap() -> impl Sized { | ^^^^^^^^^^ recursive opaque type LL | wrap(recursive_wrap2()) diff --git a/src/test/ui/issues/issue-24883.rs b/src/test/ui/imports/issue-24883.rs index 819a20ddbda..819a20ddbda 100644 --- a/src/test/ui/issues/issue-24883.rs +++ b/src/test/ui/imports/issue-24883.rs diff --git a/src/test/ui/imports/issue-45829/import-self.stderr b/src/test/ui/imports/issue-45829/import-self.stderr index 3301b7d4ef8..0c9424f3083 100644 --- a/src/test/ui/imports/issue-45829/import-self.stderr +++ b/src/test/ui/imports/issue-45829/import-self.stderr @@ -14,7 +14,7 @@ help: consider importing the module directly | LL - use foo::self; LL + use foo; - | + | help: alternatively, use the multi-path `use` syntax to import `self` | LL | use foo::{self}; diff --git a/src/test/ui/imports/issue-59764.stderr b/src/test/ui/imports/issue-59764.stderr index c2cfc0939d6..b969515e2f0 100644 --- a/src/test/ui/imports/issue-59764.stderr +++ b/src/test/ui/imports/issue-59764.stderr @@ -9,7 +9,7 @@ help: a macro with this name exists at the root of the crate | LL - use issue_59764::foo::{baz, makro}; LL + use issue_59764::{makro, foo::{baz}}; - | + | error[E0432]: unresolved import `issue_59764::foo::makro` --> $DIR/issue-59764.rs:21:9 @@ -52,7 +52,7 @@ help: a macro with this name exists at the root of the crate | LL - use issue_59764::foo::{baz, makro, foobar}; LL + use issue_59764::{makro, foo::{baz, foobar}}; - | + | error[E0432]: unresolved import `issue_59764::foo::makro` --> $DIR/issue-59764.rs:40:9 @@ -97,7 +97,7 @@ help: a macro with this name exists at the root of the crate | LL - use issue_59764::{foobaz, foo::makro}; LL + use issue_59764::{makro, foobaz}; - | + | error[E0432]: unresolved import `issue_59764::foo::makro` --> $DIR/issue-59764.rs:59:42 @@ -110,7 +110,7 @@ help: a macro with this name exists at the root of the crate | LL - use issue_59764::{foobaz, foo::{baz, makro}}; LL + use issue_59764::{makro, foobaz, foo::{baz}}; - | + | error[E0432]: unresolved import `issue_59764::foo::makro` --> $DIR/issue-59764.rs:68:13 @@ -155,7 +155,7 @@ help: a macro with this name exists at the root of the crate | LL - use issue_59764::{foobaz, foo::{baz, makro, barbaz::{barfoo}}}; LL + use issue_59764::{makro, foobaz, foo::{baz, barbaz::{barfoo}}}; - | + | error[E0432]: unresolved import `issue_59764::foo::makro` --> $DIR/issue-59764.rs:93:13 @@ -196,7 +196,7 @@ help: a macro with this name exists at the root of the crate | LL - use issue_59764::foo::{baz, makro as foobar}; LL + use issue_59764::{makro as foobar, foo::{baz}}; - | + | error[E0432]: unresolved import `issue_59764::foo::makro` --> $DIR/issue-59764.rs:120:17 @@ -209,8 +209,7 @@ help: a macro with this name exists at the root of the crate | LL ~ issue_59764::{makro as foobar, LL | -LL | foobaz, -LL | + ... LL | LL ~ foo::{baz} | diff --git a/src/test/ui/issues/issue-68103.rs b/src/test/ui/imports/issue-68103.rs index e775678fc60..e775678fc60 100644 --- a/src/test/ui/issues/issue-68103.rs +++ b/src/test/ui/imports/issue-68103.rs diff --git a/src/test/ui/inference/cannot-infer-closure-circular.rs b/src/test/ui/inference/cannot-infer-closure-circular.rs index ae879db68ec..affb481496d 100644 --- a/src/test/ui/inference/cannot-infer-closure-circular.rs +++ b/src/test/ui/inference/cannot-infer-closure-circular.rs @@ -4,10 +4,10 @@ fn main() { // error handles this gracefully, and in particular doesn't generate an extra // note about the `?` operator in the closure body, which isn't relevant to // the inference. - let x = |r| { + let x = |r| { //~ ERROR type annotations needed for `Result<(), E>` let v = r?; Ok(v) }; - let _ = x(x(Ok(()))); //~ ERROR type annotations needed for `Result<(), E>` + let _ = x(x(Ok(()))); } diff --git a/src/test/ui/inference/cannot-infer-closure-circular.stderr b/src/test/ui/inference/cannot-infer-closure-circular.stderr index 3ad8e3cda16..b706cd2bc36 100644 --- a/src/test/ui/inference/cannot-infer-closure-circular.stderr +++ b/src/test/ui/inference/cannot-infer-closure-circular.stderr @@ -1,13 +1,13 @@ error[E0282]: type annotations needed for `Result<(), E>` - --> $DIR/cannot-infer-closure-circular.rs:12:9 + --> $DIR/cannot-infer-closure-circular.rs:7:14 | -LL | let _ = x(x(Ok(()))); - | ^ +LL | let x = |r| { + | ^ | -help: consider giving this pattern a type, where the type for type parameter `E` is specified +help: consider giving this closure parameter an explicit type, where the type for type parameter `E` is specified | -LL | let _: Result<(), E> = x(x(Ok(()))); - | +++++++++++++++ +LL | let x = |r: Result<(), E>| { + | +++++++++++++++ error: aborting due to previous error diff --git a/src/test/ui/inference/deref-suggestion.stderr b/src/test/ui/inference/deref-suggestion.stderr index 8ba9dacb4b2..e763e17e517 100644 --- a/src/test/ui/inference/deref-suggestion.stderr +++ b/src/test/ui/inference/deref-suggestion.stderr @@ -48,7 +48,7 @@ help: consider removing the borrow | LL - foo(&"aaa".to_owned()); LL + foo("aaa".to_owned()); - | + | error[E0308]: mismatched types --> $DIR/deref-suggestion.rs:32:9 @@ -67,7 +67,7 @@ help: consider removing the borrow | LL - foo(&mut "aaa".to_owned()); LL + foo("aaa".to_owned()); - | + | error[E0308]: mismatched types --> $DIR/deref-suggestion.rs:2:20 diff --git a/src/test/ui/issues/issue-72690.rs b/src/test/ui/inference/issue-72690.rs index 8c0a0f51a21..8c0a0f51a21 100644 --- a/src/test/ui/issues/issue-72690.rs +++ b/src/test/ui/inference/issue-72690.rs diff --git a/src/test/ui/issues/issue-72690.stderr b/src/test/ui/inference/issue-72690.stderr index 9edf14ef291..9edf14ef291 100644 --- a/src/test/ui/issues/issue-72690.stderr +++ b/src/test/ui/inference/issue-72690.stderr diff --git a/src/test/ui/interior-mutability/interior-mutability.stderr b/src/test/ui/interior-mutability/interior-mutability.stderr index cb22d5adb71..66fe3c74e2c 100644 --- a/src/test/ui/interior-mutability/interior-mutability.stderr +++ b/src/test/ui/interior-mutability/interior-mutability.stderr @@ -7,7 +7,11 @@ LL | catch_unwind(|| { x.set(23); }); = help: within `Cell<i32>`, the trait `RefUnwindSafe` is not implemented for `UnsafeCell<i32>` = note: required because it appears within the type `Cell<i32>` = note: required because of the requirements on the impl of `UnwindSafe` for `&Cell<i32>` - = note: required because it appears within the type `[closure@$DIR/interior-mutability.rs:5:18: 5:35]` +note: required because it's used within this closure + --> $DIR/interior-mutability.rs:5:18 + | +LL | catch_unwind(|| { x.set(23); }); + | ^^^^^^^^^^^^^^^^^ note: required by a bound in `catch_unwind` --> $SRC_DIR/std/src/panic.rs:LL:COL | diff --git a/src/test/ui/issue-94866.rs b/src/test/ui/issue-94866.rs new file mode 100644 index 00000000000..c4203487936 --- /dev/null +++ b/src/test/ui/issue-94866.rs @@ -0,0 +1,14 @@ +macro_rules! m { + () => { + {} + }; +} + +enum Enum { A, B } + +fn main() { + match Enum::A { + //~^ ERROR non-exhaustive patterns + Enum::A => m!() + } +} diff --git a/src/test/ui/issue-94866.stderr b/src/test/ui/issue-94866.stderr new file mode 100644 index 00000000000..5477d83f449 --- /dev/null +++ b/src/test/ui/issue-94866.stderr @@ -0,0 +1,21 @@ +error[E0004]: non-exhaustive patterns: `B` not covered + --> $DIR/issue-94866.rs:10:11 + | +LL | match Enum::A { + | ^^^^^^^ pattern `B` not covered + | +note: `Enum` defined here + --> $DIR/issue-94866.rs:7:16 + | +LL | enum Enum { A, B } + | ---- ^ not covered + = note: the matched value is of type `Enum` +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown + | +LL ~ Enum::A => m!(), +LL + B => todo!() + | + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0004`. diff --git a/src/test/ui/issues-71798.stderr b/src/test/ui/issues-71798.stderr index ab72c3e41af..829d0a02ec9 100644 --- a/src/test/ui/issues-71798.stderr +++ b/src/test/ui/issues-71798.stderr @@ -9,6 +9,9 @@ error[E0277]: `u32` is not a future | LL | fn test_ref(x: &u32) -> impl std::future::Future<Output = u32> + '_ { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `u32` is not a future +LL | +LL | *x + | -- return type was inferred to be `u32` here | = help: the trait `Future` is not implemented for `u32` = note: u32 must be a future or must implement `IntoFuture` to be awaited diff --git a/src/test/ui/issues/issue-11873.stderr b/src/test/ui/issues/issue-11873.stderr index 4475bdf1474..c814eedd226 100644 --- a/src/test/ui/issues/issue-11873.stderr +++ b/src/test/ui/issues/issue-11873.stderr @@ -7,7 +7,7 @@ LL | let mut f = || v.push(2); | borrow of `v` occurs here LL | let _w = v; | ^ move out of `v` occurs here -LL | +LL | LL | f(); | - borrow later used here diff --git a/src/test/ui/issues/issue-18819.stderr b/src/test/ui/issues/issue-18819.stderr index db228fded6e..6499dd0d81b 100644 --- a/src/test/ui/issues/issue-18819.stderr +++ b/src/test/ui/issues/issue-18819.stderr @@ -20,8 +20,8 @@ LL | print_x(&X); | ~~ help: provide the argument | -LL | print_x({&dyn Foo<Item = bool>}, {&str}); - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL | print_x(/* &dyn Foo<Item = bool> */, /* &str */); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-22370.stderr b/src/test/ui/issues/issue-22370.stderr index 950c12ef7a2..4da346f56ab 100644 --- a/src/test/ui/issues/issue-22370.stderr +++ b/src/test/ui/issues/issue-22370.stderr @@ -3,7 +3,7 @@ error[E0393]: the type parameter `T` must be explicitly specified | LL | trait A<T=Self> {} | ------------------ type parameter `T` must be specified for this -LL | +LL | LL | fn f(a: &dyn A) {} | ^ help: set the type parameter to the desired type: `A<T>` | diff --git a/src/test/ui/issues/issue-22644.stderr b/src/test/ui/issues/issue-22644.stderr index 6bec98121b7..039ffbfd3d8 100644 --- a/src/test/ui/issues/issue-22644.stderr +++ b/src/test/ui/issues/issue-22644.stderr @@ -90,11 +90,10 @@ help: try comparing the cast value | LL ~ println!("{}", (a LL | -LL | -LL | as -LL | -LL | ... +LL | +LL ~ usize) + | error: `<` is interpreted as a start of generic arguments for `usize`, not a shift --> $DIR/issue-22644.rs:32:31 diff --git a/src/test/ui/issues/issue-22706.stderr b/src/test/ui/issues/issue-22706.stderr index 66911f081d7..5366a36b1a6 100644 --- a/src/test/ui/issues/issue-22706.stderr +++ b/src/test/ui/issues/issue-22706.stderr @@ -4,7 +4,7 @@ error[E0109]: type arguments are not allowed on module `marker` LL | fn is_copy<T: ::std::marker<i32>::Copy>() {} | ------ ^^^ type argument not allowed | | - | not allowed on this + | not allowed on module `marker` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-28472.stderr b/src/test/ui/issues/issue-28472.stderr index 92b598252bf..051ed25b6c9 100644 --- a/src/test/ui/issues/issue-28472.stderr +++ b/src/test/ui/issues/issue-28472.stderr @@ -3,7 +3,7 @@ error[E0428]: the name `foo` is defined multiple times | LL | fn foo(); | --------- previous definition of the value `foo` here -LL | +LL | LL | / pub LL | | fn foo(); | |___________^ `foo` redefined here diff --git a/src/test/ui/issues/issue-2995.stderr b/src/test/ui/issues/issue-2995.stderr index 7616f987d73..0d09612c6c2 100644 --- a/src/test/ui/issues/issue-2995.stderr +++ b/src/test/ui/issues/issue-2995.stderr @@ -8,7 +8,7 @@ help: consider borrowing the value | LL - let _q: &isize = p as &isize; LL + let _q: &isize = &*p; - | + | error: aborting due to previous error diff --git a/src/test/ui/issues/issue-3044.stderr b/src/test/ui/issues/issue-3044.stderr index 5bb07cfda21..6dbe6b59391 100644 --- a/src/test/ui/issues/issue-3044.stderr +++ b/src/test/ui/issues/issue-3044.stderr @@ -25,7 +25,7 @@ LL | fn fold<B, F>(mut self, init: B, mut f: F) -> B help: provide the argument | LL ~ needlesArr.iter().fold(|x, y| { -LL ~ }, {_}); +LL ~ }, /* value */); | error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-3099-a.stderr b/src/test/ui/issues/issue-3099-a.stderr index d6e0a799921..e3733cebba5 100644 --- a/src/test/ui/issues/issue-3099-a.stderr +++ b/src/test/ui/issues/issue-3099-a.stderr @@ -3,7 +3,7 @@ error[E0428]: the name `A` is defined multiple times | LL | enum A { B, C } | ------ previous definition of the type `A` here -LL | +LL | LL | enum A { D, E } | ^^^^^^ `A` redefined here | diff --git a/src/test/ui/issues/issue-3099-b.stderr b/src/test/ui/issues/issue-3099-b.stderr index 3ba8b189da6..c0cfefeb940 100644 --- a/src/test/ui/issues/issue-3099-b.stderr +++ b/src/test/ui/issues/issue-3099-b.stderr @@ -3,7 +3,7 @@ error[E0428]: the name `a` is defined multiple times | LL | pub mod a {} | --------- previous definition of the module `a` here -LL | +LL | LL | pub mod a {} | ^^^^^^^^^ `a` redefined here | diff --git a/src/test/ui/issues/issue-35241.stderr b/src/test/ui/issues/issue-35241.stderr index 4e89f59afbe..319886f8783 100644 --- a/src/test/ui/issues/issue-35241.stderr +++ b/src/test/ui/issues/issue-35241.stderr @@ -3,7 +3,7 @@ error[E0308]: mismatched types | LL | struct Foo(u32); | ---------------- fn(u32) -> Foo {Foo} defined here -LL | +LL | LL | fn test() -> Foo { Foo } | --- ^^^ expected struct `Foo`, found fn item | | diff --git a/src/test/ui/issues/issue-37515.rs b/src/test/ui/issues/issue-37515.rs index caff507c918..b3a870d505a 100644 --- a/src/test/ui/issues/issue-37515.rs +++ b/src/test/ui/issues/issue-37515.rs @@ -3,6 +3,6 @@ #![warn(unused)] type Z = dyn for<'x> Send; -//~^ WARN type alias is never used +//~^ WARN type alias `Z` is never used fn main() {} diff --git a/src/test/ui/issues/issue-37515.stderr b/src/test/ui/issues/issue-37515.stderr index 204a39bc8e8..c9bb4c10010 100644 --- a/src/test/ui/issues/issue-37515.stderr +++ b/src/test/ui/issues/issue-37515.stderr @@ -1,4 +1,4 @@ -warning: type alias is never used: `Z` +warning: type alias `Z` is never used --> $DIR/issue-37515.rs:5:1 | LL | type Z = dyn for<'x> Send; diff --git a/src/test/ui/issues/issue-40510-1.stderr b/src/test/ui/issues/issue-40510-1.stderr index 54df40b6e3d..e88f31ea1ee 100644 --- a/src/test/ui/issues/issue-40510-1.stderr +++ b/src/test/ui/issues/issue-40510-1.stderr @@ -3,7 +3,7 @@ error: captured variable cannot escape `FnMut` closure body | LL | let mut x: Box<()> = Box::new(()); | ----- variable defined here -LL | +LL | LL | || { | - inferred to be a `FnMut` closure LL | &mut x diff --git a/src/test/ui/issues/issue-40510-3.stderr b/src/test/ui/issues/issue-40510-3.stderr index cb885ec7d95..22186ba9a67 100644 --- a/src/test/ui/issues/issue-40510-3.stderr +++ b/src/test/ui/issues/issue-40510-3.stderr @@ -3,7 +3,7 @@ error: captured variable cannot escape `FnMut` closure body | LL | let mut x: Vec<()> = Vec::new(); | ----- variable defined here -LL | +LL | LL | || { | - inferred to be a `FnMut` closure LL | / || { diff --git a/src/test/ui/issues/issue-4265.stderr b/src/test/ui/issues/issue-4265.stderr index 4faf5d3a923..acdf963ed3b 100644 --- a/src/test/ui/issues/issue-4265.stderr +++ b/src/test/ui/issues/issue-4265.stderr @@ -5,7 +5,7 @@ LL | / fn bar() { LL | | Foo { baz: 0 }.bar(); LL | | } | |_____- previous definition of `bar` here -LL | +LL | LL | / fn bar() { LL | | } | |_____^ duplicate definition diff --git a/src/test/ui/issues/issue-47646.stderr b/src/test/ui/issues/issue-47646.stderr index 32e8588b3c0..4e28874e140 100644 --- a/src/test/ui/issues/issue-47646.stderr +++ b/src/test/ui/issues/issue-47646.stderr @@ -3,7 +3,7 @@ error[E0502]: cannot borrow `heap` as immutable because it is also borrowed as m | LL | let borrow = heap.peek_mut(); | --------------- mutable borrow occurs here -LL | +LL | LL | match (borrow, ()) { | ------------ a temporary with access to the mutable borrow is created here ... LL | (Some(_), ()) => { diff --git a/src/test/ui/issues/issue-49257.stderr b/src/test/ui/issues/issue-49257.stderr index a14a66659b3..846467f7f22 100644 --- a/src/test/ui/issues/issue-49257.stderr +++ b/src/test/ui/issues/issue-49257.stderr @@ -11,7 +11,7 @@ help: move the `..` to the end of the field list | LL - let Point { .., y, } = p; LL + let Point { y, .. } = p; - | + | error: expected `}`, found `,` --> $DIR/issue-49257.rs:11:19 @@ -26,7 +26,7 @@ help: move the `..` to the end of the field list | LL - let Point { .., y } = p; LL + let Point { y , .. } = p; - | + | error: expected `}`, found `,` --> $DIR/issue-49257.rs:12:19 diff --git a/src/test/ui/issues/issue-51632-try-desugar-incompatible-types.stderr b/src/test/ui/issues/issue-51632-try-desugar-incompatible-types.stderr index 15d2ef3fce8..cc0726bcade 100644 --- a/src/test/ui/issues/issue-51632-try-desugar-incompatible-types.stderr +++ b/src/test/ui/issues/issue-51632-try-desugar-incompatible-types.stderr @@ -11,7 +11,7 @@ help: try removing this `?` | LL - missing_discourses()? LL + missing_discourses() - | + | help: try wrapping the expression in `Ok` | LL | Ok(missing_discourses()?) diff --git a/src/test/ui/issues/issue-57924.stderr b/src/test/ui/issues/issue-57924.stderr index 211b0dde48c..0323a4dfb8a 100644 --- a/src/test/ui/issues/issue-57924.stderr +++ b/src/test/ui/issues/issue-57924.stderr @@ -4,7 +4,7 @@ error[E0109]: type arguments are not allowed on self constructor LL | Self::<E>(e) | ---- ^ type argument not allowed | | - | not allowed on this + | not allowed on self constructor error: aborting due to previous error diff --git a/src/test/ui/issues/issue-60989.stderr b/src/test/ui/issues/issue-60989.stderr index 9076f4f9385..e0236567b2f 100644 --- a/src/test/ui/issues/issue-60989.stderr +++ b/src/test/ui/issues/issue-60989.stderr @@ -4,7 +4,7 @@ error[E0109]: type arguments are not allowed on local variable LL | c1::<()>; | -- ^^ type argument not allowed | | - | not allowed on this + | not allowed on local variable error[E0109]: type arguments are not allowed on local variable --> $DIR/issue-60989.rs:16:10 @@ -12,7 +12,7 @@ error[E0109]: type arguments are not allowed on local variable LL | c1::<dyn Into<B>>; | -- ^^^^^^^^^^^ type argument not allowed | | - | not allowed on this + | not allowed on local variable error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-64792-bad-unicode-ctor.stderr b/src/test/ui/issues/issue-64792-bad-unicode-ctor.stderr index c3dda704b0e..2ec151d24d1 100644 --- a/src/test/ui/issues/issue-64792-bad-unicode-ctor.stderr +++ b/src/test/ui/issues/issue-64792-bad-unicode-ctor.stderr @@ -3,7 +3,7 @@ error[E0423]: expected function, tuple struct or tuple variant, found struct `X` | LL | struct X {} | ----------- `X` defined here -LL | +LL | LL | const Y: X = X("ö"); | ^^^^^^ help: use struct literal syntax instead: `X {}` diff --git a/src/test/ui/issues/issue-86756.stderr b/src/test/ui/issues/issue-86756.stderr index 5b2f04ffa83..399c940ca19 100644 --- a/src/test/ui/issues/issue-86756.stderr +++ b/src/test/ui/issues/issue-86756.stderr @@ -27,7 +27,7 @@ help: use `dyn` | LL - eq::<dyn, Foo> LL + eq::<dyn, dyn Foo> - | + | error[E0107]: missing generics for trait `Foo` --> $DIR/issue-86756.rs:5:15 diff --git a/src/test/ui/issues/issue-98299.rs b/src/test/ui/issues/issue-98299.rs new file mode 100644 index 00000000000..63c058f91fc --- /dev/null +++ b/src/test/ui/issues/issue-98299.rs @@ -0,0 +1,18 @@ +use std::convert::TryFrom; + +pub fn test_usage(p: ()) { + SmallCString::try_from(p).map(|cstr| cstr); + //~^ ERROR: type annotations needed +} + +pub struct SmallCString<const N: usize> {} + +impl<const N: usize> TryFrom<()> for SmallCString<N> { + type Error = (); + + fn try_from(path: ()) -> Result<Self, Self::Error> { + unimplemented!(); + } +} + +fn main() {} diff --git a/src/test/ui/issues/issue-98299.stderr b/src/test/ui/issues/issue-98299.stderr new file mode 100644 index 00000000000..a61bffa91e7 --- /dev/null +++ b/src/test/ui/issues/issue-98299.stderr @@ -0,0 +1,9 @@ +error[E0282]: type annotations needed + --> $DIR/issue-98299.rs:4:5 + | +LL | SmallCString::try_from(p).map(|cstr| cstr); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type for enum `Result<SmallCString<{_: usize}>, ()>` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0282`. diff --git a/src/test/ui/iterators/into-iter-on-arrays-2018.stderr b/src/test/ui/iterators/into-iter-on-arrays-2018.stderr index e994d691106..9b312505837 100644 --- a/src/test/ui/iterators/into-iter-on-arrays-2018.stderr +++ b/src/test/ui/iterators/into-iter-on-arrays-2018.stderr @@ -59,7 +59,7 @@ help: or remove `.into_iter()` to iterate by value | LL - for _ in [1, 2, 3].into_iter() {} LL + for _ in [1, 2, 3] {} - | + | warning: 5 warnings emitted diff --git a/src/test/ui/kindck/kindck-nonsendable-1.stderr b/src/test/ui/kindck/kindck-nonsendable-1.stderr index b3ebe7f5c7d..727573a0be4 100644 --- a/src/test/ui/kindck/kindck-nonsendable-1.stderr +++ b/src/test/ui/kindck/kindck-nonsendable-1.stderr @@ -7,7 +7,11 @@ LL | bar(move|| foo(x)); | `Rc<usize>` cannot be sent between threads safely | = help: within `[closure@$DIR/kindck-nonsendable-1.rs:9:9: 9:22]`, the trait `Send` is not implemented for `Rc<usize>` - = note: required because it appears within the type `[closure@$DIR/kindck-nonsendable-1.rs:9:9: 9:22]` +note: required because it's used within this closure + --> $DIR/kindck-nonsendable-1.rs:9:9 + | +LL | bar(move|| foo(x)); + | ^^^^^^^^^^^^^ note: required by a bound in `bar` --> $DIR/kindck-nonsendable-1.rs:5:21 | diff --git a/src/test/ui/let-else/let-else-if.stderr b/src/test/ui/let-else/let-else-if.stderr index a0324565673..746738bbd93 100644 --- a/src/test/ui/let-else/let-else-if.stderr +++ b/src/test/ui/let-else/let-else-if.stderr @@ -8,8 +8,7 @@ help: try placing this code inside a block | LL ~ let Some(_) = Some(()) else { if true { LL | -LL | return; -LL | } else { + ... LL | return; LL ~ } }; | diff --git a/src/test/ui/lifetimes/elided-lifetime-in-path-in-pat.rs b/src/test/ui/lifetimes/elided-lifetime-in-path-in-pat.rs new file mode 100644 index 00000000000..ff84d251149 --- /dev/null +++ b/src/test/ui/lifetimes/elided-lifetime-in-path-in-pat.rs @@ -0,0 +1,13 @@ +// check-pass + +struct Foo<'a> { + x: &'a (), +} + +// The lifetime in pattern-position `Foo` is elided. +// Verify that lowering does not create an independent lifetime parameter for it. +fn foo<'a>(Foo { x }: Foo<'a>) { + *x +} + +fn main() {} diff --git a/src/test/ui/lifetimes/issue-97194.rs b/src/test/ui/lifetimes/issue-97194.rs index accb4a99830..5f3560dbe94 100644 --- a/src/test/ui/lifetimes/issue-97194.rs +++ b/src/test/ui/lifetimes/issue-97194.rs @@ -2,7 +2,7 @@ extern "C" { fn bget(&self, index: [usize; Self::DIM]) -> bool { //~^ ERROR incorrect function inside `extern` block //~| ERROR `self` parameter is only allowed in associated functions - //~| ERROR use of undeclared type `Self` + //~| ERROR failed to resolve: `Self` type T<'a> = &'a str; } } diff --git a/src/test/ui/lifetimes/issue-97194.stderr b/src/test/ui/lifetimes/issue-97194.stderr index 15ad5aadf9f..93bde285a99 100644 --- a/src/test/ui/lifetimes/issue-97194.stderr +++ b/src/test/ui/lifetimes/issue-97194.stderr @@ -25,11 +25,11 @@ LL | fn bget(&self, index: [usize; Self::DIM]) -> bool { | = note: associated functions are those in `impl` or `trait` definitions -error[E0433]: failed to resolve: use of undeclared type `Self` +error[E0433]: failed to resolve: `Self` is only available in impls, traits, and type definitions --> $DIR/issue-97194.rs:2:35 | LL | fn bget(&self, index: [usize; Self::DIM]) -> bool { - | ^^^^ use of undeclared type `Self` + | ^^^^ `Self` is only available in impls, traits, and type definitions error: aborting due to 3 previous errors diff --git a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl-3.stderr b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl-3.stderr index f764ec43ad1..961f9de6614 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl-3.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl-3.stderr @@ -3,7 +3,7 @@ error[E0621]: explicit lifetime required in the type of `x` | LL | fn foo<'a>(&'a self, x: &i32) -> &i32 { | ---- help: add explicit lifetime `'a` to the type of `x`: `&'a i32` -LL | +LL | LL | if true { &self.field } else { x } | ^ lifetime `'a` required diff --git a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl.stderr b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl.stderr index 4c788211576..5bb76381332 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl.stderr @@ -5,7 +5,7 @@ LL | fn foo<'a>(x: &i32, y: &'a i32) -> &'a i32 { | -- - let's call the lifetime of this reference `'1` | | | lifetime `'a` defined here -LL | +LL | LL | if x > y { x } else { y } | ^ associated function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'1` diff --git a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-return-type-is-anon.stderr b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-return-type-is-anon.stderr index 11e7fa96d7e..4bcd7cf9578 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-return-type-is-anon.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-return-type-is-anon.stderr @@ -5,7 +5,7 @@ LL | fn foo<'a>(&self, x: &'a i32) -> &i32 { | -- - let's call the lifetime of this reference `'1` | | | lifetime `'a` defined here -LL | +LL | LL | x | ^ associated function was supposed to return data with lifetime `'1` but it is returning data with lifetime `'a` diff --git a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-self-is-anon.stderr b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-self-is-anon.stderr index c41f08e691a..34a64f8a63e 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-self-is-anon.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-self-is-anon.stderr @@ -5,7 +5,7 @@ LL | fn foo<'a>(&self, x: &'a Foo) -> &'a Foo { | -- - let's call the lifetime of this reference `'1` | | | lifetime `'a` defined here -LL | +LL | LL | if true { x } else { self } | ^^^^ associated function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'1` diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-trait-objects.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-trait-objects.stderr index cce0a31bfbb..d85ea6529f6 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-trait-objects.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-trait-objects.stderr @@ -10,8 +10,8 @@ LL | y.push(z); | help: consider introducing a named lifetime parameter | -LL | fn foo<'a>(x:Box<dyn Fn(&'a u8, &'a u8)> , y: Vec<&u8>, z: &u8) { - | ++++ ++ ++ +LL | fn foo<'a>(x:Box<dyn Fn(&u8, &u8)> , y: Vec<&'a u8>, z: &'a u8) { + | ++++ ++ ++ error[E0596]: cannot borrow `y` as mutable, as it is not declared as mutable --> $DIR/ex3-both-anon-regions-using-trait-objects.rs:2:3 diff --git a/src/test/ui/lint/dead-code/basic.rs b/src/test/ui/lint/dead-code/basic.rs index 2b69985d33d..3b8ffd58cb5 100644 --- a/src/test/ui/lint/dead-code/basic.rs +++ b/src/test/ui/lint/dead-code/basic.rs @@ -1,7 +1,7 @@ #![deny(dead_code)] #![allow(unreachable_code)] -fn foo() { //~ ERROR function is never used +fn foo() { //~ ERROR function `foo` is never used // none of these should have any dead_code exposed to the user panic!(); diff --git a/src/test/ui/lint/dead-code/basic.stderr b/src/test/ui/lint/dead-code/basic.stderr index f7b9b9c613a..7d068cead44 100644 --- a/src/test/ui/lint/dead-code/basic.stderr +++ b/src/test/ui/lint/dead-code/basic.stderr @@ -1,4 +1,4 @@ -error: function is never used: `foo` +error: function `foo` is never used --> $DIR/basic.rs:4:4 | LL | fn foo() { diff --git a/src/test/ui/lint/dead-code/const-and-self.rs b/src/test/ui/lint/dead-code/const-and-self.rs index 0bcdd6edf0d..5c96e4d0ecb 100644 --- a/src/test/ui/lint/dead-code/const-and-self.rs +++ b/src/test/ui/lint/dead-code/const-and-self.rs @@ -30,8 +30,8 @@ impl Foo<Y> for X { enum E { A, - B, //~ WARN variant is never constructed: `B` - C, //~ WARN variant is never constructed: `C` + B, //~ WARN variants `B` and `C` are never constructed + C, } type F = E; diff --git a/src/test/ui/lint/dead-code/const-and-self.stderr b/src/test/ui/lint/dead-code/const-and-self.stderr index c0e406189e8..9d1d7d6ecde 100644 --- a/src/test/ui/lint/dead-code/const-and-self.stderr +++ b/src/test/ui/lint/dead-code/const-and-self.stderr @@ -1,8 +1,13 @@ -warning: variant is never constructed: `B` +warning: variants `B` and `C` are never constructed --> $DIR/const-and-self.rs:33:5 | +LL | enum E { + | - variants in this enum +LL | A, LL | B, | ^ +LL | C, + | ^ | note: the lint level is defined here --> $DIR/const-and-self.rs:3:9 @@ -10,11 +15,5 @@ note: the lint level is defined here LL | #![warn(dead_code)] | ^^^^^^^^^ -warning: variant is never constructed: `C` - --> $DIR/const-and-self.rs:34:5 - | -LL | C, - | ^ - -warning: 2 warnings emitted +warning: 1 warning emitted diff --git a/src/test/ui/lint/dead-code/empty-unused-enum.rs b/src/test/ui/lint/dead-code/empty-unused-enum.rs index 834681d77e6..864501e9495 100644 --- a/src/test/ui/lint/dead-code/empty-unused-enum.rs +++ b/src/test/ui/lint/dead-code/empty-unused-enum.rs @@ -1,5 +1,5 @@ #![deny(unused)] -enum E {} //~ ERROR enum is never used +enum E {} //~ ERROR enum `E` is never used fn main() {} diff --git a/src/test/ui/lint/dead-code/empty-unused-enum.stderr b/src/test/ui/lint/dead-code/empty-unused-enum.stderr index ed9a7ccd14b..6391f0941c8 100644 --- a/src/test/ui/lint/dead-code/empty-unused-enum.stderr +++ b/src/test/ui/lint/dead-code/empty-unused-enum.stderr @@ -1,4 +1,4 @@ -error: enum is never used: `E` +error: enum `E` is never used --> $DIR/empty-unused-enum.rs:3:6 | LL | enum E {} diff --git a/src/test/ui/lint/dead-code/impl-trait.rs b/src/test/ui/lint/dead-code/impl-trait.rs index a2736d97308..757b8f83ef0 100644 --- a/src/test/ui/lint/dead-code/impl-trait.rs +++ b/src/test/ui/lint/dead-code/impl-trait.rs @@ -9,7 +9,7 @@ impl Trait for () { } type Used = (); -type Unused = (); //~ ERROR type alias is never used +type Unused = (); //~ ERROR type alias `Unused` is never used fn foo() -> impl Trait<Type = Used> {} diff --git a/src/test/ui/lint/dead-code/impl-trait.stderr b/src/test/ui/lint/dead-code/impl-trait.stderr index 09b6d08eb8f..9c47c1b5355 100644 --- a/src/test/ui/lint/dead-code/impl-trait.stderr +++ b/src/test/ui/lint/dead-code/impl-trait.stderr @@ -1,4 +1,4 @@ -error: type alias is never used: `Unused` +error: type alias `Unused` is never used --> $DIR/impl-trait.rs:12:1 | LL | type Unused = (); diff --git a/src/test/ui/lint/dead-code/issue-85255.rs b/src/test/ui/lint/dead-code/issue-85255.rs index 871dde91a3e..043f68137b8 100644 --- a/src/test/ui/lint/dead-code/issue-85255.rs +++ b/src/test/ui/lint/dead-code/issue-85255.rs @@ -4,39 +4,39 @@ #![warn(dead_code)] struct Foo { - a: i32, //~ WARNING: field is never read - pub b: i32, //~ WARNING: field is never read + a: i32, //~ WARNING: fields `a` and `b` are never read + pub b: i32, } struct Bar; impl Bar { - fn a(&self) -> i32 { 5 } //~ WARNING: associated function is never used - pub fn b(&self) -> i32 { 6 } //~ WARNING: associated function is never used + fn a(&self) -> i32 { 5 } //~ WARNING: associated function `a` is never used + pub fn b(&self) -> i32 { 6 } //~ WARNING: associated function `b` is never used } pub(crate) struct Foo1 { - a: i32, //~ WARNING: field is never read - pub b: i32, //~ WARNING: field is never read + a: i32, //~ WARNING: fields `a` and `b` are never read + pub b: i32, } pub(crate) struct Bar1; impl Bar1 { - fn a(&self) -> i32 { 5 } //~ WARNING: associated function is never used - pub fn b(&self) -> i32 { 6 } //~ WARNING: associated function is never used + fn a(&self) -> i32 { 5 } //~ WARNING: associated function `a` is never used + pub fn b(&self) -> i32 { 6 } //~ WARNING: associated function `b` is never used } pub(crate) struct Foo2 { - a: i32, //~ WARNING: field is never read - pub b: i32, //~ WARNING: field is never read + a: i32, //~ WARNING: fields `a` and `b` are never read + pub b: i32, } pub(crate) struct Bar2; impl Bar2 { - fn a(&self) -> i32 { 5 } //~ WARNING: associated function is never used - pub fn b(&self) -> i32 { 6 } //~ WARNING: associated function is never used + fn a(&self) -> i32 { 5 } //~ WARNING: associated function `a` is never used + pub fn b(&self) -> i32 { 6 } //~ WARNING: associated function `b` is never used } diff --git a/src/test/ui/lint/dead-code/issue-85255.stderr b/src/test/ui/lint/dead-code/issue-85255.stderr index 5f786d5a2a8..7ebbebb1aba 100644 --- a/src/test/ui/lint/dead-code/issue-85255.stderr +++ b/src/test/ui/lint/dead-code/issue-85255.stderr @@ -1,8 +1,12 @@ -warning: field is never read: `a` +warning: fields `a` and `b` are never read --> $DIR/issue-85255.rs:7:5 | +LL | struct Foo { + | --- fields in this struct LL | a: i32, | ^^^^^^ +LL | pub b: i32, + | ^^^^^^^^^^ | note: the lint level is defined here --> $DIR/issue-85255.rs:4:9 @@ -10,71 +14,61 @@ note: the lint level is defined here LL | #![warn(dead_code)] | ^^^^^^^^^ -warning: field is never read: `b` - --> $DIR/issue-85255.rs:8:5 - | -LL | pub b: i32, - | ^^^^^^^^^^ - -warning: associated function is never used: `a` +warning: associated function `a` is never used --> $DIR/issue-85255.rs:14:8 | LL | fn a(&self) -> i32 { 5 } | ^ -warning: associated function is never used: `b` +warning: associated function `b` is never used --> $DIR/issue-85255.rs:15:12 | LL | pub fn b(&self) -> i32 { 6 } | ^ -warning: field is never read: `a` +warning: fields `a` and `b` are never read --> $DIR/issue-85255.rs:19:5 | +LL | pub(crate) struct Foo1 { + | ---- fields in this struct LL | a: i32, | ^^^^^^ - -warning: field is never read: `b` - --> $DIR/issue-85255.rs:20:5 - | LL | pub b: i32, | ^^^^^^^^^^ -warning: associated function is never used: `a` +warning: associated function `a` is never used --> $DIR/issue-85255.rs:26:8 | LL | fn a(&self) -> i32 { 5 } | ^ -warning: associated function is never used: `b` +warning: associated function `b` is never used --> $DIR/issue-85255.rs:27:12 | LL | pub fn b(&self) -> i32 { 6 } | ^ -warning: field is never read: `a` +warning: fields `a` and `b` are never read --> $DIR/issue-85255.rs:31:5 | +LL | pub(crate) struct Foo2 { + | ---- fields in this struct LL | a: i32, | ^^^^^^ - -warning: field is never read: `b` - --> $DIR/issue-85255.rs:32:5 - | LL | pub b: i32, | ^^^^^^^^^^ -warning: associated function is never used: `a` +warning: associated function `a` is never used --> $DIR/issue-85255.rs:38:8 | LL | fn a(&self) -> i32 { 5 } | ^ -warning: associated function is never used: `b` +warning: associated function `b` is never used --> $DIR/issue-85255.rs:39:12 | LL | pub fn b(&self) -> i32 { 6 } | ^ -warning: 12 warnings emitted +warning: 9 warnings emitted diff --git a/src/test/ui/lint/dead-code/lint-dead-code-1.rs b/src/test/ui/lint/dead-code/lint-dead-code-1.rs index 896147fcc77..8f5a4c41ef2 100644 --- a/src/test/ui/lint/dead-code/lint-dead-code-1.rs +++ b/src/test/ui/lint/dead-code/lint-dead-code-1.rs @@ -9,7 +9,7 @@ pub use foo2::Bar2; mod foo { - pub struct Bar; //~ ERROR: struct is never constructed + pub struct Bar; //~ ERROR: struct `Bar` is never constructed } mod foo2 { @@ -17,14 +17,14 @@ mod foo2 { } pub static pub_static: isize = 0; -static priv_static: isize = 0; //~ ERROR: static is never used +static priv_static: isize = 0; //~ ERROR: static `priv_static` is never used const used_static: isize = 0; pub static used_static2: isize = used_static; const USED_STATIC: isize = 0; const STATIC_USED_IN_ENUM_DISCRIMINANT: isize = 10; pub const pub_const: isize = 0; -const priv_const: isize = 0; //~ ERROR: constant is never used +const priv_const: isize = 0; //~ ERROR: constant `priv_const` is never used const used_const: isize = 0; pub const used_const2: isize = used_const; const USED_CONST: isize = 1; @@ -32,7 +32,7 @@ const CONST_USED_IN_ENUM_DISCRIMINANT: isize = 11; pub type typ = *const UsedStruct4; pub struct PubStruct; -struct PrivStruct; //~ ERROR: struct is never constructed +struct PrivStruct; //~ ERROR: struct `PrivStruct` is never constructed struct UsedStruct1 { #[allow(dead_code)] x: isize @@ -61,10 +61,10 @@ pub enum pub_enum3 { Bar = CONST_USED_IN_ENUM_DISCRIMINANT, } -enum priv_enum { foo2, bar2 } //~ ERROR: enum is never used +enum priv_enum { foo2, bar2 } //~ ERROR: enum `priv_enum` is never used enum used_enum { foo3, - bar3 //~ ERROR variant is never constructed + bar3 //~ ERROR variant `bar3` is never constructed } fn f<T>() {} @@ -85,21 +85,21 @@ pub fn pub_fn() { } f::<StructUsedInGeneric>(); } -fn priv_fn() { //~ ERROR: function is never used +fn priv_fn() { //~ ERROR: function `priv_fn` is never used let unused_struct = PrivStruct; } fn used_fn() {} -fn foo() { //~ ERROR: function is never used +fn foo() { //~ ERROR: function `foo` is never used bar(); let unused_enum = priv_enum::foo2; } -fn bar() { //~ ERROR: function is never used +fn bar() { //~ ERROR: function `bar` is never used foo(); } -fn baz() -> impl Copy { //~ ERROR: function is never used +fn baz() -> impl Copy { //~ ERROR: function `baz` is never used "I'm unused, too" } diff --git a/src/test/ui/lint/dead-code/lint-dead-code-1.stderr b/src/test/ui/lint/dead-code/lint-dead-code-1.stderr index 72e28e7940e..2eddc4ce21c 100644 --- a/src/test/ui/lint/dead-code/lint-dead-code-1.stderr +++ b/src/test/ui/lint/dead-code/lint-dead-code-1.stderr @@ -1,4 +1,4 @@ -error: static is never used: `priv_static` +error: static `priv_static` is never used --> $DIR/lint-dead-code-1.rs:20:1 | LL | static priv_static: isize = 0; @@ -10,55 +10,58 @@ note: the lint level is defined here LL | #![deny(dead_code)] | ^^^^^^^^^ -error: constant is never used: `priv_const` +error: constant `priv_const` is never used --> $DIR/lint-dead-code-1.rs:27:1 | LL | const priv_const: isize = 0; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: struct is never constructed: `PrivStruct` +error: struct `PrivStruct` is never constructed --> $DIR/lint-dead-code-1.rs:35:8 | LL | struct PrivStruct; | ^^^^^^^^^^ -error: enum is never used: `priv_enum` +error: enum `priv_enum` is never used --> $DIR/lint-dead-code-1.rs:64:6 | LL | enum priv_enum { foo2, bar2 } | ^^^^^^^^^ -error: variant is never constructed: `bar3` +error: variant `bar3` is never constructed --> $DIR/lint-dead-code-1.rs:67:5 | +LL | enum used_enum { + | --------- variant in this enum +LL | foo3, LL | bar3 | ^^^^ -error: function is never used: `priv_fn` +error: function `priv_fn` is never used --> $DIR/lint-dead-code-1.rs:88:4 | LL | fn priv_fn() { | ^^^^^^^ -error: function is never used: `foo` +error: function `foo` is never used --> $DIR/lint-dead-code-1.rs:93:4 | LL | fn foo() { | ^^^ -error: function is never used: `bar` +error: function `bar` is never used --> $DIR/lint-dead-code-1.rs:98:4 | LL | fn bar() { | ^^^ -error: function is never used: `baz` +error: function `baz` is never used --> $DIR/lint-dead-code-1.rs:102:4 | LL | fn baz() -> impl Copy { | ^^^ -error: struct is never constructed: `Bar` +error: struct `Bar` is never constructed --> $DIR/lint-dead-code-1.rs:12:16 | LL | pub struct Bar; diff --git a/src/test/ui/lint/dead-code/lint-dead-code-2.rs b/src/test/ui/lint/dead-code/lint-dead-code-2.rs index 2cfe6e539db..6bfa4d96f71 100644 --- a/src/test/ui/lint/dead-code/lint-dead-code-2.rs +++ b/src/test/ui/lint/dead-code/lint-dead-code-2.rs @@ -19,10 +19,10 @@ impl Bar for Foo { fn live_fn() {} -fn dead_fn() {} //~ ERROR: function is never used +fn dead_fn() {} //~ ERROR: function `dead_fn` is never used #[rustc_main] -fn dead_fn2() {} //~ ERROR: function is never used +fn dead_fn2() {} //~ ERROR: function `dead_fn2` is never used fn used_fn() {} @@ -35,7 +35,7 @@ fn start(_: isize, _: *const *const u8) -> isize { } // this is not main -fn main() { //~ ERROR: function is never used +fn main() { //~ ERROR: function `main` is never used dead_fn(); dead_fn2(); } diff --git a/src/test/ui/lint/dead-code/lint-dead-code-2.stderr b/src/test/ui/lint/dead-code/lint-dead-code-2.stderr index b01ba57f985..85af553c986 100644 --- a/src/test/ui/lint/dead-code/lint-dead-code-2.stderr +++ b/src/test/ui/lint/dead-code/lint-dead-code-2.stderr @@ -1,4 +1,4 @@ -error: function is never used: `dead_fn` +error: function `dead_fn` is never used --> $DIR/lint-dead-code-2.rs:22:4 | LL | fn dead_fn() {} @@ -10,13 +10,13 @@ note: the lint level is defined here LL | #![deny(dead_code)] | ^^^^^^^^^ -error: function is never used: `dead_fn2` +error: function `dead_fn2` is never used --> $DIR/lint-dead-code-2.rs:25:4 | LL | fn dead_fn2() {} | ^^^^^^^^ -error: function is never used: `main` +error: function `main` is never used --> $DIR/lint-dead-code-2.rs:38:4 | LL | fn main() { diff --git a/src/test/ui/lint/dead-code/lint-dead-code-3.rs b/src/test/ui/lint/dead-code/lint-dead-code-3.rs index 7f39f7965f2..c3e56063dc3 100644 --- a/src/test/ui/lint/dead-code/lint-dead-code-3.rs +++ b/src/test/ui/lint/dead-code/lint-dead-code-3.rs @@ -11,14 +11,14 @@ extern "C" { pub fn extern_foo(); } -struct Foo; //~ ERROR: struct is never constructed +struct Foo; //~ ERROR: struct `Foo` is never constructed impl Foo { - fn foo(&self) { //~ ERROR: associated function is never used + fn foo(&self) { //~ ERROR: associated function `foo` is never used bar() } } -fn bar() { //~ ERROR: function is never used +fn bar() { //~ ERROR: function `bar` is never used fn baz() {} Foo.foo(); @@ -57,9 +57,9 @@ mod blah { } } -enum c_void {} //~ ERROR: enum is never used +enum c_void {} //~ ERROR: enum `c_void` is never used extern "C" { - fn free(p: *const c_void); //~ ERROR: function is never used + fn free(p: *const c_void); //~ ERROR: function `free` is never used } // Check provided method diff --git a/src/test/ui/lint/dead-code/lint-dead-code-3.stderr b/src/test/ui/lint/dead-code/lint-dead-code-3.stderr index cf8f01ea19f..af59c6fec1f 100644 --- a/src/test/ui/lint/dead-code/lint-dead-code-3.stderr +++ b/src/test/ui/lint/dead-code/lint-dead-code-3.stderr @@ -1,4 +1,4 @@ -error: struct is never constructed: `Foo` +error: struct `Foo` is never constructed --> $DIR/lint-dead-code-3.rs:14:8 | LL | struct Foo; @@ -10,25 +10,25 @@ note: the lint level is defined here LL | #![deny(dead_code)] | ^^^^^^^^^ -error: associated function is never used: `foo` +error: associated function `foo` is never used --> $DIR/lint-dead-code-3.rs:16:8 | LL | fn foo(&self) { | ^^^ -error: function is never used: `bar` +error: function `bar` is never used --> $DIR/lint-dead-code-3.rs:21:4 | LL | fn bar() { | ^^^ -error: enum is never used: `c_void` +error: enum `c_void` is never used --> $DIR/lint-dead-code-3.rs:60:6 | LL | enum c_void {} | ^^^^^^ -error: function is never used: `free` +error: function `free` is never used --> $DIR/lint-dead-code-3.rs:62:5 | LL | fn free(p: *const c_void); diff --git a/src/test/ui/lint/dead-code/lint-dead-code-4.rs b/src/test/ui/lint/dead-code/lint-dead-code-4.rs index 8bcb1e5ba8c..0fc6c6156fd 100644 --- a/src/test/ui/lint/dead-code/lint-dead-code-4.rs +++ b/src/test/ui/lint/dead-code/lint-dead-code-4.rs @@ -4,7 +4,7 @@ struct Foo { x: usize, - b: bool, //~ ERROR: field is never read + b: bool, //~ ERROR: field `b` is never read } fn field_read(f: Foo) -> usize { @@ -12,8 +12,8 @@ fn field_read(f: Foo) -> usize { } enum XYZ { - X, //~ ERROR variant is never constructed - Y { //~ ERROR variant is never constructed + X, //~ ERROR variants `X` and `Y` are never constructed + Y { a: String, b: i32, c: i32, @@ -21,7 +21,7 @@ enum XYZ { Z } -enum ABC { //~ ERROR enum is never used +enum ABC { //~ ERROR enum `ABC` is never used A, B { a: String, @@ -33,13 +33,13 @@ enum ABC { //~ ERROR enum is never used // ensure struct variants get warning for their fields enum IJK { - I, //~ ERROR variant is never constructed + I, //~ ERROR variants `I` and `K` are never constructed J { a: String, - b: i32, //~ ERROR field is never read - c: i32, //~ ERROR field is never read + b: i32, //~ ERROR fields `b` and `c` are never read + c: i32, }, - K //~ ERROR variant is never constructed + K } @@ -58,9 +58,9 @@ fn field_match_in_patterns(b: XYZ) -> String { } struct Bar { - x: usize, //~ ERROR: field is never read + x: usize, //~ ERROR: fields `x` and `c` are never read b: bool, - c: bool, //~ ERROR: field is never read + c: bool, _guard: () } diff --git a/src/test/ui/lint/dead-code/lint-dead-code-4.stderr b/src/test/ui/lint/dead-code/lint-dead-code-4.stderr index 3905d1a06bd..dcd810b3e48 100644 --- a/src/test/ui/lint/dead-code/lint-dead-code-4.stderr +++ b/src/test/ui/lint/dead-code/lint-dead-code-4.stderr @@ -1,6 +1,9 @@ -error: field is never read: `b` +error: field `b` is never read --> $DIR/lint-dead-code-4.rs:7:5 | +LL | struct Foo { + | --- field in this struct +LL | x: usize, LL | b: bool, | ^^^^^^^ | @@ -10,15 +13,13 @@ note: the lint level is defined here LL | #![deny(dead_code)] | ^^^^^^^^^ -error: variant is never constructed: `X` +error: variants `X` and `Y` are never constructed --> $DIR/lint-dead-code-4.rs:15:5 | -LL | X, - | ^ - -error: variant is never constructed: `Y` - --> $DIR/lint-dead-code-4.rs:16:5 - | +LL | enum XYZ { + | --- variants in this enum +LL | X, + | ^ LL | / Y { LL | | a: String, LL | | b: i32, @@ -26,47 +27,44 @@ LL | | c: i32, LL | | }, | |_____^ -error: enum is never used: `ABC` +error: enum `ABC` is never used --> $DIR/lint-dead-code-4.rs:24:6 | LL | enum ABC { | ^^^ -error: variant is never constructed: `I` - --> $DIR/lint-dead-code-4.rs:36:5 - | -LL | I, - | ^ - -error: field is never read: `b` +error: fields `b` and `c` are never read --> $DIR/lint-dead-code-4.rs:39:9 | +LL | enum IJK { + | --- fields in this enum +... LL | b: i32, | ^^^^^^ - -error: field is never read: `c` - --> $DIR/lint-dead-code-4.rs:40:9 - | LL | c: i32, | ^^^^^^ -error: variant is never constructed: `K` - --> $DIR/lint-dead-code-4.rs:42:5 +error: variants `I` and `K` are never constructed + --> $DIR/lint-dead-code-4.rs:36:5 | +LL | enum IJK { + | --- variants in this enum +LL | I, + | ^ +... LL | K | ^ -error: field is never read: `x` +error: fields `x` and `c` are never read --> $DIR/lint-dead-code-4.rs:61:5 | +LL | struct Bar { + | --- fields in this struct LL | x: usize, | ^^^^^^^^ - -error: field is never read: `c` - --> $DIR/lint-dead-code-4.rs:63:5 - | +LL | b: bool, LL | c: bool, | ^^^^^^^ -error: aborting due to 10 previous errors +error: aborting due to 6 previous errors diff --git a/src/test/ui/lint/dead-code/lint-dead-code-5.rs b/src/test/ui/lint/dead-code/lint-dead-code-5.rs index b477c97c545..ed90fb46429 100644 --- a/src/test/ui/lint/dead-code/lint-dead-code-5.rs +++ b/src/test/ui/lint/dead-code/lint-dead-code-5.rs @@ -3,15 +3,15 @@ enum Enum1 { Variant1(isize), - Variant2 //~ ERROR: variant is never constructed + Variant2 //~ ERROR: variant `Variant2` is never constructed } enum Enum2 { Variant3(bool), #[allow(dead_code)] Variant4(isize), - Variant5 { _x: isize }, //~ ERROR: variant is never constructed: `Variant5` - Variant6(isize), //~ ERROR: variant is never constructed: `Variant6` + Variant5 { _x: isize }, //~ ERROR: variants `Variant5` and `Variant6` are never constructed + Variant6(isize), _Variant7, Variant8 { _field: bool }, Variant9, @@ -32,7 +32,7 @@ impl Enum2 { } } -enum Enum3 { //~ ERROR: enum is never used +enum Enum3 { //~ ERROR: enum `Enum3` is never used Variant8, Variant9 } diff --git a/src/test/ui/lint/dead-code/lint-dead-code-5.stderr b/src/test/ui/lint/dead-code/lint-dead-code-5.stderr index 519add82627..037a9be22ad 100644 --- a/src/test/ui/lint/dead-code/lint-dead-code-5.stderr +++ b/src/test/ui/lint/dead-code/lint-dead-code-5.stderr @@ -1,6 +1,9 @@ -error: variant is never constructed: `Variant2` +error: variant `Variant2` is never constructed --> $DIR/lint-dead-code-5.rs:6:5 | +LL | enum Enum1 { + | ----- variant in this enum +LL | Variant1(isize), LL | Variant2 | ^^^^^^^^ | @@ -10,23 +13,22 @@ note: the lint level is defined here LL | #![deny(dead_code)] | ^^^^^^^^^ -error: variant is never constructed: `Variant5` +error: variants `Variant5` and `Variant6` are never constructed --> $DIR/lint-dead-code-5.rs:13:5 | +LL | enum Enum2 { + | ----- variants in this enum +... LL | Variant5 { _x: isize }, | ^^^^^^^^^^^^^^^^^^^^^^ - -error: variant is never constructed: `Variant6` - --> $DIR/lint-dead-code-5.rs:14:5 - | LL | Variant6(isize), | ^^^^^^^^^^^^^^^ -error: enum is never used: `Enum3` +error: enum `Enum3` is never used --> $DIR/lint-dead-code-5.rs:35:6 | LL | enum Enum3 { | ^^^^^ -error: aborting due to 4 previous errors +error: aborting due to 3 previous errors diff --git a/src/test/ui/lint/dead-code/lint-dead-code-6.rs b/src/test/ui/lint/dead-code/lint-dead-code-6.rs index 0a543d5c622..e3074acf129 100644 --- a/src/test/ui/lint/dead-code/lint-dead-code-6.rs +++ b/src/test/ui/lint/dead-code/lint-dead-code-6.rs @@ -1,16 +1,16 @@ #![deny(dead_code)] -struct UnusedStruct; //~ ERROR struct is never constructed: `UnusedStruct` +struct UnusedStruct; //~ ERROR struct `UnusedStruct` is never constructed impl UnusedStruct { - fn unused_impl_fn_1() { //~ ERROR associated function is never used: `unused_impl_fn_1` + fn unused_impl_fn_1() { //~ ERROR associated function `unused_impl_fn_1` is never used println!("blah"); } - fn unused_impl_fn_2(var: i32) { //~ ERROR associated function is never used: `unused_impl_fn_2` + fn unused_impl_fn_2(var: i32) { //~ ERROR associated function `unused_impl_fn_2` is never used println!("foo {}", var); } - fn unused_impl_fn_3( //~ ERROR associated function is never used: `unused_impl_fn_3` + fn unused_impl_fn_3( //~ ERROR associated function `unused_impl_fn_3` is never used var: i32, ) { println!("bar {}", var); diff --git a/src/test/ui/lint/dead-code/lint-dead-code-6.stderr b/src/test/ui/lint/dead-code/lint-dead-code-6.stderr index 7dc60730d6a..f9d83308a3d 100644 --- a/src/test/ui/lint/dead-code/lint-dead-code-6.stderr +++ b/src/test/ui/lint/dead-code/lint-dead-code-6.stderr @@ -1,4 +1,4 @@ -error: struct is never constructed: `UnusedStruct` +error: struct `UnusedStruct` is never constructed --> $DIR/lint-dead-code-6.rs:3:8 | LL | struct UnusedStruct; @@ -10,19 +10,19 @@ note: the lint level is defined here LL | #![deny(dead_code)] | ^^^^^^^^^ -error: associated function is never used: `unused_impl_fn_1` +error: associated function `unused_impl_fn_1` is never used --> $DIR/lint-dead-code-6.rs:5:8 | LL | fn unused_impl_fn_1() { | ^^^^^^^^^^^^^^^^ -error: associated function is never used: `unused_impl_fn_2` +error: associated function `unused_impl_fn_2` is never used --> $DIR/lint-dead-code-6.rs:9:8 | LL | fn unused_impl_fn_2(var: i32) { | ^^^^^^^^^^^^^^^^ -error: associated function is never used: `unused_impl_fn_3` +error: associated function `unused_impl_fn_3` is never used --> $DIR/lint-dead-code-6.rs:13:8 | LL | fn unused_impl_fn_3( diff --git a/src/test/ui/lint/dead-code/multiple-dead-codes-in-the-same-struct.rs b/src/test/ui/lint/dead-code/multiple-dead-codes-in-the-same-struct.rs new file mode 100644 index 00000000000..e3935cf9149 --- /dev/null +++ b/src/test/ui/lint/dead-code/multiple-dead-codes-in-the-same-struct.rs @@ -0,0 +1,29 @@ +#![warn(dead_code)] + +struct Bar { + #[allow(dead_code)] + a: usize, + #[forbid(dead_code)] + b: usize, //~ ERROR field `b` is never read + #[deny(dead_code)] + c: usize, //~ ERROR fields `c` and `e` are never read + d: usize, //~ WARN fields `d`, `f` and `g` are never read + #[deny(dead_code)] + e: usize, + f: usize, + g: usize, + _h: usize, +} + +fn main() { + Bar { + a: 1, + b: 1, + c: 1, + d: 1, + e: 1, + f: 1, + g: 1, + _h: 1, + }; +} diff --git a/src/test/ui/lint/dead-code/multiple-dead-codes-in-the-same-struct.stderr b/src/test/ui/lint/dead-code/multiple-dead-codes-in-the-same-struct.stderr new file mode 100644 index 00000000000..5cc8e06c09d --- /dev/null +++ b/src/test/ui/lint/dead-code/multiple-dead-codes-in-the-same-struct.stderr @@ -0,0 +1,55 @@ +warning: fields `d`, `f` and `g` are never read + --> $DIR/multiple-dead-codes-in-the-same-struct.rs:10:5 + | +LL | struct Bar { + | --- fields in this struct +... +LL | d: usize, + | ^^^^^^^^ +... +LL | f: usize, + | ^^^^^^^^ +LL | g: usize, + | ^^^^^^^^ + | +note: the lint level is defined here + --> $DIR/multiple-dead-codes-in-the-same-struct.rs:1:9 + | +LL | #![warn(dead_code)] + | ^^^^^^^^^ + +error: fields `c` and `e` are never read + --> $DIR/multiple-dead-codes-in-the-same-struct.rs:9:5 + | +LL | struct Bar { + | --- fields in this struct +... +LL | c: usize, + | ^^^^^^^^ +... +LL | e: usize, + | ^^^^^^^^ + | +note: the lint level is defined here + --> $DIR/multiple-dead-codes-in-the-same-struct.rs:8:12 + | +LL | #[deny(dead_code)] + | ^^^^^^^^^ + +error: field `b` is never read + --> $DIR/multiple-dead-codes-in-the-same-struct.rs:7:5 + | +LL | struct Bar { + | --- field in this struct +... +LL | b: usize, + | ^^^^^^^^ + | +note: the lint level is defined here + --> $DIR/multiple-dead-codes-in-the-same-struct.rs:6:14 + | +LL | #[forbid(dead_code)] + | ^^^^^^^^^ + +error: aborting due to 2 previous errors; 1 warning emitted + diff --git a/src/test/ui/lint/dead-code/newline-span.rs b/src/test/ui/lint/dead-code/newline-span.rs index a4342056419..209c3cd937f 100644 --- a/src/test/ui/lint/dead-code/newline-span.rs +++ b/src/test/ui/lint/dead-code/newline-span.rs @@ -1,14 +1,14 @@ #![deny(dead_code)] -fn unused() { //~ error: function is never used: +fn unused() { //~ error: function `unused` is never used println!("blah"); } -fn unused2(var: i32) { //~ error: function is never used: +fn unused2(var: i32) { //~ error: function `unused2` is never used println!("foo {}", var); } -fn unused3( //~ error: function is never used: +fn unused3( //~ error: function `unused3` is never used var: i32, ) { println!("bar {}", var); diff --git a/src/test/ui/lint/dead-code/newline-span.stderr b/src/test/ui/lint/dead-code/newline-span.stderr index fd74405f2b6..4eeadccc823 100644 --- a/src/test/ui/lint/dead-code/newline-span.stderr +++ b/src/test/ui/lint/dead-code/newline-span.stderr @@ -1,4 +1,4 @@ -error: function is never used: `unused` +error: function `unused` is never used --> $DIR/newline-span.rs:3:4 | LL | fn unused() { @@ -10,13 +10,13 @@ note: the lint level is defined here LL | #![deny(dead_code)] | ^^^^^^^^^ -error: function is never used: `unused2` +error: function `unused2` is never used --> $DIR/newline-span.rs:7:4 | LL | fn unused2(var: i32) { | ^^^^^^^ -error: function is never used: `unused3` +error: function `unused3` is never used --> $DIR/newline-span.rs:11:4 | LL | fn unused3( diff --git a/src/test/ui/lint/dead-code/type-alias.rs b/src/test/ui/lint/dead-code/type-alias.rs index 86daf3ea04d..35a7f125dda 100644 --- a/src/test/ui/lint/dead-code/type-alias.rs +++ b/src/test/ui/lint/dead-code/type-alias.rs @@ -1,7 +1,7 @@ #![deny(dead_code)] type Used = u8; -type Unused = u8; //~ ERROR type alias is never used +type Unused = u8; //~ ERROR type alias `Unused` is never used fn id(x: Used) -> Used { x } diff --git a/src/test/ui/lint/dead-code/type-alias.stderr b/src/test/ui/lint/dead-code/type-alias.stderr index b2acd5d4213..80c6ba962b8 100644 --- a/src/test/ui/lint/dead-code/type-alias.stderr +++ b/src/test/ui/lint/dead-code/type-alias.stderr @@ -1,4 +1,4 @@ -error: type alias is never used: `Unused` +error: type alias `Unused` is never used --> $DIR/type-alias.rs:4:1 | LL | type Unused = u8; diff --git a/src/test/ui/lint/dead-code/unused-enum.rs b/src/test/ui/lint/dead-code/unused-enum.rs index e57fac259c5..20df3e1de6f 100644 --- a/src/test/ui/lint/dead-code/unused-enum.rs +++ b/src/test/ui/lint/dead-code/unused-enum.rs @@ -1,9 +1,10 @@ #![deny(unused)] -struct F; //~ ERROR struct is never constructed -struct B; //~ ERROR struct is never constructed +struct F; //~ ERROR struct `F` is never constructed +struct B; //~ ERROR struct `B` is never constructed -enum E { //~ ERROR enum is never used +enum E { + //~^ ERROR enum `E` is never used Foo(F), Bar(B), } diff --git a/src/test/ui/lint/dead-code/unused-enum.stderr b/src/test/ui/lint/dead-code/unused-enum.stderr index 9f368fdd2f8..d2602dbb344 100644 --- a/src/test/ui/lint/dead-code/unused-enum.stderr +++ b/src/test/ui/lint/dead-code/unused-enum.stderr @@ -1,4 +1,4 @@ -error: struct is never constructed: `F` +error: struct `F` is never constructed --> $DIR/unused-enum.rs:3:8 | LL | struct F; @@ -11,13 +11,13 @@ LL | #![deny(unused)] | ^^^^^^ = note: `#[deny(dead_code)]` implied by `#[deny(unused)]` -error: struct is never constructed: `B` +error: struct `B` is never constructed --> $DIR/unused-enum.rs:4:8 | LL | struct B; | ^ -error: enum is never used: `E` +error: enum `E` is never used --> $DIR/unused-enum.rs:6:6 | LL | enum E { diff --git a/src/test/ui/lint/dead-code/unused-struct-variant.rs b/src/test/ui/lint/dead-code/unused-struct-variant.rs index 69ab29042e5..a914e0c3301 100644 --- a/src/test/ui/lint/dead-code/unused-struct-variant.rs +++ b/src/test/ui/lint/dead-code/unused-struct-variant.rs @@ -5,7 +5,7 @@ struct B; enum E { Foo(F), - Bar(B), //~ ERROR variant is never constructed + Bar(B), //~ ERROR variant `Bar` is never constructed } fn main() { diff --git a/src/test/ui/lint/dead-code/unused-struct-variant.stderr b/src/test/ui/lint/dead-code/unused-struct-variant.stderr index b93d6d4ac18..b08402b671b 100644 --- a/src/test/ui/lint/dead-code/unused-struct-variant.stderr +++ b/src/test/ui/lint/dead-code/unused-struct-variant.stderr @@ -1,6 +1,9 @@ -error: variant is never constructed: `Bar` +error: variant `Bar` is never constructed --> $DIR/unused-struct-variant.rs:8:5 | +LL | enum E { + | - variant in this enum +LL | Foo(F), LL | Bar(B), | ^^^^^^ | diff --git a/src/test/ui/lint/dead-code/unused-variant.rs b/src/test/ui/lint/dead-code/unused-variant.rs index 295ed16d4cf..82108fa9c13 100644 --- a/src/test/ui/lint/dead-code/unused-variant.rs +++ b/src/test/ui/lint/dead-code/unused-variant.rs @@ -2,7 +2,7 @@ #[derive(Clone)] enum Enum { - Variant1, //~ ERROR: variant is never constructed + Variant1, //~ ERROR: variant `Variant1` is never constructed Variant2, } diff --git a/src/test/ui/lint/dead-code/unused-variant.stderr b/src/test/ui/lint/dead-code/unused-variant.stderr index 57f8ca74f83..a68f64775ad 100644 --- a/src/test/ui/lint/dead-code/unused-variant.stderr +++ b/src/test/ui/lint/dead-code/unused-variant.stderr @@ -1,6 +1,8 @@ -error: variant is never constructed: `Variant1` +error: variant `Variant1` is never constructed --> $DIR/unused-variant.rs:5:5 | +LL | enum Enum { + | ---- variant in this enum LL | Variant1, | ^^^^^^^^ | diff --git a/src/test/ui/lint/dead-code/with-core-crate.rs b/src/test/ui/lint/dead-code/with-core-crate.rs index bc74e807783..0a94b528f33 100644 --- a/src/test/ui/lint/dead-code/with-core-crate.rs +++ b/src/test/ui/lint/dead-code/with-core-crate.rs @@ -4,7 +4,7 @@ #[macro_use] extern crate core; -fn foo() { //~ ERROR function is never used +fn foo() { //~ ERROR function `foo` is never used // none of these should have any dead_code exposed to the user panic!(); diff --git a/src/test/ui/lint/dead-code/with-core-crate.stderr b/src/test/ui/lint/dead-code/with-core-crate.stderr index 2c63e60d676..7adcf884886 100644 --- a/src/test/ui/lint/dead-code/with-core-crate.stderr +++ b/src/test/ui/lint/dead-code/with-core-crate.stderr @@ -1,4 +1,4 @@ -error: function is never used: `foo` +error: function `foo` is never used --> $DIR/with-core-crate.rs:7:4 | LL | fn foo() { diff --git a/src/test/ui/lint/forbid-group-member.stderr b/src/test/ui/lint/forbid-group-member.stderr index 72772a42bed..891fa9885f3 100644 --- a/src/test/ui/lint/forbid-group-member.stderr +++ b/src/test/ui/lint/forbid-group-member.stderr @@ -3,7 +3,7 @@ warning: allow(unused_variables) incompatible with previous forbid | LL | #![forbid(unused)] | ------ `forbid` level set here -LL | +LL | LL | #[allow(unused_variables)] | ^^^^^^^^^^^^^^^^ overruled by previous forbid | @@ -16,7 +16,7 @@ warning: allow(unused_variables) incompatible with previous forbid | LL | #![forbid(unused)] | ------ `forbid` level set here -LL | +LL | LL | #[allow(unused_variables)] | ^^^^^^^^^^^^^^^^ overruled by previous forbid | @@ -28,7 +28,7 @@ warning: allow(unused_variables) incompatible with previous forbid | LL | #![forbid(unused)] | ------ `forbid` level set here -LL | +LL | LL | #[allow(unused_variables)] | ^^^^^^^^^^^^^^^^ overruled by previous forbid | diff --git a/src/test/ui/lint/forbid-member-group.stderr b/src/test/ui/lint/forbid-member-group.stderr index 39700af4d59..e6530177833 100644 --- a/src/test/ui/lint/forbid-member-group.stderr +++ b/src/test/ui/lint/forbid-member-group.stderr @@ -3,7 +3,7 @@ error[E0453]: allow(unused) incompatible with previous forbid | LL | #![forbid(unused_variables)] | ---------------- `forbid` level set here -LL | +LL | LL | #[allow(unused)] | ^^^^^^ overruled by previous forbid @@ -12,7 +12,7 @@ error[E0453]: allow(unused) incompatible with previous forbid | LL | #![forbid(unused_variables)] | ---------------- `forbid` level set here -LL | +LL | LL | #[allow(unused)] | ^^^^^^ overruled by previous forbid diff --git a/src/test/ui/lint/force-warn/allow-warnings.rs b/src/test/ui/lint/force-warn/allow-warnings.rs index adcefc7ec78..0199381fcbb 100644 --- a/src/test/ui/lint/force-warn/allow-warnings.rs +++ b/src/test/ui/lint/force-warn/allow-warnings.rs @@ -6,6 +6,6 @@ #![allow(warnings)] fn dead_function() {} -//~^ WARN function is never used +//~^ WARN function `dead_function` is never used fn main() {} diff --git a/src/test/ui/lint/force-warn/allow-warnings.stderr b/src/test/ui/lint/force-warn/allow-warnings.stderr index cac2b4e9189..4de68a079e5 100644 --- a/src/test/ui/lint/force-warn/allow-warnings.stderr +++ b/src/test/ui/lint/force-warn/allow-warnings.stderr @@ -1,4 +1,4 @@ -warning: function is never used: `dead_function` +warning: function `dead_function` is never used --> $DIR/allow-warnings.rs:8:4 | LL | fn dead_function() {} diff --git a/src/test/ui/lint/force-warn/allowed-group-warn-by-default-lint.stderr b/src/test/ui/lint/force-warn/allowed-group-warn-by-default-lint.stderr index 99d97ba52a0..8d826bd1457 100644 --- a/src/test/ui/lint/force-warn/allowed-group-warn-by-default-lint.stderr +++ b/src/test/ui/lint/force-warn/allowed-group-warn-by-default-lint.stderr @@ -11,7 +11,7 @@ help: use `dyn` | LL - pub fn function(_x: Box<SomeTrait>) {} LL + pub fn function(_x: Box<dyn SomeTrait>) {} - | + | warning: trait objects without an explicit `dyn` are deprecated --> $DIR/allowed-group-warn-by-default-lint.rs:10:25 @@ -25,7 +25,7 @@ help: use `dyn` | LL - pub fn function(_x: Box<SomeTrait>) {} LL + pub fn function(_x: Box<dyn SomeTrait>) {} - | + | warning: trait objects without an explicit `dyn` are deprecated --> $DIR/allowed-group-warn-by-default-lint.rs:10:25 @@ -39,7 +39,7 @@ help: use `dyn` | LL - pub fn function(_x: Box<SomeTrait>) {} LL + pub fn function(_x: Box<dyn SomeTrait>) {} - | + | warning: 3 warnings emitted diff --git a/src/test/ui/lint/force-warn/allowed-warn-by-default-lint.rs b/src/test/ui/lint/force-warn/allowed-warn-by-default-lint.rs index 4ac29ff7d99..06b37286776 100644 --- a/src/test/ui/lint/force-warn/allowed-warn-by-default-lint.rs +++ b/src/test/ui/lint/force-warn/allowed-warn-by-default-lint.rs @@ -6,6 +6,6 @@ #![allow(dead_code)] fn dead_function() {} -//~^ WARN function is never used +//~^ WARN function `dead_function` is never used fn main() {} diff --git a/src/test/ui/lint/force-warn/allowed-warn-by-default-lint.stderr b/src/test/ui/lint/force-warn/allowed-warn-by-default-lint.stderr index c46d7403fd0..a6634e212bd 100644 --- a/src/test/ui/lint/force-warn/allowed-warn-by-default-lint.stderr +++ b/src/test/ui/lint/force-warn/allowed-warn-by-default-lint.stderr @@ -1,4 +1,4 @@ -warning: function is never used: `dead_function` +warning: function `dead_function` is never used --> $DIR/allowed-warn-by-default-lint.rs:8:4 | LL | fn dead_function() {} diff --git a/src/test/ui/lint/force-warn/cap-lints-allow.stderr b/src/test/ui/lint/force-warn/cap-lints-allow.stderr index 90496ca7d20..978270872c4 100644 --- a/src/test/ui/lint/force-warn/cap-lints-allow.stderr +++ b/src/test/ui/lint/force-warn/cap-lints-allow.stderr @@ -11,7 +11,7 @@ help: use `dyn` | LL - pub fn function(_x: Box<SomeTrait>) {} LL + pub fn function(_x: Box<dyn SomeTrait>) {} - | + | warning: trait objects without an explicit `dyn` are deprecated --> $DIR/cap-lints-allow.rs:8:25 @@ -25,7 +25,7 @@ help: use `dyn` | LL - pub fn function(_x: Box<SomeTrait>) {} LL + pub fn function(_x: Box<dyn SomeTrait>) {} - | + | warning: trait objects without an explicit `dyn` are deprecated --> $DIR/cap-lints-allow.rs:8:25 @@ -39,7 +39,7 @@ help: use `dyn` | LL - pub fn function(_x: Box<SomeTrait>) {} LL + pub fn function(_x: Box<dyn SomeTrait>) {} - | + | warning: 3 warnings emitted diff --git a/src/test/ui/lint/force-warn/lint-group-allowed-cli-warn-by-default-lint.stderr b/src/test/ui/lint/force-warn/lint-group-allowed-cli-warn-by-default-lint.stderr index b6d36eaac44..6e67ebf2747 100644 --- a/src/test/ui/lint/force-warn/lint-group-allowed-cli-warn-by-default-lint.stderr +++ b/src/test/ui/lint/force-warn/lint-group-allowed-cli-warn-by-default-lint.stderr @@ -11,7 +11,7 @@ help: use `dyn` | LL - pub fn function(_x: Box<SomeTrait>) {} LL + pub fn function(_x: Box<dyn SomeTrait>) {} - | + | warning: trait objects without an explicit `dyn` are deprecated --> $DIR/lint-group-allowed-cli-warn-by-default-lint.rs:8:25 @@ -25,7 +25,7 @@ help: use `dyn` | LL - pub fn function(_x: Box<SomeTrait>) {} LL + pub fn function(_x: Box<dyn SomeTrait>) {} - | + | warning: trait objects without an explicit `dyn` are deprecated --> $DIR/lint-group-allowed-cli-warn-by-default-lint.rs:8:25 @@ -39,7 +39,7 @@ help: use `dyn` | LL - pub fn function(_x: Box<SomeTrait>) {} LL + pub fn function(_x: Box<dyn SomeTrait>) {} - | + | warning: 3 warnings emitted diff --git a/src/test/ui/lint/force-warn/lint-group-allowed-lint-group.stderr b/src/test/ui/lint/force-warn/lint-group-allowed-lint-group.stderr index e8fdaa72cc0..c5dea84b8f3 100644 --- a/src/test/ui/lint/force-warn/lint-group-allowed-lint-group.stderr +++ b/src/test/ui/lint/force-warn/lint-group-allowed-lint-group.stderr @@ -11,7 +11,7 @@ help: use `dyn` | LL - pub fn function(_x: Box<SomeTrait>) {} LL + pub fn function(_x: Box<dyn SomeTrait>) {} - | + | warning: trait objects without an explicit `dyn` are deprecated --> $DIR/lint-group-allowed-lint-group.rs:10:25 @@ -25,7 +25,7 @@ help: use `dyn` | LL - pub fn function(_x: Box<SomeTrait>) {} LL + pub fn function(_x: Box<dyn SomeTrait>) {} - | + | warning: trait objects without an explicit `dyn` are deprecated --> $DIR/lint-group-allowed-lint-group.rs:10:25 @@ -39,7 +39,7 @@ help: use `dyn` | LL - pub fn function(_x: Box<SomeTrait>) {} LL + pub fn function(_x: Box<dyn SomeTrait>) {} - | + | warning: 3 warnings emitted diff --git a/src/test/ui/lint/force-warn/lint-group-allowed-warn-by-default-lint.stderr b/src/test/ui/lint/force-warn/lint-group-allowed-warn-by-default-lint.stderr index 2de30d0c2f4..acd0c503d9c 100644 --- a/src/test/ui/lint/force-warn/lint-group-allowed-warn-by-default-lint.stderr +++ b/src/test/ui/lint/force-warn/lint-group-allowed-warn-by-default-lint.stderr @@ -11,7 +11,7 @@ help: use `dyn` | LL - pub fn function(_x: Box<SomeTrait>) {} LL + pub fn function(_x: Box<dyn SomeTrait>) {} - | + | warning: trait objects without an explicit `dyn` are deprecated --> $DIR/lint-group-allowed-warn-by-default-lint.rs:10:25 @@ -25,7 +25,7 @@ help: use `dyn` | LL - pub fn function(_x: Box<SomeTrait>) {} LL + pub fn function(_x: Box<dyn SomeTrait>) {} - | + | warning: trait objects without an explicit `dyn` are deprecated --> $DIR/lint-group-allowed-warn-by-default-lint.rs:10:25 @@ -39,7 +39,7 @@ help: use `dyn` | LL - pub fn function(_x: Box<SomeTrait>) {} LL + pub fn function(_x: Box<dyn SomeTrait>) {} - | + | warning: 3 warnings emitted diff --git a/src/test/ui/lint/force-warn/warn-by-default-lint-two-modules.rs b/src/test/ui/lint/force-warn/warn-by-default-lint-two-modules.rs index 267e7b45f0c..47a480ad708 100644 --- a/src/test/ui/lint/force-warn/warn-by-default-lint-two-modules.rs +++ b/src/test/ui/lint/force-warn/warn-by-default-lint-two-modules.rs @@ -7,12 +7,12 @@ mod one { #![allow(dead_code)] fn dead_function() {} - //~^ WARN function is never used + //~^ WARN function `dead_function` is never used } mod two { fn dead_function() {} - //~^ WARN function is never used + //~^ WARN function `dead_function` is never used } fn main() {} diff --git a/src/test/ui/lint/force-warn/warn-by-default-lint-two-modules.stderr b/src/test/ui/lint/force-warn/warn-by-default-lint-two-modules.stderr index 2a3cf85a1e3..824bcccc05f 100644 --- a/src/test/ui/lint/force-warn/warn-by-default-lint-two-modules.stderr +++ b/src/test/ui/lint/force-warn/warn-by-default-lint-two-modules.stderr @@ -1,4 +1,4 @@ -warning: function is never used: `dead_function` +warning: function `dead_function` is never used --> $DIR/warn-by-default-lint-two-modules.rs:9:8 | LL | fn dead_function() {} @@ -6,7 +6,7 @@ LL | fn dead_function() {} | = note: requested on the command line with `--force-warn dead-code` -warning: function is never used: `dead_function` +warning: function `dead_function` is never used --> $DIR/warn-by-default-lint-two-modules.rs:14:8 | LL | fn dead_function() {} diff --git a/src/test/ui/lint/issue-17718-const-naming.rs b/src/test/ui/lint/issue-17718-const-naming.rs index 7386478f9f0..d7f0e72769b 100644 --- a/src/test/ui/lint/issue-17718-const-naming.rs +++ b/src/test/ui/lint/issue-17718-const-naming.rs @@ -3,6 +3,6 @@ const foo: isize = 3; //~^ ERROR: should have an upper case name -//~^^ ERROR: constant is never used +//~^^ ERROR: constant `foo` is never used fn main() {} diff --git a/src/test/ui/lint/issue-17718-const-naming.stderr b/src/test/ui/lint/issue-17718-const-naming.stderr index a1fc99c9a3d..4c97f6d63d4 100644 --- a/src/test/ui/lint/issue-17718-const-naming.stderr +++ b/src/test/ui/lint/issue-17718-const-naming.stderr @@ -1,4 +1,4 @@ -error: constant is never used: `foo` +error: constant `foo` is never used --> $DIR/issue-17718-const-naming.rs:4:1 | LL | const foo: isize = 3; diff --git a/src/test/ui/issues/issue-35075.rs b/src/test/ui/lint/issue-35075.rs index 0e54131c245..0e54131c245 100644 --- a/src/test/ui/issues/issue-35075.rs +++ b/src/test/ui/lint/issue-35075.rs diff --git a/src/test/ui/issues/issue-35075.stderr b/src/test/ui/lint/issue-35075.stderr index 08bdaa72858..08bdaa72858 100644 --- a/src/test/ui/issues/issue-35075.stderr +++ b/src/test/ui/lint/issue-35075.stderr diff --git a/src/test/ui/lint/issue-80988.stderr b/src/test/ui/lint/issue-80988.stderr index deee267d0c6..1d397f43133 100644 --- a/src/test/ui/lint/issue-80988.stderr +++ b/src/test/ui/lint/issue-80988.stderr @@ -3,7 +3,7 @@ warning: deny(warnings) incompatible with previous forbid | LL | #![forbid(warnings)] | -------- `forbid` level set here -LL | +LL | LL | #[deny(warnings)] | ^^^^^^^^ overruled by previous forbid | @@ -16,7 +16,7 @@ warning: deny(warnings) incompatible with previous forbid | LL | #![forbid(warnings)] | -------- `forbid` level set here -LL | +LL | LL | #[deny(warnings)] | ^^^^^^^^ overruled by previous forbid | @@ -28,7 +28,7 @@ warning: deny(warnings) incompatible with previous forbid | LL | #![forbid(warnings)] | -------- `forbid` level set here -LL | +LL | LL | #[deny(warnings)] | ^^^^^^^^ overruled by previous forbid | diff --git a/src/test/ui/lint/lint-forbid-attr.stderr b/src/test/ui/lint/lint-forbid-attr.stderr index 48228c5dfdd..5977b9c949d 100644 --- a/src/test/ui/lint/lint-forbid-attr.stderr +++ b/src/test/ui/lint/lint-forbid-attr.stderr @@ -3,7 +3,7 @@ error[E0453]: allow(deprecated) incompatible with previous forbid | LL | #![forbid(deprecated)] | ---------- `forbid` level set here -LL | +LL | LL | #[allow(deprecated)] | ^^^^^^^^^^ overruled by previous forbid @@ -12,7 +12,7 @@ error[E0453]: allow(deprecated) incompatible with previous forbid | LL | #![forbid(deprecated)] | ---------- `forbid` level set here -LL | +LL | LL | #[allow(deprecated)] | ^^^^^^^^^^ overruled by previous forbid diff --git a/src/test/ui/lint/lint-incoherent-auto-trait-objects.stderr b/src/test/ui/lint/lint-incoherent-auto-trait-objects.stderr index 5308bba440e..afbab989676 100644 --- a/src/test/ui/lint/lint-incoherent-auto-trait-objects.stderr +++ b/src/test/ui/lint/lint-incoherent-auto-trait-objects.stderr @@ -3,7 +3,7 @@ error: conflicting implementations of trait `Foo` for type `(dyn std::marker::Se | LL | impl Foo for dyn Send {} | --------------------- first implementation here -LL | +LL | LL | impl Foo for dyn Send + Send {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(dyn std::marker::Send + 'static)` | @@ -16,7 +16,7 @@ error: conflicting implementations of trait `Foo` for type `(dyn std::marker::Se | LL | impl Foo for dyn Send + Sync {} | ---------------------------- first implementation here -LL | +LL | LL | impl Foo for dyn Sync + Send {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(dyn std::marker::Send + std::marker::Sync + 'static)` | diff --git a/src/test/ui/lint/lint-unnecessary-parens.stderr b/src/test/ui/lint/lint-unnecessary-parens.stderr index 1d5f9ebb5e5..e13620f06ce 100644 --- a/src/test/ui/lint/lint-unnecessary-parens.stderr +++ b/src/test/ui/lint/lint-unnecessary-parens.stderr @@ -13,7 +13,7 @@ help: remove these parentheses | LL - return (1); LL + return 1; - | + | error: unnecessary parentheses around `return` value --> $DIR/lint-unnecessary-parens.rs:16:12 @@ -25,7 +25,7 @@ help: remove these parentheses | LL - return (X { y }); LL + return X { y }; - | + | error: unnecessary parentheses around type --> $DIR/lint-unnecessary-parens.rs:19:46 @@ -37,7 +37,7 @@ help: remove these parentheses | LL - pub fn unused_parens_around_return_type() -> (u32) { LL + pub fn unused_parens_around_return_type() -> u32 { - | + | error: unnecessary parentheses around block return value --> $DIR/lint-unnecessary-parens.rs:25:9 @@ -49,7 +49,7 @@ help: remove these parentheses | LL - (5) LL + 5 - | + | error: unnecessary parentheses around block return value --> $DIR/lint-unnecessary-parens.rs:27:5 @@ -61,7 +61,7 @@ help: remove these parentheses | LL - (5) LL + 5 - | + | error: unnecessary parentheses around assigned value --> $DIR/lint-unnecessary-parens.rs:44:31 @@ -73,7 +73,7 @@ help: remove these parentheses | LL - pub const CONST_ITEM: usize = (10); LL + pub const CONST_ITEM: usize = 10; - | + | error: unnecessary parentheses around assigned value --> $DIR/lint-unnecessary-parens.rs:45:33 @@ -85,7 +85,7 @@ help: remove these parentheses | LL - pub static STATIC_ITEM: usize = (10); LL + pub static STATIC_ITEM: usize = 10; - | + | error: unnecessary parentheses around function argument --> $DIR/lint-unnecessary-parens.rs:49:9 @@ -97,7 +97,7 @@ help: remove these parentheses | LL - bar((true)); LL + bar(true); - | + | error: unnecessary parentheses around `if` condition --> $DIR/lint-unnecessary-parens.rs:51:8 @@ -109,7 +109,7 @@ help: remove these parentheses | LL - if (true) {} LL + if true {} - | + | error: unnecessary parentheses around `while` condition --> $DIR/lint-unnecessary-parens.rs:52:11 @@ -121,7 +121,7 @@ help: remove these parentheses | LL - while (true) {} LL + while true {} - | + | error: unnecessary parentheses around `match` scrutinee expression --> $DIR/lint-unnecessary-parens.rs:53:11 @@ -133,7 +133,7 @@ help: remove these parentheses | LL - match (true) { LL + match true { - | + | error: unnecessary parentheses around `let` scrutinee expression --> $DIR/lint-unnecessary-parens.rs:56:16 @@ -145,7 +145,7 @@ help: remove these parentheses | LL - if let 1 = (1) {} LL + if let 1 = 1 {} - | + | error: unnecessary parentheses around `let` scrutinee expression --> $DIR/lint-unnecessary-parens.rs:57:19 @@ -157,7 +157,7 @@ help: remove these parentheses | LL - while let 1 = (2) {} LL + while let 1 = 2 {} - | + | error: unnecessary parentheses around method argument --> $DIR/lint-unnecessary-parens.rs:73:24 @@ -169,7 +169,7 @@ help: remove these parentheses | LL - X { y: false }.foo((true)); LL + X { y: false }.foo(true); - | + | error: unnecessary parentheses around assigned value --> $DIR/lint-unnecessary-parens.rs:75:18 @@ -181,7 +181,7 @@ help: remove these parentheses | LL - let mut _a = (0); LL + let mut _a = 0; - | + | error: unnecessary parentheses around assigned value --> $DIR/lint-unnecessary-parens.rs:76:10 @@ -193,7 +193,7 @@ help: remove these parentheses | LL - _a = (0); LL + _a = 0; - | + | error: unnecessary parentheses around assigned value --> $DIR/lint-unnecessary-parens.rs:77:11 @@ -205,7 +205,7 @@ help: remove these parentheses | LL - _a += (1); LL + _a += 1; - | + | error: aborting due to 17 previous errors diff --git a/src/test/ui/lint/must_not_suspend/ref.stderr b/src/test/ui/lint/must_not_suspend/ref.stderr index 6d30f134ec4..5f000014c7d 100644 --- a/src/test/ui/lint/must_not_suspend/ref.stderr +++ b/src/test/ui/lint/must_not_suspend/ref.stderr @@ -3,7 +3,7 @@ error: `Umm` held across a suspend point, but should not be | LL | let guard = &mut self.u; | ^^^^^^ -LL | +LL | LL | other().await; | ------ the value is held across this suspend point | diff --git a/src/test/ui/lint/must_not_suspend/trait.stderr b/src/test/ui/lint/must_not_suspend/trait.stderr index dd3978b02a8..60369430a3e 100644 --- a/src/test/ui/lint/must_not_suspend/trait.stderr +++ b/src/test/ui/lint/must_not_suspend/trait.stderr @@ -23,7 +23,7 @@ error: boxed `Wow` trait object held across a suspend point, but should not be | LL | let _guard2 = r#dyn(); | ^^^^^^^ -LL | +LL | LL | other().await; | ------ the value is held across this suspend point | diff --git a/src/test/ui/lint/renamed-lints-still-apply.stderr b/src/test/ui/lint/renamed-lints-still-apply.stderr index 00ed5c89d4b..e926719bb6b 100644 --- a/src/test/ui/lint/renamed-lints-still-apply.stderr +++ b/src/test/ui/lint/renamed-lints-still-apply.stderr @@ -23,7 +23,7 @@ help: elide the single-use lifetime | LL - fn _foo<'a>(_x: &'a u32) {} LL + fn _foo(_x: &u32) {} - | + | error: aborting due to previous error; 1 warning emitted diff --git a/src/test/ui/lint/suggestions.stderr b/src/test/ui/lint/suggestions.stderr index 255772ff402..f4c0e2141b2 100644 --- a/src/test/ui/lint/suggestions.stderr +++ b/src/test/ui/lint/suggestions.stderr @@ -21,7 +21,7 @@ help: remove these parentheses | LL - let mut registry_no = (format!("NX-{}", 74205)); LL + let mut registry_no = format!("NX-{}", 74205); - | + | warning: variable does not need to be mutable --> $DIR/suggestions.rs:48:13 diff --git a/src/test/ui/lint/unused/issue-54538-unused-parens-lint.stderr b/src/test/ui/lint/unused/issue-54538-unused-parens-lint.stderr index 677b96d3f32..c73884663c8 100644 --- a/src/test/ui/lint/unused/issue-54538-unused-parens-lint.stderr +++ b/src/test/ui/lint/unused/issue-54538-unused-parens-lint.stderr @@ -13,7 +13,7 @@ help: remove these parentheses | LL - let (a) = 0; LL + let a = 0; - | + | error: unnecessary parentheses around pattern --> $DIR/issue-54538-unused-parens-lint.rs:17:9 @@ -25,7 +25,7 @@ help: remove these parentheses | LL - for (a) in 0..1 {} LL + for a in 0..1 {} - | + | error: unnecessary parentheses around pattern --> $DIR/issue-54538-unused-parens-lint.rs:18:12 @@ -37,7 +37,7 @@ help: remove these parentheses | LL - if let (a) = 0 {} LL + if let a = 0 {} - | + | error: unnecessary parentheses around pattern --> $DIR/issue-54538-unused-parens-lint.rs:19:15 @@ -49,7 +49,7 @@ help: remove these parentheses | LL - while let (a) = 0 {} LL + while let a = 0 {} - | + | error: unnecessary parentheses around pattern --> $DIR/issue-54538-unused-parens-lint.rs:20:12 @@ -61,7 +61,7 @@ help: remove these parentheses | LL - fn foo((a): u8) {} LL + fn foo(a: u8) {} - | + | error: unnecessary parentheses around pattern --> $DIR/issue-54538-unused-parens-lint.rs:21:14 @@ -73,7 +73,7 @@ help: remove these parentheses | LL - let _ = |(a): u8| 0; LL + let _ = |a: u8| 0; - | + | error: unnecessary parentheses around pattern --> $DIR/issue-54538-unused-parens-lint.rs:49:12 @@ -85,7 +85,7 @@ help: remove these parentheses | LL - if let (0 | 1) = 0 {} LL + if let 0 | 1 = 0 {} - | + | error: unnecessary parentheses around pattern --> $DIR/issue-54538-unused-parens-lint.rs:50:13 @@ -97,7 +97,7 @@ help: remove these parentheses | LL - if let ((0 | 1),) = (0,) {} LL + if let (0 | 1,) = (0,) {} - | + | error: unnecessary parentheses around pattern --> $DIR/issue-54538-unused-parens-lint.rs:51:13 @@ -109,7 +109,7 @@ help: remove these parentheses | LL - if let [(0 | 1)] = [0] {} LL + if let [0 | 1] = [0] {} - | + | error: unnecessary parentheses around pattern --> $DIR/issue-54538-unused-parens-lint.rs:52:16 @@ -121,7 +121,7 @@ help: remove these parentheses | LL - if let 0 | (1 | 2) = 0 {} LL + if let 0 | 1 | 2 = 0 {} - | + | error: unnecessary parentheses around pattern --> $DIR/issue-54538-unused-parens-lint.rs:54:15 @@ -133,7 +133,7 @@ help: remove these parentheses | LL - if let TS((0 | 1)) = TS(0) {} LL + if let TS(0 | 1) = TS(0) {} - | + | error: unnecessary parentheses around pattern --> $DIR/issue-54538-unused-parens-lint.rs:56:20 @@ -145,7 +145,7 @@ help: remove these parentheses | LL - if let NS { f: (0 | 1) } = (NS { f: 0 }) {} LL + if let NS { f: 0 | 1 } = (NS { f: 0 }) {} - | + | error: unnecessary parentheses around pattern --> $DIR/issue-54538-unused-parens-lint.rs:66:9 @@ -157,7 +157,7 @@ help: remove these parentheses | LL - (_) => {} LL + _ => {} - | + | error: unnecessary parentheses around pattern --> $DIR/issue-54538-unused-parens-lint.rs:67:9 @@ -169,7 +169,7 @@ help: remove these parentheses | LL - (y) => {} LL + y => {} - | + | error: unnecessary parentheses around pattern --> $DIR/issue-54538-unused-parens-lint.rs:68:9 @@ -181,7 +181,7 @@ help: remove these parentheses | LL - (ref r) => {} LL + ref r => {} - | + | error: unnecessary parentheses around pattern --> $DIR/issue-54538-unused-parens-lint.rs:69:9 @@ -193,7 +193,7 @@ help: remove these parentheses | LL - (e @ 1...2) => {} LL + e @ 1...2 => {} - | + | error: unnecessary parentheses around pattern --> $DIR/issue-54538-unused-parens-lint.rs:75:9 @@ -205,7 +205,7 @@ help: remove these parentheses | LL - (e @ &(1...2)) => {} LL + e @ &(1...2) => {} - | + | error: unnecessary parentheses around pattern --> $DIR/issue-54538-unused-parens-lint.rs:76:10 @@ -217,7 +217,7 @@ help: remove these parentheses | LL - &(_) => {} LL + &_ => {} - | + | error: unnecessary parentheses around pattern --> $DIR/issue-54538-unused-parens-lint.rs:87:9 @@ -229,7 +229,7 @@ help: remove these parentheses | LL - (_) => {} LL + _ => {} - | + | error: unnecessary parentheses around pattern --> $DIR/issue-54538-unused-parens-lint.rs:88:9 @@ -241,7 +241,7 @@ help: remove these parentheses | LL - (y) => {} LL + y => {} - | + | error: unnecessary parentheses around pattern --> $DIR/issue-54538-unused-parens-lint.rs:89:9 @@ -253,7 +253,7 @@ help: remove these parentheses | LL - (ref r) => {} LL + ref r => {} - | + | error: unnecessary parentheses around pattern --> $DIR/issue-54538-unused-parens-lint.rs:90:9 @@ -265,7 +265,7 @@ help: remove these parentheses | LL - (e @ 1..=2) => {} LL + e @ 1..=2 => {} - | + | error: unnecessary parentheses around pattern --> $DIR/issue-54538-unused-parens-lint.rs:96:9 @@ -277,7 +277,7 @@ help: remove these parentheses | LL - (e @ &(1..=2)) => {} LL + e @ &(1..=2) => {} - | + | error: unnecessary parentheses around pattern --> $DIR/issue-54538-unused-parens-lint.rs:97:10 @@ -289,7 +289,7 @@ help: remove these parentheses | LL - &(_) => {} LL + &_ => {} - | + | error: aborting due to 24 previous errors diff --git a/src/test/ui/lint/unused/issue-74883-unused-paren-baren-yield.stderr b/src/test/ui/lint/unused/issue-74883-unused-paren-baren-yield.stderr index a715093df4c..3f1fee332be 100644 --- a/src/test/ui/lint/unused/issue-74883-unused-paren-baren-yield.stderr +++ b/src/test/ui/lint/unused/issue-74883-unused-paren-baren-yield.stderr @@ -13,7 +13,7 @@ help: remove these parentheses | LL - while let Some(_) = ({yield}) {} LL + while let Some(_) = {yield} {} - | + | error: unnecessary parentheses around `let` scrutinee expression --> $DIR/issue-74883-unused-paren-baren-yield.rs:15:29 @@ -25,7 +25,7 @@ help: remove these parentheses | LL - while let Some(_) = ((yield)) {} LL + while let Some(_) = (yield) {} - | + | error: unnecessary braces around block return value --> $DIR/issue-74883-unused-paren-baren-yield.rs:16:10 @@ -42,7 +42,7 @@ help: remove these braces | LL - {{yield}}; LL + {yield}; - | + | error: unnecessary parentheses around block return value --> $DIR/issue-74883-unused-paren-baren-yield.rs:17:10 @@ -54,7 +54,7 @@ help: remove these parentheses | LL - {( yield )}; LL + {yield}; - | + | error: unnecessary parentheses around block return value --> $DIR/issue-74883-unused-paren-baren-yield.rs:18:30 @@ -66,7 +66,7 @@ help: remove these parentheses | LL - while let Some(_) = {(yield)} {} LL + while let Some(_) = {yield} {} - | + | error: unnecessary braces around block return value --> $DIR/issue-74883-unused-paren-baren-yield.rs:19:30 @@ -78,7 +78,7 @@ help: remove these braces | LL - while let Some(_) = {{yield}} {} LL + while let Some(_) = {yield} {} - | + | error: aborting due to 6 previous errors diff --git a/src/test/ui/lint/unused/issue-90807-unused-paren-error.stderr b/src/test/ui/lint/unused/issue-90807-unused-paren-error.stderr index 4e158e126ac..b3b809d5f42 100644 --- a/src/test/ui/lint/unused/issue-90807-unused-paren-error.stderr +++ b/src/test/ui/lint/unused/issue-90807-unused-paren-error.stderr @@ -13,7 +13,7 @@ help: remove these parentheses | LL - for _ in (1..loop { break 2 }) {} LL + for _ in 1..loop { break 2 } {} - | + | error: unnecessary parentheses around `for` iterator expression --> $DIR/issue-90807-unused-paren-error.rs:8:14 @@ -25,7 +25,7 @@ help: remove these parentheses | LL - for _ in (1..match () { () => 2 }) {} LL + for _ in 1..match () { () => 2 } {} - | + | error: aborting due to 2 previous errors diff --git a/src/test/ui/lint/unused/unused-attr-doc-hidden.fixed b/src/test/ui/lint/unused/unused-attr-doc-hidden.fixed deleted file mode 100644 index 362ad55707a..00000000000 --- a/src/test/ui/lint/unused/unused-attr-doc-hidden.fixed +++ /dev/null @@ -1,55 +0,0 @@ -#![feature(inherent_associated_types)] -#![allow(dead_code, incomplete_features)] -#![crate_type = "lib"] -#![deny(unused_attributes)] -// run-rustfix - -pub trait Trait { - type It; - const IT: (); - fn it0(); - fn it1(); - fn it2(); -} - -pub struct Implementor; - -impl Implementor { - #[doc(hidden)] // no error - type Inh = (); - - #[doc(hidden)] // no error - const INH: () = (); - - #[doc(hidden)] // no error - fn inh() {} -} - -impl Trait for Implementor { - - type It = (); - //~^^ ERROR `#[doc(hidden)]` is ignored - //~| WARNING this was previously accepted - - - const IT: () = (); - //~^^ ERROR `#[doc(hidden)]` is ignored - //~| WARNING this was previously accepted - - #[doc(alias = "aka")] - fn it0() {} - //~^^ ERROR `#[doc(hidden)]` is ignored - //~| WARNING this was previously accepted - - #[doc(alias = "this", )] - fn it1() {} - //~^^ ERROR `#[doc(hidden)]` is ignored - //~| WARNING this was previously accepted - - #[doc()] - fn it2() {} - //~^^ ERROR `#[doc(hidden)]` is ignored - //~| WARNING this was previously accepted - //~| ERROR `#[doc(hidden)]` is ignored - //~| WARNING this was previously accepted -} diff --git a/src/test/ui/lint/unused/unused-attr-doc-hidden.rs b/src/test/ui/lint/unused/unused-attr-doc-hidden.rs deleted file mode 100644 index d493ed6dae2..00000000000 --- a/src/test/ui/lint/unused/unused-attr-doc-hidden.rs +++ /dev/null @@ -1,55 +0,0 @@ -#![feature(inherent_associated_types)] -#![allow(dead_code, incomplete_features)] -#![crate_type = "lib"] -#![deny(unused_attributes)] -// run-rustfix - -pub trait Trait { - type It; - const IT: (); - fn it0(); - fn it1(); - fn it2(); -} - -pub struct Implementor; - -impl Implementor { - #[doc(hidden)] // no error - type Inh = (); - - #[doc(hidden)] // no error - const INH: () = (); - - #[doc(hidden)] // no error - fn inh() {} -} - -impl Trait for Implementor { - #[doc(hidden)] - type It = (); - //~^^ ERROR `#[doc(hidden)]` is ignored - //~| WARNING this was previously accepted - - #[doc(hidden)] - const IT: () = (); - //~^^ ERROR `#[doc(hidden)]` is ignored - //~| WARNING this was previously accepted - - #[doc(hidden, alias = "aka")] - fn it0() {} - //~^^ ERROR `#[doc(hidden)]` is ignored - //~| WARNING this was previously accepted - - #[doc(alias = "this", hidden,)] - fn it1() {} - //~^^ ERROR `#[doc(hidden)]` is ignored - //~| WARNING this was previously accepted - - #[doc(hidden, hidden)] - fn it2() {} - //~^^ ERROR `#[doc(hidden)]` is ignored - //~| WARNING this was previously accepted - //~| ERROR `#[doc(hidden)]` is ignored - //~| WARNING this was previously accepted -} diff --git a/src/test/ui/lint/unused/unused-attr-doc-hidden.stderr b/src/test/ui/lint/unused/unused-attr-doc-hidden.stderr deleted file mode 100644 index f167bd460db..00000000000 --- a/src/test/ui/lint/unused/unused-attr-doc-hidden.stderr +++ /dev/null @@ -1,67 +0,0 @@ -error: `#[doc(hidden)]` is ignored on trait impl items - --> $DIR/unused-attr-doc-hidden.rs:29:5 - | -LL | #[doc(hidden)] - | ^^^^^^^^^^^^^^ help: remove this attribute - | -note: the lint level is defined here - --> $DIR/unused-attr-doc-hidden.rs:4:9 - | -LL | #![deny(unused_attributes)] - | ^^^^^^^^^^^^^^^^^ - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: whether the impl item is `doc(hidden)` or not entirely depends on the corresponding trait item - -error: `#[doc(hidden)]` is ignored on trait impl items - --> $DIR/unused-attr-doc-hidden.rs:34:5 - | -LL | #[doc(hidden)] - | ^^^^^^^^^^^^^^ help: remove this attribute - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: whether the impl item is `doc(hidden)` or not entirely depends on the corresponding trait item - -error: `#[doc(hidden)]` is ignored on trait impl items - --> $DIR/unused-attr-doc-hidden.rs:39:11 - | -LL | #[doc(hidden, alias = "aka")] - | ^^^^^^-- - | | - | help: remove this attribute - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: whether the impl item is `doc(hidden)` or not entirely depends on the corresponding trait item - -error: `#[doc(hidden)]` is ignored on trait impl items - --> $DIR/unused-attr-doc-hidden.rs:44:27 - | -LL | #[doc(alias = "this", hidden,)] - | ^^^^^^- - | | - | help: remove this attribute - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: whether the impl item is `doc(hidden)` or not entirely depends on the corresponding trait item - -error: `#[doc(hidden)]` is ignored on trait impl items - --> $DIR/unused-attr-doc-hidden.rs:49:11 - | -LL | #[doc(hidden, hidden)] - | ^^^^^^-- - | | - | help: remove this attribute - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: whether the impl item is `doc(hidden)` or not entirely depends on the corresponding trait item - -error: `#[doc(hidden)]` is ignored on trait impl items - --> $DIR/unused-attr-doc-hidden.rs:49:19 - | -LL | #[doc(hidden, hidden)] - | ^^^^^^ help: remove this attribute - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: whether the impl item is `doc(hidden)` or not entirely depends on the corresponding trait item - -error: aborting due to 6 previous errors - diff --git a/src/test/ui/lint/unused_braces.stderr b/src/test/ui/lint/unused_braces.stderr index 7d6fef00ac1..7773f44ea2d 100644 --- a/src/test/ui/lint/unused_braces.stderr +++ b/src/test/ui/lint/unused_braces.stderr @@ -13,7 +13,7 @@ help: remove these parentheses | LL - let _ = (7); LL + let _ = 7; - | + | warning: unnecessary braces around `if` condition --> $DIR/unused_braces.rs:26:8 @@ -30,7 +30,7 @@ help: remove these braces | LL - if { true } { LL + if true { - | + | warning: unnecessary braces around `while` condition --> $DIR/unused_braces.rs:30:11 @@ -42,7 +42,7 @@ help: remove these braces | LL - while { false } { LL + while false { - | + | warning: unnecessary braces around const expression --> $DIR/unused_braces.rs:34:17 @@ -54,7 +54,7 @@ help: remove these braces | LL - let _: [u8; { 3 }]; LL + let _: [u8; 3]; - | + | warning: unnecessary braces around function argument --> $DIR/unused_braces.rs:37:13 @@ -66,7 +66,7 @@ help: remove these braces | LL - consume({ 7 }); LL + consume(7); - | + | warning: 5 warnings emitted diff --git a/src/test/ui/lint/unused_braces_borrow.stderr b/src/test/ui/lint/unused_braces_borrow.stderr index 5a5326cab3b..05f7432b8ab 100644 --- a/src/test/ui/lint/unused_braces_borrow.stderr +++ b/src/test/ui/lint/unused_braces_borrow.stderr @@ -13,7 +13,7 @@ help: remove these braces | LL - consume({ a.b }); LL + consume(a.b); - | + | warning: 1 warning emitted diff --git a/src/test/ui/lint/unused_parens_json_suggestion.stderr b/src/test/ui/lint/unused_parens_json_suggestion.stderr index 169fb824021..ea19e0cdc0c 100644 --- a/src/test/ui/lint/unused_parens_json_suggestion.stderr +++ b/src/test/ui/lint/unused_parens_json_suggestion.stderr @@ -13,7 +13,7 @@ help: remove these parentheses | LL - let _a = (1 / (2 + 3)); LL + let _a = 1 / (2 + 3); - | + | "} {"message":"aborting due to previous error","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to previous error diff --git a/src/test/ui/lint/unused_parens_remove_json_suggestion.stderr b/src/test/ui/lint/unused_parens_remove_json_suggestion.stderr index 43367aaa911..f4c6ceaf1dc 100644 --- a/src/test/ui/lint/unused_parens_remove_json_suggestion.stderr +++ b/src/test/ui/lint/unused_parens_remove_json_suggestion.stderr @@ -13,7 +13,7 @@ help: remove these parentheses | LL - if (_b) { LL + if _b { - | + | "} {"message":"unnecessary parentheses around `if` condition","code":{"code":"unused_parens","explanation":null},"level":"error","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":612,"byte_end":613,"line_start":28,"line_end":28,"column_start":7,"column_end":8,"is_primary":true,"text":[{"text":" if(c) { @@ -26,7 +26,7 @@ help: remove these parentheses | LL - if(c) { LL + if c { - | + | "} {"message":"unnecessary parentheses around `if` condition","code":{"code":"unused_parens","explanation":null},"level":"error","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":692,"byte_end":693,"line_start":32,"line_end":32,"column_start":8,"column_end":9,"is_primary":true,"text":[{"text":" if (c){ @@ -39,7 +39,7 @@ help: remove these parentheses | LL - if (c){ LL + if c { - | + | "} {"message":"unnecessary parentheses around `while` condition","code":{"code":"unused_parens","explanation":null},"level":"error","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":774,"byte_end":775,"line_start":36,"line_end":36,"column_start":11,"column_end":12,"is_primary":true,"text":[{"text":" while (false && true){","highlight_start":11,"highlight_end":12}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":788,"byte_end":789,"line_start":36,"line_end":36,"column_start":25,"column_end":26,"is_primary":true,"text":[{"text":" while (false && true){","highlight_start":25,"highlight_end":26}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"remove these parentheses","code":null,"level":"help","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":774,"byte_end":775,"line_start":36,"line_end":36,"column_start":11,"column_end":12,"is_primary":true,"text":[{"text":" while (false && true){","highlight_start":11,"highlight_end":12}],"label":null,"suggested_replacement":"","suggestion_applicability":"MachineApplicable","expansion":null},{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":788,"byte_end":789,"line_start":36,"line_end":36,"column_start":25,"column_end":26,"is_primary":true,"text":[{"text":" while (false && true){","highlight_start":25,"highlight_end":26}],"label":null,"suggested_replacement":" ","suggestion_applicability":"MachineApplicable","expansion":null}],"children":[],"rendered":null}],"rendered":"error: unnecessary parentheses around `while` condition @@ -52,7 +52,7 @@ help: remove these parentheses | LL - while (false && true){ LL + while false && true { - | + | "} {"message":"unnecessary parentheses around `if` condition","code":{"code":"unused_parens","explanation":null},"level":"error","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":802,"byte_end":803,"line_start":37,"line_end":37,"column_start":12,"column_end":13,"is_primary":true,"text":[{"text":" if (c) { @@ -65,7 +65,7 @@ help: remove these parentheses | LL - if (c) { LL + if c { - | + | "} {"message":"unnecessary parentheses around `while` condition","code":{"code":"unused_parens","explanation":null},"level":"error","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":899,"byte_end":900,"line_start":43,"line_end":43,"column_start":10,"column_end":11,"is_primary":true,"text":[{"text":" while(true && false) { @@ -78,7 +78,7 @@ help: remove these parentheses | LL - while(true && false) { LL + while true && false { - | + | "} {"message":"unnecessary parentheses around `for` iterator expression","code":{"code":"unused_parens","explanation":null},"level":"error","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":968,"byte_end":969,"line_start":44,"line_end":44,"column_start":18,"column_end":19,"is_primary":true,"text":[{"text":" for _ in (0 .. 3){ @@ -91,7 +91,7 @@ help: remove these parentheses | LL - for _ in (0 .. 3){ LL + for _ in 0 .. 3 { - | + | "} {"message":"unnecessary parentheses around `for` iterator expression","code":{"code":"unused_parens","explanation":null},"level":"error","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":1069,"byte_end":1070,"line_start":49,"line_end":49,"column_start":14,"column_end":15,"is_primary":true,"text":[{"text":" for _ in (0 .. 3) { @@ -104,7 +104,7 @@ help: remove these parentheses | LL - for _ in (0 .. 3) { LL + for _ in 0 .. 3 { - | + | "} {"message":"unnecessary parentheses around `while` condition","code":{"code":"unused_parens","explanation":null},"level":"error","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":1128,"byte_end":1129,"line_start":50,"line_end":50,"column_start":15,"column_end":16,"is_primary":true,"text":[{"text":" while (true && false) { @@ -117,7 +117,7 @@ help: remove these parentheses | LL - while (true && false) { LL + while true && false { - | + | "} {"message":"aborting due to 9 previous errors","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to 9 previous errors diff --git a/src/test/ui/liveness/liveness-use-after-move.stderr b/src/test/ui/liveness/liveness-use-after-move.stderr index df54af9f0f2..f7d131109ea 100644 --- a/src/test/ui/liveness/liveness-use-after-move.stderr +++ b/src/test/ui/liveness/liveness-use-after-move.stderr @@ -5,7 +5,7 @@ LL | let x: Box<_> = 5.into(); | - move occurs because `x` has type `Box<i32>`, which does not implement the `Copy` trait LL | let y = x; | - value moved here -LL | +LL | LL | println!("{}", *x); | ^^ value borrowed here after move | diff --git a/src/test/ui/lub-glb/empty-binder-future-compat.rs b/src/test/ui/lub-glb/empty-binder-future-compat.rs new file mode 100644 index 00000000000..8700a88a36e --- /dev/null +++ b/src/test/ui/lub-glb/empty-binder-future-compat.rs @@ -0,0 +1,22 @@ +// check-pass +fn lt_in_fn_fn<'a: 'a>() -> fn(fn(&'a ())) { + |_| () +} + + +fn foo<'a, 'b, 'lower>(v: bool) +where + 'a: 'lower, + 'b: 'lower, +{ + // if we infer `x` to be higher ranked in the future, + // this would cause a type error. + let x = match v { + true => lt_in_fn_fn::<'a>(), + false => lt_in_fn_fn::<'b>(), + }; + + let _: fn(fn(&'lower())) = x; +} + +fn main() {} diff --git a/src/test/ui/lub-glb/empty-binders-err.rs b/src/test/ui/lub-glb/empty-binders-err.rs new file mode 100644 index 00000000000..557480173ee --- /dev/null +++ b/src/test/ui/lub-glb/empty-binders-err.rs @@ -0,0 +1,55 @@ +fn lt<'a: 'a>() -> &'a () { + &() +} + +fn lt_in_fn<'a: 'a>() -> fn(&'a ()) { + |_| () +} + +struct Contra<'a>(fn(&'a ())); +fn lt_in_contra<'a: 'a>() -> Contra<'a> { + Contra(|_| ()) +} + +fn covariance<'a, 'b, 'upper>(v: bool) +where + 'upper: 'a, + 'upper: 'b, + +{ + let _: &'upper () = match v { + //~^ ERROR lifetime may not live long enough + //~| ERROR lifetime may not live long enough + true => lt::<'a>(), + false => lt::<'b>(), + }; +} + +fn contra_fn<'a, 'b, 'lower>(v: bool) +where + 'a: 'lower, + 'b: 'lower, + +{ + + let _: fn(&'lower ()) = match v { + //~^ ERROR lifetime may not live long enough + true => lt_in_fn::<'a>(), + false => lt_in_fn::<'b>(), + }; +} + +fn contra_struct<'a, 'b, 'lower>(v: bool) +where + 'a: 'lower, + 'b: 'lower, + +{ + let _: Contra<'lower> = match v { + //~^ ERROR lifetime may not live long enough + true => lt_in_contra::<'a>(), + false => lt_in_contra::<'b>(), + }; +} + +fn main() {} diff --git a/src/test/ui/lub-glb/empty-binders-err.stderr b/src/test/ui/lub-glb/empty-binders-err.stderr new file mode 100644 index 00000000000..f86f22d5e40 --- /dev/null +++ b/src/test/ui/lub-glb/empty-binders-err.stderr @@ -0,0 +1,59 @@ +error: lifetime may not live long enough + --> $DIR/empty-binders-err.rs:20:12 + | +LL | fn covariance<'a, 'b, 'upper>(v: bool) + | -- ------ lifetime `'upper` defined here + | | + | lifetime `'a` defined here +... +LL | let _: &'upper () = match v { + | ^^^^^^^^^^ type annotation requires that `'a` must outlive `'upper` + | + = help: consider adding the following bound: `'a: 'upper` + +error: lifetime may not live long enough + --> $DIR/empty-binders-err.rs:20:12 + | +LL | fn covariance<'a, 'b, 'upper>(v: bool) + | -- ------ lifetime `'upper` defined here + | | + | lifetime `'b` defined here +... +LL | let _: &'upper () = match v { + | ^^^^^^^^^^ type annotation requires that `'b` must outlive `'upper` + | + = help: consider adding the following bound: `'b: 'upper` + +help: the following changes may resolve your lifetime errors + | + = help: add bound `'a: 'upper` + = help: add bound `'b: 'upper` + +error: lifetime may not live long enough + --> $DIR/empty-binders-err.rs:35:12 + | +LL | fn contra_fn<'a, 'b, 'lower>(v: bool) + | -- ------ lifetime `'lower` defined here + | | + | lifetime `'a` defined here +... +LL | let _: fn(&'lower ()) = match v { + | ^^^^^^^^^^^^^^ type annotation requires that `'lower` must outlive `'a` + | + = help: consider adding the following bound: `'lower: 'a` + +error: lifetime may not live long enough + --> $DIR/empty-binders-err.rs:48:12 + | +LL | fn contra_struct<'a, 'b, 'lower>(v: bool) + | -- ------ lifetime `'lower` defined here + | | + | lifetime `'a` defined here +... +LL | let _: Contra<'lower> = match v { + | ^^^^^^^^^^^^^^ type annotation requires that `'lower` must outlive `'a` + | + = help: consider adding the following bound: `'lower: 'a` + +error: aborting due to 4 previous errors + diff --git a/src/test/ui/lub-glb/empty-binders.rs b/src/test/ui/lub-glb/empty-binders.rs new file mode 100644 index 00000000000..f9d07e79fda --- /dev/null +++ b/src/test/ui/lub-glb/empty-binders.rs @@ -0,0 +1,45 @@ +// check-pass +// +// Check that computing the lub works even for empty binders. +fn lt<'a: 'a>() -> &'a () { + &() +} + +fn lt_in_fn<'a: 'a>() -> fn(&'a ()) { + |_| () +} + +struct Contra<'a>(fn(&'a ())); +fn lt_in_contra<'a: 'a>() -> Contra<'a> { + Contra(|_| ()) +} + +fn ok<'a, 'b, 'upper, 'lower>(v: bool) +where + 'upper: 'a, + 'upper: 'b, + 'a: 'lower, + 'b: 'lower, + +{ + let _: &'lower () = match v { + true => lt::<'a>(), + false => lt::<'b>(), + }; + + // This errored in the past because LUB and GLB always + // bailed out when encountering binders, even if they were + // empty. + let _: fn(&'upper ()) = match v { + true => lt_in_fn::<'a>(), + false => lt_in_fn::<'b>(), + }; + + // This was already accepted, as relate didn't encounter any binders. + let _: Contra<'upper> = match v { + true => lt_in_contra::<'a>(), + false => lt_in_contra::<'b>(), + }; +} + +fn main() {} diff --git a/src/test/ui/issues/issue-8851.rs b/src/test/ui/macros/issue-8851.rs index faacfe5f895..faacfe5f895 100644 --- a/src/test/ui/issues/issue-8851.rs +++ b/src/test/ui/macros/issue-8851.rs diff --git a/src/test/ui/macros/macro-outer-attributes.stderr b/src/test/ui/macros/macro-outer-attributes.stderr index 91073d3698d..4ea760ab82b 100644 --- a/src/test/ui/macros/macro-outer-attributes.stderr +++ b/src/test/ui/macros/macro-outer-attributes.stderr @@ -12,7 +12,7 @@ help: if you import `bar`, refer to it directly | LL - a::bar(); LL + bar(); - | + | error: aborting due to previous error diff --git a/src/test/ui/macros/rfc-2011-nicer-assert-messages/all-expr-kinds.rs b/src/test/ui/macros/rfc-2011-nicer-assert-messages/all-expr-kinds.rs index c0e9f29fdbc..f538ec64390 100644 --- a/src/test/ui/macros/rfc-2011-nicer-assert-messages/all-expr-kinds.rs +++ b/src/test/ui/macros/rfc-2011-nicer-assert-messages/all-expr-kinds.rs @@ -55,14 +55,56 @@ struct Foo { bar: i32 } +impl Foo { + fn add(&self, a: i32, b: i32) -> i32 { a + b } +} + +fn add(a: i32, b: i32) -> i32 { a + b } + fn main() { // ***** Allowed ***** tests!( let mut elem = 1i32; + // addr of + [ &elem == &3 ] => "Assertion failed: &elem == &3\nWith captures:\n elem = 1\n" + + // array + [ [elem][0] == 3 ] => "Assertion failed: [elem][0] == 3\nWith captures:\n elem = 1\n" + // binary [ elem + 1 == 3 ] => "Assertion failed: elem + 1 == 3\nWith captures:\n elem = 1\n" + + // call + [ add(elem, elem) == 3 ] => "Assertion failed: add(elem, elem) == 3\nWith captures:\n elem = 1\n" + + // cast + [ elem as i32 == 3 ] => "Assertion failed: elem as i32 == 3\nWith captures:\n elem = 1\n" + + // index + [ [1i32, 1][elem as usize] == 3 ] => "Assertion failed: [1i32, 1][elem as usize] == 3\nWith captures:\n elem = 1\n" + + // method call + [ FOO.add(elem, elem) == 3 ] => "Assertion failed: FOO.add(elem, elem) == 3\nWith captures:\n elem = 1\n" + + // paren + [ (elem) == 3 ] => "Assertion failed: (elem) == 3\nWith captures:\n elem = 1\n" + + // range + [ (0..elem) == (0..3) ] => "Assertion failed: (0..elem) == (0..3)\nWith captures:\n elem = 1\n" + + // repeat + [ [elem; 1] == [3; 1] ] => "Assertion failed: [elem; 1] == [3; 1]\nWith captures:\n elem = 1\n" + + // struct + [ Foo { bar: elem } == Foo { bar: 3 } ] => "Assertion failed: Foo { bar: elem } == Foo { bar: 3 }\nWith captures:\n elem = 1\n" + + // tuple + [ (elem, 1) == (3, 3) ] => "Assertion failed: (elem, 1) == (3, 3)\nWith captures:\n elem = 1\n" + + // unary + [ -elem == -3 ] => "Assertion failed: -elem == -3\nWith captures:\n elem = 1\n" ); // ***** Disallowed ***** diff --git a/src/test/ui/issues/issue-46920-byte-array-patterns.rs b/src/test/ui/match/issue-46920-byte-array-patterns.rs index 2a8b4bb4922..2a8b4bb4922 100644 --- a/src/test/ui/issues/issue-46920-byte-array-patterns.rs +++ b/src/test/ui/match/issue-46920-byte-array-patterns.rs diff --git a/src/test/ui/match/match-tag-nullary.stderr b/src/test/ui/match/match-tag-nullary.stderr index 723c7fa92b1..a6add31d1c5 100644 --- a/src/test/ui/match/match-tag-nullary.stderr +++ b/src/test/ui/match/match-tag-nullary.stderr @@ -3,7 +3,7 @@ error[E0308]: mismatched types | LL | enum B { B } | - unit variant defined here -LL | +LL | LL | fn main() { let x: A = A::A; match x { B::B => { } } } | - ^^^^ expected enum `A`, found enum `B` | | diff --git a/src/test/ui/methods/method-call-err-msg.stderr b/src/test/ui/methods/method-call-err-msg.stderr index 53e582f7f13..95edee6ad23 100644 --- a/src/test/ui/methods/method-call-err-msg.stderr +++ b/src/test/ui/methods/method-call-err-msg.stderr @@ -27,8 +27,8 @@ LL | fn one(self, _: isize) -> Foo { self } | ^^^ ---- -------- help: provide the argument | -LL | .one({isize}) - | ~~~~~~~~~~~~ +LL | .one(/* isize */) + | ~~~~~~~~~~~~~~~~ error[E0061]: this function takes 2 arguments but 1 argument was supplied --> $DIR/method-call-err-msg.rs:15:7 @@ -43,8 +43,8 @@ LL | fn two(self, _: isize, _: isize) -> Foo { self } | ^^^ ---- -------- -------- help: provide the argument | -LL | .two(0, {isize}); - | ~~~~~~~~~~~~~~~ +LL | .two(0, /* isize */); + | ~~~~~~~~~~~~~~~~~~~ error[E0599]: `Foo` is not an iterator --> $DIR/method-call-err-msg.rs:19:7 @@ -89,8 +89,8 @@ LL | fn three<T>(self, _: T, _: T, _: T) -> Foo { self } | ^^^^^ ---- ---- ---- ---- help: provide the arguments | -LL | y.three::<usize>({usize}, {usize}, {usize}); - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL | y.three::<usize>(/* usize */, /* usize */, /* usize */); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 5 previous errors diff --git a/src/test/ui/mir/ssa-analysis-regression-50041.rs b/src/test/ui/mir/ssa-analysis-regression-50041.rs index 8c382ff0558..8e9c14a03c3 100644 --- a/src/test/ui/mir/ssa-analysis-regression-50041.rs +++ b/src/test/ui/mir/ssa-analysis-regression-50041.rs @@ -1,27 +1,29 @@ // build-pass // compile-flags: -Z mir-opt-level=4 -#![crate_type="lib"] +#![crate_type = "lib"] #![feature(lang_items)] #![no_std] +struct NonNull<T: ?Sized>(*mut T); + +struct Unique<T: ?Sized>(NonNull<T>); + #[lang = "owned_box"] -pub struct Box<T: ?Sized>(*mut T, ()); +pub struct Box<T: ?Sized>(Unique<T>); impl<T: ?Sized> Drop for Box<T> { - fn drop(&mut self) { - } + fn drop(&mut self) {} } #[lang = "box_free"] #[inline(always)] -unsafe fn box_free<T: ?Sized>(ptr: *mut T, _: ()) { - dealloc(ptr) +unsafe fn box_free<T: ?Sized>(ptr: Unique<T>) { + dealloc(ptr.0.0) } #[inline(never)] -fn dealloc<T: ?Sized>(_: *mut T) { -} +fn dealloc<T: ?Sized>(_: *mut T) {} pub struct Foo<T>(T); diff --git a/src/test/ui/mismatched_types/cast-rfc0401.stderr b/src/test/ui/mismatched_types/cast-rfc0401.stderr index 3a508459cc0..e63ca6e11de 100644 --- a/src/test/ui/mismatched_types/cast-rfc0401.stderr +++ b/src/test/ui/mismatched_types/cast-rfc0401.stderr @@ -30,7 +30,7 @@ help: consider borrowing the value | LL - let _ = v as &u8; LL + let _ = &*v; - | + | error[E0605]: non-primitive cast: `*const u8` as `E` --> $DIR/cast-rfc0401.rs:30:13 diff --git a/src/test/ui/mismatched_types/issue-38371.stderr b/src/test/ui/mismatched_types/issue-38371.stderr index 003f17cda15..f43427f9832 100644 --- a/src/test/ui/mismatched_types/issue-38371.stderr +++ b/src/test/ui/mismatched_types/issue-38371.stderr @@ -12,7 +12,7 @@ help: to take parameter `_a` by reference, move `&` to the type | LL - fn foo(&_a: Foo) {} LL + fn foo(_a: &Foo) {} - | + | error[E0308]: mismatched types --> $DIR/issue-38371.rs:16:9 @@ -28,7 +28,7 @@ help: consider removing `&` from the pattern | LL - fn agh(&&_a: &u32) {} LL + fn agh(&_a: &u32) {} - | + | error: aborting due to 2 previous errors diff --git a/src/test/ui/mismatched_types/overloaded-calls-bad.stderr b/src/test/ui/mismatched_types/overloaded-calls-bad.stderr index a5742d6fe8c..4000b2ba312 100644 --- a/src/test/ui/mismatched_types/overloaded-calls-bad.stderr +++ b/src/test/ui/mismatched_types/overloaded-calls-bad.stderr @@ -25,8 +25,8 @@ LL | extern "rust-call" fn call_mut(&mut self, args: Args) -> Self::Output; | ^^^^^^^^ help: provide the argument | -LL | let ans = s({isize}); - | ~~~~~~~~~~ +LL | let ans = s(/* isize */); + | ~~~~~~~~~~~~~~ error[E0057]: this function takes 1 argument but 2 arguments were supplied --> $DIR/overloaded-calls-bad.rs:31:15 @@ -43,8 +43,8 @@ LL | extern "rust-call" fn call_mut(&mut self, args: Args) -> Self::Output; | ^^^^^^^^ help: remove the extra argument | -LL | let ans = s({isize}); - | ~~~~~~~~~~ +LL | let ans = s(/* isize */); + | ~~~~~~~~~~~~~~ error: aborting due to 3 previous errors diff --git a/src/test/ui/mismatched_types/ref-pat-suggestions.stderr b/src/test/ui/mismatched_types/ref-pat-suggestions.stderr index 0516bad49ab..0e8f8853fb7 100644 --- a/src/test/ui/mismatched_types/ref-pat-suggestions.stderr +++ b/src/test/ui/mismatched_types/ref-pat-suggestions.stderr @@ -12,7 +12,7 @@ help: to take parameter `_a` by reference, move `&` to the type | LL - fn _f0(&_a: u32) {} LL + fn _f0(_a: &u32) {} - | + | error[E0308]: mismatched types --> $DIR/ref-pat-suggestions.rs:4:8 @@ -28,7 +28,7 @@ help: to take parameter `_a` by reference, move `&mut` to the type | LL - fn _f1(&mut _a: u32) {} LL + fn _f1(_a: &mut u32) {} - | + | error[E0308]: mismatched types --> $DIR/ref-pat-suggestions.rs:5:9 @@ -44,7 +44,7 @@ help: consider removing `&` from the pattern | LL - fn _f2(&&_a: &u32) {} LL + fn _f2(&_a: &u32) {} - | + | error[E0308]: mismatched types --> $DIR/ref-pat-suggestions.rs:6:13 @@ -60,7 +60,7 @@ help: consider removing `&` from the pattern | LL - fn _f3(&mut &_a: &mut u32) {} LL + fn _f3(&mut _a: &mut u32) {} - | + | error[E0308]: mismatched types --> $DIR/ref-pat-suggestions.rs:7:9 @@ -76,7 +76,7 @@ help: consider removing `&mut` from the pattern | LL - fn _f4(&&mut _a: &u32) {} LL + fn _f4(&_a: &u32) {} - | + | error[E0308]: mismatched types --> $DIR/ref-pat-suggestions.rs:8:13 @@ -92,7 +92,7 @@ help: consider removing `&mut` from the pattern | LL - fn _f5(&mut &mut _a: &mut u32) {} LL + fn _f5(&mut _a: &mut u32) {} - | + | error[E0308]: mismatched types --> $DIR/ref-pat-suggestions.rs:11:23 @@ -109,7 +109,7 @@ help: consider removing `&` from the pattern | LL - let _: fn(u32) = |&_a| (); LL + let _: fn(u32) = |_a| (); - | + | error[E0308]: mismatched types --> $DIR/ref-pat-suggestions.rs:12:23 @@ -126,7 +126,7 @@ help: consider removing `&mut` from the pattern | LL - let _: fn(u32) = |&mut _a| (); LL + let _: fn(u32) = |_a| (); - | + | error[E0308]: mismatched types --> $DIR/ref-pat-suggestions.rs:13:25 @@ -143,7 +143,7 @@ help: consider removing `&` from the pattern | LL - let _: fn(&u32) = |&&_a| (); LL + let _: fn(&u32) = |&_a| (); - | + | error[E0308]: mismatched types --> $DIR/ref-pat-suggestions.rs:14:33 @@ -160,7 +160,7 @@ help: consider removing `&` from the pattern | LL - let _: fn(&mut u32) = |&mut &_a| (); LL + let _: fn(&mut u32) = |&mut _a| (); - | + | error[E0308]: mismatched types --> $DIR/ref-pat-suggestions.rs:15:25 @@ -177,7 +177,7 @@ help: consider removing `&mut` from the pattern | LL - let _: fn(&u32) = |&&mut _a| (); LL + let _: fn(&u32) = |&_a| (); - | + | error[E0308]: mismatched types --> $DIR/ref-pat-suggestions.rs:16:33 @@ -194,7 +194,7 @@ help: consider removing `&mut` from the pattern | LL - let _: fn(&mut u32) = |&mut &mut _a| (); LL + let _: fn(&mut u32) = |&mut _a| (); - | + | error[E0308]: mismatched types --> $DIR/ref-pat-suggestions.rs:18:14 @@ -210,7 +210,7 @@ help: to take parameter `_a` by reference, move `&` to the type | LL - let _ = |&_a: u32| (); LL + let _ = |_a: &u32| (); - | + | error[E0308]: mismatched types --> $DIR/ref-pat-suggestions.rs:19:14 @@ -226,7 +226,7 @@ help: to take parameter `_a` by reference, move `&mut` to the type | LL - let _ = |&mut _a: u32| (); LL + let _ = |_a: &mut u32| (); - | + | error[E0308]: mismatched types --> $DIR/ref-pat-suggestions.rs:20:15 @@ -242,7 +242,7 @@ help: consider removing `&` from the pattern | LL - let _ = |&&_a: &u32| (); LL + let _ = |&_a: &u32| (); - | + | error[E0308]: mismatched types --> $DIR/ref-pat-suggestions.rs:21:19 @@ -258,7 +258,7 @@ help: consider removing `&` from the pattern | LL - let _ = |&mut &_a: &mut u32| (); LL + let _ = |&mut _a: &mut u32| (); - | + | error[E0308]: mismatched types --> $DIR/ref-pat-suggestions.rs:22:15 @@ -274,7 +274,7 @@ help: consider removing `&mut` from the pattern | LL - let _ = |&&mut _a: &u32| (); LL + let _ = |&_a: &u32| (); - | + | error[E0308]: mismatched types --> $DIR/ref-pat-suggestions.rs:23:19 @@ -290,7 +290,7 @@ help: consider removing `&mut` from the pattern | LL - let _ = |&mut &mut _a: &mut u32| (); LL + let _ = |&mut _a: &mut u32| (); - | + | error: aborting due to 18 previous errors diff --git a/src/test/ui/missing/missing-items/missing-type-parameter2.stderr b/src/test/ui/missing/missing-items/missing-type-parameter2.stderr index cbceec58eb1..f33951c98bf 100644 --- a/src/test/ui/missing/missing-items/missing-type-parameter2.stderr +++ b/src/test/ui/missing/missing-items/missing-type-parameter2.stderr @@ -3,7 +3,7 @@ error[E0412]: cannot find type `N` in this scope | LL | struct X<const N: u8>(); | ------------------------ similarly named struct `X` defined here -LL | +LL | LL | impl X<N> {} | ^ | diff --git a/src/test/ui/mod-subitem-as-enum-variant.stderr b/src/test/ui/mod-subitem-as-enum-variant.stderr index 15da1d155a3..cf61e94bd86 100644 --- a/src/test/ui/mod-subitem-as-enum-variant.stderr +++ b/src/test/ui/mod-subitem-as-enum-variant.stderr @@ -4,7 +4,7 @@ error[E0109]: type arguments are not allowed on module `Mod` LL | Mod::<i32>::FakeVariant(0); | --- ^^^ type argument not allowed | | - | not allowed on this + | not allowed on module `Mod` error: aborting due to previous error diff --git a/src/test/ui/namespace/namespace-mix.stderr b/src/test/ui/namespace/namespace-mix.stderr index 037a858d7e1..ccdd4dd272e 100644 --- a/src/test/ui/namespace/namespace-mix.stderr +++ b/src/test/ui/namespace/namespace-mix.stderr @@ -22,7 +22,7 @@ help: if you import `S`, refer to it directly | LL - check(m1::S); LL + check(S); - | + | error[E0423]: expected value, found type alias `xm1::S` --> $DIR/namespace-mix.rs:40:11 @@ -50,7 +50,7 @@ help: if you import `S`, refer to it directly | LL - check(xm1::S); LL + check(S); - | + | error[E0423]: expected value, found struct variant `m7::V` --> $DIR/namespace-mix.rs:100:11 @@ -81,7 +81,7 @@ help: if you import `V`, refer to it directly | LL - check(m7::V); LL + check(V); - | + | error[E0423]: expected value, found struct variant `xm7::V` --> $DIR/namespace-mix.rs:106:11 @@ -114,7 +114,7 @@ help: if you import `V`, refer to it directly | LL - check(xm7::V); LL + check(V); - | + | error[E0277]: the trait bound `c::Item: Impossible` is not satisfied --> $DIR/namespace-mix.rs:33:11 diff --git a/src/test/ui/never_type/diverging-tuple-parts-39485.stderr b/src/test/ui/never_type/diverging-tuple-parts-39485.stderr index 4b5b8c45d59..52d07ae170c 100644 --- a/src/test/ui/never_type/diverging-tuple-parts-39485.stderr +++ b/src/test/ui/never_type/diverging-tuple-parts-39485.stderr @@ -14,7 +14,7 @@ help: consider removing the borrow | LL - &panic!() LL + panic!() - | + | error[E0308]: mismatched types --> $DIR/diverging-tuple-parts-39485.rs:12:5 diff --git a/src/test/ui/never_type/issue-52443.stderr b/src/test/ui/never_type/issue-52443.stderr index c2079a19d0a..3c0daa4c55f 100644 --- a/src/test/ui/never_type/issue-52443.stderr +++ b/src/test/ui/never_type/issue-52443.stderr @@ -27,7 +27,7 @@ help: consider removing the borrow | LL - [(); & { loop { continue } } ]; LL + [(); { loop { continue } } ]; - | + | error[E0308]: mismatched types --> $DIR/issue-52443.rs:4:17 diff --git a/src/test/ui/nll/capture-ref-in-struct.stderr b/src/test/ui/nll/capture-ref-in-struct.stderr index 521e543bd26..cdfe7f6db82 100644 --- a/src/test/ui/nll/capture-ref-in-struct.stderr +++ b/src/test/ui/nll/capture-ref-in-struct.stderr @@ -6,7 +6,7 @@ LL | y: &y, ... LL | } | - `y` dropped here while still borrowed -LL | +LL | LL | deref(p); | - borrow later used here diff --git a/src/test/ui/nll/closure-requirements/escape-argument.stderr b/src/test/ui/nll/closure-requirements/escape-argument.stderr index 22398f08572..49ec0dd931a 100644 --- a/src/test/ui/nll/closure-requirements/escape-argument.stderr +++ b/src/test/ui/nll/closure-requirements/escape-argument.stderr @@ -32,7 +32,7 @@ LL | closure(&mut p, &y); LL | LL | } | - `y` dropped here while still borrowed -LL | +LL | LL | deref(p); | - borrow later used here diff --git a/src/test/ui/nll/closure-requirements/escape-upvar-nested.stderr b/src/test/ui/nll/closure-requirements/escape-upvar-nested.stderr index e1b446fc61f..f0ae4c7fb04 100644 --- a/src/test/ui/nll/closure-requirements/escape-upvar-nested.stderr +++ b/src/test/ui/nll/closure-requirements/escape-upvar-nested.stderr @@ -54,7 +54,7 @@ LL | let mut closure1 = || p = &y; ... LL | } | - `y` dropped here while still borrowed -LL | +LL | LL | deref(p); | - borrow later used here diff --git a/src/test/ui/nll/closure-requirements/escape-upvar-ref.stderr b/src/test/ui/nll/closure-requirements/escape-upvar-ref.stderr index 0ea1076c32e..e99fc4b43a2 100644 --- a/src/test/ui/nll/closure-requirements/escape-upvar-ref.stderr +++ b/src/test/ui/nll/closure-requirements/escape-upvar-ref.stderr @@ -36,7 +36,7 @@ LL | let mut closure = || p = &y; ... LL | } | - `y` dropped here while still borrowed -LL | +LL | LL | deref(p); | - borrow later used here diff --git a/src/test/ui/borrowck/issue-27282-move-match-input-into-guard.rs b/src/test/ui/nll/issue-27282-move-match-input-into-guard.rs index 4109c10e2e4..4109c10e2e4 100644 --- a/src/test/ui/borrowck/issue-27282-move-match-input-into-guard.rs +++ b/src/test/ui/nll/issue-27282-move-match-input-into-guard.rs diff --git a/src/test/ui/borrowck/issue-27282-move-match-input-into-guard.stderr b/src/test/ui/nll/issue-27282-move-match-input-into-guard.stderr index 9be1a927999..9be1a927999 100644 --- a/src/test/ui/borrowck/issue-27282-move-match-input-into-guard.stderr +++ b/src/test/ui/nll/issue-27282-move-match-input-into-guard.stderr diff --git a/src/test/ui/issues/issue-27282-move-ref-mut-into-guard.rs b/src/test/ui/nll/issue-27282-move-ref-mut-into-guard.rs index afa0ba780de..afa0ba780de 100644 --- a/src/test/ui/issues/issue-27282-move-ref-mut-into-guard.rs +++ b/src/test/ui/nll/issue-27282-move-ref-mut-into-guard.rs diff --git a/src/test/ui/issues/issue-27282-move-ref-mut-into-guard.stderr b/src/test/ui/nll/issue-27282-move-ref-mut-into-guard.stderr index a0d32616f83..a0d32616f83 100644 --- a/src/test/ui/issues/issue-27282-move-ref-mut-into-guard.stderr +++ b/src/test/ui/nll/issue-27282-move-ref-mut-into-guard.stderr diff --git a/src/test/ui/issues/issue-27282-mutate-before-diverging-arm-1.rs b/src/test/ui/nll/issue-27282-mutate-before-diverging-arm-1.rs index d17d6f07f68..d17d6f07f68 100644 --- a/src/test/ui/issues/issue-27282-mutate-before-diverging-arm-1.rs +++ b/src/test/ui/nll/issue-27282-mutate-before-diverging-arm-1.rs diff --git a/src/test/ui/issues/issue-27282-mutate-before-diverging-arm-1.stderr b/src/test/ui/nll/issue-27282-mutate-before-diverging-arm-1.stderr index a1f973e0fdf..a1f973e0fdf 100644 --- a/src/test/ui/issues/issue-27282-mutate-before-diverging-arm-1.stderr +++ b/src/test/ui/nll/issue-27282-mutate-before-diverging-arm-1.stderr diff --git a/src/test/ui/borrowck/issue-27282-mutate-before-diverging-arm-2.rs b/src/test/ui/nll/issue-27282-mutate-before-diverging-arm-2.rs index 9c3e7e9978e..9c3e7e9978e 100644 --- a/src/test/ui/borrowck/issue-27282-mutate-before-diverging-arm-2.rs +++ b/src/test/ui/nll/issue-27282-mutate-before-diverging-arm-2.rs diff --git a/src/test/ui/borrowck/issue-27282-mutate-before-diverging-arm-2.stderr b/src/test/ui/nll/issue-27282-mutate-before-diverging-arm-2.stderr index dd46308d140..dd46308d140 100644 --- a/src/test/ui/borrowck/issue-27282-mutate-before-diverging-arm-2.stderr +++ b/src/test/ui/nll/issue-27282-mutate-before-diverging-arm-2.stderr diff --git a/src/test/ui/issues/issue-27282-mutate-before-diverging-arm-3.rs b/src/test/ui/nll/issue-27282-mutate-before-diverging-arm-3.rs index cff9e963e27..cff9e963e27 100644 --- a/src/test/ui/issues/issue-27282-mutate-before-diverging-arm-3.rs +++ b/src/test/ui/nll/issue-27282-mutate-before-diverging-arm-3.rs diff --git a/src/test/ui/issues/issue-27282-mutate-before-diverging-arm-3.stderr b/src/test/ui/nll/issue-27282-mutate-before-diverging-arm-3.stderr index 4a4a25790b9..4a4a25790b9 100644 --- a/src/test/ui/issues/issue-27282-mutate-before-diverging-arm-3.stderr +++ b/src/test/ui/nll/issue-27282-mutate-before-diverging-arm-3.stderr diff --git a/src/test/ui/borrowck/issue-27282-mutation-in-guard.rs b/src/test/ui/nll/issue-27282-mutation-in-guard.rs index 395c7d214d0..395c7d214d0 100644 --- a/src/test/ui/borrowck/issue-27282-mutation-in-guard.rs +++ b/src/test/ui/nll/issue-27282-mutation-in-guard.rs diff --git a/src/test/ui/borrowck/issue-27282-mutation-in-guard.stderr b/src/test/ui/nll/issue-27282-mutation-in-guard.stderr index c4ce7e62fda..c4ce7e62fda 100644 --- a/src/test/ui/borrowck/issue-27282-mutation-in-guard.stderr +++ b/src/test/ui/nll/issue-27282-mutation-in-guard.stderr diff --git a/src/test/ui/borrowck/issue-27282-reborrow-ref-mut-in-guard.rs b/src/test/ui/nll/issue-27282-reborrow-ref-mut-in-guard.rs index 82d8b9e9ed9..82d8b9e9ed9 100644 --- a/src/test/ui/borrowck/issue-27282-reborrow-ref-mut-in-guard.rs +++ b/src/test/ui/nll/issue-27282-reborrow-ref-mut-in-guard.rs diff --git a/src/test/ui/borrowck/issue-27282-reborrow-ref-mut-in-guard.stderr b/src/test/ui/nll/issue-27282-reborrow-ref-mut-in-guard.stderr index 48433432de1..48433432de1 100644 --- a/src/test/ui/borrowck/issue-27282-reborrow-ref-mut-in-guard.stderr +++ b/src/test/ui/nll/issue-27282-reborrow-ref-mut-in-guard.stderr diff --git a/src/test/ui/issues/issue-52057.rs b/src/test/ui/nll/issue-52057.rs index 98f49fe8f55..98f49fe8f55 100644 --- a/src/test/ui/issues/issue-52057.rs +++ b/src/test/ui/nll/issue-52057.rs diff --git a/src/test/ui/nll/issue-52534-2.stderr b/src/test/ui/nll/issue-52534-2.stderr index cef4aba0240..ac385e056b9 100644 --- a/src/test/ui/nll/issue-52534-2.stderr +++ b/src/test/ui/nll/issue-52534-2.stderr @@ -6,7 +6,7 @@ LL | y = &x LL | LL | } | - `x` dropped here while still borrowed -LL | +LL | LL | println!("{}", y); | - borrow later used here diff --git a/src/test/ui/nll/issue-54382-use-span-of-tail-of-block.stderr b/src/test/ui/nll/issue-54382-use-span-of-tail-of-block.stderr index 6dacfd1f264..d8f43cbc92a 100644 --- a/src/test/ui/nll/issue-54382-use-span-of-tail-of-block.stderr +++ b/src/test/ui/nll/issue-54382-use-span-of-tail-of-block.stderr @@ -9,7 +9,7 @@ LL | D("other").next(&_thing1) ... LL | } | - `_thing1` dropped here while still borrowed -LL | +LL | LL | ; | - ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `D` | diff --git a/src/test/ui/nll/issue-54556-temps-in-tail-diagnostic.stderr b/src/test/ui/nll/issue-54556-temps-in-tail-diagnostic.stderr index 68d3cef8aa1..92f5ffdf388 100644 --- a/src/test/ui/nll/issue-54556-temps-in-tail-diagnostic.stderr +++ b/src/test/ui/nll/issue-54556-temps-in-tail-diagnostic.stderr @@ -8,7 +8,7 @@ LL | D(&_thing1).end() | a temporary with access to the borrow is created here ... LL | } | - `_thing1` dropped here while still borrowed -LL | +LL | LL | ; | - ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `D` | diff --git a/src/test/ui/nll/issue-97997.rs b/src/test/ui/nll/issue-97997.rs new file mode 100644 index 00000000000..c64e720b12f --- /dev/null +++ b/src/test/ui/nll/issue-97997.rs @@ -0,0 +1,16 @@ +trait Foo { + const ASSOC: bool = true; +} +impl<T> Foo for fn(T) {} + +fn foo(_x: i32) {} + +fn impls_foo<T: Foo>(_x: T) {} + +fn main() { + impls_foo(foo as fn(i32)); + + <fn(&u8) as Foo>::ASSOC; + //~^ ERROR implementation of `Foo` is not general enough + //~| ERROR implementation of `Foo` is not general enough +} diff --git a/src/test/ui/nll/issue-97997.stderr b/src/test/ui/nll/issue-97997.stderr new file mode 100644 index 00000000000..78401bbf654 --- /dev/null +++ b/src/test/ui/nll/issue-97997.stderr @@ -0,0 +1,20 @@ +error: implementation of `Foo` is not general enough + --> $DIR/issue-97997.rs:13:5 + | +LL | <fn(&u8) as Foo>::ASSOC; + | ^^^^^^^^^^^^^^^^^^^^^^^ implementation of `Foo` is not general enough + | + = note: `Foo` would have to be implemented for the type `for<'r> fn(&'r u8)` + = note: ...but `Foo` is actually implemented for the type `fn(&'0 u8)`, for some specific lifetime `'0` + +error: implementation of `Foo` is not general enough + --> $DIR/issue-97997.rs:13:5 + | +LL | <fn(&u8) as Foo>::ASSOC; + | ^^^^^^^^^^^^^^^^^^^^^^^ implementation of `Foo` is not general enough + | + = note: `Foo` would have to be implemented for the type `for<'r> fn(&'r u8)` + = note: ...but `Foo` is actually implemented for the type `fn(&'0 u8)`, for some specific lifetime `'0` + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/nll/issue-98170.rs b/src/test/ui/nll/issue-98170.rs new file mode 100644 index 00000000000..6bb12f52d3f --- /dev/null +++ b/src/test/ui/nll/issue-98170.rs @@ -0,0 +1,25 @@ +pub struct MyStruct<'a> { + field: &'a [u32], +} + +impl MyStruct<'_> { + pub fn new<'a>(field: &'a [u32]) -> MyStruct<'a> { + Self { field } + //~^ ERROR lifetime may not live long enough + //~| ERROR lifetime may not live long enough + } +} + +trait Trait<'a> { + fn new(field: &'a [u32]) -> MyStruct<'a>; +} + +impl<'a> Trait<'a> for MyStruct<'_> { + fn new(field: &'a [u32]) -> MyStruct<'a> { + Self { field } + //~^ ERROR lifetime may not live long enough + //~| ERROR lifetime may not live long enough + } +} + +fn main() {} diff --git a/src/test/ui/nll/issue-98170.stderr b/src/test/ui/nll/issue-98170.stderr new file mode 100644 index 00000000000..0d17365e71b --- /dev/null +++ b/src/test/ui/nll/issue-98170.stderr @@ -0,0 +1,44 @@ +error: lifetime may not live long enough + --> $DIR/issue-98170.rs:7:9 + | +LL | impl MyStruct<'_> { + | -- lifetime `'1` appears in the `impl`'s self type +LL | pub fn new<'a>(field: &'a [u32]) -> MyStruct<'a> { + | -- lifetime `'a` defined here +LL | Self { field } + | ^^^^^^^^^^^^^^ associated function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'1` + +error: lifetime may not live long enough + --> $DIR/issue-98170.rs:7:16 + | +LL | impl MyStruct<'_> { + | -- lifetime `'1` appears in the `impl`'s self type +LL | pub fn new<'a>(field: &'a [u32]) -> MyStruct<'a> { + | -- lifetime `'a` defined here +LL | Self { field } + | ^^^^^ this usage requires that `'a` must outlive `'1` + +error: lifetime may not live long enough + --> $DIR/issue-98170.rs:19:9 + | +LL | impl<'a> Trait<'a> for MyStruct<'_> { + | -- -- lifetime `'1` appears in the `impl`'s self type + | | + | lifetime `'a` defined here +LL | fn new(field: &'a [u32]) -> MyStruct<'a> { +LL | Self { field } + | ^^^^^^^^^^^^^^ associated function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'1` + +error: lifetime may not live long enough + --> $DIR/issue-98170.rs:19:16 + | +LL | impl<'a> Trait<'a> for MyStruct<'_> { + | -- -- lifetime `'1` appears in the `impl`'s self type + | | + | lifetime `'a` defined here +LL | fn new(field: &'a [u32]) -> MyStruct<'a> { +LL | Self { field } + | ^^^^^ this usage requires that `'a` must outlive `'1` + +error: aborting due to 4 previous errors + diff --git a/src/test/ui/no-capture-arc.stderr b/src/test/ui/no-capture-arc.stderr index 37032e73f19..7fa2090e3e6 100644 --- a/src/test/ui/no-capture-arc.stderr +++ b/src/test/ui/no-capture-arc.stderr @@ -3,7 +3,7 @@ error[E0382]: borrow of moved value: `arc_v` | LL | let arc_v = Arc::new(v); | ----- move occurs because `arc_v` has type `Arc<Vec<i32>>`, which does not implement the `Copy` trait -LL | +LL | LL | thread::spawn(move|| { | ------ value moved into closure here LL | assert_eq!((*arc_v)[3], 4); diff --git a/src/test/ui/no-reuse-move-arc.stderr b/src/test/ui/no-reuse-move-arc.stderr index 6f37d4c9d86..bcc4506dc8d 100644 --- a/src/test/ui/no-reuse-move-arc.stderr +++ b/src/test/ui/no-reuse-move-arc.stderr @@ -3,7 +3,7 @@ error[E0382]: borrow of moved value: `arc_v` | LL | let arc_v = Arc::new(v); | ----- move occurs because `arc_v` has type `Arc<Vec<i32>>`, which does not implement the `Copy` trait -LL | +LL | LL | thread::spawn(move|| { | ------ value moved into closure here LL | assert_eq!((*arc_v)[3], 4); diff --git a/src/test/ui/no-send-res-ports.stderr b/src/test/ui/no-send-res-ports.stderr index 80708c989fc..e4c57c04e72 100644 --- a/src/test/ui/no-send-res-ports.stderr +++ b/src/test/ui/no-send-res-ports.stderr @@ -22,7 +22,16 @@ note: required because it appears within the type `Foo` | LL | struct Foo { | ^^^ - = note: required because it appears within the type `[closure@$DIR/no-send-res-ports.rs:25:19: 29:6]` +note: required because it's used within this closure + --> $DIR/no-send-res-ports.rs:25:19 + | +LL | thread::spawn(move|| { + | ___________________^ +LL | | +LL | | let y = x; +LL | | println!("{:?}", y); +LL | | }); + | |_____^ note: required by a bound in `spawn` --> $SRC_DIR/std/src/thread/mod.rs:LL:COL | diff --git a/src/test/ui/non-fmt-panic.stderr b/src/test/ui/non-fmt-panic.stderr index 3305e5cc906..4da97ed5d60 100644 --- a/src/test/ui/non-fmt-panic.stderr +++ b/src/test/ui/non-fmt-panic.stderr @@ -296,7 +296,7 @@ help: remove the `format!(..)` macro call | LL - panic!(format!("{}", 1)); LL + panic!("{}", 1); - | + | warning: panic message is not a string literal --> $DIR/non-fmt-panic.rs:50:18 @@ -311,7 +311,7 @@ help: remove the `format!(..)` macro call | LL - unreachable!(format!("{}", 1)); LL + unreachable!("{}", 1); - | + | warning: panic message is not a string literal --> $DIR/non-fmt-panic.rs:51:20 @@ -326,7 +326,7 @@ help: remove the `format!(..)` macro call | LL - assert!(false, format!("{}", 1)); LL + assert!(false, "{}", 1); - | + | warning: panic message is not a string literal --> $DIR/non-fmt-panic.rs:52:26 @@ -341,7 +341,7 @@ help: remove the `format!(..)` macro call | LL - debug_assert!(false, format!("{}", 1)); LL + debug_assert!(false, "{}", 1); - | + | warning: panic message is not a string literal --> $DIR/non-fmt-panic.rs:54:12 diff --git a/src/test/ui/not-clone-closure.stderr b/src/test/ui/not-clone-closure.stderr index 92909797c96..bebf561b120 100644 --- a/src/test/ui/not-clone-closure.stderr +++ b/src/test/ui/not-clone-closure.stderr @@ -6,11 +6,18 @@ LL | let hello = move || { LL | | println!("Hello {}", a.0); LL | | }; | |_____- within this `[closure@$DIR/not-clone-closure.rs:7:17: 9:6]` -LL | +LL | LL | let hello = hello.clone(); | ^^^^^ within `[closure@$DIR/not-clone-closure.rs:7:17: 9:6]`, the trait `Clone` is not implemented for `S` | - = note: required because it appears within the type `[closure@$DIR/not-clone-closure.rs:7:17: 9:6]` +note: required because it's used within this closure + --> $DIR/not-clone-closure.rs:7:17 + | +LL | let hello = move || { + | _________________^ +LL | | println!("Hello {}", a.0); +LL | | }; + | |_____^ help: consider annotating `S` with `#[derive(Clone)]` | LL | #[derive(Clone)] diff --git a/src/test/ui/not-enough-arguments.stderr b/src/test/ui/not-enough-arguments.stderr index 4f502acc95c..b1df578ea80 100644 --- a/src/test/ui/not-enough-arguments.stderr +++ b/src/test/ui/not-enough-arguments.stderr @@ -11,8 +11,8 @@ LL | fn foo(a: isize, b: isize, c: isize, d:isize) { | ^^^ -------- -------- -------- ------- help: provide the argument | -LL | foo(1, 2, 3, {isize}); - | ~~~~~~~~~~~~~~~~~~~~~ +LL | foo(1, 2, 3, /* isize */); + | ~~~~~~~~~~~~~~~~~~~~~~~~~ error[E0061]: this function takes 6 arguments but 3 arguments were supplied --> $DIR/not-enough-arguments.rs:29:3 @@ -39,8 +39,8 @@ LL | f: i32, | ------ help: provide the arguments | -LL | bar(1, 2, 3, {i32}, {i32}, {i32}); - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL | bar(1, 2, 3, /* i32 */, /* i32 */, /* i32 */); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 2 previous errors diff --git a/src/test/ui/packed/issue-27060-2.stderr b/src/test/ui/packed/issue-27060-2.stderr index 8cd2ce6f36c..0836ceaecd1 100644 --- a/src/test/ui/packed/issue-27060-2.stderr +++ b/src/test/ui/packed/issue-27060-2.stderr @@ -12,7 +12,7 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - pub struct Bad<T: ?Sized> { LL + pub struct Bad<T> { - | + | help: borrowed types always have a statically known size | LL | data: &T, diff --git a/src/test/ui/parser/attr-stmt-expr-attr-bad.stderr b/src/test/ui/parser/attr-stmt-expr-attr-bad.stderr index d38b98a1901..7bb3db0301b 100644 --- a/src/test/ui/parser/attr-stmt-expr-attr-bad.stderr +++ b/src/test/ui/parser/attr-stmt-expr-attr-bad.stderr @@ -322,7 +322,7 @@ help: to annotate the item macro invocation, change the attribute from inner to | LL - #[cfg(FALSE)] fn s() { #[attr] #![attr] foo!(); } LL + #[cfg(FALSE)] fn s() { #[attr] #[attr] foo!(); } - | + | error: an inner attribute is not permitted following an outer attribute --> $DIR/attr-stmt-expr-attr-bad.rs:80:32 @@ -338,7 +338,7 @@ help: to annotate the item macro invocation, change the attribute from inner to | LL - #[cfg(FALSE)] fn s() { #[attr] #![attr] foo![]; } LL + #[cfg(FALSE)] fn s() { #[attr] #[attr] foo![]; } - | + | error: an inner attribute is not permitted following an outer attribute --> $DIR/attr-stmt-expr-attr-bad.rs:82:32 @@ -354,7 +354,7 @@ help: to annotate the item macro invocation, change the attribute from inner to | LL - #[cfg(FALSE)] fn s() { #[attr] #![attr] foo!{}; } LL + #[cfg(FALSE)] fn s() { #[attr] #[attr] foo!{}; } - | + | error[E0586]: inclusive range with no end --> $DIR/attr-stmt-expr-attr-bad.rs:88:35 diff --git a/src/test/ui/parser/attr-with-a-semicolon.stderr b/src/test/ui/parser/attr-with-a-semicolon.stderr index 49ed30150d0..0de3490b8ea 100644 --- a/src/test/ui/parser/attr-with-a-semicolon.stderr +++ b/src/test/ui/parser/attr-with-a-semicolon.stderr @@ -8,7 +8,7 @@ help: consider removing this semicolon | LL - #[derive(Debug, Clone)]; LL + #[derive(Debug, Clone)] - | + | error: aborting due to previous error diff --git a/src/test/ui/parser/attr.stderr b/src/test/ui/parser/attr.stderr index 3527274bd0f..7cd0ac2244a 100644 --- a/src/test/ui/parser/attr.stderr +++ b/src/test/ui/parser/attr.stderr @@ -11,7 +11,7 @@ help: to annotate the function, change the attribute from inner to outer style | LL - #![lang = "foo"] LL + #[lang = "foo"] - | + | error: aborting due to previous error diff --git a/src/test/ui/parser/circular_modules_main.stderr b/src/test/ui/parser/circular_modules_main.stderr index c5434c72b38..1094def6014 100644 --- a/src/test/ui/parser/circular_modules_main.stderr +++ b/src/test/ui/parser/circular_modules_main.stderr @@ -18,7 +18,7 @@ help: if you import `hi_str`, refer to it directly | LL - println!("{}", circular_modules_main::hi_str()); LL + println!("{}", hi_str()); - | + | error: aborting due to 2 previous errors diff --git a/src/test/ui/parser/doc-comment-in-if-statement.stderr b/src/test/ui/parser/doc-comment-in-if-statement.stderr index b7c1847fc7c..fc0bc507370 100644 --- a/src/test/ui/parser/doc-comment-in-if-statement.stderr +++ b/src/test/ui/parser/doc-comment-in-if-statement.stderr @@ -9,7 +9,7 @@ help: you might have meant to write a regular comment | LL - if true /*!*/ {} LL + if true /**/ {} - | + | error: outer attributes are not allowed on `if` and `else` branches --> $DIR/doc-comment-in-if-statement.rs:2:13 diff --git a/src/test/ui/parser/expr-as-stmt-2.stderr b/src/test/ui/parser/expr-as-stmt-2.stderr index b7516babc13..9b939f05e02 100644 --- a/src/test/ui/parser/expr-as-stmt-2.stderr +++ b/src/test/ui/parser/expr-as-stmt-2.stderr @@ -40,7 +40,7 @@ help: consider removing the `&&` | LL - && LL + if let Some(y) = a { true } else { false } - | + | help: parentheses are required to parse this as an expression | LL | (if let Some(x) = a { true } else { false }) diff --git a/src/test/ui/parser/expr-as-stmt.stderr b/src/test/ui/parser/expr-as-stmt.stderr index e63da52c8fe..8eb81301bc3 100644 --- a/src/test/ui/parser/expr-as-stmt.stderr +++ b/src/test/ui/parser/expr-as-stmt.stderr @@ -174,7 +174,7 @@ help: consider removing the `&&` | LL - { true } && { true } LL + { true } { true } - | + | help: parentheses are required to parse this as an expression | LL | ({ true }) && { true } diff --git a/src/test/ui/parser/increment-autofix.stderr b/src/test/ui/parser/increment-autofix.stderr index 593592ba4ab..1dc69fd9f46 100644 --- a/src/test/ui/parser/increment-autofix.stderr +++ b/src/test/ui/parser/increment-autofix.stderr @@ -8,7 +8,7 @@ help: use `+= 1` instead | LL - ++i; LL + i += 1; - | + | error: Rust has no prefix increment operator --> $DIR/increment-autofix.rs:11:11 @@ -33,7 +33,7 @@ help: use `+= 1` instead | LL - ++tmp; LL + tmp += 1; - | + | error: Rust has no prefix increment operator --> $DIR/increment-autofix.rs:25:11 diff --git a/src/test/ui/parser/increment-notfixed.stderr b/src/test/ui/parser/increment-notfixed.stderr index f23595da32a..352d98cf82e 100644 --- a/src/test/ui/parser/increment-notfixed.stderr +++ b/src/test/ui/parser/increment-notfixed.stderr @@ -10,7 +10,7 @@ LL | { let tmp = i; i += 1; tmp }; | +++++++++++ ~~~~~~~~~~~~~~~ LL - i++; LL + i += 1; - | + | error: Rust has no postfix increment operator --> $DIR/increment-notfixed.rs:17:12 @@ -26,7 +26,7 @@ LL | while { let tmp = i; i += 1; tmp } < 5 { | +++++++++++ ~~~~~~~~~~~~~~~ LL - while i++ < 5 { LL + while i += 1 < 5 { - | + | error: Rust has no postfix increment operator --> $DIR/increment-notfixed.rs:25:8 @@ -40,7 +40,7 @@ LL | { let tmp_ = tmp; tmp += 1; tmp_ }; | ++++++++++++ ~~~~~~~~~~~~~~~~~~ LL - tmp++; LL + tmp += 1; - | + | error: Rust has no postfix increment operator --> $DIR/increment-notfixed.rs:31:14 @@ -56,7 +56,7 @@ LL | while { let tmp_ = tmp; tmp += 1; tmp_ } < 5 { | ++++++++++++ ~~~~~~~~~~~~~~~~~~ LL - while tmp++ < 5 { LL + while tmp += 1 < 5 { - | + | error: Rust has no postfix increment operator --> $DIR/increment-notfixed.rs:39:16 @@ -70,7 +70,7 @@ LL | { let tmp = foo.bar.qux; foo.bar.qux += 1; tmp }; | +++++++++++ ~~~~~~~~~~~~~~~~~~~~~~~~~ LL - foo.bar.qux++; LL + foo.bar.qux += 1; - | + | error: Rust has no postfix increment operator --> $DIR/increment-notfixed.rs:49:10 @@ -84,7 +84,7 @@ LL | { let tmp = s.tmp; s.tmp += 1; tmp }; | +++++++++++ ~~~~~~~~~~~~~~~~~~~ LL - s.tmp++; LL + s.tmp += 1; - | + | error: Rust has no prefix increment operator --> $DIR/increment-notfixed.rs:56:5 @@ -96,7 +96,7 @@ help: use `+= 1` instead | LL - ++foo.bar.qux; LL + foo.bar.qux += 1; - | + | error: aborting due to 7 previous errors diff --git a/src/test/ui/parser/inner-attr-after-doc-comment.stderr b/src/test/ui/parser/inner-attr-after-doc-comment.stderr index 404800ee15b..2cfafac7794 100644 --- a/src/test/ui/parser/inner-attr-after-doc-comment.stderr +++ b/src/test/ui/parser/inner-attr-after-doc-comment.stderr @@ -5,7 +5,7 @@ LL | / /** LL | | * My module LL | | */ | |___- previous doc comment -LL | +LL | LL | #![recursion_limit="100"] | ^^^^^^^^^^^^^^^^^^^^^^^^^ not permitted following an outer attribute LL | @@ -17,7 +17,7 @@ help: to annotate the function, change the attribute from inner to outer style | LL - #![recursion_limit="100"] LL + #[recursion_limit="100"] - | + | error: aborting due to previous error diff --git a/src/test/ui/parser/inner-attr.stderr b/src/test/ui/parser/inner-attr.stderr index 1adac745908..331c254a52b 100644 --- a/src/test/ui/parser/inner-attr.stderr +++ b/src/test/ui/parser/inner-attr.stderr @@ -3,7 +3,7 @@ error: an inner attribute is not permitted following an outer attribute | LL | #[feature(lang_items)] | ---------------------- previous outer attribute -LL | +LL | LL | #![recursion_limit="100"] | ^^^^^^^^^^^^^^^^^^^^^^^^^ not permitted following an outer attribute LL | fn main() {} @@ -14,7 +14,7 @@ help: to annotate the function, change the attribute from inner to outer style | LL - #![recursion_limit="100"] LL + #[recursion_limit="100"] - | + | error: aborting due to previous error diff --git a/src/test/ui/parser/issues/issue-30318.stderr b/src/test/ui/parser/issues/issue-30318.stderr index 7e710884554..c441a92abad 100644 --- a/src/test/ui/parser/issues/issue-30318.stderr +++ b/src/test/ui/parser/issues/issue-30318.stderr @@ -25,7 +25,7 @@ help: to annotate the function, change the attribute from inner to outer style | LL - #![test] LL + #[test] - | + | error[E0753]: expected outer doc comment --> $DIR/issue-30318.rs:13:1 @@ -52,7 +52,7 @@ help: you might have meant to write a regular comment | LL - //! Misplaced comment... LL + // Misplaced comment... - | + | error[E0753]: expected outer doc comment --> $DIR/issue-30318.rs:23:1 @@ -65,7 +65,7 @@ help: you might have meant to write a regular comment | LL - /*! Misplaced comment... */ LL + /* Misplaced comment... */ - | + | error: expected item after doc comment --> $DIR/issue-30318.rs:23:1 diff --git a/src/test/ui/parser/issues/issue-34255-1.stderr b/src/test/ui/parser/issues/issue-34255-1.stderr index fbff75e37d9..0e2b0d62ef6 100644 --- a/src/test/ui/parser/issues/issue-34255-1.stderr +++ b/src/test/ui/parser/issues/issue-34255-1.stderr @@ -12,7 +12,7 @@ help: if `Test::Drill` is a function, use the arguments directly | LL - Test::Drill(field: 42); LL + Test::Drill(42); - | + | error: aborting due to previous error diff --git a/src/test/ui/parser/issues/issue-35813-postfix-after-cast.stderr b/src/test/ui/parser/issues/issue-35813-postfix-after-cast.stderr index 6823a426823..4cf273d8be5 100644 --- a/src/test/ui/parser/issues/issue-35813-postfix-after-cast.stderr +++ b/src/test/ui/parser/issues/issue-35813-postfix-after-cast.stderr @@ -23,7 +23,7 @@ help: alternatively, remove the type ascription | LL - vec![1, 2, 3]: Vec<i32>[0]; LL + vec![1, 2, 3][0]; - | + | error: casts cannot be followed by indexing --> $DIR/issue-35813-postfix-after-cast.rs:17:5 @@ -50,7 +50,7 @@ help: alternatively, remove the type ascription | LL - (&[0i32]): &[i32; 1][0]; LL + (&[0i32])[0]; - | + | error: casts cannot be followed by a method call --> $DIR/issue-35813-postfix-after-cast.rs:39:13 @@ -66,7 +66,7 @@ help: alternatively, remove the type ascription | LL - let _ = 0i32: i32: i32.count_ones(); LL + let _ = 0i32: i32.count_ones(); - | + | error: casts cannot be followed by a method call --> $DIR/issue-35813-postfix-after-cast.rs:41:13 @@ -82,7 +82,7 @@ help: alternatively, remove the type ascription | LL - let _ = 0 as i32: i32.count_ones(); LL + let _ = 0 as i32.count_ones(); - | + | error: casts cannot be followed by a method call --> $DIR/issue-35813-postfix-after-cast.rs:43:13 @@ -131,7 +131,7 @@ help: alternatively, remove the type ascription | LL - let _ = 0i32: i32.count_ones(): u32; LL + let _ = 0i32.count_ones(): u32; - | + | error: casts cannot be followed by a method call --> $DIR/issue-35813-postfix-after-cast.rs:51:13 @@ -158,7 +158,7 @@ help: alternatively, remove the type ascription | LL - let _ = 0i32: i32.count_ones() as u32; LL + let _ = 0i32.count_ones() as u32; - | + | error: casts cannot be followed by a method call --> $DIR/issue-35813-postfix-after-cast.rs:55:13 @@ -185,7 +185,7 @@ help: alternatively, remove the type ascription | LL - let _ = 0i32: i32: i32.count_ones() as u32 as i32; LL + let _ = 0i32: i32.count_ones() as u32 as i32; - | + | error: casts cannot be followed by a method call --> $DIR/issue-35813-postfix-after-cast.rs:62:13 @@ -237,7 +237,7 @@ help: alternatively, remove the type ascription | LL - 0: i32.max(0); LL + 0.max(0); - | + | error: casts cannot be followed by a method call --> $DIR/issue-35813-postfix-after-cast.rs:92:8 @@ -264,7 +264,7 @@ help: alternatively, remove the type ascription | LL - if 5u64: u64.max(0) == 0 { LL + if 5u64.max(0) == 0 { - | + | error: casts cannot be followed by a method call --> $DIR/issue-35813-postfix-after-cast.rs:102:9 @@ -291,7 +291,7 @@ help: alternatively, remove the type ascription | LL - 5u64: u64.max(0) == 0 LL + 5u64.max(0) == 0 - | + | error: casts cannot be followed by indexing --> $DIR/issue-35813-postfix-after-cast.rs:111:24 @@ -318,7 +318,7 @@ help: alternatively, remove the type ascription | LL - static bar2: &[i32] = &(&[1i32,2,3]: &[i32; 3][0..1]); LL + static bar2: &[i32] = &(&[1i32,2,3][0..1]); - | + | error: casts cannot be followed by `?` --> $DIR/issue-35813-postfix-after-cast.rs:119:5 @@ -345,7 +345,7 @@ help: alternatively, remove the type ascription | LL - Err(0u64): Result<u64,u64>?; LL + Err(0u64)?; - | + | error: casts cannot be followed by a function call --> $DIR/issue-35813-postfix-after-cast.rs:145:5 @@ -372,7 +372,7 @@ help: alternatively, remove the type ascription | LL - drop_ptr: fn(u8)(0); LL + drop_ptr(0); - | + | error: casts cannot be followed by `.await` --> $DIR/issue-35813-postfix-after-cast.rs:152:5 @@ -399,7 +399,7 @@ help: alternatively, remove the type ascription | LL - Box::pin(noop()): Pin<Box<_>>.await; LL + Box::pin(noop()).await; - | + | error: casts cannot be followed by a field access --> $DIR/issue-35813-postfix-after-cast.rs:167:5 @@ -426,7 +426,7 @@ help: alternatively, remove the type ascription | LL - Foo::default(): Foo.bar; LL + Foo::default().bar; - | + | error: casts cannot be followed by a method call --> $DIR/issue-35813-postfix-after-cast.rs:84:9 @@ -453,7 +453,7 @@ help: alternatively, remove the type ascription | LL - if true { 33 } else { 44 }: i32.max(0) LL + if true { 33 } else { 44 }.max(0) - | + | error[E0214]: parenthesized type parameters may only be used with a `Fn` trait --> $DIR/issue-35813-postfix-after-cast.rs:131:13 diff --git a/src/test/ui/parser/issues/issue-44406.stderr b/src/test/ui/parser/issues/issue-44406.stderr index 2f85d8cd865..1f0c1ea4c2f 100644 --- a/src/test/ui/parser/issues/issue-44406.stderr +++ b/src/test/ui/parser/issues/issue-44406.stderr @@ -27,7 +27,7 @@ help: if `bar` is a function, use the arguments directly | LL - bar(baz: $rest) LL + bar(: $rest) - | + | error: aborting due to 2 previous errors diff --git a/src/test/ui/parser/issues/issue-45296.stderr b/src/test/ui/parser/issues/issue-45296.stderr index 6abe266d4e9..081a72054e8 100644 --- a/src/test/ui/parser/issues/issue-45296.stderr +++ b/src/test/ui/parser/issues/issue-45296.stderr @@ -11,7 +11,7 @@ help: to annotate the function, change the attribute from inner to outer style | LL - #![allow(unused_variables)] LL + #[allow(unused_variables)] - | + | error: aborting due to previous error diff --git a/src/test/ui/parser/issues/issue-56031.stderr b/src/test/ui/parser/issues/issue-56031.stderr index 7ee5bc6ec61..2fa05dd2dfb 100644 --- a/src/test/ui/parser/issues/issue-56031.stderr +++ b/src/test/ui/parser/issues/issue-56031.stderr @@ -12,7 +12,7 @@ help: for an inherent impl, drop this `for` | LL - impl for T {} LL + impl T {} - | + | error: aborting due to previous error diff --git a/src/test/ui/parser/issues/issue-62894.stderr b/src/test/ui/parser/issues/issue-62894.stderr index ed5e863bd9d..ae89926914e 100644 --- a/src/test/ui/parser/issues/issue-62894.stderr +++ b/src/test/ui/parser/issues/issue-62894.stderr @@ -6,7 +6,7 @@ LL | fn f() { assert_eq!(f(), (), assert_eq!(assert_eq! | | | | | unclosed delimiter | unclosed delimiter -LL | +LL | LL | fn main() {} | ^ @@ -18,7 +18,7 @@ LL | fn f() { assert_eq!(f(), (), assert_eq!(assert_eq! | | | | | unclosed delimiter | unclosed delimiter -LL | +LL | LL | fn main() {} | ^ @@ -30,7 +30,7 @@ LL | fn f() { assert_eq!(f(), (), assert_eq!(assert_eq! | | | | | unclosed delimiter | unclosed delimiter -LL | +LL | LL | fn main() {} | ^ @@ -39,7 +39,7 @@ error: expected one of `(`, `[`, or `{`, found keyword `fn` | LL | fn f() { assert_eq!(f(), (), assert_eq!(assert_eq! | - expected one of `(`, `[`, or `{` -LL | +LL | LL | fn main() {} | ^^ unexpected token | diff --git a/src/test/ui/parser/issues/issue-62973.stderr b/src/test/ui/parser/issues/issue-62973.stderr index 871b5d59651..bc3358fc6ba 100644 --- a/src/test/ui/parser/issues/issue-62973.stderr +++ b/src/test/ui/parser/issues/issue-62973.stderr @@ -5,8 +5,8 @@ LL | fn p() { match s { v, E { [) {) } | - - unclosed delimiter | | | unclosed delimiter -LL | -LL | +LL | +LL | | ^ error: this file contains an unclosed delimiter @@ -16,8 +16,8 @@ LL | fn p() { match s { v, E { [) {) } | - - unclosed delimiter | | | unclosed delimiter -LL | -LL | +LL | +LL | | ^ error: expected one of `,` or `}`, found `{` @@ -51,8 +51,8 @@ error: expected one of `.`, `?`, `{`, or an operator, found `}` | LL | fn p() { match s { v, E { [) {) } | ----- while parsing this `match` expression -LL | -LL | +LL | +LL | | ^ expected one of `.`, `?`, `{`, or an operator error: mismatched closing delimiter: `)` diff --git a/src/test/ui/parser/issues/issue-88276-unary-plus.stderr b/src/test/ui/parser/issues/issue-88276-unary-plus.stderr index b26761729a8..363e08201f4 100644 --- a/src/test/ui/parser/issues/issue-88276-unary-plus.stderr +++ b/src/test/ui/parser/issues/issue-88276-unary-plus.stderr @@ -8,7 +8,7 @@ help: try removing the `+` | LL - let _ = +1; LL + let _ = 1; - | + | error: leading `+` is not supported --> $DIR/issue-88276-unary-plus.rs:5:20 @@ -20,7 +20,7 @@ help: try removing the `+` | LL - let _ = (1.0 + +2.0) * +3.0; LL + let _ = (1.0 + 2.0) * +3.0; - | + | error: leading `+` is not supported --> $DIR/issue-88276-unary-plus.rs:5:28 @@ -32,7 +32,7 @@ help: try removing the `+` | LL - let _ = (1.0 + +2.0) * +3.0; LL + let _ = (1.0 + +2.0) * 3.0; - | + | error: leading `+` is not supported --> $DIR/issue-88276-unary-plus.rs:7:14 @@ -44,7 +44,7 @@ help: try removing the `+` | LL - let _ = [+3, 4+6]; LL + let _ = [3, 4+6]; - | + | error: aborting due to 4 previous errors diff --git a/src/test/ui/parser/issues/issue-88818.stderr b/src/test/ui/parser/issues/issue-88818.stderr index d30990ae582..6e624c5a284 100644 --- a/src/test/ui/parser/issues/issue-88818.stderr +++ b/src/test/ui/parser/issues/issue-88818.stderr @@ -12,7 +12,7 @@ help: for an inherent impl, drop this `for` | LL - impl for S { } LL + impl S { } - | + | error: aborting due to previous error diff --git a/src/test/ui/parser/issues/issue-89971-outer-attr-following-inner-attr-ice.stderr b/src/test/ui/parser/issues/issue-89971-outer-attr-following-inner-attr-ice.stderr index 34a6ab00d7b..a5ee2444520 100644 --- a/src/test/ui/parser/issues/issue-89971-outer-attr-following-inner-attr-ice.stderr +++ b/src/test/ui/parser/issues/issue-89971-outer-attr-following-inner-attr-ice.stderr @@ -12,7 +12,7 @@ help: to annotate the struct, change the attribute from inner to outer style | LL - #![deny(missing_docs)] LL + #[deny(missing_docs)] - | + | error: aborting due to previous error diff --git a/src/test/ui/parser/labeled-no-colon-expr.stderr b/src/test/ui/parser/labeled-no-colon-expr.stderr index 5c9597c440c..a258bd3ccde 100644 --- a/src/test/ui/parser/labeled-no-colon-expr.stderr +++ b/src/test/ui/parser/labeled-no-colon-expr.stderr @@ -52,7 +52,7 @@ help: consider removing the label | LL - 'l4 0; LL + 0; - | + | error: labeled expression must be followed by `:` --> $DIR/labeled-no-colon-expr.rs:8:9 diff --git a/src/test/ui/parser/mismatched-delim-brace-empty-block.stderr b/src/test/ui/parser/mismatched-delim-brace-empty-block.stderr index c871e549c9e..165eb8ae932 100644 --- a/src/test/ui/parser/mismatched-delim-brace-empty-block.stderr +++ b/src/test/ui/parser/mismatched-delim-brace-empty-block.stderr @@ -3,7 +3,7 @@ error: unexpected closing delimiter: `}` | LL | fn main() { | - this opening brace... -LL | +LL | LL | } | - ...matches this closing brace LL | let _ = (); diff --git a/src/test/ui/parser/recover-assoc-eq-missing-term.stderr b/src/test/ui/parser/recover-assoc-eq-missing-term.stderr index f3ed77cbde2..152f7f2fb06 100644 --- a/src/test/ui/parser/recover-assoc-eq-missing-term.stderr +++ b/src/test/ui/parser/recover-assoc-eq-missing-term.stderr @@ -12,7 +12,7 @@ help: remove the `=` if `Item` is a type | LL - bar::<Item = >(); LL + bar::<Item >(); - | + | error: aborting due to previous error diff --git a/src/test/ui/parser/recover-for-loop-parens-around-head.stderr b/src/test/ui/parser/recover-for-loop-parens-around-head.stderr index fa55970dbd1..3bad29f20af 100644 --- a/src/test/ui/parser/recover-for-loop-parens-around-head.stderr +++ b/src/test/ui/parser/recover-for-loop-parens-around-head.stderr @@ -14,7 +14,7 @@ help: remove parentheses in `for` loop | LL - for ( elem in vec ) { LL + for elem in vec { - | + | error[E0308]: mismatched types --> $DIR/recover-for-loop-parens-around-head.rs:13:38 diff --git a/src/test/ui/parser/recover-from-bad-variant.stderr b/src/test/ui/parser/recover-from-bad-variant.stderr index 8cb71069bda..483312c16cc 100644 --- a/src/test/ui/parser/recover-from-bad-variant.stderr +++ b/src/test/ui/parser/recover-from-bad-variant.stderr @@ -12,7 +12,7 @@ help: if `Enum::Foo` is a function, use the arguments directly | LL - let x = Enum::Foo(a: 3, b: 4); LL + let x = Enum::Foo(3, 4); - | + | error[E0532]: expected tuple struct or tuple variant, found struct variant `Enum::Foo` --> $DIR/recover-from-bad-variant.rs:10:9 diff --git a/src/test/ui/parser/recover-labeled-non-block-expr.stderr b/src/test/ui/parser/recover-labeled-non-block-expr.stderr index 767389c4808..04fc1203e90 100644 --- a/src/test/ui/parser/recover-labeled-non-block-expr.stderr +++ b/src/test/ui/parser/recover-labeled-non-block-expr.stderr @@ -8,7 +8,7 @@ help: consider removing the label | LL - let _ = 'label: 1 + 1; LL + let _ = 1 + 1; - | + | error: expected `while`, `for`, `loop` or `{` after a label --> $DIR/recover-labeled-non-block-expr.rs:6:13 @@ -20,7 +20,7 @@ help: consider removing the label | LL - 'label: match () { () => {}, }; LL + match () { () => {}, }; - | + | error: expected `while`, `for`, `loop` or `{` after a label --> $DIR/recover-labeled-non-block-expr.rs:7:13 @@ -54,11 +54,10 @@ help: consider enclosing expression in a block | LL ~ let _i = 'label: { match x { LL | 0 => 42, -LL | 1 if false => break 'label 17, -LL | 1 => { -LL | if true { -LL | break 'label 13 ... +LL | _ => 1, +LL ~ } }; + | error: expected `while`, `for`, `loop` or `{` after a label --> $DIR/recover-labeled-non-block-expr.rs:26:24 diff --git a/src/test/ui/parser/trait-object-delimiters.stderr b/src/test/ui/parser/trait-object-delimiters.stderr index 75eeeda8646..6eb9c7238cb 100644 --- a/src/test/ui/parser/trait-object-delimiters.stderr +++ b/src/test/ui/parser/trait-object-delimiters.stderr @@ -14,7 +14,7 @@ help: remove the parentheses | LL - fn foo2(_: &dyn (Drop + AsRef<str>)) {} LL + fn foo2(_: &dyn Drop + AsRef<str>) {} - | + | error: expected parameter name, found `{` --> $DIR/trait-object-delimiters.rs:8:17 diff --git a/src/test/ui/parser/trait-object-trait-parens.stderr b/src/test/ui/parser/trait-object-trait-parens.stderr index a852337b6fe..7ee965bd2ba 100644 --- a/src/test/ui/parser/trait-object-trait-parens.stderr +++ b/src/test/ui/parser/trait-object-trait-parens.stderr @@ -29,7 +29,7 @@ help: use `dyn` | LL - let _: Box<(Obj) + (?Sized) + (for<'a> Trait<'a>)>; LL + let _: Box<dyn (Obj) + (?Sized) + (for<'a> Trait<'a>)>; - | + | error[E0225]: only auto traits can be used as additional traits in a trait object --> $DIR/trait-object-trait-parens.rs:8:35 @@ -54,7 +54,7 @@ help: use `dyn` | LL - let _: Box<?Sized + (for<'a> Trait<'a>) + (Obj)>; LL + let _: Box<dyn ?Sized + (for<'a> Trait<'a>) + (Obj)>; - | + | error[E0225]: only auto traits can be used as additional traits in a trait object --> $DIR/trait-object-trait-parens.rs:13:47 @@ -79,7 +79,7 @@ help: use `dyn` | LL - let _: Box<for<'a> Trait<'a> + (Obj) + (?Sized)>; LL + let _: Box<dyn for<'a> Trait<'a> + (Obj) + (?Sized)>; - | + | error[E0225]: only auto traits can be used as additional traits in a trait object --> $DIR/trait-object-trait-parens.rs:18:36 diff --git a/src/test/ui/parser/type-alias-where-fixable.stderr b/src/test/ui/parser/type-alias-where-fixable.stderr index 7ec1a965bae..abfeb62fcbb 100644 --- a/src/test/ui/parser/type-alias-where-fixable.stderr +++ b/src/test/ui/parser/type-alias-where-fixable.stderr @@ -10,7 +10,7 @@ help: move it to the end of the type declaration | LL - type Assoc where u32: Copy = (); LL + type Assoc = () where u32: Copy; - | + | warning: where clause not allowed here --> $DIR/type-alias-where-fixable.rs:18:17 @@ -23,7 +23,7 @@ help: move it to the end of the type declaration | LL - type Assoc2 where u32: Copy = () where i32: Copy; LL + type Assoc2 = () where i32: Copy, u32: Copy; - | + | warning: where clause not allowed here --> $DIR/type-alias-where-fixable.rs:26:17 @@ -36,7 +36,7 @@ help: move it to the end of the type declaration | LL - type Assoc2 where u32: Copy, i32: Copy = (); LL + type Assoc2 = () where u32: Copy, i32: Copy; - | + | warning: 3 warnings emitted diff --git a/src/test/ui/path-lookahead.stderr b/src/test/ui/path-lookahead.stderr index 8adf02b150b..2cc786fd947 100644 --- a/src/test/ui/path-lookahead.stderr +++ b/src/test/ui/path-lookahead.stderr @@ -13,7 +13,7 @@ help: remove these parentheses | LL - return (<T as ToString>::to_string(&arg)); LL + return <T as ToString>::to_string(&arg); - | + | warning: 1 warning emitted diff --git a/src/test/ui/pattern/for-loop-bad-item.stderr b/src/test/ui/pattern/for-loop-bad-item.stderr index 886d815d70b..ad737f7bd15 100644 --- a/src/test/ui/pattern/for-loop-bad-item.stderr +++ b/src/test/ui/pattern/for-loop-bad-item.stderr @@ -12,7 +12,7 @@ help: consider removing `&mut` from the pattern | LL - for ((_, _), (&mut c, _)) in &mut map { LL + for ((_, _), (c, _)) in &mut map { - | + | error[E0308]: mismatched types --> $DIR/for-loop-bad-item.rs:14:14 diff --git a/src/test/ui/pattern/usefulness/integer-ranges/exhaustiveness.stderr b/src/test/ui/pattern/usefulness/integer-ranges/exhaustiveness.stderr index fec54e89d63..f30ba05dff9 100644 --- a/src/test/ui/pattern/usefulness/integer-ranges/exhaustiveness.stderr +++ b/src/test/ui/pattern/usefulness/integer-ranges/exhaustiveness.stderr @@ -7,9 +7,8 @@ LL | m!(0u8, 0..255); = note: the matched value is of type `u8` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ match $s { $($t)+ => {} -LL ~ u8::MAX => todo!() } - | +LL | match $s { $($t)+ => {}, u8::MAX => todo!() } + | ++++++++++++++++++++ error[E0004]: non-exhaustive patterns: `u8::MAX` not covered --> $DIR/exhaustiveness.rs:48:8 @@ -20,9 +19,8 @@ LL | m!(0u8, 0..=254); = note: the matched value is of type `u8` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ match $s { $($t)+ => {} -LL ~ u8::MAX => todo!() } - | +LL | match $s { $($t)+ => {}, u8::MAX => todo!() } + | ++++++++++++++++++++ error[E0004]: non-exhaustive patterns: `0_u8` not covered --> $DIR/exhaustiveness.rs:49:8 @@ -33,9 +31,8 @@ LL | m!(0u8, 1..=255); = note: the matched value is of type `u8` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ match $s { $($t)+ => {} -LL ~ 0_u8 => todo!() } - | +LL | match $s { $($t)+ => {}, 0_u8 => todo!() } + | +++++++++++++++++ error[E0004]: non-exhaustive patterns: `42_u8` not covered --> $DIR/exhaustiveness.rs:50:8 @@ -46,9 +43,8 @@ LL | m!(0u8, 0..42 | 43..=255); = note: the matched value is of type `u8` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ match $s { $($t)+ => {} -LL ~ 42_u8 => todo!() } - | +LL | match $s { $($t)+ => {}, 42_u8 => todo!() } + | ++++++++++++++++++ error[E0004]: non-exhaustive patterns: `i8::MAX` not covered --> $DIR/exhaustiveness.rs:51:8 @@ -59,9 +55,8 @@ LL | m!(0i8, -128..127); = note: the matched value is of type `i8` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ match $s { $($t)+ => {} -LL ~ i8::MAX => todo!() } - | +LL | match $s { $($t)+ => {}, i8::MAX => todo!() } + | ++++++++++++++++++++ error[E0004]: non-exhaustive patterns: `i8::MAX` not covered --> $DIR/exhaustiveness.rs:52:8 @@ -72,9 +67,8 @@ LL | m!(0i8, -128..=126); = note: the matched value is of type `i8` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ match $s { $($t)+ => {} -LL ~ i8::MAX => todo!() } - | +LL | match $s { $($t)+ => {}, i8::MAX => todo!() } + | ++++++++++++++++++++ error[E0004]: non-exhaustive patterns: `i8::MIN` not covered --> $DIR/exhaustiveness.rs:53:8 @@ -85,9 +79,8 @@ LL | m!(0i8, -127..=127); = note: the matched value is of type `i8` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ match $s { $($t)+ => {} -LL ~ i8::MIN => todo!() } - | +LL | match $s { $($t)+ => {}, i8::MIN => todo!() } + | ++++++++++++++++++++ error[E0004]: non-exhaustive patterns: `0_i8` not covered --> $DIR/exhaustiveness.rs:54:11 @@ -111,9 +104,8 @@ LL | m!(0u128, 0..=ALMOST_MAX); = note: the matched value is of type `u128` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ match $s { $($t)+ => {} -LL ~ u128::MAX => todo!() } - | +LL | match $s { $($t)+ => {}, u128::MAX => todo!() } + | ++++++++++++++++++++++ error[E0004]: non-exhaustive patterns: `5_u128..=u128::MAX` not covered --> $DIR/exhaustiveness.rs:60:8 @@ -124,9 +116,8 @@ LL | m!(0u128, 0..=4); = note: the matched value is of type `u128` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ match $s { $($t)+ => {} -LL ~ 5_u128..=u128::MAX => todo!() } - | +LL | match $s { $($t)+ => {}, 5_u128..=u128::MAX => todo!() } + | +++++++++++++++++++++++++++++++ error[E0004]: non-exhaustive patterns: `0_u128` not covered --> $DIR/exhaustiveness.rs:61:8 @@ -137,9 +128,8 @@ LL | m!(0u128, 1..=u128::MAX); = note: the matched value is of type `u128` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ match $s { $($t)+ => {} -LL ~ 0_u128 => todo!() } - | +LL | match $s { $($t)+ => {}, 0_u128 => todo!() } + | +++++++++++++++++++ error[E0004]: non-exhaustive patterns: `(126_u8..=127_u8, false)` not covered --> $DIR/exhaustiveness.rs:69:11 diff --git a/src/test/ui/pattern/usefulness/integer-ranges/pointer-sized-int.deny.stderr b/src/test/ui/pattern/usefulness/integer-ranges/pointer-sized-int.deny.stderr index fa4146a7ad8..e3eb98ccdcd 100644 --- a/src/test/ui/pattern/usefulness/integer-ranges/pointer-sized-int.deny.stderr +++ b/src/test/ui/pattern/usefulness/integer-ranges/pointer-sized-int.deny.stderr @@ -39,9 +39,8 @@ LL | m!(0usize, 0..=usize::MAX); = help: add `#![feature(precise_pointer_size_matching)]` to the crate attributes to enable precise `usize` matching help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ match $s { $($t)+ => {} -LL ~ _ => todo!() } - | +LL | match $s { $($t)+ => {}, _ => todo!() } + | ++++++++++++++ error[E0004]: non-exhaustive patterns: `_` not covered --> $DIR/pointer-sized-int.rs:24:8 @@ -54,9 +53,8 @@ LL | m!(0usize, 0..5 | 5..=usize::MAX); = help: add `#![feature(precise_pointer_size_matching)]` to the crate attributes to enable precise `usize` matching help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ match $s { $($t)+ => {} -LL ~ _ => todo!() } - | +LL | match $s { $($t)+ => {}, _ => todo!() } + | ++++++++++++++ error[E0004]: non-exhaustive patterns: `_` not covered --> $DIR/pointer-sized-int.rs:26:8 @@ -69,9 +67,8 @@ LL | m!(0usize, 0..usize::MAX | usize::MAX); = help: add `#![feature(precise_pointer_size_matching)]` to the crate attributes to enable precise `usize` matching help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ match $s { $($t)+ => {} -LL ~ _ => todo!() } - | +LL | match $s { $($t)+ => {}, _ => todo!() } + | ++++++++++++++ error[E0004]: non-exhaustive patterns: `(_, _)` not covered --> $DIR/pointer-sized-int.rs:28:8 @@ -82,9 +79,8 @@ LL | m!((0usize, true), (0..5, true) | (5..=usize::MAX, true) | (0..=usize:: = note: the matched value is of type `(usize, bool)` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ match $s { $($t)+ => {} -LL ~ (_, _) => todo!() } - | +LL | match $s { $($t)+ => {}, (_, _) => todo!() } + | +++++++++++++++++++ error[E0004]: non-exhaustive patterns: `_` not covered --> $DIR/pointer-sized-int.rs:31:8 @@ -97,9 +93,8 @@ LL | m!(0isize, isize::MIN..=isize::MAX); = help: add `#![feature(precise_pointer_size_matching)]` to the crate attributes to enable precise `isize` matching help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ match $s { $($t)+ => {} -LL ~ _ => todo!() } - | +LL | match $s { $($t)+ => {}, _ => todo!() } + | ++++++++++++++ error[E0004]: non-exhaustive patterns: `_` not covered --> $DIR/pointer-sized-int.rs:33:8 @@ -112,9 +107,8 @@ LL | m!(0isize, isize::MIN..5 | 5..=isize::MAX); = help: add `#![feature(precise_pointer_size_matching)]` to the crate attributes to enable precise `isize` matching help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ match $s { $($t)+ => {} -LL ~ _ => todo!() } - | +LL | match $s { $($t)+ => {}, _ => todo!() } + | ++++++++++++++ error[E0004]: non-exhaustive patterns: `_` not covered --> $DIR/pointer-sized-int.rs:35:8 @@ -127,9 +121,8 @@ LL | m!(0isize, isize::MIN..isize::MAX | isize::MAX); = help: add `#![feature(precise_pointer_size_matching)]` to the crate attributes to enable precise `isize` matching help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ match $s { $($t)+ => {} -LL ~ _ => todo!() } - | +LL | match $s { $($t)+ => {}, _ => todo!() } + | ++++++++++++++ error[E0004]: non-exhaustive patterns: `(_, _)` not covered --> $DIR/pointer-sized-int.rs:37:8 @@ -140,9 +133,8 @@ LL | m!((0isize, true), (isize::MIN..5, true) = note: the matched value is of type `(isize, bool)` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ match $s { $($t)+ => {} -LL ~ (_, _) => todo!() } - | +LL | match $s { $($t)+ => {}, (_, _) => todo!() } + | +++++++++++++++++++ error[E0004]: non-exhaustive patterns: `_` not covered --> $DIR/pointer-sized-int.rs:41:11 diff --git a/src/test/ui/pattern/usefulness/non-exhaustive-match.stderr b/src/test/ui/pattern/usefulness/non-exhaustive-match.stderr index e7fa6a7814f..89b4e06efda 100644 --- a/src/test/ui/pattern/usefulness/non-exhaustive-match.stderr +++ b/src/test/ui/pattern/usefulness/non-exhaustive-match.stderr @@ -12,8 +12,8 @@ LL | enum T { A, B } = note: the matched value is of type `T` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL | match x { T::B => { } A => todo!() } - | ++++++++++++ +LL | match x { T::B => { }, A => todo!() } + | ++++++++++++++ error[E0004]: non-exhaustive patterns: `false` not covered --> $DIR/non-exhaustive-match.rs:8:11 diff --git a/src/test/ui/pattern/usefulness/tuple-struct-nonexhaustive.stderr b/src/test/ui/pattern/usefulness/tuple-struct-nonexhaustive.stderr index fc0430d06fa..e2a65ff8524 100644 --- a/src/test/ui/pattern/usefulness/tuple-struct-nonexhaustive.stderr +++ b/src/test/ui/pattern/usefulness/tuple-struct-nonexhaustive.stderr @@ -12,7 +12,7 @@ LL | struct Foo(isize, isize); = note: the matched value is of type `Foo` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ Foo(2, b) => println!("{}", b) +LL ~ Foo(2, b) => println!("{}", b), LL + Foo(_, _) => todo!() | diff --git a/src/test/ui/privacy/private-in-public-warn.stderr b/src/test/ui/privacy/private-in-public-warn.stderr index a72d8247792..5f2c4935bad 100644 --- a/src/test/ui/privacy/private-in-public-warn.stderr +++ b/src/test/ui/privacy/private-in-public-warn.stderr @@ -320,7 +320,7 @@ help: the bound will not be checked when the type alias is used, and should be r | LL - pub type Alias<T: PrivTr> = T; LL + pub type Alias<T> = T; - | + | warning: where clauses are not enforced in type aliases --> $DIR/private-in-public-warn.rs:74:29 @@ -332,7 +332,7 @@ help: the clause will not be checked when the type alias is used, and should be | LL - pub type Alias<T> where T: PrivTr = T; LL + pub type Alias<T> = T; - | + | error: aborting due to 34 previous errors; 2 warnings emitted diff --git a/src/test/ui/reachable/unreachable-code.stderr b/src/test/ui/reachable/unreachable-code.stderr index 4b951263dbd..cb1b760c282 100644 --- a/src/test/ui/reachable/unreachable-code.stderr +++ b/src/test/ui/reachable/unreachable-code.stderr @@ -3,7 +3,7 @@ error: unreachable statement | LL | loop{} | ------ any code following this expression is unreachable -LL | +LL | LL | let a = 3; | ^^^^^^^^^^ unreachable statement | diff --git a/src/test/ui/recursion/recursive-static-definition.stderr b/src/test/ui/recursion/recursive-static-definition.stderr index be4f09f9286..d4d2c8c3d9c 100644 --- a/src/test/ui/recursion/recursive-static-definition.stderr +++ b/src/test/ui/recursion/recursive-static-definition.stderr @@ -10,7 +10,14 @@ note: ...which requires const-evaluating + checking `FOO`... LL | pub static FOO: u32 = FOO; | ^^^ = note: ...which again requires const-evaluating + checking `FOO`, completing the cycle - = note: cycle used when running analysis passes on this crate +note: cycle used when linting top-level module + --> $DIR/recursive-static-definition.rs:1:1 + | +LL | / pub static FOO: u32 = FOO; +LL | | +LL | | +LL | | fn main() {} + | |____________^ error: aborting due to previous error diff --git a/src/test/ui/resolve/enums-are-namespaced-xc.stderr b/src/test/ui/resolve/enums-are-namespaced-xc.stderr index 1d26a2c0058..6448e596d56 100644 --- a/src/test/ui/resolve/enums-are-namespaced-xc.stderr +++ b/src/test/ui/resolve/enums-are-namespaced-xc.stderr @@ -12,7 +12,7 @@ help: if you import `A`, refer to it directly | LL - let _ = namespaced_enums::A; LL + let _ = A; - | + | error[E0425]: cannot find function, tuple struct or tuple variant `B` in crate `namespaced_enums` --> $DIR/enums-are-namespaced-xc.rs:7:31 @@ -28,7 +28,7 @@ help: if you import `B`, refer to it directly | LL - let _ = namespaced_enums::B(10); LL + let _ = B(10); - | + | error[E0422]: cannot find struct, variant or union type `C` in crate `namespaced_enums` --> $DIR/enums-are-namespaced-xc.rs:9:31 @@ -44,7 +44,7 @@ help: if you import `C`, refer to it directly | LL - let _ = namespaced_enums::C { a: 10 }; LL + let _ = C { a: 10 }; - | + | error: aborting due to 3 previous errors diff --git a/src/test/ui/resolve/issue-23716.stderr b/src/test/ui/resolve/issue-23716.stderr index e7bebfbbcb5..8b89c350c84 100644 --- a/src/test/ui/resolve/issue-23716.stderr +++ b/src/test/ui/resolve/issue-23716.stderr @@ -3,7 +3,7 @@ error[E0530]: function parameters cannot shadow statics | LL | static foo: i32 = 0; | -------------------- the static `foo` is defined here -LL | +LL | LL | fn bar(foo: i32) {} | ^^^ cannot be named the same as a static @@ -12,7 +12,7 @@ error[E0530]: function parameters cannot shadow statics | LL | use self::submod::answer; | -------------------- the static `answer` is imported here -LL | +LL | LL | fn question(answer: i32) {} | ^^^^^^ cannot be named the same as a static diff --git a/src/test/ui/resolve/issue-24968.rs b/src/test/ui/resolve/issue-24968.rs index 916b48205dc..19e16abcee3 100644 --- a/src/test/ui/resolve/issue-24968.rs +++ b/src/test/ui/resolve/issue-24968.rs @@ -1,5 +1,30 @@ +// Also includes more Self usages per #93796 + fn foo(_: Self) { //~^ ERROR cannot find type `Self` } +fn foo2() { + let x: Self; + //~^ ERROR cannot find type `Self` +} + +type Foo<T> +where + Self: Clone, +//~^ ERROR cannot find type `Self` += Vec<T>; + +const FOO: Self = 0; +//~^ ERROR cannot find type `Self` + +const FOO2: u32 = Self::bar(); +//~^ ERROR failed to resolve: `Self` + +static FOO_S: Self = 0; +//~^ ERROR cannot find type `Self` + +static FOO_S2: u32 = Self::bar(); +//~^ ERROR failed to resolve: `Self` + fn main() {} diff --git a/src/test/ui/resolve/issue-24968.stderr b/src/test/ui/resolve/issue-24968.stderr index c891952c42b..7e539d25804 100644 --- a/src/test/ui/resolve/issue-24968.stderr +++ b/src/test/ui/resolve/issue-24968.stderr @@ -1,9 +1,57 @@ +error[E0433]: failed to resolve: `Self` is only available in impls, traits, and type definitions + --> $DIR/issue-24968.rs:21:19 + | +LL | const FOO2: u32 = Self::bar(); + | ^^^^ `Self` is only available in impls, traits, and type definitions + +error[E0433]: failed to resolve: `Self` is only available in impls, traits, and type definitions + --> $DIR/issue-24968.rs:27:22 + | +LL | static FOO_S2: u32 = Self::bar(); + | ^^^^ `Self` is only available in impls, traits, and type definitions + error[E0411]: cannot find type `Self` in this scope - --> $DIR/issue-24968.rs:1:11 + --> $DIR/issue-24968.rs:3:11 | LL | fn foo(_: Self) { - | ^^^^ `Self` is only available in impls, traits, and type definitions + | --- ^^^^ `Self` is only available in impls, traits, and type definitions + | | + | `Self` not allowed in a function + +error[E0411]: cannot find type `Self` in this scope + --> $DIR/issue-24968.rs:8:12 + | +LL | fn foo2() { + | ---- `Self` not allowed in a function +LL | let x: Self; + | ^^^^ `Self` is only available in impls, traits, and type definitions + +error[E0411]: cannot find type `Self` in this scope + --> $DIR/issue-24968.rs:14:5 + | +LL | type Foo<T> + | --- `Self` not allowed in a type alias +LL | where +LL | Self: Clone, + | ^^^^ `Self` is only available in impls, traits, and type definitions + +error[E0411]: cannot find type `Self` in this scope + --> $DIR/issue-24968.rs:18:12 + | +LL | const FOO: Self = 0; + | --- ^^^^ `Self` is only available in impls, traits, and type definitions + | | + | `Self` not allowed in a constant item + +error[E0411]: cannot find type `Self` in this scope + --> $DIR/issue-24968.rs:24:15 + | +LL | static FOO_S: Self = 0; + | ----- ^^^^ `Self` is only available in impls, traits, and type definitions + | | + | `Self` not allowed in a static item -error: aborting due to previous error +error: aborting due to 7 previous errors -For more information about this error, try `rustc --explain E0411`. +Some errors have detailed explanations: E0411, E0433. +For more information about an error, try `rustc --explain E0411`. diff --git a/src/test/ui/resolve/issue-50599.stderr b/src/test/ui/resolve/issue-50599.stderr index f0cb784f56c..910deddd8bc 100644 --- a/src/test/ui/resolve/issue-50599.stderr +++ b/src/test/ui/resolve/issue-50599.stderr @@ -14,7 +14,7 @@ help: if you import `LOG10_2`, refer to it directly | LL - const M: usize = (f64::from(N) * std::f64::LOG10_2) as usize; LL + const M: usize = (f64::from(N) * LOG10_2) as usize; - | + | error[E0080]: evaluation of constant value failed --> $DIR/issue-50599.rs:4:29 diff --git a/src/test/ui/resolve/issue-81508.stderr b/src/test/ui/resolve/issue-81508.stderr index 15555631b90..7258174ba89 100644 --- a/src/test/ui/resolve/issue-81508.stderr +++ b/src/test/ui/resolve/issue-81508.stderr @@ -3,7 +3,7 @@ error[E0433]: failed to resolve: use of undeclared type `Baz` | LL | let Baz: &str = ""; | --- help: `Baz` is defined here, but is not a type -LL | +LL | LL | println!("{}", Baz::Bar); | ^^^ use of undeclared type `Baz` diff --git a/src/test/ui/resolve/levenshtein.stderr b/src/test/ui/resolve/levenshtein.stderr index a7f10f7719e..249a7e53d45 100644 --- a/src/test/ui/resolve/levenshtein.stderr +++ b/src/test/ui/resolve/levenshtein.stderr @@ -9,7 +9,7 @@ error[E0412]: cannot find type `Baz` in this scope | LL | enum Bar { } | -------- similarly named enum `Bar` defined here -LL | +LL | LL | type A = Baz; // Misspelled type name. | ^^^ help: an enum with a similar name exists: `Bar` diff --git a/src/test/ui/resolve/missing-in-namespace.stderr b/src/test/ui/resolve/missing-in-namespace.stderr index 338a5423aa4..3d49b2e5dfc 100644 --- a/src/test/ui/resolve/missing-in-namespace.stderr +++ b/src/test/ui/resolve/missing-in-namespace.stderr @@ -12,7 +12,7 @@ help: if you import `HashMap`, refer to it directly | LL - let _map = std::hahmap::HashMap::new(); LL + let _map = HashMap::new(); - | + | error: aborting due to previous error diff --git a/src/test/ui/resolve/privacy-enum-ctor.stderr b/src/test/ui/resolve/privacy-enum-ctor.stderr index ed89170fd8a..81d8a34881c 100644 --- a/src/test/ui/resolve/privacy-enum-ctor.stderr +++ b/src/test/ui/resolve/privacy-enum-ctor.stderr @@ -109,7 +109,7 @@ help: if you import `E`, refer to it directly | LL - let _: E = m::E; LL + let _: E = E; - | + | error[E0423]: expected value, found struct variant `m::E::Struct` --> $DIR/privacy-enum-ctor.rs:45:16 @@ -347,7 +347,7 @@ help: `Z::Unit` is a unit variant, you need to write it without the parentheses | LL - let _ = Z::Unit(); LL + let _ = Z::Unit; - | + | error[E0308]: mismatched types --> $DIR/privacy-enum-ctor.rs:43:16 @@ -382,7 +382,7 @@ help: `m::E::Unit` is a unit variant, you need to write it without the parenthes | LL - let _: E = m::E::Unit(); LL + let _: E = m::E::Unit; - | + | error[E0308]: mismatched types --> $DIR/privacy-enum-ctor.rs:51:16 @@ -417,7 +417,7 @@ help: `E::Unit` is a unit variant, you need to write it without the parentheses | LL - let _: E = E::Unit(); LL + let _: E = E::Unit; - | + | error: aborting due to 23 previous errors diff --git a/src/test/ui/resolve/resolve-conflict-item-vs-import.stderr b/src/test/ui/resolve/resolve-conflict-item-vs-import.stderr index 922753a00db..5e5c9f6b3d8 100644 --- a/src/test/ui/resolve/resolve-conflict-item-vs-import.stderr +++ b/src/test/ui/resolve/resolve-conflict-item-vs-import.stderr @@ -3,7 +3,7 @@ error[E0255]: the name `transmute` is defined multiple times | LL | use std::mem::transmute; | ------------------- previous import of the value `transmute` here -LL | +LL | LL | fn transmute() {} | ^^^^^^^^^^^^^^ `transmute` redefined here | diff --git a/src/test/ui/resolve/resolve-conflict-type-vs-import.stderr b/src/test/ui/resolve/resolve-conflict-type-vs-import.stderr index b63495458a0..198ef10311e 100644 --- a/src/test/ui/resolve/resolve-conflict-type-vs-import.stderr +++ b/src/test/ui/resolve/resolve-conflict-type-vs-import.stderr @@ -3,7 +3,7 @@ error[E0255]: the name `Iter` is defined multiple times | LL | use std::slice::Iter; | ---------------- previous import of the type `Iter` here -LL | +LL | LL | struct Iter; | ^^^^^^^^^^^^ `Iter` redefined here | diff --git a/src/test/ui/resolve/resolve-primitive-fallback.stderr b/src/test/ui/resolve/resolve-primitive-fallback.stderr index fcbc28475f9..f0eb1a4f487 100644 --- a/src/test/ui/resolve/resolve-primitive-fallback.stderr +++ b/src/test/ui/resolve/resolve-primitive-fallback.stderr @@ -18,7 +18,7 @@ help: if you import `u8`, refer to it directly | LL - let _: ::u8; LL + let _: u8; - | + | error[E0061]: this function takes 0 arguments but 1 argument was supplied --> $DIR/resolve-primitive-fallback.rs:3:5 diff --git a/src/test/ui/rfc-1937-termination-trait/termination-trait-test-wrong-type.stderr b/src/test/ui/rfc-1937-termination-trait/termination-trait-test-wrong-type.stderr index 96a899ecca5..6086723b5c4 100644 --- a/src/test/ui/rfc-1937-termination-trait/termination-trait-test-wrong-type.stderr +++ b/src/test/ui/rfc-1937-termination-trait/termination-trait-test-wrong-type.stderr @@ -1,4 +1,4 @@ -error[E0277]: `main` has invalid return type `Result<f32, ParseFloatError>` +error[E0277]: `main` has invalid return type `f32` --> $DIR/termination-trait-test-wrong-type.rs:6:1 | LL | #[test] @@ -8,11 +8,8 @@ LL | | "0".parse() LL | | } | |_^ `main` can only return types that implement `Termination` | - = help: the trait `Termination` is not implemented for `Result<f32, ParseFloatError>` - = help: the following other types implement trait `Termination`: - Result<!, E> - Result<(), E> - Result<Infallible, E> + = help: the trait `Termination` is not implemented for `f32` + = note: required because of the requirements on the impl of `Termination` for `Result<f32, ParseFloatError>` note: required by a bound in `assert_test_result` --> $SRC_DIR/test/src/lib.rs:LL:COL | diff --git a/src/test/ui/rfc-2497-if-let-chains/disallowed-positions.stderr b/src/test/ui/rfc-2497-if-let-chains/disallowed-positions.stderr index 00da9d26057..dfc7fdc1ed2 100644 --- a/src/test/ui/rfc-2497-if-let-chains/disallowed-positions.stderr +++ b/src/test/ui/rfc-2497-if-let-chains/disallowed-positions.stderr @@ -982,7 +982,7 @@ help: consider removing the borrow | LL - if &let 0 = 0 {} LL + if let 0 = 0 {} - | + | error[E0614]: type `bool` cannot be dereferenced --> $DIR/disallowed-positions.rs:94:8 @@ -1149,7 +1149,7 @@ help: consider removing the `&&` | LL - if let Range { start: true, end } = t..&&false {} LL + if let Range { start: true, end } = t..false {} - | + | error[E0308]: mismatched types --> $DIR/disallowed-positions.rs:144:8 @@ -1178,7 +1178,7 @@ help: consider removing the borrow | LL - while &let 0 = 0 {} LL + while let 0 = 0 {} - | + | error[E0614]: type `bool` cannot be dereferenced --> $DIR/disallowed-positions.rs:158:11 @@ -1345,7 +1345,7 @@ help: consider removing the `&&` | LL - while let Range { start: true, end } = t..&&false {} LL + while let Range { start: true, end } = t..false {} - | + | error[E0308]: mismatched types --> $DIR/disallowed-positions.rs:208:11 diff --git a/src/test/ui/rfc-2632-const-trait-impl/const-impl-recovery.stderr b/src/test/ui/rfc-2632-const-trait-impl/const-impl-recovery.stderr index 79d170cdd1b..709084c86e0 100644 --- a/src/test/ui/rfc-2632-const-trait-impl/const-impl-recovery.stderr +++ b/src/test/ui/rfc-2632-const-trait-impl/const-impl-recovery.stderr @@ -8,7 +8,7 @@ help: you might have meant to write a const trait impl | LL - const impl Foo for i32 {} LL + impl const Foo for i32 {} - | + | error: expected identifier, found keyword `impl` --> $DIR/const-impl-recovery.rs:9:7 @@ -20,7 +20,7 @@ help: you might have meant to write a const trait impl | LL - const impl<T: Foo> Bar for T {} LL + impl<T: Foo> const Bar for T {} - | + | error: aborting due to 2 previous errors diff --git a/src/test/ui/rfcs/rfc-2528-type-changing-struct-update/coerce-in-base-expr.rs b/src/test/ui/rfcs/rfc-2528-type-changing-struct-update/coerce-in-base-expr.rs new file mode 100644 index 00000000000..75e48bf4a48 --- /dev/null +++ b/src/test/ui/rfcs/rfc-2528-type-changing-struct-update/coerce-in-base-expr.rs @@ -0,0 +1,28 @@ +// check-pass + +#![feature(type_changing_struct_update)] +#![allow(incomplete_features)] + +use std::any::Any; + +struct Foo<A, B: ?Sized, C: ?Sized> { + a: A, + b: Box<B>, + c: Box<C>, +} + +struct B; +struct C; + +fn main() { + let y = Foo::<usize, dyn Any, dyn Any> { + a: 0, + b: Box::new(B), + ..Foo { + a: 0, + b: Box::new(B), + // C needs to be told to coerce to `Box<dyn Any>` + c: Box::new(C), + } + }; +} diff --git a/src/test/ui/rfcs/rfc-2528-type-changing-struct-update/type-generic-update.rs b/src/test/ui/rfcs/rfc-2528-type-changing-struct-update/type-generic-update.rs index d8b1396a692..dae1241d35a 100644 --- a/src/test/ui/rfcs/rfc-2528-type-changing-struct-update/type-generic-update.rs +++ b/src/test/ui/rfcs/rfc-2528-type-changing-struct-update/type-generic-update.rs @@ -50,7 +50,6 @@ fn fail_update() { let m3 = Machine::<i32, i32> { ..m1 //~^ ERROR mismatched types [E0308] - //~| ERROR mismatched types [E0308] }; } diff --git a/src/test/ui/rfcs/rfc-2528-type-changing-struct-update/type-generic-update.stderr b/src/test/ui/rfcs/rfc-2528-type-changing-struct-update/type-generic-update.stderr index fa8d6ee23d5..6f31b1a9620 100644 --- a/src/test/ui/rfcs/rfc-2528-type-changing-struct-update/type-generic-update.stderr +++ b/src/test/ui/rfcs/rfc-2528-type-changing-struct-update/type-generic-update.stderr @@ -2,29 +2,20 @@ error[E0308]: mismatched types --> $DIR/type-generic-update.rs:46:11 | LL | ..m1 - | ^^ field type mismatch: Machine.state + | ^^ expected `i32`, found `f64` | - = note: expected type `i32` - found type `f64` + = note: expected struct `Machine<'_, i32, _>` + found struct `Machine<'_, f64, _>` error[E0308]: mismatched types --> $DIR/type-generic-update.rs:51:11 | LL | ..m1 - | ^^ field type mismatch: Machine.state + | ^^ expected `i32`, found `f64` | - = note: expected type `i32` - found type `f64` + = note: expected struct `Machine<'_, i32, i32>` + found struct `Machine<'_, f64, f64>` -error[E0308]: mismatched types - --> $DIR/type-generic-update.rs:51:11 - | -LL | ..m1 - | ^^ field type mismatch: Machine.message - | - = note: expected type `i32` - found type `f64` - -error: aborting due to 3 previous errors +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/rust-2018/edition-lint-infer-outlives-multispan.stderr b/src/test/ui/rust-2018/edition-lint-infer-outlives-multispan.stderr index b8eba3e075d..251d74094ca 100644 --- a/src/test/ui/rust-2018/edition-lint-infer-outlives-multispan.stderr +++ b/src/test/ui/rust-2018/edition-lint-infer-outlives-multispan.stderr @@ -13,7 +13,7 @@ help: remove these bounds | LL - struct TeeOutlivesAyIsDebugBee<'a, 'b, T: 'a + Debug + 'b> { LL + struct TeeOutlivesAyIsDebugBee<'a, 'b, T: Debug> { - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:18:61 @@ -25,7 +25,7 @@ help: remove these bounds | LL - struct TeeWhereOutlivesAyIsDebugBee<'a, 'b, T> where T: 'a + Debug + 'b { LL + struct TeeWhereOutlivesAyIsDebugBee<'a, 'b, T> where T: Debug { - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:23:53 @@ -37,7 +37,7 @@ help: remove these bounds | LL - struct TeeYooOutlivesAyIsDebugBee<'a, 'b, T, U: 'a + Debug + 'b> { LL + struct TeeYooOutlivesAyIsDebugBee<'a, 'b, T, U: Debug> { - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:29:48 @@ -49,7 +49,7 @@ help: remove these bounds | LL - struct TeeOutlivesAyYooBeeIsDebug<'a, 'b, T: 'a, U: 'b + Debug> { LL + struct TeeOutlivesAyYooBeeIsDebug<'a, 'b, T, U: Debug> { - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:35:48 @@ -61,7 +61,7 @@ help: remove these bounds | LL - struct TeeOutlivesAyYooIsDebugBee<'a, 'b, T: 'a, U: Debug + 'b> { LL + struct TeeOutlivesAyYooIsDebugBee<'a, 'b, T, U: Debug> { - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:41:46 @@ -73,7 +73,7 @@ help: remove these bounds | LL - struct TeeOutlivesAyYooWhereBee<'a, 'b, T: 'a, U> where U: 'b { LL + struct TeeOutlivesAyYooWhereBee<'a, 'b, T, U> { - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:47:67 @@ -85,7 +85,7 @@ help: remove these bounds | LL - struct TeeYooWhereOutlivesAyIsDebugBee<'a, 'b, T, U> where U: 'a + Debug + 'b { LL + struct TeeYooWhereOutlivesAyIsDebugBee<'a, 'b, T, U> where U: Debug { - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:53:53 @@ -97,7 +97,7 @@ help: remove these bounds | LL - struct TeeOutlivesAyYooWhereBeeIsDebug<'a, 'b, T: 'a, U> where U: 'b + Debug { LL + struct TeeOutlivesAyYooWhereBeeIsDebug<'a, 'b, T, U> where U: Debug { - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:59:53 @@ -109,7 +109,7 @@ help: remove these bounds | LL - struct TeeOutlivesAyYooWhereIsDebugBee<'a, 'b, T: 'a, U> where U: Debug + 'b { LL + struct TeeOutlivesAyYooWhereIsDebugBee<'a, 'b, T, U> where U: Debug { - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:65:69 @@ -121,7 +121,7 @@ help: remove these bounds | LL - struct TeeWhereOutlivesAyYooWhereBeeIsDebug<'a, 'b, T, U> where T: 'a, U: 'b + Debug { LL + struct TeeWhereOutlivesAyYooWhereBeeIsDebug<'a, 'b, T, U> where U: Debug { - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:71:69 @@ -133,7 +133,7 @@ help: remove these bounds | LL - struct TeeWhereOutlivesAyYooWhereIsDebugBee<'a, 'b, T, U> where T: 'a, U: Debug + 'b { LL + struct TeeWhereOutlivesAyYooWhereIsDebugBee<'a, 'b, T, U> where U: Debug { - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:77:38 @@ -145,7 +145,7 @@ help: remove these bounds | LL - struct BeeOutlivesAyTeeBee<'a, 'b: 'a, T: 'b> { LL + struct BeeOutlivesAyTeeBee<'a, 'b, T> { - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:82:40 @@ -157,7 +157,7 @@ help: remove these bounds | LL - struct BeeOutlivesAyTeeAyBee<'a, 'b: 'a, T: 'a + 'b> { LL + struct BeeOutlivesAyTeeAyBee<'a, 'b, T> { - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:87:55 @@ -169,7 +169,7 @@ help: remove these bounds | LL - struct BeeOutlivesAyTeeOutlivesAyIsDebugBee<'a, 'b: 'a, T: 'a + Debug + 'b> { LL + struct BeeOutlivesAyTeeOutlivesAyIsDebugBee<'a, 'b, T: Debug> { - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:92:68 @@ -181,7 +181,7 @@ help: remove these bounds | LL - struct BeeWhereAyTeeWhereOutlivesAyIsDebugBee<'a, 'b, T> where 'b: 'a, T: 'a + Debug + 'b { LL + struct BeeWhereAyTeeWhereOutlivesAyIsDebugBee<'a, 'b, T> where T: Debug { - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:97:58 @@ -193,7 +193,7 @@ help: remove these bounds | LL - struct BeeOutlivesAyTeeYooOutlivesAyIsDebugBee<'a, 'b: 'a, T, U: 'a + Debug + 'b> { LL + struct BeeOutlivesAyTeeYooOutlivesAyIsDebugBee<'a, 'b, T, U: Debug> { - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:104:18 @@ -205,7 +205,7 @@ help: remove these bounds | LL - where U: 'a + Debug + 'b, 'b: 'a LL + where U: Debug, - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:115:47 @@ -217,7 +217,7 @@ help: remove these bounds | LL - struct TeeOutlivesAyIsDebugBee<'a, 'b, T: 'a + Debug + 'b>(&'a &'b T); LL + struct TeeOutlivesAyIsDebugBee<'a, 'b, T: Debug>(&'a &'b T); - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:118:72 @@ -229,7 +229,7 @@ help: remove these bounds | LL - struct TeeWhereOutlivesAyIsDebugBee<'a, 'b, T>(&'a &'b T) where T: 'a + Debug + 'b; LL + struct TeeWhereOutlivesAyIsDebugBee<'a, 'b, T>(&'a &'b T) where T: Debug; - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:121:53 @@ -241,7 +241,7 @@ help: remove these bounds | LL - struct TeeYooOutlivesAyIsDebugBee<'a, 'b, T, U: 'a + Debug + 'b>(T, &'a &'b U); LL + struct TeeYooOutlivesAyIsDebugBee<'a, 'b, T, U: Debug>(T, &'a &'b U); - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:124:48 @@ -253,7 +253,7 @@ help: remove these bounds | LL - struct TeeOutlivesAyYooBeeIsDebug<'a, 'b, T: 'a, U: 'b + Debug>(&'a T, &'b U); LL + struct TeeOutlivesAyYooBeeIsDebug<'a, 'b, T, U: Debug>(&'a T, &'b U); - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:127:48 @@ -265,7 +265,7 @@ help: remove these bounds | LL - struct TeeOutlivesAyYooIsDebugBee<'a, 'b, T: 'a, U: Debug + 'b>(&'a T, &'b U); LL + struct TeeOutlivesAyYooIsDebugBee<'a, 'b, T, U: Debug>(&'a T, &'b U); - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:130:46 @@ -277,7 +277,7 @@ help: remove these bounds | LL - struct TeeOutlivesAyYooWhereBee<'a, 'b, T: 'a, U>(&'a T, &'b U) where U: 'b; LL + struct TeeOutlivesAyYooWhereBee<'a, 'b, T, U>(&'a T, &'b U) ; - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:133:81 @@ -289,7 +289,7 @@ help: remove these bounds | LL - struct TeeYooWhereOutlivesAyIsDebugBee<'a, 'b, T, U>(T, &'a &'b U) where U: 'a + Debug + 'b; LL + struct TeeYooWhereOutlivesAyIsDebugBee<'a, 'b, T, U>(T, &'a &'b U) where U: Debug; - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:136:53 @@ -301,7 +301,7 @@ help: remove these bounds | LL - struct TeeOutlivesAyYooWhereBeeIsDebug<'a, 'b, T: 'a, U>(&'a T, &'b U) where U: 'b + Debug; LL + struct TeeOutlivesAyYooWhereBeeIsDebug<'a, 'b, T, U>(&'a T, &'b U) where U: Debug; - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:139:53 @@ -313,7 +313,7 @@ help: remove these bounds | LL - struct TeeOutlivesAyYooWhereIsDebugBee<'a, 'b, T: 'a, U>(&'a T, &'b U) where U: Debug + 'b; LL + struct TeeOutlivesAyYooWhereIsDebugBee<'a, 'b, T, U>(&'a T, &'b U) where U: Debug; - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:142:75 @@ -325,7 +325,7 @@ help: remove these bounds | LL - struct TeeWhereAyYooWhereBeeIsDebug<'a, 'b, T, U>(&'a T, &'b U) where T: 'a, U: 'b + Debug; LL + struct TeeWhereAyYooWhereBeeIsDebug<'a, 'b, T, U>(&'a T, &'b U) where U: Debug; - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:145:75 @@ -337,7 +337,7 @@ help: remove these bounds | LL - struct TeeWhereAyYooWhereIsDebugBee<'a, 'b, T, U>(&'a T, &'b U) where T: 'a, U: Debug + 'b; LL + struct TeeWhereAyYooWhereIsDebugBee<'a, 'b, T, U>(&'a T, &'b U) where U: Debug; - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:148:38 @@ -349,7 +349,7 @@ help: remove these bounds | LL - struct BeeOutlivesAyTeeBee<'a, 'b: 'a, T: 'b>(&'a &'b T); LL + struct BeeOutlivesAyTeeBee<'a, 'b, T>(&'a &'b T); - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:151:40 @@ -361,7 +361,7 @@ help: remove these bounds | LL - struct BeeOutlivesAyTeeAyBee<'a, 'b: 'a, T: 'a + 'b>(&'a &'b T); LL + struct BeeOutlivesAyTeeAyBee<'a, 'b, T>(&'a &'b T); - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:154:55 @@ -373,7 +373,7 @@ help: remove these bounds | LL - struct BeeOutlivesAyTeeOutlivesAyIsDebugBee<'a, 'b: 'a, T: 'a + Debug + 'b>(&'a &'b T); LL + struct BeeOutlivesAyTeeOutlivesAyIsDebugBee<'a, 'b, T: Debug>(&'a &'b T); - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:157:71 @@ -385,7 +385,7 @@ help: remove these bounds | LL - struct BeeWhereAyTeeWhereAyIsDebugBee<'a, 'b, T>(&'a &'b T) where 'b: 'a, T: 'a + Debug + 'b; LL + struct BeeWhereAyTeeWhereAyIsDebugBee<'a, 'b, T>(&'a &'b T) where T: Debug; - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:160:58 @@ -397,7 +397,7 @@ help: remove these bounds | LL - struct BeeOutlivesAyTeeYooOutlivesAyIsDebugBee<'a, 'b: 'a, T, U: 'a + Debug + 'b>(T, &'a &'b U); LL + struct BeeOutlivesAyTeeYooOutlivesAyIsDebugBee<'a, 'b, T, U: Debug>(T, &'a &'b U); - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:164:18 @@ -409,7 +409,7 @@ help: remove these bounds | LL - where U: 'a + Debug + 'b, 'b: 'a; LL + where U: Debug, ; - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:171:45 @@ -421,7 +421,7 @@ help: remove these bounds | LL - enum TeeOutlivesAyIsDebugBee<'a, 'b, T: 'a + Debug + 'b> { LL + enum TeeOutlivesAyIsDebugBee<'a, 'b, T: Debug> { - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:176:59 @@ -433,7 +433,7 @@ help: remove these bounds | LL - enum TeeWhereOutlivesAyIsDebugBee<'a, 'b, T> where T: 'a + Debug + 'b { LL + enum TeeWhereOutlivesAyIsDebugBee<'a, 'b, T> where T: Debug { - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:181:51 @@ -445,7 +445,7 @@ help: remove these bounds | LL - enum TeeYooOutlivesAyIsDebugBee<'a, 'b, T, U: 'a + Debug + 'b> { LL + enum TeeYooOutlivesAyIsDebugBee<'a, 'b, T, U: Debug> { - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:187:46 @@ -457,7 +457,7 @@ help: remove these bounds | LL - enum TeeOutlivesAyYooBeeIsDebug<'a, 'b, T: 'a, U: 'b + Debug> { LL + enum TeeOutlivesAyYooBeeIsDebug<'a, 'b, T, U: Debug> { - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:193:46 @@ -469,7 +469,7 @@ help: remove these bounds | LL - enum TeeOutlivesAyYooIsDebugBee<'a, 'b, T: 'a, U: Debug + 'b> { LL + enum TeeOutlivesAyYooIsDebugBee<'a, 'b, T, U: Debug> { - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:199:44 @@ -481,7 +481,7 @@ help: remove these bounds | LL - enum TeeOutlivesAyYooWhereBee<'a, 'b, T: 'a, U> where U: 'b { LL + enum TeeOutlivesAyYooWhereBee<'a, 'b, T, U> { - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:205:65 @@ -493,7 +493,7 @@ help: remove these bounds | LL - enum TeeYooWhereOutlivesAyIsDebugBee<'a, 'b, T, U> where U: 'a + Debug + 'b { LL + enum TeeYooWhereOutlivesAyIsDebugBee<'a, 'b, T, U> where U: Debug { - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:211:51 @@ -505,7 +505,7 @@ help: remove these bounds | LL - enum TeeOutlivesAyYooWhereBeeIsDebug<'a, 'b, T: 'a, U> where U: 'b + Debug { LL + enum TeeOutlivesAyYooWhereBeeIsDebug<'a, 'b, T, U> where U: Debug { - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:217:51 @@ -517,7 +517,7 @@ help: remove these bounds | LL - enum TeeOutlivesAyYooWhereIsDebugBee<'a, 'b, T: 'a, U> where U: Debug + 'b { LL + enum TeeOutlivesAyYooWhereIsDebugBee<'a, 'b, T, U> where U: Debug { - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:223:67 @@ -529,7 +529,7 @@ help: remove these bounds | LL - enum TeeWhereOutlivesAyYooWhereBeeIsDebug<'a, 'b, T, U> where T: 'a, U: 'b + Debug { LL + enum TeeWhereOutlivesAyYooWhereBeeIsDebug<'a, 'b, T, U> where U: Debug { - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:229:67 @@ -541,7 +541,7 @@ help: remove these bounds | LL - enum TeeWhereOutlivesAyYooWhereIsDebugBee<'a, 'b, T, U> where T: 'a, U: Debug + 'b { LL + enum TeeWhereOutlivesAyYooWhereIsDebugBee<'a, 'b, T, U> where U: Debug { - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:235:36 @@ -553,7 +553,7 @@ help: remove these bounds | LL - enum BeeOutlivesAyTeeBee<'a, 'b: 'a, T: 'b> { LL + enum BeeOutlivesAyTeeBee<'a, 'b, T> { - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:240:38 @@ -565,7 +565,7 @@ help: remove these bounds | LL - enum BeeOutlivesAyTeeAyBee<'a, 'b: 'a, T: 'a + 'b> { LL + enum BeeOutlivesAyTeeAyBee<'a, 'b, T> { - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:246:53 @@ -577,7 +577,7 @@ help: remove these bounds | LL - enum BeeOutlivesAyTeeOutlivesAyIsDebugBee<'a, 'b: 'a, T: 'a + Debug + 'b> { LL + enum BeeOutlivesAyTeeOutlivesAyIsDebugBee<'a, 'b, T: Debug> { - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:251:66 @@ -589,7 +589,7 @@ help: remove these bounds | LL - enum BeeWhereAyTeeWhereOutlivesAyIsDebugBee<'a, 'b, T> where 'b: 'a, T: 'a + Debug + 'b { LL + enum BeeWhereAyTeeWhereOutlivesAyIsDebugBee<'a, 'b, T> where T: Debug { - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:256:56 @@ -601,7 +601,7 @@ help: remove these bounds | LL - enum BeeOutlivesAyTeeYooOutlivesAyIsDebugBee<'a, 'b: 'a, T, U: 'a + Debug + 'b> { LL + enum BeeOutlivesAyTeeYooOutlivesAyIsDebugBee<'a, 'b, T, U: Debug> { - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:262:75 @@ -613,7 +613,7 @@ help: remove these bounds | LL - enum BeeWhereAyTeeYooWhereOutlivesAyIsDebugBee<'a, 'b, T, U> where U: 'a + Debug + 'b, 'b: 'a { LL + enum BeeWhereAyTeeYooWhereOutlivesAyIsDebugBee<'a, 'b, T, U> where U: Debug, { - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:271:46 @@ -625,7 +625,7 @@ help: remove these bounds | LL - union TeeOutlivesAyIsDebugBee<'a, 'b, T: 'a + Debug + 'b> { LL + union TeeOutlivesAyIsDebugBee<'a, 'b, T: Debug> { - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:276:60 @@ -637,7 +637,7 @@ help: remove these bounds | LL - union TeeWhereOutlivesAyIsDebugBee<'a, 'b, T> where T: 'a + Debug + 'b { LL + union TeeWhereOutlivesAyIsDebugBee<'a, 'b, T> where T: Debug { - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:281:52 @@ -649,7 +649,7 @@ help: remove these bounds | LL - union TeeYooOutlivesAyIsDebugBee<'a, 'b, T, U: 'a + Debug + 'b> { LL + union TeeYooOutlivesAyIsDebugBee<'a, 'b, T, U: Debug> { - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:287:47 @@ -661,7 +661,7 @@ help: remove these bounds | LL - union TeeOutlivesAyYooBeeIsDebug<'a, 'b, T: 'a, U: 'b + Debug> { LL + union TeeOutlivesAyYooBeeIsDebug<'a, 'b, T, U: Debug> { - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:293:47 @@ -673,7 +673,7 @@ help: remove these bounds | LL - union TeeOutlivesAyYooIsDebugBee<'a, 'b, T: 'a, U: Debug + 'b> { LL + union TeeOutlivesAyYooIsDebugBee<'a, 'b, T, U: Debug> { - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:299:45 @@ -685,7 +685,7 @@ help: remove these bounds | LL - union TeeOutlivesAyYooWhereBee<'a, 'b, T: 'a, U> where U: 'b { LL + union TeeOutlivesAyYooWhereBee<'a, 'b, T, U> { - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:305:66 @@ -697,7 +697,7 @@ help: remove these bounds | LL - union TeeYooWhereOutlivesAyIsDebugBee<'a, 'b, T, U> where U: 'a + Debug + 'b { LL + union TeeYooWhereOutlivesAyIsDebugBee<'a, 'b, T, U> where U: Debug { - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:311:52 @@ -709,7 +709,7 @@ help: remove these bounds | LL - union TeeOutlivesAyYooWhereBeeIsDebug<'a, 'b, T: 'a, U> where U: 'b + Debug { LL + union TeeOutlivesAyYooWhereBeeIsDebug<'a, 'b, T, U> where U: Debug { - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:317:52 @@ -721,7 +721,7 @@ help: remove these bounds | LL - union TeeOutlivesAyYooWhereIsDebugBee<'a, 'b, T: 'a, U> where U: Debug + 'b { LL + union TeeOutlivesAyYooWhereIsDebugBee<'a, 'b, T, U> where U: Debug { - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:323:68 @@ -733,7 +733,7 @@ help: remove these bounds | LL - union TeeWhereOutlivesAyYooWhereBeeIsDebug<'a, 'b, T, U> where T: 'a, U: 'b + Debug { LL + union TeeWhereOutlivesAyYooWhereBeeIsDebug<'a, 'b, T, U> where U: Debug { - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:329:68 @@ -745,7 +745,7 @@ help: remove these bounds | LL - union TeeWhereOutlivesAyYooWhereIsDebugBee<'a, 'b, T, U> where T: 'a, U: Debug + 'b { LL + union TeeWhereOutlivesAyYooWhereIsDebugBee<'a, 'b, T, U> where U: Debug { - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:335:37 @@ -757,7 +757,7 @@ help: remove these bounds | LL - union BeeOutlivesAyTeeBee<'a, 'b: 'a, T: 'b> { LL + union BeeOutlivesAyTeeBee<'a, 'b, T> { - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:340:39 @@ -769,7 +769,7 @@ help: remove these bounds | LL - union BeeOutlivesAyTeeAyBee<'a, 'b: 'a, T: 'a + 'b> { LL + union BeeOutlivesAyTeeAyBee<'a, 'b, T> { - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:345:54 @@ -781,7 +781,7 @@ help: remove these bounds | LL - union BeeOutlivesAyTeeOutlivesAyIsDebugBee<'a, 'b: 'a, T: 'a + Debug + 'b> { LL + union BeeOutlivesAyTeeOutlivesAyIsDebugBee<'a, 'b, T: Debug> { - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:350:67 @@ -793,7 +793,7 @@ help: remove these bounds | LL - union BeeWhereAyTeeWhereOutlivesAyIsDebugBee<'a, 'b, T> where 'b: 'a, T: 'a + Debug + 'b { LL + union BeeWhereAyTeeWhereOutlivesAyIsDebugBee<'a, 'b, T> where T: Debug { - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:355:57 @@ -805,7 +805,7 @@ help: remove these bounds | LL - union BeeOutlivesAyTeeYooOutlivesAyIsDebugBee<'a, 'b: 'a, T, U: 'a + Debug + 'b> { LL + union BeeOutlivesAyTeeYooOutlivesAyIsDebugBee<'a, 'b, T, U: Debug> { - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:361:76 @@ -817,7 +817,7 @@ help: remove these bounds | LL - union BeeWhereAyTeeYooWhereOutlivesAyIsDebugBee<'a, 'b, T, U> where U: 'a + Debug + 'b, 'b: 'a { LL + union BeeWhereAyTeeYooWhereOutlivesAyIsDebugBee<'a, 'b, T, U> where U: Debug, { - | + | error: aborting due to 68 previous errors diff --git a/src/test/ui/rust-2021/reserved-prefixes-migration.stderr b/src/test/ui/rust-2021/reserved-prefixes-migration.stderr index dc1152679b9..647a9f39312 100644 --- a/src/test/ui/rust-2021/reserved-prefixes-migration.stderr +++ b/src/test/ui/rust-2021/reserved-prefixes-migration.stderr @@ -15,7 +15,7 @@ help: insert whitespace here to avoid this being parsed as a prefix in Rust 2021 | LL - m2!(z"hey"); LL + m2!(z "hey"); - | + | warning: prefix `prefix` is unknown --> $DIR/reserved-prefixes-migration.rs:19:9 @@ -29,7 +29,7 @@ help: insert whitespace here to avoid this being parsed as a prefix in Rust 2021 | LL - m2!(prefix"hey"); LL + m2!(prefix "hey"); - | + | warning: prefix `hey` is unknown --> $DIR/reserved-prefixes-migration.rs:22:9 @@ -43,7 +43,7 @@ help: insert whitespace here to avoid this being parsed as a prefix in Rust 2021 | LL - m3!(hey#123); LL + m3!(hey #123); - | + | warning: prefix `hey` is unknown --> $DIR/reserved-prefixes-migration.rs:25:9 @@ -57,7 +57,7 @@ help: insert whitespace here to avoid this being parsed as a prefix in Rust 2021 | LL - m3!(hey#hey); LL + m3!(hey #hey); - | + | warning: prefix `kind` is unknown --> $DIR/reserved-prefixes-migration.rs:35:14 @@ -71,7 +71,7 @@ help: insert whitespace here to avoid this being parsed as a prefix in Rust 2021 | LL - #name = #kind#value LL + #name = #kind #value - | + | warning: 5 warnings emitted diff --git a/src/test/ui/rust-2021/reserved-prefixes.stderr b/src/test/ui/rust-2021/reserved-prefixes.stderr index 2755688c17f..df31aee66fe 100644 --- a/src/test/ui/rust-2021/reserved-prefixes.stderr +++ b/src/test/ui/rust-2021/reserved-prefixes.stderr @@ -9,7 +9,7 @@ help: consider inserting whitespace here | LL - demo3!(foo#bar); LL + demo3!(foo #bar); - | + | error: prefix `foo` is unknown --> $DIR/reserved-prefixes.rs:17:12 @@ -22,7 +22,7 @@ help: consider inserting whitespace here | LL - demo2!(foo"bar"); LL + demo2!(foo "bar"); - | + | error: prefix `foo` is unknown --> $DIR/reserved-prefixes.rs:18:12 @@ -35,7 +35,7 @@ help: consider inserting whitespace here | LL - demo2!(foo'b'); LL + demo2!(foo 'b'); - | + | error: prefix `foo` is unknown --> $DIR/reserved-prefixes.rs:20:12 @@ -48,7 +48,7 @@ help: consider inserting whitespace here | LL - demo2!(foo'b); LL + demo2!(foo 'b); - | + | error: prefix `foo` is unknown --> $DIR/reserved-prefixes.rs:21:12 @@ -61,7 +61,7 @@ help: consider inserting whitespace here | LL - demo3!(foo# bar); LL + demo3!(foo # bar); - | + | error: prefix `foo` is unknown --> $DIR/reserved-prefixes.rs:22:12 @@ -74,7 +74,7 @@ help: consider inserting whitespace here | LL - demo4!(foo#! bar); LL + demo4!(foo #! bar); - | + | error: prefix `foo` is unknown --> $DIR/reserved-prefixes.rs:23:12 @@ -87,7 +87,7 @@ help: consider inserting whitespace here | LL - demo4!(foo## bar); LL + demo4!(foo ## bar); - | + | error: prefix `foo` is unknown --> $DIR/reserved-prefixes.rs:25:12 @@ -100,7 +100,7 @@ help: consider inserting whitespace here | LL - demo4!(foo#bar#); LL + demo4!(foo #bar#); - | + | error: prefix `bar` is unknown --> $DIR/reserved-prefixes.rs:25:16 @@ -113,7 +113,7 @@ help: consider inserting whitespace here | LL - demo4!(foo#bar#); LL + demo4!(foo#bar #); - | + | error: aborting due to 9 previous errors diff --git a/src/test/ui/single-use-lifetime/fn-types.stderr b/src/test/ui/single-use-lifetime/fn-types.stderr index 9290c21620e..55959def4f3 100644 --- a/src/test/ui/single-use-lifetime/fn-types.stderr +++ b/src/test/ui/single-use-lifetime/fn-types.stderr @@ -15,7 +15,7 @@ help: elide the single-use lifetime | LL - a: for<'a> fn(&'a u32), LL + a: fn(&u32), - | + | error[E0581]: return type references lifetime `'a`, which is not constrained by the fn input types --> $DIR/fn-types.rs:12:22 diff --git a/src/test/ui/single-use-lifetime/one-use-in-fn-argument.stderr b/src/test/ui/single-use-lifetime/one-use-in-fn-argument.stderr index d22508998a6..93f16f5bad5 100644 --- a/src/test/ui/single-use-lifetime/one-use-in-fn-argument.stderr +++ b/src/test/ui/single-use-lifetime/one-use-in-fn-argument.stderr @@ -15,7 +15,7 @@ help: elide the single-use lifetime | LL - fn a<'a>(x: &'a u32) { LL + fn a(x: &u32) { - | + | error: lifetime parameter `'m` only used once --> $DIR/one-use-in-fn-argument.rs:15:11 @@ -29,7 +29,7 @@ help: elide the single-use lifetime | LL - fn center<'m>(_: Single<'m>) {} LL + fn center(_: Single<'_>) {} - | + | error: lifetime parameter `'y` only used once --> $DIR/one-use-in-fn-argument.rs:17:13 @@ -41,7 +41,7 @@ help: elide the single-use lifetime | LL - fn left<'x, 'y>(foo: Double<'x, 'y>) -> &'x u32 { foo.f } LL + fn left<'x>(foo: Double<'x, '_>) -> &'x u32 { foo.f } - | + | error: lifetime parameter `'x` only used once --> $DIR/one-use-in-fn-argument.rs:19:10 @@ -53,7 +53,7 @@ help: elide the single-use lifetime | LL - fn right<'x, 'y>(foo: Double<'x, 'y>) -> &'y u32 { foo.f } LL + fn right<'y>(foo: Double<'_, 'y>) -> &'y u32 { foo.f } - | + | error: aborting due to 4 previous errors diff --git a/src/test/ui/single-use-lifetime/one-use-in-inherent-impl-header.stderr b/src/test/ui/single-use-lifetime/one-use-in-inherent-impl-header.stderr index cf34a1ca299..94129560f40 100644 --- a/src/test/ui/single-use-lifetime/one-use-in-inherent-impl-header.stderr +++ b/src/test/ui/single-use-lifetime/one-use-in-inherent-impl-header.stderr @@ -15,7 +15,7 @@ help: elide the single-use lifetime | LL - impl<'f> Foo<'f> { LL + impl Foo<'_> { - | + | error: aborting due to previous error diff --git a/src/test/ui/single-use-lifetime/one-use-in-inherent-method-argument.stderr b/src/test/ui/single-use-lifetime/one-use-in-inherent-method-argument.stderr index 846c1bf41a2..39507785bbe 100644 --- a/src/test/ui/single-use-lifetime/one-use-in-inherent-method-argument.stderr +++ b/src/test/ui/single-use-lifetime/one-use-in-inherent-method-argument.stderr @@ -15,7 +15,7 @@ help: elide the single-use lifetime | LL - impl<'f> Foo<'f> { LL + impl Foo<'_> { - | + | error: lifetime parameter `'a` only used once --> $DIR/one-use-in-inherent-method-argument.rs:13:19 @@ -29,7 +29,7 @@ help: elide the single-use lifetime | LL - fn inherent_a<'a>(&self, data: &'a u32) { LL + fn inherent_a(&self, data: &u32) { - | + | error: aborting due to 2 previous errors diff --git a/src/test/ui/single-use-lifetime/one-use-in-inherent-method-return.stderr b/src/test/ui/single-use-lifetime/one-use-in-inherent-method-return.stderr index 790fcaa409c..69578fe2f88 100644 --- a/src/test/ui/single-use-lifetime/one-use-in-inherent-method-return.stderr +++ b/src/test/ui/single-use-lifetime/one-use-in-inherent-method-return.stderr @@ -15,7 +15,7 @@ help: elide the single-use lifetime | LL - impl<'f> Foo<'f> { LL + impl Foo<'_> { - | + | error: aborting due to previous error diff --git a/src/test/ui/single-use-lifetime/one-use-in-trait-method-argument.stderr b/src/test/ui/single-use-lifetime/one-use-in-trait-method-argument.stderr index 05944e04bd8..1a6e8310d30 100644 --- a/src/test/ui/single-use-lifetime/one-use-in-trait-method-argument.stderr +++ b/src/test/ui/single-use-lifetime/one-use-in-trait-method-argument.stderr @@ -15,7 +15,7 @@ help: elide the single-use lifetime | LL - fn next<'g>(&'g mut self) -> Option<Self::Item> { LL + fn next(&mut self) -> Option<Self::Item> { - | + | error: aborting due to previous error diff --git a/src/test/ui/single-use-lifetime/two-uses-in-inherent-method-argument-and-return.stderr b/src/test/ui/single-use-lifetime/two-uses-in-inherent-method-argument-and-return.stderr index b50975a189e..4794566eae4 100644 --- a/src/test/ui/single-use-lifetime/two-uses-in-inherent-method-argument-and-return.stderr +++ b/src/test/ui/single-use-lifetime/two-uses-in-inherent-method-argument-and-return.stderr @@ -15,7 +15,7 @@ help: elide the single-use lifetime | LL - impl<'f> Foo<'f> { LL + impl Foo<'_> { - | + | error: aborting due to previous error diff --git a/src/test/ui/span/issue-39018.stderr b/src/test/ui/span/issue-39018.stderr index e2e7ce1ed18..e0cfe04cf41 100644 --- a/src/test/ui/span/issue-39018.stderr +++ b/src/test/ui/span/issue-39018.stderr @@ -66,7 +66,7 @@ help: remove the borrow to obtain an owned `String` | LL - let _ = &a + &b; LL + let _ = a + &b; - | + | error[E0369]: cannot add `String` to `&String` --> $DIR/issue-39018.rs:27:16 @@ -81,7 +81,7 @@ help: remove the borrow on the left and add one on the right | LL - let _ = &a + b; LL + let _ = a + &b; - | + | error[E0308]: mismatched types --> $DIR/issue-39018.rs:29:17 diff --git a/src/test/ui/span/macro-span-replacement.rs b/src/test/ui/span/macro-span-replacement.rs index 25df4a2aa38..66973c58d35 100644 --- a/src/test/ui/span/macro-span-replacement.rs +++ b/src/test/ui/span/macro-span-replacement.rs @@ -4,7 +4,7 @@ macro_rules! m { ($a:tt $b:tt) => { - $b $a; //~ WARN struct is never constructed + $b $a; //~ WARN struct `S` is never constructed } } diff --git a/src/test/ui/span/macro-span-replacement.stderr b/src/test/ui/span/macro-span-replacement.stderr index d08b24e9562..433d02dcbe7 100644 --- a/src/test/ui/span/macro-span-replacement.stderr +++ b/src/test/ui/span/macro-span-replacement.stderr @@ -1,4 +1,4 @@ -warning: struct is never constructed: `S` +warning: struct `S` is never constructed --> $DIR/macro-span-replacement.rs:7:14 | LL | $b $a; diff --git a/src/test/ui/span/unused-warning-point-at-identifier.rs b/src/test/ui/span/unused-warning-point-at-identifier.rs index d4d5bc1cbc8..af4834503cd 100644 --- a/src/test/ui/span/unused-warning-point-at-identifier.rs +++ b/src/test/ui/span/unused-warning-point-at-identifier.rs @@ -2,26 +2,26 @@ #![warn(unused)] -enum Enum { //~ WARN enum is never used +enum Enum { //~ WARN enum `Enum` is never used A, B, C, D, } -struct Struct { //~ WARN struct is never constructed +struct Struct { //~ WARN struct `Struct` is never constructed a: usize, b: usize, c: usize, d: usize, } -fn func() -> usize { //~ WARN function is never used +fn func() -> usize { //~ WARN function `func` is never used 3 } fn -func_complete_span() //~ WARN function is never used +func_complete_span() //~ WARN function `func_complete_span` is never used -> usize { 3 diff --git a/src/test/ui/span/unused-warning-point-at-identifier.stderr b/src/test/ui/span/unused-warning-point-at-identifier.stderr index 6ef877da122..c2cb5623194 100644 --- a/src/test/ui/span/unused-warning-point-at-identifier.stderr +++ b/src/test/ui/span/unused-warning-point-at-identifier.stderr @@ -1,4 +1,4 @@ -warning: enum is never used: `Enum` +warning: enum `Enum` is never used --> $DIR/unused-warning-point-at-identifier.rs:5:6 | LL | enum Enum { @@ -11,19 +11,19 @@ LL | #![warn(unused)] | ^^^^^^ = note: `#[warn(dead_code)]` implied by `#[warn(unused)]` -warning: struct is never constructed: `Struct` +warning: struct `Struct` is never constructed --> $DIR/unused-warning-point-at-identifier.rs:12:8 | LL | struct Struct { | ^^^^^^ -warning: function is never used: `func` +warning: function `func` is never used --> $DIR/unused-warning-point-at-identifier.rs:19:4 | LL | fn func() -> usize { | ^^^^ -warning: function is never used: `func_complete_span` +warning: function `func_complete_span` is never used --> $DIR/unused-warning-point-at-identifier.rs:24:1 | LL | func_complete_span() diff --git a/src/test/ui/specialization/issue-52050.stderr b/src/test/ui/specialization/issue-52050.stderr index ab3cf27d0d0..8732b10d8f8 100644 --- a/src/test/ui/specialization/issue-52050.stderr +++ b/src/test/ui/specialization/issue-52050.stderr @@ -17,7 +17,7 @@ LL | | I: Iterator, LL | | { LL | | } | |_- first implementation here -LL | +LL | LL | impl IntoPyDictPointer for () | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `()` | diff --git a/src/test/ui/statics/uninhabited-static.stderr b/src/test/ui/statics/uninhabited-static.stderr index 1e0becb7d5a..855e5dca92a 100644 --- a/src/test/ui/statics/uninhabited-static.stderr +++ b/src/test/ui/statics/uninhabited-static.stderr @@ -49,12 +49,6 @@ error[E0080]: could not evaluate static initializer LL | static VOID2: Void = unsafe { std::mem::transmute(()) }; | ^^^^^^^^^^^^^^^^^^^^^^^ transmuting to uninhabited type -error[E0080]: could not evaluate static initializer - --> $DIR/uninhabited-static.rs:16:32 - | -LL | static NEVER2: Void = unsafe { std::mem::transmute(()) }; - | ^^^^^^^^^^^^^^^^^^^^^^^ transmuting to uninhabited type - warning: the type `Void` does not permit zero-initialization --> $DIR/uninhabited-static.rs:12:31 | @@ -67,6 +61,12 @@ LL | static VOID2: Void = unsafe { std::mem::transmute(()) }; = note: `#[warn(invalid_value)]` on by default = note: enums with no variants have no valid value +error[E0080]: could not evaluate static initializer + --> $DIR/uninhabited-static.rs:16:32 + | +LL | static NEVER2: Void = unsafe { std::mem::transmute(()) }; + | ^^^^^^^^^^^^^^^^^^^^^^^ transmuting to uninhabited type + warning: the type `Void` does not permit zero-initialization --> $DIR/uninhabited-static.rs:16:32 | diff --git a/src/test/ui/str/str-lit-type-mismatch.stderr b/src/test/ui/str/str-lit-type-mismatch.stderr index 90590b70dfe..6b56cd6f3fc 100644 --- a/src/test/ui/str/str-lit-type-mismatch.stderr +++ b/src/test/ui/str/str-lit-type-mismatch.stderr @@ -42,7 +42,7 @@ help: consider removing the leading `b` | LL - let z: &str = b"foo"; LL + let z: &str = "foo"; - | + | error: aborting due to 3 previous errors diff --git a/src/test/ui/structs/struct-path-associated-type.stderr b/src/test/ui/structs/struct-path-associated-type.stderr index 7424ceecbe3..bdce0e1b331 100644 --- a/src/test/ui/structs/struct-path-associated-type.stderr +++ b/src/test/ui/structs/struct-path-associated-type.stderr @@ -10,7 +10,7 @@ error[E0109]: type arguments are not allowed on this type LL | let z = T::A::<u8> {}; | - ^^ type argument not allowed | | - | not allowed on this + | not allowed on this type error[E0071]: expected struct, variant or union type, found associated type --> $DIR/struct-path-associated-type.rs:14:13 @@ -30,7 +30,7 @@ error[E0109]: type arguments are not allowed on this type LL | let z = T::A::<u8> {}; | - ^^ type argument not allowed | | - | not allowed on this + | not allowed on this type error[E0223]: ambiguous associated type --> $DIR/struct-path-associated-type.rs:32:13 diff --git a/src/test/ui/structs/struct-path-self.stderr b/src/test/ui/structs/struct-path-self.stderr index cccdd7b0f02..c2a8623f9b4 100644 --- a/src/test/ui/structs/struct-path-self.stderr +++ b/src/test/ui/structs/struct-path-self.stderr @@ -10,13 +10,13 @@ error[E0109]: type arguments are not allowed on self type LL | let z = Self::<u8> {}; | ---- ^^ type argument not allowed | | - | not allowed on this + | not allowed on self type | help: the `Self` type doesn't accept type parameters | LL - let z = Self::<u8> {}; LL + let z = Self {}; - | + | error[E0071]: expected struct, variant or union type, found type parameter `Self` --> $DIR/struct-path-self.rs:7:17 @@ -36,7 +36,7 @@ error[E0109]: type arguments are not allowed on self type LL | let z = Self::<u8> {}; | ---- ^^ type argument not allowed | | - | not allowed on this + | not allowed on self type | note: `Self` is of type `S` --> $DIR/struct-path-self.rs:1:8 @@ -50,7 +50,7 @@ help: the `Self` type doesn't accept type parameters | LL - let z = Self::<u8> {}; LL + let z = Self {}; - | + | error[E0109]: type arguments are not allowed on self type --> $DIR/struct-path-self.rs:30:24 @@ -58,7 +58,7 @@ error[E0109]: type arguments are not allowed on self type LL | let z = Self::<u8> {}; | ---- ^^ type argument not allowed | | - | not allowed on this + | not allowed on self type | note: `Self` is of type `S` --> $DIR/struct-path-self.rs:1:8 @@ -72,7 +72,7 @@ help: the `Self` type doesn't accept type parameters | LL - let z = Self::<u8> {}; LL + let z = Self {}; - | + | error: aborting due to 6 previous errors 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 fb40c260e2d..40b4b42f742 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 @@ -105,7 +105,7 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - struct Struct5<T: ?Sized>{ LL + struct Struct5<T>{ - | + | error: aborting due to 5 previous errors diff --git a/src/test/ui/suggestions/args-instead-of-tuple-errors.stderr b/src/test/ui/suggestions/args-instead-of-tuple-errors.stderr index aacbe1d9efb..3d367eca707 100644 --- a/src/test/ui/suggestions/args-instead-of-tuple-errors.stderr +++ b/src/test/ui/suggestions/args-instead-of-tuple-errors.stderr @@ -15,8 +15,8 @@ LL | Some(#[stable(feature = "rust1", since = "1.0.0")] T), | ^^^^ help: remove the extra argument | -LL | let _: Option<(i32, bool)> = Some({(i32, bool)}); - | ~~~~~~~~~~~~~~~~~~~ +LL | let _: Option<(i32, bool)> = Some(/* (i32, bool) */); + | ~~~~~~~~~~~~~~~~~~~~~~~ error[E0061]: this function takes 1 argument but 2 arguments were supplied --> $DIR/args-instead-of-tuple-errors.rs:8:5 @@ -35,8 +35,8 @@ LL | fn int_bool(_: (i32, bool)) { | ^^^^^^^^ -------------- help: remove the extra argument | -LL | int_bool({(i32, bool)}); - | ~~~~~~~~~~~~~~~~~~~~~~~ +LL | int_bool(/* (i32, bool) */); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ error[E0061]: this enum variant takes 1 argument but 0 arguments were supplied --> $DIR/args-instead-of-tuple-errors.rs:11:28 @@ -51,8 +51,8 @@ LL | Some(#[stable(feature = "rust1", since = "1.0.0")] T), | ^^^^ help: provide the argument | -LL | let _: Option<(i8,)> = Some({(i8,)}); - | ~~~~~~~~~~~~~ +LL | let _: Option<(i8,)> = Some(/* (i8,) */); + | ~~~~~~~~~~~~~~~~~ error[E0308]: mismatched types --> $DIR/args-instead-of-tuple-errors.rs:14:34 diff --git a/src/test/ui/suggestions/format-borrow.stderr b/src/test/ui/suggestions/format-borrow.stderr index 8a2941cb6a4..fac6a5a5f48 100644 --- a/src/test/ui/suggestions/format-borrow.stderr +++ b/src/test/ui/suggestions/format-borrow.stderr @@ -10,7 +10,7 @@ help: consider removing the borrow | LL - let a: String = &String::from("a"); LL + let a: String = String::from("a"); - | + | error[E0308]: mismatched types --> $DIR/format-borrow.rs:4:21 @@ -24,7 +24,7 @@ help: consider removing the borrow | LL - let b: String = &format!("b"); LL + let b: String = format!("b"); - | + | error[E0308]: mismatched types --> $DIR/format-borrow.rs:6:21 @@ -38,7 +38,7 @@ help: consider removing the borrow | LL - let c: String = &mut format!("c"); LL + let c: String = format!("c"); - | + | error[E0308]: mismatched types --> $DIR/format-borrow.rs:8:21 @@ -52,7 +52,7 @@ help: consider removing the borrow | LL - let d: String = &mut (format!("d")); LL + let d: String = format!("d")); - | + | error: aborting due to 4 previous errors diff --git a/src/test/ui/suggestions/issue-61963.stderr b/src/test/ui/suggestions/issue-61963.stderr index 1eebd8d60ca..c0d776e59ab 100644 --- a/src/test/ui/suggestions/issue-61963.stderr +++ b/src/test/ui/suggestions/issue-61963.stderr @@ -15,7 +15,7 @@ help: use `dyn` | LL - bar: Box<Bar>, LL + bar: Box<dyn Bar>, - | + | error: trait objects without an explicit `dyn` are deprecated --> $DIR/issue-61963.rs:18:1 @@ -29,7 +29,7 @@ help: use `dyn` | LL - pub struct Foo { LL + dyn pub struct Foo { - | + | error: trait objects without an explicit `dyn` are deprecated --> $DIR/issue-61963.rs:28:14 @@ -43,7 +43,7 @@ help: use `dyn` | LL - bar: Box<Bar>, LL + bar: Box<dyn Bar>, - | + | error: trait objects without an explicit `dyn` are deprecated --> $DIR/issue-61963.rs:28:14 @@ -57,7 +57,7 @@ help: use `dyn` | LL - bar: Box<Bar>, LL + bar: Box<dyn Bar>, - | + | error: trait objects without an explicit `dyn` are deprecated --> $DIR/issue-61963.rs:18:1 @@ -71,7 +71,7 @@ help: use `dyn` | LL - pub struct Foo { LL + dyn pub struct Foo { - | + | error: trait objects without an explicit `dyn` are deprecated --> $DIR/issue-61963.rs:18:1 @@ -85,7 +85,7 @@ help: use `dyn` | LL - pub struct Foo { LL + dyn pub struct Foo { - | + | error: trait objects without an explicit `dyn` are deprecated --> $DIR/issue-61963.rs:18:1 @@ -99,7 +99,7 @@ help: use `dyn` | LL - pub struct Foo { LL + dyn pub struct Foo { - | + | error: aborting due to 7 previous errors diff --git a/src/test/ui/suggestions/issue-82361.stderr b/src/test/ui/suggestions/issue-82361.stderr index c09ad17f82a..e4e8ad15d17 100644 --- a/src/test/ui/suggestions/issue-82361.stderr +++ b/src/test/ui/suggestions/issue-82361.stderr @@ -31,7 +31,7 @@ help: consider removing the borrow | LL - &1 LL + 1 - | + | error[E0308]: `if` and `else` have incompatible types --> $DIR/issue-82361.rs:22:9 @@ -49,7 +49,7 @@ help: consider removing the borrow | LL - &mut 1 LL + 1 - | + | error: aborting due to 3 previous errors diff --git a/src/test/ui/suggestions/issue-96555.stderr b/src/test/ui/suggestions/issue-96555.stderr index 6d3b8844d95..a1a603cf246 100644 --- a/src/test/ui/suggestions/issue-96555.stderr +++ b/src/test/ui/suggestions/issue-96555.stderr @@ -13,7 +13,7 @@ help: remove the `.await` | LL - m::f1().await; LL + m::f1(); - | + | help: alternatively, consider making `fn f1` asynchronous | LL | pub async fn f1() {} @@ -34,7 +34,7 @@ help: remove the `.await` | LL - m::f2().await; LL + m::f2(); - | + | help: alternatively, consider making `fn f2` asynchronous | LL | pub(crate) async fn f2() {} @@ -55,7 +55,7 @@ help: remove the `.await` | LL - m::f3().await; LL + m::f3(); - | + | help: alternatively, consider making `fn f3` asynchronous | LL | pub async diff --git a/src/test/ui/suggestions/match-ergonomics.stderr b/src/test/ui/suggestions/match-ergonomics.stderr index a9342f9fc30..aa2b407bf56 100644 --- a/src/test/ui/suggestions/match-ergonomics.stderr +++ b/src/test/ui/suggestions/match-ergonomics.stderr @@ -12,7 +12,7 @@ help: consider removing `&` from the pattern | LL - [&v] => {}, LL + [v] => {}, - | + | error[E0529]: expected an array or slice, found `Vec<i32>` --> $DIR/match-ergonomics.rs:8:9 @@ -44,7 +44,7 @@ help: consider removing `&` from the pattern | LL - &v => {}, LL + v => {}, - | + | error[E0308]: mismatched types --> $DIR/match-ergonomics.rs:40:13 @@ -60,7 +60,7 @@ help: consider removing `&` from the pattern | LL - if let [&v] = &x[..] {} LL + if let [v] = &x[..] {} - | + | error: aborting due to 5 previous errors diff --git a/src/test/ui/suggestions/match-prev-arm-needing-semi.stderr b/src/test/ui/suggestions/match-prev-arm-needing-semi.stderr index 4c4b782bd6f..8d735b71f82 100644 --- a/src/test/ui/suggestions/match-prev-arm-needing-semi.stderr +++ b/src/test/ui/suggestions/match-prev-arm-needing-semi.stderr @@ -30,7 +30,7 @@ help: consider removing this semicolon | LL - async_dummy(); LL + async_dummy() - | + | error[E0308]: `match` arms have incompatible types --> $DIR/match-prev-arm-needing-semi.rs:48:18 diff --git a/src/test/ui/suggestions/removal-of-multiline-trait-bound-in-where-clause.stderr b/src/test/ui/suggestions/removal-of-multiline-trait-bound-in-where-clause.stderr index 3df17056ef4..6071b10d387 100644 --- a/src/test/ui/suggestions/removal-of-multiline-trait-bound-in-where-clause.stderr +++ b/src/test/ui/suggestions/removal-of-multiline-trait-bound-in-where-clause.stderr @@ -25,7 +25,7 @@ LL - T LL - : LL - ? LL - Sized - | + | error[E0277]: the size for values of type `T` cannot be known at compilation time --> $DIR/removal-of-multiline-trait-bound-in-where-clause.rs:14:16 @@ -50,7 +50,7 @@ LL | struct Wrapper<T>(T); help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - where T: ?Sized - | + | error[E0277]: the size for values of type `T` cannot be known at compilation time --> $DIR/removal-of-multiline-trait-bound-in-where-clause.rs:21:16 @@ -76,7 +76,7 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - where LL - T: ?Sized - | + | error: aborting due to 3 previous errors diff --git a/src/test/ui/suggestions/suggest-change-mut.stderr b/src/test/ui/suggestions/suggest-change-mut.stderr index be549239e36..889b11a7410 100644 --- a/src/test/ui/suggestions/suggest-change-mut.stderr +++ b/src/test/ui/suggestions/suggest-change-mut.stderr @@ -15,7 +15,7 @@ help: consider removing the leading `&`-reference | LL - let mut stream_reader = BufReader::new(&stream); LL + let mut stream_reader = BufReader::new(stream); - | + | help: consider introducing a `where` clause, but there might be an alternative better way to express this requirement | LL | fn issue_81421<T: Read + Write>(mut stream: T) where &T: std::io::Read { diff --git a/src/test/ui/suggestions/suggest-swapping-self-ty-and-trait-edition-2021.stderr b/src/test/ui/suggestions/suggest-swapping-self-ty-and-trait-edition-2021.stderr index dd6951e0474..fc880d6b86a 100644 --- a/src/test/ui/suggestions/suggest-swapping-self-ty-and-trait-edition-2021.stderr +++ b/src/test/ui/suggestions/suggest-swapping-self-ty-and-trait-edition-2021.stderr @@ -41,7 +41,7 @@ help: add `dyn` keyword before this trait | LL - impl<'a, T> Struct<T> for Trait<'a, T> {} LL + impl<'a, T> Struct<T> for dyn Trait<'a, T> {} - | + | error: aborting due to 4 previous errors diff --git a/src/test/ui/suggestions/suggest-swapping-self-ty-and-trait.stderr b/src/test/ui/suggestions/suggest-swapping-self-ty-and-trait.stderr index 86ab8474c42..f5143762da8 100644 --- a/src/test/ui/suggestions/suggest-swapping-self-ty-and-trait.stderr +++ b/src/test/ui/suggestions/suggest-swapping-self-ty-and-trait.stderr @@ -44,7 +44,7 @@ help: use `dyn` | LL - impl<'a, T> Struct<T> for Trait<'a, T> {} LL + impl<'a, T> Struct<T> for dyn Trait<'a, T> {} - | + | error: aborting due to 3 previous errors; 1 warning emitted diff --git a/src/test/ui/suggestions/suggest-trait-items.stderr b/src/test/ui/suggestions/suggest-trait-items.stderr index 151bae7d1b9..4abc3446610 100644 --- a/src/test/ui/suggestions/suggest-trait-items.stderr +++ b/src/test/ui/suggestions/suggest-trait-items.stderr @@ -48,7 +48,7 @@ error[E0046]: not all trait items implemented, missing: `Type`, `foo`, `bar`, `q | LL | type Type; | ---------- `Type` from trait -LL | +LL | LL | fn foo(); | --------- `foo` from trait LL | fn bar(); diff --git a/src/test/ui/issues/issue-16597-empty.rs b/src/test/ui/test-attrs/issue-16597-empty.rs index 2bdd08575c4..2bdd08575c4 100644 --- a/src/test/ui/issues/issue-16597-empty.rs +++ b/src/test/ui/test-attrs/issue-16597-empty.rs diff --git a/src/test/ui/issues/issue-16597.rs b/src/test/ui/test-attrs/issue-16597.rs index 35769bfc117..35769bfc117 100644 --- a/src/test/ui/issues/issue-16597.rs +++ b/src/test/ui/test-attrs/issue-16597.rs diff --git a/src/test/ui/test-attrs/test-warns-dead-code.rs b/src/test/ui/test-attrs/test-warns-dead-code.rs index 936461f162d..4190885b6b2 100644 --- a/src/test/ui/test-attrs/test-warns-dead-code.rs +++ b/src/test/ui/test-attrs/test-warns-dead-code.rs @@ -2,6 +2,6 @@ #![deny(dead_code)] -fn dead() {} //~ error: function is never used: `dead` +fn dead() {} //~ error: function `dead` is never used fn main() {} diff --git a/src/test/ui/test-attrs/test-warns-dead-code.stderr b/src/test/ui/test-attrs/test-warns-dead-code.stderr index d3bcea29513..6c0f2884128 100644 --- a/src/test/ui/test-attrs/test-warns-dead-code.stderr +++ b/src/test/ui/test-attrs/test-warns-dead-code.stderr @@ -1,4 +1,4 @@ -error: function is never used: `dead` +error: function `dead` is never used --> $DIR/test-warns-dead-code.rs:5:4 | LL | fn dead() {} diff --git a/src/test/ui/trait-bounds/issue-93008.rs b/src/test/ui/trait-bounds/issue-93008.rs index 1b010566cbc..f4d21a160b6 100644 --- a/src/test/ui/trait-bounds/issue-93008.rs +++ b/src/test/ui/trait-bounds/issue-93008.rs @@ -1,10 +1,15 @@ -// compile-flags: -Zmir-opt-level=4 +// build-pass +// compile-flags: -Zmir-opt-level=3 --crate-type=lib -pub fn bar<T>(s: &'static mut ()) +#![feature(trivial_bounds)] +#![allow(trivial_bounds)] + +trait Foo { + fn test(self); +} +fn baz<T>() where - &'static mut (): Clone, //~ ERROR the trait bound + &'static str: Foo, { - <&'static mut () as Clone>::clone(&s); + "Foo".test() } - -fn main() {} diff --git a/src/test/ui/trait-bounds/issue-93008.stderr b/src/test/ui/trait-bounds/issue-93008.stderr deleted file mode 100644 index 10f80f8de0c..00000000000 --- a/src/test/ui/trait-bounds/issue-93008.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0277]: the trait bound `&'static mut (): Clone` is not satisfied - --> $DIR/issue-93008.rs:5:5 - | -LL | &'static mut (): Clone, - | ^^^^^^^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `&'static mut ()` - | - = help: see issue #48214 - = help: add `#![feature(trivial_bounds)]` to the crate attributes to enable - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/trait-bounds/issue-94680.rs b/src/test/ui/trait-bounds/issue-94680.rs new file mode 100644 index 00000000000..58e892079e6 --- /dev/null +++ b/src/test/ui/trait-bounds/issue-94680.rs @@ -0,0 +1,14 @@ +// check-pass + +fn main() { + println!("{:?}", { + type T = (); + + pub fn cloneit(it: &'_ mut T) -> (&'_ mut T, &'_ mut T) + where + for<'any> &'any mut T: Clone, + { + (it.clone(), it) + } + }); +} diff --git a/src/test/ui/trait-bounds/issue-94999.rs b/src/test/ui/trait-bounds/issue-94999.rs new file mode 100644 index 00000000000..e131902346f --- /dev/null +++ b/src/test/ui/trait-bounds/issue-94999.rs @@ -0,0 +1,34 @@ +// check-pass + +trait Identity<Q> { + type T; +} + +impl<Q, T> Identity<Q> for T { + type T = T; +} + +trait Holds { + type Q; +} + +struct S; +struct X(S); + +struct XHelper; + +impl Holds for X { + type Q = XHelper; +} + +impl<Q> Clone for X +where + <S as Identity<Q>>::T: Clone, + X: Holds<Q = Q>, +{ + fn clone(&self) -> Self { + Self(self.0.clone()) + } +} + +fn main() {} diff --git a/src/test/ui/trait-bounds/issue-95640.rs b/src/test/ui/trait-bounds/issue-95640.rs new file mode 100644 index 00000000000..e4e998b5d0b --- /dev/null +++ b/src/test/ui/trait-bounds/issue-95640.rs @@ -0,0 +1,31 @@ +// build-pass +// compile-flags:-Zmir-opt-level=3 + +struct D; + +trait Tr { + type It; + fn foo(self) -> Option<Self::It>; +} + +impl<'a> Tr for &'a D { + type It = (); + fn foo(self) -> Option<()> { + None + } +} + +fn run<F>(f: F) +where + for<'a> &'a D: Tr, + F: Fn(<&D as Tr>::It), +{ + let d = &D; + while let Some(i) = d.foo() { + f(i); + } +} + +fn main() { + run(|_| {}); +} diff --git a/src/test/ui/trait-bounds/select-param-env-instead-of-blanket.rs b/src/test/ui/trait-bounds/select-param-env-instead-of-blanket.rs new file mode 100644 index 00000000000..288b2098b4c --- /dev/null +++ b/src/test/ui/trait-bounds/select-param-env-instead-of-blanket.rs @@ -0,0 +1,43 @@ +// known-bug +// build-fail +// failure-status: 101 +// compile-flags:--crate-type=lib -Zmir-opt-level=3 +// rustc-env:RUST_BACKTRACE=0 + +// normalize-stderr-test "thread 'rustc' panicked.*" -> "thread 'rustc' panicked" +// normalize-stderr-test "note:.*RUST_BACKTRACE=1.*\n" -> "" +// normalize-stderr-test "error: internal compiler error.*" -> "error: internal compiler error" +// normalize-stderr-test "encountered.*with incompatible types:" "encountered ... with incompatible types:" +// normalize-stderr-test "note:.*unexpectedly panicked.*\n\n" -> "" +// normalize-stderr-test "note: we would appreciate a bug report.*\n\n" -> "" +// normalize-stderr-test "note: compiler flags.*\n\n" -> "" +// normalize-stderr-test "note: rustc.*running on.*\n\n" -> "" +// normalize-stderr-test "query stack during panic:\n" -> "" +// normalize-stderr-test "we're just showing a limited slice of the query stack\n" -> "" +// normalize-stderr-test "end of query stack\n" -> "" +// normalize-stderr-test "#.*\n" -> "" + +// This is a known bug that @compiler-errors tried to fix in #94238, +// but the solution was probably not correct. + +pub trait Factory<T> { + type Item; +} + +pub struct IntFactory; + +impl<T> Factory<T> for IntFactory { + type Item = usize; +} + +pub fn foo<T>() +where + IntFactory: Factory<T>, +{ + let mut x: <IntFactory as Factory<T>>::Item = bar::<T>(); +} + +#[inline] +pub fn bar<T>() -> <IntFactory as Factory<T>>::Item { + 0usize +} diff --git a/src/test/ui/trait-bounds/select-param-env-instead-of-blanket.stderr b/src/test/ui/trait-bounds/select-param-env-instead-of-blanket.stderr new file mode 100644 index 00000000000..56cc5c93c96 --- /dev/null +++ b/src/test/ui/trait-bounds/select-param-env-instead-of-blanket.stderr @@ -0,0 +1,18 @@ +error: internal compiler error + +error: internal compiler error + encountered ... with incompatible types: + left-hand side has type: <IntFactory as Factory<T>>::Item + right-hand side has type: usize + --> $DIR/select-param-env-instead-of-blanket.rs:42:5 + | +LL | let mut x: <IntFactory as Factory<T>>::Item = bar::<T>(); + | ---------- in this inlined function call +... +LL | 0usize + | ^^^^^^ + | + = note: delayed at compiler/rustc_const_eval/src/transform/validate.rs:128:36 + +thread 'rustc' panicked + diff --git a/src/test/ui/trait-bounds/shadowed-path-in-trait-bound-suggestion.stderr b/src/test/ui/trait-bounds/shadowed-path-in-trait-bound-suggestion.stderr index a8b275f9803..b297662955e 100644 --- a/src/test/ui/trait-bounds/shadowed-path-in-trait-bound-suggestion.stderr +++ b/src/test/ui/trait-bounds/shadowed-path-in-trait-bound-suggestion.stderr @@ -12,7 +12,7 @@ help: if you import `Trait`, refer to it directly | LL - pub struct A<H: A::Trait>(pub H); LL + pub struct A<H: Trait>(pub H); - | + | error: aborting due to previous error diff --git a/src/test/ui/trait-bounds/unsized-bound.stderr b/src/test/ui/trait-bounds/unsized-bound.stderr index 0c758c9ba26..ec85ada7a8d 100644 --- a/src/test/ui/trait-bounds/unsized-bound.stderr +++ b/src/test/ui/trait-bounds/unsized-bound.stderr @@ -16,7 +16,7 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - impl<A, B> Trait<(A, B)> for (A, B) where A: ?Sized, B: ?Sized, {} LL + impl<A, B> Trait<(A, B)> for (A, B) where A: ?Sized, {} - | + | help: consider relaxing the implicit `Sized` restriction | LL | trait Trait<A: ?Sized> {} @@ -35,7 +35,7 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - impl<A, B> Trait<(A, B)> for (A, B) where A: ?Sized, B: ?Sized, {} LL + impl<A, B> Trait<(A, B)> for (A, B) where B: ?Sized, {} - | + | error[E0277]: the size for values of type `C` cannot be known at compilation time --> $DIR/unsized-bound.rs:5:31 @@ -55,7 +55,7 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - impl<A, B: ?Sized, C: ?Sized> Trait<(A, B, C)> for (A, B, C) where A: ?Sized, {} LL + impl<A, B: ?Sized, C> Trait<(A, B, C)> for (A, B, C) where A: ?Sized, {} - | + | help: consider relaxing the implicit `Sized` restriction | LL | trait Trait<A: ?Sized> {} @@ -74,7 +74,7 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - impl<A, B: ?Sized, C: ?Sized> Trait<(A, B, C)> for (A, B, C) where A: ?Sized, {} LL + impl<A, B: ?Sized, C: ?Sized> Trait<(A, B, C)> for (A, B, C) {} - | + | error[E0277]: the size for values of type `B` cannot be known at compilation time --> $DIR/unsized-bound.rs:5:52 @@ -89,7 +89,7 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - impl<A, B: ?Sized, C: ?Sized> Trait<(A, B, C)> for (A, B, C) where A: ?Sized, {} LL + impl<A, B, C: ?Sized> Trait<(A, B, C)> for (A, B, C) where A: ?Sized, {} - | + | error[E0277]: the size for values of type `B` cannot be known at compilation time --> $DIR/unsized-bound.rs:10:28 @@ -109,7 +109,7 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - impl<A: ?Sized, B: ?Sized> Trait2<(A, B)> for (A, B) {} LL + impl<A: ?Sized, B> Trait2<(A, B)> for (A, B) {} - | + | help: consider relaxing the implicit `Sized` restriction | LL | trait Trait2<A: ?Sized> {} @@ -128,7 +128,7 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - impl<A: ?Sized, B: ?Sized> Trait2<(A, B)> for (A, B) {} LL + impl<A, B: ?Sized> Trait2<(A, B)> for (A, B) {} - | + | error[E0277]: the size for values of type `A` cannot be known at compilation time --> $DIR/unsized-bound.rs:14:9 @@ -147,7 +147,7 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - impl<A> Trait3<A> for A where A: ?Sized {} LL + impl<A> Trait3<A> for A {} - | + | help: consider relaxing the implicit `Sized` restriction | LL | trait Trait3<A: ?Sized> {} @@ -170,7 +170,7 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - impl<A: ?Sized> Trait4<A> for A {} LL + impl<A> Trait4<A> for A {} - | + | help: consider relaxing the implicit `Sized` restriction | LL | trait Trait4<A: ?Sized> {} @@ -193,7 +193,7 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - impl<X, Y> Trait5<X, Y> for X where X: ?Sized {} LL + impl<X, Y> Trait5<X, Y> for X {} - | + | help: consider relaxing the implicit `Sized` restriction | LL | trait Trait5<A: ?Sized, B> {} @@ -216,7 +216,7 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - impl<X: ?Sized, Y> Trait6<X, Y> for X {} LL + impl<X, Y> Trait6<X, Y> for X {} - | + | help: consider relaxing the implicit `Sized` restriction | LL | trait Trait6<A: ?Sized, B> {} @@ -239,7 +239,7 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - impl<X, Y> Trait7<X, Y> for X where Y: ?Sized {} LL + impl<X, Y> Trait7<X, Y> for X {} - | + | help: consider relaxing the implicit `Sized` restriction | LL | trait Trait7<A, B: ?Sized> {} @@ -262,7 +262,7 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - impl<X, Y: ?Sized> Trait8<X, Y> for X {} LL + impl<X, Y> Trait8<X, Y> for X {} - | + | help: consider relaxing the implicit `Sized` restriction | LL | trait Trait8<A, B: ?Sized> {} diff --git a/src/test/ui/traits/alias/no-duplicates.stderr b/src/test/ui/traits/alias/no-duplicates.stderr index d3002db46a2..bf244b97e9b 100644 --- a/src/test/ui/traits/alias/no-duplicates.stderr +++ b/src/test/ui/traits/alias/no-duplicates.stderr @@ -262,7 +262,7 @@ LL | trait _5 = Obj + Send; | | | additional non-auto trait | first non-auto trait -LL | +LL | LL | type _T20 = dyn _5 + _5; | -- ^^ trait alias used in trait object type (additional use) | | @@ -326,7 +326,7 @@ LL | trait _6 = _5 + _5; // ==> Obj + Send + Obj + Send | -- -- referenced here (additional use) | | | referenced here (first use) -LL | +LL | LL | type _T30 = dyn _6; | ^^ | | @@ -392,7 +392,7 @@ LL | trait _7 = _5 + Sync; | -- referenced here (first use) LL | trait _8 = Unpin + _7; | -- referenced here (first use) -LL | +LL | LL | type _T40 = dyn _8 + Obj; | -- ^^^ additional non-auto trait | | diff --git a/src/test/ui/traits/alias/no-extra-traits.stderr b/src/test/ui/traits/alias/no-extra-traits.stderr index eaba70d7ce3..4b1ddf6843c 100644 --- a/src/test/ui/traits/alias/no-extra-traits.stderr +++ b/src/test/ui/traits/alias/no-extra-traits.stderr @@ -148,7 +148,7 @@ LL | trait _1 = _0; ... LL | trait _5 = Sync + ObjB + Send; | ---- first non-auto trait -LL | +LL | LL | type _T20 = dyn _5 + _1; | -- ^^ trait alias used in trait object type (additional use) | | @@ -460,7 +460,7 @@ LL | trait _9 = _5 + Sync; | -- referenced here (first use) LL | trait _10 = Unpin + _9; | -- referenced here (first use) -LL | +LL | LL | type _T40 = dyn _10 + ObjA; | --- ^^^^ additional non-auto trait | | diff --git a/src/test/ui/traits/alias/only-maybe-bound.stderr b/src/test/ui/traits/alias/only-maybe-bound.stderr index e9e846c2ff3..06c707e4332 100644 --- a/src/test/ui/traits/alias/only-maybe-bound.stderr +++ b/src/test/ui/traits/alias/only-maybe-bound.stderr @@ -12,7 +12,7 @@ error[E0224]: at least one trait is required for an object type | LL | trait _2 = _1 + _1; | ------------------- this alias does not contain a trait -LL | +LL | LL | type _T1 = dyn _2; | ^^^^^^ diff --git a/src/test/ui/traits/bound/not-on-bare-trait.stderr b/src/test/ui/traits/bound/not-on-bare-trait.stderr index 08f6d166d22..8a92dd11872 100644 --- a/src/test/ui/traits/bound/not-on-bare-trait.stderr +++ b/src/test/ui/traits/bound/not-on-bare-trait.stderr @@ -11,7 +11,7 @@ help: use `dyn` | LL - fn foo(_x: Foo + Send) { LL + fn foo(_x: dyn Foo + Send) { - | + | error[E0277]: the size for values of type `(dyn Foo + Send + 'static)` cannot be known at compilation time --> $DIR/not-on-bare-trait.rs:7:8 diff --git a/src/test/ui/traits/bound/not-on-struct.stderr b/src/test/ui/traits/bound/not-on-struct.stderr index 407a4f0ef14..2de35dc7fc3 100644 --- a/src/test/ui/traits/bound/not-on-struct.stderr +++ b/src/test/ui/traits/bound/not-on-struct.stderr @@ -47,7 +47,7 @@ help: if you meant to use a type and not a trait here, remove the bounds | LL - fn a() -> A + 'static { LL + fn a() -> A { - | + | error[E0404]: expected trait, found enum `Result` --> $DIR/not-on-struct.rs:16:34 @@ -66,7 +66,7 @@ help: if you meant to use a type and not a trait here, remove the bounds | LL - fn b<'a,T,E>(iter: Iterator<Item=Result<T,E> + 'a>) { LL + fn b<'a,T,E>(iter: Iterator<Item=Result<T,E>>) { - | + | error[E0404]: expected trait, found struct `A` --> $DIR/not-on-struct.rs:19:21 @@ -85,7 +85,7 @@ help: if you meant to use a type and not a trait here, remove the bounds | LL - fn c() -> 'static + A { LL + fn c() -> A { - | + | error[E0404]: expected trait, found enum `Result` --> $DIR/not-on-struct.rs:22:39 @@ -104,7 +104,7 @@ help: if you meant to use a type and not a trait here, remove the bounds | LL - fn d<'a,T,E>(iter: Iterator<Item='a + Result<T,E>>) { LL + fn d<'a,T,E>(iter: Iterator<Item=Result<T,E>>) { - | + | error[E0404]: expected trait, found struct `A` --> $DIR/not-on-struct.rs:25:21 @@ -123,7 +123,7 @@ help: if you meant to use a type and not a trait here, remove the bounds | LL - fn e() -> 'static + A + 'static { LL + fn e() -> A { - | + | error[E0404]: expected trait, found enum `Result` --> $DIR/not-on-struct.rs:29:39 @@ -142,7 +142,7 @@ help: if you meant to use a type and not a trait here, remove the bounds | LL - fn f<'a,T,E>(iter: Iterator<Item='a + Result<T,E> + 'a>) { LL + fn f<'a,T,E>(iter: Iterator<Item=Result<T,E>>) { - | + | error[E0404]: expected trait, found struct `Traitor` --> $DIR/not-on-struct.rs:35:11 @@ -163,7 +163,7 @@ help: if you meant to use a type and not a trait here, remove the bounds | LL - fn g() -> Traitor + 'static { LL + fn g() -> Traitor { - | + | help: a trait with a similar name exists | LL | fn g() -> Trait + 'static { diff --git a/src/test/ui/issues/issue-38033.rs b/src/test/ui/traits/issue-38033.rs index 16b867ec88f..16b867ec88f 100644 --- a/src/test/ui/issues/issue-38033.rs +++ b/src/test/ui/traits/issue-38033.rs diff --git a/src/test/ui/traits/suggest-where-clause.stderr b/src/test/ui/traits/suggest-where-clause.stderr index 520ee0b5ea7..21b339d12a8 100644 --- a/src/test/ui/traits/suggest-where-clause.stderr +++ b/src/test/ui/traits/suggest-where-clause.stderr @@ -16,7 +16,7 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - fn check<T: Iterator, U: ?Sized>() { LL + fn check<T: Iterator, U>() { - | + | error[E0277]: the size for values of type `U` cannot be known at compilation time --> $DIR/suggest-where-clause.rs:10:5 @@ -41,7 +41,7 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - fn check<T: Iterator, U: ?Sized>() { LL + fn check<T: Iterator, U>() { - | + | error[E0277]: the trait bound `u64: From<T>` is not satisfied --> $DIR/suggest-where-clause.rs:15:5 diff --git a/src/test/ui/traits/vtable/issue-97381.stderr b/src/test/ui/traits/vtable/issue-97381.stderr index f88c8716ff7..c4f8294e263 100644 --- a/src/test/ui/traits/vtable/issue-97381.stderr +++ b/src/test/ui/traits/vtable/issue-97381.stderr @@ -3,7 +3,7 @@ error[E0505]: cannot move out of `v` because it is borrowed | LL | let el = &v[0]; | - borrow of `v` occurs here -LL | +LL | LL | for _ in v { | ^ move out of `v` occurs here LL | diff --git a/src/test/ui/trivial-bounds/trivial-bounds-inconsistent.stderr b/src/test/ui/trivial-bounds/trivial-bounds-inconsistent.stderr index 16f32e043d5..d66e468873b 100644 --- a/src/test/ui/trivial-bounds/trivial-bounds-inconsistent.stderr +++ b/src/test/ui/trivial-bounds/trivial-bounds-inconsistent.stderr @@ -35,7 +35,7 @@ help: the clause will not be checked when the type alias is used, and should be | LL - type Y where i32: Foo = (); LL + type Y = (); - | + | warning: trait bound i32: Foo does not depend on any type or lifetime parameters --> $DIR/trivial-bounds-inconsistent.rs:22:19 diff --git a/src/test/ui/try-block/try-block-bad-lifetime.stderr b/src/test/ui/try-block/try-block-bad-lifetime.stderr index de1667d8832..ea079e30d9c 100644 --- a/src/test/ui/try-block/try-block-bad-lifetime.stderr +++ b/src/test/ui/try-block/try-block-bad-lifetime.stderr @@ -42,7 +42,7 @@ LL | let k = &mut i; ... LL | i = 40; | ^^^^^^ assignment to borrowed `i` occurs here -LL | +LL | LL | let i_ptr = if let Err(i_ptr) = j { i_ptr } else { panic ! ("") }; | - borrow later used here diff --git a/src/test/ui/try-block/try-block-unreachable-code-lint.stderr b/src/test/ui/try-block/try-block-unreachable-code-lint.stderr index 61df702fb87..9fc0b661f1e 100644 --- a/src/test/ui/try-block/try-block-unreachable-code-lint.stderr +++ b/src/test/ui/try-block/try-block-unreachable-code-lint.stderr @@ -3,7 +3,7 @@ warning: unreachable expression | LL | return; | ------ any code following this expression is unreachable -LL | +LL | LL | / try { LL | | loop { LL | | err()?; @@ -32,7 +32,7 @@ LL | / loop { LL | | err()?; LL | | } | |_________- any code following this expression is unreachable -LL | +LL | LL | 42 | ^^ unreachable expression diff --git a/src/test/ui/try-block/try-block-unused-delims.stderr b/src/test/ui/try-block/try-block-unused-delims.stderr index d8dd31645e0..765cd9c0fc4 100644 --- a/src/test/ui/try-block/try-block-unused-delims.stderr +++ b/src/test/ui/try-block/try-block-unused-delims.stderr @@ -13,7 +13,7 @@ help: remove these parentheses | LL - consume((try {})); LL + consume(try {}); - | + | warning: unnecessary braces around function argument --> $DIR/try-block-unused-delims.rs:14:13 @@ -30,7 +30,7 @@ help: remove these braces | LL - consume({ try {} }); LL + consume(try {}); - | + | warning: unnecessary parentheses around `match` scrutinee expression --> $DIR/try-block-unused-delims.rs:17:11 @@ -42,7 +42,7 @@ help: remove these parentheses | LL - match (try {}) { LL + match try {} { - | + | warning: unnecessary parentheses around `let` scrutinee expression --> $DIR/try-block-unused-delims.rs:22:22 @@ -54,7 +54,7 @@ help: remove these parentheses | LL - if let Err(()) = (try {}) {} LL + if let Err(()) = try {} {} - | + | warning: unnecessary parentheses around `match` scrutinee expression --> $DIR/try-block-unused-delims.rs:25:11 @@ -66,7 +66,7 @@ help: remove these parentheses | LL - match (try {}) { LL + match try {} { - | + | warning: 5 warnings emitted diff --git a/src/test/ui/tuple/wrong_argument_ice-3.stderr b/src/test/ui/tuple/wrong_argument_ice-3.stderr index 6ea6e670fd6..667b15776ef 100644 --- a/src/test/ui/tuple/wrong_argument_ice-3.stderr +++ b/src/test/ui/tuple/wrong_argument_ice-3.stderr @@ -15,8 +15,8 @@ LL | pub fn push(&mut self, value: T) { | ^^^^ help: remove the extra argument | -LL | groups.push({(Vec<String>, Vec<Process>)}); - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL | groups.push(/* (Vec<String>, Vec<Process>) */); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to previous error diff --git a/src/test/ui/type-alias-enum-variants/enum-variant-generic-args.rs b/src/test/ui/type-alias-enum-variants/enum-variant-generic-args.rs index e6f45036f85..0031a4665c8 100644 --- a/src/test/ui/type-alias-enum-variants/enum-variant-generic-args.rs +++ b/src/test/ui/type-alias-enum-variants/enum-variant-generic-args.rs @@ -52,7 +52,7 @@ fn main() { // Tuple struct variant Enum::<()>::TSVariant::<()>(()); - //~^ ERROR type arguments are not allowed on this type [E0109] + //~^ ERROR type arguments are not allowed on tuple variant `TSVariant` [E0109] Alias::TSVariant::<()>(()); //~^ ERROR type arguments are not allowed on this type [E0109] @@ -70,7 +70,7 @@ fn main() { // Struct variant Enum::<()>::SVariant::<()> { v: () }; - //~^ ERROR type arguments are not allowed on this type [E0109] + //~^ ERROR type arguments are not allowed on variant `SVariant` [E0109] Alias::SVariant::<()> { v: () }; //~^ ERROR type arguments are not allowed on this type [E0109] @@ -88,7 +88,7 @@ fn main() { // Unit variant Enum::<()>::UVariant::<()>; - //~^ ERROR type arguments are not allowed on this type [E0109] + //~^ ERROR type arguments are not allowed on unit variant `UVariant` [E0109] Alias::UVariant::<()>; //~^ ERROR type arguments are not allowed on this type [E0109] diff --git a/src/test/ui/type-alias-enum-variants/enum-variant-generic-args.stderr b/src/test/ui/type-alias-enum-variants/enum-variant-generic-args.stderr index 3e60ab108a8..5467f61bee4 100644 --- a/src/test/ui/type-alias-enum-variants/enum-variant-generic-args.stderr +++ b/src/test/ui/type-alias-enum-variants/enum-variant-generic-args.stderr @@ -23,7 +23,7 @@ error[E0109]: type arguments are not allowed on this type LL | Self::TSVariant::<()>(()); | --------- ^^ type argument not allowed | | - | not allowed on this + | not allowed on this type error[E0109]: type arguments are not allowed on self type --> $DIR/enum-variant-generic-args.rs:17:16 @@ -31,7 +31,7 @@ error[E0109]: type arguments are not allowed on self type LL | Self::<()>::TSVariant(()); | ---- ^^ type argument not allowed | | - | not allowed on this + | not allowed on self type | note: `Self` is of type `Enum<T>` --> $DIR/enum-variant-generic-args.rs:7:6 @@ -71,7 +71,7 @@ error[E0109]: type arguments are not allowed on self type LL | Self::<()>::TSVariant::<()>(()); | ---- ^^ type argument not allowed | | - | not allowed on this + | not allowed on self type | note: `Self` is of type `Enum<T>` --> $DIR/enum-variant-generic-args.rs:7:6 @@ -92,7 +92,7 @@ error[E0109]: type arguments are not allowed on this type LL | Self::<()>::TSVariant::<()>(()); | --------- ^^ type argument not allowed | | - | not allowed on this + | not allowed on this type error[E0308]: mismatched types --> $DIR/enum-variant-generic-args.rs:26:29 @@ -112,14 +112,14 @@ error[E0109]: type arguments are not allowed on this type LL | Self::SVariant::<()> { v: () }; | -------- ^^ type argument not allowed | | - | not allowed on this + | not allowed on this type | = note: enum variants can't have type parameters help: you might have meant to specity type parameters on enum `Enum` | LL - Self::SVariant::<()> { v: () }; LL + Enum::<()>::SVariant { v: () }; - | + | error[E0308]: mismatched types --> $DIR/enum-variant-generic-args.rs:28:35 @@ -139,7 +139,7 @@ error[E0109]: type arguments are not allowed on self type LL | Self::<()>::SVariant { v: () }; | ---- ^^ type argument not allowed | | - | not allowed on this + | not allowed on self type | note: `Self` is of type `Enum<T>` --> $DIR/enum-variant-generic-args.rs:7:6 @@ -172,7 +172,7 @@ error[E0109]: type arguments are not allowed on self type LL | Self::<()>::SVariant::<()> { v: () }; | ---- ^^ type argument not allowed | | - | not allowed on this + | not allowed on self type | note: `Self` is of type `Enum<T>` --> $DIR/enum-variant-generic-args.rs:7:6 @@ -193,14 +193,14 @@ error[E0109]: type arguments are not allowed on this type LL | Self::<()>::SVariant::<()> { v: () }; | -------- ^^ type argument not allowed | | - | not allowed on this + | not allowed on this type | = note: enum variants can't have type parameters help: you might have meant to specity type parameters on enum `Enum` | LL - Self::<()>::SVariant::<()> { v: () }; LL + Enum::<()>::SVariant { v: () }; - | + | error[E0308]: mismatched types --> $DIR/enum-variant-generic-args.rs:34:41 @@ -220,7 +220,7 @@ error[E0109]: type arguments are not allowed on this type LL | Self::UVariant::<()>; | -------- ^^ type argument not allowed | | - | not allowed on this + | not allowed on this type error[E0109]: type arguments are not allowed on self type --> $DIR/enum-variant-generic-args.rs:43:16 @@ -228,7 +228,7 @@ error[E0109]: type arguments are not allowed on self type LL | Self::<()>::UVariant; | ---- ^^ type argument not allowed | | - | not allowed on this + | not allowed on self type | note: `Self` is of type `Enum<T>` --> $DIR/enum-variant-generic-args.rs:7:6 @@ -249,7 +249,7 @@ error[E0109]: type arguments are not allowed on self type LL | Self::<()>::UVariant::<()>; | ---- ^^ type argument not allowed | | - | not allowed on this + | not allowed on self type | note: `Self` is of type `Enum<T>` --> $DIR/enum-variant-generic-args.rs:7:6 @@ -270,15 +270,15 @@ error[E0109]: type arguments are not allowed on this type LL | Self::<()>::UVariant::<()>; | -------- ^^ type argument not allowed | | - | not allowed on this + | not allowed on this type -error[E0109]: type arguments are not allowed on this type +error[E0109]: type arguments are not allowed on tuple variant `TSVariant` --> $DIR/enum-variant-generic-args.rs:54:29 | LL | Enum::<()>::TSVariant::<()>(()); | --------- ^^ type argument not allowed | | - | not allowed on this + | not allowed on tuple variant `TSVariant` error[E0109]: type arguments are not allowed on this type --> $DIR/enum-variant-generic-args.rs:57:24 @@ -286,7 +286,7 @@ error[E0109]: type arguments are not allowed on this type LL | Alias::TSVariant::<()>(()); | --------- ^^ type argument not allowed | | - | not allowed on this + | not allowed on this type error[E0109]: type arguments are not allowed on this type --> $DIR/enum-variant-generic-args.rs:59:30 @@ -294,7 +294,7 @@ error[E0109]: type arguments are not allowed on this type LL | Alias::<()>::TSVariant::<()>(()); | --------- ^^ type argument not allowed | | - | not allowed on this + | not allowed on this type error[E0109]: type arguments are not allowed on this type --> $DIR/enum-variant-generic-args.rs:62:29 @@ -302,7 +302,7 @@ error[E0109]: type arguments are not allowed on this type LL | AliasFixed::TSVariant::<()>(()); | --------- ^^ type argument not allowed | | - | not allowed on this + | not allowed on this type error[E0107]: this type alias takes 0 generic arguments but 1 generic argument was supplied --> $DIR/enum-variant-generic-args.rs:64:5 @@ -338,15 +338,15 @@ error[E0109]: type arguments are not allowed on this type LL | AliasFixed::<()>::TSVariant::<()>(()); | --------- ^^ type argument not allowed | | - | not allowed on this + | not allowed on this type -error[E0109]: type arguments are not allowed on this type +error[E0109]: type arguments are not allowed on variant `SVariant` --> $DIR/enum-variant-generic-args.rs:72:28 | LL | Enum::<()>::SVariant::<()> { v: () }; | -------- ^^ type argument not allowed | | - | not allowed on this + | not allowed on variant `SVariant` | = note: enum variants can't have type parameters @@ -356,14 +356,14 @@ error[E0109]: type arguments are not allowed on this type LL | Alias::SVariant::<()> { v: () }; | -------- ^^ type argument not allowed | | - | not allowed on this + | not allowed on this type | = note: enum variants can't have type parameters help: you might have meant to specity type parameters on enum `Enum` | LL - Alias::SVariant::<()> { v: () }; LL + Alias::<()>::SVariant { v: () }; - | + | error[E0109]: type arguments are not allowed on this type --> $DIR/enum-variant-generic-args.rs:77:29 @@ -371,14 +371,14 @@ error[E0109]: type arguments are not allowed on this type LL | Alias::<()>::SVariant::<()> { v: () }; | -------- ^^ type argument not allowed | | - | not allowed on this + | not allowed on this type | = note: enum variants can't have type parameters help: you might have meant to specity type parameters on enum `Enum` | LL - Alias::<()>::SVariant::<()> { v: () }; LL + Alias::<()>::SVariant { v: () }; - | + | error[E0109]: type arguments are not allowed on this type --> $DIR/enum-variant-generic-args.rs:80:28 @@ -386,14 +386,14 @@ error[E0109]: type arguments are not allowed on this type LL | AliasFixed::SVariant::<()> { v: () }; | -------- ^^ type argument not allowed | | - | not allowed on this + | not allowed on this type | = note: enum variants can't have type parameters help: you might have meant to specity type parameters on enum `Enum` | LL - AliasFixed::SVariant::<()> { v: () }; LL + AliasFixed::<()>::SVariant { v: () }; - | + | error[E0107]: this type alias takes 0 generic arguments but 1 generic argument was supplied --> $DIR/enum-variant-generic-args.rs:82:5 @@ -429,22 +429,22 @@ error[E0109]: type arguments are not allowed on this type LL | AliasFixed::<()>::SVariant::<()> { v: () }; | -------- ^^ type argument not allowed | | - | not allowed on this + | not allowed on this type | = note: enum variants can't have type parameters help: you might have meant to specity type parameters on enum `Enum` | LL - AliasFixed::<()>::SVariant::<()> { v: () }; LL + AliasFixed::<()>::SVariant { v: () }; - | + | -error[E0109]: type arguments are not allowed on this type +error[E0109]: type arguments are not allowed on unit variant `UVariant` --> $DIR/enum-variant-generic-args.rs:90:28 | LL | Enum::<()>::UVariant::<()>; | -------- ^^ type argument not allowed | | - | not allowed on this + | not allowed on unit variant `UVariant` error[E0109]: type arguments are not allowed on this type --> $DIR/enum-variant-generic-args.rs:93:23 @@ -452,7 +452,7 @@ error[E0109]: type arguments are not allowed on this type LL | Alias::UVariant::<()>; | -------- ^^ type argument not allowed | | - | not allowed on this + | not allowed on this type error[E0109]: type arguments are not allowed on this type --> $DIR/enum-variant-generic-args.rs:95:29 @@ -460,7 +460,7 @@ error[E0109]: type arguments are not allowed on this type LL | Alias::<()>::UVariant::<()>; | -------- ^^ type argument not allowed | | - | not allowed on this + | not allowed on this type error[E0109]: type arguments are not allowed on this type --> $DIR/enum-variant-generic-args.rs:98:28 @@ -468,7 +468,7 @@ error[E0109]: type arguments are not allowed on this type LL | AliasFixed::UVariant::<()>; | -------- ^^ type argument not allowed | | - | not allowed on this + | not allowed on this type error[E0107]: this type alias takes 0 generic arguments but 1 generic argument was supplied --> $DIR/enum-variant-generic-args.rs:100:5 @@ -504,7 +504,7 @@ error[E0109]: type arguments are not allowed on this type LL | AliasFixed::<()>::UVariant::<()>; | -------- ^^ type argument not allowed | | - | not allowed on this + | not allowed on this type error: aborting due to 39 previous errors diff --git a/src/test/ui/type-alias-enum-variants/enum-variant-priority-higher-than-other-inherent.stderr b/src/test/ui/type-alias-enum-variants/enum-variant-priority-higher-than-other-inherent.stderr index 3fc5a3594d8..6ae2aa1dc77 100644 --- a/src/test/ui/type-alias-enum-variants/enum-variant-priority-higher-than-other-inherent.stderr +++ b/src/test/ui/type-alias-enum-variants/enum-variant-priority-higher-than-other-inherent.stderr @@ -11,8 +11,8 @@ LL | V(u8) | ^ help: provide the argument | -LL | <E>::V({u8}); - | ~~~~~~~~~~~~ +LL | <E>::V(/* u8 */); + | ~~~~~~~~~~~~~~~~ error[E0308]: mismatched types --> $DIR/enum-variant-priority-higher-than-other-inherent.rs:22:17 diff --git a/src/test/ui/type-alias-enum-variants/incorrect-variant-form-through-alias-caught.stderr b/src/test/ui/type-alias-enum-variants/incorrect-variant-form-through-alias-caught.stderr index 0cf020861c7..8ddf9f7cd68 100644 --- a/src/test/ui/type-alias-enum-variants/incorrect-variant-form-through-alias-caught.stderr +++ b/src/test/ui/type-alias-enum-variants/incorrect-variant-form-through-alias-caught.stderr @@ -31,7 +31,7 @@ help: `Alias::Unit` is a unit variant, you need to write it without the parenthe | LL - Alias::Unit(); LL + Alias::Unit; - | + | error[E0164]: expected tuple struct or tuple variant, found unit variant `Alias::Unit` --> $DIR/incorrect-variant-form-through-alias-caught.rs:17:9 diff --git a/src/test/ui/type-alias-enum-variants/no-type-application-on-aliased-enum-variant.stderr b/src/test/ui/type-alias-enum-variants/no-type-application-on-aliased-enum-variant.stderr index 474548a14a9..51b1c8a1068 100644 --- a/src/test/ui/type-alias-enum-variants/no-type-application-on-aliased-enum-variant.stderr +++ b/src/test/ui/type-alias-enum-variants/no-type-application-on-aliased-enum-variant.stderr @@ -4,7 +4,7 @@ error[E0109]: type arguments are not allowed on this type LL | let _ = Alias::None::<u8>; | ---- ^^ type argument not allowed | | - | not allowed on this + | not allowed on this type error: aborting due to previous error diff --git a/src/test/ui/type-alias-impl-trait/auto-trait-leakage2.rs b/src/test/ui/type-alias-impl-trait/auto-trait-leakage2.rs index 745379efa6d..fc89b0e870e 100644 --- a/src/test/ui/type-alias-impl-trait/auto-trait-leakage2.rs +++ b/src/test/ui/type-alias-impl-trait/auto-trait-leakage2.rs @@ -4,7 +4,9 @@ mod m { use std::rc::Rc; - type Foo = impl std::fmt::Debug; + type Foo = impl std::fmt::Debug; //~ NOTE appears within the type + //~^ within this `Foo` + //~| expansion of desugaring pub fn foo() -> Foo { Rc::new(22_u32) @@ -12,8 +14,12 @@ mod m { } fn is_send<T: Send>(_: T) {} +//~^ required by this bound +//~| required by a bound fn main() { is_send(m::foo()); //~^ ERROR: `Rc<u32>` cannot be sent between threads safely [E0277] + //~| NOTE cannot be sent + //~| NOTE required by a bound } diff --git a/src/test/ui/type-alias-impl-trait/auto-trait-leakage2.stderr b/src/test/ui/type-alias-impl-trait/auto-trait-leakage2.stderr index 0664275b2ad..d7247302dd1 100644 --- a/src/test/ui/type-alias-impl-trait/auto-trait-leakage2.stderr +++ b/src/test/ui/type-alias-impl-trait/auto-trait-leakage2.stderr @@ -1,5 +1,5 @@ error[E0277]: `Rc<u32>` cannot be sent between threads safely - --> $DIR/auto-trait-leakage2.rs:17:13 + --> $DIR/auto-trait-leakage2.rs:21:13 | LL | type Foo = impl std::fmt::Debug; | -------------------- within this `Foo` @@ -10,9 +10,13 @@ LL | is_send(m::foo()); | required by a bound introduced by this call | = help: within `Foo`, the trait `Send` is not implemented for `Rc<u32>` - = note: required because it appears within the type `Foo` +note: required because it appears within the type `Foo` + --> $DIR/auto-trait-leakage2.rs:7:16 + | +LL | type Foo = impl std::fmt::Debug; + | ^^^^^^^^^^^^^^^^^^^^ note: required by a bound in `is_send` - --> $DIR/auto-trait-leakage2.rs:14:15 + --> $DIR/auto-trait-leakage2.rs:16:15 | LL | fn is_send<T: Send>(_: T) {} | ^^^^ required by this bound in `is_send` diff --git a/src/test/ui/type-alias-impl-trait/issue-63279.stderr b/src/test/ui/type-alias-impl-trait/issue-63279.stderr index bcc9c57f91c..33f81a77aaf 100644 --- a/src/test/ui/type-alias-impl-trait/issue-63279.stderr +++ b/src/test/ui/type-alias-impl-trait/issue-63279.stderr @@ -21,7 +21,7 @@ error[E0308]: mismatched types | LL | type Closure = impl FnOnce(); | ------------- the expected opaque type -LL | +LL | LL | fn c() -> Closure { | ------- expected `Closure` because of return type LL | || -> Closure { || () } diff --git a/src/test/ui/type-alias-impl-trait/issue-74280.stderr b/src/test/ui/type-alias-impl-trait/issue-74280.stderr index 7a22b360a31..573e691b4cc 100644 --- a/src/test/ui/type-alias-impl-trait/issue-74280.stderr +++ b/src/test/ui/type-alias-impl-trait/issue-74280.stderr @@ -3,7 +3,7 @@ error[E0308]: mismatched types | LL | type Test = impl Copy; | --------- the expected opaque type -LL | +LL | LL | fn test() -> Test { | ---- expected `Test` because of return type LL | let y = || -> Test { () }; diff --git a/src/test/ui/type-alias-impl-trait/nested-tait-inference.stderr b/src/test/ui/type-alias-impl-trait/nested-tait-inference.stderr index f98da9f7f92..62db019ed6a 100644 --- a/src/test/ui/type-alias-impl-trait/nested-tait-inference.stderr +++ b/src/test/ui/type-alias-impl-trait/nested-tait-inference.stderr @@ -3,6 +3,9 @@ error[E0277]: the trait bound `(): Foo<FooX>` is not satisfied | LL | fn foo() -> impl Foo<FooX> { | ^^^^^^^^^^^^^^ the trait `Foo<FooX>` is not implemented for `()` +... +LL | () + | -- return type was inferred to be `()` here | = help: the trait `Foo<()>` is implemented for `()` diff --git a/src/test/ui/type-alias-impl-trait/nested-tait-inference2.stderr b/src/test/ui/type-alias-impl-trait/nested-tait-inference2.stderr index 54f571ad3e3..f4d96038d91 100644 --- a/src/test/ui/type-alias-impl-trait/nested-tait-inference2.stderr +++ b/src/test/ui/type-alias-impl-trait/nested-tait-inference2.stderr @@ -3,6 +3,9 @@ error[E0277]: the trait bound `(): Foo<FooX>` is not satisfied | LL | fn foo() -> impl Foo<FooX> { | ^^^^^^^^^^^^^^ the trait `Foo<FooX>` is not implemented for `()` +LL | +LL | () + | -- return type was inferred to be `()` here | = help: the following other types implement trait `Foo<A>`: <() as Foo<()>> diff --git a/src/test/ui/type-alias/issue-62263-self-in-atb.rs b/src/test/ui/type-alias/issue-62263-self-in-atb.rs index 1f64b4cfe5c..91522d8912f 100644 --- a/src/test/ui/type-alias/issue-62263-self-in-atb.rs +++ b/src/test/ui/type-alias/issue-62263-self-in-atb.rs @@ -3,6 +3,6 @@ pub trait Trait { } pub type Alias = dyn Trait<A = Self::A>; -//~^ ERROR failed to resolve: use of undeclared type `Self` [E0433] +//~^ ERROR failed to resolve: `Self` fn main() {} diff --git a/src/test/ui/type-alias/issue-62263-self-in-atb.stderr b/src/test/ui/type-alias/issue-62263-self-in-atb.stderr index d34b6ed5038..c20074dc27c 100644 --- a/src/test/ui/type-alias/issue-62263-self-in-atb.stderr +++ b/src/test/ui/type-alias/issue-62263-self-in-atb.stderr @@ -1,8 +1,8 @@ -error[E0433]: failed to resolve: use of undeclared type `Self` +error[E0433]: failed to resolve: `Self` is only available in impls, traits, and type definitions --> $DIR/issue-62263-self-in-atb.rs:5:32 | LL | pub type Alias = dyn Trait<A = Self::A>; - | ^^^^ use of undeclared type `Self` + | ^^^^ `Self` is only available in impls, traits, and type definitions error: aborting due to previous error diff --git a/src/test/ui/type-alias/issue-62305-self-assoc-ty.rs b/src/test/ui/type-alias/issue-62305-self-assoc-ty.rs index 999902fb18b..a4d9a285485 100644 --- a/src/test/ui/type-alias/issue-62305-self-assoc-ty.rs +++ b/src/test/ui/type-alias/issue-62305-self-assoc-ty.rs @@ -1,4 +1,4 @@ type Alias = Self::Target; -//~^ ERROR failed to resolve: use of undeclared type `Self` [E0433] +//~^ ERROR failed to resolve: `Self` fn main() {} diff --git a/src/test/ui/type-alias/issue-62305-self-assoc-ty.stderr b/src/test/ui/type-alias/issue-62305-self-assoc-ty.stderr index 823a5fa50fc..f3da50df926 100644 --- a/src/test/ui/type-alias/issue-62305-self-assoc-ty.stderr +++ b/src/test/ui/type-alias/issue-62305-self-assoc-ty.stderr @@ -1,8 +1,8 @@ -error[E0433]: failed to resolve: use of undeclared type `Self` +error[E0433]: failed to resolve: `Self` is only available in impls, traits, and type definitions --> $DIR/issue-62305-self-assoc-ty.rs:1:14 | LL | type Alias = Self::Target; - | ^^^^ use of undeclared type `Self` + | ^^^^ `Self` is only available in impls, traits, and type definitions error: aborting due to previous error diff --git a/src/test/ui/type-alias/issue-62364-self-ty-arg.stderr b/src/test/ui/type-alias/issue-62364-self-ty-arg.stderr index cae41672ead..7e15e42e3cc 100644 --- a/src/test/ui/type-alias/issue-62364-self-ty-arg.stderr +++ b/src/test/ui/type-alias/issue-62364-self-ty-arg.stderr @@ -2,9 +2,9 @@ error[E0411]: cannot find type `Self` in this scope --> $DIR/issue-62364-self-ty-arg.rs:5:29 | LL | type Alias<'a> = Struct<&'a Self>; - | - ^^^^ `Self` is only available in impls, traits, and type definitions - | | - | help: you might be missing a type parameter: `, Self` + | ----- ^^^^ `Self` is only available in impls, traits, and type definitions + | | + | `Self` not allowed in a type alias error: aborting due to previous error diff --git a/src/test/ui/type/ascription/issue-34255-1.stderr b/src/test/ui/type/ascription/issue-34255-1.stderr index 43f0fbbc4e3..6819d14bb01 100644 --- a/src/test/ui/type/ascription/issue-34255-1.stderr +++ b/src/test/ui/type/ascription/issue-34255-1.stderr @@ -8,8 +8,7 @@ help: you might have meant to write a `struct` literal | LL ~ pub fn new() -> Self { SomeStruct { LL | input_cells: Vec::new() -LL | -LL | + ... LL | LL ~ }} | diff --git a/src/test/ui/type/issue-67690-type-alias-bound-diagnostic-crash.stderr b/src/test/ui/type/issue-67690-type-alias-bound-diagnostic-crash.stderr index db215d2810a..125ffbbb417 100644 --- a/src/test/ui/type/issue-67690-type-alias-bound-diagnostic-crash.stderr +++ b/src/test/ui/type/issue-67690-type-alias-bound-diagnostic-crash.stderr @@ -9,7 +9,7 @@ help: the bound will not be checked when the type alias is used, and should be r | LL - pub type T<P: Send + Send + Send> = P; LL + pub type T<P> = P; - | + | warning: 1 warning emitted diff --git a/src/test/ui/type/issue-91268.rs b/src/test/ui/type/issue-91268.rs index 01ed9ea9e23..f1e16bc7bd3 100644 --- a/src/test/ui/type/issue-91268.rs +++ b/src/test/ui/type/issue-91268.rs @@ -1,7 +1,7 @@ // error-pattern: this file contains an unclosed delimiter // error-pattern: cannot find type `ţ` in this scope // error-pattern: parenthesized type parameters may only be used with a `Fn` trait -// error-pattern: type arguments are not allowed on this type +// error-pattern: type arguments are not allowed on builtin type `u8` // error-pattern: mismatched types // ignore-tidy-trailing-newlines // `ţ` must be the last character in this file, it cannot be followed by a newline diff --git a/src/test/ui/type/issue-91268.stderr b/src/test/ui/type/issue-91268.stderr index 71c357865fe..6c9ee994584 100644 --- a/src/test/ui/type/issue-91268.stderr +++ b/src/test/ui/type/issue-91268.stderr @@ -35,19 +35,19 @@ help: use angle brackets instead LL | 0: u8<ţ> | ~ + -error[E0109]: type arguments are not allowed on this type +error[E0109]: type arguments are not allowed on builtin type `u8` --> $DIR/issue-91268.rs:9:11 | LL | 0: u8(ţ | -- ^ type argument not allowed | | - | not allowed on this + | not allowed on builtin type `u8` | help: primitive type `u8` doesn't have generic parameters | LL - 0: u8(ţ LL + 0: u8 - | + | error[E0308]: mismatched types --> $DIR/issue-91268.rs:9:5 diff --git a/src/test/ui/type/type-alias-bounds.stderr b/src/test/ui/type/type-alias-bounds.stderr index dc44dede13b..92e573393c9 100644 --- a/src/test/ui/type/type-alias-bounds.stderr +++ b/src/test/ui/type/type-alias-bounds.stderr @@ -9,7 +9,7 @@ help: the bound will not be checked when the type alias is used, and should be r | LL - type SVec<T: Send + Send> = Vec<T>; LL + type SVec<T> = Vec<T>; - | + | warning: where clauses are not enforced in type aliases --> $DIR/type-alias-bounds.rs:10:21 @@ -21,7 +21,7 @@ help: the clause will not be checked when the type alias is used, and should be | LL - type S2Vec<T> where T: Send = Vec<T>; LL + type S2Vec<T> = Vec<T>; - | + | warning: bounds on generic parameters are not enforced in type aliases --> $DIR/type-alias-bounds.rs:12:19 @@ -33,7 +33,7 @@ help: the bound will not be checked when the type alias is used, and should be r | LL - type VVec<'b, 'a: 'b + 'b> = (&'b u32, Vec<&'a i32>); LL + type VVec<'b, 'a> = (&'b u32, Vec<&'a i32>); - | + | warning: bounds on generic parameters are not enforced in type aliases --> $DIR/type-alias-bounds.rs:14:18 @@ -45,7 +45,7 @@ help: the bound will not be checked when the type alias is used, and should be r | LL - type WVec<'b, T: 'b + 'b> = (&'b u32, Vec<T>); LL + type WVec<'b, T> = (&'b u32, Vec<T>); - | + | warning: where clauses are not enforced in type aliases --> $DIR/type-alias-bounds.rs:16:25 @@ -57,7 +57,7 @@ help: the clause will not be checked when the type alias is used, and should be | LL - type W2Vec<'b, T> where T: 'b, T: 'b = (&'b u32, Vec<T>); LL + type W2Vec<'b, T> = (&'b u32, Vec<T>); - | + | warning: bounds on generic parameters are not enforced in type aliases --> $DIR/type-alias-bounds.rs:47:12 @@ -74,7 +74,7 @@ help: the bound will not be checked when the type alias is used, and should be r | LL - type T1<U: Bound> = U::Assoc; LL + type T1<U> = U::Assoc; - | + | warning: where clauses are not enforced in type aliases --> $DIR/type-alias-bounds.rs:48:18 @@ -91,7 +91,7 @@ help: the clause will not be checked when the type alias is used, and should be | LL - type T2<U> where U: Bound = U::Assoc; LL + type T2<U> = U::Assoc; - | + | warning: bounds on generic parameters are not enforced in type aliases --> $DIR/type-alias-bounds.rs:56:12 @@ -103,7 +103,7 @@ help: the bound will not be checked when the type alias is used, and should be r | LL - type T5<U: Bound> = <U as Bound>::Assoc; LL + type T5<U> = <U as Bound>::Assoc; - | + | warning: bounds on generic parameters are not enforced in type aliases --> $DIR/type-alias-bounds.rs:57:12 @@ -115,7 +115,7 @@ help: the bound will not be checked when the type alias is used, and should be r | LL - type T6<U: Bound> = ::std::vec::Vec<U>; LL + type T6<U> = ::std::vec::Vec<U>; - | + | warning: 9 warnings emitted diff --git a/src/test/ui/type/type-parameter-defaults-referencing-Self.stderr b/src/test/ui/type/type-parameter-defaults-referencing-Self.stderr index 4fc21bd7af2..ea259cf3d37 100644 --- a/src/test/ui/type/type-parameter-defaults-referencing-Self.stderr +++ b/src/test/ui/type/type-parameter-defaults-referencing-Self.stderr @@ -5,7 +5,7 @@ LL | / trait Foo<T=Self> { LL | | fn method(&self); LL | | } | |_- type parameter `T` must be specified for this -LL | +LL | LL | fn foo(x: &dyn Foo) { } | ^^^ help: set the type parameter to the desired type: `Foo<T>` | diff --git a/src/test/ui/issues/issue-10401.rs b/src/test/ui/typeck/issue-10401.rs index d77ff381e1a..d77ff381e1a 100644 --- a/src/test/ui/issues/issue-10401.rs +++ b/src/test/ui/typeck/issue-10401.rs diff --git a/src/test/ui/issues/issue-10401.stderr b/src/test/ui/typeck/issue-10401.stderr index 1f68abcfb43..1f68abcfb43 100644 --- a/src/test/ui/issues/issue-10401.stderr +++ b/src/test/ui/typeck/issue-10401.stderr diff --git a/src/test/ui/typeck/issue-88803-call-expr-method.stderr b/src/test/ui/typeck/issue-88803-call-expr-method.stderr index dd717ed9416..645c04b87a1 100644 --- a/src/test/ui/typeck/issue-88803-call-expr-method.stderr +++ b/src/test/ui/typeck/issue-88803-call-expr-method.stderr @@ -8,7 +8,7 @@ help: remove wrapping parentheses to call the method | LL - (a.unwrap)() LL + a.unwrap() - | + | error: aborting due to previous error diff --git a/src/test/ui/typeck/prim-with-args.fixed b/src/test/ui/typeck/prim-with-args.fixed index 1c5fd750867..e3f99479a38 100644 --- a/src/test/ui/typeck/prim-with-args.fixed +++ b/src/test/ui/typeck/prim-with-args.fixed @@ -1,28 +1,28 @@ // run-rustfix fn main() { -let _x: isize; //~ ERROR type arguments are not allowed on this type -let _x: i8; //~ ERROR type arguments are not allowed on this type -let _x: i16; //~ ERROR type arguments are not allowed on this type -let _x: i32; //~ ERROR type arguments are not allowed on this type -let _x: i64; //~ ERROR type arguments are not allowed on this type -let _x: usize; //~ ERROR type arguments are not allowed on this type -let _x: u8; //~ ERROR type arguments are not allowed on this type -let _x: u16; //~ ERROR type arguments are not allowed on this type -let _x: u32; //~ ERROR type arguments are not allowed on this type -let _x: u64; //~ ERROR type arguments are not allowed on this type -let _x: char; //~ ERROR type arguments are not allowed on this type +let _x: isize; //~ ERROR type arguments are not allowed on builtin type +let _x: i8; //~ ERROR type arguments are not allowed on builtin type +let _x: i16; //~ ERROR type arguments are not allowed on builtin type +let _x: i32; //~ ERROR type arguments are not allowed on builtin type +let _x: i64; //~ ERROR type arguments are not allowed on builtin type +let _x: usize; //~ ERROR type arguments are not allowed on builtin type +let _x: u8; //~ ERROR type arguments are not allowed on builtin type +let _x: u16; //~ ERROR type arguments are not allowed on builtin type +let _x: u32; //~ ERROR type arguments are not allowed on builtin type +let _x: u64; //~ ERROR type arguments are not allowed on builtin type +let _x: char; //~ ERROR type arguments are not allowed on builtin type -let _x: isize; //~ ERROR lifetime arguments are not allowed on this type -let _x: i8; //~ ERROR lifetime arguments are not allowed on this type -let _x: i16; //~ ERROR lifetime arguments are not allowed on this type -let _x: i32; //~ ERROR lifetime arguments are not allowed on this type -let _x: i64; //~ ERROR lifetime arguments are not allowed on this type -let _x: usize; //~ ERROR lifetime arguments are not allowed on this type -let _x: u8; //~ ERROR lifetime arguments are not allowed on this type -let _x: u16; //~ ERROR lifetime arguments are not allowed on this type -let _x: u32; //~ ERROR lifetime arguments are not allowed on this type -let _x: u64; //~ ERROR lifetime arguments are not allowed on this type -let _x: char; //~ ERROR lifetime arguments are not allowed on this type +let _x: isize; //~ ERROR lifetime arguments are not allowed on builtin type +let _x: i8; //~ ERROR lifetime arguments are not allowed on builtin type +let _x: i16; //~ ERROR lifetime arguments are not allowed on builtin type +let _x: i32; //~ ERROR lifetime arguments are not allowed on builtin type +let _x: i64; //~ ERROR lifetime arguments are not allowed on builtin type +let _x: usize; //~ ERROR lifetime arguments are not allowed on builtin type +let _x: u8; //~ ERROR lifetime arguments are not allowed on builtin type +let _x: u16; //~ ERROR lifetime arguments are not allowed on builtin type +let _x: u32; //~ ERROR lifetime arguments are not allowed on builtin type +let _x: u64; //~ ERROR lifetime arguments are not allowed on builtin type +let _x: char; //~ ERROR lifetime arguments are not allowed on builtin type } diff --git a/src/test/ui/typeck/prim-with-args.rs b/src/test/ui/typeck/prim-with-args.rs index b05d6c1cb4e..b10471eccee 100644 --- a/src/test/ui/typeck/prim-with-args.rs +++ b/src/test/ui/typeck/prim-with-args.rs @@ -1,28 +1,28 @@ // run-rustfix fn main() { -let _x: isize<isize>; //~ ERROR type arguments are not allowed on this type -let _x: i8<isize>; //~ ERROR type arguments are not allowed on this type -let _x: i16<isize>; //~ ERROR type arguments are not allowed on this type -let _x: i32<isize>; //~ ERROR type arguments are not allowed on this type -let _x: i64<isize>; //~ ERROR type arguments are not allowed on this type -let _x: usize<isize>; //~ ERROR type arguments are not allowed on this type -let _x: u8<isize>; //~ ERROR type arguments are not allowed on this type -let _x: u16<isize>; //~ ERROR type arguments are not allowed on this type -let _x: u32<isize>; //~ ERROR type arguments are not allowed on this type -let _x: u64<isize>; //~ ERROR type arguments are not allowed on this type -let _x: char<isize>; //~ ERROR type arguments are not allowed on this type +let _x: isize<isize>; //~ ERROR type arguments are not allowed on builtin type +let _x: i8<isize>; //~ ERROR type arguments are not allowed on builtin type +let _x: i16<isize>; //~ ERROR type arguments are not allowed on builtin type +let _x: i32<isize>; //~ ERROR type arguments are not allowed on builtin type +let _x: i64<isize>; //~ ERROR type arguments are not allowed on builtin type +let _x: usize<isize>; //~ ERROR type arguments are not allowed on builtin type +let _x: u8<isize>; //~ ERROR type arguments are not allowed on builtin type +let _x: u16<isize>; //~ ERROR type arguments are not allowed on builtin type +let _x: u32<isize>; //~ ERROR type arguments are not allowed on builtin type +let _x: u64<isize>; //~ ERROR type arguments are not allowed on builtin type +let _x: char<isize>; //~ ERROR type arguments are not allowed on builtin type -let _x: isize<'static>; //~ ERROR lifetime arguments are not allowed on this type -let _x: i8<'static>; //~ ERROR lifetime arguments are not allowed on this type -let _x: i16<'static>; //~ ERROR lifetime arguments are not allowed on this type -let _x: i32<'static>; //~ ERROR lifetime arguments are not allowed on this type -let _x: i64<'static>; //~ ERROR lifetime arguments are not allowed on this type -let _x: usize<'static>; //~ ERROR lifetime arguments are not allowed on this type -let _x: u8<'static>; //~ ERROR lifetime arguments are not allowed on this type -let _x: u16<'static>; //~ ERROR lifetime arguments are not allowed on this type -let _x: u32<'static>; //~ ERROR lifetime arguments are not allowed on this type -let _x: u64<'static>; //~ ERROR lifetime arguments are not allowed on this type -let _x: char<'static>; //~ ERROR lifetime arguments are not allowed on this type +let _x: isize<'static>; //~ ERROR lifetime arguments are not allowed on builtin type +let _x: i8<'static>; //~ ERROR lifetime arguments are not allowed on builtin type +let _x: i16<'static>; //~ ERROR lifetime arguments are not allowed on builtin type +let _x: i32<'static>; //~ ERROR lifetime arguments are not allowed on builtin type +let _x: i64<'static>; //~ ERROR lifetime arguments are not allowed on builtin type +let _x: usize<'static>; //~ ERROR lifetime arguments are not allowed on builtin type +let _x: u8<'static>; //~ ERROR lifetime arguments are not allowed on builtin type +let _x: u16<'static>; //~ ERROR lifetime arguments are not allowed on builtin type +let _x: u32<'static>; //~ ERROR lifetime arguments are not allowed on builtin type +let _x: u64<'static>; //~ ERROR lifetime arguments are not allowed on builtin type +let _x: char<'static>; //~ ERROR lifetime arguments are not allowed on builtin type } diff --git a/src/test/ui/typeck/prim-with-args.stderr b/src/test/ui/typeck/prim-with-args.stderr index 7e7bc580b3b..2ddad5ad71e 100644 --- a/src/test/ui/typeck/prim-with-args.stderr +++ b/src/test/ui/typeck/prim-with-args.stderr @@ -1,310 +1,310 @@ -error[E0109]: type arguments are not allowed on this type +error[E0109]: type arguments are not allowed on builtin type `isize` --> $DIR/prim-with-args.rs:4:15 | LL | let _x: isize<isize>; | ----- ^^^^^ type argument not allowed | | - | not allowed on this + | not allowed on builtin type `isize` | help: primitive type `isize` doesn't have generic parameters | LL - let _x: isize<isize>; LL + let _x: isize; - | + | -error[E0109]: type arguments are not allowed on this type +error[E0109]: type arguments are not allowed on builtin type `i8` --> $DIR/prim-with-args.rs:5:12 | LL | let _x: i8<isize>; | -- ^^^^^ type argument not allowed | | - | not allowed on this + | not allowed on builtin type `i8` | help: primitive type `i8` doesn't have generic parameters | LL - let _x: i8<isize>; LL + let _x: i8; - | + | -error[E0109]: type arguments are not allowed on this type +error[E0109]: type arguments are not allowed on builtin type `i16` --> $DIR/prim-with-args.rs:6:13 | LL | let _x: i16<isize>; | --- ^^^^^ type argument not allowed | | - | not allowed on this + | not allowed on builtin type `i16` | help: primitive type `i16` doesn't have generic parameters | LL - let _x: i16<isize>; LL + let _x: i16; - | + | -error[E0109]: type arguments are not allowed on this type +error[E0109]: type arguments are not allowed on builtin type `i32` --> $DIR/prim-with-args.rs:7:13 | LL | let _x: i32<isize>; | --- ^^^^^ type argument not allowed | | - | not allowed on this + | not allowed on builtin type `i32` | help: primitive type `i32` doesn't have generic parameters | LL - let _x: i32<isize>; LL + let _x: i32; - | + | -error[E0109]: type arguments are not allowed on this type +error[E0109]: type arguments are not allowed on builtin type `i64` --> $DIR/prim-with-args.rs:8:13 | LL | let _x: i64<isize>; | --- ^^^^^ type argument not allowed | | - | not allowed on this + | not allowed on builtin type `i64` | help: primitive type `i64` doesn't have generic parameters | LL - let _x: i64<isize>; LL + let _x: i64; - | + | -error[E0109]: type arguments are not allowed on this type +error[E0109]: type arguments are not allowed on builtin type `usize` --> $DIR/prim-with-args.rs:9:15 | LL | let _x: usize<isize>; | ----- ^^^^^ type argument not allowed | | - | not allowed on this + | not allowed on builtin type `usize` | help: primitive type `usize` doesn't have generic parameters | LL - let _x: usize<isize>; LL + let _x: usize; - | + | -error[E0109]: type arguments are not allowed on this type +error[E0109]: type arguments are not allowed on builtin type `u8` --> $DIR/prim-with-args.rs:10:12 | LL | let _x: u8<isize>; | -- ^^^^^ type argument not allowed | | - | not allowed on this + | not allowed on builtin type `u8` | help: primitive type `u8` doesn't have generic parameters | LL - let _x: u8<isize>; LL + let _x: u8; - | + | -error[E0109]: type arguments are not allowed on this type +error[E0109]: type arguments are not allowed on builtin type `u16` --> $DIR/prim-with-args.rs:11:13 | LL | let _x: u16<isize>; | --- ^^^^^ type argument not allowed | | - | not allowed on this + | not allowed on builtin type `u16` | help: primitive type `u16` doesn't have generic parameters | LL - let _x: u16<isize>; LL + let _x: u16; - | + | -error[E0109]: type arguments are not allowed on this type +error[E0109]: type arguments are not allowed on builtin type `u32` --> $DIR/prim-with-args.rs:12:13 | LL | let _x: u32<isize>; | --- ^^^^^ type argument not allowed | | - | not allowed on this + | not allowed on builtin type `u32` | help: primitive type `u32` doesn't have generic parameters | LL - let _x: u32<isize>; LL + let _x: u32; - | + | -error[E0109]: type arguments are not allowed on this type +error[E0109]: type arguments are not allowed on builtin type `u64` --> $DIR/prim-with-args.rs:13:13 | LL | let _x: u64<isize>; | --- ^^^^^ type argument not allowed | | - | not allowed on this + | not allowed on builtin type `u64` | help: primitive type `u64` doesn't have generic parameters | LL - let _x: u64<isize>; LL + let _x: u64; - | + | -error[E0109]: type arguments are not allowed on this type +error[E0109]: type arguments are not allowed on builtin type `char` --> $DIR/prim-with-args.rs:14:14 | LL | let _x: char<isize>; | ---- ^^^^^ type argument not allowed | | - | not allowed on this + | not allowed on builtin type `char` | help: primitive type `char` doesn't have generic parameters | LL - let _x: char<isize>; LL + let _x: char; - | + | -error[E0109]: lifetime arguments are not allowed on this type +error[E0109]: lifetime arguments are not allowed on builtin type `isize` --> $DIR/prim-with-args.rs:16:15 | LL | let _x: isize<'static>; | ----- ^^^^^^^ lifetime argument not allowed | | - | not allowed on this + | not allowed on builtin type `isize` | help: primitive type `isize` doesn't have generic parameters | LL - let _x: isize<'static>; LL + let _x: isize; - | + | -error[E0109]: lifetime arguments are not allowed on this type +error[E0109]: lifetime arguments are not allowed on builtin type `i8` --> $DIR/prim-with-args.rs:17:12 | LL | let _x: i8<'static>; | -- ^^^^^^^ lifetime argument not allowed | | - | not allowed on this + | not allowed on builtin type `i8` | help: primitive type `i8` doesn't have generic parameters | LL - let _x: i8<'static>; LL + let _x: i8; - | + | -error[E0109]: lifetime arguments are not allowed on this type +error[E0109]: lifetime arguments are not allowed on builtin type `i16` --> $DIR/prim-with-args.rs:18:13 | LL | let _x: i16<'static>; | --- ^^^^^^^ lifetime argument not allowed | | - | not allowed on this + | not allowed on builtin type `i16` | help: primitive type `i16` doesn't have generic parameters | LL - let _x: i16<'static>; LL + let _x: i16; - | + | -error[E0109]: lifetime arguments are not allowed on this type +error[E0109]: lifetime arguments are not allowed on builtin type `i32` --> $DIR/prim-with-args.rs:19:13 | LL | let _x: i32<'static>; | --- ^^^^^^^ lifetime argument not allowed | | - | not allowed on this + | not allowed on builtin type `i32` | help: primitive type `i32` doesn't have generic parameters | LL - let _x: i32<'static>; LL + let _x: i32; - | + | -error[E0109]: lifetime arguments are not allowed on this type +error[E0109]: lifetime arguments are not allowed on builtin type `i64` --> $DIR/prim-with-args.rs:20:13 | LL | let _x: i64<'static>; | --- ^^^^^^^ lifetime argument not allowed | | - | not allowed on this + | not allowed on builtin type `i64` | help: primitive type `i64` doesn't have generic parameters | LL - let _x: i64<'static>; LL + let _x: i64; - | + | -error[E0109]: lifetime arguments are not allowed on this type +error[E0109]: lifetime arguments are not allowed on builtin type `usize` --> $DIR/prim-with-args.rs:21:15 | LL | let _x: usize<'static>; | ----- ^^^^^^^ lifetime argument not allowed | | - | not allowed on this + | not allowed on builtin type `usize` | help: primitive type `usize` doesn't have generic parameters | LL - let _x: usize<'static>; LL + let _x: usize; - | + | -error[E0109]: lifetime arguments are not allowed on this type +error[E0109]: lifetime arguments are not allowed on builtin type `u8` --> $DIR/prim-with-args.rs:22:12 | LL | let _x: u8<'static>; | -- ^^^^^^^ lifetime argument not allowed | | - | not allowed on this + | not allowed on builtin type `u8` | help: primitive type `u8` doesn't have generic parameters | LL - let _x: u8<'static>; LL + let _x: u8; - | + | -error[E0109]: lifetime arguments are not allowed on this type +error[E0109]: lifetime arguments are not allowed on builtin type `u16` --> $DIR/prim-with-args.rs:23:13 | LL | let _x: u16<'static>; | --- ^^^^^^^ lifetime argument not allowed | | - | not allowed on this + | not allowed on builtin type `u16` | help: primitive type `u16` doesn't have generic parameters | LL - let _x: u16<'static>; LL + let _x: u16; - | + | -error[E0109]: lifetime arguments are not allowed on this type +error[E0109]: lifetime arguments are not allowed on builtin type `u32` --> $DIR/prim-with-args.rs:24:13 | LL | let _x: u32<'static>; | --- ^^^^^^^ lifetime argument not allowed | | - | not allowed on this + | not allowed on builtin type `u32` | help: primitive type `u32` doesn't have generic parameters | LL - let _x: u32<'static>; LL + let _x: u32; - | + | -error[E0109]: lifetime arguments are not allowed on this type +error[E0109]: lifetime arguments are not allowed on builtin type `u64` --> $DIR/prim-with-args.rs:25:13 | LL | let _x: u64<'static>; | --- ^^^^^^^ lifetime argument not allowed | | - | not allowed on this + | not allowed on builtin type `u64` | help: primitive type `u64` doesn't have generic parameters | LL - let _x: u64<'static>; LL + let _x: u64; - | + | -error[E0109]: lifetime arguments are not allowed on this type +error[E0109]: lifetime arguments are not allowed on builtin type `char` --> $DIR/prim-with-args.rs:26:14 | LL | let _x: char<'static>; | ---- ^^^^^^^ lifetime argument not allowed | | - | not allowed on this + | not allowed on builtin type `char` | help: primitive type `char` doesn't have generic parameters | LL - let _x: char<'static>; LL + let _x: char; - | + | error: aborting due to 22 previous errors diff --git a/src/test/ui/typeck/struct-enum-wrong-args.stderr b/src/test/ui/typeck/struct-enum-wrong-args.stderr index aafb29f25d0..2ea822df275 100644 --- a/src/test/ui/typeck/struct-enum-wrong-args.stderr +++ b/src/test/ui/typeck/struct-enum-wrong-args.stderr @@ -45,8 +45,8 @@ LL | Ok(#[stable(feature = "rust1", since = "1.0.0")] T), | ^^ help: provide the argument | -LL | let _ = Ok({_}); - | ~~~~~~~ +LL | let _ = Ok(/* value */); + | ~~~~~~~~~~~~~~~ error[E0061]: this struct takes 1 argument but 0 arguments were supplied --> $DIR/struct-enum-wrong-args.rs:9:13 @@ -61,8 +61,8 @@ LL | struct Wrapper(i32); | ^^^^^^^ help: provide the argument | -LL | let _ = Wrapper({i32}); - | ~~~~~~~~~~~~~~ +LL | let _ = Wrapper(/* i32 */); + | ~~~~~~~~~~~~~~~~~~ error[E0061]: this struct takes 1 argument but 2 arguments were supplied --> $DIR/struct-enum-wrong-args.rs:10:13 @@ -93,8 +93,8 @@ LL | struct DoubleWrapper(i32, i32); | ^^^^^^^^^^^^^ help: provide the arguments | -LL | let _ = DoubleWrapper({i32}, {i32}); - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL | let _ = DoubleWrapper(/* i32 */, /* i32 */); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error[E0061]: this struct takes 2 arguments but 1 argument was supplied --> $DIR/struct-enum-wrong-args.rs:12:13 @@ -109,8 +109,8 @@ LL | struct DoubleWrapper(i32, i32); | ^^^^^^^^^^^^^ help: provide the argument | -LL | let _ = DoubleWrapper(5, {i32}); - | ~~~~~~~~~~~~~~~~~~~~~~~ +LL | let _ = DoubleWrapper(5, /* i32 */); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ error[E0061]: this struct takes 2 arguments but 3 arguments were supplied --> $DIR/struct-enum-wrong-args.rs:13:13 diff --git a/src/test/ui/unboxed-closures/unboxed-closure-sugar-lifetime-elision.stderr b/src/test/ui/unboxed-closures/unboxed-closure-sugar-lifetime-elision.stderr index 64d14d0fc5f..d25452456bb 100644 --- a/src/test/ui/unboxed-closures/unboxed-closure-sugar-lifetime-elision.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closure-sugar-lifetime-elision.stderr @@ -9,11 +9,10 @@ help: consider introducing a named lifetime parameter | LL ~ fn main<'a>() { LL | eq::< dyn for<'a> Foo<(&'a isize,), Output=&'a isize>, -LL | dyn Foo(&isize) -> &isize >(); -LL | eq::< dyn for<'a> Foo<(&'a isize,), Output=(&'a isize, &'a isize)>, -LL | dyn Foo(&isize) -> (&isize, &isize) >(); -LL | ... +LL | +LL ~ let _: dyn Foo(&'a isize, &'a usize) -> &'a usize; + | error: aborting due to previous error diff --git a/src/test/ui/unboxed-closures/unboxed-closures-failed-recursive-fn-1.stderr b/src/test/ui/unboxed-closures/unboxed-closures-failed-recursive-fn-1.stderr index 94de194705d..cbdb4dd0fb5 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-failed-recursive-fn-1.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closures-failed-recursive-fn-1.stderr @@ -31,7 +31,7 @@ error[E0597]: `factorial` does not live long enough | LL | let mut factorial: Option<Box<dyn Fn(u32) -> u32 + 'static>> = None; | ----------------------------------------- type annotation requires that `factorial` is borrowed for `'static` -LL | +LL | LL | let f = |x: u32| -> u32 { | --------------- value captured here LL | let g = factorial.as_ref().unwrap(); @@ -45,7 +45,7 @@ error[E0506]: cannot assign to `factorial` because it is borrowed | LL | let mut factorial: Option<Box<dyn Fn(u32) -> u32 + 'static>> = None; | ----------------------------------------- type annotation requires that `factorial` is borrowed for `'static` -LL | +LL | LL | let f = |x: u32| -> u32 { | --------------- borrow of `factorial` occurs here LL | let g = factorial.as_ref().unwrap(); diff --git a/src/test/ui/union/union-fields-1.mirunsafeck.stderr b/src/test/ui/union/union-fields-1.mirunsafeck.stderr index 9f1e2947c86..5b932b9626c 100644 --- a/src/test/ui/union/union-fields-1.mirunsafeck.stderr +++ b/src/test/ui/union/union-fields-1.mirunsafeck.stderr @@ -1,6 +1,9 @@ -error: field is never read: `c` +error: field `c` is never read --> $DIR/union-fields-1.rs:9:5 | +LL | union U1 { + | -- field in this union +... LL | c: u8, | ^^^^^ | @@ -10,21 +13,28 @@ note: the lint level is defined here LL | #![deny(dead_code)] | ^^^^^^^^^ -error: field is never read: `a` +error: field `a` is never read --> $DIR/union-fields-1.rs:12:5 | +LL | union U2 { + | -- field in this union LL | a: u8, | ^^^^^ -error: field is never read: `a` +error: field `a` is never read --> $DIR/union-fields-1.rs:16:20 | LL | union NoDropLike { a: u8 } - | ^^^^^ + | ---------- ^^^^^ + | | + | field in this union -error: field is never read: `c` +error: field `c` is never read --> $DIR/union-fields-1.rs:21:5 | +LL | union U { + | - field in this union +... LL | c: u8, | ^^^^^ diff --git a/src/test/ui/union/union-fields-1.rs b/src/test/ui/union/union-fields-1.rs index 3d3e2355a26..cf2ef4c03d6 100644 --- a/src/test/ui/union/union-fields-1.rs +++ b/src/test/ui/union/union-fields-1.rs @@ -6,19 +6,19 @@ union U1 { a: u8, // should not be reported b: u8, // should not be reported - c: u8, //~ ERROR field is never read + c: u8, //~ ERROR field `c` is never read } union U2 { - a: u8, //~ ERROR field is never read + a: u8, //~ ERROR field `a` is never read b: u8, // should not be reported c: u8, // should not be reported } -union NoDropLike { a: u8 } //~ ERROR field is never read +union NoDropLike { a: u8 } //~ ERROR field `a` is never read union U { a: u8, // should not be reported b: u8, // should not be reported - c: u8, //~ ERROR field is never read + c: u8, //~ ERROR field `c` is never read } type A = U; diff --git a/src/test/ui/union/union-fields-1.thirunsafeck.stderr b/src/test/ui/union/union-fields-1.thirunsafeck.stderr index 9f1e2947c86..5b932b9626c 100644 --- a/src/test/ui/union/union-fields-1.thirunsafeck.stderr +++ b/src/test/ui/union/union-fields-1.thirunsafeck.stderr @@ -1,6 +1,9 @@ -error: field is never read: `c` +error: field `c` is never read --> $DIR/union-fields-1.rs:9:5 | +LL | union U1 { + | -- field in this union +... LL | c: u8, | ^^^^^ | @@ -10,21 +13,28 @@ note: the lint level is defined here LL | #![deny(dead_code)] | ^^^^^^^^^ -error: field is never read: `a` +error: field `a` is never read --> $DIR/union-fields-1.rs:12:5 | +LL | union U2 { + | -- field in this union LL | a: u8, | ^^^^^ -error: field is never read: `a` +error: field `a` is never read --> $DIR/union-fields-1.rs:16:20 | LL | union NoDropLike { a: u8 } - | ^^^^^ + | ---------- ^^^^^ + | | + | field in this union -error: field is never read: `c` +error: field `c` is never read --> $DIR/union-fields-1.rs:21:5 | +LL | union U { + | - field in this union +... LL | c: u8, | ^^^^^ diff --git a/src/test/ui/union/union-lint-dead-code.mirunsafeck.stderr b/src/test/ui/union/union-lint-dead-code.mirunsafeck.stderr index 22d4428c902..f6e515f8400 100644 --- a/src/test/ui/union/union-lint-dead-code.mirunsafeck.stderr +++ b/src/test/ui/union/union-lint-dead-code.mirunsafeck.stderr @@ -1,6 +1,9 @@ -error: field is never read: `b` +error: field `b` is never read --> $DIR/union-lint-dead-code.rs:8:5 | +LL | union Foo { + | --- field in this union +LL | x: usize, LL | b: bool, | ^^^^^^^ | diff --git a/src/test/ui/union/union-lint-dead-code.rs b/src/test/ui/union/union-lint-dead-code.rs index 64c28d72e9e..65aaf0a1d35 100644 --- a/src/test/ui/union/union-lint-dead-code.rs +++ b/src/test/ui/union/union-lint-dead-code.rs @@ -5,7 +5,7 @@ union Foo { x: usize, - b: bool, //~ ERROR: field is never read + b: bool, //~ ERROR: field `b` is never read _unused: u16, } diff --git a/src/test/ui/union/union-lint-dead-code.thirunsafeck.stderr b/src/test/ui/union/union-lint-dead-code.thirunsafeck.stderr index 22d4428c902..f6e515f8400 100644 --- a/src/test/ui/union/union-lint-dead-code.thirunsafeck.stderr +++ b/src/test/ui/union/union-lint-dead-code.thirunsafeck.stderr @@ -1,6 +1,9 @@ -error: field is never read: `b` +error: field `b` is never read --> $DIR/union-lint-dead-code.rs:8:5 | +LL | union Foo { + | --- field in this union +LL | x: usize, LL | b: bool, | ^^^^^^^ | diff --git a/src/test/ui/union/union-sized-field.stderr b/src/test/ui/union/union-sized-field.stderr index 0f66f6c541b..3fe6e71f3b8 100644 --- a/src/test/ui/union/union-sized-field.stderr +++ b/src/test/ui/union/union-sized-field.stderr @@ -12,7 +12,7 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - union Foo<T: ?Sized> { LL + union Foo<T> { - | + | help: borrowed types always have a statically known size | LL | value: &T, @@ -36,7 +36,7 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - struct Foo2<T: ?Sized> { LL + struct Foo2<T> { - | + | help: borrowed types always have a statically known size | LL | value: &T, @@ -60,7 +60,7 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - enum Foo3<T: ?Sized> { LL + enum Foo3<T> { - | + | help: borrowed types always have a statically known size | LL | Value(&T), diff --git a/src/test/ui/unop-move-semantics.stderr b/src/test/ui/unop-move-semantics.stderr index 199d5e37278..14052486cbb 100644 --- a/src/test/ui/unop-move-semantics.stderr +++ b/src/test/ui/unop-move-semantics.stderr @@ -5,7 +5,7 @@ LL | fn move_then_borrow<T: Not<Output=T> + Clone>(x: T) { | - move occurs because `x` has type `T`, which does not implement the `Copy` trait LL | !x; | -- `x` moved due to usage in operator -LL | +LL | LL | x.clone(); | ^^^^^^^^^ value borrowed here after move | diff --git a/src/test/ui/issues/issue-3080.mir.stderr b/src/test/ui/unsafe/issue-3080.mir.stderr index f395c30b815..f395c30b815 100644 --- a/src/test/ui/issues/issue-3080.mir.stderr +++ b/src/test/ui/unsafe/issue-3080.mir.stderr diff --git a/src/test/ui/issues/issue-3080.rs b/src/test/ui/unsafe/issue-3080.rs index 2b5269dda8f..2b5269dda8f 100644 --- a/src/test/ui/issues/issue-3080.rs +++ b/src/test/ui/unsafe/issue-3080.rs diff --git a/src/test/ui/issues/issue-3080.thir.stderr b/src/test/ui/unsafe/issue-3080.thir.stderr index 4d8acac61d9..4d8acac61d9 100644 --- a/src/test/ui/issues/issue-3080.thir.stderr +++ b/src/test/ui/unsafe/issue-3080.thir.stderr diff --git a/src/test/ui/issues/issue-47412.mir.stderr b/src/test/ui/unsafe/issue-47412.mir.stderr index 305f482e8c2..305f482e8c2 100644 --- a/src/test/ui/issues/issue-47412.mir.stderr +++ b/src/test/ui/unsafe/issue-47412.mir.stderr diff --git a/src/test/ui/issues/issue-47412.rs b/src/test/ui/unsafe/issue-47412.rs index df6d6e4222e..df6d6e4222e 100644 --- a/src/test/ui/issues/issue-47412.rs +++ b/src/test/ui/unsafe/issue-47412.rs diff --git a/src/test/ui/issues/issue-47412.thir.stderr b/src/test/ui/unsafe/issue-47412.thir.stderr index 305f482e8c2..305f482e8c2 100644 --- a/src/test/ui/issues/issue-47412.thir.stderr +++ b/src/test/ui/unsafe/issue-47412.thir.stderr diff --git a/src/test/ui/unsized/unsized-bare-typaram.stderr b/src/test/ui/unsized/unsized-bare-typaram.stderr index 531e9b4c9c9..1eff14be8e1 100644 --- a/src/test/ui/unsized/unsized-bare-typaram.stderr +++ b/src/test/ui/unsized/unsized-bare-typaram.stderr @@ -15,7 +15,7 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - fn foo<T: ?Sized>() { bar::<T>() } LL + fn foo<T>() { bar::<T>() } - | + | 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 980dee87e58..5f2e224308f 100644 --- a/src/test/ui/unsized/unsized-enum.stderr +++ b/src/test/ui/unsized/unsized-enum.stderr @@ -22,7 +22,7 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - fn foo2<T: ?Sized>() { not_sized::<Foo<T>>() } LL + fn foo2<T>() { not_sized::<Foo<T>>() } - | + | error: aborting due to previous error diff --git a/src/test/ui/unsized/unsized-enum2.stderr b/src/test/ui/unsized/unsized-enum2.stderr index 3985f73f118..00b80327c9b 100644 --- a/src/test/ui/unsized/unsized-enum2.stderr +++ b/src/test/ui/unsized/unsized-enum2.stderr @@ -13,7 +13,7 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - enum E<W: ?Sized, X: ?Sized, Y: ?Sized, Z: ?Sized> { LL + enum E<W, X: ?Sized, Y: ?Sized, Z: ?Sized> { - | + | help: borrowed types always have a statically known size | LL | VA(&W), @@ -38,7 +38,7 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - enum E<W: ?Sized, X: ?Sized, Y: ?Sized, Z: ?Sized> { LL + enum E<W: ?Sized, X, Y: ?Sized, Z: ?Sized> { - | + | help: borrowed types always have a statically known size | LL | VB{x: &X}, @@ -63,7 +63,7 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - enum E<W: ?Sized, X: ?Sized, Y: ?Sized, Z: ?Sized> { LL + enum E<W: ?Sized, X: ?Sized, Y, Z: ?Sized> { - | + | help: borrowed types always have a statically known size | LL | VC(isize, &Y), @@ -88,7 +88,7 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - enum E<W: ?Sized, X: ?Sized, Y: ?Sized, Z: ?Sized> { LL + enum E<W: ?Sized, X: ?Sized, Y: ?Sized, Z> { - | + | help: borrowed types always have a statically known size | LL | VD{u: isize, x: &Z}, diff --git a/src/test/ui/unsized/unsized-fn-arg.stderr b/src/test/ui/unsized/unsized-fn-arg.stderr index d81dd7f342c..404fa5291b3 100644 --- a/src/test/ui/unsized/unsized-fn-arg.stderr +++ b/src/test/ui/unsized/unsized-fn-arg.stderr @@ -11,7 +11,7 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - fn f<T: ?Sized>(t: T) {} LL + fn f<T>(t: T) {} - | + | help: function arguments must have a statically known size, borrowed types always have a known size | LL | fn f<T: ?Sized>(t: &T) {} 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 1a3c7d788f0..a952aa063d1 100644 --- a/src/test/ui/unsized/unsized-inherent-impl-self-type.stderr +++ b/src/test/ui/unsized/unsized-inherent-impl-self-type.stderr @@ -22,7 +22,7 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - impl<X: ?Sized> S5<X> { LL + impl<X> S5<X> { - | + | error: aborting due to previous error diff --git a/src/test/ui/unsized/unsized-struct.stderr b/src/test/ui/unsized/unsized-struct.stderr index 1c70a840c77..c9510e92fec 100644 --- a/src/test/ui/unsized/unsized-struct.stderr +++ b/src/test/ui/unsized/unsized-struct.stderr @@ -22,7 +22,7 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - fn foo2<T: ?Sized>() { not_sized::<Foo<T>>() } LL + fn foo2<T>() { not_sized::<Foo<T>>() } - | + | error[E0277]: the size for values of type `T` cannot be known at compilation time --> $DIR/unsized-struct.rs:13:24 @@ -46,7 +46,7 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - fn bar2<T: ?Sized>() { is_sized::<Bar<T>>() } LL + fn bar2<T>() { is_sized::<Bar<T>>() } - | + | error: aborting due to 2 previous errors 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 da251d4078b..f6ba9a80cb1 100644 --- a/src/test/ui/unsized/unsized-trait-impl-self-type.stderr +++ b/src/test/ui/unsized/unsized-trait-impl-self-type.stderr @@ -22,7 +22,7 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - impl<X: ?Sized> T3<X> for S5<X> { LL + impl<X> T3<X> for S5<X> { - | + | error: aborting due to previous error 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 e91419070f5..f81487d5231 100644 --- a/src/test/ui/unsized/unsized-trait-impl-trait-arg.stderr +++ b/src/test/ui/unsized/unsized-trait-impl-trait-arg.stderr @@ -15,7 +15,7 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - impl<X: ?Sized> T2<X> for S4<X> { LL + impl<X> T2<X> for S4<X> { - | + | help: consider relaxing the implicit `Sized` restriction | LL | trait T2<Z: ?Sized> { diff --git a/src/test/ui/unsized/unsized3.stderr b/src/test/ui/unsized/unsized3.stderr index ae89f2f9977..65bdc4c2ea3 100644 --- a/src/test/ui/unsized/unsized3.stderr +++ b/src/test/ui/unsized/unsized3.stderr @@ -17,7 +17,7 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - fn f1<X: ?Sized>(x: &X) { LL + fn f1<X>(x: &X) { - | + | help: consider relaxing the implicit `Sized` restriction | LL | fn f2<X: ?Sized>(x: &X) { @@ -42,7 +42,7 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - fn f3<X: ?Sized + T>(x: &X) { LL + fn f3<X: T>(x: &X) { - | + | help: consider relaxing the implicit `Sized` restriction | LL | fn f4<X: T + ?Sized>(x: &X) { @@ -72,7 +72,7 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - fn f8<X: ?Sized>(x1: &S<X>, x2: &S<X>) { LL + fn f8<X>(x1: &S<X>, x2: &S<X>) { - | + | help: consider relaxing the implicit `Sized` restriction | LL | fn f5<Y: ?Sized>(x: &Y) {} @@ -98,7 +98,7 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - fn f9<X: ?Sized>(x1: Box<S<X>>) { LL + fn f9<X>(x1: Box<S<X>>) { - | + | error[E0277]: the size for values of type `X` cannot be known at compilation time --> $DIR/unsized3.rs:45:8 @@ -121,7 +121,7 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - fn f10<X: ?Sized>(x1: Box<S<X>>) { LL + fn f10<X>(x1: Box<S<X>>) { - | + | error: aborting due to 5 previous errors diff --git a/src/test/ui/unsized/unsized5.stderr b/src/test/ui/unsized/unsized5.stderr index 43463ff8266..03ed0c4574a 100644 --- a/src/test/ui/unsized/unsized5.stderr +++ b/src/test/ui/unsized/unsized5.stderr @@ -12,7 +12,7 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - struct S1<X: ?Sized> { LL + struct S1<X> { - | + | help: borrowed types always have a statically known size | LL | f1: &X, @@ -37,7 +37,7 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - struct S2<X: ?Sized> { LL + struct S2<X> { - | + | help: borrowed types always have a statically known size | LL | g: &X, @@ -97,7 +97,7 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - enum E<X: ?Sized> { LL + enum E<X> { - | + | help: borrowed types always have a statically known size | LL | V1(&X, isize), @@ -121,7 +121,7 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - enum F<X: ?Sized> { LL + enum F<X> { - | + | help: borrowed types always have a statically known size | LL | V2{f1: &X, f: isize}, diff --git a/src/test/ui/unsized/unsized6.stderr b/src/test/ui/unsized/unsized6.stderr index 38ed50daa1d..011f2b426c7 100644 --- a/src/test/ui/unsized/unsized6.stderr +++ b/src/test/ui/unsized/unsized6.stderr @@ -13,7 +13,7 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - fn f1<W: ?Sized, X: ?Sized, Y: ?Sized, Z: ?Sized>(x: &X) { LL + fn f1<W: ?Sized, X: ?Sized, Y, Z: ?Sized>(x: &X) { - | + | error[E0277]: the size for values of type `X` cannot be known at compilation time --> $DIR/unsized6.rs:7:12 @@ -29,7 +29,7 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - fn f1<W: ?Sized, X: ?Sized, Y: ?Sized, Z: ?Sized>(x: &X) { LL + fn f1<W: ?Sized, X, Y: ?Sized, Z: ?Sized>(x: &X) { - | + | error[E0277]: the size for values of type `Z` cannot be known at compilation time --> $DIR/unsized6.rs:11:12 @@ -45,7 +45,7 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - fn f1<W: ?Sized, X: ?Sized, Y: ?Sized, Z: ?Sized>(x: &X) { LL + fn f1<W: ?Sized, X: ?Sized, Y: ?Sized, Z>(x: &X) { - | + | error[E0277]: the size for values of type `X` cannot be known at compilation time --> $DIR/unsized6.rs:15:9 @@ -61,7 +61,7 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - fn f2<X: ?Sized, Y: ?Sized>(x: &X) { LL + fn f2<X, Y: ?Sized>(x: &X) { - | + | error[E0277]: the size for values of type `Y` cannot be known at compilation time --> $DIR/unsized6.rs:17:12 @@ -77,7 +77,7 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - fn f2<X: ?Sized, Y: ?Sized>(x: &X) { LL + fn f2<X: ?Sized, Y>(x: &X) { - | + | error[E0277]: the size for values of type `X` cannot be known at compilation time --> $DIR/unsized6.rs:22:9 @@ -93,7 +93,7 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - fn f3<X: ?Sized>(x1: Box<X>, x2: Box<X>, x3: Box<X>) { LL + fn f3<X>(x1: Box<X>, x2: Box<X>, x3: Box<X>) { - | + | error[E0277]: the size for values of type `X` cannot be known at compilation time --> $DIR/unsized6.rs:24:9 @@ -110,7 +110,7 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - fn f3<X: ?Sized>(x1: Box<X>, x2: Box<X>, x3: Box<X>) { LL + fn f3<X>(x1: Box<X>, x2: Box<X>, x3: Box<X>) { - | + | error[E0277]: the size for values of type `X` cannot be known at compilation time --> $DIR/unsized6.rs:26:10 @@ -127,7 +127,7 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - fn f3<X: ?Sized>(x1: Box<X>, x2: Box<X>, x3: Box<X>) { LL + fn f3<X>(x1: Box<X>, x2: Box<X>, x3: Box<X>) { - | + | error[E0277]: the size for values of type `X` cannot be known at compilation time --> $DIR/unsized6.rs:30:9 @@ -143,7 +143,7 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - fn f4<X: ?Sized + T>(x1: Box<X>, x2: Box<X>, x3: Box<X>) { LL + fn f4<X: T>(x1: Box<X>, x2: Box<X>, x3: Box<X>) { - | + | error[E0277]: the size for values of type `X` cannot be known at compilation time --> $DIR/unsized6.rs:32:9 @@ -160,7 +160,7 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - fn f4<X: ?Sized + T>(x1: Box<X>, x2: Box<X>, x3: Box<X>) { LL + fn f4<X: T>(x1: Box<X>, x2: Box<X>, x3: Box<X>) { - | + | error[E0277]: the size for values of type `X` cannot be known at compilation time --> $DIR/unsized6.rs:34:10 @@ -177,7 +177,7 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - fn f4<X: ?Sized + T>(x1: Box<X>, x2: Box<X>, x3: Box<X>) { LL + fn f4<X: T>(x1: Box<X>, x2: Box<X>, x3: Box<X>) { - | + | error[E0277]: the size for values of type `X` cannot be known at compilation time --> $DIR/unsized6.rs:38:18 @@ -192,7 +192,7 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - fn g1<X: ?Sized>(x: X) {} LL + fn g1<X>(x: X) {} - | + | help: function arguments must have a statically known size, borrowed types always have a known size | LL | fn g1<X: ?Sized>(x: &X) {} @@ -211,7 +211,7 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - fn g2<X: ?Sized + T>(x: X) {} LL + fn g2<X: T>(x: X) {} - | + | help: function arguments must have a statically known size, borrowed types always have a known size | LL | fn g2<X: ?Sized + T>(x: &X) {} diff --git a/src/test/ui/unsized/unsized7.stderr b/src/test/ui/unsized/unsized7.stderr index 3246e26e6eb..1555b9df4f8 100644 --- a/src/test/ui/unsized/unsized7.stderr +++ b/src/test/ui/unsized/unsized7.stderr @@ -15,7 +15,7 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - impl<X: ?Sized + T> T1<X> for S3<X> { LL + impl<X: T> T1<X> for S3<X> { - | + | help: consider relaxing the implicit `Sized` restriction | LL | trait T1<Z: T + ?Sized> { diff --git a/src/test/ui/use/use-after-move-implicity-coerced-object.stderr b/src/test/ui/use/use-after-move-implicity-coerced-object.stderr index 0ad6d6c7c0e..26804216d9d 100644 --- a/src/test/ui/use/use-after-move-implicity-coerced-object.stderr +++ b/src/test/ui/use/use-after-move-implicity-coerced-object.stderr @@ -6,7 +6,7 @@ LL | let n: Box<_> = Number { n: 42 }.into(); LL | let mut l: Box<_> = List { list: Vec::new() }.into(); LL | l.push(n); | - value moved here -LL | +LL | LL | let x = n.to_string(); | ^^^^^^^^^^^^^ value borrowed here after move diff --git a/src/test/ui/use/use-mod/use-mod-4.stderr b/src/test/ui/use/use-mod/use-mod-4.stderr index 5bb04b2633b..0b4fbadb458 100644 --- a/src/test/ui/use/use-mod/use-mod-4.stderr +++ b/src/test/ui/use/use-mod/use-mod-4.stderr @@ -8,7 +8,7 @@ help: consider importing the module directly | LL - use foo::self; LL + use foo; - | + | help: alternatively, use the multi-path `use` syntax to import `self` | LL | use foo::{self}; @@ -24,7 +24,7 @@ help: consider importing the module directly | LL - use std::mem::self; LL + use std::mem; - | + | help: alternatively, use the multi-path `use` syntax to import `self` | LL | use std::mem::{self}; diff --git a/src/test/ui/use/use-mod/use-mod-5.stderr b/src/test/ui/use/use-mod/use-mod-5.stderr index 627cf73c314..62859e261a3 100644 --- a/src/test/ui/use/use-mod/use-mod-5.stderr +++ b/src/test/ui/use/use-mod/use-mod-5.stderr @@ -8,7 +8,7 @@ help: consider importing the module directly | LL - use foo::bar::self; LL + use foo::bar; - | + | help: alternatively, use the multi-path `use` syntax to import `self` | LL | use foo::bar::{self}; diff --git a/src/test/ui/use/use-mod/use-mod-6.stderr b/src/test/ui/use/use-mod/use-mod-6.stderr index 7be6e7525cb..2d2c90067aa 100644 --- a/src/test/ui/use/use-mod/use-mod-6.stderr +++ b/src/test/ui/use/use-mod/use-mod-6.stderr @@ -8,7 +8,7 @@ help: consider importing the module directly | LL - use foo::bar::self as abc; LL + use foo::bar as abc; - | + | help: alternatively, use the multi-path `use` syntax to import `self` | LL | use foo::bar::{self as abc}; diff --git a/src/test/ui/use/use-self-type.rs b/src/test/ui/use/use-self-type.rs index 370593b2eb2..3b4ce429701 100644 --- a/src/test/ui/use/use-self-type.rs +++ b/src/test/ui/use/use-self-type.rs @@ -4,7 +4,7 @@ impl S { fn f() {} fn g() { use Self::f; //~ ERROR unresolved import - pub(in Self::f) struct Z; //~ ERROR use of undeclared type `Self` + pub(in Self::f) struct Z; //~ ERROR failed to resolve: `Self` } } diff --git a/src/test/ui/use/use-self-type.stderr b/src/test/ui/use/use-self-type.stderr index d1469fb3490..e6153941151 100644 --- a/src/test/ui/use/use-self-type.stderr +++ b/src/test/ui/use/use-self-type.stderr @@ -1,14 +1,14 @@ -error[E0433]: failed to resolve: use of undeclared type `Self` +error[E0433]: failed to resolve: `Self` is only available in impls, traits, and type definitions --> $DIR/use-self-type.rs:7:16 | LL | pub(in Self::f) struct Z; - | ^^^^ use of undeclared type `Self` + | ^^^^ `Self` is only available in impls, traits, and type definitions error[E0432]: unresolved import `Self` --> $DIR/use-self-type.rs:6:13 | LL | use Self::f; - | ^^^^ use of undeclared type `Self` + | ^^^^ `Self` is only available in impls, traits, and type definitions error: aborting due to 2 previous errors diff --git a/src/test/ui/usize-generic-argument-parent.rs b/src/test/ui/usize-generic-argument-parent.rs index 6d17ba9b5b2..4ab80d944a5 100644 --- a/src/test/ui/usize-generic-argument-parent.rs +++ b/src/test/ui/usize-generic-argument-parent.rs @@ -1,5 +1,5 @@ fn foo() { - let x: usize<foo>; //~ ERROR const arguments are not allowed on this type + let x: usize<foo>; //~ ERROR const arguments are not allowed on builtin type `usize` } fn main() {} diff --git a/src/test/ui/usize-generic-argument-parent.stderr b/src/test/ui/usize-generic-argument-parent.stderr index c657f0faa0b..131c476aa55 100644 --- a/src/test/ui/usize-generic-argument-parent.stderr +++ b/src/test/ui/usize-generic-argument-parent.stderr @@ -1,16 +1,16 @@ -error[E0109]: const arguments are not allowed on this type +error[E0109]: const arguments are not allowed on builtin type `usize` --> $DIR/usize-generic-argument-parent.rs:2:18 | LL | let x: usize<foo>; | ----- ^^^ const argument not allowed | | - | not allowed on this + | not allowed on builtin type `usize` | help: primitive type `usize` doesn't have generic parameters | LL - let x: usize<foo>; LL + let x: usize; - | + | error: aborting due to previous error diff --git a/src/test/ui/wf/issue-95665.rs b/src/test/ui/wf/issue-95665.rs new file mode 100644 index 00000000000..67923cbb2d6 --- /dev/null +++ b/src/test/ui/wf/issue-95665.rs @@ -0,0 +1,18 @@ +// Regression test for the ICE described in #95665. +// Ensure that the expected error is output (and thus that there is no ICE) + +pub trait Trait: {} + +pub struct Struct<T: Trait> { + member: T, +} + +// uncomment and bug goes away +// impl Trait for u8 {} + +extern "C" { + static VAR: Struct<u8>; + //~^ 14:17: 14:27: the trait bound `u8: Trait` is not satisfied [E0277] +} + +fn main() {} diff --git a/src/test/ui/wf/issue-95665.stderr b/src/test/ui/wf/issue-95665.stderr new file mode 100644 index 00000000000..b1cda59a916 --- /dev/null +++ b/src/test/ui/wf/issue-95665.stderr @@ -0,0 +1,15 @@ +error[E0277]: the trait bound `u8: Trait` is not satisfied + --> $DIR/issue-95665.rs:14:17 + | +LL | static VAR: Struct<u8>; + | ^^^^^^^^^^ the trait `Trait` is not implemented for `u8` + | +note: required by a bound in `Struct` + --> $DIR/issue-95665.rs:6:22 + | +LL | pub struct Struct<T: Trait> { + | ^^^^^ required by this bound in `Struct` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/src/tools/bump-stage0/src/main.rs b/src/tools/bump-stage0/src/main.rs index d6364e28fef..1c839fdc00a 100644 --- a/src/tools/bump-stage0/src/main.rs +++ b/src/tools/bump-stage0/src/main.rs @@ -4,11 +4,14 @@ use indexmap::IndexMap; use std::collections::HashMap; use std::convert::TryInto; -const DIST_SERVER: &str = "https://static.rust-lang.org"; +const PATH: &str = "src/stage0.json"; const COMPILER_COMPONENTS: &[&str] = &["rustc", "rust-std", "cargo"]; const RUSTFMT_COMPONENTS: &[&str] = &["rustfmt-preview"]; struct Tool { + config: Config, + comments: Vec<String>, + channel: Channel, version: [u16; 3], checksums: IndexMap<String, String>, @@ -32,18 +35,23 @@ impl Tool { .try_into() .map_err(|_| anyhow::anyhow!("failed to parse version"))?; - Ok(Self { channel, version, checksums: IndexMap::new() }) + let existing: Stage0 = serde_json::from_slice(&std::fs::read(PATH)?)?; + + Ok(Self { + channel, + version, + config: existing.config, + comments: existing.comments, + checksums: IndexMap::new(), + }) } fn update_json(mut self) -> Result<(), Error> { std::fs::write( - "src/stage0.json", + PATH, format!( "{}\n", serde_json::to_string_pretty(&Stage0 { - comment: "Generated by `./x.py run src/tools/bump-stage0`. \ - Run that command again to update the bootstrap compiler.", - dist_server: DIST_SERVER.into(), compiler: self.detect_compiler()?, rustfmt: self.detect_rustfmt()?, checksums_sha256: { @@ -51,7 +59,9 @@ impl Tool { // are added while filling the other struct fields just above this block. self.checksums.sort_keys(); self.checksums - } + }, + config: self.config, + comments: self.comments, })? ), )?; @@ -74,7 +84,7 @@ impl Tool { Channel::Nightly => "beta".to_string(), }; - let manifest = fetch_manifest(&channel)?; + let manifest = fetch_manifest(&self.config, &channel)?; self.collect_checksums(&manifest, COMPILER_COMPONENTS)?; Ok(Stage0Toolchain { date: manifest.date, @@ -100,13 +110,13 @@ impl Tool { return Ok(None); } - let manifest = fetch_manifest("nightly")?; + let manifest = fetch_manifest(&self.config, "nightly")?; self.collect_checksums(&manifest, RUSTFMT_COMPONENTS)?; Ok(Some(Stage0Toolchain { date: manifest.date, version: "nightly".into() })) } fn collect_checksums(&mut self, manifest: &Manifest, components: &[&str]) -> Result<(), Error> { - let prefix = format!("{}/", DIST_SERVER); + let prefix = format!("{}/", self.config.dist_server); for component in components { let pkg = manifest .pkg @@ -136,10 +146,10 @@ fn main() -> Result<(), Error> { Ok(()) } -fn fetch_manifest(channel: &str) -> Result<Manifest, Error> { +fn fetch_manifest(config: &Config, channel: &str) -> Result<Manifest, Error> { Ok(toml::from_slice(&http_get(&format!( "{}/dist/channel-rust-{}.toml", - DIST_SERVER, channel + config.dist_server, channel ))?)?) } @@ -166,35 +176,52 @@ enum Channel { Nightly, } -#[derive(Debug, serde::Serialize)] +#[derive(Debug, serde::Serialize, serde::Deserialize)] struct Stage0 { - #[serde(rename = "__comment")] - comment: &'static str, - dist_server: String, + config: Config, + // Comments are explicitly below the config, do not move them above. + // + // Downstream forks of the compiler codebase can change the configuration values defined above, + // but doing so would risk merge conflicts whenever they import new changes that include a + // bootstrap compiler bump. + // + // To lessen the pain, a big block of comments is placed between the configuration and the + // auto-generated parts of the file, preventing git diffs of the config to include parts of the + // auto-generated content and vice versa. This should prevent merge conflicts. + #[serde(rename = "__comments")] + comments: Vec<String>, compiler: Stage0Toolchain, rustfmt: Option<Stage0Toolchain>, checksums_sha256: IndexMap<String, String>, } -#[derive(Debug, serde::Serialize)] +#[derive(Debug, serde::Serialize, serde::Deserialize)] +struct Config { + dist_server: String, + artifacts_server: String, + artifacts_with_llvm_assertions_server: String, + git_merge_commit_email: String, +} + +#[derive(Debug, serde::Serialize, serde::Deserialize)] struct Stage0Toolchain { date: String, version: String, } -#[derive(Debug, serde::Deserialize)] +#[derive(Debug, serde::Serialize, serde::Deserialize)] struct Manifest { date: String, pkg: HashMap<String, ManifestPackage>, } -#[derive(Debug, serde::Deserialize)] +#[derive(Debug, serde::Serialize, serde::Deserialize)] struct ManifestPackage { version: String, target: HashMap<String, ManifestTargetPackage>, } -#[derive(Debug, serde::Deserialize)] +#[derive(Debug, serde::Serialize, serde::Deserialize)] struct ManifestTargetPackage { url: Option<String>, hash: Option<String>, diff --git a/src/tools/cargo b/src/tools/cargo -Subproject 4d92f07f34ba7fb7d7f207564942508f46c225d +Subproject 03a849043e25104e8b7ad0d4a96c525787b6937 diff --git a/src/tools/clippy/clippy_dev/src/bless.rs b/src/tools/clippy/clippy_dev/src/bless.rs index 8e5c739afe0..f5c51b9474f 100644 --- a/src/tools/clippy/clippy_dev/src/bless.rs +++ b/src/tools/clippy/clippy_dev/src/bless.rs @@ -4,12 +4,12 @@ use crate::cargo_clippy_path; use std::ffi::OsStr; use std::fs; -use std::lazy::SyncLazy; use std::path::{Path, PathBuf}; +use std::sync::LazyLock; use walkdir::{DirEntry, WalkDir}; -static CLIPPY_BUILD_TIME: SyncLazy<Option<std::time::SystemTime>> = - SyncLazy::new(|| cargo_clippy_path().metadata().ok()?.modified().ok()); +static CLIPPY_BUILD_TIME: LazyLock<Option<std::time::SystemTime>> = + LazyLock::new(|| cargo_clippy_path().metadata().ok()?.modified().ok()); /// # Panics /// diff --git a/src/tools/clippy/clippy_utils/src/lib.rs b/src/tools/clippy/clippy_utils/src/lib.rs index 73c1bdd0e3f..5106c39b5c6 100644 --- a/src/tools/clippy/clippy_utils/src/lib.rs +++ b/src/tools/clippy/clippy_utils/src/lib.rs @@ -64,7 +64,7 @@ pub use self::hir_utils::{ use std::collections::hash_map::Entry; use std::hash::BuildHasherDefault; -use std::lazy::SyncOnceCell; +use std::sync::OnceLock; use std::sync::{Mutex, MutexGuard}; use if_chain::if_chain; @@ -2080,7 +2080,7 @@ pub fn is_hir_ty_cfg_dependant(cx: &LateContext<'_>, ty: &hir::Ty<'_>) -> bool { false } -static TEST_ITEM_NAMES_CACHE: SyncOnceCell<Mutex<FxHashMap<LocalDefId, Vec<Symbol>>>> = SyncOnceCell::new(); +static TEST_ITEM_NAMES_CACHE: OnceLock<Mutex<FxHashMap<LocalDefId, Vec<Symbol>>>> = OnceLock::new(); fn with_test_item_names<'tcx>(tcx: TyCtxt<'tcx>, module: LocalDefId, f: impl Fn(&[Symbol]) -> bool) -> bool { let cache = TEST_ITEM_NAMES_CACHE.get_or_init(|| Mutex::new(FxHashMap::default())); diff --git a/src/tools/clippy/clippy_utils/src/sugg.rs b/src/tools/clippy/clippy_utils/src/sugg.rs index 4d21ba8bd1d..aa119539b1b 100644 --- a/src/tools/clippy/clippy_utils/src/sugg.rs +++ b/src/tools/clippy/clippy_utils/src/sugg.rs @@ -771,7 +771,7 @@ impl<T: LintContext> DiagnosticExt<T> for rustc_errors::Diagnostic { } } - self.span_suggestion(remove_span, msg, String::new(), applicability); + self.span_suggestion(remove_span, msg, "", applicability); } } diff --git a/src/tools/clippy/src/driver.rs b/src/tools/clippy/src/driver.rs index 7de40fe63ac..67467f89b47 100644 --- a/src/tools/clippy/src/driver.rs +++ b/src/tools/clippy/src/driver.rs @@ -21,11 +21,11 @@ use rustc_tools_util::VersionInfo; use std::borrow::Cow; use std::env; -use std::lazy::SyncLazy; use std::ops::Deref; use std::panic; use std::path::{Path, PathBuf}; use std::process::{exit, Command}; +use std::sync::LazyLock; /// If a command-line option matches `find_arg`, then apply the predicate `pred` on its value. If /// true, then return it. The parameter is assumed to be either `--arg=value` or `--arg value`. @@ -152,7 +152,7 @@ You can use tool lints to allow or deny lints from your code, eg.: const BUG_REPORT_URL: &str = "https://github.com/rust-lang/rust-clippy/issues/new"; -static ICE_HOOK: SyncLazy<Box<dyn Fn(&panic::PanicInfo<'_>) + Sync + Send + 'static>> = SyncLazy::new(|| { +static ICE_HOOK: LazyLock<Box<dyn Fn(&panic::PanicInfo<'_>) + Sync + Send + 'static>> = LazyLock::new(|| { let hook = panic::take_hook(); panic::set_hook(Box::new(|info| report_clippy_ice(info, BUG_REPORT_URL))); hook @@ -219,7 +219,7 @@ fn toolchain_path(home: Option<String>, toolchain: Option<String>) -> Option<Pat #[allow(clippy::too_many_lines)] pub fn main() { rustc_driver::init_rustc_env_logger(); - SyncLazy::force(&ICE_HOOK); + LazyLock::force(&ICE_HOOK); exit(rustc_driver::catch_with_exit_code(move || { let mut orig_args: Vec<String> = env::args().collect(); diff --git a/src/tools/clippy/tests/compile-test.rs b/src/tools/clippy/tests/compile-test.rs index 04c2eeff08b..061cda7e01e 100644 --- a/src/tools/clippy/tests/compile-test.rs +++ b/src/tools/clippy/tests/compile-test.rs @@ -12,8 +12,8 @@ use std::env::{self, remove_var, set_var, var_os}; use std::ffi::{OsStr, OsString}; use std::fs; use std::io; -use std::lazy::SyncLazy; use std::path::{Path, PathBuf}; +use std::sync::LazyLock; use test_utils::IS_RUSTC_TEST_SUITE; mod test_utils; @@ -69,7 +69,7 @@ extern crate tokio; /// dependencies must be added to Cargo.toml at the project root. Test /// dependencies that are not *directly* used by this test module require an /// `extern crate` declaration. -static EXTERN_FLAGS: SyncLazy<String> = SyncLazy::new(|| { +static EXTERN_FLAGS: LazyLock<String> = LazyLock::new(|| { let current_exe_depinfo = { let mut path = env::current_exe().unwrap(); path.set_extension("d"); diff --git a/src/tools/clippy/tests/test_utils/mod.rs b/src/tools/clippy/tests/test_utils/mod.rs index 8a4de3f6def..ea8c54e08b3 100644 --- a/src/tools/clippy/tests/test_utils/mod.rs +++ b/src/tools/clippy/tests/test_utils/mod.rs @@ -1,9 +1,9 @@ #![allow(dead_code)] // see https://github.com/rust-lang/rust/issues/46379 -use std::lazy::SyncLazy; use std::path::PathBuf; +use std::sync::LazyLock; -pub static CARGO_CLIPPY_PATH: SyncLazy<PathBuf> = SyncLazy::new(|| { +pub static CARGO_CLIPPY_PATH: LazyLock<PathBuf> = LazyLock::new(|| { let mut path = std::env::current_exe().unwrap(); assert!(path.pop()); // deps path.set_file_name("cargo-clippy"); diff --git a/src/tools/clippy/tests/ui/bind_instead_of_map_multipart.stderr b/src/tools/clippy/tests/ui/bind_instead_of_map_multipart.stderr index f822b6f49fa..0152a93feee 100644 --- a/src/tools/clippy/tests/ui/bind_instead_of_map_multipart.stderr +++ b/src/tools/clippy/tests/ui/bind_instead_of_map_multipart.stderr @@ -56,7 +56,25 @@ LL | if s == "43" { LL ~ return 43; LL | } LL | s == "42" +LL | } { +LL ~ return 45; +LL | } +LL | match s.len() { +LL ~ 10 => 2, +LL | 20 => { ... +LL | if foo() { +LL ~ return 20; +LL | } +LL | println!("foo"); +LL ~ 3 +LL | }; +LL | } +LL ~ 20 +LL | }, +LL ~ 40 => 30, +LL ~ _ => 1, + | error: using `Option.and_then(|x| Some(y))`, which is more succinctly expressed as `map(|x| y)` --> $DIR/bind_instead_of_map_multipart.rs:61:13 diff --git a/src/tools/clippy/tests/ui/branches_sharing_code/shared_at_top_and_bottom.stderr b/src/tools/clippy/tests/ui/branches_sharing_code/shared_at_top_and_bottom.stderr index 11843cc03d8..a270f637f2b 100644 --- a/src/tools/clippy/tests/ui/branches_sharing_code/shared_at_top_and_bottom.stderr +++ b/src/tools/clippy/tests/ui/branches_sharing_code/shared_at_top_and_bottom.stderr @@ -98,7 +98,8 @@ LL + id: e_id, LL + name: "Player 1".to_string(), LL + some_data: vec![0x12, 0x34, 0x56, 0x78, 0x90], LL + }; - ... +LL + process_data(pack); + | error: all if blocks contain the same code at both the start and the end --> $DIR/shared_at_top_and_bottom.rs:94:5 diff --git a/src/tools/clippy/tests/ui/entry.stderr b/src/tools/clippy/tests/ui/entry.stderr index 1076500498d..2ef9966525c 100644 --- a/src/tools/clippy/tests/ui/entry.stderr +++ b/src/tools/clippy/tests/ui/entry.stderr @@ -28,7 +28,8 @@ LL + v LL + } else { LL + v2 LL + } - ... +LL + }); + | error: usage of `contains_key` followed by `insert` on a `HashMap` --> $DIR/entry.rs:38:5 @@ -50,7 +51,8 @@ LL + v LL + } else { LL + v2 LL + } - ... +LL + }); + | error: usage of `contains_key` followed by `insert` on a `HashMap` --> $DIR/entry.rs:47:5 @@ -72,7 +74,9 @@ LL + e.insert(v); LL + } else { LL + e.insert(v2); LL + return; - ... +LL + } +LL + } + | error: usage of `contains_key` followed by `insert` on a `HashMap` --> $DIR/entry.rs:57:5 @@ -111,7 +115,11 @@ LL + 1 if true => { LL + v LL + }, LL + _ => { - ... +LL + v2 +LL + }, +LL + } +LL + }); + | error: usage of `contains_key` followed by `insert` on a `HashMap` --> $DIR/entry.rs:75:5 @@ -133,7 +141,9 @@ LL + 0 => foo(), LL + _ => { LL + e.insert(v2); LL + }, - ... +LL + }; +LL + } + | error: usage of `contains_key` followed by `insert` on a `HashMap` --> $DIR/entry.rs:85:5 @@ -155,7 +165,26 @@ LL + match 0 { LL + 0 if false => { LL + v LL + }, - ... +LL + 1 => { +LL + foo(); +LL + v +LL + }, +LL + 2 | 3 => { +LL + for _ in 0..2 { +LL + foo(); +LL + } +LL + if true { +LL + v +LL + } else { +LL + v2 +LL + } +LL + }, +LL + _ => { +LL + v2 +LL + }, +LL + } +LL + }); + | error: usage of `contains_key` followed by `insert` on a `HashMap` --> $DIR/entry.rs:119:5 diff --git a/src/tools/clippy/tests/ui/entry_with_else.stderr b/src/tools/clippy/tests/ui/entry_with_else.stderr index 7279efc5959..e0f6671b460 100644 --- a/src/tools/clippy/tests/ui/entry_with_else.stderr +++ b/src/tools/clippy/tests/ui/entry_with_else.stderr @@ -17,7 +17,9 @@ LL + e.insert(v); LL + } LL + std::collections::hash_map::Entry::Occupied(mut e) => { LL + e.insert(v2); - ... +LL + } +LL + } + | error: usage of `contains_key` followed by `insert` on a `HashMap` --> $DIR/entry_with_else.rs:22:5 @@ -37,7 +39,9 @@ LL + e.insert(v); LL + } LL + std::collections::hash_map::Entry::Vacant(e) => { LL + e.insert(v2); - ... +LL + } +LL + } + | error: usage of `contains_key` followed by `insert` on a `HashMap` --> $DIR/entry_with_else.rs:28:5 @@ -95,7 +99,9 @@ LL + e.insert(v); LL + } LL + std::collections::hash_map::Entry::Occupied(mut e) => { LL + e.insert(v2); - ... +LL + } +LL + } + | error: usage of `contains_key` followed by `insert` on a `HashMap` --> $DIR/entry_with_else.rs:46:5 @@ -115,7 +121,10 @@ LL + if true { Some(e.insert(v)) } else { Some(e.insert(v2)) } LL + } LL + std::collections::hash_map::Entry::Vacant(e) => { LL + e.insert(v); - ... +LL + None +LL + } +LL ~ }; + | error: usage of `contains_key` followed by `insert` on a `HashMap` --> $DIR/entry_with_else.rs:52:5 diff --git a/src/tools/clippy/tests/ui/eprint_with_newline.stderr b/src/tools/clippy/tests/ui/eprint_with_newline.stderr index 090dae3733d..f137787bff0 100644 --- a/src/tools/clippy/tests/ui/eprint_with_newline.stderr +++ b/src/tools/clippy/tests/ui/eprint_with_newline.stderr @@ -9,7 +9,7 @@ help: use `eprintln!` instead | LL - eprint!("Hello/n"); LL + eprintln!("Hello"); - | + | error: using `eprint!()` with a format string that ends in a single newline --> $DIR/eprint_with_newline.rs:6:5 @@ -21,7 +21,7 @@ help: use `eprintln!` instead | LL - eprint!("Hello {}/n", "world"); LL + eprintln!("Hello {}", "world"); - | + | error: using `eprint!()` with a format string that ends in a single newline --> $DIR/eprint_with_newline.rs:7:5 @@ -33,7 +33,7 @@ help: use `eprintln!` instead | LL - eprint!("Hello {} {}/n", "world", "#2"); LL + eprintln!("Hello {} {}", "world", "#2"); - | + | error: using `eprint!()` with a format string that ends in a single newline --> $DIR/eprint_with_newline.rs:8:5 @@ -45,7 +45,7 @@ help: use `eprintln!` instead | LL - eprint!("{}/n", 1265); LL + eprintln!("{}", 1265); - | + | error: using `eprint!()` with a format string that ends in a single newline --> $DIR/eprint_with_newline.rs:9:5 @@ -57,7 +57,7 @@ help: use `eprintln!` instead | LL - eprint!("/n"); LL + eprintln!(); - | + | error: using `eprint!()` with a format string that ends in a single newline --> $DIR/eprint_with_newline.rs:28:5 @@ -69,7 +69,7 @@ help: use `eprintln!` instead | LL - eprint!("//n"); // should fail LL + eprintln!("/"); // should fail - | + | error: using `eprint!()` with a format string that ends in a single newline --> $DIR/eprint_with_newline.rs:35:5 @@ -111,7 +111,7 @@ help: use `eprintln!` instead | LL - eprint!("/r/n"); //~ ERROR LL + eprintln!("/r"); //~ ERROR - | + | error: using `eprint!()` with a format string that ends in a single newline --> $DIR/eprint_with_newline.rs:48:5 @@ -123,7 +123,7 @@ help: use `eprintln!` instead | LL - eprint!("foo/rbar/n") // ~ ERROR LL + eprintln!("foo/rbar") // ~ ERROR - | + | error: aborting due to 10 previous errors diff --git a/src/tools/clippy/tests/ui/let_unit.stderr b/src/tools/clippy/tests/ui/let_unit.stderr index 13ec11a6d33..45bf67acdb7 100644 --- a/src/tools/clippy/tests/ui/let_unit.stderr +++ b/src/tools/clippy/tests/ui/let_unit.stderr @@ -32,7 +32,8 @@ LL + .map(|i| i * 2) LL + .filter(|i| i % 2 == 0) LL + .map(|_| ()) LL + .next() - ... +LL + .unwrap(); + | error: this let-binding has unit value --> $DIR/let_unit.rs:80:5 diff --git a/src/tools/clippy/tests/ui/manual_async_fn.stderr b/src/tools/clippy/tests/ui/manual_async_fn.stderr index 7435f46074c..0a903ed6fd4 100644 --- a/src/tools/clippy/tests/ui/manual_async_fn.stderr +++ b/src/tools/clippy/tests/ui/manual_async_fn.stderr @@ -122,7 +122,14 @@ LL + let a = 42; LL + let b = 21; LL + if a < b { LL + let c = 21; - ... +LL + let d = 42; +LL + if c < d { +LL + let _ = 42; +LL + } +LL + } +LL + 42 +LL + } + | error: this function can be simplified using the `async fn` syntax --> $DIR/manual_async_fn.rs:92:1 diff --git a/src/tools/clippy/tests/ui/manual_split_once.stderr b/src/tools/clippy/tests/ui/manual_split_once.stderr index 2563a6904b7..2696694680a 100644 --- a/src/tools/clippy/tests/ui/manual_split_once.stderr +++ b/src/tools/clippy/tests/ui/manual_split_once.stderr @@ -96,12 +96,12 @@ help: remove the `iter` usages | LL - let l = iter.next().unwrap(); LL + - | + | help: remove the `iter` usages | LL - let r = iter.next().unwrap(); LL + - | + | error: manual implementation of `split_once` --> $DIR/manual_split_once.rs:49:5 @@ -121,12 +121,12 @@ help: remove the `iter` usages | LL - let l = iter.next()?; LL + - | + | help: remove the `iter` usages | LL - let r = iter.next()?; LL + - | + | error: manual implementation of `rsplit_once` --> $DIR/manual_split_once.rs:53:5 @@ -146,12 +146,12 @@ help: remove the `iter` usages | LL - let r = iter.next().unwrap(); LL + - | + | help: remove the `iter` usages | LL - let l = iter.next().unwrap(); LL + - | + | error: manual implementation of `rsplit_once` --> $DIR/manual_split_once.rs:57:5 @@ -171,12 +171,12 @@ help: remove the `iter` usages | LL - let r = iter.next()?; LL + - | + | help: remove the `iter` usages | LL - let l = iter.next()?; LL + - | + | error: manual implementation of `split_once` --> $DIR/manual_split_once.rs:142:13 @@ -202,12 +202,12 @@ help: remove the `iter` usages | LL - let a = iter.next().unwrap(); LL + - | + | help: remove the `iter` usages | LL - let b = iter.next().unwrap(); LL + - | + | error: aborting due to 19 previous errors diff --git a/src/tools/clippy/tests/ui/map_unwrap_or.stderr b/src/tools/clippy/tests/ui/map_unwrap_or.stderr index 954000b8b76..abc9c1ece32 100644 --- a/src/tools/clippy/tests/ui/map_unwrap_or.stderr +++ b/src/tools/clippy/tests/ui/map_unwrap_or.stderr @@ -12,7 +12,7 @@ help: use `map_or(<a>, <f>)` instead | LL - let _ = opt.map(|x| x + 1) LL + let _ = opt.map_or(0, |x| x + 1); - | + | error: called `map(<f>).unwrap_or(<a>)` on an `Option` value. This can be done more directly by calling `map_or(<a>, <f>)` instead --> $DIR/map_unwrap_or.rs:20:13 @@ -59,7 +59,7 @@ help: use `and_then(<f>)` instead | LL - let _ = opt.map(|x| Some(x + 1)).unwrap_or(None); LL + let _ = opt.and_then(|x| Some(x + 1)); - | + | error: called `map(<f>).unwrap_or(None)` on an `Option` value. This can be done more directly by calling `and_then(<f>)` instead --> $DIR/map_unwrap_or.rs:31:13 @@ -92,7 +92,7 @@ help: use `and_then(<f>)` instead | LL - .map(|x| Some(x + 1)) LL + .and_then(|x| Some(x + 1)); - | + | error: called `map(<f>).unwrap_or(<a>)` on an `Option` value. This can be done more directly by calling `map_or(<a>, <f>)` instead --> $DIR/map_unwrap_or.rs:46:13 @@ -104,7 +104,7 @@ help: use `map_or(<a>, <f>)` instead | LL - let _ = Some("prefix").map(|p| format!("{}.", p)).unwrap_or(id); LL + let _ = Some("prefix").map_or(id, |p| format!("{}.", p)); - | + | error: called `map(<f>).unwrap_or_else(<g>)` on an `Option` value. This can be done more directly by calling `map_or_else(<g>, <f>)` instead --> $DIR/map_unwrap_or.rs:50:13 diff --git a/src/tools/clippy/tests/ui/needless_for_each_unfixable.stderr b/src/tools/clippy/tests/ui/needless_for_each_unfixable.stderr index f607e0a430e..7893ff31a6f 100644 --- a/src/tools/clippy/tests/ui/needless_for_each_unfixable.stderr +++ b/src/tools/clippy/tests/ui/needless_for_each_unfixable.stderr @@ -19,7 +19,8 @@ LL + return; LL + } else { LL + println!("{}", v); LL + } - ... +LL + } + | help: ...and replace `return` with `continue` | LL | continue; diff --git a/src/tools/clippy/tests/ui/needless_late_init.stderr b/src/tools/clippy/tests/ui/needless_late_init.stderr index f320b5b9cbb..313cdbbeba1 100644 --- a/src/tools/clippy/tests/ui/needless_late_init.stderr +++ b/src/tools/clippy/tests/ui/needless_late_init.stderr @@ -164,7 +164,7 @@ help: remove the assignments from the `match` arms | LL - 1 => f = "three", LL + 1 => "three", - | + | error: unneeded late initialization --> $DIR/needless_late_init.rs:76:5 @@ -180,7 +180,7 @@ help: remove the assignments from the branches | LL - g = 5; LL + 5 - | + | help: add a semicolon after the `if` expression | LL | }; diff --git a/src/tools/clippy/tests/ui/new_without_default.stderr b/src/tools/clippy/tests/ui/new_without_default.stderr index 19572dfe8b0..212a69ab94e 100644 --- a/src/tools/clippy/tests/ui/new_without_default.stderr +++ b/src/tools/clippy/tests/ui/new_without_default.stderr @@ -117,7 +117,8 @@ LL + Self::new() LL + } LL + } LL + - ... +LL ~ impl<T> Foo<T> { + | error: aborting due to 7 previous errors diff --git a/src/tools/clippy/tests/ui/print_literal.stderr b/src/tools/clippy/tests/ui/print_literal.stderr index a10cac04411..72aae075603 100644 --- a/src/tools/clippy/tests/ui/print_literal.stderr +++ b/src/tools/clippy/tests/ui/print_literal.stderr @@ -9,7 +9,7 @@ help: try this | LL - print!("Hello {}", "world"); LL + print!("Hello world"); - | + | error: literal with an empty format string --> $DIR/print_literal.rs:26:36 @@ -21,7 +21,7 @@ help: try this | LL - println!("Hello {} {}", world, "world"); LL + println!("Hello {} world", world); - | + | error: literal with an empty format string --> $DIR/print_literal.rs:27:26 @@ -33,7 +33,7 @@ help: try this | LL - println!("Hello {}", "world"); LL + println!("Hello world"); - | + | error: literal with an empty format string --> $DIR/print_literal.rs:32:25 @@ -45,7 +45,7 @@ help: try this | LL - println!("{0} {1}", "hello", "world"); LL + println!("hello {1}", "world"); - | + | error: literal with an empty format string --> $DIR/print_literal.rs:32:34 @@ -57,7 +57,7 @@ help: try this | LL - println!("{0} {1}", "hello", "world"); LL + println!("{0} world", "hello"); - | + | error: literal with an empty format string --> $DIR/print_literal.rs:33:25 @@ -69,7 +69,7 @@ help: try this | LL - println!("{1} {0}", "hello", "world"); LL + println!("{1} hello", "world"); - | + | error: literal with an empty format string --> $DIR/print_literal.rs:33:34 @@ -81,7 +81,7 @@ help: try this | LL - println!("{1} {0}", "hello", "world"); LL + println!("world {0}", "hello"); - | + | error: literal with an empty format string --> $DIR/print_literal.rs:36:29 @@ -93,7 +93,7 @@ help: try this | LL - println!("{foo} {bar}", foo = "hello", bar = "world"); LL + println!("hello {bar}", bar = "world"); - | + | error: literal with an empty format string --> $DIR/print_literal.rs:36:44 @@ -105,7 +105,7 @@ help: try this | LL - println!("{foo} {bar}", foo = "hello", bar = "world"); LL + println!("{foo} world", foo = "hello"); - | + | error: literal with an empty format string --> $DIR/print_literal.rs:37:29 @@ -117,7 +117,7 @@ help: try this | LL - println!("{bar} {foo}", foo = "hello", bar = "world"); LL + println!("{bar} hello", bar = "world"); - | + | error: literal with an empty format string --> $DIR/print_literal.rs:37:44 @@ -129,7 +129,7 @@ help: try this | LL - println!("{bar} {foo}", foo = "hello", bar = "world"); LL + println!("world {foo}", foo = "hello"); - | + | error: aborting due to 11 previous errors diff --git a/src/tools/clippy/tests/ui/print_with_newline.stderr b/src/tools/clippy/tests/ui/print_with_newline.stderr index d409bee30ec..edbaa1cdf97 100644 --- a/src/tools/clippy/tests/ui/print_with_newline.stderr +++ b/src/tools/clippy/tests/ui/print_with_newline.stderr @@ -9,7 +9,7 @@ help: use `println!` instead | LL - print!("Hello/n"); LL + println!("Hello"); - | + | error: using `print!()` with a format string that ends in a single newline --> $DIR/print_with_newline.rs:9:5 @@ -21,7 +21,7 @@ help: use `println!` instead | LL - print!("Hello {}/n", "world"); LL + println!("Hello {}", "world"); - | + | error: using `print!()` with a format string that ends in a single newline --> $DIR/print_with_newline.rs:10:5 @@ -33,7 +33,7 @@ help: use `println!` instead | LL - print!("Hello {} {}/n", "world", "#2"); LL + println!("Hello {} {}", "world", "#2"); - | + | error: using `print!()` with a format string that ends in a single newline --> $DIR/print_with_newline.rs:11:5 @@ -45,7 +45,7 @@ help: use `println!` instead | LL - print!("{}/n", 1265); LL + println!("{}", 1265); - | + | error: using `print!()` with a format string that ends in a single newline --> $DIR/print_with_newline.rs:12:5 @@ -57,7 +57,7 @@ help: use `println!` instead | LL - print!("/n"); LL + println!(); - | + | error: using `print!()` with a format string that ends in a single newline --> $DIR/print_with_newline.rs:31:5 @@ -69,7 +69,7 @@ help: use `println!` instead | LL - print!("//n"); // should fail LL + println!("/"); // should fail - | + | error: using `print!()` with a format string that ends in a single newline --> $DIR/print_with_newline.rs:38:5 @@ -111,7 +111,7 @@ help: use `println!` instead | LL - print!("/r/n"); //~ ERROR LL + println!("/r"); //~ ERROR - | + | error: using `print!()` with a format string that ends in a single newline --> $DIR/print_with_newline.rs:51:5 @@ -123,7 +123,7 @@ help: use `println!` instead | LL - print!("foo/rbar/n") // ~ ERROR LL + println!("foo/rbar") // ~ ERROR - | + | error: aborting due to 10 previous errors diff --git a/src/tools/clippy/tests/ui/ptr_arg.stderr b/src/tools/clippy/tests/ui/ptr_arg.stderr index a9613daadde..7ec4a566ff3 100644 --- a/src/tools/clippy/tests/ui/ptr_arg.stderr +++ b/src/tools/clippy/tests/ui/ptr_arg.stderr @@ -56,7 +56,8 @@ LL | let f = e.clone(); // OK LL | let g = x; LL ~ let h = g.to_owned(); LL | let i = (e).clone(); - ... +LL ~ x.to_owned() + | error: writing `&String` instead of `&str` involves a new object where a slice will do --> $DIR/ptr_arg.rs:57:18 diff --git a/src/tools/clippy/tests/ui/significant_drop_in_scrutinee.stderr b/src/tools/clippy/tests/ui/significant_drop_in_scrutinee.stderr index 303f3c1df03..5ce95204416 100644 --- a/src/tools/clippy/tests/ui/significant_drop_in_scrutinee.stderr +++ b/src/tools/clippy/tests/ui/significant_drop_in_scrutinee.stderr @@ -188,7 +188,9 @@ LL + _ => mutex2.lock().unwrap(), LL + } LL + .s LL + .len() - ... +LL + > 1; +LL ~ match value + | error: temporary with significant drop in match scrutinee --> $DIR/significant_drop_in_scrutinee.rs:397:11 @@ -211,7 +213,10 @@ LL + } else { LL + mutex2.lock().unwrap() LL + } LL + .s - ... +LL + .len() +LL + > 1; +LL ~ match value + | error: temporary with significant drop in match scrutinee --> $DIR/significant_drop_in_scrutinee.rs:451:11 diff --git a/src/tools/clippy/tests/ui/unit_arg.stderr b/src/tools/clippy/tests/ui/unit_arg.stderr index 394dee29dc9..11cfe66a30e 100644 --- a/src/tools/clippy/tests/ui/unit_arg.stderr +++ b/src/tools/clippy/tests/ui/unit_arg.stderr @@ -137,7 +137,13 @@ LL + foo(1); LL + }; LL + { LL + foo(2); - ... +LL + foo(3); +LL + }; +LL + taking_multiple_units( +LL + (), +LL + (), +LL ~ ); + | error: passing a unit value to a function --> $DIR/unit_arg.rs:85:13 diff --git a/src/tools/clippy/tests/ui/unnecessary_iter_cloned.stderr b/src/tools/clippy/tests/ui/unnecessary_iter_cloned.stderr index e44379f8aa0..8f151e620a2 100644 --- a/src/tools/clippy/tests/ui/unnecessary_iter_cloned.stderr +++ b/src/tools/clippy/tests/ui/unnecessary_iter_cloned.stderr @@ -13,7 +13,7 @@ help: remove this `&` | LL - let other = match get_file_path(&t) { LL + let other = match get_file_path(t) { - | + | error: unnecessary use of `copied` --> $DIR/unnecessary_iter_cloned.rs:46:22 @@ -29,7 +29,7 @@ help: remove this `&` | LL - let other = match get_file_path(&t) { LL + let other = match get_file_path(t) { - | + | error: aborting due to 2 previous errors diff --git a/src/tools/clippy/tests/ui/unnecessary_to_owned.stderr b/src/tools/clippy/tests/ui/unnecessary_to_owned.stderr index af7e7b41fb0..243b4599dba 100644 --- a/src/tools/clippy/tests/ui/unnecessary_to_owned.stderr +++ b/src/tools/clippy/tests/ui/unnecessary_to_owned.stderr @@ -489,7 +489,7 @@ help: remove this `&` | LL - let path = match get_file_path(&t) { LL + let path = match get_file_path(t) { - | + | error: unnecessary use of `to_vec` --> $DIR/unnecessary_to_owned.rs:221:14 diff --git a/src/tools/clippy/tests/ui/unnecessary_wraps.stderr b/src/tools/clippy/tests/ui/unnecessary_wraps.stderr index 8e31db39502..a6a0b22cf68 100644 --- a/src/tools/clippy/tests/ui/unnecessary_wraps.stderr +++ b/src/tools/clippy/tests/ui/unnecessary_wraps.stderr @@ -23,7 +23,8 @@ LL | if a { LL | Some(-1); LL ~ 2 LL | } else { - ... +LL ~ return 1337; + | error: this function's return value is unnecessarily wrapped by `Option` --> $DIR/unnecessary_wraps.rs:21:1 @@ -122,7 +123,8 @@ LL | if a { LL | Some(()); LL ~ LL | } else { - ... +LL ~ return ; + | error: this function's return value is unnecessary --> $DIR/unnecessary_wraps.rs:117:1 diff --git a/src/tools/clippy/tests/ui/write_literal.stderr b/src/tools/clippy/tests/ui/write_literal.stderr index 593e9493ec5..3c5ec91d3e0 100644 --- a/src/tools/clippy/tests/ui/write_literal.stderr +++ b/src/tools/clippy/tests/ui/write_literal.stderr @@ -9,7 +9,7 @@ help: try this | LL - write!(v, "Hello {}", "world"); LL + write!(v, "Hello world"); - | + | error: literal with an empty format string --> $DIR/write_literal.rs:31:39 @@ -21,7 +21,7 @@ help: try this | LL - writeln!(v, "Hello {} {}", world, "world"); LL + writeln!(v, "Hello {} world", world); - | + | error: literal with an empty format string --> $DIR/write_literal.rs:32:29 @@ -33,7 +33,7 @@ help: try this | LL - writeln!(v, "Hello {}", "world"); LL + writeln!(v, "Hello world"); - | + | error: literal with an empty format string --> $DIR/write_literal.rs:37:28 @@ -45,7 +45,7 @@ help: try this | LL - writeln!(v, "{0} {1}", "hello", "world"); LL + writeln!(v, "hello {1}", "world"); - | + | error: literal with an empty format string --> $DIR/write_literal.rs:37:37 @@ -57,7 +57,7 @@ help: try this | LL - writeln!(v, "{0} {1}", "hello", "world"); LL + writeln!(v, "{0} world", "hello"); - | + | error: literal with an empty format string --> $DIR/write_literal.rs:38:28 @@ -69,7 +69,7 @@ help: try this | LL - writeln!(v, "{1} {0}", "hello", "world"); LL + writeln!(v, "{1} hello", "world"); - | + | error: literal with an empty format string --> $DIR/write_literal.rs:38:37 @@ -81,7 +81,7 @@ help: try this | LL - writeln!(v, "{1} {0}", "hello", "world"); LL + writeln!(v, "world {0}", "hello"); - | + | error: literal with an empty format string --> $DIR/write_literal.rs:41:32 @@ -93,7 +93,7 @@ help: try this | LL - writeln!(v, "{foo} {bar}", foo = "hello", bar = "world"); LL + writeln!(v, "hello {bar}", bar = "world"); - | + | error: literal with an empty format string --> $DIR/write_literal.rs:41:47 @@ -105,7 +105,7 @@ help: try this | LL - writeln!(v, "{foo} {bar}", foo = "hello", bar = "world"); LL + writeln!(v, "{foo} world", foo = "hello"); - | + | error: literal with an empty format string --> $DIR/write_literal.rs:42:32 @@ -117,7 +117,7 @@ help: try this | LL - writeln!(v, "{bar} {foo}", foo = "hello", bar = "world"); LL + writeln!(v, "{bar} hello", bar = "world"); - | + | error: literal with an empty format string --> $DIR/write_literal.rs:42:47 @@ -129,7 +129,7 @@ help: try this | LL - writeln!(v, "{bar} {foo}", foo = "hello", bar = "world"); LL + writeln!(v, "world {foo}", foo = "hello"); - | + | error: aborting due to 11 previous errors diff --git a/src/tools/clippy/tests/ui/write_literal_2.stderr b/src/tools/clippy/tests/ui/write_literal_2.stderr index fc40fbfa9e2..9ff297069c4 100644 --- a/src/tools/clippy/tests/ui/write_literal_2.stderr +++ b/src/tools/clippy/tests/ui/write_literal_2.stderr @@ -9,7 +9,7 @@ help: try this | LL - writeln!(v, "{}", "{hello}"); LL + writeln!(v, "{{hello}}"); - | + | error: literal with an empty format string --> $DIR/write_literal_2.rs:10:24 @@ -21,7 +21,7 @@ help: try this | LL - writeln!(v, r"{}", r"{hello}"); LL + writeln!(v, r"{{hello}}"); - | + | error: literal with an empty format string --> $DIR/write_literal_2.rs:11:23 @@ -33,7 +33,7 @@ help: try this | LL - writeln!(v, "{}", '/''); LL + writeln!(v, "'"); - | + | error: literal with an empty format string --> $DIR/write_literal_2.rs:12:23 @@ -45,7 +45,7 @@ help: try this | LL - writeln!(v, "{}", '"'); LL + writeln!(v, "/""); - | + | error: literal with an empty format string --> $DIR/write_literal_2.rs:14:24 @@ -57,7 +57,7 @@ help: try this | LL - writeln!(v, r"{}", '/''); LL + writeln!(v, r"'"); - | + | error: literal with an empty format string --> $DIR/write_literal_2.rs:18:9 diff --git a/src/tools/clippy/tests/ui/write_with_newline.stderr b/src/tools/clippy/tests/ui/write_with_newline.stderr index 3314a2a6e24..5f55431be0b 100644 --- a/src/tools/clippy/tests/ui/write_with_newline.stderr +++ b/src/tools/clippy/tests/ui/write_with_newline.stderr @@ -9,7 +9,7 @@ help: use `writeln!()` instead | LL - write!(v, "Hello/n"); LL + writeln!(v, "Hello"); - | + | error: using `write!()` with a format string that ends in a single newline --> $DIR/write_with_newline.rs:14:5 @@ -21,7 +21,7 @@ help: use `writeln!()` instead | LL - write!(v, "Hello {}/n", "world"); LL + writeln!(v, "Hello {}", "world"); - | + | error: using `write!()` with a format string that ends in a single newline --> $DIR/write_with_newline.rs:15:5 @@ -33,7 +33,7 @@ help: use `writeln!()` instead | LL - write!(v, "Hello {} {}/n", "world", "#2"); LL + writeln!(v, "Hello {} {}", "world", "#2"); - | + | error: using `write!()` with a format string that ends in a single newline --> $DIR/write_with_newline.rs:16:5 @@ -45,7 +45,7 @@ help: use `writeln!()` instead | LL - write!(v, "{}/n", 1265); LL + writeln!(v, "{}", 1265); - | + | error: using `write!()` with a format string that ends in a single newline --> $DIR/write_with_newline.rs:17:5 @@ -57,7 +57,7 @@ help: use `writeln!()` instead | LL - write!(v, "/n"); LL + writeln!(v); - | + | error: using `write!()` with a format string that ends in a single newline --> $DIR/write_with_newline.rs:36:5 @@ -69,7 +69,7 @@ help: use `writeln!()` instead | LL - write!(v, "//n"); // should fail LL + writeln!(v, "/"); // should fail - | + | error: using `write!()` with a format string that ends in a single newline --> $DIR/write_with_newline.rs:43:5 @@ -115,7 +115,7 @@ help: use `writeln!()` instead | LL - write!(v, "/r/n"); //~ ERROR LL + writeln!(v, "/r"); //~ ERROR - | + | error: using `write!()` with a format string that ends in a single newline --> $DIR/write_with_newline.rs:58:5 @@ -127,7 +127,7 @@ help: use `writeln!()` instead | LL - write!(v, "foo/rbar/n"); LL + writeln!(v, "foo/rbar"); - | + | error: aborting due to 10 previous errors diff --git a/src/tools/miri b/src/tools/miri -Subproject 4c1f50bf2bef7b25613a4c42322de87ffcf8c92 +Subproject c4dd3f4ef98f8527aa652e8154ff044ca3e8845 diff --git a/src/tools/rls b/src/tools/rls -Subproject 7241c6cc45badc0e30cefd6c123a539f82c50cd +Subproject 27f4044df03d15c7c38a483c3e4635cf4f51807 diff --git a/src/tools/rust-analyzer b/src/tools/rust-analyzer -Subproject 366bd7242ed00c65f293497a26eb81c7510ac68 +Subproject 427061da19723f2206fe4dcb175c9c43b9a6193 diff --git a/src/tools/rustc-workspace-hack/Cargo.toml b/src/tools/rustc-workspace-hack/Cargo.toml index 992a2e83f63..40aa0e8f715 100644 --- a/src/tools/rustc-workspace-hack/Cargo.toml +++ b/src/tools/rustc-workspace-hack/Cargo.toml @@ -73,7 +73,7 @@ features = [ [dependencies] bstr = { version = "0.2.13", features = ["default"] } byteorder = { version = "1", features = ['default', 'std'] } -clap = { version = "3.1.1", features = ["lazy_static", "derive", "clap_derive"]} +clap = { version = "3.1.1", features = ["derive", "clap_derive"]} curl-sys = { version = "0.4.13", features = ["http2", "libnghttp2-sys"], optional = true } crossbeam-utils = { version = "0.8.0", features = ["nightly"] } libc = { version = "0.2.79", features = ["align"] } diff --git a/src/tools/tidy/src/ui_tests.rs b/src/tools/tidy/src/ui_tests.rs index f59121181d2..8ec5c332493 100644 --- a/src/tools/tidy/src/ui_tests.rs +++ b/src/tools/tidy/src/ui_tests.rs @@ -8,7 +8,7 @@ use std::path::Path; const ENTRY_LIMIT: usize = 1000; // FIXME: The following limits should be reduced eventually. const ROOT_ENTRY_LIMIT: usize = 968; -const ISSUES_ENTRY_LIMIT: usize = 2179; +const ISSUES_ENTRY_LIMIT: usize = 2147; fn check_entries(path: &Path, bad: &mut bool) { let dirs = walkdir::WalkDir::new(&path.join("test/ui")) |
