mirror of
https://github.com/rust-lang/rust.git
synced 2024-10-31 22:41:50 +00:00
Auto merge of #103264 - matthiaskrgr:rollup-3ja4spo, r=matthiaskrgr
Rollup of 7 pull requests Successful merges: - #103211 (rustdoc: remove class name `location` from sidebar sibling nav) - #103223 (Use already checked RHS ty for LHS deref suggestions) - #103237 (Clean up codeblock-tooltip rustdoc-gui test) - #103239 (Allow #[unstable] impls for fn() with unstable abi.) - #103246 (Mark `rust-analyzer` as a host-only tool) - #103257 (rustdoc: move `setting-line` color CSS to settings.css) - #103258 (Make miri read_dir test a little more robust) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
commit
57781b24c5
@ -1130,11 +1130,6 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
}
|
||||
};
|
||||
|
||||
self.check_lhs_assignable(lhs, "E0070", span, |err| {
|
||||
let rhs_ty = self.check_expr(&rhs);
|
||||
suggest_deref_binop(err, rhs_ty);
|
||||
});
|
||||
|
||||
// This is (basically) inlined `check_expr_coercable_to_type`, but we want
|
||||
// to suggest an additional fixup here in `suggest_deref_binop`.
|
||||
let rhs_ty = self.check_expr_with_hint(&rhs, lhs_ty);
|
||||
@ -1145,6 +1140,12 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
diag.emit();
|
||||
}
|
||||
|
||||
self.check_lhs_assignable(lhs, "E0070", span, |err| {
|
||||
if let Some(rhs_ty) = self.typeck_results.borrow().expr_ty_opt(rhs) {
|
||||
suggest_deref_binop(err, rhs_ty);
|
||||
}
|
||||
});
|
||||
|
||||
self.require_type_is_sized(lhs_ty, lhs.span, traits::AssignmentLhsSized);
|
||||
|
||||
if lhs_ty.references_error() || rhs_ty.references_error() {
|
||||
|
@ -891,8 +891,25 @@ impl<'tcx> Visitor<'tcx> for CheckTraitImplStable<'tcx> {
|
||||
if let TyKind::Never = t.kind {
|
||||
self.fully_stable = false;
|
||||
}
|
||||
if let TyKind::BareFn(f) = t.kind {
|
||||
if rustc_target::spec::abi::is_stable(f.abi.name()).is_err() {
|
||||
self.fully_stable = false;
|
||||
}
|
||||
}
|
||||
intravisit::walk_ty(self, t)
|
||||
}
|
||||
|
||||
fn visit_fn_decl(&mut self, fd: &'tcx hir::FnDecl<'tcx>) {
|
||||
for ty in fd.inputs {
|
||||
self.visit_ty(ty)
|
||||
}
|
||||
if let hir::FnRetTy::Return(output_ty) = fd.output {
|
||||
match output_ty.kind {
|
||||
TyKind::Never => {} // `-> !` is stable
|
||||
_ => self.visit_ty(output_ty),
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Given the list of enabled features that were not language features (i.e., that
|
||||
|
@ -109,175 +109,125 @@ pub enum AbiDisabled {
|
||||
Unrecognized,
|
||||
}
|
||||
|
||||
fn gate_feature_post(
|
||||
features: &rustc_feature::Features,
|
||||
feature: Symbol,
|
||||
span: Span,
|
||||
explain: &'static str,
|
||||
) -> Result<(), AbiDisabled> {
|
||||
if !features.enabled(feature) && !span.allows_unstable(feature) {
|
||||
Err(AbiDisabled::Unstable { feature, explain })
|
||||
} else {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
pub fn is_enabled(
|
||||
features: &rustc_feature::Features,
|
||||
span: Span,
|
||||
name: &str,
|
||||
) -> Result<(), AbiDisabled> {
|
||||
let s = is_stable(name);
|
||||
if let Err(AbiDisabled::Unstable { feature, .. }) = s {
|
||||
if features.enabled(feature) || span.allows_unstable(feature) {
|
||||
return Ok(());
|
||||
}
|
||||
}
|
||||
s
|
||||
}
|
||||
|
||||
pub fn is_stable(name: &str) -> Result<(), AbiDisabled> {
|
||||
match name {
|
||||
// Stable
|
||||
"Rust" | "C" | "cdecl" | "stdcall" | "fastcall" | "aapcs" | "win64" | "sysv64"
|
||||
| "system" => Ok(()),
|
||||
"rust-intrinsic" => {
|
||||
gate_feature_post(features, sym::intrinsics, span, "intrinsics are subject to change")
|
||||
}
|
||||
"platform-intrinsic" => gate_feature_post(
|
||||
features,
|
||||
sym::platform_intrinsics,
|
||||
span,
|
||||
"platform intrinsics are experimental and possibly buggy",
|
||||
),
|
||||
"vectorcall" => gate_feature_post(
|
||||
features,
|
||||
sym::abi_vectorcall,
|
||||
span,
|
||||
"vectorcall is experimental and subject to change",
|
||||
),
|
||||
"thiscall" => gate_feature_post(
|
||||
features,
|
||||
sym::abi_thiscall,
|
||||
span,
|
||||
"thiscall is experimental and subject to change",
|
||||
),
|
||||
"rust-call" => gate_feature_post(
|
||||
features,
|
||||
sym::unboxed_closures,
|
||||
span,
|
||||
"rust-call ABI is subject to change",
|
||||
),
|
||||
"rust-cold" => gate_feature_post(
|
||||
features,
|
||||
sym::rust_cold_cc,
|
||||
span,
|
||||
"rust-cold is experimental and subject to change",
|
||||
),
|
||||
"ptx-kernel" => gate_feature_post(
|
||||
features,
|
||||
sym::abi_ptx,
|
||||
span,
|
||||
"PTX ABIs are experimental and subject to change",
|
||||
),
|
||||
"unadjusted" => gate_feature_post(
|
||||
features,
|
||||
sym::abi_unadjusted,
|
||||
span,
|
||||
"unadjusted ABI is an implementation detail and perma-unstable",
|
||||
),
|
||||
"msp430-interrupt" => gate_feature_post(
|
||||
features,
|
||||
sym::abi_msp430_interrupt,
|
||||
span,
|
||||
"msp430-interrupt ABI is experimental and subject to change",
|
||||
),
|
||||
"x86-interrupt" => gate_feature_post(
|
||||
features,
|
||||
sym::abi_x86_interrupt,
|
||||
span,
|
||||
"x86-interrupt ABI is experimental and subject to change",
|
||||
),
|
||||
"amdgpu-kernel" => gate_feature_post(
|
||||
features,
|
||||
sym::abi_amdgpu_kernel,
|
||||
span,
|
||||
"amdgpu-kernel ABI is experimental and subject to change",
|
||||
),
|
||||
"avr-interrupt" | "avr-non-blocking-interrupt" => gate_feature_post(
|
||||
features,
|
||||
sym::abi_avr_interrupt,
|
||||
span,
|
||||
"avr-interrupt and avr-non-blocking-interrupt ABIs are experimental and subject to change",
|
||||
),
|
||||
"efiapi" => gate_feature_post(
|
||||
features,
|
||||
sym::abi_efiapi,
|
||||
span,
|
||||
"efiapi ABI is experimental and subject to change",
|
||||
),
|
||||
"C-cmse-nonsecure-call" => gate_feature_post(
|
||||
features,
|
||||
sym::abi_c_cmse_nonsecure_call,
|
||||
span,
|
||||
"C-cmse-nonsecure-call ABI is experimental and subject to change",
|
||||
),
|
||||
"C-unwind" => gate_feature_post(
|
||||
features,
|
||||
sym::c_unwind,
|
||||
span,
|
||||
"C-unwind ABI is experimental and subject to change",
|
||||
),
|
||||
"stdcall-unwind" => gate_feature_post(
|
||||
features,
|
||||
sym::c_unwind,
|
||||
span,
|
||||
"stdcall-unwind ABI is experimental and subject to change",
|
||||
),
|
||||
"system-unwind" => gate_feature_post(
|
||||
features,
|
||||
sym::c_unwind,
|
||||
span,
|
||||
"system-unwind ABI is experimental and subject to change",
|
||||
),
|
||||
"thiscall-unwind" => gate_feature_post(
|
||||
features,
|
||||
sym::c_unwind,
|
||||
span,
|
||||
"thiscall-unwind ABI is experimental and subject to change",
|
||||
),
|
||||
"cdecl-unwind" => gate_feature_post(
|
||||
features,
|
||||
sym::c_unwind,
|
||||
span,
|
||||
"cdecl-unwind ABI is experimental and subject to change",
|
||||
),
|
||||
"fastcall-unwind" => gate_feature_post(
|
||||
features,
|
||||
sym::c_unwind,
|
||||
span,
|
||||
"fastcall-unwind ABI is experimental and subject to change",
|
||||
),
|
||||
"vectorcall-unwind" => gate_feature_post(
|
||||
features,
|
||||
sym::c_unwind,
|
||||
span,
|
||||
"vectorcall-unwind ABI is experimental and subject to change",
|
||||
),
|
||||
"aapcs-unwind" => gate_feature_post(
|
||||
features,
|
||||
sym::c_unwind,
|
||||
span,
|
||||
"aapcs-unwind ABI is experimental and subject to change",
|
||||
),
|
||||
"win64-unwind" => gate_feature_post(
|
||||
features,
|
||||
sym::c_unwind,
|
||||
span,
|
||||
"win64-unwind ABI is experimental and subject to change",
|
||||
),
|
||||
"sysv64-unwind" => gate_feature_post(
|
||||
features,
|
||||
sym::c_unwind,
|
||||
span,
|
||||
"sysv64-unwind ABI is experimental and subject to change",
|
||||
),
|
||||
"wasm" => gate_feature_post(
|
||||
features,
|
||||
sym::wasm_abi,
|
||||
span,
|
||||
"wasm ABI is experimental and subject to change",
|
||||
),
|
||||
"rust-intrinsic" => Err(AbiDisabled::Unstable {
|
||||
feature: sym::intrinsics,
|
||||
explain: "intrinsics are subject to change",
|
||||
}),
|
||||
"platform-intrinsic" => Err(AbiDisabled::Unstable {
|
||||
feature: sym::platform_intrinsics,
|
||||
explain: "platform intrinsics are experimental and possibly buggy",
|
||||
}),
|
||||
"vectorcall" => Err(AbiDisabled::Unstable {
|
||||
feature: sym::abi_vectorcall,
|
||||
explain: "vectorcall is experimental and subject to change",
|
||||
}),
|
||||
"thiscall" => Err(AbiDisabled::Unstable {
|
||||
feature: sym::abi_thiscall,
|
||||
explain: "thiscall is experimental and subject to change",
|
||||
}),
|
||||
"rust-call" => Err(AbiDisabled::Unstable {
|
||||
feature: sym::unboxed_closures,
|
||||
explain: "rust-call ABI is subject to change",
|
||||
}),
|
||||
"rust-cold" => Err(AbiDisabled::Unstable {
|
||||
feature: sym::rust_cold_cc,
|
||||
explain: "rust-cold is experimental and subject to change",
|
||||
}),
|
||||
"ptx-kernel" => Err(AbiDisabled::Unstable {
|
||||
feature: sym::abi_ptx,
|
||||
explain: "PTX ABIs are experimental and subject to change",
|
||||
}),
|
||||
"unadjusted" => Err(AbiDisabled::Unstable {
|
||||
feature: sym::abi_unadjusted,
|
||||
explain: "unadjusted ABI is an implementation detail and perma-unstable",
|
||||
}),
|
||||
"msp430-interrupt" => Err(AbiDisabled::Unstable {
|
||||
feature: sym::abi_msp430_interrupt,
|
||||
explain: "msp430-interrupt ABI is experimental and subject to change",
|
||||
}),
|
||||
"x86-interrupt" => Err(AbiDisabled::Unstable {
|
||||
feature: sym::abi_x86_interrupt,
|
||||
explain: "x86-interrupt ABI is experimental and subject to change",
|
||||
}),
|
||||
"amdgpu-kernel" => Err(AbiDisabled::Unstable {
|
||||
feature: sym::abi_amdgpu_kernel,
|
||||
explain: "amdgpu-kernel ABI is experimental and subject to change",
|
||||
}),
|
||||
"avr-interrupt" | "avr-non-blocking-interrupt" => Err(AbiDisabled::Unstable {
|
||||
feature: sym::abi_avr_interrupt,
|
||||
explain: "avr-interrupt and avr-non-blocking-interrupt ABIs are experimental and subject to change",
|
||||
}),
|
||||
"efiapi" => Err(AbiDisabled::Unstable {
|
||||
feature: sym::abi_efiapi,
|
||||
explain: "efiapi ABI is experimental and subject to change",
|
||||
}),
|
||||
"C-cmse-nonsecure-call" => Err(AbiDisabled::Unstable {
|
||||
feature: sym::abi_c_cmse_nonsecure_call,
|
||||
explain: "C-cmse-nonsecure-call ABI is experimental and subject to change",
|
||||
}),
|
||||
"C-unwind" => Err(AbiDisabled::Unstable {
|
||||
feature: sym::c_unwind,
|
||||
explain: "C-unwind ABI is experimental and subject to change",
|
||||
}),
|
||||
"stdcall-unwind" => Err(AbiDisabled::Unstable {
|
||||
feature: sym::c_unwind,
|
||||
explain: "stdcall-unwind ABI is experimental and subject to change",
|
||||
}),
|
||||
"system-unwind" => Err(AbiDisabled::Unstable {
|
||||
feature: sym::c_unwind,
|
||||
explain: "system-unwind ABI is experimental and subject to change",
|
||||
}),
|
||||
"thiscall-unwind" => Err(AbiDisabled::Unstable {
|
||||
feature: sym::c_unwind,
|
||||
explain: "thiscall-unwind ABI is experimental and subject to change",
|
||||
}),
|
||||
"cdecl-unwind" => Err(AbiDisabled::Unstable {
|
||||
feature: sym::c_unwind,
|
||||
explain: "cdecl-unwind ABI is experimental and subject to change",
|
||||
}),
|
||||
"fastcall-unwind" => Err(AbiDisabled::Unstable {
|
||||
feature: sym::c_unwind,
|
||||
explain: "fastcall-unwind ABI is experimental and subject to change",
|
||||
}),
|
||||
"vectorcall-unwind" => Err(AbiDisabled::Unstable {
|
||||
feature: sym::c_unwind,
|
||||
explain: "vectorcall-unwind ABI is experimental and subject to change",
|
||||
}),
|
||||
"aapcs-unwind" => Err(AbiDisabled::Unstable {
|
||||
feature: sym::c_unwind,
|
||||
explain: "aapcs-unwind ABI is experimental and subject to change",
|
||||
}),
|
||||
"win64-unwind" => Err(AbiDisabled::Unstable {
|
||||
feature: sym::c_unwind,
|
||||
explain: "win64-unwind ABI is experimental and subject to change",
|
||||
}),
|
||||
"sysv64-unwind" => Err(AbiDisabled::Unstable {
|
||||
feature: sym::c_unwind,
|
||||
explain: "sysv64-unwind ABI is experimental and subject to change",
|
||||
}),
|
||||
"wasm" => Err(AbiDisabled::Unstable {
|
||||
feature: sym::wasm_abi,
|
||||
explain: "wasm ABI is experimental and subject to change",
|
||||
}),
|
||||
_ => Err(AbiDisabled::Unrecognized),
|
||||
}
|
||||
}
|
||||
|
@ -698,7 +698,7 @@ pub struct RustAnalyzer {
|
||||
impl Step for RustAnalyzer {
|
||||
type Output = Option<PathBuf>;
|
||||
const DEFAULT: bool = true;
|
||||
const ONLY_HOSTS: bool = false;
|
||||
const ONLY_HOSTS: bool = true;
|
||||
|
||||
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
|
||||
let builder = run.builder;
|
||||
@ -742,7 +742,7 @@ pub struct RustAnalyzerProcMacroSrv {
|
||||
impl Step for RustAnalyzerProcMacroSrv {
|
||||
type Output = Option<PathBuf>;
|
||||
const DEFAULT: bool = true;
|
||||
const ONLY_HOSTS: bool = false;
|
||||
const ONLY_HOSTS: bool = true;
|
||||
|
||||
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
|
||||
let builder = run.builder;
|
||||
|
@ -1 +1 @@
|
||||
0.12.6
|
||||
0.12.7
|
@ -1884,7 +1884,7 @@ fn print_sidebar(cx: &Context<'_>, it: &clean::Item, buffer: &mut Buffer) {
|
||||
if !it.is_mod() {
|
||||
let path: String = cx.current.iter().map(|s| s.as_str()).intersperse("::").collect();
|
||||
|
||||
write!(buffer, "<h2 class=\"location\"><a href=\"index.html\">In {}</a></h2>", path);
|
||||
write!(buffer, "<h2><a href=\"index.html\">In {}</a></h2>", path);
|
||||
}
|
||||
|
||||
// Closes sidebar-elems div.
|
||||
|
@ -171,7 +171,7 @@ h1.fqn {
|
||||
Rustdoc-generated h2 section headings (e.g. "Implementations", "Required Methods", etc)
|
||||
Underlines elsewhere in the documentation break up visual flow and tend to invert
|
||||
section hierarchies. */
|
||||
h2,
|
||||
.content h2,
|
||||
.top-doc .docblock > h3,
|
||||
.top-doc .docblock > h4 {
|
||||
border-bottom: 1px solid var(--headings-border-bottom-color);
|
||||
@ -397,15 +397,6 @@ img {
|
||||
left: 0;
|
||||
}
|
||||
|
||||
.sidebar-elems,
|
||||
.sidebar > .location {
|
||||
padding-left: 24px;
|
||||
}
|
||||
|
||||
.sidebar .location {
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
.rustdoc.source .sidebar {
|
||||
width: 50px;
|
||||
min-width: 0px;
|
||||
@ -505,8 +496,8 @@ ul.block, .block li {
|
||||
}
|
||||
|
||||
.block a,
|
||||
.sidebar h3 a,
|
||||
h2.location a {
|
||||
.sidebar h2 a,
|
||||
.sidebar h3 a {
|
||||
display: block;
|
||||
padding: 0.25rem;
|
||||
margin-left: -0.25rem;
|
||||
@ -516,8 +507,7 @@ h2.location a {
|
||||
}
|
||||
|
||||
.sidebar h2 {
|
||||
border-bottom: none;
|
||||
font-weight: 500;
|
||||
overflow-wrap: anywhere;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
margin-top: 0.7rem;
|
||||
@ -526,11 +516,15 @@ h2.location a {
|
||||
|
||||
.sidebar h3 {
|
||||
font-size: 1.125rem; /* 18px */
|
||||
font-weight: 500;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.sidebar-elems,
|
||||
.sidebar > h2 {
|
||||
padding-left: 24px;
|
||||
}
|
||||
|
||||
.sidebar a, .sidebar .current {
|
||||
color: var(--sidebar-link-color);
|
||||
}
|
||||
@ -1474,25 +1468,6 @@ h3.variant {
|
||||
animation: rotating 2s linear infinite;
|
||||
}
|
||||
|
||||
.setting-line .radio-line input:checked {
|
||||
box-shadow: inset 0 0 0 3px var(--main-background-color);
|
||||
background-color: var(--settings-input-color);
|
||||
}
|
||||
.setting-line .radio-line input:focus {
|
||||
box-shadow: 0 0 1px 1px var(--settings-input-color);
|
||||
}
|
||||
/* In here we combine both `:focus` and `:checked` properties. */
|
||||
.setting-line .radio-line input:checked:focus {
|
||||
box-shadow: inset 0 0 0 3px var(--main-background-color),
|
||||
0 0 2px 2px var(--settings-input-color);
|
||||
}
|
||||
.setting-line .radio-line input:hover {
|
||||
border-color: var(--settings-input-color) !important;
|
||||
}
|
||||
input:checked + .slider {
|
||||
background-color: var(--settings-input-color);
|
||||
}
|
||||
|
||||
#help-button > a {
|
||||
text-align: center;
|
||||
/* Rare exception to specifying font sizes in rem. Since this is acting
|
||||
@ -1788,18 +1763,10 @@ in storage.js
|
||||
width: 0;
|
||||
}
|
||||
|
||||
.mobile-topbar .location a {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.mobile-topbar .location {
|
||||
border: none;
|
||||
padding: 0;
|
||||
.mobile-topbar h2 {
|
||||
padding-bottom: 0;
|
||||
margin: auto 0.5em auto auto;
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
/* Rare exception to specifying font sizes in rem. Since the topbar
|
||||
height is specified in pixels, this also has to be specified in
|
||||
pixels to avoid overflowing the topbar when the user sets a bigger
|
||||
@ -1807,6 +1774,13 @@ in storage.js
|
||||
font-size: 24px;
|
||||
}
|
||||
|
||||
.mobile-topbar h2 a {
|
||||
display: block;
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.mobile-topbar .logo-container {
|
||||
max-height: 45px;
|
||||
}
|
||||
|
@ -89,3 +89,22 @@ input:checked + .slider:before {
|
||||
#settings .setting-line {
|
||||
margin: 1.2em 0.6em;
|
||||
}
|
||||
|
||||
.setting-line .radio-line input:checked {
|
||||
box-shadow: inset 0 0 0 3px var(--main-background-color);
|
||||
background-color: var(--settings-input-color);
|
||||
}
|
||||
.setting-line .radio-line input:focus {
|
||||
box-shadow: 0 0 1px 1px var(--settings-input-color);
|
||||
}
|
||||
/* In here we combine both `:focus` and `:checked` properties. */
|
||||
.setting-line .radio-line input:checked:focus {
|
||||
box-shadow: inset 0 0 0 3px var(--main-background-color),
|
||||
0 0 2px 2px var(--settings-input-color);
|
||||
}
|
||||
.setting-line .radio-line input:hover {
|
||||
border-color: var(--settings-input-color) !important;
|
||||
}
|
||||
input:checked + .slider {
|
||||
background-color: var(--settings-input-color);
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ function blurHandler(event, parentElem, hideCallback) {
|
||||
function setMobileTopbar() {
|
||||
// FIXME: It would be nicer to generate this text content directly in HTML,
|
||||
// but with the current code it's hard to get the right information in the right place.
|
||||
const mobileLocationTitle = document.querySelector(".mobile-topbar h2.location");
|
||||
const mobileLocationTitle = document.querySelector(".mobile-topbar h2");
|
||||
const locationTitle = document.querySelector(".sidebar h2.location");
|
||||
if (mobileLocationTitle && locationTitle) {
|
||||
mobileLocationTitle.innerHTML = locationTitle.innerHTML;
|
||||
|
@ -85,7 +85,7 @@
|
||||
{%- endif -%}
|
||||
</div> {#- -#}
|
||||
</a> {#- -#}
|
||||
<h2 class="location"></h2> {#- -#}
|
||||
<h2></h2> {#- -#}
|
||||
</nav> {#- -#}
|
||||
{%- endif -%}
|
||||
<nav class="sidebar"> {#- -#}
|
||||
|
@ -2,95 +2,79 @@
|
||||
goto: "file://" + |DOC_PATH| + "/test_docs/fn.foo.html"
|
||||
show-text: true
|
||||
|
||||
// Dark theme.
|
||||
local-storage: {"rustdoc-theme": "dark", "rustdoc-use-system-theme": "false"}
|
||||
reload:
|
||||
define-function: (
|
||||
"check-colors",
|
||||
(theme),
|
||||
[
|
||||
// Setting the theme.
|
||||
("local-storage", {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}),
|
||||
("reload"),
|
||||
|
||||
// compile_fail block
|
||||
assert-css: (".docblock .example-wrap.compile_fail .tooltip", {"color": "rgba(255, 0, 0, 0.5)"})
|
||||
assert-css: (".docblock .example-wrap.compile_fail", {"border-left": "2px solid rgba(255, 0, 0, 0.5)"})
|
||||
// compile_fail block
|
||||
("assert-css", (
|
||||
".docblock .example-wrap.compile_fail .tooltip",
|
||||
{"color": "rgba(255, 0, 0, 0.5)"},
|
||||
)),
|
||||
("assert-css", (
|
||||
".docblock .example-wrap.compile_fail",
|
||||
{"border-left": "2px solid rgba(255, 0, 0, 0.5)"},
|
||||
)),
|
||||
|
||||
move-cursor-to: ".docblock .example-wrap.compile_fail"
|
||||
("move-cursor-to", ".docblock .example-wrap.compile_fail"),
|
||||
|
||||
assert-css: (".docblock .example-wrap.compile_fail .tooltip", {"color": "rgb(255, 0, 0)"})
|
||||
assert-css: (".docblock .example-wrap.compile_fail", {"border-left": "2px solid rgb(255, 0, 0)"})
|
||||
("assert-css", (
|
||||
".docblock .example-wrap.compile_fail .tooltip",
|
||||
{"color": "rgb(255, 0, 0)"},
|
||||
)),
|
||||
("assert-css", (
|
||||
".docblock .example-wrap.compile_fail",
|
||||
{"border-left": "2px solid rgb(255, 0, 0)"},
|
||||
)),
|
||||
|
||||
// should_panic block
|
||||
assert-css: (".docblock .example-wrap.should_panic .tooltip", {"color": "rgba(255, 0, 0, 0.5)"})
|
||||
assert-css: (".docblock .example-wrap.should_panic", {"border-left": "2px solid rgba(255, 0, 0, 0.5)"})
|
||||
// should_panic block
|
||||
("assert-css", (
|
||||
".docblock .example-wrap.should_panic .tooltip",
|
||||
{"color": "rgba(255, 0, 0, 0.5)"},
|
||||
)),
|
||||
("assert-css", (
|
||||
".docblock .example-wrap.should_panic",
|
||||
{"border-left": "2px solid rgba(255, 0, 0, 0.5)"},
|
||||
)),
|
||||
|
||||
move-cursor-to: ".docblock .example-wrap.should_panic"
|
||||
("move-cursor-to", ".docblock .example-wrap.should_panic"),
|
||||
|
||||
assert-css: (".docblock .example-wrap.should_panic .tooltip", {"color": "rgb(255, 0, 0)"})
|
||||
assert-css: (".docblock .example-wrap.should_panic", {"border-left": "2px solid rgb(255, 0, 0)"})
|
||||
("assert-css", (
|
||||
".docblock .example-wrap.should_panic .tooltip",
|
||||
{"color": "rgb(255, 0, 0)"},
|
||||
)),
|
||||
("assert-css", (
|
||||
".docblock .example-wrap.should_panic",
|
||||
{"border-left": "2px solid rgb(255, 0, 0)"},
|
||||
)),
|
||||
|
||||
// ignore block
|
||||
assert-css: (".docblock .example-wrap.ignore .tooltip", {"color": "rgba(255, 142, 0, 0.6)"})
|
||||
assert-css: (".docblock .example-wrap.ignore", {"border-left": "2px solid rgba(255, 142, 0, 0.6)"})
|
||||
// ignore block
|
||||
("assert-css", (
|
||||
".docblock .example-wrap.ignore .tooltip",
|
||||
{"color": "rgba(255, 142, 0, 0.6)"},
|
||||
)),
|
||||
("assert-css", (
|
||||
".docblock .example-wrap.ignore",
|
||||
{"border-left": "2px solid rgba(255, 142, 0, 0.6)"},
|
||||
)),
|
||||
|
||||
move-cursor-to: ".docblock .example-wrap.ignore"
|
||||
("move-cursor-to", ".docblock .example-wrap.ignore"),
|
||||
|
||||
assert-css: (".docblock .example-wrap.ignore .tooltip", {"color": "rgb(255, 142, 0)"})
|
||||
assert-css: (".docblock .example-wrap.ignore", {"border-left": "2px solid rgb(255, 142, 0)"})
|
||||
("assert-css", (
|
||||
".docblock .example-wrap.ignore .tooltip",
|
||||
{"color": "rgb(255, 142, 0)"},
|
||||
)),
|
||||
("assert-css", (
|
||||
".docblock .example-wrap.ignore",
|
||||
{"border-left": "2px solid rgb(255, 142, 0)"},
|
||||
)),
|
||||
],
|
||||
)
|
||||
|
||||
|
||||
// Light theme.
|
||||
local-storage: {"rustdoc-theme": "light"}
|
||||
reload:
|
||||
|
||||
assert-css: (".docblock .example-wrap.compile_fail .tooltip", {"color": "rgba(255, 0, 0, 0.5)"})
|
||||
assert-css: (".docblock .example-wrap.compile_fail", {"border-left": "2px solid rgba(255, 0, 0, 0.5)"})
|
||||
|
||||
move-cursor-to: ".docblock .example-wrap.compile_fail"
|
||||
|
||||
assert-css: (".docblock .example-wrap.compile_fail .tooltip", {"color": "rgb(255, 0, 0)"})
|
||||
assert-css: (".docblock .example-wrap.compile_fail", {"border-left": "2px solid rgb(255, 0, 0)"})
|
||||
|
||||
// should_panic block
|
||||
assert-css: (".docblock .example-wrap.should_panic .tooltip", {"color": "rgba(255, 0, 0, 0.5)"})
|
||||
assert-css: (".docblock .example-wrap.should_panic", {"border-left": "2px solid rgba(255, 0, 0, 0.5)"})
|
||||
|
||||
move-cursor-to: ".docblock .example-wrap.should_panic"
|
||||
|
||||
assert-css: (".docblock .example-wrap.should_panic .tooltip", {"color": "rgb(255, 0, 0)"})
|
||||
assert-css: (".docblock .example-wrap.should_panic", {"border-left": "2px solid rgb(255, 0, 0)"})
|
||||
|
||||
// ignore block
|
||||
assert-css: (".docblock .example-wrap.ignore .tooltip", {"color": "rgba(255, 142, 0, 0.6)"})
|
||||
assert-css: (".docblock .example-wrap.ignore", {"border-left": "2px solid rgba(255, 142, 0, 0.6)"})
|
||||
|
||||
move-cursor-to: ".docblock .example-wrap.ignore"
|
||||
|
||||
assert-css: (".docblock .example-wrap.ignore .tooltip", {"color": "rgb(255, 142, 0)"})
|
||||
assert-css: (".docblock .example-wrap.ignore", {"border-left": "2px solid rgb(255, 142, 0)"})
|
||||
|
||||
|
||||
// Ayu theme.
|
||||
local-storage: {"rustdoc-theme": "ayu"}
|
||||
reload:
|
||||
|
||||
assert-css: (".docblock .example-wrap.compile_fail .tooltip", {"color": "rgba(255, 0, 0, 0.5)"})
|
||||
assert-css: (".docblock .example-wrap.compile_fail", {"border-left": "2px solid rgba(255, 0, 0, 0.5)"})
|
||||
|
||||
move-cursor-to: ".docblock .example-wrap.compile_fail"
|
||||
|
||||
assert-css: (".docblock .example-wrap.compile_fail .tooltip", {"color": "rgb(255, 0, 0)"})
|
||||
assert-css: (".docblock .example-wrap.compile_fail", {"border-left": "2px solid rgb(255, 0, 0)"})
|
||||
|
||||
// should_panic block
|
||||
assert-css: (".docblock .example-wrap.should_panic .tooltip", {"color": "rgba(255, 0, 0, 0.5)"})
|
||||
assert-css: (".docblock .example-wrap.should_panic", {"border-left": "2px solid rgba(255, 0, 0, 0.5)"})
|
||||
|
||||
move-cursor-to: ".docblock .example-wrap.should_panic"
|
||||
|
||||
assert-css: (".docblock .example-wrap.should_panic .tooltip", {"color": "rgb(255, 0, 0)"})
|
||||
assert-css: (".docblock .example-wrap.should_panic", {"border-left": "2px solid rgb(255, 0, 0)"})
|
||||
|
||||
// ignore block
|
||||
assert-css: (".docblock .example-wrap.ignore .tooltip", {"color": "rgba(255, 142, 0, 0.6)"})
|
||||
assert-css: (".docblock .example-wrap.ignore", {"border-left": "2px solid rgba(255, 142, 0, 0.6)"})
|
||||
|
||||
move-cursor-to: ".docblock .example-wrap.ignore"
|
||||
|
||||
assert-css: (".docblock .example-wrap.ignore .tooltip", {"color": "rgb(255, 142, 0)"})
|
||||
assert-css: (".docblock .example-wrap.ignore", {"border-left": "2px solid rgb(255, 142, 0)"})
|
||||
call-function: ("check-colors", ("ayu"))
|
||||
call-function: ("check-colors", ("dark"))
|
||||
call-function: ("check-colors", ("light"))
|
||||
|
@ -12,7 +12,7 @@ assert-css: (".main-heading", {
|
||||
"flex-direction": "column"
|
||||
})
|
||||
|
||||
assert-property: (".mobile-topbar h2.location", {"offsetHeight": 36})
|
||||
assert-property: (".mobile-topbar h2", {"offsetHeight": 36})
|
||||
|
||||
// Note: We can't use assert-text here because the 'Since' is set by CSS and
|
||||
// is therefore not part of the DOM.
|
||||
|
@ -23,6 +23,11 @@ assert-css: (".sidebar", {"display": "block", "left": "-1000px"})
|
||||
click: ".sidebar-menu-toggle"
|
||||
assert-css: (".sidebar", {"left": "0px"})
|
||||
|
||||
// Make sure the "struct Foo" header is hidden, since the mobile topbar already does it.
|
||||
assert-css: ("//nav[contains(@class, 'sidebar')]//h2/a[text()='Foo']/parent::h2", {"display": "none"})
|
||||
// Make sure the global navigation is still here.
|
||||
assert-css: ("//nav[contains(@class, 'sidebar')]//h2/a[text()='In test_docs']/parent::h2", {"display": "block"})
|
||||
|
||||
// Click elsewhere.
|
||||
click: "body"
|
||||
assert-css: (".sidebar", {"display": "block", "left": "-1000px"})
|
||||
@ -39,7 +44,7 @@ assert-position: ("#method\.must_use", {"y": 45})
|
||||
// Check that the bottom-most item on the sidebar menu can be scrolled fully into view.
|
||||
click: ".sidebar-menu-toggle"
|
||||
scroll-to: ".block.keyword li:nth-child(1)"
|
||||
compare-elements-position-near: (".block.keyword li:nth-child(1)", ".mobile-topbar", {"y": 543})
|
||||
compare-elements-position-near: (".block.keyword li:nth-child(1)", ".mobile-topbar", {"y": 543.19})
|
||||
|
||||
// Now checking the background color of the sidebar.
|
||||
show-text: true
|
||||
|
@ -9,6 +9,7 @@ reload:
|
||||
assert-text: (".sidebar > .location", "Crate test_docs")
|
||||
// In modules, we only have one "location" element.
|
||||
assert-count: (".sidebar .location", 1)
|
||||
assert-count: (".sidebar h2", 1)
|
||||
assert-text: ("#all-types", "All Items")
|
||||
assert-css: ("#all-types", {"color": "rgb(53, 109, 164)"})
|
||||
// We check that we have the crates list and that the "current" on is "test_docs".
|
||||
@ -28,7 +29,8 @@ assert-text: ("#structs + .item-table .item-left > a", "Foo")
|
||||
click: "#structs + .item-table .item-left > a"
|
||||
|
||||
// PAGE: struct.Foo.html
|
||||
assert-count: (".sidebar .location", 2)
|
||||
assert-count: (".sidebar .location", 1)
|
||||
assert-count: (".sidebar h2", 2)
|
||||
// We check that there is no crate listed outside of the top level.
|
||||
assert-false: ".sidebar-elems > .crate"
|
||||
|
||||
@ -60,10 +62,11 @@ assert-text: ("#functions + .item-table .item-left > a", "foobar")
|
||||
click: "#functions + .item-table .item-left > a"
|
||||
|
||||
// PAGE: fn.foobar.html
|
||||
// In items containing no items (like functions or constants) and in modules, we have one
|
||||
// "location" elements.
|
||||
assert-count: (".sidebar .location", 1)
|
||||
assert-text: (".sidebar .sidebar-elems .location", "In lib2")
|
||||
// In items containing no items (like functions or constants) and in modules, we have no
|
||||
// "location" elements. Only the parent module h2.
|
||||
assert-count: (".sidebar .location", 0)
|
||||
assert-count: (".sidebar h2", 1)
|
||||
assert-text: (".sidebar .sidebar-elems h2", "In lib2")
|
||||
// We check that we don't have the crate list.
|
||||
assert-false: ".sidebar-elems > .crate"
|
||||
|
||||
|
@ -32,6 +32,6 @@ assert-property: (".item-decl pre", {"scrollWidth": "950"})
|
||||
size: (600, 600)
|
||||
goto: "file://" + |DOC_PATH| + "/lib2/too_long/struct.SuperIncrediblyLongLongLongLongLongLongLongGigaGigaGigaMegaLongLongLongStructName.html"
|
||||
// It shouldn't have an overflow in the topbar either.
|
||||
store-property: (scrollWidth, ".mobile-topbar .location", "scrollWidth")
|
||||
assert-property: (".mobile-topbar .location", {"clientWidth": |scrollWidth|})
|
||||
assert-css: (".mobile-topbar .location", {"overflow-x": "hidden"})
|
||||
store-property: (scrollWidth, ".mobile-topbar h2", "scrollWidth")
|
||||
assert-property: (".mobile-topbar h2", {"clientWidth": |scrollWidth|})
|
||||
assert-css: (".mobile-topbar h2", {"overflow-x": "hidden"})
|
||||
|
@ -1,4 +1,4 @@
|
||||
#![feature(staged_api)]
|
||||
#![feature(staged_api, never_type, c_unwind)]
|
||||
//~^ ERROR module has missing stability attribute
|
||||
|
||||
#[stable(feature = "a", since = "1")]
|
||||
@ -23,7 +23,21 @@ impl StableTrait for UnstableType {}
|
||||
impl UnstableTrait for StableType {}
|
||||
|
||||
#[unstable(feature = "h", issue = "none")]
|
||||
impl StableTrait for ! {}
|
||||
|
||||
// Note: If C-unwind is stabilized, switch this to another (unstable) ABI.
|
||||
#[unstable(feature = "i", issue = "none")]
|
||||
impl StableTrait for extern "C-unwind" fn() {}
|
||||
|
||||
#[unstable(feature = "j", issue = "none")]
|
||||
//~^ ERROR an `#[unstable]` annotation here has no effect [ineffective_unstable_trait_impl]
|
||||
impl StableTrait for StableType {}
|
||||
|
||||
#[unstable(feature = "k", issue = "none")]
|
||||
//~^ ERROR an `#[unstable]` annotation here has no effect [ineffective_unstable_trait_impl]
|
||||
impl StableTrait for fn() -> ! {}
|
||||
|
||||
#[unstable(feature = "l", issue = "none")]
|
||||
impl StableTrait for fn() -> UnstableType {}
|
||||
|
||||
fn main() {}
|
||||
|
@ -1,16 +1,24 @@
|
||||
error: an `#[unstable]` annotation here has no effect
|
||||
--> $DIR/stability-attribute-trait-impl.rs:25:1
|
||||
--> $DIR/stability-attribute-trait-impl.rs:32:1
|
||||
|
|
||||
LL | #[unstable(feature = "h", issue = "none")]
|
||||
LL | #[unstable(feature = "j", issue = "none")]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: see issue #55436 <https://github.com/rust-lang/rust/issues/55436> for more information
|
||||
= note: `#[deny(ineffective_unstable_trait_impl)]` on by default
|
||||
|
||||
error: an `#[unstable]` annotation here has no effect
|
||||
--> $DIR/stability-attribute-trait-impl.rs:36:1
|
||||
|
|
||||
LL | #[unstable(feature = "k", issue = "none")]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: see issue #55436 <https://github.com/rust-lang/rust/issues/55436> for more information
|
||||
|
||||
error: module has missing stability attribute
|
||||
--> $DIR/stability-attribute-trait-impl.rs:1:1
|
||||
|
|
||||
LL | / #![feature(staged_api)]
|
||||
LL | / #![feature(staged_api, never_type, c_unwind)]
|
||||
LL | |
|
||||
LL | |
|
||||
LL | | #[stable(feature = "a", since = "1")]
|
||||
@ -19,5 +27,5 @@ LL | |
|
||||
LL | | fn main() {}
|
||||
| |____________^
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
|
26
src/test/ui/typeck/slow-lhs-suggestion.rs
Normal file
26
src/test/ui/typeck/slow-lhs-suggestion.rs
Normal file
@ -0,0 +1,26 @@
|
||||
fn main() {
|
||||
1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1;
|
||||
//~^ ERROR invalid left-hand side of assignment
|
||||
//~| ERROR invalid left-hand side of assignment
|
||||
//~| ERROR invalid left-hand side of assignment
|
||||
//~| ERROR invalid left-hand side of assignment
|
||||
//~| ERROR invalid left-hand side of assignment
|
||||
//~| ERROR invalid left-hand side of assignment
|
||||
//~| ERROR invalid left-hand side of assignment
|
||||
//~| ERROR invalid left-hand side of assignment
|
||||
//~| ERROR invalid left-hand side of assignment
|
||||
//~| ERROR invalid left-hand side of assignment
|
||||
//~| ERROR invalid left-hand side of assignment
|
||||
//~| ERROR invalid left-hand side of assignment
|
||||
//~| ERROR invalid left-hand side of assignment
|
||||
//~| ERROR invalid left-hand side of assignment
|
||||
//~| ERROR invalid left-hand side of assignment
|
||||
//~| ERROR invalid left-hand side of assignment
|
||||
//~| ERROR invalid left-hand side of assignment
|
||||
//~| ERROR invalid left-hand side of assignment
|
||||
//~| ERROR invalid left-hand side of assignment
|
||||
//~| ERROR invalid left-hand side of assignment
|
||||
//~| ERROR invalid left-hand side of assignment
|
||||
//~| ERROR invalid left-hand side of assignment
|
||||
//~| ERROR invalid left-hand side of assignment
|
||||
}
|
187
src/test/ui/typeck/slow-lhs-suggestion.stderr
Normal file
187
src/test/ui/typeck/slow-lhs-suggestion.stderr
Normal file
@ -0,0 +1,187 @@
|
||||
error[E0070]: invalid left-hand side of assignment
|
||||
--> $DIR/slow-lhs-suggestion.rs:2:95
|
||||
|
|
||||
LL | 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1;
|
||||
| - ^
|
||||
| |
|
||||
| cannot assign to this expression
|
||||
|
||||
error[E0070]: invalid left-hand side of assignment
|
||||
--> $DIR/slow-lhs-suggestion.rs:2:91
|
||||
|
|
||||
LL | 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1;
|
||||
| - ^
|
||||
| |
|
||||
| cannot assign to this expression
|
||||
|
||||
error[E0070]: invalid left-hand side of assignment
|
||||
--> $DIR/slow-lhs-suggestion.rs:2:87
|
||||
|
|
||||
LL | 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1;
|
||||
| - ^
|
||||
| |
|
||||
| cannot assign to this expression
|
||||
|
||||
error[E0070]: invalid left-hand side of assignment
|
||||
--> $DIR/slow-lhs-suggestion.rs:2:83
|
||||
|
|
||||
LL | 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1;
|
||||
| - ^
|
||||
| |
|
||||
| cannot assign to this expression
|
||||
|
||||
error[E0070]: invalid left-hand side of assignment
|
||||
--> $DIR/slow-lhs-suggestion.rs:2:79
|
||||
|
|
||||
LL | 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1;
|
||||
| - ^
|
||||
| |
|
||||
| cannot assign to this expression
|
||||
|
||||
error[E0070]: invalid left-hand side of assignment
|
||||
--> $DIR/slow-lhs-suggestion.rs:2:75
|
||||
|
|
||||
LL | 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1;
|
||||
| - ^
|
||||
| |
|
||||
| cannot assign to this expression
|
||||
|
||||
error[E0070]: invalid left-hand side of assignment
|
||||
--> $DIR/slow-lhs-suggestion.rs:2:71
|
||||
|
|
||||
LL | 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1;
|
||||
| - ^
|
||||
| |
|
||||
| cannot assign to this expression
|
||||
|
||||
error[E0070]: invalid left-hand side of assignment
|
||||
--> $DIR/slow-lhs-suggestion.rs:2:67
|
||||
|
|
||||
LL | 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1;
|
||||
| - ^
|
||||
| |
|
||||
| cannot assign to this expression
|
||||
|
||||
error[E0070]: invalid left-hand side of assignment
|
||||
--> $DIR/slow-lhs-suggestion.rs:2:63
|
||||
|
|
||||
LL | 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1;
|
||||
| - ^
|
||||
| |
|
||||
| cannot assign to this expression
|
||||
|
||||
error[E0070]: invalid left-hand side of assignment
|
||||
--> $DIR/slow-lhs-suggestion.rs:2:59
|
||||
|
|
||||
LL | 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1;
|
||||
| - ^
|
||||
| |
|
||||
| cannot assign to this expression
|
||||
|
||||
error[E0070]: invalid left-hand side of assignment
|
||||
--> $DIR/slow-lhs-suggestion.rs:2:55
|
||||
|
|
||||
LL | 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1;
|
||||
| - ^
|
||||
| |
|
||||
| cannot assign to this expression
|
||||
|
||||
error[E0070]: invalid left-hand side of assignment
|
||||
--> $DIR/slow-lhs-suggestion.rs:2:51
|
||||
|
|
||||
LL | 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1;
|
||||
| - ^
|
||||
| |
|
||||
| cannot assign to this expression
|
||||
|
||||
error[E0070]: invalid left-hand side of assignment
|
||||
--> $DIR/slow-lhs-suggestion.rs:2:47
|
||||
|
|
||||
LL | 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1;
|
||||
| - ^
|
||||
| |
|
||||
| cannot assign to this expression
|
||||
|
||||
error[E0070]: invalid left-hand side of assignment
|
||||
--> $DIR/slow-lhs-suggestion.rs:2:43
|
||||
|
|
||||
LL | 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1;
|
||||
| - ^
|
||||
| |
|
||||
| cannot assign to this expression
|
||||
|
||||
error[E0070]: invalid left-hand side of assignment
|
||||
--> $DIR/slow-lhs-suggestion.rs:2:39
|
||||
|
|
||||
LL | 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1;
|
||||
| - ^
|
||||
| |
|
||||
| cannot assign to this expression
|
||||
|
||||
error[E0070]: invalid left-hand side of assignment
|
||||
--> $DIR/slow-lhs-suggestion.rs:2:35
|
||||
|
|
||||
LL | 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1;
|
||||
| - ^
|
||||
| |
|
||||
| cannot assign to this expression
|
||||
|
||||
error[E0070]: invalid left-hand side of assignment
|
||||
--> $DIR/slow-lhs-suggestion.rs:2:31
|
||||
|
|
||||
LL | 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1;
|
||||
| - ^
|
||||
| |
|
||||
| cannot assign to this expression
|
||||
|
||||
error[E0070]: invalid left-hand side of assignment
|
||||
--> $DIR/slow-lhs-suggestion.rs:2:27
|
||||
|
|
||||
LL | 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1;
|
||||
| - ^
|
||||
| |
|
||||
| cannot assign to this expression
|
||||
|
||||
error[E0070]: invalid left-hand side of assignment
|
||||
--> $DIR/slow-lhs-suggestion.rs:2:23
|
||||
|
|
||||
LL | 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1;
|
||||
| - ^
|
||||
| |
|
||||
| cannot assign to this expression
|
||||
|
||||
error[E0070]: invalid left-hand side of assignment
|
||||
--> $DIR/slow-lhs-suggestion.rs:2:19
|
||||
|
|
||||
LL | 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1;
|
||||
| - ^
|
||||
| |
|
||||
| cannot assign to this expression
|
||||
|
||||
error[E0070]: invalid left-hand side of assignment
|
||||
--> $DIR/slow-lhs-suggestion.rs:2:15
|
||||
|
|
||||
LL | 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1;
|
||||
| - ^
|
||||
| |
|
||||
| cannot assign to this expression
|
||||
|
||||
error[E0070]: invalid left-hand side of assignment
|
||||
--> $DIR/slow-lhs-suggestion.rs:2:11
|
||||
|
|
||||
LL | 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1;
|
||||
| - ^
|
||||
| |
|
||||
| cannot assign to this expression
|
||||
|
||||
error[E0070]: invalid left-hand side of assignment
|
||||
--> $DIR/slow-lhs-suggestion.rs:2:7
|
||||
|
|
||||
LL | 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1 = 1;
|
||||
| - ^
|
||||
| |
|
||||
| cannot assign to this expression
|
||||
|
||||
error: aborting due to 23 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0070`.
|
@ -4,7 +4,8 @@
|
||||
#![feature(io_error_more)]
|
||||
#![feature(io_error_uncategorized)]
|
||||
|
||||
use std::ffi::CString;
|
||||
use std::collections::HashMap;
|
||||
use std::ffi::{CString, OsString};
|
||||
use std::fs::{
|
||||
create_dir, read_dir, read_link, remove_dir, remove_dir_all, remove_file, rename, File,
|
||||
OpenOptions,
|
||||
@ -394,29 +395,34 @@ fn test_directory() {
|
||||
// Creating a directory when it already exists should fail.
|
||||
assert_eq!(ErrorKind::AlreadyExists, create_dir(&dir_path).unwrap_err().kind());
|
||||
|
||||
// Create some files inside the directory
|
||||
// Create some files and dirs inside the directory
|
||||
let path_1 = dir_path.join("test_file_1");
|
||||
drop(File::create(&path_1).unwrap());
|
||||
let path_2 = dir_path.join("test_file_2");
|
||||
drop(File::create(&path_2).unwrap());
|
||||
// Test that the files are present inside the directory
|
||||
let dir_iter = read_dir(&dir_path).unwrap();
|
||||
let mut file_names = dir_iter.map(|e| e.unwrap().file_name()).collect::<Vec<_>>();
|
||||
file_names.sort_unstable();
|
||||
assert_eq!(file_names, vec!["test_file_1", "test_file_2"]);
|
||||
let dir_1 = dir_path.join("test_dir_1");
|
||||
create_dir(&dir_1).unwrap();
|
||||
// Test that read_dir metadata calls succeed
|
||||
assert_eq!(
|
||||
&[true, true],
|
||||
&*read_dir(&dir_path)
|
||||
HashMap::from([
|
||||
(OsString::from("test_file_1"), true),
|
||||
(OsString::from("test_file_2"), true),
|
||||
(OsString::from("test_dir_1"), false)
|
||||
]),
|
||||
read_dir(&dir_path)
|
||||
.unwrap()
|
||||
.map(|e| e.unwrap().metadata().unwrap().is_file())
|
||||
.collect::<Vec<_>>()
|
||||
.map(|e| {
|
||||
let e = e.unwrap();
|
||||
(e.file_name(), e.metadata().unwrap().is_file())
|
||||
})
|
||||
.collect::<HashMap<_, _>>()
|
||||
);
|
||||
// Deleting the directory should fail, since it is not empty.
|
||||
assert_eq!(ErrorKind::DirectoryNotEmpty, remove_dir(&dir_path).unwrap_err().kind());
|
||||
// Clean up the files in the directory
|
||||
remove_file(&path_1).unwrap();
|
||||
remove_file(&path_2).unwrap();
|
||||
remove_dir(&dir_1).unwrap();
|
||||
// Now there should be nothing left in the directory.
|
||||
let dir_iter = read_dir(&dir_path).unwrap();
|
||||
let file_names = dir_iter.map(|e| e.unwrap().file_name()).collect::<Vec<_>>();
|
||||
|
Loading…
Reference in New Issue
Block a user