diff options
Diffstat (limited to 'src')
212 files changed, 2369 insertions, 1135 deletions
diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs index 5604e14f2d5..789267aa880 100644 --- a/src/bootstrap/builder.rs +++ b/src/bootstrap/builder.rs @@ -377,6 +377,8 @@ impl<'a> Builder<'a> { check::Rustdoc, check::CodegenBackend, check::Clippy, + check::Miri, + check::Rls, check::Bootstrap ), Kind::Test => describe!( diff --git a/src/bootstrap/check.rs b/src/bootstrap/check.rs index 8561a2a39b8..3e9d921d0f5 100644 --- a/src/bootstrap/check.rs +++ b/src/bootstrap/check.rs @@ -289,7 +289,8 @@ macro_rules! tool_check_step { impl Step for $name { type Output = (); const ONLY_HOSTS: bool = true; - const DEFAULT: bool = true $( && $default )?; + // don't ever check out-of-tree tools by default, they'll fail when toolstate is broken + const DEFAULT: bool = matches!($source_type, SourceType::InTree) $( && $default )?; fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> { run.paths(&[ $path, $($alias),* ]) @@ -367,6 +368,8 @@ tool_check_step!(Rustdoc, "src/tools/rustdoc", "src/librustdoc", SourceType::InT // behavior, treat it as in-tree so that any new warnings in clippy will be // rejected. tool_check_step!(Clippy, "src/tools/clippy", SourceType::InTree); +tool_check_step!(Miri, "src/tools/miri", SourceType::Submodule); +tool_check_step!(Rls, "src/tools/rls", SourceType::Submodule); tool_check_step!(Bootstrap, "src/bootstrap", SourceType::InTree, false); diff --git a/src/bootstrap/compile.rs b/src/bootstrap/compile.rs index 66a88e85fea..2676b3bf8e0 100644 --- a/src/bootstrap/compile.rs +++ b/src/bootstrap/compile.rs @@ -648,6 +648,7 @@ pub fn rustc_cargo_env(builder: &Builder<'_>, cargo: &mut Cargo, target: TargetS } if builder.config.rustc_parallel { cargo.rustflag("--cfg=parallel_compiler"); + cargo.rustdocflag("--cfg=parallel_compiler"); } if builder.config.rust_verify_llvm_ir { cargo.env("RUSTC_VERIFY_LLVM_IR", "1"); diff --git a/src/bootstrap/doc.rs b/src/bootstrap/doc.rs index a32b92ef1af..326a6fdaa80 100644 --- a/src/bootstrap/doc.rs +++ b/src/bootstrap/doc.rs @@ -549,6 +549,7 @@ impl Step for Rustc { cargo.rustdocflag("--enable-index-page"); cargo.rustdocflag("-Zunstable-options"); cargo.rustdocflag("-Znormalize-docs"); + cargo.rustdocflag("--show-type-layout"); compile::rustc_cargo(builder, &mut cargo, target); // Only include compiler crates, no dependencies of those, such as `libc`. @@ -648,6 +649,7 @@ impl Step for Rustdoc { cargo.rustdocflag("--document-private-items"); cargo.rustdocflag("--enable-index-page"); + cargo.rustdocflag("--show-type-layout"); cargo.rustdocflag("-Zunstable-options"); builder.run(&mut cargo.into()); } diff --git a/src/bootstrap/flags.rs b/src/bootstrap/flags.rs index d961e067db3..80a60c79edf 100644 --- a/src/bootstrap/flags.rs +++ b/src/bootstrap/flags.rs @@ -91,6 +91,7 @@ pub enum Subcommand { paths: Vec<PathBuf>, }, Format { + paths: Vec<PathBuf>, check: bool, }, Doc { @@ -581,7 +582,7 @@ Arguments: Subcommand::Clean { all: matches.opt_present("all") } } - "fmt" => Subcommand::Format { check: matches.opt_present("check") }, + "fmt" => Subcommand::Format { check: matches.opt_present("check"), paths }, "dist" => Subcommand::Dist { paths }, "install" => Subcommand::Install { paths }, "run" | "r" => { diff --git a/src/bootstrap/format.rs b/src/bootstrap/format.rs index d21e3408144..2408344487b 100644 --- a/src/bootstrap/format.rs +++ b/src/bootstrap/format.rs @@ -42,7 +42,7 @@ struct RustfmtConfig { ignore: Vec<String>, } -pub fn format(build: &Build, check: bool) { +pub fn format(build: &Build, check: bool, paths: &[PathBuf]) { if build.config.dry_run { return; } @@ -118,8 +118,19 @@ pub fn format(build: &Build, check: bool) { .to_path_buf(); let src = build.src.clone(); let (tx, rx): (SyncSender<PathBuf>, _) = std::sync::mpsc::sync_channel(128); - let walker = - WalkBuilder::new(src.clone()).types(matcher).overrides(ignore_fmt).build_parallel(); + let walker = match paths.get(0) { + Some(first) => { + let mut walker = WalkBuilder::new(first); + for path in &paths[1..] { + walker.add(path); + } + walker + } + None => WalkBuilder::new(src.clone()), + } + .types(matcher) + .overrides(ignore_fmt) + .build_parallel(); // there is a lot of blocking involved in spawning a child process and reading files to format. // spawn more processes than available concurrency to keep the CPU busy diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs index 24da44b933a..2960dd3df6b 100644 --- a/src/bootstrap/lib.rs +++ b/src/bootstrap/lib.rs @@ -478,8 +478,8 @@ impl Build { job::setup(self); } - if let Subcommand::Format { check } = self.config.cmd { - return format::format(self, check); + if let Subcommand::Format { check, paths } = &self.config.cmd { + return format::format(self, *check, &paths); } if let Subcommand::Clean { all } = self.config.cmd { diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs index df467bebe74..78163651158 100644 --- a/src/bootstrap/test.rs +++ b/src/bootstrap/test.rs @@ -889,7 +889,7 @@ help: to skip test's attempt to check tidiness, pass `--exclude src/tools/tidy` ); std::process::exit(1); } - crate::format::format(&builder.build, !builder.config.cmd.bless()); + crate::format::format(&builder.build, !builder.config.cmd.bless(), &[]); } } diff --git a/src/ci/pgo.sh b/src/ci/pgo.sh index ad2a8c771de..c3c717266db 100755 --- a/src/ci/pgo.sh +++ b/src/ci/pgo.sh @@ -12,7 +12,7 @@ RUSTC_BOOTSTRAP=1 ./build/$PGO_HOST/stage2/bin/rustc --edition=2018 \ # Download and build a single-file stress test benchmark on perf.rust-lang.org. function pgo_perf_benchmark { - local PERF=9442def56a39d742bf27ebcc3e0614cf117e1bc2 + local PERF=1e19fc4c6168d2f7596e512f42f358f245d8f09d local github_prefix=https://raw.githubusercontent.com/rust-lang/rustc-perf/$PERF local name=$1 curl -o /tmp/$name.rs $github_prefix/collector/benchmarks/$name/src/lib.rs diff --git a/src/doc/unstable-book/src/language-features/const-fn.md b/src/doc/unstable-book/src/language-features/const-fn.md deleted file mode 100644 index bcf7f78b8fe..00000000000 --- a/src/doc/unstable-book/src/language-features/const-fn.md +++ /dev/null @@ -1,10 +0,0 @@ -# `const_fn` - -The tracking issue for this feature is: [#57563] - -[#57563]: https://github.com/rust-lang/rust/issues/57563 - ------------------------- - -The `const_fn` feature enables additional functionality not stabilized in the -[minimal subset of `const_fn`](https://github.com/rust-lang/rust/issues/53555) diff --git a/src/librustdoc/clean/types.rs b/src/librustdoc/clean/types.rs index 33aa42b137a..bca7a8cfcee 100644 --- a/src/librustdoc/clean/types.rs +++ b/src/librustdoc/clean/types.rs @@ -1606,7 +1606,6 @@ impl Type { } } RawPointer(..) => Some(PrimitiveType::RawPointer), - BorrowedRef { type_: box Generic(..), .. } => Some(PrimitiveType::Reference), BareFunction(..) => Some(PrimitiveType::Fn), Never => Some(PrimitiveType::Never), _ => None, @@ -1665,13 +1664,7 @@ impl Type { } crate fn is_primitive(&self) -> bool { - match self { - Self::Primitive(_) => true, - Self::BorrowedRef { ref type_, .. } | Self::RawPointer(_, ref type_) => { - type_.is_primitive() - } - _ => false, - } + self.primitive_type().is_some() } crate fn projection(&self) -> Option<(&Type, DefId, Symbol)> { diff --git a/src/librustdoc/config.rs b/src/librustdoc/config.rs index 48eb14ed291..b75e98ae16c 100644 --- a/src/librustdoc/config.rs +++ b/src/librustdoc/config.rs @@ -7,10 +7,7 @@ use std::str::FromStr; use rustc_data_structures::fx::FxHashMap; use rustc_session::config::{self, parse_crate_types_from_list, parse_externs, CrateType}; -use rustc_session::config::{ - build_codegen_options, build_debugging_options, get_cmd_lint_options, host_triple, - nightly_options, -}; +use rustc_session::config::{get_cmd_lint_options, host_triple, nightly_options}; use rustc_session::config::{CodegenOptions, DebuggingOptions, ErrorOutputType, Externs}; use rustc_session::getopts; use rustc_session::lint::Level; @@ -270,6 +267,8 @@ crate struct RenderOptions { crate document_hidden: bool, /// If `true`, generate a JSON file in the crate folder instead of HTML redirection files. crate generate_redirect_map: bool, + /// Show the memory layout of types in the docs. + crate show_type_layout: bool, crate unstable_features: rustc_feature::UnstableFeatures, crate emit: Vec<EmitType>, } @@ -360,8 +359,8 @@ impl Options { config::parse_json(&matches); let error_format = config::parse_error_format(&matches, color, json_rendered); - let codegen_options = build_codegen_options(matches, error_format); - let debugging_opts = build_debugging_options(matches, error_format); + let codegen_options = CodegenOptions::build(matches, error_format); + let debugging_opts = DebuggingOptions::build(matches, error_format); let diag = new_handler(error_format, None, &debugging_opts); @@ -639,6 +638,7 @@ impl Options { let document_hidden = matches.opt_present("document-hidden-items"); let run_check = matches.opt_present("check"); let generate_redirect_map = matches.opt_present("generate-redirect-map"); + let show_type_layout = matches.opt_present("show-type-layout"); let (lint_opts, describe_lints, lint_cap) = get_cmd_lint_options(matches, error_format); @@ -698,6 +698,7 @@ impl Options { document_private, document_hidden, generate_redirect_map, + show_type_layout, unstable_features: rustc_feature::UnstableFeatures::from_environment( crate_name.as_deref(), ), diff --git a/src/librustdoc/doctest.rs b/src/librustdoc/doctest.rs index e563889f776..03e3fe52f71 100644 --- a/src/librustdoc/doctest.rs +++ b/src/librustdoc/doctest.rs @@ -76,7 +76,6 @@ crate fn run(options: Options) -> Result<(), ErrorReported> { externs: options.externs.clone(), unstable_features: options.render_options.unstable_features, actually_rustdoc: true, - debugging_opts: config::DebuggingOptions { ..config::basic_debugging_options() }, edition: options.edition, target_triple: options.target.clone(), crate_name: options.crate_name.clone(), diff --git a/src/librustdoc/html/highlight.rs b/src/librustdoc/html/highlight.rs index f631f627fc2..51392ca1191 100644 --- a/src/librustdoc/html/highlight.rs +++ b/src/librustdoc/html/highlight.rs @@ -24,6 +24,7 @@ crate fn render_with_highlighting( playground_button: Option<&str>, tooltip: Option<(Option<Edition>, &str)>, edition: Edition, + extra_content: Option<Buffer>, ) { debug!("highlighting: ================\n{}\n==============", src); if let Some((edition_info, class)) = tooltip { @@ -39,13 +40,21 @@ crate fn render_with_highlighting( ); } - write_header(out, class); + write_header(out, class, extra_content); write_code(out, &src, edition); write_footer(out, playground_button); } -fn write_header(out: &mut Buffer, class: Option<&str>) { - writeln!(out, "<div class=\"example-wrap\"><pre class=\"rust {}\">", class.unwrap_or_default()); +fn write_header(out: &mut Buffer, class: Option<&str>, extra_content: Option<Buffer>) { + write!(out, "<div class=\"example-wrap\">"); + if let Some(extra) = extra_content { + out.push_buffer(extra); + } + if let Some(class) = class { + writeln!(out, "<pre class=\"rust {}\">", class); + } else { + writeln!(out, "<pre class=\"rust\">"); + } } fn write_code(out: &mut Buffer, src: &str, edition: Edition) { diff --git a/src/librustdoc/html/layout.rs b/src/librustdoc/html/layout.rs index dc29add9333..99e96fdcf1e 100644 --- a/src/librustdoc/html/layout.rs +++ b/src/librustdoc/html/layout.rs @@ -34,6 +34,12 @@ crate struct Page<'a> { crate static_extra_scripts: &'a [&'a str], } +impl<'a> Page<'a> { + crate fn get_static_root_path(&self) -> &str { + self.static_root_path.unwrap_or(self.root_path) + } +} + crate fn render<T: Print, S: Print>( layout: &Layout, page: &Page<'_>, @@ -41,7 +47,7 @@ crate fn render<T: Print, S: Print>( t: T, style_files: &[StylePath], ) -> String { - let static_root_path = page.static_root_path.unwrap_or(page.root_path); + let static_root_path = page.get_static_root_path(); format!( "<!DOCTYPE html>\ <html lang=\"en\">\ diff --git a/src/librustdoc/html/markdown.rs b/src/librustdoc/html/markdown.rs index 509f1730557..c2b40ab34e2 100644 --- a/src/librustdoc/html/markdown.rs +++ b/src/librustdoc/html/markdown.rs @@ -315,6 +315,7 @@ impl<'a, I: Iterator<Item = Event<'a>>> Iterator for CodeBlocks<'_, 'a, I> { playground_button.as_deref(), tooltip, edition, + None, ); Some(Event::Html(s.into_inner().into())) } diff --git a/src/librustdoc/html/render/context.rs b/src/librustdoc/html/render/context.rs index e0c1fd06e7b..666d9dfc3e9 100644 --- a/src/librustdoc/html/render/context.rs +++ b/src/librustdoc/html/render/context.rs @@ -91,6 +91,8 @@ crate struct SharedContext<'tcx> { crate include_sources: bool, /// The local file sources we've emitted and their respective url-paths. crate local_sources: FxHashMap<PathBuf, String>, + /// Show the memory layout of types in the docs. + pub(super) show_type_layout: bool, /// Whether the collapsed pass ran collapsed: bool, /// The base-URL of the issue tracker for when an item has been tagged with @@ -215,7 +217,7 @@ impl<'tcx> Context<'tcx> { &self.shared.layout, &page, |buf: &mut _| print_sidebar(self, it, buf), - |buf: &mut _| print_item(self, it, buf), + |buf: &mut _| print_item(self, it, buf, &page), &self.shared.style_files, ) } else { @@ -373,6 +375,7 @@ impl<'tcx> FormatRenderer<'tcx> for Context<'tcx> { generate_search_filter, unstable_features, generate_redirect_map, + show_type_layout, .. } = options; @@ -446,6 +449,7 @@ impl<'tcx> FormatRenderer<'tcx> for Context<'tcx> { all: RefCell::new(AllTypes::new()), errors: receiver, redirections: if generate_redirect_map { Some(Default::default()) } else { None }, + show_type_layout, }; // Add the default themes to the `Vec` of stylepaths diff --git a/src/librustdoc/html/render/print_item.rs b/src/librustdoc/html/render/print_item.rs index 4b7664f28a1..f0ca24b8f02 100644 --- a/src/librustdoc/html/render/print_item.rs +++ b/src/librustdoc/html/render/print_item.rs @@ -7,6 +7,7 @@ use rustc_hir as hir; use rustc_hir::def::CtorKind; use rustc_hir::def_id::DefId; use rustc_middle::middle::stability; +use rustc_middle::ty::layout::LayoutError; use rustc_middle::ty::TyCtxt; use rustc_span::hygiene::MacroKind; use rustc_span::symbol::{kw, sym, Symbol}; @@ -22,9 +23,10 @@ use crate::formats::{AssocItemRender, Impl, RenderMode}; use crate::html::escape::Escape; use crate::html::format::{print_abi_with_space, print_where_clause, Buffer, PrintWithSpace}; use crate::html::highlight; +use crate::html::layout::Page; use crate::html::markdown::MarkdownSummaryLine; -pub(super) fn print_item(cx: &Context<'_>, item: &clean::Item, buf: &mut Buffer) { +pub(super) fn print_item(cx: &Context<'_>, item: &clean::Item, buf: &mut Buffer, page: &Page<'_>) { debug_assert!(!item.is_stripped()); // Write the breadcrumb trail header for the top buf.write_str("<h1 class=\"fqn\"><span class=\"in-band\">"); @@ -74,7 +76,16 @@ pub(super) fn print_item(cx: &Context<'_>, item: &clean::Item, buf: &mut Buffer) } } write!(buf, "<a class=\"{}\" href=\"\">{}</a>", item.type_(), item.name.as_ref().unwrap()); - write!(buf, "<button id=\"copy-path\" onclick=\"copy_path(this)\">⎘</button>"); + write!( + buf, + "<button id=\"copy-path\" onclick=\"copy_path(this)\">\ + <img src=\"{static_root_path}clipboard{suffix}.svg\" \ + width=\"19\" height=\"18\" \ + alt=\"Copy item import\">\ + </button>", + static_root_path = page.get_static_root_path(), + suffix = page.resource_suffix, + ); buf.write_str("</span>"); // in-band buf.write_str("<span class=\"out-of-band\">"); @@ -820,11 +831,12 @@ fn item_typedef(w: &mut Buffer, cx: &Context<'_>, it: &clean::Item, t: &clean::T document(w, cx, it, None); + let def_id = it.def_id.expect_real(); // Render any items associated directly to this alias, as otherwise they // won't be visible anywhere in the docs. It would be nice to also show // associated items from the aliased type (see discussion in #32077), but // we need #14072 to make sense of the generics. - render_assoc_items(w, cx, it, it.def_id.expect_real(), AssocItemRender::All) + render_assoc_items(w, cx, it, def_id, AssocItemRender::All); } fn item_union(w: &mut Buffer, cx: &Context<'_>, it: &clean::Item, s: &clean::Union) { @@ -836,6 +848,7 @@ fn item_union(w: &mut Buffer, cx: &Context<'_>, it: &clean::Item, s: &clean::Uni }); document(w, cx, it, None); + let mut fields = s .fields .iter() @@ -870,7 +883,9 @@ fn item_union(w: &mut Buffer, cx: &Context<'_>, it: &clean::Item, s: &clean::Uni document(w, cx, field, Some(it)); } } - render_assoc_items(w, cx, it, it.def_id.expect_real(), AssocItemRender::All) + let def_id = it.def_id.expect_real(); + render_assoc_items(w, cx, it, def_id, AssocItemRender::All); + document_type_layout(w, cx, def_id); } fn item_enum(w: &mut Buffer, cx: &Context<'_>, it: &clean::Item, e: &clean::Enum) { @@ -930,6 +945,7 @@ fn item_enum(w: &mut Buffer, cx: &Context<'_>, it: &clean::Item, e: &clean::Enum }); document(w, cx, it, None); + if !e.variants.is_empty() { write!( w, @@ -1004,7 +1020,9 @@ fn item_enum(w: &mut Buffer, cx: &Context<'_>, it: &clean::Item, e: &clean::Enum render_stability_since(w, variant, it, cx.tcx()); } } - render_assoc_items(w, cx, it, it.def_id.expect_real(), AssocItemRender::All) + let def_id = it.def_id.expect_real(); + render_assoc_items(w, cx, it, def_id, AssocItemRender::All); + document_type_layout(w, cx, def_id); } fn item_macro(w: &mut Buffer, cx: &Context<'_>, it: &clean::Item, t: &clean::Macro) { @@ -1016,6 +1034,7 @@ fn item_macro(w: &mut Buffer, cx: &Context<'_>, it: &clean::Item, t: &clean::Mac None, None, it.span(cx.tcx()).inner().edition(), + None, ); }); document(w, cx, it, None) @@ -1103,6 +1122,7 @@ fn item_struct(w: &mut Buffer, cx: &Context<'_>, it: &clean::Item, s: &clean::St }); document(w, cx, it, None); + let mut fields = s .fields .iter() @@ -1141,7 +1161,9 @@ fn item_struct(w: &mut Buffer, cx: &Context<'_>, it: &clean::Item, s: &clean::St } } } - render_assoc_items(w, cx, it, it.def_id.expect_real(), AssocItemRender::All) + let def_id = it.def_id.expect_real(); + render_assoc_items(w, cx, it, def_id, AssocItemRender::All); + document_type_layout(w, cx, def_id); } fn item_static(w: &mut Buffer, cx: &Context<'_>, it: &clean::Item, s: &clean::Static) { @@ -1511,3 +1533,62 @@ fn document_non_exhaustive(w: &mut Buffer, item: &clean::Item) { w.write_str("</div></details>"); } } + +fn document_type_layout(w: &mut Buffer, cx: &Context<'_>, ty_def_id: DefId) { + if !cx.shared.show_type_layout { + return; + } + + writeln!(w, "<h2 class=\"small-section-header\">Layout</h2>"); + writeln!(w, "<div class=\"docblock\">"); + + let tcx = cx.tcx(); + let param_env = tcx.param_env(ty_def_id); + let ty = tcx.type_of(ty_def_id); + match tcx.layout_of(param_env.and(ty)) { + Ok(ty_layout) => { + writeln!( + w, + "<div class=\"warning\"><p><strong>Note:</strong> Most layout information is \ + completely unstable and may be different between compiler versions and platforms. \ + The only exception is types with certain <code>repr(...)</code> attributes. \ + Please see the Rust Reference’s \ + <a href=\"https://doc.rust-lang.org/reference/type-layout.html\">“Type Layout”</a> \ + chapter for details on type layout guarantees.</p></div>" + ); + if ty_layout.layout.abi.is_unsized() { + writeln!(w, "<p><strong>Size:</strong> (unsized)</p>"); + } else { + let bytes = ty_layout.layout.size.bytes(); + writeln!( + w, + "<p><strong>Size:</strong> {size} byte{pl}</p>", + size = bytes, + pl = if bytes == 1 { "" } else { "s" }, + ); + } + } + // This kind of layout error can occur with valid code, e.g. if you try to + // get the layout of a generic type such as `Vec<T>`. + Err(LayoutError::Unknown(_)) => { + writeln!( + w, + "<p><strong>Note:</strong> Unable to compute type layout, \ + possibly due to this type having generic parameters. \ + Layout can only be computed for concrete, fully-instantiated types.</p>" + ); + } + // This kind of error probably can't happen with valid code, but we don't + // want to panic and prevent the docs from building, so we just let the + // user know that we couldn't compute the layout. + Err(LayoutError::SizeOverflow(_)) => { + writeln!( + w, + "<p><strong>Note:</strong> Encountered an error during type layout; \ + the type was too big.</p>" + ); + } + } + + writeln!(w, "</div>"); +} diff --git a/src/librustdoc/html/render/write_shared.rs b/src/librustdoc/html/render/write_shared.rs index c493801d990..d0518cb6862 100644 --- a/src/librustdoc/html/render/write_shared.rs +++ b/src/librustdoc/html/render/write_shared.rs @@ -207,6 +207,7 @@ pub(super) fn write_shared( } write_toolchain("brush.svg", static_files::BRUSH_SVG)?; write_toolchain("wheel.svg", static_files::WHEEL_SVG)?; + write_toolchain("clipboard.svg", static_files::CLIPBOARD_SVG)?; write_toolchain("down-arrow.svg", static_files::DOWN_ARROW_SVG)?; let mut themes: Vec<&String> = themes.iter().collect(); diff --git a/src/librustdoc/html/sources.rs b/src/librustdoc/html/sources.rs index 14e2d65d94e..57c33f94918 100644 --- a/src/librustdoc/html/sources.rs +++ b/src/librustdoc/html/sources.rs @@ -169,16 +169,17 @@ where /// adding line numbers to the left-hand side. fn print_src(buf: &mut Buffer, s: &str, edition: Edition) { let lines = s.lines().count(); + let mut line_numbers = Buffer::empty_from(buf); let mut cols = 0; let mut tmp = lines; while tmp > 0 { cols += 1; tmp /= 10; } - buf.write_str("<pre class=\"line-numbers\">"); + line_numbers.write_str("<pre class=\"line-numbers\">"); for i in 1..=lines { - writeln!(buf, "<span id=\"{0}\">{0:1$}</span>", i, cols); + writeln!(line_numbers, "<span id=\"{0}\">{0:1$}</span>", i, cols); } - buf.write_str("</pre>"); - highlight::render_with_highlighting(s, buf, None, None, None, edition); + line_numbers.write_str("</pre>"); + highlight::render_with_highlighting(s, buf, None, None, None, edition, Some(line_numbers)); } diff --git a/src/librustdoc/html/static/clipboard.svg b/src/librustdoc/html/static/clipboard.svg new file mode 100644 index 00000000000..8adbd996304 --- /dev/null +++ b/src/librustdoc/html/static/clipboard.svg @@ -0,0 +1 @@ +<svg width="24" height="25" viewBox="0 0 24 25" xmlns="http://www.w3.org/2000/svg" aria-label="Copy to clipboard"><path d="M18 20h2v3c0 1-1 2-2 2H2c-.998 0-2-1-2-2V5c0-.911.755-1.667 1.667-1.667h5A3.323 3.323 0 0110 0a3.323 3.323 0 013.333 3.333h5C19.245 3.333 20 4.09 20 5v8.333h-2V9H2v14h16v-3zM3 7h14c0-.911-.793-1.667-1.75-1.667H13.5c-.957 0-1.75-.755-1.75-1.666C11.75 2.755 10.957 2 10 2s-1.75.755-1.75 1.667c0 .911-.793 1.666-1.75 1.666H4.75C3.793 5.333 3 6.09 3 7z"/><path d="M4 19h6v2H4zM12 11H4v2h8zM4 17h4v-2H4zM15 15v-3l-4.5 4.5L15 21v-3l8.027-.032L23 15z"/></svg> diff --git a/src/librustdoc/html/static/main.js b/src/librustdoc/html/static/main.js index a03d20c053d..04dc25341f4 100644 --- a/src/librustdoc/html/static/main.js +++ b/src/librustdoc/html/static/main.js @@ -448,14 +448,14 @@ function hideThemeButtonState() { } function getHelpElement(build) { - if (build !== false) { + if (build) { buildHelperPopup(); } return document.getElementById("help"); } function displayHelp(display, ev, help) { - if (display === true) { + if (display) { help = help ? help : getHelpElement(true); if (hasClass(help, "hidden")) { ev.preventDefault(); @@ -466,7 +466,7 @@ function hideThemeButtonState() { // No need to build the help popup if we want to hide it in case it hasn't been // built yet... help = help ? help : getHelpElement(false); - if (help && hasClass(help, "hidden") === false) { + if (help && !hasClass(help, "hidden")) { ev.preventDefault(); addClass(help, "hidden"); removeClass(document.body, "blur"); @@ -477,9 +477,9 @@ function hideThemeButtonState() { function handleEscape(ev) { var help = getHelpElement(false); var search = searchState.outputElement(); - if (hasClass(help, "hidden") === false) { + if (!hasClass(help, "hidden")) { displayHelp(false, ev, help); - } else if (hasClass(search, "hidden") === false) { + } else if (!hasClass(search, "hidden")) { searchState.clearInputTimeout(); ev.preventDefault(); searchState.hideResults(search); @@ -491,7 +491,7 @@ function hideThemeButtonState() { var disableShortcuts = getSettingValue("disable-shortcuts") === "true"; function handleShortcut(ev) { // Don't interfere with browser shortcuts - if (ev.ctrlKey || ev.altKey || ev.metaKey || disableShortcuts === true) { + if (ev.ctrlKey || ev.altKey || ev.metaKey || disableShortcuts) { return; } @@ -908,11 +908,11 @@ function hideThemeButtonState() { function implHider(addOrRemove, fullHide) { return function(n) { var shouldHide = - fullHide === true || - hasClass(n, "method") === true || - hasClass(n, "associatedconstant") === true; - if (shouldHide === true || hasClass(n, "type") === true) { - if (shouldHide === true) { + fullHide || + hasClass(n, "method") || + hasClass(n, "associatedconstant"); + if (shouldHide || hasClass(n, "type")) { + if (shouldHide) { if (addOrRemove) { addClass(n, "hidden-by-impl-hider"); } else { @@ -934,7 +934,7 @@ function hideThemeButtonState() { var relatedDoc; var action = mode; - if (hasClass(toggle.parentNode, "impl") === false) { + if (!hasClass(toggle.parentNode, "impl")) { relatedDoc = toggle.parentNode.nextElementSibling; if (hasClass(relatedDoc, "item-info")) { relatedDoc = relatedDoc.nextElementSibling; @@ -964,11 +964,11 @@ function hideThemeButtonState() { relatedDoc = parentElem; var docblock = relatedDoc.nextElementSibling; - while (hasClass(relatedDoc, "impl-items") === false) { + while (!hasClass(relatedDoc, "impl-items")) { relatedDoc = relatedDoc.nextElementSibling; } - if (!relatedDoc && hasClass(docblock, "docblock") === false) { + if (!relatedDoc && !hasClass(docblock, "docblock")) { return; } @@ -987,7 +987,7 @@ function hideThemeButtonState() { if (action === "show") { removeClass(relatedDoc, "fns-now-collapsed"); // Stability/deprecation/portability information is never hidden. - if (hasClass(docblock, "item-info") === false) { + if (!hasClass(docblock, "item-info")) { removeClass(docblock, "hidden-by-usual-hider"); } onEachLazy(toggle.childNodes, adjustToggle(false, dontApplyBlockRule)); @@ -996,7 +996,7 @@ function hideThemeButtonState() { addClass(relatedDoc, "fns-now-collapsed"); // Stability/deprecation/portability information should be shown even when detailed // info is hidden. - if (hasClass(docblock, "item-info") === false) { + if (!hasClass(docblock, "item-info")) { addClass(docblock, "hidden-by-usual-hider"); } onEachLazy(toggle.childNodes, adjustToggle(true, dontApplyBlockRule)); @@ -1045,7 +1045,7 @@ function hideThemeButtonState() { }); } - if (hideMethodDocs === true) { + if (hideMethodDocs) { onEachLazy(document.getElementsByClassName("method"), function(e) { var toggle = e.parentNode; if (toggle) { @@ -1132,7 +1132,7 @@ function hideThemeButtonState() { if (sidebar_menu) { sidebar_menu.onclick = function() { var sidebar = document.getElementsByClassName("sidebar")[0]; - if (hasClass(sidebar, "mobile") === true) { + if (hasClass(sidebar, "mobile")) { hideSidebar(); } else { showSidebar(); @@ -1252,15 +1252,31 @@ function hideThemeButtonState() { document.execCommand('copy'); document.body.removeChild(el); - but.textContent = '✓'; + // There is always one children, but multiple childNodes. + but.children[0].style.display = 'none'; + + var tmp; + if (but.childNodes.length < 2) { + tmp = document.createTextNode('✓'); + but.appendChild(tmp); + } else { + onEachLazy(but.childNodes, function(e) { + if (e.nodeType === Node.TEXT_NODE) { + tmp = e; + return true; + } + }); + tmp.textContent = '✓'; + } if (reset_button_timeout !== null) { window.clearTimeout(reset_button_timeout); } function reset_button() { - but.textContent = '⎘'; + tmp.textContent = ''; reset_button_timeout = null; + but.children[0].style.display = ""; } reset_button_timeout = window.setTimeout(reset_button, 1000); diff --git a/src/librustdoc/html/static/rustdoc.css b/src/librustdoc/html/static/rustdoc.css index 42a85fcce03..aaa2525644f 100644 --- a/src/librustdoc/html/static/rustdoc.css +++ b/src/librustdoc/html/static/rustdoc.css @@ -206,7 +206,6 @@ li { max-width: none; overflow: visible; margin-left: 0px; - min-width: 70em; } nav.sub { @@ -357,7 +356,7 @@ nav.sub { padding-left: 0; } -.rustdoc:not(.source) .example-wrap { +.rustdoc .example-wrap { display: inline-flex; margin-bottom: 10px; } @@ -370,8 +369,6 @@ nav.sub { .example-wrap > pre.line-number { overflow: initial; border: 1px solid; - border-top-left-radius: 5px; - border-bottom-left-radius: 5px; padding: 13px 8px; text-align: right; } @@ -381,7 +378,7 @@ nav.sub { overflow-x: auto; } -.rustdoc:not(.source) .example-wrap > pre { +.rustdoc .example-wrap > pre { margin: 0; } @@ -395,15 +392,14 @@ nav.sub { table-layout: fixed; } -.content pre.line-numbers { - float: left; - border: none; +.content > .example-wrap pre.line-numbers { position: relative; - -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; + border-top-left-radius: 5px; + border-bottom-left-radius: 5px; } .line-numbers span { cursor: pointer; @@ -1321,11 +1317,12 @@ h4 > .notable-traits { } #copy-path { - height: 30px; - font-size: 18px; margin-left: 10px; - padding: 0 6px; - width: 28px; + padding: 0; + padding-left: 2px; +} +#copy-path> img { + margin-bottom: 2px; } #theme-choices { diff --git a/src/librustdoc/html/static/search.js b/src/librustdoc/html/static/search.js index 9fab435de49..b4f9d7b3740 100644 --- a/src/librustdoc/html/static/search.js +++ b/src/librustdoc/html/static/search.js @@ -146,23 +146,21 @@ window.initSearch = function(rawSearchIndex) { removeEmptyStringsFromArray(split); - function transformResults(results, isType) { + function transformResults(results) { var out = []; for (var i = 0, len = results.length; i < len; ++i) { if (results[i].id > -1) { var obj = searchIndex[results[i].id]; obj.lev = results[i].lev; - if (isType !== true || obj.type) { - var res = buildHrefAndPath(obj); - obj.displayPath = pathSplitter(res[0]); - obj.fullPath = obj.displayPath + obj.name; - // To be sure than it some items aren't considered as duplicate. - obj.fullPath += "|" + obj.ty; - obj.href = res[1]; - out.push(obj); - if (out.length >= MAX_RESULTS) { - break; - } + var res = buildHrefAndPath(obj); + obj.displayPath = pathSplitter(res[0]); + obj.fullPath = obj.displayPath + obj.name; + // To be sure than it some items aren't considered as duplicate. + obj.fullPath += "|" + obj.ty; + obj.href = res[1]; + out.push(obj); + if (out.length >= MAX_RESULTS) { + break; } } } @@ -266,9 +264,7 @@ window.initSearch = function(rawSearchIndex) { path = result.item.path.toLowerCase(), parent = result.item.parent; - if (isType !== true && - validateResult(name, path, split, parent) === false) - { + if (!isType && !validateResult(name, path, split, parent)) { result.id = -1; } } @@ -352,7 +348,7 @@ window.initSearch = function(rawSearchIndex) { var lev_distance = MAX_LEV_DISTANCE + 1; var len, x, firstGeneric; if (obj[NAME] === val.name) { - if (literalSearch === true) { + if (literalSearch) { if (val.generics && val.generics.length !== 0) { if (obj.length > GENERICS_DATA && obj[GENERICS_DATA].length >= val.generics.length) { @@ -373,7 +369,7 @@ window.initSearch = function(rawSearchIndex) { break; } } - if (allFound === true) { + if (allFound) { return true; } } else { @@ -394,7 +390,7 @@ window.initSearch = function(rawSearchIndex) { } } // Names didn't match so let's check if one of the generic types could. - if (literalSearch === true) { + if (literalSearch) { if (obj.length > GENERICS_DATA && obj[GENERICS_DATA].length > 0) { return obj[GENERICS_DATA].some( function(name) { @@ -429,12 +425,12 @@ window.initSearch = function(rawSearchIndex) { var length = obj.type[INPUTS_DATA].length; for (var i = 0; i < length; i++) { var tmp = obj.type[INPUTS_DATA][i]; - if (typePassesFilter(typeFilter, tmp[1]) === false) { + if (!typePassesFilter(typeFilter, tmp[1])) { continue; } tmp = checkType(tmp, val, literalSearch); - if (literalSearch === true) { - if (tmp === true) { + if (literalSearch) { + if (tmp) { return true; } continue; @@ -445,7 +441,7 @@ window.initSearch = function(rawSearchIndex) { } } } - return literalSearch === true ? false : lev_distance; + return literalSearch ? false : lev_distance; } function checkReturned(obj, val, literalSearch, typeFilter) { @@ -458,12 +454,12 @@ window.initSearch = function(rawSearchIndex) { } for (var x = 0, len = ret.length; x < len; ++x) { var tmp = ret[x]; - if (typePassesFilter(typeFilter, tmp[1]) === false) { + if (!typePassesFilter(typeFilter, tmp[1])) { continue; } tmp = checkType(tmp, val, literalSearch); - if (literalSearch === true) { - if (tmp === true) { + if (literalSearch) { + if (tmp) { return true; } continue; @@ -474,7 +470,7 @@ window.initSearch = function(rawSearchIndex) { } } } - return literalSearch === true ? false : lev_distance; + return literalSearch ? false : lev_distance; } function checkPath(contains, lastElem, ty) { @@ -507,7 +503,7 @@ window.initSearch = function(rawSearchIndex) { } lev_total += lev; } - if (aborted === false) { + if (!aborted) { ret_lev = Math.min(ret_lev, Math.round(lev_total / clength)); } } @@ -634,14 +630,14 @@ window.initSearch = function(rawSearchIndex) { dontValidate: true, }; } - if (in_args === true && results_in_args[fullId] === undefined) { + if (in_args && results_in_args[fullId] === undefined) { results_in_args[fullId] = { id: i, index: -1, dontValidate: true, }; } - if (returned === true && results_returned[fullId] === undefined) { + if (returned && results_returned[fullId] === undefined) { results_returned[fullId] = { id: i, index: -1, @@ -676,7 +672,7 @@ window.initSearch = function(rawSearchIndex) { fullId = ty.id; returned = checkReturned(ty, output, true, NO_TYPE_FILTER); - if (output.name === "*" || returned === true) { + if (output.name === "*" || returned) { in_args = false; var is_module = false; @@ -684,26 +680,26 @@ window.initSearch = function(rawSearchIndex) { is_module = true; } else { var allFound = true; - for (it = 0, len = inputs.length; allFound === true && it < len; it++) { + for (it = 0, len = inputs.length; allFound && it < len; it++) { allFound = checkType(type, inputs[it], true); } in_args = allFound; } - if (in_args === true) { + if (in_args) { results_in_args[fullId] = { id: i, index: -1, dontValidate: true, }; } - if (returned === true) { + if (returned) { results_returned[fullId] = { id: i, index: -1, dontValidate: true, }; } - if (is_module === true) { + if (is_module) { results[fullId] = { id: i, index: -1, @@ -763,10 +759,10 @@ window.initSearch = function(rawSearchIndex) { } } if ((lev = levenshtein(searchWords[j], val)) <= MAX_LEV_DISTANCE) { - if (typePassesFilter(typeFilter, ty.ty) === false) { - lev = MAX_LEV_DISTANCE + 1; - } else { + if (typePassesFilter(typeFilter, ty.ty)) { lev += 1; + } else { + lev = MAX_LEV_DISTANCE + 1; } } in_args = findArg(ty, valGenerics, false, typeFilter); @@ -821,7 +817,7 @@ window.initSearch = function(rawSearchIndex) { var ret = { "in_args": sortResults(results_in_args, true), "returned": sortResults(results_returned, true), - "others": sortResults(results), + "others": sortResults(results, false), }; handleAliases(ret, query, filterCrates); return ret; @@ -1263,7 +1259,7 @@ window.initSearch = function(rawSearchIndex) { if (query.query.length === 0) { return; } - if (forced !== true && query.id === currentResults) { + if (!forced && query.id === currentResults) { if (query.query.length > 0) { searchState.putBackSearch(searchState.input); } diff --git a/src/librustdoc/html/static/source-script.js b/src/librustdoc/html/static/source-script.js index 42b54e4cc1e..81df5411896 100644 --- a/src/librustdoc/html/static/source-script.js +++ b/src/librustdoc/html/static/source-script.js @@ -44,7 +44,7 @@ function createDirEntry(elem, parent, fullPath, currentFile, hasFoundFile) { if (elem.dirs) { for (i = 0, len = elem.dirs.length; i < len; ++i) { if (createDirEntry(elem.dirs[i], folders, fullPath, currentFile, - hasFoundFile) === true) { + hasFoundFile)) { addClass(name, "expand"); hasFoundFile = true; } @@ -59,8 +59,7 @@ function createDirEntry(elem, parent, fullPath, currentFile, hasFoundFile) { var file = document.createElement("a"); file.innerText = elem.files[i]; file.href = window.rootPath + "src/" + fullPath + elem.files[i] + ".html"; - if (hasFoundFile === false && - currentFile === fullPath + elem.files[i]) { + if (!hasFoundFile && currentFile === fullPath + elem.files[i]) { file.className = "selected"; addClass(name, "expand"); hasFoundFile = true; @@ -72,7 +71,7 @@ function createDirEntry(elem, parent, fullPath, currentFile, hasFoundFile) { children.appendChild(files); parent.appendChild(name); parent.appendChild(children); - return hasFoundFile === true && currentFile.startsWith(fullPath); + return hasFoundFile && currentFile.startsWith(fullPath); } function toggleSidebar() { @@ -116,7 +115,7 @@ function createSidebarToggle() { // This function is called from "source-files.js", generated in `html/render/mod.rs`. // eslint-disable-next-line no-unused-vars function createSourceSidebar() { - if (window.rootPath.endsWith("/") === false) { + if (!window.rootPath.endsWith("/")) { window.rootPath += "/"; } var main = document.getElementById("main"); diff --git a/src/librustdoc/html/static/storage.js b/src/librustdoc/html/static/storage.js index 2ed87fdedae..208afd2e732 100644 --- a/src/librustdoc/html/static/storage.js +++ b/src/librustdoc/html/static/storage.js @@ -59,15 +59,15 @@ function onEach(arr, func, reversed) { if (arr && arr.length > 0 && func) { var length = arr.length; var i; - if (reversed !== true) { - for (i = 0; i < length; ++i) { - if (func(arr[i]) === true) { + if (reversed) { + for (i = length - 1; i >= 0; --i) { + if (func(arr[i])) { return true; } } } else { - for (i = length - 1; i >= 0; --i) { - if (func(arr[i]) === true) { + for (i = 0; i < length; ++i) { + if (func(arr[i])) { return true; } } @@ -111,7 +111,7 @@ function switchTheme(styleElem, mainStyleElem, newTheme, saveTheme) { // If this new value comes from a system setting or from the previously // saved theme, no need to save it. - if (saveTheme === true) { + if (saveTheme) { updateLocalStorage("rustdoc-theme", newTheme); } @@ -131,7 +131,7 @@ function switchTheme(styleElem, mainStyleElem, newTheme, saveTheme) { return true; } }); - if (found === true) { + if (found) { styleElem.href = newHref; } } diff --git a/src/librustdoc/html/static/themes/ayu.css b/src/librustdoc/html/static/themes/ayu.css index aace0b3c037..aafb7f6300e 100644 --- a/src/librustdoc/html/static/themes/ayu.css +++ b/src/librustdoc/html/static/themes/ayu.css @@ -53,7 +53,7 @@ span code { .docblock code, .docblock-short code { background-color: #191f26; } -pre { +pre, .rustdoc.source .example-wrap { color: #e6e1cf; background-color: #191f26; } @@ -509,7 +509,7 @@ kbd { color: #fff; } -#theme-picker > img, #settings-menu > img { +#theme-picker > img, #settings-menu > img, #copy-path > img { filter: invert(100); } diff --git a/src/librustdoc/html/static/themes/dark.css b/src/librustdoc/html/static/themes/dark.css index c23e95ce107..715605d7b37 100644 --- a/src/librustdoc/html/static/themes/dark.css +++ b/src/librustdoc/html/static/themes/dark.css @@ -26,7 +26,7 @@ h4:not(.method):not(.type):not(.tymethod) { .docblock code, .docblock-short code { background-color: #2A2A2A; } -pre { +pre, .rustdoc.source .example-wrap { background-color: #2A2A2A; } diff --git a/src/librustdoc/html/static/themes/light.css b/src/librustdoc/html/static/themes/light.css index 93309721210..60ed8898793 100644 --- a/src/librustdoc/html/static/themes/light.css +++ b/src/librustdoc/html/static/themes/light.css @@ -28,7 +28,7 @@ h4:not(.method):not(.type):not(.tymethod) { .docblock code, .docblock-short code { background-color: #F5F5F5; } -pre { +pre, .rustdoc.source .example-wrap { background-color: #F5F5F5; } diff --git a/src/librustdoc/html/static_files.rs b/src/librustdoc/html/static_files.rs index 2b73bd5d52e..1abb1f7294a 100644 --- a/src/librustdoc/html/static_files.rs +++ b/src/librustdoc/html/static_files.rs @@ -41,6 +41,9 @@ crate static BRUSH_SVG: &[u8] = include_bytes!("static/brush.svg"); /// The file contents of `wheel.svg`, the icon used for the settings button. crate static WHEEL_SVG: &[u8] = include_bytes!("static/wheel.svg"); +/// The file contents of `clipboard.svg`, the icon used for the "copy path" button. +crate static CLIPBOARD_SVG: &[u8] = include_bytes!("static/clipboard.svg"); + /// The file contents of `down-arrow.svg`, the icon used for the crate choice combobox. crate static DOWN_ARROW_SVG: &[u8] = include_bytes!("static/down-arrow.svg"); diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs index 169ef015fa8..5ede3780e87 100644 --- a/src/librustdoc/lib.rs +++ b/src/librustdoc/lib.rs @@ -594,6 +594,9 @@ fn opts() -> Vec<RustcOptGroup> { ) }), unstable("no-run", |o| o.optflag("", "no-run", "Compile doctests without running them")), + unstable("show-type-layout", |o| { + o.optflag("", "show-type-layout", "Include the memory layout of types in the docs") + }), ] } diff --git a/src/test/mir-opt/retag.array_casts.SimplifyCfg-elaborate-drops.after.mir b/src/test/mir-opt/retag.array_casts.SimplifyCfg-elaborate-drops.after.mir new file mode 100644 index 00000000000..c6ef403c3c1 --- /dev/null +++ b/src/test/mir-opt/retag.array_casts.SimplifyCfg-elaborate-drops.after.mir @@ -0,0 +1,199 @@ +// MIR for `array_casts` after SimplifyCfg-elaborate-drops + +fn array_casts() -> () { + let mut _0: (); // return place in scope 0 at $DIR/retag.rs:57:18: 57:18 + let mut _1: [usize; 2]; // in scope 0 at $DIR/retag.rs:58:9: 58:14 + let mut _3: *mut [usize; 2]; // in scope 0 at $DIR/retag.rs:59:13: 59:19 + let mut _4: &mut [usize; 2]; // in scope 0 at $DIR/retag.rs:59:13: 59:19 + let _5: (); // in scope 0 at $DIR/retag.rs:60:5: 60:30 + let mut _6: *mut usize; // in scope 0 at $DIR/retag.rs:60:15: 60:23 + let mut _7: *mut usize; // in scope 0 at $DIR/retag.rs:60:15: 60:16 + let mut _10: *const [usize; 2]; // in scope 0 at $DIR/retag.rs:63:13: 63:15 + let _11: &[usize; 2]; // in scope 0 at $DIR/retag.rs:63:13: 63:15 + let _12: (); // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _13: (&usize, &usize); // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _14: &usize; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let _15: usize; // in scope 0 at $DIR/retag.rs:64:16: 64:36 + let mut _16: *const usize; // in scope 0 at $DIR/retag.rs:64:26: 64:34 + let mut _17: *const usize; // in scope 0 at $DIR/retag.rs:64:26: 64:27 + let mut _18: &usize; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let _19: usize; // in scope 0 at $DIR/retag.rs:64:38: 64:39 + let mut _22: bool; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _23: bool; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _24: usize; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _25: usize; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _26: !; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let _28: !; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _29: core::panicking::AssertKind; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _30: &usize; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let _31: &usize; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _32: &usize; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let _33: &usize; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _34: std::option::Option<std::fmt::Arguments>; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + scope 1 { + debug x => _1; // in scope 1 at $DIR/retag.rs:58:9: 58:14 + let _2: *mut usize; // in scope 1 at $DIR/retag.rs:59:9: 59:10 + scope 2 { + debug p => _2; // in scope 2 at $DIR/retag.rs:59:9: 59:10 + let _8: [usize; 2]; // in scope 2 at $DIR/retag.rs:62:9: 62:10 + scope 3 { + } + scope 4 { + debug x => _8; // in scope 4 at $DIR/retag.rs:62:9: 62:10 + let _9: *const usize; // in scope 4 at $DIR/retag.rs:63:9: 63:10 + scope 5 { + debug p => _9; // in scope 5 at $DIR/retag.rs:63:9: 63:10 + let _20: &usize; // in scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let _21: &usize; // in scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _35: &usize; // in scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + scope 6 { + } + scope 7 { + debug left_val => _20; // in scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + debug right_val => _21; // in scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let _27: core::panicking::AssertKind; // in scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + scope 8 { + debug kind => _27; // in scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + } + } + } + } + } + } + + bb0: { + StorageLive(_1); // scope 0 at $DIR/retag.rs:58:9: 58:14 + _1 = [const 0_usize, const 0_usize]; // scope 0 at $DIR/retag.rs:58:29: 58:35 + StorageLive(_2); // scope 1 at $DIR/retag.rs:59:9: 59:10 + StorageLive(_3); // scope 1 at $DIR/retag.rs:59:13: 59:19 + StorageLive(_4); // scope 1 at $DIR/retag.rs:59:13: 59:19 + _4 = &mut _1; // scope 1 at $DIR/retag.rs:59:13: 59:19 + Retag(_4); // scope 1 at $DIR/retag.rs:59:13: 59:19 + _3 = &raw mut (*_4); // scope 1 at $DIR/retag.rs:59:13: 59:19 + Retag([raw] _3); // scope 1 at $DIR/retag.rs:59:13: 59:19 + _2 = move _3 as *mut usize (Pointer(ArrayToPointer)); // scope 1 at $DIR/retag.rs:59:13: 59:33 + StorageDead(_3); // scope 1 at $DIR/retag.rs:59:32: 59:33 + StorageDead(_4); // scope 1 at $DIR/retag.rs:59:33: 59:34 + StorageLive(_5); // scope 2 at $DIR/retag.rs:60:5: 60:30 + StorageLive(_6); // scope 3 at $DIR/retag.rs:60:15: 60:23 + StorageLive(_7); // scope 3 at $DIR/retag.rs:60:15: 60:16 + _7 = _2; // scope 3 at $DIR/retag.rs:60:15: 60:16 + _6 = ptr::mut_ptr::<impl *mut usize>::add(move _7, const 1_usize) -> bb1; // scope 3 at $DIR/retag.rs:60:15: 60:23 + // mir::Constant + // + span: $DIR/retag.rs:60:17: 60:20 + // + literal: Const { ty: unsafe fn(*mut usize, usize) -> *mut usize {std::ptr::mut_ptr::<impl *mut usize>::add}, val: Value(Scalar(<ZST>)) } + } + + bb1: { + StorageDead(_7); // scope 3 at $DIR/retag.rs:60:22: 60:23 + (*_6) = const 1_usize; // scope 3 at $DIR/retag.rs:60:14: 60:27 + StorageDead(_6); // scope 3 at $DIR/retag.rs:60:27: 60:28 + _5 = const (); // scope 3 at $DIR/retag.rs:60:5: 60:30 + StorageDead(_5); // scope 2 at $DIR/retag.rs:60:29: 60:30 + StorageLive(_8); // scope 2 at $DIR/retag.rs:62:9: 62:10 + _8 = [const 0_usize, const 1_usize]; // scope 2 at $DIR/retag.rs:62:25: 62:31 + StorageLive(_9); // scope 4 at $DIR/retag.rs:63:9: 63:10 + StorageLive(_10); // scope 4 at $DIR/retag.rs:63:13: 63:15 + StorageLive(_11); // scope 4 at $DIR/retag.rs:63:13: 63:15 + _11 = &_8; // scope 4 at $DIR/retag.rs:63:13: 63:15 + Retag(_11); // scope 4 at $DIR/retag.rs:63:13: 63:15 + _10 = &raw const (*_11); // scope 4 at $DIR/retag.rs:63:13: 63:15 + Retag([raw] _10); // scope 4 at $DIR/retag.rs:63:13: 63:15 + _9 = move _10 as *const usize (Pointer(ArrayToPointer)); // scope 4 at $DIR/retag.rs:63:13: 63:31 + StorageDead(_10); // scope 4 at $DIR/retag.rs:63:30: 63:31 + StorageDead(_11); // scope 4 at $DIR/retag.rs:63:31: 63:32 + StorageLive(_12); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_13); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_14); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_15); // scope 5 at $DIR/retag.rs:64:16: 64:36 + StorageLive(_16); // scope 6 at $DIR/retag.rs:64:26: 64:34 + StorageLive(_17); // scope 6 at $DIR/retag.rs:64:26: 64:27 + _17 = _9; // scope 6 at $DIR/retag.rs:64:26: 64:27 + _16 = ptr::const_ptr::<impl *const usize>::add(move _17, const 1_usize) -> bb2; // scope 6 at $DIR/retag.rs:64:26: 64:34 + // mir::Constant + // + span: $DIR/retag.rs:64:28: 64:31 + // + literal: Const { ty: unsafe fn(*const usize, usize) -> *const usize {std::ptr::const_ptr::<impl *const usize>::add}, val: Value(Scalar(<ZST>)) } + } + + bb2: { + StorageDead(_17); // scope 6 at $DIR/retag.rs:64:33: 64:34 + _15 = (*_16); // scope 6 at $DIR/retag.rs:64:25: 64:34 + _14 = &_15; // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + Retag(_14); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_18); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _35 = const array_casts::promoted[0]; // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + // ty::Const + // + ty: &usize + // + val: Unevaluated(array_casts, [], Some(promoted[0])) + // mir::Constant + // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL + // + literal: Const { ty: &usize, val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:15 ~ retag[317d]::array_casts), const_param_did: None }, substs: [], promoted: Some(promoted[0]) }) } + Retag(_35); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _18 = &(*_35); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + Retag(_18); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _13 = (move _14, move _18); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_18); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_14); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_20); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _20 = (_13.0: &usize); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + Retag(_20); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_21); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _21 = (_13.1: &usize); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + Retag(_21); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_22); // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_23); // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_24); // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _24 = (*_20); // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_25); // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _25 = (*_21); // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _23 = Eq(move _24, move _25); // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_25); // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_24); // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _22 = Not(move _23); // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_23); // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + switchInt(move _22) -> [false: bb4, otherwise: bb3]; // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + } + + bb3: { + StorageLive(_27); // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _27 = core::panicking::AssertKind::Eq; // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_28); // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_29); // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _29 = move _27; // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_30); // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_31); // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _31 = &(*_20); // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + Retag(_31); // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _30 = &(*_31); // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + Retag(_30); // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_32); // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_33); // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _33 = &(*_21); // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + Retag(_33); // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _32 = &(*_33); // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + Retag(_32); // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_34); // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _34 = Option::<Arguments>::None; // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + core::panicking::assert_failed::<usize, usize>(move _29, move _30, move _32, move _34); // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + // mir::Constant + // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL + // + literal: Const { ty: for<'r, 's, 't0> fn(core::panicking::AssertKind, &'r usize, &'s usize, std::option::Option<std::fmt::Arguments<'t0>>) -> ! {core::panicking::assert_failed::<usize, usize>}, val: Value(Scalar(<ZST>)) } + } + + bb4: { + _12 = const (); // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_22); // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_21); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_20); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_16); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_15); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_13); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_12); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _0 = const (); // scope 0 at $DIR/retag.rs:57:18: 65:2 + StorageDead(_9); // scope 4 at $DIR/retag.rs:65:1: 65:2 + StorageDead(_8); // scope 2 at $DIR/retag.rs:65:1: 65:2 + StorageDead(_2); // scope 1 at $DIR/retag.rs:65:1: 65:2 + StorageDead(_1); // scope 0 at $DIR/retag.rs:65:1: 65:2 + return; // scope 0 at $DIR/retag.rs:65:2: 65:2 + } +} diff --git a/src/test/mir-opt/retag.main.SimplifyCfg-elaborate-drops.after.mir b/src/test/mir-opt/retag.main.SimplifyCfg-elaborate-drops.after.mir index 894f64c7767..4bab5a97488 100644 --- a/src/test/mir-opt/retag.main.SimplifyCfg-elaborate-drops.after.mir +++ b/src/test/mir-opt/retag.main.SimplifyCfg-elaborate-drops.after.mir @@ -21,6 +21,7 @@ fn main() -> () { let _23: &i32; // in scope 0 at $DIR/retag.rs:47:21: 47:23 let _24: i32; // in scope 0 at $DIR/retag.rs:47:22: 47:23 let mut _26: *const i32; // in scope 0 at $DIR/retag.rs:50:14: 50:28 + let _27: (); // in scope 0 at $DIR/retag.rs:52:5: 52:18 scope 1 { debug x => _1; // in scope 1 at $DIR/retag.rs:30:9: 30:14 let _3: &mut i32; // in scope 1 at $DIR/retag.rs:32:13: 32:14 @@ -46,7 +47,7 @@ fn main() -> () { scope 7 { debug _w => _15; // in scope 7 at $DIR/retag.rs:44:9: 44:11 let _25: *const i32; // in scope 7 at $DIR/retag.rs:50:9: 50:11 - let mut _27: &i32; // in scope 7 at $DIR/retag.rs:47:21: 47:23 + let mut _28: &i32; // in scope 7 at $DIR/retag.rs:47:21: 47:23 scope 8 { debug _w => _25; // in scope 8 at $DIR/retag.rs:50:9: 50:11 } @@ -70,7 +71,7 @@ fn main() -> () { Retag(_7); // scope 1 at $DIR/retag.rs:32:29: 32:35 _6 = &mut (*_7); // scope 1 at $DIR/retag.rs:32:29: 32:35 Retag([2phase] _6); // scope 1 at $DIR/retag.rs:32:29: 32:35 - _3 = Test::foo(move _4, move _6) -> [return: bb1, unwind: bb7]; // scope 1 at $DIR/retag.rs:32:17: 32:36 + _3 = Test::foo(move _4, move _6) -> [return: bb1, unwind: bb8]; // scope 1 at $DIR/retag.rs:32:17: 32:36 // mir::Constant // + span: $DIR/retag.rs:32:25: 32:28 // + literal: Const { ty: for<'r, 'x> fn(&'r Test, &'x mut i32) -> &'x mut i32 {Test::foo}, val: Value(Scalar(<ZST>)) } @@ -81,7 +82,7 @@ fn main() -> () { StorageDead(_6); // scope 1 at $DIR/retag.rs:32:35: 32:36 StorageDead(_4); // scope 1 at $DIR/retag.rs:32:35: 32:36 StorageDead(_7); // scope 1 at $DIR/retag.rs:32:36: 32:37 - drop(_5) -> [return: bb2, unwind: bb8]; // scope 1 at $DIR/retag.rs:32:36: 32:37 + drop(_5) -> [return: bb2, unwind: bb9]; // scope 1 at $DIR/retag.rs:32:36: 32:37 } bb2: { @@ -146,19 +147,19 @@ fn main() -> () { Retag(_20); // scope 7 at $DIR/retag.rs:47:5: 47:12 StorageLive(_22); // scope 7 at $DIR/retag.rs:47:21: 47:23 StorageLive(_23); // scope 7 at $DIR/retag.rs:47:21: 47:23 - _27 = const main::promoted[0]; // scope 7 at $DIR/retag.rs:47:21: 47:23 + _28 = const main::promoted[0]; // scope 7 at $DIR/retag.rs:47:21: 47:23 // ty::Const // + ty: &i32 // + val: Unevaluated(main, [], Some(promoted[0])) // mir::Constant // + span: $DIR/retag.rs:47:21: 47:23 // + literal: Const { ty: &i32, val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:13 ~ retag[317d]::main), const_param_did: None }, substs: [], promoted: Some(promoted[0]) }) } - Retag(_27); // scope 7 at $DIR/retag.rs:47:21: 47:23 - _23 = &(*_27); // scope 7 at $DIR/retag.rs:47:21: 47:23 + Retag(_28); // scope 7 at $DIR/retag.rs:47:21: 47:23 + _23 = &(*_28); // scope 7 at $DIR/retag.rs:47:21: 47:23 Retag(_23); // scope 7 at $DIR/retag.rs:47:21: 47:23 _22 = &(*_23); // scope 7 at $DIR/retag.rs:47:21: 47:23 Retag(_22); // scope 7 at $DIR/retag.rs:47:21: 47:23 - _19 = Test::foo_shr(move _20, move _22) -> [return: bb4, unwind: bb6]; // scope 7 at $DIR/retag.rs:47:5: 47:24 + _19 = Test::foo_shr(move _20, move _22) -> [return: bb4, unwind: bb7]; // scope 7 at $DIR/retag.rs:47:5: 47:24 // mir::Constant // + span: $DIR/retag.rs:47:13: 47:20 // + literal: Const { ty: for<'r, 'x> fn(&'r Test, &'x i32) -> &'x i32 {Test::foo_shr}, val: Value(Scalar(<ZST>)) } @@ -169,7 +170,7 @@ fn main() -> () { StorageDead(_22); // scope 7 at $DIR/retag.rs:47:23: 47:24 StorageDead(_20); // scope 7 at $DIR/retag.rs:47:23: 47:24 StorageDead(_23); // scope 7 at $DIR/retag.rs:47:24: 47:25 - drop(_21) -> [return: bb5, unwind: bb8]; // scope 7 at $DIR/retag.rs:47:24: 47:25 + drop(_21) -> [return: bb5, unwind: bb9]; // scope 7 at $DIR/retag.rs:47:24: 47:25 } bb5: { @@ -181,23 +182,32 @@ fn main() -> () { Retag([raw] _26); // scope 7 at $DIR/retag.rs:50:14: 50:16 _25 = _26; // scope 7 at $DIR/retag.rs:50:14: 50:28 StorageDead(_26); // scope 7 at $DIR/retag.rs:50:28: 50:29 - _0 = const (); // scope 0 at $DIR/retag.rs:29:11: 51:2 - StorageDead(_25); // scope 7 at $DIR/retag.rs:51:1: 51:2 - StorageDead(_15); // scope 6 at $DIR/retag.rs:51:1: 51:2 - StorageDead(_13); // scope 1 at $DIR/retag.rs:51:1: 51:2 - StorageDead(_1); // scope 0 at $DIR/retag.rs:51:1: 51:2 - return; // scope 0 at $DIR/retag.rs:51:2: 51:2 + StorageLive(_27); // scope 8 at $DIR/retag.rs:52:5: 52:18 + _27 = array_casts() -> bb6; // scope 8 at $DIR/retag.rs:52:5: 52:18 + // mir::Constant + // + span: $DIR/retag.rs:52:5: 52:16 + // + literal: Const { ty: fn() {array_casts}, val: Value(Scalar(<ZST>)) } } - bb6 (cleanup): { - drop(_21) -> bb8; // scope 7 at $DIR/retag.rs:47:24: 47:25 + bb6: { + StorageDead(_27); // scope 8 at $DIR/retag.rs:52:18: 52:19 + _0 = const (); // scope 0 at $DIR/retag.rs:29:11: 53:2 + StorageDead(_25); // scope 7 at $DIR/retag.rs:53:1: 53:2 + StorageDead(_15); // scope 6 at $DIR/retag.rs:53:1: 53:2 + StorageDead(_13); // scope 1 at $DIR/retag.rs:53:1: 53:2 + StorageDead(_1); // scope 0 at $DIR/retag.rs:53:1: 53:2 + return; // scope 0 at $DIR/retag.rs:53:2: 53:2 } bb7 (cleanup): { - drop(_5) -> bb8; // scope 1 at $DIR/retag.rs:32:36: 32:37 + drop(_21) -> bb9; // scope 7 at $DIR/retag.rs:47:24: 47:25 } bb8 (cleanup): { - resume; // scope 0 at $DIR/retag.rs:29:1: 51:2 + drop(_5) -> bb9; // scope 1 at $DIR/retag.rs:32:36: 32:37 + } + + bb9 (cleanup): { + resume; // scope 0 at $DIR/retag.rs:29:1: 53:2 } } diff --git a/src/test/mir-opt/retag.rs b/src/test/mir-opt/retag.rs index d0ea2cfb18b..13568b822d4 100644 --- a/src/test/mir-opt/retag.rs +++ b/src/test/mir-opt/retag.rs @@ -48,4 +48,18 @@ fn main() { // escape-to-raw (shr) let _w = _w as *const _; + + array_casts(); +} + +/// Casting directly to an array should also go through `&raw` and thus add appropriate retags. +// EMIT_MIR retag.array_casts.SimplifyCfg-elaborate-drops.after.mir +fn array_casts() { + let mut x: [usize; 2] = [0, 0]; + let p = &mut x as *mut usize; + unsafe { *p.add(1) = 1; } + + let x: [usize; 2] = [0, 1]; + let p = &x as *const usize; + assert_eq!(unsafe { *p.add(1) }, 1); } diff --git a/src/test/rustdoc-gui/source-code-page.goml b/src/test/rustdoc-gui/source-code-page.goml new file mode 100644 index 00000000000..f11c41e8bd5 --- /dev/null +++ b/src/test/rustdoc-gui/source-code-page.goml @@ -0,0 +1,13 @@ +goto: file://|DOC_PATH|/../src/test_docs/lib.rs.html +// Check that we can click on the line number. +click: (40, 224) // This is the position of the span for line 4. +// Unfortunately, "#4" isn't a valid query selector, so we have to go around that limitation +// by instead getting the nth span. +assert: (".line-numbers > span:nth-child(4)", "class", "line-highlighted") +// We now check that the good spans are highlighted +goto: file://|DOC_PATH|/../src/test_docs/lib.rs.html#4-6 +assert-false: (".line-numbers > span:nth-child(3)", "class", "line-highlighted") +assert: (".line-numbers > span:nth-child(4)", "class", "line-highlighted") +assert: (".line-numbers > span:nth-child(5)", "class", "line-highlighted") +assert: (".line-numbers > span:nth-child(6)", "class", "line-highlighted") +assert-false: (".line-numbers > span:nth-child(7)", "class", "line-highlighted") diff --git a/src/test/rustdoc-ui/doc-attr2.rs b/src/test/rustdoc-ui/doc-attr2.rs deleted file mode 100644 index 3fb484644d7..00000000000 --- a/src/test/rustdoc-ui/doc-attr2.rs +++ /dev/null @@ -1,11 +0,0 @@ -#![crate_type = "lib"] -#![deny(warnings)] - -#[doc(test(no_crate_inject))] //~ ERROR -//~^ WARN -pub fn foo() {} - -pub mod bar { - #![doc(test(no_crate_inject))] //~ ERROR - //~^ WARN -} diff --git a/src/test/rustdoc-ui/doc-attr2.stderr b/src/test/rustdoc-ui/doc-attr2.stderr deleted file mode 100644 index 643107318b9..00000000000 --- a/src/test/rustdoc-ui/doc-attr2.stderr +++ /dev/null @@ -1,26 +0,0 @@ -error: `#![doc(test(...)]` is only allowed as a crate-level attribute - --> $DIR/doc-attr2.rs:4:7 - | -LL | #[doc(test(no_crate_inject))] - | ^^^^^^^^^^^^^^^^^^^^^ - | -note: the lint level is defined here - --> $DIR/doc-attr2.rs:2:9 - | -LL | #![deny(warnings)] - | ^^^^^^^^ - = note: `#[deny(invalid_doc_attributes)]` implied by `#[deny(warnings)]` - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730> - -error: `#![doc(test(...)]` is only allowed as a crate-level attribute - --> $DIR/doc-attr2.rs:9:12 - | -LL | #![doc(test(no_crate_inject))] - | ^^^^^^^^^^^^^^^^^^^^^ - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730> - -error: aborting due to 2 previous errors - diff --git a/src/test/rustdoc-ui/invalid-doc-attr.rs b/src/test/rustdoc-ui/invalid-doc-attr.rs new file mode 100644 index 00000000000..de004b41e27 --- /dev/null +++ b/src/test/rustdoc-ui/invalid-doc-attr.rs @@ -0,0 +1,32 @@ +#![crate_type = "lib"] +#![deny(warnings)] + +#[doc(test(no_crate_inject))] +//~^ ERROR can only be applied at the crate level +//~| WARN is being phased out +//~| HELP to apply to the crate, use an inner attribute +//~| SUGGESTION #![doc(test(no_crate_inject))] +#[doc(inline)] +//~^ ERROR can only be applied to a `use` item +//~| WARN is being phased out +pub fn foo() {} + +pub mod bar { + #![doc(test(no_crate_inject))] + //~^ ERROR can only be applied at the crate level + //~| WARN is being phased out + + #[doc(test(no_crate_inject))] + //~^ ERROR can only be applied at the crate level + //~| WARN is being phased out + #[doc(inline)] + //~^ ERROR can only be applied to a `use` item + //~| WARN is being phased out + pub fn baz() {} +} + +#[doc(inline)] +#[doc(no_inline)] +//~^^ ERROR conflicting doc inlining attributes +//~| HELP remove one of the conflicting attributes +pub use bar::baz; diff --git a/src/test/rustdoc-ui/invalid-doc-attr.stderr b/src/test/rustdoc-ui/invalid-doc-attr.stderr new file mode 100644 index 00000000000..595ece2ea72 --- /dev/null +++ b/src/test/rustdoc-ui/invalid-doc-attr.stderr @@ -0,0 +1,78 @@ +error: this attribute can only be applied at the crate level + --> $DIR/invalid-doc-attr.rs:4:7 + | +LL | #[doc(test(no_crate_inject))] + | ^^^^^^^^^^^^^^^^^^^^^ + | +note: the lint level is defined here + --> $DIR/invalid-doc-attr.rs:2:9 + | +LL | #![deny(warnings)] + | ^^^^^^^^ + = note: `#[deny(invalid_doc_attributes)]` implied by `#[deny(warnings)]` + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730> + = note: read https://doc.rust-lang.org/nightly/rustdoc/the-doc-attribute.html#at-the-crate-level for more information +help: to apply to the crate, use an inner attribute + | +LL | #![doc(test(no_crate_inject))] + | + +error: this attribute can only be applied to a `use` item + --> $DIR/invalid-doc-attr.rs:9:7 + | +LL | #[doc(inline)] + | ^^^^^^ only applicable on `use` items +... +LL | pub fn foo() {} + | ------------ not a `use` item + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730> + = note: read https://doc.rust-lang.org/nightly/rustdoc/the-doc-attribute.html#docno_inlinedocinline for more information + +error: this attribute can only be applied at the crate level + --> $DIR/invalid-doc-attr.rs:15:12 + | +LL | #![doc(test(no_crate_inject))] + | ^^^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730> + = note: read https://doc.rust-lang.org/nightly/rustdoc/the-doc-attribute.html#at-the-crate-level for more information + +error: conflicting doc inlining attributes + --> $DIR/invalid-doc-attr.rs:28:7 + | +LL | #[doc(inline)] + | ^^^^^^ this attribute... +LL | #[doc(no_inline)] + | ^^^^^^^^^ ...conflicts with this attribute + | + = help: remove one of the conflicting attributes + +error: this attribute can only be applied at the crate level + --> $DIR/invalid-doc-attr.rs:19:11 + | +LL | #[doc(test(no_crate_inject))] + | ^^^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730> + = note: read https://doc.rust-lang.org/nightly/rustdoc/the-doc-attribute.html#at-the-crate-level for more information + +error: this attribute can only be applied to a `use` item + --> $DIR/invalid-doc-attr.rs:22:11 + | +LL | #[doc(inline)] + | ^^^^^^ only applicable on `use` items +... +LL | pub fn baz() {} + | ------------ not a `use` item + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730> + = note: read https://doc.rust-lang.org/nightly/rustdoc/the-doc-attribute.html#docno_inlinedocinline for more information + +error: aborting due to 6 previous errors + diff --git a/src/test/rustdoc/type-layout-flag-required.rs b/src/test/rustdoc/type-layout-flag-required.rs new file mode 100644 index 00000000000..a01fbd22950 --- /dev/null +++ b/src/test/rustdoc/type-layout-flag-required.rs @@ -0,0 +1,4 @@ +// Tests that `--show-type-layout` is required in order to show layout info. + +// @!has type_layout_flag_required/struct.Foo.html 'Size: ' +pub struct Foo(usize); diff --git a/src/test/rustdoc/type-layout.rs b/src/test/rustdoc/type-layout.rs new file mode 100644 index 00000000000..272911de681 --- /dev/null +++ b/src/test/rustdoc/type-layout.rs @@ -0,0 +1,54 @@ +// compile-flags: --show-type-layout -Z unstable-options + +// @has type_layout/struct.Foo.html 'Size: ' +// @has - ' bytes' +pub struct Foo { + pub a: usize, + b: Vec<String>, +} + +// @has type_layout/enum.Bar.html 'Size: ' +// @has - ' bytes' +pub enum Bar<'a> { + A(String), + B(&'a str, (std::collections::HashMap<String, usize>, Foo)), +} + +// @has type_layout/union.Baz.html 'Size: ' +// @has - ' bytes' +pub union Baz { + a: &'static str, + b: usize, + c: &'static [u8], +} + +// @has type_layout/struct.X.html 'Size: ' +// @has - ' bytes' +pub struct X(usize); + +// @has type_layout/struct.Y.html 'Size: ' +// @has - '1 byte' +// @!has - ' bytes' +pub struct Y(u8); + +// @has type_layout/struct.Z.html 'Size: ' +// @has - '0 bytes' +pub struct Z; + +// We can't compute layout for generic types. +// @has type_layout/struct.Generic.html 'Unable to compute type layout, possibly due to this type having generic parameters' +// @!has - 'Size: ' +pub struct Generic<T>(T); + +// We *can*, however, compute layout for types that are only generic over lifetimes, +// because lifetimes are a type-system construct. +// @has type_layout/struct.GenericLifetimes.html 'Size: ' +// @has - ' bytes' +pub struct GenericLifetimes<'a>(&'a str); + +// @has type_layout/struct.Unsized.html 'Size: ' +// @has - '(unsized)' +pub struct Unsized([u8]); + +// @!has type_layout/trait.MyTrait.html 'Size: ' +pub trait MyTrait {} diff --git a/src/test/ui/async-await/issues/issue-65159.rs b/src/test/ui/async-await/issues/issue-65159.rs index ce3fa9180cb..1dbf5db6c32 100644 --- a/src/test/ui/async-await/issues/issue-65159.rs +++ b/src/test/ui/async-await/issues/issue-65159.rs @@ -3,7 +3,7 @@ // edition:2018 async fn copy() -> Result<()> -//~^ ERROR this enum takes 2 type arguments but only 1 type argument was supplied +//~^ ERROR this enum takes 2 generic arguments { Ok(()) //~^ ERROR type annotations needed diff --git a/src/test/ui/async-await/issues/issue-65159.stderr b/src/test/ui/async-await/issues/issue-65159.stderr index bcb4c292e26..51fc34c4818 100644 --- a/src/test/ui/async-await/issues/issue-65159.stderr +++ b/src/test/ui/async-await/issues/issue-65159.stderr @@ -1,17 +1,17 @@ -error[E0107]: this enum takes 2 type arguments but only 1 type argument was supplied +error[E0107]: this enum takes 2 generic arguments but 1 generic argument was supplied --> $DIR/issue-65159.rs:5:20 | LL | async fn copy() -> Result<()> - | ^^^^^^ -- supplied 1 type argument + | ^^^^^^ -- supplied 1 generic argument | | - | expected 2 type arguments + | expected 2 generic arguments | -note: enum defined here, with 2 type parameters: `T`, `E` +note: enum defined here, with 2 generic parameters: `T`, `E` --> $SRC_DIR/core/src/result.rs:LL:COL | LL | pub enum Result<T, E> { | ^^^^^^ - - -help: add missing type argument +help: add missing generic argument | LL | async fn copy() -> Result<(), E> | ^^^ diff --git a/src/test/ui/attributes/doc-attr2.rs b/src/test/ui/attributes/doc-attr2.rs deleted file mode 100644 index 3fb484644d7..00000000000 --- a/src/test/ui/attributes/doc-attr2.rs +++ /dev/null @@ -1,11 +0,0 @@ -#![crate_type = "lib"] -#![deny(warnings)] - -#[doc(test(no_crate_inject))] //~ ERROR -//~^ WARN -pub fn foo() {} - -pub mod bar { - #![doc(test(no_crate_inject))] //~ ERROR - //~^ WARN -} diff --git a/src/test/ui/attributes/doc-attr2.stderr b/src/test/ui/attributes/doc-attr2.stderr deleted file mode 100644 index 643107318b9..00000000000 --- a/src/test/ui/attributes/doc-attr2.stderr +++ /dev/null @@ -1,26 +0,0 @@ -error: `#![doc(test(...)]` is only allowed as a crate-level attribute - --> $DIR/doc-attr2.rs:4:7 - | -LL | #[doc(test(no_crate_inject))] - | ^^^^^^^^^^^^^^^^^^^^^ - | -note: the lint level is defined here - --> $DIR/doc-attr2.rs:2:9 - | -LL | #![deny(warnings)] - | ^^^^^^^^ - = note: `#[deny(invalid_doc_attributes)]` implied by `#[deny(warnings)]` - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730> - -error: `#![doc(test(...)]` is only allowed as a crate-level attribute - --> $DIR/doc-attr2.rs:9:12 - | -LL | #![doc(test(no_crate_inject))] - | ^^^^^^^^^^^^^^^^^^^^^ - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730> - -error: aborting due to 2 previous errors - diff --git a/src/test/ui/attributes/invalid-doc-attr.rs b/src/test/ui/attributes/invalid-doc-attr.rs new file mode 100644 index 00000000000..de004b41e27 --- /dev/null +++ b/src/test/ui/attributes/invalid-doc-attr.rs @@ -0,0 +1,32 @@ +#![crate_type = "lib"] +#![deny(warnings)] + +#[doc(test(no_crate_inject))] +//~^ ERROR can only be applied at the crate level +//~| WARN is being phased out +//~| HELP to apply to the crate, use an inner attribute +//~| SUGGESTION #![doc(test(no_crate_inject))] +#[doc(inline)] +//~^ ERROR can only be applied to a `use` item +//~| WARN is being phased out +pub fn foo() {} + +pub mod bar { + #![doc(test(no_crate_inject))] + //~^ ERROR can only be applied at the crate level + //~| WARN is being phased out + + #[doc(test(no_crate_inject))] + //~^ ERROR can only be applied at the crate level + //~| WARN is being phased out + #[doc(inline)] + //~^ ERROR can only be applied to a `use` item + //~| WARN is being phased out + pub fn baz() {} +} + +#[doc(inline)] +#[doc(no_inline)] +//~^^ ERROR conflicting doc inlining attributes +//~| HELP remove one of the conflicting attributes +pub use bar::baz; diff --git a/src/test/ui/attributes/invalid-doc-attr.stderr b/src/test/ui/attributes/invalid-doc-attr.stderr new file mode 100644 index 00000000000..595ece2ea72 --- /dev/null +++ b/src/test/ui/attributes/invalid-doc-attr.stderr @@ -0,0 +1,78 @@ +error: this attribute can only be applied at the crate level + --> $DIR/invalid-doc-attr.rs:4:7 + | +LL | #[doc(test(no_crate_inject))] + | ^^^^^^^^^^^^^^^^^^^^^ + | +note: the lint level is defined here + --> $DIR/invalid-doc-attr.rs:2:9 + | +LL | #![deny(warnings)] + | ^^^^^^^^ + = note: `#[deny(invalid_doc_attributes)]` implied by `#[deny(warnings)]` + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730> + = note: read https://doc.rust-lang.org/nightly/rustdoc/the-doc-attribute.html#at-the-crate-level for more information +help: to apply to the crate, use an inner attribute + | +LL | #![doc(test(no_crate_inject))] + | + +error: this attribute can only be applied to a `use` item + --> $DIR/invalid-doc-attr.rs:9:7 + | +LL | #[doc(inline)] + | ^^^^^^ only applicable on `use` items +... +LL | pub fn foo() {} + | ------------ not a `use` item + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730> + = note: read https://doc.rust-lang.org/nightly/rustdoc/the-doc-attribute.html#docno_inlinedocinline for more information + +error: this attribute can only be applied at the crate level + --> $DIR/invalid-doc-attr.rs:15:12 + | +LL | #![doc(test(no_crate_inject))] + | ^^^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730> + = note: read https://doc.rust-lang.org/nightly/rustdoc/the-doc-attribute.html#at-the-crate-level for more information + +error: conflicting doc inlining attributes + --> $DIR/invalid-doc-attr.rs:28:7 + | +LL | #[doc(inline)] + | ^^^^^^ this attribute... +LL | #[doc(no_inline)] + | ^^^^^^^^^ ...conflicts with this attribute + | + = help: remove one of the conflicting attributes + +error: this attribute can only be applied at the crate level + --> $DIR/invalid-doc-attr.rs:19:11 + | +LL | #[doc(test(no_crate_inject))] + | ^^^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730> + = note: read https://doc.rust-lang.org/nightly/rustdoc/the-doc-attribute.html#at-the-crate-level for more information + +error: this attribute can only be applied to a `use` item + --> $DIR/invalid-doc-attr.rs:22:11 + | +LL | #[doc(inline)] + | ^^^^^^ only applicable on `use` items +... +LL | pub fn baz() {} + | ------------ not a `use` item + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730> + = note: read https://doc.rust-lang.org/nightly/rustdoc/the-doc-attribute.html#docno_inlinedocinline for more information + +error: aborting due to 6 previous errors + diff --git a/src/test/ui/borrowck/issue-82126-mismatched-subst-and-hir.rs b/src/test/ui/borrowck/issue-82126-mismatched-subst-and-hir.rs index 2e6b88a4beb..569769b8213 100644 --- a/src/test/ui/borrowck/issue-82126-mismatched-subst-and-hir.rs +++ b/src/test/ui/borrowck/issue-82126-mismatched-subst-and-hir.rs @@ -15,7 +15,7 @@ impl MarketMultiplier { async fn buy_lock(generator: &Mutex<MarketMultiplier>) -> LockedMarket<'_> { //~^ ERROR this struct takes 0 lifetime arguments but 1 lifetime argument was supplied - //~^^ ERROR this struct takes 1 type argument but 0 type arguments were supplied + //~^^ ERROR this struct takes 1 generic argument but 0 generic arguments were supplied LockedMarket(generator.lock().unwrap().buy()) //~^ ERROR cannot return value referencing temporary value } diff --git a/src/test/ui/borrowck/issue-82126-mismatched-subst-and-hir.stderr b/src/test/ui/borrowck/issue-82126-mismatched-subst-and-hir.stderr index b6844f50488..0d506a0956d 100644 --- a/src/test/ui/borrowck/issue-82126-mismatched-subst-and-hir.stderr +++ b/src/test/ui/borrowck/issue-82126-mismatched-subst-and-hir.stderr @@ -12,18 +12,18 @@ note: struct defined here, with 0 lifetime parameters LL | struct LockedMarket<T>(T); | ^^^^^^^^^^^^ -error[E0107]: this struct takes 1 type argument but 0 type arguments were supplied +error[E0107]: this struct takes 1 generic argument but 0 generic arguments were supplied --> $DIR/issue-82126-mismatched-subst-and-hir.rs:16:59 | LL | async fn buy_lock(generator: &Mutex<MarketMultiplier>) -> LockedMarket<'_> { - | ^^^^^^^^^^^^ expected 1 type argument + | ^^^^^^^^^^^^ expected 1 generic argument | -note: struct defined here, with 1 type parameter: `T` +note: struct defined here, with 1 generic parameter: `T` --> $DIR/issue-82126-mismatched-subst-and-hir.rs:23:8 | LL | struct LockedMarket<T>(T); | ^^^^^^^^^^^^ - -help: add missing type argument +help: add missing generic argument | LL | async fn buy_lock(generator: &Mutex<MarketMultiplier>) -> LockedMarket<'_, T> { | ^^^ diff --git a/src/test/ui/const-generics/incorrect-number-of-const-args.full.stderr b/src/test/ui/const-generics/incorrect-number-of-const-args.full.stderr index dd7e63480eb..9deda56cd0d 100644 --- a/src/test/ui/const-generics/incorrect-number-of-const-args.full.stderr +++ b/src/test/ui/const-generics/incorrect-number-of-const-args.full.stderr @@ -1,30 +1,30 @@ -error[E0107]: this function takes 2 const arguments but only 1 const argument was supplied +error[E0107]: this function takes 2 generic arguments but 1 generic argument was supplied --> $DIR/incorrect-number-of-const-args.rs:11:5 | LL | foo::<0>(); - | ^^^ - supplied 1 const argument + | ^^^ - supplied 1 generic argument | | - | expected 2 const arguments + | expected 2 generic arguments | -note: function defined here, with 2 const parameters: `X`, `Y` +note: function defined here, with 2 generic parameters: `X`, `Y` --> $DIR/incorrect-number-of-const-args.rs:6:4 | LL | fn foo<const X: usize, const Y: usize>() -> usize { | ^^^ - - -help: add missing const argument +help: add missing generic argument | LL | foo::<0, Y>(); | ^^^ -error[E0107]: this function takes 2 const arguments but 3 const arguments were supplied +error[E0107]: this function takes 2 generic arguments but 3 generic arguments were supplied --> $DIR/incorrect-number-of-const-args.rs:14:5 | LL | foo::<0, 0, 0>(); - | ^^^ --- help: remove this const argument + | ^^^ - help: remove this generic argument | | - | expected 2 const arguments + | expected 2 generic arguments | -note: function defined here, with 2 const parameters: `X`, `Y` +note: function defined here, with 2 generic parameters: `X`, `Y` --> $DIR/incorrect-number-of-const-args.rs:6:4 | LL | fn foo<const X: usize, const Y: usize>() -> usize { diff --git a/src/test/ui/const-generics/incorrect-number-of-const-args.min.stderr b/src/test/ui/const-generics/incorrect-number-of-const-args.min.stderr index dd7e63480eb..9deda56cd0d 100644 --- a/src/test/ui/const-generics/incorrect-number-of-const-args.min.stderr +++ b/src/test/ui/const-generics/incorrect-number-of-const-args.min.stderr @@ -1,30 +1,30 @@ -error[E0107]: this function takes 2 const arguments but only 1 const argument was supplied +error[E0107]: this function takes 2 generic arguments but 1 generic argument was supplied --> $DIR/incorrect-number-of-const-args.rs:11:5 | LL | foo::<0>(); - | ^^^ - supplied 1 const argument + | ^^^ - supplied 1 generic argument | | - | expected 2 const arguments + | expected 2 generic arguments | -note: function defined here, with 2 const parameters: `X`, `Y` +note: function defined here, with 2 generic parameters: `X`, `Y` --> $DIR/incorrect-number-of-const-args.rs:6:4 | LL | fn foo<const X: usize, const Y: usize>() -> usize { | ^^^ - - -help: add missing const argument +help: add missing generic argument | LL | foo::<0, Y>(); | ^^^ -error[E0107]: this function takes 2 const arguments but 3 const arguments were supplied +error[E0107]: this function takes 2 generic arguments but 3 generic arguments were supplied --> $DIR/incorrect-number-of-const-args.rs:14:5 | LL | foo::<0, 0, 0>(); - | ^^^ --- help: remove this const argument + | ^^^ - help: remove this generic argument | | - | expected 2 const arguments + | expected 2 generic arguments | -note: function defined here, with 2 const parameters: `X`, `Y` +note: function defined here, with 2 generic parameters: `X`, `Y` --> $DIR/incorrect-number-of-const-args.rs:6:4 | LL | fn foo<const X: usize, const Y: usize>() -> usize { diff --git a/src/test/ui/const-generics/incorrect-number-of-const-args.rs b/src/test/ui/const-generics/incorrect-number-of-const-args.rs index 3114e716845..305559d93fd 100644 --- a/src/test/ui/const-generics/incorrect-number-of-const-args.rs +++ b/src/test/ui/const-generics/incorrect-number-of-const-args.rs @@ -9,8 +9,8 @@ fn foo<const X: usize, const Y: usize>() -> usize { fn main() { foo::<0>(); - //~^ ERROR this function takes 2 const arguments but only 1 const argument was supplied + //~^ ERROR this function takes 2 foo::<0, 0, 0>(); - //~^ ERROR this function takes 2 const arguments but 3 const arguments were supplied + //~^ ERROR this function takes 2 } diff --git a/src/test/ui/const-generics/invalid-const-arg-for-type-param.rs b/src/test/ui/const-generics/invalid-const-arg-for-type-param.rs index b67a1f153ff..7d4dc98f396 100644 --- a/src/test/ui/const-generics/invalid-const-arg-for-type-param.rs +++ b/src/test/ui/const-generics/invalid-const-arg-for-type-param.rs @@ -4,11 +4,11 @@ struct S; fn main() { let _: u32 = 5i32.try_into::<32>().unwrap(); - //~^ ERROR this associated function takes 0 const arguments but 1 const argument was supplied + //~^ ERROR this associated function takes S.f::<0>(); //~^ ERROR no method named `f` S::<0>; - //~^ ERROR this struct takes 0 const arguments but 1 const argument was supplied + //~^ ERROR this struct takes 0 } diff --git a/src/test/ui/const-generics/invalid-const-arg-for-type-param.stderr b/src/test/ui/const-generics/invalid-const-arg-for-type-param.stderr index a75da91caa8..aa5cebd873e 100644 --- a/src/test/ui/const-generics/invalid-const-arg-for-type-param.stderr +++ b/src/test/ui/const-generics/invalid-const-arg-for-type-param.stderr @@ -1,12 +1,12 @@ -error[E0107]: this associated function takes 0 const arguments but 1 const argument was supplied +error[E0107]: this associated function takes 0 generic arguments but 1 generic argument was supplied --> $DIR/invalid-const-arg-for-type-param.rs:6:23 | LL | let _: u32 = 5i32.try_into::<32>().unwrap(); | ^^^^^^^^------ help: remove these generics | | - | expected 0 const arguments + | expected 0 generic arguments | -note: associated function defined here, with 0 const parameters +note: associated function defined here, with 0 generic parameters --> $SRC_DIR/core/src/convert/mod.rs:LL:COL | LL | fn try_into(self) -> Result<T, Self::Error>; @@ -21,15 +21,15 @@ LL | struct S; LL | S.f::<0>(); | ^ method not found in `S` -error[E0107]: this struct takes 0 const arguments but 1 const argument was supplied +error[E0107]: this struct takes 0 generic arguments but 1 generic argument was supplied --> $DIR/invalid-const-arg-for-type-param.rs:12:5 | LL | S::<0>; | ^----- help: remove these generics | | - | expected 0 const arguments + | expected 0 generic arguments | -note: struct defined here, with 0 const parameters +note: struct defined here, with 0 generic parameters --> $DIR/invalid-const-arg-for-type-param.rs:3:8 | LL | struct S; diff --git a/src/test/ui/const-generics/invalid-constant-in-args.stderr b/src/test/ui/const-generics/invalid-constant-in-args.stderr index 57c1af36d61..1400d2bf5a7 100644 --- a/src/test/ui/const-generics/invalid-constant-in-args.stderr +++ b/src/test/ui/const-generics/invalid-constant-in-args.stderr @@ -2,7 +2,7 @@ error[E0107]: this struct takes 1 generic argument but 2 generic arguments were --> $DIR/invalid-constant-in-args.rs:4:12 | LL | let _: Cell<&str, "a"> = Cell::new(""); - | ^^^^ ----- help: remove this generic argument + | ^^^^ --- help: remove this generic argument | | | expected 1 generic argument | diff --git a/src/test/ui/const-generics/issues/issue-76595.rs b/src/test/ui/const-generics/issues/issue-76595.rs index d95d675ddad..2d7051c3a24 100644 --- a/src/test/ui/const-generics/issues/issue-76595.rs +++ b/src/test/ui/const-generics/issues/issue-76595.rs @@ -13,5 +13,5 @@ fn test<T, const P: usize>() where Bool<{core::mem::size_of::<T>() > 4}>: True { fn main() { test::<2>(); - //~^ ERROR this function takes 2 generic arguments but only 1 generic argument was supplied + //~^ ERROR this function takes 2 generic arguments } diff --git a/src/test/ui/const-generics/issues/issue-76595.stderr b/src/test/ui/const-generics/issues/issue-76595.stderr index 9d95e5a014d..01a0f6bcba9 100644 --- a/src/test/ui/const-generics/issues/issue-76595.stderr +++ b/src/test/ui/const-generics/issues/issue-76595.stderr @@ -1,4 +1,4 @@ -error[E0107]: this function takes 2 generic arguments but only 1 generic argument was supplied +error[E0107]: this function takes 2 generic arguments but 1 generic argument was supplied --> $DIR/issue-76595.rs:15:5 | LL | test::<2>(); diff --git a/src/test/ui/constructor-lifetime-args.rs b/src/test/ui/constructor-lifetime-args.rs index d038269382b..a824a44c9c2 100644 --- a/src/test/ui/constructor-lifetime-args.rs +++ b/src/test/ui/constructor-lifetime-args.rs @@ -15,12 +15,12 @@ enum E<'a, 'b> { fn main() { S(&0, &0); // OK S::<'static>(&0, &0); - //~^ ERROR this struct takes 2 lifetime arguments but only 1 lifetime argument was supplied + //~^ ERROR this struct takes 2 lifetime arguments S::<'static, 'static, 'static>(&0, &0); - //~^ ERROR this struct takes 2 lifetime arguments but 3 lifetime arguments were supplied + //~^ ERROR this struct takes 2 lifetime arguments E::V(&0); // OK E::V::<'static>(&0); - //~^ ERROR this enum takes 2 lifetime arguments but only 1 lifetime argument was supplied + //~^ ERROR this enum takes 2 lifetime arguments E::V::<'static, 'static, 'static>(&0); - //~^ ERROR this enum takes 2 lifetime arguments but 3 lifetime arguments were supplied + //~^ ERROR this enum takes 2 lifetime arguments } diff --git a/src/test/ui/constructor-lifetime-args.stderr b/src/test/ui/constructor-lifetime-args.stderr index 378b07694e6..f33aa4953e4 100644 --- a/src/test/ui/constructor-lifetime-args.stderr +++ b/src/test/ui/constructor-lifetime-args.stderr @@ -1,4 +1,4 @@ -error[E0107]: this struct takes 2 lifetime arguments but only 1 lifetime argument was supplied +error[E0107]: this struct takes 2 lifetime arguments but 1 lifetime argument was supplied --> $DIR/constructor-lifetime-args.rs:17:5 | LL | S::<'static>(&0, &0); @@ -20,7 +20,7 @@ error[E0107]: this struct takes 2 lifetime arguments but 3 lifetime arguments we --> $DIR/constructor-lifetime-args.rs:19:5 | LL | S::<'static, 'static, 'static>(&0, &0); - | ^ --------- help: remove this lifetime argument + | ^ ------- help: remove this lifetime argument | | | expected 2 lifetime arguments | @@ -30,7 +30,7 @@ note: struct defined here, with 2 lifetime parameters: `'a`, `'b` LL | struct S<'a, 'b>(&'a u8, &'b u8); | ^ -- -- -error[E0107]: this enum takes 2 lifetime arguments but only 1 lifetime argument was supplied +error[E0107]: this enum takes 2 lifetime arguments but 1 lifetime argument was supplied --> $DIR/constructor-lifetime-args.rs:22:8 | LL | E::V::<'static>(&0); @@ -52,7 +52,7 @@ error[E0107]: this enum takes 2 lifetime arguments but 3 lifetime arguments were --> $DIR/constructor-lifetime-args.rs:24:8 | LL | E::V::<'static, 'static, 'static>(&0); - | ^ --------- help: remove this lifetime argument + | ^ ------- help: remove this lifetime argument | | | expected 2 lifetime arguments | diff --git a/src/test/ui/consts/const-eval/erroneous-const.rs b/src/test/ui/consts/const-eval/erroneous-const.rs index b79ce4a523f..bee5a7cb3ba 100644 --- a/src/test/ui/consts/const-eval/erroneous-const.rs +++ b/src/test/ui/consts/const-eval/erroneous-const.rs @@ -10,6 +10,8 @@ impl<T> PrintName<T> { const fn no_codegen<T>() { if false { + // This bad constant is only used in dead code in a no-codegen function... and yet we still + // must make sure that the build fails. let _ = PrintName::<T>::VOID; //~ERROR could not evaluate static initializer } } diff --git a/src/test/ui/consts/const-eval/erroneous-const.stderr b/src/test/ui/consts/const-eval/erroneous-const.stderr index 16ed596628b..7e2a60929c7 100644 --- a/src/test/ui/consts/const-eval/erroneous-const.stderr +++ b/src/test/ui/consts/const-eval/erroneous-const.stderr @@ -27,16 +27,16 @@ LL | #![warn(const_err, unconditional_panic)] = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> error[E0080]: could not evaluate static initializer - --> $DIR/erroneous-const.rs:13:17 + --> $DIR/erroneous-const.rs:15:17 | LL | let _ = PrintName::<T>::VOID; | ^^^^^^^^^^^^^^^^^^^^ | | | referenced constant has errors - | inside `no_codegen::<i32>` at $DIR/erroneous-const.rs:13:17 + | inside `no_codegen::<i32>` at $DIR/erroneous-const.rs:15:17 ... LL | pub static FOO: () = no_codegen::<i32>(); - | ------------------- inside `FOO` at $DIR/erroneous-const.rs:17:22 + | ------------------- inside `FOO` at $DIR/erroneous-const.rs:19:22 error: aborting due to previous error; 2 warnings emitted diff --git a/src/test/ui/consts/const-eval/erroneous-const2.rs b/src/test/ui/consts/const-eval/erroneous-const2.rs new file mode 100644 index 00000000000..aa0f093bf62 --- /dev/null +++ b/src/test/ui/consts/const-eval/erroneous-const2.rs @@ -0,0 +1,21 @@ +//! Make sure we error on erroneous consts even if they are unused. +#![warn(const_err, unconditional_panic)] + +struct PrintName<T>(T); +impl<T> PrintName<T> { + const VOID: () = [()][2]; //~WARN any use of this value will cause an error + //~^ WARN this operation will panic at runtime + //~| WARN this was previously accepted by the compiler but is being phased out +} + +pub static FOO: () = { + if false { + // This bad constant is only used in dead code in a static initializer... and yet we still + // must make sure that the build fails. + let _ = PrintName::<i32>::VOID; //~ERROR could not evaluate static initializer + } +}; + +fn main() { + FOO +} diff --git a/src/test/ui/consts/const-eval/erroneous-const2.stderr b/src/test/ui/consts/const-eval/erroneous-const2.stderr new file mode 100644 index 00000000000..813d3ee249f --- /dev/null +++ b/src/test/ui/consts/const-eval/erroneous-const2.stderr @@ -0,0 +1,37 @@ +warning: this operation will panic at runtime + --> $DIR/erroneous-const2.rs:6:22 + | +LL | const VOID: () = [()][2]; + | ^^^^^^^ index out of bounds: the length is 1 but the index is 2 + | +note: the lint level is defined here + --> $DIR/erroneous-const2.rs:2:20 + | +LL | #![warn(const_err, unconditional_panic)] + | ^^^^^^^^^^^^^^^^^^^ + +warning: any use of this value will cause an error + --> $DIR/erroneous-const2.rs:6:22 + | +LL | const VOID: () = [()][2]; + | -----------------^^^^^^^- + | | + | index out of bounds: the length is 1 but the index is 2 + | +note: the lint level is defined here + --> $DIR/erroneous-const2.rs:2:9 + | +LL | #![warn(const_err, unconditional_panic)] + | ^^^^^^^^^ + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> + +error[E0080]: could not evaluate static initializer + --> $DIR/erroneous-const2.rs:15:17 + | +LL | let _ = PrintName::<i32>::VOID; + | ^^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors + +error: aborting due to previous error; 2 warnings emitted + +For more information about this error, try `rustc --explain E0080`. diff --git a/src/test/ui/consts/const-eval/promoted_errors.noopt.stderr b/src/test/ui/consts/const-eval/promoted_errors.noopt.stderr index 6f266801bdb..77e7d484071 100644 --- a/src/test/ui/consts/const-eval/promoted_errors.noopt.stderr +++ b/src/test/ui/consts/const-eval/promoted_errors.noopt.stderr @@ -1,12 +1,12 @@ warning: any use of this value will cause an error - --> $DIR/promoted_errors.rs:13:5 + --> $DIR/promoted_errors.rs:15:5 | LL | 0 - 1 | ^^^^^ | | | attempt to compute `0_u32 - 1_u32`, which would overflow - | inside `overflow` at $DIR/promoted_errors.rs:13:5 - | inside `X` at $DIR/promoted_errors.rs:33:29 + | inside `overflow` at $DIR/promoted_errors.rs:15:5 + | inside `X` at $DIR/promoted_errors.rs:38:29 ... LL | / const X: () = { LL | | let _x: &'static u32 = &overflow(); @@ -18,7 +18,7 @@ LL | | }; | |__- | note: the lint level is defined here - --> $DIR/promoted_errors.rs:9:9 + --> $DIR/promoted_errors.rs:11:9 | LL | #![warn(const_err, arithmetic_overflow, unconditional_panic)] | ^^^^^^^^^ @@ -26,7 +26,7 @@ LL | #![warn(const_err, arithmetic_overflow, unconditional_panic)] = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> warning: any use of this value will cause an error - --> $DIR/promoted_errors.rs:33:28 + --> $DIR/promoted_errors.rs:38:28 | LL | / const X: () = { LL | | let _x: &'static u32 = &overflow(); diff --git a/src/test/ui/consts/const-eval/promoted_errors.opt.stderr b/src/test/ui/consts/const-eval/promoted_errors.opt.stderr index 892f57bfdfc..6b17346e6ec 100644 --- a/src/test/ui/consts/const-eval/promoted_errors.opt.stderr +++ b/src/test/ui/consts/const-eval/promoted_errors.opt.stderr @@ -1,12 +1,12 @@ warning: any use of this value will cause an error - --> $DIR/promoted_errors.rs:18:5 + --> $DIR/promoted_errors.rs:20:5 | LL | 1 / 0 | ^^^^^ | | | attempt to divide `1_i32` by zero - | inside `div_by_zero1` at $DIR/promoted_errors.rs:18:5 - | inside `X` at $DIR/promoted_errors.rs:36:29 + | inside `div_by_zero1` at $DIR/promoted_errors.rs:20:5 + | inside `X` at $DIR/promoted_errors.rs:41:29 ... LL | / const X: () = { LL | | let _x: &'static u32 = &overflow(); @@ -18,7 +18,7 @@ LL | | }; | |__- | note: the lint level is defined here - --> $DIR/promoted_errors.rs:9:9 + --> $DIR/promoted_errors.rs:11:9 | LL | #![warn(const_err, arithmetic_overflow, unconditional_panic)] | ^^^^^^^^^ @@ -26,7 +26,7 @@ LL | #![warn(const_err, arithmetic_overflow, unconditional_panic)] = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> warning: any use of this value will cause an error - --> $DIR/promoted_errors.rs:36:28 + --> $DIR/promoted_errors.rs:41:28 | LL | / const X: () = { LL | | let _x: &'static u32 = &overflow(); diff --git a/src/test/ui/consts/const-eval/promoted_errors.opt_with_overflow_checks.stderr b/src/test/ui/consts/const-eval/promoted_errors.opt_with_overflow_checks.stderr index 6f266801bdb..77e7d484071 100644 --- a/src/test/ui/consts/const-eval/promoted_errors.opt_with_overflow_checks.stderr +++ b/src/test/ui/consts/const-eval/promoted_errors.opt_with_overflow_checks.stderr @@ -1,12 +1,12 @@ warning: any use of this value will cause an error - --> $DIR/promoted_errors.rs:13:5 + --> $DIR/promoted_errors.rs:15:5 | LL | 0 - 1 | ^^^^^ | | | attempt to compute `0_u32 - 1_u32`, which would overflow - | inside `overflow` at $DIR/promoted_errors.rs:13:5 - | inside `X` at $DIR/promoted_errors.rs:33:29 + | inside `overflow` at $DIR/promoted_errors.rs:15:5 + | inside `X` at $DIR/promoted_errors.rs:38:29 ... LL | / const X: () = { LL | | let _x: &'static u32 = &overflow(); @@ -18,7 +18,7 @@ LL | | }; | |__- | note: the lint level is defined here - --> $DIR/promoted_errors.rs:9:9 + --> $DIR/promoted_errors.rs:11:9 | LL | #![warn(const_err, arithmetic_overflow, unconditional_panic)] | ^^^^^^^^^ @@ -26,7 +26,7 @@ LL | #![warn(const_err, arithmetic_overflow, unconditional_panic)] = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> warning: any use of this value will cause an error - --> $DIR/promoted_errors.rs:33:28 + --> $DIR/promoted_errors.rs:38:28 | LL | / const X: () = { LL | | let _x: &'static u32 = &overflow(); diff --git a/src/test/ui/consts/const-eval/promoted_errors.rs b/src/test/ui/consts/const-eval/promoted_errors.rs index 7840f67c216..5bafea1ed46 100644 --- a/src/test/ui/consts/const-eval/promoted_errors.rs +++ b/src/test/ui/consts/const-eval/promoted_errors.rs @@ -6,6 +6,8 @@ // build-pass // ignore-pass (test emits codegen-time warnings and verifies that they are not errors) +//! This test ensures that when we promote code that fails to evaluate, the build still succeeds. + #![warn(const_err, arithmetic_overflow, unconditional_panic)] // The only way to have promoteds that fail is in `const fn` called from `const`/`static`. @@ -29,6 +31,9 @@ const fn oob() -> i32 { [1, 2, 3][4] } +// An unused constant containing failing promoteds. +// This should work as long as `const_err` can be turned into just a warning; +// once it turns into a hard error, just remove `X`. const X: () = { let _x: &'static u32 = &overflow(); //[opt_with_overflow_checks,noopt]~^ WARN any use of this value will cause an error @@ -41,4 +46,21 @@ const X: () = { let _x: &'static i32 = &oob(); }; -fn main() {} +const fn mk_false() -> bool { false } + +// An actually used constant referencing failing promoteds in dead code. +// This needs to always work. +const Y: () = { + if mk_false() { + let _x: &'static u32 = &overflow(); + let _x: &'static i32 = &div_by_zero1(); + let _x: &'static i32 = &div_by_zero2(); + let _x: &'static i32 = &div_by_zero3(); + let _x: &'static i32 = &oob(); + } + () +}; + +fn main() { + let _y = Y; +} diff --git a/src/test/ui/deprecation/deprecation-lint.stderr b/src/test/ui/deprecation/deprecation-lint.stderr index 959cf93bac0..3699a939e27 100644 --- a/src/test/ui/deprecation/deprecation-lint.stderr +++ b/src/test/ui/deprecation/deprecation-lint.stderr @@ -359,16 +359,16 @@ LL | foo.method_deprecated(); | ^^^^^^^^^^^^^^^^^ error: use of deprecated associated function `deprecation_lint::MethodTester::method_deprecated`: text - --> $DIR/deprecation-lint.rs:18:9 + --> $DIR/deprecation-lint.rs:18:14 | LL | Foo::method_deprecated(&foo); - | ^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^ error: use of deprecated associated function `deprecation_lint::MethodTester::method_deprecated`: text - --> $DIR/deprecation-lint.rs:19:9 + --> $DIR/deprecation-lint.rs:19:16 | LL | <Foo>::method_deprecated(&foo); - | ^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^ error: use of deprecated associated function `deprecation_lint::Trait::trait_deprecated`: text --> $DIR/deprecation-lint.rs:20:13 @@ -377,10 +377,10 @@ LL | foo.trait_deprecated(); | ^^^^^^^^^^^^^^^^ error: use of deprecated associated function `deprecation_lint::Trait::trait_deprecated`: text - --> $DIR/deprecation-lint.rs:22:9 + --> $DIR/deprecation-lint.rs:22:16 | LL | <Foo>::trait_deprecated(&foo); - | ^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^ error: use of deprecated associated function `deprecation_lint::MethodTester::method_deprecated_text`: text --> $DIR/deprecation-lint.rs:26:13 @@ -389,16 +389,16 @@ LL | ... foo.method_deprecated_text(); | ^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated associated function `deprecation_lint::MethodTester::method_deprecated_text`: text - --> $DIR/deprecation-lint.rs:27:9 + --> $DIR/deprecation-lint.rs:27:14 | LL | ... Foo::method_deprecated_text(&foo); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated associated function `deprecation_lint::MethodTester::method_deprecated_text`: text - --> $DIR/deprecation-lint.rs:28:9 + --> $DIR/deprecation-lint.rs:28:16 | LL | ... <Foo>::method_deprecated_text(&foo); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated associated function `deprecation_lint::Trait::trait_deprecated_text`: text --> $DIR/deprecation-lint.rs:29:13 @@ -407,10 +407,10 @@ LL | foo.trait_deprecated_text(); | ^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated associated function `deprecation_lint::Trait::trait_deprecated_text`: text - --> $DIR/deprecation-lint.rs:31:9 + --> $DIR/deprecation-lint.rs:31:16 | LL | ... <Foo>::trait_deprecated_text(&foo); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated field `deprecation_lint::DeprecatedStruct::i`: text --> $DIR/deprecation-lint.rs:35:13 @@ -431,10 +431,10 @@ LL | foo.trait_deprecated(); | ^^^^^^^^^^^^^^^^ error: use of deprecated associated function `deprecation_lint::Trait::trait_deprecated`: text - --> $DIR/deprecation-lint.rs:66:9 + --> $DIR/deprecation-lint.rs:66:16 | LL | <Foo>::trait_deprecated(&foo); - | ^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^ error: use of deprecated associated function `deprecation_lint::Trait::trait_deprecated_text`: text --> $DIR/deprecation-lint.rs:68:13 @@ -443,10 +443,10 @@ LL | foo.trait_deprecated_text(); | ^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated associated function `deprecation_lint::Trait::trait_deprecated_text`: text - --> $DIR/deprecation-lint.rs:70:9 + --> $DIR/deprecation-lint.rs:70:16 | LL | ... <Foo>::trait_deprecated_text(&foo); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated associated function `deprecation_lint::Trait::trait_deprecated`: text --> $DIR/deprecation-lint.rs:75:13 @@ -551,16 +551,16 @@ LL | foo.method_deprecated(); | ^^^^^^^^^^^^^^^^^ error: use of deprecated associated function `this_crate::MethodTester::method_deprecated`: text - --> $DIR/deprecation-lint.rs:247:9 + --> $DIR/deprecation-lint.rs:247:14 | LL | Foo::method_deprecated(&foo); - | ^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^ error: use of deprecated associated function `this_crate::MethodTester::method_deprecated`: text - --> $DIR/deprecation-lint.rs:248:9 + --> $DIR/deprecation-lint.rs:248:16 | LL | <Foo>::method_deprecated(&foo); - | ^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^ error: use of deprecated associated function `this_crate::Trait::trait_deprecated`: text --> $DIR/deprecation-lint.rs:249:13 @@ -569,10 +569,10 @@ LL | foo.trait_deprecated(); | ^^^^^^^^^^^^^^^^ error: use of deprecated associated function `this_crate::Trait::trait_deprecated`: text - --> $DIR/deprecation-lint.rs:251:9 + --> $DIR/deprecation-lint.rs:251:16 | LL | <Foo>::trait_deprecated(&foo); - | ^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^ error: use of deprecated associated function `this_crate::MethodTester::method_deprecated_text`: text --> $DIR/deprecation-lint.rs:255:13 @@ -581,16 +581,16 @@ LL | ... foo.method_deprecated_text(); | ^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated associated function `this_crate::MethodTester::method_deprecated_text`: text - --> $DIR/deprecation-lint.rs:256:9 + --> $DIR/deprecation-lint.rs:256:14 | LL | ... Foo::method_deprecated_text(&foo); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated associated function `this_crate::MethodTester::method_deprecated_text`: text - --> $DIR/deprecation-lint.rs:257:9 + --> $DIR/deprecation-lint.rs:257:16 | LL | ... <Foo>::method_deprecated_text(&foo); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated associated function `this_crate::Trait::trait_deprecated_text`: text --> $DIR/deprecation-lint.rs:258:13 @@ -599,10 +599,10 @@ LL | foo.trait_deprecated_text(); | ^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated associated function `this_crate::Trait::trait_deprecated_text`: text - --> $DIR/deprecation-lint.rs:260:9 + --> $DIR/deprecation-lint.rs:260:16 | LL | <Foo>::trait_deprecated_text(&foo); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated field `this_crate::DeprecatedStruct::i`: text --> $DIR/deprecation-lint.rs:269:13 @@ -623,10 +623,10 @@ LL | foo.trait_deprecated(); | ^^^^^^^^^^^^^^^^ error: use of deprecated associated function `this_crate::Trait::trait_deprecated`: text - --> $DIR/deprecation-lint.rs:293:9 + --> $DIR/deprecation-lint.rs:293:16 | LL | <Foo>::trait_deprecated(&foo); - | ^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^ error: use of deprecated associated function `this_crate::Trait::trait_deprecated_text`: text --> $DIR/deprecation-lint.rs:295:13 @@ -635,10 +635,10 @@ LL | foo.trait_deprecated_text(); | ^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated associated function `this_crate::Trait::trait_deprecated_text`: text - --> $DIR/deprecation-lint.rs:297:9 + --> $DIR/deprecation-lint.rs:297:16 | LL | <Foo>::trait_deprecated_text(&foo); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated associated function `this_crate::Trait::trait_deprecated`: text --> $DIR/deprecation-lint.rs:302:13 diff --git a/src/test/ui/deprecation/issue-84637-deprecated-associated-function.fixed b/src/test/ui/deprecation/issue-84637-deprecated-associated-function.fixed new file mode 100644 index 00000000000..99a2b09614f --- /dev/null +++ b/src/test/ui/deprecation/issue-84637-deprecated-associated-function.fixed @@ -0,0 +1,9 @@ +// run-rustfix + +#![deny(deprecated)] + +fn main() { + let _foo = str::trim_start(" aoeu"); //~ ERROR use of deprecated associated function `core::str::<impl str>::trim_left`: superseded by `trim_start` [deprecated] + + let _bar = " aoeu".trim_start(); //~ ERROR use of deprecated associated function `core::str::<impl str>::trim_left`: superseded by `trim_start` [deprecated] +} diff --git a/src/test/ui/deprecation/issue-84637-deprecated-associated-function.rs b/src/test/ui/deprecation/issue-84637-deprecated-associated-function.rs new file mode 100644 index 00000000000..62bf84aa3ea --- /dev/null +++ b/src/test/ui/deprecation/issue-84637-deprecated-associated-function.rs @@ -0,0 +1,9 @@ +// run-rustfix + +#![deny(deprecated)] + +fn main() { + let _foo = str::trim_left(" aoeu"); //~ ERROR use of deprecated associated function `core::str::<impl str>::trim_left`: superseded by `trim_start` [deprecated] + + let _bar = " aoeu".trim_left(); //~ ERROR use of deprecated associated function `core::str::<impl str>::trim_left`: superseded by `trim_start` [deprecated] +} diff --git a/src/test/ui/deprecation/issue-84637-deprecated-associated-function.stderr b/src/test/ui/deprecation/issue-84637-deprecated-associated-function.stderr new file mode 100644 index 00000000000..e65d21bb09b --- /dev/null +++ b/src/test/ui/deprecation/issue-84637-deprecated-associated-function.stderr @@ -0,0 +1,20 @@ +error: use of deprecated associated function `core::str::<impl str>::trim_left`: superseded by `trim_start` + --> $DIR/issue-84637-deprecated-associated-function.rs:6:21 + | +LL | let _foo = str::trim_left(" aoeu"); + | ^^^^^^^^^ help: replace the use of the deprecated associated function: `trim_start` + | +note: the lint level is defined here + --> $DIR/issue-84637-deprecated-associated-function.rs:3:9 + | +LL | #![deny(deprecated)] + | ^^^^^^^^^^ + +error: use of deprecated associated function `core::str::<impl str>::trim_left`: superseded by `trim_start` + --> $DIR/issue-84637-deprecated-associated-function.rs:8:26 + | +LL | let _bar = " aoeu".trim_left(); + | ^^^^^^^^^ help: replace the use of the deprecated associated function: `trim_start` + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/error-codes/E0107.rs b/src/test/ui/error-codes/E0107.rs index c3dde72599b..f7f6afa860e 100644 --- a/src/test/ui/error-codes/E0107.rs +++ b/src/test/ui/error-codes/E0107.rs @@ -9,15 +9,15 @@ enum Bar { struct Baz<'a, 'b, 'c> { buzz: Buzz<'a>, - //~^ ERROR this struct takes 2 lifetime arguments but only 1 lifetime argument was supplied + //~^ ERROR this struct takes 2 lifetime arguments //~| HELP add missing lifetime argument bar: Bar<'a>, - //~^ ERROR this enum takes 0 lifetime arguments but 1 lifetime argument was supplied + //~^ ERROR this enum takes 0 lifetime arguments //~| HELP remove these generics foo2: Foo<'a, 'b, 'c>, - //~^ ERROR this struct takes 1 lifetime argument but 3 lifetime arguments were supplied + //~^ ERROR this struct takes 1 lifetime argument //~| HELP remove these lifetime arguments } diff --git a/src/test/ui/error-codes/E0107.stderr b/src/test/ui/error-codes/E0107.stderr index 30a2768d060..299776b08f2 100644 --- a/src/test/ui/error-codes/E0107.stderr +++ b/src/test/ui/error-codes/E0107.stderr @@ -1,4 +1,4 @@ -error[E0107]: this struct takes 2 lifetime arguments but only 1 lifetime argument was supplied +error[E0107]: this struct takes 2 lifetime arguments but 1 lifetime argument was supplied --> $DIR/E0107.rs:11:11 | LL | buzz: Buzz<'a>, @@ -13,7 +13,7 @@ LL | struct Buzz<'a, 'b>(&'a str, &'b str); | ^^^^ -- -- help: add missing lifetime argument | -LL | buzz: Buzz<'a, 'b>, +LL | buzz: Buzz<'a, 'a>, | ^^^^ error[E0107]: this enum takes 0 lifetime arguments but 1 lifetime argument was supplied @@ -34,7 +34,7 @@ error[E0107]: this struct takes 1 lifetime argument but 3 lifetime arguments wer --> $DIR/E0107.rs:19:11 | LL | foo2: Foo<'a, 'b, 'c>, - | ^^^ -------- help: remove these lifetime arguments + | ^^^ ------ help: remove these lifetime arguments | | | expected 1 lifetime argument | diff --git a/src/test/ui/feature-gates/feature-gate-const_fn.rs b/src/test/ui/feature-gates/feature-gate-const_fn.rs deleted file mode 100644 index b97aa214f84..00000000000 --- a/src/test/ui/feature-gates/feature-gate-const_fn.rs +++ /dev/null @@ -1,35 +0,0 @@ -// Test use of advanced const fn without the `const_fn` feature gate. - -const fn foo() -> usize { 0 } // ok - -trait Foo { - const fn foo() -> u32; //~ ERROR functions in traits cannot be declared const - const fn bar() -> u32 { 0 } //~ ERROR functions in traits cannot be declared const -} - -impl Foo for u32 { - const fn foo() -> u32 { 0 } //~ ERROR functions in traits cannot be declared const -} - -trait Bar {} - -impl dyn Bar { - const fn baz() -> u32 { 0 } // ok -} - -static FOO: usize = foo(); -const BAR: usize = foo(); - -macro_rules! constant { - ($n:ident: $t:ty = $v:expr) => { - const $n: $t = $v; - } -} - -constant! { - BAZ: usize = foo() -} - -fn main() { - let x: [usize; foo()] = []; -} diff --git a/src/test/ui/feature-gates/feature-gate-const_fn.stderr b/src/test/ui/feature-gates/feature-gate-const_fn.stderr deleted file mode 100644 index 1e7fd669b1d..00000000000 --- a/src/test/ui/feature-gates/feature-gate-const_fn.stderr +++ /dev/null @@ -1,21 +0,0 @@ -error[E0379]: functions in traits cannot be declared const - --> $DIR/feature-gate-const_fn.rs:6:5 - | -LL | const fn foo() -> u32; - | ^^^^^ functions in traits cannot be const - -error[E0379]: functions in traits cannot be declared const - --> $DIR/feature-gate-const_fn.rs:7:5 - | -LL | const fn bar() -> u32 { 0 } - | ^^^^^ functions in traits cannot be const - -error[E0379]: functions in traits cannot be declared const - --> $DIR/feature-gate-const_fn.rs:11:5 - | -LL | const fn foo() -> u32 { 0 } - | ^^^^^ functions in traits cannot be const - -error: aborting due to 3 previous errors - -For more information about this error, try `rustc --explain E0379`. diff --git a/src/test/ui/feature-gates/feature-gate-rustc_const_unstable.rs b/src/test/ui/feature-gates/feature-gate-rustc_const_unstable.rs index 3296a17a0b7..d7daaaaa101 100644 --- a/src/test/ui/feature-gates/feature-gate-rustc_const_unstable.rs +++ b/src/test/ui/feature-gates/feature-gate-rustc_const_unstable.rs @@ -1,7 +1,5 @@ // Test internal const fn feature gate. -#![feature(const_fn)] - #[rustc_const_unstable(feature="fzzzzzt")] //~ stability attributes may not be used outside pub const fn bazinga() {} diff --git a/src/test/ui/feature-gates/feature-gate-rustc_const_unstable.stderr b/src/test/ui/feature-gates/feature-gate-rustc_const_unstable.stderr index 9df926dcf90..48493b786d6 100644 --- a/src/test/ui/feature-gates/feature-gate-rustc_const_unstable.stderr +++ b/src/test/ui/feature-gates/feature-gate-rustc_const_unstable.stderr @@ -1,5 +1,5 @@ error[E0734]: stability attributes may not be used outside of the standard library - --> $DIR/feature-gate-rustc_const_unstable.rs:5:1 + --> $DIR/feature-gate-rustc_const_unstable.rs:3:1 | LL | #[rustc_const_unstable(feature="fzzzzzt")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/generic-associated-types/gat-trait-path-missing-lifetime.rs b/src/test/ui/generic-associated-types/gat-trait-path-missing-lifetime.rs index e69e355ba48..484790501b9 100644 --- a/src/test/ui/generic-associated-types/gat-trait-path-missing-lifetime.rs +++ b/src/test/ui/generic-associated-types/gat-trait-path-missing-lifetime.rs @@ -3,14 +3,14 @@ trait X { type Y<'a>; - //~^ ERROR missing generics for - //~| ERROR missing generics for fn foo<'a>(t : Self::Y<'a>) -> Self::Y<'a> { t } } impl<T> X for T { fn foo<'a, T1: X<Y = T1>>(t : T1) -> T1::Y<'a> { + //~^ ERROR missing generics for associated type + //~^^ ERROR missing generics for associated type t } } diff --git a/src/test/ui/generic-associated-types/gat-trait-path-missing-lifetime.stderr b/src/test/ui/generic-associated-types/gat-trait-path-missing-lifetime.stderr index 9c6e2ce3e17..56b5551cd3f 100644 --- a/src/test/ui/generic-associated-types/gat-trait-path-missing-lifetime.stderr +++ b/src/test/ui/generic-associated-types/gat-trait-path-missing-lifetime.stderr @@ -8,36 +8,36 @@ LL | #![feature(generic_associated_types)] = note: see issue #44265 <https://github.com/rust-lang/rust/issues/44265> for more information error[E0107]: missing generics for associated type `X::Y` - --> $DIR/gat-trait-path-missing-lifetime.rs:5:8 + --> $DIR/gat-trait-path-missing-lifetime.rs:11:20 | -LL | type Y<'a>; - | ^ expected 1 lifetime argument +LL | fn foo<'a, T1: X<Y = T1>>(t : T1) -> T1::Y<'a> { + | ^ expected 1 lifetime argument | note: associated type defined here, with 1 lifetime parameter: `'a` --> $DIR/gat-trait-path-missing-lifetime.rs:5:8 | LL | type Y<'a>; | ^ -- -help: use angle brackets to add missing lifetime argument +help: add missing lifetime argument | -LL | type Y<'a><'a>; - | ^^^^ +LL | fn foo<'a, T1: X<Y<'a> = T1>>(t : T1) -> T1::Y<'a> { + | ^^^^^ error[E0107]: missing generics for associated type `X::Y` - --> $DIR/gat-trait-path-missing-lifetime.rs:5:8 + --> $DIR/gat-trait-path-missing-lifetime.rs:11:20 | -LL | type Y<'a>; - | ^ expected 1 lifetime argument +LL | fn foo<'a, T1: X<Y = T1>>(t : T1) -> T1::Y<'a> { + | ^ expected 1 lifetime argument | note: associated type defined here, with 1 lifetime parameter: `'a` --> $DIR/gat-trait-path-missing-lifetime.rs:5:8 | LL | type Y<'a>; | ^ -- -help: use angle brackets to add missing lifetime argument +help: add missing lifetime argument | -LL | type Y<'a><'a>; - | ^^^^ +LL | fn foo<'a, T1: X<Y<'a> = T1>>(t : T1) -> T1::Y<'a> { + | ^^^^^ error: aborting due to 2 previous errors; 1 warning emitted diff --git a/src/test/ui/generic-associated-types/gat-trait-path-parenthesised-args.rs b/src/test/ui/generic-associated-types/gat-trait-path-parenthesised-args.rs index 40ed42c9ce0..f1af6860284 100644 --- a/src/test/ui/generic-associated-types/gat-trait-path-parenthesised-args.rs +++ b/src/test/ui/generic-associated-types/gat-trait-path-parenthesised-args.rs @@ -3,13 +3,13 @@ trait X { type Y<'a>; - //~^ ERROR this associated type - //~| ERROR this associated type } fn foo<'a>(arg: Box<dyn X<Y('a) = &'a ()>>) {} //~^ ERROR: lifetime in trait object type must be followed by `+` //~| ERROR: parenthesized generic arguments cannot be used + //~| ERROR this associated type takes 0 generic arguments but 1 generic argument + //~| ERROR this associated type takes 1 lifetime argument but 0 lifetime arguments //~| WARNING: trait objects without an explicit `dyn` are deprecated //~| WARNING: this was previously accepted by the compiler diff --git a/src/test/ui/generic-associated-types/gat-trait-path-parenthesised-args.stderr b/src/test/ui/generic-associated-types/gat-trait-path-parenthesised-args.stderr index 0e95c54d811..72855a74256 100644 --- a/src/test/ui/generic-associated-types/gat-trait-path-parenthesised-args.stderr +++ b/src/test/ui/generic-associated-types/gat-trait-path-parenthesised-args.stderr @@ -1,11 +1,11 @@ error: lifetime in trait object type must be followed by `+` - --> $DIR/gat-trait-path-parenthesised-args.rs:10:29 + --> $DIR/gat-trait-path-parenthesised-args.rs:8:29 | LL | fn foo<'a>(arg: Box<dyn X<Y('a) = &'a ()>>) {} | ^^ error: parenthesized generic arguments cannot be used in associated type constraints - --> $DIR/gat-trait-path-parenthesised-args.rs:10:27 + --> $DIR/gat-trait-path-parenthesised-args.rs:8:27 | LL | fn foo<'a>(arg: Box<dyn X<Y('a) = &'a ()>>) {} | ^^^^^ @@ -20,7 +20,7 @@ LL | #![feature(generic_associated_types)] = note: see issue #44265 <https://github.com/rust-lang/rust/issues/44265> for more information warning: trait objects without an explicit `dyn` are deprecated - --> $DIR/gat-trait-path-parenthesised-args.rs:10:29 + --> $DIR/gat-trait-path-parenthesised-args.rs:8:29 | LL | fn foo<'a>(arg: Box<dyn X<Y('a) = &'a ()>>) {} | ^^ help: use `dyn`: `dyn 'a` @@ -30,10 +30,10 @@ LL | fn foo<'a>(arg: Box<dyn X<Y('a) = &'a ()>>) {} = note: for more information, see issue #80165 <https://github.com/rust-lang/rust/issues/80165> error[E0107]: this associated type takes 1 lifetime argument but 0 lifetime arguments were supplied - --> $DIR/gat-trait-path-parenthesised-args.rs:5:8 + --> $DIR/gat-trait-path-parenthesised-args.rs:8:27 | -LL | type Y<'a>; - | ^ expected 1 lifetime argument +LL | fn foo<'a>(arg: Box<dyn X<Y('a) = &'a ()>>) {} + | ^ expected 1 lifetime argument | note: associated type defined here, with 1 lifetime parameter: `'a` --> $DIR/gat-trait-path-parenthesised-args.rs:5:8 @@ -42,24 +42,18 @@ LL | type Y<'a>; | ^ -- help: add missing lifetime argument | -LL | fn foo<'a>(arg: Box<dyn X<Y('a'a) = &'a ()>>) {} - | ^^ +LL | fn foo<'a>(arg: Box<dyn X<Y('a, 'a) = &'a ()>>) {} + | ^^^ -error[E0107]: this associated type takes 0 type arguments but 1 type argument was supplied - --> $DIR/gat-trait-path-parenthesised-args.rs:5:8 +error[E0107]: this associated type takes 0 generic arguments but 1 generic argument was supplied + --> $DIR/gat-trait-path-parenthesised-args.rs:8:27 | -LL | type Y<'a>; - | ________^- - | | | - | | expected 0 type arguments -LL | | -LL | | -LL | | } -LL | | -LL | | fn foo<'a>(arg: Box<dyn X<Y('a) = &'a ()>>) {} - | |_________________________________________- help: remove these generics +LL | fn foo<'a>(arg: Box<dyn X<Y('a) = &'a ()>>) {} + | ^-------------- help: remove these generics + | | + | expected 0 generic arguments | -note: associated type defined here, with 0 type parameters +note: associated type defined here, with 0 generic parameters --> $DIR/gat-trait-path-parenthesised-args.rs:5:8 | LL | type Y<'a>; diff --git a/src/test/ui/generic-associated-types/issue-71176.rs b/src/test/ui/generic-associated-types/issue-71176.rs index 470476bf476..c767bef1552 100644 --- a/src/test/ui/generic-associated-types/issue-71176.rs +++ b/src/test/ui/generic-associated-types/issue-71176.rs @@ -3,7 +3,6 @@ trait Provider { type A<'a>; - //~^ ERROR: missing generics for associated type } impl Provider for () { @@ -12,6 +11,7 @@ impl Provider for () { struct Holder<B> { inner: Box<dyn Provider<A = B>>, + //~^ ERROR: missing generics for associated type } fn main() { diff --git a/src/test/ui/generic-associated-types/issue-71176.stderr b/src/test/ui/generic-associated-types/issue-71176.stderr index dd19dd4ad8e..2df800d065f 100644 --- a/src/test/ui/generic-associated-types/issue-71176.stderr +++ b/src/test/ui/generic-associated-types/issue-71176.stderr @@ -1,18 +1,18 @@ error[E0107]: missing generics for associated type `Provider::A` - --> $DIR/issue-71176.rs:5:10 + --> $DIR/issue-71176.rs:13:27 | -LL | type A<'a>; - | ^ expected 1 lifetime argument +LL | inner: Box<dyn Provider<A = B>>, + | ^ expected 1 lifetime argument | note: associated type defined here, with 1 lifetime parameter: `'a` --> $DIR/issue-71176.rs:5:10 | LL | type A<'a>; | ^ -- -help: use angle brackets to add missing lifetime argument +help: add missing lifetime argument | -LL | type A<'a><'a>; - | ^^^^ +LL | inner: Box<dyn Provider<A<'a> = B>>, + | ^^^^^ error: aborting due to previous error diff --git a/src/test/ui/generic-associated-types/issue-76535.rs b/src/test/ui/generic-associated-types/issue-76535.rs index 9643c82db77..3db3c38216a 100644 --- a/src/test/ui/generic-associated-types/issue-76535.rs +++ b/src/test/ui/generic-associated-types/issue-76535.rs @@ -5,7 +5,6 @@ pub trait SubTrait {} pub trait SuperTrait { type SubType<'a>: SubTrait; - //~^ ERROR missing generics for associated fn get_sub<'a>(&'a mut self) -> Self::SubType<'a>; } @@ -36,6 +35,7 @@ impl SuperTrait for SuperStruct { fn main() { let sub: Box<dyn SuperTrait<SubType = SubStruct>> = Box::new(SuperStruct::new(0)); - //~^ ERROR the trait `SuperTrait` cannot be made into an object - //~^^ ERROR the trait `SuperTrait` cannot be made into an object + //~^ ERROR missing generics for associated type + //~^^ ERROR the trait + //~| ERROR the trait } diff --git a/src/test/ui/generic-associated-types/issue-76535.stderr b/src/test/ui/generic-associated-types/issue-76535.stderr index d31560f12f0..d9829e59605 100644 --- a/src/test/ui/generic-associated-types/issue-76535.stderr +++ b/src/test/ui/generic-associated-types/issue-76535.stderr @@ -8,23 +8,23 @@ LL | #![feature(generic_associated_types)] = note: see issue #44265 <https://github.com/rust-lang/rust/issues/44265> for more information error[E0107]: missing generics for associated type `SuperTrait::SubType` - --> $DIR/issue-76535.rs:7:10 + --> $DIR/issue-76535.rs:37:33 | -LL | type SubType<'a>: SubTrait; - | ^^^^^^^ expected 1 lifetime argument +LL | let sub: Box<dyn SuperTrait<SubType = SubStruct>> = Box::new(SuperStruct::new(0)); + | ^^^^^^^ expected 1 lifetime argument | note: associated type defined here, with 1 lifetime parameter: `'a` --> $DIR/issue-76535.rs:7:10 | LL | type SubType<'a>: SubTrait; | ^^^^^^^ -- -help: use angle brackets to add missing lifetime argument +help: add missing lifetime argument | -LL | type SubType<'a><'a>: SubTrait; - | ^^^^ +LL | let sub: Box<dyn SuperTrait<SubType<'a> = SubStruct>> = Box::new(SuperStruct::new(0)); + | ^^^^^^^^^^^ error[E0038]: the trait `SuperTrait` cannot be made into an object - --> $DIR/issue-76535.rs:38:14 + --> $DIR/issue-76535.rs:37:14 | LL | let sub: Box<dyn SuperTrait<SubType = SubStruct>> = Box::new(SuperStruct::new(0)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `SuperTrait` cannot be made into an object @@ -39,7 +39,7 @@ LL | type SubType<'a>: SubTrait; | ^^^^^^^ ...because it contains the generic associated type `SubType` error[E0038]: the trait `SuperTrait` cannot be made into an object - --> $DIR/issue-76535.rs:38:57 + --> $DIR/issue-76535.rs:37:57 | LL | let sub: Box<dyn SuperTrait<SubType = SubStruct>> = Box::new(SuperStruct::new(0)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `SuperTrait` cannot be made into an object diff --git a/src/test/ui/generic-associated-types/issue-78671.rs b/src/test/ui/generic-associated-types/issue-78671.rs index 4e47d3c6655..310dd51ea0c 100644 --- a/src/test/ui/generic-associated-types/issue-78671.rs +++ b/src/test/ui/generic-associated-types/issue-78671.rs @@ -3,11 +3,11 @@ trait CollectionFamily { type Member<T>; - //~^ ERROR: missing generics for associated type } fn floatify() { Box::new(Family) as &dyn CollectionFamily<Member=usize> - //~^ the trait `CollectionFamily` cannot be made into an object + //~^ ERROR: missing generics for associated type + //~| ERROR: the trait `CollectionFamily` cannot be made into an object } struct Family; diff --git a/src/test/ui/generic-associated-types/issue-78671.stderr b/src/test/ui/generic-associated-types/issue-78671.stderr index c9febfb59af..0a231d22b62 100644 --- a/src/test/ui/generic-associated-types/issue-78671.stderr +++ b/src/test/ui/generic-associated-types/issue-78671.stderr @@ -1,21 +1,21 @@ error[E0107]: missing generics for associated type `CollectionFamily::Member` - --> $DIR/issue-78671.rs:5:10 + --> $DIR/issue-78671.rs:8:47 | -LL | type Member<T>; - | ^^^^^^ expected 1 type argument +LL | Box::new(Family) as &dyn CollectionFamily<Member=usize> + | ^^^^^^ expected 1 generic argument | -note: associated type defined here, with 1 type parameter: `T` +note: associated type defined here, with 1 generic parameter: `T` --> $DIR/issue-78671.rs:5:10 | LL | type Member<T>; | ^^^^^^ - -help: use angle brackets to add missing type argument +help: add missing generic argument | -LL | type Member<T><T>; - | ^^^ +LL | Box::new(Family) as &dyn CollectionFamily<Member<T>=usize> + | ^^^^^^^^^ error[E0038]: the trait `CollectionFamily` cannot be made into an object - --> $DIR/issue-78671.rs:9:25 + --> $DIR/issue-78671.rs:8:25 | LL | Box::new(Family) as &dyn CollectionFamily<Member=usize> | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `CollectionFamily` cannot be made into an object diff --git a/src/test/ui/generic-associated-types/issue-79422.rs b/src/test/ui/generic-associated-types/issue-79422.rs index b2ba3c24abb..216e426ada2 100644 --- a/src/test/ui/generic-associated-types/issue-79422.rs +++ b/src/test/ui/generic-associated-types/issue-79422.rs @@ -19,7 +19,6 @@ impl<'a, T> RefCont<'a, T> for Box<T> { trait MapLike<K, V> { type VRefCont<'a>: RefCont<'a, V>; - //~^ ERROR missing generics fn get<'a>(&'a self, key: &K) -> Option<Self::VRefCont<'a>>; } @@ -42,6 +41,7 @@ impl<K, V: Default> MapLike<K, V> for Source { fn main() { let m = Box::new(std::collections::BTreeMap::<u8, u8>::new()) as Box<dyn MapLike<u8, u8, VRefCont = dyn RefCont<'_, u8>>>; - //~^^ the trait `MapLike` cannot be made into an object - //~^^ the trait `MapLike` cannot be made into an object + //~^ ERROR missing generics for associated type + //~^^ ERROR the trait + //~^^^^ ERROR the trait } diff --git a/src/test/ui/generic-associated-types/issue-79422.stderr b/src/test/ui/generic-associated-types/issue-79422.stderr index 4973ae19729..11b4a519d51 100644 --- a/src/test/ui/generic-associated-types/issue-79422.stderr +++ b/src/test/ui/generic-associated-types/issue-79422.stderr @@ -1,21 +1,21 @@ error[E0107]: missing generics for associated type `MapLike::VRefCont` - --> $DIR/issue-79422.rs:21:10 + --> $DIR/issue-79422.rs:43:36 | -LL | type VRefCont<'a>: RefCont<'a, V>; - | ^^^^^^^^ expected 1 lifetime argument +LL | as Box<dyn MapLike<u8, u8, VRefCont = dyn RefCont<'_, u8>>>; + | ^^^^^^^^ expected 1 lifetime argument | note: associated type defined here, with 1 lifetime parameter: `'a` --> $DIR/issue-79422.rs:21:10 | LL | type VRefCont<'a>: RefCont<'a, V>; | ^^^^^^^^ -- -help: use angle brackets to add missing lifetime argument +help: add missing lifetime argument | -LL | type VRefCont<'a><'a>: RefCont<'a, V>; - | ^^^^ +LL | as Box<dyn MapLike<u8, u8, VRefCont<'a> = dyn RefCont<'_, u8>>>; + | ^^^^^^^^^^^^ error[E0038]: the trait `MapLike` cannot be made into an object - --> $DIR/issue-79422.rs:44:12 + --> $DIR/issue-79422.rs:43:12 | LL | as Box<dyn MapLike<u8, u8, VRefCont = dyn RefCont<'_, u8>>>; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `MapLike` cannot be made into an object @@ -30,7 +30,7 @@ LL | type VRefCont<'a>: RefCont<'a, V>; | ^^^^^^^^ ...because it contains the generic associated type `VRefCont` error[E0038]: the trait `MapLike` cannot be made into an object - --> $DIR/issue-79422.rs:43:13 + --> $DIR/issue-79422.rs:42:13 | LL | let m = Box::new(std::collections::BTreeMap::<u8, u8>::new()) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `MapLike` cannot be made into an object diff --git a/src/test/ui/generic-associated-types/issue-79636-1.rs b/src/test/ui/generic-associated-types/issue-79636-1.rs index 17f9387e292..412a9f8257c 100644 --- a/src/test/ui/generic-associated-types/issue-79636-1.rs +++ b/src/test/ui/generic-associated-types/issue-79636-1.rs @@ -4,7 +4,6 @@ trait Monad { type Unwrapped; type Wrapped<B>; - //~^ ERROR: missing generics for associated type `Monad::Wrapped` fn bind<B, F>(self, f: F) -> Self::Wrapped<B> { todo!() @@ -15,6 +14,7 @@ fn join<MOuter, MInner, A>(outer: MOuter) -> MOuter::Wrapped<A> where MOuter: Monad<Unwrapped = MInner>, MInner: Monad<Unwrapped = A, Wrapped = MOuter::Wrapped<A>>, + //~^ ERROR: missing generics for associated type `Monad::Wrapped` { outer.bind(|inner| inner) } diff --git a/src/test/ui/generic-associated-types/issue-79636-1.stderr b/src/test/ui/generic-associated-types/issue-79636-1.stderr index 58eeb43f70d..b7a0ef0a6d6 100644 --- a/src/test/ui/generic-associated-types/issue-79636-1.stderr +++ b/src/test/ui/generic-associated-types/issue-79636-1.stderr @@ -1,18 +1,18 @@ error[E0107]: missing generics for associated type `Monad::Wrapped` - --> $DIR/issue-79636-1.rs:6:10 + --> $DIR/issue-79636-1.rs:16:34 | -LL | type Wrapped<B>; - | ^^^^^^^ expected 1 type argument +LL | MInner: Monad<Unwrapped = A, Wrapped = MOuter::Wrapped<A>>, + | ^^^^^^^ expected 1 generic argument | -note: associated type defined here, with 1 type parameter: `B` +note: associated type defined here, with 1 generic parameter: `B` --> $DIR/issue-79636-1.rs:6:10 | LL | type Wrapped<B>; | ^^^^^^^ - -help: use angle brackets to add missing type argument +help: add missing generic argument | -LL | type Wrapped<B><B>; - | ^^^ +LL | MInner: Monad<Unwrapped = A, Wrapped<B> = MOuter::Wrapped<A>>, + | ^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/generic-associated-types/issue-79636-2.rs b/src/test/ui/generic-associated-types/issue-79636-2.rs index 5a654219375..ef39378e78d 100644 --- a/src/test/ui/generic-associated-types/issue-79636-2.rs +++ b/src/test/ui/generic-associated-types/issue-79636-2.rs @@ -3,7 +3,6 @@ trait SomeTrait { type Wrapped<A>: SomeTrait; - //~^ ERROR: missing generics for associated type `SomeTrait::Wrapped` fn f() -> (); } @@ -11,6 +10,7 @@ trait SomeTrait { fn program<W>() -> () where W: SomeTrait<Wrapped = W>, + //~^ ERROR: missing generics for associated type `SomeTrait::Wrapped` { return W::f(); } diff --git a/src/test/ui/generic-associated-types/issue-79636-2.stderr b/src/test/ui/generic-associated-types/issue-79636-2.stderr index d5e3c56ebb9..d5ba1aaeed5 100644 --- a/src/test/ui/generic-associated-types/issue-79636-2.stderr +++ b/src/test/ui/generic-associated-types/issue-79636-2.stderr @@ -1,18 +1,18 @@ error[E0107]: missing generics for associated type `SomeTrait::Wrapped` - --> $DIR/issue-79636-2.rs:5:10 + --> $DIR/issue-79636-2.rs:12:18 | -LL | type Wrapped<A>: SomeTrait; - | ^^^^^^^ expected 1 type argument +LL | W: SomeTrait<Wrapped = W>, + | ^^^^^^^ expected 1 generic argument | -note: associated type defined here, with 1 type parameter: `A` +note: associated type defined here, with 1 generic parameter: `A` --> $DIR/issue-79636-2.rs:5:10 | LL | type Wrapped<A>: SomeTrait; | ^^^^^^^ - -help: use angle brackets to add missing type argument +help: add missing generic argument | -LL | type Wrapped<A><A>: SomeTrait; - | ^^^ +LL | W: SomeTrait<Wrapped<A> = W>, + | ^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/generic-associated-types/issue-80433.rs b/src/test/ui/generic-associated-types/issue-80433.rs index ea65f05de23..fd81804f234 100644 --- a/src/test/ui/generic-associated-types/issue-80433.rs +++ b/src/test/ui/generic-associated-types/issue-80433.rs @@ -8,7 +8,6 @@ struct E<T> { trait TestMut { type Output<'a>; - //~^ ERROR missing generics fn test_mut<'a>(&'a mut self) -> Self::Output<'a>; } @@ -23,6 +22,7 @@ where } fn test_simpler<'a>(dst: &'a mut impl TestMut<Output = &'a mut f32>) + //~^ ERROR missing generics for associated type { for n in 0i16..100 { *dst.test_mut() = n.into(); diff --git a/src/test/ui/generic-associated-types/issue-80433.stderr b/src/test/ui/generic-associated-types/issue-80433.stderr index 5398920fafd..31483ff0cd6 100644 --- a/src/test/ui/generic-associated-types/issue-80433.stderr +++ b/src/test/ui/generic-associated-types/issue-80433.stderr @@ -1,18 +1,18 @@ error[E0107]: missing generics for associated type `TestMut::Output` - --> $DIR/issue-80433.rs:10:10 + --> $DIR/issue-80433.rs:24:47 | -LL | type Output<'a>; - | ^^^^^^ expected 1 lifetime argument +LL | fn test_simpler<'a>(dst: &'a mut impl TestMut<Output = &'a mut f32>) + | ^^^^^^ expected 1 lifetime argument | note: associated type defined here, with 1 lifetime parameter: `'a` --> $DIR/issue-80433.rs:10:10 | LL | type Output<'a>; | ^^^^^^ -- -help: use angle brackets to add missing lifetime argument +help: add missing lifetime argument | -LL | type Output<'a><'a>; - | ^^^^ +LL | fn test_simpler<'a>(dst: &'a mut impl TestMut<Output<'a> = &'a mut f32>) + | ^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/generic-associated-types/issue-81712-cyclic-traits.rs b/src/test/ui/generic-associated-types/issue-81712-cyclic-traits.rs index 934870afc11..b5512ee6d62 100644 --- a/src/test/ui/generic-associated-types/issue-81712-cyclic-traits.rs +++ b/src/test/ui/generic-associated-types/issue-81712-cyclic-traits.rs @@ -12,10 +12,10 @@ trait B { } trait C { type DType<T>: D<T, CType = Self>; - //~^ ERROR: missing generics for associated type `C::DType` [E0107] } trait D<T> { type CType: C<DType = Self>; + //~^ ERROR missing generics for associated type } fn main() {} diff --git a/src/test/ui/generic-associated-types/issue-81712-cyclic-traits.stderr b/src/test/ui/generic-associated-types/issue-81712-cyclic-traits.stderr index 75f68cd3148..4a7b96db30a 100644 --- a/src/test/ui/generic-associated-types/issue-81712-cyclic-traits.stderr +++ b/src/test/ui/generic-associated-types/issue-81712-cyclic-traits.stderr @@ -1,18 +1,18 @@ error[E0107]: missing generics for associated type `C::DType` - --> $DIR/issue-81712-cyclic-traits.rs:14:10 + --> $DIR/issue-81712-cyclic-traits.rs:17:19 | -LL | type DType<T>: D<T, CType = Self>; - | ^^^^^ expected 1 type argument +LL | type CType: C<DType = Self>; + | ^^^^^ expected 1 generic argument | -note: associated type defined here, with 1 type parameter: `T` +note: associated type defined here, with 1 generic parameter: `T` --> $DIR/issue-81712-cyclic-traits.rs:14:10 | LL | type DType<T>: D<T, CType = Self>; | ^^^^^ - -help: use angle brackets to add missing type argument +help: add missing generic argument | -LL | type DType<T><T>: D<T, CType = Self>; - | ^^^ +LL | type CType: C<DType<T> = Self>; + | ^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/generic-associated-types/issue-81862.rs b/src/test/ui/generic-associated-types/issue-81862.rs new file mode 100644 index 00000000000..02f843b07e2 --- /dev/null +++ b/src/test/ui/generic-associated-types/issue-81862.rs @@ -0,0 +1,13 @@ +#![allow(incomplete_features)] +#![feature(generic_associated_types)] + +trait StreamingIterator { + type Item<'a>; + fn next(&mut self) -> Option<Self::Item>; + //~^ ERROR missing generics for associated type +} + +fn main() {} + +// call stack from back to front: +// create_substs_for_assoc_ty -> qpath_to_ty -> res_to_ty -> ast_ty_to_ty -> ty_of_fn diff --git a/src/test/ui/generic-associated-types/issue-81862.stderr b/src/test/ui/generic-associated-types/issue-81862.stderr new file mode 100644 index 00000000000..d7b904165c0 --- /dev/null +++ b/src/test/ui/generic-associated-types/issue-81862.stderr @@ -0,0 +1,19 @@ +error[E0107]: missing generics for associated type `StreamingIterator::Item` + --> $DIR/issue-81862.rs:6:40 + | +LL | fn next(&mut self) -> Option<Self::Item>; + | ^^^^ expected 1 lifetime argument + | +note: associated type defined here, with 1 lifetime parameter: `'a` + --> $DIR/issue-81862.rs:5:10 + | +LL | type Item<'a>; + | ^^^^ -- +help: add missing lifetime argument + | +LL | fn next(&mut self) -> Option<Self::Item<'_>>; + | ^^^^^^^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0107`. diff --git a/src/test/ui/generic-associated-types/missing_lifetime_args.rs b/src/test/ui/generic-associated-types/missing_lifetime_args.rs new file mode 100644 index 00000000000..de24361dfde --- /dev/null +++ b/src/test/ui/generic-associated-types/missing_lifetime_args.rs @@ -0,0 +1,23 @@ +#![feature(generic_associated_types)] +//~^ WARNING the feature `generic_associated_types` + +trait X { + type Y<'a, 'b>; +} + +struct Foo<'a, 'b, 'c> { + a: &'a u32, + b: &'b str, + c: &'c str, +} + +fn foo<'c, 'd>(_arg: Box<dyn X<Y = (&'c u32, &'d u32)>>) {} +//~^ ERROR missing generics for associated type + +fn bar<'a, 'b, 'c>(_arg: Foo<'a, 'b>) {} +//~^ ERROR this struct takes 3 lifetime arguments but 2 lifetime + +fn f<'a>(_arg: Foo<'a>) {} +//~^ ERROR this struct takes 3 lifetime arguments but 1 lifetime + +fn main() {} diff --git a/src/test/ui/generic-associated-types/missing_lifetime_args.stderr b/src/test/ui/generic-associated-types/missing_lifetime_args.stderr new file mode 100644 index 00000000000..73829594c82 --- /dev/null +++ b/src/test/ui/generic-associated-types/missing_lifetime_args.stderr @@ -0,0 +1,64 @@ +warning: the feature `generic_associated_types` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/missing_lifetime_args.rs:1:12 + | +LL | #![feature(generic_associated_types)] + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: `#[warn(incomplete_features)]` on by default + = note: see issue #44265 <https://github.com/rust-lang/rust/issues/44265> for more information + +error[E0107]: missing generics for associated type `X::Y` + --> $DIR/missing_lifetime_args.rs:14:32 + | +LL | fn foo<'c, 'd>(_arg: Box<dyn X<Y = (&'c u32, &'d u32)>>) {} + | ^ expected 2 lifetime arguments + | +note: associated type defined here, with 2 lifetime parameters: `'a`, `'b` + --> $DIR/missing_lifetime_args.rs:5:10 + | +LL | type Y<'a, 'b>; + | ^ -- -- +help: add missing lifetime arguments + | +LL | fn foo<'c, 'd>(_arg: Box<dyn X<Y<'c, 'd> = (&'c u32, &'d u32)>>) {} + | ^^^^^^^^^ + +error[E0107]: this struct takes 3 lifetime arguments but 2 lifetime arguments were supplied + --> $DIR/missing_lifetime_args.rs:17:26 + | +LL | fn bar<'a, 'b, 'c>(_arg: Foo<'a, 'b>) {} + | ^^^ -- -- supplied 2 lifetime arguments + | | + | expected 3 lifetime arguments + | +note: struct defined here, with 3 lifetime parameters: `'a`, `'b`, `'c` + --> $DIR/missing_lifetime_args.rs:8:8 + | +LL | struct Foo<'a, 'b, 'c> { + | ^^^ -- -- -- +help: add missing lifetime argument + | +LL | fn bar<'a, 'b, 'c>(_arg: Foo<'a, 'b, 'a>) {} + | ^^^^ + +error[E0107]: this struct takes 3 lifetime arguments but 1 lifetime argument was supplied + --> $DIR/missing_lifetime_args.rs:20:16 + | +LL | fn f<'a>(_arg: Foo<'a>) {} + | ^^^ -- supplied 1 lifetime argument + | | + | expected 3 lifetime arguments + | +note: struct defined here, with 3 lifetime parameters: `'a`, `'b`, `'c` + --> $DIR/missing_lifetime_args.rs:8:8 + | +LL | struct Foo<'a, 'b, 'c> { + | ^^^ -- -- -- +help: add missing lifetime arguments + | +LL | fn f<'a>(_arg: Foo<'a, 'b, 'c>) {} + | ^^^^^^^^ + +error: aborting due to 3 previous errors; 1 warning emitted + +For more information about this error, try `rustc --explain E0107`. diff --git a/src/test/ui/generic-associated-types/missing_lifetime_const.rs b/src/test/ui/generic-associated-types/missing_lifetime_const.rs new file mode 100644 index 00000000000..37cb7cab121 --- /dev/null +++ b/src/test/ui/generic-associated-types/missing_lifetime_const.rs @@ -0,0 +1,13 @@ +#![feature(generic_associated_types)] +//~^ WARNING the feature + +trait Foo { + type Assoc<'a, const N: usize>; +} + +fn foo<T: Foo>() { + let _: <T as Foo>::Assoc<3>; + //~^ ERROR this associated type +} + +fn main() {} diff --git a/src/test/ui/generic-associated-types/missing_lifetime_const.stderr b/src/test/ui/generic-associated-types/missing_lifetime_const.stderr new file mode 100644 index 00000000000..6c66312e7b1 --- /dev/null +++ b/src/test/ui/generic-associated-types/missing_lifetime_const.stderr @@ -0,0 +1,28 @@ +warning: the feature `generic_associated_types` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/missing_lifetime_const.rs:1:12 + | +LL | #![feature(generic_associated_types)] + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: `#[warn(incomplete_features)]` on by default + = note: see issue #44265 <https://github.com/rust-lang/rust/issues/44265> for more information + +error[E0107]: this associated type takes 1 lifetime argument but 0 lifetime arguments were supplied + --> $DIR/missing_lifetime_const.rs:9:24 + | +LL | let _: <T as Foo>::Assoc<3>; + | ^^^^^ expected 1 lifetime argument + | +note: associated type defined here, with 1 lifetime parameter: `'a` + --> $DIR/missing_lifetime_const.rs:5:10 + | +LL | type Assoc<'a, const N: usize>; + | ^^^^^ -- +help: add missing lifetime argument + | +LL | let _: <T as Foo>::Assoc<'a, 3>; + | ^^^ + +error: aborting due to previous error; 1 warning emitted + +For more information about this error, try `rustc --explain E0107`. diff --git a/src/test/ui/generic-associated-types/parameter_number_and_kind.rs b/src/test/ui/generic-associated-types/parameter_number_and_kind.rs index 9d7ef88b767..3f92c031e18 100644 --- a/src/test/ui/generic-associated-types/parameter_number_and_kind.rs +++ b/src/test/ui/generic-associated-types/parameter_number_and_kind.rs @@ -12,9 +12,9 @@ trait Foo { type FOk<T> = Self::E<'static, T>; type FErr1 = Self::E<'static, 'static>; //~^ ERROR this associated type takes 1 lifetime argument but 2 lifetime arguments were supplied - //~| ERROR this associated type takes 1 type argument but 0 type arguments were supplied + //~| ERROR this associated type takes 1 type FErr2<T> = Self::E<'static, T, u32>; - //~^ ERROR this associated type takes 1 type argument but 2 type arguments were supplied + //~^ ERROR this associated type takes 1 } fn main() {} diff --git a/src/test/ui/generic-associated-types/parameter_number_and_kind.stderr b/src/test/ui/generic-associated-types/parameter_number_and_kind.stderr index d021889c084..b6f600964c9 100644 --- a/src/test/ui/generic-associated-types/parameter_number_and_kind.stderr +++ b/src/test/ui/generic-associated-types/parameter_number_and_kind.stderr @@ -2,7 +2,7 @@ error[E0107]: this associated type takes 1 lifetime argument but 2 lifetime argu --> $DIR/parameter_number_and_kind.rs:13:24 | LL | type FErr1 = Self::E<'static, 'static>; - | ^ --------- help: remove this lifetime argument + | ^ ------- help: remove this lifetime argument | | | expected 1 lifetime argument | @@ -12,31 +12,31 @@ note: associated type defined here, with 1 lifetime parameter: `'a` LL | type E<'a, T>; | ^ -- -error[E0107]: this associated type takes 1 type argument but 0 type arguments were supplied +error[E0107]: this associated type takes 1 generic argument but 0 generic arguments were supplied --> $DIR/parameter_number_and_kind.rs:13:24 | LL | type FErr1 = Self::E<'static, 'static>; - | ^ expected 1 type argument + | ^ expected 1 generic argument | -note: associated type defined here, with 1 type parameter: `T` +note: associated type defined here, with 1 generic parameter: `T` --> $DIR/parameter_number_and_kind.rs:10:10 | LL | type E<'a, T>; | ^ - -help: add missing type argument +help: add missing generic argument | LL | type FErr1 = Self::E<'static, 'static, T>; | ^^^ -error[E0107]: this associated type takes 1 type argument but 2 type arguments were supplied +error[E0107]: this associated type takes 1 generic argument but 2 generic arguments were supplied --> $DIR/parameter_number_and_kind.rs:16:27 | LL | type FErr2<T> = Self::E<'static, T, u32>; - | ^ ----- help: remove this type argument + | ^ --- help: remove this generic argument | | - | expected 1 type argument + | expected 1 generic argument | -note: associated type defined here, with 1 type parameter: `T` +note: associated type defined here, with 1 generic parameter: `T` --> $DIR/parameter_number_and_kind.rs:10:10 | LL | type E<'a, T>; diff --git a/src/test/ui/generic-associated-types/parse/trait-path-type-error-once-implemented.rs b/src/test/ui/generic-associated-types/parse/trait-path-type-error-once-implemented.rs index 2d38770bcdf..d7a0ef4916a 100644 --- a/src/test/ui/generic-associated-types/parse/trait-path-type-error-once-implemented.rs +++ b/src/test/ui/generic-associated-types/parse/trait-path-type-error-once-implemented.rs @@ -3,12 +3,12 @@ trait X { type Y<'a>; - //~^ ERROR this associated type - //~| ERROR this associated type } const _: () = { fn f2<'a>(arg : Box<dyn X<Y<1> = &'a ()>>) {} + //~^ ERROR this associated type takes 1 lifetime argument but 0 lifetime arguments + //~| ERROR this associated type takes 0 generic arguments but 1 generic argument }; fn main() {} diff --git a/src/test/ui/generic-associated-types/parse/trait-path-type-error-once-implemented.stderr b/src/test/ui/generic-associated-types/parse/trait-path-type-error-once-implemented.stderr index 60b8fb9bcaa..5685e5208c6 100644 --- a/src/test/ui/generic-associated-types/parse/trait-path-type-error-once-implemented.stderr +++ b/src/test/ui/generic-associated-types/parse/trait-path-type-error-once-implemented.stderr @@ -8,10 +8,10 @@ LL | #![feature(generic_associated_types)] = note: see issue #44265 <https://github.com/rust-lang/rust/issues/44265> for more information error[E0107]: this associated type takes 1 lifetime argument but 0 lifetime arguments were supplied - --> $DIR/trait-path-type-error-once-implemented.rs:5:10 + --> $DIR/trait-path-type-error-once-implemented.rs:9:29 | -LL | type Y<'a>; - | ^ expected 1 lifetime argument +LL | fn f2<'a>(arg : Box<dyn X<Y<1> = &'a ()>>) {} + | ^ expected 1 lifetime argument | note: associated type defined here, with 1 lifetime parameter: `'a` --> $DIR/trait-path-type-error-once-implemented.rs:5:10 @@ -20,25 +20,18 @@ LL | type Y<'a>; | ^ -- help: add missing lifetime argument | -LL | fn f2<'a>(arg : Box<dyn X<Y<'a1> = &'a ()>>) {} - | ^^ +LL | fn f2<'a>(arg : Box<dyn X<Y<'a, 1> = &'a ()>>) {} + | ^^^ -error[E0107]: this associated type takes 0 const arguments but 1 const argument was supplied - --> $DIR/trait-path-type-error-once-implemented.rs:5:10 +error[E0107]: this associated type takes 0 generic arguments but 1 generic argument was supplied + --> $DIR/trait-path-type-error-once-implemented.rs:9:29 + | +LL | fn f2<'a>(arg : Box<dyn X<Y<1> = &'a ()>>) {} + | ^--- help: remove these generics + | | + | expected 0 generic arguments | -LL | type Y<'a>; - | __________^- - | | | - | | expected 0 const arguments -LL | | -LL | | -LL | | } -LL | | -LL | | const _: () = { -LL | | fn f2<'a>(arg : Box<dyn X<Y<1> = &'a ()>>) {} - | |________________________________- help: remove these generics - | -note: associated type defined here, with 0 const parameters +note: associated type defined here, with 0 generic parameters --> $DIR/trait-path-type-error-once-implemented.rs:5:10 | LL | type Y<'a>; diff --git a/src/test/ui/generics/bad-mid-path-type-params.rs b/src/test/ui/generics/bad-mid-path-type-params.rs index c42ce602e99..23a5d1525d9 100644 --- a/src/test/ui/generics/bad-mid-path-type-params.rs +++ b/src/test/ui/generics/bad-mid-path-type-params.rs @@ -28,17 +28,17 @@ impl Trait<isize> for S2 { fn foo<'a>() { let _ = S::new::<isize,f64>(1, 1.0); - //~^ ERROR this associated function takes 1 type argument but 2 type arguments were supplied + //~^ ERROR this associated function takes 1 let _ = S::<'a,isize>::new::<f64>(1, 1.0); //~^ ERROR this struct takes 0 lifetime arguments but 1 lifetime argument was supplied let _: S2 = Trait::new::<isize,f64>(1, 1.0); - //~^ ERROR this associated function takes 1 type argument but 2 type arguments were supplied + //~^ ERROR this associated function takes 1 let _: S2 = Trait::<'a,isize>::new::<f64,f64>(1, 1.0); //~^ ERROR this trait takes 0 lifetime arguments but 1 lifetime argument was supplied - //~| ERROR this associated function takes 1 type argument but 2 type arguments were supplied + //~| ERROR this associated function takes 1 } fn main() {} diff --git a/src/test/ui/generics/bad-mid-path-type-params.stderr b/src/test/ui/generics/bad-mid-path-type-params.stderr index dd96856e563..aee2b60159f 100644 --- a/src/test/ui/generics/bad-mid-path-type-params.stderr +++ b/src/test/ui/generics/bad-mid-path-type-params.stderr @@ -1,12 +1,12 @@ -error[E0107]: this associated function takes 1 type argument but 2 type arguments were supplied +error[E0107]: this associated function takes 1 generic argument but 2 generic arguments were supplied --> $DIR/bad-mid-path-type-params.rs:30:16 | LL | let _ = S::new::<isize,f64>(1, 1.0); - | ^^^ ---- help: remove this type argument + | ^^^ --- help: remove this generic argument | | - | expected 1 type argument + | expected 1 generic argument | -note: associated function defined here, with 1 type parameter: `U` +note: associated function defined here, with 1 generic parameter: `U` --> $DIR/bad-mid-path-type-params.rs:6:8 | LL | fn new<U>(x: T, _: U) -> S<T> { @@ -16,7 +16,7 @@ error[E0107]: this struct takes 0 lifetime arguments but 1 lifetime argument was --> $DIR/bad-mid-path-type-params.rs:33:13 | LL | let _ = S::<'a,isize>::new::<f64>(1, 1.0); - | ^ --- help: remove this lifetime argument + | ^ -- help: remove this lifetime argument | | | expected 0 lifetime arguments | @@ -26,15 +26,15 @@ note: struct defined here, with 0 lifetime parameters LL | struct S<T> { | ^ -error[E0107]: this associated function takes 1 type argument but 2 type arguments were supplied +error[E0107]: this associated function takes 1 generic argument but 2 generic arguments were supplied --> $DIR/bad-mid-path-type-params.rs:36:24 | LL | let _: S2 = Trait::new::<isize,f64>(1, 1.0); - | ^^^ ---- help: remove this type argument + | ^^^ --- help: remove this generic argument | | - | expected 1 type argument + | expected 1 generic argument | -note: associated function defined here, with 1 type parameter: `U` +note: associated function defined here, with 1 generic parameter: `U` --> $DIR/bad-mid-path-type-params.rs:14:8 | LL | fn new<U>(x: T, y: U) -> Self; @@ -44,7 +44,7 @@ error[E0107]: this trait takes 0 lifetime arguments but 1 lifetime argument was --> $DIR/bad-mid-path-type-params.rs:39:17 | LL | let _: S2 = Trait::<'a,isize>::new::<f64,f64>(1, 1.0); - | ^^^^^ --- help: remove this lifetime argument + | ^^^^^ -- help: remove this lifetime argument | | | expected 0 lifetime arguments | @@ -54,15 +54,15 @@ note: trait defined here, with 0 lifetime parameters LL | trait Trait<T> { | ^^^^^ -error[E0107]: this associated function takes 1 type argument but 2 type arguments were supplied +error[E0107]: this associated function takes 1 generic argument but 2 generic arguments were supplied --> $DIR/bad-mid-path-type-params.rs:39:36 | LL | let _: S2 = Trait::<'a,isize>::new::<f64,f64>(1, 1.0); - | ^^^ ---- help: remove this type argument + | ^^^ --- help: remove this generic argument | | - | expected 1 type argument + | expected 1 generic argument | -note: associated function defined here, with 1 type parameter: `U` +note: associated function defined here, with 1 generic parameter: `U` --> $DIR/bad-mid-path-type-params.rs:14:8 | LL | fn new<U>(x: T, y: U) -> Self; diff --git a/src/test/ui/generics/generic-arg-mismatch-recover.rs b/src/test/ui/generics/generic-arg-mismatch-recover.rs index 0e0d1daec5f..2cf7f1d657b 100644 --- a/src/test/ui/generics/generic-arg-mismatch-recover.rs +++ b/src/test/ui/generics/generic-arg-mismatch-recover.rs @@ -8,5 +8,5 @@ fn main() { Bar::<'static, 'static, ()>(&()); //~^ ERROR this struct takes 1 lifetime argument but 2 lifetime arguments were supplied - //~| ERROR this struct takes 0 type arguments but 1 type argument was supplied + //~| ERROR this struct takes 0 } diff --git a/src/test/ui/generics/generic-arg-mismatch-recover.stderr b/src/test/ui/generics/generic-arg-mismatch-recover.stderr index ca73b82737d..45fea925f27 100644 --- a/src/test/ui/generics/generic-arg-mismatch-recover.stderr +++ b/src/test/ui/generics/generic-arg-mismatch-recover.stderr @@ -2,7 +2,7 @@ error[E0107]: this struct takes 1 lifetime argument but 2 lifetime arguments wer --> $DIR/generic-arg-mismatch-recover.rs:6:5 | LL | Foo::<'static, 'static, ()>(&0); - | ^^^ --------- help: remove this lifetime argument + | ^^^ ------- help: remove this lifetime argument | | | expected 1 lifetime argument | @@ -16,7 +16,7 @@ error[E0107]: this struct takes 1 lifetime argument but 2 lifetime arguments wer --> $DIR/generic-arg-mismatch-recover.rs:9:5 | LL | Bar::<'static, 'static, ()>(&()); - | ^^^ --------- help: remove this lifetime argument + | ^^^ ------- help: remove this lifetime argument | | | expected 1 lifetime argument | @@ -26,15 +26,15 @@ note: struct defined here, with 1 lifetime parameter: `'a` LL | struct Bar<'a>(&'a ()); | ^^^ -- -error[E0107]: this struct takes 0 type arguments but 1 type argument was supplied +error[E0107]: this struct takes 0 generic arguments but 1 generic argument was supplied --> $DIR/generic-arg-mismatch-recover.rs:9:5 | LL | Bar::<'static, 'static, ()>(&()); - | ^^^ ---- help: remove this type argument + | ^^^ -- help: remove this generic argument | | - | expected 0 type arguments + | expected 0 generic arguments | -note: struct defined here, with 0 type parameters +note: struct defined here, with 0 generic parameters --> $DIR/generic-arg-mismatch-recover.rs:3:8 | LL | struct Bar<'a>(&'a ()); diff --git a/src/test/ui/generics/generic-impl-less-params-with-defaults.rs b/src/test/ui/generics/generic-impl-less-params-with-defaults.rs index 01964f652ee..66afbb58ad4 100644 --- a/src/test/ui/generics/generic-impl-less-params-with-defaults.rs +++ b/src/test/ui/generics/generic-impl-less-params-with-defaults.rs @@ -9,5 +9,5 @@ impl<A, B, C> Foo<A, B, C> { fn main() { Foo::<isize>::new(); - //~^ ERROR this struct takes at least 2 type arguments but only 1 type argument was supplied + //~^ ERROR this struct takes at least 2 generic arguments but 1 generic argument } diff --git a/src/test/ui/generics/generic-impl-less-params-with-defaults.stderr b/src/test/ui/generics/generic-impl-less-params-with-defaults.stderr index a8a17876ee0..2c7ffde7ddb 100644 --- a/src/test/ui/generics/generic-impl-less-params-with-defaults.stderr +++ b/src/test/ui/generics/generic-impl-less-params-with-defaults.stderr @@ -1,17 +1,17 @@ -error[E0107]: this struct takes at least 2 type arguments but only 1 type argument was supplied +error[E0107]: this struct takes at least 2 generic arguments but 1 generic argument was supplied --> $DIR/generic-impl-less-params-with-defaults.rs:11:5 | LL | Foo::<isize>::new(); - | ^^^ ----- supplied 1 type argument + | ^^^ ----- supplied 1 generic argument | | - | expected at least 2 type arguments + | expected at least 2 generic arguments | -note: struct defined here, with at least 2 type parameters: `A`, `B` +note: struct defined here, with at least 2 generic parameters: `A`, `B` --> $DIR/generic-impl-less-params-with-defaults.rs:3:8 | LL | struct Foo<A, B, C = (A, B)>( | ^^^ - - -help: add missing type argument +help: add missing generic argument | LL | Foo::<isize, B>::new(); | ^^^ diff --git a/src/test/ui/generics/generic-impl-more-params-with-defaults.rs b/src/test/ui/generics/generic-impl-more-params-with-defaults.rs index 24c41a9088b..a283323742a 100644 --- a/src/test/ui/generics/generic-impl-more-params-with-defaults.rs +++ b/src/test/ui/generics/generic-impl-more-params-with-defaults.rs @@ -11,5 +11,5 @@ impl<T, A> Vec<T, A> { fn main() { Vec::<isize, Heap, bool>::new(); - //~^ ERROR this struct takes at most 2 type arguments but 3 type arguments were supplied + //~^ ERROR this struct takes at most 2 generic arguments but 3 generic arguments were supplied } diff --git a/src/test/ui/generics/generic-impl-more-params-with-defaults.stderr b/src/test/ui/generics/generic-impl-more-params-with-defaults.stderr index 8ba86afe91e..059289533da 100644 --- a/src/test/ui/generics/generic-impl-more-params-with-defaults.stderr +++ b/src/test/ui/generics/generic-impl-more-params-with-defaults.stderr @@ -1,12 +1,12 @@ -error[E0107]: this struct takes at most 2 type arguments but 3 type arguments were supplied +error[E0107]: this struct takes at most 2 generic arguments but 3 generic arguments were supplied --> $DIR/generic-impl-more-params-with-defaults.rs:13:5 | LL | Vec::<isize, Heap, bool>::new(); - | ^^^ ------ help: remove this type argument + | ^^^ ---- help: remove this generic argument | | - | expected at most 2 type arguments + | expected at most 2 generic arguments | -note: struct defined here, with at most 2 type parameters: `T`, `A` +note: struct defined here, with at most 2 generic parameters: `T`, `A` --> $DIR/generic-impl-more-params-with-defaults.rs:5:8 | LL | struct Vec<T, A = Heap>( diff --git a/src/test/ui/generics/generic-type-less-params-with-defaults.stderr b/src/test/ui/generics/generic-type-less-params-with-defaults.stderr index 93f7a24d877..7c0836375e3 100644 --- a/src/test/ui/generics/generic-type-less-params-with-defaults.stderr +++ b/src/test/ui/generics/generic-type-less-params-with-defaults.stderr @@ -2,17 +2,17 @@ error[E0107]: missing generics for struct `Vec` --> $DIR/generic-type-less-params-with-defaults.rs:9:12 | LL | let _: Vec; - | ^^^ expected at least 1 type argument + | ^^^ expected at least 1 generic argument | -note: struct defined here, with at least 1 type parameter: `T` +note: struct defined here, with at least 1 generic parameter: `T` --> $DIR/generic-type-less-params-with-defaults.rs:5:8 | LL | struct Vec<T, A = Heap>( | ^^^ - -help: use angle brackets to add missing type argument +help: add missing generic argument | LL | let _: Vec<T>; - | ^^^ + | ^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/generics/generic-type-more-params-with-defaults.rs b/src/test/ui/generics/generic-type-more-params-with-defaults.rs index c421774ebba..3dab03297c9 100644 --- a/src/test/ui/generics/generic-type-more-params-with-defaults.rs +++ b/src/test/ui/generics/generic-type-more-params-with-defaults.rs @@ -7,5 +7,5 @@ struct Vec<T, A = Heap>( fn main() { let _: Vec<isize, Heap, bool>; - //~^ ERROR this struct takes at most 2 type arguments but 3 type arguments were supplied + //~^ ERROR this struct takes at most 2 generic arguments but 3 generic arguments } diff --git a/src/test/ui/generics/generic-type-more-params-with-defaults.stderr b/src/test/ui/generics/generic-type-more-params-with-defaults.stderr index e331481390b..500880cfb86 100644 --- a/src/test/ui/generics/generic-type-more-params-with-defaults.stderr +++ b/src/test/ui/generics/generic-type-more-params-with-defaults.stderr @@ -1,12 +1,12 @@ -error[E0107]: this struct takes at most 2 type arguments but 3 type arguments were supplied +error[E0107]: this struct takes at most 2 generic arguments but 3 generic arguments were supplied --> $DIR/generic-type-more-params-with-defaults.rs:9:12 | LL | let _: Vec<isize, Heap, bool>; - | ^^^ ------ help: remove this type argument + | ^^^ ---- help: remove this generic argument | | - | expected at most 2 type arguments + | expected at most 2 generic arguments | -note: struct defined here, with at most 2 type parameters: `T`, `A` +note: struct defined here, with at most 2 generic parameters: `T`, `A` --> $DIR/generic-type-more-params-with-defaults.rs:5:8 | LL | struct Vec<T, A = Heap>( diff --git a/src/test/ui/generics/wrong-number-of-args.rs b/src/test/ui/generics/wrong-number-of-args.rs index 2994ca3c759..f061c581459 100644 --- a/src/test/ui/generics/wrong-number-of-args.rs +++ b/src/test/ui/generics/wrong-number-of-args.rs @@ -4,18 +4,18 @@ mod no_generics { type A = Ty; type B = Ty<'static>; - //~^ ERROR this struct takes 0 lifetime arguments but 1 lifetime argument was supplied + //~^ ERROR this struct takes 0 lifetime arguments but 1 lifetime argument //~| HELP remove these generics type C = Ty<'static, usize>; - //~^ ERROR this struct takes 0 lifetime arguments but 1 lifetime argument was supplied - //~| ERROR this struct takes 0 type arguments but 1 type argument was supplied + //~^ ERROR this struct takes 0 lifetime arguments but 1 lifetime argument + //~| ERROR this struct takes 0 generic arguments but 1 generic argument //~| HELP remove this lifetime argument - //~| HELP remove this type argument + //~| HELP remove this generic argument type D = Ty<'static, usize, { 0 }>; - //~^ ERROR this struct takes 0 lifetime arguments but 1 lifetime argument was supplied - //~| ERROR this struct takes 0 generic arguments but 2 generic arguments were supplied + //~^ ERROR this struct takes 0 lifetime arguments but 1 lifetime argument + //~| ERROR this struct takes 0 generic arguments but 2 generic arguments //~| HELP remove this lifetime argument //~| HELP remove these generic arguments } @@ -25,31 +25,31 @@ mod type_and_type { type A = Ty; //~^ ERROR missing generics for struct `type_and_type::Ty` - //~| HELP use angle brackets + //~| HELP add missing type B = Ty<usize>; - //~^ ERROR this struct takes 2 type arguments but only 1 type argument was supplied - //~| HELP add missing type argument + //~^ ERROR this struct takes 2 generic arguments but 1 generic argument + //~| HELP add missing type C = Ty<usize, String>; type D = Ty<usize, String, char>; - //~^ ERROR this struct takes 2 type arguments but 3 type arguments were supplied - //~| HELP remove this type argument + //~^ ERROR this struct takes 2 generic arguments but 3 generic arguments + //~| HELP remove this } mod lifetime_and_type { struct Ty<'a, T>; type A = Ty; - //~^ ERROR missing generics for struct `lifetime_and_type::Ty` + //~^ ERROR missing generics for struct //~| ERROR missing lifetime specifier + //~| HELP add missing //~| HELP consider introducing - //~| HELP use angle brackets type B = Ty<'static>; - //~^ ERROR this struct takes 1 type argument but 0 type arguments were supplied - //~| HELP add missing type argument + //~^ ERROR this struct takes 1 generic argument but 0 generic arguments + //~| HELP add missing type C = Ty<usize>; //~^ ERROR missing lifetime specifier @@ -63,18 +63,18 @@ mod type_and_type_and_type { type A = Ty; //~^ ERROR missing generics for struct `type_and_type_and_type::Ty` - //~| HELP use angle brackets + //~| HELP add missing type B = Ty<usize>; - //~^ ERROR this struct takes at least 2 type arguments but only 1 type argument was supplied - //~| HELP add missing type argument + //~^ ERROR this struct takes at least 2 + //~| HELP add missing type C = Ty<usize, String>; type D = Ty<usize, String, char>; type E = Ty<usize, String, char, f64>; - //~^ ERROR this struct takes at most 3 type arguments but 4 type arguments were supplied + //~^ ERROR this struct takes at most 3 //~| HELP remove } @@ -94,7 +94,7 @@ mod r#trait { } type A = Box<dyn NonGeneric<usize>>; - //~^ ERROR this trait takes 0 type arguments but 1 type argument was supplied + //~^ ERROR this trait takes 0 generic arguments but 1 generic argument //~| HELP remove type B = Box<dyn GenericLifetime>; @@ -107,10 +107,10 @@ mod r#trait { type D = Box<dyn GenericType>; //~^ ERROR missing generics for trait `GenericType` - //~| HELP use angle brackets + //~| HELP add missing type E = Box<dyn GenericType<String, usize>>; - //~^ ERROR this trait takes 1 type argument but 2 type arguments were supplied + //~^ ERROR this trait takes 1 generic argument but 2 generic arguments //~| HELP remove } @@ -120,40 +120,40 @@ mod stdlib { type A = HashMap; //~^ ERROR missing generics for struct `HashMap` - //~| HELP use angle brackets + //~| HELP add missing type B = HashMap<String>; - //~^ ERROR this struct takes at least 2 type arguments but only 1 type argument was supplied - //~| HELP add missing type argument + //~^ ERROR this struct takes at least + //~| HELP add missing type C = HashMap<'static>; - //~^ ERROR this struct takes 0 lifetime arguments but 1 lifetime argument was supplied + //~^ ERROR this struct takes 0 lifetime arguments but 1 lifetime argument //~| HELP remove these generics - //~| ERROR this struct takes at least 2 type arguments but 0 type arguments were supplied - //~| HELP add missing type arguments + //~| ERROR this struct takes at least 2 + //~| HELP add missing type D = HashMap<usize, String, char, f64>; - //~^ ERROR this struct takes at most 3 type arguments but 4 type arguments were supplied - //~| HELP remove this type argument + //~^ ERROR this struct takes at most 3 + //~| HELP remove this } mod result { type A = Result; //~^ ERROR missing generics for enum `Result` - //~| HELP use angle brackets + //~| HELP add missing type B = Result<String>; - //~^ ERROR this enum takes 2 type arguments but only 1 type argument was supplied - //~| HELP add missing type argument + //~^ ERROR this enum takes 2 generic arguments but 1 generic argument + //~| HELP add missing type C = Result<'static>; - //~^ ERROR this enum takes 0 lifetime arguments but 1 lifetime argument was supplied + //~^ ERROR this enum takes 0 lifetime arguments but 1 lifetime argument //~| HELP remove these generics - //~| ERROR this enum takes 2 type arguments but 0 type arguments were supplied - //~| HELP add missing type arguments + //~| ERROR this enum takes 2 generic arguments but 0 generic arguments + //~| HELP add missing type D = Result<usize, String, char>; - //~^ ERROR this enum takes 2 type arguments but 3 type arguments were supplied + //~^ ERROR this enum takes 2 generic arguments but 3 generic arguments //~| HELP remove } } diff --git a/src/test/ui/generics/wrong-number-of-args.stderr b/src/test/ui/generics/wrong-number-of-args.stderr index 94fdd355d48..45bde4163d0 100644 --- a/src/test/ui/generics/wrong-number-of-args.stderr +++ b/src/test/ui/generics/wrong-number-of-args.stderr @@ -16,7 +16,7 @@ error[E0107]: this struct takes 0 lifetime arguments but 1 lifetime argument was --> $DIR/wrong-number-of-args.rs:10:14 | LL | type C = Ty<'static, usize>; - | ^^ --------- help: remove this lifetime argument + | ^^ ------- help: remove this lifetime argument | | | expected 0 lifetime arguments | @@ -26,15 +26,15 @@ note: struct defined here, with 0 lifetime parameters LL | struct Ty; | ^^ -error[E0107]: this struct takes 0 type arguments but 1 type argument was supplied +error[E0107]: this struct takes 0 generic arguments but 1 generic argument was supplied --> $DIR/wrong-number-of-args.rs:10:14 | LL | type C = Ty<'static, usize>; - | ^^ ------- help: remove this type argument + | ^^ ----- help: remove this generic argument | | - | expected 0 type arguments + | expected 0 generic arguments | -note: struct defined here, with 0 type parameters +note: struct defined here, with 0 generic parameters --> $DIR/wrong-number-of-args.rs:2:12 | LL | struct Ty; @@ -44,7 +44,7 @@ error[E0107]: this struct takes 0 lifetime arguments but 1 lifetime argument was --> $DIR/wrong-number-of-args.rs:16:14 | LL | type D = Ty<'static, usize, { 0 }>; - | ^^ --------- help: remove this lifetime argument + | ^^ ------- help: remove this lifetime argument | | | expected 0 lifetime arguments | @@ -58,7 +58,7 @@ error[E0107]: this struct takes 0 generic arguments but 2 generic arguments were --> $DIR/wrong-number-of-args.rs:16:14 | LL | type D = Ty<'static, usize, { 0 }>; - | ^^ -------------- help: remove these generic arguments + | ^^ ------------ help: remove these generic arguments | | | expected 0 generic arguments | @@ -72,45 +72,45 @@ error[E0107]: missing generics for struct `type_and_type::Ty` --> $DIR/wrong-number-of-args.rs:26:14 | LL | type A = Ty; - | ^^ expected 2 type arguments + | ^^ expected 2 generic arguments | -note: struct defined here, with 2 type parameters: `A`, `B` +note: struct defined here, with 2 generic parameters: `A`, `B` --> $DIR/wrong-number-of-args.rs:24:12 | LL | struct Ty<A, B>; | ^^ - - -help: use angle brackets to add missing type arguments +help: add missing generic arguments | LL | type A = Ty<A, B>; - | ^^^^^^ + | ^^^^^^^^ -error[E0107]: this struct takes 2 type arguments but only 1 type argument was supplied +error[E0107]: this struct takes 2 generic arguments but 1 generic argument was supplied --> $DIR/wrong-number-of-args.rs:30:14 | LL | type B = Ty<usize>; - | ^^ ----- supplied 1 type argument + | ^^ ----- supplied 1 generic argument | | - | expected 2 type arguments + | expected 2 generic arguments | -note: struct defined here, with 2 type parameters: `A`, `B` +note: struct defined here, with 2 generic parameters: `A`, `B` --> $DIR/wrong-number-of-args.rs:24:12 | LL | struct Ty<A, B>; | ^^ - - -help: add missing type argument +help: add missing generic argument | LL | type B = Ty<usize, B>; | ^^^ -error[E0107]: this struct takes 2 type arguments but 3 type arguments were supplied +error[E0107]: this struct takes 2 generic arguments but 3 generic arguments were supplied --> $DIR/wrong-number-of-args.rs:36:14 | LL | type D = Ty<usize, String, char>; - | ^^ ------ help: remove this type argument + | ^^ ---- help: remove this generic argument | | - | expected 2 type arguments + | expected 2 generic arguments | -note: struct defined here, with 2 type parameters: `A`, `B` +note: struct defined here, with 2 generic parameters: `A`, `B` --> $DIR/wrong-number-of-args.rs:24:12 | LL | struct Ty<A, B>; @@ -120,17 +120,17 @@ error[E0107]: missing generics for struct `lifetime_and_type::Ty` --> $DIR/wrong-number-of-args.rs:44:14 | LL | type A = Ty; - | ^^ expected 1 type argument + | ^^ expected 1 generic argument | -note: struct defined here, with 1 type parameter: `T` +note: struct defined here, with 1 generic parameter: `T` --> $DIR/wrong-number-of-args.rs:42:12 | LL | struct Ty<'a, T>; | ^^ - -help: use angle brackets to add missing type argument +help: add missing generic argument | LL | type A = Ty<T>; - | ^^^ + | ^^^^^ error[E0106]: missing lifetime specifier --> $DIR/wrong-number-of-args.rs:44:14 @@ -143,18 +143,18 @@ help: consider introducing a named lifetime parameter LL | type A<'a> = Ty<'a>; | ^^^^ ^^^^^^ -error[E0107]: this struct takes 1 type argument but 0 type arguments were supplied +error[E0107]: this struct takes 1 generic argument but 0 generic arguments were supplied --> $DIR/wrong-number-of-args.rs:50:14 | LL | type B = Ty<'static>; - | ^^ expected 1 type argument + | ^^ expected 1 generic argument | -note: struct defined here, with 1 type parameter: `T` +note: struct defined here, with 1 generic parameter: `T` --> $DIR/wrong-number-of-args.rs:42:12 | LL | struct Ty<'a, T>; | ^^ - -help: add missing type argument +help: add missing generic argument | LL | type B = Ty<'static, T>; | ^^^ @@ -174,59 +174,59 @@ error[E0107]: missing generics for struct `type_and_type_and_type::Ty` --> $DIR/wrong-number-of-args.rs:64:14 | LL | type A = Ty; - | ^^ expected at least 2 type arguments + | ^^ expected at least 2 generic arguments | -note: struct defined here, with at least 2 type parameters: `A`, `B` +note: struct defined here, with at least 2 generic parameters: `A`, `B` --> $DIR/wrong-number-of-args.rs:62:12 | LL | struct Ty<A, B, C = &'static str>; | ^^ - - -help: use angle brackets to add missing type arguments +help: add missing generic arguments | LL | type A = Ty<A, B>; - | ^^^^^^ + | ^^^^^^^^ -error[E0107]: this struct takes at least 2 type arguments but only 1 type argument was supplied +error[E0107]: this struct takes at least 2 generic arguments but 1 generic argument was supplied --> $DIR/wrong-number-of-args.rs:68:14 | LL | type B = Ty<usize>; - | ^^ ----- supplied 1 type argument + | ^^ ----- supplied 1 generic argument | | - | expected at least 2 type arguments + | expected at least 2 generic arguments | -note: struct defined here, with at least 2 type parameters: `A`, `B` +note: struct defined here, with at least 2 generic parameters: `A`, `B` --> $DIR/wrong-number-of-args.rs:62:12 | LL | struct Ty<A, B, C = &'static str>; | ^^ - - -help: add missing type argument +help: add missing generic argument | LL | type B = Ty<usize, B>; | ^^^ -error[E0107]: this struct takes at most 3 type arguments but 4 type arguments were supplied +error[E0107]: this struct takes at most 3 generic arguments but 4 generic arguments were supplied --> $DIR/wrong-number-of-args.rs:76:14 | LL | type E = Ty<usize, String, char, f64>; - | ^^ ----- help: remove this type argument + | ^^ --- help: remove this generic argument | | - | expected at most 3 type arguments + | expected at most 3 generic arguments | -note: struct defined here, with at most 3 type parameters: `A`, `B`, `C` +note: struct defined here, with at most 3 generic parameters: `A`, `B`, `C` --> $DIR/wrong-number-of-args.rs:62:12 | LL | struct Ty<A, B, C = &'static str>; | ^^ - - - -error[E0107]: this trait takes 0 type arguments but 1 type argument was supplied +error[E0107]: this trait takes 0 generic arguments but 1 generic argument was supplied --> $DIR/wrong-number-of-args.rs:96:22 | LL | type A = Box<dyn NonGeneric<usize>>; | ^^^^^^^^^^------- help: remove these generics | | - | expected 0 type arguments + | expected 0 generic arguments | -note: trait defined here, with 0 type parameters +note: trait defined here, with 0 generic parameters --> $DIR/wrong-number-of-args.rs:84:11 | LL | trait NonGeneric { @@ -247,7 +247,7 @@ error[E0107]: this trait takes 1 lifetime argument but 2 lifetime arguments were --> $DIR/wrong-number-of-args.rs:104:22 | LL | type C = Box<dyn GenericLifetime<'static, 'static>>; - | ^^^^^^^^^^^^^^^ --------- help: remove this lifetime argument + | ^^^^^^^^^^^^^^^ ------- help: remove this lifetime argument | | | expected 1 lifetime argument | @@ -261,27 +261,27 @@ error[E0107]: missing generics for trait `GenericType` --> $DIR/wrong-number-of-args.rs:108:22 | LL | type D = Box<dyn GenericType>; - | ^^^^^^^^^^^ expected 1 type argument + | ^^^^^^^^^^^ expected 1 generic argument | -note: trait defined here, with 1 type parameter: `A` +note: trait defined here, with 1 generic parameter: `A` --> $DIR/wrong-number-of-args.rs:92:11 | LL | trait GenericType<A> { | ^^^^^^^^^^^ - -help: use angle brackets to add missing type argument +help: add missing generic argument | LL | type D = Box<dyn GenericType<A>>; - | ^^^ + | ^^^^^^^^^^^^^^ -error[E0107]: this trait takes 1 type argument but 2 type arguments were supplied +error[E0107]: this trait takes 1 generic argument but 2 generic arguments were supplied --> $DIR/wrong-number-of-args.rs:112:22 | LL | type E = Box<dyn GenericType<String, usize>>; - | ^^^^^^^^^^^ ------- help: remove this type argument + | ^^^^^^^^^^^ ----- help: remove this generic argument | | - | expected 1 type argument + | expected 1 generic argument | -note: trait defined here, with 1 type parameter: `A` +note: trait defined here, with 1 generic parameter: `A` --> $DIR/wrong-number-of-args.rs:92:11 | LL | trait GenericType<A> { @@ -291,32 +291,32 @@ error[E0107]: missing generics for struct `HashMap` --> $DIR/wrong-number-of-args.rs:121:18 | LL | type A = HashMap; - | ^^^^^^^ expected at least 2 type arguments + | ^^^^^^^ expected at least 2 generic arguments | -note: struct defined here, with at least 2 type parameters: `K`, `V` +note: struct defined here, with at least 2 generic parameters: `K`, `V` --> $SRC_DIR/std/src/collections/hash/map.rs:LL:COL | LL | pub struct HashMap<K, V, S = RandomState> { | ^^^^^^^ - - -help: use angle brackets to add missing type arguments +help: add missing generic arguments | LL | type A = HashMap<K, V>; - | ^^^^^^ + | ^^^^^^^^^^^^^ -error[E0107]: this struct takes at least 2 type arguments but only 1 type argument was supplied +error[E0107]: this struct takes at least 2 generic arguments but 1 generic argument was supplied --> $DIR/wrong-number-of-args.rs:125:18 | LL | type B = HashMap<String>; - | ^^^^^^^ ------ supplied 1 type argument + | ^^^^^^^ ------ supplied 1 generic argument | | - | expected at least 2 type arguments + | expected at least 2 generic arguments | -note: struct defined here, with at least 2 type parameters: `K`, `V` +note: struct defined here, with at least 2 generic parameters: `K`, `V` --> $SRC_DIR/std/src/collections/hash/map.rs:LL:COL | LL | pub struct HashMap<K, V, S = RandomState> { | ^^^^^^^ - - -help: add missing type argument +help: add missing generic argument | LL | type B = HashMap<String, V>; | ^^^ @@ -335,31 +335,31 @@ note: struct defined here, with 0 lifetime parameters LL | pub struct HashMap<K, V, S = RandomState> { | ^^^^^^^ -error[E0107]: this struct takes at least 2 type arguments but 0 type arguments were supplied +error[E0107]: this struct takes at least 2 generic arguments but 0 generic arguments were supplied --> $DIR/wrong-number-of-args.rs:129:18 | LL | type C = HashMap<'static>; - | ^^^^^^^ expected at least 2 type arguments + | ^^^^^^^ expected at least 2 generic arguments | -note: struct defined here, with at least 2 type parameters: `K`, `V` +note: struct defined here, with at least 2 generic parameters: `K`, `V` --> $SRC_DIR/std/src/collections/hash/map.rs:LL:COL | LL | pub struct HashMap<K, V, S = RandomState> { | ^^^^^^^ - - -help: add missing type arguments +help: add missing generic arguments | LL | type C = HashMap<'static, K, V>; | ^^^^^^ -error[E0107]: this struct takes at most 3 type arguments but 4 type arguments were supplied +error[E0107]: this struct takes at most 3 generic arguments but 4 generic arguments were supplied --> $DIR/wrong-number-of-args.rs:135:18 | LL | type D = HashMap<usize, String, char, f64>; - | ^^^^^^^ ----- help: remove this type argument + | ^^^^^^^ --- help: remove this generic argument | | - | expected at most 3 type arguments + | expected at most 3 generic arguments | -note: struct defined here, with at most 3 type parameters: `K`, `V`, `S` +note: struct defined here, with at most 3 generic parameters: `K`, `V`, `S` --> $SRC_DIR/std/src/collections/hash/map.rs:LL:COL | LL | pub struct HashMap<K, V, S = RandomState> { @@ -369,32 +369,32 @@ error[E0107]: missing generics for enum `Result` --> $DIR/wrong-number-of-args.rs:141:18 | LL | type A = Result; - | ^^^^^^ expected 2 type arguments + | ^^^^^^ expected 2 generic arguments | -note: enum defined here, with 2 type parameters: `T`, `E` +note: enum defined here, with 2 generic parameters: `T`, `E` --> $SRC_DIR/core/src/result.rs:LL:COL | LL | pub enum Result<T, E> { | ^^^^^^ - - -help: use angle brackets to add missing type arguments +help: add missing generic arguments | LL | type A = Result<T, E>; - | ^^^^^^ + | ^^^^^^^^^^^^ -error[E0107]: this enum takes 2 type arguments but only 1 type argument was supplied +error[E0107]: this enum takes 2 generic arguments but 1 generic argument was supplied --> $DIR/wrong-number-of-args.rs:145:18 | LL | type B = Result<String>; - | ^^^^^^ ------ supplied 1 type argument + | ^^^^^^ ------ supplied 1 generic argument | | - | expected 2 type arguments + | expected 2 generic arguments | -note: enum defined here, with 2 type parameters: `T`, `E` +note: enum defined here, with 2 generic parameters: `T`, `E` --> $SRC_DIR/core/src/result.rs:LL:COL | LL | pub enum Result<T, E> { | ^^^^^^ - - -help: add missing type argument +help: add missing generic argument | LL | type B = Result<String, E>; | ^^^ @@ -413,31 +413,31 @@ note: enum defined here, with 0 lifetime parameters LL | pub enum Result<T, E> { | ^^^^^^ -error[E0107]: this enum takes 2 type arguments but 0 type arguments were supplied +error[E0107]: this enum takes 2 generic arguments but 0 generic arguments were supplied --> $DIR/wrong-number-of-args.rs:149:18 | LL | type C = Result<'static>; - | ^^^^^^ expected 2 type arguments + | ^^^^^^ expected 2 generic arguments | -note: enum defined here, with 2 type parameters: `T`, `E` +note: enum defined here, with 2 generic parameters: `T`, `E` --> $SRC_DIR/core/src/result.rs:LL:COL | LL | pub enum Result<T, E> { | ^^^^^^ - - -help: add missing type arguments +help: add missing generic arguments | LL | type C = Result<'static, T, E>; | ^^^^^^ -error[E0107]: this enum takes 2 type arguments but 3 type arguments were supplied +error[E0107]: this enum takes 2 generic arguments but 3 generic arguments were supplied --> $DIR/wrong-number-of-args.rs:155:18 | LL | type D = Result<usize, String, char>; - | ^^^^^^ ------ help: remove this type argument + | ^^^^^^ ---- help: remove this generic argument | | - | expected 2 type arguments + | expected 2 generic arguments | -note: enum defined here, with 2 type parameters: `T`, `E` +note: enum defined here, with 2 generic parameters: `T`, `E` --> $SRC_DIR/core/src/result.rs:LL:COL | LL | pub enum Result<T, E> { diff --git a/src/test/ui/internal/internal-unstable-const.rs b/src/test/ui/internal/internal-unstable-const.rs index 554c67be4e0..470262a15ba 100644 --- a/src/test/ui/internal/internal-unstable-const.rs +++ b/src/test/ui/internal/internal-unstable-const.rs @@ -3,7 +3,7 @@ #![stable(feature = "rust1", since = "1.0.0")] #![feature(staged_api)] -#![feature(const_transmute, const_fn)] +#![feature(const_transmute)] #[stable(feature = "rust1", since = "1.0.0")] #[rustc_const_stable(feature = "rust1", since = "1.0.0")] diff --git a/src/test/ui/issues/issue-14092.stderr b/src/test/ui/issues/issue-14092.stderr index 5cacce751c9..1aa278b450f 100644 --- a/src/test/ui/issues/issue-14092.stderr +++ b/src/test/ui/issues/issue-14092.stderr @@ -2,19 +2,19 @@ error[E0107]: missing generics for struct `Box` --> $DIR/issue-14092.rs:1:11 | LL | fn fn1(0: Box) {} - | ^^^ expected at least 1 type argument + | ^^^ expected at least 1 generic argument | -note: struct defined here, with at least 1 type parameter: `T` +note: struct defined here, with at least 1 generic parameter: `T` --> $SRC_DIR/alloc/src/boxed.rs:LL:COL | LL | pub struct Box< | ^^^ LL | T: ?Sized, | - -help: use angle brackets to add missing type argument +help: add missing generic argument | LL | fn fn1(0: Box<T>) {} - | ^^^ + | ^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-18423.stderr b/src/test/ui/issues/issue-18423.stderr index f9006235234..4711a3f3ce0 100644 --- a/src/test/ui/issues/issue-18423.stderr +++ b/src/test/ui/issues/issue-18423.stderr @@ -2,7 +2,7 @@ error[E0107]: this struct takes 0 lifetime arguments but 1 lifetime argument was --> $DIR/issue-18423.rs:4:8 | LL | x: Box<'a, isize> - | ^^^ ---- help: remove this lifetime argument + | ^^^ -- help: remove this lifetime argument | | | expected 0 lifetime arguments | diff --git a/src/test/ui/issues/issue-23024.stderr b/src/test/ui/issues/issue-23024.stderr index 1b876090ad6..5d7ffeb0deb 100644 --- a/src/test/ui/issues/issue-23024.stderr +++ b/src/test/ui/issues/issue-23024.stderr @@ -11,17 +11,17 @@ error[E0107]: missing generics for trait `Fn` --> $DIR/issue-23024.rs:9:39 | LL | println!("{:?}",(vfnfer[0] as dyn Fn)(3)); - | ^^ expected 1 type argument + | ^^ expected 1 generic argument | -note: trait defined here, with 1 type parameter: `Args` +note: trait defined here, with 1 generic parameter: `Args` --> $SRC_DIR/core/src/ops/function.rs:LL:COL | LL | pub trait Fn<Args>: FnMut<Args> { | ^^ ---- -help: use angle brackets to add missing type argument +help: add missing generic argument | LL | println!("{:?}",(vfnfer[0] as dyn Fn<Args>)(3)); - | ^^^^^^ + | ^^^^^^^^ error[E0191]: the value of the associated type `Output` (from trait `FnOnce`) must be specified --> $DIR/issue-23024.rs:9:39 diff --git a/src/test/ui/issues/issue-3214.rs b/src/test/ui/issues/issue-3214.rs index ccfaf23b4b9..aa43d06c99b 100644 --- a/src/test/ui/issues/issue-3214.rs +++ b/src/test/ui/issues/issue-3214.rs @@ -4,7 +4,7 @@ fn foo<T>() { } impl<T> Drop for Foo<T> { - //~^ ERROR this struct takes 0 type arguments but 1 type argument was supplied + //~^ ERROR this struct takes 0 generic arguments but 1 generic argument //~| ERROR the type parameter `T` is not constrained by the impl trait, self type, or predicates fn drop(&mut self) {} } diff --git a/src/test/ui/issues/issue-3214.stderr b/src/test/ui/issues/issue-3214.stderr index 0da095b7fda..094da64d76d 100644 --- a/src/test/ui/issues/issue-3214.stderr +++ b/src/test/ui/issues/issue-3214.stderr @@ -9,15 +9,15 @@ LL | struct Foo { LL | x: T, | ^ use of generic parameter from outer function -error[E0107]: this struct takes 0 type arguments but 1 type argument was supplied +error[E0107]: this struct takes 0 generic arguments but 1 generic argument was supplied --> $DIR/issue-3214.rs:6:22 | LL | impl<T> Drop for Foo<T> { | ^^^--- help: remove these generics | | - | expected 0 type arguments + | expected 0 generic arguments | -note: struct defined here, with 0 type parameters +note: struct defined here, with 0 generic parameters --> $DIR/issue-3214.rs:2:12 | LL | struct Foo { diff --git a/src/test/ui/issues/issue-53251.rs b/src/test/ui/issues/issue-53251.rs index 937271d42f4..240826a161d 100644 --- a/src/test/ui/issues/issue-53251.rs +++ b/src/test/ui/issues/issue-53251.rs @@ -9,8 +9,8 @@ macro_rules! impl_add { $( fn $n() { S::f::<i64>(); - //~^ ERROR this associated function takes 0 type arguments but 1 type argument was supplied - //~| ERROR this associated function takes 0 type arguments but 1 type argument was supplied + //~^ ERROR this associated function takes 0 generic + //~| ERROR this associated function takes 0 generic } )* } diff --git a/src/test/ui/issues/issue-53251.stderr b/src/test/ui/issues/issue-53251.stderr index 1676c508a4d..708feffb84d 100644 --- a/src/test/ui/issues/issue-53251.stderr +++ b/src/test/ui/issues/issue-53251.stderr @@ -1,33 +1,33 @@ -error[E0107]: this associated function takes 0 type arguments but 1 type argument was supplied +error[E0107]: this associated function takes 0 generic arguments but 1 generic argument was supplied --> $DIR/issue-53251.rs:11:20 | LL | S::f::<i64>(); | ^------- help: remove these generics | | - | expected 0 type arguments + | expected 0 generic arguments ... LL | impl_add!(a b); | --------------- in this macro invocation | -note: associated function defined here, with 0 type parameters +note: associated function defined here, with 0 generic parameters --> $DIR/issue-53251.rs:4:8 | LL | fn f() {} | ^ = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) -error[E0107]: this associated function takes 0 type arguments but 1 type argument was supplied +error[E0107]: this associated function takes 0 generic arguments but 1 generic argument was supplied --> $DIR/issue-53251.rs:11:20 | LL | S::f::<i64>(); | ^------- help: remove these generics | | - | expected 0 type arguments + | expected 0 generic arguments ... LL | impl_add!(a b); | --------------- in this macro invocation | -note: associated function defined here, with 0 type parameters +note: associated function defined here, with 0 generic parameters --> $DIR/issue-53251.rs:4:8 | LL | fn f() {} diff --git a/src/test/ui/issues/issue-54954.rs b/src/test/ui/issues/issue-54954.rs index 00805eb5dc9..42a4d5b674b 100644 --- a/src/test/ui/issues/issue-54954.rs +++ b/src/test/ui/issues/issue-54954.rs @@ -1,5 +1,3 @@ -#![feature(const_fn)] - const ARR_LEN: usize = Tt::const_val::<[i8; 123]>(); //~^ ERROR type annotations needed diff --git a/src/test/ui/issues/issue-54954.stderr b/src/test/ui/issues/issue-54954.stderr index 29d439b457f..9de58d83c8b 100644 --- a/src/test/ui/issues/issue-54954.stderr +++ b/src/test/ui/issues/issue-54954.stderr @@ -1,11 +1,11 @@ error[E0379]: functions in traits cannot be declared const - --> $DIR/issue-54954.rs:7:5 + --> $DIR/issue-54954.rs:5:5 | LL | const fn const_val<T: Sized>() -> usize { | ^^^^^ functions in traits cannot be const error[E0283]: type annotations needed - --> $DIR/issue-54954.rs:3:24 + --> $DIR/issue-54954.rs:1:24 | LL | const ARR_LEN: usize = Tt::const_val::<[i8; 123]>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type diff --git a/src/test/ui/issues/issue-60622.rs b/src/test/ui/issues/issue-60622.rs index 1018c88ae55..8e230c615bc 100644 --- a/src/test/ui/issues/issue-60622.rs +++ b/src/test/ui/issues/issue-60622.rs @@ -9,7 +9,7 @@ impl Borked { fn run_wild<T>(b: &Borked) { b.a::<'_, T>(); //~^ ERROR cannot specify lifetime arguments explicitly if late bound lifetime parameters are present - //~| ERROR this associated function takes 0 type arguments but 1 type argument was supplied + //~| ERROR this associated function takes 0 generic arguments but 1 generic argument //~| WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! } diff --git a/src/test/ui/issues/issue-60622.stderr b/src/test/ui/issues/issue-60622.stderr index f970a63e4b2..b305cc78535 100644 --- a/src/test/ui/issues/issue-60622.stderr +++ b/src/test/ui/issues/issue-60622.stderr @@ -16,15 +16,15 @@ LL | #![deny(warnings)] = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #42868 <https://github.com/rust-lang/rust/issues/42868> -error[E0107]: this associated function takes 0 type arguments but 1 type argument was supplied +error[E0107]: this associated function takes 0 generic arguments but 1 generic argument was supplied --> $DIR/issue-60622.rs:10:7 | LL | b.a::<'_, T>(); - | ^ --- help: remove this type argument + | ^ - help: remove this generic argument | | - | expected 0 type arguments + | expected 0 generic arguments | -note: associated function defined here, with 0 type parameters +note: associated function defined here, with 0 generic parameters --> $DIR/issue-60622.rs:6:8 | LL | fn a(&self) {} diff --git a/src/test/ui/lint/lint-stability-deprecated.stderr b/src/test/ui/lint/lint-stability-deprecated.stderr index 47dc8e4a63c..94fc1a7b46d 100644 --- a/src/test/ui/lint/lint-stability-deprecated.stderr +++ b/src/test/ui/lint/lint-stability-deprecated.stderr @@ -335,16 +335,16 @@ LL | foo.method_deprecated(); | ^^^^^^^^^^^^^^^^^ warning: use of deprecated associated function `lint_stability::MethodTester::method_deprecated`: text - --> $DIR/lint-stability-deprecated.rs:26:9 + --> $DIR/lint-stability-deprecated.rs:26:14 | LL | Foo::method_deprecated(&foo); - | ^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^ warning: use of deprecated associated function `lint_stability::MethodTester::method_deprecated`: text - --> $DIR/lint-stability-deprecated.rs:27:9 + --> $DIR/lint-stability-deprecated.rs:27:16 | LL | <Foo>::method_deprecated(&foo); - | ^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^ warning: use of deprecated associated function `lint_stability::Trait::trait_deprecated`: text --> $DIR/lint-stability-deprecated.rs:28:13 @@ -353,10 +353,10 @@ LL | foo.trait_deprecated(); | ^^^^^^^^^^^^^^^^ warning: use of deprecated associated function `lint_stability::Trait::trait_deprecated`: text - --> $DIR/lint-stability-deprecated.rs:30:9 + --> $DIR/lint-stability-deprecated.rs:30:16 | LL | <Foo>::trait_deprecated(&foo); - | ^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^ warning: use of deprecated associated function `lint_stability::MethodTester::method_deprecated_text`: text --> $DIR/lint-stability-deprecated.rs:34:13 @@ -365,16 +365,16 @@ LL | ... foo.method_deprecated_text(); | ^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated associated function `lint_stability::MethodTester::method_deprecated_text`: text - --> $DIR/lint-stability-deprecated.rs:35:9 + --> $DIR/lint-stability-deprecated.rs:35:14 | LL | ... Foo::method_deprecated_text(&foo); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated associated function `lint_stability::MethodTester::method_deprecated_text`: text - --> $DIR/lint-stability-deprecated.rs:36:9 + --> $DIR/lint-stability-deprecated.rs:36:16 | LL | ... <Foo>::method_deprecated_text(&foo); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated associated function `lint_stability::Trait::trait_deprecated_text`: text --> $DIR/lint-stability-deprecated.rs:37:13 @@ -383,10 +383,10 @@ LL | foo.trait_deprecated_text(); | ^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated associated function `lint_stability::Trait::trait_deprecated_text`: text - --> $DIR/lint-stability-deprecated.rs:39:9 + --> $DIR/lint-stability-deprecated.rs:39:16 | LL | ... <Foo>::trait_deprecated_text(&foo); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated associated function `lint_stability::MethodTester::method_deprecated_unstable`: text --> $DIR/lint-stability-deprecated.rs:43:13 @@ -395,16 +395,16 @@ LL | ... foo.method_deprecated_unstable(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated associated function `lint_stability::MethodTester::method_deprecated_unstable`: text - --> $DIR/lint-stability-deprecated.rs:44:9 + --> $DIR/lint-stability-deprecated.rs:44:14 | LL | ... Foo::method_deprecated_unstable(&foo); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated associated function `lint_stability::MethodTester::method_deprecated_unstable`: text - --> $DIR/lint-stability-deprecated.rs:45:9 + --> $DIR/lint-stability-deprecated.rs:45:16 | LL | ... <Foo>::method_deprecated_unstable(&foo); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated associated function `lint_stability::Trait::trait_deprecated_unstable`: text --> $DIR/lint-stability-deprecated.rs:46:13 @@ -413,10 +413,10 @@ LL | foo.trait_deprecated_unstable(); | ^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated associated function `lint_stability::Trait::trait_deprecated_unstable`: text - --> $DIR/lint-stability-deprecated.rs:48:9 + --> $DIR/lint-stability-deprecated.rs:48:16 | LL | ... <Foo>::trait_deprecated_unstable(&foo); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated associated function `lint_stability::MethodTester::method_deprecated_unstable_text`: text --> $DIR/lint-stability-deprecated.rs:52:13 @@ -425,16 +425,16 @@ LL | ... foo.method_deprecated_unstable_text(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated associated function `lint_stability::MethodTester::method_deprecated_unstable_text`: text - --> $DIR/lint-stability-deprecated.rs:53:9 + --> $DIR/lint-stability-deprecated.rs:53:14 | LL | ... Foo::method_deprecated_unstable_text(&foo); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated associated function `lint_stability::MethodTester::method_deprecated_unstable_text`: text - --> $DIR/lint-stability-deprecated.rs:54:9 + --> $DIR/lint-stability-deprecated.rs:54:16 | LL | ... <Foo>::method_deprecated_unstable_text(&foo); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated associated function `lint_stability::Trait::trait_deprecated_unstable_text`: text --> $DIR/lint-stability-deprecated.rs:55:13 @@ -443,10 +443,10 @@ LL | ... foo.trait_deprecated_unstable_text(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated associated function `lint_stability::Trait::trait_deprecated_unstable_text`: text - --> $DIR/lint-stability-deprecated.rs:57:9 + --> $DIR/lint-stability-deprecated.rs:57:16 | LL | ... <Foo>::trait_deprecated_unstable_text(&foo); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated field `lint_stability::DeprecatedStruct::i`: text --> $DIR/lint-stability-deprecated.rs:109:13 @@ -467,10 +467,10 @@ LL | foo.trait_deprecated(); | ^^^^^^^^^^^^^^^^ warning: use of deprecated associated function `lint_stability::Trait::trait_deprecated`: text - --> $DIR/lint-stability-deprecated.rs:146:9 + --> $DIR/lint-stability-deprecated.rs:146:16 | LL | <Foo>::trait_deprecated(&foo); - | ^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^ warning: use of deprecated associated function `lint_stability::Trait::trait_deprecated_text`: text --> $DIR/lint-stability-deprecated.rs:148:13 @@ -479,10 +479,10 @@ LL | foo.trait_deprecated_text(); | ^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated associated function `lint_stability::Trait::trait_deprecated_text`: text - --> $DIR/lint-stability-deprecated.rs:150:9 + --> $DIR/lint-stability-deprecated.rs:150:16 | LL | ... <Foo>::trait_deprecated_text(&foo); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated associated function `lint_stability::Trait::trait_deprecated_unstable`: text --> $DIR/lint-stability-deprecated.rs:152:13 @@ -491,10 +491,10 @@ LL | foo.trait_deprecated_unstable(); | ^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated associated function `lint_stability::Trait::trait_deprecated_unstable`: text - --> $DIR/lint-stability-deprecated.rs:154:9 + --> $DIR/lint-stability-deprecated.rs:154:16 | LL | ... <Foo>::trait_deprecated_unstable(&foo); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated associated function `lint_stability::Trait::trait_deprecated_unstable_text`: text --> $DIR/lint-stability-deprecated.rs:156:13 @@ -503,10 +503,10 @@ LL | ... foo.trait_deprecated_unstable_text(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated associated function `lint_stability::Trait::trait_deprecated_unstable_text`: text - --> $DIR/lint-stability-deprecated.rs:158:9 + --> $DIR/lint-stability-deprecated.rs:158:16 | LL | ... <Foo>::trait_deprecated_unstable_text(&foo); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated associated function `lint_stability::Trait::trait_deprecated`: text --> $DIR/lint-stability-deprecated.rs:175:13 @@ -539,16 +539,16 @@ LL | foo.method_deprecated(); | ^^^^^^^^^^^^^^^^^ warning: use of deprecated associated function `this_crate::MethodTester::method_deprecated`: text - --> $DIR/lint-stability-deprecated.rs:332:9 + --> $DIR/lint-stability-deprecated.rs:332:14 | LL | Foo::method_deprecated(&foo); - | ^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^ warning: use of deprecated associated function `this_crate::MethodTester::method_deprecated`: text - --> $DIR/lint-stability-deprecated.rs:333:9 + --> $DIR/lint-stability-deprecated.rs:333:16 | LL | <Foo>::method_deprecated(&foo); - | ^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^ warning: use of deprecated associated function `this_crate::Trait::trait_deprecated`: text --> $DIR/lint-stability-deprecated.rs:334:13 @@ -557,10 +557,10 @@ LL | foo.trait_deprecated(); | ^^^^^^^^^^^^^^^^ warning: use of deprecated associated function `this_crate::Trait::trait_deprecated`: text - --> $DIR/lint-stability-deprecated.rs:336:9 + --> $DIR/lint-stability-deprecated.rs:336:16 | LL | <Foo>::trait_deprecated(&foo); - | ^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^ warning: use of deprecated associated function `this_crate::MethodTester::method_deprecated_text`: text --> $DIR/lint-stability-deprecated.rs:340:13 @@ -569,16 +569,16 @@ LL | ... foo.method_deprecated_text(); | ^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated associated function `this_crate::MethodTester::method_deprecated_text`: text - --> $DIR/lint-stability-deprecated.rs:341:9 + --> $DIR/lint-stability-deprecated.rs:341:14 | LL | ... Foo::method_deprecated_text(&foo); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated associated function `this_crate::MethodTester::method_deprecated_text`: text - --> $DIR/lint-stability-deprecated.rs:342:9 + --> $DIR/lint-stability-deprecated.rs:342:16 | LL | ... <Foo>::method_deprecated_text(&foo); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated associated function `this_crate::Trait::trait_deprecated_text`: text --> $DIR/lint-stability-deprecated.rs:343:13 @@ -587,10 +587,10 @@ LL | foo.trait_deprecated_text(); | ^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated associated function `this_crate::Trait::trait_deprecated_text`: text - --> $DIR/lint-stability-deprecated.rs:345:9 + --> $DIR/lint-stability-deprecated.rs:345:16 | LL | <Foo>::trait_deprecated_text(&foo); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated field `this_crate::DeprecatedStruct::i`: text --> $DIR/lint-stability-deprecated.rs:386:13 @@ -605,10 +605,10 @@ LL | foo.trait_deprecated(); | ^^^^^^^^^^^^^^^^ warning: use of deprecated associated function `this_crate::Trait::trait_deprecated`: text - --> $DIR/lint-stability-deprecated.rs:407:9 + --> $DIR/lint-stability-deprecated.rs:407:16 | LL | <Foo>::trait_deprecated(&foo); - | ^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^ warning: use of deprecated associated function `this_crate::Trait::trait_deprecated_text`: text --> $DIR/lint-stability-deprecated.rs:409:13 @@ -617,10 +617,10 @@ LL | foo.trait_deprecated_text(); | ^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated associated function `this_crate::Trait::trait_deprecated_text`: text - --> $DIR/lint-stability-deprecated.rs:411:9 + --> $DIR/lint-stability-deprecated.rs:411:16 | LL | <Foo>::trait_deprecated_text(&foo); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated associated function `this_crate::Trait::trait_deprecated`: text --> $DIR/lint-stability-deprecated.rs:428:13 diff --git a/src/test/ui/methods/method-call-lifetime-args-fail.rs b/src/test/ui/methods/method-call-lifetime-args-fail.rs index af173851252..6bf55844da8 100644 --- a/src/test/ui/methods/method-call-lifetime-args-fail.rs +++ b/src/test/ui/methods/method-call-lifetime-args-fail.rs @@ -14,7 +14,7 @@ impl S { fn method_call() { S.early(); // OK S.early::<'static>(); - //~^ ERROR this associated function takes 2 lifetime arguments but only 1 lifetime argument was supplied + //~^ ERROR this associated function takes 2 lifetime arguments but 1 lifetime argument S.early::<'static, 'static, 'static>(); //~^ ERROR this associated function takes 2 lifetime arguments but 3 lifetime arguments were supplied let _: &u8 = S.life_and_type::<'static>(); @@ -61,7 +61,7 @@ fn ufcs() { S::early(S); // OK S::early::<'static>(S); - //~^ ERROR this associated function takes 2 lifetime arguments but only 1 lifetime argument was supplied + //~^ ERROR this associated function takes 2 lifetime arguments but 1 lifetime argument S::early::<'static, 'static, 'static>(S); //~^ ERROR this associated function takes 2 lifetime arguments but 3 lifetime arguments were supplied let _: &u8 = S::life_and_type::<'static>(S); diff --git a/src/test/ui/methods/method-call-lifetime-args-fail.stderr b/src/test/ui/methods/method-call-lifetime-args-fail.stderr index 2907309c27c..ea50815ec1a 100644 --- a/src/test/ui/methods/method-call-lifetime-args-fail.stderr +++ b/src/test/ui/methods/method-call-lifetime-args-fail.stderr @@ -1,4 +1,4 @@ -error[E0107]: this associated function takes 2 lifetime arguments but only 1 lifetime argument was supplied +error[E0107]: this associated function takes 2 lifetime arguments but 1 lifetime argument was supplied --> $DIR/method-call-lifetime-args-fail.rs:16:7 | LL | S.early::<'static>(); @@ -20,7 +20,7 @@ error[E0107]: this associated function takes 2 lifetime arguments but 3 lifetime --> $DIR/method-call-lifetime-args-fail.rs:18:7 | LL | S.early::<'static, 'static, 'static>(); - | ^^^^^ --------- help: remove this lifetime argument + | ^^^^^ ------- help: remove this lifetime argument | | | expected 2 lifetime arguments | @@ -198,7 +198,7 @@ note: the late bound lifetime parameter is introduced here LL | fn late_unused_early<'a, 'b>(self) -> &'b u8 { loop {} } | ^^ -error[E0107]: this associated function takes 2 lifetime arguments but only 1 lifetime argument was supplied +error[E0107]: this associated function takes 2 lifetime arguments but 1 lifetime argument was supplied --> $DIR/method-call-lifetime-args-fail.rs:63:8 | LL | S::early::<'static>(S); @@ -220,7 +220,7 @@ error[E0107]: this associated function takes 2 lifetime arguments but 3 lifetime --> $DIR/method-call-lifetime-args-fail.rs:65:8 | LL | S::early::<'static, 'static, 'static>(S); - | ^^^^^ --------- help: remove this lifetime argument + | ^^^^^ ------- help: remove this lifetime argument | | | expected 2 lifetime arguments | diff --git a/src/test/ui/mismatched_types/const-fn-in-trait.rs b/src/test/ui/mismatched_types/const-fn-in-trait.rs index 3b1992d90b7..e04d59c58c2 100644 --- a/src/test/ui/mismatched_types/const-fn-in-trait.rs +++ b/src/test/ui/mismatched_types/const-fn-in-trait.rs @@ -1,5 +1,3 @@ -#![feature(const_fn)] - trait Foo { fn f() -> u32; const fn g(); //~ ERROR cannot be declared const diff --git a/src/test/ui/mismatched_types/const-fn-in-trait.stderr b/src/test/ui/mismatched_types/const-fn-in-trait.stderr index 450981a9183..7d1fbe45c53 100644 --- a/src/test/ui/mismatched_types/const-fn-in-trait.stderr +++ b/src/test/ui/mismatched_types/const-fn-in-trait.stderr @@ -1,11 +1,11 @@ error[E0379]: functions in traits cannot be declared const - --> $DIR/const-fn-in-trait.rs:5:5 + --> $DIR/const-fn-in-trait.rs:3:5 | LL | const fn g(); | ^^^^^ functions in traits cannot be const error[E0379]: functions in traits cannot be declared const - --> $DIR/const-fn-in-trait.rs:9:5 + --> $DIR/const-fn-in-trait.rs:7:5 | LL | const fn f() -> u32 { 22 } | ^^^^^ functions in traits cannot be const diff --git a/src/test/ui/non-fmt-panic.rs b/src/test/ui/non-fmt-panic.rs index c80a90b3eaa..77390aae2d6 100644 --- a/src/test/ui/non-fmt-panic.rs +++ b/src/test/ui/non-fmt-panic.rs @@ -36,6 +36,8 @@ fn main() { panic!(a!()); //~ WARN panic message is not a string literal panic!(format!("{}", 1)); //~ WARN panic message is not a string literal + assert!(false, format!("{}", 1)); //~ WARN panic message is not a string literal + debug_assert!(false, format!("{}", 1)); //~ WARN panic message is not a string literal panic![123]; //~ WARN panic message is not a string literal panic!{123}; //~ WARN panic message is not a string literal diff --git a/src/test/ui/non-fmt-panic.stderr b/src/test/ui/non-fmt-panic.stderr index 7a333b3e76a..3278eb5f023 100644 --- a/src/test/ui/non-fmt-panic.stderr +++ b/src/test/ui/non-fmt-panic.stderr @@ -213,7 +213,33 @@ LL | panic!("{}", 1); | -- -- warning: panic message is not a string literal - --> $DIR/non-fmt-panic.rs:40:12 + --> $DIR/non-fmt-panic.rs:39:20 + | +LL | assert!(false, format!("{}", 1)); + | ^^^^^^^^^^^^^^^^ + | + = note: this is no longer accepted in Rust 2021 + = note: the assert!() macro supports formatting, so there's no need for the format!() macro here +help: remove the `format!(..)` macro call + | +LL | assert!(false, "{}", 1); + | -- -- + +warning: panic message is not a string literal + --> $DIR/non-fmt-panic.rs:40:26 + | +LL | debug_assert!(false, format!("{}", 1)); + | ^^^^^^^^^^^^^^^^ + | + = note: this is no longer accepted in Rust 2021 + = note: the debug_assert!() macro supports formatting, so there's no need for the format!() macro here +help: remove the `format!(..)` macro call + | +LL | debug_assert!(false, "{}", 1); + | -- -- + +warning: panic message is not a string literal + --> $DIR/non-fmt-panic.rs:42:12 | LL | panic![123]; | ^^^ @@ -229,7 +255,7 @@ LL | std::panic::panic_any(123); | ^^^^^^^^^^^^^^^^^^^^^^ ^ warning: panic message is not a string literal - --> $DIR/non-fmt-panic.rs:41:12 + --> $DIR/non-fmt-panic.rs:43:12 | LL | panic!{123}; | ^^^ @@ -244,5 +270,5 @@ help: or use std::panic::panic_any instead LL | std::panic::panic_any(123); | ^^^^^^^^^^^^^^^^^^^^^^ ^ -warning: 18 warnings emitted +warning: 20 warnings emitted diff --git a/src/test/ui/parser/fn-header-semantic-fail.rs b/src/test/ui/parser/fn-header-semantic-fail.rs index 0bbaeec0c7f..91a63bafd99 100644 --- a/src/test/ui/parser/fn-header-semantic-fail.rs +++ b/src/test/ui/parser/fn-header-semantic-fail.rs @@ -3,7 +3,6 @@ // edition:2018 #![feature(const_extern_fn)] -#![feature(const_fn)] fn main() { async fn ff1() {} // OK. diff --git a/src/test/ui/parser/fn-header-semantic-fail.stderr b/src/test/ui/parser/fn-header-semantic-fail.stderr index 2e513415e6c..b3f60b13b0f 100644 --- a/src/test/ui/parser/fn-header-semantic-fail.stderr +++ b/src/test/ui/parser/fn-header-semantic-fail.stderr @@ -1,5 +1,5 @@ error: functions cannot be both `const` and `async` - --> $DIR/fn-header-semantic-fail.rs:13:5 + --> $DIR/fn-header-semantic-fail.rs:12:5 | LL | const async unsafe extern "C" fn ff5() {} // OK. | ^^^^^-^^^^^------------------------------ @@ -8,7 +8,7 @@ LL | const async unsafe extern "C" fn ff5() {} // OK. | `const` because of this error[E0706]: functions in traits cannot be declared `async` - --> $DIR/fn-header-semantic-fail.rs:17:9 + --> $DIR/fn-header-semantic-fail.rs:16:9 | LL | async fn ft1(); | -----^^^^^^^^^^ @@ -19,19 +19,19 @@ LL | async fn ft1(); = note: consider using the `async-trait` crate: https://crates.io/crates/async-trait error[E0379]: functions in traits cannot be declared const - --> $DIR/fn-header-semantic-fail.rs:19:9 + --> $DIR/fn-header-semantic-fail.rs:18:9 | LL | const fn ft3(); | ^^^^^ functions in traits cannot be const error[E0379]: functions in traits cannot be declared const - --> $DIR/fn-header-semantic-fail.rs:21:9 + --> $DIR/fn-header-semantic-fail.rs:20:9 | LL | const async unsafe extern "C" fn ft5(); | ^^^^^ functions in traits cannot be const error[E0706]: functions in traits cannot be declared `async` - --> $DIR/fn-header-semantic-fail.rs:21:9 + --> $DIR/fn-header-semantic-fail.rs:20:9 | LL | const async unsafe extern "C" fn ft5(); | ^^^^^^-----^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -42,7 +42,7 @@ LL | const async unsafe extern "C" fn ft5(); = note: consider using the `async-trait` crate: https://crates.io/crates/async-trait error: functions cannot be both `const` and `async` - --> $DIR/fn-header-semantic-fail.rs:21:9 + --> $DIR/fn-header-semantic-fail.rs:20:9 | LL | const async unsafe extern "C" fn ft5(); | ^^^^^-^^^^^---------------------------- @@ -51,7 +51,7 @@ LL | const async unsafe extern "C" fn ft5(); | `const` because of this error[E0706]: functions in traits cannot be declared `async` - --> $DIR/fn-header-semantic-fail.rs:29:9 + --> $DIR/fn-header-semantic-fail.rs:28:9 | LL | async fn ft1() {} | -----^^^^^^^^^^^^ @@ -62,19 +62,19 @@ LL | async fn ft1() {} = note: consider using the `async-trait` crate: https://crates.io/crates/async-trait error[E0379]: functions in traits cannot be declared const - --> $DIR/fn-header-semantic-fail.rs:32:9 + --> $DIR/fn-header-semantic-fail.rs:31:9 | LL | const fn ft3() {} | ^^^^^ functions in traits cannot be const error[E0379]: functions in traits cannot be declared const - --> $DIR/fn-header-semantic-fail.rs:34:9 + --> $DIR/fn-header-semantic-fail.rs:33:9 | LL | const async unsafe extern "C" fn ft5() {} | ^^^^^ functions in traits cannot be const error[E0706]: functions in traits cannot be declared `async` - --> $DIR/fn-header-semantic-fail.rs:34:9 + --> $DIR/fn-header-semantic-fail.rs:33:9 | LL | const async unsafe extern "C" fn ft5() {} | ^^^^^^-----^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -85,7 +85,7 @@ LL | const async unsafe extern "C" fn ft5() {} = note: consider using the `async-trait` crate: https://crates.io/crates/async-trait error: functions cannot be both `const` and `async` - --> $DIR/fn-header-semantic-fail.rs:34:9 + --> $DIR/fn-header-semantic-fail.rs:33:9 | LL | const async unsafe extern "C" fn ft5() {} | ^^^^^-^^^^^------------------------------ @@ -94,7 +94,7 @@ LL | const async unsafe extern "C" fn ft5() {} | `const` because of this error: functions cannot be both `const` and `async` - --> $DIR/fn-header-semantic-fail.rs:46:9 + --> $DIR/fn-header-semantic-fail.rs:45:9 | LL | const async unsafe extern "C" fn fi5() {} | ^^^^^-^^^^^------------------------------ @@ -103,7 +103,7 @@ LL | const async unsafe extern "C" fn fi5() {} | `const` because of this error: functions in `extern` blocks cannot have qualifiers - --> $DIR/fn-header-semantic-fail.rs:51:18 + --> $DIR/fn-header-semantic-fail.rs:50:18 | LL | extern "C" { | ---------- in this `extern` block @@ -116,7 +116,7 @@ LL | fn fe1(); | ^^ error: functions in `extern` blocks cannot have qualifiers - --> $DIR/fn-header-semantic-fail.rs:52:19 + --> $DIR/fn-header-semantic-fail.rs:51:19 | LL | extern "C" { | ---------- in this `extern` block @@ -130,7 +130,7 @@ LL | fn fe2(); | ^^ error: functions in `extern` blocks cannot have qualifiers - --> $DIR/fn-header-semantic-fail.rs:53:18 + --> $DIR/fn-header-semantic-fail.rs:52:18 | LL | extern "C" { | ---------- in this `extern` block @@ -144,7 +144,7 @@ LL | fn fe3(); | ^^ error: functions in `extern` blocks cannot have qualifiers - --> $DIR/fn-header-semantic-fail.rs:54:23 + --> $DIR/fn-header-semantic-fail.rs:53:23 | LL | extern "C" { | ---------- in this `extern` block @@ -158,7 +158,7 @@ LL | fn fe4(); | ^^ error: functions in `extern` blocks cannot have qualifiers - --> $DIR/fn-header-semantic-fail.rs:55:42 + --> $DIR/fn-header-semantic-fail.rs:54:42 | LL | extern "C" { | ---------- in this `extern` block @@ -172,7 +172,7 @@ LL | fn fe5(); | ^^ error: functions cannot be both `const` and `async` - --> $DIR/fn-header-semantic-fail.rs:55:9 + --> $DIR/fn-header-semantic-fail.rs:54:9 | LL | const async unsafe extern "C" fn fe5(); | ^^^^^-^^^^^---------------------------- @@ -181,7 +181,7 @@ LL | const async unsafe extern "C" fn fe5(); | `const` because of this error[E0053]: method `ft1` has an incompatible type for trait - --> $DIR/fn-header-semantic-fail.rs:29:24 + --> $DIR/fn-header-semantic-fail.rs:28:24 | LL | async fn ft1(); | - type in trait @@ -197,7 +197,7 @@ LL | async fn ft1() {} found fn pointer `fn() -> impl Future` error[E0053]: method `ft5` has an incompatible type for trait - --> $DIR/fn-header-semantic-fail.rs:34:48 + --> $DIR/fn-header-semantic-fail.rs:33:48 | LL | const async unsafe extern "C" fn ft5(); | - type in trait diff --git a/src/test/ui/rfc-2091-track-caller/caller-location-fnptr-rt-ctfe-equiv.rs b/src/test/ui/rfc-2091-track-caller/caller-location-fnptr-rt-ctfe-equiv.rs index 05240908917..a3bed707ecc 100644 --- a/src/test/ui/rfc-2091-track-caller/caller-location-fnptr-rt-ctfe-equiv.rs +++ b/src/test/ui/rfc-2091-track-caller/caller-location-fnptr-rt-ctfe-equiv.rs @@ -6,7 +6,7 @@ // run-pass // compile-flags: -Z unleash-the-miri-inside-of-you -#![feature(core_intrinsics, const_caller_location, const_fn)] +#![feature(core_intrinsics, const_caller_location)] type L = &'static std::panic::Location<'static>; diff --git a/src/test/ui/rfc-2091-track-caller/const-caller-location.rs b/src/test/ui/rfc-2091-track-caller/const-caller-location.rs index 89b0b69f38d..6e15cf3fe8a 100644 --- a/src/test/ui/rfc-2091-track-caller/const-caller-location.rs +++ b/src/test/ui/rfc-2091-track-caller/const-caller-location.rs @@ -2,7 +2,7 @@ // revisions: default mir-opt //[mir-opt] compile-flags: -Zmir-opt-level=4 -#![feature(const_caller_location, const_fn)] +#![feature(const_caller_location)] use std::panic::Location; diff --git a/src/test/ui/rustc-args-required-const2.rs b/src/test/ui/rustc-args-required-const2.rs index 5feeca6f530..06457bc5ca6 100644 --- a/src/test/ui/rustc-args-required-const2.rs +++ b/src/test/ui/rustc-args-required-const2.rs @@ -1,4 +1,4 @@ -#![feature(rustc_attrs, const_fn)] +#![feature(rustc_attrs)] #[rustc_args_required_const(0)] fn foo(_a: i32) { diff --git a/src/test/ui/seq-args.rs b/src/test/ui/seq-args.rs index 9a3c495602a..a5ebeecd311 100644 --- a/src/test/ui/seq-args.rs +++ b/src/test/ui/seq-args.rs @@ -2,12 +2,12 @@ fn main() { trait Seq { } impl<T> Seq<T> for Vec<T> { - //~^ ERROR this trait takes 0 type arguments but 1 type argument was supplied + //~^ ERROR this trait takes 0 generic arguments but 1 generic argument /* ... */ } impl Seq<bool> for u32 { - //~^ ERROR this trait takes 0 type arguments but 1 type argument was supplied + //~^ ERROR this trait takes 0 generic arguments but 1 generic argument /* Treat the integer as a sequence of bits */ } } diff --git a/src/test/ui/seq-args.stderr b/src/test/ui/seq-args.stderr index 0e89fefc69d..c404d95748b 100644 --- a/src/test/ui/seq-args.stderr +++ b/src/test/ui/seq-args.stderr @@ -1,26 +1,26 @@ -error[E0107]: this trait takes 0 type arguments but 1 type argument was supplied +error[E0107]: this trait takes 0 generic arguments but 1 generic argument was supplied --> $DIR/seq-args.rs:4:13 | LL | impl<T> Seq<T> for Vec<T> { | ^^^--- help: remove these generics | | - | expected 0 type arguments + | expected 0 generic arguments | -note: trait defined here, with 0 type parameters +note: trait defined here, with 0 generic parameters --> $DIR/seq-args.rs:2:11 | LL | trait Seq { } | ^^^ -error[E0107]: this trait takes 0 type arguments but 1 type argument was supplied +error[E0107]: this trait takes 0 generic arguments but 1 generic argument was supplied --> $DIR/seq-args.rs:9:10 | LL | impl Seq<bool> for u32 { | ^^^------ help: remove these generics | | - | expected 0 type arguments + | expected 0 generic arguments | -note: trait defined here, with 0 type parameters +note: trait defined here, with 0 generic parameters --> $DIR/seq-args.rs:2:11 | LL | trait Seq { } diff --git a/src/test/ui/stability-attribute/stability-attribute-sanity.rs b/src/test/ui/stability-attribute/stability-attribute-sanity.rs index 9f8ecc26281..d7cb66d9c84 100644 --- a/src/test/ui/stability-attribute/stability-attribute-sanity.rs +++ b/src/test/ui/stability-attribute/stability-attribute-sanity.rs @@ -1,6 +1,6 @@ // Various checks that stability attributes are used correctly, per RFC 507 -#![feature(const_fn, staged_api)] +#![feature(staged_api)] #![stable(feature = "rust1", since = "1.0.0")] diff --git a/src/test/ui/static/static-drop-scope.rs b/src/test/ui/static/static-drop-scope.rs index 0de28d5469b..e7ea8663d5a 100644 --- a/src/test/ui/static/static-drop-scope.rs +++ b/src/test/ui/static/static-drop-scope.rs @@ -1,5 +1,3 @@ -#![feature(const_fn)] - struct WithDtor; impl Drop for WithDtor { diff --git a/src/test/ui/static/static-drop-scope.stderr b/src/test/ui/static/static-drop-scope.stderr index ed81734f6eb..ac32f217fd7 100644 --- a/src/test/ui/static/static-drop-scope.stderr +++ b/src/test/ui/static/static-drop-scope.stderr @@ -1,5 +1,5 @@ error[E0493]: destructors cannot be evaluated at compile-time - --> $DIR/static-drop-scope.rs:9:60 + --> $DIR/static-drop-scope.rs:7:60 | LL | static PROMOTION_FAIL_S: Option<&'static WithDtor> = Some(&WithDtor); | ^^^^^^^^- value is dropped here @@ -7,7 +7,7 @@ LL | static PROMOTION_FAIL_S: Option<&'static WithDtor> = Some(&WithDtor); | statics cannot evaluate destructors error[E0716]: temporary value dropped while borrowed - --> $DIR/static-drop-scope.rs:9:60 + --> $DIR/static-drop-scope.rs:7:60 | LL | static PROMOTION_FAIL_S: Option<&'static WithDtor> = Some(&WithDtor); | ------^^^^^^^^- @@ -17,7 +17,7 @@ LL | static PROMOTION_FAIL_S: Option<&'static WithDtor> = Some(&WithDtor); | using this value as a static requires that borrow lasts for `'static` error[E0493]: destructors cannot be evaluated at compile-time - --> $DIR/static-drop-scope.rs:13:59 + --> $DIR/static-drop-scope.rs:11:59 | LL | const PROMOTION_FAIL_C: Option<&'static WithDtor> = Some(&WithDtor); | ^^^^^^^^- value is dropped here @@ -25,7 +25,7 @@ LL | const PROMOTION_FAIL_C: Option<&'static WithDtor> = Some(&WithDtor); | constants cannot evaluate destructors error[E0716]: temporary value dropped while borrowed - --> $DIR/static-drop-scope.rs:13:59 + --> $DIR/static-drop-scope.rs:11:59 | LL | const PROMOTION_FAIL_C: Option<&'static WithDtor> = Some(&WithDtor); | ------^^^^^^^^- @@ -35,7 +35,7 @@ LL | const PROMOTION_FAIL_C: Option<&'static WithDtor> = Some(&WithDtor); | using this value as a constant requires that borrow lasts for `'static` error[E0493]: destructors cannot be evaluated at compile-time - --> $DIR/static-drop-scope.rs:17:28 + --> $DIR/static-drop-scope.rs:15:28 | LL | static EARLY_DROP_S: i32 = (WithDtor, 0).1; | ^^^^^^^^^^^^^ - value is dropped here @@ -43,7 +43,7 @@ LL | static EARLY_DROP_S: i32 = (WithDtor, 0).1; | statics cannot evaluate destructors error[E0493]: destructors cannot be evaluated at compile-time - --> $DIR/static-drop-scope.rs:20:27 + --> $DIR/static-drop-scope.rs:18:27 | LL | const EARLY_DROP_C: i32 = (WithDtor, 0).1; | ^^^^^^^^^^^^^ - value is dropped here @@ -51,7 +51,7 @@ LL | const EARLY_DROP_C: i32 = (WithDtor, 0).1; | constants cannot evaluate destructors error[E0493]: destructors cannot be evaluated at compile-time - --> $DIR/static-drop-scope.rs:23:24 + --> $DIR/static-drop-scope.rs:21:24 | LL | const fn const_drop<T>(_: T) {} | ^ - value is dropped here @@ -59,7 +59,7 @@ LL | const fn const_drop<T>(_: T) {} | constant functions cannot evaluate destructors error[E0493]: destructors cannot be evaluated at compile-time - --> $DIR/static-drop-scope.rs:27:5 + --> $DIR/static-drop-scope.rs:25:5 | LL | (x, ()).1 | ^^^^^^^ constant functions cannot evaluate destructors @@ -68,7 +68,7 @@ LL | } | - value is dropped here error[E0493]: destructors cannot be evaluated at compile-time - --> $DIR/static-drop-scope.rs:31:34 + --> $DIR/static-drop-scope.rs:29:34 | LL | const EARLY_DROP_C_OPTION: i32 = (Some(WithDtor), 0).1; | ^^^^^^^^^^^^^^^^^^^ - value is dropped here @@ -76,7 +76,7 @@ LL | const EARLY_DROP_C_OPTION: i32 = (Some(WithDtor), 0).1; | constants cannot evaluate destructors error[E0493]: destructors cannot be evaluated at compile-time - --> $DIR/static-drop-scope.rs:36:43 + --> $DIR/static-drop-scope.rs:34:43 | LL | const EARLY_DROP_C_OPTION_CONSTANT: i32 = (HELPER, 0).1; | ^^^^^^^^^^^ - value is dropped here diff --git a/src/test/ui/structs-enums/struct-rec/issue-74224.rs b/src/test/ui/structs-enums/struct-rec/issue-74224.rs new file mode 100644 index 00000000000..f3b72c5df7f --- /dev/null +++ b/src/test/ui/structs-enums/struct-rec/issue-74224.rs @@ -0,0 +1,11 @@ +struct A<T> { +//~^ ERROR recursive type `A` has infinite size + x: T, + y: A<A<T>>, +} + +struct B { + z: A<usize> +} + +fn main() {} diff --git a/src/test/ui/structs-enums/struct-rec/issue-74224.stderr b/src/test/ui/structs-enums/struct-rec/issue-74224.stderr new file mode 100644 index 00000000000..d61ab1952f9 --- /dev/null +++ b/src/test/ui/structs-enums/struct-rec/issue-74224.stderr @@ -0,0 +1,17 @@ +error[E0072]: recursive type `A` has infinite size + --> $DIR/issue-74224.rs:1:1 + | +LL | struct A<T> { + | ^^^^^^^^^^^ recursive type has infinite size +... +LL | y: A<A<T>>, + | ------- recursive without indirection + | +help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to make `A` representable + | +LL | y: Box<A<A<T>>>, + | ^^^^ ^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0072`. diff --git a/src/test/ui/structs-enums/struct-rec/issue-84611.rs b/src/test/ui/structs-enums/struct-rec/issue-84611.rs new file mode 100644 index 00000000000..4c356af3eb8 --- /dev/null +++ b/src/test/ui/structs-enums/struct-rec/issue-84611.rs @@ -0,0 +1,11 @@ +struct Foo<T> { +//~^ ERROR recursive type `Foo` has infinite size + x: Foo<[T; 1]>, + y: T, +} + +struct Bar { + x: Foo<Bar>, +} + +fn main() {} diff --git a/src/test/ui/structs-enums/struct-rec/issue-84611.stderr b/src/test/ui/structs-enums/struct-rec/issue-84611.stderr new file mode 100644 index 00000000000..0a898e5c46d --- /dev/null +++ b/src/test/ui/structs-enums/struct-rec/issue-84611.stderr @@ -0,0 +1,17 @@ +error[E0072]: recursive type `Foo` has infinite size + --> $DIR/issue-84611.rs:1:1 + | +LL | struct Foo<T> { + | ^^^^^^^^^^^^^ recursive type has infinite size +LL | +LL | x: Foo<[T; 1]>, + | ----------- recursive without indirection + | +help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to make `Foo` representable + | +LL | x: Box<Foo<[T; 1]>>, + | ^^^^ ^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0072`. diff --git a/src/test/ui/structs-enums/struct-rec/mutual-struct-recursion.rs b/src/test/ui/structs-enums/struct-rec/mutual-struct-recursion.rs new file mode 100644 index 00000000000..cca97f43eff --- /dev/null +++ b/src/test/ui/structs-enums/struct-rec/mutual-struct-recursion.rs @@ -0,0 +1,23 @@ +struct A<T> { +//~^ ERROR recursive type `A` has infinite size + x: T, + y: B<T>, +} + +struct B<T> { +//~^ ERROR recursive type `B` has infinite size + z: A<T> +} + +struct C<T> { +//~^ ERROR recursive type `C` has infinite size + x: T, + y: Option<Option<D<T>>>, +} + +struct D<T> { +//~^ ERROR recursive type `D` has infinite size + z: Option<Option<C<T>>>, +} + +fn main() {} diff --git a/src/test/ui/structs-enums/struct-rec/mutual-struct-recursion.stderr b/src/test/ui/structs-enums/struct-rec/mutual-struct-recursion.stderr new file mode 100644 index 00000000000..efc4ba93f0a --- /dev/null +++ b/src/test/ui/structs-enums/struct-rec/mutual-struct-recursion.stderr @@ -0,0 +1,59 @@ +error[E0072]: recursive type `A` has infinite size + --> $DIR/mutual-struct-recursion.rs:1:1 + | +LL | struct A<T> { + | ^^^^^^^^^^^ recursive type has infinite size +... +LL | y: B<T>, + | ---- recursive without indirection + | +help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to make `A` representable + | +LL | y: Box<B<T>>, + | ^^^^ ^ + +error[E0072]: recursive type `B` has infinite size + --> $DIR/mutual-struct-recursion.rs:7:1 + | +LL | struct B<T> { + | ^^^^^^^^^^^ recursive type has infinite size +LL | +LL | z: A<T> + | ---- recursive without indirection + | +help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to make `B` representable + | +LL | z: Box<A<T>> + | ^^^^ ^ + +error[E0072]: recursive type `C` has infinite size + --> $DIR/mutual-struct-recursion.rs:12:1 + | +LL | struct C<T> { + | ^^^^^^^^^^^ recursive type has infinite size +... +LL | y: Option<Option<D<T>>>, + | -------------------- recursive without indirection + | +help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to make `C` representable + | +LL | y: Box<Option<Option<D<T>>>>, + | ^^^^ ^ + +error[E0072]: recursive type `D` has infinite size + --> $DIR/mutual-struct-recursion.rs:18:1 + | +LL | struct D<T> { + | ^^^^^^^^^^^ recursive type has infinite size +LL | +LL | z: Option<Option<C<T>>>, + | -------------------- recursive without indirection + | +help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to make `D` representable + | +LL | z: Box<Option<Option<C<T>>>>, + | ^^^^ ^ + +error: aborting due to 4 previous errors + +For more information about this error, try `rustc --explain E0072`. diff --git a/src/test/ui/structs/structure-constructor-type-mismatch.rs b/src/test/ui/structs/structure-constructor-type-mismatch.rs index efc6304a6f7..a03ef590cb3 100644 --- a/src/test/ui/structs/structure-constructor-type-mismatch.rs +++ b/src/test/ui/structs/structure-constructor-type-mismatch.rs @@ -45,13 +45,13 @@ fn main() { y: 8, }; - let pt3 = PointF::<i32> { //~ ERROR this type alias takes 0 type arguments but 1 type argument was supplied + let pt3 = PointF::<i32> { //~ ERROR this type alias takes 0 generic arguments but 1 generic argument x: 9, //~ ERROR mismatched types y: 10, //~ ERROR mismatched types }; match (Point { x: 1, y: 2 }) { - PointF::<u32> { .. } => {} //~ ERROR this type alias takes 0 type arguments but 1 type argument was supplied + PointF::<u32> { .. } => {} //~ ERROR this type alias takes 0 generic arguments but 1 generic argument //~^ ERROR mismatched types } diff --git a/src/test/ui/structs/structure-constructor-type-mismatch.stderr b/src/test/ui/structs/structure-constructor-type-mismatch.stderr index 64381278681..3d64fc601df 100644 --- a/src/test/ui/structs/structure-constructor-type-mismatch.stderr +++ b/src/test/ui/structs/structure-constructor-type-mismatch.stderr @@ -52,15 +52,15 @@ LL | x: 7, | expected `f32`, found integer | help: use a float literal: `7.0` -error[E0107]: this type alias takes 0 type arguments but 1 type argument was supplied +error[E0107]: this type alias takes 0 generic arguments but 1 generic argument was supplied --> $DIR/structure-constructor-type-mismatch.rs:48:15 | LL | let pt3 = PointF::<i32> { | ^^^^^^------- help: remove these generics | | - | expected 0 type arguments + | expected 0 generic arguments | -note: type alias defined here, with 0 type parameters +note: type alias defined here, with 0 generic parameters --> $DIR/structure-constructor-type-mismatch.rs:6:6 | LL | type PointF = Point<f32>; @@ -84,15 +84,15 @@ LL | y: 10, | expected `f32`, found integer | help: use a float literal: `10.0` -error[E0107]: this type alias takes 0 type arguments but 1 type argument was supplied +error[E0107]: this type alias takes 0 generic arguments but 1 generic argument was supplied --> $DIR/structure-constructor-type-mismatch.rs:54:9 | LL | PointF::<u32> { .. } => {} | ^^^^^^------- help: remove these generics | | - | expected 0 type arguments + | expected 0 generic arguments | -note: type alias defined here, with 0 type parameters +note: type alias defined here, with 0 generic parameters --> $DIR/structure-constructor-type-mismatch.rs:6:6 | LL | type PointF = Point<f32>; diff --git a/src/test/ui/suggestions/issue-68049-1.rs b/src/test/ui/suggestions/issue-68049-1.rs new file mode 100644 index 00000000000..0acb7b1bf2b --- /dev/null +++ b/src/test/ui/suggestions/issue-68049-1.rs @@ -0,0 +1,16 @@ +use std::alloc::{GlobalAlloc, Layout}; + +struct Test(u32); + +unsafe impl GlobalAlloc for Test { + unsafe fn alloc(&self, _layout: Layout) -> *mut u8 { + self.0 += 1; //~ ERROR cannot assign + 0 as *mut u8 + } + + unsafe fn dealloc(&self, _ptr: *mut u8, _layout: Layout) { + unimplemented!(); + } +} + +fn main() { } diff --git a/src/test/ui/suggestions/issue-68049-1.stderr b/src/test/ui/suggestions/issue-68049-1.stderr new file mode 100644 index 00000000000..32367d2d0cf --- /dev/null +++ b/src/test/ui/suggestions/issue-68049-1.stderr @@ -0,0 +1,9 @@ +error[E0594]: cannot assign to `self.0` which is behind a `&` reference + --> $DIR/issue-68049-1.rs:7:9 + | +LL | self.0 += 1; + | ^^^^^^^^^^^ `self` is a `&` reference, so the data it refers to cannot be written + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0594`. diff --git a/src/test/ui/suggestions/issue-68049-2.rs b/src/test/ui/suggestions/issue-68049-2.rs new file mode 100644 index 00000000000..1c3430c14e9 --- /dev/null +++ b/src/test/ui/suggestions/issue-68049-2.rs @@ -0,0 +1,21 @@ +trait Hello { + fn example(&self, input: &i32); // should suggest here +} + +struct Test1(i32); + +impl Hello for Test1 { + fn example(&self, input: &i32) { // should not suggest here + *input = self.0; //~ ERROR cannot assign + } +} + +struct Test2(i32); + +impl Hello for Test2 { + fn example(&self, input: &i32) { // should not suggest here + self.0 += *input; //~ ERROR cannot assign + } +} + +fn main() { } diff --git a/src/test/ui/suggestions/issue-68049-2.stderr b/src/test/ui/suggestions/issue-68049-2.stderr new file mode 100644 index 00000000000..f10a83c68a8 --- /dev/null +++ b/src/test/ui/suggestions/issue-68049-2.stderr @@ -0,0 +1,21 @@ +error[E0594]: cannot assign to `*input` which is behind a `&` reference + --> $DIR/issue-68049-2.rs:9:7 + | +LL | fn example(&self, input: &i32); // should suggest here + | ---- help: consider changing that to be a mutable reference: `&mut i32` +... +LL | *input = self.0; + | ^^^^^^^^^^^^^^^ `input` is a `&` reference, so the data it refers to cannot be written + +error[E0594]: cannot assign to `self.0` which is behind a `&` reference + --> $DIR/issue-68049-2.rs:17:5 + | +LL | fn example(&self, input: &i32); // should suggest here + | ----- help: consider changing that to be a mutable reference: `&mut self` +... +LL | self.0 += *input; + | ^^^^^^^^^^^^^^^^ `self` is a `&` reference, so the data it refers to cannot be written + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0594`. diff --git a/src/test/ui/suggestions/issue-84592.rs b/src/test/ui/suggestions/issue-84592.rs new file mode 100644 index 00000000000..aa246aaa3d4 --- /dev/null +++ b/src/test/ui/suggestions/issue-84592.rs @@ -0,0 +1,17 @@ +/* Checks whether issue #84592 has been resolved. The issue was + * that in this example, there are two expected/missing lifetime + * parameters with *different spans*, leading to incorrect + * suggestions from rustc. + */ + +struct TwoLifetimes<'x, 'y> { + x: &'x (), + y: &'y (), +} + +fn two_lifetimes_needed(a: &(), b: &()) -> TwoLifetimes<'_, '_> { +//~^ ERROR missing lifetime specifiers [E0106] + TwoLifetimes { x: &(), y: &() } +} + +fn main() {} diff --git a/src/test/ui/suggestions/issue-84592.stderr b/src/test/ui/suggestions/issue-84592.stderr new file mode 100644 index 00000000000..02f9241a6d2 --- /dev/null +++ b/src/test/ui/suggestions/issue-84592.stderr @@ -0,0 +1,17 @@ +error[E0106]: missing lifetime specifiers + --> $DIR/issue-84592.rs:12:57 + | +LL | fn two_lifetimes_needed(a: &(), b: &()) -> TwoLifetimes<'_, '_> { + | --- --- ^^ ^^ expected named lifetime parameter + | | + | expected named lifetime parameter + | + = help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from `a` or `b` +help: consider introducing a named lifetime parameter + | +LL | fn two_lifetimes_needed<'a>(a: &'a (), b: &'a ()) -> TwoLifetimes<'a, 'a> { + | ^^^^ ^^^^^^ ^^^^^^ ^^ ^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0106`. diff --git a/src/test/ui/suggestions/missing-lifetime-specifier.rs b/src/test/ui/suggestions/missing-lifetime-specifier.rs index 761922beb17..4aaac2d95d4 100644 --- a/src/test/ui/suggestions/missing-lifetime-specifier.rs +++ b/src/test/ui/suggestions/missing-lifetime-specifier.rs @@ -16,44 +16,44 @@ trait Tar<'t, 'k, I> {} thread_local! { static a: RefCell<HashMap<i32, Vec<Vec<Foo>>>> = RefCell::new(HashMap::new()); - //~^ ERROR missing lifetime specifier - //~| ERROR missing lifetime specifier + //~^ ERROR missing lifetime specifiers + //~| ERROR missing lifetime specifiers } thread_local! { static b: RefCell<HashMap<i32, Vec<Vec<&Bar>>>> = RefCell::new(HashMap::new()); - //~^ ERROR missing lifetime specifier - //~| ERROR missing lifetime specifier - //~| ERROR missing lifetime specifier - //~| ERROR missing lifetime specifier + //~^ ERROR missing lifetime specifier + //~| ERROR missing lifetime specifier + //~| ERROR missing lifetime specifier + //~| ERROR missing lifetime specifier } thread_local! { static c: RefCell<HashMap<i32, Vec<Vec<Qux<i32>>>>> = RefCell::new(HashMap::new()); - //~^ ERROR missing lifetime specifier - //~| ERROR missing lifetime specifier + //~^ ERROR missing lifetime + //~| ERROR missing lifetime } thread_local! { static d: RefCell<HashMap<i32, Vec<Vec<&Tar<i32>>>>> = RefCell::new(HashMap::new()); - //~^ ERROR missing lifetime specifier - //~| ERROR missing lifetime specifier - //~| ERROR missing lifetime specifier - //~| ERROR missing lifetime specifier + //~^ ERROR missing lifetime + //~| ERROR missing lifetime + //~| ERROR missing lifetime + //~| ERROR missing lifetime } thread_local! { static e: RefCell<HashMap<i32, Vec<Vec<Qux<'static, i32>>>>> = RefCell::new(HashMap::new()); - //~^ ERROR this union takes 2 lifetime arguments but only 1 lifetime argument was supplied - //~| ERROR this union takes 2 lifetime arguments but only 1 lifetime argument was supplied - //~| ERROR this union takes 2 lifetime arguments but only 1 lifetime argument was supplied - //~| ERROR this union takes 2 lifetime arguments but only 1 lifetime argument was supplied + //~^ ERROR this union takes 2 lifetime arguments but 1 lifetime argument + //~| ERROR this union takes 2 lifetime arguments but 1 lifetime argument was supplied + //~| ERROR this union takes 2 lifetime arguments but 1 lifetime argument was supplied + //~| ERROR this union takes 2 lifetime arguments but 1 lifetime argument was supplied } thread_local! { static f: RefCell<HashMap<i32, Vec<Vec<&Tar<'static, i32>>>>> = RefCell::new(HashMap::new()); - //~^ ERROR this trait takes 2 lifetime arguments but only 1 lifetime argument was supplied - //~| ERROR this trait takes 2 lifetime arguments but only 1 lifetime argument was supplied - //~| ERROR this trait takes 2 lifetime arguments but only 1 lifetime argument was supplied - //~| ERROR this trait takes 2 lifetime arguments but only 1 lifetime argument was supplied - //~| ERROR missing lifetime specifier - //~| ERROR missing lifetime specifier + //~^ ERROR this trait takes 2 lifetime arguments but 1 lifetime argument was supplied + //~| ERROR this trait takes 2 lifetime arguments but 1 lifetime argument was supplied + //~| ERROR this trait takes 2 lifetime arguments but 1 lifetime argument was supplied + //~| ERROR this trait takes 2 lifetime arguments but 1 lifetime argument was supplied + //~| ERROR missing lifetime + //~| ERROR missing lifetime } fn main() {} diff --git a/src/test/ui/suggestions/missing-lifetime-specifier.stderr b/src/test/ui/suggestions/missing-lifetime-specifier.stderr index 489926ea78a..8ddd2f7d522 100644 --- a/src/test/ui/suggestions/missing-lifetime-specifier.stderr +++ b/src/test/ui/suggestions/missing-lifetime-specifier.stderr @@ -142,7 +142,7 @@ help: consider using the `'static` lifetime LL | static d: RefCell<HashMap<i32, Vec<Vec<&Tar<'static, 'static, i32>>>>> = RefCell::new(HashMap::new()); | ^^^^^^^^^^^^^^^^^ -error[E0107]: this union takes 2 lifetime arguments but only 1 lifetime argument was supplied +error[E0107]: this union takes 2 lifetime arguments but 1 lifetime argument was supplied --> $DIR/missing-lifetime-specifier.rs:43:44 | LL | static e: RefCell<HashMap<i32, Vec<Vec<Qux<'static, i32>>>>> = RefCell::new(HashMap::new()); @@ -157,10 +157,10 @@ LL | pub union Qux<'t, 'k, I> { | ^^^ -- -- help: add missing lifetime argument | -LL | static e: RefCell<HashMap<i32, Vec<Vec<Qux<'static, 'k, i32>>>>> = RefCell::new(HashMap::new()); +LL | static e: RefCell<HashMap<i32, Vec<Vec<Qux<'static, '_, i32>>>>> = RefCell::new(HashMap::new()); | ^^^^ -error[E0107]: this union takes 2 lifetime arguments but only 1 lifetime argument was supplied +error[E0107]: this union takes 2 lifetime arguments but 1 lifetime argument was supplied --> $DIR/missing-lifetime-specifier.rs:43:44 | LL | static e: RefCell<HashMap<i32, Vec<Vec<Qux<'static, i32>>>>> = RefCell::new(HashMap::new()); @@ -178,7 +178,7 @@ help: add missing lifetime argument LL | static e: RefCell<HashMap<i32, Vec<Vec<Qux<'static, 'k, i32>>>>> = RefCell::new(HashMap::new()); | ^^^^ -error[E0107]: this union takes 2 lifetime arguments but only 1 lifetime argument was supplied +error[E0107]: this union takes 2 lifetime arguments but 1 lifetime argument was supplied --> $DIR/missing-lifetime-specifier.rs:43:44 | LL | static e: RefCell<HashMap<i32, Vec<Vec<Qux<'static, i32>>>>> = RefCell::new(HashMap::new()); @@ -196,7 +196,7 @@ help: add missing lifetime argument LL | static e: RefCell<HashMap<i32, Vec<Vec<Qux<'static, 'k, i32>>>>> = RefCell::new(HashMap::new()); | ^^^^ -error[E0107]: this union takes 2 lifetime arguments but only 1 lifetime argument was supplied +error[E0107]: this union takes 2 lifetime arguments but 1 lifetime argument was supplied --> $DIR/missing-lifetime-specifier.rs:43:44 | LL | static e: RefCell<HashMap<i32, Vec<Vec<Qux<'static, i32>>>>> = RefCell::new(HashMap::new()); @@ -211,10 +211,10 @@ LL | pub union Qux<'t, 'k, I> { | ^^^ -- -- help: add missing lifetime argument | -LL | static e: RefCell<HashMap<i32, Vec<Vec<Qux<'static, 'k, i32>>>>> = RefCell::new(HashMap::new()); +LL | static e: RefCell<HashMap<i32, Vec<Vec<Qux<'static, '_, i32>>>>> = RefCell::new(HashMap::new()); | ^^^^ -error[E0107]: this trait takes 2 lifetime arguments but only 1 lifetime argument was supplied +error[E0107]: this trait takes 2 lifetime arguments but 1 lifetime argument was supplied --> $DIR/missing-lifetime-specifier.rs:50:45 | LL | static f: RefCell<HashMap<i32, Vec<Vec<&Tar<'static, i32>>>>> = RefCell::new(HashMap::new()); @@ -229,7 +229,7 @@ LL | trait Tar<'t, 'k, I> {} | ^^^ -- -- help: add missing lifetime argument | -LL | static f: RefCell<HashMap<i32, Vec<Vec<&Tar<'static, 'k, i32>>>>> = RefCell::new(HashMap::new()); +LL | static f: RefCell<HashMap<i32, Vec<Vec<&Tar<'static, '_, i32>>>>> = RefCell::new(HashMap::new()); | ^^^^ error[E0106]: missing lifetime specifier @@ -244,7 +244,7 @@ help: consider using the `'static` lifetime LL | static f: RefCell<HashMap<i32, Vec<Vec<&'static Tar<'static, i32>>>>> = RefCell::new(HashMap::new()); | ^^^^^^^^ -error[E0107]: this trait takes 2 lifetime arguments but only 1 lifetime argument was supplied +error[E0107]: this trait takes 2 lifetime arguments but 1 lifetime argument was supplied --> $DIR/missing-lifetime-specifier.rs:50:45 | LL | static f: RefCell<HashMap<i32, Vec<Vec<&Tar<'static, i32>>>>> = RefCell::new(HashMap::new()); @@ -274,7 +274,7 @@ help: consider using the `'static` lifetime LL | static f: RefCell<HashMap<i32, Vec<Vec<&'static Tar<'static, i32>>>>> = RefCell::new(HashMap::new()); | ^^^^^^^^ -error[E0107]: this trait takes 2 lifetime arguments but only 1 lifetime argument was supplied +error[E0107]: this trait takes 2 lifetime arguments but 1 lifetime argument was supplied --> $DIR/missing-lifetime-specifier.rs:50:45 | LL | static f: RefCell<HashMap<i32, Vec<Vec<&Tar<'static, i32>>>>> = RefCell::new(HashMap::new()); @@ -292,7 +292,7 @@ help: add missing lifetime argument LL | static f: RefCell<HashMap<i32, Vec<Vec<&Tar<'static, 'k, i32>>>>> = RefCell::new(HashMap::new()); | ^^^^ -error[E0107]: this trait takes 2 lifetime arguments but only 1 lifetime argument was supplied +error[E0107]: this trait takes 2 lifetime arguments but 1 lifetime argument was supplied --> $DIR/missing-lifetime-specifier.rs:50:45 | LL | static f: RefCell<HashMap<i32, Vec<Vec<&Tar<'static, i32>>>>> = RefCell::new(HashMap::new()); @@ -307,7 +307,7 @@ LL | trait Tar<'t, 'k, I> {} | ^^^ -- -- help: add missing lifetime argument | -LL | static f: RefCell<HashMap<i32, Vec<Vec<&Tar<'static, 'k, i32>>>>> = RefCell::new(HashMap::new()); +LL | static f: RefCell<HashMap<i32, Vec<Vec<&Tar<'static, '_, i32>>>>> = RefCell::new(HashMap::new()); | ^^^^ error: aborting due to 22 previous errors diff --git a/src/test/ui/suggestions/missing-lt-for-hrtb.stderr b/src/test/ui/suggestions/missing-lt-for-hrtb.stderr index 2cb63500e48..a7a44b511db 100644 --- a/src/test/ui/suggestions/missing-lt-for-hrtb.stderr +++ b/src/test/ui/suggestions/missing-lt-for-hrtb.stderr @@ -44,6 +44,10 @@ note: these named lifetimes are available to use | LL | struct V<'a>(&'a dyn for<'b> Fn(&X) -> &X); | ^^ ^^ +help: consider using one of the available lifetimes here + | +LL | struct V<'a>(&'a dyn for<'b> Fn(&X) -> &'lifetime X); + | ^^^^^^^^^^ error[E0106]: missing lifetime specifier --> $DIR/missing-lt-for-hrtb.rs:5:41 diff --git a/src/test/ui/suggestions/return-elided-lifetime.rs b/src/test/ui/suggestions/return-elided-lifetime.rs new file mode 100644 index 00000000000..ca336bbb056 --- /dev/null +++ b/src/test/ui/suggestions/return-elided-lifetime.rs @@ -0,0 +1,37 @@ +/* Checks all four scenarios possible in report_elision_failure() of + * rustc_resolve::late::lifetimes::LifetimeContext related to returning + * borrowed values, in various configurations. + */ + +fn f1() -> &i32 { loop {} } +//~^ ERROR missing lifetime specifier [E0106] +fn f1_() -> (&i32, &i32) { loop {} } +//~^ ERROR missing lifetime specifier [E0106] +//~^^ ERROR missing lifetime specifier [E0106] + +fn f2(a: i32, b: i32) -> &i32 { loop {} } +//~^ ERROR missing lifetime specifier [E0106] +fn f2_(a: i32, b: i32) -> (&i32, &i32) { loop {} } +//~^ ERROR missing lifetime specifier [E0106] +//~^^ ERROR missing lifetime specifier [E0106] + +struct S<'a, 'b> { a: &'a i32, b: &'b i32 } +fn f3(s: &S) -> &i32 { loop {} } +//~^ ERROR missing lifetime specifier [E0106] +fn f3_(s: &S, t: &S) -> (&i32, &i32) { loop {} } +//~^ ERROR missing lifetime specifier [E0106] +//~^^ ERROR missing lifetime specifier [E0106] + +fn f4<'a, 'b>(a: &'a i32, b: &'b i32) -> &i32 { loop {} } +//~^ ERROR missing lifetime specifier [E0106] +fn f4_<'a, 'b>(a: &'a i32, b: &'b i32) -> (&i32, &i32) { loop {} } +//~^ ERROR missing lifetime specifier [E0106] +//~^^ ERROR missing lifetime specifier [E0106] + +fn f5<'a>(a: &'a i32, b: &i32) -> &i32 { loop {} } +//~^ ERROR missing lifetime specifier [E0106] +fn f5_<'a>(a: &'a i32, b: &i32) -> (&i32, &i32) { loop {} } +//~^ ERROR missing lifetime specifier [E0106] +//~^^ ERROR missing lifetime specifier [E0106] + +fn main() {} diff --git a/src/test/ui/suggestions/return-elided-lifetime.stderr b/src/test/ui/suggestions/return-elided-lifetime.stderr new file mode 100644 index 00000000000..888cd5e58ab --- /dev/null +++ b/src/test/ui/suggestions/return-elided-lifetime.stderr @@ -0,0 +1,198 @@ +error[E0106]: missing lifetime specifier + --> $DIR/return-elided-lifetime.rs:6:12 + | +LL | fn f1() -> &i32 { loop {} } + | ^ expected named lifetime parameter + | + = help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from +help: consider using the `'static` lifetime + | +LL | fn f1() -> &'static i32 { loop {} } + | ^^^^^^^^ + +error[E0106]: missing lifetime specifier + --> $DIR/return-elided-lifetime.rs:8:14 + | +LL | fn f1_() -> (&i32, &i32) { loop {} } + | ^ expected named lifetime parameter + | + = help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from +help: consider using the `'static` lifetime + | +LL | fn f1_() -> (&'static i32, &i32) { loop {} } + | ^^^^^^^^ + +error[E0106]: missing lifetime specifier + --> $DIR/return-elided-lifetime.rs:8:20 + | +LL | fn f1_() -> (&i32, &i32) { loop {} } + | ^ expected named lifetime parameter + | + = help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from +help: consider using the `'static` lifetime + | +LL | fn f1_() -> (&i32, &'static i32) { loop {} } + | ^^^^^^^^ + +error[E0106]: missing lifetime specifier + --> $DIR/return-elided-lifetime.rs:12:26 + | +LL | fn f2(a: i32, b: i32) -> &i32 { loop {} } + | ^ expected named lifetime parameter + | + = help: this function's return type contains a borrowed value with an elided lifetime, but the lifetime cannot be derived from the arguments +help: consider using the `'static` lifetime + | +LL | fn f2(a: i32, b: i32) -> &'static i32 { loop {} } + | ^^^^^^^^ + +error[E0106]: missing lifetime specifier + --> $DIR/return-elided-lifetime.rs:14:28 + | +LL | fn f2_(a: i32, b: i32) -> (&i32, &i32) { loop {} } + | ^ expected named lifetime parameter + | + = help: this function's return type contains a borrowed value with an elided lifetime, but the lifetime cannot be derived from the arguments +help: consider using the `'static` lifetime + | +LL | fn f2_(a: i32, b: i32) -> (&'static i32, &i32) { loop {} } + | ^^^^^^^^ + +error[E0106]: missing lifetime specifier + --> $DIR/return-elided-lifetime.rs:14:34 + | +LL | fn f2_(a: i32, b: i32) -> (&i32, &i32) { loop {} } + | ^ expected named lifetime parameter + | + = help: this function's return type contains a borrowed value with an elided lifetime, but the lifetime cannot be derived from the arguments +help: consider using the `'static` lifetime + | +LL | fn f2_(a: i32, b: i32) -> (&i32, &'static i32) { loop {} } + | ^^^^^^^^ + +error[E0106]: missing lifetime specifier + --> $DIR/return-elided-lifetime.rs:19:17 + | +LL | fn f3(s: &S) -> &i32 { loop {} } + | -- ^ expected named lifetime parameter + | + = help: this function's return type contains a borrowed value, but the signature does not say which one of `s`'s 3 lifetimes it is borrowed from +help: consider introducing a named lifetime parameter + | +LL | fn f3<'a>(s: &'a S) -> &'a i32 { loop {} } + | ^^^^ ^^^^^ ^^^ + +error[E0106]: missing lifetime specifier + --> $DIR/return-elided-lifetime.rs:21:26 + | +LL | fn f3_(s: &S, t: &S) -> (&i32, &i32) { loop {} } + | -- -- ^ expected named lifetime parameter + | + = help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from one of `s`'s 3 lifetimes or one of `t`'s 3 lifetimes +help: consider introducing a named lifetime parameter + | +LL | fn f3_<'a>(s: &'a S, t: &'a S) -> (&'a i32, &i32) { loop {} } + | ^^^^ ^^^^^ ^^^^^ ^^^ + +error[E0106]: missing lifetime specifier + --> $DIR/return-elided-lifetime.rs:21:32 + | +LL | fn f3_(s: &S, t: &S) -> (&i32, &i32) { loop {} } + | -- -- ^ expected named lifetime parameter + | + = help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from one of `s`'s 3 lifetimes or one of `t`'s 3 lifetimes +help: consider introducing a named lifetime parameter + | +LL | fn f3_<'a>(s: &'a S, t: &'a S) -> (&i32, &'a i32) { loop {} } + | ^^^^ ^^^^^ ^^^^^ ^^^ + +error[E0106]: missing lifetime specifier + --> $DIR/return-elided-lifetime.rs:25:42 + | +LL | fn f4<'a, 'b>(a: &'a i32, b: &'b i32) -> &i32 { loop {} } + | ------- ------- ^ expected named lifetime parameter + | + = help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from `a` or `b` +note: these named lifetimes are available to use + --> $DIR/return-elided-lifetime.rs:25:7 + | +LL | fn f4<'a, 'b>(a: &'a i32, b: &'b i32) -> &i32 { loop {} } + | ^^ ^^ +help: consider using one of the available lifetimes here + | +LL | fn f4<'a, 'b>(a: &'a i32, b: &'b i32) -> &'lifetime i32 { loop {} } + | ^^^^^^^^^^ + +error[E0106]: missing lifetime specifier + --> $DIR/return-elided-lifetime.rs:27:44 + | +LL | fn f4_<'a, 'b>(a: &'a i32, b: &'b i32) -> (&i32, &i32) { loop {} } + | ------- ------- ^ expected named lifetime parameter + | + = help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from `a` or `b` +note: these named lifetimes are available to use + --> $DIR/return-elided-lifetime.rs:27:8 + | +LL | fn f4_<'a, 'b>(a: &'a i32, b: &'b i32) -> (&i32, &i32) { loop {} } + | ^^ ^^ +help: consider using one of the available lifetimes here + | +LL | fn f4_<'a, 'b>(a: &'a i32, b: &'b i32) -> (&'lifetime i32, &i32) { loop {} } + | ^^^^^^^^^^ + +error[E0106]: missing lifetime specifier + --> $DIR/return-elided-lifetime.rs:27:50 + | +LL | fn f4_<'a, 'b>(a: &'a i32, b: &'b i32) -> (&i32, &i32) { loop {} } + | ------- ------- ^ expected named lifetime parameter + | + = help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from `a` or `b` +note: these named lifetimes are available to use + --> $DIR/return-elided-lifetime.rs:27:8 + | +LL | fn f4_<'a, 'b>(a: &'a i32, b: &'b i32) -> (&i32, &i32) { loop {} } + | ^^ ^^ +help: consider using one of the available lifetimes here + | +LL | fn f4_<'a, 'b>(a: &'a i32, b: &'b i32) -> (&i32, &'lifetime i32) { loop {} } + | ^^^^^^^^^^ + +error[E0106]: missing lifetime specifier + --> $DIR/return-elided-lifetime.rs:31:35 + | +LL | fn f5<'a>(a: &'a i32, b: &i32) -> &i32 { loop {} } + | ------- ---- ^ expected named lifetime parameter + | + = help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from `a` or `b` +help: consider using the `'a` lifetime + | +LL | fn f5<'a>(a: &'a i32, b: &i32) -> &'a i32 { loop {} } + | ^^^ + +error[E0106]: missing lifetime specifier + --> $DIR/return-elided-lifetime.rs:33:37 + | +LL | fn f5_<'a>(a: &'a i32, b: &i32) -> (&i32, &i32) { loop {} } + | ------- ---- ^ expected named lifetime parameter + | + = help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from `a` or `b` +help: consider using the `'a` lifetime + | +LL | fn f5_<'a>(a: &'a i32, b: &i32) -> (&'a i32, &i32) { loop {} } + | ^^^ + +error[E0106]: missing lifetime specifier + --> $DIR/return-elided-lifetime.rs:33:43 + | +LL | fn f5_<'a>(a: &'a i32, b: &i32) -> (&i32, &i32) { loop {} } + | ------- ---- ^ expected named lifetime parameter + | + = help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from `a` or `b` +help: consider using the `'a` lifetime + | +LL | fn f5_<'a>(a: &'a i32, b: &i32) -> (&i32, &'a i32) { loop {} } + | ^^^ + +error: aborting due to 15 previous errors + +For more information about this error, try `rustc --explain E0106`. diff --git a/src/test/ui/suggestions/use-type-argument-instead-of-assoc-type.rs b/src/test/ui/suggestions/use-type-argument-instead-of-assoc-type.rs index 05e2d38c43b..8b6e8cfd720 100644 --- a/src/test/ui/suggestions/use-type-argument-instead-of-assoc-type.rs +++ b/src/test/ui/suggestions/use-type-argument-instead-of-assoc-type.rs @@ -6,7 +6,7 @@ pub trait T<X, Y> { pub struct Foo { i: Box<dyn T<usize, usize, usize, usize, B=usize>>, //~^ ERROR must be specified - //~| ERROR this trait takes 2 type arguments but 4 type arguments were supplied + //~| ERROR this trait takes 2 generic arguments but 4 generic arguments were supplied } diff --git a/src/test/ui/suggestions/use-type-argument-instead-of-assoc-type.stderr b/src/test/ui/suggestions/use-type-argument-instead-of-assoc-type.stderr index 2d06591f4c7..f1248643105 100644 --- a/src/test/ui/suggestions/use-type-argument-instead-of-assoc-type.stderr +++ b/src/test/ui/suggestions/use-type-argument-instead-of-assoc-type.stderr @@ -1,12 +1,12 @@ -error[E0107]: this trait takes 2 type arguments but 4 type arguments were supplied +error[E0107]: this trait takes 2 generic arguments but 4 generic arguments were supplied --> $DIR/use-type-argument-instead-of-assoc-type.rs:7:16 | LL | i: Box<dyn T<usize, usize, usize, usize, B=usize>>, - | ^ -------------- help: remove these type arguments + | ^ ------------ help: remove these generic arguments | | - | expected 2 type arguments + | expected 2 generic arguments | -note: trait defined here, with 2 type parameters: `X`, `Y` +note: trait defined here, with 2 generic parameters: `X`, `Y` --> $DIR/use-type-argument-instead-of-assoc-type.rs:1:11 | LL | pub trait T<X, Y> { diff --git a/src/test/ui/tag-type-args.stderr b/src/test/ui/tag-type-args.stderr index c9888dc54dc..7523a931dd5 100644 --- a/src/test/ui/tag-type-args.stderr +++ b/src/test/ui/tag-type-args.stderr @@ -2,17 +2,17 @@ error[E0107]: missing generics for enum `Quux` --> $DIR/tag-type-args.rs:3:11 | LL | fn foo(c: Quux) { assert!((false)); } - | ^^^^ expected 1 type argument + | ^^^^ expected 1 generic argument | -note: enum defined here, with 1 type parameter: `T` +note: enum defined here, with 1 generic parameter: `T` --> $DIR/tag-type-args.rs:1:6 | LL | enum Quux<T> { Bar } | ^^^^ - -help: use angle brackets to add missing type argument +help: add missing generic argument | LL | fn foo(c: Quux<T>) { assert!((false)); } - | ^^^ + | ^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/thread-local-in-ctfe.rs b/src/test/ui/thread-local-in-ctfe.rs index 313d39de36b..547e5445aa1 100644 --- a/src/test/ui/thread-local-in-ctfe.rs +++ b/src/test/ui/thread-local-in-ctfe.rs @@ -1,4 +1,4 @@ -#![feature(const_fn, thread_local)] +#![feature(thread_local)] #[thread_local] static A: u32 = 1; diff --git a/src/test/ui/threads-sendsync/auxiliary/thread-local-extern-static.rs b/src/test/ui/threads-sendsync/auxiliary/thread-local-extern-static.rs index b237b1c480e..4d3c4e8accd 100644 --- a/src/test/ui/threads-sendsync/auxiliary/thread-local-extern-static.rs +++ b/src/test/ui/threads-sendsync/auxiliary/thread-local-extern-static.rs @@ -1,4 +1,4 @@ -#![feature(cfg_target_thread_local, const_fn, thread_local)] +#![feature(cfg_target_thread_local, thread_local)] #![crate_type = "lib"] #[cfg(target_thread_local)] diff --git a/src/test/ui/threads-sendsync/issue-43733.rs b/src/test/ui/threads-sendsync/issue-43733.rs index a602d7667c4..4d81d0a5d20 100644 --- a/src/test/ui/threads-sendsync/issue-43733.rs +++ b/src/test/ui/threads-sendsync/issue-43733.rs @@ -1,4 +1,3 @@ -#![feature(const_fn)] #![feature(thread_local)] #![feature(cfg_target_thread_local, thread_local_internals)] diff --git a/src/test/ui/threads-sendsync/issue-43733.stderr b/src/test/ui/threads-sendsync/issue-43733.stderr index ee6a3b065d6..c7b12a395a2 100644 --- a/src/test/ui/threads-sendsync/issue-43733.stderr +++ b/src/test/ui/threads-sendsync/issue-43733.stderr @@ -1,5 +1,5 @@ error[E0133]: call to unsafe function is unsafe and requires unsafe function or block - --> $DIR/issue-43733.rs:18:5 + --> $DIR/issue-43733.rs:17:5 | LL | __KEY.get(Default::default) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function @@ -7,7 +7,7 @@ LL | __KEY.get(Default::default) = note: consult the function's documentation for information on how to avoid undefined behavior error[E0133]: call to unsafe function is unsafe and requires unsafe function or block - --> $DIR/issue-43733.rs:22:5 + --> $DIR/issue-43733.rs:21:5 | LL | std::thread::LocalKey::new(__getit); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function diff --git a/src/test/ui/traits/object/vs-lifetime.rs b/src/test/ui/traits/object/vs-lifetime.rs index e49d276a55a..14ae67cffd7 100644 --- a/src/test/ui/traits/object/vs-lifetime.rs +++ b/src/test/ui/traits/object/vs-lifetime.rs @@ -10,7 +10,7 @@ fn main() { //~^ at least one trait is required for an object type let _: S<'static, 'static>; //~^ ERROR this struct takes 1 lifetime argument but 2 lifetime arguments were supplied - //~| ERROR this struct takes 1 type argument but 0 type arguments were supplied + //~| ERROR this struct takes 1 generic argument but 0 generic arguments were supplied let _: S<dyn 'static +, 'static>; //~^ ERROR type provided when a lifetime was expected //~| ERROR at least one trait is required for an object type diff --git a/src/test/ui/traits/object/vs-lifetime.stderr b/src/test/ui/traits/object/vs-lifetime.stderr index 6673472e4a9..40f5fcbceaf 100644 --- a/src/test/ui/traits/object/vs-lifetime.stderr +++ b/src/test/ui/traits/object/vs-lifetime.stderr @@ -8,7 +8,7 @@ error[E0107]: this struct takes 1 lifetime argument but 2 lifetime arguments wer --> $DIR/vs-lifetime.rs:11:12 | LL | let _: S<'static, 'static>; - | ^ --------- help: remove this lifetime argument + | ^ ------- help: remove this lifetime argument | | | expected 1 lifetime argument | @@ -18,18 +18,18 @@ note: struct defined here, with 1 lifetime parameter: `'a` LL | struct S<'a, T>(&'a u8, T); | ^ -- -error[E0107]: this struct takes 1 type argument but 0 type arguments were supplied +error[E0107]: this struct takes 1 generic argument but 0 generic arguments were supplied --> $DIR/vs-lifetime.rs:11:12 | LL | let _: S<'static, 'static>; - | ^ expected 1 type argument + | ^ expected 1 generic argument | -note: struct defined here, with 1 type parameter: `T` +note: struct defined here, with 1 generic parameter: `T` --> $DIR/vs-lifetime.rs:4:8 | LL | struct S<'a, T>(&'a u8, T); | ^ - -help: add missing type argument +help: add missing generic argument | LL | let _: S<'static, 'static, T>; | ^^^ diff --git a/src/test/ui/traits/test-2.rs b/src/test/ui/traits/test-2.rs index a33773144c2..183c779607c 100644 --- a/src/test/ui/traits/test-2.rs +++ b/src/test/ui/traits/test-2.rs @@ -7,9 +7,9 @@ impl bar for u32 { fn dup(&self) -> u32 { *self } fn blah<X>(&self) {} } fn main() { 10.dup::<i32>(); - //~^ ERROR this associated function takes 0 type arguments but 1 type argument was supplied + //~^ ERROR this associated function takes 0 generic arguments but 1 10.blah::<i32, i32>(); - //~^ ERROR this associated function takes 1 type argument but 2 type arguments were supplied + //~^ ERROR this associated function takes 1 generic argument but 2 (box 10 as Box<dyn bar>).dup(); //~^ ERROR E0038 //~| ERROR E0038 diff --git a/src/test/ui/traits/test-2.stderr b/src/test/ui/traits/test-2.stderr index 12b55c3a4fd..0289424510f 100644 --- a/src/test/ui/traits/test-2.stderr +++ b/src/test/ui/traits/test-2.stderr @@ -1,26 +1,26 @@ -error[E0107]: this associated function takes 0 type arguments but 1 type argument was supplied +error[E0107]: this associated function takes 0 generic arguments but 1 generic argument was supplied --> $DIR/test-2.rs:9:8 | LL | 10.dup::<i32>(); | ^^^------- help: remove these generics | | - | expected 0 type arguments + | expected 0 generic arguments | -note: associated function defined here, with 0 type parameters +note: associated function defined here, with 0 generic parameters --> $DIR/test-2.rs:4:16 | LL | trait bar { fn dup(&self) -> Self; fn blah<X>(&self); } | ^^^ -error[E0107]: this associated function takes 1 type argument but 2 type arguments were supplied +error[E0107]: this associated function takes 1 generic argument but 2 generic arguments were supplied --> $DIR/test-2.rs:11:8 | LL | 10.blah::<i32, i32>(); - | ^^^^ ----- help: remove this type argument + | ^^^^ --- help: remove this generic argument | | - | expected 1 type argument + | expected 1 generic argument | -note: associated function defined here, with 1 type parameter: `X` +note: associated function defined here, with 1 generic parameter: `X` --> $DIR/test-2.rs:4:39 | LL | trait bar { fn dup(&self) -> Self; fn blah<X>(&self); } diff --git a/src/test/ui/type-alias-enum-variants/enum-variant-generic-args.rs b/src/test/ui/type-alias-enum-variants/enum-variant-generic-args.rs index f204035248a..6bc4f528faa 100644 --- a/src/test/ui/type-alias-enum-variants/enum-variant-generic-args.rs +++ b/src/test/ui/type-alias-enum-variants/enum-variant-generic-args.rs @@ -62,10 +62,10 @@ fn main() { AliasFixed::TSVariant::<()>(()); //~^ ERROR type arguments are not allowed for this type [E0109] AliasFixed::<()>::TSVariant(()); - //~^ ERROR this type alias takes 0 type arguments but 1 type argument was supplied [E0107] + //~^ ERROR this type alias takes 0 generic arguments but 1 generic argument was supplied [E0107] AliasFixed::<()>::TSVariant::<()>(()); //~^ ERROR type arguments are not allowed for this type [E0109] - //~| ERROR this type alias takes 0 type arguments but 1 type argument was supplied [E0107] + //~| ERROR this type alias takes 0 generic arguments but 1 generic argument was supplied [E0107] // Struct variant @@ -80,10 +80,10 @@ fn main() { AliasFixed::SVariant::<()> { v: () }; //~^ ERROR type arguments are not allowed for this type [E0109] AliasFixed::<()>::SVariant { v: () }; - //~^ ERROR this type alias takes 0 type arguments but 1 type argument was supplied [E0107] + //~^ ERROR this type alias takes 0 generic arguments but 1 generic argument was supplied [E0107] AliasFixed::<()>::SVariant::<()> { v: () }; //~^ ERROR type arguments are not allowed for this type [E0109] - //~| ERROR this type alias takes 0 type arguments but 1 type argument was supplied [E0107] + //~| ERROR this type alias takes 0 generic arguments but 1 generic argument was supplied [E0107] // Unit variant @@ -98,8 +98,8 @@ fn main() { AliasFixed::UVariant::<()>; //~^ ERROR type arguments are not allowed for this type [E0109] AliasFixed::<()>::UVariant; - //~^ ERROR this type alias takes 0 type arguments but 1 type argument was supplied [E0107] + //~^ ERROR this type alias takes 0 generic arguments but 1 generic argument was supplied [E0107] AliasFixed::<()>::UVariant::<()>; //~^ ERROR type arguments are not allowed for this type [E0109] - //~| ERROR this type alias takes 0 type arguments but 1 type argument was supplied [E0107] + //~| ERROR this type alias takes 0 generic arguments but 1 generic argument was supplied [E0107] } diff --git a/src/test/ui/type-alias-enum-variants/enum-variant-generic-args.stderr b/src/test/ui/type-alias-enum-variants/enum-variant-generic-args.stderr index e83db3b0d51..a384d5f561c 100644 --- a/src/test/ui/type-alias-enum-variants/enum-variant-generic-args.stderr +++ b/src/test/ui/type-alias-enum-variants/enum-variant-generic-args.stderr @@ -166,29 +166,29 @@ error[E0109]: type arguments are not allowed for this type LL | AliasFixed::TSVariant::<()>(()); | ^^ type argument not allowed -error[E0107]: this type alias takes 0 type arguments but 1 type argument was supplied +error[E0107]: this type alias takes 0 generic arguments but 1 generic argument was supplied --> $DIR/enum-variant-generic-args.rs:64:5 | LL | AliasFixed::<()>::TSVariant(()); | ^^^^^^^^^^------ help: remove these generics | | - | expected 0 type arguments + | expected 0 generic arguments | -note: type alias defined here, with 0 type parameters +note: type alias defined here, with 0 generic parameters --> $DIR/enum-variant-generic-args.rs:9:6 | LL | type AliasFixed = Enum<()>; | ^^^^^^^^^^ -error[E0107]: this type alias takes 0 type arguments but 1 type argument was supplied +error[E0107]: this type alias takes 0 generic arguments but 1 generic argument was supplied --> $DIR/enum-variant-generic-args.rs:66:5 | LL | AliasFixed::<()>::TSVariant::<()>(()); | ^^^^^^^^^^------ help: remove these generics | | - | expected 0 type arguments + | expected 0 generic arguments | -note: type alias defined here, with 0 type parameters +note: type alias defined here, with 0 generic parameters --> $DIR/enum-variant-generic-args.rs:9:6 | LL | type AliasFixed = Enum<()>; @@ -224,29 +224,29 @@ error[E0109]: type arguments are not allowed for this type LL | AliasFixed::SVariant::<()> { v: () }; | ^^ type argument not allowed -error[E0107]: this type alias takes 0 type arguments but 1 type argument was supplied +error[E0107]: this type alias takes 0 generic arguments but 1 generic argument was supplied --> $DIR/enum-variant-generic-args.rs:82:5 | LL | AliasFixed::<()>::SVariant { v: () }; | ^^^^^^^^^^------ help: remove these generics | | - | expected 0 type arguments + | expected 0 generic arguments | -note: type alias defined here, with 0 type parameters +note: type alias defined here, with 0 generic parameters --> $DIR/enum-variant-generic-args.rs:9:6 | LL | type AliasFixed = Enum<()>; | ^^^^^^^^^^ -error[E0107]: this type alias takes 0 type arguments but 1 type argument was supplied +error[E0107]: this type alias takes 0 generic arguments but 1 generic argument was supplied --> $DIR/enum-variant-generic-args.rs:84:5 | LL | AliasFixed::<()>::SVariant::<()> { v: () }; | ^^^^^^^^^^------ help: remove these generics | | - | expected 0 type arguments + | expected 0 generic arguments | -note: type alias defined here, with 0 type parameters +note: type alias defined here, with 0 generic parameters --> $DIR/enum-variant-generic-args.rs:9:6 | LL | type AliasFixed = Enum<()>; @@ -282,29 +282,29 @@ error[E0109]: type arguments are not allowed for this type LL | AliasFixed::UVariant::<()>; | ^^ type argument not allowed -error[E0107]: this type alias takes 0 type arguments but 1 type argument was supplied +error[E0107]: this type alias takes 0 generic arguments but 1 generic argument was supplied --> $DIR/enum-variant-generic-args.rs:100:5 | LL | AliasFixed::<()>::UVariant; | ^^^^^^^^^^------ help: remove these generics | | - | expected 0 type arguments + | expected 0 generic arguments | -note: type alias defined here, with 0 type parameters +note: type alias defined here, with 0 generic parameters --> $DIR/enum-variant-generic-args.rs:9:6 | LL | type AliasFixed = Enum<()>; | ^^^^^^^^^^ -error[E0107]: this type alias takes 0 type arguments but 1 type argument was supplied +error[E0107]: this type alias takes 0 generic arguments but 1 generic argument was supplied --> $DIR/enum-variant-generic-args.rs:102:5 | LL | AliasFixed::<()>::UVariant::<()>; | ^^^^^^^^^^------ help: remove these generics | | - | expected 0 type arguments + | expected 0 generic arguments | -note: type alias defined here, with 0 type parameters +note: type alias defined here, with 0 generic parameters --> $DIR/enum-variant-generic-args.rs:9:6 | LL | type AliasFixed = Enum<()>; diff --git a/src/test/ui/type/ascription/issue-34255-1.stderr b/src/test/ui/type/ascription/issue-34255-1.stderr index fc474e1ec3b..00449af6a45 100644 --- a/src/test/ui/type/ascription/issue-34255-1.stderr +++ b/src/test/ui/type/ascription/issue-34255-1.stderr @@ -14,17 +14,17 @@ error[E0107]: missing generics for struct `Vec` --> $DIR/issue-34255-1.rs:7:22 | LL | input_cells: Vec::new() - | ^^^ expected at least 1 type argument + | ^^^ expected at least 1 generic argument | -note: struct defined here, with at least 1 type parameter: `T` +note: struct defined here, with at least 1 generic parameter: `T` --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL | LL | pub struct Vec<T, #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global> { | ^^^ - -help: use angle brackets to add missing type argument +help: add missing generic argument | LL | input_cells: Vec<T>::new() - | ^^^ + | ^^^^^^ error: aborting due to 3 previous errors diff --git a/src/test/ui/typeck/issue-75883.rs b/src/test/ui/typeck/issue-75883.rs index 3a59ca049ba..8cd34f48835 100644 --- a/src/test/ui/typeck/issue-75883.rs +++ b/src/test/ui/typeck/issue-75883.rs @@ -4,7 +4,7 @@ pub struct UI {} impl UI { pub fn run() -> Result<_> { - //~^ ERROR: this enum takes 2 type arguments but only 1 type argument was supplied + //~^ ERROR: this enum takes 2 generic arguments but 1 generic argument was supplied //~| ERROR: the type placeholder `_` is not allowed within types on item signatures let mut ui = UI {}; ui.interact(); @@ -13,7 +13,7 @@ impl UI { } pub fn interact(&mut self) -> Result<_> { - //~^ ERROR: this enum takes 2 type arguments but only 1 type argument was supplied + //~^ ERROR: this enum takes 2 generic arguments but 1 generic argument was supplied //~| ERROR: the type placeholder `_` is not allowed within types on item signatures unimplemented!(); } diff --git a/src/test/ui/typeck/issue-75883.stderr b/src/test/ui/typeck/issue-75883.stderr index a6b2eb8f972..71f4138c81d 100644 --- a/src/test/ui/typeck/issue-75883.stderr +++ b/src/test/ui/typeck/issue-75883.stderr @@ -1,35 +1,35 @@ -error[E0107]: this enum takes 2 type arguments but only 1 type argument was supplied +error[E0107]: this enum takes 2 generic arguments but 1 generic argument was supplied --> $DIR/issue-75883.rs:6:21 | LL | pub fn run() -> Result<_> { - | ^^^^^^ - supplied 1 type argument + | ^^^^^^ - supplied 1 generic argument | | - | expected 2 type arguments + | expected 2 generic arguments | -note: enum defined here, with 2 type parameters: `T`, `E` +note: enum defined here, with 2 generic parameters: `T`, `E` --> $SRC_DIR/core/src/result.rs:LL:COL | LL | pub enum Result<T, E> { | ^^^^^^ - - -help: add missing type argument +help: add missing generic argument | LL | pub fn run() -> Result<_, E> { | ^^^ -error[E0107]: this enum takes 2 type arguments but only 1 type argument was supplied +error[E0107]: this enum takes 2 generic arguments but 1 generic argument was supplied --> $DIR/issue-75883.rs:15:35 | LL | pub fn interact(&mut self) -> Result<_> { - | ^^^^^^ - supplied 1 type argument + | ^^^^^^ - supplied 1 generic argument | | - | expected 2 type arguments + | expected 2 generic arguments | -note: enum defined here, with 2 type parameters: `T`, `E` +note: enum defined here, with 2 generic parameters: `T`, `E` --> $SRC_DIR/core/src/result.rs:LL:COL | LL | pub enum Result<T, E> { | ^^^^^^ - - -help: add missing type argument +help: add missing generic argument | LL | pub fn interact(&mut self) -> Result<_, E> { | ^^^ diff --git a/src/test/ui/typeck/typeck-builtin-bound-type-parameters.rs b/src/test/ui/typeck/typeck-builtin-bound-type-parameters.rs index f1659d08670..c463a8ad0c7 100644 --- a/src/test/ui/typeck/typeck-builtin-bound-type-parameters.rs +++ b/src/test/ui/typeck/typeck-builtin-bound-type-parameters.rs @@ -1,17 +1,17 @@ fn foo1<T:Copy<U>, U>(x: T) {} -//~^ ERROR this trait takes 0 type arguments but 1 type argument was supplied +//~^ ERROR this trait takes 0 generic arguments but 1 generic argument was supplied trait Trait: Copy<dyn Send> {} -//~^ ERROR this trait takes 0 type arguments but 1 type argument was supplied +//~^ ERROR this trait takes 0 generic arguments but 1 generic argument was supplied struct MyStruct1<T: Copy<T>>; -//~^ ERROR this trait takes 0 type arguments but 1 type argument was supplied +//~^ ERROR this trait takes 0 generic arguments but 1 generic argument was supplied struct MyStruct2<'a, T: Copy<'a>>; //~^ ERROR this trait takes 0 lifetime arguments but 1 lifetime argument was supplied fn foo2<'a, T:Copy<'a, U>, U>(x: T) {} //~^ ERROR this trait takes 0 lifetime arguments but 1 lifetime argument was supplied -//~| ERROR this trait takes 0 type arguments but 1 type argument was supplied +//~| ERROR this trait takes 0 generic arguments but 1 generic argument was supplied fn main() { } diff --git a/src/test/ui/typeck/typeck-builtin-bound-type-parameters.stderr b/src/test/ui/typeck/typeck-builtin-bound-type-parameters.stderr index 777bc1c95b0..bf74dd7dec0 100644 --- a/src/test/ui/typeck/typeck-builtin-bound-type-parameters.stderr +++ b/src/test/ui/typeck/typeck-builtin-bound-type-parameters.stderr @@ -1,40 +1,40 @@ -error[E0107]: this trait takes 0 type arguments but 1 type argument was supplied +error[E0107]: this trait takes 0 generic arguments but 1 generic argument was supplied --> $DIR/typeck-builtin-bound-type-parameters.rs:1:11 | LL | fn foo1<T:Copy<U>, U>(x: T) {} | ^^^^--- help: remove these generics | | - | expected 0 type arguments + | expected 0 generic arguments | -note: trait defined here, with 0 type parameters +note: trait defined here, with 0 generic parameters --> $SRC_DIR/core/src/marker.rs:LL:COL | LL | pub trait Copy: Clone { | ^^^^ -error[E0107]: this trait takes 0 type arguments but 1 type argument was supplied +error[E0107]: this trait takes 0 generic arguments but 1 generic argument was supplied --> $DIR/typeck-builtin-bound-type-parameters.rs:4:14 | LL | trait Trait: Copy<dyn Send> {} | ^^^^---------- help: remove these generics | | - | expected 0 type arguments + | expected 0 generic arguments | -note: trait defined here, with 0 type parameters +note: trait defined here, with 0 generic parameters --> $SRC_DIR/core/src/marker.rs:LL:COL | LL | pub trait Copy: Clone { | ^^^^ -error[E0107]: this trait takes 0 type arguments but 1 type argument was supplied +error[E0107]: this trait takes 0 generic arguments but 1 generic argument was supplied --> $DIR/typeck-builtin-bound-type-parameters.rs:7:21 | LL | struct MyStruct1<T: Copy<T>>; | ^^^^--- help: remove these generics | | - | expected 0 type arguments + | expected 0 generic arguments | -note: trait defined here, with 0 type parameters +note: trait defined here, with 0 generic parameters --> $SRC_DIR/core/src/marker.rs:LL:COL | LL | pub trait Copy: Clone { @@ -58,7 +58,7 @@ error[E0107]: this trait takes 0 lifetime arguments but 1 lifetime argument was --> $DIR/typeck-builtin-bound-type-parameters.rs:13:15 | LL | fn foo2<'a, T:Copy<'a, U>, U>(x: T) {} - | ^^^^ ---- help: remove this lifetime argument + | ^^^^ -- help: remove this lifetime argument | | | expected 0 lifetime arguments | @@ -68,15 +68,15 @@ note: trait defined here, with 0 lifetime parameters LL | pub trait Copy: Clone { | ^^^^ -error[E0107]: this trait takes 0 type arguments but 1 type argument was supplied +error[E0107]: this trait takes 0 generic arguments but 1 generic argument was supplied --> $DIR/typeck-builtin-bound-type-parameters.rs:13:15 | LL | fn foo2<'a, T:Copy<'a, U>, U>(x: T) {} - | ^^^^ --- help: remove this type argument + | ^^^^ - help: remove this generic argument | | - | expected 0 type arguments + | expected 0 generic arguments | -note: trait defined here, with 0 type parameters +note: trait defined here, with 0 generic parameters --> $SRC_DIR/core/src/marker.rs:LL:COL | LL | pub trait Copy: Clone { diff --git a/src/test/ui/typeck/typeck_type_placeholder_lifetime_1.rs b/src/test/ui/typeck/typeck_type_placeholder_lifetime_1.rs index 8f8917e16af..43e46c5b6c3 100644 --- a/src/test/ui/typeck/typeck_type_placeholder_lifetime_1.rs +++ b/src/test/ui/typeck/typeck_type_placeholder_lifetime_1.rs @@ -7,5 +7,5 @@ struct Foo<'a, T:'a> { pub fn main() { let c: Foo<_, _> = Foo { r: &5 }; - //~^ ERROR this struct takes 1 type argument but 2 type arguments were supplied + //~^ ERROR this struct takes 1 generic argument but 2 generic arguments were supplied } diff --git a/src/test/ui/typeck/typeck_type_placeholder_lifetime_1.stderr b/src/test/ui/typeck/typeck_type_placeholder_lifetime_1.stderr index 01ab8e78d7c..a89c6b85c78 100644 --- a/src/test/ui/typeck/typeck_type_placeholder_lifetime_1.stderr +++ b/src/test/ui/typeck/typeck_type_placeholder_lifetime_1.stderr @@ -1,12 +1,12 @@ -error[E0107]: this struct takes 1 type argument but 2 type arguments were supplied +error[E0107]: this struct takes 1 generic argument but 2 generic arguments were supplied --> $DIR/typeck_type_placeholder_lifetime_1.rs:9:12 | LL | let c: Foo<_, _> = Foo { r: &5 }; - | ^^^ --- help: remove this type argument + | ^^^ - help: remove this generic argument | | - | expected 1 type argument + | expected 1 generic argument | -note: struct defined here, with 1 type parameter: `T` +note: struct defined here, with 1 generic parameter: `T` --> $DIR/typeck_type_placeholder_lifetime_1.rs:4:8 | LL | struct Foo<'a, T:'a> { diff --git a/src/test/ui/typeck/typeck_type_placeholder_lifetime_2.rs b/src/test/ui/typeck/typeck_type_placeholder_lifetime_2.rs index b491a7e1a9c..178b8b1229a 100644 --- a/src/test/ui/typeck/typeck_type_placeholder_lifetime_2.rs +++ b/src/test/ui/typeck/typeck_type_placeholder_lifetime_2.rs @@ -7,5 +7,5 @@ struct Foo<'a, T:'a> { pub fn main() { let c: Foo<_, usize> = Foo { r: &5 }; - //~^ ERROR this struct takes 1 type argument but 2 type arguments were supplied + //~^ ERROR this struct takes 1 generic argument but 2 generic arguments were supplied } diff --git a/src/test/ui/typeck/typeck_type_placeholder_lifetime_2.stderr b/src/test/ui/typeck/typeck_type_placeholder_lifetime_2.stderr index 6d03b833c0f..f30766bdf01 100644 --- a/src/test/ui/typeck/typeck_type_placeholder_lifetime_2.stderr +++ b/src/test/ui/typeck/typeck_type_placeholder_lifetime_2.stderr @@ -1,12 +1,12 @@ -error[E0107]: this struct takes 1 type argument but 2 type arguments were supplied +error[E0107]: this struct takes 1 generic argument but 2 generic arguments were supplied --> $DIR/typeck_type_placeholder_lifetime_2.rs:9:12 | LL | let c: Foo<_, usize> = Foo { r: &5 }; - | ^^^ ------- help: remove this type argument + | ^^^ ----- help: remove this generic argument | | - | expected 1 type argument + | expected 1 generic argument | -note: struct defined here, with 1 type parameter: `T` +note: struct defined here, with 1 generic parameter: `T` --> $DIR/typeck_type_placeholder_lifetime_2.rs:4:8 | LL | struct Foo<'a, T:'a> { diff --git a/src/test/ui/ufcs/ufcs-qpath-missing-params.rs b/src/test/ui/ufcs/ufcs-qpath-missing-params.rs index 7d2fbdae6a2..766351634bb 100644 --- a/src/test/ui/ufcs/ufcs-qpath-missing-params.rs +++ b/src/test/ui/ufcs/ufcs-qpath-missing-params.rs @@ -12,9 +12,9 @@ impl<'a> IntoCow<'a, str> for String { fn main() { <String as IntoCow>::into_cow("foo".to_string()); - //~^ ERROR missing generics for trait `IntoCow` + //~^ ERROR missing generics for <String as IntoCow>::into_cow::<str>("foo".to_string()); - //~^ ERROR missing generics for trait `IntoCow` - //~| ERROR this associated function takes 0 type arguments but 1 type argument was supplied + //~^ ERROR this associated function takes 0 generic arguments but 1 + //~| ERROR missing generics for } diff --git a/src/test/ui/ufcs/ufcs-qpath-missing-params.stderr b/src/test/ui/ufcs/ufcs-qpath-missing-params.stderr index e3fcef3dc1b..37aa4d949da 100644 --- a/src/test/ui/ufcs/ufcs-qpath-missing-params.stderr +++ b/src/test/ui/ufcs/ufcs-qpath-missing-params.stderr @@ -2,43 +2,43 @@ error[E0107]: missing generics for trait `IntoCow` --> $DIR/ufcs-qpath-missing-params.rs:14:16 | LL | <String as IntoCow>::into_cow("foo".to_string()); - | ^^^^^^^ expected 1 type argument + | ^^^^^^^ expected 1 generic argument | -note: trait defined here, with 1 type parameter: `B` +note: trait defined here, with 1 generic parameter: `B` --> $DIR/ufcs-qpath-missing-params.rs:3:11 | LL | pub trait IntoCow<'a, B: ?Sized> where B: ToOwned { | ^^^^^^^ - -help: use angle brackets to add missing type argument +help: add missing generic argument | LL | <String as IntoCow<B>>::into_cow("foo".to_string()); - | ^^^ + | ^^^^^^^^^^ error[E0107]: missing generics for trait `IntoCow` --> $DIR/ufcs-qpath-missing-params.rs:17:16 | LL | <String as IntoCow>::into_cow::<str>("foo".to_string()); - | ^^^^^^^ expected 1 type argument + | ^^^^^^^ expected 1 generic argument | -note: trait defined here, with 1 type parameter: `B` +note: trait defined here, with 1 generic parameter: `B` --> $DIR/ufcs-qpath-missing-params.rs:3:11 | LL | pub trait IntoCow<'a, B: ?Sized> where B: ToOwned { | ^^^^^^^ - -help: use angle brackets to add missing type argument +help: add missing generic argument | LL | <String as IntoCow<B>>::into_cow::<str>("foo".to_string()); - | ^^^ + | ^^^^^^^^^^ -error[E0107]: this associated function takes 0 type arguments but 1 type argument was supplied +error[E0107]: this associated function takes 0 generic arguments but 1 generic argument was supplied --> $DIR/ufcs-qpath-missing-params.rs:17:26 | LL | <String as IntoCow>::into_cow::<str>("foo".to_string()); | ^^^^^^^^------- help: remove these generics | | - | expected 0 type arguments + | expected 0 generic arguments | -note: associated function defined here, with 0 type parameters +note: associated function defined here, with 0 generic parameters --> $DIR/ufcs-qpath-missing-params.rs:4:8 | LL | fn into_cow(self) -> Cow<'a, B>; diff --git a/src/test/ui/unboxed-closures/unboxed-closure-sugar-used-on-struct-1.stderr b/src/test/ui/unboxed-closures/unboxed-closure-sugar-used-on-struct-1.stderr index d81975abbe9..d0d27a5b759 100644 --- a/src/test/ui/unboxed-closures/unboxed-closure-sugar-used-on-struct-1.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closure-sugar-used-on-struct-1.stderr @@ -8,17 +8,17 @@ error[E0107]: missing generics for struct `Bar` --> $DIR/unboxed-closure-sugar-used-on-struct-1.rs:8:16 | LL | let x: Box<Bar()> = panic!(); - | ^^^ expected 1 type argument + | ^^^ expected 1 generic argument | -note: struct defined here, with 1 type parameter: `A` +note: struct defined here, with 1 generic parameter: `A` --> $DIR/unboxed-closure-sugar-used-on-struct-1.rs:3:8 | LL | struct Bar<A> { | ^^^ - -help: use angle brackets to add missing type argument +help: add missing generic argument | LL | let x: Box<Bar<A>()> = panic!(); - | ^^^ + | ^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/unboxed-closures/unboxed-closure-sugar-used-on-struct.stderr b/src/test/ui/unboxed-closures/unboxed-closure-sugar-used-on-struct.stderr index 80d7c2402b6..0abf46cee92 100644 --- a/src/test/ui/unboxed-closures/unboxed-closure-sugar-used-on-struct.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closure-sugar-used-on-struct.stderr @@ -8,17 +8,17 @@ error[E0107]: missing generics for struct `Bar` --> $DIR/unboxed-closure-sugar-used-on-struct.rs:7:15 | LL | fn foo(b: Box<Bar()>) { - | ^^^ expected 1 type argument + | ^^^ expected 1 generic argument | -note: struct defined here, with 1 type parameter: `A` +note: struct defined here, with 1 generic parameter: `A` --> $DIR/unboxed-closure-sugar-used-on-struct.rs:3:8 | LL | struct Bar<A> { | ^^^ - -help: use angle brackets to add missing type argument +help: add missing generic argument | LL | fn foo(b: Box<Bar<A>()>) { - | ^^^ + | ^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters-3.rs b/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters-3.rs index a496b7da2f1..f26ad8e93a1 100644 --- a/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters-3.rs +++ b/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters-3.rs @@ -3,7 +3,7 @@ trait Three<A,B,C> { fn dummy(&self) -> (A,B,C); } fn foo(_: &dyn Three()) -//~^ ERROR this trait takes 3 type arguments but only 1 type argument was supplied +//~^ ERROR this trait takes 3 generic arguments but 1 generic argument //~| ERROR associated type `Output` not found {} diff --git a/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters-3.stderr b/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters-3.stderr index ef5e7d222b4..ebaacf0a698 100644 --- a/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters-3.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters-3.stderr @@ -1,12 +1,12 @@ -error[E0107]: this trait takes 3 type arguments but only 1 type argument was supplied +error[E0107]: this trait takes 3 generic arguments but 1 generic argument was supplied --> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters-3.rs:5:16 | LL | fn foo(_: &dyn Three()) - | ^^^^^-- supplied 1 type argument + | ^^^^^-- supplied 1 generic argument | | - | expected 3 type arguments + | expected 3 generic arguments | -note: trait defined here, with 3 type parameters: `A`, `B`, `C` +note: trait defined here, with 3 generic parameters: `A`, `B`, `C` --> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters-3.rs:3:7 | LL | trait Three<A,B,C> { fn dummy(&self) -> (A,B,C); } diff --git a/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters.rs b/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters.rs index d0c85150efe..4465b43a757 100644 --- a/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters.rs +++ b/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters.rs @@ -3,25 +3,25 @@ trait Zero { fn dummy(&self); } fn foo1(_: dyn Zero()) { - //~^ ERROR this trait takes 0 type arguments but 1 type argument was supplied + //~^ ERROR this trait takes 0 generic arguments but 1 generic argument //~| ERROR associated type `Output` not found for `Zero` } fn foo2(_: dyn Zero<usize>) { - //~^ ERROR this trait takes 0 type arguments but 1 type argument was supplied + //~^ ERROR this trait takes 0 generic arguments but 1 generic argument } fn foo3(_: dyn Zero < usize >) { - //~^ ERROR this trait takes 0 type arguments but 1 type argument was supplied + //~^ ERROR this trait takes 0 generic arguments but 1 generic argument } fn foo4(_: dyn Zero(usize)) { - //~^ ERROR this trait takes 0 type arguments but 1 type argument was supplied + //~^ ERROR this trait takes 0 generic arguments but 1 generic argument //~| ERROR associated type `Output` not found for `Zero` } fn foo5(_: dyn Zero ( usize )) { - //~^ ERROR this trait takes 0 type arguments but 1 type argument was supplied + //~^ ERROR this trait takes 0 generic arguments but 1 generic argument //~| ERROR associated type `Output` not found for `Zero` } diff --git a/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters.stderr b/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters.stderr index 2e620a5563f..9601e64c189 100644 --- a/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters.stderr @@ -1,12 +1,12 @@ -error[E0107]: this trait takes 0 type arguments but 1 type argument was supplied +error[E0107]: this trait takes 0 generic arguments but 1 generic argument was supplied --> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters.rs:5:16 | LL | fn foo1(_: dyn Zero()) { | ^^^^-- help: remove these parenthetical generics | | - | expected 0 type arguments + | expected 0 generic arguments | -note: trait defined here, with 0 type parameters +note: trait defined here, with 0 generic parameters --> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters.rs:3:7 | LL | trait Zero { fn dummy(&self); } @@ -18,43 +18,43 @@ error[E0220]: associated type `Output` not found for `Zero` LL | fn foo1(_: dyn Zero()) { | ^^^^^^ associated type `Output` not found -error[E0107]: this trait takes 0 type arguments but 1 type argument was supplied +error[E0107]: this trait takes 0 generic arguments but 1 generic argument was supplied --> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters.rs:10:16 | LL | fn foo2(_: dyn Zero<usize>) { | ^^^^------- help: remove these generics | | - | expected 0 type arguments + | expected 0 generic arguments | -note: trait defined here, with 0 type parameters +note: trait defined here, with 0 generic parameters --> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters.rs:3:7 | LL | trait Zero { fn dummy(&self); } | ^^^^ -error[E0107]: this trait takes 0 type arguments but 1 type argument was supplied +error[E0107]: this trait takes 0 generic arguments but 1 generic argument was supplied --> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters.rs:14:16 | LL | fn foo3(_: dyn Zero < usize >) { | ^^^^-------------- help: remove these generics | | - | expected 0 type arguments + | expected 0 generic arguments | -note: trait defined here, with 0 type parameters +note: trait defined here, with 0 generic parameters --> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters.rs:3:7 | LL | trait Zero { fn dummy(&self); } | ^^^^ -error[E0107]: this trait takes 0 type arguments but 1 type argument was supplied +error[E0107]: this trait takes 0 generic arguments but 1 generic argument was supplied --> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters.rs:18:16 | LL | fn foo4(_: dyn Zero(usize)) { | ^^^^------- help: remove these parenthetical generics | | - | expected 0 type arguments + | expected 0 generic arguments | -note: trait defined here, with 0 type parameters +note: trait defined here, with 0 generic parameters --> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters.rs:3:7 | LL | trait Zero { fn dummy(&self); } @@ -66,15 +66,15 @@ error[E0220]: associated type `Output` not found for `Zero` LL | fn foo4(_: dyn Zero(usize)) { | ^^^^^^^^^^^ associated type `Output` not found -error[E0107]: this trait takes 0 type arguments but 1 type argument was supplied +error[E0107]: this trait takes 0 generic arguments but 1 generic argument was supplied --> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters.rs:23:16 | LL | fn foo5(_: dyn Zero ( usize )) { | ^^^^-------------- help: remove these parenthetical generics | | - | expected 0 type arguments + | expected 0 generic arguments | -note: trait defined here, with 0 type parameters +note: trait defined here, with 0 generic parameters --> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters.rs:3:7 | LL | trait Zero { fn dummy(&self); } diff --git a/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-trait.rs b/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-trait.rs index 5a47942e5af..4bcf90552f9 100644 --- a/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-trait.rs +++ b/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-trait.rs @@ -3,7 +3,7 @@ trait Trait {} fn f<F:Trait(isize) -> isize>(x: F) {} -//~^ ERROR this trait takes 0 type arguments but 1 type argument was supplied +//~^ ERROR this trait takes 0 generic arguments but 1 generic argument //~| ERROR associated type `Output` not found for `Trait` fn main() {} diff --git a/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-trait.stderr b/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-trait.stderr index b88a316c0c9..3ff05fb2331 100644 --- a/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-trait.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-trait.stderr @@ -1,12 +1,12 @@ -error[E0107]: this trait takes 0 type arguments but 1 type argument was supplied +error[E0107]: this trait takes 0 generic arguments but 1 generic argument was supplied --> $DIR/unboxed-closure-sugar-wrong-trait.rs:5:8 | LL | fn f<F:Trait(isize) -> isize>(x: F) {} | ^^^^^------- help: remove these parenthetical generics | | - | expected 0 type arguments + | expected 0 generic arguments | -note: trait defined here, with 0 type parameters +note: trait defined here, with 0 generic parameters --> $DIR/unboxed-closure-sugar-wrong-trait.rs:3:7 | LL | trait Trait {} diff --git a/src/test/ui/union/union-const-eval-field.rs b/src/test/ui/union/union-const-eval-field.rs index 3b40a21d80d..15a20899a78 100644 --- a/src/test/ui/union/union-const-eval-field.rs +++ b/src/test/ui/union/union-const-eval-field.rs @@ -1,7 +1,5 @@ // run-pass -#![feature(const_fn)] - type Field1 = (i32, u32); type Field2 = f32; type Field3 = i64; diff --git a/src/test/ui/unsafe/unsafe-unstable-const-fn.rs b/src/test/ui/unsafe/unsafe-unstable-const-fn.rs index 963d892931a..c7120e05007 100644 --- a/src/test/ui/unsafe/unsafe-unstable-const-fn.rs +++ b/src/test/ui/unsafe/unsafe-unstable-const-fn.rs @@ -1,7 +1,6 @@ #![stable(feature = "foo", since = "1.33.0")] #![feature(staged_api)] #![feature(const_raw_ptr_deref)] -#![feature(const_fn)] #[stable(feature = "foo", since = "1.33.0")] #[rustc_const_unstable(feature = "const_foo", issue = "none")] diff --git a/src/test/ui/unsafe/unsafe-unstable-const-fn.stderr b/src/test/ui/unsafe/unsafe-unstable-const-fn.stderr index 98d7ae9f854..410d8d3fb40 100644 --- a/src/test/ui/unsafe/unsafe-unstable-const-fn.stderr +++ b/src/test/ui/unsafe/unsafe-unstable-const-fn.stderr @@ -1,5 +1,5 @@ error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block - --> $DIR/unsafe-unstable-const-fn.rs:9:5 + --> $DIR/unsafe-unstable-const-fn.rs:8:5 | LL | *a == b | ^^ dereference of raw pointer diff --git a/src/tools/clippy/tests/ui/deprecated.stderr b/src/tools/clippy/tests/ui/deprecated.stderr index 3e125c1dab5..e5de839dbc5 100644 --- a/src/tools/clippy/tests/ui/deprecated.stderr +++ b/src/tools/clippy/tests/ui/deprecated.stderr @@ -84,11 +84,5 @@ error: lint `clippy::filter_map` has been removed: this lint has been replaced b LL | #[warn(clippy::filter_map)] | ^^^^^^^^^^^^^^^^^^ -error: lint `clippy::unstable_as_slice` has been removed: `Vec::as_slice` has been stabilized in 1.7 - --> $DIR/deprecated.rs:1:8 - | -LL | #[warn(clippy::unstable_as_slice)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: aborting due to 15 previous errors +error: aborting due to 14 previous errors diff --git a/src/tools/clippy/tests/ui/deprecated_old.stderr b/src/tools/clippy/tests/ui/deprecated_old.stderr index b8550078c46..8043ab0058a 100644 --- a/src/tools/clippy/tests/ui/deprecated_old.stderr +++ b/src/tools/clippy/tests/ui/deprecated_old.stderr @@ -18,11 +18,5 @@ error: lint `misaligned_transmute` has been removed: this lint has been split in LL | #[warn(misaligned_transmute)] | ^^^^^^^^^^^^^^^^^^^^ -error: lint `unstable_as_slice` has been removed: `Vec::as_slice` has been stabilized in 1.7 - --> $DIR/deprecated_old.rs:1:8 - | -LL | #[warn(unstable_as_slice)] - | ^^^^^^^^^^^^^^^^^ - -error: aborting due to 4 previous errors +error: aborting due to 3 previous errors diff --git a/src/tools/clippy/tests/ui/new_without_default.rs b/src/tools/clippy/tests/ui/new_without_default.rs index 64659b63f46..58094646b50 100644 --- a/src/tools/clippy/tests/ui/new_without_default.rs +++ b/src/tools/clippy/tests/ui/new_without_default.rs @@ -1,4 +1,3 @@ -#![feature(const_fn)] #![allow(dead_code, clippy::missing_safety_doc)] #![warn(clippy::new_without_default)] diff --git a/src/tools/clippy/tests/ui/new_without_default.stderr b/src/tools/clippy/tests/ui/new_without_default.stderr index 973836f75a9..56c5fe1c618 100644 --- a/src/tools/clippy/tests/ui/new_without_default.stderr +++ b/src/tools/clippy/tests/ui/new_without_default.stderr @@ -1,5 +1,5 @@ error: you should consider adding a `Default` implementation for `Foo` - --> $DIR/new_without_default.rs:8:5 + --> $DIR/new_without_default.rs:7:5 | LL | / pub fn new() -> Foo { LL | | Foo @@ -17,7 +17,7 @@ LL | } | error: you should consider adding a `Default` implementation for `Bar` - --> $DIR/new_without_default.rs:16:5 + --> $DIR/new_without_default.rs:15:5 | LL | / pub fn new() -> Self { LL | | Bar @@ -34,7 +34,7 @@ LL | } | error: you should consider adding a `Default` implementation for `LtKo<'c>` - --> $DIR/new_without_default.rs:80:5 + --> $DIR/new_without_default.rs:79:5 | LL | / pub fn new() -> LtKo<'c> { LL | | unimplemented!() @@ -51,7 +51,7 @@ LL | } | error: you should consider adding a `Default` implementation for `NewNotEqualToDerive` - --> $DIR/new_without_default.rs:157:5 + --> $DIR/new_without_default.rs:156:5 | LL | / pub fn new() -> Self { LL | | NewNotEqualToDerive { foo: 1 } @@ -68,7 +68,7 @@ LL | } | error: you should consider adding a `Default` implementation for `FooGenerics<T>` - --> $DIR/new_without_default.rs:165:5 + --> $DIR/new_without_default.rs:164:5 | LL | / pub fn new() -> Self { LL | | Self(Default::default()) @@ -85,7 +85,7 @@ LL | } | error: you should consider adding a `Default` implementation for `BarGenerics<T>` - --> $DIR/new_without_default.rs:172:5 + --> $DIR/new_without_default.rs:171:5 | LL | / pub fn new() -> Self { LL | | Self(Default::default()) diff --git a/src/tools/clippy/tests/ui/rename.stderr b/src/tools/clippy/tests/ui/rename.stderr index a9e80394604..c5d633ff86b 100644 --- a/src/tools/clippy/tests/ui/rename.stderr +++ b/src/tools/clippy/tests/ui/rename.stderr @@ -24,11 +24,5 @@ error: lint `clippy::const_static_lifetime` has been renamed to `clippy::redunda LL | #[warn(clippy::const_static_lifetime)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::redundant_static_lifetimes` -error: lint `clippy::cyclomatic_complexity` has been renamed to `clippy::cognitive_complexity` - --> $DIR/rename.rs:10:9 - | -LL | #![warn(clippy::cyclomatic_complexity)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::cognitive_complexity` - -error: aborting due to 5 previous errors +error: aborting due to 4 previous errors diff --git a/src/tools/clippy/tests/ui/unknown_clippy_lints.stderr b/src/tools/clippy/tests/ui/unknown_clippy_lints.stderr index 94a667e5898..421bf5ffa9a 100644 --- a/src/tools/clippy/tests/ui/unknown_clippy_lints.stderr +++ b/src/tools/clippy/tests/ui/unknown_clippy_lints.stderr @@ -48,11 +48,5 @@ error: unknown lint: `clippy::const_static_lifetim` LL | #[warn(clippy::const_static_lifetim)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: did you mean: `clippy::redundant_static_lifetimes` -error: unknown lint: `clippy::All` - --> $DIR/unknown_clippy_lints.rs:5:10 - | -LL | #![allow(clippy::All)] - | ^^^^^^^^^^^ help: did you mean: `clippy::all` - -error: aborting due to 9 previous errors +error: aborting due to 8 previous errors diff --git a/src/tools/rust-analyzer b/src/tools/rust-analyzer -Subproject eb741e895f1a73420a401f2495c711afe37d9d1 +Subproject fd109fb587904cfecc1149e068814bfd38feb83 diff --git a/src/tools/tidy/src/features.rs b/src/tools/tidy/src/features.rs index b14b5aeb572..a7e700b935e 100644 --- a/src/tools/tidy/src/features.rs +++ b/src/tools/tidy/src/features.rs @@ -51,6 +51,14 @@ pub struct Feature { pub has_gate_test: bool, pub tracking_issue: Option<NonZeroU32>, } +impl Feature { + fn tracking_issue_display(&self) -> impl fmt::Display { + match self.tracking_issue { + None => "none".to_string(), + Some(x) => x.to_string(), + } + } +} pub type Features = HashMap<String, Feature>; @@ -361,10 +369,12 @@ fn get_and_check_lib_features( if f.tracking_issue != s.tracking_issue && f.level != Status::Stable { tidy_error!( bad, - "{}:{}: mismatches the `issue` in {}", + "{}:{}: `issue` \"{}\" mismatches the {} `issue` of \"{}\"", file.display(), line, - display + f.tracking_issue_display(), + display, + s.tracking_issue_display(), ); } } diff --git a/src/tools/tidy/src/pal.rs b/src/tools/tidy/src/pal.rs index 144529d8641..db177f75cea 100644 --- a/src/tools/tidy/src/pal.rs +++ b/src/tools/tidy/src/pal.rs @@ -21,8 +21,7 @@ //! - libunwind may have platform-specific code. //! - other crates in the std facade may not. //! - std may have platform-specific code in the following places: -//! - `sys/unix/` -//! - `sys/windows/` +//! - `sys/` //! - `os/` //! //! `std/sys_common` should _not_ contain platform-specific code. @@ -36,34 +35,30 @@ use std::path::Path; // Paths that may contain platform-specific code. const EXCEPTION_PATHS: &[&str] = &[ - // std crates "library/panic_abort", "library/panic_unwind", "library/unwind", - "library/std/src/sys/", // Platform-specific code for std lives here. - // This has the trailing slash so that sys_common is not excepted. - "library/std/src/os", // Platform-specific public interfaces - "library/rtstartup", // Not sure what to do about this. magic stuff for mingw - // Integration test for platform-specific run-time feature detection: - "library/std/tests/run-time-detect.rs", - "library/std/src/net/test.rs", - "library/std/src/net/addr", - "library/std/src/net/udp", - "library/std/src/sys_common/remutex.rs", - "library/std/src/sync/mutex.rs", - "library/std/src/sync/rwlock.rs", - "library/term", // Not sure how to make this crate portable, but test crate needs it. - "library/test", // Probably should defer to unstable `std::sys` APIs. - // std testing crates, okay for now at least - "library/core/tests", - "library/alloc/tests/lib.rs", - "library/alloc/benches/lib.rs", + "library/rtstartup", // Not sure what to do about this. magic stuff for mingw + "library/term", // Not sure how to make this crate portable, but test crate needs it. + "library/test", // Probably should defer to unstable `std::sys` APIs. // The `VaList` implementation must have platform specific code. // The Windows implementation of a `va_list` is always a character // pointer regardless of the target architecture. As a result, // we must use `#[cfg(windows)]` to conditionally compile the // correct `VaList` structure for windows. "library/core/src/ffi.rs", + "library/std/src/sys/", // Platform-specific code for std lives here. + "library/std/src/os", // Platform-specific public interfaces + // Temporary `std` exceptions + // FIXME: platform-specific code should be moved to `sys` + "library/std/src/io/copy.rs", + "library/std/src/io/stdio.rs", + "library/std/src/f32.rs", + "library/std/src/f64.rs", + "library/std/src/path.rs", + "library/std/src/thread/available_concurrency.rs", + "library/std/src/sys_common", // Should only contain abstractions over platforms + "library/std/src/net/test.rs", // Utility helpers for tests ]; pub fn check(path: &Path, bad: &mut bool) { @@ -82,6 +77,11 @@ pub fn check(path: &Path, bad: &mut bool) { return; } + // exclude tests and benchmarks as some platforms do not support all tests + if filestr.contains("tests") || filestr.contains("benches") { + return; + } + check_cfgs(contents, &file, bad, &mut saw_target_arch, &mut saw_cfg_bang); }); @@ -96,9 +96,6 @@ fn check_cfgs( saw_target_arch: &mut bool, saw_cfg_bang: &mut bool, ) { - // For now it's ok to have platform-specific code after 'mod tests'. - let mod_tests_idx = find_test_mod(contents); - let contents = &contents[..mod_tests_idx]; // Pull out all `cfg(...)` and `cfg!(...)` strings. let cfgs = parse_cfgs(contents); @@ -149,39 +146,22 @@ fn check_cfgs( continue; } - err(idx, cfg); - } -} - -fn find_test_mod(contents: &str) -> usize { - if let Some(mod_tests_idx) = contents.find("mod tests") { - // Also capture a previous line indicating that "mod tests" is cfg'd out. - let prev_newline_idx = contents[..mod_tests_idx].rfind('\n').unwrap_or(mod_tests_idx); - let prev_newline_idx = contents[..prev_newline_idx].rfind('\n'); - if let Some(nl) = prev_newline_idx { - let prev_line = &contents[nl + 1..mod_tests_idx]; - if prev_line.contains("cfg(all(test, not(target_os") - || prev_line.contains("cfg(all(test, not(any(target_os") - { - nl - } else { - mod_tests_idx - } - } else { - mod_tests_idx + // exclude tests as some platforms do not support all tests + if cfg.contains("test") { + continue; } - } else { - contents.len() + + err(idx, cfg); } } -fn parse_cfgs<'a>(contents: &'a str) -> Vec<(usize, &'a str)> { +fn parse_cfgs(contents: &str) -> Vec<(usize, &str)> { let candidate_cfgs = contents.match_indices("cfg"); let candidate_cfg_idxs = candidate_cfgs.map(|(i, _)| i); // This is puling out the indexes of all "cfg" strings // that appear to be tokens followed by a parenthesis. let cfgs = candidate_cfg_idxs.filter(|i| { - let pre_idx = i.saturating_sub(*i); + let pre_idx = i.saturating_sub(1); let succeeds_non_ident = !contents .as_bytes() .get(pre_idx) |
