forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
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#121741 - GuillaumeGomez:rollup-msrsrnk, r=Gui…
…llaumeGomez Rollup of 12 pull requests Successful merges: - rust-lang#120051 (Add `display` method to `OsStr`) - rust-lang#121226 (Fix issues in suggesting importing extern crate paths) - rust-lang#121423 (Remove the `UntranslatableDiagnosticTrivial` lint.) - rust-lang#121527 (unix_sigpipe: Simple fixes and improvements in tests) - rust-lang#121572 (Add test case for primitive links in alias js) - rust-lang#121661 (Changing some attributes to only_local.) - rust-lang#121680 (Fix link generation for foreign macro in jump to definition feature) - rust-lang#121686 (Adjust printing for RPITITs) - rust-lang#121691 (handle unavailable creation time as `io::ErrorKind::Unsupported`) - rust-lang#121695 (Split rustc_type_ir to avoid rustc_ast from depending on it) - rust-lang#121698 (CFI: Fix typo in test file names) - rust-lang#121702 (Process alias-relate obligations in CoerceUnsized loop) r? `@ghost` `@rustbot` modify labels: rollup
- Loading branch information
Showing
58 changed files
with
431 additions
and
234 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
[package] | ||
name = "rustc_ast_ir" | ||
version = "0.0.0" | ||
edition = "2021" | ||
|
||
[dependencies] | ||
# tidy-alphabetical-start | ||
rustc_data_structures = { path = "../rustc_data_structures", optional = true } | ||
rustc_macros = { path = "../rustc_macros", optional = true } | ||
rustc_serialize = { path = "../rustc_serialize", optional = true } | ||
rustc_span = { path = "../rustc_span", optional = true } | ||
smallvec = { version = "1.8.1" } | ||
# tidy-alphabetical-end | ||
|
||
[features] | ||
default = ["nightly"] | ||
nightly = [ | ||
"rustc_serialize", | ||
"rustc_data_structures", | ||
"rustc_macros", | ||
"rustc_span", | ||
] |
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,68 @@ | ||
#![cfg_attr(feature = "nightly", feature(rustc_attrs))] | ||
#![cfg_attr(feature = "nightly", allow(internal_features))] | ||
|
||
#[cfg(feature = "nightly")] | ||
#[macro_use] | ||
extern crate rustc_macros; | ||
|
||
/// The movability of a coroutine / closure literal: | ||
/// whether a coroutine contains self-references, causing it to be `!Unpin`. | ||
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Copy)] | ||
#[cfg_attr(feature = "nightly", derive(Encodable, Decodable, HashStable_NoContext))] | ||
pub enum Movability { | ||
/// May contain self-references, `!Unpin`. | ||
Static, | ||
/// Must not contain self-references, `Unpin`. | ||
Movable, | ||
} | ||
|
||
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Copy)] | ||
#[cfg_attr(feature = "nightly", derive(Encodable, Decodable, HashStable_NoContext))] | ||
pub enum Mutability { | ||
// N.B. Order is deliberate, so that Not < Mut | ||
Not, | ||
Mut, | ||
} | ||
|
||
impl Mutability { | ||
pub fn invert(self) -> Self { | ||
match self { | ||
Mutability::Mut => Mutability::Not, | ||
Mutability::Not => Mutability::Mut, | ||
} | ||
} | ||
|
||
/// Returns `""` (empty string) or `"mut "` depending on the mutability. | ||
pub fn prefix_str(self) -> &'static str { | ||
match self { | ||
Mutability::Mut => "mut ", | ||
Mutability::Not => "", | ||
} | ||
} | ||
|
||
/// Returns `"&"` or `"&mut "` depending on the mutability. | ||
pub fn ref_prefix_str(self) -> &'static str { | ||
match self { | ||
Mutability::Not => "&", | ||
Mutability::Mut => "&mut ", | ||
} | ||
} | ||
|
||
/// Returns `""` (empty string) or `"mutably "` depending on the mutability. | ||
pub fn mutably_str(self) -> &'static str { | ||
match self { | ||
Mutability::Not => "", | ||
Mutability::Mut => "mutably ", | ||
} | ||
} | ||
|
||
/// Return `true` if self is mutable | ||
pub fn is_mut(self) -> bool { | ||
matches!(self, Self::Mut) | ||
} | ||
|
||
/// Return `true` if self is **not** mutable | ||
pub fn is_not(self) -> bool { | ||
matches!(self, Self::Not) | ||
} | ||
} |
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.