-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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 #72589 - Dylan-DPC:rollup-7l2a2bo, r=Dylan-DPC
Rollup of 5 pull requests Successful merges: - #72061 (add regression tests for stalled_on const vars) - #72424 (fix ICE when debug-printing MIR) - #72450 (Fix ice-#72442) - #72451 (Perform MIR NRVO even if types don't match) - #72538 (Removed all instances of const_field.) Failed merges: r? @ghost
- Loading branch information
Showing
16 changed files
with
155 additions
and
78 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
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,26 @@ | ||
// edition:2018 | ||
// compile-flags:-Cincremental=tmp/issue-72442 | ||
|
||
use std::fs::File; | ||
use std::future::Future; | ||
use std::io::prelude::*; | ||
|
||
fn main() -> Result<(), Box<dyn std::error::Error>> { | ||
block_on(async { | ||
{ | ||
let path = std::path::Path::new("."); | ||
let mut f = File::open(path.to_str())?; | ||
//~^ ERROR the trait bound | ||
let mut src = String::new(); | ||
f.read_to_string(&mut src)?; | ||
Ok(()) | ||
} | ||
}) | ||
} | ||
|
||
fn block_on<F>(f: F) -> F::Output | ||
where | ||
F: Future<Output = Result<(), Box<dyn std::error::Error>>>, | ||
{ | ||
Ok(()) | ||
} |
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,14 @@ | ||
error[E0277]: the trait bound `std::option::Option<&str>: std::convert::AsRef<std::path::Path>` is not satisfied | ||
--> $DIR/issue-72442.rs:12:36 | ||
| | ||
LL | let mut f = File::open(path.to_str())?; | ||
| ^^^^^^^^^^^^^ the trait `std::convert::AsRef<std::path::Path>` is not implemented for `std::option::Option<&str>` | ||
| | ||
::: $SRC_DIR/libstd/fs.rs:LL:COL | ||
| | ||
LL | pub fn open<P: AsRef<Path>>(path: P) -> io::Result<File> { | ||
| ----------- required by this bound in `std::fs::File::open` | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0277`. |
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,35 @@ | ||
// build-pass | ||
#![feature(const_generics)] | ||
#![allow(incomplete_features)] | ||
|
||
pub fn works() { | ||
let array/*: [_; _]*/ = default_array(); | ||
let _: [_; 4] = array; | ||
Foo::foo(&array); | ||
} | ||
|
||
pub fn didnt_work() { | ||
let array/*: [_; _]*/ = default_array(); | ||
Foo::foo(&array); | ||
let _: [_; 4] = array; | ||
} | ||
|
||
trait Foo { | ||
fn foo(&self) {} | ||
} | ||
|
||
impl Foo for [i32; 4] {} | ||
impl Foo for [i64; 8] {} | ||
|
||
// Only needed because `[_; _]` is not valid type syntax. | ||
fn default_array<T, const N: usize>() -> [T; N] | ||
where | ||
[T; N]: Default, | ||
{ | ||
Default::default() | ||
} | ||
|
||
fn main() { | ||
works(); | ||
didnt_work(); | ||
} |
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,35 @@ | ||
// build-pass | ||
#![feature(const_generics)] | ||
#![allow(incomplete_features)] | ||
|
||
fn works() { | ||
let array/*: [u8; _]*/ = default_byte_array(); | ||
let _: [_; 4] = array; | ||
Foo::foo(&array); | ||
} | ||
|
||
fn didnt_work() { | ||
let array/*: [u8; _]*/ = default_byte_array(); | ||
Foo::foo(&array); | ||
let _: [_; 4] = array; | ||
} | ||
|
||
trait Foo<T> { | ||
fn foo(&self) {} | ||
} | ||
|
||
impl Foo<i32> for [u8; 4] {} | ||
impl Foo<i64> for [u8; 8] {} | ||
|
||
// Only needed because `[u8; _]` is not valid type syntax. | ||
fn default_byte_array<const N: usize>() -> [u8; N] | ||
where | ||
[u8; N]: Default, | ||
{ | ||
Default::default() | ||
} | ||
|
||
fn main() { | ||
works(); | ||
didnt_work(); | ||
} |