Auto merge of #96974 - matthiaskrgr:rollup-jd4otnc, r=matthiaskrgr

Rollup of 5 pull requests

Successful merges:

 - #95896 (Note the contacts for the nvptx64 target(s))
 - #96860 (openbsd: convert futex timeout managment to Timespec usage)
 - #96939 (Fix settings page CSS)
 - #96941 (update graphviz links)
 - #96968 (Add tests for #96806)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
This commit is contained in:
bors 2022-05-12 15:07:35 +00:00
commit c6499fd998
16 changed files with 431 additions and 59 deletions

View file

@ -4,18 +4,16 @@
//! use with [Graphviz](https://www.graphviz.org/) by walking a labeled //! use with [Graphviz](https://www.graphviz.org/) by walking a labeled
//! graph. (Graphviz can then automatically lay out the nodes and edges //! graph. (Graphviz can then automatically lay out the nodes and edges
//! of the graph, and also optionally render the graph as an image or //! of the graph, and also optionally render the graph as an image or
//! other [output formats]( //! other [output formats](https://www.graphviz.org/docs/outputs), such as SVG.)
//! https://www.graphviz.org/content/output-formats), such as SVG.)
//! //!
//! Rather than impose some particular graph data structure on clients, //! Rather than impose some particular graph data structure on clients,
//! this library exposes two traits that clients can implement on their //! this library exposes two traits that clients can implement on their
//! own structs before handing them over to the rendering function. //! own structs before handing them over to the rendering function.
//! //!
//! Note: This library does not yet provide access to the full //! Note: This library does not yet provide access to the full
//! expressiveness of the [DOT language]( //! expressiveness of the [DOT language](https://www.graphviz.org/doc/info/lang.html).
//! https://www.graphviz.org/doc/info/lang.html). For example, there are //! For example, there are many [attributes](https://www.graphviz.org/doc/info/attrs.html)
//! many [attributes](https://www.graphviz.org/content/attrs) related to //! related to providing layout hints (e.g., left-to-right versus top-down, which
//! providing layout hints (e.g., left-to-right versus top-down, which
//! algorithm to use, etc). The current intention of this library is to //! algorithm to use, etc). The current intention of this library is to
//! emit a human-readable .dot file with very regular structure suitable //! emit a human-readable .dot file with very regular structure suitable
//! for easy post-processing. //! for easy post-processing.
@ -292,7 +290,7 @@ pub enum LabelText<'a> {
LabelStr(Cow<'a, str>), LabelStr(Cow<'a, str>),
/// This kind of label uses the graphviz label escString type: /// This kind of label uses the graphviz label escString type:
/// <https://www.graphviz.org/content/attrs#kescString> /// <https://www.graphviz.org/docs/attr-types/escString>
/// ///
/// Occurrences of backslashes (`\`) are not escaped; instead they /// Occurrences of backslashes (`\`) are not escaped; instead they
/// are interpreted as initiating an escString escape sequence. /// are interpreted as initiating an escString escape sequence.
@ -307,12 +305,12 @@ pub enum LabelText<'a> {
/// printed exactly as given, but between `<` and `>`. **No /// printed exactly as given, but between `<` and `>`. **No
/// escaping is performed.** /// escaping is performed.**
/// ///
/// [html]: https://www.graphviz.org/content/node-shapes#html /// [html]: https://www.graphviz.org/doc/info/shapes.html#html
HtmlStr(Cow<'a, str>), HtmlStr(Cow<'a, str>),
} }
/// The style for a node or edge. /// The style for a node or edge.
/// See <https://www.graphviz.org/doc/info/attrs.html#k:style> for descriptions. /// See <https://www.graphviz.org/docs/attr-types/style/> for descriptions.
/// Note that some of these are not valid for edges. /// Note that some of these are not valid for edges.
#[derive(Copy, Clone, PartialEq, Eq, Debug)] #[derive(Copy, Clone, PartialEq, Eq, Debug)]
pub enum Style { pub enum Style {
@ -439,7 +437,7 @@ pub trait Labeller<'a> {
/// Maps `n` to one of the [graphviz `shape` names][1]. If `None` /// Maps `n` to one of the [graphviz `shape` names][1]. If `None`
/// is returned, no `shape` attribute is specified. /// is returned, no `shape` attribute is specified.
/// ///
/// [1]: https://www.graphviz.org/content/node-shapes /// [1]: https://www.graphviz.org/doc/info/shapes.html
fn node_shape(&'a self, _node: &Self::Node) -> Option<LabelText<'a>> { fn node_shape(&'a self, _node: &Self::Node) -> Option<LabelText<'a>> {
None None
} }

View file

@ -25,7 +25,7 @@ pub fn futex_wait(futex: &AtomicU32, expected: u32, timeout: Option<Duration>) -
// //
// Overflows are rounded up to an infinite timeout (None). // Overflows are rounded up to an infinite timeout (None).
let timespec = timeout let timespec = timeout
.and_then(|d| Some(Timespec::now(libc::CLOCK_MONOTONIC).checked_add_duration(&d)?)) .and_then(|d| Timespec::now(libc::CLOCK_MONOTONIC).checked_add_duration(&d))
.and_then(|t| t.to_timespec()); .and_then(|t| t.to_timespec());
loop { loop {
@ -136,15 +136,13 @@ pub fn futex_wake_all(futex: &AtomicU32) {
#[cfg(target_os = "openbsd")] #[cfg(target_os = "openbsd")]
pub fn futex_wait(futex: &AtomicU32, expected: u32, timeout: Option<Duration>) -> bool { pub fn futex_wait(futex: &AtomicU32, expected: u32, timeout: Option<Duration>) -> bool {
use super::time::Timespec;
use crate::ptr::{null, null_mut}; use crate::ptr::{null, null_mut};
let timespec = timeout.and_then(|d| {
Some(libc::timespec { // Overflows are rounded up to an infinite timeout (None).
// Sleep forever if the timeout is longer than fits in a timespec. let timespec = timeout
tv_sec: d.as_secs().try_into().ok()?, .and_then(|d| Timespec::zero().checked_add_duration(&d))
// This conversion never truncates, as subsec_nanos is always <1e9. .and_then(|t| t.to_timespec());
tv_nsec: d.subsec_nanos() as _,
})
});
let r = unsafe { let r = unsafe {
libc::futex( libc::futex(

View file

@ -51,7 +51,7 @@ impl fmt::Debug for SystemTime {
} }
impl Timespec { impl Timespec {
const fn zero() -> Timespec { pub const fn zero() -> Timespec {
Timespec { tv_sec: 0, tv_nsec: 0 } Timespec { tv_sec: 0, tv_nsec: 0 }
} }
@ -125,6 +125,7 @@ impl Timespec {
Some(Timespec::new(secs, nsec as i64)) Some(Timespec::new(secs, nsec as i64))
} }
#[allow(dead_code)]
pub fn to_timespec(&self) -> Option<libc::timespec> { pub fn to_timespec(&self) -> Option<libc::timespec> {
Some(libc::timespec { Some(libc::timespec {
tv_sec: self.tv_sec.try_into().ok()?, tv_sec: self.tv_sec.try_into().ok()?,

View file

@ -0,0 +1,58 @@
# `nvptx64-nvidia-cuda`
**Tier: 2**
This is the target meant for deploying code for Nvidia® accelerators based on their CUDA
platform.
## Target maintainers
- Riccardo D'Ambrosio, https://github.com/RDambrosio016
- Kjetil Kjeka, https://github.com/kjetilkjeka
<!-- FIXME: fill this out
## Requirements
Does the target support host tools, or only cross-compilation? Does the target
support std, or alloc (either with a default allocator, or if the user supplies
an allocator)?
Document the expectations of binaries built for the target. Do they assume
specific minimum features beyond the baseline of the CPU/environment/etc? What
version of the OS or environment do they expect?
Are there notable `#[target_feature(...)]` or `-C target-feature=` values that
programs may wish to use?
What calling convention does `extern "C"` use on the target?
What format do binaries use by default? ELF, PE, something else?
## Building the target
If Rust doesn't build the target by default, how can users build it? Can users
just add it to the `target` list in `config.toml`?
## Building Rust programs
Rust does not yet ship pre-compiled artifacts for this target. To compile for
this target, you will either need to build Rust with the target enabled (see
"Building the target" above), or build your own copy of `core` by using
`build-std` or similar.
## Testing
Does the target support running binaries, or do binaries have varying
expectations that prevent having a standard way to run them? If users can run
binaries, can they do so in some common emulator, or do they need native
hardware? Does the target support running the Rust testsuite?
## Cross-compilation toolchains and C code
Does the target support C code? If so, what toolchain target should users use
to build compatible C code? (This may match the target triple, or it may be a
toolchain for a different target triple, potentially with specific options or
caveats.)
-->

View file

@ -596,9 +596,11 @@ impl<'tcx> FormatRenderer<'tcx> for Context<'tcx> {
|buf: &mut Buffer| { |buf: &mut Buffer| {
write!( write!(
buf, buf,
"<script defer src=\"{}settings{}.js\"></script>", "<link rel=\"stylesheet\" type=\"text/css\" \
page.static_root_path.unwrap_or(""), href=\"{root_path}settings{suffix}.css\">\
page.resource_suffix <script defer src=\"{root_path}settings{suffix}.js\"></script>",
root_path = page.static_root_path.unwrap_or(""),
suffix = page.resource_suffix,
) )
}, },
&self.shared.style_files, &self.shared.style_files,

View file

@ -56,38 +56,6 @@
position: absolute; position: absolute;
} }
.select-wrapper {
float: right;
position: relative;
height: 27px;
min-width: 25%;
}
.select-wrapper select {
appearance: none;
-moz-appearance: none;
-webkit-appearance: none;
background: none;
border: 2px solid #ccc;
padding-right: 28px;
width: 100%;
}
.select-wrapper img {
pointer-events: none;
position: absolute;
right: 0;
bottom: 0;
background: #ccc;
height: 100%;
width: 28px;
padding: 0px 4px;
}
.select-wrapper select option {
color: initial;
}
.slider { .slider {
position: absolute; position: absolute;
cursor: pointer; cursor: pointer;
@ -96,7 +64,6 @@
right: 0; right: 0;
bottom: 0; bottom: 0;
background-color: #ccc; background-color: #ccc;
-webkit-transition: .3s;
transition: .3s; transition: .3s;
} }
@ -108,7 +75,6 @@
left: 4px; left: 4px;
bottom: 4px; bottom: 4px;
background-color: white; background-color: white;
-webkit-transition: .3s;
transition: .3s; transition: .3s;
} }
@ -121,8 +87,6 @@ input:focus + .slider {
} }
input:checked + .slider:before { input:checked + .slider:before {
-webkit-transform: translateX(19px);
-ms-transform: translateX(19px);
transform: translateX(19px); transform: translateX(19px);
} }

View file

@ -0,0 +1,35 @@
#![crate_type = "lib"]
use std::fmt::Debug;
pub trait Cache {
type V: Debug;
fn store_nocache(&self);
}
pub trait Query {
type V;
type C: Cache<V = Self::V>;
fn cache<T>(s: &T) -> &Self::C;
}
// EMIT_MIR dyn_trait.mk_cycle.Inline.diff
#[inline(always)]
pub fn mk_cycle<V: Debug>(c: &dyn Cache<V = V>) {
c.store_nocache()
}
// EMIT_MIR dyn_trait.try_execute_query.Inline.diff
#[inline(always)]
pub fn try_execute_query<C: Cache>(c: &C) {
mk_cycle(c)
}
// EMIT_MIR dyn_trait.get_query.Inline.diff
#[inline(always)]
pub fn get_query<Q: Query, T>(t: &T) {
let c = Q::cache(t);
try_execute_query(c)
}

View file

@ -0,0 +1,62 @@
- // MIR for `get_query` before Inline
+ // MIR for `get_query` after Inline
fn get_query(_1: &T) -> () {
debug t => _1; // in scope 0 at $DIR/dyn-trait.rs:32:31: 32:32
let mut _0: (); // return place in scope 0 at $DIR/dyn-trait.rs:32:38: 32:38
let _2: &<Q as Query>::C; // in scope 0 at $DIR/dyn-trait.rs:33:9: 33:10
let mut _3: &T; // in scope 0 at $DIR/dyn-trait.rs:33:22: 33:23
let mut _4: &<Q as Query>::C; // in scope 0 at $DIR/dyn-trait.rs:34:23: 34:24
scope 1 {
debug c => _2; // in scope 1 at $DIR/dyn-trait.rs:33:9: 33:10
+ scope 2 (inlined try_execute_query::<<Q as Query>::C>) { // at $DIR/dyn-trait.rs:34:5: 34:25
+ debug c => _4; // in scope 2 at $DIR/dyn-trait.rs:26:36: 26:37
+ let mut _5: &dyn Cache<V = <Q as Query>::V>; // in scope 2 at $DIR/dyn-trait.rs:27:14: 27:15
+ let mut _6: &<Q as Query>::C; // in scope 2 at $DIR/dyn-trait.rs:27:14: 27:15
+ scope 3 (inlined mk_cycle::<<Q as Query>::V>) { // at $DIR/dyn-trait.rs:27:5: 27:16
+ debug c => _5; // in scope 3 at $DIR/dyn-trait.rs:20:27: 20:28
+ let mut _7: &dyn Cache<V = <Q as Query>::V>; // in scope 3 at $DIR/dyn-trait.rs:21:5: 21:22
+ }
+ }
}
bb0: {
StorageLive(_2); // scope 0 at $DIR/dyn-trait.rs:33:9: 33:10
StorageLive(_3); // scope 0 at $DIR/dyn-trait.rs:33:22: 33:23
_3 = &(*_1); // scope 0 at $DIR/dyn-trait.rs:33:22: 33:23
_2 = <Q as Query>::cache::<T>(move _3) -> bb1; // scope 0 at $DIR/dyn-trait.rs:33:13: 33:24
// mir::Constant
// + span: $DIR/dyn-trait.rs:33:13: 33:21
// + user_ty: UserType(0)
// + literal: Const { ty: for<'r> fn(&'r T) -> &'r <Q as Query>::C {<Q as Query>::cache::<T>}, val: Value(Scalar(<ZST>)) }
}
bb1: {
StorageDead(_3); // scope 0 at $DIR/dyn-trait.rs:33:23: 33:24
StorageLive(_4); // scope 1 at $DIR/dyn-trait.rs:34:23: 34:24
_4 = &(*_2); // scope 1 at $DIR/dyn-trait.rs:34:23: 34:24
- _0 = try_execute_query::<<Q as Query>::C>(move _4) -> bb2; // scope 1 at $DIR/dyn-trait.rs:34:5: 34:25
+ StorageLive(_5); // scope 2 at $DIR/dyn-trait.rs:27:14: 27:15
+ StorageLive(_6); // scope 2 at $DIR/dyn-trait.rs:27:14: 27:15
+ _6 = _4; // scope 2 at $DIR/dyn-trait.rs:27:14: 27:15
+ _5 = move _6 as &dyn Cache<V = <Q as Query>::V> (Pointer(Unsize)); // scope 2 at $DIR/dyn-trait.rs:27:14: 27:15
+ StorageDead(_6); // scope 2 at $DIR/dyn-trait.rs:27:14: 27:15
+ StorageLive(_7); // scope 3 at $DIR/dyn-trait.rs:21:5: 21:22
+ _7 = _5; // scope 3 at $DIR/dyn-trait.rs:21:5: 21:22
+ _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
// mir::Constant
- // + span: $DIR/dyn-trait.rs:34:5: 34:22
- // + literal: Const { ty: for<'r> fn(&'r <Q as Query>::C) {try_execute_query::<<Q as Query>::C>}, val: Value(Scalar(<ZST>)) }
+ // + span: $DIR/dyn-trait.rs:21:7: 21:20
+ // + 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>)) }
}
bb2: {
+ StorageDead(_7); // scope 3 at $DIR/dyn-trait.rs:21:21: 21:22
+ StorageDead(_5); // scope 2 at $DIR/dyn-trait.rs:27:15: 27:16
StorageDead(_4); // scope 1 at $DIR/dyn-trait.rs:34:24: 34:25
StorageDead(_2); // scope 0 at $DIR/dyn-trait.rs:35:1: 35:2
return; // scope 0 at $DIR/dyn-trait.rs:35:2: 35:2
}
}

View file

@ -0,0 +1,23 @@
- // MIR for `mk_cycle` before Inline
+ // MIR for `mk_cycle` after Inline
fn mk_cycle(_1: &dyn Cache<V = V>) -> () {
debug c => _1; // in scope 0 at $DIR/dyn-trait.rs:20:27: 20:28
let mut _0: (); // return place in scope 0 at $DIR/dyn-trait.rs:20:49: 20:49
let mut _2: &dyn Cache<V = V>; // in scope 0 at $DIR/dyn-trait.rs:21:5: 21:22
bb0: {
StorageLive(_2); // scope 0 at $DIR/dyn-trait.rs:21:5: 21:22
_2 = &(*_1); // scope 0 at $DIR/dyn-trait.rs:21:5: 21:22
_0 = <dyn Cache<V = V> as Cache>::store_nocache(move _2) -> bb1; // scope 0 at $DIR/dyn-trait.rs:21:5: 21:22
// mir::Constant
// + span: $DIR/dyn-trait.rs:21:7: 21:20
// + literal: Const { ty: for<'r> fn(&'r dyn Cache<V = V>) {<dyn Cache<V = V> as Cache>::store_nocache}, val: Value(Scalar(<ZST>)) }
}
bb1: {
StorageDead(_2); // scope 0 at $DIR/dyn-trait.rs:21:21: 21:22
return; // scope 0 at $DIR/dyn-trait.rs:22:2: 22:2
}
}

View file

@ -0,0 +1,37 @@
- // MIR for `try_execute_query` before Inline
+ // MIR for `try_execute_query` after Inline
fn try_execute_query(_1: &C) -> () {
debug c => _1; // in scope 0 at $DIR/dyn-trait.rs:26:36: 26:37
let mut _0: (); // return place in scope 0 at $DIR/dyn-trait.rs:26:43: 26:43
let mut _2: &dyn Cache<V = <C as Cache>::V>; // in scope 0 at $DIR/dyn-trait.rs:27:14: 27:15
let mut _3: &C; // in scope 0 at $DIR/dyn-trait.rs:27:14: 27:15
+ scope 1 (inlined mk_cycle::<<C as Cache>::V>) { // at $DIR/dyn-trait.rs:27:5: 27:16
+ debug c => _2; // in scope 1 at $DIR/dyn-trait.rs:20:27: 20:28
+ let mut _4: &dyn Cache<V = <C as Cache>::V>; // in scope 1 at $DIR/dyn-trait.rs:21:5: 21:22
+ }
bb0: {
StorageLive(_2); // scope 0 at $DIR/dyn-trait.rs:27:14: 27:15
StorageLive(_3); // scope 0 at $DIR/dyn-trait.rs:27:14: 27:15
_3 = &(*_1); // scope 0 at $DIR/dyn-trait.rs:27:14: 27:15
_2 = move _3 as &dyn Cache<V = <C as Cache>::V> (Pointer(Unsize)); // scope 0 at $DIR/dyn-trait.rs:27:14: 27:15
StorageDead(_3); // scope 0 at $DIR/dyn-trait.rs:27:14: 27:15
- _0 = mk_cycle::<<C as Cache>::V>(move _2) -> bb1; // scope 0 at $DIR/dyn-trait.rs:27:5: 27:16
+ StorageLive(_4); // scope 1 at $DIR/dyn-trait.rs:21:5: 21:22
+ _4 = _2; // scope 1 at $DIR/dyn-trait.rs:21:5: 21:22
+ _0 = <dyn Cache<V = <C as Cache>::V> as Cache>::store_nocache(move _4) -> bb1; // scope 1 at $DIR/dyn-trait.rs:21:5: 21:22
// mir::Constant
- // + span: $DIR/dyn-trait.rs:27:5: 27:13
- // + literal: Const { ty: for<'r> fn(&'r (dyn Cache<V = <C as Cache>::V> + 'r)) {mk_cycle::<<C as Cache>::V>}, val: Value(Scalar(<ZST>)) }
+ // + span: $DIR/dyn-trait.rs:21:7: 21:20
+ // + literal: Const { ty: for<'r> fn(&'r dyn Cache<V = <C as Cache>::V>) {<dyn Cache<V = <C as Cache>::V> as Cache>::store_nocache}, val: Value(Scalar(<ZST>)) }
}
bb1: {
+ StorageDead(_4); // scope 1 at $DIR/dyn-trait.rs:21:21: 21:22
StorageDead(_2); // scope 0 at $DIR/dyn-trait.rs:27:15: 27:16
return; // scope 0 at $DIR/dyn-trait.rs:28:2: 28:2
}
}

View file

@ -65,3 +65,8 @@ assert: ".setting-line.hidden #theme"
// We check their text as well. // We check their text as well.
assert-text: ("#preferred-dark-theme .setting-name", "Preferred dark theme") assert-text: ("#preferred-dark-theme .setting-name", "Preferred dark theme")
assert-text: ("#preferred-light-theme .setting-name", "Preferred light theme") assert-text: ("#preferred-light-theme .setting-name", "Preferred light theme")
// Now we go to the settings page to check that the CSS is loaded as expected.
goto: file://|DOC_PATH|/settings.html
wait-for: "#settings"
assert-css: (".setting-line .toggle", {"width": "45px", "margin-right": "20px"})

View file

@ -0,0 +1,24 @@
// check-pass
#![feature(generic_const_exprs)]
#![allow(incomplete_features)]
pub trait First {
const CONST: usize;
}
pub trait Second {}
impl<'a> First for dyn Second
where
&'a Self: First,
{
const CONST: usize = <&Self>::CONST;
}
trait Third: First
where
[u8; Self::CONST]:
{
const VAL: [u8; Self::CONST] = [0; Self::CONST];
}
fn main() {}

View file

@ -1,4 +1,6 @@
// build-pass // build-pass
// compiler-opts: -Zmir-opt-level=2
#![allow(dead_code)] #![allow(dead_code)]
trait Foo { trait Foo {
fn foo(&self); fn foo(&self);

View file

@ -0,0 +1,46 @@
warning: trait bound for<'any> &'any mut (): Clone does not depend on any type or lifetime parameters
--> $DIR/issue-73021-impossible-inline.rs:20:29
|
LL | for<'any> &'any mut (): Clone,
| ^^^^^
|
= note: `#[warn(trivial_bounds)]` on by default
warning: trait bound i32: Foo does not depend on any type or lifetime parameters
--> $DIR/issue-73021-impossible-inline.rs:28:21
|
LL | struct S where i32: Foo;
| ^^^
warning: trait bound i32: Foo does not depend on any type or lifetime parameters
--> $DIR/issue-73021-impossible-inline.rs:31:28
|
LL | impl Foo for () where i32: Foo {
| ^^^
warning: trait bound i32: Foo does not depend on any type or lifetime parameters
--> $DIR/issue-73021-impossible-inline.rs:40:19
|
LL | fn f() where i32: Foo {
| ^^^
warning: trait bound &'static str: Foo does not depend on any type or lifetime parameters
--> $DIR/issue-73021-impossible-inline.rs:48:28
|
LL | fn g() where &'static str: Foo {
| ^^^
warning: trait bound String: Neg does not depend on any type or lifetime parameters
--> $DIR/issue-73021-impossible-inline.rs:57:13
|
LL | String: ::std::ops::Neg<Output = String>,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
warning: trait bound i32: Iterator does not depend on any type or lifetime parameters
--> $DIR/issue-73021-impossible-inline.rs:65:10
|
LL | i32: Iterator,
| ^^^^^^^^
warning: 7 warnings emitted

View file

@ -0,0 +1,46 @@
warning: trait bound for<'any> &'any mut (): Clone does not depend on any type or lifetime parameters
--> $DIR/issue-73021-impossible-inline.rs:20:29
|
LL | for<'any> &'any mut (): Clone,
| ^^^^^
|
= note: `#[warn(trivial_bounds)]` on by default
warning: trait bound i32: Foo does not depend on any type or lifetime parameters
--> $DIR/issue-73021-impossible-inline.rs:28:21
|
LL | struct S where i32: Foo;
| ^^^
warning: trait bound i32: Foo does not depend on any type or lifetime parameters
--> $DIR/issue-73021-impossible-inline.rs:31:28
|
LL | impl Foo for () where i32: Foo {
| ^^^
warning: trait bound i32: Foo does not depend on any type or lifetime parameters
--> $DIR/issue-73021-impossible-inline.rs:40:19
|
LL | fn f() where i32: Foo {
| ^^^
warning: trait bound &'static str: Foo does not depend on any type or lifetime parameters
--> $DIR/issue-73021-impossible-inline.rs:48:28
|
LL | fn g() where &'static str: Foo {
| ^^^
warning: trait bound String: Neg does not depend on any type or lifetime parameters
--> $DIR/issue-73021-impossible-inline.rs:57:13
|
LL | String: ::std::ops::Neg<Output = String>,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
warning: trait bound i32: Iterator does not depend on any type or lifetime parameters
--> $DIR/issue-73021-impossible-inline.rs:65:10
|
LL | i32: Iterator,
| ^^^^^^^^
warning: 7 warnings emitted

View file

@ -0,0 +1,71 @@
// build-pass
// revisions: no-opt inline
// [inline]compile-flags: -Zmir-opt-level=3 --emit=mir
#![feature(trivial_bounds)]
#![allow(unused)]
trait Foo {
fn test(&self);
}
fn foo<'a>(s: &'a mut ())
where
&'a mut (): Foo,
{
s.test();
}
fn clone(it: &mut ()) -> &mut ()
where
for<'any> &'any mut (): Clone,
//~^ WARN trait bound for<'any> &'any mut (): Clone does not depend on any type or lifetime parameters
{
it.clone()
}
fn generic_function<X: Foo>(x: X) {}
struct S where i32: Foo;
//~^ WARN trait bound i32: Foo does not depend on any type or lifetime parameters
impl Foo for () where i32: Foo {
//~^ WARN trait bound i32: Foo does not depend on any type or lifetime parameters
fn test(&self) {
3i32.test();
Foo::test(&4i32);
generic_function(5i32);
}
}
fn f() where i32: Foo {
//~^ WARN trait bound i32: Foo does not depend on any type or lifetime parameters
let s = S;
3i32.test();
Foo::test(&4i32);
generic_function(5i32);
}
fn g() where &'static str: Foo {
//~^ WARN trait bound &'static str: Foo does not depend on any type or lifetime parameters
"Foo".test();
Foo::test(&"Foo");
generic_function("Foo");
}
fn use_op(s: String) -> String
where
String: ::std::ops::Neg<Output = String>,
//~^ WARN trait bound String: Neg does not depend on any type or lifetime parameters
{
-s
}
fn use_for()
where
i32: Iterator,
//~^ WARN trait bound i32: Iterator does not depend on any type or lifetime parameters
{
for _ in 2i32 {}
}
fn main() {}