Auto merge of #89019 - Manishearth:rollup-5qp8a5s, r=Manishearth

Rollup of 10 pull requests

Successful merges:

 - #88292 (Enable --generate-link-to-definition for rustc's docs)
 - #88729 (Recover from `Foo(a: 1, b: 2)`)
 - #88875 (cleanup(rustc_trait_selection): remove vestigial code from rustc_on_unimplemented)
 - #88892 (Move object safety suggestions to the end of the error)
 - #88928 (Document the closure arguments for `reduce`.)
 - #88976 (Clean up and add doc comments for CStr)
 - #88983 (Allow calling `get_body_with_borrowck_facts` without `-Z polonius`)
 - #88985 (Update clobber_abi list to include k[1-7] regs)
 - #88986 (Update the backtrace crate)
 - #89009 (Fix typo in `break` docs)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
This commit is contained in:
bors 2021-09-16 19:33:39 +00:00
commit e4828d5b7f
49 changed files with 210 additions and 106 deletions

View File

@ -14,7 +14,9 @@ pub use super::{
}; };
/// This function computes Polonius facts for the given body. It makes a copy of /// This function computes Polonius facts for the given body. It makes a copy of
/// the body because it needs to regenerate the region identifiers. /// the body because it needs to regenerate the region identifiers. This function
/// should never be invoked during a typical compilation session due to performance
/// issues with Polonius.
/// ///
/// Note: /// Note:
/// * This function will panic if the required body was already stolen. This /// * This function will panic if the required body was already stolen. This
@ -22,8 +24,6 @@ pub use super::{
/// because they are evaluated during typechecking. The panic can be avoided /// because they are evaluated during typechecking. The panic can be avoided
/// by overriding the `mir_borrowck` query. You can find a complete example /// by overriding the `mir_borrowck` query. You can find a complete example
/// that shows how to do this at `src/test/run-make/obtain-borrowck/`. /// that shows how to do this at `src/test/run-make/obtain-borrowck/`.
/// * This function will also panic if computation of Polonius facts
/// (`-Zpolonius` flag) is not enabled.
/// ///
/// * Polonius is highly unstable, so expect regular changes in its signature or other details. /// * Polonius is highly unstable, so expect regular changes in its signature or other details.
pub fn get_body_with_borrowck_facts<'tcx>( pub fn get_body_with_borrowck_facts<'tcx>(

View File

@ -154,11 +154,6 @@ fn do_mir_borrowck<'a, 'tcx>(
debug!("do_mir_borrowck(def = {:?})", def); debug!("do_mir_borrowck(def = {:?})", def);
assert!(
!return_body_with_facts || infcx.tcx.sess.opts.debugging_opts.polonius,
"borrowck facts can be requested only when Polonius is enabled"
);
let tcx = infcx.tcx; let tcx = infcx.tcx;
let param_env = tcx.param_env(def.did); let param_env = tcx.param_env(def.did);
let id = tcx.hir().local_def_id_to_hir_id(def.did); let id = tcx.hir().local_def_id_to_hir_id(def.did);
@ -235,6 +230,8 @@ fn do_mir_borrowck<'a, 'tcx>(
let borrow_set = let borrow_set =
Rc::new(BorrowSet::build(tcx, body, locals_are_invalidated_at_exit, &mdpe.move_data)); Rc::new(BorrowSet::build(tcx, body, locals_are_invalidated_at_exit, &mdpe.move_data));
let use_polonius = return_body_with_facts || infcx.tcx.sess.opts.debugging_opts.polonius;
// Compute non-lexical lifetimes. // Compute non-lexical lifetimes.
let nll::NllOutput { let nll::NllOutput {
regioncx, regioncx,
@ -254,6 +251,7 @@ fn do_mir_borrowck<'a, 'tcx>(
&mdpe.move_data, &mdpe.move_data,
&borrow_set, &borrow_set,
&upvars, &upvars,
use_polonius,
); );
// Dump MIR results into a file, if that is enabled. This let us // Dump MIR results into a file, if that is enabled. This let us

View File

@ -164,8 +164,10 @@ pub(crate) fn compute_regions<'cx, 'tcx>(
move_data: &MoveData<'tcx>, move_data: &MoveData<'tcx>,
borrow_set: &BorrowSet<'tcx>, borrow_set: &BorrowSet<'tcx>,
upvars: &[Upvar<'tcx>], upvars: &[Upvar<'tcx>],
use_polonius: bool,
) -> NllOutput<'tcx> { ) -> NllOutput<'tcx> {
let mut all_facts = AllFacts::enabled(infcx.tcx).then_some(AllFacts::default()); let mut all_facts =
(use_polonius || AllFacts::enabled(infcx.tcx)).then_some(AllFacts::default());
let universal_regions = Rc::new(universal_regions); let universal_regions = Rc::new(universal_regions);
@ -281,7 +283,7 @@ pub(crate) fn compute_regions<'cx, 'tcx>(
all_facts.write_to_dir(dir_path, location_table).unwrap(); all_facts.write_to_dir(dir_path, location_table).unwrap();
} }
if infcx.tcx.sess.opts.debugging_opts.polonius { if use_polonius {
let algorithm = let algorithm =
env::var("POLONIUS_ALGORITHM").unwrap_or_else(|_| String::from("Hybrid")); env::var("POLONIUS_ALGORITHM").unwrap_or_else(|_| String::from("Hybrid"));
let algorithm = Algorithm::from_str(&algorithm).unwrap(); let algorithm = Algorithm::from_str(&algorithm).unwrap();

View File

@ -72,7 +72,7 @@ pub(super) fn parse(
// this with just `span.edition()`. A // this with just `span.edition()`. A
// `SyntaxContext::root()` from the current crate will // `SyntaxContext::root()` from the current crate will
// have the edition of the current crate, and a // have the edition of the current crate, and a
// `SyntaxxContext::root()` from a foreign crate will // `SyntaxContext::root()` from a foreign crate will
// have the edition of that crate (which we manually // have the edition of that crate (which we manually
// retrieve via the `edition` parameter). // retrieve via the `edition` parameter).
if span.ctxt() == SyntaxContext::root() { if span.ctxt() == SyntaxContext::root() {

View File

@ -83,10 +83,6 @@ pub fn report_object_safety_error(
messages.push(msg.clone()); messages.push(msg.clone());
} }
} }
if trait_span.is_some() {
// Only provide the help if its a local trait, otherwise it's not actionable.
violation.solution(&mut err);
}
} }
} }
let has_multi_span = !multi_span.is_empty(); let has_multi_span = !multi_span.is_empty();
@ -104,5 +100,13 @@ pub fn report_object_safety_error(
to be resolvable dynamically; for more information visit \ to be resolvable dynamically; for more information visit \
<https://doc.rust-lang.org/reference/items/traits.html#object-safety>", <https://doc.rust-lang.org/reference/items/traits.html#object-safety>",
); );
if trait_span.is_some() {
let mut reported_violations: Vec<_> = reported_violations.into_iter().collect();
reported_violations.sort();
for violation in reported_violations {
// Only provide the help if its a local trait, otherwise it's not actionable.
violation.solution(&mut err);
}
}
err err
} }

View File

@ -730,7 +730,7 @@ pub struct ImplSourceTraitAliasData<'tcx, N> {
pub nested: Vec<N>, pub nested: Vec<N>,
} }
#[derive(Clone, Debug, PartialEq, Eq, Hash, HashStable)] #[derive(Clone, Debug, PartialEq, Eq, Hash, HashStable, PartialOrd, Ord)]
pub enum ObjectSafetyViolation { pub enum ObjectSafetyViolation {
/// `Self: Sized` declared on the trait. /// `Self: Sized` declared on the trait.
SizedSelf(SmallVec<[Span; 1]>), SizedSelf(SmallVec<[Span; 1]>),
@ -879,7 +879,7 @@ impl ObjectSafetyViolation {
} }
/// Reasons a method might not be object-safe. /// Reasons a method might not be object-safe.
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, HashStable)] #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, HashStable, PartialOrd, Ord)]
pub enum MethodViolationCode { pub enum MethodViolationCode {
/// e.g., `fn foo()` /// e.g., `fn foo()`
StaticMethod(Option<(&'static str, Span)>, Span, bool /* has args */), StaticMethod(Option<(&'static str, Span)>, Span, bool /* has args */),

View File

@ -28,8 +28,8 @@ pub use self::drop_flag_effects::{
on_lookup_result_bits, on_lookup_result_bits,
}; };
pub use self::framework::{ pub use self::framework::{
fmt, lattice, visit_results, Analysis, AnalysisDomain, Backward, Direction, Engine, Forward, fmt, graphviz, lattice, visit_results, Analysis, AnalysisDomain, Backward, Direction, Engine,
GenKill, GenKillAnalysis, JoinSemiLattice, Results, ResultsCursor, ResultsRefCursor, Forward, GenKill, GenKillAnalysis, JoinSemiLattice, Results, ResultsCursor, ResultsRefCursor,
ResultsVisitable, ResultsVisitor, ResultsVisitable, ResultsVisitor,
}; };

View File

@ -76,7 +76,7 @@ mod unreachable_prop;
use rustc_const_eval::transform::check_consts; use rustc_const_eval::transform::check_consts;
use rustc_const_eval::transform::promote_consts; use rustc_const_eval::transform::promote_consts;
use rustc_const_eval::transform::validate; use rustc_const_eval::transform::validate;
use rustc_const_eval::transform::MirPass; pub use rustc_const_eval::transform::MirPass;
use rustc_mir_dataflow::rustc_peek; use rustc_mir_dataflow::rustc_peek;
pub fn provide(providers: &mut Providers) { pub fn provide(providers: &mut Providers) {

View File

@ -907,6 +907,12 @@ impl<'a> Parser<'a> {
} }
} }
fn look_ahead_type_ascription_as_field(&mut self) -> bool {
self.look_ahead(1, |t| t.is_ident())
&& self.look_ahead(2, |t| t == &token::Colon)
&& self.look_ahead(3, |t| t.can_begin_expr())
}
fn parse_dot_suffix_expr(&mut self, lo: Span, base: P<Expr>) -> PResult<'a, P<Expr>> { fn parse_dot_suffix_expr(&mut self, lo: Span, base: P<Expr>) -> PResult<'a, P<Expr>> {
match self.token.uninterpolate().kind { match self.token.uninterpolate().kind {
token::Ident(..) => self.parse_dot_suffix(base, lo), token::Ident(..) => self.parse_dot_suffix(base, lo),
@ -1056,12 +1062,76 @@ impl<'a> Parser<'a> {
/// Parse a function call expression, `expr(...)`. /// Parse a function call expression, `expr(...)`.
fn parse_fn_call_expr(&mut self, lo: Span, fun: P<Expr>) -> P<Expr> { fn parse_fn_call_expr(&mut self, lo: Span, fun: P<Expr>) -> P<Expr> {
let seq = self.parse_paren_expr_seq().map(|args| { let snapshot = if self.token.kind == token::OpenDelim(token::Paren)
&& self.look_ahead_type_ascription_as_field()
{
Some((self.clone(), fun.kind.clone()))
} else {
None
};
let open_paren = self.token.span;
let mut seq = self.parse_paren_expr_seq().map(|args| {
self.mk_expr(lo.to(self.prev_token.span), self.mk_call(fun, args), AttrVec::new()) self.mk_expr(lo.to(self.prev_token.span), self.mk_call(fun, args), AttrVec::new())
}); });
if let Some(expr) =
self.maybe_recover_struct_lit_bad_delims(lo, open_paren, &mut seq, snapshot)
{
return expr;
}
self.recover_seq_parse_error(token::Paren, lo, seq) self.recover_seq_parse_error(token::Paren, lo, seq)
} }
/// If we encounter a parser state that looks like the user has written a `struct` literal with
/// parentheses instead of braces, recover the parser state and provide suggestions.
fn maybe_recover_struct_lit_bad_delims(
&mut self,
lo: Span,
open_paren: Span,
seq: &mut PResult<'a, P<Expr>>,
snapshot: Option<(Self, ExprKind)>,
) -> Option<P<Expr>> {
match (seq.as_mut(), snapshot) {
(Err(ref mut err), Some((mut snapshot, ExprKind::Path(None, path)))) => {
let name = pprust::path_to_string(&path);
snapshot.bump(); // `(`
match snapshot.parse_struct_fields(path.clone(), false, token::Paren) {
Ok((fields, ..)) if snapshot.eat(&token::CloseDelim(token::Paren)) => {
// We have are certain we have `Enum::Foo(a: 3, b: 4)`, suggest
// `Enum::Foo { a: 3, b: 4 }` or `Enum::Foo(3, 4)`.
*self = snapshot;
let close_paren = self.prev_token.span;
let span = lo.to(self.prev_token.span);
err.cancel();
self.struct_span_err(
span,
"invalid `struct` delimiters or `fn` call arguments",
)
.multipart_suggestion(
&format!("if `{}` is a struct, use braces as delimiters", name),
vec![(open_paren, " { ".to_string()), (close_paren, " }".to_string())],
Applicability::MaybeIncorrect,
)
.multipart_suggestion(
&format!("if `{}` is a function, use the arguments directly", name),
fields
.into_iter()
.map(|field| (field.span.until(field.expr.span), String::new()))
.collect(),
Applicability::MaybeIncorrect,
)
.emit();
return Some(self.mk_expr_err(span));
}
Ok(_) => {}
Err(mut err) => err.emit(),
}
}
_ => {}
}
None
}
/// Parse an indexing expression `expr[...]`. /// Parse an indexing expression `expr[...]`.
fn parse_index_expr(&mut self, lo: Span, base: P<Expr>) -> PResult<'a, P<Expr>> { fn parse_index_expr(&mut self, lo: Span, base: P<Expr>) -> PResult<'a, P<Expr>> {
self.bump(); // `[` self.bump(); // `[`
@ -2374,14 +2444,12 @@ impl<'a> Parser<'a> {
.emit(); .emit();
} }
/// Precondition: already parsed the '{'. pub(super) fn parse_struct_fields(
pub(super) fn parse_struct_expr(
&mut self, &mut self,
qself: Option<ast::QSelf>,
pth: ast::Path, pth: ast::Path,
attrs: AttrVec,
recover: bool, recover: bool,
) -> PResult<'a, P<Expr>> { close_delim: token::DelimToken,
) -> PResult<'a, (Vec<ExprField>, ast::StructRest, bool)> {
let mut fields = Vec::new(); let mut fields = Vec::new();
let mut base = ast::StructRest::None; let mut base = ast::StructRest::None;
let mut recover_async = false; let mut recover_async = false;
@ -2393,11 +2461,11 @@ impl<'a> Parser<'a> {
e.note("for more on editions, read https://doc.rust-lang.org/edition-guide"); e.note("for more on editions, read https://doc.rust-lang.org/edition-guide");
}; };
while self.token != token::CloseDelim(token::Brace) { while self.token != token::CloseDelim(close_delim) {
if self.eat(&token::DotDot) { if self.eat(&token::DotDot) {
let exp_span = self.prev_token.span; let exp_span = self.prev_token.span;
// We permit `.. }` on the left-hand side of a destructuring assignment. // We permit `.. }` on the left-hand side of a destructuring assignment.
if self.check(&token::CloseDelim(token::Brace)) { if self.check(&token::CloseDelim(close_delim)) {
self.sess.gated_spans.gate(sym::destructuring_assignment, self.prev_token.span); self.sess.gated_spans.gate(sym::destructuring_assignment, self.prev_token.span);
base = ast::StructRest::Rest(self.prev_token.span.shrink_to_hi()); base = ast::StructRest::Rest(self.prev_token.span.shrink_to_hi());
break; break;
@ -2438,7 +2506,7 @@ impl<'a> Parser<'a> {
} }
}; };
match self.expect_one_of(&[token::Comma], &[token::CloseDelim(token::Brace)]) { match self.expect_one_of(&[token::Comma], &[token::CloseDelim(close_delim)]) {
Ok(_) => { Ok(_) => {
if let Some(f) = parsed_field.or(recovery_field) { if let Some(f) = parsed_field.or(recovery_field) {
// Only include the field if there's no parse error for the field name. // Only include the field if there's no parse error for the field name.
@ -2469,8 +2537,21 @@ impl<'a> Parser<'a> {
} }
} }
} }
Ok((fields, base, recover_async))
}
let span = pth.span.to(self.token.span); /// Precondition: already parsed the '{'.
pub(super) fn parse_struct_expr(
&mut self,
qself: Option<ast::QSelf>,
pth: ast::Path,
attrs: AttrVec,
recover: bool,
) -> PResult<'a, P<Expr>> {
let lo = pth.span;
let (fields, base, recover_async) =
self.parse_struct_fields(pth.clone(), recover, token::Brace)?;
let span = lo.to(self.token.span);
self.expect(&token::CloseDelim(token::Brace))?; self.expect(&token::CloseDelim(token::Brace))?;
let expr = if recover_async { let expr = if recover_async {
ExprKind::Err ExprKind::Err

View File

@ -934,7 +934,6 @@ symbols! {
panic_unwind, panic_unwind,
panicking, panicking,
param_attrs, param_attrs,
parent_trait,
partial_cmp, partial_cmp,
partial_ord, partial_ord,
passes, passes,

View File

@ -154,9 +154,6 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
flags.push((sym::from_method, Some(method.to_string()))); flags.push((sym::from_method, Some(method.to_string())));
} }
} }
if let Some((t, _)) = self.get_parent_trait_ref(&obligation.cause.code) {
flags.push((sym::parent_trait, Some(t)));
}
if let Some(k) = obligation.cause.span.desugaring_kind() { if let Some(k) = obligation.cause.span.desugaring_kind() {
flags.push((sym::from_desugaring, None)); flags.push((sym::from_desugaring, None));

@ -1 +1 @@
Subproject commit 4f925f8d81dfa57067537217e501e1dff7433491 Subproject commit cc89bb66f91b2b4a640b0b525ca5d753e3346d7e

View File

@ -2172,8 +2172,9 @@ pub trait Iterator {
/// If the iterator is empty, returns [`None`]; otherwise, returns the /// If the iterator is empty, returns [`None`]; otherwise, returns the
/// result of the reduction. /// result of the reduction.
/// ///
/// The reducing function is a closure with two arguments: an 'accumulator', and an element.
/// For iterators with at least one element, this is the same as [`fold()`] /// For iterators with at least one element, this is the same as [`fold()`]
/// with the first element of the iterator as the initial value, folding /// with the first element of the iterator as the initial accumulator value, folding
/// every subsequent element into it. /// every subsequent element into it.
/// ///
/// [`fold()`]: Iterator::fold /// [`fold()`]: Iterator::fold
@ -2187,8 +2188,8 @@ pub trait Iterator {
/// where I: Iterator, /// where I: Iterator,
/// I::Item: Ord, /// I::Item: Ord,
/// { /// {
/// iter.reduce(|a, b| { /// iter.reduce(|accum, item| {
/// if a >= b { a } else { b } /// if accum >= item { accum } else { item }
/// }) /// })
/// } /// }
/// let a = [10, 20, 5, -23, 0]; /// let a = [10, 20, 5, -23, 0];

View File

@ -915,6 +915,7 @@ impl From<CString> for Box<CStr> {
#[stable(feature = "cow_from_cstr", since = "1.28.0")] #[stable(feature = "cow_from_cstr", since = "1.28.0")]
impl<'a> From<CString> for Cow<'a, CStr> { impl<'a> From<CString> for Cow<'a, CStr> {
/// Converts a [`CString`] into an owned [`Cow`] without copying or allocating.
#[inline] #[inline]
fn from(s: CString) -> Cow<'a, CStr> { fn from(s: CString) -> Cow<'a, CStr> {
Cow::Owned(s) Cow::Owned(s)
@ -923,6 +924,7 @@ impl<'a> From<CString> for Cow<'a, CStr> {
#[stable(feature = "cow_from_cstr", since = "1.28.0")] #[stable(feature = "cow_from_cstr", since = "1.28.0")]
impl<'a> From<&'a CStr> for Cow<'a, CStr> { impl<'a> From<&'a CStr> for Cow<'a, CStr> {
/// Converts a [`CStr`] into a borrowed [`Cow`] without copying or allocating.
#[inline] #[inline]
fn from(s: &'a CStr) -> Cow<'a, CStr> { fn from(s: &'a CStr) -> Cow<'a, CStr> {
Cow::Borrowed(s) Cow::Borrowed(s)
@ -931,6 +933,7 @@ impl<'a> From<&'a CStr> for Cow<'a, CStr> {
#[stable(feature = "cow_from_cstr", since = "1.28.0")] #[stable(feature = "cow_from_cstr", since = "1.28.0")]
impl<'a> From<&'a CString> for Cow<'a, CStr> { impl<'a> From<&'a CString> for Cow<'a, CStr> {
/// Converts a `&`[`CString`] into a borrowed [`Cow`] without copying or allocating.
#[inline] #[inline]
fn from(s: &'a CString) -> Cow<'a, CStr> { fn from(s: &'a CString) -> Cow<'a, CStr> {
Cow::Borrowed(s.as_c_str()) Cow::Borrowed(s.as_c_str())

View File

@ -77,7 +77,7 @@ mod as_keyword {}
/// '_inner: for j in 1..=200 { /// '_inner: for j in 1..=200 {
/// println!(" inner iteration (j): {}", j); /// println!(" inner iteration (j): {}", j);
/// if j >= 3 { /// if j >= 3 {
/// // breaks from inner loop, let's outer loop continue. /// // breaks from inner loop, lets outer loop continue.
/// break; /// break;
/// } /// }
/// if i >= 2 { /// if i >= 2 {

View File

@ -589,6 +589,7 @@ impl Step for Rustc {
cargo.rustdocflag("-Zunstable-options"); cargo.rustdocflag("-Zunstable-options");
cargo.rustdocflag("-Znormalize-docs"); cargo.rustdocflag("-Znormalize-docs");
cargo.rustdocflag("--show-type-layout"); cargo.rustdocflag("--show-type-layout");
cargo.rustdocflag("--generate-link-to-definition");
compile::rustc_cargo(builder, &mut cargo, target); compile::rustc_cargo(builder, &mut cargo, target);
cargo.arg("-Zunstable-options"); cargo.arg("-Zunstable-options");
cargo.arg("-Zskip-rustdoc-fingerprint"); cargo.arg("-Zskip-rustdoc-fingerprint");

View File

@ -804,9 +804,9 @@ The following ABIs can be used with `clobber_abi`:
| Architecture | ABI name | Clobbered registers | | Architecture | ABI name | Clobbered registers |
| ------------ | -------- | ------------------- | | ------------ | -------- | ------------------- |
| x86-32 | `"C"`, `"system"`, `"efiapi"`, `"cdecl"`, `"stdcall"`, `"fastcall"` | `ax`, `cx`, `dx`, `xmm[0-7]`, `mm[0-7]`, `st([0-7])` | | x86-32 | `"C"`, `"system"`, `"efiapi"`, `"cdecl"`, `"stdcall"`, `"fastcall"` | `ax`, `cx`, `dx`, `xmm[0-7]`, `mm[0-7]`, `k[1-7]`, `st([0-7])` |
| x86-64 | `"C"`, `"system"` (on Windows), `"efiapi"`, `"win64"` | `ax`, `cx`, `dx`, `r[8-11]`, `xmm[0-31]`, `mm[0-7]`, `st([0-7])` | | x86-64 | `"C"`, `"system"` (on Windows), `"efiapi"`, `"win64"` | `ax`, `cx`, `dx`, `r[8-11]`, `xmm[0-31]`, `mm[0-7]`, `k[1-7]`, `st([0-7])` |
| x86-64 | `"C"`, `"system"` (on non-Windows), `"sysv64"` | `ax`, `cx`, `dx`, `si`, `di`, `r[8-11]`, `xmm[0-31]`, `mm[0-7]`, `st([0-7])` | | x86-64 | `"C"`, `"system"` (on non-Windows), `"sysv64"` | `ax`, `cx`, `dx`, `si`, `di`, `r[8-11]`, `xmm[0-31]`, `mm[0-7]`, `k[1-7]`, `st([0-7])` |
| AArch64 | `"C"`, `"system"`, `"efiapi"` | `x[0-17]`, `x30`, `v[0-31]`, `p[0-15]`, `ffr` | | AArch64 | `"C"`, `"system"`, `"efiapi"` | `x[0-17]`, `x30`, `v[0-31]`, `p[0-15]`, `ffr` |
| ARM | `"C"`, `"system"`, `"efiapi"`, `"aapcs"` | `r[0-3]`, `r12`, `r14`, `s[0-15]`, `d[0-7]`, `d[16-31]` | | ARM | `"C"`, `"system"`, `"efiapi"`, `"aapcs"` | `r[0-3]`, `r12`, `r14`, `s[0-15]`, `d[0-7]`, `d[16-31]` |
| RISC-V | `"C"`, `"system"`, `"efiapi"` | `x1`, `x[5-7]`, `x[10-17]`, `x[28-31]`, `f[0-7]`, `f[10-17]`, `f[28-31]`, `v[0-31]` | | RISC-V | `"C"`, `"system"`, `"efiapi"` | `x1`, `x[5-7]`, `x[10-17]`, `x[28-31]`, `f[0-7]`, `f[10-17]`, `f[28-31]`, `v[0-31]` |

View File

@ -4,7 +4,6 @@ error[E0038]: the trait `Trait` cannot be made into an object
LL | impl dyn Trait { LL | impl dyn Trait {
| ^^^^^^^^^ `Trait` cannot be made into an object | ^^^^^^^^^ `Trait` cannot be made into an object
| |
= help: consider moving `N` to another trait
note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
--> $DIR/associated-const-in-trait.rs:6:11 --> $DIR/associated-const-in-trait.rs:6:11
| |
@ -12,6 +11,7 @@ LL | trait Trait {
| ----- this trait cannot be made into an object... | ----- this trait cannot be made into an object...
LL | const N: usize; LL | const N: usize;
| ^ ...because it contains this associated `const` | ^ ...because it contains this associated `const`
= help: consider moving `N` to another trait
error: aborting due to previous error error: aborting due to previous error

View File

@ -21,7 +21,6 @@ error[E0038]: the trait `Bar` cannot be made into an object
LL | impl dyn Bar {} LL | impl dyn Bar {}
| ^^^^^^^ `Bar` cannot be made into an object | ^^^^^^^ `Bar` cannot be made into an object
| |
= help: consider moving `X` to another trait
note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
--> $DIR/issue-48027.rs:2:11 --> $DIR/issue-48027.rs:2:11
| |
@ -29,6 +28,7 @@ LL | trait Bar {
| --- this trait cannot be made into an object... | --- this trait cannot be made into an object...
LL | const X: usize; LL | const X: usize;
| ^ ...because it contains this associated `const` | ^ ...because it contains this associated `const`
= help: consider moving `X` to another trait
error: aborting due to 2 previous errors error: aborting due to 2 previous errors

View File

@ -4,7 +4,6 @@ error[E0038]: the trait `NotObjectSafe` cannot be made into an object
LL | impl NotObjectSafe for dyn NotObjectSafe { } LL | impl NotObjectSafe for dyn NotObjectSafe { }
| ^^^^^^^^^^^^^^^^^ `NotObjectSafe` cannot be made into an object | ^^^^^^^^^^^^^^^^^ `NotObjectSafe` cannot be made into an object
| |
= help: consider moving `eq` to another trait
note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
--> $DIR/coherence-impl-trait-for-trait-object-safe.rs:6:43 --> $DIR/coherence-impl-trait-for-trait-object-safe.rs:6:43
| |
@ -12,6 +11,7 @@ LL | trait NotObjectSafe { fn eq(&self, other: Self); }
| ------------- ^^^^ ...because method `eq` references the `Self` type in this parameter | ------------- ^^^^ ...because method `eq` references the `Self` type in this parameter
| | | |
| this trait cannot be made into an object... | this trait cannot be made into an object...
= help: consider moving `eq` to another trait
error: aborting due to previous error error: aborting due to previous error

View File

@ -4,7 +4,6 @@ error[E0038]: the trait `Foo` cannot be made into an object
LL | fn use_dyn(v: &dyn Foo) { LL | fn use_dyn(v: &dyn Foo) {
| ^^^^^^^ `Foo` cannot be made into an object | ^^^^^^^ `Foo` cannot be made into an object
| |
= help: consider moving `test` to another trait
note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
--> $DIR/object-safety-err-ret.rs:8:23 --> $DIR/object-safety-err-ret.rs:8:23
| |
@ -12,6 +11,7 @@ LL | trait Foo {
| --- this trait cannot be made into an object... | --- this trait cannot be made into an object...
LL | fn test(&self) -> [u8; bar::<Self>()]; LL | fn test(&self) -> [u8; bar::<Self>()];
| ^^^^^^^^^^^^^^^^^^^ ...because method `test` references the `Self` type in its return type | ^^^^^^^^^^^^^^^^^^^ ...because method `test` references the `Self` type in its return type
= help: consider moving `test` to another trait
error: aborting due to previous error error: aborting due to previous error

View File

@ -4,7 +4,6 @@ error[E0038]: the trait `Trait` cannot be made into an object
LL | fn call_foo(x: Box<dyn Trait>) { LL | fn call_foo(x: Box<dyn Trait>) {
| ^^^^^^^^^ `Trait` cannot be made into an object | ^^^^^^^^^ `Trait` cannot be made into an object
| |
= help: consider moving `foo` to another trait
note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
--> $DIR/E0038.rs:2:22 --> $DIR/E0038.rs:2:22
| |
@ -12,6 +11,7 @@ LL | trait Trait {
| ----- this trait cannot be made into an object... | ----- this trait cannot be made into an object...
LL | fn foo(&self) -> Self; LL | fn foo(&self) -> Self;
| ^^^^ ...because method `foo` references the `Self` type in its return type | ^^^^ ...because method `foo` references the `Self` type in its return type
= help: consider moving `foo` to another trait
error: aborting due to previous error error: aborting due to previous error

View File

@ -40,7 +40,6 @@ error[E0038]: the trait `NonObjectSafe3` cannot be made into an object
LL | fn takes_non_object_safe_box(obj: Box<dyn NonObjectSafe3>) { LL | fn takes_non_object_safe_box(obj: Box<dyn NonObjectSafe3>) {
| ^^^^^^^^^^^^^^^^^^ `NonObjectSafe3` cannot be made into an object | ^^^^^^^^^^^^^^^^^^ `NonObjectSafe3` cannot be made into an object
| |
= help: consider moving `foo` to another trait
note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
--> $DIR/feature-gate-object_safe_for_dispatch.rs:11:8 --> $DIR/feature-gate-object_safe_for_dispatch.rs:11:8
| |
@ -48,6 +47,7 @@ LL | trait NonObjectSafe3 {
| -------------- this trait cannot be made into an object... | -------------- this trait cannot be made into an object...
LL | fn foo<T>(&self); LL | fn foo<T>(&self);
| ^^^ ...because method `foo` has generic type parameters | ^^^ ...because method `foo` has generic type parameters
= help: consider moving `foo` to another trait
error[E0038]: the trait `NonObjectSafe4` cannot be made into an object error[E0038]: the trait `NonObjectSafe4` cannot be made into an object
--> $DIR/feature-gate-object_safe_for_dispatch.rs:31:35 --> $DIR/feature-gate-object_safe_for_dispatch.rs:31:35
@ -55,7 +55,6 @@ error[E0038]: the trait `NonObjectSafe4` cannot be made into an object
LL | fn return_non_object_safe_rc() -> std::rc::Rc<dyn NonObjectSafe4> { LL | fn return_non_object_safe_rc() -> std::rc::Rc<dyn NonObjectSafe4> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `NonObjectSafe4` cannot be made into an object | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `NonObjectSafe4` cannot be made into an object
| |
= help: consider moving `foo` to another trait
note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
--> $DIR/feature-gate-object_safe_for_dispatch.rs:15:22 --> $DIR/feature-gate-object_safe_for_dispatch.rs:15:22
| |
@ -63,6 +62,7 @@ LL | trait NonObjectSafe4 {
| -------------- this trait cannot be made into an object... | -------------- this trait cannot be made into an object...
LL | fn foo(&self, s: &Self); LL | fn foo(&self, s: &Self);
| ^^^^^ ...because method `foo` references the `Self` type in this parameter | ^^^^^ ...because method `foo` references the `Self` type in this parameter
= help: consider moving `foo` to another trait
error[E0038]: the trait `NonObjectSafe1` cannot be made into an object error[E0038]: the trait `NonObjectSafe1` cannot be made into an object
--> $DIR/feature-gate-object_safe_for_dispatch.rs:38:16 --> $DIR/feature-gate-object_safe_for_dispatch.rs:38:16

View File

@ -4,7 +4,6 @@ error[E0038]: the trait `Foo` cannot be made into an object
LL | fn f(_arg : Box<dyn for<'a> Foo<A<'a> = &'a ()>>) {} LL | fn f(_arg : Box<dyn for<'a> Foo<A<'a> = &'a ()>>) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `Foo` cannot be made into an object | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `Foo` cannot be made into an object
| |
= help: consider moving `A` to another trait
note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
--> $DIR/gat-in-trait-path.rs:5:10 --> $DIR/gat-in-trait-path.rs:5:10
| |
@ -12,6 +11,7 @@ LL | trait Foo {
| --- this trait cannot be made into an object... | --- this trait cannot be made into an object...
LL | type A<'a> where Self: 'a; LL | type A<'a> where Self: 'a;
| ^ ...because it contains the generic associated type `A` | ^ ...because it contains the generic associated type `A`
= help: consider moving `A` to another trait
error: aborting due to previous error error: aborting due to previous error

View File

@ -4,7 +4,6 @@ error[E0038]: the trait `X` cannot be made into an object
LL | fn _func1<'a>(_x: Box<dyn X<Y<'a>=&'a ()>>) {} LL | fn _func1<'a>(_x: Box<dyn X<Y<'a>=&'a ()>>) {}
| ^^^^^^^^^^^^^^^^^^^ `X` cannot be made into an object | ^^^^^^^^^^^^^^^^^^^ `X` cannot be made into an object
| |
= help: consider moving `Y` to another trait
note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
--> $DIR/issue-67510-pass.rs:4:10 --> $DIR/issue-67510-pass.rs:4:10
| |
@ -12,6 +11,7 @@ LL | trait X {
| - this trait cannot be made into an object... | - this trait cannot be made into an object...
LL | type Y<'a>; LL | type Y<'a>;
| ^ ...because it contains the generic associated type `Y` | ^ ...because it contains the generic associated type `Y`
= help: consider moving `Y` to another trait
error: aborting due to previous error error: aborting due to previous error

View File

@ -20,7 +20,6 @@ error[E0038]: the trait `SuperTrait` cannot be made into an object
LL | let sub: Box<dyn SuperTrait<SubType = SubStruct>> = Box::new(SuperStruct::new(0)); LL | let sub: Box<dyn SuperTrait<SubType = SubStruct>> = Box::new(SuperStruct::new(0));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `SuperTrait` cannot be made into an object | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `SuperTrait` cannot be made into an object
| |
= help: consider moving `SubType` to another trait
note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
--> $DIR/issue-76535.rs:6:10 --> $DIR/issue-76535.rs:6:10
| |
@ -28,6 +27,7 @@ LL | pub trait SuperTrait {
| ---------- this trait cannot be made into an object... | ---------- this trait cannot be made into an object...
LL | type SubType<'a>: SubTrait; LL | type SubType<'a>: SubTrait;
| ^^^^^^^ ...because it contains the generic associated type `SubType` | ^^^^^^^ ...because it contains the generic associated type `SubType`
= help: consider moving `SubType` to another trait
error[E0038]: the trait `SuperTrait` cannot be made into an object error[E0038]: the trait `SuperTrait` cannot be made into an object
--> $DIR/issue-76535.rs:36:57 --> $DIR/issue-76535.rs:36:57
@ -35,7 +35,6 @@ error[E0038]: the trait `SuperTrait` cannot be made into an object
LL | let sub: Box<dyn SuperTrait<SubType = SubStruct>> = Box::new(SuperStruct::new(0)); LL | let sub: Box<dyn SuperTrait<SubType = SubStruct>> = Box::new(SuperStruct::new(0));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `SuperTrait` cannot be made into an object | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `SuperTrait` cannot be made into an object
| |
= help: consider moving `SubType` to another trait
note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
--> $DIR/issue-76535.rs:6:10 --> $DIR/issue-76535.rs:6:10
| |
@ -43,6 +42,7 @@ LL | pub trait SuperTrait {
| ---------- this trait cannot be made into an object... | ---------- this trait cannot be made into an object...
LL | type SubType<'a>: SubTrait; LL | type SubType<'a>: SubTrait;
| ^^^^^^^ ...because it contains the generic associated type `SubType` | ^^^^^^^ ...because it contains the generic associated type `SubType`
= help: consider moving `SubType` to another trait
= note: required because of the requirements on the impl of `CoerceUnsized<Box<dyn SuperTrait<SubType = SubStruct<'_>>>>` for `Box<SuperStruct>` = note: required because of the requirements on the impl of `CoerceUnsized<Box<dyn SuperTrait<SubType = SubStruct<'_>>>>` for `Box<SuperStruct>`
= note: required by cast to type `Box<dyn SuperTrait<SubType = SubStruct<'_>>>` = note: required by cast to type `Box<dyn SuperTrait<SubType = SubStruct<'_>>>`

View File

@ -20,7 +20,6 @@ error[E0038]: the trait `CollectionFamily` cannot be made into an object
LL | Box::new(Family) as &dyn CollectionFamily<Member=usize> LL | Box::new(Family) as &dyn CollectionFamily<Member=usize>
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `CollectionFamily` cannot be made into an object | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `CollectionFamily` cannot be made into an object
| |
= help: consider moving `Member` to another trait
note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
--> $DIR/issue-78671.rs:4:10 --> $DIR/issue-78671.rs:4:10
| |
@ -28,6 +27,7 @@ LL | trait CollectionFamily {
| ---------------- this trait cannot be made into an object... | ---------------- this trait cannot be made into an object...
LL | type Member<T>; LL | type Member<T>;
| ^^^^^^ ...because it contains the generic associated type `Member` | ^^^^^^ ...because it contains the generic associated type `Member`
= help: consider moving `Member` to another trait
error: aborting due to 2 previous errors error: aborting due to 2 previous errors

View File

@ -20,7 +20,6 @@ error[E0038]: the trait `MapLike` cannot be made into an object
LL | as Box<dyn MapLike<u8, u8, VRefCont = dyn RefCont<'_, u8>>>; LL | as Box<dyn MapLike<u8, u8, VRefCont = dyn RefCont<'_, u8>>>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `MapLike` cannot be made into an object | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `MapLike` cannot be made into an object
| |
= help: consider moving `VRefCont` to another trait
note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
--> $DIR/issue-79422.rs:20:10 --> $DIR/issue-79422.rs:20:10
| |
@ -28,6 +27,7 @@ LL | trait MapLike<K, V> {
| ------- this trait cannot be made into an object... | ------- this trait cannot be made into an object...
LL | type VRefCont<'a>: RefCont<'a, V>; LL | type VRefCont<'a>: RefCont<'a, V>;
| ^^^^^^^^ ...because it contains the generic associated type `VRefCont` | ^^^^^^^^ ...because it contains the generic associated type `VRefCont`
= help: consider moving `VRefCont` to another trait
error[E0038]: the trait `MapLike` cannot be made into an object error[E0038]: the trait `MapLike` cannot be made into an object
--> $DIR/issue-79422.rs:41:13 --> $DIR/issue-79422.rs:41:13
@ -35,7 +35,6 @@ error[E0038]: the trait `MapLike` cannot be made into an object
LL | let m = Box::new(std::collections::BTreeMap::<u8, u8>::new()) LL | let m = Box::new(std::collections::BTreeMap::<u8, u8>::new())
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `MapLike` cannot be made into an object | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `MapLike` cannot be made into an object
| |
= help: consider moving `VRefCont` to another trait
note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
--> $DIR/issue-79422.rs:20:10 --> $DIR/issue-79422.rs:20:10
| |
@ -43,6 +42,7 @@ LL | trait MapLike<K, V> {
| ------- this trait cannot be made into an object... | ------- this trait cannot be made into an object...
LL | type VRefCont<'a>: RefCont<'a, V>; LL | type VRefCont<'a>: RefCont<'a, V>;
| ^^^^^^^^ ...because it contains the generic associated type `VRefCont` | ^^^^^^^^ ...because it contains the generic associated type `VRefCont`
= help: consider moving `VRefCont` to another trait
= note: required because of the requirements on the impl of `CoerceUnsized<Box<dyn MapLike<u8, u8, VRefCont = (dyn RefCont<'_, u8> + 'static)>>>` for `Box<BTreeMap<u8, u8>>` = note: required because of the requirements on the impl of `CoerceUnsized<Box<dyn MapLike<u8, u8, VRefCont = (dyn RefCont<'_, u8> + 'static)>>>` for `Box<BTreeMap<u8, u8>>`
= note: required by cast to type `Box<dyn MapLike<u8, u8, VRefCont = (dyn RefCont<'_, u8> + 'static)>>` = note: required by cast to type `Box<dyn MapLike<u8, u8, VRefCont = (dyn RefCont<'_, u8> + 'static)>>`

View File

@ -4,7 +4,6 @@ error[E0038]: the trait `StreamingIterator` cannot be made into an object
LL | fn min_size(x: &mut dyn for<'a> StreamingIterator<Item<'a> = &'a i32>) -> usize { LL | fn min_size(x: &mut dyn for<'a> StreamingIterator<Item<'a> = &'a i32>) -> usize {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `StreamingIterator` cannot be made into an object | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `StreamingIterator` cannot be made into an object
| |
= help: consider moving `Item` to another trait
note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
--> $DIR/trait-objects.rs:4:10 --> $DIR/trait-objects.rs:4:10
| |
@ -12,6 +11,7 @@ LL | trait StreamingIterator {
| ----------------- this trait cannot be made into an object... | ----------------- this trait cannot be made into an object...
LL | type Item<'a> where Self: 'a; LL | type Item<'a> where Self: 'a;
| ^^^^ ...because it contains the generic associated type `Item` | ^^^^ ...because it contains the generic associated type `Item`
= help: consider moving `Item` to another trait
error: aborting due to previous error error: aborting due to previous error

View File

@ -4,7 +4,6 @@ error[E0038]: the trait `Bar` cannot be made into an object
LL | fn foo(b: &dyn Bar) { LL | fn foo(b: &dyn Bar) {
| ^^^^^^^ `Bar` cannot be made into an object | ^^^^^^^ `Bar` cannot be made into an object
| |
= help: consider moving `foo` to another trait
note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
--> $DIR/issue-18959.rs:1:20 --> $DIR/issue-18959.rs:1:20
| |
@ -12,6 +11,7 @@ LL | pub trait Foo { fn foo<T>(&self, ext_thing: &T); }
| ^^^ ...because method `foo` has generic type parameters | ^^^ ...because method `foo` has generic type parameters
LL | pub trait Bar: Foo { } LL | pub trait Bar: Foo { }
| --- this trait cannot be made into an object... | --- this trait cannot be made into an object...
= help: consider moving `foo` to another trait
error: aborting due to previous error error: aborting due to previous error

View File

@ -4,7 +4,6 @@ error[E0038]: the trait `Bar` cannot be made into an object
LL | let test: &mut dyn Bar = &mut thing; LL | let test: &mut dyn Bar = &mut thing;
| ^^^^^^^^^^^^ `Bar` cannot be made into an object | ^^^^^^^^^^^^ `Bar` cannot be made into an object
| |
= help: consider moving `foo` to another trait
note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
--> $DIR/issue-19538.rs:2:8 --> $DIR/issue-19538.rs:2:8
| |
@ -13,6 +12,7 @@ LL | fn foo<T>(&self, val: T);
... ...
LL | trait Bar: Foo { } LL | trait Bar: Foo { }
| --- this trait cannot be made into an object... | --- this trait cannot be made into an object...
= help: consider moving `foo` to another trait
error[E0038]: the trait `Bar` cannot be made into an object error[E0038]: the trait `Bar` cannot be made into an object
--> $DIR/issue-19538.rs:17:30 --> $DIR/issue-19538.rs:17:30
@ -20,7 +20,6 @@ error[E0038]: the trait `Bar` cannot be made into an object
LL | let test: &mut dyn Bar = &mut thing; LL | let test: &mut dyn Bar = &mut thing;
| ^^^^^^^^^^ `Bar` cannot be made into an object | ^^^^^^^^^^ `Bar` cannot be made into an object
| |
= help: consider moving `foo` to another trait
note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
--> $DIR/issue-19538.rs:2:8 --> $DIR/issue-19538.rs:2:8
| |
@ -29,6 +28,7 @@ LL | fn foo<T>(&self, val: T);
... ...
LL | trait Bar: Foo { } LL | trait Bar: Foo { }
| --- this trait cannot be made into an object... | --- this trait cannot be made into an object...
= help: consider moving `foo` to another trait
= note: required because of the requirements on the impl of `CoerceUnsized<&mut dyn Bar>` for `&mut Thing` = note: required because of the requirements on the impl of `CoerceUnsized<&mut dyn Bar>` for `&mut Thing`
= note: required by cast to type `&mut dyn Bar` = note: required by cast to type `&mut dyn Bar`

View File

@ -6,5 +6,5 @@ enum Test {
fn main() { fn main() {
Test::Drill(field: 42); Test::Drill(field: 42);
//~^ ERROR expected type, found //~^ ERROR invalid `struct` delimiters or `fn` call arguments
} }

View File

@ -1,13 +1,18 @@
error: expected type, found `42` error: invalid `struct` delimiters or `fn` call arguments
--> $DIR/issue-34255-1.rs:8:24 --> $DIR/issue-34255-1.rs:8:5
| |
LL | Test::Drill(field: 42); LL | Test::Drill(field: 42);
| - ^^ expected type | ^^^^^^^^^^^^^^^^^^^^^^
| |
| tried to parse a type due to this type ascription
| |
= note: `#![feature(type_ascription)]` lets you annotate an expression with a type: `<expr>: <type>` help: if `Test::Drill` is a struct, use braces as delimiters
= note: see issue #23416 <https://github.com/rust-lang/rust/issues/23416> for more information |
LL | Test::Drill { field: 42 };
| ~ ~
help: if `Test::Drill` is a function, use the arguments directly
|
LL - Test::Drill(field: 42);
LL + Test::Drill(42);
|
error: aborting due to previous error error: aborting due to previous error

View File

@ -4,7 +4,6 @@ error[E0038]: the trait `Bar` cannot be made into an object
LL | fn make_bar<T:Bar>(t: &T) -> &dyn Bar { LL | fn make_bar<T:Bar>(t: &T) -> &dyn Bar {
| ^^^^^^^^ `Bar` cannot be made into an object | ^^^^^^^^ `Bar` cannot be made into an object
| |
= help: consider moving `X` to another trait
note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
--> $DIR/object-safety-associated-consts.rs:9:11 --> $DIR/object-safety-associated-consts.rs:9:11
| |
@ -12,6 +11,7 @@ LL | trait Bar {
| --- this trait cannot be made into an object... | --- this trait cannot be made into an object...
LL | const X: usize; LL | const X: usize;
| ^ ...because it contains this associated `const` | ^ ...because it contains this associated `const`
= help: consider moving `X` to another trait
error: aborting due to previous error error: aborting due to previous error

View File

@ -4,7 +4,6 @@ error[E0038]: the trait `Bar` cannot be made into an object
LL | t LL | t
| ^ `Bar` cannot be made into an object | ^ `Bar` cannot be made into an object
| |
= help: consider moving `X` to another trait
note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
--> $DIR/object-safety-associated-consts.rs:9:11 --> $DIR/object-safety-associated-consts.rs:9:11
| |
@ -12,6 +11,7 @@ LL | trait Bar {
| --- this trait cannot be made into an object... | --- this trait cannot be made into an object...
LL | const X: usize; LL | const X: usize;
| ^ ...because it contains this associated `const` | ^ ...because it contains this associated `const`
= help: consider moving `X` to another trait
= note: required because of the requirements on the impl of `CoerceUnsized<&dyn Bar>` for `&T` = note: required because of the requirements on the impl of `CoerceUnsized<&dyn Bar>` for `&T`
= note: required by cast to type `&dyn Bar` = note: required by cast to type `&dyn Bar`

View File

@ -4,7 +4,6 @@ error[E0038]: the trait `Bar` cannot be made into an object
LL | fn make_bar<T:Bar>(t: &T) -> &dyn Bar { LL | fn make_bar<T:Bar>(t: &T) -> &dyn Bar {
| ^^^^^^^^ `Bar` cannot be made into an object | ^^^^^^^^ `Bar` cannot be made into an object
| |
= help: consider moving `bar` to another trait
note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
--> $DIR/object-safety-generics.rs:10:8 --> $DIR/object-safety-generics.rs:10:8
| |
@ -12,6 +11,7 @@ LL | trait Bar {
| --- this trait cannot be made into an object... | --- this trait cannot be made into an object...
LL | fn bar<T>(&self, t: T); LL | fn bar<T>(&self, t: T);
| ^^^ ...because method `bar` has generic type parameters | ^^^ ...because method `bar` has generic type parameters
= help: consider moving `bar` to another trait
error[E0038]: the trait `Bar` cannot be made into an object error[E0038]: the trait `Bar` cannot be made into an object
--> $DIR/object-safety-generics.rs:24:39 --> $DIR/object-safety-generics.rs:24:39
@ -19,7 +19,6 @@ error[E0038]: the trait `Bar` cannot be made into an object
LL | fn make_bar_explicit<T:Bar>(t: &T) -> &dyn Bar { LL | fn make_bar_explicit<T:Bar>(t: &T) -> &dyn Bar {
| ^^^^^^^^ `Bar` cannot be made into an object | ^^^^^^^^ `Bar` cannot be made into an object
| |
= help: consider moving `bar` to another trait
note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
--> $DIR/object-safety-generics.rs:10:8 --> $DIR/object-safety-generics.rs:10:8
| |
@ -27,6 +26,7 @@ LL | trait Bar {
| --- this trait cannot be made into an object... | --- this trait cannot be made into an object...
LL | fn bar<T>(&self, t: T); LL | fn bar<T>(&self, t: T);
| ^^^ ...because method `bar` has generic type parameters | ^^^ ...because method `bar` has generic type parameters
= help: consider moving `bar` to another trait
error: aborting due to 2 previous errors error: aborting due to 2 previous errors

View File

@ -4,7 +4,6 @@ error[E0038]: the trait `Bar` cannot be made into an object
LL | t LL | t
| ^ `Bar` cannot be made into an object | ^ `Bar` cannot be made into an object
| |
= help: consider moving `bar` to another trait
note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
--> $DIR/object-safety-generics.rs:10:8 --> $DIR/object-safety-generics.rs:10:8
| |
@ -12,6 +11,7 @@ LL | trait Bar {
| --- this trait cannot be made into an object... | --- this trait cannot be made into an object...
LL | fn bar<T>(&self, t: T); LL | fn bar<T>(&self, t: T);
| ^^^ ...because method `bar` has generic type parameters | ^^^ ...because method `bar` has generic type parameters
= help: consider moving `bar` to another trait
= note: required because of the requirements on the impl of `CoerceUnsized<&dyn Bar>` for `&T` = note: required because of the requirements on the impl of `CoerceUnsized<&dyn Bar>` for `&T`
= note: required by cast to type `&dyn Bar` = note: required by cast to type `&dyn Bar`
@ -21,7 +21,6 @@ error[E0038]: the trait `Bar` cannot be made into an object
LL | t as &dyn Bar LL | t as &dyn Bar
| ^ `Bar` cannot be made into an object | ^ `Bar` cannot be made into an object
| |
= help: consider moving `bar` to another trait
note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
--> $DIR/object-safety-generics.rs:10:8 --> $DIR/object-safety-generics.rs:10:8
| |
@ -29,6 +28,7 @@ LL | trait Bar {
| --- this trait cannot be made into an object... | --- this trait cannot be made into an object...
LL | fn bar<T>(&self, t: T); LL | fn bar<T>(&self, t: T);
| ^^^ ...because method `bar` has generic type parameters | ^^^ ...because method `bar` has generic type parameters
= help: consider moving `bar` to another trait
= note: required because of the requirements on the impl of `CoerceUnsized<&dyn Bar>` for `&T` = note: required because of the requirements on the impl of `CoerceUnsized<&dyn Bar>` for `&T`
= note: required by cast to type `&dyn Bar` = note: required by cast to type `&dyn Bar`

View File

@ -4,7 +4,6 @@ error[E0038]: the trait `Bar` cannot be made into an object
LL | fn make_bar<T:Bar>(t: &T) -> &dyn Bar { LL | fn make_bar<T:Bar>(t: &T) -> &dyn Bar {
| ^^^^^^^^ `Bar` cannot be made into an object | ^^^^^^^^ `Bar` cannot be made into an object
| |
= help: consider moving `bar` to another trait
note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
--> $DIR/object-safety-mentions-Self.rs:11:22 --> $DIR/object-safety-mentions-Self.rs:11:22
| |
@ -12,6 +11,7 @@ LL | trait Bar {
| --- this trait cannot be made into an object... | --- this trait cannot be made into an object...
LL | fn bar(&self, x: &Self); LL | fn bar(&self, x: &Self);
| ^^^^^ ...because method `bar` references the `Self` type in this parameter | ^^^^^ ...because method `bar` references the `Self` type in this parameter
= help: consider moving `bar` to another trait
error[E0038]: the trait `Baz` cannot be made into an object error[E0038]: the trait `Baz` cannot be made into an object
--> $DIR/object-safety-mentions-Self.rs:28:30 --> $DIR/object-safety-mentions-Self.rs:28:30
@ -19,7 +19,6 @@ error[E0038]: the trait `Baz` cannot be made into an object
LL | fn make_baz<T:Baz>(t: &T) -> &dyn Baz { LL | fn make_baz<T:Baz>(t: &T) -> &dyn Baz {
| ^^^^^^^^ `Baz` cannot be made into an object | ^^^^^^^^ `Baz` cannot be made into an object
| |
= help: consider moving `baz` to another trait
note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
--> $DIR/object-safety-mentions-Self.rs:15:22 --> $DIR/object-safety-mentions-Self.rs:15:22
| |
@ -27,6 +26,7 @@ LL | trait Baz {
| --- this trait cannot be made into an object... | --- this trait cannot be made into an object...
LL | fn baz(&self) -> Self; LL | fn baz(&self) -> Self;
| ^^^^ ...because method `baz` references the `Self` type in its return type | ^^^^ ...because method `baz` references the `Self` type in its return type
= help: consider moving `baz` to another trait
error: aborting due to 2 previous errors error: aborting due to 2 previous errors

View File

@ -4,7 +4,6 @@ error[E0038]: the trait `Bar` cannot be made into an object
LL | t LL | t
| ^ `Bar` cannot be made into an object | ^ `Bar` cannot be made into an object
| |
= help: consider moving `bar` to another trait
note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
--> $DIR/object-safety-mentions-Self.rs:11:22 --> $DIR/object-safety-mentions-Self.rs:11:22
| |
@ -12,6 +11,7 @@ LL | trait Bar {
| --- this trait cannot be made into an object... | --- this trait cannot be made into an object...
LL | fn bar(&self, x: &Self); LL | fn bar(&self, x: &Self);
| ^^^^^ ...because method `bar` references the `Self` type in this parameter | ^^^^^ ...because method `bar` references the `Self` type in this parameter
= help: consider moving `bar` to another trait
= note: required because of the requirements on the impl of `CoerceUnsized<&dyn Bar>` for `&T` = note: required because of the requirements on the impl of `CoerceUnsized<&dyn Bar>` for `&T`
= note: required by cast to type `&dyn Bar` = note: required by cast to type `&dyn Bar`
@ -21,7 +21,6 @@ error[E0038]: the trait `Baz` cannot be made into an object
LL | t LL | t
| ^ `Baz` cannot be made into an object | ^ `Baz` cannot be made into an object
| |
= help: consider moving `baz` to another trait
note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
--> $DIR/object-safety-mentions-Self.rs:15:22 --> $DIR/object-safety-mentions-Self.rs:15:22
| |
@ -29,6 +28,7 @@ LL | trait Baz {
| --- this trait cannot be made into an object... | --- this trait cannot be made into an object...
LL | fn baz(&self) -> Self; LL | fn baz(&self) -> Self;
| ^^^^ ...because method `baz` references the `Self` type in its return type | ^^^^ ...because method `baz` references the `Self` type in its return type
= help: consider moving `baz` to another trait
= note: required because of the requirements on the impl of `CoerceUnsized<&dyn Baz>` for `&T` = note: required because of the requirements on the impl of `CoerceUnsized<&dyn Baz>` for `&T`
= note: required by cast to type `&dyn Baz` = note: required by cast to type `&dyn Baz`

View File

@ -1,10 +1,10 @@
macro_rules! foo { macro_rules! foo {
($rest: tt) => { ($rest: tt) => {
bar(baz: $rest) bar(baz: $rest) //~ ERROR invalid `struct` delimiters or `fn` call arguments
} }
} }
fn main() { fn main() {
foo!(true); //~ ERROR expected type, found keyword foo!(true);
//~^ ERROR expected identifier, found keyword //~^ ERROR expected identifier, found keyword
} }

View File

@ -9,17 +9,25 @@ help: you can escape reserved keywords to use them as identifiers
LL | foo!(r#true); LL | foo!(r#true);
| ~~~~~~ | ~~~~~~
error: expected type, found keyword `true` error: invalid `struct` delimiters or `fn` call arguments
--> $DIR/issue-44406.rs:8:10 --> $DIR/issue-44406.rs:3:9
| |
LL | bar(baz: $rest) LL | bar(baz: $rest)
| - help: try using a semicolon: `;` | ^^^^^^^^^^^^^^^
... ...
LL | foo!(true); LL | foo!(true);
| ^^^^ expected type | ----------- in this macro invocation
| |
= note: `#![feature(type_ascription)]` lets you annotate an expression with a type: `<expr>: <type>` = note: this error originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info)
= note: see issue #23416 <https://github.com/rust-lang/rust/issues/23416> for more information help: if `bar` is a struct, use braces as delimiters
|
LL | bar { }
| ~
help: if `bar` is a function, use the arguments directly
|
LL - bar(baz: $rest)
LL + bar(true);
|
error: aborting due to 2 previous errors error: aborting due to 2 previous errors

View File

@ -5,7 +5,7 @@ enum Enum {
fn main() { fn main() {
let x = Enum::Foo(a: 3, b: 4); let x = Enum::Foo(a: 3, b: 4);
//~^ ERROR expected type, found `3` //~^ ERROR invalid `struct` delimiters or `fn` call arguments
match x { match x {
Enum::Foo(a, b) => {} Enum::Foo(a, b) => {}
//~^ ERROR expected tuple struct or tuple variant, found struct variant `Enum::Foo` //~^ ERROR expected tuple struct or tuple variant, found struct variant `Enum::Foo`

View File

@ -1,13 +1,18 @@
error: expected type, found `3` error: invalid `struct` delimiters or `fn` call arguments
--> $DIR/recover-from-bad-variant.rs:7:26 --> $DIR/recover-from-bad-variant.rs:7:13
| |
LL | let x = Enum::Foo(a: 3, b: 4); LL | let x = Enum::Foo(a: 3, b: 4);
| - ^ expected type | ^^^^^^^^^^^^^^^^^^^^^
| |
| tried to parse a type due to this type ascription
| |
= note: `#![feature(type_ascription)]` lets you annotate an expression with a type: `<expr>: <type>` help: if `Enum::Foo` is a struct, use braces as delimiters
= note: see issue #23416 <https://github.com/rust-lang/rust/issues/23416> for more information |
LL | let x = Enum::Foo { a: 3, b: 4 };
| ~ ~
help: if `Enum::Foo` is a function, use the arguments directly
|
LL - let x = Enum::Foo(a: 3, b: 4);
LL + let x = Enum::Foo(3, 4);
|
error[E0532]: expected tuple struct or tuple variant, found struct variant `Enum::Foo` error[E0532]: expected tuple struct or tuple variant, found struct variant `Enum::Foo`
--> $DIR/recover-from-bad-variant.rs:10:9 --> $DIR/recover-from-bad-variant.rs:10:9

View File

@ -4,8 +4,6 @@ error[E0038]: the trait `Trait` cannot be made into an object
LL | fn bar(x: &dyn Trait) {} LL | fn bar(x: &dyn Trait) {}
| ^^^^^^^^^ `Trait` cannot be made into an object | ^^^^^^^^^ `Trait` cannot be made into an object
| |
= help: consider moving `baz` to another trait
= help: consider moving `bat` to another trait
note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
--> $DIR/object-unsafe-trait-references-self.rs:2:22 --> $DIR/object-unsafe-trait-references-self.rs:2:22
| |
@ -15,6 +13,8 @@ LL | fn baz(&self, _: Self) {}
| ^^^^ ...because method `baz` references the `Self` type in this parameter | ^^^^ ...because method `baz` references the `Self` type in this parameter
LL | fn bat(&self) -> Self {} LL | fn bat(&self) -> Self {}
| ^^^^ ...because method `bat` references the `Self` type in its return type | ^^^^ ...because method `bat` references the `Self` type in its return type
= help: consider moving `baz` to another trait
= help: consider moving `bat` to another trait
error[E0038]: the trait `Other` cannot be made into an object error[E0038]: the trait `Other` cannot be made into an object
--> $DIR/object-unsafe-trait-references-self.rs:10:12 --> $DIR/object-unsafe-trait-references-self.rs:10:12

View File

@ -127,9 +127,6 @@ error[E0038]: the trait `assoc_const::C` cannot be made into an object
LL | <dyn C>::A; LL | <dyn C>::A;
| ^^^^^ `assoc_const::C` cannot be made into an object | ^^^^^ `assoc_const::C` cannot be made into an object
| |
= help: consider moving `C` to another trait
= help: consider moving `B` to another trait
= help: consider moving `A` to another trait
note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
--> $DIR/item-privacy.rs:25:15 --> $DIR/item-privacy.rs:25:15
| |
@ -143,6 +140,9 @@ LL | pub trait C: A + B {
| - this trait cannot be made into an object... | - this trait cannot be made into an object...
LL | const C: u8 = 0; LL | const C: u8 = 0;
| ^ ...because it contains this associated `const` | ^ ...because it contains this associated `const`
= help: consider moving `C` to another trait
= help: consider moving `A` to another trait
= help: consider moving `B` to another trait
error[E0223]: ambiguous associated type error[E0223]: ambiguous associated type
--> $DIR/item-privacy.rs:115:12 --> $DIR/item-privacy.rs:115:12

View File

@ -32,8 +32,6 @@ error[E0038]: the trait `bar` cannot be made into an object
LL | (box 10 as Box<dyn bar>).dup(); LL | (box 10 as Box<dyn bar>).dup();
| ^^^^^^^^^^^^ `bar` cannot be made into an object | ^^^^^^^^^^^^ `bar` cannot be made into an object
| |
= help: consider moving `dup` to another trait
= help: consider moving `blah` to another trait
note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
--> $DIR/test-2.rs:4:30 --> $DIR/test-2.rs:4:30
| |
@ -42,6 +40,8 @@ LL | trait bar { fn dup(&self) -> Self; fn blah<X>(&self); }
| | | | | |
| | ...because method `dup` references the `Self` type in its return type | | ...because method `dup` references the `Self` type in its return type
| this trait cannot be made into an object... | this trait cannot be made into an object...
= help: consider moving `dup` to another trait
= help: consider moving `blah` to another trait
error[E0038]: the trait `bar` cannot be made into an object error[E0038]: the trait `bar` cannot be made into an object
--> $DIR/test-2.rs:13:6 --> $DIR/test-2.rs:13:6
@ -49,8 +49,6 @@ error[E0038]: the trait `bar` cannot be made into an object
LL | (box 10 as Box<dyn bar>).dup(); LL | (box 10 as Box<dyn bar>).dup();
| ^^^^^^ `bar` cannot be made into an object | ^^^^^^ `bar` cannot be made into an object
| |
= help: consider moving `dup` to another trait
= help: consider moving `blah` to another trait
note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
--> $DIR/test-2.rs:4:30 --> $DIR/test-2.rs:4:30
| |
@ -59,6 +57,8 @@ LL | trait bar { fn dup(&self) -> Self; fn blah<X>(&self); }
| | | | | |
| | ...because method `dup` references the `Self` type in its return type | | ...because method `dup` references the `Self` type in its return type
| this trait cannot be made into an object... | this trait cannot be made into an object...
= help: consider moving `dup` to another trait
= help: consider moving `blah` to another trait
= note: required because of the requirements on the impl of `CoerceUnsized<Box<dyn bar>>` for `Box<{integer}>` = note: required because of the requirements on the impl of `CoerceUnsized<Box<dyn bar>>` for `Box<{integer}>`
= note: required by cast to type `Box<dyn bar>` = note: required by cast to type `Box<dyn bar>`

View File

@ -16,7 +16,6 @@ error[E0038]: the trait `MyAdd` cannot be made into an object
LL | let y = x as dyn MyAdd<i32>; LL | let y = x as dyn MyAdd<i32>;
| ^^^^^^^^^^^^^^ `MyAdd` cannot be made into an object | ^^^^^^^^^^^^^^ `MyAdd` cannot be made into an object
| |
= help: consider moving `add` to another trait
note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
--> $DIR/type-parameter-defaults-referencing-Self-ppaux.rs:6:55 --> $DIR/type-parameter-defaults-referencing-Self-ppaux.rs:6:55
| |
@ -24,6 +23,7 @@ LL | trait MyAdd<Rhs=Self> { fn add(&self, other: &Rhs) -> Self; }
| ----- ^^^^ ...because method `add` references the `Self` type in its return type | ----- ^^^^ ...because method `add` references the `Self` type in its return type
| | | |
| this trait cannot be made into an object... | this trait cannot be made into an object...
= help: consider moving `add` to another trait
error: aborting due to 2 previous errors error: aborting due to 2 previous errors

View File

@ -4,7 +4,6 @@ error[E0038]: the trait `T` cannot be made into an object
LL | const CONST: (bool, dyn T); LL | const CONST: (bool, dyn T);
| ^^^^^ `T` cannot be made into an object | ^^^^^ `T` cannot be made into an object
| |
= help: consider moving `CONST` to another trait
note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
--> $DIR/issue-87495.rs:4:11 --> $DIR/issue-87495.rs:4:11
| |
@ -12,6 +11,7 @@ LL | trait T {
| - this trait cannot be made into an object... | - this trait cannot be made into an object...
LL | const CONST: (bool, dyn T); LL | const CONST: (bool, dyn T);
| ^^^^^ ...because it contains this associated `const` | ^^^^^ ...because it contains this associated `const`
= help: consider moving `CONST` to another trait
error: aborting due to previous error error: aborting due to previous error

View File

@ -4,7 +4,6 @@ error[E0038]: the trait `A` cannot be made into an object
LL | let _x: &dyn A; LL | let _x: &dyn A;
| ^^^^^^ `A` cannot be made into an object | ^^^^^^ `A` cannot be made into an object
| |
= help: consider moving `foo` to another trait
note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
--> $DIR/wf-object-safe.rs:5:23 --> $DIR/wf-object-safe.rs:5:23
| |
@ -12,6 +11,7 @@ LL | trait A {
| - this trait cannot be made into an object... | - this trait cannot be made into an object...
LL | fn foo(&self, _x: &Self); LL | fn foo(&self, _x: &Self);
| ^^^^^ ...because method `foo` references the `Self` type in this parameter | ^^^^^ ...because method `foo` references the `Self` type in this parameter
= help: consider moving `foo` to another trait
error: aborting due to previous error error: aborting due to previous error