mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-28 20:16:58 +03:00
Auto merge of #86559 - Dylan-DPC:rollup-aixg3q5, r=Dylan-DPC
Rollup of 6 pull requests Successful merges: - #86223 (Specify the kind of the item for E0121) - #86521 (Add comments around code where ordering is important due for panic-safety) - #86523 (Improvements to intra-doc link macro disambiguators) - #86542 (Line numbers aligned with content) - #86549 (Add destructuring example of E0508) - #86557 (Update books) Failed merges: - #86548 (Fix crate filter search reset) r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
@@ -39,3 +39,16 @@ fn main() {
|
||||
let _value = array[0].clone();
|
||||
}
|
||||
```
|
||||
|
||||
If you really want to move the value out, you can use a destructuring array
|
||||
pattern to move it:
|
||||
|
||||
```
|
||||
struct NonCopy;
|
||||
|
||||
fn main() {
|
||||
let array = [NonCopy; 1];
|
||||
// Destructuring the array
|
||||
let [_value] = array;
|
||||
}
|
||||
```
|
||||
|
||||
@@ -2815,6 +2815,27 @@ pub fn generics(&self) -> Option<&Generics<'_>> {
|
||||
_ => return None,
|
||||
})
|
||||
}
|
||||
|
||||
pub fn descr(&self) -> &'static str {
|
||||
match self {
|
||||
ItemKind::ExternCrate(..) => "extern crate",
|
||||
ItemKind::Use(..) => "`use` import",
|
||||
ItemKind::Static(..) => "static item",
|
||||
ItemKind::Const(..) => "constant item",
|
||||
ItemKind::Fn(..) => "function",
|
||||
ItemKind::Mod(..) => "module",
|
||||
ItemKind::ForeignMod { .. } => "extern block",
|
||||
ItemKind::GlobalAsm(..) => "global asm item",
|
||||
ItemKind::TyAlias(..) => "type alias",
|
||||
ItemKind::OpaqueTy(..) => "opaque type",
|
||||
ItemKind::Enum(..) => "enum",
|
||||
ItemKind::Struct(..) => "struct",
|
||||
ItemKind::Union(..) => "union",
|
||||
ItemKind::Trait(..) => "trait",
|
||||
ItemKind::TraitAlias(..) => "trait alias",
|
||||
ItemKind::Impl(..) => "implementation",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// A reference from an trait to one of its associated items. This
|
||||
|
||||
@@ -2418,6 +2418,7 @@ pub fn ty_of_fn(
|
||||
visitor.0,
|
||||
true,
|
||||
hir_ty,
|
||||
"function",
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -145,6 +145,7 @@ struct CollectItemTypesVisitor<'tcx> {
|
||||
placeholder_types: Vec<Span>,
|
||||
suggest: bool,
|
||||
hir_ty: Option<&hir::Ty<'_>>,
|
||||
kind: &'static str,
|
||||
) {
|
||||
if placeholder_types.is_empty() {
|
||||
return;
|
||||
@@ -174,7 +175,7 @@ struct CollectItemTypesVisitor<'tcx> {
|
||||
));
|
||||
}
|
||||
|
||||
let mut err = bad_placeholder_type(tcx, placeholder_types);
|
||||
let mut err = bad_placeholder_type(tcx, placeholder_types, kind);
|
||||
|
||||
// Suggest, but only if it is not a function in const or static
|
||||
if suggest {
|
||||
@@ -236,7 +237,15 @@ fn reject_placeholder_type_signatures_in_item(tcx: TyCtxt<'tcx>, item: &'tcx hir
|
||||
let mut visitor = PlaceholderHirTyCollector::default();
|
||||
visitor.visit_item(item);
|
||||
|
||||
placeholder_type_error(tcx, Some(generics.span), generics.params, visitor.0, suggest, None);
|
||||
placeholder_type_error(
|
||||
tcx,
|
||||
Some(generics.span),
|
||||
generics.params,
|
||||
visitor.0,
|
||||
suggest,
|
||||
None,
|
||||
item.kind.descr(),
|
||||
);
|
||||
}
|
||||
|
||||
impl Visitor<'tcx> for CollectItemTypesVisitor<'tcx> {
|
||||
@@ -302,13 +311,17 @@ fn visit_impl_item(&mut self, impl_item: &'tcx hir::ImplItem<'tcx>) {
|
||||
fn bad_placeholder_type(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
mut spans: Vec<Span>,
|
||||
kind: &'static str,
|
||||
) -> rustc_errors::DiagnosticBuilder<'tcx> {
|
||||
let kind = if kind.ends_with('s') { format!("{}es", kind) } else { format!("{}s", kind) };
|
||||
|
||||
spans.sort();
|
||||
let mut err = struct_span_err!(
|
||||
tcx.sess,
|
||||
spans.clone(),
|
||||
E0121,
|
||||
"the type placeholder `_` is not allowed within types on item signatures",
|
||||
"the type placeholder `_` is not allowed within types on item signatures for {}",
|
||||
kind
|
||||
);
|
||||
for span in spans {
|
||||
err.span_label(span, "not allowed in type signatures");
|
||||
@@ -382,7 +395,7 @@ fn ct_infer(
|
||||
_: Option<&ty::GenericParamDef>,
|
||||
span: Span,
|
||||
) -> &'tcx Const<'tcx> {
|
||||
bad_placeholder_type(self.tcx(), vec![span]).emit();
|
||||
bad_placeholder_type(self.tcx(), vec![span], "generic").emit();
|
||||
// Typeck doesn't expect erased regions to be returned from `type_of`.
|
||||
let ty = self.tcx.fold_regions(ty, &mut false, |r, _| match r {
|
||||
ty::ReErased => self.tcx.lifetimes.re_static,
|
||||
@@ -746,7 +759,15 @@ fn convert_item(tcx: TyCtxt<'_>, item_id: hir::ItemId) {
|
||||
hir::ForeignItemKind::Static(..) => {
|
||||
let mut visitor = PlaceholderHirTyCollector::default();
|
||||
visitor.visit_foreign_item(item);
|
||||
placeholder_type_error(tcx, None, &[], visitor.0, false, None);
|
||||
placeholder_type_error(
|
||||
tcx,
|
||||
None,
|
||||
&[],
|
||||
visitor.0,
|
||||
false,
|
||||
None,
|
||||
"static variable",
|
||||
);
|
||||
}
|
||||
_ => (),
|
||||
}
|
||||
@@ -818,7 +839,15 @@ fn convert_item(tcx: TyCtxt<'_>, item_id: hir::ItemId) {
|
||||
if let hir::TyKind::TraitObject(..) = ty.kind {
|
||||
let mut visitor = PlaceholderHirTyCollector::default();
|
||||
visitor.visit_item(it);
|
||||
placeholder_type_error(tcx, None, &[], visitor.0, false, None);
|
||||
placeholder_type_error(
|
||||
tcx,
|
||||
None,
|
||||
&[],
|
||||
visitor.0,
|
||||
false,
|
||||
None,
|
||||
it.kind.descr(),
|
||||
);
|
||||
}
|
||||
}
|
||||
_ => (),
|
||||
@@ -846,7 +875,7 @@ fn convert_trait_item(tcx: TyCtxt<'_>, trait_item_id: hir::TraitItemId) {
|
||||
// Account for `const C: _;`.
|
||||
let mut visitor = PlaceholderHirTyCollector::default();
|
||||
visitor.visit_trait_item(trait_item);
|
||||
placeholder_type_error(tcx, None, &[], visitor.0, false, None);
|
||||
placeholder_type_error(tcx, None, &[], visitor.0, false, None, "constant");
|
||||
}
|
||||
|
||||
hir::TraitItemKind::Type(_, Some(_)) => {
|
||||
@@ -855,7 +884,7 @@ fn convert_trait_item(tcx: TyCtxt<'_>, trait_item_id: hir::TraitItemId) {
|
||||
// Account for `type T = _;`.
|
||||
let mut visitor = PlaceholderHirTyCollector::default();
|
||||
visitor.visit_trait_item(trait_item);
|
||||
placeholder_type_error(tcx, None, &[], visitor.0, false, None);
|
||||
placeholder_type_error(tcx, None, &[], visitor.0, false, None, "associated type");
|
||||
}
|
||||
|
||||
hir::TraitItemKind::Type(_, None) => {
|
||||
@@ -865,7 +894,7 @@ fn convert_trait_item(tcx: TyCtxt<'_>, trait_item_id: hir::TraitItemId) {
|
||||
let mut visitor = PlaceholderHirTyCollector::default();
|
||||
visitor.visit_trait_item(trait_item);
|
||||
|
||||
placeholder_type_error(tcx, None, &[], visitor.0, false, None);
|
||||
placeholder_type_error(tcx, None, &[], visitor.0, false, None, "associated type");
|
||||
}
|
||||
};
|
||||
|
||||
@@ -887,7 +916,7 @@ fn convert_impl_item(tcx: TyCtxt<'_>, impl_item_id: hir::ImplItemId) {
|
||||
let mut visitor = PlaceholderHirTyCollector::default();
|
||||
visitor.visit_impl_item(impl_item);
|
||||
|
||||
placeholder_type_error(tcx, None, &[], visitor.0, false, None);
|
||||
placeholder_type_error(tcx, None, &[], visitor.0, false, None, "associated type");
|
||||
}
|
||||
hir::ImplItemKind::Const(..) => {}
|
||||
}
|
||||
@@ -1711,7 +1740,7 @@ fn fn_sig(tcx: TyCtxt<'_>, def_id: DefId) -> ty::PolyFnSig<'_> {
|
||||
|
||||
let mut visitor = PlaceholderHirTyCollector::default();
|
||||
visitor.visit_ty(ty);
|
||||
let mut diag = bad_placeholder_type(tcx, visitor.0);
|
||||
let mut diag = bad_placeholder_type(tcx, visitor.0, "return type");
|
||||
let ret_ty = fn_sig.output();
|
||||
if ret_ty != tcx.ty_error() {
|
||||
if !ret_ty.is_closure() {
|
||||
|
||||
@@ -285,7 +285,9 @@ pub(super) fn type_of(tcx: TyCtxt<'_>, def_id: DefId) -> Ty<'_> {
|
||||
TraitItemKind::Const(ref ty, body_id) => body_id
|
||||
.and_then(|body_id| {
|
||||
if is_suggestable_infer_ty(ty) {
|
||||
Some(infer_placeholder_type(tcx, def_id, body_id, ty.span, item.ident))
|
||||
Some(infer_placeholder_type(
|
||||
tcx, def_id, body_id, ty.span, item.ident, "constant",
|
||||
))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
@@ -304,7 +306,7 @@ pub(super) fn type_of(tcx: TyCtxt<'_>, def_id: DefId) -> Ty<'_> {
|
||||
}
|
||||
ImplItemKind::Const(ref ty, body_id) => {
|
||||
if is_suggestable_infer_ty(ty) {
|
||||
infer_placeholder_type(tcx, def_id, body_id, ty.span, item.ident)
|
||||
infer_placeholder_type(tcx, def_id, body_id, ty.span, item.ident, "constant")
|
||||
} else {
|
||||
icx.to_ty(ty)
|
||||
}
|
||||
@@ -320,9 +322,25 @@ pub(super) fn type_of(tcx: TyCtxt<'_>, def_id: DefId) -> Ty<'_> {
|
||||
|
||||
Node::Item(item) => {
|
||||
match item.kind {
|
||||
ItemKind::Static(ref ty, .., body_id) | ItemKind::Const(ref ty, body_id) => {
|
||||
ItemKind::Static(ref ty, .., body_id) => {
|
||||
if is_suggestable_infer_ty(ty) {
|
||||
infer_placeholder_type(tcx, def_id, body_id, ty.span, item.ident)
|
||||
infer_placeholder_type(
|
||||
tcx,
|
||||
def_id,
|
||||
body_id,
|
||||
ty.span,
|
||||
item.ident,
|
||||
"static variable",
|
||||
)
|
||||
} else {
|
||||
icx.to_ty(ty)
|
||||
}
|
||||
}
|
||||
ItemKind::Const(ref ty, body_id) => {
|
||||
if is_suggestable_infer_ty(ty) {
|
||||
infer_placeholder_type(
|
||||
tcx, def_id, body_id, ty.span, item.ident, "constant",
|
||||
)
|
||||
} else {
|
||||
icx.to_ty(ty)
|
||||
}
|
||||
@@ -742,13 +760,14 @@ fn let_position_impl_trait_type(tcx: TyCtxt<'_>, opaque_ty_id: LocalDefId) -> Ty
|
||||
concrete_ty
|
||||
}
|
||||
|
||||
fn infer_placeholder_type(
|
||||
tcx: TyCtxt<'_>,
|
||||
fn infer_placeholder_type<'a>(
|
||||
tcx: TyCtxt<'a>,
|
||||
def_id: LocalDefId,
|
||||
body_id: hir::BodyId,
|
||||
span: Span,
|
||||
item_ident: Ident,
|
||||
) -> Ty<'_> {
|
||||
kind: &'static str,
|
||||
) -> Ty<'a> {
|
||||
// Attempts to make the type nameable by turning FnDefs into FnPtrs.
|
||||
struct MakeNameable<'tcx> {
|
||||
success: bool,
|
||||
@@ -802,7 +821,7 @@ fn fold_ty(&mut self, ty: Ty<'tcx>) -> Ty<'tcx> {
|
||||
if let Some(sugg_ty) = sugg_ty {
|
||||
err.span_suggestion(
|
||||
span,
|
||||
"provide a type for the item",
|
||||
&format!("provide a type for the {item}", item = kind),
|
||||
format!("{}: {}", item_ident, sugg_ty),
|
||||
Applicability::MachineApplicable,
|
||||
);
|
||||
@@ -816,7 +835,7 @@ fn fold_ty(&mut self, ty: Ty<'tcx>) -> Ty<'tcx> {
|
||||
err.emit_unless(ty.references_error());
|
||||
}
|
||||
None => {
|
||||
let mut diag = bad_placeholder_type(tcx, vec![span]);
|
||||
let mut diag = bad_placeholder_type(tcx, vec![span], kind);
|
||||
|
||||
if !ty.references_error() {
|
||||
let mut mk_nameable = MakeNameable::new(tcx);
|
||||
|
||||
@@ -2568,6 +2568,8 @@ fn extend_desugared<I: Iterator<Item = T>>(&mut self, mut iterator: I) {
|
||||
}
|
||||
unsafe {
|
||||
ptr::write(self.as_mut_ptr().add(len), element);
|
||||
// Since next() executes user code which can panic we have to bump the length
|
||||
// after each step.
|
||||
// NB can't overflow since we would have had to alloc the address space
|
||||
self.set_len(len + 1);
|
||||
}
|
||||
|
||||
@@ -89,6 +89,8 @@ fn write_in_place_with_drop<T>(
|
||||
// all we can do is check if it's still in range
|
||||
debug_assert!(sink.dst as *const _ <= src_end, "InPlaceIterable contract violation");
|
||||
ptr::write(sink.dst, item);
|
||||
// Since this executes user code which can panic we have to bump the pointer
|
||||
// after each step.
|
||||
sink.dst = sink.dst.add(1);
|
||||
}
|
||||
Ok(sink)
|
||||
@@ -136,6 +138,8 @@ fn collect_in_place(&mut self, dst_buf: *mut T, end: *const T) -> usize {
|
||||
let dst = dst_buf.offset(i as isize);
|
||||
debug_assert!(dst as *const _ <= end, "InPlaceIterable contract violation");
|
||||
ptr::write(dst, self.__iterator_get_unchecked(i));
|
||||
// Since this executes user code which can panic we have to bump the pointer
|
||||
// after each step.
|
||||
drop_guard.dst = dst.add(1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,6 +40,8 @@ impl<T, I, A: Allocator> SpecExtend<T, I> for Vec<T, A>
|
||||
iterator.for_each(move |element| {
|
||||
ptr::write(ptr, element);
|
||||
ptr = ptr.offset(1);
|
||||
// Since the loop executes user code which can panic we have to bump the pointer
|
||||
// after each step.
|
||||
// NB can't overflow since we would have had to alloc the address space
|
||||
local_len.increment_len(1);
|
||||
});
|
||||
|
||||
@@ -227,6 +227,8 @@ fn new(a: A, b: B) -> Self {
|
||||
fn next(&mut self) -> Option<(A::Item, B::Item)> {
|
||||
if self.index < self.len {
|
||||
let i = self.index;
|
||||
// since get_unchecked executes code which can panic we increment the counters beforehand
|
||||
// so that the same index won't be accessed twice, as required by TrustedRandomAccess
|
||||
self.index += 1;
|
||||
// SAFETY: `i` is smaller than `self.len`, thus smaller than `self.a.len()` and `self.b.len()`
|
||||
unsafe {
|
||||
@@ -234,6 +236,7 @@ fn next(&mut self) -> Option<(A::Item, B::Item)> {
|
||||
}
|
||||
} else if A::MAY_HAVE_SIDE_EFFECT && self.index < self.a_len {
|
||||
let i = self.index;
|
||||
// as above, increment before executing code that may panic
|
||||
self.index += 1;
|
||||
self.len += 1;
|
||||
// match the base implementation's potential side effects
|
||||
@@ -259,6 +262,8 @@ fn nth(&mut self, n: usize) -> Option<Self::Item> {
|
||||
let end = self.index + delta;
|
||||
while self.index < end {
|
||||
let i = self.index;
|
||||
// since get_unchecked executes code which can panic we increment the counters beforehand
|
||||
// so that the same index won't be accessed twice, as required by TrustedRandomAccess
|
||||
self.index += 1;
|
||||
if A::MAY_HAVE_SIDE_EFFECT {
|
||||
// SAFETY: the usage of `cmp::min` to calculate `delta`
|
||||
@@ -295,6 +300,8 @@ fn next_back(&mut self) -> Option<(A::Item, B::Item)>
|
||||
let sz_a = self.a.size();
|
||||
if A::MAY_HAVE_SIDE_EFFECT && sz_a > self.len {
|
||||
for _ in 0..sz_a - self.len {
|
||||
// since next_back() may panic we increment the counters beforehand
|
||||
// to keep Zip's state in sync with the underlying iterator source
|
||||
self.a_len -= 1;
|
||||
self.a.next_back();
|
||||
}
|
||||
@@ -309,6 +316,8 @@ fn next_back(&mut self) -> Option<(A::Item, B::Item)>
|
||||
}
|
||||
}
|
||||
if self.index < self.len {
|
||||
// since get_unchecked executes code which can panic we increment the counters beforehand
|
||||
// so that the same index won't be accessed twice, as required by TrustedRandomAccess
|
||||
self.len -= 1;
|
||||
self.a_len -= 1;
|
||||
let i = self.len;
|
||||
|
||||
@@ -71,7 +71,7 @@ ENV PATH="/node-v14.4.0-linux-x64/bin:${PATH}"
|
||||
# https://github.com/puppeteer/puppeteer/issues/375
|
||||
#
|
||||
# We also specify the version in case we need to update it to go around cache limitations.
|
||||
RUN npm install -g browser-ui-test@0.3.0 --unsafe-perm=true
|
||||
RUN npm install -g browser-ui-test@0.4.0 --unsafe-perm=true
|
||||
|
||||
ENV RUST_CONFIGURE_ARGS \
|
||||
--build=x86_64-unknown-linux-gnu \
|
||||
|
||||
+1
-1
Submodule src/doc/edition-guide updated: 302a115e8f...c74b2a0d6b
+1
-1
Submodule src/doc/embedded-book updated: 7349d173fa...cbec77fbd8
+1
-1
Submodule src/doc/nomicon updated: 55de6fa3c1...b9ca313e68
+1
-1
Submodule src/doc/reference updated: 8f598e2af6...d9699fa8f3
+1
-1
Submodule src/doc/rustc-dev-guide updated: c8da5bfd1c...fe34beddb4
@@ -992,9 +992,9 @@ fn preprocess_link<'a>(
|
||||
}
|
||||
|
||||
// Parse and strip the disambiguator from the link, if present.
|
||||
let (path_str, disambiguator) = match Disambiguator::from_str(&link) {
|
||||
Ok(Some((d, path))) => (path.trim(), Some(d)),
|
||||
Ok(None) => (link.trim(), None),
|
||||
let (disambiguator, path_str, link_text) = match Disambiguator::from_str(&link) {
|
||||
Ok(Some((d, path, link_text))) => (Some(d), path.trim(), link_text.trim()),
|
||||
Ok(None) => (None, link.trim(), link.trim()),
|
||||
Err((err_msg, relative_range)) => {
|
||||
// Only report error if we would not have ignored this link. See issue #83859.
|
||||
if !should_ignore_link_with_disambiguators(link) {
|
||||
@@ -1012,11 +1012,6 @@ fn preprocess_link<'a>(
|
||||
return None;
|
||||
}
|
||||
|
||||
// We stripped `()` and `!` when parsing the disambiguator.
|
||||
// Add them back to be displayed, but not prefix disambiguators.
|
||||
let link_text =
|
||||
disambiguator.map(|d| d.display_for(path_str)).unwrap_or_else(|| path_str.to_owned());
|
||||
|
||||
// Strip generics from the path.
|
||||
let path_str = if path_str.contains(['<', '>'].as_slice()) {
|
||||
match strip_generics_from_path(&path_str) {
|
||||
@@ -1046,7 +1041,7 @@ fn preprocess_link<'a>(
|
||||
path_str,
|
||||
disambiguator,
|
||||
extra_fragment: extra_fragment.map(String::from),
|
||||
link_text,
|
||||
link_text: link_text.to_owned(),
|
||||
}))
|
||||
}
|
||||
|
||||
@@ -1554,24 +1549,12 @@ enum Disambiguator {
|
||||
}
|
||||
|
||||
impl Disambiguator {
|
||||
/// The text that should be displayed when the path is rendered as HTML.
|
||||
///
|
||||
/// NOTE: `path` is not the original link given by the user, but a name suitable for passing to `resolve`.
|
||||
fn display_for(&self, path: &str) -> String {
|
||||
match self {
|
||||
// FIXME: this will have different output if the user had `m!()` originally.
|
||||
Self::Kind(DefKind::Macro(MacroKind::Bang)) => format!("{}!", path),
|
||||
Self::Kind(DefKind::Fn) => format!("{}()", path),
|
||||
_ => path.to_owned(),
|
||||
}
|
||||
}
|
||||
|
||||
/// Given a link, parse and return `(disambiguator, path_str)`.
|
||||
/// Given a link, parse and return `(disambiguator, path_str, link_text)`.
|
||||
///
|
||||
/// This returns `Ok(Some(...))` if a disambiguator was found,
|
||||
/// `Ok(None)` if no disambiguator was found, or `Err(...)`
|
||||
/// if there was a problem with the disambiguator.
|
||||
fn from_str(link: &str) -> Result<Option<(Self, &str)>, (String, Range<usize>)> {
|
||||
fn from_str(link: &str) -> Result<Option<(Self, &str, &str)>, (String, Range<usize>)> {
|
||||
use Disambiguator::{Kind, Namespace as NS, Primitive};
|
||||
|
||||
if let Some(idx) = link.find('@') {
|
||||
@@ -1592,18 +1575,20 @@ fn from_str(link: &str) -> Result<Option<(Self, &str)>, (String, Range<usize>)>
|
||||
"prim" | "primitive" => Primitive,
|
||||
_ => return Err((format!("unknown disambiguator `{}`", prefix), 0..idx)),
|
||||
};
|
||||
Ok(Some((d, &rest[1..])))
|
||||
Ok(Some((d, &rest[1..], &rest[1..])))
|
||||
} else {
|
||||
let suffixes = [
|
||||
("!()", DefKind::Macro(MacroKind::Bang)),
|
||||
("!{}", DefKind::Macro(MacroKind::Bang)),
|
||||
("![]", DefKind::Macro(MacroKind::Bang)),
|
||||
("()", DefKind::Fn),
|
||||
("!", DefKind::Macro(MacroKind::Bang)),
|
||||
];
|
||||
for (suffix, kind) in suffixes {
|
||||
if let Some(link) = link.strip_suffix(suffix) {
|
||||
if let Some(path_str) = link.strip_suffix(suffix) {
|
||||
// Avoid turning `!` or `()` into an empty string
|
||||
if !link.is_empty() {
|
||||
return Ok(Some((Kind(kind), link)));
|
||||
if !path_str.is_empty() {
|
||||
return Ok(Some((Kind(kind), path_str, link)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,25 +2,25 @@ goto: file://|DOC_PATH|/test_docs/index.html
|
||||
// First, we check that the search results are hidden when the Escape key is pressed.
|
||||
write: (".search-input", "test")
|
||||
wait-for: "#search > h1" // The search element is empty before the first search
|
||||
assert-attr: ("#search", {"class": "content"})
|
||||
assert-attr: ("#main", {"class": "content hidden"})
|
||||
assert-attribute: ("#search", {"class": "content"})
|
||||
assert-attribute: ("#main", {"class": "content hidden"})
|
||||
press-key: "Escape"
|
||||
assert-attr: ("#search", {"class": "content hidden"})
|
||||
assert-attr: ("#main", {"class": "content"})
|
||||
assert-attribute: ("#search", {"class": "content hidden"})
|
||||
assert-attribute: ("#main", {"class": "content"})
|
||||
|
||||
// Check that focusing the search input brings back the search results
|
||||
focus: ".search-input"
|
||||
assert-attr: ("#search", {"class": "content"})
|
||||
assert-attr: ("#main", {"class": "content hidden"})
|
||||
assert-attribute: ("#search", {"class": "content"})
|
||||
assert-attribute: ("#main", {"class": "content hidden"})
|
||||
|
||||
// Now let's check that when the help popup is displayed and we press Escape, it doesn't
|
||||
// hide the search results too.
|
||||
click: "#help-button"
|
||||
assert-attr: ("#help", {"class": ""})
|
||||
assert-attribute: ("#help", {"class": ""})
|
||||
press-key: "Escape"
|
||||
assert-attr: ("#help", {"class": "hidden"})
|
||||
assert-attr: ("#search", {"class": "content"})
|
||||
assert-attr: ("#main", {"class": "content hidden"})
|
||||
assert-attribute: ("#help", {"class": "hidden"})
|
||||
assert-attribute: ("#search", {"class": "content"})
|
||||
assert-attribute: ("#main", {"class": "content hidden"})
|
||||
|
||||
// Check that Escape hides the search results when a search result is focused.
|
||||
focus: ".search-input"
|
||||
@@ -29,6 +29,6 @@ press-key: "ArrowDown"
|
||||
assert-false: ".search-input:focus"
|
||||
assert: "#results a:focus"
|
||||
press-key: "Escape"
|
||||
assert-attr: ("#help", {"class": "hidden"})
|
||||
assert-attr: ("#search", {"class": "content hidden"})
|
||||
assert-attr: ("#main", {"class": "content"})
|
||||
assert-attribute: ("#help", {"class": "hidden"})
|
||||
assert-attribute: ("#search", {"class": "content hidden"})
|
||||
assert-attribute: ("#main", {"class": "content"})
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
// This test ensures that the element corresponding to the hash is displayed.
|
||||
goto: file://|DOC_PATH|/test_docs/struct.Foo.html#method.borrow
|
||||
// In the blanket implementations list, "Borrow" is the second one, hence the ":nth(2)".
|
||||
assert-attr: ("#blanket-implementations-list > details:nth-child(2)", {"open": ""})
|
||||
assert-attribute: ("#blanket-implementations-list > details:nth-child(2)", {"open": ""})
|
||||
// We first check that the impl block is open by default.
|
||||
assert-attr: ("#implementations + details", {"open": ""})
|
||||
assert-attribute: ("#implementations + details", {"open": ""})
|
||||
// We collapse it.
|
||||
click: "#implementations + details > summary"
|
||||
// We check that it was collapsed as expected.
|
||||
assert-attr-false: ("#implementations + details", {"open": ""})
|
||||
assert-attribute-false: ("#implementations + details", {"open": ""})
|
||||
// To ensure that we will click on the currently hidden method.
|
||||
assert-text: (".sidebar-links > a", "must_use")
|
||||
click: ".sidebar-links > a"
|
||||
// We check that the impl block was opened as expected so that we can see the method.
|
||||
assert-attr: ("#implementations + details", {"open": ""})
|
||||
assert-attribute: ("#implementations + details", {"open": ""})
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
// This test ensures that the impl blocks are open by default.
|
||||
goto: file://|DOC_PATH|/test_docs/struct.Foo.html
|
||||
assert-attr: ("#main > details.implementors-toggle", {"open": ""})
|
||||
assert-attribute: ("#main > details.implementors-toggle", {"open": ""})
|
||||
|
||||
@@ -2,7 +2,7 @@ goto: file://|DOC_PATH|/test_docs/index.html
|
||||
write: (".search-input", "Foo")
|
||||
// Waiting for the search results to appear...
|
||||
wait-for: "#titles"
|
||||
assert-attr: ("#titles > button:nth-of-type(1)", {"class": "selected"})
|
||||
assert-attribute: ("#titles > button:nth-of-type(1)", {"class": "selected"})
|
||||
|
||||
// To go back to the original "state"
|
||||
goto: file://|DOC_PATH|/test_docs/index.html
|
||||
@@ -10,7 +10,7 @@ write: (".search-input", "-> String")
|
||||
// Waiting for the search results to appear...
|
||||
wait-for: "#titles"
|
||||
// With this search, only the last tab shouldn't be empty so it should be selected.
|
||||
assert-attr: ("#titles > button:nth-of-type(3)", {"class": "selected"})
|
||||
assert-attribute: ("#titles > button:nth-of-type(3)", {"class": "selected"})
|
||||
|
||||
// To go back to the original "state"
|
||||
goto: file://|DOC_PATH|/test_docs/index.html
|
||||
@@ -18,4 +18,4 @@ write: (".search-input", "-> Something")
|
||||
// Waiting for the search results to appear...
|
||||
wait-for: "#titles"
|
||||
// With this search, all the tabs are empty so the first one should remain selected.
|
||||
assert-attr: ("#titles > button:nth-of-type(1)", {"class": "selected"})
|
||||
assert-attribute: ("#titles > button:nth-of-type(1)", {"class": "selected"})
|
||||
|
||||
@@ -3,11 +3,13 @@ goto: file://|DOC_PATH|/src/test_docs/lib.rs.html
|
||||
click: (40, 224) // This is the position of the span for line 4.
|
||||
// Unfortunately, "#4" isn't a valid query selector, so we have to go around that limitation
|
||||
// by instead getting the nth span.
|
||||
assert-attr: (".line-numbers > span:nth-child(4)", {"class": "line-highlighted"})
|
||||
assert-attribute: (".line-numbers > span:nth-child(4)", {"class": "line-highlighted"})
|
||||
// We now check that the good spans are highlighted
|
||||
goto: file://|DOC_PATH|/src/test_docs/lib.rs.html#4-6
|
||||
assert-attr-false: (".line-numbers > span:nth-child(3)", {"class": "line-highlighted"})
|
||||
assert-attr: (".line-numbers > span:nth-child(4)", {"class": "line-highlighted"})
|
||||
assert-attr: (".line-numbers > span:nth-child(5)", {"class": "line-highlighted"})
|
||||
assert-attr: (".line-numbers > span:nth-child(6)", {"class": "line-highlighted"})
|
||||
assert-attr-false: (".line-numbers > span:nth-child(7)", {"class": "line-highlighted"})
|
||||
assert-attribute-false: (".line-numbers > span:nth-child(3)", {"class": "line-highlighted"})
|
||||
assert-attribute: (".line-numbers > span:nth-child(4)", {"class": "line-highlighted"})
|
||||
assert-attribute: (".line-numbers > span:nth-child(5)", {"class": "line-highlighted"})
|
||||
assert-attribute: (".line-numbers > span:nth-child(6)", {"class": "line-highlighted"})
|
||||
assert-attribute-false: (".line-numbers > span:nth-child(7)", {"class": "line-highlighted"})
|
||||
// This is to ensure that the content is correctly align with the line numbers.
|
||||
compare-elements-position: ("//*[@id='1']", ".rust > span", ("y"))
|
||||
|
||||
@@ -1,21 +1,21 @@
|
||||
goto: file://|DOC_PATH|/test_docs/struct.Foo.html
|
||||
size: (433, 600)
|
||||
assert-attr: (".top-doc", {"open": ""})
|
||||
assert-attribute: (".top-doc", {"open": ""})
|
||||
click: (4, 280) // This is the position of the top doc comment toggle
|
||||
assert-attr-false: (".top-doc", {"open": ""})
|
||||
assert-attribute-false: (".top-doc", {"open": ""})
|
||||
click: (4, 280)
|
||||
assert-attr: (".top-doc", {"open": ""})
|
||||
assert-attribute: (".top-doc", {"open": ""})
|
||||
// To ensure that the toggle isn't over the text, we check that the toggle isn't clicked.
|
||||
click: (3, 280)
|
||||
assert-attr: (".top-doc", {"open": ""})
|
||||
assert-attribute: (".top-doc", {"open": ""})
|
||||
|
||||
// Now we do the same but with a little bigger width
|
||||
size: (600, 600)
|
||||
assert-attr: (".top-doc", {"open": ""})
|
||||
assert-attribute: (".top-doc", {"open": ""})
|
||||
click: (4, 240) // New Y position since all search elements are back on one line.
|
||||
assert-attr-false: (".top-doc", {"open": ""})
|
||||
assert-attribute-false: (".top-doc", {"open": ""})
|
||||
click: (4, 240)
|
||||
assert-attr: (".top-doc", {"open": ""})
|
||||
assert-attribute: (".top-doc", {"open": ""})
|
||||
// To ensure that the toggle isn't over the text, we check that the toggle isn't clicked.
|
||||
click: (3, 240)
|
||||
assert-attr: (".top-doc", {"open": ""})
|
||||
assert-attribute: (".top-doc", {"open": ""})
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
goto: file://|DOC_PATH|/test_docs/index.html
|
||||
assert-attr: ("#main > details.top-doc", {"open": ""})
|
||||
assert-attribute: ("#main > details.top-doc", {"open": ""})
|
||||
click: "#toggle-all-docs"
|
||||
wait-for: 1000
|
||||
// This is now collapsed so there shouldn't be the "open" attribute on details.
|
||||
assert-attr-false: ("#main > details.top-doc", {"open": ""})
|
||||
assert-attribute-false: ("#main > details.top-doc", {"open": ""})
|
||||
click: "#toggle-all-docs"
|
||||
wait-for: 1000
|
||||
// Not collapsed anymore so the "open" attribute should be back.
|
||||
assert-attr: ("#main > details.top-doc", {"open": ""})
|
||||
assert-attribute: ("#main > details.top-doc", {"open": ""})
|
||||
|
||||
@@ -2,4 +2,4 @@
|
||||
// has all the implementations toggled open by default, so users can
|
||||
// find method names in those implementations with Ctrl-F.
|
||||
goto: file://|DOC_PATH|/test_docs/struct.Foo.html
|
||||
assert-attr: (".rustdoc-toggle.implementors-toggle", {"open": ""})
|
||||
assert-attribute: (".rustdoc-toggle.implementors-toggle", {"open": ""})
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
#![crate_name = "foo"]
|
||||
#![deny(rustdoc::broken_intra_doc_links)]
|
||||
|
||||
//! [foo!()]
|
||||
// @has foo/index.html '//a[@href="macro.foo.html"]' 'foo!()'
|
||||
|
||||
//! [foo!{}]
|
||||
// @has - '//a[@href="macro.foo.html"]' 'foo!{}'
|
||||
|
||||
//! [foo![]](foo![])
|
||||
// @has - '//a[@href="macro.foo.html"]' 'foo![]'
|
||||
|
||||
//! [foo1](foo!())
|
||||
// @has - '//a[@href="macro.foo.html"]' 'foo1'
|
||||
|
||||
//! [foo2](foo!{})
|
||||
// @has - '//a[@href="macro.foo.html"]' 'foo2'
|
||||
|
||||
//! [foo3](foo![])
|
||||
// @has - '//a[@href="macro.foo.html"]' 'foo3'
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! foo {
|
||||
() => {};
|
||||
}
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
type E = _::AssocTy;
|
||||
//~^ ERROR missing angle brackets in associated item path
|
||||
//~| ERROR the type placeholder `_` is not allowed within types on item signatures
|
||||
//~| ERROR the type placeholder `_` is not allowed within types on item signatures for type aliases
|
||||
|
||||
type F = &'static (u8)::AssocTy;
|
||||
//~^ ERROR missing angle brackets in associated item path
|
||||
@@ -47,37 +47,37 @@ macro_rules! ty {
|
||||
|
||||
trait K<A, B> {}
|
||||
fn foo<X: K<_, _>>(x: X) {}
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures for functions
|
||||
|
||||
fn bar<F>(_: F) where F: Fn() -> _ {}
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures for functions
|
||||
|
||||
fn baz<F: Fn() -> _>(_: F) {}
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures for functions
|
||||
|
||||
struct L<F>(F) where F: Fn() -> _;
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures for structs
|
||||
struct M<F> where F: Fn() -> _ {
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures for structs
|
||||
a: F,
|
||||
}
|
||||
enum N<F> where F: Fn() -> _ {
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures for enums
|
||||
Foo(F),
|
||||
}
|
||||
|
||||
union O<F> where F: Fn() -> _ {
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures for unions
|
||||
foo: F,
|
||||
}
|
||||
|
||||
trait P<F> where F: Fn() -> _ {
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures for traits
|
||||
}
|
||||
|
||||
trait Q {
|
||||
fn foo<F>(_: F) where F: Fn() -> _ {}
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures for functions
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
||||
@@ -81,7 +81,7 @@ error[E0223]: ambiguous associated type
|
||||
LL | type D = (u8, u8)::AssocTy;
|
||||
| ^^^^^^^^^^^^^^^^^ help: use fully-qualified syntax: `<(u8, u8) as Trait>::AssocTy`
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for type aliases
|
||||
--> $DIR/bad-assoc-ty.rs:17:10
|
||||
|
|
||||
LL | type E = _::AssocTy;
|
||||
@@ -122,7 +122,7 @@ error[E0223]: ambiguous associated type
|
||||
LL | type I = ty!()::AssocTy;
|
||||
| ^^^^^^^^^^^^^^ help: use fully-qualified syntax: `<u8 as Trait>::AssocTy`
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for functions
|
||||
--> $DIR/bad-assoc-ty.rs:49:13
|
||||
|
|
||||
LL | fn foo<X: K<_, _>>(x: X) {}
|
||||
@@ -135,7 +135,7 @@ help: use type parameters instead
|
||||
LL | fn foo<X: K<T, T>, T>(x: X) {}
|
||||
| ^ ^ ^^^
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for functions
|
||||
--> $DIR/bad-assoc-ty.rs:52:34
|
||||
|
|
||||
LL | fn bar<F>(_: F) where F: Fn() -> _ {}
|
||||
@@ -146,7 +146,7 @@ help: use type parameters instead
|
||||
LL | fn bar<F, T>(_: F) where F: Fn() -> T {}
|
||||
| ^^^ ^
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for functions
|
||||
--> $DIR/bad-assoc-ty.rs:55:19
|
||||
|
|
||||
LL | fn baz<F: Fn() -> _>(_: F) {}
|
||||
@@ -157,7 +157,7 @@ help: use type parameters instead
|
||||
LL | fn baz<F: Fn() -> T, T>(_: F) {}
|
||||
| ^^^^
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for structs
|
||||
--> $DIR/bad-assoc-ty.rs:58:33
|
||||
|
|
||||
LL | struct L<F>(F) where F: Fn() -> _;
|
||||
@@ -168,7 +168,7 @@ help: use type parameters instead
|
||||
LL | struct L<F, T>(F) where F: Fn() -> T;
|
||||
| ^^^ ^
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for structs
|
||||
--> $DIR/bad-assoc-ty.rs:60:30
|
||||
|
|
||||
LL | struct M<F> where F: Fn() -> _ {
|
||||
@@ -179,7 +179,7 @@ help: use type parameters instead
|
||||
LL | struct M<F, T> where F: Fn() -> T {
|
||||
| ^^^ ^
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for enums
|
||||
--> $DIR/bad-assoc-ty.rs:64:28
|
||||
|
|
||||
LL | enum N<F> where F: Fn() -> _ {
|
||||
@@ -190,7 +190,7 @@ help: use type parameters instead
|
||||
LL | enum N<F, T> where F: Fn() -> T {
|
||||
| ^^^ ^
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for unions
|
||||
--> $DIR/bad-assoc-ty.rs:69:29
|
||||
|
|
||||
LL | union O<F> where F: Fn() -> _ {
|
||||
@@ -201,7 +201,7 @@ help: use type parameters instead
|
||||
LL | union O<F, T> where F: Fn() -> T {
|
||||
| ^^^ ^
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for traits
|
||||
--> $DIR/bad-assoc-ty.rs:74:29
|
||||
|
|
||||
LL | trait P<F> where F: Fn() -> _ {
|
||||
@@ -212,7 +212,7 @@ help: use type parameters instead
|
||||
LL | trait P<F, T> where F: Fn() -> T {
|
||||
| ^^^ ^
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for functions
|
||||
--> $DIR/bad-assoc-ty.rs:79:38
|
||||
|
|
||||
LL | fn foo<F>(_: F) where F: Fn() -> _ {}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for return types
|
||||
--> $DIR/E0121.rs:1:13
|
||||
|
|
||||
LL | fn foo() -> _ { 5 }
|
||||
@@ -7,7 +7,7 @@ LL | fn foo() -> _ { 5 }
|
||||
| not allowed in type signatures
|
||||
| help: replace with the correct return type: `i32`
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for static variables
|
||||
--> $DIR/E0121.rs:3:13
|
||||
|
|
||||
LL | static BAR: _ = "test";
|
||||
|
||||
@@ -8,7 +8,7 @@ fn returns_i32() -> i32 {
|
||||
}
|
||||
|
||||
fn returns_fn_ptr() -> _ {
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures [E0121]
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures for return types [E0121]
|
||||
//~| NOTE not allowed in type signatures
|
||||
//~| HELP replace with the correct return type
|
||||
//~| SUGGESTION fn() -> i32
|
||||
@@ -16,7 +16,7 @@ fn returns_fn_ptr() -> _ {
|
||||
}
|
||||
|
||||
fn returns_closure() -> _ {
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures [E0121]
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures for return types [E0121]
|
||||
//~| NOTE not allowed in type signatures
|
||||
//~| HELP consider using an `Fn`, `FnMut`, or `FnOnce` trait bound
|
||||
//~| NOTE for more information on `Fn` traits and closure types, see
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for return types
|
||||
--> $DIR/issue-80179.rs:10:24
|
||||
|
|
||||
LL | fn returns_fn_ptr() -> _ {
|
||||
@@ -7,7 +7,7 @@ LL | fn returns_fn_ptr() -> _ {
|
||||
| not allowed in type signatures
|
||||
| help: replace with the correct return type: `fn() -> i32`
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for return types
|
||||
--> $DIR/issue-80179.rs:18:25
|
||||
|
|
||||
LL | fn returns_closure() -> _ {
|
||||
|
||||
@@ -4,7 +4,7 @@ macro_rules! suite {
|
||||
const A = "A".$fn();
|
||||
//~^ ERROR the name `A` is defined multiple times
|
||||
//~| ERROR missing type for `const` item
|
||||
//~| ERROR the type placeholder `_` is not allowed within types
|
||||
//~| ERROR the type placeholder `_` is not allowed within types on item signatures for constants
|
||||
)*
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ error: missing type for `const` item
|
||||
--> $DIR/issue-69396-const-no-type-in-macro.rs:4:19
|
||||
|
|
||||
LL | const A = "A".$fn();
|
||||
| ^ help: provide a type for the item: `A: usize`
|
||||
| ^ help: provide a type for the constant: `A: usize`
|
||||
...
|
||||
LL | / suite! {
|
||||
LL | | len;
|
||||
@@ -30,7 +30,7 @@ LL | | }
|
||||
|
|
||||
= note: this error originates in the macro `suite` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for constants
|
||||
--> $DIR/issue-69396-const-no-type-in-macro.rs:4:19
|
||||
|
|
||||
LL | const A = "A".$fn();
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
struct S;
|
||||
|
||||
impl S {
|
||||
fn f(self: _) {} //~ERROR the type placeholder `_` is not allowed within types on item sig
|
||||
fn g(self: &_) {} //~ERROR the type placeholder `_` is not allowed within types on item sig
|
||||
fn f(self: _) {} //~ERROR the type placeholder `_` is not allowed within types on item signatures for functions
|
||||
fn g(self: &_) {} //~ERROR the type placeholder `_` is not allowed within types on item signatures for functions
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for functions
|
||||
--> $DIR/self-infer.rs:4:16
|
||||
|
|
||||
LL | fn f(self: _) {}
|
||||
@@ -9,7 +9,7 @@ help: use type parameters instead
|
||||
LL | fn f<T>(self: T) {}
|
||||
| ^^^ ^
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for functions
|
||||
--> $DIR/self-infer.rs:5:17
|
||||
|
|
||||
LL | fn g(self: &_) {}
|
||||
|
||||
@@ -32,20 +32,20 @@ fn main() {}
|
||||
|
||||
const C = 42;
|
||||
//~^ ERROR missing type for `const` item
|
||||
//~| HELP provide a type for the item
|
||||
//~| HELP provide a type for the constant
|
||||
//~| SUGGESTION C: i32
|
||||
|
||||
const D = &&42;
|
||||
//~^ ERROR missing type for `const` item
|
||||
//~| HELP provide a type for the item
|
||||
//~| HELP provide a type for the constant
|
||||
//~| SUGGESTION D: &&i32
|
||||
|
||||
static S = Vec::<String>::new();
|
||||
//~^ ERROR missing type for `static` item
|
||||
//~| HELP provide a type for the item
|
||||
//~| HELP provide a type for the static variable
|
||||
//~| SUGGESTION S: Vec<String>
|
||||
|
||||
static mut SM = "abc";
|
||||
//~^ ERROR missing type for `static mut` item
|
||||
//~| HELP provide a type for the item
|
||||
//~| HELP provide a type for the static variable
|
||||
//~| SUGGESTION &str
|
||||
|
||||
@@ -2,25 +2,25 @@ error: missing type for `const` item
|
||||
--> $DIR/const-no-type.rs:33:7
|
||||
|
|
||||
LL | const C = 42;
|
||||
| ^ help: provide a type for the item: `C: i32`
|
||||
| ^ help: provide a type for the constant: `C: i32`
|
||||
|
||||
error: missing type for `const` item
|
||||
--> $DIR/const-no-type.rs:38:7
|
||||
|
|
||||
LL | const D = &&42;
|
||||
| ^ help: provide a type for the item: `D: &&i32`
|
||||
| ^ help: provide a type for the constant: `D: &&i32`
|
||||
|
||||
error: missing type for `static` item
|
||||
--> $DIR/const-no-type.rs:43:8
|
||||
|
|
||||
LL | static S = Vec::<String>::new();
|
||||
| ^ help: provide a type for the item: `S: Vec<String>`
|
||||
| ^ help: provide a type for the static variable: `S: Vec<String>`
|
||||
|
||||
error: missing type for `static mut` item
|
||||
--> $DIR/const-no-type.rs:48:12
|
||||
|
|
||||
LL | static mut SM = "abc";
|
||||
| ^^ help: provide a type for the item: `SM: &str`
|
||||
| ^^ help: provide a type for the static variable: `SM: &str`
|
||||
|
||||
error: missing type for `const` item
|
||||
--> $DIR/const-no-type.rs:14:7
|
||||
|
||||
@@ -5,17 +5,17 @@
|
||||
|
||||
const A = 5;
|
||||
//~^ ERROR: missing type for `const` item
|
||||
//~| HELP: provide a type for the item
|
||||
//~| HELP: provide a type for the constant
|
||||
|
||||
static B: _ = "abc";
|
||||
//~^ ERROR: the type placeholder `_` is not allowed within types on item signatures
|
||||
//~^ ERROR: the type placeholder `_` is not allowed within types on item signatures for static variables
|
||||
//~| NOTE: not allowed in type signatures
|
||||
//~| HELP: replace with the correct type
|
||||
|
||||
|
||||
// FIXME: this should also suggest a function pointer, as the closure is non-capturing
|
||||
const C: _ = || 42;
|
||||
//~^ ERROR: the type placeholder `_` is not allowed within types on item signatures
|
||||
//~^ ERROR: the type placeholder `_` is not allowed within types on item signatures for constants
|
||||
//~| NOTE: not allowed in type signatures
|
||||
//~| NOTE: however, the inferred type
|
||||
|
||||
@@ -28,10 +28,10 @@ struct S<T> { t: T }
|
||||
fn foo() -> i32 { 42 }
|
||||
const E = foo;
|
||||
//~^ ERROR: missing type for `const` item
|
||||
//~| HELP: provide a type for the item
|
||||
//~| HELP: provide a type for the constant
|
||||
const F = S { t: foo };
|
||||
//~^ ERROR: missing type for `const` item
|
||||
//~| HELP: provide a type for the item
|
||||
//~| HELP: provide a type for the constant
|
||||
|
||||
|
||||
const G = || -> i32 { yield 0; return 1; };
|
||||
|
||||
@@ -2,9 +2,9 @@ error: missing type for `const` item
|
||||
--> $DIR/unnamable-types.rs:6:7
|
||||
|
|
||||
LL | const A = 5;
|
||||
| ^ help: provide a type for the item: `A: i32`
|
||||
| ^ help: provide a type for the constant: `A: i32`
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for static variables
|
||||
--> $DIR/unnamable-types.rs:10:11
|
||||
|
|
||||
LL | static B: _ = "abc";
|
||||
@@ -13,7 +13,7 @@ LL | static B: _ = "abc";
|
||||
| not allowed in type signatures
|
||||
| help: replace with the correct type: `&str`
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for constants
|
||||
--> $DIR/unnamable-types.rs:17:10
|
||||
|
|
||||
LL | const C: _ = || 42;
|
||||
@@ -41,13 +41,13 @@ error: missing type for `const` item
|
||||
--> $DIR/unnamable-types.rs:29:7
|
||||
|
|
||||
LL | const E = foo;
|
||||
| ^ help: provide a type for the item: `E: fn() -> i32`
|
||||
| ^ help: provide a type for the constant: `E: fn() -> i32`
|
||||
|
||||
error: missing type for `const` item
|
||||
--> $DIR/unnamable-types.rs:32:7
|
||||
|
|
||||
LL | const F = S { t: foo };
|
||||
| ^ help: provide a type for the item: `F: S<fn() -> i32>`
|
||||
| ^ help: provide a type for the constant: `F: S<fn() -> i32>`
|
||||
|
||||
error: missing type for `const` item
|
||||
--> $DIR/unnamable-types.rs:37:7
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
fn main() {
|
||||
static BUG: fn(_) -> u8 = |_| 8;
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures [E0121]
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures for functions [E0121]
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for functions
|
||||
--> $DIR/issue-74086.rs:2:20
|
||||
|
|
||||
LL | static BUG: fn(_) -> u8 = |_| 8;
|
||||
|
||||
@@ -5,7 +5,7 @@ pub struct UI {}
|
||||
impl UI {
|
||||
pub fn run() -> Result<_> {
|
||||
//~^ ERROR: this enum takes 2 generic arguments but 1 generic argument was supplied
|
||||
//~| ERROR: the type placeholder `_` is not allowed within types on item signatures
|
||||
//~| ERROR: the type placeholder `_` is not allowed within types on item signatures for return types
|
||||
let mut ui = UI {};
|
||||
ui.interact();
|
||||
|
||||
@@ -14,7 +14,7 @@ pub fn run() -> Result<_> {
|
||||
|
||||
pub fn interact(&mut self) -> Result<_> {
|
||||
//~^ ERROR: this enum takes 2 generic arguments but 1 generic argument was supplied
|
||||
//~| ERROR: the type placeholder `_` is not allowed within types on item signatures
|
||||
//~| ERROR: the type placeholder `_` is not allowed within types on item signatures for return types
|
||||
unimplemented!();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,13 +34,13 @@ help: add missing generic argument
|
||||
LL | pub fn interact(&mut self) -> Result<_, E> {
|
||||
| ^^^
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for return types
|
||||
--> $DIR/issue-75883.rs:15:42
|
||||
|
|
||||
LL | pub fn interact(&mut self) -> Result<_> {
|
||||
| ^ not allowed in type signatures
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for return types
|
||||
--> $DIR/issue-75883.rs:6:28
|
||||
|
|
||||
LL | pub fn run() -> Result<_> {
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for constant items
|
||||
--> $DIR/issue-75889.rs:3:24
|
||||
|
|
||||
LL | const FOO: dyn Fn() -> _ = "";
|
||||
| ^ not allowed in type signatures
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for static items
|
||||
--> $DIR/issue-75889.rs:4:25
|
||||
|
|
||||
LL | static BOO: dyn Fn() -> _ = "";
|
||||
|
||||
@@ -3,11 +3,11 @@
|
||||
pub struct T<'a>(&'a str);
|
||||
|
||||
pub fn f<'a>(val: T<'a>) -> _ {
|
||||
//~^ ERROR: the type placeholder `_` is not allowed within types on item signatures
|
||||
//~^ ERROR: the type placeholder `_` is not allowed within types on item signatures for return types
|
||||
g(val)
|
||||
}
|
||||
|
||||
pub fn g(_: T<'static>) -> _ {}
|
||||
//~^ ERROR: the type placeholder `_` is not allowed within types on item signatures
|
||||
//~^ ERROR: the type placeholder `_` is not allowed within types on item signatures for return types
|
||||
|
||||
fn main() {}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for return types
|
||||
--> $DIR/issue-80779.rs:10:28
|
||||
|
|
||||
LL | pub fn g(_: T<'static>) -> _ {}
|
||||
@@ -7,7 +7,7 @@ LL | pub fn g(_: T<'static>) -> _ {}
|
||||
| not allowed in type signatures
|
||||
| help: replace with the correct return type: `()`
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for return types
|
||||
--> $DIR/issue-80779.rs:5:29
|
||||
|
|
||||
LL | pub fn f<'a>(val: T<'a>) -> _ {
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
const TEST4: fn() -> _ = 42;
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item
|
||||
//signatures
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures for functions
|
||||
|
||||
fn main() {
|
||||
const TEST5: fn() -> _ = 42;
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item
|
||||
//signatures
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures for functions
|
||||
|
||||
}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for functions
|
||||
--> $DIR/issue-81885.rs:1:22
|
||||
|
|
||||
LL | const TEST4: fn() -> _ = 42;
|
||||
| ^ not allowed in type signatures
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
--> $DIR/issue-81885.rs:6:26
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for functions
|
||||
--> $DIR/issue-81885.rs:5:26
|
||||
|
|
||||
LL | const TEST5: fn() -> _ = 42;
|
||||
| ^ not allowed in type signatures
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for static variables
|
||||
--> $DIR/issue-83621-placeholder-static-in-extern.rs:4:15
|
||||
|
|
||||
LL | static x: _;
|
||||
|
||||
@@ -2,13 +2,13 @@
|
||||
|
||||
trait Test {
|
||||
const TEST: fn() -> _;
|
||||
//~^ ERROR: the type placeholder `_` is not allowed within types on item signatures [E0121]
|
||||
//~| ERROR: the type placeholder `_` is not allowed within types on item signatures [E0121]
|
||||
//~^ ERROR: the type placeholder `_` is not allowed within types on item signatures for functions [E0121]
|
||||
//~| ERROR: the type placeholder `_` is not allowed within types on item signatures for constants [E0121]
|
||||
}
|
||||
|
||||
impl Test for MyStruct {
|
||||
const TEST: fn() -> _ = 42;
|
||||
//~^ ERROR: the type placeholder `_` is not allowed within types on item signatures [E0121]
|
||||
//~^ ERROR: the type placeholder `_` is not allowed within types on item signatures for functions [E0121]
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for functions
|
||||
--> $DIR/type-placeholder-fn-in-const.rs:4:25
|
||||
|
|
||||
LL | const TEST: fn() -> _;
|
||||
| ^ not allowed in type signatures
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for constants
|
||||
--> $DIR/type-placeholder-fn-in-const.rs:4:25
|
||||
|
|
||||
LL | const TEST: fn() -> _;
|
||||
| ^ not allowed in type signatures
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for functions
|
||||
--> $DIR/type-placeholder-fn-in-const.rs:10:25
|
||||
|
|
||||
LL | const TEST: fn() -> _ = 42;
|
||||
|
||||
@@ -1,35 +1,35 @@
|
||||
error: expected identifier, found reserved identifier `_`
|
||||
--> $DIR/typeck_type_placeholder_item.rs:158:18
|
||||
--> $DIR/typeck_type_placeholder_item.rs:157:18
|
||||
|
|
||||
LL | struct BadStruct<_>(_);
|
||||
| ^ expected identifier, found reserved identifier
|
||||
|
||||
error: expected identifier, found reserved identifier `_`
|
||||
--> $DIR/typeck_type_placeholder_item.rs:161:16
|
||||
--> $DIR/typeck_type_placeholder_item.rs:160:16
|
||||
|
|
||||
LL | trait BadTrait<_> {}
|
||||
| ^ expected identifier, found reserved identifier
|
||||
|
||||
error: expected identifier, found reserved identifier `_`
|
||||
--> $DIR/typeck_type_placeholder_item.rs:171:19
|
||||
--> $DIR/typeck_type_placeholder_item.rs:170:19
|
||||
|
|
||||
LL | struct BadStruct1<_, _>(_);
|
||||
| ^ expected identifier, found reserved identifier
|
||||
|
||||
error: expected identifier, found reserved identifier `_`
|
||||
--> $DIR/typeck_type_placeholder_item.rs:171:22
|
||||
--> $DIR/typeck_type_placeholder_item.rs:170:22
|
||||
|
|
||||
LL | struct BadStruct1<_, _>(_);
|
||||
| ^ expected identifier, found reserved identifier
|
||||
|
||||
error: expected identifier, found reserved identifier `_`
|
||||
--> $DIR/typeck_type_placeholder_item.rs:176:19
|
||||
--> $DIR/typeck_type_placeholder_item.rs:175:19
|
||||
|
|
||||
LL | struct BadStruct2<_, T>(_, T);
|
||||
| ^ expected identifier, found reserved identifier
|
||||
|
||||
error: associated constant in `impl` without body
|
||||
--> $DIR/typeck_type_placeholder_item.rs:209:5
|
||||
--> $DIR/typeck_type_placeholder_item.rs:208:5
|
||||
|
|
||||
LL | const C: _;
|
||||
| ^^^^^^^^^^-
|
||||
@@ -37,7 +37,7 @@ LL | const C: _;
|
||||
| help: provide a definition for the constant: `= <expr>;`
|
||||
|
||||
error[E0403]: the name `_` is already used for a generic parameter in this item's generic parameters
|
||||
--> $DIR/typeck_type_placeholder_item.rs:171:22
|
||||
--> $DIR/typeck_type_placeholder_item.rs:170:22
|
||||
|
|
||||
LL | struct BadStruct1<_, _>(_);
|
||||
| - ^ already used
|
||||
@@ -53,7 +53,7 @@ LL | #![cfg_attr(full_tait, feature(type_alias_impl_trait))]
|
||||
= note: `#[warn(incomplete_features)]` on by default
|
||||
= note: see issue #63063 <https://github.com/rust-lang/rust/issues/63063> for more information
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for return types
|
||||
--> $DIR/typeck_type_placeholder_item.rs:10:14
|
||||
|
|
||||
LL | fn test() -> _ { 5 }
|
||||
@@ -62,7 +62,7 @@ LL | fn test() -> _ { 5 }
|
||||
| not allowed in type signatures
|
||||
| help: replace with the correct return type: `i32`
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for return types
|
||||
--> $DIR/typeck_type_placeholder_item.rs:13:16
|
||||
|
|
||||
LL | fn test2() -> (_, _) { (5, 5) }
|
||||
@@ -72,7 +72,7 @@ LL | fn test2() -> (_, _) { (5, 5) }
|
||||
| |not allowed in type signatures
|
||||
| help: replace with the correct return type: `(i32, i32)`
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for static variables
|
||||
--> $DIR/typeck_type_placeholder_item.rs:16:15
|
||||
|
|
||||
LL | static TEST3: _ = "test";
|
||||
@@ -81,7 +81,7 @@ LL | static TEST3: _ = "test";
|
||||
| not allowed in type signatures
|
||||
| help: replace with the correct type: `&str`
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for static variables
|
||||
--> $DIR/typeck_type_placeholder_item.rs:19:15
|
||||
|
|
||||
LL | static TEST4: _ = 145;
|
||||
@@ -90,13 +90,13 @@ LL | static TEST4: _ = 145;
|
||||
| not allowed in type signatures
|
||||
| help: replace with the correct type: `i32`
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for static variables
|
||||
--> $DIR/typeck_type_placeholder_item.rs:22:15
|
||||
|
|
||||
LL | static TEST5: (_, _) = (1, 2);
|
||||
| ^^^^^^ not allowed in type signatures
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for functions
|
||||
--> $DIR/typeck_type_placeholder_item.rs:25:13
|
||||
|
|
||||
LL | fn test6(_: _) { }
|
||||
@@ -107,7 +107,7 @@ help: use type parameters instead
|
||||
LL | fn test6<T>(_: T) { }
|
||||
| ^^^ ^
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for functions
|
||||
--> $DIR/typeck_type_placeholder_item.rs:28:18
|
||||
|
|
||||
LL | fn test6_b<T>(_: _, _: T) { }
|
||||
@@ -118,7 +118,7 @@ help: use type parameters instead
|
||||
LL | fn test6_b<T, U>(_: U, _: T) { }
|
||||
| ^^^ ^
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for functions
|
||||
--> $DIR/typeck_type_placeholder_item.rs:31:30
|
||||
|
|
||||
LL | fn test6_c<T, K, L, A, B>(_: _, _: (T, K, L, A, B)) { }
|
||||
@@ -129,7 +129,7 @@ help: use type parameters instead
|
||||
LL | fn test6_c<T, K, L, A, B, U>(_: U, _: (T, K, L, A, B)) { }
|
||||
| ^^^ ^
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for functions
|
||||
--> $DIR/typeck_type_placeholder_item.rs:34:13
|
||||
|
|
||||
LL | fn test7(x: _) { let _x: usize = x; }
|
||||
@@ -140,7 +140,7 @@ help: use type parameters instead
|
||||
LL | fn test7<T>(x: T) { let _x: usize = x; }
|
||||
| ^^^ ^
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for functions
|
||||
--> $DIR/typeck_type_placeholder_item.rs:37:22
|
||||
|
|
||||
LL | fn test8(_f: fn() -> _) { }
|
||||
@@ -149,7 +149,7 @@ LL | fn test8(_f: fn() -> _) { }
|
||||
| not allowed in type signatures
|
||||
| help: use type parameters instead: `T`
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for functions
|
||||
--> $DIR/typeck_type_placeholder_item.rs:37:22
|
||||
|
|
||||
LL | fn test8(_f: fn() -> _) { }
|
||||
@@ -160,7 +160,7 @@ help: use type parameters instead
|
||||
LL | fn test8<T>(_f: fn() -> T) { }
|
||||
| ^^^ ^
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for return types
|
||||
--> $DIR/typeck_type_placeholder_item.rs:51:26
|
||||
|
|
||||
LL | fn test11(x: &usize) -> &_ {
|
||||
@@ -169,7 +169,7 @@ LL | fn test11(x: &usize) -> &_ {
|
||||
| |not allowed in type signatures
|
||||
| help: replace with the correct return type: `&'static &'static usize`
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for return types
|
||||
--> $DIR/typeck_type_placeholder_item.rs:56:52
|
||||
|
|
||||
LL | unsafe fn test12(x: *const usize) -> *const *const _ {
|
||||
@@ -178,7 +178,7 @@ LL | unsafe fn test12(x: *const usize) -> *const *const _ {
|
||||
| | not allowed in type signatures
|
||||
| help: replace with the correct return type: `*const *const usize`
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for structs
|
||||
--> $DIR/typeck_type_placeholder_item.rs:70:8
|
||||
|
|
||||
LL | a: _,
|
||||
@@ -201,9 +201,9 @@ error: missing type for `static` item
|
||||
--> $DIR/typeck_type_placeholder_item.rs:76:12
|
||||
|
|
||||
LL | static A = 42;
|
||||
| ^ help: provide a type for the item: `A: i32`
|
||||
| ^ help: provide a type for the static variable: `A: i32`
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for static variables
|
||||
--> $DIR/typeck_type_placeholder_item.rs:78:15
|
||||
|
|
||||
LL | static B: _ = 42;
|
||||
@@ -212,14 +212,14 @@ LL | static B: _ = 42;
|
||||
| not allowed in type signatures
|
||||
| help: replace with the correct type: `i32`
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for static variables
|
||||
--> $DIR/typeck_type_placeholder_item.rs:80:15
|
||||
|
|
||||
LL | static C: Option<_> = Some(42);
|
||||
| ^^^^^^^^^ not allowed in type signatures
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
--> $DIR/typeck_type_placeholder_item.rs:83:21
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for return types
|
||||
--> $DIR/typeck_type_placeholder_item.rs:82:21
|
||||
|
|
||||
LL | fn fn_test() -> _ { 5 }
|
||||
| ^
|
||||
@@ -227,8 +227,8 @@ LL | fn fn_test() -> _ { 5 }
|
||||
| not allowed in type signatures
|
||||
| help: replace with the correct return type: `i32`
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
--> $DIR/typeck_type_placeholder_item.rs:86:23
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for return types
|
||||
--> $DIR/typeck_type_placeholder_item.rs:85:23
|
||||
|
|
||||
LL | fn fn_test2() -> (_, _) { (5, 5) }
|
||||
| -^--^-
|
||||
@@ -237,8 +237,8 @@ LL | fn fn_test2() -> (_, _) { (5, 5) }
|
||||
| |not allowed in type signatures
|
||||
| help: replace with the correct return type: `(i32, i32)`
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
--> $DIR/typeck_type_placeholder_item.rs:89:22
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for static variables
|
||||
--> $DIR/typeck_type_placeholder_item.rs:88:22
|
||||
|
|
||||
LL | static FN_TEST3: _ = "test";
|
||||
| ^
|
||||
@@ -246,8 +246,8 @@ LL | static FN_TEST3: _ = "test";
|
||||
| not allowed in type signatures
|
||||
| help: replace with the correct type: `&str`
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
--> $DIR/typeck_type_placeholder_item.rs:92:22
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for static variables
|
||||
--> $DIR/typeck_type_placeholder_item.rs:91:22
|
||||
|
|
||||
LL | static FN_TEST4: _ = 145;
|
||||
| ^
|
||||
@@ -255,14 +255,14 @@ LL | static FN_TEST4: _ = 145;
|
||||
| not allowed in type signatures
|
||||
| help: replace with the correct type: `i32`
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
--> $DIR/typeck_type_placeholder_item.rs:95:22
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for static variables
|
||||
--> $DIR/typeck_type_placeholder_item.rs:94:22
|
||||
|
|
||||
LL | static FN_TEST5: (_, _) = (1, 2);
|
||||
| ^^^^^^ not allowed in type signatures
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
--> $DIR/typeck_type_placeholder_item.rs:98:20
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for functions
|
||||
--> $DIR/typeck_type_placeholder_item.rs:97:20
|
||||
|
|
||||
LL | fn fn_test6(_: _) { }
|
||||
| ^ not allowed in type signatures
|
||||
@@ -272,8 +272,8 @@ help: use type parameters instead
|
||||
LL | fn fn_test6<T>(_: T) { }
|
||||
| ^^^ ^
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
--> $DIR/typeck_type_placeholder_item.rs:101:20
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for functions
|
||||
--> $DIR/typeck_type_placeholder_item.rs:100:20
|
||||
|
|
||||
LL | fn fn_test7(x: _) { let _x: usize = x; }
|
||||
| ^ not allowed in type signatures
|
||||
@@ -283,8 +283,8 @@ help: use type parameters instead
|
||||
LL | fn fn_test7<T>(x: T) { let _x: usize = x; }
|
||||
| ^^^ ^
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
--> $DIR/typeck_type_placeholder_item.rs:104:29
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for functions
|
||||
--> $DIR/typeck_type_placeholder_item.rs:103:29
|
||||
|
|
||||
LL | fn fn_test8(_f: fn() -> _) { }
|
||||
| ^
|
||||
@@ -292,8 +292,8 @@ LL | fn fn_test8(_f: fn() -> _) { }
|
||||
| not allowed in type signatures
|
||||
| help: use type parameters instead: `T`
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
--> $DIR/typeck_type_placeholder_item.rs:104:29
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for functions
|
||||
--> $DIR/typeck_type_placeholder_item.rs:103:29
|
||||
|
|
||||
LL | fn fn_test8(_f: fn() -> _) { }
|
||||
| ^ not allowed in type signatures
|
||||
@@ -303,8 +303,8 @@ help: use type parameters instead
|
||||
LL | fn fn_test8<T>(_f: fn() -> T) { }
|
||||
| ^^^ ^
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
--> $DIR/typeck_type_placeholder_item.rs:127:12
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for structs
|
||||
--> $DIR/typeck_type_placeholder_item.rs:126:12
|
||||
|
|
||||
LL | a: _,
|
||||
| ^ not allowed in type signatures
|
||||
@@ -323,21 +323,21 @@ LL | b: (T, T),
|
||||
|
|
||||
|
||||
error[E0282]: type annotations needed
|
||||
--> $DIR/typeck_type_placeholder_item.rs:132:18
|
||||
--> $DIR/typeck_type_placeholder_item.rs:131:18
|
||||
|
|
||||
LL | fn fn_test11(_: _) -> (_, _) { panic!() }
|
||||
| ^ cannot infer type
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
--> $DIR/typeck_type_placeholder_item.rs:132:28
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for return types
|
||||
--> $DIR/typeck_type_placeholder_item.rs:131:28
|
||||
|
|
||||
LL | fn fn_test11(_: _) -> (_, _) { panic!() }
|
||||
| ^ ^ not allowed in type signatures
|
||||
| |
|
||||
| not allowed in type signatures
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
--> $DIR/typeck_type_placeholder_item.rs:136:30
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for return types
|
||||
--> $DIR/typeck_type_placeholder_item.rs:135:30
|
||||
|
|
||||
LL | fn fn_test12(x: i32) -> (_, _) { (x, x) }
|
||||
| -^--^-
|
||||
@@ -346,8 +346,8 @@ LL | fn fn_test12(x: i32) -> (_, _) { (x, x) }
|
||||
| |not allowed in type signatures
|
||||
| help: replace with the correct return type: `(i32, i32)`
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
--> $DIR/typeck_type_placeholder_item.rs:139:33
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for return types
|
||||
--> $DIR/typeck_type_placeholder_item.rs:138:33
|
||||
|
|
||||
LL | fn fn_test13(x: _) -> (i32, _) { (x, x) }
|
||||
| ------^-
|
||||
@@ -355,8 +355,8 @@ LL | fn fn_test13(x: _) -> (i32, _) { (x, x) }
|
||||
| | not allowed in type signatures
|
||||
| help: replace with the correct return type: `(i32, i32)`
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
--> $DIR/typeck_type_placeholder_item.rs:158:21
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for structs
|
||||
--> $DIR/typeck_type_placeholder_item.rs:157:21
|
||||
|
|
||||
LL | struct BadStruct<_>(_);
|
||||
| ^ not allowed in type signatures
|
||||
@@ -366,8 +366,8 @@ help: use type parameters instead
|
||||
LL | struct BadStruct<T>(T);
|
||||
| ^ ^
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
--> $DIR/typeck_type_placeholder_item.rs:163:15
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for implementations
|
||||
--> $DIR/typeck_type_placeholder_item.rs:162:15
|
||||
|
|
||||
LL | impl BadTrait<_> for BadStruct<_> {}
|
||||
| ^ ^ not allowed in type signatures
|
||||
@@ -379,14 +379,14 @@ help: use type parameters instead
|
||||
LL | impl<T> BadTrait<T> for BadStruct<T> {}
|
||||
| ^^^ ^ ^
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
--> $DIR/typeck_type_placeholder_item.rs:166:34
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for opaque types
|
||||
--> $DIR/typeck_type_placeholder_item.rs:165:34
|
||||
|
|
||||
LL | fn impl_trait() -> impl BadTrait<_> {
|
||||
| ^ not allowed in type signatures
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
--> $DIR/typeck_type_placeholder_item.rs:171:25
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for structs
|
||||
--> $DIR/typeck_type_placeholder_item.rs:170:25
|
||||
|
|
||||
LL | struct BadStruct1<_, _>(_);
|
||||
| ^ not allowed in type signatures
|
||||
@@ -396,8 +396,8 @@ help: use type parameters instead
|
||||
LL | struct BadStruct1<T, _>(T);
|
||||
| ^ ^
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
--> $DIR/typeck_type_placeholder_item.rs:176:25
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for structs
|
||||
--> $DIR/typeck_type_placeholder_item.rs:175:25
|
||||
|
|
||||
LL | struct BadStruct2<_, T>(_, T);
|
||||
| ^ not allowed in type signatures
|
||||
@@ -407,20 +407,20 @@ help: use type parameters instead
|
||||
LL | struct BadStruct2<U, T>(U, T);
|
||||
| ^ ^
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
--> $DIR/typeck_type_placeholder_item.rs:180:14
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for type aliases
|
||||
--> $DIR/typeck_type_placeholder_item.rs:179:14
|
||||
|
|
||||
LL | type X = Box<_>;
|
||||
| ^ not allowed in type signatures
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
--> $DIR/typeck_type_placeholder_item.rs:186:21
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for opaque types
|
||||
--> $DIR/typeck_type_placeholder_item.rs:185:21
|
||||
|
|
||||
LL | type Y = impl Trait<_>;
|
||||
| ^ not allowed in type signatures
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
--> $DIR/typeck_type_placeholder_item.rs:220:31
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for return types
|
||||
--> $DIR/typeck_type_placeholder_item.rs:219:31
|
||||
|
|
||||
LL | fn value() -> Option<&'static _> {
|
||||
| ----------------^-
|
||||
@@ -428,8 +428,8 @@ LL | fn value() -> Option<&'static _> {
|
||||
| | not allowed in type signatures
|
||||
| help: replace with the correct return type: `Option<&'static u8>`
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
--> $DIR/typeck_type_placeholder_item.rs:225:10
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for constants
|
||||
--> $DIR/typeck_type_placeholder_item.rs:224:10
|
||||
|
|
||||
LL | const _: Option<_> = map(value);
|
||||
| ^^^^^^^^^
|
||||
@@ -437,8 +437,8 @@ LL | const _: Option<_> = map(value);
|
||||
| not allowed in type signatures
|
||||
| help: replace with the correct type: `Option<u8>`
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
--> $DIR/typeck_type_placeholder_item.rs:144:31
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for functions
|
||||
--> $DIR/typeck_type_placeholder_item.rs:143:31
|
||||
|
|
||||
LL | fn method_test1(&self, x: _);
|
||||
| ^ not allowed in type signatures
|
||||
@@ -448,8 +448,8 @@ help: use type parameters instead
|
||||
LL | fn method_test1<T>(&self, x: T);
|
||||
| ^^^ ^
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
--> $DIR/typeck_type_placeholder_item.rs:146:31
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for functions
|
||||
--> $DIR/typeck_type_placeholder_item.rs:145:31
|
||||
|
|
||||
LL | fn method_test2(&self, x: _) -> _;
|
||||
| ^ ^ not allowed in type signatures
|
||||
@@ -461,8 +461,8 @@ help: use type parameters instead
|
||||
LL | fn method_test2<T>(&self, x: T) -> T;
|
||||
| ^^^ ^ ^
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
--> $DIR/typeck_type_placeholder_item.rs:148:31
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for functions
|
||||
--> $DIR/typeck_type_placeholder_item.rs:147:31
|
||||
|
|
||||
LL | fn method_test3(&self) -> _;
|
||||
| ^ not allowed in type signatures
|
||||
@@ -472,8 +472,8 @@ help: use type parameters instead
|
||||
LL | fn method_test3<T>(&self) -> T;
|
||||
| ^^^ ^
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
--> $DIR/typeck_type_placeholder_item.rs:150:26
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for functions
|
||||
--> $DIR/typeck_type_placeholder_item.rs:149:26
|
||||
|
|
||||
LL | fn assoc_fn_test1(x: _);
|
||||
| ^ not allowed in type signatures
|
||||
@@ -483,8 +483,8 @@ help: use type parameters instead
|
||||
LL | fn assoc_fn_test1<T>(x: T);
|
||||
| ^^^ ^
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
--> $DIR/typeck_type_placeholder_item.rs:152:26
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for functions
|
||||
--> $DIR/typeck_type_placeholder_item.rs:151:26
|
||||
|
|
||||
LL | fn assoc_fn_test2(x: _) -> _;
|
||||
| ^ ^ not allowed in type signatures
|
||||
@@ -496,8 +496,8 @@ help: use type parameters instead
|
||||
LL | fn assoc_fn_test2<T>(x: T) -> T;
|
||||
| ^^^ ^ ^
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
--> $DIR/typeck_type_placeholder_item.rs:154:28
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for functions
|
||||
--> $DIR/typeck_type_placeholder_item.rs:153:28
|
||||
|
|
||||
LL | fn assoc_fn_test3() -> _;
|
||||
| ^ not allowed in type signatures
|
||||
@@ -507,20 +507,20 @@ help: use type parameters instead
|
||||
LL | fn assoc_fn_test3<T>() -> T;
|
||||
| ^^^ ^
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
--> $DIR/typeck_type_placeholder_item.rs:194:14
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for associated types
|
||||
--> $DIR/typeck_type_placeholder_item.rs:193:14
|
||||
|
|
||||
LL | type B = _;
|
||||
| ^ not allowed in type signatures
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
--> $DIR/typeck_type_placeholder_item.rs:196:14
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for constants
|
||||
--> $DIR/typeck_type_placeholder_item.rs:195:14
|
||||
|
|
||||
LL | const C: _;
|
||||
| ^ not allowed in type signatures
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
--> $DIR/typeck_type_placeholder_item.rs:198:14
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for constants
|
||||
--> $DIR/typeck_type_placeholder_item.rs:197:14
|
||||
|
|
||||
LL | const D: _ = 42;
|
||||
| ^
|
||||
@@ -528,13 +528,13 @@ LL | const D: _ = 42;
|
||||
| not allowed in type signatures
|
||||
| help: replace with the correct type: `i32`
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
--> $DIR/typeck_type_placeholder_item.rs:201:26
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for associated types
|
||||
--> $DIR/typeck_type_placeholder_item.rs:200:26
|
||||
|
|
||||
LL | type F: std::ops::Fn(_);
|
||||
| ^ not allowed in type signatures
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for return types
|
||||
--> $DIR/typeck_type_placeholder_item.rs:44:24
|
||||
|
|
||||
LL | fn test9(&self) -> _ { () }
|
||||
@@ -543,7 +543,7 @@ LL | fn test9(&self) -> _ { () }
|
||||
| not allowed in type signatures
|
||||
| help: replace with the correct return type: `()`
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for functions
|
||||
--> $DIR/typeck_type_placeholder_item.rs:47:27
|
||||
|
|
||||
LL | fn test10(&self, _x : _) { }
|
||||
@@ -554,7 +554,7 @@ help: use type parameters instead
|
||||
LL | fn test10<T>(&self, _x : T) { }
|
||||
| ^^^ ^
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for return types
|
||||
--> $DIR/typeck_type_placeholder_item.rs:62:24
|
||||
|
|
||||
LL | fn clone(&self) -> _ { Test9 }
|
||||
@@ -563,7 +563,7 @@ LL | fn clone(&self) -> _ { Test9 }
|
||||
| not allowed in type signatures
|
||||
| help: replace with the correct return type: `Test9`
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for functions
|
||||
--> $DIR/typeck_type_placeholder_item.rs:65:37
|
||||
|
|
||||
LL | fn clone_from(&mut self, other: _) { *self = Test9; }
|
||||
@@ -574,8 +574,8 @@ help: use type parameters instead
|
||||
LL | fn clone_from<T>(&mut self, other: T) { *self = Test9; }
|
||||
| ^^^ ^
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
--> $DIR/typeck_type_placeholder_item.rs:111:31
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for return types
|
||||
--> $DIR/typeck_type_placeholder_item.rs:110:31
|
||||
|
|
||||
LL | fn fn_test9(&self) -> _ { () }
|
||||
| ^
|
||||
@@ -583,8 +583,8 @@ LL | fn fn_test9(&self) -> _ { () }
|
||||
| not allowed in type signatures
|
||||
| help: replace with the correct return type: `()`
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
--> $DIR/typeck_type_placeholder_item.rs:114:34
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for functions
|
||||
--> $DIR/typeck_type_placeholder_item.rs:113:34
|
||||
|
|
||||
LL | fn fn_test10(&self, _x : _) { }
|
||||
| ^ not allowed in type signatures
|
||||
@@ -594,8 +594,8 @@ help: use type parameters instead
|
||||
LL | fn fn_test10<T>(&self, _x : T) { }
|
||||
| ^^^ ^
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
--> $DIR/typeck_type_placeholder_item.rs:119:28
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for return types
|
||||
--> $DIR/typeck_type_placeholder_item.rs:118:28
|
||||
|
|
||||
LL | fn clone(&self) -> _ { FnTest9 }
|
||||
| ^
|
||||
@@ -603,8 +603,8 @@ LL | fn clone(&self) -> _ { FnTest9 }
|
||||
| not allowed in type signatures
|
||||
| help: replace with the correct return type: `FnTest9`
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
--> $DIR/typeck_type_placeholder_item.rs:122:41
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for functions
|
||||
--> $DIR/typeck_type_placeholder_item.rs:121:41
|
||||
|
|
||||
LL | fn clone_from(&mut self, other: _) { *self = FnTest9; }
|
||||
| ^ not allowed in type signatures
|
||||
@@ -614,26 +614,26 @@ help: use type parameters instead
|
||||
LL | fn clone_from<T>(&mut self, other: T) { *self = FnTest9; }
|
||||
| ^^^ ^
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
--> $DIR/typeck_type_placeholder_item.rs:205:14
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for associated types
|
||||
--> $DIR/typeck_type_placeholder_item.rs:204:14
|
||||
|
|
||||
LL | type A = _;
|
||||
| ^ not allowed in type signatures
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
--> $DIR/typeck_type_placeholder_item.rs:207:14
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for associated types
|
||||
--> $DIR/typeck_type_placeholder_item.rs:206:14
|
||||
|
|
||||
LL | type B = _;
|
||||
| ^ not allowed in type signatures
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
--> $DIR/typeck_type_placeholder_item.rs:209:14
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for constants
|
||||
--> $DIR/typeck_type_placeholder_item.rs:208:14
|
||||
|
|
||||
LL | const C: _;
|
||||
| ^ not allowed in type signatures
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
--> $DIR/typeck_type_placeholder_item.rs:212:14
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for constants
|
||||
--> $DIR/typeck_type_placeholder_item.rs:211:14
|
||||
|
|
||||
LL | const D: _ = 42;
|
||||
| ^
|
||||
|
||||
@@ -1,35 +1,35 @@
|
||||
error: expected identifier, found reserved identifier `_`
|
||||
--> $DIR/typeck_type_placeholder_item.rs:158:18
|
||||
--> $DIR/typeck_type_placeholder_item.rs:157:18
|
||||
|
|
||||
LL | struct BadStruct<_>(_);
|
||||
| ^ expected identifier, found reserved identifier
|
||||
|
||||
error: expected identifier, found reserved identifier `_`
|
||||
--> $DIR/typeck_type_placeholder_item.rs:161:16
|
||||
--> $DIR/typeck_type_placeholder_item.rs:160:16
|
||||
|
|
||||
LL | trait BadTrait<_> {}
|
||||
| ^ expected identifier, found reserved identifier
|
||||
|
||||
error: expected identifier, found reserved identifier `_`
|
||||
--> $DIR/typeck_type_placeholder_item.rs:171:19
|
||||
--> $DIR/typeck_type_placeholder_item.rs:170:19
|
||||
|
|
||||
LL | struct BadStruct1<_, _>(_);
|
||||
| ^ expected identifier, found reserved identifier
|
||||
|
||||
error: expected identifier, found reserved identifier `_`
|
||||
--> $DIR/typeck_type_placeholder_item.rs:171:22
|
||||
--> $DIR/typeck_type_placeholder_item.rs:170:22
|
||||
|
|
||||
LL | struct BadStruct1<_, _>(_);
|
||||
| ^ expected identifier, found reserved identifier
|
||||
|
||||
error: expected identifier, found reserved identifier `_`
|
||||
--> $DIR/typeck_type_placeholder_item.rs:176:19
|
||||
--> $DIR/typeck_type_placeholder_item.rs:175:19
|
||||
|
|
||||
LL | struct BadStruct2<_, T>(_, T);
|
||||
| ^ expected identifier, found reserved identifier
|
||||
|
||||
error: associated constant in `impl` without body
|
||||
--> $DIR/typeck_type_placeholder_item.rs:209:5
|
||||
--> $DIR/typeck_type_placeholder_item.rs:208:5
|
||||
|
|
||||
LL | const C: _;
|
||||
| ^^^^^^^^^^-
|
||||
@@ -37,14 +37,14 @@ LL | const C: _;
|
||||
| help: provide a definition for the constant: `= <expr>;`
|
||||
|
||||
error[E0403]: the name `_` is already used for a generic parameter in this item's generic parameters
|
||||
--> $DIR/typeck_type_placeholder_item.rs:171:22
|
||||
--> $DIR/typeck_type_placeholder_item.rs:170:22
|
||||
|
|
||||
LL | struct BadStruct1<_, _>(_);
|
||||
| - ^ already used
|
||||
| |
|
||||
| first use of `_`
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for return types
|
||||
--> $DIR/typeck_type_placeholder_item.rs:10:14
|
||||
|
|
||||
LL | fn test() -> _ { 5 }
|
||||
@@ -53,7 +53,7 @@ LL | fn test() -> _ { 5 }
|
||||
| not allowed in type signatures
|
||||
| help: replace with the correct return type: `i32`
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for return types
|
||||
--> $DIR/typeck_type_placeholder_item.rs:13:16
|
||||
|
|
||||
LL | fn test2() -> (_, _) { (5, 5) }
|
||||
@@ -63,7 +63,7 @@ LL | fn test2() -> (_, _) { (5, 5) }
|
||||
| |not allowed in type signatures
|
||||
| help: replace with the correct return type: `(i32, i32)`
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for static variables
|
||||
--> $DIR/typeck_type_placeholder_item.rs:16:15
|
||||
|
|
||||
LL | static TEST3: _ = "test";
|
||||
@@ -72,7 +72,7 @@ LL | static TEST3: _ = "test";
|
||||
| not allowed in type signatures
|
||||
| help: replace with the correct type: `&str`
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for static variables
|
||||
--> $DIR/typeck_type_placeholder_item.rs:19:15
|
||||
|
|
||||
LL | static TEST4: _ = 145;
|
||||
@@ -81,13 +81,13 @@ LL | static TEST4: _ = 145;
|
||||
| not allowed in type signatures
|
||||
| help: replace with the correct type: `i32`
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for static variables
|
||||
--> $DIR/typeck_type_placeholder_item.rs:22:15
|
||||
|
|
||||
LL | static TEST5: (_, _) = (1, 2);
|
||||
| ^^^^^^ not allowed in type signatures
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for functions
|
||||
--> $DIR/typeck_type_placeholder_item.rs:25:13
|
||||
|
|
||||
LL | fn test6(_: _) { }
|
||||
@@ -98,7 +98,7 @@ help: use type parameters instead
|
||||
LL | fn test6<T>(_: T) { }
|
||||
| ^^^ ^
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for functions
|
||||
--> $DIR/typeck_type_placeholder_item.rs:28:18
|
||||
|
|
||||
LL | fn test6_b<T>(_: _, _: T) { }
|
||||
@@ -109,7 +109,7 @@ help: use type parameters instead
|
||||
LL | fn test6_b<T, U>(_: U, _: T) { }
|
||||
| ^^^ ^
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for functions
|
||||
--> $DIR/typeck_type_placeholder_item.rs:31:30
|
||||
|
|
||||
LL | fn test6_c<T, K, L, A, B>(_: _, _: (T, K, L, A, B)) { }
|
||||
@@ -120,7 +120,7 @@ help: use type parameters instead
|
||||
LL | fn test6_c<T, K, L, A, B, U>(_: U, _: (T, K, L, A, B)) { }
|
||||
| ^^^ ^
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for functions
|
||||
--> $DIR/typeck_type_placeholder_item.rs:34:13
|
||||
|
|
||||
LL | fn test7(x: _) { let _x: usize = x; }
|
||||
@@ -131,7 +131,7 @@ help: use type parameters instead
|
||||
LL | fn test7<T>(x: T) { let _x: usize = x; }
|
||||
| ^^^ ^
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for functions
|
||||
--> $DIR/typeck_type_placeholder_item.rs:37:22
|
||||
|
|
||||
LL | fn test8(_f: fn() -> _) { }
|
||||
@@ -140,7 +140,7 @@ LL | fn test8(_f: fn() -> _) { }
|
||||
| not allowed in type signatures
|
||||
| help: use type parameters instead: `T`
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for functions
|
||||
--> $DIR/typeck_type_placeholder_item.rs:37:22
|
||||
|
|
||||
LL | fn test8(_f: fn() -> _) { }
|
||||
@@ -151,7 +151,7 @@ help: use type parameters instead
|
||||
LL | fn test8<T>(_f: fn() -> T) { }
|
||||
| ^^^ ^
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for return types
|
||||
--> $DIR/typeck_type_placeholder_item.rs:51:26
|
||||
|
|
||||
LL | fn test11(x: &usize) -> &_ {
|
||||
@@ -160,7 +160,7 @@ LL | fn test11(x: &usize) -> &_ {
|
||||
| |not allowed in type signatures
|
||||
| help: replace with the correct return type: `&'static &'static usize`
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for return types
|
||||
--> $DIR/typeck_type_placeholder_item.rs:56:52
|
||||
|
|
||||
LL | unsafe fn test12(x: *const usize) -> *const *const _ {
|
||||
@@ -169,7 +169,7 @@ LL | unsafe fn test12(x: *const usize) -> *const *const _ {
|
||||
| | not allowed in type signatures
|
||||
| help: replace with the correct return type: `*const *const usize`
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for structs
|
||||
--> $DIR/typeck_type_placeholder_item.rs:70:8
|
||||
|
|
||||
LL | a: _,
|
||||
@@ -192,9 +192,9 @@ error: missing type for `static` item
|
||||
--> $DIR/typeck_type_placeholder_item.rs:76:12
|
||||
|
|
||||
LL | static A = 42;
|
||||
| ^ help: provide a type for the item: `A: i32`
|
||||
| ^ help: provide a type for the static variable: `A: i32`
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for static variables
|
||||
--> $DIR/typeck_type_placeholder_item.rs:78:15
|
||||
|
|
||||
LL | static B: _ = 42;
|
||||
@@ -203,14 +203,14 @@ LL | static B: _ = 42;
|
||||
| not allowed in type signatures
|
||||
| help: replace with the correct type: `i32`
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for static variables
|
||||
--> $DIR/typeck_type_placeholder_item.rs:80:15
|
||||
|
|
||||
LL | static C: Option<_> = Some(42);
|
||||
| ^^^^^^^^^ not allowed in type signatures
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
--> $DIR/typeck_type_placeholder_item.rs:83:21
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for return types
|
||||
--> $DIR/typeck_type_placeholder_item.rs:82:21
|
||||
|
|
||||
LL | fn fn_test() -> _ { 5 }
|
||||
| ^
|
||||
@@ -218,8 +218,8 @@ LL | fn fn_test() -> _ { 5 }
|
||||
| not allowed in type signatures
|
||||
| help: replace with the correct return type: `i32`
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
--> $DIR/typeck_type_placeholder_item.rs:86:23
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for return types
|
||||
--> $DIR/typeck_type_placeholder_item.rs:85:23
|
||||
|
|
||||
LL | fn fn_test2() -> (_, _) { (5, 5) }
|
||||
| -^--^-
|
||||
@@ -228,8 +228,8 @@ LL | fn fn_test2() -> (_, _) { (5, 5) }
|
||||
| |not allowed in type signatures
|
||||
| help: replace with the correct return type: `(i32, i32)`
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
--> $DIR/typeck_type_placeholder_item.rs:89:22
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for static variables
|
||||
--> $DIR/typeck_type_placeholder_item.rs:88:22
|
||||
|
|
||||
LL | static FN_TEST3: _ = "test";
|
||||
| ^
|
||||
@@ -237,8 +237,8 @@ LL | static FN_TEST3: _ = "test";
|
||||
| not allowed in type signatures
|
||||
| help: replace with the correct type: `&str`
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
--> $DIR/typeck_type_placeholder_item.rs:92:22
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for static variables
|
||||
--> $DIR/typeck_type_placeholder_item.rs:91:22
|
||||
|
|
||||
LL | static FN_TEST4: _ = 145;
|
||||
| ^
|
||||
@@ -246,14 +246,14 @@ LL | static FN_TEST4: _ = 145;
|
||||
| not allowed in type signatures
|
||||
| help: replace with the correct type: `i32`
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
--> $DIR/typeck_type_placeholder_item.rs:95:22
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for static variables
|
||||
--> $DIR/typeck_type_placeholder_item.rs:94:22
|
||||
|
|
||||
LL | static FN_TEST5: (_, _) = (1, 2);
|
||||
| ^^^^^^ not allowed in type signatures
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
--> $DIR/typeck_type_placeholder_item.rs:98:20
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for functions
|
||||
--> $DIR/typeck_type_placeholder_item.rs:97:20
|
||||
|
|
||||
LL | fn fn_test6(_: _) { }
|
||||
| ^ not allowed in type signatures
|
||||
@@ -263,8 +263,8 @@ help: use type parameters instead
|
||||
LL | fn fn_test6<T>(_: T) { }
|
||||
| ^^^ ^
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
--> $DIR/typeck_type_placeholder_item.rs:101:20
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for functions
|
||||
--> $DIR/typeck_type_placeholder_item.rs:100:20
|
||||
|
|
||||
LL | fn fn_test7(x: _) { let _x: usize = x; }
|
||||
| ^ not allowed in type signatures
|
||||
@@ -274,8 +274,8 @@ help: use type parameters instead
|
||||
LL | fn fn_test7<T>(x: T) { let _x: usize = x; }
|
||||
| ^^^ ^
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
--> $DIR/typeck_type_placeholder_item.rs:104:29
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for functions
|
||||
--> $DIR/typeck_type_placeholder_item.rs:103:29
|
||||
|
|
||||
LL | fn fn_test8(_f: fn() -> _) { }
|
||||
| ^
|
||||
@@ -283,8 +283,8 @@ LL | fn fn_test8(_f: fn() -> _) { }
|
||||
| not allowed in type signatures
|
||||
| help: use type parameters instead: `T`
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
--> $DIR/typeck_type_placeholder_item.rs:104:29
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for functions
|
||||
--> $DIR/typeck_type_placeholder_item.rs:103:29
|
||||
|
|
||||
LL | fn fn_test8(_f: fn() -> _) { }
|
||||
| ^ not allowed in type signatures
|
||||
@@ -294,8 +294,8 @@ help: use type parameters instead
|
||||
LL | fn fn_test8<T>(_f: fn() -> T) { }
|
||||
| ^^^ ^
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
--> $DIR/typeck_type_placeholder_item.rs:127:12
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for structs
|
||||
--> $DIR/typeck_type_placeholder_item.rs:126:12
|
||||
|
|
||||
LL | a: _,
|
||||
| ^ not allowed in type signatures
|
||||
@@ -314,21 +314,21 @@ LL | b: (T, T),
|
||||
|
|
||||
|
||||
error[E0282]: type annotations needed
|
||||
--> $DIR/typeck_type_placeholder_item.rs:132:18
|
||||
--> $DIR/typeck_type_placeholder_item.rs:131:18
|
||||
|
|
||||
LL | fn fn_test11(_: _) -> (_, _) { panic!() }
|
||||
| ^ cannot infer type
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
--> $DIR/typeck_type_placeholder_item.rs:132:28
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for return types
|
||||
--> $DIR/typeck_type_placeholder_item.rs:131:28
|
||||
|
|
||||
LL | fn fn_test11(_: _) -> (_, _) { panic!() }
|
||||
| ^ ^ not allowed in type signatures
|
||||
| |
|
||||
| not allowed in type signatures
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
--> $DIR/typeck_type_placeholder_item.rs:136:30
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for return types
|
||||
--> $DIR/typeck_type_placeholder_item.rs:135:30
|
||||
|
|
||||
LL | fn fn_test12(x: i32) -> (_, _) { (x, x) }
|
||||
| -^--^-
|
||||
@@ -337,8 +337,8 @@ LL | fn fn_test12(x: i32) -> (_, _) { (x, x) }
|
||||
| |not allowed in type signatures
|
||||
| help: replace with the correct return type: `(i32, i32)`
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
--> $DIR/typeck_type_placeholder_item.rs:139:33
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for return types
|
||||
--> $DIR/typeck_type_placeholder_item.rs:138:33
|
||||
|
|
||||
LL | fn fn_test13(x: _) -> (i32, _) { (x, x) }
|
||||
| ------^-
|
||||
@@ -346,8 +346,8 @@ LL | fn fn_test13(x: _) -> (i32, _) { (x, x) }
|
||||
| | not allowed in type signatures
|
||||
| help: replace with the correct return type: `(i32, i32)`
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
--> $DIR/typeck_type_placeholder_item.rs:158:21
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for structs
|
||||
--> $DIR/typeck_type_placeholder_item.rs:157:21
|
||||
|
|
||||
LL | struct BadStruct<_>(_);
|
||||
| ^ not allowed in type signatures
|
||||
@@ -357,8 +357,8 @@ help: use type parameters instead
|
||||
LL | struct BadStruct<T>(T);
|
||||
| ^ ^
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
--> $DIR/typeck_type_placeholder_item.rs:163:15
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for implementations
|
||||
--> $DIR/typeck_type_placeholder_item.rs:162:15
|
||||
|
|
||||
LL | impl BadTrait<_> for BadStruct<_> {}
|
||||
| ^ ^ not allowed in type signatures
|
||||
@@ -370,14 +370,14 @@ help: use type parameters instead
|
||||
LL | impl<T> BadTrait<T> for BadStruct<T> {}
|
||||
| ^^^ ^ ^
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
--> $DIR/typeck_type_placeholder_item.rs:166:34
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for opaque types
|
||||
--> $DIR/typeck_type_placeholder_item.rs:165:34
|
||||
|
|
||||
LL | fn impl_trait() -> impl BadTrait<_> {
|
||||
| ^ not allowed in type signatures
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
--> $DIR/typeck_type_placeholder_item.rs:171:25
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for structs
|
||||
--> $DIR/typeck_type_placeholder_item.rs:170:25
|
||||
|
|
||||
LL | struct BadStruct1<_, _>(_);
|
||||
| ^ not allowed in type signatures
|
||||
@@ -387,8 +387,8 @@ help: use type parameters instead
|
||||
LL | struct BadStruct1<T, _>(T);
|
||||
| ^ ^
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
--> $DIR/typeck_type_placeholder_item.rs:176:25
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for structs
|
||||
--> $DIR/typeck_type_placeholder_item.rs:175:25
|
||||
|
|
||||
LL | struct BadStruct2<_, T>(_, T);
|
||||
| ^ not allowed in type signatures
|
||||
@@ -398,20 +398,20 @@ help: use type parameters instead
|
||||
LL | struct BadStruct2<U, T>(U, T);
|
||||
| ^ ^
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
--> $DIR/typeck_type_placeholder_item.rs:180:14
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for type aliases
|
||||
--> $DIR/typeck_type_placeholder_item.rs:179:14
|
||||
|
|
||||
LL | type X = Box<_>;
|
||||
| ^ not allowed in type signatures
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
--> $DIR/typeck_type_placeholder_item.rs:186:21
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for opaque types
|
||||
--> $DIR/typeck_type_placeholder_item.rs:185:21
|
||||
|
|
||||
LL | type Y = impl Trait<_>;
|
||||
| ^ not allowed in type signatures
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
--> $DIR/typeck_type_placeholder_item.rs:220:31
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for return types
|
||||
--> $DIR/typeck_type_placeholder_item.rs:219:31
|
||||
|
|
||||
LL | fn value() -> Option<&'static _> {
|
||||
| ----------------^-
|
||||
@@ -419,8 +419,8 @@ LL | fn value() -> Option<&'static _> {
|
||||
| | not allowed in type signatures
|
||||
| help: replace with the correct return type: `Option<&'static u8>`
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
--> $DIR/typeck_type_placeholder_item.rs:225:10
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for constants
|
||||
--> $DIR/typeck_type_placeholder_item.rs:224:10
|
||||
|
|
||||
LL | const _: Option<_> = map(value);
|
||||
| ^^^^^^^^^
|
||||
@@ -428,8 +428,8 @@ LL | const _: Option<_> = map(value);
|
||||
| not allowed in type signatures
|
||||
| help: replace with the correct type: `Option<u8>`
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
--> $DIR/typeck_type_placeholder_item.rs:144:31
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for functions
|
||||
--> $DIR/typeck_type_placeholder_item.rs:143:31
|
||||
|
|
||||
LL | fn method_test1(&self, x: _);
|
||||
| ^ not allowed in type signatures
|
||||
@@ -439,8 +439,8 @@ help: use type parameters instead
|
||||
LL | fn method_test1<T>(&self, x: T);
|
||||
| ^^^ ^
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
--> $DIR/typeck_type_placeholder_item.rs:146:31
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for functions
|
||||
--> $DIR/typeck_type_placeholder_item.rs:145:31
|
||||
|
|
||||
LL | fn method_test2(&self, x: _) -> _;
|
||||
| ^ ^ not allowed in type signatures
|
||||
@@ -452,8 +452,8 @@ help: use type parameters instead
|
||||
LL | fn method_test2<T>(&self, x: T) -> T;
|
||||
| ^^^ ^ ^
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
--> $DIR/typeck_type_placeholder_item.rs:148:31
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for functions
|
||||
--> $DIR/typeck_type_placeholder_item.rs:147:31
|
||||
|
|
||||
LL | fn method_test3(&self) -> _;
|
||||
| ^ not allowed in type signatures
|
||||
@@ -463,8 +463,8 @@ help: use type parameters instead
|
||||
LL | fn method_test3<T>(&self) -> T;
|
||||
| ^^^ ^
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
--> $DIR/typeck_type_placeholder_item.rs:150:26
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for functions
|
||||
--> $DIR/typeck_type_placeholder_item.rs:149:26
|
||||
|
|
||||
LL | fn assoc_fn_test1(x: _);
|
||||
| ^ not allowed in type signatures
|
||||
@@ -474,8 +474,8 @@ help: use type parameters instead
|
||||
LL | fn assoc_fn_test1<T>(x: T);
|
||||
| ^^^ ^
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
--> $DIR/typeck_type_placeholder_item.rs:152:26
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for functions
|
||||
--> $DIR/typeck_type_placeholder_item.rs:151:26
|
||||
|
|
||||
LL | fn assoc_fn_test2(x: _) -> _;
|
||||
| ^ ^ not allowed in type signatures
|
||||
@@ -487,8 +487,8 @@ help: use type parameters instead
|
||||
LL | fn assoc_fn_test2<T>(x: T) -> T;
|
||||
| ^^^ ^ ^
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
--> $DIR/typeck_type_placeholder_item.rs:154:28
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for functions
|
||||
--> $DIR/typeck_type_placeholder_item.rs:153:28
|
||||
|
|
||||
LL | fn assoc_fn_test3() -> _;
|
||||
| ^ not allowed in type signatures
|
||||
@@ -498,20 +498,20 @@ help: use type parameters instead
|
||||
LL | fn assoc_fn_test3<T>() -> T;
|
||||
| ^^^ ^
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
--> $DIR/typeck_type_placeholder_item.rs:194:14
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for associated types
|
||||
--> $DIR/typeck_type_placeholder_item.rs:193:14
|
||||
|
|
||||
LL | type B = _;
|
||||
| ^ not allowed in type signatures
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
--> $DIR/typeck_type_placeholder_item.rs:196:14
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for constants
|
||||
--> $DIR/typeck_type_placeholder_item.rs:195:14
|
||||
|
|
||||
LL | const C: _;
|
||||
| ^ not allowed in type signatures
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
--> $DIR/typeck_type_placeholder_item.rs:198:14
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for constants
|
||||
--> $DIR/typeck_type_placeholder_item.rs:197:14
|
||||
|
|
||||
LL | const D: _ = 42;
|
||||
| ^
|
||||
@@ -519,13 +519,13 @@ LL | const D: _ = 42;
|
||||
| not allowed in type signatures
|
||||
| help: replace with the correct type: `i32`
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
--> $DIR/typeck_type_placeholder_item.rs:201:26
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for associated types
|
||||
--> $DIR/typeck_type_placeholder_item.rs:200:26
|
||||
|
|
||||
LL | type F: std::ops::Fn(_);
|
||||
| ^ not allowed in type signatures
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for return types
|
||||
--> $DIR/typeck_type_placeholder_item.rs:44:24
|
||||
|
|
||||
LL | fn test9(&self) -> _ { () }
|
||||
@@ -534,7 +534,7 @@ LL | fn test9(&self) -> _ { () }
|
||||
| not allowed in type signatures
|
||||
| help: replace with the correct return type: `()`
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for functions
|
||||
--> $DIR/typeck_type_placeholder_item.rs:47:27
|
||||
|
|
||||
LL | fn test10(&self, _x : _) { }
|
||||
@@ -545,7 +545,7 @@ help: use type parameters instead
|
||||
LL | fn test10<T>(&self, _x : T) { }
|
||||
| ^^^ ^
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for return types
|
||||
--> $DIR/typeck_type_placeholder_item.rs:62:24
|
||||
|
|
||||
LL | fn clone(&self) -> _ { Test9 }
|
||||
@@ -554,7 +554,7 @@ LL | fn clone(&self) -> _ { Test9 }
|
||||
| not allowed in type signatures
|
||||
| help: replace with the correct return type: `Test9`
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for functions
|
||||
--> $DIR/typeck_type_placeholder_item.rs:65:37
|
||||
|
|
||||
LL | fn clone_from(&mut self, other: _) { *self = Test9; }
|
||||
@@ -565,8 +565,8 @@ help: use type parameters instead
|
||||
LL | fn clone_from<T>(&mut self, other: T) { *self = Test9; }
|
||||
| ^^^ ^
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
--> $DIR/typeck_type_placeholder_item.rs:111:31
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for return types
|
||||
--> $DIR/typeck_type_placeholder_item.rs:110:31
|
||||
|
|
||||
LL | fn fn_test9(&self) -> _ { () }
|
||||
| ^
|
||||
@@ -574,8 +574,8 @@ LL | fn fn_test9(&self) -> _ { () }
|
||||
| not allowed in type signatures
|
||||
| help: replace with the correct return type: `()`
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
--> $DIR/typeck_type_placeholder_item.rs:114:34
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for functions
|
||||
--> $DIR/typeck_type_placeholder_item.rs:113:34
|
||||
|
|
||||
LL | fn fn_test10(&self, _x : _) { }
|
||||
| ^ not allowed in type signatures
|
||||
@@ -585,8 +585,8 @@ help: use type parameters instead
|
||||
LL | fn fn_test10<T>(&self, _x : T) { }
|
||||
| ^^^ ^
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
--> $DIR/typeck_type_placeholder_item.rs:119:28
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for return types
|
||||
--> $DIR/typeck_type_placeholder_item.rs:118:28
|
||||
|
|
||||
LL | fn clone(&self) -> _ { FnTest9 }
|
||||
| ^
|
||||
@@ -594,8 +594,8 @@ LL | fn clone(&self) -> _ { FnTest9 }
|
||||
| not allowed in type signatures
|
||||
| help: replace with the correct return type: `FnTest9`
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
--> $DIR/typeck_type_placeholder_item.rs:122:41
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for functions
|
||||
--> $DIR/typeck_type_placeholder_item.rs:121:41
|
||||
|
|
||||
LL | fn clone_from(&mut self, other: _) { *self = FnTest9; }
|
||||
| ^ not allowed in type signatures
|
||||
@@ -605,26 +605,26 @@ help: use type parameters instead
|
||||
LL | fn clone_from<T>(&mut self, other: T) { *self = FnTest9; }
|
||||
| ^^^ ^
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
--> $DIR/typeck_type_placeholder_item.rs:205:14
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for associated types
|
||||
--> $DIR/typeck_type_placeholder_item.rs:204:14
|
||||
|
|
||||
LL | type A = _;
|
||||
| ^ not allowed in type signatures
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
--> $DIR/typeck_type_placeholder_item.rs:207:14
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for associated types
|
||||
--> $DIR/typeck_type_placeholder_item.rs:206:14
|
||||
|
|
||||
LL | type B = _;
|
||||
| ^ not allowed in type signatures
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
--> $DIR/typeck_type_placeholder_item.rs:209:14
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for constants
|
||||
--> $DIR/typeck_type_placeholder_item.rs:208:14
|
||||
|
|
||||
LL | const C: _;
|
||||
| ^ not allowed in type signatures
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
--> $DIR/typeck_type_placeholder_item.rs:212:14
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for constants
|
||||
--> $DIR/typeck_type_placeholder_item.rs:211:14
|
||||
|
|
||||
LL | const D: _ = 42;
|
||||
| ^
|
||||
|
||||
@@ -8,67 +8,67 @@
|
||||
// inference by using the `_` type placeholder.
|
||||
|
||||
fn test() -> _ { 5 }
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures for return types
|
||||
|
||||
fn test2() -> (_, _) { (5, 5) }
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures for return types
|
||||
|
||||
static TEST3: _ = "test";
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures for static variables
|
||||
|
||||
static TEST4: _ = 145;
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures for static variables
|
||||
|
||||
static TEST5: (_, _) = (1, 2);
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures for static variables
|
||||
|
||||
fn test6(_: _) { }
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures for functions
|
||||
|
||||
fn test6_b<T>(_: _, _: T) { }
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures for functions
|
||||
|
||||
fn test6_c<T, K, L, A, B>(_: _, _: (T, K, L, A, B)) { }
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures for functions
|
||||
|
||||
fn test7(x: _) { let _x: usize = x; }
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures for functions
|
||||
|
||||
fn test8(_f: fn() -> _) { }
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
|
||||
//~^^ ERROR the type placeholder `_` is not allowed within types on item signatures
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures for functions
|
||||
//~^^ ERROR the type placeholder `_` is not allowed within types on item signatures for functions
|
||||
|
||||
struct Test9;
|
||||
|
||||
impl Test9 {
|
||||
fn test9(&self) -> _ { () }
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures for return types
|
||||
|
||||
fn test10(&self, _x : _) { }
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures for functions
|
||||
}
|
||||
|
||||
fn test11(x: &usize) -> &_ {
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures for return types
|
||||
&x
|
||||
}
|
||||
|
||||
unsafe fn test12(x: *const usize) -> *const *const _ {
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures for return types
|
||||
&x
|
||||
}
|
||||
|
||||
impl Clone for Test9 {
|
||||
fn clone(&self) -> _ { Test9 }
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures for return types
|
||||
|
||||
fn clone_from(&mut self, other: _) { *self = Test9; }
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures for functions
|
||||
}
|
||||
|
||||
struct Test10 {
|
||||
a: _,
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures for structs
|
||||
b: (_, _),
|
||||
}
|
||||
|
||||
@@ -76,95 +76,94 @@ pub fn main() {
|
||||
static A = 42;
|
||||
//~^ ERROR missing type for `static` item
|
||||
static B: _ = 42;
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures for static variables
|
||||
static C: Option<_> = Some(42);
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
|
||||
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures for static variables
|
||||
fn fn_test() -> _ { 5 }
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures for return types
|
||||
|
||||
fn fn_test2() -> (_, _) { (5, 5) }
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures for return types
|
||||
|
||||
static FN_TEST3: _ = "test";
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures for static variables
|
||||
|
||||
static FN_TEST4: _ = 145;
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures for static variables
|
||||
|
||||
static FN_TEST5: (_, _) = (1, 2);
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures for static variables
|
||||
|
||||
fn fn_test6(_: _) { }
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures for functions
|
||||
|
||||
fn fn_test7(x: _) { let _x: usize = x; }
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures for functions
|
||||
|
||||
fn fn_test8(_f: fn() -> _) { }
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
|
||||
//~^^ ERROR the type placeholder `_` is not allowed within types on item signatures
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures for functions
|
||||
//~^^ ERROR the type placeholder `_` is not allowed within types on item signatures for functions
|
||||
|
||||
struct FnTest9;
|
||||
|
||||
impl FnTest9 {
|
||||
fn fn_test9(&self) -> _ { () }
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures for return types
|
||||
|
||||
fn fn_test10(&self, _x : _) { }
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures for functions
|
||||
}
|
||||
|
||||
impl Clone for FnTest9 {
|
||||
fn clone(&self) -> _ { FnTest9 }
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures for return types
|
||||
|
||||
fn clone_from(&mut self, other: _) { *self = FnTest9; }
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures for functions
|
||||
}
|
||||
|
||||
struct FnTest10 {
|
||||
a: _,
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures for structs
|
||||
b: (_, _),
|
||||
}
|
||||
|
||||
fn fn_test11(_: _) -> (_, _) { panic!() }
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures for return types
|
||||
//~| ERROR type annotations needed
|
||||
|
||||
fn fn_test12(x: i32) -> (_, _) { (x, x) }
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures for return types
|
||||
|
||||
fn fn_test13(x: _) -> (i32, _) { (x, x) }
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures for return types
|
||||
}
|
||||
|
||||
trait T {
|
||||
fn method_test1(&self, x: _);
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures for functions
|
||||
fn method_test2(&self, x: _) -> _;
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures for functions
|
||||
fn method_test3(&self) -> _;
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures for functions
|
||||
fn assoc_fn_test1(x: _);
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures for functions
|
||||
fn assoc_fn_test2(x: _) -> _;
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures for functions
|
||||
fn assoc_fn_test3() -> _;
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures for functions
|
||||
}
|
||||
|
||||
struct BadStruct<_>(_);
|
||||
//~^ ERROR expected identifier, found reserved identifier `_`
|
||||
//~| ERROR the type placeholder `_` is not allowed within types on item signatures
|
||||
//~| ERROR the type placeholder `_` is not allowed within types on item signatures for structs
|
||||
trait BadTrait<_> {}
|
||||
//~^ ERROR expected identifier, found reserved identifier `_`
|
||||
impl BadTrait<_> for BadStruct<_> {}
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures for implementations
|
||||
|
||||
fn impl_trait() -> impl BadTrait<_> {
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures for opaque types
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
@@ -172,19 +171,19 @@ fn impl_trait() -> impl BadTrait<_> {
|
||||
//~^ ERROR expected identifier, found reserved identifier `_`
|
||||
//~| ERROR expected identifier, found reserved identifier `_`
|
||||
//~| ERROR the name `_` is already used
|
||||
//~| ERROR the type placeholder `_` is not allowed within types on item signatures
|
||||
//~| ERROR the type placeholder `_` is not allowed within types on item signatures for structs
|
||||
struct BadStruct2<_, T>(_, T);
|
||||
//~^ ERROR expected identifier, found reserved identifier `_`
|
||||
//~| ERROR the type placeholder `_` is not allowed within types on item signatures
|
||||
//~| ERROR the type placeholder `_` is not allowed within types on item signatures for structs
|
||||
|
||||
type X = Box<_>;
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures for type aliases
|
||||
|
||||
struct Struct;
|
||||
trait Trait<T> {}
|
||||
impl Trait<usize> for Struct {}
|
||||
type Y = impl Trait<_>;
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures for opaque types
|
||||
fn foo() -> Y {
|
||||
Struct
|
||||
}
|
||||
@@ -192,25 +191,25 @@ fn foo() -> Y {
|
||||
trait Qux {
|
||||
type A;
|
||||
type B = _;
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures for associated types
|
||||
const C: _;
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures for constants
|
||||
const D: _ = 42;
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures for constants
|
||||
// type E: _; // FIXME: make the parser propagate the existence of `B`
|
||||
type F: std::ops::Fn(_);
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures for associated types
|
||||
}
|
||||
impl Qux for Struct {
|
||||
type A = _;
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures for associated types
|
||||
type B = _;
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures for associated types
|
||||
const C: _;
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures for constants
|
||||
//~| ERROR associated constant in `impl` without body
|
||||
const D: _ = 42;
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures for constants
|
||||
}
|
||||
|
||||
fn map<T>(_: fn() -> Option<&'static T>) -> Option<T> {
|
||||
@@ -218,9 +217,9 @@ fn map<T>(_: fn() -> Option<&'static T>) -> Option<T> {
|
||||
}
|
||||
|
||||
fn value() -> Option<&'static _> {
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures for return types
|
||||
Option::<&'static u8>::None
|
||||
}
|
||||
|
||||
const _: Option<_> = map(value);
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures for constants
|
||||
|
||||
@@ -2,27 +2,27 @@
|
||||
// using the `_` type placeholder.
|
||||
|
||||
fn test1() -> _ { Some(42) }
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures for return types
|
||||
|
||||
const TEST2: _ = 42u32;
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures for constants
|
||||
|
||||
const TEST3: _ = Some(42);
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures for constants
|
||||
|
||||
const TEST4: fn() -> _ = 42;
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures for functions
|
||||
|
||||
trait Test5 {
|
||||
const TEST5: _ = 42;
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures for constants
|
||||
}
|
||||
|
||||
struct Test6;
|
||||
|
||||
impl Test6 {
|
||||
const TEST6: _ = 13;
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures for constants
|
||||
}
|
||||
|
||||
pub fn main() {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for return types
|
||||
--> $DIR/typeck_type_placeholder_item_help.rs:4:15
|
||||
|
|
||||
LL | fn test1() -> _ { Some(42) }
|
||||
@@ -7,7 +7,7 @@ LL | fn test1() -> _ { Some(42) }
|
||||
| not allowed in type signatures
|
||||
| help: replace with the correct return type: `Option<i32>`
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for constants
|
||||
--> $DIR/typeck_type_placeholder_item_help.rs:7:14
|
||||
|
|
||||
LL | const TEST2: _ = 42u32;
|
||||
@@ -16,7 +16,7 @@ LL | const TEST2: _ = 42u32;
|
||||
| not allowed in type signatures
|
||||
| help: replace with the correct type: `u32`
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for constants
|
||||
--> $DIR/typeck_type_placeholder_item_help.rs:10:14
|
||||
|
|
||||
LL | const TEST3: _ = Some(42);
|
||||
@@ -25,13 +25,13 @@ LL | const TEST3: _ = Some(42);
|
||||
| not allowed in type signatures
|
||||
| help: replace with the correct type: `Option<i32>`
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for functions
|
||||
--> $DIR/typeck_type_placeholder_item_help.rs:13:22
|
||||
|
|
||||
LL | const TEST4: fn() -> _ = 42;
|
||||
| ^ not allowed in type signatures
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for constants
|
||||
--> $DIR/typeck_type_placeholder_item_help.rs:17:18
|
||||
|
|
||||
LL | const TEST5: _ = 42;
|
||||
@@ -40,7 +40,7 @@ LL | const TEST5: _ = 42;
|
||||
| not allowed in type signatures
|
||||
| help: replace with the correct type: `i32`
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for constants
|
||||
--> $DIR/typeck_type_placeholder_item_help.rs:24:18
|
||||
|
|
||||
LL | const TEST6: _ = 13;
|
||||
|
||||
Reference in New Issue
Block a user