Skip to content

Commit 83beb0a

Browse files
committed
Auto merge of #68546 - JohnTitor:rollup-znuot4b, r=JohnTitor
Rollup of 5 pull requests Successful merges: - #68485 (add a test for #60976) - #68498 (Add some type-alias-impl-trait regression tests) - #68514 (Use Self instead of self return type) - #68534 (Update submodules to rust-lang) - #68540 (clean up error codes E0229 and E0261) Failed merges: r? @ghost
2 parents 6d3f4e0 + 5774dd0 commit 83beb0a

File tree

9 files changed

+109
-17
lines changed

9 files changed

+109
-17
lines changed

.gitmodules

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@
1515
url = https://github.com/rust-lang/book.git
1616
[submodule "src/tools/rls"]
1717
path = src/tools/rls
18-
url = https://github.com/rust-lang-nursery/rls.git
18+
url = https://github.com/rust-lang/rls.git
1919
[submodule "src/tools/clippy"]
2020
path = src/tools/clippy
21-
url = https://github.com/rust-lang-nursery/rust-clippy.git
21+
url = https://github.com/rust-lang/rust-clippy.git
2222
[submodule "src/tools/rustfmt"]
2323
path = src/tools/rustfmt
24-
url = https://github.com/rust-lang-nursery/rustfmt.git
24+
url = https://github.com/rust-lang/rustfmt.git
2525
[submodule "src/tools/miri"]
2626
path = src/tools/miri
2727
url = https://github.com/rust-lang/miri.git

src/libcore/fmt/builders.rs

+10-10
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ impl<'a, 'b: 'a> DebugStruct<'a, 'b> {
133133
/// );
134134
/// ```
135135
#[stable(feature = "debug_builders", since = "1.2.0")]
136-
pub fn field(&mut self, name: &str, value: &dyn fmt::Debug) -> &mut DebugStruct<'a, 'b> {
136+
pub fn field(&mut self, name: &str, value: &dyn fmt::Debug) -> &mut Self {
137137
self.result = self.result.and_then(|_| {
138138
if self.is_pretty() {
139139
if !self.has_fields {
@@ -330,7 +330,7 @@ impl<'a, 'b: 'a> DebugTuple<'a, 'b> {
330330
/// );
331331
/// ```
332332
#[stable(feature = "debug_builders", since = "1.2.0")]
333-
pub fn field(&mut self, value: &dyn fmt::Debug) -> &mut DebugTuple<'a, 'b> {
333+
pub fn field(&mut self, value: &dyn fmt::Debug) -> &mut Self {
334334
self.result = self.result.and_then(|_| {
335335
if self.is_pretty() {
336336
if self.fields == 0 {
@@ -492,7 +492,7 @@ impl<'a, 'b: 'a> DebugSet<'a, 'b> {
492492
/// );
493493
/// ```
494494
#[stable(feature = "debug_builders", since = "1.2.0")]
495-
pub fn entry(&mut self, entry: &dyn fmt::Debug) -> &mut DebugSet<'a, 'b> {
495+
pub fn entry(&mut self, entry: &dyn fmt::Debug) -> &mut Self {
496496
self.inner.entry(entry);
497497
self
498498
}
@@ -521,7 +521,7 @@ impl<'a, 'b: 'a> DebugSet<'a, 'b> {
521521
/// );
522522
/// ```
523523
#[stable(feature = "debug_builders", since = "1.2.0")]
524-
pub fn entries<D, I>(&mut self, entries: I) -> &mut DebugSet<'a, 'b>
524+
pub fn entries<D, I>(&mut self, entries: I) -> &mut Self
525525
where
526526
D: fmt::Debug,
527527
I: IntoIterator<Item = D>,
@@ -624,7 +624,7 @@ impl<'a, 'b: 'a> DebugList<'a, 'b> {
624624
/// );
625625
/// ```
626626
#[stable(feature = "debug_builders", since = "1.2.0")]
627-
pub fn entry(&mut self, entry: &dyn fmt::Debug) -> &mut DebugList<'a, 'b> {
627+
pub fn entry(&mut self, entry: &dyn fmt::Debug) -> &mut Self {
628628
self.inner.entry(entry);
629629
self
630630
}
@@ -653,7 +653,7 @@ impl<'a, 'b: 'a> DebugList<'a, 'b> {
653653
/// );
654654
/// ```
655655
#[stable(feature = "debug_builders", since = "1.2.0")]
656-
pub fn entries<D, I>(&mut self, entries: I) -> &mut DebugList<'a, 'b>
656+
pub fn entries<D, I>(&mut self, entries: I) -> &mut Self
657657
where
658658
D: fmt::Debug,
659659
I: IntoIterator<Item = D>,
@@ -760,7 +760,7 @@ impl<'a, 'b: 'a> DebugMap<'a, 'b> {
760760
/// );
761761
/// ```
762762
#[stable(feature = "debug_builders", since = "1.2.0")]
763-
pub fn entry(&mut self, key: &dyn fmt::Debug, value: &dyn fmt::Debug) -> &mut DebugMap<'a, 'b> {
763+
pub fn entry(&mut self, key: &dyn fmt::Debug, value: &dyn fmt::Debug) -> &mut Self {
764764
self.key(key).value(value)
765765
}
766766

@@ -797,7 +797,7 @@ impl<'a, 'b: 'a> DebugMap<'a, 'b> {
797797
/// );
798798
/// ```
799799
#[unstable(feature = "debug_map_key_value", reason = "recently added", issue = "62482")]
800-
pub fn key(&mut self, key: &dyn fmt::Debug) -> &mut DebugMap<'a, 'b> {
800+
pub fn key(&mut self, key: &dyn fmt::Debug) -> &mut Self {
801801
self.result = self.result.and_then(|_| {
802802
assert!(
803803
!self.has_key,
@@ -862,7 +862,7 @@ impl<'a, 'b: 'a> DebugMap<'a, 'b> {
862862
/// );
863863
/// ```
864864
#[unstable(feature = "debug_map_key_value", reason = "recently added", issue = "62482")]
865-
pub fn value(&mut self, value: &dyn fmt::Debug) -> &mut DebugMap<'a, 'b> {
865+
pub fn value(&mut self, value: &dyn fmt::Debug) -> &mut Self {
866866
self.result = self.result.and_then(|_| {
867867
assert!(self.has_key, "attempted to format a map value before its key");
868868

@@ -908,7 +908,7 @@ impl<'a, 'b: 'a> DebugMap<'a, 'b> {
908908
/// );
909909
/// ```
910910
#[stable(feature = "debug_builders", since = "1.2.0")]
911-
pub fn entries<K, V, I>(&mut self, entries: I) -> &mut DebugMap<'a, 'b>
911+
pub fn entries<K, V, I>(&mut self, entries: I) -> &mut Self
912912
where
913913
K: fmt::Debug,
914914
V: fmt::Debug,

src/librustc_error_codes/error_codes/E0229.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
An associated type binding was done outside of the type parameter declaration
2-
and `where` clause. Erroneous code example:
2+
and `where` clause.
3+
4+
Erroneous code example:
35

46
```compile_fail,E0229
57
pub trait Foo {

src/librustc_error_codes/error_codes/E0261.md

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
When using a lifetime like `'a` in a type, it must be declared before being
2-
used.
1+
An undeclared lifetime was used.
32

4-
These two examples illustrate the problem:
3+
Erroneous code example:
54

65
```compile_fail,E0261
76
// error, use of undeclared lifetime name `'a`
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// Regression test for issue #57611
2+
// Ensures that we don't ICE
3+
// FIXME: This should compile, but it currently doesn't
4+
5+
#![feature(trait_alias)]
6+
#![feature(type_alias_impl_trait)]
7+
8+
trait Foo {
9+
type Bar: Baz<Self, Self>;
10+
11+
fn bar(&self) -> Self::Bar;
12+
}
13+
14+
struct X;
15+
16+
impl Foo for X {
17+
type Bar = impl Baz<Self, Self>; //~ ERROR type mismatch in closure arguments
18+
//~^ ERROR type mismatch resolving
19+
20+
fn bar(&self) -> Self::Bar {
21+
|x| x
22+
}
23+
}
24+
25+
trait Baz<A, B> = Fn(&A) -> &B;
26+
27+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
error[E0631]: type mismatch in closure arguments
2+
--> $DIR/issue-57611-trait-alias.rs:17:5
3+
|
4+
LL | type Bar = impl Baz<Self, Self>;
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected signature of `for<'r> fn(&'r X) -> _`
6+
...
7+
LL | |x| x
8+
| ----- found signature of `fn(_) -> _`
9+
|
10+
= note: the return type of a function must have a statically known size
11+
12+
error[E0271]: type mismatch resolving `for<'r> <[closure@$DIR/issue-57611-trait-alias.rs:21:9: 21:14] as std::ops::FnOnce<(&'r X,)>>::Output == &'r X`
13+
--> $DIR/issue-57611-trait-alias.rs:17:5
14+
|
15+
LL | type Bar = impl Baz<Self, Self>;
16+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected bound lifetime parameter, found concrete lifetime
17+
|
18+
= note: the return type of a function must have a statically known size
19+
20+
error: aborting due to 2 previous errors
21+
22+
Some errors have detailed explanations: E0271, E0631.
23+
For more information about an error, try `rustc --explain E0271`.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
// Regression test for issue #57807 - ensure
2+
// that we properly unify associated types within
3+
// a type alias impl trait
4+
// check-pass
5+
#![feature(type_alias_impl_trait)]
6+
7+
trait Bar {
8+
type A;
9+
}
10+
11+
impl Bar for () {
12+
type A = ();
13+
}
14+
15+
trait Foo {
16+
type A;
17+
type B: Bar<A = Self::A>;
18+
19+
fn foo() -> Self::B;
20+
}
21+
22+
impl Foo for () {
23+
type A = ();
24+
type B = impl Bar<A = Self::A>;
25+
26+
fn foo() -> Self::B {
27+
()
28+
}
29+
}
30+
31+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// compile-flags: --edition=2018
2+
3+
pub use u32;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// Regression test for #60976: ICE (with <=1.36.0) when another file had `use <primitive_type>;`.
2+
// check-pass
3+
// aux-build:extern-use-primitive-type-lib.rs
4+
5+
extern crate extern_use_primitive_type_lib;
6+
7+
fn main() {}

0 commit comments

Comments
 (0)