make const_err a hard error
This commit is contained in:
parent
5854680388
commit
fd59d44f58
254 changed files with 1460 additions and 5402 deletions
|
@ -2,7 +2,6 @@ use std::error::Error;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
|
|
||||||
use rustc_errors::Diagnostic;
|
use rustc_errors::Diagnostic;
|
||||||
use rustc_hir as hir;
|
|
||||||
use rustc_middle::mir::AssertKind;
|
use rustc_middle::mir::AssertKind;
|
||||||
use rustc_middle::ty::{layout::LayoutError, query::TyCtxtAt, ConstInt};
|
use rustc_middle::ty::{layout::LayoutError, query::TyCtxtAt, ConstInt};
|
||||||
use rustc_span::{Span, Symbol};
|
use rustc_span::{Span, Symbol};
|
||||||
|
@ -23,11 +22,7 @@ pub enum ConstEvalErrKind {
|
||||||
Abort(String),
|
Abort(String),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl MachineStopType for ConstEvalErrKind {
|
impl MachineStopType for ConstEvalErrKind {}
|
||||||
fn is_hard_err(&self) -> bool {
|
|
||||||
matches!(self, Self::Panic { .. })
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// The errors become `MachineStop` with plain strings when being raised.
|
// The errors become `MachineStop` with plain strings when being raised.
|
||||||
// `ConstEvalErr` (in `librustc_middle/mir/interpret/error.rs`) knows to
|
// `ConstEvalErr` (in `librustc_middle/mir/interpret/error.rs`) knows to
|
||||||
|
@ -87,48 +82,10 @@ impl<'tcx> ConstEvalErr<'tcx> {
|
||||||
ConstEvalErr { error: error.into_kind(), stacktrace, span }
|
ConstEvalErr { error: error.into_kind(), stacktrace, span }
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn struct_error(
|
|
||||||
&self,
|
|
||||||
tcx: TyCtxtAt<'tcx>,
|
|
||||||
message: &str,
|
|
||||||
decorate: impl FnOnce(&mut Diagnostic),
|
|
||||||
) -> ErrorHandled {
|
|
||||||
self.struct_generic(tcx, message, decorate, None)
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn report_as_error(&self, tcx: TyCtxtAt<'tcx>, message: &str) -> ErrorHandled {
|
pub fn report_as_error(&self, tcx: TyCtxtAt<'tcx>, message: &str) -> ErrorHandled {
|
||||||
self.struct_error(tcx, message, |_| {})
|
self.struct_error(tcx, message, |_| {})
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn report_as_lint(
|
|
||||||
&self,
|
|
||||||
tcx: TyCtxtAt<'tcx>,
|
|
||||||
message: &str,
|
|
||||||
lint_root: hir::HirId,
|
|
||||||
span: Option<Span>,
|
|
||||||
) -> ErrorHandled {
|
|
||||||
self.struct_generic(
|
|
||||||
tcx,
|
|
||||||
message,
|
|
||||||
|lint: &mut Diagnostic| {
|
|
||||||
// Apply the span.
|
|
||||||
if let Some(span) = span {
|
|
||||||
let primary_spans = lint.span.primary_spans().to_vec();
|
|
||||||
// point at the actual error as the primary span
|
|
||||||
lint.replace_span_with(span);
|
|
||||||
// point to the `const` statement as a secondary span
|
|
||||||
// they don't have any label
|
|
||||||
for sp in primary_spans {
|
|
||||||
if sp != span {
|
|
||||||
lint.span_label(sp, "");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
Some(lint_root),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Create a diagnostic for this const eval error.
|
/// Create a diagnostic for this const eval error.
|
||||||
///
|
///
|
||||||
/// Sets the message passed in via `message` and adds span labels with detailed error
|
/// Sets the message passed in via `message` and adds span labels with detailed error
|
||||||
|
@ -137,13 +94,12 @@ impl<'tcx> ConstEvalErr<'tcx> {
|
||||||
///
|
///
|
||||||
/// If `lint_root.is_some()` report it as a lint, else report it as a hard error.
|
/// If `lint_root.is_some()` report it as a lint, else report it as a hard error.
|
||||||
/// (Except that for some errors, we ignore all that -- see `must_error` below.)
|
/// (Except that for some errors, we ignore all that -- see `must_error` below.)
|
||||||
#[instrument(skip(self, tcx, decorate, lint_root), level = "debug")]
|
#[instrument(skip(self, tcx, decorate), level = "debug")]
|
||||||
fn struct_generic(
|
pub fn struct_error(
|
||||||
&self,
|
&self,
|
||||||
tcx: TyCtxtAt<'tcx>,
|
tcx: TyCtxtAt<'tcx>,
|
||||||
message: &str,
|
message: &str,
|
||||||
decorate: impl FnOnce(&mut Diagnostic),
|
decorate: impl FnOnce(&mut Diagnostic),
|
||||||
lint_root: Option<hir::HirId>,
|
|
||||||
) -> ErrorHandled {
|
) -> ErrorHandled {
|
||||||
let finish = |err: &mut Diagnostic, span_msg: Option<String>| {
|
let finish = |err: &mut Diagnostic, span_msg: Option<String>| {
|
||||||
trace!("reporting const eval failure at {:?}", self.span);
|
trace!("reporting const eval failure at {:?}", self.span);
|
||||||
|
@ -224,27 +180,9 @@ impl<'tcx> ConstEvalErr<'tcx> {
|
||||||
|
|
||||||
let err_msg = self.error.to_string();
|
let err_msg = self.error.to_string();
|
||||||
|
|
||||||
// Regular case - emit a lint.
|
// Report as hard error.
|
||||||
if let Some(lint_root) = lint_root {
|
let mut err = struct_error(tcx, message);
|
||||||
// Report as lint.
|
finish(&mut err, Some(err_msg));
|
||||||
let hir_id =
|
ErrorHandled::Reported(err.emit())
|
||||||
self.stacktrace.iter().rev().find_map(|frame| frame.lint_root).unwrap_or(lint_root);
|
|
||||||
tcx.struct_span_lint_hir(
|
|
||||||
rustc_session::lint::builtin::CONST_ERR,
|
|
||||||
hir_id,
|
|
||||||
tcx.span,
|
|
||||||
message,
|
|
||||||
|lint| {
|
|
||||||
finish(lint, Some(err_msg));
|
|
||||||
lint
|
|
||||||
},
|
|
||||||
);
|
|
||||||
ErrorHandled::Linted
|
|
||||||
} else {
|
|
||||||
// Report as hard error.
|
|
||||||
let mut err = struct_error(tcx, message);
|
|
||||||
finish(&mut err, Some(err_msg));
|
|
||||||
ErrorHandled::Reported(err.emit())
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -317,45 +317,23 @@ pub fn eval_to_allocation_raw_provider<'tcx>(
|
||||||
match res.and_then(|body| eval_body_using_ecx(&mut ecx, cid, &body)) {
|
match res.and_then(|body| eval_body_using_ecx(&mut ecx, cid, &body)) {
|
||||||
Err(error) => {
|
Err(error) => {
|
||||||
let err = ConstEvalErr::new(&ecx, error, None);
|
let err = ConstEvalErr::new(&ecx, error, None);
|
||||||
// Some CTFE errors raise just a lint, not a hard error; see
|
let msg = if is_static {
|
||||||
// <https://github.com/rust-lang/rust/issues/71800>.
|
Cow::from("could not evaluate static initializer")
|
||||||
let is_hard_err = if let Some(def) = def.as_local() {
|
|
||||||
// (Associated) consts only emit a lint, since they might be unused.
|
|
||||||
!matches!(tcx.def_kind(def.did.to_def_id()), DefKind::Const | DefKind::AssocConst)
|
|
||||||
// check if the inner InterpError is hard
|
|
||||||
|| err.error.is_hard_err()
|
|
||||||
} else {
|
} else {
|
||||||
// use of broken constant from other crate: always an error
|
// If the current item has generics, we'd like to enrich the message with the
|
||||||
true
|
// instance and its substs: to show the actual compile-time values, in addition to
|
||||||
|
// the expression, leading to the const eval error.
|
||||||
|
let instance = &key.value.instance;
|
||||||
|
if !instance.substs.is_empty() {
|
||||||
|
let instance = with_no_trimmed_paths!(instance.to_string());
|
||||||
|
let msg = format!("evaluation of `{}` failed", instance);
|
||||||
|
Cow::from(msg)
|
||||||
|
} else {
|
||||||
|
Cow::from("evaluation of constant value failed")
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if is_hard_err {
|
Err(err.report_as_error(ecx.tcx.at(err.span), &msg))
|
||||||
let msg = if is_static {
|
|
||||||
Cow::from("could not evaluate static initializer")
|
|
||||||
} else {
|
|
||||||
// If the current item has generics, we'd like to enrich the message with the
|
|
||||||
// instance and its substs: to show the actual compile-time values, in addition to
|
|
||||||
// the expression, leading to the const eval error.
|
|
||||||
let instance = &key.value.instance;
|
|
||||||
if !instance.substs.is_empty() {
|
|
||||||
let instance = with_no_trimmed_paths!(instance.to_string());
|
|
||||||
let msg = format!("evaluation of `{}` failed", instance);
|
|
||||||
Cow::from(msg)
|
|
||||||
} else {
|
|
||||||
Cow::from("evaluation of constant value failed")
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
Err(err.report_as_error(ecx.tcx.at(err.span), &msg))
|
|
||||||
} else {
|
|
||||||
let hir_id = tcx.hir().local_def_id_to_hir_id(def.as_local().unwrap().did);
|
|
||||||
Err(err.report_as_lint(
|
|
||||||
tcx.at(tcx.def_span(def.did)),
|
|
||||||
"any use of this value will cause an error",
|
|
||||||
hir_id,
|
|
||||||
Some(err.span),
|
|
||||||
))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Ok(mplace) => {
|
Ok(mplace) => {
|
||||||
// Since evaluation had no errors, validate the resulting constant.
|
// Since evaluation had no errors, validate the resulting constant.
|
||||||
|
|
|
@ -258,6 +258,9 @@ impl<'tcx> fmt::Display for FrameInfo<'tcx> {
|
||||||
{
|
{
|
||||||
write!(f, "inside closure")?;
|
write!(f, "inside closure")?;
|
||||||
} else {
|
} else {
|
||||||
|
// Note: this triggers a `good_path_bug` state, which means that if we ever get here
|
||||||
|
// we must emit a diagnostic. We should never display a `FrameInfo` unless we
|
||||||
|
// actually want to emit a warning or error to the user.
|
||||||
write!(f, "inside `{}`", self.instance)?;
|
write!(f, "inside `{}`", self.instance)?;
|
||||||
}
|
}
|
||||||
if !self.span.is_dummy() {
|
if !self.span.is_dummy() {
|
||||||
|
|
|
@ -332,8 +332,6 @@ pub enum InternKind {
|
||||||
///
|
///
|
||||||
/// This *cannot raise an interpreter error*. Doing so is left to validation, which
|
/// This *cannot raise an interpreter error*. Doing so is left to validation, which
|
||||||
/// tracks where in the value we are and thus can show much better error messages.
|
/// tracks where in the value we are and thus can show much better error messages.
|
||||||
/// Any errors here would anyway be turned into `const_err` lints, whereas validation failures
|
|
||||||
/// are hard errors.
|
|
||||||
#[instrument(level = "debug", skip(ecx))]
|
#[instrument(level = "debug", skip(ecx))]
|
||||||
pub fn intern_const_alloc_recursive<
|
pub fn intern_const_alloc_recursive<
|
||||||
'mir,
|
'mir,
|
||||||
|
|
|
@ -522,6 +522,11 @@ fn register_builtins(store: &mut LintStore, no_interleave_lints: bool) {
|
||||||
"now allowed, see issue #59159 \
|
"now allowed, see issue #59159 \
|
||||||
<https://github.com/rust-lang/rust/issues/59159> for more information",
|
<https://github.com/rust-lang/rust/issues/59159> for more information",
|
||||||
);
|
);
|
||||||
|
store.register_removed(
|
||||||
|
"const_err",
|
||||||
|
"converted into hard error, see issue #71800 \
|
||||||
|
<https://github.com/rust-lang/rust/issues/71800> for more information",
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn register_internals(store: &mut LintStore) {
|
fn register_internals(store: &mut LintStore) {
|
||||||
|
|
|
@ -263,37 +263,6 @@ declare_lint! {
|
||||||
"operation will cause a panic at runtime"
|
"operation will cause a panic at runtime"
|
||||||
}
|
}
|
||||||
|
|
||||||
declare_lint! {
|
|
||||||
/// The `const_err` lint detects an erroneous expression while doing
|
|
||||||
/// constant evaluation.
|
|
||||||
///
|
|
||||||
/// ### Example
|
|
||||||
///
|
|
||||||
/// ```rust,compile_fail
|
|
||||||
/// #![allow(unconditional_panic)]
|
|
||||||
/// const C: i32 = 1/0;
|
|
||||||
/// ```
|
|
||||||
///
|
|
||||||
/// {{produces}}
|
|
||||||
///
|
|
||||||
/// ### Explanation
|
|
||||||
///
|
|
||||||
/// This lint detects constants that fail to evaluate. Allowing the lint will accept the
|
|
||||||
/// constant declaration, but any use of this constant will still lead to a hard error. This is
|
|
||||||
/// a future incompatibility lint; the plan is to eventually entirely forbid even declaring
|
|
||||||
/// constants that cannot be evaluated. See [issue #71800] for more details.
|
|
||||||
///
|
|
||||||
/// [issue #71800]: https://github.com/rust-lang/rust/issues/71800
|
|
||||||
pub CONST_ERR,
|
|
||||||
Deny,
|
|
||||||
"constant evaluation encountered erroneous expression",
|
|
||||||
@future_incompatible = FutureIncompatibleInfo {
|
|
||||||
reference: "issue #71800 <https://github.com/rust-lang/rust/issues/71800>",
|
|
||||||
reason: FutureIncompatibilityReason::FutureReleaseErrorReportNow,
|
|
||||||
};
|
|
||||||
report_in_external_macro
|
|
||||||
}
|
|
||||||
|
|
||||||
declare_lint! {
|
declare_lint! {
|
||||||
/// The `unused_imports` lint detects imports that are never used.
|
/// The `unused_imports` lint detects imports that are never used.
|
||||||
///
|
///
|
||||||
|
@ -3295,7 +3264,6 @@ declare_lint_pass! {
|
||||||
EXPORTED_PRIVATE_DEPENDENCIES,
|
EXPORTED_PRIVATE_DEPENDENCIES,
|
||||||
PUB_USE_OF_PRIVATE_EXTERN_CRATE,
|
PUB_USE_OF_PRIVATE_EXTERN_CRATE,
|
||||||
INVALID_TYPE_PARAM_DEFAULT,
|
INVALID_TYPE_PARAM_DEFAULT,
|
||||||
CONST_ERR,
|
|
||||||
RENAMED_AND_REMOVED_LINTS,
|
RENAMED_AND_REMOVED_LINTS,
|
||||||
UNALIGNED_REFERENCES,
|
UNALIGNED_REFERENCES,
|
||||||
CONST_ITEM_MUTATION,
|
CONST_ITEM_MUTATION,
|
||||||
|
|
|
@ -479,12 +479,7 @@ impl<T: Any> AsAny for T {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A trait for machine-specific errors (or other "machine stop" conditions).
|
/// A trait for machine-specific errors (or other "machine stop" conditions).
|
||||||
pub trait MachineStopType: AsAny + fmt::Display + Send {
|
pub trait MachineStopType: AsAny + fmt::Display + Send {}
|
||||||
/// If `true`, emit a hard error instead of going through the `CONST_ERR` lint
|
|
||||||
fn is_hard_err(&self) -> bool {
|
|
||||||
false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl dyn MachineStopType {
|
impl dyn MachineStopType {
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
|
@ -543,16 +538,4 @@ impl InterpError<'_> {
|
||||||
| InterpError::UndefinedBehavior(UndefinedBehaviorInfo::Ub(_))
|
| InterpError::UndefinedBehavior(UndefinedBehaviorInfo::Ub(_))
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Should this error be reported as a hard error, preventing compilation, or a soft error,
|
|
||||||
/// causing a deny-by-default lint?
|
|
||||||
pub fn is_hard_err(&self) -> bool {
|
|
||||||
use InterpError::*;
|
|
||||||
match *self {
|
|
||||||
MachineStop(ref err) => err.is_hard_err(),
|
|
||||||
UndefinedBehavior(_) => true,
|
|
||||||
ResourceExhaustion(ResourceExhaustionInfo::MemoryExhausted) => true,
|
|
||||||
_ => false,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,9 +16,9 @@ use rustc_index::bit_set::BitSet;
|
||||||
use rustc_index::vec::IndexVec;
|
use rustc_index::vec::IndexVec;
|
||||||
use rustc_middle::mir::visit::Visitor;
|
use rustc_middle::mir::visit::Visitor;
|
||||||
use rustc_middle::mir::{
|
use rustc_middle::mir::{
|
||||||
self, AssertKind, BinOp, Body, Constant, ConstantKind, Local, LocalDecl, Location, Operand,
|
AssertKind, BinOp, Body, Constant, Local, LocalDecl, Location, Operand, Place, Rvalue,
|
||||||
Place, Rvalue, SourceInfo, SourceScope, SourceScopeData, Statement, StatementKind, Terminator,
|
SourceInfo, SourceScope, SourceScopeData, Statement, StatementKind, Terminator, TerminatorKind,
|
||||||
TerminatorKind, UnOp, RETURN_PLACE,
|
UnOp, RETURN_PLACE,
|
||||||
};
|
};
|
||||||
use rustc_middle::ty::layout::{LayoutError, LayoutOf, LayoutOfHelpers, TyAndLayout};
|
use rustc_middle::ty::layout::{LayoutError, LayoutOf, LayoutOfHelpers, TyAndLayout};
|
||||||
use rustc_middle::ty::InternalSubsts;
|
use rustc_middle::ty::InternalSubsts;
|
||||||
|
@ -286,7 +286,11 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns the value, if any, of evaluating `c`.
|
/// Returns the value, if any, of evaluating `c`.
|
||||||
fn eval_constant(&mut self, c: &Constant<'tcx>, source_info: SourceInfo) -> Option<OpTy<'tcx>> {
|
fn eval_constant(
|
||||||
|
&mut self,
|
||||||
|
c: &Constant<'tcx>,
|
||||||
|
_source_info: SourceInfo,
|
||||||
|
) -> Option<OpTy<'tcx>> {
|
||||||
// FIXME we need to revisit this for #67176
|
// FIXME we need to revisit this for #67176
|
||||||
if c.needs_subst() {
|
if c.needs_subst() {
|
||||||
return None;
|
return None;
|
||||||
|
@ -297,28 +301,7 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> {
|
||||||
Err(error) => {
|
Err(error) => {
|
||||||
let tcx = self.ecx.tcx.at(c.span);
|
let tcx = self.ecx.tcx.at(c.span);
|
||||||
let err = ConstEvalErr::new(&self.ecx, error, Some(c.span));
|
let err = ConstEvalErr::new(&self.ecx, error, Some(c.span));
|
||||||
if let Some(lint_root) = self.lint_root(source_info) {
|
err.report_as_error(tcx, "erroneous constant used");
|
||||||
let lint_only = match c.literal {
|
|
||||||
ConstantKind::Ty(ct) => ct.needs_subst(),
|
|
||||||
ConstantKind::Unevaluated(
|
|
||||||
mir::UnevaluatedConst { def: _, substs: _, promoted: Some(_) },
|
|
||||||
_,
|
|
||||||
) => {
|
|
||||||
// Promoteds must lint and not error as the user didn't ask for them
|
|
||||||
true
|
|
||||||
}
|
|
||||||
ConstantKind::Unevaluated(..) | ConstantKind::Val(..) => c.needs_subst(),
|
|
||||||
};
|
|
||||||
if lint_only {
|
|
||||||
// Out of backwards compatibility we cannot report hard errors in unused
|
|
||||||
// generic functions using associated constants of the generic parameters.
|
|
||||||
err.report_as_lint(tcx, "erroneous constant used", lint_root, Some(c.span));
|
|
||||||
} else {
|
|
||||||
err.report_as_error(tcx, "erroneous constant used");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
err.report_as_error(tcx, "erroneous constant used");
|
|
||||||
}
|
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,8 +75,6 @@ wrapping_test!(test_wrapping_u64, u64, u64::MIN, u64::MAX);
|
||||||
wrapping_test!(test_wrapping_u128, u128, u128::MIN, u128::MAX);
|
wrapping_test!(test_wrapping_u128, u128, u128::MIN, u128::MAX);
|
||||||
wrapping_test!(test_wrapping_usize, usize, usize::MIN, usize::MAX);
|
wrapping_test!(test_wrapping_usize, usize, usize::MIN, usize::MAX);
|
||||||
|
|
||||||
// Don't warn about overflowing ops on 32-bit platforms
|
|
||||||
#[cfg_attr(target_pointer_width = "32", allow(const_err))]
|
|
||||||
#[test]
|
#[test]
|
||||||
fn wrapping_int_api() {
|
fn wrapping_int_api() {
|
||||||
assert_eq!(i8::MAX.wrapping_add(1), i8::MIN);
|
assert_eq!(i8::MAX.wrapping_add(1), i8::MIN);
|
||||||
|
|
|
@ -1284,7 +1284,6 @@ fn test_windows_zip() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[allow(const_err)]
|
|
||||||
fn test_iter_ref_consistency() {
|
fn test_iter_ref_consistency() {
|
||||||
use std::fmt::Debug;
|
use std::fmt::Debug;
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,6 @@
|
||||||
// compile-flags: --emit mir,link
|
// compile-flags: --emit mir,link
|
||||||
|
|
||||||
#![feature(never_type)]
|
#![feature(never_type)]
|
||||||
#![warn(const_err)]
|
|
||||||
|
|
||||||
struct PrintName<T>(T);
|
struct PrintName<T>(T);
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
const A: &'static [i32] = &[];
|
const A: &'static [i32] = &[];
|
||||||
const B: i32 = (&A)[1];
|
const B: i32 = (&A)[1];
|
||||||
//~^ index out of bounds: the length is 0 but the index is 1
|
//~^ index out of bounds: the length is 0 but the index is 1
|
||||||
//~| ERROR any use of this value will cause an error
|
//~| ERROR evaluation of constant value failed
|
||||||
//~| WARN this was previously accepted by the compiler but is being phased out
|
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let _ = B;
|
let _ = B;
|
||||||
|
|
|
@ -1,23 +1,9 @@
|
||||||
error: any use of this value will cause an error
|
error[E0080]: evaluation of constant value failed
|
||||||
--> $DIR/array_const_index-0.rs:2:16
|
--> $DIR/array_const_index-0.rs:2:16
|
||||||
|
|
|
|
||||||
LL | const B: i32 = (&A)[1];
|
LL | const B: i32 = (&A)[1];
|
||||||
| ------------ ^^^^^^^ index out of bounds: the length is 0 but the index is 1
|
| ^^^^^^^ index out of bounds: the length is 0 but the index is 1
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
= note: `#[deny(const_err)]` on by default
|
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
Future incompatibility report: Future breakage diagnostic:
|
For more information about this error, try `rustc --explain E0080`.
|
||||||
error: any use of this value will cause an error
|
|
||||||
--> $DIR/array_const_index-0.rs:2:16
|
|
||||||
|
|
|
||||||
LL | const B: i32 = (&A)[1];
|
|
||||||
| ------------ ^^^^^^^ index out of bounds: the length is 0 but the index is 1
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
= note: `#[deny(const_err)]` on by default
|
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
const A: [i32; 0] = [];
|
const A: [i32; 0] = [];
|
||||||
const B: i32 = A[1];
|
const B: i32 = A[1];
|
||||||
//~^ index out of bounds: the length is 0 but the index is 1
|
//~^ index out of bounds: the length is 0 but the index is 1
|
||||||
//~| ERROR any use of this value will cause an error
|
//~| ERROR evaluation of constant value failed
|
||||||
//~| WARN this was previously accepted by the compiler but is being phased out
|
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let _ = B;
|
let _ = B;
|
||||||
|
|
|
@ -1,23 +1,9 @@
|
||||||
error: any use of this value will cause an error
|
error[E0080]: evaluation of constant value failed
|
||||||
--> $DIR/array_const_index-1.rs:2:16
|
--> $DIR/array_const_index-1.rs:2:16
|
||||||
|
|
|
|
||||||
LL | const B: i32 = A[1];
|
LL | const B: i32 = A[1];
|
||||||
| ------------ ^^^^ index out of bounds: the length is 0 but the index is 1
|
| ^^^^ index out of bounds: the length is 0 but the index is 1
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
= note: `#[deny(const_err)]` on by default
|
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
Future incompatibility report: Future breakage diagnostic:
|
For more information about this error, try `rustc --explain E0080`.
|
||||||
error: any use of this value will cause an error
|
|
||||||
--> $DIR/array_const_index-1.rs:2:16
|
|
||||||
|
|
|
||||||
LL | const B: i32 = A[1];
|
|
||||||
| ------------ ^^^^ index out of bounds: the length is 0 but the index is 1
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
= note: `#[deny(const_err)]` on by default
|
|
||||||
|
|
||||||
|
|
|
@ -6,8 +6,7 @@ trait Tr {
|
||||||
// This should not be a constant evaluation error (overflow). The value of
|
// This should not be a constant evaluation error (overflow). The value of
|
||||||
// `Self::A` must not be assumed to hold inside the trait.
|
// `Self::A` must not be assumed to hold inside the trait.
|
||||||
const B: u8 = Self::A + 1;
|
const B: u8 = Self::A + 1;
|
||||||
//~^ ERROR any use of this value will cause an error
|
//~^ ERROR evaluation of `<() as Tr>::B` failed
|
||||||
//~| WARN this was previously accepted by the compiler but is being phased out
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// An impl that doesn't override any constant will NOT cause a const eval error
|
// An impl that doesn't override any constant will NOT cause a const eval error
|
||||||
|
@ -34,7 +33,6 @@ fn main() {
|
||||||
assert_eq!(<() as Tr>::B, 0); // causes the error above
|
assert_eq!(<() as Tr>::B, 0); // causes the error above
|
||||||
//~^ ERROR evaluation of constant value failed
|
//~^ ERROR evaluation of constant value failed
|
||||||
//~| ERROR erroneous constant used
|
//~| ERROR erroneous constant used
|
||||||
//~| WARN this was previously accepted by the compiler but is being phased out
|
|
||||||
|
|
||||||
assert_eq!(<u8 as Tr>::A, 254);
|
assert_eq!(<u8 as Tr>::A, 254);
|
||||||
assert_eq!(<u8 as Tr>::B, 255);
|
assert_eq!(<u8 as Tr>::B, 255);
|
||||||
|
|
|
@ -1,52 +1,23 @@
|
||||||
error: any use of this value will cause an error
|
error[E0080]: evaluation of `<() as Tr>::B` failed
|
||||||
--> $DIR/defaults-not-assumed-fail.rs:8:19
|
--> $DIR/defaults-not-assumed-fail.rs:8:19
|
||||||
|
|
|
|
||||||
LL | const B: u8 = Self::A + 1;
|
LL | const B: u8 = Self::A + 1;
|
||||||
| ----------- ^^^^^^^^^^^ attempt to compute `u8::MAX + 1_u8`, which would overflow
|
| ^^^^^^^^^^^ attempt to compute `u8::MAX + 1_u8`, which would overflow
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
= note: `#[deny(const_err)]` on by default
|
|
||||||
|
|
||||||
error[E0080]: evaluation of constant value failed
|
error[E0080]: evaluation of constant value failed
|
||||||
--> $DIR/defaults-not-assumed-fail.rs:34:16
|
--> $DIR/defaults-not-assumed-fail.rs:33:16
|
||||||
|
|
|
|
||||||
LL | assert_eq!(<() as Tr>::B, 0); // causes the error above
|
LL | assert_eq!(<() as Tr>::B, 0); // causes the error above
|
||||||
| ^^^^^^^^^^^^^ referenced constant has errors
|
| ^^^^^^^^^^^^^ referenced constant has errors
|
||||||
|
|
||||||
error: erroneous constant used
|
error[E0080]: erroneous constant used
|
||||||
--> $DIR/defaults-not-assumed-fail.rs:34:5
|
--> $DIR/defaults-not-assumed-fail.rs:33:5
|
||||||
|
|
|
|
||||||
LL | assert_eq!(<() as Tr>::B, 0); // causes the error above
|
LL | assert_eq!(<() as Tr>::B, 0); // causes the error above
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors
|
||||||
|
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
= note: this error originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info)
|
= note: this error originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
|
||||||
error: aborting due to 3 previous errors
|
error: aborting due to 3 previous errors
|
||||||
|
|
||||||
For more information about this error, try `rustc --explain E0080`.
|
For more information about this error, try `rustc --explain E0080`.
|
||||||
Future incompatibility report: Future breakage diagnostic:
|
|
||||||
error: any use of this value will cause an error
|
|
||||||
--> $DIR/defaults-not-assumed-fail.rs:8:19
|
|
||||||
|
|
|
||||||
LL | const B: u8 = Self::A + 1;
|
|
||||||
| ----------- ^^^^^^^^^^^ attempt to compute `u8::MAX + 1_u8`, which would overflow
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
= note: `#[deny(const_err)]` on by default
|
|
||||||
|
|
||||||
Future breakage diagnostic:
|
|
||||||
error: erroneous constant used
|
|
||||||
--> $DIR/defaults-not-assumed-fail.rs:34:5
|
|
||||||
|
|
|
||||||
LL | assert_eq!(<() as Tr>::B, 0); // causes the error above
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
= note: `#[deny(const_err)]` on by default
|
|
||||||
= note: this error originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info)
|
|
||||||
|
|
||||||
|
|
|
@ -2,8 +2,7 @@
|
||||||
// The `panic!()` below is important to trigger the fixed ICE.
|
// The `panic!()` below is important to trigger the fixed ICE.
|
||||||
|
|
||||||
const _CONST: &[u8] = &f(&[], |_| {});
|
const _CONST: &[u8] = &f(&[], |_| {});
|
||||||
//~^ ERROR any use of this value
|
//~^ ERROR constant
|
||||||
//~| WARNING this was previously
|
|
||||||
|
|
||||||
const fn f<F>(_: &[u8], _: F) -> &[u8]
|
const fn f<F>(_: &[u8], _: F) -> &[u8]
|
||||||
where
|
where
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
error[E0080]: evaluation of constant value failed
|
error[E0080]: evaluation of constant value failed
|
||||||
--> $DIR/issue-81899.rs:12:5
|
--> $DIR/issue-81899.rs:11:5
|
||||||
|
|
|
|
||||||
LL | const _CONST: &[u8] = &f(&[], |_| {});
|
LL | const _CONST: &[u8] = &f(&[], |_| {});
|
||||||
| -------------- inside `_CONST` at $DIR/issue-81899.rs:4:24
|
| -------------- inside `_CONST` at $DIR/issue-81899.rs:4:24
|
||||||
|
@ -7,32 +7,17 @@ LL | const _CONST: &[u8] = &f(&[], |_| {});
|
||||||
LL | panic!()
|
LL | panic!()
|
||||||
| ^^^^^^^^
|
| ^^^^^^^^
|
||||||
| |
|
| |
|
||||||
| the evaluated program panicked at 'explicit panic', $DIR/issue-81899.rs:12:5
|
| the evaluated program panicked at 'explicit panic', $DIR/issue-81899.rs:11:5
|
||||||
| inside `f::<[closure@$DIR/issue-81899.rs:4:31: 4:34]>` at $SRC_DIR/std/src/panic.rs:LL:COL
|
| inside `f::<[closure@$DIR/issue-81899.rs:4:31: 4:34]>` at $SRC_DIR/std/src/panic.rs:LL:COL
|
||||||
|
|
|
|
||||||
= note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
|
= note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
|
||||||
error: any use of this value will cause an error
|
error[E0080]: evaluation of constant value failed
|
||||||
--> $DIR/issue-81899.rs:4:23
|
--> $DIR/issue-81899.rs:4:23
|
||||||
|
|
|
|
||||||
LL | const _CONST: &[u8] = &f(&[], |_| {});
|
LL | const _CONST: &[u8] = &f(&[], |_| {});
|
||||||
| ------------------- ^^^^^^^^^^^^^^^ referenced constant has errors
|
| ^^^^^^^^^^^^^^^ referenced constant has errors
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
= note: `#[deny(const_err)]` on by default
|
|
||||||
|
|
||||||
error: aborting due to 2 previous errors
|
error: aborting due to 2 previous errors
|
||||||
|
|
||||||
For more information about this error, try `rustc --explain E0080`.
|
For more information about this error, try `rustc --explain E0080`.
|
||||||
Future incompatibility report: Future breakage diagnostic:
|
|
||||||
error: any use of this value will cause an error
|
|
||||||
--> $DIR/issue-81899.rs:4:23
|
|
||||||
|
|
|
||||||
LL | const _CONST: &[u8] = &f(&[], |_| {});
|
|
||||||
| ------------------- ^^^^^^^^^^^^^^^ referenced constant has errors
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
= note: `#[deny(const_err)]` on by default
|
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
// Regression test related to issue 88434
|
// Regression test related to issue 88434
|
||||||
|
|
||||||
const _CONST: &() = &f(&|_| {});
|
const _CONST: &() = &f(&|_| {});
|
||||||
//~^ ERROR any use of this value
|
//~^ ERROR constant
|
||||||
//~| WARNING this was previously
|
|
||||||
|
|
||||||
const fn f<F>(_: &F)
|
const fn f<F>(_: &F)
|
||||||
where
|
where
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
error[E0080]: evaluation of constant value failed
|
error[E0080]: evaluation of constant value failed
|
||||||
--> $DIR/issue-88434-minimal-example.rs:11:5
|
--> $DIR/issue-88434-minimal-example.rs:10:5
|
||||||
|
|
|
|
||||||
LL | const _CONST: &() = &f(&|_| {});
|
LL | const _CONST: &() = &f(&|_| {});
|
||||||
| ---------- inside `_CONST` at $DIR/issue-88434-minimal-example.rs:3:22
|
| ---------- inside `_CONST` at $DIR/issue-88434-minimal-example.rs:3:22
|
||||||
|
@ -7,32 +7,17 @@ LL | const _CONST: &() = &f(&|_| {});
|
||||||
LL | panic!()
|
LL | panic!()
|
||||||
| ^^^^^^^^
|
| ^^^^^^^^
|
||||||
| |
|
| |
|
||||||
| the evaluated program panicked at 'explicit panic', $DIR/issue-88434-minimal-example.rs:11:5
|
| the evaluated program panicked at 'explicit panic', $DIR/issue-88434-minimal-example.rs:10:5
|
||||||
| inside `f::<[closure@$DIR/issue-88434-minimal-example.rs:3:25: 3:28]>` at $SRC_DIR/std/src/panic.rs:LL:COL
|
| inside `f::<[closure@$DIR/issue-88434-minimal-example.rs:3:25: 3:28]>` at $SRC_DIR/std/src/panic.rs:LL:COL
|
||||||
|
|
|
|
||||||
= note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
|
= note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
|
||||||
error: any use of this value will cause an error
|
error[E0080]: evaluation of constant value failed
|
||||||
--> $DIR/issue-88434-minimal-example.rs:3:21
|
--> $DIR/issue-88434-minimal-example.rs:3:21
|
||||||
|
|
|
|
||||||
LL | const _CONST: &() = &f(&|_| {});
|
LL | const _CONST: &() = &f(&|_| {});
|
||||||
| ----------------- ^^^^^^^^^^^ referenced constant has errors
|
| ^^^^^^^^^^^ referenced constant has errors
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
= note: `#[deny(const_err)]` on by default
|
|
||||||
|
|
||||||
error: aborting due to 2 previous errors
|
error: aborting due to 2 previous errors
|
||||||
|
|
||||||
For more information about this error, try `rustc --explain E0080`.
|
For more information about this error, try `rustc --explain E0080`.
|
||||||
Future incompatibility report: Future breakage diagnostic:
|
|
||||||
error: any use of this value will cause an error
|
|
||||||
--> $DIR/issue-88434-minimal-example.rs:3:21
|
|
||||||
|
|
|
||||||
LL | const _CONST: &() = &f(&|_| {});
|
|
||||||
| ----------------- ^^^^^^^^^^^ referenced constant has errors
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
= note: `#[deny(const_err)]` on by default
|
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
// Regression test for issue 88434
|
// Regression test for issue 88434
|
||||||
|
|
||||||
const _CONST: &[u8] = &f(&[], |_| {});
|
const _CONST: &[u8] = &f(&[], |_| {});
|
||||||
//~^ ERROR any use of this value will cause an error
|
//~^ ERROR constant
|
||||||
//~| WARNING this was previously
|
|
||||||
|
|
||||||
const fn f<F>(_: &[u8], _: F) -> &[u8]
|
const fn f<F>(_: &[u8], _: F) -> &[u8]
|
||||||
where
|
where
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
error[E0080]: evaluation of constant value failed
|
error[E0080]: evaluation of constant value failed
|
||||||
--> $DIR/issue-88434-removal-index-should-be-less.rs:11:5
|
--> $DIR/issue-88434-removal-index-should-be-less.rs:10:5
|
||||||
|
|
|
|
||||||
LL | const _CONST: &[u8] = &f(&[], |_| {});
|
LL | const _CONST: &[u8] = &f(&[], |_| {});
|
||||||
| -------------- inside `_CONST` at $DIR/issue-88434-removal-index-should-be-less.rs:3:24
|
| -------------- inside `_CONST` at $DIR/issue-88434-removal-index-should-be-less.rs:3:24
|
||||||
|
@ -7,32 +7,17 @@ LL | const _CONST: &[u8] = &f(&[], |_| {});
|
||||||
LL | panic!()
|
LL | panic!()
|
||||||
| ^^^^^^^^
|
| ^^^^^^^^
|
||||||
| |
|
| |
|
||||||
| the evaluated program panicked at 'explicit panic', $DIR/issue-88434-removal-index-should-be-less.rs:11:5
|
| the evaluated program panicked at 'explicit panic', $DIR/issue-88434-removal-index-should-be-less.rs:10:5
|
||||||
| inside `f::<[closure@$DIR/issue-88434-removal-index-should-be-less.rs:3:31: 3:34]>` at $SRC_DIR/std/src/panic.rs:LL:COL
|
| inside `f::<[closure@$DIR/issue-88434-removal-index-should-be-less.rs:3:31: 3:34]>` at $SRC_DIR/std/src/panic.rs:LL:COL
|
||||||
|
|
|
|
||||||
= note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
|
= note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
|
||||||
error: any use of this value will cause an error
|
error[E0080]: evaluation of constant value failed
|
||||||
--> $DIR/issue-88434-removal-index-should-be-less.rs:3:23
|
--> $DIR/issue-88434-removal-index-should-be-less.rs:3:23
|
||||||
|
|
|
|
||||||
LL | const _CONST: &[u8] = &f(&[], |_| {});
|
LL | const _CONST: &[u8] = &f(&[], |_| {});
|
||||||
| ------------------- ^^^^^^^^^^^^^^^ referenced constant has errors
|
| ^^^^^^^^^^^^^^^ referenced constant has errors
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
= note: `#[deny(const_err)]` on by default
|
|
||||||
|
|
||||||
error: aborting due to 2 previous errors
|
error: aborting due to 2 previous errors
|
||||||
|
|
||||||
For more information about this error, try `rustc --explain E0080`.
|
For more information about this error, try `rustc --explain E0080`.
|
||||||
Future incompatibility report: Future breakage diagnostic:
|
|
||||||
error: any use of this value will cause an error
|
|
||||||
--> $DIR/issue-88434-removal-index-should-be-less.rs:3:23
|
|
||||||
|
|
|
||||||
LL | const _CONST: &[u8] = &f(&[], |_| {});
|
|
||||||
| ------------------- ^^^^^^^^^^^^^^^ referenced constant has errors
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
= note: `#[deny(const_err)]` on by default
|
|
||||||
|
|
||||||
|
|
|
@ -159,11 +159,7 @@ fn main()
|
||||||
assert!(foo as usize != bar as usize);
|
assert!(foo as usize != bar as usize);
|
||||||
|
|
||||||
// Taking a few bits of a function's address is totally pointless and we detect that
|
// Taking a few bits of a function's address is totally pointless and we detect that
|
||||||
// Disabling the lint to ensure that the assertion can still be run
|
assert_eq!(foo as i16, foo as usize as i16);
|
||||||
#[allow(const_err)]
|
|
||||||
{
|
|
||||||
assert_eq!(foo as i16, foo as usize as i16);
|
|
||||||
}
|
|
||||||
|
|
||||||
// fptr-ptr-cast
|
// fptr-ptr-cast
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
// build-pass (FIXME(62277): could be check-pass?)
|
// build-pass (FIXME(62277): could be check-pass?)
|
||||||
|
|
||||||
#![allow(const_err)]
|
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let x: &'static _ = &|| { let z = 3; z };
|
let x: &'static _ = &|| { let z = 3; z };
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// build-pass
|
// build-pass
|
||||||
// ignore-pass (test emits codegen-time warnings and verifies that they are not errors)
|
// ignore-pass (test emits codegen-time warnings and verifies that they are not errors)
|
||||||
|
|
||||||
#![warn(const_err, unconditional_panic)]
|
#![warn(unconditional_panic)]
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
&{ [1, 2, 3][4] };
|
&{ [1, 2, 3][4] };
|
||||||
|
|
|
@ -5,10 +5,10 @@ LL | &{ [1, 2, 3][4] };
|
||||||
| ^^^^^^^^^^^^ index out of bounds: the length is 3 but the index is 4
|
| ^^^^^^^^^^^^ index out of bounds: the length is 3 but the index is 4
|
||||||
|
|
|
|
||||||
note: the lint level is defined here
|
note: the lint level is defined here
|
||||||
--> $DIR/array-literal-index-oob.rs:4:20
|
--> $DIR/array-literal-index-oob.rs:4:9
|
||||||
|
|
|
|
||||||
LL | #![warn(const_err, unconditional_panic)]
|
LL | #![warn(unconditional_panic)]
|
||||||
| ^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
warning: 1 warning emitted
|
warning: 1 warning emitted
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
// error-pattern: any use of this value will cause an error
|
|
||||||
|
|
||||||
#![feature(never_type)]
|
#![feature(never_type)]
|
||||||
#![feature(const_assert_type2)]
|
#![feature(const_assert_type2)]
|
||||||
#![feature(core_intrinsics)]
|
#![feature(core_intrinsics)]
|
||||||
|
@ -11,15 +9,15 @@ fn main() {
|
||||||
use std::mem::MaybeUninit;
|
use std::mem::MaybeUninit;
|
||||||
|
|
||||||
const _BAD1: () = unsafe {
|
const _BAD1: () = unsafe {
|
||||||
intrinsics::assert_inhabited::<!>(); //~ERROR: any use of this value will cause an error
|
MaybeUninit::<!>::uninit().assume_init();
|
||||||
//~^WARN: previously accepted
|
//~^ERROR: evaluation of constant value failed
|
||||||
};
|
};
|
||||||
const _BAD2: () = {
|
const _BAD2: () = {
|
||||||
intrinsics::assert_uninit_valid::<!>(); //~ERROR: any use of this value will cause an error
|
intrinsics::assert_uninit_valid::<&'static i32>();
|
||||||
//~^WARN: previously accepted
|
//~^ERROR: evaluation of constant value failed
|
||||||
};
|
};
|
||||||
const _BAD3: () = {
|
const _BAD3: () = {
|
||||||
intrinsics::assert_zero_valid::<&'static i32>(); //~ERROR: any use of this value will cause an error
|
intrinsics::assert_zero_valid::<&'static i32>();
|
||||||
//~^WARN: previously accepted
|
//~^ERROR: evaluation of constant value failed
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,75 +1,21 @@
|
||||||
error: any use of this value will cause an error
|
error[E0080]: evaluation of constant value failed
|
||||||
--> $DIR/assert-type-intrinsics.rs:14:9
|
--> $DIR/assert-type-intrinsics.rs:12:9
|
||||||
|
|
|
|
||||||
LL | const _BAD1: () = unsafe {
|
LL | MaybeUninit::<!>::uninit().assume_init();
|
||||||
| ---------------
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ aborted execution: attempted to instantiate uninhabited type `!`
|
||||||
LL | intrinsics::assert_inhabited::<!>();
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ aborted execution: attempted to instantiate uninhabited type `!`
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
= note: `#[deny(const_err)]` on by default
|
|
||||||
|
|
||||||
error: any use of this value will cause an error
|
error[E0080]: evaluation of constant value failed
|
||||||
--> $DIR/assert-type-intrinsics.rs:18:9
|
--> $DIR/assert-type-intrinsics.rs:16:9
|
||||||
|
|
|
|
||||||
LL | const _BAD2: () = {
|
LL | intrinsics::assert_uninit_valid::<&'static i32>();
|
||||||
| ---------------
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ aborted execution: attempted to leave type `&i32` uninitialized, which is invalid
|
||||||
LL | intrinsics::assert_uninit_valid::<!>();
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ aborted execution: attempted to instantiate uninhabited type `!`
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
|
|
||||||
error: any use of this value will cause an error
|
error[E0080]: evaluation of constant value failed
|
||||||
--> $DIR/assert-type-intrinsics.rs:22:9
|
--> $DIR/assert-type-intrinsics.rs:20:9
|
||||||
|
|
|
|
||||||
LL | const _BAD3: () = {
|
|
||||||
| ---------------
|
|
||||||
LL | intrinsics::assert_zero_valid::<&'static i32>();
|
LL | intrinsics::assert_zero_valid::<&'static i32>();
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ aborted execution: attempted to zero-initialize type `&i32`, which is invalid
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ aborted execution: attempted to zero-initialize type `&i32`, which is invalid
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
|
|
||||||
error: aborting due to 3 previous errors
|
error: aborting due to 3 previous errors
|
||||||
|
|
||||||
Future incompatibility report: Future breakage diagnostic:
|
For more information about this error, try `rustc --explain E0080`.
|
||||||
error: any use of this value will cause an error
|
|
||||||
--> $DIR/assert-type-intrinsics.rs:14:9
|
|
||||||
|
|
|
||||||
LL | const _BAD1: () = unsafe {
|
|
||||||
| ---------------
|
|
||||||
LL | intrinsics::assert_inhabited::<!>();
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ aborted execution: attempted to instantiate uninhabited type `!`
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
= note: `#[deny(const_err)]` on by default
|
|
||||||
|
|
||||||
Future breakage diagnostic:
|
|
||||||
error: any use of this value will cause an error
|
|
||||||
--> $DIR/assert-type-intrinsics.rs:18:9
|
|
||||||
|
|
|
||||||
LL | const _BAD2: () = {
|
|
||||||
| ---------------
|
|
||||||
LL | intrinsics::assert_uninit_valid::<!>();
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ aborted execution: attempted to instantiate uninhabited type `!`
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
= note: `#[deny(const_err)]` on by default
|
|
||||||
|
|
||||||
Future breakage diagnostic:
|
|
||||||
error: any use of this value will cause an error
|
|
||||||
--> $DIR/assert-type-intrinsics.rs:22:9
|
|
||||||
|
|
|
||||||
LL | const _BAD3: () = {
|
|
||||||
| ---------------
|
|
||||||
LL | intrinsics::assert_zero_valid::<&'static i32>();
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ aborted execution: attempted to zero-initialize type `&i32`, which is invalid
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
= note: `#[deny(const_err)]` on by default
|
|
||||||
|
|
||||||
|
|
|
@ -1,17 +1,14 @@
|
||||||
// build-fail
|
// build-fail
|
||||||
|
|
||||||
#![warn(const_err)]
|
|
||||||
|
|
||||||
trait ZeroSized: Sized {
|
trait ZeroSized: Sized {
|
||||||
const I_AM_ZERO_SIZED: ();
|
const I_AM_ZERO_SIZED: ();
|
||||||
fn requires_zero_size(self);
|
fn requires_zero_size(self);
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T: Sized> ZeroSized for T {
|
impl<T: Sized> ZeroSized for T {
|
||||||
const I_AM_ZERO_SIZED: () = [()][std::mem::size_of::<Self>()]; //~ WARN any use of this value
|
const I_AM_ZERO_SIZED: () = [()][std::mem::size_of::<Self>()]; //~ ERROR evaluation of `<u32 as ZeroSized>::I_AM_ZERO_SIZED` failed
|
||||||
//~| WARN this was previously accepted by the compiler but is being phased out
|
|
||||||
fn requires_zero_size(self) {
|
fn requires_zero_size(self) {
|
||||||
let () = Self::I_AM_ZERO_SIZED; //~ ERROR erroneous constant encountered
|
let () = Self::I_AM_ZERO_SIZED;
|
||||||
println!("requires_zero_size called");
|
println!("requires_zero_size called");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,37 +1,15 @@
|
||||||
warning: any use of this value will cause an error
|
error[E0080]: evaluation of `<u32 as ZeroSized>::I_AM_ZERO_SIZED` failed
|
||||||
--> $DIR/assoc_const_generic_impl.rs:11:34
|
--> $DIR/assoc_const_generic_impl.rs:9:34
|
||||||
|
|
|
|
||||||
LL | const I_AM_ZERO_SIZED: () = [()][std::mem::size_of::<Self>()];
|
LL | const I_AM_ZERO_SIZED: () = [()][std::mem::size_of::<Self>()];
|
||||||
| ------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ index out of bounds: the length is 1 but the index is 4
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ index out of bounds: the length is 1 but the index is 4
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
note: the lint level is defined here
|
|
||||||
--> $DIR/assoc_const_generic_impl.rs:3:9
|
|
||||||
|
|
|
||||||
LL | #![warn(const_err)]
|
|
||||||
| ^^^^^^^^^
|
|
||||||
|
|
||||||
error: erroneous constant encountered
|
note: the above error was encountered while instantiating `fn <u32 as ZeroSized>::requires_zero_size`
|
||||||
--> $DIR/assoc_const_generic_impl.rs:14:18
|
--> $DIR/assoc_const_generic_impl.rs:18:5
|
||||||
|
|
|
|
||||||
LL | let () = Self::I_AM_ZERO_SIZED;
|
LL | 42_u32.requires_zero_size();
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: aborting due to previous error; 1 warning emitted
|
error: aborting due to previous error
|
||||||
|
|
||||||
Future incompatibility report: Future breakage diagnostic:
|
|
||||||
warning: any use of this value will cause an error
|
|
||||||
--> $DIR/assoc_const_generic_impl.rs:11:34
|
|
||||||
|
|
|
||||||
LL | const I_AM_ZERO_SIZED: () = [()][std::mem::size_of::<Self>()];
|
|
||||||
| ------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ index out of bounds: the length is 1 but the index is 4
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
note: the lint level is defined here
|
|
||||||
--> $DIR/assoc_const_generic_impl.rs:3:9
|
|
||||||
|
|
|
||||||
LL | #![warn(const_err)]
|
|
||||||
| ^^^^^^^^^
|
|
||||||
|
|
||||||
|
For more information about this error, try `rustc --explain E0080`.
|
||||||
|
|
|
@ -1,15 +1,8 @@
|
||||||
#![deny(const_err)]
|
pub const A: i8 = -i8::MIN; //~ ERROR constant
|
||||||
|
pub const B: u8 = 200u8 + 200u8; //~ ERROR constant
|
||||||
pub const A: i8 = -i8::MIN; //~ ERROR const_err
|
pub const C: u8 = 200u8 * 4; //~ ERROR constant
|
||||||
//~| WARN this was previously accepted by the compiler but is being phased out
|
pub const D: u8 = 42u8 - (42u8 + 1); //~ ERROR constant
|
||||||
pub const B: u8 = 200u8 + 200u8; //~ ERROR const_err
|
pub const E: u8 = [5u8][1]; //~ ERROR constant
|
||||||
//~| WARN this was previously accepted by the compiler but is being phased out
|
|
||||||
pub const C: u8 = 200u8 * 4; //~ ERROR const_err
|
|
||||||
//~| WARN this was previously accepted by the compiler but is being phased out
|
|
||||||
pub const D: u8 = 42u8 - (42u8 + 1); //~ ERROR const_err
|
|
||||||
//~| WARN this was previously accepted by the compiler but is being phased out
|
|
||||||
pub const E: u8 = [5u8][1]; //~ ERROR const_err
|
|
||||||
//~| WARN this was previously accepted by the compiler but is being phased out
|
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let _a = A;
|
let _a = A;
|
||||||
|
|
|
@ -1,127 +1,33 @@
|
||||||
error: any use of this value will cause an error
|
error[E0080]: evaluation of constant value failed
|
||||||
--> $DIR/const-err-early.rs:3:19
|
--> $DIR/const-err-early.rs:1:19
|
||||||
|
|
|
|
||||||
LL | pub const A: i8 = -i8::MIN;
|
LL | pub const A: i8 = -i8::MIN;
|
||||||
| --------------- ^^^^^^^^ attempt to negate `i8::MIN`, which would overflow
|
| ^^^^^^^^ attempt to negate `i8::MIN`, which would overflow
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
note: the lint level is defined here
|
|
||||||
--> $DIR/const-err-early.rs:1:9
|
|
||||||
|
|
|
||||||
LL | #![deny(const_err)]
|
|
||||||
| ^^^^^^^^^
|
|
||||||
|
|
||||||
error: any use of this value will cause an error
|
error[E0080]: evaluation of constant value failed
|
||||||
--> $DIR/const-err-early.rs:5:19
|
--> $DIR/const-err-early.rs:2:19
|
||||||
|
|
|
|
||||||
LL | pub const B: u8 = 200u8 + 200u8;
|
LL | pub const B: u8 = 200u8 + 200u8;
|
||||||
| --------------- ^^^^^^^^^^^^^ attempt to compute `200_u8 + 200_u8`, which would overflow
|
| ^^^^^^^^^^^^^ attempt to compute `200_u8 + 200_u8`, which would overflow
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
|
|
||||||
error: any use of this value will cause an error
|
error[E0080]: evaluation of constant value failed
|
||||||
--> $DIR/const-err-early.rs:7:19
|
--> $DIR/const-err-early.rs:3:19
|
||||||
|
|
|
|
||||||
LL | pub const C: u8 = 200u8 * 4;
|
LL | pub const C: u8 = 200u8 * 4;
|
||||||
| --------------- ^^^^^^^^^ attempt to compute `200_u8 * 4_u8`, which would overflow
|
| ^^^^^^^^^ attempt to compute `200_u8 * 4_u8`, which would overflow
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
|
|
||||||
error: any use of this value will cause an error
|
error[E0080]: evaluation of constant value failed
|
||||||
--> $DIR/const-err-early.rs:9:19
|
--> $DIR/const-err-early.rs:4:19
|
||||||
|
|
|
|
||||||
LL | pub const D: u8 = 42u8 - (42u8 + 1);
|
LL | pub const D: u8 = 42u8 - (42u8 + 1);
|
||||||
| --------------- ^^^^^^^^^^^^^^^^^ attempt to compute `42_u8 - 43_u8`, which would overflow
|
| ^^^^^^^^^^^^^^^^^ attempt to compute `42_u8 - 43_u8`, which would overflow
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
|
|
||||||
error: any use of this value will cause an error
|
error[E0080]: evaluation of constant value failed
|
||||||
--> $DIR/const-err-early.rs:11:19
|
--> $DIR/const-err-early.rs:5:19
|
||||||
|
|
|
|
||||||
LL | pub const E: u8 = [5u8][1];
|
LL | pub const E: u8 = [5u8][1];
|
||||||
| --------------- ^^^^^^^^ index out of bounds: the length is 1 but the index is 1
|
| ^^^^^^^^ index out of bounds: the length is 1 but the index is 1
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
|
|
||||||
error: aborting due to 5 previous errors
|
error: aborting due to 5 previous errors
|
||||||
|
|
||||||
Future incompatibility report: Future breakage diagnostic:
|
For more information about this error, try `rustc --explain E0080`.
|
||||||
error: any use of this value will cause an error
|
|
||||||
--> $DIR/const-err-early.rs:3:19
|
|
||||||
|
|
|
||||||
LL | pub const A: i8 = -i8::MIN;
|
|
||||||
| --------------- ^^^^^^^^ attempt to negate `i8::MIN`, which would overflow
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
note: the lint level is defined here
|
|
||||||
--> $DIR/const-err-early.rs:1:9
|
|
||||||
|
|
|
||||||
LL | #![deny(const_err)]
|
|
||||||
| ^^^^^^^^^
|
|
||||||
|
|
||||||
Future breakage diagnostic:
|
|
||||||
error: any use of this value will cause an error
|
|
||||||
--> $DIR/const-err-early.rs:5:19
|
|
||||||
|
|
|
||||||
LL | pub const B: u8 = 200u8 + 200u8;
|
|
||||||
| --------------- ^^^^^^^^^^^^^ attempt to compute `200_u8 + 200_u8`, which would overflow
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
note: the lint level is defined here
|
|
||||||
--> $DIR/const-err-early.rs:1:9
|
|
||||||
|
|
|
||||||
LL | #![deny(const_err)]
|
|
||||||
| ^^^^^^^^^
|
|
||||||
|
|
||||||
Future breakage diagnostic:
|
|
||||||
error: any use of this value will cause an error
|
|
||||||
--> $DIR/const-err-early.rs:7:19
|
|
||||||
|
|
|
||||||
LL | pub const C: u8 = 200u8 * 4;
|
|
||||||
| --------------- ^^^^^^^^^ attempt to compute `200_u8 * 4_u8`, which would overflow
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
note: the lint level is defined here
|
|
||||||
--> $DIR/const-err-early.rs:1:9
|
|
||||||
|
|
|
||||||
LL | #![deny(const_err)]
|
|
||||||
| ^^^^^^^^^
|
|
||||||
|
|
||||||
Future breakage diagnostic:
|
|
||||||
error: any use of this value will cause an error
|
|
||||||
--> $DIR/const-err-early.rs:9:19
|
|
||||||
|
|
|
||||||
LL | pub const D: u8 = 42u8 - (42u8 + 1);
|
|
||||||
| --------------- ^^^^^^^^^^^^^^^^^ attempt to compute `42_u8 - 43_u8`, which would overflow
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
note: the lint level is defined here
|
|
||||||
--> $DIR/const-err-early.rs:1:9
|
|
||||||
|
|
|
||||||
LL | #![deny(const_err)]
|
|
||||||
| ^^^^^^^^^
|
|
||||||
|
|
||||||
Future breakage diagnostic:
|
|
||||||
error: any use of this value will cause an error
|
|
||||||
--> $DIR/const-err-early.rs:11:19
|
|
||||||
|
|
|
||||||
LL | pub const E: u8 = [5u8][1];
|
|
||||||
| --------------- ^^^^^^^^ index out of bounds: the length is 1 but the index is 1
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
note: the lint level is defined here
|
|
||||||
--> $DIR/const-err-early.rs:1:9
|
|
||||||
|
|
|
||||||
LL | #![deny(const_err)]
|
|
||||||
| ^^^^^^^^^
|
|
||||||
|
|
||||||
|
|
22
src/test/ui/consts/const-err-late.rs
Normal file
22
src/test/ui/consts/const-err-late.rs
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
// build-fail
|
||||||
|
// compile-flags: -C overflow-checks=on
|
||||||
|
|
||||||
|
#![allow(arithmetic_overflow, unconditional_panic)]
|
||||||
|
|
||||||
|
fn black_box<T>(_: T) {
|
||||||
|
unimplemented!()
|
||||||
|
}
|
||||||
|
|
||||||
|
struct S<T>(T);
|
||||||
|
|
||||||
|
impl<T> S<T> {
|
||||||
|
const FOO: u8 = [5u8][1];
|
||||||
|
//~^ ERROR evaluation of `S::<i32>::FOO` failed
|
||||||
|
//~| ERROR evaluation of `S::<u32>::FOO` failed
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
black_box((S::<i32>::FOO, S::<u32>::FOO));
|
||||||
|
//~^ ERROR erroneous constant
|
||||||
|
//~| ERROR erroneous constant
|
||||||
|
}
|
27
src/test/ui/consts/const-err-late.stderr
Normal file
27
src/test/ui/consts/const-err-late.stderr
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
error[E0080]: evaluation of `S::<i32>::FOO` failed
|
||||||
|
--> $DIR/const-err-late.rs:13:21
|
||||||
|
|
|
||||||
|
LL | const FOO: u8 = [5u8][1];
|
||||||
|
| ^^^^^^^^ index out of bounds: the length is 1 but the index is 1
|
||||||
|
|
||||||
|
error[E0080]: erroneous constant used
|
||||||
|
--> $DIR/const-err-late.rs:19:16
|
||||||
|
|
|
||||||
|
LL | black_box((S::<i32>::FOO, S::<u32>::FOO));
|
||||||
|
| ^^^^^^^^^^^^^ referenced constant has errors
|
||||||
|
|
||||||
|
error[E0080]: evaluation of `S::<u32>::FOO` failed
|
||||||
|
--> $DIR/const-err-late.rs:13:21
|
||||||
|
|
|
||||||
|
LL | const FOO: u8 = [5u8][1];
|
||||||
|
| ^^^^^^^^ index out of bounds: the length is 1 but the index is 1
|
||||||
|
|
||||||
|
error[E0080]: erroneous constant used
|
||||||
|
--> $DIR/const-err-late.rs:19:31
|
||||||
|
|
|
||||||
|
LL | black_box((S::<i32>::FOO, S::<u32>::FOO));
|
||||||
|
| ^^^^^^^^^^^^^ referenced constant has errors
|
||||||
|
|
||||||
|
error: aborting due to 4 previous errors
|
||||||
|
|
||||||
|
For more information about this error, try `rustc --explain E0080`.
|
|
@ -1,17 +1,11 @@
|
||||||
#![deny(const_err)]
|
|
||||||
|
|
||||||
pub const A: i8 = -i8::MIN;
|
pub const A: i8 = -i8::MIN;
|
||||||
//~^ ERROR const_err
|
//~^ ERROR constant
|
||||||
//~| WARN this was previously accepted by the compiler but is being phased out
|
|
||||||
pub const B: i8 = A;
|
pub const B: i8 = A;
|
||||||
//~^ ERROR const_err
|
//~^ ERROR constant
|
||||||
//~| WARN this was previously accepted by the compiler but is being phased out
|
|
||||||
pub const C: u8 = A as u8;
|
pub const C: u8 = A as u8;
|
||||||
//~^ ERROR const_err
|
//~^ ERROR constant
|
||||||
//~| WARN this was previously accepted by the compiler but is being phased out
|
|
||||||
pub const D: i8 = 50 - A;
|
pub const D: i8 = 50 - A;
|
||||||
//~^ ERROR const_err
|
//~^ ERROR constant
|
||||||
//~| WARN this was previously accepted by the compiler but is being phased out
|
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let _ = (A, B, C, D);
|
let _ = (A, B, C, D);
|
||||||
|
|
|
@ -1,103 +1,27 @@
|
||||||
error: any use of this value will cause an error
|
error[E0080]: evaluation of constant value failed
|
||||||
--> $DIR/const-err-multi.rs:3:19
|
--> $DIR/const-err-multi.rs:1:19
|
||||||
|
|
|
|
||||||
LL | pub const A: i8 = -i8::MIN;
|
LL | pub const A: i8 = -i8::MIN;
|
||||||
| --------------- ^^^^^^^^ attempt to negate `i8::MIN`, which would overflow
|
| ^^^^^^^^ attempt to negate `i8::MIN`, which would overflow
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
note: the lint level is defined here
|
|
||||||
--> $DIR/const-err-multi.rs:1:9
|
|
||||||
|
|
|
||||||
LL | #![deny(const_err)]
|
|
||||||
| ^^^^^^^^^
|
|
||||||
|
|
||||||
error: any use of this value will cause an error
|
error[E0080]: evaluation of constant value failed
|
||||||
--> $DIR/const-err-multi.rs:6:19
|
--> $DIR/const-err-multi.rs:3:19
|
||||||
|
|
|
|
||||||
LL | pub const B: i8 = A;
|
LL | pub const B: i8 = A;
|
||||||
| --------------- ^ referenced constant has errors
|
| ^ referenced constant has errors
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
|
|
||||||
error: any use of this value will cause an error
|
error[E0080]: evaluation of constant value failed
|
||||||
--> $DIR/const-err-multi.rs:9:19
|
--> $DIR/const-err-multi.rs:5:19
|
||||||
|
|
|
|
||||||
LL | pub const C: u8 = A as u8;
|
LL | pub const C: u8 = A as u8;
|
||||||
| --------------- ^ referenced constant has errors
|
| ^ referenced constant has errors
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
|
|
||||||
error: any use of this value will cause an error
|
error[E0080]: evaluation of constant value failed
|
||||||
--> $DIR/const-err-multi.rs:12:24
|
--> $DIR/const-err-multi.rs:7:24
|
||||||
|
|
|
|
||||||
LL | pub const D: i8 = 50 - A;
|
LL | pub const D: i8 = 50 - A;
|
||||||
| --------------- ^ referenced constant has errors
|
| ^ referenced constant has errors
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
|
|
||||||
error: aborting due to 4 previous errors
|
error: aborting due to 4 previous errors
|
||||||
|
|
||||||
Future incompatibility report: Future breakage diagnostic:
|
For more information about this error, try `rustc --explain E0080`.
|
||||||
error: any use of this value will cause an error
|
|
||||||
--> $DIR/const-err-multi.rs:3:19
|
|
||||||
|
|
|
||||||
LL | pub const A: i8 = -i8::MIN;
|
|
||||||
| --------------- ^^^^^^^^ attempt to negate `i8::MIN`, which would overflow
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
note: the lint level is defined here
|
|
||||||
--> $DIR/const-err-multi.rs:1:9
|
|
||||||
|
|
|
||||||
LL | #![deny(const_err)]
|
|
||||||
| ^^^^^^^^^
|
|
||||||
|
|
||||||
Future breakage diagnostic:
|
|
||||||
error: any use of this value will cause an error
|
|
||||||
--> $DIR/const-err-multi.rs:6:19
|
|
||||||
|
|
|
||||||
LL | pub const B: i8 = A;
|
|
||||||
| --------------- ^ referenced constant has errors
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
note: the lint level is defined here
|
|
||||||
--> $DIR/const-err-multi.rs:1:9
|
|
||||||
|
|
|
||||||
LL | #![deny(const_err)]
|
|
||||||
| ^^^^^^^^^
|
|
||||||
|
|
||||||
Future breakage diagnostic:
|
|
||||||
error: any use of this value will cause an error
|
|
||||||
--> $DIR/const-err-multi.rs:9:19
|
|
||||||
|
|
|
||||||
LL | pub const C: u8 = A as u8;
|
|
||||||
| --------------- ^ referenced constant has errors
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
note: the lint level is defined here
|
|
||||||
--> $DIR/const-err-multi.rs:1:9
|
|
||||||
|
|
|
||||||
LL | #![deny(const_err)]
|
|
||||||
| ^^^^^^^^^
|
|
||||||
|
|
||||||
Future breakage diagnostic:
|
|
||||||
error: any use of this value will cause an error
|
|
||||||
--> $DIR/const-err-multi.rs:12:24
|
|
||||||
|
|
|
||||||
LL | pub const D: i8 = 50 - A;
|
|
||||||
| --------------- ^ referenced constant has errors
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
note: the lint level is defined here
|
|
||||||
--> $DIR/const-err-multi.rs:1:9
|
|
||||||
|
|
|
||||||
LL | #![deny(const_err)]
|
|
||||||
| ^^^^^^^^^
|
|
||||||
|
|
||||||
|
|
|
@ -2,8 +2,6 @@
|
||||||
#![allow(dead_code)]
|
#![allow(dead_code)]
|
||||||
// check for const_err regressions
|
// check for const_err regressions
|
||||||
|
|
||||||
#![deny(const_err)]
|
|
||||||
|
|
||||||
const X: *const u8 = b"" as _;
|
const X: *const u8 = b"" as _;
|
||||||
const Y: bool = 'A' == 'B';
|
const Y: bool = 'A' == 'B';
|
||||||
const Z: char = 'A';
|
const Z: char = 'A';
|
||||||
|
|
|
@ -1,19 +0,0 @@
|
||||||
// build-fail
|
|
||||||
// compile-flags: -C overflow-checks=on
|
|
||||||
|
|
||||||
#![allow(arithmetic_overflow)]
|
|
||||||
#![warn(const_err)]
|
|
||||||
|
|
||||||
fn black_box<T>(_: T) {
|
|
||||||
unimplemented!()
|
|
||||||
}
|
|
||||||
|
|
||||||
const FOO: u8 = [5u8][1];
|
|
||||||
//~^ WARN any use of this value will cause an error
|
|
||||||
//~| WARN this was previously accepted by the compiler but is being phased out
|
|
||||||
|
|
||||||
fn main() {
|
|
||||||
black_box((FOO, FOO));
|
|
||||||
//~^ ERROR erroneous constant used
|
|
||||||
//~| ERROR erroneous constant
|
|
||||||
}
|
|
|
@ -1,44 +0,0 @@
|
||||||
warning: any use of this value will cause an error
|
|
||||||
--> $DIR/const-err.rs:11:17
|
|
||||||
|
|
|
||||||
LL | const FOO: u8 = [5u8][1];
|
|
||||||
| ------------- ^^^^^^^^ index out of bounds: the length is 1 but the index is 1
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
note: the lint level is defined here
|
|
||||||
--> $DIR/const-err.rs:5:9
|
|
||||||
|
|
|
||||||
LL | #![warn(const_err)]
|
|
||||||
| ^^^^^^^^^
|
|
||||||
|
|
||||||
error[E0080]: erroneous constant used
|
|
||||||
--> $DIR/const-err.rs:16:16
|
|
||||||
|
|
|
||||||
LL | black_box((FOO, FOO));
|
|
||||||
| ^^^ referenced constant has errors
|
|
||||||
|
|
||||||
error[E0080]: erroneous constant used
|
|
||||||
--> $DIR/const-err.rs:16:21
|
|
||||||
|
|
|
||||||
LL | black_box((FOO, FOO));
|
|
||||||
| ^^^ referenced constant has errors
|
|
||||||
|
|
||||||
error: aborting due to 2 previous errors; 1 warning emitted
|
|
||||||
|
|
||||||
For more information about this error, try `rustc --explain E0080`.
|
|
||||||
Future incompatibility report: Future breakage diagnostic:
|
|
||||||
warning: any use of this value will cause an error
|
|
||||||
--> $DIR/const-err.rs:11:17
|
|
||||||
|
|
|
||||||
LL | const FOO: u8 = [5u8][1];
|
|
||||||
| ------------- ^^^^^^^^ index out of bounds: the length is 1 but the index is 1
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
note: the lint level is defined here
|
|
||||||
--> $DIR/const-err.rs:5:9
|
|
||||||
|
|
|
||||||
LL | #![warn(const_err)]
|
|
||||||
| ^^^^^^^^^
|
|
||||||
|
|
|
@ -1,16 +1,8 @@
|
||||||
// build-fail
|
|
||||||
|
|
||||||
#![warn(const_err)]
|
|
||||||
|
|
||||||
const X: u32 = 5;
|
const X: u32 = 5;
|
||||||
const Y: u32 = 6;
|
const Y: u32 = 6;
|
||||||
const FOO: u32 = [X - Y, Y - X][(X < Y) as usize];
|
const FOO: u32 = [X - Y, Y - X][(X < Y) as usize];
|
||||||
//~^ WARN any use of this value will cause an error
|
//~^ ERROR constant
|
||||||
//~| WARN this was previously accepted by the compiler but is being phased out
|
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
println!("{}", FOO);
|
println!("{}", FOO);
|
||||||
//~^ ERROR evaluation of constant value failed
|
|
||||||
//~| WARN erroneous constant used [const_err]
|
|
||||||
//~| WARN this was previously accepted by the compiler but is being phased out
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,64 +1,9 @@
|
||||||
warning: any use of this value will cause an error
|
error[E0080]: evaluation of constant value failed
|
||||||
--> $DIR/conditional_array_execution.rs:7:19
|
--> $DIR/conditional_array_execution.rs:3:19
|
||||||
|
|
|
|
||||||
LL | const FOO: u32 = [X - Y, Y - X][(X < Y) as usize];
|
LL | const FOO: u32 = [X - Y, Y - X][(X < Y) as usize];
|
||||||
| -------------- ^^^^^ attempt to compute `5_u32 - 6_u32`, which would overflow
|
| ^^^^^ attempt to compute `5_u32 - 6_u32`, which would overflow
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
note: the lint level is defined here
|
|
||||||
--> $DIR/conditional_array_execution.rs:3:9
|
|
||||||
|
|
|
||||||
LL | #![warn(const_err)]
|
|
||||||
| ^^^^^^^^^
|
|
||||||
|
|
||||||
error[E0080]: evaluation of constant value failed
|
error: aborting due to previous error
|
||||||
--> $DIR/conditional_array_execution.rs:12:20
|
|
||||||
|
|
|
||||||
LL | println!("{}", FOO);
|
|
||||||
| ^^^ referenced constant has errors
|
|
||||||
|
|
||||||
warning: erroneous constant used
|
|
||||||
--> $DIR/conditional_array_execution.rs:12:20
|
|
||||||
|
|
|
||||||
LL | println!("{}", FOO);
|
|
||||||
| ^^^ referenced constant has errors
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
= note: this warning originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)
|
|
||||||
|
|
||||||
error: aborting due to previous error; 2 warnings emitted
|
|
||||||
|
|
||||||
For more information about this error, try `rustc --explain E0080`.
|
For more information about this error, try `rustc --explain E0080`.
|
||||||
Future incompatibility report: Future breakage diagnostic:
|
|
||||||
warning: any use of this value will cause an error
|
|
||||||
--> $DIR/conditional_array_execution.rs:7:19
|
|
||||||
|
|
|
||||||
LL | const FOO: u32 = [X - Y, Y - X][(X < Y) as usize];
|
|
||||||
| -------------- ^^^^^ attempt to compute `5_u32 - 6_u32`, which would overflow
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
note: the lint level is defined here
|
|
||||||
--> $DIR/conditional_array_execution.rs:3:9
|
|
||||||
|
|
|
||||||
LL | #![warn(const_err)]
|
|
||||||
| ^^^^^^^^^
|
|
||||||
|
|
||||||
Future breakage diagnostic:
|
|
||||||
warning: erroneous constant used
|
|
||||||
--> $DIR/conditional_array_execution.rs:12:20
|
|
||||||
|
|
|
||||||
LL | println!("{}", FOO);
|
|
||||||
| ^^^ referenced constant has errors
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
note: the lint level is defined here
|
|
||||||
--> $DIR/conditional_array_execution.rs:3:9
|
|
||||||
|
|
|
||||||
LL | #![warn(const_err)]
|
|
||||||
| ^^^^^^^^^
|
|
||||||
= note: this warning originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)
|
|
||||||
|
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
// Evaluation of constants in refutable patterns goes through
|
// Evaluation of constants in refutable patterns goes through
|
||||||
// different compiler control-flow paths.
|
// different compiler control-flow paths.
|
||||||
|
|
||||||
#![allow(unused_imports, warnings, const_err)]
|
#![allow(unused_imports, warnings)]
|
||||||
|
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::{i8, i16, i32, i64, isize};
|
use std::{i8, i16, i32, i64, isize};
|
||||||
use std::{u8, u16, u32, u64, usize};
|
use std::{u8, u16, u32, u64, usize};
|
||||||
|
|
||||||
const NEG_128: i8 = -128;
|
const NEG_128: i8 = -128;
|
||||||
const NEG_NEG_128: i8 = -NEG_128;
|
const NEG_NEG_128: i8 = -NEG_128; //~ ERROR constant
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
match -128i8 {
|
match -128i8 {
|
||||||
|
|
|
@ -1,29 +1,21 @@
|
||||||
error: could not evaluate constant pattern
|
error[E0080]: evaluation of constant value failed
|
||||||
--> $DIR/const-eval-overflow-2.rs:15:9
|
|
||||||
|
|
|
||||||
LL | NEG_NEG_128 => println!("A"),
|
|
||||||
| ^^^^^^^^^^^
|
|
||||||
|
|
||||||
error: could not evaluate constant pattern
|
|
||||||
--> $DIR/const-eval-overflow-2.rs:15:9
|
|
||||||
|
|
|
||||||
LL | NEG_NEG_128 => println!("A"),
|
|
||||||
| ^^^^^^^^^^^
|
|
||||||
|
|
||||||
error: aborting due to 2 previous errors
|
|
||||||
|
|
||||||
Future incompatibility report: Future breakage diagnostic:
|
|
||||||
warning: any use of this value will cause an error
|
|
||||||
--> $DIR/const-eval-overflow-2.rs:11:25
|
--> $DIR/const-eval-overflow-2.rs:11:25
|
||||||
|
|
|
|
||||||
LL | const NEG_NEG_128: i8 = -NEG_128;
|
LL | const NEG_NEG_128: i8 = -NEG_128;
|
||||||
| --------------------- ^^^^^^^^ attempt to negate `i8::MIN`, which would overflow
|
| ^^^^^^^^ attempt to negate `i8::MIN`, which would overflow
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
note: the lint level is defined here
|
|
||||||
--> $DIR/const-eval-overflow-2.rs:4:36
|
|
||||||
|
|
|
||||||
LL | #![allow(unused_imports, warnings, const_err)]
|
|
||||||
| ^^^^^^^^^
|
|
||||||
|
|
||||||
|
error: could not evaluate constant pattern
|
||||||
|
--> $DIR/const-eval-overflow-2.rs:15:9
|
||||||
|
|
|
||||||
|
LL | NEG_NEG_128 => println!("A"),
|
||||||
|
| ^^^^^^^^^^^
|
||||||
|
|
||||||
|
error: could not evaluate constant pattern
|
||||||
|
--> $DIR/const-eval-overflow-2.rs:15:9
|
||||||
|
|
|
||||||
|
LL | NEG_NEG_128 => println!("A"),
|
||||||
|
| ^^^^^^^^^^^
|
||||||
|
|
||||||
|
error: aborting due to 3 previous errors
|
||||||
|
|
||||||
|
For more information about this error, try `rustc --explain E0080`.
|
||||||
|
|
|
@ -5,63 +5,53 @@
|
||||||
// change this warn to a deny, then the compiler will exit before
|
// change this warn to a deny, then the compiler will exit before
|
||||||
// those errors are detected.
|
// those errors are detected.
|
||||||
|
|
||||||
#![deny(const_err)]
|
|
||||||
|
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
|
|
||||||
const VALS_I8: (i8,) =
|
const VALS_I8: (i8,) =
|
||||||
(
|
(
|
||||||
i8::MIN - 1,
|
i8::MIN - 1,
|
||||||
);
|
);
|
||||||
//~^^ ERROR any use of this value will cause an error
|
//~^^ ERROR evaluation of constant value failed
|
||||||
//~| WARN this was previously accepted by the compiler but is being phased out
|
|
||||||
|
|
||||||
const VALS_I16: (i16,) =
|
const VALS_I16: (i16,) =
|
||||||
(
|
(
|
||||||
i16::MIN - 1,
|
i16::MIN - 1,
|
||||||
);
|
);
|
||||||
//~^^ ERROR any use of this value will cause an error
|
//~^^ ERROR evaluation of constant value failed
|
||||||
//~| WARN this was previously accepted by the compiler but is being phased out
|
|
||||||
|
|
||||||
const VALS_I32: (i32,) =
|
const VALS_I32: (i32,) =
|
||||||
(
|
(
|
||||||
i32::MIN - 1,
|
i32::MIN - 1,
|
||||||
);
|
);
|
||||||
//~^^ ERROR any use of this value will cause an error
|
//~^^ ERROR evaluation of constant value failed
|
||||||
//~| WARN this was previously accepted by the compiler but is being phased out
|
|
||||||
|
|
||||||
const VALS_I64: (i64,) =
|
const VALS_I64: (i64,) =
|
||||||
(
|
(
|
||||||
i64::MIN - 1,
|
i64::MIN - 1,
|
||||||
);
|
);
|
||||||
//~^^ ERROR any use of this value will cause an error
|
//~^^ ERROR evaluation of constant value failed
|
||||||
//~| WARN this was previously accepted by the compiler but is being phased out
|
|
||||||
|
|
||||||
const VALS_U8: (u8,) =
|
const VALS_U8: (u8,) =
|
||||||
(
|
(
|
||||||
u8::MIN - 1,
|
u8::MIN - 1,
|
||||||
);
|
);
|
||||||
//~^^ ERROR any use of this value will cause an error
|
//~^^ ERROR evaluation of constant value failed
|
||||||
//~| WARN this was previously accepted by the compiler but is being phased out
|
|
||||||
|
|
||||||
const VALS_U16: (u16,) = (
|
const VALS_U16: (u16,) = (
|
||||||
u16::MIN - 1,
|
u16::MIN - 1,
|
||||||
);
|
);
|
||||||
//~^^ ERROR any use of this value will cause an error
|
//~^^ ERROR evaluation of constant value failed
|
||||||
//~| WARN this was previously accepted by the compiler but is being phased out
|
|
||||||
|
|
||||||
const VALS_U32: (u32,) = (
|
const VALS_U32: (u32,) = (
|
||||||
u32::MIN - 1,
|
u32::MIN - 1,
|
||||||
);
|
);
|
||||||
//~^^ ERROR any use of this value will cause an error
|
//~^^ ERROR evaluation of constant value failed
|
||||||
//~| WARN this was previously accepted by the compiler but is being phased out
|
|
||||||
|
|
||||||
const VALS_U64: (u64,) =
|
const VALS_U64: (u64,) =
|
||||||
(
|
(
|
||||||
u64::MIN - 1,
|
u64::MIN - 1,
|
||||||
);
|
);
|
||||||
//~^^ ERROR any use of this value will cause an error
|
//~^^ ERROR evaluation of constant value failed
|
||||||
//~| WARN this was previously accepted by the compiler but is being phased out
|
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
foo(VALS_I8);
|
foo(VALS_I8);
|
||||||
|
|
|
@ -1,243 +1,51 @@
|
||||||
error: any use of this value will cause an error
|
error[E0080]: evaluation of constant value failed
|
||||||
--> $DIR/const-eval-overflow2.rs:14:6
|
--> $DIR/const-eval-overflow2.rs:12:6
|
||||||
|
|
|
|
||||||
LL | const VALS_I8: (i8,) =
|
|
||||||
| --------------------
|
|
||||||
LL | (
|
|
||||||
LL | i8::MIN - 1,
|
LL | i8::MIN - 1,
|
||||||
| ^^^^^^^^^^^ attempt to compute `i8::MIN - 1_i8`, which would overflow
|
| ^^^^^^^^^^^ attempt to compute `i8::MIN - 1_i8`, which would overflow
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
note: the lint level is defined here
|
|
||||||
--> $DIR/const-eval-overflow2.rs:8:9
|
|
||||||
|
|
|
||||||
LL | #![deny(const_err)]
|
|
||||||
| ^^^^^^^^^
|
|
||||||
|
|
||||||
error: any use of this value will cause an error
|
error[E0080]: evaluation of constant value failed
|
||||||
--> $DIR/const-eval-overflow2.rs:21:6
|
--> $DIR/const-eval-overflow2.rs:18:6
|
||||||
|
|
|
|
||||||
LL | const VALS_I16: (i16,) =
|
|
||||||
| ----------------------
|
|
||||||
LL | (
|
|
||||||
LL | i16::MIN - 1,
|
LL | i16::MIN - 1,
|
||||||
| ^^^^^^^^^^^^ attempt to compute `i16::MIN - 1_i16`, which would overflow
|
| ^^^^^^^^^^^^ attempt to compute `i16::MIN - 1_i16`, which would overflow
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
|
|
||||||
error: any use of this value will cause an error
|
error[E0080]: evaluation of constant value failed
|
||||||
--> $DIR/const-eval-overflow2.rs:28:6
|
--> $DIR/const-eval-overflow2.rs:24:6
|
||||||
|
|
|
|
||||||
LL | const VALS_I32: (i32,) =
|
|
||||||
| ----------------------
|
|
||||||
LL | (
|
|
||||||
LL | i32::MIN - 1,
|
LL | i32::MIN - 1,
|
||||||
| ^^^^^^^^^^^^ attempt to compute `i32::MIN - 1_i32`, which would overflow
|
| ^^^^^^^^^^^^ attempt to compute `i32::MIN - 1_i32`, which would overflow
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
|
|
||||||
error: any use of this value will cause an error
|
error[E0080]: evaluation of constant value failed
|
||||||
--> $DIR/const-eval-overflow2.rs:35:6
|
--> $DIR/const-eval-overflow2.rs:30:6
|
||||||
|
|
|
|
||||||
LL | const VALS_I64: (i64,) =
|
|
||||||
| ----------------------
|
|
||||||
LL | (
|
|
||||||
LL | i64::MIN - 1,
|
LL | i64::MIN - 1,
|
||||||
| ^^^^^^^^^^^^ attempt to compute `i64::MIN - 1_i64`, which would overflow
|
| ^^^^^^^^^^^^ attempt to compute `i64::MIN - 1_i64`, which would overflow
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
|
|
||||||
error: any use of this value will cause an error
|
error[E0080]: evaluation of constant value failed
|
||||||
--> $DIR/const-eval-overflow2.rs:42:6
|
--> $DIR/const-eval-overflow2.rs:36:6
|
||||||
|
|
|
|
||||||
LL | const VALS_U8: (u8,) =
|
|
||||||
| --------------------
|
|
||||||
LL | (
|
|
||||||
LL | u8::MIN - 1,
|
LL | u8::MIN - 1,
|
||||||
| ^^^^^^^^^^^ attempt to compute `0_u8 - 1_u8`, which would overflow
|
| ^^^^^^^^^^^ attempt to compute `0_u8 - 1_u8`, which would overflow
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
|
|
||||||
error: any use of this value will cause an error
|
error[E0080]: evaluation of constant value failed
|
||||||
--> $DIR/const-eval-overflow2.rs:48:6
|
--> $DIR/const-eval-overflow2.rs:41:6
|
||||||
|
|
|
|
||||||
LL | const VALS_U16: (u16,) = (
|
|
||||||
| ----------------------
|
|
||||||
LL | u16::MIN - 1,
|
LL | u16::MIN - 1,
|
||||||
| ^^^^^^^^^^^^ attempt to compute `0_u16 - 1_u16`, which would overflow
|
| ^^^^^^^^^^^^ attempt to compute `0_u16 - 1_u16`, which would overflow
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
|
|
||||||
error: any use of this value will cause an error
|
error[E0080]: evaluation of constant value failed
|
||||||
--> $DIR/const-eval-overflow2.rs:54:6
|
--> $DIR/const-eval-overflow2.rs:46:6
|
||||||
|
|
|
|
||||||
LL | const VALS_U32: (u32,) = (
|
|
||||||
| ----------------------
|
|
||||||
LL | u32::MIN - 1,
|
LL | u32::MIN - 1,
|
||||||
| ^^^^^^^^^^^^ attempt to compute `0_u32 - 1_u32`, which would overflow
|
| ^^^^^^^^^^^^ attempt to compute `0_u32 - 1_u32`, which would overflow
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
|
|
||||||
error: any use of this value will cause an error
|
error[E0080]: evaluation of constant value failed
|
||||||
--> $DIR/const-eval-overflow2.rs:61:6
|
--> $DIR/const-eval-overflow2.rs:52:6
|
||||||
|
|
|
|
||||||
LL | const VALS_U64: (u64,) =
|
|
||||||
| ----------------------
|
|
||||||
LL | (
|
|
||||||
LL | u64::MIN - 1,
|
LL | u64::MIN - 1,
|
||||||
| ^^^^^^^^^^^^ attempt to compute `0_u64 - 1_u64`, which would overflow
|
| ^^^^^^^^^^^^ attempt to compute `0_u64 - 1_u64`, which would overflow
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
|
|
||||||
error: aborting due to 8 previous errors
|
error: aborting due to 8 previous errors
|
||||||
|
|
||||||
Future incompatibility report: Future breakage diagnostic:
|
For more information about this error, try `rustc --explain E0080`.
|
||||||
error: any use of this value will cause an error
|
|
||||||
--> $DIR/const-eval-overflow2.rs:14:6
|
|
||||||
|
|
|
||||||
LL | const VALS_I8: (i8,) =
|
|
||||||
| --------------------
|
|
||||||
LL | (
|
|
||||||
LL | i8::MIN - 1,
|
|
||||||
| ^^^^^^^^^^^ attempt to compute `i8::MIN - 1_i8`, which would overflow
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
note: the lint level is defined here
|
|
||||||
--> $DIR/const-eval-overflow2.rs:8:9
|
|
||||||
|
|
|
||||||
LL | #![deny(const_err)]
|
|
||||||
| ^^^^^^^^^
|
|
||||||
|
|
||||||
Future breakage diagnostic:
|
|
||||||
error: any use of this value will cause an error
|
|
||||||
--> $DIR/const-eval-overflow2.rs:21:6
|
|
||||||
|
|
|
||||||
LL | const VALS_I16: (i16,) =
|
|
||||||
| ----------------------
|
|
||||||
LL | (
|
|
||||||
LL | i16::MIN - 1,
|
|
||||||
| ^^^^^^^^^^^^ attempt to compute `i16::MIN - 1_i16`, which would overflow
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
note: the lint level is defined here
|
|
||||||
--> $DIR/const-eval-overflow2.rs:8:9
|
|
||||||
|
|
|
||||||
LL | #![deny(const_err)]
|
|
||||||
| ^^^^^^^^^
|
|
||||||
|
|
||||||
Future breakage diagnostic:
|
|
||||||
error: any use of this value will cause an error
|
|
||||||
--> $DIR/const-eval-overflow2.rs:28:6
|
|
||||||
|
|
|
||||||
LL | const VALS_I32: (i32,) =
|
|
||||||
| ----------------------
|
|
||||||
LL | (
|
|
||||||
LL | i32::MIN - 1,
|
|
||||||
| ^^^^^^^^^^^^ attempt to compute `i32::MIN - 1_i32`, which would overflow
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
note: the lint level is defined here
|
|
||||||
--> $DIR/const-eval-overflow2.rs:8:9
|
|
||||||
|
|
|
||||||
LL | #![deny(const_err)]
|
|
||||||
| ^^^^^^^^^
|
|
||||||
|
|
||||||
Future breakage diagnostic:
|
|
||||||
error: any use of this value will cause an error
|
|
||||||
--> $DIR/const-eval-overflow2.rs:35:6
|
|
||||||
|
|
|
||||||
LL | const VALS_I64: (i64,) =
|
|
||||||
| ----------------------
|
|
||||||
LL | (
|
|
||||||
LL | i64::MIN - 1,
|
|
||||||
| ^^^^^^^^^^^^ attempt to compute `i64::MIN - 1_i64`, which would overflow
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
note: the lint level is defined here
|
|
||||||
--> $DIR/const-eval-overflow2.rs:8:9
|
|
||||||
|
|
|
||||||
LL | #![deny(const_err)]
|
|
||||||
| ^^^^^^^^^
|
|
||||||
|
|
||||||
Future breakage diagnostic:
|
|
||||||
error: any use of this value will cause an error
|
|
||||||
--> $DIR/const-eval-overflow2.rs:42:6
|
|
||||||
|
|
|
||||||
LL | const VALS_U8: (u8,) =
|
|
||||||
| --------------------
|
|
||||||
LL | (
|
|
||||||
LL | u8::MIN - 1,
|
|
||||||
| ^^^^^^^^^^^ attempt to compute `0_u8 - 1_u8`, which would overflow
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
note: the lint level is defined here
|
|
||||||
--> $DIR/const-eval-overflow2.rs:8:9
|
|
||||||
|
|
|
||||||
LL | #![deny(const_err)]
|
|
||||||
| ^^^^^^^^^
|
|
||||||
|
|
||||||
Future breakage diagnostic:
|
|
||||||
error: any use of this value will cause an error
|
|
||||||
--> $DIR/const-eval-overflow2.rs:48:6
|
|
||||||
|
|
|
||||||
LL | const VALS_U16: (u16,) = (
|
|
||||||
| ----------------------
|
|
||||||
LL | u16::MIN - 1,
|
|
||||||
| ^^^^^^^^^^^^ attempt to compute `0_u16 - 1_u16`, which would overflow
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
note: the lint level is defined here
|
|
||||||
--> $DIR/const-eval-overflow2.rs:8:9
|
|
||||||
|
|
|
||||||
LL | #![deny(const_err)]
|
|
||||||
| ^^^^^^^^^
|
|
||||||
|
|
||||||
Future breakage diagnostic:
|
|
||||||
error: any use of this value will cause an error
|
|
||||||
--> $DIR/const-eval-overflow2.rs:54:6
|
|
||||||
|
|
|
||||||
LL | const VALS_U32: (u32,) = (
|
|
||||||
| ----------------------
|
|
||||||
LL | u32::MIN - 1,
|
|
||||||
| ^^^^^^^^^^^^ attempt to compute `0_u32 - 1_u32`, which would overflow
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
note: the lint level is defined here
|
|
||||||
--> $DIR/const-eval-overflow2.rs:8:9
|
|
||||||
|
|
|
||||||
LL | #![deny(const_err)]
|
|
||||||
| ^^^^^^^^^
|
|
||||||
|
|
||||||
Future breakage diagnostic:
|
|
||||||
error: any use of this value will cause an error
|
|
||||||
--> $DIR/const-eval-overflow2.rs:61:6
|
|
||||||
|
|
|
||||||
LL | const VALS_U64: (u64,) =
|
|
||||||
| ----------------------
|
|
||||||
LL | (
|
|
||||||
LL | u64::MIN - 1,
|
|
||||||
| ^^^^^^^^^^^^ attempt to compute `0_u64 - 1_u64`, which would overflow
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
note: the lint level is defined here
|
|
||||||
--> $DIR/const-eval-overflow2.rs:8:9
|
|
||||||
|
|
|
||||||
LL | #![deny(const_err)]
|
|
||||||
| ^^^^^^^^^
|
|
||||||
|
|
||||||
|
|
|
@ -5,63 +5,53 @@
|
||||||
// change this warn to a deny, then the compiler will exit before
|
// change this warn to a deny, then the compiler will exit before
|
||||||
// those errors are detected.
|
// those errors are detected.
|
||||||
|
|
||||||
#![deny(const_err)]
|
|
||||||
|
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
|
|
||||||
const VALS_I8: (i8,) =
|
const VALS_I8: (i8,) =
|
||||||
(
|
(
|
||||||
i8::MAX + 1,
|
i8::MAX + 1,
|
||||||
);
|
);
|
||||||
//~^^ ERROR any use of this value will cause an error
|
//~^^ ERROR evaluation of constant value failed
|
||||||
//~| WARN this was previously accepted by the compiler but is being phased out
|
|
||||||
|
|
||||||
const VALS_I16: (i16,) =
|
const VALS_I16: (i16,) =
|
||||||
(
|
(
|
||||||
i16::MAX + 1,
|
i16::MAX + 1,
|
||||||
);
|
);
|
||||||
//~^^ ERROR any use of this value will cause an error
|
//~^^ ERROR evaluation of constant value failed
|
||||||
//~| WARN this was previously accepted by the compiler but is being phased out
|
|
||||||
|
|
||||||
const VALS_I32: (i32,) =
|
const VALS_I32: (i32,) =
|
||||||
(
|
(
|
||||||
i32::MAX + 1,
|
i32::MAX + 1,
|
||||||
);
|
);
|
||||||
//~^^ ERROR any use of this value will cause an error
|
//~^^ ERROR evaluation of constant value failed
|
||||||
//~| WARN this was previously accepted by the compiler but is being phased out
|
|
||||||
|
|
||||||
const VALS_I64: (i64,) =
|
const VALS_I64: (i64,) =
|
||||||
(
|
(
|
||||||
i64::MAX + 1,
|
i64::MAX + 1,
|
||||||
);
|
);
|
||||||
//~^^ ERROR any use of this value will cause an error
|
//~^^ ERROR evaluation of constant value failed
|
||||||
//~| WARN this was previously accepted by the compiler but is being phased out
|
|
||||||
|
|
||||||
const VALS_U8: (u8,) =
|
const VALS_U8: (u8,) =
|
||||||
(
|
(
|
||||||
u8::MAX + 1,
|
u8::MAX + 1,
|
||||||
);
|
);
|
||||||
//~^^ ERROR any use of this value will cause an error
|
//~^^ ERROR evaluation of constant value failed
|
||||||
//~| WARN this was previously accepted by the compiler but is being phased out
|
|
||||||
|
|
||||||
const VALS_U16: (u16,) = (
|
const VALS_U16: (u16,) = (
|
||||||
u16::MAX + 1,
|
u16::MAX + 1,
|
||||||
);
|
);
|
||||||
//~^^ ERROR any use of this value will cause an error
|
//~^^ ERROR evaluation of constant value failed
|
||||||
//~| WARN this was previously accepted by the compiler but is being phased out
|
|
||||||
|
|
||||||
const VALS_U32: (u32,) = (
|
const VALS_U32: (u32,) = (
|
||||||
u32::MAX + 1,
|
u32::MAX + 1,
|
||||||
);
|
);
|
||||||
//~^^ ERROR any use of this value will cause an error
|
//~^^ ERROR evaluation of constant value failed
|
||||||
//~| WARN this was previously accepted by the compiler but is being phased out
|
|
||||||
|
|
||||||
const VALS_U64: (u64,) =
|
const VALS_U64: (u64,) =
|
||||||
(
|
(
|
||||||
u64::MAX + 1,
|
u64::MAX + 1,
|
||||||
);
|
);
|
||||||
//~^^ ERROR any use of this value will cause an error
|
//~^^ ERROR evaluation of constant value failed
|
||||||
//~| WARN this was previously accepted by the compiler but is being phased out
|
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
foo(VALS_I8);
|
foo(VALS_I8);
|
||||||
|
|
|
@ -1,243 +1,51 @@
|
||||||
error: any use of this value will cause an error
|
error[E0080]: evaluation of constant value failed
|
||||||
--> $DIR/const-eval-overflow2b.rs:14:6
|
--> $DIR/const-eval-overflow2b.rs:12:6
|
||||||
|
|
|
|
||||||
LL | const VALS_I8: (i8,) =
|
|
||||||
| --------------------
|
|
||||||
LL | (
|
|
||||||
LL | i8::MAX + 1,
|
LL | i8::MAX + 1,
|
||||||
| ^^^^^^^^^^^ attempt to compute `i8::MAX + 1_i8`, which would overflow
|
| ^^^^^^^^^^^ attempt to compute `i8::MAX + 1_i8`, which would overflow
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
note: the lint level is defined here
|
|
||||||
--> $DIR/const-eval-overflow2b.rs:8:9
|
|
||||||
|
|
|
||||||
LL | #![deny(const_err)]
|
|
||||||
| ^^^^^^^^^
|
|
||||||
|
|
||||||
error: any use of this value will cause an error
|
error[E0080]: evaluation of constant value failed
|
||||||
--> $DIR/const-eval-overflow2b.rs:21:6
|
--> $DIR/const-eval-overflow2b.rs:18:6
|
||||||
|
|
|
|
||||||
LL | const VALS_I16: (i16,) =
|
|
||||||
| ----------------------
|
|
||||||
LL | (
|
|
||||||
LL | i16::MAX + 1,
|
LL | i16::MAX + 1,
|
||||||
| ^^^^^^^^^^^^ attempt to compute `i16::MAX + 1_i16`, which would overflow
|
| ^^^^^^^^^^^^ attempt to compute `i16::MAX + 1_i16`, which would overflow
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
|
|
||||||
error: any use of this value will cause an error
|
error[E0080]: evaluation of constant value failed
|
||||||
--> $DIR/const-eval-overflow2b.rs:28:6
|
--> $DIR/const-eval-overflow2b.rs:24:6
|
||||||
|
|
|
|
||||||
LL | const VALS_I32: (i32,) =
|
|
||||||
| ----------------------
|
|
||||||
LL | (
|
|
||||||
LL | i32::MAX + 1,
|
LL | i32::MAX + 1,
|
||||||
| ^^^^^^^^^^^^ attempt to compute `i32::MAX + 1_i32`, which would overflow
|
| ^^^^^^^^^^^^ attempt to compute `i32::MAX + 1_i32`, which would overflow
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
|
|
||||||
error: any use of this value will cause an error
|
error[E0080]: evaluation of constant value failed
|
||||||
--> $DIR/const-eval-overflow2b.rs:35:6
|
--> $DIR/const-eval-overflow2b.rs:30:6
|
||||||
|
|
|
|
||||||
LL | const VALS_I64: (i64,) =
|
|
||||||
| ----------------------
|
|
||||||
LL | (
|
|
||||||
LL | i64::MAX + 1,
|
LL | i64::MAX + 1,
|
||||||
| ^^^^^^^^^^^^ attempt to compute `i64::MAX + 1_i64`, which would overflow
|
| ^^^^^^^^^^^^ attempt to compute `i64::MAX + 1_i64`, which would overflow
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
|
|
||||||
error: any use of this value will cause an error
|
error[E0080]: evaluation of constant value failed
|
||||||
--> $DIR/const-eval-overflow2b.rs:42:6
|
--> $DIR/const-eval-overflow2b.rs:36:6
|
||||||
|
|
|
|
||||||
LL | const VALS_U8: (u8,) =
|
|
||||||
| --------------------
|
|
||||||
LL | (
|
|
||||||
LL | u8::MAX + 1,
|
LL | u8::MAX + 1,
|
||||||
| ^^^^^^^^^^^ attempt to compute `u8::MAX + 1_u8`, which would overflow
|
| ^^^^^^^^^^^ attempt to compute `u8::MAX + 1_u8`, which would overflow
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
|
|
||||||
error: any use of this value will cause an error
|
error[E0080]: evaluation of constant value failed
|
||||||
--> $DIR/const-eval-overflow2b.rs:48:6
|
--> $DIR/const-eval-overflow2b.rs:41:6
|
||||||
|
|
|
|
||||||
LL | const VALS_U16: (u16,) = (
|
|
||||||
| ----------------------
|
|
||||||
LL | u16::MAX + 1,
|
LL | u16::MAX + 1,
|
||||||
| ^^^^^^^^^^^^ attempt to compute `u16::MAX + 1_u16`, which would overflow
|
| ^^^^^^^^^^^^ attempt to compute `u16::MAX + 1_u16`, which would overflow
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
|
|
||||||
error: any use of this value will cause an error
|
error[E0080]: evaluation of constant value failed
|
||||||
--> $DIR/const-eval-overflow2b.rs:54:6
|
--> $DIR/const-eval-overflow2b.rs:46:6
|
||||||
|
|
|
|
||||||
LL | const VALS_U32: (u32,) = (
|
|
||||||
| ----------------------
|
|
||||||
LL | u32::MAX + 1,
|
LL | u32::MAX + 1,
|
||||||
| ^^^^^^^^^^^^ attempt to compute `u32::MAX + 1_u32`, which would overflow
|
| ^^^^^^^^^^^^ attempt to compute `u32::MAX + 1_u32`, which would overflow
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
|
|
||||||
error: any use of this value will cause an error
|
error[E0080]: evaluation of constant value failed
|
||||||
--> $DIR/const-eval-overflow2b.rs:61:6
|
--> $DIR/const-eval-overflow2b.rs:52:6
|
||||||
|
|
|
|
||||||
LL | const VALS_U64: (u64,) =
|
|
||||||
| ----------------------
|
|
||||||
LL | (
|
|
||||||
LL | u64::MAX + 1,
|
LL | u64::MAX + 1,
|
||||||
| ^^^^^^^^^^^^ attempt to compute `u64::MAX + 1_u64`, which would overflow
|
| ^^^^^^^^^^^^ attempt to compute `u64::MAX + 1_u64`, which would overflow
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
|
|
||||||
error: aborting due to 8 previous errors
|
error: aborting due to 8 previous errors
|
||||||
|
|
||||||
Future incompatibility report: Future breakage diagnostic:
|
For more information about this error, try `rustc --explain E0080`.
|
||||||
error: any use of this value will cause an error
|
|
||||||
--> $DIR/const-eval-overflow2b.rs:14:6
|
|
||||||
|
|
|
||||||
LL | const VALS_I8: (i8,) =
|
|
||||||
| --------------------
|
|
||||||
LL | (
|
|
||||||
LL | i8::MAX + 1,
|
|
||||||
| ^^^^^^^^^^^ attempt to compute `i8::MAX + 1_i8`, which would overflow
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
note: the lint level is defined here
|
|
||||||
--> $DIR/const-eval-overflow2b.rs:8:9
|
|
||||||
|
|
|
||||||
LL | #![deny(const_err)]
|
|
||||||
| ^^^^^^^^^
|
|
||||||
|
|
||||||
Future breakage diagnostic:
|
|
||||||
error: any use of this value will cause an error
|
|
||||||
--> $DIR/const-eval-overflow2b.rs:21:6
|
|
||||||
|
|
|
||||||
LL | const VALS_I16: (i16,) =
|
|
||||||
| ----------------------
|
|
||||||
LL | (
|
|
||||||
LL | i16::MAX + 1,
|
|
||||||
| ^^^^^^^^^^^^ attempt to compute `i16::MAX + 1_i16`, which would overflow
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
note: the lint level is defined here
|
|
||||||
--> $DIR/const-eval-overflow2b.rs:8:9
|
|
||||||
|
|
|
||||||
LL | #![deny(const_err)]
|
|
||||||
| ^^^^^^^^^
|
|
||||||
|
|
||||||
Future breakage diagnostic:
|
|
||||||
error: any use of this value will cause an error
|
|
||||||
--> $DIR/const-eval-overflow2b.rs:28:6
|
|
||||||
|
|
|
||||||
LL | const VALS_I32: (i32,) =
|
|
||||||
| ----------------------
|
|
||||||
LL | (
|
|
||||||
LL | i32::MAX + 1,
|
|
||||||
| ^^^^^^^^^^^^ attempt to compute `i32::MAX + 1_i32`, which would overflow
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
note: the lint level is defined here
|
|
||||||
--> $DIR/const-eval-overflow2b.rs:8:9
|
|
||||||
|
|
|
||||||
LL | #![deny(const_err)]
|
|
||||||
| ^^^^^^^^^
|
|
||||||
|
|
||||||
Future breakage diagnostic:
|
|
||||||
error: any use of this value will cause an error
|
|
||||||
--> $DIR/const-eval-overflow2b.rs:35:6
|
|
||||||
|
|
|
||||||
LL | const VALS_I64: (i64,) =
|
|
||||||
| ----------------------
|
|
||||||
LL | (
|
|
||||||
LL | i64::MAX + 1,
|
|
||||||
| ^^^^^^^^^^^^ attempt to compute `i64::MAX + 1_i64`, which would overflow
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
note: the lint level is defined here
|
|
||||||
--> $DIR/const-eval-overflow2b.rs:8:9
|
|
||||||
|
|
|
||||||
LL | #![deny(const_err)]
|
|
||||||
| ^^^^^^^^^
|
|
||||||
|
|
||||||
Future breakage diagnostic:
|
|
||||||
error: any use of this value will cause an error
|
|
||||||
--> $DIR/const-eval-overflow2b.rs:42:6
|
|
||||||
|
|
|
||||||
LL | const VALS_U8: (u8,) =
|
|
||||||
| --------------------
|
|
||||||
LL | (
|
|
||||||
LL | u8::MAX + 1,
|
|
||||||
| ^^^^^^^^^^^ attempt to compute `u8::MAX + 1_u8`, which would overflow
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
note: the lint level is defined here
|
|
||||||
--> $DIR/const-eval-overflow2b.rs:8:9
|
|
||||||
|
|
|
||||||
LL | #![deny(const_err)]
|
|
||||||
| ^^^^^^^^^
|
|
||||||
|
|
||||||
Future breakage diagnostic:
|
|
||||||
error: any use of this value will cause an error
|
|
||||||
--> $DIR/const-eval-overflow2b.rs:48:6
|
|
||||||
|
|
|
||||||
LL | const VALS_U16: (u16,) = (
|
|
||||||
| ----------------------
|
|
||||||
LL | u16::MAX + 1,
|
|
||||||
| ^^^^^^^^^^^^ attempt to compute `u16::MAX + 1_u16`, which would overflow
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
note: the lint level is defined here
|
|
||||||
--> $DIR/const-eval-overflow2b.rs:8:9
|
|
||||||
|
|
|
||||||
LL | #![deny(const_err)]
|
|
||||||
| ^^^^^^^^^
|
|
||||||
|
|
||||||
Future breakage diagnostic:
|
|
||||||
error: any use of this value will cause an error
|
|
||||||
--> $DIR/const-eval-overflow2b.rs:54:6
|
|
||||||
|
|
|
||||||
LL | const VALS_U32: (u32,) = (
|
|
||||||
| ----------------------
|
|
||||||
LL | u32::MAX + 1,
|
|
||||||
| ^^^^^^^^^^^^ attempt to compute `u32::MAX + 1_u32`, which would overflow
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
note: the lint level is defined here
|
|
||||||
--> $DIR/const-eval-overflow2b.rs:8:9
|
|
||||||
|
|
|
||||||
LL | #![deny(const_err)]
|
|
||||||
| ^^^^^^^^^
|
|
||||||
|
|
||||||
Future breakage diagnostic:
|
|
||||||
error: any use of this value will cause an error
|
|
||||||
--> $DIR/const-eval-overflow2b.rs:61:6
|
|
||||||
|
|
|
||||||
LL | const VALS_U64: (u64,) =
|
|
||||||
| ----------------------
|
|
||||||
LL | (
|
|
||||||
LL | u64::MAX + 1,
|
|
||||||
| ^^^^^^^^^^^^ attempt to compute `u64::MAX + 1_u64`, which would overflow
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
note: the lint level is defined here
|
|
||||||
--> $DIR/const-eval-overflow2b.rs:8:9
|
|
||||||
|
|
|
||||||
LL | #![deny(const_err)]
|
|
||||||
| ^^^^^^^^^
|
|
||||||
|
|
||||||
|
|
|
@ -5,63 +5,53 @@
|
||||||
// change this warn to a deny, then the compiler will exit before
|
// change this warn to a deny, then the compiler will exit before
|
||||||
// those errors are detected.
|
// those errors are detected.
|
||||||
|
|
||||||
#![deny(const_err)]
|
|
||||||
|
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
|
|
||||||
const VALS_I8: (i8,) =
|
const VALS_I8: (i8,) =
|
||||||
(
|
(
|
||||||
i8::MIN * 2,
|
i8::MIN * 2,
|
||||||
);
|
);
|
||||||
//~^^ ERROR any use of this value will cause an error
|
//~^^ ERROR evaluation of constant value failed
|
||||||
//~| WARN this was previously accepted by the compiler but is being phased out
|
|
||||||
|
|
||||||
const VALS_I16: (i16,) =
|
const VALS_I16: (i16,) =
|
||||||
(
|
(
|
||||||
i16::MIN * 2,
|
i16::MIN * 2,
|
||||||
);
|
);
|
||||||
//~^^ ERROR any use of this value will cause an error
|
//~^^ ERROR evaluation of constant value failed
|
||||||
//~| WARN this was previously accepted by the compiler but is being phased out
|
|
||||||
|
|
||||||
const VALS_I32: (i32,) =
|
const VALS_I32: (i32,) =
|
||||||
(
|
(
|
||||||
i32::MIN * 2,
|
i32::MIN * 2,
|
||||||
);
|
);
|
||||||
//~^^ ERROR any use of this value will cause an error
|
//~^^ ERROR evaluation of constant value failed
|
||||||
//~| WARN this was previously accepted by the compiler but is being phased out
|
|
||||||
|
|
||||||
const VALS_I64: (i64,) =
|
const VALS_I64: (i64,) =
|
||||||
(
|
(
|
||||||
i64::MIN * 2,
|
i64::MIN * 2,
|
||||||
);
|
);
|
||||||
//~^^ ERROR any use of this value will cause an error
|
//~^^ ERROR evaluation of constant value failed
|
||||||
//~| WARN this was previously accepted by the compiler but is being phased out
|
|
||||||
|
|
||||||
const VALS_U8: (u8,) =
|
const VALS_U8: (u8,) =
|
||||||
(
|
(
|
||||||
u8::MAX * 2,
|
u8::MAX * 2,
|
||||||
);
|
);
|
||||||
//~^^ ERROR any use of this value will cause an error
|
//~^^ ERROR evaluation of constant value failed
|
||||||
//~| WARN this was previously accepted by the compiler but is being phased out
|
|
||||||
|
|
||||||
const VALS_U16: (u16,) = (
|
const VALS_U16: (u16,) = (
|
||||||
u16::MAX * 2,
|
u16::MAX * 2,
|
||||||
);
|
);
|
||||||
//~^^ ERROR any use of this value will cause an error
|
//~^^ ERROR evaluation of constant value failed
|
||||||
//~| WARN this was previously accepted by the compiler but is being phased out
|
|
||||||
|
|
||||||
const VALS_U32: (u32,) = (
|
const VALS_U32: (u32,) = (
|
||||||
u32::MAX * 2,
|
u32::MAX * 2,
|
||||||
);
|
);
|
||||||
//~^^ ERROR any use of this value will cause an error
|
//~^^ ERROR evaluation of constant value failed
|
||||||
//~| WARN this was previously accepted by the compiler but is being phased out
|
|
||||||
|
|
||||||
const VALS_U64: (u64,) =
|
const VALS_U64: (u64,) =
|
||||||
(
|
(
|
||||||
u64::MAX * 2,
|
u64::MAX * 2,
|
||||||
);
|
);
|
||||||
//~^^ ERROR any use of this value will cause an error
|
//~^^ ERROR evaluation of constant value failed
|
||||||
//~| WARN this was previously accepted by the compiler but is being phased out
|
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
foo(VALS_I8);
|
foo(VALS_I8);
|
||||||
|
|
|
@ -1,243 +1,51 @@
|
||||||
error: any use of this value will cause an error
|
error[E0080]: evaluation of constant value failed
|
||||||
--> $DIR/const-eval-overflow2c.rs:14:6
|
--> $DIR/const-eval-overflow2c.rs:12:6
|
||||||
|
|
|
|
||||||
LL | const VALS_I8: (i8,) =
|
|
||||||
| --------------------
|
|
||||||
LL | (
|
|
||||||
LL | i8::MIN * 2,
|
LL | i8::MIN * 2,
|
||||||
| ^^^^^^^^^^^ attempt to compute `i8::MIN * 2_i8`, which would overflow
|
| ^^^^^^^^^^^ attempt to compute `i8::MIN * 2_i8`, which would overflow
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
note: the lint level is defined here
|
|
||||||
--> $DIR/const-eval-overflow2c.rs:8:9
|
|
||||||
|
|
|
||||||
LL | #![deny(const_err)]
|
|
||||||
| ^^^^^^^^^
|
|
||||||
|
|
||||||
error: any use of this value will cause an error
|
error[E0080]: evaluation of constant value failed
|
||||||
--> $DIR/const-eval-overflow2c.rs:21:6
|
--> $DIR/const-eval-overflow2c.rs:18:6
|
||||||
|
|
|
|
||||||
LL | const VALS_I16: (i16,) =
|
|
||||||
| ----------------------
|
|
||||||
LL | (
|
|
||||||
LL | i16::MIN * 2,
|
LL | i16::MIN * 2,
|
||||||
| ^^^^^^^^^^^^ attempt to compute `i16::MIN * 2_i16`, which would overflow
|
| ^^^^^^^^^^^^ attempt to compute `i16::MIN * 2_i16`, which would overflow
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
|
|
||||||
error: any use of this value will cause an error
|
error[E0080]: evaluation of constant value failed
|
||||||
--> $DIR/const-eval-overflow2c.rs:28:6
|
--> $DIR/const-eval-overflow2c.rs:24:6
|
||||||
|
|
|
|
||||||
LL | const VALS_I32: (i32,) =
|
|
||||||
| ----------------------
|
|
||||||
LL | (
|
|
||||||
LL | i32::MIN * 2,
|
LL | i32::MIN * 2,
|
||||||
| ^^^^^^^^^^^^ attempt to compute `i32::MIN * 2_i32`, which would overflow
|
| ^^^^^^^^^^^^ attempt to compute `i32::MIN * 2_i32`, which would overflow
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
|
|
||||||
error: any use of this value will cause an error
|
error[E0080]: evaluation of constant value failed
|
||||||
--> $DIR/const-eval-overflow2c.rs:35:6
|
--> $DIR/const-eval-overflow2c.rs:30:6
|
||||||
|
|
|
|
||||||
LL | const VALS_I64: (i64,) =
|
|
||||||
| ----------------------
|
|
||||||
LL | (
|
|
||||||
LL | i64::MIN * 2,
|
LL | i64::MIN * 2,
|
||||||
| ^^^^^^^^^^^^ attempt to compute `i64::MIN * 2_i64`, which would overflow
|
| ^^^^^^^^^^^^ attempt to compute `i64::MIN * 2_i64`, which would overflow
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
|
|
||||||
error: any use of this value will cause an error
|
error[E0080]: evaluation of constant value failed
|
||||||
--> $DIR/const-eval-overflow2c.rs:42:6
|
--> $DIR/const-eval-overflow2c.rs:36:6
|
||||||
|
|
|
|
||||||
LL | const VALS_U8: (u8,) =
|
|
||||||
| --------------------
|
|
||||||
LL | (
|
|
||||||
LL | u8::MAX * 2,
|
LL | u8::MAX * 2,
|
||||||
| ^^^^^^^^^^^ attempt to compute `u8::MAX * 2_u8`, which would overflow
|
| ^^^^^^^^^^^ attempt to compute `u8::MAX * 2_u8`, which would overflow
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
|
|
||||||
error: any use of this value will cause an error
|
error[E0080]: evaluation of constant value failed
|
||||||
--> $DIR/const-eval-overflow2c.rs:48:6
|
--> $DIR/const-eval-overflow2c.rs:41:6
|
||||||
|
|
|
|
||||||
LL | const VALS_U16: (u16,) = (
|
|
||||||
| ----------------------
|
|
||||||
LL | u16::MAX * 2,
|
LL | u16::MAX * 2,
|
||||||
| ^^^^^^^^^^^^ attempt to compute `u16::MAX * 2_u16`, which would overflow
|
| ^^^^^^^^^^^^ attempt to compute `u16::MAX * 2_u16`, which would overflow
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
|
|
||||||
error: any use of this value will cause an error
|
error[E0080]: evaluation of constant value failed
|
||||||
--> $DIR/const-eval-overflow2c.rs:54:6
|
--> $DIR/const-eval-overflow2c.rs:46:6
|
||||||
|
|
|
|
||||||
LL | const VALS_U32: (u32,) = (
|
|
||||||
| ----------------------
|
|
||||||
LL | u32::MAX * 2,
|
LL | u32::MAX * 2,
|
||||||
| ^^^^^^^^^^^^ attempt to compute `u32::MAX * 2_u32`, which would overflow
|
| ^^^^^^^^^^^^ attempt to compute `u32::MAX * 2_u32`, which would overflow
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
|
|
||||||
error: any use of this value will cause an error
|
error[E0080]: evaluation of constant value failed
|
||||||
--> $DIR/const-eval-overflow2c.rs:61:6
|
--> $DIR/const-eval-overflow2c.rs:52:6
|
||||||
|
|
|
|
||||||
LL | const VALS_U64: (u64,) =
|
|
||||||
| ----------------------
|
|
||||||
LL | (
|
|
||||||
LL | u64::MAX * 2,
|
LL | u64::MAX * 2,
|
||||||
| ^^^^^^^^^^^^ attempt to compute `u64::MAX * 2_u64`, which would overflow
|
| ^^^^^^^^^^^^ attempt to compute `u64::MAX * 2_u64`, which would overflow
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
|
|
||||||
error: aborting due to 8 previous errors
|
error: aborting due to 8 previous errors
|
||||||
|
|
||||||
Future incompatibility report: Future breakage diagnostic:
|
For more information about this error, try `rustc --explain E0080`.
|
||||||
error: any use of this value will cause an error
|
|
||||||
--> $DIR/const-eval-overflow2c.rs:14:6
|
|
||||||
|
|
|
||||||
LL | const VALS_I8: (i8,) =
|
|
||||||
| --------------------
|
|
||||||
LL | (
|
|
||||||
LL | i8::MIN * 2,
|
|
||||||
| ^^^^^^^^^^^ attempt to compute `i8::MIN * 2_i8`, which would overflow
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
note: the lint level is defined here
|
|
||||||
--> $DIR/const-eval-overflow2c.rs:8:9
|
|
||||||
|
|
|
||||||
LL | #![deny(const_err)]
|
|
||||||
| ^^^^^^^^^
|
|
||||||
|
|
||||||
Future breakage diagnostic:
|
|
||||||
error: any use of this value will cause an error
|
|
||||||
--> $DIR/const-eval-overflow2c.rs:21:6
|
|
||||||
|
|
|
||||||
LL | const VALS_I16: (i16,) =
|
|
||||||
| ----------------------
|
|
||||||
LL | (
|
|
||||||
LL | i16::MIN * 2,
|
|
||||||
| ^^^^^^^^^^^^ attempt to compute `i16::MIN * 2_i16`, which would overflow
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
note: the lint level is defined here
|
|
||||||
--> $DIR/const-eval-overflow2c.rs:8:9
|
|
||||||
|
|
|
||||||
LL | #![deny(const_err)]
|
|
||||||
| ^^^^^^^^^
|
|
||||||
|
|
||||||
Future breakage diagnostic:
|
|
||||||
error: any use of this value will cause an error
|
|
||||||
--> $DIR/const-eval-overflow2c.rs:28:6
|
|
||||||
|
|
|
||||||
LL | const VALS_I32: (i32,) =
|
|
||||||
| ----------------------
|
|
||||||
LL | (
|
|
||||||
LL | i32::MIN * 2,
|
|
||||||
| ^^^^^^^^^^^^ attempt to compute `i32::MIN * 2_i32`, which would overflow
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
note: the lint level is defined here
|
|
||||||
--> $DIR/const-eval-overflow2c.rs:8:9
|
|
||||||
|
|
|
||||||
LL | #![deny(const_err)]
|
|
||||||
| ^^^^^^^^^
|
|
||||||
|
|
||||||
Future breakage diagnostic:
|
|
||||||
error: any use of this value will cause an error
|
|
||||||
--> $DIR/const-eval-overflow2c.rs:35:6
|
|
||||||
|
|
|
||||||
LL | const VALS_I64: (i64,) =
|
|
||||||
| ----------------------
|
|
||||||
LL | (
|
|
||||||
LL | i64::MIN * 2,
|
|
||||||
| ^^^^^^^^^^^^ attempt to compute `i64::MIN * 2_i64`, which would overflow
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
note: the lint level is defined here
|
|
||||||
--> $DIR/const-eval-overflow2c.rs:8:9
|
|
||||||
|
|
|
||||||
LL | #![deny(const_err)]
|
|
||||||
| ^^^^^^^^^
|
|
||||||
|
|
||||||
Future breakage diagnostic:
|
|
||||||
error: any use of this value will cause an error
|
|
||||||
--> $DIR/const-eval-overflow2c.rs:42:6
|
|
||||||
|
|
|
||||||
LL | const VALS_U8: (u8,) =
|
|
||||||
| --------------------
|
|
||||||
LL | (
|
|
||||||
LL | u8::MAX * 2,
|
|
||||||
| ^^^^^^^^^^^ attempt to compute `u8::MAX * 2_u8`, which would overflow
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
note: the lint level is defined here
|
|
||||||
--> $DIR/const-eval-overflow2c.rs:8:9
|
|
||||||
|
|
|
||||||
LL | #![deny(const_err)]
|
|
||||||
| ^^^^^^^^^
|
|
||||||
|
|
||||||
Future breakage diagnostic:
|
|
||||||
error: any use of this value will cause an error
|
|
||||||
--> $DIR/const-eval-overflow2c.rs:48:6
|
|
||||||
|
|
|
||||||
LL | const VALS_U16: (u16,) = (
|
|
||||||
| ----------------------
|
|
||||||
LL | u16::MAX * 2,
|
|
||||||
| ^^^^^^^^^^^^ attempt to compute `u16::MAX * 2_u16`, which would overflow
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
note: the lint level is defined here
|
|
||||||
--> $DIR/const-eval-overflow2c.rs:8:9
|
|
||||||
|
|
|
||||||
LL | #![deny(const_err)]
|
|
||||||
| ^^^^^^^^^
|
|
||||||
|
|
||||||
Future breakage diagnostic:
|
|
||||||
error: any use of this value will cause an error
|
|
||||||
--> $DIR/const-eval-overflow2c.rs:54:6
|
|
||||||
|
|
|
||||||
LL | const VALS_U32: (u32,) = (
|
|
||||||
| ----------------------
|
|
||||||
LL | u32::MAX * 2,
|
|
||||||
| ^^^^^^^^^^^^ attempt to compute `u32::MAX * 2_u32`, which would overflow
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
note: the lint level is defined here
|
|
||||||
--> $DIR/const-eval-overflow2c.rs:8:9
|
|
||||||
|
|
|
||||||
LL | #![deny(const_err)]
|
|
||||||
| ^^^^^^^^^
|
|
||||||
|
|
||||||
Future breakage diagnostic:
|
|
||||||
error: any use of this value will cause an error
|
|
||||||
--> $DIR/const-eval-overflow2c.rs:61:6
|
|
||||||
|
|
|
||||||
LL | const VALS_U64: (u64,) =
|
|
||||||
| ----------------------
|
|
||||||
LL | (
|
|
||||||
LL | u64::MAX * 2,
|
|
||||||
| ^^^^^^^^^^^^ attempt to compute `u64::MAX * 2_u64`, which would overflow
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
note: the lint level is defined here
|
|
||||||
--> $DIR/const-eval-overflow2c.rs:8:9
|
|
||||||
|
|
|
||||||
LL | #![deny(const_err)]
|
|
||||||
| ^^^^^^^^^
|
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
// compile-flags: -Ztreat-err-as-bug=2
|
// compile-flags: -Ztreat-err-as-bug=1
|
||||||
// build-fail
|
|
||||||
// failure-status: 101
|
// failure-status: 101
|
||||||
// rustc-env:RUST_BACKTRACE=1
|
// rustc-env:RUST_BACKTRACE=1
|
||||||
// normalize-stderr-test "\nerror: internal compiler error.*\n\n" -> ""
|
// normalize-stderr-test "\nerror: internal compiler error.*\n\n" -> ""
|
||||||
|
@ -15,14 +14,9 @@
|
||||||
|
|
||||||
#![allow(unconditional_panic)]
|
#![allow(unconditional_panic)]
|
||||||
|
|
||||||
#[warn(const_err)]
|
const X: i32 = 1 / 0; //~ERROR constant
|
||||||
const X: i32 = 1 / 0; //~WARN any use of this value will cause an error
|
|
||||||
//~| WARN this was previously accepted by the compiler but is being phased out
|
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let x: &'static i32 = &X;
|
let x: &'static i32 = &X;
|
||||||
//~^ ERROR evaluation of constant value failed
|
|
||||||
//~| ERROR erroneous constant used
|
|
||||||
//~| WARNING this was previously accepted by the compiler
|
|
||||||
println!("x={}", x);
|
println!("x={}", x);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,61 +1,13 @@
|
||||||
warning: any use of this value will cause an error
|
error[E0080]: evaluation of constant value failed
|
||||||
--> $DIR/const-eval-query-stack.rs:19:16
|
--> $DIR/const-eval-query-stack.rs:17:16
|
||||||
|
|
|
|
||||||
LL | const X: i32 = 1 / 0;
|
LL | const X: i32 = 1 / 0;
|
||||||
| ------------ ^^^^^ attempt to divide `1_i32` by zero
|
| ^^^^^ attempt to divide `1_i32` by zero
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
note: the lint level is defined here
|
|
||||||
--> $DIR/const-eval-query-stack.rs:18:8
|
|
||||||
|
|
|
||||||
LL | #[warn(const_err)]
|
|
||||||
| ^^^^^^^^^
|
|
||||||
|
|
||||||
error[E0080]: evaluation of constant value failed
|
|
||||||
--> $DIR/const-eval-query-stack.rs:23:28
|
|
||||||
|
|
|
||||||
LL | let x: &'static i32 = &X;
|
|
||||||
| ^ referenced constant has errors
|
|
||||||
|
|
||||||
error: erroneous constant used
|
|
||||||
--> $DIR/const-eval-query-stack.rs:23:27
|
|
||||||
|
|
|
||||||
LL | let x: &'static i32 = &X;
|
|
||||||
| ^^ referenced constant has errors
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
= note: `#[deny(const_err)]` on by default
|
|
||||||
|
|
||||||
query stack during panic:
|
query stack during panic:
|
||||||
#0 [mir_drops_elaborated_and_const_checked] elaborating drops for `main`
|
#0 [eval_to_allocation_raw] const-evaluating + checking `X`
|
||||||
#1 [optimized_mir] optimizing MIR for `main`
|
#1 [eval_to_const_value_raw] simplifying constant for the type system `X`
|
||||||
#2 [collect_and_partition_mono_items] collect_and_partition_mono_items
|
#2 [eval_to_const_value_raw] simplifying constant for the type system `X`
|
||||||
|
#3 [lint_mod] linting top-level module
|
||||||
|
#4 [analysis] running analysis passes on this crate
|
||||||
end of query stack
|
end of query stack
|
||||||
Future incompatibility report: Future breakage diagnostic:
|
|
||||||
warning: any use of this value will cause an error
|
|
||||||
--> $DIR/const-eval-query-stack.rs:19:16
|
|
||||||
|
|
|
||||||
LL | const X: i32 = 1 / 0;
|
|
||||||
| ------------ ^^^^^ attempt to divide `1_i32` by zero
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
note: the lint level is defined here
|
|
||||||
--> $DIR/const-eval-query-stack.rs:18:8
|
|
||||||
|
|
|
||||||
LL | #[warn(const_err)]
|
|
||||||
| ^^^^^^^^^
|
|
||||||
|
|
||||||
Future breakage diagnostic:
|
|
||||||
error: erroneous constant used
|
|
||||||
--> $DIR/const-eval-query-stack.rs:23:27
|
|
||||||
|
|
|
||||||
LL | let x: &'static i32 = &X;
|
|
||||||
| ^^ referenced constant has errors
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
= note: `#[deny(const_err)]` on by default
|
|
||||||
|
|
||||||
|
|
|
@ -1,664 +1,258 @@
|
||||||
error: any use of this value will cause an error
|
error[E0080]: evaluation of constant value failed
|
||||||
--> $DIR/const-pointer-values-in-various-types.rs:26:49
|
--> $DIR/const-pointer-values-in-various-types.rs:26:49
|
||||||
|
|
|
|
||||||
LL | const I32_REF_USIZE_UNION: usize = unsafe { Nonsense { int_32_ref: &3 }.u };
|
LL | const I32_REF_USIZE_UNION: usize = unsafe { Nonsense { int_32_ref: &3 }.u };
|
||||||
| -------------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
|
||||||
|
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
= help: this code performed an operation that depends on the underlying bytes representing a pointer
|
|
||||||
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
|
|
||||||
= note: `#[deny(const_err)]` on by default
|
|
||||||
|
|
||||||
error: any use of this value will cause an error
|
|
||||||
--> $DIR/const-pointer-values-in-various-types.rs:30:43
|
|
||||||
|
|
|
||||||
LL | const I32_REF_U8_UNION: u8 = unsafe { Nonsense { int_32_ref: &3 }.uint_8 };
|
|
||||||
| -------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
= help: this code performed an operation that depends on the underlying bytes representing a pointer
|
|
||||||
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
|
|
||||||
|
|
||||||
error: any use of this value will cause an error
|
|
||||||
--> $DIR/const-pointer-values-in-various-types.rs:34:45
|
|
||||||
|
|
|
||||||
LL | const I32_REF_U16_UNION: u16 = unsafe { Nonsense { int_32_ref: &3 }.uint_16 };
|
|
||||||
| ---------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
= help: this code performed an operation that depends on the underlying bytes representing a pointer
|
|
||||||
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
|
|
||||||
|
|
||||||
error: any use of this value will cause an error
|
|
||||||
--> $DIR/const-pointer-values-in-various-types.rs:38:45
|
|
||||||
|
|
|
||||||
LL | const I32_REF_U32_UNION: u32 = unsafe { Nonsense { int_32_ref: &3 }.uint_32 };
|
|
||||||
| ---------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
= help: this code performed an operation that depends on the underlying bytes representing a pointer
|
|
||||||
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
|
|
||||||
|
|
||||||
error: any use of this value will cause an error
|
|
||||||
--> $DIR/const-pointer-values-in-various-types.rs:42:45
|
|
||||||
|
|
|
||||||
LL | const I32_REF_U64_UNION: u64 = unsafe { Nonsense { int_32_ref: &3 }.uint_64 };
|
|
||||||
| ---------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
= help: this code performed an operation that depends on the underlying bytes representing a pointer
|
= help: this code performed an operation that depends on the underlying bytes representing a pointer
|
||||||
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
|
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
|
||||||
|
|
||||||
error[E0080]: evaluation of constant value failed
|
error[E0080]: evaluation of constant value failed
|
||||||
--> $DIR/const-pointer-values-in-various-types.rs:46:47
|
--> $DIR/const-pointer-values-in-various-types.rs:29:43
|
||||||
|
|
|
||||||
|
LL | const I32_REF_U8_UNION: u8 = unsafe { Nonsense { int_32_ref: &3 }.uint_8 };
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
|
||||||
|
|
|
||||||
|
= help: this code performed an operation that depends on the underlying bytes representing a pointer
|
||||||
|
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
|
||||||
|
|
||||||
|
error[E0080]: evaluation of constant value failed
|
||||||
|
--> $DIR/const-pointer-values-in-various-types.rs:32:45
|
||||||
|
|
|
||||||
|
LL | const I32_REF_U16_UNION: u16 = unsafe { Nonsense { int_32_ref: &3 }.uint_16 };
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
|
||||||
|
|
|
||||||
|
= help: this code performed an operation that depends on the underlying bytes representing a pointer
|
||||||
|
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
|
||||||
|
|
||||||
|
error[E0080]: evaluation of constant value failed
|
||||||
|
--> $DIR/const-pointer-values-in-various-types.rs:35:45
|
||||||
|
|
|
||||||
|
LL | const I32_REF_U32_UNION: u32 = unsafe { Nonsense { int_32_ref: &3 }.uint_32 };
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
|
||||||
|
|
|
||||||
|
= help: this code performed an operation that depends on the underlying bytes representing a pointer
|
||||||
|
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
|
||||||
|
|
||||||
|
error[E0080]: evaluation of constant value failed
|
||||||
|
--> $DIR/const-pointer-values-in-various-types.rs:38:45
|
||||||
|
|
|
||||||
|
LL | const I32_REF_U64_UNION: u64 = unsafe { Nonsense { int_32_ref: &3 }.uint_64 };
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
|
||||||
|
|
|
||||||
|
= help: this code performed an operation that depends on the underlying bytes representing a pointer
|
||||||
|
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
|
||||||
|
|
||||||
|
error[E0080]: evaluation of constant value failed
|
||||||
|
--> $DIR/const-pointer-values-in-various-types.rs:41:47
|
||||||
|
|
|
|
||||||
LL | const I32_REF_U128_UNION: u128 = unsafe { Nonsense { int_32_ref: &3 }.uint_128 };
|
LL | const I32_REF_U128_UNION: u128 = unsafe { Nonsense { int_32_ref: &3 }.uint_128 };
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory
|
||||||
|
|
||||||
error: any use of this value will cause an error
|
error[E0080]: evaluation of constant value failed
|
||||||
--> $DIR/const-pointer-values-in-various-types.rs:50:43
|
--> $DIR/const-pointer-values-in-various-types.rs:45:43
|
||||||
|
|
|
|
||||||
LL | const I32_REF_I8_UNION: i8 = unsafe { Nonsense { int_32_ref: &3 }.int_8 };
|
LL | const I32_REF_I8_UNION: i8 = unsafe { Nonsense { int_32_ref: &3 }.int_8 };
|
||||||
| -------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
|
||||||
|
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
= help: this code performed an operation that depends on the underlying bytes representing a pointer
|
|
||||||
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
|
|
||||||
|
|
||||||
error: any use of this value will cause an error
|
|
||||||
--> $DIR/const-pointer-values-in-various-types.rs:54:45
|
|
||||||
|
|
|
||||||
LL | const I32_REF_I16_UNION: i16 = unsafe { Nonsense { int_32_ref: &3 }.int_16 };
|
|
||||||
| ---------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
= help: this code performed an operation that depends on the underlying bytes representing a pointer
|
|
||||||
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
|
|
||||||
|
|
||||||
error: any use of this value will cause an error
|
|
||||||
--> $DIR/const-pointer-values-in-various-types.rs:58:45
|
|
||||||
|
|
|
||||||
LL | const I32_REF_I32_UNION: i32 = unsafe { Nonsense { int_32_ref: &3 }.int_32 };
|
|
||||||
| ---------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
= help: this code performed an operation that depends on the underlying bytes representing a pointer
|
|
||||||
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
|
|
||||||
|
|
||||||
error: any use of this value will cause an error
|
|
||||||
--> $DIR/const-pointer-values-in-various-types.rs:62:45
|
|
||||||
|
|
|
||||||
LL | const I32_REF_I64_UNION: i64 = unsafe { Nonsense { int_32_ref: &3 }.int_64 };
|
|
||||||
| ---------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
= help: this code performed an operation that depends on the underlying bytes representing a pointer
|
= help: this code performed an operation that depends on the underlying bytes representing a pointer
|
||||||
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
|
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
|
||||||
|
|
||||||
error[E0080]: evaluation of constant value failed
|
error[E0080]: evaluation of constant value failed
|
||||||
--> $DIR/const-pointer-values-in-various-types.rs:66:47
|
--> $DIR/const-pointer-values-in-various-types.rs:48:45
|
||||||
|
|
|
||||||
|
LL | const I32_REF_I16_UNION: i16 = unsafe { Nonsense { int_32_ref: &3 }.int_16 };
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
|
||||||
|
|
|
||||||
|
= help: this code performed an operation that depends on the underlying bytes representing a pointer
|
||||||
|
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
|
||||||
|
|
||||||
|
error[E0080]: evaluation of constant value failed
|
||||||
|
--> $DIR/const-pointer-values-in-various-types.rs:51:45
|
||||||
|
|
|
||||||
|
LL | const I32_REF_I32_UNION: i32 = unsafe { Nonsense { int_32_ref: &3 }.int_32 };
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
|
||||||
|
|
|
||||||
|
= help: this code performed an operation that depends on the underlying bytes representing a pointer
|
||||||
|
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
|
||||||
|
|
||||||
|
error[E0080]: evaluation of constant value failed
|
||||||
|
--> $DIR/const-pointer-values-in-various-types.rs:54:45
|
||||||
|
|
|
||||||
|
LL | const I32_REF_I64_UNION: i64 = unsafe { Nonsense { int_32_ref: &3 }.int_64 };
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
|
||||||
|
|
|
||||||
|
= help: this code performed an operation that depends on the underlying bytes representing a pointer
|
||||||
|
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
|
||||||
|
|
||||||
|
error[E0080]: evaluation of constant value failed
|
||||||
|
--> $DIR/const-pointer-values-in-various-types.rs:57:47
|
||||||
|
|
|
|
||||||
LL | const I32_REF_I128_UNION: i128 = unsafe { Nonsense { int_32_ref: &3 }.int_128 };
|
LL | const I32_REF_I128_UNION: i128 = unsafe { Nonsense { int_32_ref: &3 }.int_128 };
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory
|
||||||
|
|
||||||
error: any use of this value will cause an error
|
error[E0080]: evaluation of constant value failed
|
||||||
--> $DIR/const-pointer-values-in-various-types.rs:70:45
|
--> $DIR/const-pointer-values-in-various-types.rs:61:45
|
||||||
|
|
|
|
||||||
LL | const I32_REF_F32_UNION: f32 = unsafe { Nonsense { int_32_ref: &3 }.float_32 };
|
LL | const I32_REF_F32_UNION: f32 = unsafe { Nonsense { int_32_ref: &3 }.float_32 };
|
||||||
| ---------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
|
||||||
|
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
= help: this code performed an operation that depends on the underlying bytes representing a pointer
|
= help: this code performed an operation that depends on the underlying bytes representing a pointer
|
||||||
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
|
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
|
||||||
|
|
||||||
error: any use of this value will cause an error
|
error[E0080]: evaluation of constant value failed
|
||||||
--> $DIR/const-pointer-values-in-various-types.rs:74:45
|
--> $DIR/const-pointer-values-in-various-types.rs:64:45
|
||||||
|
|
|
|
||||||
LL | const I32_REF_F64_UNION: f64 = unsafe { Nonsense { int_32_ref: &3 }.float_64 };
|
LL | const I32_REF_F64_UNION: f64 = unsafe { Nonsense { int_32_ref: &3 }.float_64 };
|
||||||
| ---------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
|
||||||
|
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
= help: this code performed an operation that depends on the underlying bytes representing a pointer
|
= help: this code performed an operation that depends on the underlying bytes representing a pointer
|
||||||
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
|
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
|
||||||
|
|
||||||
error: any use of this value will cause an error
|
error[E0080]: evaluation of constant value failed
|
||||||
--> $DIR/const-pointer-values-in-various-types.rs:78:47
|
--> $DIR/const-pointer-values-in-various-types.rs:67:47
|
||||||
|
|
|
|
||||||
LL | const I32_REF_BOOL_UNION: bool = unsafe { Nonsense { int_32_ref: &3 }.truthy_falsey };
|
LL | const I32_REF_BOOL_UNION: bool = unsafe { Nonsense { int_32_ref: &3 }.truthy_falsey };
|
||||||
| ------------------------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
|
||||||
|
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
= help: this code performed an operation that depends on the underlying bytes representing a pointer
|
= help: this code performed an operation that depends on the underlying bytes representing a pointer
|
||||||
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
|
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
|
||||||
|
|
||||||
error: any use of this value will cause an error
|
error[E0080]: evaluation of constant value failed
|
||||||
--> $DIR/const-pointer-values-in-various-types.rs:82:47
|
--> $DIR/const-pointer-values-in-various-types.rs:70:47
|
||||||
|
|
|
|
||||||
LL | const I32_REF_CHAR_UNION: char = unsafe { Nonsense { int_32_ref: &3 }.character };
|
LL | const I32_REF_CHAR_UNION: char = unsafe { Nonsense { int_32_ref: &3 }.character };
|
||||||
| ------------------------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
|
||||||
|
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
= help: this code performed an operation that depends on the underlying bytes representing a pointer
|
= help: this code performed an operation that depends on the underlying bytes representing a pointer
|
||||||
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
|
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
|
||||||
|
|
||||||
error: any use of this value will cause an error
|
error[E0080]: evaluation of constant value failed
|
||||||
--> $DIR/const-pointer-values-in-various-types.rs:86:39
|
--> $DIR/const-pointer-values-in-various-types.rs:73:39
|
||||||
|
|
|
|
||||||
LL | const STR_U8_UNION: u8 = unsafe { Nonsense { stringy: "3" }.uint_8 };
|
LL | const STR_U8_UNION: u8 = unsafe { Nonsense { stringy: "3" }.uint_8 };
|
||||||
| ---------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
|
||||||
|
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
= help: this code performed an operation that depends on the underlying bytes representing a pointer
|
= help: this code performed an operation that depends on the underlying bytes representing a pointer
|
||||||
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
|
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
|
||||||
|
|
||||||
error: any use of this value will cause an error
|
error[E0080]: evaluation of constant value failed
|
||||||
--> $DIR/const-pointer-values-in-various-types.rs:90:41
|
--> $DIR/const-pointer-values-in-various-types.rs:76:41
|
||||||
|
|
|
|
||||||
LL | const STR_U16_UNION: u16 = unsafe { Nonsense { stringy: "3" }.uint_16 };
|
LL | const STR_U16_UNION: u16 = unsafe { Nonsense { stringy: "3" }.uint_16 };
|
||||||
| ------------------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
|
||||||
|
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
= help: this code performed an operation that depends on the underlying bytes representing a pointer
|
= help: this code performed an operation that depends on the underlying bytes representing a pointer
|
||||||
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
|
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
|
||||||
|
|
||||||
error: any use of this value will cause an error
|
error[E0080]: evaluation of constant value failed
|
||||||
--> $DIR/const-pointer-values-in-various-types.rs:94:41
|
--> $DIR/const-pointer-values-in-various-types.rs:79:41
|
||||||
|
|
|
|
||||||
LL | const STR_U32_UNION: u32 = unsafe { Nonsense { stringy: "3" }.uint_32 };
|
LL | const STR_U32_UNION: u32 = unsafe { Nonsense { stringy: "3" }.uint_32 };
|
||||||
| ------------------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
|
||||||
|
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
= help: this code performed an operation that depends on the underlying bytes representing a pointer
|
= help: this code performed an operation that depends on the underlying bytes representing a pointer
|
||||||
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
|
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
|
||||||
|
|
||||||
error: any use of this value will cause an error
|
error[E0080]: evaluation of constant value failed
|
||||||
--> $DIR/const-pointer-values-in-various-types.rs:98:41
|
--> $DIR/const-pointer-values-in-various-types.rs:82:41
|
||||||
|
|
|
|
||||||
LL | const STR_U64_UNION: u64 = unsafe { Nonsense { stringy: "3" }.uint_64 };
|
LL | const STR_U64_UNION: u64 = unsafe { Nonsense { stringy: "3" }.uint_64 };
|
||||||
| ------------------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
|
||||||
|
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
= help: this code performed an operation that depends on the underlying bytes representing a pointer
|
= help: this code performed an operation that depends on the underlying bytes representing a pointer
|
||||||
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
|
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
|
||||||
|
|
||||||
error: any use of this value will cause an error
|
error[E0080]: evaluation of constant value failed
|
||||||
--> $DIR/const-pointer-values-in-various-types.rs:102:43
|
--> $DIR/const-pointer-values-in-various-types.rs:85:43
|
||||||
|
|
|
|
||||||
LL | const STR_U128_UNION: u128 = unsafe { Nonsense { stringy: "3" }.uint_128 };
|
LL | const STR_U128_UNION: u128 = unsafe { Nonsense { stringy: "3" }.uint_128 };
|
||||||
| -------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
|
||||||
|
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
= help: this code performed an operation that depends on the underlying bytes representing a pointer
|
= help: this code performed an operation that depends on the underlying bytes representing a pointer
|
||||||
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
|
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
|
||||||
|
|
||||||
error: any use of this value will cause an error
|
error[E0080]: evaluation of constant value failed
|
||||||
--> $DIR/const-pointer-values-in-various-types.rs:106:39
|
--> $DIR/const-pointer-values-in-various-types.rs:88:39
|
||||||
|
|
|
|
||||||
LL | const STR_I8_UNION: i8 = unsafe { Nonsense { stringy: "3" }.int_8 };
|
LL | const STR_I8_UNION: i8 = unsafe { Nonsense { stringy: "3" }.int_8 };
|
||||||
| ---------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
|
||||||
|
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
= help: this code performed an operation that depends on the underlying bytes representing a pointer
|
= help: this code performed an operation that depends on the underlying bytes representing a pointer
|
||||||
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
|
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
|
||||||
|
|
||||||
error: any use of this value will cause an error
|
error[E0080]: evaluation of constant value failed
|
||||||
--> $DIR/const-pointer-values-in-various-types.rs:110:41
|
--> $DIR/const-pointer-values-in-various-types.rs:91:41
|
||||||
|
|
|
|
||||||
LL | const STR_I16_UNION: i16 = unsafe { Nonsense { stringy: "3" }.int_16 };
|
LL | const STR_I16_UNION: i16 = unsafe { Nonsense { stringy: "3" }.int_16 };
|
||||||
| ------------------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
|
||||||
|
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
= help: this code performed an operation that depends on the underlying bytes representing a pointer
|
= help: this code performed an operation that depends on the underlying bytes representing a pointer
|
||||||
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
|
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
|
||||||
|
|
||||||
error: any use of this value will cause an error
|
error[E0080]: evaluation of constant value failed
|
||||||
--> $DIR/const-pointer-values-in-various-types.rs:114:41
|
--> $DIR/const-pointer-values-in-various-types.rs:94:41
|
||||||
|
|
|
|
||||||
LL | const STR_I32_UNION: i32 = unsafe { Nonsense { stringy: "3" }.int_32 };
|
LL | const STR_I32_UNION: i32 = unsafe { Nonsense { stringy: "3" }.int_32 };
|
||||||
| ------------------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
|
||||||
|
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
= help: this code performed an operation that depends on the underlying bytes representing a pointer
|
= help: this code performed an operation that depends on the underlying bytes representing a pointer
|
||||||
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
|
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
|
||||||
|
|
||||||
error: any use of this value will cause an error
|
error[E0080]: evaluation of constant value failed
|
||||||
--> $DIR/const-pointer-values-in-various-types.rs:118:41
|
--> $DIR/const-pointer-values-in-various-types.rs:97:41
|
||||||
|
|
|
|
||||||
LL | const STR_I64_UNION: i64 = unsafe { Nonsense { stringy: "3" }.int_64 };
|
LL | const STR_I64_UNION: i64 = unsafe { Nonsense { stringy: "3" }.int_64 };
|
||||||
| ------------------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
|
||||||
|
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
= help: this code performed an operation that depends on the underlying bytes representing a pointer
|
= help: this code performed an operation that depends on the underlying bytes representing a pointer
|
||||||
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
|
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
|
||||||
|
|
||||||
error: any use of this value will cause an error
|
error[E0080]: evaluation of constant value failed
|
||||||
--> $DIR/const-pointer-values-in-various-types.rs:122:43
|
--> $DIR/const-pointer-values-in-various-types.rs:100:43
|
||||||
|
|
|
|
||||||
LL | const STR_I128_UNION: i128 = unsafe { Nonsense { stringy: "3" }.int_128 };
|
LL | const STR_I128_UNION: i128 = unsafe { Nonsense { stringy: "3" }.int_128 };
|
||||||
| -------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
|
||||||
|
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
= help: this code performed an operation that depends on the underlying bytes representing a pointer
|
= help: this code performed an operation that depends on the underlying bytes representing a pointer
|
||||||
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
|
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
|
||||||
|
|
||||||
error: any use of this value will cause an error
|
error[E0080]: evaluation of constant value failed
|
||||||
--> $DIR/const-pointer-values-in-various-types.rs:126:41
|
--> $DIR/const-pointer-values-in-various-types.rs:103:41
|
||||||
|
|
|
|
||||||
LL | const STR_F32_UNION: f32 = unsafe { Nonsense { stringy: "3" }.float_32 };
|
LL | const STR_F32_UNION: f32 = unsafe { Nonsense { stringy: "3" }.float_32 };
|
||||||
| ------------------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
|
||||||
|
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
= help: this code performed an operation that depends on the underlying bytes representing a pointer
|
= help: this code performed an operation that depends on the underlying bytes representing a pointer
|
||||||
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
|
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
|
||||||
|
|
||||||
error: any use of this value will cause an error
|
error[E0080]: evaluation of constant value failed
|
||||||
--> $DIR/const-pointer-values-in-various-types.rs:130:41
|
--> $DIR/const-pointer-values-in-various-types.rs:106:41
|
||||||
|
|
|
|
||||||
LL | const STR_F64_UNION: f64 = unsafe { Nonsense { stringy: "3" }.float_64 };
|
LL | const STR_F64_UNION: f64 = unsafe { Nonsense { stringy: "3" }.float_64 };
|
||||||
| ------------------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
|
||||||
|
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
= help: this code performed an operation that depends on the underlying bytes representing a pointer
|
= help: this code performed an operation that depends on the underlying bytes representing a pointer
|
||||||
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
|
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
|
||||||
|
|
||||||
error: any use of this value will cause an error
|
error[E0080]: evaluation of constant value failed
|
||||||
--> $DIR/const-pointer-values-in-various-types.rs:134:43
|
--> $DIR/const-pointer-values-in-various-types.rs:109:43
|
||||||
|
|
|
|
||||||
LL | const STR_BOOL_UNION: bool = unsafe { Nonsense { stringy: "3" }.truthy_falsey };
|
LL | const STR_BOOL_UNION: bool = unsafe { Nonsense { stringy: "3" }.truthy_falsey };
|
||||||
| -------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
|
||||||
|
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
= help: this code performed an operation that depends on the underlying bytes representing a pointer
|
= help: this code performed an operation that depends on the underlying bytes representing a pointer
|
||||||
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
|
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
|
||||||
|
|
||||||
error: any use of this value will cause an error
|
error[E0080]: evaluation of constant value failed
|
||||||
--> $DIR/const-pointer-values-in-various-types.rs:138:43
|
--> $DIR/const-pointer-values-in-various-types.rs:112:43
|
||||||
|
|
|
|
||||||
LL | const STR_CHAR_UNION: char = unsafe { Nonsense { stringy: "3" }.character };
|
LL | const STR_CHAR_UNION: char = unsafe { Nonsense { stringy: "3" }.character };
|
||||||
| -------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
|
||||||
|
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
= help: this code performed an operation that depends on the underlying bytes representing a pointer
|
= help: this code performed an operation that depends on the underlying bytes representing a pointer
|
||||||
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
|
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
|
||||||
|
|
||||||
error: aborting due to 29 previous errors
|
error: aborting due to 29 previous errors
|
||||||
|
|
||||||
For more information about this error, try `rustc --explain E0080`.
|
For more information about this error, try `rustc --explain E0080`.
|
||||||
Future incompatibility report: Future breakage diagnostic:
|
|
||||||
error: any use of this value will cause an error
|
|
||||||
--> $DIR/const-pointer-values-in-various-types.rs:26:49
|
|
||||||
|
|
|
||||||
LL | const I32_REF_USIZE_UNION: usize = unsafe { Nonsense { int_32_ref: &3 }.u };
|
|
||||||
| -------------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
= help: this code performed an operation that depends on the underlying bytes representing a pointer
|
|
||||||
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
|
|
||||||
= note: `#[deny(const_err)]` on by default
|
|
||||||
|
|
||||||
Future breakage diagnostic:
|
|
||||||
error: any use of this value will cause an error
|
|
||||||
--> $DIR/const-pointer-values-in-various-types.rs:30:43
|
|
||||||
|
|
|
||||||
LL | const I32_REF_U8_UNION: u8 = unsafe { Nonsense { int_32_ref: &3 }.uint_8 };
|
|
||||||
| -------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
= help: this code performed an operation that depends on the underlying bytes representing a pointer
|
|
||||||
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
|
|
||||||
= note: `#[deny(const_err)]` on by default
|
|
||||||
|
|
||||||
Future breakage diagnostic:
|
|
||||||
error: any use of this value will cause an error
|
|
||||||
--> $DIR/const-pointer-values-in-various-types.rs:34:45
|
|
||||||
|
|
|
||||||
LL | const I32_REF_U16_UNION: u16 = unsafe { Nonsense { int_32_ref: &3 }.uint_16 };
|
|
||||||
| ---------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
= help: this code performed an operation that depends on the underlying bytes representing a pointer
|
|
||||||
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
|
|
||||||
= note: `#[deny(const_err)]` on by default
|
|
||||||
|
|
||||||
Future breakage diagnostic:
|
|
||||||
error: any use of this value will cause an error
|
|
||||||
--> $DIR/const-pointer-values-in-various-types.rs:38:45
|
|
||||||
|
|
|
||||||
LL | const I32_REF_U32_UNION: u32 = unsafe { Nonsense { int_32_ref: &3 }.uint_32 };
|
|
||||||
| ---------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
= help: this code performed an operation that depends on the underlying bytes representing a pointer
|
|
||||||
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
|
|
||||||
= note: `#[deny(const_err)]` on by default
|
|
||||||
|
|
||||||
Future breakage diagnostic:
|
|
||||||
error: any use of this value will cause an error
|
|
||||||
--> $DIR/const-pointer-values-in-various-types.rs:42:45
|
|
||||||
|
|
|
||||||
LL | const I32_REF_U64_UNION: u64 = unsafe { Nonsense { int_32_ref: &3 }.uint_64 };
|
|
||||||
| ---------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
= help: this code performed an operation that depends on the underlying bytes representing a pointer
|
|
||||||
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
|
|
||||||
= note: `#[deny(const_err)]` on by default
|
|
||||||
|
|
||||||
Future breakage diagnostic:
|
|
||||||
error: any use of this value will cause an error
|
|
||||||
--> $DIR/const-pointer-values-in-various-types.rs:50:43
|
|
||||||
|
|
|
||||||
LL | const I32_REF_I8_UNION: i8 = unsafe { Nonsense { int_32_ref: &3 }.int_8 };
|
|
||||||
| -------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
= help: this code performed an operation that depends on the underlying bytes representing a pointer
|
|
||||||
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
|
|
||||||
= note: `#[deny(const_err)]` on by default
|
|
||||||
|
|
||||||
Future breakage diagnostic:
|
|
||||||
error: any use of this value will cause an error
|
|
||||||
--> $DIR/const-pointer-values-in-various-types.rs:54:45
|
|
||||||
|
|
|
||||||
LL | const I32_REF_I16_UNION: i16 = unsafe { Nonsense { int_32_ref: &3 }.int_16 };
|
|
||||||
| ---------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
= help: this code performed an operation that depends on the underlying bytes representing a pointer
|
|
||||||
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
|
|
||||||
= note: `#[deny(const_err)]` on by default
|
|
||||||
|
|
||||||
Future breakage diagnostic:
|
|
||||||
error: any use of this value will cause an error
|
|
||||||
--> $DIR/const-pointer-values-in-various-types.rs:58:45
|
|
||||||
|
|
|
||||||
LL | const I32_REF_I32_UNION: i32 = unsafe { Nonsense { int_32_ref: &3 }.int_32 };
|
|
||||||
| ---------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
= help: this code performed an operation that depends on the underlying bytes representing a pointer
|
|
||||||
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
|
|
||||||
= note: `#[deny(const_err)]` on by default
|
|
||||||
|
|
||||||
Future breakage diagnostic:
|
|
||||||
error: any use of this value will cause an error
|
|
||||||
--> $DIR/const-pointer-values-in-various-types.rs:62:45
|
|
||||||
|
|
|
||||||
LL | const I32_REF_I64_UNION: i64 = unsafe { Nonsense { int_32_ref: &3 }.int_64 };
|
|
||||||
| ---------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
= help: this code performed an operation that depends on the underlying bytes representing a pointer
|
|
||||||
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
|
|
||||||
= note: `#[deny(const_err)]` on by default
|
|
||||||
|
|
||||||
Future breakage diagnostic:
|
|
||||||
error: any use of this value will cause an error
|
|
||||||
--> $DIR/const-pointer-values-in-various-types.rs:70:45
|
|
||||||
|
|
|
||||||
LL | const I32_REF_F32_UNION: f32 = unsafe { Nonsense { int_32_ref: &3 }.float_32 };
|
|
||||||
| ---------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
= help: this code performed an operation that depends on the underlying bytes representing a pointer
|
|
||||||
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
|
|
||||||
= note: `#[deny(const_err)]` on by default
|
|
||||||
|
|
||||||
Future breakage diagnostic:
|
|
||||||
error: any use of this value will cause an error
|
|
||||||
--> $DIR/const-pointer-values-in-various-types.rs:74:45
|
|
||||||
|
|
|
||||||
LL | const I32_REF_F64_UNION: f64 = unsafe { Nonsense { int_32_ref: &3 }.float_64 };
|
|
||||||
| ---------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
= help: this code performed an operation that depends on the underlying bytes representing a pointer
|
|
||||||
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
|
|
||||||
= note: `#[deny(const_err)]` on by default
|
|
||||||
|
|
||||||
Future breakage diagnostic:
|
|
||||||
error: any use of this value will cause an error
|
|
||||||
--> $DIR/const-pointer-values-in-various-types.rs:78:47
|
|
||||||
|
|
|
||||||
LL | const I32_REF_BOOL_UNION: bool = unsafe { Nonsense { int_32_ref: &3 }.truthy_falsey };
|
|
||||||
| ------------------------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
= help: this code performed an operation that depends on the underlying bytes representing a pointer
|
|
||||||
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
|
|
||||||
= note: `#[deny(const_err)]` on by default
|
|
||||||
|
|
||||||
Future breakage diagnostic:
|
|
||||||
error: any use of this value will cause an error
|
|
||||||
--> $DIR/const-pointer-values-in-various-types.rs:82:47
|
|
||||||
|
|
|
||||||
LL | const I32_REF_CHAR_UNION: char = unsafe { Nonsense { int_32_ref: &3 }.character };
|
|
||||||
| ------------------------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
= help: this code performed an operation that depends on the underlying bytes representing a pointer
|
|
||||||
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
|
|
||||||
= note: `#[deny(const_err)]` on by default
|
|
||||||
|
|
||||||
Future breakage diagnostic:
|
|
||||||
error: any use of this value will cause an error
|
|
||||||
--> $DIR/const-pointer-values-in-various-types.rs:86:39
|
|
||||||
|
|
|
||||||
LL | const STR_U8_UNION: u8 = unsafe { Nonsense { stringy: "3" }.uint_8 };
|
|
||||||
| ---------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
= help: this code performed an operation that depends on the underlying bytes representing a pointer
|
|
||||||
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
|
|
||||||
= note: `#[deny(const_err)]` on by default
|
|
||||||
|
|
||||||
Future breakage diagnostic:
|
|
||||||
error: any use of this value will cause an error
|
|
||||||
--> $DIR/const-pointer-values-in-various-types.rs:90:41
|
|
||||||
|
|
|
||||||
LL | const STR_U16_UNION: u16 = unsafe { Nonsense { stringy: "3" }.uint_16 };
|
|
||||||
| ------------------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
= help: this code performed an operation that depends on the underlying bytes representing a pointer
|
|
||||||
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
|
|
||||||
= note: `#[deny(const_err)]` on by default
|
|
||||||
|
|
||||||
Future breakage diagnostic:
|
|
||||||
error: any use of this value will cause an error
|
|
||||||
--> $DIR/const-pointer-values-in-various-types.rs:94:41
|
|
||||||
|
|
|
||||||
LL | const STR_U32_UNION: u32 = unsafe { Nonsense { stringy: "3" }.uint_32 };
|
|
||||||
| ------------------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
= help: this code performed an operation that depends on the underlying bytes representing a pointer
|
|
||||||
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
|
|
||||||
= note: `#[deny(const_err)]` on by default
|
|
||||||
|
|
||||||
Future breakage diagnostic:
|
|
||||||
error: any use of this value will cause an error
|
|
||||||
--> $DIR/const-pointer-values-in-various-types.rs:98:41
|
|
||||||
|
|
|
||||||
LL | const STR_U64_UNION: u64 = unsafe { Nonsense { stringy: "3" }.uint_64 };
|
|
||||||
| ------------------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
= help: this code performed an operation that depends on the underlying bytes representing a pointer
|
|
||||||
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
|
|
||||||
= note: `#[deny(const_err)]` on by default
|
|
||||||
|
|
||||||
Future breakage diagnostic:
|
|
||||||
error: any use of this value will cause an error
|
|
||||||
--> $DIR/const-pointer-values-in-various-types.rs:102:43
|
|
||||||
|
|
|
||||||
LL | const STR_U128_UNION: u128 = unsafe { Nonsense { stringy: "3" }.uint_128 };
|
|
||||||
| -------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
= help: this code performed an operation that depends on the underlying bytes representing a pointer
|
|
||||||
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
|
|
||||||
= note: `#[deny(const_err)]` on by default
|
|
||||||
|
|
||||||
Future breakage diagnostic:
|
|
||||||
error: any use of this value will cause an error
|
|
||||||
--> $DIR/const-pointer-values-in-various-types.rs:106:39
|
|
||||||
|
|
|
||||||
LL | const STR_I8_UNION: i8 = unsafe { Nonsense { stringy: "3" }.int_8 };
|
|
||||||
| ---------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
= help: this code performed an operation that depends on the underlying bytes representing a pointer
|
|
||||||
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
|
|
||||||
= note: `#[deny(const_err)]` on by default
|
|
||||||
|
|
||||||
Future breakage diagnostic:
|
|
||||||
error: any use of this value will cause an error
|
|
||||||
--> $DIR/const-pointer-values-in-various-types.rs:110:41
|
|
||||||
|
|
|
||||||
LL | const STR_I16_UNION: i16 = unsafe { Nonsense { stringy: "3" }.int_16 };
|
|
||||||
| ------------------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
= help: this code performed an operation that depends on the underlying bytes representing a pointer
|
|
||||||
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
|
|
||||||
= note: `#[deny(const_err)]` on by default
|
|
||||||
|
|
||||||
Future breakage diagnostic:
|
|
||||||
error: any use of this value will cause an error
|
|
||||||
--> $DIR/const-pointer-values-in-various-types.rs:114:41
|
|
||||||
|
|
|
||||||
LL | const STR_I32_UNION: i32 = unsafe { Nonsense { stringy: "3" }.int_32 };
|
|
||||||
| ------------------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
= help: this code performed an operation that depends on the underlying bytes representing a pointer
|
|
||||||
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
|
|
||||||
= note: `#[deny(const_err)]` on by default
|
|
||||||
|
|
||||||
Future breakage diagnostic:
|
|
||||||
error: any use of this value will cause an error
|
|
||||||
--> $DIR/const-pointer-values-in-various-types.rs:118:41
|
|
||||||
|
|
|
||||||
LL | const STR_I64_UNION: i64 = unsafe { Nonsense { stringy: "3" }.int_64 };
|
|
||||||
| ------------------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
= help: this code performed an operation that depends on the underlying bytes representing a pointer
|
|
||||||
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
|
|
||||||
= note: `#[deny(const_err)]` on by default
|
|
||||||
|
|
||||||
Future breakage diagnostic:
|
|
||||||
error: any use of this value will cause an error
|
|
||||||
--> $DIR/const-pointer-values-in-various-types.rs:122:43
|
|
||||||
|
|
|
||||||
LL | const STR_I128_UNION: i128 = unsafe { Nonsense { stringy: "3" }.int_128 };
|
|
||||||
| -------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
= help: this code performed an operation that depends on the underlying bytes representing a pointer
|
|
||||||
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
|
|
||||||
= note: `#[deny(const_err)]` on by default
|
|
||||||
|
|
||||||
Future breakage diagnostic:
|
|
||||||
error: any use of this value will cause an error
|
|
||||||
--> $DIR/const-pointer-values-in-various-types.rs:126:41
|
|
||||||
|
|
|
||||||
LL | const STR_F32_UNION: f32 = unsafe { Nonsense { stringy: "3" }.float_32 };
|
|
||||||
| ------------------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
= help: this code performed an operation that depends on the underlying bytes representing a pointer
|
|
||||||
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
|
|
||||||
= note: `#[deny(const_err)]` on by default
|
|
||||||
|
|
||||||
Future breakage diagnostic:
|
|
||||||
error: any use of this value will cause an error
|
|
||||||
--> $DIR/const-pointer-values-in-various-types.rs:130:41
|
|
||||||
|
|
|
||||||
LL | const STR_F64_UNION: f64 = unsafe { Nonsense { stringy: "3" }.float_64 };
|
|
||||||
| ------------------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
= help: this code performed an operation that depends on the underlying bytes representing a pointer
|
|
||||||
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
|
|
||||||
= note: `#[deny(const_err)]` on by default
|
|
||||||
|
|
||||||
Future breakage diagnostic:
|
|
||||||
error: any use of this value will cause an error
|
|
||||||
--> $DIR/const-pointer-values-in-various-types.rs:134:43
|
|
||||||
|
|
|
||||||
LL | const STR_BOOL_UNION: bool = unsafe { Nonsense { stringy: "3" }.truthy_falsey };
|
|
||||||
| -------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
= help: this code performed an operation that depends on the underlying bytes representing a pointer
|
|
||||||
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
|
|
||||||
= note: `#[deny(const_err)]` on by default
|
|
||||||
|
|
||||||
Future breakage diagnostic:
|
|
||||||
error: any use of this value will cause an error
|
|
||||||
--> $DIR/const-pointer-values-in-various-types.rs:138:43
|
|
||||||
|
|
|
||||||
LL | const STR_CHAR_UNION: char = unsafe { Nonsense { stringy: "3" }.character };
|
|
||||||
| -------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
= help: this code performed an operation that depends on the underlying bytes representing a pointer
|
|
||||||
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
|
|
||||||
= note: `#[deny(const_err)]` on by default
|
|
||||||
|
|
||||||
|
|
|
@ -24,118 +24,91 @@ union Nonsense {
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
const I32_REF_USIZE_UNION: usize = unsafe { Nonsense { int_32_ref: &3 }.u };
|
const I32_REF_USIZE_UNION: usize = unsafe { Nonsense { int_32_ref: &3 }.u };
|
||||||
//~^ ERROR any use of this value will cause an error
|
//~^ ERROR evaluation of constant value failed
|
||||||
//~| WARN this was previously accepted by the compiler but is being phased out
|
|
||||||
|
|
||||||
const I32_REF_U8_UNION: u8 = unsafe { Nonsense { int_32_ref: &3 }.uint_8 };
|
const I32_REF_U8_UNION: u8 = unsafe { Nonsense { int_32_ref: &3 }.uint_8 };
|
||||||
//~^ ERROR any use of this value will cause an error
|
//~^ ERROR evaluation of constant value failed
|
||||||
//~| WARN this was previously accepted by the compiler but is being phased out
|
|
||||||
|
|
||||||
const I32_REF_U16_UNION: u16 = unsafe { Nonsense { int_32_ref: &3 }.uint_16 };
|
const I32_REF_U16_UNION: u16 = unsafe { Nonsense { int_32_ref: &3 }.uint_16 };
|
||||||
//~^ ERROR any use of this value will cause an error
|
//~^ ERROR evaluation of constant value failed
|
||||||
//~| WARN this was previously accepted by the compiler but is being phased out
|
|
||||||
|
|
||||||
const I32_REF_U32_UNION: u32 = unsafe { Nonsense { int_32_ref: &3 }.uint_32 };
|
const I32_REF_U32_UNION: u32 = unsafe { Nonsense { int_32_ref: &3 }.uint_32 };
|
||||||
//~^ ERROR any use of this value will cause an error
|
//~^ ERROR evaluation of constant value failed
|
||||||
//~| WARN this was previously accepted by the compiler but is being phased out
|
|
||||||
|
|
||||||
const I32_REF_U64_UNION: u64 = unsafe { Nonsense { int_32_ref: &3 }.uint_64 };
|
const I32_REF_U64_UNION: u64 = unsafe { Nonsense { int_32_ref: &3 }.uint_64 };
|
||||||
//~^ ERROR any use of this value will cause an error
|
//~^ ERROR evaluation of constant value failed
|
||||||
//~| WARN this was previously accepted by the compiler but is being phased out
|
|
||||||
|
|
||||||
const I32_REF_U128_UNION: u128 = unsafe { Nonsense { int_32_ref: &3 }.uint_128 };
|
const I32_REF_U128_UNION: u128 = unsafe { Nonsense { int_32_ref: &3 }.uint_128 };
|
||||||
//~^ ERROR evaluation of constant value failed
|
//~^ ERROR evaluation of constant value failed
|
||||||
//~| uninitialized
|
//~| uninitialized
|
||||||
|
|
||||||
const I32_REF_I8_UNION: i8 = unsafe { Nonsense { int_32_ref: &3 }.int_8 };
|
const I32_REF_I8_UNION: i8 = unsafe { Nonsense { int_32_ref: &3 }.int_8 };
|
||||||
//~^ ERROR any use of this value will cause an error
|
//~^ ERROR evaluation of constant value failed
|
||||||
//~| WARN this was previously accepted by the compiler but is being phased out
|
|
||||||
|
|
||||||
const I32_REF_I16_UNION: i16 = unsafe { Nonsense { int_32_ref: &3 }.int_16 };
|
const I32_REF_I16_UNION: i16 = unsafe { Nonsense { int_32_ref: &3 }.int_16 };
|
||||||
//~^ ERROR any use of this value will cause an error
|
//~^ ERROR evaluation of constant value failed
|
||||||
//~| WARN this was previously accepted by the compiler but is being phased out
|
|
||||||
|
|
||||||
const I32_REF_I32_UNION: i32 = unsafe { Nonsense { int_32_ref: &3 }.int_32 };
|
const I32_REF_I32_UNION: i32 = unsafe { Nonsense { int_32_ref: &3 }.int_32 };
|
||||||
//~^ ERROR any use of this value will cause an error
|
//~^ ERROR evaluation of constant value failed
|
||||||
//~| WARN this was previously accepted by the compiler but is being phased out
|
|
||||||
|
|
||||||
const I32_REF_I64_UNION: i64 = unsafe { Nonsense { int_32_ref: &3 }.int_64 };
|
const I32_REF_I64_UNION: i64 = unsafe { Nonsense { int_32_ref: &3 }.int_64 };
|
||||||
//~^ ERROR any use of this value will cause an error
|
//~^ ERROR evaluation of constant value failed
|
||||||
//~| WARN this was previously accepted by the compiler but is being phased out
|
|
||||||
|
|
||||||
const I32_REF_I128_UNION: i128 = unsafe { Nonsense { int_32_ref: &3 }.int_128 };
|
const I32_REF_I128_UNION: i128 = unsafe { Nonsense { int_32_ref: &3 }.int_128 };
|
||||||
//~^ ERROR evaluation of constant value failed
|
//~^ ERROR evaluation of constant value failed
|
||||||
//~| uninitialized
|
//~| uninitialized
|
||||||
|
|
||||||
const I32_REF_F32_UNION: f32 = unsafe { Nonsense { int_32_ref: &3 }.float_32 };
|
const I32_REF_F32_UNION: f32 = unsafe { Nonsense { int_32_ref: &3 }.float_32 };
|
||||||
//~^ ERROR any use of this value will cause an error
|
//~^ ERROR evaluation of constant value failed
|
||||||
//~| WARN this was previously accepted by the compiler but is being phased out
|
|
||||||
|
|
||||||
const I32_REF_F64_UNION: f64 = unsafe { Nonsense { int_32_ref: &3 }.float_64 };
|
const I32_REF_F64_UNION: f64 = unsafe { Nonsense { int_32_ref: &3 }.float_64 };
|
||||||
//~^ ERROR any use of this value will cause an error
|
//~^ ERROR evaluation of constant value failed
|
||||||
//~| WARN this was previously accepted by the compiler but is being phased out
|
|
||||||
|
|
||||||
const I32_REF_BOOL_UNION: bool = unsafe { Nonsense { int_32_ref: &3 }.truthy_falsey };
|
const I32_REF_BOOL_UNION: bool = unsafe { Nonsense { int_32_ref: &3 }.truthy_falsey };
|
||||||
//~^ ERROR any use of this value will cause an error
|
//~^ ERROR evaluation of constant value failed
|
||||||
//~| WARN this was previously accepted by the compiler but is being phased out
|
|
||||||
|
|
||||||
const I32_REF_CHAR_UNION: char = unsafe { Nonsense { int_32_ref: &3 }.character };
|
const I32_REF_CHAR_UNION: char = unsafe { Nonsense { int_32_ref: &3 }.character };
|
||||||
//~^ ERROR any use of this value will cause an error
|
//~^ ERROR evaluation of constant value failed
|
||||||
//~| WARN this was previously accepted by the compiler but is being phased out
|
|
||||||
|
|
||||||
const STR_U8_UNION: u8 = unsafe { Nonsense { stringy: "3" }.uint_8 };
|
const STR_U8_UNION: u8 = unsafe { Nonsense { stringy: "3" }.uint_8 };
|
||||||
//~^ ERROR any use of this value will cause an error
|
//~^ ERROR evaluation of constant value failed
|
||||||
//~| WARN this was previously accepted by the compiler but is being phased out
|
|
||||||
|
|
||||||
const STR_U16_UNION: u16 = unsafe { Nonsense { stringy: "3" }.uint_16 };
|
const STR_U16_UNION: u16 = unsafe { Nonsense { stringy: "3" }.uint_16 };
|
||||||
//~^ ERROR any use of this value will cause an error
|
//~^ ERROR evaluation of constant value failed
|
||||||
//~| WARN this was previously accepted by the compiler but is being phased out
|
|
||||||
|
|
||||||
const STR_U32_UNION: u32 = unsafe { Nonsense { stringy: "3" }.uint_32 };
|
const STR_U32_UNION: u32 = unsafe { Nonsense { stringy: "3" }.uint_32 };
|
||||||
//~^ ERROR any use of this value will cause an error
|
//~^ ERROR evaluation of constant value failed
|
||||||
//~| WARN this was previously accepted by the compiler but is being phased out
|
|
||||||
|
|
||||||
const STR_U64_UNION: u64 = unsafe { Nonsense { stringy: "3" }.uint_64 };
|
const STR_U64_UNION: u64 = unsafe { Nonsense { stringy: "3" }.uint_64 };
|
||||||
//~^ ERROR any use of this value will cause an error
|
//~^ ERROR evaluation of constant value failed
|
||||||
//~| WARN this was previously accepted by the compiler but is being phased out
|
|
||||||
|
|
||||||
const STR_U128_UNION: u128 = unsafe { Nonsense { stringy: "3" }.uint_128 };
|
const STR_U128_UNION: u128 = unsafe { Nonsense { stringy: "3" }.uint_128 };
|
||||||
//~^ ERROR any use of this value will cause an error
|
//~^ ERROR evaluation of constant value failed
|
||||||
//~| WARN this was previously accepted by the compiler but is being phased out
|
|
||||||
|
|
||||||
const STR_I8_UNION: i8 = unsafe { Nonsense { stringy: "3" }.int_8 };
|
const STR_I8_UNION: i8 = unsafe { Nonsense { stringy: "3" }.int_8 };
|
||||||
//~^ ERROR any use of this value will cause an error
|
//~^ ERROR evaluation of constant value failed
|
||||||
//~| WARN this was previously accepted by the compiler but is being phased out
|
|
||||||
|
|
||||||
const STR_I16_UNION: i16 = unsafe { Nonsense { stringy: "3" }.int_16 };
|
const STR_I16_UNION: i16 = unsafe { Nonsense { stringy: "3" }.int_16 };
|
||||||
//~^ ERROR any use of this value will cause an error
|
//~^ ERROR evaluation of constant value failed
|
||||||
//~| WARN this was previously accepted by the compiler but is being phased out
|
|
||||||
|
|
||||||
const STR_I32_UNION: i32 = unsafe { Nonsense { stringy: "3" }.int_32 };
|
const STR_I32_UNION: i32 = unsafe { Nonsense { stringy: "3" }.int_32 };
|
||||||
//~^ ERROR any use of this value will cause an error
|
//~^ ERROR evaluation of constant value failed
|
||||||
//~| WARN this was previously accepted by the compiler but is being phased out
|
|
||||||
|
|
||||||
const STR_I64_UNION: i64 = unsafe { Nonsense { stringy: "3" }.int_64 };
|
const STR_I64_UNION: i64 = unsafe { Nonsense { stringy: "3" }.int_64 };
|
||||||
//~^ ERROR any use of this value will cause an error
|
//~^ ERROR evaluation of constant value failed
|
||||||
//~| WARN this was previously accepted by the compiler but is being phased out
|
|
||||||
|
|
||||||
const STR_I128_UNION: i128 = unsafe { Nonsense { stringy: "3" }.int_128 };
|
const STR_I128_UNION: i128 = unsafe { Nonsense { stringy: "3" }.int_128 };
|
||||||
//~^ ERROR any use of this value will cause an error
|
//~^ ERROR evaluation of constant value failed
|
||||||
//~| WARN this was previously accepted by the compiler but is being phased out
|
|
||||||
|
|
||||||
const STR_F32_UNION: f32 = unsafe { Nonsense { stringy: "3" }.float_32 };
|
const STR_F32_UNION: f32 = unsafe { Nonsense { stringy: "3" }.float_32 };
|
||||||
//~^ ERROR any use of this value will cause an error
|
//~^ ERROR evaluation of constant value failed
|
||||||
//~| WARN this was previously accepted by the compiler but is being phased out
|
|
||||||
|
|
||||||
const STR_F64_UNION: f64 = unsafe { Nonsense { stringy: "3" }.float_64 };
|
const STR_F64_UNION: f64 = unsafe { Nonsense { stringy: "3" }.float_64 };
|
||||||
//~^ ERROR any use of this value will cause an error
|
//~^ ERROR evaluation of constant value failed
|
||||||
//~| WARN this was previously accepted by the compiler but is being phased out
|
|
||||||
|
|
||||||
const STR_BOOL_UNION: bool = unsafe { Nonsense { stringy: "3" }.truthy_falsey };
|
const STR_BOOL_UNION: bool = unsafe { Nonsense { stringy: "3" }.truthy_falsey };
|
||||||
//~^ ERROR any use of this value will cause an error
|
//~^ ERROR evaluation of constant value failed
|
||||||
//~| WARN this was previously accepted by the compiler but is being phased out
|
|
||||||
|
|
||||||
const STR_CHAR_UNION: char = unsafe { Nonsense { stringy: "3" }.character };
|
const STR_CHAR_UNION: char = unsafe { Nonsense { stringy: "3" }.character };
|
||||||
//~^ ERROR any use of this value will cause an error
|
//~^ ERROR evaluation of constant value failed
|
||||||
//~| WARN this was previously accepted by the compiler but is being phased out
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
// build-fail
|
|
||||||
// compile-flags: -Zunleash-the-miri-inside-of-you
|
// compile-flags: -Zunleash-the-miri-inside-of-you
|
||||||
|
|
||||||
#![allow(const_err)]
|
|
||||||
|
|
||||||
fn double(x: usize) -> usize {
|
fn double(x: usize) -> usize {
|
||||||
x * 2
|
x * 2
|
||||||
}
|
}
|
||||||
|
@ -10,6 +7,8 @@ const X: fn(usize) -> usize = double;
|
||||||
|
|
||||||
const fn bar(x: fn(usize) -> usize, y: usize) -> usize {
|
const fn bar(x: fn(usize) -> usize, y: usize) -> usize {
|
||||||
x(y)
|
x(y)
|
||||||
|
//~^ ERROR evaluation of constant value failed
|
||||||
|
//~| ERROR evaluation of constant value failed
|
||||||
}
|
}
|
||||||
|
|
||||||
const Y: usize = bar(X, 2); // FIXME: should fail to typeck someday
|
const Y: usize = bar(X, 2); // FIXME: should fail to typeck someday
|
||||||
|
@ -17,7 +16,5 @@ const Z: usize = bar(double, 2); // FIXME: should fail to typeck someday
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
assert_eq!(Y, 4);
|
assert_eq!(Y, 4);
|
||||||
//~^ ERROR evaluation of constant value failed
|
|
||||||
assert_eq!(Z, 4);
|
assert_eq!(Z, 4);
|
||||||
//~^ ERROR evaluation of constant value failed
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,19 +1,31 @@
|
||||||
error[E0080]: evaluation of constant value failed
|
error[E0080]: evaluation of constant value failed
|
||||||
--> $DIR/const_fn_ptr_fail2.rs:19:16
|
--> $DIR/const_fn_ptr_fail2.rs:9:5
|
||||||
|
|
|
|
||||||
LL | assert_eq!(Y, 4);
|
LL | x(y)
|
||||||
| ^ referenced constant has errors
|
| ^^^^
|
||||||
|
| |
|
||||||
|
| calling non-const function `double`
|
||||||
|
| inside `bar` at $DIR/const_fn_ptr_fail2.rs:9:5
|
||||||
|
...
|
||||||
|
LL | const Y: usize = bar(X, 2); // FIXME: should fail to typeck someday
|
||||||
|
| --------- inside `Y` at $DIR/const_fn_ptr_fail2.rs:14:18
|
||||||
|
|
||||||
error[E0080]: evaluation of constant value failed
|
error[E0080]: evaluation of constant value failed
|
||||||
--> $DIR/const_fn_ptr_fail2.rs:21:16
|
--> $DIR/const_fn_ptr_fail2.rs:9:5
|
||||||
|
|
|
|
||||||
LL | assert_eq!(Z, 4);
|
LL | x(y)
|
||||||
| ^ referenced constant has errors
|
| ^^^^
|
||||||
|
| |
|
||||||
|
| calling non-const function `double`
|
||||||
|
| inside `bar` at $DIR/const_fn_ptr_fail2.rs:9:5
|
||||||
|
...
|
||||||
|
LL | const Z: usize = bar(double, 2); // FIXME: should fail to typeck someday
|
||||||
|
| -------------- inside `Z` at $DIR/const_fn_ptr_fail2.rs:15:18
|
||||||
|
|
||||||
warning: skipping const checks
|
warning: skipping const checks
|
||||||
|
|
|
|
||||||
help: skipping check that does not even have a feature gate
|
help: skipping check that does not even have a feature gate
|
||||||
--> $DIR/const_fn_ptr_fail2.rs:12:5
|
--> $DIR/const_fn_ptr_fail2.rs:9:5
|
||||||
|
|
|
|
||||||
LL | x(y)
|
LL | x(y)
|
||||||
| ^^^^
|
| ^^^^
|
||||||
|
@ -21,79 +33,3 @@ LL | x(y)
|
||||||
error: aborting due to 2 previous errors; 1 warning emitted
|
error: aborting due to 2 previous errors; 1 warning emitted
|
||||||
|
|
||||||
For more information about this error, try `rustc --explain E0080`.
|
For more information about this error, try `rustc --explain E0080`.
|
||||||
Future incompatibility report: Future breakage diagnostic:
|
|
||||||
warning: any use of this value will cause an error
|
|
||||||
--> $DIR/const_fn_ptr_fail2.rs:12:5
|
|
||||||
|
|
|
||||||
LL | x(y)
|
|
||||||
| ^^^^
|
|
||||||
| |
|
|
||||||
| calling non-const function `double`
|
|
||||||
| inside `bar` at $DIR/const_fn_ptr_fail2.rs:12:5
|
|
||||||
| inside `Y` at $DIR/const_fn_ptr_fail2.rs:15:18
|
|
||||||
...
|
|
||||||
LL | const Y: usize = bar(X, 2); // FIXME: should fail to typeck someday
|
|
||||||
| --------------
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
note: the lint level is defined here
|
|
||||||
--> $DIR/const_fn_ptr_fail2.rs:4:10
|
|
||||||
|
|
|
||||||
LL | #![allow(const_err)]
|
|
||||||
| ^^^^^^^^^
|
|
||||||
|
|
||||||
Future breakage diagnostic:
|
|
||||||
warning: any use of this value will cause an error
|
|
||||||
--> $DIR/const_fn_ptr_fail2.rs:12:5
|
|
||||||
|
|
|
||||||
LL | x(y)
|
|
||||||
| ^^^^
|
|
||||||
| |
|
|
||||||
| calling non-const function `double`
|
|
||||||
| inside `bar` at $DIR/const_fn_ptr_fail2.rs:12:5
|
|
||||||
| inside `Z` at $DIR/const_fn_ptr_fail2.rs:16:18
|
|
||||||
...
|
|
||||||
LL | const Z: usize = bar(double, 2); // FIXME: should fail to typeck someday
|
|
||||||
| --------------
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
note: the lint level is defined here
|
|
||||||
--> $DIR/const_fn_ptr_fail2.rs:4:10
|
|
||||||
|
|
|
||||||
LL | #![allow(const_err)]
|
|
||||||
| ^^^^^^^^^
|
|
||||||
|
|
||||||
Future breakage diagnostic:
|
|
||||||
warning: erroneous constant used
|
|
||||||
--> $DIR/const_fn_ptr_fail2.rs:19:5
|
|
||||||
|
|
|
||||||
LL | assert_eq!(Y, 4);
|
|
||||||
| ^^^^^^^^^^^^^^^^ referenced constant has errors
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
note: the lint level is defined here
|
|
||||||
--> $DIR/const_fn_ptr_fail2.rs:4:10
|
|
||||||
|
|
|
||||||
LL | #![allow(const_err)]
|
|
||||||
| ^^^^^^^^^
|
|
||||||
= note: this warning originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info)
|
|
||||||
|
|
||||||
Future breakage diagnostic:
|
|
||||||
warning: erroneous constant used
|
|
||||||
--> $DIR/const_fn_ptr_fail2.rs:21:5
|
|
||||||
|
|
|
||||||
LL | assert_eq!(Z, 4);
|
|
||||||
| ^^^^^^^^^^^^^^^^ referenced constant has errors
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
note: the lint level is defined here
|
|
||||||
--> $DIR/const_fn_ptr_fail2.rs:4:10
|
|
||||||
|
|
|
||||||
LL | #![allow(const_err)]
|
|
||||||
| ^^^^^^^^^
|
|
||||||
= note: this warning originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info)
|
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,9 @@
|
||||||
//! Make sure we error on erroneous consts even if they are unused.
|
//! Make sure we error on erroneous consts even if they are unused.
|
||||||
#![warn(const_err, unconditional_panic)]
|
#![allow(unconditional_panic)]
|
||||||
|
|
||||||
struct PrintName<T>(T);
|
struct PrintName<T>(T);
|
||||||
impl<T> PrintName<T> {
|
impl<T> PrintName<T> {
|
||||||
const VOID: () = [()][2]; //~WARN any use of this value will cause an error
|
const VOID: () = [()][2]; //~ERROR evaluation of `PrintName::<i32>::VOID` failed
|
||||||
//~^ WARN this operation will panic at runtime
|
|
||||||
//~| WARN this was previously accepted by the compiler but is being phased out
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const fn no_codegen<T>() {
|
const fn no_codegen<T>() {
|
||||||
|
|
|
@ -1,56 +1,21 @@
|
||||||
warning: this operation will panic at runtime
|
error[E0080]: evaluation of `PrintName::<i32>::VOID` failed
|
||||||
--> $DIR/erroneous-const.rs:6:22
|
--> $DIR/erroneous-const.rs:6:22
|
||||||
|
|
|
|
||||||
LL | const VOID: () = [()][2];
|
LL | const VOID: () = [()][2];
|
||||||
| ^^^^^^^ index out of bounds: the length is 1 but the index is 2
|
| ^^^^^^^ index out of bounds: the length is 1 but the index is 2
|
||||||
|
|
|
||||||
note: the lint level is defined here
|
|
||||||
--> $DIR/erroneous-const.rs:2:20
|
|
||||||
|
|
|
||||||
LL | #![warn(const_err, unconditional_panic)]
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^
|
|
||||||
|
|
||||||
warning: any use of this value will cause an error
|
|
||||||
--> $DIR/erroneous-const.rs:6:22
|
|
||||||
|
|
|
||||||
LL | const VOID: () = [()][2];
|
|
||||||
| -------------- ^^^^^^^ index out of bounds: the length is 1 but the index is 2
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
note: the lint level is defined here
|
|
||||||
--> $DIR/erroneous-const.rs:2:9
|
|
||||||
|
|
|
||||||
LL | #![warn(const_err, unconditional_panic)]
|
|
||||||
| ^^^^^^^^^
|
|
||||||
|
|
||||||
error[E0080]: could not evaluate static initializer
|
error[E0080]: could not evaluate static initializer
|
||||||
--> $DIR/erroneous-const.rs:15:17
|
--> $DIR/erroneous-const.rs:13:17
|
||||||
|
|
|
|
||||||
LL | let _ = PrintName::<T>::VOID;
|
LL | let _ = PrintName::<T>::VOID;
|
||||||
| ^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^
|
||||||
| |
|
| |
|
||||||
| referenced constant has errors
|
| referenced constant has errors
|
||||||
| inside `no_codegen::<i32>` at $DIR/erroneous-const.rs:15:17
|
| inside `no_codegen::<i32>` at $DIR/erroneous-const.rs:13:17
|
||||||
...
|
...
|
||||||
LL | pub static FOO: () = no_codegen::<i32>();
|
LL | pub static FOO: () = no_codegen::<i32>();
|
||||||
| ------------------- inside `FOO` at $DIR/erroneous-const.rs:19:22
|
| ------------------- inside `FOO` at $DIR/erroneous-const.rs:17:22
|
||||||
|
|
||||||
error: aborting due to previous error; 2 warnings emitted
|
error: aborting due to 2 previous errors
|
||||||
|
|
||||||
For more information about this error, try `rustc --explain E0080`.
|
For more information about this error, try `rustc --explain E0080`.
|
||||||
Future incompatibility report: Future breakage diagnostic:
|
|
||||||
warning: any use of this value will cause an error
|
|
||||||
--> $DIR/erroneous-const.rs:6:22
|
|
||||||
|
|
|
||||||
LL | const VOID: () = [()][2];
|
|
||||||
| -------------- ^^^^^^^ index out of bounds: the length is 1 but the index is 2
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
note: the lint level is defined here
|
|
||||||
--> $DIR/erroneous-const.rs:2:9
|
|
||||||
|
|
|
||||||
LL | #![warn(const_err, unconditional_panic)]
|
|
||||||
| ^^^^^^^^^
|
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,9 @@
|
||||||
//! Make sure we error on erroneous consts even if they are unused.
|
//! Make sure we error on erroneous consts even if they are unused.
|
||||||
#![warn(const_err, unconditional_panic)]
|
#![allow(unconditional_panic)]
|
||||||
|
|
||||||
struct PrintName<T>(T);
|
struct PrintName<T>(T);
|
||||||
impl<T> PrintName<T> {
|
impl<T> PrintName<T> {
|
||||||
const VOID: () = [()][2]; //~WARN any use of this value will cause an error
|
const VOID: () = [()][2]; //~ERROR evaluation of `PrintName::<i32>::VOID` failed
|
||||||
//~^ WARN this operation will panic at runtime
|
|
||||||
//~| WARN this was previously accepted by the compiler but is being phased out
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub static FOO: () = {
|
pub static FOO: () = {
|
||||||
|
|
|
@ -1,50 +1,15 @@
|
||||||
warning: this operation will panic at runtime
|
error[E0080]: evaluation of `PrintName::<i32>::VOID` failed
|
||||||
--> $DIR/erroneous-const2.rs:6:22
|
--> $DIR/erroneous-const2.rs:6:22
|
||||||
|
|
|
|
||||||
LL | const VOID: () = [()][2];
|
LL | const VOID: () = [()][2];
|
||||||
| ^^^^^^^ index out of bounds: the length is 1 but the index is 2
|
| ^^^^^^^ index out of bounds: the length is 1 but the index is 2
|
||||||
|
|
|
||||||
note: the lint level is defined here
|
|
||||||
--> $DIR/erroneous-const2.rs:2:20
|
|
||||||
|
|
|
||||||
LL | #![warn(const_err, unconditional_panic)]
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^
|
|
||||||
|
|
||||||
warning: any use of this value will cause an error
|
|
||||||
--> $DIR/erroneous-const2.rs:6:22
|
|
||||||
|
|
|
||||||
LL | const VOID: () = [()][2];
|
|
||||||
| -------------- ^^^^^^^ index out of bounds: the length is 1 but the index is 2
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
note: the lint level is defined here
|
|
||||||
--> $DIR/erroneous-const2.rs:2:9
|
|
||||||
|
|
|
||||||
LL | #![warn(const_err, unconditional_panic)]
|
|
||||||
| ^^^^^^^^^
|
|
||||||
|
|
||||||
error[E0080]: could not evaluate static initializer
|
error[E0080]: could not evaluate static initializer
|
||||||
--> $DIR/erroneous-const2.rs:15:17
|
--> $DIR/erroneous-const2.rs:13:17
|
||||||
|
|
|
|
||||||
LL | let _ = PrintName::<i32>::VOID;
|
LL | let _ = PrintName::<i32>::VOID;
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors
|
| ^^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors
|
||||||
|
|
||||||
error: aborting due to previous error; 2 warnings emitted
|
error: aborting due to 2 previous errors
|
||||||
|
|
||||||
For more information about this error, try `rustc --explain E0080`.
|
For more information about this error, try `rustc --explain E0080`.
|
||||||
Future incompatibility report: Future breakage diagnostic:
|
|
||||||
warning: any use of this value will cause an error
|
|
||||||
--> $DIR/erroneous-const2.rs:6:22
|
|
||||||
|
|
|
||||||
LL | const VOID: () = [()][2];
|
|
||||||
| -------------- ^^^^^^^ index out of bounds: the length is 1 but the index is 2
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
note: the lint level is defined here
|
|
||||||
--> $DIR/erroneous-const2.rs:2:9
|
|
||||||
|
|
|
||||||
LL | #![warn(const_err, unconditional_panic)]
|
|
||||||
| ^^^^^^^^^
|
|
||||||
|
|
||||||
|
|
|
@ -3,8 +3,6 @@ const fn failure() {
|
||||||
//~^ ERROR cannot call non-const formatting macro in constant functions
|
//~^ ERROR cannot call non-const formatting macro in constant functions
|
||||||
//~| ERROR erroneous constant used
|
//~| ERROR erroneous constant used
|
||||||
//~| ERROR erroneous constant used
|
//~| ERROR erroneous constant used
|
||||||
//~| WARN this was previously accepted by the compiler
|
|
||||||
//~| WARN this was previously accepted by the compiler
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const fn print() {
|
const fn print() {
|
||||||
|
@ -14,8 +12,6 @@ const fn print() {
|
||||||
//~| ERROR cannot call non-const fn `_print` in constant functions
|
//~| ERROR cannot call non-const fn `_print` in constant functions
|
||||||
//~| ERROR erroneous constant used
|
//~| ERROR erroneous constant used
|
||||||
//~| ERROR erroneous constant used
|
//~| ERROR erroneous constant used
|
||||||
//~| WARN this was previously accepted by the compiler
|
|
||||||
//~| WARN this was previously accepted by the compiler
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {}
|
fn main() {}
|
||||||
|
|
|
@ -8,7 +8,7 @@ LL | panic!("{:?}", 0);
|
||||||
= note: this error originates in the macro `$crate::const_format_args` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
|
= note: this error originates in the macro `$crate::const_format_args` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
|
||||||
error[E0015]: cannot call non-const formatting macro in constant functions
|
error[E0015]: cannot call non-const formatting macro in constant functions
|
||||||
--> $DIR/format.rs:11:22
|
--> $DIR/format.rs:9:22
|
||||||
|
|
|
|
||||||
LL | println!("{:?}", 0);
|
LL | println!("{:?}", 0);
|
||||||
| ^
|
| ^
|
||||||
|
@ -17,7 +17,7 @@ LL | println!("{:?}", 0);
|
||||||
= note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)
|
= note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
|
||||||
error: `Arguments::<'a>::new_v1` is not yet stable as a const fn
|
error: `Arguments::<'a>::new_v1` is not yet stable as a const fn
|
||||||
--> $DIR/format.rs:11:5
|
--> $DIR/format.rs:9:5
|
||||||
|
|
|
|
||||||
LL | println!("{:?}", 0);
|
LL | println!("{:?}", 0);
|
||||||
| ^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^
|
||||||
|
@ -26,7 +26,7 @@ LL | println!("{:?}", 0);
|
||||||
= note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)
|
= note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
|
||||||
error[E0015]: cannot call non-const fn `_print` in constant functions
|
error[E0015]: cannot call non-const fn `_print` in constant functions
|
||||||
--> $DIR/format.rs:11:5
|
--> $DIR/format.rs:9:5
|
||||||
|
|
|
|
||||||
LL | println!("{:?}", 0);
|
LL | println!("{:?}", 0);
|
||||||
| ^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^
|
||||||
|
@ -34,91 +34,35 @@ LL | println!("{:?}", 0);
|
||||||
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
|
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
|
||||||
= note: this error originates in the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)
|
= note: this error originates in the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
|
||||||
error: erroneous constant used
|
error[E0080]: erroneous constant used
|
||||||
--> $DIR/format.rs:2:12
|
--> $DIR/format.rs:2:12
|
||||||
|
|
|
|
||||||
LL | panic!("{:?}", 0);
|
LL | panic!("{:?}", 0);
|
||||||
| ^^^^^^ referenced constant has errors
|
| ^^^^^^ referenced constant has errors
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
= note: `#[deny(const_err)]` on by default
|
|
||||||
|
|
||||||
error: erroneous constant used
|
error[E0080]: erroneous constant used
|
||||||
--> $DIR/format.rs:2:20
|
--> $DIR/format.rs:2:20
|
||||||
|
|
|
|
||||||
LL | panic!("{:?}", 0);
|
LL | panic!("{:?}", 0);
|
||||||
| ^ referenced constant has errors
|
| ^ referenced constant has errors
|
||||||
|
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
= note: this error originates in the macro `$crate::const_format_args` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
|
= note: this error originates in the macro `$crate::const_format_args` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
|
||||||
error: erroneous constant used
|
error[E0080]: erroneous constant used
|
||||||
--> $DIR/format.rs:11:14
|
--> $DIR/format.rs:9:14
|
||||||
|
|
|
|
||||||
LL | println!("{:?}", 0);
|
LL | println!("{:?}", 0);
|
||||||
| ^^^^^^ referenced constant has errors
|
| ^^^^^^ referenced constant has errors
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
|
|
||||||
error: erroneous constant used
|
error[E0080]: erroneous constant used
|
||||||
--> $DIR/format.rs:11:22
|
--> $DIR/format.rs:9:22
|
||||||
|
|
|
|
||||||
LL | println!("{:?}", 0);
|
LL | println!("{:?}", 0);
|
||||||
| ^ referenced constant has errors
|
| ^ referenced constant has errors
|
||||||
|
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
= note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)
|
= note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
|
||||||
error: aborting due to 8 previous errors
|
error: aborting due to 8 previous errors
|
||||||
|
|
||||||
For more information about this error, try `rustc --explain E0015`.
|
Some errors have detailed explanations: E0015, E0080.
|
||||||
Future incompatibility report: Future breakage diagnostic:
|
For more information about an error, try `rustc --explain E0015`.
|
||||||
error: erroneous constant used
|
|
||||||
--> $DIR/format.rs:2:12
|
|
||||||
|
|
|
||||||
LL | panic!("{:?}", 0);
|
|
||||||
| ^^^^^^ referenced constant has errors
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
= note: `#[deny(const_err)]` on by default
|
|
||||||
|
|
||||||
Future breakage diagnostic:
|
|
||||||
error: erroneous constant used
|
|
||||||
--> $DIR/format.rs:2:20
|
|
||||||
|
|
|
||||||
LL | panic!("{:?}", 0);
|
|
||||||
| ^ referenced constant has errors
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
= note: `#[deny(const_err)]` on by default
|
|
||||||
= note: this error originates in the macro `$crate::const_format_args` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
|
|
||||||
|
|
||||||
Future breakage diagnostic:
|
|
||||||
error: erroneous constant used
|
|
||||||
--> $DIR/format.rs:11:14
|
|
||||||
|
|
|
||||||
LL | println!("{:?}", 0);
|
|
||||||
| ^^^^^^ referenced constant has errors
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
= note: `#[deny(const_err)]` on by default
|
|
||||||
|
|
||||||
Future breakage diagnostic:
|
|
||||||
error: erroneous constant used
|
|
||||||
--> $DIR/format.rs:11:22
|
|
||||||
|
|
|
||||||
LL | println!("{:?}", 0);
|
|
||||||
| ^ referenced constant has errors
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
= note: `#[deny(const_err)]` on by default
|
|
||||||
= note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)
|
|
||||||
|
|
||||||
|
|
|
@ -1,21 +1,19 @@
|
||||||
// build-fail
|
// build-fail
|
||||||
|
|
||||||
// Regression test for #66975
|
// Regression test for #66975
|
||||||
#![warn(const_err, unconditional_panic)]
|
#![warn(unconditional_panic)]
|
||||||
#![feature(never_type)]
|
#![feature(never_type)]
|
||||||
|
|
||||||
struct PrintName<T>(T);
|
struct PrintName<T>(T);
|
||||||
|
|
||||||
impl<T> PrintName<T> {
|
impl<T> PrintName<T> {
|
||||||
const VOID: ! = { let x = 0 * std::mem::size_of::<T>(); [][x] };
|
const VOID: ! = { let x = 0 * std::mem::size_of::<T>(); [][x] };
|
||||||
//~^ WARN any use of this value will cause an error
|
//~^ ERROR evaluation of `PrintName::<()>::VOID` failed
|
||||||
//~| WARN this was previously accepted by the compiler but is being phased out
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn f<T>() {
|
fn f<T>() {
|
||||||
let _ = PrintName::<T>::VOID;
|
let _ = PrintName::<T>::VOID;
|
||||||
//~^ ERROR erroneous constant encountered
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn main() {
|
pub fn main() {
|
||||||
|
|
|
@ -1,37 +1,15 @@
|
||||||
warning: any use of this value will cause an error
|
error[E0080]: evaluation of `PrintName::<()>::VOID` failed
|
||||||
--> $DIR/index-out-of-bounds-never-type.rs:10:61
|
--> $DIR/index-out-of-bounds-never-type.rs:10:61
|
||||||
|
|
|
|
||||||
LL | const VOID: ! = { let x = 0 * std::mem::size_of::<T>(); [][x] };
|
LL | const VOID: ! = { let x = 0 * std::mem::size_of::<T>(); [][x] };
|
||||||
| ------------- ^^^^^ index out of bounds: the length is 0 but the index is 0
|
| ^^^^^ index out of bounds: the length is 0 but the index is 0
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
note: the lint level is defined here
|
|
||||||
--> $DIR/index-out-of-bounds-never-type.rs:4:9
|
|
||||||
|
|
|
||||||
LL | #![warn(const_err, unconditional_panic)]
|
|
||||||
| ^^^^^^^^^
|
|
||||||
|
|
||||||
error: erroneous constant encountered
|
note: the above error was encountered while instantiating `fn f::<()>`
|
||||||
--> $DIR/index-out-of-bounds-never-type.rs:17:13
|
--> $DIR/index-out-of-bounds-never-type.rs:20:5
|
||||||
|
|
|
|
||||||
LL | let _ = PrintName::<T>::VOID;
|
LL | f::<()>();
|
||||||
| ^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^
|
||||||
|
|
||||||
error: aborting due to previous error; 1 warning emitted
|
error: aborting due to previous error
|
||||||
|
|
||||||
Future incompatibility report: Future breakage diagnostic:
|
|
||||||
warning: any use of this value will cause an error
|
|
||||||
--> $DIR/index-out-of-bounds-never-type.rs:10:61
|
|
||||||
|
|
|
||||||
LL | const VOID: ! = { let x = 0 * std::mem::size_of::<T>(); [][x] };
|
|
||||||
| ------------- ^^^^^ index out of bounds: the length is 0 but the index is 0
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
note: the lint level is defined here
|
|
||||||
--> $DIR/index-out-of-bounds-never-type.rs:4:9
|
|
||||||
|
|
|
||||||
LL | #![warn(const_err, unconditional_panic)]
|
|
||||||
| ^^^^^^^^^
|
|
||||||
|
|
||||||
|
For more information about this error, try `rustc --explain E0080`.
|
||||||
|
|
|
@ -1,23 +1,11 @@
|
||||||
// build-fail
|
|
||||||
|
|
||||||
#![warn(const_err)]
|
|
||||||
|
|
||||||
const fn foo(x: u32) -> u32 {
|
const fn foo(x: u32) -> u32 {
|
||||||
x
|
x
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
const X: u32 = 0 - 1;
|
const X: u32 = 0 - 1;
|
||||||
//~^ WARN any use of this value will cause
|
//~^ ERROR constant
|
||||||
//~| WARN this was previously accepted by the compiler but is being phased out
|
|
||||||
const Y: u32 = foo(0 - 1);
|
const Y: u32 = foo(0 - 1);
|
||||||
//~^ WARN any use of this value will cause
|
//~^ ERROR constant
|
||||||
//~| WARN this was previously accepted by the compiler but is being phased out
|
|
||||||
println!("{} {}", X, Y);
|
println!("{} {}", X, Y);
|
||||||
//~^ ERROR evaluation of constant value failed
|
|
||||||
//~| ERROR evaluation of constant value failed
|
|
||||||
//~| WARN erroneous constant used [const_err]
|
|
||||||
//~| WARN erroneous constant used [const_err]
|
|
||||||
//~| WARN this was previously accepted by the compiler but is being phased out
|
|
||||||
//~| WARN this was previously accepted by the compiler but is being phased out
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,120 +1,15 @@
|
||||||
warning: any use of this value will cause an error
|
error[E0080]: evaluation of constant value failed
|
||||||
--> $DIR/issue-43197.rs:10:20
|
--> $DIR/issue-43197.rs:6:20
|
||||||
|
|
|
|
||||||
LL | const X: u32 = 0 - 1;
|
LL | const X: u32 = 0 - 1;
|
||||||
| ------------ ^^^^^ attempt to compute `0_u32 - 1_u32`, which would overflow
|
| ^^^^^ attempt to compute `0_u32 - 1_u32`, which would overflow
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
note: the lint level is defined here
|
|
||||||
--> $DIR/issue-43197.rs:3:9
|
|
||||||
|
|
|
||||||
LL | #![warn(const_err)]
|
|
||||||
| ^^^^^^^^^
|
|
||||||
|
|
||||||
warning: any use of this value will cause an error
|
error[E0080]: evaluation of constant value failed
|
||||||
--> $DIR/issue-43197.rs:13:24
|
--> $DIR/issue-43197.rs:8:24
|
||||||
|
|
|
|
||||||
LL | const Y: u32 = foo(0 - 1);
|
LL | const Y: u32 = foo(0 - 1);
|
||||||
| ------------ ^^^^^ attempt to compute `0_u32 - 1_u32`, which would overflow
|
| ^^^^^ attempt to compute `0_u32 - 1_u32`, which would overflow
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
|
|
||||||
error[E0080]: evaluation of constant value failed
|
error: aborting due to 2 previous errors
|
||||||
--> $DIR/issue-43197.rs:16:23
|
|
||||||
|
|
|
||||||
LL | println!("{} {}", X, Y);
|
|
||||||
| ^ referenced constant has errors
|
|
||||||
|
|
||||||
warning: erroneous constant used
|
|
||||||
--> $DIR/issue-43197.rs:16:23
|
|
||||||
|
|
|
||||||
LL | println!("{} {}", X, Y);
|
|
||||||
| ^ referenced constant has errors
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
= note: this warning originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)
|
|
||||||
|
|
||||||
error[E0080]: evaluation of constant value failed
|
|
||||||
--> $DIR/issue-43197.rs:16:26
|
|
||||||
|
|
|
||||||
LL | println!("{} {}", X, Y);
|
|
||||||
| ^ referenced constant has errors
|
|
||||||
|
|
||||||
warning: erroneous constant used
|
|
||||||
--> $DIR/issue-43197.rs:16:26
|
|
||||||
|
|
|
||||||
LL | println!("{} {}", X, Y);
|
|
||||||
| ^ referenced constant has errors
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
= note: this warning originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)
|
|
||||||
|
|
||||||
error: aborting due to 2 previous errors; 4 warnings emitted
|
|
||||||
|
|
||||||
For more information about this error, try `rustc --explain E0080`.
|
For more information about this error, try `rustc --explain E0080`.
|
||||||
Future incompatibility report: Future breakage diagnostic:
|
|
||||||
warning: any use of this value will cause an error
|
|
||||||
--> $DIR/issue-43197.rs:10:20
|
|
||||||
|
|
|
||||||
LL | const X: u32 = 0 - 1;
|
|
||||||
| ------------ ^^^^^ attempt to compute `0_u32 - 1_u32`, which would overflow
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
note: the lint level is defined here
|
|
||||||
--> $DIR/issue-43197.rs:3:9
|
|
||||||
|
|
|
||||||
LL | #![warn(const_err)]
|
|
||||||
| ^^^^^^^^^
|
|
||||||
|
|
||||||
Future breakage diagnostic:
|
|
||||||
warning: any use of this value will cause an error
|
|
||||||
--> $DIR/issue-43197.rs:13:24
|
|
||||||
|
|
|
||||||
LL | const Y: u32 = foo(0 - 1);
|
|
||||||
| ------------ ^^^^^ attempt to compute `0_u32 - 1_u32`, which would overflow
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
note: the lint level is defined here
|
|
||||||
--> $DIR/issue-43197.rs:3:9
|
|
||||||
|
|
|
||||||
LL | #![warn(const_err)]
|
|
||||||
| ^^^^^^^^^
|
|
||||||
|
|
||||||
Future breakage diagnostic:
|
|
||||||
warning: erroneous constant used
|
|
||||||
--> $DIR/issue-43197.rs:16:23
|
|
||||||
|
|
|
||||||
LL | println!("{} {}", X, Y);
|
|
||||||
| ^ referenced constant has errors
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
note: the lint level is defined here
|
|
||||||
--> $DIR/issue-43197.rs:3:9
|
|
||||||
|
|
|
||||||
LL | #![warn(const_err)]
|
|
||||||
| ^^^^^^^^^
|
|
||||||
= note: this warning originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)
|
|
||||||
|
|
||||||
Future breakage diagnostic:
|
|
||||||
warning: erroneous constant used
|
|
||||||
--> $DIR/issue-43197.rs:16:26
|
|
||||||
|
|
|
||||||
LL | println!("{} {}", X, Y);
|
|
||||||
| ^ referenced constant has errors
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
note: the lint level is defined here
|
|
||||||
--> $DIR/issue-43197.rs:3:9
|
|
||||||
|
|
|
||||||
LL | #![warn(const_err)]
|
|
||||||
| ^^^^^^^^^
|
|
||||||
= note: this warning originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)
|
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
// build-fail
|
// build-fail
|
||||||
|
|
||||||
#![allow(const_err)]
|
|
||||||
|
|
||||||
trait Foo {
|
trait Foo {
|
||||||
const AMT: usize;
|
const AMT: usize;
|
||||||
}
|
}
|
||||||
|
@ -12,7 +10,7 @@ enum Bar<A, B> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<A: Foo, B: Foo> Foo for Bar<A, B> {
|
impl<A: Foo, B: Foo> Foo for Bar<A, B> {
|
||||||
const AMT: usize = [A::AMT][(A::AMT > B::AMT) as usize];
|
const AMT: usize = [A::AMT][(A::AMT > B::AMT) as usize]; //~ERROR evaluation of `<Bar<u16, u8> as Foo>::AMT` failed
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Foo for u8 {
|
impl Foo for u8 {
|
||||||
|
@ -26,4 +24,5 @@ impl Foo for u16 {
|
||||||
fn main() {
|
fn main() {
|
||||||
println!("{}", <Bar<u16, u8> as Foo>::AMT);
|
println!("{}", <Bar<u16, u8> as Foo>::AMT);
|
||||||
//~^ ERROR evaluation of constant value failed
|
//~^ ERROR evaluation of constant value failed
|
||||||
|
//~| ERROR erroneous constant used
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,40 +1,23 @@
|
||||||
error[E0080]: evaluation of constant value failed
|
error[E0080]: evaluation of `<Bar<u16, u8> as Foo>::AMT` failed
|
||||||
--> $DIR/issue-44578.rs:27:20
|
--> $DIR/issue-44578.rs:13:24
|
||||||
|
|
|
||||||
LL | println!("{}", <Bar<u16, u8> as Foo>::AMT);
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors
|
|
||||||
|
|
||||||
error: aborting due to previous error
|
|
||||||
|
|
||||||
For more information about this error, try `rustc --explain E0080`.
|
|
||||||
Future incompatibility report: Future breakage diagnostic:
|
|
||||||
warning: any use of this value will cause an error
|
|
||||||
--> $DIR/issue-44578.rs:15:24
|
|
||||||
|
|
|
|
||||||
LL | const AMT: usize = [A::AMT][(A::AMT > B::AMT) as usize];
|
LL | const AMT: usize = [A::AMT][(A::AMT > B::AMT) as usize];
|
||||||
| ---------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ index out of bounds: the length is 1 but the index is 1
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ index out of bounds: the length is 1 but the index is 1
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
note: the lint level is defined here
|
|
||||||
--> $DIR/issue-44578.rs:3:10
|
|
||||||
|
|
|
||||||
LL | #![allow(const_err)]
|
|
||||||
| ^^^^^^^^^
|
|
||||||
|
|
||||||
Future breakage diagnostic:
|
error[E0080]: evaluation of constant value failed
|
||||||
warning: erroneous constant used
|
--> $DIR/issue-44578.rs:25:20
|
||||||
--> $DIR/issue-44578.rs:27:20
|
|
|
||||||
|
LL | println!("{}", <Bar<u16, u8> as Foo>::AMT);
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors
|
||||||
|
|
||||||
|
error[E0080]: erroneous constant used
|
||||||
|
--> $DIR/issue-44578.rs:25:20
|
||||||
|
|
|
|
||||||
LL | println!("{}", <Bar<u16, u8> as Foo>::AMT);
|
LL | println!("{}", <Bar<u16, u8> as Foo>::AMT);
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors
|
||||||
|
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
= note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
note: the lint level is defined here
|
|
||||||
--> $DIR/issue-44578.rs:3:10
|
|
||||||
|
|
|
||||||
LL | #![allow(const_err)]
|
|
||||||
| ^^^^^^^^^
|
|
||||||
= note: this warning originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)
|
|
||||||
|
|
||||||
|
error: aborting due to 3 previous errors
|
||||||
|
|
||||||
|
For more information about this error, try `rustc --explain E0080`.
|
||||||
|
|
|
@ -11,8 +11,7 @@ trait Foo<T> {
|
||||||
struct A<T>(T);
|
struct A<T>(T);
|
||||||
|
|
||||||
impl<T: C> Foo<T> for A<T> {
|
impl<T: C> Foo<T> for A<T> {
|
||||||
const BAR: usize = [5, 6, 7][T::BOO]; //~ ERROR any use of this value will cause an error
|
const BAR: usize = [5, 6, 7][T::BOO]; //~ ERROR evaluation of `<A<()> as Foo<()>>::BAR` failed
|
||||||
//~| WARN this was previously accepted by the compiler but is being phased out
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn foo<T: C>() -> &'static usize {
|
fn foo<T: C>() -> &'static usize {
|
||||||
|
|
|
@ -1,21 +1,17 @@
|
||||||
error: any use of this value will cause an error
|
error[E0080]: evaluation of `<A<()> as Foo<()>>::BAR` failed
|
||||||
--> $DIR/issue-50814-2.rs:14:24
|
--> $DIR/issue-50814-2.rs:14:24
|
||||||
|
|
|
|
||||||
LL | const BAR: usize = [5, 6, 7][T::BOO];
|
LL | const BAR: usize = [5, 6, 7][T::BOO];
|
||||||
| ---------------- ^^^^^^^^^^^^^^^^^ index out of bounds: the length is 3 but the index is 42
|
| ^^^^^^^^^^^^^^^^^ index out of bounds: the length is 3 but the index is 42
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
= note: `#[deny(const_err)]` on by default
|
|
||||||
|
|
||||||
error[E0080]: evaluation of `foo::<()>` failed
|
error[E0080]: evaluation of `foo::<()>` failed
|
||||||
--> $DIR/issue-50814-2.rs:19:6
|
--> $DIR/issue-50814-2.rs:18:6
|
||||||
|
|
|
|
||||||
LL | &<A<T> as Foo<T>>::BAR
|
LL | &<A<T> as Foo<T>>::BAR
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors
|
| ^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors
|
||||||
|
|
||||||
note: the above error was encountered while instantiating `fn foo::<()>`
|
note: the above error was encountered while instantiating `fn foo::<()>`
|
||||||
--> $DIR/issue-50814-2.rs:31:22
|
--> $DIR/issue-50814-2.rs:30:22
|
||||||
|
|
|
|
||||||
LL | println!("{:x}", foo::<()>() as *const usize as usize);
|
LL | println!("{:x}", foo::<()>() as *const usize as usize);
|
||||||
| ^^^^^^^^^^^
|
| ^^^^^^^^^^^
|
||||||
|
@ -23,14 +19,3 @@ LL | println!("{:x}", foo::<()>() as *const usize as usize);
|
||||||
error: aborting due to 2 previous errors
|
error: aborting due to 2 previous errors
|
||||||
|
|
||||||
For more information about this error, try `rustc --explain E0080`.
|
For more information about this error, try `rustc --explain E0080`.
|
||||||
Future incompatibility report: Future breakage diagnostic:
|
|
||||||
error: any use of this value will cause an error
|
|
||||||
--> $DIR/issue-50814-2.rs:14:24
|
|
||||||
|
|
|
||||||
LL | const BAR: usize = [5, 6, 7][T::BOO];
|
|
||||||
| ---------------- ^^^^^^^^^^^^^^^^^ index out of bounds: the length is 3 but the index is 42
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
= note: `#[deny(const_err)]` on by default
|
|
||||||
|
|
||||||
|
|
|
@ -13,8 +13,7 @@ struct Sum<A,B>(A,B);
|
||||||
|
|
||||||
impl<A: Unsigned, B: Unsigned> Unsigned for Sum<A,B> {
|
impl<A: Unsigned, B: Unsigned> Unsigned for Sum<A,B> {
|
||||||
const MAX: u8 = A::MAX + B::MAX;
|
const MAX: u8 = A::MAX + B::MAX;
|
||||||
//~^ ERROR any use of this value will cause an error [const_err]
|
//~^ ERROR evaluation of `<Sum<U8, U8> as Unsigned>::MAX` failed
|
||||||
//~| WARN this was previously accepted by the compiler but is being phased out
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn foo<T>(_: T) -> &'static u8 {
|
fn foo<T>(_: T) -> &'static u8 {
|
||||||
|
|
|
@ -1,21 +1,17 @@
|
||||||
error: any use of this value will cause an error
|
error[E0080]: evaluation of `<Sum<U8, U8> as Unsigned>::MAX` failed
|
||||||
--> $DIR/issue-50814.rs:15:21
|
--> $DIR/issue-50814.rs:15:21
|
||||||
|
|
|
|
||||||
LL | const MAX: u8 = A::MAX + B::MAX;
|
LL | const MAX: u8 = A::MAX + B::MAX;
|
||||||
| ------------- ^^^^^^^^^^^^^^^ attempt to compute `u8::MAX + u8::MAX`, which would overflow
|
| ^^^^^^^^^^^^^^^ attempt to compute `u8::MAX + u8::MAX`, which would overflow
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
= note: `#[deny(const_err)]` on by default
|
|
||||||
|
|
||||||
error[E0080]: evaluation of `foo::<i32>` failed
|
error[E0080]: evaluation of `foo::<i32>` failed
|
||||||
--> $DIR/issue-50814.rs:21:6
|
--> $DIR/issue-50814.rs:20:6
|
||||||
|
|
|
|
||||||
LL | &Sum::<U8,U8>::MAX
|
LL | &Sum::<U8,U8>::MAX
|
||||||
| ^^^^^^^^^^^^^^^^^ referenced constant has errors
|
| ^^^^^^^^^^^^^^^^^ referenced constant has errors
|
||||||
|
|
||||||
note: the above error was encountered while instantiating `fn foo::<i32>`
|
note: the above error was encountered while instantiating `fn foo::<i32>`
|
||||||
--> $DIR/issue-50814.rs:26:5
|
--> $DIR/issue-50814.rs:25:5
|
||||||
|
|
|
|
||||||
LL | foo(0);
|
LL | foo(0);
|
||||||
| ^^^^^^
|
| ^^^^^^
|
||||||
|
@ -23,14 +19,3 @@ LL | foo(0);
|
||||||
error: aborting due to 2 previous errors
|
error: aborting due to 2 previous errors
|
||||||
|
|
||||||
For more information about this error, try `rustc --explain E0080`.
|
For more information about this error, try `rustc --explain E0080`.
|
||||||
Future incompatibility report: Future breakage diagnostic:
|
|
||||||
error: any use of this value will cause an error
|
|
||||||
--> $DIR/issue-50814.rs:15:21
|
|
||||||
|
|
|
||||||
LL | const MAX: u8 = A::MAX + B::MAX;
|
|
||||||
| ------------- ^^^^^^^^^^^^^^^ attempt to compute `u8::MAX + u8::MAX`, which would overflow
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
= note: `#[deny(const_err)]` on by default
|
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
// build-fail
|
// build-fail
|
||||||
|
|
||||||
// Regression test for #66975
|
// Regression test for #66975
|
||||||
#![warn(const_err)]
|
|
||||||
#![feature(never_type)]
|
#![feature(never_type)]
|
||||||
|
|
||||||
struct PrintName;
|
struct PrintName;
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
error[E0080]: evaluation of constant value failed
|
error[E0080]: evaluation of constant value failed
|
||||||
--> $DIR/panic-assoc-never-type.rs:10:21
|
--> $DIR/panic-assoc-never-type.rs:9:21
|
||||||
|
|
|
|
||||||
LL | const VOID: ! = panic!();
|
LL | const VOID: ! = panic!();
|
||||||
| ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/panic-assoc-never-type.rs:10:21
|
| ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/panic-assoc-never-type.rs:9:21
|
||||||
|
|
|
|
||||||
= note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
|
= note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
|
||||||
error[E0080]: erroneous constant used
|
error[E0080]: erroneous constant used
|
||||||
--> $DIR/panic-assoc-never-type.rs:15:13
|
--> $DIR/panic-assoc-never-type.rs:14:13
|
||||||
|
|
|
|
||||||
LL | let _ = PrintName::VOID;
|
LL | let _ = PrintName::VOID;
|
||||||
| ^^^^^^^^^^^^^^^ referenced constant has errors
|
| ^^^^^^^^^^^^^^^ referenced constant has errors
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
// Regression test for #66975
|
// Regression test for #66975
|
||||||
#![warn(const_err)]
|
|
||||||
#![feature(never_type)]
|
#![feature(never_type)]
|
||||||
|
|
||||||
const VOID: ! = panic!();
|
const VOID: ! = panic!();
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
error[E0080]: evaluation of constant value failed
|
error[E0080]: evaluation of constant value failed
|
||||||
--> $DIR/panic-never-type.rs:5:17
|
--> $DIR/panic-never-type.rs:4:17
|
||||||
|
|
|
|
||||||
LL | const VOID: ! = panic!();
|
LL | const VOID: ! = panic!();
|
||||||
| ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/panic-never-type.rs:5:17
|
| ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/panic-never-type.rs:4:17
|
||||||
|
|
|
|
||||||
= note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
|
= note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
|
||||||
|
|
|
@ -5,9 +5,8 @@ const PARTIAL_OVERWRITE: () = {
|
||||||
let mut p = &42;
|
let mut p = &42;
|
||||||
unsafe {
|
unsafe {
|
||||||
let ptr: *mut _ = &mut p;
|
let ptr: *mut _ = &mut p;
|
||||||
*(ptr as *mut u8) = 123; //~ ERROR any use of this value
|
*(ptr as *mut u8) = 123; //~ ERROR constant
|
||||||
//~| unable to overwrite parts of a pointer
|
//~| unable to overwrite parts of a pointer
|
||||||
//~| WARN previously accepted
|
|
||||||
}
|
}
|
||||||
let x = *p;
|
let x = *p;
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,33 +1,12 @@
|
||||||
error: any use of this value will cause an error
|
error[E0080]: evaluation of constant value failed
|
||||||
--> $DIR/partial_ptr_overwrite.rs:8:9
|
--> $DIR/partial_ptr_overwrite.rs:8:9
|
||||||
|
|
|
|
||||||
LL | const PARTIAL_OVERWRITE: () = {
|
|
||||||
| ---------------------------
|
|
||||||
...
|
|
||||||
LL | *(ptr as *mut u8) = 123;
|
LL | *(ptr as *mut u8) = 123;
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^ unable to overwrite parts of a pointer in memory at alloc4
|
| ^^^^^^^^^^^^^^^^^^^^^^^ unable to overwrite parts of a pointer in memory at alloc4
|
||||||
|
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
= help: this code performed an operation that depends on the underlying bytes representing a pointer
|
= help: this code performed an operation that depends on the underlying bytes representing a pointer
|
||||||
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
|
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
|
||||||
= note: `#[deny(const_err)]` on by default
|
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
Future incompatibility report: Future breakage diagnostic:
|
For more information about this error, try `rustc --explain E0080`.
|
||||||
error: any use of this value will cause an error
|
|
||||||
--> $DIR/partial_ptr_overwrite.rs:8:9
|
|
||||||
|
|
|
||||||
LL | const PARTIAL_OVERWRITE: () = {
|
|
||||||
| ---------------------------
|
|
||||||
...
|
|
||||||
LL | *(ptr as *mut u8) = 123;
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^ unable to overwrite parts of a pointer in memory at alloc4
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
= help: this code performed an operation that depends on the underlying bytes representing a pointer
|
|
||||||
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
|
|
||||||
= note: `#[deny(const_err)]` on by default
|
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
#![allow(const_err)]
|
|
||||||
|
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
union Bar {
|
union Bar {
|
||||||
a: &'static u8,
|
a: &'static u8,
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
error[E0716]: temporary value dropped while borrowed
|
error[E0716]: temporary value dropped while borrowed
|
||||||
--> $DIR/promoted_const_fn_fail.rs:19:27
|
--> $DIR/promoted_const_fn_fail.rs:17:27
|
||||||
|
|
|
|
||||||
LL | let x: &'static u8 = &(bar() + 1);
|
LL | let x: &'static u8 = &(bar() + 1);
|
||||||
| ----------- ^^^^^^^^^^^ creates a temporary which is freed while still in use
|
| ----------- ^^^^^^^^^^^ creates a temporary which is freed while still in use
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
#![deny(const_err)]
|
|
||||||
|
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
union Bar {
|
union Bar {
|
||||||
a: &'static u8,
|
a: &'static u8,
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
error[E0716]: temporary value dropped while borrowed
|
error[E0716]: temporary value dropped while borrowed
|
||||||
--> $DIR/promoted_const_fn_fail_deny_const_err.rs:20:27
|
--> $DIR/promoted_const_fn_fail_deny_const_err.rs:18:27
|
||||||
|
|
|
|
||||||
LL | let x: &'static u8 = &(bar() + 1);
|
LL | let x: &'static u8 = &(bar() + 1);
|
||||||
| ----------- ^^^^^^^^^^^ creates a temporary which is freed while still in use
|
| ----------- ^^^^^^^^^^^ creates a temporary which is freed while still in use
|
||||||
|
|
|
@ -5,111 +5,40 @@ LL | 0 - 1
|
||||||
| ^^^^^ attempt to compute `0_u32 - 1_u32`, which would overflow
|
| ^^^^^ attempt to compute `0_u32 - 1_u32`, which would overflow
|
||||||
|
|
|
|
||||||
note: the lint level is defined here
|
note: the lint level is defined here
|
||||||
--> $DIR/promoted_errors.rs:11:20
|
--> $DIR/promoted_errors.rs:11:9
|
||||||
|
|
|
|
||||||
LL | #![warn(const_err, arithmetic_overflow, unconditional_panic)]
|
LL | #![warn(arithmetic_overflow, unconditional_panic)]
|
||||||
| ^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
warning: this operation will panic at runtime
|
warning: this operation will panic at runtime
|
||||||
--> $DIR/promoted_errors.rs:21:5
|
--> $DIR/promoted_errors.rs:19:5
|
||||||
|
|
|
|
||||||
LL | 1 / 0
|
LL | 1 / 0
|
||||||
| ^^^^^ attempt to divide `1_i32` by zero
|
| ^^^^^ attempt to divide `1_i32` by zero
|
||||||
|
|
|
|
||||||
note: the lint level is defined here
|
note: the lint level is defined here
|
||||||
--> $DIR/promoted_errors.rs:11:41
|
--> $DIR/promoted_errors.rs:11:30
|
||||||
|
|
|
|
||||||
LL | #![warn(const_err, arithmetic_overflow, unconditional_panic)]
|
LL | #![warn(arithmetic_overflow, unconditional_panic)]
|
||||||
| ^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
warning: this operation will panic at runtime
|
warning: this operation will panic at runtime
|
||||||
--> $DIR/promoted_errors.rs:27:5
|
--> $DIR/promoted_errors.rs:23:5
|
||||||
|
|
|
|
||||||
LL | 1 / (1 - 1)
|
LL | 1 / (1 - 1)
|
||||||
| ^^^^^^^^^^^ attempt to divide `1_i32` by zero
|
| ^^^^^^^^^^^ attempt to divide `1_i32` by zero
|
||||||
|
|
||||||
warning: this operation will panic at runtime
|
warning: this operation will panic at runtime
|
||||||
--> $DIR/promoted_errors.rs:31:5
|
--> $DIR/promoted_errors.rs:27:5
|
||||||
|
|
|
|
||||||
LL | 1 / (false as i32)
|
LL | 1 / (false as i32)
|
||||||
| ^^^^^^^^^^^^^^^^^^ attempt to divide `1_i32` by zero
|
| ^^^^^^^^^^^^^^^^^^ attempt to divide `1_i32` by zero
|
||||||
|
|
||||||
warning: this operation will panic at runtime
|
warning: this operation will panic at runtime
|
||||||
--> $DIR/promoted_errors.rs:35:5
|
--> $DIR/promoted_errors.rs:31:5
|
||||||
|
|
|
|
||||||
LL | [1, 2, 3][4]
|
LL | [1, 2, 3][4]
|
||||||
| ^^^^^^^^^^^^ index out of bounds: the length is 3 but the index is 4
|
| ^^^^^^^^^^^^ index out of bounds: the length is 3 but the index is 4
|
||||||
|
|
||||||
warning: any use of this value will cause an error
|
warning: 5 warnings emitted
|
||||||
--> $DIR/promoted_errors.rs:15:5
|
|
||||||
|
|
|
||||||
LL | 0 - 1
|
|
||||||
| ^^^^^
|
|
||||||
| |
|
|
||||||
| attempt to compute `0_u32 - 1_u32`, which would overflow
|
|
||||||
| inside `overflow` at $DIR/promoted_errors.rs:15:5
|
|
||||||
| inside `X` at $DIR/promoted_errors.rs:43:29
|
|
||||||
...
|
|
||||||
LL | const X: () = {
|
|
||||||
| -----------
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
note: the lint level is defined here
|
|
||||||
--> $DIR/promoted_errors.rs:11:9
|
|
||||||
|
|
|
||||||
LL | #![warn(const_err, arithmetic_overflow, unconditional_panic)]
|
|
||||||
| ^^^^^^^^^
|
|
||||||
|
|
||||||
warning: any use of this value will cause an error
|
|
||||||
--> $DIR/promoted_errors.rs:43:28
|
|
||||||
|
|
|
||||||
LL | const X: () = {
|
|
||||||
| -----------
|
|
||||||
LL | let _x: &'static u32 = &overflow();
|
|
||||||
| ^^^^^^^^^^^ referenced constant has errors
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
|
|
||||||
warning: 7 warnings emitted
|
|
||||||
|
|
||||||
Future incompatibility report: Future breakage diagnostic:
|
|
||||||
warning: any use of this value will cause an error
|
|
||||||
--> $DIR/promoted_errors.rs:15:5
|
|
||||||
|
|
|
||||||
LL | 0 - 1
|
|
||||||
| ^^^^^
|
|
||||||
| |
|
|
||||||
| attempt to compute `0_u32 - 1_u32`, which would overflow
|
|
||||||
| inside `overflow` at $DIR/promoted_errors.rs:15:5
|
|
||||||
| inside `X` at $DIR/promoted_errors.rs:43:29
|
|
||||||
...
|
|
||||||
LL | const X: () = {
|
|
||||||
| -----------
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
note: the lint level is defined here
|
|
||||||
--> $DIR/promoted_errors.rs:11:9
|
|
||||||
|
|
|
||||||
LL | #![warn(const_err, arithmetic_overflow, unconditional_panic)]
|
|
||||||
| ^^^^^^^^^
|
|
||||||
|
|
||||||
Future breakage diagnostic:
|
|
||||||
warning: any use of this value will cause an error
|
|
||||||
--> $DIR/promoted_errors.rs:43:28
|
|
||||||
|
|
|
||||||
LL | const X: () = {
|
|
||||||
| -----------
|
|
||||||
LL | let _x: &'static u32 = &overflow();
|
|
||||||
| ^^^^^^^^^^^ referenced constant has errors
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
note: the lint level is defined here
|
|
||||||
--> $DIR/promoted_errors.rs:11:9
|
|
||||||
|
|
|
||||||
LL | #![warn(const_err, arithmetic_overflow, unconditional_panic)]
|
|
||||||
| ^^^^^^^^^
|
|
||||||
|
|
||||||
|
|
|
@ -5,113 +5,40 @@ LL | 0 - 1
|
||||||
| ^^^^^ attempt to compute `0_u32 - 1_u32`, which would overflow
|
| ^^^^^ attempt to compute `0_u32 - 1_u32`, which would overflow
|
||||||
|
|
|
|
||||||
note: the lint level is defined here
|
note: the lint level is defined here
|
||||||
--> $DIR/promoted_errors.rs:11:20
|
--> $DIR/promoted_errors.rs:11:9
|
||||||
|
|
|
|
||||||
LL | #![warn(const_err, arithmetic_overflow, unconditional_panic)]
|
LL | #![warn(arithmetic_overflow, unconditional_panic)]
|
||||||
| ^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
warning: this operation will panic at runtime
|
warning: this operation will panic at runtime
|
||||||
--> $DIR/promoted_errors.rs:21:5
|
--> $DIR/promoted_errors.rs:19:5
|
||||||
|
|
|
|
||||||
LL | 1 / 0
|
LL | 1 / 0
|
||||||
| ^^^^^ attempt to divide `1_i32` by zero
|
| ^^^^^ attempt to divide `1_i32` by zero
|
||||||
|
|
|
|
||||||
note: the lint level is defined here
|
note: the lint level is defined here
|
||||||
--> $DIR/promoted_errors.rs:11:41
|
--> $DIR/promoted_errors.rs:11:30
|
||||||
|
|
|
|
||||||
LL | #![warn(const_err, arithmetic_overflow, unconditional_panic)]
|
LL | #![warn(arithmetic_overflow, unconditional_panic)]
|
||||||
| ^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
warning: this operation will panic at runtime
|
warning: this operation will panic at runtime
|
||||||
--> $DIR/promoted_errors.rs:27:5
|
--> $DIR/promoted_errors.rs:23:5
|
||||||
|
|
|
|
||||||
LL | 1 / (1 - 1)
|
LL | 1 / (1 - 1)
|
||||||
| ^^^^^^^^^^^ attempt to divide `1_i32` by zero
|
| ^^^^^^^^^^^ attempt to divide `1_i32` by zero
|
||||||
|
|
||||||
warning: this operation will panic at runtime
|
warning: this operation will panic at runtime
|
||||||
--> $DIR/promoted_errors.rs:31:5
|
--> $DIR/promoted_errors.rs:27:5
|
||||||
|
|
|
|
||||||
LL | 1 / (false as i32)
|
LL | 1 / (false as i32)
|
||||||
| ^^^^^^^^^^^^^^^^^^ attempt to divide `1_i32` by zero
|
| ^^^^^^^^^^^^^^^^^^ attempt to divide `1_i32` by zero
|
||||||
|
|
||||||
warning: this operation will panic at runtime
|
warning: this operation will panic at runtime
|
||||||
--> $DIR/promoted_errors.rs:35:5
|
--> $DIR/promoted_errors.rs:31:5
|
||||||
|
|
|
|
||||||
LL | [1, 2, 3][4]
|
LL | [1, 2, 3][4]
|
||||||
| ^^^^^^^^^^^^ index out of bounds: the length is 3 but the index is 4
|
| ^^^^^^^^^^^^ index out of bounds: the length is 3 but the index is 4
|
||||||
|
|
||||||
warning: any use of this value will cause an error
|
warning: 5 warnings emitted
|
||||||
--> $DIR/promoted_errors.rs:21:5
|
|
||||||
|
|
|
||||||
LL | 1 / 0
|
|
||||||
| ^^^^^
|
|
||||||
| |
|
|
||||||
| attempt to divide `1_i32` by zero
|
|
||||||
| inside `div_by_zero1` at $DIR/promoted_errors.rs:21:5
|
|
||||||
| inside `X` at $DIR/promoted_errors.rs:46:29
|
|
||||||
...
|
|
||||||
LL | const X: () = {
|
|
||||||
| -----------
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
note: the lint level is defined here
|
|
||||||
--> $DIR/promoted_errors.rs:11:9
|
|
||||||
|
|
|
||||||
LL | #![warn(const_err, arithmetic_overflow, unconditional_panic)]
|
|
||||||
| ^^^^^^^^^
|
|
||||||
|
|
||||||
warning: any use of this value will cause an error
|
|
||||||
--> $DIR/promoted_errors.rs:46:28
|
|
||||||
|
|
|
||||||
LL | const X: () = {
|
|
||||||
| -----------
|
|
||||||
...
|
|
||||||
LL | let _x: &'static i32 = &div_by_zero1();
|
|
||||||
| ^^^^^^^^^^^^^^^ referenced constant has errors
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
|
|
||||||
warning: 7 warnings emitted
|
|
||||||
|
|
||||||
Future incompatibility report: Future breakage diagnostic:
|
|
||||||
warning: any use of this value will cause an error
|
|
||||||
--> $DIR/promoted_errors.rs:21:5
|
|
||||||
|
|
|
||||||
LL | 1 / 0
|
|
||||||
| ^^^^^
|
|
||||||
| |
|
|
||||||
| attempt to divide `1_i32` by zero
|
|
||||||
| inside `div_by_zero1` at $DIR/promoted_errors.rs:21:5
|
|
||||||
| inside `X` at $DIR/promoted_errors.rs:46:29
|
|
||||||
...
|
|
||||||
LL | const X: () = {
|
|
||||||
| -----------
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
note: the lint level is defined here
|
|
||||||
--> $DIR/promoted_errors.rs:11:9
|
|
||||||
|
|
|
||||||
LL | #![warn(const_err, arithmetic_overflow, unconditional_panic)]
|
|
||||||
| ^^^^^^^^^
|
|
||||||
|
|
||||||
Future breakage diagnostic:
|
|
||||||
warning: any use of this value will cause an error
|
|
||||||
--> $DIR/promoted_errors.rs:46:28
|
|
||||||
|
|
|
||||||
LL | const X: () = {
|
|
||||||
| -----------
|
|
||||||
...
|
|
||||||
LL | let _x: &'static i32 = &div_by_zero1();
|
|
||||||
| ^^^^^^^^^^^^^^^ referenced constant has errors
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
note: the lint level is defined here
|
|
||||||
--> $DIR/promoted_errors.rs:11:9
|
|
||||||
|
|
|
||||||
LL | #![warn(const_err, arithmetic_overflow, unconditional_panic)]
|
|
||||||
| ^^^^^^^^^
|
|
||||||
|
|
||||||
|
|
|
@ -5,111 +5,40 @@ LL | 0 - 1
|
||||||
| ^^^^^ attempt to compute `0_u32 - 1_u32`, which would overflow
|
| ^^^^^ attempt to compute `0_u32 - 1_u32`, which would overflow
|
||||||
|
|
|
|
||||||
note: the lint level is defined here
|
note: the lint level is defined here
|
||||||
--> $DIR/promoted_errors.rs:11:20
|
--> $DIR/promoted_errors.rs:11:9
|
||||||
|
|
|
|
||||||
LL | #![warn(const_err, arithmetic_overflow, unconditional_panic)]
|
LL | #![warn(arithmetic_overflow, unconditional_panic)]
|
||||||
| ^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
warning: this operation will panic at runtime
|
warning: this operation will panic at runtime
|
||||||
--> $DIR/promoted_errors.rs:21:5
|
--> $DIR/promoted_errors.rs:19:5
|
||||||
|
|
|
|
||||||
LL | 1 / 0
|
LL | 1 / 0
|
||||||
| ^^^^^ attempt to divide `1_i32` by zero
|
| ^^^^^ attempt to divide `1_i32` by zero
|
||||||
|
|
|
|
||||||
note: the lint level is defined here
|
note: the lint level is defined here
|
||||||
--> $DIR/promoted_errors.rs:11:41
|
--> $DIR/promoted_errors.rs:11:30
|
||||||
|
|
|
|
||||||
LL | #![warn(const_err, arithmetic_overflow, unconditional_panic)]
|
LL | #![warn(arithmetic_overflow, unconditional_panic)]
|
||||||
| ^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
warning: this operation will panic at runtime
|
warning: this operation will panic at runtime
|
||||||
--> $DIR/promoted_errors.rs:27:5
|
--> $DIR/promoted_errors.rs:23:5
|
||||||
|
|
|
|
||||||
LL | 1 / (1 - 1)
|
LL | 1 / (1 - 1)
|
||||||
| ^^^^^^^^^^^ attempt to divide `1_i32` by zero
|
| ^^^^^^^^^^^ attempt to divide `1_i32` by zero
|
||||||
|
|
||||||
warning: this operation will panic at runtime
|
warning: this operation will panic at runtime
|
||||||
--> $DIR/promoted_errors.rs:31:5
|
--> $DIR/promoted_errors.rs:27:5
|
||||||
|
|
|
|
||||||
LL | 1 / (false as i32)
|
LL | 1 / (false as i32)
|
||||||
| ^^^^^^^^^^^^^^^^^^ attempt to divide `1_i32` by zero
|
| ^^^^^^^^^^^^^^^^^^ attempt to divide `1_i32` by zero
|
||||||
|
|
||||||
warning: this operation will panic at runtime
|
warning: this operation will panic at runtime
|
||||||
--> $DIR/promoted_errors.rs:35:5
|
--> $DIR/promoted_errors.rs:31:5
|
||||||
|
|
|
|
||||||
LL | [1, 2, 3][4]
|
LL | [1, 2, 3][4]
|
||||||
| ^^^^^^^^^^^^ index out of bounds: the length is 3 but the index is 4
|
| ^^^^^^^^^^^^ index out of bounds: the length is 3 but the index is 4
|
||||||
|
|
||||||
warning: any use of this value will cause an error
|
warning: 5 warnings emitted
|
||||||
--> $DIR/promoted_errors.rs:15:5
|
|
||||||
|
|
|
||||||
LL | 0 - 1
|
|
||||||
| ^^^^^
|
|
||||||
| |
|
|
||||||
| attempt to compute `0_u32 - 1_u32`, which would overflow
|
|
||||||
| inside `overflow` at $DIR/promoted_errors.rs:15:5
|
|
||||||
| inside `X` at $DIR/promoted_errors.rs:43:29
|
|
||||||
...
|
|
||||||
LL | const X: () = {
|
|
||||||
| -----------
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
note: the lint level is defined here
|
|
||||||
--> $DIR/promoted_errors.rs:11:9
|
|
||||||
|
|
|
||||||
LL | #![warn(const_err, arithmetic_overflow, unconditional_panic)]
|
|
||||||
| ^^^^^^^^^
|
|
||||||
|
|
||||||
warning: any use of this value will cause an error
|
|
||||||
--> $DIR/promoted_errors.rs:43:28
|
|
||||||
|
|
|
||||||
LL | const X: () = {
|
|
||||||
| -----------
|
|
||||||
LL | let _x: &'static u32 = &overflow();
|
|
||||||
| ^^^^^^^^^^^ referenced constant has errors
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
|
|
||||||
warning: 7 warnings emitted
|
|
||||||
|
|
||||||
Future incompatibility report: Future breakage diagnostic:
|
|
||||||
warning: any use of this value will cause an error
|
|
||||||
--> $DIR/promoted_errors.rs:15:5
|
|
||||||
|
|
|
||||||
LL | 0 - 1
|
|
||||||
| ^^^^^
|
|
||||||
| |
|
|
||||||
| attempt to compute `0_u32 - 1_u32`, which would overflow
|
|
||||||
| inside `overflow` at $DIR/promoted_errors.rs:15:5
|
|
||||||
| inside `X` at $DIR/promoted_errors.rs:43:29
|
|
||||||
...
|
|
||||||
LL | const X: () = {
|
|
||||||
| -----------
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
note: the lint level is defined here
|
|
||||||
--> $DIR/promoted_errors.rs:11:9
|
|
||||||
|
|
|
||||||
LL | #![warn(const_err, arithmetic_overflow, unconditional_panic)]
|
|
||||||
| ^^^^^^^^^
|
|
||||||
|
|
||||||
Future breakage diagnostic:
|
|
||||||
warning: any use of this value will cause an error
|
|
||||||
--> $DIR/promoted_errors.rs:43:28
|
|
||||||
|
|
|
||||||
LL | const X: () = {
|
|
||||||
| -----------
|
|
||||||
LL | let _x: &'static u32 = &overflow();
|
|
||||||
| ^^^^^^^^^^^ referenced constant has errors
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
note: the lint level is defined here
|
|
||||||
--> $DIR/promoted_errors.rs:11:9
|
|
||||||
|
|
|
||||||
LL | #![warn(const_err, arithmetic_overflow, unconditional_panic)]
|
|
||||||
| ^^^^^^^^^
|
|
||||||
|
|
||||||
|
|
|
@ -8,20 +8,16 @@
|
||||||
|
|
||||||
//! This test ensures that when we promote code that fails to evaluate, the build still succeeds.
|
//! This test ensures that when we promote code that fails to evaluate, the build still succeeds.
|
||||||
|
|
||||||
#![warn(const_err, arithmetic_overflow, unconditional_panic)]
|
#![warn(arithmetic_overflow, unconditional_panic)]
|
||||||
|
|
||||||
// The only way to have promoteds that fail is in `const fn` called from `const`/`static`.
|
// The only way to have promoteds that fail is in `const fn` called from `const`/`static`.
|
||||||
const fn overflow() -> u32 {
|
const fn overflow() -> u32 {
|
||||||
0 - 1
|
0 - 1
|
||||||
//[opt_with_overflow_checks,noopt]~^ WARN any use of this value will cause an error
|
//~^ WARN this arithmetic operation will overflow
|
||||||
//[opt_with_overflow_checks,noopt]~| WARN this was previously accepted by the compiler
|
|
||||||
//~^^^ WARN this arithmetic operation will overflow
|
|
||||||
}
|
}
|
||||||
const fn div_by_zero1() -> i32 {
|
const fn div_by_zero1() -> i32 {
|
||||||
1 / 0
|
1 / 0
|
||||||
//[opt]~^ WARN any use of this value will cause an error
|
//~^ WARN this operation will panic at runtime
|
||||||
//[opt]~| WARN this was previously accepted by the compiler but is being phased out
|
|
||||||
//~^^^ WARN this operation will panic at runtime
|
|
||||||
}
|
}
|
||||||
const fn div_by_zero2() -> i32 {
|
const fn div_by_zero2() -> i32 {
|
||||||
1 / (1 - 1)
|
1 / (1 - 1)
|
||||||
|
@ -36,21 +32,6 @@ const fn oob() -> i32 {
|
||||||
//~^ WARN this operation will panic at runtime
|
//~^ WARN this operation will panic at runtime
|
||||||
}
|
}
|
||||||
|
|
||||||
// An unused constant containing failing promoteds.
|
|
||||||
// This should work as long as `const_err` can be turned into just a warning;
|
|
||||||
// once it turns into a hard error, just remove `X`.
|
|
||||||
const X: () = {
|
|
||||||
let _x: &'static u32 = &overflow();
|
|
||||||
//[opt_with_overflow_checks,noopt]~^ WARN any use of this value will cause an error
|
|
||||||
//[opt_with_overflow_checks,noopt]~| WARN this was previously accepted by the compiler
|
|
||||||
let _x: &'static i32 = &div_by_zero1();
|
|
||||||
//[opt]~^ WARN any use of this value will cause an error
|
|
||||||
//[opt]~| WARN this was previously accepted by the compiler but is being phased out
|
|
||||||
let _x: &'static i32 = &div_by_zero2();
|
|
||||||
let _x: &'static i32 = &div_by_zero3();
|
|
||||||
let _x: &'static i32 = &oob();
|
|
||||||
};
|
|
||||||
|
|
||||||
const fn mk_false() -> bool { false }
|
const fn mk_false() -> bool { false }
|
||||||
|
|
||||||
// An actually used constant referencing failing promoteds in dead code.
|
// An actually used constant referencing failing promoteds in dead code.
|
||||||
|
|
|
@ -1,10 +0,0 @@
|
||||||
// check-pass
|
|
||||||
#![warn(const_err)]
|
|
||||||
|
|
||||||
#![crate_type = "lib"]
|
|
||||||
|
|
||||||
pub const Z: u32 = 0 - 1;
|
|
||||||
//~^ WARN any use of this value will cause an error
|
|
||||||
//~| WARN this was previously accepted by the compiler but is being phased out
|
|
||||||
|
|
||||||
pub type Foo = [i32; 0 - 1];
|
|
|
@ -1,31 +0,0 @@
|
||||||
warning: any use of this value will cause an error
|
|
||||||
--> $DIR/pub_const_err.rs:6:20
|
|
||||||
|
|
|
||||||
LL | pub const Z: u32 = 0 - 1;
|
|
||||||
| ---------------- ^^^^^ attempt to compute `0_u32 - 1_u32`, which would overflow
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
note: the lint level is defined here
|
|
||||||
--> $DIR/pub_const_err.rs:2:9
|
|
||||||
|
|
|
||||||
LL | #![warn(const_err)]
|
|
||||||
| ^^^^^^^^^
|
|
||||||
|
|
||||||
warning: 1 warning emitted
|
|
||||||
|
|
||||||
Future incompatibility report: Future breakage diagnostic:
|
|
||||||
warning: any use of this value will cause an error
|
|
||||||
--> $DIR/pub_const_err.rs:6:20
|
|
||||||
|
|
|
||||||
LL | pub const Z: u32 = 0 - 1;
|
|
||||||
| ---------------- ^^^^^ attempt to compute `0_u32 - 1_u32`, which would overflow
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
note: the lint level is defined here
|
|
||||||
--> $DIR/pub_const_err.rs:2:9
|
|
||||||
|
|
|
||||||
LL | #![warn(const_err)]
|
|
||||||
| ^^^^^^^^^
|
|
||||||
|
|
|
@ -1,10 +0,0 @@
|
||||||
// check-pass
|
|
||||||
#![warn(const_err)]
|
|
||||||
|
|
||||||
pub const Z: u32 = 0 - 1;
|
|
||||||
//~^ WARN any use of this value will cause an error
|
|
||||||
//~| WARN this was previously accepted by the compiler but is being phased out
|
|
||||||
|
|
||||||
pub type Foo = [i32; 0 - 1];
|
|
||||||
|
|
||||||
fn main() {}
|
|
|
@ -1,31 +0,0 @@
|
||||||
warning: any use of this value will cause an error
|
|
||||||
--> $DIR/pub_const_err_bin.rs:4:20
|
|
||||||
|
|
|
||||||
LL | pub const Z: u32 = 0 - 1;
|
|
||||||
| ---------------- ^^^^^ attempt to compute `0_u32 - 1_u32`, which would overflow
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
note: the lint level is defined here
|
|
||||||
--> $DIR/pub_const_err_bin.rs:2:9
|
|
||||||
|
|
|
||||||
LL | #![warn(const_err)]
|
|
||||||
| ^^^^^^^^^
|
|
||||||
|
|
||||||
warning: 1 warning emitted
|
|
||||||
|
|
||||||
Future incompatibility report: Future breakage diagnostic:
|
|
||||||
warning: any use of this value will cause an error
|
|
||||||
--> $DIR/pub_const_err_bin.rs:4:20
|
|
||||||
|
|
|
||||||
LL | pub const Z: u32 = 0 - 1;
|
|
||||||
| ---------------- ^^^^^ attempt to compute `0_u32 - 1_u32`, which would overflow
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
note: the lint level is defined here
|
|
||||||
--> $DIR/pub_const_err_bin.rs:2:9
|
|
||||||
|
|
|
||||||
LL | #![warn(const_err)]
|
|
||||||
| ^^^^^^^^^
|
|
||||||
|
|
|
@ -1,14 +1,11 @@
|
||||||
error: any use of this value will cause an error
|
error[E0080]: evaluation of constant value failed
|
||||||
--> $DIR/ref_to_int_match.rs:25:27
|
--> $DIR/ref_to_int_match.rs:25:27
|
||||||
|
|
|
|
||||||
LL | const BAR: Int = unsafe { Foo { r: &42 }.f };
|
LL | const BAR: Int = unsafe { Foo { r: &42 }.f };
|
||||||
| -------------- ^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
|
| ^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
|
||||||
|
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
= help: this code performed an operation that depends on the underlying bytes representing a pointer
|
= help: this code performed an operation that depends on the underlying bytes representing a pointer
|
||||||
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
|
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
|
||||||
= note: `#[deny(const_err)]` on by default
|
|
||||||
|
|
||||||
error: could not evaluate constant pattern
|
error: could not evaluate constant pattern
|
||||||
--> $DIR/ref_to_int_match.rs:7:14
|
--> $DIR/ref_to_int_match.rs:7:14
|
||||||
|
@ -24,16 +21,4 @@ LL | 10..=BAR => {},
|
||||||
|
|
||||||
error: aborting due to 3 previous errors
|
error: aborting due to 3 previous errors
|
||||||
|
|
||||||
Future incompatibility report: Future breakage diagnostic:
|
For more information about this error, try `rustc --explain E0080`.
|
||||||
error: any use of this value will cause an error
|
|
||||||
--> $DIR/ref_to_int_match.rs:25:27
|
|
||||||
|
|
|
||||||
LL | const BAR: Int = unsafe { Foo { r: &42 }.f };
|
|
||||||
| -------------- ^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
= help: this code performed an operation that depends on the underlying bytes representing a pointer
|
|
||||||
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
|
|
||||||
= note: `#[deny(const_err)]` on by default
|
|
||||||
|
|
||||||
|
|
|
@ -1,14 +1,11 @@
|
||||||
error: any use of this value will cause an error
|
error[E0080]: evaluation of constant value failed
|
||||||
--> $DIR/ref_to_int_match.rs:25:27
|
--> $DIR/ref_to_int_match.rs:25:27
|
||||||
|
|
|
|
||||||
LL | const BAR: Int = unsafe { Foo { r: &42 }.f };
|
LL | const BAR: Int = unsafe { Foo { r: &42 }.f };
|
||||||
| -------------- ^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
|
| ^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
|
||||||
|
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
= help: this code performed an operation that depends on the underlying bytes representing a pointer
|
= help: this code performed an operation that depends on the underlying bytes representing a pointer
|
||||||
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
|
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
|
||||||
= note: `#[deny(const_err)]` on by default
|
|
||||||
|
|
||||||
error: could not evaluate constant pattern
|
error: could not evaluate constant pattern
|
||||||
--> $DIR/ref_to_int_match.rs:7:14
|
--> $DIR/ref_to_int_match.rs:7:14
|
||||||
|
@ -24,16 +21,4 @@ LL | 10..=BAR => {},
|
||||||
|
|
||||||
error: aborting due to 3 previous errors
|
error: aborting due to 3 previous errors
|
||||||
|
|
||||||
Future incompatibility report: Future breakage diagnostic:
|
For more information about this error, try `rustc --explain E0080`.
|
||||||
error: any use of this value will cause an error
|
|
||||||
--> $DIR/ref_to_int_match.rs:25:27
|
|
||||||
|
|
|
||||||
LL | const BAR: Int = unsafe { Foo { r: &42 }.f };
|
|
||||||
| -------------- ^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
= help: this code performed an operation that depends on the underlying bytes representing a pointer
|
|
||||||
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
|
|
||||||
= note: `#[deny(const_err)]` on by default
|
|
||||||
|
|
||||||
|
|
|
@ -23,5 +23,4 @@ type Int = u64;
|
||||||
type Int = u32;
|
type Int = u32;
|
||||||
|
|
||||||
const BAR: Int = unsafe { Foo { r: &42 }.f };
|
const BAR: Int = unsafe { Foo { r: &42 }.f };
|
||||||
//~^ ERROR any use of this value will cause an error
|
//~^ ERROR constant
|
||||||
//~| WARN this was previously accepted by the compiler but is being phased out
|
|
||||||
|
|
|
@ -9,31 +9,26 @@ LL | const BAD_ENUM: Enum = unsafe { mem::transmute(1usize) };
|
||||||
01 00 00 00 │ ....
|
01 00 00 00 │ ....
|
||||||
}
|
}
|
||||||
|
|
||||||
error: any use of this value will cause an error
|
error[E0080]: evaluation of constant value failed
|
||||||
--> $DIR/ub-enum.rs:27:1
|
--> $DIR/ub-enum.rs:27:1
|
||||||
|
|
|
|
||||||
LL | const BAD_ENUM_PTR: Enum = unsafe { mem::transmute(&1) };
|
LL | const BAD_ENUM_PTR: Enum = unsafe { mem::transmute(&1) };
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
|
| ^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
|
||||||
|
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
= help: this code performed an operation that depends on the underlying bytes representing a pointer
|
= help: this code performed an operation that depends on the underlying bytes representing a pointer
|
||||||
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
|
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
|
||||||
= note: `#[deny(const_err)]` on by default
|
|
||||||
|
|
||||||
error: any use of this value will cause an error
|
error[E0080]: evaluation of constant value failed
|
||||||
--> $DIR/ub-enum.rs:31:1
|
--> $DIR/ub-enum.rs:30:1
|
||||||
|
|
|
|
||||||
LL | const BAD_ENUM_WRAPPED: Wrap<Enum> = unsafe { mem::transmute(&1) };
|
LL | const BAD_ENUM_WRAPPED: Wrap<Enum> = unsafe { mem::transmute(&1) };
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
|
||||||
|
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
= help: this code performed an operation that depends on the underlying bytes representing a pointer
|
= help: this code performed an operation that depends on the underlying bytes representing a pointer
|
||||||
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
|
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
|
||||||
|
|
||||||
error[E0080]: it is undefined behavior to use this value
|
error[E0080]: it is undefined behavior to use this value
|
||||||
--> $DIR/ub-enum.rs:44:1
|
--> $DIR/ub-enum.rs:42:1
|
||||||
|
|
|
|
||||||
LL | const BAD_ENUM2: Enum2 = unsafe { mem::transmute(0usize) };
|
LL | const BAD_ENUM2: Enum2 = unsafe { mem::transmute(0usize) };
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-tag>: encountered 0x00000000, but expected a valid enum tag
|
| ^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-tag>: encountered 0x00000000, but expected a valid enum tag
|
||||||
|
@ -43,47 +38,41 @@ LL | const BAD_ENUM2: Enum2 = unsafe { mem::transmute(0usize) };
|
||||||
00 00 00 00 │ ....
|
00 00 00 00 │ ....
|
||||||
}
|
}
|
||||||
|
|
||||||
error: any use of this value will cause an error
|
error[E0080]: evaluation of constant value failed
|
||||||
--> $DIR/ub-enum.rs:46:1
|
--> $DIR/ub-enum.rs:44:1
|
||||||
|
|
|
|
||||||
LL | const BAD_ENUM2_PTR: Enum2 = unsafe { mem::transmute(&0) };
|
LL | const BAD_ENUM2_PTR: Enum2 = unsafe { mem::transmute(&0) };
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
|
||||||
|
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
= help: this code performed an operation that depends on the underlying bytes representing a pointer
|
|
||||||
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
|
|
||||||
|
|
||||||
error: any use of this value will cause an error
|
|
||||||
--> $DIR/ub-enum.rs:50:1
|
|
||||||
|
|
|
||||||
LL | const BAD_ENUM2_WRAPPED: Wrap<Enum2> = unsafe { mem::transmute(&0) };
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
= help: this code performed an operation that depends on the underlying bytes representing a pointer
|
= help: this code performed an operation that depends on the underlying bytes representing a pointer
|
||||||
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
|
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
|
||||||
|
|
||||||
error[E0080]: evaluation of constant value failed
|
error[E0080]: evaluation of constant value failed
|
||||||
--> $DIR/ub-enum.rs:60:42
|
--> $DIR/ub-enum.rs:47:1
|
||||||
|
|
|
||||||
|
LL | const BAD_ENUM2_WRAPPED: Wrap<Enum2> = unsafe { mem::transmute(&0) };
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
|
||||||
|
|
|
||||||
|
= help: this code performed an operation that depends on the underlying bytes representing a pointer
|
||||||
|
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
|
||||||
|
|
||||||
|
error[E0080]: evaluation of constant value failed
|
||||||
|
--> $DIR/ub-enum.rs:56:42
|
||||||
|
|
|
|
||||||
LL | const BAD_ENUM2_UNDEF : Enum2 = unsafe { MaybeUninit { uninit: () }.init };
|
LL | const BAD_ENUM2_UNDEF : Enum2 = unsafe { MaybeUninit { uninit: () }.init };
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory
|
||||||
|
|
||||||
error: any use of this value will cause an error
|
error[E0080]: evaluation of constant value failed
|
||||||
--> $DIR/ub-enum.rs:65:1
|
--> $DIR/ub-enum.rs:61:1
|
||||||
|
|
|
|
||||||
LL | const BAD_ENUM2_OPTION_PTR: Option<Enum2> = unsafe { mem::transmute(&0) };
|
LL | const BAD_ENUM2_OPTION_PTR: Option<Enum2> = unsafe { mem::transmute(&0) };
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
|
||||||
|
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
= help: this code performed an operation that depends on the underlying bytes representing a pointer
|
= help: this code performed an operation that depends on the underlying bytes representing a pointer
|
||||||
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
|
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
|
||||||
|
|
||||||
error[E0080]: it is undefined behavior to use this value
|
error[E0080]: it is undefined behavior to use this value
|
||||||
--> $DIR/ub-enum.rs:83:1
|
--> $DIR/ub-enum.rs:78:1
|
||||||
|
|
|
|
||||||
LL | const BAD_UNINHABITED_VARIANT1: UninhDiscriminant = unsafe { mem::transmute(1u8) };
|
LL | const BAD_UNINHABITED_VARIANT1: UninhDiscriminant = unsafe { mem::transmute(1u8) };
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-variant(B)>.0: encountered a value of the never type `!`
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-variant(B)>.0: encountered a value of the never type `!`
|
||||||
|
@ -94,7 +83,7 @@ LL | const BAD_UNINHABITED_VARIANT1: UninhDiscriminant = unsafe { mem::transmute
|
||||||
}
|
}
|
||||||
|
|
||||||
error[E0080]: it is undefined behavior to use this value
|
error[E0080]: it is undefined behavior to use this value
|
||||||
--> $DIR/ub-enum.rs:85:1
|
--> $DIR/ub-enum.rs:80:1
|
||||||
|
|
|
|
||||||
LL | const BAD_UNINHABITED_VARIANT2: UninhDiscriminant = unsafe { mem::transmute(3u8) };
|
LL | const BAD_UNINHABITED_VARIANT2: UninhDiscriminant = unsafe { mem::transmute(3u8) };
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-variant(D)>.0: encountered a value of uninhabited type Never
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-variant(D)>.0: encountered a value of uninhabited type Never
|
||||||
|
@ -105,7 +94,7 @@ LL | const BAD_UNINHABITED_VARIANT2: UninhDiscriminant = unsafe { mem::transmute
|
||||||
}
|
}
|
||||||
|
|
||||||
error[E0080]: it is undefined behavior to use this value
|
error[E0080]: it is undefined behavior to use this value
|
||||||
--> $DIR/ub-enum.rs:93:1
|
--> $DIR/ub-enum.rs:88:1
|
||||||
|
|
|
|
||||||
LL | const BAD_OPTION_CHAR: Option<(char, char)> = Some(('x', unsafe { mem::transmute(!0u32) }));
|
LL | const BAD_OPTION_CHAR: Option<(char, char)> = Some(('x', unsafe { mem::transmute(!0u32) }));
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-variant(Some)>.0.1: encountered 0xffffffff, but expected a valid unicode scalar value (in `0..=0x10FFFF` but not in `0xD800..=0xDFFF`)
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-variant(Some)>.0.1: encountered 0xffffffff, but expected a valid unicode scalar value (in `0..=0x10FFFF` but not in `0xD800..=0xDFFF`)
|
||||||
|
@ -116,13 +105,13 @@ LL | const BAD_OPTION_CHAR: Option<(char, char)> = Some(('x', unsafe { mem::tran
|
||||||
}
|
}
|
||||||
|
|
||||||
error[E0080]: evaluation of constant value failed
|
error[E0080]: evaluation of constant value failed
|
||||||
--> $DIR/ub-enum.rs:98:77
|
--> $DIR/ub-enum.rs:93:77
|
||||||
|
|
|
|
||||||
LL | const BAD_UNINHABITED_WITH_DATA1: Result<(i32, Never), (i32, !)> = unsafe { mem::transmute(0u64) };
|
LL | const BAD_UNINHABITED_WITH_DATA1: Result<(i32, Never), (i32, !)> = unsafe { mem::transmute(0u64) };
|
||||||
| ^^^^^^^^^^^^^^^^^^^^ transmuting to uninhabited type
|
| ^^^^^^^^^^^^^^^^^^^^ transmuting to uninhabited type
|
||||||
|
|
||||||
error[E0080]: evaluation of constant value failed
|
error[E0080]: evaluation of constant value failed
|
||||||
--> $DIR/ub-enum.rs:100:77
|
--> $DIR/ub-enum.rs:95:77
|
||||||
|
|
|
|
||||||
LL | const BAD_UNINHABITED_WITH_DATA2: Result<(i32, !), (i32, Never)> = unsafe { mem::transmute(0u64) };
|
LL | const BAD_UNINHABITED_WITH_DATA2: Result<(i32, !), (i32, Never)> = unsafe { mem::transmute(0u64) };
|
||||||
| ^^^^^^^^^^^^^^^^^^^^ transmuting to uninhabited type
|
| ^^^^^^^^^^^^^^^^^^^^ transmuting to uninhabited type
|
||||||
|
@ -130,68 +119,3 @@ LL | const BAD_UNINHABITED_WITH_DATA2: Result<(i32, !), (i32, Never)> = unsafe {
|
||||||
error: aborting due to 13 previous errors
|
error: aborting due to 13 previous errors
|
||||||
|
|
||||||
For more information about this error, try `rustc --explain E0080`.
|
For more information about this error, try `rustc --explain E0080`.
|
||||||
Future incompatibility report: Future breakage diagnostic:
|
|
||||||
error: any use of this value will cause an error
|
|
||||||
--> $DIR/ub-enum.rs:27:1
|
|
||||||
|
|
|
||||||
LL | const BAD_ENUM_PTR: Enum = unsafe { mem::transmute(&1) };
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
= help: this code performed an operation that depends on the underlying bytes representing a pointer
|
|
||||||
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
|
|
||||||
= note: `#[deny(const_err)]` on by default
|
|
||||||
|
|
||||||
Future breakage diagnostic:
|
|
||||||
error: any use of this value will cause an error
|
|
||||||
--> $DIR/ub-enum.rs:31:1
|
|
||||||
|
|
|
||||||
LL | const BAD_ENUM_WRAPPED: Wrap<Enum> = unsafe { mem::transmute(&1) };
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
= help: this code performed an operation that depends on the underlying bytes representing a pointer
|
|
||||||
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
|
|
||||||
= note: `#[deny(const_err)]` on by default
|
|
||||||
|
|
||||||
Future breakage diagnostic:
|
|
||||||
error: any use of this value will cause an error
|
|
||||||
--> $DIR/ub-enum.rs:46:1
|
|
||||||
|
|
|
||||||
LL | const BAD_ENUM2_PTR: Enum2 = unsafe { mem::transmute(&0) };
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
= help: this code performed an operation that depends on the underlying bytes representing a pointer
|
|
||||||
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
|
|
||||||
= note: `#[deny(const_err)]` on by default
|
|
||||||
|
|
||||||
Future breakage diagnostic:
|
|
||||||
error: any use of this value will cause an error
|
|
||||||
--> $DIR/ub-enum.rs:50:1
|
|
||||||
|
|
|
||||||
LL | const BAD_ENUM2_WRAPPED: Wrap<Enum2> = unsafe { mem::transmute(&0) };
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
= help: this code performed an operation that depends on the underlying bytes representing a pointer
|
|
||||||
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
|
|
||||||
= note: `#[deny(const_err)]` on by default
|
|
||||||
|
|
||||||
Future breakage diagnostic:
|
|
||||||
error: any use of this value will cause an error
|
|
||||||
--> $DIR/ub-enum.rs:65:1
|
|
||||||
|
|
|
||||||
LL | const BAD_ENUM2_OPTION_PTR: Option<Enum2> = unsafe { mem::transmute(&0) };
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
= help: this code performed an operation that depends on the underlying bytes representing a pointer
|
|
||||||
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
|
|
||||||
= note: `#[deny(const_err)]` on by default
|
|
||||||
|
|
||||||
|
|
|
@ -9,31 +9,26 @@ LL | const BAD_ENUM: Enum = unsafe { mem::transmute(1usize) };
|
||||||
01 00 00 00 00 00 00 00 │ ........
|
01 00 00 00 00 00 00 00 │ ........
|
||||||
}
|
}
|
||||||
|
|
||||||
error: any use of this value will cause an error
|
error[E0080]: evaluation of constant value failed
|
||||||
--> $DIR/ub-enum.rs:27:1
|
--> $DIR/ub-enum.rs:27:1
|
||||||
|
|
|
|
||||||
LL | const BAD_ENUM_PTR: Enum = unsafe { mem::transmute(&1) };
|
LL | const BAD_ENUM_PTR: Enum = unsafe { mem::transmute(&1) };
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
|
| ^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
|
||||||
|
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
= help: this code performed an operation that depends on the underlying bytes representing a pointer
|
= help: this code performed an operation that depends on the underlying bytes representing a pointer
|
||||||
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
|
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
|
||||||
= note: `#[deny(const_err)]` on by default
|
|
||||||
|
|
||||||
error: any use of this value will cause an error
|
error[E0080]: evaluation of constant value failed
|
||||||
--> $DIR/ub-enum.rs:31:1
|
--> $DIR/ub-enum.rs:30:1
|
||||||
|
|
|
|
||||||
LL | const BAD_ENUM_WRAPPED: Wrap<Enum> = unsafe { mem::transmute(&1) };
|
LL | const BAD_ENUM_WRAPPED: Wrap<Enum> = unsafe { mem::transmute(&1) };
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
|
||||||
|
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
= help: this code performed an operation that depends on the underlying bytes representing a pointer
|
= help: this code performed an operation that depends on the underlying bytes representing a pointer
|
||||||
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
|
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
|
||||||
|
|
||||||
error[E0080]: it is undefined behavior to use this value
|
error[E0080]: it is undefined behavior to use this value
|
||||||
--> $DIR/ub-enum.rs:44:1
|
--> $DIR/ub-enum.rs:42:1
|
||||||
|
|
|
|
||||||
LL | const BAD_ENUM2: Enum2 = unsafe { mem::transmute(0usize) };
|
LL | const BAD_ENUM2: Enum2 = unsafe { mem::transmute(0usize) };
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-tag>: encountered 0x0000000000000000, but expected a valid enum tag
|
| ^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-tag>: encountered 0x0000000000000000, but expected a valid enum tag
|
||||||
|
@ -43,47 +38,41 @@ LL | const BAD_ENUM2: Enum2 = unsafe { mem::transmute(0usize) };
|
||||||
00 00 00 00 00 00 00 00 │ ........
|
00 00 00 00 00 00 00 00 │ ........
|
||||||
}
|
}
|
||||||
|
|
||||||
error: any use of this value will cause an error
|
error[E0080]: evaluation of constant value failed
|
||||||
--> $DIR/ub-enum.rs:46:1
|
--> $DIR/ub-enum.rs:44:1
|
||||||
|
|
|
|
||||||
LL | const BAD_ENUM2_PTR: Enum2 = unsafe { mem::transmute(&0) };
|
LL | const BAD_ENUM2_PTR: Enum2 = unsafe { mem::transmute(&0) };
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
|
||||||
|
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
= help: this code performed an operation that depends on the underlying bytes representing a pointer
|
|
||||||
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
|
|
||||||
|
|
||||||
error: any use of this value will cause an error
|
|
||||||
--> $DIR/ub-enum.rs:50:1
|
|
||||||
|
|
|
||||||
LL | const BAD_ENUM2_WRAPPED: Wrap<Enum2> = unsafe { mem::transmute(&0) };
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
= help: this code performed an operation that depends on the underlying bytes representing a pointer
|
= help: this code performed an operation that depends on the underlying bytes representing a pointer
|
||||||
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
|
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
|
||||||
|
|
||||||
error[E0080]: evaluation of constant value failed
|
error[E0080]: evaluation of constant value failed
|
||||||
--> $DIR/ub-enum.rs:60:42
|
--> $DIR/ub-enum.rs:47:1
|
||||||
|
|
|
||||||
|
LL | const BAD_ENUM2_WRAPPED: Wrap<Enum2> = unsafe { mem::transmute(&0) };
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
|
||||||
|
|
|
||||||
|
= help: this code performed an operation that depends on the underlying bytes representing a pointer
|
||||||
|
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
|
||||||
|
|
||||||
|
error[E0080]: evaluation of constant value failed
|
||||||
|
--> $DIR/ub-enum.rs:56:42
|
||||||
|
|
|
|
||||||
LL | const BAD_ENUM2_UNDEF : Enum2 = unsafe { MaybeUninit { uninit: () }.init };
|
LL | const BAD_ENUM2_UNDEF : Enum2 = unsafe { MaybeUninit { uninit: () }.init };
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory
|
||||||
|
|
||||||
error: any use of this value will cause an error
|
error[E0080]: evaluation of constant value failed
|
||||||
--> $DIR/ub-enum.rs:65:1
|
--> $DIR/ub-enum.rs:61:1
|
||||||
|
|
|
|
||||||
LL | const BAD_ENUM2_OPTION_PTR: Option<Enum2> = unsafe { mem::transmute(&0) };
|
LL | const BAD_ENUM2_OPTION_PTR: Option<Enum2> = unsafe { mem::transmute(&0) };
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
|
||||||
|
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
= help: this code performed an operation that depends on the underlying bytes representing a pointer
|
= help: this code performed an operation that depends on the underlying bytes representing a pointer
|
||||||
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
|
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
|
||||||
|
|
||||||
error[E0080]: it is undefined behavior to use this value
|
error[E0080]: it is undefined behavior to use this value
|
||||||
--> $DIR/ub-enum.rs:83:1
|
--> $DIR/ub-enum.rs:78:1
|
||||||
|
|
|
|
||||||
LL | const BAD_UNINHABITED_VARIANT1: UninhDiscriminant = unsafe { mem::transmute(1u8) };
|
LL | const BAD_UNINHABITED_VARIANT1: UninhDiscriminant = unsafe { mem::transmute(1u8) };
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-variant(B)>.0: encountered a value of the never type `!`
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-variant(B)>.0: encountered a value of the never type `!`
|
||||||
|
@ -94,7 +83,7 @@ LL | const BAD_UNINHABITED_VARIANT1: UninhDiscriminant = unsafe { mem::transmute
|
||||||
}
|
}
|
||||||
|
|
||||||
error[E0080]: it is undefined behavior to use this value
|
error[E0080]: it is undefined behavior to use this value
|
||||||
--> $DIR/ub-enum.rs:85:1
|
--> $DIR/ub-enum.rs:80:1
|
||||||
|
|
|
|
||||||
LL | const BAD_UNINHABITED_VARIANT2: UninhDiscriminant = unsafe { mem::transmute(3u8) };
|
LL | const BAD_UNINHABITED_VARIANT2: UninhDiscriminant = unsafe { mem::transmute(3u8) };
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-variant(D)>.0: encountered a value of uninhabited type Never
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-variant(D)>.0: encountered a value of uninhabited type Never
|
||||||
|
@ -105,7 +94,7 @@ LL | const BAD_UNINHABITED_VARIANT2: UninhDiscriminant = unsafe { mem::transmute
|
||||||
}
|
}
|
||||||
|
|
||||||
error[E0080]: it is undefined behavior to use this value
|
error[E0080]: it is undefined behavior to use this value
|
||||||
--> $DIR/ub-enum.rs:93:1
|
--> $DIR/ub-enum.rs:88:1
|
||||||
|
|
|
|
||||||
LL | const BAD_OPTION_CHAR: Option<(char, char)> = Some(('x', unsafe { mem::transmute(!0u32) }));
|
LL | const BAD_OPTION_CHAR: Option<(char, char)> = Some(('x', unsafe { mem::transmute(!0u32) }));
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-variant(Some)>.0.1: encountered 0xffffffff, but expected a valid unicode scalar value (in `0..=0x10FFFF` but not in `0xD800..=0xDFFF`)
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-variant(Some)>.0.1: encountered 0xffffffff, but expected a valid unicode scalar value (in `0..=0x10FFFF` but not in `0xD800..=0xDFFF`)
|
||||||
|
@ -116,13 +105,13 @@ LL | const BAD_OPTION_CHAR: Option<(char, char)> = Some(('x', unsafe { mem::tran
|
||||||
}
|
}
|
||||||
|
|
||||||
error[E0080]: evaluation of constant value failed
|
error[E0080]: evaluation of constant value failed
|
||||||
--> $DIR/ub-enum.rs:98:77
|
--> $DIR/ub-enum.rs:93:77
|
||||||
|
|
|
|
||||||
LL | const BAD_UNINHABITED_WITH_DATA1: Result<(i32, Never), (i32, !)> = unsafe { mem::transmute(0u64) };
|
LL | const BAD_UNINHABITED_WITH_DATA1: Result<(i32, Never), (i32, !)> = unsafe { mem::transmute(0u64) };
|
||||||
| ^^^^^^^^^^^^^^^^^^^^ transmuting to uninhabited type
|
| ^^^^^^^^^^^^^^^^^^^^ transmuting to uninhabited type
|
||||||
|
|
||||||
error[E0080]: evaluation of constant value failed
|
error[E0080]: evaluation of constant value failed
|
||||||
--> $DIR/ub-enum.rs:100:77
|
--> $DIR/ub-enum.rs:95:77
|
||||||
|
|
|
|
||||||
LL | const BAD_UNINHABITED_WITH_DATA2: Result<(i32, !), (i32, Never)> = unsafe { mem::transmute(0u64) };
|
LL | const BAD_UNINHABITED_WITH_DATA2: Result<(i32, !), (i32, Never)> = unsafe { mem::transmute(0u64) };
|
||||||
| ^^^^^^^^^^^^^^^^^^^^ transmuting to uninhabited type
|
| ^^^^^^^^^^^^^^^^^^^^ transmuting to uninhabited type
|
||||||
|
@ -130,68 +119,3 @@ LL | const BAD_UNINHABITED_WITH_DATA2: Result<(i32, !), (i32, Never)> = unsafe {
|
||||||
error: aborting due to 13 previous errors
|
error: aborting due to 13 previous errors
|
||||||
|
|
||||||
For more information about this error, try `rustc --explain E0080`.
|
For more information about this error, try `rustc --explain E0080`.
|
||||||
Future incompatibility report: Future breakage diagnostic:
|
|
||||||
error: any use of this value will cause an error
|
|
||||||
--> $DIR/ub-enum.rs:27:1
|
|
||||||
|
|
|
||||||
LL | const BAD_ENUM_PTR: Enum = unsafe { mem::transmute(&1) };
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
= help: this code performed an operation that depends on the underlying bytes representing a pointer
|
|
||||||
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
|
|
||||||
= note: `#[deny(const_err)]` on by default
|
|
||||||
|
|
||||||
Future breakage diagnostic:
|
|
||||||
error: any use of this value will cause an error
|
|
||||||
--> $DIR/ub-enum.rs:31:1
|
|
||||||
|
|
|
||||||
LL | const BAD_ENUM_WRAPPED: Wrap<Enum> = unsafe { mem::transmute(&1) };
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
= help: this code performed an operation that depends on the underlying bytes representing a pointer
|
|
||||||
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
|
|
||||||
= note: `#[deny(const_err)]` on by default
|
|
||||||
|
|
||||||
Future breakage diagnostic:
|
|
||||||
error: any use of this value will cause an error
|
|
||||||
--> $DIR/ub-enum.rs:46:1
|
|
||||||
|
|
|
||||||
LL | const BAD_ENUM2_PTR: Enum2 = unsafe { mem::transmute(&0) };
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
= help: this code performed an operation that depends on the underlying bytes representing a pointer
|
|
||||||
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
|
|
||||||
= note: `#[deny(const_err)]` on by default
|
|
||||||
|
|
||||||
Future breakage diagnostic:
|
|
||||||
error: any use of this value will cause an error
|
|
||||||
--> $DIR/ub-enum.rs:50:1
|
|
||||||
|
|
|
||||||
LL | const BAD_ENUM2_WRAPPED: Wrap<Enum2> = unsafe { mem::transmute(&0) };
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
= help: this code performed an operation that depends on the underlying bytes representing a pointer
|
|
||||||
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
|
|
||||||
= note: `#[deny(const_err)]` on by default
|
|
||||||
|
|
||||||
Future breakage diagnostic:
|
|
||||||
error: any use of this value will cause an error
|
|
||||||
--> $DIR/ub-enum.rs:65:1
|
|
||||||
|
|
|
||||||
LL | const BAD_ENUM2_OPTION_PTR: Option<Enum2> = unsafe { mem::transmute(&0) };
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
|
||||||
= help: this code performed an operation that depends on the underlying bytes representing a pointer
|
|
||||||
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
|
|
||||||
= note: `#[deny(const_err)]` on by default
|
|
||||||
|
|
||||||
|
|
|
@ -25,12 +25,10 @@ const BAD_ENUM: Enum = unsafe { mem::transmute(1usize) };
|
||||||
//~^ ERROR is undefined behavior
|
//~^ ERROR is undefined behavior
|
||||||
|
|
||||||
const BAD_ENUM_PTR: Enum = unsafe { mem::transmute(&1) };
|
const BAD_ENUM_PTR: Enum = unsafe { mem::transmute(&1) };
|
||||||
//~^ ERROR any use of this value will cause an error
|
//~^ ERROR evaluation of constant value failed
|
||||||
//~| WARN this was previously accepted by the compiler but is being phased out
|
|
||||||
|
|
||||||
const BAD_ENUM_WRAPPED: Wrap<Enum> = unsafe { mem::transmute(&1) };
|
const BAD_ENUM_WRAPPED: Wrap<Enum> = unsafe { mem::transmute(&1) };
|
||||||
//~^ ERROR any use of this value will cause an error
|
//~^ ERROR evaluation of constant value failed
|
||||||
//~| WARN this was previously accepted by the compiler but is being phased out
|
|
||||||
|
|
||||||
// # simple enum with discriminant 2
|
// # simple enum with discriminant 2
|
||||||
|
|
||||||
|
@ -44,12 +42,10 @@ enum Enum2 {
|
||||||
const BAD_ENUM2: Enum2 = unsafe { mem::transmute(0usize) };
|
const BAD_ENUM2: Enum2 = unsafe { mem::transmute(0usize) };
|
||||||
//~^ ERROR is undefined behavior
|
//~^ ERROR is undefined behavior
|
||||||
const BAD_ENUM2_PTR: Enum2 = unsafe { mem::transmute(&0) };
|
const BAD_ENUM2_PTR: Enum2 = unsafe { mem::transmute(&0) };
|
||||||
//~^ ERROR any use of this value will cause an error
|
//~^ ERROR evaluation of constant value failed
|
||||||
//~| WARN this was previously accepted by the compiler but is being phased out
|
|
||||||
// something wrapping the enum so that we test layout first, not enum
|
// something wrapping the enum so that we test layout first, not enum
|
||||||
const BAD_ENUM2_WRAPPED: Wrap<Enum2> = unsafe { mem::transmute(&0) };
|
const BAD_ENUM2_WRAPPED: Wrap<Enum2> = unsafe { mem::transmute(&0) };
|
||||||
//~^ ERROR any use of this value will cause an error
|
//~^ ERROR evaluation of constant value failed
|
||||||
//~| WARN this was previously accepted by the compiler but is being phased out
|
|
||||||
|
|
||||||
// Undef enum discriminant.
|
// Undef enum discriminant.
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
|
@ -63,8 +59,7 @@ const BAD_ENUM2_UNDEF : Enum2 = unsafe { MaybeUninit { uninit: () }.init };
|
||||||
|
|
||||||
// Pointer value in an enum with a niche that is not just 0.
|
// Pointer value in an enum with a niche that is not just 0.
|
||||||
const BAD_ENUM2_OPTION_PTR: Option<Enum2> = unsafe { mem::transmute(&0) };
|
const BAD_ENUM2_OPTION_PTR: Option<Enum2> = unsafe { mem::transmute(&0) };
|
||||||
//~^ ERROR any use of this value will cause an error
|
//~^ ERROR evaluation of constant value failed
|
||||||
//~| WARN this was previously accepted by the compiler but is being phased out
|
|
||||||
|
|
||||||
// # valid discriminant for uninhabited variant
|
// # valid discriminant for uninhabited variant
|
||||||
|
|
||||||
|
|
|
@ -1,17 +1,17 @@
|
||||||
error[E0080]: evaluation of constant value failed
|
error[E0080]: evaluation of constant value failed
|
||||||
--> $DIR/ub-int-array.rs:16:9
|
--> $DIR/ub-int-array.rs:15:9
|
||||||
|
|
|
|
||||||
LL | MaybeUninit { uninit: () }.init,
|
LL | MaybeUninit { uninit: () }.init,
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory
|
||||||
|
|
||||||
error[E0080]: evaluation of constant value failed
|
error[E0080]: evaluation of constant value failed
|
||||||
--> $DIR/ub-int-array.rs:31:13
|
--> $DIR/ub-int-array.rs:30:13
|
||||||
|
|
|
|
||||||
LL | MaybeUninit { uninit: () }.init,
|
LL | MaybeUninit { uninit: () }.init,
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory
|
||||||
|
|
||||||
error[E0080]: evaluation of constant value failed
|
error[E0080]: evaluation of constant value failed
|
||||||
--> $DIR/ub-int-array.rs:57:13
|
--> $DIR/ub-int-array.rs:56:13
|
||||||
|
|
|
|
||||||
LL | MaybeUninit { uninit: () }.init,
|
LL | MaybeUninit { uninit: () }.init,
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory
|
||||||
|
|
|
@ -1,17 +1,17 @@
|
||||||
error[E0080]: evaluation of constant value failed
|
error[E0080]: evaluation of constant value failed
|
||||||
--> $DIR/ub-int-array.rs:16:9
|
--> $DIR/ub-int-array.rs:15:9
|
||||||
|
|
|
|
||||||
LL | MaybeUninit { uninit: () }.init,
|
LL | MaybeUninit { uninit: () }.init,
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory
|
||||||
|
|
||||||
error[E0080]: evaluation of constant value failed
|
error[E0080]: evaluation of constant value failed
|
||||||
--> $DIR/ub-int-array.rs:31:13
|
--> $DIR/ub-int-array.rs:30:13
|
||||||
|
|
|
|
||||||
LL | MaybeUninit { uninit: () }.init,
|
LL | MaybeUninit { uninit: () }.init,
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory
|
||||||
|
|
||||||
error[E0080]: evaluation of constant value failed
|
error[E0080]: evaluation of constant value failed
|
||||||
--> $DIR/ub-int-array.rs:57:13
|
--> $DIR/ub-int-array.rs:56:13
|
||||||
|
|
|
|
||||||
LL | MaybeUninit { uninit: () }.init,
|
LL | MaybeUninit { uninit: () }.init,
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
#![allow(const_err)] // make sure we cannot allow away the errors tested here
|
|
||||||
// stderr-per-bitwidth
|
// stderr-per-bitwidth
|
||||||
//! Test the "array of int" fast path in validity checking, and in particular whether it
|
//! Test the "array of int" fast path in validity checking, and in particular whether it
|
||||||
//! points at the right array element.
|
//! points at the right array element.
|
||||||
|
|
|
@ -10,13 +10,13 @@ LL | const NULL_PTR: NonNull<u8> = unsafe { mem::transmute(0usize) };
|
||||||
}
|
}
|
||||||
|
|
||||||
error[E0080]: evaluation of constant value failed
|
error[E0080]: evaluation of constant value failed
|
||||||
--> $DIR/ub-nonnull.rs:19:30
|
--> $DIR/ub-nonnull.rs:18:30
|
||||||
|
|
|
|
||||||
LL | let out_of_bounds_ptr = &ptr[255];
|
LL | let out_of_bounds_ptr = &ptr[255];
|
||||||
| ^^^^^^^^ dereferencing pointer failed: alloc11 has size 1, so pointer to 256 bytes starting at offset 0 is out-of-bounds
|
| ^^^^^^^^ dereferencing pointer failed: alloc11 has size 1, so pointer to 256 bytes starting at offset 0 is out-of-bounds
|
||||||
|
|
||||||
error[E0080]: it is undefined behavior to use this value
|
error[E0080]: it is undefined behavior to use this value
|
||||||
--> $DIR/ub-nonnull.rs:23:1
|
--> $DIR/ub-nonnull.rs:22:1
|
||||||
|
|
|
|
||||||
LL | const NULL_U8: NonZeroU8 = unsafe { mem::transmute(0u8) };
|
LL | const NULL_U8: NonZeroU8 = unsafe { mem::transmute(0u8) };
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 0, but expected something greater or equal to 1
|
| ^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 0, but expected something greater or equal to 1
|
||||||
|
@ -27,7 +27,7 @@ LL | const NULL_U8: NonZeroU8 = unsafe { mem::transmute(0u8) };
|
||||||
}
|
}
|
||||||
|
|
||||||
error[E0080]: it is undefined behavior to use this value
|
error[E0080]: it is undefined behavior to use this value
|
||||||
--> $DIR/ub-nonnull.rs:25:1
|
--> $DIR/ub-nonnull.rs:24:1
|
||||||
|
|
|
|
||||||
LL | const NULL_USIZE: NonZeroUsize = unsafe { mem::transmute(0usize) };
|
LL | const NULL_USIZE: NonZeroUsize = unsafe { mem::transmute(0usize) };
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 0, but expected something greater or equal to 1
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 0, but expected something greater or equal to 1
|
||||||
|
@ -38,13 +38,13 @@ LL | const NULL_USIZE: NonZeroUsize = unsafe { mem::transmute(0usize) };
|
||||||
}
|
}
|
||||||
|
|
||||||
error[E0080]: evaluation of constant value failed
|
error[E0080]: evaluation of constant value failed
|
||||||
--> $DIR/ub-nonnull.rs:33:36
|
--> $DIR/ub-nonnull.rs:32:36
|
||||||
|
|
|
|
||||||
LL | const UNINIT: NonZeroU8 = unsafe { MaybeUninit { uninit: () }.init };
|
LL | const UNINIT: NonZeroU8 = unsafe { MaybeUninit { uninit: () }.init };
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory
|
||||||
|
|
||||||
error[E0080]: it is undefined behavior to use this value
|
error[E0080]: it is undefined behavior to use this value
|
||||||
--> $DIR/ub-nonnull.rs:42:1
|
--> $DIR/ub-nonnull.rs:41:1
|
||||||
|
|
|
|
||||||
LL | const BAD_RANGE1: RestrictedRange1 = unsafe { RestrictedRange1(42) };
|
LL | const BAD_RANGE1: RestrictedRange1 = unsafe { RestrictedRange1(42) };
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 42, but expected something in the range 10..=30
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 42, but expected something in the range 10..=30
|
||||||
|
@ -55,7 +55,7 @@ LL | const BAD_RANGE1: RestrictedRange1 = unsafe { RestrictedRange1(42) };
|
||||||
}
|
}
|
||||||
|
|
||||||
error[E0080]: it is undefined behavior to use this value
|
error[E0080]: it is undefined behavior to use this value
|
||||||
--> $DIR/ub-nonnull.rs:48:1
|
--> $DIR/ub-nonnull.rs:47:1
|
||||||
|
|
|
|
||||||
LL | const BAD_RANGE2: RestrictedRange2 = unsafe { RestrictedRange2(20) };
|
LL | const BAD_RANGE2: RestrictedRange2 = unsafe { RestrictedRange2(20) };
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 20, but expected something less or equal to 10, or greater or equal to 30
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 20, but expected something less or equal to 10, or greater or equal to 30
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue