-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
11 changed files
with
404 additions
and
16 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -651,6 +651,7 @@ pub fn check_function_signature<'tcx>( | |
}))), | ||
err, | ||
false, | ||
None, | ||
); | ||
return Err(diag.emit()); | ||
} | ||
|
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 |
---|---|---|
|
@@ -1119,6 +1119,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { | |
Some(self.param_env.and(trace.values)), | ||
e, | ||
true, | ||
None, | ||
); | ||
} | ||
} | ||
|
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
64 changes: 64 additions & 0 deletions
64
tests/ui/suggestions/suggest-deref-in-match-issue-132784.rs
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,64 @@ | ||
use std::sync::Arc; | ||
fn main() { | ||
let mut x = Arc::new(Some(1)); | ||
match x { | ||
//~^ HELP consider dereferencing to access the inner value | ||
//~| HELP consider dereferencing to access the inner value | ||
Some(_) => {} | ||
//~^ ERROR mismatched types | ||
None => {} | ||
//~^ ERROR mismatched types | ||
} | ||
|
||
let mut y = Box::new(Some(1)); | ||
match y { | ||
//~^ HELP consider dereferencing to access the inner value | ||
//~| HELP consider dereferencing to access the inner value | ||
Some(_) => {} | ||
//~^ ERROR mismatched types | ||
None => {} | ||
//~^ ERROR mismatched types | ||
} | ||
|
||
let mut z = Arc::new(Some(1)); | ||
match z as Arc<Option<i32>> { | ||
//~^ HELP consider dereferencing to access the inner value | ||
//~| HELP consider dereferencing to access the inner value | ||
Some(_) => {} | ||
//~^ ERROR mismatched types | ||
None => {} | ||
//~^ ERROR mismatched types | ||
} | ||
|
||
let z_const: &Arc<Option<i32>> = &z; | ||
match z_const { | ||
//~^ HELP consider dereferencing to access the inner value | ||
//~| HELP consider dereferencing to access the inner value | ||
Some(_) => {} | ||
//~^ ERROR mismatched types | ||
None => {} | ||
//~^ ERROR mismatched types | ||
} | ||
|
||
// Normal reference because Arc doesn't implement DerefMut. | ||
let z_mut: &mut Arc<Option<i32>> = &mut z; | ||
match z_mut { | ||
//~^ HELP consider dereferencing to access the inner value | ||
//~| HELP consider dereferencing to access the inner value | ||
Some(_) => {} | ||
//~^ ERROR mismatched types | ||
None => {} | ||
//~^ ERROR mismatched types | ||
} | ||
|
||
// Mutable reference because Box does implement DerefMut. | ||
let y_mut: &mut Box<Option<i32>> = &mut y; | ||
match y_mut { | ||
//~^ HELP consider dereferencing to access the inner value | ||
//~| HELP consider dereferencing to access the inner value | ||
Some(_) => {} | ||
//~^ ERROR mismatched types | ||
None => {} | ||
//~^ ERROR mismatched types | ||
} | ||
} |
Oops, something went wrong.