mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 16:24:46 +00:00
Auto merge of #102165 - matthiaskrgr:rollup-n5oquhe, r=matthiaskrgr
Rollup of 8 pull requests Successful merges: - #100734 (Split out async_fn_in_trait into a separate feature) - #101664 (Note if mismatched types have a similar name) - #101815 (Migrated the rustc_passes annotation without effect diagnostic infrastructure) - #102042 (Distribute rust-docs-json via rustup.) - #102066 (rustdoc: remove unnecessary `max-width` on headers) - #102095 (Deduplicate two functions that would soon have been three) - #102104 (Set 'exec-env:RUST_BACKTRACE=0' in const-eval-select tests) - #102112 (Allow full relro on powerpc64-unknown-linux-gnu) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
commit
4d44e09cb1
@ -332,6 +332,15 @@ impl FnDeclKind {
|
|||||||
_ => false,
|
_ => false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn async_fn_allowed(&self, tcx: TyCtxt<'_>) -> bool {
|
||||||
|
match self {
|
||||||
|
FnDeclKind::Fn | FnDeclKind::Inherent => true,
|
||||||
|
FnDeclKind::Impl if tcx.features().async_fn_in_trait => true,
|
||||||
|
FnDeclKind::Trait if tcx.features().async_fn_in_trait => true,
|
||||||
|
_ => false,
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Copy, Clone)]
|
#[derive(Copy, Clone)]
|
||||||
@ -1692,14 +1701,14 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
let output = if let Some((ret_id, span)) = make_ret_async {
|
let output = if let Some((ret_id, span)) = make_ret_async {
|
||||||
if !kind.impl_trait_allowed(self.tcx) {
|
if !kind.async_fn_allowed(self.tcx) {
|
||||||
match kind {
|
match kind {
|
||||||
FnDeclKind::Trait | FnDeclKind::Impl => {
|
FnDeclKind::Trait | FnDeclKind::Impl => {
|
||||||
self.tcx
|
self.tcx
|
||||||
.sess
|
.sess
|
||||||
.create_feature_err(
|
.create_feature_err(
|
||||||
TraitFnAsync { fn_span, span },
|
TraitFnAsync { fn_span, span },
|
||||||
sym::return_position_impl_trait_in_trait,
|
sym::async_fn_in_trait,
|
||||||
)
|
)
|
||||||
.emit();
|
.emit();
|
||||||
}
|
}
|
||||||
@ -1917,9 +1926,13 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
|
|||||||
let future_bound = this.lower_async_fn_output_type_to_future_bound(
|
let future_bound = this.lower_async_fn_output_type_to_future_bound(
|
||||||
output,
|
output,
|
||||||
span,
|
span,
|
||||||
|
if in_trait && !this.tcx.features().return_position_impl_trait_in_trait {
|
||||||
|
ImplTraitContext::Disallowed(ImplTraitPosition::TraitReturn)
|
||||||
|
} else {
|
||||||
ImplTraitContext::ReturnPositionOpaqueTy {
|
ImplTraitContext::ReturnPositionOpaqueTy {
|
||||||
origin: hir::OpaqueTyOrigin::FnReturn(fn_def_id),
|
origin: hir::OpaqueTyOrigin::FnReturn(fn_def_id),
|
||||||
in_trait,
|
in_trait,
|
||||||
|
}
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -268,3 +268,6 @@ passes_link_ordinal = attribute should be applied to a foreign function or stati
|
|||||||
|
|
||||||
passes_collapse_debuginfo = `collapse_debuginfo` attribute should be applied to macro definitions
|
passes_collapse_debuginfo = `collapse_debuginfo` attribute should be applied to macro definitions
|
||||||
.label = not a macro definition
|
.label = not a macro definition
|
||||||
|
|
||||||
|
passes_deprecated_annotation_has_no_effect = this `#[deprecated]` annotation has no effect
|
||||||
|
.suggestion = remove the unnecessary deprecation attribute
|
||||||
|
@ -312,6 +312,8 @@ declare_features! (
|
|||||||
(active, associated_type_defaults, "1.2.0", Some(29661), None),
|
(active, associated_type_defaults, "1.2.0", Some(29661), None),
|
||||||
/// Allows `async || body` closures.
|
/// Allows `async || body` closures.
|
||||||
(active, async_closure, "1.37.0", Some(62290), None),
|
(active, async_closure, "1.37.0", Some(62290), None),
|
||||||
|
/// Alows async functions to be declared, implemented, and used in traits.
|
||||||
|
(incomplete, async_fn_in_trait, "CURRENT_RUSTC_VERSION", Some(91611), None),
|
||||||
/// Allows `extern "C-unwind" fn` to enable unwinding across ABI boundaries.
|
/// Allows `extern "C-unwind" fn` to enable unwinding across ABI boundaries.
|
||||||
(active, c_unwind, "1.52.0", Some(74990), None),
|
(active, c_unwind, "1.52.0", Some(74990), None),
|
||||||
/// Allows using C-variadics.
|
/// Allows using C-variadics.
|
||||||
|
@ -51,6 +51,7 @@ use super::{InferCtxt, RegionVariableOrigin, SubregionOrigin, TypeTrace, ValuePa
|
|||||||
|
|
||||||
use crate::infer;
|
use crate::infer;
|
||||||
use crate::infer::error_reporting::nice_region_error::find_anon_type::find_anon_type;
|
use crate::infer::error_reporting::nice_region_error::find_anon_type::find_anon_type;
|
||||||
|
use crate::infer::ExpectedFound;
|
||||||
use crate::traits::error_reporting::report_object_safety_error;
|
use crate::traits::error_reporting::report_object_safety_error;
|
||||||
use crate::traits::{
|
use crate::traits::{
|
||||||
IfExpressionCause, MatchExpressionArmCause, ObligationCause, ObligationCauseCode,
|
IfExpressionCause, MatchExpressionArmCause, ObligationCause, ObligationCauseCode,
|
||||||
@ -1653,8 +1654,114 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
|
|||||||
),
|
),
|
||||||
Mismatch::Fixed(s) => (s.into(), s.into(), None),
|
Mismatch::Fixed(s) => (s.into(), s.into(), None),
|
||||||
};
|
};
|
||||||
match (&terr, expected == found) {
|
|
||||||
(TypeError::Sorts(values), extra) => {
|
enum Similar<'tcx> {
|
||||||
|
Adts { expected: ty::AdtDef<'tcx>, found: ty::AdtDef<'tcx> },
|
||||||
|
PrimitiveFound { expected: ty::AdtDef<'tcx>, found: Ty<'tcx> },
|
||||||
|
PrimitiveExpected { expected: Ty<'tcx>, found: ty::AdtDef<'tcx> },
|
||||||
|
}
|
||||||
|
|
||||||
|
let similarity = |ExpectedFound { expected, found }: ExpectedFound<Ty<'tcx>>| {
|
||||||
|
if let ty::Adt(expected, _) = expected.kind() && let Some(primitive) = found.primitive_symbol() {
|
||||||
|
let path = self.tcx.def_path(expected.did()).data;
|
||||||
|
let name = path.last().unwrap().data.get_opt_name();
|
||||||
|
if name == Some(primitive) {
|
||||||
|
return Some(Similar::PrimitiveFound { expected: *expected, found });
|
||||||
|
}
|
||||||
|
} else if let Some(primitive) = expected.primitive_symbol() && let ty::Adt(found, _) = found.kind() {
|
||||||
|
let path = self.tcx.def_path(found.did()).data;
|
||||||
|
let name = path.last().unwrap().data.get_opt_name();
|
||||||
|
if name == Some(primitive) {
|
||||||
|
return Some(Similar::PrimitiveExpected { expected, found: *found });
|
||||||
|
}
|
||||||
|
} else if let ty::Adt(expected, _) = expected.kind() && let ty::Adt(found, _) = found.kind() {
|
||||||
|
if !expected.did().is_local() && expected.did().krate == found.did().krate {
|
||||||
|
// Most likely types from different versions of the same crate
|
||||||
|
// are in play, in which case this message isn't so helpful.
|
||||||
|
// A "perhaps two different versions..." error is already emitted for that.
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
let f_path = self.tcx.def_path(found.did()).data;
|
||||||
|
let e_path = self.tcx.def_path(expected.did()).data;
|
||||||
|
|
||||||
|
if let (Some(e_last), Some(f_last)) = (e_path.last(), f_path.last()) && e_last == f_last {
|
||||||
|
return Some(Similar::Adts{expected: *expected, found: *found});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
None
|
||||||
|
};
|
||||||
|
|
||||||
|
match terr {
|
||||||
|
// If two types mismatch but have similar names, mention that specifically.
|
||||||
|
TypeError::Sorts(values) if let Some(s) = similarity(values) => {
|
||||||
|
let diagnose_primitive =
|
||||||
|
|prim: Ty<'tcx>,
|
||||||
|
shadow: Ty<'tcx>,
|
||||||
|
defid: DefId,
|
||||||
|
diagnostic: &mut Diagnostic| {
|
||||||
|
let name = shadow.sort_string(self.tcx);
|
||||||
|
diagnostic.note(format!(
|
||||||
|
"{prim} and {name} have similar names, but are actually distinct types"
|
||||||
|
));
|
||||||
|
diagnostic
|
||||||
|
.note(format!("{prim} is a primitive defined by the language"));
|
||||||
|
let def_span = self.tcx.def_span(defid);
|
||||||
|
let msg = if defid.is_local() {
|
||||||
|
format!("{name} is defined in the current crate")
|
||||||
|
} else {
|
||||||
|
let crate_name = self.tcx.crate_name(defid.krate);
|
||||||
|
format!("{name} is defined in crate `{crate_name}")
|
||||||
|
};
|
||||||
|
diagnostic.span_note(def_span, msg);
|
||||||
|
};
|
||||||
|
|
||||||
|
let diagnose_adts =
|
||||||
|
|expected_adt : ty::AdtDef<'tcx>,
|
||||||
|
found_adt: ty::AdtDef<'tcx>,
|
||||||
|
diagnostic: &mut Diagnostic| {
|
||||||
|
let found_name = values.found.sort_string(self.tcx);
|
||||||
|
let expected_name = values.expected.sort_string(self.tcx);
|
||||||
|
|
||||||
|
let found_defid = found_adt.did();
|
||||||
|
let expected_defid = expected_adt.did();
|
||||||
|
|
||||||
|
diagnostic.note(format!("{found_name} and {expected_name} have similar names, but are actually distinct types"));
|
||||||
|
for (defid, name) in
|
||||||
|
[(found_defid, found_name), (expected_defid, expected_name)]
|
||||||
|
{
|
||||||
|
let def_span = self.tcx.def_span(defid);
|
||||||
|
|
||||||
|
let msg = if found_defid.is_local() && expected_defid.is_local() {
|
||||||
|
let module = self
|
||||||
|
.tcx
|
||||||
|
.parent_module_from_def_id(defid.expect_local())
|
||||||
|
.to_def_id();
|
||||||
|
let module_name = self.tcx.def_path(module).to_string_no_crate_verbose();
|
||||||
|
format!("{name} is defined in module `crate{module_name}` of the current crate")
|
||||||
|
} else if defid.is_local() {
|
||||||
|
format!("{name} is defined in the current crate")
|
||||||
|
} else {
|
||||||
|
let crate_name = self.tcx.crate_name(defid.krate);
|
||||||
|
format!("{name} is defined in crate `{crate_name}`")
|
||||||
|
};
|
||||||
|
diagnostic.span_note(def_span, msg);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
match s {
|
||||||
|
Similar::Adts{expected, found} => {
|
||||||
|
diagnose_adts(expected, found, diag)
|
||||||
|
}
|
||||||
|
Similar::PrimitiveFound{expected, found: prim} => {
|
||||||
|
diagnose_primitive(prim, values.expected, expected.did(), diag)
|
||||||
|
}
|
||||||
|
Similar::PrimitiveExpected{expected: prim, found} => {
|
||||||
|
diagnose_primitive(prim, values.found, found.did(), diag)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
TypeError::Sorts(values) => {
|
||||||
|
let extra = expected == found;
|
||||||
let sort_string = |ty: Ty<'tcx>| match (extra, ty.kind()) {
|
let sort_string = |ty: Ty<'tcx>| match (extra, ty.kind()) {
|
||||||
(true, ty::Opaque(def_id, _)) => {
|
(true, ty::Opaque(def_id, _)) => {
|
||||||
let sm = self.tcx.sess.source_map();
|
let sm = self.tcx.sess.source_map();
|
||||||
@ -1707,10 +1814,10 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
(TypeError::ObjectUnsafeCoercion(_), _) => {
|
TypeError::ObjectUnsafeCoercion(_) => {
|
||||||
diag.note_unsuccessful_coercion(found, expected);
|
diag.note_unsuccessful_coercion(found, expected);
|
||||||
}
|
}
|
||||||
(_, _) => {
|
_ => {
|
||||||
debug!(
|
debug!(
|
||||||
"note_type_err: exp_found={:?}, expected={:?} found={:?}",
|
"note_type_err: exp_found={:?}, expected={:?} found={:?}",
|
||||||
exp_found, expected, found
|
exp_found, expected, found
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
#![cfg_attr(bootstrap, feature(label_break_value))]
|
#![cfg_attr(bootstrap, feature(label_break_value))]
|
||||||
#![feature(let_chains)]
|
#![feature(let_chains)]
|
||||||
#![cfg_attr(bootstrap, feature(let_else))]
|
#![cfg_attr(bootstrap, feature(let_else))]
|
||||||
|
#![feature(if_let_guard)]
|
||||||
#![feature(min_specialization)]
|
#![feature(min_specialization)]
|
||||||
#![feature(never_type)]
|
#![feature(never_type)]
|
||||||
#![feature(try_blocks)]
|
#![feature(try_blocks)]
|
||||||
|
@ -19,7 +19,7 @@ use rustc_hir as hir;
|
|||||||
use rustc_hir::def_id::DefId;
|
use rustc_hir::def_id::DefId;
|
||||||
use rustc_index::vec::Idx;
|
use rustc_index::vec::Idx;
|
||||||
use rustc_macros::HashStable;
|
use rustc_macros::HashStable;
|
||||||
use rustc_span::symbol::{kw, Symbol};
|
use rustc_span::symbol::{kw, sym, Symbol};
|
||||||
use rustc_target::abi::VariantIdx;
|
use rustc_target::abi::VariantIdx;
|
||||||
use rustc_target::spec::abi;
|
use rustc_target::spec::abi;
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
@ -2207,6 +2207,35 @@ impl<'tcx> Ty<'tcx> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If `self` is a primitive, return its [`Symbol`].
|
||||||
|
pub fn primitive_symbol(self) -> Option<Symbol> {
|
||||||
|
match self.kind() {
|
||||||
|
ty::Bool => Some(sym::bool),
|
||||||
|
ty::Char => Some(sym::char),
|
||||||
|
ty::Float(f) => match f {
|
||||||
|
ty::FloatTy::F32 => Some(sym::f32),
|
||||||
|
ty::FloatTy::F64 => Some(sym::f64),
|
||||||
|
},
|
||||||
|
ty::Int(f) => match f {
|
||||||
|
ty::IntTy::Isize => Some(sym::isize),
|
||||||
|
ty::IntTy::I8 => Some(sym::i8),
|
||||||
|
ty::IntTy::I16 => Some(sym::i16),
|
||||||
|
ty::IntTy::I32 => Some(sym::i32),
|
||||||
|
ty::IntTy::I64 => Some(sym::i64),
|
||||||
|
ty::IntTy::I128 => Some(sym::i128),
|
||||||
|
},
|
||||||
|
ty::Uint(f) => match f {
|
||||||
|
ty::UintTy::Usize => Some(sym::usize),
|
||||||
|
ty::UintTy::U8 => Some(sym::u8),
|
||||||
|
ty::UintTy::U16 => Some(sym::u16),
|
||||||
|
ty::UintTy::U32 => Some(sym::u32),
|
||||||
|
ty::UintTy::U64 => Some(sym::u64),
|
||||||
|
ty::UintTy::U128 => Some(sym::u128),
|
||||||
|
},
|
||||||
|
_ => None,
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Extra information about why we ended up with a particular variance.
|
/// Extra information about why we ended up with a particular variance.
|
||||||
|
@ -658,3 +658,10 @@ pub struct CollapseDebuginfo {
|
|||||||
#[label]
|
#[label]
|
||||||
pub defn_span: Span,
|
pub defn_span: Span,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(LintDiagnostic)]
|
||||||
|
#[diag(passes::deprecated_annotation_has_no_effect)]
|
||||||
|
pub struct DeprecatedAnnotationHasNoEffect {
|
||||||
|
#[suggestion(applicability = "machine-applicable", code = "")]
|
||||||
|
pub span: Span,
|
||||||
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
//! A pass that annotates every item and method with its stability level,
|
//! A pass that annotates every item and method with its stability level,
|
||||||
//! propagating default levels lexically from parent to children ast nodes.
|
//! propagating default levels lexically from parent to children ast nodes.
|
||||||
|
|
||||||
|
use crate::errors;
|
||||||
use rustc_attr::{
|
use rustc_attr::{
|
||||||
self as attr, rust_version_symbol, ConstStability, Stability, StabilityLevel, Unstable,
|
self as attr, rust_version_symbol, ConstStability, Stability, StabilityLevel, Unstable,
|
||||||
UnstableReason, VERSION_PLACEHOLDER,
|
UnstableReason, VERSION_PLACEHOLDER,
|
||||||
@ -122,16 +123,12 @@ impl<'a, 'tcx> Annotator<'a, 'tcx> {
|
|||||||
|
|
||||||
if kind == AnnotationKind::Prohibited || kind == AnnotationKind::DeprecationProhibited {
|
if kind == AnnotationKind::Prohibited || kind == AnnotationKind::DeprecationProhibited {
|
||||||
let hir_id = self.tcx.hir().local_def_id_to_hir_id(def_id);
|
let hir_id = self.tcx.hir().local_def_id_to_hir_id(def_id);
|
||||||
self.tcx.struct_span_lint_hir(USELESS_DEPRECATED, hir_id, *span, |lint| {
|
self.tcx.emit_spanned_lint(
|
||||||
lint.build("this `#[deprecated]` annotation has no effect")
|
USELESS_DEPRECATED,
|
||||||
.span_suggestion_short(
|
hir_id,
|
||||||
*span,
|
*span,
|
||||||
"remove the unnecessary deprecation attribute",
|
errors::DeprecatedAnnotationHasNoEffect { span: *span },
|
||||||
"",
|
);
|
||||||
rustc_errors::Applicability::MachineApplicable,
|
|
||||||
)
|
|
||||||
.emit();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// `Deprecation` is just two pointers, no need to intern it
|
// `Deprecation` is just two pointers, no need to intern it
|
||||||
|
@ -396,6 +396,7 @@ symbols! {
|
|||||||
assume_init,
|
assume_init,
|
||||||
async_await,
|
async_await,
|
||||||
async_closure,
|
async_closure,
|
||||||
|
async_fn_in_trait,
|
||||||
atomic,
|
atomic,
|
||||||
atomic_mod,
|
atomic_mod,
|
||||||
atomics,
|
atomics,
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
use crate::abi::Endian;
|
use crate::abi::Endian;
|
||||||
use crate::spec::{LinkerFlavor, RelroLevel, Target, TargetOptions};
|
use crate::spec::{LinkerFlavor, Target, TargetOptions};
|
||||||
|
|
||||||
pub fn target() -> Target {
|
pub fn target() -> Target {
|
||||||
let mut base = super::linux_gnu_base::opts();
|
let mut base = super::linux_gnu_base::opts();
|
||||||
@ -7,10 +7,6 @@ pub fn target() -> Target {
|
|||||||
base.add_pre_link_args(LinkerFlavor::Gcc, &["-m64"]);
|
base.add_pre_link_args(LinkerFlavor::Gcc, &["-m64"]);
|
||||||
base.max_atomic_width = Some(64);
|
base.max_atomic_width = Some(64);
|
||||||
|
|
||||||
// ld.so in at least RHEL6 on ppc64 has a bug related to BIND_NOW, so only enable partial RELRO
|
|
||||||
// for now. https://github.com/rust-lang/rust/pull/43170#issuecomment-315411474
|
|
||||||
base.relro_level = RelroLevel::Partial;
|
|
||||||
|
|
||||||
Target {
|
Target {
|
||||||
llvm_target: "powerpc64-unknown-linux-gnu".into(),
|
llvm_target: "powerpc64-unknown-linux-gnu".into(),
|
||||||
pointer_width: 64,
|
pointer_width: 64,
|
||||||
|
@ -717,27 +717,13 @@ impl<'cx, 'tcx> Resolver<'cx, 'tcx> {
|
|||||||
Resolver { tcx: fcx.tcx, infcx: fcx, span, body, replaced_with_error: false }
|
Resolver { tcx: fcx.tcx, infcx: fcx, span, body, replaced_with_error: false }
|
||||||
}
|
}
|
||||||
|
|
||||||
fn report_type_error(&self, t: Ty<'tcx>) {
|
fn report_error(&self, p: impl Into<ty::GenericArg<'tcx>>) {
|
||||||
if !self.tcx.sess.has_errors().is_some() {
|
if !self.tcx.sess.has_errors().is_some() {
|
||||||
self.infcx
|
self.infcx
|
||||||
.emit_inference_failure_err(
|
.emit_inference_failure_err(
|
||||||
Some(self.body.id()),
|
Some(self.body.id()),
|
||||||
self.span.to_span(self.tcx),
|
self.span.to_span(self.tcx),
|
||||||
t.into(),
|
p.into(),
|
||||||
E0282,
|
|
||||||
false,
|
|
||||||
)
|
|
||||||
.emit();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn report_const_error(&self, c: ty::Const<'tcx>) {
|
|
||||||
if self.tcx.sess.has_errors().is_none() {
|
|
||||||
self.infcx
|
|
||||||
.emit_inference_failure_err(
|
|
||||||
Some(self.body.id()),
|
|
||||||
self.span.to_span(self.tcx),
|
|
||||||
c.into(),
|
|
||||||
E0282,
|
E0282,
|
||||||
false,
|
false,
|
||||||
)
|
)
|
||||||
@ -782,7 +768,7 @@ impl<'cx, 'tcx> TypeFolder<'tcx> for Resolver<'cx, 'tcx> {
|
|||||||
}
|
}
|
||||||
Err(_) => {
|
Err(_) => {
|
||||||
debug!("Resolver::fold_ty: input type `{:?}` not fully resolvable", t);
|
debug!("Resolver::fold_ty: input type `{:?}` not fully resolvable", t);
|
||||||
self.report_type_error(t);
|
self.report_error(t);
|
||||||
self.replaced_with_error = true;
|
self.replaced_with_error = true;
|
||||||
self.tcx().ty_error()
|
self.tcx().ty_error()
|
||||||
}
|
}
|
||||||
@ -799,7 +785,7 @@ impl<'cx, 'tcx> TypeFolder<'tcx> for Resolver<'cx, 'tcx> {
|
|||||||
Ok(ct) => self.tcx.erase_regions(ct),
|
Ok(ct) => self.tcx.erase_regions(ct),
|
||||||
Err(_) => {
|
Err(_) => {
|
||||||
debug!("Resolver::fold_const: input const `{:?}` not fully resolvable", ct);
|
debug!("Resolver::fold_const: input const `{:?}` not fully resolvable", ct);
|
||||||
self.report_const_error(ct);
|
self.report_error(ct);
|
||||||
self.replaced_with_error = true;
|
self.replaced_with_error = true;
|
||||||
self.tcx().const_error(ct.ty())
|
self.tcx().const_error(ct.ty())
|
||||||
}
|
}
|
||||||
|
@ -86,29 +86,23 @@ impl Step for JsonDocs {
|
|||||||
|
|
||||||
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
|
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
|
||||||
let default = run.builder.config.docs;
|
let default = run.builder.config.docs;
|
||||||
run.alias("rust-json-docs").default_condition(default)
|
run.alias("rust-docs-json").default_condition(default)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn make_run(run: RunConfig<'_>) {
|
fn make_run(run: RunConfig<'_>) {
|
||||||
run.builder.ensure(JsonDocs { host: run.target });
|
run.builder.ensure(JsonDocs { host: run.target });
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Builds the `rust-json-docs` installer component.
|
/// Builds the `rust-docs-json` installer component.
|
||||||
fn run(self, builder: &Builder<'_>) -> Option<GeneratedTarball> {
|
fn run(self, builder: &Builder<'_>) -> Option<GeneratedTarball> {
|
||||||
// This prevents JSON docs from being built for "dist" or "install"
|
|
||||||
// on the stable/beta channels. The JSON format is not stable yet and
|
|
||||||
// should not be included in stable/beta toolchains.
|
|
||||||
if !builder.build.unstable_features() {
|
|
||||||
return None;
|
|
||||||
}
|
|
||||||
|
|
||||||
let host = self.host;
|
let host = self.host;
|
||||||
builder.ensure(crate::doc::JsonStd { stage: builder.top_stage, target: host });
|
builder.ensure(crate::doc::JsonStd { stage: builder.top_stage, target: host });
|
||||||
|
|
||||||
let dest = "share/doc/rust/json";
|
let dest = "share/doc/rust/json";
|
||||||
|
|
||||||
let mut tarball = Tarball::new(builder, "rust-json-docs", &host.triple);
|
let mut tarball = Tarball::new(builder, "rust-docs-json", &host.triple);
|
||||||
tarball.set_product_name("Rust Documentation In JSON Format");
|
tarball.set_product_name("Rust Documentation In JSON Format");
|
||||||
|
tarball.is_preview(true);
|
||||||
tarball.add_bulk_dir(&builder.json_doc_out(host), dest);
|
tarball.add_bulk_dir(&builder.json_doc_out(host), dest);
|
||||||
Some(tarball.generate())
|
Some(tarball.generate())
|
||||||
}
|
}
|
||||||
|
@ -666,7 +666,6 @@ h2.location a {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.method > .code-header, .trait-impl > .code-header {
|
.method > .code-header, .trait-impl > .code-header {
|
||||||
max-width: calc(100% - 41px);
|
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@ assert-position: (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// Checking on very small mobile. The `i` should be on its own line.
|
// Checking on very small mobile. The `i` should be on its own line.
|
||||||
size: (410, 600)
|
size: (365, 600)
|
||||||
compare-elements-position-false: (
|
compare-elements-position-false: (
|
||||||
"//*[@id='method.create_an_iterator_from_read']//a[text()='NotableStructWithLongName']",
|
"//*[@id='method.create_an_iterator_from_read']//a[text()='NotableStructWithLongName']",
|
||||||
"//*[@id='method.create_an_iterator_from_read']//*[@class='notable-traits']",
|
"//*[@id='method.create_an_iterator_from_read']//*[@class='notable-traits']",
|
||||||
|
@ -9,7 +9,7 @@ LL | async fn foo() {}
|
|||||||
= note: `async` trait functions are not currently supported
|
= note: `async` trait functions are not currently supported
|
||||||
= note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
|
= note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
|
||||||
= note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
|
= note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
|
||||||
= help: add `#![feature(return_position_impl_trait_in_trait)]` to the crate attributes to enable
|
= help: add `#![feature(async_fn_in_trait)]` to the crate attributes to enable
|
||||||
|
|
||||||
error[E0706]: functions in traits cannot be declared `async`
|
error[E0706]: functions in traits cannot be declared `async`
|
||||||
--> $DIR/async-trait-fn.rs:5:5
|
--> $DIR/async-trait-fn.rs:5:5
|
||||||
@ -22,7 +22,7 @@ LL | async fn bar(&self) {}
|
|||||||
= note: `async` trait functions are not currently supported
|
= note: `async` trait functions are not currently supported
|
||||||
= note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
|
= note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
|
||||||
= note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
|
= note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
|
||||||
= help: add `#![feature(return_position_impl_trait_in_trait)]` to the crate attributes to enable
|
= help: add `#![feature(async_fn_in_trait)]` to the crate attributes to enable
|
||||||
|
|
||||||
error[E0706]: functions in traits cannot be declared `async`
|
error[E0706]: functions in traits cannot be declared `async`
|
||||||
--> $DIR/async-trait-fn.rs:7:5
|
--> $DIR/async-trait-fn.rs:7:5
|
||||||
@ -35,7 +35,7 @@ LL | async fn baz() {
|
|||||||
= note: `async` trait functions are not currently supported
|
= note: `async` trait functions are not currently supported
|
||||||
= note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
|
= note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
|
||||||
= note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
|
= note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
|
||||||
= help: add `#![feature(return_position_impl_trait_in_trait)]` to the crate attributes to enable
|
= help: add `#![feature(async_fn_in_trait)]` to the crate attributes to enable
|
||||||
|
|
||||||
error[E0308]: mismatched types
|
error[E0308]: mismatched types
|
||||||
--> $DIR/async-trait-fn.rs:3:20
|
--> $DIR/async-trait-fn.rs:3:20
|
||||||
|
@ -90,7 +90,7 @@ LL | async fn foo() {}
|
|||||||
= note: `async` trait functions are not currently supported
|
= note: `async` trait functions are not currently supported
|
||||||
= note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
|
= note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
|
||||||
= note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
|
= note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
|
||||||
= help: add `#![feature(return_position_impl_trait_in_trait)]` to the crate attributes to enable
|
= help: add `#![feature(async_fn_in_trait)]` to the crate attributes to enable
|
||||||
|
|
||||||
error[E0308]: mismatched types
|
error[E0308]: mismatched types
|
||||||
--> $DIR/edition-deny-async-fns-2015.rs:18:20
|
--> $DIR/edition-deny-async-fns-2015.rs:18:20
|
||||||
|
25
src/test/ui/async-await/feature-gate-async_fn_in_trait.rs
Normal file
25
src/test/ui/async-await/feature-gate-async_fn_in_trait.rs
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
// edition:2021
|
||||||
|
|
||||||
|
// RPITIT is not enough to allow use of async functions
|
||||||
|
#![allow(incomplete_features)]
|
||||||
|
#![feature(return_position_impl_trait_in_trait)]
|
||||||
|
|
||||||
|
trait T {
|
||||||
|
async fn foo(); //~ ERROR functions in traits cannot be declared `async`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Both return_position_impl_trait_in_trait and async_fn_in_trait are required for this (see also
|
||||||
|
// feature-gate-return_position_impl_trait_in_trait.rs)
|
||||||
|
trait T2 {
|
||||||
|
async fn foo() -> impl Sized; //~ ERROR functions in traits cannot be declared `async`
|
||||||
|
}
|
||||||
|
|
||||||
|
trait T3 {
|
||||||
|
fn foo() -> impl std::future::Future<Output = ()>;
|
||||||
|
}
|
||||||
|
|
||||||
|
impl T3 for () {
|
||||||
|
async fn foo() {} //~ ERROR functions in traits cannot be declared `async`
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {}
|
@ -0,0 +1,42 @@
|
|||||||
|
error[E0706]: functions in traits cannot be declared `async`
|
||||||
|
--> $DIR/feature-gate-async_fn_in_trait.rs:8:5
|
||||||
|
|
|
||||||
|
LL | async fn foo();
|
||||||
|
| -----^^^^^^^^^^
|
||||||
|
| |
|
||||||
|
| `async` because of this
|
||||||
|
|
|
||||||
|
= note: `async` trait functions are not currently supported
|
||||||
|
= note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
|
||||||
|
= note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
|
||||||
|
= help: add `#![feature(async_fn_in_trait)]` to the crate attributes to enable
|
||||||
|
|
||||||
|
error[E0706]: functions in traits cannot be declared `async`
|
||||||
|
--> $DIR/feature-gate-async_fn_in_trait.rs:14:5
|
||||||
|
|
|
||||||
|
LL | async fn foo() -> impl Sized;
|
||||||
|
| -----^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
| |
|
||||||
|
| `async` because of this
|
||||||
|
|
|
||||||
|
= note: `async` trait functions are not currently supported
|
||||||
|
= note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
|
||||||
|
= note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
|
||||||
|
= help: add `#![feature(async_fn_in_trait)]` to the crate attributes to enable
|
||||||
|
|
||||||
|
error[E0706]: functions in traits cannot be declared `async`
|
||||||
|
--> $DIR/feature-gate-async_fn_in_trait.rs:22:5
|
||||||
|
|
|
||||||
|
LL | async fn foo() {}
|
||||||
|
| -----^^^^^^^^^
|
||||||
|
| |
|
||||||
|
| `async` because of this
|
||||||
|
|
|
||||||
|
= note: `async` trait functions are not currently supported
|
||||||
|
= note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
|
||||||
|
= note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
|
||||||
|
= help: add `#![feature(async_fn_in_trait)]` to the crate attributes to enable
|
||||||
|
|
||||||
|
error: aborting due to 3 previous errors
|
||||||
|
|
||||||
|
For more information about this error, try `rustc --explain E0706`.
|
@ -9,7 +9,7 @@ LL | async fn new() -> [u8; _];
|
|||||||
= note: `async` trait functions are not currently supported
|
= note: `async` trait functions are not currently supported
|
||||||
= note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
|
= note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
|
||||||
= note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
|
= note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
|
||||||
= help: add `#![feature(return_position_impl_trait_in_trait)]` to the crate attributes to enable
|
= help: add `#![feature(async_fn_in_trait)]` to the crate attributes to enable
|
||||||
|
|
||||||
error: in expressions, `_` can only be used on the left-hand side of an assignment
|
error: in expressions, `_` can only be used on the left-hand side of an assignment
|
||||||
--> $DIR/issue-95307.rs:7:28
|
--> $DIR/issue-95307.rs:7:28
|
||||||
|
@ -1,5 +1,18 @@
|
|||||||
|
// edition:2021
|
||||||
|
|
||||||
|
// async_fn_in_trait is not enough to allow use of RPITIT
|
||||||
|
#![allow(incomplete_features)]
|
||||||
|
#![feature(async_fn_in_trait)]
|
||||||
|
|
||||||
trait Foo {
|
trait Foo {
|
||||||
fn bar() -> impl Sized; //~ ERROR `impl Trait` only allowed in function and inherent method return types, not in trait method return
|
fn bar() -> impl Sized; //~ ERROR `impl Trait` only allowed in function and inherent method return types, not in trait method return
|
||||||
|
fn baz() -> Box<impl std::fmt::Display>; //~ ERROR `impl Trait` only allowed in function and inherent method return types, not in trait method return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Both return_position_impl_trait_in_trait and async_fn_in_trait are required for this (see also
|
||||||
|
// feature-gate-async_fn_in_trait.rs)
|
||||||
|
trait AsyncFoo {
|
||||||
|
async fn bar() -> impl Sized; //~ ERROR `impl Trait` only allowed in function and inherent method return types, not in trait method return
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {}
|
fn main() {}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in trait method return
|
error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in trait method return
|
||||||
--> $DIR/feature-gate-return_position_impl_trait_in_trait.rs:2:17
|
--> $DIR/feature-gate-return_position_impl_trait_in_trait.rs:8:17
|
||||||
|
|
|
|
||||||
LL | fn bar() -> impl Sized;
|
LL | fn bar() -> impl Sized;
|
||||||
| ^^^^^^^^^^
|
| ^^^^^^^^^^
|
||||||
@ -7,6 +7,24 @@ LL | fn bar() -> impl Sized;
|
|||||||
= note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
|
= note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
|
||||||
= help: add `#![feature(return_position_impl_trait_in_trait)]` to the crate attributes to enable
|
= help: add `#![feature(return_position_impl_trait_in_trait)]` to the crate attributes to enable
|
||||||
|
|
||||||
error: aborting due to previous error
|
error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in trait method return
|
||||||
|
--> $DIR/feature-gate-return_position_impl_trait_in_trait.rs:9:21
|
||||||
|
|
|
||||||
|
LL | fn baz() -> Box<impl std::fmt::Display>;
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
||||||
|
= note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
|
||||||
|
= help: add `#![feature(return_position_impl_trait_in_trait)]` to the crate attributes to enable
|
||||||
|
|
||||||
|
error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in trait method return
|
||||||
|
--> $DIR/feature-gate-return_position_impl_trait_in_trait.rs:15:23
|
||||||
|
|
|
||||||
|
LL | async fn bar() -> impl Sized;
|
||||||
|
| ^^^^^^^^^^
|
||||||
|
|
|
||||||
|
= note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
|
||||||
|
= help: add `#![feature(return_position_impl_trait_in_trait)]` to the crate attributes to enable
|
||||||
|
|
||||||
|
error: aborting due to 3 previous errors
|
||||||
|
|
||||||
For more information about this error, try `rustc --explain E0562`.
|
For more information about this error, try `rustc --explain E0562`.
|
||||||
|
@ -5,6 +5,18 @@ LL | fn bar(x: x::Foo) -> y::Foo {
|
|||||||
| ------ expected `y::Foo` because of return type
|
| ------ expected `y::Foo` because of return type
|
||||||
LL | return x;
|
LL | return x;
|
||||||
| ^ expected enum `y::Foo`, found enum `x::Foo`
|
| ^ expected enum `y::Foo`, found enum `x::Foo`
|
||||||
|
|
|
||||||
|
= note: enum `x::Foo` and enum `y::Foo` have similar names, but are actually distinct types
|
||||||
|
note: enum `x::Foo` is defined in module `crate::x` of the current crate
|
||||||
|
--> $DIR/fully-qualified-type-name2.rs:4:5
|
||||||
|
|
|
||||||
|
LL | pub enum Foo { }
|
||||||
|
| ^^^^^^^^^^^^
|
||||||
|
note: enum `y::Foo` is defined in module `crate::y` of the current crate
|
||||||
|
--> $DIR/fully-qualified-type-name2.rs:8:5
|
||||||
|
|
|
||||||
|
LL | pub enum Foo { }
|
||||||
|
| ^^^^^^^^^^^^
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
// See issue #100696.
|
// See issue #100696.
|
||||||
// run-fail
|
// run-fail
|
||||||
// check-run-results
|
// check-run-results
|
||||||
|
// exec-env:RUST_BACKTRACE=0
|
||||||
fn main() {
|
fn main() {
|
||||||
&""[1..];
|
&""[1..];
|
||||||
}
|
}
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
thread 'main' panicked at 'byte index 1 is out of bounds of ``', $DIR/const-eval-select-backtrace-std.rs:5:6
|
thread 'main' panicked at 'byte index 1 is out of bounds of ``', $DIR/const-eval-select-backtrace-std.rs:6:6
|
||||||
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
|
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
// See issue #100696.
|
// See issue #100696.
|
||||||
// run-fail
|
// run-fail
|
||||||
// check-run-results
|
// check-run-results
|
||||||
|
// exec-env:RUST_BACKTRACE=0
|
||||||
|
|
||||||
#[track_caller]
|
#[track_caller]
|
||||||
fn uhoh() {
|
fn uhoh() {
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
thread 'main' panicked at 'Aaah!', $DIR/const-eval-select-backtrace.rs:16:9
|
thread 'main' panicked at 'Aaah!', $DIR/const-eval-select-backtrace.rs:17:9
|
||||||
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
|
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
|
||||||
|
18
src/test/ui/mismatched_types/show_module.rs
Normal file
18
src/test/ui/mismatched_types/show_module.rs
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
pub mod blah {
|
||||||
|
pub mod baz {
|
||||||
|
pub struct Foo;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub mod meh {
|
||||||
|
pub struct Foo;
|
||||||
|
}
|
||||||
|
|
||||||
|
pub type Foo = blah::baz::Foo;
|
||||||
|
|
||||||
|
fn foo() -> Foo {
|
||||||
|
meh::Foo
|
||||||
|
//~^ ERROR mismatched types [E0308]
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {}
|
23
src/test/ui/mismatched_types/show_module.stderr
Normal file
23
src/test/ui/mismatched_types/show_module.stderr
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
error[E0308]: mismatched types
|
||||||
|
--> $DIR/show_module.rs:14:5
|
||||||
|
|
|
||||||
|
LL | fn foo() -> Foo {
|
||||||
|
| --- expected `baz::Foo` because of return type
|
||||||
|
LL | meh::Foo
|
||||||
|
| ^^^^^^^^ expected struct `baz::Foo`, found struct `meh::Foo`
|
||||||
|
|
|
||||||
|
= note: struct `meh::Foo` and struct `baz::Foo` have similar names, but are actually distinct types
|
||||||
|
note: struct `meh::Foo` is defined in module `crate::meh` of the current crate
|
||||||
|
--> $DIR/show_module.rs:8:5
|
||||||
|
|
|
||||||
|
LL | pub struct Foo;
|
||||||
|
| ^^^^^^^^^^^^^^
|
||||||
|
note: struct `baz::Foo` is defined in module `crate::blah::baz` of the current crate
|
||||||
|
--> $DIR/show_module.rs:3:9
|
||||||
|
|
|
||||||
|
LL | pub struct Foo;
|
||||||
|
| ^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
For more information about this error, try `rustc --explain E0308`.
|
11
src/test/ui/mismatched_types/similar_paths.rs
Normal file
11
src/test/ui/mismatched_types/similar_paths.rs
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
enum Option<T> {
|
||||||
|
Some(T),
|
||||||
|
None,
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn foo() -> Option<u8> {
|
||||||
|
Some(42_u8)
|
||||||
|
//~^ ERROR mismatched types [E0308]
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {}
|
23
src/test/ui/mismatched_types/similar_paths.stderr
Normal file
23
src/test/ui/mismatched_types/similar_paths.stderr
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
error[E0308]: mismatched types
|
||||||
|
--> $DIR/similar_paths.rs:7:5
|
||||||
|
|
|
||||||
|
LL | pub fn foo() -> Option<u8> {
|
||||||
|
| ---------- expected `Option<u8>` because of return type
|
||||||
|
LL | Some(42_u8)
|
||||||
|
| ^^^^^^^^^^^ expected enum `Option`, found enum `std::option::Option`
|
||||||
|
|
|
||||||
|
= note: enum `std::option::Option` and enum `Option` have similar names, but are actually distinct types
|
||||||
|
note: enum `std::option::Option` is defined in crate `core`
|
||||||
|
--> $SRC_DIR/core/src/option.rs:LL:COL
|
||||||
|
|
|
||||||
|
LL | pub enum Option<T> {
|
||||||
|
| ^^^^^^^^^^^^^^^^^^
|
||||||
|
note: enum `Option` is defined in the current crate
|
||||||
|
--> $DIR/similar_paths.rs:1:1
|
||||||
|
|
|
||||||
|
LL | enum Option<T> {
|
||||||
|
| ^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
For more information about this error, try `rustc --explain E0308`.
|
10
src/test/ui/mismatched_types/similar_paths_primitive.rs
Normal file
10
src/test/ui/mismatched_types/similar_paths_primitive.rs
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
#![allow(non_camel_case_types)]
|
||||||
|
|
||||||
|
struct bool;
|
||||||
|
|
||||||
|
fn foo(_: bool) {}
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
foo(true);
|
||||||
|
//~^ ERROR mismatched types [E0308]
|
||||||
|
}
|
24
src/test/ui/mismatched_types/similar_paths_primitive.stderr
Normal file
24
src/test/ui/mismatched_types/similar_paths_primitive.stderr
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
error[E0308]: mismatched types
|
||||||
|
--> $DIR/similar_paths_primitive.rs:8:9
|
||||||
|
|
|
||||||
|
LL | foo(true);
|
||||||
|
| --- ^^^^ expected struct `bool`, found `bool`
|
||||||
|
| |
|
||||||
|
| arguments to this function are incorrect
|
||||||
|
|
|
||||||
|
= note: bool and struct `bool` have similar names, but are actually distinct types
|
||||||
|
= note: bool is a primitive defined by the language
|
||||||
|
note: struct `bool` is defined in the current crate
|
||||||
|
--> $DIR/similar_paths_primitive.rs:3:1
|
||||||
|
|
|
||||||
|
LL | struct bool;
|
||||||
|
| ^^^^^^^^^^^
|
||||||
|
note: function defined here
|
||||||
|
--> $DIR/similar_paths_primitive.rs:5:4
|
||||||
|
|
|
||||||
|
LL | fn foo(_: bool) {}
|
||||||
|
| ^^^ -------
|
||||||
|
|
||||||
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
For more information about this error, try `rustc --explain E0308`.
|
@ -147,7 +147,7 @@ LL | async fn ft1();
|
|||||||
= note: `async` trait functions are not currently supported
|
= note: `async` trait functions are not currently supported
|
||||||
= note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
|
= note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
|
||||||
= note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
|
= note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
|
||||||
= help: add `#![feature(return_position_impl_trait_in_trait)]` to the crate attributes to enable
|
= help: add `#![feature(async_fn_in_trait)]` to the crate attributes to enable
|
||||||
|
|
||||||
error[E0706]: functions in traits cannot be declared `async`
|
error[E0706]: functions in traits cannot be declared `async`
|
||||||
--> $DIR/fn-header-semantic-fail.rs:21:9
|
--> $DIR/fn-header-semantic-fail.rs:21:9
|
||||||
@ -160,7 +160,7 @@ LL | const async unsafe extern "C" fn ft5();
|
|||||||
= note: `async` trait functions are not currently supported
|
= note: `async` trait functions are not currently supported
|
||||||
= note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
|
= note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
|
||||||
= note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
|
= note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
|
||||||
= help: add `#![feature(return_position_impl_trait_in_trait)]` to the crate attributes to enable
|
= help: add `#![feature(async_fn_in_trait)]` to the crate attributes to enable
|
||||||
|
|
||||||
error[E0706]: functions in traits cannot be declared `async`
|
error[E0706]: functions in traits cannot be declared `async`
|
||||||
--> $DIR/fn-header-semantic-fail.rs:29:9
|
--> $DIR/fn-header-semantic-fail.rs:29:9
|
||||||
@ -173,7 +173,7 @@ LL | async fn ft1() {}
|
|||||||
= note: `async` trait functions are not currently supported
|
= note: `async` trait functions are not currently supported
|
||||||
= note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
|
= note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
|
||||||
= note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
|
= note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
|
||||||
= help: add `#![feature(return_position_impl_trait_in_trait)]` to the crate attributes to enable
|
= help: add `#![feature(async_fn_in_trait)]` to the crate attributes to enable
|
||||||
|
|
||||||
error[E0706]: functions in traits cannot be declared `async`
|
error[E0706]: functions in traits cannot be declared `async`
|
||||||
--> $DIR/fn-header-semantic-fail.rs:33:9
|
--> $DIR/fn-header-semantic-fail.rs:33:9
|
||||||
@ -186,7 +186,7 @@ LL | const async unsafe extern "C" fn ft5() {}
|
|||||||
= note: `async` trait functions are not currently supported
|
= note: `async` trait functions are not currently supported
|
||||||
= note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
|
= note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
|
||||||
= note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
|
= note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
|
||||||
= help: add `#![feature(return_position_impl_trait_in_trait)]` to the crate attributes to enable
|
= help: add `#![feature(async_fn_in_trait)]` to the crate attributes to enable
|
||||||
|
|
||||||
error[E0391]: cycle detected when computing type of `main::ff5::{opaque#0}`
|
error[E0391]: cycle detected when computing type of `main::ff5::{opaque#0}`
|
||||||
--> $DIR/fn-header-semantic-fail.rs:12:44
|
--> $DIR/fn-header-semantic-fail.rs:12:44
|
||||||
|
@ -33,7 +33,7 @@ LL | async fn associated();
|
|||||||
= note: `async` trait functions are not currently supported
|
= note: `async` trait functions are not currently supported
|
||||||
= note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
|
= note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
|
||||||
= note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
|
= note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
|
||||||
= help: add `#![feature(return_position_impl_trait_in_trait)]` to the crate attributes to enable
|
= help: add `#![feature(async_fn_in_trait)]` to the crate attributes to enable
|
||||||
|
|
||||||
error[E0706]: functions in traits cannot be declared `async`
|
error[E0706]: functions in traits cannot be declared `async`
|
||||||
--> $DIR/issue-70736-async-fn-no-body-def-collector.rs:15:5
|
--> $DIR/issue-70736-async-fn-no-body-def-collector.rs:15:5
|
||||||
@ -46,7 +46,7 @@ LL | async fn associated();
|
|||||||
= note: `async` trait functions are not currently supported
|
= note: `async` trait functions are not currently supported
|
||||||
= note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
|
= note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
|
||||||
= note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
|
= note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
|
||||||
= help: add `#![feature(return_position_impl_trait_in_trait)]` to the crate attributes to enable
|
= help: add `#![feature(async_fn_in_trait)]` to the crate attributes to enable
|
||||||
|
|
||||||
error: aborting due to 5 previous errors
|
error: aborting due to 5 previous errors
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ LL | trait C{async fn new(val: T) {}
|
|||||||
= note: `async` trait functions are not currently supported
|
= note: `async` trait functions are not currently supported
|
||||||
= note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
|
= note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
|
||||||
= note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
|
= note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
|
||||||
= help: add `#![feature(return_position_impl_trait_in_trait)]` to the crate attributes to enable
|
= help: add `#![feature(async_fn_in_trait)]` to the crate attributes to enable
|
||||||
|
|
||||||
warning: changes to closure capture in Rust 2021 will affect drop order
|
warning: changes to closure capture in Rust 2021 will affect drop order
|
||||||
--> $DIR/drop-location-span-error-rust-2021-incompatible-closure-captures-93117.rs:6:57
|
--> $DIR/drop-location-span-error-rust-2021-incompatible-closure-captures-93117.rs:6:57
|
||||||
|
@ -6,6 +6,17 @@ LL | a::try_foo(foo2);
|
|||||||
| |
|
| |
|
||||||
| arguments to this function are incorrect
|
| arguments to this function are incorrect
|
||||||
|
|
|
|
||||||
|
= note: struct `main::a::Foo` and struct `main::a::Foo` have similar names, but are actually distinct types
|
||||||
|
note: struct `main::a::Foo` is defined in crate `crate_a2`
|
||||||
|
--> $DIR/auxiliary/crate_a2.rs:1:1
|
||||||
|
|
|
||||||
|
LL | pub struct Foo;
|
||||||
|
| ^^^^^^^^^^^^^^
|
||||||
|
note: struct `main::a::Foo` is defined in crate `crate_a1`
|
||||||
|
--> $DIR/auxiliary/crate_a1.rs:1:1
|
||||||
|
|
|
||||||
|
LL | pub struct Foo;
|
||||||
|
| ^^^^^^^^^^^^^^
|
||||||
= note: perhaps two different versions of crate `crate_a1` are being used?
|
= note: perhaps two different versions of crate `crate_a1` are being used?
|
||||||
note: function defined here
|
note: function defined here
|
||||||
--> $DIR/auxiliary/crate_a1.rs:10:8
|
--> $DIR/auxiliary/crate_a1.rs:10:8
|
||||||
|
@ -184,7 +184,7 @@ static PKG_INSTALLERS: &[&str] = &["x86_64-apple-darwin", "aarch64-apple-darwin"
|
|||||||
|
|
||||||
static MINGW: &[&str] = &["i686-pc-windows-gnu", "x86_64-pc-windows-gnu"];
|
static MINGW: &[&str] = &["i686-pc-windows-gnu", "x86_64-pc-windows-gnu"];
|
||||||
|
|
||||||
static NIGHTLY_ONLY_COMPONENTS: &[&str] = &["miri-preview"];
|
static NIGHTLY_ONLY_COMPONENTS: &[&str] = &["miri-preview", "rust-docs-json-preview"];
|
||||||
|
|
||||||
macro_rules! t {
|
macro_rules! t {
|
||||||
($e:expr) => {
|
($e:expr) => {
|
||||||
@ -294,6 +294,7 @@ impl Builder {
|
|||||||
package!("rust-mingw", MINGW);
|
package!("rust-mingw", MINGW);
|
||||||
package!("rust-std", TARGETS);
|
package!("rust-std", TARGETS);
|
||||||
self.package("rust-docs", &mut manifest.pkg, HOSTS, DOCS_FALLBACK);
|
self.package("rust-docs", &mut manifest.pkg, HOSTS, DOCS_FALLBACK);
|
||||||
|
self.package("rust-docs-json-preview", &mut manifest.pkg, HOSTS, DOCS_FALLBACK);
|
||||||
package!("rust-src", &["*"]);
|
package!("rust-src", &["*"]);
|
||||||
package!("rls-preview", HOSTS);
|
package!("rls-preview", HOSTS);
|
||||||
package!("rust-analyzer-preview", HOSTS);
|
package!("rust-analyzer-preview", HOSTS);
|
||||||
@ -379,6 +380,7 @@ impl Builder {
|
|||||||
rename("rustfmt", "rustfmt-preview");
|
rename("rustfmt", "rustfmt-preview");
|
||||||
rename("clippy", "clippy-preview");
|
rename("clippy", "clippy-preview");
|
||||||
rename("miri", "miri-preview");
|
rename("miri", "miri-preview");
|
||||||
|
rename("rust-docs-json", "rust-docs-json-preview");
|
||||||
rename("rust-analyzer", "rust-analyzer-preview");
|
rename("rust-analyzer", "rust-analyzer-preview");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -435,6 +437,7 @@ impl Builder {
|
|||||||
host_component("rustfmt-preview"),
|
host_component("rustfmt-preview"),
|
||||||
host_component("llvm-tools-preview"),
|
host_component("llvm-tools-preview"),
|
||||||
host_component("rust-analysis"),
|
host_component("rust-analysis"),
|
||||||
|
host_component("rust-docs-json"),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
extensions.extend(
|
extensions.extend(
|
||||||
|
Loading…
Reference in New Issue
Block a user