Auto merge of #149750 - Zalathar:rollup-9qjiz5r, r=Zalathar

Rollup of 8 pull requests

Successful merges:

 - rust-lang/rust#148935 (Fix division syntax in doc comments)
 - rust-lang/rust#149207 (Add `ilog10` result range hints)
 - rust-lang/rust#149676 (Tidying up tests/ui/issues tests [3/N])
 - rust-lang/rust#149710 (Move ambient gdb discovery from compiletest to bootstrap)
 - rust-lang/rust#149714 (Check associated type where-clauses for lifetimes)
 - rust-lang/rust#149722 (contracts: fix lowering final declaration without trailing semicolon)
 - rust-lang/rust#149736 (contracts: clean up feature flag warning duplicated across tests)
 - rust-lang/rust#149739 (mailmap: add binarycat)

r? `@ghost`
`@rustbot` modify labels: rollup
This commit is contained in:
bors 2025-12-08 06:27:26 +00:00
commit 03d7ad7dd6
121 changed files with 599 additions and 766 deletions

View file

@ -83,6 +83,7 @@ Ben Sago <ogham@users.noreply.github.com> <ogham@bsago.me>
Ben Striegel <ben.striegel@gmail.com>
Benjamin Jackman <ben@jackman.biz>
Benoît Cortier <benoit.cortier@fried-world.eu>
binarycat <binarycat@envs.net> lolbinarycat <dogedoge61+github@gmail.com> <dogedoge61@gmail.com>
Bheesham Persaud <bheesham123@hotmail.com> Bheesham Persaud <bheesham.persaud@live.ca>
bjorn3 <17426603+bjorn3@users.noreply.github.com> <bjorn3@users.noreply.github.com>
bjorn3 <17426603+bjorn3@users.noreply.github.com> <bjorn3_gh@protonmail.com>

View file

@ -23,7 +23,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
// The order in which things are lowered is important! I.e to
// refer to variables in contract_decls from postcond/precond,
// we must lower it first!
let contract_decls = self.lower_stmts(&contract.declarations).0;
let contract_decls = self.lower_decls(contract);
match (&contract.requires, &contract.ensures) {
(Some(req), Some(ens)) => {
@ -124,6 +124,18 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
}
}
fn lower_decls(&mut self, contract: &rustc_ast::FnContract) -> &'hir [rustc_hir::Stmt<'hir>] {
let (decls, decls_tail) = self.lower_stmts(&contract.declarations);
if let Some(e) = decls_tail {
// include the tail expression in the declaration statements
let tail = self.stmt_expr(e.span, *e);
self.arena.alloc_from_iter(decls.into_iter().map(|d| *d).chain([tail].into_iter()))
} else {
decls
}
}
/// Lower the precondition check intrinsic.
fn lower_precond(&mut self, req: &Box<rustc_ast::Expr>) -> rustc_hir::Stmt<'hir> {
let lowered_req = self.lower_expr_mut(&req);

View file

@ -301,17 +301,12 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
visit::walk_ty(self, ty)
}
fn visit_generics(&mut self, g: &'a ast::Generics) {
for predicate in &g.where_clause.predicates {
match &predicate.kind {
ast::WherePredicateKind::BoundPredicate(bound_pred) => {
// A type bound (e.g., `for<'c> Foo: Send + Clone + 'c`).
self.check_late_bound_lifetime_defs(&bound_pred.bound_generic_params);
}
_ => {}
}
fn visit_where_predicate_kind(&mut self, kind: &'a ast::WherePredicateKind) {
if let ast::WherePredicateKind::BoundPredicate(bound) = kind {
// A type bound (e.g., `for<'c> Foo: Send + Clone + 'c`).
self.check_late_bound_lifetime_defs(&bound.bound_generic_params);
}
visit::walk_generics(self, g);
visit::walk_where_predicate_kind(self, kind);
}
fn visit_fn_ret_ty(&mut self, ret_ty: &'a ast::FnRetTy) {

View file

@ -1753,7 +1753,8 @@ impl f128 {
q
}
/// Calculates the least nonnegative remainder of `self (mod rhs)`.
/// Calculates the least nonnegative remainder of `self` when
/// divided by `rhs`.
///
/// In particular, the return value `r` satisfies `0.0 <= r < rhs.abs()` in
/// most cases. However, due to a floating point round-off error it can

View file

@ -1728,7 +1728,8 @@ impl f16 {
q
}
/// Calculates the least nonnegative remainder of `self (mod rhs)`.
/// Calculates the least nonnegative remainder of `self` when
/// divided by `rhs`.
///
/// In particular, the return value `r` satisfies `0.0 <= r < rhs.abs()` in
/// most cases. However, due to a floating point round-off error it can

View file

@ -1,9 +1,11 @@
//! These functions compute the integer logarithm of their type, assuming
//! that someone has already checked that the value is strictly positive.
use crate::num::NonZero;
// 0 < val <= u8::MAX
#[inline]
pub(super) const fn u8(val: u8) -> u32 {
const fn u8_impl(val: u8) -> u32 {
let val = val as u32;
// For better performance, avoid branches by assembling the solution
@ -45,13 +47,13 @@ const fn less_than_5(val: u32) -> u32 {
// 0 < val <= u16::MAX
#[inline]
pub(super) const fn u16(val: u16) -> u32 {
const fn u16_impl(val: u16) -> u32 {
less_than_5(val as u32)
}
// 0 < val <= u32::MAX
#[inline]
pub(super) const fn u32(mut val: u32) -> u32 {
const fn u32_impl(mut val: u32) -> u32 {
let mut log = 0;
if val >= 100_000 {
val /= 100_000;
@ -62,7 +64,7 @@ pub(super) const fn u32(mut val: u32) -> u32 {
// 0 < val <= u64::MAX
#[inline]
pub(super) const fn u64(mut val: u64) -> u32 {
const fn u64_impl(mut val: u64) -> u32 {
let mut log = 0;
if val >= 10_000_000_000 {
val /= 10_000_000_000;
@ -77,66 +79,87 @@ pub(super) const fn u64(mut val: u64) -> u32 {
// 0 < val <= u128::MAX
#[inline]
pub(super) const fn u128(mut val: u128) -> u32 {
const fn u128_impl(mut val: u128) -> u32 {
let mut log = 0;
if val >= 100_000_000_000_000_000_000_000_000_000_000 {
val /= 100_000_000_000_000_000_000_000_000_000_000;
log += 32;
return log + u32(val as u32);
return log + u32_impl(val as u32);
}
if val >= 10_000_000_000_000_000 {
val /= 10_000_000_000_000_000;
log += 16;
}
log + u64(val as u64)
log + u64_impl(val as u64)
}
#[cfg(target_pointer_width = "16")]
#[inline]
pub(super) const fn usize(val: usize) -> u32 {
u16(val as _)
macro_rules! define_unsigned_ilog10 {
($($ty:ident => $impl_fn:ident,)*) => {$(
#[inline]
pub(super) const fn $ty(val: NonZero<$ty>) -> u32 {
let result = $impl_fn(val.get());
// SAFETY: Integer logarithm is monotonic non-decreasing, so the computed `result` cannot
// exceed the value produced for the maximum input.
unsafe { crate::hint::assert_unchecked(result <= const { $impl_fn($ty::MAX) }) };
result
}
)*};
}
#[cfg(target_pointer_width = "32")]
#[inline]
pub(super) const fn usize(val: usize) -> u32 {
u32(val as _)
define_unsigned_ilog10! {
u8 => u8_impl,
u16 => u16_impl,
u32 => u32_impl,
u64 => u64_impl,
u128 => u128_impl,
}
#[cfg(target_pointer_width = "64")]
#[inline]
pub(super) const fn usize(val: usize) -> u32 {
u64(val as _)
pub(super) const fn usize(val: NonZero<usize>) -> u32 {
#[cfg(target_pointer_width = "16")]
let impl_fn = u16;
#[cfg(target_pointer_width = "32")]
let impl_fn = u32;
#[cfg(target_pointer_width = "64")]
let impl_fn = u64;
// SAFETY: We have selected the correct `impl_fn`, so the converting `val` to the argument is
// safe.
impl_fn(unsafe { NonZero::new_unchecked(val.get() as _) })
}
// 0 < val <= i8::MAX
#[inline]
pub(super) const fn i8(val: i8) -> u32 {
u8(val as u8)
macro_rules! define_signed_ilog10 {
($($ty:ident => $impl_fn:ident,)*) => {$(
// 0 < val <= $ty::MAX
#[inline]
pub(super) const fn $ty(val: $ty) -> Option<u32> {
if val > 0 {
let result = $impl_fn(val.cast_unsigned());
// SAFETY: Integer logarithm is monotonic non-decreasing, so the computed `result`
// cannot exceed the value produced for the maximum input.
unsafe {
crate::hint::assert_unchecked(result <= const { $impl_fn($ty::MAX.cast_unsigned()) });
}
Some(result)
} else {
None
}
}
)*};
}
// 0 < val <= i16::MAX
#[inline]
pub(super) const fn i16(val: i16) -> u32 {
u16(val as u16)
}
// 0 < val <= i32::MAX
#[inline]
pub(super) const fn i32(val: i32) -> u32 {
u32(val as u32)
}
// 0 < val <= i64::MAX
#[inline]
pub(super) const fn i64(val: i64) -> u32 {
u64(val as u64)
}
// 0 < val <= i128::MAX
#[inline]
pub(super) const fn i128(val: i128) -> u32 {
u128(val as u128)
define_signed_ilog10! {
i8 => u8_impl,
i16 => u16_impl,
i32 => u32_impl,
i64 => u64_impl,
i128 => u128_impl,
}
/// Instantiate this panic logic once, rather than for all the ilog methods

View file

@ -3147,7 +3147,8 @@ macro_rules! int_impl {
}
/// Calculates the least nonnegative remainder of `self (mod rhs)`.
/// Calculates the least nonnegative remainder of `self` when
/// divided by `rhs`.
///
/// This is done as if by the Euclidean division algorithm -- given
/// `r = self.rem_euclid(rhs)`, the result satisfies
@ -3527,11 +3528,7 @@ macro_rules! int_impl {
without modifying the original"]
#[inline]
pub const fn checked_ilog10(self) -> Option<u32> {
if self > 0 {
Some(int_log10::$ActualT(self as $ActualT))
} else {
None
}
int_log10::$ActualT(self as $ActualT)
}
/// Computes the absolute value of `self`.

View file

@ -1657,7 +1657,7 @@ macro_rules! nonzero_integer_signedness_dependent_methods {
without modifying the original"]
#[inline]
pub const fn ilog10(self) -> u32 {
super::int_log10::$Int(self.get())
super::int_log10::$Int(self)
}
/// Calculates the midpoint (average) between `self` and `rhs`.

View file

@ -3481,7 +3481,8 @@ macro_rules! uint_impl {
}
/// Calculates the least remainder of `self (mod rhs)`.
/// Calculates the least remainder of `self` when divided by
/// `rhs`.
///
/// Since, for the positive integers, all common
/// definitions of division are equal, this

View file

@ -252,7 +252,8 @@ impl f32 {
core::f32::math::div_euclid(self, rhs)
}
/// Calculates the least nonnegative remainder of `self (mod rhs)`.
/// Calculates the least nonnegative remainder of `self` when divided by
/// `rhs`.
///
/// In particular, the return value `r` satisfies `0.0 <= r < rhs.abs()` in
/// most cases. However, due to a floating point round-off error it can

View file

@ -252,7 +252,8 @@ impl f64 {
core::f64::math::div_euclid(self, rhs)
}
/// Calculates the least nonnegative remainder of `self (mod rhs)`.
/// Calculates the least nonnegative remainder of `self` when divided by
/// `rhs`.
///
/// In particular, the return value `r` satisfies `0.0 <= r < rhs.abs()` in
/// most cases. However, due to a floating point round-off error it can

View file

@ -10,11 +10,15 @@ pub(crate) struct Android {
}
pub(crate) fn discover_android(builder: &Builder<'_>, target: TargetSelection) -> Option<Android> {
if !target.contains("android") {
return None;
}
let adb_path = "adb";
// See <https://github.com/rust-lang/rust/pull/102755>.
let adb_test_dir = "/data/local/tmp/work";
let android_cross_path = if target.contains("android") && !builder.config.dry_run() {
let android_cross_path = if !builder.config.dry_run() {
builder.cc(target).parent().unwrap().parent().unwrap().to_owned()
} else {
PathBuf::new()

View file

@ -29,7 +29,7 @@ use crate::core::builder::{
};
use crate::core::config::TargetSelection;
use crate::core::config::flags::{Subcommand, get_completion, top_level_help};
use crate::core::debuggers;
use crate::core::{android, debuggers};
use crate::utils::build_stamp::{self, BuildStamp};
use crate::utils::exec::{BootstrapCommand, command};
use crate::utils::helpers::{
@ -2114,21 +2114,18 @@ Please disable assertions with `rust.debug-assertions = false`.
builder.config.python.as_ref().expect("python is required for running rustdoc tests"),
);
// FIXME(#148099): Currently we set these Android-related flags in all
// modes, even though they should only be needed in "debuginfo" mode,
// because the GDB-discovery code in compiletest currently assumes that
// `--android-cross-path` is always set for Android targets.
if let Some(debuggers::Android { adb_path, adb_test_dir, android_cross_path }) =
debuggers::discover_android(builder, target)
{
// Discover and set some flags related to running tests on Android targets.
let android = android::discover_android(builder, target);
if let Some(android::Android { adb_path, adb_test_dir, android_cross_path }) = &android {
cmd.arg("--adb-path").arg(adb_path);
cmd.arg("--adb-test-dir").arg(adb_test_dir);
cmd.arg("--android-cross-path").arg(android_cross_path);
}
if mode == "debuginfo" {
if let Some(debuggers::Gdb { gdb }) = debuggers::discover_gdb(builder) {
cmd.arg("--gdb").arg(gdb);
if let Some(debuggers::Gdb { gdb }) = debuggers::discover_gdb(builder, android.as_ref())
{
cmd.arg("--gdb").arg(gdb.as_ref());
}
if let Some(debuggers::Lldb { lldb_exe, lldb_version }) =

View file

@ -1,13 +1,42 @@
use std::borrow::Cow;
use std::path::Path;
use crate::core::android;
use crate::core::builder::Builder;
use crate::utils::exec::BootstrapCommand;
pub(crate) struct Gdb<'a> {
pub(crate) gdb: &'a Path,
pub(crate) gdb: Cow<'a, Path>,
}
pub(crate) fn discover_gdb<'a>(builder: &'a Builder<'_>) -> Option<Gdb<'a>> {
let gdb = builder.config.gdb.as_deref()?;
pub(crate) fn discover_gdb<'a>(
builder: &'a Builder<'_>,
android: Option<&android::Android>,
) -> Option<Gdb<'a>> {
// If there's an explicitly-configured gdb, use that.
if let Some(gdb) = builder.config.gdb.as_deref() {
// FIXME(Zalathar): Consider returning None if gdb is an empty string,
// as a way to explicitly disable ambient gdb discovery.
let gdb = Cow::Borrowed(gdb);
return Some(Gdb { gdb });
}
Some(Gdb { gdb })
// Otherwise, fall back to whatever gdb is sitting around in PATH.
// (That's the historical behavior, but maybe we should require opt-in?)
let gdb: Cow<'_, Path> = match android {
Some(android::Android { android_cross_path, .. }) => {
android_cross_path.join("bin/gdb").into()
}
None => Path::new("gdb").into(),
};
// Check whether an ambient gdb exists, by running `gdb --version`.
let output = {
let mut gdb_command = BootstrapCommand::new(gdb.as_ref()).allow_failure();
gdb_command.arg("--version");
gdb_command.run_capture(builder)
};
if output.is_success() { Some(Gdb { gdb }) } else { None }
}

View file

@ -1,10 +1,8 @@
//! Code for discovering debuggers and debugger-related configuration, so that
//! it can be passed to compiletest when running debuginfo tests.
pub(crate) use self::android::{Android, discover_android};
pub(crate) use self::gdb::{Gdb, discover_gdb};
pub(crate) use self::lldb::{Lldb, discover_lldb};
mod android;
mod gdb;
mod lldb;

View file

@ -1,3 +1,4 @@
pub(crate) mod android;
pub(crate) mod build_steps;
pub(crate) mod builder;
pub(crate) mod config;

View file

@ -566,7 +566,7 @@ pub struct Config {
///
/// FIXME: take a look at this; this is piggy-backing off of gdb code paths but only for
/// `arm-linux-androideabi` target.
pub android_cross_path: Utf8PathBuf,
pub android_cross_path: Option<Utf8PathBuf>,
/// Extra parameter to run adb on `arm-linux-androideabi`.
///

View file

@ -54,15 +54,6 @@ pub(crate) fn configure_lldb(config: &Config) -> Option<Arc<Config>> {
Some(Arc::new(Config { debugger: Some(Debugger::Lldb), ..config.clone() }))
}
/// Returns `true` if the given target is an Android target for the
/// purposes of GDB testing.
pub(crate) fn is_android_gdb_target(target: &str) -> bool {
matches!(
&target[..],
"arm-linux-androideabi" | "armv7-linux-androideabi" | "aarch64-linux-android"
)
}
/// Returns `true` if the given target is a MSVC target for the purposes of CDB testing.
fn is_pc_windows_msvc_target(target: &str) -> bool {
target.ends_with("-pc-windows-msvc")
@ -129,35 +120,6 @@ pub(crate) fn extract_cdb_version(full_version_line: &str) -> Option<[u16; 4]> {
Some([major, minor, patch, build])
}
pub(crate) fn discover_gdb(
gdb: Option<String>,
target: &str,
android_cross_path: &Utf8Path,
) -> Option<Utf8PathBuf> {
#[cfg(not(windows))]
const GDB_FALLBACK: &str = "gdb";
#[cfg(windows)]
const GDB_FALLBACK: &str = "gdb.exe";
let fallback_gdb = || {
if is_android_gdb_target(target) {
let mut gdb_path = android_cross_path.to_string();
gdb_path.push_str("/bin/gdb");
gdb_path
} else {
GDB_FALLBACK.to_owned()
}
};
let gdb = match gdb {
None => fallback_gdb(),
Some(ref s) if s.is_empty() => fallback_gdb(), // may be empty if configure found no gdb
Some(ref s) => s.to_owned(),
};
Some(Utf8PathBuf::from(gdb))
}
pub(crate) fn query_gdb_version(gdb: &Utf8Path) -> Option<u32> {
let mut version_line = None;
if let Ok(output) = Command::new(&gdb).arg("--version").output() {

View file

@ -256,12 +256,12 @@ fn parse_config(args: Vec<String>) -> Config {
}
let target = opt_str2(matches.opt_str("target"));
let android_cross_path = opt_path(matches, "android-cross-path");
let android_cross_path = matches.opt_str("android-cross-path").map(Utf8PathBuf::from);
// FIXME: `cdb_version` is *derived* from cdb, but it's *not* technically a config!
let cdb = debuggers::discover_cdb(matches.opt_str("cdb"), &target);
let cdb_version = cdb.as_deref().and_then(debuggers::query_cdb_version);
// FIXME: `gdb_version` is *derived* from gdb, but it's *not* technically a config!
let gdb = debuggers::discover_gdb(matches.opt_str("gdb"), &target, &android_cross_path);
let gdb = matches.opt_str("gdb").map(Utf8PathBuf::from);
let gdb_version = gdb.as_deref().and_then(debuggers::query_gdb_version);
// FIXME: `lldb_version` is *derived* from lldb, but it's *not* technically a config!
let lldb = matches.opt_str("lldb").map(Utf8PathBuf::from);

View file

@ -8,7 +8,7 @@ use tracing::debug;
use super::debugger::DebuggerCommands;
use super::{Debugger, Emit, ProcRes, TestCx, Truncated, WillExecute};
use crate::debuggers::{extract_gdb_version, is_android_gdb_target};
use crate::debuggers::extract_gdb_version;
impl TestCx<'_> {
pub(super) fn run_debuginfo_test(&self) {
@ -122,13 +122,15 @@ impl TestCx<'_> {
let exe_file = self.make_exe_name();
let debugger_run_result;
if is_android_gdb_target(&self.config.target) {
// If bootstrap gave us an `--android-cross-path`, assume the target
// needs Android-specific handling.
if let Some(android_cross_path) = self.config.android_cross_path.as_deref() {
cmds = cmds.replace("run", "continue");
// write debugger script
let mut script_str = String::with_capacity(2048);
script_str.push_str(&format!("set charset {}\n", Self::charset()));
script_str.push_str(&format!("set sysroot {}\n", &self.config.android_cross_path));
script_str.push_str(&format!("set sysroot {android_cross_path}\n"));
script_str.push_str(&format!("file {}\n", exe_file));
script_str.push_str("target remote :5039\n");
script_str.push_str(&format!(

View file

@ -2892,7 +2892,6 @@ ui/typeck/issue-105946.rs
ui/typeck/issue-106929.rs
ui/typeck/issue-107087.rs
ui/typeck/issue-107775.rs
ui/typeck/issue-10969.rs
ui/typeck/issue-110017-format-into-help-deletes-macro.rs
ui/typeck/issue-110052.rs
ui/typeck/issue-112007-leaked-writeln-macro-internals.rs

View file

@ -0,0 +1,213 @@
//! Make sure the compiler knows the result range of `ilog10`.
//@ compile-flags: -O -Z merge-functions=disabled
#![crate_type = "lib"]
use std::num::NonZero;
// Signed integers.
#[no_mangle]
fn i8_ilog10_range(value: i8) {
const MAX_RESULT: u32 = i8::MAX.ilog10();
// CHECK-LABEL: @i8_ilog10_range(
// CHECK-NOT: panic
// CHECK: ret void
// CHECK-NEXT: }
assert!(value <= 0 || value.ilog10() <= MAX_RESULT);
assert!(value.checked_ilog10().is_none_or(|result| result <= MAX_RESULT));
}
#[no_mangle]
fn i16_ilog10_range(value: i16) {
const MAX_RESULT: u32 = i16::MAX.ilog10();
// CHECK-LABEL: @i16_ilog10_range(
// CHECK-NOT: panic
// CHECK: ret void
// CHECK-NEXT: }
assert!(value <= 0 || value.ilog10() <= MAX_RESULT);
assert!(value.checked_ilog10().is_none_or(|result| result <= MAX_RESULT));
}
#[no_mangle]
fn i32_ilog10_range(value: i32) {
const MAX_RESULT: u32 = i32::MAX.ilog10();
// CHECK-LABEL: @i32_ilog10_range(
// CHECK-NOT: panic
// CHECK: ret void
// CHECK-NEXT: }
assert!(value <= 0 || value.ilog10() <= MAX_RESULT);
assert!(value.checked_ilog10().is_none_or(|result| result <= MAX_RESULT));
}
#[no_mangle]
fn i64_ilog10_range(value: i64) {
const MAX_RESULT: u32 = i64::MAX.ilog10();
// CHECK-LABEL: @i64_ilog10_range(
// CHECK-NOT: panic
// CHECK: ret void
// CHECK-NEXT: }
assert!(value <= 0 || value.ilog10() <= MAX_RESULT);
assert!(value.checked_ilog10().is_none_or(|result| result <= MAX_RESULT));
}
#[no_mangle]
fn i128_ilog10_range(value: i128) {
const MAX_RESULT: u32 = i128::MAX.ilog10();
// CHECK-LABEL: @i128_ilog10_range(
// CHECK-NOT: panic
// CHECK: ret void
// CHECK-NEXT: }
assert!(value <= 0 || value.ilog10() <= MAX_RESULT);
assert!(value.checked_ilog10().is_none_or(|result| result <= MAX_RESULT));
}
#[no_mangle]
fn isize_ilog10_range(value: isize) {
const MAX_RESULT: u32 = isize::MAX.ilog10();
// CHECK-LABEL: @isize_ilog10_range(
// CHECK-NOT: panic
// CHECK: ret void
// CHECK-NEXT: }
assert!(value <= 0 || value.ilog10() <= MAX_RESULT);
assert!(value.checked_ilog10().is_none_or(|result| result <= MAX_RESULT));
}
// Unsigned integer types.
#[no_mangle]
fn u8_ilog10_range(value: u8) {
const MAX_RESULT: u32 = u8::MAX.ilog10();
// CHECK-LABEL: @u8_ilog10_range(
// CHECK-NOT: panic
// CHECK: ret void
// CHECK-NEXT: }
assert!(value == 0 || value.ilog10() <= MAX_RESULT);
assert!(value.checked_ilog10().is_none_or(|result| result <= MAX_RESULT));
}
#[no_mangle]
fn u16_ilog10_range(value: u16) {
const MAX_RESULT: u32 = u16::MAX.ilog10();
// CHECK-LABEL: @u16_ilog10_range(
// CHECK-NOT: panic
// CHECK: ret void
// CHECK-NEXT: }
assert!(value == 0 || value.ilog10() <= MAX_RESULT);
assert!(value.checked_ilog10().is_none_or(|result| result <= MAX_RESULT));
}
#[no_mangle]
fn u32_ilog10_range(value: u32) {
const MAX_RESULT: u32 = u32::MAX.ilog10();
// CHECK-LABEL: @u32_ilog10_range(
// CHECK-NOT: panic
// CHECK: ret void
// CHECK-NEXT: }
assert!(value == 0 || value.ilog10() <= MAX_RESULT);
assert!(value.checked_ilog10().is_none_or(|result| result <= MAX_RESULT));
}
#[no_mangle]
fn u64_ilog10_range(value: u64) {
const MAX_RESULT: u32 = u64::MAX.ilog10();
// CHECK-LABEL: @u64_ilog10_range(
// CHECK-NOT: panic
// CHECK: ret void
// CHECK-NEXT: }
assert!(value == 0 || value.ilog10() <= MAX_RESULT);
assert!(value.checked_ilog10().is_none_or(|result| result <= MAX_RESULT));
}
#[no_mangle]
fn u128_ilog10_range(value: u128) {
const MAX_RESULT: u32 = u128::MAX.ilog10();
// CHECK-LABEL: @u128_ilog10_range(
// CHECK-NOT: panic
// CHECK: ret void
// CHECK-NEXT: }
assert!(value == 0 || value.ilog10() <= MAX_RESULT);
assert!(value.checked_ilog10().is_none_or(|result| result <= MAX_RESULT));
}
#[no_mangle]
fn usize_ilog10_range(value: usize) {
const MAX_RESULT: u32 = usize::MAX.ilog10();
// CHECK-LABEL: @usize_ilog10_range(
// CHECK-NOT: panic
// CHECK: ret void
// CHECK-NEXT: }
assert!(value == 0 || value.ilog10() <= MAX_RESULT);
assert!(value.checked_ilog10().is_none_or(|result| result <= MAX_RESULT));
}
// Signed non-zero integers do not have `ilog10` methods.
// Unsigned non-zero integers.
#[no_mangle]
fn non_zero_u8_ilog10_range(value: NonZero<u8>) {
// CHECK-LABEL: @non_zero_u8_ilog10_range(
// CHECK-NOT: panic
// CHECK: ret void
// CHECK-NEXT: }
assert!(value.ilog10() <= const { u8::MAX.ilog10() });
}
#[no_mangle]
fn non_zero_u16_ilog10_range(value: NonZero<u16>) {
// CHECK-LABEL: @non_zero_u16_ilog10_range(
// CHECK-NOT: panic
// CHECK: ret void
// CHECK-NEXT: }
assert!(value.ilog10() <= const { u16::MAX.ilog10() });
}
#[no_mangle]
fn non_zero_u32_ilog10_range(value: NonZero<u32>) {
// CHECK-LABEL: @non_zero_u32_ilog10_range(
// CHECK-NOT: panic
// CHECK: ret void
// CHECK-NEXT: }
assert!(value.ilog10() <= const { u32::MAX.ilog10() });
}
#[no_mangle]
fn non_zero_u64_ilog10_range(value: NonZero<u64>) {
// CHECK-LABEL: @non_zero_u64_ilog10_range(
// CHECK-NOT: panic
// CHECK: ret void
// CHECK-NEXT: }
assert!(value.ilog10() <= const { u64::MAX.ilog10() });
}
#[no_mangle]
fn non_zero_u128_ilog10_range(value: NonZero<u128>) {
// CHECK-LABEL: @non_zero_u128_ilog10_range(
// CHECK-NOT: panic
// CHECK: ret void
// CHECK-NEXT: }
assert!(value.ilog10() <= const { u128::MAX.ilog10() });
}
#[no_mangle]
fn non_zero_usize_ilog10_range(value: NonZero<usize>) {
// CHECK-LABEL: @non_zero_usize_ilog10_range(
// CHECK-NOT: panic
// CHECK: ret void
// CHECK-NEXT: }
assert!(value.ilog10() <= const { usize::MAX.ilog10() });
}

View file

@ -0,0 +1,13 @@
//! regression test for #148627
#![feature(associated_type_defaults)]
trait Trait {
type Assoc2
= ()
where
for<const C: usize> [(); C]: Copy;
//~^ ERROR: only lifetime parameters can be used in this context
}
fn main() {}

View file

@ -0,0 +1,13 @@
error[E0658]: only lifetime parameters can be used in this context
--> $DIR/associated-type-where-non-lifetime-const.rs:9:19
|
LL | for<const C: usize> [(); C]: Copy;
| ^
|
= note: see issue #108185 <https://github.com/rust-lang/rust/issues/108185> for more information
= help: add `#![feature(non_lifetime_binders)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0658`.

View file

@ -0,0 +1,18 @@
//! regression test for #149233
trait Foo {
type Bar<'a>
where
Self: Sized;
fn test(&self);
}
impl Foo for () {
type Bar<'a>
= ()
where
for<T> T:;
//~^ ERROR: only lifetime parameters can be used in this context
fn test(&self) {}
}
fn main() {}

View file

@ -0,0 +1,13 @@
error[E0658]: only lifetime parameters can be used in this context
--> $DIR/associated-type-where-non-lifetime-type.rs:13:13
|
LL | for<T> T:;
| ^
|
= note: see issue #108185 <https://github.com/rust-lang/rust/issues/108185> for more information
= help: add `#![feature(non_lifetime_binders)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0658`.

View file

@ -0,0 +1,8 @@
//! regression test for issue #1895
//@ run-pass
fn main() {
let x = 1_usize;
let y = || x;
let _z = y();
}

View file

@ -3,8 +3,8 @@
//@ compile-flags: --crate-type=lib
//@ check-pass
#![expect(incomplete_features)]
#![feature(contracts)]
//~^ WARN the feature `contracts` is incomplete and may not be safe to use
extern crate core;

View file

@ -1,7 +1,7 @@
//@ compile-flags: --crate-type=lib
//@ edition: 2021
#![expect(incomplete_features)]
#![feature(contracts)]
//~^ WARN the feature `contracts` is incomplete
#[core::contracts::ensures(|ret| *ret)]
//~^ ERROR contract annotations are not yet supported on async or gen functions

View file

@ -4,14 +4,5 @@ error: contract annotations are not yet supported on async or gen functions
LL | #[core::contracts::ensures(|ret| *ret)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/async-fn-contract-ice-145333.rs:3:12
|
LL | #![feature(contracts)]
| ^^^^^^^^^
|
= note: see issue #128044 <https://github.com/rust-lang/rust/issues/128044> for more information
= note: `#[warn(incomplete_features)]` on by default
error: aborting due to 1 previous error; 1 warning emitted
error: aborting due to 1 previous error

View file

@ -1,8 +1,8 @@
//! Test for some of the existing limitations and the current error messages.
//! Some of these limitations may be removed in the future.
#![expect(incomplete_features)]
#![feature(contracts)]
//~^ WARN the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes [incomplete_features]
#![allow(dead_code)]
/// Represent a 5-star system.

View file

@ -10,14 +10,5 @@ error: contract annotations is only supported in functions with bodies
LL | #[core::contracts::ensures(|ret| ret.is_none_or(Stars::is_valid))]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/contract-annotation-limitations.rs:4:12
|
LL | #![feature(contracts)]
| ^^^^^^^^^
|
= note: see issue #128044 <https://github.com/rust-lang/rust/issues/128044> for more information
= note: `#[warn(incomplete_features)]` on by default
error: aborting due to 2 previous errors; 1 warning emitted
error: aborting due to 2 previous errors

View file

@ -1,11 +0,0 @@
warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/contract-attributes-generics.rs:19:12
|
LL | #![feature(contracts)]
| ^^^^^^^^^
|
= note: see issue #128044 <https://github.com/rust-lang/rust/issues/128044> for more information
= note: `#[warn(incomplete_features)]` on by default
warning: 1 warning emitted

View file

@ -1,11 +0,0 @@
warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/contract-attributes-generics.rs:19:12
|
LL | #![feature(contracts)]
| ^^^^^^^^^
|
= note: see issue #128044 <https://github.com/rust-lang/rust/issues/128044> for more information
= note: `#[warn(incomplete_features)]` on by default
warning: 1 warning emitted

View file

@ -1,11 +0,0 @@
warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/contract-attributes-generics.rs:19:12
|
LL | #![feature(contracts)]
| ^^^^^^^^^
|
= note: see issue #128044 <https://github.com/rust-lang/rust/issues/128044> for more information
= note: `#[warn(incomplete_features)]` on by default
warning: 1 warning emitted

View file

@ -1,11 +0,0 @@
warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/contract-attributes-generics.rs:19:12
|
LL | #![feature(contracts)]
| ^^^^^^^^^
|
= note: see issue #128044 <https://github.com/rust-lang/rust/issues/128044> for more information
= note: `#[warn(incomplete_features)]` on by default
warning: 1 warning emitted

View file

@ -16,8 +16,8 @@
//@ [chk_fail_post] compile-flags: -Zcontract-checks=yes
//@ [chk_const_fail] compile-flags: -Zcontract-checks=yes
#![expect(incomplete_features)]
#![feature(contracts)]
//~^ WARN the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes [incomplete_features]
use std::ops::Sub;

View file

@ -1,11 +0,0 @@
warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/contract-attributes-generics.rs:19:12
|
LL | #![feature(contracts)]
| ^^^^^^^^^
|
= note: see issue #128044 <https://github.com/rust-lang/rust/issues/128044> for more information
= note: `#[warn(incomplete_features)]` on by default
warning: 1 warning emitted

View file

@ -1,11 +0,0 @@
warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/contract-attributes-nest.rs:19:12
|
LL | #![feature(contracts)]
| ^^^^^^^^^
|
= note: see issue #128044 <https://github.com/rust-lang/rust/issues/128044> for more information
= note: `#[warn(incomplete_features)]` on by default
warning: 1 warning emitted

View file

@ -1,11 +0,0 @@
warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/contract-attributes-nest.rs:19:12
|
LL | #![feature(contracts)]
| ^^^^^^^^^
|
= note: see issue #128044 <https://github.com/rust-lang/rust/issues/128044> for more information
= note: `#[warn(incomplete_features)]` on by default
warning: 1 warning emitted

View file

@ -1,11 +0,0 @@
warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/contract-attributes-nest.rs:19:12
|
LL | #![feature(contracts)]
| ^^^^^^^^^
|
= note: see issue #128044 <https://github.com/rust-lang/rust/issues/128044> for more information
= note: `#[warn(incomplete_features)]` on by default
warning: 1 warning emitted

View file

@ -16,8 +16,8 @@
//@ [chk_fail_pre] compile-flags: -Zcontract-checks=yes
//@ [chk_fail_post] compile-flags: -Zcontract-checks=yes
#![expect(incomplete_features)]
#![feature(contracts)]
//~^ WARN the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes [incomplete_features]
#[core::contracts::requires(x.baz > 0)]
#[core::contracts::ensures(|ret| *ret > 100)]

View file

@ -1,11 +0,0 @@
warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/contract-attributes-nest.rs:19:12
|
LL | #![feature(contracts)]
| ^^^^^^^^^
|
= note: see issue #128044 <https://github.com/rust-lang/rust/issues/128044> for more information
= note: `#[warn(incomplete_features)]` on by default
warning: 1 warning emitted

View file

@ -1,11 +0,0 @@
warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/contract-attributes-nest.rs:19:12
|
LL | #![feature(contracts)]
| ^^^^^^^^^
|
= note: see issue #128044 <https://github.com/rust-lang/rust/issues/128044> for more information
= note: `#[warn(incomplete_features)]` on by default
warning: 1 warning emitted

View file

@ -1,11 +0,0 @@
warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/contract-attributes-nest.rs:19:12
|
LL | #![feature(contracts)]
| ^^^^^^^^^
|
= note: see issue #128044 <https://github.com/rust-lang/rust/issues/128044> for more information
= note: `#[warn(incomplete_features)]` on by default
warning: 1 warning emitted

View file

@ -1,11 +0,0 @@
warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/contract-attributes-tail.rs:19:12
|
LL | #![feature(contracts)]
| ^^^^^^^^^
|
= note: see issue #128044 <https://github.com/rust-lang/rust/issues/128044> for more information
= note: `#[warn(incomplete_features)]` on by default
warning: 1 warning emitted

View file

@ -1,11 +0,0 @@
warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/contract-attributes-tail.rs:19:12
|
LL | #![feature(contracts)]
| ^^^^^^^^^
|
= note: see issue #128044 <https://github.com/rust-lang/rust/issues/128044> for more information
= note: `#[warn(incomplete_features)]` on by default
warning: 1 warning emitted

View file

@ -1,11 +0,0 @@
warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/contract-attributes-tail.rs:19:12
|
LL | #![feature(contracts)]
| ^^^^^^^^^
|
= note: see issue #128044 <https://github.com/rust-lang/rust/issues/128044> for more information
= note: `#[warn(incomplete_features)]` on by default
warning: 1 warning emitted

View file

@ -16,8 +16,8 @@
//@ [chk_fail_pre] compile-flags: -Zcontract-checks=yes
//@ [chk_fail_post] compile-flags: -Zcontract-checks=yes
#![expect(incomplete_features)]
#![feature(contracts)]
//~^ WARN the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes [incomplete_features]
#[core::contracts::requires(x.baz > 0)]
#[core::contracts::ensures(|ret| *ret > 100)]

View file

@ -1,11 +0,0 @@
warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/contract-attributes-tail.rs:19:12
|
LL | #![feature(contracts)]
| ^^^^^^^^^
|
= note: see issue #128044 <https://github.com/rust-lang/rust/issues/128044> for more information
= note: `#[warn(incomplete_features)]` on by default
warning: 1 warning emitted

View file

@ -1,11 +0,0 @@
warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/contract-attributes-tail.rs:19:12
|
LL | #![feature(contracts)]
| ^^^^^^^^^
|
= note: see issue #128044 <https://github.com/rust-lang/rust/issues/128044> for more information
= note: `#[warn(incomplete_features)]` on by default
warning: 1 warning emitted

View file

@ -1,11 +0,0 @@
warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/contract-attributes-tail.rs:19:12
|
LL | #![feature(contracts)]
| ^^^^^^^^^
|
= note: see issue #128044 <https://github.com/rust-lang/rust/issues/128044> for more information
= note: `#[warn(incomplete_features)]` on by default
warning: 1 warning emitted

View file

@ -1,8 +1,8 @@
//@ run-crash
//@ compile-flags: -Zcontract-checks=yes
#![expect(incomplete_features)]
#![feature(contracts)]
//~^ WARN the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes [incomplete_features]
struct Baz {
baz: i32

View file

@ -1,11 +0,0 @@
warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/contract-captures-via-closure-copy.rs:4:12
|
LL | #![feature(contracts)]
| ^^^^^^^^^
|
= note: see issue #128044 <https://github.com/rust-lang/rust/issues/128044> for more information
= note: `#[warn(incomplete_features)]` on by default
warning: 1 warning emitted

View file

@ -1,8 +1,8 @@
//@ edition:2015..2021
//@ compile-flags: -Zcontract-checks=yes
#![expect(incomplete_features)]
#![feature(contracts)]
//~^ WARN the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes [incomplete_features]
struct Baz {
baz: i32

View file

@ -1,12 +1,3 @@
warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/contract-captures-via-closure-noncopy.rs:4:12
|
LL | #![feature(contracts)]
| ^^^^^^^^^
|
= note: see issue #128044 <https://github.com/rust-lang/rust/issues/128044> for more information
= note: `#[warn(incomplete_features)]` on by default
error[E0277]: the trait bound `Baz: std::marker::Copy` is not satisfied in `{closure@$DIR/contract-captures-via-closure-noncopy.rs:13:42: 13:57}`
--> $DIR/contract-captures-via-closure-noncopy.rs:13:1
|
@ -32,6 +23,6 @@ LL + #[derive(Copy)]
LL | struct Baz {
|
error: aborting due to 1 previous error; 1 warning emitted
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0277`.

View file

@ -1,11 +0,0 @@
warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/contract-const-fn.rs:17:12
|
LL | #![feature(contracts)]
| ^^^^^^^^^
|
= note: see issue #128044 <https://github.com/rust-lang/rust/issues/128044> for more information
= note: `#[warn(incomplete_features)]` on by default
warning: 1 warning emitted

View file

@ -14,8 +14,8 @@
//@ [all_pass] compile-flags: -Zcontract-checks=yes
//@ [runtime_fail_pre] compile-flags: -Zcontract-checks=yes
//@ [runtime_fail_post] compile-flags: -Zcontract-checks=yes
#![expect(incomplete_features)]
#![feature(contracts)]
//~^ WARN the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes [incomplete_features]
extern crate core;
use core::contracts::*;

View file

@ -1,11 +0,0 @@
warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/contract-const-fn.rs:17:12
|
LL | #![feature(contracts)]
| ^^^^^^^^^
|
= note: see issue #128044 <https://github.com/rust-lang/rust/issues/128044> for more information
= note: `#[warn(incomplete_features)]` on by default
warning: 1 warning emitted

View file

@ -1,11 +0,0 @@
warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/contract-const-fn.rs:17:12
|
LL | #![feature(contracts)]
| ^^^^^^^^^
|
= note: see issue #128044 <https://github.com/rust-lang/rust/issues/128044> for more information
= note: `#[warn(incomplete_features)]` on by default
warning: 1 warning emitted

View file

@ -1,6 +1,6 @@
//@ run-pass
#![expect(incomplete_features)]
#![feature(contracts)]
//~^ WARN the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes [incomplete_features]
extern crate core;
use core::contracts::requires;

View file

@ -1,11 +0,0 @@
warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/contracts-disabled-side-effect-declarations.rs:2:12
|
LL | #![feature(contracts)]
| ^^^^^^^^^
|
= note: see issue #128044 <https://github.com/rust-lang/rust/issues/128044> for more information
= note: `#[warn(incomplete_features)]` on by default
warning: 1 warning emitted

View file

@ -1,6 +1,6 @@
//@ run-pass
#![expect(incomplete_features)]
#![feature(contracts)]
//~^ WARN the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes [incomplete_features]
extern crate core;
use core::contracts::ensures;

View file

@ -1,11 +0,0 @@
warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/contracts-disabled-side-effect-ensures.rs:2:12
|
LL | #![feature(contracts)]
| ^^^^^^^^^
|
= note: see issue #128044 <https://github.com/rust-lang/rust/issues/128044> for more information
= note: `#[warn(incomplete_features)]` on by default
warning: 1 warning emitted

View file

@ -1,11 +0,0 @@
warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/contracts-ensures-early-fn-exit.rs:16:12
|
LL | #![feature(contracts)]
| ^^^^^^^^^
|
= note: see issue #128044 <https://github.com/rust-lang/rust/issues/128044> for more information
= note: `#[warn(incomplete_features)]` on by default
warning: 1 warning emitted

View file

@ -1,11 +0,0 @@
warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/contracts-ensures-early-fn-exit.rs:16:12
|
LL | #![feature(contracts)]
| ^^^^^^^^^
|
= note: see issue #128044 <https://github.com/rust-lang/rust/issues/128044> for more information
= note: `#[warn(incomplete_features)]` on by default
warning: 1 warning emitted

View file

@ -1,11 +0,0 @@
warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/contracts-ensures-early-fn-exit.rs:16:12
|
LL | #![feature(contracts)]
| ^^^^^^^^^
|
= note: see issue #128044 <https://github.com/rust-lang/rust/issues/128044> for more information
= note: `#[warn(incomplete_features)]` on by default
warning: 1 warning emitted

View file

@ -1,11 +0,0 @@
warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/contracts-ensures-early-fn-exit.rs:16:12
|
LL | #![feature(contracts)]
| ^^^^^^^^^
|
= note: see issue #128044 <https://github.com/rust-lang/rust/issues/128044> for more information
= note: `#[warn(incomplete_features)]` on by default
warning: 1 warning emitted

View file

@ -13,8 +13,8 @@
//@ [chk_fail_yeet] compile-flags: -Zcontract-checks=yes
//! This test ensures that ensures clauses are checked for different return points of a function.
#![expect(incomplete_features)]
#![feature(contracts)]
//~^ WARN the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes [incomplete_features]
#![feature(yeet_expr)]
/// This ensures will fail in different return points depending on the input.

View file

@ -1,11 +0,0 @@
warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/contracts-ensures-early-fn-exit.rs:16:12
|
LL | #![feature(contracts)]
| ^^^^^^^^^
|
= note: see issue #128044 <https://github.com/rust-lang/rust/issues/128044> for more information
= note: `#[warn(incomplete_features)]` on by default
warning: 1 warning emitted

View file

@ -1,7 +1,7 @@
//@ run-pass
//@ compile-flags: -Zcontract-checks=yes
#![expect(incomplete_features)]
#![feature(contracts)]
//~^ WARN the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes [incomplete_features]
#[core::contracts::ensures(|ret| *ret > 0)]
fn outer() -> i32 {

View file

@ -1,11 +0,0 @@
warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/contracts-ensures-is-not-inherited-when-nesting.rs:3:12
|
LL | #![feature(contracts)]
| ^^^^^^^^^
|
= note: see issue #128044 <https://github.com/rust-lang/rust/issues/128044> for more information
= note: `#[warn(incomplete_features)]` on by default
warning: 1 warning emitted

View file

@ -1,7 +1,7 @@
//@ run-pass
//@ compile-flags: -Zcontract-checks=yes
#![expect(incomplete_features)]
#![feature(contracts)]
//~^ WARN the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes [incomplete_features]
struct Outer { outer: std::cell::Cell<i32> }

View file

@ -1,11 +0,0 @@
warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/contracts-requires-is-not-inherited-when-nesting.rs:3:12
|
LL | #![feature(contracts)]
| ^^^^^^^^^
|
= note: see issue #128044 <https://github.com/rust-lang/rust/issues/128044> for more information
= note: `#[warn(incomplete_features)]` on by default
warning: 1 warning emitted

View file

@ -1,7 +1,7 @@
//@ run-pass
//@ compile-flags: -Zcontract-checks=yes
#![expect(incomplete_features)]
#![feature(contracts)]
//~^ WARN the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes [incomplete_features]
extern crate core;
use core::contracts::{ensures, requires};

View file

@ -1,11 +0,0 @@
warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/declared-vars-referring-to-params.rs:3:12
|
LL | #![feature(contracts)]
| ^^^^^^^^^
|
= note: see issue #128044 <https://github.com/rust-lang/rust/issues/128044> for more information
= note: `#[warn(incomplete_features)]` on by default
warning: 1 warning emitted

View file

@ -1,7 +1,7 @@
//@ run-pass
//@ compile-flags: -Zcontract-checks=yes
#![expect(incomplete_features)]
#![feature(contracts)]
//~^ WARN the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes [incomplete_features]
extern crate core;
use core::contracts::{ensures, requires};

View file

@ -1,11 +0,0 @@
warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/declared-vars-used-in-ensures.rs:3:12
|
LL | #![feature(contracts)]
| ^^^^^^^^^
|
= note: see issue #128044 <https://github.com/rust-lang/rust/issues/128044> for more information
= note: `#[warn(incomplete_features)]` on by default
warning: 1 warning emitted

View file

@ -1,7 +1,7 @@
//@ run-pass
//@ compile-flags: -Zcontract-checks=yes
#![expect(incomplete_features)]
#![feature(contracts)]
//~^ WARN the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes [incomplete_features]
extern crate core;
use core::contracts::{ensures, requires};

View file

@ -1,11 +0,0 @@
warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/declared-vars-used-in-requires-and-ensures.rs:3:12
|
LL | #![feature(contracts)]
| ^^^^^^^^^
|
= note: see issue #128044 <https://github.com/rust-lang/rust/issues/128044> for more information
= note: `#[warn(incomplete_features)]` on by default
warning: 1 warning emitted

View file

@ -1,7 +1,7 @@
//! Checks for compilation errors related to adding contracts to non-function items.
#![expect(incomplete_features)]
#![feature(contracts)]
//~^ WARN the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes [incomplete_features]
#![allow(dead_code)]
#[core::contracts::requires(true)]

View file

@ -40,14 +40,5 @@ error: contract annotations can only be used on functions
LL | #[core::contracts::requires(true)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/disallow-contract-annotation-on-non-fn.rs:3:12
|
LL | #![feature(contracts)]
| ^^^^^^^^^
|
= note: see issue #128044 <https://github.com/rust-lang/rust/issues/128044> for more information
= note: `#[warn(incomplete_features)]` on by default
error: aborting due to 7 previous errors; 1 warning emitted
error: aborting due to 7 previous errors

View file

@ -1,6 +1,6 @@
//@ compile-flags: -Zcontract-checks=yes
#![expect(incomplete_features)]
#![feature(contracts)]
//~^ WARN the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes [incomplete_features]
extern crate core;
use core::contracts::ensures;

View file

@ -1,12 +1,3 @@
warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/empty-ensures.rs:2:12
|
LL | #![feature(contracts)]
| ^^^^^^^^^
|
= note: see issue #128044 <https://github.com/rust-lang/rust/issues/128044> for more information
= note: `#[warn(incomplete_features)]` on by default
error[E0277]: expected a `Fn(&_)` closure, found `()`
--> $DIR/empty-ensures.rs:8:1
|
@ -20,6 +11,6 @@ LL | #[ensures()]
note: required by a bound in `build_check_ensures`
--> $SRC_DIR/core/src/contracts.rs:LL:COL
error: aborting due to 1 previous error; 1 warning emitted
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0277`.

View file

@ -1,7 +1,7 @@
//@ dont-require-annotations: NOTE
//@ compile-flags: -Zcontract-checks=yes
#![expect(incomplete_features)]
#![feature(contracts)]
//~^ WARN the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes [incomplete_features]
extern crate core;
use core::contracts::requires;

View file

@ -1,18 +1,9 @@
warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/empty-requires.rs:3:12
|
LL | #![feature(contracts)]
| ^^^^^^^^^
|
= note: see issue #128044 <https://github.com/rust-lang/rust/issues/128044> for more information
= note: `#[warn(incomplete_features)]` on by default
error[E0308]: mismatched types
--> $DIR/empty-requires.rs:9:1
|
LL | #[requires()]
| ^^^^^^^^^^^^^ expected `bool`, found `()`
error: aborting due to 1 previous error; 1 warning emitted
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0308`.

View file

@ -0,0 +1,17 @@
//@ run-pass
//@ compile-flags: -Zcontract-checks=yes
// This test specifically checks that the [incomplete_features] warning is
// emitted when the `contracts` feature gate is enabled, so that it can be
// marked as `expect`ed in other tests in order to reduce duplication.
#![feature(contracts)]
//~^ WARN the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes [incomplete_features]
extern crate core;
use core::contracts::requires;
#[requires(true)]
fn foo() {}
fn main() {
foo()
}

View file

@ -1,5 +1,5 @@
warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/associated-item.rs:6:12
--> $DIR/incomplete-feature.rs:7:12
|
LL | #![feature(contracts)]
| ^^^^^^^^^

View file

@ -1,11 +0,0 @@
warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/contract-lang-items.rs:8:12
|
LL | #![feature(contracts)] // to access core::contracts
| ^^^^^^^^^
|
= note: see issue #128044 <https://github.com/rust-lang/rust/issues/128044> for more information
= note: `#[warn(incomplete_features)]` on by default
warning: 1 warning emitted

View file

@ -1,11 +0,0 @@
warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/contract-lang-items.rs:8:12
|
LL | #![feature(contracts)] // to access core::contracts
| ^^^^^^^^^
|
= note: see issue #128044 <https://github.com/rust-lang/rust/issues/128044> for more information
= note: `#[warn(incomplete_features)]` on by default
warning: 1 warning emitted

View file

@ -5,8 +5,8 @@
//
//@ [chk_fail_post] run-crash
#![expect(incomplete_features)]
#![feature(contracts)] // to access core::contracts
//~^ WARN the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes [incomplete_features]
#![feature(contracts_internals)] // to access check_requires lang item
#![feature(core_intrinsics)]
fn foo(x: Baz) -> i32 {

View file

@ -1,11 +0,0 @@
warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/contract-lang-items.rs:8:12
|
LL | #![feature(contracts)] // to access core::contracts
| ^^^^^^^^^
|
= note: see issue #128044 <https://github.com/rust-lang/rust/issues/128044> for more information
= note: `#[warn(incomplete_features)]` on by default
warning: 1 warning emitted

View file

@ -1,6 +1,6 @@
//@ run-pass
#![expect(incomplete_features)]
#![feature(contracts, cfg_contract_checks, contracts_internals, core_intrinsics)]
//~^ WARN the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes [incomplete_features]
extern crate core;

View file

@ -1,11 +0,0 @@
warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/basics.rs:2:12
|
LL | #![feature(contracts, cfg_contract_checks, contracts_internals, core_intrinsics)]
| ^^^^^^^^^
|
= note: see issue #128044 <https://github.com/rust-lang/rust/issues/128044> for more information
= note: `#[warn(incomplete_features)]` on by default
warning: 1 warning emitted

View file

@ -0,0 +1,22 @@
//@ run-pass
//@ compile-flags: -Zcontract-checks=yes
#![expect(incomplete_features)]
#![feature(contracts)]
extern crate core;
use core::contracts::requires;
// Compound statements (those using [ExpressionWithBlock]
// (https://doc.rust-lang.org/beta/reference/expressions.html#railroad-ExpressionWithBlock))
// like blocks, if-expressions, and loops require no trailing semicolon. This
// regression test captures the case where the last statement in the contract
// declarations has no trailing semicolon.
#[requires(
{}
true
)]
fn foo() {}
fn main() {
foo()
}

View file

@ -1,7 +1,7 @@
//@ dont-require-annotations: NOTE
//@ compile-flags: -Zcontract-checks=yes
#![expect(incomplete_features)]
#![feature(contracts)]
//~^ WARN the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes [incomplete_features]
extern crate core;
use core::contracts::requires;

View file

@ -1,18 +1,9 @@
warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/requires-bool-expr-with-semicolon.rs:3:12
|
LL | #![feature(contracts)]
| ^^^^^^^^^
|
= note: see issue #128044 <https://github.com/rust-lang/rust/issues/128044> for more information
= note: `#[warn(incomplete_features)]` on by default
error[E0308]: mismatched types
--> $DIR/requires-bool-expr-with-semicolon.rs:9:1
|
LL | #[requires(true;)]
| ^^^^^^^^^^^^^^^^^^ expected `bool`, found `()`
error: aborting due to 1 previous error; 1 warning emitted
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0308`.

View file

@ -1,7 +1,7 @@
//@ dont-require-annotations: NOTE
//@ compile-flags: -Zcontract-checks=yes
#![expect(incomplete_features)]
#![feature(contracts)]
//~^ WARN the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes [incomplete_features]
extern crate core;
use core::contracts::requires;

View file

@ -1,18 +1,9 @@
warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/requires-no-final-expression.rs:3:12
|
LL | #![feature(contracts)]
| ^^^^^^^^^
|
= note: see issue #128044 <https://github.com/rust-lang/rust/issues/128044> for more information
= note: `#[warn(incomplete_features)]` on by default
error[E0308]: mismatched types
--> $DIR/requires-no-final-expression.rs:9:1
|
LL | #[requires(let y = 1;)]
| ^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found `()`
error: aborting due to 1 previous error; 1 warning emitted
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0308`.

View file

@ -1,3 +1,4 @@
//! regression test for issue #2642
//@ run-pass
#![allow(dead_code)]

Some files were not shown because too many files have changed in this diff Show more