Skip to content

Rollup of 11 pull requests #135181

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

Closed
wants to merge 25 commits into from
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
0d5087d
Display valid values in --crate-type
malezjaa Dec 24, 2024
5a2e2a9
add relnotes
BoxyUwU Dec 20, 2024
575cdf7
Stabilized APIs
BoxyUwU Jan 3, 2025
db17be8
[generic_assert] Constify methods used by the formatting system
c410-f3r Jan 5, 2025
49c7423
Add support for wasm exception handling to Emscripten target
hoodmane Oct 17, 2024
37f2631
add deprecated and do nothing flag to options table
klensy Jan 5, 2025
87ce94d
last feedback items
pietroalbini Jan 6, 2025
2be9ffc
Add derived causes for host effect predicates
compiler-errors Dec 10, 2024
96285bd
Don't ice on bad transmute in typeck in new solver
compiler-errors Dec 25, 2024
ebdf19a
Recurse on GAT where clauses in fulfillment error proof tree visitor
compiler-errors Dec 23, 2024
ec6d5bc
Implement const Destruct in old solver
compiler-errors Dec 29, 2024
304ccf4
Suggest to replace tuple constructor through projection
compiler-errors Jan 4, 2025
5172364
Update triagebot.toml: celinval vacation is over
celinval Jan 6, 2025
b0aaa38
rustdoc: Fix mismatched capitalization in sidebar
camelid Jan 5, 2025
971a01a
Rollup merge of #131830 - hoodmane:emscripten-wasm-eh, r=workingjubilee
jhpratt Jan 7, 2025
4fc205f
Rollup merge of #132345 - compiler-errors:fx-diag, r=lcnr
jhpratt Jan 7, 2025
1c6862f
Rollup merge of #134568 - BoxyUwU:relnotes_1_84, r=pietroalbini
jhpratt Jan 7, 2025
fa48f63
Rollup merge of #134720 - malezjaa:feat/crate-type-valid-values, r=ji…
jhpratt Jan 7, 2025
9f2ac38
Rollup merge of #134744 - compiler-errors:transmute-non-wf, r=lcnr
jhpratt Jan 7, 2025
6ae7a88
Rollup merge of #134875 - compiler-errors:const-destruct-old-solver, …
jhpratt Jan 7, 2025
e1e9fcd
Rollup merge of #135090 - compiler-errors:invalid-tuple-ctor-projecti…
jhpratt Jan 7, 2025
49ac654
Rollup merge of #135116 - camelid:sidebar-case, r=fmease
jhpratt Jan 7, 2025
b5cf02f
Rollup merge of #135126 - klensy:deprecated-and-do-nothing, r=jieyouxu
jhpratt Jan 7, 2025
3836aa7
Rollup merge of #135139 - c410-f3r:8-years-rfc, r=jhpratt
jhpratt Jan 7, 2025
8c1f55a
Rollup merge of #135170 - celinval:chores-vacation-end, r=jieyouxu
jhpratt Jan 7, 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
14 changes: 13 additions & 1 deletion compiler/rustc_hir_typeck/src/intrinsicck.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,25 @@ fn unpack_option_like<'tcx>(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>) -> Ty<'tcx> {
}

impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
/// FIXME: Move this check out of typeck, since it'll easily cycle when revealing opaques,
/// and we shouldn't need to check anything here if the typeck results are tainted.
pub(crate) fn check_transmute(&self, from: Ty<'tcx>, to: Ty<'tcx>, hir_id: HirId) {
let tcx = self.tcx;
let dl = &tcx.data_layout;
let span = tcx.hir().span(hir_id);
let normalize = |ty| {
let ty = self.resolve_vars_if_possible(ty);
self.tcx.normalize_erasing_regions(self.typing_env(self.param_env), ty)
if let Ok(ty) =
self.tcx.try_normalize_erasing_regions(self.typing_env(self.param_env), ty)
{
ty
} else {
Ty::new_error_with_message(
tcx,
span,
"tried to normalize non-wf type in check_transmute",
)
}
};
let from = normalize(from);
let to = normalize(to);
Expand Down
17 changes: 17 additions & 0 deletions tests/ui/traits/next-solver/dont-ice-on-bad-transmute-in-typeck.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//@ compile-flags: -Znext-solver

trait Trait<'a> {
type Assoc;
}

fn foo(x: for<'a> fn(<() as Trait<'a>>::Assoc)) {
//~^ ERROR the trait bound `for<'a> (): Trait<'a>` is not satisfied
//~| ERROR the trait bound `for<'a> (): Trait<'a>` is not satisfied
//~| ERROR the trait bound `for<'a> (): Trait<'a>` is not satisfied
unsafe { std::mem::transmute::<_, ()>(x); }
//~^ ERROR the trait bound `for<'a> (): Trait<'a>` is not satisfied
//~| ERROR the trait bound `for<'a> (): Trait<'a>` is not satisfied
//~| ERROR the trait bound `for<'a> (): Trait<'a>` is not satisfied
}

fn main() {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
error[E0277]: the trait bound `for<'a> (): Trait<'a>` is not satisfied
--> $DIR/dont-ice-on-bad-transmute-in-typeck.rs:7:11
|
LL | fn foo(x: for<'a> fn(<() as Trait<'a>>::Assoc)) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `for<'a> Trait<'a>` is not implemented for `()`
|
help: this trait has no implementations, consider adding one
--> $DIR/dont-ice-on-bad-transmute-in-typeck.rs:3:1
|
LL | trait Trait<'a> {
| ^^^^^^^^^^^^^^^

error[E0277]: the trait bound `for<'a> (): Trait<'a>` is not satisfied
--> $DIR/dont-ice-on-bad-transmute-in-typeck.rs:7:8
|
LL | fn foo(x: for<'a> fn(<() as Trait<'a>>::Assoc)) {
| ^ the trait `for<'a> Trait<'a>` is not implemented for `()`
|
help: this trait has no implementations, consider adding one
--> $DIR/dont-ice-on-bad-transmute-in-typeck.rs:3:1
|
LL | trait Trait<'a> {
| ^^^^^^^^^^^^^^^

error[E0277]: the trait bound `for<'a> (): Trait<'a>` is not satisfied
--> $DIR/dont-ice-on-bad-transmute-in-typeck.rs:11:14
|
LL | unsafe { std::mem::transmute::<_, ()>(x); }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `for<'a> Trait<'a>` is not implemented for `()`
|
help: this trait has no implementations, consider adding one
--> $DIR/dont-ice-on-bad-transmute-in-typeck.rs:3:1
|
LL | trait Trait<'a> {
| ^^^^^^^^^^^^^^^

error[E0277]: the trait bound `for<'a> (): Trait<'a>` is not satisfied
--> $DIR/dont-ice-on-bad-transmute-in-typeck.rs:11:36
|
LL | unsafe { std::mem::transmute::<_, ()>(x); }
| ^ the trait `for<'a> Trait<'a>` is not implemented for `()`
|
help: this trait has no implementations, consider adding one
--> $DIR/dont-ice-on-bad-transmute-in-typeck.rs:3:1
|
LL | trait Trait<'a> {
| ^^^^^^^^^^^^^^^

error[E0277]: the trait bound `for<'a> (): Trait<'a>` is not satisfied
--> $DIR/dont-ice-on-bad-transmute-in-typeck.rs:11:43
|
LL | unsafe { std::mem::transmute::<_, ()>(x); }
| ^ the trait `for<'a> Trait<'a>` is not implemented for `()`
|
help: this trait has no implementations, consider adding one
--> $DIR/dont-ice-on-bad-transmute-in-typeck.rs:3:1
|
LL | trait Trait<'a> {
| ^^^^^^^^^^^^^^^

error[E0277]: the trait bound `for<'a> (): Trait<'a>` is not satisfied
--> $DIR/dont-ice-on-bad-transmute-in-typeck.rs:7:1
|
LL | fn foo(x: for<'a> fn(<() as Trait<'a>>::Assoc)) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `for<'a> Trait<'a>` is not implemented for `()`
|
help: this trait has no implementations, consider adding one
--> $DIR/dont-ice-on-bad-transmute-in-typeck.rs:3:1
|
LL | trait Trait<'a> {
| ^^^^^^^^^^^^^^^

error: aborting due to 6 previous errors

For more information about this error, try `rustc --explain E0277`.