forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 7
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 rust-lang#97013 - matthiaskrgr:rollup-c1pc6pc, r=matthi…
…askrgr Rollup of 5 pull requests Successful merges: - rust-lang#96154 (Expand core::hint::unreachable_unchecked() docs) - rust-lang#96615 (Add a regression test for rust-lang#54779) - rust-lang#96982 (fix clippy expect_fun_call) - rust-lang#97003 (Remove some unnecessary `rustc_allow_const_fn_unstable` attributes.) - rust-lang#97011 (Add regression test for rust-lang#28935) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
- Loading branch information
Showing
11 changed files
with
140 additions
and
26 deletions.
There are no files selected for viewing
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,9 @@ | ||
// check-pass | ||
|
||
use std::cell::RefCell; | ||
|
||
pub fn f(v: Vec<RefCell<u8>>) { | ||
let _t = &mut *v[0].borrow_mut(); | ||
} | ||
|
||
fn main() {} |
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,51 @@ | ||
// Regression test for #54779, checks if the diagnostics are confusing. | ||
|
||
#![feature(nll)] | ||
|
||
trait DebugWith<Cx: ?Sized> { | ||
fn debug_with<'me>(&'me self, cx: &'me Cx) -> DebugCxPair<'me, Self, Cx> { | ||
DebugCxPair { value: self, cx } | ||
} | ||
|
||
fn fmt_with(&self, cx: &Cx, fmt: &mut std::fmt::Formatter<'_>) -> std::fmt::Result; | ||
} | ||
|
||
struct DebugCxPair<'me, Value: ?Sized, Cx: ?Sized> | ||
where | ||
Value: DebugWith<Cx>, | ||
{ | ||
value: &'me Value, | ||
cx: &'me Cx, | ||
} | ||
|
||
trait DebugContext {} | ||
|
||
struct Foo { | ||
bar: Bar, | ||
} | ||
|
||
impl DebugWith<dyn DebugContext> for Foo { | ||
fn fmt_with( | ||
&self, | ||
cx: &dyn DebugContext, | ||
fmt: &mut std::fmt::Formatter<'_>, | ||
) -> std::fmt::Result { | ||
let Foo { bar } = self; | ||
bar.debug_with(cx); //~ ERROR: lifetime may not live long enough | ||
Ok(()) | ||
} | ||
} | ||
|
||
struct Bar {} | ||
|
||
impl DebugWith<dyn DebugContext> for Bar { | ||
fn fmt_with( | ||
&self, | ||
cx: &dyn DebugContext, | ||
fmt: &mut std::fmt::Formatter<'_>, | ||
) -> std::fmt::Result { | ||
Ok(()) | ||
} | ||
} | ||
|
||
fn main() {} |
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,11 @@ | ||
error: lifetime may not live long enough | ||
--> $DIR/issue-54779-anon-static-lifetime.rs:34:24 | ||
| | ||
LL | cx: &dyn DebugContext, | ||
| - let's call the lifetime of this reference `'1` | ||
... | ||
LL | bar.debug_with(cx); | ||
| ^^ cast requires that `'1` must outlive `'static` | ||
|
||
error: aborting due to previous error | ||
|