Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
450b864
Clean up 'HashMap' and 'HashSet' docs;
bjoernager Feb 7, 2025
3948be6
clippy: directly use rustc_abi instead of reexports
workingjubilee Feb 5, 2025
1f37b9a
compiler: remove rustc_target::abi entirely
workingjubilee Feb 5, 2025
eddfe8f
compiler: remove reexports from rustc_target::callconv
workingjubilee Feb 5, 2025
a3a9c28
Update minifier version to `0.3.4`
GuillaumeGomez Feb 7, 2025
ba12489
Add comment for regression #136223 on borrowck-errors.rs
Shunpoco Feb 1, 2025
7155382
Make `AsyncFnOnce`, `AsyncFnMut`, `AsyncFn` non-`#[fundamental]`
steffahn Feb 8, 2025
597143b
Have a break from review rotation
chenyukang Feb 8, 2025
c097b2c
transmutability: fix ICE when passing wrong ADT to ASSUME
Feb 8, 2025
221416d
compiler: use rustc_abi in rustc_ast_*
workingjubilee Nov 3, 2024
4b8b18f
resolve `llvm-config` path properly on cross builds
onur-ozkan Feb 7, 2025
949c9c4
add coverage for llvm-config path resolution
onur-ozkan Feb 8, 2025
32955b9
Small resolve refactor
llogiq Feb 8, 2025
4457f44
Document `Sum::sum` returns additive identities for `[]`
JakenHerman Feb 7, 2025
e690d5d
Rollup merge of #136397 - Shunpoco:issue-136223-ICE-pattern-mutabilit…
workingjubilee Feb 9, 2025
35f6be8
Rollup merge of #136681 - onur-ozkan:132926, r=jieyouxu
workingjubilee Feb 9, 2025
808f739
Rollup merge of #136686 - bjoernager:master, r=jhpratt
workingjubilee Feb 9, 2025
662f24f
Rollup merge of #136694 - GuillaumeGomez:update-minifier, r=notriddle
workingjubilee Feb 9, 2025
7b81236
Rollup merge of #136706 - workingjubilee:finish-up-rustc-abi-updates,…
workingjubilee Feb 9, 2025
eb0e0b5
Rollup merge of #136710 - JakenHerman:jaken/iterator-docs, r=workingj…
workingjubilee Feb 9, 2025
c5801fd
Rollup merge of #136724 - steffahn:asyncfn-non-fundamental, r=compile…
workingjubilee Feb 9, 2025
1873500
Rollup merge of #136727 - chenyukang:yukang-fix-review-scope, r=worki…
workingjubilee Feb 9, 2025
05adcca
Rollup merge of #136730 - lukas-code:trans-ice, r=jswrenn
workingjubilee Feb 9, 2025
79186b7
Rollup merge of #136736 - llogiq:small-resolve-refactor, r=jieyouxu
workingjubilee Feb 9, 2025
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
Prev Previous commit
Next Next commit
transmutability: fix ICE when passing wrong ADT to ASSUME
  • Loading branch information
Lukas Markeffsky committed Feb 8, 2025
commit c097b2c6bb63e793d30191ffdcaf30c8e0d48607
32 changes: 14 additions & 18 deletions compiler/rustc_transmute/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ mod rustc {
use rustc_infer::infer::InferCtxt;
use rustc_macros::TypeVisitable;
use rustc_middle::traits::ObligationCause;
use rustc_middle::ty::{Const, ParamEnv, Ty, TyCtxt, ValTree};
use rustc_middle::ty::{Const, ParamEnv, Ty, TyCtxt};

use super::*;

Expand Down Expand Up @@ -139,25 +139,21 @@ mod rustc {

let adt_def = cv.ty.ty_adt_def()?;

assert_eq!(
tcx.require_lang_item(LangItem::TransmuteOpts, None),
adt_def.did(),
"The given `Const` was not marked with the `{}` lang item.",
LangItem::TransmuteOpts.name(),
);
if !tcx.is_lang_item(adt_def.did(), LangItem::TransmuteOpts) {
tcx.dcx().delayed_bug(format!(
"The given `const` was not marked with the `{}` lang item.",
LangItem::TransmuteOpts.name()
));
return Some(Self {
alignment: true,
lifetimes: true,
safety: true,
validity: true,
});
}

let variant = adt_def.non_enum_variant();
let fields = match cv.valtree {
ValTree::Branch(branch) => branch,
_ => {
return Some(Self {
alignment: true,
lifetimes: true,
safety: true,
validity: true,
});
}
};
let fields = cv.valtree.unwrap_branch();

let get_field = |name| {
let (field_idx, _) = variant
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
//! Test that we don't ICE when passing the wrong ADT to ASSUME.

#![feature(adt_const_params)]
#![feature(transmutability)]

use std::marker::ConstParamTy;
use std::mem::TransmuteFrom;

#[derive(ConstParamTy, PartialEq, Eq)]
struct NotAssume;

fn foo<const ASSUME: NotAssume>()
where
u8: TransmuteFrom<u8, ASSUME>, //~ ERROR the constant `ASSUME` is not of type `Assume`
{
}

fn main() {
foo::<{ NotAssume }>();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
error: the constant `ASSUME` is not of type `Assume`
--> $DIR/wrong-adt-assume.rs:14:9
|
LL | u8: TransmuteFrom<u8, ASSUME>,
| ^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Assume`, found `NotAssume`
|
note: required by a const generic parameter in `TransmuteFrom`
--> $SRC_DIR/core/src/mem/transmutability.rs:LL:COL

error: aborting due to 1 previous error

Loading