diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs index 079fdee7e8626..ab4a9967e2aa9 100644 --- a/src/bootstrap/builder.rs +++ b/src/bootstrap/builder.rs @@ -389,7 +389,6 @@ impl<'a> Builder<'a> { test::UiFullDeps, test::RunPassFullDeps, test::RunFailFullDeps, - test::CompileFailFullDeps, test::Rustdoc, test::Pretty, test::RunPassPretty, diff --git a/src/bootstrap/doc.rs b/src/bootstrap/doc.rs index 201129b92df05..e9c27a3f3cf31 100644 --- a/src/bootstrap/doc.rs +++ b/src/bootstrap/doc.rs @@ -697,9 +697,6 @@ impl Step for Rustc { return; } - // Build libstd docs so that we generate relative links. - builder.ensure(Std { stage, target }); - // Build rustc. builder.ensure(compile::Rustc { compiler, target }); @@ -718,12 +715,16 @@ impl Step for Rustc { // Find dependencies for top level crates. let mut compiler_crates = HashSet::new(); - for root_crate in &["rustc", "rustc_driver", "rustc_codegen_llvm"] { + for root_crate in &["rustc_driver", "rustc_codegen_llvm", "rustc_codegen_ssa"] { let interned_root_crate = INTERNER.intern_str(root_crate); find_compiler_crates(builder, &interned_root_crate, &mut compiler_crates); } for krate in &compiler_crates { + // Create all crate output directories first to make sure rustdoc uses + // relative links. + // FIXME: Cargo should probably do this itself. + t!(fs::create_dir_all(out_dir.join(krate))); cargo.arg("-p").arg(krate); } @@ -797,8 +798,8 @@ impl Step for Rustdoc { return; } - // Build libstd docs so that we generate relative links. - builder.ensure(Std { stage, target }); + // Build rustc docs so that we generate relative links. + builder.ensure(Rustc { stage, target }); // Build rustdoc. builder.ensure(tool::Rustdoc { host: compiler.host }); @@ -822,6 +823,10 @@ impl Step for Rustdoc { &[] ); + // Only include compiler crates, no dependencies of those, such as `libc`. + cargo.arg("--no-deps"); + cargo.arg("-p").arg("rustdoc"); + cargo.env("RUSTDOCFLAGS", "--document-private-items"); builder.run(&mut cargo); } diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs index da827356800e9..31b6a83714498 100644 --- a/src/bootstrap/test.rs +++ b/src/bootstrap/test.rs @@ -833,12 +833,6 @@ host_test!(RunFailFullDeps { suite: "run-fail-fulldeps" }); -host_test!(CompileFailFullDeps { - path: "src/test/compile-fail-fulldeps", - mode: "compile-fail", - suite: "compile-fail-fulldeps" -}); - host_test!(Rustdoc { path: "src/test/rustdoc", mode: "rustdoc", diff --git a/src/liballoc/rc.rs b/src/liballoc/rc.rs index 3ca6de191de2d..c0a947e701108 100644 --- a/src/liballoc/rc.rs +++ b/src/liballoc/rc.rs @@ -1187,8 +1187,9 @@ impl, U: ?Sized> DispatchFromDyn> for Weak {} impl Weak { /// Constructs a new `Weak`, without allocating any memory. - /// Calling [`upgrade`][Weak::upgrade] on the return value always gives [`None`]. + /// Calling [`upgrade`] on the return value always gives [`None`]. /// + /// [`upgrade`]: #method.upgrade /// [`None`]: ../../std/option/enum.Option.html /// /// # Examples @@ -1260,6 +1261,52 @@ impl Weak { Some(unsafe { self.ptr.as_ref() }) } } + + /// Returns true if the two `Weak`s point to the same value (not just values + /// that compare as equal). + /// + /// # Notes + /// + /// Since this compares pointers it means that `Weak::new()` will equal each + /// other, even though they don't point to any value. + /// + /// # Examples + /// + /// ``` + /// #![feature(weak_ptr_eq)] + /// use std::rc::{Rc, Weak}; + /// + /// let first_rc = Rc::new(5); + /// let first = Rc::downgrade(&first_rc); + /// let second = Rc::downgrade(&first_rc); + /// + /// assert!(Weak::ptr_eq(&first, &second)); + /// + /// let third_rc = Rc::new(5); + /// let third = Rc::downgrade(&third_rc); + /// + /// assert!(!Weak::ptr_eq(&first, &third)); + /// ``` + /// + /// Comparing `Weak::new`. + /// + /// ``` + /// #![feature(weak_ptr_eq)] + /// use std::rc::{Rc, Weak}; + /// + /// let first = Weak::new(); + /// let second = Weak::new(); + /// assert!(Weak::ptr_eq(&first, &second)); + /// + /// let third_rc = Rc::new(()); + /// let third = Rc::downgrade(&third_rc); + /// assert!(!Weak::ptr_eq(&first, &third)); + /// ``` + #[inline] + #[unstable(feature = "weak_ptr_eq", issue = "55981")] + pub fn ptr_eq(this: &Self, other: &Self) -> bool { + this.ptr.as_ptr() == other.ptr.as_ptr() + } } #[stable(feature = "rc_weak", since = "1.4.0")] diff --git a/src/liballoc/sync.rs b/src/liballoc/sync.rs index 4f4031e3c4e32..0a397f79103db 100644 --- a/src/liballoc/sync.rs +++ b/src/liballoc/sync.rs @@ -1130,6 +1130,53 @@ impl Weak { Some(unsafe { self.ptr.as_ref() }) } } + + /// Returns true if the two `Weak`s point to the same value (not just values + /// that compare as equal). + /// + /// # Notes + /// + /// Since this compares pointers it means that `Weak::new()` will equal each + /// other, even though they don't point to any value. + /// + /// + /// # Examples + /// + /// ``` + /// #![feature(weak_ptr_eq)] + /// use std::sync::{Arc, Weak}; + /// + /// let first_rc = Arc::new(5); + /// let first = Arc::downgrade(&first_rc); + /// let second = Arc::downgrade(&first_rc); + /// + /// assert!(Weak::ptr_eq(&first, &second)); + /// + /// let third_rc = Arc::new(5); + /// let third = Arc::downgrade(&third_rc); + /// + /// assert!(!Weak::ptr_eq(&first, &third)); + /// ``` + /// + /// Comparing `Weak::new`. + /// + /// ``` + /// #![feature(weak_ptr_eq)] + /// use std::sync::{Arc, Weak}; + /// + /// let first = Weak::new(); + /// let second = Weak::new(); + /// assert!(Weak::ptr_eq(&first, &second)); + /// + /// let third_rc = Arc::new(()); + /// let third = Arc::downgrade(&third_rc); + /// assert!(!Weak::ptr_eq(&first, &third)); + /// ``` + #[inline] + #[unstable(feature = "weak_ptr_eq", issue = "55981")] + pub fn ptr_eq(this: &Self, other: &Self) -> bool { + this.ptr.as_ptr() == other.ptr.as_ptr() + } } #[stable(feature = "arc_weak", since = "1.4.0")] diff --git a/src/libcore/macros.rs b/src/libcore/macros.rs index 8b1855800c2fd..5ba0e949483ae 100644 --- a/src/libcore/macros.rs +++ b/src/libcore/macros.rs @@ -238,6 +238,10 @@ macro_rules! debug_assert_ne { /// with converting downstream errors. /// /// The `?` operator was added to replace `try!` and should be used instead. +/// Furthermore, `try` is a reserved word in Rust 2018, so if you must use +/// it, you will need to use the [raw-identifier syntax][ris]: `r#try`. +/// +/// [ris]: https://doc.rust-lang.org/nightly/rust-by-example/compatibility/raw_identifiers.html /// /// `try!` matches the given [`Result`]. In case of the `Ok` variant, the /// expression has the value of the wrapped value. diff --git a/src/librustc/middle/dead.rs b/src/librustc/middle/dead.rs index 282b5d13e2c61..bb7a6a6ee7b72 100644 --- a/src/librustc/middle/dead.rs +++ b/src/librustc/middle/dead.rs @@ -166,6 +166,7 @@ impl<'a, 'tcx> MarkSymbolVisitor<'a, 'tcx> { hir::ItemKind::Fn(..) | hir::ItemKind::Ty(..) | hir::ItemKind::Static(..) + | hir::ItemKind::Existential(..) | hir::ItemKind::Const(..) => { intravisit::walk_item(self, &item); } diff --git a/src/librustc_borrowck/borrowck/check_loans.rs b/src/librustc_borrowck/borrowck/check_loans.rs index a802729e3fbdb..e47e95afb1643 100644 --- a/src/librustc_borrowck/borrowck/check_loans.rs +++ b/src/librustc_borrowck/borrowck/check_loans.rs @@ -615,7 +615,7 @@ impl<'a, 'tcx> CheckLoanCtxt<'a, 'tcx> { let new_loan_str = &new_loan.kind.to_user_str(); self.bccx.cannot_reborrow_already_uniquely_borrowed( new_loan.span, "closure", &nl, &new_loan_msg, new_loan_str, - old_loan.span, &old_loan_msg, previous_end_span, Origin::Ast) + old_loan.span, &old_loan_msg, previous_end_span, "", Origin::Ast) } (..) => self.bccx.cannot_reborrow_already_borrowed( diff --git a/src/librustc_data_structures/lib.rs b/src/librustc_data_structures/lib.rs index 96cb235a93362..8e0ecb70c6896 100644 --- a/src/librustc_data_structures/lib.rs +++ b/src/librustc_data_structures/lib.rs @@ -81,7 +81,6 @@ pub mod sync; pub mod tiny_list; pub mod thin_vec; pub mod transitive_relation; -pub mod tuple_slice; pub use ena::unify; pub mod vec_linked_list; pub mod work_queue; diff --git a/src/librustc_data_structures/tuple_slice.rs b/src/librustc_data_structures/tuple_slice.rs deleted file mode 100644 index b7c71dd366469..0000000000000 --- a/src/librustc_data_structures/tuple_slice.rs +++ /dev/null @@ -1,70 +0,0 @@ -// 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. - -use std::slice; - -/// Allows to view uniform tuples as slices -pub trait TupleSlice { - fn as_slice(&self) -> &[T]; - fn as_mut_slice(&mut self) -> &mut [T]; -} - -macro_rules! impl_tuple_slice { - ($tuple_type:ty, $size:expr) => { - impl TupleSlice for $tuple_type { - fn as_slice(&self) -> &[T] { - unsafe { - let ptr = &self.0 as *const T; - slice::from_raw_parts(ptr, $size) - } - } - - fn as_mut_slice(&mut self) -> &mut [T] { - unsafe { - let ptr = &mut self.0 as *mut T; - slice::from_raw_parts_mut(ptr, $size) - } - } - } - } -} - -impl_tuple_slice!((T, T), 2); -impl_tuple_slice!((T, T, T), 3); -impl_tuple_slice!((T, T, T, T), 4); -impl_tuple_slice!((T, T, T, T, T), 5); -impl_tuple_slice!((T, T, T, T, T, T), 6); -impl_tuple_slice!((T, T, T, T, T, T, T), 7); -impl_tuple_slice!((T, T, T, T, T, T, T, T), 8); - -#[test] -fn test_sliced_tuples() { - let t2 = (100, 101); - assert_eq!(t2.as_slice(), &[100, 101]); - - let t3 = (102, 103, 104); - assert_eq!(t3.as_slice(), &[102, 103, 104]); - - let t4 = (105, 106, 107, 108); - assert_eq!(t4.as_slice(), &[105, 106, 107, 108]); - - let t5 = (109, 110, 111, 112, 113); - assert_eq!(t5.as_slice(), &[109, 110, 111, 112, 113]); - - let t6 = (114, 115, 116, 117, 118, 119); - assert_eq!(t6.as_slice(), &[114, 115, 116, 117, 118, 119]); - - let t7 = (120, 121, 122, 123, 124, 125, 126); - assert_eq!(t7.as_slice(), &[120, 121, 122, 123, 124, 125, 126]); - - let t8 = (127, 128, 129, 130, 131, 132, 133, 134); - assert_eq!(t8.as_slice(), &[127, 128, 129, 130, 131, 132, 133, 134]); - -} diff --git a/src/librustc_mir/borrow_check/borrow_set.rs b/src/librustc_mir/borrow_check/borrow_set.rs index fd7dc7fc4bd3a..947c32df0f6a3 100644 --- a/src/librustc_mir/borrow_check/borrow_set.rs +++ b/src/librustc_mir/borrow_check/borrow_set.rs @@ -16,7 +16,7 @@ use rustc::mir::traversal; use rustc::mir::visit::{ PlaceContext, Visitor, NonUseContext, MutatingUseContext, NonMutatingUseContext }; -use rustc::mir::{self, Location, Mir, Place, Local}; +use rustc::mir::{self, Location, Mir, Local}; use rustc::ty::{RegionVid, TyCtxt}; use rustc::util::nodemap::{FxHashMap, FxHashSet}; use rustc_data_structures::indexed_vec::IndexVec; @@ -41,10 +41,6 @@ crate struct BorrowSet<'tcx> { /// only need to store one borrow index crate activation_map: FxHashMap>, - /// Every borrow has a region; this maps each such regions back to - /// its borrow-indexes. - crate region_map: FxHashMap>, - /// Map from local to all the borrows on that local crate local_map: FxHashMap>, @@ -149,7 +145,6 @@ impl<'tcx> BorrowSet<'tcx> { idx_vec: IndexVec::new(), location_map: Default::default(), activation_map: Default::default(), - region_map: Default::default(), local_map: Default::default(), pending_activations: Default::default(), locals_state_at_exit: @@ -164,7 +159,6 @@ impl<'tcx> BorrowSet<'tcx> { borrows: visitor.idx_vec, location_map: visitor.location_map, activation_map: visitor.activation_map, - region_map: visitor.region_map, local_map: visitor.local_map, locals_state_at_exit: visitor.locals_state_at_exit, } @@ -184,7 +178,6 @@ struct GatherBorrows<'a, 'gcx: 'tcx, 'tcx: 'a> { idx_vec: IndexVec>, location_map: FxHashMap, activation_map: FxHashMap>, - region_map: FxHashMap>, local_map: FxHashMap>, /// When we encounter a 2-phase borrow statement, it will always @@ -229,7 +222,6 @@ impl<'a, 'gcx, 'tcx> Visitor<'tcx> for GatherBorrows<'a, 'gcx, 'tcx> { self.insert_as_pending_if_two_phase(location, &assigned_place, kind, idx); - self.region_map.entry(region).or_default().insert(idx); if let Some(local) = borrowed_place.root_local() { self.local_map.entry(local).or_default().insert(idx); } @@ -238,68 +230,68 @@ impl<'a, 'gcx, 'tcx> Visitor<'tcx> for GatherBorrows<'a, 'gcx, 'tcx> { self.super_assign(block, assigned_place, rvalue, location) } - fn visit_place( + fn visit_local( &mut self, - place: &mir::Place<'tcx>, + temp: &Local, context: PlaceContext<'tcx>, location: Location, ) { - self.super_place(place, context, location); - - // We found a use of some temporary TEMP... - if let Place::Local(temp) = place { - // ... check whether we (earlier) saw a 2-phase borrow like - // - // TMP = &mut place - if let Some(&borrow_index) = self.pending_activations.get(temp) { - let borrow_data = &mut self.idx_vec[borrow_index]; - - // Watch out: the use of TMP in the borrow itself - // doesn't count as an activation. =) - if borrow_data.reserve_location == location && - context == PlaceContext::MutatingUse(MutatingUseContext::Store) - { - return; - } + if !context.is_use() { + return; + } - if let TwoPhaseActivation::ActivatedAt(other_location) = - borrow_data.activation_location { - span_bug!( - self.mir.source_info(location).span, - "found two uses for 2-phase borrow temporary {:?}: \ - {:?} and {:?}", - temp, - location, - other_location, - ); - } + // We found a use of some temporary TMP + // check whether we (earlier) saw a 2-phase borrow like + // + // TMP = &mut place + if let Some(&borrow_index) = self.pending_activations.get(temp) { + let borrow_data = &mut self.idx_vec[borrow_index]; - // Otherwise, this is the unique later use - // that we expect. - borrow_data.activation_location = match context { - // The use of TMP in a shared borrow does not - // count as an actual activation. - PlaceContext::NonMutatingUse(NonMutatingUseContext::SharedBorrow(..)) | - PlaceContext::NonMutatingUse(NonMutatingUseContext::ShallowBorrow(..)) => - TwoPhaseActivation::NotActivated, - _ => { - // Double check: This borrow is indeed a two-phase borrow (that is, - // we are 'transitioning' from `NotActivated` to `ActivatedAt`) and - // we've not found any other activations (checked above). - assert_eq!( - borrow_data.activation_location, - TwoPhaseActivation::NotActivated, - "never found an activation for this borrow!", - ); - - self.activation_map - .entry(location) - .or_default() - .push(borrow_index); - TwoPhaseActivation::ActivatedAt(location) - } - }; + // Watch out: the use of TMP in the borrow itself + // doesn't count as an activation. =) + if borrow_data.reserve_location == location && + context == PlaceContext::MutatingUse(MutatingUseContext::Store) + { + return; + } + + if let TwoPhaseActivation::ActivatedAt(other_location) = + borrow_data.activation_location { + span_bug!( + self.mir.source_info(location).span, + "found two uses for 2-phase borrow temporary {:?}: \ + {:?} and {:?}", + temp, + location, + other_location, + ); } + + // Otherwise, this is the unique later use + // that we expect. + borrow_data.activation_location = match context { + // The use of TMP in a shared borrow does not + // count as an actual activation. + PlaceContext::NonMutatingUse(NonMutatingUseContext::SharedBorrow(..)) | + PlaceContext::NonMutatingUse(NonMutatingUseContext::ShallowBorrow(..)) => + TwoPhaseActivation::NotActivated, + _ => { + // Double check: This borrow is indeed a two-phase borrow (that is, + // we are 'transitioning' from `NotActivated` to `ActivatedAt`) and + // we've not found any other activations (checked above). + assert_eq!( + borrow_data.activation_location, + TwoPhaseActivation::NotActivated, + "never found an activation for this borrow!", + ); + + self.activation_map + .entry(location) + .or_default() + .push(borrow_index); + TwoPhaseActivation::ActivatedAt(location) + } + }; } } diff --git a/src/librustc_mir/borrow_check/error_reporting.rs b/src/librustc_mir/borrow_check/error_reporting.rs index 4ccd26bee8b88..ba26ed36c20f4 100644 --- a/src/librustc_mir/borrow_check/error_reporting.rs +++ b/src/librustc_mir/borrow_check/error_reporting.rs @@ -344,6 +344,13 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { let first_borrow_desc; + let explanation = self.explain_why_borrow_contains_point(context, issued_borrow, None); + let second_borrow_desc = if explanation.is_explained() { + "second " + } else { + "" + }; + // FIXME: supply non-"" `opt_via` when appropriate let mut err = match ( gen_borrow_kind, @@ -454,6 +461,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { issued_span, "", None, + second_borrow_desc, Origin::Mir, ) } @@ -469,6 +477,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { issued_span, "", None, + second_borrow_desc, Origin::Mir, ) } @@ -513,7 +522,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { ); } - self.explain_why_borrow_contains_point(context, issued_borrow, None) + explanation .add_explanation_to_diagnostic(self.infcx.tcx, self.mir, &mut err, first_borrow_desc); err.buffer(&mut self.errors_buffer); diff --git a/src/librustc_mir/borrow_check/nll/explain_borrow/mod.rs b/src/librustc_mir/borrow_check/nll/explain_borrow/mod.rs index bb9a29b055b7f..477b78926084e 100644 --- a/src/librustc_mir/borrow_check/nll/explain_borrow/mod.rs +++ b/src/librustc_mir/borrow_check/nll/explain_borrow/mod.rs @@ -52,6 +52,12 @@ pub(in borrow_check) enum LaterUseKind { } impl BorrowExplanation { + pub(in borrow_check) fn is_explained(&self) -> bool { + match self { + BorrowExplanation::Unexplained => false, + _ => true, + } + } pub(in borrow_check) fn add_explanation_to_diagnostic<'cx, 'gcx, 'tcx>( &self, tcx: TyCtxt<'cx, 'gcx, 'tcx>, diff --git a/src/librustc_mir/dataflow/impls/borrows.rs b/src/librustc_mir/dataflow/impls/borrows.rs index 27bc28ac81d84..3a9e4fc9e4ab9 100644 --- a/src/librustc_mir/dataflow/impls/borrows.rs +++ b/src/librustc_mir/dataflow/impls/borrows.rs @@ -246,7 +246,7 @@ impl<'a, 'gcx, 'tcx> BitDenotation for Borrows<'a, 'gcx, 'tcx> { // re-consider the current implementations of the // propagate_call_return method. - if let mir::Rvalue::Ref(region, _, ref place) = **rhs { + if let mir::Rvalue::Ref(_, _, ref place) = **rhs { if place.ignore_borrow( self.tcx, self.mir, @@ -258,13 +258,6 @@ impl<'a, 'gcx, 'tcx> BitDenotation for Borrows<'a, 'gcx, 'tcx> { panic!("could not find BorrowIndex for location {:?}", location); }); - assert!(self.borrow_set.region_map - .get(®ion.to_region_vid()) - .unwrap_or_else(|| { - panic!("could not find BorrowIndexs for RegionVid {:?}", region); - }) - .contains(&index) - ); sets.gen(*index); // Issue #46746: Two-phase borrows handles diff --git a/src/librustc_mir/transform/cleanup_post_borrowck.rs b/src/librustc_mir/transform/cleanup_post_borrowck.rs index c0edd3926d32d..6d7fc404edbb1 100644 --- a/src/librustc_mir/transform/cleanup_post_borrowck.rs +++ b/src/librustc_mir/transform/cleanup_post_borrowck.rs @@ -10,17 +10,25 @@ //! This module provides two passes: //! -//! - [CleanAscribeUserType], that replaces all -//! [StatementKind::AscribeUserType] statements with [StatementKind::Nop]. -//! - [CleanFakeReadsAndBorrows], that replaces all [FakeRead] statements and -//! borrows that are read by [FakeReadCause::ForMatchGuard] fake reads with -//! [StatementKind::Nop]. +//! - [`CleanAscribeUserType`], that replaces all [`AscribeUserType`] +//! statements with [`Nop`]. +//! - [`CleanFakeReadsAndBorrows`], that replaces all [`FakeRead`] statements +//! and borrows that are read by [`ForMatchGuard`] fake reads with [`Nop`]. //! -//! The [CleanFakeReadsAndBorrows] "pass" is actually implemented as two +//! The `CleanFakeReadsAndBorrows` "pass" is actually implemented as two //! traversals (aka visits) of the input MIR. The first traversal, -//! [DeleteAndRecordFakeReads], deletes the fake reads and finds the temporaries -//! read by [ForMatchGuard] reads, and [DeleteFakeBorrows] deletes the -//! initialization of those temporaries. +//! [`DeleteAndRecordFakeReads`], deletes the fake reads and finds the +//! temporaries read by [`ForMatchGuard`] reads, and [`DeleteFakeBorrows`] +//! deletes the initialization of those temporaries. +//! +//! [`CleanAscribeUserType`]: cleanup_post_borrowck::CleanAscribeUserType +//! [`CleanFakeReadsAndBorrows`]: cleanup_post_borrowck::CleanFakeReadsAndBorrows +//! [`DeleteAndRecordFakeReads`]: cleanup_post_borrowck::DeleteAndRecordFakeReads +//! [`DeleteFakeBorrows`]: cleanup_post_borrowck::DeleteFakeBorrows +//! [`AscribeUserType`]: rustc::mir::StatementKind::AscribeUserType +//! [`Nop`]: rustc::mir::StatementKind::Nop +//! [`FakeRead`]: rustc::mir::StatementKind::FakeRead +//! [`ForMatchGuard`]: rustc::mir::FakeReadCause::ForMatchGuard use rustc_data_structures::fx::FxHashSet; diff --git a/src/librustc_mir/util/borrowck_errors.rs b/src/librustc_mir/util/borrowck_errors.rs index ae0483e3c140c..8566f845f23e3 100644 --- a/src/librustc_mir/util/borrowck_errors.rs +++ b/src/librustc_mir/util/borrowck_errors.rs @@ -261,6 +261,7 @@ pub trait BorrowckErrors<'cx>: Sized + Copy { old_loan_span: Span, old_opt_via: &str, previous_end_span: Option, + second_borrow_desc: &str, o: Origin, ) -> DiagnosticBuilder<'cx> { let mut err = struct_span_err!( @@ -274,7 +275,10 @@ pub trait BorrowckErrors<'cx>: Sized + Copy { kind_new, OGN = o ); - err.span_label(new_loan_span, format!("borrow occurs here{}", opt_via)); + err.span_label( + new_loan_span, + format!("{}borrow occurs here{}", second_borrow_desc, opt_via), + ); err.span_label( old_loan_span, format!("{} construction occurs here{}", container_name, old_opt_via), diff --git a/src/librustdoc/html/layout.rs b/src/librustdoc/html/layout.rs index 5263cfe7b0e4f..fa5d015e5b72d 100644 --- a/src/librustdoc/html/layout.rs +++ b/src/librustdoc/html/layout.rs @@ -57,6 +57,9 @@ pub fn render( {css_extension}\ {favicon}\ {in_header}\ + \ \ \ $DIR/dropck_tarena_cycle_checked.rs:126:8 + | +LL | f(&arena); + | ^^^^^ borrowed value does not live long enough +LL | } //~^ ERROR `arena` does not live long enough + | - `arena` dropped here while still borrowed + | + = note: values in a scope are dropped in the opposite order they are created + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0597`. diff --git a/src/test/compile-fail-fulldeps/dropck_tarena_unsound_drop.rs b/src/test/ui-fulldeps/dropck_tarena_unsound_drop.rs similarity index 100% rename from src/test/compile-fail-fulldeps/dropck_tarena_unsound_drop.rs rename to src/test/ui-fulldeps/dropck_tarena_unsound_drop.rs diff --git a/src/test/ui-fulldeps/dropck_tarena_unsound_drop.stderr b/src/test/ui-fulldeps/dropck_tarena_unsound_drop.stderr new file mode 100644 index 0000000000000..75ceb692c7595 --- /dev/null +++ b/src/test/ui-fulldeps/dropck_tarena_unsound_drop.stderr @@ -0,0 +1,13 @@ +error[E0597]: `arena` does not live long enough + --> $DIR/dropck_tarena_unsound_drop.rs:51:8 + | +LL | f(&arena); + | ^^^^^ borrowed value does not live long enough +LL | } //~^ ERROR `arena` does not live long enough + | - `arena` dropped here while still borrowed + | + = note: values in a scope are dropped in the opposite order they are created + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0597`. diff --git a/src/test/compile-fail-fulldeps/gated-plugin.rs b/src/test/ui-fulldeps/gated-plugin.rs similarity index 100% rename from src/test/compile-fail-fulldeps/gated-plugin.rs rename to src/test/ui-fulldeps/gated-plugin.rs diff --git a/src/test/ui-fulldeps/gated-plugin.stderr b/src/test/ui-fulldeps/gated-plugin.stderr new file mode 100644 index 0000000000000..075bc799b3349 --- /dev/null +++ b/src/test/ui-fulldeps/gated-plugin.stderr @@ -0,0 +1,11 @@ +error[E0658]: compiler plugins are experimental and possibly buggy (see issue #29597) + --> $DIR/gated-plugin.rs:13:1 + | +LL | #![plugin(macro_crate_test)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(plugin)] 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/compile-fail-fulldeps/gated-quote.rs b/src/test/ui-fulldeps/gated-quote.rs similarity index 100% rename from src/test/compile-fail-fulldeps/gated-quote.rs rename to src/test/ui-fulldeps/gated-quote.rs diff --git a/src/test/ui-fulldeps/gated-quote.stderr b/src/test/ui-fulldeps/gated-quote.stderr new file mode 100644 index 0000000000000..db091938c6ea8 --- /dev/null +++ b/src/test/ui-fulldeps/gated-quote.stderr @@ -0,0 +1,80 @@ +error: cannot find macro `quote_path!` in this scope + --> $DIR/gated-quote.rs:65:13 + | +LL | let x = quote_path!(ecx, 3); + | ^^^^^^^^^^ + +error: cannot find macro `quote_meta_item!` in this scope + --> $DIR/gated-quote.rs:63:13 + | +LL | let x = quote_meta_item!(ecx, 3); + | ^^^^^^^^^^^^^^^ + +error: cannot find macro `quote_block!` in this scope + --> $DIR/gated-quote.rs:61:13 + | +LL | let x = quote_block!(ecx, 3); + | ^^^^^^^^^^^ + +error: cannot find macro `quote_arg!` in this scope + --> $DIR/gated-quote.rs:59:13 + | +LL | let x = quote_arg!(ecx, 3); + | ^^^^^^^^^ + +error: cannot find macro `quote_attr!` in this scope + --> $DIR/gated-quote.rs:57:13 + | +LL | let x = quote_attr!(ecx, 3); + | ^^^^^^^^^^ + +error: cannot find macro `quote_stmt!` in this scope + --> $DIR/gated-quote.rs:55:13 + | +LL | let x = quote_stmt!(ecx, 3); + | ^^^^^^^^^^ + +error: cannot find macro `quote_arm!` in this scope + --> $DIR/gated-quote.rs:53:13 + | +LL | let x = quote_arm!(ecx, 3); + | ^^^^^^^^^ + +error: cannot find macro `quote_pat!` in this scope + --> $DIR/gated-quote.rs:51:13 + | +LL | let x = quote_pat!(ecx, 3); + | ^^^^^^^^^ + +error: cannot find macro `quote_item!` in this scope + --> $DIR/gated-quote.rs:49:13 + | +LL | let x = quote_item!(ecx, 3); + | ^^^^^^^^^^ + +error: cannot find macro `quote_method!` in this scope + --> $DIR/gated-quote.rs:47:13 + | +LL | let x = quote_method!(ecx, 3); + | ^^^^^^^^^^^^ + +error: cannot find macro `quote_ty!` in this scope + --> $DIR/gated-quote.rs:45:13 + | +LL | let x = quote_ty!(ecx, 3); + | ^^^^^^^^ + +error: cannot find macro `quote_expr!` in this scope + --> $DIR/gated-quote.rs:43:13 + | +LL | let x = quote_expr!(ecx, 3); + | ^^^^^^^^^^ + +error: cannot find macro `quote_tokens!` in this scope + --> $DIR/gated-quote.rs:41:13 + | +LL | let x = quote_tokens!(ecx, 3); + | ^^^^^^^^^^^^ + +error: aborting due to 13 previous errors + diff --git a/src/test/compile-fail-fulldeps/issue-15778-fail.rs b/src/test/ui-fulldeps/issue-15778-fail.rs similarity index 100% rename from src/test/compile-fail-fulldeps/issue-15778-fail.rs rename to src/test/ui-fulldeps/issue-15778-fail.rs diff --git a/src/test/ui-fulldeps/issue-15778-fail.stderr b/src/test/ui-fulldeps/issue-15778-fail.stderr new file mode 100644 index 0000000000000..49a2b260a1e31 --- /dev/null +++ b/src/test/ui-fulldeps/issue-15778-fail.stderr @@ -0,0 +1,13 @@ +error: crate is not marked with #![crate_okay] + --> $DIR/issue-15778-fail.rs:15:1 + | +LL | / #![feature(plugin)] //~ ERROR crate is not marked with #![crate_okay] +LL | | #![plugin(lint_for_crate)] +LL | | +LL | | pub fn main() { } + | |_________________^ + | + = note: requested on the command line with `-D crate-not-okay` + +error: aborting due to previous error + diff --git a/src/test/compile-fail-fulldeps/issue-48941.rs b/src/test/ui-fulldeps/issue-48941.rs similarity index 100% rename from src/test/compile-fail-fulldeps/issue-48941.rs rename to src/test/ui-fulldeps/issue-48941.rs diff --git a/src/test/ui-fulldeps/issue-48941.stderr b/src/test/ui-fulldeps/issue-48941.stderr new file mode 100644 index 0000000000000..606c51fc5004d --- /dev/null +++ b/src/test/ui-fulldeps/issue-48941.stderr @@ -0,0 +1,14 @@ +error: expected unsuffixed literal or identifier, found a + --> $DIR/issue-48941.rs:20:24 + | +LL | #[noop_attribute("hi", rank = a)] //~ ERROR expected unsuffixed literal or identifier, found a + | ^^^^ + +error: expected unsuffixed literal or identifier, found = + --> $DIR/issue-48941.rs:23:27 + | +LL | #[noop_attribute("/user", data= = " $DIR/lint-group-plugin-deny-cmdline.rs:18:1 + | +LL | fn lintme() { } //~ ERROR item is named 'lintme' + | ^^^^^^^^^^^^^^^ + | + = note: `-D test-lint` implied by `-D lint-me` + +error: item is named 'pleaselintme' + --> $DIR/lint-group-plugin-deny-cmdline.rs:20:1 + | +LL | fn pleaselintme() { } //~ ERROR item is named 'pleaselintme' + | ^^^^^^^^^^^^^^^^^^^^^ + | + = note: `-D please-lint` implied by `-D lint-me` + +error: aborting due to 2 previous errors + diff --git a/src/test/compile-fail-fulldeps/lint-plugin-deny-attr.rs b/src/test/ui-fulldeps/lint-plugin-deny-attr.rs similarity index 100% rename from src/test/compile-fail-fulldeps/lint-plugin-deny-attr.rs rename to src/test/ui-fulldeps/lint-plugin-deny-attr.rs diff --git a/src/test/ui-fulldeps/lint-plugin-deny-attr.stderr b/src/test/ui-fulldeps/lint-plugin-deny-attr.stderr new file mode 100644 index 0000000000000..e0ea1e0065a9e --- /dev/null +++ b/src/test/ui-fulldeps/lint-plugin-deny-attr.stderr @@ -0,0 +1,14 @@ +error: item is named 'lintme' + --> $DIR/lint-plugin-deny-attr.rs:18:1 + | +LL | fn lintme() { } //~ ERROR item is named 'lintme' + | ^^^^^^^^^^^^^^^ + | +note: lint level defined here + --> $DIR/lint-plugin-deny-attr.rs:16:9 + | +LL | #![deny(test_lint)] + | ^^^^^^^^^ + +error: aborting due to previous error + diff --git a/src/test/compile-fail-fulldeps/lint-plugin-deny-cmdline.rs b/src/test/ui-fulldeps/lint-plugin-deny-cmdline.rs similarity index 100% rename from src/test/compile-fail-fulldeps/lint-plugin-deny-cmdline.rs rename to src/test/ui-fulldeps/lint-plugin-deny-cmdline.rs diff --git a/src/test/ui-fulldeps/lint-plugin-deny-cmdline.stderr b/src/test/ui-fulldeps/lint-plugin-deny-cmdline.stderr new file mode 100644 index 0000000000000..9084253b71e98 --- /dev/null +++ b/src/test/ui-fulldeps/lint-plugin-deny-cmdline.stderr @@ -0,0 +1,10 @@ +error: item is named 'lintme' + --> $DIR/lint-plugin-deny-cmdline.rs:18:1 + | +LL | fn lintme() { } //~ ERROR item is named 'lintme' + | ^^^^^^^^^^^^^^^ + | + = note: requested on the command line with `-D test-lint` + +error: aborting due to previous error + diff --git a/src/test/compile-fail-fulldeps/lint-plugin-forbid-cmdline.rs b/src/test/ui-fulldeps/lint-plugin-forbid-cmdline.rs similarity index 100% rename from src/test/compile-fail-fulldeps/lint-plugin-forbid-cmdline.rs rename to src/test/ui-fulldeps/lint-plugin-forbid-cmdline.rs diff --git a/src/test/ui-fulldeps/lint-plugin-forbid-cmdline.stderr b/src/test/ui-fulldeps/lint-plugin-forbid-cmdline.stderr new file mode 100644 index 0000000000000..30043db41da89 --- /dev/null +++ b/src/test/ui-fulldeps/lint-plugin-forbid-cmdline.stderr @@ -0,0 +1,19 @@ +error[E0453]: allow(test_lint) overruled by outer forbid(test_lint) + --> $DIR/lint-plugin-forbid-cmdline.rs:20:9 + | +LL | #[allow(test_lint)] //~ ERROR allow(test_lint) overruled by outer forbid(test_lint) + | ^^^^^^^^^ overruled by previous forbid + | + = note: `forbid` lint level was set on command line + +error: item is named 'lintme' + --> $DIR/lint-plugin-forbid-cmdline.rs:18:1 + | +LL | fn lintme() { } //~ ERROR item is named 'lintme' + | ^^^^^^^^^^^^^^^ + | + = note: requested on the command line with `-F test-lint` + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0453`. diff --git a/src/test/compile-fail-fulldeps/macro-crate-doesnt-resolve.rs b/src/test/ui-fulldeps/macro-crate-doesnt-resolve.rs similarity index 100% rename from src/test/compile-fail-fulldeps/macro-crate-doesnt-resolve.rs rename to src/test/ui-fulldeps/macro-crate-doesnt-resolve.rs diff --git a/src/test/ui-fulldeps/macro-crate-doesnt-resolve.stderr b/src/test/ui-fulldeps/macro-crate-doesnt-resolve.stderr new file mode 100644 index 0000000000000..c45cfa9070f07 --- /dev/null +++ b/src/test/ui-fulldeps/macro-crate-doesnt-resolve.stderr @@ -0,0 +1,9 @@ +error[E0425]: cannot find function `foo` in module `macro_crate_test` + --> $DIR/macro-crate-doesnt-resolve.rs:17:23 + | +LL | macro_crate_test::foo(); //~ ERROR cannot find function `foo` in module `macro_crate_test` + | ^^^ not found in `macro_crate_test` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0425`. diff --git a/src/test/compile-fail-fulldeps/macro-crate-rlib.rs b/src/test/ui-fulldeps/macro-crate-rlib.rs similarity index 100% rename from src/test/compile-fail-fulldeps/macro-crate-rlib.rs rename to src/test/ui-fulldeps/macro-crate-rlib.rs diff --git a/src/test/ui-fulldeps/macro-crate-rlib.stderr b/src/test/ui-fulldeps/macro-crate-rlib.stderr new file mode 100644 index 0000000000000..8a7f7883a1088 --- /dev/null +++ b/src/test/ui-fulldeps/macro-crate-rlib.stderr @@ -0,0 +1,9 @@ +error[E0457]: plugin `rlib_crate_test` only found in rlib format, but must be available in dylib format + --> $DIR/macro-crate-rlib.rs:16:11 + | +LL | #![plugin(rlib_crate_test)] + | ^^^^^^^^^^^^^^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0457`. diff --git a/src/test/compile-fail-fulldeps/macro-crate-unexported-macro.rs b/src/test/ui-fulldeps/macro-crate-unexported-macro.rs similarity index 100% rename from src/test/compile-fail-fulldeps/macro-crate-unexported-macro.rs rename to src/test/ui-fulldeps/macro-crate-unexported-macro.rs diff --git a/src/test/ui-fulldeps/macro-crate-unexported-macro.stderr b/src/test/ui-fulldeps/macro-crate-unexported-macro.stderr new file mode 100644 index 0000000000000..8d87c882a1ac4 --- /dev/null +++ b/src/test/ui-fulldeps/macro-crate-unexported-macro.stderr @@ -0,0 +1,8 @@ +error: cannot find macro `unexported_macro!` in this scope + --> $DIR/macro-crate-unexported-macro.rs:17:5 + | +LL | unexported_macro!(); + | ^^^^^^^^^^^^^^^^ help: you could try the macro: `exported_macro` + +error: aborting due to previous error + diff --git a/src/test/compile-fail-fulldeps/plugin-as-extern-crate.rs b/src/test/ui-fulldeps/plugin-as-extern-crate.rs similarity index 100% rename from src/test/compile-fail-fulldeps/plugin-as-extern-crate.rs rename to src/test/ui-fulldeps/plugin-as-extern-crate.rs diff --git a/src/test/ui-fulldeps/plugin-as-extern-crate.stderr b/src/test/ui-fulldeps/plugin-as-extern-crate.stderr new file mode 100644 index 0000000000000..713f1b0734544 --- /dev/null +++ b/src/test/ui-fulldeps/plugin-as-extern-crate.stderr @@ -0,0 +1,14 @@ +error: compiler plugin used as an ordinary library + --> $DIR/plugin-as-extern-crate.rs:20:1 + | +LL | extern crate macro_crate_test; //~ ERROR compiler plugin used as an ordinary library + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +note: lint level defined here + --> $DIR/plugin-as-extern-crate.rs:17:9 + | +LL | #![deny(plugin_as_library)] + | ^^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/src/test/compile-fail-fulldeps/plugin-attr-register-deny.rs b/src/test/ui-fulldeps/plugin-attr-register-deny.rs similarity index 100% rename from src/test/compile-fail-fulldeps/plugin-attr-register-deny.rs rename to src/test/ui-fulldeps/plugin-attr-register-deny.rs diff --git a/src/test/ui-fulldeps/plugin-attr-register-deny.stderr b/src/test/ui-fulldeps/plugin-attr-register-deny.stderr new file mode 100644 index 0000000000000..0bb2d1c9f5ee0 --- /dev/null +++ b/src/test/ui-fulldeps/plugin-attr-register-deny.stderr @@ -0,0 +1,26 @@ +error: unused attribute + --> $DIR/plugin-attr-register-deny.rs:24:5 + | +LL | #[bar] + | ^^^^^^ + | +note: lint level defined here + --> $DIR/plugin-attr-register-deny.rs:16:9 + | +LL | #![deny(unused_attributes)] + | ^^^^^^^^^^^^^^^^^ + +error: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] + --> $DIR/plugin-attr-register-deny.rs:24:5 + | +LL | #[bar] + | ^^^^^^ + +error: unused attribute + --> $DIR/plugin-attr-register-deny.rs:21:1 + | +LL | #[foo] + | ^^^^^^ + +error: aborting due to 3 previous errors + diff --git a/src/test/compile-fail-fulldeps/plugin-plus-extern-crate.rs b/src/test/ui-fulldeps/plugin-plus-extern-crate.rs similarity index 100% rename from src/test/compile-fail-fulldeps/plugin-plus-extern-crate.rs rename to src/test/ui-fulldeps/plugin-plus-extern-crate.rs diff --git a/src/test/ui-fulldeps/plugin-plus-extern-crate.stderr b/src/test/ui-fulldeps/plugin-plus-extern-crate.stderr new file mode 100644 index 0000000000000..faefe04e14ab8 --- /dev/null +++ b/src/test/ui-fulldeps/plugin-plus-extern-crate.stderr @@ -0,0 +1,14 @@ +error: compiler plugin used as an ordinary library + --> $DIR/plugin-plus-extern-crate.rs:22:1 + | +LL | extern crate macro_crate_test; //~ ERROR compiler plugin used as an ordinary library + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +note: lint level defined here + --> $DIR/plugin-plus-extern-crate.rs:18:9 + | +LL | #![deny(plugin_as_library)] + | ^^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/src/test/compile-fail-fulldeps/qquote.rs b/src/test/ui-fulldeps/qquote.rs similarity index 100% rename from src/test/compile-fail-fulldeps/qquote.rs rename to src/test/ui-fulldeps/qquote.rs diff --git a/src/test/ui-fulldeps/qquote.stderr b/src/test/ui-fulldeps/qquote.stderr new file mode 100644 index 0000000000000..4c136ad4b787a --- /dev/null +++ b/src/test/ui-fulldeps/qquote.stderr @@ -0,0 +1,9 @@ +error[E0425]: cannot find value `abcd` in this scope + --> $DIR/qquote.rs:35:38 + | +LL | let expr = quote_expr!(&cx, 2 - $abcd + 7); //~ ERROR cannot find value `abcd` in this scope + | ^^^^ not found in this scope + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0425`. diff --git a/src/test/ui/E0501.ast.nll.stderr b/src/test/ui/E0501.ast.nll.stderr index 72fda9079d636..8a3fce3a554eb 100644 --- a/src/test/ui/E0501.ast.nll.stderr +++ b/src/test/ui/E0501.ast.nll.stderr @@ -7,7 +7,7 @@ LL | inside_closure(a) | - first borrow occurs due to use of `a` in closure LL | }; LL | outside_closure_1(a); //[ast]~ ERROR cannot borrow `*a` as mutable because previous closure requires unique access - | ^ borrow occurs here + | ^ second borrow occurs here ... LL | drop(bar); | --- first borrow later used here @@ -21,7 +21,7 @@ LL | inside_closure(a) | - first borrow occurs due to use of `a` in closure ... LL | outside_closure_2(a); //[ast]~ ERROR cannot borrow `*a` as immutable because previous closure requires unique access - | ^ borrow occurs here + | ^ second borrow occurs here ... LL | drop(bar); | --- first borrow later used here diff --git a/src/test/ui/E0501.mir.stderr b/src/test/ui/E0501.mir.stderr index 72fda9079d636..8a3fce3a554eb 100644 --- a/src/test/ui/E0501.mir.stderr +++ b/src/test/ui/E0501.mir.stderr @@ -7,7 +7,7 @@ LL | inside_closure(a) | - first borrow occurs due to use of `a` in closure LL | }; LL | outside_closure_1(a); //[ast]~ ERROR cannot borrow `*a` as mutable because previous closure requires unique access - | ^ borrow occurs here + | ^ second borrow occurs here ... LL | drop(bar); | --- first borrow later used here @@ -21,7 +21,7 @@ LL | inside_closure(a) | - first borrow occurs due to use of `a` in closure ... LL | outside_closure_2(a); //[ast]~ ERROR cannot borrow `*a` as immutable because previous closure requires unique access - | ^ borrow occurs here + | ^ second borrow occurs here ... LL | drop(bar); | --- first borrow later used here diff --git a/src/test/compile-fail-fulldeps/auxiliary/pub_and_stability.rs b/src/test/ui/auxiliary/pub_and_stability.rs similarity index 100% rename from src/test/compile-fail-fulldeps/auxiliary/pub_and_stability.rs rename to src/test/ui/auxiliary/pub_and_stability.rs diff --git a/src/test/compile-fail-fulldeps/auxiliary/use_from_trait_xc.rs b/src/test/ui/auxiliary/use_from_trait_xc.rs similarity index 100% rename from src/test/compile-fail-fulldeps/auxiliary/use_from_trait_xc.rs rename to src/test/ui/auxiliary/use_from_trait_xc.rs diff --git a/src/test/ui/borrowck/borrowck-insert-during-each.nll.stderr b/src/test/ui/borrowck/borrowck-insert-during-each.nll.stderr index 123d475f1c09f..84fc69465cb4a 100644 --- a/src/test/ui/borrowck/borrowck-insert-during-each.nll.stderr +++ b/src/test/ui/borrowck/borrowck-insert-during-each.nll.stderr @@ -10,7 +10,7 @@ LL | | |a| { //~ ERROR closure requires unique access to `f` LL | | f.n.insert(*a); | | - first borrow occurs due to use of `f` in closure LL | | }) - | |__________^ borrow occurs here + | |__________^ second borrow occurs here error[E0500]: closure requires unique access to `f` but it is already borrowed --> $DIR/borrowck-insert-during-each.rs:27:9 diff --git a/src/test/ui/existential_types/private_unused.rs b/src/test/ui/existential_types/private_unused.rs new file mode 100644 index 0000000000000..736d812bc0aff --- /dev/null +++ b/src/test/ui/existential_types/private_unused.rs @@ -0,0 +1,13 @@ +// compile-pass + +#[deny(warnings)] + +enum Empty { } +trait Bar {} +impl Bar for () {} + +fn boo() -> impl Bar {} + +fn main() { + boo(); +} diff --git a/src/test/compile-fail-fulldeps/explore-issue-38412.rs b/src/test/ui/explore-issue-38412.rs similarity index 100% rename from src/test/compile-fail-fulldeps/explore-issue-38412.rs rename to src/test/ui/explore-issue-38412.rs diff --git a/src/test/ui/explore-issue-38412.stderr b/src/test/ui/explore-issue-38412.stderr new file mode 100644 index 0000000000000..8e31c1c7e017e --- /dev/null +++ b/src/test/ui/explore-issue-38412.stderr @@ -0,0 +1,132 @@ +error[E0658]: use of unstable library feature 'unstable_undeclared' (see issue #38412) + --> $DIR/explore-issue-38412.rs:31:63 + | +LL | let Record { a_stable_pub: _, a_unstable_declared_pub: _, a_unstable_undeclared_pub: _, .. } = + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(unstable_undeclared)] to the crate attributes to enable + +error[E0658]: use of unstable library feature 'unstable_undeclared' (see issue #38412) + --> $DIR/explore-issue-38412.rs:40:5 + | +LL | r.a_unstable_undeclared_pub; //~ ERROR use of unstable library feature + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(unstable_undeclared)] to the crate attributes to enable + +error[E0616]: field `b_crate` of struct `pub_and_stability::Record` is private + --> $DIR/explore-issue-38412.rs:41:5 + | +LL | r.b_crate; //~ ERROR is private + | ^^^^^^^^^ + +error[E0616]: field `c_mod` of struct `pub_and_stability::Record` is private + --> $DIR/explore-issue-38412.rs:42:5 + | +LL | r.c_mod; //~ ERROR is private + | ^^^^^^^ + +error[E0616]: field `d_priv` of struct `pub_and_stability::Record` is private + --> $DIR/explore-issue-38412.rs:43:5 + | +LL | r.d_priv; //~ ERROR is private + | ^^^^^^^^ + +error[E0658]: use of unstable library feature 'unstable_undeclared' (see issue #38412) + --> $DIR/explore-issue-38412.rs:47:5 + | +LL | t.2; //~ ERROR use of unstable library feature + | ^^^ + | + = help: add #![feature(unstable_undeclared)] to the crate attributes to enable + +error[E0616]: field `3` of struct `pub_and_stability::Tuple` is private + --> $DIR/explore-issue-38412.rs:48:5 + | +LL | t.3; //~ ERROR is private + | ^^^ + +error[E0616]: field `4` of struct `pub_and_stability::Tuple` is private + --> $DIR/explore-issue-38412.rs:49:5 + | +LL | t.4; //~ ERROR is private + | ^^^ + +error[E0616]: field `5` of struct `pub_and_stability::Tuple` is private + --> $DIR/explore-issue-38412.rs:50:5 + | +LL | t.5; //~ ERROR is private + | ^^^ + +error[E0658]: use of unstable library feature 'unstable_undeclared' (see issue #38412) + --> $DIR/explore-issue-38412.rs:54:7 + | +LL | r.unstable_undeclared_trait_method(); //~ ERROR use of unstable library feature + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(unstable_undeclared)] to the crate attributes to enable + +error[E0658]: use of unstable library feature 'unstable_undeclared' (see issue #38412) + --> $DIR/explore-issue-38412.rs:58:7 + | +LL | r.unstable_undeclared(); //~ ERROR use of unstable library feature + | ^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(unstable_undeclared)] to the crate attributes to enable + +error[E0624]: method `pub_crate` is private + --> $DIR/explore-issue-38412.rs:60:7 + | +LL | r.pub_crate(); //~ ERROR `pub_crate` is private + | ^^^^^^^^^ + +error[E0624]: method `pub_mod` is private + --> $DIR/explore-issue-38412.rs:61:7 + | +LL | r.pub_mod(); //~ ERROR `pub_mod` is private + | ^^^^^^^ + +error[E0624]: method `private` is private + --> $DIR/explore-issue-38412.rs:62:7 + | +LL | r.private(); //~ ERROR `private` is private + | ^^^^^^^ + +error[E0658]: use of unstable library feature 'unstable_undeclared' (see issue #38412) + --> $DIR/explore-issue-38412.rs:67:7 + | +LL | t.unstable_undeclared_trait_method(); //~ ERROR use of unstable library feature + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(unstable_undeclared)] to the crate attributes to enable + +error[E0658]: use of unstable library feature 'unstable_undeclared' (see issue #38412) + --> $DIR/explore-issue-38412.rs:71:7 + | +LL | t.unstable_undeclared(); //~ ERROR use of unstable library feature + | ^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(unstable_undeclared)] to the crate attributes to enable + +error[E0624]: method `pub_crate` is private + --> $DIR/explore-issue-38412.rs:73:7 + | +LL | t.pub_crate(); //~ ERROR `pub_crate` is private + | ^^^^^^^^^ + +error[E0624]: method `pub_mod` is private + --> $DIR/explore-issue-38412.rs:74:7 + | +LL | t.pub_mod(); //~ ERROR `pub_mod` is private + | ^^^^^^^ + +error[E0624]: method `private` is private + --> $DIR/explore-issue-38412.rs:75:7 + | +LL | t.private(); //~ ERROR `private` is private + | ^^^^^^^ + +error: aborting due to 19 previous errors + +Some errors occurred: E0616, E0624, E0658. +For more information about an error, try `rustc --explain E0616`. diff --git a/src/test/ui/generator/yield-while-ref-reborrowed.nll.stderr b/src/test/ui/generator/yield-while-ref-reborrowed.nll.stderr index 8dabb3c2505b6..60163d78e78f9 100644 --- a/src/test/ui/generator/yield-while-ref-reborrowed.nll.stderr +++ b/src/test/ui/generator/yield-while-ref-reborrowed.nll.stderr @@ -7,7 +7,7 @@ LL | let a = &mut *x; | - first borrow occurs due to use of `x` in generator ... LL | println!("{}", x); //~ ERROR - | ^ borrow occurs here + | ^ second borrow occurs here LL | b.resume(); | - first borrow later used here diff --git a/src/test/compile-fail-fulldeps/issue-18986.rs b/src/test/ui/issue-18986.rs similarity index 100% rename from src/test/compile-fail-fulldeps/issue-18986.rs rename to src/test/ui/issue-18986.rs diff --git a/src/test/ui/issue-18986.stderr b/src/test/ui/issue-18986.stderr new file mode 100644 index 0000000000000..241cc4250a38d --- /dev/null +++ b/src/test/ui/issue-18986.stderr @@ -0,0 +1,9 @@ +error[E0574]: expected struct, variant or union type, found trait `Trait` + --> $DIR/issue-18986.rs:18:9 + | +LL | Trait { x: 42 } => () //~ ERROR expected struct, variant or union type, found trait `Trait` + | ^^^^^ not a struct, variant or union type + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0574`. diff --git a/src/test/ui/nll/closure-borrow-spans.stderr b/src/test/ui/nll/closure-borrow-spans.stderr index 3e423dadd192c..98a261657b1e7 100644 --- a/src/test/ui/nll/closure-borrow-spans.stderr +++ b/src/test/ui/nll/closure-borrow-spans.stderr @@ -126,7 +126,7 @@ LL | let f = || *x = 0; | | | closure construction occurs here LL | let y = &x; //~ ERROR - | ^^ borrow occurs here + | ^^ second borrow occurs here LL | f.use_ref(); | - first borrow later used here @@ -138,7 +138,7 @@ LL | let f = || *x = 0; | | | closure construction occurs here LL | let y = &mut x; //~ ERROR - | ^^^^^^ borrow occurs here + | ^^^^^^ second borrow occurs here LL | f.use_ref(); | - first borrow later used here diff --git a/src/test/compile-fail-fulldeps/no-link-unknown-crate.rs b/src/test/ui/no-link-unknown-crate.rs similarity index 100% rename from src/test/compile-fail-fulldeps/no-link-unknown-crate.rs rename to src/test/ui/no-link-unknown-crate.rs diff --git a/src/test/ui/no-link-unknown-crate.stderr b/src/test/ui/no-link-unknown-crate.stderr new file mode 100644 index 0000000000000..182b484f80bfb --- /dev/null +++ b/src/test/ui/no-link-unknown-crate.stderr @@ -0,0 +1,9 @@ +error[E0463]: can't find crate for `doesnt_exist` + --> $DIR/no-link-unknown-crate.rs:12:1 + | +LL | extern crate doesnt_exist; //~ ERROR can't find crate + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ can't find crate + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0463`. diff --git a/src/test/compile-fail/proc-macro/attr-invalid-exprs.rs b/src/test/ui/proc-macro/attr-invalid-exprs.rs similarity index 100% rename from src/test/compile-fail/proc-macro/attr-invalid-exprs.rs rename to src/test/ui/proc-macro/attr-invalid-exprs.rs diff --git a/src/test/ui/proc-macro/attr-invalid-exprs.stderr b/src/test/ui/proc-macro/attr-invalid-exprs.stderr new file mode 100644 index 0000000000000..c28def63e3e24 --- /dev/null +++ b/src/test/ui/proc-macro/attr-invalid-exprs.stderr @@ -0,0 +1,28 @@ +error: expected expression, found `` + --> $DIR/attr-invalid-exprs.rs:21:13 + | +LL | let _ = #[no_output] "Hello, world!"; + | ^^^^^^^^^^^^ + +error: macro expansion ignores token `,` and any following + --> $DIR/attr-invalid-exprs.rs:24:13 + | +LL | let _ = #[duplicate] "Hello, world!"; + | ^^^^^^^^^^^^- help: you might be missing a semicolon here: `;` + | | + | caused by the macro expansion here + | + = note: the usage of `duplicate!` is likely invalid in expression context + +error: macro expansion ignores token `,` and any following + --> $DIR/attr-invalid-exprs.rs:33:9 + | +LL | #[duplicate] + | ^^^^^^^^^^^^- help: you might be missing a semicolon here: `;` + | | + | caused by the macro expansion here + | + = note: the usage of `duplicate!` is likely invalid in expression context + +error: aborting due to 3 previous errors + diff --git a/src/test/compile-fail/proc-macro/attr-stmt-expr.rs b/src/test/ui/proc-macro/attr-stmt-expr.rs similarity index 100% rename from src/test/compile-fail/proc-macro/attr-stmt-expr.rs rename to src/test/ui/proc-macro/attr-stmt-expr.rs diff --git a/src/test/ui/proc-macro/attr-stmt-expr.stderr b/src/test/ui/proc-macro/attr-stmt-expr.stderr new file mode 100644 index 0000000000000..ee9bc77178217 --- /dev/null +++ b/src/test/ui/proc-macro/attr-stmt-expr.stderr @@ -0,0 +1,19 @@ +error[E0658]: attributes on expressions are experimental. (see issue #15701) + --> $DIR/attr-stmt-expr.rs:20:5 + | +LL | #[expect_print_expr] + | ^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(stmt_expr_attributes)] to the crate attributes to enable + +error[E0658]: attributes on expressions are experimental. (see issue #15701) + --> $DIR/attr-stmt-expr.rs:33:5 + | +LL | #[expect_expr] + | ^^^^^^^^^^^^^^ + | + = help: add #![feature(stmt_expr_attributes)] to the crate attributes to enable + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/compile-fail/proc-macro/attribute-with-error.rs b/src/test/ui/proc-macro/attribute-with-error.rs similarity index 100% rename from src/test/compile-fail/proc-macro/attribute-with-error.rs rename to src/test/ui/proc-macro/attribute-with-error.rs diff --git a/src/test/ui/proc-macro/attribute-with-error.stderr b/src/test/ui/proc-macro/attribute-with-error.stderr new file mode 100644 index 0000000000000..d2b4ac639929a --- /dev/null +++ b/src/test/ui/proc-macro/attribute-with-error.stderr @@ -0,0 +1,39 @@ +error[E0308]: mismatched types + --> $DIR/attribute-with-error.rs:21:18 + | +LL | let a: i32 = "foo"; + | ^^^^^ expected i32, found reference + | + = note: expected type `i32` + found type `&'static str` + +error[E0308]: mismatched types + --> $DIR/attribute-with-error.rs:23:18 + | +LL | let b: i32 = "f'oo"; + | ^^^^^^ expected i32, found reference + | + = note: expected type `i32` + found type `&'static str` + +error[E0308]: mismatched types + --> $DIR/attribute-with-error.rs:36:22 + | +LL | let a: i32 = "foo"; + | ^^^^^ expected i32, found reference + | + = note: expected type `i32` + found type `&'static str` + +error[E0308]: mismatched types + --> $DIR/attribute-with-error.rs:46:22 + | +LL | let a: i32 = "foo"; + | ^^^^^ expected i32, found reference + | + = note: expected type `i32` + found type `&'static str` + +error: aborting due to 4 previous errors + +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/compile-fail/proc-macro/attribute.rs b/src/test/ui/proc-macro/attribute.rs similarity index 100% rename from src/test/compile-fail/proc-macro/attribute.rs rename to src/test/ui/proc-macro/attribute.rs diff --git a/src/test/ui/proc-macro/attribute.stderr b/src/test/ui/proc-macro/attribute.stderr new file mode 100644 index 0000000000000..c752c5364f499 --- /dev/null +++ b/src/test/ui/proc-macro/attribute.stderr @@ -0,0 +1,50 @@ +error: attribute must be of form: #[proc_macro_derive(TraitName)] + --> $DIR/attribute.rs:18:1 + | +LL | #[proc_macro_derive] + | ^^^^^^^^^^^^^^^^^^^^ + +error: attribute must be of form: #[proc_macro_derive(TraitName)] + --> $DIR/attribute.rs:24:1 + | +LL | #[proc_macro_derive = "foo"] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: must only be one word + --> $DIR/attribute.rs:31:5 + | +LL | a = "b" + | ^^^^^^^ + +error: attribute must have either one or two arguments + --> $DIR/attribute.rs:38:1 + | +LL | #[proc_macro_derive(b, c, d)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: must only be one word + --> $DIR/attribute.rs:44:21 + | +LL | #[proc_macro_derive(d(e))] + | ^^^^ + +error: must only be one word + --> $DIR/attribute.rs:50:35 + | +LL | #[proc_macro_derive(f, attributes(g = "h"))] + | ^^^^^^^ + +error: must only be one word + --> $DIR/attribute.rs:56:35 + | +LL | #[proc_macro_derive(i, attributes(j(k)))] + | ^^^^ + +error: attribute must have either one or two arguments + --> $DIR/attribute.rs:62:1 + | +LL | #[proc_macro_derive(l, attributes(m), n)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 8 previous errors + diff --git a/src/test/compile-fail/proc-macro/attributes-included.rs b/src/test/ui/proc-macro/attributes-included.rs similarity index 100% rename from src/test/compile-fail/proc-macro/attributes-included.rs rename to src/test/ui/proc-macro/attributes-included.rs diff --git a/src/test/ui/proc-macro/attributes-included.stderr b/src/test/ui/proc-macro/attributes-included.stderr new file mode 100644 index 0000000000000..e7eeccc01f245 --- /dev/null +++ b/src/test/ui/proc-macro/attributes-included.stderr @@ -0,0 +1,13 @@ +warning: unused variable: `a` + --> $DIR/attributes-included.rs:27:9 + | +LL | let a: i32 = "foo"; //~ WARN: unused variable + | ^ help: consider using `_a` instead + | +note: lint level defined here + --> $DIR/attributes-included.rs:14:9 + | +LL | #![warn(unused)] + | ^^^^^^ + = note: #[warn(unused_variables)] implied by #[warn(unused)] + diff --git a/src/test/compile-fail/proc-macro/auxiliary/attr-stmt-expr.rs b/src/test/ui/proc-macro/auxiliary/attr-stmt-expr.rs similarity index 100% rename from src/test/compile-fail/proc-macro/auxiliary/attr-stmt-expr.rs rename to src/test/ui/proc-macro/auxiliary/attr-stmt-expr.rs diff --git a/src/test/compile-fail/proc-macro/auxiliary/attribute-with-error.rs b/src/test/ui/proc-macro/auxiliary/attribute-with-error.rs similarity index 100% rename from src/test/compile-fail/proc-macro/auxiliary/attribute-with-error.rs rename to src/test/ui/proc-macro/auxiliary/attribute-with-error.rs diff --git a/src/test/compile-fail/proc-macro/auxiliary/attributes-included.rs b/src/test/ui/proc-macro/auxiliary/attributes-included.rs similarity index 100% rename from src/test/compile-fail/proc-macro/auxiliary/attributes-included.rs rename to src/test/ui/proc-macro/auxiliary/attributes-included.rs diff --git a/src/test/compile-fail/proc-macro/auxiliary/bang_proc_macro2.rs b/src/test/ui/proc-macro/auxiliary/bang_proc_macro2.rs similarity index 100% rename from src/test/compile-fail/proc-macro/auxiliary/bang_proc_macro2.rs rename to src/test/ui/proc-macro/auxiliary/bang_proc_macro2.rs diff --git a/src/test/compile-fail/proc-macro/auxiliary/derive-a-b.rs b/src/test/ui/proc-macro/auxiliary/derive-a-b.rs similarity index 100% rename from src/test/compile-fail/proc-macro/auxiliary/derive-a-b.rs rename to src/test/ui/proc-macro/auxiliary/derive-a-b.rs diff --git a/src/test/compile-fail/proc-macro/auxiliary/derive-a.rs b/src/test/ui/proc-macro/auxiliary/derive-a.rs similarity index 100% rename from src/test/compile-fail/proc-macro/auxiliary/derive-a.rs rename to src/test/ui/proc-macro/auxiliary/derive-a.rs diff --git a/src/test/compile-fail/proc-macro/auxiliary/derive-b.rs b/src/test/ui/proc-macro/auxiliary/derive-b.rs similarity index 100% rename from src/test/compile-fail/proc-macro/auxiliary/derive-b.rs rename to src/test/ui/proc-macro/auxiliary/derive-b.rs diff --git a/src/test/compile-fail/proc-macro/auxiliary/derive-bad.rs b/src/test/ui/proc-macro/auxiliary/derive-bad.rs similarity index 100% rename from src/test/compile-fail/proc-macro/auxiliary/derive-bad.rs rename to src/test/ui/proc-macro/auxiliary/derive-bad.rs diff --git a/src/test/compile-fail/proc-macro/auxiliary/derive-unstable-2.rs b/src/test/ui/proc-macro/auxiliary/derive-unstable-2.rs similarity index 100% rename from src/test/compile-fail/proc-macro/auxiliary/derive-unstable-2.rs rename to src/test/ui/proc-macro/auxiliary/derive-unstable-2.rs diff --git a/src/test/compile-fail/proc-macro/auxiliary/derive-unstable.rs b/src/test/ui/proc-macro/auxiliary/derive-unstable.rs similarity index 100% rename from src/test/compile-fail/proc-macro/auxiliary/derive-unstable.rs rename to src/test/ui/proc-macro/auxiliary/derive-unstable.rs diff --git a/src/test/ui-fulldeps/proc-macro/auxiliary/edition-imports-2015.rs b/src/test/ui/proc-macro/auxiliary/edition-imports-2015.rs similarity index 100% rename from src/test/ui-fulldeps/proc-macro/auxiliary/edition-imports-2015.rs rename to src/test/ui/proc-macro/auxiliary/edition-imports-2015.rs diff --git a/src/test/compile-fail/proc-macro/auxiliary/issue-41211.rs b/src/test/ui/proc-macro/auxiliary/issue-41211.rs similarity index 100% rename from src/test/compile-fail/proc-macro/auxiliary/issue-41211.rs rename to src/test/ui/proc-macro/auxiliary/issue-41211.rs diff --git a/src/test/compile-fail/proc-macro/auxiliary/issue_38586.rs b/src/test/ui/proc-macro/auxiliary/issue_38586.rs similarity index 100% rename from src/test/compile-fail/proc-macro/auxiliary/issue_38586.rs rename to src/test/ui/proc-macro/auxiliary/issue_38586.rs diff --git a/src/test/compile-fail/proc-macro/auxiliary/issue_50493.rs b/src/test/ui/proc-macro/auxiliary/issue_50493.rs similarity index 100% rename from src/test/compile-fail/proc-macro/auxiliary/issue_50493.rs rename to src/test/ui/proc-macro/auxiliary/issue_50493.rs diff --git a/src/test/compile-fail/proc-macro/auxiliary/more-gates.rs b/src/test/ui/proc-macro/auxiliary/more-gates.rs similarity index 100% rename from src/test/compile-fail/proc-macro/auxiliary/more-gates.rs rename to src/test/ui/proc-macro/auxiliary/more-gates.rs diff --git a/src/test/compile-fail/proc-macro/auxiliary/proc-macro-gates.rs b/src/test/ui/proc-macro/auxiliary/proc-macro-gates.rs similarity index 100% rename from src/test/compile-fail/proc-macro/auxiliary/proc-macro-gates.rs rename to src/test/ui/proc-macro/auxiliary/proc-macro-gates.rs diff --git a/src/test/compile-fail/proc-macro/auxiliary/test-macros.rs b/src/test/ui/proc-macro/auxiliary/test-macros.rs similarity index 100% rename from src/test/compile-fail/proc-macro/auxiliary/test-macros.rs rename to src/test/ui/proc-macro/auxiliary/test-macros.rs diff --git a/src/test/compile-fail/proc-macro/define-two.rs b/src/test/ui/proc-macro/define-two.rs similarity index 100% rename from src/test/compile-fail/proc-macro/define-two.rs rename to src/test/ui/proc-macro/define-two.rs diff --git a/src/test/ui/proc-macro/define-two.stderr b/src/test/ui/proc-macro/define-two.stderr new file mode 100644 index 0000000000000..1ca2e0a3e3cf7 --- /dev/null +++ b/src/test/ui/proc-macro/define-two.stderr @@ -0,0 +1,14 @@ +error[E0428]: the name `A` is defined multiple times + --> $DIR/define-two.rs:25:21 + | +LL | #[proc_macro_derive(A)] + | - previous definition of the macro `A` here +... +LL | #[proc_macro_derive(A)] //~ ERROR the name `A` is defined multiple times + | ^ `A` redefined here + | + = note: `A` must be defined only once in the macro namespace of this module + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0428`. diff --git a/src/test/compile-fail/proc-macro/derive-bad.rs b/src/test/ui/proc-macro/derive-bad.rs similarity index 100% rename from src/test/compile-fail/proc-macro/derive-bad.rs rename to src/test/ui/proc-macro/derive-bad.rs diff --git a/src/test/ui/proc-macro/derive-bad.stderr b/src/test/ui/proc-macro/derive-bad.stderr new file mode 100644 index 0000000000000..57e72a07ee195 --- /dev/null +++ b/src/test/ui/proc-macro/derive-bad.stderr @@ -0,0 +1,14 @@ +error: expected `:`, found `}` + --> $DIR/derive-bad.rs:17:5 + | +LL | A + | ^ expected `:` + +error: proc-macro derive produced unparseable tokens + --> $DIR/derive-bad.rs:17:5 + | +LL | A + | ^ + +error: aborting due to 2 previous errors + diff --git a/src/test/compile-fail/proc-macro/derive-still-gated.rs b/src/test/ui/proc-macro/derive-still-gated.rs similarity index 100% rename from src/test/compile-fail/proc-macro/derive-still-gated.rs rename to src/test/ui/proc-macro/derive-still-gated.rs diff --git a/src/test/ui/proc-macro/derive-still-gated.stderr b/src/test/ui/proc-macro/derive-still-gated.stderr new file mode 100644 index 0000000000000..f2e92b992ed6e --- /dev/null +++ b/src/test/ui/proc-macro/derive-still-gated.stderr @@ -0,0 +1,11 @@ +error[E0658]: attributes of the form `#[derive_*]` are reserved for the compiler (see issue #29644) + --> $DIR/derive-still-gated.rs:18:3 + | +LL | #[derive_A] //~ ERROR: attributes of the form `#[derive_*]` are reserved for the compiler + | ^^^^^^^^ + | + = help: add #![feature(custom_derive)] 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-fulldeps/proc-macro/edition-imports-2018.rs b/src/test/ui/proc-macro/edition-imports-2018.rs similarity index 100% rename from src/test/ui-fulldeps/proc-macro/edition-imports-2018.rs rename to src/test/ui/proc-macro/edition-imports-2018.rs diff --git a/src/test/compile-fail/proc-macro/expand-to-unstable-2.rs b/src/test/ui/proc-macro/expand-to-unstable-2.rs similarity index 100% rename from src/test/compile-fail/proc-macro/expand-to-unstable-2.rs rename to src/test/ui/proc-macro/expand-to-unstable-2.rs diff --git a/src/test/ui/proc-macro/expand-to-unstable-2.stderr b/src/test/ui/proc-macro/expand-to-unstable-2.stderr new file mode 100644 index 0000000000000..855e9051974b2 --- /dev/null +++ b/src/test/ui/proc-macro/expand-to-unstable-2.stderr @@ -0,0 +1,11 @@ +error[E0658]: unless otherwise specified, attributes with the prefix `rustc_` are reserved for internal compiler diagnostics (see issue #29642) + --> $DIR/expand-to-unstable-2.rs:18:10 + | +LL | #[derive(Unstable)] + | ^^^^^^^^ + | + = help: add #![feature(rustc_attrs)] 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/compile-fail/proc-macro/expand-to-unstable.rs b/src/test/ui/proc-macro/expand-to-unstable.rs similarity index 100% rename from src/test/compile-fail/proc-macro/expand-to-unstable.rs rename to src/test/ui/proc-macro/expand-to-unstable.rs diff --git a/src/test/ui/proc-macro/expand-to-unstable.stderr b/src/test/ui/proc-macro/expand-to-unstable.stderr new file mode 100644 index 0000000000000..e851b0e2bc3f1 --- /dev/null +++ b/src/test/ui/proc-macro/expand-to-unstable.stderr @@ -0,0 +1,11 @@ +error[E0658]: use of unstable library feature 'core_intrinsics': intrinsics are unlikely to ever be stabilized, instead they should be used through stabilized interfaces in the rest of the standard library + --> $DIR/expand-to-unstable.rs:18:10 + | +LL | #[derive(Unstable)] + | ^^^^^^^^ + | + = help: add #![feature(core_intrinsics)] 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/compile-fail/proc-macro/export-macro.rs b/src/test/ui/proc-macro/export-macro.rs similarity index 100% rename from src/test/compile-fail/proc-macro/export-macro.rs rename to src/test/ui/proc-macro/export-macro.rs diff --git a/src/test/ui/proc-macro/export-macro.stderr b/src/test/ui/proc-macro/export-macro.stderr new file mode 100644 index 0000000000000..f82d5ab5f1c6b --- /dev/null +++ b/src/test/ui/proc-macro/export-macro.stderr @@ -0,0 +1,10 @@ +error: cannot export macro_rules! macros from a `proc-macro` crate type currently + --> $DIR/export-macro.rs:19:1 + | +LL | / macro_rules! foo { +LL | | ($e:expr) => ($e) +LL | | } + | |_^ + +error: aborting due to previous error + diff --git a/src/test/compile-fail/proc-macro/exports.rs b/src/test/ui/proc-macro/exports.rs similarity index 100% rename from src/test/compile-fail/proc-macro/exports.rs rename to src/test/ui/proc-macro/exports.rs diff --git a/src/test/ui/proc-macro/exports.stderr b/src/test/ui/proc-macro/exports.stderr new file mode 100644 index 0000000000000..3637d0fbd837e --- /dev/null +++ b/src/test/ui/proc-macro/exports.stderr @@ -0,0 +1,26 @@ +error: `proc-macro` crate types cannot export any items other than functions tagged with `#[proc_macro_derive]` currently + --> $DIR/exports.rs:17:1 + | +LL | pub fn a() {} //~ ERROR: cannot export any items + | ^^^^^^^^^^^^^ + +error: `proc-macro` crate types cannot export any items other than functions tagged with `#[proc_macro_derive]` currently + --> $DIR/exports.rs:18:1 + | +LL | pub struct B; //~ ERROR: cannot export any items + | ^^^^^^^^^^^^^ + +error: `proc-macro` crate types cannot export any items other than functions tagged with `#[proc_macro_derive]` currently + --> $DIR/exports.rs:19:1 + | +LL | pub enum C {} //~ ERROR: cannot export any items + | ^^^^^^^^^^^^^ + +error: `proc-macro` crate types cannot export any items other than functions tagged with `#[proc_macro_derive]` currently + --> $DIR/exports.rs:20:1 + | +LL | pub mod d {} //~ ERROR: cannot export any items + | ^^^^^^^^^^^^ + +error: aborting due to 4 previous errors + diff --git a/src/test/compile-fail/proc-macro/illegal-proc-macro-derive-use.rs b/src/test/ui/proc-macro/illegal-proc-macro-derive-use.rs similarity index 100% rename from src/test/compile-fail/proc-macro/illegal-proc-macro-derive-use.rs rename to src/test/ui/proc-macro/illegal-proc-macro-derive-use.rs diff --git a/src/test/ui/proc-macro/illegal-proc-macro-derive-use.stderr b/src/test/ui/proc-macro/illegal-proc-macro-derive-use.stderr new file mode 100644 index 0000000000000..715ff0e20a9b0 --- /dev/null +++ b/src/test/ui/proc-macro/illegal-proc-macro-derive-use.stderr @@ -0,0 +1,14 @@ +error: the `#[proc_macro_derive]` attribute is only usable with crates of the `proc-macro` crate type + --> $DIR/illegal-proc-macro-derive-use.rs:13:1 + | +LL | #[proc_macro_derive(Foo)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: the `#[proc_macro_derive]` attribute may only be used on bare functions + --> $DIR/illegal-proc-macro-derive-use.rs:20:1 + | +LL | #[proc_macro_derive(Foo)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 2 previous errors + diff --git a/src/test/compile-fail/proc-macro/import.rs b/src/test/ui/proc-macro/import.rs similarity index 100% rename from src/test/compile-fail/proc-macro/import.rs rename to src/test/ui/proc-macro/import.rs diff --git a/src/test/ui/proc-macro/import.stderr b/src/test/ui/proc-macro/import.stderr new file mode 100644 index 0000000000000..f3633b2158383 --- /dev/null +++ b/src/test/ui/proc-macro/import.stderr @@ -0,0 +1,9 @@ +error[E0432]: unresolved import `derive_a::derive_a` + --> $DIR/import.rs:18:5 + | +LL | use derive_a::derive_a; + | ^^^^^^^^^^^^^^^^^^ no `derive_a` in the root + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0432`. diff --git a/src/test/compile-fail/proc-macro/issue-37788.rs b/src/test/ui/proc-macro/issue-37788.rs similarity index 100% rename from src/test/compile-fail/proc-macro/issue-37788.rs rename to src/test/ui/proc-macro/issue-37788.rs diff --git a/src/test/ui/proc-macro/issue-37788.stderr b/src/test/ui/proc-macro/issue-37788.stderr new file mode 100644 index 0000000000000..f5ddf9ba6b88b --- /dev/null +++ b/src/test/ui/proc-macro/issue-37788.stderr @@ -0,0 +1,17 @@ +error[E0308]: mismatched types + --> $DIR/issue-37788.rs:18:5 + | +LL | fn main() { + | - expected `()` because of default return type +LL | // Test that constructing the `visible_parent_map` (in `cstore_impl.rs`) does not ICE. +LL | std::cell::Cell::new(0) //~ ERROR mismatched types + | ^^^^^^^^^^^^^^^^^^^^^^^- help: try adding a semicolon: `;` + | | + | expected (), found struct `std::cell::Cell` + | + = note: expected type `()` + found type `std::cell::Cell<{integer}>` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/compile-fail/proc-macro/issue-38586.rs b/src/test/ui/proc-macro/issue-38586.rs similarity index 100% rename from src/test/compile-fail/proc-macro/issue-38586.rs rename to src/test/ui/proc-macro/issue-38586.rs diff --git a/src/test/ui/proc-macro/issue-38586.stderr b/src/test/ui/proc-macro/issue-38586.stderr new file mode 100644 index 0000000000000..6ba2c0b269fe6 --- /dev/null +++ b/src/test/ui/proc-macro/issue-38586.stderr @@ -0,0 +1,9 @@ +error[E0425]: cannot find value `foo` in this scope + --> $DIR/issue-38586.rs:16:10 + | +LL | #[derive(A)] //~ ERROR `foo` + | ^ not found in this scope + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0425`. diff --git a/src/test/compile-fail/proc-macro/issue-41211.rs b/src/test/ui/proc-macro/issue-41211.rs similarity index 100% rename from src/test/compile-fail/proc-macro/issue-41211.rs rename to src/test/ui/proc-macro/issue-41211.rs diff --git a/src/test/ui/proc-macro/issue-41211.stderr b/src/test/ui/proc-macro/issue-41211.stderr new file mode 100644 index 0000000000000..ba5fad432b7ab --- /dev/null +++ b/src/test/ui/proc-macro/issue-41211.stderr @@ -0,0 +1,11 @@ +error[E0658]: The attribute `emit_unchanged` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) + --> $DIR/issue-41211.rs:18:4 + | +LL | #![emit_unchanged] + | ^^^^^^^^^^^^^^ + | + = help: add #![feature(custom_attribute)] 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/compile-fail/proc-macro/issue-50493.rs b/src/test/ui/proc-macro/issue-50493.rs similarity index 100% rename from src/test/compile-fail/proc-macro/issue-50493.rs rename to src/test/ui/proc-macro/issue-50493.rs diff --git a/src/test/ui/proc-macro/issue-50493.stderr b/src/test/ui/proc-macro/issue-50493.stderr new file mode 100644 index 0000000000000..3dcb526553565 --- /dev/null +++ b/src/test/ui/proc-macro/issue-50493.stderr @@ -0,0 +1,15 @@ +error: visibilities can only be restricted to ancestor modules + --> $DIR/issue-50493.rs:18:12 + | +LL | pub(in restricted) field: usize, //~ visibilities can only be restricted to ancestor modules + | ^^^^^^^^^^ + +error[E0616]: field `field` of struct `Restricted` is private + --> $DIR/issue-50493.rs:16:10 + | +LL | #[derive(Derive)] //~ ERROR field `field` of struct `Restricted` is private + | ^^^^^^ + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0616`. diff --git a/src/test/compile-fail/proc-macro/item-error.rs b/src/test/ui/proc-macro/item-error.rs similarity index 100% rename from src/test/compile-fail/proc-macro/item-error.rs rename to src/test/ui/proc-macro/item-error.rs diff --git a/src/test/ui/proc-macro/item-error.stderr b/src/test/ui/proc-macro/item-error.stderr new file mode 100644 index 0000000000000..d19328687979b --- /dev/null +++ b/src/test/ui/proc-macro/item-error.stderr @@ -0,0 +1,9 @@ +error[E0106]: missing lifetime specifier + --> $DIR/item-error.rs:20:8 + | +LL | a: &u64 + | ^ expected lifetime parameter + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0106`. diff --git a/src/test/compile-fail/proc-macro/lints_in_proc_macros.rs b/src/test/ui/proc-macro/lints_in_proc_macros.rs similarity index 100% rename from src/test/compile-fail/proc-macro/lints_in_proc_macros.rs rename to src/test/ui/proc-macro/lints_in_proc_macros.rs diff --git a/src/test/ui/proc-macro/lints_in_proc_macros.stderr b/src/test/ui/proc-macro/lints_in_proc_macros.stderr new file mode 100644 index 0000000000000..42d9a30722654 --- /dev/null +++ b/src/test/ui/proc-macro/lints_in_proc_macros.stderr @@ -0,0 +1,9 @@ +error[E0425]: cannot find value `foobar2` in this scope + --> $DIR/lints_in_proc_macros.rs:22:5 + | +LL | bang_proc_macro2!(); + | ^^^^^^^^^^^^^^^^^^^^ did you mean `foobar`? + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0425`. diff --git a/src/test/compile-fail/proc-macro/macros-in-extern.rs b/src/test/ui/proc-macro/macros-in-extern.rs similarity index 100% rename from src/test/compile-fail/proc-macro/macros-in-extern.rs rename to src/test/ui/proc-macro/macros-in-extern.rs diff --git a/src/test/ui/proc-macro/macros-in-extern.stderr b/src/test/ui/proc-macro/macros-in-extern.stderr new file mode 100644 index 0000000000000..5c51de4580165 --- /dev/null +++ b/src/test/ui/proc-macro/macros-in-extern.stderr @@ -0,0 +1,27 @@ +error[E0658]: macro invocations in `extern {}` blocks are experimental (see issue #49476) + --> $DIR/macros-in-extern.rs:25:5 + | +LL | #[no_output] + | ^^^^^^^^^^^^ + | + = help: add #![feature(macros_in_extern)] to the crate attributes to enable + +error[E0658]: macro invocations in `extern {}` blocks are experimental (see issue #49476) + --> $DIR/macros-in-extern.rs:29:5 + | +LL | #[nop_attr] + | ^^^^^^^^^^^ + | + = help: add #![feature(macros_in_extern)] to the crate attributes to enable + +error[E0658]: macro invocations in `extern {}` blocks are experimental (see issue #49476) + --> $DIR/macros-in-extern.rs:33:5 + | +LL | emit_input!(fn rust_dbg_extern_identity_u32(arg: u32) -> u32;); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(macros_in_extern)] to the crate attributes to enable + +error: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/compile-fail/proc-macro/more-gates.rs b/src/test/ui/proc-macro/more-gates.rs similarity index 100% rename from src/test/compile-fail/proc-macro/more-gates.rs rename to src/test/ui/proc-macro/more-gates.rs diff --git a/src/test/ui/proc-macro/more-gates.stderr b/src/test/ui/proc-macro/more-gates.stderr new file mode 100644 index 0000000000000..d5f30d5817c93 --- /dev/null +++ b/src/test/ui/proc-macro/more-gates.stderr @@ -0,0 +1,43 @@ +error[E0658]: procedural macros cannot expand to macro definitions (see issue #54727) + --> $DIR/more-gates.rs:17:1 + | +LL | #[attr2mac1] + | ^^^^^^^^^^^^ + | + = help: add #![feature(proc_macro_hygiene)] to the crate attributes to enable + +error[E0658]: procedural macros cannot expand to macro definitions (see issue #54727) + --> $DIR/more-gates.rs:20:1 + | +LL | #[attr2mac2] + | ^^^^^^^^^^^^ + | + = help: add #![feature(proc_macro_hygiene)] to the crate attributes to enable + +error[E0658]: procedural macros cannot expand to macro definitions (see issue #54727) + --> $DIR/more-gates.rs:24:1 + | +LL | mac2mac1!(); //~ ERROR: cannot expand to macro definitions + | ^^^^^^^^^^^^ + | + = help: add #![feature(proc_macro_hygiene)] to the crate attributes to enable + +error[E0658]: procedural macros cannot expand to macro definitions (see issue #54727) + --> $DIR/more-gates.rs:25:1 + | +LL | mac2mac2!(); //~ ERROR: cannot expand to macro definitions + | ^^^^^^^^^^^^ + | + = help: add #![feature(proc_macro_hygiene)] to the crate attributes to enable + +error[E0658]: procedural macros cannot expand to macro definitions (see issue #54727) + --> $DIR/more-gates.rs:27:1 + | +LL | tricky!(); + | ^^^^^^^^^^ + | + = help: add #![feature(proc_macro_hygiene)] to the crate attributes to enable + +error: aborting due to 5 previous errors + +For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/compile-fail/proc-macro/no-macro-use-attr.rs b/src/test/ui/proc-macro/no-macro-use-attr.rs similarity index 100% rename from src/test/compile-fail/proc-macro/no-macro-use-attr.rs rename to src/test/ui/proc-macro/no-macro-use-attr.rs diff --git a/src/test/ui/proc-macro/no-macro-use-attr.stderr b/src/test/ui/proc-macro/no-macro-use-attr.stderr new file mode 100644 index 0000000000000..447cb26f056d4 --- /dev/null +++ b/src/test/ui/proc-macro/no-macro-use-attr.stderr @@ -0,0 +1,20 @@ +warning: unused extern crate + --> $DIR/no-macro-use-attr.rs:16:1 + | +LL | extern crate derive_a; + | ^^^^^^^^^^^^^^^^^^^^^^ help: remove it + | +note: lint level defined here + --> $DIR/no-macro-use-attr.rs:14:9 + | +LL | #![warn(unused_extern_crates)] + | ^^^^^^^^^^^^^^^^^^^^ + +error: compilation successful + --> $DIR/no-macro-use-attr.rs:20:1 + | +LL | fn main() {} //~ ERROR compilation successful + | ^^^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/src/test/compile-fail/proc-macro/proc-macro-attributes.rs b/src/test/ui/proc-macro/proc-macro-attributes.rs similarity index 100% rename from src/test/compile-fail/proc-macro/proc-macro-attributes.rs rename to src/test/ui/proc-macro/proc-macro-attributes.rs diff --git a/src/test/ui/proc-macro/proc-macro-attributes.stderr b/src/test/ui/proc-macro/proc-macro-attributes.stderr new file mode 100644 index 0000000000000..a1289c6356ae6 --- /dev/null +++ b/src/test/ui/proc-macro/proc-macro-attributes.stderr @@ -0,0 +1,11 @@ +error[E0658]: The attribute `C` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) + --> $DIR/proc-macro-attributes.rs:17:3 + | +LL | #[C] //~ ERROR attribute `C` is currently unknown to the compiler + | ^ + | + = help: add #![feature(custom_attribute)] 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/compile-fail/proc-macro/proc-macro-gates.rs b/src/test/ui/proc-macro/proc-macro-gates.rs similarity index 100% rename from src/test/compile-fail/proc-macro/proc-macro-gates.rs rename to src/test/ui/proc-macro/proc-macro-gates.rs diff --git a/src/test/ui/proc-macro/proc-macro-gates.stderr b/src/test/ui/proc-macro/proc-macro-gates.stderr new file mode 100644 index 0000000000000..d5c85d97b5464 --- /dev/null +++ b/src/test/ui/proc-macro/proc-macro-gates.stderr @@ -0,0 +1,137 @@ +error[E0658]: non-builtin inner attributes are unstable (see issue #54726) + --> $DIR/proc-macro-gates.rs:21:5 + | +LL | #![a] //~ ERROR: non-builtin inner attributes are unstable + | ^^^^^ + | + = help: add #![feature(custom_inner_attributes)] to the crate attributes to enable + +error[E0658]: non-builtin inner attributes are unstable (see issue #54726) + --> $DIR/proc-macro-gates.rs:28:5 + | +LL | #![a] //~ ERROR: custom attributes cannot be applied to modules + | ^^^^^ + | + = help: add #![feature(custom_inner_attributes)] to the crate attributes to enable + +error[E0658]: custom attributes cannot be applied to modules (see issue #54727) + --> $DIR/proc-macro-gates.rs:24:1 + | +LL | #[a] //~ ERROR: custom attributes cannot be applied to modules + | ^^^^ + | + = help: add #![feature(proc_macro_hygiene)] to the crate attributes to enable + +error[E0658]: custom attributes cannot be applied to modules (see issue #54727) + --> $DIR/proc-macro-gates.rs:28:5 + | +LL | #![a] //~ ERROR: custom attributes cannot be applied to modules + | ^^^^^ + | + = help: add #![feature(proc_macro_hygiene)] to the crate attributes to enable + +error: custom attribute invocations must be of the form #[foo] or #[foo(..)], the macro name must only be followed by a delimiter token + --> $DIR/proc-macro-gates.rs:32:1 + | +LL | #[a = y] //~ ERROR: must only be followed by a delimiter token + | ^^^^^^^^ + +error[E0658]: custom attributes cannot be applied to statements (see issue #54727) + --> $DIR/proc-macro-gates.rs:41:5 + | +LL | #[a] //~ ERROR: custom attributes cannot be applied to statements + | ^^^^ + | + = help: add #![feature(proc_macro_hygiene)] to the crate attributes to enable + +error[E0658]: custom attributes cannot be applied to statements (see issue #54727) + --> $DIR/proc-macro-gates.rs:45:5 + | +LL | #[a] //~ ERROR: custom attributes cannot be applied to statements + | ^^^^ + | + = help: add #![feature(proc_macro_hygiene)] to the crate attributes to enable + +error[E0658]: custom attributes cannot be applied to statements (see issue #54727) + --> $DIR/proc-macro-gates.rs:49:5 + | +LL | #[a] //~ ERROR: custom attributes cannot be applied to statements + | ^^^^ + | + = help: add #![feature(proc_macro_hygiene)] to the crate attributes to enable + +error[E0658]: custom attributes cannot be applied to expressions (see issue #54727) + --> $DIR/proc-macro-gates.rs:53:14 + | +LL | let _x = #[a] 2; //~ ERROR: custom attributes cannot be applied to expressions + | ^^^^ + | + = help: add #![feature(proc_macro_hygiene)] to the crate attributes to enable + +error[E0658]: custom attributes cannot be applied to expressions (see issue #54727) + --> $DIR/proc-macro-gates.rs:56:15 + | +LL | let _x = [#[a] 2]; //~ ERROR: custom attributes cannot be applied to expressions + | ^^^^ + | + = help: add #![feature(proc_macro_hygiene)] to the crate attributes to enable + +error[E0658]: custom attributes cannot be applied to expressions (see issue #54727) + --> $DIR/proc-macro-gates.rs:59:14 + | +LL | let _x = #[a] println!(); //~ ERROR: custom attributes cannot be applied to expressions + | ^^^^ + | + = help: add #![feature(proc_macro_hygiene)] to the crate attributes to enable + +error[E0658]: procedural macros cannot be expanded to types (see issue #54727) + --> $DIR/proc-macro-gates.rs:63:13 + | +LL | let _x: m!(u32) = 3; //~ ERROR: procedural macros cannot be expanded to types + | ^^^^^^^ + | + = help: add #![feature(proc_macro_hygiene)] to the crate attributes to enable + +error[E0658]: procedural macros cannot be expanded to patterns (see issue #54727) + --> $DIR/proc-macro-gates.rs:64:12 + | +LL | if let m!(Some(_x)) = Some(3) {} //~ ERROR: procedural macros cannot be expanded to patterns + | ^^^^^^^^^^^^ + | + = help: add #![feature(proc_macro_hygiene)] to the crate attributes to enable + +error[E0658]: procedural macros cannot be expanded to statements (see issue #54727) + --> $DIR/proc-macro-gates.rs:66:5 + | +LL | m!(struct S;); //~ ERROR: procedural macros cannot be expanded to statements + | ^^^^^^^^^^^^^^ + | + = help: add #![feature(proc_macro_hygiene)] to the crate attributes to enable + +error[E0658]: procedural macros cannot be expanded to statements (see issue #54727) + --> $DIR/proc-macro-gates.rs:67:5 + | +LL | m!(let _x = 3;); //~ ERROR: procedural macros cannot be expanded to statements + | ^^^^^^^^^^^^^^^^ + | + = help: add #![feature(proc_macro_hygiene)] to the crate attributes to enable + +error[E0658]: procedural macros cannot be expanded to expressions (see issue #54727) + --> $DIR/proc-macro-gates.rs:69:14 + | +LL | let _x = m!(3); //~ ERROR: procedural macros cannot be expanded to expressions + | ^^^^^ + | + = help: add #![feature(proc_macro_hygiene)] to the crate attributes to enable + +error[E0658]: procedural macros cannot be expanded to expressions (see issue #54727) + --> $DIR/proc-macro-gates.rs:70:15 + | +LL | let _x = [m!(3)]; //~ ERROR: procedural macros cannot be expanded to expressions + | ^^^^^ + | + = help: add #![feature(proc_macro_hygiene)] to the crate attributes to enable + +error: aborting due to 17 previous errors + +For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/compile-fail/proc-macro/proc-macro-gates2.rs b/src/test/ui/proc-macro/proc-macro-gates2.rs similarity index 100% rename from src/test/compile-fail/proc-macro/proc-macro-gates2.rs rename to src/test/ui/proc-macro/proc-macro-gates2.rs diff --git a/src/test/ui/proc-macro/proc-macro-gates2.stderr b/src/test/ui/proc-macro/proc-macro-gates2.stderr new file mode 100644 index 0000000000000..2c0f2b09f066b --- /dev/null +++ b/src/test/ui/proc-macro/proc-macro-gates2.stderr @@ -0,0 +1,19 @@ +error[E0658]: The attribute `a` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) + --> $DIR/proc-macro-gates2.rs:23:11 + | +LL | fn _test6<#[a] T>() {} + | ^^^^ + | + = help: add #![feature(custom_attribute)] to the crate attributes to enable + +error[E0658]: The attribute `a` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) + --> $DIR/proc-macro-gates2.rs:28:9 + | +LL | #[a] //~ ERROR: unknown to the compiler + | ^^^^ + | + = help: add #![feature(custom_attribute)] to the crate attributes to enable + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/compile-fail/proc-macro/pub-at-crate-root.rs b/src/test/ui/proc-macro/pub-at-crate-root.rs similarity index 100% rename from src/test/compile-fail/proc-macro/pub-at-crate-root.rs rename to src/test/ui/proc-macro/pub-at-crate-root.rs diff --git a/src/test/ui/proc-macro/pub-at-crate-root.stderr b/src/test/ui/proc-macro/pub-at-crate-root.stderr new file mode 100644 index 0000000000000..ba9a8605f1fd3 --- /dev/null +++ b/src/test/ui/proc-macro/pub-at-crate-root.stderr @@ -0,0 +1,32 @@ +error: `proc-macro` crate types cannot export any items other than functions tagged with `#[proc_macro_derive]` currently + --> $DIR/pub-at-crate-root.rs:18:1 + | +LL | / pub mod a { //~ `proc-macro` crate types cannot export any items +LL | | use proc_macro::TokenStream; +LL | | +LL | | #[proc_macro_derive(B)] +... | +LL | | } +LL | | } + | |_^ + +error: functions tagged with `#[proc_macro_derive]` must currently reside in the root of the crate + --> $DIR/pub-at-crate-root.rs:22:5 + | +LL | / pub fn bar(a: TokenStream) -> TokenStream { +LL | | //~^ ERROR: must currently reside in the root of the crate +LL | | a +LL | | } + | |_____^ + +error: functions tagged with `#[proc_macro_derive]` must be `pub` + --> $DIR/pub-at-crate-root.rs:29:1 + | +LL | / fn bar(a: proc_macro::TokenStream) -> proc_macro::TokenStream { +LL | | //~^ ERROR: functions tagged with `#[proc_macro_derive]` must be `pub` +LL | | a +LL | | } + | |_^ + +error: aborting due to 3 previous errors + diff --git a/src/test/compile-fail/proc-macro/shadow-builtin.rs b/src/test/ui/proc-macro/shadow-builtin.rs similarity index 100% rename from src/test/compile-fail/proc-macro/shadow-builtin.rs rename to src/test/ui/proc-macro/shadow-builtin.rs diff --git a/src/test/ui/proc-macro/shadow-builtin.stderr b/src/test/ui/proc-macro/shadow-builtin.stderr new file mode 100644 index 0000000000000..6d04c90738694 --- /dev/null +++ b/src/test/ui/proc-macro/shadow-builtin.stderr @@ -0,0 +1,8 @@ +error: cannot override a built-in #[derive] mode + --> $DIR/shadow-builtin.rs:20:21 + | +LL | #[proc_macro_derive(PartialEq)] + | ^^^^^^^^^ + +error: aborting due to previous error + diff --git a/src/test/compile-fail/proc-macro/shadow.rs b/src/test/ui/proc-macro/shadow.rs similarity index 100% rename from src/test/compile-fail/proc-macro/shadow.rs rename to src/test/ui/proc-macro/shadow.rs diff --git a/src/test/ui/proc-macro/shadow.stderr b/src/test/ui/proc-macro/shadow.stderr new file mode 100644 index 0000000000000..847fc73f9e019 --- /dev/null +++ b/src/test/ui/proc-macro/shadow.stderr @@ -0,0 +1,18 @@ +error[E0259]: the name `derive_a` is defined multiple times + --> $DIR/shadow.rs:16:1 + | +LL | extern crate derive_a; + | ---------------------- previous import of the extern crate `derive_a` here +LL | #[macro_use] +LL | extern crate derive_a; //~ ERROR the name `derive_a` is defined multiple times + | ^^^^^^^^^^^^^^^^^^^^^^ `derive_a` reimported here + | + = note: `derive_a` must be defined only once in the type namespace of this module +help: you can use `as` to change the binding name of the import + | +LL | extern crate derive_a as other_derive_a; //~ ERROR the name `derive_a` is defined multiple times + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0259`. diff --git a/src/test/compile-fail/proc-macro/two-crate-types-1.rs b/src/test/ui/proc-macro/two-crate-types-1.rs similarity index 100% rename from src/test/compile-fail/proc-macro/two-crate-types-1.rs rename to src/test/ui/proc-macro/two-crate-types-1.rs diff --git a/src/test/ui/proc-macro/two-crate-types-1.stderr b/src/test/ui/proc-macro/two-crate-types-1.stderr new file mode 100644 index 0000000000000..deaba1cf272fd --- /dev/null +++ b/src/test/ui/proc-macro/two-crate-types-1.stderr @@ -0,0 +1,4 @@ +error: cannot mix `proc-macro` crate type with others + +error: aborting due to previous error + diff --git a/src/test/compile-fail/proc-macro/two-crate-types-2.rs b/src/test/ui/proc-macro/two-crate-types-2.rs similarity index 100% rename from src/test/compile-fail/proc-macro/two-crate-types-2.rs rename to src/test/ui/proc-macro/two-crate-types-2.rs diff --git a/src/test/ui/proc-macro/two-crate-types-2.stderr b/src/test/ui/proc-macro/two-crate-types-2.stderr new file mode 100644 index 0000000000000..deaba1cf272fd --- /dev/null +++ b/src/test/ui/proc-macro/two-crate-types-2.stderr @@ -0,0 +1,4 @@ +error: cannot mix `proc-macro` crate type with others + +error: aborting due to previous error + diff --git a/src/tools/rustdoc-js/tester.js b/src/tools/rustdoc-js/tester.js index c8ce4cf8bb5be..f7c30df9f3ebb 100644 --- a/src/tools/rustdoc-js/tester.js +++ b/src/tools/rustdoc-js/tester.js @@ -259,6 +259,7 @@ function main(argv) { 'exports.QUERY = QUERY;exports.EXPECTED = EXPECTED;'); const expected = loadedFile.EXPECTED; const query = loadedFile.QUERY; + const filter_crate = loadedFile.FILTER_CRATE; const ignore_order = loadedFile.ignore_order; const exact_check = loadedFile.exact_check; const should_fail = loadedFile.should_fail; diff --git a/src/tools/tidy/src/features.rs b/src/tools/tidy/src/features.rs index 85b123e4af51f..259a549c89d89 100644 --- a/src/tools/tidy/src/features.rs +++ b/src/tools/tidy/src/features.rs @@ -61,12 +61,9 @@ pub fn check(path: &Path, bad: &mut bool, quiet: bool) { let mut contents = String::new(); - super::walk_many(&[&path.join("test/ui-fulldeps"), - &path.join("test/ui"), - &path.join("test/compile-fail"), - &path.join("test/compile-fail-fulldeps"), - &path.join("test/parse-fail"), - &path.join("test/ui"),], + super::walk_many(&[&path.join("test/ui"), + &path.join("test/ui-fulldeps"), + &path.join("test/compile-fail")], &mut |path| super::filter_dirs(path), &mut |file| { let filename = file.file_name().unwrap().to_string_lossy();