diff --git a/compiler/rustc_ast/src/tokenstream.rs b/compiler/rustc_ast/src/tokenstream.rs index f4f35a4d2ee07..a5d8fbfac612a 100644 --- a/compiler/rustc_ast/src/tokenstream.rs +++ b/compiler/rustc_ast/src/tokenstream.rs @@ -3,15 +3,6 @@ //! `TokenStream`s represent syntactic objects before they are converted into ASTs. //! A `TokenStream` is, roughly speaking, a sequence of [`TokenTree`]s, //! which are themselves a single [`Token`] or a `Delimited` subsequence of tokens. -//! -//! ## Ownership -//! -//! `TokenStream`s are persistent data structures constructed as ropes with reference -//! counted-children. In general, this means that calling an operation on a `TokenStream` -//! (such as `slice`) produces an entirely new `TokenStream` from the borrowed reference to -//! the original. This essentially coerces `TokenStream`s into "views" of their subparts, -//! and a borrowed `TokenStream` is sufficient to build an owned `TokenStream` without taking -//! ownership of the original. use std::borrow::Cow; use std::ops::Range; @@ -99,17 +90,6 @@ impl TokenTree { } } -impl HashStable for TokenStream -where - CTX: crate::HashStableContext, -{ - fn hash_stable(&self, hcx: &mut CTX, hasher: &mut StableHasher) { - for sub_tt in self.iter() { - sub_tt.hash_stable(hcx, hasher); - } - } -} - /// A lazy version of [`AttrTokenStream`], which defers creation of an actual /// `AttrTokenStream` until it is needed. #[derive(Clone)] @@ -556,10 +536,6 @@ pub struct AttrsTarget { pub tokens: LazyAttrTokenStream, } -/// A `TokenStream` is an abstract sequence of tokens, organized into [`TokenTree`]s. -#[derive(Clone, Debug, Default, Encodable, Decodable)] -pub struct TokenStream(pub(crate) Arc>); - /// Indicates whether a token can join with the following token to form a /// compound token. Used for conversions to `proc_macro::Spacing`. Also used to /// guide pretty-printing, which is where the `JointHidden` value (which isn't @@ -620,58 +596,9 @@ pub enum Spacing { JointHidden, } -impl TokenStream { - /// Given a `TokenStream` with a `Stream` of only two arguments, return a new `TokenStream` - /// separating the two arguments with a comma for diagnostic suggestions. - pub fn add_comma(&self) -> Option<(TokenStream, Span)> { - // Used to suggest if a user writes `foo!(a b);` - let mut suggestion = None; - let mut iter = self.0.iter().enumerate().peekable(); - while let Some((pos, ts)) = iter.next() { - if let Some((_, next)) = iter.peek() { - let sp = match (&ts, &next) { - (_, TokenTree::Token(Token { kind: token::Comma, .. }, _)) => continue, - ( - TokenTree::Token(token_left, Spacing::Alone), - TokenTree::Token(token_right, _), - ) if (token_left.is_non_reserved_ident() || token_left.is_lit()) - && (token_right.is_non_reserved_ident() || token_right.is_lit()) => - { - token_left.span - } - (TokenTree::Delimited(sp, ..), _) => sp.entire(), - _ => continue, - }; - let sp = sp.shrink_to_hi(); - let comma = TokenTree::token_alone(token::Comma, sp); - suggestion = Some((pos, comma, sp)); - } - } - if let Some((pos, comma, sp)) = suggestion { - let mut new_stream = Vec::with_capacity(self.0.len() + 1); - let parts = self.0.split_at(pos + 1); - new_stream.extend_from_slice(parts.0); - new_stream.push(comma); - new_stream.extend_from_slice(parts.1); - return Some((TokenStream::new(new_stream), sp)); - } - None - } -} - -impl FromIterator for TokenStream { - fn from_iter>(iter: I) -> Self { - TokenStream::new(iter.into_iter().collect::>()) - } -} - -impl Eq for TokenStream {} - -impl PartialEq for TokenStream { - fn eq(&self, other: &TokenStream) -> bool { - self.iter().eq(other.iter()) - } -} +/// A `TokenStream` is an abstract sequence of tokens, organized into [`TokenTree`]s. +#[derive(Clone, Debug, Default, Encodable, Decodable)] +pub struct TokenStream(pub(crate) Arc>); impl TokenStream { pub fn new(tts: Vec) -> TokenStream { @@ -847,6 +774,68 @@ impl TokenStream { } } } + + /// Given a `TokenStream` with a `Stream` of only two arguments, return a new `TokenStream` + /// separating the two arguments with a comma for diagnostic suggestions. + pub fn add_comma(&self) -> Option<(TokenStream, Span)> { + // Used to suggest if a user writes `foo!(a b);` + let mut suggestion = None; + let mut iter = self.0.iter().enumerate().peekable(); + while let Some((pos, ts)) = iter.next() { + if let Some((_, next)) = iter.peek() { + let sp = match (&ts, &next) { + (_, TokenTree::Token(Token { kind: token::Comma, .. }, _)) => continue, + ( + TokenTree::Token(token_left, Spacing::Alone), + TokenTree::Token(token_right, _), + ) if (token_left.is_non_reserved_ident() || token_left.is_lit()) + && (token_right.is_non_reserved_ident() || token_right.is_lit()) => + { + token_left.span + } + (TokenTree::Delimited(sp, ..), _) => sp.entire(), + _ => continue, + }; + let sp = sp.shrink_to_hi(); + let comma = TokenTree::token_alone(token::Comma, sp); + suggestion = Some((pos, comma, sp)); + } + } + if let Some((pos, comma, sp)) = suggestion { + let mut new_stream = Vec::with_capacity(self.0.len() + 1); + let parts = self.0.split_at(pos + 1); + new_stream.extend_from_slice(parts.0); + new_stream.push(comma); + new_stream.extend_from_slice(parts.1); + return Some((TokenStream::new(new_stream), sp)); + } + None + } +} + +impl PartialEq for TokenStream { + fn eq(&self, other: &TokenStream) -> bool { + self.iter().eq(other.iter()) + } +} + +impl Eq for TokenStream {} + +impl FromIterator for TokenStream { + fn from_iter>(iter: I) -> Self { + TokenStream::new(iter.into_iter().collect::>()) + } +} + +impl HashStable for TokenStream +where + CTX: crate::HashStableContext, +{ + fn hash_stable(&self, hcx: &mut CTX, hasher: &mut StableHasher) { + for sub_tt in self.iter() { + sub_tt.hash_stable(hcx, hasher); + } + } } #[derive(Clone)] diff --git a/src/tools/compiletest/src/bin/main.rs b/src/tools/compiletest/src/bin/main.rs index 1f777e71cf97f..8fac6ccdc582b 100644 --- a/src/tools/compiletest/src/bin/main.rs +++ b/src/tools/compiletest/src/bin/main.rs @@ -2,7 +2,7 @@ use std::env; use std::io::IsTerminal; use std::sync::Arc; -use compiletest::{early_config_check, log_config, parse_config, run_tests}; +use compiletest::{early_config_check, parse_config, run_tests}; fn main() { tracing_subscriber::fmt::init(); @@ -19,6 +19,5 @@ fn main() { early_config_check(&config); - log_config(&config); run_tests(config); } diff --git a/src/tools/compiletest/src/lib.rs b/src/tools/compiletest/src/lib.rs index 58f7c6b50718a..8737fec80bb39 100644 --- a/src/tools/compiletest/src/lib.rs +++ b/src/tools/compiletest/src/lib.rs @@ -9,7 +9,6 @@ mod tests; pub mod common; -pub mod compute_diff; mod debuggers; pub mod diagnostics; pub mod directives; @@ -44,7 +43,6 @@ use crate::common::{ }; use crate::directives::DirectivesCache; use crate::executor::{CollectedTest, ColorConfig}; -use crate::util::logv; /// Creates the `Config` instance for this invocation of compiletest. /// @@ -477,51 +475,6 @@ pub fn parse_config(args: Vec) -> Config { } } -pub fn log_config(config: &Config) { - let c = config; - logv(c, "configuration:".to_string()); - logv(c, format!("compile_lib_path: {}", config.compile_lib_path)); - logv(c, format!("run_lib_path: {}", config.run_lib_path)); - logv(c, format!("rustc_path: {}", config.rustc_path)); - logv(c, format!("cargo_path: {:?}", config.cargo_path)); - logv(c, format!("rustdoc_path: {:?}", config.rustdoc_path)); - - logv(c, format!("src_root: {}", config.src_root)); - logv(c, format!("src_test_suite_root: {}", config.src_test_suite_root)); - - logv(c, format!("build_root: {}", config.build_root)); - logv(c, format!("build_test_suite_root: {}", config.build_test_suite_root)); - - logv(c, format!("sysroot_base: {}", config.sysroot_base)); - - logv(c, format!("stage: {}", config.stage)); - logv(c, format!("stage_id: {}", config.stage_id)); - logv(c, format!("mode: {}", config.mode)); - logv(c, format!("run_ignored: {}", config.run_ignored)); - logv(c, format!("filters: {:?}", config.filters)); - logv(c, format!("skip: {:?}", config.skip)); - logv(c, format!("filter_exact: {}", config.filter_exact)); - logv( - c, - format!("force_pass_mode: {}", opt_str(&config.force_pass_mode.map(|m| format!("{}", m))),), - ); - logv(c, format!("runner: {}", opt_str(&config.runner))); - logv(c, format!("host-rustcflags: {:?}", config.host_rustcflags)); - logv(c, format!("target-rustcflags: {:?}", config.target_rustcflags)); - logv(c, format!("target: {}", config.target)); - logv(c, format!("host: {}", config.host)); - logv(c, format!("android-cross-path: {}", config.android_cross_path)); - logv(c, format!("adb_path: {}", config.adb_path)); - logv(c, format!("adb_test_dir: {}", config.adb_test_dir)); - logv(c, format!("adb_device_status: {}", config.adb_device_status)); - logv(c, format!("ar: {}", config.ar)); - logv(c, format!("target-linker: {:?}", config.target_linker)); - logv(c, format!("host-linker: {:?}", config.host_linker)); - logv(c, format!("verbose: {}", config.verbose)); - logv(c, format!("minicore_path: {}", config.minicore_path)); - logv(c, "\n".to_string()); -} - pub fn opt_str(maybestr: &Option) -> &str { match *maybestr { None => "(none)", @@ -538,6 +491,8 @@ pub fn opt_str2(maybestr: Option) -> String { /// Called by `main` after the config has been parsed. pub fn run_tests(config: Arc) { + debug!(?config, "run_tests"); + // If we want to collect rustfix coverage information, // we first make sure that the coverage file does not exist. // It will be created later on. diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index 3a05b242519ef..867624cc8fa97 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -7,7 +7,7 @@ use std::io::prelude::*; use std::io::{self, BufReader}; use std::process::{Child, Command, ExitStatus, Output, Stdio}; use std::sync::Arc; -use std::{env, iter, str}; +use std::{env, fmt, iter, str}; use build_helper::fs::remove_and_create_dir_all; use camino::{Utf8Path, Utf8PathBuf}; @@ -21,15 +21,13 @@ use crate::common::{ UI_WINDOWS_SVG, expected_output_path, incremental_dir, output_base_dir, output_base_name, output_testname_unique, }; -use crate::compute_diff::{DiffLine, make_diff, write_diff, write_filtered_diff}; use crate::directives::TestProps; use crate::errors::{Error, ErrorKind, load_errors}; use crate::read2::{Truncated, read2_abbreviated}; -use crate::util::{Utf8PathBufExt, add_dylib_path, logv, static_regex}; +use crate::runtest::compute_diff::{DiffLine, make_diff, write_diff, write_filtered_diff}; +use crate::util::{Utf8PathBufExt, add_dylib_path, static_regex}; use crate::{ColorConfig, help, json, stamp_file_path, warning}; -mod debugger; - // Helper modules that implement test running logic for each test suite. // tidy-alphabetical-start mod assembly; @@ -48,6 +46,8 @@ mod rustdoc_json; mod ui; // tidy-alphabetical-end +mod compute_diff; +mod debugger; #[cfg(test)] mod tests; @@ -1459,7 +1459,7 @@ impl<'test> TestCx<'test> { ) -> ProcRes { let cmdline = { let cmdline = self.make_cmdline(&command, lib_path); - logv(self.config, format!("executing {}", cmdline)); + self.logv(format_args!("executing {cmdline}")); cmdline }; @@ -2006,6 +2006,18 @@ impl<'test> TestCx<'test> { output_base_name(self.config, self.testpaths, self.safe_revision()) } + /// Prints a message to (captured) stdout if `config.verbose` is true. + /// The message is also logged to `tracing::debug!` regardles of verbosity. + /// + /// Use `format_args!` as the argument to perform formatting if required. + fn logv(&self, message: impl fmt::Display) { + debug!("{message}"); + if self.config.verbose { + // Note: `./x test ... --verbose --no-capture` is needed to see this print. + println!("{message}"); + } + } + /// Prefix to print before error messages. Normally just `error`, but also /// includes the revision name for tests that use revisions. #[must_use] @@ -2666,8 +2678,8 @@ impl<'test> TestCx<'test> { // // It's not possible to detect paths in the error messages generally, but this is a // decent enough heuristic. - static_regex!( - r#"(?x) + let re = static_regex!( + r#"(?x) (?: # Match paths that don't include spaces. (?:\\[\pL\pN\.\-_']+)+\.\pL+ @@ -2675,11 +2687,8 @@ impl<'test> TestCx<'test> { # If the path starts with a well-known root, then allow spaces and no file extension. \$(?:DIR|SRC_DIR|TEST_BUILD_DIR|BUILD_DIR|LIB_DIR)(?:\\[\pL\pN\.\-_'\ ]+)+ )"# - ) - .replace_all(&output, |caps: &Captures<'_>| { - println!("{}", &caps[0]); - caps[0].replace(r"\", "/") - }) + ); + re.replace_all(&output, |caps: &Captures<'_>| caps[0].replace(r"\", "/")) .replace("\r\n", "\n") } diff --git a/src/tools/compiletest/src/compute_diff.rs b/src/tools/compiletest/src/runtest/compute_diff.rs similarity index 100% rename from src/tools/compiletest/src/compute_diff.rs rename to src/tools/compiletest/src/runtest/compute_diff.rs diff --git a/src/tools/compiletest/src/runtest/debuginfo.rs b/src/tools/compiletest/src/runtest/debuginfo.rs index 24fdbab3aec4f..88d022b8bbaaf 100644 --- a/src/tools/compiletest/src/runtest/debuginfo.rs +++ b/src/tools/compiletest/src/runtest/debuginfo.rs @@ -10,7 +10,6 @@ use super::debugger::DebuggerCommands; use super::{Debugger, Emit, ProcRes, TestCx, Truncated, WillExecute}; use crate::common::Config; use crate::debuggers::{extract_gdb_version, is_android_gdb_target}; -use crate::util::logv; impl TestCx<'_> { pub(super) fn run_debuginfo_test(&self) { @@ -234,7 +233,7 @@ impl TestCx<'_> { gdb.args(debugger_opts); // FIXME(jieyouxu): don't pass an empty Path let cmdline = self.make_cmdline(&gdb, Utf8Path::new("")); - logv(self.config, format!("executing {}", cmdline)); + self.logv(format_args!("executing {cmdline}")); cmdline }; diff --git a/src/tools/compiletest/src/runtest/mir_opt.rs b/src/tools/compiletest/src/runtest/mir_opt.rs index efdb131bf14a8..55043bf4bc26d 100644 --- a/src/tools/compiletest/src/runtest/mir_opt.rs +++ b/src/tools/compiletest/src/runtest/mir_opt.rs @@ -6,7 +6,7 @@ use miropt_test_tools::{MiroptTest, MiroptTestFile, files_for_miropt_test}; use tracing::debug; use super::{Emit, TestCx, WillExecute}; -use crate::compute_diff::write_diff; +use crate::runtest::compute_diff::write_diff; impl TestCx<'_> { pub(super) fn run_mir_opt_test(&self) { diff --git a/src/tools/compiletest/src/runtest/pretty.rs b/src/tools/compiletest/src/runtest/pretty.rs index e3b07f1d63d1e..2655772723352 100644 --- a/src/tools/compiletest/src/runtest/pretty.rs +++ b/src/tools/compiletest/src/runtest/pretty.rs @@ -1,14 +1,13 @@ use std::fs; use super::{ProcRes, ReadFrom, TestCx}; -use crate::util::logv; impl TestCx<'_> { pub(super) fn run_pretty_test(&self) { if self.props.pp_exact.is_some() { - logv(self.config, "testing for exact pretty-printing".to_owned()); + self.logv("testing for exact pretty-printing"); } else { - logv(self.config, "testing for converging pretty-printing".to_owned()); + self.logv("testing for converging pretty-printing"); } let rounds = match self.props.pp_exact { @@ -21,10 +20,7 @@ impl TestCx<'_> { let mut round = 0; while round < rounds { - logv( - self.config, - format!("pretty-printing round {} revision {:?}", round, self.revision), - ); + self.logv(format_args!("pretty-printing round {round} revision {:?}", self.revision)); let read_from = if round == 0 { ReadFrom::Path } else { ReadFrom::Stdin(srcs[round].to_owned()) }; diff --git a/src/tools/compiletest/src/util.rs b/src/tools/compiletest/src/util.rs index fb047548c456a..1f16a672a98e7 100644 --- a/src/tools/compiletest/src/util.rs +++ b/src/tools/compiletest/src/util.rs @@ -2,9 +2,6 @@ use std::env; use std::process::Command; use camino::{Utf8Path, Utf8PathBuf}; -use tracing::*; - -use crate::common::Config; #[cfg(test)] mod tests; @@ -26,14 +23,6 @@ fn path_div() -> &'static str { ";" } -pub fn logv(config: &Config, s: String) { - debug!("{}", s); - if config.verbose { - // Note: `./x test ... --verbose --no-capture` is needed to see this print. - println!("{}", s); - } -} - pub trait Utf8PathBufExt { /// Append an extension to the path, even if it already has one. fn with_extra_extension(&self, extension: &str) -> Utf8PathBuf; diff --git a/tests/ui/array-slice-vec/pattern-matching-fixed-length-vectors-7784.rs b/tests/ui/array-slice-vec/fixed-length-vector-pattern-matching-7784.rs similarity index 100% rename from tests/ui/array-slice-vec/pattern-matching-fixed-length-vectors-7784.rs rename to tests/ui/array-slice-vec/fixed-length-vector-pattern-matching-7784.rs diff --git a/tests/ui/array-slice-vec/matching-on-vector-slice-option-8498.rs b/tests/ui/array-slice-vec/vector-slice-matching-8498.rs similarity index 100% rename from tests/ui/array-slice-vec/matching-on-vector-slice-option-8498.rs rename to tests/ui/array-slice-vec/vector-slice-matching-8498.rs diff --git a/tests/ui/pattern/match-with-at-binding-8391.rs b/tests/ui/binding/match-with-at-binding-8391.rs similarity index 100% rename from tests/ui/pattern/match-with-at-binding-8391.rs rename to tests/ui/binding/match-with-at-binding-8391.rs diff --git a/tests/ui/issues/issue-7092.rs b/tests/ui/binding/method-call-nonsensical-pattern-binding-7092.rs similarity index 86% rename from tests/ui/issues/issue-7092.rs rename to tests/ui/binding/method-call-nonsensical-pattern-binding-7092.rs index fab18bd7cf759..4cb04cdf5bef8 100644 --- a/tests/ui/issues/issue-7092.rs +++ b/tests/ui/binding/method-call-nonsensical-pattern-binding-7092.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/7092 enum Whatever { } diff --git a/tests/ui/issues/issue-7092.stderr b/tests/ui/binding/method-call-nonsensical-pattern-binding-7092.stderr similarity index 86% rename from tests/ui/issues/issue-7092.stderr rename to tests/ui/binding/method-call-nonsensical-pattern-binding-7092.stderr index e2e5748674615..1f8ff2d8df1dc 100644 --- a/tests/ui/issues/issue-7092.stderr +++ b/tests/ui/binding/method-call-nonsensical-pattern-binding-7092.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/issue-7092.rs:6:9 + --> $DIR/method-call-nonsensical-pattern-binding-7092.rs:7:9 | LL | match x { | - this expression has type `Whatever` diff --git a/tests/ui/pattern/ref-in-function-parameter-patterns-8860.rs b/tests/ui/binding/ref-pattern-drop-behavior-8860.rs similarity index 100% rename from tests/ui/pattern/ref-in-function-parameter-patterns-8860.rs rename to tests/ui/binding/ref-pattern-drop-behavior-8860.rs diff --git a/tests/ui/issues/issue-6738.rs b/tests/ui/binop/struct-field-generic-type-binary-assignment-error-6738.rs similarity index 79% rename from tests/ui/issues/issue-6738.rs rename to tests/ui/binop/struct-field-generic-type-binary-assignment-error-6738.rs index a2f8dfe9c493c..856caa2b297a0 100644 --- a/tests/ui/issues/issue-6738.rs +++ b/tests/ui/binop/struct-field-generic-type-binary-assignment-error-6738.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/6738 struct Foo { x: T, } diff --git a/tests/ui/issues/issue-6738.stderr b/tests/ui/binop/struct-field-generic-type-binary-assignment-error-6738.stderr similarity index 86% rename from tests/ui/issues/issue-6738.stderr rename to tests/ui/binop/struct-field-generic-type-binary-assignment-error-6738.stderr index f22d6a2e4686c..060d33079d339 100644 --- a/tests/ui/issues/issue-6738.stderr +++ b/tests/ui/binop/struct-field-generic-type-binary-assignment-error-6738.stderr @@ -1,5 +1,5 @@ error[E0368]: binary assignment operation `+=` cannot be applied to type `T` - --> $DIR/issue-6738.rs:6:9 + --> $DIR/struct-field-generic-type-binary-assignment-error-6738.rs:7:9 | LL | self.x += v.x; | ------^^^^^^^ diff --git a/tests/ui/issues/auxiliary/issue-5518.rs b/tests/ui/borrowck/auxiliary/aux-5518.rs similarity index 100% rename from tests/ui/issues/auxiliary/issue-5518.rs rename to tests/ui/borrowck/auxiliary/aux-5518.rs diff --git a/tests/ui/issues/issue-5884.rs b/tests/ui/borrowck/borrowed-pointer-in-struct-5884.rs similarity index 82% rename from tests/ui/issues/issue-5884.rs rename to tests/ui/borrowck/borrowed-pointer-in-struct-5884.rs index 559b897395d02..d2f17cf905d33 100644 --- a/tests/ui/issues/issue-5884.rs +++ b/tests/ui/borrowck/borrowed-pointer-in-struct-5884.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/5884 //@ build-pass #![allow(dead_code)] diff --git a/tests/ui/issues/issue-5550.rs b/tests/ui/borrowck/incorrect-loan-error-on-local-update-5550.rs similarity index 79% rename from tests/ui/issues/issue-5550.rs rename to tests/ui/borrowck/incorrect-loan-error-on-local-update-5550.rs index 41de8ee5d32c9..2258d76865751 100644 --- a/tests/ui/issues/issue-5550.rs +++ b/tests/ui/borrowck/incorrect-loan-error-on-local-update-5550.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/5550 //@ run-pass #![allow(unused_assignments)] diff --git a/tests/ui/issues/issue-5708.rs b/tests/ui/borrowck/struct-with-reference-to-trait-5708.rs similarity index 95% rename from tests/ui/issues/issue-5708.rs rename to tests/ui/borrowck/struct-with-reference-to-trait-5708.rs index 6fa3cfa472454..5157a3bf36b52 100644 --- a/tests/ui/issues/issue-5708.rs +++ b/tests/ui/borrowck/struct-with-reference-to-trait-5708.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/5708 //@ run-pass #![allow(unused_variables)] /* @@ -10,7 +11,6 @@ This does not occur with concrete types, only with references to traits. */ - // original trait Inner { fn print(&self); @@ -38,7 +38,6 @@ pub fn main() { outer.inner.print(); } - // minimal pub trait MyTrait { fn dummy(&self, t: T) -> T { panic!() } diff --git a/tests/ui/borrowck/trait-method-lifetime-substitution-5518.rs b/tests/ui/borrowck/trait-method-lifetime-substitution-5518.rs new file mode 100644 index 0000000000000..f254030a011b2 --- /dev/null +++ b/tests/ui/borrowck/trait-method-lifetime-substitution-5518.rs @@ -0,0 +1,7 @@ +// https://github.com/rust-lang/rust/issues/5518 +//@ run-pass +//@ aux-build:aux-5518.rs + +extern crate aux_5518 as other; + +fn main() {} diff --git a/tests/ui/issues/issue-6557.rs b/tests/ui/box/box-patterns-feature-usage-6557.rs similarity index 72% rename from tests/ui/issues/issue-6557.rs rename to tests/ui/box/box-patterns-feature-usage-6557.rs index 64a025a294f68..e0d9b25c366d4 100644 --- a/tests/ui/issues/issue-6557.rs +++ b/tests/ui/box/box-patterns-feature-usage-6557.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/6557 //@ check-pass #![allow(dead_code)] diff --git a/tests/ui/issues/issue-54094.rs b/tests/ui/cast/associated-type-bounds-cast-54094.rs similarity index 76% rename from tests/ui/issues/issue-54094.rs rename to tests/ui/cast/associated-type-bounds-cast-54094.rs index 4ca7d1d81b621..c9f307e95b9a0 100644 --- a/tests/ui/issues/issue-54094.rs +++ b/tests/ui/cast/associated-type-bounds-cast-54094.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/54094 //@ check-pass trait Zoo { type X; diff --git a/tests/ui/issues/issue-6318.rs b/tests/ui/cast/owned-struct-to-trait-cast-6318.rs similarity index 84% rename from tests/ui/issues/issue-6318.rs rename to tests/ui/cast/owned-struct-to-trait-cast-6318.rs index d3f08285a93b3..8cfc77c427400 100644 --- a/tests/ui/issues/issue-6318.rs +++ b/tests/ui/cast/owned-struct-to-trait-cast-6318.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/6318 //@ run-pass pub enum Thing { diff --git a/tests/ui/issues/issue-6153.rs b/tests/ui/closures/closure-mut-argument-6153.rs similarity index 83% rename from tests/ui/issues/issue-6153.rs rename to tests/ui/closures/closure-mut-argument-6153.rs index cd78c85d94b55..ac19c2bd15fcf 100644 --- a/tests/ui/issues/issue-6153.rs +++ b/tests/ui/closures/closure-mut-argument-6153.rs @@ -1,6 +1,6 @@ +// https://github.com/rust-lang/rust/issues/6153 //@ run-pass - fn swap(f: F) -> Vec where F: FnOnce(Vec) -> Vec { let x = vec![1, 2, 3]; f(x) diff --git a/tests/ui/issues/issue-54462-mutable-noalias-correctness.rs b/tests/ui/codegen/matrix-row-swap-54462.rs similarity index 94% rename from tests/ui/issues/issue-54462-mutable-noalias-correctness.rs rename to tests/ui/codegen/matrix-row-swap-54462.rs index 70d0bee733262..6bfc600399a13 100644 --- a/tests/ui/issues/issue-54462-mutable-noalias-correctness.rs +++ b/tests/ui/codegen/matrix-row-swap-54462.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/54462 //@ run-pass // //@ compile-flags: -Ccodegen-units=1 -O diff --git a/tests/ui/issues/issue-7012.rs b/tests/ui/codegen/static-array-comparison-7012.rs similarity index 92% rename from tests/ui/issues/issue-7012.rs rename to tests/ui/codegen/static-array-comparison-7012.rs index 69b881e2a43b3..c08b1c0059b57 100644 --- a/tests/ui/issues/issue-7012.rs +++ b/tests/ui/codegen/static-array-comparison-7012.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/7012 //@ run-pass #![allow(non_camel_case_types)] #![allow(non_upper_case_globals)] diff --git a/tests/ui/coercion/mut-trait-coercion-8248.rs b/tests/ui/coercion/coerce-mut-trait-object-8248.rs similarity index 100% rename from tests/ui/coercion/mut-trait-coercion-8248.rs rename to tests/ui/coercion/coerce-mut-trait-object-8248.rs diff --git a/tests/ui/coercion/mut-trait-coercion-8248.stderr b/tests/ui/coercion/coerce-mut-trait-object-8248.stderr similarity index 84% rename from tests/ui/coercion/mut-trait-coercion-8248.stderr rename to tests/ui/coercion/coerce-mut-trait-object-8248.stderr index 0c7d5f9dc4584..c3b35a7063cdb 100644 --- a/tests/ui/coercion/mut-trait-coercion-8248.stderr +++ b/tests/ui/coercion/coerce-mut-trait-object-8248.stderr @@ -1,5 +1,5 @@ warning: method `dummy` is never used - --> $DIR/mut-trait-coercion-8248.rs:5:8 + --> $DIR/coerce-mut-trait-object-8248.rs:5:8 | LL | trait A { | - method in this trait diff --git a/tests/ui/issues/issue-54477-reduced-2.rs b/tests/ui/collections/vecdeque-append-operation-54477.rs similarity index 94% rename from tests/ui/issues/issue-54477-reduced-2.rs rename to tests/ui/collections/vecdeque-append-operation-54477.rs index 5f65e54518208..7680fd0bb0147 100644 --- a/tests/ui/issues/issue-54477-reduced-2.rs +++ b/tests/ui/collections/vecdeque-append-operation-54477.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/54477 //@ run-pass // rust-lang/rust#54477: runtime bug in the VecDeque library that was // exposed by this test case, derived from test suite of crates.io diff --git a/tests/ui/issues/auxiliary/issue-7178.rs b/tests/ui/cross-crate/auxiliary/aux-7178.rs similarity index 100% rename from tests/ui/issues/auxiliary/issue-7178.rs rename to tests/ui/cross-crate/auxiliary/aux-7178.rs diff --git a/tests/ui/cross-crate/static-method-returning-self-with-generics-7178.rs b/tests/ui/cross-crate/static-method-returning-self-with-generics-7178.rs new file mode 100644 index 0000000000000..3888d3bdaa9de --- /dev/null +++ b/tests/ui/cross-crate/static-method-returning-self-with-generics-7178.rs @@ -0,0 +1,9 @@ +// https://github.com/rust-lang/rust/issues/7178 +//@ run-pass +//@ aux-build:aux-7178.rs + +extern crate aux_7178 as cross_crate_self; + +pub fn main() { + let _ = cross_crate_self::Foo::new(&1); +} diff --git a/tests/ui/cross-crate/static-regions-in-cross-crate-8259.rs b/tests/ui/cross-crate/static-with-cross-crate-regions-8259.rs similarity index 100% rename from tests/ui/cross-crate/static-regions-in-cross-crate-8259.rs rename to tests/ui/cross-crate/static-with-cross-crate-regions-8259.rs diff --git a/tests/ui/cross-crate/tuple-struct-cross-crate-7899.rs b/tests/ui/cross-crate/tuple-struct-cross-crate-7899.rs new file mode 100644 index 0000000000000..ce3ea7dd5796a --- /dev/null +++ b/tests/ui/cross-crate/tuple-struct-cross-crate-7899.rs @@ -0,0 +1,10 @@ +// https://github.com/rust-lang/rust/issues/7899 +//@ run-pass +#![allow(unused_variables)] +//@ aux-build:aux-7899.rs + +extern crate aux_7899 as testcrate; + +fn main() { + let f = testcrate::V2(1.0f32, 2.0f32); +} diff --git a/tests/ui/issues/issue-5900.rs b/tests/ui/enum/enum-referred-by-submodule-5900.rs similarity index 77% rename from tests/ui/issues/issue-5900.rs rename to tests/ui/enum/enum-referred-by-submodule-5900.rs index 14b7b8f815a01..4ed092670a86a 100644 --- a/tests/ui/issues/issue-5900.rs +++ b/tests/ui/enum/enum-referred-by-submodule-5900.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/5900 //@ check-pass #![allow(dead_code)] diff --git a/tests/ui/issues/issue-5997-outer-generic-parameter/issue-5997.rs b/tests/ui/enum/enum-with-generic-parameter-5997.rs similarity index 77% rename from tests/ui/issues/issue-5997-outer-generic-parameter/issue-5997.rs rename to tests/ui/enum/enum-with-generic-parameter-5997.rs index 7ed8819f3220a..fab7ebbbbdc85 100644 --- a/tests/ui/issues/issue-5997-outer-generic-parameter/issue-5997.rs +++ b/tests/ui/enum/enum-with-generic-parameter-5997.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/5997 //@ run-pass #![allow(dead_code)] diff --git a/tests/ui/issues/issue-6117.rs b/tests/ui/enum/match-either-enum-variants-6117.rs similarity index 79% rename from tests/ui/issues/issue-6117.rs rename to tests/ui/enum/match-either-enum-variants-6117.rs index 3ccf67b031991..7b395066166b7 100644 --- a/tests/ui/issues/issue-6117.rs +++ b/tests/ui/enum/match-either-enum-variants-6117.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/6117 //@ run-pass #![allow(dead_code)] diff --git a/tests/ui/issues/issue-54696.rs b/tests/ui/function-pointer/function-pointer-comparison-54696.rs similarity index 82% rename from tests/ui/issues/issue-54696.rs rename to tests/ui/function-pointer/function-pointer-comparison-54696.rs index 63ffbe42bcc9f..2e28dfeaaf884 100644 --- a/tests/ui/issues/issue-54696.rs +++ b/tests/ui/function-pointer/function-pointer-comparison-54696.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/54696 //@ run-pass #![allow(unpredictable_function_pointer_comparisons)] diff --git a/tests/ui/issues/issue-5997-outer-generic-parameter/issue-5997-enum.rs b/tests/ui/generics/enum-definition-with-outer-generic-parameter-5997.rs similarity index 77% rename from tests/ui/issues/issue-5997-outer-generic-parameter/issue-5997-enum.rs rename to tests/ui/generics/enum-definition-with-outer-generic-parameter-5997.rs index 0b1857ae3df30..00bf66dd4e00a 100644 --- a/tests/ui/issues/issue-5997-outer-generic-parameter/issue-5997-enum.rs +++ b/tests/ui/generics/enum-definition-with-outer-generic-parameter-5997.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/5997 fn f() -> bool { enum E { V(Z) } //~^ ERROR can't use generic parameters from outer item diff --git a/tests/ui/issues/issue-5997-outer-generic-parameter/issue-5997-enum.stderr b/tests/ui/generics/enum-definition-with-outer-generic-parameter-5997.stderr similarity index 85% rename from tests/ui/issues/issue-5997-outer-generic-parameter/issue-5997-enum.stderr rename to tests/ui/generics/enum-definition-with-outer-generic-parameter-5997.stderr index c0b3cd6de66d7..aea0f049b07d3 100644 --- a/tests/ui/issues/issue-5997-outer-generic-parameter/issue-5997-enum.stderr +++ b/tests/ui/generics/enum-definition-with-outer-generic-parameter-5997.stderr @@ -1,5 +1,5 @@ error[E0401]: can't use generic parameters from outer item - --> $DIR/issue-5997-enum.rs:2:16 + --> $DIR/enum-definition-with-outer-generic-parameter-5997.rs:3:16 | LL | fn f() -> bool { | - type parameter from outer item diff --git a/tests/ui/issues/issue-54410.rs b/tests/ui/issues/issue-54410.rs deleted file mode 100644 index e3e8ca985b970..0000000000000 --- a/tests/ui/issues/issue-54410.rs +++ /dev/null @@ -1,8 +0,0 @@ -extern "C" { - pub static mut symbol: [i8]; - //~^ ERROR the size for values of type `[i8]` cannot be known at compilation time -} - -fn main() { - println!("{:p}", unsafe { &symbol }); -} diff --git a/tests/ui/issues/issue-54410.stderr b/tests/ui/issues/issue-54410.stderr deleted file mode 100644 index cb68ada7e1354..0000000000000 --- a/tests/ui/issues/issue-54410.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0277]: the size for values of type `[i8]` cannot be known at compilation time - --> $DIR/issue-54410.rs:2:5 - | -LL | pub static mut symbol: [i8]; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time - | - = help: the trait `Sized` is not implemented for `[i8]` - = note: statics and constants must have a statically known size - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/issues/issue-5518.rs b/tests/ui/issues/issue-5518.rs deleted file mode 100644 index 333185c482fe4..0000000000000 --- a/tests/ui/issues/issue-5518.rs +++ /dev/null @@ -1,7 +0,0 @@ -//@ run-pass -//@ aux-build:issue-5518.rs - - -extern crate issue_5518 as other; - -fn main() {} diff --git a/tests/ui/issues/issue-5844.rs b/tests/ui/issues/issue-5844.rs deleted file mode 100644 index 23021207ae195..0000000000000 --- a/tests/ui/issues/issue-5844.rs +++ /dev/null @@ -1,7 +0,0 @@ -//@aux-build:issue-5844-aux.rs - -extern crate issue_5844_aux; - -fn main() { - issue_5844_aux::rand(); //~ ERROR: requires unsafe -} diff --git a/tests/ui/issues/issue-5997-outer-generic-parameter/issue-5997-struct.rs b/tests/ui/issues/issue-5997-outer-generic-parameter/issue-5997-struct.rs deleted file mode 100644 index 19d994b0dfb7a..0000000000000 --- a/tests/ui/issues/issue-5997-outer-generic-parameter/issue-5997-struct.rs +++ /dev/null @@ -1,10 +0,0 @@ -fn f() -> bool { - struct S(T); //~ ERROR can't use generic parameters from outer item - - true -} - -fn main() { - let b = f::(); - assert!(b); -} diff --git a/tests/ui/issues/issue-5997-outer-generic-parameter/issue-5997-struct.stderr b/tests/ui/issues/issue-5997-outer-generic-parameter/issue-5997-struct.stderr deleted file mode 100644 index 670a54894b5c6..0000000000000 --- a/tests/ui/issues/issue-5997-outer-generic-parameter/issue-5997-struct.stderr +++ /dev/null @@ -1,13 +0,0 @@ -error[E0401]: can't use generic parameters from outer item - --> $DIR/issue-5997-struct.rs:2:14 - | -LL | fn f() -> bool { - | - type parameter from outer item -LL | struct S(T); - | -^ use of generic parameter from outer item - | | - | help: try introducing a local generic parameter here: `` - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0401`. diff --git a/tests/ui/issues/issue-6344-match.rs b/tests/ui/issues/issue-6344-match.rs deleted file mode 100644 index 9251e274383da..0000000000000 --- a/tests/ui/issues/issue-6344-match.rs +++ /dev/null @@ -1,18 +0,0 @@ -//@ run-pass -#![allow(non_shorthand_field_patterns)] - -struct A { x: usize } - -impl Drop for A { - fn drop(&mut self) {} -} - -pub fn main() { - let a = A { x: 0 }; - - match a { - A { x : ref x } => { - println!("{}", x) - } - } -} diff --git a/tests/ui/issues/issue-7178.rs b/tests/ui/issues/issue-7178.rs deleted file mode 100644 index 408ce0b03eb82..0000000000000 --- a/tests/ui/issues/issue-7178.rs +++ /dev/null @@ -1,9 +0,0 @@ -//@ run-pass -//@ aux-build:issue-7178.rs - - -extern crate issue_7178 as cross_crate_self; - -pub fn main() { - let _ = cross_crate_self::Foo::new(&1); -} diff --git a/tests/ui/issues/issue-53419.rs b/tests/ui/lifetimes/dyn-trait-function-pointer-53419.rs similarity index 65% rename from tests/ui/issues/issue-53419.rs rename to tests/ui/lifetimes/dyn-trait-function-pointer-53419.rs index 55d41f2005d29..b1017b104ac24 100644 --- a/tests/ui/issues/issue-53419.rs +++ b/tests/ui/lifetimes/dyn-trait-function-pointer-53419.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/53419 //@ check-pass struct Foo { diff --git a/tests/ui/issues/issue-7268.rs b/tests/ui/lifetimes/static-bound-fulfillment-with-pointer-7268.rs similarity index 71% rename from tests/ui/issues/issue-7268.rs rename to tests/ui/lifetimes/static-bound-fulfillment-with-pointer-7268.rs index a3bc1bc344626..8ec58e6cd800b 100644 --- a/tests/ui/issues/issue-7268.rs +++ b/tests/ui/lifetimes/static-bound-fulfillment-with-pointer-7268.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/7268 //@ check-pass #![allow(dead_code)] diff --git a/tests/ui/issues/issue-5741.rs b/tests/ui/loops/unreachable-while-loop-5741.rs similarity index 69% rename from tests/ui/issues/issue-5741.rs rename to tests/ui/loops/unreachable-while-loop-5741.rs index af4702ec22ca9..bc69df0f6755c 100644 --- a/tests/ui/issues/issue-5741.rs +++ b/tests/ui/loops/unreachable-while-loop-5741.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/5741 //@ run-pass #![allow(while_true)] #![allow(unreachable_code)] diff --git a/tests/ui/issues/issue-5554.rs b/tests/ui/macros/macro-variable-declaration-with-bounds-5554.rs similarity index 90% rename from tests/ui/issues/issue-5554.rs rename to tests/ui/macros/macro-variable-declaration-with-bounds-5554.rs index 7d219a0df7093..8ccf8e8013100 100644 --- a/tests/ui/issues/issue-5554.rs +++ b/tests/ui/macros/macro-variable-declaration-with-bounds-5554.rs @@ -1,7 +1,7 @@ +// https://github.com/rust-lang/rust/issues/5554 //@ run-pass #![allow(dead_code)] - pub struct X { a: T, } diff --git a/tests/ui/issues/issue-5718.rs b/tests/ui/macros/macro-variable-unused-reporting-5718.rs similarity index 88% rename from tests/ui/issues/issue-5718.rs rename to tests/ui/macros/macro-variable-unused-reporting-5718.rs index 234fb2e222278..55da925461db5 100644 --- a/tests/ui/issues/issue-5718.rs +++ b/tests/ui/macros/macro-variable-unused-reporting-5718.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/5718 //@ run-pass struct Element; diff --git a/tests/ui/issues/issue-5358-1.rs b/tests/ui/match/mismatched-types-in-match-5358.rs similarity index 60% rename from tests/ui/issues/issue-5358-1.rs rename to tests/ui/match/mismatched-types-in-match-5358.rs index 281f219c03940..d096bf3a493d6 100644 --- a/tests/ui/issues/issue-5358-1.rs +++ b/tests/ui/match/mismatched-types-in-match-5358.rs @@ -1,8 +1,13 @@ -enum Either { Left(T), Right(U) } +// https://github.com/rust-lang/rust/issues/5358 +enum Either { + Left(T), + Right(U), +} struct S(Either); fn main() { - match S(Either::Left(5)) { //~ NOTE this expression has type `S` + match S(Either::Left(5)) { + //~^ NOTE this expression has type `S` Either::Right(_) => {} //~^ ERROR mismatched types //~| NOTE expected `S`, found `Either<_, _>` diff --git a/tests/ui/issues/issue-5358-1.stderr b/tests/ui/match/mismatched-types-in-match-5358.stderr similarity index 92% rename from tests/ui/issues/issue-5358-1.stderr rename to tests/ui/match/mismatched-types-in-match-5358.stderr index e68db865dc414..6a6cf3ee2694e 100644 --- a/tests/ui/issues/issue-5358-1.stderr +++ b/tests/ui/match/mismatched-types-in-match-5358.stderr @@ -1,8 +1,9 @@ error[E0308]: mismatched types - --> $DIR/issue-5358-1.rs:6:9 + --> $DIR/mismatched-types-in-match-5358.rs:11:9 | LL | match S(Either::Left(5)) { | ------------------ this expression has type `S` +LL | LL | Either::Right(_) => {} | ^^^^^^^^^^^^^^^^ expected `S`, found `Either<_, _>` | diff --git a/tests/ui/match/mismatched-types-in-match-pattern-7867.rs b/tests/ui/match/mismatched-types-in-match-7867.rs similarity index 100% rename from tests/ui/match/mismatched-types-in-match-pattern-7867.rs rename to tests/ui/match/mismatched-types-in-match-7867.rs diff --git a/tests/ui/match/mismatched-types-in-match-pattern-7867.stderr b/tests/ui/match/mismatched-types-in-match-7867.stderr similarity index 88% rename from tests/ui/match/mismatched-types-in-match-pattern-7867.stderr rename to tests/ui/match/mismatched-types-in-match-7867.stderr index 8997f36114a89..e41a61e42f4b0 100644 --- a/tests/ui/match/mismatched-types-in-match-pattern-7867.stderr +++ b/tests/ui/match/mismatched-types-in-match-7867.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/mismatched-types-in-match-pattern-7867.rs:10:9 + --> $DIR/mismatched-types-in-match-7867.rs:10:9 | LL | enum A { B, C } | - unit variant defined here diff --git a/tests/ui/methods/trait-method-self-param-error-7575.rs b/tests/ui/methods/trait-method-resolution-7575.rs similarity index 100% rename from tests/ui/methods/trait-method-self-param-error-7575.rs rename to tests/ui/methods/trait-method-resolution-7575.rs diff --git a/tests/ui/methods/trait-method-self-param-error-7575.stderr b/tests/ui/methods/trait-method-resolution-7575.stderr similarity index 77% rename from tests/ui/methods/trait-method-self-param-error-7575.stderr rename to tests/ui/methods/trait-method-resolution-7575.stderr index 656db30352d56..8bbc360de5726 100644 --- a/tests/ui/methods/trait-method-self-param-error-7575.stderr +++ b/tests/ui/methods/trait-method-resolution-7575.stderr @@ -1,5 +1,5 @@ warning: trait `Foo` is never used - --> $DIR/trait-method-self-param-error-7575.rs:4:7 + --> $DIR/trait-method-resolution-7575.rs:4:7 | LL | trait Foo { | ^^^ diff --git a/tests/ui/issues/issue-5950.rs b/tests/ui/modules/pub-use-module-alias-5950.rs similarity index 62% rename from tests/ui/issues/issue-5950.rs rename to tests/ui/modules/pub-use-module-alias-5950.rs index 6015560fcf8a9..91d3f9b16ff0d 100644 --- a/tests/ui/issues/issue-5950.rs +++ b/tests/ui/modules/pub-use-module-alias-5950.rs @@ -1,6 +1,6 @@ +// https://github.com/rust-lang/rust/issues/5950 //@ check-pass - pub use local as local_alias; pub mod local { } diff --git a/tests/ui/resolve/module-import-resolution-7663.rs b/tests/ui/modules/use-statement-duplicate-check-7663.rs similarity index 100% rename from tests/ui/resolve/module-import-resolution-7663.rs rename to tests/ui/modules/use-statement-duplicate-check-7663.rs diff --git a/tests/ui/issues/issue-6130.rs b/tests/ui/numeric/type-limit-comparisons-6130.rs similarity index 77% rename from tests/ui/issues/issue-6130.rs rename to tests/ui/numeric/type-limit-comparisons-6130.rs index c675a8a41dd0b..54b3f631e67bc 100644 --- a/tests/ui/issues/issue-6130.rs +++ b/tests/ui/numeric/type-limit-comparisons-6130.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/6130 //@ run-pass pub fn main() { diff --git a/tests/ui/issues/issue-5572.rs b/tests/ui/parser/partial-eq-trait-bound-5572.rs similarity index 67% rename from tests/ui/issues/issue-5572.rs rename to tests/ui/parser/partial-eq-trait-bound-5572.rs index f27744ef0ac7a..7ee0cdc43ee55 100644 --- a/tests/ui/issues/issue-5572.rs +++ b/tests/ui/parser/partial-eq-trait-bound-5572.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/5572 //@ check-pass #![allow(dead_code)] diff --git a/tests/ui/issues/auxiliary/iss.rs b/tests/ui/privacy/auxiliary/iss-6919.rs similarity index 100% rename from tests/ui/issues/auxiliary/iss.rs rename to tests/ui/privacy/auxiliary/iss-6919.rs diff --git a/tests/ui/issues/issue-6919.rs b/tests/ui/privacy/deref-separate-compile-unit-6919.rs similarity index 61% rename from tests/ui/issues/issue-6919.rs rename to tests/ui/privacy/deref-separate-compile-unit-6919.rs index 7fb8a2f33bc9c..5d8934987e507 100644 --- a/tests/ui/issues/issue-6919.rs +++ b/tests/ui/privacy/deref-separate-compile-unit-6919.rs @@ -1,7 +1,7 @@ +// https://github.com/rust-lang/rust/issues/6919 //@ run-pass #![allow(unused_attributes)] -//@ aux-build:iss.rs - +//@ aux-build:iss-6919.rs extern crate issue6919_3; diff --git a/tests/ui/issues/issue-55376.rs b/tests/ui/privacy/pub-restricted-path-usage-55376.rs similarity index 85% rename from tests/ui/issues/issue-55376.rs rename to tests/ui/privacy/pub-restricted-path-usage-55376.rs index 5a6862b6530b1..ca4e27c30a8fc 100644 --- a/tests/ui/issues/issue-55376.rs +++ b/tests/ui/privacy/pub-restricted-path-usage-55376.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/55376 //@ run-pass // Tests that paths in `pub(...)` don't fail HIR verification. diff --git a/tests/ui/issues/issue-53728.rs b/tests/ui/repr/packed-struct-with-enum-53728.rs similarity index 85% rename from tests/ui/issues/issue-53728.rs rename to tests/ui/repr/packed-struct-with-enum-53728.rs index 364965228c608..6ce65ed634fc5 100644 --- a/tests/ui/issues/issue-53728.rs +++ b/tests/ui/repr/packed-struct-with-enum-53728.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/53728 //@ run-pass #![allow(dead_code)] diff --git a/tests/ui/issues/issue-6936.rs b/tests/ui/resolve/duplicate-name-in-module-6936.rs similarity index 91% rename from tests/ui/issues/issue-6936.rs rename to tests/ui/resolve/duplicate-name-in-module-6936.rs index e9aa80b4eb33d..ae9282c0c24a0 100644 --- a/tests/ui/issues/issue-6936.rs +++ b/tests/ui/resolve/duplicate-name-in-module-6936.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/6936 struct T; mod t1 { @@ -30,5 +31,4 @@ mod t6 { impl Foo {} // ok } - fn main() {} diff --git a/tests/ui/issues/issue-6936.stderr b/tests/ui/resolve/duplicate-name-in-module-6936.stderr similarity index 87% rename from tests/ui/issues/issue-6936.stderr rename to tests/ui/resolve/duplicate-name-in-module-6936.stderr index 03cc50636b4b8..76bb8f57386b1 100644 --- a/tests/ui/issues/issue-6936.stderr +++ b/tests/ui/resolve/duplicate-name-in-module-6936.stderr @@ -1,5 +1,5 @@ error[E0428]: the name `Foo` is defined multiple times - --> $DIR/issue-6936.rs:5:5 + --> $DIR/duplicate-name-in-module-6936.rs:6:5 | LL | type Foo = crate::T; | -------------------- previous definition of the type `Foo` here @@ -9,7 +9,7 @@ LL | mod Foo {} = note: `Foo` must be defined only once in the type namespace of this module error[E0428]: the name `Foo` is defined multiple times - --> $DIR/issue-6936.rs:10:5 + --> $DIR/duplicate-name-in-module-6936.rs:11:5 | LL | type Foo = crate::T; | -------------------- previous definition of the type `Foo` here @@ -19,7 +19,7 @@ LL | struct Foo; = note: `Foo` must be defined only once in the type namespace of this module error[E0428]: the name `Foo` is defined multiple times - --> $DIR/issue-6936.rs:15:5 + --> $DIR/duplicate-name-in-module-6936.rs:16:5 | LL | type Foo = crate::T; | -------------------- previous definition of the type `Foo` here @@ -29,7 +29,7 @@ LL | enum Foo {} = note: `Foo` must be defined only once in the type namespace of this module error[E0428]: the name `Bar` is defined multiple times - --> $DIR/issue-6936.rs:25:5 + --> $DIR/duplicate-name-in-module-6936.rs:26:5 | LL | type Bar = T; | ---------------- previous definition of the type `Bar` here diff --git a/tests/ui/issues/issue-7044.rs b/tests/ui/resolve/unit-like-struct-masks-constant-7044.rs similarity index 65% rename from tests/ui/issues/issue-7044.rs rename to tests/ui/resolve/unit-like-struct-masks-constant-7044.rs index a6e22bc5237ab..f48dd695f018e 100644 --- a/tests/ui/issues/issue-7044.rs +++ b/tests/ui/resolve/unit-like-struct-masks-constant-7044.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/7044 static X: isize = 0; struct X; //~ ERROR the name `X` is defined multiple times diff --git a/tests/ui/issues/issue-7044.stderr b/tests/ui/resolve/unit-like-struct-masks-constant-7044.stderr similarity index 87% rename from tests/ui/issues/issue-7044.stderr rename to tests/ui/resolve/unit-like-struct-masks-constant-7044.stderr index 9d1fb3a10ddd3..48aa6fce455a8 100644 --- a/tests/ui/issues/issue-7044.stderr +++ b/tests/ui/resolve/unit-like-struct-masks-constant-7044.stderr @@ -1,5 +1,5 @@ error[E0428]: the name `X` is defined multiple times - --> $DIR/issue-7044.rs:2:1 + --> $DIR/unit-like-struct-masks-constant-7044.rs:3:1 | LL | static X: isize = 0; | -------------------- previous definition of the value `X` here diff --git a/tests/ui/issues/issue-55380.rs b/tests/ui/specialization/trait-specialization-default-methods-55380.rs similarity index 90% rename from tests/ui/issues/issue-55380.rs rename to tests/ui/specialization/trait-specialization-default-methods-55380.rs index 54894cdede021..b3d79fb5ffb6a 100644 --- a/tests/ui/issues/issue-55380.rs +++ b/tests/ui/specialization/trait-specialization-default-methods-55380.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/55380 //@ run-pass #![feature(specialization)] //~^ WARN the feature `specialization` is incomplete diff --git a/tests/ui/issues/issue-55380.stderr b/tests/ui/specialization/trait-specialization-default-methods-55380.stderr similarity index 88% rename from tests/ui/issues/issue-55380.stderr rename to tests/ui/specialization/trait-specialization-default-methods-55380.stderr index 403844c726fa2..f7c1903da6292 100644 --- a/tests/ui/issues/issue-55380.stderr +++ b/tests/ui/specialization/trait-specialization-default-methods-55380.stderr @@ -1,5 +1,5 @@ warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/issue-55380.rs:2:12 + --> $DIR/trait-specialization-default-methods-55380.rs:3:12 | LL | #![feature(specialization)] | ^^^^^^^^^^^^^^ diff --git a/tests/ui/issues/issue-7364.rs b/tests/ui/static/global-variable-promotion-error-7364.rs similarity index 84% rename from tests/ui/issues/issue-7364.rs rename to tests/ui/static/global-variable-promotion-error-7364.rs index 4ce9beb68cd3f..dba4a484d6115 100644 --- a/tests/ui/issues/issue-7364.rs +++ b/tests/ui/static/global-variable-promotion-error-7364.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/7364 use std::cell::RefCell; // Regression test for issue 7364 diff --git a/tests/ui/issues/issue-7364.stderr b/tests/ui/static/global-variable-promotion-error-7364.stderr similarity index 91% rename from tests/ui/issues/issue-7364.stderr rename to tests/ui/static/global-variable-promotion-error-7364.stderr index a47a90c90ce16..b9d75676bef89 100644 --- a/tests/ui/issues/issue-7364.stderr +++ b/tests/ui/static/global-variable-promotion-error-7364.stderr @@ -1,5 +1,5 @@ error[E0277]: `RefCell` cannot be shared between threads safely - --> $DIR/issue-7364.rs:4:15 + --> $DIR/global-variable-promotion-error-7364.rs:5:15 | LL | static boxed: Box> = Box::new(RefCell::new(0)); | ^^^^^^^^^^^^^^^^^^^ `RefCell` cannot be shared between threads safely @@ -12,7 +12,7 @@ note: required because it appears within the type `Box>` = note: shared static variables must have a type that implements `Sync` error[E0015]: cannot call non-const associated function `Box::>::new` in statics - --> $DIR/issue-7364.rs:4:37 + --> $DIR/global-variable-promotion-error-7364.rs:5:37 | LL | static boxed: Box> = Box::new(RefCell::new(0)); | ^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/issues/issue-5917.rs b/tests/ui/static/static-list-initialization-5917.rs similarity index 78% rename from tests/ui/issues/issue-5917.rs rename to tests/ui/static/static-list-initialization-5917.rs index 8e91b1052a2d0..c6c32f7582e17 100644 --- a/tests/ui/issues/issue-5917.rs +++ b/tests/ui/static/static-list-initialization-5917.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/5917 //@ run-pass #![allow(non_upper_case_globals)] diff --git a/tests/ui/issues/issue-5688.rs b/tests/ui/static/static-struct-initialization-5688.rs similarity index 90% rename from tests/ui/issues/issue-5688.rs rename to tests/ui/static/static-struct-initialization-5688.rs index a7db1dfb15f6c..6a4c2f45b6b35 100644 --- a/tests/ui/issues/issue-5688.rs +++ b/tests/ui/static/static-struct-initialization-5688.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/5688 //@ run-pass /* # Corrupted initialization in the static struct diff --git a/tests/ui/structs-enums/auxiliary/aux-8044.rs b/tests/ui/structs/auxiliary/aux-8044.rs similarity index 100% rename from tests/ui/structs-enums/auxiliary/aux-8044.rs rename to tests/ui/structs/auxiliary/aux-8044.rs diff --git a/tests/ui/structs-enums/struct-and-enum-usage-8044.rs b/tests/ui/structs/btree-struct-usage-8044.rs similarity index 100% rename from tests/ui/structs-enums/struct-and-enum-usage-8044.rs rename to tests/ui/structs/btree-struct-usage-8044.rs diff --git a/tests/ui/issues/issue-6344-let.rs b/tests/ui/structs/destructuring-struct-with-dtor-6344.rs similarity index 81% rename from tests/ui/issues/issue-6344-let.rs rename to tests/ui/structs/destructuring-struct-with-dtor-6344.rs index 1e1bdfa17bed2..b107a99e89f1d 100644 --- a/tests/ui/issues/issue-6344-let.rs +++ b/tests/ui/structs/destructuring-struct-with-dtor-6344.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/6344 //@ run-pass #![allow(non_shorthand_field_patterns)] diff --git a/tests/ui/issues/issue-5439.rs b/tests/ui/structs/nonexistent-struct-field-error-5439.rs similarity index 86% rename from tests/ui/issues/issue-5439.rs rename to tests/ui/structs/nonexistent-struct-field-error-5439.rs index 852b264dc5dbf..b2b3293ac91ad 100644 --- a/tests/ui/issues/issue-5439.rs +++ b/tests/ui/structs/nonexistent-struct-field-error-5439.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/5439 struct Foo { foo: isize, } diff --git a/tests/ui/issues/issue-5439.stderr b/tests/ui/structs/nonexistent-struct-field-error-5439.stderr similarity index 86% rename from tests/ui/issues/issue-5439.stderr rename to tests/ui/structs/nonexistent-struct-field-error-5439.stderr index 6d1d74e304558..b560772fbf042 100644 --- a/tests/ui/issues/issue-5439.stderr +++ b/tests/ui/structs/nonexistent-struct-field-error-5439.stderr @@ -1,5 +1,5 @@ error[E0560]: struct `Foo` has no field named `nonexistent` - --> $DIR/issue-5439.rs:11:31 + --> $DIR/nonexistent-struct-field-error-5439.rs:12:31 | LL | return Box::new(Foo { nonexistent: self, foo: i }); | ^^^^^^^^^^^ `Foo` does not have this field diff --git a/tests/ui/issues/issue-5666.rs b/tests/ui/traits/dynamic-dispatch-trait-objects-5666.rs similarity index 90% rename from tests/ui/issues/issue-5666.rs rename to tests/ui/traits/dynamic-dispatch-trait-objects-5666.rs index 76e2f8229a0f9..e335949d832da 100644 --- a/tests/ui/issues/issue-5666.rs +++ b/tests/ui/traits/dynamic-dispatch-trait-objects-5666.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/5666 //@ run-pass struct Dog { @@ -14,7 +15,6 @@ impl Barks for Dog { } } - pub fn main() { let snoopy = Box::new(Dog{name: "snoopy".to_string()}); let bubbles = Box::new(Dog{name: "bubbles".to_string()}); diff --git a/tests/ui/issues/issue-53568.rs b/tests/ui/traits/nll-ice-custom-type-ops-53568.rs similarity index 93% rename from tests/ui/issues/issue-53568.rs rename to tests/ui/traits/nll-ice-custom-type-ops-53568.rs index 9862d4ced12c3..9b240cdc190d7 100644 --- a/tests/ui/issues/issue-53568.rs +++ b/tests/ui/traits/nll-ice-custom-type-ops-53568.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/53568 // Regression test for an NLL-related ICE (#53568) -- we failed to // resolve inference variables in "custom type-ops". // diff --git a/tests/ui/issues/issue-5883.rs b/tests/ui/traits/opaque-trait-size-error-5883.rs similarity index 81% rename from tests/ui/issues/issue-5883.rs rename to tests/ui/traits/opaque-trait-size-error-5883.rs index dd4753e0344a0..e39e24e734299 100644 --- a/tests/ui/issues/issue-5883.rs +++ b/tests/ui/traits/opaque-trait-size-error-5883.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/5883 trait A {} struct Struct { diff --git a/tests/ui/issues/issue-5883.stderr b/tests/ui/traits/opaque-trait-size-error-5883.stderr similarity index 89% rename from tests/ui/issues/issue-5883.stderr rename to tests/ui/traits/opaque-trait-size-error-5883.stderr index 2ca437b8c4735..78de250b19a1e 100644 --- a/tests/ui/issues/issue-5883.stderr +++ b/tests/ui/traits/opaque-trait-size-error-5883.stderr @@ -1,19 +1,19 @@ error[E0277]: the size for values of type `(dyn A + 'static)` cannot be known at compilation time - --> $DIR/issue-5883.rs:9:6 + --> $DIR/opaque-trait-size-error-5883.rs:10:6 | LL | ) -> Struct { | ^^^^^^ doesn't have a size known at compile-time | = help: within `Struct`, the trait `Sized` is not implemented for `(dyn A + 'static)` note: required because it appears within the type `Struct` - --> $DIR/issue-5883.rs:3:8 + --> $DIR/opaque-trait-size-error-5883.rs:4:8 | LL | struct Struct { | ^^^^^^ = note: the return type of a function must have a statically known size error[E0277]: the size for values of type `(dyn A + 'static)` cannot be known at compilation time - --> $DIR/issue-5883.rs:8:8 + --> $DIR/opaque-trait-size-error-5883.rs:9:8 | LL | r: dyn A + 'static | ^^^^^^^^^^^^^^^ doesn't have a size known at compile-time diff --git a/tests/ui/traits/self-implements-kinds-in-default-methods-8171.rs b/tests/ui/traits/self-not-send-in-default-method-8171.rs similarity index 100% rename from tests/ui/traits/self-implements-kinds-in-default-methods-8171.rs rename to tests/ui/traits/self-not-send-in-default-method-8171.rs diff --git a/tests/ui/issues/issue-6898.rs b/tests/ui/traits/trait-implementation-generic-access-6898.rs similarity index 93% rename from tests/ui/issues/issue-6898.rs rename to tests/ui/traits/trait-implementation-generic-access-6898.rs index c810acaf61baa..e9437b1c522e0 100644 --- a/tests/ui/issues/issue-6898.rs +++ b/tests/ui/traits/trait-implementation-generic-access-6898.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/6898 //@ check-pass use std::mem; diff --git a/tests/ui/issues/issue-5988.rs b/tests/ui/traits/trait-implementation-restriction-5988.rs similarity index 80% rename from tests/ui/issues/issue-5988.rs rename to tests/ui/traits/trait-implementation-restriction-5988.rs index b7527d9bea803..d3a5b10569b22 100644 --- a/tests/ui/issues/issue-5988.rs +++ b/tests/ui/traits/trait-implementation-restriction-5988.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/5988 //@ run-pass trait B { diff --git a/tests/ui/traits/trait-implementation-and-usage-7563.rs b/tests/ui/traits/trait-object-lifetime-bounds-7563.rs similarity index 100% rename from tests/ui/traits/trait-implementation-and-usage-7563.rs rename to tests/ui/traits/trait-object-lifetime-bounds-7563.rs diff --git a/tests/ui/issues/issue-7344.rs b/tests/ui/unreachable-code/boolean-negation-in-unreachable-code-7344.rs similarity index 81% rename from tests/ui/issues/issue-7344.rs rename to tests/ui/unreachable-code/boolean-negation-in-unreachable-code-7344.rs index 406b24634f55e..8fd091872c310 100644 --- a/tests/ui/issues/issue-7344.rs +++ b/tests/ui/unreachable-code/boolean-negation-in-unreachable-code-7344.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/7344 //@ run-pass #![allow(unused_must_use)] diff --git a/tests/ui/issues/auxiliary/issue-5844-aux.rs b/tests/ui/unsafe/auxiliary/aux-5844.rs similarity index 100% rename from tests/ui/issues/auxiliary/issue-5844-aux.rs rename to tests/ui/unsafe/auxiliary/aux-5844.rs diff --git a/tests/ui/unsafe/extern-function-requires-unsafe-5844.rs b/tests/ui/unsafe/extern-function-requires-unsafe-5844.rs new file mode 100644 index 0000000000000..11863ce647ae1 --- /dev/null +++ b/tests/ui/unsafe/extern-function-requires-unsafe-5844.rs @@ -0,0 +1,8 @@ +// https://github.com/rust-lang/rust/issues/5844 +//@aux-build:aux-5844.rs + +extern crate aux_5844; + +fn main() { + aux_5844::rand(); //~ ERROR: requires unsafe +} diff --git a/tests/ui/issues/issue-5844.stderr b/tests/ui/unsafe/extern-function-requires-unsafe-5844.stderr similarity index 70% rename from tests/ui/issues/issue-5844.stderr rename to tests/ui/unsafe/extern-function-requires-unsafe-5844.stderr index bae917fa72c5d..44dee178991ae 100644 --- a/tests/ui/issues/issue-5844.stderr +++ b/tests/ui/unsafe/extern-function-requires-unsafe-5844.stderr @@ -1,8 +1,8 @@ error[E0133]: call to unsafe function `rand` is unsafe and requires unsafe function or block - --> $DIR/issue-5844.rs:6:5 + --> $DIR/extern-function-requires-unsafe-5844.rs:7:5 | -LL | issue_5844_aux::rand(); - | ^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function +LL | aux_5844::rand(); + | ^^^^^^^^^^^^^^^^ call to unsafe function | = note: consult the function's documentation for information on how to avoid undefined behavior