Skip to content

Commit 7f01f03

Browse files
committed
Auto merge of #113038 - matthiaskrgr:rollup-sdcfkxa, r=matthiaskrgr
Rollup of 5 pull requests Successful merges: - #112976 (Add test for futures with HRTB) - #113013 (rustdoc: get rid of extra line when line-wrapping fn decls with empty arg list) - #113030 (Add a regression test for #109071) - #113031 (Add a regression test for #110933) - #113036 (Accept `ReStatic` for RPITIT) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 8084f39 + 6c75757 commit 7f01f03

File tree

11 files changed

+171
-2
lines changed

11 files changed

+171
-2
lines changed

compiler/rustc_hir_analysis/src/check/wfcheck.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1549,7 +1549,7 @@ impl<'tcx> TypeVisitor<TyCtxt<'tcx>> for ImplTraitInTraitFinder<'_, 'tcx> {
15491549
{
15501550
let opaque_ty = tcx.fold_regions(unshifted_opaque_ty, |re, _depth| {
15511551
match re.kind() {
1552-
ty::ReEarlyBound(_) | ty::ReFree(_) | ty::ReError(_) => re,
1552+
ty::ReEarlyBound(_) | ty::ReFree(_) | ty::ReError(_) | ty::ReStatic => re,
15531553
r => bug!("unexpected region: {r:?}"),
15541554
}
15551555
});

src/librustdoc/html/format.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1408,7 +1408,7 @@ impl clean::FnDecl {
14081408
let amp = if f.alternate() { "&" } else { "&amp;" };
14091409

14101410
write!(f, "(")?;
1411-
if let Some(n) = line_wrapping_indent {
1411+
if let Some(n) = line_wrapping_indent && !self.inputs.values.is_empty() {
14121412
write!(f, "\n{}", Indent(n + 4))?;
14131413
}
14141414
for (i, input) in self.inputs.values.iter().enumerate() {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<pre class="rust item-decl"><code>pub fn create(
2+
) -&gt; <a class="struct" href="struct.Padding00000000000000000000000000000000000000000000000000000000000000000000000000000000.html" title="struct decl_line_wrapping_empty_arg_list::Padding00000000000000000000000000000000000000000000000000000000000000000000000000000000">Padding00000000000000000000000000000000000000000000000000000000000000000000000000000000</a></code></pre>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// Ensure that we don't add an extra line containing nothing but whitespace in between the two
2+
// parentheses of an empty argument list when line-wrapping a function declaration.
3+
4+
// ignore-tidy-linelength
5+
6+
pub struct Padding00000000000000000000000000000000000000000000000000000000000000000000000000000000;
7+
8+
// @has 'decl_line_wrapping_empty_arg_list/fn.create.html'
9+
// @snapshot decl - '//pre[@class="rust item-decl"]'
10+
pub fn create() -> Padding00000000000000000000000000000000000000000000000000000000000000000000000000000000 {
11+
loop {}
12+
}
+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// check-pass
2+
3+
#![feature(associated_const_equality)]
4+
5+
pub trait Trait {
6+
const ASSOC: usize;
7+
}
8+
9+
pub fn foo<
10+
T: Trait<
11+
ASSOC = {
12+
let a = 10_usize;
13+
let b: &'_ usize = &a;
14+
*b
15+
},
16+
>,
17+
>() {
18+
}
19+
20+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
error[E0637]: `&` without an explicit lifetime name cannot be used here
2+
--> $DIR/issue-109071.rs:8:17
3+
|
4+
LL | type Item = &[T];
5+
| ^ explicit lifetime name needed here
6+
7+
error[E0107]: missing generics for struct `Windows`
8+
--> $DIR/issue-109071.rs:7:9
9+
|
10+
LL | impl<T> Windows {
11+
| ^^^^^^^ expected 1 generic argument
12+
|
13+
note: struct defined here, with 1 generic parameter: `T`
14+
--> $DIR/issue-109071.rs:5:8
15+
|
16+
LL | struct Windows<T> {}
17+
| ^^^^^^^ -
18+
help: add missing generic argument
19+
|
20+
LL | impl<T> Windows<T> {
21+
| +++
22+
23+
error[E0658]: inherent associated types are unstable
24+
--> $DIR/issue-109071.rs:8:5
25+
|
26+
LL | type Item = &[T];
27+
| ^^^^^^^^^^^^^^^^^
28+
|
29+
= note: see issue #8995 <https://github.com/rust-lang/rust/issues/8995> for more information
30+
= help: add `#![feature(inherent_associated_types)]` to the crate attributes to enable
31+
32+
error: aborting due to 3 previous errors
33+
34+
Some errors have detailed explanations: E0107, E0637, E0658.
35+
For more information about an error, try `rustc --explain E0107`.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// revisions: with_gate no_gate
2+
#![cfg_attr(with_gate, feature(inherent_associated_types))]
3+
#![cfg_attr(with_gate, allow(incomplete_features))]
4+
5+
struct Windows<T> {}
6+
7+
impl<T> Windows { //~ ERROR: missing generics for struct `Windows`
8+
type Item = &[T]; //~ ERROR: `&` without an explicit lifetime name cannot be used here
9+
//[no_gate]~^ ERROR: inherent associated types are unstable
10+
11+
fn next() -> Option<Self::Item> {}
12+
}
13+
14+
impl<T> Windows<T> {
15+
fn T() -> Option<Self::Item> {}
16+
}
17+
18+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
error[E0637]: `&` without an explicit lifetime name cannot be used here
2+
--> $DIR/issue-109071.rs:8:17
3+
|
4+
LL | type Item = &[T];
5+
| ^ explicit lifetime name needed here
6+
7+
error[E0107]: missing generics for struct `Windows`
8+
--> $DIR/issue-109071.rs:7:9
9+
|
10+
LL | impl<T> Windows {
11+
| ^^^^^^^ expected 1 generic argument
12+
|
13+
note: struct defined here, with 1 generic parameter: `T`
14+
--> $DIR/issue-109071.rs:5:8
15+
|
16+
LL | struct Windows<T> {}
17+
| ^^^^^^^ -
18+
help: add missing generic argument
19+
|
20+
LL | impl<T> Windows<T> {
21+
| +++
22+
23+
error: aborting due to 2 previous errors
24+
25+
Some errors have detailed explanations: E0107, E0637.
26+
For more information about an error, try `rustc --explain E0107`.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
error: the compiler unexpectedly panicked. this is a bug.
2+
3+
query stack during panic:
4+
#0 [evaluate_obligation] evaluating trait selection obligation `for<'a> [async fn body@$DIR/future.rs:32:35: 34:2]: core::future::future::Future`
5+
#1 [codegen_select_candidate] computing candidate for `<strlen as Trait>`
6+
end of query stack
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
// ignore-tidy-linelength
2+
// edition:2021
3+
// revisions: classic next
4+
//[next] compile-flags: -Ztrait-solver=next
5+
//[next] check-pass
6+
//[classic] known-bug: #112347
7+
//[classic] build-fail
8+
//[classic] failure-status: 101
9+
//[classic] normalize-stderr-test "note: .*\n\n" -> ""
10+
//[classic] normalize-stderr-test "thread 'rustc' panicked.*\n" -> ""
11+
//[classic] normalize-stderr-test "(error: internal compiler error: [^:]+):\d+:\d+: " -> "$1:LL:CC: "
12+
//[classic] rustc-env:RUST_BACKTRACE=0
13+
14+
#![feature(unboxed_closures)]
15+
16+
use std::future::Future;
17+
18+
trait Trait {
19+
fn func(&self, _: &str);
20+
}
21+
22+
impl<T> Trait for T
23+
where
24+
for<'a> T: Fn<(&'a str,)> + Send + Sync,
25+
for<'a> <T as FnOnce<(&'a str,)>>::Output: Future<Output = usize> + Send,
26+
{
27+
fn func(&self, _: &str) {
28+
println!("hello!");
29+
}
30+
}
31+
32+
async fn strlen(x: &str) -> usize {
33+
x.len()
34+
}
35+
36+
fn main() {
37+
strlen.func("hi");
38+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// check-pass
2+
3+
#![allow(incomplete_features)]
4+
#![feature(adt_const_params, return_position_impl_trait_in_trait)]
5+
6+
pub struct Element;
7+
8+
pub trait Node {
9+
fn elements<const T: &'static str>(&self) -> impl Iterator<Item = Element>;
10+
}
11+
12+
fn main() {}

0 commit comments

Comments
 (0)