Auto merge of #132251 - jieyouxu:rollup-mtv9mpd, r=jieyouxu

Rollup of 7 pull requests

Successful merges:

 - #131633 (error on alignments greater than `isize::MAX`)
 - #132086 (Tweak E0277 highlighting and "long type" path printing)
 - #132220 (Add GUI regression test for doc struct fields margins)
 - #132225 (Dynamically link run-make support)
 - #132227 (Pass constness with span into lower_poly_trait_ref)
 - #132242 (Support `char::is_digit` in const contexts.)
 - #132243 (Remove `ObligationCause::span()` method)

r? `@ghost`
`@rustbot` modify labels: rollup
This commit is contained in:
bors 2024-10-28 07:14:11 +00:00
commit 66701c4226
66 changed files with 572 additions and 337 deletions

View File

@ -611,7 +611,7 @@ pub(super) fn collect_return_position_impl_trait_in_trait_tys<'tcx>(
Err(terr) => { Err(terr) => {
let mut diag = struct_span_code_err!( let mut diag = struct_span_code_err!(
tcx.dcx(), tcx.dcx(),
cause.span(), cause.span,
E0053, E0053,
"method `{}` has an incompatible return type for trait", "method `{}` has an incompatible return type for trait",
trait_m.name trait_m.name
@ -1169,7 +1169,7 @@ fn extract_spans_for_error_reporting<'tcx>(
TypeError::ArgumentMutability(i) | TypeError::ArgumentSorts(ExpectedFound { .. }, i) => { TypeError::ArgumentMutability(i) | TypeError::ArgumentSorts(ExpectedFound { .. }, i) => {
(impl_args.nth(i).unwrap(), trait_args.and_then(|mut args| args.nth(i))) (impl_args.nth(i).unwrap(), trait_args.and_then(|mut args| args.nth(i)))
} }
_ => (cause.span(), tcx.hir().span_if_local(trait_m.def_id)), _ => (cause.span, tcx.hir().span_if_local(trait_m.def_id)),
} }
} }

View File

@ -612,7 +612,7 @@ pub fn check_function_signature<'tcx>(
match err { match err {
TypeError::ArgumentMutability(i) TypeError::ArgumentMutability(i)
| TypeError::ArgumentSorts(ExpectedFound { .. }, i) => args.nth(i).unwrap(), | TypeError::ArgumentSorts(ExpectedFound { .. }, i) => args.nth(i).unwrap(),
_ => cause.span(), _ => cause.span,
} }
} }

View File

@ -168,13 +168,6 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
match hir_bound { match hir_bound {
hir::GenericBound::Trait(poly_trait_ref) => { hir::GenericBound::Trait(poly_trait_ref) => {
let hir::TraitBoundModifiers { constness, polarity } = poly_trait_ref.modifiers; let hir::TraitBoundModifiers { constness, polarity } = poly_trait_ref.modifiers;
// FIXME: We could pass these directly into `lower_poly_trait_ref`
// so that we could use these spans in diagnostics within that function...
let constness = match constness {
hir::BoundConstness::Never => None,
hir::BoundConstness::Always(_) => Some(ty::BoundConstness::Const),
hir::BoundConstness::Maybe(_) => Some(ty::BoundConstness::ConstIfConst),
};
let polarity = match polarity { let polarity = match polarity {
rustc_ast::BoundPolarity::Positive => ty::PredicatePolarity::Positive, rustc_ast::BoundPolarity::Positive => ty::PredicatePolarity::Positive,
rustc_ast::BoundPolarity::Negative(_) => ty::PredicatePolarity::Negative, rustc_ast::BoundPolarity::Negative(_) => ty::PredicatePolarity::Negative,

View File

@ -50,7 +50,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
} = self.lower_poly_trait_ref( } = self.lower_poly_trait_ref(
&trait_bound.trait_ref, &trait_bound.trait_ref,
trait_bound.span, trait_bound.span,
None, hir::BoundConstness::Never,
ty::PredicatePolarity::Positive, ty::PredicatePolarity::Positive,
dummy_self, dummy_self,
&mut bounds, &mut bounds,

View File

@ -658,7 +658,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
&self, &self,
trait_ref: &hir::TraitRef<'tcx>, trait_ref: &hir::TraitRef<'tcx>,
span: Span, span: Span,
constness: Option<ty::BoundConstness>, constness: hir::BoundConstness,
polarity: ty::PredicatePolarity, polarity: ty::PredicatePolarity,
self_ty: Ty<'tcx>, self_ty: Ty<'tcx>,
bounds: &mut Bounds<'tcx>, bounds: &mut Bounds<'tcx>,
@ -681,11 +681,11 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
Some(self_ty), Some(self_ty),
); );
if let Some(constness) = constness if let hir::BoundConstness::Always(span) | hir::BoundConstness::Maybe(span) = constness
&& !self.tcx().is_const_trait(trait_def_id) && !self.tcx().is_const_trait(trait_def_id)
{ {
self.dcx().emit_err(crate::errors::ConstBoundForNonConstTrait { self.dcx().emit_err(crate::errors::ConstBoundForNonConstTrait {
span: trait_ref.path.span, span,
modifier: constness.as_str(), modifier: constness.as_str(),
}); });
} }
@ -708,7 +708,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
bounds.push_trait_bound(tcx, poly_trait_ref, span, polarity); bounds.push_trait_bound(tcx, poly_trait_ref, span, polarity);
match constness { match constness {
Some(ty::BoundConstness::Const) => { hir::BoundConstness::Always(span) => {
if polarity == ty::PredicatePolarity::Positive { if polarity == ty::PredicatePolarity::Positive {
bounds.push_const_bound( bounds.push_const_bound(
tcx, tcx,
@ -718,13 +718,13 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
); );
} }
} }
Some(ty::BoundConstness::ConstIfConst) => { hir::BoundConstness::Maybe(_) => {
// We don't emit a const bound here, since that would mean that we // We don't emit a const bound here, since that would mean that we
// unconditionally need to prove a `HostEffect` predicate, even when // unconditionally need to prove a `HostEffect` predicate, even when
// the predicates are being instantiated in a non-const context. This // the predicates are being instantiated in a non-const context. This
// is instead handled in the `const_conditions` query. // is instead handled in the `const_conditions` query.
} }
None => {} hir::BoundConstness::Never => {}
} }
} }
// On the flip side, when filtering `ConstIfConst` bounds, we only need to convert // On the flip side, when filtering `ConstIfConst` bounds, we only need to convert
@ -734,12 +734,12 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
// here because we only call this on self bounds, and deal with the recursive case // here because we only call this on self bounds, and deal with the recursive case
// in `lower_assoc_item_constraint`. // in `lower_assoc_item_constraint`.
PredicateFilter::ConstIfConst | PredicateFilter::SelfConstIfConst => match constness { PredicateFilter::ConstIfConst | PredicateFilter::SelfConstIfConst => match constness {
Some(ty::BoundConstness::ConstIfConst) => { hir::BoundConstness::Maybe(span) => {
if polarity == ty::PredicatePolarity::Positive { if polarity == ty::PredicatePolarity::Positive {
bounds.push_const_bound(tcx, poly_trait_ref, ty::HostPolarity::Maybe, span); bounds.push_const_bound(tcx, poly_trait_ref, ty::HostPolarity::Maybe, span);
} }
} }
None | Some(ty::BoundConstness::Const) => {} hir::BoundConstness::Always(_) | hir::BoundConstness::Never => {}
}, },
} }

View File

@ -94,14 +94,11 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
(None, arm.body.span) (None, arm.body.span)
}; };
let (span, code) = match prior_arm { let code = match prior_arm {
// The reason for the first arm to fail is not that the match arms diverge, // The reason for the first arm to fail is not that the match arms diverge,
// but rather that there's a prior obligation that doesn't hold. // but rather that there's a prior obligation that doesn't hold.
None => { None => ObligationCauseCode::BlockTailExpression(arm.body.hir_id, match_src),
(arm_span, ObligationCauseCode::BlockTailExpression(arm.body.hir_id, match_src)) Some((prior_arm_block_id, prior_arm_ty, prior_arm_span)) => {
}
Some((prior_arm_block_id, prior_arm_ty, prior_arm_span)) => (
expr.span,
ObligationCauseCode::MatchExpressionArm(Box::new(MatchExpressionArmCause { ObligationCauseCode::MatchExpressionArm(Box::new(MatchExpressionArmCause {
arm_block_id, arm_block_id,
arm_span, arm_span,
@ -110,13 +107,14 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
prior_arm_ty, prior_arm_ty,
prior_arm_span, prior_arm_span,
scrut_span: scrut.span, scrut_span: scrut.span,
expr_span: expr.span,
source: match_src, source: match_src,
prior_non_diverging_arms: prior_non_diverging_arms.clone(), prior_non_diverging_arms: prior_non_diverging_arms.clone(),
tail_defines_return_position_impl_trait, tail_defines_return_position_impl_trait,
})), }))
), }
}; };
let cause = self.cause(span, code); let cause = self.cause(arm_span, code);
// This is the moral equivalent of `coercion.coerce(self, cause, arm.body, arm_ty)`. // This is the moral equivalent of `coercion.coerce(self, cause, arm.body, arm_ty)`.
// We use it this way to be able to expand on the potential error and detect when a // We use it this way to be able to expand on the potential error and detect when a

View File

@ -2027,7 +2027,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
} }
Err(_) => { Err(_) => {
span_bug!( span_bug!(
cause.span(), cause.span,
"subtyping remaining fields of type changing FRU failed: {target_ty} != {fru_ty}: {}::{}", "subtyping remaining fields of type changing FRU failed: {target_ty} != {fru_ty}: {}::{}",
variant.name, variant.name,
ident.name, ident.name,

View File

@ -550,7 +550,7 @@ impl<'a, 'tcx> ConfirmContext<'a, 'tcx> {
// This has/will have errored in wfcheck, which we cannot depend on from here, as typeck on functions // This has/will have errored in wfcheck, which we cannot depend on from here, as typeck on functions
// may run before wfcheck if the function is used in const eval. // may run before wfcheck if the function is used in const eval.
self.dcx().span_delayed_bug( self.dcx().span_delayed_bug(
cause.span(), cause.span,
format!("{self_ty} was a subtype of {method_self_ty} but now is not?"), format!("{self_ty} was a subtype of {method_self_ty} but now is not?"),
); );
} }

View File

@ -92,16 +92,6 @@ impl<'tcx> ObligationCause<'tcx> {
ObligationCause { span, body_id: CRATE_DEF_ID, code: Default::default() } ObligationCause { span, body_id: CRATE_DEF_ID, code: Default::default() }
} }
pub fn span(&self) -> Span {
match *self.code() {
ObligationCauseCode::MatchExpressionArm(box MatchExpressionArmCause {
arm_span,
..
}) => arm_span,
_ => self.span,
}
}
#[inline] #[inline]
pub fn code(&self) -> &ObligationCauseCode<'tcx> { pub fn code(&self) -> &ObligationCauseCode<'tcx> {
&self.code &self.code
@ -517,10 +507,17 @@ pub struct MatchExpressionArmCause<'tcx> {
pub prior_arm_block_id: Option<HirId>, pub prior_arm_block_id: Option<HirId>,
pub prior_arm_ty: Ty<'tcx>, pub prior_arm_ty: Ty<'tcx>,
pub prior_arm_span: Span, pub prior_arm_span: Span,
/// Span of the scrutinee of the match (the matched value).
pub scrut_span: Span, pub scrut_span: Span,
/// Source of the match, i.e. `match` or a desugaring.
pub source: hir::MatchSource, pub source: hir::MatchSource,
/// Span of the *whole* match expr.
pub expr_span: Span,
/// Spans of the previous arms except for those that diverge (i.e. evaluate to `!`).
///
/// These are used for pointing out errors that may affect several arms.
pub prior_non_diverging_arms: Vec<Span>, pub prior_non_diverging_arms: Vec<Span>,
// Is the expectation of this match expression an RPIT? /// Is the expectation of this match expression an RPIT?
pub tail_defines_return_position_impl_trait: Option<LocalDefId>, pub tail_defines_return_position_impl_trait: Option<LocalDefId>,
} }

View File

@ -622,6 +622,10 @@ passes_remove_fields =
passes_repr_align_function = passes_repr_align_function =
`repr(align)` attributes on functions are unstable `repr(align)` attributes on functions are unstable
passes_repr_align_greater_than_target_max =
alignment must not be greater than `isize::MAX` bytes
.note = `isize::MAX` is {$size} for the current target
passes_repr_conflicting = passes_repr_conflicting =
conflicting representation hints conflicting representation hints

View File

@ -34,6 +34,7 @@ use rustc_session::lint::builtin::{
use rustc_session::parse::feature_err; use rustc_session::parse::feature_err;
use rustc_span::symbol::{Symbol, kw, sym}; use rustc_span::symbol::{Symbol, kw, sym};
use rustc_span::{BytePos, DUMMY_SP, Span}; use rustc_span::{BytePos, DUMMY_SP, Span};
use rustc_target::abi::Size;
use rustc_target::spec::abi::Abi; use rustc_target::spec::abi::Abi;
use rustc_trait_selection::error_reporting::InferCtxtErrorExt; use rustc_trait_selection::error_reporting::InferCtxtErrorExt;
use rustc_trait_selection::infer::{TyCtxtInferExt, ValuePairs}; use rustc_trait_selection::infer::{TyCtxtInferExt, ValuePairs};
@ -1785,7 +1786,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
| Target::Union | Target::Union
| Target::Enum | Target::Enum
| Target::Fn | Target::Fn
| Target::Method(_) => continue, | Target::Method(_) => {}
_ => { _ => {
self.dcx().emit_err( self.dcx().emit_err(
errors::AttrApplication::StructEnumFunctionMethodUnion { errors::AttrApplication::StructEnumFunctionMethodUnion {
@ -1795,6 +1796,8 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
); );
} }
} }
self.check_align_value(hint);
} }
sym::packed => { sym::packed => {
if target != Target::Struct && target != Target::Union { if target != Target::Struct && target != Target::Union {
@ -1892,6 +1895,45 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
} }
} }
fn check_align_value(&self, item: &MetaItemInner) {
match item.singleton_lit_list() {
Some((
_,
MetaItemLit {
kind: ast::LitKind::Int(literal, ast::LitIntType::Unsuffixed), ..
},
)) => {
let val = literal.get() as u64;
if val > 2_u64.pow(29) {
// for values greater than 2^29, a different error will be emitted, make sure that happens
self.dcx().span_delayed_bug(
item.span(),
"alignment greater than 2^29 should be errored on elsewhere",
);
} else {
// only do this check when <= 2^29 to prevent duplicate errors:
// alignment greater than 2^29 not supported
// alignment is too large for the current target
let max =
Size::from_bits(self.tcx.sess.target.pointer_width).signed_int_max() as u64;
if val > max {
self.dcx().emit_err(errors::InvalidReprAlignForTarget {
span: item.span(),
size: max,
});
}
}
}
// if the attribute is malformed, singleton_lit_list may not be of the expected type or may be None
// but an error will have already been emitted, so this code should just skip such attributes
Some((_, _)) | None => {
self.dcx().span_delayed_bug(item.span(), "malformed repr(align(N))");
}
}
}
fn check_used(&self, attrs: &[Attribute], target: Target, target_span: Span) { fn check_used(&self, attrs: &[Attribute], target: Target, target_span: Span) {
let mut used_linker_span = None; let mut used_linker_span = None;
let mut used_compiler_span = None; let mut used_compiler_span = None;

View File

@ -567,6 +567,15 @@ pub(crate) struct ReprConflicting {
pub hint_spans: Vec<Span>, pub hint_spans: Vec<Span>,
} }
#[derive(Diagnostic)]
#[diag(passes_repr_align_greater_than_target_max, code = E0589)]
#[note]
pub(crate) struct InvalidReprAlignForTarget {
#[primary_span]
pub span: Span,
pub size: u64,
}
#[derive(LintDiagnostic)] #[derive(LintDiagnostic)]
#[diag(passes_repr_conflicting, code = E0566)] #[diag(passes_repr_conflicting, code = E0566)]
pub(crate) struct ReprConflictingLint; pub(crate) struct ReprConflictingLint;

View File

@ -392,7 +392,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
Some(ty) if expected == ty => { Some(ty) if expected == ty => {
let source_map = self.tcx.sess.source_map(); let source_map = self.tcx.sess.source_map();
err.span_suggestion( err.span_suggestion(
source_map.end_point(cause.span()), source_map.end_point(cause.span),
"try removing this `?`", "try removing this `?`",
"", "",
Applicability::MachineApplicable, Applicability::MachineApplicable,
@ -412,6 +412,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
source, source,
ref prior_non_diverging_arms, ref prior_non_diverging_arms,
scrut_span, scrut_span,
expr_span,
.. ..
}) => match source { }) => match source {
hir::MatchSource::TryDesugar(scrut_hir_id) => { hir::MatchSource::TryDesugar(scrut_hir_id) => {
@ -430,7 +431,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
Some(ty) if expected == ty => { Some(ty) if expected == ty => {
let source_map = self.tcx.sess.source_map(); let source_map = self.tcx.sess.source_map();
err.span_suggestion( err.span_suggestion(
source_map.end_point(cause.span()), source_map.end_point(cause.span),
"try removing this `?`", "try removing this `?`",
"", "",
Applicability::MachineApplicable, Applicability::MachineApplicable,
@ -460,12 +461,12 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
format!("this and all prior arms are found to be of type `{t}`"), format!("this and all prior arms are found to be of type `{t}`"),
); );
} }
let outer = if any_multiline_arm || !source_map.is_multiline(cause.span) { let outer = if any_multiline_arm || !source_map.is_multiline(expr_span) {
// Cover just `match` and the scrutinee expression, not // Cover just `match` and the scrutinee expression, not
// the entire match body, to reduce diagram noise. // the entire match body, to reduce diagram noise.
cause.span.shrink_to_lo().to(scrut_span) expr_span.shrink_to_lo().to(scrut_span)
} else { } else {
cause.span expr_span
}; };
let msg = "`match` arms have incompatible types"; let msg = "`match` arms have incompatible types";
err.span_label(outer, msg); err.span_label(outer, msg);
@ -1148,7 +1149,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
terr: TypeError<'tcx>, terr: TypeError<'tcx>,
prefer_label: bool, prefer_label: bool,
) { ) {
let span = cause.span(); let span = cause.span;
// For some types of errors, expected-found does not make // For some types of errors, expected-found does not make
// sense, so just ignore the values we were given. // sense, so just ignore the values we were given.
@ -1642,7 +1643,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
terr: TypeError<'tcx>, terr: TypeError<'tcx>,
) -> Vec<TypeErrorAdditionalDiags> { ) -> Vec<TypeErrorAdditionalDiags> {
let mut suggestions = Vec::new(); let mut suggestions = Vec::new();
let span = trace.cause.span(); let span = trace.cause.span;
let values = self.resolve_vars_if_possible(trace.values); let values = self.resolve_vars_if_possible(trace.values);
if let Some((expected, found)) = values.ty() { if let Some((expected, found)) = values.ty() {
match (expected.kind(), found.kind()) { match (expected.kind(), found.kind()) {
@ -1792,7 +1793,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
) -> Diag<'a> { ) -> Diag<'a> {
debug!("report_and_explain_type_error(trace={:?}, terr={:?})", trace, terr); debug!("report_and_explain_type_error(trace={:?}, terr={:?})", trace, terr);
let span = trace.cause.span(); let span = trace.cause.span;
let failure_code = trace.cause.as_failure_code_diag( let failure_code = trace.cause.as_failure_code_diag(
terr, terr,
span, span,

View File

@ -237,7 +237,7 @@ impl<'tcx> NiceRegionError<'_, 'tcx> {
expected_args: GenericArgsRef<'tcx>, expected_args: GenericArgsRef<'tcx>,
actual_args: GenericArgsRef<'tcx>, actual_args: GenericArgsRef<'tcx>,
) -> Diag<'tcx> { ) -> Diag<'tcx> {
let span = cause.span(); let span = cause.span;
let (leading_ellipsis, satisfy_span, where_span, dup_span, def_id) = let (leading_ellipsis, satisfy_span, where_span, dup_span, def_id) =
if let ObligationCauseCode::WhereClause(def_id, span) if let ObligationCauseCode::WhereClause(def_id, span)

View File

@ -1835,6 +1835,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
if impl_trait_ref.references_error() { if impl_trait_ref.references_error() {
return false; return false;
} }
let self_ty = impl_trait_ref.self_ty().to_string();
err.highlighted_help(vec![ err.highlighted_help(vec![
StringPart::normal(format!( StringPart::normal(format!(
"the trait `{}` ", "the trait `{}` ",
@ -1842,16 +1843,24 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
)), )),
StringPart::highlighted("is"), StringPart::highlighted("is"),
StringPart::normal(" implemented for `"), StringPart::normal(" implemented for `"),
StringPart::highlighted(impl_trait_ref.self_ty().to_string()), if let [TypeError::Sorts(_)] = &terrs[..] {
StringPart::normal(self_ty)
} else {
StringPart::highlighted(self_ty)
},
StringPart::normal("`"), StringPart::normal("`"),
]); ]);
if let [TypeError::Sorts(exp_found)] = &terrs[..] { if let [TypeError::Sorts(exp_found)] = &terrs[..] {
let exp_found = self.resolve_vars_if_possible(*exp_found); let exp_found = self.resolve_vars_if_possible(*exp_found);
err.help(format!( err.highlighted_help(vec![
"for that trait implementation, expected `{}`, found `{}`", StringPart::normal("for that trait implementation, "),
exp_found.expected, exp_found.found StringPart::normal("expected `"),
)); StringPart::highlighted(exp_found.expected.to_string()),
StringPart::normal("`, found `"),
StringPart::highlighted(exp_found.found.to_string()),
StringPart::normal("`"),
]);
} }
true true
@ -2160,6 +2169,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
// First, attempt to add note to this error with an async-await-specific // First, attempt to add note to this error with an async-await-specific
// message, and fall back to regular note otherwise. // message, and fall back to regular note otherwise.
if !self.maybe_note_obligation_cause_for_async_await(err, obligation) { if !self.maybe_note_obligation_cause_for_async_await(err, obligation) {
let mut long_ty_file = None;
self.note_obligation_cause_code( self.note_obligation_cause_code(
obligation.cause.body_id, obligation.cause.body_id,
err, err,
@ -2168,7 +2178,15 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
obligation.cause.code(), obligation.cause.code(),
&mut vec![], &mut vec![],
&mut Default::default(), &mut Default::default(),
&mut long_ty_file,
); );
if let Some(file) = long_ty_file {
err.note(format!(
"the full name for the type has been written to '{}'",
file.display(),
));
err.note("consider using `--verbose` to print the full type name to the console");
}
self.suggest_unsized_bound_if_applicable(err, obligation); self.suggest_unsized_bound_if_applicable(err, obligation);
if let Some(span) = err.span.primary_span() if let Some(span) = err.span.primary_span()
&& let Some(mut diag) = && let Some(mut diag) =

View File

@ -305,6 +305,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
if let ObligationCauseCode::WhereClause(..) if let ObligationCauseCode::WhereClause(..)
| ObligationCauseCode::WhereClauseInExpr(..) = code | ObligationCauseCode::WhereClauseInExpr(..) = code
{ {
let mut long_ty_file = None;
self.note_obligation_cause_code( self.note_obligation_cause_code(
error.obligation.cause.body_id, error.obligation.cause.body_id,
&mut diag, &mut diag,
@ -313,7 +314,17 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
code, code,
&mut vec![], &mut vec![],
&mut Default::default(), &mut Default::default(),
&mut long_ty_file,
); );
if let Some(file) = long_ty_file {
diag.note(format!(
"the full name for the type has been written to '{}'",
file.display(),
));
diag.note(
"consider using `--verbose` to print the full type name to the console",
);
}
} }
diag.emit() diag.emit()
} }

View File

@ -144,6 +144,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
obligation.cause.span, obligation.cause.span,
suggest_increasing_limit, suggest_increasing_limit,
|err| { |err| {
let mut long_ty_file = None;
self.note_obligation_cause_code( self.note_obligation_cause_code(
obligation.cause.body_id, obligation.cause.body_id,
err, err,
@ -152,7 +153,17 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
obligation.cause.code(), obligation.cause.code(),
&mut vec![], &mut vec![],
&mut Default::default(), &mut Default::default(),
&mut long_ty_file,
); );
if let Some(file) = long_ty_file {
err.note(format!(
"the full name for the type has been written to '{}'",
file.display(),
));
err.note(
"consider using `--verbose` to print the full type name to the console",
);
}
}, },
); );
} }

View File

@ -3,6 +3,7 @@
use std::assert_matches::debug_assert_matches; use std::assert_matches::debug_assert_matches;
use std::borrow::Cow; use std::borrow::Cow;
use std::iter; use std::iter;
use std::path::PathBuf;
use itertools::{EitherOrBoth, Itertools}; use itertools::{EitherOrBoth, Itertools};
use rustc_data_structures::fx::FxHashSet; use rustc_data_structures::fx::FxHashSet;
@ -2703,6 +2704,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
// Add a note for the item obligation that remains - normally a note pointing to the // Add a note for the item obligation that remains - normally a note pointing to the
// bound that introduced the obligation (e.g. `T: Send`). // bound that introduced the obligation (e.g. `T: Send`).
debug!(?next_code); debug!(?next_code);
let mut long_ty_file = None;
self.note_obligation_cause_code( self.note_obligation_cause_code(
obligation.cause.body_id, obligation.cause.body_id,
err, err,
@ -2711,6 +2713,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
next_code.unwrap(), next_code.unwrap(),
&mut Vec::new(), &mut Vec::new(),
&mut Default::default(), &mut Default::default(),
&mut long_ty_file,
); );
} }
@ -2723,11 +2726,10 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
cause_code: &ObligationCauseCode<'tcx>, cause_code: &ObligationCauseCode<'tcx>,
obligated_types: &mut Vec<Ty<'tcx>>, obligated_types: &mut Vec<Ty<'tcx>>,
seen_requirements: &mut FxHashSet<DefId>, seen_requirements: &mut FxHashSet<DefId>,
long_ty_file: &mut Option<PathBuf>,
) where ) where
T: Upcast<TyCtxt<'tcx>, ty::Predicate<'tcx>>, T: Upcast<TyCtxt<'tcx>, ty::Predicate<'tcx>>,
{ {
let mut long_ty_file = None;
let tcx = self.tcx; let tcx = self.tcx;
let predicate = predicate.upcast(tcx); let predicate = predicate.upcast(tcx);
let suggest_remove_deref = |err: &mut Diag<'_, G>, expr: &hir::Expr<'_>| { let suggest_remove_deref = |err: &mut Diag<'_, G>, expr: &hir::Expr<'_>| {
@ -2957,9 +2959,9 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
} }
ObligationCauseCode::Coercion { source, target } => { ObligationCauseCode::Coercion { source, target } => {
let source = let source =
tcx.short_ty_string(self.resolve_vars_if_possible(source), &mut long_ty_file); tcx.short_ty_string(self.resolve_vars_if_possible(source), long_ty_file);
let target = let target =
tcx.short_ty_string(self.resolve_vars_if_possible(target), &mut long_ty_file); tcx.short_ty_string(self.resolve_vars_if_possible(target), long_ty_file);
err.note(with_forced_trimmed_paths!(format!( err.note(with_forced_trimmed_paths!(format!(
"required for the cast from `{source}` to `{target}`", "required for the cast from `{source}` to `{target}`",
))); )));
@ -3249,7 +3251,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
}; };
if !is_upvar_tys_infer_tuple { if !is_upvar_tys_infer_tuple {
let ty_str = tcx.short_ty_string(ty, &mut long_ty_file); let ty_str = tcx.short_ty_string(ty, long_ty_file);
let msg = format!("required because it appears within the type `{ty_str}`"); let msg = format!("required because it appears within the type `{ty_str}`");
match ty.kind() { match ty.kind() {
ty::Adt(def, _) => match tcx.opt_item_ident(def.did()) { ty::Adt(def, _) => match tcx.opt_item_ident(def.did()) {
@ -3327,6 +3329,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
&data.parent_code, &data.parent_code,
obligated_types, obligated_types,
seen_requirements, seen_requirements,
long_ty_file,
) )
}); });
} else { } else {
@ -3339,6 +3342,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
cause_code.peel_derives(), cause_code.peel_derives(),
obligated_types, obligated_types,
seen_requirements, seen_requirements,
long_ty_file,
) )
}); });
} }
@ -3347,8 +3351,8 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
let mut parent_trait_pred = let mut parent_trait_pred =
self.resolve_vars_if_possible(data.derived.parent_trait_pred); self.resolve_vars_if_possible(data.derived.parent_trait_pred);
let parent_def_id = parent_trait_pred.def_id(); let parent_def_id = parent_trait_pred.def_id();
let self_ty_str = tcx let self_ty_str =
.short_ty_string(parent_trait_pred.skip_binder().self_ty(), &mut long_ty_file); tcx.short_ty_string(parent_trait_pred.skip_binder().self_ty(), long_ty_file);
let trait_name = parent_trait_pred.print_modifiers_and_trait_path().to_string(); let trait_name = parent_trait_pred.print_modifiers_and_trait_path().to_string();
let msg = format!("required for `{self_ty_str}` to implement `{trait_name}`"); let msg = format!("required for `{self_ty_str}` to implement `{trait_name}`");
let mut is_auto_trait = false; let mut is_auto_trait = false;
@ -3444,10 +3448,8 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
count, count,
pluralize!(count) pluralize!(count)
)); ));
let self_ty = tcx.short_ty_string( let self_ty = tcx
parent_trait_pred.skip_binder().self_ty(), .short_ty_string(parent_trait_pred.skip_binder().self_ty(), long_ty_file);
&mut long_ty_file,
);
err.note(format!( err.note(format!(
"required for `{self_ty}` to implement `{}`", "required for `{self_ty}` to implement `{}`",
parent_trait_pred.print_modifiers_and_trait_path() parent_trait_pred.print_modifiers_and_trait_path()
@ -3463,6 +3465,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
&data.parent_code, &data.parent_code,
obligated_types, obligated_types,
seen_requirements, seen_requirements,
long_ty_file,
) )
}); });
} }
@ -3479,6 +3482,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
&data.parent_code, &data.parent_code,
obligated_types, obligated_types,
seen_requirements, seen_requirements,
long_ty_file,
) )
}); });
} }
@ -3493,6 +3497,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
nested, nested,
obligated_types, obligated_types,
seen_requirements, seen_requirements,
long_ty_file,
) )
}); });
let mut multispan = MultiSpan::from(span); let mut multispan = MultiSpan::from(span);
@ -3523,6 +3528,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
parent_code, parent_code,
obligated_types, obligated_types,
seen_requirements, seen_requirements,
long_ty_file,
) )
}); });
} }
@ -3562,7 +3568,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
} }
ObligationCauseCode::OpaqueReturnType(expr_info) => { ObligationCauseCode::OpaqueReturnType(expr_info) => {
if let Some((expr_ty, hir_id)) = expr_info { if let Some((expr_ty, hir_id)) = expr_info {
let expr_ty = self.tcx.short_ty_string(expr_ty, &mut long_ty_file); let expr_ty = self.tcx.short_ty_string(expr_ty, long_ty_file);
let expr = self.infcx.tcx.hir().expect_expr(hir_id); let expr = self.infcx.tcx.hir().expect_expr(hir_id);
err.span_label( err.span_label(
expr.span, expr.span,
@ -3574,14 +3580,6 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
} }
} }
} }
if let Some(file) = long_ty_file {
err.note(format!(
"the full name for the type has been written to '{}'",
file.display(),
));
err.note("consider using `--verbose` to print the full type name to the console");
}
} }
#[instrument( #[instrument(

View File

@ -1180,7 +1180,7 @@ fn assemble_candidates_from_impls<'cx, 'tcx>(
selcx.tcx(), selcx.tcx(),
selcx.tcx().require_lang_item( selcx.tcx().require_lang_item(
LangItem::Sized, LangItem::Sized,
Some(obligation.cause.span()), Some(obligation.cause.span),
), ),
[self_ty], [self_ty],
), ),
@ -1600,7 +1600,7 @@ fn confirm_builtin_candidate<'cx, 'tcx>(
// exist. Instead, `Pointee<Metadata = ()>` should be a supertrait of `Sized`. // exist. Instead, `Pointee<Metadata = ()>` should be a supertrait of `Sized`.
let sized_predicate = ty::TraitRef::new( let sized_predicate = ty::TraitRef::new(
tcx, tcx,
tcx.require_lang_item(LangItem::Sized, Some(obligation.cause.span())), tcx.require_lang_item(LangItem::Sized, Some(obligation.cause.span)),
[self_ty], [self_ty],
); );
obligations.push(obligation.with(tcx, sized_predicate)); obligations.push(obligation.with(tcx, sized_predicate));

View File

@ -90,7 +90,7 @@ impl<'tcx> InferCtxt<'tcx> {
assert!(!self.intercrate); assert!(!self.intercrate);
let c_pred = let c_pred =
self.canonicalize_query(param_env.and(obligation.predicate), &mut _orig_values); self.canonicalize_query(param_env.and(obligation.predicate), &mut _orig_values);
self.tcx.at(obligation.cause.span()).evaluate_obligation(c_pred) self.tcx.at(obligation.cause.span).evaluate_obligation(c_pred)
} }
} }

View File

@ -320,8 +320,9 @@ impl char {
/// '1'.is_digit(37); /// '1'.is_digit(37);
/// ``` /// ```
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[rustc_const_unstable(feature = "const_char_is_digit", issue = "132241")]
#[inline] #[inline]
pub fn is_digit(self, radix: u32) -> bool { pub const fn is_digit(self, radix: u32) -> bool {
self.to_digit(radix).is_some() self.to_digit(radix).is_some()
} }

View File

@ -329,6 +329,7 @@ impl TestCx<'_> {
.arg(format!("run_make_support={}", &support_lib_path.to_string_lossy())) .arg(format!("run_make_support={}", &support_lib_path.to_string_lossy()))
.arg("--edition=2021") .arg("--edition=2021")
.arg(&self.testpaths.file.join("rmake.rs")) .arg(&self.testpaths.file.join("rmake.rs"))
.arg("-Cprefer-dynamic")
// Provide necessary library search paths for rustc. // Provide necessary library search paths for rustc.
.env(dylib_env_var(), &env::join_paths(host_dylib_search_paths).unwrap()); .env(dylib_env_var(), &env::join_paths(host_dylib_search_paths).unwrap());

View File

@ -13,3 +13,6 @@ gimli = "0.31.0"
build_helper = { path = "../build_helper" } build_helper = { path = "../build_helper" }
serde_json = "1.0" serde_json = "1.0"
libc = "0.2" libc = "0.2"
[lib]
crate-type = ["lib", "dylib"]

View File

@ -1,13 +1,36 @@
// This test checks that fields are displayed as expected (one by line). // This test checks that fields are displayed as expected (one by line) and they are surrounded
go-to: "file://" + |DOC_PATH| + "/test_docs/fields/struct.Struct.html" // by margins.
store-position: ("#structfield\.a", {"y": a_y})
store-position: ("#structfield\.b", {"y": b_y})
assert: |a_y| < |b_y|
go-to: "file://" + |DOC_PATH| + "/test_docs/fields/union.Union.html" define-function: (
store-position: ("#structfield\.a", {"y": a_y}) "check-fields",
store-position: ("#structfield\.b", {"y": b_y}) [path, selector_1, selector_2],
assert: |a_y| < |b_y| block {
go-to: "file://" + |DOC_PATH| + "/test_docs/fields/" + |path|
store-position: (|selector_1|, {"y": a_y})
store-position: (|selector_2|, {"y": b_y})
assert: |a_y| < |b_y|
// Check the margins.
assert-css: (".structfield.section-header", {
"margin-top": "9.6px",
"margin-bottom": "9.6px",
"margin-left": "0px",
"margin-right": "0px",
}, ALL)
}
)
call-function: ("check-fields", {
"path": "struct.Struct.html",
"selector_1": "#structfield\.a",
"selector_2": "#structfield\.b",
})
call-function: ("check-fields", {
"path": "union.Union.html",
"selector_1": "#structfield\.a",
"selector_2": "#structfield\.b",
})
go-to: "file://" + |DOC_PATH| + "/test_docs/fields/enum.Enum.html" go-to: "file://" + |DOC_PATH| + "/test_docs/fields/enum.Enum.html"
store-position: ("#variant\.A\.field\.a", {"y": a_y}) store-position: ("#variant\.A\.field\.a", {"y": a_y})
@ -16,3 +39,11 @@ assert: |a_y| < |b_y|
store-position: ("#variant\.B\.field\.a", {"y": a_y}) store-position: ("#variant\.B\.field\.a", {"y": a_y})
store-position: ("#variant\.B\.field\.b", {"y": b_y}) store-position: ("#variant\.B\.field\.b", {"y": b_y})
assert: |a_y| < |b_y| assert: |a_y| < |b_y|
// Check the margins.
assert-css: (".sub-variant-field .section-header", {
"margin-top": "0px",
"margin-bottom": "0px",
"margin-left": "0px",
"margin-right": "0px",
}, ALL)

View File

@ -1,4 +1,5 @@
// This test ensures that each field is on its own line (In other words, they have display: block). // This test ensures that each field is on its own line (In other words, they have
// `display: block`).
go-to: "file://" + |DOC_PATH| + "/test_docs/struct.StructWithPublicUndocumentedFields.html" go-to: "file://" + |DOC_PATH| + "/test_docs/struct.StructWithPublicUndocumentedFields.html"
store-property: ("//*[@id='structfield.first']", {"offsetTop": first_top}) store-property: ("//*[@id='structfield.first']", {"offsetTop": first_top})

View File

@ -1,14 +1,14 @@
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-block-const-bound.rs:8:22 --> $DIR/const-block-const-bound.rs:8:15
| |
LL | const fn f<T: ~const Destruct>(x: T) {} LL | const fn f<T: ~const Destruct>(x: T) {}
| ^^^^^^^^ | ^^^^^^
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-block-const-bound.rs:8:22 --> $DIR/const-block-const-bound.rs:8:15
| |
LL | const fn f<T: ~const Destruct>(x: T) {} LL | const fn f<T: ~const Destruct>(x: T) {}
| ^^^^^^^^ | ^^^^^^
| |
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`

View File

@ -11,168 +11,168 @@ LL | #![feature(const_cmp)]
| ^^^^^^^^^ | ^^^^^^^^^
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/fn_trait_refs.rs:13:15 --> $DIR/fn_trait_refs.rs:13:8
| |
LL | T: ~const Fn<()> + ~const Destruct, LL | T: ~const Fn<()> + ~const Destruct,
| ^^^^^^ | ^^^^^^
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/fn_trait_refs.rs:13:31 --> $DIR/fn_trait_refs.rs:13:24
| |
LL | T: ~const Fn<()> + ~const Destruct, LL | T: ~const Fn<()> + ~const Destruct,
| ^^^^^^^^ | ^^^^^^
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/fn_trait_refs.rs:13:15 --> $DIR/fn_trait_refs.rs:13:8
| |
LL | T: ~const Fn<()> + ~const Destruct, LL | T: ~const Fn<()> + ~const Destruct,
| ^^^^^^ | ^^^^^^
| |
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/fn_trait_refs.rs:13:15 --> $DIR/fn_trait_refs.rs:13:8
| |
LL | T: ~const Fn<()> + ~const Destruct, LL | T: ~const Fn<()> + ~const Destruct,
| ^^^^^^ | ^^^^^^
| |
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/fn_trait_refs.rs:13:31 --> $DIR/fn_trait_refs.rs:13:24
| |
LL | T: ~const Fn<()> + ~const Destruct, LL | T: ~const Fn<()> + ~const Destruct,
| ^^^^^^^^ | ^^^^^^
| |
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/fn_trait_refs.rs:20:15 --> $DIR/fn_trait_refs.rs:20:8
| |
LL | T: ~const FnMut<()> + ~const Destruct, LL | T: ~const FnMut<()> + ~const Destruct,
| ^^^^^^^^^ | ^^^^^^
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/fn_trait_refs.rs:20:34 --> $DIR/fn_trait_refs.rs:20:27
| |
LL | T: ~const FnMut<()> + ~const Destruct, LL | T: ~const FnMut<()> + ~const Destruct,
| ^^^^^^^^ | ^^^^^^
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/fn_trait_refs.rs:20:15 --> $DIR/fn_trait_refs.rs:20:8
| |
LL | T: ~const FnMut<()> + ~const Destruct, LL | T: ~const FnMut<()> + ~const Destruct,
| ^^^^^^^^^ | ^^^^^^
| |
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/fn_trait_refs.rs:20:15 --> $DIR/fn_trait_refs.rs:20:8
| |
LL | T: ~const FnMut<()> + ~const Destruct, LL | T: ~const FnMut<()> + ~const Destruct,
| ^^^^^^^^^ | ^^^^^^
| |
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/fn_trait_refs.rs:20:34 --> $DIR/fn_trait_refs.rs:20:27
| |
LL | T: ~const FnMut<()> + ~const Destruct, LL | T: ~const FnMut<()> + ~const Destruct,
| ^^^^^^^^ | ^^^^^^
| |
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/fn_trait_refs.rs:27:15 --> $DIR/fn_trait_refs.rs:27:8
| |
LL | T: ~const FnOnce<()>, LL | T: ~const FnOnce<()>,
| ^^^^^^^^^^ | ^^^^^^
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/fn_trait_refs.rs:27:15 --> $DIR/fn_trait_refs.rs:27:8
| |
LL | T: ~const FnOnce<()>, LL | T: ~const FnOnce<()>,
| ^^^^^^^^^^ | ^^^^^^
| |
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/fn_trait_refs.rs:27:15 --> $DIR/fn_trait_refs.rs:27:8
| |
LL | T: ~const FnOnce<()>, LL | T: ~const FnOnce<()>,
| ^^^^^^^^^^ | ^^^^^^
| |
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/fn_trait_refs.rs:34:15 --> $DIR/fn_trait_refs.rs:34:8
| |
LL | T: ~const Fn<()> + ~const Destruct, LL | T: ~const Fn<()> + ~const Destruct,
| ^^^^^^ | ^^^^^^
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/fn_trait_refs.rs:34:31 --> $DIR/fn_trait_refs.rs:34:24
| |
LL | T: ~const Fn<()> + ~const Destruct, LL | T: ~const Fn<()> + ~const Destruct,
| ^^^^^^^^ | ^^^^^^
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/fn_trait_refs.rs:34:15 --> $DIR/fn_trait_refs.rs:34:8
| |
LL | T: ~const Fn<()> + ~const Destruct, LL | T: ~const Fn<()> + ~const Destruct,
| ^^^^^^ | ^^^^^^
| |
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/fn_trait_refs.rs:34:15 --> $DIR/fn_trait_refs.rs:34:8
| |
LL | T: ~const Fn<()> + ~const Destruct, LL | T: ~const Fn<()> + ~const Destruct,
| ^^^^^^ | ^^^^^^
| |
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/fn_trait_refs.rs:34:31 --> $DIR/fn_trait_refs.rs:34:24
| |
LL | T: ~const Fn<()> + ~const Destruct, LL | T: ~const Fn<()> + ~const Destruct,
| ^^^^^^^^ | ^^^^^^
| |
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/fn_trait_refs.rs:48:15 --> $DIR/fn_trait_refs.rs:48:8
| |
LL | T: ~const FnMut<()> + ~const Destruct, LL | T: ~const FnMut<()> + ~const Destruct,
| ^^^^^^^^^ | ^^^^^^
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/fn_trait_refs.rs:48:34 --> $DIR/fn_trait_refs.rs:48:27
| |
LL | T: ~const FnMut<()> + ~const Destruct, LL | T: ~const FnMut<()> + ~const Destruct,
| ^^^^^^^^ | ^^^^^^
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/fn_trait_refs.rs:48:15 --> $DIR/fn_trait_refs.rs:48:8
| |
LL | T: ~const FnMut<()> + ~const Destruct, LL | T: ~const FnMut<()> + ~const Destruct,
| ^^^^^^^^^ | ^^^^^^
| |
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/fn_trait_refs.rs:48:15 --> $DIR/fn_trait_refs.rs:48:8
| |
LL | T: ~const FnMut<()> + ~const Destruct, LL | T: ~const FnMut<()> + ~const Destruct,
| ^^^^^^^^^ | ^^^^^^
| |
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/fn_trait_refs.rs:48:34 --> $DIR/fn_trait_refs.rs:48:27
| |
LL | T: ~const FnMut<()> + ~const Destruct, LL | T: ~const FnMut<()> + ~const Destruct,
| ^^^^^^^^ | ^^^^^^
| |
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`

View File

@ -1,14 +1,14 @@
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/unstable-const-fn-in-libcore.rs:19:39 --> $DIR/unstable-const-fn-in-libcore.rs:19:32
| |
LL | const fn unwrap_or_else<F: ~const FnOnce() -> T>(self, f: F) -> T { LL | const fn unwrap_or_else<F: ~const FnOnce() -> T>(self, f: F) -> T {
| ^^^^^^^^^^^^^ | ^^^^^^
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/unstable-const-fn-in-libcore.rs:19:39 --> $DIR/unstable-const-fn-in-libcore.rs:19:32
| |
LL | const fn unwrap_or_else<F: ~const FnOnce() -> T>(self, f: F) -> T { LL | const fn unwrap_or_else<F: ~const FnOnce() -> T>(self, f: F) -> T {
| ^^^^^^^^^^^^^ | ^^^^^^
| |
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`

View File

@ -0,0 +1,20 @@
//@ only-linux
//@ compile-flags: --error-format=human --color=always
//@ error-pattern: the trait bound
trait Foo<T>: Bar<T> {}
trait Bar<T> {}
struct Struct;
impl<T, K> Foo<K> for T where T: Bar<K>
{}
impl<'a> Bar<()> for Struct {}
fn foo() -> impl Foo<i32> {
Struct
}
fn main() {}

View File

@ -0,0 +1,62 @@
<svg width="1104px" height="344px" xmlns="http://www.w3.org/2000/svg">
<style>
.fg { fill: #AAAAAA }
.bg { background: #000000 }
.fg-ansi256-009 { fill: #FF5555 }
.fg-ansi256-010 { fill: #55FF55 }
.fg-ansi256-012 { fill: #5555FF }
.fg-magenta { fill: #AA00AA }
.container {
padding: 0 10px;
line-height: 18px;
}
.bold { font-weight: bold; }
tspan {
font: 14px SFMono-Regular, Consolas, Liberation Mono, Menlo, monospace;
white-space: pre;
line-height: 18px;
}
</style>
<rect width="100%" height="100%" y="0" rx="4.5" class="bg" />
<text xml:space="preserve" class="container fg">
<tspan x="10px" y="28px"><tspan class="fg-ansi256-009 bold">error[E0277]</tspan><tspan class="bold">: the trait bound `Struct: Foo&lt;i32&gt;` is not satisfied</tspan>
</tspan>
<tspan x="10px" y="46px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--&gt; </tspan><tspan>$DIR/highlight-difference-between-expected-trait-and-found-trait.rs:16:13</tspan>
</tspan>
<tspan x="10px" y="64px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
</tspan>
<tspan x="10px" y="82px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> fn foo() -&gt; impl Foo&lt;i32&gt; {</tspan>
</tspan>
<tspan x="10px" y="100px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-009 bold">^^^^^^^^^^^^^</tspan><tspan> </tspan><tspan class="fg-ansi256-009 bold">the trait `Bar&lt;i32&gt;` is not implemented for `Struct`, which is required by `Struct: Foo&lt;i32&gt;`</tspan>
</tspan>
<tspan x="10px" y="118px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
</tspan>
<tspan x="10px" y="136px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">= </tspan><tspan class="bold">help</tspan><tspan>: the trait `Bar&lt;()&gt;` </tspan><tspan class="fg-magenta bold">is</tspan><tspan> implemented for `Struct`</tspan>
</tspan>
<tspan x="10px" y="154px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">= </tspan><tspan class="bold">help</tspan><tspan>: for that trait implementation, expected `</tspan><tspan class="fg-magenta bold">()</tspan><tspan>`, found `</tspan><tspan class="fg-magenta bold">i32</tspan><tspan>`</tspan>
</tspan>
<tspan x="10px" y="172px"><tspan class="fg-ansi256-010 bold">note</tspan><tspan>: required for `Struct` to implement `Foo&lt;i32&gt;`</tspan>
</tspan>
<tspan x="10px" y="190px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--&gt; </tspan><tspan>$DIR/highlight-difference-between-expected-trait-and-found-trait.rs:11:12</tspan>
</tspan>
<tspan x="10px" y="208px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
</tspan>
<tspan x="10px" y="226px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> impl&lt;T, K&gt; Foo&lt;K&gt; for T where T: Bar&lt;K&gt;</tspan>
</tspan>
<tspan x="10px" y="244px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-010 bold">^^^^^^</tspan><tspan> </tspan><tspan class="fg-ansi256-010 bold">^</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">------</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">unsatisfied trait bound introduced here</tspan>
</tspan>
<tspan x="10px" y="262px">
</tspan>
<tspan x="10px" y="280px"><tspan class="fg-ansi256-009 bold">error</tspan><tspan class="bold">: aborting due to 1 previous error</tspan>
</tspan>
<tspan x="10px" y="298px">
</tspan>
<tspan x="10px" y="316px"><tspan class="bold">For more information about this error, try `rustc --explain E0277`.</tspan>
</tspan>
<tspan x="10px" y="334px">
</tspan>
</text>
</svg>

After

Width:  |  Height:  |  Size: 3.8 KiB

View File

@ -1,28 +1,28 @@
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/normalize-tait-in-const.rs:26:42 --> $DIR/normalize-tait-in-const.rs:26:35
| |
LL | const fn with_positive<F: for<'a> ~const Fn(&'a Alias<'a>) + ~const Destruct>(fun: F) { LL | const fn with_positive<F: for<'a> ~const Fn(&'a Alias<'a>) + ~const Destruct>(fun: F) {
| ^^^^^^^^^^^^^^^^^ | ^^^^^^
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/normalize-tait-in-const.rs:26:69 --> $DIR/normalize-tait-in-const.rs:26:62
| |
LL | const fn with_positive<F: for<'a> ~const Fn(&'a Alias<'a>) + ~const Destruct>(fun: F) { LL | const fn with_positive<F: for<'a> ~const Fn(&'a Alias<'a>) + ~const Destruct>(fun: F) {
| ^^^^^^^^ | ^^^^^^
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/normalize-tait-in-const.rs:26:42 --> $DIR/normalize-tait-in-const.rs:26:35
| |
LL | const fn with_positive<F: for<'a> ~const Fn(&'a Alias<'a>) + ~const Destruct>(fun: F) { LL | const fn with_positive<F: for<'a> ~const Fn(&'a Alias<'a>) + ~const Destruct>(fun: F) {
| ^^^^^^^^^^^^^^^^^ | ^^^^^^
| |
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/normalize-tait-in-const.rs:26:69 --> $DIR/normalize-tait-in-const.rs:26:62
| |
LL | const fn with_positive<F: for<'a> ~const Fn(&'a Alias<'a>) + ~const Destruct>(fun: F) { LL | const fn with_positive<F: for<'a> ~const Fn(&'a Alias<'a>) + ~const Destruct>(fun: F) {
| ^^^^^^^^ | ^^^^^^
| |
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`

View File

@ -0,0 +1,19 @@
error[E0589]: alignment must not be greater than `isize::MAX` bytes
--> $DIR/repr_align_greater_usize.rs:21:8
|
LL | #[repr(align(32768))]
| ^^^^^^^^^^^^
|
= note: `isize::MAX` is 32767 for the current target
error[E0589]: alignment must not be greater than `isize::MAX` bytes
--> $DIR/repr_align_greater_usize.rs:24:8
|
LL | #[repr(align(65536))]
| ^^^^^^^^^^^^
|
= note: `isize::MAX` is 32767 for the current target
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0589`.

View File

@ -0,0 +1,25 @@
//@ revisions: msp430 aarch32
//@[msp430] needs-llvm-components: msp430
//@[msp430] compile-flags: --target=msp430-none-elf
//@[aarch32] build-pass
//@[aarch32] needs-llvm-components: arm
//@[aarch32] compile-flags: --target=thumbv7m-none-eabi
// We should fail to compute alignment for types aligned higher than usize::MAX.
// We can't handle alignments that require all 32 bits, so this only affects 16-bit.
#![feature(lang_items, no_core)]
#![no_core]
#![crate_type = "lib"]
#[lang = "sized"]
trait Sized {}
#[repr(align(16384))]
struct Kitten;
#[repr(align(32768))] //[msp430]~ ERROR alignment must not be greater than `isize::MAX`
struct Cat;
#[repr(align(65536))] //[msp430]~ ERROR alignment must not be greater than `isize::MAX`
struct BigCat;

View File

@ -1,42 +1,42 @@
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const_trait_impl.rs:34:16 --> $DIR/const_trait_impl.rs:34:9
| |
LL | impl<T: ~const Default> const A for T { LL | impl<T: ~const Default> const A for T {
| ^^^^^^^ | ^^^^^^
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const_trait_impl.rs:40:16 --> $DIR/const_trait_impl.rs:40:9
| |
LL | impl<T: ~const Default + ~const Sup> const A for T { LL | impl<T: ~const Default + ~const Sup> const A for T {
| ^^^^^^^ | ^^^^^^
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const_trait_impl.rs:46:16 --> $DIR/const_trait_impl.rs:46:9
| |
LL | impl<T: ~const Default + ~const Sub> const A for T { LL | impl<T: ~const Default + ~const Sub> const A for T {
| ^^^^^^^ | ^^^^^^
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const_trait_impl.rs:40:16 --> $DIR/const_trait_impl.rs:40:9
| |
LL | impl<T: ~const Default + ~const Sup> const A for T { LL | impl<T: ~const Default + ~const Sup> const A for T {
| ^^^^^^^ | ^^^^^^
| |
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const_trait_impl.rs:34:16 --> $DIR/const_trait_impl.rs:34:9
| |
LL | impl<T: ~const Default> const A for T { LL | impl<T: ~const Default> const A for T {
| ^^^^^^^ | ^^^^^^
| |
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const_trait_impl.rs:46:16 --> $DIR/const_trait_impl.rs:46:9
| |
LL | impl<T: ~const Default + ~const Sub> const A for T { LL | impl<T: ~const Default + ~const Sub> const A for T {
| ^^^^^^^ | ^^^^^^
| |
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`

View File

@ -17,7 +17,7 @@ note: required by a bound in `Foo::Bar`
--> $DIR/assoc-type.rs:32:15 --> $DIR/assoc-type.rs:32:15
| |
LL | type Bar: ~const Add; LL | type Bar: ~const Add;
| ^^^^^^^^^^ required by this bound in `Foo::Bar` | ^^^^^^ required by this bound in `Foo::Bar`
error: aborting due to 1 previous error; 1 warning emitted error: aborting due to 1 previous error; 1 warning emitted

View File

@ -1,14 +1,14 @@
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/call-generic-in-impl.rs:10:16 --> $DIR/call-generic-in-impl.rs:10:9
| |
LL | impl<T: ~const PartialEq> const MyPartialEq for T { LL | impl<T: ~const PartialEq> const MyPartialEq for T {
| ^^^^^^^^^ | ^^^^^^
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/call-generic-in-impl.rs:10:16 --> $DIR/call-generic-in-impl.rs:10:9
| |
LL | impl<T: ~const PartialEq> const MyPartialEq for T { LL | impl<T: ~const PartialEq> const MyPartialEq for T {
| ^^^^^^^^^ | ^^^^^^
| |
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`

View File

@ -17,30 +17,30 @@ LL | impl const PartialEq for S {
= note: adding a non-const method body in the future would be a breaking change = note: adding a non-const method body in the future would be a breaking change
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/call-generic-method-chain.rs:20:32 --> $DIR/call-generic-method-chain.rs:20:25
| |
LL | const fn equals_self<T: ~const PartialEq>(t: &T) -> bool { LL | const fn equals_self<T: ~const PartialEq>(t: &T) -> bool {
| ^^^^^^^^^ | ^^^^^^
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/call-generic-method-chain.rs:20:32 --> $DIR/call-generic-method-chain.rs:20:25
| |
LL | const fn equals_self<T: ~const PartialEq>(t: &T) -> bool { LL | const fn equals_self<T: ~const PartialEq>(t: &T) -> bool {
| ^^^^^^^^^ | ^^^^^^
| |
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/call-generic-method-chain.rs:24:40 --> $DIR/call-generic-method-chain.rs:24:33
| |
LL | const fn equals_self_wrapper<T: ~const PartialEq>(t: &T) -> bool { LL | const fn equals_self_wrapper<T: ~const PartialEq>(t: &T) -> bool {
| ^^^^^^^^^ | ^^^^^^
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/call-generic-method-chain.rs:24:40 --> $DIR/call-generic-method-chain.rs:24:33
| |
LL | const fn equals_self_wrapper<T: ~const PartialEq>(t: &T) -> bool { LL | const fn equals_self_wrapper<T: ~const PartialEq>(t: &T) -> bool {
| ^^^^^^^^^ | ^^^^^^
| |
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`

View File

@ -17,30 +17,30 @@ LL | impl const PartialEq for S {
= note: adding a non-const method body in the future would be a breaking change = note: adding a non-const method body in the future would be a breaking change
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/call-generic-method-dup-bound.rs:20:44 --> $DIR/call-generic-method-dup-bound.rs:20:37
| |
LL | const fn equals_self<T: PartialEq + ~const PartialEq>(t: &T) -> bool { LL | const fn equals_self<T: PartialEq + ~const PartialEq>(t: &T) -> bool {
| ^^^^^^^^^ | ^^^^^^
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/call-generic-method-dup-bound.rs:20:44 --> $DIR/call-generic-method-dup-bound.rs:20:37
| |
LL | const fn equals_self<T: PartialEq + ~const PartialEq>(t: &T) -> bool { LL | const fn equals_self<T: PartialEq + ~const PartialEq>(t: &T) -> bool {
| ^^^^^^^^^ | ^^^^^^
| |
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/call-generic-method-dup-bound.rs:27:37 --> $DIR/call-generic-method-dup-bound.rs:27:30
| |
LL | const fn equals_self2<T: A + ~const PartialEq>(t: &T) -> bool { LL | const fn equals_self2<T: A + ~const PartialEq>(t: &T) -> bool {
| ^^^^^^^^^ | ^^^^^^
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/call-generic-method-dup-bound.rs:27:37 --> $DIR/call-generic-method-dup-bound.rs:27:30
| |
LL | const fn equals_self2<T: A + ~const PartialEq>(t: &T) -> bool { LL | const fn equals_self2<T: A + ~const PartialEq>(t: &T) -> bool {
| ^^^^^^^^^ | ^^^^^^
| |
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`

View File

@ -17,16 +17,16 @@ LL | impl const PartialEq for S {
= note: adding a non-const method body in the future would be a breaking change = note: adding a non-const method body in the future would be a breaking change
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/call-generic-method-pass.rs:20:32 --> $DIR/call-generic-method-pass.rs:20:25
| |
LL | const fn equals_self<T: ~const PartialEq>(t: &T) -> bool { LL | const fn equals_self<T: ~const PartialEq>(t: &T) -> bool {
| ^^^^^^^^^ | ^^^^^^
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/call-generic-method-pass.rs:20:32 --> $DIR/call-generic-method-pass.rs:20:25
| |
LL | const fn equals_self<T: ~const PartialEq>(t: &T) -> bool { LL | const fn equals_self<T: ~const PartialEq>(t: &T) -> bool {
| ^^^^^^^^^ | ^^^^^^
| |
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`

View File

@ -13,24 +13,24 @@ error: using `#![feature(effects)]` without enabling next trait solver globally
= help: use `-Znext-solver` to enable = help: use `-Znext-solver` to enable
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-bounds-non-const-trait.rs:6:28 --> $DIR/const-bounds-non-const-trait.rs:6:21
| |
LL | const fn perform<T: ~const NonConst>() {} LL | const fn perform<T: ~const NonConst>() {}
| ^^^^^^^^ | ^^^^^^
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-bounds-non-const-trait.rs:6:28 --> $DIR/const-bounds-non-const-trait.rs:6:21
| |
LL | const fn perform<T: ~const NonConst>() {} LL | const fn perform<T: ~const NonConst>() {}
| ^^^^^^^^ | ^^^^^^
| |
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: `const` can only be applied to `#[const_trait]` traits error: `const` can only be applied to `#[const_trait]` traits
--> $DIR/const-bounds-non-const-trait.rs:10:21 --> $DIR/const-bounds-non-const-trait.rs:10:15
| |
LL | fn operate<T: const NonConst>() {} LL | fn operate<T: const NonConst>() {}
| ^^^^^^^^ | ^^^^^
error: aborting due to 4 previous errors; 1 warning emitted error: aborting due to 4 previous errors; 1 warning emitted

View File

@ -1,14 +1,14 @@
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-closure-parse-not-item.rs:7:32 --> $DIR/const-closure-parse-not-item.rs:7:25
| |
LL | const fn test() -> impl ~const Fn() { LL | const fn test() -> impl ~const Fn() {
| ^^^^ | ^^^^^^
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-closure-parse-not-item.rs:7:32 --> $DIR/const-closure-parse-not-item.rs:7:25
| |
LL | const fn test() -> impl ~const Fn() { LL | const fn test() -> impl ~const Fn() {
| ^^^^ | ^^^^^^
| |
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`

View File

@ -1,14 +1,14 @@
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-closure-trait-method-fail.rs:14:39 --> $DIR/const-closure-trait-method-fail.rs:14:32
| |
LL | const fn need_const_closure<T: ~const FnOnce(()) -> i32>(x: T) -> i32 { LL | const fn need_const_closure<T: ~const FnOnce(()) -> i32>(x: T) -> i32 {
| ^^^^^^^^^^^^^^^^^ | ^^^^^^
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-closure-trait-method-fail.rs:14:39 --> $DIR/const-closure-trait-method-fail.rs:14:32
| |
LL | const fn need_const_closure<T: ~const FnOnce(()) -> i32>(x: T) -> i32 { LL | const fn need_const_closure<T: ~const FnOnce(()) -> i32>(x: T) -> i32 {
| ^^^^^^^^^^^^^^^^^ | ^^^^^^
| |
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`

View File

@ -1,14 +1,14 @@
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-closure-trait-method.rs:14:39 --> $DIR/const-closure-trait-method.rs:14:32
| |
LL | const fn need_const_closure<T: ~const FnOnce(()) -> i32>(x: T) -> i32 { LL | const fn need_const_closure<T: ~const FnOnce(()) -> i32>(x: T) -> i32 {
| ^^^^^^^^^^^^^^^^^ | ^^^^^^
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-closure-trait-method.rs:14:39 --> $DIR/const-closure-trait-method.rs:14:32
| |
LL | const fn need_const_closure<T: ~const FnOnce(()) -> i32>(x: T) -> i32 { LL | const fn need_const_closure<T: ~const FnOnce(()) -> i32>(x: T) -> i32 {
| ^^^^^^^^^^^^^^^^^ | ^^^^^^
| |
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`

View File

@ -1,56 +1,56 @@
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-closures.rs:8:19 --> $DIR/const-closures.rs:8:12
| |
LL | F: ~const FnOnce() -> u8, LL | F: ~const FnOnce() -> u8,
| ^^^^^^^^^^^^^^ | ^^^^^^
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-closures.rs:9:19 --> $DIR/const-closures.rs:9:12
| |
LL | F: ~const FnMut() -> u8, LL | F: ~const FnMut() -> u8,
| ^^^^^^^^^^^^^ | ^^^^^^
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-closures.rs:10:19 --> $DIR/const-closures.rs:10:12
| |
LL | F: ~const Fn() -> u8, LL | F: ~const Fn() -> u8,
| ^^^^^^^^^^ | ^^^^^^
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-closures.rs:8:19 --> $DIR/const-closures.rs:8:12
| |
LL | F: ~const FnOnce() -> u8, LL | F: ~const FnOnce() -> u8,
| ^^^^^^^^^^^^^^ | ^^^^^^
| |
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-closures.rs:9:19 --> $DIR/const-closures.rs:9:12
| |
LL | F: ~const FnMut() -> u8, LL | F: ~const FnMut() -> u8,
| ^^^^^^^^^^^^^ | ^^^^^^
| |
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-closures.rs:10:19 --> $DIR/const-closures.rs:10:12
| |
LL | F: ~const Fn() -> u8, LL | F: ~const Fn() -> u8,
| ^^^^^^^^^^ | ^^^^^^
| |
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-closures.rs:23:27 --> $DIR/const-closures.rs:23:20
| |
LL | const fn answer<F: ~const Fn() -> u8>(f: &F) -> u8 { LL | const fn answer<F: ~const Fn() -> u8>(f: &F) -> u8 {
| ^^^^^^^^^^ | ^^^^^^
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-closures.rs:23:27 --> $DIR/const-closures.rs:23:20
| |
LL | const fn answer<F: ~const Fn() -> u8>(f: &F) -> u8 { LL | const fn answer<F: ~const Fn() -> u8>(f: &F) -> u8 {
| ^^^^^^^^^^ | ^^^^^^
| |
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`

View File

@ -1,42 +1,42 @@
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-drop-bound.rs:9:68 --> $DIR/const-drop-bound.rs:9:61
| |
LL | const fn foo<T, E>(res: Result<T, E>) -> Option<T> where E: ~const Destruct { LL | const fn foo<T, E>(res: Result<T, E>) -> Option<T> where E: ~const Destruct {
| ^^^^^^^^ | ^^^^^^
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-drop-bound.rs:9:68 --> $DIR/const-drop-bound.rs:9:61
| |
LL | const fn foo<T, E>(res: Result<T, E>) -> Option<T> where E: ~const Destruct { LL | const fn foo<T, E>(res: Result<T, E>) -> Option<T> where E: ~const Destruct {
| ^^^^^^^^ | ^^^^^^
| |
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-drop-bound.rs:20:15 --> $DIR/const-drop-bound.rs:20:8
| |
LL | T: ~const Destruct, LL | T: ~const Destruct,
| ^^^^^^^^ | ^^^^^^
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-drop-bound.rs:21:15 --> $DIR/const-drop-bound.rs:21:8
| |
LL | E: ~const Destruct, LL | E: ~const Destruct,
| ^^^^^^^^ | ^^^^^^
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-drop-bound.rs:20:15 --> $DIR/const-drop-bound.rs:20:8
| |
LL | T: ~const Destruct, LL | T: ~const Destruct,
| ^^^^^^^^ | ^^^^^^
| |
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-drop-bound.rs:21:15 --> $DIR/const-drop-bound.rs:21:8
| |
LL | E: ~const Destruct, LL | E: ~const Destruct,
| ^^^^^^^^ | ^^^^^^
| |
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`

View File

@ -8,16 +8,16 @@ LL | impl<T: ~const A> const Drop for ConstDropImplWithNonConstBounds<T> {
= note: adding a non-const method body in the future would be a breaking change = note: adding a non-const method body in the future would be a breaking change
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-drop-fail-2.rs:20:26 --> $DIR/const-drop-fail-2.rs:20:19
| |
LL | const fn check<T: ~const Destruct>(_: T) {} LL | const fn check<T: ~const Destruct>(_: T) {}
| ^^^^^^^^ | ^^^^^^
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-drop-fail-2.rs:20:26 --> $DIR/const-drop-fail-2.rs:20:19
| |
LL | const fn check<T: ~const Destruct>(_: T) {} LL | const fn check<T: ~const Destruct>(_: T) {}
| ^^^^^^^^ | ^^^^^^
| |
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`

View File

@ -8,16 +8,16 @@ LL | impl const Drop for ConstImplWithDropGlue {
= note: adding a non-const method body in the future would be a breaking change = note: adding a non-const method body in the future would be a breaking change
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-drop-fail.rs:23:26 --> $DIR/const-drop-fail.rs:23:19
| |
LL | const fn check<T: ~const Destruct>(_: T) {} LL | const fn check<T: ~const Destruct>(_: T) {}
| ^^^^^^^^ | ^^^^^^
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-drop-fail.rs:23:26 --> $DIR/const-drop-fail.rs:23:19
| |
LL | const fn check<T: ~const Destruct>(_: T) {} LL | const fn check<T: ~const Destruct>(_: T) {}
| ^^^^^^^^ | ^^^^^^
| |
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`

View File

@ -8,16 +8,16 @@ LL | impl const Drop for ConstImplWithDropGlue {
= note: adding a non-const method body in the future would be a breaking change = note: adding a non-const method body in the future would be a breaking change
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-drop-fail.rs:23:26 --> $DIR/const-drop-fail.rs:23:19
| |
LL | const fn check<T: ~const Destruct>(_: T) {} LL | const fn check<T: ~const Destruct>(_: T) {}
| ^^^^^^^^ | ^^^^^^
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-drop-fail.rs:23:26 --> $DIR/const-drop-fail.rs:23:19
| |
LL | const fn check<T: ~const Destruct>(_: T) {} LL | const fn check<T: ~const Destruct>(_: T) {}
| ^^^^^^^^ | ^^^^^^
| |
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`

View File

@ -35,16 +35,16 @@ LL | impl<T: SomeTrait> const Drop for ConstDropWithNonconstBound<T> {
= note: adding a non-const method body in the future would be a breaking change = note: adding a non-const method body in the future would be a breaking change
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-drop.rs:18:22 --> $DIR/const-drop.rs:18:15
| |
LL | const fn a<T: ~const Destruct>(_: T) {} LL | const fn a<T: ~const Destruct>(_: T) {}
| ^^^^^^^^ | ^^^^^^
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-drop.rs:18:22 --> $DIR/const-drop.rs:18:15
| |
LL | const fn a<T: ~const Destruct>(_: T) {} LL | const fn a<T: ~const Destruct>(_: T) {}
| ^^^^^^^^ | ^^^^^^
| |
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`

View File

@ -35,16 +35,16 @@ LL | impl<T: SomeTrait> const Drop for ConstDropWithNonconstBound<T> {
= note: adding a non-const method body in the future would be a breaking change = note: adding a non-const method body in the future would be a breaking change
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-drop.rs:18:22 --> $DIR/const-drop.rs:18:15
| |
LL | const fn a<T: ~const Destruct>(_: T) {} LL | const fn a<T: ~const Destruct>(_: T) {}
| ^^^^^^^^ | ^^^^^^
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-drop.rs:18:22 --> $DIR/const-drop.rs:18:15
| |
LL | const fn a<T: ~const Destruct>(_: T) {} LL | const fn a<T: ~const Destruct>(_: T) {}
| ^^^^^^^^ | ^^^^^^
| |
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`

View File

@ -23,12 +23,6 @@ LL | #[derive_const(PartialEq)]
= note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info) = note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info)
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/derive-const-with-params.rs:7:16
|
LL | #[derive_const(PartialEq)]
| ^^^^^^^^^
|
= note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0015]: cannot call non-const operator in constant functions error[E0015]: cannot call non-const operator in constant functions
--> $DIR/derive-const-with-params.rs:8:23 --> $DIR/derive-const-with-params.rs:8:23

View File

@ -23,16 +23,16 @@ error: using `#![feature(effects)]` without enabling next trait solver globally
= help: use `-Znext-solver` to enable = help: use `-Znext-solver` to enable
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/ice-112822-expected-type-for-param.rs:3:32 --> $DIR/ice-112822-expected-type-for-param.rs:3:25
| |
LL | const fn test() -> impl ~const Fn() { LL | const fn test() -> impl ~const Fn() {
| ^^^^ | ^^^^^^
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/ice-112822-expected-type-for-param.rs:3:32 --> $DIR/ice-112822-expected-type-for-param.rs:3:25
| |
LL | const fn test() -> impl ~const Fn() { LL | const fn test() -> impl ~const Fn() {
| ^^^^ | ^^^^^^
| |
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`

View File

@ -37,10 +37,10 @@ LL | impl<T> const Foo for T where T: const Specialize {}
= note: adding a non-const method body in the future would be a breaking change = note: adding a non-const method body in the future would be a breaking change
error: `const` can only be applied to `#[const_trait]` traits error: `const` can only be applied to `#[const_trait]` traits
--> $DIR/spec-effectvar-ice.rs:14:40 --> $DIR/spec-effectvar-ice.rs:14:34
| |
LL | impl<T> const Foo for T where T: const Specialize {} LL | impl<T> const Foo for T where T: const Specialize {}
| ^^^^^^^^^^ | ^^^^^
error: specialization impl does not specialize any associated items error: specialization impl does not specialize any associated items
--> $DIR/spec-effectvar-ice.rs:14:1 --> $DIR/spec-effectvar-ice.rs:14:1

View File

@ -4,16 +4,16 @@ error: using `#![feature(effects)]` without enabling next trait solver globally
= help: use `-Znext-solver` to enable = help: use `-Znext-solver` to enable
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/ice-123664-unexpected-bound-var.rs:4:34 --> $DIR/ice-123664-unexpected-bound-var.rs:4:27
| |
LL | const fn with_positive<F: ~const Fn()>() {} LL | const fn with_positive<F: ~const Fn()>() {}
| ^^^^ | ^^^^^^
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/ice-123664-unexpected-bound-var.rs:4:34 --> $DIR/ice-123664-unexpected-bound-var.rs:4:27
| |
LL | const fn with_positive<F: ~const Fn()>() {} LL | const fn with_positive<F: ~const Fn()>() {}
| ^^^^ | ^^^^^^
| |
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`

View File

@ -1,14 +1,14 @@
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/issue-92111.rs:20:22 --> $DIR/issue-92111.rs:20:15
| |
LL | const fn a<T: ~const Destruct>(t: T) {} LL | const fn a<T: ~const Destruct>(t: T) {}
| ^^^^^^^^ | ^^^^^^
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/issue-92111.rs:20:22 --> $DIR/issue-92111.rs:20:15
| |
LL | const fn a<T: ~const Destruct>(t: T) {} LL | const fn a<T: ~const Destruct>(t: T) {}
| ^^^^^^^^ | ^^^^^^
| |
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`

View File

@ -17,7 +17,7 @@ note: required by a bound in `Foo::Assoc`
--> $DIR/item-bound-entailment-fails.rs:6:20 --> $DIR/item-bound-entailment-fails.rs:6:20
| |
LL | type Assoc<T>: ~const Bar LL | type Assoc<T>: ~const Bar
| ^^^^^^^^^^ required by this bound in `Foo::Assoc` | ^^^^^^ required by this bound in `Foo::Assoc`
error[E0277]: the trait bound `T: ~const Bar` is not satisfied error[E0277]: the trait bound `T: ~const Bar` is not satisfied
--> $DIR/item-bound-entailment-fails.rs:25:21 --> $DIR/item-bound-entailment-fails.rs:25:21
@ -29,7 +29,7 @@ note: required by a bound in `Foo::Assoc`
--> $DIR/item-bound-entailment-fails.rs:6:20 --> $DIR/item-bound-entailment-fails.rs:6:20
| |
LL | type Assoc<T>: ~const Bar LL | type Assoc<T>: ~const Bar
| ^^^^^^^^^^ required by this bound in `Foo::Assoc` | ^^^^^^ required by this bound in `Foo::Assoc`
error: aborting due to 2 previous errors; 1 warning emitted error: aborting due to 2 previous errors; 1 warning emitted

View File

@ -1,14 +1,14 @@
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/non-const-op-in-closure-in-const.rs:10:51 --> $DIR/non-const-op-in-closure-in-const.rs:10:44
| |
LL | impl<A, B> const Convert<B> for A where B: ~const From<A> { LL | impl<A, B> const Convert<B> for A where B: ~const From<A> {
| ^^^^^^^ | ^^^^^^
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/non-const-op-in-closure-in-const.rs:10:51 --> $DIR/non-const-op-in-closure-in-const.rs:10:44
| |
LL | impl<A, B> const Convert<B> for A where B: ~const From<A> { LL | impl<A, B> const Convert<B> for A where B: ~const From<A> {
| ^^^^^^^ | ^^^^^^
| |
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`

View File

@ -14,7 +14,7 @@ LL | type Bar<T> where T: ~const Bar;
| ----------- definition of `Bar` from trait | ----------- definition of `Bar` from trait
... ...
LL | type Bar<T> = () where T: const Bar; LL | type Bar<T> = () where T: const Bar;
| ^^^^^^^^^ impl has extra requirement `T: const Bar` | ^^^^^ impl has extra requirement `T: const Bar`
error[E0276]: impl has stricter requirements than trait error[E0276]: impl has stricter requirements than trait
--> $DIR/predicate-entailment-fails.rs:18:26 --> $DIR/predicate-entailment-fails.rs:18:26
@ -23,7 +23,7 @@ LL | fn foo<T>() where T: ~const Bar;
| -------------------------------- definition of `foo` from trait | -------------------------------- definition of `foo` from trait
... ...
LL | fn foo<T>() where T: const Bar {} LL | fn foo<T>() where T: const Bar {}
| ^^^^^^^^^ impl has extra requirement `T: const Bar` | ^^^^^ impl has extra requirement `T: const Bar`
error[E0276]: impl has stricter requirements than trait error[E0276]: impl has stricter requirements than trait
--> $DIR/predicate-entailment-fails.rs:29:31 --> $DIR/predicate-entailment-fails.rs:29:31
@ -32,7 +32,7 @@ LL | type Bar<T> where T: Bar;
| ----------- definition of `Bar` from trait | ----------- definition of `Bar` from trait
... ...
LL | type Bar<T> = () where T: const Bar; LL | type Bar<T> = () where T: const Bar;
| ^^^^^^^^^ impl has extra requirement `T: const Bar` | ^^^^^ impl has extra requirement `T: const Bar`
error[E0276]: impl has stricter requirements than trait error[E0276]: impl has stricter requirements than trait
--> $DIR/predicate-entailment-fails.rs:32:26 --> $DIR/predicate-entailment-fails.rs:32:26
@ -41,7 +41,7 @@ LL | fn foo<T>() where T: Bar;
| ------------------------- definition of `foo` from trait | ------------------------- definition of `foo` from trait
... ...
LL | fn foo<T>() where T: const Bar {} LL | fn foo<T>() where T: const Bar {}
| ^^^^^^^^^ impl has extra requirement `T: const Bar` | ^^^^^ impl has extra requirement `T: const Bar`
error[E0276]: impl has stricter requirements than trait error[E0276]: impl has stricter requirements than trait
--> $DIR/predicate-entailment-fails.rs:36:31 --> $DIR/predicate-entailment-fails.rs:36:31
@ -50,7 +50,7 @@ LL | type Bar<T> where T: Bar;
| ----------- definition of `Bar` from trait | ----------- definition of `Bar` from trait
... ...
LL | type Bar<T> = () where T: ~const Bar; LL | type Bar<T> = () where T: ~const Bar;
| ^^^^^^^^^^ impl has extra requirement `T: ~const Bar` | ^^^^^^ impl has extra requirement `T: ~const Bar`
error[E0276]: impl has stricter requirements than trait error[E0276]: impl has stricter requirements than trait
--> $DIR/predicate-entailment-fails.rs:39:26 --> $DIR/predicate-entailment-fails.rs:39:26
@ -59,7 +59,7 @@ LL | fn foo<T>() where T: Bar;
| ------------------------- definition of `foo` from trait | ------------------------- definition of `foo` from trait
... ...
LL | fn foo<T>() where T: ~const Bar {} LL | fn foo<T>() where T: ~const Bar {}
| ^^^^^^^^^^ impl has extra requirement `T: ~const Bar` | ^^^^^^ impl has extra requirement `T: ~const Bar`
error: aborting due to 6 previous errors; 1 warning emitted error: aborting due to 6 previous errors; 1 warning emitted

View File

@ -11,24 +11,24 @@ LL | trait Bar: ~const Foo {}
| ^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/super-traits-fail-2.rs:12:19 --> $DIR/super-traits-fail-2.rs:12:12
| |
LL | trait Bar: ~const Foo {} LL | trait Bar: ~const Foo {}
| ^^^ | ^^^^^^
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/super-traits-fail-2.rs:12:19 --> $DIR/super-traits-fail-2.rs:12:12
| |
LL | trait Bar: ~const Foo {} LL | trait Bar: ~const Foo {}
| ^^^ | ^^^^^^
| |
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/super-traits-fail-2.rs:12:19 --> $DIR/super-traits-fail-2.rs:12:12
| |
LL | trait Bar: ~const Foo {} LL | trait Bar: ~const Foo {}
| ^^^ | ^^^^^^
| |
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`

View File

@ -1,38 +1,38 @@
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/super-traits-fail-2.rs:12:19 --> $DIR/super-traits-fail-2.rs:12:12
| |
LL | trait Bar: ~const Foo {} LL | trait Bar: ~const Foo {}
| ^^^ | ^^^^^^
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/super-traits-fail-2.rs:12:19 --> $DIR/super-traits-fail-2.rs:12:12
| |
LL | trait Bar: ~const Foo {} LL | trait Bar: ~const Foo {}
| ^^^ | ^^^^^^
| |
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/super-traits-fail-2.rs:12:19 --> $DIR/super-traits-fail-2.rs:12:12
| |
LL | trait Bar: ~const Foo {} LL | trait Bar: ~const Foo {}
| ^^^ | ^^^^^^
| |
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/super-traits-fail-2.rs:12:19 --> $DIR/super-traits-fail-2.rs:12:12
| |
LL | trait Bar: ~const Foo {} LL | trait Bar: ~const Foo {}
| ^^^ | ^^^^^^
| |
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/super-traits-fail-2.rs:12:19 --> $DIR/super-traits-fail-2.rs:12:12
| |
LL | trait Bar: ~const Foo {} LL | trait Bar: ~const Foo {}
| ^^^ | ^^^^^^
| |
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`

View File

@ -11,38 +11,38 @@ LL | trait Bar: ~const Foo {}
| ^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/super-traits-fail-3.rs:14:19 --> $DIR/super-traits-fail-3.rs:14:12
| |
LL | trait Bar: ~const Foo {} LL | trait Bar: ~const Foo {}
| ^^^ | ^^^^^^
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/super-traits-fail-3.rs:14:19 --> $DIR/super-traits-fail-3.rs:14:12
| |
LL | trait Bar: ~const Foo {} LL | trait Bar: ~const Foo {}
| ^^^ | ^^^^^^
| |
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/super-traits-fail-3.rs:14:19 --> $DIR/super-traits-fail-3.rs:14:12
| |
LL | trait Bar: ~const Foo {} LL | trait Bar: ~const Foo {}
| ^^^ | ^^^^^^
| |
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/super-traits-fail-3.rs:22:24 --> $DIR/super-traits-fail-3.rs:22:17
| |
LL | const fn foo<T: ~const Bar>(x: &T) { LL | const fn foo<T: ~const Bar>(x: &T) {
| ^^^ | ^^^^^^
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/super-traits-fail-3.rs:22:24 --> $DIR/super-traits-fail-3.rs:22:17
| |
LL | const fn foo<T: ~const Bar>(x: &T) { LL | const fn foo<T: ~const Bar>(x: &T) {
| ^^^ | ^^^^^^
| |
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`

View File

@ -1,38 +1,38 @@
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/super-traits-fail-3.rs:14:19 --> $DIR/super-traits-fail-3.rs:14:12
| |
LL | trait Bar: ~const Foo {} LL | trait Bar: ~const Foo {}
| ^^^ | ^^^^^^
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/super-traits-fail-3.rs:14:19 --> $DIR/super-traits-fail-3.rs:14:12
| |
LL | trait Bar: ~const Foo {} LL | trait Bar: ~const Foo {}
| ^^^ | ^^^^^^
| |
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/super-traits-fail-3.rs:14:19 --> $DIR/super-traits-fail-3.rs:14:12
| |
LL | trait Bar: ~const Foo {} LL | trait Bar: ~const Foo {}
| ^^^ | ^^^^^^
| |
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/super-traits-fail-3.rs:14:19 --> $DIR/super-traits-fail-3.rs:14:12
| |
LL | trait Bar: ~const Foo {} LL | trait Bar: ~const Foo {}
| ^^^ | ^^^^^^
| |
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/super-traits-fail-3.rs:14:19 --> $DIR/super-traits-fail-3.rs:14:12
| |
LL | trait Bar: ~const Foo {} LL | trait Bar: ~const Foo {}
| ^^^ | ^^^^^^
| |
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`

View File

@ -11,16 +11,16 @@ LL | trait Bar: ~const Foo {}
| ^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/super-traits-fail-3.rs:22:24 --> $DIR/super-traits-fail-3.rs:22:17
| |
LL | const fn foo<T: ~const Bar>(x: &T) { LL | const fn foo<T: ~const Bar>(x: &T) {
| ^^^ | ^^^^^^
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/super-traits-fail-3.rs:22:24 --> $DIR/super-traits-fail-3.rs:22:17
| |
LL | const fn foo<T: ~const Bar>(x: &T) { LL | const fn foo<T: ~const Bar>(x: &T) {
| ^^^ | ^^^^^^
| |
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`

View File

@ -28,7 +28,7 @@ note: required by a bound in `require`
--> $DIR/unsatisfied-const-trait-bound.rs:8:15 --> $DIR/unsatisfied-const-trait-bound.rs:8:15
| |
LL | fn require<T: const Trait>() {} LL | fn require<T: const Trait>() {}
| ^^^^^^^^^^^ required by this bound in `require` | ^^^^^ required by this bound in `require`
error: aborting due to 4 previous errors error: aborting due to 4 previous errors

View File

@ -22,8 +22,8 @@ fn main() {
Some(()) => &S, Some(()) => &S,
None => &R, //~ ERROR E0308 None => &R, //~ ERROR E0308
} }
let t: &dyn Trait = match opt() { //~ ERROR E0038 let t: &dyn Trait = match opt() {
Some(()) => &S, //~ ERROR E0038 Some(()) => &S, //~ ERROR E0038
None => &R, None => &R, //~ ERROR E0038
}; };
} }

View File

@ -31,14 +31,10 @@ LL | trait Trait: Sized {}
= note: required for the cast from `&S` to `&dyn Trait` = note: required for the cast from `&S` to `&dyn Trait`
error[E0038]: the trait `Trait` cannot be made into an object error[E0038]: the trait `Trait` cannot be made into an object
--> $DIR/wf-dyn-incompat-trait-obj-match.rs:25:25 --> $DIR/wf-dyn-incompat-trait-obj-match.rs:27:17
| |
LL | let t: &dyn Trait = match opt() { LL | None => &R,
| _________________________^ | ^^ `Trait` cannot be made into an object
LL | | Some(()) => &S,
LL | | None => &R,
LL | | };
| |_____^ `Trait` cannot be made into an object
| |
note: for a trait to be "dyn-compatible" 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 "dyn-compatible" 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-dyn-incompat-trait-obj-match.rs:6:14 --> $DIR/wf-dyn-incompat-trait-obj-match.rs:6:14