diff --git a/RELEASES.md b/RELEASES.md index d634feba33ac5..ecf49278f4b52 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -68,6 +68,13 @@ Misc - [`rustc` will now warn about some incorrect uses of `mem::{uninitialized, zeroed}` that are known to cause undefined behaviour.][63346] +Compatibility Notes +------------------- +- Unfortunately the [`x86_64-unknown-uefi` platform can not be built][62785] + with rustc 1.39.0. +- The [`armv7-unknown-linux-gnueabihf` platform is also known to have + issues][62896] for certain crates such as libc. + [60260]: https://github.com/rust-lang/rust/pull/60260/ [61457]: https://github.com/rust-lang/rust/pull/61457/ [61491]: https://github.com/rust-lang/rust/pull/61491/ @@ -79,7 +86,9 @@ Misc [62735]: https://github.com/rust-lang/rust/pull/62735/ [62766]: https://github.com/rust-lang/rust/pull/62766/ [62784]: https://github.com/rust-lang/rust/pull/62784/ +[62785]: https://github.com/rust-lang/rust/issues/62785/ [62814]: https://github.com/rust-lang/rust/pull/62814/ +[62896]: https://github.com/rust-lang/rust/issues/62896/ [63000]: https://github.com/rust-lang/rust/pull/63000/ [63056]: https://github.com/rust-lang/rust/pull/63056/ [63107]: https://github.com/rust-lang/rust/pull/63107/ diff --git a/src/bootstrap/dist.rs b/src/bootstrap/dist.rs index e27a6bf7da0ac..d9dff77a30e6b 100644 --- a/src/bootstrap/dist.rs +++ b/src/bootstrap/dist.rs @@ -18,7 +18,7 @@ use build_helper::{output, t}; use crate::{Compiler, Mode, LLVM_TOOLS}; use crate::channel; -use crate::util::{is_dylib, exe}; +use crate::util::{is_dylib, exe, timeit}; use crate::builder::{Builder, RunConfig, ShouldRun, Step}; use crate::compile; use crate::tool::{self, Tool}; @@ -91,14 +91,15 @@ impl Step for Docs { let name = pkgname(builder, "rust-docs"); - builder.info(&format!("Dist docs ({})", host)); if !builder.config.docs { - builder.info("\tskipping - docs disabled"); return distdir(builder).join(format!("{}-{}.tar.gz", name, host)); } builder.default_doc(None); + builder.info(&format!("Dist docs ({})", host)); + let _time = timeit(builder); + let image = tmpdir(builder).join(format!("{}-{}-image", name, host)); let _ = fs::remove_dir_all(&image); @@ -151,9 +152,7 @@ impl Step for RustcDocs { let name = pkgname(builder, "rustc-docs"); - builder.info(&format!("Dist compiler docs ({})", host)); if !builder.config.compiler_docs { - builder.info("\tskipping - compiler docs disabled"); return distdir(builder).join(format!("{}-{}.tar.gz", name, host)); } @@ -179,6 +178,9 @@ impl Step for RustcDocs { .arg("--component-name=rustc-docs") .arg("--legacy-manifest-dirs=rustlib,cargo") .arg("--bulk-dirs=share/doc/rust/html"); + + builder.info(&format!("Dist compiler docs ({})", host)); + let _time = timeit(builder); builder.run(&mut cmd); builder.remove_dir(&image); @@ -350,6 +352,7 @@ impl Step for Mingw { } builder.info(&format!("Dist mingw ({})", host)); + let _time = timeit(builder); let name = pkgname(builder, "rust-mingw"); let image = tmpdir(builder).join(format!("{}-{}-image", name, host)); let _ = fs::remove_dir_all(&image); @@ -403,7 +406,6 @@ impl Step for Rustc { let compiler = self.compiler; let host = self.compiler.host; - builder.info(&format!("Dist rustc stage{} ({})", compiler.stage, host)); let name = pkgname(builder, "rustc"); let image = tmpdir(builder).join(format!("{}-{}-image", name, host)); let _ = fs::remove_dir_all(&image); @@ -460,6 +462,9 @@ impl Step for Rustc { .arg(format!("--package-name={}-{}", name, host)) .arg("--component-name=rustc") .arg("--legacy-manifest-dirs=rustlib,cargo"); + + builder.info(&format!("Dist rustc stage{} ({})", compiler.stage, host)); + let _time = timeit(builder); builder.run(&mut cmd); builder.remove_dir(&image); builder.remove_dir(&overlay); @@ -662,8 +667,6 @@ impl Step for Std { let target = self.target; let name = pkgname(builder, "rust-std"); - builder.info(&format!("Dist std stage{} ({} -> {})", - compiler.stage, &compiler.host, target)); // The only true set of target libraries came from the build triple, so // let's reduce redundant work by only producing archives from that host. @@ -714,6 +717,10 @@ impl Step for Std { .arg(format!("--package-name={}-{}", name, target)) .arg(format!("--component-name=rust-std-{}", target)) .arg("--legacy-manifest-dirs=rustlib,cargo"); + + builder.info(&format!("Dist std stage{} ({} -> {})", + compiler.stage, &compiler.host, target)); + let _time = timeit(builder); builder.run(&mut cmd); builder.remove_dir(&image); distdir(builder).join(format!("{}-{}.tar.gz", name, target)) @@ -754,11 +761,9 @@ impl Step for Analysis { let compiler = self.compiler; let target = self.target; assert!(builder.config.extended); - builder.info("Dist analysis"); let name = pkgname(builder, "rust-analysis"); if &compiler.host != builder.config.build { - builder.info("\tskipping, not a build host"); return distdir(builder).join(format!("{}-{}.tar.gz", name, target)); } @@ -786,6 +791,9 @@ impl Step for Analysis { .arg(format!("--package-name={}-{}", name, target)) .arg(format!("--component-name=rust-analysis-{}", target)) .arg("--legacy-manifest-dirs=rustlib,cargo"); + + builder.info("Dist analysis"); + let _time = timeit(builder); builder.run(&mut cmd); builder.remove_dir(&image); distdir(builder).join(format!("{}-{}.tar.gz", name, target)) @@ -874,8 +882,6 @@ impl Step for Src { /// Creates the `rust-src` installer component fn run(self, builder: &Builder<'_>) -> PathBuf { - builder.info("Dist src"); - let name = pkgname(builder, "rust-src"); let image = tmpdir(builder).join(format!("{}-image", name)); let _ = fs::remove_dir_all(&image); @@ -930,6 +936,9 @@ impl Step for Src { .arg(format!("--package-name={}", name)) .arg("--component-name=rust-src") .arg("--legacy-manifest-dirs=rustlib,cargo"); + + builder.info("Dist src"); + let _time = timeit(builder); builder.run(&mut cmd); builder.remove_dir(&image); @@ -957,8 +966,6 @@ impl Step for PlainSourceTarball { /// Creates the plain source tarball fn run(self, builder: &Builder<'_>) -> PathBuf { - builder.info("Create plain source tarball"); - // Make sure that the root folder of tarball has the correct name let plain_name = format!("{}-src", pkgname(builder, "rustc")); let plain_dst_src = tmpdir(builder).join(&plain_name); @@ -1020,6 +1027,9 @@ impl Step for PlainSourceTarball { .arg("--output").arg(&tarball) .arg("--work-dir=.") .current_dir(tmpdir(builder)); + + builder.info("Create plain source tarball"); + let _time = timeit(builder); builder.run(&mut cmd); distdir(builder).join(&format!("{}.tar.gz", plain_name)) } @@ -1073,7 +1083,6 @@ impl Step for Cargo { let compiler = self.compiler; let target = self.target; - builder.info(&format!("Dist cargo stage{} ({})", compiler.stage, target)); let src = builder.src.join("src/tools/cargo"); let etc = src.join("src/etc"); let release_num = builder.release_num("cargo"); @@ -1126,6 +1135,9 @@ impl Step for Cargo { .arg(format!("--package-name={}-{}", name, target)) .arg("--component-name=cargo") .arg("--legacy-manifest-dirs=rustlib,cargo"); + + builder.info(&format!("Dist cargo stage{} ({})", compiler.stage, target)); + let _time = timeit(builder); builder.run(&mut cmd); distdir(builder).join(format!("{}-{}.tar.gz", name, target)) } @@ -1161,7 +1173,6 @@ impl Step for Rls { let target = self.target; assert!(builder.config.extended); - builder.info(&format!("Dist RLS stage{} ({})", compiler.stage, target)); let src = builder.src.join("src/tools/rls"); let release_num = builder.release_num("rls"); let name = pkgname(builder, "rls"); @@ -1210,6 +1221,8 @@ impl Step for Rls { .arg("--legacy-manifest-dirs=rustlib,cargo") .arg("--component-name=rls-preview"); + builder.info(&format!("Dist RLS stage{} ({})", compiler.stage, target)); + let _time = timeit(builder); builder.run(&mut cmd); Some(distdir(builder).join(format!("{}-{}.tar.gz", name, target))) } @@ -1245,7 +1258,6 @@ impl Step for Clippy { let target = self.target; assert!(builder.config.extended); - builder.info(&format!("Dist clippy stage{} ({})", compiler.stage, target)); let src = builder.src.join("src/tools/clippy"); let release_num = builder.release_num("clippy"); let name = pkgname(builder, "clippy"); @@ -1299,6 +1311,8 @@ impl Step for Clippy { .arg("--legacy-manifest-dirs=rustlib,cargo") .arg("--component-name=clippy-preview"); + builder.info(&format!("Dist clippy stage{} ({})", compiler.stage, target)); + let _time = timeit(builder); builder.run(&mut cmd); Some(distdir(builder).join(format!("{}-{}.tar.gz", name, target))) } @@ -1334,7 +1348,6 @@ impl Step for Miri { let target = self.target; assert!(builder.config.extended); - builder.info(&format!("Dist miri stage{} ({})", compiler.stage, target)); let src = builder.src.join("src/tools/miri"); let release_num = builder.release_num("miri"); let name = pkgname(builder, "miri"); @@ -1389,6 +1402,8 @@ impl Step for Miri { .arg("--legacy-manifest-dirs=rustlib,cargo") .arg("--component-name=miri-preview"); + builder.info(&format!("Dist miri stage{} ({})", compiler.stage, target)); + let _time = timeit(builder); builder.run(&mut cmd); Some(distdir(builder).join(format!("{}-{}.tar.gz", name, target))) } @@ -1423,7 +1438,6 @@ impl Step for Rustfmt { let compiler = self.compiler; let target = self.target; - builder.info(&format!("Dist Rustfmt stage{} ({})", compiler.stage, target)); let src = builder.src.join("src/tools/rustfmt"); let release_num = builder.release_num("rustfmt"); let name = pkgname(builder, "rustfmt"); @@ -1476,6 +1490,8 @@ impl Step for Rustfmt { .arg("--legacy-manifest-dirs=rustlib,cargo") .arg("--component-name=rustfmt-preview"); + builder.info(&format!("Dist Rustfmt stage{} ({})", compiler.stage, target)); + let _time = timeit(builder); builder.run(&mut cmd); Some(distdir(builder).join(format!("{}-{}.tar.gz", name, target))) } @@ -1576,6 +1592,7 @@ impl Step for Extended { input_tarballs.push(tarball); } + builder.info("building combined installer"); let mut cmd = rust_installer(builder); cmd.arg("combine") .arg("--product-name=Rust") @@ -1587,7 +1604,9 @@ impl Step for Extended { .arg("--legacy-manifest-dirs=rustlib,cargo") .arg("--input-tarballs").arg(input_tarballs) .arg("--non-installed-overlay").arg(&overlay); + let time = timeit(&builder); builder.run(&mut cmd); + drop(time); let mut license = String::new(); license += &builder.read(&builder.src.join("COPYRIGHT")); @@ -1643,6 +1662,7 @@ impl Step for Extended { }; if target.contains("apple-darwin") { + builder.info("building pkg installer"); let pkg = tmp.join("pkg"); let _ = fs::remove_dir_all(&pkg); @@ -1692,6 +1712,7 @@ impl Step for Extended { pkgname(builder, "rust"), target))) .arg("--package-path").arg(&pkg); + let _time = timeit(builder); builder.run(&mut cmd); } @@ -1742,14 +1763,18 @@ impl Step for Extended { builder.create(&exe.join("LICENSE.txt"), &license); // Generate exe installer + builder.info("building `exe` installer with `iscc`"); let mut cmd = Command::new("iscc"); cmd.arg("rust.iss") + .arg("/Q") .current_dir(&exe); if target.contains("windows-gnu") { cmd.arg("/dMINGW"); } add_env(builder, &mut cmd, target); + let time = timeit(builder); builder.run(&mut cmd); + drop(time); builder.install(&exe.join(format!("{}-{}.exe", pkgname(builder, "rust"), target)), &distdir(builder), 0o755); @@ -1914,6 +1939,7 @@ impl Step for Extended { builder.install(&etc.join("gfx/banner.bmp"), &exe, 0o644); builder.install(&etc.join("gfx/dialogbg.bmp"), &exe, 0o644); + builder.info(&format!("building `msi` installer with {:?}", light)); let filename = format!("{}-{}.msi", pkgname(builder, "rust"), target); let mut cmd = Command::new(&light); cmd.arg("-nologo") @@ -1946,6 +1972,7 @@ impl Step for Extended { // ICE57 wrongly complains about the shortcuts cmd.arg("-sice:ICE57"); + let _time = timeit(builder); builder.run(&mut cmd); if !builder.config.dry_run { @@ -2114,6 +2141,7 @@ impl Step for LlvmTools { } builder.info(&format!("Dist LlvmTools ({})", target)); + let _time = timeit(builder); let src = builder.src.join("src/llvm-project/llvm"); let name = pkgname(builder, "llvm-tools"); diff --git a/src/etc/installer/exe/rust.iss b/src/etc/installer/exe/rust.iss index c22d60b6c5df1..70648beac38b0 100644 --- a/src/etc/installer/exe/rust.iss +++ b/src/etc/installer/exe/rust.iss @@ -25,9 +25,9 @@ SourceDir=.\ OutputBaseFilename={#CFG_PACKAGE_NAME}-{#CFG_BUILD} DefaultDirName={sd}\Rust -Compression=lzma2/ultra -InternalCompressLevel=ultra -SolidCompression=true +Compression=lzma2/normal +InternalCompressLevel=normal +SolidCompression=no ChangesEnvironment=true ChangesAssociations=no diff --git a/src/etc/installer/msi/rust.wxs b/src/etc/installer/msi/rust.wxs index a471ccc6f5b48..a2e378f7b1db4 100644 --- a/src/etc/installer/msi/rust.wxs +++ b/src/etc/installer/msi/rust.wxs @@ -152,7 +152,7 @@ - + diff --git a/src/librustc/lint/builtin.rs b/src/librustc/lint/builtin.rs index dd290572d7bb7..5906a6388a8bd 100644 --- a/src/librustc/lint/builtin.rs +++ b/src/librustc/lint/builtin.rs @@ -7,7 +7,7 @@ use crate::lint::{LintPass, LateLintPass, LintArray}; use crate::middle::stability; use crate::session::Session; -use errors::{Applicability, DiagnosticBuilder}; +use errors::{Applicability, DiagnosticBuilder, pluralise}; use syntax::ast; use syntax::source_map::Span; use syntax::symbol::Symbol; @@ -524,7 +524,7 @@ pub(crate) fn add_elided_lifetime_in_path_suggestion( }; db.span_suggestion( replace_span, - &format!("indicate the anonymous lifetime{}", if n >= 2 { "s" } else { "" }), + &format!("indicate the anonymous lifetime{}", pluralise!(n)), suggestion, Applicability::MachineApplicable ); diff --git a/src/librustc/middle/resolve_lifetime.rs b/src/librustc/middle/resolve_lifetime.rs index 8836a632a7ca8..d833a34385b2d 100644 --- a/src/librustc/middle/resolve_lifetime.rs +++ b/src/librustc/middle/resolve_lifetime.rs @@ -17,7 +17,7 @@ use crate::ty::{self, DefIdTree, GenericParamDefKind, TyCtxt}; use crate::rustc::lint; use crate::session::Session; use crate::util::nodemap::{DefIdMap, FxHashMap, FxHashSet, HirIdMap, HirIdSet}; -use errors::{Applicability, DiagnosticBuilder}; +use errors::{Applicability, DiagnosticBuilder, pluralise}; use rustc_macros::HashStable; use std::borrow::Cow; use std::cell::Cell; @@ -3047,7 +3047,7 @@ pub fn report_missing_lifetime_specifiers( span, E0106, "missing lifetime specifier{}", - if count > 1 { "s" } else { "" } + pluralise!(count) ) } diff --git a/src/librustc/traits/chalk_fulfill.rs b/src/librustc/traits/chalk_fulfill.rs index 0c7c94b684a9f..a7e1f2a6a73a7 100644 --- a/src/librustc/traits/chalk_fulfill.rs +++ b/src/librustc/traits/chalk_fulfill.rs @@ -81,6 +81,7 @@ impl TraitEngine<'tcx> for FulfillmentContext<'tcx> { .map(|obligation| FulfillmentError { obligation: obligation.goal.clone(), code: FulfillmentErrorCode::CodeAmbiguity, + points_at_arg_span: false, }) .collect(); Err(errors) @@ -129,6 +130,7 @@ impl TraitEngine<'tcx> for FulfillmentContext<'tcx> { code: FulfillmentErrorCode::CodeSelectionError( SelectionError::Unimplemented ), + points_at_arg_span: false, }), } } else { @@ -142,6 +144,7 @@ impl TraitEngine<'tcx> for FulfillmentContext<'tcx> { code: FulfillmentErrorCode::CodeSelectionError( SelectionError::Unimplemented ), + points_at_arg_span: false, }) } } diff --git a/src/librustc/traits/error_reporting.rs b/src/librustc/traits/error_reporting.rs index 03cc00d87e3cd..c9018f1c290d2 100644 --- a/src/librustc/traits/error_reporting.rs +++ b/src/librustc/traits/error_reporting.rs @@ -33,7 +33,7 @@ use crate::ty::subst::Subst; use crate::ty::SubtypePredicate; use crate::util::nodemap::{FxHashMap, FxHashSet}; -use errors::{Applicability, DiagnosticBuilder}; +use errors::{Applicability, DiagnosticBuilder, pluralise}; use std::fmt; use syntax::ast; use syntax::symbol::{sym, kw}; @@ -119,11 +119,11 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> { // returns if `cond` not occurring implies that `error` does not occur - i.e., that // `error` occurring implies that `cond` occurs. - fn error_implies(&self, - cond: &ty::Predicate<'tcx>, - error: &ty::Predicate<'tcx>) - -> bool - { + fn error_implies( + &self, + cond: &ty::Predicate<'tcx>, + error: &ty::Predicate<'tcx>, + ) -> bool { if cond == error { return true } @@ -155,13 +155,21 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> { false } - fn report_fulfillment_error(&self, error: &FulfillmentError<'tcx>, - body_id: Option, - fallback_has_occurred: bool) { + fn report_fulfillment_error( + &self, + error: &FulfillmentError<'tcx>, + body_id: Option, + fallback_has_occurred: bool, + ) { debug!("report_fulfillment_errors({:?})", error); match error.code { - FulfillmentErrorCode::CodeSelectionError(ref e) => { - self.report_selection_error(&error.obligation, e, fallback_has_occurred); + FulfillmentErrorCode::CodeSelectionError(ref selection_error) => { + self.report_selection_error( + &error.obligation, + selection_error, + fallback_has_occurred, + error.points_at_arg_span, + ); } FulfillmentErrorCode::CodeProjectionError(ref e) => { self.report_projection_error(&error.obligation, e); @@ -170,19 +178,21 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> { self.maybe_report_ambiguity(&error.obligation, body_id); } FulfillmentErrorCode::CodeSubtypeError(ref expected_found, ref err) => { - self.report_mismatched_types(&error.obligation.cause, - expected_found.expected, - expected_found.found, - err.clone()) - .emit(); + self.report_mismatched_types( + &error.obligation.cause, + expected_found.expected, + expected_found.found, + err.clone(), + ).emit(); } } } - fn report_projection_error(&self, - obligation: &PredicateObligation<'tcx>, - error: &MismatchedProjectionTypes<'tcx>) - { + fn report_projection_error( + &self, + obligation: &PredicateObligation<'tcx>, + error: &MismatchedProjectionTypes<'tcx>, + ) { let predicate = self.resolve_vars_if_possible(&obligation.predicate); @@ -603,6 +613,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> { obligation: &PredicateObligation<'tcx>, error: &SelectionError<'tcx>, fallback_has_occurred: bool, + points_at_arg: bool, ) { let span = obligation.cause.span; @@ -690,7 +701,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> { } self.suggest_borrow_on_unsized_slice(&obligation.cause.code, &mut err); - self.suggest_fn_call(&obligation, &mut err, &trait_ref); + self.suggest_fn_call(&obligation, &mut err, &trait_ref, points_at_arg); self.suggest_remove_reference(&obligation, &mut err, &trait_ref); self.suggest_semicolon_removal(&obligation, &mut err, span, &trait_ref); @@ -963,6 +974,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> { obligation: &PredicateObligation<'tcx>, err: &mut DiagnosticBuilder<'tcx>, trait_ref: &ty::Binder>, + points_at_arg: bool, ) { let self_ty = trait_ref.self_ty(); match self_ty.sty { @@ -991,15 +1003,31 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> { .. })) = self.tcx.hir().get_if_local(def_id) { let body = self.tcx.hir().body(*body_id); - err.help(&format!( - "use parentheses to call the function: `{}({})`", + let msg = "use parentheses to call the function"; + let snippet = format!( + "{}({})", ident, body.params.iter() .map(|arg| match &arg.pat.node { hir::PatKind::Binding(_, _, ident, None) if ident.name != kw::SelfLower => ident.to_string(), _ => "_".to_string(), - }).collect::>().join(", "))); + }).collect::>().join(", "), + ); + // When the obligation error has been ensured to have been caused by + // an argument, the `obligation.cause.span` points at the expression + // of the argument, so we can provide a suggestion. This is signaled + // by `points_at_arg`. Otherwise, we give a more general note. + if points_at_arg { + err.span_suggestion( + obligation.cause.span, + msg, + snippet, + Applicability::HasPlaceholders, + ); + } else { + err.help(&format!("{}: `{}`", msg, snippet)); + } } } _ => {} @@ -1186,7 +1214,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> { _ => format!("{} {}argument{}", arg_length, if distinct && arg_length > 1 { "distinct " } else { "" }, - if arg_length == 1 { "" } else { "s" }), + pluralise!(arg_length)) } }; diff --git a/src/librustc/traits/mod.rs b/src/librustc/traits/mod.rs index d2683090add40..c53f4e49971bf 100644 --- a/src/librustc/traits/mod.rs +++ b/src/librustc/traits/mod.rs @@ -484,7 +484,11 @@ EnumTypeFoldableImpl! { pub struct FulfillmentError<'tcx> { pub obligation: PredicateObligation<'tcx>, - pub code: FulfillmentErrorCode<'tcx> + pub code: FulfillmentErrorCode<'tcx>, + /// Diagnostics only: we opportunistically change the `code.span` when we encounter an + /// obligation error caused by a call argument. When this is the case, we also signal that in + /// this field to ensure accuracy of suggestions. + pub points_at_arg_span: bool, } #[derive(Clone)] @@ -1183,7 +1187,7 @@ impl<'tcx> FulfillmentError<'tcx> { code: FulfillmentErrorCode<'tcx>) -> FulfillmentError<'tcx> { - FulfillmentError { obligation: obligation, code: code } + FulfillmentError { obligation: obligation, code: code, points_at_arg_span: false } } } diff --git a/src/librustc/ty/error.rs b/src/librustc/ty/error.rs index 62910ec320494..5409cbc4129f0 100644 --- a/src/librustc/ty/error.rs +++ b/src/librustc/ty/error.rs @@ -196,7 +196,7 @@ impl<'tcx> ty::TyS<'tcx> { let n = tcx.lift_to_global(&n).unwrap(); match n.try_eval_usize(tcx, ty::ParamEnv::empty()) { Some(n) => { - format!("array of {} element{}", n, if n != 1 { "s" } else { "" }).into() + format!("array of {} element{}", n, pluralise!(n)).into() } None => "array".into(), } diff --git a/src/librustc_lint/unused.rs b/src/librustc_lint/unused.rs index c3975098351af..2d4af2f606a2c 100644 --- a/src/librustc_lint/unused.rs +++ b/src/librustc_lint/unused.rs @@ -9,7 +9,7 @@ use lint::{LintPass, EarlyLintPass, LateLintPass}; use syntax::ast; use syntax::attr; -use syntax::errors::Applicability; +use syntax::errors::{Applicability, pluralise}; use syntax::feature_gate::{AttributeType, BuiltinAttribute, BUILTIN_ATTRIBUTE_MAP}; use syntax::print::pprust; use syntax::symbol::{kw, sym}; @@ -48,7 +48,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnusedResults { } let ty = cx.tables.expr_ty(&expr); - let type_permits_lack_of_use = check_must_use_ty(cx, ty, &expr, s.span, "", "", false); + let type_permits_lack_of_use = check_must_use_ty(cx, ty, &expr, s.span, "", "", 1); let mut fn_warned = false; let mut op_warned = false; @@ -135,7 +135,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnusedResults { span: Span, descr_pre: &str, descr_post: &str, - plural: bool, + plural_len: usize, ) -> bool { if ty.is_unit() || cx.tcx.is_ty_uninhabited_from( cx.tcx.hir().get_module_parent(expr.hir_id), ty) @@ -143,13 +143,13 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnusedResults { return true; } - let plural_suffix = if plural { "s" } else { "" }; + let plural_suffix = pluralise!(plural_len); match ty.sty { ty::Adt(..) if ty.is_box() => { let boxed_ty = ty.boxed_ty(); let descr_pre = &format!("{}boxed ", descr_pre); - check_must_use_ty(cx, boxed_ty, expr, span, descr_pre, descr_post, plural) + check_must_use_ty(cx, boxed_ty, expr, span, descr_pre, descr_post, plural_len) } ty::Adt(def, _) => { check_must_use_def(cx, def.did, span, descr_pre, descr_post) @@ -202,7 +202,15 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnusedResults { for (i, ty) in tys.iter().map(|k| k.expect_ty()).enumerate() { let descr_post = &format!(" in tuple element {}", i); let span = *spans.get(i).unwrap_or(&span); - if check_must_use_ty(cx, ty, expr, span, descr_pre, descr_post, plural) { + if check_must_use_ty( + cx, + ty, + expr, + span, + descr_pre, + descr_post, + plural_len + ) { has_emitted = true; } } @@ -216,7 +224,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnusedResults { descr_pre, plural_suffix, ); - check_must_use_ty(cx, ty, expr, span, descr_pre, descr_post, true) + check_must_use_ty(cx, ty, expr, span, descr_pre, descr_post, n as usize + 1) } // Otherwise, we don't lint, to avoid false positives. _ => false, diff --git a/src/librustc_mir/borrow_check/nll/type_check/mod.rs b/src/librustc_mir/borrow_check/nll/type_check/mod.rs index 62bff3421a078..6a764b19c4ddf 100644 --- a/src/librustc_mir/borrow_check/nll/type_check/mod.rs +++ b/src/librustc_mir/borrow_check/nll/type_check/mod.rs @@ -1999,6 +1999,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> { ), &traits::SelectionError::Unimplemented, false, + false, ); } } diff --git a/src/librustc_resolve/check_unused.rs b/src/librustc_resolve/check_unused.rs index 96d44b4b4c0dc..0d85be83e12e0 100644 --- a/src/librustc_resolve/check_unused.rs +++ b/src/librustc_resolve/check_unused.rs @@ -26,6 +26,8 @@ use crate::Resolver; use crate::resolve_imports::ImportDirectiveSubclass; +use errors::pluralise; + use rustc::util::nodemap::NodeMap; use rustc::{lint, ty}; use rustc_data_structures::fx::FxHashSet; @@ -295,7 +297,7 @@ impl Resolver<'_> { }).collect::>(); span_snippets.sort(); let msg = format!("unused import{}{}", - if len > 1 { "s" } else { "" }, + pluralise!(len), if !span_snippets.is_empty() { format!(": {}", span_snippets.join(", ")) } else { diff --git a/src/librustc_resolve/resolve_imports.rs b/src/librustc_resolve/resolve_imports.rs index e77e8290f1faa..360343169bc3d 100644 --- a/src/librustc_resolve/resolve_imports.rs +++ b/src/librustc_resolve/resolve_imports.rs @@ -11,7 +11,7 @@ use crate::{Resolver, ResolutionError, Segment, ModuleKind}; use crate::{names_to_string, module_to_string}; use crate::diagnostics::Suggestion; -use errors::Applicability; +use errors::{Applicability, pluralise}; use rustc_data_structures::ptr_key::PtrKey; use rustc::ty; @@ -728,7 +728,7 @@ impl<'a, 'b> ImportResolver<'a, 'b> { let msg = format!( "unresolved import{} {}", - if paths.len() > 1 { "s" } else { "" }, + pluralise!(paths.len()), paths.join(", "), ); diff --git a/src/librustc_typeck/astconv.rs b/src/librustc_typeck/astconv.rs index 09e6b76900396..718d12484f741 100644 --- a/src/librustc_typeck/astconv.rs +++ b/src/librustc_typeck/astconv.rs @@ -1346,7 +1346,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { span, E0191, "the value of the associated type{} {} must be specified", - if associated_types.len() == 1 { "" } else { "s" }, + pluralise!(associated_types.len()), names, ); let (suggest, potential_assoc_types_spans) = diff --git a/src/librustc_typeck/check/coercion.rs b/src/librustc_typeck/check/coercion.rs index f2e1a6e29d6fc..ee4f0a868c10a 100644 --- a/src/librustc_typeck/check/coercion.rs +++ b/src/librustc_typeck/check/coercion.rs @@ -617,7 +617,7 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> { // Object safety violations or miscellaneous. Err(err) => { - self.report_selection_error(&obligation, &err, false); + self.report_selection_error(&obligation, &err, false, false); // Treat this like an obligation and follow through // with the unsizing - the lack of a coercion should // be silent, as it causes a type mismatch later. diff --git a/src/librustc_typeck/check/expr.rs b/src/librustc_typeck/check/expr.rs index 049f2eb16bb00..1ae50b8cb2883 100644 --- a/src/librustc_typeck/check/expr.rs +++ b/src/librustc_typeck/check/expr.rs @@ -17,7 +17,7 @@ use crate::util::common::ErrorReported; use crate::util::nodemap::FxHashMap; use crate::astconv::AstConv as _; -use errors::{Applicability, DiagnosticBuilder}; +use errors::{Applicability, DiagnosticBuilder, pluralise}; use syntax::ast; use syntax::symbol::{Symbol, kw, sym}; use syntax::source_map::Span; @@ -1178,7 +1178,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { struct_span_err!(tcx.sess, span, E0063, "missing field{} {}{} in initializer of `{}`", - if remaining_fields.len() == 1 { "" } else { "s" }, + pluralise!(remaining_fields.len()), remaining_fields_names, truncated_fields_error, adt_ty) diff --git a/src/librustc_typeck/check/method/suggest.rs b/src/librustc_typeck/check/method/suggest.rs index 3e45b1e98d4ec..74e4f28255b16 100644 --- a/src/librustc_typeck/check/method/suggest.rs +++ b/src/librustc_typeck/check/method/suggest.rs @@ -5,7 +5,7 @@ use crate::check::FnCtxt; use crate::middle::lang_items::FnOnceTraitLangItem; use crate::namespace::Namespace; use crate::util::nodemap::FxHashSet; -use errors::{Applicability, DiagnosticBuilder}; +use errors::{Applicability, DiagnosticBuilder, pluralise}; use rustc::hir::{self, ExprKind, Node, QPath}; use rustc::hir::def::{Res, DefKind}; use rustc::hir::def_id::{CRATE_DEF_INDEX, LOCAL_CRATE, DefId}; @@ -560,7 +560,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { let help = format!("{an}other candidate{s} {were} found in the following \ trait{s}, perhaps add a `use` for {one_of_them}:", an = if candidates.len() == 1 {"an" } else { "" }, - s = if candidates.len() == 1 { "" } else { "s" }, + s = pluralise!(candidates.len()), were = if candidates.len() == 1 { "was" } else { "were" }, one_of_them = if candidates.len() == 1 { "it" diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs index 1d68d79db8856..7ff8f9c95c89c 100644 --- a/src/librustc_typeck/check/mod.rs +++ b/src/librustc_typeck/check/mod.rs @@ -88,7 +88,7 @@ pub mod intrinsic; mod op; use crate::astconv::{AstConv, PathSeg}; -use errors::{Applicability, DiagnosticBuilder, DiagnosticId}; +use errors::{Applicability, DiagnosticBuilder, DiagnosticId, pluralise}; use rustc::hir::{self, ExprKind, GenericArg, ItemKind, Node, PatKind, QPath}; use rustc::hir::def::{CtorOf, Res, DefKind}; use rustc::hir::def_id::{CrateNum, DefId, LOCAL_CRATE}; @@ -912,12 +912,12 @@ fn typeck_tables_of(tcx: TyCtxt<'_>, def_id: DefId) -> &ty::TypeckTables<'_> { }; // All type checking constraints were added, try to fallback unsolved variables. - fcx.select_obligations_where_possible(false); + fcx.select_obligations_where_possible(false, |_| {}); let mut fallback_has_occurred = false; for ty in &fcx.unsolved_variables() { fallback_has_occurred |= fcx.fallback_if_possible(ty); } - fcx.select_obligations_where_possible(fallback_has_occurred); + fcx.select_obligations_where_possible(fallback_has_occurred, |_| {}); // Even though coercion casts provide type hints, we check casts after fallback for // backwards compatibility. This makes fallback a stronger type hint than a cast coercion. @@ -2391,7 +2391,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { // possible. This can help substantially when there are // indirect dependencies that don't seem worth tracking // precisely. - self.select_obligations_where_possible(false); + self.select_obligations_where_possible(false, |_| {}); ty = self.resolve_vars_if_possible(&ty); debug!("resolve_type_vars_with_obligations: ty={:?}", ty); @@ -2842,7 +2842,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { fn resolve_generator_interiors(&self, def_id: DefId) { let mut generators = self.deferred_generator_interiors.borrow_mut(); for (body_id, interior, kind) in generators.drain(..) { - self.select_obligations_where_possible(false); + self.select_obligations_where_possible(false, |_| {}); generator_interior::resolve_interior(self, def_id, body_id, interior, kind); } } @@ -2879,8 +2879,13 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { } /// Select as many obligations as we can at present. - fn select_obligations_where_possible(&self, fallback_has_occurred: bool) { - if let Err(errors) = self.fulfillment_cx.borrow_mut().select_where_possible(self) { + fn select_obligations_where_possible( + &self, + fallback_has_occurred: bool, + mutate_fullfillment_errors: impl Fn(&mut Vec>), + ) { + if let Err(mut errors) = self.fulfillment_cx.borrow_mut().select_where_possible(self) { + mutate_fullfillment_errors(&mut errors); self.report_fulfillment_errors(&errors, self.inh.body_id, fallback_has_occurred); } } @@ -3288,6 +3293,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { formal_tys.clone() }; + let mut final_arg_types: Vec<(usize, Ty<'_>)> = vec![]; + // Check the arguments. // We do this in a pretty awful way: first we type-check any arguments // that are not closures, then we type-check the closures. This is so @@ -3300,7 +3307,14 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { // an "opportunistic" vtable resolution of any trait bounds on // the call. This helps coercions. if check_closures { - self.select_obligations_where_possible(false); + self.select_obligations_where_possible(false, |errors| { + self.point_at_arg_instead_of_call_if_possible( + errors, + &final_arg_types[..], + sp, + &args, + ); + }) } // For C-variadic functions, we don't have a declared type for all of @@ -3346,6 +3360,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { // We're processing function arguments so we definitely want to use // two-phase borrows. self.demand_coerce(&arg, checked_ty, coerce_ty, AllowTwoPhase::Yes); + final_arg_types.push((i, coerce_ty)); // 3. Relate the expected type and the formal one, // if the expected type was used for the coercion. @@ -3392,6 +3407,44 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { vec![self.tcx.types.err; len] } + /// Given a vec of evaluated `FullfillmentError`s and an `fn` call argument expressions, we + /// walk the resolved types for each argument to see if any of the `FullfillmentError`s + /// reference a type argument. If they do, and there's only *one* argument that does, we point + /// at the corresponding argument's expression span instead of the `fn` call path span. + fn point_at_arg_instead_of_call_if_possible( + &self, + errors: &mut Vec>, + final_arg_types: &[(usize, Ty<'tcx>)], + call_sp: Span, + args: &'tcx [hir::Expr], + ) { + if !call_sp.desugaring_kind().is_some() { + // We *do not* do this for desugared call spans to keep good diagnostics when involving + // the `?` operator. + for error in errors { + if let ty::Predicate::Trait(predicate) = error.obligation.predicate { + // Collect the argument position for all arguments that could have caused this + // `FullfillmentError`. + let mut referenced_in = final_arg_types.iter() + .flat_map(|(i, ty)| { + let ty = self.resolve_vars_if_possible(ty); + // We walk the argument type because the argument's type could have + // been `Option`, but the `FullfillmentError` references `T`. + ty.walk() + .filter(|&ty| ty == predicate.skip_binder().self_ty()) + .map(move |_| *i) + }); + if let (Some(ref_in), None) = (referenced_in.next(), referenced_in.next()) { + // We make sure that only *one* argument matches the obligation failure + // and thet the obligation's span to its expression's. + error.obligation.cause.span = args[ref_in].span; + error.points_at_arg_span = true; + } + } + } + } + } + // AST fragment checking fn check_lit(&self, lit: &hir::Lit, @@ -3549,8 +3602,11 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { // Check bounds on type arguments used in the path. let bounds = self.instantiate_bounds(path_span, did, substs); - let cause = traits::ObligationCause::new(path_span, self.body_id, - traits::ItemObligation(did)); + let cause = traits::ObligationCause::new( + path_span, + self.body_id, + traits::ItemObligation(did), + ); self.add_obligations_for_parameters(cause, &bounds); Some((variant, ty)) @@ -4674,7 +4730,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { let bounds = self.instantiate_bounds(span, def_id, &substs); self.add_obligations_for_parameters( traits::ObligationCause::new(span, self.body_id, traits::ItemObligation(def_id)), - &bounds); + &bounds, + ); // Substitute the values for the type parameters into the type of // the referenced item. @@ -4878,5 +4935,5 @@ fn fatally_break_rust(sess: &Session) { } fn potentially_plural_count(count: usize, word: &str) -> String { - format!("{} {}{}", count, word, if count == 1 { "" } else { "s" }) + format!("{} {}{}", count, word, pluralise!(count)) } diff --git a/src/librustc_typeck/check/op.rs b/src/librustc_typeck/check/op.rs index 18b555dc037c2..956d04ff6229b 100644 --- a/src/librustc_typeck/check/op.rs +++ b/src/librustc_typeck/check/op.rs @@ -724,7 +724,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { match method { Some(ok) => { let method = self.register_infer_ok_obligations(ok); - self.select_obligations_where_possible(false); + self.select_obligations_where_possible(false, |_| {}); Ok(method) } diff --git a/src/librustc_typeck/check/pat.rs b/src/librustc_typeck/check/pat.rs index 8502b89de1469..d93a4052cd393 100644 --- a/src/librustc_typeck/check/pat.rs +++ b/src/librustc_typeck/check/pat.rs @@ -1,6 +1,6 @@ use crate::check::FnCtxt; use crate::util::nodemap::FxHashMap; -use errors::{Applicability, DiagnosticBuilder}; +use errors::{Applicability, DiagnosticBuilder, pluralise}; use rustc::hir::{self, PatKind, Pat, HirId}; use rustc::hir::def::{Res, DefKind, CtorKind}; use rustc::hir::pat_util::EnumerateAndAdjustIterator; @@ -684,8 +684,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { } fn e0023(&self, pat_span: Span, res: Res, subpats: &'tcx [P], fields: &[ty::FieldDef]) { - let subpats_ending = if subpats.len() == 1 { "" } else { "s" }; - let fields_ending = if fields.len() == 1 { "" } else { "s" }; + let subpats_ending = pluralise!(subpats.len()); + let fields_ending = pluralise!(fields.len()); let res_span = self.tcx.def_span(res.def_id()); struct_span_err!( self.tcx.sess, @@ -1103,10 +1103,10 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { E0527, "pattern requires {} element{} but array has {}", min_len, - if min_len != 1 { "s" } else { "" }, + pluralise!(min_len), size, ) - .span_label(span, format!("expected {} element{}", size, if size != 1 { "s" } else { "" })) + .span_label(span, format!("expected {} element{}", size, pluralise!(size))) .emit(); } @@ -1117,14 +1117,14 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { E0528, "pattern requires at least {} element{} but array has {}", min_len, - if min_len != 1 { "s" } else { "" }, + pluralise!(min_len), size, ).span_label( span, format!( "pattern cannot match array of {} element{}", size, - if size != 1 { "s" } else { "" }, + pluralise!(size), ), ).emit(); } diff --git a/src/librustc_typeck/check/wfcheck.rs b/src/librustc_typeck/check/wfcheck.rs index ac8ee43dd0801..b0e886a2aa2eb 100644 --- a/src/librustc_typeck/check/wfcheck.rs +++ b/src/librustc_typeck/check/wfcheck.rs @@ -506,7 +506,7 @@ fn check_where_clauses<'tcx, 'fcx>( }); // Now we build the substituted predicates. - let default_obligations = predicates.predicates.iter().flat_map(|&(pred, _)| { + let default_obligations = predicates.predicates.iter().flat_map(|&(pred, sp)| { #[derive(Default)] struct CountParams { params: FxHashSet } impl<'tcx> ty::fold::TypeVisitor<'tcx> for CountParams { @@ -539,9 +539,9 @@ fn check_where_clauses<'tcx, 'fcx>( // Avoid duplication of predicates that contain no parameters, for example. None } else { - Some(substituted_pred) + Some((substituted_pred, sp)) } - }).map(|pred| { + }).map(|(pred, sp)| { // Convert each of those into an obligation. So if you have // something like `struct Foo`, we would // take that predicate `T: Copy`, substitute to `String: Copy` @@ -551,8 +551,8 @@ fn check_where_clauses<'tcx, 'fcx>( // Note the subtle difference from how we handle `predicates` // below: there, we are not trying to prove those predicates // to be *true* but merely *well-formed*. - let pred = fcx.normalize_associated_types_in(span, &pred); - let cause = traits::ObligationCause::new(span, fcx.body_id, traits::ItemObligation(def_id)); + let pred = fcx.normalize_associated_types_in(sp, &pred); + let cause = traits::ObligationCause::new(sp, fcx.body_id, traits::ItemObligation(def_id)); traits::Obligation::new(cause, fcx.param_env, pred) }); diff --git a/src/libsyntax/ext/tt/transcribe.rs b/src/libsyntax/ext/tt/transcribe.rs index 23735727fe8cf..f9c07e3a2e4ff 100644 --- a/src/libsyntax/ext/tt/transcribe.rs +++ b/src/libsyntax/ext/tt/transcribe.rs @@ -8,6 +8,7 @@ use crate::tokenstream::{DelimSpan, TokenStream, TokenTree, TreeAndJoint}; use smallvec::{smallvec, SmallVec}; +use errors::pluralise; use rustc_data_structures::fx::FxHashMap; use rustc_data_structures::sync::Lrc; use syntax_pos::hygiene::{ExpnId, Transparency}; @@ -348,10 +349,10 @@ impl LockstepIterSize { "meta-variable `{}` repeats {} time{}, but `{}` repeats {} time{}", l_id, l_len, - if l_len != 1 { "s" } else { "" }, + pluralise!(l_len), r_id, r_len, - if r_len != 1 { "s" } else { "" }, + pluralise!(r_len), ); LockstepIterSize::Contradiction(msg) } diff --git a/src/libsyntax/parse/diagnostics.rs b/src/libsyntax/parse/diagnostics.rs index b74f2492c351f..2d7f4f71ca4ee 100644 --- a/src/libsyntax/parse/diagnostics.rs +++ b/src/libsyntax/parse/diagnostics.rs @@ -11,7 +11,7 @@ use crate::ptr::P; use crate::symbol::{kw, sym}; use crate::ThinVec; use crate::util::parser::AssocOp; -use errors::{Applicability, DiagnosticBuilder, DiagnosticId}; +use errors::{Applicability, DiagnosticBuilder, DiagnosticId, pluralise}; use rustc_data_structures::fx::FxHashSet; use syntax_pos::{Span, DUMMY_SP, MultiSpan, SpanSnippetError}; use log::{debug, trace}; @@ -532,15 +532,15 @@ impl<'a> Parser<'a> { self.eat_to_tokens(&[&end]); let span = lo.until(self.token.span); - let plural = number_of_gt > 1 || number_of_shr >= 1; + let total_num_of_gt = number_of_gt + number_of_shr * 2; self.diagnostic() .struct_span_err( span, - &format!("unmatched angle bracket{}", if plural { "s" } else { "" }), + &format!("unmatched angle bracket{}", pluralise!(total_num_of_gt)), ) .span_suggestion( span, - &format!("remove extra angle bracket{}", if plural { "s" } else { "" }), + &format!("remove extra angle bracket{}", pluralise!(total_num_of_gt)), String::new(), Applicability::MachineApplicable, ) diff --git a/src/libsyntax/parse/parser/expr.rs b/src/libsyntax/parse/parser/expr.rs index 31b28443abbc3..14a93d986b305 100644 --- a/src/libsyntax/parse/parser/expr.rs +++ b/src/libsyntax/parse/parser/expr.rs @@ -66,6 +66,10 @@ pub(super) enum LhsExpr { } impl From>> for LhsExpr { + /// Converts `Some(attrs)` into `LhsExpr::AttributesParsed(attrs)` + /// and `None` into `LhsExpr::NotYetParsed`. + /// + /// This conversion does not allocate. fn from(o: Option>) -> Self { if let Some(attrs) = o { LhsExpr::AttributesParsed(attrs) @@ -76,6 +80,9 @@ impl From>> for LhsExpr { } impl From> for LhsExpr { + /// Converts the `expr: P` into `LhsExpr::AlreadyParsed(expr)`. + /// + /// This conversion does not allocate. fn from(expr: P) -> Self { LhsExpr::AlreadyParsed(expr) } diff --git a/src/libsyntax/parse/parser/path.rs b/src/libsyntax/parse/parser/path.rs index d4b13cc2e0121..dcd3c64801742 100644 --- a/src/libsyntax/parse/parser/path.rs +++ b/src/libsyntax/parse/parser/path.rs @@ -9,7 +9,7 @@ use crate::symbol::kw; use std::mem; use log::debug; -use errors::{Applicability}; +use errors::{Applicability, pluralise}; /// Specifies how to parse a path. #[derive(Copy, Clone, PartialEq)] @@ -347,20 +347,19 @@ impl<'a> Parser<'a> { let span = lo.with_hi( lo.lo() + BytePos(snapshot.unmatched_angle_bracket_count) ); - let plural = snapshot.unmatched_angle_bracket_count > 1; self.diagnostic() .struct_span_err( span, &format!( "unmatched angle bracket{}", - if plural { "s" } else { "" } + pluralise!(snapshot.unmatched_angle_bracket_count) ), ) .span_suggestion( span, &format!( "remove extra angle bracket{}", - if plural { "s" } else { "" } + pluralise!(snapshot.unmatched_angle_bracket_count) ), String::new(), Applicability::MachineApplicable, diff --git a/src/libsyntax/parse/parser/ty.rs b/src/libsyntax/parse/parser/ty.rs index 465e31ac57e64..5697edd8e4867 100644 --- a/src/libsyntax/parse/parser/ty.rs +++ b/src/libsyntax/parse/parser/ty.rs @@ -11,7 +11,7 @@ use crate::symbol::{kw}; use rustc_target::spec::abi::Abi; -use errors::{Applicability}; +use errors::{Applicability, pluralise}; /// Returns `true` if `IDENT t` can start a type -- `IDENT::a::b`, `IDENT`, /// `IDENT<::AssocTy>`. @@ -397,7 +397,7 @@ impl<'a> Parser<'a> { } if !negative_bounds.is_empty() || was_negative { - let plural = negative_bounds.len() > 1; + let negative_bounds_len = negative_bounds.len(); let last_span = negative_bounds.last().map(|sp| *sp); let mut err = self.struct_span_err( negative_bounds, @@ -420,7 +420,7 @@ impl<'a> Parser<'a> { } err.span_suggestion_hidden( bound_list, - &format!("remove the trait bound{}", if plural { "s" } else { "" }), + &format!("remove the trait bound{}", pluralise!(negative_bounds_len)), new_bound_list, Applicability::MachineApplicable, ); diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index bf36c0d2f5658..27927c3c67593 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -1657,9 +1657,18 @@ impl<'a> State<'a> { } } ast::StmtKind::Semi(ref expr) => { - self.space_if_not_bol(); - self.print_expr_outer_attr_style(expr, false); - self.s.word(";"); + match expr.node { + // Filter out empty `Tup` exprs created for the `redundant_semicolon` + // lint, as they shouldn't be visible and interact poorly + // with proc macros. + ast::ExprKind::Tup(ref exprs) if exprs.is_empty() + && expr.attrs.is_empty() => (), + _ => { + self.space_if_not_bol(); + self.print_expr_outer_attr_style(expr, false); + self.s.word(";"); + } + } } ast::StmtKind::Mac(ref mac) => { let (ref mac, style, ref attrs) = **mac; diff --git a/src/libsyntax_ext/format.rs b/src/libsyntax_ext/format.rs index 46c7cbb83de90..26455df17b896 100644 --- a/src/libsyntax_ext/format.rs +++ b/src/libsyntax_ext/format.rs @@ -5,6 +5,7 @@ use fmt_macros as parse; use errors::DiagnosticBuilder; use errors::Applicability; +use errors::pluralise; use syntax::ast; use syntax::ext::base::{self, *}; @@ -299,7 +300,7 @@ impl<'a, 'b> Context<'a, 'b> { &format!( "{} positional argument{} in format string, but {}", count, - if count != 1 { "s" } else { "" }, + pluralise!(count), self.describe_num_args(), ), ); diff --git a/src/test/ui/associated-types/associated-types-bound-failure.stderr b/src/test/ui/associated-types/associated-types-bound-failure.stderr index 54654b95edd90..85acf134d51d5 100644 --- a/src/test/ui/associated-types/associated-types-bound-failure.stderr +++ b/src/test/ui/associated-types/associated-types-bound-failure.stderr @@ -1,11 +1,11 @@ error[E0277]: the trait bound `::R: ToInt` is not satisfied - --> $DIR/associated-types-bound-failure.rs:17:5 + --> $DIR/associated-types-bound-failure.rs:17:19 | LL | fn to_int(&self) -> isize; | -------------------------- required by `ToInt::to_int` ... LL | ToInt::to_int(&g.get()) - | ^^^^^^^^^^^^^ the trait `ToInt` is not implemented for `::R` + | ^^^^^^^^ the trait `ToInt` is not implemented for `::R` | = help: consider adding a `where ::R: ToInt` bound diff --git a/src/test/ui/closure-expected.stderr b/src/test/ui/closure-expected.stderr index ff77423577db6..ae4f4d69b5ef5 100644 --- a/src/test/ui/closure-expected.stderr +++ b/src/test/ui/closure-expected.stderr @@ -1,8 +1,8 @@ error[E0277]: expected a `std::ops::FnOnce<()>` closure, found `{integer}` - --> $DIR/closure-expected.rs:3:15 + --> $DIR/closure-expected.rs:3:23 | LL | let y = x.or_else(4); - | ^^^^^^^ expected an `FnOnce<()>` closure, found `{integer}` + | ^ expected an `FnOnce<()>` closure, found `{integer}` | = help: the trait `std::ops::FnOnce<()>` is not implemented for `{integer}` = note: wrap the `{integer}` in a closure with no arguments: `|| { /* code */ } diff --git a/src/test/ui/closures/closure-bounds-subtype.stderr b/src/test/ui/closures/closure-bounds-subtype.stderr index 4958bd06d9b16..e9b34e05ac2e2 100644 --- a/src/test/ui/closures/closure-bounds-subtype.stderr +++ b/src/test/ui/closures/closure-bounds-subtype.stderr @@ -1,11 +1,11 @@ error[E0277]: `F` cannot be shared between threads safely - --> $DIR/closure-bounds-subtype.rs:13:5 + --> $DIR/closure-bounds-subtype.rs:13:22 | LL | fn take_const_owned(_: F) where F: FnOnce() + Sync + Send { | ------------------------------------------------------------ required by `take_const_owned` ... LL | take_const_owned(f); - | ^^^^^^^^^^^^^^^^ `F` cannot be shared between threads safely + | ^ `F` cannot be shared between threads safely | = help: the trait `std::marker::Sync` is not implemented for `F` = help: consider adding a `where F: std::marker::Sync` bound diff --git a/src/test/ui/const-generics/array-impls/core-traits-no-impls-length-33.stderr b/src/test/ui/const-generics/array-impls/core-traits-no-impls-length-33.stderr index 09652d99e8ea5..594a0d4b5d844 100644 --- a/src/test/ui/const-generics/array-impls/core-traits-no-impls-length-33.stderr +++ b/src/test/ui/const-generics/array-impls/core-traits-no-impls-length-33.stderr @@ -8,10 +8,10 @@ LL | println!("{:?}", [0_usize; 33]); = note: required by `std::fmt::Debug::fmt` error[E0277]: arrays only have std trait implementations for lengths 0..=32 - --> $DIR/core-traits-no-impls-length-33.rs:9:9 + --> $DIR/core-traits-no-impls-length-33.rs:9:16 | LL | set.insert([0_usize; 33]); - | ^^^^^^ the trait `std::array::LengthAtMost32` is not implemented for `[usize; 33]` + | ^^^^^^^^^^^^^ the trait `std::array::LengthAtMost32` is not implemented for `[usize; 33]` | = note: required because of the requirements on the impl of `std::cmp::Eq` for `[usize; 33]` diff --git a/src/test/ui/derives/deriving-copyclone.stderr b/src/test/ui/derives/deriving-copyclone.stderr index 46b6a0d337695..f142257604cc8 100644 --- a/src/test/ui/derives/deriving-copyclone.stderr +++ b/src/test/ui/derives/deriving-copyclone.stderr @@ -1,33 +1,33 @@ error[E0277]: the trait bound `C: std::marker::Copy` is not satisfied - --> $DIR/deriving-copyclone.rs:31:5 + --> $DIR/deriving-copyclone.rs:31:13 | LL | fn is_copy(_: T) {} | ------------------------- required by `is_copy` ... LL | is_copy(B { a: 1, b: C }); - | ^^^^^^^ the trait `std::marker::Copy` is not implemented for `C` + | ^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `C` | = note: required because of the requirements on the impl of `std::marker::Copy` for `B` error[E0277]: the trait bound `C: std::clone::Clone` is not satisfied - --> $DIR/deriving-copyclone.rs:32:5 + --> $DIR/deriving-copyclone.rs:32:14 | LL | fn is_clone(_: T) {} | --------------------------- required by `is_clone` ... LL | is_clone(B { a: 1, b: C }); - | ^^^^^^^^ the trait `std::clone::Clone` is not implemented for `C` + | ^^^^^^^^^^^^^^^^ the trait `std::clone::Clone` is not implemented for `C` | = note: required because of the requirements on the impl of `std::clone::Clone` for `B` error[E0277]: the trait bound `D: std::marker::Copy` is not satisfied - --> $DIR/deriving-copyclone.rs:35:5 + --> $DIR/deriving-copyclone.rs:35:13 | LL | fn is_copy(_: T) {} | ------------------------- required by `is_copy` ... LL | is_copy(B { a: 1, b: D }); - | ^^^^^^^ the trait `std::marker::Copy` is not implemented for `D` + | ^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `D` | = note: required because of the requirements on the impl of `std::marker::Copy` for `B` diff --git a/src/test/ui/did_you_mean/issue-39802-show-5-trait-impls.stderr b/src/test/ui/did_you_mean/issue-39802-show-5-trait-impls.stderr index ea2017f485a7b..1bd4543f2316c 100644 --- a/src/test/ui/did_you_mean/issue-39802-show-5-trait-impls.stderr +++ b/src/test/ui/did_you_mean/issue-39802-show-5-trait-impls.stderr @@ -1,11 +1,11 @@ error[E0277]: the trait bound `i8: Foo` is not satisfied - --> $DIR/issue-39802-show-5-trait-impls.rs:24:5 + --> $DIR/issue-39802-show-5-trait-impls.rs:24:21 | LL | fn bar(&self){} | ------------- required by `Foo::bar` ... LL | Foo::::bar(&1i8); - | ^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `i8` + | ^^^^ the trait `Foo` is not implemented for `i8` | = help: the following implementations were found: > @@ -15,13 +15,13 @@ LL | Foo::::bar(&1i8); > error[E0277]: the trait bound `u8: Foo` is not satisfied - --> $DIR/issue-39802-show-5-trait-impls.rs:25:5 + --> $DIR/issue-39802-show-5-trait-impls.rs:25:21 | LL | fn bar(&self){} | ------------- required by `Foo::bar` ... LL | Foo::::bar(&1u8); - | ^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `u8` + | ^^^^ the trait `Foo` is not implemented for `u8` | = help: the following implementations were found: > @@ -30,13 +30,13 @@ LL | Foo::::bar(&1u8); > error[E0277]: the trait bound `bool: Foo` is not satisfied - --> $DIR/issue-39802-show-5-trait-impls.rs:26:5 + --> $DIR/issue-39802-show-5-trait-impls.rs:26:21 | LL | fn bar(&self){} | ------------- required by `Foo::bar` ... LL | Foo::::bar(&true); - | ^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `bool` + | ^^^^^ the trait `Foo` is not implemented for `bool` | = help: the following implementations were found: > diff --git a/src/test/ui/error-codes/E0277.stderr b/src/test/ui/error-codes/E0277.stderr index 352102dd38629..9cd0dc7a68e7c 100644 --- a/src/test/ui/error-codes/E0277.stderr +++ b/src/test/ui/error-codes/E0277.stderr @@ -11,13 +11,13 @@ LL | fn f(p: Path) { } = help: unsized locals are gated as an unstable feature error[E0277]: the trait bound `i32: Foo` is not satisfied - --> $DIR/E0277.rs:17:5 + --> $DIR/E0277.rs:17:15 | LL | fn some_func(foo: T) { | ---------------------------- required by `some_func` ... LL | some_func(5i32); - | ^^^^^^^^^ the trait `Foo` is not implemented for `i32` + | ^^^^ the trait `Foo` is not implemented for `i32` error: aborting due to 2 previous errors diff --git a/src/test/ui/error-should-say-copy-not-pod.stderr b/src/test/ui/error-should-say-copy-not-pod.stderr index 78d54c3836db4..df79aeea054ca 100644 --- a/src/test/ui/error-should-say-copy-not-pod.stderr +++ b/src/test/ui/error-should-say-copy-not-pod.stderr @@ -1,11 +1,11 @@ error[E0277]: the trait bound `std::string::String: std::marker::Copy` is not satisfied - --> $DIR/error-should-say-copy-not-pod.rs:6:5 + --> $DIR/error-should-say-copy-not-pod.rs:6:17 | LL | fn check_bound(_: T) {} | ---------------------------- required by `check_bound` ... LL | check_bound("nocopy".to_string()); - | ^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `std::string::String` + | ^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `std::string::String` error: aborting due to previous error diff --git a/src/test/ui/extern/extern-wrong-value-type.stderr b/src/test/ui/extern/extern-wrong-value-type.stderr index 52fcb90e6de0c..f2468895d21d1 100644 --- a/src/test/ui/extern/extern-wrong-value-type.stderr +++ b/src/test/ui/extern/extern-wrong-value-type.stderr @@ -1,11 +1,11 @@ error[E0277]: expected a `std::ops::Fn<()>` closure, found `extern "C" fn() {f}` - --> $DIR/extern-wrong-value-type.rs:9:5 + --> $DIR/extern-wrong-value-type.rs:9:11 | LL | fn is_fn(_: F) where F: Fn() {} | ------------------------------- required by `is_fn` ... LL | is_fn(f); - | ^^^^^ expected an `Fn<()>` closure, found `extern "C" fn() {f}` + | ^ expected an `Fn<()>` closure, found `extern "C" fn() {f}` | = help: the trait `std::ops::Fn<()>` is not implemented for `extern "C" fn() {f}` = note: wrap the `extern "C" fn() {f}` in a closure with no arguments: `|| { /* code */ } diff --git a/src/test/ui/fn/fn-trait-formatting.stderr b/src/test/ui/fn/fn-trait-formatting.stderr index 20d7d9ea5b7a8..4d610b49dff8e 100644 --- a/src/test/ui/fn/fn-trait-formatting.stderr +++ b/src/test/ui/fn/fn-trait-formatting.stderr @@ -26,13 +26,13 @@ LL | let _: () = (box || -> isize { unimplemented!() }) as Box isize>` error[E0277]: expected a `std::ops::Fn<(isize,)>` closure, found `{integer}` - --> $DIR/fn-trait-formatting.rs:19:5 + --> $DIR/fn-trait-formatting.rs:19:14 | LL | fn needs_fn(x: F) where F: Fn(isize) -> isize {} | ------------------------------------------------ required by `needs_fn` ... LL | needs_fn(1); - | ^^^^^^^^ expected an `Fn<(isize,)>` closure, found `{integer}` + | ^ expected an `Fn<(isize,)>` closure, found `{integer}` | = help: the trait `std::ops::Fn<(isize,)>` is not implemented for `{integer}` diff --git a/src/test/ui/for/for-c-in-str.rs b/src/test/ui/for/for-c-in-str.rs index 0fbc796d7c0d3..1871cf9d2386e 100644 --- a/src/test/ui/for/for-c-in-str.rs +++ b/src/test/ui/for/for-c-in-str.rs @@ -6,6 +6,9 @@ fn main() { //~| NOTE `&str` is not an iterator //~| HELP the trait `std::iter::Iterator` is not implemented for `&str` //~| NOTE required by `std::iter::IntoIterator::into_iter` + //~| NOTE in this expansion of desugaring of `for` loop + //~| NOTE in this expansion of desugaring of `for` loop + //~| NOTE in this expansion of desugaring of `for` loop println!(); } } diff --git a/src/test/ui/generator/static-not-unpin.stderr b/src/test/ui/generator/static-not-unpin.stderr index 28a6fac5b85e3..b7871ee3478a4 100644 --- a/src/test/ui/generator/static-not-unpin.stderr +++ b/src/test/ui/generator/static-not-unpin.stderr @@ -1,11 +1,11 @@ error[E0277]: the trait bound `[static generator@$DIR/static-not-unpin.rs:11:25: 13:6 _]: std::marker::Unpin` is not satisfied - --> $DIR/static-not-unpin.rs:14:5 + --> $DIR/static-not-unpin.rs:14:18 | LL | fn assert_unpin(_: T) { | ------------------------------- required by `assert_unpin` ... LL | assert_unpin(generator); - | ^^^^^^^^^^^^ the trait `std::marker::Unpin` is not implemented for `[static generator@$DIR/static-not-unpin.rs:11:25: 13:6 _]` + | ^^^^^^^^^ the trait `std::marker::Unpin` is not implemented for `[static generator@$DIR/static-not-unpin.rs:11:25: 13:6 _]` error: aborting due to previous error diff --git a/src/test/ui/hrtb/hrtb-higher-ranker-supertraits-transitive.stderr b/src/test/ui/hrtb/hrtb-higher-ranker-supertraits-transitive.stderr index 0cddd353d679e..18f49089302e5 100644 --- a/src/test/ui/hrtb/hrtb-higher-ranker-supertraits-transitive.stderr +++ b/src/test/ui/hrtb/hrtb-higher-ranker-supertraits-transitive.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `for<'ccx> B: Bar<'ccx>` is not satisfied - --> $DIR/hrtb-higher-ranker-supertraits-transitive.rs:47:5 + --> $DIR/hrtb-higher-ranker-supertraits-transitive.rs:47:26 | LL | / fn want_bar_for_any_ccx(b: &B) LL | | where B : for<'ccx> Bar<'ccx> @@ -8,7 +8,7 @@ LL | | } | |_- required by `want_bar_for_any_ccx` ... LL | want_bar_for_any_ccx(b); - | ^^^^^^^^^^^^^^^^^^^^ the trait `for<'ccx> Bar<'ccx>` is not implemented for `B` + | ^ the trait `for<'ccx> Bar<'ccx>` is not implemented for `B` | = help: consider adding a `where for<'ccx> B: Bar<'ccx>` bound diff --git a/src/test/ui/hrtb/hrtb-higher-ranker-supertraits.stderr b/src/test/ui/hrtb/hrtb-higher-ranker-supertraits.stderr index 6df486ebaff38..7857ab6e86a20 100644 --- a/src/test/ui/hrtb/hrtb-higher-ranker-supertraits.stderr +++ b/src/test/ui/hrtb/hrtb-higher-ranker-supertraits.stderr @@ -1,8 +1,8 @@ error[E0277]: the trait bound `for<'tcx> F: Foo<'tcx>` is not satisfied - --> $DIR/hrtb-higher-ranker-supertraits.rs:18:5 + --> $DIR/hrtb-higher-ranker-supertraits.rs:18:26 | LL | want_foo_for_any_tcx(f); - | ^^^^^^^^^^^^^^^^^^^^ the trait `for<'tcx> Foo<'tcx>` is not implemented for `F` + | ^ the trait `for<'tcx> Foo<'tcx>` is not implemented for `F` ... LL | / fn want_foo_for_any_tcx(f: &F) LL | | where F : for<'tcx> Foo<'tcx> @@ -15,10 +15,10 @@ LL | | } = help: consider adding a `where for<'tcx> F: Foo<'tcx>` bound error[E0277]: the trait bound `for<'ccx> B: Bar<'ccx>` is not satisfied - --> $DIR/hrtb-higher-ranker-supertraits.rs:35:5 + --> $DIR/hrtb-higher-ranker-supertraits.rs:35:26 | LL | want_bar_for_any_ccx(b); - | ^^^^^^^^^^^^^^^^^^^^ the trait `for<'ccx> Bar<'ccx>` is not implemented for `B` + | ^ the trait `for<'ccx> Bar<'ccx>` is not implemented for `B` ... LL | / fn want_bar_for_any_ccx(b: &B) LL | | where B : for<'ccx> Bar<'ccx> diff --git a/src/test/ui/issues/issue-17651.rs b/src/test/ui/issues/issue-17651.rs index 7629a5a3be1ea..08f352c11fa12 100644 --- a/src/test/ui/issues/issue-17651.rs +++ b/src/test/ui/issues/issue-17651.rs @@ -4,4 +4,5 @@ fn main() { (|| Box::new(*(&[0][..])))(); //~^ ERROR the size for values of type + //~| ERROR the size for values of type } diff --git a/src/test/ui/issues/issue-17651.stderr b/src/test/ui/issues/issue-17651.stderr index ce9af1524b087..c3445024c3752 100644 --- a/src/test/ui/issues/issue-17651.stderr +++ b/src/test/ui/issues/issue-17651.stderr @@ -1,3 +1,13 @@ +error[E0277]: the size for values of type `[{integer}]` cannot be known at compilation time + --> $DIR/issue-17651.rs:5:18 + | +LL | (|| Box::new(*(&[0][..])))(); + | ^^^^^^^^^^^ doesn't have a size known at compile-time + | + = help: the trait `std::marker::Sized` is not implemented for `[{integer}]` + = note: to learn more, visit + = note: required by `std::boxed::Box::::new` + error[E0277]: the size for values of type `[{integer}]` cannot be known at compilation time --> $DIR/issue-17651.rs:5:9 | @@ -6,8 +16,9 @@ LL | (|| Box::new(*(&[0][..])))(); | = help: the trait `std::marker::Sized` is not implemented for `[{integer}]` = note: to learn more, visit - = note: required by `std::boxed::Box::::new` + = note: all function arguments must have a statically known size + = help: unsized locals are gated as an unstable feature -error: aborting due to previous error +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/issues/issue-23966.stderr b/src/test/ui/issues/issue-23966.stderr index ac64067db1099..c2fe6d92b910a 100644 --- a/src/test/ui/issues/issue-23966.stderr +++ b/src/test/ui/issues/issue-23966.stderr @@ -1,8 +1,8 @@ error[E0277]: expected a `std::ops::FnMut<(_, char)>` closure, found `()` - --> $DIR/issue-23966.rs:2:16 + --> $DIR/issue-23966.rs:2:32 | LL | "".chars().fold(|_, _| (), ()); - | ^^^^ expected an `FnMut<(_, char)>` closure, found `()` + | ^^ expected an `FnMut<(_, char)>` closure, found `()` | = help: the trait `std::ops::FnMut<(_, char)>` is not implemented for `()` diff --git a/src/test/ui/issues/issue-25076.stderr b/src/test/ui/issues/issue-25076.stderr index b583a6b54bf9f..a7b6626b16a1c 100644 --- a/src/test/ui/issues/issue-25076.stderr +++ b/src/test/ui/issues/issue-25076.stderr @@ -1,11 +1,11 @@ error[E0277]: the trait bound `(): InOut<_>` is not satisfied - --> $DIR/issue-25076.rs:10:5 + --> $DIR/issue-25076.rs:10:20 | LL | fn do_fold>(init: B, f: F) {} | ------------------------------------------------ required by `do_fold` ... LL | do_fold(bot(), ()); - | ^^^^^^^ the trait `InOut<_>` is not implemented for `()` + | ^^ the trait `InOut<_>` is not implemented for `()` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-28098.rs b/src/test/ui/issues/issue-28098.rs index c4addaccefc10..62a90d90d12de 100644 --- a/src/test/ui/issues/issue-28098.rs +++ b/src/test/ui/issues/issue-28098.rs @@ -1,6 +1,7 @@ fn main() { let _ = Iterator::next(&mut ()); //~^ ERROR `()` is not an iterator + //~| ERROR `()` is not an iterator for _ in false {} //~^ ERROR `bool` is not an iterator @@ -16,6 +17,7 @@ pub fn other() { let _ = Iterator::next(&mut ()); //~^ ERROR `()` is not an iterator + //~| ERROR `()` is not an iterator let _ = Iterator::next(&mut ()); //~^ ERROR `()` is not an iterator diff --git a/src/test/ui/issues/issue-28098.stderr b/src/test/ui/issues/issue-28098.stderr index 30f7819b96daf..8b724b9331dd6 100644 --- a/src/test/ui/issues/issue-28098.stderr +++ b/src/test/ui/issues/issue-28098.stderr @@ -1,14 +1,14 @@ error[E0277]: `()` is not an iterator - --> $DIR/issue-28098.rs:2:13 + --> $DIR/issue-28098.rs:2:28 | LL | let _ = Iterator::next(&mut ()); - | ^^^^^^^^^^^^^^ `()` is not an iterator + | ^^^^^^^ `()` is not an iterator | = help: the trait `std::iter::Iterator` is not implemented for `()` = note: required by `std::iter::Iterator::next` error[E0277]: `bool` is not an iterator - --> $DIR/issue-28098.rs:5:14 + --> $DIR/issue-28098.rs:6:14 | LL | for _ in false {} | ^^^^^ `bool` is not an iterator @@ -17,34 +17,42 @@ LL | for _ in false {} = note: required by `std::iter::IntoIterator::into_iter` error[E0277]: `()` is not an iterator - --> $DIR/issue-28098.rs:8:13 + --> $DIR/issue-28098.rs:9:28 | LL | let _ = Iterator::next(&mut ()); - | ^^^^^^^^^^^^^^ `()` is not an iterator + | ^^^^^^^ `()` is not an iterator | = help: the trait `std::iter::Iterator` is not implemented for `()` = note: required by `std::iter::Iterator::next` error[E0277]: `()` is not an iterator - --> $DIR/issue-28098.rs:17:13 + --> $DIR/issue-28098.rs:2:13 | LL | let _ = Iterator::next(&mut ()); | ^^^^^^^^^^^^^^ `()` is not an iterator | = help: the trait `std::iter::Iterator` is not implemented for `()` + +error[E0277]: `()` is not an iterator + --> $DIR/issue-28098.rs:18:28 + | +LL | let _ = Iterator::next(&mut ()); + | ^^^^^^^ `()` is not an iterator + | + = help: the trait `std::iter::Iterator` is not implemented for `()` = note: required by `std::iter::Iterator::next` error[E0277]: `()` is not an iterator - --> $DIR/issue-28098.rs:20:13 + --> $DIR/issue-28098.rs:22:28 | LL | let _ = Iterator::next(&mut ()); - | ^^^^^^^^^^^^^^ `()` is not an iterator + | ^^^^^^^ `()` is not an iterator | = help: the trait `std::iter::Iterator` is not implemented for `()` = note: required by `std::iter::Iterator::next` error[E0277]: `bool` is not an iterator - --> $DIR/issue-28098.rs:23:14 + --> $DIR/issue-28098.rs:25:14 | LL | for _ in false {} | ^^^^^ `bool` is not an iterator @@ -52,6 +60,14 @@ LL | for _ in false {} = help: the trait `std::iter::Iterator` is not implemented for `bool` = note: required by `std::iter::IntoIterator::into_iter` -error: aborting due to 6 previous errors +error[E0277]: `()` is not an iterator + --> $DIR/issue-28098.rs:18:13 + | +LL | let _ = Iterator::next(&mut ()); + | ^^^^^^^^^^^^^^ `()` is not an iterator + | + = help: the trait `std::iter::Iterator` is not implemented for `()` + +error: aborting due to 8 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/issues/issue-47706-trait.stderr b/src/test/ui/issues/issue-47706-trait.stderr index 5f8f8564249c8..8a6a199148c39 100644 --- a/src/test/ui/issues/issue-47706-trait.stderr +++ b/src/test/ui/issues/issue-47706-trait.stderr @@ -1,10 +1,10 @@ error[E0593]: function is expected to take a single 0-tuple as argument, but it takes 2 distinct arguments - --> $DIR/issue-47706-trait.rs:3:20 + --> $DIR/issue-47706-trait.rs:3:24 | LL | fn f(&self, _: ()) { | ------------------ takes 2 distinct arguments LL | None::<()>.map(Self::f); - | ^^^ expected function that takes a single 0-tuple as argument + | ^^^^^^^ expected function that takes a single 0-tuple as argument error: aborting due to previous error diff --git a/src/test/ui/issues/issue-47706.stderr b/src/test/ui/issues/issue-47706.stderr index c47eebb8e5c07..4f64a643fe57d 100644 --- a/src/test/ui/issues/issue-47706.stderr +++ b/src/test/ui/issues/issue-47706.stderr @@ -1,14 +1,14 @@ error[E0593]: function is expected to take 1 argument, but it takes 2 arguments - --> $DIR/issue-47706.rs:11:18 + --> $DIR/issue-47706.rs:11:22 | LL | pub fn new(foo: Option, _: ()) -> Foo { | ------------------------------------------ takes 2 arguments ... LL | self.foo.map(Foo::new) - | ^^^ expected function that takes 1 argument + | ^^^^^^^^ expected function that takes 1 argument error[E0593]: function is expected to take 0 arguments, but it takes 1 argument - --> $DIR/issue-47706.rs:27:5 + --> $DIR/issue-47706.rs:27:9 | LL | Bar(i32), | -------- takes 1 argument @@ -21,7 +21,7 @@ LL | | } | |_- required by `foo` ... LL | foo(Qux::Bar); - | ^^^ expected function that takes 0 arguments + | ^^^^^^^^ expected function that takes 0 arguments error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-60283.stderr b/src/test/ui/issues/issue-60283.stderr index a977ba392769f..2b01a64d39a9b 100644 --- a/src/test/ui/issues/issue-60283.stderr +++ b/src/test/ui/issues/issue-60283.stderr @@ -1,5 +1,5 @@ error[E0631]: type mismatch in function arguments - --> $DIR/issue-60283.rs:14:5 + --> $DIR/issue-60283.rs:14:13 | LL | / pub fn foo(_: T, _: F) LL | | where T: for<'a> Trait<'a>, @@ -7,10 +7,10 @@ LL | | F: for<'a> FnMut(>::Item) {} | |_________________________________________________- required by `foo` ... LL | foo((), drop) - | ^^^ - | | - | expected signature of `for<'a> fn(<() as Trait<'a>>::Item) -> _` - | found signature of `fn(_) -> _` + | ^^^^ + | | + | expected signature of `for<'a> fn(<() as Trait<'a>>::Item) -> _` + | found signature of `fn(_) -> _` error[E0271]: type mismatch resolving `for<'a> } as std::ops::FnOnce<(<() as Trait<'a>>::Item,)>>::Output == ()` --> $DIR/issue-60283.rs:14:5 diff --git a/src/test/ui/kindck/kindck-impl-type-params-2.stderr b/src/test/ui/kindck/kindck-impl-type-params-2.stderr index 6d599423d2548..5e6eca6f0571b 100644 --- a/src/test/ui/kindck/kindck-impl-type-params-2.stderr +++ b/src/test/ui/kindck/kindck-impl-type-params-2.stderr @@ -1,11 +1,11 @@ error[E0277]: the trait bound `std::boxed::Box<{integer}>: std::marker::Copy` is not satisfied - --> $DIR/kindck-impl-type-params-2.rs:13:5 + --> $DIR/kindck-impl-type-params-2.rs:13:16 | LL | fn take_param(foo: &T) { } | ----------------------------- required by `take_param` ... LL | take_param(&x); - | ^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `std::boxed::Box<{integer}>` + | ^^ the trait `std::marker::Copy` is not implemented for `std::boxed::Box<{integer}>` | = note: required because of the requirements on the impl of `Foo` for `std::boxed::Box<{integer}>` diff --git a/src/test/ui/kindck/kindck-inherited-copy-bound.stderr b/src/test/ui/kindck/kindck-inherited-copy-bound.stderr index a53063157fc8e..9f548083e73d1 100644 --- a/src/test/ui/kindck/kindck-inherited-copy-bound.stderr +++ b/src/test/ui/kindck/kindck-inherited-copy-bound.stderr @@ -1,11 +1,11 @@ error[E0277]: the trait bound `std::boxed::Box<{integer}>: std::marker::Copy` is not satisfied - --> $DIR/kindck-inherited-copy-bound.rs:18:5 + --> $DIR/kindck-inherited-copy-bound.rs:18:16 | LL | fn take_param(foo: &T) { } | ----------------------------- required by `take_param` ... LL | take_param(&x); - | ^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `std::boxed::Box<{integer}>` + | ^^ the trait `std::marker::Copy` is not implemented for `std::boxed::Box<{integer}>` | = note: required because of the requirements on the impl of `Foo` for `std::boxed::Box<{integer}>` diff --git a/src/test/ui/lint/redundant-semicolon/auxiliary/redundant-semi-proc-macro-def.rs b/src/test/ui/lint/redundant-semicolon/auxiliary/redundant-semi-proc-macro-def.rs new file mode 100644 index 0000000000000..ca741393aec0c --- /dev/null +++ b/src/test/ui/lint/redundant-semicolon/auxiliary/redundant-semi-proc-macro-def.rs @@ -0,0 +1,11 @@ +// no-prefer-dynamic +#![crate_type="proc-macro"] +#![crate_name="redundant_semi_proc_macro"] +extern crate proc_macro; +use proc_macro::TokenStream; + +#[proc_macro_attribute] +pub fn should_preserve_spans(_attr: TokenStream, item: TokenStream) -> TokenStream { + eprintln!("{:?}", item); + item +} diff --git a/src/test/ui/lint/redundant-semicolon/redundant-semi-proc-macro.rs b/src/test/ui/lint/redundant-semicolon/redundant-semi-proc-macro.rs new file mode 100644 index 0000000000000..f207b235735fe --- /dev/null +++ b/src/test/ui/lint/redundant-semicolon/redundant-semi-proc-macro.rs @@ -0,0 +1,19 @@ +// aux-build:redundant-semi-proc-macro-def.rs + +#![deny(redundant_semicolon)] +extern crate redundant_semi_proc_macro; +use redundant_semi_proc_macro::should_preserve_spans; + +#[should_preserve_spans] +fn span_preservation() { + let tst = 123;; //~ ERROR unnecessary trailing semicolon + match tst { + // Redundant semicolons are parsed as empty tuple exprs + // for the lint, so ensure the lint doesn't affect + // empty tuple exprs explicitly in source. + 123 => (), + _ => () + };;; //~ ERROR unnecessary trailing semicolons +} + +fn main() {} diff --git a/src/test/ui/lint/redundant-semicolon/redundant-semi-proc-macro.stderr b/src/test/ui/lint/redundant-semicolon/redundant-semi-proc-macro.stderr new file mode 100644 index 0000000000000..5f289c0914d6e --- /dev/null +++ b/src/test/ui/lint/redundant-semicolon/redundant-semi-proc-macro.stderr @@ -0,0 +1,21 @@ +TokenStream [Ident { ident: "fn", span: #0 bytes(197..199) }, Ident { ident: "span_preservation", span: #0 bytes(200..217) }, Group { delimiter: Parenthesis, stream: TokenStream [], span: #0 bytes(217..219) }, Group { delimiter: Brace, stream: TokenStream [Ident { ident: "let", span: #0 bytes(227..230) }, Ident { ident: "tst", span: #0 bytes(231..234) }, Punct { ch: '=', spacing: Alone, span: #0 bytes(235..236) }, Literal { lit: Lit { kind: Integer, symbol: 123, suffix: None }, span: Span { lo: BytePos(237), hi: BytePos(240), ctxt: #0 } }, Punct { ch: ';', spacing: Joint, span: #0 bytes(240..241) }, Punct { ch: ';', spacing: Alone, span: #0 bytes(241..242) }, Ident { ident: "match", span: #0 bytes(288..293) }, Ident { ident: "tst", span: #0 bytes(294..297) }, Group { delimiter: Brace, stream: TokenStream [Literal { lit: Lit { kind: Integer, symbol: 123, suffix: None }, span: Span { lo: BytePos(482), hi: BytePos(485), ctxt: #0 } }, Punct { ch: '=', spacing: Joint, span: #0 bytes(486..488) }, Punct { ch: '>', spacing: Alone, span: #0 bytes(486..488) }, Group { delimiter: Parenthesis, stream: TokenStream [], span: #0 bytes(489..491) }, Punct { ch: ',', spacing: Alone, span: #0 bytes(491..492) }, Ident { ident: "_", span: #0 bytes(501..502) }, Punct { ch: '=', spacing: Joint, span: #0 bytes(503..505) }, Punct { ch: '>', spacing: Alone, span: #0 bytes(503..505) }, Group { delimiter: Parenthesis, stream: TokenStream [], span: #0 bytes(506..508) }], span: #0 bytes(298..514) }, Punct { ch: ';', spacing: Joint, span: #0 bytes(514..515) }, Punct { ch: ';', spacing: Joint, span: #0 bytes(515..516) }, Punct { ch: ';', spacing: Alone, span: #0 bytes(516..517) }], span: #0 bytes(221..561) }] +error: unnecessary trailing semicolon + --> $DIR/redundant-semi-proc-macro.rs:9:19 + | +LL | let tst = 123;; + | ^ help: remove this semicolon + | +note: lint level defined here + --> $DIR/redundant-semi-proc-macro.rs:3:9 + | +LL | #![deny(redundant_semicolon)] + | ^^^^^^^^^^^^^^^^^^^ + +error: unnecessary trailing semicolons + --> $DIR/redundant-semi-proc-macro.rs:16:7 + | +LL | };;; + | ^^ help: remove these semicolons + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/mismatched_types/E0631.stderr b/src/test/ui/mismatched_types/E0631.stderr index 319eb86480af5..64ddf1deb0639 100644 --- a/src/test/ui/mismatched_types/E0631.stderr +++ b/src/test/ui/mismatched_types/E0631.stderr @@ -21,7 +21,7 @@ LL | bar(|_: isize| {}); | expected signature of `fn(usize) -> _` error[E0631]: type mismatch in function arguments - --> $DIR/E0631.rs:9:5 + --> $DIR/E0631.rs:9:9 | LL | fn foo(_: F) {} | -------------------------- required by `foo` @@ -30,10 +30,10 @@ LL | fn f(_: u64) {} | ------------ found signature of `fn(u64) -> _` ... LL | foo(f); - | ^^^ expected signature of `fn(usize) -> _` + | ^ expected signature of `fn(usize) -> _` error[E0631]: type mismatch in function arguments - --> $DIR/E0631.rs:10:5 + --> $DIR/E0631.rs:10:9 | LL | fn bar>(_: F) {} | -------------------------- required by `bar` @@ -42,7 +42,7 @@ LL | fn f(_: u64) {} | ------------ found signature of `fn(u64) -> _` ... LL | bar(f); - | ^^^ expected signature of `fn(usize) -> _` + | ^ expected signature of `fn(usize) -> _` error: aborting due to 4 previous errors diff --git a/src/test/ui/mismatched_types/closure-arg-count.stderr b/src/test/ui/mismatched_types/closure-arg-count.stderr index b7b5b50b0b4e4..12ae8acaee5cf 100644 --- a/src/test/ui/mismatched_types/closure-arg-count.stderr +++ b/src/test/ui/mismatched_types/closure-arg-count.stderr @@ -105,42 +105,42 @@ LL | let _it = vec![1, 2, 3].into_iter().enumerate().map(|i, x, y| i); | expected closure that takes a single 2-tuple as argument error[E0593]: function is expected to take a single 2-tuple as argument, but it takes 0 arguments - --> $DIR/closure-arg-count.rs:24:53 + --> $DIR/closure-arg-count.rs:24:57 | LL | let _it = vec![1, 2, 3].into_iter().enumerate().map(foo); - | ^^^ expected function that takes a single 2-tuple as argument + | ^^^ expected function that takes a single 2-tuple as argument ... LL | fn foo() {} | -------- takes 0 arguments error[E0593]: closure is expected to take a single 2-tuple as argument, but it takes 3 distinct arguments - --> $DIR/closure-arg-count.rs:27:53 + --> $DIR/closure-arg-count.rs:27:57 | LL | let bar = |i, x, y| i; | --------- takes 3 distinct arguments LL | let _it = vec![1, 2, 3].into_iter().enumerate().map(bar); - | ^^^ expected closure that takes a single 2-tuple as argument + | ^^^ expected closure that takes a single 2-tuple as argument error[E0593]: function is expected to take a single 2-tuple as argument, but it takes 2 distinct arguments - --> $DIR/closure-arg-count.rs:29:53 + --> $DIR/closure-arg-count.rs:29:57 | LL | let _it = vec![1, 2, 3].into_iter().enumerate().map(qux); - | ^^^ expected function that takes a single 2-tuple as argument + | ^^^ expected function that takes a single 2-tuple as argument ... LL | fn qux(x: usize, y: usize) {} | -------------------------- takes 2 distinct arguments error[E0593]: function is expected to take 1 argument, but it takes 2 arguments - --> $DIR/closure-arg-count.rs:32:41 + --> $DIR/closure-arg-count.rs:32:45 | LL | let _it = vec![1, 2, 3].into_iter().map(usize::checked_add); - | ^^^ expected function that takes 1 argument + | ^^^^^^^^^^^^^^^^^^ expected function that takes 1 argument error[E0593]: function is expected to take 0 arguments, but it takes 1 argument - --> $DIR/closure-arg-count.rs:35:5 + --> $DIR/closure-arg-count.rs:35:10 | LL | call(Foo); - | ^^^^ expected function that takes 0 arguments + | ^^^ expected function that takes 0 arguments ... LL | fn call(_: F) where F: FnOnce() -> R {} | ------------------------------------------ required by `call` diff --git a/src/test/ui/mismatched_types/closure-arg-type-mismatch.stderr b/src/test/ui/mismatched_types/closure-arg-type-mismatch.stderr index 2a65759dd17f8..68bc17b4966f1 100644 --- a/src/test/ui/mismatched_types/closure-arg-type-mismatch.stderr +++ b/src/test/ui/mismatched_types/closure-arg-type-mismatch.stderr @@ -23,16 +23,16 @@ LL | a.iter().map(|_: (u16, u16)| 45); | expected signature of `fn(&(u32, u32)) -> _` error[E0631]: type mismatch in function arguments - --> $DIR/closure-arg-type-mismatch.rs:10:5 + --> $DIR/closure-arg-type-mismatch.rs:10:9 | LL | fn baz(_: F) {} | ------------------------------ required by `baz` LL | fn _test<'a>(f: fn(*mut &'a u32)) { LL | baz(f); - | ^^^ - | | - | expected signature of `for<'r> fn(*mut &'r u32) -> _` - | found signature of `fn(*mut &'a u32) -> _` + | ^ + | | + | expected signature of `for<'r> fn(*mut &'r u32) -> _` + | found signature of `fn(*mut &'a u32) -> _` error[E0271]: type mismatch resolving `for<'r> >::Output == ()` --> $DIR/closure-arg-type-mismatch.rs:10:5 diff --git a/src/test/ui/mismatched_types/fn-variance-1.stderr b/src/test/ui/mismatched_types/fn-variance-1.stderr index d4db7bda06e7e..6342ee770ddaf 100644 --- a/src/test/ui/mismatched_types/fn-variance-1.stderr +++ b/src/test/ui/mismatched_types/fn-variance-1.stderr @@ -1,5 +1,5 @@ error[E0631]: type mismatch in function arguments - --> $DIR/fn-variance-1.rs:11:5 + --> $DIR/fn-variance-1.rs:11:15 | LL | fn takes_mut(x: &mut isize) { } | --------------------------- found signature of `for<'r> fn(&'r mut isize) -> _` @@ -8,10 +8,10 @@ LL | fn apply(t: T, f: F) where F: FnOnce(T) { | --------------------------------------------- required by `apply` ... LL | apply(&3, takes_mut); - | ^^^^^ expected signature of `fn(&{integer}) -> _` + | ^^^^^^^^^ expected signature of `fn(&{integer}) -> _` error[E0631]: type mismatch in function arguments - --> $DIR/fn-variance-1.rs:15:5 + --> $DIR/fn-variance-1.rs:15:19 | LL | fn takes_imm(x: &isize) { } | ----------------------- found signature of `for<'r> fn(&'r isize) -> _` @@ -20,7 +20,7 @@ LL | fn apply(t: T, f: F) where F: FnOnce(T) { | --------------------------------------------- required by `apply` ... LL | apply(&mut 3, takes_imm); - | ^^^^^ expected signature of `fn(&mut {integer}) -> _` + | ^^^^^^^^^ expected signature of `fn(&mut {integer}) -> _` error: aborting due to 2 previous errors diff --git a/src/test/ui/mismatched_types/unboxed-closures-vtable-mismatch.stderr b/src/test/ui/mismatched_types/unboxed-closures-vtable-mismatch.stderr index 53c9fcd70a23d..139d87d58b640 100644 --- a/src/test/ui/mismatched_types/unboxed-closures-vtable-mismatch.stderr +++ b/src/test/ui/mismatched_types/unboxed-closures-vtable-mismatch.stderr @@ -1,5 +1,5 @@ error[E0631]: type mismatch in closure arguments - --> $DIR/unboxed-closures-vtable-mismatch.rs:15:13 + --> $DIR/unboxed-closures-vtable-mismatch.rs:15:24 | LL | fn call_itisize>(y: isize, mut f: F) -> isize { | -------------------------------------------------------------------- required by `call_it` @@ -8,7 +8,7 @@ LL | let f = to_fn_mut(|x: usize, y: isize| -> isize { (x as isize) + y }); | ----------------------------- found signature of `fn(usize, isize) -> _` LL | LL | let z = call_it(3, f); - | ^^^^^^^ expected signature of `fn(isize, isize) -> _` + | ^ expected signature of `fn(isize, isize) -> _` error: aborting due to previous error diff --git a/src/test/ui/mutexguard-sync.stderr b/src/test/ui/mutexguard-sync.stderr index 4a93c9f09b788..1cda2da5061a5 100644 --- a/src/test/ui/mutexguard-sync.stderr +++ b/src/test/ui/mutexguard-sync.stderr @@ -1,11 +1,11 @@ error[E0277]: `std::cell::Cell` cannot be shared between threads safely - --> $DIR/mutexguard-sync.rs:11:5 + --> $DIR/mutexguard-sync.rs:11:15 | LL | fn test_sync(_t: T) {} | ---------------------------- required by `test_sync` ... LL | test_sync(guard); - | ^^^^^^^^^ `std::cell::Cell` cannot be shared between threads safely + | ^^^^^ `std::cell::Cell` cannot be shared between threads safely | = help: the trait `std::marker::Sync` is not implemented for `std::cell::Cell` = note: required because of the requirements on the impl of `std::marker::Sync` for `std::sync::MutexGuard<'_, std::cell::Cell>` diff --git a/src/test/ui/namespace/namespace-mix.stderr b/src/test/ui/namespace/namespace-mix.stderr index 39aaddb390caa..249ad1c584421 100644 --- a/src/test/ui/namespace/namespace-mix.stderr +++ b/src/test/ui/namespace/namespace-mix.stderr @@ -67,400 +67,400 @@ LL | use namespace_mix::xm8::V; | error[E0277]: the trait bound `c::Item: Impossible` is not satisfied - --> $DIR/namespace-mix.rs:33:5 + --> $DIR/namespace-mix.rs:33:11 | LL | fn check(_: T) {} | ----------------------------- required by `check` ... LL | check(m1::S{}); - | ^^^^^ the trait `Impossible` is not implemented for `c::Item` + | ^^^^^^^ the trait `Impossible` is not implemented for `c::Item` error[E0277]: the trait bound `c::S: Impossible` is not satisfied - --> $DIR/namespace-mix.rs:35:5 + --> $DIR/namespace-mix.rs:35:11 | LL | fn check(_: T) {} | ----------------------------- required by `check` ... LL | check(m2::S{}); - | ^^^^^ the trait `Impossible` is not implemented for `c::S` + | ^^^^^^^ the trait `Impossible` is not implemented for `c::S` error[E0277]: the trait bound `c::Item: Impossible` is not satisfied - --> $DIR/namespace-mix.rs:36:5 + --> $DIR/namespace-mix.rs:36:11 | LL | fn check(_: T) {} | ----------------------------- required by `check` ... LL | check(m2::S); - | ^^^^^ the trait `Impossible` is not implemented for `c::Item` + | ^^^^^ the trait `Impossible` is not implemented for `c::Item` error[E0277]: the trait bound `namespace_mix::c::Item: Impossible` is not satisfied - --> $DIR/namespace-mix.rs:39:5 + --> $DIR/namespace-mix.rs:39:11 | LL | fn check(_: T) {} | ----------------------------- required by `check` ... LL | check(xm1::S{}); - | ^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::Item` + | ^^^^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::Item` error[E0277]: the trait bound `namespace_mix::c::S: Impossible` is not satisfied - --> $DIR/namespace-mix.rs:41:5 + --> $DIR/namespace-mix.rs:41:11 | LL | fn check(_: T) {} | ----------------------------- required by `check` ... LL | check(xm2::S{}); - | ^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::S` + | ^^^^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::S` error[E0277]: the trait bound `namespace_mix::c::Item: Impossible` is not satisfied - --> $DIR/namespace-mix.rs:42:5 + --> $DIR/namespace-mix.rs:42:11 | LL | fn check(_: T) {} | ----------------------------- required by `check` ... LL | check(xm2::S); - | ^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::Item` + | ^^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::Item` error[E0277]: the trait bound `c::Item: Impossible` is not satisfied - --> $DIR/namespace-mix.rs:55:5 + --> $DIR/namespace-mix.rs:55:11 | LL | fn check(_: T) {} | ----------------------------- required by `check` ... LL | check(m3::TS{}); - | ^^^^^ the trait `Impossible` is not implemented for `c::Item` + | ^^^^^^^^ the trait `Impossible` is not implemented for `c::Item` error[E0277]: the trait bound `fn() -> c::TS {c::TS}: Impossible` is not satisfied - --> $DIR/namespace-mix.rs:56:5 + --> $DIR/namespace-mix.rs:56:11 | LL | fn check(_: T) {} | ----------------------------- required by `check` ... LL | check(m3::TS); - | ^^^^^ the trait `Impossible` is not implemented for `fn() -> c::TS {c::TS}` + | ^^^^^^ the trait `Impossible` is not implemented for `fn() -> c::TS {c::TS}` error[E0277]: the trait bound `c::TS: Impossible` is not satisfied - --> $DIR/namespace-mix.rs:57:5 + --> $DIR/namespace-mix.rs:57:11 | LL | fn check(_: T) {} | ----------------------------- required by `check` ... LL | check(m4::TS{}); - | ^^^^^ the trait `Impossible` is not implemented for `c::TS` + | ^^^^^^^^ the trait `Impossible` is not implemented for `c::TS` error[E0277]: the trait bound `c::Item: Impossible` is not satisfied - --> $DIR/namespace-mix.rs:58:5 + --> $DIR/namespace-mix.rs:58:11 | LL | fn check(_: T) {} | ----------------------------- required by `check` ... LL | check(m4::TS); - | ^^^^^ the trait `Impossible` is not implemented for `c::Item` + | ^^^^^^ the trait `Impossible` is not implemented for `c::Item` error[E0277]: the trait bound `namespace_mix::c::Item: Impossible` is not satisfied - --> $DIR/namespace-mix.rs:61:5 + --> $DIR/namespace-mix.rs:61:11 | LL | fn check(_: T) {} | ----------------------------- required by `check` ... LL | check(xm3::TS{}); - | ^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::Item` + | ^^^^^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::Item` error[E0277]: the trait bound `fn() -> namespace_mix::c::TS {namespace_mix::c::TS}: Impossible` is not satisfied - --> $DIR/namespace-mix.rs:62:5 + --> $DIR/namespace-mix.rs:62:11 | LL | fn check(_: T) {} | ----------------------------- required by `check` ... LL | check(xm3::TS); - | ^^^^^ the trait `Impossible` is not implemented for `fn() -> namespace_mix::c::TS {namespace_mix::c::TS}` + | ^^^^^^^ the trait `Impossible` is not implemented for `fn() -> namespace_mix::c::TS {namespace_mix::c::TS}` error[E0277]: the trait bound `namespace_mix::c::TS: Impossible` is not satisfied - --> $DIR/namespace-mix.rs:63:5 + --> $DIR/namespace-mix.rs:63:11 | LL | fn check(_: T) {} | ----------------------------- required by `check` ... LL | check(xm4::TS{}); - | ^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::TS` + | ^^^^^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::TS` error[E0277]: the trait bound `namespace_mix::c::Item: Impossible` is not satisfied - --> $DIR/namespace-mix.rs:64:5 + --> $DIR/namespace-mix.rs:64:11 | LL | fn check(_: T) {} | ----------------------------- required by `check` ... LL | check(xm4::TS); - | ^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::Item` + | ^^^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::Item` error[E0277]: the trait bound `c::Item: Impossible` is not satisfied - --> $DIR/namespace-mix.rs:77:5 + --> $DIR/namespace-mix.rs:77:11 | LL | fn check(_: T) {} | ----------------------------- required by `check` ... LL | check(m5::US{}); - | ^^^^^ the trait `Impossible` is not implemented for `c::Item` + | ^^^^^^^^ the trait `Impossible` is not implemented for `c::Item` error[E0277]: the trait bound `c::US: Impossible` is not satisfied - --> $DIR/namespace-mix.rs:78:5 + --> $DIR/namespace-mix.rs:78:11 | LL | fn check(_: T) {} | ----------------------------- required by `check` ... LL | check(m5::US); - | ^^^^^ the trait `Impossible` is not implemented for `c::US` + | ^^^^^^ the trait `Impossible` is not implemented for `c::US` error[E0277]: the trait bound `c::US: Impossible` is not satisfied - --> $DIR/namespace-mix.rs:79:5 + --> $DIR/namespace-mix.rs:79:11 | LL | fn check(_: T) {} | ----------------------------- required by `check` ... LL | check(m6::US{}); - | ^^^^^ the trait `Impossible` is not implemented for `c::US` + | ^^^^^^^^ the trait `Impossible` is not implemented for `c::US` error[E0277]: the trait bound `c::Item: Impossible` is not satisfied - --> $DIR/namespace-mix.rs:80:5 + --> $DIR/namespace-mix.rs:80:11 | LL | fn check(_: T) {} | ----------------------------- required by `check` ... LL | check(m6::US); - | ^^^^^ the trait `Impossible` is not implemented for `c::Item` + | ^^^^^^ the trait `Impossible` is not implemented for `c::Item` error[E0277]: the trait bound `namespace_mix::c::Item: Impossible` is not satisfied - --> $DIR/namespace-mix.rs:83:5 + --> $DIR/namespace-mix.rs:83:11 | LL | fn check(_: T) {} | ----------------------------- required by `check` ... LL | check(xm5::US{}); - | ^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::Item` + | ^^^^^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::Item` error[E0277]: the trait bound `namespace_mix::c::US: Impossible` is not satisfied - --> $DIR/namespace-mix.rs:84:5 + --> $DIR/namespace-mix.rs:84:11 | LL | fn check(_: T) {} | ----------------------------- required by `check` ... LL | check(xm5::US); - | ^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::US` + | ^^^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::US` error[E0277]: the trait bound `namespace_mix::c::US: Impossible` is not satisfied - --> $DIR/namespace-mix.rs:85:5 + --> $DIR/namespace-mix.rs:85:11 | LL | fn check(_: T) {} | ----------------------------- required by `check` ... LL | check(xm6::US{}); - | ^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::US` + | ^^^^^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::US` error[E0277]: the trait bound `namespace_mix::c::Item: Impossible` is not satisfied - --> $DIR/namespace-mix.rs:86:5 + --> $DIR/namespace-mix.rs:86:11 | LL | fn check(_: T) {} | ----------------------------- required by `check` ... LL | check(xm6::US); - | ^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::Item` + | ^^^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::Item` error[E0277]: the trait bound `c::Item: Impossible` is not satisfied - --> $DIR/namespace-mix.rs:99:5 + --> $DIR/namespace-mix.rs:99:11 | LL | fn check(_: T) {} | ----------------------------- required by `check` ... LL | check(m7::V{}); - | ^^^^^ the trait `Impossible` is not implemented for `c::Item` + | ^^^^^^^ the trait `Impossible` is not implemented for `c::Item` error[E0277]: the trait bound `c::E: Impossible` is not satisfied - --> $DIR/namespace-mix.rs:101:5 + --> $DIR/namespace-mix.rs:101:11 | LL | fn check(_: T) {} | ----------------------------- required by `check` ... LL | check(m8::V{}); - | ^^^^^ the trait `Impossible` is not implemented for `c::E` + | ^^^^^^^ the trait `Impossible` is not implemented for `c::E` error[E0277]: the trait bound `c::Item: Impossible` is not satisfied - --> $DIR/namespace-mix.rs:102:5 + --> $DIR/namespace-mix.rs:102:11 | LL | fn check(_: T) {} | ----------------------------- required by `check` ... LL | check(m8::V); - | ^^^^^ the trait `Impossible` is not implemented for `c::Item` + | ^^^^^ the trait `Impossible` is not implemented for `c::Item` error[E0277]: the trait bound `namespace_mix::c::Item: Impossible` is not satisfied - --> $DIR/namespace-mix.rs:105:5 + --> $DIR/namespace-mix.rs:105:11 | LL | fn check(_: T) {} | ----------------------------- required by `check` ... LL | check(xm7::V{}); - | ^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::Item` + | ^^^^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::Item` error[E0277]: the trait bound `namespace_mix::c::E: Impossible` is not satisfied - --> $DIR/namespace-mix.rs:107:5 + --> $DIR/namespace-mix.rs:107:11 | LL | fn check(_: T) {} | ----------------------------- required by `check` ... LL | check(xm8::V{}); - | ^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::E` + | ^^^^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::E` error[E0277]: the trait bound `namespace_mix::c::Item: Impossible` is not satisfied - --> $DIR/namespace-mix.rs:108:5 + --> $DIR/namespace-mix.rs:108:11 | LL | fn check(_: T) {} | ----------------------------- required by `check` ... LL | check(xm8::V); - | ^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::Item` + | ^^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::Item` error[E0277]: the trait bound `c::Item: Impossible` is not satisfied - --> $DIR/namespace-mix.rs:121:5 + --> $DIR/namespace-mix.rs:121:11 | LL | fn check(_: T) {} | ----------------------------- required by `check` ... LL | check(m9::TV{}); - | ^^^^^ the trait `Impossible` is not implemented for `c::Item` + | ^^^^^^^^ the trait `Impossible` is not implemented for `c::Item` error[E0277]: the trait bound `fn() -> c::E {c::E::TV}: Impossible` is not satisfied - --> $DIR/namespace-mix.rs:122:5 + --> $DIR/namespace-mix.rs:122:11 | LL | fn check(_: T) {} | ----------------------------- required by `check` ... LL | check(m9::TV); - | ^^^^^ the trait `Impossible` is not implemented for `fn() -> c::E {c::E::TV}` + | ^^^^^^ the trait `Impossible` is not implemented for `fn() -> c::E {c::E::TV}` error[E0277]: the trait bound `c::E: Impossible` is not satisfied - --> $DIR/namespace-mix.rs:123:5 + --> $DIR/namespace-mix.rs:123:11 | LL | fn check(_: T) {} | ----------------------------- required by `check` ... LL | check(mA::TV{}); - | ^^^^^ the trait `Impossible` is not implemented for `c::E` + | ^^^^^^^^ the trait `Impossible` is not implemented for `c::E` error[E0277]: the trait bound `c::Item: Impossible` is not satisfied - --> $DIR/namespace-mix.rs:124:5 + --> $DIR/namespace-mix.rs:124:11 | LL | fn check(_: T) {} | ----------------------------- required by `check` ... LL | check(mA::TV); - | ^^^^^ the trait `Impossible` is not implemented for `c::Item` + | ^^^^^^ the trait `Impossible` is not implemented for `c::Item` error[E0277]: the trait bound `namespace_mix::c::Item: Impossible` is not satisfied - --> $DIR/namespace-mix.rs:127:5 + --> $DIR/namespace-mix.rs:127:11 | LL | fn check(_: T) {} | ----------------------------- required by `check` ... LL | check(xm9::TV{}); - | ^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::Item` + | ^^^^^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::Item` error[E0277]: the trait bound `fn() -> namespace_mix::c::E {namespace_mix::xm7::TV}: Impossible` is not satisfied - --> $DIR/namespace-mix.rs:128:5 + --> $DIR/namespace-mix.rs:128:11 | LL | fn check(_: T) {} | ----------------------------- required by `check` ... LL | check(xm9::TV); - | ^^^^^ the trait `Impossible` is not implemented for `fn() -> namespace_mix::c::E {namespace_mix::xm7::TV}` + | ^^^^^^^ the trait `Impossible` is not implemented for `fn() -> namespace_mix::c::E {namespace_mix::xm7::TV}` error[E0277]: the trait bound `namespace_mix::c::E: Impossible` is not satisfied - --> $DIR/namespace-mix.rs:129:5 + --> $DIR/namespace-mix.rs:129:11 | LL | fn check(_: T) {} | ----------------------------- required by `check` ... LL | check(xmA::TV{}); - | ^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::E` + | ^^^^^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::E` error[E0277]: the trait bound `namespace_mix::c::Item: Impossible` is not satisfied - --> $DIR/namespace-mix.rs:130:5 + --> $DIR/namespace-mix.rs:130:11 | LL | fn check(_: T) {} | ----------------------------- required by `check` ... LL | check(xmA::TV); - | ^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::Item` + | ^^^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::Item` error[E0277]: the trait bound `c::Item: Impossible` is not satisfied - --> $DIR/namespace-mix.rs:143:5 + --> $DIR/namespace-mix.rs:143:11 | LL | fn check(_: T) {} | ----------------------------- required by `check` ... LL | check(mB::UV{}); - | ^^^^^ the trait `Impossible` is not implemented for `c::Item` + | ^^^^^^^^ the trait `Impossible` is not implemented for `c::Item` error[E0277]: the trait bound `c::E: Impossible` is not satisfied - --> $DIR/namespace-mix.rs:144:5 + --> $DIR/namespace-mix.rs:144:11 | LL | fn check(_: T) {} | ----------------------------- required by `check` ... LL | check(mB::UV); - | ^^^^^ the trait `Impossible` is not implemented for `c::E` + | ^^^^^^ the trait `Impossible` is not implemented for `c::E` error[E0277]: the trait bound `c::E: Impossible` is not satisfied - --> $DIR/namespace-mix.rs:145:5 + --> $DIR/namespace-mix.rs:145:11 | LL | fn check(_: T) {} | ----------------------------- required by `check` ... LL | check(mC::UV{}); - | ^^^^^ the trait `Impossible` is not implemented for `c::E` + | ^^^^^^^^ the trait `Impossible` is not implemented for `c::E` error[E0277]: the trait bound `c::Item: Impossible` is not satisfied - --> $DIR/namespace-mix.rs:146:5 + --> $DIR/namespace-mix.rs:146:11 | LL | fn check(_: T) {} | ----------------------------- required by `check` ... LL | check(mC::UV); - | ^^^^^ the trait `Impossible` is not implemented for `c::Item` + | ^^^^^^ the trait `Impossible` is not implemented for `c::Item` error[E0277]: the trait bound `namespace_mix::c::Item: Impossible` is not satisfied - --> $DIR/namespace-mix.rs:149:5 + --> $DIR/namespace-mix.rs:149:11 | LL | fn check(_: T) {} | ----------------------------- required by `check` ... LL | check(xmB::UV{}); - | ^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::Item` + | ^^^^^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::Item` error[E0277]: the trait bound `namespace_mix::c::E: Impossible` is not satisfied - --> $DIR/namespace-mix.rs:150:5 + --> $DIR/namespace-mix.rs:150:11 | LL | fn check(_: T) {} | ----------------------------- required by `check` ... LL | check(xmB::UV); - | ^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::E` + | ^^^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::E` error[E0277]: the trait bound `namespace_mix::c::E: Impossible` is not satisfied - --> $DIR/namespace-mix.rs:151:5 + --> $DIR/namespace-mix.rs:151:11 | LL | fn check(_: T) {} | ----------------------------- required by `check` ... LL | check(xmC::UV{}); - | ^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::E` + | ^^^^^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::E` error[E0277]: the trait bound `namespace_mix::c::Item: Impossible` is not satisfied - --> $DIR/namespace-mix.rs:152:5 + --> $DIR/namespace-mix.rs:152:11 | LL | fn check(_: T) {} | ----------------------------- required by `check` ... LL | check(xmC::UV); - | ^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::Item` + | ^^^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::Item` error: aborting due to 48 previous errors diff --git a/src/test/ui/no_send-rc.stderr b/src/test/ui/no_send-rc.stderr index eaf3103060eff..de08634e16ac4 100644 --- a/src/test/ui/no_send-rc.stderr +++ b/src/test/ui/no_send-rc.stderr @@ -1,11 +1,11 @@ error[E0277]: `std::rc::Rc<{integer}>` cannot be sent between threads safely - --> $DIR/no_send-rc.rs:7:5 + --> $DIR/no_send-rc.rs:7:9 | LL | fn bar(_: T) {} | --------------------- required by `bar` ... LL | bar(x); - | ^^^ `std::rc::Rc<{integer}>` cannot be sent between threads safely + | ^ `std::rc::Rc<{integer}>` cannot be sent between threads safely | = help: the trait `std::marker::Send` is not implemented for `std::rc::Rc<{integer}>` diff --git a/src/test/ui/no_send-struct.stderr b/src/test/ui/no_send-struct.stderr index 1808cef45f184..3865971fcfdd1 100644 --- a/src/test/ui/no_send-struct.stderr +++ b/src/test/ui/no_send-struct.stderr @@ -1,11 +1,11 @@ error[E0277]: `Foo` cannot be sent between threads safely - --> $DIR/no_send-struct.rs:15:5 + --> $DIR/no_send-struct.rs:15:9 | LL | fn bar(_: T) {} | --------------------- required by `bar` ... LL | bar(x); - | ^^^ `Foo` cannot be sent between threads safely + | ^ `Foo` cannot be sent between threads safely | = help: the trait `std::marker::Send` is not implemented for `Foo` diff --git a/src/test/ui/no_share-struct.stderr b/src/test/ui/no_share-struct.stderr index c12ee7c5eae85..13de5bd6fe84b 100644 --- a/src/test/ui/no_share-struct.stderr +++ b/src/test/ui/no_share-struct.stderr @@ -1,11 +1,11 @@ error[E0277]: `Foo` cannot be shared between threads safely - --> $DIR/no_share-struct.rs:12:5 + --> $DIR/no_share-struct.rs:12:9 | LL | fn bar(_: T) {} | --------------------- required by `bar` ... LL | bar(x); - | ^^^ `Foo` cannot be shared between threads safely + | ^ `Foo` cannot be shared between threads safely | = help: the trait `std::marker::Sync` is not implemented for `Foo` diff --git a/src/test/ui/object-does-not-impl-trait.stderr b/src/test/ui/object-does-not-impl-trait.stderr index d3add6398bd98..83ca9a7212b22 100644 --- a/src/test/ui/object-does-not-impl-trait.stderr +++ b/src/test/ui/object-does-not-impl-trait.stderr @@ -1,10 +1,10 @@ error[E0277]: the trait bound `std::boxed::Box: Foo` is not satisfied - --> $DIR/object-does-not-impl-trait.rs:6:35 + --> $DIR/object-does-not-impl-trait.rs:6:44 | LL | fn take_foo(f: F) {} | ------------------------ required by `take_foo` LL | fn take_object(f: Box) { take_foo(f); } - | ^^^^^^^^ the trait `Foo` is not implemented for `std::boxed::Box` + | ^ the trait `Foo` is not implemented for `std::boxed::Box` error: aborting due to previous error diff --git a/src/test/ui/on-unimplemented/multiple-impls.stderr b/src/test/ui/on-unimplemented/multiple-impls.stderr index b286265bf01c0..f0651c4cdef0e 100644 --- a/src/test/ui/on-unimplemented/multiple-impls.stderr +++ b/src/test/ui/on-unimplemented/multiple-impls.stderr @@ -1,57 +1,57 @@ error[E0277]: the trait bound `[i32]: Index` is not satisfied - --> $DIR/multiple-impls.rs:33:5 + --> $DIR/multiple-impls.rs:33:18 | LL | fn index(&self, index: Idx) -> &Self::Output; | --------------------------------------------- required by `Index::index` ... LL | Index::index(&[] as &[i32], 2u32); - | ^^^^^^^^^^^^ trait message - | - = help: the trait `Index` is not implemented for `[i32]` - -error[E0277]: the trait bound `[i32]: Index` is not satisfied - --> $DIR/multiple-impls.rs:33:5 - | -LL | Index::index(&[] as &[i32], 2u32); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ trait message + | ^^^^^^^^^^^^^ trait message | = help: the trait `Index` is not implemented for `[i32]` error[E0277]: the trait bound `[i32]: Index>` is not satisfied - --> $DIR/multiple-impls.rs:36:5 + --> $DIR/multiple-impls.rs:36:18 | LL | fn index(&self, index: Idx) -> &Self::Output; | --------------------------------------------- required by `Index::index` ... LL | Index::index(&[] as &[i32], Foo(2u32)); - | ^^^^^^^^^^^^ on impl for Foo - | - = help: the trait `Index>` is not implemented for `[i32]` - -error[E0277]: the trait bound `[i32]: Index>` is not satisfied - --> $DIR/multiple-impls.rs:36:5 - | -LL | Index::index(&[] as &[i32], Foo(2u32)); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ on impl for Foo + | ^^^^^^^^^^^^^ on impl for Foo | = help: the trait `Index>` is not implemented for `[i32]` error[E0277]: the trait bound `[i32]: Index>` is not satisfied - --> $DIR/multiple-impls.rs:39:5 + --> $DIR/multiple-impls.rs:39:18 | LL | fn index(&self, index: Idx) -> &Self::Output; | --------------------------------------------- required by `Index::index` ... LL | Index::index(&[] as &[i32], Bar(2u32)); - | ^^^^^^^^^^^^ on impl for Bar + | ^^^^^^^^^^^^^ on impl for Bar | = help: the trait `Index>` is not implemented for `[i32]` +error[E0277]: the trait bound `[i32]: Index` is not satisfied + --> $DIR/multiple-impls.rs:33:5 + | +LL | Index::index(&[] as &[i32], 2u32); + | ^^^^^^^^^^^^ trait message + | + = help: the trait `Index` is not implemented for `[i32]` + +error[E0277]: the trait bound `[i32]: Index>` is not satisfied + --> $DIR/multiple-impls.rs:36:5 + | +LL | Index::index(&[] as &[i32], Foo(2u32)); + | ^^^^^^^^^^^^ on impl for Foo + | + = help: the trait `Index>` is not implemented for `[i32]` + error[E0277]: the trait bound `[i32]: Index>` is not satisfied --> $DIR/multiple-impls.rs:39:5 | LL | Index::index(&[] as &[i32], Bar(2u32)); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ on impl for Bar + | ^^^^^^^^^^^^ on impl for Bar | = help: the trait `Index>` is not implemented for `[i32]` diff --git a/src/test/ui/on-unimplemented/on-impl.stderr b/src/test/ui/on-unimplemented/on-impl.stderr index 78dc9a53761c5..f19fa8a07fe64 100644 --- a/src/test/ui/on-unimplemented/on-impl.stderr +++ b/src/test/ui/on-unimplemented/on-impl.stderr @@ -1,11 +1,11 @@ error[E0277]: the trait bound `[i32]: Index` is not satisfied - --> $DIR/on-impl.rs:22:5 + --> $DIR/on-impl.rs:22:25 | LL | fn index(&self, index: Idx) -> &Self::Output; | --------------------------------------------- required by `Index::index` ... LL | Index::::index(&[1, 2, 3] as &[i32], 2u32); - | ^^^^^^^^^^^^^^^^^^^ a usize is required to index into a slice + | ^^^^^^^^^^^^^^^^^^^^ a usize is required to index into a slice | = help: the trait `Index` is not implemented for `[i32]` @@ -13,7 +13,7 @@ error[E0277]: the trait bound `[i32]: Index` is not satisfied --> $DIR/on-impl.rs:22:5 | LL | Index::::index(&[1, 2, 3] as &[i32], 2u32); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ a usize is required to index into a slice + | ^^^^^^^^^^^^^^^^^^^ a usize is required to index into a slice | = help: the trait `Index` is not implemented for `[i32]` diff --git a/src/test/ui/phantom-oibit.stderr b/src/test/ui/phantom-oibit.stderr index 284102a6df028..c1b60e0823fd4 100644 --- a/src/test/ui/phantom-oibit.stderr +++ b/src/test/ui/phantom-oibit.stderr @@ -1,11 +1,11 @@ error[E0277]: `T` cannot be shared between threads safely - --> $DIR/phantom-oibit.rs:21:5 + --> $DIR/phantom-oibit.rs:21:12 | LL | fn is_zen(_: T) {} | ----------------------- required by `is_zen` ... LL | is_zen(x) - | ^^^^^^ `T` cannot be shared between threads safely + | ^ `T` cannot be shared between threads safely | = help: the trait `std::marker::Sync` is not implemented for `T` = help: consider adding a `where T: std::marker::Sync` bound @@ -14,13 +14,13 @@ LL | is_zen(x) = note: required because it appears within the type `Guard<'_, T>` error[E0277]: `T` cannot be shared between threads safely - --> $DIR/phantom-oibit.rs:26:5 + --> $DIR/phantom-oibit.rs:26:12 | LL | fn is_zen(_: T) {} | ----------------------- required by `is_zen` ... LL | is_zen(x) - | ^^^^^^ `T` cannot be shared between threads safely + | ^ `T` cannot be shared between threads safely | = help: the trait `std::marker::Sync` is not implemented for `T` = help: consider adding a `where T: std::marker::Sync` bound diff --git a/src/test/ui/str/str-idx.stderr b/src/test/ui/str/str-idx.stderr index e388534f132d2..9f21aaaebad58 100644 --- a/src/test/ui/str/str-idx.stderr +++ b/src/test/ui/str/str-idx.stderr @@ -10,20 +10,20 @@ LL | let _: u8 = s[4]; = note: required because of the requirements on the impl of `std::ops::Index<{integer}>` for `str` error[E0277]: the type `str` cannot be indexed by `{integer}` - --> $DIR/str-idx.rs:4:15 + --> $DIR/str-idx.rs:4:19 | LL | let _ = s.get(4); - | ^^^ string indices are ranges of `usize` + | ^ string indices are ranges of `usize` | = help: the trait `std::slice::SliceIndex` is not implemented for `{integer}` = note: you can use `.chars().nth()` or `.bytes().nth()` see chapter in The Book error[E0277]: the type `str` cannot be indexed by `{integer}` - --> $DIR/str-idx.rs:5:15 + --> $DIR/str-idx.rs:5:29 | LL | let _ = s.get_unchecked(4); - | ^^^^^^^^^^^^^ string indices are ranges of `usize` + | ^ string indices are ranges of `usize` | = help: the trait `std::slice::SliceIndex` is not implemented for `{integer}` = note: you can use `.chars().nth()` or `.bytes().nth()` diff --git a/src/test/ui/str/str-mut-idx.stderr b/src/test/ui/str/str-mut-idx.stderr index 08baa478b8bfa..372077a465e4a 100644 --- a/src/test/ui/str/str-mut-idx.stderr +++ b/src/test/ui/str/str-mut-idx.stderr @@ -30,20 +30,20 @@ LL | s[1usize] = bot(); = note: required because of the requirements on the impl of `std::ops::Index` for `str` error[E0277]: the type `str` cannot be indexed by `{integer}` - --> $DIR/str-mut-idx.rs:9:7 + --> $DIR/str-mut-idx.rs:9:15 | LL | s.get_mut(1); - | ^^^^^^^ string indices are ranges of `usize` + | ^ string indices are ranges of `usize` | = help: the trait `std::slice::SliceIndex` is not implemented for `{integer}` = note: you can use `.chars().nth()` or `.bytes().nth()` see chapter in The Book error[E0277]: the type `str` cannot be indexed by `{integer}` - --> $DIR/str-mut-idx.rs:11:7 + --> $DIR/str-mut-idx.rs:11:25 | LL | s.get_unchecked_mut(1); - | ^^^^^^^^^^^^^^^^^ string indices are ranges of `usize` + | ^ string indices are ranges of `usize` | = help: the trait `std::slice::SliceIndex` is not implemented for `{integer}` = note: you can use `.chars().nth()` or `.bytes().nth()` diff --git a/src/test/ui/suggestions/async-fn-ctor-passed-as-arg-where-it-should-have-been-called.stderr b/src/test/ui/suggestions/async-fn-ctor-passed-as-arg-where-it-should-have-been-called.stderr index 3141b1b65f9ba..6bb6533899669 100644 --- a/src/test/ui/suggestions/async-fn-ctor-passed-as-arg-where-it-should-have-been-called.stderr +++ b/src/test/ui/suggestions/async-fn-ctor-passed-as-arg-where-it-should-have-been-called.stderr @@ -1,13 +1,14 @@ error[E0277]: the trait bound `fn() -> impl std::future::Future {foo}: std::future::Future` is not satisfied - --> $DIR/async-fn-ctor-passed-as-arg-where-it-should-have-been-called.rs:9:5 + --> $DIR/async-fn-ctor-passed-as-arg-where-it-should-have-been-called.rs:9:9 | LL | fn bar(f: impl Future) {} | --------------------------------- required by `bar` ... LL | bar(foo); - | ^^^ the trait `std::future::Future` is not implemented for `fn() -> impl std::future::Future {foo}` - | - = help: use parentheses to call the function: `foo()` + | ^^^ + | | + | the trait `std::future::Future` is not implemented for `fn() -> impl std::future::Future {foo}` + | help: use parentheses to call the function: `foo()` error: aborting due to previous error diff --git a/src/test/ui/suggestions/fn-ctor-passed-as-arg-where-it-should-have-been-called.stderr b/src/test/ui/suggestions/fn-ctor-passed-as-arg-where-it-should-have-been-called.stderr index 2cc4653fabe2d..59726c82c2377 100644 --- a/src/test/ui/suggestions/fn-ctor-passed-as-arg-where-it-should-have-been-called.stderr +++ b/src/test/ui/suggestions/fn-ctor-passed-as-arg-where-it-should-have-been-called.stderr @@ -1,13 +1,14 @@ error[E0277]: the trait bound `fn() -> impl T {foo}: T` is not satisfied - --> $DIR/fn-ctor-passed-as-arg-where-it-should-have-been-called.rs:17:5 + --> $DIR/fn-ctor-passed-as-arg-where-it-should-have-been-called.rs:17:9 | LL | fn bar(f: impl T) {} | ----------------------- required by `bar` ... LL | bar(foo); - | ^^^ the trait `T` is not implemented for `fn() -> impl T {foo}` - | - = help: use parentheses to call the function: `foo()` + | ^^^ + | | + | the trait `T` is not implemented for `fn() -> impl T {foo}` + | help: use parentheses to call the function: `foo()` error: aborting due to previous error diff --git a/src/test/ui/suggestions/issue-62843.stderr b/src/test/ui/suggestions/issue-62843.stderr index cc27b5b49b67d..b5801e9162fb3 100644 --- a/src/test/ui/suggestions/issue-62843.stderr +++ b/src/test/ui/suggestions/issue-62843.stderr @@ -1,8 +1,8 @@ error[E0277]: expected a `std::ops::FnMut<(char,)>` closure, found `std::string::String` - --> $DIR/issue-62843.rs:4:27 + --> $DIR/issue-62843.rs:4:32 | LL | println!("{:?}", line.find(pattern)); - | ^^^^ expected an `FnMut<(char,)>` closure, found `std::string::String` + | ^^^^^^^ expected an `FnMut<(char,)>` closure, found `std::string::String` | = help: the trait `std::ops::FnMut<(char,)>` is not implemented for `std::string::String` = note: borrowing the `std::string::String` might fix the problem diff --git a/src/test/ui/traits/traits-inductive-overflow-supertrait-oibit.stderr b/src/test/ui/traits/traits-inductive-overflow-supertrait-oibit.stderr index 0b543616d7c9a..76d486a51e5cc 100644 --- a/src/test/ui/traits/traits-inductive-overflow-supertrait-oibit.stderr +++ b/src/test/ui/traits/traits-inductive-overflow-supertrait-oibit.stderr @@ -5,13 +5,13 @@ LL | auto trait Magic: Copy {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `NoClone: std::marker::Copy` is not satisfied - --> $DIR/traits-inductive-overflow-supertrait-oibit.rs:15:18 + --> $DIR/traits-inductive-overflow-supertrait-oibit.rs:15:23 | LL | fn copy(x: T) -> (T, T) { (x, x) } | --------------------------------- required by `copy` ... LL | let (a, b) = copy(NoClone); - | ^^^^ the trait `std::marker::Copy` is not implemented for `NoClone` + | ^^^^^^^ the trait `std::marker::Copy` is not implemented for `NoClone` | = note: required because of the requirements on the impl of `Magic` for `NoClone` diff --git a/src/test/ui/traits/traits-negative-impls.stderr b/src/test/ui/traits/traits-negative-impls.stderr index 23bd334a3e776..022b12d256cc3 100644 --- a/src/test/ui/traits/traits-negative-impls.stderr +++ b/src/test/ui/traits/traits-negative-impls.stderr @@ -1,11 +1,11 @@ error[E0277]: `dummy::TestType` cannot be sent between threads safely - --> $DIR/traits-negative-impls.rs:23:5 + --> $DIR/traits-negative-impls.rs:23:11 | LL | struct Outer(T); | ------------------------- required by `Outer` ... LL | Outer(TestType); - | ^^^^^ `dummy::TestType` cannot be sent between threads safely + | ^^^^^^^^ `dummy::TestType` cannot be sent between threads safely | = help: the trait `std::marker::Send` is not implemented for `dummy::TestType` @@ -21,49 +21,49 @@ LL | Outer(TestType); = help: the trait `std::marker::Send` is not implemented for `dummy::TestType` error[E0277]: `dummy1b::TestType` cannot be sent between threads safely - --> $DIR/traits-negative-impls.rs:32:5 + --> $DIR/traits-negative-impls.rs:32:13 | LL | fn is_send(_: T) {} | ------------------------- required by `is_send` ... LL | is_send(TestType); - | ^^^^^^^ `dummy1b::TestType` cannot be sent between threads safely + | ^^^^^^^^ `dummy1b::TestType` cannot be sent between threads safely | = help: the trait `std::marker::Send` is not implemented for `dummy1b::TestType` error[E0277]: `dummy1c::TestType` cannot be sent between threads safely - --> $DIR/traits-negative-impls.rs:40:5 + --> $DIR/traits-negative-impls.rs:40:13 | LL | fn is_send(_: T) {} | ------------------------- required by `is_send` ... LL | is_send((8, TestType)); - | ^^^^^^^ `dummy1c::TestType` cannot be sent between threads safely + | ^^^^^^^^^^^^^ `dummy1c::TestType` cannot be sent between threads safely | = help: within `({integer}, dummy1c::TestType)`, the trait `std::marker::Send` is not implemented for `dummy1c::TestType` = note: required because it appears within the type `({integer}, dummy1c::TestType)` error[E0277]: `dummy2::TestType` cannot be sent between threads safely - --> $DIR/traits-negative-impls.rs:48:5 + --> $DIR/traits-negative-impls.rs:48:13 | LL | fn is_send(_: T) {} | ------------------------- required by `is_send` ... LL | is_send(Box::new(TestType)); - | ^^^^^^^ `dummy2::TestType` cannot be sent between threads safely + | ^^^^^^^^^^^^^^^^^^ `dummy2::TestType` cannot be sent between threads safely | = help: the trait `std::marker::Send` is not implemented for `dummy2::TestType` = note: required because of the requirements on the impl of `std::marker::Send` for `std::ptr::Unique` = note: required because it appears within the type `std::boxed::Box` error[E0277]: `dummy3::TestType` cannot be sent between threads safely - --> $DIR/traits-negative-impls.rs:56:5 + --> $DIR/traits-negative-impls.rs:56:13 | LL | fn is_send(_: T) {} | ------------------------- required by `is_send` ... LL | is_send(Box::new(Outer2(TestType))); - | ^^^^^^^ `dummy3::TestType` cannot be sent between threads safely + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ `dummy3::TestType` cannot be sent between threads safely | = help: within `Outer2`, the trait `std::marker::Send` is not implemented for `dummy3::TestType` = note: required because it appears within the type `Outer2` @@ -71,13 +71,13 @@ LL | is_send(Box::new(Outer2(TestType))); = note: required because it appears within the type `std::boxed::Box>` error[E0277]: `main::TestType` cannot be sent between threads safely - --> $DIR/traits-negative-impls.rs:66:5 + --> $DIR/traits-negative-impls.rs:66:13 | LL | fn is_sync(_: T) {} | ------------------------- required by `is_sync` ... LL | is_sync(Outer2(TestType)); - | ^^^^^^^ `main::TestType` cannot be sent between threads safely + | ^^^^^^^^^^^^^^^^ `main::TestType` cannot be sent between threads safely | = help: the trait `std::marker::Send` is not implemented for `main::TestType` = note: required because of the requirements on the impl of `std::marker::Sync` for `Outer2` diff --git a/src/test/ui/trivial-bounds/trivial-bounds-leak.stderr b/src/test/ui/trivial-bounds/trivial-bounds-leak.stderr index d172d5ecc4b70..49393a8678ef8 100644 --- a/src/test/ui/trivial-bounds/trivial-bounds-leak.stderr +++ b/src/test/ui/trivial-bounds/trivial-bounds-leak.stderr @@ -19,19 +19,19 @@ LL | 3i32.test(); candidate #1: `Foo` error[E0277]: the trait bound `i32: Foo` is not satisfied - --> $DIR/trivial-bounds-leak.rs:25:5 + --> $DIR/trivial-bounds-leak.rs:25:15 | LL | fn test(&self); | --------------- required by `Foo::test` ... LL | Foo::test(&4i32); - | ^^^^^^^^^ the trait `Foo` is not implemented for `i32` + | ^^^^^ the trait `Foo` is not implemented for `i32` error[E0277]: the trait bound `i32: Foo` is not satisfied - --> $DIR/trivial-bounds-leak.rs:26:5 + --> $DIR/trivial-bounds-leak.rs:26:22 | LL | generic_function(5i32); - | ^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `i32` + | ^^^^ the trait `Foo` is not implemented for `i32` ... LL | fn generic_function(t: T) {} | --------------------------------- required by `generic_function` diff --git a/src/test/ui/try-operator-on-main.rs b/src/test/ui/try-operator-on-main.rs index 3b48194eb44fd..602c3c5c3593b 100644 --- a/src/test/ui/try-operator-on-main.rs +++ b/src/test/ui/try-operator-on-main.rs @@ -19,7 +19,7 @@ fn main() { fn try_trait_generic() -> T { // and a non-`Try` object on a `Try` fn. - ()?; //~ ERROR the `?` operator can only + ()?; //~ ERROR the `?` operator can only be applied to values that implement `std::ops::Try` loop {} } diff --git a/src/test/ui/type/type-check-defaults.stderr b/src/test/ui/type/type-check-defaults.stderr index 42cca76451fd1..742a709958fa0 100644 --- a/src/test/ui/type/type-check-defaults.stderr +++ b/src/test/ui/type/type-check-defaults.stderr @@ -20,30 +20,30 @@ LL | struct WellFormedNoBounds>(Z); = help: the trait `std::iter::FromIterator` is not implemented for `i32` error[E0277]: the trait bound `std::string::String: std::marker::Copy` is not satisfied - --> $DIR/type-check-defaults.rs:11:1 + --> $DIR/type-check-defaults.rs:11:17 | LL | struct Bounds(T); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | the trait `std::marker::Copy` is not implemented for `std::string::String` + | ----------------^^^^------------ + | | | + | | the trait `std::marker::Copy` is not implemented for `std::string::String` | required by `Bounds` error[E0277]: the trait bound `std::string::String: std::marker::Copy` is not satisfied - --> $DIR/type-check-defaults.rs:14:1 + --> $DIR/type-check-defaults.rs:14:42 | LL | struct WhereClause(T) where T: Copy; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | the trait `std::marker::Copy` is not implemented for `std::string::String` + | -----------------------------------------^^^^- + | | | + | | the trait `std::marker::Copy` is not implemented for `std::string::String` | required by `WhereClause` error[E0277]: the trait bound `std::string::String: std::marker::Copy` is not satisfied - --> $DIR/type-check-defaults.rs:17:1 + --> $DIR/type-check-defaults.rs:17:20 | LL | trait TraitBound {} - | -------------------------------^^^ - | | - | the trait `std::marker::Copy` is not implemented for `std::string::String` + | -------------------^^^^-------- + | | | + | | the trait `std::marker::Copy` is not implemented for `std::string::String` | required by `TraitBound` error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied @@ -57,12 +57,12 @@ LL | trait Base: Super { } = help: consider adding a `where T: std::marker::Copy` bound error[E0277]: cannot add `u8` to `i32` - --> $DIR/type-check-defaults.rs:24:1 + --> $DIR/type-check-defaults.rs:24:66 | LL | trait ProjectionPred> where T::Item : Add {} - | ------------------------------------------------------------------------^^^ - | | - | no implementation for `i32 + u8` + | -----------------------------------------------------------------^^^^^^^ + | | | + | | no implementation for `i32 + u8` | required by `ProjectionPred` | = help: the trait `std::ops::Add` is not implemented for `i32` diff --git a/src/test/ui/typeck/typeck-unsafe-always-share.stderr b/src/test/ui/typeck/typeck-unsafe-always-share.stderr index 7ed85a14259aa..8b3032b088d0e 100644 --- a/src/test/ui/typeck/typeck-unsafe-always-share.stderr +++ b/src/test/ui/typeck/typeck-unsafe-always-share.stderr @@ -1,22 +1,22 @@ error[E0277]: `std::cell::UnsafeCell>` cannot be shared between threads safely - --> $DIR/typeck-unsafe-always-share.rs:19:5 + --> $DIR/typeck-unsafe-always-share.rs:19:10 | LL | fn test(s: T) {} | ---------------------- required by `test` ... LL | test(us); - | ^^^^ `std::cell::UnsafeCell>` cannot be shared between threads safely + | ^^ `std::cell::UnsafeCell>` cannot be shared between threads safely | = help: the trait `std::marker::Sync` is not implemented for `std::cell::UnsafeCell>` error[E0277]: `std::cell::UnsafeCell` cannot be shared between threads safely - --> $DIR/typeck-unsafe-always-share.rs:23:5 + --> $DIR/typeck-unsafe-always-share.rs:23:10 | LL | fn test(s: T) {} | ---------------------- required by `test` ... LL | test(uns); - | ^^^^ `std::cell::UnsafeCell` cannot be shared between threads safely + | ^^^ `std::cell::UnsafeCell` cannot be shared between threads safely | = help: the trait `std::marker::Sync` is not implemented for `std::cell::UnsafeCell` @@ -33,13 +33,13 @@ LL | test(ms); = note: required because it appears within the type `MySync` error[E0277]: `NoSync` cannot be shared between threads safely - --> $DIR/typeck-unsafe-always-share.rs:30:5 + --> $DIR/typeck-unsafe-always-share.rs:30:10 | LL | fn test(s: T) {} | ---------------------- required by `test` ... LL | test(NoSync); - | ^^^^ `NoSync` cannot be shared between threads safely + | ^^^^^^ `NoSync` cannot be shared between threads safely | = help: the trait `std::marker::Sync` is not implemented for `NoSync` diff --git a/src/test/ui/unboxed-closures/unboxed-closures-fnmut-as-fn.stderr b/src/test/ui/unboxed-closures/unboxed-closures-fnmut-as-fn.stderr index d64e54a548442..d03397e42445c 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-fnmut-as-fn.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closures-fnmut-as-fn.stderr @@ -1,11 +1,11 @@ error[E0277]: expected a `std::ops::Fn<(isize,)>` closure, found `S` - --> $DIR/unboxed-closures-fnmut-as-fn.rs:28:13 + --> $DIR/unboxed-closures-fnmut-as-fn.rs:28:21 | LL | fn call_itisize>(f: &F, x: isize) -> isize { | -------------------------------------------------------- required by `call_it` ... LL | let x = call_it(&S, 22); - | ^^^^^^^ expected an `Fn<(isize,)>` closure, found `S` + | ^^ expected an `Fn<(isize,)>` closure, found `S` | = help: the trait `std::ops::Fn<(isize,)>` is not implemented for `S` diff --git a/src/test/ui/unboxed-closures/unboxed-closures-unsafe-extern-fn.stderr b/src/test/ui/unboxed-closures/unboxed-closures-unsafe-extern-fn.stderr index 3d20b5df1e3f3..bde30729a3ca3 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-unsafe-extern-fn.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closures-unsafe-extern-fn.stderr @@ -1,55 +1,55 @@ error[E0277]: expected a `std::ops::Fn<(&isize,)>` closure, found `for<'r> unsafe fn(&'r isize) -> isize {square}` - --> $DIR/unboxed-closures-unsafe-extern-fn.rs:12:13 + --> $DIR/unboxed-closures-unsafe-extern-fn.rs:12:21 | LL | fn call_itisize>(_: &F, _: isize) -> isize { 0 } | --------------------------------------------------------- required by `call_it` ... LL | let x = call_it(&square, 22); - | ^^^^^^^ expected an `Fn<(&isize,)>` closure, found `for<'r> unsafe fn(&'r isize) -> isize {square}` + | ^^^^^^^ expected an `Fn<(&isize,)>` closure, found `for<'r> unsafe fn(&'r isize) -> isize {square}` | = help: the trait `for<'r> std::ops::Fn<(&'r isize,)>` is not implemented for `for<'r> unsafe fn(&'r isize) -> isize {square}` error[E0277]: expected a `std::ops::FnOnce<(&isize,)>` closure, found `for<'r> unsafe fn(&'r isize) -> isize {square}` - --> $DIR/unboxed-closures-unsafe-extern-fn.rs:12:13 + --> $DIR/unboxed-closures-unsafe-extern-fn.rs:12:21 | LL | fn call_itisize>(_: &F, _: isize) -> isize { 0 } | --------------------------------------------------------- required by `call_it` ... LL | let x = call_it(&square, 22); - | ^^^^^^^ expected an `FnOnce<(&isize,)>` closure, found `for<'r> unsafe fn(&'r isize) -> isize {square}` + | ^^^^^^^ expected an `FnOnce<(&isize,)>` closure, found `for<'r> unsafe fn(&'r isize) -> isize {square}` | = help: the trait `std::ops::FnOnce<(&isize,)>` is not implemented for `for<'r> unsafe fn(&'r isize) -> isize {square}` error[E0277]: expected a `std::ops::FnMut<(&isize,)>` closure, found `for<'r> unsafe fn(&'r isize) -> isize {square}` - --> $DIR/unboxed-closures-unsafe-extern-fn.rs:18:13 + --> $DIR/unboxed-closures-unsafe-extern-fn.rs:18:25 | LL | fn call_it_mutisize>(_: &mut F, _: isize) -> isize { 0 } | -------------------------------------------------------------------- required by `call_it_mut` ... LL | let y = call_it_mut(&mut square, 22); - | ^^^^^^^^^^^ expected an `FnMut<(&isize,)>` closure, found `for<'r> unsafe fn(&'r isize) -> isize {square}` + | ^^^^^^^^^^^ expected an `FnMut<(&isize,)>` closure, found `for<'r> unsafe fn(&'r isize) -> isize {square}` | = help: the trait `for<'r> std::ops::FnMut<(&'r isize,)>` is not implemented for `for<'r> unsafe fn(&'r isize) -> isize {square}` error[E0277]: expected a `std::ops::FnOnce<(&isize,)>` closure, found `for<'r> unsafe fn(&'r isize) -> isize {square}` - --> $DIR/unboxed-closures-unsafe-extern-fn.rs:18:13 + --> $DIR/unboxed-closures-unsafe-extern-fn.rs:18:25 | LL | fn call_it_mutisize>(_: &mut F, _: isize) -> isize { 0 } | -------------------------------------------------------------------- required by `call_it_mut` ... LL | let y = call_it_mut(&mut square, 22); - | ^^^^^^^^^^^ expected an `FnOnce<(&isize,)>` closure, found `for<'r> unsafe fn(&'r isize) -> isize {square}` + | ^^^^^^^^^^^ expected an `FnOnce<(&isize,)>` closure, found `for<'r> unsafe fn(&'r isize) -> isize {square}` | = help: the trait `std::ops::FnOnce<(&isize,)>` is not implemented for `for<'r> unsafe fn(&'r isize) -> isize {square}` error[E0277]: expected a `std::ops::FnOnce<(&isize,)>` closure, found `for<'r> unsafe fn(&'r isize) -> isize {square}` - --> $DIR/unboxed-closures-unsafe-extern-fn.rs:24:13 + --> $DIR/unboxed-closures-unsafe-extern-fn.rs:24:26 | LL | fn call_it_onceisize>(_: F, _: isize) -> isize { 0 } | ----------------------------------------------------------------- required by `call_it_once` ... LL | let z = call_it_once(square, 22); - | ^^^^^^^^^^^^ expected an `FnOnce<(&isize,)>` closure, found `for<'r> unsafe fn(&'r isize) -> isize {square}` + | ^^^^^^ expected an `FnOnce<(&isize,)>` closure, found `for<'r> unsafe fn(&'r isize) -> isize {square}` | = help: the trait `std::ops::FnOnce<(&isize,)>` is not implemented for `for<'r> unsafe fn(&'r isize) -> isize {square}` diff --git a/src/test/ui/unboxed-closures/unboxed-closures-wrong-abi.stderr b/src/test/ui/unboxed-closures/unboxed-closures-wrong-abi.stderr index f435a05e04901..7b393b35f298d 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-wrong-abi.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closures-wrong-abi.stderr @@ -1,55 +1,55 @@ error[E0277]: expected a `std::ops::Fn<(&isize,)>` closure, found `for<'r> extern "C" fn(&'r isize) -> isize {square}` - --> $DIR/unboxed-closures-wrong-abi.rs:12:13 + --> $DIR/unboxed-closures-wrong-abi.rs:12:21 | LL | fn call_itisize>(_: &F, _: isize) -> isize { 0 } | --------------------------------------------------------- required by `call_it` ... LL | let x = call_it(&square, 22); - | ^^^^^^^ expected an `Fn<(&isize,)>` closure, found `for<'r> extern "C" fn(&'r isize) -> isize {square}` + | ^^^^^^^ expected an `Fn<(&isize,)>` closure, found `for<'r> extern "C" fn(&'r isize) -> isize {square}` | = help: the trait `for<'r> std::ops::Fn<(&'r isize,)>` is not implemented for `for<'r> extern "C" fn(&'r isize) -> isize {square}` error[E0277]: expected a `std::ops::FnOnce<(&isize,)>` closure, found `for<'r> extern "C" fn(&'r isize) -> isize {square}` - --> $DIR/unboxed-closures-wrong-abi.rs:12:13 + --> $DIR/unboxed-closures-wrong-abi.rs:12:21 | LL | fn call_itisize>(_: &F, _: isize) -> isize { 0 } | --------------------------------------------------------- required by `call_it` ... LL | let x = call_it(&square, 22); - | ^^^^^^^ expected an `FnOnce<(&isize,)>` closure, found `for<'r> extern "C" fn(&'r isize) -> isize {square}` + | ^^^^^^^ expected an `FnOnce<(&isize,)>` closure, found `for<'r> extern "C" fn(&'r isize) -> isize {square}` | = help: the trait `std::ops::FnOnce<(&isize,)>` is not implemented for `for<'r> extern "C" fn(&'r isize) -> isize {square}` error[E0277]: expected a `std::ops::FnMut<(&isize,)>` closure, found `for<'r> extern "C" fn(&'r isize) -> isize {square}` - --> $DIR/unboxed-closures-wrong-abi.rs:18:13 + --> $DIR/unboxed-closures-wrong-abi.rs:18:25 | LL | fn call_it_mutisize>(_: &mut F, _: isize) -> isize { 0 } | -------------------------------------------------------------------- required by `call_it_mut` ... LL | let y = call_it_mut(&mut square, 22); - | ^^^^^^^^^^^ expected an `FnMut<(&isize,)>` closure, found `for<'r> extern "C" fn(&'r isize) -> isize {square}` + | ^^^^^^^^^^^ expected an `FnMut<(&isize,)>` closure, found `for<'r> extern "C" fn(&'r isize) -> isize {square}` | = help: the trait `for<'r> std::ops::FnMut<(&'r isize,)>` is not implemented for `for<'r> extern "C" fn(&'r isize) -> isize {square}` error[E0277]: expected a `std::ops::FnOnce<(&isize,)>` closure, found `for<'r> extern "C" fn(&'r isize) -> isize {square}` - --> $DIR/unboxed-closures-wrong-abi.rs:18:13 + --> $DIR/unboxed-closures-wrong-abi.rs:18:25 | LL | fn call_it_mutisize>(_: &mut F, _: isize) -> isize { 0 } | -------------------------------------------------------------------- required by `call_it_mut` ... LL | let y = call_it_mut(&mut square, 22); - | ^^^^^^^^^^^ expected an `FnOnce<(&isize,)>` closure, found `for<'r> extern "C" fn(&'r isize) -> isize {square}` + | ^^^^^^^^^^^ expected an `FnOnce<(&isize,)>` closure, found `for<'r> extern "C" fn(&'r isize) -> isize {square}` | = help: the trait `std::ops::FnOnce<(&isize,)>` is not implemented for `for<'r> extern "C" fn(&'r isize) -> isize {square}` error[E0277]: expected a `std::ops::FnOnce<(&isize,)>` closure, found `for<'r> extern "C" fn(&'r isize) -> isize {square}` - --> $DIR/unboxed-closures-wrong-abi.rs:24:13 + --> $DIR/unboxed-closures-wrong-abi.rs:24:26 | LL | fn call_it_onceisize>(_: F, _: isize) -> isize { 0 } | ----------------------------------------------------------------- required by `call_it_once` ... LL | let z = call_it_once(square, 22); - | ^^^^^^^^^^^^ expected an `FnOnce<(&isize,)>` closure, found `for<'r> extern "C" fn(&'r isize) -> isize {square}` + | ^^^^^^ expected an `FnOnce<(&isize,)>` closure, found `for<'r> extern "C" fn(&'r isize) -> isize {square}` | = help: the trait `std::ops::FnOnce<(&isize,)>` is not implemented for `for<'r> extern "C" fn(&'r isize) -> isize {square}` diff --git a/src/test/ui/unboxed-closures/unboxed-closures-wrong-arg-type-extern-fn.stderr b/src/test/ui/unboxed-closures/unboxed-closures-wrong-arg-type-extern-fn.stderr index efdb2e8efa4e8..68fc0d45b9a8c 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-wrong-arg-type-extern-fn.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closures-wrong-arg-type-extern-fn.stderr @@ -1,55 +1,55 @@ error[E0277]: expected a `std::ops::Fn<(&isize,)>` closure, found `unsafe fn(isize) -> isize {square}` - --> $DIR/unboxed-closures-wrong-arg-type-extern-fn.rs:13:13 + --> $DIR/unboxed-closures-wrong-arg-type-extern-fn.rs:13:21 | LL | fn call_itisize>(_: &F, _: isize) -> isize { 0 } | --------------------------------------------------------- required by `call_it` ... LL | let x = call_it(&square, 22); - | ^^^^^^^ expected an `Fn<(&isize,)>` closure, found `unsafe fn(isize) -> isize {square}` + | ^^^^^^^ expected an `Fn<(&isize,)>` closure, found `unsafe fn(isize) -> isize {square}` | = help: the trait `for<'r> std::ops::Fn<(&'r isize,)>` is not implemented for `unsafe fn(isize) -> isize {square}` error[E0277]: expected a `std::ops::FnOnce<(&isize,)>` closure, found `unsafe fn(isize) -> isize {square}` - --> $DIR/unboxed-closures-wrong-arg-type-extern-fn.rs:13:13 + --> $DIR/unboxed-closures-wrong-arg-type-extern-fn.rs:13:21 | LL | fn call_itisize>(_: &F, _: isize) -> isize { 0 } | --------------------------------------------------------- required by `call_it` ... LL | let x = call_it(&square, 22); - | ^^^^^^^ expected an `FnOnce<(&isize,)>` closure, found `unsafe fn(isize) -> isize {square}` + | ^^^^^^^ expected an `FnOnce<(&isize,)>` closure, found `unsafe fn(isize) -> isize {square}` | = help: the trait `std::ops::FnOnce<(&isize,)>` is not implemented for `unsafe fn(isize) -> isize {square}` error[E0277]: expected a `std::ops::FnMut<(&isize,)>` closure, found `unsafe fn(isize) -> isize {square}` - --> $DIR/unboxed-closures-wrong-arg-type-extern-fn.rs:19:13 + --> $DIR/unboxed-closures-wrong-arg-type-extern-fn.rs:19:25 | LL | fn call_it_mutisize>(_: &mut F, _: isize) -> isize { 0 } | -------------------------------------------------------------------- required by `call_it_mut` ... LL | let y = call_it_mut(&mut square, 22); - | ^^^^^^^^^^^ expected an `FnMut<(&isize,)>` closure, found `unsafe fn(isize) -> isize {square}` + | ^^^^^^^^^^^ expected an `FnMut<(&isize,)>` closure, found `unsafe fn(isize) -> isize {square}` | = help: the trait `for<'r> std::ops::FnMut<(&'r isize,)>` is not implemented for `unsafe fn(isize) -> isize {square}` error[E0277]: expected a `std::ops::FnOnce<(&isize,)>` closure, found `unsafe fn(isize) -> isize {square}` - --> $DIR/unboxed-closures-wrong-arg-type-extern-fn.rs:19:13 + --> $DIR/unboxed-closures-wrong-arg-type-extern-fn.rs:19:25 | LL | fn call_it_mutisize>(_: &mut F, _: isize) -> isize { 0 } | -------------------------------------------------------------------- required by `call_it_mut` ... LL | let y = call_it_mut(&mut square, 22); - | ^^^^^^^^^^^ expected an `FnOnce<(&isize,)>` closure, found `unsafe fn(isize) -> isize {square}` + | ^^^^^^^^^^^ expected an `FnOnce<(&isize,)>` closure, found `unsafe fn(isize) -> isize {square}` | = help: the trait `std::ops::FnOnce<(&isize,)>` is not implemented for `unsafe fn(isize) -> isize {square}` error[E0277]: expected a `std::ops::FnOnce<(&isize,)>` closure, found `unsafe fn(isize) -> isize {square}` - --> $DIR/unboxed-closures-wrong-arg-type-extern-fn.rs:25:13 + --> $DIR/unboxed-closures-wrong-arg-type-extern-fn.rs:25:26 | LL | fn call_it_onceisize>(_: F, _: isize) -> isize { 0 } | ----------------------------------------------------------------- required by `call_it_once` ... LL | let z = call_it_once(square, 22); - | ^^^^^^^^^^^^ expected an `FnOnce<(&isize,)>` closure, found `unsafe fn(isize) -> isize {square}` + | ^^^^^^ expected an `FnOnce<(&isize,)>` closure, found `unsafe fn(isize) -> isize {square}` | = help: the trait `std::ops::FnOnce<(&isize,)>` is not implemented for `unsafe fn(isize) -> isize {square}` diff --git a/src/test/ui/unsized3.stderr b/src/test/ui/unsized3.stderr index 9064aa14d429f..f381cacadf9c0 100644 --- a/src/test/ui/unsized3.stderr +++ b/src/test/ui/unsized3.stderr @@ -1,8 +1,8 @@ error[E0277]: the size for values of type `X` cannot be known at compilation time - --> $DIR/unsized3.rs:7:5 + --> $DIR/unsized3.rs:7:13 | LL | f2::(x); - | ^^^^^^^ doesn't have a size known at compile-time + | ^ doesn't have a size known at compile-time ... LL | fn f2(x: &X) { | --------------- required by `f2` @@ -12,10 +12,10 @@ LL | fn f2(x: &X) { = help: consider adding a `where X: std::marker::Sized` bound error[E0277]: the size for values of type `X` cannot be known at compilation time - --> $DIR/unsized3.rs:18:5 + --> $DIR/unsized3.rs:18:13 | LL | f4::(x); - | ^^^^^^^ doesn't have a size known at compile-time + | ^ doesn't have a size known at compile-time ... LL | fn f4(x: &X) { | ------------------ required by `f4` @@ -25,13 +25,13 @@ LL | fn f4(x: &X) { = help: consider adding a `where X: std::marker::Sized` bound error[E0277]: the size for values of type `X` cannot be known at compilation time - --> $DIR/unsized3.rs:33:5 + --> $DIR/unsized3.rs:33:8 | LL | fn f5(x: &Y) {} | --------------- required by `f5` ... LL | f5(x1); - | ^^ doesn't have a size known at compile-time + | ^^ doesn't have a size known at compile-time | = help: within `S`, the trait `std::marker::Sized` is not implemented for `X` = note: to learn more, visit @@ -39,10 +39,10 @@ LL | f5(x1); = note: required because it appears within the type `S` error[E0277]: the size for values of type `X` cannot be known at compilation time - --> $DIR/unsized3.rs:40:5 + --> $DIR/unsized3.rs:40:8 | LL | f5(&(*x1, 34)); - | ^^ doesn't have a size known at compile-time + | ^^^^^^^^^^ doesn't have a size known at compile-time | = help: within `S`, the trait `std::marker::Sized` is not implemented for `X` = note: to learn more, visit @@ -64,13 +64,13 @@ LL | f5(&(32, *x1)); = note: tuples must have a statically known size to be initialized error[E0277]: the size for values of type `X` cannot be known at compilation time - --> $DIR/unsized3.rs:45:5 + --> $DIR/unsized3.rs:45:8 | LL | fn f5(x: &Y) {} | --------------- required by `f5` ... LL | f5(&(32, *x1)); - | ^^ doesn't have a size known at compile-time + | ^^^^^^^^^^ doesn't have a size known at compile-time | = help: within `({integer}, S)`, the trait `std::marker::Sized` is not implemented for `X` = note: to learn more, visit diff --git a/src/test/ui/vtable-res-trait-param.stderr b/src/test/ui/vtable-res-trait-param.stderr index 58a88979b2faf..bff64813268ce 100644 --- a/src/test/ui/vtable-res-trait-param.stderr +++ b/src/test/ui/vtable-res-trait-param.stderr @@ -1,8 +1,8 @@ error[E0277]: the trait bound `{integer}: TraitA` is not satisfied - --> $DIR/vtable-res-trait-param.rs:17:7 + --> $DIR/vtable-res-trait-param.rs:17:18 | LL | b.gimme_an_a(y) - | ^^^^^^^^^^ the trait `TraitA` is not implemented for `{integer}` + | ^ the trait `TraitA` is not implemented for `{integer}` error: aborting due to previous error diff --git a/src/test/ui/where-clauses/where-clause-constraints-are-local-for-inherent-impl.stderr b/src/test/ui/where-clauses/where-clause-constraints-are-local-for-inherent-impl.stderr index f923c6798829f..118caf8cccec7 100644 --- a/src/test/ui/where-clauses/where-clause-constraints-are-local-for-inherent-impl.stderr +++ b/src/test/ui/where-clauses/where-clause-constraints-are-local-for-inherent-impl.stderr @@ -1,11 +1,11 @@ error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied - --> $DIR/where-clause-constraints-are-local-for-inherent-impl.rs:13:9 + --> $DIR/where-clause-constraints-are-local-for-inherent-impl.rs:13:22 | LL | fn require_copy(x: T) {} | ------------------------------ required by `require_copy` ... LL | require_copy(self.x); - | ^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `T` + | ^^^^^^ the trait `std::marker::Copy` is not implemented for `T` | = help: consider adding a `where T: std::marker::Copy` bound diff --git a/src/test/ui/where-clauses/where-clause-constraints-are-local-for-trait-impl.stderr b/src/test/ui/where-clauses/where-clause-constraints-are-local-for-trait-impl.stderr index 32736836ef8a3..d1cb4e1cc7d1d 100644 --- a/src/test/ui/where-clauses/where-clause-constraints-are-local-for-trait-impl.stderr +++ b/src/test/ui/where-clauses/where-clause-constraints-are-local-for-trait-impl.stderr @@ -1,11 +1,11 @@ error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied - --> $DIR/where-clause-constraints-are-local-for-trait-impl.rs:18:9 + --> $DIR/where-clause-constraints-are-local-for-trait-impl.rs:18:22 | LL | fn require_copy(x: T) {} | ------------------------------ required by `require_copy` ... LL | require_copy(self.x); - | ^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `T` + | ^^^^^^ the trait `std::marker::Copy` is not implemented for `T` | = help: consider adding a `where T: std::marker::Copy` bound diff --git a/src/test/ui/where-clauses/where-clauses-method-unsatisfied.stderr b/src/test/ui/where-clauses/where-clauses-method-unsatisfied.stderr index 60bcba09e976c..6fd38728777e4 100644 --- a/src/test/ui/where-clauses/where-clauses-method-unsatisfied.stderr +++ b/src/test/ui/where-clauses/where-clauses-method-unsatisfied.stderr @@ -1,8 +1,8 @@ error[E0277]: the trait bound `Bar: std::cmp::Eq` is not satisfied - --> $DIR/where-clauses-method-unsatisfied.rs:18:7 + --> $DIR/where-clauses-method-unsatisfied.rs:18:14 | LL | x.equals(&x); - | ^^^^^^ the trait `std::cmp::Eq` is not implemented for `Bar` + | ^^ the trait `std::cmp::Eq` is not implemented for `Bar` error: aborting due to previous error