diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ea9f2c1943005..21b14d011f911 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -405,7 +405,8 @@ before the PR is merged. [breaking-tools-built-with-the-compiler]: #breaking-tools-built-with-the-compiler Rust's build system builds a number of tools that make use of the -internals of the compiler. This includes clippy, +internals of the compiler. This includes +[Clippy](/~https://github.com/rust-lang-nursery/rust-clippy), [RLS](/~https://github.com/rust-lang-nursery/rls) and [rustfmt](/~https://github.com/rust-lang-nursery/rustfmt). If these tools break because of your changes, you may run into a sort of "chicken and egg" diff --git a/src/bootstrap/bin/rustdoc.rs b/src/bootstrap/bin/rustdoc.rs index a54e58665cceb..bb5a21e3e405f 100644 --- a/src/bootstrap/bin/rustdoc.rs +++ b/src/bootstrap/bin/rustdoc.rs @@ -37,6 +37,8 @@ fn main() { let mut dylib_path = bootstrap::util::dylib_path(); dylib_path.insert(0, PathBuf::from(libdir.clone())); + //FIXME(misdreavus): once stdsimd uses cfg(rustdoc) instead of cfg(dox), remove the `--cfg dox` + //arguments here let mut cmd = Command::new(rustdoc); cmd.args(&args) .arg("--cfg") diff --git a/src/doc/rustdoc/src/unstable-features.md b/src/doc/rustdoc/src/unstable-features.md index a23dbd308244f..32fb8c2f7d58e 100644 --- a/src/doc/rustdoc/src/unstable-features.md +++ b/src/doc/rustdoc/src/unstable-features.md @@ -106,27 +106,25 @@ The `#[doc(cfg(...))]` attribute has another effect: When Rustdoc renders docume item, it will be accompanied by a banner explaining that the item is only available on certain platforms. -As mentioned earlier, getting the items to Rustdoc requires some extra preparation. The standard -library adds a `--cfg dox` flag to every Rustdoc command, but the same thing can be accomplished by -adding a feature to your Cargo.toml and adding `--feature dox` (or whatever you choose to name the -feature) to your `cargo doc` calls. +For Rustdoc to document an item, it needs to see it, regardless of what platform it's currently +running on. To aid this, Rustdoc sets the flag `#[cfg(rustdoc)]` when running on your crate. +Combining this with the target platform of a given item allows it to appear when building your crate +normally on that platform, as well as when building documentation anywhere. -Either way, once you create an environment for the documentation, you can start to augment your -`#[cfg]` attributes to allow both the target platform *and* the documentation configuration to leave -the item in. For example, `#[cfg(any(windows, feature = "dox"))]` will preserve the item either on -Windows or during the documentation process. Then, adding a new attribute `#[doc(cfg(windows))]` -will tell Rustdoc that the item is supposed to be used on Windows. For example: +For example, `#[cfg(any(windows, rustdoc))]` will preserve the item either on Windows or during the +documentation process. Then, adding a new attribute `#[doc(cfg(windows))]` will tell Rustdoc that +the item is supposed to be used on Windows. For example: ```rust #![feature(doc_cfg)] /// Token struct that can only be used on Windows. -#[cfg(any(windows, feature = "dox"))] +#[cfg(any(windows, rustdoc))] #[doc(cfg(windows))] pub struct WindowsToken; /// Token struct that can only be used on Unix. -#[cfg(any(unix, feature = "dox"))] +#[cfg(any(unix, rustdoc))] #[doc(cfg(unix))] pub struct UnixToken; ``` diff --git a/src/doc/unstable-book/src/language-features/doc-cfg.md b/src/doc/unstable-book/src/language-features/doc-cfg.md index ddc538e12144a..96c66a1515ed5 100644 --- a/src/doc/unstable-book/src/language-features/doc-cfg.md +++ b/src/doc/unstable-book/src/language-features/doc-cfg.md @@ -12,13 +12,17 @@ This attribute has two effects: 2. The item's doc-tests will only run on the specific platform. +In addition to allowing the use of the `#[doc(cfg)]` attribute, this feature enables the use of a +special conditional compilation flag, `#[cfg(rustdoc)]`, set whenever building documentation on your +crate. + This feature was introduced as part of PR [#43348] to allow the platform-specific parts of the standard library be documented. ```rust #![feature(doc_cfg)] -#[cfg(any(windows, feature = "documentation"))] +#[cfg(any(windows, rustdoc))] #[doc(cfg(windows))] /// The application's icon in the notification area (a.k.a. system tray). /// @@ -39,4 +43,4 @@ pub struct Icon { ``` [#43781]: /~https://github.com/rust-lang/rust/issues/43781 -[#43348]: /~https://github.com/rust-lang/rust/issues/43348 \ No newline at end of file +[#43348]: /~https://github.com/rust-lang/rust/issues/43348 diff --git a/src/etc/rust-gdbgui b/src/etc/rust-gdbgui new file mode 100755 index 0000000000000..7e179ba927dff --- /dev/null +++ b/src/etc/rust-gdbgui @@ -0,0 +1,65 @@ +#!/bin/sh +# Copyright 2014 The Rust Project Developers. See the COPYRIGHT +# file at the top-level directory of this distribution and at +# http://rust-lang.org/COPYRIGHT. +# +# Licensed under the Apache License, Version 2.0 or the MIT license +# , at your +# option. This file may not be copied, modified, or distributed +# except according to those terms. + +# Exit if anything fails +set -e + +if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ] || [ "$1" = "--help" ]; then + echo " +rust-gdbgui +=========== +gdbgui - https://gdbgui.com - is a graphical front-end to GDB +that runs in a browser. This script invokes gdbgui with the Rust +pretty printers loaded. + +Simple usage : rust-gdbgui target/debug/myprog +With arguments: rust-gdbgui 'target/debug/myprog arg1 arg2...' + (note the quotes) + + +Hints +===== +gdbgui won't be able to find the rust 'main' method automatically, so +in its options make sure to disable the 'Add breakpoint to main after +loading executable' setting to avoid a 'File not found: main' warning +on startup. + +Instead, type 'main' into gdbgui's file browser and you should get +auto-completion on the filename. Just pick 'main.rs', add a breakpoint +by clicking in the line number gutter, and type 'r' or hit the Restart +icon to start your program running. +" + exit 0 +fi + +# Find out where the pretty printer Python module is +RUSTC_SYSROOT=`rustc --print=sysroot` +GDB_PYTHON_MODULE_DIRECTORY="$RUSTC_SYSROOT/lib/rustlib/etc" + +# Set the environment variable `RUST_GDB` to overwrite the call to a +# different/specific command (defaults to `gdb`). +RUST_GDB="${RUST_GDB:-gdb}" + +# Set the environment variable `RUST_GDBGUI` to overwrite the call to a +# different/specific command (defaults to `gdbgui`). +RUST_GDBGUI="${RUST_GDBGUI:-gdbgui}" + +# These arguments get passed through to GDB and make it load the +# Rust pretty printers. +GDB_ARGS="--directory=\"$GDB_PYTHON_MODULE_DIRECTORY\" -iex \"add-auto-load-safe-path $GDB_PYTHON_MODULE_DIRECTORY\"" + +# Finally we execute gdbgui. +PYTHONPATH="$PYTHONPATH:$GDB_PYTHON_MODULE_DIRECTORY" \ + exec ${RUST_GDBGUI} \ + --gdb ${RUST_GDB} \ + --gdb-args "${GDB_ARGS}" \ + "${@}" + diff --git a/src/liballoc/sync.rs b/src/liballoc/sync.rs index 2cd7898f4c781..db7a4044b267f 100644 --- a/src/liballoc/sync.rs +++ b/src/liballoc/sync.rs @@ -49,9 +49,10 @@ const MAX_REFCOUNT: usize = (isize::MAX) as usize; /// /// The type `Arc` provides shared ownership of a value of type `T`, /// allocated in the heap. Invoking [`clone`][clone] on `Arc` produces -/// a new pointer to the same value in the heap. When the last `Arc` -/// pointer to a given value is destroyed, the pointed-to value is -/// also destroyed. +/// a new `Arc` instance, which points to the same value on the heap as the +/// source `Arc`, while increasing a reference count. When the last `Arc` +/// pointer to a given value is destroyed, the pointed-to value is also +/// destroyed. /// /// Shared references in Rust disallow mutation by default, and `Arc` is no /// exception: you cannot generally obtain a mutable reference to something @@ -107,7 +108,7 @@ const MAX_REFCOUNT: usize = (isize::MAX) as usize; /// // The two syntaxes below are equivalent. /// let a = foo.clone(); /// let b = Arc::clone(&foo); -/// // a and b both point to the same memory location as foo. +/// // a, b, and foo are all Arcs that point to the same memory location /// ``` /// /// The [`Arc::clone(&from)`] syntax is the most idiomatic because it conveys more explicitly diff --git a/src/libcore/benches/any.rs b/src/libcore/benches/any.rs index 67e02cf9509b6..f4f01eb1cf5d2 100644 --- a/src/libcore/benches/any.rs +++ b/src/libcore/benches/any.rs @@ -15,7 +15,7 @@ use test::{Bencher, black_box}; fn bench_downcast_ref(b: &mut Bencher) { b.iter(|| { let mut x = 0; - let mut y = &mut x as &mut Any; + let mut y = &mut x as &mut dyn Any; black_box(&mut y); black_box(y.downcast_ref::() == Some(&0)); }); diff --git a/src/libcore/macros.rs b/src/libcore/macros.rs index 5b3b2d1635688..0032bedc7ed1d 100644 --- a/src/libcore/macros.rs +++ b/src/libcore/macros.rs @@ -541,7 +541,7 @@ macro_rules! unimplemented { /// into libsyntax itself. /// /// For more information, see documentation for `std`'s macros. -#[cfg(dox)] +#[cfg(rustdoc)] mod builtin { /// Unconditionally causes compilation to fail with the given error message when encountered. diff --git a/src/librustc/dep_graph/dep_node.rs b/src/librustc/dep_graph/dep_node.rs index 90081d5b85ef9..dfe0a395ca140 100644 --- a/src/librustc/dep_graph/dep_node.rs +++ b/src/librustc/dep_graph/dep_node.rs @@ -75,7 +75,7 @@ use traits::query::{ CanonicalPredicateGoal, CanonicalTypeOpProvePredicateGoal, CanonicalTypeOpNormalizeGoal, }; use ty::{TyCtxt, FnSig, Instance, InstanceDef, - ParamEnv, ParamEnvAnd, Predicate, PolyFnSig, PolyTraitRef, Ty, self}; + ParamEnv, ParamEnvAnd, Predicate, PolyFnSig, PolyTraitRef, Ty}; use ty::subst::Substs; // erase!() just makes tokens go away. It's used to specify which macro argument @@ -632,7 +632,6 @@ define_dep_nodes!( <'tcx> // queries). Making them anonymous avoids hashing the result, which // may save a bit of time. [anon] EraseRegionsTy { ty: Ty<'tcx> }, - [anon] ConstToAllocation { val: &'tcx ty::Const<'tcx> }, [input] Freevars(DefId), [input] MaybeUnusedTraitImport(DefId), diff --git a/src/librustc/ty/query/config.rs b/src/librustc/ty/query/config.rs index b5093d0a1fc95..d32580181f8dc 100644 --- a/src/librustc/ty/query/config.rs +++ b/src/librustc/ty/query/config.rs @@ -198,12 +198,6 @@ impl<'tcx> QueryDescription<'tcx> for queries::super_predicates_of<'tcx> { } } -impl<'tcx> QueryDescription<'tcx> for queries::const_to_allocation<'tcx> { - fn describe(_tcx: TyCtxt, val: &'tcx ty::Const<'tcx>) -> String { - format!("converting constant `{:?}` to an allocation", val) - } -} - impl<'tcx> QueryDescription<'tcx> for queries::erase_regions_ty<'tcx> { fn describe(_tcx: TyCtxt, ty: Ty<'tcx>) -> String { format!("erasing regions from `{:?}`", ty) diff --git a/src/librustc/ty/query/mod.rs b/src/librustc/ty/query/mod.rs index 6f61583e49b8e..88f599971c7da 100644 --- a/src/librustc/ty/query/mod.rs +++ b/src/librustc/ty/query/mod.rs @@ -30,7 +30,7 @@ use middle::exported_symbols::{SymbolExportLevel, ExportedSymbol}; use mir::interpret::ConstEvalResult; use mir::mono::{CodegenUnit, Stats}; use mir; -use mir::interpret::{GlobalId, Allocation}; +use mir::interpret::GlobalId; use session::{CompileResult, CrateDisambiguator}; use session::config::OutputFilenames; use traits::{self, Vtable}; @@ -286,11 +286,6 @@ define_queries! { <'tcx> /// other items (such as enum variant explicit discriminants). [] fn const_eval: const_eval_dep_node(ty::ParamEnvAnd<'tcx, GlobalId<'tcx>>) -> ConstEvalResult<'tcx>, - - /// Converts a constant value to a constant allocation - [] fn const_to_allocation: const_to_allocation( - &'tcx ty::Const<'tcx> - ) -> &'tcx Allocation, }, TypeChecking { @@ -706,12 +701,6 @@ fn erase_regions_ty<'tcx>(ty: Ty<'tcx>) -> DepConstructor<'tcx> { DepConstructor::EraseRegionsTy { ty } } -fn const_to_allocation<'tcx>( - val: &'tcx ty::Const<'tcx>, -) -> DepConstructor<'tcx> { - DepConstructor::ConstToAllocation { val } -} - fn type_param_predicates<'tcx>((item_id, param_id): (DefId, DefId)) -> DepConstructor<'tcx> { DepConstructor::TypeParamPredicates { item_id, diff --git a/src/librustc/ty/query/plumbing.rs b/src/librustc/ty/query/plumbing.rs index 0edb1aa79e745..215fba54499b7 100644 --- a/src/librustc/ty/query/plumbing.rs +++ b/src/librustc/ty/query/plumbing.rs @@ -1062,7 +1062,6 @@ pub fn force_from_dep_node<'a, 'gcx, 'lcx>(tcx: TyCtxt<'a, 'gcx, 'lcx>, DepKind::FulfillObligation | DepKind::VtableMethods | DepKind::EraseRegionsTy | - DepKind::ConstToAllocation | DepKind::NormalizeProjectionTy | DepKind::NormalizeTyAfterErasingRegions | DepKind::ImpliedOutlivesBounds | diff --git a/src/librustc_mir/interpret/memory.rs b/src/librustc_mir/interpret/memory.rs index 91fc6453446a8..59bebbb87a775 100644 --- a/src/librustc_mir/interpret/memory.rs +++ b/src/librustc_mir/interpret/memory.rs @@ -22,7 +22,7 @@ use std::ptr; use rustc::ty::{self, Instance, query::TyCtxtAt}; use rustc::ty::layout::{self, Align, TargetDataLayout, Size, HasDataLayout}; -use rustc::mir::interpret::{Pointer, AllocId, Allocation, ScalarMaybeUndef, GlobalId, +use rustc::mir::interpret::{Pointer, AllocId, Allocation, ConstValue, ScalarMaybeUndef, GlobalId, EvalResult, Scalar, EvalErrorKind, AllocType, PointerArithmetic, truncate}; pub use rustc::mir::interpret::{write_target_uint, read_target_uint}; @@ -340,9 +340,12 @@ impl<'a, 'mir, 'tcx, M: Machine<'mir, 'tcx>> Memory<'a, 'mir, 'tcx, M> { // no need to report anything, the const_eval call takes care of that for statics assert!(tcx.is_static(def_id).is_some()); EvalErrorKind::ReferencedConstant(err).into() - }).map(|val| { - // FIXME We got our static (will be a ByRef), now we make a *copy*?!? - tcx.const_to_allocation(val) + }).map(|const_val| { + if let ConstValue::ByRef(_, allocation, _) = const_val.val { + allocation + } else { + bug!("Matching on non-ByRef static") + } }) } diff --git a/src/librustc_mir/lib.rs b/src/librustc_mir/lib.rs index 6f087221b8024..a55f0496c2dee 100644 --- a/src/librustc_mir/lib.rs +++ b/src/librustc_mir/lib.rs @@ -92,7 +92,6 @@ pub fn provide(providers: &mut Providers) { shim::provide(providers); transform::provide(providers); providers.const_eval = interpret::const_eval_provider; - providers.const_to_allocation = interpret::const_to_allocation_provider; providers.check_match = hair::pattern::check_match; } diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs index bbb45c04e4e98..7a13d8bdd4bac 100644 --- a/src/librustc_typeck/check/mod.rs +++ b/src/librustc_typeck/check/mod.rs @@ -94,7 +94,7 @@ use rustc::infer::{self, InferCtxt, InferOk, RegionVariableOrigin}; use rustc::infer::anon_types::AnonTypeDecl; use rustc::infer::type_variable::{TypeVariableOrigin}; use rustc::middle::region; -use rustc::mir::interpret::{GlobalId}; +use rustc::mir::interpret::{ConstValue, GlobalId}; use rustc::ty::subst::{CanonicalSubsts, UnpackedKind, Subst, Substs}; use rustc::traits::{self, ObligationCause, ObligationCauseCode, TraitEngine}; use rustc::ty::{self, Ty, TyCtxt, GenericParamDefKind, Visibility, ToPredicate, RegionKind}; @@ -1375,7 +1375,11 @@ fn maybe_check_static_with_link_section(tcx: TyCtxt, id: DefId, span: Span) { }; let param_env = ty::ParamEnv::reveal_all(); if let Ok(static_) = tcx.const_eval(param_env.and(cid)) { - let alloc = tcx.const_to_allocation(static_); + let alloc = if let ConstValue::ByRef(_, allocation, _) = static_.val { + allocation + } else { + bug!("Matching on non-ByRef static") + }; if alloc.relocations.len() != 0 { let msg = "statics with a custom `#[link_section]` must be a \ simple list of bytes on the wasm target with no \ diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs index be51ab5484da7..368c056f021c1 100644 --- a/src/librustdoc/html/render.rs +++ b/src/librustdoc/html/render.rs @@ -2956,12 +2956,16 @@ fn item_trait( ")?; + let mut foreign_cache = FxHashSet(); for implementor in foreign { - let assoc_link = AssocItemLink::GotoSource( - implementor.impl_item.def_id, &implementor.inner_impl().provided_trait_methods - ); - render_impl(w, cx, &implementor, assoc_link, - RenderMode::Normal, implementor.impl_item.stable_since(), false)?; + if foreign_cache.insert(implementor.inner_impl().to_string()) { + let assoc_link = AssocItemLink::GotoSource( + implementor.impl_item.def_id, + &implementor.inner_impl().provided_trait_methods + ); + render_impl(w, cx, &implementor, assoc_link, + RenderMode::Normal, implementor.impl_item.stable_since(), false)?; + } } } diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs index df885d8a772fb..1acae86f0068f 100644 --- a/src/librustdoc/lib.rs +++ b/src/librustdoc/lib.rs @@ -477,7 +477,8 @@ fn main_args(args: &[String]) -> isize { let output = matches.opt_str("o").map(|s| PathBuf::from(&s)); let css_file_extension = matches.opt_str("e").map(|s| PathBuf::from(&s)); - let cfgs = matches.opt_strs("cfg"); + let mut cfgs = matches.opt_strs("cfg"); + cfgs.push("rustdoc".to_string()); if let Some(ref p) = css_file_extension { if !p.is_file() { @@ -671,7 +672,8 @@ where R: 'static + Send, for s in &matches.opt_strs("L") { paths.add_path(s, ErrorOutputType::default()); } - let cfgs = matches.opt_strs("cfg"); + let mut cfgs = matches.opt_strs("cfg"); + cfgs.push("rustdoc".to_string()); let triple = matches.opt_str("target").map(|target| { if target.ends_with(".json") { TargetTriple::TargetPath(PathBuf::from(target)) diff --git a/src/libstd/macros.rs b/src/libstd/macros.rs index 6945a41a5e73b..b649ec2340e93 100644 --- a/src/libstd/macros.rs +++ b/src/libstd/macros.rs @@ -309,7 +309,7 @@ macro_rules! assert_approx_eq { /// These macros do not have any corresponding definition with a `macro_rules!` /// macro, but are documented here. Their implementations can be found hardcoded /// into libsyntax itself. -#[cfg(dox)] +#[cfg(rustdoc)] mod builtin { /// Unconditionally causes compilation to fail with the given error message when encountered. diff --git a/src/libstd/os/mod.rs b/src/libstd/os/mod.rs index 6d8298f01cdce..1cb9799ff3c22 100644 --- a/src/libstd/os/mod.rs +++ b/src/libstd/os/mod.rs @@ -14,7 +14,7 @@ #![allow(missing_docs, nonstandard_style, missing_debug_implementations)] cfg_if! { - if #[cfg(dox)] { + if #[cfg(rustdoc)] { // When documenting libstd we want to show unix/windows/linux modules as // these are the "main modules" that are used across platforms. This diff --git a/src/libstd/sys/mod.rs b/src/libstd/sys/mod.rs index c44db3b107224..61e4ce66eec0f 100644 --- a/src/libstd/sys/mod.rs +++ b/src/libstd/sys/mod.rs @@ -57,7 +57,7 @@ cfg_if! { // then later used in the `std::os` module when documenting, for example, // Windows when we're compiling for Linux. -#[cfg(dox)] +#[cfg(rustdoc)] cfg_if! { if #[cfg(any(unix, target_os = "redox"))] { // On unix we'll document what's already available @@ -77,7 +77,7 @@ cfg_if! { } } -#[cfg(dox)] +#[cfg(rustdoc)] cfg_if! { if #[cfg(windows)] { // On windows we'll just be documenting what's already available diff --git a/src/libstd/sys/unix/mod.rs b/src/libstd/sys/unix/mod.rs index 2b9fbc9ef3945..17214be5b0549 100644 --- a/src/libstd/sys/unix/mod.rs +++ b/src/libstd/sys/unix/mod.rs @@ -13,22 +13,22 @@ use io::{self, ErrorKind}; use libc; -#[cfg(any(dox, target_os = "linux"))] pub use os::linux as platform; - -#[cfg(all(not(dox), target_os = "android"))] pub use os::android as platform; -#[cfg(all(not(dox), target_os = "bitrig"))] pub use os::bitrig as platform; -#[cfg(all(not(dox), target_os = "dragonfly"))] pub use os::dragonfly as platform; -#[cfg(all(not(dox), target_os = "freebsd"))] pub use os::freebsd as platform; -#[cfg(all(not(dox), target_os = "haiku"))] pub use os::haiku as platform; -#[cfg(all(not(dox), target_os = "ios"))] pub use os::ios as platform; -#[cfg(all(not(dox), target_os = "macos"))] pub use os::macos as platform; -#[cfg(all(not(dox), target_os = "netbsd"))] pub use os::netbsd as platform; -#[cfg(all(not(dox), target_os = "openbsd"))] pub use os::openbsd as platform; -#[cfg(all(not(dox), target_os = "solaris"))] pub use os::solaris as platform; -#[cfg(all(not(dox), target_os = "emscripten"))] pub use os::emscripten as platform; -#[cfg(all(not(dox), target_os = "fuchsia"))] pub use os::fuchsia as platform; -#[cfg(all(not(dox), target_os = "l4re"))] pub use os::linux as platform; -#[cfg(all(not(dox), target_os = "hermit"))] pub use os::hermit as platform; +#[cfg(any(rustdoc, target_os = "linux"))] pub use os::linux as platform; + +#[cfg(all(not(rustdoc), target_os = "android"))] pub use os::android as platform; +#[cfg(all(not(rustdoc), target_os = "bitrig"))] pub use os::bitrig as platform; +#[cfg(all(not(rustdoc), target_os = "dragonfly"))] pub use os::dragonfly as platform; +#[cfg(all(not(rustdoc), target_os = "freebsd"))] pub use os::freebsd as platform; +#[cfg(all(not(rustdoc), target_os = "haiku"))] pub use os::haiku as platform; +#[cfg(all(not(rustdoc), target_os = "ios"))] pub use os::ios as platform; +#[cfg(all(not(rustdoc), target_os = "macos"))] pub use os::macos as platform; +#[cfg(all(not(rustdoc), target_os = "netbsd"))] pub use os::netbsd as platform; +#[cfg(all(not(rustdoc), target_os = "openbsd"))] pub use os::openbsd as platform; +#[cfg(all(not(rustdoc), target_os = "solaris"))] pub use os::solaris as platform; +#[cfg(all(not(rustdoc), target_os = "emscripten"))] pub use os::emscripten as platform; +#[cfg(all(not(rustdoc), target_os = "fuchsia"))] pub use os::fuchsia as platform; +#[cfg(all(not(rustdoc), target_os = "l4re"))] pub use os::linux as platform; +#[cfg(all(not(rustdoc), target_os = "hermit"))] pub use os::hermit as platform; pub use self::rand::hashmap_random_keys; pub use libc::strlen; diff --git a/src/libstd/sys/windows/c.rs b/src/libstd/sys/windows/c.rs index 8a744519e9175..4c64322a6dce3 100644 --- a/src/libstd/sys/windows/c.rs +++ b/src/libstd/sys/windows/c.rs @@ -794,7 +794,7 @@ pub struct FLOATING_SAVE_AREA { // will not appear in the final documentation. This should be also defined for // other architectures supported by Windows such as ARM, and for historical // interest, maybe MIPS and PowerPC as well. -#[cfg(all(dox, not(any(target_arch = "x86_64", target_arch = "x86", target_arch = "aarch64"))))] +#[cfg(all(rustdoc, not(any(target_arch = "x86_64", target_arch = "x86", target_arch = "aarch64"))))] pub enum CONTEXT {} #[cfg(target_arch = "aarch64")] diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs index f226c9dd979d4..14781dd8e24d3 100644 --- a/src/libsyntax/feature_gate.rs +++ b/src/libsyntax/feature_gate.rs @@ -1164,6 +1164,7 @@ const GATED_CFGS: &[(&str, &str, fn(&Features) -> bool)] = &[ ("target_vendor", "cfg_target_vendor", cfg_fn!(cfg_target_vendor)), ("target_thread_local", "cfg_target_thread_local", cfg_fn!(cfg_target_thread_local)), ("target_has_atomic", "cfg_target_has_atomic", cfg_fn!(cfg_target_has_atomic)), + ("rustdoc", "doc_cfg", cfg_fn!(doc_cfg)), ]; #[derive(Debug)] diff --git a/src/test/ui/enum/enum-discrim-autosizing.rs b/src/test/ui/enum/enum-discrim-autosizing.rs index 3a243330ad9b0..dab22de1b6e58 100644 --- a/src/test/ui/enum/enum-discrim-autosizing.rs +++ b/src/test/ui/enum/enum-discrim-autosizing.rs @@ -18,3 +18,4 @@ enum Eu64 { Bu64 = 0x8000_0000_0000_0000 //~ERROR already exists } +fn main() {} diff --git a/src/test/ui/enum/enum-discrim-autosizing.stderr b/src/test/ui/enum/enum-discrim-autosizing.stderr index 3b4ac436898e6..e4419d6285127 100644 --- a/src/test/ui/enum/enum-discrim-autosizing.stderr +++ b/src/test/ui/enum/enum-discrim-autosizing.stderr @@ -1,7 +1,3 @@ -error[E0601]: `main` function not found in crate `enum_discrim_autosizing` - | - = note: consider adding a `main` function to `$DIR/enum-discrim-autosizing.rs` - error[E0081]: discriminant value `0` already exists --> $DIR/enum-discrim-autosizing.rs:18:12 | @@ -10,7 +6,6 @@ LL | Au64 = 0, LL | Bu64 = 0x8000_0000_0000_0000 //~ERROR already exists | ^^^^^^^^^^^^^^^^^^^^^ enum already has `0` -error: aborting due to 2 previous errors +error: aborting due to previous error -Some errors occurred: E0081, E0601. -For more information about an error, try `rustc --explain E0081`. +For more information about this error, try `rustc --explain E0081`. diff --git a/src/test/ui/feature-gate-doc_cfg-cfg-rustdoc.rs b/src/test/ui/feature-gate-doc_cfg-cfg-rustdoc.rs new file mode 100644 index 0000000000000..6207d99dc36aa --- /dev/null +++ b/src/test/ui/feature-gate-doc_cfg-cfg-rustdoc.rs @@ -0,0 +1,14 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#[cfg(rustdoc)] //~ ERROR: `cfg(rustdoc)` is experimental and subject to change +pub struct SomeStruct; + +fn main() {} diff --git a/src/test/ui/feature-gate-doc_cfg-cfg-rustdoc.stderr b/src/test/ui/feature-gate-doc_cfg-cfg-rustdoc.stderr new file mode 100644 index 0000000000000..be2c263af042d --- /dev/null +++ b/src/test/ui/feature-gate-doc_cfg-cfg-rustdoc.stderr @@ -0,0 +1,11 @@ +error[E0658]: `cfg(rustdoc)` is experimental and subject to change (see issue #43781) + --> $DIR/feature-gate-doc_cfg-cfg-rustdoc.rs:11:7 + | +LL | #[cfg(rustdoc)] //~ ERROR: `cfg(rustdoc)` is experimental and subject to change + | ^^^^^^^ + | + = help: add #![feature(doc_cfg)] to the crate attributes to enable + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/gated-bad-feature.rs b/src/test/ui/gated-bad-feature.rs index 5baafd4153159..0d74f9011c3ec 100644 --- a/src/test/ui/gated-bad-feature.rs +++ b/src/test/ui/gated-bad-feature.rs @@ -20,3 +20,5 @@ #![feature = "foo"] //~ ERROR: malformed feature #![feature(test_removed_feature)] //~ ERROR: feature has been removed + +fn main() {} diff --git a/src/test/ui/gated-bad-feature.stderr b/src/test/ui/gated-bad-feature.stderr index 2bed241d68cab..68be49a7277d2 100644 --- a/src/test/ui/gated-bad-feature.stderr +++ b/src/test/ui/gated-bad-feature.stderr @@ -28,11 +28,7 @@ error[E0557]: feature has been removed LL | #![feature(test_removed_feature)] //~ ERROR: feature has been removed | ^^^^^^^^^^^^^^^^^^^^ -error[E0601]: `main` function not found in crate `gated_bad_feature` - | - = note: consider adding a `main` function to `$DIR/gated-bad-feature.rs` - -error: aborting due to 6 previous errors +error: aborting due to 5 previous errors -Some errors occurred: E0555, E0556, E0557, E0601. +Some errors occurred: E0555, E0556, E0557. For more information about an error, try `rustc --explain E0555`. diff --git a/src/test/ui/hygiene/generate-mod.rs b/src/test/ui/hygiene/generate-mod.rs index 2b2108558a0f3..efb3696cf8513 100644 --- a/src/test/ui/hygiene/generate-mod.rs +++ b/src/test/ui/hygiene/generate-mod.rs @@ -55,3 +55,5 @@ fn check_legacy() { struct FromOutside; genmod_legacy!(); } + +fn main() {} diff --git a/src/test/ui/hygiene/generate-mod.stderr b/src/test/ui/hygiene/generate-mod.stderr index 0c5905c5acb4f..f86444bae77e8 100644 --- a/src/test/ui/hygiene/generate-mod.stderr +++ b/src/test/ui/hygiene/generate-mod.stderr @@ -46,11 +46,6 @@ LL | type Inner = Outer; //~ ERROR cannot find type `Outer` in this scop LL | genmod_legacy!(); | ----------------- in this macro invocation -error[E0601]: `main` function not found in crate `generate_mod` - | - = note: consider adding a `main` function to `$DIR/generate-mod.rs` - -error: aborting due to 7 previous errors +error: aborting due to 6 previous errors -Some errors occurred: E0412, E0601. -For more information about an error, try `rustc --explain E0412`. +For more information about this error, try `rustc --explain E0412`. diff --git a/src/test/ui/hygiene/no_implicit_prelude.rs b/src/test/ui/hygiene/no_implicit_prelude.rs index c90c7b3093c9f..bf07bc05491cc 100644 --- a/src/test/ui/hygiene/no_implicit_prelude.rs +++ b/src/test/ui/hygiene/no_implicit_prelude.rs @@ -23,3 +23,5 @@ mod bar { } fn f() { ::foo::m!(); } } + +fn main() {} diff --git a/src/test/ui/hygiene/no_implicit_prelude.stderr b/src/test/ui/hygiene/no_implicit_prelude.stderr index b3d82e9094ba7..463fdbf00ce54 100644 --- a/src/test/ui/hygiene/no_implicit_prelude.stderr +++ b/src/test/ui/hygiene/no_implicit_prelude.stderr @@ -7,10 +7,6 @@ LL | fn f() { ::bar::m!(); } LL | Vec::new(); //~ ERROR failed to resolve | ^^^ Use of undeclared type or module `Vec` -error[E0601]: `main` function not found in crate `no_implicit_prelude` - | - = note: consider adding a `main` function to `$DIR/no_implicit_prelude.rs` - error[E0599]: no method named `clone` found for type `()` in the current scope --> $DIR/no_implicit_prelude.rs:22:12 | @@ -24,7 +20,7 @@ LL | ().clone() //~ ERROR no method named `clone` found = note: the following trait is implemented but not in scope, perhaps add a `use` for it: `use std::clone::Clone;` -error: aborting due to 3 previous errors +error: aborting due to 2 previous errors -Some errors occurred: E0433, E0599, E0601. +Some errors occurred: E0433, E0599. For more information about an error, try `rustc --explain E0433`. diff --git a/src/test/ui/imports/import-glob-circular.rs b/src/test/ui/imports/import-glob-circular.rs index d9cc17791ed56..b2e92fe0e1bf9 100644 --- a/src/test/ui/imports/import-glob-circular.rs +++ b/src/test/ui/imports/import-glob-circular.rs @@ -25,3 +25,5 @@ mod test { fn test() { f1066(); } //~ ERROR cannot find function `f1066` in this scope } + +fn main() {} diff --git a/src/test/ui/imports/import-glob-circular.stderr b/src/test/ui/imports/import-glob-circular.stderr index 078a6a3937a47..fdff04cc24148 100644 --- a/src/test/ui/imports/import-glob-circular.stderr +++ b/src/test/ui/imports/import-glob-circular.stderr @@ -4,11 +4,6 @@ error[E0425]: cannot find function `f1066` in this scope LL | fn test() { f1066(); } //~ ERROR cannot find function `f1066` in this scope | ^^^^^ not found in this scope -error[E0601]: `main` function not found in crate `import_glob_circular` - | - = note: consider adding a `main` function to `$DIR/import-glob-circular.rs` - -error: aborting due to 2 previous errors +error: aborting due to previous error -Some errors occurred: E0425, E0601. -For more information about an error, try `rustc --explain E0425`. +For more information about this error, try `rustc --explain E0425`. diff --git a/src/test/ui/imports/import-loop-2.rs b/src/test/ui/imports/import-loop-2.rs index b7bbe11a4dc96..0bc968872db5b 100644 --- a/src/test/ui/imports/import-loop-2.rs +++ b/src/test/ui/imports/import-loop-2.rs @@ -19,3 +19,5 @@ mod b { fn main() { let y = x; } } + +fn main() {} diff --git a/src/test/ui/imports/import-loop-2.stderr b/src/test/ui/imports/import-loop-2.stderr index 717f74643ebb4..09c2e7918f376 100644 --- a/src/test/ui/imports/import-loop-2.stderr +++ b/src/test/ui/imports/import-loop-2.stderr @@ -4,16 +4,6 @@ error[E0432]: unresolved import `a::x` LL | pub use a::x; | ^^^^ no `x` in `a` -error[E0601]: `main` function not found in crate `import_loop_2` - | - = note: the main function must be defined at the crate level but you have one or more functions named 'main' that are not defined at the crate level. Either move the definition or attach the `#[main]` attribute to override this behavior. -note: here is a function named 'main' - --> $DIR/import-loop-2.rs:20:5 - | -LL | fn main() { let y = x; } - | ^^^^^^^^^^^^^^^^^^^^^^^^ - -error: aborting due to 2 previous errors +error: aborting due to previous error -Some errors occurred: E0432, E0601. -For more information about an error, try `rustc --explain E0432`. +For more information about this error, try `rustc --explain E0432`. diff --git a/src/test/ui/invalid_crate_type_syntax.rs b/src/test/ui/invalid_crate_type_syntax.rs index 6d42515704ea1..904a9acf9e530 100644 --- a/src/test/ui/invalid_crate_type_syntax.rs +++ b/src/test/ui/invalid_crate_type_syntax.rs @@ -12,3 +12,5 @@ #![crate_type(lib)] //~ ERROR `crate_type` requires a value fn my_lib_fn() {} + +fn main() {} diff --git a/src/test/ui/invalid_crate_type_syntax.stderr b/src/test/ui/invalid_crate_type_syntax.stderr index b609695b86ee5..6f02f96faca93 100644 --- a/src/test/ui/invalid_crate_type_syntax.stderr +++ b/src/test/ui/invalid_crate_type_syntax.stderr @@ -6,10 +6,5 @@ LL | #![crate_type(lib)] //~ ERROR `crate_type` requires a value | = note: for example: `#![crate_type="lib"]` -error[E0601]: `main` function not found in crate `invalid_crate_type_syntax` - | - = note: consider adding a `main` function to `$DIR/invalid_crate_type_syntax.rs` - -error: aborting due to 2 previous errors +error: aborting due to previous error -For more information about this error, try `rustc --explain E0601`. diff --git a/src/test/ui/issues/issue-38715.rs b/src/test/ui/issues/issue-38715.rs index 552653c21bad6..5c745d1fab3b5 100644 --- a/src/test/ui/issues/issue-38715.rs +++ b/src/test/ui/issues/issue-38715.rs @@ -14,3 +14,5 @@ macro_rules! foo { ($i:ident) => {} } #[macro_export] macro_rules! foo { () => {} } //~ ERROR a macro named `foo` has already been exported //~| WARN this was previously accepted + +fn main() {} diff --git a/src/test/ui/issues/issue-38715.stderr b/src/test/ui/issues/issue-38715.stderr index a0dbcbd18c673..67b27cc83cc89 100644 --- a/src/test/ui/issues/issue-38715.stderr +++ b/src/test/ui/issues/issue-38715.stderr @@ -13,10 +13,5 @@ note: previous macro export is now shadowed LL | macro_rules! foo { ($i:ident) => {} } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error[E0601]: `main` function not found in crate `issue_38715` - | - = note: consider adding a `main` function to `$DIR/issue-38715.rs` - -error: aborting due to 2 previous errors +error: aborting due to previous error -For more information about this error, try `rustc --explain E0601`. diff --git a/src/test/ui/issues/issue-42755.rs b/src/test/ui/issues/issue-42755.rs index dd53a1c71a5bc..46c8cb740ded7 100644 --- a/src/test/ui/issues/issue-42755.rs +++ b/src/test/ui/issues/issue-42755.rs @@ -15,3 +15,5 @@ macro_rules! foo { } foo!(a); + +fn main() {} diff --git a/src/test/ui/issues/issue-42755.stderr b/src/test/ui/issues/issue-42755.stderr index 9143906199616..fa736edc47f5b 100644 --- a/src/test/ui/issues/issue-42755.stderr +++ b/src/test/ui/issues/issue-42755.stderr @@ -4,10 +4,5 @@ error: repetition matches empty token tree LL | ($($p:vis)*) => {} //~ ERROR repetition matches empty token tree | ^^^^^^^^ -error[E0601]: `main` function not found in crate `issue_42755` - | - = note: consider adding a `main` function to `$DIR/issue-42755.rs` - -error: aborting due to 2 previous errors +error: aborting due to previous error -For more information about this error, try `rustc --explain E0601`. diff --git a/src/test/ui/issues/issue-43784-associated-type.rs b/src/test/ui/issues/issue-43784-associated-type.rs index 94b5c0034a76d..1ff1238ec54b8 100644 --- a/src/test/ui/issues/issue-43784-associated-type.rs +++ b/src/test/ui/issues/issue-43784-associated-type.rs @@ -23,3 +23,5 @@ impl Partial for T::Assoc where impl Complete for T { //~ ERROR the trait bound `T: std::marker::Copy` is not satisfied type Assoc = T; } + +fn main() {} diff --git a/src/test/ui/issues/issue-43784-associated-type.stderr b/src/test/ui/issues/issue-43784-associated-type.stderr index 798d8c6601668..18e97e24b733a 100644 --- a/src/test/ui/issues/issue-43784-associated-type.stderr +++ b/src/test/ui/issues/issue-43784-associated-type.stderr @@ -1,7 +1,3 @@ -error[E0601]: `main` function not found in crate `issue_43784_associated_type` - | - = note: consider adding a `main` function to `$DIR/issue-43784-associated-type.rs` - error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied --> $DIR/issue-43784-associated-type.rs:23:9 | @@ -10,7 +6,6 @@ LL | impl Complete for T { //~ ERROR the trait bound `T: std::marker::Copy` i | = help: consider adding a `where T: std::marker::Copy` bound -error: aborting due to 2 previous errors +error: aborting due to previous error -Some errors occurred: E0277, E0601. -For more information about an error, try `rustc --explain E0277`. +For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/issues/issue-43784-supertrait.rs b/src/test/ui/issues/issue-43784-supertrait.rs index e70df113da33c..30132c3be88a7 100644 --- a/src/test/ui/issues/issue-43784-supertrait.rs +++ b/src/test/ui/issues/issue-43784-supertrait.rs @@ -16,3 +16,5 @@ pub trait Complete: Partial { impl Partial for T where T: Complete {} impl Complete for T {} //~ ERROR the trait bound `T: std::marker::Copy` is not satisfied + +fn main() {} diff --git a/src/test/ui/issues/issue-43784-supertrait.stderr b/src/test/ui/issues/issue-43784-supertrait.stderr index 8646b315abdab..422075f62aa0d 100644 --- a/src/test/ui/issues/issue-43784-supertrait.stderr +++ b/src/test/ui/issues/issue-43784-supertrait.stderr @@ -1,7 +1,3 @@ -error[E0601]: `main` function not found in crate `issue_43784_supertrait` - | - = note: consider adding a `main` function to `$DIR/issue-43784-supertrait.rs` - error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied --> $DIR/issue-43784-supertrait.rs:18:9 | @@ -10,7 +6,6 @@ LL | impl Complete for T {} //~ ERROR the trait bound `T: std::marker::Copy` | = help: consider adding a `where T: std::marker::Copy` bound -error: aborting due to 2 previous errors +error: aborting due to previous error -Some errors occurred: E0277, E0601. -For more information about an error, try `rustc --explain E0277`. +For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/issues/issue-52060.rs b/src/test/ui/issues/issue-52060.rs new file mode 100644 index 0000000000000..54eff228934e3 --- /dev/null +++ b/src/test/ui/issues/issue-52060.rs @@ -0,0 +1,8 @@ +// Regression test for /~https://github.com/rust-lang/rust/issues/52060 +// The compiler shouldn't ICE in this case +static A: &'static [u32] = &[1]; +static B: [u32; 1] = [0; A.len()]; +//~^ ERROR [E0013] +//~| ERROR `core::slice::::len` is not yet stable as a const fn + +fn main() {} diff --git a/src/test/ui/issues/issue-52060.stderr b/src/test/ui/issues/issue-52060.stderr new file mode 100644 index 0000000000000..988bfd480e6ad --- /dev/null +++ b/src/test/ui/issues/issue-52060.stderr @@ -0,0 +1,17 @@ +error[E0013]: constants cannot refer to statics, use a constant instead + --> $DIR/issue-52060.rs:4:26 + | +LL | static B: [u32; 1] = [0; A.len()]; + | ^ + +error: `core::slice::::len` is not yet stable as a const fn + --> $DIR/issue-52060.rs:4:26 + | +LL | static B: [u32; 1] = [0; A.len()]; + | ^^^^^^^ + | + = help: in Nightly builds, add `#![feature(const_slice_len)]` to the crate attributes to enable + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0013`. diff --git a/src/test/ui/macros/macro-use-bad-args-1.rs b/src/test/ui/macros/macro-use-bad-args-1.rs index a07cc83441173..fefc6ff6ca615 100644 --- a/src/test/ui/macros/macro-use-bad-args-1.rs +++ b/src/test/ui/macros/macro-use-bad-args-1.rs @@ -13,3 +13,5 @@ #[allow(unused_extern_crates)] #[macro_use(foo(bar))] //~ ERROR bad macro import extern crate std; + +fn main() {} diff --git a/src/test/ui/macros/macro-use-bad-args-1.stderr b/src/test/ui/macros/macro-use-bad-args-1.stderr index 19a8c7c0382d1..308fb6c76e1b9 100644 --- a/src/test/ui/macros/macro-use-bad-args-1.stderr +++ b/src/test/ui/macros/macro-use-bad-args-1.stderr @@ -4,11 +4,6 @@ error[E0466]: bad macro import LL | #[macro_use(foo(bar))] //~ ERROR bad macro import | ^^^^^^^^ -error[E0601]: `main` function not found in crate `macro_use_bad_args_1` - | - = note: consider adding a `main` function to `$DIR/macro-use-bad-args-1.rs` - -error: aborting due to 2 previous errors +error: aborting due to previous error -Some errors occurred: E0466, E0601. -For more information about an error, try `rustc --explain E0466`. +For more information about this error, try `rustc --explain E0466`. diff --git a/src/test/ui/macros/macro-use-bad-args-2.rs b/src/test/ui/macros/macro-use-bad-args-2.rs index 89004f1689774..81352cf2e427d 100644 --- a/src/test/ui/macros/macro-use-bad-args-2.rs +++ b/src/test/ui/macros/macro-use-bad-args-2.rs @@ -13,3 +13,5 @@ #[allow(unused_extern_crates)] #[macro_use(foo="bar")] //~ ERROR bad macro import extern crate std; + +fn main() {} diff --git a/src/test/ui/macros/macro-use-bad-args-2.stderr b/src/test/ui/macros/macro-use-bad-args-2.stderr index 0ac18201d791e..62e3c22fab3ec 100644 --- a/src/test/ui/macros/macro-use-bad-args-2.stderr +++ b/src/test/ui/macros/macro-use-bad-args-2.stderr @@ -4,11 +4,6 @@ error[E0466]: bad macro import LL | #[macro_use(foo="bar")] //~ ERROR bad macro import | ^^^^^^^^^ -error[E0601]: `main` function not found in crate `macro_use_bad_args_2` - | - = note: consider adding a `main` function to `$DIR/macro-use-bad-args-2.rs` - -error: aborting due to 2 previous errors +error: aborting due to previous error -Some errors occurred: E0466, E0601. -For more information about an error, try `rustc --explain E0466`. +For more information about this error, try `rustc --explain E0466`. diff --git a/src/test/ui/nested-ty-params.rs b/src/test/ui/nested-ty-params.rs index aac37289bb749..2378cccf56f76 100644 --- a/src/test/ui/nested-ty-params.rs +++ b/src/test/ui/nested-ty-params.rs @@ -14,3 +14,5 @@ fn hd(v: Vec ) -> U { return hd1(v); } + +fn main() {} diff --git a/src/test/ui/nested-ty-params.stderr b/src/test/ui/nested-ty-params.stderr index 93b934f610f8c..58b6cd18989f2 100644 --- a/src/test/ui/nested-ty-params.stderr +++ b/src/test/ui/nested-ty-params.stderr @@ -18,11 +18,6 @@ LL | fn hd1(w: [U]) -> U { return w[0]; } | | | help: try using a local type parameter instead: `hd1` -error[E0601]: `main` function not found in crate `nested_ty_params` - | - = note: consider adding a `main` function to `$DIR/nested-ty-params.rs` - -error: aborting due to 3 previous errors +error: aborting due to 2 previous errors -Some errors occurred: E0401, E0601. -For more information about an error, try `rustc --explain E0401`. +For more information about this error, try `rustc --explain E0401`. diff --git a/src/test/ui/repr/repr-transparent-other-items.rs b/src/test/ui/repr/repr-transparent-other-items.rs index 685d62dc3a9c8..be6f3cf9eb205 100644 --- a/src/test/ui/repr/repr-transparent-other-items.rs +++ b/src/test/ui/repr/repr-transparent-other-items.rs @@ -36,3 +36,5 @@ fn cant_repr_this() {} #[repr(transparent)] //~ ERROR should be applied to struct static CANT_REPR_THIS: u32 = 0; + +fn main() {} diff --git a/src/test/ui/repr/repr-transparent-other-items.stderr b/src/test/ui/repr/repr-transparent-other-items.stderr index e5889cf53e58a..5a1978991480e 100644 --- a/src/test/ui/repr/repr-transparent-other-items.stderr +++ b/src/test/ui/repr/repr-transparent-other-items.stderr @@ -1,7 +1,3 @@ -error[E0601]: `main` function not found in crate `repr_transparent_other_items` - | - = note: consider adding a `main` function to `$DIR/repr-transparent-other-items.rs` - error[E0517]: attribute should be applied to struct --> $DIR/repr-transparent-other-items.rs:13:8 | @@ -67,7 +63,7 @@ LL | #[repr(transparent)] //~ ERROR unsupported representation for zero-variant LL | enum Void {} //~| ERROR should be applied to struct | ------------ zero-variant enum -error: aborting due to 8 previous errors +error: aborting due to 7 previous errors -Some errors occurred: E0084, E0517, E0601. +Some errors occurred: E0084, E0517. For more information about an error, try `rustc --explain E0084`. diff --git a/src/test/ui/repr/repr-transparent-other-reprs.rs b/src/test/ui/repr/repr-transparent-other-reprs.rs index fa5f1a2f7fb80..aed8a69f66ef8 100644 --- a/src/test/ui/repr/repr-transparent-other-reprs.rs +++ b/src/test/ui/repr/repr-transparent-other-reprs.rs @@ -26,3 +26,5 @@ struct TransparentPlusAlign(u8); #[repr(transparent)] //~ ERROR cannot have other repr #[repr(C)] struct SeparateAttributes(*mut u8); + +fn main() {} diff --git a/src/test/ui/repr/repr-transparent-other-reprs.stderr b/src/test/ui/repr/repr-transparent-other-reprs.stderr index 40f41c474dbda..c8f5dea3c1242 100644 --- a/src/test/ui/repr/repr-transparent-other-reprs.stderr +++ b/src/test/ui/repr/repr-transparent-other-reprs.stderr @@ -1,7 +1,3 @@ -error[E0601]: `main` function not found in crate `repr_transparent_other_reprs` - | - = note: consider adding a `main` function to `$DIR/repr-transparent-other-reprs.rs` - error[E0692]: transparent struct cannot have other repr hints --> $DIR/repr-transparent-other-reprs.rs:15:8 | @@ -28,7 +24,6 @@ LL | #[repr(transparent)] //~ ERROR cannot have other repr LL | #[repr(C)] | ^ -error: aborting due to 5 previous errors +error: aborting due to 4 previous errors -Some errors occurred: E0601, E0692. -For more information about an error, try `rustc --explain E0601`. +For more information about this error, try `rustc --explain E0692`. diff --git a/src/test/ui/repr/repr-transparent.rs b/src/test/ui/repr/repr-transparent.rs index 230573247316e..f5b99af156ee0 100644 --- a/src/test/ui/repr/repr-transparent.rs +++ b/src/test/ui/repr/repr-transparent.rs @@ -48,3 +48,5 @@ struct ZstAlign32(PhantomData); #[repr(transparent)] struct GenericAlign(ZstAlign32, u32); //~ ERROR alignment larger than 1 + +fn main() {} diff --git a/src/test/ui/repr/repr-transparent.stderr b/src/test/ui/repr/repr-transparent.stderr index 0f620880fa9d3..f7bfdbdc625bb 100644 --- a/src/test/ui/repr/repr-transparent.stderr +++ b/src/test/ui/repr/repr-transparent.stderr @@ -1,7 +1,3 @@ -error[E0601]: `main` function not found in crate `repr_transparent` - | - = note: consider adding a `main` function to `$DIR/repr-transparent.rs` - error[E0690]: transparent struct needs exactly one non-zero-sized field, but has 0 --> $DIR/repr-transparent.rs:21:1 | @@ -70,7 +66,7 @@ error[E0691]: zero-sized field in transparent struct has alignment larger than 1 LL | struct GenericAlign(ZstAlign32, u32); //~ ERROR alignment larger than 1 | ^^^^^^^^^^^^^ -error: aborting due to 9 previous errors +error: aborting due to 8 previous errors -Some errors occurred: E0601, E0690, E0691. -For more information about an error, try `rustc --explain E0601`. +Some errors occurred: E0690, E0691. +For more information about an error, try `rustc --explain E0690`. diff --git a/src/test/ui/resolve/resolve-unknown-trait.rs b/src/test/ui/resolve/resolve-unknown-trait.rs index 9432e727fa5b7..05bf4b928b725 100644 --- a/src/test/ui/resolve/resolve-unknown-trait.rs +++ b/src/test/ui/resolve/resolve-unknown-trait.rs @@ -17,3 +17,5 @@ impl SomeNonExistentTrait for isize {} fn f() {} //~^ ERROR cannot find trait `SomeNonExistentTrait` in this scope + +fn main() {} diff --git a/src/test/ui/resolve/resolve-unknown-trait.stderr b/src/test/ui/resolve/resolve-unknown-trait.stderr index 8a2d791654d2f..74b190f86845f 100644 --- a/src/test/ui/resolve/resolve-unknown-trait.stderr +++ b/src/test/ui/resolve/resolve-unknown-trait.stderr @@ -16,11 +16,6 @@ error[E0405]: cannot find trait `SomeNonExistentTrait` in this scope LL | fn f() {} | ^^^^^^^^^^^^^^^^^^^^ not found in this scope -error[E0601]: `main` function not found in crate `resolve_unknown_trait` - | - = note: consider adding a `main` function to `$DIR/resolve-unknown-trait.rs` - -error: aborting due to 4 previous errors +error: aborting due to 3 previous errors -Some errors occurred: E0405, E0601. -For more information about an error, try `rustc --explain E0405`. +For more information about this error, try `rustc --explain E0405`. diff --git a/src/test/ui/resolve_self_super_hint.rs b/src/test/ui/resolve_self_super_hint.rs index a89fd802baf0c..c5dd367c0ab88 100644 --- a/src/test/ui/resolve_self_super_hint.rs +++ b/src/test/ui/resolve_self_super_hint.rs @@ -32,3 +32,5 @@ mod a { } } } + +fn main() {} diff --git a/src/test/ui/resolve_self_super_hint.stderr b/src/test/ui/resolve_self_super_hint.stderr index 8538da06baf64..40b2a4bf96842 100644 --- a/src/test/ui/resolve_self_super_hint.stderr +++ b/src/test/ui/resolve_self_super_hint.stderr @@ -22,11 +22,6 @@ error[E0432]: unresolved import `alloc` LL | use alloc::HashMap; | ^^^^^ Did you mean `a::alloc`? -error[E0601]: `main` function not found in crate `resolve_self_super_hint` - | - = note: consider adding a `main` function to `$DIR/resolve_self_super_hint.rs` - -error: aborting due to 5 previous errors +error: aborting due to 4 previous errors -Some errors occurred: E0432, E0601. -For more information about an error, try `rustc --explain E0432`. +For more information about this error, try `rustc --explain E0432`. diff --git a/src/test/ui/specialization/defaultimpl/validation.rs b/src/test/ui/specialization/defaultimpl/validation.rs index 26b8b737f340d..068eb7a448556 100644 --- a/src/test/ui/specialization/defaultimpl/validation.rs +++ b/src/test/ui/specialization/defaultimpl/validation.rs @@ -21,3 +21,5 @@ default impl !Send for Z {} //~ ERROR impls of auto traits cannot be default trait Tr {} default impl !Tr for S {} //~ ERROR negative impls are only allowed for auto traits + +fn main() {} diff --git a/src/test/ui/specialization/defaultimpl/validation.stderr b/src/test/ui/specialization/defaultimpl/validation.stderr index 54b92da7b2192..c25c428eb4e94 100644 --- a/src/test/ui/specialization/defaultimpl/validation.stderr +++ b/src/test/ui/specialization/defaultimpl/validation.stderr @@ -6,10 +6,6 @@ LL | default impl S {} //~ ERROR inherent impls cannot be default | = note: only trait implementations may be annotated with default -error[E0601]: `main` function not found in crate `validation` - | - = note: consider adding a `main` function to `$DIR/validation.rs` - error: impls of auto traits cannot be default --> $DIR/validation.rs:19:1 | @@ -28,7 +24,6 @@ error[E0192]: negative impls are only allowed for auto traits (e.g., `Send` and LL | default impl !Tr for S {} //~ ERROR negative impls are only allowed for auto traits | ^^^^^^^^^^^^^^^^^^^^^^^^^ -error: aborting due to 5 previous errors +error: aborting due to 4 previous errors -Some errors occurred: E0192, E0601. -For more information about an error, try `rustc --explain E0192`. +For more information about this error, try `rustc --explain E0192`. diff --git a/src/test/ui/tuple/tuple-struct-fields/test.rs b/src/test/ui/tuple/tuple-struct-fields/test.rs index 22d54a3834073..c8b77bfabdb95 100644 --- a/src/test/ui/tuple/tuple-struct-fields/test.rs +++ b/src/test/ui/tuple/tuple-struct-fields/test.rs @@ -15,3 +15,5 @@ mod foo { //~^ ERROR expected one of `)` or `,`, found `(` //~| ERROR cannot find type `foo` in this scope } + +fn main() {} diff --git a/src/test/ui/tuple/tuple-struct-fields/test.stderr b/src/test/ui/tuple/tuple-struct-fields/test.stderr index 59228ea8c14d2..f83e9dd5458fb 100644 --- a/src/test/ui/tuple/tuple-struct-fields/test.stderr +++ b/src/test/ui/tuple/tuple-struct-fields/test.stderr @@ -10,11 +10,6 @@ error[E0412]: cannot find type `foo` in this scope LL | struct S2(pub((foo)) ()); | ^^^ not found in this scope -error[E0601]: `main` function not found in crate `test` - | - = note: consider adding a `main` function to `$DIR/test.rs` - -error: aborting due to 3 previous errors +error: aborting due to 2 previous errors -Some errors occurred: E0412, E0601. -For more information about an error, try `rustc --explain E0412`. +For more information about this error, try `rustc --explain E0412`. diff --git a/src/test/ui/unresolved/unresolved-import.rs b/src/test/ui/unresolved/unresolved-import.rs index a3eeb6de96bda..efa7494647691 100644 --- a/src/test/ui/unresolved/unresolved-import.rs +++ b/src/test/ui/unresolved/unresolved-import.rs @@ -55,3 +55,5 @@ mod items { fn item() {} } + +fn main() {} diff --git a/src/test/ui/unresolved/unresolved-import.stderr b/src/test/ui/unresolved/unresolved-import.stderr index 1e663cde48a65..9bcebb0011a75 100644 --- a/src/test/ui/unresolved/unresolved-import.stderr +++ b/src/test/ui/unresolved/unresolved-import.stderr @@ -34,11 +34,6 @@ error[E0432]: unresolved import `Enum` LL | use Enum::*; //~ ERROR unresolved import `Enum` [E0432] | ^^^^ Did you mean `self::Enum`? -error[E0601]: `main` function not found in crate `unresolved_import` - | - = note: consider adding a `main` function to `$DIR/unresolved-import.rs` - -error: aborting due to 7 previous errors +error: aborting due to 6 previous errors -Some errors occurred: E0432, E0601. -For more information about an error, try `rustc --explain E0432`. +For more information about this error, try `rustc --explain E0432`. diff --git a/src/test/ui/user-defined-macro-rules.rs b/src/test/ui/user-defined-macro-rules.rs index 02e1a585fa89d..fe76d58f1ef76 100644 --- a/src/test/ui/user-defined-macro-rules.rs +++ b/src/test/ui/user-defined-macro-rules.rs @@ -11,3 +11,5 @@ #![allow(unused_macros)] macro_rules! macro_rules { () => {} } //~ ERROR user-defined macros may not be named `macro_rules` + +fn main() {} diff --git a/src/test/ui/user-defined-macro-rules.stderr b/src/test/ui/user-defined-macro-rules.stderr index 3359aa4bcd720..1f8b18166c9c9 100644 --- a/src/test/ui/user-defined-macro-rules.stderr +++ b/src/test/ui/user-defined-macro-rules.stderr @@ -4,10 +4,5 @@ error: user-defined macros may not be named `macro_rules` LL | macro_rules! macro_rules { () => {} } //~ ERROR user-defined macros may not be named `macro_rules` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error[E0601]: `main` function not found in crate `user_defined_macro_rules` - | - = note: consider adding a `main` function to `$DIR/user-defined-macro-rules.rs` - -error: aborting due to 2 previous errors +error: aborting due to previous error -For more information about this error, try `rustc --explain E0601`. diff --git a/src/test/ui/wasm-custom-section-relocations.rs b/src/test/ui/wasm-custom-section-relocations.rs index 5631a70192afd..9f431e7806139 100644 --- a/src/test/ui/wasm-custom-section-relocations.rs +++ b/src/test/ui/wasm-custom-section-relocations.rs @@ -21,3 +21,5 @@ pub static C: usize = 3; #[link_section = "test"] pub static D: &usize = &C; //~ ERROR: no extra levels of indirection + +fn main() {} diff --git a/src/test/ui/wasm-custom-section-relocations.stderr b/src/test/ui/wasm-custom-section-relocations.stderr index 9b96b99e02ae4..cea6e5c41923a 100644 --- a/src/test/ui/wasm-custom-section-relocations.stderr +++ b/src/test/ui/wasm-custom-section-relocations.stderr @@ -1,7 +1,3 @@ -error[E0601]: `main` function not found in crate `wasm_custom_section_relocations` - | - = note: consider adding a `main` function to `$DIR/wasm-custom-section-relocations.rs` - error: statics with a custom `#[link_section]` must be a simple list of bytes on the wasm target with no extra levels of indirection such as references --> $DIR/wasm-custom-section-relocations.rs:14:1 | @@ -14,6 +10,5 @@ error: statics with a custom `#[link_section]` must be a simple list of bytes on LL | pub static D: &usize = &C; //~ ERROR: no extra levels of indirection | ^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: aborting due to 3 previous errors +error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0601`.