diff --git a/src/librustc_resolve/late/diagnostics.rs b/src/librustc_resolve/late/diagnostics.rs index b1a1f8725a180..5b5e8a53be915 100644 --- a/src/librustc_resolve/late/diagnostics.rs +++ b/src/librustc_resolve/late/diagnostics.rs @@ -353,10 +353,252 @@ impl<'a> LateResolutionVisitor<'a, '_, '_> { } _ => {} } + if ns == TypeNS && path.len() == 1 { + // Case-insensitive test against most libstd struct names + // as another fallback + match res { + Some(Res::ToolMod) => {} + _ => { + let structs = self.get_case_insensitive_libstd_structs_matches( + &ident.name.to_ident_string(), + ); + if structs.len() == 1 { + err.span_suggestion( + ident_span, + &format!("found a std struct with a similar name"), + format!("{}", structs[0]), + Applicability::MaybeIncorrect, + ); + } else if structs.len() > 1 { + let mut struct_suggestions = Vec::new(); + let message = "found std structs with similar names:"; + for a_struct in structs.iter() { + struct_suggestions.push(format!("{}", a_struct)); + } + err.span_suggestions( + ident_span, + message, + struct_suggestions.into_iter(), + Applicability::MaybeIncorrect, + ); + } + } + } + } } + (err, candidates) } + /// Get a case-insensitive match with standard library + /// structs that are *not imported* in the prelude. + /// This is used for type checking diagnostics in cases when + /// the type is not in scope and the name includes case + /// misspelling (e.g., `Hashmap`, not `HashMap`). + fn get_case_insensitive_libstd_structs_matches(&self, needle: &str) -> Vec { + // Excludes error types + // Excludes nightly only types + // Excludes types with case-sensitive macro names (e.g., `File` -> `file`) + // Excludes deprecated types (e.g., `std::str::LinesAny`) + let libstd_structs = [ + "std::alloc::Layout", + "std::alloc::System", + "std::any::TypeId", + "std::ascii::EscapeDefault", + "std::cell::Cell", + "std::char::DecodeUtf16", + "std::char::EscapeDefault", + "std::char::EscapeUnicode", + "std::char::ToLowercase", + "std::char::ToUppercase", + "std::cmp::Reverse", + "std::collections::BTreeMap", + "std::collections::BTreeSet", + "std::collections::BinaryHeap", + "std::collections::HashMap", + "std::collections::HashSet", + "std::collections::LinkedList", + "std::collections::VecDeque", + "std::env::Args", + "std::env::ArgsOs", + "std::env::SplitPaths", + "std::env::Vars", + "std::env::VarsOs", + "std::ffi::CStr", + "std::ffi::CString", + "std::ffi::OsStr", + "std::ffi::OsString", + "std::fmt::DebugList", + "std::fmt::DebugMap", + "std::fmt::DebugSet", + "std::fmt::DebugStruct", + "std::fmt::DebugTuple", + "std::fmt::Formatter", + "std::fs::DirBuilder", + "std::fs::DirEntry", + "std::fs::FileType", + "std::fs::Metadata", + "std::fs::OpenOptions", + "std::fs::Permissions", + "std::fs::ReadDir", + "std::hash::BuildHasherDefault", + "std::io::BufReader", + "std::io::BufWriter", + "std::io::Bytes", + "std::io::Chain", + "std::io::Cursor", + "std::io::Empty", + "std::io::IoSlice", + "std::io::IoSliceMut", + "std::io::LineWriter", + "std::io::Lines", + "std::io::Repeat", + "std::io::Sink", + "std::io::Split", + "std::io::Stderr", + "std::io::StderrLock", + "std::io::Stdin", + "std::io::StdinLock", + "std::io::Stdout", + "std::io::StdoutLock", + "std::io::Take", + "std::iter::Chain", + "std::iter::Cloned", + "std::iter::Copied", + "std::iter::Cycle", + "std::iter::Empty", + "std::iter::Enumerate", + "std::iter::Filter", + "std::iter::FilterMap", + "std::iter::Flatten", + "std::iter::FromFn", + "std::iter::Fuse", + "std::iter::Inspect", + "std::iter::Map", + "std::iter::Once", + "std::iter::OnceWith", + "std::iter::Peekable", + "std::iter::Repeat", + "std::iter::RepeatWith", + "std::iter::Rev", + "std::iter::Scan", + "std::iter::Skip", + "std::iter::SkipWhile", + "std::iter::StepBy", + "std::iter::Successors", + "std::iter::Take", + "std::iter::TakeWhile", + "std::iter::Zip", + "std::marker::PhantomData", + "std::marker::PhantomPinned", + "std::mem::Discriminant", + "std::mem::ManuallyDrop", + "std::net::Incoming", + "std::net::Ipv4Addr", + "std::net::Ipv6Addr", + "std::net::SocketAddrV4", + "std::net::SocketAddrV6", + "std::net::TcpListener", + "std::net::TcpStream", + "std::net::UdpSocket", + "std::num::NonZeroI8", + "std::num::NonZeroI16", + "std::num::NonZeroI32", + "std::num::NonZeroI64", + "std::num::NonZeroI128", + "std::num::NonZeroU8", + "std::num::NonZeroU16", + "std::num::NonZeroU32", + "std::num::NonZeroU64", + "std::num::NonZeroU128", + "std::num::NonZeroUsize", + "std::num::Wrapping", + "std::ops::Range", + "std::ops::RangeFrom", + "std::ops::RangeFull", + "std::ops::RangeInclusive", + "std::ops::RangeTo", + "std::ops::RangeToInclusive", + "std::panic::AssertUnwindSafe", + "std::panic::Location", + "std::panic::PanicInfo", + "std::path::Ancestors", + "std::path::Components", + "std::path::PathBuf", + "std::path::PrefixComponent", + "std::pin::Pin", + "std::process::Child", + "std::process::ChildStderr", + "std::process::ChildStdin", + "std::process::ChildStdout", + "std::process::Command", + "std::process::ExitStatus", + "std::process::Output", + "std::process::Stdio", + "std::ptr::NonNull", + "std::rc::Rc", + "std::rc::Weak", + "std::str::Bytes", + "std::str::CharIndices", + "std::str::Chars", + "std::str::EncodeUtf16", + "std::str::EscapeDefault", + "std::str::EscapeUnicode", + "std::str::Lines", + "std::str::MatchIndices", + "std::str::RMatchIndices", + "std::str::RMatches", + "std::str::RSplit", + "std::str::RSplitN", + "std::str::RSplitTerminator", + "std::str::Split", + "std::str::SplitAsciiWhitespace", + "std::str::SplitN", + "std::str::SplitTerminator", + "std::str::SplitWhitespace", + "std::string::Drain", + "std::sync::Arc", + "std::sync::Barrier", + "std::sync::BarrierWaitResult", + "std::sync::Condvar", + "std::sync::Mutex", + "std::sync::MutexGuard", + "std::sync::Once", + "std::sync::RwLock", + "std::sync::RwLockReadGuard", + "std::sync::RwLockWriteGuard", + "std::sync::WaitTimeoutResult", + "std::sync::Weak", + "std::task::Context", + "std::task::RawWaker", + "std::task::RawWakerVTable", + "std::task::Waker", + "std::thread::Builder", + "std::thread::JoinHandle", + "std::thread::LocalKey", + "std::thread::Thread", + "std::thread::ThreadId", + "std::time::Duration", + "std::time::Instant", + "std::time::SystemTime", + ]; + + let mut structs = Vec::new(); + // abort for single character type names + if needle.len() < 2 { + return structs; + } + for item in libstd_structs.iter() { + // check the struct name in the module path + let struct_path: Vec<&str> = item.split("::").collect(); + // case-insensitive comparison of names + if needle.to_lowercase() == struct_path.last().unwrap().to_lowercase() { + structs.push(item.to_string()); + } + } + structs + } + /// Check if the source is call expression and the first argument is `self`. If true, /// return the span of whole call and the span for all arguments expect the first one (`self`). fn call_has_self_arg(&self, source: PathSource<'_>) -> Option<(Span, Option)> { diff --git a/src/test/ui/libstd-case-typo/alloc.rs b/src/test/ui/libstd-case-typo/alloc.rs new file mode 100644 index 0000000000000..1ed796f3b4957 --- /dev/null +++ b/src/test/ui/libstd-case-typo/alloc.rs @@ -0,0 +1,7 @@ +// checks case typos with libstd::alloc structs +fn main(){} + +fn test_layout(_x: LayOut){} +//~^ ERROR: cannot find type `LayOut` in this scope +fn test_system(_x: system){} +//~^ ERROR: cannot find type `system` in this scope diff --git a/src/test/ui/libstd-case-typo/alloc.stderr b/src/test/ui/libstd-case-typo/alloc.stderr new file mode 100644 index 0000000000000..858c27bf5b5bf --- /dev/null +++ b/src/test/ui/libstd-case-typo/alloc.stderr @@ -0,0 +1,21 @@ +error[E0412]: cannot find type `LayOut` in this scope + --> $DIR/alloc.rs:4:20 + | +LL | fn test_layout(_x: LayOut){} + | ^^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::alloc::Layout` + +error[E0412]: cannot find type `system` in this scope + --> $DIR/alloc.rs:6:20 + | +LL | fn test_system(_x: system){} + | ^^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::alloc::System` + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0412`. diff --git a/src/test/ui/libstd-case-typo/any.rs b/src/test/ui/libstd-case-typo/any.rs new file mode 100644 index 0000000000000..96801f93d5ec0 --- /dev/null +++ b/src/test/ui/libstd-case-typo/any.rs @@ -0,0 +1,5 @@ +// checks case typos with libstd::any structs +fn main(){} + +fn test_typeid(_x: Typeid){} +//~^ ERROR: cannot find type `Typeid` in this scope diff --git a/src/test/ui/libstd-case-typo/any.stderr b/src/test/ui/libstd-case-typo/any.stderr new file mode 100644 index 0000000000000..70f5f4de0b168 --- /dev/null +++ b/src/test/ui/libstd-case-typo/any.stderr @@ -0,0 +1,12 @@ +error[E0412]: cannot find type `Typeid` in this scope + --> $DIR/any.rs:4:20 + | +LL | fn test_typeid(_x: Typeid){} + | ^^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::any::TypeId` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0412`. diff --git a/src/test/ui/libstd-case-typo/ascii.rs b/src/test/ui/libstd-case-typo/ascii.rs new file mode 100644 index 0000000000000..9b8f20aa1c307 --- /dev/null +++ b/src/test/ui/libstd-case-typo/ascii.rs @@ -0,0 +1,5 @@ +// checks case typos with libstd::ascii structs +fn main(){} + +fn test_escdef(_x: Escapedefault){} +//~^ ERROR: cannot find type `Escapedefault` in this scope diff --git a/src/test/ui/libstd-case-typo/ascii.stderr b/src/test/ui/libstd-case-typo/ascii.stderr new file mode 100644 index 0000000000000..6bef3496094b1 --- /dev/null +++ b/src/test/ui/libstd-case-typo/ascii.stderr @@ -0,0 +1,18 @@ +error[E0412]: cannot find type `Escapedefault` in this scope + --> $DIR/ascii.rs:4:20 + | +LL | fn test_escdef(_x: Escapedefault){} + | ^^^^^^^^^^^^^ not found in this scope + | +help: found std structs with similar names: + | +LL | fn test_escdef(_x: std::ascii::EscapeDefault){} + | ^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | fn test_escdef(_x: std::char::EscapeDefault){} + | ^^^^^^^^^^^^^^^^^^^^^^^^ +LL | fn test_escdef(_x: std::str::EscapeDefault){} + | ^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0412`. diff --git a/src/test/ui/libstd-case-typo/cell.rs b/src/test/ui/libstd-case-typo/cell.rs new file mode 100644 index 0000000000000..760b163667300 --- /dev/null +++ b/src/test/ui/libstd-case-typo/cell.rs @@ -0,0 +1,5 @@ +// checks case typos with libstd::cell structs +fn main(){} + +fn test_cell(_x: cell<()>){} +//~^ ERROR: cannot find type `cell` in this scope diff --git a/src/test/ui/libstd-case-typo/cell.stderr b/src/test/ui/libstd-case-typo/cell.stderr new file mode 100644 index 0000000000000..77f369a51403d --- /dev/null +++ b/src/test/ui/libstd-case-typo/cell.stderr @@ -0,0 +1,12 @@ +error[E0412]: cannot find type `cell` in this scope + --> $DIR/cell.rs:4:18 + | +LL | fn test_cell(_x: cell<()>){} + | ^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::cell::Cell` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0412`. diff --git a/src/test/ui/libstd-case-typo/char.rs b/src/test/ui/libstd-case-typo/char.rs new file mode 100644 index 0000000000000..e4561609e8f7d --- /dev/null +++ b/src/test/ui/libstd-case-typo/char.rs @@ -0,0 +1,17 @@ +// checks case typos with libstd::char structs +fn main(){} + +fn test_du16(_x: DecodeUTF16<()>){} +//~^ ERROR: cannot find type `DecodeUTF16` in this scope + +fn test_edflt(_x: Escapedefault){} +//~^ ERROR: cannot find type `Escapedefault` in this scope + +fn test_euni(_x: Escapeunicode){} +//~^ ERROR: cannot find type `Escapeunicode` in this scope + +fn test_tolow(_x: Tolowercase){} +//~^ ERROR: cannot find type `Tolowercase` in this scope + +fn test_toupper(_x: Touppercase){} +//~^ ERROR: cannot find type `Touppercase` in this scope diff --git a/src/test/ui/libstd-case-typo/char.stderr b/src/test/ui/libstd-case-typo/char.stderr new file mode 100644 index 0000000000000..4b332f5f36dd5 --- /dev/null +++ b/src/test/ui/libstd-case-typo/char.stderr @@ -0,0 +1,58 @@ +error[E0412]: cannot find type `DecodeUTF16` in this scope + --> $DIR/char.rs:4:18 + | +LL | fn test_du16(_x: DecodeUTF16<()>){} + | ^^^^^^^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::char::DecodeUtf16` + +error[E0412]: cannot find type `Escapedefault` in this scope + --> $DIR/char.rs:7:19 + | +LL | fn test_edflt(_x: Escapedefault){} + | ^^^^^^^^^^^^^ not found in this scope + | +help: found std structs with similar names: + | +LL | fn test_edflt(_x: std::ascii::EscapeDefault){} + | ^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | fn test_edflt(_x: std::char::EscapeDefault){} + | ^^^^^^^^^^^^^^^^^^^^^^^^ +LL | fn test_edflt(_x: std::str::EscapeDefault){} + | ^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0412]: cannot find type `Escapeunicode` in this scope + --> $DIR/char.rs:10:18 + | +LL | fn test_euni(_x: Escapeunicode){} + | ^^^^^^^^^^^^^ not found in this scope + | +help: found std structs with similar names: + | +LL | fn test_euni(_x: std::char::EscapeUnicode){} + | ^^^^^^^^^^^^^^^^^^^^^^^^ +LL | fn test_euni(_x: std::str::EscapeUnicode){} + | ^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0412]: cannot find type `Tolowercase` in this scope + --> $DIR/char.rs:13:19 + | +LL | fn test_tolow(_x: Tolowercase){} + | ^^^^^^^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::char::ToLowercase` + +error[E0412]: cannot find type `Touppercase` in this scope + --> $DIR/char.rs:16:21 + | +LL | fn test_toupper(_x: Touppercase){} + | ^^^^^^^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::char::ToUppercase` + +error: aborting due to 5 previous errors + +For more information about this error, try `rustc --explain E0412`. diff --git a/src/test/ui/libstd-case-typo/cmp.rs b/src/test/ui/libstd-case-typo/cmp.rs new file mode 100644 index 0000000000000..09c73ce43e73d --- /dev/null +++ b/src/test/ui/libstd-case-typo/cmp.rs @@ -0,0 +1,5 @@ +// checks case typos with libstd::cmp structs +fn main(){} + +fn test_rev(_x: reverse<()>){} +//~^ ERROR: cannot find type `reverse` in this scope diff --git a/src/test/ui/libstd-case-typo/cmp.stderr b/src/test/ui/libstd-case-typo/cmp.stderr new file mode 100644 index 0000000000000..03288051970ba --- /dev/null +++ b/src/test/ui/libstd-case-typo/cmp.stderr @@ -0,0 +1,12 @@ +error[E0412]: cannot find type `reverse` in this scope + --> $DIR/cmp.rs:4:17 + | +LL | fn test_rev(_x: reverse<()>){} + | ^^^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::cmp::Reverse` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0412`. diff --git a/src/test/ui/libstd-case-typo/collections.rs b/src/test/ui/libstd-case-typo/collections.rs new file mode 100644 index 0000000000000..9dc4af183b0b9 --- /dev/null +++ b/src/test/ui/libstd-case-typo/collections.rs @@ -0,0 +1,17 @@ +// checks case typos with libstd::collections structs +fn main(){} + +fn test_btm(_x: BtreeMap<(), ()>){} +//~^ ERROR: cannot find type `BtreeMap` in this scope +fn test_bts(_x: BtreeSet<()>){} +//~^ ERROR: cannot find type `BtreeSet` in this scope +fn test_binh(_x: Binaryheap<()>){} +//~^ ERROR: cannot find type `Binaryheap` in this scope +fn test_hashm(_x: Hashmap){} +//~^ ERROR: cannot find type `Hashmap` in this scope +fn test_hashs(_x: Hashset<()>){} +//~^ ERROR: cannot find type `Hashset` in this scope +fn test_llist(_x: Linkedlist<()>){} +//~^ ERROR: cannot find type `Linkedlist` in this scope +fn test_vd(_x: Vecdeque<()>){} +//~^ ERROR: cannot find type `Vecdeque` in this scope diff --git a/src/test/ui/libstd-case-typo/collections.stderr b/src/test/ui/libstd-case-typo/collections.stderr new file mode 100644 index 0000000000000..26eddba7f462a --- /dev/null +++ b/src/test/ui/libstd-case-typo/collections.stderr @@ -0,0 +1,66 @@ +error[E0412]: cannot find type `BtreeMap` in this scope + --> $DIR/collections.rs:4:17 + | +LL | fn test_btm(_x: BtreeMap<(), ()>){} + | ^^^^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::collections::BTreeMap` + +error[E0412]: cannot find type `BtreeSet` in this scope + --> $DIR/collections.rs:6:17 + | +LL | fn test_bts(_x: BtreeSet<()>){} + | ^^^^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::collections::BTreeSet` + +error[E0412]: cannot find type `Binaryheap` in this scope + --> $DIR/collections.rs:8:18 + | +LL | fn test_binh(_x: Binaryheap<()>){} + | ^^^^^^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::collections::BinaryHeap` + +error[E0412]: cannot find type `Hashmap` in this scope + --> $DIR/collections.rs:10:19 + | +LL | fn test_hashm(_x: Hashmap){} + | ^^^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::collections::HashMap` + +error[E0412]: cannot find type `Hashset` in this scope + --> $DIR/collections.rs:12:19 + | +LL | fn test_hashs(_x: Hashset<()>){} + | ^^^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::collections::HashSet` + +error[E0412]: cannot find type `Linkedlist` in this scope + --> $DIR/collections.rs:14:19 + | +LL | fn test_llist(_x: Linkedlist<()>){} + | ^^^^^^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::collections::LinkedList` + +error[E0412]: cannot find type `Vecdeque` in this scope + --> $DIR/collections.rs:16:16 + | +LL | fn test_vd(_x: Vecdeque<()>){} + | ^^^^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::collections::VecDeque` + +error: aborting due to 7 previous errors + +For more information about this error, try `rustc --explain E0412`. diff --git a/src/test/ui/libstd-case-typo/env.rs b/src/test/ui/libstd-case-typo/env.rs new file mode 100644 index 0000000000000..deede552c3243 --- /dev/null +++ b/src/test/ui/libstd-case-typo/env.rs @@ -0,0 +1,13 @@ +// checks case typos with libstd::env structs +fn main(){} + +fn test_args(_x: args){} +//~^ ERROR: cannot find type `args` in this scope +fn test_argsos(_x: Argsos){} +//~^ ERROR: cannot find type `Argsos` in this scope +fn test_sp(_x: Splitpaths<'_>){} +//~^ ERROR: cannot find type `Splitpaths` in this scope +fn test_vars(_x: vars){} +//~^ ERROR: cannot find type `vars` in this scope +fn test_varsos(_x: Varsos){} +//~^ ERROR: cannot find type `Varsos` in this scope diff --git a/src/test/ui/libstd-case-typo/env.stderr b/src/test/ui/libstd-case-typo/env.stderr new file mode 100644 index 0000000000000..c66dd1e61d4f2 --- /dev/null +++ b/src/test/ui/libstd-case-typo/env.stderr @@ -0,0 +1,48 @@ +error[E0412]: cannot find type `args` in this scope + --> $DIR/env.rs:4:18 + | +LL | fn test_args(_x: args){} + | ^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::env::Args` + +error[E0412]: cannot find type `Argsos` in this scope + --> $DIR/env.rs:6:20 + | +LL | fn test_argsos(_x: Argsos){} + | ^^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::env::ArgsOs` + +error[E0412]: cannot find type `Splitpaths` in this scope + --> $DIR/env.rs:8:16 + | +LL | fn test_sp(_x: Splitpaths<'_>){} + | ^^^^^^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::env::SplitPaths` + +error[E0412]: cannot find type `vars` in this scope + --> $DIR/env.rs:10:18 + | +LL | fn test_vars(_x: vars){} + | ^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::env::Vars` + +error[E0412]: cannot find type `Varsos` in this scope + --> $DIR/env.rs:12:20 + | +LL | fn test_varsos(_x: Varsos){} + | ^^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::env::VarsOs` + +error: aborting due to 5 previous errors + +For more information about this error, try `rustc --explain E0412`. diff --git a/src/test/ui/libstd-case-typo/ffi.rs b/src/test/ui/libstd-case-typo/ffi.rs new file mode 100644 index 0000000000000..3148b10f57772 --- /dev/null +++ b/src/test/ui/libstd-case-typo/ffi.rs @@ -0,0 +1,9 @@ +// checks case typos with libstd::ffi structs +fn main(){} + +fn test_cstr(_x: cStr){} +//~^ ERROR: cannot find type `cStr` in this scope +fn test_osstr(_x: Osstr){} +//~^ ERROR: cannot find type `Osstr` in this scope +fn test_osstring(_x: Osstring){} +//~^ ERROR: cannot find type `Osstring` in this scope diff --git a/src/test/ui/libstd-case-typo/ffi.stderr b/src/test/ui/libstd-case-typo/ffi.stderr new file mode 100644 index 0000000000000..a3999f4654921 --- /dev/null +++ b/src/test/ui/libstd-case-typo/ffi.stderr @@ -0,0 +1,30 @@ +error[E0412]: cannot find type `cStr` in this scope + --> $DIR/ffi.rs:4:18 + | +LL | fn test_cstr(_x: cStr){} + | ^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::ffi::CStr` + +error[E0412]: cannot find type `Osstr` in this scope + --> $DIR/ffi.rs:6:19 + | +LL | fn test_osstr(_x: Osstr){} + | ^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::ffi::OsStr` + +error[E0412]: cannot find type `Osstring` in this scope + --> $DIR/ffi.rs:8:22 + | +LL | fn test_osstring(_x: Osstring){} + | ^^^^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::ffi::OsString` + +error: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0412`. diff --git a/src/test/ui/libstd-case-typo/fmt.rs b/src/test/ui/libstd-case-typo/fmt.rs new file mode 100644 index 0000000000000..3f08432fc3260 --- /dev/null +++ b/src/test/ui/libstd-case-typo/fmt.rs @@ -0,0 +1,15 @@ +// checks case typos with libstd::fmt structs +fn main(){} + +fn test_dbglist(_x: Debuglist){} +//~^ ERROR: cannot find type `Debuglist` in this scope +fn test_dbgmap(_x: Debugmap){} +//~^ ERROR: cannot find type `Debugmap` in this scope +fn test_dbgset(_x: Debugset){} +//~^ ERROR: cannot find type `Debugset` in this scope +fn test_dbgstruct(_x: Debugstruct){} +//~^ ERROR: cannot find type `Debugstruct` in this scope +fn test_dbgtuple(_x: Debugtuple){} +//~^ ERROR: cannot find type `Debugtuple` in this scope +fn test_fmter(mut _x: formatter){} +//~^ ERROR: cannot find type `formatter` in this scope diff --git a/src/test/ui/libstd-case-typo/fmt.stderr b/src/test/ui/libstd-case-typo/fmt.stderr new file mode 100644 index 0000000000000..4559011cef9af --- /dev/null +++ b/src/test/ui/libstd-case-typo/fmt.stderr @@ -0,0 +1,57 @@ +error[E0412]: cannot find type `Debuglist` in this scope + --> $DIR/fmt.rs:4:21 + | +LL | fn test_dbglist(_x: Debuglist){} + | ^^^^^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::fmt::DebugList` + +error[E0412]: cannot find type `Debugmap` in this scope + --> $DIR/fmt.rs:6:20 + | +LL | fn test_dbgmap(_x: Debugmap){} + | ^^^^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::fmt::DebugMap` + +error[E0412]: cannot find type `Debugset` in this scope + --> $DIR/fmt.rs:8:20 + | +LL | fn test_dbgset(_x: Debugset){} + | ^^^^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::fmt::DebugSet` + +error[E0412]: cannot find type `Debugstruct` in this scope + --> $DIR/fmt.rs:10:23 + | +LL | fn test_dbgstruct(_x: Debugstruct){} + | ^^^^^^^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::fmt::DebugStruct` + +error[E0412]: cannot find type `Debugtuple` in this scope + --> $DIR/fmt.rs:12:22 + | +LL | fn test_dbgtuple(_x: Debugtuple){} + | ^^^^^^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::fmt::DebugTuple` + +error[E0412]: cannot find type `formatter` in this scope + --> $DIR/fmt.rs:14:23 + | +LL | fn test_fmter(mut _x: formatter){} + | ^^^^^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::fmt::Formatter` + +error: aborting due to 6 previous errors + +For more information about this error, try `rustc --explain E0412`. diff --git a/src/test/ui/libstd-case-typo/fs.rs b/src/test/ui/libstd-case-typo/fs.rs new file mode 100644 index 0000000000000..293722e9bcf52 --- /dev/null +++ b/src/test/ui/libstd-case-typo/fs.rs @@ -0,0 +1,17 @@ +// checks case typos with libstd::fs structs +fn main(){} + +fn test_dirbuild(_x: Dirbuilder){} +//~^ ERROR: cannot find type `Dirbuilder` in this scope +fn test_direntry(_x: Direntry){} +//~^ ERROR: cannot find type `Direntry` in this scope +fn test_filety(_x: Filetype){} +//~^ ERROR: cannot find type `Filetype` in this scope +fn test_metadata(_x: MetaData){} +//~^ ERROR: cannot find type `MetaData` in this scope +fn test_opop(_x: Openoptions){} +//~^ ERROR: cannot find type `Openoptions` in this scope +fn test_perm(_x: permissions){} +//~^ ERROR: cannot find type `permissions` in this scope +fn test_readdir(_x: Readdir){} +//~^ ERROR: cannot find type `Readdir` in this scope diff --git a/src/test/ui/libstd-case-typo/fs.stderr b/src/test/ui/libstd-case-typo/fs.stderr new file mode 100644 index 0000000000000..8c9adc74dbded --- /dev/null +++ b/src/test/ui/libstd-case-typo/fs.stderr @@ -0,0 +1,66 @@ +error[E0412]: cannot find type `Dirbuilder` in this scope + --> $DIR/fs.rs:4:22 + | +LL | fn test_dirbuild(_x: Dirbuilder){} + | ^^^^^^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::fs::DirBuilder` + +error[E0412]: cannot find type `Direntry` in this scope + --> $DIR/fs.rs:6:22 + | +LL | fn test_direntry(_x: Direntry){} + | ^^^^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::fs::DirEntry` + +error[E0412]: cannot find type `Filetype` in this scope + --> $DIR/fs.rs:8:20 + | +LL | fn test_filety(_x: Filetype){} + | ^^^^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::fs::FileType` + +error[E0412]: cannot find type `MetaData` in this scope + --> $DIR/fs.rs:10:22 + | +LL | fn test_metadata(_x: MetaData){} + | ^^^^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::fs::Metadata` + +error[E0412]: cannot find type `Openoptions` in this scope + --> $DIR/fs.rs:12:18 + | +LL | fn test_opop(_x: Openoptions){} + | ^^^^^^^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::fs::OpenOptions` + +error[E0412]: cannot find type `permissions` in this scope + --> $DIR/fs.rs:14:18 + | +LL | fn test_perm(_x: permissions){} + | ^^^^^^^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::fs::Permissions` + +error[E0412]: cannot find type `Readdir` in this scope + --> $DIR/fs.rs:16:21 + | +LL | fn test_readdir(_x: Readdir){} + | ^^^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::fs::ReadDir` + +error: aborting due to 7 previous errors + +For more information about this error, try `rustc --explain E0412`. diff --git a/src/test/ui/libstd-case-typo/hash.rs b/src/test/ui/libstd-case-typo/hash.rs new file mode 100644 index 0000000000000..c8373625b9133 --- /dev/null +++ b/src/test/ui/libstd-case-typo/hash.rs @@ -0,0 +1,5 @@ +// checks case typos with libstd::hash structs +fn main(){} + +fn test_bhd(_x: BuildhasherDefault){} +//~^ ERROR: cannot find type `BuildhasherDefault` in this scope diff --git a/src/test/ui/libstd-case-typo/hash.stderr b/src/test/ui/libstd-case-typo/hash.stderr new file mode 100644 index 0000000000000..91410c5a74043 --- /dev/null +++ b/src/test/ui/libstd-case-typo/hash.stderr @@ -0,0 +1,12 @@ +error[E0412]: cannot find type `BuildhasherDefault` in this scope + --> $DIR/hash.rs:4:17 + | +LL | fn test_bhd(_x: BuildhasherDefault){} + | ^^^^^^^^^^^^^^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::hash::BuildHasherDefault` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0412`. diff --git a/src/test/ui/libstd-case-typo/io.rs b/src/test/ui/libstd-case-typo/io.rs new file mode 100644 index 0000000000000..5604ef96148ca --- /dev/null +++ b/src/test/ui/libstd-case-typo/io.rs @@ -0,0 +1,43 @@ +// checks case typos with libstd::io structs +fn main(){} + +fn test_bufrd(_x: Bufreader<()>){} +//~^ ERROR: cannot find type `Bufreader` in this scope +fn test_bufwr(_x: Bufwriter<()>){} +//~^ ERROR: cannot find type `Bufwriter` in this scope +fn test_bytes(_x: bytes<()>){} +//~^ ERROR: cannot find type `bytes` in this scope +fn test_chain(_x: chain<(), ()>){} +//~^ ERROR: cannot find type `chain` in this scope +fn test_cursor(_x: cursor<()>){} +//~^ ERROR: cannot find type `cursor` in this scope +fn test_empty(_x: empty){} +//~^ ERROR: cannot find type `empty` in this scope +fn test_ios(_x: Ioslice){} +//~^ ERROR: cannot find type `Ioslice` in this scope +fn test_iosm(_x: IosliceMut){} +//~^ ERROR: cannot find type `IosliceMut` in this scope +fn test_linewr(_x: Linewriter<()>){} +//~^ ERROR: cannot find type `Linewriter` in this scope +fn test_lines(_x: lines<()>){} +//~^ ERROR: cannot find type `lines` in this scope +fn test_repeat(_x: repeat){} +//~^ ERROR: cannot find type `repeat` in this scope +fn test_sink(_x: sink){} +//~^ ERROR: cannot find type `sink` in this scope +fn test_split(_x: split<()>){} +//~^ ERROR: cannot find type `split` in this scope +fn test_stderr(_x: StdErr){} +//~^ ERROR: cannot find type `StdErr` in this scope +fn test_stderr_l(_x: StdErrLock){} +//~^ ERROR: cannot find type `StdErrLock` in this scope +fn test_stdind(_x: StdIn){} +//~^ ERROR: cannot find type `StdIn` in this scope +fn test_stdin_l(_x: StdInLock){} +//~^ ERROR: cannot find type `StdInLock` in this scope +fn test_stdout(_x: StdOut){} +//~^ ERROR: cannot find type `StdOut` in this scope +fn test_stdout_l(_x: StdOutLock){} +//~^ ERROR: cannot find type `StdOutLock` in this scope +fn test_take(_x: take){} +//~^ ERROR: cannot find type `take` in this scope diff --git a/src/test/ui/libstd-case-typo/io.stderr b/src/test/ui/libstd-case-typo/io.stderr new file mode 100644 index 0000000000000..a4aee31daef6f --- /dev/null +++ b/src/test/ui/libstd-case-typo/io.stderr @@ -0,0 +1,211 @@ +error[E0412]: cannot find type `Bufreader` in this scope + --> $DIR/io.rs:4:19 + | +LL | fn test_bufrd(_x: Bufreader<()>){} + | ^^^^^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::io::BufReader` + +error[E0412]: cannot find type `Bufwriter` in this scope + --> $DIR/io.rs:6:19 + | +LL | fn test_bufwr(_x: Bufwriter<()>){} + | ^^^^^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::io::BufWriter` + +error[E0412]: cannot find type `bytes` in this scope + --> $DIR/io.rs:8:19 + | +LL | fn test_bytes(_x: bytes<()>){} + | ^^^^^ not found in this scope + | +help: found std structs with similar names: + | +LL | fn test_bytes(_x: std::io::Bytes<()>){} + | ^^^^^^^^^^^^^^ +LL | fn test_bytes(_x: std::str::Bytes<()>){} + | ^^^^^^^^^^^^^^^ + +error[E0412]: cannot find type `chain` in this scope + --> $DIR/io.rs:10:19 + | +LL | fn test_chain(_x: chain<(), ()>){} + | ^^^^^ not found in this scope + | +help: found std structs with similar names: + | +LL | fn test_chain(_x: std::io::Chain<(), ()>){} + | ^^^^^^^^^^^^^^ +LL | fn test_chain(_x: std::iter::Chain<(), ()>){} + | ^^^^^^^^^^^^^^^^ + +error[E0412]: cannot find type `cursor` in this scope + --> $DIR/io.rs:12:20 + | +LL | fn test_cursor(_x: cursor<()>){} + | ^^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::io::Cursor` + +error[E0412]: cannot find type `empty` in this scope + --> $DIR/io.rs:14:19 + | +LL | fn test_empty(_x: empty){} + | ^^^^^ not found in this scope + | +help: found std structs with similar names: + | +LL | fn test_empty(_x: std::io::Empty){} + | ^^^^^^^^^^^^^^ +LL | fn test_empty(_x: std::iter::Empty){} + | ^^^^^^^^^^^^^^^^ + +error[E0412]: cannot find type `Ioslice` in this scope + --> $DIR/io.rs:16:17 + | +LL | fn test_ios(_x: Ioslice){} + | ^^^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::io::IoSlice` + +error[E0412]: cannot find type `IosliceMut` in this scope + --> $DIR/io.rs:18:18 + | +LL | fn test_iosm(_x: IosliceMut){} + | ^^^^^^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::io::IoSliceMut` + +error[E0412]: cannot find type `Linewriter` in this scope + --> $DIR/io.rs:20:20 + | +LL | fn test_linewr(_x: Linewriter<()>){} + | ^^^^^^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::io::LineWriter` + +error[E0412]: cannot find type `lines` in this scope + --> $DIR/io.rs:22:19 + | +LL | fn test_lines(_x: lines<()>){} + | ^^^^^ not found in this scope + | +help: found std structs with similar names: + | +LL | fn test_lines(_x: std::io::Lines<()>){} + | ^^^^^^^^^^^^^^ +LL | fn test_lines(_x: std::str::Lines<()>){} + | ^^^^^^^^^^^^^^^ + +error[E0412]: cannot find type `repeat` in this scope + --> $DIR/io.rs:24:20 + | +LL | fn test_repeat(_x: repeat){} + | ^^^^^^ not found in this scope + | +help: found std structs with similar names: + | +LL | fn test_repeat(_x: std::io::Repeat){} + | ^^^^^^^^^^^^^^^ +LL | fn test_repeat(_x: std::iter::Repeat){} + | ^^^^^^^^^^^^^^^^^ + +error[E0412]: cannot find type `sink` in this scope + --> $DIR/io.rs:26:18 + | +LL | fn test_sink(_x: sink){} + | ^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::io::Sink` + +error[E0412]: cannot find type `split` in this scope + --> $DIR/io.rs:28:19 + | +LL | fn test_split(_x: split<()>){} + | ^^^^^ not found in this scope + | +help: found std structs with similar names: + | +LL | fn test_split(_x: std::io::Split<()>){} + | ^^^^^^^^^^^^^^ +LL | fn test_split(_x: std::str::Split<()>){} + | ^^^^^^^^^^^^^^^ + +error[E0412]: cannot find type `StdErr` in this scope + --> $DIR/io.rs:30:20 + | +LL | fn test_stderr(_x: StdErr){} + | ^^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::io::Stderr` + +error[E0412]: cannot find type `StdErrLock` in this scope + --> $DIR/io.rs:32:22 + | +LL | fn test_stderr_l(_x: StdErrLock){} + | ^^^^^^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::io::StderrLock` + +error[E0412]: cannot find type `StdIn` in this scope + --> $DIR/io.rs:34:20 + | +LL | fn test_stdind(_x: StdIn){} + | ^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::io::Stdin` + +error[E0412]: cannot find type `StdInLock` in this scope + --> $DIR/io.rs:36:21 + | +LL | fn test_stdin_l(_x: StdInLock){} + | ^^^^^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::io::StdinLock` + +error[E0412]: cannot find type `StdOut` in this scope + --> $DIR/io.rs:38:20 + | +LL | fn test_stdout(_x: StdOut){} + | ^^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::io::Stdout` + +error[E0412]: cannot find type `StdOutLock` in this scope + --> $DIR/io.rs:40:22 + | +LL | fn test_stdout_l(_x: StdOutLock){} + | ^^^^^^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::io::StdoutLock` + +error[E0412]: cannot find type `take` in this scope + --> $DIR/io.rs:42:18 + | +LL | fn test_take(_x: take){} + | ^^^^ not found in this scope + | +help: found std structs with similar names: + | +LL | fn test_take(_x: std::io::Take){} + | ^^^^^^^^^^^^^ +LL | fn test_take(_x: std::iter::Take){} + | ^^^^^^^^^^^^^^^ + +error: aborting due to 20 previous errors + +For more information about this error, try `rustc --explain E0412`. diff --git a/src/test/ui/libstd-case-typo/iter.rs b/src/test/ui/libstd-case-typo/iter.rs new file mode 100644 index 0000000000000..bd76447607d91 --- /dev/null +++ b/src/test/ui/libstd-case-typo/iter.rs @@ -0,0 +1,57 @@ +// checks case typos with libstd::iter structs +fn main(){} + +fn test_chain(_x: chain<(), ()>){} +//~^ ERROR: cannot find type `chain` in this scope +fn test_cloned(_x: cloned<(), ()>){} +//~^ ERROR: cannot find type `cloned` in this scope +fn test_copied(_x: copied<(), ()>){} +//~^ ERROR: cannot find type `copied` in this scope +fn test_cycle(_x: cycle<(), ()>){} +//~^ ERROR: cannot find type `cycle` in this scope +fn test_empty(_x: empty){} +//~^ ERROR: cannot find type `empty` in this scope +fn test_enumer(_x: enumerate<(), ()>){} +//~^ ERROR: cannot find type `enumerate` in this scope +fn test_filter(_x: filter<(), ()>){} +//~^ ERROR: cannot find type `filter` in this scope +fn test_filtermap(_x: Filtermap<(), ()>){} +//~^ ERROR: cannot find type `Filtermap` in this scope +fn test_flatten(_x: flatten<()>){} +//~^ ERROR: cannot find type `flatten` in this scope +fn test_fromfn(_x: Fromfn<()>){} +//~^ ERROR: cannot find type `Fromfn` in this scope +fn test_fuse(_x: fuse<()>){} +//~^ ERROR: cannot find type `fuse` in this scope +fn test_inspect(_x: inspect<(), ()>){} +//~^ ERROR: cannot find type `inspect` in this scope +fn test_map(_x: map<(), ()>){} +//~^ ERROR: cannot find type `map` in this scope +fn test_once(_x: once<()>){} +//~^ ERROR: cannot find type `once` in this scope +fn test_oncewith(_x: Oncewith<()>){} +//~^ ERROR: cannot find type `Oncewith` in this scope +fn test_peek(_x: peekable<()>){} +//~^ ERROR: cannot find type `peekable` in this scope +fn test_repeat(_x: repeat<()>){} +//~^ ERROR: cannot find type `repeat` in this scope +fn test_repeatw(_x: Repeatwith<()>){} +//~^ ERROR: cannot find type `Repeatwith` in this scope +fn test_rev(_x: rev<()>){} +//~^ ERROR: cannot find type `rev` in this scope +fn test_scan(_x: scan<(), (), ()>){} +//~^ ERROR: cannot find type `scan` in this scope +fn test_skip(_x: skip<()>){} +//~^ ERROR: cannot find type `skip` in this scope +fn test_skipw(_x: Skipwhile<(), ()>){} +//~^ ERROR: cannot find type `Skipwhile` in this scope +fn test_stepby(_x: Stepby<()>){} +//~^ ERROR: cannot find type `Stepby` in this scope +fn test_successors(_x: successors<()>){} +//~^ ERROR: cannot find type `successors` in this scope +fn test_take(_x: take<()>){} +//~^ ERROR: cannot find type `take` in this scope +fn test_takew(_x: Takewhile<(), ()>){} +//~^ ERROR: cannot find type `Takewhile` in this scope +fn test_zip(_x: zip<(), ()>){} +//~^ ERROR: cannot find type `zip` in this scope diff --git a/src/test/ui/libstd-case-typo/iter.stderr b/src/test/ui/libstd-case-typo/iter.stderr new file mode 100644 index 0000000000000..605a703d2bbda --- /dev/null +++ b/src/test/ui/libstd-case-typo/iter.stderr @@ -0,0 +1,270 @@ +error[E0412]: cannot find type `chain` in this scope + --> $DIR/iter.rs:4:19 + | +LL | fn test_chain(_x: chain<(), ()>){} + | ^^^^^ not found in this scope + | +help: found std structs with similar names: + | +LL | fn test_chain(_x: std::io::Chain<(), ()>){} + | ^^^^^^^^^^^^^^ +LL | fn test_chain(_x: std::iter::Chain<(), ()>){} + | ^^^^^^^^^^^^^^^^ + +error[E0412]: cannot find type `cloned` in this scope + --> $DIR/iter.rs:6:20 + | +LL | fn test_cloned(_x: cloned<(), ()>){} + | ^^^^^^ help: a trait with a similar name exists: `Clone` + | + ::: $SRC_DIR/libcore/clone.rs:LL:COL + | +LL | pub trait Clone: Sized { + | ---------------------- similarly named trait `Clone` defined here + +error[E0412]: cannot find type `copied` in this scope + --> $DIR/iter.rs:8:20 + | +LL | fn test_copied(_x: copied<(), ()>){} + | ^^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::iter::Copied` + +error[E0412]: cannot find type `cycle` in this scope + --> $DIR/iter.rs:10:19 + | +LL | fn test_cycle(_x: cycle<(), ()>){} + | ^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::iter::Cycle` + +error[E0412]: cannot find type `empty` in this scope + --> $DIR/iter.rs:12:19 + | +LL | fn test_empty(_x: empty){} + | ^^^^^ not found in this scope + | +help: found std structs with similar names: + | +LL | fn test_empty(_x: std::io::Empty){} + | ^^^^^^^^^^^^^^ +LL | fn test_empty(_x: std::iter::Empty){} + | ^^^^^^^^^^^^^^^^ + +error[E0412]: cannot find type `enumerate` in this scope + --> $DIR/iter.rs:14:20 + | +LL | fn test_enumer(_x: enumerate<(), ()>){} + | ^^^^^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::iter::Enumerate` + +error[E0412]: cannot find type `filter` in this scope + --> $DIR/iter.rs:16:20 + | +LL | fn test_filter(_x: filter<(), ()>){} + | ^^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::iter::Filter` + +error[E0412]: cannot find type `Filtermap` in this scope + --> $DIR/iter.rs:18:23 + | +LL | fn test_filtermap(_x: Filtermap<(), ()>){} + | ^^^^^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::iter::FilterMap` + +error[E0412]: cannot find type `flatten` in this scope + --> $DIR/iter.rs:20:21 + | +LL | fn test_flatten(_x: flatten<()>){} + | ^^^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::iter::Flatten` + +error[E0412]: cannot find type `Fromfn` in this scope + --> $DIR/iter.rs:22:20 + | +LL | fn test_fromfn(_x: Fromfn<()>){} + | ^^^^^^ help: a trait with a similar name exists: `From` + | + ::: $SRC_DIR/libcore/convert/mod.rs:LL:COL + | +LL | pub trait From: Sized { + | ------------------------ similarly named trait `From` defined here + +error[E0412]: cannot find type `fuse` in this scope + --> $DIR/iter.rs:24:18 + | +LL | fn test_fuse(_x: fuse<()>){} + | ^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::iter::Fuse` + +error[E0412]: cannot find type `inspect` in this scope + --> $DIR/iter.rs:26:21 + | +LL | fn test_inspect(_x: inspect<(), ()>){} + | ^^^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::iter::Inspect` + +error[E0412]: cannot find type `map` in this scope + --> $DIR/iter.rs:28:17 + | +LL | fn test_map(_x: map<(), ()>){} + | ^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::iter::Map` + +error[E0412]: cannot find type `once` in this scope + --> $DIR/iter.rs:30:18 + | +LL | fn test_once(_x: once<()>){} + | ^^^^ not found in this scope + | +help: found std structs with similar names: + | +LL | fn test_once(_x: std::iter::Once<()>){} + | ^^^^^^^^^^^^^^^ +LL | fn test_once(_x: std::sync::Once<()>){} + | ^^^^^^^^^^^^^^^ + +error[E0412]: cannot find type `Oncewith` in this scope + --> $DIR/iter.rs:32:22 + | +LL | fn test_oncewith(_x: Oncewith<()>){} + | ^^^^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::iter::OnceWith` + +error[E0412]: cannot find type `peekable` in this scope + --> $DIR/iter.rs:34:18 + | +LL | fn test_peek(_x: peekable<()>){} + | ^^^^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::iter::Peekable` + +error[E0412]: cannot find type `repeat` in this scope + --> $DIR/iter.rs:36:20 + | +LL | fn test_repeat(_x: repeat<()>){} + | ^^^^^^ not found in this scope + | +help: found std structs with similar names: + | +LL | fn test_repeat(_x: std::io::Repeat<()>){} + | ^^^^^^^^^^^^^^^ +LL | fn test_repeat(_x: std::iter::Repeat<()>){} + | ^^^^^^^^^^^^^^^^^ + +error[E0412]: cannot find type `Repeatwith` in this scope + --> $DIR/iter.rs:38:21 + | +LL | fn test_repeatw(_x: Repeatwith<()>){} + | ^^^^^^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::iter::RepeatWith` + +error[E0412]: cannot find type `rev` in this scope + --> $DIR/iter.rs:40:17 + | +LL | fn test_rev(_x: rev<()>){} + | ^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::iter::Rev` + +error[E0412]: cannot find type `scan` in this scope + --> $DIR/iter.rs:42:18 + | +LL | fn test_scan(_x: scan<(), (), ()>){} + | ^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::iter::Scan` + +error[E0412]: cannot find type `skip` in this scope + --> $DIR/iter.rs:44:18 + | +LL | fn test_skip(_x: skip<()>){} + | ^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::iter::Skip` + +error[E0412]: cannot find type `Skipwhile` in this scope + --> $DIR/iter.rs:46:19 + | +LL | fn test_skipw(_x: Skipwhile<(), ()>){} + | ^^^^^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::iter::SkipWhile` + +error[E0412]: cannot find type `Stepby` in this scope + --> $DIR/iter.rs:48:20 + | +LL | fn test_stepby(_x: Stepby<()>){} + | ^^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::iter::StepBy` + +error[E0412]: cannot find type `successors` in this scope + --> $DIR/iter.rs:50:24 + | +LL | fn test_successors(_x: successors<()>){} + | ^^^^^^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::iter::Successors` + +error[E0412]: cannot find type `take` in this scope + --> $DIR/iter.rs:52:18 + | +LL | fn test_take(_x: take<()>){} + | ^^^^ not found in this scope + | +help: found std structs with similar names: + | +LL | fn test_take(_x: std::io::Take<()>){} + | ^^^^^^^^^^^^^ +LL | fn test_take(_x: std::iter::Take<()>){} + | ^^^^^^^^^^^^^^^ + +error[E0412]: cannot find type `Takewhile` in this scope + --> $DIR/iter.rs:54:19 + | +LL | fn test_takew(_x: Takewhile<(), ()>){} + | ^^^^^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::iter::TakeWhile` + +error[E0412]: cannot find type `zip` in this scope + --> $DIR/iter.rs:56:17 + | +LL | fn test_zip(_x: zip<(), ()>){} + | ^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::iter::Zip` + +error: aborting due to 27 previous errors + +For more information about this error, try `rustc --explain E0412`. diff --git a/src/test/ui/libstd-case-typo/marker.rs b/src/test/ui/libstd-case-typo/marker.rs new file mode 100644 index 0000000000000..61e6fc92178b4 --- /dev/null +++ b/src/test/ui/libstd-case-typo/marker.rs @@ -0,0 +1,7 @@ +// checks case typos with libstd::marker structs +fn main(){} + +fn test_phandat(_x: Phantomdata){} +//~^ ERROR: cannot find type `Phantomdata` in this scope +fn test_phanpin(_x: Phantompinned){} +//~^ ERROR: cannot find type `Phantompinned` in this scope diff --git a/src/test/ui/libstd-case-typo/marker.stderr b/src/test/ui/libstd-case-typo/marker.stderr new file mode 100644 index 0000000000000..6dfb26267d9d8 --- /dev/null +++ b/src/test/ui/libstd-case-typo/marker.stderr @@ -0,0 +1,21 @@ +error[E0412]: cannot find type `Phantomdata` in this scope + --> $DIR/marker.rs:4:21 + | +LL | fn test_phandat(_x: Phantomdata){} + | ^^^^^^^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::marker::PhantomData` + +error[E0412]: cannot find type `Phantompinned` in this scope + --> $DIR/marker.rs:6:21 + | +LL | fn test_phanpin(_x: Phantompinned){} + | ^^^^^^^^^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::marker::PhantomPinned` + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0412`. diff --git a/src/test/ui/libstd-case-typo/mem.rs b/src/test/ui/libstd-case-typo/mem.rs new file mode 100644 index 0000000000000..554a1084ce8ea --- /dev/null +++ b/src/test/ui/libstd-case-typo/mem.rs @@ -0,0 +1,7 @@ +// checks case typos with libstd::mem structs +fn main(){} + +fn test_disc(_x: discriminant<()>){} +//~^ ERROR: cannot find type `discriminant` in this scope +fn test_mandrop(_x: Manuallydrop<()>){} +//~^ ERROR: cannot find type `Manuallydrop` in this scope diff --git a/src/test/ui/libstd-case-typo/mem.stderr b/src/test/ui/libstd-case-typo/mem.stderr new file mode 100644 index 0000000000000..28802addd2992 --- /dev/null +++ b/src/test/ui/libstd-case-typo/mem.stderr @@ -0,0 +1,21 @@ +error[E0412]: cannot find type `discriminant` in this scope + --> $DIR/mem.rs:4:18 + | +LL | fn test_disc(_x: discriminant<()>){} + | ^^^^^^^^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::mem::Discriminant` + +error[E0412]: cannot find type `Manuallydrop` in this scope + --> $DIR/mem.rs:6:21 + | +LL | fn test_mandrop(_x: Manuallydrop<()>){} + | ^^^^^^^^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::mem::ManuallyDrop` + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0412`. diff --git a/src/test/ui/libstd-case-typo/net.rs b/src/test/ui/libstd-case-typo/net.rs new file mode 100644 index 0000000000000..b9f6b4c6c9c83 --- /dev/null +++ b/src/test/ui/libstd-case-typo/net.rs @@ -0,0 +1,19 @@ +// checks case typos with libstd::net structs +fn main(){} + +fn test_inc(_x: incoming){} +//~^ ERROR: cannot find type `incoming` in this scope +fn test_ipv4(_x: IPv4Addr){} +//~^ ERROR: cannot find type `IPv4Addr` in this scope +fn test_ipv6(_x: IPv6Addr){} +//~^ ERROR: cannot find type `IPv6Addr` in this scope +fn test_socv4(_x: SocketAddrv4){} +//~^ ERROR: cannot find type `SocketAddrv4` in this scope +fn test_socv6(_x: SocketAddrv6){} +//~^ ERROR: cannot find type `SocketAddrv6` in this scope +fn test_tcplist(_x: TCPListener){} +//~^ ERROR: cannot find type `TCPListener` in this scope +fn test_tcpstr(_x: TCPStream){} +//~^ ERROR: cannot find type `TCPStream` in this scope +fn test_udpsoc(_x: UDPSocket){} +//~^ ERROR: cannot find type `UDPSocket` in this scope diff --git a/src/test/ui/libstd-case-typo/net.stderr b/src/test/ui/libstd-case-typo/net.stderr new file mode 100644 index 0000000000000..c65c311b92897 --- /dev/null +++ b/src/test/ui/libstd-case-typo/net.stderr @@ -0,0 +1,75 @@ +error[E0412]: cannot find type `incoming` in this scope + --> $DIR/net.rs:4:17 + | +LL | fn test_inc(_x: incoming){} + | ^^^^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::net::Incoming` + +error[E0412]: cannot find type `IPv4Addr` in this scope + --> $DIR/net.rs:6:18 + | +LL | fn test_ipv4(_x: IPv4Addr){} + | ^^^^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::net::Ipv4Addr` + +error[E0412]: cannot find type `IPv6Addr` in this scope + --> $DIR/net.rs:8:18 + | +LL | fn test_ipv6(_x: IPv6Addr){} + | ^^^^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::net::Ipv6Addr` + +error[E0412]: cannot find type `SocketAddrv4` in this scope + --> $DIR/net.rs:10:19 + | +LL | fn test_socv4(_x: SocketAddrv4){} + | ^^^^^^^^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::net::SocketAddrV4` + +error[E0412]: cannot find type `SocketAddrv6` in this scope + --> $DIR/net.rs:12:19 + | +LL | fn test_socv6(_x: SocketAddrv6){} + | ^^^^^^^^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::net::SocketAddrV6` + +error[E0412]: cannot find type `TCPListener` in this scope + --> $DIR/net.rs:14:21 + | +LL | fn test_tcplist(_x: TCPListener){} + | ^^^^^^^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::net::TcpListener` + +error[E0412]: cannot find type `TCPStream` in this scope + --> $DIR/net.rs:16:20 + | +LL | fn test_tcpstr(_x: TCPStream){} + | ^^^^^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::net::TcpStream` + +error[E0412]: cannot find type `UDPSocket` in this scope + --> $DIR/net.rs:18:20 + | +LL | fn test_udpsoc(_x: UDPSocket){} + | ^^^^^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::net::UdpSocket` + +error: aborting due to 8 previous errors + +For more information about this error, try `rustc --explain E0412`. diff --git a/src/test/ui/libstd-case-typo/num.rs b/src/test/ui/libstd-case-typo/num.rs new file mode 100644 index 0000000000000..ff32db03f9a58 --- /dev/null +++ b/src/test/ui/libstd-case-typo/num.rs @@ -0,0 +1,27 @@ +// checks case typos with libstd::num structs +fn main(){} + +fn test_nzi8(_x: NonZeroi8){} +//~^ ERROR: cannot find type `NonZeroi8` in this scope +fn test_nzi16(_x: NonZeroi16){} +//~^ ERROR: cannot find type `NonZeroi16` in this scope +fn test_nzi32(_x: NonZeroi32){} +//~^ ERROR: cannot find type `NonZeroi32` in this scope +fn test_nzi64(_x: NonZeroi64){} +//~^ ERROR: cannot find type `NonZeroi64` in this scope +fn test_nzi128(_x: NonZeroi128){} +//~^ ERROR: cannot find type `NonZeroi128` in this scope +fn test_nzu8(_x: NonZerou8){} +//~^ ERROR: cannot find type `NonZerou8` in this scope +fn test_nzu16(_x: NonZerou16){} +//~^ ERROR: cannot find type `NonZerou16` in this scope +fn test_nzu32(_x: NonZerou32){} +//~^ ERROR: cannot find type `NonZerou32` in this scope +fn test_nzu64(_x: NonZerou64){} +//~^ ERROR: cannot find type `NonZerou64` in this scope +fn test_nzu128(_x: NonZerou128){} +//~^ ERROR: cannot find type `NonZerou128` in this scope +fn test_nzus(_x: NonzeroUsize){} +//~^ ERROR: cannot find type `NonzeroUsize` in this scope +fn test_wrap(_x: wrapping){} +//~^ ERROR: cannot find type `wrapping` in this scope diff --git a/src/test/ui/libstd-case-typo/num.stderr b/src/test/ui/libstd-case-typo/num.stderr new file mode 100644 index 0000000000000..320e04e3d1e39 --- /dev/null +++ b/src/test/ui/libstd-case-typo/num.stderr @@ -0,0 +1,111 @@ +error[E0412]: cannot find type `NonZeroi8` in this scope + --> $DIR/num.rs:4:18 + | +LL | fn test_nzi8(_x: NonZeroi8){} + | ^^^^^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::num::NonZeroI8` + +error[E0412]: cannot find type `NonZeroi16` in this scope + --> $DIR/num.rs:6:19 + | +LL | fn test_nzi16(_x: NonZeroi16){} + | ^^^^^^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::num::NonZeroI16` + +error[E0412]: cannot find type `NonZeroi32` in this scope + --> $DIR/num.rs:8:19 + | +LL | fn test_nzi32(_x: NonZeroi32){} + | ^^^^^^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::num::NonZeroI32` + +error[E0412]: cannot find type `NonZeroi64` in this scope + --> $DIR/num.rs:10:19 + | +LL | fn test_nzi64(_x: NonZeroi64){} + | ^^^^^^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::num::NonZeroI64` + +error[E0412]: cannot find type `NonZeroi128` in this scope + --> $DIR/num.rs:12:20 + | +LL | fn test_nzi128(_x: NonZeroi128){} + | ^^^^^^^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::num::NonZeroI128` + +error[E0412]: cannot find type `NonZerou8` in this scope + --> $DIR/num.rs:14:18 + | +LL | fn test_nzu8(_x: NonZerou8){} + | ^^^^^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::num::NonZeroU8` + +error[E0412]: cannot find type `NonZerou16` in this scope + --> $DIR/num.rs:16:19 + | +LL | fn test_nzu16(_x: NonZerou16){} + | ^^^^^^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::num::NonZeroU16` + +error[E0412]: cannot find type `NonZerou32` in this scope + --> $DIR/num.rs:18:19 + | +LL | fn test_nzu32(_x: NonZerou32){} + | ^^^^^^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::num::NonZeroU32` + +error[E0412]: cannot find type `NonZerou64` in this scope + --> $DIR/num.rs:20:19 + | +LL | fn test_nzu64(_x: NonZerou64){} + | ^^^^^^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::num::NonZeroU64` + +error[E0412]: cannot find type `NonZerou128` in this scope + --> $DIR/num.rs:22:20 + | +LL | fn test_nzu128(_x: NonZerou128){} + | ^^^^^^^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::num::NonZeroU128` + +error[E0412]: cannot find type `NonzeroUsize` in this scope + --> $DIR/num.rs:24:18 + | +LL | fn test_nzus(_x: NonzeroUsize){} + | ^^^^^^^^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::num::NonZeroUsize` + +error[E0412]: cannot find type `wrapping` in this scope + --> $DIR/num.rs:26:18 + | +LL | fn test_wrap(_x: wrapping){} + | ^^^^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::num::Wrapping` + +error: aborting due to 12 previous errors + +For more information about this error, try `rustc --explain E0412`. diff --git a/src/test/ui/libstd-case-typo/ops.rs b/src/test/ui/libstd-case-typo/ops.rs new file mode 100644 index 0000000000000..0b59ca9928503 --- /dev/null +++ b/src/test/ui/libstd-case-typo/ops.rs @@ -0,0 +1,15 @@ +// checks case typos with libstd::ops structs +fn main(){} + +fn test_range(_x: range<()>){} +//~^ ERROR: cannot find type `range` in this scope +fn test_rangefr(_x: Rangefrom<()>){} +//~^ ERROR: cannot find type `Rangefrom` in this scope +fn test_rangefu(_x: Rangefull<()>){} +//~^ ERROR: cannot find type `Rangefull` in this scope +fn test_rangeinc(_x: Rangeinclusive<()>){} +//~^ ERROR: cannot find type `Rangeinclusive` in this scope +fn test_rangeto(_x: Rangeto<()>){} +//~^ ERROR: cannot find type `Rangeto` in this scope +fn test_rangetoi(_x: RangetoInclusive<()>){} +//~^ ERROR: cannot find type `RangetoInclusive` in this scope diff --git a/src/test/ui/libstd-case-typo/ops.stderr b/src/test/ui/libstd-case-typo/ops.stderr new file mode 100644 index 0000000000000..448076597bcda --- /dev/null +++ b/src/test/ui/libstd-case-typo/ops.stderr @@ -0,0 +1,57 @@ +error[E0412]: cannot find type `range` in this scope + --> $DIR/ops.rs:4:19 + | +LL | fn test_range(_x: range<()>){} + | ^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::ops::Range` + +error[E0412]: cannot find type `Rangefrom` in this scope + --> $DIR/ops.rs:6:21 + | +LL | fn test_rangefr(_x: Rangefrom<()>){} + | ^^^^^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::ops::RangeFrom` + +error[E0412]: cannot find type `Rangefull` in this scope + --> $DIR/ops.rs:8:21 + | +LL | fn test_rangefu(_x: Rangefull<()>){} + | ^^^^^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::ops::RangeFull` + +error[E0412]: cannot find type `Rangeinclusive` in this scope + --> $DIR/ops.rs:10:22 + | +LL | fn test_rangeinc(_x: Rangeinclusive<()>){} + | ^^^^^^^^^^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::ops::RangeInclusive` + +error[E0412]: cannot find type `Rangeto` in this scope + --> $DIR/ops.rs:12:21 + | +LL | fn test_rangeto(_x: Rangeto<()>){} + | ^^^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::ops::RangeTo` + +error[E0412]: cannot find type `RangetoInclusive` in this scope + --> $DIR/ops.rs:14:22 + | +LL | fn test_rangetoi(_x: RangetoInclusive<()>){} + | ^^^^^^^^^^^^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::ops::RangeToInclusive` + +error: aborting due to 6 previous errors + +For more information about this error, try `rustc --explain E0412`. diff --git a/src/test/ui/libstd-case-typo/panic.rs b/src/test/ui/libstd-case-typo/panic.rs new file mode 100644 index 0000000000000..becec70cefc87 --- /dev/null +++ b/src/test/ui/libstd-case-typo/panic.rs @@ -0,0 +1,9 @@ +// checks case typos with libstd::panic structs +fn main(){} + +fn test_assertus(_x: AssertUnwindsafe<()>){} +//~^ ERROR: cannot find type `AssertUnwindsafe` in this scope +fn test_loc(_x: location<()>){} +//~^ ERROR: cannot find type `location` in this scope +fn test_pinfo(_x: Panicinfo<()>){} +//~^ ERROR: cannot find type `Panicinfo` in this scope diff --git a/src/test/ui/libstd-case-typo/panic.stderr b/src/test/ui/libstd-case-typo/panic.stderr new file mode 100644 index 0000000000000..33f6e524f7ed3 --- /dev/null +++ b/src/test/ui/libstd-case-typo/panic.stderr @@ -0,0 +1,30 @@ +error[E0412]: cannot find type `AssertUnwindsafe` in this scope + --> $DIR/panic.rs:4:22 + | +LL | fn test_assertus(_x: AssertUnwindsafe<()>){} + | ^^^^^^^^^^^^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::panic::AssertUnwindSafe` + +error[E0412]: cannot find type `location` in this scope + --> $DIR/panic.rs:6:17 + | +LL | fn test_loc(_x: location<()>){} + | ^^^^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::panic::Location` + +error[E0412]: cannot find type `Panicinfo` in this scope + --> $DIR/panic.rs:8:19 + | +LL | fn test_pinfo(_x: Panicinfo<()>){} + | ^^^^^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::panic::PanicInfo` + +error: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0412`. diff --git a/src/test/ui/libstd-case-typo/path.rs b/src/test/ui/libstd-case-typo/path.rs new file mode 100644 index 0000000000000..316bbb0bb5d0c --- /dev/null +++ b/src/test/ui/libstd-case-typo/path.rs @@ -0,0 +1,11 @@ +// checks case typos with libstd::path structs +fn main(){} + +fn test_ances(_x: ancestors){} +//~^ ERROR: cannot find type `ancestors` in this scope +fn test_comp(_x: components){} +//~^ ERROR: cannot find type `components` in this scope +fn test_pathbuf(_x: Pathbuf){} +//~^ ERROR: cannot find type `Pathbuf` in this scope +fn test_pcomp(_x: Prefixcomponent){} +//~^ ERROR: cannot find type `Prefixcomponent` in this scope diff --git a/src/test/ui/libstd-case-typo/path.stderr b/src/test/ui/libstd-case-typo/path.stderr new file mode 100644 index 0000000000000..917815d6acae1 --- /dev/null +++ b/src/test/ui/libstd-case-typo/path.stderr @@ -0,0 +1,39 @@ +error[E0412]: cannot find type `ancestors` in this scope + --> $DIR/path.rs:4:19 + | +LL | fn test_ances(_x: ancestors){} + | ^^^^^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::path::Ancestors` + +error[E0412]: cannot find type `components` in this scope + --> $DIR/path.rs:6:18 + | +LL | fn test_comp(_x: components){} + | ^^^^^^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::path::Components` + +error[E0412]: cannot find type `Pathbuf` in this scope + --> $DIR/path.rs:8:21 + | +LL | fn test_pathbuf(_x: Pathbuf){} + | ^^^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::path::PathBuf` + +error[E0412]: cannot find type `Prefixcomponent` in this scope + --> $DIR/path.rs:10:19 + | +LL | fn test_pcomp(_x: Prefixcomponent){} + | ^^^^^^^^^^^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::path::PrefixComponent` + +error: aborting due to 4 previous errors + +For more information about this error, try `rustc --explain E0412`. diff --git a/src/test/ui/libstd-case-typo/pin.rs b/src/test/ui/libstd-case-typo/pin.rs new file mode 100644 index 0000000000000..5e9b0a64b00b4 --- /dev/null +++ b/src/test/ui/libstd-case-typo/pin.rs @@ -0,0 +1,5 @@ +// checks case typos with libstd::pin structs +fn main(){} + +fn test_pin(_x: pin<()>){} +//~^ ERROR: cannot find type `pin` in this scope diff --git a/src/test/ui/libstd-case-typo/pin.stderr b/src/test/ui/libstd-case-typo/pin.stderr new file mode 100644 index 0000000000000..ce10cc11f8270 --- /dev/null +++ b/src/test/ui/libstd-case-typo/pin.stderr @@ -0,0 +1,12 @@ +error[E0412]: cannot find type `pin` in this scope + --> $DIR/pin.rs:4:17 + | +LL | fn test_pin(_x: pin<()>){} + | ^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::pin::Pin` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0412`. diff --git a/src/test/ui/libstd-case-typo/process.rs b/src/test/ui/libstd-case-typo/process.rs new file mode 100644 index 0000000000000..35709bb531c34 --- /dev/null +++ b/src/test/ui/libstd-case-typo/process.rs @@ -0,0 +1,19 @@ +// checks case typos with libstd::process structs +fn main(){} + +fn test_child(_x: child){} +//~^ ERROR: cannot find type `child` in this scope +fn test_childse(_x: ChildStdErr){} +//~^ ERROR: cannot find type `ChildStdErr` in this scope +fn test_childsi(_x: ChildStdIn){} +//~^ ERROR: cannot find type `ChildStdIn` in this scope +fn test_childso(_x: ChildStdOut){} +//~^ ERROR: cannot find type `ChildStdOut` in this scope +fn test_command(_x: command){} +//~^ ERROR: cannot find type `command` in this scope +fn test_exits(_x: Exitstatus){} +//~^ ERROR: cannot find type `Exitstatus` in this scope +fn test_output(_x: output){} +//~^ ERROR: cannot find type `output` in this scope +fn test_stdio(_x: StdIo){} +//~^ ERROR: cannot find type `StdIo` in this scope diff --git a/src/test/ui/libstd-case-typo/process.stderr b/src/test/ui/libstd-case-typo/process.stderr new file mode 100644 index 0000000000000..df37cab36b75a --- /dev/null +++ b/src/test/ui/libstd-case-typo/process.stderr @@ -0,0 +1,75 @@ +error[E0412]: cannot find type `child` in this scope + --> $DIR/process.rs:4:19 + | +LL | fn test_child(_x: child){} + | ^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::process::Child` + +error[E0412]: cannot find type `ChildStdErr` in this scope + --> $DIR/process.rs:6:21 + | +LL | fn test_childse(_x: ChildStdErr){} + | ^^^^^^^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::process::ChildStderr` + +error[E0412]: cannot find type `ChildStdIn` in this scope + --> $DIR/process.rs:8:21 + | +LL | fn test_childsi(_x: ChildStdIn){} + | ^^^^^^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::process::ChildStdin` + +error[E0412]: cannot find type `ChildStdOut` in this scope + --> $DIR/process.rs:10:21 + | +LL | fn test_childso(_x: ChildStdOut){} + | ^^^^^^^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::process::ChildStdout` + +error[E0412]: cannot find type `command` in this scope + --> $DIR/process.rs:12:21 + | +LL | fn test_command(_x: command){} + | ^^^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::process::Command` + +error[E0412]: cannot find type `Exitstatus` in this scope + --> $DIR/process.rs:14:19 + | +LL | fn test_exits(_x: Exitstatus){} + | ^^^^^^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::process::ExitStatus` + +error[E0412]: cannot find type `output` in this scope + --> $DIR/process.rs:16:20 + | +LL | fn test_output(_x: output){} + | ^^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::process::Output` + +error[E0412]: cannot find type `StdIo` in this scope + --> $DIR/process.rs:18:19 + | +LL | fn test_stdio(_x: StdIo){} + | ^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::process::Stdio` + +error: aborting due to 8 previous errors + +For more information about this error, try `rustc --explain E0412`. diff --git a/src/test/ui/libstd-case-typo/ptr.rs b/src/test/ui/libstd-case-typo/ptr.rs new file mode 100644 index 0000000000000..5febbbf78db40 --- /dev/null +++ b/src/test/ui/libstd-case-typo/ptr.rs @@ -0,0 +1,5 @@ +// checks case typos with libstd::ptr structs +fn main(){} + +fn test_nonnull(_x: Nonnull<()>){} +//~^ ERROR: cannot find type `Nonnull` in this scope diff --git a/src/test/ui/libstd-case-typo/ptr.stderr b/src/test/ui/libstd-case-typo/ptr.stderr new file mode 100644 index 0000000000000..78f33496d4fa2 --- /dev/null +++ b/src/test/ui/libstd-case-typo/ptr.stderr @@ -0,0 +1,12 @@ +error[E0412]: cannot find type `Nonnull` in this scope + --> $DIR/ptr.rs:4:21 + | +LL | fn test_nonnull(_x: Nonnull<()>){} + | ^^^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::ptr::NonNull` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0412`. diff --git a/src/test/ui/libstd-case-typo/rc.rs b/src/test/ui/libstd-case-typo/rc.rs new file mode 100644 index 0000000000000..7af5d842a0263 --- /dev/null +++ b/src/test/ui/libstd-case-typo/rc.rs @@ -0,0 +1,7 @@ +// checks case typos with libstd::rc structs +fn main(){} + +fn test_rc(_x: rc<()>){} +//~^ ERROR: cannot find type `rc` in this scope +fn test_weak(_x: weak<()>){} +//~^ ERROR: cannot find type `weak` in this scope diff --git a/src/test/ui/libstd-case-typo/rc.stderr b/src/test/ui/libstd-case-typo/rc.stderr new file mode 100644 index 0000000000000..f6f702955da87 --- /dev/null +++ b/src/test/ui/libstd-case-typo/rc.stderr @@ -0,0 +1,25 @@ +error[E0412]: cannot find type `rc` in this scope + --> $DIR/rc.rs:4:16 + | +LL | fn test_rc(_x: rc<()>){} + | ^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::rc::Rc` + +error[E0412]: cannot find type `weak` in this scope + --> $DIR/rc.rs:6:18 + | +LL | fn test_weak(_x: weak<()>){} + | ^^^^ not found in this scope + | +help: found std structs with similar names: + | +LL | fn test_weak(_x: std::rc::Weak<()>){} + | ^^^^^^^^^^^^^ +LL | fn test_weak(_x: std::sync::Weak<()>){} + | ^^^^^^^^^^^^^^^ + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0412`. diff --git a/src/test/ui/libstd-case-typo/str.rs b/src/test/ui/libstd-case-typo/str.rs new file mode 100644 index 0000000000000..137d58415ed3a --- /dev/null +++ b/src/test/ui/libstd-case-typo/str.rs @@ -0,0 +1,39 @@ +// checks case typos with libstd::str structs +fn main(){} + +fn test_bytes(_x: bytes){} +//~^ ERROR: cannot find type `bytes` in this scope +fn test_charind(_x: Charindices){} +//~^ ERROR: cannot find type `Charindices` in this scope +fn test_chars(_x: chars){} +//~^ ERROR: cannot find type `chars` in this scope +fn test_encutf16(_x: EncodeUTF16){} +//~^ ERROR: cannot find type `EncodeUTF16` in this scope +fn test_escdflt(_x: Escapedefault){} +//~^ ERROR: cannot find type `Escapedefault` in this scope +fn test_escuni(_x: Escapeunicode){} +//~^ ERROR: cannot find type `Escapeunicode` in this scope +fn test_lines(_x: lines){} +//~^ ERROR: cannot find type `lines` in this scope +fn test_matchind(_x: Matchindices){} +//~^ ERROR: cannot find type `Matchindices` in this scope +fn test_rmatchind(_x: RmatchIndices){} +//~^ ERROR: cannot find type `RmatchIndices` in this scope +fn test_rmatch(_x: Rmatches){} +//~^ ERROR: cannot find type `Rmatches` in this scope +fn test_rsplit(_x: Rsplit){} +//~^ ERROR: cannot find type `Rsplit` in this scope +fn test_rsplitn(_x: RSplitn){} +//~^ ERROR: cannot find type `RSplitn` in this scope +fn test_rsplitterm(_x: RsplitTerminator){} +//~^ ERROR: cannot find type `RsplitTerminator` in this scope +fn test_split(_x: split){} +//~^ ERROR: cannot find type `split` in this scope +fn test_splitasciiws(_x: SplitASCIIWhitespace){} +//~^ ERROR: cannot find type `SplitASCIIWhitespace` in this scope +fn test_splitn(_x: Splitn){} +//~^ ERROR: cannot find type `Splitn` in this scope +fn test_splitterm(_x: Splitterminator){} +//~^ ERROR: cannot find type `Splitterminator` in this scope +fn test_splitws(_x: Splitwhitespace){} +//~^ ERROR: cannot find type `Splitwhitespace` in this scope diff --git a/src/test/ui/libstd-case-typo/str.stderr b/src/test/ui/libstd-case-typo/str.stderr new file mode 100644 index 0000000000000..4d88fe6a8b657 --- /dev/null +++ b/src/test/ui/libstd-case-typo/str.stderr @@ -0,0 +1,184 @@ +error[E0412]: cannot find type `bytes` in this scope + --> $DIR/str.rs:4:19 + | +LL | fn test_bytes(_x: bytes){} + | ^^^^^ not found in this scope + | +help: found std structs with similar names: + | +LL | fn test_bytes(_x: std::io::Bytes){} + | ^^^^^^^^^^^^^^ +LL | fn test_bytes(_x: std::str::Bytes){} + | ^^^^^^^^^^^^^^^ + +error[E0412]: cannot find type `Charindices` in this scope + --> $DIR/str.rs:6:21 + | +LL | fn test_charind(_x: Charindices){} + | ^^^^^^^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::str::CharIndices` + +error[E0412]: cannot find type `chars` in this scope + --> $DIR/str.rs:8:19 + | +LL | fn test_chars(_x: chars){} + | ^^^^^ help: a builtin type with a similar name exists: `char` + +error[E0412]: cannot find type `EncodeUTF16` in this scope + --> $DIR/str.rs:10:22 + | +LL | fn test_encutf16(_x: EncodeUTF16){} + | ^^^^^^^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::str::EncodeUtf16` + +error[E0412]: cannot find type `Escapedefault` in this scope + --> $DIR/str.rs:12:21 + | +LL | fn test_escdflt(_x: Escapedefault){} + | ^^^^^^^^^^^^^ not found in this scope + | +help: found std structs with similar names: + | +LL | fn test_escdflt(_x: std::ascii::EscapeDefault){} + | ^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | fn test_escdflt(_x: std::char::EscapeDefault){} + | ^^^^^^^^^^^^^^^^^^^^^^^^ +LL | fn test_escdflt(_x: std::str::EscapeDefault){} + | ^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0412]: cannot find type `Escapeunicode` in this scope + --> $DIR/str.rs:14:20 + | +LL | fn test_escuni(_x: Escapeunicode){} + | ^^^^^^^^^^^^^ not found in this scope + | +help: found std structs with similar names: + | +LL | fn test_escuni(_x: std::char::EscapeUnicode){} + | ^^^^^^^^^^^^^^^^^^^^^^^^ +LL | fn test_escuni(_x: std::str::EscapeUnicode){} + | ^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0412]: cannot find type `lines` in this scope + --> $DIR/str.rs:16:19 + | +LL | fn test_lines(_x: lines){} + | ^^^^^ not found in this scope + | +help: found std structs with similar names: + | +LL | fn test_lines(_x: std::io::Lines){} + | ^^^^^^^^^^^^^^ +LL | fn test_lines(_x: std::str::Lines){} + | ^^^^^^^^^^^^^^^ + +error[E0412]: cannot find type `Matchindices` in this scope + --> $DIR/str.rs:18:22 + | +LL | fn test_matchind(_x: Matchindices){} + | ^^^^^^^^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::str::MatchIndices` + +error[E0412]: cannot find type `RmatchIndices` in this scope + --> $DIR/str.rs:20:23 + | +LL | fn test_rmatchind(_x: RmatchIndices){} + | ^^^^^^^^^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::str::RMatchIndices` + +error[E0412]: cannot find type `Rmatches` in this scope + --> $DIR/str.rs:22:20 + | +LL | fn test_rmatch(_x: Rmatches){} + | ^^^^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::str::RMatches` + +error[E0412]: cannot find type `Rsplit` in this scope + --> $DIR/str.rs:24:20 + | +LL | fn test_rsplit(_x: Rsplit){} + | ^^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::str::RSplit` + +error[E0412]: cannot find type `RSplitn` in this scope + --> $DIR/str.rs:26:21 + | +LL | fn test_rsplitn(_x: RSplitn){} + | ^^^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::str::RSplitN` + +error[E0412]: cannot find type `RsplitTerminator` in this scope + --> $DIR/str.rs:28:24 + | +LL | fn test_rsplitterm(_x: RsplitTerminator){} + | ^^^^^^^^^^^^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::str::RSplitTerminator` + +error[E0412]: cannot find type `split` in this scope + --> $DIR/str.rs:30:19 + | +LL | fn test_split(_x: split){} + | ^^^^^ not found in this scope + | +help: found std structs with similar names: + | +LL | fn test_split(_x: std::io::Split){} + | ^^^^^^^^^^^^^^ +LL | fn test_split(_x: std::str::Split){} + | ^^^^^^^^^^^^^^^ + +error[E0412]: cannot find type `SplitASCIIWhitespace` in this scope + --> $DIR/str.rs:32:26 + | +LL | fn test_splitasciiws(_x: SplitASCIIWhitespace){} + | ^^^^^^^^^^^^^^^^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::str::SplitAsciiWhitespace` + +error[E0412]: cannot find type `Splitn` in this scope + --> $DIR/str.rs:34:20 + | +LL | fn test_splitn(_x: Splitn){} + | ^^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::str::SplitN` + +error[E0412]: cannot find type `Splitterminator` in this scope + --> $DIR/str.rs:36:23 + | +LL | fn test_splitterm(_x: Splitterminator){} + | ^^^^^^^^^^^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::str::SplitTerminator` + +error[E0412]: cannot find type `Splitwhitespace` in this scope + --> $DIR/str.rs:38:21 + | +LL | fn test_splitws(_x: Splitwhitespace){} + | ^^^^^^^^^^^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::str::SplitWhitespace` + +error: aborting due to 18 previous errors + +For more information about this error, try `rustc --explain E0412`. diff --git a/src/test/ui/libstd-case-typo/string.rs b/src/test/ui/libstd-case-typo/string.rs new file mode 100644 index 0000000000000..497455fafb8b3 --- /dev/null +++ b/src/test/ui/libstd-case-typo/string.rs @@ -0,0 +1,5 @@ +// checks case typos with libstd::string structs +fn main(){} + +fn test_drain(_x: drain){} +//~^ ERROR: cannot find type `drain` in this scope diff --git a/src/test/ui/libstd-case-typo/string.stderr b/src/test/ui/libstd-case-typo/string.stderr new file mode 100644 index 0000000000000..3d47a635581de --- /dev/null +++ b/src/test/ui/libstd-case-typo/string.stderr @@ -0,0 +1,12 @@ +error[E0412]: cannot find type `drain` in this scope + --> $DIR/string.rs:4:19 + | +LL | fn test_drain(_x: drain){} + | ^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::string::Drain` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0412`. diff --git a/src/test/ui/libstd-case-typo/sync.rs b/src/test/ui/libstd-case-typo/sync.rs new file mode 100644 index 0000000000000..15946c201b20a --- /dev/null +++ b/src/test/ui/libstd-case-typo/sync.rs @@ -0,0 +1,27 @@ +// checks case typos with libstd::sync structs +fn main(){} + +fn test_arc(_x: arc<()>){} +//~^ ERROR: cannot find type `arc` in this scope +fn test_barrier(_x: barrier<()>){} +//~^ ERROR: cannot find type `barrier` in this scope +fn test_bwr(_x: BarrierwaitResult<()>){} +//~^ ERROR: cannot find type `BarrierwaitResult` in this scope +fn test_cvar(_x: CondVar<()>){} +//~^ ERROR: cannot find type `CondVar` in this scope +fn test_mutex(_x: mutex<()>){} +//~^ ERROR: cannot find type `mutex` in this scope +fn test_mutexguard(_x: Mutexguard<()>){} +//~^ ERROR: cannot find type `Mutexguard` in this scope +fn test_once(_x: once<()>){} +//~^ ERROR: cannot find type `once` in this scope +fn test_rwl(_x: RWlock<()>){} +//~^ ERROR: cannot find type `RWlock` in this scope +fn test_rwlrg(_x: RWlockReadGuard<()>){} +//~^ ERROR: cannot find type `RWlockReadGuard` in this scope +fn test_rwlwg(_x: RWlockWriteGuard<()>){} +//~^ ERROR: cannot find type `RWlockWriteGuard` in this scope +fn test_wtr(_x: WaittimeoutResult<()>){} +//~^ ERROR: cannot find type `WaittimeoutResult` in this scope +fn test_weak(_x: weak<()>){} +//~^ ERROR: cannot find type `weak` in this scope diff --git a/src/test/ui/libstd-case-typo/sync.stderr b/src/test/ui/libstd-case-typo/sync.stderr new file mode 100644 index 0000000000000..821a59235e719 --- /dev/null +++ b/src/test/ui/libstd-case-typo/sync.stderr @@ -0,0 +1,119 @@ +error[E0412]: cannot find type `arc` in this scope + --> $DIR/sync.rs:4:17 + | +LL | fn test_arc(_x: arc<()>){} + | ^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::sync::Arc` + +error[E0412]: cannot find type `barrier` in this scope + --> $DIR/sync.rs:6:21 + | +LL | fn test_barrier(_x: barrier<()>){} + | ^^^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::sync::Barrier` + +error[E0412]: cannot find type `BarrierwaitResult` in this scope + --> $DIR/sync.rs:8:17 + | +LL | fn test_bwr(_x: BarrierwaitResult<()>){} + | ^^^^^^^^^^^^^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::sync::BarrierWaitResult` + +error[E0412]: cannot find type `CondVar` in this scope + --> $DIR/sync.rs:10:18 + | +LL | fn test_cvar(_x: CondVar<()>){} + | ^^^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::sync::Condvar` + +error[E0412]: cannot find type `mutex` in this scope + --> $DIR/sync.rs:12:19 + | +LL | fn test_mutex(_x: mutex<()>){} + | ^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::sync::Mutex` + +error[E0412]: cannot find type `Mutexguard` in this scope + --> $DIR/sync.rs:14:24 + | +LL | fn test_mutexguard(_x: Mutexguard<()>){} + | ^^^^^^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::sync::MutexGuard` + +error[E0412]: cannot find type `once` in this scope + --> $DIR/sync.rs:16:18 + | +LL | fn test_once(_x: once<()>){} + | ^^^^ not found in this scope + | +help: found std structs with similar names: + | +LL | fn test_once(_x: std::iter::Once<()>){} + | ^^^^^^^^^^^^^^^ +LL | fn test_once(_x: std::sync::Once<()>){} + | ^^^^^^^^^^^^^^^ + +error[E0412]: cannot find type `RWlock` in this scope + --> $DIR/sync.rs:18:17 + | +LL | fn test_rwl(_x: RWlock<()>){} + | ^^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::sync::RwLock` + +error[E0412]: cannot find type `RWlockReadGuard` in this scope + --> $DIR/sync.rs:20:19 + | +LL | fn test_rwlrg(_x: RWlockReadGuard<()>){} + | ^^^^^^^^^^^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::sync::RwLockReadGuard` + +error[E0412]: cannot find type `RWlockWriteGuard` in this scope + --> $DIR/sync.rs:22:19 + | +LL | fn test_rwlwg(_x: RWlockWriteGuard<()>){} + | ^^^^^^^^^^^^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::sync::RwLockWriteGuard` + +error[E0412]: cannot find type `WaittimeoutResult` in this scope + --> $DIR/sync.rs:24:17 + | +LL | fn test_wtr(_x: WaittimeoutResult<()>){} + | ^^^^^^^^^^^^^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::sync::WaitTimeoutResult` + +error[E0412]: cannot find type `weak` in this scope + --> $DIR/sync.rs:26:18 + | +LL | fn test_weak(_x: weak<()>){} + | ^^^^ not found in this scope + | +help: found std structs with similar names: + | +LL | fn test_weak(_x: std::rc::Weak<()>){} + | ^^^^^^^^^^^^^ +LL | fn test_weak(_x: std::sync::Weak<()>){} + | ^^^^^^^^^^^^^^^ + +error: aborting due to 12 previous errors + +For more information about this error, try `rustc --explain E0412`. diff --git a/src/test/ui/libstd-case-typo/task.rs b/src/test/ui/libstd-case-typo/task.rs new file mode 100644 index 0000000000000..81bcf1539c3b8 --- /dev/null +++ b/src/test/ui/libstd-case-typo/task.rs @@ -0,0 +1,11 @@ +// checks case typos with libstd::task structs +fn main(){} + +fn test_context(_x: context){} +//~^ ERROR: cannot find type `context` in this scope +fn test_rwake(_x: Rawwaker){} +//~^ ERROR: cannot find type `Rawwaker` in this scope +fn test_rwakevt(_x: RawwakerVTable){} +//~^ ERROR: cannot find type `RawwakerVTable` in this scope +fn test_waker(_x: waker){} +//~^ ERROR: cannot find type `waker` in this scope diff --git a/src/test/ui/libstd-case-typo/task.stderr b/src/test/ui/libstd-case-typo/task.stderr new file mode 100644 index 0000000000000..a30167f93c1de --- /dev/null +++ b/src/test/ui/libstd-case-typo/task.stderr @@ -0,0 +1,39 @@ +error[E0412]: cannot find type `context` in this scope + --> $DIR/task.rs:4:21 + | +LL | fn test_context(_x: context){} + | ^^^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::task::Context` + +error[E0412]: cannot find type `Rawwaker` in this scope + --> $DIR/task.rs:6:19 + | +LL | fn test_rwake(_x: Rawwaker){} + | ^^^^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::task::RawWaker` + +error[E0412]: cannot find type `RawwakerVTable` in this scope + --> $DIR/task.rs:8:21 + | +LL | fn test_rwakevt(_x: RawwakerVTable){} + | ^^^^^^^^^^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::task::RawWakerVTable` + +error[E0412]: cannot find type `waker` in this scope + --> $DIR/task.rs:10:19 + | +LL | fn test_waker(_x: waker){} + | ^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::task::Waker` + +error: aborting due to 4 previous errors + +For more information about this error, try `rustc --explain E0412`. diff --git a/src/test/ui/libstd-case-typo/thread.rs b/src/test/ui/libstd-case-typo/thread.rs new file mode 100644 index 0000000000000..3a56ec74feaca --- /dev/null +++ b/src/test/ui/libstd-case-typo/thread.rs @@ -0,0 +1,13 @@ +// checks case typos with libstd::thread structs +fn main(){} + +fn test_build(_x: builder){} +//~^ ERROR: cannot find type `builder` in this scope +fn test_jhand(_x: Joinhandle<()>){} +//~^ ERROR: cannot find type `Joinhandle` in this scope +fn test_lkey(_x: Localkey<()>){} +//~^ ERROR: cannot find type `Localkey` in this scope +fn test_thread(_x: thread){} +//~^ ERROR: cannot find type `thread` in this scope +fn test_threadid(_x: ThreadID){} +//~^ ERROR: cannot find type `ThreadID` in this scope diff --git a/src/test/ui/libstd-case-typo/thread.stderr b/src/test/ui/libstd-case-typo/thread.stderr new file mode 100644 index 0000000000000..ffefee13fcabe --- /dev/null +++ b/src/test/ui/libstd-case-typo/thread.stderr @@ -0,0 +1,48 @@ +error[E0412]: cannot find type `builder` in this scope + --> $DIR/thread.rs:4:19 + | +LL | fn test_build(_x: builder){} + | ^^^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::thread::Builder` + +error[E0412]: cannot find type `Joinhandle` in this scope + --> $DIR/thread.rs:6:19 + | +LL | fn test_jhand(_x: Joinhandle<()>){} + | ^^^^^^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::thread::JoinHandle` + +error[E0412]: cannot find type `Localkey` in this scope + --> $DIR/thread.rs:8:18 + | +LL | fn test_lkey(_x: Localkey<()>){} + | ^^^^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::thread::LocalKey` + +error[E0412]: cannot find type `thread` in this scope + --> $DIR/thread.rs:10:20 + | +LL | fn test_thread(_x: thread){} + | ^^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::thread::Thread` + +error[E0412]: cannot find type `ThreadID` in this scope + --> $DIR/thread.rs:12:22 + | +LL | fn test_threadid(_x: ThreadID){} + | ^^^^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::thread::ThreadId` + +error: aborting due to 5 previous errors + +For more information about this error, try `rustc --explain E0412`. diff --git a/src/test/ui/libstd-case-typo/time.rs b/src/test/ui/libstd-case-typo/time.rs new file mode 100644 index 0000000000000..561943d8c15df --- /dev/null +++ b/src/test/ui/libstd-case-typo/time.rs @@ -0,0 +1,9 @@ +// checks case typos with libstd::time structs +fn main(){} + +fn test_dur(_x: duration){} +//~^ ERROR: cannot find type `duration` in this scope +fn test_ins(_x: instant){} +//~^ ERROR: cannot find type `instant` in this scope +fn test_systime(_x: Systemtime){} +//~^ ERROR: cannot find type `Systemtime` in this scope diff --git a/src/test/ui/libstd-case-typo/time.stderr b/src/test/ui/libstd-case-typo/time.stderr new file mode 100644 index 0000000000000..5f061a212ba7b --- /dev/null +++ b/src/test/ui/libstd-case-typo/time.stderr @@ -0,0 +1,30 @@ +error[E0412]: cannot find type `duration` in this scope + --> $DIR/time.rs:4:17 + | +LL | fn test_dur(_x: duration){} + | ^^^^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::time::Duration` + +error[E0412]: cannot find type `instant` in this scope + --> $DIR/time.rs:6:17 + | +LL | fn test_ins(_x: instant){} + | ^^^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::time::Instant` + +error[E0412]: cannot find type `Systemtime` in this scope + --> $DIR/time.rs:8:21 + | +LL | fn test_systime(_x: Systemtime){} + | ^^^^^^^^^^ + | | + | not found in this scope + | help: found a std struct with a similar name: `std::time::SystemTime` + +error: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0412`.