mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-23 12:23:22 +00:00
Auto merge of #129060 - matthiaskrgr:rollup-s72gpif, r=matthiaskrgr
Rollup of 7 pull requests Successful merges: - #122884 (Optimize integer `pow` by removing the exit branch) - #127857 (Allow to customize `// TODO:` comment for deprecated safe autofix) - #129034 (Add `#[must_use]` attribute to `Coroutine` trait) - #129049 (compiletest: Don't panic on unknown JSON-like output lines) - #129050 (Emit a warning instead of an error if `--generate-link-to-definition` is used with other output formats than HTML) - #129056 (Fix one usage of target triple in bootstrap) - #129058 (Add mw back to review rotation) r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
commit
fbce03b195
@ -643,8 +643,8 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
|
||||
through unstable paths"
|
||||
),
|
||||
rustc_attr!(
|
||||
rustc_deprecated_safe_2024, Normal, template!(Word), WarnFollowing,
|
||||
EncodeCrossCrate::Yes,
|
||||
rustc_deprecated_safe_2024, Normal, template!(List: r#"audit_that = "...""#),
|
||||
ErrorFollowing, EncodeCrossCrate::Yes,
|
||||
"rustc_deprecated_safe_2024 is supposed to be used in libstd only",
|
||||
),
|
||||
|
||||
|
@ -30,7 +30,7 @@ mir_build_call_to_deprecated_safe_fn_requires_unsafe =
|
||||
call to deprecated safe function `{$function}` is unsafe and requires unsafe block
|
||||
.note = consult the function's documentation for information on how to avoid undefined behavior
|
||||
.label = call to unsafe function
|
||||
.suggestion = you can wrap the call in an `unsafe` block if you can guarantee the code is only ever called from single-threaded code
|
||||
.suggestion = you can wrap the call in an `unsafe` block if you can guarantee {$guarantee}
|
||||
|
||||
mir_build_call_to_fn_with_requires_unsafe =
|
||||
call to function `{$function}` with `#[target_feature]` is unsafe and requires unsafe block
|
||||
|
@ -96,9 +96,32 @@ impl<'tcx> UnsafetyVisitor<'_, 'tcx> {
|
||||
// from an edition before 2024.
|
||||
&UnsafeOpKind::CallToUnsafeFunction(Some(id))
|
||||
if !span.at_least_rust_2024()
|
||||
&& self.tcx.has_attr(id, sym::rustc_deprecated_safe_2024) =>
|
||||
&& let Some(attr) = self.tcx.get_attr(id, sym::rustc_deprecated_safe_2024) =>
|
||||
{
|
||||
let suggestion = attr
|
||||
.meta_item_list()
|
||||
.unwrap_or_default()
|
||||
.into_iter()
|
||||
.find(|item| item.has_name(sym::audit_that))
|
||||
.map(|item| {
|
||||
item.value_str().expect(
|
||||
"`#[rustc_deprecated_safe_2024(audit_that)]` must have a string value",
|
||||
)
|
||||
});
|
||||
|
||||
let sm = self.tcx.sess.source_map();
|
||||
let guarantee = suggestion
|
||||
.as_ref()
|
||||
.map(|suggestion| format!("that {}", suggestion))
|
||||
.unwrap_or_else(|| String::from("its unsafe preconditions"));
|
||||
let suggestion = suggestion
|
||||
.and_then(|suggestion| {
|
||||
sm.indentation_before(span).map(|indent| {
|
||||
format!("{}// TODO: Audit that {}.\n", indent, suggestion) // ignore-tidy-todo
|
||||
})
|
||||
})
|
||||
.unwrap_or_default();
|
||||
|
||||
self.tcx.emit_node_span_lint(
|
||||
DEPRECATED_SAFE_2024,
|
||||
self.hir_context,
|
||||
@ -106,8 +129,9 @@ impl<'tcx> UnsafetyVisitor<'_, 'tcx> {
|
||||
CallToDeprecatedSafeFnRequiresUnsafe {
|
||||
span,
|
||||
function: with_no_trimmed_paths!(self.tcx.def_path_str(id)),
|
||||
guarantee,
|
||||
sub: CallToDeprecatedSafeFnRequiresUnsafeSub {
|
||||
indent: sm.indentation_before(span).unwrap_or_default(),
|
||||
start_of_line_suggestion: suggestion,
|
||||
start_of_line: sm.span_extend_to_line(span).shrink_to_lo(),
|
||||
left: span.shrink_to_lo(),
|
||||
right: span.shrink_to_hi(),
|
||||
|
@ -28,6 +28,7 @@ pub(crate) struct CallToDeprecatedSafeFnRequiresUnsafe {
|
||||
#[label]
|
||||
pub(crate) span: Span,
|
||||
pub(crate) function: String,
|
||||
pub(crate) guarantee: String,
|
||||
#[subdiagnostic]
|
||||
pub(crate) sub: CallToDeprecatedSafeFnRequiresUnsafeSub,
|
||||
}
|
||||
@ -35,10 +36,8 @@ pub(crate) struct CallToDeprecatedSafeFnRequiresUnsafe {
|
||||
#[derive(Subdiagnostic)]
|
||||
#[multipart_suggestion(mir_build_suggestion, applicability = "machine-applicable")]
|
||||
pub(crate) struct CallToDeprecatedSafeFnRequiresUnsafeSub {
|
||||
pub(crate) indent: String,
|
||||
#[suggestion_part(
|
||||
code = "{indent}// TODO: Audit that the environment access only happens in single-threaded code.\n" // ignore-tidy-todo
|
||||
)]
|
||||
pub(crate) start_of_line_suggestion: String,
|
||||
#[suggestion_part(code = "{start_of_line_suggestion}")]
|
||||
pub(crate) start_of_line: Span,
|
||||
#[suggestion_part(code = "unsafe {{ ")]
|
||||
pub(crate) left: Span,
|
||||
|
@ -472,6 +472,7 @@ symbols! {
|
||||
attr,
|
||||
attr_literals,
|
||||
attributes,
|
||||
audit_that,
|
||||
augmented_assignments,
|
||||
auto_traits,
|
||||
automatically_derived,
|
||||
|
@ -170,6 +170,7 @@
|
||||
#![feature(internal_impls_macro)]
|
||||
#![feature(ip)]
|
||||
#![feature(is_ascii_octdigit)]
|
||||
#![feature(is_val_statically_known)]
|
||||
#![feature(isqrt)]
|
||||
#![feature(link_cfg)]
|
||||
#![feature(offset_of_enum)]
|
||||
|
@ -1496,18 +1496,17 @@ macro_rules! int_impl {
|
||||
let mut base = self;
|
||||
let mut acc: Self = 1;
|
||||
|
||||
while exp > 1 {
|
||||
loop {
|
||||
if (exp & 1) == 1 {
|
||||
acc = try_opt!(acc.checked_mul(base));
|
||||
// since exp!=0, finally the exp must be 1.
|
||||
if exp == 1 {
|
||||
return Some(acc);
|
||||
}
|
||||
}
|
||||
exp /= 2;
|
||||
base = try_opt!(base.checked_mul(base));
|
||||
}
|
||||
// since exp!=0, finally the exp must be 1.
|
||||
// Deal with the final bit of the exponent separately, since
|
||||
// squaring the base afterwards is not necessary and may cause a
|
||||
// needless overflow.
|
||||
acc.checked_mul(base)
|
||||
}
|
||||
|
||||
/// Strict exponentiation. Computes `self.pow(exp)`, panicking if
|
||||
@ -1547,18 +1546,17 @@ macro_rules! int_impl {
|
||||
let mut base = self;
|
||||
let mut acc: Self = 1;
|
||||
|
||||
while exp > 1 {
|
||||
loop {
|
||||
if (exp & 1) == 1 {
|
||||
acc = acc.strict_mul(base);
|
||||
// since exp!=0, finally the exp must be 1.
|
||||
if exp == 1 {
|
||||
return acc;
|
||||
}
|
||||
}
|
||||
exp /= 2;
|
||||
base = base.strict_mul(base);
|
||||
}
|
||||
// since exp!=0, finally the exp must be 1.
|
||||
// Deal with the final bit of the exponent separately, since
|
||||
// squaring the base afterwards is not necessary and may cause a
|
||||
// needless overflow.
|
||||
acc.strict_mul(base)
|
||||
}
|
||||
|
||||
/// Returns the square root of the number, rounded down.
|
||||
@ -2175,6 +2173,7 @@ macro_rules! int_impl {
|
||||
#[must_use = "this returns the result of the operation, \
|
||||
without modifying the original"]
|
||||
#[inline]
|
||||
#[rustc_allow_const_fn_unstable(is_val_statically_known)]
|
||||
pub const fn wrapping_pow(self, mut exp: u32) -> Self {
|
||||
if exp == 0 {
|
||||
return 1;
|
||||
@ -2182,19 +2181,36 @@ macro_rules! int_impl {
|
||||
let mut base = self;
|
||||
let mut acc: Self = 1;
|
||||
|
||||
while exp > 1 {
|
||||
if (exp & 1) == 1 {
|
||||
acc = acc.wrapping_mul(base);
|
||||
if intrinsics::is_val_statically_known(exp) {
|
||||
while exp > 1 {
|
||||
if (exp & 1) == 1 {
|
||||
acc = acc.wrapping_mul(base);
|
||||
}
|
||||
exp /= 2;
|
||||
base = base.wrapping_mul(base);
|
||||
}
|
||||
exp /= 2;
|
||||
base = base.wrapping_mul(base);
|
||||
}
|
||||
|
||||
// since exp!=0, finally the exp must be 1.
|
||||
// Deal with the final bit of the exponent separately, since
|
||||
// squaring the base afterwards is not necessary and may cause a
|
||||
// needless overflow.
|
||||
acc.wrapping_mul(base)
|
||||
// since exp!=0, finally the exp must be 1.
|
||||
// Deal with the final bit of the exponent separately, since
|
||||
// squaring the base afterwards is not necessary.
|
||||
acc.wrapping_mul(base)
|
||||
} else {
|
||||
// This is faster than the above when the exponent is not known
|
||||
// at compile time. We can't use the same code for the constant
|
||||
// exponent case because LLVM is currently unable to unroll
|
||||
// this loop.
|
||||
loop {
|
||||
if (exp & 1) == 1 {
|
||||
acc = acc.wrapping_mul(base);
|
||||
// since exp!=0, finally the exp must be 1.
|
||||
if exp == 1 {
|
||||
return acc;
|
||||
}
|
||||
}
|
||||
exp /= 2;
|
||||
base = base.wrapping_mul(base);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Calculates `self` + `rhs`.
|
||||
@ -2690,9 +2706,14 @@ macro_rules! int_impl {
|
||||
// Scratch space for storing results of overflowing_mul.
|
||||
let mut r;
|
||||
|
||||
while exp > 1 {
|
||||
loop {
|
||||
if (exp & 1) == 1 {
|
||||
r = acc.overflowing_mul(base);
|
||||
// since exp!=0, finally the exp must be 1.
|
||||
if exp == 1 {
|
||||
r.1 |= overflown;
|
||||
return r;
|
||||
}
|
||||
acc = r.0;
|
||||
overflown |= r.1;
|
||||
}
|
||||
@ -2701,14 +2722,6 @@ macro_rules! int_impl {
|
||||
base = r.0;
|
||||
overflown |= r.1;
|
||||
}
|
||||
|
||||
// since exp!=0, finally the exp must be 1.
|
||||
// Deal with the final bit of the exponent separately, since
|
||||
// squaring the base afterwards is not necessary and may cause a
|
||||
// needless overflow.
|
||||
r = acc.overflowing_mul(base);
|
||||
r.1 |= overflown;
|
||||
r
|
||||
}
|
||||
|
||||
/// Raises self to the power of `exp`, using exponentiation by squaring.
|
||||
@ -2728,6 +2741,7 @@ macro_rules! int_impl {
|
||||
without modifying the original"]
|
||||
#[inline]
|
||||
#[rustc_inherit_overflow_checks]
|
||||
#[rustc_allow_const_fn_unstable(is_val_statically_known)]
|
||||
pub const fn pow(self, mut exp: u32) -> Self {
|
||||
if exp == 0 {
|
||||
return 1;
|
||||
@ -2735,19 +2749,37 @@ macro_rules! int_impl {
|
||||
let mut base = self;
|
||||
let mut acc = 1;
|
||||
|
||||
while exp > 1 {
|
||||
if (exp & 1) == 1 {
|
||||
acc = acc * base;
|
||||
if intrinsics::is_val_statically_known(exp) {
|
||||
while exp > 1 {
|
||||
if (exp & 1) == 1 {
|
||||
acc = acc * base;
|
||||
}
|
||||
exp /= 2;
|
||||
base = base * base;
|
||||
}
|
||||
exp /= 2;
|
||||
base = base * base;
|
||||
}
|
||||
|
||||
// since exp!=0, finally the exp must be 1.
|
||||
// Deal with the final bit of the exponent separately, since
|
||||
// squaring the base afterwards is not necessary and may cause a
|
||||
// needless overflow.
|
||||
acc * base
|
||||
// since exp!=0, finally the exp must be 1.
|
||||
// Deal with the final bit of the exponent separately, since
|
||||
// squaring the base afterwards is not necessary and may cause a
|
||||
// needless overflow.
|
||||
acc * base
|
||||
} else {
|
||||
// This is faster than the above when the exponent is not known
|
||||
// at compile time. We can't use the same code for the constant
|
||||
// exponent case because LLVM is currently unable to unroll
|
||||
// this loop.
|
||||
loop {
|
||||
if (exp & 1) == 1 {
|
||||
acc = acc * base;
|
||||
// since exp!=0, finally the exp must be 1.
|
||||
if exp == 1 {
|
||||
return acc;
|
||||
}
|
||||
}
|
||||
exp /= 2;
|
||||
base = base * base;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns the square root of the number, rounded down.
|
||||
|
@ -1622,20 +1622,17 @@ macro_rules! uint_impl {
|
||||
let mut base = self;
|
||||
let mut acc: Self = 1;
|
||||
|
||||
while exp > 1 {
|
||||
loop {
|
||||
if (exp & 1) == 1 {
|
||||
acc = try_opt!(acc.checked_mul(base));
|
||||
// since exp!=0, finally the exp must be 1.
|
||||
if exp == 1 {
|
||||
return Some(acc);
|
||||
}
|
||||
}
|
||||
exp /= 2;
|
||||
base = try_opt!(base.checked_mul(base));
|
||||
}
|
||||
|
||||
// since exp!=0, finally the exp must be 1.
|
||||
// Deal with the final bit of the exponent separately, since
|
||||
// squaring the base afterwards is not necessary and may cause a
|
||||
// needless overflow.
|
||||
|
||||
acc.checked_mul(base)
|
||||
}
|
||||
|
||||
/// Strict exponentiation. Computes `self.pow(exp)`, panicking if
|
||||
@ -1675,18 +1672,17 @@ macro_rules! uint_impl {
|
||||
let mut base = self;
|
||||
let mut acc: Self = 1;
|
||||
|
||||
while exp > 1 {
|
||||
loop {
|
||||
if (exp & 1) == 1 {
|
||||
acc = acc.strict_mul(base);
|
||||
// since exp!=0, finally the exp must be 1.
|
||||
if exp == 1 {
|
||||
return acc;
|
||||
}
|
||||
}
|
||||
exp /= 2;
|
||||
base = base.strict_mul(base);
|
||||
}
|
||||
// since exp!=0, finally the exp must be 1.
|
||||
// Deal with the final bit of the exponent separately, since
|
||||
// squaring the base afterwards is not necessary and may cause a
|
||||
// needless overflow.
|
||||
acc.strict_mul(base)
|
||||
}
|
||||
|
||||
/// Saturating integer addition. Computes `self + rhs`, saturating at
|
||||
@ -2138,6 +2134,7 @@ macro_rules! uint_impl {
|
||||
#[must_use = "this returns the result of the operation, \
|
||||
without modifying the original"]
|
||||
#[inline]
|
||||
#[rustc_allow_const_fn_unstable(is_val_statically_known)]
|
||||
pub const fn wrapping_pow(self, mut exp: u32) -> Self {
|
||||
if exp == 0 {
|
||||
return 1;
|
||||
@ -2145,19 +2142,36 @@ macro_rules! uint_impl {
|
||||
let mut base = self;
|
||||
let mut acc: Self = 1;
|
||||
|
||||
while exp > 1 {
|
||||
if (exp & 1) == 1 {
|
||||
acc = acc.wrapping_mul(base);
|
||||
if intrinsics::is_val_statically_known(exp) {
|
||||
while exp > 1 {
|
||||
if (exp & 1) == 1 {
|
||||
acc = acc.wrapping_mul(base);
|
||||
}
|
||||
exp /= 2;
|
||||
base = base.wrapping_mul(base);
|
||||
}
|
||||
exp /= 2;
|
||||
base = base.wrapping_mul(base);
|
||||
}
|
||||
|
||||
// since exp!=0, finally the exp must be 1.
|
||||
// Deal with the final bit of the exponent separately, since
|
||||
// squaring the base afterwards is not necessary and may cause a
|
||||
// needless overflow.
|
||||
acc.wrapping_mul(base)
|
||||
// since exp!=0, finally the exp must be 1.
|
||||
// Deal with the final bit of the exponent separately, since
|
||||
// squaring the base afterwards is not necessary.
|
||||
acc.wrapping_mul(base)
|
||||
} else {
|
||||
// This is faster than the above when the exponent is not known
|
||||
// at compile time. We can't use the same code for the constant
|
||||
// exponent case because LLVM is currently unable to unroll
|
||||
// this loop.
|
||||
loop {
|
||||
if (exp & 1) == 1 {
|
||||
acc = acc.wrapping_mul(base);
|
||||
// since exp!=0, finally the exp must be 1.
|
||||
if exp == 1 {
|
||||
return acc;
|
||||
}
|
||||
}
|
||||
exp /= 2;
|
||||
base = base.wrapping_mul(base);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Calculates `self` + `rhs`.
|
||||
@ -2603,9 +2617,14 @@ macro_rules! uint_impl {
|
||||
// Scratch space for storing results of overflowing_mul.
|
||||
let mut r;
|
||||
|
||||
while exp > 1 {
|
||||
loop {
|
||||
if (exp & 1) == 1 {
|
||||
r = acc.overflowing_mul(base);
|
||||
// since exp!=0, finally the exp must be 1.
|
||||
if exp == 1 {
|
||||
r.1 |= overflown;
|
||||
return r;
|
||||
}
|
||||
acc = r.0;
|
||||
overflown |= r.1;
|
||||
}
|
||||
@ -2614,15 +2633,6 @@ macro_rules! uint_impl {
|
||||
base = r.0;
|
||||
overflown |= r.1;
|
||||
}
|
||||
|
||||
// since exp!=0, finally the exp must be 1.
|
||||
// Deal with the final bit of the exponent separately, since
|
||||
// squaring the base afterwards is not necessary and may cause a
|
||||
// needless overflow.
|
||||
r = acc.overflowing_mul(base);
|
||||
r.1 |= overflown;
|
||||
|
||||
r
|
||||
}
|
||||
|
||||
/// Raises self to the power of `exp`, using exponentiation by squaring.
|
||||
@ -2640,6 +2650,7 @@ macro_rules! uint_impl {
|
||||
without modifying the original"]
|
||||
#[inline]
|
||||
#[rustc_inherit_overflow_checks]
|
||||
#[rustc_allow_const_fn_unstable(is_val_statically_known)]
|
||||
pub const fn pow(self, mut exp: u32) -> Self {
|
||||
if exp == 0 {
|
||||
return 1;
|
||||
@ -2647,19 +2658,37 @@ macro_rules! uint_impl {
|
||||
let mut base = self;
|
||||
let mut acc = 1;
|
||||
|
||||
while exp > 1 {
|
||||
if (exp & 1) == 1 {
|
||||
acc = acc * base;
|
||||
if intrinsics::is_val_statically_known(exp) {
|
||||
while exp > 1 {
|
||||
if (exp & 1) == 1 {
|
||||
acc = acc * base;
|
||||
}
|
||||
exp /= 2;
|
||||
base = base * base;
|
||||
}
|
||||
exp /= 2;
|
||||
base = base * base;
|
||||
}
|
||||
|
||||
// since exp!=0, finally the exp must be 1.
|
||||
// Deal with the final bit of the exponent separately, since
|
||||
// squaring the base afterwards is not necessary and may cause a
|
||||
// needless overflow.
|
||||
acc * base
|
||||
// since exp!=0, finally the exp must be 1.
|
||||
// Deal with the final bit of the exponent separately, since
|
||||
// squaring the base afterwards is not necessary and may cause a
|
||||
// needless overflow.
|
||||
acc * base
|
||||
} else {
|
||||
// This is faster than the above when the exponent is not known
|
||||
// at compile time. We can't use the same code for the constant
|
||||
// exponent case because LLVM is currently unable to unroll
|
||||
// this loop.
|
||||
loop {
|
||||
if (exp & 1) == 1 {
|
||||
acc = acc * base;
|
||||
// since exp!=0, finally the exp must be 1.
|
||||
if exp == 1 {
|
||||
return acc;
|
||||
}
|
||||
}
|
||||
exp /= 2;
|
||||
base = base * base;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns the square root of the number, rounded down.
|
||||
|
@ -69,6 +69,7 @@ pub enum CoroutineState<Y, R> {
|
||||
#[lang = "coroutine"]
|
||||
#[unstable(feature = "coroutine_trait", issue = "43122")]
|
||||
#[fundamental]
|
||||
#[must_use = "coroutines are lazy and do nothing unless resumed"]
|
||||
pub trait Coroutine<R = ()> {
|
||||
/// The type of value this coroutine yields.
|
||||
///
|
||||
|
@ -355,7 +355,13 @@ impl Error for VarError {
|
||||
/// }
|
||||
/// assert_eq!(env::var(key), Ok("VALUE".to_string()));
|
||||
/// ```
|
||||
#[rustc_deprecated_safe_2024]
|
||||
#[cfg_attr(bootstrap, rustc_deprecated_safe_2024)]
|
||||
#[cfg_attr(
|
||||
not(bootstrap),
|
||||
rustc_deprecated_safe_2024(
|
||||
audit_that = "the environment access only happens in single-threaded code"
|
||||
)
|
||||
)]
|
||||
#[stable(feature = "env", since = "1.0.0")]
|
||||
pub unsafe fn set_var<K: AsRef<OsStr>, V: AsRef<OsStr>>(key: K, value: V) {
|
||||
let (key, value) = (key.as_ref(), value.as_ref());
|
||||
@ -419,7 +425,13 @@ pub unsafe fn set_var<K: AsRef<OsStr>, V: AsRef<OsStr>>(key: K, value: V) {
|
||||
/// }
|
||||
/// assert!(env::var(key).is_err());
|
||||
/// ```
|
||||
#[rustc_deprecated_safe_2024]
|
||||
#[cfg_attr(bootstrap, rustc_deprecated_safe_2024)]
|
||||
#[cfg_attr(
|
||||
not(bootstrap),
|
||||
rustc_deprecated_safe_2024(
|
||||
audit_that = "the environment access only happens in single-threaded code"
|
||||
)
|
||||
)]
|
||||
#[stable(feature = "env", since = "1.0.0")]
|
||||
pub unsafe fn remove_var<K: AsRef<OsStr>>(key: K) {
|
||||
let key = key.as_ref();
|
||||
|
@ -519,7 +519,7 @@ impl Config {
|
||||
extra_components: &[&str],
|
||||
download_component: fn(&Config, String, &str, &str),
|
||||
) {
|
||||
let host = self.build;
|
||||
let host = self.build.triple;
|
||||
let bin_root = self.out.join(host).join(sysroot);
|
||||
let rustc_stamp = bin_root.join(".rustc-stamp");
|
||||
|
||||
|
@ -733,9 +733,11 @@ impl Options {
|
||||
let html_no_source = matches.opt_present("html-no-source");
|
||||
|
||||
if generate_link_to_definition && (show_coverage || output_format != OutputFormat::Html) {
|
||||
dcx.fatal(
|
||||
"--generate-link-to-definition option can only be used with HTML output format",
|
||||
);
|
||||
dcx.struct_warn(
|
||||
"`--generate-link-to-definition` option can only be used with HTML output format",
|
||||
)
|
||||
.with_note("`--generate-link-to-definition` option will be ignored")
|
||||
.emit();
|
||||
}
|
||||
|
||||
let scrape_examples_options = ScrapeExamplesOptions::new(matches, dcx);
|
||||
|
@ -1,5 +1,4 @@
|
||||
//! These structs are a subset of the ones found in `rustc_errors::json`.
|
||||
//! They are only used for deserialization of JSON output provided by libtest.
|
||||
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::str::FromStr;
|
||||
@ -127,11 +126,10 @@ pub fn extract_rendered(output: &str) -> String {
|
||||
// Ignore the notification.
|
||||
None
|
||||
} else {
|
||||
print!(
|
||||
"failed to decode compiler output as json: line: {}\noutput: {}",
|
||||
line, output
|
||||
);
|
||||
panic!()
|
||||
// This function is called for both compiler and non-compiler output,
|
||||
// so if the line isn't recognized as JSON from the compiler then
|
||||
// just print it as-is.
|
||||
Some(format!("{line}\n"))
|
||||
}
|
||||
} else {
|
||||
// preserve non-JSON lines, such as ICEs
|
||||
|
@ -2,5 +2,6 @@
|
||||
// option can only be used with HTML generation.
|
||||
|
||||
//@ compile-flags: -Zunstable-options --generate-link-to-definition --output-format json
|
||||
//@ check-pass
|
||||
|
||||
pub fn f() {}
|
||||
|
@ -1,2 +1,4 @@
|
||||
error: --generate-link-to-definition option can only be used with HTML output format
|
||||
warning: `--generate-link-to-definition` option can only be used with HTML output format
|
||||
|
|
||||
= note: `--generate-link-to-definition` option will be ignored
|
||||
|
||||
|
@ -1,6 +0,0 @@
|
||||
// This test purpose is to check that the "--generate-link-to-definition"
|
||||
// option can only be used with HTML generation.
|
||||
|
||||
//@ compile-flags: -Zunstable-options --generate-link-to-definition --show-coverage
|
||||
|
||||
pub fn f() {}
|
@ -1,2 +0,0 @@
|
||||
error: --generate-link-to-definition option can only be used with HTML output format
|
||||
|
@ -13,7 +13,8 @@ impl Database {
|
||||
}
|
||||
|
||||
fn check_connection(&self) -> impl Coroutine<Yield = (), Return = ()> + '_ {
|
||||
#[coroutine] move || {
|
||||
#[coroutine]
|
||||
move || {
|
||||
let iter = self.get_connection();
|
||||
for i in iter {
|
||||
yield i
|
||||
@ -23,5 +24,5 @@ impl Database {
|
||||
}
|
||||
|
||||
fn main() {
|
||||
Database.check_connection();
|
||||
let _ = Database.check_connection();
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ note: the lint level is defined here
|
||||
|
|
||||
LL | #![deny(deprecated_safe_2024)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
help: you can wrap the call in an `unsafe` block if you can guarantee the code is only ever called from single-threaded code
|
||||
help: you can wrap the call in an `unsafe` block if you can guarantee that the environment access only happens in single-threaded code
|
||||
|
|
||||
LL + // TODO: Audit that the environment access only happens in single-threaded code.
|
||||
LL ~ unsafe { env::set_var("FOO", "BAR") };
|
||||
@ -25,7 +25,7 @@ LL | env::remove_var("FOO");
|
||||
|
|
||||
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2024!
|
||||
= note: for more information, see issue #27970 <https://github.com/rust-lang/rust/issues/27970>
|
||||
help: you can wrap the call in an `unsafe` block if you can guarantee the code is only ever called from single-threaded code
|
||||
help: you can wrap the call in an `unsafe` block if you can guarantee that the environment access only happens in single-threaded code
|
||||
|
|
||||
LL + // TODO: Audit that the environment access only happens in single-threaded code.
|
||||
LL ~ unsafe { env::remove_var("FOO") };
|
||||
|
@ -913,7 +913,7 @@ cc = ["@kobzol"]
|
||||
[assign]
|
||||
warn_non_default_branch = true
|
||||
contributing_url = "https://rustc-dev-guide.rust-lang.org/getting-started.html"
|
||||
users_on_vacation = ["jyn514", "jhpratt", "oli-obk", "michaelwoerister"]
|
||||
users_on_vacation = ["jyn514", "jhpratt", "oli-obk"]
|
||||
|
||||
[assign.adhoc_groups]
|
||||
compiler-team = [
|
||||
|
Loading…
Reference in New Issue
Block a user