Skip to content

Commit c6499fd

Browse files
committed
Auto merge of rust-lang#96974 - matthiaskrgr:rollup-jd4otnc, r=matthiaskrgr
Rollup of 5 pull requests Successful merges: - rust-lang#95896 (Note the contacts for the nvptx64 target(s)) - rust-lang#96860 (openbsd: convert futex timeout managment to Timespec usage) - rust-lang#96939 (Fix settings page CSS) - rust-lang#96941 (update graphviz links) - rust-lang#96968 (Add tests for rust-lang#96806) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents 481db40 + 5656ea2 commit c6499fd

16 files changed

+431
-59
lines changed

compiler/rustc_graphviz/src/lib.rs

+8-10
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,16 @@
44
//! use with [Graphviz](https://www.graphviz.org/) by walking a labeled
55
//! graph. (Graphviz can then automatically lay out the nodes and edges
66
//! of the graph, and also optionally render the graph as an image or
7-
//! other [output formats](
8-
//! https://www.graphviz.org/content/output-formats), such as SVG.)
7+
//! other [output formats](https://www.graphviz.org/docs/outputs), such as SVG.)
98
//!
109
//! Rather than impose some particular graph data structure on clients,
1110
//! this library exposes two traits that clients can implement on their
1211
//! own structs before handing them over to the rendering function.
1312
//!
1413
//! Note: This library does not yet provide access to the full
15-
//! expressiveness of the [DOT language](
16-
//! https://www.graphviz.org/doc/info/lang.html). For example, there are
17-
//! many [attributes](https://www.graphviz.org/content/attrs) related to
18-
//! providing layout hints (e.g., left-to-right versus top-down, which
14+
//! expressiveness of the [DOT language](https://www.graphviz.org/doc/info/lang.html).
15+
//! For example, there are many [attributes](https://www.graphviz.org/doc/info/attrs.html)
16+
//! related to providing layout hints (e.g., left-to-right versus top-down, which
1917
//! algorithm to use, etc). The current intention of this library is to
2018
//! emit a human-readable .dot file with very regular structure suitable
2119
//! for easy post-processing.
@@ -292,7 +290,7 @@ pub enum LabelText<'a> {
292290
LabelStr(Cow<'a, str>),
293291

294292
/// This kind of label uses the graphviz label escString type:
295-
/// <https://www.graphviz.org/content/attrs#kescString>
293+
/// <https://www.graphviz.org/docs/attr-types/escString>
296294
///
297295
/// Occurrences of backslashes (`\`) are not escaped; instead they
298296
/// are interpreted as initiating an escString escape sequence.
@@ -307,12 +305,12 @@ pub enum LabelText<'a> {
307305
/// printed exactly as given, but between `<` and `>`. **No
308306
/// escaping is performed.**
309307
///
310-
/// [html]: https://www.graphviz.org/content/node-shapes#html
308+
/// [html]: https://www.graphviz.org/doc/info/shapes.html#html
311309
HtmlStr(Cow<'a, str>),
312310
}
313311

314312
/// The style for a node or edge.
315-
/// See <https://www.graphviz.org/doc/info/attrs.html#k:style> for descriptions.
313+
/// See <https://www.graphviz.org/docs/attr-types/style/> for descriptions.
316314
/// Note that some of these are not valid for edges.
317315
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
318316
pub enum Style {
@@ -439,7 +437,7 @@ pub trait Labeller<'a> {
439437
/// Maps `n` to one of the [graphviz `shape` names][1]. If `None`
440438
/// is returned, no `shape` attribute is specified.
441439
///
442-
/// [1]: https://www.graphviz.org/content/node-shapes
440+
/// [1]: https://www.graphviz.org/doc/info/shapes.html
443441
fn node_shape(&'a self, _node: &Self::Node) -> Option<LabelText<'a>> {
444442
None
445443
}

library/std/src/sys/unix/futex.rs

+7-9
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ pub fn futex_wait(futex: &AtomicU32, expected: u32, timeout: Option<Duration>) -
2525
//
2626
// Overflows are rounded up to an infinite timeout (None).
2727
let timespec = timeout
28-
.and_then(|d| Some(Timespec::now(libc::CLOCK_MONOTONIC).checked_add_duration(&d)?))
28+
.and_then(|d| Timespec::now(libc::CLOCK_MONOTONIC).checked_add_duration(&d))
2929
.and_then(|t| t.to_timespec());
3030

3131
loop {
@@ -136,15 +136,13 @@ pub fn futex_wake_all(futex: &AtomicU32) {
136136

137137
#[cfg(target_os = "openbsd")]
138138
pub fn futex_wait(futex: &AtomicU32, expected: u32, timeout: Option<Duration>) -> bool {
139+
use super::time::Timespec;
139140
use crate::ptr::{null, null_mut};
140-
let timespec = timeout.and_then(|d| {
141-
Some(libc::timespec {
142-
// Sleep forever if the timeout is longer than fits in a timespec.
143-
tv_sec: d.as_secs().try_into().ok()?,
144-
// This conversion never truncates, as subsec_nanos is always <1e9.
145-
tv_nsec: d.subsec_nanos() as _,
146-
})
147-
});
141+
142+
// Overflows are rounded up to an infinite timeout (None).
143+
let timespec = timeout
144+
.and_then(|d| Timespec::zero().checked_add_duration(&d))
145+
.and_then(|t| t.to_timespec());
148146

149147
let r = unsafe {
150148
libc::futex(

library/std/src/sys/unix/time.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ impl fmt::Debug for SystemTime {
5151
}
5252

5353
impl Timespec {
54-
const fn zero() -> Timespec {
54+
pub const fn zero() -> Timespec {
5555
Timespec { tv_sec: 0, tv_nsec: 0 }
5656
}
5757

@@ -125,6 +125,7 @@ impl Timespec {
125125
Some(Timespec::new(secs, nsec as i64))
126126
}
127127

128+
#[allow(dead_code)]
128129
pub fn to_timespec(&self) -> Option<libc::timespec> {
129130
Some(libc::timespec {
130131
tv_sec: self.tv_sec.try_into().ok()?,
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# `nvptx64-nvidia-cuda`
2+
3+
**Tier: 2**
4+
5+
This is the target meant for deploying code for Nvidia® accelerators based on their CUDA
6+
platform.
7+
8+
## Target maintainers
9+
10+
- Riccardo D'Ambrosio, https://github.com/RDambrosio016
11+
- Kjetil Kjeka, https://github.com/kjetilkjeka
12+
13+
<!-- FIXME: fill this out
14+
15+
## Requirements
16+
17+
Does the target support host tools, or only cross-compilation? Does the target
18+
support std, or alloc (either with a default allocator, or if the user supplies
19+
an allocator)?
20+
21+
Document the expectations of binaries built for the target. Do they assume
22+
specific minimum features beyond the baseline of the CPU/environment/etc? What
23+
version of the OS or environment do they expect?
24+
25+
Are there notable `#[target_feature(...)]` or `-C target-feature=` values that
26+
programs may wish to use?
27+
28+
What calling convention does `extern "C"` use on the target?
29+
30+
What format do binaries use by default? ELF, PE, something else?
31+
32+
## Building the target
33+
34+
If Rust doesn't build the target by default, how can users build it? Can users
35+
just add it to the `target` list in `config.toml`?
36+
37+
## Building Rust programs
38+
39+
Rust does not yet ship pre-compiled artifacts for this target. To compile for
40+
this target, you will either need to build Rust with the target enabled (see
41+
"Building the target" above), or build your own copy of `core` by using
42+
`build-std` or similar.
43+
44+
## Testing
45+
46+
Does the target support running binaries, or do binaries have varying
47+
expectations that prevent having a standard way to run them? If users can run
48+
binaries, can they do so in some common emulator, or do they need native
49+
hardware? Does the target support running the Rust testsuite?
50+
51+
## Cross-compilation toolchains and C code
52+
53+
Does the target support C code? If so, what toolchain target should users use
54+
to build compatible C code? (This may match the target triple, or it may be a
55+
toolchain for a different target triple, potentially with specific options or
56+
caveats.)
57+
58+
-->

src/librustdoc/html/render/context.rs

+5-3
Original file line numberDiff line numberDiff line change
@@ -596,9 +596,11 @@ impl<'tcx> FormatRenderer<'tcx> for Context<'tcx> {
596596
|buf: &mut Buffer| {
597597
write!(
598598
buf,
599-
"<script defer src=\"{}settings{}.js\"></script>",
600-
page.static_root_path.unwrap_or(""),
601-
page.resource_suffix
599+
"<link rel=\"stylesheet\" type=\"text/css\" \
600+
href=\"{root_path}settings{suffix}.css\">\
601+
<script defer src=\"{root_path}settings{suffix}.js\"></script>",
602+
root_path = page.static_root_path.unwrap_or(""),
603+
suffix = page.resource_suffix,
602604
)
603605
},
604606
&self.shared.style_files,

src/librustdoc/html/static/css/settings.css

-36
Original file line numberDiff line numberDiff line change
@@ -56,38 +56,6 @@
5656
position: absolute;
5757
}
5858

59-
.select-wrapper {
60-
float: right;
61-
position: relative;
62-
height: 27px;
63-
min-width: 25%;
64-
}
65-
66-
.select-wrapper select {
67-
appearance: none;
68-
-moz-appearance: none;
69-
-webkit-appearance: none;
70-
background: none;
71-
border: 2px solid #ccc;
72-
padding-right: 28px;
73-
width: 100%;
74-
}
75-
76-
.select-wrapper img {
77-
pointer-events: none;
78-
position: absolute;
79-
right: 0;
80-
bottom: 0;
81-
background: #ccc;
82-
height: 100%;
83-
width: 28px;
84-
padding: 0px 4px;
85-
}
86-
87-
.select-wrapper select option {
88-
color: initial;
89-
}
90-
9159
.slider {
9260
position: absolute;
9361
cursor: pointer;
@@ -96,7 +64,6 @@
9664
right: 0;
9765
bottom: 0;
9866
background-color: #ccc;
99-
-webkit-transition: .3s;
10067
transition: .3s;
10168
}
10269

@@ -108,7 +75,6 @@
10875
left: 4px;
10976
bottom: 4px;
11077
background-color: white;
111-
-webkit-transition: .3s;
11278
transition: .3s;
11379
}
11480

@@ -121,8 +87,6 @@ input:focus + .slider {
12187
}
12288

12389
input:checked + .slider:before {
124-
-webkit-transform: translateX(19px);
125-
-ms-transform: translateX(19px);
12690
transform: translateX(19px);
12791
}
12892

src/test/mir-opt/inline/dyn-trait.rs

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#![crate_type = "lib"]
2+
3+
use std::fmt::Debug;
4+
5+
pub trait Cache {
6+
type V: Debug;
7+
8+
fn store_nocache(&self);
9+
}
10+
11+
pub trait Query {
12+
type V;
13+
type C: Cache<V = Self::V>;
14+
15+
fn cache<T>(s: &T) -> &Self::C;
16+
}
17+
18+
// EMIT_MIR dyn_trait.mk_cycle.Inline.diff
19+
#[inline(always)]
20+
pub fn mk_cycle<V: Debug>(c: &dyn Cache<V = V>) {
21+
c.store_nocache()
22+
}
23+
24+
// EMIT_MIR dyn_trait.try_execute_query.Inline.diff
25+
#[inline(always)]
26+
pub fn try_execute_query<C: Cache>(c: &C) {
27+
mk_cycle(c)
28+
}
29+
30+
// EMIT_MIR dyn_trait.get_query.Inline.diff
31+
#[inline(always)]
32+
pub fn get_query<Q: Query, T>(t: &T) {
33+
let c = Q::cache(t);
34+
try_execute_query(c)
35+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
- // MIR for `get_query` before Inline
2+
+ // MIR for `get_query` after Inline
3+
4+
fn get_query(_1: &T) -> () {
5+
debug t => _1; // in scope 0 at $DIR/dyn-trait.rs:32:31: 32:32
6+
let mut _0: (); // return place in scope 0 at $DIR/dyn-trait.rs:32:38: 32:38
7+
let _2: &<Q as Query>::C; // in scope 0 at $DIR/dyn-trait.rs:33:9: 33:10
8+
let mut _3: &T; // in scope 0 at $DIR/dyn-trait.rs:33:22: 33:23
9+
let mut _4: &<Q as Query>::C; // in scope 0 at $DIR/dyn-trait.rs:34:23: 34:24
10+
scope 1 {
11+
debug c => _2; // in scope 1 at $DIR/dyn-trait.rs:33:9: 33:10
12+
+ scope 2 (inlined try_execute_query::<<Q as Query>::C>) { // at $DIR/dyn-trait.rs:34:5: 34:25
13+
+ debug c => _4; // in scope 2 at $DIR/dyn-trait.rs:26:36: 26:37
14+
+ let mut _5: &dyn Cache<V = <Q as Query>::V>; // in scope 2 at $DIR/dyn-trait.rs:27:14: 27:15
15+
+ let mut _6: &<Q as Query>::C; // in scope 2 at $DIR/dyn-trait.rs:27:14: 27:15
16+
+ scope 3 (inlined mk_cycle::<<Q as Query>::V>) { // at $DIR/dyn-trait.rs:27:5: 27:16
17+
+ debug c => _5; // in scope 3 at $DIR/dyn-trait.rs:20:27: 20:28
18+
+ let mut _7: &dyn Cache<V = <Q as Query>::V>; // in scope 3 at $DIR/dyn-trait.rs:21:5: 21:22
19+
+ }
20+
+ }
21+
}
22+
23+
bb0: {
24+
StorageLive(_2); // scope 0 at $DIR/dyn-trait.rs:33:9: 33:10
25+
StorageLive(_3); // scope 0 at $DIR/dyn-trait.rs:33:22: 33:23
26+
_3 = &(*_1); // scope 0 at $DIR/dyn-trait.rs:33:22: 33:23
27+
_2 = <Q as Query>::cache::<T>(move _3) -> bb1; // scope 0 at $DIR/dyn-trait.rs:33:13: 33:24
28+
// mir::Constant
29+
// + span: $DIR/dyn-trait.rs:33:13: 33:21
30+
// + user_ty: UserType(0)
31+
// + literal: Const { ty: for<'r> fn(&'r T) -> &'r <Q as Query>::C {<Q as Query>::cache::<T>}, val: Value(Scalar(<ZST>)) }
32+
}
33+
34+
bb1: {
35+
StorageDead(_3); // scope 0 at $DIR/dyn-trait.rs:33:23: 33:24
36+
StorageLive(_4); // scope 1 at $DIR/dyn-trait.rs:34:23: 34:24
37+
_4 = &(*_2); // scope 1 at $DIR/dyn-trait.rs:34:23: 34:24
38+
- _0 = try_execute_query::<<Q as Query>::C>(move _4) -> bb2; // scope 1 at $DIR/dyn-trait.rs:34:5: 34:25
39+
+ StorageLive(_5); // scope 2 at $DIR/dyn-trait.rs:27:14: 27:15
40+
+ StorageLive(_6); // scope 2 at $DIR/dyn-trait.rs:27:14: 27:15
41+
+ _6 = _4; // scope 2 at $DIR/dyn-trait.rs:27:14: 27:15
42+
+ _5 = move _6 as &dyn Cache<V = <Q as Query>::V> (Pointer(Unsize)); // scope 2 at $DIR/dyn-trait.rs:27:14: 27:15
43+
+ StorageDead(_6); // scope 2 at $DIR/dyn-trait.rs:27:14: 27:15
44+
+ StorageLive(_7); // scope 3 at $DIR/dyn-trait.rs:21:5: 21:22
45+
+ _7 = _5; // scope 3 at $DIR/dyn-trait.rs:21:5: 21:22
46+
+ _0 = <dyn Cache<V = <Q as Query>::V> as Cache>::store_nocache(move _7) -> bb2; // scope 3 at $DIR/dyn-trait.rs:21:5: 21:22
47+
// mir::Constant
48+
- // + span: $DIR/dyn-trait.rs:34:5: 34:22
49+
- // + literal: Const { ty: for<'r> fn(&'r <Q as Query>::C) {try_execute_query::<<Q as Query>::C>}, val: Value(Scalar(<ZST>)) }
50+
+ // + span: $DIR/dyn-trait.rs:21:7: 21:20
51+
+ // + literal: Const { ty: for<'r> fn(&'r dyn Cache<V = <Q as Query>::V>) {<dyn Cache<V = <Q as Query>::V> as Cache>::store_nocache}, val: Value(Scalar(<ZST>)) }
52+
}
53+
54+
bb2: {
55+
+ StorageDead(_7); // scope 3 at $DIR/dyn-trait.rs:21:21: 21:22
56+
+ StorageDead(_5); // scope 2 at $DIR/dyn-trait.rs:27:15: 27:16
57+
StorageDead(_4); // scope 1 at $DIR/dyn-trait.rs:34:24: 34:25
58+
StorageDead(_2); // scope 0 at $DIR/dyn-trait.rs:35:1: 35:2
59+
return; // scope 0 at $DIR/dyn-trait.rs:35:2: 35:2
60+
}
61+
}
62+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
- // MIR for `mk_cycle` before Inline
2+
+ // MIR for `mk_cycle` after Inline
3+
4+
fn mk_cycle(_1: &dyn Cache<V = V>) -> () {
5+
debug c => _1; // in scope 0 at $DIR/dyn-trait.rs:20:27: 20:28
6+
let mut _0: (); // return place in scope 0 at $DIR/dyn-trait.rs:20:49: 20:49
7+
let mut _2: &dyn Cache<V = V>; // in scope 0 at $DIR/dyn-trait.rs:21:5: 21:22
8+
9+
bb0: {
10+
StorageLive(_2); // scope 0 at $DIR/dyn-trait.rs:21:5: 21:22
11+
_2 = &(*_1); // scope 0 at $DIR/dyn-trait.rs:21:5: 21:22
12+
_0 = <dyn Cache<V = V> as Cache>::store_nocache(move _2) -> bb1; // scope 0 at $DIR/dyn-trait.rs:21:5: 21:22
13+
// mir::Constant
14+
// + span: $DIR/dyn-trait.rs:21:7: 21:20
15+
// + literal: Const { ty: for<'r> fn(&'r dyn Cache<V = V>) {<dyn Cache<V = V> as Cache>::store_nocache}, val: Value(Scalar(<ZST>)) }
16+
}
17+
18+
bb1: {
19+
StorageDead(_2); // scope 0 at $DIR/dyn-trait.rs:21:21: 21:22
20+
return; // scope 0 at $DIR/dyn-trait.rs:22:2: 22:2
21+
}
22+
}
23+

0 commit comments

Comments
 (0)