Skip to content

Rollup of 9 pull requests #129595

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

Merged
merged 19 commits into from
Aug 26, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
a97b41f
Use subtyping for UnsafeFnPointer coercion, too
compiler-errors Aug 20, 2024
147bb17
Rework how we emit errors for unresolved object lifetimes
compiler-errors Aug 24, 2024
6df0ccf
rustdoc: clean up tuple <-> primitive conversion docs
notriddle Aug 24, 2024
e7f11b6
Removes dead code from the compiler
mu001999 Aug 8, 2024
c29e328
gitignore: ignore ICE reports regardless of directory
GrigorenkoPV Aug 24, 2024
ba24121
tweak rustc_allow_const_fn_unstable hint, and add back test for stabl…
RalfJung Aug 25, 2024
8750e24
Fixing span manipulation and indentation of the suggestion introduced…
surechen Aug 22, 2024
48f43fa
Avoid taking reference of &TyKind
compiler-errors Aug 25, 2024
ecd2d11
Remove redundant flags that can be inferred from the HIR
compiler-errors Aug 24, 2024
1c58522
Use FxHasher on new solver unconditionally
compiler-errors Aug 24, 2024
621f272
Rollup merge of #129288 - compiler-errors:unsafe-fn-coercion, r=lcnr
matthiaskrgr Aug 25, 2024
6228bd6
Rollup merge of #129405 - surechen:fix_span_x, r=cjgillot
matthiaskrgr Aug 25, 2024
5a07308
Rollup merge of #129518 - GrigorenkoPV:gitignore-library-ice, r=tgross35
matthiaskrgr Aug 25, 2024
ae21236
Rollup merge of #129519 - compiler-errors:lowering-flags, r=fmease
matthiaskrgr Aug 25, 2024
aa26e1a
Rollup merge of #129525 - notriddle:notriddle/fake-variadic-tuple-arr…
matthiaskrgr Aug 25, 2024
a8a242c
Rollup merge of #129526 - compiler-errors:fx, r=lqd
matthiaskrgr Aug 25, 2024
c6e0068
Rollup merge of #129544 - mu001999-contrib:dead-code/clean, r=compile…
matthiaskrgr Aug 25, 2024
0a8e305
Rollup merge of #129553 - RalfJung:const-stability, r=compiler-errors
matthiaskrgr Aug 25, 2024
d6a3aa4
Rollup merge of #129590 - compiler-errors:ref-tykind, r=fmease
matthiaskrgr Aug 25, 2024
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
Next Next commit
Use subtyping for UnsafeFnPointer coercion, too
  • Loading branch information
compiler-errors committed Aug 20, 2024
commit a97b41f1880f3aef9f4669ba56cf2e4d830825bc
4 changes: 2 additions & 2 deletions compiler/rustc_borrowck/src/type_check/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2043,9 +2043,9 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {

let ty_fn_ptr_from = tcx.safe_to_unsafe_fn_ty(fn_sig);

if let Err(terr) = self.eq_types(
*ty,
if let Err(terr) = self.sub_types(
ty_fn_ptr_from,
*ty,
location.to_locations(),
ConstraintCategory::Cast { unsize_to: None },
) {
Expand Down
14 changes: 14 additions & 0 deletions tests/ui/coercion/cast-higher-ranked-unsafe-fn-ptr.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//@ check-pass

fn higher_ranked_fndef(ctx: &mut ()) {}

fn test(higher_ranked_fnptr: fn(&mut ())) {
fn as_unsafe<T>(_: unsafe fn(T)) {}

// Make sure that we can cast higher-ranked fn items and pointers to
// a non-higher-ranked target.
as_unsafe(higher_ranked_fndef);
as_unsafe(higher_ranked_fnptr);
}

fn main() {}
Loading