Skip to content

enable RevealAll pass always #115299

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions compiler/rustc_mir_transform/src/reveal_all.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@ use rustc_middle::ty::{self, Ty, TyCtxt};
pub struct RevealAll;

impl<'tcx> MirPass<'tcx> for RevealAll {
fn is_enabled(&self, sess: &rustc_session::Session) -> bool {
sess.mir_opt_level() >= 3 || super::inline::Inline.is_enabled(sess)
}

fn run_pass(&self, tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
// Do not apply this transformation to generators.
if body.generator.is_some() {
Expand Down
2 changes: 2 additions & 0 deletions tests/ui/polymorphization/generators.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ where

#[rustc_polymorphize_error]
pub fn unused_type<T>() -> impl Generator<(), Yield = u32, Return = u32> + Unpin {
//~^ ERROR item has unused generic parameters
|| {
//~^ ERROR item has unused generic parameters
yield 1;
Expand All @@ -57,6 +58,7 @@ pub fn used_type_in_return<R: Default>() -> impl Generator<(), Yield = u32, Retu

#[rustc_polymorphize_error]
pub fn unused_const<const T: u32>() -> impl Generator<(), Yield = u32, Return = u32> + Unpin {
//~^ ERROR item has unused generic parameters
|| {
//~^ ERROR item has unused generic parameters
yield 1;
Expand Down
20 changes: 17 additions & 3 deletions tests/ui/polymorphization/generators.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,34 @@ LL | #![feature(generic_const_exprs, generators, generator_trait, rustc_attrs)]
= note: `#[warn(incomplete_features)]` on by default

error: item has unused generic parameters
--> $DIR/generators.rs:35:5
--> $DIR/generators.rs:36:5
|
LL | pub fn unused_type<T>() -> impl Generator<(), Yield = u32, Return = u32> + Unpin {
| - generic parameter `T` is unused
LL |
LL | || {
| ^^

error: item has unused generic parameters
--> $DIR/generators.rs:60:5
--> $DIR/generators.rs:34:8
|
LL | pub fn unused_type<T>() -> impl Generator<(), Yield = u32, Return = u32> + Unpin {
| ^^^^^^^^^^^ - generic parameter `T` is unused

error: item has unused generic parameters
--> $DIR/generators.rs:62:5
|
LL | pub fn unused_const<const T: u32>() -> impl Generator<(), Yield = u32, Return = u32> + Unpin {
| ------------ generic parameter `T` is unused
LL |
LL | || {
| ^^

error: aborting due to 2 previous errors; 1 warning emitted
error: item has unused generic parameters
--> $DIR/generators.rs:60:8
|
LL | pub fn unused_const<const T: u32>() -> impl Generator<(), Yield = u32, Return = u32> + Unpin {
| ^^^^^^^^^^^^ ------------ generic parameter `T` is unused

error: aborting due to 4 previous errors; 1 warning emitted