-
Notifications
You must be signed in to change notification settings - Fork 13k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #44888 - tirr-c:binder-hr-region, r=arielb1
Refactor fmt::Display and fmt::Debug impls in ppaux Also fixes #44887. There was a problem that unnamed late-bound regions are *always* named `'r` while they are displayed using `std::fmt::Display`. --- ```rust fn main() { f(|_: (), _: ()| {}); } fn f<F>(_: F) where F: Fn(&(), for<'r> fn(&'r ())) {} ``` Before (incorrectly shadows lifetime, `for<'r>` omitted for the second argument): ``` error[E0631]: type mismatch in closure arguments --> test.rs:2:5 | 2 | f(|_: (), _: ()| {}); | ^ ----------------- found signature of `fn((), ()) -> _` | | | expected signature of `for<'r> fn(&'r (), fn(&'r ())) -> _` | = note: required by `f` ``` After: ``` error[E0631]: type mismatch in closure arguments --> test.rs:2:5 | 2 | f(|_: (), _: ()| {}); | ^ ----------------- found signature of `fn((), ()) -> _` | | | expected signature of `for<'s> fn(&'s (), for<'r> fn(&'r ())) -> _` | = note: required by `f` ``` r? @nikomatsakis
- Loading branch information
Showing
13 changed files
with
1,180 additions
and
807 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT | ||
// file at the top-level directory of this distribution and at | ||
// http://rust-lang.org/COPYRIGHT. | ||
// | ||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or | ||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license | ||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your | ||
// option. This file may not be copied, modified, or distributed | ||
// except according to those terms. | ||
|
||
fn main() { | ||
f1(|_: (), _: ()| {}); | ||
f2(|_: (), _: ()| {}); | ||
f3(|_: (), _: ()| {}); | ||
f4(|_: (), _: ()| {}); | ||
f5(|_: (), _: ()| {}); | ||
g1(|_: (), _: ()| {}); | ||
g2(|_: (), _: ()| {}); | ||
g3(|_: (), _: ()| {}); | ||
g4(|_: (), _: ()| {}); | ||
h1(|_: (), _: (), _: (), _: ()| {}); | ||
h2(|_: (), _: (), _: (), _: ()| {}); | ||
} | ||
|
||
// Basic | ||
fn f1<F>(_: F) where F: Fn(&(), &()) {} | ||
fn f2<F>(_: F) where F: for<'a> Fn(&'a (), &()) {} | ||
fn f3<'a, F>(_: F) where F: Fn(&'a (), &()) {} | ||
fn f4<F>(_: F) where F: for<'r> Fn(&(), &'r ()) {} | ||
fn f5<F>(_: F) where F: for<'r> Fn(&'r (), &'r ()) {} | ||
|
||
// Nested | ||
fn g1<F>(_: F) where F: Fn(&(), Box<Fn(&())>) {} | ||
fn g2<F>(_: F) where F: Fn(&(), fn(&())) {} | ||
fn g3<F>(_: F) where F: for<'s> Fn(&'s (), Box<Fn(&())>) {} | ||
fn g4<F>(_: F) where F: Fn(&(), for<'r> fn(&'r ())) {} | ||
|
||
// Mixed | ||
fn h1<F>(_: F) where F: Fn(&(), Box<Fn(&())>, &(), fn(&(), &())) {} | ||
fn h2<F>(_: F) where F: for<'t0> Fn(&(), Box<Fn(&())>, &'t0 (), fn(&(), &())) {} |
Oops, something went wrong.