authorbors <bors@rust-lang.org> 2024-07-24 22:37:03 UTC
committerbors <bors@rust-lang.org> 2024-07-24 22:37:03 UTC
loge7d66eac5e8e8f60370c98d186aee9fa0ebd7845
tree97016eb7002b3db48e8c6d44226eaf59c49eb214
parentc1a6199e9d92bb785c17a6d7ffd8b8b552f79c10
parent104a421a46f9756a3ebc1a77c40878479e99993e

Auto merge of #128155 - matthiaskrgr:rollup-lxtal9f, r=matthiaskrgr

Rollup of 8 pull requests Successful merges: - #122192 (Do not try to reveal hidden types when trying to prove auto-traits in the defining scope) - #126042 (Implement `unsigned_signed_diff`) - #126548 (Improved clarity of documentation for std::fs::create_dir_all) - #127717 (Fix malformed suggestion for repeated maybe unsized bounds) - #128046 (Fix some `#[cfg_attr(not(doc), repr(..))]`) - #128122 (Mark `missing_fragment_specifier` as `FutureReleaseErrorReportInDeps`) - #128135 (std: use duplicate thread local state in tests) - #128140 (Remove Unnecessary `.as_str()` Conversions) r? `@ghost` `@rustbot` modify labels: rollup

53 files changed, 742 insertions(+), 335 deletions(-)

compiler/rustc_const_eval/src/check_consts/qualifs.rs+27-1
......@@ -100,7 +100,33 @@ impl Qualif for HasMutInterior {
100100 }
101101
102102 fn in_any_value_of_ty<'tcx>(cx: &ConstCx<'_, 'tcx>, ty: Ty<'tcx>) -> bool {
103 !ty.is_freeze(cx.tcx, cx.param_env)
103 // Avoid selecting for simple cases, such as builtin types.
104 if ty.is_trivially_freeze() {
105 return false;
106 }
107
108 // We do not use `ty.is_freeze` here, because that requires revealing opaque types, which
109 // requires borrowck, which in turn will invoke mir_const_qualifs again, causing a cycle error.
110 // Instead we invoke an obligation context manually, and provide the opaque type inference settings
111 // that allow the trait solver to just error out instead of cycling.
112 let freeze_def_id = cx.tcx.require_lang_item(LangItem::Freeze, Some(cx.body.span));
113
114 let obligation = Obligation::new(
115 cx.tcx,
116 ObligationCause::dummy_with_span(cx.body.span),
117 cx.param_env,
118 ty::TraitRef::new(cx.tcx, freeze_def_id, [ty::GenericArg::from(ty)]),
119 );
120
121 let infcx = cx
122 .tcx
123 .infer_ctxt()
124 .with_opaque_type_inference(cx.body.source.def_id().expect_local())
125 .build();
126 let ocx = ObligationCtxt::new(&infcx);
127 ocx.register_obligation(obligation);
128 let errors = ocx.select_all_or_error();
129 !errors.is_empty()
104130 }
105131
106132 fn in_adt_inherently<'tcx>(
compiler/rustc_hir/src/hir.rs+15-9
......@@ -763,7 +763,7 @@ impl<'hir> Generics<'hir> {
763763 )
764764 }
765765
766 fn span_for_predicate_removal(&self, pos: usize) -> Span {
766 pub fn span_for_predicate_removal(&self, pos: usize) -> Span {
767767 let predicate = &self.predicates[pos];
768768 let span = predicate.span();
769769
......@@ -806,15 +806,21 @@ impl<'hir> Generics<'hir> {
806806 return self.span_for_predicate_removal(predicate_pos);
807807 }
808808
809 let span = bounds[bound_pos].span();
810 if bound_pos == 0 {
811 // where T: ?Sized + Bar, Foo: Bar,
812 // ^^^^^^^^^
813 span.to(bounds[1].span().shrink_to_lo())
809 let bound_span = bounds[bound_pos].span();
810 if bound_pos < bounds.len() - 1 {
811 // If there's another bound after the current bound
812 // include the following '+' e.g.:
813 //
814 // `T: Foo + CurrentBound + Bar`
815 // ^^^^^^^^^^^^^^^
816 bound_span.to(bounds[bound_pos + 1].span().shrink_to_lo())
814817 } else {
815 // where T: Bar + ?Sized, Foo: Bar,
816 // ^^^^^^^^^
817 bounds[bound_pos - 1].span().shrink_to_hi().to(span)
818 // If the current bound is the last bound
819 // include the preceding '+' E.g.:
820 //
821 // `T: Foo + Bar + CurrentBound`
822 // ^^^^^^^^^^^^^^^
823 bound_span.with_lo(bounds[bound_pos - 1].span().hi())
818824 }
819825 }
820826}
compiler/rustc_hir_typeck/src/method/probe.rs+4-4
......@@ -1846,7 +1846,7 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
18461846 /// Determine if the associated item with the given DefId matches
18471847 /// the desired name via a doc alias.
18481848 fn matches_by_doc_alias(&self, def_id: DefId) -> bool {
1849 let Some(name) = self.method_name else {
1849 let Some(method) = self.method_name else {
18501850 return false;
18511851 };
18521852 let Some(local_def_id) = def_id.as_local() else {
......@@ -1863,7 +1863,7 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
18631863 // #[rustc_confusables("foo", "bar"))]
18641864 for n in confusables {
18651865 if let Some(lit) = n.lit()
1866 && name.as_str() == lit.symbol.as_str()
1866 && method.name == lit.symbol
18671867 {
18681868 return true;
18691869 }
......@@ -1883,14 +1883,14 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
18831883 // #[doc(alias("foo", "bar"))]
18841884 for n in nested {
18851885 if let Some(lit) = n.lit()
1886 && name.as_str() == lit.symbol.as_str()
1886 && method.name == lit.symbol
18871887 {
18881888 return true;
18891889 }
18901890 }
18911891 } else if let Some(meta) = v.meta_item()
18921892 && let Some(lit) = meta.name_value_literal()
1893 && name.as_str() == lit.symbol.as_str()
1893 && method.name == lit.symbol
18941894 {
18951895 // #[doc(alias = "foo")]
18961896 return true;
compiler/rustc_lint_defs/src/builtin.rs+1-1
......@@ -1424,7 +1424,7 @@ declare_lint! {
14241424 Deny,
14251425 "detects missing fragment specifiers in unused `macro_rules!` patterns",
14261426 @future_incompatible = FutureIncompatibleInfo {
1427 reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps,
1427 reason: FutureIncompatibilityReason::FutureReleaseErrorReportInDeps,
14281428 reference: "issue #40107 <https://github.com/rust-lang/rust/issues/40107>",
14291429 };
14301430}
compiler/rustc_middle/src/ty/diagnostics.rs+49-20
......@@ -188,31 +188,60 @@ fn suggest_changing_unsized_bound(
188188 continue;
189189 };
190190
191 for (pos, bound) in predicate.bounds.iter().enumerate() {
192 let hir::GenericBound::Trait(poly, hir::TraitBoundModifier::Maybe) = bound else {
193 continue;
194 };
195 if poly.trait_ref.trait_def_id() != def_id {
196 continue;
197 }
198 if predicate.origin == PredicateOrigin::ImplTrait && predicate.bounds.len() == 1 {
199 // For `impl ?Sized` with no other bounds, suggest `impl Sized` instead.
200 let bound_span = bound.span();
201 if bound_span.can_be_used_for_suggestions() {
202 let question_span = bound_span.with_hi(bound_span.lo() + BytePos(1));
203 suggestions.push((
191 let unsized_bounds = predicate
192 .bounds
193 .iter()
194 .enumerate()
195 .filter(|(_, bound)| {
196 if let hir::GenericBound::Trait(poly, hir::TraitBoundModifier::Maybe) = bound
197 && poly.trait_ref.trait_def_id() == def_id
198 {
199 true
200 } else {
201 false
202 }
203 })
204 .collect::<Vec<_>>();
205
206 if unsized_bounds.is_empty() {
207 continue;
208 }
209
210 let mut push_suggestion = |sp, msg| suggestions.push((sp, String::new(), msg));
211
212 if predicate.bounds.len() == unsized_bounds.len() {
213 // All the bounds are unsized bounds, e.g.
214 // `T: ?Sized + ?Sized` or `_: impl ?Sized + ?Sized`,
215 // so in this case:
216 // - if it's an impl trait predicate suggest changing the
217 // the first bound to sized and removing the rest
218 // - Otherwise simply suggest removing the entire predicate
219 if predicate.origin == PredicateOrigin::ImplTrait {
220 let first_bound = unsized_bounds[0].1;
221 let first_bound_span = first_bound.span();
222 if first_bound_span.can_be_used_for_suggestions() {
223 let question_span =
224 first_bound_span.with_hi(first_bound_span.lo() + BytePos(1));
225 push_suggestion(
204226 question_span,
205 String::new(),
206227 SuggestChangingConstraintsMessage::ReplaceMaybeUnsizedWithSized,
207 ));
228 );
229
230 for (pos, _) in unsized_bounds.iter().skip(1) {
231 let sp = generics.span_for_bound_removal(where_pos, *pos);
232 push_suggestion(sp, SuggestChangingConstraintsMessage::RemoveMaybeUnsized);
233 }
208234 }
209235 } else {
236 let sp = generics.span_for_predicate_removal(where_pos);
237 push_suggestion(sp, SuggestChangingConstraintsMessage::RemoveMaybeUnsized);
238 }
239 } else {
240 // Some of the bounds are other than unsized.
241 // So push separate removal suggestion for each unsized bound
242 for (pos, _) in unsized_bounds {
210243 let sp = generics.span_for_bound_removal(where_pos, pos);
211 suggestions.push((
212 sp,
213 String::new(),
214 SuggestChangingConstraintsMessage::RemoveMaybeUnsized,
215 ));
244 push_suggestion(sp, SuggestChangingConstraintsMessage::RemoveMaybeUnsized);
216245 }
217246 }
218247 }
compiler/rustc_middle/src/ty/util.rs+1-1
......@@ -1268,7 +1268,7 @@ impl<'tcx> Ty<'tcx> {
12681268 ///
12691269 /// Returning true means the type is known to be `Freeze`. Returning
12701270 /// `false` means nothing -- could be `Freeze`, might not be.
1271 fn is_trivially_freeze(self) -> bool {
1271 pub fn is_trivially_freeze(self) -> bool {
12721272 match self.kind() {
12731273 ty::Int(_)
12741274 | ty::Uint(_)
compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs+6-1
......@@ -772,7 +772,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
772772 );
773773 }
774774
775 ty::Alias(ty::Opaque, _) => {
775 ty::Alias(ty::Opaque, alias) => {
776776 if candidates.vec.iter().any(|c| matches!(c, ProjectionCandidate(_))) {
777777 // We do not generate an auto impl candidate for `impl Trait`s which already
778778 // reference our auto trait.
......@@ -787,6 +787,11 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
787787 // We do not emit auto trait candidates for opaque types in coherence.
788788 // Doing so can result in weird dependency cycles.
789789 candidates.ambiguous = true;
790 } else if self.infcx.can_define_opaque_ty(alias.def_id) {
791 // We do not emit auto trait candidates for opaque types in their defining scope, as
792 // we need to know the hidden type first, which we can't reliably know within the defining
793 // scope.
794 candidates.ambiguous = true;
790795 } else {
791796 candidates.vec.push(AutoImplCandidate)
792797 }
compiler/rustc_trait_selection/src/traits/select/mod.rs+11-7
......@@ -2386,13 +2386,17 @@ impl<'tcx> SelectionContext<'_, 'tcx> {
23862386 }
23872387
23882388 ty::Alias(ty::Opaque, ty::AliasTy { def_id, args, .. }) => {
2389 // We can resolve the `impl Trait` to its concrete type,
2390 // which enforces a DAG between the functions requiring
2391 // the auto trait bounds in question.
2392 match self.tcx().type_of_opaque(def_id) {
2393 Ok(ty) => t.rebind(vec![ty.instantiate(self.tcx(), args)]),
2394 Err(_) => {
2395 return Err(SelectionError::OpaqueTypeAutoTraitLeakageUnknown(def_id));
2389 if self.infcx.can_define_opaque_ty(def_id) {
2390 unreachable!()
2391 } else {
2392 // We can resolve the `impl Trait` to its concrete type,
2393 // which enforces a DAG between the functions requiring
2394 // the auto trait bounds in question.
2395 match self.tcx().type_of_opaque(def_id) {
2396 Ok(ty) => t.rebind(vec![ty.instantiate(self.tcx(), args)]),
2397 Err(_) => {
2398 return Err(SelectionError::OpaqueTypeAutoTraitLeakageUnknown(def_id));
2399 }
23962400 }
23972401 }
23982402 }
library/core/src/error.rs+1-1
......@@ -506,7 +506,7 @@ where
506506/// ```
507507///
508508#[unstable(feature = "error_generic_member_access", issue = "99301")]
509#[cfg_attr(not(doc), repr(transparent))] // work around https://github.com/rust-lang/rust/issues/90435
509#[repr(transparent)]
510510pub struct Request<'a>(Tagged<dyn Erased<'a> + 'a>);
511511
512512impl<'a> Request<'a> {
library/core/src/ffi/c_str.rs+1-1
......@@ -103,7 +103,7 @@ use crate::str;
103103// However, `CStr` layout is considered an implementation detail and must not be relied upon. We
104104// want `repr(transparent)` but we don't want it to show up in rustdoc, so we hide it under
105105// `cfg(doc)`. This is an ad-hoc implementation of attribute privacy.
106#[cfg_attr(not(doc), repr(transparent))]
106#[repr(transparent)]
107107#[allow(clippy::derived_hash_with_manual_eq)]
108108pub struct CStr {
109109 // FIXME: this should not be represented with a DST slice but rather with
library/core/src/ffi/mod.rs+1-1
......@@ -191,7 +191,7 @@ mod c_long_definition {
191191// be UB.
192192#[doc = include_str!("c_void.md")]
193193#[lang = "c_void"]
194#[cfg_attr(not(doc), repr(u8))] // work around https://github.com/rust-lang/rust/issues/90435
194#[cfg_attr(not(doc), repr(u8))] // An implementation detail we don't want to show up in rustdoc
195195#[stable(feature = "core_c_void", since = "1.30.0")]
196196pub enum c_void {
197197 #[unstable(
library/core/src/ffi/va_list.rs+2-2
......@@ -23,7 +23,7 @@ use crate::ops::{Deref, DerefMut};
2323 target_os = "uefi",
2424 windows,
2525))]
26#[cfg_attr(not(doc), repr(transparent))] // work around https://github.com/rust-lang/rust/issues/90435
26#[repr(transparent)]
2727#[lang = "va_list"]
2828pub struct VaListImpl<'f> {
2929 ptr: *mut c_void,
......@@ -115,7 +115,7 @@ pub struct VaListImpl<'f> {
115115}
116116
117117/// A wrapper for a `va_list`
118#[cfg_attr(not(doc), repr(transparent))] // work around https://github.com/rust-lang/rust/issues/90435
118#[repr(transparent)]
119119#[derive(Debug)]
120120pub struct VaList<'a, 'f: 'a> {
121121 #[cfg(any(
library/core/src/num/uint_macros.rs+61
......@@ -765,6 +765,67 @@ macro_rules! uint_impl {
765765 }
766766 }
767767
768 #[doc = concat!(
769 "Checked integer subtraction. Computes `self - rhs` and checks if the result fits into an [`",
770 stringify!($SignedT), "`], returning `None` if overflow occurred."
771 )]
772 ///
773 /// # Examples
774 ///
775 /// Basic usage:
776 ///
777 /// ```
778 /// #![feature(unsigned_signed_diff)]
779 #[doc = concat!("assert_eq!(10", stringify!($SelfT), ".checked_signed_diff(2), Some(8));")]
780 #[doc = concat!("assert_eq!(2", stringify!($SelfT), ".checked_signed_diff(10), Some(-8));")]
781 #[doc = concat!(
782 "assert_eq!(",
783 stringify!($SelfT),
784 "::MAX.checked_signed_diff(",
785 stringify!($SignedT),
786 "::MAX as ",
787 stringify!($SelfT),
788 "), None);"
789 )]
790 #[doc = concat!(
791 "assert_eq!((",
792 stringify!($SignedT),
793 "::MAX as ",
794 stringify!($SelfT),
795 ").checked_signed_diff(",
796 stringify!($SelfT),
797 "::MAX), Some(",
798 stringify!($SignedT),
799 "::MIN));"
800 )]
801 #[doc = concat!(
802 "assert_eq!((",
803 stringify!($SignedT),
804 "::MAX as ",
805 stringify!($SelfT),
806 " + 1).checked_signed_diff(0), None);"
807 )]
808 #[doc = concat!(
809 "assert_eq!(",
810 stringify!($SelfT),
811 "::MAX.checked_signed_diff(",
812 stringify!($SelfT),
813 "::MAX), Some(0));"
814 )]
815 /// ```
816 #[unstable(feature = "unsigned_signed_diff", issue = "126041")]
817 #[inline]
818 pub const fn checked_signed_diff(self, rhs: Self) -> Option<$SignedT> {
819 let res = self.wrapping_sub(rhs) as $SignedT;
820 let overflow = (self >= rhs) == (res < 0);
821
822 if !overflow {
823 Some(res)
824 } else {
825 None
826 }
827 }
828
768829 /// Checked integer multiplication. Computes `self * rhs`, returning
769830 /// `None` if overflow occurred.
770831 ///
library/core/src/task/wake.rs+2-2
......@@ -428,7 +428,7 @@ impl<'a> ContextBuilder<'a> {
428428/// [`Future::poll()`]: core::future::Future::poll
429429/// [`Poll::Pending`]: core::task::Poll::Pending
430430/// [`Wake`]: ../../alloc/task/trait.Wake.html
431#[cfg_attr(not(doc), repr(transparent))] // work around https://github.com/rust-lang/rust/issues/66401
431#[repr(transparent)]
432432#[stable(feature = "futures_api", since = "1.36.0")]
433433pub struct Waker {
434434 waker: RawWaker,
......@@ -692,7 +692,7 @@ impl fmt::Debug for Waker {
692692/// [`Poll::Pending`]: core::task::Poll::Pending
693693/// [`local_waker`]: core::task::Context::local_waker
694694#[unstable(feature = "local_waker", issue = "118959")]
695#[cfg_attr(not(doc), repr(transparent))] // work around https://github.com/rust-lang/rust/issues/66401
695#[repr(transparent)]
696696pub struct LocalWaker {
697697 waker: RawWaker,
698698}
library/std/src/ffi/os_str.rs+2-4
......@@ -115,10 +115,8 @@ impl crate::sealed::Sealed for OsString {}
115115#[stable(feature = "rust1", since = "1.0.0")]
116116// `OsStr::from_inner` current implementation relies
117117// on `OsStr` being layout-compatible with `Slice`.
118// However, `OsStr` layout is considered an implementation detail and must not be relied upon. We
119// want `repr(transparent)` but we don't want it to show up in rustdoc, so we hide it under
120// `cfg(doc)`. This is an ad-hoc implementation of attribute privacy.
121#[cfg_attr(not(doc), repr(transparent))]
118// However, `OsStr` layout is considered an implementation detail and must not be relied upon.
119#[repr(transparent)]
122120pub struct OsStr {
123121 inner: Slice,
124122}
library/std/src/fs.rs+2-7
......@@ -2400,13 +2400,8 @@ pub fn create_dir<P: AsRef<Path>>(path: P) -> io::Result<()> {
24002400///
24012401/// # Errors
24022402///
2403/// This function will return an error in the following situations, but is not
2404/// limited to just these cases:
2405///
2406/// * If any directory in the path specified by `path`
2407/// does not already exist and it could not be created otherwise. The specific
2408/// error conditions for when a directory is being created (after it is
2409/// determined to not exist) are outlined by [`fs::create_dir`].
2403/// The function will return an error if any directory specified in path does not exist and
2404/// could not be created. There may be other error conditions; see [`fs::create_dir`] for specifics.
24102405///
24112406/// Notable exception is made for situations where any of the directories
24122407/// specified in the `path` could not be created as it was being created concurrently.
library/std/src/path.rs+2-4
......@@ -2079,10 +2079,8 @@ impl AsRef<OsStr> for PathBuf {
20792079#[stable(feature = "rust1", since = "1.0.0")]
20802080// `Path::new` current implementation relies
20812081// on `Path` being layout-compatible with `OsStr`.
2082// However, `Path` layout is considered an implementation detail and must not be relied upon. We
2083// want `repr(transparent)` but we don't want it to show up in rustdoc, so we hide it under
2084// `cfg(doc)`. This is an ad-hoc implementation of attribute privacy.
2085#[cfg_attr(not(doc), repr(transparent))]
2082// However, `Path` layout is considered an implementation detail and must not be relied upon.
2083#[repr(transparent)]
20862084pub struct Path {
20872085 inner: OsStr,
20882086}
library/std/src/thread/mod.rs+8-16
......@@ -192,22 +192,14 @@ pub use scoped::{scope, Scope, ScopedJoinHandle};
192192#[macro_use]
193193mod local;
194194
195cfg_if::cfg_if! {
196 if #[cfg(test)] {
197 // Avoid duplicating the global state associated with thread-locals between this crate and
198 // realstd. Miri relies on this.
199 pub use realstd::thread::{local_impl, AccessError, LocalKey};
200 } else {
201 #[stable(feature = "rust1", since = "1.0.0")]
202 pub use self::local::{AccessError, LocalKey};
203
204 // Implementation details used by the thread_local!{} macro.
205 #[doc(hidden)]
206 #[unstable(feature = "thread_local_internals", issue = "none")]
207 pub mod local_impl {
208 pub use crate::sys::thread_local::*;
209 }
210 }
195#[stable(feature = "rust1", since = "1.0.0")]
196pub use self::local::{AccessError, LocalKey};
197
198// Implementation details used by the thread_local!{} macro.
199#[doc(hidden)]
200#[unstable(feature = "thread_local_internals", issue = "none")]
201pub mod local_impl {
202 pub use crate::sys::thread_local::*;
211203}
212204
213205////////////////////////////////////////////////////////////////////////////////
tests/ui/const-generics/opaque_types.stderr-2
......@@ -122,8 +122,6 @@ note: ...which requires const checking `main::{constant#0}`...
122122 |
123123LL | foo::<42>();
124124 | ^^
125 = note: ...which requires computing whether `Foo` is freeze...
126 = note: ...which requires evaluating trait selection obligation `Foo: core::marker::Freeze`...
127125 = note: ...which again requires computing type of opaque `Foo::{opaque#0}`, completing the cycle
128126note: cycle used when computing type of `Foo::{opaque#0}`
129127 --> $DIR/opaque_types.rs:3:12
tests/ui/consts/const-fn-cycle.rs+2-1
......@@ -7,6 +7,8 @@
77/// to end up revealing opaque types (the RPIT in `many`'s return type),
88/// which can quickly lead to cycles.
99
10//@ check-pass
11
1012pub struct Parser<H>(H);
1113
1214impl<H, T> Parser<H>
......@@ -18,7 +20,6 @@ where
1820 }
1921
2022 pub const fn many<'s>(&'s self) -> Parser<impl for<'a> Fn(&'a str) -> Vec<T> + 's> {
21 //~^ ERROR: cycle detected
2223 Parser::new(|_| unimplemented!())
2324 }
2425}
tests/ui/consts/const-fn-cycle.stderr deleted-34
......@@ -1,34 +0,0 @@
1error[E0391]: cycle detected when computing type of opaque `<impl at $DIR/const-fn-cycle.rs:12:1: 14:33>::many::{opaque#0}`
2 --> $DIR/const-fn-cycle.rs:20:47
3 |
4LL | pub const fn many<'s>(&'s self) -> Parser<impl for<'a> Fn(&'a str) -> Vec<T> + 's> {
5 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6 |
7note: ...which requires borrow-checking `<impl at $DIR/const-fn-cycle.rs:12:1: 14:33>::many`...
8 --> $DIR/const-fn-cycle.rs:20:5
9 |
10LL | pub const fn many<'s>(&'s self) -> Parser<impl for<'a> Fn(&'a str) -> Vec<T> + 's> {
11 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
12note: ...which requires promoting constants in MIR for `<impl at $DIR/const-fn-cycle.rs:12:1: 14:33>::many`...
13 --> $DIR/const-fn-cycle.rs:20:5
14 |
15LL | pub const fn many<'s>(&'s self) -> Parser<impl for<'a> Fn(&'a str) -> Vec<T> + 's> {
16 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
17note: ...which requires const checking `<impl at $DIR/const-fn-cycle.rs:12:1: 14:33>::many`...
18 --> $DIR/const-fn-cycle.rs:20:5
19 |
20LL | pub const fn many<'s>(&'s self) -> Parser<impl for<'a> Fn(&'a str) -> Vec<T> + 's> {
21 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
22 = note: ...which requires computing whether `Parser<<impl at $DIR/const-fn-cycle.rs:12:1: 14:33>::many::{opaque#0}>` is freeze...
23 = note: ...which requires evaluating trait selection obligation `Parser<<impl at $DIR/const-fn-cycle.rs:12:1: 14:33>::many::{opaque#0}>: core::marker::Freeze`...
24 = note: ...which again requires computing type of opaque `<impl at $DIR/const-fn-cycle.rs:12:1: 14:33>::many::{opaque#0}`, completing the cycle
25note: cycle used when computing type of `<impl at $DIR/const-fn-cycle.rs:12:1: 14:33>::many::{opaque#0}`
26 --> $DIR/const-fn-cycle.rs:20:47
27 |
28LL | pub const fn many<'s>(&'s self) -> Parser<impl for<'a> Fn(&'a str) -> Vec<T> + 's> {
29 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
30 = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
31
32error: aborting due to 1 previous error
33
34For more information about this error, try `rustc --explain E0391`.
tests/ui/consts/const-promoted-opaque.atomic.stderr+7-38
......@@ -1,5 +1,5 @@
11error[E0658]: cannot borrow here, since the borrowed element may contain interior mutability
2 --> $DIR/const-promoted-opaque.rs:29:25
2 --> $DIR/const-promoted-opaque.rs:28:25
33 |
44LL | let _: &'static _ = &FOO;
55 | ^^^^
......@@ -9,7 +9,7 @@ LL | let _: &'static _ = &FOO;
99 = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
1010
1111error[E0493]: destructor of `helper::Foo` cannot be evaluated at compile-time
12 --> $DIR/const-promoted-opaque.rs:29:26
12 --> $DIR/const-promoted-opaque.rs:28:26
1313 |
1414LL | let _: &'static _ = &FOO;
1515 | ^^^ the destructor for this type cannot be evaluated in constants
......@@ -18,13 +18,13 @@ LL | };
1818 | - value is dropped here
1919
2020error[E0492]: constants cannot refer to interior mutable data
21 --> $DIR/const-promoted-opaque.rs:34:19
21 --> $DIR/const-promoted-opaque.rs:33:19
2222 |
2323LL | const BAZ: &Foo = &FOO;
2424 | ^^^^ this borrow of an interior mutable value may end up in the final value
2525
2626error[E0716]: temporary value dropped while borrowed
27 --> $DIR/const-promoted-opaque.rs:38:26
27 --> $DIR/const-promoted-opaque.rs:37:26
2828 |
2929LL | let _: &'static _ = &FOO;
3030 | ---------- ^^^ creates a temporary value which is freed while still in use
......@@ -34,38 +34,7 @@ LL |
3434LL | }
3535 | - temporary value is freed at the end of this statement
3636
37error[E0391]: cycle detected when computing type of opaque `helper::Foo::{opaque#0}`
38 --> $DIR/const-promoted-opaque.rs:14:20
39 |
40LL | pub type Foo = impl Sized;
41 | ^^^^^^^^^^
42 |
43note: ...which requires borrow-checking `helper::FOO`...
44 --> $DIR/const-promoted-opaque.rs:21:5
45 |
46LL | pub const FOO: Foo = std::sync::atomic::AtomicU8::new(42);
47 | ^^^^^^^^^^^^^^^^^^
48note: ...which requires promoting constants in MIR for `helper::FOO`...
49 --> $DIR/const-promoted-opaque.rs:21:5
50 |
51LL | pub const FOO: Foo = std::sync::atomic::AtomicU8::new(42);
52 | ^^^^^^^^^^^^^^^^^^
53note: ...which requires const checking `helper::FOO`...
54 --> $DIR/const-promoted-opaque.rs:21:5
55 |
56LL | pub const FOO: Foo = std::sync::atomic::AtomicU8::new(42);
57 | ^^^^^^^^^^^^^^^^^^
58 = note: ...which requires computing whether `helper::Foo` is freeze...
59 = note: ...which requires evaluating trait selection obligation `helper::Foo: core::marker::Freeze`...
60 = note: ...which again requires computing type of opaque `helper::Foo::{opaque#0}`, completing the cycle
61note: cycle used when computing type of `helper::Foo::{opaque#0}`
62 --> $DIR/const-promoted-opaque.rs:14:20
63 |
64LL | pub type Foo = impl Sized;
65 | ^^^^^^^^^^
66 = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
67
68error: aborting due to 5 previous errors
37error: aborting due to 4 previous errors
6938
70Some errors have detailed explanations: E0391, E0492, E0493, E0658, E0716.
71For more information about an error, try `rustc --explain E0391`.
39Some errors have detailed explanations: E0492, E0493, E0658, E0716.
40For more information about an error, try `rustc --explain E0492`.
tests/ui/consts/const-promoted-opaque.rs+2-3
......@@ -12,7 +12,6 @@
1212
1313mod helper {
1414 pub type Foo = impl Sized;
15 //[string,atomic]~^ ERROR cycle detected
1615
1716 #[cfg(string)]
1817 pub const FOO: Foo = String::new();
......@@ -28,11 +27,11 @@ use helper::*;
2827const BAR: () = {
2928 let _: &'static _ = &FOO;
3029 //[string,atomic]~^ ERROR: destructor of `helper::Foo` cannot be evaluated at compile-time
31 //[string,atomic]~| ERROR: cannot borrow here
30 //[atomic]~| ERROR: cannot borrow here
3231};
3332
3433const BAZ: &Foo = &FOO;
35//[string,atomic]~^ ERROR: constants cannot refer to interior mutable data
34//[atomic]~^ ERROR: constants cannot refer to interior mutable data
3635
3736fn main() {
3837 let _: &'static _ = &FOO;
tests/ui/consts/const-promoted-opaque.string.stderr+5-52
......@@ -1,15 +1,5 @@
1error[E0658]: cannot borrow here, since the borrowed element may contain interior mutability
2 --> $DIR/const-promoted-opaque.rs:29:25
3 |
4LL | let _: &'static _ = &FOO;
5 | ^^^^
6 |
7 = note: see issue #80384 <https://github.com/rust-lang/rust/issues/80384> for more information
8 = help: add `#![feature(const_refs_to_cell)]` to the crate attributes to enable
9 = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
10
111error[E0493]: destructor of `helper::Foo` cannot be evaluated at compile-time
12 --> $DIR/const-promoted-opaque.rs:29:26
2 --> $DIR/const-promoted-opaque.rs:28:26
133 |
144LL | let _: &'static _ = &FOO;
155 | ^^^ the destructor for this type cannot be evaluated in constants
......@@ -17,14 +7,8 @@ LL | let _: &'static _ = &FOO;
177LL | };
188 | - value is dropped here
199
20error[E0492]: constants cannot refer to interior mutable data
21 --> $DIR/const-promoted-opaque.rs:34:19
22 |
23LL | const BAZ: &Foo = &FOO;
24 | ^^^^ this borrow of an interior mutable value may end up in the final value
25
2610error[E0716]: temporary value dropped while borrowed
27 --> $DIR/const-promoted-opaque.rs:38:26
11 --> $DIR/const-promoted-opaque.rs:37:26
2812 |
2913LL | let _: &'static _ = &FOO;
3014 | ---------- ^^^ creates a temporary value which is freed while still in use
......@@ -34,38 +18,7 @@ LL |
3418LL | }
3519 | - temporary value is freed at the end of this statement
3620
37error[E0391]: cycle detected when computing type of opaque `helper::Foo::{opaque#0}`
38 --> $DIR/const-promoted-opaque.rs:14:20
39 |
40LL | pub type Foo = impl Sized;
41 | ^^^^^^^^^^
42 |
43note: ...which requires borrow-checking `helper::FOO`...
44 --> $DIR/const-promoted-opaque.rs:18:5
45 |
46LL | pub const FOO: Foo = String::new();
47 | ^^^^^^^^^^^^^^^^^^
48note: ...which requires promoting constants in MIR for `helper::FOO`...
49 --> $DIR/const-promoted-opaque.rs:18:5
50 |
51LL | pub const FOO: Foo = String::new();
52 | ^^^^^^^^^^^^^^^^^^
53note: ...which requires const checking `helper::FOO`...
54 --> $DIR/const-promoted-opaque.rs:18:5
55 |
56LL | pub const FOO: Foo = String::new();
57 | ^^^^^^^^^^^^^^^^^^
58 = note: ...which requires computing whether `helper::Foo` is freeze...
59 = note: ...which requires evaluating trait selection obligation `helper::Foo: core::marker::Freeze`...
60 = note: ...which again requires computing type of opaque `helper::Foo::{opaque#0}`, completing the cycle
61note: cycle used when computing type of `helper::Foo::{opaque#0}`
62 --> $DIR/const-promoted-opaque.rs:14:20
63 |
64LL | pub type Foo = impl Sized;
65 | ^^^^^^^^^^
66 = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
67
68error: aborting due to 5 previous errors
21error: aborting due to 2 previous errors
6922
70Some errors have detailed explanations: E0391, E0492, E0493, E0658, E0716.
71For more information about an error, try `rustc --explain E0391`.
23Some errors have detailed explanations: E0493, E0716.
24For more information about an error, try `rustc --explain E0493`.
tests/ui/impl-trait/auto-trait-selection-freeze.next.stderr created+22
......@@ -0,0 +1,22 @@
1error[E0283]: type annotations needed
2 --> $DIR/auto-trait-selection-freeze.rs:19:16
3 |
4LL | if false { is_trait(foo()) } else { Default::default() }
5 | ^^^^^^^^ ----- type must be known at this point
6 | |
7 | cannot infer type of the type parameter `T` declared on the function `is_trait`
8 |
9 = note: cannot satisfy `_: Trait<_>`
10note: required by a bound in `is_trait`
11 --> $DIR/auto-trait-selection-freeze.rs:11:16
12 |
13LL | fn is_trait<T: Trait<U>, U: Default>(_: T) -> U {
14 | ^^^^^^^^ required by this bound in `is_trait`
15help: consider specifying the generic arguments
16 |
17LL | if false { is_trait::<T, U>(foo()) } else { Default::default() }
18 | ++++++++
19
20error: aborting due to 1 previous error
21
22For more information about this error, try `rustc --explain E0283`.
tests/ui/impl-trait/auto-trait-selection-freeze.old.stderr created+26
......@@ -0,0 +1,26 @@
1error[E0283]: type annotations needed
2 --> $DIR/auto-trait-selection-freeze.rs:19:16
3 |
4LL | if false { is_trait(foo()) } else { Default::default() }
5 | ^^^^^^^^ cannot infer type of the type parameter `U` declared on the function `is_trait`
6 |
7note: multiple `impl`s satisfying `impl Sized: Trait<_>` found
8 --> $DIR/auto-trait-selection-freeze.rs:16:1
9 |
10LL | impl<T: Freeze> Trait<u32> for T {}
11 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
12LL | impl<T> Trait<i32> for T {}
13 | ^^^^^^^^^^^^^^^^^^^^^^^^
14note: required by a bound in `is_trait`
15 --> $DIR/auto-trait-selection-freeze.rs:11:16
16 |
17LL | fn is_trait<T: Trait<U>, U: Default>(_: T) -> U {
18 | ^^^^^^^^ required by this bound in `is_trait`
19help: consider specifying the generic arguments
20 |
21LL | if false { is_trait::<_, U>(foo()) } else { Default::default() }
22 | ++++++++
23
24error: aborting due to 1 previous error
25
26For more information about this error, try `rustc --explain E0283`.
tests/ui/impl-trait/auto-trait-selection-freeze.rs created+23
......@@ -0,0 +1,23 @@
1//! This test shows how we fail selection in a way that can influence
2//! selection in a code path that succeeds.
3
4//@ revisions: next old
5//@[next] compile-flags: -Znext-solver
6
7#![feature(freeze)]
8
9use std::marker::Freeze;
10
11fn is_trait<T: Trait<U>, U: Default>(_: T) -> U {
12 Default::default()
13}
14
15trait Trait<T> {}
16impl<T: Freeze> Trait<u32> for T {}
17impl<T> Trait<i32> for T {}
18fn foo() -> impl Sized {
19 if false { is_trait(foo()) } else { Default::default() }
20 //~^ ERROR: type annotations needed
21}
22
23fn main() {}
tests/ui/impl-trait/auto-trait-selection.next.stderr created+22
......@@ -0,0 +1,22 @@
1error[E0283]: type annotations needed
2 --> $DIR/auto-trait-selection.rs:15:16
3 |
4LL | if false { is_trait(foo()) } else { Default::default() }
5 | ^^^^^^^^ ----- type must be known at this point
6 | |
7 | cannot infer type of the type parameter `T` declared on the function `is_trait`
8 |
9 = note: cannot satisfy `_: Trait<_>`
10note: required by a bound in `is_trait`
11 --> $DIR/auto-trait-selection.rs:7:16
12 |
13LL | fn is_trait<T: Trait<U>, U: Default>(_: T) -> U {
14 | ^^^^^^^^ required by this bound in `is_trait`
15help: consider specifying the generic arguments
16 |
17LL | if false { is_trait::<T, U>(foo()) } else { Default::default() }
18 | ++++++++
19
20error: aborting due to 1 previous error
21
22For more information about this error, try `rustc --explain E0283`.
tests/ui/impl-trait/auto-trait-selection.old.stderr created+26
......@@ -0,0 +1,26 @@
1error[E0283]: type annotations needed
2 --> $DIR/auto-trait-selection.rs:15:16
3 |
4LL | if false { is_trait(foo()) } else { Default::default() }
5 | ^^^^^^^^ cannot infer type of the type parameter `U` declared on the function `is_trait`
6 |
7note: multiple `impl`s satisfying `impl Sized: Trait<_>` found
8 --> $DIR/auto-trait-selection.rs:12:1
9 |
10LL | impl<T: Send> Trait<u32> for T {}
11 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
12LL | impl<T> Trait<i32> for T {}
13 | ^^^^^^^^^^^^^^^^^^^^^^^^
14note: required by a bound in `is_trait`
15 --> $DIR/auto-trait-selection.rs:7:16
16 |
17LL | fn is_trait<T: Trait<U>, U: Default>(_: T) -> U {
18 | ^^^^^^^^ required by this bound in `is_trait`
19help: consider specifying the generic arguments
20 |
21LL | if false { is_trait::<_, U>(foo()) } else { Default::default() }
22 | ++++++++
23
24error: aborting due to 1 previous error
25
26For more information about this error, try `rustc --explain E0283`.
tests/ui/impl-trait/auto-trait-selection.rs created+19
......@@ -0,0 +1,19 @@
1//! This test shows how we fail selection in a way that can influence
2//! selection in a code path that succeeds.
3
4//@ revisions: next old
5//@[next] compile-flags: -Znext-solver
6
7fn is_trait<T: Trait<U>, U: Default>(_: T) -> U {
8 Default::default()
9}
10
11trait Trait<T> {}
12impl<T: Send> Trait<u32> for T {}
13impl<T> Trait<i32> for T {}
14fn foo() -> impl Sized {
15 if false { is_trait(foo()) } else { Default::default() }
16 //~^ ERROR: type annotations needed
17}
18
19fn main() {}
tests/ui/impl-trait/call_method_on_inherent_impl_ref.current.stderr+3-24
......@@ -1,5 +1,5 @@
11error[E0599]: no method named `my_debug` found for opaque type `impl Debug` in the current scope
2 --> $DIR/call_method_on_inherent_impl_ref.rs:20:11
2 --> $DIR/call_method_on_inherent_impl_ref.rs:19:11
33 |
44LL | fn my_debug(&self);
55 | -------- the method is available for `&impl Debug` here
......@@ -14,27 +14,6 @@ note: `MyDebug` defines an item `my_debug`, perhaps you need to implement it
1414LL | trait MyDebug {
1515 | ^^^^^^^^^^^^^
1616
17error[E0391]: cycle detected when computing type of opaque `my_foo::{opaque#0}`
18 --> $DIR/call_method_on_inherent_impl_ref.rs:15:16
19 |
20LL | fn my_foo() -> impl std::fmt::Debug {
21 | ^^^^^^^^^^^^^^^^^^^^
22 |
23note: ...which requires type-checking `my_foo`...
24 --> $DIR/call_method_on_inherent_impl_ref.rs:20:9
25 |
26LL | x.my_debug();
27 | ^
28 = note: ...which requires evaluating trait selection obligation `my_foo::{opaque#0}: core::marker::Unpin`...
29 = note: ...which again requires computing type of opaque `my_foo::{opaque#0}`, completing the cycle
30note: cycle used when computing type of `my_foo::{opaque#0}`
31 --> $DIR/call_method_on_inherent_impl_ref.rs:15:16
32 |
33LL | fn my_foo() -> impl std::fmt::Debug {
34 | ^^^^^^^^^^^^^^^^^^^^
35 = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
36
37error: aborting due to 2 previous errors
17error: aborting due to 1 previous error
3818
39Some errors have detailed explanations: E0391, E0599.
40For more information about an error, try `rustc --explain E0391`.
19For more information about this error, try `rustc --explain E0599`.
tests/ui/impl-trait/call_method_on_inherent_impl_ref.next.stderr+2-2
......@@ -1,5 +1,5 @@
11error[E0282]: type annotations needed
2 --> $DIR/call_method_on_inherent_impl_ref.rs:18:13
2 --> $DIR/call_method_on_inherent_impl_ref.rs:17:13
33 |
44LL | let x = my_foo();
55 | ^
......@@ -13,7 +13,7 @@ LL | let x: /* Type */ = my_foo();
1313 | ++++++++++++
1414
1515error[E0282]: type annotations needed for `&_`
16 --> $DIR/call_method_on_inherent_impl_ref.rs:28:13
16 --> $DIR/call_method_on_inherent_impl_ref.rs:27:13
1717 |
1818LL | let x = &my_bar();
1919 | ^
tests/ui/impl-trait/call_method_on_inherent_impl_ref.rs-1
......@@ -13,7 +13,6 @@ where
1313}
1414
1515fn my_foo() -> impl std::fmt::Debug {
16 //[current]~^ cycle
1716 if false {
1817 let x = my_foo();
1918 //[next]~^ type annotations needed
tests/ui/impl-trait/rpit/const_check_false_cycle.rs created+14
......@@ -0,0 +1,14 @@
1//! This test caused a cycle error when checking whether the
2//! return type is `Freeze` during const checking, even though
3//! the information is readily available.
4
5//@ revisions: current next
6//@[next] compile-flags: -Znext-solver
7//@ check-pass
8
9const fn f() -> impl Eq {
10 g()
11}
12const fn g() {}
13
14fn main() {}
tests/ui/impl-trait/unsized_coercion3.next.stderr+2-2
......@@ -5,7 +5,7 @@ LL | let x = hello();
55 | ^^^^^^^ types differ
66
77error[E0308]: mismatched types
8 --> $DIR/unsized_coercion3.rs:19:14
8 --> $DIR/unsized_coercion3.rs:18:14
99 |
1010LL | fn hello() -> Box<impl Trait + ?Sized> {
1111 | ------------------- the expected opaque type
......@@ -21,7 +21,7 @@ note: associated function defined here
2121 --> $SRC_DIR/alloc/src/boxed.rs:LL:COL
2222
2323error[E0277]: the size for values of type `impl Trait + ?Sized` cannot be known at compilation time
24 --> $DIR/unsized_coercion3.rs:19:14
24 --> $DIR/unsized_coercion3.rs:18:14
2525 |
2626LL | Box::new(1u32)
2727 | -------- ^^^^ doesn't have a size known at compile-time
tests/ui/impl-trait/unsized_coercion3.old.stderr+1-15
......@@ -1,17 +1,3 @@
1error: cannot check whether the hidden type of opaque type satisfies auto traits
2 --> $DIR/unsized_coercion3.rs:15:32
3 |
4LL | let y: Box<dyn Send> = x;
5 | ^
6 |
7 = note: fetching the hidden types of an opaque inside of the defining scope is not supported. You can try moving the opaque type and the item that actually registers a hidden type into a new submodule
8note: opaque type is declared here
9 --> $DIR/unsized_coercion3.rs:11:19
10 |
11LL | fn hello() -> Box<impl Trait + ?Sized> {
12 | ^^^^^^^^^^^^^^^^^^^
13 = note: required for the cast from `Box<impl Trait + ?Sized>` to `Box<dyn Send>`
14
151error[E0277]: the size for values of type `impl Trait + ?Sized` cannot be known at compilation time
162 --> $DIR/unsized_coercion3.rs:15:32
173 |
......@@ -21,6 +7,6 @@ LL | let y: Box<dyn Send> = x;
217 = help: the trait `Sized` is not implemented for `impl Trait + ?Sized`
228 = note: required for the cast from `Box<impl Trait + ?Sized>` to `Box<dyn Send>`
239
24error: aborting due to 2 previous errors
10error: aborting due to 1 previous error
2511
2612For more information about this error, try `rustc --explain E0277`.
tests/ui/impl-trait/unsized_coercion3.rs-1
......@@ -14,7 +14,6 @@ fn hello() -> Box<impl Trait + ?Sized> {
1414 //[next]~^ ERROR: type mismatch resolving `impl Trait + ?Sized <: dyn Send`
1515 let y: Box<dyn Send> = x;
1616 //[old]~^ ERROR: the size for values of type `impl Trait + ?Sized` cannot be know
17 //[old]~| ERROR: cannot check whether the hidden type of opaque type satisfies auto traits
1817 }
1918 Box::new(1u32)
2019 //[next]~^ ERROR: mismatched types
tests/ui/impl-trait/unsized_coercion5.old.stderr+1-15
......@@ -9,20 +9,6 @@ LL | let y: Box<dyn Send> = x as Box<dyn Trait + Send>;
99 = note: expected struct `Box<dyn Send>`
1010 found struct `Box<dyn Trait + Send>`
1111
12error: cannot check whether the hidden type of opaque type satisfies auto traits
13 --> $DIR/unsized_coercion5.rs:16:32
14 |
15LL | let y: Box<dyn Send> = x as Box<dyn Trait + Send>;
16 | ^
17 |
18 = note: fetching the hidden types of an opaque inside of the defining scope is not supported. You can try moving the opaque type and the item that actually registers a hidden type into a new submodule
19note: opaque type is declared here
20 --> $DIR/unsized_coercion5.rs:13:19
21 |
22LL | fn hello() -> Box<impl Trait + ?Sized> {
23 | ^^^^^^^^^^^^^^^^^^^
24 = note: required for the cast from `Box<impl Trait + ?Sized>` to `Box<dyn Trait + Send>`
25
2612error[E0277]: the size for values of type `impl Trait + ?Sized` cannot be known at compilation time
2713 --> $DIR/unsized_coercion5.rs:16:32
2814 |
......@@ -32,7 +18,7 @@ LL | let y: Box<dyn Send> = x as Box<dyn Trait + Send>;
3218 = help: the trait `Sized` is not implemented for `impl Trait + ?Sized`
3319 = note: required for the cast from `Box<impl Trait + ?Sized>` to `Box<dyn Trait + Send>`
3420
35error: aborting due to 3 previous errors
21error: aborting due to 2 previous errors
3622
3723Some errors have detailed explanations: E0277, E0308.
3824For more information about an error, try `rustc --explain E0277`.
tests/ui/impl-trait/unsized_coercion5.rs+1-2
......@@ -15,8 +15,7 @@ fn hello() -> Box<impl Trait + ?Sized> {
1515 let x = hello();
1616 let y: Box<dyn Send> = x as Box<dyn Trait + Send>;
1717 //[old]~^ ERROR: the size for values of type `impl Trait + ?Sized` cannot be know
18 //[old]~| ERROR: cannot check whether the hidden type of opaque type satisfies auto traits
19 //~^^^ ERROR: mismatched types
18 //~^^ ERROR: mismatched types
2019 }
2120 Box::new(1u32)
2221}
tests/ui/lint/expansion-time.stderr+15
......@@ -55,6 +55,21 @@ LL | #[warn(incomplete_include)]
5555warning: 4 warnings emitted
5656
5757Future incompatibility report: Future breakage diagnostic:
58warning: missing fragment specifier
59 --> $DIR/expansion-time.rs:9:19
60 |
61LL | macro_rules! m { ($i) => {} }
62 | ^^
63 |
64 = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
65 = note: for more information, see issue #40107 <https://github.com/rust-lang/rust/issues/40107>
66note: the lint level is defined here
67 --> $DIR/expansion-time.rs:8:8
68 |
69LL | #[warn(missing_fragment_specifier)]
70 | ^^^^^^^^^^^^^^^^^^^^^^^^^^
71
72Future breakage diagnostic:
5873warning: use of unstable library feature 'test': `bench` is a part of custom test frameworks which are unstable
5974 --> $DIR/expansion-time.rs:14:7
6075 |
tests/ui/macros/issue-39404.stderr+11
......@@ -10,3 +10,14 @@ LL | macro_rules! m { ($i) => {} }
1010
1111error: aborting due to 1 previous error
1212
13Future incompatibility report: Future breakage diagnostic:
14error: missing fragment specifier
15 --> $DIR/issue-39404.rs:3:19
16 |
17LL | macro_rules! m { ($i) => {} }
18 | ^^
19 |
20 = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
21 = note: for more information, see issue #40107 <https://github.com/rust-lang/rust/issues/40107>
22 = note: `#[deny(missing_fragment_specifier)]` on by default
23
tests/ui/macros/macro-match-nonterminal.stderr+22
......@@ -25,3 +25,25 @@ LL | ($a, $b) => {
2525
2626error: aborting due to 3 previous errors
2727
28Future incompatibility report: Future breakage diagnostic:
29error: missing fragment specifier
30 --> $DIR/macro-match-nonterminal.rs:2:8
31 |
32LL | ($a, $b) => {
33 | ^
34 |
35 = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
36 = note: for more information, see issue #40107 <https://github.com/rust-lang/rust/issues/40107>
37 = note: `#[deny(missing_fragment_specifier)]` on by default
38
39Future breakage diagnostic:
40error: missing fragment specifier
41 --> $DIR/macro-match-nonterminal.rs:2:10
42 |
43LL | ($a, $b) => {
44 | ^^
45 |
46 = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
47 = note: for more information, see issue #40107 <https://github.com/rust-lang/rust/issues/40107>
48 = note: `#[deny(missing_fragment_specifier)]` on by default
49
tests/ui/macros/macro-missing-fragment-deduplication.stderr+11
......@@ -16,3 +16,14 @@ LL | ($name) => {}
1616
1717error: aborting due to 2 previous errors
1818
19Future incompatibility report: Future breakage diagnostic:
20error: missing fragment specifier
21 --> $DIR/macro-missing-fragment-deduplication.rs:4:6
22 |
23LL | ($name) => {}
24 | ^^^^^
25 |
26 = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
27 = note: for more information, see issue #40107 <https://github.com/rust-lang/rust/issues/40107>
28 = note: `#[deny(missing_fragment_specifier)]` on by default
29
tests/ui/macros/macro-missing-fragment.stderr+45
......@@ -38,3 +38,48 @@ LL | ( $name ) => {};
3838
3939error: aborting due to 1 previous error; 3 warnings emitted
4040
41Future incompatibility report: Future breakage diagnostic:
42warning: missing fragment specifier
43 --> $DIR/macro-missing-fragment.rs:4:20
44 |
45LL | ( $( any_token $field_rust_type )* ) => {};
46 | ^^^^^^^^^^^^^^^^
47 |
48 = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
49 = note: for more information, see issue #40107 <https://github.com/rust-lang/rust/issues/40107>
50note: the lint level is defined here
51 --> $DIR/macro-missing-fragment.rs:1:9
52 |
53LL | #![warn(missing_fragment_specifier)]
54 | ^^^^^^^^^^^^^^^^^^^^^^^^^^
55
56Future breakage diagnostic:
57warning: missing fragment specifier
58 --> $DIR/macro-missing-fragment.rs:12:7
59 |
60LL | ( $name ) => {};
61 | ^^^^^
62 |
63 = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
64 = note: for more information, see issue #40107 <https://github.com/rust-lang/rust/issues/40107>
65note: the lint level is defined here
66 --> $DIR/macro-missing-fragment.rs:1:9
67 |
68LL | #![warn(missing_fragment_specifier)]
69 | ^^^^^^^^^^^^^^^^^^^^^^^^^^
70
71Future breakage diagnostic:
72warning: missing fragment specifier
73 --> $DIR/macro-missing-fragment.rs:18:7
74 |
75LL | ( $name ) => {};
76 | ^^^^^
77 |
78 = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
79 = note: for more information, see issue #40107 <https://github.com/rust-lang/rust/issues/40107>
80note: the lint level is defined here
81 --> $DIR/macro-missing-fragment.rs:1:9
82 |
83LL | #![warn(missing_fragment_specifier)]
84 | ^^^^^^^^^^^^^^^^^^^^^^^^^^
85
tests/ui/parser/macro/issue-33569.stderr+11
......@@ -28,3 +28,14 @@ LL | { $+ } => {
2828
2929error: aborting due to 4 previous errors
3030
31Future incompatibility report: Future breakage diagnostic:
32error: missing fragment specifier
33 --> $DIR/issue-33569.rs:2:8
34 |
35LL | { $+ } => {
36 | ^
37 |
38 = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
39 = note: for more information, see issue #40107 <https://github.com/rust-lang/rust/issues/40107>
40 = note: `#[deny(missing_fragment_specifier)]` on by default
41
tests/ui/rfcs/rfc-2632-const-trait-impl/ice-120503-async-const-method.rs-1
......@@ -9,7 +9,6 @@ impl MyTrait for i32 {
99 //~| ERROR functions in trait impls cannot be declared const
1010 //~| ERROR functions cannot be both `const` and `async`
1111 //~| ERROR method `bar` is not a member
12 //~| ERROR cycle detected when computing type
1312 main8().await;
1413 //~^ ERROR cannot find function
1514 }
tests/ui/rfcs/rfc-2632-const-trait-impl/ice-120503-async-const-method.stderr+3-34
......@@ -61,7 +61,7 @@ error: using `#![feature(effects)]` without enabling next trait solver globally
6161 = help: use `-Znext-solver` to enable
6262
6363error[E0425]: cannot find function `main8` in this scope
64 --> $DIR/ice-120503-async-const-method.rs:13:9
64 --> $DIR/ice-120503-async-const-method.rs:12:9
6565 |
6666LL | main8().await;
6767 | ^^^^^ help: a function with a similar name exists: `main`
......@@ -69,38 +69,7 @@ LL | main8().await;
6969LL | fn main() {}
7070 | --------- similarly named function `main` defined here
7171
72error[E0391]: cycle detected when computing type of opaque `<impl at $DIR/ice-120503-async-const-method.rs:6:1: 6:21>::bar::{opaque#0}`
73 --> $DIR/ice-120503-async-const-method.rs:7:5
74 |
75LL | async const fn bar(&self) {
76 | ^^^^^^^^^^^^^^^^^^^^^^^^^
77 |
78note: ...which requires borrow-checking `<impl at $DIR/ice-120503-async-const-method.rs:6:1: 6:21>::bar`...
79 --> $DIR/ice-120503-async-const-method.rs:7:5
80 |
81LL | async const fn bar(&self) {
82 | ^^^^^^^^^^^^^^^^^^^^^^^^^
83note: ...which requires promoting constants in MIR for `<impl at $DIR/ice-120503-async-const-method.rs:6:1: 6:21>::bar`...
84 --> $DIR/ice-120503-async-const-method.rs:7:5
85 |
86LL | async const fn bar(&self) {
87 | ^^^^^^^^^^^^^^^^^^^^^^^^^
88note: ...which requires const checking `<impl at $DIR/ice-120503-async-const-method.rs:6:1: 6:21>::bar`...
89 --> $DIR/ice-120503-async-const-method.rs:7:5
90 |
91LL | async const fn bar(&self) {
92 | ^^^^^^^^^^^^^^^^^^^^^^^^^
93 = note: ...which requires computing whether `<impl at $DIR/ice-120503-async-const-method.rs:6:1: 6:21>::bar::{opaque#0}` is freeze...
94 = note: ...which requires evaluating trait selection obligation `<impl at $DIR/ice-120503-async-const-method.rs:6:1: 6:21>::bar::{opaque#0}: core::marker::Freeze`...
95 = note: ...which again requires computing type of opaque `<impl at $DIR/ice-120503-async-const-method.rs:6:1: 6:21>::bar::{opaque#0}`, completing the cycle
96note: cycle used when computing type of `<impl at $DIR/ice-120503-async-const-method.rs:6:1: 6:21>::bar::{opaque#0}`
97 --> $DIR/ice-120503-async-const-method.rs:7:5
98 |
99LL | async const fn bar(&self) {
100 | ^^^^^^^^^^^^^^^^^^^^^^^^^
101 = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
102
103error: aborting due to 7 previous errors; 1 warning emitted
72error: aborting due to 6 previous errors; 1 warning emitted
10473
105Some errors have detailed explanations: E0379, E0391, E0407, E0425.
74Some errors have detailed explanations: E0379, E0407, E0425.
10675For more information about an error, try `rustc --explain E0379`.
tests/ui/trait-bounds/bad-suggestionf-for-repeated-unsized-bound-127441.rs created+39
......@@ -0,0 +1,39 @@
1// Regression test for #127441
2
3// Tests that we make the correct suggestion
4// in case there are more than one `?Sized`
5// bounds on a function parameter
6
7use std::fmt::Debug;
8
9fn foo1<T: ?Sized>(a: T) {}
10//~^ ERROR he size for values of type `T` cannot be known at compilation time
11
12fn foo2<T: ?Sized + ?Sized>(a: T) {}
13//~^ ERROR type parameter has more than one relaxed default bound, only one is supported
14//~| ERROR the size for values of type `T` cannot be known at compilation time
15
16fn foo3<T: ?Sized + ?Sized + Debug>(a: T) {}
17//~^ ERROR type parameter has more than one relaxed default bound, only one is supported
18//~| ERROR he size for values of type `T` cannot be known at compilation time
19
20fn foo4<T: ?Sized + Debug + ?Sized >(a: T) {}
21//~^ ERROR type parameter has more than one relaxed default bound, only one is supported
22//~| ERROR the size for values of type `T` cannot be known at compilation time
23
24fn foo5(_: impl ?Sized) {}
25//~^ ERROR the size for values of type `impl ?Sized` cannot be known at compilation time
26
27fn foo6(_: impl ?Sized + ?Sized) {}
28//~^ ERROR type parameter has more than one relaxed default bound, only one is supported
29//~| ERROR the size for values of type `impl ?Sized + ?Sized` cannot be known at compilation tim
30
31fn foo7(_: impl ?Sized + ?Sized + Debug) {}
32//~^ ERROR type parameter has more than one relaxed default bound, only one is supported
33//~| ERROR the size for values of type `impl ?Sized + ?Sized + Debug` cannot be known at compilation time
34
35fn foo8(_: impl ?Sized + Debug + ?Sized ) {}
36//~^ ERROR type parameter has more than one relaxed default bound, only one is supported
37//~| ERROR the size for values of type `impl ?Sized + Debug + ?Sized` cannot be known at compilation time
38
39fn main() {}
tests/ui/trait-bounds/bad-suggestionf-for-repeated-unsized-bound-127441.stderr created+192
......@@ -0,0 +1,192 @@
1error[E0203]: type parameter has more than one relaxed default bound, only one is supported
2 --> $DIR/bad-suggestionf-for-repeated-unsized-bound-127441.rs:12:12
3 |
4LL | fn foo2<T: ?Sized + ?Sized>(a: T) {}
5 | ^^^^^^ ^^^^^^
6
7error[E0203]: type parameter has more than one relaxed default bound, only one is supported
8 --> $DIR/bad-suggestionf-for-repeated-unsized-bound-127441.rs:16:12
9 |
10LL | fn foo3<T: ?Sized + ?Sized + Debug>(a: T) {}
11 | ^^^^^^ ^^^^^^
12
13error[E0203]: type parameter has more than one relaxed default bound, only one is supported
14 --> $DIR/bad-suggestionf-for-repeated-unsized-bound-127441.rs:20:12
15 |
16LL | fn foo4<T: ?Sized + Debug + ?Sized >(a: T) {}
17 | ^^^^^^ ^^^^^^
18
19error[E0203]: type parameter has more than one relaxed default bound, only one is supported
20 --> $DIR/bad-suggestionf-for-repeated-unsized-bound-127441.rs:27:17
21 |
22LL | fn foo6(_: impl ?Sized + ?Sized) {}
23 | ^^^^^^ ^^^^^^
24
25error[E0203]: type parameter has more than one relaxed default bound, only one is supported
26 --> $DIR/bad-suggestionf-for-repeated-unsized-bound-127441.rs:31:17
27 |
28LL | fn foo7(_: impl ?Sized + ?Sized + Debug) {}
29 | ^^^^^^ ^^^^^^
30
31error[E0203]: type parameter has more than one relaxed default bound, only one is supported
32 --> $DIR/bad-suggestionf-for-repeated-unsized-bound-127441.rs:35:17
33 |
34LL | fn foo8(_: impl ?Sized + Debug + ?Sized ) {}
35 | ^^^^^^ ^^^^^^
36
37error[E0277]: the size for values of type `T` cannot be known at compilation time
38 --> $DIR/bad-suggestionf-for-repeated-unsized-bound-127441.rs:9:20
39 |
40LL | fn foo1<T: ?Sized>(a: T) {}
41 | - ^ doesn't have a size known at compile-time
42 | |
43 | this type parameter needs to be `Sized`
44 |
45 = help: unsized fn params are gated as an unstable feature
46help: consider removing the `?Sized` bound to make the type parameter `Sized`
47 |
48LL - fn foo1<T: ?Sized>(a: T) {}
49LL + fn foo1<T>(a: T) {}
50 |
51help: function arguments must have a statically known size, borrowed types always have a known size
52 |
53LL | fn foo1<T: ?Sized>(a: &T) {}
54 | +
55
56error[E0277]: the size for values of type `T` cannot be known at compilation time
57 --> $DIR/bad-suggestionf-for-repeated-unsized-bound-127441.rs:12:29
58 |
59LL | fn foo2<T: ?Sized + ?Sized>(a: T) {}
60 | - ^ doesn't have a size known at compile-time
61 | |
62 | this type parameter needs to be `Sized`
63 |
64 = help: unsized fn params are gated as an unstable feature
65help: consider removing the `?Sized` bound to make the type parameter `Sized`
66 |
67LL - fn foo2<T: ?Sized + ?Sized>(a: T) {}
68LL + fn foo2<T>(a: T) {}
69 |
70help: function arguments must have a statically known size, borrowed types always have a known size
71 |
72LL | fn foo2<T: ?Sized + ?Sized>(a: &T) {}
73 | +
74
75error[E0277]: the size for values of type `T` cannot be known at compilation time
76 --> $DIR/bad-suggestionf-for-repeated-unsized-bound-127441.rs:16:37
77 |
78LL | fn foo3<T: ?Sized + ?Sized + Debug>(a: T) {}
79 | - ^ doesn't have a size known at compile-time
80 | |
81 | this type parameter needs to be `Sized`
82 |
83 = help: unsized fn params are gated as an unstable feature
84help: consider restricting type parameters
85 |
86LL - fn foo3<T: ?Sized + ?Sized + Debug>(a: T) {}
87LL + fn foo3<T: Debug>(a: T) {}
88 |
89help: function arguments must have a statically known size, borrowed types always have a known size
90 |
91LL | fn foo3<T: ?Sized + ?Sized + Debug>(a: &T) {}
92 | +
93
94error[E0277]: the size for values of type `T` cannot be known at compilation time
95 --> $DIR/bad-suggestionf-for-repeated-unsized-bound-127441.rs:20:38
96 |
97LL | fn foo4<T: ?Sized + Debug + ?Sized >(a: T) {}
98 | - ^ doesn't have a size known at compile-time
99 | |
100 | this type parameter needs to be `Sized`
101 |
102 = help: unsized fn params are gated as an unstable feature
103help: consider restricting type parameters
104 |
105LL - fn foo4<T: ?Sized + Debug + ?Sized >(a: T) {}
106LL + fn foo4<T: Debug >(a: T) {}
107 |
108help: function arguments must have a statically known size, borrowed types always have a known size
109 |
110LL | fn foo4<T: ?Sized + Debug + ?Sized >(a: &T) {}
111 | +
112
113error[E0277]: the size for values of type `impl ?Sized` cannot be known at compilation time
114 --> $DIR/bad-suggestionf-for-repeated-unsized-bound-127441.rs:24:9
115 |
116LL | fn foo5(_: impl ?Sized) {}
117 | ^ ----------- this type parameter needs to be `Sized`
118 | |
119 | doesn't have a size known at compile-time
120 |
121 = help: unsized fn params are gated as an unstable feature
122help: consider replacing `?Sized` with `Sized`
123 |
124LL - fn foo5(_: impl ?Sized) {}
125LL + fn foo5(_: impl Sized) {}
126 |
127help: function arguments must have a statically known size, borrowed types always have a known size
128 |
129LL | fn foo5(_: &impl ?Sized) {}
130 | +
131
132error[E0277]: the size for values of type `impl ?Sized + ?Sized` cannot be known at compilation time
133 --> $DIR/bad-suggestionf-for-repeated-unsized-bound-127441.rs:27:9
134 |
135LL | fn foo6(_: impl ?Sized + ?Sized) {}
136 | ^ -------------------- this type parameter needs to be `Sized`
137 | |
138 | doesn't have a size known at compile-time
139 |
140 = help: unsized fn params are gated as an unstable feature
141help: consider restricting type parameters
142 |
143LL - fn foo6(_: impl ?Sized + ?Sized) {}
144LL + fn foo6(_: impl Sized) {}
145 |
146help: function arguments must have a statically known size, borrowed types always have a known size
147 |
148LL | fn foo6(_: &impl ?Sized + ?Sized) {}
149 | +
150
151error[E0277]: the size for values of type `impl ?Sized + ?Sized + Debug` cannot be known at compilation time
152 --> $DIR/bad-suggestionf-for-repeated-unsized-bound-127441.rs:31:9
153 |
154LL | fn foo7(_: impl ?Sized + ?Sized + Debug) {}
155 | ^ ---------------------------- this type parameter needs to be `Sized`
156 | |
157 | doesn't have a size known at compile-time
158 |
159 = help: unsized fn params are gated as an unstable feature
160help: consider restricting type parameters
161 |
162LL - fn foo7(_: impl ?Sized + ?Sized + Debug) {}
163LL + fn foo7(_: impl Debug) {}
164 |
165help: function arguments must have a statically known size, borrowed types always have a known size
166 |
167LL | fn foo7(_: &impl ?Sized + ?Sized + Debug) {}
168 | +
169
170error[E0277]: the size for values of type `impl ?Sized + Debug + ?Sized` cannot be known at compilation time
171 --> $DIR/bad-suggestionf-for-repeated-unsized-bound-127441.rs:35:9
172 |
173LL | fn foo8(_: impl ?Sized + Debug + ?Sized ) {}
174 | ^ ---------------------------- this type parameter needs to be `Sized`
175 | |
176 | doesn't have a size known at compile-time
177 |
178 = help: unsized fn params are gated as an unstable feature
179help: consider restricting type parameters
180 |
181LL - fn foo8(_: impl ?Sized + Debug + ?Sized ) {}
182LL + fn foo8(_: impl Debug ) {}
183 |
184help: function arguments must have a statically known size, borrowed types always have a known size
185 |
186LL | fn foo8(_: &impl ?Sized + Debug + ?Sized ) {}
187 | +
188
189error: aborting due to 14 previous errors
190
191Some errors have detailed explanations: E0203, E0277.
192For more information about an error, try `rustc --explain E0203`.
tests/ui/type-alias-impl-trait/in-where-clause.rs+1-1
......@@ -4,13 +4,13 @@
44#![feature(type_alias_impl_trait)]
55type Bar = impl Sized;
66//~^ ERROR: cycle
7//~| ERROR: cycle
87
98fn foo() -> Bar
109where
1110 Bar: Send,
1211{
1312 [0; 1 + 2]
13 //~^ ERROR: type annotations needed: cannot satisfy `Bar: Send`
1414}
1515
1616fn main() {}
tests/ui/type-alias-impl-trait/in-where-clause.stderr+14-17
......@@ -10,7 +10,7 @@ note: ...which requires computing type of opaque `Bar::{opaque#0}`...
1010LL | type Bar = impl Sized;
1111 | ^^^^^^^^^^
1212note: ...which requires type-checking `foo`...
13 --> $DIR/in-where-clause.rs:9:1
13 --> $DIR/in-where-clause.rs:8:1
1414 |
1515LL | / fn foo() -> Bar
1616LL | | where
......@@ -25,26 +25,23 @@ LL | type Bar = impl Sized;
2525 | ^^^^^^^^^^
2626 = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
2727
28error[E0391]: cycle detected when computing type of opaque `Bar::{opaque#0}`
29 --> $DIR/in-where-clause.rs:5:12
30 |
31LL | type Bar = impl Sized;
32 | ^^^^^^^^^^
33 |
34note: ...which requires type-checking `foo`...
35 --> $DIR/in-where-clause.rs:13:9
28error[E0283]: type annotations needed: cannot satisfy `Bar: Send`
29 --> $DIR/in-where-clause.rs:12:9
3630 |
3731LL | [0; 1 + 2]
3832 | ^^^^^
39 = note: ...which requires evaluating trait selection obligation `Bar: core::marker::Send`...
40 = note: ...which again requires computing type of opaque `Bar::{opaque#0}`, completing the cycle
41note: cycle used when computing type of `Bar::{opaque#0}`
42 --> $DIR/in-where-clause.rs:5:12
4333 |
44LL | type Bar = impl Sized;
45 | ^^^^^^^^^^
46 = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
34 = note: cannot satisfy `Bar: Send`
35note: required by a bound in `foo`
36 --> $DIR/in-where-clause.rs:10:10
37 |
38LL | fn foo() -> Bar
39 | --- required by a bound in this function
40LL | where
41LL | Bar: Send,
42 | ^^^^ required by this bound in `foo`
4743
4844error: aborting due to 2 previous errors
4945
50For more information about this error, try `rustc --explain E0391`.
46Some errors have detailed explanations: E0283, E0391.
47For more information about an error, try `rustc --explain E0283`.
tests/ui/type-alias-impl-trait/reveal_local.rs+1-1
......@@ -20,7 +20,7 @@ fn not_gooder() -> Foo {
2020 // while we could know this from the hidden type, it would
2121 // need extra roundabout logic to support it.
2222 is_send::<Foo>();
23 //~^ ERROR: cannot check whether the hidden type of `reveal_local[9507]::Foo::{opaque#0}` satisfies auto traits
23 //~^ ERROR: type annotations needed: cannot satisfy `Foo: Send`
2424
2525 x
2626}
tests/ui/type-alias-impl-trait/reveal_local.stderr+3-7
......@@ -16,18 +16,13 @@ note: required by a bound in `is_send`
1616LL | fn is_send<T: Send>() {}
1717 | ^^^^ required by this bound in `is_send`
1818
19error: cannot check whether the hidden type of `reveal_local[9507]::Foo::{opaque#0}` satisfies auto traits
19error[E0283]: type annotations needed: cannot satisfy `Foo: Send`
2020 --> $DIR/reveal_local.rs:22:15
2121 |
2222LL | is_send::<Foo>();
2323 | ^^^
2424 |
25 = note: fetching the hidden types of an opaque inside of the defining scope is not supported. You can try moving the opaque type and the item that actually registers a hidden type into a new submodule
26note: opaque type is declared here
27 --> $DIR/reveal_local.rs:5:12
28 |
29LL | type Foo = impl Debug;
30 | ^^^^^^^^^^
25 = note: cannot satisfy `Foo: Send`
3126note: required by a bound in `is_send`
3227 --> $DIR/reveal_local.rs:7:15
3328 |
......@@ -36,3 +31,4 @@ LL | fn is_send<T: Send>() {}
3631
3732error: aborting due to 2 previous errors
3833
34For more information about this error, try `rustc --explain E0283`.