Auto merge of #134305 - matthiaskrgr:rollup-bja3lsz, r=matthiaskrgr
Rollup of 6 pull requests Successful merges: - #133221 (Add external macros specific diagnostics for check-cfg) - #133386 (Update linux_musl base to dynamically link the crt by default) - #134191 (Make some types and methods related to Polonius + Miri public) - #134227 (Update wasi-sdk used to build WASI targets) - #134279 ((Re-)return adjustment target if adjust kind is never-to-any) - #134295 (Encode coroutine-closures in SMIR) r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
commit
0aeaa5eb22
55 changed files with 593 additions and 73 deletions
|
@ -34,6 +34,25 @@ pub struct BorrowSet<'tcx> {
|
||||||
pub(crate) locals_state_at_exit: LocalsStateAtExit,
|
pub(crate) locals_state_at_exit: LocalsStateAtExit,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// These methods are public to support borrowck consumers.
|
||||||
|
impl<'tcx> BorrowSet<'tcx> {
|
||||||
|
pub fn location_map(&self) -> &FxIndexMap<Location, BorrowData<'tcx>> {
|
||||||
|
&self.location_map
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn activation_map(&self) -> &FxIndexMap<Location, Vec<BorrowIndex>> {
|
||||||
|
&self.activation_map
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn local_map(&self) -> &FxIndexMap<mir::Local, FxIndexSet<BorrowIndex>> {
|
||||||
|
&self.local_map
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn locals_state_at_exit(&self) -> &LocalsStateAtExit {
|
||||||
|
&self.locals_state_at_exit
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl<'tcx> Index<BorrowIndex> for BorrowSet<'tcx> {
|
impl<'tcx> Index<BorrowIndex> for BorrowSet<'tcx> {
|
||||||
type Output = BorrowData<'tcx>;
|
type Output = BorrowData<'tcx>;
|
||||||
|
|
||||||
|
@ -45,7 +64,7 @@ impl<'tcx> Index<BorrowIndex> for BorrowSet<'tcx> {
|
||||||
/// Location where a two-phase borrow is activated, if a borrow
|
/// Location where a two-phase borrow is activated, if a borrow
|
||||||
/// is in fact a two-phase borrow.
|
/// is in fact a two-phase borrow.
|
||||||
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
|
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
|
||||||
pub(crate) enum TwoPhaseActivation {
|
pub enum TwoPhaseActivation {
|
||||||
NotTwoPhase,
|
NotTwoPhase,
|
||||||
NotActivated,
|
NotActivated,
|
||||||
ActivatedAt(Location),
|
ActivatedAt(Location),
|
||||||
|
@ -68,6 +87,33 @@ pub struct BorrowData<'tcx> {
|
||||||
pub(crate) assigned_place: mir::Place<'tcx>,
|
pub(crate) assigned_place: mir::Place<'tcx>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// These methods are public to support borrowck consumers.
|
||||||
|
impl<'tcx> BorrowData<'tcx> {
|
||||||
|
pub fn reserve_location(&self) -> Location {
|
||||||
|
self.reserve_location
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn activation_location(&self) -> TwoPhaseActivation {
|
||||||
|
self.activation_location
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn kind(&self) -> mir::BorrowKind {
|
||||||
|
self.kind
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn region(&self) -> RegionVid {
|
||||||
|
self.region
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn borrowed_place(&self) -> mir::Place<'tcx> {
|
||||||
|
self.borrowed_place
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn assigned_place(&self) -> mir::Place<'tcx> {
|
||||||
|
self.assigned_place
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl<'tcx> fmt::Display for BorrowData<'tcx> {
|
impl<'tcx> fmt::Display for BorrowData<'tcx> {
|
||||||
fn fmt(&self, w: &mut fmt::Formatter<'_>) -> fmt::Result {
|
fn fmt(&self, w: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
let kind = match self.kind {
|
let kind = match self.kind {
|
||||||
|
@ -120,7 +166,7 @@ impl LocalsStateAtExit {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'tcx> BorrowSet<'tcx> {
|
impl<'tcx> BorrowSet<'tcx> {
|
||||||
pub(crate) fn build(
|
pub fn build(
|
||||||
tcx: TyCtxt<'tcx>,
|
tcx: TyCtxt<'tcx>,
|
||||||
body: &Body<'tcx>,
|
body: &Body<'tcx>,
|
||||||
locals_are_invalidated_at_exit: bool,
|
locals_are_invalidated_at_exit: bool,
|
||||||
|
|
|
@ -5,15 +5,15 @@ use rustc_index::{IndexSlice, IndexVec};
|
||||||
use rustc_middle::mir::{Body, Promoted};
|
use rustc_middle::mir::{Body, Promoted};
|
||||||
use rustc_middle::ty::TyCtxt;
|
use rustc_middle::ty::TyCtxt;
|
||||||
|
|
||||||
|
pub use super::borrow_set::{BorrowData, BorrowSet, TwoPhaseActivation};
|
||||||
pub use super::constraints::OutlivesConstraint;
|
pub use super::constraints::OutlivesConstraint;
|
||||||
pub use super::dataflow::{BorrowIndex, Borrows, calculate_borrows_out_of_scope_at_location};
|
pub use super::dataflow::{BorrowIndex, Borrows, calculate_borrows_out_of_scope_at_location};
|
||||||
pub use super::facts::{AllFacts as PoloniusInput, RustcFacts};
|
pub use super::facts::{AllFacts as PoloniusInput, PoloniusRegionVid, RustcFacts};
|
||||||
pub use super::location::{LocationTable, RichLocation};
|
pub use super::location::{LocationTable, RichLocation};
|
||||||
pub use super::nll::PoloniusOutput;
|
pub use super::nll::PoloniusOutput;
|
||||||
pub use super::place_ext::PlaceExt;
|
pub use super::place_ext::PlaceExt;
|
||||||
pub use super::places_conflict::{PlaceConflictBias, places_conflict};
|
pub use super::places_conflict::{PlaceConflictBias, places_conflict};
|
||||||
pub use super::region_infer::RegionInferenceContext;
|
pub use super::region_infer::RegionInferenceContext;
|
||||||
use crate::borrow_set::BorrowSet;
|
|
||||||
|
|
||||||
/// Options determining the output behavior of [`get_body_with_borrowck_facts`].
|
/// Options determining the output behavior of [`get_body_with_borrowck_facts`].
|
||||||
///
|
///
|
||||||
|
|
|
@ -540,10 +540,14 @@ pub trait Machine<'tcx>: Sized {
|
||||||
interp_ok(ReturnAction::Normal)
|
interp_ok(ReturnAction::Normal)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Called immediately after an "immediate" local variable is read
|
/// Called immediately after an "immediate" local variable is read in a given frame
|
||||||
/// (i.e., this is called for reads that do not end up accessing addressable memory).
|
/// (i.e., this is called for reads that do not end up accessing addressable memory).
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
fn after_local_read(_ecx: &InterpCx<'tcx, Self>, _local: mir::Local) -> InterpResult<'tcx> {
|
fn after_local_read(
|
||||||
|
_ecx: &InterpCx<'tcx, Self>,
|
||||||
|
_frame: &Frame<'tcx, Self::Provenance, Self::FrameExtra>,
|
||||||
|
_local: mir::Local,
|
||||||
|
) -> InterpResult<'tcx> {
|
||||||
interp_ok(())
|
interp_ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,9 +15,9 @@ use rustc_middle::{bug, mir, span_bug, ty};
|
||||||
use tracing::trace;
|
use tracing::trace;
|
||||||
|
|
||||||
use super::{
|
use super::{
|
||||||
CtfeProvenance, InterpCx, InterpResult, MPlaceTy, Machine, MemPlace, MemPlaceMeta, OffsetMode,
|
CtfeProvenance, Frame, InterpCx, InterpResult, MPlaceTy, Machine, MemPlace, MemPlaceMeta,
|
||||||
PlaceTy, Pointer, Projectable, Provenance, Scalar, alloc_range, err_ub, from_known_layout,
|
OffsetMode, PlaceTy, Pointer, Projectable, Provenance, Scalar, alloc_range, err_ub,
|
||||||
interp_ok, mir_assign_valid_types, throw_ub,
|
from_known_layout, interp_ok, mir_assign_valid_types, throw_ub,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// An `Immediate` represents a single immediate self-contained Rust value.
|
/// An `Immediate` represents a single immediate self-contained Rust value.
|
||||||
|
@ -708,23 +708,32 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
|
||||||
interp_ok(str)
|
interp_ok(str)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Read from a local of the current frame.
|
/// Read from a local of the current frame. Convenience method for [`InterpCx::local_at_frame_to_op`].
|
||||||
/// Will not access memory, instead an indirect `Operand` is returned.
|
|
||||||
///
|
|
||||||
/// This is public because it is used by [priroda](https://github.com/oli-obk/priroda) to get an
|
|
||||||
/// OpTy from a local.
|
|
||||||
pub fn local_to_op(
|
pub fn local_to_op(
|
||||||
&self,
|
&self,
|
||||||
local: mir::Local,
|
local: mir::Local,
|
||||||
layout: Option<TyAndLayout<'tcx>>,
|
layout: Option<TyAndLayout<'tcx>>,
|
||||||
) -> InterpResult<'tcx, OpTy<'tcx, M::Provenance>> {
|
) -> InterpResult<'tcx, OpTy<'tcx, M::Provenance>> {
|
||||||
let frame = self.frame();
|
self.local_at_frame_to_op(self.frame(), local, layout)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Read from a local of a given frame.
|
||||||
|
/// Will not access memory, instead an indirect `Operand` is returned.
|
||||||
|
///
|
||||||
|
/// This is public because it is used by [Aquascope](https://github.com/cognitive-engineering-lab/aquascope/)
|
||||||
|
/// to get an OpTy from a local.
|
||||||
|
pub fn local_at_frame_to_op(
|
||||||
|
&self,
|
||||||
|
frame: &Frame<'tcx, M::Provenance, M::FrameExtra>,
|
||||||
|
local: mir::Local,
|
||||||
|
layout: Option<TyAndLayout<'tcx>>,
|
||||||
|
) -> InterpResult<'tcx, OpTy<'tcx, M::Provenance>> {
|
||||||
let layout = self.layout_of_local(frame, local, layout)?;
|
let layout = self.layout_of_local(frame, local, layout)?;
|
||||||
let op = *frame.locals[local].access()?;
|
let op = *frame.locals[local].access()?;
|
||||||
if matches!(op, Operand::Immediate(_)) {
|
if matches!(op, Operand::Immediate(_)) {
|
||||||
assert!(!layout.is_unsized());
|
assert!(!layout.is_unsized());
|
||||||
}
|
}
|
||||||
M::after_local_read(self, local)?;
|
M::after_local_read(self, frame, local)?;
|
||||||
interp_ok(OpTy { op, layout })
|
interp_ok(OpTy { op, layout })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -584,8 +584,10 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
|
||||||
interp_ok(())
|
interp_ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// This is public because it is used by [Aquascope](https://github.com/cognitive-engineering-lab/aquascope/)
|
||||||
|
/// to analyze all the locals in a stack frame.
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
pub(super) fn layout_of_local(
|
pub fn layout_of_local(
|
||||||
&self,
|
&self,
|
||||||
frame: &Frame<'tcx, M::Provenance, M::FrameExtra>,
|
frame: &Frame<'tcx, M::Provenance, M::FrameExtra>,
|
||||||
local: mir::Local,
|
local: mir::Local,
|
||||||
|
|
|
@ -72,12 +72,17 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
if self.try_structurally_resolve_type(expr.span, ty).is_never()
|
if self.try_structurally_resolve_type(expr.span, ty).is_never()
|
||||||
&& self.expr_guaranteed_to_constitute_read_for_never(expr)
|
&& self.expr_guaranteed_to_constitute_read_for_never(expr)
|
||||||
{
|
{
|
||||||
if let Some(_) = self.typeck_results.borrow().adjustments().get(expr.hir_id) {
|
if let Some(adjustments) = self.typeck_results.borrow().adjustments().get(expr.hir_id) {
|
||||||
let reported = self.dcx().span_delayed_bug(
|
let reported = self.dcx().span_delayed_bug(
|
||||||
expr.span,
|
expr.span,
|
||||||
"expression with never type wound up being adjusted",
|
"expression with never type wound up being adjusted",
|
||||||
);
|
);
|
||||||
return Ty::new_error(self.tcx(), reported);
|
|
||||||
|
return if let [Adjustment { kind: Adjust::NeverToAny, target }] = &adjustments[..] {
|
||||||
|
target.to_owned()
|
||||||
|
} else {
|
||||||
|
Ty::new_error(self.tcx(), reported)
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
let adj_ty = self.next_ty_var(expr.span);
|
let adj_ty = self.next_ty_var(expr.span);
|
||||||
|
|
|
@ -806,10 +806,14 @@ lint_unexpected_cfg_add_build_rs_println = or consider adding `{$build_rs_printl
|
||||||
lint_unexpected_cfg_add_cargo_feature = consider using a Cargo feature instead
|
lint_unexpected_cfg_add_cargo_feature = consider using a Cargo feature instead
|
||||||
lint_unexpected_cfg_add_cargo_toml_lint_cfg = or consider adding in `Cargo.toml` the `check-cfg` lint config for the lint:{$cargo_toml_lint_cfg}
|
lint_unexpected_cfg_add_cargo_toml_lint_cfg = or consider adding in `Cargo.toml` the `check-cfg` lint config for the lint:{$cargo_toml_lint_cfg}
|
||||||
lint_unexpected_cfg_add_cmdline_arg = to expect this configuration use `{$cmdline_arg}`
|
lint_unexpected_cfg_add_cmdline_arg = to expect this configuration use `{$cmdline_arg}`
|
||||||
|
lint_unexpected_cfg_cargo_update = the {$macro_kind} `{$macro_name}` may come from an old version of it's defining crate, try updating your dependencies with `cargo update`
|
||||||
|
|
||||||
lint_unexpected_cfg_define_features = consider defining some features in `Cargo.toml`
|
lint_unexpected_cfg_define_features = consider defining some features in `Cargo.toml`
|
||||||
lint_unexpected_cfg_doc_cargo = see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration
|
lint_unexpected_cfg_doc_cargo = see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration
|
||||||
lint_unexpected_cfg_doc_rustc = see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration
|
lint_unexpected_cfg_doc_rustc = see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration
|
||||||
|
|
||||||
|
lint_unexpected_cfg_from_external_macro_origin = using a cfg inside a {$macro_kind} will use the cfgs from the destination crate and not the ones from the defining crate
|
||||||
|
lint_unexpected_cfg_from_external_macro_refer = try refering to `{$macro_name}` crate for guidance on how handle this unexpected cfg
|
||||||
lint_unexpected_cfg_name = unexpected `cfg` condition name: `{$name}`
|
lint_unexpected_cfg_name = unexpected `cfg` condition name: `{$name}`
|
||||||
lint_unexpected_cfg_name_expected_names = expected names are: {$possibilities}{$and_more ->
|
lint_unexpected_cfg_name_expected_names = expected names are: {$possibilities}{$and_more ->
|
||||||
[0] {""}
|
[0] {""}
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
|
use rustc_hir::def_id::LOCAL_CRATE;
|
||||||
use rustc_middle::bug;
|
use rustc_middle::bug;
|
||||||
use rustc_session::Session;
|
use rustc_session::Session;
|
||||||
use rustc_session::config::ExpectedValues;
|
use rustc_session::config::ExpectedValues;
|
||||||
use rustc_span::edit_distance::find_best_match_for_name;
|
use rustc_span::edit_distance::find_best_match_for_name;
|
||||||
use rustc_span::symbol::Ident;
|
use rustc_span::symbol::Ident;
|
||||||
use rustc_span::{Span, Symbol, sym};
|
use rustc_span::{ExpnKind, Span, Symbol, sym};
|
||||||
|
|
||||||
use crate::lints;
|
use crate::lints;
|
||||||
|
|
||||||
|
@ -60,6 +61,35 @@ fn cargo_help_sub(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn rustc_macro_help(span: Span) -> Option<lints::UnexpectedCfgRustcMacroHelp> {
|
||||||
|
let oexpn = span.ctxt().outer_expn_data();
|
||||||
|
if let Some(def_id) = oexpn.macro_def_id
|
||||||
|
&& let ExpnKind::Macro(macro_kind, macro_name) = oexpn.kind
|
||||||
|
&& def_id.krate != LOCAL_CRATE
|
||||||
|
{
|
||||||
|
Some(lints::UnexpectedCfgRustcMacroHelp { macro_kind: macro_kind.descr(), macro_name })
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn cargo_macro_help(span: Span) -> Option<lints::UnexpectedCfgCargoMacroHelp> {
|
||||||
|
let oexpn = span.ctxt().outer_expn_data();
|
||||||
|
if let Some(def_id) = oexpn.macro_def_id
|
||||||
|
&& let ExpnKind::Macro(macro_kind, macro_name) = oexpn.kind
|
||||||
|
&& def_id.krate != LOCAL_CRATE
|
||||||
|
{
|
||||||
|
Some(lints::UnexpectedCfgCargoMacroHelp {
|
||||||
|
macro_kind: macro_kind.descr(),
|
||||||
|
macro_name,
|
||||||
|
// FIXME: Get access to a `TyCtxt` from an `EarlyContext`
|
||||||
|
// crate_name: cx.tcx.crate_name(def_id.krate),
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub(super) fn unexpected_cfg_name(
|
pub(super) fn unexpected_cfg_name(
|
||||||
sess: &Session,
|
sess: &Session,
|
||||||
(name, name_span): (Symbol, Span),
|
(name, name_span): (Symbol, Span),
|
||||||
|
@ -85,6 +115,7 @@ pub(super) fn unexpected_cfg_name(
|
||||||
};
|
};
|
||||||
|
|
||||||
let is_from_cargo = rustc_session::utils::was_invoked_from_cargo();
|
let is_from_cargo = rustc_session::utils::was_invoked_from_cargo();
|
||||||
|
let is_from_external_macro = rustc_middle::lint::in_external_macro(sess, name_span);
|
||||||
let mut is_feature_cfg = name == sym::feature;
|
let mut is_feature_cfg = name == sym::feature;
|
||||||
|
|
||||||
let code_sugg = if is_feature_cfg && is_from_cargo {
|
let code_sugg = if is_feature_cfg && is_from_cargo {
|
||||||
|
@ -185,12 +216,21 @@ pub(super) fn unexpected_cfg_name(
|
||||||
};
|
};
|
||||||
|
|
||||||
let invocation_help = if is_from_cargo {
|
let invocation_help = if is_from_cargo {
|
||||||
let sub = if !is_feature_cfg { Some(cargo_help_sub(sess, &inst)) } else { None };
|
let help = if !is_feature_cfg && !is_from_external_macro {
|
||||||
lints::unexpected_cfg_name::InvocationHelp::Cargo { sub }
|
Some(cargo_help_sub(sess, &inst))
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
};
|
||||||
|
lints::unexpected_cfg_name::InvocationHelp::Cargo {
|
||||||
|
help,
|
||||||
|
macro_help: cargo_macro_help(name_span),
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
lints::unexpected_cfg_name::InvocationHelp::Rustc(lints::UnexpectedCfgRustcHelp::new(
|
let help = lints::UnexpectedCfgRustcHelp::new(&inst(EscapeQuotes::No));
|
||||||
&inst(EscapeQuotes::No),
|
lints::unexpected_cfg_name::InvocationHelp::Rustc {
|
||||||
))
|
help,
|
||||||
|
macro_help: rustc_macro_help(name_span),
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
lints::UnexpectedCfgName { code_sugg, invocation_help, name }
|
lints::UnexpectedCfgName { code_sugg, invocation_help, name }
|
||||||
|
@ -216,7 +256,9 @@ pub(super) fn unexpected_cfg_value(
|
||||||
.copied()
|
.copied()
|
||||||
.flatten()
|
.flatten()
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
let is_from_cargo = rustc_session::utils::was_invoked_from_cargo();
|
let is_from_cargo = rustc_session::utils::was_invoked_from_cargo();
|
||||||
|
let is_from_external_macro = rustc_middle::lint::in_external_macro(sess, name_span);
|
||||||
|
|
||||||
// Show the full list if all possible values for a given name, but don't do it
|
// Show the full list if all possible values for a given name, but don't do it
|
||||||
// for names as the possibilities could be very long
|
// for names as the possibilities could be very long
|
||||||
|
@ -284,25 +326,31 @@ pub(super) fn unexpected_cfg_value(
|
||||||
};
|
};
|
||||||
|
|
||||||
let invocation_help = if is_from_cargo {
|
let invocation_help = if is_from_cargo {
|
||||||
let help = if name == sym::feature {
|
let help = if name == sym::feature && !is_from_external_macro {
|
||||||
if let Some((value, _value_span)) = value {
|
if let Some((value, _value_span)) = value {
|
||||||
Some(lints::unexpected_cfg_value::CargoHelp::AddFeature { value })
|
Some(lints::unexpected_cfg_value::CargoHelp::AddFeature { value })
|
||||||
} else {
|
} else {
|
||||||
Some(lints::unexpected_cfg_value::CargoHelp::DefineFeatures)
|
Some(lints::unexpected_cfg_value::CargoHelp::DefineFeatures)
|
||||||
}
|
}
|
||||||
} else if can_suggest_adding_value {
|
} else if can_suggest_adding_value && !is_from_external_macro {
|
||||||
Some(lints::unexpected_cfg_value::CargoHelp::Other(cargo_help_sub(sess, &inst)))
|
Some(lints::unexpected_cfg_value::CargoHelp::Other(cargo_help_sub(sess, &inst)))
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
};
|
};
|
||||||
lints::unexpected_cfg_value::InvocationHelp::Cargo(help)
|
lints::unexpected_cfg_value::InvocationHelp::Cargo {
|
||||||
|
help,
|
||||||
|
macro_help: cargo_macro_help(name_span),
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
let help = if can_suggest_adding_value {
|
let help = if can_suggest_adding_value {
|
||||||
Some(lints::UnexpectedCfgRustcHelp::new(&inst(EscapeQuotes::No)))
|
Some(lints::UnexpectedCfgRustcHelp::new(&inst(EscapeQuotes::No)))
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
};
|
};
|
||||||
lints::unexpected_cfg_value::InvocationHelp::Rustc(help)
|
lints::unexpected_cfg_value::InvocationHelp::Rustc {
|
||||||
|
help,
|
||||||
|
macro_help: rustc_macro_help(name_span),
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
lints::UnexpectedCfgValue {
|
lints::UnexpectedCfgValue {
|
||||||
|
|
|
@ -2172,6 +2172,25 @@ impl UnexpectedCfgRustcHelp {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Subdiagnostic)]
|
||||||
|
#[note(lint_unexpected_cfg_from_external_macro_origin)]
|
||||||
|
#[help(lint_unexpected_cfg_from_external_macro_refer)]
|
||||||
|
pub(crate) struct UnexpectedCfgRustcMacroHelp {
|
||||||
|
pub macro_kind: &'static str,
|
||||||
|
pub macro_name: Symbol,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Subdiagnostic)]
|
||||||
|
#[note(lint_unexpected_cfg_from_external_macro_origin)]
|
||||||
|
#[help(lint_unexpected_cfg_from_external_macro_refer)]
|
||||||
|
#[help(lint_unexpected_cfg_cargo_update)]
|
||||||
|
pub(crate) struct UnexpectedCfgCargoMacroHelp {
|
||||||
|
pub macro_kind: &'static str,
|
||||||
|
pub macro_name: Symbol,
|
||||||
|
// FIXME: Figure out a way to get the crate name
|
||||||
|
// crate_name: String,
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(LintDiagnostic)]
|
#[derive(LintDiagnostic)]
|
||||||
#[diag(lint_unexpected_cfg_name)]
|
#[diag(lint_unexpected_cfg_name)]
|
||||||
pub(crate) struct UnexpectedCfgName {
|
pub(crate) struct UnexpectedCfgName {
|
||||||
|
@ -2276,10 +2295,17 @@ pub(crate) mod unexpected_cfg_name {
|
||||||
#[note(lint_unexpected_cfg_doc_cargo)]
|
#[note(lint_unexpected_cfg_doc_cargo)]
|
||||||
Cargo {
|
Cargo {
|
||||||
#[subdiagnostic]
|
#[subdiagnostic]
|
||||||
sub: Option<super::UnexpectedCfgCargoHelp>,
|
macro_help: Option<super::UnexpectedCfgCargoMacroHelp>,
|
||||||
|
#[subdiagnostic]
|
||||||
|
help: Option<super::UnexpectedCfgCargoHelp>,
|
||||||
},
|
},
|
||||||
#[note(lint_unexpected_cfg_doc_rustc)]
|
#[note(lint_unexpected_cfg_doc_rustc)]
|
||||||
Rustc(#[subdiagnostic] super::UnexpectedCfgRustcHelp),
|
Rustc {
|
||||||
|
#[subdiagnostic]
|
||||||
|
macro_help: Option<super::UnexpectedCfgRustcMacroHelp>,
|
||||||
|
#[subdiagnostic]
|
||||||
|
help: super::UnexpectedCfgRustcHelp,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2382,9 +2408,19 @@ pub(crate) mod unexpected_cfg_value {
|
||||||
#[derive(Subdiagnostic)]
|
#[derive(Subdiagnostic)]
|
||||||
pub(crate) enum InvocationHelp {
|
pub(crate) enum InvocationHelp {
|
||||||
#[note(lint_unexpected_cfg_doc_cargo)]
|
#[note(lint_unexpected_cfg_doc_cargo)]
|
||||||
Cargo(#[subdiagnostic] Option<CargoHelp>),
|
Cargo {
|
||||||
|
#[subdiagnostic]
|
||||||
|
help: Option<CargoHelp>,
|
||||||
|
#[subdiagnostic]
|
||||||
|
macro_help: Option<super::UnexpectedCfgCargoMacroHelp>,
|
||||||
|
},
|
||||||
#[note(lint_unexpected_cfg_doc_rustc)]
|
#[note(lint_unexpected_cfg_doc_rustc)]
|
||||||
Rustc(#[subdiagnostic] Option<super::UnexpectedCfgRustcHelp>),
|
Rustc {
|
||||||
|
#[subdiagnostic]
|
||||||
|
help: Option<super::UnexpectedCfgRustcHelp>,
|
||||||
|
#[subdiagnostic]
|
||||||
|
macro_help: Option<super::UnexpectedCfgRustcMacroHelp>,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Subdiagnostic)]
|
#[derive(Subdiagnostic)]
|
||||||
|
|
|
@ -141,6 +141,10 @@ impl RustcInternal for RigidTy {
|
||||||
RigidTy::Coroutine(def, args, _mov) => {
|
RigidTy::Coroutine(def, args, _mov) => {
|
||||||
rustc_ty::TyKind::Coroutine(def.0.internal(tables, tcx), args.internal(tables, tcx))
|
rustc_ty::TyKind::Coroutine(def.0.internal(tables, tcx), args.internal(tables, tcx))
|
||||||
}
|
}
|
||||||
|
RigidTy::CoroutineClosure(def, args) => rustc_ty::TyKind::CoroutineClosure(
|
||||||
|
def.0.internal(tables, tcx),
|
||||||
|
args.internal(tables, tcx),
|
||||||
|
),
|
||||||
RigidTy::CoroutineWitness(def, args) => rustc_ty::TyKind::CoroutineWitness(
|
RigidTy::CoroutineWitness(def, args) => rustc_ty::TyKind::CoroutineWitness(
|
||||||
def.0.internal(tables, tcx),
|
def.0.internal(tables, tcx),
|
||||||
args.internal(tables, tcx),
|
args.internal(tables, tcx),
|
||||||
|
|
|
@ -107,6 +107,10 @@ impl<'tcx> Tables<'tcx> {
|
||||||
stable_mir::ty::CoroutineDef(self.create_def_id(did))
|
stable_mir::ty::CoroutineDef(self.create_def_id(did))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn coroutine_closure_def(&mut self, did: DefId) -> stable_mir::ty::CoroutineClosureDef {
|
||||||
|
stable_mir::ty::CoroutineClosureDef(self.create_def_id(did))
|
||||||
|
}
|
||||||
|
|
||||||
pub fn alias_def(&mut self, did: DefId) -> stable_mir::ty::AliasDef {
|
pub fn alias_def(&mut self, did: DefId) -> stable_mir::ty::AliasDef {
|
||||||
stable_mir::ty::AliasDef(self.create_def_id(did))
|
stable_mir::ty::AliasDef(self.create_def_id(did))
|
||||||
}
|
}
|
||||||
|
|
|
@ -565,8 +565,11 @@ impl<'tcx> Stable<'tcx> for mir::AggregateKind<'tcx> {
|
||||||
tables.tcx.coroutine_movability(*def_id).stable(tables),
|
tables.tcx.coroutine_movability(*def_id).stable(tables),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
mir::AggregateKind::CoroutineClosure(..) => {
|
mir::AggregateKind::CoroutineClosure(def_id, generic_args) => {
|
||||||
todo!("FIXME(async_closures): Lower these to SMIR")
|
stable_mir::mir::AggregateKind::CoroutineClosure(
|
||||||
|
tables.coroutine_closure_def(*def_id),
|
||||||
|
generic_args.stable(tables),
|
||||||
|
)
|
||||||
}
|
}
|
||||||
mir::AggregateKind::RawPtr(ty, mutability) => {
|
mir::AggregateKind::RawPtr(ty, mutability) => {
|
||||||
stable_mir::mir::AggregateKind::RawPtr(ty.stable(tables), mutability.stable(tables))
|
stable_mir::mir::AggregateKind::RawPtr(ty.stable(tables), mutability.stable(tables))
|
||||||
|
|
|
@ -8,8 +8,5 @@ pub(crate) fn opts() -> TargetOptions {
|
||||||
base.post_link_objects_self_contained = crt_objects::post_musl_self_contained();
|
base.post_link_objects_self_contained = crt_objects::post_musl_self_contained();
|
||||||
base.link_self_contained = LinkSelfContainedDefault::InferredForMusl;
|
base.link_self_contained = LinkSelfContainedDefault::InferredForMusl;
|
||||||
|
|
||||||
// These targets statically link libc by default
|
|
||||||
base.crt_static_default = true;
|
|
||||||
|
|
||||||
base
|
base
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,9 @@ pub(crate) fn target() -> Target {
|
||||||
| SanitizerSet::MEMORY
|
| SanitizerSet::MEMORY
|
||||||
| SanitizerSet::THREAD;
|
| SanitizerSet::THREAD;
|
||||||
|
|
||||||
|
// FIXME(compiler-team#422): musl targets should be dynamically linked by default.
|
||||||
|
base.crt_static_default = true;
|
||||||
|
|
||||||
Target {
|
Target {
|
||||||
llvm_target: "aarch64-unknown-linux-musl".into(),
|
llvm_target: "aarch64-unknown-linux-musl".into(),
|
||||||
metadata: crate::spec::TargetMetadata {
|
metadata: crate::spec::TargetMetadata {
|
||||||
|
|
|
@ -22,6 +22,8 @@ pub(crate) fn target() -> Target {
|
||||||
features: "+strict-align,+v6".into(),
|
features: "+strict-align,+v6".into(),
|
||||||
max_atomic_width: Some(64),
|
max_atomic_width: Some(64),
|
||||||
mcount: "\u{1}mcount".into(),
|
mcount: "\u{1}mcount".into(),
|
||||||
|
// FIXME(compiler-team#422): musl targets should be dynamically linked by default.
|
||||||
|
crt_static_default: true,
|
||||||
..base::linux_musl::opts()
|
..base::linux_musl::opts()
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,8 @@ pub(crate) fn target() -> Target {
|
||||||
features: "+strict-align,+v6,+vfp2,-d32".into(),
|
features: "+strict-align,+v6,+vfp2,-d32".into(),
|
||||||
max_atomic_width: Some(64),
|
max_atomic_width: Some(64),
|
||||||
mcount: "\u{1}mcount".into(),
|
mcount: "\u{1}mcount".into(),
|
||||||
|
// FIXME(compiler-team#422): musl targets should be dynamically linked by default.
|
||||||
|
crt_static_default: true,
|
||||||
..base::linux_musl::opts()
|
..base::linux_musl::opts()
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,8 @@ pub(crate) fn target() -> Target {
|
||||||
max_atomic_width: Some(32),
|
max_atomic_width: Some(32),
|
||||||
mcount: "\u{1}mcount".into(),
|
mcount: "\u{1}mcount".into(),
|
||||||
has_thumb_interworking: true,
|
has_thumb_interworking: true,
|
||||||
|
// FIXME(compiler-team#422): musl targets should be dynamically linked by default.
|
||||||
|
crt_static_default: true,
|
||||||
..base::linux_musl::opts()
|
..base::linux_musl::opts()
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,8 @@ pub(crate) fn target() -> Target {
|
||||||
features: "+v7,+thumb2,+soft-float,-neon".into(),
|
features: "+v7,+thumb2,+soft-float,-neon".into(),
|
||||||
max_atomic_width: Some(64),
|
max_atomic_width: Some(64),
|
||||||
mcount: "\u{1}mcount".into(),
|
mcount: "\u{1}mcount".into(),
|
||||||
|
// FIXME(compiler-team#422): musl targets should be dynamically linked by default.
|
||||||
|
crt_static_default: true,
|
||||||
..base::linux_musl::opts()
|
..base::linux_musl::opts()
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,8 @@ pub(crate) fn target() -> Target {
|
||||||
features: "+v7,+vfp3,-d32,+thumb2,-neon".into(),
|
features: "+v7,+vfp3,-d32,+thumb2,-neon".into(),
|
||||||
max_atomic_width: Some(64),
|
max_atomic_width: Some(64),
|
||||||
mcount: "\u{1}mcount".into(),
|
mcount: "\u{1}mcount".into(),
|
||||||
|
// FIXME(compiler-team#422): musl targets should be dynamically linked by default.
|
||||||
|
crt_static_default: true,
|
||||||
..base::linux_musl::opts()
|
..base::linux_musl::opts()
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,5 +4,7 @@ pub(crate) fn target() -> Target {
|
||||||
let mut base = super::i686_unknown_linux_musl::target();
|
let mut base = super::i686_unknown_linux_musl::target();
|
||||||
base.cpu = "pentium".into();
|
base.cpu = "pentium".into();
|
||||||
base.llvm_target = "i586-unknown-linux-musl".into();
|
base.llvm_target = "i586-unknown-linux-musl".into();
|
||||||
|
// FIXME(compiler-team#422): musl targets should be dynamically linked by default.
|
||||||
|
base.crt_static_default = true;
|
||||||
base
|
base
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,8 @@ pub(crate) fn target() -> Target {
|
||||||
base.max_atomic_width = Some(64);
|
base.max_atomic_width = Some(64);
|
||||||
base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m32", "-Wl,-melf_i386"]);
|
base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m32", "-Wl,-melf_i386"]);
|
||||||
base.stack_probes = StackProbeType::Inline;
|
base.stack_probes = StackProbeType::Inline;
|
||||||
|
// FIXME(compiler-team#422): musl targets should be dynamically linked by default.
|
||||||
|
base.crt_static_default = true;
|
||||||
|
|
||||||
// The unwinder used by i686-unknown-linux-musl, the LLVM libunwind
|
// The unwinder used by i686-unknown-linux-musl, the LLVM libunwind
|
||||||
// implementation, apparently relies on frame pointers existing... somehow.
|
// implementation, apparently relies on frame pointers existing... somehow.
|
||||||
|
|
|
@ -8,7 +8,6 @@ pub(crate) fn target() -> Target {
|
||||||
base.cpu = "mips64r2".into();
|
base.cpu = "mips64r2".into();
|
||||||
base.features = "+mips64r2,+soft-float".into();
|
base.features = "+mips64r2,+soft-float".into();
|
||||||
base.max_atomic_width = Some(64);
|
base.max_atomic_width = Some(64);
|
||||||
base.crt_static_default = false;
|
|
||||||
|
|
||||||
Target {
|
Target {
|
||||||
// LLVM doesn't recognize "muslabi64" yet.
|
// LLVM doesn't recognize "muslabi64" yet.
|
||||||
|
|
|
@ -22,6 +22,8 @@ pub(crate) fn target() -> Target {
|
||||||
abi: "abi64".into(),
|
abi: "abi64".into(),
|
||||||
endian: Endian::Big,
|
endian: Endian::Big,
|
||||||
mcount: "_mcount".into(),
|
mcount: "_mcount".into(),
|
||||||
|
// FIXME(compiler-team#422): musl targets should be dynamically linked by default.
|
||||||
|
crt_static_default: true,
|
||||||
..base
|
..base
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,8 @@ pub(crate) fn target() -> Target {
|
||||||
base.cpu = "mips64r2".into();
|
base.cpu = "mips64r2".into();
|
||||||
base.features = "+mips64r2".into();
|
base.features = "+mips64r2".into();
|
||||||
base.max_atomic_width = Some(64);
|
base.max_atomic_width = Some(64);
|
||||||
|
// FIXME(compiler-team#422): musl targets should be dynamically linked by default.
|
||||||
|
base.crt_static_default = true;
|
||||||
Target {
|
Target {
|
||||||
// LLVM doesn't recognize "muslabi64" yet.
|
// LLVM doesn't recognize "muslabi64" yet.
|
||||||
llvm_target: "mips64el-unknown-linux-musl".into(),
|
llvm_target: "mips64el-unknown-linux-musl".into(),
|
||||||
|
|
|
@ -6,7 +6,6 @@ pub(crate) fn target() -> Target {
|
||||||
base.cpu = "mips32r2".into();
|
base.cpu = "mips32r2".into();
|
||||||
base.features = "+mips32r2,+soft-float".into();
|
base.features = "+mips32r2,+soft-float".into();
|
||||||
base.max_atomic_width = Some(32);
|
base.max_atomic_width = Some(32);
|
||||||
base.crt_static_default = false;
|
|
||||||
Target {
|
Target {
|
||||||
llvm_target: "mips-unknown-linux-musl".into(),
|
llvm_target: "mips-unknown-linux-musl".into(),
|
||||||
metadata: crate::spec::TargetMetadata {
|
metadata: crate::spec::TargetMetadata {
|
||||||
|
|
|
@ -5,7 +5,6 @@ pub(crate) fn target() -> Target {
|
||||||
base.cpu = "mips32r2".into();
|
base.cpu = "mips32r2".into();
|
||||||
base.features = "+mips32r2,+soft-float".into();
|
base.features = "+mips32r2,+soft-float".into();
|
||||||
base.max_atomic_width = Some(32);
|
base.max_atomic_width = Some(32);
|
||||||
base.crt_static_default = false;
|
|
||||||
Target {
|
Target {
|
||||||
llvm_target: "mipsel-unknown-linux-musl".into(),
|
llvm_target: "mipsel-unknown-linux-musl".into(),
|
||||||
metadata: crate::spec::TargetMetadata {
|
metadata: crate::spec::TargetMetadata {
|
||||||
|
|
|
@ -7,6 +7,8 @@ pub(crate) fn target() -> Target {
|
||||||
base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m64"]);
|
base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m64"]);
|
||||||
base.max_atomic_width = Some(64);
|
base.max_atomic_width = Some(64);
|
||||||
base.stack_probes = StackProbeType::Inline;
|
base.stack_probes = StackProbeType::Inline;
|
||||||
|
// FIXME(compiler-team#422): musl targets should be dynamically linked by default.
|
||||||
|
base.crt_static_default = true;
|
||||||
|
|
||||||
Target {
|
Target {
|
||||||
llvm_target: "powerpc64-unknown-linux-musl".into(),
|
llvm_target: "powerpc64-unknown-linux-musl".into(),
|
||||||
|
|
|
@ -6,6 +6,8 @@ pub(crate) fn target() -> Target {
|
||||||
base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m64"]);
|
base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m64"]);
|
||||||
base.max_atomic_width = Some(64);
|
base.max_atomic_width = Some(64);
|
||||||
base.stack_probes = StackProbeType::Inline;
|
base.stack_probes = StackProbeType::Inline;
|
||||||
|
// FIXME(compiler-team#422): musl targets should be dynamically linked by default.
|
||||||
|
base.crt_static_default = true;
|
||||||
|
|
||||||
Target {
|
Target {
|
||||||
llvm_target: "powerpc64le-unknown-linux-musl".into(),
|
llvm_target: "powerpc64le-unknown-linux-musl".into(),
|
||||||
|
|
|
@ -6,6 +6,8 @@ pub(crate) fn target() -> Target {
|
||||||
base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m32"]);
|
base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m32"]);
|
||||||
base.max_atomic_width = Some(32);
|
base.max_atomic_width = Some(32);
|
||||||
base.stack_probes = StackProbeType::Inline;
|
base.stack_probes = StackProbeType::Inline;
|
||||||
|
// FIXME(compiler-team#422): musl targets should be dynamically linked by default.
|
||||||
|
base.crt_static_default = true;
|
||||||
|
|
||||||
Target {
|
Target {
|
||||||
llvm_target: "powerpc-unknown-linux-musl".into(),
|
llvm_target: "powerpc-unknown-linux-musl".into(),
|
||||||
|
|
|
@ -6,6 +6,8 @@ pub(crate) fn target() -> Target {
|
||||||
base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-mspe"]);
|
base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-mspe"]);
|
||||||
base.max_atomic_width = Some(32);
|
base.max_atomic_width = Some(32);
|
||||||
base.stack_probes = StackProbeType::Inline;
|
base.stack_probes = StackProbeType::Inline;
|
||||||
|
// FIXME(compiler-team#422): musl targets should be dynamically linked by default.
|
||||||
|
base.crt_static_default = true;
|
||||||
|
|
||||||
Target {
|
Target {
|
||||||
llvm_target: "powerpc-unknown-linux-muslspe".into(),
|
llvm_target: "powerpc-unknown-linux-muslspe".into(),
|
||||||
|
|
|
@ -23,6 +23,8 @@ pub(crate) fn target() -> Target {
|
||||||
llvm_abiname: "ilp32d".into(),
|
llvm_abiname: "ilp32d".into(),
|
||||||
max_atomic_width: Some(32),
|
max_atomic_width: Some(32),
|
||||||
supported_split_debuginfo: Cow::Borrowed(&[SplitDebuginfo::Off]),
|
supported_split_debuginfo: Cow::Borrowed(&[SplitDebuginfo::Off]),
|
||||||
|
// FIXME(compiler-team#422): musl targets should be dynamically linked by default.
|
||||||
|
crt_static_default: true,
|
||||||
..base::linux_musl::opts()
|
..base::linux_musl::opts()
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,6 @@ pub(crate) fn target() -> Target {
|
||||||
llvm_abiname: "lp64d".into(),
|
llvm_abiname: "lp64d".into(),
|
||||||
max_atomic_width: Some(64),
|
max_atomic_width: Some(64),
|
||||||
supported_split_debuginfo: Cow::Borrowed(&[SplitDebuginfo::Off]),
|
supported_split_debuginfo: Cow::Borrowed(&[SplitDebuginfo::Off]),
|
||||||
crt_static_default: false,
|
|
||||||
..base::linux_musl::opts()
|
..base::linux_musl::opts()
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,8 @@ pub(crate) fn target() -> Target {
|
||||||
base.stack_probes = StackProbeType::Inline;
|
base.stack_probes = StackProbeType::Inline;
|
||||||
base.supported_sanitizers =
|
base.supported_sanitizers =
|
||||||
SanitizerSet::ADDRESS | SanitizerSet::LEAK | SanitizerSet::MEMORY | SanitizerSet::THREAD;
|
SanitizerSet::ADDRESS | SanitizerSet::LEAK | SanitizerSet::MEMORY | SanitizerSet::THREAD;
|
||||||
|
// FIXME(compiler-team#422): musl targets should be dynamically linked by default.
|
||||||
|
base.crt_static_default = true;
|
||||||
|
|
||||||
Target {
|
Target {
|
||||||
llvm_target: "s390x-unknown-linux-musl".into(),
|
llvm_target: "s390x-unknown-linux-musl".into(),
|
||||||
|
|
|
@ -29,6 +29,8 @@ pub(crate) fn target() -> Target {
|
||||||
features: "+v7,+thumb-mode,+thumb2,+vfp3,+neon".into(),
|
features: "+v7,+thumb-mode,+thumb2,+vfp3,+neon".into(),
|
||||||
max_atomic_width: Some(64),
|
max_atomic_width: Some(64),
|
||||||
mcount: "\u{1}mcount".into(),
|
mcount: "\u{1}mcount".into(),
|
||||||
|
// FIXME(compiler-team#422): musl targets should be dynamically linked by default.
|
||||||
|
crt_static_default: true,
|
||||||
..base::linux_musl::opts()
|
..base::linux_musl::opts()
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,8 @@ pub(crate) fn target() -> Target {
|
||||||
| SanitizerSet::MEMORY
|
| SanitizerSet::MEMORY
|
||||||
| SanitizerSet::THREAD;
|
| SanitizerSet::THREAD;
|
||||||
base.supports_xray = true;
|
base.supports_xray = true;
|
||||||
|
// FIXME(compiler-team#422): musl targets should be dynamically linked by default.
|
||||||
|
base.crt_static_default = true;
|
||||||
|
|
||||||
Target {
|
Target {
|
||||||
llvm_target: "x86_64-unknown-linux-musl".into(),
|
llvm_target: "x86_64-unknown-linux-musl".into(),
|
||||||
|
|
|
@ -5,8 +5,8 @@ use serde::Serialize;
|
||||||
use crate::compiler_interface::with;
|
use crate::compiler_interface::with;
|
||||||
use crate::mir::pretty::function_body;
|
use crate::mir::pretty::function_body;
|
||||||
use crate::ty::{
|
use crate::ty::{
|
||||||
AdtDef, ClosureDef, CoroutineDef, GenericArgs, MirConst, Movability, Region, RigidTy, Ty,
|
AdtDef, ClosureDef, CoroutineClosureDef, CoroutineDef, GenericArgs, MirConst, Movability,
|
||||||
TyConst, TyKind, VariantIdx,
|
Region, RigidTy, Ty, TyConst, TyKind, VariantIdx,
|
||||||
};
|
};
|
||||||
use crate::{Error, Opaque, Span, Symbol};
|
use crate::{Error, Opaque, Span, Symbol};
|
||||||
|
|
||||||
|
@ -617,6 +617,9 @@ impl Rvalue {
|
||||||
AggregateKind::Coroutine(def, ref args, mov) => {
|
AggregateKind::Coroutine(def, ref args, mov) => {
|
||||||
Ok(Ty::new_coroutine(def, args.clone(), mov))
|
Ok(Ty::new_coroutine(def, args.clone(), mov))
|
||||||
}
|
}
|
||||||
|
AggregateKind::CoroutineClosure(def, ref args) => {
|
||||||
|
Ok(Ty::new_coroutine_closure(def, args.clone()))
|
||||||
|
}
|
||||||
AggregateKind::RawPtr(ty, mutability) => Ok(Ty::new_ptr(ty, mutability)),
|
AggregateKind::RawPtr(ty, mutability) => Ok(Ty::new_ptr(ty, mutability)),
|
||||||
},
|
},
|
||||||
Rvalue::ShallowInitBox(_, ty) => Ok(Ty::new_box(*ty)),
|
Rvalue::ShallowInitBox(_, ty) => Ok(Ty::new_box(*ty)),
|
||||||
|
@ -633,6 +636,7 @@ pub enum AggregateKind {
|
||||||
Closure(ClosureDef, GenericArgs),
|
Closure(ClosureDef, GenericArgs),
|
||||||
// FIXME(stable_mir): Movability here is redundant
|
// FIXME(stable_mir): Movability here is redundant
|
||||||
Coroutine(CoroutineDef, GenericArgs, Movability),
|
Coroutine(CoroutineDef, GenericArgs, Movability),
|
||||||
|
CoroutineClosure(CoroutineClosureDef, GenericArgs),
|
||||||
RawPtr(Ty, Mutability),
|
RawPtr(Ty, Mutability),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -410,6 +410,10 @@ fn pretty_aggregate<W: Write>(
|
||||||
write!(writer, "{{coroutine@{}}}(", def.span().diagnostic())?;
|
write!(writer, "{{coroutine@{}}}(", def.span().diagnostic())?;
|
||||||
")"
|
")"
|
||||||
}
|
}
|
||||||
|
AggregateKind::CoroutineClosure(def, _) => {
|
||||||
|
write!(writer, "{{coroutine-closure@{}}}(", def.span().diagnostic())?;
|
||||||
|
")"
|
||||||
|
}
|
||||||
AggregateKind::RawPtr(ty, mutability) => {
|
AggregateKind::RawPtr(ty, mutability) => {
|
||||||
write!(
|
write!(
|
||||||
writer,
|
writer,
|
||||||
|
|
|
@ -63,6 +63,11 @@ impl Ty {
|
||||||
Ty::from_rigid_kind(RigidTy::Coroutine(def, args, mov))
|
Ty::from_rigid_kind(RigidTy::Coroutine(def, args, mov))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Create a new closure type.
|
||||||
|
pub fn new_coroutine_closure(def: CoroutineClosureDef, args: GenericArgs) -> Ty {
|
||||||
|
Ty::from_rigid_kind(RigidTy::CoroutineClosure(def, args))
|
||||||
|
}
|
||||||
|
|
||||||
/// Create a new box type that represents `Box<T>`, for the given inner type `T`.
|
/// Create a new box type that represents `Box<T>`, for the given inner type `T`.
|
||||||
pub fn new_box(inner_ty: Ty) -> Ty {
|
pub fn new_box(inner_ty: Ty) -> Ty {
|
||||||
with(|cx| cx.new_box_ty(inner_ty))
|
with(|cx| cx.new_box_ty(inner_ty))
|
||||||
|
@ -550,6 +555,7 @@ pub enum RigidTy {
|
||||||
Closure(ClosureDef, GenericArgs),
|
Closure(ClosureDef, GenericArgs),
|
||||||
// FIXME(stable_mir): Movability here is redundant
|
// FIXME(stable_mir): Movability here is redundant
|
||||||
Coroutine(CoroutineDef, GenericArgs, Movability),
|
Coroutine(CoroutineDef, GenericArgs, Movability),
|
||||||
|
CoroutineClosure(CoroutineClosureDef, GenericArgs),
|
||||||
Dynamic(Vec<Binder<ExistentialPredicate>>, Region, DynKind),
|
Dynamic(Vec<Binder<ExistentialPredicate>>, Region, DynKind),
|
||||||
Never,
|
Never,
|
||||||
Tuple(Vec<Ty>),
|
Tuple(Vec<Ty>),
|
||||||
|
@ -740,6 +746,11 @@ crate_def! {
|
||||||
pub CoroutineDef;
|
pub CoroutineDef;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
crate_def! {
|
||||||
|
#[derive(Serialize)]
|
||||||
|
pub CoroutineClosureDef;
|
||||||
|
}
|
||||||
|
|
||||||
crate_def! {
|
crate_def! {
|
||||||
#[derive(Serialize)]
|
#[derive(Serialize)]
|
||||||
pub ParamDef;
|
pub ParamDef;
|
||||||
|
|
|
@ -168,6 +168,7 @@ impl Visitable for RigidTy {
|
||||||
| RigidTy::Closure(_, args)
|
| RigidTy::Closure(_, args)
|
||||||
| RigidTy::Coroutine(_, args, _)
|
| RigidTy::Coroutine(_, args, _)
|
||||||
| RigidTy::CoroutineWitness(_, args)
|
| RigidTy::CoroutineWitness(_, args)
|
||||||
|
| RigidTy::CoroutineClosure(_, args)
|
||||||
| RigidTy::FnDef(_, args) => args.visit(visitor),
|
| RigidTy::FnDef(_, args) => args.visit(visitor),
|
||||||
RigidTy::FnPtr(sig) => sig.visit(visitor),
|
RigidTy::FnPtr(sig) => sig.visit(visitor),
|
||||||
RigidTy::Dynamic(pred, r, _) => {
|
RigidTy::Dynamic(pred, r, _) => {
|
||||||
|
|
|
@ -90,9 +90,9 @@ RUN /tmp/build-solaris-toolchain.sh sparcv9 sparcv9 solaris-sparc sun
|
||||||
COPY host-x86_64/dist-various-2/build-x86_64-fortanix-unknown-sgx-toolchain.sh /tmp/
|
COPY host-x86_64/dist-various-2/build-x86_64-fortanix-unknown-sgx-toolchain.sh /tmp/
|
||||||
RUN /tmp/build-x86_64-fortanix-unknown-sgx-toolchain.sh
|
RUN /tmp/build-x86_64-fortanix-unknown-sgx-toolchain.sh
|
||||||
|
|
||||||
RUN curl -L https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-23/wasi-sdk-23.0-x86_64-linux.tar.gz | \
|
RUN curl -L https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-25/wasi-sdk-25.0-x86_64-linux.tar.gz | \
|
||||||
tar -xz
|
tar -xz
|
||||||
ENV WASI_SDK_PATH=/tmp/wasi-sdk-23.0-x86_64-linux
|
ENV WASI_SDK_PATH=/tmp/wasi-sdk-25.0-x86_64-linux
|
||||||
|
|
||||||
COPY scripts/freebsd-toolchain.sh /tmp/
|
COPY scripts/freebsd-toolchain.sh /tmp/
|
||||||
RUN /tmp/freebsd-toolchain.sh i686
|
RUN /tmp/freebsd-toolchain.sh i686
|
||||||
|
|
|
@ -40,9 +40,9 @@ WORKDIR /
|
||||||
COPY scripts/sccache.sh /scripts/
|
COPY scripts/sccache.sh /scripts/
|
||||||
RUN sh /scripts/sccache.sh
|
RUN sh /scripts/sccache.sh
|
||||||
|
|
||||||
RUN curl -L https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-23/wasi-sdk-23.0-x86_64-linux.tar.gz | \
|
RUN curl -L https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-25/wasi-sdk-25.0-x86_64-linux.tar.gz | \
|
||||||
tar -xz
|
tar -xz
|
||||||
ENV WASI_SDK_PATH=/wasi-sdk-23.0-x86_64-linux
|
ENV WASI_SDK_PATH=/wasi-sdk-25.0-x86_64-linux
|
||||||
|
|
||||||
ENV RUST_CONFIGURE_ARGS \
|
ENV RUST_CONFIGURE_ARGS \
|
||||||
--musl-root-x86_64=/usr/local/x86_64-linux-musl \
|
--musl-root-x86_64=/usr/local/x86_64-linux-musl \
|
||||||
|
|
|
@ -1571,8 +1571,12 @@ impl<'tcx> Machine<'tcx> for MiriMachine<'tcx> {
|
||||||
res
|
res
|
||||||
}
|
}
|
||||||
|
|
||||||
fn after_local_read(ecx: &InterpCx<'tcx, Self>, local: mir::Local) -> InterpResult<'tcx> {
|
fn after_local_read(
|
||||||
if let Some(data_race) = &ecx.frame().extra.data_race {
|
ecx: &InterpCx<'tcx, Self>,
|
||||||
|
frame: &Frame<'tcx, Provenance, FrameExtra<'tcx>>,
|
||||||
|
local: mir::Local,
|
||||||
|
) -> InterpResult<'tcx> {
|
||||||
|
if let Some(data_race) = &frame.extra.data_race {
|
||||||
data_race.local_read(local, &ecx.machine);
|
data_race.local_read(local, &ecx.machine);
|
||||||
}
|
}
|
||||||
interp_ok(())
|
interp_ok(())
|
||||||
|
|
|
@ -1,8 +0,0 @@
|
||||||
//@ known-bug: #134162
|
|
||||||
|
|
||||||
fn main() {
|
|
||||||
struct X;
|
|
||||||
|
|
||||||
let xs = [X, X, X];
|
|
||||||
let eq = xs == [panic!("panic evaluated"); 2];
|
|
||||||
}
|
|
62
tests/run-make/musl-default-linking/rmake.rs
Normal file
62
tests/run-make/musl-default-linking/rmake.rs
Normal file
|
@ -0,0 +1,62 @@
|
||||||
|
use run_make_support::{rustc, serde_json};
|
||||||
|
|
||||||
|
// Please do NOT add more targets to this list!
|
||||||
|
// Per https://github.com/rust-lang/compiler-team/issues/422,
|
||||||
|
// we should be trying to move these targets to dynamically link
|
||||||
|
// musl libc by default.
|
||||||
|
static LEGACY_STATIC_LINKING_TARGETS: &[&'static str] = &[
|
||||||
|
"aarch64-unknown-linux-musl",
|
||||||
|
"arm-unknown-linux-musleabi",
|
||||||
|
"arm-unknown-linux-musleabihf",
|
||||||
|
"armv5te-unknown-linux-musleabi",
|
||||||
|
"armv7-unknown-linux-musleabi",
|
||||||
|
"armv7-unknown-linux-musleabihf",
|
||||||
|
"i586-unknown-linux-musl",
|
||||||
|
"i686-unknown-linux-musl",
|
||||||
|
"mips64-unknown-linux-musl",
|
||||||
|
"mips64-unknown-linux-muslabi64",
|
||||||
|
"mips64el-unknown-linux-muslabi64",
|
||||||
|
"powerpc-unknown-linux-musl",
|
||||||
|
"powerpc-unknown-linux-muslspe",
|
||||||
|
"powerpc64-unknown-linux-musl",
|
||||||
|
"powerpc64le-unknown-linux-musl",
|
||||||
|
"riscv32gc-unknown-linux-musl",
|
||||||
|
"s390x-unknown-linux-musl",
|
||||||
|
"thumbv7neon-unknown-linux-musleabihf",
|
||||||
|
"x86_64-unknown-linux-musl",
|
||||||
|
];
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
let targets = rustc().print("target-list").run().stdout_utf8();
|
||||||
|
|
||||||
|
for target in targets.lines() {
|
||||||
|
let abi = target.split('-').last().unwrap();
|
||||||
|
|
||||||
|
if !abi.starts_with("musl") {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
let target_spec_json = rustc()
|
||||||
|
.print("target-spec-json")
|
||||||
|
.target(target)
|
||||||
|
.arg("-Zunstable-options")
|
||||||
|
.run()
|
||||||
|
.stdout_utf8();
|
||||||
|
|
||||||
|
let target_spec: serde_json::Value =
|
||||||
|
serde_json::from_str(&target_spec_json).expect("failed to parse target-spec-json");
|
||||||
|
let default = &target_spec["crt-static-default"];
|
||||||
|
|
||||||
|
// If the value is `null`, then the default to dynamically link from
|
||||||
|
// musl_base was not overriden.
|
||||||
|
if default.is_null() {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if default.as_bool().expect("wasn't a boolean")
|
||||||
|
&& !LEGACY_STATIC_LINKING_TARGETS.contains(&target)
|
||||||
|
{
|
||||||
|
panic!("{target} statically links musl libc when it should dynamically link it");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -9,3 +9,19 @@ macro_rules! my_lib_macro {
|
||||||
$crate::my_lib_func()
|
$crate::my_lib_func()
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[macro_export]
|
||||||
|
macro_rules! my_lib_macro_value {
|
||||||
|
() => {
|
||||||
|
#[cfg(panic = "UNEXPECTED_VALUE")]
|
||||||
|
$crate::my_lib_func()
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#[macro_export]
|
||||||
|
macro_rules! my_lib_macro_feature {
|
||||||
|
() => {
|
||||||
|
#[cfg(feature = "UNEXPECTED_FEATURE")]
|
||||||
|
$crate::my_lib_func()
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
42
tests/ui/check-cfg/report-in-external-macros.cargo.stderr
Normal file
42
tests/ui/check-cfg/report-in-external-macros.cargo.stderr
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
warning: unexpected `cfg` condition name: `my_lib_cfg`
|
||||||
|
--> $DIR/report-in-external-macros.rs:13:5
|
||||||
|
|
|
||||||
|
LL | cfg_macro::my_lib_macro!();
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
||||||
|
= help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `feature`, `fmt_debug`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, and `windows`
|
||||||
|
= note: using a cfg inside a macro will use the cfgs from the destination crate and not the ones from the defining crate
|
||||||
|
= help: try refering to `cfg_macro::my_lib_macro` crate for guidance on how handle this unexpected cfg
|
||||||
|
= help: the macro `cfg_macro::my_lib_macro` may come from an old version of it's defining crate, try updating your dependencies with `cargo update`
|
||||||
|
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration
|
||||||
|
= note: `#[warn(unexpected_cfgs)]` on by default
|
||||||
|
= note: this warning originates in the macro `cfg_macro::my_lib_macro` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
|
||||||
|
warning: unexpected `cfg` condition value: `UNEXPECTED_VALUE`
|
||||||
|
--> $DIR/report-in-external-macros.rs:16:5
|
||||||
|
|
|
||||||
|
LL | cfg_macro::my_lib_macro_value!();
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
||||||
|
= note: expected values for `panic` are: `abort` and `unwind`
|
||||||
|
= note: using a cfg inside a macro will use the cfgs from the destination crate and not the ones from the defining crate
|
||||||
|
= help: try refering to `cfg_macro::my_lib_macro_value` crate for guidance on how handle this unexpected cfg
|
||||||
|
= help: the macro `cfg_macro::my_lib_macro_value` may come from an old version of it's defining crate, try updating your dependencies with `cargo update`
|
||||||
|
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration
|
||||||
|
= note: this warning originates in the macro `cfg_macro::my_lib_macro_value` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
|
||||||
|
warning: unexpected `cfg` condition value: `UNEXPECTED_FEATURE`
|
||||||
|
--> $DIR/report-in-external-macros.rs:19:5
|
||||||
|
|
|
||||||
|
LL | cfg_macro::my_lib_macro_feature!();
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
||||||
|
= note: no expected values for `feature`
|
||||||
|
= note: using a cfg inside a macro will use the cfgs from the destination crate and not the ones from the defining crate
|
||||||
|
= help: try refering to `cfg_macro::my_lib_macro_feature` crate for guidance on how handle this unexpected cfg
|
||||||
|
= help: the macro `cfg_macro::my_lib_macro_feature` may come from an old version of it's defining crate, try updating your dependencies with `cargo update`
|
||||||
|
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration
|
||||||
|
= note: this warning originates in the macro `cfg_macro::my_lib_macro_feature` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
|
||||||
|
warning: 3 warnings emitted
|
||||||
|
|
|
@ -3,10 +3,19 @@
|
||||||
|
|
||||||
//@ check-pass
|
//@ check-pass
|
||||||
//@ no-auto-check-cfg
|
//@ no-auto-check-cfg
|
||||||
|
//@ revisions: cargo rustc
|
||||||
|
//@ [rustc]unset-rustc-env:CARGO_CRATE_NAME
|
||||||
|
//@ [cargo]rustc-env:CARGO_CRATE_NAME=foo
|
||||||
//@ aux-crate: cfg_macro=cfg_macro.rs
|
//@ aux-crate: cfg_macro=cfg_macro.rs
|
||||||
//@ compile-flags: --check-cfg=cfg()
|
//@ compile-flags: --check-cfg=cfg(feature,values())
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
cfg_macro::my_lib_macro!();
|
cfg_macro::my_lib_macro!();
|
||||||
//~^ WARNING unexpected `cfg` condition name
|
//~^ WARNING unexpected `cfg` condition name
|
||||||
|
|
||||||
|
cfg_macro::my_lib_macro_value!();
|
||||||
|
//~^ WARNING unexpected `cfg` condition value
|
||||||
|
|
||||||
|
cfg_macro::my_lib_macro_feature!();
|
||||||
|
//~^ WARNING unexpected `cfg` condition value
|
||||||
}
|
}
|
||||||
|
|
41
tests/ui/check-cfg/report-in-external-macros.rustc.stderr
Normal file
41
tests/ui/check-cfg/report-in-external-macros.rustc.stderr
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
warning: unexpected `cfg` condition name: `my_lib_cfg`
|
||||||
|
--> $DIR/report-in-external-macros.rs:13:5
|
||||||
|
|
|
||||||
|
LL | cfg_macro::my_lib_macro!();
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
||||||
|
= help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `feature`, `fmt_debug`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, and `windows`
|
||||||
|
= note: using a cfg inside a macro will use the cfgs from the destination crate and not the ones from the defining crate
|
||||||
|
= help: try refering to `cfg_macro::my_lib_macro` crate for guidance on how handle this unexpected cfg
|
||||||
|
= help: to expect this configuration use `--check-cfg=cfg(my_lib_cfg)`
|
||||||
|
= 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
|
||||||
|
= note: this warning originates in the macro `cfg_macro::my_lib_macro` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
|
||||||
|
warning: unexpected `cfg` condition value: `UNEXPECTED_VALUE`
|
||||||
|
--> $DIR/report-in-external-macros.rs:16:5
|
||||||
|
|
|
||||||
|
LL | cfg_macro::my_lib_macro_value!();
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
||||||
|
= note: expected values for `panic` are: `abort` and `unwind`
|
||||||
|
= note: using a cfg inside a macro will use the cfgs from the destination crate and not the ones from the defining crate
|
||||||
|
= help: try refering to `cfg_macro::my_lib_macro_value` crate for guidance on how handle this unexpected cfg
|
||||||
|
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration
|
||||||
|
= note: this warning originates in the macro `cfg_macro::my_lib_macro_value` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
|
||||||
|
warning: unexpected `cfg` condition value: `UNEXPECTED_FEATURE`
|
||||||
|
--> $DIR/report-in-external-macros.rs:19:5
|
||||||
|
|
|
||||||
|
LL | cfg_macro::my_lib_macro_feature!();
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
||||||
|
= note: no expected values for `feature`
|
||||||
|
= help: to expect this configuration use `--check-cfg=cfg(feature, values("UNEXPECTED_FEATURE"))`
|
||||||
|
= note: using a cfg inside a macro will use the cfgs from the destination crate and not the ones from the defining crate
|
||||||
|
= help: try refering to `cfg_macro::my_lib_macro_feature` crate for guidance on how handle this unexpected cfg
|
||||||
|
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration
|
||||||
|
= note: this warning originates in the macro `cfg_macro::my_lib_macro_feature` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
|
||||||
|
warning: 3 warnings emitted
|
||||||
|
|
|
@ -1,14 +0,0 @@
|
||||||
warning: unexpected `cfg` condition name: `my_lib_cfg`
|
|
||||||
--> $DIR/report-in-external-macros.rs:10:5
|
|
||||||
|
|
|
||||||
LL | cfg_macro::my_lib_macro!();
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
|
|
|
||||||
= help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `fmt_debug`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, and `windows`
|
|
||||||
= help: to expect this configuration use `--check-cfg=cfg(my_lib_cfg)`
|
|
||||||
= 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
|
|
||||||
= note: this warning originates in the macro `cfg_macro::my_lib_macro` (in Nightly builds, run with -Z macro-backtrace for more info)
|
|
||||||
|
|
||||||
warning: 1 warning emitted
|
|
||||||
|
|
12
tests/ui/stable-mir-print/async-closure.rs
Normal file
12
tests/ui/stable-mir-print/async-closure.rs
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
//@ compile-flags: -Z unpretty=stable-mir --crate-type lib -C panic=abort
|
||||||
|
//@ check-pass
|
||||||
|
//@ only-x86_64
|
||||||
|
//@ edition: 2024
|
||||||
|
//@ needs-unwind unwind edges are different with panic=abort
|
||||||
|
|
||||||
|
pub fn foo() {
|
||||||
|
let y = 0;
|
||||||
|
let x = async || {
|
||||||
|
let y = y;
|
||||||
|
};
|
||||||
|
}
|
90
tests/ui/stable-mir-print/async-closure.stdout
Normal file
90
tests/ui/stable-mir-print/async-closure.stdout
Normal file
|
@ -0,0 +1,90 @@
|
||||||
|
// WARNING: This is highly experimental output it's intended for stable-mir developers only.
|
||||||
|
// If you find a bug or want to improve the output open a issue at https://github.com/rust-lang/project-stable-mir.
|
||||||
|
fn foo() -> () {
|
||||||
|
let mut _0: ();
|
||||||
|
let _1: i32;
|
||||||
|
let _2: {async closure@$DIR/async-closure.rs:9:13: 9:21};
|
||||||
|
let mut _3: &i32;
|
||||||
|
debug y => _1;
|
||||||
|
debug x => _2;
|
||||||
|
bb0: {
|
||||||
|
_1 = 0_i32;
|
||||||
|
_3 = &_1;
|
||||||
|
_2 = {coroutine-closure@$DIR/async-closure.rs:9:13: 9:21}(move _3);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fn foo::{closure#0}(_1: &{async closure@$DIR/async-closure.rs:9:13: 9:21}) -> {async closure body@$DIR/async-closure.rs:9:22: 11:6} {
|
||||||
|
let mut _0: {async closure body@$DIR/async-closure.rs:9:22: 11:6};
|
||||||
|
let mut _2: &i32;
|
||||||
|
debug y => (*((*_1).0: &i32));
|
||||||
|
bb0: {
|
||||||
|
_2 = CopyForDeref(((*_1).0: &i32));
|
||||||
|
_0 = {coroutine@$DIR/async-closure.rs:9:22: 11:6}(_2);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fn foo::{closure#0}::{closure#0}(_1: Pin<&mut {async closure body@$DIR/async-closure.rs:9:22: 11:6}>, _2: &mut Context<'_>) -> Poll<()> {
|
||||||
|
let mut _0: Poll<()>;
|
||||||
|
let _3: i32;
|
||||||
|
let mut _4: &i32;
|
||||||
|
let mut _5: u32;
|
||||||
|
let mut _6: &mut {async closure body@$DIR/async-closure.rs:9:22: 11:6};
|
||||||
|
let mut _7: &mut {async closure body@$DIR/async-closure.rs:9:22: 11:6};
|
||||||
|
let mut _8: &mut {async closure body@$DIR/async-closure.rs:9:22: 11:6};
|
||||||
|
debug _task_context => _2;
|
||||||
|
debug y => (*((*(_1.0: &mut {async closure body@$DIR/async-closure.rs:9:22: 11:6})).0: &i32));
|
||||||
|
debug y => _3;
|
||||||
|
bb0: {
|
||||||
|
_6 = CopyForDeref((_1.0: &mut {async closure body@$DIR/async-closure.rs:9:22: 11:6}));
|
||||||
|
_5 = discriminant((*_6));
|
||||||
|
switchInt(move _5) -> [0: bb1, 1: bb2, otherwise: bb3];
|
||||||
|
}
|
||||||
|
bb1: {
|
||||||
|
_7 = CopyForDeref((_1.0: &mut {async closure body@$DIR/async-closure.rs:9:22: 11:6}));
|
||||||
|
_4 = CopyForDeref(((*_7).0: &i32));
|
||||||
|
_3 = (*_4);
|
||||||
|
_0 = std::task::Poll::Ready(());
|
||||||
|
_8 = CopyForDeref((_1.0: &mut {async closure body@$DIR/async-closure.rs:9:22: 11:6}));
|
||||||
|
discriminant((*_8) = 1;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
bb2: {
|
||||||
|
assert(false, `async fn` resumed after completion) -> [success: bb2, unwind unreachable];
|
||||||
|
}
|
||||||
|
bb3: {
|
||||||
|
unreachable;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fn foo::{closure#0}::{closure#1}(_1: Pin<&mut {async closure body@$DIR/async-closure.rs:9:22: 11:6}>, _2: &mut Context<'_>) -> Poll<()> {
|
||||||
|
let mut _0: Poll<()>;
|
||||||
|
let _3: i32;
|
||||||
|
let mut _4: &i32;
|
||||||
|
let mut _5: u32;
|
||||||
|
let mut _6: &mut {async closure body@$DIR/async-closure.rs:9:22: 11:6};
|
||||||
|
let mut _7: &mut {async closure body@$DIR/async-closure.rs:9:22: 11:6};
|
||||||
|
let mut _8: &mut {async closure body@$DIR/async-closure.rs:9:22: 11:6};
|
||||||
|
debug _task_context => _2;
|
||||||
|
debug y => (*((*(_1.0: &mut {async closure body@$DIR/async-closure.rs:9:22: 11:6})).0: &i32));
|
||||||
|
debug y => _3;
|
||||||
|
bb0: {
|
||||||
|
_6 = CopyForDeref((_1.0: &mut {async closure body@$DIR/async-closure.rs:9:22: 11:6}));
|
||||||
|
_5 = discriminant((*_6));
|
||||||
|
switchInt(move _5) -> [0: bb1, 1: bb2, otherwise: bb3];
|
||||||
|
}
|
||||||
|
bb1: {
|
||||||
|
_7 = CopyForDeref((_1.0: &mut {async closure body@$DIR/async-closure.rs:9:22: 11:6}));
|
||||||
|
_4 = CopyForDeref(((*_7).0: &i32));
|
||||||
|
_3 = (*_4);
|
||||||
|
_0 = std::task::Poll::Ready(());
|
||||||
|
_8 = CopyForDeref((_1.0: &mut {async closure body@$DIR/async-closure.rs:9:22: 11:6}));
|
||||||
|
discriminant((*_8) = 1;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
bb2: {
|
||||||
|
assert(false, `async fn` resumed after completion) -> [success: bb2, unwind unreachable];
|
||||||
|
}
|
||||||
|
bb3: {
|
||||||
|
unreachable;
|
||||||
|
}
|
||||||
|
}
|
11
tests/ui/typeck/rhs-ty-hint-134162.e2018.stderr
Normal file
11
tests/ui/typeck/rhs-ty-hint-134162.e2018.stderr
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
error[E0369]: binary operation `==` cannot be applied to type `[X; 1]`
|
||||||
|
--> $DIR/rhs-ty-hint-134162.rs:16:17
|
||||||
|
|
|
||||||
|
LL | let _ = [X] == [panic!(); 2];
|
||||||
|
| --- ^^ ------------- [_; 2]
|
||||||
|
| |
|
||||||
|
| [X; 1]
|
||||||
|
|
||||||
|
error: aborting due to 1 previous error
|
||||||
|
|
||||||
|
For more information about this error, try `rustc --explain E0369`.
|
11
tests/ui/typeck/rhs-ty-hint-134162.e2021.stderr
Normal file
11
tests/ui/typeck/rhs-ty-hint-134162.e2021.stderr
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
error[E0369]: binary operation `==` cannot be applied to type `[X; 1]`
|
||||||
|
--> $DIR/rhs-ty-hint-134162.rs:16:17
|
||||||
|
|
|
||||||
|
LL | let _ = [X] == [panic!(); 2];
|
||||||
|
| --- ^^ ------------- [_; 2]
|
||||||
|
| |
|
||||||
|
| [X; 1]
|
||||||
|
|
||||||
|
error: aborting due to 1 previous error
|
||||||
|
|
||||||
|
For more information about this error, try `rustc --explain E0369`.
|
11
tests/ui/typeck/rhs-ty-hint-134162.e2024.stderr
Normal file
11
tests/ui/typeck/rhs-ty-hint-134162.e2024.stderr
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
error[E0369]: binary operation `==` cannot be applied to type `[X; 1]`
|
||||||
|
--> $DIR/rhs-ty-hint-134162.rs:16:17
|
||||||
|
|
|
||||||
|
LL | let _ = [X] == [panic!(); 2];
|
||||||
|
| --- ^^ ------------- [_; 2]
|
||||||
|
| |
|
||||||
|
| [X; 1]
|
||||||
|
|
||||||
|
error: aborting due to 1 previous error
|
||||||
|
|
||||||
|
For more information about this error, try `rustc --explain E0369`.
|
18
tests/ui/typeck/rhs-ty-hint-134162.rs
Normal file
18
tests/ui/typeck/rhs-ty-hint-134162.rs
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
//! Regression test for <https://github.com/rust-lang/rust/issues/134162>.
|
||||||
|
//!
|
||||||
|
//! <https://github.com/rust-lang/rust/pull/110877> introduced RHS type hints for when a ty doesn't
|
||||||
|
//! support a bin op. In the suggestion path, there was a `delay_bug`.
|
||||||
|
//! <https://github.com/rust-lang/rust/pull/121208> converted this `delay_bug` to `bug`, which did
|
||||||
|
//! not trigger any test failures as we did not have test coverage for this particular case. This
|
||||||
|
//! manifested in an ICE as reported in <https://github.com/rust-lang/rust/issues/134162>.
|
||||||
|
|
||||||
|
//@ revisions: e2018 e2021 e2024
|
||||||
|
//@[e2018] edition: 2018
|
||||||
|
//@[e2021] edition: 2021
|
||||||
|
//@[e2024] edition: 2024
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
struct X;
|
||||||
|
let _ = [X] == [panic!(); 2];
|
||||||
|
//[e2018,e2021,e2024]~^ ERROR binary operation `==` cannot be applied to type `[X; 1]`
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue