diff --git a/compiler/rustc_data_structures/src/vec_map.rs b/compiler/rustc_data_structures/src/vec_map.rs index 73b04d3329cb8..1786fa340cc8b 100644 --- a/compiler/rustc_data_structures/src/vec_map.rs +++ b/compiler/rustc_data_structures/src/vec_map.rs @@ -127,13 +127,15 @@ impl IntoIterator for VecMap { } } -impl Extend<(K, V)> for VecMap { +impl Extend<(K, V)> for VecMap { fn extend>(&mut self, iter: I) { - self.0.extend(iter); + for (k, v) in iter { + self.insert(k, v); + } } - fn extend_one(&mut self, item: (K, V)) { - self.0.extend_one(item); + fn extend_one(&mut self, (k, v): (K, V)) { + self.insert(k, v); } fn extend_reserve(&mut self, additional: usize) { diff --git a/compiler/rustc_feature/src/active.rs b/compiler/rustc_feature/src/active.rs index ede510b693679..fdb15f6849bc0 100644 --- a/compiler/rustc_feature/src/active.rs +++ b/compiler/rustc_feature/src/active.rs @@ -534,7 +534,7 @@ declare_features! ( (active, bindings_after_at, "1.41.0", Some(65490), None), /// Allows `impl const Trait for T` syntax. - (incomplete, const_trait_impl, "1.42.0", Some(67792), None), + (active, const_trait_impl, "1.42.0", Some(67792), None), /// Allows `T: ?const Trait` syntax in bounds. (incomplete, const_trait_bound_opt_out, "1.42.0", Some(67794), None), diff --git a/compiler/rustc_middle/src/ty/mod.rs b/compiler/rustc_middle/src/ty/mod.rs index 42a8f1763f117..bfc942e6f10ff 100644 --- a/compiler/rustc_middle/src/ty/mod.rs +++ b/compiler/rustc_middle/src/ty/mod.rs @@ -857,7 +857,7 @@ impl<'tcx> InstantiatedPredicates<'tcx> { } } -#[derive(Copy, Clone, Debug, PartialEq, Eq, HashStable, TyEncodable, TyDecodable)] +#[derive(Copy, Clone, Debug, PartialEq, Eq, HashStable, TyEncodable, TyDecodable, TypeFoldable)] pub struct OpaqueTypeKey<'tcx> { pub def_id: DefId, pub substs: SubstsRef<'tcx>, diff --git a/compiler/rustc_trait_selection/src/opaque_types.rs b/compiler/rustc_trait_selection/src/opaque_types.rs index 0061ce4ed3709..d5e334b5c6595 100644 --- a/compiler/rustc_trait_selection/src/opaque_types.rs +++ b/compiler/rustc_trait_selection/src/opaque_types.rs @@ -568,6 +568,7 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> { /// - `substs`, the substs used to instantiate this opaque type /// - `instantiated_ty`, the inferred type C1 -- fully resolved, lifted version of /// `opaque_defn.concrete_ty` + #[instrument(skip(self))] fn infer_opaque_definition_from_instantiation( &self, opaque_type_key: OpaqueTypeKey<'tcx>, @@ -576,11 +577,6 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> { ) -> Ty<'tcx> { let OpaqueTypeKey { def_id, substs } = opaque_type_key; - debug!( - "infer_opaque_definition_from_instantiation(def_id={:?}, instantiated_ty={:?})", - def_id, instantiated_ty - ); - // Use substs to build up a reverse map from regions to their // identity mappings. This is necessary because of `impl // Trait` lifetimes are computed by replacing existing @@ -588,6 +584,7 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> { // `impl Trait` return type, resulting in the parameters // shifting. let id_substs = InternalSubsts::identity_for_item(self.tcx, def_id); + debug!(?id_substs); let map: FxHashMap, GenericArg<'tcx>> = substs.iter().enumerate().map(|(index, subst)| (subst, id_substs[index])).collect(); @@ -602,7 +599,7 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> { instantiated_ty, span, )); - debug!("infer_opaque_definition_from_instantiation: definition_ty={:?}", definition_ty); + debug!(?definition_ty); definition_ty } @@ -857,7 +854,7 @@ impl TypeFolder<'tcx> for ReverseMapper<'tcx> { self.tcx.mk_generator(def_id, substs, movability) } - ty::Param(..) => { + ty::Param(param) => { // Look it up in the substitution list. match self.map.get(&ty.into()).map(|k| k.unpack()) { // Found it in the substitution list; replace with the parameter from the @@ -865,6 +862,7 @@ impl TypeFolder<'tcx> for ReverseMapper<'tcx> { Some(GenericArgKind::Type(t1)) => t1, Some(u) => panic!("type mapped to unexpected kind: {:?}", u), None => { + debug!(?param, ?self.map); self.tcx .sess .struct_span_err( @@ -931,8 +929,8 @@ struct Instantiator<'a, 'tcx> { } impl<'a, 'tcx> Instantiator<'a, 'tcx> { + #[instrument(skip(self))] fn instantiate_opaque_types_in_map>(&mut self, value: T) -> T { - debug!("instantiate_opaque_types_in_map(value={:?})", value); let tcx = self.infcx.tcx; value.fold_with(&mut BottomUpFolder { tcx, diff --git a/compiler/rustc_typeck/src/check/demand.rs b/compiler/rustc_typeck/src/check/demand.rs index 33bc25accb319..3ea59906d3dcd 100644 --- a/compiler/rustc_typeck/src/check/demand.rs +++ b/compiler/rustc_typeck/src/check/demand.rs @@ -10,6 +10,7 @@ use rustc_hir::lang_items::LangItem; use rustc_hir::{is_range_literal, Node}; use rustc_middle::lint::in_external_macro; use rustc_middle::ty::adjustment::AllowTwoPhase; +use rustc_middle::ty::print::with_no_trimmed_paths; use rustc_middle::ty::{self, AssocItem, Ty, TypeAndMut}; use rustc_span::symbol::sym; use rustc_span::Span; @@ -201,7 +202,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { let sole_field = &variant.fields[0]; let sole_field_ty = sole_field.ty(self.tcx, substs); if self.can_coerce(expr_ty, sole_field_ty) { - let variant_path = self.tcx.def_path_str(variant.def_id); + let variant_path = + with_no_trimmed_paths(|| self.tcx.def_path_str(variant.def_id)); // FIXME #56861: DRYer prelude filtering if let Some(path) = variant_path.strip_prefix("std::prelude::") { if let Some((_, path)) = path.split_once("::") { diff --git a/compiler/rustc_typeck/src/check/mod.rs b/compiler/rustc_typeck/src/check/mod.rs index ff7d291d3c909..34d0908bcc74e 100644 --- a/compiler/rustc_typeck/src/check/mod.rs +++ b/compiler/rustc_typeck/src/check/mod.rs @@ -112,11 +112,9 @@ use rustc_hir::{HirIdMap, ImplicitSelfKind, Node}; use rustc_index::bit_set::BitSet; use rustc_index::vec::Idx; use rustc_infer::infer::type_variable::{TypeVariableOrigin, TypeVariableOriginKind}; -use rustc_middle::ty::fold::{TypeFoldable, TypeFolder}; use rustc_middle::ty::query::Providers; -use rustc_middle::ty::subst::GenericArgKind; use rustc_middle::ty::subst::{InternalSubsts, Subst, SubstsRef}; -use rustc_middle::ty::{self, RegionKind, Ty, TyCtxt, UserType}; +use rustc_middle::ty::{self, Ty, TyCtxt, UserType}; use rustc_session::config; use rustc_session::parse::feature_err; use rustc_session::Session; @@ -321,117 +319,6 @@ fn used_trait_imports(tcx: TyCtxt<'_>, def_id: LocalDefId) -> &FxHashSet Self::MyItem -/// } -/// impl MyTrait for T where T: Iterator { -/// type MyItem = impl Iterator; -/// fn use_it(self) -> Self::MyItem { -/// self -/// } -/// } -/// ``` -/// -/// When we normalize the signature of `use_it` from the impl block, -/// we will normalize `Self::MyItem` to the opaque type `impl Iterator` -/// However, this projection result may contain inference variables, due -/// to the way that projection works. We didn't have any inference variables -/// in the signature to begin with - leaving them in will cause us to incorrectly -/// conclude that we don't have a defining use of `MyItem`. By mapping inference -/// variables back to the actual generic parameters, we will correctly see that -/// we have a defining use of `MyItem` -fn fixup_opaque_types<'tcx, T>(tcx: TyCtxt<'tcx>, val: T) -> T -where - T: TypeFoldable<'tcx>, -{ - struct FixupFolder<'tcx> { - tcx: TyCtxt<'tcx>, - } - - impl<'tcx> TypeFolder<'tcx> for FixupFolder<'tcx> { - fn tcx<'a>(&'a self) -> TyCtxt<'tcx> { - self.tcx - } - - fn fold_ty(&mut self, ty: Ty<'tcx>) -> Ty<'tcx> { - match *ty.kind() { - ty::Opaque(def_id, substs) => { - debug!("fixup_opaque_types: found type {:?}", ty); - // Here, we replace any inference variables that occur within - // the substs of an opaque type. By definition, any type occurring - // in the substs has a corresponding generic parameter, which is what - // we replace it with. - // This replacement is only run on the function signature, so any - // inference variables that we come across must be the rust of projection - // (there's no other way for a user to get inference variables into - // a function signature). - if ty.needs_infer() { - let new_substs = InternalSubsts::for_item(self.tcx, def_id, |param, _| { - let old_param = substs[param.index as usize]; - match old_param.unpack() { - GenericArgKind::Type(old_ty) => { - if let ty::Infer(_) = old_ty.kind() { - // Replace inference type with a generic parameter - self.tcx.mk_param_from_def(param) - } else { - old_param.fold_with(self) - } - } - GenericArgKind::Const(old_const) => { - if let ty::ConstKind::Infer(_) = old_const.val { - // This should never happen - we currently do not support - // 'const projections', e.g.: - // `impl MyTrait for T where ::MyConst == 25` - // which should be the only way for us to end up with a const inference - // variable after projection. If Rust ever gains support for this kind - // of projection, this should *probably* be changed to - // `self.tcx.mk_param_from_def(param)` - bug!( - "Found infer const: `{:?}` in opaque type: {:?}", - old_const, - ty - ); - } else { - old_param.fold_with(self) - } - } - GenericArgKind::Lifetime(old_region) => { - if let RegionKind::ReVar(_) = old_region { - self.tcx.mk_param_from_def(param) - } else { - old_param.fold_with(self) - } - } - } - }); - let new_ty = self.tcx.mk_opaque(def_id, new_substs); - debug!("fixup_opaque_types: new type: {:?}", new_ty); - new_ty - } else { - ty - } - } - _ => ty.super_fold_with(self), - } - } - } - - debug!("fixup_opaque_types({:?})", val); - val.fold_with(&mut FixupFolder { tcx }) -} - fn typeck_const_arg<'tcx>( tcx: TyCtxt<'tcx>, (did, param_did): (LocalDefId, DefId), @@ -510,8 +397,6 @@ fn typeck_with_fallback<'tcx>( fn_sig, ); - let fn_sig = fixup_opaque_types(tcx, fn_sig); - let fcx = check_fn(&inh, param_env, fn_sig, decl, id, body, None).0; fcx } else { diff --git a/compiler/rustc_typeck/src/check/writeback.rs b/compiler/rustc_typeck/src/check/writeback.rs index 589570f1cb7ca..0aa059b7de80f 100644 --- a/compiler/rustc_typeck/src/check/writeback.rs +++ b/compiler/rustc_typeck/src/check/writeback.rs @@ -496,6 +496,8 @@ impl<'cx, 'tcx> WritebackCx<'cx, 'tcx> { debug_assert!(!instantiated_ty.has_escaping_bound_vars()); + let opaque_type_key = self.fcx.fully_resolve(opaque_type_key).unwrap(); + // Prevent: // * `fn foo() -> Foo` // * `fn foo() -> Foo` @@ -508,6 +510,8 @@ impl<'cx, 'tcx> WritebackCx<'cx, 'tcx> { // fn foo() -> Foo { .. } // ``` // figures out the concrete type with `U`, but the stored type is with `T`. + + // FIXME: why are we calling this here? This seems too early, and duplicated. let definition_ty = self.fcx.infer_opaque_definition_from_instantiation( opaque_type_key, instantiated_ty, @@ -529,33 +533,33 @@ impl<'cx, 'tcx> WritebackCx<'cx, 'tcx> { } } - if !opaque_type_key.substs.needs_infer() { - // We only want to add an entry into `concrete_opaque_types` - // if we actually found a defining usage of this opaque type. - // Otherwise, we do nothing - we'll either find a defining usage - // in some other location, or we'll end up emitting an error due - // to the lack of defining usage - if !skip_add { - let old_concrete_ty = self - .typeck_results - .concrete_opaque_types - .insert(opaque_type_key, definition_ty); - if let Some(old_concrete_ty) = old_concrete_ty { - if old_concrete_ty != definition_ty { - span_bug!( - span, - "`visit_opaque_types` tried to write different types for the same \ + if opaque_type_key.substs.needs_infer() { + span_bug!(span, "{:#?} has inference variables", opaque_type_key.substs) + } + + // We only want to add an entry into `concrete_opaque_types` + // if we actually found a defining usage of this opaque type. + // Otherwise, we do nothing - we'll either find a defining usage + // in some other location, or we'll end up emitting an error due + // to the lack of defining usage + if !skip_add { + let old_concrete_ty = self + .typeck_results + .concrete_opaque_types + .insert(opaque_type_key, definition_ty); + if let Some(old_concrete_ty) = old_concrete_ty { + if old_concrete_ty != definition_ty { + span_bug!( + span, + "`visit_opaque_types` tried to write different types for the same \ opaque type: {:?}, {:?}, {:?}, {:?}", - opaque_type_key.def_id, - definition_ty, - opaque_defn, - old_concrete_ty, - ); - } + opaque_type_key.def_id, + definition_ty, + opaque_defn, + old_concrete_ty, + ); } } - } else { - self.tcx().sess.delay_span_bug(span, "`opaque_defn` has inference variables"); } } } diff --git a/compiler/rustc_typeck/src/collect/type_of.rs b/compiler/rustc_typeck/src/collect/type_of.rs index ee84974cb73c2..7b0002914eca8 100644 --- a/compiler/rustc_typeck/src/collect/type_of.rs +++ b/compiler/rustc_typeck/src/collect/type_of.rs @@ -509,11 +509,10 @@ pub(super) fn type_of(tcx: TyCtxt<'_>, def_id: DefId) -> Ty<'_> { } } +#[instrument(skip(tcx), level = "debug")] fn find_opaque_ty_constraints(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Ty<'_> { use rustc_hir::{Expr, ImplItem, Item, TraitItem}; - debug!("find_opaque_ty_constraints({:?})", def_id); - struct ConstraintLocator<'tcx> { tcx: TyCtxt<'tcx>, def_id: DefId, @@ -522,13 +521,11 @@ fn find_opaque_ty_constraints(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Ty<'_> { } impl ConstraintLocator<'_> { + #[instrument(skip(self), level = "debug")] fn check(&mut self, def_id: LocalDefId) { // Don't try to check items that cannot possibly constrain the type. if !self.tcx.has_typeck_results(def_id) { - debug!( - "find_opaque_ty_constraints: no constraint for `{:?}` at `{:?}`: no typeck results", - self.def_id, def_id, - ); + debug!("no constraint: no typeck results"); return; } // Calling `mir_borrowck` can lead to cycle errors through @@ -540,21 +537,19 @@ fn find_opaque_ty_constraints(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Ty<'_> { .get_by(|(key, _)| key.def_id == self.def_id) .is_none() { - debug!( - "find_opaque_ty_constraints: no constraint for `{:?}` at `{:?}`", - self.def_id, def_id, - ); + debug!("no constraints in typeck results"); return; } // Use borrowck to get the type with unerased regions. let concrete_opaque_types = &self.tcx.mir_borrowck(def_id).concrete_opaque_types; - if let Some((opaque_type_key, concrete_type)) = - concrete_opaque_types.iter().find(|(key, _)| key.def_id == self.def_id) - { - debug!( - "find_opaque_ty_constraints: found constraint for `{:?}` at `{:?}`: {:?}", - self.def_id, def_id, concrete_type, - ); + debug!(?concrete_opaque_types); + for (opaque_type_key, concrete_type) in concrete_opaque_types { + if opaque_type_key.def_id != self.def_id { + // Ignore constraints for other opaque types. + continue; + } + + debug!(?concrete_type, ?opaque_type_key.substs, "found constraint"); // FIXME(oli-obk): trace the actual span from inference to improve errors. let span = self.tcx.def_span(def_id); @@ -603,7 +598,7 @@ fn find_opaque_ty_constraints(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Ty<'_> { if let Some((prev_span, prev_ty)) = self.found { if *concrete_type != prev_ty { - debug!("find_opaque_ty_constraints: span={:?}", span); + debug!(?span); // Found different concrete types for the opaque type. let mut err = self.tcx.sess.struct_span_err( span, @@ -619,11 +614,6 @@ fn find_opaque_ty_constraints(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Ty<'_> { } else { self.found = Some((span, concrete_type)); } - } else { - debug!( - "find_opaque_ty_constraints: no constraint for `{:?}` at `{:?}`", - self.def_id, def_id, - ); } } } diff --git a/library/core/src/array/mod.rs b/library/core/src/array/mod.rs index 32d344010aafd..78b799cd70976 100644 --- a/library/core/src/array/mod.rs +++ b/library/core/src/array/mod.rs @@ -296,7 +296,6 @@ impl [T; N] { /// # Examples /// /// ``` - /// #![feature(array_map)] /// let x = [1, 2, 3]; /// let y = x.map(|v| v + 1); /// assert_eq!(y, [2, 3, 4]); @@ -310,7 +309,7 @@ impl [T; N] { /// let y = x.map(|v| v.len()); /// assert_eq!(y, [6, 9, 3, 3]); /// ``` - #[unstable(feature = "array_map", issue = "75243")] + #[stable(feature = "array_map", since = "1.55.0")] pub fn map(self, f: F) -> [U; N] where F: FnMut(T) -> U, @@ -377,7 +376,7 @@ impl [T; N] { /// array if its elements are not `Copy`. /// /// ``` - /// #![feature(array_methods, array_map)] + /// #![feature(array_methods)] /// /// let strings = ["Ferris".to_string(), "♥".to_string(), "Rust".to_string()]; /// let is_ascii = strings.each_ref().map(|s| s.is_ascii()); diff --git a/library/core/tests/lib.rs b/library/core/tests/lib.rs index cc4ff1be56314..c7756a503c3e9 100644 --- a/library/core/tests/lib.rs +++ b/library/core/tests/lib.rs @@ -1,7 +1,6 @@ #![feature(alloc_layout_extra)] #![feature(array_chunks)] #![feature(array_methods)] -#![feature(array_map)] #![feature(array_windows)] #![feature(bool_to_option)] #![feature(box_syntax)] diff --git a/src/librustdoc/html/static/css/rustdoc.css b/src/librustdoc/html/static/css/rustdoc.css index 89dbc4d825f3d..b86f012c0e168 100644 --- a/src/librustdoc/html/static/css/rustdoc.css +++ b/src/librustdoc/html/static/css/rustdoc.css @@ -1732,7 +1732,8 @@ details.undocumented[open] > summary::before { width: calc(100% + 30px); } - .show-it { + .show-it, .sidebar-elems:focus-within { + z-index: 2; left: 0; } diff --git a/src/test/rustdoc-gui/auto-hide-trait-implementations.goml b/src/test/rustdoc-gui/auto-hide-trait-implementations.goml new file mode 100644 index 0000000000000..7b1358fedc3b5 --- /dev/null +++ b/src/test/rustdoc-gui/auto-hide-trait-implementations.goml @@ -0,0 +1,13 @@ +// Checks that the setting "auto hide trait implementations" is working as expected. +goto: file://|DOC_PATH|/test_docs/struct.Foo.html + +// By default, the trait implementations are not collapsed. +assert-attribute: ("#trait-implementations-list > details", {"open": ""}, ALL) + +// We now set the setting to auto hide all trait implementations. +local-storage: {"rustdoc-auto-hide-trait-implementations": "true" } +// We reload to ensure the trait implementations are collapsed as expected. +reload: + +// We now check that all matching elements don't have the open attributes. +assert-attribute-false: ("#trait-implementations-list > details", {"open": ""}, ALL) diff --git a/src/test/rustdoc-gui/sidebar-mobile.goml b/src/test/rustdoc-gui/sidebar-mobile.goml index 9a1442e48a9ea..f0c9361d0806b 100644 --- a/src/test/rustdoc-gui/sidebar-mobile.goml +++ b/src/test/rustdoc-gui/sidebar-mobile.goml @@ -8,3 +8,13 @@ assert-css: (".sidebar-elems", {"display": "block", "left": "-246px"}) // Opening the sidebar menu. click: ".sidebar-menu" assert-css: (".sidebar-elems", {"display": "block", "left": "0px"}) +// Closing the sidebar menu. +click: ".sidebar-menu" +assert-css: (".sidebar-elems", {"display": "block", "left": "-246px"}) +// Force the sidebar open by focusing a link inside it. +// This makes it easier for keyboard users to get to it. +focus: ".sidebar-title" +assert-css: (".sidebar-elems", {"display": "block", "left": "0px"}) +// When we tab out of the sidebar, close it. +focus: ".search-input" +assert-css: (".sidebar-elems", {"display": "block", "left": "-246px"}) diff --git a/src/test/rustdoc-gui/src/test_docs/lib.rs b/src/test/rustdoc-gui/src/test_docs/lib.rs index 85dd8805fbc4c..bed72ccb9f929 100644 --- a/src/test/rustdoc-gui/src/test_docs/lib.rs +++ b/src/test/rustdoc-gui/src/test_docs/lib.rs @@ -5,6 +5,7 @@ #![feature(doc_keyword)] #![feature(doc_cfg)] +use std::convert::AsRef; use std::fmt; /// Basic function with some code examples: @@ -36,6 +37,12 @@ impl Foo { } } +impl AsRef for Foo { + fn as_ref(&self) -> &str { + "hello" + } +} + /// Just a normal enum. #[doc(alias = "ThisIsAnAlias")] pub enum WhoLetTheDogOut { diff --git a/src/test/ui/consts/const-float-classify.rs b/src/test/ui/consts/const-float-classify.rs index 95e7f9e9c837a..5d38e032ac408 100644 --- a/src/test/ui/consts/const-float-classify.rs +++ b/src/test/ui/consts/const-float-classify.rs @@ -5,7 +5,6 @@ #![feature(const_float_bits_conv)] #![feature(const_float_classify)] #![feature(const_trait_impl)] -#![allow(incomplete_features)] // Don't promote const fn nop(x: T) -> T { x } diff --git a/src/test/ui/consts/rustc-impl-const-stability.rs b/src/test/ui/consts/rustc-impl-const-stability.rs index 01daa1c9cb42f..e3fda57548ea3 100644 --- a/src/test/ui/consts/rustc-impl-const-stability.rs +++ b/src/test/ui/consts/rustc-impl-const-stability.rs @@ -1,7 +1,6 @@ // build-pass #![crate_type = "lib"] -#![allow(incomplete_features)] #![feature(staged_api)] #![feature(const_trait_impl)] #![stable(feature = "foo", since = "1.0.0")] diff --git a/src/test/ui/rfc-2632-const-trait-impl/assoc-type.rs b/src/test/ui/rfc-2632-const-trait-impl/assoc-type.rs index 5a66af1d29e94..4a1bd5da98b8a 100644 --- a/src/test/ui/rfc-2632-const-trait-impl/assoc-type.rs +++ b/src/test/ui/rfc-2632-const-trait-impl/assoc-type.rs @@ -3,7 +3,6 @@ // FIXME: This test should fail since, within a const impl of `Foo`, the bound on `Foo::Bar` should // require a const impl of `Add` for the associated type. -#![allow(incomplete_features)] #![feature(const_trait_impl)] struct NonConstAdd(i32); diff --git a/src/test/ui/rfc-2632-const-trait-impl/attr-misuse.rs b/src/test/ui/rfc-2632-const-trait-impl/attr-misuse.rs index 338ac3d250536..be73ec09ceb3b 100644 --- a/src/test/ui/rfc-2632-const-trait-impl/attr-misuse.rs +++ b/src/test/ui/rfc-2632-const-trait-impl/attr-misuse.rs @@ -1,5 +1,4 @@ #![feature(const_trait_impl)] -#![allow(incomplete_features)] #[default_method_body_is_const] //~ ERROR attribute should be applied trait A { diff --git a/src/test/ui/rfc-2632-const-trait-impl/attr-misuse.stderr b/src/test/ui/rfc-2632-const-trait-impl/attr-misuse.stderr index 3af71d6ff78fb..fcb7e15b205e9 100644 --- a/src/test/ui/rfc-2632-const-trait-impl/attr-misuse.stderr +++ b/src/test/ui/rfc-2632-const-trait-impl/attr-misuse.stderr @@ -1,5 +1,5 @@ error: attribute should be applied to a trait method with body - --> $DIR/attr-misuse.rs:4:1 + --> $DIR/attr-misuse.rs:3:1 | LL | #[default_method_body_is_const] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -13,7 +13,7 @@ LL | | } | |_- not a trait method or missing a body error: attribute should be applied to a trait method with body - --> $DIR/attr-misuse.rs:13:1 + --> $DIR/attr-misuse.rs:12:1 | LL | #[default_method_body_is_const] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -21,7 +21,7 @@ LL | fn main() {} | ------------ not a trait method or missing a body error: attribute should be applied to a trait method with body - --> $DIR/attr-misuse.rs:6:5 + --> $DIR/attr-misuse.rs:5:5 | LL | #[default_method_body_is_const] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/rfc-2632-const-trait-impl/auxiliary/cross-crate.rs b/src/test/ui/rfc-2632-const-trait-impl/auxiliary/cross-crate.rs index 4285eaf18aaad..d8fd7ef3c1f44 100644 --- a/src/test/ui/rfc-2632-const-trait-impl/auxiliary/cross-crate.rs +++ b/src/test/ui/rfc-2632-const-trait-impl/auxiliary/cross-crate.rs @@ -1,5 +1,4 @@ #![feature(const_trait_impl)] -#![allow(incomplete_features)] pub trait MyTrait { fn func(self); diff --git a/src/test/ui/rfc-2632-const-trait-impl/auxiliary/staged-api.rs b/src/test/ui/rfc-2632-const-trait-impl/auxiliary/staged-api.rs index 734ce17001edd..80e61ab0a9e8b 100644 --- a/src/test/ui/rfc-2632-const-trait-impl/auxiliary/staged-api.rs +++ b/src/test/ui/rfc-2632-const-trait-impl/auxiliary/staged-api.rs @@ -1,5 +1,4 @@ #![feature(const_trait_impl)] -#![allow(incomplete_features)] #![feature(staged_api)] #![stable(feature = "rust1", since = "1.0.0")] diff --git a/src/test/ui/rfc-2632-const-trait-impl/call-const-trait-method-fail.rs b/src/test/ui/rfc-2632-const-trait-impl/call-const-trait-method-fail.rs index fa5570d5454a0..33e839fd1203d 100644 --- a/src/test/ui/rfc-2632-const-trait-impl/call-const-trait-method-fail.rs +++ b/src/test/ui/rfc-2632-const-trait-impl/call-const-trait-method-fail.rs @@ -1,4 +1,3 @@ -#![allow(incomplete_features)] #![feature(const_trait_impl)] pub trait Plus { diff --git a/src/test/ui/rfc-2632-const-trait-impl/call-const-trait-method-fail.stderr b/src/test/ui/rfc-2632-const-trait-impl/call-const-trait-method-fail.stderr index d3f350e1b61db..5a73c4debb481 100644 --- a/src/test/ui/rfc-2632-const-trait-impl/call-const-trait-method-fail.stderr +++ b/src/test/ui/rfc-2632-const-trait-impl/call-const-trait-method-fail.stderr @@ -1,5 +1,5 @@ error[E0015]: calls in constant functions are limited to constant functions, tuple structs and tuple variants - --> $DIR/call-const-trait-method-fail.rs:25:5 + --> $DIR/call-const-trait-method-fail.rs:24:5 | LL | a.plus(b) | ^^^^^^^^^ diff --git a/src/test/ui/rfc-2632-const-trait-impl/call-const-trait-method-pass.rs b/src/test/ui/rfc-2632-const-trait-impl/call-const-trait-method-pass.rs index 44814b0654e91..cf38bc3c96453 100644 --- a/src/test/ui/rfc-2632-const-trait-impl/call-const-trait-method-pass.rs +++ b/src/test/ui/rfc-2632-const-trait-impl/call-const-trait-method-pass.rs @@ -1,6 +1,5 @@ // run-pass -#![allow(incomplete_features)] #![feature(const_trait_impl)] struct Int(i32); diff --git a/src/test/ui/rfc-2632-const-trait-impl/call-generic-method-chain.rs b/src/test/ui/rfc-2632-const-trait-impl/call-generic-method-chain.rs index 47eed89d03d2d..f3391aa63468c 100644 --- a/src/test/ui/rfc-2632-const-trait-impl/call-generic-method-chain.rs +++ b/src/test/ui/rfc-2632-const-trait-impl/call-generic-method-chain.rs @@ -4,7 +4,6 @@ #![feature(const_trait_impl)] #![feature(const_fn_trait_bound)] -#![allow(incomplete_features)] struct S; diff --git a/src/test/ui/rfc-2632-const-trait-impl/call-generic-method-nonconst.rs b/src/test/ui/rfc-2632-const-trait-impl/call-generic-method-nonconst.rs index 9aefe6380cb18..087f8fbdcd1ea 100644 --- a/src/test/ui/rfc-2632-const-trait-impl/call-generic-method-nonconst.rs +++ b/src/test/ui/rfc-2632-const-trait-impl/call-generic-method-nonconst.rs @@ -2,7 +2,6 @@ // ignore-test #![feature(const_trait_impl)] -#![allow(incomplete_features)] struct S; diff --git a/src/test/ui/rfc-2632-const-trait-impl/call-generic-method-pass.rs b/src/test/ui/rfc-2632-const-trait-impl/call-generic-method-pass.rs index 953a65111990e..aee88d6053eee 100644 --- a/src/test/ui/rfc-2632-const-trait-impl/call-generic-method-pass.rs +++ b/src/test/ui/rfc-2632-const-trait-impl/call-generic-method-pass.rs @@ -4,7 +4,6 @@ #![feature(const_trait_impl)] #![feature(const_fn_trait_bound)] -#![allow(incomplete_features)] struct S; diff --git a/src/test/ui/rfc-2632-const-trait-impl/const-and-non-const-impl.rs b/src/test/ui/rfc-2632-const-trait-impl/const-and-non-const-impl.rs index e148ad9a0ee14..4b2f049b99d9e 100644 --- a/src/test/ui/rfc-2632-const-trait-impl/const-and-non-const-impl.rs +++ b/src/test/ui/rfc-2632-const-trait-impl/const-and-non-const-impl.rs @@ -1,4 +1,3 @@ -#![allow(incomplete_features)] #![feature(const_trait_impl)] pub struct Int(i32); diff --git a/src/test/ui/rfc-2632-const-trait-impl/const-and-non-const-impl.stderr b/src/test/ui/rfc-2632-const-trait-impl/const-and-non-const-impl.stderr index 99560ed06888a..a0960a21d46f8 100644 --- a/src/test/ui/rfc-2632-const-trait-impl/const-and-non-const-impl.stderr +++ b/src/test/ui/rfc-2632-const-trait-impl/const-and-non-const-impl.stderr @@ -1,5 +1,5 @@ error[E0119]: conflicting implementations of trait `std::ops::Add` for type `i32` - --> $DIR/const-and-non-const-impl.rs:6:1 + --> $DIR/const-and-non-const-impl.rs:5:1 | LL | impl const std::ops::Add for i32 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -8,7 +8,7 @@ LL | impl const std::ops::Add for i32 { - impl Add for i32; error[E0119]: conflicting implementations of trait `std::ops::Add` for type `Int` - --> $DIR/const-and-non-const-impl.rs:24:1 + --> $DIR/const-and-non-const-impl.rs:23:1 | LL | impl std::ops::Add for Int { | -------------------------- first implementation here @@ -17,7 +17,7 @@ LL | impl const std::ops::Add for Int { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `Int` error[E0117]: only traits defined in the current crate can be implemented for arbitrary types - --> $DIR/const-and-non-const-impl.rs:6:1 + --> $DIR/const-and-non-const-impl.rs:5:1 | LL | impl const std::ops::Add for i32 { | ^^^^^^^^^^^-------------^^^^^--- diff --git a/src/test/ui/rfc-2632-const-trait-impl/const-check-fns-in-const-impl.rs b/src/test/ui/rfc-2632-const-trait-impl/const-check-fns-in-const-impl.rs index fc85e98ef5326..3a7074163523b 100644 --- a/src/test/ui/rfc-2632-const-trait-impl/const-check-fns-in-const-impl.rs +++ b/src/test/ui/rfc-2632-const-trait-impl/const-check-fns-in-const-impl.rs @@ -1,4 +1,3 @@ -#![allow(incomplete_features)] #![feature(const_trait_impl)] struct S; diff --git a/src/test/ui/rfc-2632-const-trait-impl/const-check-fns-in-const-impl.stderr b/src/test/ui/rfc-2632-const-trait-impl/const-check-fns-in-const-impl.stderr index c6c78c7d1e895..aaec67161a6af 100644 --- a/src/test/ui/rfc-2632-const-trait-impl/const-check-fns-in-const-impl.stderr +++ b/src/test/ui/rfc-2632-const-trait-impl/const-check-fns-in-const-impl.stderr @@ -1,5 +1,5 @@ error[E0015]: calls in constant functions are limited to constant functions, tuple structs and tuple variants - --> $DIR/const-check-fns-in-const-impl.rs:12:16 + --> $DIR/const-check-fns-in-const-impl.rs:11:16 | LL | fn foo() { non_const() } | ^^^^^^^^^^^ diff --git a/src/test/ui/rfc-2632-const-trait-impl/const-default-method-bodies.rs b/src/test/ui/rfc-2632-const-trait-impl/const-default-method-bodies.rs index d08c01750c379..7a0db9c98ea61 100644 --- a/src/test/ui/rfc-2632-const-trait-impl/const-default-method-bodies.rs +++ b/src/test/ui/rfc-2632-const-trait-impl/const-default-method-bodies.rs @@ -1,6 +1,5 @@ #![feature(const_trait_impl)] #![feature(const_fn_trait_bound)] // FIXME is this needed? -#![allow(incomplete_features)] trait ConstDefaultFn: Sized { fn b(self); diff --git a/src/test/ui/rfc-2632-const-trait-impl/const-default-method-bodies.stderr b/src/test/ui/rfc-2632-const-trait-impl/const-default-method-bodies.stderr index d52e83609489b..63e4095af2943 100644 --- a/src/test/ui/rfc-2632-const-trait-impl/const-default-method-bodies.stderr +++ b/src/test/ui/rfc-2632-const-trait-impl/const-default-method-bodies.stderr @@ -1,5 +1,5 @@ error[E0015]: calls in constant functions are limited to constant functions, tuple structs and tuple variants - --> $DIR/const-default-method-bodies.rs:26:5 + --> $DIR/const-default-method-bodies.rs:25:5 | LL | NonConstImpl.a(); | ^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/rfc-2632-const-trait-impl/const-impl-norecover.rs b/src/test/ui/rfc-2632-const-trait-impl/const-impl-norecover.rs index 936c90e88aaee..bed4e9fd1e610 100644 --- a/src/test/ui/rfc-2632-const-trait-impl/const-impl-norecover.rs +++ b/src/test/ui/rfc-2632-const-trait-impl/const-impl-norecover.rs @@ -1,5 +1,4 @@ #![feature(const_trait_impl)] -#![allow(incomplete_features)] struct Foo; diff --git a/src/test/ui/rfc-2632-const-trait-impl/const-impl-norecover.stderr b/src/test/ui/rfc-2632-const-trait-impl/const-impl-norecover.stderr index 612511a479956..603f6b7d2835e 100644 --- a/src/test/ui/rfc-2632-const-trait-impl/const-impl-norecover.stderr +++ b/src/test/ui/rfc-2632-const-trait-impl/const-impl-norecover.stderr @@ -1,5 +1,5 @@ error: expected identifier, found keyword `impl` - --> $DIR/const-impl-norecover.rs:6:7 + --> $DIR/const-impl-norecover.rs:5:7 | LL | const impl Foo { | ^^^^ expected identifier, found keyword diff --git a/src/test/ui/rfc-2632-const-trait-impl/const-impl-recovery.rs b/src/test/ui/rfc-2632-const-trait-impl/const-impl-recovery.rs index fd3dd2cef9d1c..470c653dd4701 100644 --- a/src/test/ui/rfc-2632-const-trait-impl/const-impl-recovery.rs +++ b/src/test/ui/rfc-2632-const-trait-impl/const-impl-recovery.rs @@ -1,5 +1,4 @@ #![feature(const_trait_impl)] -#![allow(incomplete_features)] trait Foo {} diff --git a/src/test/ui/rfc-2632-const-trait-impl/const-impl-recovery.stderr b/src/test/ui/rfc-2632-const-trait-impl/const-impl-recovery.stderr index 84fb619dc9648..f815389ff01c3 100644 --- a/src/test/ui/rfc-2632-const-trait-impl/const-impl-recovery.stderr +++ b/src/test/ui/rfc-2632-const-trait-impl/const-impl-recovery.stderr @@ -1,5 +1,5 @@ error: expected identifier, found keyword `impl` - --> $DIR/const-impl-recovery.rs:6:7 + --> $DIR/const-impl-recovery.rs:5:7 | LL | const impl Foo for i32 {} | ^^^^ expected identifier, found keyword @@ -10,7 +10,7 @@ LL | impl const Foo for i32 {} |-- ^^^^^ error: expected identifier, found keyword `impl` - --> $DIR/const-impl-recovery.rs:10:7 + --> $DIR/const-impl-recovery.rs:9:7 | LL | const impl Bar for T {} | ^^^^ expected identifier, found keyword diff --git a/src/test/ui/rfc-2632-const-trait-impl/cross-crate.gated.stderr b/src/test/ui/rfc-2632-const-trait-impl/cross-crate.gated.stderr index 30baa38547580..3f553a8ee7079 100644 --- a/src/test/ui/rfc-2632-const-trait-impl/cross-crate.gated.stderr +++ b/src/test/ui/rfc-2632-const-trait-impl/cross-crate.gated.stderr @@ -1,5 +1,5 @@ error[E0015]: calls in constant functions are limited to constant functions, tuple structs and tuple variants - --> $DIR/cross-crate.rs:16:5 + --> $DIR/cross-crate.rs:15:5 | LL | NonConst.func(); | ^^^^^^^^^^^^^^^ diff --git a/src/test/ui/rfc-2632-const-trait-impl/cross-crate.rs b/src/test/ui/rfc-2632-const-trait-impl/cross-crate.rs index c28ff63895841..4bd3359947d94 100644 --- a/src/test/ui/rfc-2632-const-trait-impl/cross-crate.rs +++ b/src/test/ui/rfc-2632-const-trait-impl/cross-crate.rs @@ -1,6 +1,5 @@ // revisions: stock gated #![cfg_attr(gated, feature(const_trait_impl))] -#![allow(incomplete_features)] // aux-build: cross-crate.rs extern crate cross_crate; diff --git a/src/test/ui/rfc-2632-const-trait-impl/cross-crate.stock.stderr b/src/test/ui/rfc-2632-const-trait-impl/cross-crate.stock.stderr index e6a86f251ca3c..9908f47a7b288 100644 --- a/src/test/ui/rfc-2632-const-trait-impl/cross-crate.stock.stderr +++ b/src/test/ui/rfc-2632-const-trait-impl/cross-crate.stock.stderr @@ -1,11 +1,11 @@ error[E0015]: calls in constant functions are limited to constant functions, tuple structs and tuple variants - --> $DIR/cross-crate.rs:16:5 + --> $DIR/cross-crate.rs:15:5 | LL | NonConst.func(); | ^^^^^^^^^^^^^^^ error[E0015]: calls in constant functions are limited to constant functions, tuple structs and tuple variants - --> $DIR/cross-crate.rs:18:5 + --> $DIR/cross-crate.rs:17:5 | LL | Const.func(); | ^^^^^^^^^^^^ diff --git a/src/test/ui/rfc-2632-const-trait-impl/feature-gate.gated.stderr b/src/test/ui/rfc-2632-const-trait-impl/feature-gate.gated.stderr index 4c630d33c5516..af4d3909e4051 100644 --- a/src/test/ui/rfc-2632-const-trait-impl/feature-gate.gated.stderr +++ b/src/test/ui/rfc-2632-const-trait-impl/feature-gate.gated.stderr @@ -1,5 +1,5 @@ error: fatal error triggered by #[rustc_error] - --> $DIR/feature-gate.rs:14:1 + --> $DIR/feature-gate.rs:13:1 | LL | fn main() {} | ^^^^^^^^^ diff --git a/src/test/ui/rfc-2632-const-trait-impl/feature-gate.rs b/src/test/ui/rfc-2632-const-trait-impl/feature-gate.rs index d9772431941d3..7bac72e1bb6fb 100644 --- a/src/test/ui/rfc-2632-const-trait-impl/feature-gate.rs +++ b/src/test/ui/rfc-2632-const-trait-impl/feature-gate.rs @@ -2,7 +2,6 @@ // gate-test-const_trait_impl #![cfg_attr(gated, feature(const_trait_impl))] -#![allow(incomplete_features)] #![feature(rustc_attrs)] struct S; diff --git a/src/test/ui/rfc-2632-const-trait-impl/feature-gate.stock.stderr b/src/test/ui/rfc-2632-const-trait-impl/feature-gate.stock.stderr index 724090e49cd41..91a8bb578a829 100644 --- a/src/test/ui/rfc-2632-const-trait-impl/feature-gate.stock.stderr +++ b/src/test/ui/rfc-2632-const-trait-impl/feature-gate.stock.stderr @@ -1,5 +1,5 @@ error[E0658]: const trait impls are experimental - --> $DIR/feature-gate.rs:10:6 + --> $DIR/feature-gate.rs:9:6 | LL | impl const T for S {} | ^^^^^ diff --git a/src/test/ui/rfc-2632-const-trait-impl/generic-bound.rs b/src/test/ui/rfc-2632-const-trait-impl/generic-bound.rs index d368082031260..91c3d2d5920bc 100644 --- a/src/test/ui/rfc-2632-const-trait-impl/generic-bound.rs +++ b/src/test/ui/rfc-2632-const-trait-impl/generic-bound.rs @@ -1,6 +1,5 @@ // run-pass -#![allow(incomplete_features)] #![feature(const_trait_impl)] #![feature(const_fn_trait_bound)] diff --git a/src/test/ui/rfc-2632-const-trait-impl/hir-const-check.rs b/src/test/ui/rfc-2632-const-trait-impl/hir-const-check.rs index ad14dd62bc7b5..80a4442de2cba 100644 --- a/src/test/ui/rfc-2632-const-trait-impl/hir-const-check.rs +++ b/src/test/ui/rfc-2632-const-trait-impl/hir-const-check.rs @@ -1,7 +1,6 @@ // Regression test for #69615. #![feature(const_trait_impl)] -#![allow(incomplete_features)] pub trait MyTrait { fn method(&self) -> Option<()>; diff --git a/src/test/ui/rfc-2632-const-trait-impl/hir-const-check.stderr b/src/test/ui/rfc-2632-const-trait-impl/hir-const-check.stderr index 8c76d7eb597b6..3ec329cba1eb2 100644 --- a/src/test/ui/rfc-2632-const-trait-impl/hir-const-check.stderr +++ b/src/test/ui/rfc-2632-const-trait-impl/hir-const-check.stderr @@ -1,5 +1,5 @@ error[E0744]: `?` is not allowed in a `const fn` - --> $DIR/hir-const-check.rs:12:9 + --> $DIR/hir-const-check.rs:11:9 | LL | Some(())?; | ^^^^^^^^^ diff --git a/src/test/ui/rfc-2632-const-trait-impl/impl-with-default-fn.rs b/src/test/ui/rfc-2632-const-trait-impl/impl-with-default-fn.rs index def7c34b4e50e..59de9e9571944 100644 --- a/src/test/ui/rfc-2632-const-trait-impl/impl-with-default-fn.rs +++ b/src/test/ui/rfc-2632-const-trait-impl/impl-with-default-fn.rs @@ -1,5 +1,4 @@ #![feature(const_trait_impl)] -#![allow(incomplete_features)] trait Tr { fn req(&self); diff --git a/src/test/ui/rfc-2632-const-trait-impl/impl-with-default-fn.stderr b/src/test/ui/rfc-2632-const-trait-impl/impl-with-default-fn.stderr index eb7f899b4dee2..5301e0ad12ef1 100644 --- a/src/test/ui/rfc-2632-const-trait-impl/impl-with-default-fn.stderr +++ b/src/test/ui/rfc-2632-const-trait-impl/impl-with-default-fn.stderr @@ -1,5 +1,5 @@ error: const trait implementations may not use non-const default functions - --> $DIR/impl-with-default-fn.rs:18:1 + --> $DIR/impl-with-default-fn.rs:17:1 | LL | / impl const Tr for S { LL | | fn req(&self) {} @@ -9,7 +9,7 @@ LL | | } = note: `prov` not implemented error: const trait implementations may not use non-const default functions - --> $DIR/impl-with-default-fn.rs:33:1 + --> $DIR/impl-with-default-fn.rs:32:1 | LL | / impl const Tr for u32 { LL | | fn req(&self) {} @@ -20,7 +20,7 @@ LL | | } = note: `prov` not implemented error[E0046]: not all trait items implemented, missing: `req` - --> $DIR/impl-with-default-fn.rs:27:1 + --> $DIR/impl-with-default-fn.rs:26:1 | LL | fn req(&self); | -------------- `req` from trait diff --git a/src/test/ui/rfc-2632-const-trait-impl/stability.rs b/src/test/ui/rfc-2632-const-trait-impl/stability.rs index 454fde34a2cdc..6b54a9eab5205 100644 --- a/src/test/ui/rfc-2632-const-trait-impl/stability.rs +++ b/src/test/ui/rfc-2632-const-trait-impl/stability.rs @@ -1,4 +1,3 @@ -#![allow(incomplete_features)] #![feature(allow_internal_unstable)] #![feature(const_add)] #![feature(const_trait_impl)] diff --git a/src/test/ui/rfc-2632-const-trait-impl/stability.stderr b/src/test/ui/rfc-2632-const-trait-impl/stability.stderr index 5b2ebccef1c6d..86b685959a6cb 100644 --- a/src/test/ui/rfc-2632-const-trait-impl/stability.stderr +++ b/src/test/ui/rfc-2632-const-trait-impl/stability.stderr @@ -1,5 +1,5 @@ error: trait methods cannot be stable const fn - --> $DIR/stability.rs:14:5 + --> $DIR/stability.rs:13:5 | LL | / fn sub(self, rhs: Self) -> Self { LL | | @@ -8,7 +8,7 @@ LL | | } | |_____^ error: `::add` is not yet stable as a const fn - --> $DIR/stability.rs:32:5 + --> $DIR/stability.rs:31:5 | LL | Int(1i32) + Int(2i32) | ^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/rfc-2632-const-trait-impl/syntax.rs b/src/test/ui/rfc-2632-const-trait-impl/syntax.rs index 354d48d630f7b..82a1275bffaed 100644 --- a/src/test/ui/rfc-2632-const-trait-impl/syntax.rs +++ b/src/test/ui/rfc-2632-const-trait-impl/syntax.rs @@ -3,7 +3,6 @@ #![feature(const_trait_bound_opt_out)] #![feature(const_trait_impl)] -#![allow(incomplete_features)] // For now, this parses since an error does not occur until AST lowering. impl ?const T {} diff --git a/src/test/ui/suggestions/suggest-full-enum-variant-for-local-module.rs b/src/test/ui/suggestions/suggest-full-enum-variant-for-local-module.rs new file mode 100644 index 0000000000000..1dfc0786668f2 --- /dev/null +++ b/src/test/ui/suggestions/suggest-full-enum-variant-for-local-module.rs @@ -0,0 +1,10 @@ +mod option { + pub enum O { + Some(T), + None, + } +} + +fn main() { + let _: option::O<()> = (); //~ ERROR 9:28: 9:30: mismatched types [E0308] +} diff --git a/src/test/ui/suggestions/suggest-full-enum-variant-for-local-module.stderr b/src/test/ui/suggestions/suggest-full-enum-variant-for-local-module.stderr new file mode 100644 index 0000000000000..22a0ce1e91d72 --- /dev/null +++ b/src/test/ui/suggestions/suggest-full-enum-variant-for-local-module.stderr @@ -0,0 +1,16 @@ +error[E0308]: mismatched types + --> $DIR/suggest-full-enum-variant-for-local-module.rs:9:28 + | +LL | let _: option::O<()> = (); + | ------------- ^^ + | | | + | | expected enum `O`, found `()` + | | help: try using a variant of the expected enum: `option::O::Some(())` + | expected due to this + | + = note: expected enum `O<()>` + found unit type `()` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/type-alias-impl-trait/issue-60371.rs b/src/test/ui/type-alias-impl-trait/issue-60371.rs index 4ac7f9423ff41..b7c8a58a65629 100644 --- a/src/test/ui/type-alias-impl-trait/issue-60371.rs +++ b/src/test/ui/type-alias-impl-trait/issue-60371.rs @@ -9,7 +9,7 @@ trait Bug { impl Bug for &() { type Item = impl Bug; //~ ERROR `impl Trait` in type aliases is unstable //~^ ERROR the trait bound `(): Bug` is not satisfied - //~^^ ERROR could not find defining uses + //~^^ ERROR the trait bound `(): Bug` is not satisfied const FUN: fn() -> Self::Item = || (); //~^ ERROR type alias impl trait is not permitted here diff --git a/src/test/ui/type-alias-impl-trait/issue-60371.stderr b/src/test/ui/type-alias-impl-trait/issue-60371.stderr index 255d381bf0683..6857d5264b65e 100644 --- a/src/test/ui/type-alias-impl-trait/issue-60371.stderr +++ b/src/test/ui/type-alias-impl-trait/issue-60371.stderr @@ -25,11 +25,14 @@ LL | type Item = impl Bug; = help: the following implementations were found: <&() as Bug> -error: could not find defining uses +error[E0277]: the trait bound `(): Bug` is not satisfied --> $DIR/issue-60371.rs:10:17 | LL | type Item = impl Bug; - | ^^^^^^^^ + | ^^^^^^^^ the trait `Bug` is not implemented for `()` + | + = help: the following implementations were found: + <&() as Bug> error: aborting due to 4 previous errors diff --git a/src/test/ui/type-alias-impl-trait/issue-85113.rs b/src/test/ui/type-alias-impl-trait/issue-85113.rs index b09833f3ed014..0c37399df8dd2 100644 --- a/src/test/ui/type-alias-impl-trait/issue-85113.rs +++ b/src/test/ui/type-alias-impl-trait/issue-85113.rs @@ -12,6 +12,7 @@ trait Output<'a> {} impl<'a> Output<'a> for &'a str {} fn cool_fn<'a>(arg: &'a str) -> OpaqueOutputImpl<'a> { + //~^ ERROR: concrete type differs from previous defining opaque type use let out: OpaqueOutputImpl<'a> = arg; arg } diff --git a/src/test/ui/type-alias-impl-trait/issue-85113.stderr b/src/test/ui/type-alias-impl-trait/issue-85113.stderr index 361d66866ef8b..233c996340d84 100644 --- a/src/test/ui/type-alias-impl-trait/issue-85113.stderr +++ b/src/test/ui/type-alias-impl-trait/issue-85113.stderr @@ -10,6 +10,18 @@ note: hidden type `&' str` captures lifetime smaller than the function bo LL | type OpaqueOutputImpl<'a> = impl Output<'a> + 'a; | ^^^^^^^^^^^^^^^^^^^^ +error: concrete type differs from previous defining opaque type use + --> $DIR/issue-85113.rs:14:1 + | +LL | fn cool_fn<'a>(arg: &'a str) -> OpaqueOutputImpl<'a> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `&' str`, got `&'a str` + | +note: previous use here + --> $DIR/issue-85113.rs:14:1 + | +LL | fn cool_fn<'a>(arg: &'a str) -> OpaqueOutputImpl<'a> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + error[E0477]: the type `&' str` does not fulfill the required lifetime --> $DIR/issue-85113.rs:5:29 | @@ -42,7 +54,7 @@ LL | type OpaqueOutputImpl<'a> = impl Output<'a> + 'a; = note: expected `Output<'a>` found `Output<'_>` -error: aborting due to 3 previous errors +error: aborting due to 4 previous errors Some errors have detailed explanations: E0477, E0495, E0700. For more information about an error, try `rustc --explain E0477`.