diff --git a/compiler/rustc_expand/src/proc_macro_server.rs b/compiler/rustc_expand/src/proc_macro_server.rs index ff09a9fb87a7f..17a348ec6baae 100644 --- a/compiler/rustc_expand/src/proc_macro_server.rs +++ b/compiler/rustc_expand/src/proc_macro_server.rs @@ -115,8 +115,20 @@ impl FromInternal<(TokenStream, &mut Rustc<'_, '_>)> for Vec FnCtxt<'a, 'tcx> { } /// When encountering an fn-like type, try accessing the output of the type - /// // and suggesting calling it if it satisfies a predicate (i.e. if the + /// and suggesting calling it if it satisfies a predicate (i.e. if the /// output has a method or a field): /// ```compile_fail,E0308 /// fn foo(x: usize) -> usize { x } @@ -139,7 +139,6 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { sugg, applicability, ); - return true; } false @@ -338,6 +337,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { } else { err.span_suggestion(sp, &msg, suggestion, applicability); } + } else if self.suggest_else_fn_with_closure(err, expr, found, expected) + { } else if self.suggest_fn_call(err, expr, found, |output| self.can_coerce(output, expected)) && let ty::FnDef(def_id, ..) = &found.kind() && let Some(sp) = self.tcx.hir().span_if_local(*def_id) diff --git a/compiler/rustc_hir_analysis/src/check/method/suggest.rs b/compiler/rustc_hir_analysis/src/check/method/suggest.rs index 0e82e4956c7c1..ad1084bd1b1b6 100644 --- a/compiler/rustc_hir_analysis/src/check/method/suggest.rs +++ b/compiler/rustc_hir_analysis/src/check/method/suggest.rs @@ -2324,6 +2324,60 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { } } + /// issue #102320, for `unwrap_or` with closure as argument, suggest `unwrap_or_else` + /// FIXME: currently not working for suggesting `map_or_else`, see #102408 + pub(crate) fn suggest_else_fn_with_closure( + &self, + err: &mut Diagnostic, + expr: &hir::Expr<'_>, + found: Ty<'tcx>, + expected: Ty<'tcx>, + ) -> bool { + let Some((_def_id_or_name, output, _inputs)) = self.extract_callable_info(expr, found) + else { return false; }; + + if !self.can_coerce(output, expected) { + return false; + } + + let parent = self.tcx.hir().get_parent_node(expr.hir_id); + if let Some(Node::Expr(call_expr)) = self.tcx.hir().find(parent) && + let hir::ExprKind::MethodCall( + hir::PathSegment { ident: method_name, .. }, + self_expr, + args, + .., + ) = call_expr.kind && + let Some(self_ty) = self.typeck_results.borrow().expr_ty_opt(self_expr) { + let new_name = Ident { + name: Symbol::intern(&format!("{}_else", method_name.as_str())), + span: method_name.span, + }; + let probe = self.lookup_probe( + expr.span, + new_name, + self_ty, + self_expr, + ProbeScope::TraitsInScope, + ); + + // check the method arguments number + if let Ok(pick) = probe && + let fn_sig = self.tcx.fn_sig(pick.item.def_id) && + let fn_args = fn_sig.skip_binder().inputs() && + fn_args.len() == args.len() + 1 { + err.span_suggestion_verbose( + method_name.span.shrink_to_hi(), + &format!("try calling `{}` instead", new_name.name.as_str()), + "_else", + Applicability::MaybeIncorrect, + ); + return true; + } + } + false + } + /// Checks whether there is a local type somewhere in the chain of /// autoderefs of `rcvr_ty`. fn type_derefs_to_local( diff --git a/compiler/rustc_middle/src/lint.rs b/compiler/rustc_middle/src/lint.rs index 7b0054a96d3ea..b3b02f5b9879b 100644 --- a/compiler/rustc_middle/src/lint.rs +++ b/compiler/rustc_middle/src/lint.rs @@ -350,7 +350,6 @@ pub fn struct_lint_level( (Level::Deny | Level::Forbid, None) => sess.diagnostic().struct_err_lint(""), }; - err.set_primary_message(msg); err.set_is_lint(); // If this code originates in a foreign macro, aka something that this crate @@ -375,6 +374,10 @@ pub fn struct_lint_level( } } + // Delay evaluating and setting the primary message until after we've + // suppressed the lint due to macros. + err.set_primary_message(msg); + // Lint diagnostics that are covered by the expect level will not be emitted outside // the compiler. It is therefore not necessary to add any information for the user. // This will therefore directly call the decorate function which will in turn emit diff --git a/library/core/src/convert/mod.rs b/library/core/src/convert/mod.rs index 223695c2bec7b..33493964bad2e 100644 --- a/library/core/src/convert/mod.rs +++ b/library/core/src/convert/mod.rs @@ -545,7 +545,7 @@ pub trait From: Sized { #[lang = "from"] #[must_use] #[stable(feature = "rust1", since = "1.0.0")] - fn from(_: T) -> Self; + fn from(value: T) -> Self; } /// An attempted conversion that consumes `self`, which may or may not be diff --git a/src/librustdoc/html/static/css/rustdoc.css b/src/librustdoc/html/static/css/rustdoc.css index 5f034723c33a4..4795c14e0aef6 100644 --- a/src/librustdoc/html/static/css/rustdoc.css +++ b/src/librustdoc/html/static/css/rustdoc.css @@ -194,13 +194,10 @@ h1, h2, h3, h4, h5, h6, .item-left > a, .out-of-band, span.since, -details.rustdoc-toggle > summary::before, a.srclink, #help-button > button, details.rustdoc-toggle.top-doc > summary, -details.rustdoc-toggle.top-doc > summary::before, details.rustdoc-toggle.non-exhaustive > summary, -details.rustdoc-toggle.non-exhaustive > summary::before, .scraped-example-title, .more-examples-toggle summary, .more-examples-toggle .hide-more, .example-links a, @@ -970,6 +967,11 @@ so that we can apply CSS-filters to change the arrow color in themes */ padding-right: 1em; } +.search-results a:hover, +.search-results a:focus { + background-color: var(--search-result-link-focus-background-color); +} + .popover { font-size: 1rem; position: absolute; @@ -1567,7 +1569,6 @@ details.rustdoc-toggle > summary::before { } details.rustdoc-toggle > summary.hideme > span, -details.rustdoc-toggle > summary::before, .more-examples-toggle summary, .more-examples-toggle .hide-more { color: var(--toggles-color); } diff --git a/src/librustdoc/html/static/css/themes/ayu.css b/src/librustdoc/html/static/css/themes/ayu.css index 219e6509d2007..7245dce6ed6e3 100644 --- a/src/librustdoc/html/static/css/themes/ayu.css +++ b/src/librustdoc/html/static/css/themes/ayu.css @@ -37,6 +37,7 @@ Original by Dempfi (https://github.com/dempfi/ayu) --link-color: #39afd7; --sidebar-link-color: #53b1db; --sidebar-current-link-background-color: transparent; + --search-result-link-focus-background-color: #3c3c3c; --stab-background-color: #314559; --stab-code-color: #e6e1cf; } @@ -250,30 +251,6 @@ pre.rust .kw {} pre.rust .self, pre.rust .bool-val, pre.rust .prelude-val, pre.rust .attribute {} pre.rust .kw-2, pre.rust .prelude-ty {} -.search-results a:focus span {} -a.result-trait:focus {} -a.result-traitalias:focus {} -a.result-mod:focus, -a.result-externcrate:focus {} -a.result-mod:focus {} -a.result-externcrate:focus {} -a.result-enum:focus {} -a.result-struct:focus {} -a.result-union:focus {} -a.result-fn:focus, -a.result-method:focus, -a.result-tymethod:focus {} -a.result-type:focus {} -a.result-associatedtype:focus {} -a.result-foreigntype:focus {} -a.result-attr:focus, -a.result-derive:focus, -a.result-macro:focus {} -a.result-constant:focus, -a.result-static:focus {} -a.result-primitive:focus {} -a.result-keyword:focus {} - kbd { color: #c5c5c5; background-color: #314559; diff --git a/src/librustdoc/html/static/css/themes/dark.css b/src/librustdoc/html/static/css/themes/dark.css index 0b598db82ee80..9d5406e65a8b9 100644 --- a/src/librustdoc/html/static/css/themes/dark.css +++ b/src/librustdoc/html/static/css/themes/dark.css @@ -32,6 +32,7 @@ --link-color: #d2991d; --sidebar-link-color: #fdbf35; --sidebar-current-link-background-color: #444; + --search-result-link-focus-background-color: #616161; --stab-background-color: #314559; --stab-code-color: #e6e1cf; } @@ -58,36 +59,6 @@ input:focus + .slider { background-color: #0a042f !important; } -.search-results a:hover { - background-color: #777; -} - -.search-results a:focus { - color: #eee !important; - background-color: #616161; -} -.search-results a:focus span { color: #eee !important; } -a.result-trait:focus { background-color: #013191; } -a.result-traitalias:focus { background-color: #013191; } -a.result-mod:focus, -a.result-externcrate:focus { background-color: #884719; } -a.result-enum:focus { background-color: #194e9f; } -a.result-struct:focus { background-color: #194e9f; } -a.result-union:focus { background-color: #194e9f; } -a.result-fn:focus, -a.result-method:focus, -a.result-tymethod:focus { background-color: #4950ed; } -a.result-type:focus { background-color: #194e9f; } -a.result-associatedtype:focus { background-color: #884719; } -a.result-foreigntype:focus { background-color: #194e9f; } -a.result-attr:focus, -a.result-derive:focus, -a.result-macro:focus { background-color: #217d1c; } -a.result-constant:focus, -a.result-static:focus { background-color: #884719; } -a.result-primitive:focus { background-color: #194e9f; } -a.result-keyword:focus { background-color: #884719; } - .content .item-info::before { color: #ccc; } pre.rust .comment { color: #8d8d8b; } diff --git a/src/librustdoc/html/static/css/themes/light.css b/src/librustdoc/html/static/css/themes/light.css index fe1cf10bc2fd4..b63895e56c687 100644 --- a/src/librustdoc/html/static/css/themes/light.css +++ b/src/librustdoc/html/static/css/themes/light.css @@ -32,6 +32,7 @@ --link-color: #3873ad; --sidebar-link-color: #356da4; --sidebar-current-link-background-color: #fff; + --search-result-link-focus-background-color: #ccc; --stab-background-color: #fff5d6; --stab-code-color: #000; } @@ -57,36 +58,6 @@ input:focus + .slider { background-color: #FDFFD3 !important; } -.search-results a:hover { - background-color: #ddd; -} - -.search-results a:focus { - color: #000 !important; - background-color: #ccc; -} -.search-results a:focus span { color: #000 !important; } -a.result-trait:focus { background-color: #c7b6ff; } -a.result-traitalias:focus { background-color: #c7b6ff; } -a.result-mod:focus, -a.result-externcrate:focus { background-color: #afc6e4; } -a.result-enum:focus { background-color: #e7b1a0; } -a.result-struct:focus { background-color: #e7b1a0; } -a.result-union:focus { background-color: #e7b1a0; } -a.result-fn:focus, -a.result-method:focus, -a.result-tymethod:focus { background-color: #c6afb3; } -a.result-type:focus { background-color: #e7b1a0; } -a.result-associatedtype:focus { background-color: #afc6e4; } -a.result-foreigntype:focus { background-color: #e7b1a0; } -a.result-attr:focus, -a.result-derive:focus, -a.result-macro:focus { background-color: #8ce488; } -a.result-constant:focus, -a.result-static:focus { background-color: #afc6e4; } -a.result-primitive:focus { background-color: #e7b1a0; } -a.result-keyword:focus { background-color: #afc6e4; } - .content .item-info::before { color: #ccc; } body.source .example-wrap pre.rust a { diff --git a/src/test/rustdoc-gui/search-result-color.goml b/src/test/rustdoc-gui/search-result-color.goml index c4b5fdf53dd6b..807646cce37e9 100644 --- a/src/test/rustdoc-gui/search-result-color.goml +++ b/src/test/rustdoc-gui/search-result-color.goml @@ -30,54 +30,243 @@ assert-css: ( // Checking the color of "keyword". assert-css: ( - ".result-name .keyword", + ".result-keyword .keyword", {"color": "rgb(57, 175, 215)"}, ALL, ) +assert-css: ( + ".result-keyword", + {"color": "rgb(0, 150, 207)", "background-color": "rgba(0, 0, 0, 0)"}, +) +move-cursor-to: ".result-keyword" +assert-css: ( + ".result-keyword:hover", + {"color": "rgb(255, 255, 255)", "background-color": "rgb(60, 60, 60)"}, +) +assert-css: ( + ".result-keyword:hover .keyword", + {"color": "rgb(57, 175, 215)"}, +) +move-cursor-to: ".search-input" +focus: ".result-keyword" +assert-css: ( + ".result-keyword:focus", + {"color": "rgb(255, 255, 255)", "background-color": "rgb(60, 60, 60)"}, +) +assert-css: ( + ".result-keyword:focus .keyword", + {"color": "rgb(57, 175, 215)"}, +) + // Check the color of "struct". assert-css: ( - ".result-name .struct", + ".result-struct .struct", {"color": "rgb(255, 160, 165)"}, ALL, ) +assert-css: ( + ".result-struct", + {"color": "rgb(0, 150, 207)", "background-color": "rgba(0, 0, 0, 0)"}, +) +move-cursor-to: ".result-struct" +assert-css: ( + ".result-struct:hover", + {"color": "rgb(255, 255, 255)", "background-color": "rgb(60, 60, 60)"}, +) +assert-css: ( + ".result-struct:hover .struct", + {"color": "rgb(255, 160, 165)"}, +) +move-cursor-to: ".search-input" +focus: ".result-struct" +assert-css: ( + ".result-struct:focus", + {"color": "rgb(255, 255, 255)", "background-color": "rgb(60, 60, 60)"}, +) +assert-css: ( + ".result-struct:focus .struct", + {"color": "rgb(255, 160, 165)"}, +) + // Check the color of "associated type". assert-css: ( - ".result-name .associatedtype", + ".result-associatedtype .associatedtype", {"color": "rgb(57, 175, 215)"}, ALL, ) +assert-css: ( + ".result-associatedtype", + {"color": "rgb(0, 150, 207)", "background-color": "rgba(0, 0, 0, 0)"}, +) +move-cursor-to: ".result-associatedtype" +assert-css: ( + ".result-associatedtype:hover", + {"color": "rgb(255, 255, 255)", "background-color": "rgb(60, 60, 60)"}, +) +assert-css: ( + ".result-associatedtype:hover .associatedtype", + {"color": "rgb(57, 175, 215)"}, +) +move-cursor-to: ".search-input" +focus: ".result-associatedtype" +assert-css: ( + ".result-associatedtype:focus", + {"color": "rgb(255, 255, 255)", "background-color": "rgb(60, 60, 60)"}, +) +assert-css: ( + ".result-associatedtype:focus .associatedtype", + {"color": "rgb(57, 175, 215)"}, +) + // Check the color of "type method". assert-css: ( - ".result-name .tymethod", + ".result-tymethod .tymethod", {"color": "rgb(253, 214, 135)"}, ALL, ) +assert-css: ( + ".result-tymethod", + {"color": "rgb(0, 150, 207)", "background-color": "rgba(0, 0, 0, 0)"}, +) +assert-css: ( + ".result-tymethod .tymethod", + {"color": "rgb(253, 214, 135)"}, +) +move-cursor-to: ".result-tymethod" +assert-css: ( + ".result-tymethod:hover", + {"color": "rgb(255, 255, 255)", "background-color": "rgb(60, 60, 60)"}, +) +move-cursor-to: ".search-input" +focus: ".result-tymethod" +assert-css: ( + ".result-tymethod:focus", + {"color": "rgb(255, 255, 255)", "background-color": "rgb(60, 60, 60)"}, +) + // Check the color of "method". assert-css: ( - ".result-name .method", + ".result-method .method", {"color": "rgb(253, 214, 135)"}, ALL, ) +assert-css: ( + ".result-method", + {"color": "rgb(0, 150, 207)", "background-color": "rgba(0, 0, 0, 0)"}, +) +move-cursor-to: ".result-method" +assert-css: ( + ".result-method:hover", + {"color": "rgb(255, 255, 255)", "background-color": "rgb(60, 60, 60)"}, +) +assert-css: ( + ".result-method:hover .method", + {"color": "rgb(253, 214, 135)"}, +) +move-cursor-to: ".search-input" +focus: ".result-method" +assert-css: ( + ".result-method:focus", + {"color": "rgb(255, 255, 255)", "background-color": "rgb(60, 60, 60)"}, +) +assert-css: ( + ".result-method:focus .method", + {"color": "rgb(253, 214, 135)"}, +) + // Check the color of "struct field". assert-css: ( - ".result-name .structfield", + ".result-structfield .structfield", {"color": "rgb(0, 150, 207)"}, ALL, ) +assert-css: ( + ".result-structfield", + {"color": "rgb(0, 150, 207)", "background-color": "rgba(0, 0, 0, 0)"}, +) +move-cursor-to: ".result-structfield" +assert-css: ( + ".result-structfield:hover", + {"color": "rgb(255, 255, 255)", "background-color": "rgb(60, 60, 60)"}, +) +assert-css: ( + ".result-structfield:hover .structfield", + {"color": "rgb(255, 255, 255)"}, +) +move-cursor-to: ".search-input" +focus: ".result-structfield" +assert-css: ( + ".result-structfield:focus", + {"color": "rgb(255, 255, 255)", "background-color": "rgb(60, 60, 60)"}, +) +assert-css: ( + ".result-structfield:focus .structfield", + {"color": "rgb(255, 255, 255)"}, +) + // Check the color of "macro". assert-css: ( - ".result-name .macro", + ".result-macro .macro", {"color": "rgb(163, 122, 204)"}, ALL, ) +assert-css: ( + ".result-macro", + {"color": "rgb(0, 150, 207)", "background-color": "rgba(0, 0, 0, 0)"}, +) +move-cursor-to: ".result-macro" +assert-css: ( + ".result-macro:hover", + {"color": "rgb(255, 255, 255)", "background-color": "rgb(60, 60, 60)"}, +) +assert-css: ( + ".result-macro:hover .macro", + {"color": "rgb(163, 122, 204)"}, +) +move-cursor-to: ".search-input" +focus: ".result-macro" +assert-css: ( + ".result-macro:focus", + {"color": "rgb(255, 255, 255)", "background-color": "rgb(60, 60, 60)"}, +) +assert-css: ( + ".result-macro:focus .macro", + {"color": "rgb(163, 122, 204)"}, +) + // Check the color of "fn". assert-css: ( - ".result-name .fn", + ".result-fn .fn", {"color": "rgb(253, 214, 135)"}, ALL, ) +assert-css: ( + ".result-fn", + {"color": "rgb(0, 150, 207)", "background-color": "rgba(0, 0, 0, 0)"}, +) +move-cursor-to: ".result-fn" +assert-css: ( + ".result-fn:hover", + {"color": "rgb(255, 255, 255)", "background-color": "rgb(60, 60, 60)"}, +) +assert-css: ( + ".result-fn:hover .fn", + {"color": "rgb(253, 214, 135)"}, +) +move-cursor-to: ".search-input" +focus: ".result-fn" +assert-css: ( + ".result-fn:focus", + {"color": "rgb(255, 255, 255)", "background-color": "rgb(60, 60, 60)"}, +) +assert-css: ( + ".result-fn:focus .fn", + {"color": "rgb(253, 214, 135)"}, +) // Checking the `` container. +move-cursor-to: ".search-input" +focus: ".search-input" // To ensure the `` container isnt focus or hover. assert-css: ( "//*[@class='result-name']/*[text()='test_docs::']/ancestor::a", {"color": "rgb(0, 150, 207)", "background-color": "rgba(0, 0, 0, 0)"}, @@ -113,7 +302,7 @@ assert-css: ( {"color": "rgb(221, 221, 221)"}, ) -// Checking the color for "keyword". +// Checking the color for "keyword" text. assert-css: ( "//*[@class='result-name']//*[text()='(keyword)']", {"color": "rgb(221, 221, 221)"}, @@ -121,68 +310,250 @@ assert-css: ( // Checking the color of "keyword". assert-css: ( - ".result-name .keyword", + ".result-keyword .keyword", {"color": "rgb(210, 153, 29)"}, ALL, ) +assert-css: ( + ".result-keyword", + {"color": "rgb(221, 221, 221)", "background-color": "rgba(0, 0, 0, 0)"}, +) +move-cursor-to: ".result-keyword" +assert-css: ( + ".result-keyword:hover", + {"color": "rgb(221, 221, 221)", "background-color": "rgb(97, 97, 97)"}, +) +assert-css: ( + ".result-keyword:hover .keyword", + {"color": "rgb(210, 153, 29)"}, +) +move-cursor-to: ".search-input" +focus: ".result-keyword" +assert-css: ( + ".result-keyword:focus", + {"color": "rgb(221, 221, 221)", "background-color": "rgb(97, 97, 97)"}, +) +assert-css: ( + ".result-keyword:focus .keyword", + {"color": "rgb(210, 153, 29)"}, +) + // Check the color of "struct". assert-css: ( - ".result-name .struct", + ".result-struct .struct", {"color": "rgb(45, 191, 184)"}, ALL, ) +assert-css: ( + ".result-struct", + {"color": "rgb(221, 221, 221)", "background-color": "rgba(0, 0, 0, 0)"}, +) +move-cursor-to: ".result-struct" +assert-css: ( + ".result-struct:hover", + {"color": "rgb(221, 221, 221)", "background-color": "rgb(97, 97, 97)"}, +) +assert-css: ( + ".result-struct:hover .struct", + {"color": "rgb(45, 191, 184)"}, +) +move-cursor-to: ".search-input" +focus: ".result-struct" +assert-css: ( + ".result-struct:focus", + {"color": "rgb(221, 221, 221)", "background-color": "rgb(97, 97, 97)"}, +) +assert-css: ( + ".result-struct:focus .struct", + {"color": "rgb(45, 191, 184)"}, +) + // Check the color of "associated type". assert-css: ( - ".result-name .associatedtype", + ".result-associatedtype .associatedtype", {"color": "rgb(210, 153, 29)"}, ALL, ) +assert-css: ( + ".result-associatedtype", + {"color": "rgb(221, 221, 221)", "background-color": "rgba(0, 0, 0, 0)"}, +) +move-cursor-to: ".result-associatedtype" +assert-css: ( + ".result-associatedtype:hover", + {"color": "rgb(221, 221, 221)", "background-color": "rgb(97, 97, 97)"}, +) +assert-css: ( + ".result-associatedtype:hover .associatedtype", + {"color": "rgb(210, 153, 29)"}, +) +move-cursor-to: ".search-input" +focus: ".result-associatedtype" +assert-css: ( + ".result-associatedtype:focus", + {"color": "rgb(221, 221, 221)", "background-color": "rgb(97, 97, 97)"}, +) +assert-css: ( + ".result-associatedtype:focus .associatedtype", + {"color": "rgb(210, 153, 29)"}, +) + // Check the color of "type method". assert-css: ( - ".result-name .tymethod", + ".result-tymethod .tymethod", {"color": "rgb(43, 171, 99)"}, ALL, ) +assert-css: ( + ".result-tymethod", + {"color": "rgb(221, 221, 221)", "background-color": "rgba(0, 0, 0, 0)"}, +) +move-cursor-to: ".result-tymethod" +assert-css: ( + ".result-tymethod:hover", + {"color": "rgb(221, 221, 221)", "background-color": "rgb(97, 97, 97)"}, +) +assert-css: ( + ".result-tymethod:hover .tymethod", + {"color": "rgb(43, 171, 99)"}, +) +move-cursor-to: ".search-input" +focus: ".result-tymethod" +assert-css: ( + ".result-tymethod:focus", + {"color": "rgb(221, 221, 221)", "background-color": "rgb(97, 97, 97)"}, +) +assert-css: ( + ".result-tymethod:focus .tymethod", + {"color": "rgb(43, 171, 99)"}, +) + // Check the color of "method". assert-css: ( - ".result-name .method", + ".result-method .method", {"color": "rgb(43, 171, 99)"}, ALL, ) +assert-css: ( + ".result-method", + {"color": "rgb(221, 221, 221)", "background-color": "rgba(0, 0, 0, 0)"}, +) +move-cursor-to: ".result-method" +assert-css: ( + ".result-method:hover", + {"color": "rgb(221, 221, 221)", "background-color": "rgb(97, 97, 97)"}, +) +assert-css: ( + ".result-method:hover .method", + {"color": "rgb(43, 171, 99)"}, +) +move-cursor-to: ".search-input" +focus: ".result-method" +assert-css: ( + ".result-method:focus", + {"color": "rgb(221, 221, 221)", "background-color": "rgb(97, 97, 97)"}, +) +assert-css: ( + ".result-method:focus .method", + {"color": "rgb(43, 171, 99)"}, +) + // Check the color of "struct field". assert-css: ( - ".result-name .structfield", + ".result-structfield .structfield", {"color": "rgb(221, 221, 221)"}, ALL, ) +assert-css: ( + ".result-structfield", + {"color": "rgb(221, 221, 221)", "background-color": "rgba(0, 0, 0, 0)"}, +) +move-cursor-to: ".result-structfield" +assert-css: ( + ".result-structfield:hover", + {"color": "rgb(221, 221, 221)", "background-color": "rgb(97, 97, 97)"}, +) +assert-css: ( + ".result-structfield:hover .structfield", + {"color": "rgb(221, 221, 221)"}, +) +move-cursor-to: ".search-input" +focus: ".result-structfield" +assert-css: ( + ".result-structfield:focus", + {"color": "rgb(221, 221, 221)", "background-color": "rgb(97, 97, 97)"}, +) +assert-css: ( + ".result-structfield:focus .structfield", + {"color": "rgb(221, 221, 221)"}, +) + // Check the color of "macro". assert-css: ( - ".result-name .macro", + ".result-macro .macro", {"color": "rgb(9, 189, 0)"}, ALL, ) +assert-css: ( + ".result-macro", + {"color": "rgb(221, 221, 221)", "background-color": "rgba(0, 0, 0, 0)"}, +) +move-cursor-to: ".result-macro" +assert-css: ( + ".result-macro:hover", + {"color": "rgb(221, 221, 221)", "background-color": "rgb(97, 97, 97)"}, +) +assert-css: ( + ".result-macro:hover .macro", + {"color": "rgb(9, 189, 0)"}, +) +move-cursor-to: ".search-input" +focus: ".result-macro" +assert-css: ( + ".result-macro:focus", + {"color": "rgb(221, 221, 221)", "background-color": "rgb(97, 97, 97)"}, +) +assert-css: ( + ".result-macro:focus .macro", + {"color": "rgb(9, 189, 0)"}, +) + // Check the color of "fn". assert-css: ( - ".result-name .fn", + ".result-fn .fn", {"color": "rgb(43, 171, 99)"}, ALL, ) - -// Checking the `` container. assert-css: ( - "//*[@class='result-name']/*[text()='test_docs::']/ancestor::a", + ".result-fn", {"color": "rgb(221, 221, 221)", "background-color": "rgba(0, 0, 0, 0)"}, ) - -// Checking color and background on hover. -move-cursor-to: "//*[@class='desc']//*[text()='Just a normal struct.']" +move-cursor-to: ".result-fn" assert-css: ( - "//*[@class='result-name']/*[text()='test_docs::']", - {"color": "rgb(221, 221, 221)"}, + ".result-fn:hover", + {"color": "rgb(221, 221, 221)", "background-color": "rgb(97, 97, 97)"}, ) +assert-css: ( + ".result-fn:hover .fn", + {"color": "rgb(43, 171, 99)"}, +) +move-cursor-to: ".search-input" +focus: ".result-fn" +assert-css: ( + ".result-fn:focus", + {"color": "rgb(221, 221, 221)", "background-color": "rgb(97, 97, 97)"}, +) +assert-css: ( + ".result-fn:focus .fn", + {"color": "rgb(43, 171, 99)"}, +) + +// Checking the `` container. +move-cursor-to: ".search-input" +focus: ".search-input" // To ensure the `` container isnt focus or hover. assert-css: ( "//*[@class='result-name']/*[text()='test_docs::']/ancestor::a", - {"color": "rgb(221, 221, 221)", "background-color": "rgb(119, 119, 119)"}, + {"color": "rgb(221, 221, 221)", "background-color": "rgba(0, 0, 0, 0)"}, ) // Light theme @@ -200,7 +571,7 @@ assert-css: ( {"color": "rgb(0, 0, 0)"}, ) -// Checking the color for "keyword". +// Checking the color for "keyword" text. assert-css: ( "//*[@class='result-name']//*[text()='(keyword)']", {"color": "rgb(0, 0, 0)"}, @@ -208,68 +579,250 @@ assert-css: ( // Checking the color of "keyword". assert-css: ( - ".result-name .keyword", + ".result-keyword .keyword", {"color": "rgb(56, 115, 173)"}, ALL, ) +assert-css: ( + ".result-keyword", + {"color": "rgb(0, 0, 0)", "background-color": "rgba(0, 0, 0, 0)"}, +) +move-cursor-to: ".result-keyword" +assert-css: ( + ".result-keyword:hover", + {"color": "rgb(0, 0, 0)", "background-color": "rgb(204, 204, 204)"}, +) +assert-css: ( + ".result-keyword:hover .keyword", + {"color": "rgb(56, 115, 173)"}, +) +move-cursor-to: ".search-input" +focus: ".result-keyword" +assert-css: ( + ".result-keyword:focus", + {"color": "rgb(0, 0, 0)", "background-color": "rgb(204, 204, 204)"}, +) +assert-css: ( + ".result-keyword:focus .keyword", + {"color": "rgb(56, 115, 173)"}, +) + // Check the color of "struct". assert-css: ( - ".result-name .struct", + ".result-struct .struct", {"color": "rgb(173, 55, 138)"}, ALL, ) +assert-css: ( + ".result-struct", + {"color": "rgb(0, 0, 0)", "background-color": "rgba(0, 0, 0, 0)"}, +) +move-cursor-to: ".result-struct" +assert-css: ( + ".result-struct:hover", + {"color": "rgb(0, 0, 0)", "background-color": "rgb(204, 204, 204)"}, +) +assert-css: ( + ".result-struct:hover .struct", + {"color": "rgb(173, 55, 138)"}, +) +move-cursor-to: ".search-input" +focus: ".result-struct" +assert-css: ( + ".result-struct:focus", + {"color": "rgb(0, 0, 0)", "background-color": "rgb(204, 204, 204)"}, +) +assert-css: ( + ".result-struct:focus .struct", + {"color": "rgb(173, 55, 138)"}, +) + // Check the color of "associated type". assert-css: ( - ".result-name .associatedtype", + ".result-associatedtype .associatedtype", {"color": "rgb(56, 115, 173)"}, ALL, ) +assert-css: ( + ".result-associatedtype", + {"color": "rgb(0, 0, 0)", "background-color": "rgba(0, 0, 0, 0)"}, +) +move-cursor-to: ".result-associatedtype" +assert-css: ( + ".result-associatedtype:hover", + {"color": "rgb(0, 0, 0)", "background-color": "rgb(204, 204, 204)"}, +) +assert-css: ( + ".result-associatedtype:hover .associatedtype", + {"color": "rgb(56, 115, 173)"}, +) +move-cursor-to: ".search-input" +focus: ".result-associatedtype" +assert-css: ( + ".result-associatedtype:focus", + {"color": "rgb(0, 0, 0)", "background-color": "rgb(204, 204, 204)"}, +) +assert-css: ( + ".result-associatedtype:focus .associatedtype", + {"color": "rgb(56, 115, 173)"}, +) + // Check the color of "type method". assert-css: ( - ".result-name .tymethod", + ".result-tymethod .tymethod", {"color": "rgb(173, 124, 55)"}, ALL, ) +assert-css: ( + ".result-tymethod", + {"color": "rgb(0, 0, 0)", "background-color": "rgba(0, 0, 0, 0)"}, +) +move-cursor-to: ".result-tymethod" +assert-css: ( + ".result-tymethod:hover", + {"color": "rgb(0, 0, 0)", "background-color": "rgb(204, 204, 204)"}, +) +assert-css: ( + ".result-tymethod:hover .tymethod", + {"color": "rgb(173, 124, 55)"}, +) +move-cursor-to: ".search-input" +focus: ".result-tymethod" +assert-css: ( + ".result-tymethod:focus", + {"color": "rgb(0, 0, 0)", "background-color": "rgb(204, 204, 204)"}, +) +assert-css: ( + ".result-tymethod:focus .tymethod", + {"color": "rgb(173, 124, 55)"}, +) + // Check the color of "method". assert-css: ( - ".result-name .method", + ".result-method .method", {"color": "rgb(173, 124, 55)"}, ALL, ) +assert-css: ( + ".result-method", + {"color": "rgb(0, 0, 0)", "background-color": "rgba(0, 0, 0, 0)"}, +) +move-cursor-to: ".result-method" +assert-css: ( + ".result-method:hover", + {"color": "rgb(0, 0, 0)", "background-color": "rgb(204, 204, 204)"}, +) +assert-css: ( + ".result-method:hover .method", + {"color": "rgb(173, 124, 55)"}, +) +move-cursor-to: ".search-input" +focus: ".result-method" +assert-css: ( + ".result-method:focus", + {"color": "rgb(0, 0, 0)", "background-color": "rgb(204, 204, 204)"}, +) +assert-css: ( + ".result-method:focus .method", + {"color": "rgb(173, 124, 55)"}, +) + // Check the color of "struct field". assert-css: ( - ".result-name .structfield", + ".result-structfield .structfield", {"color": "rgb(0, 0, 0)"}, ALL, ) +assert-css: ( + ".result-structfield", + {"color": "rgb(0, 0, 0)", "background-color": "rgba(0, 0, 0, 0)"}, +) +move-cursor-to: ".result-structfield" +assert-css: ( + ".result-structfield:hover", + {"color": "rgb(0, 0, 0)", "background-color": "rgb(204, 204, 204)"}, +) +assert-css: ( + ".result-structfield:hover .structfield", + {"color": "rgb(0, 0, 0)"}, +) +move-cursor-to: ".search-input" +focus: ".result-structfield" +assert-css: ( + ".result-structfield:focus", + {"color": "rgb(0, 0, 0)", "background-color": "rgb(204, 204, 204)"}, +) +assert-css: ( + ".result-structfield:focus .structfield", + {"color": "rgb(0, 0, 0)"}, +) + // Check the color of "macro". assert-css: ( - ".result-name .macro", + ".result-macro .macro", {"color": "rgb(6, 128, 0)"}, ALL, ) +assert-css: ( + ".result-macro", + {"color": "rgb(0, 0, 0)", "background-color": "rgba(0, 0, 0, 0)"}, +) +move-cursor-to: ".result-macro" +assert-css: ( + ".result-macro:hover", + {"color": "rgb(0, 0, 0)", "background-color": "rgb(204, 204, 204)"}, +) +assert-css: ( + ".result-macro:hover .macro", + {"color": "rgb(6, 128, 0)"}, +) +move-cursor-to: ".search-input" +focus: ".result-macro" +assert-css: ( + ".result-macro:focus", + {"color": "rgb(0, 0, 0)", "background-color": "rgb(204, 204, 204)"}, +) +assert-css: ( + ".result-macro:focus .macro", + {"color": "rgb(6, 128, 0)"}, +) + // Check the color of "fn". assert-css: ( - ".result-name .fn", + ".result-fn .fn", {"color": "rgb(173, 124, 55)"}, ALL, ) - -// Checking the `` container. assert-css: ( - "//*[@class='result-name']/*[text()='test_docs::']/ancestor::a", + ".result-fn", {"color": "rgb(0, 0, 0)", "background-color": "rgba(0, 0, 0, 0)"}, ) - -// Checking color and background on hover. -move-cursor-to: "//*[@class='desc']//*[text()='Just a normal struct.']" +move-cursor-to: ".result-fn" assert-css: ( - "//*[@class='result-name']/*[text()='test_docs::']", - {"color": "rgb(0, 0, 0)"}, + ".result-fn:hover", + {"color": "rgb(0, 0, 0)", "background-color": "rgb(204, 204, 204)"}, ) +assert-css: ( + ".result-fn:hover .fn", + {"color": "rgb(173, 124, 55)"}, +) +move-cursor-to: ".search-input" +focus: ".result-fn" +assert-css: ( + ".result-fn:focus", + {"color": "rgb(0, 0, 0)", "background-color": "rgb(204, 204, 204)"}, +) +assert-css: ( + ".result-fn:focus .fn", + {"color": "rgb(173, 124, 55)"}, +) + +// Checking the `` container. +move-cursor-to: ".search-input" +focus: ".search-input" // To ensure the `` container isnt focus or hover. assert-css: ( "//*[@class='result-name']/*[text()='test_docs::']/ancestor::a", - {"color": "rgb(0, 0, 0)", "background-color": "rgb(221, 221, 221)"}, + {"color": "rgb(0, 0, 0)", "background-color": "rgba(0, 0, 0, 0)"}, ) // Check the alias more specifically in the dark theme. diff --git a/src/test/ui/lint/auxiliary/trivial-cast-ice.rs b/src/test/ui/lint/auxiliary/trivial-cast-ice.rs new file mode 100644 index 0000000000000..ab2332d065655 --- /dev/null +++ b/src/test/ui/lint/auxiliary/trivial-cast-ice.rs @@ -0,0 +1,7 @@ +#[macro_export] +macro_rules! foo { + () => { + let x: &Option = &Some(1); + let _y = x as *const Option; + } +} diff --git a/src/test/ui/lint/redundant-semicolon/redundant-semi-proc-macro.stderr b/src/test/ui/lint/redundant-semicolon/redundant-semi-proc-macro.stderr index bc0c533032413..e31d14c559639 100644 --- a/src/test/ui/lint/redundant-semicolon/redundant-semi-proc-macro.stderr +++ b/src/test/ui/lint/redundant-semicolon/redundant-semi-proc-macro.stderr @@ -1,4 +1,4 @@ -TokenStream [Ident { ident: "fn", span: #0 bytes(198..200) }, Ident { ident: "span_preservation", span: #0 bytes(201..218) }, Group { delimiter: Parenthesis, stream: TokenStream [], span: #0 bytes(218..220) }, Group { delimiter: Brace, stream: TokenStream [Ident { ident: "let", span: #0 bytes(228..231) }, Ident { ident: "tst", span: #0 bytes(232..235) }, Punct { ch: '=', spacing: Alone, span: #0 bytes(236..237) }, Literal { kind: Integer, symbol: "123", suffix: None, span: #0 bytes(238..241) }, Punct { ch: ';', spacing: Joint, span: #0 bytes(241..242) }, Punct { ch: ';', spacing: Alone, span: #0 bytes(242..243) }, Ident { ident: "match", span: #0 bytes(289..294) }, Ident { ident: "tst", span: #0 bytes(295..298) }, Group { delimiter: Brace, stream: TokenStream [Literal { kind: Integer, symbol: "123", suffix: None, span: #0 bytes(483..486) }, Punct { ch: '=', spacing: Joint, span: #0 bytes(487..489) }, Punct { ch: '>', spacing: Alone, span: #0 bytes(487..489) }, Group { delimiter: Parenthesis, stream: TokenStream [], span: #0 bytes(490..492) }, Punct { ch: ',', spacing: Alone, span: #0 bytes(492..493) }, Ident { ident: "_", span: #0 bytes(502..503) }, Punct { ch: '=', spacing: Joint, span: #0 bytes(504..506) }, Punct { ch: '>', spacing: Alone, span: #0 bytes(504..506) }, Group { delimiter: Parenthesis, stream: TokenStream [], span: #0 bytes(507..509) }], span: #0 bytes(299..515) }, Punct { ch: ';', spacing: Joint, span: #0 bytes(515..516) }, Punct { ch: ';', spacing: Joint, span: #0 bytes(516..517) }, Punct { ch: ';', spacing: Alone, span: #0 bytes(517..518) }], span: #0 bytes(222..562) }] +TokenStream [Ident { ident: "fn", span: #0 bytes(198..200) }, Ident { ident: "span_preservation", span: #0 bytes(201..218) }, Group { delimiter: Parenthesis, stream: TokenStream [], span: #0 bytes(218..220) }, Group { delimiter: Brace, stream: TokenStream [Ident { ident: "let", span: #0 bytes(228..231) }, Ident { ident: "tst", span: #0 bytes(232..235) }, Punct { ch: '=', spacing: Alone, span: #0 bytes(236..237) }, Literal { kind: Integer, symbol: "123", suffix: None, span: #0 bytes(238..241) }, Punct { ch: ';', spacing: Joint, span: #0 bytes(241..242) }, Punct { ch: ';', spacing: Alone, span: #0 bytes(242..243) }, Ident { ident: "match", span: #0 bytes(289..294) }, Ident { ident: "tst", span: #0 bytes(295..298) }, Group { delimiter: Brace, stream: TokenStream [Literal { kind: Integer, symbol: "123", suffix: None, span: #0 bytes(483..486) }, Punct { ch: '=', spacing: Joint, span: #0 bytes(487..488) }, Punct { ch: '>', spacing: Alone, span: #0 bytes(488..489) }, Group { delimiter: Parenthesis, stream: TokenStream [], span: #0 bytes(490..492) }, Punct { ch: ',', spacing: Alone, span: #0 bytes(492..493) }, Ident { ident: "_", span: #0 bytes(502..503) }, Punct { ch: '=', spacing: Joint, span: #0 bytes(504..505) }, Punct { ch: '>', spacing: Alone, span: #0 bytes(505..506) }, Group { delimiter: Parenthesis, stream: TokenStream [], span: #0 bytes(507..509) }], span: #0 bytes(299..515) }, Punct { ch: ';', spacing: Joint, span: #0 bytes(515..516) }, Punct { ch: ';', spacing: Joint, span: #0 bytes(516..517) }, Punct { ch: ';', spacing: Alone, span: #0 bytes(517..518) }], span: #0 bytes(222..562) }] error: unnecessary trailing semicolon --> $DIR/redundant-semi-proc-macro.rs:9:19 | diff --git a/src/test/ui/lint/trivial-cast-ice.rs b/src/test/ui/lint/trivial-cast-ice.rs new file mode 100644 index 0000000000000..f781fab2212cc --- /dev/null +++ b/src/test/ui/lint/trivial-cast-ice.rs @@ -0,0 +1,12 @@ +// aux-build:trivial-cast-ice.rs +// check-pass + +// Demonstrates the ICE in #102561 + +#![deny(trivial_casts)] + +extern crate trivial_cast_ice; + +fn main() { + trivial_cast_ice::foo!(); +} diff --git a/src/test/ui/proc-macro/attr-complex-fn.stdout b/src/test/ui/proc-macro/attr-complex-fn.stdout index fc69a13ddb9b4..b12eb587fc790 100644 --- a/src/test/ui/proc-macro/attr-complex-fn.stdout +++ b/src/test/ui/proc-macro/attr-complex-fn.stdout @@ -53,12 +53,12 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [ Punct { ch: '>', spacing: Joint, - span: $DIR/attr-complex-fn.rs:19:36: 19:38 (#0), + span: $DIR/attr-complex-fn.rs:19:36: 19:37 (#0), }, Punct { ch: '>', spacing: Joint, - span: $DIR/attr-complex-fn.rs:19:36: 19:38 (#0), + span: $DIR/attr-complex-fn.rs:19:37: 19:38 (#0), }, Punct { ch: '>', diff --git a/src/test/ui/proc-macro/capture-macro-rules-invoke.stdout b/src/test/ui/proc-macro/capture-macro-rules-invoke.stdout index 4de8746a1b460..b88fbd3e89776 100644 --- a/src/test/ui/proc-macro/capture-macro-rules-invoke.stdout +++ b/src/test/ui/proc-macro/capture-macro-rules-invoke.stdout @@ -177,12 +177,12 @@ PRINT-BANG INPUT (DEBUG): TokenStream [ Punct { ch: ':', spacing: Joint, - span: $DIR/capture-macro-rules-invoke.rs:45:16: 45:18 (#0), + span: $DIR/capture-macro-rules-invoke.rs:45:16: 45:17 (#0), }, Punct { ch: ':', spacing: Alone, - span: $DIR/capture-macro-rules-invoke.rs:45:16: 45:18 (#0), + span: $DIR/capture-macro-rules-invoke.rs:45:17: 45:18 (#0), }, Ident { ident: "option", @@ -191,12 +191,12 @@ PRINT-BANG INPUT (DEBUG): TokenStream [ Punct { ch: ':', spacing: Joint, - span: $DIR/capture-macro-rules-invoke.rs:45:24: 45:26 (#0), + span: $DIR/capture-macro-rules-invoke.rs:45:24: 45:25 (#0), }, Punct { ch: ':', spacing: Alone, - span: $DIR/capture-macro-rules-invoke.rs:45:24: 45:26 (#0), + span: $DIR/capture-macro-rules-invoke.rs:45:25: 45:26 (#0), }, Ident { ident: "Option", @@ -231,12 +231,12 @@ PRINT-BANG INPUT (DEBUG): TokenStream [ Punct { ch: ':', spacing: Joint, - span: $DIR/capture-macro-rules-invoke.rs:46:24: 46:26 (#0), + span: $DIR/capture-macro-rules-invoke.rs:46:24: 46:25 (#0), }, Punct { ch: ':', spacing: Alone, - span: $DIR/capture-macro-rules-invoke.rs:46:24: 46:26 (#0), + span: $DIR/capture-macro-rules-invoke.rs:46:25: 46:26 (#0), }, Ident { ident: "path", diff --git a/src/test/ui/proc-macro/debug/dump-debug-span-debug.rs b/src/test/ui/proc-macro/debug/dump-debug-span-debug.rs index fd34eb974c094..102bd6b7b1757 100644 --- a/src/test/ui/proc-macro/debug/dump-debug-span-debug.rs +++ b/src/test/ui/proc-macro/debug/dump-debug-span-debug.rs @@ -2,6 +2,7 @@ // aux-build:macro-dump-debug.rs // compile-flags: -Z span-debug + extern crate macro_dump_debug; use macro_dump_debug::dump_debug; @@ -9,7 +10,11 @@ dump_debug! { ident // ident r#ident // raw ident , // alone punct - ==> // joint punct + && // joint punct, two-char op + ||> // joint punct, two-char op + one-char op + ||<< // joint punct, two-char op + two-char op + ..= // joint punct, three-char op + <<=! // joint punct, three-char op + one-char-op () // empty group [_] // nonempty group diff --git a/src/test/ui/proc-macro/debug/dump-debug-span-debug.stderr b/src/test/ui/proc-macro/debug/dump-debug-span-debug.stderr index 2c05bdbc492a4..fa65cbbf1eae5 100644 --- a/src/test/ui/proc-macro/debug/dump-debug-span-debug.stderr +++ b/src/test/ui/proc-macro/debug/dump-debug-span-debug.stderr @@ -1,166 +1,231 @@ -TokenStream [Ident { ident: "ident", span: $DIR/dump-debug-span-debug.rs:9:5: 9:10 (#0) }, Ident { ident: "r#ident", span: $DIR/dump-debug-span-debug.rs:10:5: 10:12 (#0) }, Punct { ch: ',', spacing: Alone, span: $DIR/dump-debug-span-debug.rs:11:5: 11:6 (#0) }, Punct { ch: '=', spacing: Joint, span: $DIR/dump-debug-span-debug.rs:12:5: 12:7 (#0) }, Punct { ch: '=', spacing: Joint, span: $DIR/dump-debug-span-debug.rs:12:5: 12:7 (#0) }, Punct { ch: '>', spacing: Alone, span: $DIR/dump-debug-span-debug.rs:12:7: 12:8 (#0) }, Group { delimiter: Parenthesis, stream: TokenStream [], span: $DIR/dump-debug-span-debug.rs:13:5: 13:7 (#0) }, Group { delimiter: Bracket, stream: TokenStream [Ident { ident: "_", span: $DIR/dump-debug-span-debug.rs:14:6: 14:7 (#0) }], span: $DIR/dump-debug-span-debug.rs:14:5: 14:8 (#0) }, Literal { kind: Integer, symbol: "0", suffix: None, span: $DIR/dump-debug-span-debug.rs:17:5: 17:6 (#0) }, Literal { kind: Float, symbol: "1.0", suffix: None, span: $DIR/dump-debug-span-debug.rs:18:5: 18:8 (#0) }, Literal { kind: Str, symbol: "S", suffix: None, span: $DIR/dump-debug-span-debug.rs:19:5: 19:8 (#0) }, Literal { kind: ByteStr, symbol: "B", suffix: None, span: $DIR/dump-debug-span-debug.rs:20:5: 20:9 (#0) }, Literal { kind: StrRaw(0), symbol: "R", suffix: None, span: $DIR/dump-debug-span-debug.rs:21:5: 21:9 (#0) }, Literal { kind: StrRaw(2), symbol: "R", suffix: None, span: $DIR/dump-debug-span-debug.rs:22:5: 22:13 (#0) }, Literal { kind: ByteStrRaw(0), symbol: "BR", suffix: None, span: $DIR/dump-debug-span-debug.rs:23:5: 23:11 (#0) }, Literal { kind: ByteStrRaw(2), symbol: "BR", suffix: None, span: $DIR/dump-debug-span-debug.rs:24:5: 24:15 (#0) }, Literal { kind: Char, symbol: "C", suffix: None, span: $DIR/dump-debug-span-debug.rs:25:5: 25:8 (#0) }, Literal { kind: Byte, symbol: "B", suffix: None, span: $DIR/dump-debug-span-debug.rs:26:5: 26:9 (#0) }, Literal { kind: Integer, symbol: "0", suffix: Some("q"), span: $DIR/dump-debug-span-debug.rs:29:5: 29:7 (#0) }, Literal { kind: Float, symbol: "1.0", suffix: Some("q"), span: $DIR/dump-debug-span-debug.rs:30:5: 30:9 (#0) }, Literal { kind: Str, symbol: "S", suffix: Some("q"), span: $DIR/dump-debug-span-debug.rs:31:5: 31:9 (#0) }, Literal { kind: ByteStr, symbol: "B", suffix: Some("q"), span: $DIR/dump-debug-span-debug.rs:32:5: 32:10 (#0) }, Literal { kind: StrRaw(0), symbol: "R", suffix: Some("q"), span: $DIR/dump-debug-span-debug.rs:33:5: 33:10 (#0) }, Literal { kind: StrRaw(2), symbol: "R", suffix: Some("q"), span: $DIR/dump-debug-span-debug.rs:34:5: 34:14 (#0) }, Literal { kind: ByteStrRaw(0), symbol: "BR", suffix: Some("q"), span: $DIR/dump-debug-span-debug.rs:35:5: 35:12 (#0) }, Literal { kind: ByteStrRaw(2), symbol: "BR", suffix: Some("q"), span: $DIR/dump-debug-span-debug.rs:36:5: 36:16 (#0) }, Literal { kind: Char, symbol: "C", suffix: Some("q"), span: $DIR/dump-debug-span-debug.rs:37:5: 37:9 (#0) }, Literal { kind: Byte, symbol: "B", suffix: Some("q"), span: $DIR/dump-debug-span-debug.rs:38:5: 38:10 (#0) }] +TokenStream [Ident { ident: "ident", span: $DIR/dump-debug-span-debug.rs:10:5: 10:10 (#0) }, Ident { ident: "r#ident", span: $DIR/dump-debug-span-debug.rs:11:5: 11:12 (#0) }, Punct { ch: ',', spacing: Alone, span: $DIR/dump-debug-span-debug.rs:12:5: 12:6 (#0) }, Punct { ch: '&', spacing: Joint, span: $DIR/dump-debug-span-debug.rs:13:5: 13:6 (#0) }, Punct { ch: '&', spacing: Alone, span: $DIR/dump-debug-span-debug.rs:13:6: 13:7 (#0) }, Punct { ch: '|', spacing: Joint, span: $DIR/dump-debug-span-debug.rs:14:5: 14:6 (#0) }, Punct { ch: '|', spacing: Joint, span: $DIR/dump-debug-span-debug.rs:14:6: 14:7 (#0) }, Punct { ch: '>', spacing: Alone, span: $DIR/dump-debug-span-debug.rs:14:7: 14:8 (#0) }, Punct { ch: '|', spacing: Joint, span: $DIR/dump-debug-span-debug.rs:15:5: 15:6 (#0) }, Punct { ch: '|', spacing: Joint, span: $DIR/dump-debug-span-debug.rs:15:6: 15:7 (#0) }, Punct { ch: '<', spacing: Joint, span: $DIR/dump-debug-span-debug.rs:15:7: 15:8 (#0) }, Punct { ch: '<', spacing: Alone, span: $DIR/dump-debug-span-debug.rs:15:8: 15:9 (#0) }, Punct { ch: '.', spacing: Joint, span: $DIR/dump-debug-span-debug.rs:16:5: 16:6 (#0) }, Punct { ch: '.', spacing: Joint, span: $DIR/dump-debug-span-debug.rs:16:6: 16:7 (#0) }, Punct { ch: '=', spacing: Alone, span: $DIR/dump-debug-span-debug.rs:16:7: 16:8 (#0) }, Punct { ch: '<', spacing: Joint, span: $DIR/dump-debug-span-debug.rs:17:5: 17:6 (#0) }, Punct { ch: '<', spacing: Joint, span: $DIR/dump-debug-span-debug.rs:17:6: 17:7 (#0) }, Punct { ch: '=', spacing: Joint, span: $DIR/dump-debug-span-debug.rs:17:7: 17:8 (#0) }, Punct { ch: '!', spacing: Alone, span: $DIR/dump-debug-span-debug.rs:17:8: 17:9 (#0) }, Group { delimiter: Parenthesis, stream: TokenStream [], span: $DIR/dump-debug-span-debug.rs:18:5: 18:7 (#0) }, Group { delimiter: Bracket, stream: TokenStream [Ident { ident: "_", span: $DIR/dump-debug-span-debug.rs:19:6: 19:7 (#0) }], span: $DIR/dump-debug-span-debug.rs:19:5: 19:8 (#0) }, Literal { kind: Integer, symbol: "0", suffix: None, span: $DIR/dump-debug-span-debug.rs:22:5: 22:6 (#0) }, Literal { kind: Float, symbol: "1.0", suffix: None, span: $DIR/dump-debug-span-debug.rs:23:5: 23:8 (#0) }, Literal { kind: Str, symbol: "S", suffix: None, span: $DIR/dump-debug-span-debug.rs:24:5: 24:8 (#0) }, Literal { kind: ByteStr, symbol: "B", suffix: None, span: $DIR/dump-debug-span-debug.rs:25:5: 25:9 (#0) }, Literal { kind: StrRaw(0), symbol: "R", suffix: None, span: $DIR/dump-debug-span-debug.rs:26:5: 26:9 (#0) }, Literal { kind: StrRaw(2), symbol: "R", suffix: None, span: $DIR/dump-debug-span-debug.rs:27:5: 27:13 (#0) }, Literal { kind: ByteStrRaw(0), symbol: "BR", suffix: None, span: $DIR/dump-debug-span-debug.rs:28:5: 28:11 (#0) }, Literal { kind: ByteStrRaw(2), symbol: "BR", suffix: None, span: $DIR/dump-debug-span-debug.rs:29:5: 29:15 (#0) }, Literal { kind: Char, symbol: "C", suffix: None, span: $DIR/dump-debug-span-debug.rs:30:5: 30:8 (#0) }, Literal { kind: Byte, symbol: "B", suffix: None, span: $DIR/dump-debug-span-debug.rs:31:5: 31:9 (#0) }, Literal { kind: Integer, symbol: "0", suffix: Some("q"), span: $DIR/dump-debug-span-debug.rs:34:5: 34:7 (#0) }, Literal { kind: Float, symbol: "1.0", suffix: Some("q"), span: $DIR/dump-debug-span-debug.rs:35:5: 35:9 (#0) }, Literal { kind: Str, symbol: "S", suffix: Some("q"), span: $DIR/dump-debug-span-debug.rs:36:5: 36:9 (#0) }, Literal { kind: ByteStr, symbol: "B", suffix: Some("q"), span: $DIR/dump-debug-span-debug.rs:37:5: 37:10 (#0) }, Literal { kind: StrRaw(0), symbol: "R", suffix: Some("q"), span: $DIR/dump-debug-span-debug.rs:38:5: 38:10 (#0) }, Literal { kind: StrRaw(2), symbol: "R", suffix: Some("q"), span: $DIR/dump-debug-span-debug.rs:39:5: 39:14 (#0) }, Literal { kind: ByteStrRaw(0), symbol: "BR", suffix: Some("q"), span: $DIR/dump-debug-span-debug.rs:40:5: 40:12 (#0) }, Literal { kind: ByteStrRaw(2), symbol: "BR", suffix: Some("q"), span: $DIR/dump-debug-span-debug.rs:41:5: 41:16 (#0) }, Literal { kind: Char, symbol: "C", suffix: Some("q"), span: $DIR/dump-debug-span-debug.rs:42:5: 42:9 (#0) }, Literal { kind: Byte, symbol: "B", suffix: Some("q"), span: $DIR/dump-debug-span-debug.rs:43:5: 43:10 (#0) }] TokenStream [ Ident { ident: "ident", - span: $DIR/dump-debug-span-debug.rs:9:5: 9:10 (#0), + span: $DIR/dump-debug-span-debug.rs:10:5: 10:10 (#0), }, Ident { ident: "r#ident", - span: $DIR/dump-debug-span-debug.rs:10:5: 10:12 (#0), + span: $DIR/dump-debug-span-debug.rs:11:5: 11:12 (#0), }, Punct { ch: ',', spacing: Alone, - span: $DIR/dump-debug-span-debug.rs:11:5: 11:6 (#0), + span: $DIR/dump-debug-span-debug.rs:12:5: 12:6 (#0), + }, + Punct { + ch: '&', + spacing: Joint, + span: $DIR/dump-debug-span-debug.rs:13:5: 13:6 (#0), + }, + Punct { + ch: '&', + spacing: Alone, + span: $DIR/dump-debug-span-debug.rs:13:6: 13:7 (#0), + }, + Punct { + ch: '|', + spacing: Joint, + span: $DIR/dump-debug-span-debug.rs:14:5: 14:6 (#0), + }, + Punct { + ch: '|', + spacing: Joint, + span: $DIR/dump-debug-span-debug.rs:14:6: 14:7 (#0), + }, + Punct { + ch: '>', + spacing: Alone, + span: $DIR/dump-debug-span-debug.rs:14:7: 14:8 (#0), + }, + Punct { + ch: '|', + spacing: Joint, + span: $DIR/dump-debug-span-debug.rs:15:5: 15:6 (#0), + }, + Punct { + ch: '|', + spacing: Joint, + span: $DIR/dump-debug-span-debug.rs:15:6: 15:7 (#0), + }, + Punct { + ch: '<', + spacing: Joint, + span: $DIR/dump-debug-span-debug.rs:15:7: 15:8 (#0), + }, + Punct { + ch: '<', + spacing: Alone, + span: $DIR/dump-debug-span-debug.rs:15:8: 15:9 (#0), + }, + Punct { + ch: '.', + spacing: Joint, + span: $DIR/dump-debug-span-debug.rs:16:5: 16:6 (#0), + }, + Punct { + ch: '.', + spacing: Joint, + span: $DIR/dump-debug-span-debug.rs:16:6: 16:7 (#0), }, Punct { ch: '=', + spacing: Alone, + span: $DIR/dump-debug-span-debug.rs:16:7: 16:8 (#0), + }, + Punct { + ch: '<', spacing: Joint, - span: $DIR/dump-debug-span-debug.rs:12:5: 12:7 (#0), + span: $DIR/dump-debug-span-debug.rs:17:5: 17:6 (#0), + }, + Punct { + ch: '<', + spacing: Joint, + span: $DIR/dump-debug-span-debug.rs:17:6: 17:7 (#0), }, Punct { ch: '=', spacing: Joint, - span: $DIR/dump-debug-span-debug.rs:12:5: 12:7 (#0), + span: $DIR/dump-debug-span-debug.rs:17:7: 17:8 (#0), }, Punct { - ch: '>', + ch: '!', spacing: Alone, - span: $DIR/dump-debug-span-debug.rs:12:7: 12:8 (#0), + span: $DIR/dump-debug-span-debug.rs:17:8: 17:9 (#0), }, Group { delimiter: Parenthesis, stream: TokenStream [], - span: $DIR/dump-debug-span-debug.rs:13:5: 13:7 (#0), + span: $DIR/dump-debug-span-debug.rs:18:5: 18:7 (#0), }, Group { delimiter: Bracket, stream: TokenStream [ Ident { ident: "_", - span: $DIR/dump-debug-span-debug.rs:14:6: 14:7 (#0), + span: $DIR/dump-debug-span-debug.rs:19:6: 19:7 (#0), }, ], - span: $DIR/dump-debug-span-debug.rs:14:5: 14:8 (#0), + span: $DIR/dump-debug-span-debug.rs:19:5: 19:8 (#0), }, Literal { kind: Integer, symbol: "0", suffix: None, - span: $DIR/dump-debug-span-debug.rs:17:5: 17:6 (#0), + span: $DIR/dump-debug-span-debug.rs:22:5: 22:6 (#0), }, Literal { kind: Float, symbol: "1.0", suffix: None, - span: $DIR/dump-debug-span-debug.rs:18:5: 18:8 (#0), + span: $DIR/dump-debug-span-debug.rs:23:5: 23:8 (#0), }, Literal { kind: Str, symbol: "S", suffix: None, - span: $DIR/dump-debug-span-debug.rs:19:5: 19:8 (#0), + span: $DIR/dump-debug-span-debug.rs:24:5: 24:8 (#0), }, Literal { kind: ByteStr, symbol: "B", suffix: None, - span: $DIR/dump-debug-span-debug.rs:20:5: 20:9 (#0), + span: $DIR/dump-debug-span-debug.rs:25:5: 25:9 (#0), }, Literal { kind: StrRaw(0), symbol: "R", suffix: None, - span: $DIR/dump-debug-span-debug.rs:21:5: 21:9 (#0), + span: $DIR/dump-debug-span-debug.rs:26:5: 26:9 (#0), }, Literal { kind: StrRaw(2), symbol: "R", suffix: None, - span: $DIR/dump-debug-span-debug.rs:22:5: 22:13 (#0), + span: $DIR/dump-debug-span-debug.rs:27:5: 27:13 (#0), }, Literal { kind: ByteStrRaw(0), symbol: "BR", suffix: None, - span: $DIR/dump-debug-span-debug.rs:23:5: 23:11 (#0), + span: $DIR/dump-debug-span-debug.rs:28:5: 28:11 (#0), }, Literal { kind: ByteStrRaw(2), symbol: "BR", suffix: None, - span: $DIR/dump-debug-span-debug.rs:24:5: 24:15 (#0), + span: $DIR/dump-debug-span-debug.rs:29:5: 29:15 (#0), }, Literal { kind: Char, symbol: "C", suffix: None, - span: $DIR/dump-debug-span-debug.rs:25:5: 25:8 (#0), + span: $DIR/dump-debug-span-debug.rs:30:5: 30:8 (#0), }, Literal { kind: Byte, symbol: "B", suffix: None, - span: $DIR/dump-debug-span-debug.rs:26:5: 26:9 (#0), + span: $DIR/dump-debug-span-debug.rs:31:5: 31:9 (#0), }, Literal { kind: Integer, symbol: "0", suffix: Some("q"), - span: $DIR/dump-debug-span-debug.rs:29:5: 29:7 (#0), + span: $DIR/dump-debug-span-debug.rs:34:5: 34:7 (#0), }, Literal { kind: Float, symbol: "1.0", suffix: Some("q"), - span: $DIR/dump-debug-span-debug.rs:30:5: 30:9 (#0), + span: $DIR/dump-debug-span-debug.rs:35:5: 35:9 (#0), }, Literal { kind: Str, symbol: "S", suffix: Some("q"), - span: $DIR/dump-debug-span-debug.rs:31:5: 31:9 (#0), + span: $DIR/dump-debug-span-debug.rs:36:5: 36:9 (#0), }, Literal { kind: ByteStr, symbol: "B", suffix: Some("q"), - span: $DIR/dump-debug-span-debug.rs:32:5: 32:10 (#0), + span: $DIR/dump-debug-span-debug.rs:37:5: 37:10 (#0), }, Literal { kind: StrRaw(0), symbol: "R", suffix: Some("q"), - span: $DIR/dump-debug-span-debug.rs:33:5: 33:10 (#0), + span: $DIR/dump-debug-span-debug.rs:38:5: 38:10 (#0), }, Literal { kind: StrRaw(2), symbol: "R", suffix: Some("q"), - span: $DIR/dump-debug-span-debug.rs:34:5: 34:14 (#0), + span: $DIR/dump-debug-span-debug.rs:39:5: 39:14 (#0), }, Literal { kind: ByteStrRaw(0), symbol: "BR", suffix: Some("q"), - span: $DIR/dump-debug-span-debug.rs:35:5: 35:12 (#0), + span: $DIR/dump-debug-span-debug.rs:40:5: 40:12 (#0), }, Literal { kind: ByteStrRaw(2), symbol: "BR", suffix: Some("q"), - span: $DIR/dump-debug-span-debug.rs:36:5: 36:16 (#0), + span: $DIR/dump-debug-span-debug.rs:41:5: 41:16 (#0), }, Literal { kind: Char, symbol: "C", suffix: Some("q"), - span: $DIR/dump-debug-span-debug.rs:37:5: 37:9 (#0), + span: $DIR/dump-debug-span-debug.rs:42:5: 42:9 (#0), }, Literal { kind: Byte, symbol: "B", suffix: Some("q"), - span: $DIR/dump-debug-span-debug.rs:38:5: 38:10 (#0), + span: $DIR/dump-debug-span-debug.rs:43:5: 43:10 (#0), }, ] diff --git a/src/test/ui/proc-macro/debug/dump-debug.stderr b/src/test/ui/proc-macro/debug/dump-debug.stderr index 0aedefd4e6091..db422b6012aea 100644 --- a/src/test/ui/proc-macro/debug/dump-debug.stderr +++ b/src/test/ui/proc-macro/debug/dump-debug.stderr @@ -1,4 +1,4 @@ -TokenStream [Ident { ident: "ident", span: #0 bytes(130..135) }, Ident { ident: "r#ident", span: #0 bytes(151..158) }, Punct { ch: ',', spacing: Alone, span: #0 bytes(176..177) }, Punct { ch: '=', spacing: Joint, span: #0 bytes(203..205) }, Punct { ch: '=', spacing: Joint, span: #0 bytes(203..205) }, Punct { ch: '>', spacing: Alone, span: #0 bytes(205..206) }, Group { delimiter: Parenthesis, stream: TokenStream [], span: #0 bytes(230..232) }, Group { delimiter: Bracket, stream: TokenStream [Ident { ident: "_", span: #0 bytes(258..259) }], span: #0 bytes(257..260) }, Literal { kind: Integer, symbol: "0", suffix: None, span: #0 bytes(315..316) }, Literal { kind: Float, symbol: "1.0", suffix: None, span: #0 bytes(321..324) }, Literal { kind: Str, symbol: "S", suffix: None, span: #0 bytes(329..332) }, Literal { kind: ByteStr, symbol: "B", suffix: None, span: #0 bytes(337..341) }, Literal { kind: StrRaw(0), symbol: "R", suffix: None, span: #0 bytes(346..350) }, Literal { kind: StrRaw(2), symbol: "R", suffix: None, span: #0 bytes(355..363) }, Literal { kind: ByteStrRaw(0), symbol: "BR", suffix: None, span: #0 bytes(368..374) }, Literal { kind: ByteStrRaw(2), symbol: "BR", suffix: None, span: #0 bytes(379..389) }, Literal { kind: Char, symbol: "C", suffix: None, span: #0 bytes(394..397) }, Literal { kind: Byte, symbol: "B", suffix: None, span: #0 bytes(402..406) }, Literal { kind: Integer, symbol: "0", suffix: Some("q"), span: #0 bytes(437..439) }, Literal { kind: Float, symbol: "1.0", suffix: Some("q"), span: #0 bytes(444..448) }, Literal { kind: Str, symbol: "S", suffix: Some("q"), span: #0 bytes(453..457) }, Literal { kind: ByteStr, symbol: "B", suffix: Some("q"), span: #0 bytes(462..467) }, Literal { kind: StrRaw(0), symbol: "R", suffix: Some("q"), span: #0 bytes(472..477) }, Literal { kind: StrRaw(2), symbol: "R", suffix: Some("q"), span: #0 bytes(482..491) }, Literal { kind: ByteStrRaw(0), symbol: "BR", suffix: Some("q"), span: #0 bytes(496..503) }, Literal { kind: ByteStrRaw(2), symbol: "BR", suffix: Some("q"), span: #0 bytes(508..519) }, Literal { kind: Char, symbol: "C", suffix: Some("q"), span: #0 bytes(524..528) }, Literal { kind: Byte, symbol: "B", suffix: Some("q"), span: #0 bytes(533..538) }] +TokenStream [Ident { ident: "ident", span: #0 bytes(130..135) }, Ident { ident: "r#ident", span: #0 bytes(151..158) }, Punct { ch: ',', spacing: Alone, span: #0 bytes(176..177) }, Punct { ch: '=', spacing: Joint, span: #0 bytes(203..204) }, Punct { ch: '=', spacing: Joint, span: #0 bytes(204..205) }, Punct { ch: '>', spacing: Alone, span: #0 bytes(205..206) }, Group { delimiter: Parenthesis, stream: TokenStream [], span: #0 bytes(230..232) }, Group { delimiter: Bracket, stream: TokenStream [Ident { ident: "_", span: #0 bytes(258..259) }], span: #0 bytes(257..260) }, Literal { kind: Integer, symbol: "0", suffix: None, span: #0 bytes(315..316) }, Literal { kind: Float, symbol: "1.0", suffix: None, span: #0 bytes(321..324) }, Literal { kind: Str, symbol: "S", suffix: None, span: #0 bytes(329..332) }, Literal { kind: ByteStr, symbol: "B", suffix: None, span: #0 bytes(337..341) }, Literal { kind: StrRaw(0), symbol: "R", suffix: None, span: #0 bytes(346..350) }, Literal { kind: StrRaw(2), symbol: "R", suffix: None, span: #0 bytes(355..363) }, Literal { kind: ByteStrRaw(0), symbol: "BR", suffix: None, span: #0 bytes(368..374) }, Literal { kind: ByteStrRaw(2), symbol: "BR", suffix: None, span: #0 bytes(379..389) }, Literal { kind: Char, symbol: "C", suffix: None, span: #0 bytes(394..397) }, Literal { kind: Byte, symbol: "B", suffix: None, span: #0 bytes(402..406) }, Literal { kind: Integer, symbol: "0", suffix: Some("q"), span: #0 bytes(437..439) }, Literal { kind: Float, symbol: "1.0", suffix: Some("q"), span: #0 bytes(444..448) }, Literal { kind: Str, symbol: "S", suffix: Some("q"), span: #0 bytes(453..457) }, Literal { kind: ByteStr, symbol: "B", suffix: Some("q"), span: #0 bytes(462..467) }, Literal { kind: StrRaw(0), symbol: "R", suffix: Some("q"), span: #0 bytes(472..477) }, Literal { kind: StrRaw(2), symbol: "R", suffix: Some("q"), span: #0 bytes(482..491) }, Literal { kind: ByteStrRaw(0), symbol: "BR", suffix: Some("q"), span: #0 bytes(496..503) }, Literal { kind: ByteStrRaw(2), symbol: "BR", suffix: Some("q"), span: #0 bytes(508..519) }, Literal { kind: Char, symbol: "C", suffix: Some("q"), span: #0 bytes(524..528) }, Literal { kind: Byte, symbol: "B", suffix: Some("q"), span: #0 bytes(533..538) }] TokenStream [ Ident { ident: "ident", @@ -16,12 +16,12 @@ TokenStream [ Punct { ch: '=', spacing: Joint, - span: #0 bytes(203..205), + span: #0 bytes(203..204), }, Punct { ch: '=', spacing: Joint, - span: #0 bytes(203..205), + span: #0 bytes(204..205), }, Punct { ch: '>', diff --git a/src/test/ui/proc-macro/dollar-crate-issue-57089.stdout b/src/test/ui/proc-macro/dollar-crate-issue-57089.stdout index c0c9ed72c5ab9..2622c005d937f 100644 --- a/src/test/ui/proc-macro/dollar-crate-issue-57089.stdout +++ b/src/test/ui/proc-macro/dollar-crate-issue-57089.stdout @@ -18,12 +18,12 @@ PRINT-BANG INPUT (DEBUG): TokenStream [ Punct { ch: ':', spacing: Joint, - span: $DIR/dollar-crate-issue-57089.rs:17:28: 17:30 (#4), + span: $DIR/dollar-crate-issue-57089.rs:17:28: 17:29 (#4), }, Punct { ch: ':', spacing: Alone, - span: $DIR/dollar-crate-issue-57089.rs:17:28: 17:30 (#4), + span: $DIR/dollar-crate-issue-57089.rs:17:29: 17:30 (#4), }, Ident { ident: "S", @@ -58,12 +58,12 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [ Punct { ch: ':', spacing: Joint, - span: $DIR/dollar-crate-issue-57089.rs:21:24: 21:26 (#4), + span: $DIR/dollar-crate-issue-57089.rs:21:24: 21:25 (#4), }, Punct { ch: ':', spacing: Alone, - span: $DIR/dollar-crate-issue-57089.rs:21:24: 21:26 (#4), + span: $DIR/dollar-crate-issue-57089.rs:21:25: 21:26 (#4), }, Ident { ident: "S", diff --git a/src/test/ui/proc-macro/dollar-crate-issue-62325.stdout b/src/test/ui/proc-macro/dollar-crate-issue-62325.stdout index e6148a687fda0..a91908239c3f8 100644 --- a/src/test/ui/proc-macro/dollar-crate-issue-62325.stdout +++ b/src/test/ui/proc-macro/dollar-crate-issue-62325.stdout @@ -30,12 +30,12 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [ Punct { ch: ':', spacing: Joint, - span: $DIR/dollar-crate-issue-62325.rs:19:30: 19:32 (#4), + span: $DIR/dollar-crate-issue-62325.rs:19:30: 19:31 (#4), }, Punct { ch: ':', spacing: Alone, - span: $DIR/dollar-crate-issue-62325.rs:19:30: 19:32 (#4), + span: $DIR/dollar-crate-issue-62325.rs:19:31: 19:32 (#4), }, Ident { ident: "S", @@ -85,12 +85,12 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [ Punct { ch: ':', spacing: Joint, - span: $DIR/auxiliary/dollar-crate-external.rs:21:30: 21:32 (#12), + span: $DIR/auxiliary/dollar-crate-external.rs:21:30: 21:31 (#12), }, Punct { ch: ':', spacing: Alone, - span: $DIR/auxiliary/dollar-crate-external.rs:21:30: 21:32 (#12), + span: $DIR/auxiliary/dollar-crate-external.rs:21:31: 21:32 (#12), }, Ident { ident: "S", diff --git a/src/test/ui/proc-macro/dollar-crate.stdout b/src/test/ui/proc-macro/dollar-crate.stdout index d01fcb9d0e498..4e169d47e1ab2 100644 --- a/src/test/ui/proc-macro/dollar-crate.stdout +++ b/src/test/ui/proc-macro/dollar-crate.stdout @@ -18,12 +18,12 @@ PRINT-BANG INPUT (DEBUG): TokenStream [ Punct { ch: ':', spacing: Joint, - span: $DIR/dollar-crate.rs:20:32: 20:34 (#4), + span: $DIR/dollar-crate.rs:20:32: 20:33 (#4), }, Punct { ch: ':', spacing: Alone, - span: $DIR/dollar-crate.rs:20:32: 20:34 (#4), + span: $DIR/dollar-crate.rs:20:33: 20:34 (#4), }, Ident { ident: "S", @@ -58,12 +58,12 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [ Punct { ch: ':', spacing: Joint, - span: $DIR/dollar-crate.rs:24:28: 24:30 (#4), + span: $DIR/dollar-crate.rs:24:28: 24:29 (#4), }, Punct { ch: ':', spacing: Alone, - span: $DIR/dollar-crate.rs:24:28: 24:30 (#4), + span: $DIR/dollar-crate.rs:24:29: 24:30 (#4), }, Ident { ident: "S", @@ -98,12 +98,12 @@ PRINT-DERIVE INPUT (DEBUG): TokenStream [ Punct { ch: ':', spacing: Joint, - span: $DIR/dollar-crate.rs:27:28: 27:30 (#4), + span: $DIR/dollar-crate.rs:27:28: 27:29 (#4), }, Punct { ch: ':', spacing: Alone, - span: $DIR/dollar-crate.rs:27:28: 27:30 (#4), + span: $DIR/dollar-crate.rs:27:29: 27:30 (#4), }, Ident { ident: "S", @@ -138,12 +138,12 @@ PRINT-BANG INPUT (DEBUG): TokenStream [ Punct { ch: ':', spacing: Joint, - span: $DIR/auxiliary/dollar-crate-external.rs:7:28: 7:30 (#15), + span: $DIR/auxiliary/dollar-crate-external.rs:7:28: 7:29 (#15), }, Punct { ch: ':', spacing: Alone, - span: $DIR/auxiliary/dollar-crate-external.rs:7:28: 7:30 (#15), + span: $DIR/auxiliary/dollar-crate-external.rs:7:29: 7:30 (#15), }, Ident { ident: "S", @@ -178,12 +178,12 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [ Punct { ch: ':', spacing: Joint, - span: $DIR/auxiliary/dollar-crate-external.rs:11:24: 11:26 (#15), + span: $DIR/auxiliary/dollar-crate-external.rs:11:24: 11:25 (#15), }, Punct { ch: ':', spacing: Alone, - span: $DIR/auxiliary/dollar-crate-external.rs:11:24: 11:26 (#15), + span: $DIR/auxiliary/dollar-crate-external.rs:11:25: 11:26 (#15), }, Ident { ident: "S", @@ -218,12 +218,12 @@ PRINT-DERIVE INPUT (DEBUG): TokenStream [ Punct { ch: ':', spacing: Joint, - span: $DIR/auxiliary/dollar-crate-external.rs:14:24: 14:26 (#15), + span: $DIR/auxiliary/dollar-crate-external.rs:14:24: 14:25 (#15), }, Punct { ch: ':', spacing: Alone, - span: $DIR/auxiliary/dollar-crate-external.rs:14:24: 14:26 (#15), + span: $DIR/auxiliary/dollar-crate-external.rs:14:25: 14:26 (#15), }, Ident { ident: "S", diff --git a/src/test/ui/proc-macro/inner-attrs.stdout b/src/test/ui/proc-macro/inner-attrs.stdout index 490fc02f51037..ee8adf0b4a970 100644 --- a/src/test/ui/proc-macro/inner-attrs.stdout +++ b/src/test/ui/proc-macro/inner-attrs.stdout @@ -627,12 +627,12 @@ PRINT-DERIVE INPUT (DEBUG): TokenStream [ Punct { ch: '=', spacing: Joint, - span: $DIR/inner-attrs.rs:39:15: 39:17 (#0), + span: $DIR/inner-attrs.rs:39:15: 39:16 (#0), }, Punct { ch: '>', spacing: Alone, - span: $DIR/inner-attrs.rs:39:15: 39:17 (#0), + span: $DIR/inner-attrs.rs:39:16: 39:17 (#0), }, Group { delimiter: Brace, diff --git a/src/test/ui/proc-macro/issue-75930-derive-cfg.stdout b/src/test/ui/proc-macro/issue-75930-derive-cfg.stdout index c81fa201cbcf5..83afd0d3eaec3 100644 --- a/src/test/ui/proc-macro/issue-75930-derive-cfg.stdout +++ b/src/test/ui/proc-macro/issue-75930-derive-cfg.stdout @@ -489,12 +489,12 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [ Punct { ch: '=', spacing: Joint, - span: $DIR/issue-75930-derive-cfg.rs:33:32: 33:34 (#0), + span: $DIR/issue-75930-derive-cfg.rs:33:32: 33:33 (#0), }, Punct { ch: '>', spacing: Alone, - span: $DIR/issue-75930-derive-cfg.rs:33:32: 33:34 (#0), + span: $DIR/issue-75930-derive-cfg.rs:33:33: 33:34 (#0), }, Group { delimiter: Brace, @@ -567,12 +567,12 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [ Punct { ch: '=', spacing: Joint, - span: $DIR/issue-75930-derive-cfg.rs:34:60: 34:62 (#0), + span: $DIR/issue-75930-derive-cfg.rs:34:60: 34:61 (#0), }, Punct { ch: '>', spacing: Alone, - span: $DIR/issue-75930-derive-cfg.rs:34:60: 34:62 (#0), + span: $DIR/issue-75930-derive-cfg.rs:34:61: 34:62 (#0), }, Group { delimiter: Brace, @@ -591,12 +591,12 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [ Punct { ch: '=', spacing: Joint, - span: $DIR/issue-75930-derive-cfg.rs:35:15: 35:17 (#0), + span: $DIR/issue-75930-derive-cfg.rs:35:15: 35:16 (#0), }, Punct { ch: '>', spacing: Alone, - span: $DIR/issue-75930-derive-cfg.rs:35:15: 35:17 (#0), + span: $DIR/issue-75930-derive-cfg.rs:35:16: 35:17 (#0), }, Group { delimiter: Brace, @@ -1519,12 +1519,12 @@ PRINT-DERIVE INPUT (DEBUG): TokenStream [ Punct { ch: '=', spacing: Joint, - span: $DIR/issue-75930-derive-cfg.rs:34:60: 34:62 (#0), + span: $DIR/issue-75930-derive-cfg.rs:34:60: 34:61 (#0), }, Punct { ch: '>', spacing: Alone, - span: $DIR/issue-75930-derive-cfg.rs:34:60: 34:62 (#0), + span: $DIR/issue-75930-derive-cfg.rs:34:61: 34:62 (#0), }, Group { delimiter: Brace, @@ -1543,12 +1543,12 @@ PRINT-DERIVE INPUT (DEBUG): TokenStream [ Punct { ch: '=', spacing: Joint, - span: $DIR/issue-75930-derive-cfg.rs:35:15: 35:17 (#0), + span: $DIR/issue-75930-derive-cfg.rs:35:15: 35:16 (#0), }, Punct { ch: '>', spacing: Alone, - span: $DIR/issue-75930-derive-cfg.rs:35:15: 35:17 (#0), + span: $DIR/issue-75930-derive-cfg.rs:35:16: 35:17 (#0), }, Group { delimiter: Brace, diff --git a/src/test/ui/proc-macro/issue-76182-leading-vert-pat.stdout b/src/test/ui/proc-macro/issue-76182-leading-vert-pat.stdout index 5493f9c7b606b..09eb33f7e31a1 100644 --- a/src/test/ui/proc-macro/issue-76182-leading-vert-pat.stdout +++ b/src/test/ui/proc-macro/issue-76182-leading-vert-pat.stdout @@ -41,12 +41,12 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [ Punct { ch: '=', spacing: Joint, - span: $DIR/issue-76182-leading-vert-pat.rs:15:21: 15:23 (#0), + span: $DIR/issue-76182-leading-vert-pat.rs:15:21: 15:22 (#0), }, Punct { ch: '>', spacing: Alone, - span: $DIR/issue-76182-leading-vert-pat.rs:15:21: 15:23 (#0), + span: $DIR/issue-76182-leading-vert-pat.rs:15:22: 15:23 (#0), }, Group { delimiter: Parenthesis, diff --git a/src/test/ui/proc-macro/meta-macro-hygiene.stdout b/src/test/ui/proc-macro/meta-macro-hygiene.stdout index 5d04fe1e3de5f..2494af1208f14 100644 --- a/src/test/ui/proc-macro/meta-macro-hygiene.stdout +++ b/src/test/ui/proc-macro/meta-macro-hygiene.stdout @@ -1,5 +1,5 @@ Def site: $DIR/auxiliary/make-macro.rs:7:9: 7:56 (#5) -Input: TokenStream [Ident { ident: "$crate", span: $DIR/meta-macro-hygiene.rs:24:37: 24:43 (#4) }, Punct { ch: ':', spacing: Joint, span: $DIR/meta-macro-hygiene.rs:24:43: 24:45 (#4) }, Punct { ch: ':', spacing: Alone, span: $DIR/meta-macro-hygiene.rs:24:43: 24:45 (#4) }, Ident { ident: "dummy", span: $DIR/meta-macro-hygiene.rs:24:45: 24:50 (#4) }, Punct { ch: '!', spacing: Alone, span: $DIR/meta-macro-hygiene.rs:24:50: 24:51 (#4) }, Group { delimiter: Parenthesis, stream: TokenStream [], span: $DIR/meta-macro-hygiene.rs:24:51: 24:53 (#4) }] +Input: TokenStream [Ident { ident: "$crate", span: $DIR/meta-macro-hygiene.rs:24:37: 24:43 (#4) }, Punct { ch: ':', spacing: Joint, span: $DIR/meta-macro-hygiene.rs:24:43: 24:44 (#4) }, Punct { ch: ':', spacing: Alone, span: $DIR/meta-macro-hygiene.rs:24:44: 24:45 (#4) }, Ident { ident: "dummy", span: $DIR/meta-macro-hygiene.rs:24:45: 24:50 (#4) }, Punct { ch: '!', spacing: Alone, span: $DIR/meta-macro-hygiene.rs:24:50: 24:51 (#4) }, Group { delimiter: Parenthesis, stream: TokenStream [], span: $DIR/meta-macro-hygiene.rs:24:51: 24:53 (#4) }] Respanned: TokenStream [Ident { ident: "$crate", span: $DIR/auxiliary/make-macro.rs:7:9: 7:56 (#5) }, Punct { ch: ':', spacing: Joint, span: $DIR/auxiliary/make-macro.rs:7:9: 7:56 (#5) }, Punct { ch: ':', spacing: Alone, span: $DIR/auxiliary/make-macro.rs:7:9: 7:56 (#5) }, Ident { ident: "dummy", span: $DIR/auxiliary/make-macro.rs:7:9: 7:56 (#5) }, Punct { ch: '!', spacing: Alone, span: $DIR/auxiliary/make-macro.rs:7:9: 7:56 (#5) }, Group { delimiter: Parenthesis, stream: TokenStream [], span: $DIR/auxiliary/make-macro.rs:7:9: 7:56 (#5) }] #![feature /* 0#0 */(prelude_import)] // aux-build:make-macro.rs diff --git a/src/test/ui/proc-macro/three-equals.stderr b/src/test/ui/proc-macro/three-equals.stderr index 1ce5e02bd82f7..9cdb2a21b04b3 100644 --- a/src/test/ui/proc-macro/three-equals.stderr +++ b/src/test/ui/proc-macro/three-equals.stderr @@ -8,16 +8,16 @@ LL | three_equals!(==); = note: this error originates in the macro `three_equals` (in Nightly builds, run with -Z macro-backtrace for more info) error: expected EOF, found `=`. - --> $DIR/three-equals.rs:15:21 + --> $DIR/three-equals.rs:15:22 | LL | three_equals!(=====); - | ^^ + | ^ | note: last good input was here --> $DIR/three-equals.rs:15:21 | LL | three_equals!(=====); - | ^^ + | ^ = help: input must be: `===` error: expected `=`, found `abc`. diff --git a/src/test/ui/process/process-panic-after-fork.rs b/src/test/ui/process/process-panic-after-fork.rs index 08b30b600e737..d0a938c03e803 100644 --- a/src/test/ui/process/process-panic-after-fork.rs +++ b/src/test/ui/process/process-panic-after-fork.rs @@ -6,6 +6,7 @@ // ignore-emscripten no processes // ignore-sgx no processes // ignore-android: FIXME(#85261) +// ignore-fuchsia no fork #![feature(rustc_private)] #![feature(never_type)] diff --git a/src/test/ui/simd/target-feature-mixup.rs b/src/test/ui/simd/target-feature-mixup.rs index 6d7688191b7f1..5dd163715eb49 100644 --- a/src/test/ui/simd/target-feature-mixup.rs +++ b/src/test/ui/simd/target-feature-mixup.rs @@ -5,6 +5,7 @@ // ignore-emscripten // ignore-sgx no processes +// ignore-fuchsia must translate zircon signal to SIGILL, FIXME (#58590) #![feature(repr_simd, target_feature, cfg_target_feature)] #![feature(avx512_target_feature)] diff --git a/src/test/ui/suggestions/sugg-else-for-closure.fixed b/src/test/ui/suggestions/sugg-else-for-closure.fixed new file mode 100644 index 0000000000000..cf381d9da8be9 --- /dev/null +++ b/src/test/ui/suggestions/sugg-else-for-closure.fixed @@ -0,0 +1,8 @@ +// run-rustfix + +fn main() { + let x = "com.example.app"; + let y: Option<&str> = None; + let _s = y.unwrap_or_else(|| x.split('.').nth(1).unwrap()); + //~^ ERROR: mismatched types [E0308] +} diff --git a/src/test/ui/suggestions/sugg-else-for-closure.rs b/src/test/ui/suggestions/sugg-else-for-closure.rs new file mode 100644 index 0000000000000..540ced91fc950 --- /dev/null +++ b/src/test/ui/suggestions/sugg-else-for-closure.rs @@ -0,0 +1,8 @@ +// run-rustfix + +fn main() { + let x = "com.example.app"; + let y: Option<&str> = None; + let _s = y.unwrap_or(|| x.split('.').nth(1).unwrap()); + //~^ ERROR: mismatched types [E0308] +} diff --git a/src/test/ui/suggestions/sugg-else-for-closure.stderr b/src/test/ui/suggestions/sugg-else-for-closure.stderr new file mode 100644 index 0000000000000..55a0eee18179a --- /dev/null +++ b/src/test/ui/suggestions/sugg-else-for-closure.stderr @@ -0,0 +1,23 @@ +error[E0308]: mismatched types + --> $DIR/sugg-else-for-closure.rs:6:26 + | +LL | let _s = y.unwrap_or(|| x.split('.').nth(1).unwrap()); + | --------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `&str`, found closure + | | + | arguments to this function are incorrect + | + = note: expected reference `&str` + found closure `[closure@$DIR/sugg-else-for-closure.rs:6:26: 6:28]` +note: associated function defined here + --> $SRC_DIR/core/src/option.rs:LL:COL + | +LL | pub const fn unwrap_or(self, default: T) -> T + | ^^^^^^^^^ +help: try calling `unwrap_or_else` instead + | +LL | let _s = y.unwrap_or_else(|| x.split('.').nth(1).unwrap()); + | +++++ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`.