Auto merge of #111552 - matthiaskrgr:rollup-4nidoti, r=matthiaskrgr
Rollup of 4 pull requests Successful merges: - #111463 (Better diagnostics for `env!` where variable contains escape) - #111477 (better diagnostics for `impl<..> impl Trait for Type`) - #111534 (rustdoc-json: Add tests for `#![feature(inherent_associated_types)]`) - #111549 ([rustdoc] Convert more GUI tests colors to their original format) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
commit
0a0e045e50
@ -63,7 +63,8 @@ pub fn expand_env<'cx>(
|
||||
Some(exprs) => exprs.into_iter(),
|
||||
};
|
||||
|
||||
let Some((var, _style)) = expr_to_string(cx, exprs.next().unwrap(), "expected string literal") else {
|
||||
let var_expr = exprs.next().unwrap();
|
||||
let Some((var, _)) = expr_to_string(cx, var_expr.clone(), "expected string literal") else {
|
||||
return DummyResult::any(sp);
|
||||
};
|
||||
|
||||
@ -71,7 +72,7 @@ pub fn expand_env<'cx>(
|
||||
None => None,
|
||||
Some(second) => match expr_to_string(cx, second, "expected string literal") {
|
||||
None => return DummyResult::any(sp),
|
||||
Some((s, _style)) => Some(s),
|
||||
Some((s, _)) => Some(s),
|
||||
},
|
||||
};
|
||||
|
||||
@ -80,10 +81,15 @@ pub fn expand_env<'cx>(
|
||||
cx.sess.parse_sess.env_depinfo.borrow_mut().insert((var, value));
|
||||
let e = match value {
|
||||
None => {
|
||||
// Use the string literal in the code in the diagnostic to avoid confusing diagnostics,
|
||||
// e.g. when the literal contains escape sequences.
|
||||
let ast::ExprKind::Lit(ast::token::Lit { kind: ast::token::LitKind::Str, symbol: original_var, ..}) = &var_expr.kind else {
|
||||
unreachable!("`expr_to_string` ensures this is a string lit")
|
||||
};
|
||||
cx.emit_err(errors::EnvNotDefined {
|
||||
span: sp,
|
||||
msg: custom_msg,
|
||||
var,
|
||||
var: *original_var,
|
||||
help: custom_msg.is_none().then(|| help_for_missing_env_var(var.as_str())),
|
||||
});
|
||||
return DummyResult::any(sp);
|
||||
|
@ -478,6 +478,11 @@ parse_missing_for_in_trait_impl = missing `for` in a trait impl
|
||||
|
||||
parse_expected_trait_in_trait_impl_found_type = expected a trait, found type
|
||||
|
||||
parse_extra_impl_keyword_in_trait_impl = unexpected `impl` keyword
|
||||
.suggestion = remove the extra `impl`
|
||||
.note = this is parsed as an `impl Trait` type, but a trait is expected at this position
|
||||
|
||||
|
||||
parse_non_item_in_item_list = non-item in item list
|
||||
.suggestion_use_const_not_let = consider using `const` instead of `let` for associated const
|
||||
.label_list_start = item list starts here
|
||||
|
@ -1519,6 +1519,16 @@ pub(crate) struct ExpectedTraitInTraitImplFoundType {
|
||||
pub span: Span,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(parse_extra_impl_keyword_in_trait_impl)]
|
||||
pub(crate) struct ExtraImplKeywordInTraitImpl {
|
||||
#[primary_span]
|
||||
#[suggestion(code = "", applicability = "maybe-incorrect")]
|
||||
pub extra_impl_kw: Span,
|
||||
#[note]
|
||||
pub impl_trait_span: Span,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(parse_bounds_not_allowed_on_trait_aliases)]
|
||||
pub(crate) struct BoundsNotAllowedOnTraitAliases {
|
||||
|
@ -603,10 +603,24 @@ impl<'a> Parser<'a> {
|
||||
let path = match ty_first.kind {
|
||||
// This notably includes paths passed through `ty` macro fragments (#46438).
|
||||
TyKind::Path(None, path) => path,
|
||||
_ => {
|
||||
self.sess.emit_err(errors::ExpectedTraitInTraitImplFoundType {
|
||||
span: ty_first.span,
|
||||
});
|
||||
other => {
|
||||
if let TyKind::ImplTrait(_, bounds) = other
|
||||
&& let [bound] = bounds.as_slice()
|
||||
{
|
||||
// Suggest removing extra `impl` keyword:
|
||||
// `impl<T: Default> impl Default for Wrapper<T>`
|
||||
// ^^^^^
|
||||
let extra_impl_kw = ty_first.span.until(bound.span());
|
||||
self.sess
|
||||
.emit_err(errors::ExtraImplKeywordInTraitImpl {
|
||||
extra_impl_kw,
|
||||
impl_trait_span: ty_first.span
|
||||
});
|
||||
} else {
|
||||
self.sess.emit_err(errors::ExpectedTraitInTraitImplFoundType {
|
||||
span: ty_first.span,
|
||||
});
|
||||
}
|
||||
err_path(ty_first.span)
|
||||
}
|
||||
};
|
||||
|
@ -1 +1 @@
|
||||
0.16.0
|
||||
0.16.3
|
@ -47,89 +47,89 @@ reload:
|
||||
wait-for: "#search-tabs"
|
||||
assert-css: (
|
||||
"#search-tabs > button > .count",
|
||||
{"color": "rgb(136, 136, 136)"},
|
||||
{"color": "#888"},
|
||||
ALL,
|
||||
)
|
||||
assert-css: (
|
||||
"//*[@class='desc'][text()='Just a normal struct.']",
|
||||
{"color": "rgb(197, 197, 197)"},
|
||||
{"color": "#c5c5c5"},
|
||||
)
|
||||
assert-css: (
|
||||
"//*[@class='result-name']/*[text()='test_docs::']",
|
||||
{"color": "rgb(0, 150, 207)"},
|
||||
{"color": "#0096cf"},
|
||||
)
|
||||
|
||||
// Checking the color of the bottom border.
|
||||
assert-css: (
|
||||
".search-results > a",
|
||||
{"border-bottom-color": "rgba(170, 170, 170, 0.2)"}
|
||||
{"border-bottom-color": "#aaa3"}
|
||||
)
|
||||
|
||||
// Checking the color of "keyword" text.
|
||||
assert-css: (
|
||||
"//*[@class='result-name']//*[text()='(keyword)']",
|
||||
{"color": "rgb(120, 135, 151)"},
|
||||
{"color": "#788797"},
|
||||
)
|
||||
|
||||
store-value: (entry_color, "rgb(0, 150, 207)") // color of the search entry
|
||||
store-value: (hover_entry_color, "rgb(255, 255, 255)") // color of the hovered/focused search entry
|
||||
store-value: (background_color, "rgba(0, 0, 0, 0)") // background color
|
||||
store-value: (hover_background_color, "rgb(60, 60, 60)") // hover background color
|
||||
store-value: (entry_color, "#0096cf") // color of the search entry
|
||||
store-value: (hover_entry_color, "#fff") // color of the hovered/focused search entry
|
||||
store-value: (background_color, "transparent") // background color
|
||||
store-value: (hover_background_color, "#3c3c3c") // hover background color
|
||||
|
||||
call-function: (
|
||||
"check-result-color", (
|
||||
"keyword", // item kind
|
||||
"rgb(57, 175, 215)", // color of item kind
|
||||
"rgb(57, 175, 215)", // color of hovered/focused item kind
|
||||
"#39afd7", // color of item kind
|
||||
"#39afd7", // color of hovered/focused item kind
|
||||
),
|
||||
)
|
||||
call-function: (
|
||||
"check-result-color", (
|
||||
"struct", // item kind
|
||||
"rgb(255, 160, 165)", // color of item kind
|
||||
"rgb(255, 160, 165)", // color of hovered/focused item kind
|
||||
"#ffa0a5", // color of item kind
|
||||
"#ffa0a5", // color of hovered/focused item kind
|
||||
),
|
||||
)
|
||||
call-function: (
|
||||
"check-result-color", (
|
||||
"associatedtype", // item kind
|
||||
"rgb(57, 175, 215)", // color of item kind
|
||||
"rgb(57, 175, 215)", // color of hovered/focused item kind
|
||||
"#39afd7", // color of item kind
|
||||
"#39afd7", // color of hovered/focused item kind
|
||||
),
|
||||
)
|
||||
call-function: (
|
||||
"check-result-color", (
|
||||
"tymethod", // item kind
|
||||
"rgb(253, 214, 135)", // color of item kind
|
||||
"rgb(253, 214, 135)", // color of hovered/focused item kind
|
||||
"#fdd687", // color of item kind
|
||||
"#fdd687", // color of hovered/focused item kind
|
||||
),
|
||||
)
|
||||
call-function: (
|
||||
"check-result-color", (
|
||||
"method", // item kind
|
||||
"rgb(253, 214, 135)", // color of item kind
|
||||
"rgb(253, 214, 135)", // color of hovered/focused item kind
|
||||
"#fdd687", // color of item kind
|
||||
"#fdd687", // color of hovered/focused item kind
|
||||
),
|
||||
)
|
||||
call-function: (
|
||||
"check-result-color", (
|
||||
"structfield", // item kind
|
||||
"rgb(0, 150, 207)", // color of item kind
|
||||
"rgb(255, 255, 255)", // color of hovered/focused item kind
|
||||
"#0096cf", // color of item kind
|
||||
"#fff", // color of hovered/focused item kind
|
||||
),
|
||||
)
|
||||
call-function: (
|
||||
"check-result-color", (
|
||||
"macro", // item kind
|
||||
"rgb(163, 122, 204)", // color of item kind
|
||||
"rgb(163, 122, 204)", // color of hovered/focused item kind
|
||||
"#a37acc", // color of item kind
|
||||
"#a37acc", // color of hovered/focused item kind
|
||||
),
|
||||
)
|
||||
call-function: (
|
||||
"check-result-color", (
|
||||
"fn", // item kind
|
||||
"rgb(253, 214, 135)", // color of item kind
|
||||
"rgb(253, 214, 135)", // color of hovered/focused item kind
|
||||
"#fdd687", // color of item kind
|
||||
"#fdd687", // color of hovered/focused item kind
|
||||
),
|
||||
)
|
||||
|
||||
@ -138,7 +138,7 @@ move-cursor-to: ".search-input"
|
||||
focus: ".search-input" // To ensure the `<a>` 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)"},
|
||||
{"color": "#0096cf", "background-color": "transparent"},
|
||||
ALL,
|
||||
)
|
||||
|
||||
@ -146,11 +146,11 @@ assert-css: (
|
||||
move-cursor-to: "//*[@class='desc'][text()='Just a normal struct.']"
|
||||
assert-css: (
|
||||
"//*[@class='result-name']/*[text()='test_docs::']",
|
||||
{"color": "rgb(255, 255, 255)"},
|
||||
{"color": "#fff"},
|
||||
)
|
||||
assert-css: (
|
||||
"//*[@class='result-name']/*[text()='test_docs::']/ancestor::a",
|
||||
{"color": "rgb(255, 255, 255)", "background-color": "rgb(60, 60, 60)"},
|
||||
{"color": "#fff", "background-color": "rgb(60, 60, 60)"},
|
||||
)
|
||||
|
||||
// Dark theme
|
||||
@ -164,89 +164,89 @@ reload:
|
||||
wait-for: "#search-tabs"
|
||||
assert-css: (
|
||||
"#search-tabs > button > .count",
|
||||
{"color": "rgb(136, 136, 136)"},
|
||||
{"color": "#888"},
|
||||
ALL,
|
||||
)
|
||||
assert-css: (
|
||||
"//*[@class='desc'][text()='Just a normal struct.']",
|
||||
{"color": "rgb(221, 221, 221)"},
|
||||
{"color": "#ddd"},
|
||||
)
|
||||
assert-css: (
|
||||
"//*[@class='result-name']/*[text()='test_docs::']",
|
||||
{"color": "rgb(221, 221, 221)"},
|
||||
{"color": "#ddd"},
|
||||
)
|
||||
|
||||
// Checking the color of the bottom border.
|
||||
assert-css: (
|
||||
".search-results > a",
|
||||
{"border-bottom-color": "rgba(170, 170, 170, 0.2)"}
|
||||
{"border-bottom-color": "#aaa3"}
|
||||
)
|
||||
|
||||
// Checking the color for "keyword" text.
|
||||
assert-css: (
|
||||
"//*[@class='result-name']//*[text()='(keyword)']",
|
||||
{"color": "rgb(221, 221, 221)"},
|
||||
{"color": "#ddd"},
|
||||
)
|
||||
|
||||
store-value: (entry_color, "rgb(221, 221, 221)") // color of the search entry
|
||||
store-value: (hover_entry_color, "rgb(221, 221, 221)") // color of the hovered/focused search entry
|
||||
store-value: (background_color, "rgba(0, 0, 0, 0)") // background color
|
||||
store-value: (hover_background_color, "rgb(97, 97, 97)") // hover background color
|
||||
store-value: (entry_color, "#ddd") // color of the search entry
|
||||
store-value: (hover_entry_color, "#ddd") // color of the hovered/focused search entry
|
||||
store-value: (background_color, "transparent") // background color
|
||||
store-value: (hover_background_color, "#616161") // hover background color
|
||||
|
||||
call-function: (
|
||||
"check-result-color", (
|
||||
"keyword", // item kind
|
||||
"rgb(210, 153, 29)", // color of item kind
|
||||
"rgb(210, 153, 29)", // color of hovered/focused item kind
|
||||
"#d2991d", // color of item kind
|
||||
"#d2991d", // color of hovered/focused item kind
|
||||
),
|
||||
)
|
||||
call-function: (
|
||||
"check-result-color", (
|
||||
"struct", // item kind
|
||||
"rgb(45, 191, 184)", // color of item kind
|
||||
"rgb(45, 191, 184)", // color of hovered/focused item kind
|
||||
"#2dbfb8", // color of item kind
|
||||
"#2dbfb8", // color of hovered/focused item kind
|
||||
),
|
||||
)
|
||||
call-function: (
|
||||
"check-result-color", (
|
||||
"associatedtype", // item kind
|
||||
"rgb(210, 153, 29)", // color of item kind
|
||||
"rgb(210, 153, 29)", // color of hovered/focused item kind
|
||||
"#d2991d", // color of item kind
|
||||
"#d2991d", // color of hovered/focused item kind
|
||||
),
|
||||
)
|
||||
call-function: (
|
||||
"check-result-color", (
|
||||
"tymethod", // item kind
|
||||
"rgb(43, 171, 99)", // color of item kind
|
||||
"rgb(43, 171, 99)", // color of hovered/focused item kind
|
||||
"#2bab63", // color of item kind
|
||||
"#2bab63", // color of hovered/focused item kind
|
||||
),
|
||||
)
|
||||
call-function: (
|
||||
"check-result-color", (
|
||||
"method", // item kind
|
||||
"rgb(43, 171, 99)", // color of item kind
|
||||
"rgb(43, 171, 99)", // color of hovered/focused item kind
|
||||
"#2bab63", // color of item kind
|
||||
"#2bab63", // color of hovered/focused item kind
|
||||
),
|
||||
)
|
||||
call-function: (
|
||||
"check-result-color", (
|
||||
"structfield", // item kind
|
||||
"rgb(221, 221, 221)", // color of item kind
|
||||
"rgb(221, 221, 221)", // color of hovered/focused item kind
|
||||
"#ddd", // color of item kind
|
||||
"#ddd", // color of hovered/focused item kind
|
||||
),
|
||||
)
|
||||
call-function: (
|
||||
"check-result-color", (
|
||||
"macro", // item kind
|
||||
"rgb(9, 189, 0)", // color of item kind
|
||||
"rgb(9, 189, 0)", // color of hovered/focused item kind
|
||||
"#09bd00", // color of item kind
|
||||
"#09bd00", // color of hovered/focused item kind
|
||||
),
|
||||
)
|
||||
call-function: (
|
||||
"check-result-color", (
|
||||
"fn", // item kind
|
||||
"rgb(43, 171, 99)", // color of item kind
|
||||
"rgb(43, 171, 99)", // color of hovered/focused item kind
|
||||
"#2bab63", // color of item kind
|
||||
"#2bab63", // color of hovered/focused item kind
|
||||
),
|
||||
)
|
||||
|
||||
@ -255,7 +255,7 @@ move-cursor-to: ".search-input"
|
||||
focus: ".search-input" // To ensure the `<a>` container isnt focus or hover.
|
||||
assert-css: (
|
||||
"//*[@class='result-name']/*[text()='test_docs::']/ancestor::a",
|
||||
{"color": "rgb(221, 221, 221)", "background-color": "rgba(0, 0, 0, 0)"},
|
||||
{"color": "#ddd", "background-color": "transparent"},
|
||||
)
|
||||
|
||||
// Light theme
|
||||
@ -266,89 +266,89 @@ reload:
|
||||
wait-for: "#search-tabs"
|
||||
assert-css: (
|
||||
"#search-tabs > button > .count",
|
||||
{"color": "rgb(136, 136, 136)"},
|
||||
{"color": "#888"},
|
||||
ALL,
|
||||
)
|
||||
assert-css: (
|
||||
"//*[@class='desc'][text()='Just a normal struct.']",
|
||||
{"color": "rgb(0, 0, 0)"},
|
||||
{"color": "#000"},
|
||||
)
|
||||
assert-css: (
|
||||
"//*[@class='result-name']/*[text()='test_docs::']",
|
||||
{"color": "rgb(0, 0, 0)"},
|
||||
{"color": "#000"},
|
||||
)
|
||||
|
||||
// Checking the color of the bottom border.
|
||||
assert-css: (
|
||||
".search-results > a",
|
||||
{"border-bottom-color": "rgba(170, 170, 170, 0.2)"}
|
||||
{"border-bottom-color": "#aaa3"}
|
||||
)
|
||||
|
||||
// Checking the color for "keyword" text.
|
||||
assert-css: (
|
||||
"//*[@class='result-name']//*[text()='(keyword)']",
|
||||
{"color": "rgb(0, 0, 0)"},
|
||||
{"color": "#000"},
|
||||
)
|
||||
|
||||
store-value: (entry_color, "rgb(0, 0, 0)") // color of the search entry
|
||||
store-value: (hover_entry_color, "rgb(0, 0, 0)") // color of the hovered/focused search entry
|
||||
store-value: (background_color, "rgba(0, 0, 0, 0)") // background color
|
||||
store-value: (hover_background_color, "rgb(204, 204, 204)") // hover background color
|
||||
store-value: (entry_color, "#000") // color of the search entry
|
||||
store-value: (hover_entry_color, "#000") // color of the hovered/focused search entry
|
||||
store-value: (background_color, "transparent") // background color
|
||||
store-value: (hover_background_color, "#ccc") // hover background color
|
||||
|
||||
call-function: (
|
||||
"check-result-color", (
|
||||
"keyword", // item kind
|
||||
"rgb(56, 115, 173)", // color of item kind
|
||||
"rgb(56, 115, 173)", // color of hovered/focused item kind
|
||||
"#3873ad", // color of item kind
|
||||
"#3873ad", // color of hovered/focused item kind
|
||||
),
|
||||
)
|
||||
call-function: (
|
||||
"check-result-color", (
|
||||
"struct", // item kind
|
||||
"rgb(173, 55, 138)", // color of item kind
|
||||
"rgb(173, 55, 138)", // color of hovered/focused item kind
|
||||
"#ad378a", // color of item kind
|
||||
"#ad378a", // color of hovered/focused item kind
|
||||
),
|
||||
)
|
||||
call-function: (
|
||||
"check-result-color", (
|
||||
"associatedtype", // item kind
|
||||
"rgb(56, 115, 173)", // color of item kind
|
||||
"rgb(56, 115, 173)", // color of hovered/focused item kind
|
||||
"#3873ad", // color of item kind
|
||||
"#3873ad", // color of hovered/focused item kind
|
||||
),
|
||||
)
|
||||
call-function: (
|
||||
"check-result-color", (
|
||||
"tymethod", // item kind
|
||||
"rgb(173, 124, 55)", // color of item kind
|
||||
"rgb(173, 124, 55)", // color of hovered/focused item kind
|
||||
"#ad7c37", // color of item kind
|
||||
"#ad7c37", // color of hovered/focused item kind
|
||||
),
|
||||
)
|
||||
call-function: (
|
||||
"check-result-color", (
|
||||
"method", // item kind
|
||||
"rgb(173, 124, 55)", // color of item kind
|
||||
"rgb(173, 124, 55)", // color of hovered/focused item kind
|
||||
"#ad7c37", // color of item kind
|
||||
"#ad7c37", // color of hovered/focused item kind
|
||||
),
|
||||
)
|
||||
call-function: (
|
||||
"check-result-color", (
|
||||
"structfield", // item kind
|
||||
"rgb(0, 0, 0)", // color of item kind
|
||||
"rgb(0, 0, 0)", // color of hovered/focused item kind
|
||||
"#000", // color of item kind
|
||||
"#000", // color of hovered/focused item kind
|
||||
),
|
||||
)
|
||||
call-function: (
|
||||
"check-result-color", (
|
||||
"macro", // item kind
|
||||
"rgb(6, 128, 0)", // color of item kind
|
||||
"rgb(6, 128, 0)", // color of hovered/focused item kind
|
||||
"#068000", // color of item kind
|
||||
"#068000", // color of hovered/focused item kind
|
||||
),
|
||||
)
|
||||
call-function: (
|
||||
"check-result-color", (
|
||||
"fn", // item kind
|
||||
"rgb(173, 124, 55)", // color of item kind
|
||||
"rgb(173, 124, 55)", // color of hovered/focused item kind
|
||||
"#ad7c37", // color of item kind
|
||||
"#ad7c37", // color of hovered/focused item kind
|
||||
),
|
||||
)
|
||||
|
||||
@ -357,7 +357,7 @@ move-cursor-to: ".search-input"
|
||||
focus: ".search-input" // To ensure the `<a>` container isnt focus or hover.
|
||||
assert-css: (
|
||||
"//*[@class='result-name']/*[text()='test_docs::']/ancestor::a",
|
||||
{"color": "rgb(0, 0, 0)", "background-color": "rgba(0, 0, 0, 0)"},
|
||||
{"color": "#000", "background-color": "transparent"},
|
||||
)
|
||||
|
||||
// Check the alias.
|
||||
@ -386,16 +386,16 @@ define-function: (
|
||||
|
||||
call-function: ("check-alias", {
|
||||
"theme": "ayu",
|
||||
"alias": "rgb(197, 197, 197)",
|
||||
"grey": "rgb(153, 153, 153)",
|
||||
"alias": "#c5c5c5",
|
||||
"grey": "#999",
|
||||
})
|
||||
call-function: ("check-alias", {
|
||||
"theme": "dark",
|
||||
"alias": "rgb(255, 255, 255)",
|
||||
"grey": "rgb(204, 204, 204)",
|
||||
"alias": "#fff",
|
||||
"grey": "#ccc",
|
||||
})
|
||||
call-function: ("check-alias", {
|
||||
"theme": "light",
|
||||
"alias": "rgb(0, 0, 0)",
|
||||
"grey": "rgb(153, 153, 153)",
|
||||
"alias": "#000",
|
||||
"grey": "#999",
|
||||
})
|
||||
|
29
tests/rustdoc-json/type/inherent_associated_type.rs
Normal file
29
tests/rustdoc-json/type/inherent_associated_type.rs
Normal file
@ -0,0 +1,29 @@
|
||||
// ignore-tidy-linelength
|
||||
#![feature(inherent_associated_types)]
|
||||
#![feature(no_core)]
|
||||
#![allow(incomplete_features)]
|
||||
#![no_core]
|
||||
|
||||
// @set OwnerMetadata = '$.index[*][?(@.name=="OwnerMetadata")].id'
|
||||
pub struct OwnerMetadata;
|
||||
// @set Owner = '$.index[*][?(@.name=="Owner")].id'
|
||||
pub struct Owner;
|
||||
|
||||
pub fn create() -> Owner::Metadata {
|
||||
OwnerMetadata
|
||||
}
|
||||
// @is '$.index[*][?(@.name=="create")].inner.decl.output.kind' '"qualified_path"'
|
||||
// @is '$.index[*][?(@.name=="create")].inner.decl.output.inner.name' '"Metadata"'
|
||||
// @is '$.index[*][?(@.name=="create")].inner.decl.output.inner.trait' null
|
||||
// @is '$.index[*][?(@.name=="create")].inner.decl.output.inner.self_type.kind' '"resolved_path"'
|
||||
// @is '$.index[*][?(@.name=="create")].inner.decl.output.inner.self_type.inner.id' $Owner
|
||||
|
||||
/// impl
|
||||
impl Owner {
|
||||
/// iat
|
||||
pub type Metadata = OwnerMetadata;
|
||||
}
|
||||
// @set iat = '$.index[*][?(@.docs=="iat")].id'
|
||||
// @is '$.index[*][?(@.docs=="impl")].inner.items[*]' $iat
|
||||
// @is '$.index[*][?(@.docs=="iat")].kind' '"assoc_type"'
|
||||
// @is '$.index[*][?(@.docs=="iat")].inner.default.inner.id' $OwnerMetadata
|
21
tests/rustdoc-json/type/inherent_associated_type_bound.rs
Normal file
21
tests/rustdoc-json/type/inherent_associated_type_bound.rs
Normal file
@ -0,0 +1,21 @@
|
||||
// ignore-tidy-linelength
|
||||
#![feature(inherent_associated_types)]
|
||||
#![allow(incomplete_features)]
|
||||
|
||||
// @set Carrier = '$.index[*][?(@.name=="Carrier")].id'
|
||||
pub struct Carrier<'a>(&'a ());
|
||||
|
||||
// @is '$.index[*][?(@.name=="User")].inner.type.kind' '"function_pointer"'
|
||||
// @is '$.index[*][?(@.name=="User")].inner.type.inner.generic_params[*].name' \""'b"\"
|
||||
// @is '$.index[*][?(@.name=="User")].inner.type.inner.decl.inputs[0][1].kind' '"qualified_path"'
|
||||
// @is '$.index[*][?(@.name=="User")].inner.type.inner.decl.inputs[0][1].inner.self_type.inner.id' $Carrier
|
||||
// @is '$.index[*][?(@.name=="User")].inner.type.inner.decl.inputs[0][1].inner.self_type.inner.args.angle_bracketed.args[0].lifetime' \""'b"\"
|
||||
// @is '$.index[*][?(@.name=="User")].inner.type.inner.decl.inputs[0][1].inner.name' '"Focus"'
|
||||
// @is '$.index[*][?(@.name=="User")].inner.type.inner.decl.inputs[0][1].inner.trait' null
|
||||
// @is '$.index[*][?(@.name=="User")].inner.type.inner.decl.inputs[0][1].inner.args.angle_bracketed.args[0].type.inner' '"i32"'
|
||||
|
||||
pub type User = for<'b> fn(Carrier<'b>::Focus<i32>);
|
||||
|
||||
impl<'a> Carrier<'a> {
|
||||
pub type Focus<T> = &'a mut T;
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
// ignore-tidy-linelength
|
||||
#![feature(inherent_associated_types)]
|
||||
#![allow(incomplete_features)]
|
||||
|
||||
// @set Parametrized = '$.index[*][?(@.name=="Parametrized")].id'
|
||||
pub struct Parametrized<T>(T);
|
||||
|
||||
// @is '$.index[*][?(@.name=="Test")].inner.type.kind' '"qualified_path"'
|
||||
// @is '$.index[*][?(@.name=="Test")].inner.type.inner.self_type.inner.id' $Parametrized
|
||||
// @is '$.index[*][?(@.name=="Test")].inner.type.inner.self_type.inner.args.angle_bracketed.args[0].type' '{"inner": "i32", "kind": "primitive"}'
|
||||
// @is '$.index[*][?(@.name=="Test")].inner.type.inner.name' '"Proj"'
|
||||
// @is '$.index[*][?(@.name=="Test")].inner.type.inner.trait' null
|
||||
pub type Test = Parametrized<i32>::Proj;
|
||||
|
||||
/// param_bool
|
||||
impl Parametrized<bool> {
|
||||
/// param_bool_proj
|
||||
pub type Proj = ();
|
||||
}
|
||||
|
||||
/// param_i32
|
||||
impl Parametrized<i32> {
|
||||
/// param_i32_proj
|
||||
pub type Proj = String;
|
||||
}
|
||||
|
||||
// @set param_bool = '$.index[*][?(@.docs=="param_bool")].id'
|
||||
// @set param_i32 = '$.index[*][?(@.docs=="param_i32")].id'
|
||||
// @set param_bool_proj = '$.index[*][?(@.docs=="param_bool_proj")].id'
|
||||
// @set param_i32_proj = '$.index[*][?(@.docs=="param_i32_proj")].id'
|
||||
|
||||
// @is '$.index[*][?(@.docs=="param_bool")].inner.items[*]' $param_bool_proj
|
||||
// @is '$.index[*][?(@.docs=="param_i32")].inner.items[*]' $param_i32_proj
|
3
tests/ui/extenv/extenv-escaped-var.rs
Normal file
3
tests/ui/extenv/extenv-escaped-var.rs
Normal file
@ -0,0 +1,3 @@
|
||||
fn main() {
|
||||
env!("\t"); //~ERROR environment variable `\t` not defined at compile time
|
||||
}
|
11
tests/ui/extenv/extenv-escaped-var.stderr
Normal file
11
tests/ui/extenv/extenv-escaped-var.stderr
Normal file
@ -0,0 +1,11 @@
|
||||
error: environment variable `\t` not defined at compile time
|
||||
--> $DIR/extenv-escaped-var.rs:2:5
|
||||
|
|
||||
LL | env!("\t");
|
||||
| ^^^^^^^^^^
|
||||
|
|
||||
= help: use `std::env::var("\t")` to read the variable at run time
|
||||
= note: this error originates in the macro `env` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: aborting due to previous error
|
||||
|
@ -1,28 +1,28 @@
|
||||
error: environment variable ` ` not defined at compile time
|
||||
error: environment variable `\t` not defined at compile time
|
||||
--> $DIR/issue-110547.rs:4:5
|
||||
|
|
||||
LL | env!{"\t"};
|
||||
| ^^^^^^^^^^
|
||||
|
|
||||
= help: use `std::env::var(" ")` to read the variable at run time
|
||||
= help: use `std::env::var("\t")` to read the variable at run time
|
||||
= note: this error originates in the macro `env` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: environment variable ` ` not defined at compile time
|
||||
error: environment variable `\t` not defined at compile time
|
||||
--> $DIR/issue-110547.rs:5:5
|
||||
|
|
||||
LL | env!("\t");
|
||||
| ^^^^^^^^^^
|
||||
|
|
||||
= help: use `std::env::var(" ")` to read the variable at run time
|
||||
= help: use `std::env::var("\t")` to read the variable at run time
|
||||
= note: this error originates in the macro `env` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: environment variable `` not defined at compile time
|
||||
error: environment variable `\u{2069}` not defined at compile time
|
||||
--> $DIR/issue-110547.rs:6:5
|
||||
|
|
||||
LL | env!("\u{2069}");
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: use `std::env::var("")` to read the variable at run time
|
||||
= help: use `std::env::var("\u{2069}")` to read the variable at run time
|
||||
= note: this error originates in the macro `env` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
19
tests/ui/impl-trait/extra-impl-in-trait-impl.fixed
Normal file
19
tests/ui/impl-trait/extra-impl-in-trait-impl.fixed
Normal file
@ -0,0 +1,19 @@
|
||||
// run-rustfix
|
||||
|
||||
struct S<T>(T);
|
||||
struct S2;
|
||||
|
||||
impl<T: Default> Default for S<T> {
|
||||
//~^ ERROR: unexpected `impl` keyword
|
||||
//~| HELP: remove the extra `impl`
|
||||
fn default() -> Self { todo!() }
|
||||
}
|
||||
|
||||
impl Default for S2 {
|
||||
//~^ ERROR: unexpected `impl` keyword
|
||||
//~| HELP: remove the extra `impl`
|
||||
fn default() -> Self { todo!() }
|
||||
}
|
||||
|
||||
|
||||
fn main() {}
|
19
tests/ui/impl-trait/extra-impl-in-trait-impl.rs
Normal file
19
tests/ui/impl-trait/extra-impl-in-trait-impl.rs
Normal file
@ -0,0 +1,19 @@
|
||||
// run-rustfix
|
||||
|
||||
struct S<T>(T);
|
||||
struct S2;
|
||||
|
||||
impl<T: Default> impl Default for S<T> {
|
||||
//~^ ERROR: unexpected `impl` keyword
|
||||
//~| HELP: remove the extra `impl`
|
||||
fn default() -> Self { todo!() }
|
||||
}
|
||||
|
||||
impl impl Default for S2 {
|
||||
//~^ ERROR: unexpected `impl` keyword
|
||||
//~| HELP: remove the extra `impl`
|
||||
fn default() -> Self { todo!() }
|
||||
}
|
||||
|
||||
|
||||
fn main() {}
|
26
tests/ui/impl-trait/extra-impl-in-trait-impl.stderr
Normal file
26
tests/ui/impl-trait/extra-impl-in-trait-impl.stderr
Normal file
@ -0,0 +1,26 @@
|
||||
error: unexpected `impl` keyword
|
||||
--> $DIR/extra-impl-in-trait-impl.rs:6:18
|
||||
|
|
||||
LL | impl<T: Default> impl Default for S<T> {
|
||||
| ^^^^^ help: remove the extra `impl`
|
||||
|
|
||||
note: this is parsed as an `impl Trait` type, but a trait is expected at this position
|
||||
--> $DIR/extra-impl-in-trait-impl.rs:6:18
|
||||
|
|
||||
LL | impl<T: Default> impl Default for S<T> {
|
||||
| ^^^^^^^^^^^^
|
||||
|
||||
error: unexpected `impl` keyword
|
||||
--> $DIR/extra-impl-in-trait-impl.rs:12:6
|
||||
|
|
||||
LL | impl impl Default for S2 {
|
||||
| ^^^^^ help: remove the extra `impl`
|
||||
|
|
||||
note: this is parsed as an `impl Trait` type, but a trait is expected at this position
|
||||
--> $DIR/extra-impl-in-trait-impl.rs:12:6
|
||||
|
|
||||
LL | impl impl Default for S2 {
|
||||
| ^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
Loading…
x
Reference in New Issue
Block a user