diff options
Diffstat (limited to 'src')
271 files changed, 1899 insertions, 1111 deletions
diff --git a/src/bootstrap/Cargo.toml b/src/bootstrap/Cargo.toml index c27c318f5ad..7be16cf3f17 100644 --- a/src/bootstrap/Cargo.toml +++ b/src/bootstrap/Cargo.toml @@ -47,7 +47,6 @@ serde_json = "1.0.2" toml = "0.5" lazy_static = "1.3.0" time = "0.1" -petgraph = "0.4.13" [dev-dependencies] pretty_assertions = "0.5" diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs index 8b0ad169cfc..2093a49c6f9 100644 --- a/src/bootstrap/builder.rs +++ b/src/bootstrap/builder.rs @@ -1,7 +1,6 @@ use std::any::Any; use std::cell::{Cell, RefCell}; use std::collections::BTreeSet; -use std::collections::HashMap; use std::env; use std::ffi::OsStr; use std::fmt::Debug; @@ -29,9 +28,6 @@ use crate::{Build, DocTests, Mode, GitRepo}; pub use crate::Compiler; -use petgraph::graph::NodeIndex; -use petgraph::Graph; - pub struct Builder<'a> { pub build: &'a Build, pub top_stage: u32, @@ -40,9 +36,6 @@ pub struct Builder<'a> { stack: RefCell<Vec<Box<dyn Any>>>, time_spent_on_dependencies: Cell<Duration>, pub paths: Vec<PathBuf>, - graph_nodes: RefCell<HashMap<String, NodeIndex>>, - graph: RefCell<Graph<String, bool>>, - parent: Cell<Option<NodeIndex>>, } impl<'a> Deref for Builder<'a> { @@ -490,9 +483,6 @@ impl<'a> Builder<'a> { stack: RefCell::new(Vec::new()), time_spent_on_dependencies: Cell::new(Duration::new(0, 0)), paths: vec![], - graph_nodes: RefCell::new(HashMap::new()), - graph: RefCell::new(Graph::new()), - parent: Cell::new(None), }; let builder = &builder; @@ -535,17 +525,13 @@ impl<'a> Builder<'a> { stack: RefCell::new(Vec::new()), time_spent_on_dependencies: Cell::new(Duration::new(0, 0)), paths: paths.to_owned(), - graph_nodes: RefCell::new(HashMap::new()), - graph: RefCell::new(Graph::new()), - parent: Cell::new(None), }; builder } - pub fn execute_cli(&self) -> Graph<String, bool> { + pub fn execute_cli(&self) { self.run_step_descriptions(&Builder::get_step_descriptions(self.kind), &self.paths); - self.graph.borrow().clone() } pub fn default_doc(&self, paths: Option<&[PathBuf]>) { @@ -1260,41 +1246,12 @@ impl<'a> Builder<'a> { if let Some(out) = self.cache.get(&step) { self.verbose(&format!("{}c {:?}", " ".repeat(stack.len()), step)); - { - let mut graph = self.graph.borrow_mut(); - let parent = self.parent.get(); - let us = *self - .graph_nodes - .borrow_mut() - .entry(format!("{:?}", step)) - .or_insert_with(|| graph.add_node(format!("{:?}", step))); - if let Some(parent) = parent { - graph.add_edge(parent, us, false); - } - } - return out; } self.verbose(&format!("{}> {:?}", " ".repeat(stack.len()), step)); stack.push(Box::new(step.clone())); } - let prev_parent = self.parent.get(); - - { - let mut graph = self.graph.borrow_mut(); - let parent = self.parent.get(); - let us = *self - .graph_nodes - .borrow_mut() - .entry(format!("{:?}", step)) - .or_insert_with(|| graph.add_node(format!("{:?}", step))); - self.parent.set(Some(us)); - if let Some(parent) = parent { - graph.add_edge(parent, us, true); - } - } - let (out, dur) = { let start = Instant::now(); let zero = Duration::new(0, 0); @@ -1305,8 +1262,6 @@ impl<'a> Builder<'a> { (out, dur - deps) }; - self.parent.set(prev_parent); - if self.config.print_step_timings && dur > Duration::from_millis(100) { println!( "[TIMING] {:?} -- {}.{:03}", diff --git a/src/bootstrap/util.rs b/src/bootstrap/util.rs index 6824b7a58c4..085742b011c 100644 --- a/src/bootstrap/util.rs +++ b/src/bootstrap/util.rs @@ -270,9 +270,9 @@ pub enum CiEnv { impl CiEnv { /// Obtains the current CI environment. pub fn current() -> CiEnv { - if env::var("TF_BUILD").ok().map_or(false, |e| &*e == "True") { + if env::var("TF_BUILD").map_or(false, |e| e == "True") { CiEnv::AzurePipelines - } else if env::var("GITHUB_ACTIONS").ok().map_or(false, |e| &*e == "true") { + } else if env::var("GITHUB_ACTIONS").map_or(false, |e| e == "true") { CiEnv::GitHubActions } else { CiEnv::None diff --git a/src/doc/book b/src/doc/book -Subproject 81ebaa2a3f88d4d106516c489682e64cacba4f6 +Subproject ef8bb568035ded8ddfa30a9309026638cc3c813 diff --git a/src/doc/embedded-book b/src/doc/embedded-book -Subproject 5ca585c4a7552efb546e7681c3de0712f4ae4fd +Subproject c26234930282210849256e4ecab925f0f2daf3b diff --git a/src/doc/nomicon b/src/doc/nomicon -Subproject 041c46e692a2592853aeca132c8dfe8eb5a79a9 +Subproject 8be35b201f9cf0a4c3fcc96c83ac21671dcf311 diff --git a/src/doc/rust-by-example b/src/doc/rust-by-example -Subproject 4835e025826729827a94fdeb7cb85fed288d08b +Subproject b7ac1bc76b7d02a43c83b3a931d226f708aa1ff diff --git a/src/libcore/any.rs b/src/libcore/any.rs index 882c4a53faf..a2aa6b3fea5 100644 --- a/src/libcore/any.rs +++ b/src/libcore/any.rs @@ -496,7 +496,6 @@ pub const fn type_name<T: ?Sized>() -> &'static str { /// ``` #[unstable(feature = "type_name_of_val", issue = "66359")] #[rustc_const_unstable(feature = "const_type_name", issue = "63084")] -pub const fn type_name_of_val<T: ?Sized>(val: &T) -> &'static str { - let _ = val; +pub const fn type_name_of_val<T: ?Sized>(_val: &T) -> &'static str { type_name::<T>() } diff --git a/src/libcore/ops/range.rs b/src/libcore/ops/range.rs index be6d8edb99f..d38b3516569 100644 --- a/src/libcore/ops/range.rs +++ b/src/libcore/ops/range.rs @@ -333,6 +333,11 @@ impl<Idx: PartialOrd<Idx>> RangeTo<Idx> { #[derive(Clone)] // not Copy -- see #27186 #[stable(feature = "inclusive_range", since = "1.26.0")] pub struct RangeInclusive<Idx> { + // Note that the fields here are not public to allow changing the + // representation in the future; in particular, while we could plausibly + // expose start/end, modifying them without changing (future/current) + // private fields may lead to incorrect behavior, so we don't want to + // support that mode. pub(crate) start: Idx, pub(crate) end: Idx, pub(crate) is_empty: Option<bool>, diff --git a/src/librustc/infer/error_reporting/mod.rs b/src/librustc/infer/error_reporting/mod.rs index c9d57706d55..fca0632a4a6 100644 --- a/src/librustc/infer/error_reporting/mod.rs +++ b/src/librustc/infer/error_reporting/mod.rs @@ -1912,6 +1912,7 @@ impl<'tcx> ObligationCause<'tcx> { use crate::traits::ObligationCauseCode::*; match self.code { CompareImplMethodObligation { .. } => Error0308("method not compatible with trait"), + CompareImplTypeObligation { .. } => Error0308("type not compatible with trait"), MatchExpressionArm(box MatchExpressionArmCause { source, .. }) => Error0308(match source { hir::MatchSource::IfLetDesugar { .. } => @@ -1948,6 +1949,7 @@ impl<'tcx> ObligationCause<'tcx> { use crate::traits::ObligationCauseCode::*; match self.code { CompareImplMethodObligation { .. } => "method type is compatible with trait", + CompareImplTypeObligation { .. } => "associated type is compatible with trait", ExprAssignable => "expression is assignable", MatchExpressionArm(box MatchExpressionArmCause { source, .. }) => match source { hir::MatchSource::IfLetDesugar { .. } => "`if let` arms have compatible types", diff --git a/src/librustc/traits/error_reporting.rs b/src/librustc/traits/error_reporting.rs index 735627578a6..b299fd6117e 100644 --- a/src/librustc/traits/error_reporting.rs +++ b/src/librustc/traits/error_reporting.rs @@ -702,6 +702,8 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> { SelectionError::Unimplemented => { if let ObligationCauseCode::CompareImplMethodObligation { item_name, impl_item_def_id, trait_item_def_id, + } | ObligationCauseCode::CompareImplTypeObligation { + item_name, impl_item_def_id, trait_item_def_id, } = obligation.cause.code { self.report_extra_impl_obligation( span, @@ -2631,6 +2633,12 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> { but not on the corresponding trait method", predicate)); } + ObligationCauseCode::CompareImplTypeObligation { .. } => { + err.note(&format!( + "the requirement `{}` appears on the associated impl type\ + but not on the corresponding associated trait type", + predicate)); + } ObligationCauseCode::ReturnType | ObligationCauseCode::ReturnValue(_) | ObligationCauseCode::BlockTailExpression(_) => (), diff --git a/src/librustc/traits/mod.rs b/src/librustc/traits/mod.rs index d94e004db29..8baedfed9d6 100644 --- a/src/librustc/traits/mod.rs +++ b/src/librustc/traits/mod.rs @@ -230,6 +230,13 @@ pub enum ObligationCauseCode<'tcx> { trait_item_def_id: DefId, }, + /// Error derived when matching traits/impls; see ObligationCause for more details + CompareImplTypeObligation { + item_name: ast::Name, + impl_item_def_id: DefId, + trait_item_def_id: DefId, + }, + /// Checking that this expression can be assigned where it needs to be // FIXME(eddyb) #11161 is the original Expr required? ExprAssignable, diff --git a/src/librustc/traits/project.rs b/src/librustc/traits/project.rs index 1fdec5f0152..408743d5788 100644 --- a/src/librustc/traits/project.rs +++ b/src/librustc/traits/project.rs @@ -23,6 +23,7 @@ use crate::ty::subst::{Subst, InternalSubsts}; use crate::ty::{self, ToPredicate, ToPolyTraitRef, Ty, TyCtxt}; use crate::ty::fold::{TypeFoldable, TypeFolder}; use crate::util::common::FN_OUTPUT_NAME; +use syntax_pos::DUMMY_SP; /// Depending on the stage of compilation, we want projection to be /// more or less conservative. @@ -1437,11 +1438,14 @@ fn confirm_impl_candidate<'cx, 'tcx>( obligation: &ProjectionTyObligation<'tcx>, impl_vtable: VtableImplData<'tcx, PredicateObligation<'tcx>>, ) -> Progress<'tcx> { + let tcx = selcx.tcx(); + let VtableImplData { impl_def_id, substs, nested } = impl_vtable; + let assoc_item_id = obligation.predicate.item_def_id; + let trait_def_id = tcx.trait_id_of_impl(impl_def_id).unwrap(); - let tcx = selcx.tcx(); let param_env = obligation.param_env; - let assoc_ty = assoc_ty_def(selcx, impl_def_id, obligation.predicate.item_def_id); + let assoc_ty = assoc_ty_def(selcx, impl_def_id, assoc_item_id); if !assoc_ty.item.defaultness.has_value() { // This means that the impl is missing a definition for the @@ -1456,6 +1460,7 @@ fn confirm_impl_candidate<'cx, 'tcx>( obligations: nested, }; } + let substs = obligation.predicate.substs.rebase_onto(tcx, trait_def_id, substs); let substs = translate_substs(selcx.infcx(), param_env, impl_def_id, substs, assoc_ty.node); let ty = if let ty::AssocKind::OpaqueTy = assoc_ty.item.kind { let item_substs = InternalSubsts::identity_for_item(tcx, assoc_ty.item.def_id); @@ -1463,9 +1468,20 @@ fn confirm_impl_candidate<'cx, 'tcx>( } else { tcx.type_of(assoc_ty.item.def_id) }; - Progress { - ty: ty.subst(tcx, substs), - obligations: nested, + if substs.len() != tcx.generics_of(assoc_ty.item.def_id).count() { + tcx.sess.delay_span_bug( + DUMMY_SP, + "impl item and trait item have different parameter counts", + ); + Progress { + ty: tcx.types.err, + obligations: nested, + } + } else { + Progress { + ty: ty.subst(tcx, substs), + obligations: nested, + } } } diff --git a/src/librustc/traits/structural_impls.rs b/src/librustc/traits/structural_impls.rs index 8c300da11fc..1e78b79ebb6 100644 --- a/src/librustc/traits/structural_impls.rs +++ b/src/librustc/traits/structural_impls.rs @@ -514,6 +514,15 @@ impl<'a, 'tcx> Lift<'tcx> for traits::ObligationCauseCode<'a> { impl_item_def_id, trait_item_def_id, }), + super::CompareImplTypeObligation { + item_name, + impl_item_def_id, + trait_item_def_id, + } => Some(super::CompareImplTypeObligation { + item_name, + impl_item_def_id, + trait_item_def_id, + }), super::ExprAssignable => Some(super::ExprAssignable), super::MatchExpressionArm(box super::MatchExpressionArmCause { arm_span, diff --git a/src/librustc/ty/mod.rs b/src/librustc/ty/mod.rs index 62fea7c31a9..37a443a2c74 100644 --- a/src/librustc/ty/mod.rs +++ b/src/librustc/ty/mod.rs @@ -1305,7 +1305,7 @@ impl<'tcx> PolyProjectionPredicate<'tcx> { } #[inline] - pub fn to_poly_trait_ref(&self, tcx: TyCtxt<'_>) -> PolyTraitRef<'tcx> { + pub fn to_poly_trait_ref(&self, tcx: TyCtxt<'tcx>) -> PolyTraitRef<'tcx> { // Note: unlike with `TraitRef::to_poly_trait_ref()`, // `self.0.trait_ref` is permitted to have escaping regions. // This is because here `self` has a `Binder` and so does our diff --git a/src/librustc/ty/sty.rs b/src/librustc/ty/sty.rs index ea4369c0180..02efe8df03d 100644 --- a/src/librustc/ty/sty.rs +++ b/src/librustc/ty/sty.rs @@ -1026,11 +1026,11 @@ impl<'tcx> ProjectionTy<'tcx> { /// Extracts the underlying trait reference from this projection. /// For example, if this is a projection of `<T as Iterator>::Item`, /// then this function would return a `T: Iterator` trait reference. - pub fn trait_ref(&self, tcx: TyCtxt<'_>) -> ty::TraitRef<'tcx> { + pub fn trait_ref(&self, tcx: TyCtxt<'tcx>) -> ty::TraitRef<'tcx> { let def_id = tcx.associated_item(self.item_def_id).container.id(); ty::TraitRef { def_id, - substs: self.substs, + substs: self.substs.truncate_to(tcx, tcx.generics_of(def_id)), } } diff --git a/src/librustc/ty/subst.rs b/src/librustc/ty/subst.rs index a8a17fe9d7d..217188a6f04 100644 --- a/src/librustc/ty/subst.rs +++ b/src/librustc/ty/subst.rs @@ -234,7 +234,7 @@ impl<'a, 'tcx> InternalSubsts<'tcx> { ty::GenericParamDefKind::Const => { tcx.mk_const(ty::Const { val: ty::ConstKind::Bound(ty::INNERMOST, ty::BoundVar::from(param.index)), - ty: tcx.type_of(def_id), + ty: tcx.type_of(param.def_id), }).into() } } @@ -533,8 +533,7 @@ impl<'a, 'tcx> TypeFolder<'tcx> for SubstFolder<'a, 'tcx> { data.name, self.root_ty, data.index); - self.tcx.sess.delay_span_bug(span, &msg); - r + span_bug!(span, "{}", msg); } } } diff --git a/src/librustc_mir/transform/inline.rs b/src/librustc_mir/transform/inline.rs index 9763913082d..dca14227946 100644 --- a/src/librustc_mir/transform/inline.rs +++ b/src/librustc_mir/transform/inline.rs @@ -663,9 +663,9 @@ impl<'a, 'tcx> Integrator<'a, 'tcx> { fn make_integrate_local(&self, local: &Local) -> Local { if *local == RETURN_PLACE { - match self.destination.as_local() { - Some(l) => return l, - ref place => bug!("Return place is {:?}, not local", place), + match self.destination.base { + PlaceBase::Local(l) => return l, + PlaceBase::Static(ref s) => bug!("Return place is {:?}, not local", s), } } @@ -695,14 +695,24 @@ impl<'a, 'tcx> MutVisitor<'tcx> for Integrator<'a, 'tcx> { fn visit_place( &mut self, place: &mut Place<'tcx>, - context: PlaceContext, - location: Location, + _context: PlaceContext, + _location: Location, ) { - if let Some(RETURN_PLACE) = place.as_local() { - // Return pointer; update the place itself - *place = self.destination.clone(); - } else { - self.super_place(place, context, location); + match &mut place.base { + PlaceBase::Static(_) => {}, + PlaceBase::Local(l) => { + // If this is the `RETURN_PLACE`, we need to rebase any projections onto it. + let dest_proj_len = self.destination.projection.len(); + if *l == RETURN_PLACE && dest_proj_len > 0 { + let mut projs = Vec::with_capacity(dest_proj_len + place.projection.len()); + projs.extend(self.destination.projection); + projs.extend(place.projection); + + place.projection = self.tcx.intern_place_elems(&*projs); + } + + *l = self.make_integrate_local(l); + } } } diff --git a/src/librustc_resolve/late.rs b/src/librustc_resolve/late.rs index 43ac8599334..df81231cf98 100644 --- a/src/librustc_resolve/late.rs +++ b/src/librustc_resolve/late.rs @@ -1119,7 +1119,7 @@ impl<'a, 'b> LateResolutionVisitor<'a, '_> { visit::walk_impl_item(this, impl_item); } - AssocItemKind::TyAlias(_, Some(ref ty)) => { + AssocItemKind::TyAlias(_, _) => { // If this is a trait impl, ensure the type // exists in trait this.check_trait_item(impl_item.ident, @@ -1127,9 +1127,8 @@ impl<'a, 'b> LateResolutionVisitor<'a, '_> { impl_item.span, |n, s| TypeNotMemberOfTrait(n, s)); - this.visit_ty(ty); + visit::walk_impl_item(this, impl_item); } - AssocItemKind::TyAlias(_, None) => {} AssocItemKind::Macro(_) => panic!("unexpanded macro in resolve!"), } diff --git a/src/librustc_typeck/astconv.rs b/src/librustc_typeck/astconv.rs index 290f86d626e..9b737428d5a 100644 --- a/src/librustc_typeck/astconv.rs +++ b/src/librustc_typeck/astconv.rs @@ -88,6 +88,7 @@ pub trait AstConv<'tcx> { fn projected_ty_from_poly_trait_ref(&self, span: Span, item_def_id: DefId, + item_segment: &hir::PathSegment, poly_trait_ref: ty::PolyTraitRef<'tcx>) -> Ty<'tcx>; @@ -205,6 +206,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { let (substs, assoc_bindings, _) = self.create_substs_for_ast_path( span, def_id, + &[], item_segment.generic_args(), item_segment.infer_args, None, @@ -615,9 +617,21 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { /// `Output = u32` are returned in the `Vec<ConvertedBinding...>` result. /// /// Note that the type listing given here is *exactly* what the user provided. + /// + /// For (generic) associated types + /// + /// ``` + /// <Vec<u8> as Iterable<u8>>::Iter::<'a> + /// ``` + /// + /// We have the parent substs are the substs for the parent trait: + /// `[Vec<u8>, u8]` and `generic_args` are the arguments for the associated + /// type itself: `['a]`. The returned `SubstsRef` concatenates these two + /// lists: `[Vec<u8>, u8, 'a]`. fn create_substs_for_ast_path<'a>(&self, span: Span, def_id: DefId, + parent_substs: &[subst::GenericArg<'tcx>], generic_args: &'a hir::GenericArgs, infer_args: bool, self_ty: Option<Ty<'tcx>>) @@ -633,17 +647,26 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { let tcx = self.tcx(); let generic_params = tcx.generics_of(def_id); - // If a self-type was declared, one should be provided. - assert_eq!(generic_params.has_self, self_ty.is_some()); + if generic_params.has_self { + if generic_params.parent.is_some() { + // The parent is a trait so it should have at least one subst + // for the `Self` type. + assert!(!parent_substs.is_empty()) + } else { + // This item (presumably a trait) needs a self-type. + assert!(self_ty.is_some()); + } + } else { + assert!(self_ty.is_none() && parent_substs.is_empty()); + } - let has_self = generic_params.has_self; let (_, potential_assoc_types) = Self::check_generic_arg_count( tcx, span, &generic_params, &generic_args, GenericArgPosition::Type, - has_self, + self_ty.is_some(), infer_args, ); @@ -652,7 +675,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { }); let default_needs_object_self = |param: &ty::GenericParamDef| { if let GenericParamDefKind::Type { has_default, .. } = param.kind { - if is_object && has_default && has_self { + if is_object && has_default { let self_param = tcx.types.self_param; if tcx.at(span).type_of(param.def_id).walk().any(|ty| ty == self_param) { // There is no suitable inference default for a type parameter @@ -668,7 +691,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { let substs = Self::create_substs_for_generic_args( tcx, def_id, - &[][..], + parent_substs, self_ty.is_some(), self_ty, // Provide the generic args, and whether types should be inferred. @@ -780,6 +803,30 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { (substs, assoc_bindings, potential_assoc_types) } + crate fn create_substs_for_associated_item( + &self, + tcx: TyCtxt<'tcx>, + span: Span, + item_def_id: DefId, + item_segment: &hir::PathSegment, + parent_substs: SubstsRef<'tcx>, + ) -> SubstsRef<'tcx> { + if tcx.generics_of(item_def_id).params.is_empty() { + self.prohibit_generics(slice::from_ref(item_segment)); + + parent_substs + } else { + self.create_substs_for_ast_path( + span, + item_def_id, + parent_substs, + item_segment.generic_args(), + item_segment.infer_args, + None, + ).0 + } + } + /// Instantiates the path for the given trait reference, assuming that it's /// bound to a valid trait type. Returns the `DefId` of the defining trait. /// The type _cannot_ be a type other than a trait type. @@ -919,6 +966,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { self.create_substs_for_ast_path(span, trait_def_id, + &[], trait_segment.generic_args(), trait_segment.infer_args, Some(self_ty)) @@ -1665,8 +1713,6 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { debug!("associated_path_to_ty: {:?}::{}", qself_ty, assoc_ident); - self.prohibit_generics(slice::from_ref(assoc_segment)); - // Check if we have an enum variant. let mut variant_resolution = None; if let ty::Adt(adt_def, _) = qself_ty.kind { @@ -1677,6 +1723,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { if let Some(variant_def) = variant_def { if permit_variants { tcx.check_stability(variant_def.def_id, Some(hir_ref_id), span); + self.prohibit_generics(slice::from_ref(assoc_segment)); return Ok((qself_ty, DefKind::Variant, variant_def.def_id)); } else { variant_resolution = Some(variant_def.def_id); @@ -1767,7 +1814,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { i.ident.modern() == assoc_ident }).expect("missing associated type"); - let ty = self.projected_ty_from_poly_trait_ref(span, item.def_id, bound); + let ty = self.projected_ty_from_poly_trait_ref(span, item.def_id, assoc_segment, bound); let ty = self.normalize_ty(span, ty); let kind = DefKind::AssocTy; @@ -1818,8 +1865,6 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { debug!("qpath_to_ty: trait_def_id={:?}", trait_def_id); - self.prohibit_generics(slice::from_ref(item_segment)); - let self_ty = if let Some(ty) = opt_self_ty { ty } else { @@ -1861,9 +1906,17 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { self_ty, trait_segment); + let item_substs = self.create_substs_for_associated_item( + tcx, + span, + item_def_id, + item_segment, + trait_ref.substs, + ); + debug!("qpath_to_ty: trait_ref={:?}", trait_ref); - self.normalize_ty(span, tcx.mk_projection(item_def_id, trait_ref.substs)) + self.normalize_ty(span, tcx.mk_projection(item_def_id, item_substs)) } pub fn prohibit_generics<'a, T: IntoIterator<Item = &'a hir::PathSegment>>( @@ -2518,10 +2571,10 @@ impl<'tcx> Bounds<'tcx> { // If it could be sized, and is, add the `Sized` predicate. let sized_predicate = self.implicitly_sized.and_then(|span| { tcx.lang_items().sized_trait().map(|sized| { - let trait_ref = ty::TraitRef { + let trait_ref = ty::Binder::bind(ty::TraitRef { def_id: sized, substs: tcx.mk_substs_trait(param_ty, &[]) - }; + }); (trait_ref.to_predicate(), span) }) }); @@ -2529,10 +2582,11 @@ impl<'tcx> Bounds<'tcx> { sized_predicate.into_iter().chain( self.region_bounds.iter().map(|&(region_bound, span)| { // Account for the binder being introduced below; no need to shift `param_ty` - // because, at present at least, it can only refer to early-bound regions. + // because, at present at least, it either only refers to early-bound regions, + // or it's a generic associated type that deliberately has escaping bound vars. let region_bound = ty::fold::shift_region(tcx, region_bound, 1); let outlives = ty::OutlivesPredicate(param_ty, region_bound); - (ty::Binder::dummy(outlives).to_predicate(), span) + (ty::Binder::bind(outlives).to_predicate(), span) }).chain( self.trait_bounds.iter().map(|&(bound_trait_ref, span)| { (bound_trait_ref.to_predicate(), span) diff --git a/src/librustc_typeck/check/compare_method.rs b/src/librustc_typeck/check/compare_method.rs index ab8a4e5a9d0..4dba2fb96eb 100644 --- a/src/librustc_typeck/check/compare_method.rs +++ b/src/librustc_typeck/check/compare_method.rs @@ -5,7 +5,7 @@ use rustc::ty::{self, TyCtxt, GenericParamDefKind}; use rustc::ty::util::ExplicitSelf; use rustc::traits::{self, ObligationCause, ObligationCauseCode, Reveal}; use rustc::ty::error::{ExpectedFound, TypeError}; -use rustc::ty::subst::{Subst, InternalSubsts, SubstsRef}; +use rustc::ty::subst::{Subst, InternalSubsts}; use rustc::util::common::ErrorReported; use errors::{Applicability, DiagnosticId}; @@ -26,7 +26,7 @@ use rustc_error_codes::*; /// - `trait_m`: the method in the trait /// - `impl_trait_ref`: the TraitRef corresponding to the trait implementation -pub fn compare_impl_method<'tcx>( +crate fn compare_impl_method<'tcx>( tcx: TyCtxt<'tcx>, impl_m: &ty::AssocItem, impl_m_span: Span, @@ -181,13 +181,14 @@ fn compare_predicate_entailment<'tcx>( let trait_m_predicates = tcx.predicates_of(trait_m.def_id); // Check region bounds. - check_region_bounds_on_impl_method(tcx, - impl_m_span, - impl_m, - trait_m, - &trait_m_generics, - &impl_m_generics, - trait_to_skol_substs)?; + check_region_bounds_on_impl_item( + tcx, + impl_m_span, + impl_m, + trait_m, + &trait_m_generics, + &impl_m_generics, + )?; // Create obligations for each predicate declared by the impl // definition in the context of the trait's parameter @@ -361,25 +362,22 @@ fn compare_predicate_entailment<'tcx>( }) } -fn check_region_bounds_on_impl_method<'tcx>( +fn check_region_bounds_on_impl_item<'tcx>( tcx: TyCtxt<'tcx>, span: Span, impl_m: &ty::AssocItem, trait_m: &ty::AssocItem, trait_generics: &ty::Generics, impl_generics: &ty::Generics, - trait_to_skol_substs: SubstsRef<'tcx>, ) -> Result<(), ErrorReported> { let trait_params = trait_generics.own_counts().lifetimes; let impl_params = impl_generics.own_counts().lifetimes; - debug!("check_region_bounds_on_impl_method: \ + debug!("check_region_bounds_on_impl_item: \ trait_generics={:?} \ - impl_generics={:?} \ - trait_to_skol_substs={:?}", + impl_generics={:?}", trait_generics, - impl_generics, - trait_to_skol_substs); + impl_generics); // Must have same number of early-bound lifetime parameters. // Unfortunately, if the user screws up the bounds, then this @@ -391,20 +389,25 @@ fn check_region_bounds_on_impl_method<'tcx>( // are zero. Since I don't quite know how to phrase things at // the moment, give a kind of vague error message. if trait_params != impl_params { + let item_kind = assoc_item_kind_str(impl_m); let def_span = tcx.sess.source_map().def_span(span); let span = tcx.hir().get_generics(impl_m.def_id).map(|g| g.span).unwrap_or(def_span); let mut err = struct_span_err!( tcx.sess, span, E0195, - "lifetime parameters or bounds on method `{}` do not match the trait declaration", + "lifetime parameters or bounds on {} `{}` do not match the trait declaration", + item_kind, impl_m.ident, ); - err.span_label(span, "lifetimes do not match method in trait"); + err.span_label(span, &format!("lifetimes do not match {} in trait", item_kind)); if let Some(sp) = tcx.hir().span_if_local(trait_m.def_id) { let def_sp = tcx.sess.source_map().def_span(sp); let sp = tcx.hir().get_generics(trait_m.def_id).map(|g| g.span).unwrap_or(def_sp); - err.span_label(sp, "lifetimes in impl do not match this method in trait"); + err.span_label( + sp, + &format!("lifetimes in impl do not match this {} in trait", item_kind), + ); } err.emit(); return Err(ErrorReported); @@ -603,6 +606,8 @@ fn compare_number_of_generics<'tcx>( ("const", trait_own_counts.consts, impl_own_counts.consts), ]; + let item_kind = assoc_item_kind_str(impl_); + let mut err_occurred = false; for &(kind, trait_count, impl_count) in &matchings { if impl_count != trait_count { @@ -647,8 +652,9 @@ fn compare_number_of_generics<'tcx>( let mut err = tcx.sess.struct_span_err_with_code( spans, &format!( - "method `{}` has {} {kind} parameter{} but its trait \ + "{} `{}` has {} {kind} parameter{} but its trait \ declaration has {} {kind} parameter{}", + item_kind, trait_.ident, impl_count, pluralize!(impl_count), @@ -961,7 +967,7 @@ fn compare_synthetic_generics<'tcx>( } } -pub fn compare_const_impl<'tcx>( +crate fn compare_const_impl<'tcx>( tcx: TyCtxt<'tcx>, impl_c: &ty::AssocItem, impl_c_span: Span, @@ -1059,3 +1065,131 @@ pub fn compare_const_impl<'tcx>( fcx.regionck_item(impl_c_hir_id, impl_c_span, &[]); }); } + +crate fn compare_ty_impl<'tcx>( + tcx: TyCtxt<'tcx>, + impl_ty: &ty::AssocItem, + impl_ty_span: Span, + trait_ty: &ty::AssocItem, + impl_trait_ref: ty::TraitRef<'tcx>, + trait_item_span: Option<Span>, +) { + debug!("compare_impl_type(impl_trait_ref={:?})", impl_trait_ref); + + let _: Result<(), ErrorReported> = (|| { + compare_number_of_generics(tcx, impl_ty, impl_ty_span, trait_ty, trait_item_span)?; + + compare_type_predicate_entailment(tcx, impl_ty, impl_ty_span, trait_ty, impl_trait_ref) + })(); +} + +/// The equivalent of [compare_predicate_entailment], but for associated types +/// instead of associated functions. +fn compare_type_predicate_entailment( + tcx: TyCtxt<'tcx>, + impl_ty: &ty::AssocItem, + impl_ty_span: Span, + trait_ty: &ty::AssocItem, + impl_trait_ref: ty::TraitRef<'tcx>, +) -> Result<(), ErrorReported> { + let impl_substs = InternalSubsts::identity_for_item(tcx, impl_ty.def_id); + let trait_to_impl_substs = impl_substs.rebase_onto(tcx, + impl_ty.container.id(), + impl_trait_ref.substs); + + let impl_ty_generics = tcx.generics_of(impl_ty.def_id); + let trait_ty_generics = tcx.generics_of(trait_ty.def_id); + let impl_ty_predicates = tcx.predicates_of(impl_ty.def_id); + let trait_ty_predicates = tcx.predicates_of(trait_ty.def_id); + + check_region_bounds_on_impl_item( + tcx, + impl_ty_span, + impl_ty, + trait_ty, + &trait_ty_generics, + &impl_ty_generics, + )?; + + let impl_ty_own_bounds = impl_ty_predicates.instantiate_own(tcx, impl_substs); + + if impl_ty_own_bounds.is_empty() { + // Nothing to check. + return Ok(()); + } + + // This `HirId` should be used for the `body_id` field on each + // `ObligationCause` (and the `FnCtxt`). This is what + // `regionck_item` expects. + let impl_ty_hir_id = tcx.hir().as_local_hir_id(impl_ty.def_id).unwrap(); + let cause = ObligationCause { + span: impl_ty_span, + body_id: impl_ty_hir_id, + code: ObligationCauseCode::CompareImplTypeObligation { + item_name: impl_ty.ident.name, + impl_item_def_id: impl_ty.def_id, + trait_item_def_id: trait_ty.def_id, + }, + }; + + debug!("compare_type_predicate_entailment: trait_to_impl_substs={:?}", trait_to_impl_substs); + + // The predicates declared by the impl definition, the trait and the + // associated type in the trait are assumed. + let impl_predicates = tcx.predicates_of(impl_ty_predicates.parent.unwrap()); + let mut hybrid_preds = impl_predicates.instantiate_identity(tcx); + hybrid_preds.predicates.extend( + trait_ty_predicates.instantiate_own(tcx, trait_to_impl_substs).predicates); + + debug!("compare_type_predicate_entailment: bounds={:?}", hybrid_preds); + + let normalize_cause = traits::ObligationCause::misc(impl_ty_span, impl_ty_hir_id); + let param_env = ty::ParamEnv::new( + tcx.intern_predicates(&hybrid_preds.predicates), + Reveal::UserFacing, + None + ); + let param_env = traits::normalize_param_env_or_error(tcx, + impl_ty.def_id, + param_env, + normalize_cause.clone()); + tcx.infer_ctxt().enter(|infcx| { + let inh = Inherited::new(infcx, impl_ty.def_id); + let infcx = &inh.infcx; + + debug!("compare_type_predicate_entailment: caller_bounds={:?}", + param_env.caller_bounds); + + let mut selcx = traits::SelectionContext::new(&infcx); + + for predicate in impl_ty_own_bounds.predicates { + let traits::Normalized { value: predicate, obligations } = + traits::normalize(&mut selcx, param_env, normalize_cause.clone(), &predicate); + + inh.register_predicates(obligations); + inh.register_predicate(traits::Obligation::new(cause.clone(), param_env, predicate)); + } + + // Check that all obligations are satisfied by the implementation's + // version. + if let Err(ref errors) = inh.fulfillment_cx.borrow_mut().select_all_or_error(&infcx) { + infcx.report_fulfillment_errors(errors, None, false); + return Err(ErrorReported); + } + + // Finally, resolve all regions. This catches wily misuses of + // lifetime parameters. + let fcx = FnCtxt::new(&inh, param_env, impl_ty_hir_id); + fcx.regionck_item(impl_ty_hir_id, impl_ty_span, &[]); + + Ok(()) + }) +} + +fn assoc_item_kind_str(impl_item: &ty::AssocItem) -> &'static str { + match impl_item.kind { + ty::AssocKind::Const => "const", + ty::AssocKind::Method => "method", + ty::AssocKind::Type | ty::AssocKind::OpaqueTy => "type", + } +} diff --git a/src/librustc_typeck/check/demand.rs b/src/librustc_typeck/check/demand.rs index 6a78a4d733a..1e3ede4c182 100644 --- a/src/librustc_typeck/check/demand.rs +++ b/src/librustc_typeck/check/demand.rs @@ -551,15 +551,15 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { // Check for `Deref` implementations by constructing a predicate to // prove: `<T as Deref>::Output == U` let deref_trait = self.tcx.lang_items().deref_trait().unwrap(); - let item_def_id = self.tcx.associated_items(deref_trait).next().unwrap().def_id; + let item_def_id = self.tcx.associated_items(deref_trait) + .find(|item| item.kind == ty::AssocKind::Type) + .unwrap() + .def_id; let predicate = ty::Predicate::Projection(ty::Binder::bind(ty::ProjectionPredicate { // `<T as Deref>::Output` projection_ty: ty::ProjectionTy { // `T` - substs: self.tcx.mk_substs_trait( - checked_ty, - self.fresh_substs_for_item(sp, item_def_id), - ), + substs: self.tcx.intern_substs(&[checked_ty.into()]), // `Deref::Output` item_def_id, }, diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs index afd027e3438..5e99b82c712 100644 --- a/src/librustc_typeck/check/mod.rs +++ b/src/librustc_typeck/check/mod.rs @@ -154,7 +154,7 @@ pub use self::Expectation::*; use self::autoderef::Autoderef; use self::callee::DeferredCallResolution; use self::coercion::{CoerceMany, DynamicCoerceMany}; -pub use self::compare_method::{compare_impl_method, compare_const_impl}; +use self::compare_method::{compare_impl_method, compare_const_impl, compare_ty_impl}; use self::method::{MethodCallee, SelfSource}; use self::TupleArgumentsFlag::*; @@ -2014,14 +2014,14 @@ fn check_impl_items_against_trait<'tcx>( } } hir::ImplItemKind::Method(..) => { - let trait_span = tcx.hir().span_if_local(ty_trait_item.def_id); + let opt_trait_span = tcx.hir().span_if_local(ty_trait_item.def_id); if ty_trait_item.kind == ty::AssocKind::Method { compare_impl_method(tcx, &ty_impl_item, impl_item.span, &ty_trait_item, impl_trait_ref, - trait_span); + opt_trait_span); } else { let mut err = struct_span_err!(tcx.sess, impl_item.span, E0324, "item `{}` is an associated method, \ @@ -2029,7 +2029,7 @@ fn check_impl_items_against_trait<'tcx>( ty_impl_item.ident, impl_trait_ref.print_only_trait_path()); err.span_label(impl_item.span, "does not match trait"); - if let Some(trait_span) = tcx.hir().span_if_local(ty_trait_item.def_id) { + if let Some(trait_span) = opt_trait_span { err.span_label(trait_span, "item in trait"); } err.emit() @@ -2037,10 +2037,19 @@ fn check_impl_items_against_trait<'tcx>( } hir::ImplItemKind::OpaqueTy(..) | hir::ImplItemKind::TyAlias(_) => { + let opt_trait_span = tcx.hir().span_if_local(ty_trait_item.def_id); if ty_trait_item.kind == ty::AssocKind::Type { if ty_trait_item.defaultness.has_value() { overridden_associated_type = Some(impl_item); } + compare_ty_impl( + tcx, + &ty_impl_item, + impl_item.span, + &ty_trait_item, + impl_trait_ref, + opt_trait_span, + ) } else { let mut err = struct_span_err!(tcx.sess, impl_item.span, E0325, "item `{}` is an associated type, \ @@ -2048,7 +2057,7 @@ fn check_impl_items_against_trait<'tcx>( ty_impl_item.ident, impl_trait_ref.print_only_trait_path()); err.span_label(impl_item.span, "does not match trait"); - if let Some(trait_span) = tcx.hir().span_if_local(ty_trait_item.def_id) { + if let Some(trait_span) = opt_trait_span { err.span_label(trait_span, "item in trait"); } err.emit() @@ -2604,6 +2613,7 @@ impl<'a, 'tcx> AstConv<'tcx> for FnCtxt<'a, 'tcx> { fn projected_ty_from_poly_trait_ref(&self, span: Span, item_def_id: DefId, + item_segment: &hir::PathSegment, poly_trait_ref: ty::PolyTraitRef<'tcx>) -> Ty<'tcx> { @@ -2613,7 +2623,16 @@ impl<'a, 'tcx> AstConv<'tcx> for FnCtxt<'a, 'tcx> { &poly_trait_ref ); - self.tcx().mk_projection(item_def_id, trait_ref.substs) + let item_substs = <dyn AstConv<'tcx>>::create_substs_for_associated_item( + self, + self.tcx, + span, + item_def_id, + item_segment, + trait_ref.substs, + ); + + self.tcx().mk_projection(item_def_id, item_substs) } fn normalize_ty(&self, span: Span, ty: Ty<'tcx>) -> Ty<'tcx> { diff --git a/src/librustc_typeck/collect.rs b/src/librustc_typeck/collect.rs index b9829793cbe..f25d2da13ee 100644 --- a/src/librustc_typeck/collect.rs +++ b/src/librustc_typeck/collect.rs @@ -224,10 +224,19 @@ impl AstConv<'tcx> for ItemCtxt<'tcx> { &self, span: Span, item_def_id: DefId, + item_segment: &hir::PathSegment, poly_trait_ref: ty::PolyTraitRef<'tcx>, ) -> Ty<'tcx> { if let Some(trait_ref) = poly_trait_ref.no_bound_vars() { - self.tcx().mk_projection(item_def_id, trait_ref.substs) + let item_substs = <dyn AstConv<'tcx>>::create_substs_for_associated_item( + self, + self.tcx, + span, + item_def_id, + item_segment, + trait_ref.substs, + ); + self.tcx().mk_projection(item_def_id, item_substs) } else { // There are no late-bound regions; we can just ignore the binder. span_err!( @@ -2291,25 +2300,7 @@ fn explicit_predicates_of( // Add predicates from associated type bounds. if let Some((self_trait_ref, trait_items)) = is_trait { predicates.extend(trait_items.iter().flat_map(|trait_item_ref| { - let trait_item = tcx.hir().trait_item(trait_item_ref.id); - let bounds = match trait_item.kind { - hir::TraitItemKind::Type(ref bounds, _) => bounds, - _ => return Vec::new().into_iter() - }; - - let assoc_ty = - tcx.mk_projection(tcx.hir().local_def_id(trait_item.hir_id), - self_trait_ref.substs); - - let bounds = AstConv::compute_bounds( - &ItemCtxt::new(tcx, def_id), - assoc_ty, - bounds, - SizedByDefault::Yes, - trait_item.span, - ); - - bounds.predicates(tcx, assoc_ty).into_iter() + associated_item_predicates(tcx, def_id, self_trait_ref, trait_item_ref) })) } @@ -2343,6 +2334,105 @@ fn explicit_predicates_of( result } +fn associated_item_predicates( + tcx: TyCtxt<'tcx>, + def_id: DefId, + self_trait_ref: ty::TraitRef<'tcx>, + trait_item_ref: &hir::TraitItemRef, +) -> Vec<(ty::Predicate<'tcx>, Span)> { + let trait_item = tcx.hir().trait_item(trait_item_ref.id); + let item_def_id = tcx.hir().local_def_id(trait_item_ref.id.hir_id); + let bounds = match trait_item.kind { + hir::TraitItemKind::Type(ref bounds, _) => bounds, + _ => return Vec::new() + }; + + let is_gat = !tcx.generics_of(item_def_id).params.is_empty(); + + let mut had_error = false; + + let mut unimplemented_error = |arg_kind: &str| { + if !had_error { + tcx.sess.struct_span_err( + trait_item.span, + &format!("{}-generic associated types are not yet implemented", arg_kind), + ) + .note("for more information, see https://github.com/rust-lang/rust/issues/44265") + .emit(); + had_error = true; + } + }; + + let mk_bound_param = |param: &ty::GenericParamDef, _: &_| { + match param.kind { + ty::GenericParamDefKind::Lifetime => { + tcx.mk_region(ty::RegionKind::ReLateBound( + ty::INNERMOST, + ty::BoundRegion::BrNamed(param.def_id, param.name) + )).into() + } + // FIXME(generic_associated_types): Use bound types and constants + // once they are handled by the trait system. + ty::GenericParamDefKind::Type { .. } => { + unimplemented_error("type"); + tcx.types.err.into() + } + ty::GenericParamDefKind::Const => { + unimplemented_error("const"); + tcx.consts.err.into() + } + } + }; + + let bound_substs = if is_gat { + // Given: + // + // trait X<'a, B, const C: usize> { + // type T<'d, E, const F: usize>: Default; + // } + // + // We need to create predicates on the trait: + // + // for<'d, E, const F: usize> + // <Self as X<'a, B, const C: usize>>::T<'d, E, const F: usize>: Sized + Default + // + // We substitute escaping bound parameters for the generic + // arguments to the associated type which are then bound by + // the `Binder` around the the predicate. + // + // FIXME(generic_associated_types): Currently only lifetimes are handled. + self_trait_ref.substs.extend_to(tcx, item_def_id, mk_bound_param) + } else { + self_trait_ref.substs + }; + + let assoc_ty = tcx.mk_projection( + tcx.hir().local_def_id(trait_item.hir_id), + bound_substs, + ); + + let bounds = AstConv::compute_bounds( + &ItemCtxt::new(tcx, def_id), + assoc_ty, + bounds, + SizedByDefault::Yes, + trait_item.span, + ); + + let predicates = bounds.predicates(tcx, assoc_ty); + + if is_gat { + // We use shifts to get the regions that we're substituting to + // be bound by the binders in the `Predicate`s rather that + // escaping. + let shifted_in = ty::fold::shift_vars(tcx, &predicates, 1); + let substituted = shifted_in.subst(tcx, bound_substs); + ty::fold::shift_out_vars(tcx, &substituted, 1) + } else { + predicates + } +} + /// Converts a specific `GenericBound` from the AST into a set of /// predicates that apply to the self type. A vector is returned /// because this can be anywhere from zero predicates (`T: ?Sized` adds no diff --git a/src/librustc_typeck/constrained_generic_params.rs b/src/librustc_typeck/constrained_generic_params.rs index 0523de56512..a3a703cf50e 100644 --- a/src/librustc_typeck/constrained_generic_params.rs +++ b/src/librustc_typeck/constrained_generic_params.rs @@ -135,7 +135,7 @@ pub fn identify_constrained_generic_params<'tcx>( /// by 0. I should probably pick a less tangled example, but I can't /// think of any. pub fn setup_constraining_predicates<'tcx>( - tcx: TyCtxt<'_>, + tcx: TyCtxt<'tcx>, predicates: &mut [(ty::Predicate<'tcx>, Span)], impl_trait_ref: Option<ty::TraitRef<'tcx>>, input_parameters: &mut FxHashSet<Parameter>, diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index cebfd99452a..2022e9def4f 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -21,7 +21,7 @@ use rustc::hir::def::{CtorKind, DefKind, Res}; use rustc::hir::def_id::{CrateNum, DefId, CRATE_DEF_INDEX}; use rustc::hir::ptr::P; use rustc::ty::subst::InternalSubsts; -use rustc::ty::{self, TyCtxt, Ty, AdtKind}; +use rustc::ty::{self, TyCtxt, Ty, AdtKind, Lift}; use rustc::ty::fold::TypeFolder; use rustc::util::nodemap::{FxHashMap, FxHashSet}; use syntax::ast::{self, Ident}; @@ -551,7 +551,8 @@ impl<'tcx> Clean<WherePredicate> for ty::ProjectionPredicate<'tcx> { impl<'tcx> Clean<Type> for ty::ProjectionTy<'tcx> { fn clean(&self, cx: &DocContext<'_>) -> Type { - let trait_ = match self.trait_ref(cx.tcx).clean(cx) { + let lifted = self.lift_to_tcx(cx.tcx).unwrap(); + let trait_ = match lifted.trait_ref(cx.tcx).clean(cx) { GenericBound::TraitBound(t, _) => t.trait_, GenericBound::Outlives(_) => panic!("cleaning a trait got a lifetime"), }; diff --git a/src/test/mir-opt/inline-any-operand.rs b/src/test/mir-opt/inline/inline-any-operand.rs index b5455003719..b5455003719 100644 --- a/src/test/mir-opt/inline-any-operand.rs +++ b/src/test/mir-opt/inline/inline-any-operand.rs diff --git a/src/test/mir-opt/inline-closure-borrows-arg.rs b/src/test/mir-opt/inline/inline-closure-borrows-arg.rs index 768f4953228..768f4953228 100644 --- a/src/test/mir-opt/inline-closure-borrows-arg.rs +++ b/src/test/mir-opt/inline/inline-closure-borrows-arg.rs diff --git a/src/test/mir-opt/inline-closure-captures.rs b/src/test/mir-opt/inline/inline-closure-captures.rs index e000a418d90..e000a418d90 100644 --- a/src/test/mir-opt/inline-closure-captures.rs +++ b/src/test/mir-opt/inline/inline-closure-captures.rs diff --git a/src/test/mir-opt/inline-closure.rs b/src/test/mir-opt/inline/inline-closure.rs index bd36e77818e..bd36e77818e 100644 --- a/src/test/mir-opt/inline-closure.rs +++ b/src/test/mir-opt/inline/inline-closure.rs diff --git a/src/test/mir-opt/inline/inline-into-box-place.rs b/src/test/mir-opt/inline/inline-into-box-place.rs new file mode 100644 index 00000000000..0bb9dfa403d --- /dev/null +++ b/src/test/mir-opt/inline/inline-into-box-place.rs @@ -0,0 +1,71 @@ +// ignore-tidy-linelength +// ignore-wasm32-bare compiled with panic=abort by default +#![feature(box_syntax)] + +fn main() { + let _x: Box<Vec<u32>> = box Vec::new(); +} + +// END RUST SOURCE +// START rustc.main.Inline.before.mir +// let mut _0: (); +// let _1: std::boxed::Box<std::vec::Vec<u32>> as UserTypeProjection { base: UserType(0), projs: [] }; +// let mut _2: std::boxed::Box<std::vec::Vec<u32>>; +// let mut _3: (); +// scope 1 { +// debug _x => _1; +// } +// bb0: { +// StorageLive(_1); +// StorageLive(_2); +// _2 = Box(std::vec::Vec<u32>); +// (*_2) = const std::vec::Vec::<u32>::new() -> [return: bb2, unwind: bb4]; +// } +// bb1 (cleanup): { +// resume; +// } +// bb2: { +// _1 = move _2; +// StorageDead(_2); +// _0 = (); +// drop(_1) -> [return: bb3, unwind: bb1]; +// } +// bb3: { +// StorageDead(_1); +// return; +// } +// bb4 (cleanup): { +// _3 = const alloc::alloc::box_free::<std::vec::Vec<u32>>(move (_2.0: std::ptr::Unique<std::vec::Vec<u32>>)) -> bb1; +// } +// END rustc.main.Inline.before.mir +// START rustc.main.Inline.after.mir +// let mut _0: (); +// let _1: std::boxed::Box<std::vec::Vec<u32>> as UserTypeProjection { base: UserType(0), projs: [] }; +// let mut _2: std::boxed::Box<std::vec::Vec<u32>>; +// let mut _3: (); +// let mut _4: &mut std::vec::Vec<u32>; +// scope 1 { +// debug _x => _1; +// } +// scope 2 { +// } +// bb0: { +// StorageLive(_1); +// StorageLive(_2); +// _2 = Box(std::vec::Vec<u32>); +// _4 = &mut (*_2); +// ((*_4).0: alloc::raw_vec::RawVec<u32>) = const alloc::raw_vec::RawVec::<u32>::NEW; +// ((*_4).1: usize) = const 0usize; +// _1 = move _2; +// StorageDead(_2); +// _0 = (); +// drop(_1) -> [return: bb2, unwind: bb1]; +// } +// bb1 (cleanup): { +// resume; +// } +// bb2: { +// StorageDead(_1); +// return; +// } +// END rustc.main.Inline.after.mir diff --git a/src/test/mir-opt/inline-retag.rs b/src/test/mir-opt/inline/inline-retag.rs index 6cdbcfdb0ad..6cdbcfdb0ad 100644 --- a/src/test/mir-opt/inline-retag.rs +++ b/src/test/mir-opt/inline/inline-retag.rs diff --git a/src/test/mir-opt/inline-trait-method.rs b/src/test/mir-opt/inline/inline-trait-method.rs index a2c5fb920cd..a2c5fb920cd 100644 --- a/src/test/mir-opt/inline-trait-method.rs +++ b/src/test/mir-opt/inline/inline-trait-method.rs diff --git a/src/test/mir-opt/inline-trait-method_2.rs b/src/test/mir-opt/inline/inline-trait-method_2.rs index 4ad4311113a..4ad4311113a 100644 --- a/src/test/mir-opt/inline-trait-method_2.rs +++ b/src/test/mir-opt/inline/inline-trait-method_2.rs diff --git a/src/test/ui/asm/issue-51431.rs b/src/test/ui/asm/issue-51431.rs index d29c31fafc2..4cef42d17d6 100644 --- a/src/test/ui/asm/issue-51431.rs +++ b/src/test/ui/asm/issue-51431.rs @@ -1,3 +1,4 @@ +// build-fail // ignore-emscripten no asm! support #![feature(asm)] diff --git a/src/test/ui/asm/issue-51431.stderr b/src/test/ui/asm/issue-51431.stderr index f78d1831973..a024f3311f1 100644 --- a/src/test/ui/asm/issue-51431.stderr +++ b/src/test/ui/asm/issue-51431.stderr @@ -1,5 +1,5 @@ error[E0669]: invalid value for constraint in inline assembly - --> $DIR/issue-51431.rs:7:32 + --> $DIR/issue-51431.rs:8:32 | LL | asm! {"mov $0,$1"::"0"("bx"),"1"(0x00)} | ^^^^ diff --git a/src/test/ui/bad/bad-intrinsic-monomorphization.rs b/src/test/ui/bad/bad-intrinsic-monomorphization.rs index a29723f34b4..f36a5f1acc1 100644 --- a/src/test/ui/bad/bad-intrinsic-monomorphization.rs +++ b/src/test/ui/bad/bad-intrinsic-monomorphization.rs @@ -1,3 +1,5 @@ +// build-fail + #![feature(repr_simd, platform_intrinsics, core_intrinsics)] #![allow(warnings)] #![crate_type = "rlib"] diff --git a/src/test/ui/bad/bad-intrinsic-monomorphization.stderr b/src/test/ui/bad/bad-intrinsic-monomorphization.stderr index dee33f574d8..c070f018181 100644 --- a/src/test/ui/bad/bad-intrinsic-monomorphization.stderr +++ b/src/test/ui/bad/bad-intrinsic-monomorphization.stderr @@ -1,17 +1,17 @@ error[E0511]: invalid monomorphization of `cttz` intrinsic: expected basic integer type, found `Foo` - --> $DIR/bad-intrinsic-monomorphization.rs:18:5 + --> $DIR/bad-intrinsic-monomorphization.rs:20:5 | LL | intrinsics::cttz(v) | ^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `fadd_fast` intrinsic: expected basic float type, found `Foo` - --> $DIR/bad-intrinsic-monomorphization.rs:23:5 + --> $DIR/bad-intrinsic-monomorphization.rs:25:5 | LL | intrinsics::fadd_fast(a, b) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_add` intrinsic: expected SIMD input type, found non-SIMD `Foo` - --> $DIR/bad-intrinsic-monomorphization.rs:28:5 + --> $DIR/bad-intrinsic-monomorphization.rs:30:5 | LL | simd_add(a, b) | ^^^^^^^^^^^^^^ diff --git a/src/test/ui/cdylib-deps-must-be-static.rs b/src/test/ui/cdylib-deps-must-be-static.rs index 8530c9e24b2..abf954d8fb2 100644 --- a/src/test/ui/cdylib-deps-must-be-static.rs +++ b/src/test/ui/cdylib-deps-must-be-static.rs @@ -1,3 +1,4 @@ +// build-fail // error-pattern: crate `cdylib_dep` required to be available in rlib format, but was not found // aux-build:cdylib-dep.rs // ignore-musl diff --git a/src/test/ui/commandline-argfile-badutf8.rs b/src/test/ui/commandline-argfile-badutf8.rs index 161715685b5..e2984e3ca97 100644 --- a/src/test/ui/commandline-argfile-badutf8.rs +++ b/src/test/ui/commandline-argfile-badutf8.rs @@ -1,6 +1,5 @@ // Check to see if we can get parameters from an @argsfile file // -// build-fail // compile-flags: --cfg cmdline_set @{{src-base}}/commandline-argfile-badutf8.args #[cfg(not(cmdline_set))] diff --git a/src/test/ui/commandline-argfile-missing.rs b/src/test/ui/commandline-argfile-missing.rs index a29b4ab062d..020c3ff3c7e 100644 --- a/src/test/ui/commandline-argfile-missing.rs +++ b/src/test/ui/commandline-argfile-missing.rs @@ -1,7 +1,6 @@ // Check to see if we can get parameters from an @argsfile file // // ignore-tidy-linelength -// build-fail // normalize-stderr-test: "os error \d+" -> "os error $$ERR" // normalize-stderr-test: "commandline-argfile-missing.args:[^(]*" -> "commandline-argfile-missing.args: $$FILE_MISSING " // compile-flags: --cfg cmdline_set @{{src-base}}/commandline-argfile-missing.args diff --git a/src/test/ui/consts/array-literal-index-oob.rs b/src/test/ui/consts/array-literal-index-oob.rs index 492182921ba..1de6bafd293 100644 --- a/src/test/ui/consts/array-literal-index-oob.rs +++ b/src/test/ui/consts/array-literal-index-oob.rs @@ -1,3 +1,5 @@ +// build-fail + fn main() { &{[1, 2, 3][4]}; //~^ ERROR index out of bounds diff --git a/src/test/ui/consts/array-literal-index-oob.stderr b/src/test/ui/consts/array-literal-index-oob.stderr index f4d4e6f969b..f3ef16659dd 100644 --- a/src/test/ui/consts/array-literal-index-oob.stderr +++ b/src/test/ui/consts/array-literal-index-oob.stderr @@ -1,5 +1,5 @@ error: index out of bounds: the len is 3 but the index is 4 - --> $DIR/array-literal-index-oob.rs:2:7 + --> $DIR/array-literal-index-oob.rs:4:7 | LL | &{[1, 2, 3][4]}; | ^^^^^^^^^^^^ @@ -7,7 +7,7 @@ LL | &{[1, 2, 3][4]}; = note: `#[deny(const_err)]` on by default error: reaching this expression at runtime will panic or abort - --> $DIR/array-literal-index-oob.rs:2:7 + --> $DIR/array-literal-index-oob.rs:4:7 | LL | &{[1, 2, 3][4]}; | --^^^^^^^^^^^^- diff --git a/src/test/ui/consts/assoc_const_generic_impl.rs b/src/test/ui/consts/assoc_const_generic_impl.rs index 62702a8ec5c..83f334dca9e 100644 --- a/src/test/ui/consts/assoc_const_generic_impl.rs +++ b/src/test/ui/consts/assoc_const_generic_impl.rs @@ -1,3 +1,5 @@ +// build-fail + #![warn(const_err)] trait ZeroSized: Sized { diff --git a/src/test/ui/consts/assoc_const_generic_impl.stderr b/src/test/ui/consts/assoc_const_generic_impl.stderr index a114d5c6ccd..4b13f52e762 100644 --- a/src/test/ui/consts/assoc_const_generic_impl.stderr +++ b/src/test/ui/consts/assoc_const_generic_impl.stderr @@ -1,5 +1,5 @@ warning: any use of this value will cause an error - --> $DIR/assoc_const_generic_impl.rs:9:34 + --> $DIR/assoc_const_generic_impl.rs:11:34 | LL | const I_AM_ZERO_SIZED: () = [()][std::mem::size_of::<Self>()]; | -----------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- @@ -7,13 +7,13 @@ LL | const I_AM_ZERO_SIZED: () = [()][std::mem::size_of::<Self>()]; | index out of bounds: the len is 1 but the index is 4 | note: lint level defined here - --> $DIR/assoc_const_generic_impl.rs:1:9 + --> $DIR/assoc_const_generic_impl.rs:3:9 | LL | #![warn(const_err)] | ^^^^^^^^^ error: erroneous constant encountered - --> $DIR/assoc_const_generic_impl.rs:11:18 + --> $DIR/assoc_const_generic_impl.rs:13:18 | LL | let () = Self::I_AM_ZERO_SIZED; | ^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/consts/const-err.rs b/src/test/ui/consts/const-err.rs index 7dfcda69058..b204f705a96 100644 --- a/src/test/ui/consts/const-err.rs +++ b/src/test/ui/consts/const-err.rs @@ -1,3 +1,4 @@ +// build-fail // compile-flags: -Zforce-overflow-checks=on #![allow(exceeding_bitshifts)] diff --git a/src/test/ui/consts/const-err.stderr b/src/test/ui/consts/const-err.stderr index 429e2ae7600..495b221d7d7 100644 --- a/src/test/ui/consts/const-err.stderr +++ b/src/test/ui/consts/const-err.stderr @@ -1,5 +1,5 @@ warning: any use of this value will cause an error - --> $DIR/const-err.rs:10:17 + --> $DIR/const-err.rs:11:17 | LL | const FOO: u8 = [5u8][1]; | ----------------^^^^^^^^- @@ -7,19 +7,19 @@ LL | const FOO: u8 = [5u8][1]; | index out of bounds: the len is 1 but the index is 1 | note: lint level defined here - --> $DIR/const-err.rs:4:9 + --> $DIR/const-err.rs:5:9 | LL | #![warn(const_err)] | ^^^^^^^^^ error[E0080]: erroneous constant used - --> $DIR/const-err.rs:14:16 + --> $DIR/const-err.rs:15:16 | LL | black_box((FOO, FOO)); | ^^^ referenced constant has errors error[E0080]: erroneous constant used - --> $DIR/const-err.rs:14:21 + --> $DIR/const-err.rs:15:21 | LL | black_box((FOO, FOO)); | ^^^ referenced constant has errors diff --git a/src/test/ui/consts/const-err2.rs b/src/test/ui/consts/const-err2.rs index ecbcc2a4b49..351dfd2e0f5 100644 --- a/src/test/ui/consts/const-err2.rs +++ b/src/test/ui/consts/const-err2.rs @@ -1,6 +1,8 @@ // needed because negating int::MIN will behave differently between // optimized compilation and unoptimized compilation and thus would // lead to different lints being emitted + +// build-fail // compile-flags: -O #![feature(rustc_attrs)] diff --git a/src/test/ui/consts/const-err2.stderr b/src/test/ui/consts/const-err2.stderr index 1d84d44dc27..2ca1019d494 100644 --- a/src/test/ui/consts/const-err2.stderr +++ b/src/test/ui/consts/const-err2.stderr @@ -1,35 +1,35 @@ error: this expression will panic at runtime - --> $DIR/const-err2.rs:16:13 + --> $DIR/const-err2.rs:18:13 | LL | let a = -std::i8::MIN; | ^^^^^^^^^^^^^ attempt to negate with overflow | note: lint level defined here - --> $DIR/const-err2.rs:9:9 + --> $DIR/const-err2.rs:11:9 | LL | #![deny(const_err)] | ^^^^^^^^^ error: this expression will panic at runtime - --> $DIR/const-err2.rs:18:13 + --> $DIR/const-err2.rs:20:13 | LL | let b = 200u8 + 200u8 + 200u8; | ^^^^^^^^^^^^^ attempt to add with overflow error: this expression will panic at runtime - --> $DIR/const-err2.rs:20:13 + --> $DIR/const-err2.rs:22:13 | LL | let c = 200u8 * 4; | ^^^^^^^^^ attempt to multiply with overflow error: this expression will panic at runtime - --> $DIR/const-err2.rs:22:13 + --> $DIR/const-err2.rs:24:13 | LL | let d = 42u8 - (42u8 + 1); | ^^^^^^^^^^^^^^^^^ attempt to subtract with overflow error: index out of bounds: the len is 1 but the index is 1 - --> $DIR/const-err2.rs:24:14 + --> $DIR/const-err2.rs:26:14 | LL | let _e = [5u8][1]; | ^^^^^^^^ diff --git a/src/test/ui/consts/const-err3.rs b/src/test/ui/consts/const-err3.rs index a9cf04cda7a..ab3823efd30 100644 --- a/src/test/ui/consts/const-err3.rs +++ b/src/test/ui/consts/const-err3.rs @@ -1,6 +1,8 @@ // needed because negating int::MIN will behave differently between // optimized compilation and unoptimized compilation and thus would // lead to different lints being emitted + +// build-fail // compile-flags: -C overflow-checks=on -O #![feature(rustc_attrs)] diff --git a/src/test/ui/consts/const-err3.stderr b/src/test/ui/consts/const-err3.stderr index 0602707be70..c374637bec2 100644 --- a/src/test/ui/consts/const-err3.stderr +++ b/src/test/ui/consts/const-err3.stderr @@ -1,35 +1,35 @@ error: attempt to negate with overflow - --> $DIR/const-err3.rs:16:13 + --> $DIR/const-err3.rs:18:13 | LL | let a = -std::i8::MIN; | ^^^^^^^^^^^^^ | note: lint level defined here - --> $DIR/const-err3.rs:9:9 + --> $DIR/const-err3.rs:11:9 | LL | #![deny(const_err)] | ^^^^^^^^^ error: attempt to add with overflow - --> $DIR/const-err3.rs:18:13 + --> $DIR/const-err3.rs:20:13 | LL | let b = 200u8 + 200u8 + 200u8; | ^^^^^^^^^^^^^ error: attempt to multiply with overflow - --> $DIR/const-err3.rs:20:13 + --> $DIR/const-err3.rs:22:13 | LL | let c = 200u8 * 4; | ^^^^^^^^^ error: attempt to subtract with overflow - --> $DIR/const-err3.rs:22:13 + --> $DIR/const-err3.rs:24:13 | LL | let d = 42u8 - (42u8 + 1); | ^^^^^^^^^^^^^^^^^ error: index out of bounds: the len is 1 but the index is 1 - --> $DIR/const-err3.rs:24:14 + --> $DIR/const-err3.rs:26:14 | LL | let _e = [5u8][1]; | ^^^^^^^^ diff --git a/src/test/ui/consts/const-eval/conditional_array_execution.rs b/src/test/ui/consts/const-eval/conditional_array_execution.rs index 12e51c24605..96f67c92a5e 100644 --- a/src/test/ui/consts/const-eval/conditional_array_execution.rs +++ b/src/test/ui/consts/const-eval/conditional_array_execution.rs @@ -1,3 +1,5 @@ +// build-fail + #![warn(const_err)] const X: u32 = 5; diff --git a/src/test/ui/consts/const-eval/conditional_array_execution.stderr b/src/test/ui/consts/const-eval/conditional_array_execution.stderr index 7f94d849c00..ec18f8f011d 100644 --- a/src/test/ui/consts/const-eval/conditional_array_execution.stderr +++ b/src/test/ui/consts/const-eval/conditional_array_execution.stderr @@ -1,5 +1,5 @@ warning: any use of this value will cause an error - --> $DIR/conditional_array_execution.rs:5:19 + --> $DIR/conditional_array_execution.rs:7:19 | LL | const FOO: u32 = [X - Y, Y - X][(X < Y) as usize]; | ------------------^^^^^--------------------------- @@ -7,13 +7,13 @@ LL | const FOO: u32 = [X - Y, Y - X][(X < Y) as usize]; | attempt to subtract with overflow | note: lint level defined here - --> $DIR/conditional_array_execution.rs:1:9 + --> $DIR/conditional_array_execution.rs:3:9 | LL | #![warn(const_err)] | ^^^^^^^^^ error[E0080]: evaluation of constant expression failed - --> $DIR/conditional_array_execution.rs:9:20 + --> $DIR/conditional_array_execution.rs:11:20 | LL | println!("{}", FOO); | ^^^ referenced constant has errors diff --git a/src/test/ui/consts/const-eval/const_fn_ptr_fail2.rs b/src/test/ui/consts/const-eval/const_fn_ptr_fail2.rs index b300119509c..a5f04d088b6 100644 --- a/src/test/ui/consts/const-eval/const_fn_ptr_fail2.rs +++ b/src/test/ui/consts/const-eval/const_fn_ptr_fail2.rs @@ -1,4 +1,6 @@ +// build-fail // compile-flags: -Zunleash-the-miri-inside-of-you + #![feature(const_fn)] #![allow(const_err)] diff --git a/src/test/ui/consts/const-eval/const_fn_ptr_fail2.stderr b/src/test/ui/consts/const-eval/const_fn_ptr_fail2.stderr index 9d74d3b0bf2..19f37fa0079 100644 --- a/src/test/ui/consts/const-eval/const_fn_ptr_fail2.stderr +++ b/src/test/ui/consts/const-eval/const_fn_ptr_fail2.stderr @@ -1,11 +1,11 @@ warning: skipping const checks - --> $DIR/const_fn_ptr_fail2.rs:9:5 + --> $DIR/const_fn_ptr_fail2.rs:11:5 | LL | x(y) | ^^^^ error[E0080]: evaluation of constant expression failed - --> $DIR/const_fn_ptr_fail2.rs:16:5 + --> $DIR/const_fn_ptr_fail2.rs:18:5 | LL | assert_eq!(Y, 4); | ^^^^^^^^^^^-^^^^^ @@ -15,7 +15,7 @@ LL | assert_eq!(Y, 4); = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) error[E0080]: evaluation of constant expression failed - --> $DIR/const_fn_ptr_fail2.rs:18:5 + --> $DIR/const_fn_ptr_fail2.rs:20:5 | LL | assert_eq!(Z, 4); | ^^^^^^^^^^^-^^^^^ diff --git a/src/test/ui/consts/const-eval/index-out-of-bounds-never-type.rs b/src/test/ui/consts/const-eval/index-out-of-bounds-never-type.rs index f6ab0bd7dbe..2a983e42683 100644 --- a/src/test/ui/consts/const-eval/index-out-of-bounds-never-type.rs +++ b/src/test/ui/consts/const-eval/index-out-of-bounds-never-type.rs @@ -1,3 +1,5 @@ +// build-fail + // Regression test for #66975 #![warn(const_err)] #![feature(never_type)] diff --git a/src/test/ui/consts/const-eval/index-out-of-bounds-never-type.stderr b/src/test/ui/consts/const-eval/index-out-of-bounds-never-type.stderr index 24830f7344c..e664a4aab3c 100644 --- a/src/test/ui/consts/const-eval/index-out-of-bounds-never-type.stderr +++ b/src/test/ui/consts/const-eval/index-out-of-bounds-never-type.stderr @@ -1,5 +1,5 @@ warning: any use of this value will cause an error - --> $DIR/index-out-of-bounds-never-type.rs:8:61 + --> $DIR/index-out-of-bounds-never-type.rs:10:61 | LL | const VOID: ! = { let x = 0 * std::mem::size_of::<T>(); [][x] }; | --------------------------------------------------------^^^^^--- @@ -7,13 +7,13 @@ LL | const VOID: ! = { let x = 0 * std::mem::size_of::<T>(); [][x] }; | index out of bounds: the len is 0 but the index is 0 | note: lint level defined here - --> $DIR/index-out-of-bounds-never-type.rs:2:9 + --> $DIR/index-out-of-bounds-never-type.rs:4:9 | LL | #![warn(const_err)] | ^^^^^^^^^ error: erroneous constant encountered - --> $DIR/index-out-of-bounds-never-type.rs:13:13 + --> $DIR/index-out-of-bounds-never-type.rs:15:13 | LL | let _ = PrintName::<T>::VOID; | ^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/consts/const-eval/index_out_of_bounds_propagated.rs b/src/test/ui/consts/const-eval/index_out_of_bounds_propagated.rs index 4b487c09a11..6d6bb94d4df 100644 --- a/src/test/ui/consts/const-eval/index_out_of_bounds_propagated.rs +++ b/src/test/ui/consts/const-eval/index_out_of_bounds_propagated.rs @@ -1,3 +1,5 @@ +// build-fail + fn main() { let array = [std::env::args().len()]; array[1]; //~ ERROR index out of bounds diff --git a/src/test/ui/consts/const-eval/index_out_of_bounds_propagated.stderr b/src/test/ui/consts/const-eval/index_out_of_bounds_propagated.stderr index f330f9caaa2..9519ccd3c24 100644 --- a/src/test/ui/consts/const-eval/index_out_of_bounds_propagated.stderr +++ b/src/test/ui/consts/const-eval/index_out_of_bounds_propagated.stderr @@ -1,5 +1,5 @@ error: index out of bounds: the len is 1 but the index is 1 - --> $DIR/index_out_of_bounds_propagated.rs:3:5 + --> $DIR/index_out_of_bounds_propagated.rs:5:5 | LL | array[1]; | ^^^^^^^^ diff --git a/src/test/ui/consts/const-eval/issue-43197.rs b/src/test/ui/consts/const-eval/issue-43197.rs index 440862090bd..849c81ad449 100644 --- a/src/test/ui/consts/const-eval/issue-43197.rs +++ b/src/test/ui/consts/const-eval/issue-43197.rs @@ -1,3 +1,5 @@ +// build-fail + #![warn(const_err)] const fn foo(x: u32) -> u32 { diff --git a/src/test/ui/consts/const-eval/issue-43197.stderr b/src/test/ui/consts/const-eval/issue-43197.stderr index d971d825f27..a1b3a05ed41 100644 --- a/src/test/ui/consts/const-eval/issue-43197.stderr +++ b/src/test/ui/consts/const-eval/issue-43197.stderr @@ -1,5 +1,5 @@ warning: any use of this value will cause an error - --> $DIR/issue-43197.rs:8:20 + --> $DIR/issue-43197.rs:10:20 | LL | const X: u32 = 0-1; | ---------------^^^- @@ -7,13 +7,13 @@ LL | const X: u32 = 0-1; | attempt to subtract with overflow | note: lint level defined here - --> $DIR/issue-43197.rs:1:9 + --> $DIR/issue-43197.rs:3:9 | LL | #![warn(const_err)] | ^^^^^^^^^ warning: any use of this value will cause an error - --> $DIR/issue-43197.rs:10:24 + --> $DIR/issue-43197.rs:12:24 | LL | const Y: u32 = foo(0-1); | -------------------^^^-- @@ -21,13 +21,13 @@ LL | const Y: u32 = foo(0-1); | attempt to subtract with overflow error[E0080]: evaluation of constant expression failed - --> $DIR/issue-43197.rs:12:23 + --> $DIR/issue-43197.rs:14:23 | LL | println!("{} {}", X, Y); | ^ referenced constant has errors error[E0080]: evaluation of constant expression failed - --> $DIR/issue-43197.rs:12:26 + --> $DIR/issue-43197.rs:14:26 | LL | println!("{} {}", X, Y); | ^ referenced constant has errors diff --git a/src/test/ui/consts/const-eval/issue-44578.rs b/src/test/ui/consts/const-eval/issue-44578.rs index 4d93130f2af..7da9256bb39 100644 --- a/src/test/ui/consts/const-eval/issue-44578.rs +++ b/src/test/ui/consts/const-eval/issue-44578.rs @@ -1,3 +1,5 @@ +// build-fail + #![allow(const_err)] trait Foo { diff --git a/src/test/ui/consts/const-eval/issue-44578.stderr b/src/test/ui/consts/const-eval/issue-44578.stderr index 3fadeac1d5c..f4323713e68 100644 --- a/src/test/ui/consts/const-eval/issue-44578.stderr +++ b/src/test/ui/consts/const-eval/issue-44578.stderr @@ -1,5 +1,5 @@ error[E0080]: evaluation of constant expression failed - --> $DIR/issue-44578.rs:25:20 + --> $DIR/issue-44578.rs:27:20 | LL | println!("{}", <Bar<u16, u8> as Foo>::AMT); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors diff --git a/src/test/ui/consts/const-eval/issue-50814-2.rs b/src/test/ui/consts/const-eval/issue-50814-2.rs index b13c19c660e..8f5c8f097a2 100644 --- a/src/test/ui/consts/const-eval/issue-50814-2.rs +++ b/src/test/ui/consts/const-eval/issue-50814-2.rs @@ -1,3 +1,5 @@ +// build-fail + trait C { const BOO: usize; } diff --git a/src/test/ui/consts/const-eval/issue-50814-2.stderr b/src/test/ui/consts/const-eval/issue-50814-2.stderr index d68f72d36e2..e04bf03a20c 100644 --- a/src/test/ui/consts/const-eval/issue-50814-2.stderr +++ b/src/test/ui/consts/const-eval/issue-50814-2.stderr @@ -1,5 +1,5 @@ error: any use of this value will cause an error - --> $DIR/issue-50814-2.rs:12:24 + --> $DIR/issue-50814-2.rs:14:24 | LL | const BAR: usize = [5, 6, 7][T::BOO]; | -------------------^^^^^^^^^^^^^^^^^- @@ -9,7 +9,7 @@ LL | const BAR: usize = [5, 6, 7][T::BOO]; = note: `#[deny(const_err)]` on by default error[E0080]: evaluation of constant expression failed - --> $DIR/issue-50814-2.rs:16:5 + --> $DIR/issue-50814-2.rs:18:5 | LL | &<A<T> as Foo<T>>::BAR | ^--------------------- diff --git a/src/test/ui/consts/const-eval/issue-50814.rs b/src/test/ui/consts/const-eval/issue-50814.rs index b85cecda16e..e589126a942 100644 --- a/src/test/ui/consts/const-eval/issue-50814.rs +++ b/src/test/ui/consts/const-eval/issue-50814.rs @@ -1,3 +1,5 @@ +// build-fail + trait Unsigned { const MAX: u8; } diff --git a/src/test/ui/consts/const-eval/issue-50814.stderr b/src/test/ui/consts/const-eval/issue-50814.stderr index 707dfee7cd5..f8b017e4b53 100644 --- a/src/test/ui/consts/const-eval/issue-50814.stderr +++ b/src/test/ui/consts/const-eval/issue-50814.stderr @@ -1,5 +1,5 @@ error: any use of this value will cause an error - --> $DIR/issue-50814.rs:13:21 + --> $DIR/issue-50814.rs:15:21 | LL | const MAX: u8 = A::MAX + B::MAX; | ----------------^^^^^^^^^^^^^^^- @@ -9,7 +9,7 @@ LL | const MAX: u8 = A::MAX + B::MAX; = note: `#[deny(const_err)]` on by default error[E0080]: evaluation of constant expression failed - --> $DIR/issue-50814.rs:17:5 + --> $DIR/issue-50814.rs:19:5 | LL | &Sum::<U8,U8>::MAX | ^----------------- diff --git a/src/test/ui/consts/const-eval/panic-assoc-never-type.rs b/src/test/ui/consts/const-eval/panic-assoc-never-type.rs index a7cbdb40ef1..21ee64fa6d9 100644 --- a/src/test/ui/consts/const-eval/panic-assoc-never-type.rs +++ b/src/test/ui/consts/const-eval/panic-assoc-never-type.rs @@ -1,3 +1,5 @@ +// build-fail + // Regression test for #66975 #![warn(const_err)] #![feature(const_panic)] diff --git a/src/test/ui/consts/const-eval/panic-assoc-never-type.stderr b/src/test/ui/consts/const-eval/panic-assoc-never-type.stderr index e15952c20e4..575c3648b70 100644 --- a/src/test/ui/consts/const-eval/panic-assoc-never-type.stderr +++ b/src/test/ui/consts/const-eval/panic-assoc-never-type.stderr @@ -1,20 +1,20 @@ warning: any use of this value will cause an error - --> $DIR/panic-assoc-never-type.rs:9:21 + --> $DIR/panic-assoc-never-type.rs:11:21 | LL | const VOID: ! = panic!(); | ----------------^^^^^^^^- | | - | the evaluated program panicked at 'explicit panic', $DIR/panic-assoc-never-type.rs:9:21 + | the evaluated program panicked at 'explicit panic', $DIR/panic-assoc-never-type.rs:11:21 | note: lint level defined here - --> $DIR/panic-assoc-never-type.rs:2:9 + --> $DIR/panic-assoc-never-type.rs:4:9 | LL | #![warn(const_err)] | ^^^^^^^^^ = note: this warning originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) error[E0080]: erroneous constant used - --> $DIR/panic-assoc-never-type.rs:14:13 + --> $DIR/panic-assoc-never-type.rs:16:13 | LL | let _ = PrintName::VOID; | ^^^^^^^^^^^^^^^ referenced constant has errors diff --git a/src/test/ui/consts/const-eval/panic-never-type.rs b/src/test/ui/consts/const-eval/panic-never-type.rs index b1a7d8ae676..3b28b2fdd24 100644 --- a/src/test/ui/consts/const-eval/panic-never-type.rs +++ b/src/test/ui/consts/const-eval/panic-never-type.rs @@ -1,3 +1,5 @@ +// build-fail + // Regression test for #66975 #![warn(const_err)] #![feature(const_panic)] diff --git a/src/test/ui/consts/const-eval/panic-never-type.stderr b/src/test/ui/consts/const-eval/panic-never-type.stderr index 9e91fdf4514..4d1686a8d8f 100644 --- a/src/test/ui/consts/const-eval/panic-never-type.stderr +++ b/src/test/ui/consts/const-eval/panic-never-type.stderr @@ -1,20 +1,20 @@ warning: any use of this value will cause an error - --> $DIR/panic-never-type.rs:6:17 + --> $DIR/panic-never-type.rs:8:17 | LL | const VOID: ! = panic!(); | ----------------^^^^^^^^- | | - | the evaluated program panicked at 'explicit panic', $DIR/panic-never-type.rs:6:17 + | the evaluated program panicked at 'explicit panic', $DIR/panic-never-type.rs:8:17 | note: lint level defined here - --> $DIR/panic-never-type.rs:2:9 + --> $DIR/panic-never-type.rs:4:9 | LL | #![warn(const_err)] | ^^^^^^^^^ = note: this warning originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) error[E0080]: erroneous constant used - --> $DIR/panic-never-type.rs:10:13 + --> $DIR/panic-never-type.rs:12:13 | LL | let _ = VOID; | ^^^^ referenced constant has errors diff --git a/src/test/ui/consts/const-eval/promoted_errors.rs b/src/test/ui/consts/const-eval/promoted_errors.rs index dfa6863082c..2eed8ca7d32 100644 --- a/src/test/ui/consts/const-eval/promoted_errors.rs +++ b/src/test/ui/consts/const-eval/promoted_errors.rs @@ -1,3 +1,4 @@ +// build-fail // compile-flags: -O #![deny(const_err)] diff --git a/src/test/ui/consts/const-eval/promoted_errors.stderr b/src/test/ui/consts/const-eval/promoted_errors.stderr index 848a880ba49..8f17ef05f23 100644 --- a/src/test/ui/consts/const-eval/promoted_errors.stderr +++ b/src/test/ui/consts/const-eval/promoted_errors.stderr @@ -1,47 +1,47 @@ error: this expression will panic at runtime - --> $DIR/promoted_errors.rs:7:14 + --> $DIR/promoted_errors.rs:8:14 | LL | let _x = 0u32 - 1; | ^^^^^^^^ attempt to subtract with overflow | note: lint level defined here - --> $DIR/promoted_errors.rs:3:9 + --> $DIR/promoted_errors.rs:4:9 | LL | #![deny(const_err)] | ^^^^^^^^^ error: attempt to divide by zero - --> $DIR/promoted_errors.rs:9:20 + --> $DIR/promoted_errors.rs:10:20 | LL | println!("{}", 1/(1-1)); | ^^^^^^^ error: reaching this expression at runtime will panic or abort - --> $DIR/promoted_errors.rs:9:20 + --> $DIR/promoted_errors.rs:10:20 | LL | println!("{}", 1/(1-1)); | ^^^^^^^ dividing by zero error: attempt to divide by zero - --> $DIR/promoted_errors.rs:12:14 + --> $DIR/promoted_errors.rs:13:14 | LL | let _x = 1/(1-1); | ^^^^^^^ error: attempt to divide by zero - --> $DIR/promoted_errors.rs:14:20 + --> $DIR/promoted_errors.rs:15:20 | LL | println!("{}", 1/(false as u32)); | ^^^^^^^^^^^^^^^^ error: reaching this expression at runtime will panic or abort - --> $DIR/promoted_errors.rs:14:20 + --> $DIR/promoted_errors.rs:15:20 | LL | println!("{}", 1/(false as u32)); | ^^^^^^^^^^^^^^^^ dividing by zero error: attempt to divide by zero - --> $DIR/promoted_errors.rs:17:14 + --> $DIR/promoted_errors.rs:18:14 | LL | let _x = 1/(false as u32); | ^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/consts/const-eval/promoted_errors2.rs b/src/test/ui/consts/const-eval/promoted_errors2.rs index 58b17940912..ae680b4f107 100644 --- a/src/test/ui/consts/const-eval/promoted_errors2.rs +++ b/src/test/ui/consts/const-eval/promoted_errors2.rs @@ -1,3 +1,4 @@ +// build-fail // compile-flags: -C overflow-checks=on -O #![deny(const_err)] diff --git a/src/test/ui/consts/const-eval/promoted_errors2.stderr b/src/test/ui/consts/const-eval/promoted_errors2.stderr index 6f4b1c045f4..60a3cba6e1f 100644 --- a/src/test/ui/consts/const-eval/promoted_errors2.stderr +++ b/src/test/ui/consts/const-eval/promoted_errors2.stderr @@ -1,53 +1,53 @@ error: attempt to subtract with overflow - --> $DIR/promoted_errors2.rs:6:20 + --> $DIR/promoted_errors2.rs:7:20 | LL | println!("{}", 0u32 - 1); | ^^^^^^^^ | note: lint level defined here - --> $DIR/promoted_errors2.rs:3:9 + --> $DIR/promoted_errors2.rs:4:9 | LL | #![deny(const_err)] | ^^^^^^^^^ error: attempt to subtract with overflow - --> $DIR/promoted_errors2.rs:8:14 + --> $DIR/promoted_errors2.rs:9:14 | LL | let _x = 0u32 - 1; | ^^^^^^^^ error: attempt to divide by zero - --> $DIR/promoted_errors2.rs:10:20 + --> $DIR/promoted_errors2.rs:11:20 | LL | println!("{}", 1/(1-1)); | ^^^^^^^ error: reaching this expression at runtime will panic or abort - --> $DIR/promoted_errors2.rs:10:20 + --> $DIR/promoted_errors2.rs:11:20 | LL | println!("{}", 1/(1-1)); | ^^^^^^^ dividing by zero error: attempt to divide by zero - --> $DIR/promoted_errors2.rs:13:14 + --> $DIR/promoted_errors2.rs:14:14 | LL | let _x = 1/(1-1); | ^^^^^^^ error: attempt to divide by zero - --> $DIR/promoted_errors2.rs:15:20 + --> $DIR/promoted_errors2.rs:16:20 | LL | println!("{}", 1/(false as u32)); | ^^^^^^^^^^^^^^^^ error: reaching this expression at runtime will panic or abort - --> $DIR/promoted_errors2.rs:15:20 + --> $DIR/promoted_errors2.rs:16:20 | LL | println!("{}", 1/(false as u32)); | ^^^^^^^^^^^^^^^^ dividing by zero error: attempt to divide by zero - --> $DIR/promoted_errors2.rs:18:14 + --> $DIR/promoted_errors2.rs:19:14 | LL | let _x = 1/(false as u32); | ^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/consts/const-prop-ice.rs b/src/test/ui/consts/const-prop-ice.rs index 13309f978b6..8682d2ee901 100644 --- a/src/test/ui/consts/const-prop-ice.rs +++ b/src/test/ui/consts/const-prop-ice.rs @@ -1,3 +1,5 @@ +// build-fail + fn main() { [0; 3][3u64 as usize]; //~ ERROR the len is 3 but the index is 3 } diff --git a/src/test/ui/consts/const-prop-ice.stderr b/src/test/ui/consts/const-prop-ice.stderr index 4b3880198bf..65502a4ff71 100644 --- a/src/test/ui/consts/const-prop-ice.stderr +++ b/src/test/ui/consts/const-prop-ice.stderr @@ -1,5 +1,5 @@ error: index out of bounds: the len is 3 but the index is 3 - --> $DIR/const-prop-ice.rs:2:5 + --> $DIR/const-prop-ice.rs:4:5 | LL | [0; 3][3u64 as usize]; | ^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/consts/const-prop-ice2.rs b/src/test/ui/consts/const-prop-ice2.rs index e5fd79f1167..6a73483026f 100644 --- a/src/test/ui/consts/const-prop-ice2.rs +++ b/src/test/ui/consts/const-prop-ice2.rs @@ -1,3 +1,5 @@ +// build-fail + fn main() { enum Enum { One=1 } let xs=[0;1 as usize]; diff --git a/src/test/ui/consts/const-prop-ice2.stderr b/src/test/ui/consts/const-prop-ice2.stderr index dc17876eae4..cbb8fde80f9 100644 --- a/src/test/ui/consts/const-prop-ice2.stderr +++ b/src/test/ui/consts/const-prop-ice2.stderr @@ -1,5 +1,5 @@ error: index out of bounds: the len is 1 but the index is 1 - --> $DIR/const-prop-ice2.rs:4:20 + --> $DIR/const-prop-ice2.rs:6:20 | LL | println!("{}", xs[Enum::One as usize]); | ^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/consts/miri_unleashed/assoc_const.rs b/src/test/ui/consts/miri_unleashed/assoc_const.rs index b8959667cc2..cfbcc959d3b 100644 --- a/src/test/ui/consts/miri_unleashed/assoc_const.rs +++ b/src/test/ui/consts/miri_unleashed/assoc_const.rs @@ -1,4 +1,6 @@ +// build-fail // compile-flags: -Zunleash-the-miri-inside-of-you + #![allow(const_err)] // a test demonstrating why we do need to run static const qualification on associated constants diff --git a/src/test/ui/consts/miri_unleashed/assoc_const.stderr b/src/test/ui/consts/miri_unleashed/assoc_const.stderr index 6a6cb343f17..1ccf2b196fd 100644 --- a/src/test/ui/consts/miri_unleashed/assoc_const.stderr +++ b/src/test/ui/consts/miri_unleashed/assoc_const.stderr @@ -1,11 +1,11 @@ warning: skipping const checks - --> $DIR/assoc_const.rs:12:20 + --> $DIR/assoc_const.rs:14:20 | LL | const F: u32 = (U::X, 42).1; | ^^^^^^^^^^ error[E0080]: erroneous constant used - --> $DIR/assoc_const.rs:29:13 + --> $DIR/assoc_const.rs:31:13 | LL | let y = <String as Bar<Vec<u32>, String>>::F; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors diff --git a/src/test/ui/consts/miri_unleashed/assoc_const_2.rs b/src/test/ui/consts/miri_unleashed/assoc_const_2.rs index c87b6389848..30dd2a51585 100644 --- a/src/test/ui/consts/miri_unleashed/assoc_const_2.rs +++ b/src/test/ui/consts/miri_unleashed/assoc_const_2.rs @@ -1,3 +1,5 @@ +// build-fail + #![allow(const_err)] // a test demonstrating that const qualification cannot prevent monomorphization time errors diff --git a/src/test/ui/consts/miri_unleashed/assoc_const_2.stderr b/src/test/ui/consts/miri_unleashed/assoc_const_2.stderr index dbfe1d93aa4..e15717979c5 100644 --- a/src/test/ui/consts/miri_unleashed/assoc_const_2.stderr +++ b/src/test/ui/consts/miri_unleashed/assoc_const_2.stderr @@ -1,5 +1,5 @@ error[E0080]: erroneous constant used - --> $DIR/assoc_const_2.rs:27:13 + --> $DIR/assoc_const_2.rs:29:13 | LL | let y = <String as Bar<String>>::F; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors diff --git a/src/test/ui/consts/miri_unleashed/non_const_fn.rs b/src/test/ui/consts/miri_unleashed/non_const_fn.rs index e1ac4306575..32a713ebaa4 100644 --- a/src/test/ui/consts/miri_unleashed/non_const_fn.rs +++ b/src/test/ui/consts/miri_unleashed/non_const_fn.rs @@ -1,4 +1,6 @@ +// build-fail // compile-flags: -Zunleash-the-miri-inside-of-you + #![warn(const_err)] // A test demonstrating that we prevent calling non-const fn during CTFE. diff --git a/src/test/ui/consts/miri_unleashed/non_const_fn.stderr b/src/test/ui/consts/miri_unleashed/non_const_fn.stderr index 7a574b34304..75f532a81bd 100644 --- a/src/test/ui/consts/miri_unleashed/non_const_fn.stderr +++ b/src/test/ui/consts/miri_unleashed/non_const_fn.stderr @@ -1,11 +1,11 @@ warning: skipping const checks - --> $DIR/non_const_fn.rs:8:15 + --> $DIR/non_const_fn.rs:10:15 | LL | const C: () = foo(); | ^^^^^ warning: any use of this value will cause an error - --> $DIR/non_const_fn.rs:8:15 + --> $DIR/non_const_fn.rs:10:15 | LL | const C: () = foo(); | --------------^^^^^- @@ -13,13 +13,13 @@ LL | const C: () = foo(); | calling non-const function `foo` | note: lint level defined here - --> $DIR/non_const_fn.rs:2:9 + --> $DIR/non_const_fn.rs:4:9 | LL | #![warn(const_err)] | ^^^^^^^^^ error[E0080]: evaluation of constant expression failed - --> $DIR/non_const_fn.rs:12:22 + --> $DIR/non_const_fn.rs:14:22 | LL | println!("{:?}", C); | ^ referenced constant has errors diff --git a/src/test/ui/consts/uninhabited-const-issue-61744.rs b/src/test/ui/consts/uninhabited-const-issue-61744.rs index e10b38a614a..945017b4937 100644 --- a/src/test/ui/consts/uninhabited-const-issue-61744.rs +++ b/src/test/ui/consts/uninhabited-const-issue-61744.rs @@ -1,4 +1,4 @@ -// compile-fail +// build-fail pub const unsafe fn fake_type<T>() -> T { hint_unreachable() diff --git a/src/test/ui/duplicate/dupe-symbols-1.rs b/src/test/ui/duplicate/dupe-symbols-1.rs index f943c7b1110..28e329b56ca 100644 --- a/src/test/ui/duplicate/dupe-symbols-1.rs +++ b/src/test/ui/duplicate/dupe-symbols-1.rs @@ -1,3 +1,5 @@ +// build-fail + // #![crate_type="rlib"] #![allow(warnings)] diff --git a/src/test/ui/duplicate/dupe-symbols-1.stderr b/src/test/ui/duplicate/dupe-symbols-1.stderr index c46ac0c6ed4..cca8b4d25da 100644 --- a/src/test/ui/duplicate/dupe-symbols-1.stderr +++ b/src/test/ui/duplicate/dupe-symbols-1.stderr @@ -1,5 +1,5 @@ error: symbol `fail` is already defined - --> $DIR/dupe-symbols-1.rs:10:1 + --> $DIR/dupe-symbols-1.rs:12:1 | LL | / pub fn b() { LL | | diff --git a/src/test/ui/duplicate/dupe-symbols-2.rs b/src/test/ui/duplicate/dupe-symbols-2.rs index 9257f97fb93..d9edd77a199 100644 --- a/src/test/ui/duplicate/dupe-symbols-2.rs +++ b/src/test/ui/duplicate/dupe-symbols-2.rs @@ -1,3 +1,5 @@ +// build-fail + // #![crate_type="rlib"] #![allow(warnings)] diff --git a/src/test/ui/duplicate/dupe-symbols-2.stderr b/src/test/ui/duplicate/dupe-symbols-2.stderr index 821bdd03392..017aade3129 100644 --- a/src/test/ui/duplicate/dupe-symbols-2.stderr +++ b/src/test/ui/duplicate/dupe-symbols-2.stderr @@ -1,5 +1,5 @@ error: symbol `fail` is already defined - --> $DIR/dupe-symbols-2.rs:13:5 + --> $DIR/dupe-symbols-2.rs:15:5 | LL | / pub extern fn fail() { LL | | diff --git a/src/test/ui/duplicate/dupe-symbols-3.rs b/src/test/ui/duplicate/dupe-symbols-3.rs index 03b3a0ab207..1af2fe98e50 100644 --- a/src/test/ui/duplicate/dupe-symbols-3.rs +++ b/src/test/ui/duplicate/dupe-symbols-3.rs @@ -1,3 +1,5 @@ +// build-fail + // #![crate_type="rlib"] #![allow(warnings)] diff --git a/src/test/ui/duplicate/dupe-symbols-3.stderr b/src/test/ui/duplicate/dupe-symbols-3.stderr index f30c88e4760..2e2ac3a98b8 100644 --- a/src/test/ui/duplicate/dupe-symbols-3.stderr +++ b/src/test/ui/duplicate/dupe-symbols-3.stderr @@ -1,5 +1,5 @@ error: symbol `fail` is already defined - --> $DIR/dupe-symbols-3.rs:10:1 + --> $DIR/dupe-symbols-3.rs:12:1 | LL | / pub fn fail() { LL | | diff --git a/src/test/ui/duplicate/dupe-symbols-4.rs b/src/test/ui/duplicate/dupe-symbols-4.rs index 8fbf1151f7c..de6610c3e79 100644 --- a/src/test/ui/duplicate/dupe-symbols-4.rs +++ b/src/test/ui/duplicate/dupe-symbols-4.rs @@ -1,3 +1,5 @@ +// build-fail + // // error-pattern: symbol `fail` is already defined #![crate_type="rlib"] diff --git a/src/test/ui/duplicate/dupe-symbols-4.stderr b/src/test/ui/duplicate/dupe-symbols-4.stderr index 84d57766c35..10b93891b66 100644 --- a/src/test/ui/duplicate/dupe-symbols-4.stderr +++ b/src/test/ui/duplicate/dupe-symbols-4.stderr @@ -1,5 +1,5 @@ error: symbol `fail` is already defined - --> $DIR/dupe-symbols-4.rs:21:5 + --> $DIR/dupe-symbols-4.rs:23:5 | LL | fn fail(self) {} | ^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/duplicate/dupe-symbols-5.rs b/src/test/ui/duplicate/dupe-symbols-5.rs index 4a96a685821..ea801cef64f 100644 --- a/src/test/ui/duplicate/dupe-symbols-5.rs +++ b/src/test/ui/duplicate/dupe-symbols-5.rs @@ -1,3 +1,5 @@ +// build-fail + // #![crate_type="rlib"] #![allow(warnings)] diff --git a/src/test/ui/duplicate/dupe-symbols-5.stderr b/src/test/ui/duplicate/dupe-symbols-5.stderr index cee72660e4f..ebeb19f94f6 100644 --- a/src/test/ui/duplicate/dupe-symbols-5.stderr +++ b/src/test/ui/duplicate/dupe-symbols-5.stderr @@ -1,5 +1,5 @@ error: symbol `fail` is already defined - --> $DIR/dupe-symbols-5.rs:9:1 + --> $DIR/dupe-symbols-5.rs:11:1 | LL | / pub fn b() { LL | | diff --git a/src/test/ui/duplicate/dupe-symbols-6.rs b/src/test/ui/duplicate/dupe-symbols-6.rs index 5a1b917f179..018f4bb7f07 100644 --- a/src/test/ui/duplicate/dupe-symbols-6.rs +++ b/src/test/ui/duplicate/dupe-symbols-6.rs @@ -1,3 +1,5 @@ +// build-fail + #![crate_type="rlib"] #![allow(warnings)] diff --git a/src/test/ui/duplicate/dupe-symbols-6.stderr b/src/test/ui/duplicate/dupe-symbols-6.stderr index 69781ee3e0d..8d5b7fb35bf 100644 --- a/src/test/ui/duplicate/dupe-symbols-6.stderr +++ b/src/test/ui/duplicate/dupe-symbols-6.stderr @@ -1,5 +1,5 @@ error: symbol `fail` is already defined - --> $DIR/dupe-symbols-6.rs:8:1 + --> $DIR/dupe-symbols-6.rs:10:1 | LL | static HELLO_TWICE: u16 = 0; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/duplicate/dupe-symbols-7.rs b/src/test/ui/duplicate/dupe-symbols-7.rs index b838aaa102e..89a32c61620 100644 --- a/src/test/ui/duplicate/dupe-symbols-7.rs +++ b/src/test/ui/duplicate/dupe-symbols-7.rs @@ -1,3 +1,5 @@ +// build-fail + // // error-pattern: entry symbol `main` defined multiple times diff --git a/src/test/ui/duplicate/dupe-symbols-7.stderr b/src/test/ui/duplicate/dupe-symbols-7.stderr index d2cb4e0970e..608ae27110a 100644 --- a/src/test/ui/duplicate/dupe-symbols-7.stderr +++ b/src/test/ui/duplicate/dupe-symbols-7.stderr @@ -1,5 +1,5 @@ error: entry symbol `main` defined multiple times - --> $DIR/dupe-symbols-7.rs:10:1 + --> $DIR/dupe-symbols-7.rs:12:1 | LL | fn main(){} | ^^^^^^^^^^^ diff --git a/src/test/ui/error-codes/E0511.rs b/src/test/ui/error-codes/E0511.rs index 3590f12e5f9..a52f81a6c5d 100644 --- a/src/test/ui/error-codes/E0511.rs +++ b/src/test/ui/error-codes/E0511.rs @@ -1,3 +1,5 @@ +// build-fail + #![feature(platform_intrinsics)] extern "platform-intrinsic" { diff --git a/src/test/ui/error-codes/E0511.stderr b/src/test/ui/error-codes/E0511.stderr index 1362a3d1f25..d797b10d5a6 100644 --- a/src/test/ui/error-codes/E0511.stderr +++ b/src/test/ui/error-codes/E0511.stderr @@ -1,5 +1,5 @@ error[E0511]: invalid monomorphization of `simd_add` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/E0511.rs:8:14 + --> $DIR/E0511.rs:10:14 | LL | unsafe { simd_add(0, 1); } | ^^^^^^^^^^^^^^ diff --git a/src/test/ui/feature-gates/feature-gate-generic_associated_types.rs b/src/test/ui/feature-gates/feature-gate-generic_associated_types.rs index 17548d7b9e8..7ff348aca7c 100644 --- a/src/test/ui/feature-gates/feature-gate-generic_associated_types.rs +++ b/src/test/ui/feature-gates/feature-gate-generic_associated_types.rs @@ -3,9 +3,11 @@ use std::ops::Deref; trait PointerFamily<U> { type Pointer<T>: Deref<Target = T>; //~^ ERROR generic associated types are unstable + //~| ERROR type-generic associated types are not yet implemented type Pointer2<T>: Deref<Target = T> where T: Clone, U: Clone; //~^ ERROR generic associated types are unstable //~| ERROR where clauses on associated types are unstable + //~| ERROR type-generic associated types are not yet implemented } struct Foo; diff --git a/src/test/ui/feature-gates/feature-gate-generic_associated_types.stderr b/src/test/ui/feature-gates/feature-gate-generic_associated_types.stderr index 04473f41069..ab17c9a28ae 100644 --- a/src/test/ui/feature-gates/feature-gate-generic_associated_types.stderr +++ b/src/test/ui/feature-gates/feature-gate-generic_associated_types.stderr @@ -8,7 +8,7 @@ LL | type Pointer<T>: Deref<Target = T>; = help: add `#![feature(generic_associated_types)]` to the crate attributes to enable error[E0658]: generic associated types are unstable - --> $DIR/feature-gate-generic_associated_types.rs:6:5 + --> $DIR/feature-gate-generic_associated_types.rs:7:5 | LL | type Pointer2<T>: Deref<Target = T> where T: Clone, U: Clone; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -17,7 +17,7 @@ LL | type Pointer2<T>: Deref<Target = T> where T: Clone, U: Clone; = help: add `#![feature(generic_associated_types)]` to the crate attributes to enable error[E0658]: where clauses on associated types are unstable - --> $DIR/feature-gate-generic_associated_types.rs:6:5 + --> $DIR/feature-gate-generic_associated_types.rs:7:5 | LL | type Pointer2<T>: Deref<Target = T> where T: Clone, U: Clone; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -26,7 +26,7 @@ LL | type Pointer2<T>: Deref<Target = T> where T: Clone, U: Clone; = help: add `#![feature(generic_associated_types)]` to the crate attributes to enable error[E0658]: generic associated types are unstable - --> $DIR/feature-gate-generic_associated_types.rs:14:5 + --> $DIR/feature-gate-generic_associated_types.rs:16:5 | LL | type Pointer<Usize> = Box<Usize>; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -35,7 +35,7 @@ LL | type Pointer<Usize> = Box<Usize>; = help: add `#![feature(generic_associated_types)]` to the crate attributes to enable error[E0658]: generic associated types are unstable - --> $DIR/feature-gate-generic_associated_types.rs:16:5 + --> $DIR/feature-gate-generic_associated_types.rs:18:5 | LL | type Pointer2<U32> = Box<U32>; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -44,7 +44,7 @@ LL | type Pointer2<U32> = Box<U32>; = help: add `#![feature(generic_associated_types)]` to the crate attributes to enable error[E0658]: where clauses on associated types are unstable - --> $DIR/feature-gate-generic_associated_types.rs:21:5 + --> $DIR/feature-gate-generic_associated_types.rs:23:5 | LL | type Assoc where Self: Sized; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -53,7 +53,7 @@ LL | type Assoc where Self: Sized; = help: add `#![feature(generic_associated_types)]` to the crate attributes to enable error[E0658]: where clauses on associated types are unstable - --> $DIR/feature-gate-generic_associated_types.rs:26:5 + --> $DIR/feature-gate-generic_associated_types.rs:28:5 | LL | type Assoc where Self: Sized = Foo; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -61,6 +61,22 @@ LL | type Assoc where Self: Sized = Foo; = note: for more information, see https://github.com/rust-lang/rust/issues/44265 = help: add `#![feature(generic_associated_types)]` to the crate attributes to enable -error: aborting due to 7 previous errors +error: type-generic associated types are not yet implemented + --> $DIR/feature-gate-generic_associated_types.rs:4:5 + | +LL | type Pointer<T>: Deref<Target = T>; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: for more information, see https://github.com/rust-lang/rust/issues/44265 + +error: type-generic associated types are not yet implemented + --> $DIR/feature-gate-generic_associated_types.rs:7:5 + | +LL | type Pointer2<T>: Deref<Target = T> where T: Clone, U: Clone; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: for more information, see https://github.com/rust-lang/rust/issues/44265 + +error: aborting due to 9 previous errors For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/rfc1598-generic-associated-types/collections.rs b/src/test/ui/generic-associated-types/collections.rs index ede6a3b2b39..6f018f04018 100644 --- a/src/test/ui/rfc1598-generic-associated-types/collections.rs +++ b/src/test/ui/generic-associated-types/collections.rs @@ -1,10 +1,7 @@ +#![allow(incomplete_features)] #![feature(generic_associated_types)] -//~^ WARNING the feature `generic_associated_types` is incomplete #![feature(associated_type_defaults)] -// FIXME(#44265): "lifetime arguments are not allowed for this type" errors will be addressed in a -// follow-up PR. - // A Collection trait and collection families. Based on // http://smallcultfollowing.com/babysteps/blog/2016/11/03/ // associated-type-constructors-part-2-family-traits/ @@ -15,18 +12,18 @@ trait Collection<T> { // Test associated type defaults with parameters type Sibling<U>: Collection<U> = <<Self as Collection<T>>::Family as CollectionFamily>::Member<U>; - //~^ ERROR type arguments are not allowed for this type [E0109] + //~^^ ERROR type-generic associated types are not yet implemented fn empty() -> Self; fn add(&mut self, value: T); fn iterate<'iter>(&'iter self) -> Self::Iter<'iter>; - //~^ ERROR lifetime arguments are not allowed for this type [E0109] } trait CollectionFamily { type Member<T>: Collection<T, Family = Self>; + //~^ ERROR type-generic associated types are not yet implemented } struct VecFamily; @@ -48,13 +45,11 @@ impl<T> Collection<T> for Vec<T> { } fn iterate<'iter>(&'iter self) -> Self::Iter<'iter> { - //~^ ERROR lifetime arguments are not allowed for this type [E0109] self.iter() } } fn floatify<C>(ints: &C) -> <<C as Collection<i32>>::Family as CollectionFamily>::Member<f32> -//~^ ERROR type arguments are not allowed for this type [E0109] where C: Collection<i32>, { @@ -66,7 +61,6 @@ where } fn floatify_sibling<C>(ints: &C) -> <C as Collection<i32>>::Sibling<f32> -//~^ ERROR type arguments are not allowed for this type [E0109] where C: Collection<i32>, { diff --git a/src/test/ui/generic-associated-types/collections.stderr b/src/test/ui/generic-associated-types/collections.stderr new file mode 100644 index 00000000000..e99ae78f714 --- /dev/null +++ b/src/test/ui/generic-associated-types/collections.stderr @@ -0,0 +1,19 @@ +error: type-generic associated types are not yet implemented + --> $DIR/collections.rs:13:5 + | +LL | / type Sibling<U>: Collection<U> = +LL | | <<Self as Collection<T>>::Family as CollectionFamily>::Member<U>; + | |_________________________________________________________________________^ + | + = note: for more information, see https://github.com/rust-lang/rust/issues/44265 + +error: type-generic associated types are not yet implemented + --> $DIR/collections.rs:25:5 + | +LL | type Member<T>: Collection<T, Family = Self>; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: for more information, see https://github.com/rust-lang/rust/issues/44265 + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/generic-associated-types/construct_with_other_type.rs b/src/test/ui/generic-associated-types/construct_with_other_type.rs new file mode 100644 index 00000000000..2198b99db25 --- /dev/null +++ b/src/test/ui/generic-associated-types/construct_with_other_type.rs @@ -0,0 +1,26 @@ +#![allow(incomplete_features)] +#![feature(generic_associated_types)] + +// FIXME(#30472) normalize enough to handle this. + +use std::ops::Deref; + +trait Foo { + type Bar<'a, 'b>; +} + +trait Baz { + type Quux<'a>: Foo where Self: 'a; + + // This weird type tests that we can use universal function call syntax to access the Item on + type Baa<'a>: Deref<Target = <Self::Quux<'a> as Foo>::Bar<'a, 'static>> where Self: 'a; +} + +impl<T> Baz for T where T: Foo { +//~^ ERROR type mismatch resolving + type Quux<'a> where T: 'a = T; + + type Baa<'a> where T: 'a = &'a <T as Foo>::Bar<'a, 'static>; +} + +fn main() {} diff --git a/src/test/ui/generic-associated-types/construct_with_other_type.stderr b/src/test/ui/generic-associated-types/construct_with_other_type.stderr new file mode 100644 index 00000000000..bad746f7ef1 --- /dev/null +++ b/src/test/ui/generic-associated-types/construct_with_other_type.stderr @@ -0,0 +1,13 @@ +error[E0271]: type mismatch resolving `for<'a> <<T as Baz>::Baa<'a> as std::ops::Deref>::Target == <<T as Baz>::Quux<'a> as Foo>::Bar<'a, 'static>` + --> $DIR/construct_with_other_type.rs:19:9 + | +LL | impl<T> Baz for T where T: Foo { + | ^^^ expected type parameter `T`, found associated type + | + = note: expected associated type `<T as Foo>::Bar<'_, 'static>` + found associated type `<<T as Baz>::Quux<'_> as Foo>::Bar<'_, 'static>` + = note: you might be missing a type parameter or trait bound + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0271`. diff --git a/src/test/ui/rfc1598-generic-associated-types/empty_generics.rs b/src/test/ui/generic-associated-types/empty_generics.rs index afc27701920..522e23ca43d 100644 --- a/src/test/ui/rfc1598-generic-associated-types/empty_generics.rs +++ b/src/test/ui/generic-associated-types/empty_generics.rs @@ -1,5 +1,5 @@ +#![allow(incomplete_features)] #![feature(generic_associated_types)] -//~^ WARNING the feature `generic_associated_types` is incomplete trait Foo { type Bar<,>; diff --git a/src/test/ui/generic-associated-types/empty_generics.stderr b/src/test/ui/generic-associated-types/empty_generics.stderr new file mode 100644 index 00000000000..d3acad47831 --- /dev/null +++ b/src/test/ui/generic-associated-types/empty_generics.stderr @@ -0,0 +1,8 @@ +error: expected one of `>`, `const`, identifier, or lifetime, found `,` + --> $DIR/empty_generics.rs:5:14 + | +LL | type Bar<,>; + | ^ expected one of `>`, `const`, identifier, or lifetime + +error: aborting due to previous error + diff --git a/src/test/ui/generic-associated-types/gat-dont-ice-on-absent-feature-2.rs b/src/test/ui/generic-associated-types/gat-dont-ice-on-absent-feature-2.rs new file mode 100644 index 00000000000..f88df6a608a --- /dev/null +++ b/src/test/ui/generic-associated-types/gat-dont-ice-on-absent-feature-2.rs @@ -0,0 +1,17 @@ +// rust-lang/rust#60654: Do not ICE on an attempt to use GATs that is +// missing the feature gate. + +struct Foo; + +trait MyTrait { + type Item<T>; + //~^ ERROR generic associated types are unstable [E0658] + //~| ERROR type-generic associated types are not yet implemented +} + +impl MyTrait for Foo { + type Item<T> = T; + //~^ ERROR generic associated types are unstable [E0658] +} + +fn main() { } diff --git a/src/test/ui/generic-associated-types/gat-dont-ice-on-absent-feature-2.stderr b/src/test/ui/generic-associated-types/gat-dont-ice-on-absent-feature-2.stderr new file mode 100644 index 00000000000..a7d280d6359 --- /dev/null +++ b/src/test/ui/generic-associated-types/gat-dont-ice-on-absent-feature-2.stderr @@ -0,0 +1,29 @@ +error[E0658]: generic associated types are unstable + --> $DIR/gat-dont-ice-on-absent-feature-2.rs:7:5 + | +LL | type Item<T>; + | ^^^^^^^^^^^^^ + | + = note: for more information, see https://github.com/rust-lang/rust/issues/44265 + = help: add `#![feature(generic_associated_types)]` to the crate attributes to enable + +error[E0658]: generic associated types are unstable + --> $DIR/gat-dont-ice-on-absent-feature-2.rs:13:5 + | +LL | type Item<T> = T; + | ^^^^^^^^^^^^^^^^^ + | + = note: for more information, see https://github.com/rust-lang/rust/issues/44265 + = help: add `#![feature(generic_associated_types)]` to the crate attributes to enable + +error: type-generic associated types are not yet implemented + --> $DIR/gat-dont-ice-on-absent-feature-2.rs:7:5 + | +LL | type Item<T>; + | ^^^^^^^^^^^^^ + | + = note: for more information, see https://github.com/rust-lang/rust/issues/44265 + +error: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/rfc1598-generic-associated-types/gat-dont-ice-on-absent-feature.rs b/src/test/ui/generic-associated-types/gat-dont-ice-on-absent-feature.rs index 84fbb47301f..e8fc47d2a59 100644 --- a/src/test/ui/rfc1598-generic-associated-types/gat-dont-ice-on-absent-feature.rs +++ b/src/test/ui/generic-associated-types/gat-dont-ice-on-absent-feature.rs @@ -4,7 +4,9 @@ struct Foo; impl Iterator for Foo { - type Item<'b> = &'b Foo; //~ ERROR generic associated types are unstable [E0658] + type Item<'b> = &'b Foo; + //~^ ERROR generic associated types are unstable [E0658] + //~| ERROR lifetime parameters or bounds on type `Item` do not match the trait declaration fn next(&mut self) -> Option<Self::Item> { None diff --git a/src/test/ui/generic-associated-types/gat-dont-ice-on-absent-feature.stderr b/src/test/ui/generic-associated-types/gat-dont-ice-on-absent-feature.stderr new file mode 100644 index 00000000000..9031071ff69 --- /dev/null +++ b/src/test/ui/generic-associated-types/gat-dont-ice-on-absent-feature.stderr @@ -0,0 +1,19 @@ +error[E0658]: generic associated types are unstable + --> $DIR/gat-dont-ice-on-absent-feature.rs:7:5 + | +LL | type Item<'b> = &'b Foo; + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: for more information, see https://github.com/rust-lang/rust/issues/44265 + = help: add `#![feature(generic_associated_types)]` to the crate attributes to enable + +error[E0195]: lifetime parameters or bounds on type `Item` do not match the trait declaration + --> $DIR/gat-dont-ice-on-absent-feature.rs:7:14 + | +LL | type Item<'b> = &'b Foo; + | ^^^^ lifetimes do not match type in trait + +error: aborting due to 2 previous errors + +Some errors have detailed explanations: E0195, E0658. +For more information about an error, try `rustc --explain E0195`. diff --git a/src/test/ui/rfc1598-generic-associated-types/gat-incomplete-warning.rs b/src/test/ui/generic-associated-types/gat-incomplete-warning.rs index 33593884de3..33593884de3 100644 --- a/src/test/ui/rfc1598-generic-associated-types/gat-incomplete-warning.rs +++ b/src/test/ui/generic-associated-types/gat-incomplete-warning.rs diff --git a/src/test/ui/rfc1598-generic-associated-types/gat-incomplete-warning.stderr b/src/test/ui/generic-associated-types/gat-incomplete-warning.stderr index d75f9fb8451..d75f9fb8451 100644 --- a/src/test/ui/rfc1598-generic-associated-types/gat-incomplete-warning.stderr +++ b/src/test/ui/generic-associated-types/gat-incomplete-warning.stderr diff --git a/src/test/ui/rfc1598-generic-associated-types/generic-associated-types-where.rs b/src/test/ui/generic-associated-types/generic-associated-types-where.rs index 01daf307c00..589024e1621 100644 --- a/src/test/ui/rfc1598-generic-associated-types/generic-associated-types-where.rs +++ b/src/test/ui/generic-associated-types/generic-associated-types-where.rs @@ -1,4 +1,5 @@ -#![feature(generic_associated_types)] //~ WARN `generic_associated_types` is incomplete +#![allow(incomplete_features)] +#![feature(generic_associated_types)] // Checking the interaction with this other feature #![feature(associated_type_defaults)] @@ -8,8 +9,11 @@ use std::fmt::{Display, Debug}; trait Foo { type Assoc where Self: Sized; type Assoc2<T> where T: Display; + //~^ ERROR type-generic associated types are not yet implemented type Assoc3<T>; - type WithDefault<T> where T: Debug = dyn Iterator<Item=T>; + //~^ ERROR type-generic associated types are not yet implemented + type WithDefault<'a, T: Debug + 'a> = dyn Iterator<Item=T>; + //~^ ERROR type-generic associated types are not yet implemented type NoGenerics; } @@ -19,7 +23,7 @@ impl Foo for Bar { type Assoc = usize; type Assoc2<T> = Vec<T>; type Assoc3<T> where T: Iterator = Vec<T>; - type WithDefault<'a, T> = &'a dyn Iterator<T>; + type WithDefault<'a, T: Debug + 'a> = &'a dyn Iterator<Item=T>; type NoGenerics = ::std::cell::Cell<i32>; } diff --git a/src/test/ui/generic-associated-types/generic-associated-types-where.stderr b/src/test/ui/generic-associated-types/generic-associated-types-where.stderr new file mode 100644 index 00000000000..2144a5e7d9c --- /dev/null +++ b/src/test/ui/generic-associated-types/generic-associated-types-where.stderr @@ -0,0 +1,26 @@ +error: type-generic associated types are not yet implemented + --> $DIR/generic-associated-types-where.rs:11:5 + | +LL | type Assoc2<T> where T: Display; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: for more information, see https://github.com/rust-lang/rust/issues/44265 + +error: type-generic associated types are not yet implemented + --> $DIR/generic-associated-types-where.rs:13:5 + | +LL | type Assoc3<T>; + | ^^^^^^^^^^^^^^^ + | + = note: for more information, see https://github.com/rust-lang/rust/issues/44265 + +error: type-generic associated types are not yet implemented + --> $DIR/generic-associated-types-where.rs:15:5 + | +LL | type WithDefault<'a, T: Debug + 'a> = dyn Iterator<Item=T>; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: for more information, see https://github.com/rust-lang/rust/issues/44265 + +error: aborting due to 3 previous errors + diff --git a/src/test/ui/generic-associated-types/generic_associated_type_undeclared_lifetimes.rs b/src/test/ui/generic-associated-types/generic_associated_type_undeclared_lifetimes.rs new file mode 100644 index 00000000000..4b4e59a5124 --- /dev/null +++ b/src/test/ui/generic-associated-types/generic_associated_type_undeclared_lifetimes.rs @@ -0,0 +1,16 @@ +#![allow(incomplete_features)] +#![feature(generic_associated_types)] + +use std::ops::Deref; + +trait Iterable { + type Item<'a>; + type Iter<'a>: Iterator<Item = Self::Item<'a>> + + Deref<Target = Self::Item<'b>>; + //~^ ERROR undeclared lifetime + + fn iter<'a>(&'a self) -> Self::Iter<'undeclared>; + //~^ ERROR undeclared lifetime +} + +fn main() {} diff --git a/src/test/ui/generic-associated-types/generic_associated_type_undeclared_lifetimes.stderr b/src/test/ui/generic-associated-types/generic_associated_type_undeclared_lifetimes.stderr new file mode 100644 index 00000000000..81137e81dc4 --- /dev/null +++ b/src/test/ui/generic-associated-types/generic_associated_type_undeclared_lifetimes.stderr @@ -0,0 +1,15 @@ +error[E0261]: use of undeclared lifetime name `'b` + --> $DIR/generic_associated_type_undeclared_lifetimes.rs:9:37 + | +LL | + Deref<Target = Self::Item<'b>>; + | ^^ undeclared lifetime + +error[E0261]: use of undeclared lifetime name `'undeclared` + --> $DIR/generic_associated_type_undeclared_lifetimes.rs:12:41 + | +LL | fn iter<'a>(&'a self) -> Self::Iter<'undeclared>; + | ^^^^^^^^^^^ undeclared lifetime + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0261`. diff --git a/src/test/ui/generic-associated-types/impl_bounds.rs b/src/test/ui/generic-associated-types/impl_bounds.rs new file mode 100644 index 00000000000..3ffa6c6eec4 --- /dev/null +++ b/src/test/ui/generic-associated-types/impl_bounds.rs @@ -0,0 +1,23 @@ +#![allow(incomplete_features)] +#![feature(generic_associated_types)] +#![feature(associated_type_defaults)] + +trait Foo { + type A<'a> where Self: 'a; + type B<'a, 'b> where 'a: 'b; + type C where Self: Clone; +} + +#[derive(Copy, Clone)] +struct Fooy<T>(T); + +impl<T> Foo for Fooy<T> { + type A<'a> where Self: 'static = (&'a ()); + //~^ ERROR the parameter type `T` may not live long enough + type B<'a, 'b> where 'b: 'a = (&'a(), &'b ()); + //~^ ERROR lifetime bound not satisfied + type C where Self: Copy = String; + //~^ ERROR the trait bound `T: std::marker::Copy` is not satisfied +} + +fn main() {} diff --git a/src/test/ui/generic-associated-types/impl_bounds.stderr b/src/test/ui/generic-associated-types/impl_bounds.stderr new file mode 100644 index 00000000000..01799007693 --- /dev/null +++ b/src/test/ui/generic-associated-types/impl_bounds.stderr @@ -0,0 +1,46 @@ +error[E0310]: the parameter type `T` may not live long enough + --> $DIR/impl_bounds.rs:15:5 + | +LL | type A<'a> where Self: 'static = (&'a ()); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: consider adding an explicit lifetime bound `T: 'static`... +note: ...so that the type `Fooy<T>` will meet its required lifetime bounds + --> $DIR/impl_bounds.rs:15:5 + | +LL | type A<'a> where Self: 'static = (&'a ()); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0478]: lifetime bound not satisfied + --> $DIR/impl_bounds.rs:17:5 + | +LL | type B<'a, 'b> where 'b: 'a = (&'a(), &'b ()); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +note: lifetime parameter instantiated with the lifetime `'b` as defined on the associated item at 17:16 + --> $DIR/impl_bounds.rs:17:16 + | +LL | type B<'a, 'b> where 'b: 'a = (&'a(), &'b ()); + | ^^ +note: but lifetime parameter must outlive the lifetime `'a` as defined on the associated item at 17:12 + --> $DIR/impl_bounds.rs:17:12 + | +LL | type B<'a, 'b> where 'b: 'a = (&'a(), &'b ()); + | ^^ + +error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied + --> $DIR/impl_bounds.rs:19:5 + | +LL | impl<T> Foo for Fooy<T> { + | - help: consider restricting this bound: `T: std::marker::Copy` +... +LL | type C where Self: Copy = String; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `T` + | + = note: required because of the requirements on the impl of `std::marker::Copy` for `Fooy<T>` + = note: the requirement `Fooy<T>: std::marker::Copy` appears on the associated impl typebut not on the corresponding associated trait type + +error: aborting due to 3 previous errors + +Some errors have detailed explanations: E0277, E0310, E0478. +For more information about an error, try `rustc --explain E0277`. diff --git a/src/test/ui/generic-associated-types/impl_bounds_ok.rs b/src/test/ui/generic-associated-types/impl_bounds_ok.rs new file mode 100644 index 00000000000..2387b891755 --- /dev/null +++ b/src/test/ui/generic-associated-types/impl_bounds_ok.rs @@ -0,0 +1,30 @@ +// check-pass + +#![allow(incomplete_features)] +#![feature(generic_associated_types)] +#![feature(associated_type_defaults)] + +trait Foo { + type A<'a> where Self: 'a; + type B<'a, 'b> where 'a: 'b; + type C where Self: Clone; +} + +struct Fooy; + +impl Foo for Fooy { + type A<'a> = (&'a ()); + type B<'a, 'b> = (&'a(), &'b ()); + type C = String; +} + +#[derive(Clone)] +struct Fooer<T>(T); + +impl<T> Foo for Fooer<T> { + type A<'x> where T: 'x = (&'x ()); + type B<'u, 'v> where 'u: 'v = (&'v &'u ()); + type C where Self: ToOwned = String; +} + +fn main() {} diff --git a/src/test/ui/generic-associated-types/issue-47206-where-clause.rs b/src/test/ui/generic-associated-types/issue-47206-where-clause.rs new file mode 100644 index 00000000000..53e350aacf8 --- /dev/null +++ b/src/test/ui/generic-associated-types/issue-47206-where-clause.rs @@ -0,0 +1,17 @@ +// Check that this program doesn't cause the compiler to error without output. + +#![allow(incomplete_features)] +#![feature(generic_associated_types)] + +trait Foo { + type Assoc3<T>; + //~^ type-generic associated types are not yet implemented +} + +struct Bar; + +impl Foo for Bar { + type Assoc3<T> where T: Iterator = Vec<T>; +} + +fn main() {} diff --git a/src/test/ui/generic-associated-types/issue-47206-where-clause.stderr b/src/test/ui/generic-associated-types/issue-47206-where-clause.stderr new file mode 100644 index 00000000000..52207d759b9 --- /dev/null +++ b/src/test/ui/generic-associated-types/issue-47206-where-clause.stderr @@ -0,0 +1,10 @@ +error: type-generic associated types are not yet implemented + --> $DIR/issue-47206-where-clause.rs:7:5 + | +LL | type Assoc3<T>; + | ^^^^^^^^^^^^^^^ + | + = note: for more information, see https://github.com/rust-lang/rust/issues/44265 + +error: aborting due to previous error + diff --git a/src/test/ui/generic-associated-types/issue-58694-parameter-out-of-range.rs b/src/test/ui/generic-associated-types/issue-58694-parameter-out-of-range.rs new file mode 100644 index 00000000000..2298aa5b0b7 --- /dev/null +++ b/src/test/ui/generic-associated-types/issue-58694-parameter-out-of-range.rs @@ -0,0 +1,10 @@ +// check-pass + +#![allow(incomplete_features)] +#![feature(generic_associated_types)] + +trait Cert { + type PublicKey<'a>: From<&'a [u8]>; +} + +fn main() {} diff --git a/src/test/ui/generic-associated-types/issue-62326-parameter-out-of-range.rs b/src/test/ui/generic-associated-types/issue-62326-parameter-out-of-range.rs new file mode 100644 index 00000000000..db0da40aab0 --- /dev/null +++ b/src/test/ui/generic-associated-types/issue-62326-parameter-out-of-range.rs @@ -0,0 +1,12 @@ +#![allow(incomplete_features)] +#![feature(generic_associated_types)] + +// FIXME(generic-associated-types) Investigate why this doesn't compile. + +trait Iterator { +//~^ ERROR the requirement `for<'a> <Self as Iterator>::Item<'a> : 'a` is not satisfied + type Item<'a>: 'a; +} + + +fn main() {} diff --git a/src/test/ui/generic-associated-types/issue-62326-parameter-out-of-range.stderr b/src/test/ui/generic-associated-types/issue-62326-parameter-out-of-range.stderr new file mode 100644 index 00000000000..07169700f39 --- /dev/null +++ b/src/test/ui/generic-associated-types/issue-62326-parameter-out-of-range.stderr @@ -0,0 +1,15 @@ +error[E0280]: the requirement `for<'a> <Self as Iterator>::Item<'a> : 'a` is not satisfied + --> $DIR/issue-62326-parameter-out-of-range.rs:6:1 + | +LL | trait Iterator { + | ^------------- + | | + | _required by `Iterator` + | | +LL | | +LL | | type Item<'a>: 'a; +LL | | } + | |_^ + +error: aborting due to previous error + diff --git a/src/test/ui/generic-associated-types/iterable.rs b/src/test/ui/generic-associated-types/iterable.rs new file mode 100644 index 00000000000..105ab4a8adc --- /dev/null +++ b/src/test/ui/generic-associated-types/iterable.rs @@ -0,0 +1,51 @@ +#![allow(incomplete_features)] +#![feature(generic_associated_types)] + +// FIXME(#30472) normalize enough to handle this. + +trait Iterable { + type Item<'a> where Self: 'a; + type Iter<'a>: Iterator<Item = Self::Item<'a>> where Self: 'a; + + fn iter<'a>(&'a self) -> Self::Iter<'a>; +} + +// Impl for struct type +impl<T> Iterable for Vec<T> { + type Item<'a> where T: 'a = <std::slice::Iter<'a, T> as Iterator>::Item; + //~^ ERROR type mismatch resolving + type Iter<'a> where T: 'a = std::slice::Iter<'a, T>; + + fn iter<'a>(&'a self) -> Self::Iter<'a> { + //~^ ERROR type mismatch resolving + self.iter() + } +} + +// Impl for a primitive type +impl<T> Iterable for [T] { + type Item<'a> where T: 'a = <std::slice::Iter<'a, T> as Iterator>::Item; + //~^ ERROR type mismatch resolving + type Iter<'a> where T: 'a = std::slice::Iter<'a, T>; + + fn iter<'a>(&'a self) -> Self::Iter<'a> { + //~^ ERROR type mismatch resolving + self.iter() + } +} + +fn make_iter<'a, I: Iterable>(it: &'a I) -> I::Iter<'a> { + it.iter() +} + +fn get_first<'a, I: Iterable>(it: &'a I) -> Option<I::Item<'a>> { + it.iter().next() +} + +fn main() { + let v = vec![1, 2, 3]; + assert_eq!(v, make_iter(&v).copied().collect()); + assert_eq!(v, make_iter(&*v).copied().collect()); + assert_eq!(1, get_first(&v)); + assert_eq!(1, get_first(&*v)); +} diff --git a/src/test/ui/generic-associated-types/iterable.stderr b/src/test/ui/generic-associated-types/iterable.stderr new file mode 100644 index 00000000000..d0d75f3cc63 --- /dev/null +++ b/src/test/ui/generic-associated-types/iterable.stderr @@ -0,0 +1,63 @@ +error[E0271]: type mismatch resolving `for<'a> <<std::vec::Vec<T> as Iterable>::Iter<'a> as std::iter::Iterator>::Item == <std::vec::Vec<T> as Iterable>::Item<'a>` + --> $DIR/iterable.rs:15:5 + | +LL | impl<T> Iterable for Vec<T> { + | --------------------------- in this `impl` item +LL | type Item<'a> where T: 'a = <std::slice::Iter<'a, T> as Iterator>::Item; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected reference, found associated type + | + = note: expected reference `&T` + found associated type `<std::vec::Vec<T> as Iterable>::Item<'_>` + = note: consider constraining the associated type `<std::vec::Vec<T> as Iterable>::Item<'_>` to `&_` + = note: for more information, visit https://doc.rust-lang.org/book/ch19-03-advanced-traits.html + +error[E0271]: type mismatch resolving `for<'a> <<[T] as Iterable>::Iter<'a> as std::iter::Iterator>::Item == <[T] as Iterable>::Item<'a>` + --> $DIR/iterable.rs:27:5 + | +LL | impl<T> Iterable for [T] { + | ------------------------ in this `impl` item +LL | type Item<'a> where T: 'a = <std::slice::Iter<'a, T> as Iterator>::Item; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected reference, found associated type + | + = note: expected reference `&T` + found associated type `<[T] as Iterable>::Item<'_>` + = note: consider constraining the associated type `<[T] as Iterable>::Item<'_>` to `&_` + = note: for more information, visit https://doc.rust-lang.org/book/ch19-03-advanced-traits.html + +error[E0271]: type mismatch resolving `for<'a> <<std::vec::Vec<T> as Iterable>::Iter<'a> as std::iter::Iterator>::Item == <std::vec::Vec<T> as Iterable>::Item<'a>` + --> $DIR/iterable.rs:19:5 + | +LL | trait Iterable { + | -------------- required by `Iterable` +... +LL | / fn iter<'a>(&'a self) -> Self::Iter<'a> { +LL | | +LL | | self.iter() +LL | | } + | |_____^ expected associated type, found reference + | + = note: expected associated type `<std::vec::Vec<T> as Iterable>::Item<'_>` + found reference `&T` + = note: consider constraining the associated type `<std::vec::Vec<T> as Iterable>::Item<'_>` to `&_` or calling a method that returns `<std::vec::Vec<T> as Iterable>::Item<'_>` + = note: for more information, visit https://doc.rust-lang.org/book/ch19-03-advanced-traits.html + +error[E0271]: type mismatch resolving `for<'a> <<[T] as Iterable>::Iter<'a> as std::iter::Iterator>::Item == <[T] as Iterable>::Item<'a>` + --> $DIR/iterable.rs:31:5 + | +LL | trait Iterable { + | -------------- required by `Iterable` +... +LL | / fn iter<'a>(&'a self) -> Self::Iter<'a> { +LL | | +LL | | self.iter() +LL | | } + | |_____^ expected associated type, found reference + | + = note: expected associated type `<[T] as Iterable>::Item<'_>` + found reference `&T` + = note: consider constraining the associated type `<[T] as Iterable>::Item<'_>` to `&_` or calling a method that returns `<[T] as Iterable>::Item<'_>` + = note: for more information, visit https://doc.rust-lang.org/book/ch19-03-advanced-traits.html + +error: aborting due to 4 previous errors + +For more information about this error, try `rustc --explain E0271`. diff --git a/src/test/ui/generic-associated-types/parameter_number_and_kind.rs b/src/test/ui/generic-associated-types/parameter_number_and_kind.rs new file mode 100644 index 00000000000..0edc5c48c01 --- /dev/null +++ b/src/test/ui/generic-associated-types/parameter_number_and_kind.rs @@ -0,0 +1,24 @@ +#![allow(incomplete_features)] +#![feature(generic_associated_types)] +#![feature(associated_type_defaults)] + +trait Foo { + type A<'a>; + type B<'a, 'b>; + type C; + type D<T>; + //~^ ERROR type-generic associated types are not yet implemented + type E<'a, T>; + //~^ ERROR type-generic associated types are not yet implemented + // Test parameters in default values + type FOk<T> = Self::E<'static, T>; + //~^ ERROR type-generic associated types are not yet implemented + type FErr1 = Self::E<'static, 'static>; + //~^ ERROR wrong number of lifetime arguments: expected 1, found 2 + //~| ERROR wrong number of type arguments: expected 1, found 0 + type FErr2<T> = Self::E<'static, T, u32>; + //~^ ERROR type-generic associated types are not yet implemented + //~| ERROR wrong number of type arguments: expected 1, found 2 +} + +fn main() {} diff --git a/src/test/ui/generic-associated-types/parameter_number_and_kind.stderr b/src/test/ui/generic-associated-types/parameter_number_and_kind.stderr new file mode 100644 index 00000000000..6b5683611a2 --- /dev/null +++ b/src/test/ui/generic-associated-types/parameter_number_and_kind.stderr @@ -0,0 +1,53 @@ +error: type-generic associated types are not yet implemented + --> $DIR/parameter_number_and_kind.rs:9:5 + | +LL | type D<T>; + | ^^^^^^^^^^ + | + = note: for more information, see https://github.com/rust-lang/rust/issues/44265 + +error: type-generic associated types are not yet implemented + --> $DIR/parameter_number_and_kind.rs:11:5 + | +LL | type E<'a, T>; + | ^^^^^^^^^^^^^^ + | + = note: for more information, see https://github.com/rust-lang/rust/issues/44265 + +error: type-generic associated types are not yet implemented + --> $DIR/parameter_number_and_kind.rs:14:5 + | +LL | type FOk<T> = Self::E<'static, T>; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: for more information, see https://github.com/rust-lang/rust/issues/44265 + +error: type-generic associated types are not yet implemented + --> $DIR/parameter_number_and_kind.rs:19:5 + | +LL | type FErr2<T> = Self::E<'static, T, u32>; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: for more information, see https://github.com/rust-lang/rust/issues/44265 + +error[E0107]: wrong number of lifetime arguments: expected 1, found 2 + --> $DIR/parameter_number_and_kind.rs:16:35 + | +LL | type FErr1 = Self::E<'static, 'static>; + | ^^^^^^^ unexpected lifetime argument + +error[E0107]: wrong number of type arguments: expected 1, found 0 + --> $DIR/parameter_number_and_kind.rs:16:18 + | +LL | type FErr1 = Self::E<'static, 'static>; + | ^^^^^^^^^^^^^^^^^^^^^^^^^ expected 1 type argument + +error[E0107]: wrong number of type arguments: expected 1, found 2 + --> $DIR/parameter_number_and_kind.rs:19:41 + | +LL | type FErr2<T> = Self::E<'static, T, u32>; + | ^^^ unexpected type argument + +error: aborting due to 7 previous errors + +For more information about this error, try `rustc --explain E0107`. diff --git a/src/test/ui/generic-associated-types/parameter_number_and_kind_impl.rs b/src/test/ui/generic-associated-types/parameter_number_and_kind_impl.rs new file mode 100644 index 00000000000..74b9cec1da3 --- /dev/null +++ b/src/test/ui/generic-associated-types/parameter_number_and_kind_impl.rs @@ -0,0 +1,35 @@ +#![allow(incomplete_features)] +#![feature(generic_associated_types)] +#![feature(associated_type_defaults)] + +// FIXME(#44265) add tests for type-generic and const-genertic associated types. + +trait Foo { + type A<'a>; + type B<'a, 'b>; + type C; +} + +struct Fooy; + +impl Foo for Fooy { + type A = u32; + //~^ ERROR lifetime parameters or bounds on type `A` do not match the trait declaration + type B<'a, T> = Vec<T>; + //~^ ERROR type `B` has 1 type parameter but its trait declaration has 0 type parameters + type C<'a> = u32; + //~^ ERROR lifetime parameters or bounds on type `C` do not match the trait declaration +} + +struct Fooer; + +impl Foo for Fooer { + type A<T> = u32; + //~^ ERROR type `A` has 1 type parameter but its trait declaration has 0 type parameters + type B<'a> = u32; + //~^ ERROR lifetime parameters or bounds on type `B` do not match the trait declaration + type C<T> = T; + //~^ ERROR type `C` has 1 type parameter but its trait declaration has 0 type parameters +} + +fn main() {} diff --git a/src/test/ui/generic-associated-types/parameter_number_and_kind_impl.stderr b/src/test/ui/generic-associated-types/parameter_number_and_kind_impl.stderr new file mode 100644 index 00000000000..bdd1c895fd9 --- /dev/null +++ b/src/test/ui/generic-associated-types/parameter_number_and_kind_impl.stderr @@ -0,0 +1,62 @@ +error[E0195]: lifetime parameters or bounds on type `A` do not match the trait declaration + --> $DIR/parameter_number_and_kind_impl.rs:16:11 + | +LL | type A<'a>; + | ---- lifetimes in impl do not match this type in trait +... +LL | type A = u32; + | ^ lifetimes do not match type in trait + +error[E0049]: type `B` has 1 type parameter but its trait declaration has 0 type parameters + --> $DIR/parameter_number_and_kind_impl.rs:18:12 + | +LL | type B<'a, 'b>; + | -- -- + | | + | expected 0 type parameters +... +LL | type B<'a, T> = Vec<T>; + | ^^ ^ + | | + | found 1 type parameter + +error[E0195]: lifetime parameters or bounds on type `C` do not match the trait declaration + --> $DIR/parameter_number_and_kind_impl.rs:20:11 + | +LL | type C; + | - lifetimes in impl do not match this type in trait +... +LL | type C<'a> = u32; + | ^^^^ lifetimes do not match type in trait + +error[E0049]: type `A` has 1 type parameter but its trait declaration has 0 type parameters + --> $DIR/parameter_number_and_kind_impl.rs:27:12 + | +LL | type A<'a>; + | -- expected 0 type parameters +... +LL | type A<T> = u32; + | ^ found 1 type parameter + +error[E0195]: lifetime parameters or bounds on type `B` do not match the trait declaration + --> $DIR/parameter_number_and_kind_impl.rs:29:11 + | +LL | type B<'a, 'b>; + | -------- lifetimes in impl do not match this type in trait +... +LL | type B<'a> = u32; + | ^^^^ lifetimes do not match type in trait + +error[E0049]: type `C` has 1 type parameter but its trait declaration has 0 type parameters + --> $DIR/parameter_number_and_kind_impl.rs:31:12 + | +LL | type C; + | - expected 0 type parameters +... +LL | type C<T> = T; + | ^ found 1 type parameter + +error: aborting due to 6 previous errors + +Some errors have detailed explanations: E0049, E0195. +For more information about an error, try `rustc --explain E0049`. diff --git a/src/test/ui/rfc1598-generic-associated-types/parse/in-trait-impl.rs b/src/test/ui/generic-associated-types/parse/in-trait-impl.rs index 9fc32d7cc55..7f4775ddbb0 100644 --- a/src/test/ui/rfc1598-generic-associated-types/parse/in-trait-impl.rs +++ b/src/test/ui/generic-associated-types/parse/in-trait-impl.rs @@ -1,4 +1,4 @@ -// build-pass (FIXME(62277): could be check-pass?) +// check-pass // compile-flags: -Z parse-only #![feature(generic_associated_types)] diff --git a/src/test/ui/rfc1598-generic-associated-types/parse/in-trait.rs b/src/test/ui/generic-associated-types/parse/in-trait.rs index 7974ee9d39b..d438795eb1d 100644 --- a/src/test/ui/rfc1598-generic-associated-types/parse/in-trait.rs +++ b/src/test/ui/generic-associated-types/parse/in-trait.rs @@ -1,9 +1,10 @@ -// build-pass (FIXME(62277): could be check-pass?) +// check-pass // compile-flags: -Z parse-only #![feature(generic_associated_types)] use std::ops::Deref; +use std::fmt::Debug; trait Foo { type Bar<'a>; diff --git a/src/test/ui/rfc1598-generic-associated-types/pointer_family.rs b/src/test/ui/generic-associated-types/pointer_family.rs index edeeaba7565..1668759b4e3 100644 --- a/src/test/ui/rfc1598-generic-associated-types/pointer_family.rs +++ b/src/test/ui/generic-associated-types/pointer_family.rs @@ -1,7 +1,7 @@ +#![allow(incomplete_features)] #![feature(generic_associated_types)] -//~^ WARNING the feature `generic_associated_types` is incomplete -// FIXME(#44265): "type argument not allowed" errors will be addressed in a follow-up PR. +// FIXME(#44265): allow type-generic associated types. use std::rc::Rc; use std::sync::Arc; @@ -9,8 +9,8 @@ use std::ops::Deref; trait PointerFamily { type Pointer<T>: Deref<Target = T>; + //~^ ERROR type-generic associated types are not yet implemented fn new<T>(value: T) -> Self::Pointer<T>; - //~^ ERROR type arguments are not allowed for this type [E0109] } struct ArcFamily; @@ -18,7 +18,6 @@ struct ArcFamily; impl PointerFamily for ArcFamily { type Pointer<T> = Arc<T>; fn new<T>(value: T) -> Self::Pointer<T> { - //~^ ERROR type arguments are not allowed for this type [E0109] Arc::new(value) } } @@ -28,14 +27,12 @@ struct RcFamily; impl PointerFamily for RcFamily { type Pointer<T> = Rc<T>; fn new<T>(value: T) -> Self::Pointer<T> { - //~^ ERROR type arguments are not allowed for this type [E0109] Rc::new(value) } } struct Foo<P: PointerFamily> { bar: P::Pointer<String>, - //~^ ERROR type arguments are not allowed for this type [E0109] } fn main() {} diff --git a/src/test/ui/generic-associated-types/pointer_family.stderr b/src/test/ui/generic-associated-types/pointer_family.stderr new file mode 100644 index 00000000000..2a784f8b9d7 --- /dev/null +++ b/src/test/ui/generic-associated-types/pointer_family.stderr @@ -0,0 +1,10 @@ +error: type-generic associated types are not yet implemented + --> $DIR/pointer_family.rs:11:5 + | +LL | type Pointer<T>: Deref<Target = T>; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: for more information, see https://github.com/rust-lang/rust/issues/44265 + +error: aborting due to previous error + diff --git a/src/test/ui/rfc1598-generic-associated-types/shadowing.rs b/src/test/ui/generic-associated-types/shadowing.rs index f5197fd01bf..7277c0d87c6 100644 --- a/src/test/ui/rfc1598-generic-associated-types/shadowing.rs +++ b/src/test/ui/generic-associated-types/shadowing.rs @@ -16,15 +16,19 @@ impl<'a> NoShadow<'a> for &'a u32 { } trait ShadowT<T> { - type Bar<T>; //~ ERROR the name `T` is already used + type Bar<T>; + //~^ ERROR the name `T` is already used + //~| ERROR type-generic associated types are not yet implemented } trait NoShadowT<T> { type Bar<U>; // OK + //~^ ERROR type-generic associated types are not yet implemented } impl<T> NoShadowT<T> for Option<T> { - type Bar<T> = i32; //~ ERROR the name `T` is already used + type Bar<T> = i32; + //~^ ERROR the name `T` is already used } fn main() {} diff --git a/src/test/ui/rfc1598-generic-associated-types/shadowing.stderr b/src/test/ui/generic-associated-types/shadowing.stderr index a06c6350845..50c12e822e7 100644 --- a/src/test/ui/rfc1598-generic-associated-types/shadowing.stderr +++ b/src/test/ui/generic-associated-types/shadowing.stderr @@ -7,13 +7,29 @@ LL | type Bar<T>; | ^ already used error[E0403]: the name `T` is already used for a generic parameter in this item's generic parameters - --> $DIR/shadowing.rs:27:14 + --> $DIR/shadowing.rs:30:14 | LL | impl<T> NoShadowT<T> for Option<T> { | - first use of `T` LL | type Bar<T> = i32; | ^ already used -error: aborting due to 2 previous errors +error: type-generic associated types are not yet implemented + --> $DIR/shadowing.rs:19:5 + | +LL | type Bar<T>; + | ^^^^^^^^^^^^ + | + = note: for more information, see https://github.com/rust-lang/rust/issues/44265 + +error: type-generic associated types are not yet implemented + --> $DIR/shadowing.rs:25:5 + | +LL | type Bar<U>; // OK + | ^^^^^^^^^^^^ + | + = note: for more information, see https://github.com/rust-lang/rust/issues/44265 + +error: aborting due to 4 previous errors For more information about this error, try `rustc --explain E0403`. diff --git a/src/test/ui/rfc1598-generic-associated-types/streaming_iterator.rs b/src/test/ui/generic-associated-types/streaming_iterator.rs index 4e177fb41d7..d814f7140d9 100644 --- a/src/test/ui/rfc1598-generic-associated-types/streaming_iterator.rs +++ b/src/test/ui/generic-associated-types/streaming_iterator.rs @@ -1,30 +1,26 @@ -#![feature(generic_associated_types)] -//~^ WARNING the feature `generic_associated_types` is incomplete +// run-pass -// FIXME(#44265): "lifetime argument not allowed on this type" errors will be addressed in a -// follow-up PR +#![allow(incomplete_features)] +#![feature(generic_associated_types)] use std::fmt::Display; trait StreamingIterator { type Item<'a>; // Applying the lifetime parameter `'a` to `Self::Item` inside the trait. - fn next<'a>(&'a self) -> Option<Self::Item<'a>>; - //~^ ERROR lifetime arguments are not allowed for this type [E0109] + fn next<'a>(&'a mut self) -> Option<Self::Item<'a>>; } struct Foo<T: StreamingIterator> { // Applying a concrete lifetime to the constructor outside the trait. bar: <T as StreamingIterator>::Item<'static>, - //~^ ERROR lifetime arguments are not allowed for this type [E0109] } // Users can bound parameters by the type constructed by that trait's associated type constructor // of a trait using HRTB. Both type equality bounds and trait bounds of this kind are valid: -//FIXME(sunjay): This next line should parse and be valid -//fn foo<T: for<'a> StreamingIterator<Item<'a>=&'a [i32]>>(iter: T) { /* ... */ } -fn foo<T>(iter: T) where T: StreamingIterator, for<'a> T::Item<'a>: Display { /* ... */ } -//~^ ERROR lifetime arguments are not allowed for this type [E0109] +//FIXME(#44265): This next line should parse and be valid +//fn foo<T: for<'a> StreamingIterator<Item<'a>=&'a [i32]>>(_iter: T) { /* ... */ } +fn _foo<T>(_iter: T) where T: StreamingIterator, for<'a> T::Item<'a>: Display { /* ... */ } // Full example of enumerate iterator @@ -36,9 +32,7 @@ struct StreamEnumerate<I> { impl<I: StreamingIterator> StreamingIterator for StreamEnumerate<I> { type Item<'a> = (usize, I::Item<'a>); - //~^ ERROR lifetime arguments are not allowed for this type [E0109] - fn next<'a>(&'a self) -> Option<Self::Item<'a>> { - //~^ ERROR lifetime arguments are not allowed for this type [E0109] + fn next<'a>(&'a mut self) -> Option<Self::Item<'a>> { match self.iter.next() { None => None, Some(val) => { @@ -50,24 +44,34 @@ impl<I: StreamingIterator> StreamingIterator for StreamEnumerate<I> { } } +impl<I: Iterator> StreamingIterator for I { + type Item<'a> = <I as Iterator>::Item; + fn next(&mut self) -> Option<<I as StreamingIterator>::Item<'_>> { + Iterator::next(self) + } +} + impl<I> StreamEnumerate<I> { pub fn new(iter: I) -> Self { StreamEnumerate { count: 0, - iter: iter, + iter, } } } fn test_stream_enumerate() { let v = vec!["a", "b", "c"]; - let se = StreamEnumerate::new(v.iter()); - let a: &str = se.next().unwrap().1; - for (i, s) in se { - println!("{} {}", i, s); + let mut se = StreamEnumerate::new(v.iter()); + while let Some(item) = se.next() { + assert_eq!(v[item.0], *item.1); } - println!("{}", a); + let x = Foo::<std::slice::Iter<'static, u32>> { + bar: &0u32, + }; + assert_eq!(*x.bar, 0u32); } - -fn main() {} +fn main() { + test_stream_enumerate(); +} diff --git a/src/test/ui/huge-array-simple-32.rs b/src/test/ui/huge-array-simple-32.rs index 9f98f4d7531..3e574dfa07b 100644 --- a/src/test/ui/huge-array-simple-32.rs +++ b/src/test/ui/huge-array-simple-32.rs @@ -1,4 +1,5 @@ // ignore-64bit +// build-fail // FIXME https://github.com/rust-lang/rust/issues/59774 // normalize-stderr-test "thread.*panicked.*Metadata module not compiled.*\n" -> "" diff --git a/src/test/ui/huge-array-simple-32.stderr b/src/test/ui/huge-array-simple-32.stderr index 16372b02750..d734a9689e0 100644 --- a/src/test/ui/huge-array-simple-32.stderr +++ b/src/test/ui/huge-array-simple-32.stderr @@ -1,5 +1,5 @@ error: the type `[u8; 2147516416]` is too big for the current architecture - --> $DIR/huge-array-simple-32.rs:9:9 + --> $DIR/huge-array-simple-32.rs:10:9 | LL | let _fat: [u8; (1<<31)+(1<<15)] = | ^^^^ diff --git a/src/test/ui/huge-array-simple-64.rs b/src/test/ui/huge-array-simple-64.rs index f72d69ee747..d4c93301283 100644 --- a/src/test/ui/huge-array-simple-64.rs +++ b/src/test/ui/huge-array-simple-64.rs @@ -1,3 +1,4 @@ +// build-fail // ignore-32bit // FIXME https://github.com/rust-lang/rust/issues/59774 diff --git a/src/test/ui/huge-array-simple-64.stderr b/src/test/ui/huge-array-simple-64.stderr index 6ed89269f0f..791baa84687 100644 --- a/src/test/ui/huge-array-simple-64.stderr +++ b/src/test/ui/huge-array-simple-64.stderr @@ -1,5 +1,5 @@ error: the type `[u8; 2305843011361177600]` is too big for the current architecture - --> $DIR/huge-array-simple-64.rs:9:9 + --> $DIR/huge-array-simple-64.rs:10:9 | LL | let _fat: [u8; (1<<61)+(1<<31)] = | ^^^^ diff --git a/src/test/ui/huge-array.rs b/src/test/ui/huge-array.rs index 1ecf012e04b..846380586a0 100644 --- a/src/test/ui/huge-array.rs +++ b/src/test/ui/huge-array.rs @@ -1,4 +1,6 @@ // FIXME https://github.com/rust-lang/rust/issues/59774 + +// build-fail // normalize-stderr-test "thread.*panicked.*Metadata module not compiled.*\n" -> "" // normalize-stderr-test "note:.*RUST_BACKTRACE=1.*\n" -> "" diff --git a/src/test/ui/huge-array.stderr b/src/test/ui/huge-array.stderr index 823d974f429..23d9e87ae00 100644 --- a/src/test/ui/huge-array.stderr +++ b/src/test/ui/huge-array.stderr @@ -1,5 +1,5 @@ error: the type `[[u8; 1518599999]; 1518600000]` is too big for the current architecture - --> $DIR/huge-array.rs:6:9 + --> $DIR/huge-array.rs:8:9 | LL | let s: [T; 1518600000] = [t; 1518600000]; | ^ diff --git a/src/test/ui/huge-enum.rs b/src/test/ui/huge-enum.rs index 98d0ba6e15c..8a713c3a26e 100644 --- a/src/test/ui/huge-enum.rs +++ b/src/test/ui/huge-enum.rs @@ -1,3 +1,4 @@ +// build-fail // normalize-stderr-test "std::option::Option<\[u32; \d+\]>" -> "TYPE" // normalize-stderr-test "\[u32; \d+\]" -> "TYPE" diff --git a/src/test/ui/huge-enum.stderr b/src/test/ui/huge-enum.stderr index 1f16c81a8f4..8398c511b9f 100644 --- a/src/test/ui/huge-enum.stderr +++ b/src/test/ui/huge-enum.stderr @@ -1,5 +1,5 @@ error: the type `TYPE` is too big for the current architecture - --> $DIR/huge-enum.rs:15:9 + --> $DIR/huge-enum.rs:16:9 | LL | let big: BIG = None; | ^^^ diff --git a/src/test/ui/huge-struct.rs b/src/test/ui/huge-struct.rs index e50ca5f54d1..71169a11047 100644 --- a/src/test/ui/huge-struct.rs +++ b/src/test/ui/huge-struct.rs @@ -1,3 +1,4 @@ +// build-fail // normalize-stderr-test "S32" -> "SXX" // normalize-stderr-test "S1M" -> "SXX" // error-pattern: too big for the current diff --git a/src/test/ui/huge-struct.stderr b/src/test/ui/huge-struct.stderr index 5c2140df481..72e32a8593b 100644 --- a/src/test/ui/huge-struct.stderr +++ b/src/test/ui/huge-struct.stderr @@ -1,5 +1,5 @@ error: the type `SXX<SXX<SXX<u32>>>` is too big for the current architecture - --> $DIR/huge-struct.rs:49:9 + --> $DIR/huge-struct.rs:50:9 | LL | let fat: Option<SXX<SXX<SXX<u32>>>> = None; | ^^^ diff --git a/src/test/ui/infinite/infinite-instantiation.rs b/src/test/ui/infinite/infinite-instantiation.rs index 4220c8837d2..6f53680f7c8 100644 --- a/src/test/ui/infinite/infinite-instantiation.rs +++ b/src/test/ui/infinite/infinite-instantiation.rs @@ -4,6 +4,8 @@ // so for now just live with it. // This test case was originally for issue #2258. +// build-fail + trait ToOpt: Sized { fn to_option(&self) -> Option<Self>; } diff --git a/src/test/ui/infinite/infinite-instantiation.stderr b/src/test/ui/infinite/infinite-instantiation.stderr index d75dc0403a2..ae81c680a7b 100644 --- a/src/test/ui/infinite/infinite-instantiation.stderr +++ b/src/test/ui/infinite/infinite-instantiation.stderr @@ -1,5 +1,5 @@ error: reached the recursion limit while instantiating `function::<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<usize>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` - --> $DIR/infinite-instantiation.rs:23:1 + --> $DIR/infinite-instantiation.rs:25:1 | LL | / fn function<T:ToOpt + Clone>(counter: usize, t: T) { LL | | diff --git a/src/test/ui/inline-asm-bad-constraint.rs b/src/test/ui/inline-asm-bad-constraint.rs index cf72afff50b..04fd5760cf8 100644 --- a/src/test/ui/inline-asm-bad-constraint.rs +++ b/src/test/ui/inline-asm-bad-constraint.rs @@ -1,5 +1,6 @@ // Test that the compiler will catch invalid inline assembly constraints. +// build-fail // ignore-emscripten #![feature(asm)] diff --git a/src/test/ui/inline-asm-bad-constraint.stderr b/src/test/ui/inline-asm-bad-constraint.stderr index 59066e5e7fc..f38bfb2af1d 100644 --- a/src/test/ui/inline-asm-bad-constraint.stderr +++ b/src/test/ui/inline-asm-bad-constraint.stderr @@ -1,17 +1,17 @@ error[E0668]: malformed inline assembly - --> $DIR/inline-asm-bad-constraint.rs:21:9 + --> $DIR/inline-asm-bad-constraint.rs:22:9 | LL | asm!("" :"={rax"(rax)) | ^^^^^^^^^^^^^^^^^^^^^^ error[E0668]: malformed inline assembly - --> $DIR/inline-asm-bad-constraint.rs:29:9 + --> $DIR/inline-asm-bad-constraint.rs:30:9 | LL | asm!("callq $0" : : "0"(foo)) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0668]: malformed inline assembly - --> $DIR/inline-asm-bad-constraint.rs:36:9 + --> $DIR/inline-asm-bad-constraint.rs:37:9 | LL | asm!("addb $1, $0" : "={rax}"((0i32, rax))); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/inline-asm-bad-operand.rs b/src/test/ui/inline-asm-bad-operand.rs index 4cfe100d85b..f4e9922164f 100644 --- a/src/test/ui/inline-asm-bad-operand.rs +++ b/src/test/ui/inline-asm-bad-operand.rs @@ -1,6 +1,7 @@ // Test that the compiler will catch passing invalid values to inline assembly // operands. +// build-fail // ignore-emscripten #![feature(asm)] diff --git a/src/test/ui/inline-asm-bad-operand.stderr b/src/test/ui/inline-asm-bad-operand.stderr index b8e7e9acfec..fe6c6c99141 100644 --- a/src/test/ui/inline-asm-bad-operand.stderr +++ b/src/test/ui/inline-asm-bad-operand.stderr @@ -1,41 +1,41 @@ error[E0669]: invalid value for constraint in inline assembly - --> $DIR/inline-asm-bad-operand.rs:21:24 + --> $DIR/inline-asm-bad-operand.rs:22:24 | LL | asm!("" :: "r"("")); | ^^ error[E0669]: invalid value for constraint in inline assembly - --> $DIR/inline-asm-bad-operand.rs:26:32 + --> $DIR/inline-asm-bad-operand.rs:27:32 | LL | asm!("ret" : : "{rdi}"(target)); | ^^^^^^ error[E0669]: invalid value for constraint in inline assembly - --> $DIR/inline-asm-bad-operand.rs:33:29 + --> $DIR/inline-asm-bad-operand.rs:34:29 | LL | unsafe { asm!("" :: "i"(hello)) }; | ^^^^^ error[E0669]: invalid value for constraint in inline assembly - --> $DIR/inline-asm-bad-operand.rs:41:38 + --> $DIR/inline-asm-bad-operand.rs:42:38 | LL | asm!("movups $1, %xmm0"::"m"(arr)); | ^^^ error[E0669]: invalid value for constraint in inline assembly - --> $DIR/inline-asm-bad-operand.rs:48:32 + --> $DIR/inline-asm-bad-operand.rs:49:32 | LL | asm!("mov sp, $0"::"r"(addr)); | ^^^^ error[E0669]: invalid value for constraint in inline assembly - --> $DIR/inline-asm-bad-operand.rs:55:32 + --> $DIR/inline-asm-bad-operand.rs:56:32 | LL | asm!("mov sp, $0"::"r"(addr), | ^^^^ error[E0669]: invalid value for constraint in inline assembly - --> $DIR/inline-asm-bad-operand.rs:56:32 + --> $DIR/inline-asm-bad-operand.rs:57:32 | LL | ... "r"("hello e0669")); | ^^^^^^^^^^^^^ diff --git a/src/test/ui/issues/issue-11154.rs b/src/test/ui/issues/issue-11154.rs index 7513abd8a5b..e11cdc82f32 100644 --- a/src/test/ui/issues/issue-11154.rs +++ b/src/test/ui/issues/issue-11154.rs @@ -1,3 +1,4 @@ +// build-fail // compile-flags: -C lto -C prefer-dynamic // error-pattern: cannot prefer dynamic linking diff --git a/src/test/ui/issues/issue-15919-32.rs b/src/test/ui/issues/issue-15919-32.rs index 65d33a61348..3c93f14ccc7 100644 --- a/src/test/ui/issues/issue-15919-32.rs +++ b/src/test/ui/issues/issue-15919-32.rs @@ -1,4 +1,5 @@ // ignore-64bit +// build-fail // FIXME https://github.com/rust-lang/rust/issues/59774 // normalize-stderr-test "thread.*panicked.*Metadata module not compiled.*\n" -> "" diff --git a/src/test/ui/issues/issue-15919-32.stderr b/src/test/ui/issues/issue-15919-32.stderr index 7f5d9262d39..8411313fc81 100644 --- a/src/test/ui/issues/issue-15919-32.stderr +++ b/src/test/ui/issues/issue-15919-32.stderr @@ -1,5 +1,5 @@ error: the type `[usize; 4294967295]` is too big for the current architecture - --> $DIR/issue-15919-32.rs:8:9 + --> $DIR/issue-15919-32.rs:9:9 | LL | let x = [0usize; 0xffff_ffff]; | ^ diff --git a/src/test/ui/issues/issue-15919-64.rs b/src/test/ui/issues/issue-15919-64.rs index abd20cc1cee..3ecbd34eaaa 100644 --- a/src/test/ui/issues/issue-15919-64.rs +++ b/src/test/ui/issues/issue-15919-64.rs @@ -1,3 +1,4 @@ +// build-fail // ignore-32bit // FIXME https://github.com/rust-lang/rust/issues/59774 diff --git a/src/test/ui/issues/issue-15919-64.stderr b/src/test/ui/issues/issue-15919-64.stderr index 571b87d9961..f624c96ce84 100644 --- a/src/test/ui/issues/issue-15919-64.stderr +++ b/src/test/ui/issues/issue-15919-64.stderr @@ -1,5 +1,5 @@ error: the type `[usize; 18446744073709551615]` is too big for the current architecture - --> $DIR/issue-15919-64.rs:8:9 + --> $DIR/issue-15919-64.rs:9:9 | LL | let x = [0usize; 0xffff_ffff_ffff_ffff]; | ^ diff --git a/src/test/ui/issues/issue-17913.rs b/src/test/ui/issues/issue-17913.rs index 48d8f407aa1..ca13b9bd6ae 100644 --- a/src/test/ui/issues/issue-17913.rs +++ b/src/test/ui/issues/issue-17913.rs @@ -1,3 +1,4 @@ +// build-fail // normalize-stderr-test "\[&usize; \d+\]" -> "[&usize; N]" // error-pattern: too big for the current architecture diff --git a/src/test/ui/issues/issue-22638.rs b/src/test/ui/issues/issue-22638.rs index fab24404eba..72c16fddb4b 100644 --- a/src/test/ui/issues/issue-22638.rs +++ b/src/test/ui/issues/issue-22638.rs @@ -1,3 +1,4 @@ +// build-fail // normalize-stderr-test: "<\[closure@.+`" -> "$$CLOSURE`" #![allow(unused)] diff --git a/src/test/ui/issues/issue-22638.stderr b/src/test/ui/issues/issue-22638.stderr index b60e1c29ec0..83dd93b853d 100644 --- a/src/test/ui/issues/issue-22638.stderr +++ b/src/test/ui/issues/issue-22638.stderr @@ -1,5 +1,5 @@ error: reached the type-length limit while instantiating `D::matches::$CLOSURE` - --> $DIR/issue-22638.rs:52:5 + --> $DIR/issue-22638.rs:53:5 | LL | / pub fn matches<F: Fn()>(&self, f: &F) { LL | | diff --git a/src/test/ui/issues/issue-23458.rs b/src/test/ui/issues/issue-23458.rs index 90b3f1f9714..521db37170a 100644 --- a/src/test/ui/issues/issue-23458.rs +++ b/src/test/ui/issues/issue-23458.rs @@ -1,5 +1,6 @@ #![feature(asm)] +// build-fail // only-x86_64 fn main() { diff --git a/src/test/ui/issues/issue-23458.stderr b/src/test/ui/issues/issue-23458.stderr index aff0f82af6f..76c3e6da82e 100644 --- a/src/test/ui/issues/issue-23458.stderr +++ b/src/test/ui/issues/issue-23458.stderr @@ -1,5 +1,5 @@ error: invalid operand in inline asm: 'int $3' - --> $DIR/issue-23458.rs:7:9 + --> $DIR/issue-23458.rs:8:9 | LL | asm!("int $3"); | ^^^^^^^^^^^^^^^ @@ -8,7 +8,7 @@ error: <inline asm>:1:2: error: too few operands for instruction int ^ - --> $DIR/issue-23458.rs:7:9 + --> $DIR/issue-23458.rs:8:9 | LL | asm!("int $3"); | ^^^^^^^^^^^^^^^ diff --git a/src/test/ui/issues/issue-26548.rs b/src/test/ui/issues/issue-26548.rs index 5b6c77d0bd1..6ee8c0fcfda 100644 --- a/src/test/ui/issues/issue-26548.rs +++ b/src/test/ui/issues/issue-26548.rs @@ -2,6 +2,8 @@ //~| NOTE ...which requires computing layout of //~| NOTE ...which again requires computing layout of +// build-fail + trait Mirror { type It: ?Sized; } impl<T: ?Sized> Mirror for T { type It = Self; } struct S(Option<<S as Mirror>::It>); diff --git a/src/test/ui/issues/issue-26548.stderr b/src/test/ui/issues/issue-26548.stderr index 7c1789cc1e9..3c213674e4b 100644 --- a/src/test/ui/issues/issue-26548.stderr +++ b/src/test/ui/issues/issue-26548.stderr @@ -3,7 +3,7 @@ error[E0391]: cycle detected when computing layout of `std::option::Option<S>` = note: ...which requires computing layout of `S`... = note: ...which again requires computing layout of `std::option::Option<S>`, completing the cycle note: cycle used when processing `main` - --> $DIR/issue-26548.rs:9:1 + --> $DIR/issue-26548.rs:11:1 | LL | fn main() { | ^^^^^^^^^ diff --git a/src/test/ui/issues/issue-37311-type-length-limit/issue-37311.rs b/src/test/ui/issues/issue-37311-type-length-limit/issue-37311.rs index 9a8dafe1394..fec4b171536 100644 --- a/src/test/ui/issues/issue-37311-type-length-limit/issue-37311.rs +++ b/src/test/ui/issues/issue-37311-type-length-limit/issue-37311.rs @@ -1,3 +1,5 @@ +// build-fail + trait Mirror { type Image; } diff --git a/src/test/ui/issues/issue-37311-type-length-limit/issue-37311.stderr b/src/test/ui/issues/issue-37311-type-length-limit/issue-37311.stderr index aead415d23f..7a4b59b5633 100644 --- a/src/test/ui/issues/issue-37311-type-length-limit/issue-37311.stderr +++ b/src/test/ui/issues/issue-37311-type-length-limit/issue-37311.stderr @@ -1,5 +1,5 @@ error: reached the type-length limit while instantiating `<(&(&(&(&(&(&(&(&(&(&(&(&(&(&(&(...))))))))))))))) as Foo>::recurse` - --> $DIR/issue-37311.rs:13:5 + --> $DIR/issue-37311.rs:15:5 | LL | / fn recurse(&self) { LL | | (self, self).recurse(); diff --git a/src/test/ui/issues/issue-37433.rs b/src/test/ui/issues/issue-37433.rs index d3663e24e60..c4d427f3ad3 100644 --- a/src/test/ui/issues/issue-37433.rs +++ b/src/test/ui/issues/issue-37433.rs @@ -1,3 +1,4 @@ +// build-fail // ignore-emscripten no asm! support #![feature(asm)] diff --git a/src/test/ui/issues/issue-37433.stderr b/src/test/ui/issues/issue-37433.stderr index 956694fc2cd..d9e1c98e9ee 100644 --- a/src/test/ui/issues/issue-37433.stderr +++ b/src/test/ui/issues/issue-37433.stderr @@ -1,5 +1,5 @@ error[E0669]: invalid value for constraint in inline assembly - --> $DIR/issue-37433.rs:7:24 + --> $DIR/issue-37433.rs:8:24 | LL | asm!("" :: "r"("")); | ^^ diff --git a/src/test/ui/issues/issue-53787-inline-assembler-macro.rs b/src/test/ui/issues/issue-53787-inline-assembler-macro.rs index 09e8d55c06b..d911ac5efbe 100644 --- a/src/test/ui/issues/issue-53787-inline-assembler-macro.rs +++ b/src/test/ui/issues/issue-53787-inline-assembler-macro.rs @@ -1,5 +1,6 @@ // Regression test for Issue #53787: Fix ICE when creating a label in inline assembler with macros. +// build-fail // ignore-emscripten #![feature(asm)] diff --git a/src/test/ui/issues/issue-53787-inline-assembler-macro.stderr b/src/test/ui/issues/issue-53787-inline-assembler-macro.stderr index f96bcaa492c..b066474f924 100644 --- a/src/test/ui/issues/issue-53787-inline-assembler-macro.stderr +++ b/src/test/ui/issues/issue-53787-inline-assembler-macro.stderr @@ -1,5 +1,5 @@ error[E0669]: invalid value for constraint in inline assembly - --> $DIR/issue-53787-inline-assembler-macro.rs:23:16 + --> $DIR/issue-53787-inline-assembler-macro.rs:24:16 | LL | fake_jump!("FirstFunc"); | ^^^^^^^^^^^ diff --git a/src/test/ui/issues/issue-54348.rs b/src/test/ui/issues/issue-54348.rs index 68d83805477..fd9a9e024aa 100644 --- a/src/test/ui/issues/issue-54348.rs +++ b/src/test/ui/issues/issue-54348.rs @@ -1,3 +1,5 @@ +// build-fail + fn main() { [1][0u64 as usize]; [1][1.5 as usize]; //~ ERROR index out of bounds diff --git a/src/test/ui/issues/issue-54348.stderr b/src/test/ui/issues/issue-54348.stderr index fa77bd6fd77..7619cd7437e 100644 --- a/src/test/ui/issues/issue-54348.stderr +++ b/src/test/ui/issues/issue-54348.stderr @@ -1,5 +1,5 @@ error: index out of bounds: the len is 1 but the index is 1 - --> $DIR/issue-54348.rs:3:5 + --> $DIR/issue-54348.rs:5:5 | LL | [1][1.5 as usize]; | ^^^^^^^^^^^^^^^^^ @@ -7,7 +7,7 @@ LL | [1][1.5 as usize]; = note: `#[deny(const_err)]` on by default error: index out of bounds: the len is 1 but the index is 1 - --> $DIR/issue-54348.rs:4:5 + --> $DIR/issue-54348.rs:6:5 | LL | [1][1u64 as usize]; | ^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/issues/issue-8460-const.rs b/src/test/ui/issues/issue-8460-const.rs index 71e2b58031c..c18a0d4d6cb 100644 --- a/src/test/ui/issues/issue-8460-const.rs +++ b/src/test/ui/issues/issue-8460-const.rs @@ -1,3 +1,4 @@ +// build-fail // compile-flags: -O #![deny(const_err)] diff --git a/src/test/ui/issues/issue-8460-const.stderr b/src/test/ui/issues/issue-8460-const.stderr index c6750e653d7..170747f8402 100644 --- a/src/test/ui/issues/issue-8460-const.stderr +++ b/src/test/ui/issues/issue-8460-const.stderr @@ -1,185 +1,185 @@ error: attempt to divide with overflow - --> $DIR/issue-8460-const.rs:9:36 + --> $DIR/issue-8460-const.rs:10:36 | LL | assert!(thread::spawn(move|| { isize::MIN / -1; }).join().is_err()); | ^^^^^^^^^^^^^^^ | note: lint level defined here - --> $DIR/issue-8460-const.rs:3:9 + --> $DIR/issue-8460-const.rs:4:9 | LL | #![deny(const_err)] | ^^^^^^^^^ error: this expression will panic at runtime - --> $DIR/issue-8460-const.rs:9:36 + --> $DIR/issue-8460-const.rs:10:36 | LL | assert!(thread::spawn(move|| { isize::MIN / -1; }).join().is_err()); | ^^^^^^^^^^^^^^^ attempt to divide with overflow error: attempt to divide with overflow - --> $DIR/issue-8460-const.rs:12:36 + --> $DIR/issue-8460-const.rs:13:36 | LL | assert!(thread::spawn(move|| { i8::MIN / -1; }).join().is_err()); | ^^^^^^^^^^^^ error: this expression will panic at runtime - --> $DIR/issue-8460-const.rs:12:36 + --> $DIR/issue-8460-const.rs:13:36 | LL | assert!(thread::spawn(move|| { i8::MIN / -1; }).join().is_err()); | ^^^^^^^^^^^^ attempt to divide with overflow error: attempt to divide with overflow - --> $DIR/issue-8460-const.rs:15:36 + --> $DIR/issue-8460-const.rs:16:36 | LL | assert!(thread::spawn(move|| { i16::MIN / -1; }).join().is_err()); | ^^^^^^^^^^^^^ error: this expression will panic at runtime - --> $DIR/issue-8460-const.rs:15:36 + --> $DIR/issue-8460-const.rs:16:36 | LL | assert!(thread::spawn(move|| { i16::MIN / -1; }).join().is_err()); | ^^^^^^^^^^^^^ attempt to divide with overflow error: attempt to divide with overflow - --> $DIR/issue-8460-const.rs:18:36 + --> $DIR/issue-8460-const.rs:19:36 | LL | assert!(thread::spawn(move|| { i32::MIN / -1; }).join().is_err()); | ^^^^^^^^^^^^^ error: this expression will panic at runtime - --> $DIR/issue-8460-const.rs:18:36 + --> $DIR/issue-8460-const.rs:19:36 | LL | assert!(thread::spawn(move|| { i32::MIN / -1; }).join().is_err()); | ^^^^^^^^^^^^^ attempt to divide with overflow error: attempt to divide with overflow - --> $DIR/issue-8460-const.rs:21:36 + --> $DIR/issue-8460-const.rs:22:36 | LL | assert!(thread::spawn(move|| { i64::MIN / -1; }).join().is_err()); | ^^^^^^^^^^^^^ error: this expression will panic at runtime - --> $DIR/issue-8460-const.rs:21:36 + --> $DIR/issue-8460-const.rs:22:36 | LL | assert!(thread::spawn(move|| { i64::MIN / -1; }).join().is_err()); | ^^^^^^^^^^^^^ attempt to divide with overflow error: attempt to divide by zero - --> $DIR/issue-8460-const.rs:24:36 + --> $DIR/issue-8460-const.rs:25:36 | LL | assert!(thread::spawn(move|| { 1isize / 0; }).join().is_err()); | ^^^^^^^^^^ error: attempt to divide by zero - --> $DIR/issue-8460-const.rs:26:36 + --> $DIR/issue-8460-const.rs:27:36 | LL | assert!(thread::spawn(move|| { 1i8 / 0; }).join().is_err()); | ^^^^^^^ error: attempt to divide by zero - --> $DIR/issue-8460-const.rs:28:36 + --> $DIR/issue-8460-const.rs:29:36 | LL | assert!(thread::spawn(move|| { 1i16 / 0; }).join().is_err()); | ^^^^^^^^ error: attempt to divide by zero - --> $DIR/issue-8460-const.rs:30:36 + --> $DIR/issue-8460-const.rs:31:36 | LL | assert!(thread::spawn(move|| { 1i32 / 0; }).join().is_err()); | ^^^^^^^^ error: attempt to divide by zero - --> $DIR/issue-8460-const.rs:32:36 + --> $DIR/issue-8460-const.rs:33:36 | LL | assert!(thread::spawn(move|| { 1i64 / 0; }).join().is_err()); | ^^^^^^^^ error: attempt to calculate the remainder with overflow - --> $DIR/issue-8460-const.rs:34:36 + --> $DIR/issue-8460-const.rs:35:36 | LL | assert!(thread::spawn(move|| { isize::MIN % -1; }).join().is_err()); | ^^^^^^^^^^^^^^^ error: this expression will panic at runtime - --> $DIR/issue-8460-const.rs:34:36 + --> $DIR/issue-8460-const.rs:35:36 | LL | assert!(thread::spawn(move|| { isize::MIN % -1; }).join().is_err()); | ^^^^^^^^^^^^^^^ attempt to calculate the remainder with overflow error: attempt to calculate the remainder with overflow - --> $DIR/issue-8460-const.rs:37:36 + --> $DIR/issue-8460-const.rs:38:36 | LL | assert!(thread::spawn(move|| { i8::MIN % -1; }).join().is_err()); | ^^^^^^^^^^^^ error: this expression will panic at runtime - --> $DIR/issue-8460-const.rs:37:36 + --> $DIR/issue-8460-const.rs:38:36 | LL | assert!(thread::spawn(move|| { i8::MIN % -1; }).join().is_err()); | ^^^^^^^^^^^^ attempt to calculate the remainder with overflow error: attempt to calculate the remainder with overflow - --> $DIR/issue-8460-const.rs:40:36 + --> $DIR/issue-8460-const.rs:41:36 | LL | assert!(thread::spawn(move|| { i16::MIN % -1; }).join().is_err()); | ^^^^^^^^^^^^^ error: this expression will panic at runtime - --> $DIR/issue-8460-const.rs:40:36 + --> $DIR/issue-8460-const.rs:41:36 | LL | assert!(thread::spawn(move|| { i16::MIN % -1; }).join().is_err()); | ^^^^^^^^^^^^^ attempt to calculate the remainder with overflow error: attempt to calculate the remainder with overflow - --> $DIR/issue-8460-const.rs:43:36 + --> $DIR/issue-8460-const.rs:44:36 | LL | assert!(thread::spawn(move|| { i32::MIN % -1; }).join().is_err()); | ^^^^^^^^^^^^^ error: this expression will panic at runtime - --> $DIR/issue-8460-const.rs:43:36 + --> $DIR/issue-8460-const.rs:44:36 | LL | assert!(thread::spawn(move|| { i32::MIN % -1; }).join().is_err()); | ^^^^^^^^^^^^^ attempt to calculate the remainder with overflow error: attempt to calculate the remainder with overflow - --> $DIR/issue-8460-const.rs:46:36 + --> $DIR/issue-8460-const.rs:47:36 | LL | assert!(thread::spawn(move|| { i64::MIN % -1; }).join().is_err()); | ^^^^^^^^^^^^^ error: this expression will panic at runtime - --> $DIR/issue-8460-const.rs:46:36 + --> $DIR/issue-8460-const.rs:47:36 | LL | assert!(thread::spawn(move|| { i64::MIN % -1; }).join().is_err()); | ^^^^^^^^^^^^^ attempt to calculate the remainder with overflow error: attempt to calculate the remainder with a divisor of zero - --> $DIR/issue-8460-const.rs:49:36 + --> $DIR/issue-8460-const.rs:50:36 | LL | assert!(thread::spawn(move|| { 1isize % 0; }).join().is_err()); | ^^^^^^^^^^ error: attempt to calculate the remainder with a divisor of zero - --> $DIR/issue-8460-const.rs:51:36 + --> $DIR/issue-8460-const.rs:52:36 | LL | assert!(thread::spawn(move|| { 1i8 % 0; }).join().is_err()); | ^^^^^^^ error: attempt to calculate the remainder with a divisor of zero - --> $DIR/issue-8460-const.rs:53:36 + --> $DIR/issue-8460-const.rs:54:36 | LL | assert!(thread::spawn(move|| { 1i16 % 0; }).join().is_err()); | ^^^^^^^^ error: attempt to calculate the remainder with a divisor of zero - --> $DIR/issue-8460-const.rs:55:36 + --> $DIR/issue-8460-const.rs:56:36 | LL | assert!(thread::spawn(move|| { 1i32 % 0; }).join().is_err()); | ^^^^^^^^ error: attempt to calculate the remainder with a divisor of zero - --> $DIR/issue-8460-const.rs:57:36 + --> $DIR/issue-8460-const.rs:58:36 | LL | assert!(thread::spawn(move|| { 1i64 % 0; }).join().is_err()); | ^^^^^^^^ diff --git a/src/test/ui/issues/issue-8460-const2.rs b/src/test/ui/issues/issue-8460-const2.rs index 723a17940a3..0ca850abc1b 100644 --- a/src/test/ui/issues/issue-8460-const2.rs +++ b/src/test/ui/issues/issue-8460-const2.rs @@ -1,3 +1,4 @@ +// build-fail // compile-flags: -C overflow-checks=on -O #![deny(const_err)] diff --git a/src/test/ui/issues/issue-8460-const2.stderr b/src/test/ui/issues/issue-8460-const2.stderr index 87b9b2daa6f..6ad186fb21c 100644 --- a/src/test/ui/issues/issue-8460-const2.stderr +++ b/src/test/ui/issues/issue-8460-const2.stderr @@ -1,125 +1,125 @@ error: attempt to divide with overflow - --> $DIR/issue-8460-const2.rs:9:36 + --> $DIR/issue-8460-const2.rs:10:36 | LL | assert!(thread::spawn(move|| { isize::MIN / -1; }).join().is_err()); | ^^^^^^^^^^^^^^^ | note: lint level defined here - --> $DIR/issue-8460-const2.rs:3:9 + --> $DIR/issue-8460-const2.rs:4:9 | LL | #![deny(const_err)] | ^^^^^^^^^ error: attempt to divide with overflow - --> $DIR/issue-8460-const2.rs:11:36 + --> $DIR/issue-8460-const2.rs:12:36 | LL | assert!(thread::spawn(move|| { i8::MIN / -1; }).join().is_err()); | ^^^^^^^^^^^^ error: attempt to divide with overflow - --> $DIR/issue-8460-const2.rs:13:36 + --> $DIR/issue-8460-const2.rs:14:36 | LL | assert!(thread::spawn(move|| { i16::MIN / -1; }).join().is_err()); | ^^^^^^^^^^^^^ error: attempt to divide with overflow - --> $DIR/issue-8460-const2.rs:15:36 + --> $DIR/issue-8460-const2.rs:16:36 | LL | assert!(thread::spawn(move|| { i32::MIN / -1; }).join().is_err()); | ^^^^^^^^^^^^^ error: attempt to divide with overflow - --> $DIR/issue-8460-const2.rs:17:36 + --> $DIR/issue-8460-const2.rs:18:36 | LL | assert!(thread::spawn(move|| { i64::MIN / -1; }).join().is_err()); | ^^^^^^^^^^^^^ error: attempt to divide by zero - --> $DIR/issue-8460-const2.rs:19:36 + --> $DIR/issue-8460-const2.rs:20:36 | LL | assert!(thread::spawn(move|| { 1isize / 0; }).join().is_err()); | ^^^^^^^^^^ error: attempt to divide by zero - --> $DIR/issue-8460-const2.rs:21:36 + --> $DIR/issue-8460-const2.rs:22:36 | LL | assert!(thread::spawn(move|| { 1i8 / 0; }).join().is_err()); | ^^^^^^^ error: attempt to divide by zero - --> $DIR/issue-8460-const2.rs:23:36 + --> $DIR/issue-8460-const2.rs:24:36 | LL | assert!(thread::spawn(move|| { 1i16 / 0; }).join().is_err()); | ^^^^^^^^ error: attempt to divide by zero - --> $DIR/issue-8460-const2.rs:25:36 + --> $DIR/issue-8460-const2.rs:26:36 | LL | assert!(thread::spawn(move|| { 1i32 / 0; }).join().is_err()); | ^^^^^^^^ error: attempt to divide by zero - --> $DIR/issue-8460-const2.rs:27:36 + --> $DIR/issue-8460-const2.rs:28:36 | LL | assert!(thread::spawn(move|| { 1i64 / 0; }).join().is_err()); | ^^^^^^^^ error: attempt to calculate the remainder with overflow - --> $DIR/issue-8460-const2.rs:29:36 + --> $DIR/issue-8460-const2.rs:30:36 | LL | assert!(thread::spawn(move|| { isize::MIN % -1; }).join().is_err()); | ^^^^^^^^^^^^^^^ error: attempt to calculate the remainder with overflow - --> $DIR/issue-8460-const2.rs:31:36 + --> $DIR/issue-8460-const2.rs:32:36 | LL | assert!(thread::spawn(move|| { i8::MIN % -1; }).join().is_err()); | ^^^^^^^^^^^^ error: attempt to calculate the remainder with overflow - --> $DIR/issue-8460-const2.rs:33:36 + --> $DIR/issue-8460-const2.rs:34:36 | LL | assert!(thread::spawn(move|| { i16::MIN % -1; }).join().is_err()); | ^^^^^^^^^^^^^ error: attempt to calculate the remainder with overflow - --> $DIR/issue-8460-const2.rs:35:36 + --> $DIR/issue-8460-const2.rs:36:36 | LL | assert!(thread::spawn(move|| { i32::MIN % -1; }).join().is_err()); | ^^^^^^^^^^^^^ error: attempt to calculate the remainder with overflow - --> $DIR/issue-8460-const2.rs:37:36 + --> $DIR/issue-8460-const2.rs:38:36 | LL | assert!(thread::spawn(move|| { i64::MIN % -1; }).join().is_err()); | ^^^^^^^^^^^^^ error: attempt to calculate the remainder with a divisor of zero - --> $DIR/issue-8460-const2.rs:39:36 + --> $DIR/issue-8460-const2.rs:40:36 | LL | assert!(thread::spawn(move|| { 1isize % 0; }).join().is_err()); | ^^^^^^^^^^ error: attempt to calculate the remainder with a divisor of zero - --> $DIR/issue-8460-const2.rs:41:36 + --> $DIR/issue-8460-const2.rs:42:36 | LL | assert!(thread::spawn(move|| { 1i8 % 0; }).join().is_err()); | ^^^^^^^ error: attempt to calculate the remainder with a divisor of zero - --> $DIR/issue-8460-const2.rs:43:36 + --> $DIR/issue-8460-const2.rs:44:36 | LL | assert!(thread::spawn(move|| { 1i16 % 0; }).join().is_err()); | ^^^^^^^^ error: attempt to calculate the remainder with a divisor of zero - --> $DIR/issue-8460-const2.rs:45:36 + --> $DIR/issue-8460-const2.rs:46:36 | LL | assert!(thread::spawn(move|| { 1i32 % 0; }).join().is_err()); | ^^^^^^^^ error: attempt to calculate the remainder with a divisor of zero - --> $DIR/issue-8460-const2.rs:47:36 + --> $DIR/issue-8460-const2.rs:48:36 | LL | assert!(thread::spawn(move|| { 1i64 % 0; }).join().is_err()); | ^^^^^^^^ diff --git a/src/test/ui/issues/issue-8727.rs b/src/test/ui/issues/issue-8727.rs index 473d237cd87..80f360155cb 100644 --- a/src/test/ui/issues/issue-8727.rs +++ b/src/test/ui/issues/issue-8727.rs @@ -1,6 +1,8 @@ // Verify the compiler fails with an error on infinite function // recursions. +// build-fail + fn generic<T>() { generic::<Option<T>>(); } diff --git a/src/test/ui/issues/issue-8727.stderr b/src/test/ui/issues/issue-8727.stderr index df01f42ce26..2fd6ea5dc82 100644 --- a/src/test/ui/issues/issue-8727.stderr +++ b/src/test/ui/issues/issue-8727.stderr @@ -1,5 +1,5 @@ warning: function cannot return without recursing - --> $DIR/issue-8727.rs:4:1 + --> $DIR/issue-8727.rs:6:1 | LL | fn generic<T>() { | ^^^^^^^^^^^^^^^ cannot return without recursing @@ -10,7 +10,7 @@ LL | generic::<Option<T>>(); = help: a `loop` may express intention better if this is on purpose error: reached the recursion limit while instantiating `generic::<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<i32>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` - --> $DIR/issue-8727.rs:4:1 + --> $DIR/issue-8727.rs:6:1 | LL | / fn generic<T>() { LL | | generic::<Option<T>>(); diff --git a/src/test/ui/json-and-color.rs b/src/test/ui/json-and-color.rs index efc07a541be..6f8326fe247 100644 --- a/src/test/ui/json-and-color.rs +++ b/src/test/ui/json-and-color.rs @@ -1,4 +1,3 @@ -// build-fail // compile-flags: --json=artifacts --error-format=json --color never fn main() {} diff --git a/src/test/ui/json-and-error-format.rs b/src/test/ui/json-and-error-format.rs index 6b369307fa4..6e2d73c76b7 100644 --- a/src/test/ui/json-and-error-format.rs +++ b/src/test/ui/json-and-error-format.rs @@ -1,4 +1,3 @@ -// build-fail // compile-flags: --json=artifacts --error-format=short fn main() {} diff --git a/src/test/ui/json-bom-plus-crlf-multifile.rs b/src/test/ui/json-bom-plus-crlf-multifile.rs index c71dd325f44..9290e010403 100644 --- a/src/test/ui/json-bom-plus-crlf-multifile.rs +++ b/src/test/ui/json-bom-plus-crlf-multifile.rs @@ -1,6 +1,5 @@ // (This line has BOM so it's ignored by compiletest for directives) // -// build-fail // compile-flags: --json=diagnostic-short --error-format=json // ignore-tidy-cr diff --git a/src/test/ui/json-bom-plus-crlf.rs b/src/test/ui/json-bom-plus-crlf.rs index ae54a35d480..be5b7dd2a86 100644 --- a/src/test/ui/json-bom-plus-crlf.rs +++ b/src/test/ui/json-bom-plus-crlf.rs @@ -1,6 +1,5 @@ // (This line has BOM so it's ignored by compiletest for directives) // -// build-fail // compile-flags: --json=diagnostic-short --error-format=json // ignore-tidy-cr diff --git a/src/test/ui/json-bom-plus-crlf.stderr b/src/test/ui/json-bom-plus-crlf.stderr index a6217f86879..1dd898db3ad 100644 --- a/src/test/ui/json-bom-plus-crlf.stderr +++ b/src/test/ui/json-bom-plus-crlf.stderr @@ -15,7 +15,7 @@ let x: i32 = \"I am not a number!\"; // | // type `i32` assigned to variable `x` ``` -"},"level":"error","spans":[{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":621,"byte_end":622,"line_start":17,"line_end":17,"column_start":22,"column_end":23,"is_primary":true,"text":[{"text":" let s : String = 1; // Error in the middle of line.","highlight_start":22,"highlight_end":23}],"label":"expected struct `std::string::String`, found integer","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":612,"byte_end":618,"line_start":17,"line_end":17,"column_start":13,"column_end":19,"is_primary":false,"text":[{"text":" let s : String = 1; // Error in the middle of line.","highlight_start":13,"highlight_end":19}],"label":"expected due to this","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"try using a conversion method","code":null,"level":"help","spans":[{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":621,"byte_end":622,"line_start":17,"line_end":17,"column_start":22,"column_end":23,"is_primary":true,"text":[{"text":" let s : String = 1; // Error in the middle of line.","highlight_start":22,"highlight_end":23}],"label":null,"suggested_replacement":"1.to_string()","suggestion_applicability":"MaybeIncorrect","expansion":null}],"children":[],"rendered":null}],"rendered":"$DIR/json-bom-plus-crlf.rs:17:22: error[E0308]: mismatched types +"},"level":"error","spans":[{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":606,"byte_end":607,"line_start":16,"line_end":16,"column_start":22,"column_end":23,"is_primary":true,"text":[{"text":" let s : String = 1; // Error in the middle of line.","highlight_start":22,"highlight_end":23}],"label":"expected struct `std::string::String`, found integer","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":597,"byte_end":603,"line_start":16,"line_end":16,"column_start":13,"column_end":19,"is_primary":false,"text":[{"text":" let s : String = 1; // Error in the middle of line.","highlight_start":13,"highlight_end":19}],"label":"expected due to this","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"try using a conversion method","code":null,"level":"help","spans":[{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":606,"byte_end":607,"line_start":16,"line_end":16,"column_start":22,"column_end":23,"is_primary":true,"text":[{"text":" let s : String = 1; // Error in the middle of line.","highlight_start":22,"highlight_end":23}],"label":null,"suggested_replacement":"1.to_string()","suggestion_applicability":"MaybeIncorrect","expansion":null}],"children":[],"rendered":null}],"rendered":"$DIR/json-bom-plus-crlf.rs:16:22: error[E0308]: mismatched types "} {"message":"mismatched types","code":{"code":"E0308","explanation":"This error occurs when the compiler was unable to infer the concrete type of a variable. It can occur for several cases, the most common of which is a @@ -34,7 +34,7 @@ let x: i32 = \"I am not a number!\"; // | // type `i32` assigned to variable `x` ``` -"},"level":"error","spans":[{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":681,"byte_end":682,"line_start":19,"line_end":19,"column_start":22,"column_end":23,"is_primary":true,"text":[{"text":" let s : String = 1","highlight_start":22,"highlight_end":23}],"label":"expected struct `std::string::String`, found integer","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":672,"byte_end":678,"line_start":19,"line_end":19,"column_start":13,"column_end":19,"is_primary":false,"text":[{"text":" let s : String = 1","highlight_start":13,"highlight_end":19}],"label":"expected due to this","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"try using a conversion method","code":null,"level":"help","spans":[{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":681,"byte_end":682,"line_start":19,"line_end":19,"column_start":22,"column_end":23,"is_primary":true,"text":[{"text":" let s : String = 1","highlight_start":22,"highlight_end":23}],"label":null,"suggested_replacement":"1.to_string()","suggestion_applicability":"MaybeIncorrect","expansion":null}],"children":[],"rendered":null}],"rendered":"$DIR/json-bom-plus-crlf.rs:19:22: error[E0308]: mismatched types +"},"level":"error","spans":[{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":666,"byte_end":667,"line_start":18,"line_end":18,"column_start":22,"column_end":23,"is_primary":true,"text":[{"text":" let s : String = 1","highlight_start":22,"highlight_end":23}],"label":"expected struct `std::string::String`, found integer","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":657,"byte_end":663,"line_start":18,"line_end":18,"column_start":13,"column_end":19,"is_primary":false,"text":[{"text":" let s : String = 1","highlight_start":13,"highlight_end":19}],"label":"expected due to this","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"try using a conversion method","code":null,"level":"help","spans":[{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":666,"byte_end":667,"line_start":18,"line_end":18,"column_start":22,"column_end":23,"is_primary":true,"text":[{"text":" let s : String = 1","highlight_start":22,"highlight_end":23}],"label":null,"suggested_replacement":"1.to_string()","suggestion_applicability":"MaybeIncorrect","expansion":null}],"children":[],"rendered":null}],"rendered":"$DIR/json-bom-plus-crlf.rs:18:22: error[E0308]: mismatched types "} {"message":"mismatched types","code":{"code":"E0308","explanation":"This error occurs when the compiler was unable to infer the concrete type of a variable. It can occur for several cases, the most common of which is a @@ -53,7 +53,7 @@ let x: i32 = \"I am not a number!\"; // | // type `i32` assigned to variable `x` ``` -"},"level":"error","spans":[{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":745,"byte_end":746,"line_start":23,"line_end":23,"column_start":1,"column_end":2,"is_primary":true,"text":[{"text":"1; // Error after the newline.","highlight_start":1,"highlight_end":2}],"label":"expected struct `std::string::String`, found integer","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":735,"byte_end":741,"line_start":22,"line_end":22,"column_start":13,"column_end":19,"is_primary":false,"text":[{"text":" let s : String =","highlight_start":13,"highlight_end":19}],"label":"expected due to this","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"try using a conversion method","code":null,"level":"help","spans":[{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":745,"byte_end":746,"line_start":23,"line_end":23,"column_start":1,"column_end":2,"is_primary":true,"text":[{"text":"1; // Error after the newline.","highlight_start":1,"highlight_end":2}],"label":null,"suggested_replacement":"1.to_string()","suggestion_applicability":"MaybeIncorrect","expansion":null}],"children":[],"rendered":null}],"rendered":"$DIR/json-bom-plus-crlf.rs:23:1: error[E0308]: mismatched types +"},"level":"error","spans":[{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":730,"byte_end":731,"line_start":22,"line_end":22,"column_start":1,"column_end":2,"is_primary":true,"text":[{"text":"1; // Error after the newline.","highlight_start":1,"highlight_end":2}],"label":"expected struct `std::string::String`, found integer","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":720,"byte_end":726,"line_start":21,"line_end":21,"column_start":13,"column_end":19,"is_primary":false,"text":[{"text":" let s : String =","highlight_start":13,"highlight_end":19}],"label":"expected due to this","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"try using a conversion method","code":null,"level":"help","spans":[{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":730,"byte_end":731,"line_start":22,"line_end":22,"column_start":1,"column_end":2,"is_primary":true,"text":[{"text":"1; // Error after the newline.","highlight_start":1,"highlight_end":2}],"label":null,"suggested_replacement":"1.to_string()","suggestion_applicability":"MaybeIncorrect","expansion":null}],"children":[],"rendered":null}],"rendered":"$DIR/json-bom-plus-crlf.rs:22:1: error[E0308]: mismatched types "} {"message":"mismatched types","code":{"code":"E0308","explanation":"This error occurs when the compiler was unable to infer the concrete type of a variable. It can occur for several cases, the most common of which is a @@ -72,7 +72,7 @@ let x: i32 = \"I am not a number!\"; // | // type `i32` assigned to variable `x` ``` -"},"level":"error","spans":[{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":801,"byte_end":809,"line_start":25,"line_end":26,"column_start":22,"column_end":6,"is_primary":true,"text":[{"text":" let s : String = (","highlight_start":22,"highlight_end":23},{"text":" ); // Error spanning the newline.","highlight_start":1,"highlight_end":6}],"label":"expected struct `std::string::String`, found `()`","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":792,"byte_end":798,"line_start":25,"line_end":25,"column_start":13,"column_end":19,"is_primary":false,"text":[{"text":" let s : String = (","highlight_start":13,"highlight_end":19}],"label":"expected due to this","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"$DIR/json-bom-plus-crlf.rs:25:22: error[E0308]: mismatched types +"},"level":"error","spans":[{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":786,"byte_end":794,"line_start":24,"line_end":25,"column_start":22,"column_end":6,"is_primary":true,"text":[{"text":" let s : String = (","highlight_start":22,"highlight_end":23},{"text":" ); // Error spanning the newline.","highlight_start":1,"highlight_end":6}],"label":"expected struct `std::string::String`, found `()`","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":777,"byte_end":783,"line_start":24,"line_end":24,"column_start":13,"column_end":19,"is_primary":false,"text":[{"text":" let s : String = (","highlight_start":13,"highlight_end":19}],"label":"expected due to this","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"$DIR/json-bom-plus-crlf.rs:24:22: error[E0308]: mismatched types "} {"message":"aborting due to 4 previous errors","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to 4 previous errors "} diff --git a/src/test/ui/json-invalid.rs b/src/test/ui/json-invalid.rs index a8c0c819a0b..54d0dd1849a 100644 --- a/src/test/ui/json-invalid.rs +++ b/src/test/ui/json-invalid.rs @@ -1,4 +1,3 @@ -// build-fail // compile-flags: --json=foo --error-format=json fn main() {} diff --git a/src/test/ui/json-short.rs b/src/test/ui/json-short.rs index 01a311b939c..7414a55869c 100644 --- a/src/test/ui/json-short.rs +++ b/src/test/ui/json-short.rs @@ -1,2 +1 @@ -// build-fail // compile-flags: --json=diagnostic-short --error-format=json diff --git a/src/test/ui/json-short.stderr b/src/test/ui/json-short.stderr index 83fc83778a8..226343b1b8c 100644 --- a/src/test/ui/json-short.stderr +++ b/src/test/ui/json-short.stderr @@ -10,7 +10,7 @@ fn main() { If you don't know the basics of Rust, you can go look to the Rust Book to get started: https://doc.rust-lang.org/book/ -"},"level":"error","spans":[{"file_name":"$DIR/json-short.rs","byte_start":76,"byte_end":76,"line_start":2,"line_end":2,"column_start":63,"column_end":63,"is_primary":true,"text":[{"text":"// compile-flags: --json=diagnostic-short --error-format=json","highlight_start":63,"highlight_end":63}],"label":"consider adding a `main` function to `$DIR/json-short.rs`","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"$DIR/json-short.rs:2:63: error[E0601]: `main` function not found in crate `json_short` +"},"level":"error","spans":[{"file_name":"$DIR/json-short.rs","byte_start":62,"byte_end":62,"line_start":1,"line_end":1,"column_start":63,"column_end":63,"is_primary":true,"text":[{"text":"// compile-flags: --json=diagnostic-short --error-format=json","highlight_start":63,"highlight_end":63}],"label":"consider adding a `main` function to `$DIR/json-short.rs`","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"$DIR/json-short.rs:1:63: error[E0601]: `main` function not found in crate `json_short` "} {"message":"aborting due to previous error","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to previous error "} diff --git a/src/test/ui/linkage-attr/linkage-detect-extern-generated-name-collision.rs b/src/test/ui/linkage-attr/linkage-detect-extern-generated-name-collision.rs index 85a9a336b0d..7b2f5365aca 100644 --- a/src/test/ui/linkage-attr/linkage-detect-extern-generated-name-collision.rs +++ b/src/test/ui/linkage-attr/linkage-detect-extern-generated-name-collision.rs @@ -2,6 +2,7 @@ // collision on the symbol generated for the external linkage item in // an extern crate. +// build-fail // aux-build:def_colliding_external.rs extern crate def_colliding_external as dep1; diff --git a/src/test/ui/linkage-attr/linkage-detect-local-generated-name-collision.rs b/src/test/ui/linkage-attr/linkage-detect-local-generated-name-collision.rs index dc15798e16a..1e5069612fb 100644 --- a/src/test/ui/linkage-attr/linkage-detect-local-generated-name-collision.rs +++ b/src/test/ui/linkage-attr/linkage-detect-local-generated-name-collision.rs @@ -1,3 +1,5 @@ +// build-fail + #![feature(linkage)] mod dep1 { diff --git a/src/test/ui/linkage-attr/linkage-detect-local-generated-name-collision.stderr b/src/test/ui/linkage-attr/linkage-detect-local-generated-name-collision.stderr index 117c76f7f26..d008acc6e7c 100644 --- a/src/test/ui/linkage-attr/linkage-detect-local-generated-name-collision.stderr +++ b/src/test/ui/linkage-attr/linkage-detect-local-generated-name-collision.stderr @@ -1,5 +1,5 @@ error: symbol `collision` is already defined - --> $DIR/linkage-detect-local-generated-name-collision.rs:7:9 + --> $DIR/linkage-detect-local-generated-name-collision.rs:9:9 | LL | pub static collision: *const i32; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/linkage-attr/linkage-requires-raw-ptr.rs b/src/test/ui/linkage-attr/linkage-requires-raw-ptr.rs index 014c715be0d..93afc537f7c 100644 --- a/src/test/ui/linkage-attr/linkage-requires-raw-ptr.rs +++ b/src/test/ui/linkage-attr/linkage-requires-raw-ptr.rs @@ -1,6 +1,7 @@ // rust-lang/rust#59548: We used to ICE when trying to use a static // with a type that violated its own `#[linkage]`. +// build-fail // aux-build:def_illtyped_external.rs extern crate def_illtyped_external as dep; diff --git a/src/test/ui/linkage-attr/linkage2.rs b/src/test/ui/linkage-attr/linkage2.rs index c8af1a69979..41e7819e8cd 100644 --- a/src/test/ui/linkage-attr/linkage2.rs +++ b/src/test/ui/linkage-attr/linkage2.rs @@ -1,4 +1,6 @@ // FIXME https://github.com/rust-lang/rust/issues/59774 + +// build-fail // normalize-stderr-test "thread.*panicked.*Metadata module not compiled.*\n" -> "" // normalize-stderr-test "note:.*RUST_BACKTRACE=1.*\n" -> "" // ignore-sgx no weak linkages permitted diff --git a/src/test/ui/linkage-attr/linkage2.stderr b/src/test/ui/linkage-attr/linkage2.stderr index 2654ffd67b6..72ee3fb62ec 100644 --- a/src/test/ui/linkage-attr/linkage2.stderr +++ b/src/test/ui/linkage-attr/linkage2.stderr @@ -1,5 +1,5 @@ error: must have type `*const T` or `*mut T` due to `#[linkage]` attribute - --> $DIR/linkage2.rs:9:32 + --> $DIR/linkage2.rs:11:32 | LL | #[linkage = "extern_weak"] static foo: i32; | ^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/linkage-attr/linkage3.rs b/src/test/ui/linkage-attr/linkage3.rs index 1462079acf7..bd4e5ba2d4a 100644 --- a/src/test/ui/linkage-attr/linkage3.rs +++ b/src/test/ui/linkage-attr/linkage3.rs @@ -1,4 +1,6 @@ // FIXME https://github.com/rust-lang/rust/issues/59774 + +// build-fail // normalize-stderr-test "thread.*panicked.*Metadata module not compiled.*\n" -> "" // normalize-stderr-test "note:.*RUST_BACKTRACE=1.*\n" -> "" diff --git a/src/test/ui/linkage-attr/linkage3.stderr b/src/test/ui/linkage-attr/linkage3.stderr index b74fdc91429..5a0833f2f74 100644 --- a/src/test/ui/linkage-attr/linkage3.stderr +++ b/src/test/ui/linkage-attr/linkage3.stderr @@ -1,5 +1,5 @@ error: invalid linkage specified - --> $DIR/linkage3.rs:8:24 + --> $DIR/linkage3.rs:10:24 | LL | #[linkage = "foo"] static foo: *const i32; | ^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/lint/lint-exceeding-bitshifts.rs b/src/test/ui/lint/lint-exceeding-bitshifts.rs index dd3b8393429..121e5b796bb 100644 --- a/src/test/ui/lint/lint-exceeding-bitshifts.rs +++ b/src/test/ui/lint/lint-exceeding-bitshifts.rs @@ -1,3 +1,4 @@ +// build-fail // compile-flags: -O #![deny(exceeding_bitshifts, const_err)] diff --git a/src/test/ui/lint/lint-exceeding-bitshifts.stderr b/src/test/ui/lint/lint-exceeding-bitshifts.stderr index 25e079b6d81..203cb741539 100644 --- a/src/test/ui/lint/lint-exceeding-bitshifts.stderr +++ b/src/test/ui/lint/lint-exceeding-bitshifts.stderr @@ -1,113 +1,113 @@ error: attempt to shift left with overflow - --> $DIR/lint-exceeding-bitshifts.rs:9:15 + --> $DIR/lint-exceeding-bitshifts.rs:10:15 | LL | let n = 1u8 << 8; | ^^^^^^^^ | note: lint level defined here - --> $DIR/lint-exceeding-bitshifts.rs:3:9 + --> $DIR/lint-exceeding-bitshifts.rs:4:9 | LL | #![deny(exceeding_bitshifts, const_err)] | ^^^^^^^^^^^^^^^^^^^ error: attempt to shift left with overflow - --> $DIR/lint-exceeding-bitshifts.rs:11:15 + --> $DIR/lint-exceeding-bitshifts.rs:12:15 | LL | let n = 1u16 << 16; | ^^^^^^^^^^ error: attempt to shift left with overflow - --> $DIR/lint-exceeding-bitshifts.rs:13:15 + --> $DIR/lint-exceeding-bitshifts.rs:14:15 | LL | let n = 1u32 << 32; | ^^^^^^^^^^ error: attempt to shift left with overflow - --> $DIR/lint-exceeding-bitshifts.rs:15:15 + --> $DIR/lint-exceeding-bitshifts.rs:16:15 | LL | let n = 1u64 << 64; | ^^^^^^^^^^ error: attempt to shift left with overflow - --> $DIR/lint-exceeding-bitshifts.rs:17:15 + --> $DIR/lint-exceeding-bitshifts.rs:18:15 | LL | let n = 1i8 << 8; | ^^^^^^^^ error: attempt to shift left with overflow - --> $DIR/lint-exceeding-bitshifts.rs:19:15 + --> $DIR/lint-exceeding-bitshifts.rs:20:15 | LL | let n = 1i16 << 16; | ^^^^^^^^^^ error: attempt to shift left with overflow - --> $DIR/lint-exceeding-bitshifts.rs:21:15 + --> $DIR/lint-exceeding-bitshifts.rs:22:15 | LL | let n = 1i32 << 32; | ^^^^^^^^^^ error: attempt to shift left with overflow - --> $DIR/lint-exceeding-bitshifts.rs:23:15 + --> $DIR/lint-exceeding-bitshifts.rs:24:15 | LL | let n = 1i64 << 64; | ^^^^^^^^^^ error: attempt to shift right with overflow - --> $DIR/lint-exceeding-bitshifts.rs:26:15 + --> $DIR/lint-exceeding-bitshifts.rs:27:15 | LL | let n = 1u8 >> 8; | ^^^^^^^^ error: attempt to shift right with overflow - --> $DIR/lint-exceeding-bitshifts.rs:28:15 + --> $DIR/lint-exceeding-bitshifts.rs:29:15 | LL | let n = 1u16 >> 16; | ^^^^^^^^^^ error: attempt to shift right with overflow - --> $DIR/lint-exceeding-bitshifts.rs:30:15 + --> $DIR/lint-exceeding-bitshifts.rs:31:15 | LL | let n = 1u32 >> 32; | ^^^^^^^^^^ error: attempt to shift right with overflow - --> $DIR/lint-exceeding-bitshifts.rs:32:15 + --> $DIR/lint-exceeding-bitshifts.rs:33:15 | LL | let n = 1u64 >> 64; | ^^^^^^^^^^ error: attempt to shift right with overflow - --> $DIR/lint-exceeding-bitshifts.rs:34:15 + --> $DIR/lint-exceeding-bitshifts.rs:35:15 | LL | let n = 1i8 >> 8; | ^^^^^^^^ error: attempt to shift right with overflow - --> $DIR/lint-exceeding-bitshifts.rs:36:15 + --> $DIR/lint-exceeding-bitshifts.rs:37:15 | LL | let n = 1i16 >> 16; | ^^^^^^^^^^ error: attempt to shift right with overflow - --> $DIR/lint-exceeding-bitshifts.rs:38:15 + --> $DIR/lint-exceeding-bitshifts.rs:39:15 | LL | let n = 1i32 >> 32; | ^^^^^^^^^^ error: attempt to shift right with overflow - --> $DIR/lint-exceeding-bitshifts.rs:40:15 + --> $DIR/lint-exceeding-bitshifts.rs:41:15 | LL | let n = 1i64 >> 64; | ^^^^^^^^^^ error: attempt to shift left with overflow - --> $DIR/lint-exceeding-bitshifts.rs:44:15 + --> $DIR/lint-exceeding-bitshifts.rs:45:15 | LL | let n = n << 8; | ^^^^^^ error: attempt to shift left with overflow - --> $DIR/lint-exceeding-bitshifts.rs:46:15 + --> $DIR/lint-exceeding-bitshifts.rs:47:15 | LL | let n = 1u8 << -8; | ^^^^^^^^^ diff --git a/src/test/ui/lint/lint-exceeding-bitshifts2.rs b/src/test/ui/lint/lint-exceeding-bitshifts2.rs index 2c213daddd7..2a7cbc10f77 100644 --- a/src/test/ui/lint/lint-exceeding-bitshifts2.rs +++ b/src/test/ui/lint/lint-exceeding-bitshifts2.rs @@ -1,3 +1,4 @@ +// build-fail // compile-flags: -O #![deny(exceeding_bitshifts, const_err)] diff --git a/src/test/ui/lint/lint-exceeding-bitshifts2.stderr b/src/test/ui/lint/lint-exceeding-bitshifts2.stderr index d9c76d233d0..49ac54ab834 100644 --- a/src/test/ui/lint/lint-exceeding-bitshifts2.stderr +++ b/src/test/ui/lint/lint-exceeding-bitshifts2.stderr @@ -1,29 +1,29 @@ error: attempt to shift left with overflow - --> $DIR/lint-exceeding-bitshifts2.rs:9:15 + --> $DIR/lint-exceeding-bitshifts2.rs:10:15 | LL | let n = 1u8 << (4+4); | ^^^^^^^^^^^^ | note: lint level defined here - --> $DIR/lint-exceeding-bitshifts2.rs:3:9 + --> $DIR/lint-exceeding-bitshifts2.rs:4:9 | LL | #![deny(exceeding_bitshifts, const_err)] | ^^^^^^^^^^^^^^^^^^^ error: attempt to shift right with overflow - --> $DIR/lint-exceeding-bitshifts2.rs:11:15 + --> $DIR/lint-exceeding-bitshifts2.rs:12:15 | LL | let n = 1i64 >> [64][0]; | ^^^^^^^^^^^^^^^ error: attempt to shift left with overflow - --> $DIR/lint-exceeding-bitshifts2.rs:17:15 + --> $DIR/lint-exceeding-bitshifts2.rs:18:15 | LL | let n = 1_isize << BITS; | ^^^^^^^^^^^^^^^ error: attempt to shift left with overflow - --> $DIR/lint-exceeding-bitshifts2.rs:18:15 + --> $DIR/lint-exceeding-bitshifts2.rs:19:15 | LL | let n = 1_usize << BITS; | ^^^^^^^^^^^^^^^ diff --git a/src/test/ui/lto-duplicate-symbols.rs b/src/test/ui/lto-duplicate-symbols.rs index c95e9fbf406..268cf261219 100644 --- a/src/test/ui/lto-duplicate-symbols.rs +++ b/src/test/ui/lto-duplicate-symbols.rs @@ -1,3 +1,4 @@ +// build-fail // aux-build:lto-duplicate-symbols1.rs // aux-build:lto-duplicate-symbols2.rs // error-pattern:Linking globals named 'foo': symbol multiply defined! diff --git a/src/test/ui/non-integer-atomic.rs b/src/test/ui/non-integer-atomic.rs index 00d07b7fe48..26d7e66ae3f 100644 --- a/src/test/ui/non-integer-atomic.rs +++ b/src/test/ui/non-integer-atomic.rs @@ -1,3 +1,5 @@ +// build-fail + #![feature(core_intrinsics)] #![allow(warnings)] #![crate_type = "rlib"] diff --git a/src/test/ui/non-integer-atomic.stderr b/src/test/ui/non-integer-atomic.stderr index 2a06b617aec..468e76da666 100644 --- a/src/test/ui/non-integer-atomic.stderr +++ b/src/test/ui/non-integer-atomic.stderr @@ -1,95 +1,95 @@ error[E0511]: invalid monomorphization of `atomic_load` intrinsic: expected basic integer type, found `bool` - --> $DIR/non-integer-atomic.rs:13:5 + --> $DIR/non-integer-atomic.rs:15:5 | LL | intrinsics::atomic_load(p); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `atomic_store` intrinsic: expected basic integer type, found `bool` - --> $DIR/non-integer-atomic.rs:18:5 + --> $DIR/non-integer-atomic.rs:20:5 | LL | intrinsics::atomic_store(p, v); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `atomic_xchg` intrinsic: expected basic integer type, found `bool` - --> $DIR/non-integer-atomic.rs:23:5 + --> $DIR/non-integer-atomic.rs:25:5 | LL | intrinsics::atomic_xchg(p, v); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `atomic_cxchg` intrinsic: expected basic integer type, found `bool` - --> $DIR/non-integer-atomic.rs:28:5 + --> $DIR/non-integer-atomic.rs:30:5 | LL | intrinsics::atomic_cxchg(p, v, v); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `atomic_load` intrinsic: expected basic integer type, found `Foo` - --> $DIR/non-integer-atomic.rs:33:5 + --> $DIR/non-integer-atomic.rs:35:5 | LL | intrinsics::atomic_load(p); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `atomic_store` intrinsic: expected basic integer type, found `Foo` - --> $DIR/non-integer-atomic.rs:38:5 + --> $DIR/non-integer-atomic.rs:40:5 | LL | intrinsics::atomic_store(p, v); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `atomic_xchg` intrinsic: expected basic integer type, found `Foo` - --> $DIR/non-integer-atomic.rs:43:5 + --> $DIR/non-integer-atomic.rs:45:5 | LL | intrinsics::atomic_xchg(p, v); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `atomic_cxchg` intrinsic: expected basic integer type, found `Foo` - --> $DIR/non-integer-atomic.rs:48:5 + --> $DIR/non-integer-atomic.rs:50:5 | LL | intrinsics::atomic_cxchg(p, v, v); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `atomic_load` intrinsic: expected basic integer type, found `&dyn std::ops::Fn()` - --> $DIR/non-integer-atomic.rs:53:5 + --> $DIR/non-integer-atomic.rs:55:5 | LL | intrinsics::atomic_load(p); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `atomic_store` intrinsic: expected basic integer type, found `&dyn std::ops::Fn()` - --> $DIR/non-integer-atomic.rs:58:5 + --> $DIR/non-integer-atomic.rs:60:5 | LL | intrinsics::atomic_store(p, v); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `atomic_xchg` intrinsic: expected basic integer type, found `&dyn std::ops::Fn()` - --> $DIR/non-integer-atomic.rs:63:5 + --> $DIR/non-integer-atomic.rs:65:5 | LL | intrinsics::atomic_xchg(p, v); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `atomic_cxchg` intrinsic: expected basic integer type, found `&dyn std::ops::Fn()` - --> $DIR/non-integer-atomic.rs:68:5 + --> $DIR/non-integer-atomic.rs:70:5 | LL | intrinsics::atomic_cxchg(p, v, v); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `atomic_load` intrinsic: expected basic integer type, found `[u8; 100]` - --> $DIR/non-integer-atomic.rs:73:5 + --> $DIR/non-integer-atomic.rs:75:5 | LL | intrinsics::atomic_load(p); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `atomic_store` intrinsic: expected basic integer type, found `[u8; 100]` - --> $DIR/non-integer-atomic.rs:78:5 + --> $DIR/non-integer-atomic.rs:80:5 | LL | intrinsics::atomic_store(p, v); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `atomic_xchg` intrinsic: expected basic integer type, found `[u8; 100]` - --> $DIR/non-integer-atomic.rs:83:5 + --> $DIR/non-integer-atomic.rs:85:5 | LL | intrinsics::atomic_xchg(p, v); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `atomic_cxchg` intrinsic: expected basic integer type, found `[u8; 100]` - --> $DIR/non-integer-atomic.rs:88:5 + --> $DIR/non-integer-atomic.rs:90:5 | LL | intrinsics::atomic_cxchg(p, v, v); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/panic-runtime/abort-link-to-unwind-dylib.rs b/src/test/ui/panic-runtime/abort-link-to-unwind-dylib.rs index c2deeb7dfd4..4b0f92456e0 100644 --- a/src/test/ui/panic-runtime/abort-link-to-unwind-dylib.rs +++ b/src/test/ui/panic-runtime/abort-link-to-unwind-dylib.rs @@ -1,3 +1,4 @@ +// build-fail // compile-flags:-C panic=abort -C prefer-dynamic // ignore-musl - no dylibs here // ignore-cloudabi diff --git a/src/test/ui/panic-runtime/transitive-link-a-bunch.rs b/src/test/ui/panic-runtime/transitive-link-a-bunch.rs index 5d72771c2dc..1848c986e36 100644 --- a/src/test/ui/panic-runtime/transitive-link-a-bunch.rs +++ b/src/test/ui/panic-runtime/transitive-link-a-bunch.rs @@ -1,3 +1,4 @@ +// build-fail // aux-build:panic-runtime-unwind.rs // aux-build:panic-runtime-abort.rs // aux-build:wants-panic-runtime-unwind.rs diff --git a/src/test/ui/panic-runtime/want-unwind-got-abort.rs b/src/test/ui/panic-runtime/want-unwind-got-abort.rs index 4c25c09d643..894a5eb38b8 100644 --- a/src/test/ui/panic-runtime/want-unwind-got-abort.rs +++ b/src/test/ui/panic-runtime/want-unwind-got-abort.rs @@ -1,3 +1,4 @@ +// build-fail // error-pattern:is incompatible with this crate's strategy of `unwind` // aux-build:panic-runtime-abort.rs // aux-build:panic-runtime-lang-items.rs diff --git a/src/test/ui/panic-runtime/want-unwind-got-abort2.rs b/src/test/ui/panic-runtime/want-unwind-got-abort2.rs index 478af451e7f..5955075bae5 100644 --- a/src/test/ui/panic-runtime/want-unwind-got-abort2.rs +++ b/src/test/ui/panic-runtime/want-unwind-got-abort2.rs @@ -1,3 +1,4 @@ +// build-fail // error-pattern:is incompatible with this crate's strategy of `unwind` // aux-build:panic-runtime-abort.rs // aux-build:wants-panic-runtime-abort.rs diff --git a/src/test/ui/parser/impl-item-type-no-body-semantic-fail.rs b/src/test/ui/parser/impl-item-type-no-body-semantic-fail.rs index 71c7d4ba21d..9c321c4bd0d 100644 --- a/src/test/ui/parser/impl-item-type-no-body-semantic-fail.rs +++ b/src/test/ui/parser/impl-item-type-no-body-semantic-fail.rs @@ -19,4 +19,5 @@ impl X { //~| ERROR associated types are not yet supported in inherent impls type W where Self: Eq; //~^ ERROR associated type in `impl` without body + //~| ERROR associated types are not yet supported in inherent impls } diff --git a/src/test/ui/parser/impl-item-type-no-body-semantic-fail.stderr b/src/test/ui/parser/impl-item-type-no-body-semantic-fail.stderr index 6f1439c8f0b..65e1981e3ac 100644 --- a/src/test/ui/parser/impl-item-type-no-body-semantic-fail.stderr +++ b/src/test/ui/parser/impl-item-type-no-body-semantic-fail.stderr @@ -68,6 +68,12 @@ error[E0202]: associated types are not yet supported in inherent impls (see #899 LL | type W: Ord where Self: Eq; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: aborting due to 9 previous errors +error[E0202]: associated types are not yet supported in inherent impls (see #8995) + --> $DIR/impl-item-type-no-body-semantic-fail.rs:20:5 + | +LL | type W where Self: Eq; + | ^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 10 previous errors For more information about this error, try `rustc --explain E0202`. diff --git a/src/test/ui/print_type_sizes/zero-sized-fields.rs b/src/test/ui/print_type_sizes/zero-sized-fields.rs index 2ad488e8d8f..71d09167747 100644 --- a/src/test/ui/print_type_sizes/zero-sized-fields.rs +++ b/src/test/ui/print_type_sizes/zero-sized-fields.rs @@ -1,5 +1,6 @@ // compile-flags: -Z print-type-sizes // build-pass (FIXME(62277): could be check-pass?) +// ignore-pass // At one point, zero-sized fields such as those in this file were causing // incorrect output from `-Z print-type-sizes`. diff --git a/src/test/ui/qualified/qualified-path-params-2.rs b/src/test/ui/qualified/qualified-path-params-2.rs index ebdd7490462..d0cc1fa3d51 100644 --- a/src/test/ui/qualified/qualified-path-params-2.rs +++ b/src/test/ui/qualified/qualified-path-params-2.rs @@ -16,7 +16,6 @@ impl S { } type A = <S as Tr>::A::f<u8>; -//~^ ERROR type arguments are not allowed for this type -//~| ERROR ambiguous associated type +//~^ ERROR ambiguous associated type fn main() {} diff --git a/src/test/ui/qualified/qualified-path-params-2.stderr b/src/test/ui/qualified/qualified-path-params-2.stderr index 15da5193e88..948f21fce4b 100644 --- a/src/test/ui/qualified/qualified-path-params-2.stderr +++ b/src/test/ui/qualified/qualified-path-params-2.stderr @@ -1,16 +1,9 @@ -error[E0109]: type arguments are not allowed for this type - --> $DIR/qualified-path-params-2.rs:18:26 - | -LL | type A = <S as Tr>::A::f<u8>; - | ^^ type argument not allowed - error[E0223]: ambiguous associated type --> $DIR/qualified-path-params-2.rs:18:10 | LL | type A = <S as Tr>::A::f<u8>; | ^^^^^^^^^^^^^^^^^^^ help: use fully-qualified syntax: `<<S as Tr>::A as Trait>::f` -error: aborting due to 2 previous errors +error: aborting due to previous error -Some errors have detailed explanations: E0109, E0223. -For more information about an error, try `rustc --explain E0109`. +For more information about this error, try `rustc --explain E0223`. diff --git a/src/test/ui/recursion/recursion.rs b/src/test/ui/recursion/recursion.rs index ba3cc33dc30..9d939e13182 100644 --- a/src/test/ui/recursion/recursion.rs +++ b/src/test/ui/recursion/recursion.rs @@ -1,3 +1,5 @@ +// build-fail + enum Nil {NilValue} struct Cons<T> {head:isize, tail:T} trait Dot {fn dot(&self, other:Self) -> isize;} diff --git a/src/test/ui/recursion/recursion.stderr b/src/test/ui/recursion/recursion.stderr index 751d56b70f1..17293720a43 100644 --- a/src/test/ui/recursion/recursion.stderr +++ b/src/test/ui/recursion/recursion.stderr @@ -1,5 +1,5 @@ error: reached the recursion limit while instantiating `test::<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Nil>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` - --> $DIR/recursion.rs:12:1 + --> $DIR/recursion.rs:14:1 | LL | / fn test<T:Dot> (n:isize, i:isize, first:T, second:T) ->isize { LL | | match n { 0 => {first.dot(second)} diff --git a/src/test/ui/required-lang-item.rs b/src/test/ui/required-lang-item.rs index ee3773675e0..3b17c5b7255 100644 --- a/src/test/ui/required-lang-item.rs +++ b/src/test/ui/required-lang-item.rs @@ -1,3 +1,5 @@ +// build-fail + #![feature(lang_items, no_core)] #![no_core] diff --git a/src/test/ui/rfc1598-generic-associated-types/collections.stderr b/src/test/ui/rfc1598-generic-associated-types/collections.stderr deleted file mode 100644 index fa8fcc99240..00000000000 --- a/src/test/ui/rfc1598-generic-associated-types/collections.stderr +++ /dev/null @@ -1,41 +0,0 @@ -warning: the feature `generic_associated_types` is incomplete and may cause the compiler to crash - --> $DIR/collections.rs:1:12 - | -LL | #![feature(generic_associated_types)] - | ^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - -error[E0109]: type arguments are not allowed for this type - --> $DIR/collections.rs:56:90 - | -LL | fn floatify<C>(ints: &C) -> <<C as Collection<i32>>::Family as CollectionFamily>::Member<f32> - | ^^^ type argument not allowed - -error[E0109]: type arguments are not allowed for this type - --> $DIR/collections.rs:68:69 - | -LL | fn floatify_sibling<C>(ints: &C) -> <C as Collection<i32>>::Sibling<f32> - | ^^^ type argument not allowed - -error[E0109]: type arguments are not allowed for this type - --> $DIR/collections.rs:17:71 - | -LL | <<Self as Collection<T>>::Family as CollectionFamily>::Member<U>; - | ^ type argument not allowed - -error[E0109]: lifetime arguments are not allowed for this type - --> $DIR/collections.rs:24:50 - | -LL | fn iterate<'iter>(&'iter self) -> Self::Iter<'iter>; - | ^^^^^ lifetime argument not allowed - -error[E0109]: lifetime arguments are not allowed for this type - --> $DIR/collections.rs:50:50 - | -LL | fn iterate<'iter>(&'iter self) -> Self::Iter<'iter> { - | ^^^^^ lifetime argument not allowed - -error: aborting due to 5 previous errors - -For more information about this error, try `rustc --explain E0109`. diff --git a/src/test/ui/rfc1598-generic-associated-types/construct_with_other_type.rs b/src/test/ui/rfc1598-generic-associated-types/construct_with_other_type.rs deleted file mode 100644 index 3a459a4551c..00000000000 --- a/src/test/ui/rfc1598-generic-associated-types/construct_with_other_type.rs +++ /dev/null @@ -1,29 +0,0 @@ -#![feature(generic_associated_types)] -//~^ WARNING the feature `generic_associated_types` is incomplete - -use std::ops::Deref; - -// FIXME(#44265): "lifetime arguments are not allowed for this type" errors will be addressed in a -// follow-up PR. - -trait Foo { - type Bar<'a, 'b>; -} - -trait Baz { - type Quux<'a>: Foo; - - // This weird type tests that we can use universal function call syntax to access the Item on - type Baa<'a>: Deref<Target = <Self::Quux<'a> as Foo>::Bar<'a, 'static>>; - //~^ ERROR lifetime arguments are not allowed for this type [E0109] - //~| ERROR lifetime arguments are not allowed for this type [E0109] -} - -impl<T> Baz for T where T: Foo { - type Quux<'a> = T; - - type Baa<'a> = &'a <T as Foo>::Bar<'a, 'static>; - //~^ ERROR lifetime arguments are not allowed for this type [E0109] -} - -fn main() {} diff --git a/src/test/ui/rfc1598-generic-associated-types/construct_with_other_type.stderr b/src/test/ui/rfc1598-generic-associated-types/construct_with_other_type.stderr deleted file mode 100644 index ab161ae21bb..00000000000 --- a/src/test/ui/rfc1598-generic-associated-types/construct_with_other_type.stderr +++ /dev/null @@ -1,29 +0,0 @@ -warning: the feature `generic_associated_types` is incomplete and may cause the compiler to crash - --> $DIR/construct_with_other_type.rs:1:12 - | -LL | #![feature(generic_associated_types)] - | ^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - -error[E0109]: lifetime arguments are not allowed for this type - --> $DIR/construct_with_other_type.rs:17:46 - | -LL | type Baa<'a>: Deref<Target = <Self::Quux<'a> as Foo>::Bar<'a, 'static>>; - | ^^ lifetime argument not allowed - -error[E0109]: lifetime arguments are not allowed for this type - --> $DIR/construct_with_other_type.rs:17:63 - | -LL | type Baa<'a>: Deref<Target = <Self::Quux<'a> as Foo>::Bar<'a, 'static>>; - | ^^ lifetime argument not allowed - -error[E0109]: lifetime arguments are not allowed for this type - --> $DIR/construct_with_other_type.rs:25:40 - | -LL | type Baa<'a> = &'a <T as Foo>::Bar<'a, 'static>; - | ^^ lifetime argument not allowed - -error: aborting due to 3 previous errors - -For more information about this error, try `rustc --explain E0109`. diff --git a/src/test/ui/rfc1598-generic-associated-types/empty_generics.stderr b/src/test/ui/rfc1598-generic-associated-types/empty_generics.stderr deleted file mode 100644 index 9c8d3f192da..00000000000 --- a/src/test/ui/rfc1598-generic-associated-types/empty_generics.stderr +++ /dev/null @@ -1,16 +0,0 @@ -error: expected one of `>`, `const`, identifier, or lifetime, found `,` - --> $DIR/empty_generics.rs:5:14 - | -LL | type Bar<,>; - | ^ expected one of `>`, `const`, identifier, or lifetime - -warning: the feature `generic_associated_types` is incomplete and may cause the compiler to crash - --> $DIR/empty_generics.rs:1:12 - | -LL | #![feature(generic_associated_types)] - | ^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - -error: aborting due to previous error - diff --git a/src/test/ui/rfc1598-generic-associated-types/gat-dont-ice-on-absent-feature.stderr b/src/test/ui/rfc1598-generic-associated-types/gat-dont-ice-on-absent-feature.stderr deleted file mode 100644 index fb43a50df78..00000000000 --- a/src/test/ui/rfc1598-generic-associated-types/gat-dont-ice-on-absent-feature.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0658]: generic associated types are unstable - --> $DIR/gat-dont-ice-on-absent-feature.rs:7:5 - | -LL | type Item<'b> = &'b Foo; - | ^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: for more information, see https://github.com/rust-lang/rust/issues/44265 - = help: add `#![feature(generic_associated_types)]` 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/rfc1598-generic-associated-types/generic-associated-types-where.stderr b/src/test/ui/rfc1598-generic-associated-types/generic-associated-types-where.stderr deleted file mode 100644 index 0d319a7a599..00000000000 --- a/src/test/ui/rfc1598-generic-associated-types/generic-associated-types-where.stderr +++ /dev/null @@ -1,8 +0,0 @@ -warning: the feature `generic_associated_types` is incomplete and may cause the compiler to crash - --> $DIR/generic-associated-types-where.rs:1:12 - | -LL | #![feature(generic_associated_types)] - | ^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - diff --git a/src/test/ui/rfc1598-generic-associated-types/generic_associated_type_undeclared_lifetimes.rs b/src/test/ui/rfc1598-generic-associated-types/generic_associated_type_undeclared_lifetimes.rs deleted file mode 100644 index 150899a034b..00000000000 --- a/src/test/ui/rfc1598-generic-associated-types/generic_associated_type_undeclared_lifetimes.rs +++ /dev/null @@ -1,22 +0,0 @@ -#![feature(generic_associated_types)] -//~^ WARNING the feature `generic_associated_types` is incomplete - -use std::ops::Deref; - -// FIXME(#44265): "lifetime arguments are not allowed for this type" errors will be addressed in a -// follow-up PR. - -trait Iterable { - type Item<'a>; - type Iter<'a>: Iterator<Item = Self::Item<'a>> - //~^ ERROR lifetime arguments are not allowed for this type [E0109] - + Deref<Target = Self::Item<'b>>; - //~^ ERROR undeclared lifetime - //~| ERROR lifetime arguments are not allowed for this type [E0109] - - fn iter<'a>(&'a self) -> Self::Iter<'undeclared>; - //~^ ERROR undeclared lifetime - //~| ERROR lifetime arguments are not allowed for this type [E0109] -} - -fn main() {} diff --git a/src/test/ui/rfc1598-generic-associated-types/generic_associated_type_undeclared_lifetimes.stderr b/src/test/ui/rfc1598-generic-associated-types/generic_associated_type_undeclared_lifetimes.stderr deleted file mode 100644 index 40ea42f6243..00000000000 --- a/src/test/ui/rfc1598-generic-associated-types/generic_associated_type_undeclared_lifetimes.stderr +++ /dev/null @@ -1,42 +0,0 @@ -warning: the feature `generic_associated_types` is incomplete and may cause the compiler to crash - --> $DIR/generic_associated_type_undeclared_lifetimes.rs:1:12 - | -LL | #![feature(generic_associated_types)] - | ^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - -error[E0261]: use of undeclared lifetime name `'b` - --> $DIR/generic_associated_type_undeclared_lifetimes.rs:13:37 - | -LL | + Deref<Target = Self::Item<'b>>; - | ^^ undeclared lifetime - -error[E0261]: use of undeclared lifetime name `'undeclared` - --> $DIR/generic_associated_type_undeclared_lifetimes.rs:17:41 - | -LL | fn iter<'a>(&'a self) -> Self::Iter<'undeclared>; - | ^^^^^^^^^^^ undeclared lifetime - -error[E0109]: lifetime arguments are not allowed for this type - --> $DIR/generic_associated_type_undeclared_lifetimes.rs:11:47 - | -LL | type Iter<'a>: Iterator<Item = Self::Item<'a>> - | ^^ lifetime argument not allowed - -error[E0109]: lifetime arguments are not allowed for this type - --> $DIR/generic_associated_type_undeclared_lifetimes.rs:13:37 - | -LL | + Deref<Target = Self::Item<'b>>; - | ^^ lifetime argument not allowed - -error[E0109]: lifetime arguments are not allowed for this type - --> $DIR/generic_associated_type_undeclared_lifetimes.rs:17:41 - | -LL | fn iter<'a>(&'a self) -> Self::Iter<'undeclared>; - | ^^^^^^^^^^^ lifetime argument not allowed - -error: aborting due to 5 previous errors - -Some errors have detailed explanations: E0109, E0261. -For more information about an error, try `rustc --explain E0109`. diff --git a/src/test/ui/rfc1598-generic-associated-types/iterable.rs b/src/test/ui/rfc1598-generic-associated-types/iterable.rs deleted file mode 100644 index 29953b9db1a..00000000000 --- a/src/test/ui/rfc1598-generic-associated-types/iterable.rs +++ /dev/null @@ -1,50 +0,0 @@ -#![feature(generic_associated_types)] -//~^ WARNING the feature `generic_associated_types` is incomplete - -use std::ops::Deref; - -// FIXME(#44265): "lifetime arguments are not allowed for this type" errors will be addressed in a -// follow-up PR. - -trait Iterable { - type Item<'a>; - type Iter<'a>: Iterator<Item = Self::Item<'a>>; - //~^ ERROR lifetime arguments are not allowed for this type [E0109] - - fn iter<'a>(&'a self) -> Self::Iter<'a>; - //~^ ERROR lifetime arguments are not allowed for this type [E0109] -} - -// Impl for struct type -impl<T> Iterable for Vec<T> { - type Item<'a> = &'a T; - type Iter<'a> = std::slice::Iter<'a, T>; - - fn iter<'a>(&'a self) -> Self::Iter<'a> { - //~^ ERROR lifetime arguments are not allowed for this type [E0109] - self.iter() - } -} - -// Impl for a primitive type -impl<T> Iterable for [T] { - type Item<'a> = &'a T; - type Iter<'a> = std::slice::Iter<'a, T>; - - fn iter<'a>(&'a self) -> Self::Iter<'a> { - //~^ ERROR lifetime arguments are not allowed for this type [E0109] - self.iter() - } -} - -fn make_iter<'a, I: Iterable>(it: &'a I) -> I::Iter<'a> { - //~^ ERROR lifetime arguments are not allowed for this type [E0109] - it.iter() -} - -fn get_first<'a, I: Iterable>(it: &'a I) -> Option<I::Item<'a>> { - //~^ ERROR lifetime arguments are not allowed for this type [E0109] - it.iter().next() -} - -fn main() {} diff --git a/src/test/ui/rfc1598-generic-associated-types/iterable.stderr b/src/test/ui/rfc1598-generic-associated-types/iterable.stderr deleted file mode 100644 index 51246d3c902..00000000000 --- a/src/test/ui/rfc1598-generic-associated-types/iterable.stderr +++ /dev/null @@ -1,47 +0,0 @@ -warning: the feature `generic_associated_types` is incomplete and may cause the compiler to crash - --> $DIR/iterable.rs:1:12 - | -LL | #![feature(generic_associated_types)] - | ^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - -error[E0109]: lifetime arguments are not allowed for this type - --> $DIR/iterable.rs:11:47 - | -LL | type Iter<'a>: Iterator<Item = Self::Item<'a>>; - | ^^ lifetime argument not allowed - -error[E0109]: lifetime arguments are not allowed for this type - --> $DIR/iterable.rs:40:53 - | -LL | fn make_iter<'a, I: Iterable>(it: &'a I) -> I::Iter<'a> { - | ^^ lifetime argument not allowed - -error[E0109]: lifetime arguments are not allowed for this type - --> $DIR/iterable.rs:45:60 - | -LL | fn get_first<'a, I: Iterable>(it: &'a I) -> Option<I::Item<'a>> { - | ^^ lifetime argument not allowed - -error[E0109]: lifetime arguments are not allowed for this type - --> $DIR/iterable.rs:14:41 - | -LL | fn iter<'a>(&'a self) -> Self::Iter<'a>; - | ^^ lifetime argument not allowed - -error[E0109]: lifetime arguments are not allowed for this type - --> $DIR/iterable.rs:23:41 - | -LL | fn iter<'a>(&'a self) -> Self::Iter<'a> { - | ^^ lifetime argument not allowed - -error[E0109]: lifetime arguments are not allowed for this type - --> $DIR/iterable.rs:34:41 - | -LL | fn iter<'a>(&'a self) -> Self::Iter<'a> { - | ^^ lifetime argument not allowed - -error: aborting due to 6 previous errors - -For more information about this error, try `rustc --explain E0109`. diff --git a/src/test/ui/rfc1598-generic-associated-types/parameter_number_and_kind.rs b/src/test/ui/rfc1598-generic-associated-types/parameter_number_and_kind.rs deleted file mode 100644 index aa3f4b186da..00000000000 --- a/src/test/ui/rfc1598-generic-associated-types/parameter_number_and_kind.rs +++ /dev/null @@ -1,47 +0,0 @@ -#![feature(generic_associated_types)] -//~^ WARNING the feature `generic_associated_types` is incomplete -#![feature(associated_type_defaults)] - -// FIXME(#44265): "lifetime arguments are not allowed for this type" errors will be addressed in a -// follow-up PR. - -// FIXME(#44265): Update expected errors once E110 is resolved, now does not get past `trait Foo`. - -trait Foo { - type A<'a>; - type B<'a, 'b>; - type C; - type D<T>; - type E<'a, T>; - // Test parameters in default values - type FOk<T> = Self::E<'static, T>; - //~^ ERROR type arguments are not allowed for this type [E0109] - //~| ERROR lifetime arguments are not allowed for this type [E0109] - type FErr1 = Self::E<'static, 'static>; // Error - //~^ ERROR lifetime arguments are not allowed for this type [E0109] - type FErr2<T> = Self::E<'static, T, u32>; // Error - //~^ ERROR type arguments are not allowed for this type [E0109] - //~| ERROR lifetime arguments are not allowed for this type [E0109] -} - -struct Fooy; - -impl Foo for Fooy { - type A = u32; // Error: parameter expected - type B<'a, T> = Vec<T>; // Error: lifetime param expected - type C<'a> = u32; // Error: no param expected - type D<'a> = u32; // Error: type param expected - type E<T, U> = u32; // Error: lifetime expected as the first param -} - -struct Fooer; - -impl Foo for Fooer { - type A<T> = u32; // Error: lifetime parameter expected - type B<'a> = u32; // Error: another lifetime param expected - type C<T> = T; // Error: no param expected - type D<'b, T> = u32; // Error: unexpected lifetime param - type E<'a, 'b> = u32; // Error: type expected as the second param -} - -fn main() {} diff --git a/src/test/ui/rfc1598-generic-associated-types/parameter_number_and_kind.stderr b/src/test/ui/rfc1598-generic-associated-types/parameter_number_and_kind.stderr deleted file mode 100644 index 65dbd00c5b1..00000000000 --- a/src/test/ui/rfc1598-generic-associated-types/parameter_number_and_kind.stderr +++ /dev/null @@ -1,41 +0,0 @@ -warning: the feature `generic_associated_types` is incomplete and may cause the compiler to crash - --> $DIR/parameter_number_and_kind.rs:1:12 - | -LL | #![feature(generic_associated_types)] - | ^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - -error[E0109]: lifetime arguments are not allowed for this type - --> $DIR/parameter_number_and_kind.rs:17:27 - | -LL | type FOk<T> = Self::E<'static, T>; - | ^^^^^^^ lifetime argument not allowed - -error[E0109]: type arguments are not allowed for this type - --> $DIR/parameter_number_and_kind.rs:17:36 - | -LL | type FOk<T> = Self::E<'static, T>; - | ^ type argument not allowed - -error[E0109]: lifetime arguments are not allowed for this type - --> $DIR/parameter_number_and_kind.rs:20:26 - | -LL | type FErr1 = Self::E<'static, 'static>; // Error - | ^^^^^^^ lifetime argument not allowed - -error[E0109]: lifetime arguments are not allowed for this type - --> $DIR/parameter_number_and_kind.rs:22:29 - | -LL | type FErr2<T> = Self::E<'static, T, u32>; // Error - | ^^^^^^^ lifetime argument not allowed - -error[E0109]: type arguments are not allowed for this type - --> $DIR/parameter_number_and_kind.rs:22:38 - | -LL | type FErr2<T> = Self::E<'static, T, u32>; // Error - | ^ type argument not allowed - -error: aborting due to 5 previous errors - -For more information about this error, try `rustc --explain E0109`. diff --git a/src/test/ui/rfc1598-generic-associated-types/pointer_family.stderr b/src/test/ui/rfc1598-generic-associated-types/pointer_family.stderr deleted file mode 100644 index 626495350a7..00000000000 --- a/src/test/ui/rfc1598-generic-associated-types/pointer_family.stderr +++ /dev/null @@ -1,35 +0,0 @@ -warning: the feature `generic_associated_types` is incomplete and may cause the compiler to crash - --> $DIR/pointer_family.rs:1:12 - | -LL | #![feature(generic_associated_types)] - | ^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - -error[E0109]: type arguments are not allowed for this type - --> $DIR/pointer_family.rs:37:21 - | -LL | bar: P::Pointer<String>, - | ^^^^^^ type argument not allowed - -error[E0109]: type arguments are not allowed for this type - --> $DIR/pointer_family.rs:12:42 - | -LL | fn new<T>(value: T) -> Self::Pointer<T>; - | ^ type argument not allowed - -error[E0109]: type arguments are not allowed for this type - --> $DIR/pointer_family.rs:20:42 - | -LL | fn new<T>(value: T) -> Self::Pointer<T> { - | ^ type argument not allowed - -error[E0109]: type arguments are not allowed for this type - --> $DIR/pointer_family.rs:30:42 - | -LL | fn new<T>(value: T) -> Self::Pointer<T> { - | ^ type argument not allowed - -error: aborting due to 4 previous errors - -For more information about this error, try `rustc --explain E0109`. diff --git a/src/test/ui/rfc1598-generic-associated-types/streaming_iterator.stderr b/src/test/ui/rfc1598-generic-associated-types/streaming_iterator.stderr deleted file mode 100644 index 09dd654b575..00000000000 --- a/src/test/ui/rfc1598-generic-associated-types/streaming_iterator.stderr +++ /dev/null @@ -1,41 +0,0 @@ -warning: the feature `generic_associated_types` is incomplete and may cause the compiler to crash - --> $DIR/streaming_iterator.rs:1:12 - | -LL | #![feature(generic_associated_types)] - | ^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - -error[E0109]: lifetime arguments are not allowed for this type - --> $DIR/streaming_iterator.rs:18:41 - | -LL | bar: <T as StreamingIterator>::Item<'static>, - | ^^^^^^^ lifetime argument not allowed - -error[E0109]: lifetime arguments are not allowed for this type - --> $DIR/streaming_iterator.rs:26:64 - | -LL | fn foo<T>(iter: T) where T: StreamingIterator, for<'a> T::Item<'a>: Display { /* ... */ } - | ^^ lifetime argument not allowed - -error[E0109]: lifetime arguments are not allowed for this type - --> $DIR/streaming_iterator.rs:12:48 - | -LL | fn next<'a>(&'a self) -> Option<Self::Item<'a>>; - | ^^ lifetime argument not allowed - -error[E0109]: lifetime arguments are not allowed for this type - --> $DIR/streaming_iterator.rs:38:37 - | -LL | type Item<'a> = (usize, I::Item<'a>); - | ^^ lifetime argument not allowed - -error[E0109]: lifetime arguments are not allowed for this type - --> $DIR/streaming_iterator.rs:40:48 - | -LL | fn next<'a>(&'a self) -> Option<Self::Item<'a>> { - | ^^ lifetime argument not allowed - -error: aborting due to 5 previous errors - -For more information about this error, try `rustc --explain E0109`. diff --git a/src/test/ui/rmeta_lib.rs b/src/test/ui/rmeta_lib.rs index 6c74aec32e3..fa6826450c9 100644 --- a/src/test/ui/rmeta_lib.rs +++ b/src/test/ui/rmeta_lib.rs @@ -1,3 +1,4 @@ +// build-fail // aux-build:rmeta-meta.rs // no-prefer-dynamic // error-pattern: crate `rmeta_meta` required to be available in rlib format, but was not found diff --git a/src/test/ui/simd-intrinsic/simd-intrinsic-generic-arithmetic-saturating.rs b/src/test/ui/simd-intrinsic/simd-intrinsic-generic-arithmetic-saturating.rs index 65cf31f2f1f..4d23a1911a3 100644 --- a/src/test/ui/simd-intrinsic/simd-intrinsic-generic-arithmetic-saturating.rs +++ b/src/test/ui/simd-intrinsic/simd-intrinsic-generic-arithmetic-saturating.rs @@ -1,3 +1,4 @@ +// build-fail // ignore-emscripten // ignore-tidy-linelength #![feature(repr_simd, platform_intrinsics)] diff --git a/src/test/ui/simd-intrinsic/simd-intrinsic-generic-arithmetic-saturating.stderr b/src/test/ui/simd-intrinsic/simd-intrinsic-generic-arithmetic-saturating.stderr index 0e88540bcc8..1ed472a485d 100644 --- a/src/test/ui/simd-intrinsic/simd-intrinsic-generic-arithmetic-saturating.stderr +++ b/src/test/ui/simd-intrinsic/simd-intrinsic-generic-arithmetic-saturating.stderr @@ -1,11 +1,11 @@ error[E0511]: invalid monomorphization of `simd_saturating_add` intrinsic: expected element type `f32` of vector type `f32x4` to be a signed or unsigned integer type - --> $DIR/simd-intrinsic-generic-arithmetic-saturating.rs:33:9 + --> $DIR/simd-intrinsic-generic-arithmetic-saturating.rs:34:9 | LL | simd_saturating_add(z, z); | ^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_saturating_sub` intrinsic: expected element type `f32` of vector type `f32x4` to be a signed or unsigned integer type - --> $DIR/simd-intrinsic-generic-arithmetic-saturating.rs:35:9 + --> $DIR/simd-intrinsic-generic-arithmetic-saturating.rs:36:9 | LL | simd_saturating_sub(z, z); | ^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/simd-intrinsic/simd-intrinsic-generic-arithmetic.rs b/src/test/ui/simd-intrinsic/simd-intrinsic-generic-arithmetic.rs index 7686b389a71..f95f548fee8 100644 --- a/src/test/ui/simd-intrinsic/simd-intrinsic-generic-arithmetic.rs +++ b/src/test/ui/simd-intrinsic/simd-intrinsic-generic-arithmetic.rs @@ -1,3 +1,5 @@ +// build-fail + #![feature(repr_simd, platform_intrinsics)] #![allow(non_camel_case_types)] #[repr(simd)] diff --git a/src/test/ui/simd-intrinsic/simd-intrinsic-generic-arithmetic.stderr b/src/test/ui/simd-intrinsic/simd-intrinsic-generic-arithmetic.stderr index 27493950af0..70cdc34684d 100644 --- a/src/test/ui/simd-intrinsic/simd-intrinsic-generic-arithmetic.stderr +++ b/src/test/ui/simd-intrinsic/simd-intrinsic-generic-arithmetic.stderr @@ -1,83 +1,83 @@ error[E0511]: invalid monomorphization of `simd_add` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/simd-intrinsic-generic-arithmetic.rs:62:9 + --> $DIR/simd-intrinsic-generic-arithmetic.rs:64:9 | LL | simd_add(0, 0); | ^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_sub` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/simd-intrinsic-generic-arithmetic.rs:64:9 + --> $DIR/simd-intrinsic-generic-arithmetic.rs:66:9 | LL | simd_sub(0, 0); | ^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_mul` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/simd-intrinsic-generic-arithmetic.rs:66:9 + --> $DIR/simd-intrinsic-generic-arithmetic.rs:68:9 | LL | simd_mul(0, 0); | ^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_div` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/simd-intrinsic-generic-arithmetic.rs:68:9 + --> $DIR/simd-intrinsic-generic-arithmetic.rs:70:9 | LL | simd_div(0, 0); | ^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_shl` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/simd-intrinsic-generic-arithmetic.rs:70:9 + --> $DIR/simd-intrinsic-generic-arithmetic.rs:72:9 | LL | simd_shl(0, 0); | ^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_shr` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/simd-intrinsic-generic-arithmetic.rs:72:9 + --> $DIR/simd-intrinsic-generic-arithmetic.rs:74:9 | LL | simd_shr(0, 0); | ^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_and` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/simd-intrinsic-generic-arithmetic.rs:74:9 + --> $DIR/simd-intrinsic-generic-arithmetic.rs:76:9 | LL | simd_and(0, 0); | ^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_or` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/simd-intrinsic-generic-arithmetic.rs:76:9 + --> $DIR/simd-intrinsic-generic-arithmetic.rs:78:9 | LL | simd_or(0, 0); | ^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_xor` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/simd-intrinsic-generic-arithmetic.rs:78:9 + --> $DIR/simd-intrinsic-generic-arithmetic.rs:80:9 | LL | simd_xor(0, 0); | ^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_shl` intrinsic: unsupported operation on `f32x4` with element `f32` - --> $DIR/simd-intrinsic-generic-arithmetic.rs:82:9 + --> $DIR/simd-intrinsic-generic-arithmetic.rs:84:9 | LL | simd_shl(z, z); | ^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_shr` intrinsic: unsupported operation on `f32x4` with element `f32` - --> $DIR/simd-intrinsic-generic-arithmetic.rs:84:9 + --> $DIR/simd-intrinsic-generic-arithmetic.rs:86:9 | LL | simd_shr(z, z); | ^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_and` intrinsic: unsupported operation on `f32x4` with element `f32` - --> $DIR/simd-intrinsic-generic-arithmetic.rs:86:9 + --> $DIR/simd-intrinsic-generic-arithmetic.rs:88:9 | LL | simd_and(z, z); | ^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_or` intrinsic: unsupported operation on `f32x4` with element `f32` - --> $DIR/simd-intrinsic-generic-arithmetic.rs:88:9 + --> $DIR/simd-intrinsic-generic-arithmetic.rs:90:9 | LL | simd_or(z, z); | ^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_xor` intrinsic: unsupported operation on `f32x4` with element `f32` - --> $DIR/simd-intrinsic-generic-arithmetic.rs:90:9 + --> $DIR/simd-intrinsic-generic-arithmetic.rs:92:9 | LL | simd_xor(z, z); | ^^^^^^^^^^^^^^ diff --git a/src/test/ui/simd-intrinsic/simd-intrinsic-generic-bitmask.rs b/src/test/ui/simd-intrinsic/simd-intrinsic-generic-bitmask.rs index 931ee9db1fe..ed267d8411a 100644 --- a/src/test/ui/simd-intrinsic/simd-intrinsic-generic-bitmask.rs +++ b/src/test/ui/simd-intrinsic/simd-intrinsic-generic-bitmask.rs @@ -1,3 +1,5 @@ +// build-fail + // Test that the simd_bitmask intrinsic produces ok-ish error // messages when misused. diff --git a/src/test/ui/simd-intrinsic/simd-intrinsic-generic-bitmask.stderr b/src/test/ui/simd-intrinsic/simd-intrinsic-generic-bitmask.stderr index d016838d098..8cb235b778b 100644 --- a/src/test/ui/simd-intrinsic/simd-intrinsic-generic-bitmask.stderr +++ b/src/test/ui/simd-intrinsic/simd-intrinsic-generic-bitmask.stderr @@ -1,29 +1,29 @@ error[E0511]: invalid monomorphization of `simd_bitmask` intrinsic: bitmask `u16`, expected `u8` - --> $DIR/simd-intrinsic-generic-bitmask.rs:74:22 + --> $DIR/simd-intrinsic-generic-bitmask.rs:76:22 | LL | let _: u16 = simd_bitmask(m2); | ^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_bitmask` intrinsic: bitmask `u16`, expected `u8` - --> $DIR/simd-intrinsic-generic-bitmask.rs:77:22 + --> $DIR/simd-intrinsic-generic-bitmask.rs:79:22 | LL | let _: u16 = simd_bitmask(m8); | ^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_bitmask` intrinsic: bitmask `u32`, expected `u16` - --> $DIR/simd-intrinsic-generic-bitmask.rs:80:22 + --> $DIR/simd-intrinsic-generic-bitmask.rs:82:22 | LL | let _: u32 = simd_bitmask(m16); | ^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_bitmask` intrinsic: bitmask `u64`, expected `u32` - --> $DIR/simd-intrinsic-generic-bitmask.rs:83:22 + --> $DIR/simd-intrinsic-generic-bitmask.rs:85:22 | LL | let _: u64 = simd_bitmask(m32); | ^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_bitmask` intrinsic: bitmask `u128`, expected `u64` - --> $DIR/simd-intrinsic-generic-bitmask.rs:86:23 + --> $DIR/simd-intrinsic-generic-bitmask.rs:88:23 | LL | let _: u128 = simd_bitmask(m64); | ^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/simd-intrinsic/simd-intrinsic-generic-cast.rs b/src/test/ui/simd-intrinsic/simd-intrinsic-generic-cast.rs index c4016e75b14..4f4fa06b002 100644 --- a/src/test/ui/simd-intrinsic/simd-intrinsic-generic-cast.rs +++ b/src/test/ui/simd-intrinsic/simd-intrinsic-generic-cast.rs @@ -1,3 +1,5 @@ +// build-fail + #![feature(repr_simd, platform_intrinsics)] #[repr(simd)] diff --git a/src/test/ui/simd-intrinsic/simd-intrinsic-generic-cast.stderr b/src/test/ui/simd-intrinsic/simd-intrinsic-generic-cast.stderr index 6e33e3b30f5..d794a742b4d 100644 --- a/src/test/ui/simd-intrinsic/simd-intrinsic-generic-cast.stderr +++ b/src/test/ui/simd-intrinsic/simd-intrinsic-generic-cast.stderr @@ -1,23 +1,23 @@ error[E0511]: invalid monomorphization of `simd_cast` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/simd-intrinsic-generic-cast.rs:32:9 + --> $DIR/simd-intrinsic-generic-cast.rs:34:9 | LL | simd_cast::<i32, i32>(0); | ^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_cast` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/simd-intrinsic-generic-cast.rs:34:9 + --> $DIR/simd-intrinsic-generic-cast.rs:36:9 | LL | simd_cast::<i32, i32x4>(0); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_cast` intrinsic: expected SIMD return type, found non-SIMD `i32` - --> $DIR/simd-intrinsic-generic-cast.rs:36:9 + --> $DIR/simd-intrinsic-generic-cast.rs:38:9 | LL | simd_cast::<i32x4, i32>(x); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_cast` intrinsic: expected return type with length 4 (same as input type `i32x4`), found `i32x8` with length 8 - --> $DIR/simd-intrinsic-generic-cast.rs:38:9 + --> $DIR/simd-intrinsic-generic-cast.rs:40:9 | LL | simd_cast::<_, i32x8>(x); | ^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/simd-intrinsic/simd-intrinsic-generic-comparison.rs b/src/test/ui/simd-intrinsic/simd-intrinsic-generic-comparison.rs index 3ac47d17dad..3cd38042f0f 100644 --- a/src/test/ui/simd-intrinsic/simd-intrinsic-generic-comparison.rs +++ b/src/test/ui/simd-intrinsic/simd-intrinsic-generic-comparison.rs @@ -1,3 +1,5 @@ +// build-fail + #![feature(repr_simd, platform_intrinsics)] #[repr(simd)] diff --git a/src/test/ui/simd-intrinsic/simd-intrinsic-generic-comparison.stderr b/src/test/ui/simd-intrinsic/simd-intrinsic-generic-comparison.stderr index d8da2e5ee57..36c6b934d58 100644 --- a/src/test/ui/simd-intrinsic/simd-intrinsic-generic-comparison.stderr +++ b/src/test/ui/simd-intrinsic/simd-intrinsic-generic-comparison.stderr @@ -1,107 +1,107 @@ error[E0511]: invalid monomorphization of `simd_eq` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/simd-intrinsic-generic-comparison.rs:26:9 + --> $DIR/simd-intrinsic-generic-comparison.rs:28:9 | LL | simd_eq::<i32, i32>(0, 0); | ^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_ne` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/simd-intrinsic-generic-comparison.rs:28:9 + --> $DIR/simd-intrinsic-generic-comparison.rs:30:9 | LL | simd_ne::<i32, i32>(0, 0); | ^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_lt` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/simd-intrinsic-generic-comparison.rs:30:9 + --> $DIR/simd-intrinsic-generic-comparison.rs:32:9 | LL | simd_lt::<i32, i32>(0, 0); | ^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_le` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/simd-intrinsic-generic-comparison.rs:32:9 + --> $DIR/simd-intrinsic-generic-comparison.rs:34:9 | LL | simd_le::<i32, i32>(0, 0); | ^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_gt` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/simd-intrinsic-generic-comparison.rs:34:9 + --> $DIR/simd-intrinsic-generic-comparison.rs:36:9 | LL | simd_gt::<i32, i32>(0, 0); | ^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_ge` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/simd-intrinsic-generic-comparison.rs:36:9 + --> $DIR/simd-intrinsic-generic-comparison.rs:38:9 | LL | simd_ge::<i32, i32>(0, 0); | ^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_eq` intrinsic: expected SIMD return type, found non-SIMD `i32` - --> $DIR/simd-intrinsic-generic-comparison.rs:39:9 + --> $DIR/simd-intrinsic-generic-comparison.rs:41:9 | LL | simd_eq::<_, i32>(x, x); | ^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_ne` intrinsic: expected SIMD return type, found non-SIMD `i32` - --> $DIR/simd-intrinsic-generic-comparison.rs:41:9 + --> $DIR/simd-intrinsic-generic-comparison.rs:43:9 | LL | simd_ne::<_, i32>(x, x); | ^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_lt` intrinsic: expected SIMD return type, found non-SIMD `i32` - --> $DIR/simd-intrinsic-generic-comparison.rs:43:9 + --> $DIR/simd-intrinsic-generic-comparison.rs:45:9 | LL | simd_lt::<_, i32>(x, x); | ^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_le` intrinsic: expected SIMD return type, found non-SIMD `i32` - --> $DIR/simd-intrinsic-generic-comparison.rs:45:9 + --> $DIR/simd-intrinsic-generic-comparison.rs:47:9 | LL | simd_le::<_, i32>(x, x); | ^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_gt` intrinsic: expected SIMD return type, found non-SIMD `i32` - --> $DIR/simd-intrinsic-generic-comparison.rs:47:9 + --> $DIR/simd-intrinsic-generic-comparison.rs:49:9 | LL | simd_gt::<_, i32>(x, x); | ^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_ge` intrinsic: expected SIMD return type, found non-SIMD `i32` - --> $DIR/simd-intrinsic-generic-comparison.rs:49:9 + --> $DIR/simd-intrinsic-generic-comparison.rs:51:9 | LL | simd_ge::<_, i32>(x, x); | ^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_eq` intrinsic: expected return type with length 4 (same as input type `i32x4`), found `i16x8` with length 8 - --> $DIR/simd-intrinsic-generic-comparison.rs:52:9 + --> $DIR/simd-intrinsic-generic-comparison.rs:54:9 | LL | simd_eq::<_, i16x8>(x, x); | ^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_ne` intrinsic: expected return type with length 4 (same as input type `i32x4`), found `i16x8` with length 8 - --> $DIR/simd-intrinsic-generic-comparison.rs:54:9 + --> $DIR/simd-intrinsic-generic-comparison.rs:56:9 | LL | simd_ne::<_, i16x8>(x, x); | ^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_lt` intrinsic: expected return type with length 4 (same as input type `i32x4`), found `i16x8` with length 8 - --> $DIR/simd-intrinsic-generic-comparison.rs:56:9 + --> $DIR/simd-intrinsic-generic-comparison.rs:58:9 | LL | simd_lt::<_, i16x8>(x, x); | ^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_le` intrinsic: expected return type with length 4 (same as input type `i32x4`), found `i16x8` with length 8 - --> $DIR/simd-intrinsic-generic-comparison.rs:58:9 + --> $DIR/simd-intrinsic-generic-comparison.rs:60:9 | LL | simd_le::<_, i16x8>(x, x); | ^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_gt` intrinsic: expected return type with length 4 (same as input type `i32x4`), found `i16x8` with length 8 - --> $DIR/simd-intrinsic-generic-comparison.rs:60:9 + --> $DIR/simd-intrinsic-generic-comparison.rs:62:9 | LL | simd_gt::<_, i16x8>(x, x); | ^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_ge` intrinsic: expected return type with length 4 (same as input type `i32x4`), found `i16x8` with length 8 - --> $DIR/simd-intrinsic-generic-comparison.rs:62:9 + --> $DIR/simd-intrinsic-generic-comparison.rs:64:9 | LL | simd_ge::<_, i16x8>(x, x); | ^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/simd-intrinsic/simd-intrinsic-generic-elements.rs b/src/test/ui/simd-intrinsic/simd-intrinsic-generic-elements.rs index 28fcb6c57ec..5929d05f4de 100644 --- a/src/test/ui/simd-intrinsic/simd-intrinsic-generic-elements.rs +++ b/src/test/ui/simd-intrinsic/simd-intrinsic-generic-elements.rs @@ -1,3 +1,5 @@ +// build-fail + #![feature(repr_simd, platform_intrinsics, rustc_attrs)] #[repr(simd)] diff --git a/src/test/ui/simd-intrinsic/simd-intrinsic-generic-elements.stderr b/src/test/ui/simd-intrinsic/simd-intrinsic-generic-elements.stderr index 2f8ffb6035e..78022c0c8bd 100644 --- a/src/test/ui/simd-intrinsic/simd-intrinsic-generic-elements.stderr +++ b/src/test/ui/simd-intrinsic/simd-intrinsic-generic-elements.stderr @@ -1,89 +1,89 @@ error[E0511]: invalid monomorphization of `simd_insert` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/simd-intrinsic-generic-elements.rs:53:9 + --> $DIR/simd-intrinsic-generic-elements.rs:55:9 | LL | simd_insert(0, 0, 0); | ^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_insert` intrinsic: expected inserted type `i32` (element of input `i32x4`), found `f64` - --> $DIR/simd-intrinsic-generic-elements.rs:55:9 + --> $DIR/simd-intrinsic-generic-elements.rs:57:9 | LL | simd_insert(x, 0, 1.0); | ^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_extract` intrinsic: expected return type `i32` (element of input `i32x4`), found `f32` - --> $DIR/simd-intrinsic-generic-elements.rs:57:9 + --> $DIR/simd-intrinsic-generic-elements.rs:59:9 | LL | simd_extract::<_, f32>(x, 0); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_shuffle2` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/simd-intrinsic-generic-elements.rs:60:9 + --> $DIR/simd-intrinsic-generic-elements.rs:62:9 | LL | simd_shuffle2::<i32, i32>(0, 0, [0; 2]); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_shuffle3` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/simd-intrinsic-generic-elements.rs:62:9 + --> $DIR/simd-intrinsic-generic-elements.rs:64:9 | LL | simd_shuffle3::<i32, i32>(0, 0, [0; 3]); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_shuffle4` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/simd-intrinsic-generic-elements.rs:64:9 + --> $DIR/simd-intrinsic-generic-elements.rs:66:9 | LL | simd_shuffle4::<i32, i32>(0, 0, [0; 4]); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_shuffle8` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/simd-intrinsic-generic-elements.rs:66:9 + --> $DIR/simd-intrinsic-generic-elements.rs:68:9 | LL | simd_shuffle8::<i32, i32>(0, 0, [0; 8]); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_shuffle2` intrinsic: expected return element type `i32` (element of input `i32x4`), found `f32x2` with element type `f32` - --> $DIR/simd-intrinsic-generic-elements.rs:69:9 + --> $DIR/simd-intrinsic-generic-elements.rs:71:9 | LL | simd_shuffle2::<_, f32x2>(x, x, [0; 2]); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_shuffle3` intrinsic: expected return element type `i32` (element of input `i32x4`), found `f32x3` with element type `f32` - --> $DIR/simd-intrinsic-generic-elements.rs:71:9 + --> $DIR/simd-intrinsic-generic-elements.rs:73:9 | LL | simd_shuffle3::<_, f32x3>(x, x, [0; 3]); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_shuffle4` intrinsic: expected return element type `i32` (element of input `i32x4`), found `f32x4` with element type `f32` - --> $DIR/simd-intrinsic-generic-elements.rs:73:9 + --> $DIR/simd-intrinsic-generic-elements.rs:75:9 | LL | simd_shuffle4::<_, f32x4>(x, x, [0; 4]); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_shuffle8` intrinsic: expected return element type `i32` (element of input `i32x4`), found `f32x8` with element type `f32` - --> $DIR/simd-intrinsic-generic-elements.rs:75:9 + --> $DIR/simd-intrinsic-generic-elements.rs:77:9 | LL | simd_shuffle8::<_, f32x8>(x, x, [0; 8]); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_shuffle2` intrinsic: expected return type of length 2, found `i32x8` with length 8 - --> $DIR/simd-intrinsic-generic-elements.rs:78:9 + --> $DIR/simd-intrinsic-generic-elements.rs:80:9 | LL | simd_shuffle2::<_, i32x8>(x, x, [0; 2]); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_shuffle3` intrinsic: expected return type of length 3, found `i32x4` with length 4 - --> $DIR/simd-intrinsic-generic-elements.rs:80:9 + --> $DIR/simd-intrinsic-generic-elements.rs:82:9 | LL | simd_shuffle3::<_, i32x4>(x, x, [0; 3]); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_shuffle4` intrinsic: expected return type of length 4, found `i32x3` with length 3 - --> $DIR/simd-intrinsic-generic-elements.rs:82:9 + --> $DIR/simd-intrinsic-generic-elements.rs:84:9 | LL | simd_shuffle4::<_, i32x3>(x, x, [0; 4]); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_shuffle8` intrinsic: expected return type of length 8, found `i32x2` with length 2 - --> $DIR/simd-intrinsic-generic-elements.rs:84:9 + --> $DIR/simd-intrinsic-generic-elements.rs:86:9 | LL | simd_shuffle8::<_, i32x2>(x, x, [0; 8]); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/simd-intrinsic/simd-intrinsic-generic-reduction.rs b/src/test/ui/simd-intrinsic/simd-intrinsic-generic-reduction.rs index 9a6dbe9d9ab..ede4b26d19c 100644 --- a/src/test/ui/simd-intrinsic/simd-intrinsic-generic-reduction.rs +++ b/src/test/ui/simd-intrinsic/simd-intrinsic-generic-reduction.rs @@ -1,3 +1,4 @@ +// build-fail // ignore-emscripten // Test that the simd_reduce_{op} intrinsics produce ok-ish error diff --git a/src/test/ui/simd-intrinsic/simd-intrinsic-generic-reduction.stderr b/src/test/ui/simd-intrinsic/simd-intrinsic-generic-reduction.stderr index 5f2a67dc14e..91a62f6a1c6 100644 --- a/src/test/ui/simd-intrinsic/simd-intrinsic-generic-reduction.stderr +++ b/src/test/ui/simd-intrinsic/simd-intrinsic-generic-reduction.stderr @@ -1,59 +1,59 @@ error[E0511]: invalid monomorphization of `simd_reduce_add_ordered` intrinsic: expected return type `f32` (element of input `f32x4`), found `i32` - --> $DIR/simd-intrinsic-generic-reduction.rs:33:9 + --> $DIR/simd-intrinsic-generic-reduction.rs:34:9 | LL | simd_reduce_add_ordered(z, 0); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_reduce_mul_ordered` intrinsic: expected return type `f32` (element of input `f32x4`), found `i32` - --> $DIR/simd-intrinsic-generic-reduction.rs:35:9 + --> $DIR/simd-intrinsic-generic-reduction.rs:36:9 | LL | simd_reduce_mul_ordered(z, 1); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_reduce_and` intrinsic: expected return type `u32` (element of input `u32x4`), found `f32` - --> $DIR/simd-intrinsic-generic-reduction.rs:38:22 + --> $DIR/simd-intrinsic-generic-reduction.rs:39:22 | LL | let _: f32 = simd_reduce_and(x); | ^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_reduce_or` intrinsic: expected return type `u32` (element of input `u32x4`), found `f32` - --> $DIR/simd-intrinsic-generic-reduction.rs:40:22 + --> $DIR/simd-intrinsic-generic-reduction.rs:41:22 | LL | let _: f32 = simd_reduce_or(x); | ^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_reduce_xor` intrinsic: expected return type `u32` (element of input `u32x4`), found `f32` - --> $DIR/simd-intrinsic-generic-reduction.rs:42:22 + --> $DIR/simd-intrinsic-generic-reduction.rs:43:22 | LL | let _: f32 = simd_reduce_xor(x); | ^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_reduce_and` intrinsic: unsupported simd_reduce_and from `f32x4` with element `f32` to `f32` - --> $DIR/simd-intrinsic-generic-reduction.rs:45:22 + --> $DIR/simd-intrinsic-generic-reduction.rs:46:22 | LL | let _: f32 = simd_reduce_and(z); | ^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_reduce_or` intrinsic: unsupported simd_reduce_or from `f32x4` with element `f32` to `f32` - --> $DIR/simd-intrinsic-generic-reduction.rs:47:22 + --> $DIR/simd-intrinsic-generic-reduction.rs:48:22 | LL | let _: f32 = simd_reduce_or(z); | ^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_reduce_xor` intrinsic: unsupported simd_reduce_xor from `f32x4` with element `f32` to `f32` - --> $DIR/simd-intrinsic-generic-reduction.rs:49:22 + --> $DIR/simd-intrinsic-generic-reduction.rs:50:22 | LL | let _: f32 = simd_reduce_xor(z); | ^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_reduce_all` intrinsic: unsupported simd_reduce_all from `f32x4` with element `f32` to `bool` - --> $DIR/simd-intrinsic-generic-reduction.rs:52:23 + --> $DIR/simd-intrinsic-generic-reduction.rs:53:23 | LL | let _: bool = simd_reduce_all(z); | ^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_reduce_any` intrinsic: unsupported simd_reduce_any from `f32x4` with element `f32` to `bool` - --> $DIR/simd-intrinsic-generic-reduction.rs:54:23 + --> $DIR/simd-intrinsic-generic-reduction.rs:55:23 | LL | let _: bool = simd_reduce_any(z); | ^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/simd-intrinsic/simd-intrinsic-generic-select.rs b/src/test/ui/simd-intrinsic/simd-intrinsic-generic-select.rs index 72f51a895b6..a719b314150 100644 --- a/src/test/ui/simd-intrinsic/simd-intrinsic-generic-select.rs +++ b/src/test/ui/simd-intrinsic/simd-intrinsic-generic-select.rs @@ -1,3 +1,5 @@ +// build-fail + // Test that the simd_select intrinsic produces ok-ish error // messages when misused. diff --git a/src/test/ui/simd-intrinsic/simd-intrinsic-generic-select.stderr b/src/test/ui/simd-intrinsic/simd-intrinsic-generic-select.stderr index a46352c7308..f68c969d13e 100644 --- a/src/test/ui/simd-intrinsic/simd-intrinsic-generic-select.stderr +++ b/src/test/ui/simd-intrinsic/simd-intrinsic-generic-select.stderr @@ -1,47 +1,47 @@ error[E0511]: invalid monomorphization of `simd_select` intrinsic: mismatched lengths: mask length `8` != other vector length `4` - --> $DIR/simd-intrinsic-generic-select.rs:38:9 + --> $DIR/simd-intrinsic-generic-select.rs:40:9 | LL | simd_select(m8, x, x); | ^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_select` intrinsic: mask element type is `u32`, expected `i_` - --> $DIR/simd-intrinsic-generic-select.rs:41:9 + --> $DIR/simd-intrinsic-generic-select.rs:43:9 | LL | simd_select(x, x, x); | ^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_select` intrinsic: mask element type is `f32`, expected `i_` - --> $DIR/simd-intrinsic-generic-select.rs:44:9 + --> $DIR/simd-intrinsic-generic-select.rs:46:9 | LL | simd_select(z, z, z); | ^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_select` intrinsic: expected SIMD argument type, found non-SIMD `u32` - --> $DIR/simd-intrinsic-generic-select.rs:47:9 + --> $DIR/simd-intrinsic-generic-select.rs:49:9 | LL | simd_select(m4, 0u32, 1u32); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_select_bitmask` intrinsic: mismatched lengths: mask length `8` != other vector length `4` - --> $DIR/simd-intrinsic-generic-select.rs:50:9 + --> $DIR/simd-intrinsic-generic-select.rs:52:9 | LL | simd_select_bitmask(0u8, x, x); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_select_bitmask` intrinsic: expected SIMD argument type, found non-SIMD `u32` - --> $DIR/simd-intrinsic-generic-select.rs:53:9 + --> $DIR/simd-intrinsic-generic-select.rs:55:9 | LL | simd_select_bitmask(0u8, 1u32, 2u32); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_select_bitmask` intrinsic: `f32` is not an integral type - --> $DIR/simd-intrinsic-generic-select.rs:56:9 + --> $DIR/simd-intrinsic-generic-select.rs:58:9 | LL | simd_select_bitmask(0.0f32, x, x); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_select_bitmask` intrinsic: `&str` is not an integral type - --> $DIR/simd-intrinsic-generic-select.rs:59:9 + --> $DIR/simd-intrinsic-generic-select.rs:61:9 | LL | simd_select_bitmask("x", x, x); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/simd-type-generic-monomorphisation.rs b/src/test/ui/simd-type-generic-monomorphisation.rs index 68eb78759eb..fc5e23f4986 100644 --- a/src/test/ui/simd-type-generic-monomorphisation.rs +++ b/src/test/ui/simd-type-generic-monomorphisation.rs @@ -1,3 +1,5 @@ +// build-fail + #![feature(repr_simd, platform_intrinsics)] // error-pattern:monomorphising SIMD type `Simd2<X>` with a non-machine element type `X` diff --git a/src/test/ui/structs/struct-path-associated-type.rs b/src/test/ui/structs/struct-path-associated-type.rs index 15b37facc50..e44a203b783 100644 --- a/src/test/ui/structs/struct-path-associated-type.rs +++ b/src/test/ui/structs/struct-path-associated-type.rs @@ -31,7 +31,6 @@ fn g<T: Tr<A = S>>() { fn main() { let s = S::A {}; //~ ERROR ambiguous associated type let z = S::A::<u8> {}; //~ ERROR ambiguous associated type - //~^ ERROR type arguments are not allowed for this type match S { S::A {} => {} //~ ERROR ambiguous associated type } diff --git a/src/test/ui/structs/struct-path-associated-type.stderr b/src/test/ui/structs/struct-path-associated-type.stderr index 7cfbd7b720b..f8a2c7c6b6c 100644 --- a/src/test/ui/structs/struct-path-associated-type.stderr +++ b/src/test/ui/structs/struct-path-associated-type.stderr @@ -34,12 +34,6 @@ error[E0223]: ambiguous associated type LL | let s = S::A {}; | ^^^^ help: use fully-qualified syntax: `<S as Trait>::A` -error[E0109]: type arguments are not allowed for this type - --> $DIR/struct-path-associated-type.rs:33:20 - | -LL | let z = S::A::<u8> {}; - | ^^ type argument not allowed - error[E0223]: ambiguous associated type --> $DIR/struct-path-associated-type.rs:33:13 | @@ -47,12 +41,12 @@ LL | let z = S::A::<u8> {}; | ^^^^^^^^^^ help: use fully-qualified syntax: `<S as Trait>::A` error[E0223]: ambiguous associated type - --> $DIR/struct-path-associated-type.rs:36:9 + --> $DIR/struct-path-associated-type.rs:35:9 | LL | S::A {} => {} | ^^^^ help: use fully-qualified syntax: `<S as Trait>::A` -error: aborting due to 9 previous errors +error: aborting due to 8 previous errors Some errors have detailed explanations: E0071, E0109, E0223. For more information about an error, try `rustc --explain E0071`. diff --git a/src/test/ui/suggestions/let-binding-init-expr-as-ty.rs b/src/test/ui/suggestions/let-binding-init-expr-as-ty.rs index 94c72a31e5e..06ee421fc32 100644 --- a/src/test/ui/suggestions/let-binding-init-expr-as-ty.rs +++ b/src/test/ui/suggestions/let-binding-init-expr-as-ty.rs @@ -1,7 +1,6 @@ pub fn foo(num: i32) -> i32 { let foo: i32::from_be(num); //~^ ERROR expected type, found local variable `num` - //~| ERROR type arguments are not allowed for this type //~| ERROR parenthesized type parameters may only be used with a `Fn` trait //~| ERROR ambiguous associated type foo diff --git a/src/test/ui/suggestions/let-binding-init-expr-as-ty.stderr b/src/test/ui/suggestions/let-binding-init-expr-as-ty.stderr index 5353b3a75b2..63ba7893f04 100644 --- a/src/test/ui/suggestions/let-binding-init-expr-as-ty.stderr +++ b/src/test/ui/suggestions/let-binding-init-expr-as-ty.stderr @@ -15,19 +15,13 @@ LL | let foo: i32::from_be(num); | only `Fn` traits may use parentheses | help: use angle brackets instead: `from_be<num>` -error[E0109]: type arguments are not allowed for this type - --> $DIR/let-binding-init-expr-as-ty.rs:2:27 - | -LL | let foo: i32::from_be(num); - | ^^^ type argument not allowed - error[E0223]: ambiguous associated type --> $DIR/let-binding-init-expr-as-ty.rs:2:14 | LL | let foo: i32::from_be(num); | ^^^^^^^^^^^^^^^^^ help: use fully-qualified syntax: `<i32 as Trait>::from_be` -error: aborting due to 4 previous errors +error: aborting due to 3 previous errors -Some errors have detailed explanations: E0109, E0214, E0223, E0573. -For more information about an error, try `rustc --explain E0109`. +Some errors have detailed explanations: E0214, E0223, E0573. +For more information about an error, try `rustc --explain E0214`. diff --git a/src/test/ui/symbol-names/basic.legacy.stderr b/src/test/ui/symbol-names/basic.legacy.stderr index 52e777285eb..895ff5ae54f 100644 --- a/src/test/ui/symbol-names/basic.legacy.stderr +++ b/src/test/ui/symbol-names/basic.legacy.stderr @@ -1,23 +1,23 @@ error: symbol-name(_ZN5basic4main17h81759b0695851718E) - --> $DIR/basic.rs:7:1 + --> $DIR/basic.rs:8:1 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling(basic::main::h81759b0695851718) - --> $DIR/basic.rs:7:1 + --> $DIR/basic.rs:8:1 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(basic::main) - --> $DIR/basic.rs:7:1 + --> $DIR/basic.rs:8:1 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: def-path(main) - --> $DIR/basic.rs:14:1 + --> $DIR/basic.rs:15:1 | LL | #[rustc_def_path] | ^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/symbol-names/basic.rs b/src/test/ui/symbol-names/basic.rs index aa88184eddf..ddc349d7f10 100644 --- a/src/test/ui/symbol-names/basic.rs +++ b/src/test/ui/symbol-names/basic.rs @@ -1,3 +1,4 @@ +// build-fail // revisions: legacy v0 //[legacy]compile-flags: -Z symbol-mangling-version=legacy //[v0]compile-flags: -Z symbol-mangling-version=v0 diff --git a/src/test/ui/symbol-names/basic.v0.stderr b/src/test/ui/symbol-names/basic.v0.stderr index 40a39daaedc..36dba0dfc97 100644 --- a/src/test/ui/symbol-names/basic.v0.stderr +++ b/src/test/ui/symbol-names/basic.v0.stderr @@ -1,23 +1,23 @@ error: symbol-name(_RNvCs4fqI2P2rA04_5basic4main) - --> $DIR/basic.rs:7:1 + --> $DIR/basic.rs:8:1 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling(basic[317d481089b8c8fe]::main) - --> $DIR/basic.rs:7:1 + --> $DIR/basic.rs:8:1 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(basic::main) - --> $DIR/basic.rs:7:1 + --> $DIR/basic.rs:8:1 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: def-path(main) - --> $DIR/basic.rs:14:1 + --> $DIR/basic.rs:15:1 | LL | #[rustc_def_path] | ^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/symbol-names/impl1.legacy.stderr b/src/test/ui/symbol-names/impl1.legacy.stderr index c9495b597eb..53ab2f9878f 100644 --- a/src/test/ui/symbol-names/impl1.legacy.stderr +++ b/src/test/ui/symbol-names/impl1.legacy.stderr @@ -1,71 +1,71 @@ error: symbol-name(_ZN5impl13foo3Foo3bar17h92cf46db76791039E) - --> $DIR/impl1.rs:13:9 + --> $DIR/impl1.rs:14:9 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling(impl1::foo::Foo::bar::h92cf46db76791039) - --> $DIR/impl1.rs:13:9 + --> $DIR/impl1.rs:14:9 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(impl1::foo::Foo::bar) - --> $DIR/impl1.rs:13:9 + --> $DIR/impl1.rs:14:9 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: def-path(foo::Foo::bar) - --> $DIR/impl1.rs:20:9 + --> $DIR/impl1.rs:21:9 | LL | #[rustc_def_path] | ^^^^^^^^^^^^^^^^^ error: symbol-name(_ZN5impl13bar33_$LT$impl$u20$impl1..foo..Foo$GT$3baz17h90c4a800b1aa0df0E) - --> $DIR/impl1.rs:31:9 + --> $DIR/impl1.rs:32:9 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling(impl1::bar::<impl impl1::foo::Foo>::baz::h90c4a800b1aa0df0) - --> $DIR/impl1.rs:31:9 + --> $DIR/impl1.rs:32:9 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(impl1::bar::<impl impl1::foo::Foo>::baz) - --> $DIR/impl1.rs:31:9 + --> $DIR/impl1.rs:32:9 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: def-path(bar::<impl foo::Foo>::baz) - --> $DIR/impl1.rs:38:9 + --> $DIR/impl1.rs:39:9 | LL | #[rustc_def_path] | ^^^^^^^^^^^^^^^^^ error: symbol-name(_ZN209_$LT$$u5b$$RF$dyn$u20$impl1..Foo$u2b$Assoc$u20$$u3d$$u20$extern$u20$$u22$C$u22$$u20$fn$LP$$RF$u8$C$$u20$...$RP$$u2b$impl1..AutoTrait$u3b$$u20$_$u5d$$u20$as$u20$impl1..main..$u7b$$u7b$closure$u7d$$u7d$..Bar$GT$6method17h92c563325b7ff21aE) - --> $DIR/impl1.rs:61:13 + --> $DIR/impl1.rs:62:13 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling(<[&dyn impl1::Foo+Assoc = extern "C" fn(&u8, ::.)+impl1::AutoTrait; _] as impl1::main::{{closure}}::Bar>::method::h92c563325b7ff21a) - --> $DIR/impl1.rs:61:13 + --> $DIR/impl1.rs:62:13 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(<[&dyn impl1::Foo+Assoc = extern "C" fn(&u8, ::.)+impl1::AutoTrait; _] as impl1::main::{{closure}}::Bar>::method) - --> $DIR/impl1.rs:61:13 + --> $DIR/impl1.rs:62:13 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: def-path(<[&dyn Foo<Assoc = for<'r> extern "C" fn(&'r u8, ...)> + AutoTrait; _] as main::{{closure}}#1::Bar>::method) - --> $DIR/impl1.rs:68:13 + --> $DIR/impl1.rs:69:13 | LL | #[rustc_def_path] | ^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/symbol-names/impl1.rs b/src/test/ui/symbol-names/impl1.rs index add0d10ea6c..c1aaec5169d 100644 --- a/src/test/ui/symbol-names/impl1.rs +++ b/src/test/ui/symbol-names/impl1.rs @@ -1,3 +1,4 @@ +// build-fail // ignore-tidy-linelength // revisions: legacy v0 //[legacy]compile-flags: -Z symbol-mangling-version=legacy diff --git a/src/test/ui/symbol-names/impl1.v0.stderr b/src/test/ui/symbol-names/impl1.v0.stderr index 01fe39ddf6c..a931937d1a8 100644 --- a/src/test/ui/symbol-names/impl1.v0.stderr +++ b/src/test/ui/symbol-names/impl1.v0.stderr @@ -1,71 +1,71 @@ error: symbol-name(_RNvMNtCs4fqI2P2rA04_5impl13fooNtB2_3Foo3bar) - --> $DIR/impl1.rs:13:9 + --> $DIR/impl1.rs:14:9 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling(<impl1[317d481089b8c8fe]::foo::Foo>::bar) - --> $DIR/impl1.rs:13:9 + --> $DIR/impl1.rs:14:9 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(<impl1::foo::Foo>::bar) - --> $DIR/impl1.rs:13:9 + --> $DIR/impl1.rs:14:9 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: def-path(foo::Foo::bar) - --> $DIR/impl1.rs:20:9 + --> $DIR/impl1.rs:21:9 | LL | #[rustc_def_path] | ^^^^^^^^^^^^^^^^^ error: symbol-name(_RNvMNtCs4fqI2P2rA04_5impl13barNtNtB4_3foo3Foo3baz) - --> $DIR/impl1.rs:31:9 + --> $DIR/impl1.rs:32:9 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling(<impl1[317d481089b8c8fe]::foo::Foo>::baz) - --> $DIR/impl1.rs:31:9 + --> $DIR/impl1.rs:32:9 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(<impl1::foo::Foo>::baz) - --> $DIR/impl1.rs:31:9 + --> $DIR/impl1.rs:32:9 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: def-path(bar::<impl foo::Foo>::baz) - --> $DIR/impl1.rs:38:9 + --> $DIR/impl1.rs:39:9 | LL | #[rustc_def_path] | ^^^^^^^^^^^^^^^^^ error: symbol-name(_RNvXNCNvCs4fqI2P2rA04_5impl14mains_0ARDNtB6_3Foop5AssocFG_KCRL0_hvEuNtB6_9AutoTraitEL_j3_NtB2_3Bar6method) - --> $DIR/impl1.rs:61:13 + --> $DIR/impl1.rs:62:13 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling(<[&dyn impl1[317d481089b8c8fe]::Foo<Assoc = for<'a> extern "C" fn(&'a u8, ...)> + impl1[317d481089b8c8fe]::AutoTrait; 3: usize] as impl1[317d481089b8c8fe]::main::{closure#1}::Bar>::method) - --> $DIR/impl1.rs:61:13 + --> $DIR/impl1.rs:62:13 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(<[&dyn impl1::Foo<Assoc = for<'a> extern "C" fn(&'a u8, ...)> + impl1::AutoTrait; 3] as impl1::main::{closure#1}::Bar>::method) - --> $DIR/impl1.rs:61:13 + --> $DIR/impl1.rs:62:13 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: def-path(<[&dyn Foo<Assoc = for<'r> extern "C" fn(&'r u8, ...)> + AutoTrait; _] as main::{{closure}}#1::Bar>::method) - --> $DIR/impl1.rs:68:13 + --> $DIR/impl1.rs:69:13 | LL | #[rustc_def_path] | ^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/symbol-names/impl2.rs b/src/test/ui/symbol-names/impl2.rs index d48b182f2a2..08add29cb9c 100644 --- a/src/test/ui/symbol-names/impl2.rs +++ b/src/test/ui/symbol-names/impl2.rs @@ -1,3 +1,5 @@ +// build-fail + #![feature(rustc_attrs)] #![allow(dead_code)] diff --git a/src/test/ui/symbol-names/impl2.stderr b/src/test/ui/symbol-names/impl2.stderr index de26fed4413..98330031602 100644 --- a/src/test/ui/symbol-names/impl2.stderr +++ b/src/test/ui/symbol-names/impl2.stderr @@ -1,5 +1,5 @@ error: def-path(<[u8; _] as Foo>::baz) - --> $DIR/impl2.rs:9:5 + --> $DIR/impl2.rs:11:5 | LL | #[rustc_def_path] | ^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/symbol-names/issue-60925.legacy.stderr b/src/test/ui/symbol-names/issue-60925.legacy.stderr index 19d9740fb16..0e3a34adbc7 100644 --- a/src/test/ui/symbol-names/issue-60925.legacy.stderr +++ b/src/test/ui/symbol-names/issue-60925.legacy.stderr @@ -1,17 +1,17 @@ error: symbol-name(_ZN11issue_609253foo37Foo$LT$issue_60925..llv$u6d$..Foo$GT$3foo17hc86312d25b60f6eeE) - --> $DIR/issue-60925.rs:21:9 + --> $DIR/issue-60925.rs:22:9 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling(issue_60925::foo::Foo<issue_60925::llvm::Foo>::foo::hc86312d25b60f6ee) - --> $DIR/issue-60925.rs:21:9 + --> $DIR/issue-60925.rs:22:9 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(issue_60925::foo::Foo<issue_60925::llvm::Foo>::foo) - --> $DIR/issue-60925.rs:21:9 + --> $DIR/issue-60925.rs:22:9 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/symbol-names/issue-60925.rs b/src/test/ui/symbol-names/issue-60925.rs index 02438351dbc..55b7041935c 100644 --- a/src/test/ui/symbol-names/issue-60925.rs +++ b/src/test/ui/symbol-names/issue-60925.rs @@ -1,3 +1,4 @@ +// build-fail // ignore-tidy-linelength // revisions: legacy v0 //[legacy]compile-flags: -Z symbol-mangling-version=legacy diff --git a/src/test/ui/symbol-names/issue-60925.v0.stderr b/src/test/ui/symbol-names/issue-60925.v0.stderr index 5ead40211d2..78594b88b45 100644 --- a/src/test/ui/symbol-names/issue-60925.v0.stderr +++ b/src/test/ui/symbol-names/issue-60925.v0.stderr @@ -1,17 +1,17 @@ error: symbol-name(_RNvMNtCs4fqI2P2rA04_11issue_609253fooINtB2_3FooNtNtB4_4llvm3FooE3foo) - --> $DIR/issue-60925.rs:21:9 + --> $DIR/issue-60925.rs:22:9 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling(<issue_60925[317d481089b8c8fe]::foo::Foo<issue_60925[317d481089b8c8fe]::llvm::Foo>>::foo) - --> $DIR/issue-60925.rs:21:9 + --> $DIR/issue-60925.rs:22:9 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: demangling-alt(<issue_60925::foo::Foo<issue_60925::llvm::Foo>>::foo) - --> $DIR/issue-60925.rs:21:9 + --> $DIR/issue-60925.rs:22:9 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/type_length_limit.rs b/src/test/ui/type_length_limit.rs index 926f12911c5..2f12c041a64 100644 --- a/src/test/ui/type_length_limit.rs +++ b/src/test/ui/type_length_limit.rs @@ -1,3 +1,4 @@ +// build-fail // ignore-x86 FIXME: missing sysroot spans (#53081) // error-pattern: reached the type-length limit while instantiating diff --git a/src/tools/build-manifest/src/main.rs b/src/tools/build-manifest/src/main.rs index d92924085e7..7e76604355d 100644 --- a/src/tools/build-manifest/src/main.rs +++ b/src/tools/build-manifest/src/main.rs @@ -453,10 +453,10 @@ impl Builder { "lldb-preview", "rust-analysis", "miri-preview" ]); - // The compiler libraries are not stable for end users, but `rustc-dev` was only recently - // split out of `rust-std`. We'll include it by default as a transition for nightly users. + // The compiler libraries are not stable for end users, and they're also huge, so we only + // `rustc-dev` for nightly users, and only in the "complete" profile. It's still possible + // for users to install the additional component manually, if needed. if self.rust_release == "nightly" { - self.extend_profile("default", &mut manifest.profiles, &["rustc-dev"]); self.extend_profile("complete", &mut manifest.profiles, &["rustc-dev"]); } } @@ -514,15 +514,6 @@ impl Builder { components.push(host_component("rust-mingw")); } - // The compiler libraries are not stable for end users, but `rustc-dev` was only recently - // split out of `rust-std`. We'll include it by default as a transition for nightly users, - // but ship it as an optional component on the beta and stable channels. - if self.rust_release == "nightly" { - components.push(host_component("rustc-dev")); - } else { - extensions.push(host_component("rustc-dev")); - } - // Tools are always present in the manifest, // but might be marked as unavailable if they weren't built. extensions.extend(vec![ @@ -542,7 +533,6 @@ impl Builder { ); extensions.extend( HOSTS.iter() - .filter(|&&target| target != host) .map(|target| Component::from_str("rustc-dev", target)) ); extensions.push(Component::from_str("rust-src", "*")); diff --git a/src/tools/cargo b/src/tools/cargo -Subproject 626f0f40efd32e6b3dbade50cd53fdfaa08446b +Subproject 19a0de242f442ac7149c511031599aafa35b36d diff --git a/src/tools/compiletest/src/common.rs b/src/tools/compiletest/src/common.rs index 2358a065d62..09733ffbe6a 100644 --- a/src/tools/compiletest/src/common.rs +++ b/src/tools/compiletest/src/common.rs @@ -100,7 +100,6 @@ pub enum PassMode { Check, Build, Run, - RunFail, } impl FromStr for PassMode { @@ -121,12 +120,18 @@ impl fmt::Display for PassMode { PassMode::Check => "check", PassMode::Build => "build", PassMode::Run => "run", - PassMode::RunFail => "run-fail", }; fmt::Display::fmt(s, f) } } +#[derive(Copy, Clone, Debug, PartialEq, PartialOrd)] +pub enum FailMode { + Check, + Build, + Run, +} + #[derive(Clone, Debug, PartialEq)] pub enum CompareMode { Nll, diff --git a/src/tools/compiletest/src/header.rs b/src/tools/compiletest/src/header.rs index 46cce6394e6..a9be7ba5f96 100644 --- a/src/tools/compiletest/src/header.rs +++ b/src/tools/compiletest/src/header.rs @@ -6,7 +6,7 @@ use std::path::{Path, PathBuf}; use log::*; -use crate::common::{self, CompareMode, Config, Mode, PassMode}; +use crate::common::{self, CompareMode, Config, Mode, PassMode, FailMode}; use crate::util; use crate::extract_gdb_version; @@ -366,6 +366,8 @@ pub struct TestProps { pass_mode: Option<PassMode>, // Ignore `--pass` overrides from the command line for this test. ignore_pass: bool, + // How far this test should proceed to start failing. + pub fail_mode: Option<FailMode>, // rustdoc will test the output of the `--test` option pub check_test_line_numbers_match: bool, // Do not pass `-Z ui-testing` to UI tests @@ -411,6 +413,7 @@ impl TestProps { forbid_output: vec![], incremental_dir: None, pass_mode: None, + fail_mode: None, ignore_pass: false, check_test_line_numbers_match: false, disable_ui_testing_normalization: false, @@ -437,6 +440,13 @@ impl TestProps { pub fn from_file(testfile: &Path, cfg: Option<&str>, config: &Config) -> Self { let mut props = TestProps::new(); props.load_from(testfile, cfg, config); + + match (props.pass_mode, props.fail_mode) { + (None, None) => props.fail_mode = Some(FailMode::Check), + (Some(_), None) | (None, Some(_)) => {} + (Some(_), Some(_)) => panic!("cannot use a *-fail and *-pass mode together"), + } + props } @@ -548,6 +558,7 @@ impl TestProps { } self.update_pass_mode(ln, cfg, config); + self.update_fail_mode(ln, config); if !self.ignore_pass { self.ignore_pass = config.parse_ignore_pass(ln); @@ -602,6 +613,29 @@ impl TestProps { } } + fn update_fail_mode(&mut self, ln: &str, config: &Config) { + let check_ui = |mode: &str| if config.mode != Mode::Ui { + panic!("`{}-fail` header is only supported in UI tests", mode); + }; + let fail_mode = if config.parse_name_directive(ln, "check-fail") { + check_ui("check"); + Some(FailMode::Check) + } else if config.parse_name_directive(ln, "build-fail") { + check_ui("build"); + Some(FailMode::Build) + } else if config.parse_name_directive(ln, "run-fail") { + check_ui("run"); + Some(FailMode::Run) + } else { + None + }; + match (self.fail_mode, fail_mode) { + (None, Some(_)) => self.fail_mode = fail_mode, + (Some(_), Some(_)) => panic!("multiple `*-fail` headers in a single test"), + (_, None) => {} + } + } + fn update_pass_mode(&mut self, ln: &str, revision: Option<&str>, config: &Config) { let check_no_run = |s| { if config.mode != Mode::Ui && config.mode != Mode::Incremental { @@ -624,11 +658,6 @@ impl TestProps { panic!("`run-pass` header is only supported in UI tests") } Some(PassMode::Run) - } else if config.parse_name_directive(ln, "run-fail") { - if config.mode != Mode::Ui { - panic!("`run-fail` header is only supported in UI tests") - } - Some(PassMode::RunFail) } else { None }; @@ -640,7 +669,7 @@ impl TestProps { } pub fn pass_mode(&self, config: &Config) -> Option<PassMode> { - if !self.ignore_pass { + if !self.ignore_pass && self.fail_mode.is_none() && config.mode == Mode::Ui { if let (mode @ Some(_), Some(_)) = (config.force_pass_mode, self.pass_mode) { return mode; } diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index 480868440b8..83a69c321bb 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -1,6 +1,6 @@ // ignore-tidy-filelength -use crate::common::{CompareMode, PassMode}; +use crate::common::{CompareMode, PassMode, FailMode}; use crate::common::{expected_output_path, UI_EXTENSIONS, UI_FIXED, UI_STDERR, UI_STDOUT}; use crate::common::{UI_RUN_STDERR, UI_RUN_STDOUT}; use crate::common::{output_base_dir, output_base_name, output_testname_unique}; @@ -264,7 +264,7 @@ pub fn compute_stamp_hash(config: &Config) -> String { env::var_os("PYTHONPATH").hash(&mut hash); } - if let Ui | Incremental | Pretty = config.mode { + if let Ui = config.mode { config.force_pass_mode.hash(&mut hash); } @@ -294,6 +294,14 @@ enum TestOutput { Run, } +/// Will this test be executed? Should we use `make_exe_name`? +#[derive(Copy, Clone, PartialEq)] +enum WillExecute { Yes, No } + +/// Should `--emit metadata` be used? +#[derive(Copy, Clone)] +enum EmitMetadata { Yes, No } + impl<'test> TestCx<'test> { /// Code executed for each revision in turn (or, if there are no /// revisions, exactly once, with revision == None). @@ -332,27 +340,28 @@ impl<'test> TestCx<'test> { self.props.pass_mode(self.config) } - fn should_run(&self) -> bool { - let pass_mode = self.pass_mode(); + fn should_run(&self, pm: Option<PassMode>) -> WillExecute { match self.config.mode { - Ui => pass_mode == Some(PassMode::Run) || pass_mode == Some(PassMode::RunFail), + Ui if pm == Some(PassMode::Run) || self.props.fail_mode == Some(FailMode::Run) => { + WillExecute::Yes + } + Ui => WillExecute::No, mode => panic!("unimplemented for mode {:?}", mode), } } - fn should_run_successfully(&self) -> bool { - let pass_mode = self.pass_mode(); + fn should_run_successfully(&self, pm: Option<PassMode>) -> bool { match self.config.mode { - Ui => pass_mode == Some(PassMode::Run), + Ui => pm == Some(PassMode::Run), mode => panic!("unimplemented for mode {:?}", mode), } } - fn should_compile_successfully(&self) -> bool { + fn should_compile_successfully(&self, pm: Option<PassMode>) -> bool { match self.config.mode { CompileFail => false, JsDocTest => true, - Ui => self.pass_mode().is_some(), + Ui => pm.is_some() || self.props.fail_mode > Some(FailMode::Build), Incremental => { let revision = self.revision .expect("incremental tests require a list of revisions"); @@ -360,7 +369,7 @@ impl<'test> TestCx<'test> { true } else if revision.starts_with("cfail") { // FIXME: would be nice if incremental revs could start with "cpass" - self.pass_mode().is_some() + pm.is_some() } else { panic!("revision name must begin with rpass, rfail, or cfail"); } @@ -369,8 +378,8 @@ impl<'test> TestCx<'test> { } } - fn check_if_test_should_compile(&self, proc_res: &ProcRes) { - if self.should_compile_successfully() { + fn check_if_test_should_compile(&self, proc_res: &ProcRes, pm: Option<PassMode>) { + if self.should_compile_successfully(pm) { if !proc_res.status.success() { self.fatal_proc_rec("test compilation failed although it shouldn't!", proc_res); } @@ -387,8 +396,9 @@ impl<'test> TestCx<'test> { } fn run_cfail_test(&self) { - let proc_res = self.compile_test(); - self.check_if_test_should_compile(&proc_res); + let pm = self.pass_mode(); + let proc_res = self.compile_test(WillExecute::No, self.should_emit_metadata(pm)); + self.check_if_test_should_compile(&proc_res, pm); self.check_no_compiler_crash(&proc_res, self.props.should_ice); let output_to_check = self.get_output(&proc_res); @@ -399,7 +409,7 @@ impl<'test> TestCx<'test> { } self.check_expected_errors(expected_errors, &proc_res); } else { - self.check_error_patterns(&output_to_check, &proc_res); + self.check_error_patterns(&output_to_check, &proc_res, pm); } if self.props.should_ice { match proc_res.status.code() { @@ -412,7 +422,8 @@ impl<'test> TestCx<'test> { } fn run_rfail_test(&self) { - let proc_res = self.compile_test(); + let pm = self.pass_mode(); + let proc_res = self.compile_test(WillExecute::Yes, self.should_emit_metadata(pm)); if !proc_res.status.success() { self.fatal_proc_rec("compilation failed!", &proc_res); @@ -428,7 +439,7 @@ impl<'test> TestCx<'test> { let output_to_check = self.get_output(&proc_res); self.check_correct_failure_status(&proc_res); - self.check_error_patterns(&output_to_check, &proc_res); + self.check_error_patterns(&output_to_check, &proc_res, pm); } fn get_output(&self, proc_res: &ProcRes) -> String { @@ -455,7 +466,8 @@ impl<'test> TestCx<'test> { } fn run_rpass_test(&self) { - let proc_res = self.compile_test(); + let emit_metadata = self.should_emit_metadata(self.pass_mode()); + let proc_res = self.compile_test(WillExecute::Yes, emit_metadata); if !proc_res.status.success() { self.fatal_proc_rec("compilation failed!", &proc_res); @@ -482,7 +494,7 @@ impl<'test> TestCx<'test> { return self.run_rpass_test(); } - let mut proc_res = self.compile_test(); + let mut proc_res = self.compile_test(WillExecute::Yes, EmitMetadata::No); if !proc_res.status.success() { self.fatal_proc_rec("compilation failed!", &proc_res); @@ -715,7 +727,7 @@ impl<'test> TestCx<'test> { fn run_debuginfo_cdb_test_no_opt(&self) { // compile test file (it should have 'compile-flags:-g' in the header) - let compile_result = self.compile_test(); + let compile_result = self.compile_test(WillExecute::Yes, EmitMetadata::No); if !compile_result.status.success() { self.fatal_proc_rec("compilation failed!", &compile_result); } @@ -823,7 +835,7 @@ impl<'test> TestCx<'test> { let mut cmds = commands.join("\n"); // compile test file (it should have 'compile-flags:-g' in the header) - let compiler_run_result = self.compile_test(); + let compiler_run_result = self.compile_test(WillExecute::Yes, EmitMetadata::No); if !compiler_run_result.status.success() { self.fatal_proc_rec("compilation failed!", &compiler_run_result); } @@ -1075,7 +1087,7 @@ impl<'test> TestCx<'test> { fn run_debuginfo_lldb_test_no_opt(&self) { // compile test file (it should have 'compile-flags:-g' in the header) - let compile_result = self.compile_test(); + let compile_result = self.compile_test(WillExecute::Yes, EmitMetadata::No); if !compile_result.status.success() { self.fatal_proc_rec("compilation failed!", &compile_result); } @@ -1374,10 +1386,16 @@ impl<'test> TestCx<'test> { } } - fn check_error_patterns(&self, output_to_check: &str, proc_res: &ProcRes) { + fn check_error_patterns( + &self, + output_to_check: &str, + proc_res: &ProcRes, + pm: Option<PassMode>, + ) { debug!("check_error_patterns"); if self.props.error_patterns.is_empty() { - if self.pass_mode().is_some() { + if pm.is_some() { + // FIXME(#65865) return; } else { self.fatal(&format!( @@ -1553,22 +1571,30 @@ impl<'test> TestCx<'test> { } } - fn compile_test(&self) -> ProcRes { + fn should_emit_metadata(&self, pm: Option<PassMode>) -> EmitMetadata { + match (pm, self.props.fail_mode, self.config.mode) { + (Some(PassMode::Check), ..) | (_, Some(FailMode::Check), Ui) => EmitMetadata::Yes, + _ => EmitMetadata::No, + } + } + + fn compile_test(&self, will_execute: WillExecute, emit_metadata: EmitMetadata) -> ProcRes { + self.compile_test_general(will_execute, emit_metadata, self.props.local_pass_mode()) + } + + fn compile_test_general( + &self, + will_execute: WillExecute, + emit_metadata: EmitMetadata, + local_pm: Option<PassMode>, + ) -> ProcRes { // Only use `make_exe_name` when the test ends up being executed. - let will_execute = match self.config.mode { - Ui => self.should_run(), - Incremental => self.revision.unwrap().starts_with("r"), - RunFail | RunPassValgrind | MirOpt | - DebugInfoCdb | DebugInfoGdbLldb | DebugInfoGdb | DebugInfoLldb => true, - _ => false, - }; - let output_file = if will_execute { - TargetLocation::ThisFile(self.make_exe_name()) - } else { - TargetLocation::ThisDirectory(self.output_base_dir()) + let output_file = match will_execute { + WillExecute::Yes => TargetLocation::ThisFile(self.make_exe_name()), + WillExecute::No => TargetLocation::ThisDirectory(self.output_base_dir()), }; - let mut rustc = self.make_compile_args(&self.testpaths.file, output_file); + let mut rustc = self.make_compile_args(&self.testpaths.file, output_file, emit_metadata); rustc.arg("-L").arg(&self.aux_output_dir_name()); @@ -1579,11 +1605,12 @@ impl<'test> TestCx<'test> { // want to actually assert warnings about all this code. Instead // let's just ignore unused code warnings by defaults and tests // can turn it back on if needed. - if !self.config.src_base.ends_with("rustdoc-ui") && - // Note that we don't call pass_mode() here as we don't want + if !self.is_rustdoc() + // Note that we use the local pass mode here as we don't want // to set unused to allow if we've overriden the pass mode // via command line flags. - self.props.local_pass_mode() != Some(PassMode::Run) { + && local_pm != Some(PassMode::Run) + { rustc.args(&["-A", "unused"]); } } @@ -1817,7 +1844,8 @@ impl<'test> TestCx<'test> { }; // Create the directory for the stdout/stderr files. create_dir_all(aux_cx.output_base_dir()).unwrap(); - let mut aux_rustc = aux_cx.make_compile_args(&aux_testpaths.file, aux_output); + let input_file = &aux_testpaths.file; + let mut aux_rustc = aux_cx.make_compile_args(input_file, aux_output, EmitMetadata::No); let (dylib, crate_type) = if aux_props.no_prefer_dynamic { (true, None) @@ -1928,13 +1956,18 @@ impl<'test> TestCx<'test> { result } + fn is_rustdoc(&self) -> bool { + self.config.src_base.ends_with("rustdoc-ui") + || self.config.src_base.ends_with("rustdoc-js") + } + fn make_compile_args( &self, input_file: &Path, output_file: TargetLocation, + emit_metadata: EmitMetadata, ) -> Command { - let is_rustdoc = self.config.src_base.ends_with("rustdoc-ui") || - self.config.src_base.ends_with("rustdoc-js"); + let is_rustdoc = self.is_rustdoc(); let mut rustc = if !is_rustdoc { Command::new(&self.config.rustc_path) } else { @@ -2029,7 +2062,7 @@ impl<'test> TestCx<'test> { } } - if let Some(PassMode::Check) = self.pass_mode() { + if let (false, EmitMetadata::Yes) = (is_rustdoc, emit_metadata) { rustc.args(&["--emit", "metadata"]); } @@ -2278,7 +2311,8 @@ impl<'test> TestCx<'test> { let aux_dir = self.aux_output_dir_name(); let output_file = TargetLocation::ThisDirectory(self.output_base_dir()); - let mut rustc = self.make_compile_args(&self.testpaths.file, output_file); + let input_file = &self.testpaths.file; + let mut rustc = self.make_compile_args(input_file, output_file, EmitMetadata::No); rustc.arg("-L").arg(aux_dir).arg("--emit=llvm-ir"); self.compose_and_run_compiler(rustc, None) @@ -2290,7 +2324,8 @@ impl<'test> TestCx<'test> { let output_path = self.output_base_name().with_extension("s"); let output_file = TargetLocation::ThisFile(output_path.clone()); - let mut rustc = self.make_compile_args(&self.testpaths.file, output_file); + let input_file = &self.testpaths.file; + let mut rustc = self.make_compile_args(input_file, output_file, EmitMetadata::No); rustc.arg("-L").arg(self.aux_output_dir_name()); @@ -2517,7 +2552,7 @@ impl<'test> TestCx<'test> { fn run_codegen_units_test(&self) { assert!(self.revision.is_none(), "revisions not relevant here"); - let proc_res = self.compile_test(); + let proc_res = self.compile_test(WillExecute::No, EmitMetadata::No); if !proc_res.status.success() { self.fatal_proc_rec("compilation failed!", &proc_res); @@ -3033,6 +3068,19 @@ impl<'test> TestCx<'test> { } fn run_ui_test(&self) { + if let Some(FailMode::Build) = self.props.fail_mode { + // Make sure a build-fail test cannot fail due to failing analysis (e.g. typeck). + let pm = Some(PassMode::Check); + let proc_res = self.compile_test_general(WillExecute::No, EmitMetadata::Yes, pm); + self.check_if_test_should_compile(&proc_res, pm); + } + + let pm = self.pass_mode(); + let should_run = self.should_run(pm); + let emit_metadata = self.should_emit_metadata(pm); + let proc_res = self.compile_test(should_run, emit_metadata); + self.check_if_test_should_compile(&proc_res, pm); + // if the user specified a format in the ui test // print the output to the stderr file, otherwise extract // the rendered error messages from json and print them @@ -3041,8 +3089,6 @@ impl<'test> TestCx<'test> { .compile_flags .iter() .any(|s| s.contains("--error-format")); - let proc_res = self.compile_test(); - self.check_if_test_should_compile(&proc_res); let expected_fixed = self.load_expected_output(UI_FIXED); @@ -3126,7 +3172,7 @@ impl<'test> TestCx<'test> { let expected_errors = errors::load_errors(&self.testpaths.file, self.revision); - if self.should_run() { + if let WillExecute::Yes = should_run { let proc_res = self.exec_compiled_test(); let run_output_errors = if self.props.check_run_results { self.load_compare_outputs(&proc_res, TestOutput::Run, explicit) @@ -3139,7 +3185,7 @@ impl<'test> TestCx<'test> { &proc_res, ); } - if self.should_run_successfully() { + if self.should_run_successfully(pm) { if !proc_res.status.success() { self.fatal_proc_rec("test run failed!", &proc_res); } @@ -3150,7 +3196,7 @@ impl<'test> TestCx<'test> { } if !self.props.error_patterns.is_empty() { // "// error-pattern" comments - self.check_error_patterns(&proc_res.stderr, &proc_res); + self.check_error_patterns(&proc_res.stderr, &proc_res, pm); } } @@ -3160,7 +3206,7 @@ impl<'test> TestCx<'test> { self.props.error_patterns); if !explicit && self.config.compare_mode.is_none() { let check_patterns = - !self.should_run() && + should_run == WillExecute::No && !self.props.error_patterns.is_empty(); let check_annotations = @@ -3169,7 +3215,7 @@ impl<'test> TestCx<'test> { if check_patterns { // "// error-pattern" comments - self.check_error_patterns(&proc_res.stderr, &proc_res); + self.check_error_patterns(&proc_res.stderr, &proc_res, pm); } if check_annotations { @@ -3184,6 +3230,7 @@ impl<'test> TestCx<'test> { let mut rustc = self.make_compile_args( &self.testpaths.file.with_extension(UI_FIXED), TargetLocation::ThisFile(self.make_exe_name()), + emit_metadata, ); rustc.arg("-L").arg(&self.aux_output_dir_name()); let res = self.compose_and_run_compiler(rustc, None); @@ -3197,7 +3244,7 @@ impl<'test> TestCx<'test> { } fn run_mir_opt_test(&self) { - let proc_res = self.compile_test(); + let proc_res = self.compile_test(WillExecute::Yes, EmitMetadata::No); if !proc_res.status.success() { self.fatal_proc_rec("compilation failed!", &proc_res); |
