Skip to content
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

Update rustc all at once #735

Merged
merged 18 commits into from
Jun 27, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
10 changes: 8 additions & 2 deletions engine/lib/import_thir.ml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ let c_mutability (witness : 'a) : bool -> 'a Ast.mutability = function

let c_borrow_kind span : Thir.borrow_kind -> borrow_kind = function
| Shared -> Shared
| Fake -> unimplemented [ span ] "Shallow borrows"
| Fake _ -> unimplemented [ span ] "Shallow borrows"
| Mut _ -> Mut W.mutable_reference

let c_binding_mode : Thir.by_ref -> binding_mode = function
Expand Down Expand Up @@ -257,6 +257,9 @@ end) : EXPR = struct
| Ge -> Core__cmp__PartialOrd__ge
| Gt -> Core__cmp__PartialOrd__gt
| Eq -> Core__cmp__PartialEq__eq
| Cmp ->
assertion_failure (Span.to_thir span)
"`Cmp` binary operator is not suppored"
Nadrieril marked this conversation as resolved.
Show resolved Hide resolved
| Offset -> Core__ptr__const_ptr__Impl__offset
in
let primitive_names_of_binop : Thir.bin_op -> Concrete_ident.name = function
Expand All @@ -276,6 +279,9 @@ end) : EXPR = struct
| Ge -> Rust_primitives__u128__ge
| Gt -> Rust_primitives__u128__gt
| Eq -> Rust_primitives__u128__eq
| Cmp ->
assertion_failure (Span.to_thir span)
"`Cmp` binary operator is not suppored"
| Offset -> Rust_primitives__offset
in
let name =
Expand Down Expand Up @@ -318,7 +324,7 @@ end) : EXPR = struct
| Rem -> both int
| BitXor | BitAnd | BitOr -> both int <|> both bool
| Shl | Shr -> int <*> int
| Lt | Le | Ne | Ge | Gt -> both int <|> both float
| Lt | Le | Ne | Ge | Gt | Cmp -> both int <|> both float
| Eq -> both int <|> both float <|> both bool
| Offset -> ("", fun _ -> Some "")
in
Expand Down
10 changes: 2 additions & 8 deletions frontend/exporter/src/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ pub fn select_trait_candidate<'tcx, S: UnderOwnerState<'tcx>>(
pub mod copy_paste_from_rustc {
use rustc_infer::infer::TyCtxtInferExt;
use rustc_infer::traits::{FulfillmentErrorCode, TraitEngineExt as _};
use rustc_middle::traits::{CodegenObligationError, DefiningAnchor};
use rustc_middle::traits::CodegenObligationError;
use rustc_middle::ty::{self, TyCtxt};
use rustc_trait_selection::traits::error_reporting::TypeErrCtxtExt;
use rustc_trait_selection::traits::{
Expand All @@ -456,13 +456,7 @@ pub mod copy_paste_from_rustc {

// Do the initial selection for the obligation. This yields the
// shallow result we are looking for -- that is, what specific impl.
let infcx = tcx
.infer_ctxt()
.ignoring_regions()
.with_opaque_type_inference(DefiningAnchor::Bubble)
.build();
//~^ HACK `Bubble` is required for
// this test to pass: type-alias-impl-trait/assoc-projection-ice.rs
let infcx = tcx.infer_ctxt().ignoring_regions().build();
let mut selcx = SelectionContext::new(&infcx);

let obligation_cause = ObligationCause::dummy();
Expand Down
28 changes: 22 additions & 6 deletions frontend/exporter/src/types/copied.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ pub enum BinOp {
Ne,
Ge,
Gt,
Cmp,
Offset,
}

Expand Down Expand Up @@ -981,11 +982,11 @@ pub struct Block {
pub safety_mode: BlockSafety,
}

/// Reflects [`rustc_ast::ast::BindingAnnotation`]
/// Reflects [`rustc_ast::ast::BindingMode`]
#[derive(AdtInto)]
#[args(<S>, from: rustc_ast::ast::BindingAnnotation, state: S as s)]
#[args(<S>, from: rustc_ast::ast::BindingMode, state: S as s)]
#[derive(Clone, Debug, Serialize, Deserialize, JsonSchema)]
pub struct BindingAnnotation {
pub struct BindingMode {
#[value(self.0.sinto(s))]
pub by_ref: ByRef,
#[value(self.1.sinto(s))]
Expand Down Expand Up @@ -1092,7 +1093,6 @@ pub enum TokenKind {
Comma,
Semi,
Colon,
ModSep,
RArrow,
LArrow,
FatArrow,
Expand Down Expand Up @@ -1907,7 +1907,7 @@ pub enum PatKind {
}
)]
Binding {
mode: BindingAnnotation,
mode: BindingMode,
var: LocalIdent, // name VS var? TODO
ty: Ty,
subpattern: Option<Pat>,
Expand Down Expand Up @@ -2017,7 +2017,7 @@ pub enum PointerCoercion {
)]
pub enum BorrowKind {
Shared,
Fake,
Fake(FakeBorrowKind),
Mut { kind: MutBorrowKind },
}

Expand All @@ -2033,6 +2033,22 @@ pub enum MutBorrowKind {
ClosureCapture,
}

/// Reflects [`rustc_middle::mir::FakeBorrowKind`]
#[derive(AdtInto)]
#[args(<S>, from: rustc_middle::mir::FakeBorrowKind, state: S as _s)]
#[derive(
Copy, Clone, Debug, Serialize, Deserialize, JsonSchema, Hash, PartialEq, Eq, PartialOrd, Ord,
)]
pub enum FakeBorrowKind {
/// A shared (deep) borrow. Data must be immutable and is aliasable.
Deep,
/// The immediately borrowed place must be immutable, but projections from
/// it don't need to be. This is used to prevent match guards from replacing
/// the scrutinee. For example, a fake borrow of `a.b` doesn't
/// conflict with a mutable borrow of `a.b.c`.
Shallow,
}

/// Reflects [`rustc_ast::ast::StrStyle`]
#[derive(AdtInto)]
#[args(<S>, from: rustc_ast::ast::StrStyle, state: S as gstate)]
Expand Down
15 changes: 3 additions & 12 deletions frontend/exporter/src/types/mir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,16 +162,6 @@ pub struct Instance {
#[args(<'tcx, S: UnderOwnerState<'tcx>>, from: rustc_middle::mir::SourceScopeLocalData, state: S as s)]
pub struct SourceScopeLocalData {
pub lint_root: HirId,
pub safety: Safety,
}

#[derive(AdtInto, Clone, Debug, Serialize, Deserialize, JsonSchema)]
#[args(<'tcx, S: UnderOwnerState<'tcx>>, from: rustc_middle::mir::Safety, state: S as s)]
pub enum Safety {
Safe,
BuiltinUnsafe,
FnUnsafe,
ExplicitUnsafe(HirId),
}

#[derive(AdtInto, Clone, Debug, Serialize, Deserialize, JsonSchema)]
Expand Down Expand Up @@ -893,13 +883,14 @@ pub enum AggregateKind {
Closure(DefId, Vec<GenericArg>, Vec<ImplExpr>, MirPolyFnSig),
Coroutine(DefId, Vec<GenericArg>),
CoroutineClosure(DefId, Vec<GenericArg>),
RawPtr(Ty, Mutability),
}

#[derive(AdtInto, Clone, Debug, Serialize, Deserialize, JsonSchema)]
#[args(<'tcx, S: UnderOwnerState<'tcx> + HasMir<'tcx>>, from: rustc_middle::mir::CastKind, state: S as s)]
pub enum CastKind {
PointerExposeAddress,
PointerFromExposedAddress,
PointerExposeProvenance,
PointerWithExposedProvenance,
PointerCoercion(PointerCoercion),
DynStar,
IntToInt,
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[toolchain]
channel = "nightly-2024-04-01"
channel = "nightly-2024-05-01"
components = [ "rustc-dev", "llvm-tools-preview" , "rust-analysis" , "rust-src" , "rustfmt" ]
Loading