forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 6
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#77306 - lcnr:inline-ok, r=eddyb
normalize substs while inlining fixes rust-lang#68347 or more precisely, this fixes the same ICE in rust analyser as veloren is pinned to a specific nightly and had an error with the current one. I didn't look into creating an MVCE here as that seems fairly annoying, will spend a few minutes doing so rn. (failed) r? `@eddyb` cc `@bjorn3`
- Loading branch information
Showing
5 changed files
with
91 additions
and
7 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// run-pass | ||
// compile-flags:-Zmir-opt-level=2 | ||
pub fn main() { | ||
let _x: fn() = handle_debug_column; | ||
} | ||
|
||
fn handle_debug_column() { | ||
let sampler = sample_columns(); | ||
|
||
let foo = || { | ||
sampler.get(17); | ||
}; | ||
foo(); | ||
} | ||
|
||
fn sample_columns() -> impl Sampler { | ||
ColumnGen {} | ||
} | ||
|
||
struct ColumnGen {} | ||
|
||
trait Sampler { | ||
fn get(&self, index: i32); | ||
} | ||
|
||
impl Sampler for ColumnGen { | ||
fn get(&self, _index: i32) {} | ||
} |
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,17 @@ | ||
// run-pass | ||
// compile-flags:-Zmir-opt-level=2 | ||
|
||
// Previously ICEd because we did not normalize during inlining, | ||
// see https://github.com/rust-lang/rust/pull/77306 for more discussion. | ||
|
||
pub fn write() { | ||
create()() | ||
} | ||
|
||
pub fn create() -> impl FnOnce() { | ||
|| () | ||
} | ||
|
||
fn main() { | ||
write(); | ||
} |
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,32 @@ | ||
// run-pass | ||
// compile-flags:-Zmir-opt-level=2 | ||
|
||
struct Cursor {} | ||
struct TokenTree {} | ||
|
||
impl Iterator for Cursor { | ||
type Item = TokenTree; | ||
|
||
fn next(&mut self) -> Option<TokenTree> { | ||
None | ||
} | ||
} | ||
|
||
fn tokenstream_probably_equal_for_proc_macro() { | ||
fn break_tokens(_tree: TokenTree) -> impl Iterator<Item = TokenTree> { | ||
let token_trees: Vec<TokenTree> = vec![]; | ||
token_trees.into_iter() | ||
} | ||
|
||
let c1 = Cursor {}; | ||
let c2 = Cursor {}; | ||
|
||
let mut t1 = c1.flat_map(break_tokens); | ||
let mut t2 = c2.flat_map(break_tokens); | ||
|
||
for (_t1, _t2) in t1.by_ref().zip(t2.by_ref()) {} | ||
} | ||
|
||
fn main() { | ||
tokenstream_probably_equal_for_proc_macro(); | ||
} |