-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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 #72010 - Dylan-DPC:rollup-prdj0pk, r=Dylan-DPC
Rollup of 6 pull requests Successful merges: - #71989 (Use a single enum for the kind of a const context) - #71993 (Remove old `util/liveness.rs` module) - #71999 (Add myself to mailmap.) - #72001 (Adjust cfg(version) to lang team decision) - #72007 (Fix some tests failing in `--pass check` mode) - #72008 (Add const-generics test) Failed merges: r? @ghost
- Loading branch information
Showing
24 changed files
with
235 additions
and
476 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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
fn main() { | ||
println!("cargo:rerun-if-changed=build.rs"); | ||
println!("cargo:rerun-if-env-changed=CFG_VERSION"); | ||
println!("cargo:rerun-if-env-changed=CFG_RELEASE"); | ||
println!("cargo:rerun-if-env-changed=CFG_RELEASE_CHANNEL"); | ||
} |
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,78 @@ | ||
use rustc_middle::mir::visit::{ | ||
MutatingUseContext, NonMutatingUseContext, NonUseContext, PlaceContext, | ||
}; | ||
|
||
#[derive(Eq, PartialEq, Clone)] | ||
pub enum DefUse { | ||
Def, | ||
Use, | ||
Drop, | ||
} | ||
|
||
pub fn categorize(context: PlaceContext) -> Option<DefUse> { | ||
match context { | ||
/////////////////////////////////////////////////////////////////////////// | ||
// DEFS | ||
|
||
PlaceContext::MutatingUse(MutatingUseContext::Store) | | ||
|
||
// This is potentially both a def and a use... | ||
PlaceContext::MutatingUse(MutatingUseContext::AsmOutput) | | ||
|
||
// We let Call define the result in both the success and | ||
// unwind cases. This is not really correct, however it | ||
// does not seem to be observable due to the way that we | ||
// generate MIR. To do things properly, we would apply | ||
// the def in call only to the input from the success | ||
// path and not the unwind path. -nmatsakis | ||
PlaceContext::MutatingUse(MutatingUseContext::Call) | | ||
PlaceContext::MutatingUse(MutatingUseContext::Yield) | | ||
|
||
// Storage live and storage dead aren't proper defines, but we can ignore | ||
// values that come before them. | ||
PlaceContext::NonUse(NonUseContext::StorageLive) | | ||
PlaceContext::NonUse(NonUseContext::StorageDead) => Some(DefUse::Def), | ||
|
||
/////////////////////////////////////////////////////////////////////////// | ||
// REGULAR USES | ||
// | ||
// These are uses that occur *outside* of a drop. For the | ||
// purposes of NLL, these are special in that **all** the | ||
// lifetimes appearing in the variable must be live for each regular use. | ||
|
||
PlaceContext::NonMutatingUse(NonMutatingUseContext::Projection) | | ||
PlaceContext::MutatingUse(MutatingUseContext::Projection) | | ||
|
||
// Borrows only consider their local used at the point of the borrow. | ||
// This won't affect the results since we use this analysis for generators | ||
// and we only care about the result at suspension points. Borrows cannot | ||
// cross suspension points so this behavior is unproblematic. | ||
PlaceContext::MutatingUse(MutatingUseContext::Borrow) | | ||
PlaceContext::NonMutatingUse(NonMutatingUseContext::SharedBorrow) | | ||
PlaceContext::NonMutatingUse(NonMutatingUseContext::ShallowBorrow) | | ||
PlaceContext::NonMutatingUse(NonMutatingUseContext::UniqueBorrow) | | ||
|
||
PlaceContext::MutatingUse(MutatingUseContext::AddressOf) | | ||
PlaceContext::NonMutatingUse(NonMutatingUseContext::AddressOf) | | ||
PlaceContext::NonMutatingUse(NonMutatingUseContext::Inspect) | | ||
PlaceContext::NonMutatingUse(NonMutatingUseContext::Copy) | | ||
PlaceContext::NonMutatingUse(NonMutatingUseContext::Move) | | ||
PlaceContext::NonUse(NonUseContext::AscribeUserTy) | | ||
PlaceContext::MutatingUse(MutatingUseContext::Retag) => | ||
Some(DefUse::Use), | ||
|
||
/////////////////////////////////////////////////////////////////////////// | ||
// DROP USES | ||
// | ||
// These are uses that occur in a DROP (a MIR drop, not a | ||
// call to `std::mem::drop()`). For the purposes of NLL, | ||
// uses in drop are special because `#[may_dangle]` | ||
// attributes can affect whether lifetimes must be live. | ||
|
||
PlaceContext::MutatingUse(MutatingUseContext::Drop) => | ||
Some(DefUse::Drop), | ||
|
||
// Debug info is neither def nor use. | ||
PlaceContext::NonUse(NonUseContext::VarDebugInfo) => 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
Oops, something went wrong.