Auto merge of #116222 - matthiaskrgr:rollup-dnag90q, r=matthiaskrgr

Rollup of 6 pull requests

Successful merges:

 - #112959 (Change the wording in `std::fmt::Write::write_str`)
 - #115535 (format doc-comment code examples in std::process)
 - #115888 (fix a comment about assert_receiver_is_total_eq)
 - #116211 (more clippy complextity fixes )
 - #116213 (Document -Zlink-native-libraries)
 - #116215 (Tweak wording of missing angle backets in qualified path)

r? `@ghost`
`@rustbot` modify labels: rollup
This commit is contained in:
bors 2023-09-28 08:05:39 +00:00
commit 6e09cff6d7
25 changed files with 263 additions and 132 deletions

View File

@ -245,7 +245,7 @@ fn suggest_static_lifetime_for_gat_from_hrtb(
let Trait(PolyTraitRef { trait_ref, span: trait_span, .. }, _) = bound else { return; }; let Trait(PolyTraitRef { trait_ref, span: trait_span, .. }, _) = bound else { return; };
diag.span_note( diag.span_note(
*trait_span, *trait_span,
format!("due to current limitations in the borrow checker, this implies a `'static` lifetime") "due to current limitations in the borrow checker, this implies a `'static` lifetime"
); );
let Some(generics_fn) = hir.get_generics(self.body.source.def_id().expect_local()) else { return; }; let Some(generics_fn) = hir.get_generics(self.body.source.def_id().expect_local()) else { return; };
let Def(_, trait_res_defid) = trait_ref.path.res else { return; }; let Def(_, trait_res_defid) = trait_ref.path.res else { return; };
@ -277,7 +277,7 @@ fn suggest_static_lifetime_for_gat_from_hrtb(
if suggestions.len() > 0 { if suggestions.len() > 0 {
suggestions.dedup(); suggestions.dedup();
diag.multipart_suggestion_verbose( diag.multipart_suggestion_verbose(
format!("consider restricting the type parameter to the `'static` lifetime"), "consider restricting the type parameter to the `'static` lifetime",
suggestions, suggestions,
Applicability::MaybeIncorrect, Applicability::MaybeIncorrect,
); );

View File

@ -181,7 +181,7 @@ pub fn unsized_info<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
old_info old_info
} }
} }
(_, &ty::Dynamic(ref data, _, _)) => meth::get_vtable(cx, source, data.principal()), (_, ty::Dynamic(data, _, _)) => meth::get_vtable(cx, source, data.principal()),
_ => bug!("unsized_info: invalid unsizing {:?} -> {:?}", source, target), _ => bug!("unsized_info: invalid unsizing {:?} -> {:?}", source, target),
} }
} }

View File

@ -1374,7 +1374,7 @@ fn impl_trait_ref(
// make astconv happy. // make astconv happy.
let mut path_segments = ast_trait_ref.path.segments.to_vec(); let mut path_segments = ast_trait_ref.path.segments.to_vec();
let last_segment = path_segments.len() - 1; let last_segment = path_segments.len() - 1;
let mut args = path_segments[last_segment].args().clone(); let mut args = *path_segments[last_segment].args();
let last_arg = args.args.len() - 1; let last_arg = args.args.len() - 1;
assert!(matches!(args.args[last_arg], hir::GenericArg::Const(anon_const) if tcx.has_attr(anon_const.value.def_id, sym::rustc_host))); assert!(matches!(args.args[last_arg], hir::GenericArg::Const(anon_const) if tcx.has_attr(anon_const.value.def_id, sym::rustc_host)));
args.args = &args.args[..args.args.len() - 1]; args.args = &args.args[..args.args.len() - 1];

View File

@ -644,7 +644,7 @@ fn visit_expr(&mut self, ex: &'tcx hir::Expr<'tcx>) {
if self.can_eq(self.param_env, ty, expected) { if self.can_eq(self.param_env, ty, expected) {
err.span_label( err.span_label(
ex.span, ex.span,
format!("expected because of this `break`"), "expected because of this `break`",
); );
exit = true; exit = true;
} }

View File

@ -621,7 +621,7 @@ trait defining them",
{ {
diag.span_label( diag.span_label(
item.span, item.span,
format!("associated type is `default` and may be overridden"), "associated type is `default` and may be overridden",
); );
return true; return true;
} }

View File

@ -1146,10 +1146,10 @@ fn post_fmt_projection(projection: &[PlaceElem<'_>], fmt: &mut Formatter<'_>) ->
ProjectionElem::ConstantIndex { offset, min_length, from_end: true } => { ProjectionElem::ConstantIndex { offset, min_length, from_end: true } => {
write!(fmt, "[-{offset:?} of {min_length:?}]")?; write!(fmt, "[-{offset:?} of {min_length:?}]")?;
} }
ProjectionElem::Subslice { from, to, from_end: true } if to == 0 => { ProjectionElem::Subslice { from, to: 0, from_end: true } => {
write!(fmt, "[{from:?}:]")?; write!(fmt, "[{from:?}:]")?;
} }
ProjectionElem::Subslice { from, to, from_end: true } if from == 0 => { ProjectionElem::Subslice { from: 0, to, from_end: true } => {
write!(fmt, "[:-{to:?}]")?; write!(fmt, "[:-{to:?}]")?;
} }
ProjectionElem::Subslice { from, to, from_end: true } => { ProjectionElem::Subslice { from, to, from_end: true } => {

View File

@ -740,9 +740,7 @@ fn non_exhaustive_match<'p, 'tcx>(
)); ));
} }
} else if ty == cx.tcx.types.str_ { } else if ty == cx.tcx.types.str_ {
err.note(format!( err.note("`&str` cannot be matched exhaustively, so a wildcard `_` is necessary");
"`&str` cannot be matched exhaustively, so a wildcard `_` is necessary",
));
} else if cx.is_foreign_non_exhaustive_enum(ty) { } else if cx.is_foreign_non_exhaustive_enum(ty) {
err.note(format!("`{ty}` is marked as non-exhaustive, so a wildcard `_` is necessary to match exhaustively")); err.note(format!("`{ty}` is marked as non-exhaustive, so a wildcard `_` is necessary to match exhaustively"));
} }

View File

@ -763,7 +763,7 @@ pub(super) fn filtered_statement_span(statement: &Statement<'_>) -> Option<Span>
// and `_1` is the `Place` for `somenum`. // and `_1` is the `Place` for `somenum`.
// //
// If and when the Issue is resolved, remove this special case match pattern: // If and when the Issue is resolved, remove this special case match pattern:
StatementKind::FakeRead(box (cause, _)) if cause == FakeReadCause::ForGuardBinding => None, StatementKind::FakeRead(box (FakeReadCause::ForGuardBinding, _)) => None,
// Retain spans from all other statements // Retain spans from all other statements
StatementKind::FakeRead(box (_, _)) // Not including `ForGuardBinding` StatementKind::FakeRead(box (_, _)) // Not including `ForGuardBinding`

View File

@ -54,11 +54,8 @@ fn candidate<'tcx>(
let layout = tcx.layout_of(param_env.and(ty)).ok()?; let layout = tcx.layout_of(param_env.and(ty)).ok()?;
let variants = match &layout.variants { let variants = match &layout.variants {
Variants::Single { .. } => return None, Variants::Single { .. } => return None,
Variants::Multiple { tag_encoding, .. } Variants::Multiple { tag_encoding: TagEncoding::Niche { .. }, .. } => return None,
if matches!(tag_encoding, TagEncoding::Niche { .. }) =>
{
return None;
}
Variants::Multiple { variants, .. } if variants.len() <= 1 => return None, Variants::Multiple { variants, .. } if variants.len() <= 1 => return None,
Variants::Multiple { variants, .. } => variants, Variants::Multiple { variants, .. } => variants,
}; };

View File

@ -509,7 +509,7 @@ parse_maybe_fn_typo_with_impl = you might have meant to write `impl` instead of
parse_maybe_recover_from_bad_qpath_stage_2 = parse_maybe_recover_from_bad_qpath_stage_2 =
missing angle brackets in associated item path missing angle brackets in associated item path
.suggestion = try: `{$ty}` .suggestion = types that don't start with an identifier need to be surrounded with angle brackets in qualified paths
parse_maybe_recover_from_bad_type_plus = parse_maybe_recover_from_bad_type_plus =
expected a path on the left-hand side of `+`, not `{$ty}` expected a path on the left-hand side of `+`, not `{$ty}`

View File

@ -59,9 +59,18 @@ pub(crate) enum BadTypePlusSub {
#[diag(parse_maybe_recover_from_bad_qpath_stage_2)] #[diag(parse_maybe_recover_from_bad_qpath_stage_2)]
pub(crate) struct BadQPathStage2 { pub(crate) struct BadQPathStage2 {
#[primary_span] #[primary_span]
#[suggestion(code = "", applicability = "maybe-incorrect")]
pub span: Span, pub span: Span,
pub ty: String, #[subdiagnostic]
pub wrap: WrapType,
}
#[derive(Subdiagnostic)]
#[multipart_suggestion(parse_suggestion, applicability = "machine-applicable")]
pub(crate) struct WrapType {
#[suggestion_part(code = "<")]
pub lo: Span,
#[suggestion_part(code = ">")]
pub hi: Span,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]

View File

@ -16,7 +16,7 @@
StructLiteralBodyWithoutPath, StructLiteralBodyWithoutPathSugg, StructLiteralNeedingParens, StructLiteralBodyWithoutPath, StructLiteralBodyWithoutPathSugg, StructLiteralNeedingParens,
StructLiteralNeedingParensSugg, SuggAddMissingLetStmt, SuggEscapeIdentifier, SuggRemoveComma, StructLiteralNeedingParensSugg, SuggAddMissingLetStmt, SuggEscapeIdentifier, SuggRemoveComma,
TernaryOperator, UnexpectedConstInGenericParam, UnexpectedConstParamDeclaration, TernaryOperator, UnexpectedConstInGenericParam, UnexpectedConstParamDeclaration,
UnexpectedConstParamDeclarationSugg, UnmatchedAngleBrackets, UseEqInstead, UnexpectedConstParamDeclarationSugg, UnmatchedAngleBrackets, UseEqInstead, WrapType,
}; };
use crate::fluent_generated as fluent; use crate::fluent_generated as fluent;
@ -1589,10 +1589,9 @@ pub(super) fn maybe_recover_from_bad_qpath_stage_2<T: RecoverQPath>(
self.parse_path_segments(&mut path.segments, T::PATH_STYLE, None)?; self.parse_path_segments(&mut path.segments, T::PATH_STYLE, None)?;
path.span = ty_span.to(self.prev_token.span); path.span = ty_span.to(self.prev_token.span);
let ty_str = self.span_to_snippet(ty_span).unwrap_or_else(|_| pprust::ty_to_string(&ty));
self.sess.emit_err(BadQPathStage2 { self.sess.emit_err(BadQPathStage2 {
span: path.span, span: ty_span,
ty: format!("<{}>::{}", ty_str, pprust::path_to_string(&path)), wrap: WrapType { lo: ty_span.shrink_to_lo(), hi: ty_span.shrink_to_hi() },
}); });
let path_span = ty_span.shrink_to_hi(); // Use an empty path since `position == 0`. let path_span = ty_span.shrink_to_hi(); // Use an empty path since `position == 0`.

View File

@ -186,7 +186,7 @@ fn make_base_error(
fallback_label: format!("not a {expected}"), fallback_label: format!("not a {expected}"),
span, span,
span_label: match res { span_label: match res {
Res::Def(kind, def_id) if kind == DefKind::TyParam => { Res::Def(DefKind::TyParam, def_id) => {
Some((self.r.def_span(def_id), "found this type parameter")) Some((self.r.def_span(def_id), "found this type parameter"))
} }
_ => None, _ => None,

View File

@ -1753,7 +1753,7 @@ pub fn original_relative_byte_pos(&self, pos: BytePos) -> RelativeBytePos {
// is recorded. // is recorded.
let diff = match self.normalized_pos.binary_search_by(|np| np.pos.cmp(&pos)) { let diff = match self.normalized_pos.binary_search_by(|np| np.pos.cmp(&pos)) {
Ok(i) => self.normalized_pos[i].diff, Ok(i) => self.normalized_pos[i].diff,
Err(i) if i == 0 => 0, Err(0) => 0,
Err(i) => self.normalized_pos[i - 1].diff, Err(i) => self.normalized_pos[i - 1].diff,
}; };
@ -1775,7 +1775,7 @@ pub fn normalized_byte_pos(&self, offset: u32) -> BytePos {
.binary_search_by(|np| (np.pos.0 + np.diff).cmp(&(self.start_pos.0 + offset))) .binary_search_by(|np| (np.pos.0 + np.diff).cmp(&(self.start_pos.0 + offset)))
{ {
Ok(i) => self.normalized_pos[i].diff, Ok(i) => self.normalized_pos[i].diff,
Err(i) if i == 0 => 0, Err(0) => 0,
Err(i) => self.normalized_pos[i - 1].diff, Err(i) => self.normalized_pos[i - 1].diff,
}; };

View File

@ -3211,7 +3211,7 @@ fn report_opaque_type_auto_trait_leakage(
) -> DiagnosticBuilder<'tcx, ErrorGuaranteed> { ) -> DiagnosticBuilder<'tcx, ErrorGuaranteed> {
let name = match self.tcx.opaque_type_origin(def_id.expect_local()) { let name = match self.tcx.opaque_type_origin(def_id.expect_local()) {
hir::OpaqueTyOrigin::FnReturn(_) | hir::OpaqueTyOrigin::AsyncFn(_) => { hir::OpaqueTyOrigin::FnReturn(_) | hir::OpaqueTyOrigin::AsyncFn(_) => {
format!("opaque type") "opaque type".to_string()
} }
hir::OpaqueTyOrigin::TyAlias { .. } => { hir::OpaqueTyOrigin::TyAlias { .. } => {
format!("`{}`", self.tcx.def_path_debug_str(def_id)) format!("`{}`", self.tcx.def_path_debug_str(def_id))

View File

@ -81,7 +81,7 @@ fn super_fold<V: Folder>(&self, folder: &mut V) -> ControlFlow<V::Break, Self> {
impl Foldable for ConstDef { impl Foldable for ConstDef {
fn super_fold<V: Folder>(&self, _folder: &mut V) -> ControlFlow<V::Break, Self> { fn super_fold<V: Folder>(&self, _folder: &mut V) -> ControlFlow<V::Break, Self> {
ControlFlow::Continue(self.clone()) ControlFlow::Continue(*self)
} }
} }
@ -96,7 +96,7 @@ fn super_fold<V: Folder>(&self, folder: &mut V) -> ControlFlow<V::Break, Self> {
impl Foldable for Promoted { impl Foldable for Promoted {
fn super_fold<V: Folder>(&self, _folder: &mut V) -> ControlFlow<V::Break, Self> { fn super_fold<V: Folder>(&self, _folder: &mut V) -> ControlFlow<V::Break, Self> {
ControlFlow::Continue(self.clone()) ControlFlow::Continue(*self)
} }
} }

View File

@ -291,9 +291,9 @@ fn ne(&self, other: &Rhs) -> bool {
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[rustc_diagnostic_item = "Eq"] #[rustc_diagnostic_item = "Eq"]
pub trait Eq: PartialEq<Self> { pub trait Eq: PartialEq<Self> {
// this method is used solely by #[deriving] to assert // this method is used solely by #[derive(Eq)] to assert
// that every component of a type implements #[deriving] // that every component of a type implements `Eq`
// itself, the current deriving infrastructure means doing this // itself. The current deriving infrastructure means doing this
// assertion without using a method on this trait is nearly // assertion without using a method on this trait is nearly
// impossible. // impossible.
// //

View File

@ -112,9 +112,9 @@ pub trait Write {
/// ///
/// # Errors /// # Errors
/// ///
/// This function will return an instance of [`Error`] on error. /// This function will return an instance of [`std::fmt::Error`][Error] on error.
/// ///
/// The purpose of std::fmt::Error is to abort the formatting operation when the underlying /// The purpose of that error is to abort the formatting operation when the underlying
/// destination encounters some error preventing it from accepting more text; it should /// destination encounters some error preventing it from accepting more text; it should
/// generally be propagated rather than handled, at least when implementing formatting traits. /// generally be propagated rather than handled, at least when implementing formatting traits.
/// ///

View File

@ -158,8 +158,7 @@
/// .spawn() /// .spawn()
/// .expect("failed to execute child"); /// .expect("failed to execute child");
/// ///
/// let ecode = child.wait() /// let ecode = child.wait().expect("failed to wait on child");
/// .expect("failed to wait on child");
/// ///
/// assert!(ecode.success()); /// assert!(ecode.success());
/// ``` /// ```
@ -502,8 +501,7 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
/// use std::process::Command; /// use std::process::Command;
/// ///
/// let mut echo_hello = Command::new("sh"); /// let mut echo_hello = Command::new("sh");
/// echo_hello.arg("-c") /// echo_hello.arg("-c").arg("echo hello");
/// .arg("echo hello");
/// let hello_1 = echo_hello.output().expect("failed to execute process"); /// let hello_1 = echo_hello.output().expect("failed to execute process");
/// let hello_2 = echo_hello.output().expect("failed to execute process"); /// let hello_2 = echo_hello.output().expect("failed to execute process");
/// ``` /// ```

View File

@ -0,0 +1,8 @@
# `link-native-libraries`
This option allows ignoring libraries specified in `#[link]` attributes instead of passing them to the linker.
This can be useful in build systems that manage native libraries themselves and pass them manually,
e.g. with `-Clink-arg`.
- `yes` - Pass native libraries to the linker. Default.
- `no` - Don't pass native libraries to the linker.

View File

@ -681,7 +681,7 @@ pub(crate) fn make_test(
if s.contains(crate_name) { if s.contains(crate_name) {
// rustdoc implicitly inserts an `extern crate` item for the own crate // rustdoc implicitly inserts an `extern crate` item for the own crate
// which may be unused, so we need to allow the lint. // which may be unused, so we need to allow the lint.
prog.push_str(&format!("#[allow(unused_extern_crates)]\n")); prog.push_str("#[allow(unused_extern_crates)]\n");
prog.push_str(&format!("extern crate r#{crate_name};\n")); prog.push_str(&format!("extern crate r#{crate_name};\n"));
line_offset += 1; line_offset += 1;

View File

@ -2,60 +2,104 @@ error: missing angle brackets in associated item path
--> $DIR/bad-assoc-expr.rs:3:5 --> $DIR/bad-assoc-expr.rs:3:5
| |
LL | [i32; 4]::clone(&a); LL | [i32; 4]::clone(&a);
| ^^^^^^^^^^^^^^^ help: try: `<[i32; 4]>::clone` | ^^^^^^^^
|
help: types that don't start with an identifier need to be surrounded with angle brackets in qualified paths
|
LL | <[i32; 4]>::clone(&a);
| + +
error: missing angle brackets in associated item path error: missing angle brackets in associated item path
--> $DIR/bad-assoc-expr.rs:6:5 --> $DIR/bad-assoc-expr.rs:6:5
| |
LL | [i32]::as_ref(&a); LL | [i32]::as_ref(&a);
| ^^^^^^^^^^^^^ help: try: `<[i32]>::as_ref` | ^^^^^
|
help: types that don't start with an identifier need to be surrounded with angle brackets in qualified paths
|
LL | <[i32]>::as_ref(&a);
| + +
error: missing angle brackets in associated item path error: missing angle brackets in associated item path
--> $DIR/bad-assoc-expr.rs:9:5 --> $DIR/bad-assoc-expr.rs:9:5
| |
LL | (u8)::clone(&0); LL | (u8)::clone(&0);
| ^^^^^^^^^^^ help: try: `<(u8)>::clone` | ^^^^
|
help: types that don't start with an identifier need to be surrounded with angle brackets in qualified paths
|
LL | <(u8)>::clone(&0);
| + +
error: missing angle brackets in associated item path error: missing angle brackets in associated item path
--> $DIR/bad-assoc-expr.rs:12:5 --> $DIR/bad-assoc-expr.rs:12:5
| |
LL | (u8, u8)::clone(&(0, 0)); LL | (u8, u8)::clone(&(0, 0));
| ^^^^^^^^^^^^^^^ help: try: `<(u8, u8)>::clone` | ^^^^^^^^
|
help: types that don't start with an identifier need to be surrounded with angle brackets in qualified paths
|
LL | <(u8, u8)>::clone(&(0, 0));
| + +
error: missing angle brackets in associated item path error: missing angle brackets in associated item path
--> $DIR/bad-assoc-expr.rs:15:6 --> $DIR/bad-assoc-expr.rs:15:6
| |
LL | &(u8)::clone(&0); LL | &(u8)::clone(&0);
| ^^^^^^^^^^^ help: try: `<(u8)>::clone` | ^^^^
|
help: types that don't start with an identifier need to be surrounded with angle brackets in qualified paths
|
LL | &<(u8)>::clone(&0);
| + +
error: missing angle brackets in associated item path error: missing angle brackets in associated item path
--> $DIR/bad-assoc-expr.rs:18:10 --> $DIR/bad-assoc-expr.rs:18:10
| |
LL | 10 + (u8)::clone(&0); LL | 10 + (u8)::clone(&0);
| ^^^^^^^^^^^ help: try: `<(u8)>::clone` | ^^^^
|
help: types that don't start with an identifier need to be surrounded with angle brackets in qualified paths
|
LL | 10 + <(u8)>::clone(&0);
| + +
error: missing angle brackets in associated item path error: missing angle brackets in associated item path
--> $DIR/bad-assoc-expr.rs:32:13 --> $DIR/bad-assoc-expr.rs:32:13
| |
LL | let _ = ty!()::clone(&0); LL | let _ = ty!()::clone(&0);
| ^^^^^^^^^^^^ help: try: `<ty!()>::clone` | ^^^^^
|
help: types that don't start with an identifier need to be surrounded with angle brackets in qualified paths
|
LL | let _ = <ty!()>::clone(&0);
| + +
error: missing angle brackets in associated item path error: missing angle brackets in associated item path
--> $DIR/bad-assoc-expr.rs:34:5 --> $DIR/bad-assoc-expr.rs:34:5
| |
LL | ty!()::clone(&0); LL | ty!()::clone(&0);
| ^^^^^^^^^^^^ help: try: `<ty!()>::clone` | ^^^^^
|
help: types that don't start with an identifier need to be surrounded with angle brackets in qualified paths
|
LL | <ty!()>::clone(&0);
| + +
error: missing angle brackets in associated item path error: missing angle brackets in associated item path
--> $DIR/bad-assoc-expr.rs:23:19 --> $DIR/bad-assoc-expr.rs:23:19
| |
LL | ($ty: ty) => ($ty::clone(&0)) LL | ($ty: ty) => ($ty::clone(&0))
| ^^^^^^^^^^ help: try: `<$ty>::clone` | ^^^
... ...
LL | expr!(u8); LL | expr!(u8);
| --------- in this macro invocation | --------- in this macro invocation
| |
= note: this error originates in the macro `expr` (in Nightly builds, run with -Z macro-backtrace for more info) = note: this error originates in the macro `expr` (in Nightly builds, run with -Z macro-backtrace for more info)
help: types that don't start with an identifier need to be surrounded with angle brackets in qualified paths
|
LL | ($ty: ty) => (<$ty>::clone(&0))
| + +
error: aborting due to 9 previous errors error: aborting due to 9 previous errors

View File

@ -2,42 +2,71 @@ error: missing angle brackets in associated item path
--> $DIR/bad-assoc-pat.rs:3:9 --> $DIR/bad-assoc-pat.rs:3:9
| |
LL | [u8]::AssocItem => {} LL | [u8]::AssocItem => {}
| ^^^^^^^^^^^^^^^ help: try: `<[u8]>::AssocItem` | ^^^^
|
help: types that don't start with an identifier need to be surrounded with angle brackets in qualified paths
|
LL | <[u8]>::AssocItem => {}
| + +
error: missing angle brackets in associated item path error: missing angle brackets in associated item path
--> $DIR/bad-assoc-pat.rs:6:9 --> $DIR/bad-assoc-pat.rs:6:9
| |
LL | (u8, u8)::AssocItem => {} LL | (u8, u8)::AssocItem => {}
| ^^^^^^^^^^^^^^^^^^^ help: try: `<(u8, u8)>::AssocItem` | ^^^^^^^^
|
help: types that don't start with an identifier need to be surrounded with angle brackets in qualified paths
|
LL | <(u8, u8)>::AssocItem => {}
| + +
error: missing angle brackets in associated item path error: missing angle brackets in associated item path
--> $DIR/bad-assoc-pat.rs:9:9 --> $DIR/bad-assoc-pat.rs:9:9
| |
LL | _::AssocItem => {} LL | _::AssocItem => {}
| ^^^^^^^^^^^^ help: try: `<_>::AssocItem` | ^
|
help: types that don't start with an identifier need to be surrounded with angle brackets in qualified paths
|
LL | <_>::AssocItem => {}
| + +
error: missing angle brackets in associated item path error: missing angle brackets in associated item path
--> $DIR/bad-assoc-pat.rs:14:10 --> $DIR/bad-assoc-pat.rs:14:10
| |
LL | &(u8,)::AssocItem => {} LL | &(u8,)::AssocItem => {}
| ^^^^^^^^^^^^^^^^ help: try: `<(u8,)>::AssocItem` | ^^^^^
|
help: types that don't start with an identifier need to be surrounded with angle brackets in qualified paths
|
LL | &<(u8,)>::AssocItem => {}
| + +
error: missing angle brackets in associated item path error: missing angle brackets in associated item path
--> $DIR/bad-assoc-pat.rs:32:9 --> $DIR/bad-assoc-pat.rs:32:9
| |
LL | ty!()::AssocItem => {} LL | ty!()::AssocItem => {}
| ^^^^^^^^^^^^^^^^ help: try: `<ty!()>::AssocItem` | ^^^^^
|
help: types that don't start with an identifier need to be surrounded with angle brackets in qualified paths
|
LL | <ty!()>::AssocItem => {}
| + +
error: missing angle brackets in associated item path error: missing angle brackets in associated item path
--> $DIR/bad-assoc-pat.rs:21:19 --> $DIR/bad-assoc-pat.rs:21:19
| |
LL | ($ty: ty) => ($ty::AssocItem) LL | ($ty: ty) => ($ty::AssocItem)
| ^^^^^^^^^^^^^^ help: try: `<$ty>::AssocItem` | ^^^
... ...
LL | pat!(u8) => {} LL | pat!(u8) => {}
| -------- in this macro invocation | -------- in this macro invocation
| |
= note: this error originates in the macro `pat` (in Nightly builds, run with -Z macro-backtrace for more info) = note: this error originates in the macro `pat` (in Nightly builds, run with -Z macro-backtrace for more info)
help: types that don't start with an identifier need to be surrounded with angle brackets in qualified paths
|
LL | ($ty: ty) => (<$ty>::AssocItem)
| + +
error[E0599]: no associated item named `AssocItem` found for slice `[u8]` in the current scope error[E0599]: no associated item named `AssocItem` found for slice `[u8]` in the current scope
--> $DIR/bad-assoc-pat.rs:3:15 --> $DIR/bad-assoc-pat.rs:3:15

View File

@ -2,60 +2,104 @@ error: missing angle brackets in associated item path
--> $DIR/bad-assoc-ty.rs:1:10 --> $DIR/bad-assoc-ty.rs:1:10
| |
LL | type A = [u8; 4]::AssocTy; LL | type A = [u8; 4]::AssocTy;
| ^^^^^^^^^^^^^^^^ help: try: `<[u8; 4]>::AssocTy` | ^^^^^^^
|
help: types that don't start with an identifier need to be surrounded with angle brackets in qualified paths
|
LL | type A = <[u8; 4]>::AssocTy;
| + +
error: missing angle brackets in associated item path error: missing angle brackets in associated item path
--> $DIR/bad-assoc-ty.rs:5:10 --> $DIR/bad-assoc-ty.rs:5:10
| |
LL | type B = [u8]::AssocTy; LL | type B = [u8]::AssocTy;
| ^^^^^^^^^^^^^ help: try: `<[u8]>::AssocTy` | ^^^^
|
help: types that don't start with an identifier need to be surrounded with angle brackets in qualified paths
|
LL | type B = <[u8]>::AssocTy;
| + +
error: missing angle brackets in associated item path error: missing angle brackets in associated item path
--> $DIR/bad-assoc-ty.rs:9:10 --> $DIR/bad-assoc-ty.rs:9:10
| |
LL | type C = (u8)::AssocTy; LL | type C = (u8)::AssocTy;
| ^^^^^^^^^^^^^ help: try: `<(u8)>::AssocTy` | ^^^^
|
help: types that don't start with an identifier need to be surrounded with angle brackets in qualified paths
|
LL | type C = <(u8)>::AssocTy;
| + +
error: missing angle brackets in associated item path error: missing angle brackets in associated item path
--> $DIR/bad-assoc-ty.rs:13:10 --> $DIR/bad-assoc-ty.rs:13:10
| |
LL | type D = (u8, u8)::AssocTy; LL | type D = (u8, u8)::AssocTy;
| ^^^^^^^^^^^^^^^^^ help: try: `<(u8, u8)>::AssocTy` | ^^^^^^^^
|
help: types that don't start with an identifier need to be surrounded with angle brackets in qualified paths
|
LL | type D = <(u8, u8)>::AssocTy;
| + +
error: missing angle brackets in associated item path error: missing angle brackets in associated item path
--> $DIR/bad-assoc-ty.rs:17:10 --> $DIR/bad-assoc-ty.rs:17:10
| |
LL | type E = _::AssocTy; LL | type E = _::AssocTy;
| ^^^^^^^^^^ help: try: `<_>::AssocTy` | ^
|
help: types that don't start with an identifier need to be surrounded with angle brackets in qualified paths
|
LL | type E = <_>::AssocTy;
| + +
error: missing angle brackets in associated item path error: missing angle brackets in associated item path
--> $DIR/bad-assoc-ty.rs:21:19 --> $DIR/bad-assoc-ty.rs:21:19
| |
LL | type F = &'static (u8)::AssocTy; LL | type F = &'static (u8)::AssocTy;
| ^^^^^^^^^^^^^ help: try: `<(u8)>::AssocTy` | ^^^^
|
help: types that don't start with an identifier need to be surrounded with angle brackets in qualified paths
|
LL | type F = &'static <(u8)>::AssocTy;
| + +
error: missing angle brackets in associated item path error: missing angle brackets in associated item path
--> $DIR/bad-assoc-ty.rs:27:10 --> $DIR/bad-assoc-ty.rs:27:10
| |
LL | type G = dyn 'static + (Send)::AssocTy; LL | type G = dyn 'static + (Send)::AssocTy;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `<dyn 'static + (Send)>::AssocTy` | ^^^^^^^^^^^^^^^^^^^^
|
help: types that don't start with an identifier need to be surrounded with angle brackets in qualified paths
|
LL | type G = <dyn 'static + (Send)>::AssocTy;
| + +
error: missing angle brackets in associated item path error: missing angle brackets in associated item path
--> $DIR/bad-assoc-ty.rs:46:10 --> $DIR/bad-assoc-ty.rs:46:10
| |
LL | type I = ty!()::AssocTy; LL | type I = ty!()::AssocTy;
| ^^^^^^^^^^^^^^ help: try: `<ty!()>::AssocTy` | ^^^^^
|
help: types that don't start with an identifier need to be surrounded with angle brackets in qualified paths
|
LL | type I = <ty!()>::AssocTy;
| + +
error: missing angle brackets in associated item path error: missing angle brackets in associated item path
--> $DIR/bad-assoc-ty.rs:39:19 --> $DIR/bad-assoc-ty.rs:39:19
| |
LL | ($ty: ty) => ($ty::AssocTy); LL | ($ty: ty) => ($ty::AssocTy);
| ^^^^^^^^^^^^ help: try: `<$ty>::AssocTy` | ^^^
... ...
LL | type J = ty!(u8); LL | type J = ty!(u8);
| ------- in this macro invocation | ------- in this macro invocation
| |
= note: this error originates in the macro `ty` (in Nightly builds, run with -Z macro-backtrace for more info) = note: this error originates in the macro `ty` (in Nightly builds, run with -Z macro-backtrace for more info)
help: types that don't start with an identifier need to be surrounded with angle brackets in qualified paths
|
LL | ($ty: ty) => (<$ty>::AssocTy);
| + +
error[E0223]: ambiguous associated type error[E0223]: ambiguous associated type
--> $DIR/bad-assoc-ty.rs:1:10 --> $DIR/bad-assoc-ty.rs:1:10

View File

@ -2,7 +2,12 @@ error: missing angle brackets in associated item path
--> $DIR/issue-89388.rs:5:24 --> $DIR/issue-89388.rs:5:24
| |
LL | let _ = option.map([_]::to_vec); LL | let _ = option.map([_]::to_vec);
| ^^^^^^^^^^^ help: try: `<[_]>::to_vec` | ^^^
|
help: types that don't start with an identifier need to be surrounded with angle brackets in qualified paths
|
LL | let _ = option.map(<[_]>::to_vec);
| + +
error: aborting due to previous error error: aborting due to previous error