Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 6 pull requests #89752

Merged
merged 16 commits into from
Oct 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions compiler/rustc_middle/src/traits/select.rs
Original file line number Diff line number Diff line change
Expand Up @@ -264,14 +264,14 @@ impl EvaluationResult {
/// Indicates that trait evaluation caused overflow and in which pass.
#[derive(Copy, Clone, Debug, PartialEq, Eq, HashStable)]
pub enum OverflowError {
Cannonical,
Canonical,
ErrorReporting,
}

impl<'tcx> From<OverflowError> for SelectionError<'tcx> {
fn from(overflow_error: OverflowError) -> SelectionError<'tcx> {
match overflow_error {
OverflowError::Cannonical => SelectionError::Overflow,
OverflowError::Canonical => SelectionError::Overflow,
OverflowError::ErrorReporting => SelectionError::ErrorReporting,
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,10 @@ impl<'cx, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'cx, 'tcx> {
) -> EvaluationResult {
match self.evaluate_obligation(obligation) {
Ok(result) => result,
Err(OverflowError::Cannonical) => {
Err(OverflowError::Canonical) => {
let mut selcx = SelectionContext::with_query_mode(&self, TraitQueryMode::Standard);
selcx.evaluate_root_obligation(obligation).unwrap_or_else(|r| match r {
OverflowError::Cannonical => {
OverflowError::Canonical => {
span_bug!(
obligation.cause.span,
"Overflow should be caught earlier in standard query mode: {:?}, {:?}",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
Ok(Some(EvaluatedCandidate { candidate: c, evaluation: eval }))
}
Ok(_) => Ok(None),
Err(OverflowError::Cannonical) => Err(Overflow),
Err(OverflowError::Canonical) => Err(Overflow),
Err(OverflowError::ErrorReporting) => Err(ErrorReporting),
})
.flat_map(Result::transpose)
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_trait_selection/src/traits/select/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -900,7 +900,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
match self.candidate_from_obligation(stack) {
Ok(Some(c)) => self.evaluate_candidate(stack, &c),
Ok(None) => Ok(EvaluatedToAmbig),
Err(Overflow) => Err(OverflowError::Cannonical),
Err(Overflow) => Err(OverflowError::Canonical),
Err(ErrorReporting) => Err(OverflowError::ErrorReporting),
Err(..) => Ok(EvaluatedToErr),
}
Expand Down Expand Up @@ -1064,7 +1064,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
self.infcx.report_overflow_error(error_obligation, true);
}
TraitQueryMode::Canonical => {
return Err(OverflowError::Cannonical);
return Err(OverflowError::Canonical);
}
}
}
Expand Down
11 changes: 5 additions & 6 deletions library/std/src/io/buffered/bufreader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -242,14 +242,13 @@ impl<R: Seek> BufReader<R> {
self.pos = new_pos as usize;
return Ok(());
}
} else {
if let Some(new_pos) = pos.checked_add(offset as u64) {
if new_pos <= self.cap as u64 {
self.pos = new_pos as usize;
return Ok(());
}
} else if let Some(new_pos) = pos.checked_add(offset as u64) {
if new_pos <= self.cap as u64 {
self.pos = new_pos as usize;
return Ok(());
}
}

self.seek(SeekFrom::Current(offset)).map(drop)
}
}
Expand Down
4 changes: 2 additions & 2 deletions library/std/src/sys/windows/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,7 @@ impl IntoInner<Handle> for File {

impl FromInner<Handle> for File {
fn from_inner(handle: Handle) -> File {
File { handle: handle }
File { handle }
}
}

Expand Down Expand Up @@ -672,7 +672,7 @@ impl FilePermissions {

impl FileType {
fn new(attrs: c::DWORD, reparse_tag: c::DWORD) -> FileType {
FileType { attributes: attrs, reparse_tag: reparse_tag }
FileType { attributes: attrs, reparse_tag }
}
pub fn is_dir(&self) -> bool {
!self.is_symlink() && self.is_directory()
Expand Down
8 changes: 4 additions & 4 deletions library/std/src/sys/windows/stack_overflow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ impl Handler {
pub unsafe fn new() -> Handler {
// This API isn't available on XP, so don't panic in that case and just
// pray it works out ok.
if c::SetThreadStackGuarantee(&mut 0x5000) == 0 {
if c::GetLastError() as u32 != c::ERROR_CALL_NOT_IMPLEMENTED as u32 {
panic!("failed to reserve stack space for exception handling");
}
if c::SetThreadStackGuarantee(&mut 0x5000) == 0
&& c::GetLastError() as u32 != c::ERROR_CALL_NOT_IMPLEMENTED as u32
{
panic!("failed to reserve stack space for exception handling");
}
Handler
}
Expand Down
6 changes: 2 additions & 4 deletions library/std/src/sys_common/backtrace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,8 @@ unsafe fn _print_fmt(fmt: &mut fmt::Formatter<'_>, print_fmt: PrintFmt) -> fmt::
if stop {
return false;
}
if !hit {
if start {
res = bt_fmt.frame().print_raw(frame.ip(), None, None, None);
}
if !hit && start {
res = bt_fmt.frame().print_raw(frame.ip(), None, None, None);
}

idx += 1;
Expand Down
2 changes: 1 addition & 1 deletion src/librustdoc/clean/blanket_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ impl<'a, 'tcx> BlanketImplFinder<'a, 'tcx> {
);
match infcx.evaluate_obligation(&obligation) {
Ok(eval_result) if eval_result.may_apply() => {}
Err(traits::OverflowError::Cannonical) => {}
Err(traits::OverflowError::Canonical) => {}
Err(traits::OverflowError::ErrorReporting) => {}
_ => {
return false;
Expand Down
6 changes: 4 additions & 2 deletions src/librustdoc/html/static/css/rustdoc.css
Original file line number Diff line number Diff line change
Expand Up @@ -773,8 +773,6 @@ h2.small-section-header > .anchor {

.item-table {
display: table-row;
/* align content left */
justify-items: start;
}
.item-row {
display: table-row;
Expand Down Expand Up @@ -1969,4 +1967,8 @@ details.undocumented[open] > summary::before {
.docblock {
margin-left: 12px;
}

.docblock code {
overflow-wrap: anywhere;
}
}
9 changes: 9 additions & 0 deletions src/test/rustdoc-gui/docblock-big-code-mobile.goml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// If we have a long `<code>`, we need to ensure that it'll be fully displayed on mobile, meaning
// that it'll be on two lines.
emulate: "iPhone 8" // it has the following size: (375, 667)
goto: file://|DOC_PATH|/test_docs/long_code_block/index.html
// We now check that the block is on two lines:
show-text: true // We need to enable text draw to be able to have the "real" size
// Little explanations for this test: if the text wasn't displayed on two lines, it would take
// around 20px (which is the font size).
assert-property: (".docblock p > code", {"offsetHeight": "42"})
3 changes: 3 additions & 0 deletions src/test/rustdoc-gui/src/test_docs/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,3 +120,6 @@ pub type SomeType = u32;
pub mod huge_amount_of_consts {
include!(concat!(env!("OUT_DIR"), "/huge_amount_of_consts.rs"));
}

/// Very long code text `hereIgoWithLongTextBecauseWhyNotAndWhyWouldntI`.
pub mod long_code_block {}
15 changes: 15 additions & 0 deletions src/test/ui/wasm/simd-to-array-80108.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// only-wasm32
// compile-flags: --crate-type=lib -Copt-level=2
// build-pass
#![feature(repr_simd)]

// Regression test for #80108

#[repr(simd)]
pub struct Vector([i32; 4]);

impl Vector {
pub const fn to_array(self) -> [i32; 4] {
self.0
}
}
Loading