Auto merge of #133770 - GuillaumeGomez:rollup-l62iyyx, r=GuillaumeGomez

Rollup of 10 pull requests

Successful merges:

 - #131713 (Stabilize `const_maybe_uninit_write`)
 - #133535 (show forbidden_lint_groups in future-compat reports)
 - #133610 (Move `Const::{from_anon_const,try_from_lit}` to hir_ty_lowering)
 - #133701 (Use c"lit" for CStrings without unwrap)
 - #133704 (fix ICE when promoted has layout size overflow)
 - #133705 (add "profiler" and "optimized-compiler-builtins" option coverage for ci-rustc)
 - #133710 (Reducing `target_feature` check-cfg merge conflicts)
 - #133732 (Fix `-Zdump-mir-dataflow`)
 - #133746 (Change `AttrArgs::Eq` to a struct variant)
 - #133763 (Fix `f16::midpoint` const feature gate)

r? `@ghost`
`@rustbot` modify labels: rollup
This commit is contained in:
bors 2024-12-03 00:51:25 +00:00
commit 41cbe3e4d1
90 changed files with 1866 additions and 421 deletions

View file

@ -1731,12 +1731,12 @@ pub enum AttrArgs {
/// Delimited arguments: `#[attr()/[]/{}]`.
Delimited(DelimArgs),
/// Arguments of a key-value attribute: `#[attr = "value"]`.
Eq(
Eq {
/// Span of the `=` token.
Span,
/// The "value".
AttrArgsEq,
),
eq_span: Span,
value: AttrArgsEq,
},
}
// The RHS of an `AttrArgs::Eq` starts out as an expression. Once macro
@ -1748,15 +1748,39 @@ pub enum AttrArgsEq {
Hir(MetaItemLit),
}
impl AttrArgsEq {
pub fn span(&self) -> Span {
match self {
AttrArgsEq::Ast(p) => p.span,
AttrArgsEq::Hir(lit) => lit.span,
}
}
pub fn unwrap_ast(&self) -> &Expr {
match self {
AttrArgsEq::Ast(p) => p,
AttrArgsEq::Hir(lit) => {
unreachable!("in literal form when getting inner tokens: {lit:?}")
}
}
}
pub fn unwrap_ast_mut(&mut self) -> &mut P<Expr> {
match self {
AttrArgsEq::Ast(p) => p,
AttrArgsEq::Hir(lit) => {
unreachable!("in literal form when getting inner tokens: {lit:?}")
}
}
}
}
impl AttrArgs {
pub fn span(&self) -> Option<Span> {
match self {
AttrArgs::Empty => None,
AttrArgs::Delimited(args) => Some(args.dspan.entire()),
AttrArgs::Eq(eq_span, AttrArgsEq::Ast(expr)) => Some(eq_span.to(expr.span)),
AttrArgs::Eq(_, AttrArgsEq::Hir(lit)) => {
unreachable!("in literal form when getting span: {:?}", lit);
}
AttrArgs::Eq { eq_span, value } => Some(eq_span.to(value.span())),
}
}
@ -1766,10 +1790,7 @@ impl AttrArgs {
match self {
AttrArgs::Empty => TokenStream::default(),
AttrArgs::Delimited(args) => args.tokens.clone(),
AttrArgs::Eq(_, AttrArgsEq::Ast(expr)) => TokenStream::from_ast(expr),
AttrArgs::Eq(_, AttrArgsEq::Hir(lit)) => {
unreachable!("in literal form when getting inner tokens: {:?}", lit)
}
AttrArgs::Eq { value, .. } => TokenStream::from_ast(value.unwrap_ast()),
}
}
}
@ -1783,10 +1804,10 @@ where
match self {
AttrArgs::Empty => {}
AttrArgs::Delimited(args) => args.hash_stable(ctx, hasher),
AttrArgs::Eq(_eq_span, AttrArgsEq::Ast(expr)) => {
AttrArgs::Eq { value: AttrArgsEq::Ast(expr), .. } => {
unreachable!("hash_stable {:?}", expr);
}
AttrArgs::Eq(eq_span, AttrArgsEq::Hir(lit)) => {
AttrArgs::Eq { eq_span, value: AttrArgsEq::Hir(lit) } => {
eq_span.hash_stable(ctx, hasher);
lit.hash_stable(ctx, hasher);
}

View file

@ -250,7 +250,7 @@ impl AttrItem {
AttrArgs::Delimited(args) if args.delim == Delimiter::Parenthesis => {
MetaItemKind::list_from_tokens(args.tokens.clone())
}
AttrArgs::Delimited(_) | AttrArgs::Eq(..) | AttrArgs::Empty => None,
AttrArgs::Delimited(_) | AttrArgs::Eq { .. } | AttrArgs::Empty => None,
}
}
@ -268,7 +268,7 @@ impl AttrItem {
/// ```
fn value_str(&self) -> Option<Symbol> {
match &self.args {
AttrArgs::Eq(_, args) => args.value_str(),
AttrArgs::Eq { value, .. } => value.value_str(),
AttrArgs::Delimited(_) | AttrArgs::Empty => None,
}
}
@ -492,7 +492,7 @@ impl MetaItemKind {
MetaItemKind::list_from_tokens(tokens.clone()).map(MetaItemKind::List)
}
AttrArgs::Delimited(..) => None,
AttrArgs::Eq(_, AttrArgsEq::Ast(expr)) => match expr.kind {
AttrArgs::Eq { value: AttrArgsEq::Ast(expr), .. } => match expr.kind {
ExprKind::Lit(token_lit) => {
// Turn failures to `None`, we'll get parse errors elsewhere.
MetaItemLit::from_token_lit(token_lit, expr.span)
@ -501,7 +501,9 @@ impl MetaItemKind {
}
_ => None,
},
AttrArgs::Eq(_, AttrArgsEq::Hir(lit)) => Some(MetaItemKind::NameValue(lit.clone())),
AttrArgs::Eq { value: AttrArgsEq::Hir(lit), .. } => {
Some(MetaItemKind::NameValue(lit.clone()))
}
}
}
}
@ -702,7 +704,7 @@ pub fn mk_attr_name_value_str(
tokens: None,
});
let path = Path::from_ident(Ident::new(name, span));
let args = AttrArgs::Eq(span, AttrArgsEq::Ast(expr));
let args = AttrArgs::Eq { eq_span: span, value: AttrArgsEq::Ast(expr) };
mk_attr(g, style, unsafety, path, args, span)
}

View file

@ -451,13 +451,10 @@ fn visit_attr_args<T: MutVisitor>(vis: &mut T, args: &mut AttrArgs) {
match args {
AttrArgs::Empty => {}
AttrArgs::Delimited(args) => visit_delim_args(vis, args),
AttrArgs::Eq(eq_span, AttrArgsEq::Ast(expr)) => {
vis.visit_expr(expr);
AttrArgs::Eq { eq_span, value } => {
vis.visit_expr(value.unwrap_ast_mut());
vis.visit_span(eq_span);
}
AttrArgs::Eq(_eq_span, AttrArgsEq::Hir(lit)) => {
unreachable!("in literal form when visiting mac args eq: {:?}", lit)
}
}
}

View file

@ -1273,10 +1273,7 @@ pub fn walk_attr_args<'a, V: Visitor<'a>>(visitor: &mut V, args: &'a AttrArgs) -
match args {
AttrArgs::Empty => {}
AttrArgs::Delimited(_args) => {}
AttrArgs::Eq(_eq_span, AttrArgsEq::Ast(expr)) => try_visit!(visitor.visit_expr(expr)),
AttrArgs::Eq(_eq_span, AttrArgsEq::Hir(lit)) => {
unreachable!("in literal form when walking mac args eq: {:?}", lit)
}
AttrArgs::Eq { value, .. } => try_visit!(visitor.visit_expr(value.unwrap_ast())),
}
V::Result::output()
}

View file

@ -889,7 +889,8 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
// This is an inert key-value attribute - it will never be visible to macros
// after it gets lowered to HIR. Therefore, we can extract literals to handle
// nonterminals in `#[doc]` (e.g. `#[doc = $e]`).
AttrArgs::Eq(eq_span, AttrArgsEq::Ast(expr)) => {
&AttrArgs::Eq { eq_span, ref value } => {
let expr = value.unwrap_ast();
// In valid code the value always ends up as a single literal. Otherwise, a dummy
// literal suffices because the error is handled elsewhere.
let lit = if let ExprKind::Lit(token_lit) = expr.kind
@ -905,10 +906,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
span: DUMMY_SP,
}
};
AttrArgs::Eq(*eq_span, AttrArgsEq::Hir(lit))
}
AttrArgs::Eq(_, AttrArgsEq::Hir(lit)) => {
unreachable!("in literal form when lowering mac args eq: {:?}", lit)
AttrArgs::Eq { eq_span, value: AttrArgsEq::Hir(lit) }
}
}
}

View file

@ -648,14 +648,14 @@ pub trait PrintState<'a>: std::ops::Deref<Target = pp::Printer> + std::ops::Dere
AttrArgs::Empty => {
self.print_path(&item.path, false, 0);
}
AttrArgs::Eq(_, AttrArgsEq::Ast(expr)) => {
AttrArgs::Eq { value: AttrArgsEq::Ast(expr), .. } => {
self.print_path(&item.path, false, 0);
self.space();
self.word_space("=");
let token_str = self.expr_to_string(expr);
self.word(token_str);
}
AttrArgs::Eq(_, AttrArgsEq::Hir(lit)) => {
AttrArgs::Eq { value: AttrArgsEq::Hir(lit), .. } => {
self.print_path(&item.path, false, 0);
self.space();
self.word_space("=");

View file

@ -148,7 +148,7 @@ fn prepare_lto(
// __llvm_profile_counter_bias is pulled in at link time by an undefined reference to
// __llvm_profile_runtime, therefore we won't know until link time if this symbol
// should have default visibility.
symbols_below_threshold.push(CString::new("__llvm_profile_counter_bias").unwrap());
symbols_below_threshold.push(c"__llvm_profile_counter_bias".to_owned());
Ok((symbols_below_threshold, upstream_modules))
}

View file

@ -509,7 +509,7 @@ fn get_pgo_sample_use_path(config: &ModuleConfig) -> Option<CString> {
}
fn get_instr_profile_output_path(config: &ModuleConfig) -> Option<CString> {
config.instrument_coverage.then(|| CString::new("default_%m_%p.profraw").unwrap())
config.instrument_coverage.then(|| c"default_%m_%p.profraw".to_owned())
}
pub(crate) unsafe fn llvm_optimize(

View file

@ -139,12 +139,14 @@ where
match error {
// Don't emit a new diagnostic for these errors, they are already reported elsewhere or
// should remain silent.
err_inval!(AlreadyReported(info)) => ErrorHandled::Reported(info, span),
err_inval!(Layout(LayoutError::Unknown(_))) | err_inval!(TooGeneric) => {
ErrorHandled::TooGeneric(span)
}
err_inval!(AlreadyReported(guar)) => ErrorHandled::Reported(guar, span),
err_inval!(Layout(LayoutError::ReferencesError(guar))) => {
ErrorHandled::Reported(ReportedErrorInfo::tainted_by_errors(guar), span)
// This can occur in infallible promoteds e.g. when a non-existent type or field is
// encountered.
ErrorHandled::Reported(ReportedErrorInfo::allowed_in_infallible(guar), span)
}
// Report remaining errors.
_ => {
@ -152,7 +154,12 @@ where
let span = span.substitute_dummy(our_span);
let err = mk(span, frames);
let mut err = tcx.dcx().create_err(err);
let can_be_spurious = matches!(error, InterpErrorKind::ResourceExhaustion(_));
// We allow invalid programs in infallible promoteds since invalid layouts can occur
// anyway (e.g. due to size overflow). And we allow OOM as that can happen any time.
let allowed_in_infallible = matches!(
error,
InterpErrorKind::ResourceExhaustion(_) | InterpErrorKind::InvalidProgram(_)
);
let msg = error.diagnostic_message();
error.add_args(&mut err);
@ -160,8 +167,8 @@ where
// Use *our* span to label the interp error
err.span_label(our_span, msg);
let g = err.emit();
let reported = if can_be_spurious {
ReportedErrorInfo::spurious(g)
let reported = if allowed_in_infallible {
ReportedErrorInfo::allowed_in_infallible(g)
} else {
ReportedErrorInfo::from(g)
};

View file

@ -268,7 +268,7 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
};
// do not continue if typeck errors occurred (can only occur in local crate)
if let Some(err) = body.tainted_by_errors {
throw_inval!(AlreadyReported(ReportedErrorInfo::tainted_by_errors(err)));
throw_inval!(AlreadyReported(ReportedErrorInfo::from(err)));
}
interp_ok(body)
}
@ -585,13 +585,10 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
match err {
ErrorHandled::TooGeneric(..) => {},
ErrorHandled::Reported(reported, span) => {
if reported.is_tainted_by_errors() {
// const-eval will return "tainted" errors if e.g. the layout cannot
// be computed as the type references non-existing names.
// See <https://github.com/rust-lang/rust/issues/124348>.
} else if reported.can_be_spurious() {
if reported.is_allowed_in_infallible() {
// These errors can just sometimes happen, even when the expression
// is nominally "infallible", e.g. when running out of memory.
// is nominally "infallible", e.g. when running out of memory
// or when some layout could not be computed.
} else {
// Looks like the const is not captured by `required_consts`, that's bad.
span_bug!(span, "interpret const eval failure of {val:?} which is not in required_consts");

View file

@ -15,7 +15,7 @@ unsafe { printf(); } // error!
Using this declaration, it must be called with at least one argument, so
simply calling `printf()` is invalid. But the following uses are allowed:
```
```rust,edition2021
# use std::os::raw::{c_char, c_int};
# #[cfg_attr(all(windows, target_env = "msvc"),
# link(name = "legacy_stdio_definitions",
@ -23,16 +23,11 @@ simply calling `printf()` is invalid. But the following uses are allowed:
# extern "C" { fn printf(_: *const c_char, ...) -> c_int; }
# fn main() {
unsafe {
use std::ffi::CString;
printf(c"test\n".as_ptr());
let fmt = CString::new("test\n").unwrap();
printf(fmt.as_ptr());
printf(c"number = %d\n".as_ptr(), 3);
let fmt = CString::new("number = %d\n").unwrap();
printf(fmt.as_ptr(), 3);
let fmt = CString::new("%d, %d\n").unwrap();
printf(fmt.as_ptr(), 10, 5);
printf(c"%d, %d\n".as_ptr(), 10, 5);
}
# }
```

View file

@ -732,7 +732,7 @@ impl<'a, 'b> MacroExpander<'a, 'b> {
_ => item.to_tokens(),
};
let attr_item = attr.unwrap_normal_item();
if let AttrArgs::Eq(..) = attr_item.args {
if let AttrArgs::Eq { .. } = attr_item.args {
self.cx.dcx().emit_err(UnsupportedKeyValue { span });
}
let inner_tokens = attr_item.args.inner_tokens();

View file

@ -13,6 +13,7 @@ use rustc_hir::lang_items::LangItem;
use rustc_infer::infer::outlives::env::OutlivesEnvironment;
use rustc_infer::infer::{self, InferCtxt, TyCtxtInferExt};
use rustc_macros::LintDiagnostic;
use rustc_middle::mir::interpret::ErrorHandled;
use rustc_middle::query::Providers;
use rustc_middle::ty::print::with_no_trimmed_paths;
use rustc_middle::ty::trait_def::TraitSpecializationKind;
@ -1170,19 +1171,13 @@ fn check_type_defn<'tcx>(
// Explicit `enum` discriminant values must const-evaluate successfully.
if let ty::VariantDiscr::Explicit(discr_def_id) = variant.discr {
let cause = traits::ObligationCause::new(
tcx.def_span(discr_def_id),
wfcx.body_def_id,
ObligationCauseCode::Misc,
);
wfcx.register_obligation(Obligation::new(
tcx,
cause,
wfcx.param_env,
ty::Binder::dummy(ty::PredicateKind::Clause(ty::ClauseKind::ConstEvaluatable(
ty::Const::from_anon_const(tcx, discr_def_id.expect_local()),
))),
));
match tcx.const_eval_poly(discr_def_id) {
Ok(_) => {}
Err(ErrorHandled::Reported(..)) => {}
Err(ErrorHandled::TooGeneric(sp)) => {
span_bug!(sp, "enum variant discr was too generic to eval")
}
}
}
}

View file

@ -1,6 +1,6 @@
use rustc_hir::def_id::{CRATE_DEF_ID, LocalDefId};
use rustc_hir::intravisit;
use rustc_middle::hir::nested_filter::OnlyBodies;
use rustc_middle::hir::nested_filter;
use rustc_middle::ty::TyCtxt;
use rustc_span::sym;
@ -42,7 +42,8 @@ pub(crate) fn predicates_and_item_bounds(tcx: TyCtxt<'_>) {
}
pub(crate) fn def_parents(tcx: TyCtxt<'_>) {
for did in tcx.hir().body_owners() {
for iid in tcx.hir().items() {
let did = iid.owner_id.def_id;
if tcx.has_attr(did, sym::rustc_dump_def_parents) {
struct AnonConstFinder<'tcx> {
tcx: TyCtxt<'tcx>,
@ -50,7 +51,7 @@ pub(crate) fn def_parents(tcx: TyCtxt<'_>) {
}
impl<'tcx> intravisit::Visitor<'tcx> for AnonConstFinder<'tcx> {
type NestedFilter = OnlyBodies;
type NestedFilter = nested_filter::All;
fn nested_visit_map(&mut self) -> Self::Map {
self.tcx.hir()
@ -62,11 +63,11 @@ pub(crate) fn def_parents(tcx: TyCtxt<'_>) {
}
}
// Look for any anon consts inside of this body owner as there is no way to apply
// Look for any anon consts inside of this item as there is no way to apply
// the `rustc_dump_def_parents` attribute to the anon const so it would not be possible
// to see what its def parent is.
let mut anon_ct_finder = AnonConstFinder { tcx, anon_consts: vec![] };
intravisit::walk_expr(&mut anon_ct_finder, tcx.hir().body_owned_by(did).value);
intravisit::walk_item(&mut anon_ct_finder, tcx.hir().item(iid));
for did in [did].into_iter().chain(anon_ct_finder.anon_consts) {
let span = tcx.def_span(did);

View file

@ -1,12 +1,13 @@
use std::assert_matches::assert_matches;
use hir::{HirId, Node};
use hir::Node;
use rustc_data_structures::fx::FxIndexSet;
use rustc_hir as hir;
use rustc_hir::def::DefKind;
use rustc_hir::def_id::{DefId, LocalDefId};
use rustc_hir::intravisit::{self, Visitor};
use rustc_middle::ty::{self, GenericPredicates, ImplTraitInTraitData, Ty, TyCtxt, Upcast};
use rustc_middle::ty::{
self, GenericPredicates, ImplTraitInTraitData, Ty, TyCtxt, TypeVisitable, TypeVisitor, Upcast,
};
use rustc_middle::{bug, span_bug};
use rustc_span::symbol::Ident;
use rustc_span::{DUMMY_SP, Span};
@ -305,7 +306,7 @@ fn gather_explicit_predicates_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::Gen
}
if tcx.features().generic_const_exprs() {
predicates.extend(const_evaluatable_predicates_of(tcx, def_id));
predicates.extend(const_evaluatable_predicates_of(tcx, def_id, &predicates));
}
let mut predicates: Vec<_> = predicates.into_iter().collect();
@ -369,32 +370,48 @@ fn compute_bidirectional_outlives_predicates<'tcx>(
}
}
fn const_evaluatable_predicates_of(
tcx: TyCtxt<'_>,
#[instrument(level = "debug", skip(tcx, predicates), ret)]
fn const_evaluatable_predicates_of<'tcx>(
tcx: TyCtxt<'tcx>,
def_id: LocalDefId,
) -> FxIndexSet<(ty::Clause<'_>, Span)> {
predicates: &FxIndexSet<(ty::Clause<'tcx>, Span)>,
) -> FxIndexSet<(ty::Clause<'tcx>, Span)> {
struct ConstCollector<'tcx> {
tcx: TyCtxt<'tcx>,
preds: FxIndexSet<(ty::Clause<'tcx>, Span)>,
}
impl<'tcx> intravisit::Visitor<'tcx> for ConstCollector<'tcx> {
fn visit_anon_const(&mut self, c: &'tcx hir::AnonConst) {
let ct = ty::Const::from_anon_const(self.tcx, c.def_id);
if let ty::ConstKind::Unevaluated(_) = ct.kind() {
let span = self.tcx.def_span(c.def_id);
self.preds.insert((ty::ClauseKind::ConstEvaluatable(ct).upcast(self.tcx), span));
}
}
fn is_const_param_default(tcx: TyCtxt<'_>, def: LocalDefId) -> bool {
let hir_id = tcx.local_def_id_to_hir_id(def);
let (_, parent_node) = tcx
.hir()
.parent_iter(hir_id)
.skip_while(|(_, n)| matches!(n, Node::ConstArg(..)))
.next()
.unwrap();
matches!(
parent_node,
Node::GenericParam(hir::GenericParam { kind: hir::GenericParamKind::Const { .. }, .. })
)
}
fn visit_const_param_default(&mut self, _param: HirId, _ct: &'tcx hir::ConstArg<'tcx>) {
// Do not look into const param defaults,
// these get checked when they are actually instantiated.
//
// We do not want the following to error:
//
// struct Foo<const N: usize, const M: usize = { N + 1 }>;
// struct Bar<const N: usize>(Foo<N, 3>);
impl<'tcx> TypeVisitor<TyCtxt<'tcx>> for ConstCollector<'tcx> {
fn visit_const(&mut self, c: ty::Const<'tcx>) {
if let ty::ConstKind::Unevaluated(uv) = c.kind() {
if is_const_param_default(self.tcx, uv.def.expect_local()) {
// Do not look into const param defaults,
// these get checked when they are actually instantiated.
//
// We do not want the following to error:
//
// struct Foo<const N: usize, const M: usize = { N + 1 }>;
// struct Bar<const N: usize>(Foo<N, 3>);
return;
}
let span = self.tcx.def_span(uv.def);
self.preds.insert((ty::ClauseKind::ConstEvaluatable(c).upcast(self.tcx), span));
}
}
}
@ -402,29 +419,32 @@ fn const_evaluatable_predicates_of(
let node = tcx.hir_node(hir_id);
let mut collector = ConstCollector { tcx, preds: FxIndexSet::default() };
for (clause, _sp) in predicates {
clause.visit_with(&mut collector);
}
if let hir::Node::Item(item) = node
&& let hir::ItemKind::Impl(impl_) = item.kind
&& let hir::ItemKind::Impl(_) = item.kind
{
if let Some(of_trait) = &impl_.of_trait {
debug!("const_evaluatable_predicates_of({:?}): visit impl trait_ref", def_id);
collector.visit_trait_ref(of_trait);
if let Some(of_trait) = tcx.impl_trait_ref(def_id) {
debug!("visit impl trait_ref");
of_trait.instantiate_identity().visit_with(&mut collector);
}
debug!("const_evaluatable_predicates_of({:?}): visit_self_ty", def_id);
collector.visit_ty(impl_.self_ty);
debug!("visit self_ty");
let self_ty = tcx.type_of(def_id);
self_ty.instantiate_identity().visit_with(&mut collector);
}
if let Some(generics) = node.generics() {
debug!("const_evaluatable_predicates_of({:?}): visit_generics", def_id);
collector.visit_generics(generics);
if let Some(_) = tcx.hir().fn_sig_by_hir_id(hir_id) {
debug!("visit fn sig");
let fn_sig = tcx.fn_sig(def_id);
let fn_sig = fn_sig.instantiate_identity();
debug!(?fn_sig);
fn_sig.visit_with(&mut collector);
}
if let Some(fn_sig) = tcx.hir().fn_sig_by_hir_id(hir_id) {
debug!("const_evaluatable_predicates_of({:?}): visit_fn_decl", def_id);
collector.visit_fn_decl(fn_sig.decl);
}
debug!("const_evaluatable_predicates_of({:?}) = {:?}", def_id, collector.preds);
collector.preds
}

View file

@ -703,7 +703,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
///
/// It might actually be possible that we can already support early-bound generic params
/// in such types if we just lifted some more checks in other places, too, for example
/// inside [`ty::Const::from_anon_const`]. However, even if that were the case, we should
/// inside `HirTyLowerer::lower_anon_const`. However, even if that were the case, we should
/// probably gate this behind another feature flag.
///
/// [^1]: <https://github.com/rust-lang/project-const-generics/issues/28>.

View file

@ -2089,7 +2089,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
qpath.span(),
format!("Const::lower_const_arg: invalid qpath {qpath:?}"),
),
hir::ConstArgKind::Anon(anon) => Const::from_anon_const(tcx, anon.def_id),
hir::ConstArgKind::Anon(anon) => self.lower_anon_const(anon.def_id),
hir::ConstArgKind::Infer(span) => self.ct_infer(None, span),
}
}
@ -2177,6 +2177,92 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
}
}
/// Literals and const generic parameters are eagerly converted to a constant, everything else
/// becomes `Unevaluated`.
#[instrument(skip(self), level = "debug")]
fn lower_anon_const(&self, def: LocalDefId) -> Const<'tcx> {
let tcx = self.tcx();
let body_id = match tcx.hir_node_by_def_id(def) {
hir::Node::AnonConst(ac) => ac.body,
node => span_bug!(
tcx.def_span(def.to_def_id()),
"from_anon_const can only process anonymous constants, not {node:?}"
),
};
let expr = &tcx.hir().body(body_id).value;
debug!(?expr);
let ty = tcx.type_of(def).no_bound_vars().expect("const parameter types cannot be generic");
match self.try_lower_anon_const_lit(ty, expr) {
Some(v) => v,
None => ty::Const::new_unevaluated(tcx, ty::UnevaluatedConst {
def: def.to_def_id(),
args: ty::GenericArgs::identity_for_item(tcx, def.to_def_id()),
}),
}
}
#[instrument(skip(self), level = "debug")]
fn try_lower_anon_const_lit(
&self,
ty: Ty<'tcx>,
expr: &'tcx hir::Expr<'tcx>,
) -> Option<Const<'tcx>> {
let tcx = self.tcx();
// Unwrap a block, so that e.g. `{ P }` is recognised as a parameter. Const arguments
// currently have to be wrapped in curly brackets, so it's necessary to special-case.
let expr = match &expr.kind {
hir::ExprKind::Block(block, _) if block.stmts.is_empty() && block.expr.is_some() => {
block.expr.as_ref().unwrap()
}
_ => expr,
};
if let hir::ExprKind::Path(hir::QPath::Resolved(
_,
&hir::Path { res: Res::Def(DefKind::ConstParam, _), .. },
)) = expr.kind
{
span_bug!(
expr.span,
"try_lower_anon_const_lit: received const param which shouldn't be possible"
);
};
let lit_input = match expr.kind {
hir::ExprKind::Lit(lit) => Some(LitToConstInput { lit: &lit.node, ty, neg: false }),
hir::ExprKind::Unary(hir::UnOp::Neg, expr) => match expr.kind {
hir::ExprKind::Lit(lit) => Some(LitToConstInput { lit: &lit.node, ty, neg: true }),
_ => None,
},
_ => None,
};
if let Some(lit_input) = lit_input {
// If an error occurred, ignore that it's a literal and leave reporting the error up to
// mir.
match tcx.at(expr.span).lit_to_const(lit_input) {
Ok(c) => return Some(c),
Err(_) if lit_input.ty.has_aliases() => {
// allow the `ty` to be an alias type, though we cannot handle it here
return None;
}
Err(e) => {
tcx.dcx().span_delayed_bug(
expr.span,
format!("try_lower_anon_const_lit: couldn't lit_to_const {e:?}"),
);
}
}
}
None
}
fn lower_delegation_ty(&self, idx: hir::InferDelegationKind) -> Ty<'tcx> {
let delegation_sig = self.tcx().inherit_sig_for_delegation_item(self.item_def_id());
match idx {

View file

@ -179,7 +179,7 @@ declare_lint! {
Warn,
"applying forbid to lint-groups",
@future_incompatible = FutureIncompatibleInfo {
reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps,
reason: FutureIncompatibilityReason::FutureReleaseErrorReportInDeps,
reference: "issue #81670 <https://github.com/rust-lang/rust/issues/81670>",
};
}

View file

@ -46,7 +46,7 @@ impl ErrorHandled {
pub fn emit_note(&self, tcx: TyCtxt<'_>) {
match self {
&ErrorHandled::Reported(err, span) => {
if !err.is_tainted_by_errors && !span.is_dummy() {
if !err.allowed_in_infallible && !span.is_dummy() {
tcx.dcx().emit_note(error::ErroneousConstant { span });
}
}
@ -58,34 +58,26 @@ impl ErrorHandled {
#[derive(Debug, Copy, Clone, PartialEq, Eq, HashStable, TyEncodable, TyDecodable)]
pub struct ReportedErrorInfo {
error: ErrorGuaranteed,
is_tainted_by_errors: bool,
/// Whether this is the kind of error that can sometimes occur, and sometimes not.
/// Used for resource exhaustion errors.
can_be_spurious: bool,
/// Whether this error is allowed to show up even in otherwise "infallible" promoteds.
/// This is for things like overflows during size computation or resource exhaustion.
allowed_in_infallible: bool,
}
impl ReportedErrorInfo {
#[inline]
pub fn tainted_by_errors(error: ErrorGuaranteed) -> ReportedErrorInfo {
ReportedErrorInfo { is_tainted_by_errors: true, can_be_spurious: false, error }
}
#[inline]
pub fn spurious(error: ErrorGuaranteed) -> ReportedErrorInfo {
ReportedErrorInfo { can_be_spurious: true, is_tainted_by_errors: false, error }
pub fn allowed_in_infallible(error: ErrorGuaranteed) -> ReportedErrorInfo {
ReportedErrorInfo { allowed_in_infallible: true, error }
}
pub fn is_tainted_by_errors(&self) -> bool {
self.is_tainted_by_errors
}
pub fn can_be_spurious(&self) -> bool {
self.can_be_spurious
pub fn is_allowed_in_infallible(&self) -> bool {
self.allowed_in_infallible
}
}
impl From<ErrorGuaranteed> for ReportedErrorInfo {
#[inline]
fn from(error: ErrorGuaranteed) -> ReportedErrorInfo {
ReportedErrorInfo { is_tainted_by_errors: false, can_be_spurious: false, error }
ReportedErrorInfo { allowed_in_infallible: false, error }
}
}

View file

@ -2,15 +2,11 @@ use std::borrow::Cow;
use rustc_data_structures::intern::Interned;
use rustc_error_messages::MultiSpan;
use rustc_hir::def::{DefKind, Res};
use rustc_hir::def_id::LocalDefId;
use rustc_hir::{self as hir};
use rustc_macros::HashStable;
use rustc_type_ir::{self as ir, TypeFlags, WithCachedTypeInfo};
use tracing::{debug, instrument};
use crate::mir::interpret::{LitToConstInput, Scalar};
use crate::ty::{self, GenericArgs, Ty, TyCtxt, TypeVisitableExt};
use crate::mir::interpret::Scalar;
use crate::ty::{self, Ty, TyCtxt};
mod int;
mod kind;
@ -181,82 +177,6 @@ impl<'tcx> rustc_type_ir::inherent::Const<TyCtxt<'tcx>> for Const<'tcx> {
}
impl<'tcx> Const<'tcx> {
// FIXME: move this and try_from_lit to hir_ty_lowering like lower_const_arg/from_const_arg
/// Literals and const generic parameters are eagerly converted to a constant, everything else
/// becomes `Unevaluated`.
#[instrument(skip(tcx), level = "debug")]
pub fn from_anon_const(tcx: TyCtxt<'tcx>, def: LocalDefId) -> Self {
let body_id = match tcx.hir_node_by_def_id(def) {
hir::Node::AnonConst(ac) => ac.body,
node => span_bug!(
tcx.def_span(def.to_def_id()),
"from_anon_const can only process anonymous constants, not {node:?}"
),
};
let expr = &tcx.hir().body(body_id).value;
debug!(?expr);
let ty = tcx.type_of(def).no_bound_vars().expect("const parameter types cannot be generic");
match Self::try_from_lit(tcx, ty, expr) {
Some(v) => v,
None => ty::Const::new_unevaluated(tcx, ty::UnevaluatedConst {
def: def.to_def_id(),
args: GenericArgs::identity_for_item(tcx, def.to_def_id()),
}),
}
}
#[instrument(skip(tcx), level = "debug")]
fn try_from_lit(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>, expr: &'tcx hir::Expr<'tcx>) -> Option<Self> {
// Unwrap a block, so that e.g. `{ P }` is recognised as a parameter. Const arguments
// currently have to be wrapped in curly brackets, so it's necessary to special-case.
let expr = match &expr.kind {
hir::ExprKind::Block(block, _) if block.stmts.is_empty() && block.expr.is_some() => {
block.expr.as_ref().unwrap()
}
_ => expr,
};
if let hir::ExprKind::Path(hir::QPath::Resolved(
_,
&hir::Path { res: Res::Def(DefKind::ConstParam, _), .. },
)) = expr.kind
{
span_bug!(expr.span, "try_from_lit: received const param which shouldn't be possible");
};
let lit_input = match expr.kind {
hir::ExprKind::Lit(lit) => Some(LitToConstInput { lit: &lit.node, ty, neg: false }),
hir::ExprKind::Unary(hir::UnOp::Neg, expr) => match expr.kind {
hir::ExprKind::Lit(lit) => Some(LitToConstInput { lit: &lit.node, ty, neg: true }),
_ => None,
},
_ => None,
};
if let Some(lit_input) = lit_input {
// If an error occurred, ignore that it's a literal and leave reporting the error up to
// mir.
match tcx.at(expr.span).lit_to_const(lit_input) {
Ok(c) => return Some(c),
Err(_) if lit_input.ty.has_aliases() => {
// allow the `ty` to be an alias type, though we cannot handle it here
return None;
}
Err(e) => {
tcx.dcx().span_delayed_bug(
expr.span,
format!("Const::try_from_lit: couldn't lit_to_const {e:?}"),
);
}
}
}
None
}
/// Creates a constant with the given integer value and interns it.
#[inline]
pub fn from_bits(

View file

@ -15,7 +15,6 @@ pub enum ResultsHandle<'a, 'tcx, A>
where
A: Analysis<'tcx>,
{
Borrowed(&'a Results<'tcx, A>),
BorrowedMut(&'a mut Results<'tcx, A>),
Owned(Results<'tcx, A>),
}
@ -28,7 +27,6 @@ where
fn deref(&self) -> &Results<'tcx, A> {
match self {
ResultsHandle::Borrowed(borrowed) => borrowed,
ResultsHandle::BorrowedMut(borrowed) => borrowed,
ResultsHandle::Owned(owned) => owned,
}
@ -41,9 +39,6 @@ where
{
fn deref_mut(&mut self) -> &mut Results<'tcx, A> {
match self {
ResultsHandle::Borrowed(_borrowed) => {
panic!("tried to deref_mut a `ResultsHandle::Borrowed")
}
ResultsHandle::BorrowedMut(borrowed) => borrowed,
ResultsHandle::Owned(owned) => owned,
}

View file

@ -47,7 +47,7 @@ where
{
pub(crate) fn new(
body: &'mir Body<'tcx>,
results: &'mir Results<'tcx, A>,
results: &'mir mut Results<'tcx, A>,
style: OutputStyle,
) -> Self {
let reachable = mir::traversal::reachable_as_bitset(body);

View file

@ -281,10 +281,10 @@ pub trait Analysis<'tcx> {
);
}
let results = Results { analysis: self, entry_sets };
let mut results = Results { analysis: self, entry_sets };
if tcx.sess.opts.unstable_opts.dump_mir_dataflow {
let res = write_graphviz_results(tcx, body, &results, pass_name);
let res = write_graphviz_results(tcx, body, &mut results, pass_name);
if let Err(e) = res {
error!("Failed to write graphviz dataflow results: {}", e);
}

View file

@ -37,18 +37,9 @@ impl<'tcx, A> Results<'tcx, A>
where
A: Analysis<'tcx>,
{
/// Creates a `ResultsCursor` that can inspect these `Results`. Immutably borrows the `Results`,
/// which is appropriate when the `Results` is used outside the cursor.
/// Creates a `ResultsCursor` that mutably borrows the `Results`, which is appropriate when the
/// `Results` is also used outside the cursor.
pub fn as_results_cursor<'mir>(
&'mir self,
body: &'mir mir::Body<'tcx>,
) -> ResultsCursor<'mir, 'tcx, A> {
ResultsCursor::new(body, ResultsHandle::Borrowed(self))
}
/// Creates a `ResultsCursor` that can mutate these `Results`. Mutably borrows the `Results`,
/// which is appropriate when the `Results` is used outside the cursor.
pub fn as_results_cursor_mut<'mir>(
&'mir mut self,
body: &'mir mir::Body<'tcx>,
) -> ResultsCursor<'mir, 'tcx, A> {
@ -95,7 +86,7 @@ where
pub(super) fn write_graphviz_results<'tcx, A>(
tcx: TyCtxt<'tcx>,
body: &mir::Body<'tcx>,
results: &Results<'tcx, A>,
results: &mut Results<'tcx, A>,
pass_name: Option<&'static str>,
) -> std::io::Result<()>
where

View file

@ -680,7 +680,7 @@ fn locals_live_across_suspend_points<'tcx>(
let mut requires_storage_results =
MaybeRequiresStorage::new(borrowed_locals_results.into_results_cursor(body))
.iterate_to_fixpoint(tcx, body, None);
let mut requires_storage_cursor = requires_storage_results.as_results_cursor_mut(body);
let mut requires_storage_cursor = requires_storage_results.as_results_cursor(body);
// Calculate the liveness of MIR locals ignoring borrows.
let mut liveness =

View file

@ -1376,7 +1376,7 @@ impl<'a> Parser<'a> {
AttrArgs::Delimited(args)
} else if self.eat(&token::Eq) {
let eq_span = self.prev_token.span;
AttrArgs::Eq(eq_span, AttrArgsEq::Ast(self.parse_expr_force_collect()?))
AttrArgs::Eq { eq_span, value: AttrArgsEq::Ast(self.parse_expr_force_collect()?) }
} else {
AttrArgs::Empty
})

View file

@ -43,7 +43,7 @@ pub fn check_attr(psess: &ParseSess, attr: &Attribute) {
}
}
_ => {
if let AttrArgs::Eq(..) = attr_item.args {
if let AttrArgs::Eq { .. } = attr_item.args {
// All key-value attributes are restricted to meta-item syntax.
match parse_meta(psess, attr) {
Ok(_) => {}
@ -70,7 +70,7 @@ pub fn parse_meta<'a>(psess: &'a ParseSess, attr: &Attribute) -> PResult<'a, Met
parse_in(psess, tokens.clone(), "meta list", |p| p.parse_meta_seq_top())?;
MetaItemKind::List(nmis)
}
AttrArgs::Eq(_, AttrArgsEq::Ast(expr)) => {
AttrArgs::Eq { value: AttrArgsEq::Ast(expr), .. } => {
if let ast::ExprKind::Lit(token_lit) = expr.kind {
let res = ast::MetaItemLit::from_token_lit(token_lit, expr.span);
let res = match res {
@ -116,7 +116,9 @@ pub fn parse_meta<'a>(psess: &'a ParseSess, attr: &Attribute) -> PResult<'a, Met
return Err(err);
}
}
AttrArgs::Eq(_, AttrArgsEq::Hir(lit)) => MetaItemKind::NameValue(lit.clone()),
AttrArgs::Eq { value: AttrArgsEq::Hir(lit), .. } => {
MetaItemKind::NameValue(lit.clone())
}
},
})
}

View file

@ -220,9 +220,9 @@ pub fn attrs_to_doc_fragments<'a>(
fn span_for_value(attr: &ast::Attribute) -> Span {
if let ast::AttrKind::Normal(normal) = &attr.kind
&& let ast::AttrArgs::Eq(_, ast::AttrArgsEq::Hir(meta)) = &normal.item.args
&& let ast::AttrArgs::Eq { value, .. } = &normal.item.args
{
meta.span.with_ctxt(attr.span.ctxt())
value.span().with_ctxt(attr.span.ctxt())
} else {
attr.span
}

View file

@ -1,7 +1,7 @@
use std::iter;
use std::path::PathBuf;
use rustc_ast::{AttrArgs, AttrArgsEq, AttrKind, Attribute, MetaItemInner};
use rustc_ast::{AttrArgs, AttrKind, Attribute, MetaItemInner};
use rustc_data_structures::fx::FxHashMap;
use rustc_errors::codes::*;
use rustc_errors::{ErrorGuaranteed, struct_span_code_err};
@ -639,8 +639,7 @@ impl<'tcx> OnUnimplementedDirective {
let report_span = match &item.args {
AttrArgs::Empty => item.path.span,
AttrArgs::Delimited(args) => args.dspan.entire(),
AttrArgs::Eq(eq_span, AttrArgsEq::Ast(expr)) => eq_span.to(expr.span),
AttrArgs::Eq(span, AttrArgsEq::Hir(expr)) => span.to(expr.span),
AttrArgs::Eq { eq_span, value } => eq_span.to(value.span()),
};
if let Some(item_def_id) = item_def_id.as_local() {

View file

@ -384,7 +384,7 @@ impl CString {
/// fn some_extern_function(s: *mut c_char);
/// }
///
/// let c_string = CString::new("Hello!").expect("CString::new failed");
/// let c_string = CString::from(c"Hello!");
/// let raw = c_string.into_raw();
/// unsafe {
/// some_extern_function(raw);
@ -429,7 +429,7 @@ impl CString {
/// ```
/// use std::ffi::CString;
///
/// let c_string = CString::new("foo").expect("CString::new failed");
/// let c_string = CString::from(c"foo");
///
/// let ptr = c_string.into_raw();
///
@ -487,7 +487,7 @@ impl CString {
/// ```
/// use std::ffi::CString;
///
/// let c_string = CString::new("foo").expect("CString::new failed");
/// let c_string = CString::from(c"foo");
/// let bytes = c_string.into_bytes();
/// assert_eq!(bytes, vec![b'f', b'o', b'o']);
/// ```
@ -508,7 +508,7 @@ impl CString {
/// ```
/// use std::ffi::CString;
///
/// let c_string = CString::new("foo").expect("CString::new failed");
/// let c_string = CString::from(c"foo");
/// let bytes = c_string.into_bytes_with_nul();
/// assert_eq!(bytes, vec![b'f', b'o', b'o', b'\0']);
/// ```
@ -530,7 +530,7 @@ impl CString {
/// ```
/// use std::ffi::CString;
///
/// let c_string = CString::new("foo").expect("CString::new failed");
/// let c_string = CString::from(c"foo");
/// let bytes = c_string.as_bytes();
/// assert_eq!(bytes, &[b'f', b'o', b'o']);
/// ```
@ -550,7 +550,7 @@ impl CString {
/// ```
/// use std::ffi::CString;
///
/// let c_string = CString::new("foo").expect("CString::new failed");
/// let c_string = CString::from(c"foo");
/// let bytes = c_string.as_bytes_with_nul();
/// assert_eq!(bytes, &[b'f', b'o', b'o', b'\0']);
/// ```
@ -568,7 +568,7 @@ impl CString {
/// ```
/// use std::ffi::{CString, CStr};
///
/// let c_string = CString::new(b"foo".to_vec()).expect("CString::new failed");
/// let c_string = CString::from(c"foo");
/// let cstr = c_string.as_c_str();
/// assert_eq!(cstr,
/// CStr::from_bytes_with_nul(b"foo\0").expect("CStr::from_bytes_with_nul failed"));
@ -586,12 +586,9 @@ impl CString {
/// # Examples
///
/// ```
/// use std::ffi::{CString, CStr};
///
/// let c_string = CString::new(b"foo".to_vec()).expect("CString::new failed");
/// let c_string = c"foo".to_owned();
/// let boxed = c_string.into_boxed_c_str();
/// assert_eq!(&*boxed,
/// CStr::from_bytes_with_nul(b"foo\0").expect("CStr::from_bytes_with_nul failed"));
/// assert_eq!(boxed.to_bytes_with_nul(), b"foo\0");
/// ```
#[must_use = "`self` will be dropped if the result is not used"]
#[stable(feature = "into_boxed_c_str", since = "1.20.0")]
@ -658,7 +655,7 @@ impl CString {
/// assert_eq!(
/// CString::from_vec_with_nul(b"abc\0".to_vec())
/// .expect("CString::from_vec_with_nul failed"),
/// CString::new(b"abc".to_vec()).expect("CString::new failed")
/// c"abc".to_owned()
/// );
/// ```
///
@ -1168,11 +1165,12 @@ impl CStr {
/// # Examples
///
/// ```
/// use std::ffi::CString;
/// use std::ffi::{CStr, CString};
///
/// let c_string = CString::new(b"foo".to_vec()).expect("CString::new failed");
/// let boxed = c_string.into_boxed_c_str();
/// assert_eq!(boxed.into_c_string(), CString::new("foo").expect("CString::new failed"));
/// let boxed: Box<CStr> = Box::from(c"foo");
/// let c_string: CString = c"foo".to_owned();
///
/// assert_eq!(boxed.into_c_string(), c_string);
/// ```
#[rustc_allow_incoherent_impl]
#[must_use = "`self` will be dropped if the result is not used"]

View file

@ -159,7 +159,7 @@ fn boxed_default() {
#[test]
fn test_c_str_clone_into() {
let mut c_string = CString::new("lorem").unwrap();
let mut c_string = c"lorem".to_owned();
let c_ptr = c_string.as_ptr();
let c_str = CStr::from_bytes_with_nul(b"ipsum\0").unwrap();
c_str.clone_into(&mut c_string);

View file

@ -349,9 +349,9 @@ fn test_unsized() {
#[test]
fn test_maybe_thin_unsized() {
// If/when custom thin DSTs exist, this test should be updated to use one
use std::ffi::{CStr, CString};
use std::ffi::CStr;
let x: Rc<CStr> = Rc::from(CString::new("swordfish").unwrap().into_boxed_c_str());
let x: Rc<CStr> = Rc::from(c"swordfish");
assert_eq!(format!("{x:?}"), "\"swordfish\"");
let y: Weak<CStr> = Rc::downgrade(&x);
drop(x);

View file

@ -412,9 +412,9 @@ fn test_unsized() {
#[test]
fn test_maybe_thin_unsized() {
// If/when custom thin DSTs exist, this test should be updated to use one
use std::ffi::{CStr, CString};
use std::ffi::CStr;
let x: Arc<CStr> = Arc::from(CString::new("swordfish").unwrap().into_boxed_c_str());
let x: Arc<CStr> = Arc::from(c"swordfish");
assert_eq!(format!("{x:?}"), "\"swordfish\"");
let y: Weak<CStr> = Arc::downgrade(&x);
drop(x);

View file

@ -485,9 +485,9 @@ impl<T> MaybeUninit<T> {
/// }
/// }
/// ```
#[stable(feature = "maybe_uninit_write", since = "1.55.0")]
#[rustc_const_unstable(feature = "const_maybe_uninit_write", issue = "63567")]
#[inline(always)]
#[stable(feature = "maybe_uninit_write", since = "1.55.0")]
#[rustc_const_stable(feature = "const_maybe_uninit_write", since = "CURRENT_RUSTC_VERSION")]
pub const fn write(&mut self, val: T) -> &mut T {
*self = MaybeUninit::new(val);
// SAFETY: We just initialized this value.

View file

@ -803,7 +803,7 @@ impl f16 {
/// ```
#[inline]
#[unstable(feature = "f16", issue = "116909")]
#[rustc_const_unstable(feature = "f128", issue = "116909")]
#[rustc_const_unstable(feature = "f16", issue = "116909")]
pub const fn midpoint(self, other: f16) -> f16 {
const LO: f16 = f16::MIN_POSITIVE * 2.;
const HI: f16 = f16::MAX / 2.;

View file

@ -393,7 +393,7 @@ impl Command {
fn os2c(s: &OsStr, saw_nul: &mut bool) -> CString {
CString::new(s.as_bytes()).unwrap_or_else(|_e| {
*saw_nul = true;
CString::new("<string-with-nul>").unwrap()
c"<string-with-nul>".to_owned()
})
}

View file

@ -2505,6 +2505,7 @@ impl Config {
// Check the config compatibility
// FIXME: this doesn't cover `--set` flags yet.
let res = check_incompatible_options_for_ci_rustc(
self.build,
current_config_toml,
ci_config_toml,
);
@ -3086,17 +3087,18 @@ pub(crate) fn check_incompatible_options_for_ci_llvm(
/// Compares the current Rust options against those in the CI rustc builder and detects any incompatible options.
/// It does this by destructuring the `Rust` instance to make sure every `Rust` field is covered and not missing.
fn check_incompatible_options_for_ci_rustc(
host: TargetSelection,
current_config_toml: TomlConfig,
ci_config_toml: TomlConfig,
) -> Result<(), String> {
macro_rules! err {
($current:expr, $expected:expr) => {
($current:expr, $expected:expr, $config_section:expr) => {
if let Some(current) = &$current {
if Some(current) != $expected.as_ref() {
return Err(format!(
"ERROR: Setting `rust.{}` is incompatible with `rust.download-rustc`. \
"ERROR: Setting `{}` is incompatible with `rust.download-rustc`. \
Current value: {:?}, Expected value(s): {}{:?}",
stringify!($expected).replace("_", "-"),
format!("{}.{}", $config_section, stringify!($expected).replace("_", "-")),
$current,
if $expected.is_some() { "None/" } else { "" },
$expected,
@ -3107,13 +3109,13 @@ fn check_incompatible_options_for_ci_rustc(
}
macro_rules! warn {
($current:expr, $expected:expr) => {
($current:expr, $expected:expr, $config_section:expr) => {
if let Some(current) = &$current {
if Some(current) != $expected.as_ref() {
println!(
"WARNING: `rust.{}` has no effect with `rust.download-rustc`. \
"WARNING: `{}` has no effect with `rust.download-rustc`. \
Current value: {:?}, Expected value(s): {}{:?}",
stringify!($expected).replace("_", "-"),
format!("{}.{}", $config_section, stringify!($expected).replace("_", "-")),
$current,
if $expected.is_some() { "None/" } else { "" },
$expected,
@ -3123,6 +3125,31 @@ fn check_incompatible_options_for_ci_rustc(
};
}
let current_profiler = current_config_toml.build.as_ref().and_then(|b| b.profiler);
let profiler = ci_config_toml.build.as_ref().and_then(|b| b.profiler);
err!(current_profiler, profiler, "build");
let current_optimized_compiler_builtins =
current_config_toml.build.as_ref().and_then(|b| b.optimized_compiler_builtins);
let optimized_compiler_builtins =
ci_config_toml.build.as_ref().and_then(|b| b.optimized_compiler_builtins);
err!(current_optimized_compiler_builtins, optimized_compiler_builtins, "build");
// We always build the in-tree compiler on cross targets, so we only care
// about the host target here.
let host_str = host.to_string();
if let Some(current_cfg) = current_config_toml.target.as_ref().and_then(|c| c.get(&host_str)) {
if current_cfg.profiler.is_some() {
let ci_target_toml = ci_config_toml.target.as_ref().and_then(|c| c.get(&host_str));
let ci_cfg = ci_target_toml.ok_or(format!(
"Target specific config for '{host_str}' is not present for CI-rustc"
))?;
let profiler = &ci_cfg.profiler;
err!(current_cfg.profiler, profiler, "build");
}
}
let (Some(current_rust_config), Some(ci_rust_config)) =
(current_config_toml.rust, ci_config_toml.rust)
else {
@ -3196,24 +3223,24 @@ fn check_incompatible_options_for_ci_rustc(
// If the option belongs to the first category, we call `err` macro for a hard error;
// otherwise, we just print a warning with `warn` macro.
err!(current_rust_config.optimize, optimize);
err!(current_rust_config.randomize_layout, randomize_layout);
err!(current_rust_config.debug_logging, debug_logging);
err!(current_rust_config.debuginfo_level_rustc, debuginfo_level_rustc);
err!(current_rust_config.rpath, rpath);
err!(current_rust_config.strip, strip);
err!(current_rust_config.lld_mode, lld_mode);
err!(current_rust_config.llvm_tools, llvm_tools);
err!(current_rust_config.llvm_bitcode_linker, llvm_bitcode_linker);
err!(current_rust_config.jemalloc, jemalloc);
err!(current_rust_config.default_linker, default_linker);
err!(current_rust_config.stack_protector, stack_protector);
err!(current_rust_config.lto, lto);
err!(current_rust_config.std_features, std_features);
err!(current_rust_config.optimize, optimize, "rust");
err!(current_rust_config.randomize_layout, randomize_layout, "rust");
err!(current_rust_config.debug_logging, debug_logging, "rust");
err!(current_rust_config.debuginfo_level_rustc, debuginfo_level_rustc, "rust");
err!(current_rust_config.rpath, rpath, "rust");
err!(current_rust_config.strip, strip, "rust");
err!(current_rust_config.lld_mode, lld_mode, "rust");
err!(current_rust_config.llvm_tools, llvm_tools, "rust");
err!(current_rust_config.llvm_bitcode_linker, llvm_bitcode_linker, "rust");
err!(current_rust_config.jemalloc, jemalloc, "rust");
err!(current_rust_config.default_linker, default_linker, "rust");
err!(current_rust_config.stack_protector, stack_protector, "rust");
err!(current_rust_config.lto, lto, "rust");
err!(current_rust_config.std_features, std_features, "rust");
warn!(current_rust_config.channel, channel);
warn!(current_rust_config.description, description);
warn!(current_rust_config.incremental, incremental);
warn!(current_rust_config.channel, channel, "rust");
warn!(current_rust_config.description, description, "rust");
warn!(current_rust_config.incremental, incremental, "rust");
Ok(())
}

View file

@ -2647,7 +2647,7 @@ fn filter_doc_attr(normal: &mut ast::NormalAttr, is_inline: bool) {
});
args.tokens = TokenStream::new(tokens);
}
ast::AttrArgs::Empty | ast::AttrArgs::Eq(..) => {}
ast::AttrArgs::Empty | ast::AttrArgs::Eq { .. } => {}
}
}

View file

@ -9,7 +9,7 @@ use rustc_span::sym;
pub(super) fn check(cx: &EarlyContext<'_>, attr: &Attribute) {
if let AttrKind::Normal(normal_attr) = &attr.kind {
if let AttrArgs::Eq(_, AttrArgsEq::Ast(_)) = &normal_attr.item.args {
if let AttrArgs::Eq { value: AttrArgsEq::Ast(_), .. } = &normal_attr.item.args {
// `#[should_panic = ".."]` found, good
return;
}

View file

@ -12,7 +12,7 @@ pub fn check(cx: &LateContext<'_>, attrs: &[Attribute]) {
if !attr.span.from_expansion()
&& let AttrKind::Normal(ref normal) = attr.kind
&& normal.item.path == sym::doc
&& let AttrArgs::Eq(_, AttrArgsEq::Hir(ref meta)) = normal.item.args
&& let AttrArgs::Eq { value: AttrArgsEq::Hir(ref meta), .. } = normal.item.args
&& !attr.span.contains(meta.span)
// Since the `include_str` is already expanded at this point, we can only take the
// whole attribute snippet and then modify for our suggestion.

View file

@ -96,7 +96,7 @@ impl LateLintPass<'_> for LargeIncludeFile {
&& let AttrKind::Normal(ref normal) = attr.kind
&& let Some(doc) = attr.doc_str()
&& doc.as_str().len() as u64 > self.max_file_size
&& let AttrArgs::Eq(_, AttrArgsEq::Hir(ref meta)) = normal.item.args
&& let AttrArgs::Eq { value: AttrArgsEq::Hir(ref meta), .. } = normal.item.args
&& !attr.span.contains(meta.span)
// Since the `include_str` is already expanded at this point, we can only take the
// whole attribute snippet and then modify for our suggestion.

View file

@ -872,8 +872,8 @@ pub fn eq_attr_args(l: &AttrArgs, r: &AttrArgs) -> bool {
match (l, r) {
(Empty, Empty) => true,
(Delimited(la), Delimited(ra)) => eq_delim_args(la, ra),
(Eq(_, AttrArgsEq::Ast(le)), Eq(_, AttrArgsEq::Ast(re))) => eq_expr(le, re),
(Eq(_, AttrArgsEq::Hir(ll)), Eq(_, AttrArgsEq::Hir(rl))) => ll.kind == rl.kind,
(Eq { value: AttrArgsEq::Ast(le), .. }, Eq{ value: AttrArgsEq::Ast(re), .. }) => eq_expr(le, re),
(Eq { value: AttrArgsEq::Hir(ll), .. }, Eq{ value: AttrArgsEq::Hir(rl), .. }) => ll.kind == rl.kind,
_ => false,
}
}

View file

@ -1125,6 +1125,8 @@ fn parse_normalize_rule(header: &str) -> Option<(String, String)> {
.captures(header)?;
let regex = captures["regex"].to_owned();
let replacement = captures["replacement"].to_owned();
// FIXME: Support escaped new-line in strings.
let replacement = replacement.replace("\\n", "\n");
Some((regex, replacement))
}

View file

@ -47,9 +47,8 @@ fn test_readlink() {
assert_eq!(res, small_buf.len() as isize);
// Test that we report a proper error for a missing path.
let bad_path = CString::new("MIRI_MISSING_FILE_NAME").unwrap();
let res = unsafe {
libc::readlink(bad_path.as_ptr(), small_buf.as_mut_ptr().cast(), small_buf.len())
libc::readlink(c"MIRI_MISSING_FILE_NAME".as_ptr(), small_buf.as_mut_ptr().cast(), small_buf.len())
};
assert_eq!(res, -1);
assert_eq!(Error::last_os_error().kind(), ErrorKind::NotFound);

View file

@ -2,7 +2,6 @@
//@compile-flags: -Zmiri-isolation-error=warn-nobacktrace
//@normalize-stderr-test: "(stat(x)?)" -> "$$STAT"
use std::ffi::CString;
use std::fs;
use std::io::{Error, ErrorKind};
@ -13,10 +12,9 @@ fn main() {
}
// test `readlink`
let symlink_c_str = CString::new("foo.txt").unwrap();
let mut buf = vec![0; "foo_link.txt".len() + 1];
unsafe {
assert_eq!(libc::readlink(symlink_c_str.as_ptr(), buf.as_mut_ptr(), buf.len()), -1);
assert_eq!(libc::readlink(c"foo.txt".as_ptr(), buf.as_mut_ptr(), buf.len()), -1);
assert_eq!(Error::last_os_error().raw_os_error(), Some(libc::EACCES));
}

View file

@ -55,12 +55,12 @@ fn test_memcpy() {
}
fn test_strcpy() {
use std::ffi::{CStr, CString};
use std::ffi::CStr;
// case: src_size equals dest_size
unsafe {
let src = CString::new("rust").unwrap();
let size = src.as_bytes_with_nul().len();
let src = c"rust";
let size = src.to_bytes_with_nul().len();
let dest = libc::malloc(size);
libc::strcpy(dest as *mut libc::c_char, src.as_ptr());
assert_eq!(CStr::from_ptr(dest as *const libc::c_char), src.as_ref());
@ -69,8 +69,8 @@ fn test_strcpy() {
// case: src_size is less than dest_size
unsafe {
let src = CString::new("rust").unwrap();
let size = src.as_bytes_with_nul().len();
let src = c"rust";
let size = src.to_bytes_with_nul().len();
let dest = libc::malloc(size + 1);
libc::strcpy(dest as *mut libc::c_char, src.as_ptr());
assert_eq!(CStr::from_ptr(dest as *const libc::c_char), src.as_ref());

View file

@ -62,15 +62,13 @@ fn memusage_linux() -> MemoryUsage {
// mallinfo2 is very recent, so its presence needs to be detected at runtime.
// Both are abysmally slow.
use std::ffi::CStr;
use std::sync::atomic::{AtomicUsize, Ordering};
static MALLINFO2: AtomicUsize = AtomicUsize::new(1);
let mut mallinfo2 = MALLINFO2.load(Ordering::Relaxed);
if mallinfo2 == 1 {
let cstr = CStr::from_bytes_with_nul(b"mallinfo2\0").unwrap();
mallinfo2 = unsafe { libc::dlsym(libc::RTLD_DEFAULT, cstr.as_ptr()) } as usize;
mallinfo2 = unsafe { libc::dlsym(libc::RTLD_DEFAULT, c"mallinfo2".as_ptr()) } as usize;
// NB: races don't matter here, since they'll always store the same value
MALLINFO2.store(mallinfo2, Ordering::Relaxed);
}

View file

@ -1,13 +1,10 @@
//@ known-bug: #121429
#![feature(generic_const_exprs)]
pub trait True {}
impl<const N: usize = { const { 3 } }> PartialEq<FixedI8<FRAC_RHS>> for FixedI8<FRAC_LHS> where
If<{}>: True
{
}
#![feature(generic_const_exprs)]
struct FixedI8<const X: usize>;
const FRAC_LHS: usize = 0;
const FRAC_RHS: usize = 1;
pub trait True {}

View file

@ -1,4 +0,0 @@
//@ known-bug: rust-lang/rust#125476
//@ only-x86_64
pub struct Data([u8; usize::MAX >> 2]);
const _: &'static [Data] = &[];

View file

@ -0,0 +1,6 @@
digraph graph_for_def_id_0_3 {
graph[fontname="Courier, monospace"];
node[fontname="Courier, monospace"];
edge[fontname="Courier, monospace"];
bb_0[label=<<table border="1" cellborder="1" cellspacing="0" cellpadding="3" sides="rb"><tr><td colspan="3" sides="tl">bb0</td></tr><tr><td colspan="2" bgcolor="#a0a0a0" sides="tl">MIR</td><td bgcolor="#a0a0a0" sides="tl">STATE</td></tr><tr><td valign="bottom" sides="tl" align="right"></td><td valign="bottom" sides="tl" align="left">(on start)</td><td colspan="1" valign="bottom" sides="tl" align="left">{}</td></tr><tr><td valign="top" sides="tl" bgcolor="#f0f0f0" align="right">0</td><td valign="top" sides="tl" bgcolor="#f0f0f0" align="left">_0 = const ()</td><td valign="top" sides="tl" bgcolor="#f0f0f0" align="left"><font color="darkgreen">+_0</font></td></tr><tr><td valign="top" sides="tl" align="right">T</td><td valign="top" sides="tl" align="left">return</td><td valign="top" sides="tl" align="left"></td></tr><tr><td valign="bottom" sides="tl" bgcolor="#f0f0f0" align="right"></td><td valign="bottom" sides="tl" bgcolor="#f0f0f0" align="left">(on end)</td><td colspan="1" valign="bottom" sides="tl" bgcolor="#f0f0f0" align="left">{_0}</td></tr></table>>][shape="none"];
}

View file

@ -0,0 +1,6 @@
// skip-filecheck
// Test graphviz dataflow output
//@ compile-flags: -Z dump-mir=main -Z dump-mir-dataflow
// EMIT_MIR dataflow.main.maybe_init.borrowck.dot
fn main() {}

View file

@ -38,7 +38,7 @@ fn main() {
// If the process ID is 0, this is the child process responsible for running the test
// program.
if pid == 0 {
let test = CString::new("test").unwrap();
let test = c"test";
// The argv array should be terminated with a NULL pointer.
let argv = [test.as_ptr(), std::ptr::null()];
// rlim_cur is soft limit, rlim_max is hard limit.

View file

@ -3,16 +3,17 @@
fn bar() {
fn foo() {
#[rustc_dump_def_parents]
fn baz() {
#[rustc_dump_def_parents]
//~^ ERROR: rustc_dump_def_parents: DefId
|| {
//~^ ERROR: rustc_dump_def_parents: DefId
qux::<
{
//~^ ERROR: rustc_dump_def_parents: DefId
fn inhibits_dump() {
qux::<
{
//~^ ERROR: rustc_dump_def_parents: DefId
"hi";
1
},

View file

@ -1,14 +1,9 @@
error: rustc_dump_def_parents: DefId(..)
--> $DIR/dump_def_parents.rs:8:13
|
LL | || {
| ^^
|
note: DefId(..)
--> $DIR/dump_def_parents.rs:6:9
--> $DIR/dump_def_parents.rs:7:9
|
LL | fn baz() {
| ^^^^^^^^
|
note: DefId(..)
--> $DIR/dump_def_parents.rs:5:5
|
@ -44,12 +39,12 @@ LL | | },
| |_____________________^
|
note: DefId(..)
--> $DIR/dump_def_parents.rs:8:13
--> $DIR/dump_def_parents.rs:9:13
|
LL | || {
| ^^
note: DefId(..)
--> $DIR/dump_def_parents.rs:6:9
--> $DIR/dump_def_parents.rs:7:9
|
LL | fn baz() {
| ^^^^^^^^
@ -76,7 +71,65 @@ LL | | fn main() {}
| |____________^
error: rustc_dump_def_parents: DefId(..)
--> $DIR/dump_def_parents.rs:22:31
--> $DIR/dump_def_parents.rs:15:33
|
LL | / ... {
LL | | ...
LL | | ... "hi";
LL | | ... 1
LL | | ... },
| |_______________________^
|
note: DefId(..)
--> $DIR/dump_def_parents.rs:13:25
|
LL | fn inhibits_dump() {
| ^^^^^^^^^^^^^^^^^^
note: DefId(..)
--> $DIR/dump_def_parents.rs:11:21
|
LL | / {
LL | |
LL | | fn inhibits_dump() {
LL | | qux::<
... |
LL | | 1
LL | | },
| |_____________________^
note: DefId(..)
--> $DIR/dump_def_parents.rs:9:13
|
LL | || {
| ^^
note: DefId(..)
--> $DIR/dump_def_parents.rs:7:9
|
LL | fn baz() {
| ^^^^^^^^
note: DefId(..)
--> $DIR/dump_def_parents.rs:5:5
|
LL | fn foo() {
| ^^^^^^^^
note: DefId(..)
--> $DIR/dump_def_parents.rs:4:1
|
LL | fn bar() {
| ^^^^^^^^
note: DefId(..)
--> $DIR/dump_def_parents.rs:2:1
|
LL | / #![feature(rustc_attrs)]
LL | |
LL | | fn bar() {
LL | | fn foo() {
... |
LL | |
LL | | fn main() {}
| |____________^
error: rustc_dump_def_parents: DefId(..)
--> $DIR/dump_def_parents.rs:23:31
|
LL | qux::<{ 1 + 1 }>();
| ^^^^^^^^^
@ -93,12 +146,12 @@ LL | | 1
LL | | },
| |_____________________^
note: DefId(..)
--> $DIR/dump_def_parents.rs:8:13
--> $DIR/dump_def_parents.rs:9:13
|
LL | || {
| ^^
note: DefId(..)
--> $DIR/dump_def_parents.rs:6:9
--> $DIR/dump_def_parents.rs:7:9
|
LL | fn baz() {
| ^^^^^^^^
@ -124,5 +177,5 @@ LL | |
LL | | fn main() {}
| |____________^
error: aborting due to 3 previous errors
error: aborting due to 4 previous errors

View file

@ -0,0 +1,13 @@
// This test makes sure that we don't emit a long list of possible values
// but that we stop at a fix point and say "and X more".
//
//@ check-pass
//@ no-auto-check-cfg
//@ compile-flags: --check-cfg=cfg()
//@ normalize-stderr-test: "and \d+ more" -> "and X more"
//@ normalize-stderr-test: "`[a-zA-Z0-9_-]+`" -> "`xxx`"
fn main() {
cfg!(target_feature = "zebra");
//~^ WARNING unexpected `cfg` condition value
}

View file

@ -0,0 +1,12 @@
warning: unexpected `xxx` condition value: `xxx`
--> $DIR/and-more-diagnostic.rs:11:10
|
LL | cfg!(target_feature = "zebra");
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: expected values for `xxx` are: `xxx`, `xxx`, `xxx`, `xxx`, `xxx`, `xxx`, `xxx`, `xxx`, `xxx`, `xxx`, `xxx`, `xxx`, `xxx`, `xxx`, `xxx`, `xxx`, `xxx`, `xxx`, `xxx`, `xxx`, `xxx`, `xxx`, `xxx`, `xxx`, `xxx`, `xxx`, `xxx`, `xxx`, `xxx`, `xxx`, `xxx`, `xxx`, `xxx`, `xxx`, and `xxx` and X more
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration
= note: `#[warn(unexpected_cfgs)]` on by default
warning: 1 warning emitted

View file

@ -75,8 +75,6 @@ fn test_cfg_macro() {
//~^ WARNING unexpected `cfg` condition value
//~| WARNING unexpected `cfg` condition value
//~| WARNING unexpected `cfg` condition value
cfg!(target_feature = "zebra");
//~^ WARNING unexpected `cfg` condition value
}
fn main() {}

View file

@ -245,14 +245,5 @@ LL | cfg!(all(feature = "zebra", feature = "zebra", feature = "zebra"));
= help: to expect this configuration use `--check-cfg=cfg(feature, values("zebra"))`
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration
warning: unexpected `cfg` condition value: `zebra`
--> $DIR/mix.rs:78:10
|
LL | cfg!(target_feature = "zebra");
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: expected values for `target_feature` are: `10e60`, `2e3`, `3e3r1`, `3e3r2`, `3e3r3`, `3e7`, `7e10`, `a`, `aclass`, `adx`, `aes`, `altivec`, `alu32`, `amx-bf16`, `amx-complex`, `amx-fp16`, `amx-int8`, `amx-tile`, `atomics`, `avx`, `avx2`, `avx512bf16`, `avx512bitalg`, `avx512bw`, `avx512cd`, `avx512dq`, `avx512f`, `avx512fp16`, `avx512ifma`, `avx512vbmi`, `avx512vbmi2`, `avx512vl`, `avx512vnni`, `avx512vp2intersect`, and `avx512vpopcntdq` and 252 more
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration
warning: 27 warnings emitted
warning: 26 warnings emitted

View file

@ -0,0 +1,18 @@
// This test prints all the possible values for the `target_feature` cfg
// as a way to assert the expected values and reflect on any changes made
// to the `target_feature` cfg in the compiler.
//
// The output of this test does not reflect the actual output seen by
// users which will see a truncated list of possible values (at worst).
//
// In case of test output differences, just `--bless` the test.
//
//@ check-pass
//@ no-auto-check-cfg
//@ compile-flags: --check-cfg=cfg() -Zcheck-cfg-all-expected
//@ normalize-stderr-test: "`, `" -> "`\n`"
fn main() {
cfg!(target_feature = "_UNEXPECTED_VALUE");
//~^ WARNING unexpected `cfg` condition value
}

View file

@ -0,0 +1,297 @@
warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE`
--> $DIR/target_feature.rs:16:10
|
LL | cfg!(target_feature = "_UNEXPECTED_VALUE");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: expected values for `target_feature` are: `10e60`
`2e3`
`3e3r1`
`3e3r2`
`3e3r3`
`3e7`
`7e10`
`a`
`aclass`
`adx`
`aes`
`altivec`
`alu32`
`amx-bf16`
`amx-complex`
`amx-fp16`
`amx-int8`
`amx-tile`
`atomics`
`avx`
`avx2`
`avx512bf16`
`avx512bitalg`
`avx512bw`
`avx512cd`
`avx512dq`
`avx512f`
`avx512fp16`
`avx512ifma`
`avx512vbmi`
`avx512vbmi2`
`avx512vl`
`avx512vnni`
`avx512vp2intersect`
`avx512vpopcntdq`
`avxifma`
`avxneconvert`
`avxvnni`
`avxvnniint16`
`avxvnniint8`
`backchain`
`bf16`
`bmi1`
`bmi2`
`bti`
`bulk-memory`
`c`
`cache`
`cmpxchg16b`
`crc`
`crt-static`
`cssc`
`d`
`d32`
`dit`
`doloop`
`dotprod`
`dpb`
`dpb2`
`dsp`
`dsp1e2`
`dspe60`
`e`
`e1`
`e2`
`ecv`
`edsp`
`elrw`
`ermsb`
`exception-handling`
`extended-const`
`f`
`f16c`
`f32mm`
`f64mm`
`faminmax`
`fcma`
`fdivdu`
`fhm`
`flagm`
`flagm2`
`float1e2`
`float1e3`
`float3e4`
`float7e60`
`floate1`
`fma`
`fp-armv8`
`fp16`
`fp64`
`fp8`
`fp8dot2`
`fp8dot4`
`fp8fma`
`fpuv2_df`
`fpuv2_sf`
`fpuv3_df`
`fpuv3_hf`
`fpuv3_hi`
`fpuv3_sf`
`frecipe`
`frintts`
`fxsr`
`gfni`
`hard-float`
`hard-float-abi`
`hard-tp`
`hbc`
`high-registers`
`hvx`
`hvx-length128b`
`hwdiv`
`i8mm`
`jsconv`
`lahfsahf`
`lasx`
`lbt`
`leoncasa`
`lor`
`lse`
`lse128`
`lse2`
`lsx`
`lut`
`lvz`
`lzcnt`
`m`
`mclass`
`mops`
`movbe`
`mp`
`mp1e2`
`msa`
`mte`
`multivalue`
`mutable-globals`
`neon`
`nontrapping-fptoint`
`nvic`
`paca`
`pacg`
`pan`
`partword-atomics`
`pauth-lr`
`pclmulqdq`
`pmuv3`
`popcnt`
`power10-vector`
`power8-altivec`
`power8-vector`
`power9-altivec`
`power9-vector`
`prfchw`
`quadword-atomics`
`rand`
`ras`
`rclass`
`rcpc`
`rcpc2`
`rcpc3`
`rdm`
`rdrand`
`rdseed`
`reference-types`
`relax`
`relaxed-simd`
`reserve-x18`
`rtm`
`sb`
`sha`
`sha2`
`sha3`
`sha512`
`sign-ext`
`simd128`
`sm3`
`sm4`
`sme`
`sme-b16b16`
`sme-f16f16`
`sme-f64f64`
`sme-f8f16`
`sme-f8f32`
`sme-fa64`
`sme-i16i64`
`sme-lutv2`
`sme2`
`sme2p1`
`spe`
`ssbs`
`sse`
`sse2`
`sse3`
`sse4.1`
`sse4.2`
`sse4a`
`ssse3`
`ssve-fp8dot2`
`ssve-fp8dot4`
`ssve-fp8fma`
`sve`
`sve-b16b16`
`sve2`
`sve2-aes`
`sve2-bitperm`
`sve2-sha3`
`sve2-sm4`
`sve2p1`
`tail-call`
`tbm`
`thumb-mode`
`thumb2`
`tme`
`trust`
`trustzone`
`ual`
`unaligned-scalar-mem`
`v`
`v5te`
`v6`
`v6k`
`v6t2`
`v7`
`v8`
`v8.1a`
`v8.2a`
`v8.3a`
`v8.4a`
`v8.5a`
`v8.6a`
`v8.7a`
`v8.8a`
`v8.9a`
`v8plus`
`v9`
`v9.1a`
`v9.2a`
`v9.3a`
`v9.4a`
`v9.5a`
`v9a`
`vaes`
`vdsp2e60f`
`vdspv1`
`vdspv2`
`vector`
`vfp2`
`vfp3`
`vfp4`
`vh`
`virt`
`virtualization`
`vpclmulqdq`
`vsx`
`wfxt`
`wide-arithmetic`
`xop`
`xsave`
`xsavec`
`xsaveopt`
`xsaves`
`zaamo`
`zabha`
`zalrsc`
`zba`
`zbb`
`zbc`
`zbkb`
`zbkc`
`zbkx`
`zbs`
`zdinx`
`zfh`
`zfhmin`
`zfinx`
`zhinx`
`zhinxmin`
`zk`
`zkn`
`zknd`
`zkne`
`zknh`
`zkr`
`zks`
`zksed`
`zksh`, and `zkt`
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration
= note: `#[warn(unexpected_cfgs)]` on by default
warning: 1 warning emitted

View file

@ -60,8 +60,8 @@
//~^ WARN unexpected `cfg` condition value
target_family = "_UNEXPECTED_VALUE",
//~^ WARN unexpected `cfg` condition value
target_feature = "_UNEXPECTED_VALUE",
//~^ WARN unexpected `cfg` condition value
// target_feature = "_UNEXPECTED_VALUE",
// ^ tested in target_feature.rs
target_has_atomic = "_UNEXPECTED_VALUE",
//~^ WARN unexpected `cfg` condition value
target_has_atomic_equal_alignment = "_UNEXPECTED_VALUE",

View file

@ -168,15 +168,6 @@ LL | target_family = "_UNEXPECTED_VALUE",
= note: expected values for `target_family` are: `unix`, `wasm`, and `windows`
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration
warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE`
--> $DIR/well-known-values.rs:63:5
|
LL | target_feature = "_UNEXPECTED_VALUE",
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: expected values for `target_feature` are: `10e60`, `2e3`, `3e3r1`, `3e3r2`, `3e3r3`, `3e7`, `7e10`, `a`, `aclass`, `adx`, `aes`, `altivec`, `alu32`, `amx-bf16`, `amx-complex`, `amx-fp16`, `amx-int8`, `amx-tile`, `atomics`, `avx`, `avx2`, `avx512bf16`, `avx512bitalg`, `avx512bw`, `avx512cd`, `avx512dq`, `avx512f`, `avx512fp16`, `avx512ifma`, `avx512vbmi`, `avx512vbmi2`, `avx512vl`, `avx512vnni`, `avx512vp2intersect`, `avx512vpopcntdq`, `avxifma`, `avxneconvert`, `avxvnni`, `avxvnniint16`, `avxvnniint8`, `backchain`, `bf16`, `bmi1`, `bmi2`, `bti`, `bulk-memory`, `c`, `cache`, `cmpxchg16b`, `crc`, `crt-static`, `cssc`, `d`, `d32`, `dit`, `doloop`, `dotprod`, `dpb`, `dpb2`, `dsp`, `dsp1e2`, `dspe60`, `e`, `e1`, `e2`, `ecv`, `edsp`, `elrw`, `ermsb`, `exception-handling`, `extended-const`, `f`, `f16c`, `f32mm`, `f64mm`, `faminmax`, `fcma`, `fdivdu`, `fhm`, `flagm`, `flagm2`, `float1e2`, `float1e3`, `float3e4`, `float7e60`, `floate1`, `fma`, `fp-armv8`, `fp16`, `fp64`, `fp8`, `fp8dot2`, `fp8dot4`, `fp8fma`, `fpuv2_df`, `fpuv2_sf`, `fpuv3_df`, `fpuv3_hf`, `fpuv3_hi`, `fpuv3_sf`, `frecipe`, `frintts`, `fxsr`, `gfni`, `hard-float`, `hard-float-abi`, `hard-tp`, `hbc`, `high-registers`, `hvx`, `hvx-length128b`, `hwdiv`, `i8mm`, `jsconv`, `lahfsahf`, `lasx`, `lbt`, `leoncasa`, `lor`, `lse`, `lse128`, `lse2`, `lsx`, `lut`, `lvz`, `lzcnt`, `m`, `mclass`, `mops`, `movbe`, `mp`, `mp1e2`, `msa`, `mte`, `multivalue`, `mutable-globals`, `neon`, `nontrapping-fptoint`, `nvic`, `paca`, `pacg`, `pan`, `partword-atomics`, `pauth-lr`, `pclmulqdq`, `pmuv3`, `popcnt`, `power10-vector`, `power8-altivec`, `power8-vector`, `power9-altivec`, `power9-vector`, `prfchw`, `quadword-atomics`, `rand`, `ras`, `rclass`, `rcpc`, `rcpc2`, `rcpc3`, `rdm`, `rdrand`, `rdseed`, `reference-types`, `relax`, `relaxed-simd`, `reserve-x18`, `rtm`, `sb`, `sha`, `sha2`, `sha3`, `sha512`, `sign-ext`, `simd128`, `sm3`, `sm4`, `sme`, `sme-b16b16`, `sme-f16f16`, `sme-f64f64`, `sme-f8f16`, `sme-f8f32`, `sme-fa64`, `sme-i16i64`, `sme-lutv2`, `sme2`, `sme2p1`, `spe`, `ssbs`, `sse`, `sse2`, `sse3`, `sse4.1`, `sse4.2`, `sse4a`, `ssse3`, `ssve-fp8dot2`, `ssve-fp8dot4`, `ssve-fp8fma`, `sve`, `sve-b16b16`, `sve2`, `sve2-aes`, `sve2-bitperm`, `sve2-sha3`, `sve2-sm4`, `sve2p1`, `tail-call`, `tbm`, `thumb-mode`, `thumb2`, `tme`, `trust`, `trustzone`, `ual`, `unaligned-scalar-mem`, `v`, `v5te`, `v6`, `v6k`, `v6t2`, `v7`, `v8`, `v8.1a`, `v8.2a`, `v8.3a`, `v8.4a`, `v8.5a`, `v8.6a`, `v8.7a`, `v8.8a`, `v8.9a`, `v8plus`, `v9`, `v9.1a`, `v9.2a`, `v9.3a`, `v9.4a`, `v9.5a`, `v9a`, `vaes`, `vdsp2e60f`, `vdspv1`, `vdspv2`, `vector`, `vfp2`, `vfp3`, `vfp4`, `vh`, `virt`, `virtualization`, `vpclmulqdq`, `vsx`, `wfxt`, `wide-arithmetic`, `xop`, `xsave`, `xsavec`, `xsaveopt`, `xsaves`, `zaamo`, `zabha`, `zalrsc`, `zba`, `zbb`, `zbc`, `zbkb`, `zbkc`, `zbkx`, `zbs`, `zdinx`, `zfh`, `zfhmin`, `zfinx`, `zhinx`, `zhinxmin`, `zk`, `zkn`, `zknd`, `zkne`, `zknh`, `zkr`, `zks`, `zksed`, `zksh`, and `zkt`
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration
warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE`
--> $DIR/well-known-values.rs:65:5
|
@ -297,5 +288,5 @@ LL | #[cfg(target_os = "linuz")] // testing that we suggest `linux`
= note: expected values for `target_os` are: `aix`, `android`, `cuda`, `dragonfly`, `emscripten`, `espidf`, `freebsd`, `fuchsia`, `haiku`, `hermit`, `horizon`, `hurd`, `illumos`, `ios`, `l4re`, `linux`, `macos`, `netbsd`, `none`, `nto`, `nuttx`, `openbsd`, `psp`, `psx`, `redox`, `rtems`, `solaris`, `solid_asp3`, `teeos`, `trusty`, `tvos`, `uefi`, `unknown`, `visionos`, `vita`, `vxworks`, `wasi`, `watchos`, `windows`, `xous`, and `zkvm`
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration
warning: 30 warnings emitted
warning: 29 warnings emitted

View file

@ -72,6 +72,20 @@ help: add `#![feature(adt_const_params)]` to the crate attributes to enable more
LL + #![feature(adt_const_params)]
|
note: erroneous constant encountered
--> $DIR/unevaluated-const-ice-119731.rs:22:19
|
LL | impl v17<512, v0> {
| ^^
note: erroneous constant encountered
--> $DIR/unevaluated-const-ice-119731.rs:22:19
|
LL | impl v17<512, v0> {
| ^^
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: maximum number of nodes exceeded in constant v20::v17::<v10, v2>::{constant#0}
--> $DIR/unevaluated-const-ice-119731.rs:28:37
|

View file

@ -1,7 +1,11 @@
//@ known-bug: rust-lang/rust#128176
//@ check-pass
// Regression test for #128176.
#![feature(generic_const_exprs)]
#![feature(dyn_compatible_for_dispatch)]
#![allow(incomplete_features)]
trait X {
type Y<const N: i16>;
}

View file

@ -10,11 +10,11 @@ note: ...which requires computing candidate for `<LazyUpdim<'_, T, <T as TensorD
LL | trait TensorDimension {
| ^^^^^^^^^^^^^^^^^^^^^
= note: ...which again requires resolving instance `<LazyUpdim<'_, T, <T as TensorDimension>::DIM, DIM> as TensorDimension>::DIM`, completing the cycle
note: cycle used when computing candidate for `<LazyUpdim<'_, T, { T::DIM }, DIM> as TensorDimension>`
--> $DIR/issue-83765.rs:4:1
note: cycle used when checking assoc item `<impl at $DIR/issue-83765.rs:50:1: 50:94>::size` is compatible with trait definition
--> $DIR/issue-83765.rs:51:5
|
LL | trait TensorDimension {
| ^^^^^^^^^^^^^^^^^^^^^
LL | fn size(&self) -> [usize; DIM] {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
error[E0391]: cycle detected when resolving instance `<LazyUpdim<'_, T, <T as TensorDimension>::DIM, DIM> as TensorDimension>::DIM`

View file

@ -16,6 +16,12 @@ error[E0308]: mismatched types
LL | const X: usize = 42 && 39;
| ^^^^^^^^ expected `usize`, found `bool`
note: erroneous constant encountered
--> $DIR/const-integer-bool-ops.rs:8:18
|
LL | const ARR: [i32; X] = [99; 34];
| ^
error[E0308]: mismatched types
--> $DIR/const-integer-bool-ops.rs:10:19
|
@ -34,6 +40,12 @@ error[E0308]: mismatched types
LL | const X1: usize = 42 || 39;
| ^^^^^^^^ expected `usize`, found `bool`
note: erroneous constant encountered
--> $DIR/const-integer-bool-ops.rs:17:19
|
LL | const ARR1: [i32; X1] = [99; 47];
| ^^
error[E0308]: mismatched types
--> $DIR/const-integer-bool-ops.rs:19:19
|
@ -52,6 +64,12 @@ error[E0308]: mismatched types
LL | const X2: usize = -42 || -39;
| ^^^^^^^^^^ expected `usize`, found `bool`
note: erroneous constant encountered
--> $DIR/const-integer-bool-ops.rs:26:19
|
LL | const ARR2: [i32; X2] = [99; 18446744073709551607];
| ^^
error[E0308]: mismatched types
--> $DIR/const-integer-bool-ops.rs:28:19
|
@ -70,42 +88,84 @@ error[E0308]: mismatched types
LL | const X3: usize = -42 && -39;
| ^^^^^^^^^^ expected `usize`, found `bool`
note: erroneous constant encountered
--> $DIR/const-integer-bool-ops.rs:35:19
|
LL | const ARR3: [i32; X3] = [99; 6];
| ^^
error[E0308]: mismatched types
--> $DIR/const-integer-bool-ops.rs:37:18
|
LL | const Y: usize = 42.0 == 42.0;
| ^^^^^^^^^^^^ expected `usize`, found `bool`
note: erroneous constant encountered
--> $DIR/const-integer-bool-ops.rs:40:19
|
LL | const ARRR: [i32; Y] = [99; 1];
| ^
error[E0308]: mismatched types
--> $DIR/const-integer-bool-ops.rs:42:19
|
LL | const Y1: usize = 42.0 >= 42.0;
| ^^^^^^^^^^^^ expected `usize`, found `bool`
note: erroneous constant encountered
--> $DIR/const-integer-bool-ops.rs:45:20
|
LL | const ARRR1: [i32; Y1] = [99; 1];
| ^^
error[E0308]: mismatched types
--> $DIR/const-integer-bool-ops.rs:47:19
|
LL | const Y2: usize = 42.0 <= 42.0;
| ^^^^^^^^^^^^ expected `usize`, found `bool`
note: erroneous constant encountered
--> $DIR/const-integer-bool-ops.rs:50:20
|
LL | const ARRR2: [i32; Y2] = [99; 1];
| ^^
error[E0308]: mismatched types
--> $DIR/const-integer-bool-ops.rs:52:19
|
LL | const Y3: usize = 42.0 > 42.0;
| ^^^^^^^^^^^ expected `usize`, found `bool`
note: erroneous constant encountered
--> $DIR/const-integer-bool-ops.rs:55:20
|
LL | const ARRR3: [i32; Y3] = [99; 0];
| ^^
error[E0308]: mismatched types
--> $DIR/const-integer-bool-ops.rs:57:19
|
LL | const Y4: usize = 42.0 < 42.0;
| ^^^^^^^^^^^ expected `usize`, found `bool`
note: erroneous constant encountered
--> $DIR/const-integer-bool-ops.rs:60:20
|
LL | const ARRR4: [i32; Y4] = [99; 0];
| ^^
error[E0308]: mismatched types
--> $DIR/const-integer-bool-ops.rs:62:19
|
LL | const Y5: usize = 42.0 != 42.0;
| ^^^^^^^^^^^^ expected `usize`, found `bool`
note: erroneous constant encountered
--> $DIR/const-integer-bool-ops.rs:65:20
|
LL | const ARRR5: [i32; Y5] = [99; 0];
| ^^
error: aborting due to 18 previous errors
For more information about this error, try `rustc --explain E0308`.

View file

@ -4,6 +4,12 @@ error[E0764]: mutable references are not allowed in the final value of constants
LL | const S: &'static mut str = &mut " hello ";
| ^^^^^^^^^^^^^^
note: erroneous constant encountered
--> $DIR/issue-76510.rs:7:70
|
LL | let s = transmute::<(*const u8, usize), &ManuallyDrop<str>>((S.as_ptr(), 3));
| ^
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0764`.

View file

@ -11,6 +11,12 @@ help: use a trailing comma to create a tuple with one element
LL | const TUP: (usize,) = (5usize << 64,);
| + ++
note: erroneous constant encountered
--> $DIR/const-tup-index-span.rs:6:18
|
LL | const ARR: [i32; TUP.0] = [];
| ^^^
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0308`.

View file

@ -19,6 +19,24 @@ LL | | core::mem::size_of::<T>()
LL | | }
| |_____- `Tt::const_val` defined here
note: erroneous constant encountered
--> $DIR/issue-54954.rs:11:15
|
LL | fn f(z: [f32; ARR_LEN]) -> [f32; ARR_LEN] {
| ^^^^^^^
note: erroneous constant encountered
--> $DIR/issue-54954.rs:11:34
|
LL | fn f(z: [f32; ARR_LEN]) -> [f32; ARR_LEN] {
| ^^^^^^^
note: erroneous constant encountered
--> $DIR/issue-54954.rs:16:22
|
LL | let _ = f([1f32; ARR_LEN]);
| ^^^^^^^
error: aborting due to 2 previous errors
Some errors have detailed explanations: E0379, E0790.

View file

@ -4,5 +4,11 @@ error: missing type for `const` item
LL | const FIRST: = 10;
| ^ help: provide a type for the associated constant: `u8`
note: erroneous constant encountered
--> $DIR/missing_assoc_const_type2.rs:18:5
|
LL | TwoDigits::FIRST as usize
| ^^^^^^^^^^^^^^^^
error: aborting due to 1 previous error

View file

@ -4,12 +4,6 @@ error[E0080]: evaluation of constant value failed
LL | const _: &'static Data = &Data([0; (1 << 47) - 1]);
| ^^^^^^^^^^^^^^^^^^ tried to allocate more memory than available to compiler
note: erroneous constant encountered
--> $DIR/promoted_running_out_of_memory_issue-130687.rs:8:26
|
LL | const _: &'static Data = &Data([0; (1 << 47) - 1]);
| ^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0080`.

View file

@ -0,0 +1,7 @@
//@ only-64bit
pub struct Data([u8; usize::MAX >> 2]);
const _: &'static [Data] = &[];
//~^ERROR: evaluation of constant value failed
//~| too big for the target architecture
fn main() {}

View file

@ -0,0 +1,9 @@
error[E0080]: evaluation of constant value failed
--> $DIR/promoted_size_overflow.rs:3:29
|
LL | const _: &'static [Data] = &[];
| ^^ values of the type `[u8; 4611686018427387903]` are too big for the target architecture
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0080`.

View file

@ -5,15 +5,15 @@ pub const unsafe fn fake_type<T>() -> T {
}
pub const unsafe fn hint_unreachable() -> ! {
fake_type()
fake_type() //~ inside
}
trait Const {
const CONSTANT: i32 = unsafe { fake_type() };
const CONSTANT: i32 = unsafe { fake_type() }; //~ inside
}
impl<T> Const for T {}
pub fn main() -> () {
dbg!(i32::CONSTANT); //~ constant
dbg!(i32::CONSTANT);
}

View file

@ -645,20 +645,6 @@ note: inside `<i32 as Const>::CONSTANT`
LL | const CONSTANT: i32 = unsafe { fake_type() };
| ^^^^^^^^^^^
note: erroneous constant encountered
--> $DIR/uninhabited-const-issue-61744.rs:18:10
|
LL | dbg!(i32::CONSTANT);
| ^^^^^^^^^^^^^
note: erroneous constant encountered
--> $DIR/uninhabited-const-issue-61744.rs:18:10
|
LL | dbg!(i32::CONSTANT);
| ^^^^^^^^^^^^^
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0080`.

View file

@ -6,6 +6,12 @@ LL | A = "" + 1
| |
| &str
note: erroneous constant encountered
--> $DIR/issue-41394.rs:7:9
|
LL | A = Foo::A as isize
| ^^^^^^^^^^^^^^^
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0369`.

View file

@ -25,12 +25,6 @@ note: inside `ID_ED`
LL | const ID_ED: u32 = rec_id(ORIGINAL);
| ^^^^^^^^^^^^^^^^
note: erroneous constant encountered
--> $DIR/ctfe-id-unlimited.rs:31:40
|
LL | const ASSERT: () = assert!(ORIGINAL == ID_ED);
| ^^^^^
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0080`.

View file

@ -25,6 +25,12 @@ LL | const C: S = unsafe { std::mem::transmute(()) };
= note: source type: `()` (0 bits)
= note: target type: `S` (size can vary because of [u8])
note: erroneous constant encountered
--> $DIR/base-layout-is-sized-ice-123078.rs:13:5
|
LL | C;
| ^
error: aborting due to 2 previous errors
Some errors have detailed explanations: E0277, E0512.

View file

@ -11,23 +11,6 @@ note: inside `main`
LL | println!("Size: {}", std::mem::size_of::<[u8; u64::MAX as usize]>());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: erroneous constant encountered
--> $DIR/issue-55878.rs:7:26
|
LL | println!("Size: {}", std::mem::size_of::<[u8; u64::MAX as usize]>());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: this note 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: erroneous constant encountered
--> $DIR/issue-55878.rs:7:26
|
LL | println!("Size: {}", std::mem::size_of::<[u8; u64::MAX as usize]>());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
= note: this note 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 1 previous error
For more information about this error, try `rustc --explain E0080`.

View file

@ -43,3 +43,57 @@ LL | #[allow(nonstandard_style)]
error: aborting due to 3 previous errors
Future incompatibility report: Future breakage diagnostic:
error: allow(nonstandard_style) incompatible with previous forbid
--> $DIR/forbid-group-group-2.rs:7:9
|
LL | #![forbid(warnings)]
| -------- `forbid` level set here
...
LL | #[allow(nonstandard_style)]
| ^^^^^^^^^^^^^^^^^ overruled by previous forbid
|
= 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 #81670 <https://github.com/rust-lang/rust/issues/81670>
note: the lint level is defined here
--> $DIR/forbid-group-group-2.rs:5:9
|
LL | #![deny(forbidden_lint_groups)]
| ^^^^^^^^^^^^^^^^^^^^^
Future breakage diagnostic:
error: allow(nonstandard_style) incompatible with previous forbid
--> $DIR/forbid-group-group-2.rs:7:9
|
LL | #![forbid(warnings)]
| -------- `forbid` level set here
...
LL | #[allow(nonstandard_style)]
| ^^^^^^^^^^^^^^^^^ overruled by previous forbid
|
= 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 #81670 <https://github.com/rust-lang/rust/issues/81670>
note: the lint level is defined here
--> $DIR/forbid-group-group-2.rs:5:9
|
LL | #![deny(forbidden_lint_groups)]
| ^^^^^^^^^^^^^^^^^^^^^
Future breakage diagnostic:
error: allow(nonstandard_style) incompatible with previous forbid
--> $DIR/forbid-group-group-2.rs:7:9
|
LL | #![forbid(warnings)]
| -------- `forbid` level set here
...
LL | #[allow(nonstandard_style)]
| ^^^^^^^^^^^^^^^^^ overruled by previous forbid
|
= 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 #81670 <https://github.com/rust-lang/rust/issues/81670>
note: the lint level is defined here
--> $DIR/forbid-group-group-2.rs:5:9
|
LL | #![deny(forbidden_lint_groups)]
| ^^^^^^^^^^^^^^^^^^^^^

View file

@ -13,3 +13,17 @@ LL | #[allow(unused_variables)]
warning: 1 warning emitted
Future incompatibility report: Future breakage diagnostic:
warning: allow(unused_variables) incompatible with previous forbid
--> $DIR/forbid-group-member.rs:8:9
|
LL | #![forbid(unused)]
| ------ `forbid` level set here
LL |
LL | #[allow(unused_variables)]
| ^^^^^^^^^^^^^^^^ overruled by previous forbid
|
= 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 #81670 <https://github.com/rust-lang/rust/issues/81670>
= note: `#[warn(forbidden_lint_groups)]` on by default

View file

@ -17,3 +17,399 @@ LL | #![forbid(forbidden_lint_groups)]
error: aborting due to 1 previous error
Future incompatibility report: Future breakage diagnostic:
error: warn(unused) incompatible with previous forbid
--> $DIR/issue-70819-dont-override-forbid-in-same-scope.rs:22:13
|
LL | #![forbid(unused)]
| ------ `forbid` level set here
LL | #![deny(unused)]
LL | #![warn(unused)]
| ^^^^^^ overruled by previous forbid
|
= 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 #81670 <https://github.com/rust-lang/rust/issues/81670>
note: the lint level is defined here
--> $DIR/issue-70819-dont-override-forbid-in-same-scope.rs:17:11
|
LL | #![forbid(forbidden_lint_groups)]
| ^^^^^^^^^^^^^^^^^^^^^
Future breakage diagnostic:
error: warn(unused) incompatible with previous forbid
--> $DIR/issue-70819-dont-override-forbid-in-same-scope.rs:22:13
|
LL | #![forbid(unused)]
| ------ `forbid` level set here
LL | #![deny(unused)]
LL | #![warn(unused)]
| ^^^^^^ overruled by previous forbid
|
= 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 #81670 <https://github.com/rust-lang/rust/issues/81670>
note: the lint level is defined here
--> $DIR/issue-70819-dont-override-forbid-in-same-scope.rs:17:11
|
LL | #![forbid(forbidden_lint_groups)]
| ^^^^^^^^^^^^^^^^^^^^^
Future breakage diagnostic:
error: warn(unused) incompatible with previous forbid
--> $DIR/issue-70819-dont-override-forbid-in-same-scope.rs:22:13
|
LL | #![forbid(unused)]
| ------ `forbid` level set here
LL | #![deny(unused)]
LL | #![warn(unused)]
| ^^^^^^ overruled by previous forbid
|
= 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 #81670 <https://github.com/rust-lang/rust/issues/81670>
note: the lint level is defined here
--> $DIR/issue-70819-dont-override-forbid-in-same-scope.rs:17:11
|
LL | #![forbid(forbidden_lint_groups)]
| ^^^^^^^^^^^^^^^^^^^^^
Future breakage diagnostic:
error: warn(unused) incompatible with previous forbid
--> $DIR/issue-70819-dont-override-forbid-in-same-scope.rs:22:13
|
LL | #![forbid(unused)]
| ------ `forbid` level set here
LL | #![deny(unused)]
LL | #![warn(unused)]
| ^^^^^^ overruled by previous forbid
|
= 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 #81670 <https://github.com/rust-lang/rust/issues/81670>
note: the lint level is defined here
--> $DIR/issue-70819-dont-override-forbid-in-same-scope.rs:17:11
|
LL | #![forbid(forbidden_lint_groups)]
| ^^^^^^^^^^^^^^^^^^^^^
Future breakage diagnostic:
error: warn(unused) incompatible with previous forbid
--> $DIR/issue-70819-dont-override-forbid-in-same-scope.rs:22:13
|
LL | #![forbid(unused)]
| ------ `forbid` level set here
LL | #![deny(unused)]
LL | #![warn(unused)]
| ^^^^^^ overruled by previous forbid
|
= 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 #81670 <https://github.com/rust-lang/rust/issues/81670>
note: the lint level is defined here
--> $DIR/issue-70819-dont-override-forbid-in-same-scope.rs:17:11
|
LL | #![forbid(forbidden_lint_groups)]
| ^^^^^^^^^^^^^^^^^^^^^
Future breakage diagnostic:
error: warn(unused) incompatible with previous forbid
--> $DIR/issue-70819-dont-override-forbid-in-same-scope.rs:22:13
|
LL | #![forbid(unused)]
| ------ `forbid` level set here
LL | #![deny(unused)]
LL | #![warn(unused)]
| ^^^^^^ overruled by previous forbid
|
= 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 #81670 <https://github.com/rust-lang/rust/issues/81670>
note: the lint level is defined here
--> $DIR/issue-70819-dont-override-forbid-in-same-scope.rs:17:11
|
LL | #![forbid(forbidden_lint_groups)]
| ^^^^^^^^^^^^^^^^^^^^^
Future breakage diagnostic:
error: warn(unused) incompatible with previous forbid
--> $DIR/issue-70819-dont-override-forbid-in-same-scope.rs:22:13
|
LL | #![forbid(unused)]
| ------ `forbid` level set here
LL | #![deny(unused)]
LL | #![warn(unused)]
| ^^^^^^ overruled by previous forbid
|
= 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 #81670 <https://github.com/rust-lang/rust/issues/81670>
note: the lint level is defined here
--> $DIR/issue-70819-dont-override-forbid-in-same-scope.rs:17:11
|
LL | #![forbid(forbidden_lint_groups)]
| ^^^^^^^^^^^^^^^^^^^^^
Future breakage diagnostic:
error: warn(unused) incompatible with previous forbid
--> $DIR/issue-70819-dont-override-forbid-in-same-scope.rs:22:13
|
LL | #![forbid(unused)]
| ------ `forbid` level set here
LL | #![deny(unused)]
LL | #![warn(unused)]
| ^^^^^^ overruled by previous forbid
|
= 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 #81670 <https://github.com/rust-lang/rust/issues/81670>
note: the lint level is defined here
--> $DIR/issue-70819-dont-override-forbid-in-same-scope.rs:17:11
|
LL | #![forbid(forbidden_lint_groups)]
| ^^^^^^^^^^^^^^^^^^^^^
Future breakage diagnostic:
error: warn(unused) incompatible with previous forbid
--> $DIR/issue-70819-dont-override-forbid-in-same-scope.rs:22:13
|
LL | #![forbid(unused)]
| ------ `forbid` level set here
LL | #![deny(unused)]
LL | #![warn(unused)]
| ^^^^^^ overruled by previous forbid
|
= 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 #81670 <https://github.com/rust-lang/rust/issues/81670>
note: the lint level is defined here
--> $DIR/issue-70819-dont-override-forbid-in-same-scope.rs:17:11
|
LL | #![forbid(forbidden_lint_groups)]
| ^^^^^^^^^^^^^^^^^^^^^
Future breakage diagnostic:
error: warn(unused) incompatible with previous forbid
--> $DIR/issue-70819-dont-override-forbid-in-same-scope.rs:22:13
|
LL | #![forbid(unused)]
| ------ `forbid` level set here
LL | #![deny(unused)]
LL | #![warn(unused)]
| ^^^^^^ overruled by previous forbid
|
= 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 #81670 <https://github.com/rust-lang/rust/issues/81670>
note: the lint level is defined here
--> $DIR/issue-70819-dont-override-forbid-in-same-scope.rs:17:11
|
LL | #![forbid(forbidden_lint_groups)]
| ^^^^^^^^^^^^^^^^^^^^^
Future breakage diagnostic:
error: warn(unused) incompatible with previous forbid
--> $DIR/issue-70819-dont-override-forbid-in-same-scope.rs:22:13
|
LL | #![forbid(unused)]
| ------ `forbid` level set here
LL | #![deny(unused)]
LL | #![warn(unused)]
| ^^^^^^ overruled by previous forbid
|
= 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 #81670 <https://github.com/rust-lang/rust/issues/81670>
note: the lint level is defined here
--> $DIR/issue-70819-dont-override-forbid-in-same-scope.rs:17:11
|
LL | #![forbid(forbidden_lint_groups)]
| ^^^^^^^^^^^^^^^^^^^^^
Future breakage diagnostic:
error: warn(unused) incompatible with previous forbid
--> $DIR/issue-70819-dont-override-forbid-in-same-scope.rs:22:13
|
LL | #![forbid(unused)]
| ------ `forbid` level set here
LL | #![deny(unused)]
LL | #![warn(unused)]
| ^^^^^^ overruled by previous forbid
|
= 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 #81670 <https://github.com/rust-lang/rust/issues/81670>
note: the lint level is defined here
--> $DIR/issue-70819-dont-override-forbid-in-same-scope.rs:17:11
|
LL | #![forbid(forbidden_lint_groups)]
| ^^^^^^^^^^^^^^^^^^^^^
Future breakage diagnostic:
error: warn(unused) incompatible with previous forbid
--> $DIR/issue-70819-dont-override-forbid-in-same-scope.rs:22:13
|
LL | #![forbid(unused)]
| ------ `forbid` level set here
LL | #![deny(unused)]
LL | #![warn(unused)]
| ^^^^^^ overruled by previous forbid
|
= 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 #81670 <https://github.com/rust-lang/rust/issues/81670>
note: the lint level is defined here
--> $DIR/issue-70819-dont-override-forbid-in-same-scope.rs:17:11
|
LL | #![forbid(forbidden_lint_groups)]
| ^^^^^^^^^^^^^^^^^^^^^
Future breakage diagnostic:
error: warn(unused) incompatible with previous forbid
--> $DIR/issue-70819-dont-override-forbid-in-same-scope.rs:22:13
|
LL | #![forbid(unused)]
| ------ `forbid` level set here
LL | #![deny(unused)]
LL | #![warn(unused)]
| ^^^^^^ overruled by previous forbid
|
= 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 #81670 <https://github.com/rust-lang/rust/issues/81670>
note: the lint level is defined here
--> $DIR/issue-70819-dont-override-forbid-in-same-scope.rs:17:11
|
LL | #![forbid(forbidden_lint_groups)]
| ^^^^^^^^^^^^^^^^^^^^^
Future breakage diagnostic:
error: warn(unused) incompatible with previous forbid
--> $DIR/issue-70819-dont-override-forbid-in-same-scope.rs:22:13
|
LL | #![forbid(unused)]
| ------ `forbid` level set here
LL | #![deny(unused)]
LL | #![warn(unused)]
| ^^^^^^ overruled by previous forbid
|
= 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 #81670 <https://github.com/rust-lang/rust/issues/81670>
note: the lint level is defined here
--> $DIR/issue-70819-dont-override-forbid-in-same-scope.rs:17:11
|
LL | #![forbid(forbidden_lint_groups)]
| ^^^^^^^^^^^^^^^^^^^^^
Future breakage diagnostic:
error: warn(unused) incompatible with previous forbid
--> $DIR/issue-70819-dont-override-forbid-in-same-scope.rs:22:13
|
LL | #![forbid(unused)]
| ------ `forbid` level set here
LL | #![deny(unused)]
LL | #![warn(unused)]
| ^^^^^^ overruled by previous forbid
|
= 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 #81670 <https://github.com/rust-lang/rust/issues/81670>
note: the lint level is defined here
--> $DIR/issue-70819-dont-override-forbid-in-same-scope.rs:17:11
|
LL | #![forbid(forbidden_lint_groups)]
| ^^^^^^^^^^^^^^^^^^^^^
Future breakage diagnostic:
error: warn(unused) incompatible with previous forbid
--> $DIR/issue-70819-dont-override-forbid-in-same-scope.rs:22:13
|
LL | #![forbid(unused)]
| ------ `forbid` level set here
LL | #![deny(unused)]
LL | #![warn(unused)]
| ^^^^^^ overruled by previous forbid
|
= 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 #81670 <https://github.com/rust-lang/rust/issues/81670>
note: the lint level is defined here
--> $DIR/issue-70819-dont-override-forbid-in-same-scope.rs:17:11
|
LL | #![forbid(forbidden_lint_groups)]
| ^^^^^^^^^^^^^^^^^^^^^
Future breakage diagnostic:
error: warn(unused) incompatible with previous forbid
--> $DIR/issue-70819-dont-override-forbid-in-same-scope.rs:22:13
|
LL | #![forbid(unused)]
| ------ `forbid` level set here
LL | #![deny(unused)]
LL | #![warn(unused)]
| ^^^^^^ overruled by previous forbid
|
= 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 #81670 <https://github.com/rust-lang/rust/issues/81670>
note: the lint level is defined here
--> $DIR/issue-70819-dont-override-forbid-in-same-scope.rs:17:11
|
LL | #![forbid(forbidden_lint_groups)]
| ^^^^^^^^^^^^^^^^^^^^^
Future breakage diagnostic:
error: warn(unused) incompatible with previous forbid
--> $DIR/issue-70819-dont-override-forbid-in-same-scope.rs:22:13
|
LL | #![forbid(unused)]
| ------ `forbid` level set here
LL | #![deny(unused)]
LL | #![warn(unused)]
| ^^^^^^ overruled by previous forbid
|
= 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 #81670 <https://github.com/rust-lang/rust/issues/81670>
note: the lint level is defined here
--> $DIR/issue-70819-dont-override-forbid-in-same-scope.rs:17:11
|
LL | #![forbid(forbidden_lint_groups)]
| ^^^^^^^^^^^^^^^^^^^^^
Future breakage diagnostic:
error: warn(unused) incompatible with previous forbid
--> $DIR/issue-70819-dont-override-forbid-in-same-scope.rs:22:13
|
LL | #![forbid(unused)]
| ------ `forbid` level set here
LL | #![deny(unused)]
LL | #![warn(unused)]
| ^^^^^^ overruled by previous forbid
|
= 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 #81670 <https://github.com/rust-lang/rust/issues/81670>
note: the lint level is defined here
--> $DIR/issue-70819-dont-override-forbid-in-same-scope.rs:17:11
|
LL | #![forbid(forbidden_lint_groups)]
| ^^^^^^^^^^^^^^^^^^^^^
Future breakage diagnostic:
error: warn(unused) incompatible with previous forbid
--> $DIR/issue-70819-dont-override-forbid-in-same-scope.rs:22:13
|
LL | #![forbid(unused)]
| ------ `forbid` level set here
LL | #![deny(unused)]
LL | #![warn(unused)]
| ^^^^^^ overruled by previous forbid
|
= 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 #81670 <https://github.com/rust-lang/rust/issues/81670>
note: the lint level is defined here
--> $DIR/issue-70819-dont-override-forbid-in-same-scope.rs:17:11
|
LL | #![forbid(forbidden_lint_groups)]
| ^^^^^^^^^^^^^^^^^^^^^
Future breakage diagnostic:
error: warn(unused) incompatible with previous forbid
--> $DIR/issue-70819-dont-override-forbid-in-same-scope.rs:22:13
|
LL | #![forbid(unused)]
| ------ `forbid` level set here
LL | #![deny(unused)]
LL | #![warn(unused)]
| ^^^^^^ overruled by previous forbid
|
= 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 #81670 <https://github.com/rust-lang/rust/issues/81670>
note: the lint level is defined here
--> $DIR/issue-70819-dont-override-forbid-in-same-scope.rs:17:11
|
LL | #![forbid(forbidden_lint_groups)]
| ^^^^^^^^^^^^^^^^^^^^^

View file

@ -39,3 +39,417 @@ LL | #[allow(nonstandard_style)]
error: aborting due to 3 previous errors
For more information about this error, try `rustc --explain E0453`.
Future incompatibility report: Future breakage diagnostic:
error: allow(unused_variables) incompatible with previous forbid
--> $DIR/outer-forbid.rs:20:9
|
LL | #![forbid(unused, non_snake_case)]
| ------ `forbid` level set here
...
LL | #[allow(unused_variables)]
| ^^^^^^^^^^^^^^^^ overruled by previous forbid
|
= 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 #81670 <https://github.com/rust-lang/rust/issues/81670>
note: the lint level is defined here
--> $DIR/outer-forbid.rs:18:11
|
LL | #![forbid(forbidden_lint_groups)]
| ^^^^^^^^^^^^^^^^^^^^^
Future breakage diagnostic:
error: allow(unused) incompatible with previous forbid
--> $DIR/outer-forbid.rs:25:9
|
LL | #![forbid(unused, non_snake_case)]
| ------ `forbid` level set here
...
LL | #[allow(unused)]
| ^^^^^^ overruled by previous forbid
|
= 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 #81670 <https://github.com/rust-lang/rust/issues/81670>
note: the lint level is defined here
--> $DIR/outer-forbid.rs:18:11
|
LL | #![forbid(forbidden_lint_groups)]
| ^^^^^^^^^^^^^^^^^^^^^
Future breakage diagnostic:
error: allow(unused) incompatible with previous forbid
--> $DIR/outer-forbid.rs:25:9
|
LL | #![forbid(unused, non_snake_case)]
| ------ `forbid` level set here
...
LL | #[allow(unused)]
| ^^^^^^ overruled by previous forbid
|
= 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 #81670 <https://github.com/rust-lang/rust/issues/81670>
note: the lint level is defined here
--> $DIR/outer-forbid.rs:18:11
|
LL | #![forbid(forbidden_lint_groups)]
| ^^^^^^^^^^^^^^^^^^^^^
Future breakage diagnostic:
error: allow(unused) incompatible with previous forbid
--> $DIR/outer-forbid.rs:25:9
|
LL | #![forbid(unused, non_snake_case)]
| ------ `forbid` level set here
...
LL | #[allow(unused)]
| ^^^^^^ overruled by previous forbid
|
= 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 #81670 <https://github.com/rust-lang/rust/issues/81670>
note: the lint level is defined here
--> $DIR/outer-forbid.rs:18:11
|
LL | #![forbid(forbidden_lint_groups)]
| ^^^^^^^^^^^^^^^^^^^^^
Future breakage diagnostic:
error: allow(unused) incompatible with previous forbid
--> $DIR/outer-forbid.rs:25:9
|
LL | #![forbid(unused, non_snake_case)]
| ------ `forbid` level set here
...
LL | #[allow(unused)]
| ^^^^^^ overruled by previous forbid
|
= 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 #81670 <https://github.com/rust-lang/rust/issues/81670>
note: the lint level is defined here
--> $DIR/outer-forbid.rs:18:11
|
LL | #![forbid(forbidden_lint_groups)]
| ^^^^^^^^^^^^^^^^^^^^^
Future breakage diagnostic:
error: allow(unused) incompatible with previous forbid
--> $DIR/outer-forbid.rs:25:9
|
LL | #![forbid(unused, non_snake_case)]
| ------ `forbid` level set here
...
LL | #[allow(unused)]
| ^^^^^^ overruled by previous forbid
|
= 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 #81670 <https://github.com/rust-lang/rust/issues/81670>
note: the lint level is defined here
--> $DIR/outer-forbid.rs:18:11
|
LL | #![forbid(forbidden_lint_groups)]
| ^^^^^^^^^^^^^^^^^^^^^
Future breakage diagnostic:
error: allow(unused) incompatible with previous forbid
--> $DIR/outer-forbid.rs:25:9
|
LL | #![forbid(unused, non_snake_case)]
| ------ `forbid` level set here
...
LL | #[allow(unused)]
| ^^^^^^ overruled by previous forbid
|
= 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 #81670 <https://github.com/rust-lang/rust/issues/81670>
note: the lint level is defined here
--> $DIR/outer-forbid.rs:18:11
|
LL | #![forbid(forbidden_lint_groups)]
| ^^^^^^^^^^^^^^^^^^^^^
Future breakage diagnostic:
error: allow(unused) incompatible with previous forbid
--> $DIR/outer-forbid.rs:25:9
|
LL | #![forbid(unused, non_snake_case)]
| ------ `forbid` level set here
...
LL | #[allow(unused)]
| ^^^^^^ overruled by previous forbid
|
= 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 #81670 <https://github.com/rust-lang/rust/issues/81670>
note: the lint level is defined here
--> $DIR/outer-forbid.rs:18:11
|
LL | #![forbid(forbidden_lint_groups)]
| ^^^^^^^^^^^^^^^^^^^^^
Future breakage diagnostic:
error: allow(unused) incompatible with previous forbid
--> $DIR/outer-forbid.rs:25:9
|
LL | #![forbid(unused, non_snake_case)]
| ------ `forbid` level set here
...
LL | #[allow(unused)]
| ^^^^^^ overruled by previous forbid
|
= 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 #81670 <https://github.com/rust-lang/rust/issues/81670>
note: the lint level is defined here
--> $DIR/outer-forbid.rs:18:11
|
LL | #![forbid(forbidden_lint_groups)]
| ^^^^^^^^^^^^^^^^^^^^^
Future breakage diagnostic:
error: allow(unused) incompatible with previous forbid
--> $DIR/outer-forbid.rs:25:9
|
LL | #![forbid(unused, non_snake_case)]
| ------ `forbid` level set here
...
LL | #[allow(unused)]
| ^^^^^^ overruled by previous forbid
|
= 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 #81670 <https://github.com/rust-lang/rust/issues/81670>
note: the lint level is defined here
--> $DIR/outer-forbid.rs:18:11
|
LL | #![forbid(forbidden_lint_groups)]
| ^^^^^^^^^^^^^^^^^^^^^
Future breakage diagnostic:
error: allow(unused) incompatible with previous forbid
--> $DIR/outer-forbid.rs:25:9
|
LL | #![forbid(unused, non_snake_case)]
| ------ `forbid` level set here
...
LL | #[allow(unused)]
| ^^^^^^ overruled by previous forbid
|
= 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 #81670 <https://github.com/rust-lang/rust/issues/81670>
note: the lint level is defined here
--> $DIR/outer-forbid.rs:18:11
|
LL | #![forbid(forbidden_lint_groups)]
| ^^^^^^^^^^^^^^^^^^^^^
Future breakage diagnostic:
error: allow(unused) incompatible with previous forbid
--> $DIR/outer-forbid.rs:25:9
|
LL | #![forbid(unused, non_snake_case)]
| ------ `forbid` level set here
...
LL | #[allow(unused)]
| ^^^^^^ overruled by previous forbid
|
= 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 #81670 <https://github.com/rust-lang/rust/issues/81670>
note: the lint level is defined here
--> $DIR/outer-forbid.rs:18:11
|
LL | #![forbid(forbidden_lint_groups)]
| ^^^^^^^^^^^^^^^^^^^^^
Future breakage diagnostic:
error: allow(unused) incompatible with previous forbid
--> $DIR/outer-forbid.rs:25:9
|
LL | #![forbid(unused, non_snake_case)]
| ------ `forbid` level set here
...
LL | #[allow(unused)]
| ^^^^^^ overruled by previous forbid
|
= 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 #81670 <https://github.com/rust-lang/rust/issues/81670>
note: the lint level is defined here
--> $DIR/outer-forbid.rs:18:11
|
LL | #![forbid(forbidden_lint_groups)]
| ^^^^^^^^^^^^^^^^^^^^^
Future breakage diagnostic:
error: allow(unused) incompatible with previous forbid
--> $DIR/outer-forbid.rs:25:9
|
LL | #![forbid(unused, non_snake_case)]
| ------ `forbid` level set here
...
LL | #[allow(unused)]
| ^^^^^^ overruled by previous forbid
|
= 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 #81670 <https://github.com/rust-lang/rust/issues/81670>
note: the lint level is defined here
--> $DIR/outer-forbid.rs:18:11
|
LL | #![forbid(forbidden_lint_groups)]
| ^^^^^^^^^^^^^^^^^^^^^
Future breakage diagnostic:
error: allow(unused) incompatible with previous forbid
--> $DIR/outer-forbid.rs:25:9
|
LL | #![forbid(unused, non_snake_case)]
| ------ `forbid` level set here
...
LL | #[allow(unused)]
| ^^^^^^ overruled by previous forbid
|
= 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 #81670 <https://github.com/rust-lang/rust/issues/81670>
note: the lint level is defined here
--> $DIR/outer-forbid.rs:18:11
|
LL | #![forbid(forbidden_lint_groups)]
| ^^^^^^^^^^^^^^^^^^^^^
Future breakage diagnostic:
error: allow(unused) incompatible with previous forbid
--> $DIR/outer-forbid.rs:25:9
|
LL | #![forbid(unused, non_snake_case)]
| ------ `forbid` level set here
...
LL | #[allow(unused)]
| ^^^^^^ overruled by previous forbid
|
= 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 #81670 <https://github.com/rust-lang/rust/issues/81670>
note: the lint level is defined here
--> $DIR/outer-forbid.rs:18:11
|
LL | #![forbid(forbidden_lint_groups)]
| ^^^^^^^^^^^^^^^^^^^^^
Future breakage diagnostic:
error: allow(unused) incompatible with previous forbid
--> $DIR/outer-forbid.rs:25:9
|
LL | #![forbid(unused, non_snake_case)]
| ------ `forbid` level set here
...
LL | #[allow(unused)]
| ^^^^^^ overruled by previous forbid
|
= 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 #81670 <https://github.com/rust-lang/rust/issues/81670>
note: the lint level is defined here
--> $DIR/outer-forbid.rs:18:11
|
LL | #![forbid(forbidden_lint_groups)]
| ^^^^^^^^^^^^^^^^^^^^^
Future breakage diagnostic:
error: allow(unused) incompatible with previous forbid
--> $DIR/outer-forbid.rs:25:9
|
LL | #![forbid(unused, non_snake_case)]
| ------ `forbid` level set here
...
LL | #[allow(unused)]
| ^^^^^^ overruled by previous forbid
|
= 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 #81670 <https://github.com/rust-lang/rust/issues/81670>
note: the lint level is defined here
--> $DIR/outer-forbid.rs:18:11
|
LL | #![forbid(forbidden_lint_groups)]
| ^^^^^^^^^^^^^^^^^^^^^
Future breakage diagnostic:
error: allow(unused) incompatible with previous forbid
--> $DIR/outer-forbid.rs:25:9
|
LL | #![forbid(unused, non_snake_case)]
| ------ `forbid` level set here
...
LL | #[allow(unused)]
| ^^^^^^ overruled by previous forbid
|
= 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 #81670 <https://github.com/rust-lang/rust/issues/81670>
note: the lint level is defined here
--> $DIR/outer-forbid.rs:18:11
|
LL | #![forbid(forbidden_lint_groups)]
| ^^^^^^^^^^^^^^^^^^^^^
Future breakage diagnostic:
error: allow(unused) incompatible with previous forbid
--> $DIR/outer-forbid.rs:25:9
|
LL | #![forbid(unused, non_snake_case)]
| ------ `forbid` level set here
...
LL | #[allow(unused)]
| ^^^^^^ overruled by previous forbid
|
= 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 #81670 <https://github.com/rust-lang/rust/issues/81670>
note: the lint level is defined here
--> $DIR/outer-forbid.rs:18:11
|
LL | #![forbid(forbidden_lint_groups)]
| ^^^^^^^^^^^^^^^^^^^^^
Future breakage diagnostic:
error: allow(unused) incompatible with previous forbid
--> $DIR/outer-forbid.rs:25:9
|
LL | #![forbid(unused, non_snake_case)]
| ------ `forbid` level set here
...
LL | #[allow(unused)]
| ^^^^^^ overruled by previous forbid
|
= 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 #81670 <https://github.com/rust-lang/rust/issues/81670>
note: the lint level is defined here
--> $DIR/outer-forbid.rs:18:11
|
LL | #![forbid(forbidden_lint_groups)]
| ^^^^^^^^^^^^^^^^^^^^^
Future breakage diagnostic:
error: allow(unused) incompatible with previous forbid
--> $DIR/outer-forbid.rs:25:9
|
LL | #![forbid(unused, non_snake_case)]
| ------ `forbid` level set here
...
LL | #[allow(unused)]
| ^^^^^^ overruled by previous forbid
|
= 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 #81670 <https://github.com/rust-lang/rust/issues/81670>
note: the lint level is defined here
--> $DIR/outer-forbid.rs:18:11
|
LL | #![forbid(forbidden_lint_groups)]
| ^^^^^^^^^^^^^^^^^^^^^
Future breakage diagnostic:
error: allow(unused) incompatible with previous forbid
--> $DIR/outer-forbid.rs:25:9
|
LL | #![forbid(unused, non_snake_case)]
| ------ `forbid` level set here
...
LL | #[allow(unused)]
| ^^^^^^ overruled by previous forbid
|
= 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 #81670 <https://github.com/rust-lang/rust/issues/81670>
note: the lint level is defined here
--> $DIR/outer-forbid.rs:18:11
|
LL | #![forbid(forbidden_lint_groups)]
| ^^^^^^^^^^^^^^^^^^^^^

View file

@ -1,4 +1,5 @@
//@ run-pass
//@ edition: 2021
// Ignore this test on Android, because it segfaults there.
//@ ignore-android
@ -32,10 +33,9 @@ fn main() {
.unwrap()
.as_os_str()
.as_bytes()).unwrap();
let new_env_var = CString::new("FOOBAR").unwrap();
let filename: *const c_char = current_exe.as_ptr();
let argv: &[*const c_char] = &[filename, filename, ptr::null()];
let envp: &[*const c_char] = &[new_env_var.as_ptr(), ptr::null()];
let envp: &[*const c_char] = &[c"FOOBAR".as_ptr(), ptr::null()];
unsafe {
execve(filename, &argv[0], &envp[0]);
}

View file

@ -29,6 +29,20 @@ LL | const _: u32 = T::C;
|
= note: a `const` is a separate item from the item that contains it
note: erroneous constant encountered
--> $DIR/generic-params-from-outer-item-in-const-item.rs:22:9
|
LL | I
| ^
note: erroneous constant encountered
--> $DIR/generic-params-from-outer-item-in-const-item.rs:22:9
|
LL | I
| ^
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 3 previous errors
For more information about this error, try `rustc --explain E0401`.

View file

@ -35,6 +35,20 @@ LL | const _: u32 = T::C;
|
= note: a `const` is a separate item from the item that contains it
note: erroneous constant encountered
--> $DIR/generic-params-from-outer-item-in-const-item.rs:22:9
|
LL | I
| ^
note: erroneous constant encountered
--> $DIR/generic-params-from-outer-item-in-const-item.rs:22:9
|
LL | I
| ^
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 3 previous errors
For more information about this error, try `rustc --explain E0401`.

View file

@ -20,6 +20,12 @@ LL - const M: usize = (f64::from(N) * std::f64::LOG10_2) as usize;
LL + const M: usize = (f64::from(N) * LOG10_2) as usize;
|
note: erroneous constant encountered
--> $DIR/issue-50599.rs:4:29
|
LL | let mut digits = [0u32; M];
| ^
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0425`.

View file

@ -6,5 +6,11 @@ LL | !let y = 42;
|
= note: only supported directly in conditions of `if` and `while` expressions
note: erroneous constant encountered
--> $DIR/avoid-invalid-mir.rs:11:13
|
LL | x: [(); N]
| ^
error: aborting due to 1 previous error

View file

@ -17,6 +17,12 @@ LL | const fn get<R: Deref<Target = Self>>(self: R) -> u32 {
LL | }
| - value is dropped here
note: erroneous constant encountered
--> $DIR/arbitrary-self-from-method-substs-ice.rs:24:5
|
LL | FOO;
| ^^^
error[E0801]: invalid generic `self` parameter type: `R`
--> $DIR/arbitrary-self-from-method-substs-ice.rs:10:49
|

View file

@ -9,6 +9,12 @@ help: consider using `let` instead of `const`
LL | let l: usize = v.count();
| ~~~
note: erroneous constant encountered
--> $DIR/type-dependent-def-issue-49241.rs:4:18
|
LL | let s: [u32; l] = v.into_iter().collect();
| ^
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0435`.