Skip to content

Commit ed14192

Browse files
committed
Auto merge of #134294 - matthiaskrgr:rollup-anh6io8, r=matthiaskrgr
Rollup of 8 pull requests Successful merges: - #134252 (Fix `Path::is_absolute` on Hermit) - #134254 (Fix building `std` for Hermit after `c_char` change) - #134255 (Update includes in `/library/core/src/error.rs`.) - #134261 (Document the symbol Visibility enum) - #134262 (Arbitrary self types v2: adjust diagnostic.) - #134265 (Rename `ty_def_id` so people will stop using it by accident) - #134271 (Arbitrary self types v2: better feature gate test) - #134274 (Add check-pass test for `&raw`) r? `@ghost` `@rustbot` modify labels: rollup
2 parents a1740a9 + 4efa98c commit ed14192

28 files changed

+157
-54
lines changed

compiler/rustc_hir_analysis/messages.ftl

+6
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,12 @@ hir_analysis_invalid_receiver_ty = invalid `self` parameter type: `{$receiver_ty
246246
hir_analysis_invalid_receiver_ty_help =
247247
consider changing to `self`, `&self`, `&mut self`, or a type implementing `Receiver` such as `self: Box<Self>`, `self: Rc<Self>`, or `self: Arc<Self>`
248248
249+
hir_analysis_invalid_receiver_ty_help_no_arbitrary_self_types =
250+
consider changing to `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`)
251+
252+
hir_analysis_invalid_receiver_ty_no_arbitrary_self_types = invalid `self` parameter type: `{$receiver_ty}`
253+
.note = type of `self` must be `Self` or a type that dereferences to it
254+
249255
hir_analysis_invalid_union_field =
250256
field must implement `Copy` or be wrapped in `ManuallyDrop<...>` to be used in a union
251257
.note = union fields must not have drop side-effects, which is currently enforced via either `Copy` or `ManuallyDrop<...>`

compiler/rustc_hir_analysis/src/check/wfcheck.rs

+7-1
Original file line numberDiff line numberDiff line change
@@ -1748,9 +1748,15 @@ fn check_method_receiver<'tcx>(
17481748
// Report error; would not have worked with `arbitrary_self_types[_pointers]`.
17491749
{
17501750
match receiver_validity_err {
1751-
ReceiverValidityError::DoesNotDeref => {
1751+
ReceiverValidityError::DoesNotDeref if arbitrary_self_types_level.is_some() => {
17521752
tcx.dcx().emit_err(errors::InvalidReceiverTy { span, receiver_ty })
17531753
}
1754+
ReceiverValidityError::DoesNotDeref => {
1755+
tcx.dcx().emit_err(errors::InvalidReceiverTyNoArbitrarySelfTypes {
1756+
span,
1757+
receiver_ty,
1758+
})
1759+
}
17541760
ReceiverValidityError::MethodGenericParamUsed => {
17551761
tcx.dcx().emit_err(errors::InvalidGenericReceiverTy { span, receiver_ty })
17561762
}

compiler/rustc_hir_analysis/src/errors.rs

+10
Original file line numberDiff line numberDiff line change
@@ -1655,6 +1655,16 @@ pub(crate) struct NonConstRange {
16551655
pub span: Span,
16561656
}
16571657

1658+
#[derive(Diagnostic)]
1659+
#[diag(hir_analysis_invalid_receiver_ty_no_arbitrary_self_types, code = E0307)]
1660+
#[note]
1661+
#[help(hir_analysis_invalid_receiver_ty_help_no_arbitrary_self_types)]
1662+
pub(crate) struct InvalidReceiverTyNoArbitrarySelfTypes<'tcx> {
1663+
#[primary_span]
1664+
pub span: Span,
1665+
pub receiver_ty: Ty<'tcx>,
1666+
}
1667+
16581668
#[derive(Diagnostic)]
16591669
#[diag(hir_analysis_invalid_receiver_ty, code = E0307)]
16601670
#[note]

compiler/rustc_hir_analysis/src/hir_ty_lowering/errors.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ use rustc_hir as hir;
99
use rustc_hir::def::{DefKind, Res};
1010
use rustc_hir::def_id::DefId;
1111
use rustc_middle::bug;
12-
use rustc_middle::query::Key;
1312
use rustc_middle::ty::print::{PrintPolyTraitRefExt as _, PrintTraitRefExt as _};
1413
use rustc_middle::ty::{
1514
self, AdtDef, Binder, GenericParamDefKind, TraitRef, Ty, TyCtxt, TypeVisitableExt,
@@ -1007,8 +1006,8 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
10071006
)),
10081007
..
10091008
}) = node
1010-
&& let Some(ty_def_id) = qself_ty.ty_def_id()
1011-
&& let [inherent_impl] = tcx.inherent_impls(ty_def_id)
1009+
&& let Some(adt_def) = qself_ty.ty_adt_def()
1010+
&& let [inherent_impl] = tcx.inherent_impls(adt_def.did())
10121011
&& let name = format!("{ident2}_{ident3}")
10131012
&& let Some(ty::AssocItem { kind: ty::AssocKind::Fn, .. }) = tcx
10141013
.associated_items(inherent_impl)

compiler/rustc_middle/src/mir/mono.rs

+12
Original file line numberDiff line numberDiff line change
@@ -294,10 +294,22 @@ pub enum Linkage {
294294
Common,
295295
}
296296

297+
/// Specifies the symbol visibility with regards to dynamic linking.
298+
///
299+
/// Visibility doesn't have any effect when linkage is internal.
300+
///
301+
/// DSO means dynamic shared object, that is a dynamically linked executable or dylib.
297302
#[derive(Copy, Clone, PartialEq, Debug, HashStable)]
298303
pub enum Visibility {
304+
/// Export the symbol from the DSO and apply overrides of the symbol by outside DSOs to within
305+
/// the DSO if the object file format supports this.
299306
Default,
307+
/// Hide the symbol outside of the defining DSO even when external linkage is used to export it
308+
/// from the object file.
300309
Hidden,
310+
/// Export the symbol from the DSO, but don't apply overrides of the symbol by outside DSOs to
311+
/// within the DSO. Equivalent to default visibility with object file formats that don't support
312+
/// overriding exported symbols by another DSO.
301313
Protected,
302314
}
303315

compiler/rustc_middle/src/query/keys.rs

+6-5
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ pub trait Key: Sized {
4141
None
4242
}
4343

44-
fn ty_def_id(&self) -> Option<DefId> {
44+
/// Used to detect when ADT def ids are used as keys in a cycle for better error reporting.
45+
fn def_id_for_ty_in_cycle(&self) -> Option<DefId> {
4546
None
4647
}
4748
}
@@ -423,7 +424,7 @@ impl<'tcx> Key for Ty<'tcx> {
423424
DUMMY_SP
424425
}
425426

426-
fn ty_def_id(&self) -> Option<DefId> {
427+
fn def_id_for_ty_in_cycle(&self) -> Option<DefId> {
427428
match *self.kind() {
428429
ty::Adt(adt, _) => Some(adt.did()),
429430
ty::Coroutine(def_id, ..) => Some(def_id),
@@ -471,8 +472,8 @@ impl<'tcx, T: Key> Key for ty::PseudoCanonicalInput<'tcx, T> {
471472
self.value.default_span(tcx)
472473
}
473474

474-
fn ty_def_id(&self) -> Option<DefId> {
475-
self.value.ty_def_id()
475+
fn def_id_for_ty_in_cycle(&self) -> Option<DefId> {
476+
self.value.def_id_for_ty_in_cycle()
476477
}
477478
}
478479

@@ -593,7 +594,7 @@ impl<'tcx> Key for (ValidityRequirement, ty::PseudoCanonicalInput<'tcx, Ty<'tcx>
593594
DUMMY_SP
594595
}
595596

596-
fn ty_def_id(&self) -> Option<DefId> {
597+
fn def_id_for_ty_in_cycle(&self) -> Option<DefId> {
597598
match self.1.value.kind() {
598599
ty::Adt(adt, _) => Some(adt.did()),
599600
_ => None,

compiler/rustc_middle/src/values.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ impl<'tcx> Value<TyCtxt<'tcx>> for Representability {
100100
}
101101
for info in &cycle_error.cycle {
102102
if info.query.dep_kind == dep_kinds::representability_adt_ty
103-
&& let Some(def_id) = info.query.ty_def_id
103+
&& let Some(def_id) = info.query.def_id_for_ty_in_cycle
104104
&& let Some(def_id) = def_id.as_local()
105105
&& !item_and_field_ids.iter().any(|&(id, _)| id == def_id)
106106
{
@@ -182,7 +182,7 @@ impl<'tcx, T> Value<TyCtxt<'tcx>> for Result<T, &'_ ty::layout::LayoutError<'_>>
182182
&cycle_error.cycle,
183183
|cycle| {
184184
if cycle[0].query.dep_kind == dep_kinds::layout_of
185-
&& let Some(def_id) = cycle[0].query.ty_def_id
185+
&& let Some(def_id) = cycle[0].query.def_id_for_ty_in_cycle
186186
&& let Some(def_id) = def_id.as_local()
187187
&& let def_kind = tcx.def_kind(def_id)
188188
&& matches!(def_kind, DefKind::Closure)
@@ -209,7 +209,7 @@ impl<'tcx, T> Value<TyCtxt<'tcx>> for Result<T, &'_ ty::layout::LayoutError<'_>>
209209
if frame.query.dep_kind != dep_kinds::layout_of {
210210
continue;
211211
}
212-
let Some(frame_def_id) = frame.query.ty_def_id else {
212+
let Some(frame_def_id) = frame.query.def_id_for_ty_in_cycle else {
213213
continue;
214214
};
215215
let Some(frame_coroutine_kind) = tcx.coroutine_kind(frame_def_id) else {

compiler/rustc_query_impl/src/plumbing.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -349,9 +349,9 @@ pub(crate) fn create_query_frame<
349349
hasher.finish::<Hash64>()
350350
})
351351
};
352-
let ty_def_id = key.ty_def_id();
352+
let def_id_for_ty_in_cycle = key.def_id_for_ty_in_cycle();
353353

354-
QueryStackFrame::new(description, span, def_id, def_kind, kind, ty_def_id, hash)
354+
QueryStackFrame::new(description, span, def_id, def_kind, kind, def_id_for_ty_in_cycle, hash)
355355
}
356356

357357
pub(crate) fn encode_query_results<'a, 'tcx, Q>(

compiler/rustc_query_system/src/query/mod.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ pub struct QueryStackFrame {
3333
pub def_id: Option<DefId>,
3434
pub def_kind: Option<DefKind>,
3535
/// A def-id that is extracted from a `Ty` in a query key
36-
pub ty_def_id: Option<DefId>,
36+
pub def_id_for_ty_in_cycle: Option<DefId>,
3737
pub dep_kind: DepKind,
3838
/// This hash is used to deterministically pick
3939
/// a query to remove cycles in the parallel compiler.
@@ -48,10 +48,10 @@ impl QueryStackFrame {
4848
def_id: Option<DefId>,
4949
def_kind: Option<DefKind>,
5050
dep_kind: DepKind,
51-
ty_def_id: Option<DefId>,
51+
def_id_for_ty_in_cycle: Option<DefId>,
5252
hash: impl FnOnce() -> Hash64,
5353
) -> Self {
54-
Self { description, span, def_id, def_kind, ty_def_id, dep_kind, hash: hash() }
54+
Self { description, span, def_id, def_kind, def_id_for_ty_in_cycle, dep_kind, hash: hash() }
5555
}
5656

5757
// FIXME(eddyb) Get more valid `Span`s on queries.

library/core/src/error.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#![stable(feature = "error_in_core", since = "1.81.0")]
33

44
use crate::any::TypeId;
5-
use crate::fmt::{Debug, Display, Formatter, Result};
5+
use crate::fmt::{self, Debug, Display, Formatter};
66

77
/// `Error` is a trait representing the basic expectations for error values,
88
/// i.e., values of type `E` in [`Result<T, E>`].
@@ -857,7 +857,7 @@ impl<'a> Request<'a> {
857857

858858
#[unstable(feature = "error_generic_member_access", issue = "99301")]
859859
impl<'a> Debug for Request<'a> {
860-
fn fmt(&self, f: &mut Formatter<'_>) -> Result {
860+
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
861861
f.debug_struct("Request").finish_non_exhaustive()
862862
}
863863
}

library/std/src/path.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -2327,7 +2327,9 @@ impl Path {
23272327
// FIXME: Allow Redox prefixes
23282328
self.has_root() || has_redox_scheme(self.as_u8_slice())
23292329
} else {
2330-
self.has_root() && (cfg!(any(unix, target_os = "wasi")) || self.prefix().is_some())
2330+
self.has_root()
2331+
&& (cfg!(any(unix, target_os = "hermit", target_os = "wasi"))
2332+
|| self.prefix().is_some())
23312333
}
23322334
}
23332335

library/std/src/sys/pal/hermit/fs.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use super::hermit_abi::{
33
self, DT_DIR, DT_LNK, DT_REG, DT_UNKNOWN, O_APPEND, O_CREAT, O_DIRECTORY, O_EXCL, O_RDONLY,
44
O_RDWR, O_TRUNC, O_WRONLY, S_IFDIR, S_IFLNK, S_IFMT, S_IFREG, dirent64, stat as stat_struct,
55
};
6-
use crate::ffi::{CStr, OsStr, OsString};
6+
use crate::ffi::{CStr, OsStr, OsString, c_char};
77
use crate::io::{self, BorrowedCursor, Error, ErrorKind, IoSlice, IoSliceMut, SeekFrom};
88
use crate::os::hermit::ffi::OsStringExt;
99
use crate::os::hermit::io::{AsFd, AsRawFd, BorrowedFd, FromRawFd, IntoRawFd, RawFd};
@@ -204,7 +204,7 @@ impl Iterator for ReadDir {
204204
// the size of dirent64. The file name is always a C string and terminated by `\0`.
205205
// Consequently, we are able to ignore the last byte.
206206
let name_bytes =
207-
unsafe { CStr::from_ptr(&dir.d_name as *const _ as *const i8).to_bytes() };
207+
unsafe { CStr::from_ptr(&dir.d_name as *const _ as *const c_char).to_bytes() };
208208
let entry = DirEntry {
209209
root: self.inner.root.clone(),
210210
ino: dir.d_ino,
@@ -445,7 +445,7 @@ impl DirBuilder {
445445

446446
pub fn mkdir(&self, path: &Path) -> io::Result<()> {
447447
run_path_with_cstr(path, &|path| {
448-
cvt(unsafe { hermit_abi::mkdir(path.as_ptr(), self.mode.into()) }).map(|_| ())
448+
cvt(unsafe { hermit_abi::mkdir(path.as_ptr().cast(), self.mode.into()) }).map(|_| ())
449449
})
450450
}
451451

library/std/src/sys/pal/hermit/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ pub unsafe extern "C" fn runtime_entry(
8585
}
8686

8787
// initialize environment
88-
os::init_environment(env as *const *const i8);
88+
os::init_environment(env);
8989

9090
let result = unsafe { main(argc as isize, argv) };
9191

library/std/src/sys/pal/hermit/os.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use core::slice::memchr;
33
use super::hermit_abi;
44
use crate::collections::HashMap;
55
use crate::error::Error as StdError;
6-
use crate::ffi::{CStr, OsStr, OsString};
6+
use crate::ffi::{CStr, OsStr, OsString, c_char};
77
use crate::marker::PhantomData;
88
use crate::os::hermit::ffi::OsStringExt;
99
use crate::path::{self, PathBuf};
@@ -70,7 +70,7 @@ pub fn current_exe() -> io::Result<PathBuf> {
7070

7171
static ENV: Mutex<Option<HashMap<OsString, OsString>>> = Mutex::new(None);
7272

73-
pub fn init_environment(env: *const *const i8) {
73+
pub fn init_environment(env: *const *const c_char) {
7474
let mut guard = ENV.lock().unwrap();
7575
let map = guard.insert(HashMap::new());
7676

src/tools/clippy/clippy_lints/src/methods/unnecessary_filter_map.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,12 @@ use clippy_utils::diagnostics::span_lint_and_sugg;
33
use clippy_utils::ty::is_copy;
44
use clippy_utils::usage::mutated_variables;
55
use clippy_utils::visitors::{Descend, for_each_expr_without_closures};
6-
use clippy_utils::{MaybePath, is_res_lang_ctor, is_trait_method, path_res, path_to_local_id};
6+
use clippy_utils::{is_res_lang_ctor, is_trait_method, path_res, path_to_local_id};
77
use core::ops::ControlFlow;
88
use rustc_errors::Applicability;
99
use rustc_hir as hir;
1010
use rustc_hir::LangItem::{OptionNone, OptionSome};
1111
use rustc_lint::LateContext;
12-
use rustc_middle::query::Key;
1312
use rustc_middle::ty;
1413
use rustc_span::sym;
1514

@@ -44,7 +43,6 @@ pub(super) fn check<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx hir::Expr<'tcx>, a
4443
if name == "filter_map"
4544
&& let hir::ExprKind::Call(expr, args) = body.value.kind
4645
&& is_res_lang_ctor(cx, path_res(cx, expr), OptionSome)
47-
&& arg_id.ty_def_id() == args[0].hir_id().ty_def_id()
4846
&& let hir::ExprKind::Path(_) = args[0].kind
4947
{
5048
span_lint_and_sugg(

tests/ui/async-await/inference_var_self_argument.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ error[E0307]: invalid `self` parameter type: `&dyn Foo`
44
LL | async fn foo(self: &dyn Foo) {
55
| ^^^^^^^^
66
|
7-
= note: type of `self` must be `Self` or some type implementing `Receiver`
8-
= help: consider changing to `self`, `&self`, `&mut self`, or a type implementing `Receiver` such as `self: Box<Self>`, `self: Rc<Self>`, or `self: Arc<Self>`
7+
= note: type of `self` must be `Self` or a type that dereferences to it
8+
= help: consider changing to `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`)
99

1010
error[E0038]: the trait `Foo` cannot be made into an object
1111
--> $DIR/inference_var_self_argument.rs:5:5

tests/ui/async-await/issue-66312.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ error[E0307]: invalid `self` parameter type: `T`
44
LL | fn is_some(self: T);
55
| ^
66
|
7-
= note: type of `self` must be `Self` or some type implementing `Receiver`
8-
= help: consider changing to `self`, `&self`, `&mut self`, or a type implementing `Receiver` such as `self: Box<Self>`, `self: Rc<Self>`, or `self: Arc<Self>`
7+
= note: type of `self` must be `Self` or a type that dereferences to it
8+
= help: consider changing to `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`)
99

1010
error[E0308]: mismatched types
1111
--> $DIR/issue-66312.rs:9:8

tests/ui/feature-gates/feature-gate-arbitrary-self-types-pointers.stderr tests/ui/feature-gates/feature-gate-arbitrary-self-types-pointers.default.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0658]: `*const Bar` cannot be used as the type of `self` without the `arbitrary_self_types_pointers` feature
2-
--> $DIR/feature-gate-arbitrary-self-types-pointers.rs:8:18
2+
--> $DIR/feature-gate-arbitrary-self-types-pointers.rs:11:18
33
|
44
LL | fn foo(self: *const Self) {}
55
| ^^^^^^^^^^^
@@ -10,7 +10,7 @@ LL | fn foo(self: *const Self) {}
1010
= help: consider changing to `self`, `&self`, `&mut self`, or a type implementing `Receiver` such as `self: Box<Self>`, `self: Rc<Self>`, or `self: Arc<Self>`
1111

1212
error[E0658]: `*mut Bar` cannot be used as the type of `self` without the `arbitrary_self_types_pointers` feature
13-
--> $DIR/feature-gate-arbitrary-self-types-pointers.rs:12:18
13+
--> $DIR/feature-gate-arbitrary-self-types-pointers.rs:15:18
1414
|
1515
LL | fn bar(self: *mut Self) {}
1616
| ^^^^^^^^^
@@ -21,7 +21,7 @@ LL | fn bar(self: *mut Self) {}
2121
= help: consider changing to `self`, `&self`, `&mut self`, or a type implementing `Receiver` such as `self: Box<Self>`, `self: Rc<Self>`, or `self: Arc<Self>`
2222

2323
error[E0658]: `*const Self` cannot be used as the type of `self` without the `arbitrary_self_types_pointers` feature
24-
--> $DIR/feature-gate-arbitrary-self-types-pointers.rs:2:18
24+
--> $DIR/feature-gate-arbitrary-self-types-pointers.rs:5:18
2525
|
2626
LL | fn foo(self: *const Self);
2727
| ^^^^^^^^^^^
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
error[E0658]: `*const Bar` cannot be used as the type of `self` without the `arbitrary_self_types_pointers` feature
2+
--> $DIR/feature-gate-arbitrary-self-types-pointers.rs:11:18
3+
|
4+
LL | fn foo(self: *const Self) {}
5+
| ^^^^^^^^^^^
6+
|
7+
= note: see issue #44874 <https://github.com/rust-lang/rust/issues/44874> for more information
8+
= help: add `#![feature(arbitrary_self_types_pointers)]` 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+
= help: consider changing to `self`, `&self`, `&mut self`, or a type implementing `Receiver` such as `self: Box<Self>`, `self: Rc<Self>`, or `self: Arc<Self>`
11+
12+
error[E0658]: `*mut Bar` cannot be used as the type of `self` without the `arbitrary_self_types_pointers` feature
13+
--> $DIR/feature-gate-arbitrary-self-types-pointers.rs:15:18
14+
|
15+
LL | fn bar(self: *mut Self) {}
16+
| ^^^^^^^^^
17+
|
18+
= note: see issue #44874 <https://github.com/rust-lang/rust/issues/44874> for more information
19+
= help: add `#![feature(arbitrary_self_types_pointers)]` to the crate attributes to enable
20+
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
21+
= help: consider changing to `self`, `&self`, `&mut self`, or a type implementing `Receiver` such as `self: Box<Self>`, `self: Rc<Self>`, or `self: Arc<Self>`
22+
23+
error[E0658]: `*const Self` cannot be used as the type of `self` without the `arbitrary_self_types_pointers` feature
24+
--> $DIR/feature-gate-arbitrary-self-types-pointers.rs:5:18
25+
|
26+
LL | fn foo(self: *const Self);
27+
| ^^^^^^^^^^^
28+
|
29+
= note: see issue #44874 <https://github.com/rust-lang/rust/issues/44874> for more information
30+
= help: add `#![feature(arbitrary_self_types_pointers)]` to the crate attributes to enable
31+
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
32+
= help: consider changing to `self`, `&self`, `&mut self`, or a type implementing `Receiver` such as `self: Box<Self>`, `self: Rc<Self>`, or `self: Arc<Self>`
33+
34+
error: aborting due to 3 previous errors
35+
36+
For more information about this error, try `rustc --explain E0658`.

tests/ui/feature-gates/feature-gate-arbitrary-self-types-pointers.rs

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
//@ revisions: default feature
2+
#![cfg_attr(feature, feature(arbitrary_self_types))]
3+
14
trait Foo {
25
fn foo(self: *const Self); //~ ERROR `*const Self` cannot be used as the type of `self`
36
}

tests/ui/feature-gates/feature-gate-dispatch-from-dyn-cell.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ error[E0307]: invalid `self` parameter type: `Cell<&Self>`
44
LL | fn cell(self: Cell<&Self>);
55
| ^^^^^^^^^^^
66
|
7-
= note: type of `self` must be `Self` or some type implementing `Receiver`
8-
= help: consider changing to `self`, `&self`, `&mut self`, or a type implementing `Receiver` such as `self: Box<Self>`, `self: Rc<Self>`, or `self: Arc<Self>`
7+
= note: type of `self` must be `Self` or a type that dereferences to it
8+
= help: consider changing to `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`)
99

1010
error: aborting due to 1 previous error
1111

0 commit comments

Comments
 (0)