Skip to content

Commit

Permalink
Auto merge of #101838 - matthiaskrgr:rollup-d1nm6b3, r=matthiaskrgr
Browse files Browse the repository at this point in the history
Rollup of 9 pull requests

Successful merges:

 - #100415 (Add BE8 support)
 - #101559 (Adding "backtrace off" option for fuchsia targets)
 - #101740 (Adding ignore-fuchsia arg to non-applicable compiler ui tests)
 - #101778 (rustdoc: clean up DOM by removing `.dockblock-short p`)
 - #101786 (Tidy will not check coding style in bootstrap/target)
 - #101810 (Constify `PartialEq` for `Ordering`)
 - #101812 (rustdoc: clean up CSS `#titles` using flexbox)
 - #101820 (rustdoc: remove no-op rule `a { background: transparent }`)
 - #101828 (Add test for #101743)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
  • Loading branch information
bors committed Sep 15, 2022
2 parents c3f5929 + 384fee9 commit 0a27ac1
Show file tree
Hide file tree
Showing 20 changed files with 184 additions and 80 deletions.
19 changes: 19 additions & 0 deletions compiler/rustc_target/src/spec/armeb_unknown_linux_gnueabi.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
use crate::abi::Endian;
use crate::spec::{Target, TargetOptions};

pub fn target() -> Target {
Target {
llvm_target: "armeb-unknown-linux-gnueabi".into(),
pointer_width: 32,
data_layout: "E-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
arch: "arm".into(),
options: TargetOptions {
abi: "eabi".into(),
features: "+strict-align,+v8,+crc".into(),
endian: Endian::Big,
max_atomic_width: Some(64),
mcount: "\u{1}__gnu_mcount_nc".into(),
..super::linux_gnu_base::opts()
},
}
}
1 change: 1 addition & 0 deletions compiler/rustc_target/src/spec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -932,6 +932,7 @@ supported_targets! {
("sparc64-unknown-linux-gnu", sparc64_unknown_linux_gnu),
("arm-unknown-linux-gnueabi", arm_unknown_linux_gnueabi),
("arm-unknown-linux-gnueabihf", arm_unknown_linux_gnueabihf),
("armeb-unknown-linux-gnueabi", armeb_unknown_linux_gnueabi),
("arm-unknown-linux-musleabi", arm_unknown_linux_musleabi),
("arm-unknown-linux-musleabihf", arm_unknown_linux_musleabihf),
("armv4t-unknown-linux-gnueabi", armv4t_unknown_linux_gnueabi),
Expand Down
15 changes: 14 additions & 1 deletion library/core/src/cmp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#![stable(feature = "rust1", since = "1.0.0")]

use crate::marker::Destruct;
use crate::marker::StructuralPartialEq;

use self::Ordering::*;

Expand Down Expand Up @@ -338,7 +339,7 @@ pub struct AssertParamIsEq<T: Eq + ?Sized> {
/// let result = 2.cmp(&1);
/// assert_eq!(Ordering::Greater, result);
/// ```
#[derive(Clone, Copy, PartialEq, Eq, Debug, Hash)]
#[derive(Clone, Copy, Eq, Debug, Hash)]
#[stable(feature = "rust1", since = "1.0.0")]
#[repr(i8)]
pub enum Ordering {
Expand Down Expand Up @@ -884,6 +885,18 @@ pub macro Ord($item:item) {
/* compiler built-in */
}

#[stable(feature = "rust1", since = "1.0.0")]
impl StructuralPartialEq for Ordering {}

#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_const_unstable(feature = "const_cmp", issue = "92391")]
impl const PartialEq for Ordering {
#[inline]
fn eq(&self, other: &Self) -> bool {
(*self as i32).eq(&(*other as i32))
}
}

#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_const_unstable(feature = "const_cmp", issue = "92391")]
impl const Ord for Ordering {
Expand Down
33 changes: 16 additions & 17 deletions library/std/src/panic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -295,23 +295,22 @@ pub fn get_backtrace_style() -> Option<BacktraceStyle> {
return Some(style);
}

// Setting environment variables for Fuchsia components isn't a standard
// or easily supported workflow. For now, display backtraces by default.
let format = if cfg!(target_os = "fuchsia") {
BacktraceStyle::Full
} else {
crate::env::var_os("RUST_BACKTRACE")
.map(|x| {
if &x == "0" {
BacktraceStyle::Off
} else if &x == "full" {
BacktraceStyle::Full
} else {
BacktraceStyle::Short
}
})
.unwrap_or(BacktraceStyle::Off)
};
let format = crate::env::var_os("RUST_BACKTRACE")
.map(|x| {
if &x == "0" {
BacktraceStyle::Off
} else if &x == "full" {
BacktraceStyle::Full
} else {
BacktraceStyle::Short
}
})
.unwrap_or(if cfg!(target_os = "fuchsia") {
// Fuchsia components default to full backtrace.
BacktraceStyle::Full
} else {
BacktraceStyle::Off
});
set_backtrace_style(format);
Some(format)
}
Expand Down
1 change: 1 addition & 0 deletions src/doc/rustc/src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
- [aarch64-apple-ios-sim](platform-support/aarch64-apple-ios-sim.md)
- [\*-apple-watchos\*](platform-support/apple-watchos.md)
- [aarch64-nintendo-switch-freestanding](platform-support/aarch64-nintendo-switch-freestanding.md)
- [armeb-unknown-linux-gnueabi](platform-support/armeb-unknown-linux-gnueabi.md)
- [armv4t-none-eabi](platform-support/armv4t-none-eabi.md)
- [armv6k-nintendo-3ds](platform-support/armv6k-nintendo-3ds.md)
- [armv7-unknown-linux-uclibceabi](platform-support/armv7-unknown-linux-uclibceabi.md)
Expand Down
1 change: 1 addition & 0 deletions src/doc/rustc/src/platform-support.md
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ target | std | host | notes
`aarch64_be-unknown-linux-gnu_ilp32` | ✓ | ✓ | ARM64 Linux (big-endian, ILP32 ABI)
`aarch64_be-unknown-linux-gnu` | ✓ | ✓ | ARM64 Linux (big-endian)
[`arm64_32-apple-watchos`](platform-support/apple-watchos.md) | ✓ | | ARM Apple WatchOS 64-bit with 32-bit pointers
[`armeb-unknown-linux-gnueabi`](platform-support/armeb-unknown-linux-gnueabi.md) | ✓ | ? | ARM BE8 the default ARM big-endian architecture since [ARMv6](https://developer.arm.com/documentation/101754/0616/armlink-Reference/armlink-Command-line-Options/--be8?lang=en).
`armv4t-none-eabi` | * | | ARMv4T A32
`armv4t-unknown-linux-gnueabi` | ? | |
`armv5te-unknown-linux-uclibceabi` | ? | | ARMv5TE Linux with uClibc
Expand Down
74 changes: 74 additions & 0 deletions src/doc/rustc/src/platform-support/armeb-unknown-linux-gnueabi.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# armeb-unknown-linux-gnueabi
**Tier: 3**

Target for cross-compiling Linux user-mode applications targetting the ARM BE8 architecture.

## Overview
BE8 architecture retains the same little-endian ordered code-stream used by conventional little endian ARM systems, however the data accesses are in big-endian. BE8 is used primarily in high-performance networking applications where the ability to read packets in their native "Network Byte Order" is important (many network protocols transmit data in big-endian byte order for their wire formats).

## History
BE8 architecture is the default big-endian architecture for ARM since [ARMv6](https://developer.arm.com/documentation/101754/0616/armlink-Reference/armlink-Command-line-Options/--be8?lang=en). It's predecessor, used for ARMv4 and ARMv5 devices was [BE32](https://developer.arm.com/documentation/dui0474/j/linker-command-line-options/--be32). On ARMv6 architecture, endianness can be configured via [system registers](https://developer.arm.com/documentation/ddi0290/g/unaligned-and-mixed-endian-data-access-support/mixed-endian-access-support/interaction-between-the-bus-protocol-and-the-core-endianness). However, BE32 was withdrawn for [ARMv7](https://developer.arm.com/documentation/ddi0406/cb/Appendixes/Deprecated-and-Obsolete-Features/Obsolete-features/Support-for-BE-32-endianness-model) onwards.

## Target Maintainers
* [@WorksButNotTested](https://github.com/WorksButNotTested)

## Requirements
The target is cross-compiled. This target supports `std` in the normal way (indeed only nominal changes are required from the standard ARM configuration).

## Target definition
The target definition can be seen [here](https://github.com/rust-lang/rust/tree/master/compiler/rustc_target/src/spec/armeb_unknown_linux_gnueabi.rs). In particular, it should be noted that the `features` specify that this target is built for the ARMv8 core. Though this can likely be modified as required.

## Building the target
Because it is Tier 3, rust does not yet ship pre-compiled artifacts for this target.

Therefore, you can build Rust with support for the target by adding it to the target list in config.toml, a sample configuration is shown below. It is expected that the user already have a working GNU compiler toolchain and update the paths accordingly.

```toml
[llvm]
download-ci-llvm = false
skip-rebuild = true
optimize = true
ninja = true
targets = "ARM;X86"
clang = false

[build]
target = ["x86_64-unknown-linux-gnu", "armeb-unknown-linux-gnueabi"]
docs = false
docs-minification = false
compiler-docs = false
[install]
prefix = "/home/user/x-tools/rust/"

[rust]
debug-logging=true
backtrace = true
incremental = true

[target.x86_64-unknown-linux-gnu]

[dist]

[target.armeb-unknown-linux-gnueabi]
cc = "/home/user/x-tools/armeb-unknown-linux-gnueabi/bin/armeb-unknown-linux-gnueabi-gcc"
cxx = "/home/user/x-tools/armeb-unknown-linux-gnueabi/bin/armeb-unknown-linux-gnueabi-g++"
ar = "/home/user/x-tools/armeb-unknown-linux-gnueabi/bin/armeb-unknown-linux-gnueabi-ar"
ranlib = "/home/user/x-tools/armeb-unknown-linux-gnueabi/bin/armeb-unknown-linux-gnueabi-ranlib"
linker = "/home/user/x-tools/armeb-unknown-linux-gnueabi/bin/armeb-unknown-linux-gnueabi-gcc"
llvm-config = "/home/user/x-tools/clang/bin/llvm-config"
llvm-filecheck = "/home/user/x-tools/clang/bin/FileCheck"
```

## Building Rust programs

The following `.cargo/config` is needed inside any project directory to build for the BE8 target:

```toml
[build]
target = "armeb-unknown-linux-gnueabi"

[target.armeb-unknown-linux-gnueabi]
linker = "armeb-unknown-linux-gnueabi-gcc"
```

Note that it is expected that the user has a suitable linker from the GNU toolchain.
6 changes: 5 additions & 1 deletion src/librustdoc/html/markdown.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1119,7 +1119,11 @@ impl MarkdownSummaryLine<'_> {

let mut s = String::new();

html::push_html(&mut s, LinkReplacer::new(SummaryLine::new(p), links));
let without_paragraphs = LinkReplacer::new(SummaryLine::new(p), links).filter(|event| {
!matches!(event, Event::Start(Tag::Paragraph) | Event::End(Tag::Paragraph))
});

html::push_html(&mut s, without_paragraphs);

s
}
Expand Down
36 changes: 7 additions & 29 deletions src/librustdoc/html/static/css/rustdoc.css
Original file line number Diff line number Diff line change
Expand Up @@ -609,16 +609,12 @@ h2.location a {
.docblock-short {
overflow-wrap: break-word;
overflow-wrap: anywhere;
}
.docblock-short p {
display: inline;
overflow: hidden;
text-overflow: ellipsis;
margin: 0;
}
/* Wrap non-pre code blocks (`text`) but not (```text```). */
.docblock > :not(pre) > code,
.docblock-short > :not(pre) > code {
.docblock-short > code {
white-space: pre-wrap;
}

Expand Down Expand Up @@ -758,7 +754,6 @@ nav.sub form { display: inline; }

a {
text-decoration: none;
background: transparent;
}

.small-section-header {
Expand Down Expand Up @@ -1369,27 +1364,19 @@ pre.rust {
}

#titles {
height: 35px;
display: flex;
flex-direction: row;
gap: 1px;
margin-bottom: 4px;
}

#titles > button {
float: left;
width: 33.3%;
text-align: center;
font-size: 1.125rem;
cursor: pointer;
border: 0;
border-top: 2px solid;
}

#titles > button:first-child:last-child {
margin-right: 1px;
width: calc(100% - 1px);
}

#titles > button:not(:last-child) {
margin-right: 1px;
width: calc(33.3% - 1px);
flex: 1;
}

#titles > button > div.count {
Expand Down Expand Up @@ -1886,12 +1873,7 @@ in storage.js plus the media query with (min-width: 701px)
}

#titles > button > div.count {
float: left;
width: 100%;
}

#titles {
height: 50px;
display: block;
}

/* Because of ios, we need to actually have a full height sidebar title so the
Expand Down Expand Up @@ -2022,10 +2004,6 @@ in storage.js plus the media query with (min-width: 701px)
}

@media (max-width: 464px) {
#titles, #titles > button {
height: 73px;
}

#crate-search {
border-radius: 4px;
}
Expand Down
18 changes: 3 additions & 15 deletions src/test/rustdoc-gui/label-next-to-symbol.goml
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,9 @@ compare-elements-position: (
)

// Ensure no wrap
compare-elements-position-near: (
"//*[@class='item-left module-item']//a[text()='replaced_function']",
"//*[@class='item-right docblock-short']//p[text()='a thing with a label']",
{"y": 2},
)
// compare parent elements
compare-elements-position: (
"//*[@class='item-left module-item']//a[text()='replaced_function']/..",
"//*[@class='item-right docblock-short']//p[text()='a thing with a label']/..",
"//*[@class='item-right docblock-short'][text()='a thing with a label']",
("y"),
)

Expand All @@ -60,19 +54,13 @@ compare-elements-position: (
)

// Ensure wrap
compare-elements-position-near-false: (
"//*[@class='item-left module-item']//a[text()='replaced_function']",
"//*[@class='item-right docblock-short']//p[text()='a thing with a label']",
{"y": 12},
)
// compare parent elements
compare-elements-position-false: (
"//*[@class='item-left module-item']//a[text()='replaced_function']/..",
"//*[@class='item-right docblock-short']//p[text()='a thing with a label']/..",
"//*[@class='item-right docblock-short'][text()='a thing with a label']",
("y"),
)
compare-elements-position-false: (
".item-left .stab.deprecated",
"//*[@class='item-right docblock-short']//p[text()='a thing with a label']",
"//*[@class='item-right docblock-short'][text()='a thing with a label']",
("y"),
)
19 changes: 19 additions & 0 deletions src/test/rustdoc/issue-101743-bold-tag.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Regression test for https://github.com/rust-lang/rust/issues/101743

#![crate_name="foo"]

pub type Word = usize;
pub struct Repr<const B: usize>([i32; B]);
pub struct IBig(usize);

pub const fn base_as_ibig<const B: Word>() -> IBig {
IBig(B)
}

impl<const B: Word> Repr<B> {
// If we change back to rendering the value of consts, check this doesn't add
// a <b> tag, but escapes correctly

// @has foo/struct.Repr.html '//section[@id="associatedconstant.BASE"]/h4' '= _'
pub const BASE: IBig = base_as_ibig::<B>();
}
10 changes: 5 additions & 5 deletions src/test/rustdoc/short-docblock.rs
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
#![crate_name = "foo"]

// @has foo/index.html '//*[@class="item-right docblock-short"]/p' 'fooo'
// @!has foo/index.html '//*[@class="item-right docblock-short"]/p/h1' 'fooo'
// @has foo/index.html '//*[@class="item-right docblock-short"]' 'fooo'
// @!has foo/index.html '//*[@class="item-right docblock-short"]/h1' 'fooo'
// @has foo/fn.foo.html '//h2[@id="fooo"]/a[@href="#fooo"]' 'fooo'

/// # fooo
///
/// foo
pub fn foo() {}

// @has foo/index.html '//*[@class="item-right docblock-short"]/p' 'mooood'
// @!has foo/index.html '//*[@class="item-right docblock-short"]/p/h2' 'mooood'
// @has foo/index.html '//*[@class="item-right docblock-short"]' 'mooood'
// @!has foo/index.html '//*[@class="item-right docblock-short"]/h2' 'mooood'
// @has foo/foo/index.html '//h3[@id="mooood"]/a[@href="#mooood"]' 'mooood'

/// ## mooood
///
/// foo mod
pub mod foo {}

// @has foo/index.html '//*[@class="item-right docblock-short"]/p/a[@href=\
// @has foo/index.html '//*[@class="item-right docblock-short"]/a[@href=\
// "https://nougat.world"]/code' 'nougat'

/// [`nougat`](https://nougat.world)
Expand Down
Loading

0 comments on commit 0a27ac1

Please sign in to comment.