Skip to content

Commit 1ddd4e6

Browse files
committed
Auto merge of #89752 - matthiaskrgr:rollup-v4fgmwg, r=matthiaskrgr
Rollup of 6 pull requests Successful merges: - #89579 (Add regression test for issue 80108) - #89632 (Fix docblock code display on mobile) - #89691 (Move `DebuggerCommands` and `check_debugger_output` to a separate module) - #89707 (Apply clippy suggestions for std) - #89722 (Fix spelling: Cannonical -> Canonical) - #89736 (Remove unused CSS rule) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents 3bf5575 + bf01a59 commit 1ddd4e6

File tree

15 files changed

+203
-151
lines changed

15 files changed

+203
-151
lines changed

compiler/rustc_middle/src/traits/select.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -264,14 +264,14 @@ impl EvaluationResult {
264264
/// Indicates that trait evaluation caused overflow and in which pass.
265265
#[derive(Copy, Clone, Debug, PartialEq, Eq, HashStable)]
266266
pub enum OverflowError {
267-
Cannonical,
267+
Canonical,
268268
ErrorReporting,
269269
}
270270

271271
impl<'tcx> From<OverflowError> for SelectionError<'tcx> {
272272
fn from(overflow_error: OverflowError) -> SelectionError<'tcx> {
273273
match overflow_error {
274-
OverflowError::Cannonical => SelectionError::Overflow,
274+
OverflowError::Canonical => SelectionError::Overflow,
275275
OverflowError::ErrorReporting => SelectionError::ErrorReporting,
276276
}
277277
}

compiler/rustc_trait_selection/src/traits/query/evaluate_obligation.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,10 @@ impl<'cx, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'cx, 'tcx> {
8383
) -> EvaluationResult {
8484
match self.evaluate_obligation(obligation) {
8585
Ok(result) => result,
86-
Err(OverflowError::Cannonical) => {
86+
Err(OverflowError::Canonical) => {
8787
let mut selcx = SelectionContext::with_query_mode(&self, TraitQueryMode::Standard);
8888
selcx.evaluate_root_obligation(obligation).unwrap_or_else(|r| match r {
89-
OverflowError::Cannonical => {
89+
OverflowError::Canonical => {
9090
span_bug!(
9191
obligation.cause.span,
9292
"Overflow should be caught earlier in standard query mode: {:?}, {:?}",

compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
161161
Ok(Some(EvaluatedCandidate { candidate: c, evaluation: eval }))
162162
}
163163
Ok(_) => Ok(None),
164-
Err(OverflowError::Cannonical) => Err(Overflow),
164+
Err(OverflowError::Canonical) => Err(Overflow),
165165
Err(OverflowError::ErrorReporting) => Err(ErrorReporting),
166166
})
167167
.flat_map(Result::transpose)

compiler/rustc_trait_selection/src/traits/select/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -900,7 +900,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
900900
match self.candidate_from_obligation(stack) {
901901
Ok(Some(c)) => self.evaluate_candidate(stack, &c),
902902
Ok(None) => Ok(EvaluatedToAmbig),
903-
Err(Overflow) => Err(OverflowError::Cannonical),
903+
Err(Overflow) => Err(OverflowError::Canonical),
904904
Err(ErrorReporting) => Err(OverflowError::ErrorReporting),
905905
Err(..) => Ok(EvaluatedToErr),
906906
}
@@ -1064,7 +1064,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
10641064
self.infcx.report_overflow_error(error_obligation, true);
10651065
}
10661066
TraitQueryMode::Canonical => {
1067-
return Err(OverflowError::Cannonical);
1067+
return Err(OverflowError::Canonical);
10681068
}
10691069
}
10701070
}

library/std/src/io/buffered/bufreader.rs

+5-6
Original file line numberDiff line numberDiff line change
@@ -242,14 +242,13 @@ impl<R: Seek> BufReader<R> {
242242
self.pos = new_pos as usize;
243243
return Ok(());
244244
}
245-
} else {
246-
if let Some(new_pos) = pos.checked_add(offset as u64) {
247-
if new_pos <= self.cap as u64 {
248-
self.pos = new_pos as usize;
249-
return Ok(());
250-
}
245+
} else if let Some(new_pos) = pos.checked_add(offset as u64) {
246+
if new_pos <= self.cap as u64 {
247+
self.pos = new_pos as usize;
248+
return Ok(());
251249
}
252250
}
251+
253252
self.seek(SeekFrom::Current(offset)).map(drop)
254253
}
255254
}

library/std/src/sys/windows/fs.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,7 @@ impl IntoInner<Handle> for File {
558558

559559
impl FromInner<Handle> for File {
560560
fn from_inner(handle: Handle) -> File {
561-
File { handle: handle }
561+
File { handle }
562562
}
563563
}
564564

@@ -672,7 +672,7 @@ impl FilePermissions {
672672

673673
impl FileType {
674674
fn new(attrs: c::DWORD, reparse_tag: c::DWORD) -> FileType {
675-
FileType { attributes: attrs, reparse_tag: reparse_tag }
675+
FileType { attributes: attrs, reparse_tag }
676676
}
677677
pub fn is_dir(&self) -> bool {
678678
!self.is_symlink() && self.is_directory()

library/std/src/sys/windows/stack_overflow.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ impl Handler {
99
pub unsafe fn new() -> Handler {
1010
// This API isn't available on XP, so don't panic in that case and just
1111
// pray it works out ok.
12-
if c::SetThreadStackGuarantee(&mut 0x5000) == 0 {
13-
if c::GetLastError() as u32 != c::ERROR_CALL_NOT_IMPLEMENTED as u32 {
14-
panic!("failed to reserve stack space for exception handling");
15-
}
12+
if c::SetThreadStackGuarantee(&mut 0x5000) == 0
13+
&& c::GetLastError() as u32 != c::ERROR_CALL_NOT_IMPLEMENTED as u32
14+
{
15+
panic!("failed to reserve stack space for exception handling");
1616
}
1717
Handler
1818
}

library/std/src/sys_common/backtrace.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,8 @@ unsafe fn _print_fmt(fmt: &mut fmt::Formatter<'_>, print_fmt: PrintFmt) -> fmt::
9393
if stop {
9494
return false;
9595
}
96-
if !hit {
97-
if start {
98-
res = bt_fmt.frame().print_raw(frame.ip(), None, None, None);
99-
}
96+
if !hit && start {
97+
res = bt_fmt.frame().print_raw(frame.ip(), None, None, None);
10098
}
10199

102100
idx += 1;

src/librustdoc/clean/blanket_impl.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ impl<'a, 'tcx> BlanketImplFinder<'a, 'tcx> {
7878
);
7979
match infcx.evaluate_obligation(&obligation) {
8080
Ok(eval_result) if eval_result.may_apply() => {}
81-
Err(traits::OverflowError::Cannonical) => {}
81+
Err(traits::OverflowError::Canonical) => {}
8282
Err(traits::OverflowError::ErrorReporting) => {}
8383
_ => {
8484
return false;

src/librustdoc/html/static/css/rustdoc.css

+4-2
Original file line numberDiff line numberDiff line change
@@ -773,8 +773,6 @@ h2.small-section-header > .anchor {
773773

774774
.item-table {
775775
display: table-row;
776-
/* align content left */
777-
justify-items: start;
778776
}
779777
.item-row {
780778
display: table-row;
@@ -1969,4 +1967,8 @@ details.undocumented[open] > summary::before {
19691967
.docblock {
19701968
margin-left: 12px;
19711969
}
1970+
1971+
.docblock code {
1972+
overflow-wrap: anywhere;
1973+
}
19721974
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// If we have a long `<code>`, we need to ensure that it'll be fully displayed on mobile, meaning
2+
// that it'll be on two lines.
3+
emulate: "iPhone 8" // it has the following size: (375, 667)
4+
goto: file://|DOC_PATH|/test_docs/long_code_block/index.html
5+
// We now check that the block is on two lines:
6+
show-text: true // We need to enable text draw to be able to have the "real" size
7+
// Little explanations for this test: if the text wasn't displayed on two lines, it would take
8+
// around 20px (which is the font size).
9+
assert-property: (".docblock p > code", {"offsetHeight": "42"})

src/test/rustdoc-gui/src/test_docs/lib.rs

+3
Original file line numberDiff line numberDiff line change
@@ -120,3 +120,6 @@ pub type SomeType = u32;
120120
pub mod huge_amount_of_consts {
121121
include!(concat!(env!("OUT_DIR"), "/huge_amount_of_consts.rs"));
122122
}
123+
124+
/// Very long code text `hereIgoWithLongTextBecauseWhyNotAndWhyWouldntI`.
125+
pub mod long_code_block {}
+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// only-wasm32
2+
// compile-flags: --crate-type=lib -Copt-level=2
3+
// build-pass
4+
#![feature(repr_simd)]
5+
6+
// Regression test for #80108
7+
8+
#[repr(simd)]
9+
pub struct Vector([i32; 4]);
10+
11+
impl Vector {
12+
pub const fn to_array(self) -> [i32; 4] {
13+
self.0
14+
}
15+
}

0 commit comments

Comments
 (0)