mirror of
https://github.com/rust-lang/rust.git
synced 2025-04-15 05:26:47 +00:00
Auto merge of #120496 - GuillaumeGomez:rollup-fmu9jre, r=GuillaumeGomez
Rollup of 11 pull requests Successful merges: - #117906 (Improve display of crate name when hovered) - #118533 (Suppress unhelpful diagnostics for unresolved top level attributes) - #120293 (Deduplicate more sized errors on call exprs) - #120295 (Remove `raw_os_nonzero` feature.) - #120310 (adapt test for v0 symbol mangling) - #120342 (Remove various `has_errors` or `err_count` uses) - #120434 (Revert outdated version of "Add the wasm32-wasi-preview2 target") - #120445 (Fix some `Arc` allocator leaks) - #120475 (Improve error message when `cargo build` is used to build the compiler) - #120476 (Remove some unnecessary check logic for lang items in HIR typeck) - #120485 (add missing potential_query_instability for keys and values in hashmap) r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
commit
f3d71c9249
@ -139,7 +139,7 @@ fn parse_args<'a>(ecx: &mut ExtCtxt<'a>, sp: Span, tts: TokenStream) -> PResult<
|
||||
_ => {
|
||||
let expr = p.parse_expr()?;
|
||||
if !args.named_args().is_empty() {
|
||||
ecx.dcx().emit_err(errors::PositionalAfterNamed {
|
||||
return Err(ecx.dcx().create_err(errors::PositionalAfterNamed {
|
||||
span: expr.span,
|
||||
args: args
|
||||
.named_args()
|
||||
@ -147,7 +147,7 @@ fn parse_args<'a>(ecx: &mut ExtCtxt<'a>, sp: Span, tts: TokenStream) -> PResult<
|
||||
.filter_map(|a| a.kind.ident().map(|ident| (a, ident)))
|
||||
.map(|(arg, n)| n.span.to(arg.expr.span))
|
||||
.collect(),
|
||||
});
|
||||
}));
|
||||
}
|
||||
args.add(FormatArgument { kind: FormatArgumentKind::Normal, expr });
|
||||
}
|
||||
@ -313,6 +313,8 @@ fn make_format_args(
|
||||
}
|
||||
use ArgRef::*;
|
||||
|
||||
let mut unnamed_arg_after_named_arg = false;
|
||||
|
||||
let mut lookup_arg = |arg: ArgRef<'_>,
|
||||
span: Option<Span>,
|
||||
used_as: PositionUsedAs,
|
||||
@ -352,6 +354,7 @@ fn make_format_args(
|
||||
// For the moment capturing variables from format strings expanded from macros is
|
||||
// disabled (see RFC #2795)
|
||||
ecx.dcx().emit_err(errors::FormatNoArgNamed { span, name });
|
||||
unnamed_arg_after_named_arg = true;
|
||||
DummyResult::raw_expr(span, true)
|
||||
};
|
||||
Ok(args.add(FormatArgument { kind: FormatArgumentKind::Captured(ident), expr }))
|
||||
@ -510,7 +513,8 @@ fn make_format_args(
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
if !unused.is_empty() {
|
||||
let has_unused = !unused.is_empty();
|
||||
if has_unused {
|
||||
// If there's a lot of unused arguments,
|
||||
// let's check if this format arguments looks like another syntax (printf / shell).
|
||||
let detect_foreign_fmt = unused.len() > args.explicit_args().len() / 2;
|
||||
@ -529,7 +533,7 @@ fn make_format_args(
|
||||
|
||||
// Only check for unused named argument names if there are no other errors to avoid causing
|
||||
// too much noise in output errors, such as when a named argument is entirely unused.
|
||||
if invalid_refs.is_empty() && ecx.dcx().has_errors().is_none() {
|
||||
if invalid_refs.is_empty() && !has_unused && !unnamed_arg_after_named_arg {
|
||||
for &(index, span, used_as) in &numeric_refences_to_named_arg {
|
||||
let (position_sp_to_replace, position_sp_for_msg) = match used_as {
|
||||
Placeholder(pspan) => (span, pspan),
|
||||
|
@ -403,6 +403,7 @@ fn codegenned_and_inlined_items(tcx: TyCtxt<'_>) -> DefIdSet {
|
||||
let mut result = items.clone();
|
||||
|
||||
for cgu in cgus {
|
||||
#[allow(rustc::potential_query_instability)]
|
||||
for item in cgu.items().keys() {
|
||||
if let mir::mono::MonoItem::Fn(ref instance) = item {
|
||||
let did = instance.def_id();
|
||||
|
@ -267,6 +267,7 @@ impl CguReuseTracker {
|
||||
|
||||
fn check_expected_reuse(&self, sess: &Session) {
|
||||
if let Some(ref data) = self.data {
|
||||
#[allow(rustc::potential_query_instability)]
|
||||
let mut keys = data.expected_reuse.keys().collect::<Vec<_>>();
|
||||
keys.sort_unstable();
|
||||
for cgu_name in keys {
|
||||
|
@ -682,6 +682,7 @@ fn link_dwarf_object<'a>(
|
||||
}
|
||||
|
||||
// Input rlibs contain .o/.dwo files from dependencies.
|
||||
#[allow(rustc::potential_query_instability)]
|
||||
let input_rlibs = cg_results
|
||||
.crate_info
|
||||
.used_crate_source
|
||||
|
@ -514,6 +514,7 @@ pub enum StashKey {
|
||||
MaybeForgetReturn,
|
||||
/// Query cycle detected, stashing in favor of a better error.
|
||||
Cycle,
|
||||
UndeterminedMacroResolution,
|
||||
}
|
||||
|
||||
fn default_track_diagnostic(diag: Diagnostic, f: &mut dyn FnMut(Diagnostic)) {
|
||||
|
@ -485,7 +485,9 @@ pub fn compile_declarative_macro(
|
||||
)
|
||||
.pop()
|
||||
.unwrap();
|
||||
valid &= check_lhs_nt_follows(sess, def, &tt);
|
||||
// We don't handle errors here, the driver will abort
|
||||
// after parsing/expansion. we can report every error in every macro this way.
|
||||
valid &= check_lhs_nt_follows(sess, def, &tt).is_ok();
|
||||
return tt;
|
||||
}
|
||||
sess.dcx().span_bug(def.span, "wrong-structured lhs")
|
||||
@ -589,18 +591,19 @@ pub fn compile_declarative_macro(
|
||||
(mk_syn_ext(expander), rule_spans)
|
||||
}
|
||||
|
||||
fn check_lhs_nt_follows(sess: &Session, def: &ast::Item, lhs: &mbe::TokenTree) -> bool {
|
||||
fn check_lhs_nt_follows(
|
||||
sess: &Session,
|
||||
def: &ast::Item,
|
||||
lhs: &mbe::TokenTree,
|
||||
) -> Result<(), ErrorGuaranteed> {
|
||||
// lhs is going to be like TokenTree::Delimited(...), where the
|
||||
// entire lhs is those tts. Or, it can be a "bare sequence", not wrapped in parens.
|
||||
if let mbe::TokenTree::Delimited(.., delimited) = lhs {
|
||||
check_matcher(sess, def, &delimited.tts)
|
||||
} else {
|
||||
let msg = "invalid macro matcher; matchers must be contained in balanced delimiters";
|
||||
sess.dcx().span_err(lhs.span(), msg);
|
||||
false
|
||||
Err(sess.dcx().span_err(lhs.span(), msg))
|
||||
}
|
||||
// we don't abort on errors on rejection, the driver will do that for us
|
||||
// after parsing/expansion. we can report every error in every macro this way.
|
||||
}
|
||||
|
||||
fn is_empty_token_tree(sess: &Session, seq: &mbe::SequenceRepetition) -> bool {
|
||||
@ -675,12 +678,15 @@ fn check_rhs(sess: &Session, rhs: &mbe::TokenTree) -> bool {
|
||||
false
|
||||
}
|
||||
|
||||
fn check_matcher(sess: &Session, def: &ast::Item, matcher: &[mbe::TokenTree]) -> bool {
|
||||
fn check_matcher(
|
||||
sess: &Session,
|
||||
def: &ast::Item,
|
||||
matcher: &[mbe::TokenTree],
|
||||
) -> Result<(), ErrorGuaranteed> {
|
||||
let first_sets = FirstSets::new(matcher);
|
||||
let empty_suffix = TokenSet::empty();
|
||||
let err = sess.dcx().err_count();
|
||||
check_matcher_core(sess, def, &first_sets, matcher, &empty_suffix);
|
||||
err == sess.dcx().err_count()
|
||||
check_matcher_core(sess, def, &first_sets, matcher, &empty_suffix)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn has_compile_error_macro(rhs: &mbe::TokenTree) -> bool {
|
||||
@ -1020,11 +1026,13 @@ fn check_matcher_core<'tt>(
|
||||
first_sets: &FirstSets<'tt>,
|
||||
matcher: &'tt [mbe::TokenTree],
|
||||
follow: &TokenSet<'tt>,
|
||||
) -> TokenSet<'tt> {
|
||||
) -> Result<TokenSet<'tt>, ErrorGuaranteed> {
|
||||
use mbe::TokenTree;
|
||||
|
||||
let mut last = TokenSet::empty();
|
||||
|
||||
let mut errored = Ok(());
|
||||
|
||||
// 2. For each token and suffix [T, SUFFIX] in M:
|
||||
// ensure that T can be followed by SUFFIX, and if SUFFIX may be empty,
|
||||
// then ensure T can also be followed by any element of FOLLOW.
|
||||
@ -1068,7 +1076,7 @@ fn check_matcher_core<'tt>(
|
||||
token::CloseDelim(d.delim),
|
||||
span.close,
|
||||
));
|
||||
check_matcher_core(sess, def, first_sets, &d.tts, &my_suffix);
|
||||
check_matcher_core(sess, def, first_sets, &d.tts, &my_suffix)?;
|
||||
// don't track non NT tokens
|
||||
last.replace_with_irrelevant();
|
||||
|
||||
@ -1100,7 +1108,7 @@ fn check_matcher_core<'tt>(
|
||||
// At this point, `suffix_first` is built, and
|
||||
// `my_suffix` is some TokenSet that we can use
|
||||
// for checking the interior of `seq_rep`.
|
||||
let next = check_matcher_core(sess, def, first_sets, &seq_rep.tts, my_suffix);
|
||||
let next = check_matcher_core(sess, def, first_sets, &seq_rep.tts, my_suffix)?;
|
||||
if next.maybe_empty {
|
||||
last.add_all(&next);
|
||||
} else {
|
||||
@ -1206,14 +1214,15 @@ fn check_matcher_core<'tt>(
|
||||
));
|
||||
}
|
||||
}
|
||||
err.emit();
|
||||
errored = Err(err.emit());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
last
|
||||
errored?;
|
||||
Ok(last)
|
||||
}
|
||||
|
||||
fn token_can_be_followed_by_any(tok: &mbe::TokenTree) -> bool {
|
||||
|
@ -96,9 +96,6 @@ hir_typeck_lossy_provenance_ptr2int =
|
||||
hir_typeck_method_call_on_unknown_raw_pointee =
|
||||
cannot call a method on a raw pointer with an unknown pointee type
|
||||
|
||||
hir_typeck_missing_fn_lang_items = failed to find an overloaded call trait for closure call
|
||||
.help = make sure the `fn`/`fn_mut`/`fn_once` lang items are defined and have correctly defined `call`/`call_mut`/`call_once` methods
|
||||
|
||||
hir_typeck_missing_parentheses_in_range = can't call method `{$method_name}` on type `{$ty_str}`
|
||||
|
||||
hir_typeck_no_associated_item = no {$item_kind} named `{$item_name}` found for {$ty_prefix} `{$ty_str}`{$trait_missing_method ->
|
||||
@ -108,8 +105,6 @@ hir_typeck_no_associated_item = no {$item_kind} named `{$item_name}` found for {
|
||||
|
||||
hir_typeck_note_edition_guide = for more on editions, read https://doc.rust-lang.org/edition-guide
|
||||
|
||||
hir_typeck_op_trait_generic_params = `{$method_name}` must not have any generic parameters
|
||||
|
||||
hir_typeck_option_result_asref = use `{$def_path}::as_ref` to convert `{$expected_ty}` to `{$expr_ty}`
|
||||
hir_typeck_option_result_cloned = use `{$def_path}::cloned` to clone the value inside the `{$def_path}`
|
||||
hir_typeck_option_result_copied = use `{$def_path}::copied` to copy the value inside the `{$def_path}`
|
||||
|
@ -77,6 +77,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
callee_expr,
|
||||
Expectation::NoExpectation,
|
||||
arg_exprs,
|
||||
Some(call_expr),
|
||||
),
|
||||
_ => self.check_expr(callee_expr),
|
||||
};
|
||||
@ -253,28 +254,13 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
adjusted_ty,
|
||||
opt_input_type.as_ref().map(slice::from_ref),
|
||||
) {
|
||||
// Check for `self` receiver on the method, otherwise we can't use this as a `Fn*` trait.
|
||||
if !self.tcx.associated_item(ok.value.def_id).fn_has_self_parameter {
|
||||
self.dcx().span_delayed_bug(
|
||||
call_expr.span,
|
||||
"input to overloaded call fn is not a self receiver",
|
||||
);
|
||||
return None;
|
||||
}
|
||||
|
||||
let method = self.register_infer_ok_obligations(ok);
|
||||
let mut autoref = None;
|
||||
if borrow {
|
||||
// Check for &self vs &mut self in the method signature. Since this is either
|
||||
// the Fn or FnMut trait, it should be one of those.
|
||||
let ty::Ref(region, _, mutbl) = method.sig.inputs()[0].kind() else {
|
||||
// The `fn`/`fn_mut` lang item is ill-formed, which should have
|
||||
// caused an error elsewhere.
|
||||
self.dcx().span_delayed_bug(
|
||||
call_expr.span,
|
||||
"input to call/call_mut is not a ref",
|
||||
);
|
||||
return None;
|
||||
bug!("Expected `FnMut`/`Fn` to take receiver by-ref/by-mut")
|
||||
};
|
||||
|
||||
// For initial two-phase borrow
|
||||
@ -948,9 +934,11 @@ impl<'a, 'tcx> DeferredCallResolution<'tcx> {
|
||||
);
|
||||
}
|
||||
None => {
|
||||
// This can happen if `#![no_core]` is used and the `fn/fn_mut/fn_once`
|
||||
// lang items are not defined (issue #86238).
|
||||
fcx.dcx().emit_err(errors::MissingFnLangItems { span: self.call_expr.span });
|
||||
span_bug!(
|
||||
self.call_expr.span,
|
||||
"Expected to find a suitable `Fn`/`FnMut`/`FnOnce` implementation for `{}`",
|
||||
self.adjusted_ty
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -152,26 +152,22 @@ pub(super) fn check_fn<'a, 'tcx>(
|
||||
}
|
||||
|
||||
fn check_panic_info_fn(tcx: TyCtxt<'_>, fn_id: LocalDefId, fn_sig: ty::FnSig<'_>) {
|
||||
let span = tcx.def_span(fn_id);
|
||||
|
||||
let DefKind::Fn = tcx.def_kind(fn_id) else {
|
||||
let span = tcx.def_span(fn_id);
|
||||
tcx.dcx().span_err(span, "should be a function");
|
||||
return;
|
||||
};
|
||||
|
||||
let generic_counts = tcx.generics_of(fn_id).own_counts();
|
||||
if generic_counts.types != 0 {
|
||||
let span = tcx.def_span(fn_id);
|
||||
tcx.dcx().span_err(span, "should have no type parameters");
|
||||
}
|
||||
if generic_counts.consts != 0 {
|
||||
let span = tcx.def_span(fn_id);
|
||||
tcx.dcx().span_err(span, "should have no const parameters");
|
||||
}
|
||||
|
||||
let Some(panic_info_did) = tcx.lang_items().panic_info() else {
|
||||
tcx.dcx().err("language item required, but not found: `panic_info`");
|
||||
return;
|
||||
};
|
||||
let panic_info_did = tcx.require_lang_item(hir::LangItem::PanicInfo, Some(span));
|
||||
|
||||
// build type `for<'a, 'b> fn(&'a PanicInfo<'b>) -> !`
|
||||
let panic_info_ty = tcx.type_of(panic_info_did).instantiate(
|
||||
@ -203,11 +199,7 @@ fn check_panic_info_fn(tcx: TyCtxt<'_>, fn_id: LocalDefId, fn_sig: ty::FnSig<'_>
|
||||
|
||||
let _ = check_function_signature(
|
||||
tcx,
|
||||
ObligationCause::new(
|
||||
tcx.def_span(fn_id),
|
||||
fn_id,
|
||||
ObligationCauseCode::LangFunctionType(sym::panic_impl),
|
||||
),
|
||||
ObligationCause::new(span, fn_id, ObligationCauseCode::LangFunctionType(sym::panic_impl)),
|
||||
fn_id.into(),
|
||||
expected_sig,
|
||||
);
|
||||
|
@ -83,14 +83,6 @@ pub struct MethodCallOnUnknownRawPointee {
|
||||
pub span: Span,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_typeck_missing_fn_lang_items)]
|
||||
#[help]
|
||||
pub struct MissingFnLangItems {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_typeck_functional_record_update_on_non_struct, code = E0436)]
|
||||
pub struct FunctionalRecordUpdateOnNonStruct {
|
||||
@ -193,14 +185,6 @@ pub struct AddMissingParenthesesInRange {
|
||||
pub right: Span,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_typeck_op_trait_generic_params)]
|
||||
pub struct OpMethodGenericParams {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
pub method_name: String,
|
||||
}
|
||||
|
||||
pub struct TypeMismatchFruTypo {
|
||||
/// Span of the LHS of the range
|
||||
pub expr_span: Span,
|
||||
|
@ -177,7 +177,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
expr: &'tcx hir::Expr<'tcx>,
|
||||
expected: Expectation<'tcx>,
|
||||
) -> Ty<'tcx> {
|
||||
self.check_expr_with_expectation_and_args(expr, expected, &[])
|
||||
self.check_expr_with_expectation_and_args(expr, expected, &[], None)
|
||||
}
|
||||
|
||||
/// Same as `check_expr_with_expectation`, but allows us to pass in the arguments of a
|
||||
@ -187,6 +187,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
expr: &'tcx hir::Expr<'tcx>,
|
||||
expected: Expectation<'tcx>,
|
||||
args: &'tcx [hir::Expr<'tcx>],
|
||||
call: Option<&'tcx hir::Expr<'tcx>>,
|
||||
) -> Ty<'tcx> {
|
||||
if self.tcx().sess.verbose_internals() {
|
||||
// make this code only run with -Zverbose-internals because it is probably slow
|
||||
@ -233,7 +234,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
let ty = ensure_sufficient_stack(|| match &expr.kind {
|
||||
hir::ExprKind::Path(
|
||||
qpath @ (hir::QPath::Resolved(..) | hir::QPath::TypeRelative(..)),
|
||||
) => self.check_expr_path(qpath, expr, args),
|
||||
) => self.check_expr_path(qpath, expr, args, call),
|
||||
_ => self.check_expr_kind(expr, expected),
|
||||
});
|
||||
let ty = self.resolve_vars_if_possible(ty);
|
||||
@ -300,7 +301,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
ExprKind::Path(QPath::LangItem(lang_item, _)) => {
|
||||
self.check_lang_item_path(lang_item, expr)
|
||||
}
|
||||
ExprKind::Path(ref qpath) => self.check_expr_path(qpath, expr, &[]),
|
||||
ExprKind::Path(ref qpath) => self.check_expr_path(qpath, expr, &[], None),
|
||||
ExprKind::InlineAsm(asm) => {
|
||||
// We defer some asm checks as we may not have resolved the input and output types yet (they may still be infer vars).
|
||||
self.deferred_asm_checks.borrow_mut().push((asm, expr.hir_id));
|
||||
@ -514,6 +515,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
qpath: &'tcx hir::QPath<'tcx>,
|
||||
expr: &'tcx hir::Expr<'tcx>,
|
||||
args: &'tcx [hir::Expr<'tcx>],
|
||||
call: Option<&'tcx hir::Expr<'tcx>>,
|
||||
) -> Ty<'tcx> {
|
||||
let tcx = self.tcx;
|
||||
let (res, opt_ty, segs) =
|
||||
@ -530,7 +532,17 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
let e = report_unexpected_variant_res(tcx, res, qpath, expr.span, E0533, "value");
|
||||
Ty::new_error(tcx, e)
|
||||
}
|
||||
_ => self.instantiate_value_path(segs, opt_ty, res, expr.span, expr.hir_id).0,
|
||||
_ => {
|
||||
self.instantiate_value_path(
|
||||
segs,
|
||||
opt_ty,
|
||||
res,
|
||||
call.map_or(expr.span, |e| e.span),
|
||||
expr.span,
|
||||
expr.hir_id,
|
||||
)
|
||||
.0
|
||||
}
|
||||
};
|
||||
|
||||
if let ty::FnDef(did, _) = *ty.kind() {
|
||||
@ -585,7 +597,11 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
infer::BoundRegionConversionTime::FnCall,
|
||||
fn_sig.output(),
|
||||
);
|
||||
self.require_type_is_sized_deferred(output, expr.span, traits::SizedReturnType);
|
||||
self.require_type_is_sized_deferred(
|
||||
output,
|
||||
call.map_or(expr.span, |e| e.span),
|
||||
traits::SizedCallReturnType,
|
||||
);
|
||||
}
|
||||
|
||||
// We always require that the type provided as the value for
|
||||
@ -1950,6 +1966,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
) {
|
||||
let len = remaining_fields.len();
|
||||
|
||||
#[allow(rustc::potential_query_instability)]
|
||||
let mut displayable_field_names: Vec<&str> =
|
||||
remaining_fields.keys().map(|ident| ident.as_str()).collect();
|
||||
// sorting &str primitives here, sort_unstable is ok
|
||||
|
@ -1073,6 +1073,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
self_ty: Option<LoweredTy<'tcx>>,
|
||||
res: Res,
|
||||
span: Span,
|
||||
path_span: Span,
|
||||
hir_id: hir::HirId,
|
||||
) -> (Ty<'tcx>, Res) {
|
||||
let tcx = self.tcx;
|
||||
@ -1106,7 +1107,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
match container {
|
||||
ty::TraitContainer => callee::check_legal_trait_for_method_call(
|
||||
tcx,
|
||||
span,
|
||||
path_span,
|
||||
None,
|
||||
span,
|
||||
container_id,
|
||||
|
@ -426,7 +426,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
.map(|vars| self.resolve_vars_if_possible(vars)),
|
||||
);
|
||||
|
||||
self.report_arg_errors(
|
||||
self.set_tainted_by_errors(self.report_arg_errors(
|
||||
compatibility_diagonal,
|
||||
formal_and_expected_inputs,
|
||||
provided_args,
|
||||
@ -435,7 +435,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
fn_def_id,
|
||||
call_span,
|
||||
call_expr,
|
||||
);
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
@ -449,7 +449,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
fn_def_id: Option<DefId>,
|
||||
call_span: Span,
|
||||
call_expr: &'tcx hir::Expr<'tcx>,
|
||||
) {
|
||||
) -> ErrorGuaranteed {
|
||||
// Next, let's construct the error
|
||||
let (error_span, full_call_span, call_name, is_method) = match &call_expr.kind {
|
||||
hir::ExprKind::Call(
|
||||
@ -488,10 +488,6 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
}
|
||||
|
||||
let tcx = self.tcx;
|
||||
// FIXME: taint after emitting errors and pass through an `ErrorGuaranteed`
|
||||
self.set_tainted_by_errors(
|
||||
tcx.dcx().span_delayed_bug(call_span, "no errors reported for args"),
|
||||
);
|
||||
|
||||
// Get the argument span in the context of the call span so that
|
||||
// suggestions and labels are (more) correct when an arg is a
|
||||
@ -698,8 +694,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
Some(mismatch_idx),
|
||||
is_method,
|
||||
);
|
||||
err.emit();
|
||||
return;
|
||||
return err.emit();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -723,11 +718,11 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
if cfg!(debug_assertions) {
|
||||
span_bug!(error_span, "expected errors from argument matrix");
|
||||
} else {
|
||||
tcx.dcx().emit_err(errors::ArgMismatchIndeterminate { span: error_span });
|
||||
return tcx.dcx().emit_err(errors::ArgMismatchIndeterminate { span: error_span });
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
let mut reported = None;
|
||||
errors.retain(|error| {
|
||||
let Error::Invalid(provided_idx, expected_idx, Compatibility::Incompatible(Some(e))) =
|
||||
error
|
||||
@ -738,16 +733,18 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
let trace =
|
||||
mk_trace(provided_span, formal_and_expected_inputs[*expected_idx], provided_ty);
|
||||
if !matches!(trace.cause.as_failure_code(*e), FailureCode::Error0308) {
|
||||
self.err_ctxt().report_and_explain_type_error(trace, *e).emit();
|
||||
reported = Some(self.err_ctxt().report_and_explain_type_error(trace, *e).emit());
|
||||
return false;
|
||||
}
|
||||
true
|
||||
});
|
||||
|
||||
// We're done if we found errors, but we already emitted them.
|
||||
if errors.is_empty() {
|
||||
return;
|
||||
if let Some(reported) = reported {
|
||||
assert!(errors.is_empty());
|
||||
return reported;
|
||||
}
|
||||
assert!(!errors.is_empty());
|
||||
|
||||
// Okay, now that we've emitted the special errors separately, we
|
||||
// are only left missing/extra/swapped and mismatched arguments, both
|
||||
@ -804,8 +801,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
Some(expected_idx.as_usize()),
|
||||
is_method,
|
||||
);
|
||||
err.emit();
|
||||
return;
|
||||
return err.emit();
|
||||
}
|
||||
|
||||
let mut err = if formal_and_expected_inputs.len() == provided_args.len() {
|
||||
@ -1253,7 +1249,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
);
|
||||
}
|
||||
|
||||
err.emit();
|
||||
err.emit()
|
||||
}
|
||||
|
||||
fn suggest_ptr_null_mut(
|
||||
|
@ -45,14 +45,6 @@ pub struct FnCtxt<'a, 'tcx> {
|
||||
/// eventually).
|
||||
pub(super) param_env: ty::ParamEnv<'tcx>,
|
||||
|
||||
/// Number of errors that had been reported when we started
|
||||
/// checking this function. On exit, if we find that *more* errors
|
||||
/// have been reported, we will skip regionck and other work that
|
||||
/// expects the types within the function to be consistent.
|
||||
// FIXME(matthewjasper) This should not exist, and it's not correct
|
||||
// if type checking is run in parallel.
|
||||
err_count_on_creation: usize,
|
||||
|
||||
/// If `Some`, this stores coercion information for returned
|
||||
/// expressions. If `None`, this is in a context where return is
|
||||
/// inappropriate, such as a const expression.
|
||||
@ -126,7 +118,6 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
FnCtxt {
|
||||
body_id,
|
||||
param_env,
|
||||
err_count_on_creation: inh.tcx.dcx().err_count(),
|
||||
ret_coercion: None,
|
||||
ret_coercion_span: Cell::new(None),
|
||||
coroutine_types: None,
|
||||
@ -195,10 +186,6 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
}),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn errors_reported_since_creation(&self) -> bool {
|
||||
self.dcx().err_count() > self.err_count_on_creation
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, 'tcx> Deref for FnCtxt<'a, 'tcx> {
|
||||
|
@ -444,15 +444,6 @@ fn fatally_break_rust(tcx: TyCtxt<'_>, span: Span) -> ! {
|
||||
diag.emit()
|
||||
}
|
||||
|
||||
/// `expected` here is the expected number of explicit generic arguments on the trait.
|
||||
fn has_expected_num_generic_args(tcx: TyCtxt<'_>, trait_did: DefId, expected: usize) -> bool {
|
||||
let generics = tcx.generics_of(trait_did);
|
||||
generics.count()
|
||||
== expected
|
||||
+ if generics.has_self { 1 } else { 0 }
|
||||
+ if generics.host_effect_index.is_some() { 1 } else { 0 }
|
||||
}
|
||||
|
||||
pub fn provide(providers: &mut Providers) {
|
||||
method::provide(providers);
|
||||
*providers = Providers {
|
||||
|
@ -10,7 +10,6 @@ mod suggest;
|
||||
pub use self::suggest::SelfSource;
|
||||
pub use self::MethodError::*;
|
||||
|
||||
use crate::errors::OpMethodGenericParams;
|
||||
use crate::FnCtxt;
|
||||
use rustc_errors::{Applicability, Diagnostic, SubdiagnosticMessage};
|
||||
use rustc_hir as hir;
|
||||
@ -385,26 +384,12 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
// type parameters or early-bound regions.
|
||||
let tcx = self.tcx;
|
||||
let Some(method_item) = self.associated_value(trait_def_id, m_name) else {
|
||||
tcx.dcx().span_delayed_bug(
|
||||
obligation.cause.span,
|
||||
"operator trait does not have corresponding operator method",
|
||||
);
|
||||
return None;
|
||||
bug!("expected associated item for operator trait")
|
||||
};
|
||||
|
||||
if method_item.kind != ty::AssocKind::Fn {
|
||||
self.dcx().span_delayed_bug(tcx.def_span(method_item.def_id), "not a method");
|
||||
return None;
|
||||
}
|
||||
|
||||
let def_id = method_item.def_id;
|
||||
let generics = tcx.generics_of(def_id);
|
||||
|
||||
if generics.params.len() != 0 {
|
||||
tcx.dcx().emit_fatal(OpMethodGenericParams {
|
||||
span: tcx.def_span(method_item.def_id),
|
||||
method_name: m_name.to_string(),
|
||||
});
|
||||
if method_item.kind != ty::AssocKind::Fn {
|
||||
span_bug!(tcx.def_span(def_id), "expected `{m_name}` to be an associated function");
|
||||
}
|
||||
|
||||
debug!("lookup_in_trait_adjusted: method_item={:?}", method_item);
|
||||
|
@ -1,7 +1,7 @@
|
||||
//! Code related to processing overloaded binary and unary operators.
|
||||
|
||||
use super::method::MethodCallee;
|
||||
use super::{has_expected_num_generic_args, FnCtxt};
|
||||
use super::FnCtxt;
|
||||
use crate::Expectation;
|
||||
use rustc_ast as ast;
|
||||
use rustc_data_structures::packed::Pu128;
|
||||
@ -887,25 +887,6 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
lhs_ty, op, opname, trait_did
|
||||
);
|
||||
|
||||
// Catches cases like #83893, where a lang item is declared with the
|
||||
// wrong number of generic arguments. Should have yielded an error
|
||||
// elsewhere by now, but we have to catch it here so that we do not
|
||||
// index `other_tys` out of bounds (if the lang item has too many
|
||||
// generic arguments, `other_tys` is too short).
|
||||
if !has_expected_num_generic_args(
|
||||
self.tcx,
|
||||
trait_did,
|
||||
match op {
|
||||
// Binary ops have a generic right-hand side, unary ops don't
|
||||
Op::Binary(..) => 1,
|
||||
Op::Unary(..) => 0,
|
||||
},
|
||||
) {
|
||||
self.dcx()
|
||||
.span_delayed_bug(span, "operator didn't have the right number of generic args");
|
||||
return Err(vec![]);
|
||||
}
|
||||
|
||||
let opname = Ident::with_dummy_span(opname);
|
||||
let (opt_rhs_expr, opt_rhs_ty) = opt_rhs.unzip();
|
||||
let input_types = opt_rhs_ty.as_slice();
|
||||
|
@ -923,7 +923,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
|
||||
// Type-check the path.
|
||||
let (pat_ty, pat_res) =
|
||||
self.instantiate_value_path(segments, opt_ty, res, pat.span, pat.hir_id);
|
||||
self.instantiate_value_path(segments, opt_ty, res, pat.span, pat.span, pat.hir_id);
|
||||
if let Some(err) =
|
||||
self.demand_suptype_with_origin(&self.pattern_cause(ti, pat.span), expected, pat_ty)
|
||||
{
|
||||
@ -1078,7 +1078,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
|
||||
// Type-check the path.
|
||||
let (pat_ty, res) =
|
||||
self.instantiate_value_path(segments, opt_ty, res, pat.span, pat.hir_id);
|
||||
self.instantiate_value_path(segments, opt_ty, res, pat.span, pat.span, pat.hir_id);
|
||||
if !pat_ty.is_fn() {
|
||||
let e = report_unexpected_res(res);
|
||||
return Ty::new_error(tcx, e);
|
||||
|
@ -1,5 +1,5 @@
|
||||
use crate::method::MethodCallee;
|
||||
use crate::{has_expected_num_generic_args, FnCtxt, PlaceOp};
|
||||
use crate::{FnCtxt, PlaceOp};
|
||||
use rustc_ast as ast;
|
||||
use rustc_errors::Applicability;
|
||||
use rustc_hir as hir;
|
||||
@ -209,20 +209,6 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
return None;
|
||||
};
|
||||
|
||||
// If the lang item was declared incorrectly, stop here so that we don't
|
||||
// run into an ICE (#83893). The error is reported where the lang item is
|
||||
// declared.
|
||||
if !has_expected_num_generic_args(
|
||||
self.tcx,
|
||||
imm_tr,
|
||||
match op {
|
||||
PlaceOp::Deref => 0,
|
||||
PlaceOp::Index => 1,
|
||||
},
|
||||
) {
|
||||
return None;
|
||||
}
|
||||
|
||||
self.lookup_method_in_trait(
|
||||
self.misc(span),
|
||||
Ident::with_dummy_span(imm_op),
|
||||
@ -249,20 +235,6 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
return None;
|
||||
};
|
||||
|
||||
// If the lang item was declared incorrectly, stop here so that we don't
|
||||
// run into an ICE (#83893). The error is reported where the lang item is
|
||||
// declared.
|
||||
if !has_expected_num_generic_args(
|
||||
self.tcx,
|
||||
mut_tr,
|
||||
match op {
|
||||
PlaceOp::Deref => 0,
|
||||
PlaceOp::Index => 1,
|
||||
},
|
||||
) {
|
||||
return None;
|
||||
}
|
||||
|
||||
self.lookup_method_in_trait(
|
||||
self.misc(span),
|
||||
Ident::with_dummy_span(mut_op),
|
||||
|
@ -278,7 +278,8 @@ pub struct InferCtxt<'tcx> {
|
||||
|
||||
/// The set of predicates on which errors have been reported, to
|
||||
/// avoid reporting the same error twice.
|
||||
pub reported_trait_errors: RefCell<FxIndexMap<Span, Vec<ty::Predicate<'tcx>>>>,
|
||||
pub reported_trait_errors:
|
||||
RefCell<FxIndexMap<Span, (Vec<ty::Predicate<'tcx>>, ErrorGuaranteed)>>,
|
||||
|
||||
pub reported_signature_mismatch: RefCell<FxHashSet<(Span, Option<Span>)>>,
|
||||
|
||||
|
@ -326,11 +326,9 @@ impl LintStore {
|
||||
|
||||
/// True if this symbol represents a lint group name.
|
||||
pub fn is_lint_group(&self, lint_name: Symbol) -> bool {
|
||||
debug!(
|
||||
"is_lint_group(lint_name={:?}, lint_groups={:?})",
|
||||
lint_name,
|
||||
self.lint_groups.keys().collect::<Vec<_>>()
|
||||
);
|
||||
#[allow(rustc::potential_query_instability)]
|
||||
let lint_groups = self.lint_groups.keys().collect::<Vec<_>>();
|
||||
debug!("is_lint_group(lint_name={:?}, lint_groups={:?})", lint_name, lint_groups);
|
||||
let lint_name_str = lint_name.as_str();
|
||||
self.lint_groups.contains_key(lint_name_str) || {
|
||||
let warnings_name_str = crate::WARNINGS.name_lower();
|
||||
@ -374,8 +372,12 @@ impl LintStore {
|
||||
None => {
|
||||
// 1. The tool is currently running, so this lint really doesn't exist.
|
||||
// FIXME: should this handle tools that never register a lint, like rustfmt?
|
||||
debug!("lints={:?}", self.by_name.keys().collect::<Vec<_>>());
|
||||
#[allow(rustc::potential_query_instability)]
|
||||
let lints = self.by_name.keys().collect::<Vec<_>>();
|
||||
debug!("lints={:?}", lints);
|
||||
let tool_prefix = format!("{tool_name}::");
|
||||
|
||||
#[allow(rustc::potential_query_instability)]
|
||||
return if self.by_name.keys().any(|lint| lint.starts_with(&tool_prefix)) {
|
||||
self.no_lint_suggestion(&complete_name, tool_name.as_str())
|
||||
} else {
|
||||
|
@ -185,6 +185,7 @@ pub(super) fn builtin(
|
||||
db.note("see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information");
|
||||
}
|
||||
BuiltinLintDiagnostics::UnexpectedCfgName((name, name_span), value) => {
|
||||
#[allow(rustc::potential_query_instability)]
|
||||
let possibilities: Vec<Symbol> =
|
||||
sess.parse_sess.check_config.expecteds.keys().copied().collect();
|
||||
let is_from_cargo = std::env::var_os("CARGO").is_some();
|
||||
|
16
compiler/rustc_macros/build.rs
Normal file
16
compiler/rustc_macros/build.rs
Normal file
@ -0,0 +1,16 @@
|
||||
fn main() {
|
||||
println!("cargo:rerun-if-changed=build.rs");
|
||||
println!("cargo:rerun-if-env-changed=RUSTC_BOOTSTRAP");
|
||||
if !std::env::var("RUSTC_BOOTSTRAP").is_ok() {
|
||||
eprintln!(
|
||||
"error: you are attempting to build the compiler without going through bootstrap"
|
||||
);
|
||||
eprintln!(
|
||||
"help: see https://rustc-dev-guide.rust-lang.org/building/how-to-build-and-run.html for how to build the compiler"
|
||||
);
|
||||
eprintln!(
|
||||
"help: if you know what you're doing, set the RUSTC_BOOTSTRAP environment variable to any value"
|
||||
);
|
||||
panic!("wrong command used for building");
|
||||
}
|
||||
}
|
@ -292,6 +292,8 @@ pub enum ObligationCauseCode<'tcx> {
|
||||
SizedArgumentType(Option<hir::HirId>),
|
||||
/// Return type must be `Sized`.
|
||||
SizedReturnType,
|
||||
/// Return type of a call expression must be `Sized`.
|
||||
SizedCallReturnType,
|
||||
/// Yield type must be `Sized`.
|
||||
SizedYieldType,
|
||||
/// Inline asm operand type must be `Sized`.
|
||||
|
@ -5,8 +5,10 @@
|
||||
//! item.
|
||||
|
||||
use crate::{errors, fluent_generated as fluent};
|
||||
use rustc_ast::{ast, AttrStyle, Attribute, LitKind, MetaItemKind, MetaItemLit, NestedMetaItem};
|
||||
use rustc_ast::{ast, AttrKind, AttrStyle, Attribute, LitKind};
|
||||
use rustc_ast::{MetaItemKind, MetaItemLit, NestedMetaItem};
|
||||
use rustc_data_structures::fx::FxHashMap;
|
||||
use rustc_errors::StashKey;
|
||||
use rustc_errors::{Applicability, DiagCtxt, IntoDiagnosticArg, MultiSpan};
|
||||
use rustc_feature::{AttributeDuplicates, AttributeType, BuiltinAttribute, BUILTIN_ATTRIBUTE_MAP};
|
||||
use rustc_hir as hir;
|
||||
@ -2530,6 +2532,14 @@ fn check_invalid_crate_level_attr(tcx: TyCtxt<'_>, attrs: &[Attribute]) {
|
||||
if attr.style == AttrStyle::Inner {
|
||||
for attr_to_check in ATTRS_TO_CHECK {
|
||||
if attr.has_name(*attr_to_check) {
|
||||
if let AttrKind::Normal(ref p) = attr.kind
|
||||
&& let Some(diag) = tcx.dcx().steal_diagnostic(
|
||||
p.item.path.span,
|
||||
StashKey::UndeterminedMacroResolution,
|
||||
)
|
||||
{
|
||||
diag.cancel();
|
||||
}
|
||||
let item = tcx
|
||||
.hir()
|
||||
.items()
|
||||
|
@ -1,10 +1,9 @@
|
||||
//! A bunch of methods and structures more or less related to resolving macros and
|
||||
//! interface provided by `Resolver` to macro expander.
|
||||
|
||||
use crate::errors::{
|
||||
self, AddAsNonDerive, CannotDetermineMacroResolution, CannotFindIdentInThisScope,
|
||||
MacroExpectedFound, RemoveSurroundingDerive,
|
||||
};
|
||||
use crate::errors::CannotDetermineMacroResolution;
|
||||
use crate::errors::{self, AddAsNonDerive, CannotFindIdentInThisScope};
|
||||
use crate::errors::{MacroExpectedFound, RemoveSurroundingDerive};
|
||||
use crate::Namespace::*;
|
||||
use crate::{BuiltinMacroState, Determinacy, MacroData};
|
||||
use crate::{DeriveData, Finalize, ParentScope, ResolutionError, Resolver, ScopeSet};
|
||||
@ -15,7 +14,7 @@ use rustc_ast_pretty::pprust;
|
||||
use rustc_attr::StabilityLevel;
|
||||
use rustc_data_structures::intern::Interned;
|
||||
use rustc_data_structures::sync::Lrc;
|
||||
use rustc_errors::{codes::*, struct_span_code_err, Applicability};
|
||||
use rustc_errors::{codes::*, struct_span_code_err, Applicability, StashKey};
|
||||
use rustc_expand::base::{Annotatable, DeriveResolutions, Indeterminate, ResolverExpand};
|
||||
use rustc_expand::base::{SyntaxExtension, SyntaxExtensionKind};
|
||||
use rustc_expand::compile_declarative_macro;
|
||||
@ -25,9 +24,8 @@ use rustc_hir::def_id::{CrateNum, DefId, LocalDefId};
|
||||
use rustc_middle::middle::stability;
|
||||
use rustc_middle::ty::RegisteredTools;
|
||||
use rustc_middle::ty::{TyCtxt, Visibility};
|
||||
use rustc_session::lint::builtin::{
|
||||
LEGACY_DERIVE_HELPERS, SOFT_UNSTABLE, UNKNOWN_OR_MALFORMED_DIAGNOSTIC_ATTRIBUTES,
|
||||
};
|
||||
use rustc_session::lint::builtin::UNKNOWN_OR_MALFORMED_DIAGNOSTIC_ATTRIBUTES;
|
||||
use rustc_session::lint::builtin::{LEGACY_DERIVE_HELPERS, SOFT_UNSTABLE};
|
||||
use rustc_session::lint::builtin::{UNUSED_MACROS, UNUSED_MACRO_RULES};
|
||||
use rustc_session::lint::BuiltinLintDiagnostics;
|
||||
use rustc_session::parse::feature_err;
|
||||
@ -703,21 +701,21 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
|
||||
// situations should be reported as errors, so this is a bug.
|
||||
this.dcx().span_delayed_bug(span, "inconsistent resolution for a macro");
|
||||
}
|
||||
} else {
|
||||
} else if this.tcx.dcx().has_errors().is_none() && this.privacy_errors.is_empty() {
|
||||
// It's possible that the macro was unresolved (indeterminate) and silently
|
||||
// expanded into a dummy fragment for recovery during expansion.
|
||||
// Now, post-expansion, the resolution may succeed, but we can't change the
|
||||
// past and need to report an error.
|
||||
// However, non-speculative `resolve_path` can successfully return private items
|
||||
// even if speculative `resolve_path` returned nothing previously, so we skip this
|
||||
// less informative error if the privacy error is reported elsewhere.
|
||||
if this.privacy_errors.is_empty() {
|
||||
this.dcx().emit_err(CannotDetermineMacroResolution {
|
||||
span,
|
||||
kind: kind.descr(),
|
||||
path: Segment::names_to_string(path),
|
||||
});
|
||||
}
|
||||
// less informative error if no other error is reported elsewhere.
|
||||
|
||||
let err = this.dcx().create_err(CannotDetermineMacroResolution {
|
||||
span,
|
||||
kind: kind.descr(),
|
||||
path: Segment::names_to_string(path),
|
||||
});
|
||||
err.stash(span, StashKey::UndeterminedMacroResolution);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -1789,7 +1789,6 @@ symbols! {
|
||||
warn,
|
||||
wasm_abi,
|
||||
wasm_import_module,
|
||||
wasm_preview2,
|
||||
wasm_target_feature,
|
||||
while_let,
|
||||
windows,
|
||||
|
@ -1574,7 +1574,6 @@ supported_targets! {
|
||||
("wasm32-unknown-emscripten", wasm32_unknown_emscripten),
|
||||
("wasm32-unknown-unknown", wasm32_unknown_unknown),
|
||||
("wasm32-wasi", wasm32_wasi),
|
||||
("wasm32-wasi-preview2", wasm32_wasi_preview2),
|
||||
("wasm32-wasi-preview1-threads", wasm32_wasi_preview1_threads),
|
||||
("wasm64-unknown-unknown", wasm64_unknown_unknown),
|
||||
|
||||
|
@ -72,12 +72,11 @@
|
||||
//! best we can with this target. Don't start relying on too much here unless
|
||||
//! you know what you're getting in to!
|
||||
|
||||
use crate::spec::{base, crt_objects, cvs, Cc, LinkSelfContainedDefault, LinkerFlavor, Target};
|
||||
use crate::spec::{base, crt_objects, Cc, LinkSelfContainedDefault, LinkerFlavor, Target};
|
||||
|
||||
pub fn target() -> Target {
|
||||
let mut options = base::wasm::options();
|
||||
|
||||
options.families = cvs!["wasm", "wasi"];
|
||||
options.os = "wasi".into();
|
||||
|
||||
options.add_pre_link_args(
|
||||
|
@ -1,64 +0,0 @@
|
||||
//! The `wasm32-wasi-preview2` target is the next evolution of the
|
||||
//! wasm32-wasi target. While the wasi specification is still under
|
||||
//! active development, the {review 2 iteration is considered an "island
|
||||
//! of stability" that should allow users to rely on it indefinitely.
|
||||
//!
|
||||
//! The `wasi` target is a proposal to define a standardized set of WebAssembly
|
||||
//! component imports that allow it to interoperate with the host system in a
|
||||
//! standardized way. This set of imports is intended to empower WebAssembly
|
||||
//! binaries with host capabilities such as filesystem access, network access, etc.
|
||||
//!
|
||||
//! Wasi Preview 2 relies on the WebAssembly component model which is an extension of
|
||||
//! the core WebAssembly specification which allows interoperability between WebAssembly
|
||||
//! modules (known as "components") through high-level, shared-nothing APIs instead of the
|
||||
//! low-level, shared-everything linear memory model of the core WebAssembly specification.
|
||||
//!
|
||||
//! You can see more about wasi at <https://wasi.dev> and the component model at
|
||||
//! <https://github.com/WebAssembly/component-model>.
|
||||
|
||||
use crate::spec::crt_objects;
|
||||
use crate::spec::LinkSelfContainedDefault;
|
||||
use crate::spec::{base, Target};
|
||||
|
||||
pub fn target() -> Target {
|
||||
let mut options = base::wasm::options();
|
||||
|
||||
options.os = "wasi".into();
|
||||
options.env = "preview2".into();
|
||||
options.linker = Some("wasm-component-ld".into());
|
||||
|
||||
options.pre_link_objects_self_contained = crt_objects::pre_wasi_self_contained();
|
||||
options.post_link_objects_self_contained = crt_objects::post_wasi_self_contained();
|
||||
|
||||
// FIXME: Figure out cases in which WASM needs to link with a native toolchain.
|
||||
options.link_self_contained = LinkSelfContainedDefault::True;
|
||||
|
||||
// Right now this is a bit of a workaround but we're currently saying that
|
||||
// the target by default has a static crt which we're taking as a signal
|
||||
// for "use the bundled crt". If that's turned off then the system's crt
|
||||
// will be used, but this means that default usage of this target doesn't
|
||||
// need an external compiler but it's still interoperable with an external
|
||||
// compiler if configured correctly.
|
||||
options.crt_static_default = true;
|
||||
options.crt_static_respected = true;
|
||||
|
||||
// Allow `+crt-static` to create a "cdylib" output which is just a wasm file
|
||||
// without a main function.
|
||||
options.crt_static_allows_dylibs = true;
|
||||
|
||||
// WASI's `sys::args::init` function ignores its arguments; instead,
|
||||
// `args::args()` makes the WASI API calls itself.
|
||||
options.main_needs_argc_argv = false;
|
||||
|
||||
// And, WASI mangles the name of "main" to distinguish between different
|
||||
// signatures.
|
||||
options.entry_name = "__main_void".into();
|
||||
|
||||
Target {
|
||||
llvm_target: "wasm32-unknown-unknown".into(),
|
||||
pointer_width: 32,
|
||||
data_layout: "e-m:e-p:32:32-p10:8:8-p20:8:8-i64:64-n32:64-S128-ni:1:10:20".into(),
|
||||
arch: "wasm32".into(),
|
||||
options,
|
||||
}
|
||||
}
|
@ -513,6 +513,7 @@ impl<'tcx> AutoTraitFinder<'tcx> {
|
||||
}
|
||||
|
||||
while !vid_map.is_empty() {
|
||||
#[allow(rustc::potential_query_instability)]
|
||||
let target = *vid_map.keys().next().expect("Keys somehow empty");
|
||||
let deps = vid_map.remove(&target).expect("Entry somehow missing");
|
||||
|
||||
|
@ -3292,7 +3292,7 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
|
||||
err.help("unsized fn params are gated as an unstable feature");
|
||||
}
|
||||
}
|
||||
ObligationCauseCode::SizedReturnType => {
|
||||
ObligationCauseCode::SizedReturnType | ObligationCauseCode::SizedCallReturnType => {
|
||||
err.note("the return type of a function must have a statically known size");
|
||||
}
|
||||
ObligationCauseCode::SizedYieldType => {
|
||||
|
@ -99,7 +99,7 @@ pub trait TypeErrCtxtExt<'tcx> {
|
||||
obligation: PredicateObligation<'tcx>,
|
||||
root_obligation: &PredicateObligation<'tcx>,
|
||||
error: &SelectionError<'tcx>,
|
||||
);
|
||||
) -> ErrorGuaranteed;
|
||||
|
||||
fn emit_specialized_closure_kind_error(
|
||||
&self,
|
||||
@ -107,7 +107,10 @@ pub trait TypeErrCtxtExt<'tcx> {
|
||||
trait_ref: ty::PolyTraitRef<'tcx>,
|
||||
) -> Option<ErrorGuaranteed>;
|
||||
|
||||
fn fn_arg_obligation(&self, obligation: &PredicateObligation<'tcx>) -> bool;
|
||||
fn fn_arg_obligation(
|
||||
&self,
|
||||
obligation: &PredicateObligation<'tcx>,
|
||||
) -> Result<(), ErrorGuaranteed>;
|
||||
|
||||
fn try_conversion_context(
|
||||
&self,
|
||||
@ -142,6 +145,7 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
|
||||
(
|
||||
span,
|
||||
predicates
|
||||
.0
|
||||
.iter()
|
||||
.map(|&predicate| ErrorDescriptor { predicate, index: None })
|
||||
.collect(),
|
||||
@ -208,10 +212,13 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
|
||||
}
|
||||
}
|
||||
|
||||
let mut reported = None;
|
||||
|
||||
for from_expansion in [false, true] {
|
||||
for (error, suppressed) in iter::zip(&errors, &is_suppressed) {
|
||||
if !suppressed && error.obligation.cause.span.from_expansion() == from_expansion {
|
||||
self.report_fulfillment_error(error);
|
||||
let guar = self.report_fulfillment_error(error);
|
||||
reported = Some(guar);
|
||||
// We want to ignore desugarings here: spans are equivalent even
|
||||
// if one is the result of a desugaring and the other is not.
|
||||
let mut span = error.obligation.cause.span;
|
||||
@ -222,13 +229,17 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
|
||||
self.reported_trait_errors
|
||||
.borrow_mut()
|
||||
.entry(span)
|
||||
.or_default()
|
||||
.or_insert_with(|| (vec![], guar))
|
||||
.0
|
||||
.push(error.obligation.predicate);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
self.dcx().delayed_bug("expected fulfillment errors")
|
||||
// It could be that we don't report an error because we have seen an `ErrorReported` from another source.
|
||||
// We should probably be able to fix most of these, but some are delayed bugs that get a proper error
|
||||
// after this function.
|
||||
reported.unwrap_or_else(|| self.dcx().delayed_bug("failed to report fulfillment errors"))
|
||||
}
|
||||
|
||||
/// Reports that an overflow has occurred and halts compilation. We
|
||||
@ -374,7 +385,7 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
|
||||
mut obligation: PredicateObligation<'tcx>,
|
||||
root_obligation: &PredicateObligation<'tcx>,
|
||||
error: &SelectionError<'tcx>,
|
||||
) {
|
||||
) -> ErrorGuaranteed {
|
||||
let tcx = self.tcx;
|
||||
|
||||
if tcx.sess.opts.unstable_opts.next_solver.map(|c| c.dump_tree).unwrap_or_default()
|
||||
@ -384,10 +395,6 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
|
||||
}
|
||||
|
||||
let mut span = obligation.cause.span;
|
||||
// FIXME: statically guarantee this by tainting after the diagnostic is emitted
|
||||
self.set_tainted_by_errors(
|
||||
tcx.dcx().span_delayed_bug(span, "`report_selection_error` did not emit an error"),
|
||||
);
|
||||
|
||||
let mut err = match *error {
|
||||
SelectionError::Unimplemented => {
|
||||
@ -412,21 +419,19 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
|
||||
kind: _,
|
||||
} = *obligation.cause.code()
|
||||
{
|
||||
self.report_extra_impl_obligation(
|
||||
return self.report_extra_impl_obligation(
|
||||
span,
|
||||
impl_item_def_id,
|
||||
trait_item_def_id,
|
||||
&format!("`{}`", obligation.predicate),
|
||||
)
|
||||
.emit();
|
||||
return;
|
||||
.emit()
|
||||
}
|
||||
|
||||
// Report a const-param specific error
|
||||
if let ObligationCauseCode::ConstParam(ty) = *obligation.cause.code().peel_derives()
|
||||
{
|
||||
self.report_const_param_not_wf(ty, &obligation).emit();
|
||||
return;
|
||||
return self.report_const_param_not_wf(ty, &obligation).emit();
|
||||
}
|
||||
|
||||
let bound_predicate = obligation.predicate.kind();
|
||||
@ -436,22 +441,22 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
|
||||
let trait_predicate = self.resolve_vars_if_possible(trait_predicate);
|
||||
let trait_ref = trait_predicate.to_poly_trait_ref();
|
||||
|
||||
if let Some(_guar) = self.emit_specialized_closure_kind_error(&obligation, trait_ref) {
|
||||
return;
|
||||
if let Some(guar) = self.emit_specialized_closure_kind_error(&obligation, trait_ref) {
|
||||
return guar;
|
||||
}
|
||||
|
||||
// FIXME(effects)
|
||||
let predicate_is_const = false;
|
||||
|
||||
if self.dcx().has_errors().is_some()
|
||||
if let Some(guar) = self.dcx().has_errors()
|
||||
&& trait_predicate.references_error()
|
||||
{
|
||||
return;
|
||||
return guar;
|
||||
}
|
||||
if self.fn_arg_obligation(&obligation) {
|
||||
// Silence redundant errors on binding acccess that are already
|
||||
// reported on the binding definition (#56607).
|
||||
return;
|
||||
// Silence redundant errors on binding acccess that are already
|
||||
// reported on the binding definition (#56607).
|
||||
if let Err(guar) = self.fn_arg_obligation(&obligation) {
|
||||
return guar;
|
||||
}
|
||||
let mut file = None;
|
||||
let (post_message, pre_message, type_def) = self
|
||||
@ -515,7 +520,7 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
|
||||
trait_ref,
|
||||
span,
|
||||
) {
|
||||
GetSafeTransmuteErrorAndReason::Silent => return,
|
||||
GetSafeTransmuteErrorAndReason::Silent => return self.dcx().span_delayed_bug(span, "silent safe transmute error"),
|
||||
GetSafeTransmuteErrorAndReason::Error {
|
||||
err_msg,
|
||||
safe_transmute_explanation,
|
||||
@ -576,8 +581,7 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
|
||||
have_alt_message,
|
||||
) {
|
||||
self.note_obligation_cause(&mut err, &obligation);
|
||||
err.emit();
|
||||
return;
|
||||
return err.emit();
|
||||
}
|
||||
|
||||
file_note.map(|note| err.note(note));
|
||||
@ -680,13 +684,11 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
|
||||
}
|
||||
|
||||
if self.suggest_add_clone_to_arg(&obligation, &mut err, trait_predicate) {
|
||||
err.emit();
|
||||
return;
|
||||
return err.emit();
|
||||
}
|
||||
|
||||
if self.suggest_impl_trait(&mut err, &obligation, trait_predicate) {
|
||||
err.emit();
|
||||
return;
|
||||
return err.emit();
|
||||
}
|
||||
|
||||
if is_unsize {
|
||||
@ -776,8 +778,7 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
|
||||
Some(sym::Debug | sym::Display)
|
||||
)
|
||||
{
|
||||
err.emit();
|
||||
return;
|
||||
return err.emit();
|
||||
}
|
||||
|
||||
err
|
||||
@ -912,8 +913,8 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
|
||||
found_trait_ref,
|
||||
expected_trait_ref,
|
||||
) {
|
||||
Some(err) => err,
|
||||
None => return,
|
||||
Ok(err) => err,
|
||||
Err(guar) => return guar,
|
||||
}
|
||||
}
|
||||
|
||||
@ -934,15 +935,15 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
|
||||
}
|
||||
SelectionError::NotConstEvaluatable(NotConstEvaluatable::MentionsParam) => {
|
||||
match self.report_not_const_evaluatable_error(&obligation, span) {
|
||||
Some(err) => err,
|
||||
None => return,
|
||||
Ok(err) => err,
|
||||
Err(guar) => return guar,
|
||||
}
|
||||
}
|
||||
|
||||
// Already reported in the query.
|
||||
SelectionError::NotConstEvaluatable(NotConstEvaluatable::Error(_)) |
|
||||
SelectionError::NotConstEvaluatable(NotConstEvaluatable::Error(guar)) |
|
||||
// Already reported.
|
||||
Overflow(OverflowError::Error(_)) => return,
|
||||
Overflow(OverflowError::Error(guar)) => return guar,
|
||||
|
||||
Overflow(_) => {
|
||||
bug!("overflow should be handled before the `report_selection_error` path");
|
||||
@ -951,7 +952,7 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
|
||||
|
||||
self.note_obligation_cause(&mut err, &obligation);
|
||||
self.point_at_returns_when_relevant(&mut err, &obligation);
|
||||
err.emit();
|
||||
err.emit()
|
||||
}
|
||||
|
||||
fn emit_specialized_closure_kind_error(
|
||||
@ -986,7 +987,10 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
|
||||
}
|
||||
}
|
||||
|
||||
fn fn_arg_obligation(&self, obligation: &PredicateObligation<'tcx>) -> bool {
|
||||
fn fn_arg_obligation(
|
||||
&self,
|
||||
obligation: &PredicateObligation<'tcx>,
|
||||
) -> Result<(), ErrorGuaranteed> {
|
||||
if let ObligationCauseCode::FunctionArgumentObligation { arg_hir_id, .. } =
|
||||
obligation.cause.code()
|
||||
&& let Some(Node::Expr(arg)) = self.tcx.opt_hir_node(*arg_hir_id)
|
||||
@ -996,12 +1000,12 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
|
||||
hir::Path { res: hir::def::Res::Local(hir_id), .. },
|
||||
)) = arg.kind
|
||||
&& let Some(Node::Pat(pat)) = self.tcx.opt_hir_node(*hir_id)
|
||||
&& let Some(preds) = self.reported_trait_errors.borrow().get(&pat.span)
|
||||
&& let Some((preds, guar)) = self.reported_trait_errors.borrow().get(&pat.span)
|
||||
&& preds.contains(&obligation.predicate)
|
||||
{
|
||||
return true;
|
||||
return Err(*guar);
|
||||
}
|
||||
false
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// When the `E` of the resulting `Result<T, E>` in an expression `foo().bar().baz()?`,
|
||||
@ -1323,13 +1327,13 @@ pub(super) trait InferCtxtPrivExt<'tcx> {
|
||||
// `error` occurring implies that `cond` occurs.
|
||||
fn error_implies(&self, cond: ty::Predicate<'tcx>, error: ty::Predicate<'tcx>) -> bool;
|
||||
|
||||
fn report_fulfillment_error(&self, error: &FulfillmentError<'tcx>);
|
||||
fn report_fulfillment_error(&self, error: &FulfillmentError<'tcx>) -> ErrorGuaranteed;
|
||||
|
||||
fn report_projection_error(
|
||||
&self,
|
||||
obligation: &PredicateObligation<'tcx>,
|
||||
error: &MismatchedProjectionTypes<'tcx>,
|
||||
);
|
||||
) -> ErrorGuaranteed;
|
||||
|
||||
fn maybe_detailed_projection_msg(
|
||||
&self,
|
||||
@ -1395,7 +1399,7 @@ pub(super) trait InferCtxtPrivExt<'tcx> {
|
||||
trait_ref_and_ty: ty::Binder<'tcx, (ty::TraitPredicate<'tcx>, Ty<'tcx>)>,
|
||||
) -> PredicateObligation<'tcx>;
|
||||
|
||||
fn maybe_report_ambiguity(&self, obligation: &PredicateObligation<'tcx>);
|
||||
fn maybe_report_ambiguity(&self, obligation: &PredicateObligation<'tcx>) -> ErrorGuaranteed;
|
||||
|
||||
fn predicate_can_apply(
|
||||
&self,
|
||||
@ -1512,13 +1516,13 @@ pub(super) trait InferCtxtPrivExt<'tcx> {
|
||||
span: Span,
|
||||
found_trait_ref: ty::Binder<'tcx, ty::TraitRef<'tcx>>,
|
||||
expected_trait_ref: ty::Binder<'tcx, ty::TraitRef<'tcx>>,
|
||||
) -> Option<DiagnosticBuilder<'tcx>>;
|
||||
) -> Result<DiagnosticBuilder<'tcx>, ErrorGuaranteed>;
|
||||
|
||||
fn report_not_const_evaluatable_error(
|
||||
&self,
|
||||
obligation: &PredicateObligation<'tcx>,
|
||||
span: Span,
|
||||
) -> Option<DiagnosticBuilder<'tcx>>;
|
||||
) -> Result<DiagnosticBuilder<'tcx>, ErrorGuaranteed>;
|
||||
}
|
||||
|
||||
impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
|
||||
@ -1564,7 +1568,7 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
|
||||
}
|
||||
|
||||
#[instrument(skip(self), level = "debug")]
|
||||
fn report_fulfillment_error(&self, error: &FulfillmentError<'tcx>) {
|
||||
fn report_fulfillment_error(&self, error: &FulfillmentError<'tcx>) -> ErrorGuaranteed {
|
||||
if self.tcx.sess.opts.unstable_opts.next_solver.map(|c| c.dump_tree).unwrap_or_default()
|
||||
== DumpSolverProofTree::OnError
|
||||
{
|
||||
@ -1572,31 +1576,29 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
|
||||
}
|
||||
|
||||
match error.code {
|
||||
FulfillmentErrorCode::SelectionError(ref selection_error) => {
|
||||
self.report_selection_error(
|
||||
FulfillmentErrorCode::SelectionError(ref selection_error) => self
|
||||
.report_selection_error(
|
||||
error.obligation.clone(),
|
||||
&error.root_obligation,
|
||||
selection_error,
|
||||
);
|
||||
}
|
||||
),
|
||||
FulfillmentErrorCode::ProjectionError(ref e) => {
|
||||
self.report_projection_error(&error.obligation, e);
|
||||
self.report_projection_error(&error.obligation, e)
|
||||
}
|
||||
FulfillmentErrorCode::Ambiguity { overflow: false } => {
|
||||
self.maybe_report_ambiguity(&error.obligation);
|
||||
self.maybe_report_ambiguity(&error.obligation)
|
||||
}
|
||||
FulfillmentErrorCode::Ambiguity { overflow: true } => {
|
||||
self.report_overflow_no_abort(error.obligation.clone());
|
||||
self.report_overflow_no_abort(error.obligation.clone())
|
||||
}
|
||||
FulfillmentErrorCode::SubtypeError(ref expected_found, ref err) => {
|
||||
self.report_mismatched_types(
|
||||
FulfillmentErrorCode::SubtypeError(ref expected_found, ref err) => self
|
||||
.report_mismatched_types(
|
||||
&error.obligation.cause,
|
||||
expected_found.expected,
|
||||
expected_found.found,
|
||||
*err,
|
||||
)
|
||||
.emit();
|
||||
}
|
||||
.emit(),
|
||||
FulfillmentErrorCode::ConstEquateError(ref expected_found, ref err) => {
|
||||
let mut diag = self.report_mismatched_consts(
|
||||
&error.obligation.cause,
|
||||
@ -1620,11 +1622,9 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
|
||||
&mut Default::default(),
|
||||
);
|
||||
}
|
||||
diag.emit();
|
||||
}
|
||||
FulfillmentErrorCode::Cycle(ref cycle) => {
|
||||
self.report_overflow_obligation_cycle(cycle);
|
||||
diag.emit()
|
||||
}
|
||||
FulfillmentErrorCode::Cycle(ref cycle) => self.report_overflow_obligation_cycle(cycle),
|
||||
}
|
||||
}
|
||||
|
||||
@ -1633,11 +1633,11 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
|
||||
&self,
|
||||
obligation: &PredicateObligation<'tcx>,
|
||||
error: &MismatchedProjectionTypes<'tcx>,
|
||||
) {
|
||||
) -> ErrorGuaranteed {
|
||||
let predicate = self.resolve_vars_if_possible(obligation.predicate);
|
||||
|
||||
if predicate.references_error() {
|
||||
return;
|
||||
if let Err(e) = predicate.error_reported() {
|
||||
return e;
|
||||
}
|
||||
|
||||
self.probe(|_| {
|
||||
@ -1802,8 +1802,8 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
|
||||
false,
|
||||
);
|
||||
self.note_obligation_cause(&mut diag, obligation);
|
||||
diag.emit();
|
||||
});
|
||||
diag.emit()
|
||||
})
|
||||
}
|
||||
|
||||
fn maybe_detailed_projection_msg(
|
||||
@ -2341,7 +2341,7 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
|
||||
}
|
||||
|
||||
#[instrument(skip(self), level = "debug")]
|
||||
fn maybe_report_ambiguity(&self, obligation: &PredicateObligation<'tcx>) {
|
||||
fn maybe_report_ambiguity(&self, obligation: &PredicateObligation<'tcx>) -> ErrorGuaranteed {
|
||||
// Unable to successfully determine, probably means
|
||||
// insufficient type information, but could mean
|
||||
// ambiguous impls. The latter *ought* to be a
|
||||
@ -2361,8 +2361,8 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
|
||||
let trait_ref = bound_predicate.rebind(data.trait_ref);
|
||||
debug!(?trait_ref);
|
||||
|
||||
if predicate.references_error() {
|
||||
return;
|
||||
if let Err(e) = predicate.error_reported() {
|
||||
return e;
|
||||
}
|
||||
|
||||
// This is kind of a hack: it frequently happens that some earlier
|
||||
@ -2381,17 +2381,20 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
|
||||
// check upstream for type errors and don't add the obligations to
|
||||
// begin with in those cases.
|
||||
if self.tcx.lang_items().sized_trait() == Some(trait_ref.def_id()) {
|
||||
if let None = self.tainted_by_errors() {
|
||||
let err = self.emit_inference_failure_err(
|
||||
obligation.cause.body_id,
|
||||
span,
|
||||
trait_ref.self_ty().skip_binder().into(),
|
||||
ErrorCode::E0282,
|
||||
false,
|
||||
);
|
||||
err.stash(span, StashKey::MaybeForgetReturn);
|
||||
match self.tainted_by_errors() {
|
||||
None => {
|
||||
let err = self.emit_inference_failure_err(
|
||||
obligation.cause.body_id,
|
||||
span,
|
||||
trait_ref.self_ty().skip_binder().into(),
|
||||
ErrorCode::E0282,
|
||||
false,
|
||||
);
|
||||
err.stash(span, StashKey::MaybeForgetReturn);
|
||||
return self.dcx().delayed_bug("stashed error never reported");
|
||||
}
|
||||
Some(e) => return e,
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// Typically, this ambiguity should only happen if
|
||||
@ -2450,19 +2453,21 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
|
||||
}
|
||||
}
|
||||
if ambiguities.len() > 1 && ambiguities.len() < 10 && has_non_region_infer {
|
||||
if self.tainted_by_errors().is_some() && subst.is_none() {
|
||||
if let Some(e) = self.tainted_by_errors()
|
||||
&& subst.is_none()
|
||||
{
|
||||
// If `subst.is_none()`, then this is probably two param-env
|
||||
// candidates or impl candidates that are equal modulo lifetimes.
|
||||
// Therefore, if we've already emitted an error, just skip this
|
||||
// one, since it's not particularly actionable.
|
||||
err.cancel();
|
||||
return;
|
||||
return e;
|
||||
}
|
||||
self.annotate_source_of_ambiguity(&mut err, &ambiguities, predicate);
|
||||
} else {
|
||||
if self.tainted_by_errors().is_some() {
|
||||
if let Some(e) = self.tainted_by_errors() {
|
||||
err.cancel();
|
||||
return;
|
||||
return e;
|
||||
}
|
||||
err.note(format!("cannot satisfy `{predicate}`"));
|
||||
let impl_candidates = self
|
||||
@ -2493,7 +2498,15 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
|
||||
expr_finder.visit_expr(self.tcx.hir().body(body_id).value);
|
||||
|
||||
if let Some(hir::Expr {
|
||||
kind: hir::ExprKind::Path(hir::QPath::Resolved(None, path)),
|
||||
kind:
|
||||
hir::ExprKind::Call(
|
||||
hir::Expr {
|
||||
kind: hir::ExprKind::Path(hir::QPath::Resolved(None, path)),
|
||||
..
|
||||
},
|
||||
_,
|
||||
)
|
||||
| hir::ExprKind::Path(hir::QPath::Resolved(None, path)),
|
||||
..
|
||||
}) = expr_finder.result
|
||||
&& let [
|
||||
@ -2605,11 +2618,15 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
|
||||
ty::PredicateKind::Clause(ty::ClauseKind::WellFormed(arg)) => {
|
||||
// Same hacky approach as above to avoid deluging user
|
||||
// with error messages.
|
||||
if arg.references_error()
|
||||
|| self.dcx().has_errors().is_some()
|
||||
|| self.tainted_by_errors().is_some()
|
||||
{
|
||||
return;
|
||||
|
||||
if let Err(e) = arg.error_reported() {
|
||||
return e;
|
||||
}
|
||||
if let Some(e) = self.tainted_by_errors() {
|
||||
return e;
|
||||
}
|
||||
if let Some(e) = self.dcx().has_errors() {
|
||||
return e;
|
||||
}
|
||||
|
||||
self.emit_inference_failure_err(
|
||||
@ -2622,12 +2639,15 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
|
||||
}
|
||||
|
||||
ty::PredicateKind::Subtype(data) => {
|
||||
if data.references_error()
|
||||
|| self.dcx().has_errors().is_some()
|
||||
|| self.tainted_by_errors().is_some()
|
||||
{
|
||||
if let Err(e) = data.error_reported() {
|
||||
return e;
|
||||
}
|
||||
if let Some(e) = self.tainted_by_errors() {
|
||||
return e;
|
||||
}
|
||||
if let Some(e) = self.dcx().has_errors() {
|
||||
// no need to overload user in such cases
|
||||
return;
|
||||
return e;
|
||||
}
|
||||
let SubtypePredicate { a_is_expected: _, a, b } = data;
|
||||
// both must be type variables, or the other would've been instantiated
|
||||
@ -2641,8 +2661,11 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
|
||||
)
|
||||
}
|
||||
ty::PredicateKind::Clause(ty::ClauseKind::Projection(data)) => {
|
||||
if predicate.references_error() || self.tainted_by_errors().is_some() {
|
||||
return;
|
||||
if let Err(e) = predicate.error_reported() {
|
||||
return e;
|
||||
}
|
||||
if let Some(e) = self.tainted_by_errors() {
|
||||
return e;
|
||||
}
|
||||
let subst = data
|
||||
.projection_ty
|
||||
@ -2673,8 +2696,11 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
|
||||
}
|
||||
|
||||
ty::PredicateKind::Clause(ty::ClauseKind::ConstEvaluatable(data)) => {
|
||||
if predicate.references_error() || self.tainted_by_errors().is_some() {
|
||||
return;
|
||||
if let Err(e) = predicate.error_reported() {
|
||||
return e;
|
||||
}
|
||||
if let Some(e) = self.tainted_by_errors() {
|
||||
return e;
|
||||
}
|
||||
let subst = data.walk().find(|g| g.is_non_region_infer());
|
||||
if let Some(subst) = subst {
|
||||
@ -2699,8 +2725,12 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
|
||||
}
|
||||
}
|
||||
_ => {
|
||||
if self.dcx().has_errors().is_some() || self.tainted_by_errors().is_some() {
|
||||
return;
|
||||
if let Some(e) = self.tainted_by_errors() {
|
||||
return e;
|
||||
}
|
||||
if let Some(e) = self.dcx().has_errors() {
|
||||
// no need to overload user in such cases
|
||||
return e;
|
||||
}
|
||||
struct_span_code_err!(
|
||||
self.dcx(),
|
||||
@ -2713,7 +2743,7 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
|
||||
}
|
||||
};
|
||||
self.note_obligation_cause(&mut err, obligation);
|
||||
err.emit();
|
||||
err.emit()
|
||||
}
|
||||
|
||||
fn annotate_source_of_ambiguity(
|
||||
@ -3433,16 +3463,14 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
|
||||
span: Span,
|
||||
found_trait_ref: ty::Binder<'tcx, ty::TraitRef<'tcx>>,
|
||||
expected_trait_ref: ty::Binder<'tcx, ty::TraitRef<'tcx>>,
|
||||
) -> Option<DiagnosticBuilder<'tcx>> {
|
||||
) -> Result<DiagnosticBuilder<'tcx>, ErrorGuaranteed> {
|
||||
let found_trait_ref = self.resolve_vars_if_possible(found_trait_ref);
|
||||
let expected_trait_ref = self.resolve_vars_if_possible(expected_trait_ref);
|
||||
|
||||
if expected_trait_ref.self_ty().references_error() {
|
||||
return None;
|
||||
}
|
||||
expected_trait_ref.self_ty().error_reported()?;
|
||||
|
||||
let Some(found_trait_ty) = found_trait_ref.self_ty().no_bound_vars() else {
|
||||
return None;
|
||||
return Err(self.dcx().delayed_bug("bound vars outside binder"));
|
||||
};
|
||||
|
||||
let found_did = match *found_trait_ty.kind() {
|
||||
@ -3456,7 +3484,7 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
|
||||
if !self.reported_signature_mismatch.borrow_mut().insert((span, found_span)) {
|
||||
// We check closures twice, with obligations flowing in different directions,
|
||||
// but we want to complain about them only once.
|
||||
return None;
|
||||
return Err(self.dcx().span_delayed_bug(span, "already_reported"));
|
||||
}
|
||||
|
||||
let mut not_tupled = false;
|
||||
@ -3485,7 +3513,7 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
|
||||
// This shouldn't be common unless manually implementing one of the
|
||||
// traits manually, but don't make it more confusing when it does
|
||||
// happen.
|
||||
Some(
|
||||
Ok(
|
||||
if Some(expected_trait_ref.def_id()) != self.tcx.lang_items().coroutine_trait()
|
||||
&& not_tupled
|
||||
{
|
||||
@ -3534,9 +3562,10 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
|
||||
&self,
|
||||
obligation: &PredicateObligation<'tcx>,
|
||||
span: Span,
|
||||
) -> Option<DiagnosticBuilder<'tcx>> {
|
||||
) -> Result<DiagnosticBuilder<'tcx>, ErrorGuaranteed> {
|
||||
if !self.tcx.features().generic_const_exprs {
|
||||
self.dcx()
|
||||
let guar = self
|
||||
.dcx()
|
||||
.struct_span_err(span, "constant expression depends on a generic parameter")
|
||||
// FIXME(const_generics): we should suggest to the user how they can resolve this
|
||||
// issue. However, this is currently not actually possible
|
||||
@ -3546,7 +3575,7 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
|
||||
// be reachable.
|
||||
.with_note("this may fail depending on what value the parameter takes")
|
||||
.emit();
|
||||
return None;
|
||||
return Err(guar);
|
||||
}
|
||||
|
||||
match obligation.predicate.kind().skip_binder() {
|
||||
@ -3561,13 +3590,13 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
|
||||
)),
|
||||
_ => err.help("consider adding a `where` bound using this expression"),
|
||||
};
|
||||
Some(err)
|
||||
Ok(err)
|
||||
}
|
||||
ty::ConstKind::Expr(_) => {
|
||||
let err = self
|
||||
.dcx()
|
||||
.struct_span_err(span, format!("unconstrained generic constant `{ct}`"));
|
||||
Some(err)
|
||||
Ok(err)
|
||||
}
|
||||
_ => {
|
||||
bug!("const evaluatable failed for non-unevaluated const `{ct:?}`");
|
||||
|
@ -279,6 +279,12 @@ impl<T: ?Sized> Arc<T> {
|
||||
}
|
||||
|
||||
impl<T: ?Sized, A: Allocator> Arc<T, A> {
|
||||
#[inline]
|
||||
fn internal_into_inner_with_allocator(self) -> (NonNull<ArcInner<T>>, A) {
|
||||
let this = mem::ManuallyDrop::new(self);
|
||||
(this.ptr, unsafe { ptr::read(&this.alloc) })
|
||||
}
|
||||
|
||||
#[inline]
|
||||
unsafe fn from_inner_in(ptr: NonNull<ArcInner<T>>, alloc: A) -> Self {
|
||||
Self { ptr, phantom: PhantomData, alloc }
|
||||
@ -1275,12 +1281,9 @@ impl<T, A: Allocator> Arc<mem::MaybeUninit<T>, A> {
|
||||
#[unstable(feature = "new_uninit", issue = "63291")]
|
||||
#[must_use = "`self` will be dropped if the result is not used"]
|
||||
#[inline]
|
||||
pub unsafe fn assume_init(self) -> Arc<T, A>
|
||||
where
|
||||
A: Clone,
|
||||
{
|
||||
let md_self = mem::ManuallyDrop::new(self);
|
||||
unsafe { Arc::from_inner_in(md_self.ptr.cast(), md_self.alloc.clone()) }
|
||||
pub unsafe fn assume_init(self) -> Arc<T, A> {
|
||||
let (ptr, alloc) = self.internal_into_inner_with_allocator();
|
||||
unsafe { Arc::from_inner_in(ptr.cast(), alloc) }
|
||||
}
|
||||
}
|
||||
|
||||
@ -1320,12 +1323,9 @@ impl<T, A: Allocator> Arc<[mem::MaybeUninit<T>], A> {
|
||||
#[unstable(feature = "new_uninit", issue = "63291")]
|
||||
#[must_use = "`self` will be dropped if the result is not used"]
|
||||
#[inline]
|
||||
pub unsafe fn assume_init(self) -> Arc<[T], A>
|
||||
where
|
||||
A: Clone,
|
||||
{
|
||||
let md_self = mem::ManuallyDrop::new(self);
|
||||
unsafe { Arc::from_ptr_in(md_self.ptr.as_ptr() as _, md_self.alloc.clone()) }
|
||||
pub unsafe fn assume_init(self) -> Arc<[T], A> {
|
||||
let (ptr, alloc) = self.internal_into_inner_with_allocator();
|
||||
unsafe { Arc::from_ptr_in(ptr.as_ptr() as _, alloc) }
|
||||
}
|
||||
}
|
||||
|
||||
@ -2413,7 +2413,7 @@ unsafe impl<#[may_dangle] T: ?Sized, A: Allocator> Drop for Arc<T, A> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<A: Allocator + Clone> Arc<dyn Any + Send + Sync, A> {
|
||||
impl<A: Allocator> Arc<dyn Any + Send + Sync, A> {
|
||||
/// Attempt to downcast the `Arc<dyn Any + Send + Sync>` to a concrete type.
|
||||
///
|
||||
/// # Examples
|
||||
@ -2440,10 +2440,8 @@ impl<A: Allocator + Clone> Arc<dyn Any + Send + Sync, A> {
|
||||
{
|
||||
if (*self).is::<T>() {
|
||||
unsafe {
|
||||
let ptr = self.ptr.cast::<ArcInner<T>>();
|
||||
let alloc = self.alloc.clone();
|
||||
mem::forget(self);
|
||||
Ok(Arc::from_inner_in(ptr, alloc))
|
||||
let (ptr, alloc) = self.internal_into_inner_with_allocator();
|
||||
Ok(Arc::from_inner_in(ptr.cast(), alloc))
|
||||
}
|
||||
} else {
|
||||
Err(self)
|
||||
@ -2483,10 +2481,8 @@ impl<A: Allocator + Clone> Arc<dyn Any + Send + Sync, A> {
|
||||
T: Any + Send + Sync,
|
||||
{
|
||||
unsafe {
|
||||
let ptr = self.ptr.cast::<ArcInner<T>>();
|
||||
let alloc = self.alloc.clone();
|
||||
mem::forget(self);
|
||||
Arc::from_inner_in(ptr, alloc)
|
||||
let (ptr, alloc) = self.internal_into_inner_with_allocator();
|
||||
Arc::from_inner_in(ptr.cast(), alloc)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -3442,13 +3438,13 @@ impl From<Arc<str>> for Arc<[u8]> {
|
||||
}
|
||||
|
||||
#[stable(feature = "boxed_slice_try_from", since = "1.43.0")]
|
||||
impl<T, A: Allocator + Clone, const N: usize> TryFrom<Arc<[T], A>> for Arc<[T; N], A> {
|
||||
impl<T, A: Allocator, const N: usize> TryFrom<Arc<[T], A>> for Arc<[T; N], A> {
|
||||
type Error = Arc<[T], A>;
|
||||
|
||||
fn try_from(boxed_slice: Arc<[T], A>) -> Result<Self, Self::Error> {
|
||||
if boxed_slice.len() == N {
|
||||
let alloc = boxed_slice.alloc.clone();
|
||||
Ok(unsafe { Arc::from_raw_in(Arc::into_raw(boxed_slice) as *mut [T; N], alloc) })
|
||||
let (ptr, alloc) = boxed_slice.internal_into_inner_with_allocator();
|
||||
Ok(unsafe { Arc::from_inner_in(ptr.cast(), alloc) })
|
||||
} else {
|
||||
Err(boxed_slice)
|
||||
}
|
||||
|
@ -1,13 +1,15 @@
|
||||
use super::*;
|
||||
|
||||
use std::clone::Clone;
|
||||
use std::mem::MaybeUninit;
|
||||
use std::option::Option::None;
|
||||
use std::sync::atomic::AtomicUsize;
|
||||
use std::sync::atomic::Ordering::SeqCst;
|
||||
use std::sync::mpsc::channel;
|
||||
use std::sync::Mutex;
|
||||
use std::thread;
|
||||
|
||||
struct Canary(*mut atomic::AtomicUsize);
|
||||
struct Canary(*mut AtomicUsize);
|
||||
|
||||
impl Drop for Canary {
|
||||
fn drop(&mut self) {
|
||||
@ -21,6 +23,37 @@ impl Drop for Canary {
|
||||
}
|
||||
}
|
||||
|
||||
struct AllocCanary<'a>(&'a AtomicUsize);
|
||||
|
||||
impl<'a> AllocCanary<'a> {
|
||||
fn new(counter: &'a AtomicUsize) -> Self {
|
||||
counter.fetch_add(1, SeqCst);
|
||||
Self(counter)
|
||||
}
|
||||
}
|
||||
|
||||
unsafe impl Allocator for AllocCanary<'_> {
|
||||
fn allocate(&self, layout: Layout) -> Result<NonNull<[u8]>, AllocError> {
|
||||
std::alloc::Global.allocate(layout)
|
||||
}
|
||||
|
||||
unsafe fn deallocate(&self, ptr: NonNull<u8>, layout: Layout) {
|
||||
unsafe { std::alloc::Global.deallocate(ptr, layout) }
|
||||
}
|
||||
}
|
||||
|
||||
impl Clone for AllocCanary<'_> {
|
||||
fn clone(&self) -> Self {
|
||||
Self::new(self.0)
|
||||
}
|
||||
}
|
||||
|
||||
impl Drop for AllocCanary<'_> {
|
||||
fn drop(&mut self) {
|
||||
self.0.fetch_sub(1, SeqCst);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg_attr(target_os = "emscripten", ignore)]
|
||||
fn manually_share_arc() {
|
||||
@ -295,16 +328,16 @@ fn weak_self_cyclic() {
|
||||
|
||||
#[test]
|
||||
fn drop_arc() {
|
||||
let mut canary = atomic::AtomicUsize::new(0);
|
||||
let x = Arc::new(Canary(&mut canary as *mut atomic::AtomicUsize));
|
||||
let mut canary = AtomicUsize::new(0);
|
||||
let x = Arc::new(Canary(&mut canary as *mut AtomicUsize));
|
||||
drop(x);
|
||||
assert!(canary.load(Acquire) == 1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn drop_arc_weak() {
|
||||
let mut canary = atomic::AtomicUsize::new(0);
|
||||
let arc = Arc::new(Canary(&mut canary as *mut atomic::AtomicUsize));
|
||||
let mut canary = AtomicUsize::new(0);
|
||||
let arc = Arc::new(Canary(&mut canary as *mut AtomicUsize));
|
||||
let arc_weak = Arc::downgrade(&arc);
|
||||
assert!(canary.load(Acquire) == 0);
|
||||
drop(arc);
|
||||
@ -660,3 +693,25 @@ fn arc_drop_dereferenceable_race() {
|
||||
thread.join().unwrap();
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn arc_doesnt_leak_allocator() {
|
||||
let counter = AtomicUsize::new(0);
|
||||
|
||||
{
|
||||
let arc: Arc<dyn Any + Send + Sync, _> = Arc::new_in(5usize, AllocCanary::new(&counter));
|
||||
drop(arc.downcast::<usize>().unwrap());
|
||||
|
||||
let arc: Arc<dyn Any + Send + Sync, _> = Arc::new_in(5usize, AllocCanary::new(&counter));
|
||||
drop(unsafe { arc.downcast_unchecked::<usize>() });
|
||||
|
||||
let arc = Arc::new_in(MaybeUninit::<usize>::new(5usize), AllocCanary::new(&counter));
|
||||
drop(unsafe { arc.assume_init() });
|
||||
|
||||
let arc: Arc<[MaybeUninit<usize>], _> =
|
||||
Arc::new_zeroed_slice_in(5, AllocCanary::new(&counter));
|
||||
drop(unsafe { arc.assume_init() });
|
||||
}
|
||||
|
||||
assert_eq!(counter.load(SeqCst), 0);
|
||||
}
|
||||
|
@ -11,7 +11,6 @@
|
||||
|
||||
use crate::fmt;
|
||||
use crate::marker::PhantomData;
|
||||
use crate::num::*;
|
||||
use crate::ops::{Deref, DerefMut};
|
||||
|
||||
#[stable(feature = "core_c_str", since = "1.64.0")]
|
||||
@ -19,7 +18,7 @@ pub use self::c_str::{CStr, FromBytesUntilNulError, FromBytesWithNulError};
|
||||
|
||||
mod c_str;
|
||||
|
||||
macro_rules! type_alias_no_nz {
|
||||
macro_rules! type_alias {
|
||||
{
|
||||
$Docfile:tt, $Alias:ident = $Real:ty;
|
||||
$( $Cfg:tt )*
|
||||
@ -31,49 +30,24 @@ macro_rules! type_alias_no_nz {
|
||||
}
|
||||
}
|
||||
|
||||
// To verify that the NonZero types in this file's macro invocations correspond
|
||||
//
|
||||
// perl -n < library/std/src/os/raw/mod.rs -e 'next unless m/type_alias\!/; die "$_ ?" unless m/, (c_\w+) = (\w+), NonZero_(\w+) = NonZero(\w+)/; die "$_ ?" unless $3 eq $1 and $4 eq ucfirst $2'
|
||||
//
|
||||
// NB this does not check that the main c_* types are right.
|
||||
type_alias! { "c_char.md", c_char = c_char_definition::c_char; #[doc(cfg(all()))] }
|
||||
|
||||
macro_rules! type_alias {
|
||||
{
|
||||
$Docfile:tt, $Alias:ident = $Real:ty, $NZAlias:ident = $NZReal:ty;
|
||||
$( $Cfg:tt )*
|
||||
} => {
|
||||
type_alias_no_nz! { $Docfile, $Alias = $Real; $( $Cfg )* }
|
||||
type_alias! { "c_schar.md", c_schar = i8; }
|
||||
type_alias! { "c_uchar.md", c_uchar = u8; }
|
||||
type_alias! { "c_short.md", c_short = i16; }
|
||||
type_alias! { "c_ushort.md", c_ushort = u16; }
|
||||
|
||||
#[doc = concat!("Type alias for `NonZero` version of [`", stringify!($Alias), "`]")]
|
||||
#[unstable(feature = "raw_os_nonzero", issue = "82363")]
|
||||
$( $Cfg )*
|
||||
pub type $NZAlias = $NZReal;
|
||||
}
|
||||
}
|
||||
type_alias! { "c_int.md", c_int = c_int_definition::c_int; #[doc(cfg(all()))] }
|
||||
type_alias! { "c_uint.md", c_uint = c_int_definition::c_uint; #[doc(cfg(all()))] }
|
||||
|
||||
type_alias! { "c_char.md", c_char = c_char_definition::c_char, NonZero_c_char = c_char_definition::NonZero_c_char;
|
||||
#[doc(cfg(all()))] }
|
||||
type_alias! { "c_long.md", c_long = c_long_definition::c_long; #[doc(cfg(all()))] }
|
||||
type_alias! { "c_ulong.md", c_ulong = c_long_definition::c_ulong; #[doc(cfg(all()))] }
|
||||
|
||||
type_alias! { "c_schar.md", c_schar = i8, NonZero_c_schar = NonZeroI8; }
|
||||
type_alias! { "c_uchar.md", c_uchar = u8, NonZero_c_uchar = NonZeroU8; }
|
||||
type_alias! { "c_short.md", c_short = i16, NonZero_c_short = NonZeroI16; }
|
||||
type_alias! { "c_ushort.md", c_ushort = u16, NonZero_c_ushort = NonZeroU16; }
|
||||
type_alias! { "c_longlong.md", c_longlong = i64; }
|
||||
type_alias! { "c_ulonglong.md", c_ulonglong = u64; }
|
||||
|
||||
type_alias! { "c_int.md", c_int = c_int_definition::c_int, NonZero_c_int = c_int_definition::NonZero_c_int;
|
||||
#[doc(cfg(all()))] }
|
||||
type_alias! { "c_uint.md", c_uint = c_int_definition::c_uint, NonZero_c_uint = c_int_definition::NonZero_c_uint;
|
||||
#[doc(cfg(all()))] }
|
||||
|
||||
type_alias! { "c_long.md", c_long = c_long_definition::c_long, NonZero_c_long = c_long_definition::NonZero_c_long;
|
||||
#[doc(cfg(all()))] }
|
||||
type_alias! { "c_ulong.md", c_ulong = c_long_definition::c_ulong, NonZero_c_ulong = c_long_definition::NonZero_c_ulong;
|
||||
#[doc(cfg(all()))] }
|
||||
|
||||
type_alias! { "c_longlong.md", c_longlong = i64, NonZero_c_longlong = NonZeroI64; }
|
||||
type_alias! { "c_ulonglong.md", c_ulonglong = u64, NonZero_c_ulonglong = NonZeroU64; }
|
||||
|
||||
type_alias_no_nz! { "c_float.md", c_float = f32; }
|
||||
type_alias_no_nz! { "c_double.md", c_double = f64; }
|
||||
type_alias! { "c_float.md", c_float = f32; }
|
||||
type_alias! { "c_double.md", c_double = f64; }
|
||||
|
||||
/// Equivalent to C's `size_t` type, from `stddef.h` (or `cstddef` for C++).
|
||||
///
|
||||
@ -152,11 +126,9 @@ mod c_char_definition {
|
||||
target_os = "horizon"
|
||||
))] {
|
||||
pub type c_char = u8;
|
||||
pub type NonZero_c_char = crate::num::NonZeroU8;
|
||||
} else {
|
||||
// On every other target, c_char is signed.
|
||||
pub type c_char = i8;
|
||||
pub type NonZero_c_char = crate::num::NonZeroI8;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -165,14 +137,10 @@ mod c_int_definition {
|
||||
cfg_if! {
|
||||
if #[cfg(any(target_arch = "avr", target_arch = "msp430"))] {
|
||||
pub type c_int = i16;
|
||||
pub type NonZero_c_int = crate::num::NonZeroI16;
|
||||
pub type c_uint = u16;
|
||||
pub type NonZero_c_uint = crate::num::NonZeroU16;
|
||||
} else {
|
||||
pub type c_int = i32;
|
||||
pub type NonZero_c_int = crate::num::NonZeroI32;
|
||||
pub type c_uint = u32;
|
||||
pub type NonZero_c_uint = crate::num::NonZeroU32;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -181,15 +149,11 @@ mod c_long_definition {
|
||||
cfg_if! {
|
||||
if #[cfg(all(target_pointer_width = "64", not(windows)))] {
|
||||
pub type c_long = i64;
|
||||
pub type NonZero_c_long = crate::num::NonZeroI64;
|
||||
pub type c_ulong = u64;
|
||||
pub type NonZero_c_ulong = crate::num::NonZeroU64;
|
||||
} else {
|
||||
// The minimal size of `long` in the C standard is 32 bits
|
||||
pub type c_long = i32;
|
||||
pub type NonZero_c_long = crate::num::NonZeroI32;
|
||||
pub type c_ulong = u32;
|
||||
pub type NonZero_c_ulong = crate::num::NonZeroU32;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -356,6 +356,7 @@ impl<K, V, S> HashMap<K, V, S> {
|
||||
///
|
||||
/// In the current implementation, iterating over keys takes O(capacity) time
|
||||
/// instead of O(len) because it internally visits empty buckets too.
|
||||
#[rustc_lint_query_instability]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn keys(&self) -> Keys<'_, K, V> {
|
||||
Keys { inner: self.iter() }
|
||||
@ -417,6 +418,7 @@ impl<K, V, S> HashMap<K, V, S> {
|
||||
///
|
||||
/// In the current implementation, iterating over values takes O(capacity) time
|
||||
/// instead of O(len) because it internally visits empty buckets too.
|
||||
#[rustc_lint_query_instability]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn values(&self) -> Values<'_, K, V> {
|
||||
Values { inner: self.iter() }
|
||||
@ -449,6 +451,7 @@ impl<K, V, S> HashMap<K, V, S> {
|
||||
///
|
||||
/// In the current implementation, iterating over values takes O(capacity) time
|
||||
/// instead of O(len) because it internally visits empty buckets too.
|
||||
#[rustc_lint_query_instability]
|
||||
#[stable(feature = "map_values_mut", since = "1.10.0")]
|
||||
pub fn values_mut(&mut self) -> ValuesMut<'_, K, V> {
|
||||
ValuesMut { inner: self.iter_mut() }
|
||||
|
@ -338,7 +338,6 @@
|
||||
#![feature(portable_simd)]
|
||||
#![feature(prelude_2024)]
|
||||
#![feature(ptr_as_uninit)]
|
||||
#![feature(raw_os_nonzero)]
|
||||
#![feature(slice_internals)]
|
||||
#![feature(slice_ptr_get)]
|
||||
#![feature(slice_range)]
|
||||
|
@ -85,9 +85,6 @@ pub mod linux;
|
||||
#[cfg(any(target_os = "wasi", doc))]
|
||||
pub mod wasi;
|
||||
|
||||
#[cfg(any(all(target_os = "wasi", target_env = "preview2"), doc))]
|
||||
pub mod wasi_preview2;
|
||||
|
||||
// windows
|
||||
#[cfg(not(all(
|
||||
doc,
|
||||
|
@ -28,8 +28,7 @@
|
||||
//! [`OsStr`]: crate::ffi::OsStr
|
||||
//! [`OsString`]: crate::ffi::OsString
|
||||
|
||||
#![cfg_attr(not(target_env = "preview2"), stable(feature = "rust1", since = "1.0.0"))]
|
||||
#![cfg_attr(target_env = "preview2", unstable(feature = "wasm_preview2", issue = "none"))]
|
||||
#![stable(feature = "rust1", since = "1.0.0")]
|
||||
#![deny(unsafe_op_in_unsafe_fn)]
|
||||
#![doc(cfg(target_os = "wasi"))]
|
||||
|
||||
|
@ -1,5 +0,0 @@
|
||||
//! Platform-specific extensions to `std` for Preview 2 of the WebAssembly System Interface (WASI).
|
||||
//!
|
||||
//! This module is currently empty, but will be filled over time as wasi-libc support for WASI Preview 2 is stabilized.
|
||||
|
||||
#![stable(feature = "raw_ext", since = "1.1.0")]
|
@ -40,9 +40,6 @@ cfg_if::cfg_if! {
|
||||
} else if #[cfg(target_os = "wasi")] {
|
||||
mod wasi;
|
||||
pub use self::wasi::*;
|
||||
} else if #[cfg(all(target_os = "wasi", target_env = "preview2"))] {
|
||||
mod wasi_preview2;
|
||||
pub use self::wasi_preview2::*;
|
||||
} else if #[cfg(target_family = "wasm")] {
|
||||
mod wasm;
|
||||
pub use self::wasm::*;
|
||||
|
@ -1,11 +1,10 @@
|
||||
use crate::fmt;
|
||||
use crate::io::{self, Error, ErrorKind};
|
||||
use crate::mem;
|
||||
use crate::num::NonZeroI32;
|
||||
use crate::num::{NonZero, NonZeroI32};
|
||||
use crate::sys;
|
||||
use crate::sys::cvt;
|
||||
use crate::sys::process::process_common::*;
|
||||
use core::ffi::NonZero_c_int;
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
use crate::os::linux::process::PidFd;
|
||||
@ -935,7 +934,7 @@ impl ExitStatus {
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/wait.html. If it is not
|
||||
// true for a platform pretending to be Unix, the tests (our doctests, and also
|
||||
// process_unix/tests.rs) will spot it. `ExitStatusError::code` assumes this too.
|
||||
match NonZero_c_int::try_from(self.0) {
|
||||
match NonZero::try_from(self.0) {
|
||||
/* was nonzero */ Ok(failure) => Err(ExitStatusError(failure)),
|
||||
/* was zero, couldn't convert */ Err(_) => Ok(()),
|
||||
}
|
||||
@ -1092,7 +1091,7 @@ impl fmt::Display for ExitStatus {
|
||||
}
|
||||
|
||||
#[derive(PartialEq, Eq, Clone, Copy)]
|
||||
pub struct ExitStatusError(NonZero_c_int);
|
||||
pub struct ExitStatusError(NonZero<c_int>);
|
||||
|
||||
impl Into<ExitStatus> for ExitStatusError {
|
||||
fn into(self) -> ExitStatus {
|
||||
|
@ -1,9 +1,8 @@
|
||||
use crate::fmt;
|
||||
use crate::io;
|
||||
use crate::num::NonZeroI32;
|
||||
use crate::num::{NonZero, NonZeroI32};
|
||||
use crate::sys::pal::unix::unsupported::*;
|
||||
use crate::sys::process::process_common::*;
|
||||
use core::ffi::NonZero_c_int;
|
||||
|
||||
use libc::{c_int, pid_t};
|
||||
|
||||
@ -59,7 +58,7 @@ mod wait_status;
|
||||
pub use wait_status::ExitStatus;
|
||||
|
||||
#[derive(PartialEq, Eq, Clone, Copy, Debug)]
|
||||
pub struct ExitStatusError(NonZero_c_int);
|
||||
pub struct ExitStatusError(NonZero<c_int>);
|
||||
|
||||
impl Into<ExitStatus> for ExitStatusError {
|
||||
fn into(self) -> ExitStatus {
|
||||
|
@ -1,10 +1,9 @@
|
||||
//! Emulated wait status for non-Unix #[cfg(unix) platforms
|
||||
//!
|
||||
//! Separate module to facilitate testing against a real Unix implementation.
|
||||
use core::ffi::NonZero_c_int;
|
||||
|
||||
use crate::ffi::c_int;
|
||||
use crate::fmt;
|
||||
use crate::num::NonZero;
|
||||
|
||||
use super::ExitStatusError;
|
||||
|
||||
@ -50,7 +49,7 @@ impl ExitStatus {
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/wait.html. If it is not
|
||||
// true for a platform pretending to be Unix, the tests (our doctests, and also
|
||||
// process_unix/tests.rs) will spot it. `ExitStatusError::code` assumes this too.
|
||||
match NonZero_c_int::try_from(self.wait_status) {
|
||||
match NonZero::try_from(self.wait_status) {
|
||||
/* was nonzero */ Ok(failure) => Err(ExitStatusError(failure)),
|
||||
/* was zero, couldn't convert */ Err(_) => Ok(()),
|
||||
}
|
||||
|
@ -1,11 +1,10 @@
|
||||
use crate::fmt;
|
||||
use crate::io::{self, Error, ErrorKind};
|
||||
use crate::num::NonZeroI32;
|
||||
use crate::num::{NonZero, NonZeroI32};
|
||||
use crate::sys;
|
||||
use crate::sys::cvt;
|
||||
use crate::sys::process::process_common::*;
|
||||
use crate::sys_common::thread;
|
||||
use core::ffi::NonZero_c_int;
|
||||
use libc::RTP_ID;
|
||||
use libc::{self, c_char, c_int};
|
||||
|
||||
@ -197,7 +196,7 @@ impl ExitStatus {
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/wait.html. If it is not
|
||||
// true for a platform pretending to be Unix, the tests (our doctests, and also
|
||||
// process_unix/tests.rs) will spot it. `ExitStatusError::code` assumes this too.
|
||||
match NonZero_c_int::try_from(self.0) {
|
||||
match NonZero::try_from(self.0) {
|
||||
Ok(failure) => Err(ExitStatusError(failure)),
|
||||
Err(_) => Ok(()),
|
||||
}
|
||||
@ -249,7 +248,7 @@ impl fmt::Display for ExitStatus {
|
||||
}
|
||||
|
||||
#[derive(PartialEq, Eq, Clone, Copy, Debug)]
|
||||
pub struct ExitStatusError(NonZero_c_int);
|
||||
pub struct ExitStatusError(NonZero<c_int>);
|
||||
|
||||
impl Into<ExitStatus> for ExitStatusError {
|
||||
fn into(self) -> ExitStatus {
|
||||
|
@ -1,123 +0,0 @@
|
||||
use crate::io as std_io;
|
||||
use crate::mem;
|
||||
|
||||
#[inline]
|
||||
pub fn is_interrupted(errno: i32) -> bool {
|
||||
errno == wasi::ERRNO_INTR.raw().into()
|
||||
}
|
||||
|
||||
pub fn decode_error_kind(errno: i32) -> std_io::ErrorKind {
|
||||
use std_io::ErrorKind;
|
||||
|
||||
let Ok(errno) = u16::try_from(errno) else {
|
||||
return ErrorKind::Uncategorized;
|
||||
};
|
||||
|
||||
macro_rules! match_errno {
|
||||
($($($errno:ident)|+ => $errkind:ident),*, _ => $wildcard:ident $(,)?) => {
|
||||
match errno {
|
||||
$(e if $(e == ::wasi::$errno.raw())||+ => ErrorKind::$errkind),*,
|
||||
_ => ErrorKind::$wildcard,
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
match_errno! {
|
||||
ERRNO_2BIG => ArgumentListTooLong,
|
||||
ERRNO_ACCES => PermissionDenied,
|
||||
ERRNO_ADDRINUSE => AddrInUse,
|
||||
ERRNO_ADDRNOTAVAIL => AddrNotAvailable,
|
||||
ERRNO_AFNOSUPPORT => Unsupported,
|
||||
ERRNO_AGAIN => WouldBlock,
|
||||
// ALREADY => "connection already in progress",
|
||||
// BADF => "bad file descriptor",
|
||||
// BADMSG => "bad message",
|
||||
ERRNO_BUSY => ResourceBusy,
|
||||
// CANCELED => "operation canceled",
|
||||
// CHILD => "no child processes",
|
||||
ERRNO_CONNABORTED => ConnectionAborted,
|
||||
ERRNO_CONNREFUSED => ConnectionRefused,
|
||||
ERRNO_CONNRESET => ConnectionReset,
|
||||
ERRNO_DEADLK => Deadlock,
|
||||
// DESTADDRREQ => "destination address required",
|
||||
ERRNO_DOM => InvalidInput,
|
||||
// DQUOT => /* reserved */,
|
||||
ERRNO_EXIST => AlreadyExists,
|
||||
// FAULT => "bad address",
|
||||
ERRNO_FBIG => FileTooLarge,
|
||||
ERRNO_HOSTUNREACH => HostUnreachable,
|
||||
// IDRM => "identifier removed",
|
||||
// ILSEQ => "illegal byte sequence",
|
||||
// INPROGRESS => "operation in progress",
|
||||
ERRNO_INTR => Interrupted,
|
||||
ERRNO_INVAL => InvalidInput,
|
||||
ERRNO_IO => Uncategorized,
|
||||
// ISCONN => "socket is connected",
|
||||
ERRNO_ISDIR => IsADirectory,
|
||||
ERRNO_LOOP => FilesystemLoop,
|
||||
// MFILE => "file descriptor value too large",
|
||||
ERRNO_MLINK => TooManyLinks,
|
||||
// MSGSIZE => "message too large",
|
||||
// MULTIHOP => /* reserved */,
|
||||
ERRNO_NAMETOOLONG => InvalidFilename,
|
||||
ERRNO_NETDOWN => NetworkDown,
|
||||
// NETRESET => "connection aborted by network",
|
||||
ERRNO_NETUNREACH => NetworkUnreachable,
|
||||
// NFILE => "too many files open in system",
|
||||
// NOBUFS => "no buffer space available",
|
||||
ERRNO_NODEV => NotFound,
|
||||
ERRNO_NOENT => NotFound,
|
||||
// NOEXEC => "executable file format error",
|
||||
// NOLCK => "no locks available",
|
||||
// NOLINK => /* reserved */,
|
||||
ERRNO_NOMEM => OutOfMemory,
|
||||
// NOMSG => "no message of the desired type",
|
||||
// NOPROTOOPT => "protocol not available",
|
||||
ERRNO_NOSPC => StorageFull,
|
||||
ERRNO_NOSYS => Unsupported,
|
||||
ERRNO_NOTCONN => NotConnected,
|
||||
ERRNO_NOTDIR => NotADirectory,
|
||||
ERRNO_NOTEMPTY => DirectoryNotEmpty,
|
||||
// NOTRECOVERABLE => "state not recoverable",
|
||||
// NOTSOCK => "not a socket",
|
||||
ERRNO_NOTSUP => Unsupported,
|
||||
// NOTTY => "inappropriate I/O control operation",
|
||||
ERRNO_NXIO => NotFound,
|
||||
// OVERFLOW => "value too large to be stored in data type",
|
||||
// OWNERDEAD => "previous owner died",
|
||||
ERRNO_PERM => PermissionDenied,
|
||||
ERRNO_PIPE => BrokenPipe,
|
||||
// PROTO => "protocol error",
|
||||
ERRNO_PROTONOSUPPORT => Unsupported,
|
||||
// PROTOTYPE => "protocol wrong type for socket",
|
||||
// RANGE => "result too large",
|
||||
ERRNO_ROFS => ReadOnlyFilesystem,
|
||||
ERRNO_SPIPE => NotSeekable,
|
||||
ERRNO_SRCH => NotFound,
|
||||
// STALE => /* reserved */,
|
||||
ERRNO_TIMEDOUT => TimedOut,
|
||||
ERRNO_TXTBSY => ResourceBusy,
|
||||
ERRNO_XDEV => CrossesDevices,
|
||||
ERRNO_NOTCAPABLE => PermissionDenied,
|
||||
_ => Uncategorized,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn abort_internal() -> ! {
|
||||
unsafe { libc::abort() }
|
||||
}
|
||||
|
||||
pub fn hashmap_random_keys() -> (u64, u64) {
|
||||
let mut ret = (0u64, 0u64);
|
||||
unsafe {
|
||||
let base = &mut ret as *mut (u64, u64) as *mut u8;
|
||||
let len = mem::size_of_val(&ret);
|
||||
wasi::random_get(base, len).expect("random_get failure");
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub(crate) fn err2io(err: wasi::Errno) -> std_io::Error {
|
||||
std_io::Error::from_raw_os_error(err.raw().into())
|
||||
}
|
@ -14,6 +14,9 @@
|
||||
//! compiling for wasm. That way it's a compile time error for something that's
|
||||
//! guaranteed to be a runtime error!
|
||||
|
||||
use crate::io as std_io;
|
||||
use crate::mem;
|
||||
|
||||
#[path = "../unix/alloc.rs"]
|
||||
pub mod alloc;
|
||||
pub mod args;
|
||||
@ -69,12 +72,123 @@ cfg_if::cfg_if! {
|
||||
mod common;
|
||||
pub use common::*;
|
||||
|
||||
mod helpers;
|
||||
// These exports are listed individually to work around Rust's glob import
|
||||
// conflict rules. If we glob export `helpers` and `common` together, then
|
||||
// the compiler complains about conflicts.
|
||||
pub use helpers::abort_internal;
|
||||
pub use helpers::decode_error_kind;
|
||||
use helpers::err2io;
|
||||
pub use helpers::hashmap_random_keys;
|
||||
pub use helpers::is_interrupted;
|
||||
#[inline]
|
||||
pub fn is_interrupted(errno: i32) -> bool {
|
||||
errno == wasi::ERRNO_INTR.raw().into()
|
||||
}
|
||||
|
||||
pub fn decode_error_kind(errno: i32) -> std_io::ErrorKind {
|
||||
use std_io::ErrorKind;
|
||||
|
||||
let Ok(errno) = u16::try_from(errno) else {
|
||||
return ErrorKind::Uncategorized;
|
||||
};
|
||||
|
||||
macro_rules! match_errno {
|
||||
($($($errno:ident)|+ => $errkind:ident),*, _ => $wildcard:ident $(,)?) => {
|
||||
match errno {
|
||||
$(e if $(e == ::wasi::$errno.raw())||+ => ErrorKind::$errkind),*,
|
||||
_ => ErrorKind::$wildcard,
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
match_errno! {
|
||||
ERRNO_2BIG => ArgumentListTooLong,
|
||||
ERRNO_ACCES => PermissionDenied,
|
||||
ERRNO_ADDRINUSE => AddrInUse,
|
||||
ERRNO_ADDRNOTAVAIL => AddrNotAvailable,
|
||||
ERRNO_AFNOSUPPORT => Unsupported,
|
||||
ERRNO_AGAIN => WouldBlock,
|
||||
// ALREADY => "connection already in progress",
|
||||
// BADF => "bad file descriptor",
|
||||
// BADMSG => "bad message",
|
||||
ERRNO_BUSY => ResourceBusy,
|
||||
// CANCELED => "operation canceled",
|
||||
// CHILD => "no child processes",
|
||||
ERRNO_CONNABORTED => ConnectionAborted,
|
||||
ERRNO_CONNREFUSED => ConnectionRefused,
|
||||
ERRNO_CONNRESET => ConnectionReset,
|
||||
ERRNO_DEADLK => Deadlock,
|
||||
// DESTADDRREQ => "destination address required",
|
||||
ERRNO_DOM => InvalidInput,
|
||||
// DQUOT => /* reserved */,
|
||||
ERRNO_EXIST => AlreadyExists,
|
||||
// FAULT => "bad address",
|
||||
ERRNO_FBIG => FileTooLarge,
|
||||
ERRNO_HOSTUNREACH => HostUnreachable,
|
||||
// IDRM => "identifier removed",
|
||||
// ILSEQ => "illegal byte sequence",
|
||||
// INPROGRESS => "operation in progress",
|
||||
ERRNO_INTR => Interrupted,
|
||||
ERRNO_INVAL => InvalidInput,
|
||||
ERRNO_IO => Uncategorized,
|
||||
// ISCONN => "socket is connected",
|
||||
ERRNO_ISDIR => IsADirectory,
|
||||
ERRNO_LOOP => FilesystemLoop,
|
||||
// MFILE => "file descriptor value too large",
|
||||
ERRNO_MLINK => TooManyLinks,
|
||||
// MSGSIZE => "message too large",
|
||||
// MULTIHOP => /* reserved */,
|
||||
ERRNO_NAMETOOLONG => InvalidFilename,
|
||||
ERRNO_NETDOWN => NetworkDown,
|
||||
// NETRESET => "connection aborted by network",
|
||||
ERRNO_NETUNREACH => NetworkUnreachable,
|
||||
// NFILE => "too many files open in system",
|
||||
// NOBUFS => "no buffer space available",
|
||||
ERRNO_NODEV => NotFound,
|
||||
ERRNO_NOENT => NotFound,
|
||||
// NOEXEC => "executable file format error",
|
||||
// NOLCK => "no locks available",
|
||||
// NOLINK => /* reserved */,
|
||||
ERRNO_NOMEM => OutOfMemory,
|
||||
// NOMSG => "no message of the desired type",
|
||||
// NOPROTOOPT => "protocol not available",
|
||||
ERRNO_NOSPC => StorageFull,
|
||||
ERRNO_NOSYS => Unsupported,
|
||||
ERRNO_NOTCONN => NotConnected,
|
||||
ERRNO_NOTDIR => NotADirectory,
|
||||
ERRNO_NOTEMPTY => DirectoryNotEmpty,
|
||||
// NOTRECOVERABLE => "state not recoverable",
|
||||
// NOTSOCK => "not a socket",
|
||||
ERRNO_NOTSUP => Unsupported,
|
||||
// NOTTY => "inappropriate I/O control operation",
|
||||
ERRNO_NXIO => NotFound,
|
||||
// OVERFLOW => "value too large to be stored in data type",
|
||||
// OWNERDEAD => "previous owner died",
|
||||
ERRNO_PERM => PermissionDenied,
|
||||
ERRNO_PIPE => BrokenPipe,
|
||||
// PROTO => "protocol error",
|
||||
ERRNO_PROTONOSUPPORT => Unsupported,
|
||||
// PROTOTYPE => "protocol wrong type for socket",
|
||||
// RANGE => "result too large",
|
||||
ERRNO_ROFS => ReadOnlyFilesystem,
|
||||
ERRNO_SPIPE => NotSeekable,
|
||||
ERRNO_SRCH => NotFound,
|
||||
// STALE => /* reserved */,
|
||||
ERRNO_TIMEDOUT => TimedOut,
|
||||
ERRNO_TXTBSY => ResourceBusy,
|
||||
ERRNO_XDEV => CrossesDevices,
|
||||
ERRNO_NOTCAPABLE => PermissionDenied,
|
||||
_ => Uncategorized,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn abort_internal() -> ! {
|
||||
unsafe { libc::abort() }
|
||||
}
|
||||
|
||||
pub fn hashmap_random_keys() -> (u64, u64) {
|
||||
let mut ret = (0u64, 0u64);
|
||||
unsafe {
|
||||
let base = &mut ret as *mut (u64, u64) as *mut u8;
|
||||
let len = mem::size_of_val(&ret);
|
||||
wasi::random_get(base, len).expect("random_get failure");
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn err2io(err: wasi::Errno) -> std_io::Error {
|
||||
std_io::Error::from_raw_os_error(err.raw().into())
|
||||
}
|
||||
|
@ -1,78 +0,0 @@
|
||||
//! System bindings for the wasi preview 2 target.
|
||||
//!
|
||||
//! This is the next evolution of the original wasi target, and is intended to
|
||||
//! replace that target over time.
|
||||
//!
|
||||
//! To begin with, this target mirrors the wasi target 1 to 1, but over
|
||||
//! time this will change significantly.
|
||||
|
||||
#[path = "../unix/alloc.rs"]
|
||||
pub mod alloc;
|
||||
#[path = "../wasi/args.rs"]
|
||||
pub mod args;
|
||||
#[path = "../unix/cmath.rs"]
|
||||
pub mod cmath;
|
||||
#[path = "../wasi/env.rs"]
|
||||
pub mod env;
|
||||
#[path = "../wasi/fd.rs"]
|
||||
pub mod fd;
|
||||
#[path = "../wasi/fs.rs"]
|
||||
pub mod fs;
|
||||
#[allow(unused)]
|
||||
#[path = "../wasm/atomics/futex.rs"]
|
||||
pub mod futex;
|
||||
#[path = "../wasi/io.rs"]
|
||||
pub mod io;
|
||||
|
||||
#[path = "../wasi/net.rs"]
|
||||
pub mod net;
|
||||
#[path = "../wasi/os.rs"]
|
||||
pub mod os;
|
||||
#[path = "../unix/os_str.rs"]
|
||||
pub mod os_str;
|
||||
#[path = "../unix/path.rs"]
|
||||
pub mod path;
|
||||
#[path = "../unsupported/pipe.rs"]
|
||||
pub mod pipe;
|
||||
#[path = "../unsupported/process.rs"]
|
||||
pub mod process;
|
||||
#[path = "../wasi/stdio.rs"]
|
||||
pub mod stdio;
|
||||
#[path = "../wasi/thread.rs"]
|
||||
pub mod thread;
|
||||
#[path = "../unsupported/thread_local_dtor.rs"]
|
||||
pub mod thread_local_dtor;
|
||||
#[path = "../unsupported/thread_local_key.rs"]
|
||||
pub mod thread_local_key;
|
||||
#[path = "../wasi/time.rs"]
|
||||
pub mod time;
|
||||
|
||||
cfg_if::cfg_if! {
|
||||
if #[cfg(target_feature = "atomics")] {
|
||||
compile_error!("The wasm32-wasi-preview2 target does not support atomics");
|
||||
} else {
|
||||
#[path = "../unsupported/locks/mod.rs"]
|
||||
pub mod locks;
|
||||
#[path = "../unsupported/once.rs"]
|
||||
pub mod once;
|
||||
#[path = "../unsupported/thread_parking.rs"]
|
||||
pub mod thread_parking;
|
||||
}
|
||||
}
|
||||
|
||||
#[path = "../unsupported/common.rs"]
|
||||
#[deny(unsafe_op_in_unsafe_fn)]
|
||||
#[allow(unused)]
|
||||
mod common;
|
||||
pub use common::*;
|
||||
|
||||
#[path = "../wasi/helpers.rs"]
|
||||
mod helpers;
|
||||
// These exports are listed individually to work around Rust's glob import
|
||||
// conflict rules. If we glob export `helpers` and `common` together, then
|
||||
// the compiler complains about conflicts.
|
||||
pub use helpers::abort_internal;
|
||||
pub use helpers::decode_error_kind;
|
||||
use helpers::err2io;
|
||||
pub use helpers::hashmap_random_keys;
|
||||
pub use helpers::is_interrupted;
|
@ -7,17 +7,17 @@
|
||||
|
||||
use crate::ffi::CStr;
|
||||
use crate::mem;
|
||||
use crate::num::NonZero;
|
||||
pub use crate::os::raw::c_int;
|
||||
use crate::os::raw::{c_char, c_long, c_longlong, c_uint, c_ulong, c_ushort, c_void};
|
||||
use crate::os::windows::io::{AsRawHandle, BorrowedHandle};
|
||||
use crate::ptr;
|
||||
use core::ffi::NonZero_c_ulong;
|
||||
|
||||
mod windows_sys;
|
||||
pub use windows_sys::*;
|
||||
|
||||
pub type DWORD = c_ulong;
|
||||
pub type NonZeroDWORD = NonZero_c_ulong;
|
||||
pub type NonZeroDWORD = NonZero<c_ulong>;
|
||||
pub type LARGE_INTEGER = c_longlong;
|
||||
#[cfg_attr(target_vendor = "uwp", allow(unused))]
|
||||
pub type LONG = c_long;
|
||||
|
@ -367,13 +367,10 @@ fn copy_self_contained_objects(
|
||||
let srcdir = builder
|
||||
.wasi_root(target)
|
||||
.unwrap_or_else(|| {
|
||||
panic!(
|
||||
"Target {:?} does not have a \"wasi-root\" key in Config.toml",
|
||||
target.triple
|
||||
)
|
||||
panic!("Target {:?} does not have a \"wasi-root\" key", target.triple)
|
||||
})
|
||||
.join("lib")
|
||||
.join(target.to_string().replace("-preview1", "").replace("-preview2", ""));
|
||||
.join(target.to_string().replace("-preview1", ""));
|
||||
for &obj in &["libc.a", "crt1-command.o", "crt1-reactor.o"] {
|
||||
copy_and_stamp(
|
||||
builder,
|
||||
|
@ -88,7 +88,7 @@ const EXTRA_CHECK_CFGS: &[(Option<Mode>, &str, Option<&[&'static str]>)] = &[
|
||||
(Some(Mode::Std), "no_sync", None),
|
||||
(Some(Mode::Std), "backtrace_in_libstd", None),
|
||||
/* Extra values not defined in the built-in targets yet, but used in std */
|
||||
(Some(Mode::Std), "target_env", Some(&["libnx", "preview2"])),
|
||||
(Some(Mode::Std), "target_env", Some(&["libnx"])),
|
||||
// (Some(Mode::Std), "target_os", Some(&[])),
|
||||
// #[cfg(bootstrap)] zkvm
|
||||
(Some(Mode::Std), "target_os", Some(&["zkvm"])),
|
||||
|
@ -59,7 +59,6 @@
|
||||
- [*-unknown-openbsd](platform-support/openbsd.md)
|
||||
- [\*-unknown-uefi](platform-support/unknown-uefi.md)
|
||||
- [wasm32-wasi-preview1-threads](platform-support/wasm32-wasi-preview1-threads.md)
|
||||
- [wasm32-wasi-preview2](platform-support/wasm32-wasi-preview2.md)
|
||||
- [wasm64-unknown-unknown](platform-support/wasm64-unknown-unknown.md)
|
||||
- [\*-win7-windows-msvc](platform-support/win7-windows-msvc.md)
|
||||
- [x86_64-fortanix-unknown-sgx](platform-support/x86_64-fortanix-unknown-sgx.md)
|
||||
|
@ -360,7 +360,6 @@ target | std | host | notes
|
||||
`thumbv7a-pc-windows-msvc` | ? | |
|
||||
`thumbv7a-uwp-windows-msvc` | ✓ | |
|
||||
`thumbv7neon-unknown-linux-musleabihf` | ? | | Thumb2-mode ARMv7-A Linux with NEON, MUSL
|
||||
[`wasm32-wasi-preview2`](platform-support/wasm32-wasi-preview2.md) | ✓ | | WebAssembly
|
||||
[`wasm64-unknown-unknown`](platform-support/wasm64-unknown-unknown.md) | ? | | WebAssembly
|
||||
`x86_64-apple-ios-macabi` | ✓ | | Apple Catalyst on x86_64
|
||||
[`x86_64-apple-tvos`](platform-support/apple-tvos.md) | ? | | x86 64-bit tvOS
|
||||
|
@ -1,30 +0,0 @@
|
||||
# `wasm32-wasi-preview2`
|
||||
|
||||
**Tier: 3**
|
||||
|
||||
The `wasm32-wasi-preview2` target is a new and still (as of January 2024) an
|
||||
experimental target. This target is an extension to `wasm32-wasi-preview1` target,
|
||||
originally known as `wasm32-wasi`. It is the next evolution in the development of
|
||||
wasi (the [WebAssembly System Interface](https://wasi.dev)) that uses the WebAssembly
|
||||
[component model] to allow for a standardized set of syscalls that are intended to empower
|
||||
WebAssembly binaries with native host capabilities.
|
||||
|
||||
[component model]: https://github.com/WebAssembly/component-model
|
||||
|
||||
## Target maintainers
|
||||
|
||||
- Alex Crichton, https://github.com/alexcrichton
|
||||
- Ryan Levick, https://github.com/rylev
|
||||
|
||||
## Requirements
|
||||
|
||||
This target is cross-compiled. The target supports `std` fully.
|
||||
|
||||
## Platform requirements
|
||||
|
||||
The WebAssembly runtime should support the wasi preview 2 API set.
|
||||
|
||||
This target is not a stable target. This means that there are only a few engines
|
||||
which implement wasi preview 2, for example:
|
||||
|
||||
* Wasmtime - `-W component-model`
|
@ -638,7 +638,7 @@ ul.block, .block li {
|
||||
|
||||
.sidebar-crate h2 a {
|
||||
display: block;
|
||||
margin: 0 calc(-24px + 0.25rem) 0 -0.5rem;
|
||||
margin: 0 calc(-24px + 0.25rem) 0 -0.2rem;
|
||||
/* Align the sidebar crate link with the search bar, which have different
|
||||
font sizes.
|
||||
|
||||
@ -653,7 +653,7 @@ ul.block, .block li {
|
||||
x = ( 16px - 0.57rem ) / 2
|
||||
*/
|
||||
padding: calc( ( 16px - 0.57rem ) / 2 ) 0.25rem;
|
||||
padding-left: 0.5rem;
|
||||
padding-left: 0.2rem;
|
||||
}
|
||||
|
||||
.sidebar-crate h2 .version {
|
||||
@ -661,8 +661,6 @@ ul.block, .block li {
|
||||
font-weight: normal;
|
||||
font-size: 1rem;
|
||||
overflow-wrap: break-word;
|
||||
/* opposite of the link padding, cut in half again */
|
||||
margin-top: calc( ( -16px + 0.57rem ) / 2 );
|
||||
}
|
||||
|
||||
.sidebar-crate + .version {
|
||||
|
@ -37,12 +37,6 @@ pub(super) fn check_cast<'tcx>(
|
||||
let inherited = Inherited::new(cx.tcx, local_def_id);
|
||||
let fn_ctxt = FnCtxt::new(&inherited, cx.param_env, local_def_id);
|
||||
|
||||
// If we already have errors, we can't be sure we can pointer cast.
|
||||
assert!(
|
||||
!fn_ctxt.errors_reported_since_creation(),
|
||||
"Newly created FnCtxt contained errors"
|
||||
);
|
||||
|
||||
if let Ok(check) = cast::CastCheck::new(
|
||||
&fn_ctxt,
|
||||
e,
|
||||
@ -53,17 +47,7 @@ pub(super) fn check_cast<'tcx>(
|
||||
DUMMY_SP,
|
||||
hir::Constness::NotConst,
|
||||
) {
|
||||
let res = check.do_check(&fn_ctxt);
|
||||
|
||||
// do_check's documentation says that it might return Ok and create
|
||||
// errors in the fcx instead of returning Err in some cases. Those cases
|
||||
// should be filtered out before getting here.
|
||||
assert!(
|
||||
!fn_ctxt.errors_reported_since_creation(),
|
||||
"`fn_ctxt` contained errors after cast check!"
|
||||
);
|
||||
|
||||
res.ok()
|
||||
check.do_check(&fn_ctxt).ok()
|
||||
} else {
|
||||
None
|
||||
}
|
||||
|
@ -489,9 +489,6 @@
|
||||
// revisions: wasm64_unknown_unknown
|
||||
// [wasm64_unknown_unknown] compile-flags: --target wasm64-unknown-unknown
|
||||
// [wasm64_unknown_unknown] needs-llvm-components: webassembly
|
||||
// revisions: wasm32_wasi_preview2
|
||||
// [wasm32_wasi_preview2] compile-flags: --target wasm32-wasi-preview2
|
||||
// [wasm32_wasi_preview2] needs-llvm-components: webassembly
|
||||
// revisions: x86_64_fortanix_unknown_sgx
|
||||
// [x86_64_fortanix_unknown_sgx] compile-flags: --target x86_64-fortanix-unknown-sgx
|
||||
// [x86_64_fortanix_unknown_sgx] needs-llvm-components: x86
|
||||
|
@ -21,6 +21,6 @@ pub fn read_up_to_8(buf: &[u8]) -> u64 {
|
||||
// CHECK-LABEL: @checking_unwrap_expectation(
|
||||
#[no_mangle]
|
||||
pub fn checking_unwrap_expectation(buf: &[u8]) -> &[u8; 4] {
|
||||
// CHECK: call void @_ZN4core6result13unwrap_failed17h
|
||||
// CHECK: call void @{{.*core6result13unwrap_failed}}
|
||||
buf.try_into().unwrap()
|
||||
}
|
||||
|
@ -21,4 +21,17 @@ fn main() {
|
||||
|
||||
for _ in x {}
|
||||
//~^ ERROR using `into_iter`
|
||||
|
||||
let x = FxHashMap::<u32, i32>::default();
|
||||
let _ = x.keys();
|
||||
//~^ ERROR using `keys` can result in unstable query results
|
||||
|
||||
let _ = x.values();
|
||||
//~^ ERROR using `values` can result in unstable query results
|
||||
|
||||
let mut x = FxHashMap::<u32, i32>::default();
|
||||
for val in x.values_mut() {
|
||||
//~^ ERROR using `values_mut` can result in unstable query results
|
||||
*val = *val + 10;
|
||||
}
|
||||
}
|
||||
|
@ -35,5 +35,29 @@ LL | for _ in x {}
|
||||
|
|
||||
= note: if you believe this case to be fine, allow this lint and add a comment explaining your rationale
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
error: using `keys` can result in unstable query results
|
||||
--> $DIR/query_stability.rs:26:15
|
||||
|
|
||||
LL | let _ = x.keys();
|
||||
| ^^^^
|
||||
|
|
||||
= note: if you believe this case to be fine, allow this lint and add a comment explaining your rationale
|
||||
|
||||
error: using `values` can result in unstable query results
|
||||
--> $DIR/query_stability.rs:29:15
|
||||
|
|
||||
LL | let _ = x.values();
|
||||
| ^^^^^^
|
||||
|
|
||||
= note: if you believe this case to be fine, allow this lint and add a comment explaining your rationale
|
||||
|
||||
error: using `values_mut` can result in unstable query results
|
||||
--> $DIR/query_stability.rs:33:18
|
||||
|
|
||||
LL | for val in x.values_mut() {
|
||||
| ^^^^^^^^^^
|
||||
|
|
||||
= note: if you believe this case to be fine, allow this lint and add a comment explaining your rationale
|
||||
|
||||
error: aborting due to 7 previous errors
|
||||
|
||||
|
@ -2,8 +2,9 @@ error[E0631]: type mismatch in closure arguments
|
||||
--> $DIR/anonymous-higher-ranked-lifetime.rs:2:5
|
||||
|
|
||||
LL | f1(|_: (), _: ()| {});
|
||||
| ^^ -------------- found signature defined here
|
||||
| |
|
||||
| ^^^--------------^^^^
|
||||
| | |
|
||||
| | found signature defined here
|
||||
| expected due to this
|
||||
|
|
||||
= note: expected closure signature `for<'a, 'b> fn(&'a (), &'b ()) -> _`
|
||||
@ -22,8 +23,9 @@ error[E0631]: type mismatch in closure arguments
|
||||
--> $DIR/anonymous-higher-ranked-lifetime.rs:3:5
|
||||
|
|
||||
LL | f2(|_: (), _: ()| {});
|
||||
| ^^ -------------- found signature defined here
|
||||
| |
|
||||
| ^^^--------------^^^^
|
||||
| | |
|
||||
| | found signature defined here
|
||||
| expected due to this
|
||||
|
|
||||
= note: expected closure signature `for<'a, 'b> fn(&'a (), &'b ()) -> _`
|
||||
@ -42,8 +44,9 @@ error[E0631]: type mismatch in closure arguments
|
||||
--> $DIR/anonymous-higher-ranked-lifetime.rs:4:5
|
||||
|
|
||||
LL | f3(|_: (), _: ()| {});
|
||||
| ^^ -------------- found signature defined here
|
||||
| |
|
||||
| ^^^--------------^^^^
|
||||
| | |
|
||||
| | found signature defined here
|
||||
| expected due to this
|
||||
|
|
||||
= note: expected closure signature `for<'a> fn(&(), &'a ()) -> _`
|
||||
@ -62,8 +65,9 @@ error[E0631]: type mismatch in closure arguments
|
||||
--> $DIR/anonymous-higher-ranked-lifetime.rs:5:5
|
||||
|
|
||||
LL | f4(|_: (), _: ()| {});
|
||||
| ^^ -------------- found signature defined here
|
||||
| |
|
||||
| ^^^--------------^^^^
|
||||
| | |
|
||||
| | found signature defined here
|
||||
| expected due to this
|
||||
|
|
||||
= note: expected closure signature `for<'r, 'a> fn(&'a (), &'r ()) -> _`
|
||||
@ -82,8 +86,9 @@ error[E0631]: type mismatch in closure arguments
|
||||
--> $DIR/anonymous-higher-ranked-lifetime.rs:6:5
|
||||
|
|
||||
LL | f5(|_: (), _: ()| {});
|
||||
| ^^ -------------- found signature defined here
|
||||
| |
|
||||
| ^^^--------------^^^^
|
||||
| | |
|
||||
| | found signature defined here
|
||||
| expected due to this
|
||||
|
|
||||
= note: expected closure signature `for<'r> fn(&'r (), &'r ()) -> _`
|
||||
@ -102,8 +107,9 @@ error[E0631]: type mismatch in closure arguments
|
||||
--> $DIR/anonymous-higher-ranked-lifetime.rs:7:5
|
||||
|
|
||||
LL | g1(|_: (), _: ()| {});
|
||||
| ^^ -------------- found signature defined here
|
||||
| |
|
||||
| ^^^--------------^^^^
|
||||
| | |
|
||||
| | found signature defined here
|
||||
| expected due to this
|
||||
|
|
||||
= note: expected closure signature `for<'a> fn(&'a (), Box<(dyn for<'a> Fn(&'a ()) + 'static)>) -> _`
|
||||
@ -122,8 +128,9 @@ error[E0631]: type mismatch in closure arguments
|
||||
--> $DIR/anonymous-higher-ranked-lifetime.rs:8:5
|
||||
|
|
||||
LL | g2(|_: (), _: ()| {});
|
||||
| ^^ -------------- found signature defined here
|
||||
| |
|
||||
| ^^^--------------^^^^
|
||||
| | |
|
||||
| | found signature defined here
|
||||
| expected due to this
|
||||
|
|
||||
= note: expected closure signature `for<'a> fn(&'a (), for<'a> fn(&'a ())) -> _`
|
||||
@ -142,8 +149,9 @@ error[E0631]: type mismatch in closure arguments
|
||||
--> $DIR/anonymous-higher-ranked-lifetime.rs:9:5
|
||||
|
|
||||
LL | g3(|_: (), _: ()| {});
|
||||
| ^^ -------------- found signature defined here
|
||||
| |
|
||||
| ^^^--------------^^^^
|
||||
| | |
|
||||
| | found signature defined here
|
||||
| expected due to this
|
||||
|
|
||||
= note: expected closure signature `for<'s> fn(&'s (), Box<(dyn for<'a> Fn(&'a ()) + 'static)>) -> _`
|
||||
@ -162,8 +170,9 @@ error[E0631]: type mismatch in closure arguments
|
||||
--> $DIR/anonymous-higher-ranked-lifetime.rs:10:5
|
||||
|
|
||||
LL | g4(|_: (), _: ()| {});
|
||||
| ^^ -------------- found signature defined here
|
||||
| |
|
||||
| ^^^--------------^^^^
|
||||
| | |
|
||||
| | found signature defined here
|
||||
| expected due to this
|
||||
|
|
||||
= note: expected closure signature `for<'a> fn(&'a (), for<'r> fn(&'r ())) -> _`
|
||||
@ -182,8 +191,9 @@ error[E0631]: type mismatch in closure arguments
|
||||
--> $DIR/anonymous-higher-ranked-lifetime.rs:11:5
|
||||
|
|
||||
LL | h1(|_: (), _: (), _: (), _: ()| {});
|
||||
| ^^ ---------------------------- found signature defined here
|
||||
| |
|
||||
| ^^^----------------------------^^^^
|
||||
| | |
|
||||
| | found signature defined here
|
||||
| expected due to this
|
||||
|
|
||||
= note: expected closure signature `for<'a, 'b> fn(&'a (), Box<(dyn for<'a> Fn(&'a ()) + 'static)>, &'b (), for<'a, 'b> fn(&'a (), &'b ())) -> _`
|
||||
@ -202,8 +212,9 @@ error[E0631]: type mismatch in closure arguments
|
||||
--> $DIR/anonymous-higher-ranked-lifetime.rs:12:5
|
||||
|
|
||||
LL | h2(|_: (), _: (), _: (), _: ()| {});
|
||||
| ^^ ---------------------------- found signature defined here
|
||||
| |
|
||||
| ^^^----------------------------^^^^
|
||||
| | |
|
||||
| | found signature defined here
|
||||
| expected due to this
|
||||
|
|
||||
= note: expected closure signature `for<'t0, 'a> fn(&'a (), Box<(dyn for<'a> Fn(&'a ()) + 'static)>, &'t0 (), for<'a, 'b> fn(&'a (), &'b ())) -> _`
|
||||
|
@ -29,14 +29,12 @@ pub fn f1_uint_uint() {
|
||||
f1(2u32, 4u32);
|
||||
//~^ ERROR `u32: Foo` is not satisfied
|
||||
//~| ERROR `u32: Foo` is not satisfied
|
||||
//~| ERROR `u32: Foo` is not satisfied
|
||||
}
|
||||
|
||||
pub fn f1_uint_int() {
|
||||
f1(2u32, 4i32);
|
||||
//~^ ERROR `u32: Foo` is not satisfied
|
||||
//~| ERROR `u32: Foo` is not satisfied
|
||||
//~| ERROR `u32: Foo` is not satisfied
|
||||
}
|
||||
|
||||
pub fn f2_int() {
|
||||
|
@ -31,14 +31,6 @@ note: required by a bound in `f1`
|
||||
LL | pub fn f1<T: Foo>(a: T, x: T::A) {}
|
||||
| ^^^ required by this bound in `f1`
|
||||
|
||||
error[E0277]: the trait bound `u32: Foo` is not satisfied
|
||||
--> $DIR/associated-types-path-2.rs:29:5
|
||||
|
|
||||
LL | f1(2u32, 4u32);
|
||||
| ^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `u32`
|
||||
|
|
||||
= help: the trait `Foo` is implemented for `i32`
|
||||
|
||||
error[E0277]: the trait bound `u32: Foo` is not satisfied
|
||||
--> $DIR/associated-types-path-2.rs:29:14
|
||||
|
|
||||
@ -48,7 +40,7 @@ LL | f1(2u32, 4u32);
|
||||
= help: the trait `Foo` is implemented for `i32`
|
||||
|
||||
error[E0277]: the trait bound `u32: Foo` is not satisfied
|
||||
--> $DIR/associated-types-path-2.rs:36:8
|
||||
--> $DIR/associated-types-path-2.rs:35:8
|
||||
|
|
||||
LL | f1(2u32, 4i32);
|
||||
| -- ^^^^ the trait `Foo` is not implemented for `u32`
|
||||
@ -63,15 +55,7 @@ LL | pub fn f1<T: Foo>(a: T, x: T::A) {}
|
||||
| ^^^ required by this bound in `f1`
|
||||
|
||||
error[E0277]: the trait bound `u32: Foo` is not satisfied
|
||||
--> $DIR/associated-types-path-2.rs:36:5
|
||||
|
|
||||
LL | f1(2u32, 4i32);
|
||||
| ^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `u32`
|
||||
|
|
||||
= help: the trait `Foo` is implemented for `i32`
|
||||
|
||||
error[E0277]: the trait bound `u32: Foo` is not satisfied
|
||||
--> $DIR/associated-types-path-2.rs:36:14
|
||||
--> $DIR/associated-types-path-2.rs:35:14
|
||||
|
|
||||
LL | f1(2u32, 4i32);
|
||||
| ^^^^ the trait `Foo` is not implemented for `u32`
|
||||
@ -79,7 +63,7 @@ LL | f1(2u32, 4i32);
|
||||
= help: the trait `Foo` is implemented for `i32`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/associated-types-path-2.rs:43:18
|
||||
--> $DIR/associated-types-path-2.rs:41:18
|
||||
|
|
||||
LL | let _: i32 = f2(2i32);
|
||||
| --- ^^^^^^^^ expected `i32`, found `u32`
|
||||
@ -91,7 +75,7 @@ help: you can convert a `u32` to an `i32` and panic if the converted value doesn
|
||||
LL | let _: i32 = f2(2i32).try_into().unwrap();
|
||||
| ++++++++++++++++++++
|
||||
|
||||
error: aborting due to 8 previous errors
|
||||
error: aborting due to 6 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0277, E0308.
|
||||
For more information about an error, try `rustc --explain E0277`.
|
||||
|
@ -5,7 +5,7 @@ LL | fn bar() -> isize;
|
||||
| ------------------ `Foo::bar` defined here
|
||||
...
|
||||
LL | let x: isize = Foo::bar();
|
||||
| ^^^^^^^^ cannot call associated function of trait
|
||||
| ^^^^^^^^^^ cannot call associated function of trait
|
||||
|
|
||||
help: use the fully-qualified path to the only available implementation
|
||||
|
|
||||
|
@ -1,17 +1,19 @@
|
||||
error[E0277]: the type `&mut Context<'_>` may not be safely transferred across an unwind boundary
|
||||
--> $DIR/async-is-unwindsafe.rs:12:5
|
||||
|
|
||||
LL | is_unwindsafe(async {
|
||||
| _____^^^^^^^^^^^^^_-
|
||||
| | |
|
||||
| | `&mut Context<'_>` may not be safely transferred across an unwind boundary
|
||||
LL | |
|
||||
LL | | use std::ptr::null;
|
||||
LL | | use std::task::{Context, RawWaker, RawWakerVTable, Waker};
|
||||
... |
|
||||
LL | | drop(cx_ref);
|
||||
LL | | });
|
||||
| |_____- within this `{async block@$DIR/async-is-unwindsafe.rs:12:19: 29:6}`
|
||||
LL | is_unwindsafe(async {
|
||||
| _____^_____________-
|
||||
| |_____|
|
||||
| ||
|
||||
LL | ||
|
||||
LL | || use std::ptr::null;
|
||||
LL | || use std::task::{Context, RawWaker, RawWakerVTable, Waker};
|
||||
... ||
|
||||
LL | || drop(cx_ref);
|
||||
LL | || });
|
||||
| ||_____-^ `&mut Context<'_>` may not be safely transferred across an unwind boundary
|
||||
| |_____|
|
||||
| within this `{async block@$DIR/async-is-unwindsafe.rs:12:19: 29:6}`
|
||||
|
|
||||
= help: within `{async block@$DIR/async-is-unwindsafe.rs:12:19: 29:6}`, the trait `UnwindSafe` is not implemented for `&mut Context<'_>`
|
||||
= note: `UnwindSafe` is implemented for `&Context<'_>`, but not for `&mut Context<'_>`
|
||||
|
@ -1,8 +1,12 @@
|
||||
error: future cannot be sent between threads safely
|
||||
--> $DIR/issue-67252-unnamed-future.rs:18:5
|
||||
|
|
||||
LL | spawn(async {
|
||||
| ^^^^^ future created by async block is not `Send`
|
||||
LL | / spawn(async {
|
||||
LL | | let a = std::ptr::null_mut::<()>(); // `*mut ()` is not `Send`
|
||||
LL | | AFuture.await;
|
||||
LL | | let _a = a;
|
||||
LL | | });
|
||||
| |______^ future created by async block is not `Send`
|
||||
|
|
||||
= help: within `{async block@$DIR/issue-67252-unnamed-future.rs:18:11: 22:6}`, the trait `Send` is not implemented for `*mut ()`
|
||||
note: future is not `Send` as this value is used across an await
|
||||
|
@ -2,7 +2,7 @@ error: future cannot be sent between threads safely
|
||||
--> $DIR/issue-68112.rs:34:5
|
||||
|
|
||||
LL | require_send(send_fut);
|
||||
| ^^^^^^^^^^^^ future created by async block is not `Send`
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^ future created by async block is not `Send`
|
||||
|
|
||||
= help: the trait `Sync` is not implemented for `RefCell<i32>`
|
||||
= note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead
|
||||
@ -21,7 +21,7 @@ error: future cannot be sent between threads safely
|
||||
--> $DIR/issue-68112.rs:43:5
|
||||
|
|
||||
LL | require_send(send_fut);
|
||||
| ^^^^^^^^^^^^ future created by async block is not `Send`
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^ future created by async block is not `Send`
|
||||
|
|
||||
= help: the trait `Sync` is not implemented for `RefCell<i32>`
|
||||
= note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead
|
||||
@ -40,7 +40,7 @@ error[E0277]: `RefCell<i32>` cannot be shared between threads safely
|
||||
--> $DIR/issue-68112.rs:62:5
|
||||
|
|
||||
LL | require_send(send_fut);
|
||||
| ^^^^^^^^^^^^ `RefCell<i32>` cannot be shared between threads safely
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^ `RefCell<i32>` cannot be shared between threads safely
|
||||
|
|
||||
= help: the trait `Sync` is not implemented for `RefCell<i32>`
|
||||
= note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead
|
||||
|
@ -125,7 +125,7 @@ warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE`
|
||||
LL | target_env = "_UNEXPECTED_VALUE",
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: expected values for `target_env` are: ``, `eabihf`, `gnu`, `gnueabihf`, `msvc`, `musl`, `newlib`, `nto70`, `nto71`, `ohos`, `preview2`, `psx`, `relibc`, `sgx`, `uclibc`
|
||||
= note: expected values for `target_env` are: ``, `eabihf`, `gnu`, `gnueabihf`, `msvc`, `musl`, `newlib`, `nto70`, `nto71`, `ohos`, `psx`, `relibc`, `sgx`, `uclibc`
|
||||
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
|
||||
|
||||
warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE`
|
||||
@ -134,7 +134,7 @@ warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE`
|
||||
LL | target_family = "_UNEXPECTED_VALUE",
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: expected values for `target_family` are: `unix`, `wasi`, `wasm`, `windows`
|
||||
= note: expected values for `target_family` are: `unix`, `wasm`, `windows`
|
||||
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
|
||||
|
||||
warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE`
|
||||
|
@ -1,10 +1,13 @@
|
||||
error[E0631]: type mismatch in closure arguments
|
||||
--> $DIR/expect-infer-var-appearing-twice.rs:14:5
|
||||
|
|
||||
LL | with_closure(|x: u32, y: i32| {
|
||||
| ^^^^^^^^^^^^ ---------------- found signature defined here
|
||||
| |
|
||||
| expected due to this
|
||||
LL | with_closure(|x: u32, y: i32| {
|
||||
| ^ ---------------- found signature defined here
|
||||
| _____|
|
||||
| |
|
||||
LL | |
|
||||
LL | | });
|
||||
| |______^ expected due to this
|
||||
|
|
||||
= note: expected closure signature `fn(_, _) -> _`
|
||||
found closure signature `fn(u32, i32) -> _`
|
||||
|
@ -2,7 +2,7 @@ error[E0277]: the size for values of type `dyn A` cannot be known at compilation
|
||||
--> $DIR/closure-return-type-must-be-sized.rs:54:5
|
||||
|
|
||||
LL | a::foo::<fn() -> dyn A>();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
||||
|
|
||||
= help: within `fn() -> dyn A`, the trait `Sized` is not implemented for `dyn A`
|
||||
= note: required because it appears within the type `fn() -> dyn A`
|
||||
@ -25,7 +25,7 @@ error[E0277]: the size for values of type `dyn A` cannot be known at compilation
|
||||
--> $DIR/closure-return-type-must-be-sized.rs:56:5
|
||||
|
|
||||
LL | a::baz::<fn() -> dyn A>();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
||||
|
|
||||
= help: within `fn() -> dyn A`, the trait `Sized` is not implemented for `dyn A`
|
||||
= note: required because it appears within the type `fn() -> dyn A`
|
||||
@ -34,7 +34,7 @@ error[E0277]: the size for values of type `dyn A` cannot be known at compilation
|
||||
--> $DIR/closure-return-type-must-be-sized.rs:61:5
|
||||
|
|
||||
LL | b::foo::<fn() -> dyn A>();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
||||
|
|
||||
= help: within `fn() -> dyn A`, the trait `Sized` is not implemented for `dyn A`
|
||||
= note: required because it appears within the type `fn() -> dyn A`
|
||||
@ -57,7 +57,7 @@ error[E0277]: the size for values of type `dyn A` cannot be known at compilation
|
||||
--> $DIR/closure-return-type-must-be-sized.rs:63:5
|
||||
|
|
||||
LL | b::baz::<fn() -> dyn A>();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
||||
|
|
||||
= help: within `fn() -> dyn A`, the trait `Sized` is not implemented for `dyn A`
|
||||
= note: required because it appears within the type `fn() -> dyn A`
|
||||
@ -66,7 +66,7 @@ error[E0277]: the size for values of type `dyn A` cannot be known at compilation
|
||||
--> $DIR/closure-return-type-must-be-sized.rs:68:5
|
||||
|
|
||||
LL | c::foo::<fn() -> dyn A>();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
||||
|
|
||||
= help: within `fn() -> dyn A`, the trait `Sized` is not implemented for `dyn A`
|
||||
= note: required because it appears within the type `fn() -> dyn A`
|
||||
@ -89,7 +89,7 @@ error[E0277]: the size for values of type `dyn A` cannot be known at compilation
|
||||
--> $DIR/closure-return-type-must-be-sized.rs:70:5
|
||||
|
|
||||
LL | c::baz::<fn() -> dyn A>();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
||||
|
|
||||
= help: within `fn() -> dyn A`, the trait `Sized` is not implemented for `dyn A`
|
||||
= note: required because it appears within the type `fn() -> dyn A`
|
||||
|
@ -2,8 +2,9 @@ error[E0631]: type mismatch in closure arguments
|
||||
--> $DIR/multiple-fn-bounds.rs:10:5
|
||||
|
|
||||
LL | foo(move |x| v);
|
||||
| ^^^ -------- found signature defined here
|
||||
| |
|
||||
| ^^^^--------^^^
|
||||
| | |
|
||||
| | found signature defined here
|
||||
| expected due to this
|
||||
|
|
||||
= note: expected closure signature `fn(_) -> _`
|
||||
|
@ -2,7 +2,7 @@ error: unconstrained generic constant
|
||||
--> $DIR/ensure_is_evaluatable.rs:9:5
|
||||
|
|
||||
LL | bar()
|
||||
| ^^^
|
||||
| ^^^^^
|
||||
|
|
||||
= help: try adding a `where` bound using this expression: `where [(); N + 1]:`
|
||||
note: required by a bound in `bar`
|
||||
|
@ -2,7 +2,7 @@ error: unconstrained generic constant
|
||||
--> $DIR/fn_with_two_const_inputs.rs:12:5
|
||||
|
|
||||
LL | bar()
|
||||
| ^^^
|
||||
| ^^^^^
|
||||
|
|
||||
= help: try adding a `where` bound using this expression: `where [(); N + 1]:`
|
||||
note: required by a bound in `bar`
|
||||
|
@ -2,7 +2,7 @@ error[E0283]: type annotations needed for `Mask<_, N>`
|
||||
--> $DIR/issue-91614.rs:6:9
|
||||
|
|
||||
LL | let y = Mask::<_, _>::splat(false);
|
||||
| ^ ------------------- type must be known at this point
|
||||
| ^ -------------------------- type must be known at this point
|
||||
|
|
||||
= note: cannot satisfy `_: MaskElement`
|
||||
= help: the following types implement trait `MaskElement`:
|
||||
|
@ -20,7 +20,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/abstract-const-as-cast-3.rs:17:5
|
||||
|
|
||||
LL | assert_impl::<HasCastInTraitImpl<{ N + 1 }, { N as u128 }>>();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `{ N as u128 }`, found `{ O as u128 }`
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `{ N as u128 }`, found `{ O as u128 }`
|
||||
|
|
||||
= note: expected constant `{ N as u128 }`
|
||||
found constant `{ O as u128 }`
|
||||
@ -52,7 +52,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/abstract-const-as-cast-3.rs:20:5
|
||||
|
|
||||
LL | assert_impl::<HasCastInTraitImpl<{ N + 1 }, { N as _ }>>();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `{ N as _ }`, found `{ O as u128 }`
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `{ N as _ }`, found `{ O as u128 }`
|
||||
|
|
||||
= note: expected constant `{ N as _ }`
|
||||
found constant `{ O as u128 }`
|
||||
@ -66,7 +66,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/abstract-const-as-cast-3.rs:23:5
|
||||
|
|
||||
LL | assert_impl::<HasCastInTraitImpl<13, { 12 as u128 }>>();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `12`, found `13`
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `12`, found `13`
|
||||
|
|
||||
= note: expected constant `12`
|
||||
found constant `13`
|
||||
@ -80,7 +80,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/abstract-const-as-cast-3.rs:25:5
|
||||
|
|
||||
LL | assert_impl::<HasCastInTraitImpl<14, 13>>();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `13`, found `14`
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `13`, found `14`
|
||||
|
|
||||
= note: expected constant `13`
|
||||
found constant `14`
|
||||
@ -112,7 +112,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/abstract-const-as-cast-3.rs:35:5
|
||||
|
|
||||
LL | assert_impl::<HasCastInTraitImpl<{ N + 1 }, { N as u128 }>>();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `{ N as u128 }`, found `{ O as u128 }`
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `{ N as u128 }`, found `{ O as u128 }`
|
||||
|
|
||||
= note: expected constant `{ N as u128 }`
|
||||
found constant `{ O as u128 }`
|
||||
@ -144,7 +144,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/abstract-const-as-cast-3.rs:38:5
|
||||
|
|
||||
LL | assert_impl::<HasCastInTraitImpl<{ N + 1 }, { N as _ }>>();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `{ N as _ }`, found `{ O as u128 }`
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `{ N as _ }`, found `{ O as u128 }`
|
||||
|
|
||||
= note: expected constant `{ N as _ }`
|
||||
found constant `{ O as u128 }`
|
||||
@ -158,7 +158,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/abstract-const-as-cast-3.rs:41:5
|
||||
|
|
||||
LL | assert_impl::<HasCastInTraitImpl<13, { 12 as u128 }>>();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `12`, found `13`
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `12`, found `13`
|
||||
|
|
||||
= note: expected constant `12`
|
||||
found constant `13`
|
||||
@ -172,7 +172,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/abstract-const-as-cast-3.rs:43:5
|
||||
|
|
||||
LL | assert_impl::<HasCastInTraitImpl<14, 13>>();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `13`, found `14`
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `13`, found `14`
|
||||
|
|
||||
= note: expected constant `13`
|
||||
found constant `14`
|
||||
|
@ -58,7 +58,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/issue-85848.rs:24:5
|
||||
|
|
||||
LL | writes_to_specific_path(&cap);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^ expected `true`, found `{ contains::<T, U>() }`
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `true`, found `{ contains::<T, U>() }`
|
||||
|
|
||||
= note: expected constant `true`
|
||||
found constant `{ contains::<T, U>() }`
|
||||
|
@ -2,7 +2,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/obligation-cause.rs:20:5
|
||||
|
|
||||
LL | g::<usize>();
|
||||
| ^^^^^^^^^^ expected `false`, found `true`
|
||||
| ^^^^^^^^^^^^ expected `false`, found `true`
|
||||
|
|
||||
= note: expected constant `false`
|
||||
found constant `true`
|
||||
|
@ -2,7 +2,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/issue-79674.rs:26:5
|
||||
|
|
||||
LL | requires_distinct("str", 12);
|
||||
| ^^^^^^^^^^^^^^^^^ expected `true`, found `false`
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `true`, found `false`
|
||||
|
|
||||
= note: expected constant `true`
|
||||
found constant `false`
|
||||
|
@ -2,7 +2,7 @@ error[E0284]: type annotations needed
|
||||
--> $DIR/parent_generics_of_encoding_impl_trait.rs:9:5
|
||||
|
|
||||
LL | generics_of_parent_impl_trait::foo([()]);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer the value of const parameter `N` declared on the function `foo`
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer the value of const parameter `N` declared on the function `foo`
|
||||
|
|
||||
note: required by a bound in `foo`
|
||||
--> $DIR/auxiliary/generics_of_parent_impl_trait.rs:6:48
|
||||
|
@ -11,7 +11,7 @@ error[E0790]: cannot call associated function on trait without specifying the co
|
||||
--> $DIR/issue-54954.rs:1:24
|
||||
|
|
||||
LL | const ARR_LEN: usize = Tt::const_val::<[i8; 123]>();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot call associated function of trait
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot call associated function of trait
|
||||
...
|
||||
LL | / const fn const_val<T: Sized>() -> usize {
|
||||
LL | |
|
||||
|
@ -5,7 +5,7 @@ LL | let gen_clone_0 = move || {
|
||||
| ------- within this `{coroutine@$DIR/clone-impl.rs:36:23: 36:30}`
|
||||
...
|
||||
LL | check_copy(&gen_clone_0);
|
||||
| ^^^^^^^^^^ within `{coroutine@$DIR/clone-impl.rs:36:23: 36:30}`, the trait `Copy` is not implemented for `Vec<u32>`
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ within `{coroutine@$DIR/clone-impl.rs:36:23: 36:30}`, the trait `Copy` is not implemented for `Vec<u32>`
|
||||
|
|
||||
note: captured value does not implement `Copy`
|
||||
--> $DIR/clone-impl.rs:40:14
|
||||
@ -25,7 +25,7 @@ LL | let gen_clone_0 = move || {
|
||||
| ------- within this `{coroutine@$DIR/clone-impl.rs:36:23: 36:30}`
|
||||
...
|
||||
LL | check_copy(&gen_clone_0);
|
||||
| ^^^^^^^^^^ within `{coroutine@$DIR/clone-impl.rs:36:23: 36:30}`, the trait `Copy` is not implemented for `Vec<char>`
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ within `{coroutine@$DIR/clone-impl.rs:36:23: 36:30}`, the trait `Copy` is not implemented for `Vec<char>`
|
||||
|
|
||||
note: coroutine does not implement `Copy` as this value is used across a yield
|
||||
--> $DIR/clone-impl.rs:38:9
|
||||
@ -47,7 +47,7 @@ LL | let gen_clone_1 = move || {
|
||||
| ------- within this `{coroutine@$DIR/clone-impl.rs:46:23: 46:30}`
|
||||
...
|
||||
LL | check_copy(&gen_clone_1);
|
||||
| ^^^^^^^^^^ within `{coroutine@$DIR/clone-impl.rs:46:23: 46:30}`, the trait `Copy` is not implemented for `Vec<u32>`
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ within `{coroutine@$DIR/clone-impl.rs:46:23: 46:30}`, the trait `Copy` is not implemented for `Vec<u32>`
|
||||
|
|
||||
note: captured value does not implement `Copy`
|
||||
--> $DIR/clone-impl.rs:56:14
|
||||
@ -67,7 +67,7 @@ LL | let gen_clone_1 = move || {
|
||||
| ------- within this `{coroutine@$DIR/clone-impl.rs:46:23: 46:30}`
|
||||
...
|
||||
LL | check_copy(&gen_clone_1);
|
||||
| ^^^^^^^^^^ within `{coroutine@$DIR/clone-impl.rs:46:23: 46:30}`, the trait `Copy` is not implemented for `Vec<char>`
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ within `{coroutine@$DIR/clone-impl.rs:46:23: 46:30}`, the trait `Copy` is not implemented for `Vec<char>`
|
||||
|
|
||||
note: coroutine does not implement `Copy` as this value is used across a yield
|
||||
--> $DIR/clone-impl.rs:52:9
|
||||
@ -90,7 +90,7 @@ LL | let gen_non_clone = move || {
|
||||
| ------- within this `{coroutine@$DIR/clone-impl.rs:62:25: 62:32}`
|
||||
...
|
||||
LL | check_copy(&gen_non_clone);
|
||||
| ^^^^^^^^^^ within `{coroutine@$DIR/clone-impl.rs:62:25: 62:32}`, the trait `Copy` is not implemented for `NonClone`
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ within `{coroutine@$DIR/clone-impl.rs:62:25: 62:32}`, the trait `Copy` is not implemented for `NonClone`
|
||||
|
|
||||
note: captured value does not implement `Copy`
|
||||
--> $DIR/clone-impl.rs:64:14
|
||||
@ -115,7 +115,7 @@ LL | let gen_non_clone = move || {
|
||||
| ------- within this `{coroutine@$DIR/clone-impl.rs:62:25: 62:32}`
|
||||
...
|
||||
LL | check_clone(&gen_non_clone);
|
||||
| ^^^^^^^^^^^ within `{coroutine@$DIR/clone-impl.rs:62:25: 62:32}`, the trait `Clone` is not implemented for `NonClone`
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ within `{coroutine@$DIR/clone-impl.rs:62:25: 62:32}`, the trait `Clone` is not implemented for `NonClone`
|
||||
|
|
||||
note: captured value does not implement `Clone`
|
||||
--> $DIR/clone-impl.rs:64:14
|
||||
|
@ -2,7 +2,7 @@ error: coroutine cannot be sent between threads safely
|
||||
--> $DIR/drop-tracking-parent-expression.rs:23:13
|
||||
|
|
||||
LL | assert_send(g);
|
||||
| ^^^^^^^^^^^ coroutine is not `Send`
|
||||
| ^^^^^^^^^^^^^^ coroutine is not `Send`
|
||||
...
|
||||
LL | / type_combinations!(
|
||||
LL | | // OK
|
||||
@ -42,7 +42,7 @@ error: coroutine cannot be sent between threads safely
|
||||
--> $DIR/drop-tracking-parent-expression.rs:23:13
|
||||
|
|
||||
LL | assert_send(g);
|
||||
| ^^^^^^^^^^^ coroutine is not `Send`
|
||||
| ^^^^^^^^^^^^^^ coroutine is not `Send`
|
||||
...
|
||||
LL | / type_combinations!(
|
||||
LL | | // OK
|
||||
@ -82,7 +82,7 @@ error: coroutine cannot be sent between threads safely
|
||||
--> $DIR/drop-tracking-parent-expression.rs:23:13
|
||||
|
|
||||
LL | assert_send(g);
|
||||
| ^^^^^^^^^^^ coroutine is not `Send`
|
||||
| ^^^^^^^^^^^^^^ coroutine is not `Send`
|
||||
...
|
||||
LL | / type_combinations!(
|
||||
LL | | // OK
|
||||
|
@ -1,8 +1,13 @@
|
||||
error: coroutine cannot be sent between threads safely
|
||||
--> $DIR/drop-yield-twice.rs:7:5
|
||||
|
|
||||
LL | assert_send(|| {
|
||||
| ^^^^^^^^^^^ coroutine is not `Send`
|
||||
LL | / assert_send(|| {
|
||||
LL | | let guard = Foo(42);
|
||||
LL | | yield;
|
||||
LL | | drop(guard);
|
||||
LL | | yield;
|
||||
LL | | })
|
||||
| |______^ coroutine is not `Send`
|
||||
|
|
||||
= help: within `{coroutine@$DIR/drop-yield-twice.rs:7:17: 7:19}`, the trait `Send` is not implemented for `Foo`
|
||||
note: coroutine is not `Send` as this value is used across a yield
|
||||
|
@ -29,7 +29,7 @@ LL | let mut g = || {
|
||||
| -- within this `{coroutine@$DIR/issue-105084.rs:14:17: 14:19}`
|
||||
...
|
||||
LL | let mut h = copy(g);
|
||||
| ^^^^ within `{coroutine@$DIR/issue-105084.rs:14:17: 14:19}`, the trait `Copy` is not implemented for `Box<(i32, ())>`
|
||||
| ^^^^^^^ within `{coroutine@$DIR/issue-105084.rs:14:17: 14:19}`, the trait `Copy` is not implemented for `Box<(i32, ())>`
|
||||
|
|
||||
note: coroutine does not implement `Copy` as this value is used across a yield
|
||||
--> $DIR/issue-105084.rs:21:22
|
||||
|
@ -2,7 +2,7 @@ error: coroutine cannot be sent between threads safely
|
||||
--> $DIR/issue-68112.rs:40:5
|
||||
|
|
||||
LL | require_send(send_gen);
|
||||
| ^^^^^^^^^^^^ coroutine is not `Send`
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^ coroutine is not `Send`
|
||||
|
|
||||
= help: the trait `Sync` is not implemented for `RefCell<i32>`
|
||||
= note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead
|
||||
@ -24,7 +24,7 @@ error[E0277]: `RefCell<i32>` cannot be shared between threads safely
|
||||
--> $DIR/issue-68112.rs:64:5
|
||||
|
|
||||
LL | require_send(send_gen);
|
||||
| ^^^^^^^^^^^^ `RefCell<i32>` cannot be shared between threads safely
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^ `RefCell<i32>` cannot be shared between threads safely
|
||||
|
|
||||
= help: the trait `Sync` is not implemented for `RefCell<i32>`
|
||||
= note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead
|
||||
|
@ -1,8 +1,13 @@
|
||||
error: coroutine cannot be shared between threads safely
|
||||
--> $DIR/not-send-sync.rs:14:5
|
||||
|
|
||||
LL | assert_sync(|| {
|
||||
| ^^^^^^^^^^^ coroutine is not `Sync`
|
||||
LL | / assert_sync(|| {
|
||||
LL | |
|
||||
LL | | let a = NotSync;
|
||||
LL | | yield;
|
||||
LL | | drop(a);
|
||||
LL | | });
|
||||
| |______^ coroutine is not `Sync`
|
||||
|
|
||||
= help: within `{coroutine@$DIR/not-send-sync.rs:14:17: 14:19}`, the trait `Sync` is not implemented for `NotSync`
|
||||
note: coroutine is not `Sync` as this value is used across a yield
|
||||
@ -21,8 +26,13 @@ LL | fn assert_sync<T: Sync>(_: T) {}
|
||||
error: coroutine cannot be sent between threads safely
|
||||
--> $DIR/not-send-sync.rs:21:5
|
||||
|
|
||||
LL | assert_send(|| {
|
||||
| ^^^^^^^^^^^ coroutine is not `Send`
|
||||
LL | / assert_send(|| {
|
||||
LL | |
|
||||
LL | | let a = NotSend;
|
||||
LL | | yield;
|
||||
LL | | drop(a);
|
||||
LL | | });
|
||||
| |______^ coroutine is not `Send`
|
||||
|
|
||||
= help: within `{coroutine@$DIR/not-send-sync.rs:21:17: 21:19}`, the trait `Send` is not implemented for `NotSend`
|
||||
note: coroutine is not `Send` as this value is used across a yield
|
||||
|
@ -2,7 +2,7 @@ error: coroutine cannot be sent between threads safely
|
||||
--> $DIR/parent-expression.rs:23:13
|
||||
|
|
||||
LL | assert_send(g);
|
||||
| ^^^^^^^^^^^ coroutine is not `Send`
|
||||
| ^^^^^^^^^^^^^^ coroutine is not `Send`
|
||||
...
|
||||
LL | / type_combinations!(
|
||||
LL | | // OK
|
||||
@ -42,7 +42,7 @@ error: coroutine cannot be sent between threads safely
|
||||
--> $DIR/parent-expression.rs:23:13
|
||||
|
|
||||
LL | assert_send(g);
|
||||
| ^^^^^^^^^^^ coroutine is not `Send`
|
||||
| ^^^^^^^^^^^^^^ coroutine is not `Send`
|
||||
...
|
||||
LL | / type_combinations!(
|
||||
LL | | // OK
|
||||
@ -82,7 +82,7 @@ error: coroutine cannot be sent between threads safely
|
||||
--> $DIR/parent-expression.rs:23:13
|
||||
|
|
||||
LL | assert_send(g);
|
||||
| ^^^^^^^^^^^ coroutine is not `Send`
|
||||
| ^^^^^^^^^^^^^^ coroutine is not `Send`
|
||||
...
|
||||
LL | / type_combinations!(
|
||||
LL | | // OK
|
||||
|
@ -2,7 +2,7 @@ error: coroutine cannot be sent between threads safely
|
||||
--> $DIR/coroutine-print-verbose-1.rs:37:5
|
||||
|
|
||||
LL | require_send(send_gen);
|
||||
| ^^^^^^^^^^^^ coroutine is not `Send`
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^ coroutine is not `Send`
|
||||
|
|
||||
= help: the trait `Sync` is not implemented for `RefCell<i32>`
|
||||
= note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead
|
||||
@ -23,7 +23,7 @@ error[E0277]: `RefCell<i32>` cannot be shared between threads safely
|
||||
--> $DIR/coroutine-print-verbose-1.rs:56:5
|
||||
|
|
||||
LL | require_send(send_gen);
|
||||
| ^^^^^^^^^^^^ `RefCell<i32>` cannot be shared between threads safely
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^ `RefCell<i32>` cannot be shared between threads safely
|
||||
|
|
||||
= help: the trait `Sync` is not implemented for `RefCell<i32>`
|
||||
= note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead
|
||||
|
@ -1,8 +1,13 @@
|
||||
error: coroutine cannot be shared between threads safely
|
||||
--> $DIR/coroutine-print-verbose-2.rs:17:5
|
||||
|
|
||||
LL | assert_sync(|| {
|
||||
| ^^^^^^^^^^^ coroutine is not `Sync`
|
||||
LL | / assert_sync(|| {
|
||||
LL | |
|
||||
LL | | let a = NotSync;
|
||||
LL | | yield;
|
||||
LL | | drop(a);
|
||||
LL | | });
|
||||
| |______^ coroutine is not `Sync`
|
||||
|
|
||||
= help: within `{main::{closure#0} upvar_tys=() witness={main::{closure#0}}}`, the trait `Sync` is not implemented for `NotSync`
|
||||
note: coroutine is not `Sync` as this value is used across a yield
|
||||
@ -21,8 +26,13 @@ LL | fn assert_sync<T: Sync>(_: T) {}
|
||||
error: coroutine cannot be sent between threads safely
|
||||
--> $DIR/coroutine-print-verbose-2.rs:24:5
|
||||
|
|
||||
LL | assert_send(|| {
|
||||
| ^^^^^^^^^^^ coroutine is not `Send`
|
||||
LL | / assert_send(|| {
|
||||
LL | |
|
||||
LL | | let a = NotSend;
|
||||
LL | | yield;
|
||||
LL | | drop(a);
|
||||
LL | | });
|
||||
| |______^ coroutine is not `Send`
|
||||
|
|
||||
= help: within `{main::{closure#1} upvar_tys=() witness={main::{closure#1}}}`, the trait `Send` is not implemented for `NotSend`
|
||||
note: coroutine is not `Send` as this value is used across a yield
|
||||
|
@ -1,16 +1,16 @@
|
||||
#![derive(Copy)] //~ ERROR cannot determine resolution for the attribute macro `derive`
|
||||
#![derive(Copy)]
|
||||
//~^ ERROR `derive` attribute cannot be used at crate level
|
||||
|
||||
#![test]//~ ERROR cannot determine resolution for the attribute macro `test`
|
||||
#![test]
|
||||
//~^ ERROR `test` attribute cannot be used at crate level
|
||||
|
||||
#![test_case]//~ ERROR cannot determine resolution for the attribute macro `test_case`
|
||||
#![test_case]
|
||||
//~^ ERROR `test_case` attribute cannot be used at crate level
|
||||
|
||||
#![bench]//~ ERROR cannot determine resolution for the attribute macro `bench`
|
||||
#![bench]
|
||||
//~^ ERROR `bench` attribute cannot be used at crate level
|
||||
|
||||
#![global_allocator]//~ ERROR cannot determine resolution for the attribute macro `global_allocator`
|
||||
#![global_allocator]
|
||||
//~^ ERROR `global_allocator` attribute cannot be used at crate level
|
||||
|
||||
fn main() {}
|
||||
|
@ -1,43 +1,3 @@
|
||||
error: cannot determine resolution for the attribute macro `derive`
|
||||
--> $DIR/issue-36617.rs:1:4
|
||||
|
|
||||
LL | #![derive(Copy)]
|
||||
| ^^^^^^
|
||||
|
|
||||
= note: import resolution is stuck, try simplifying macro imports
|
||||
|
||||
error: cannot determine resolution for the attribute macro `test`
|
||||
--> $DIR/issue-36617.rs:4:4
|
||||
|
|
||||
LL | #![test]
|
||||
| ^^^^
|
||||
|
|
||||
= note: import resolution is stuck, try simplifying macro imports
|
||||
|
||||
error: cannot determine resolution for the attribute macro `test_case`
|
||||
--> $DIR/issue-36617.rs:7:4
|
||||
|
|
||||
LL | #![test_case]
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: import resolution is stuck, try simplifying macro imports
|
||||
|
||||
error: cannot determine resolution for the attribute macro `bench`
|
||||
--> $DIR/issue-36617.rs:10:4
|
||||
|
|
||||
LL | #![bench]
|
||||
| ^^^^^
|
||||
|
|
||||
= note: import resolution is stuck, try simplifying macro imports
|
||||
|
||||
error: cannot determine resolution for the attribute macro `global_allocator`
|
||||
--> $DIR/issue-36617.rs:13:4
|
||||
|
|
||||
LL | #![global_allocator]
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: import resolution is stuck, try simplifying macro imports
|
||||
|
||||
error: `derive` attribute cannot be used at crate level
|
||||
--> $DIR/issue-36617.rs:1:1
|
||||
|
|
||||
@ -113,5 +73,5 @@ LL - #![global_allocator]
|
||||
LL + #[global_allocator]
|
||||
|
|
||||
|
||||
error: aborting due to 10 previous errors
|
||||
error: aborting due to 5 previous errors
|
||||
|
||||
|
@ -2,7 +2,7 @@ error[E0275]: overflow evaluating the requirement `J: Send`
|
||||
--> $DIR/recursion_limit.rs:34:5
|
||||
|
|
||||
LL | is_send::<A>();
|
||||
| ^^^^^^^^^^^^
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: consider increasing the recursion limit by adding a `#![recursion_limit = "20"]` attribute to your crate (`recursion_limit`)
|
||||
note: required because it appears within the type `I`
|
||||
|
@ -15,7 +15,7 @@ error[E0277]: the trait bound `[u8; 1]: Test` is not satisfied
|
||||
--> $DIR/issue-90528-unsizing-not-suggestion-110063.rs:11:22
|
||||
|
|
||||
LL | let x: [u8; 1] = needs_test();
|
||||
| ^^^^^^^^^^ the trait `Test` is not implemented for `[u8; 1]`
|
||||
| ^^^^^^^^^^^^ the trait `Test` is not implemented for `[u8; 1]`
|
||||
|
|
||||
= help: the trait `Test` is implemented for `&[u8]`
|
||||
note: required by a bound in `needs_test`
|
||||
|
@ -5,7 +5,7 @@ LL | fn create() -> u32;
|
||||
| ------------------- `Coroutine::create` defined here
|
||||
...
|
||||
LL | let cont: u32 = Coroutine::create();
|
||||
| ^^^^^^^^^^^^^^^^^ cannot call associated function of trait
|
||||
| ^^^^^^^^^^^^^^^^^^^ cannot call associated function of trait
|
||||
|
|
||||
help: use a fully-qualified path to a specific available implementation
|
||||
|
|
||||
|
@ -5,7 +5,7 @@ LL | fn my_fn();
|
||||
| ----------- `MyTrait::my_fn` defined here
|
||||
...
|
||||
LL | MyTrait::my_fn();
|
||||
| ^^^^^^^^^^^^^^ cannot call associated function of trait
|
||||
| ^^^^^^^^^^^^^^^^ cannot call associated function of trait
|
||||
|
|
||||
help: use the fully-qualified path to the only available implementation
|
||||
|
|
||||
@ -33,7 +33,7 @@ LL | fn my_fn();
|
||||
| ----------- `MyTrait::my_fn` defined here
|
||||
...
|
||||
LL | inner::MyTrait::my_fn();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^ cannot call associated function of trait
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^ cannot call associated function of trait
|
||||
|
|
||||
help: use the fully-qualified path to the only available implementation
|
||||
|
|
||||
@ -61,7 +61,7 @@ LL | fn my_fn();
|
||||
| ----------- `MyTrait2::my_fn` defined here
|
||||
...
|
||||
LL | MyTrait2::my_fn();
|
||||
| ^^^^^^^^^^^^^^^ cannot call associated function of trait
|
||||
| ^^^^^^^^^^^^^^^^^ cannot call associated function of trait
|
||||
|
|
||||
help: use a fully-qualified path to a specific available implementation
|
||||
|
|
||||
|
@ -4,7 +4,6 @@ mod unresolved_env {
|
||||
use env; //~ ERROR unresolved import `env`
|
||||
|
||||
include!(concat!(env!("NON_EXISTENT"), "/data.rs"));
|
||||
//~^ ERROR cannot determine resolution for the macro `env`
|
||||
}
|
||||
|
||||
mod nonexistent_env {
|
||||
|
@ -1,5 +1,5 @@
|
||||
error: environment variable `NON_EXISTENT` not defined at compile time
|
||||
--> $DIR/issue-55897.rs:11:22
|
||||
--> $DIR/issue-55897.rs:10:22
|
||||
|
|
||||
LL | include!(concat!(env!("NON_EXISTENT"), "/data.rs"));
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
@ -8,7 +8,7 @@ LL | include!(concat!(env!("NON_EXISTENT"), "/data.rs"));
|
||||
= note: this error originates in the macro `env` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: suffixes on string literals are invalid
|
||||
--> $DIR/issue-55897.rs:16:22
|
||||
--> $DIR/issue-55897.rs:15:22
|
||||
|
|
||||
LL | include!(concat!("NON_EXISTENT"suffix, "/data.rs"));
|
||||
| ^^^^^^^^^^^^^^^^^^^^ invalid suffix `suffix`
|
||||
@ -33,14 +33,6 @@ help: consider importing this module instead
|
||||
LL | use std::env;
|
||||
| ~~~~~~~~
|
||||
|
||||
error: cannot determine resolution for the macro `env`
|
||||
--> $DIR/issue-55897.rs:6:22
|
||||
|
|
||||
LL | include!(concat!(env!("NON_EXISTENT"), "/data.rs"));
|
||||
| ^^^
|
||||
|
|
||||
= note: import resolution is stuck, try simplifying macro imports
|
||||
|
||||
error: aborting due to 5 previous errors
|
||||
error: aborting due to 4 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0432`.
|
||||
|
@ -5,6 +5,5 @@
|
||||
#![feature(custom_inner_attributes)]
|
||||
|
||||
#![bench = "4100"]
|
||||
//~^ ERROR cannot determine resolution for the attribute macro `bench`
|
||||
//~^^ ERROR `bench` attribute cannot be used at crate level
|
||||
//~^ ERROR `bench` attribute cannot be used at crate level
|
||||
fn main() {}
|
||||
|
@ -1,17 +1,9 @@
|
||||
error: cannot determine resolution for the attribute macro `bench`
|
||||
--> $DIR/issue-43106-gating-of-bench.rs:7:4
|
||||
|
|
||||
LL | #![bench = "4100"]
|
||||
| ^^^^^
|
||||
|
|
||||
= note: import resolution is stuck, try simplifying macro imports
|
||||
|
||||
error: `bench` attribute cannot be used at crate level
|
||||
--> $DIR/issue-43106-gating-of-bench.rs:7:1
|
||||
|
|
||||
LL | #![bench = "4100"]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
...
|
||||
LL |
|
||||
LL | fn main() {}
|
||||
| ---- the inner attribute doesn't annotate this function
|
||||
|
|
||||
@ -21,5 +13,5 @@ LL - #![bench = "4100"]
|
||||
LL + #[bench = "4100"]
|
||||
|
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user