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

internal: Sync from downstream #18183

Merged
merged 135 commits into from
Sep 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
135 commits
Select commit Hold shift + click to select a range
d7485b8
Merge from rustc
Jul 16, 2024
392f8c8
Auto merge of #3751 - rust-lang:rustup-2024-07-16, r=RalfJung
bors Jul 16, 2024
5d08fa9
Auto merge of #3742 - Vanille-N:master, r=RalfJung
bors Jul 16, 2024
d986b5c
Merge from rustc
Jul 20, 2024
29cb173
Auto merge of #3755 - rust-lang:rustup-2024-07-20, r=RalfJung
bors Jul 20, 2024
f05c969
Merge from rustc
Jul 24, 2024
8ad2b26
Auto merge of #3761 - rust-lang:rustup-2024-07-24, r=RalfJung
bors Jul 24, 2024
9beae21
Merge from rustc
Aug 2, 2024
13f7536
Auto merge of #3783 - rust-lang:rustup-2024-08-02, r=RalfJung
bors Aug 2, 2024
bc6ab6a
Auto merge of #3769 - primoly:miri-start, r=RalfJung
bors Aug 2, 2024
b3ab486
Merge from rustc
RalfJung Aug 12, 2024
187b93f
Auto merge of #3801 - RalfJung:rustup, r=RalfJung
bors Aug 12, 2024
a91da98
Auto merge of #3798 - RalfJung:miri-script-remap-path-prefix, r=saethlin
bors Aug 12, 2024
2016e14
Merge from rustc
RalfJung Aug 14, 2024
3f2f4d6
Auto merge of #3803 - RalfJung:rustup, r=RalfJung
bors Aug 14, 2024
9a51bb0
Auto merge of #3712 - tiif:feat/epoll, r=oli-obk
bors Aug 14, 2024
6a89688
Auto merge of #3754 - Vanille-N:master, r=RalfJung
bors Aug 16, 2024
a38f64b
Merge from rustc
Aug 17, 2024
e5e8131
Auto merge of #3817 - rust-lang:rustup-2024-08-17, r=RalfJung
bors Aug 17, 2024
dc2ffbe
Auto merge of #3815 - RalfJung:pipe, r=RalfJung
bors Aug 17, 2024
5b373af
Auto merge of #3819 - RalfJung:epoll-test, r=RalfJung
bors Aug 17, 2024
67c171e
Auto merge of #3752 - Kixunil:simd-sha256, r=RalfJung
bors Aug 20, 2024
55207f6
Fix `elided_named_lifetimes` in code
GrigorenkoPV Aug 17, 2024
7b2e23d
Rollup merge of #129733 - lnicola:sync-from-ra, r=lnicola
matthiaskrgr Aug 31, 2024
7dd7c22
Rollup merge of #129749 - krasimirgg:llvm-20-lto, r=nikic
matthiaskrgr Aug 31, 2024
c35aea0
Rollup merge of #129757 - saethlin:half-a-recursion, r=compiler-errors
matthiaskrgr Aug 31, 2024
cccdf1a
Rollup merge of #129760 - cuviper:old-timey, r=compiler-errors
matthiaskrgr Aug 31, 2024
a4c582c
Rollup merge of #129767 - nnethercote:rm-extern-crate-tracing-4, r=ji…
matthiaskrgr Aug 31, 2024
20e3292
Rollup merge of #129774 - nnethercote:rm-extern-crate-tracing-remaind…
matthiaskrgr Aug 31, 2024
4e42396
Rollup merge of #129785 - RalfJung:miri-sync, r=RalfJung
matthiaskrgr Aug 31, 2024
a86b6ab
Rollup merge of #129791 - joboet:ich_bin_dann_mal_weg, r=joboet
matthiaskrgr Aug 31, 2024
fb3a0ea
Rollup merge of #129812 - RalfJung:box-custom-alloc, r=compiler-errors
matthiaskrgr Aug 31, 2024
883439d
Auto merge of #129817 - matthiaskrgr:rollup-ll2ld5m, r=matthiaskrgr
bors Aug 31, 2024
b5b08a8
Auto merge of #129831 - matthiaskrgr:rollup-befq6zx, r=matthiaskrgr
bors Aug 31, 2024
ae474b9
Auto merge of #129790 - BoxyUwU:bump-version, r=BoxyUwU
bors Sep 1, 2024
2a88bec
Rollup merge of #128495 - joboet:more_memcmp, r=scottmcm
matthiaskrgr Sep 1, 2024
2f853a5
Rollup merge of #128641 - Konippi:standardize-duplicate-processes-in-…
matthiaskrgr Sep 1, 2024
7136bce
Rollup merge of #129207 - GrigorenkoPV:elided-is-named, r=cjgillot
matthiaskrgr Sep 1, 2024
f79d604
Rollup merge of #129493 - cjgillot:early-opaque-def, r=petrochenkov
matthiaskrgr Sep 1, 2024
f679066
Rollup merge of #129619 - sunshowers:update-stacker, r=Mark-Simulacrum
matthiaskrgr Sep 1, 2024
dbb074d
Rollup merge of #129672 - saethlin:enum-debuginfo-tests, r=Mark-Simul…
matthiaskrgr Sep 1, 2024
946093a
Rollup merge of #129780 - cyrgani:master, r=compiler-errors
matthiaskrgr Sep 1, 2024
4be42bc
Rollup merge of #129832 - eduardosm:stray-dot, r=jhpratt
matthiaskrgr Sep 1, 2024
6158fa0
Auto merge of #129841 - matthiaskrgr:rollup-pkavdtl, r=matthiaskrgr
bors Sep 1, 2024
3297be7
Auto merge of #127897 - nyurik:add-qnx-70-target, r=saethlin
bors Sep 1, 2024
cd99bfb
Auto merge of #127313 - cjgillot:single-expect, r=jieyouxu
bors Sep 1, 2024
483b51c
Auto merge of #129063 - the8472:cold-opt-size, r=Amanieu
bors Sep 2, 2024
b7d73ea
Auto merge of #129798 - weihanglo:update-cargo, r=weihanglo
bors Sep 2, 2024
0e21dbf
Auto merge of #129317 - compiler-errors:expectation-subtyping, r=lcnr
bors Sep 2, 2024
c304e9b
Add an internal lint that warns when accessing untracked data
Nadrieril Aug 9, 2024
0ff282b
Auto merge of #129356 - nikic:llvm19-host, r=Mark-Simulacrum
bors Sep 4, 2024
223f92a
Rollup merge of #128919 - Nadrieril:lint-query-leaks, r=cjgillot
matthiaskrgr Sep 5, 2024
97ae114
Rollup merge of #129472 - folkertdev:const-refs-to-static-asm-const, …
matthiaskrgr Sep 5, 2024
7cec2c9
Rollup merge of #129653 - RalfJung:addr-of-read-only, r=scottmcm
matthiaskrgr Sep 5, 2024
9558b6b
Rollup merge of #129775 - Zalathar:initial-libdir, r=albertlarsan68
matthiaskrgr Sep 5, 2024
80e90b5
Rollup merge of #129939 - RalfJung:rvalue-len, r=compiler-errors
matthiaskrgr Sep 5, 2024
0fd6d20
Rollup merge of #129942 - onur-ozkan:building-rustc-tools, r=Kobzol
matthiaskrgr Sep 5, 2024
dd37fe0
Rollup merge of #129943 - onur-ozkan:test-float-parse-compiler, r=Kobzol
matthiaskrgr Sep 5, 2024
19b2dc1
Rollup merge of #129944 - Mark-Simulacrum:relnotes-tweak, r=pietroalbini
matthiaskrgr Sep 5, 2024
3672bb6
Rollup merge of #129947 - LiterallyVoid:duration-docs-digit-separator…
matthiaskrgr Sep 5, 2024
1945d24
Rollup merge of #129955 - fmease:fmease-break, r=fmease
matthiaskrgr Sep 5, 2024
c512337
Rollup merge of #129957 - chenx97:lint-docs-linker-opt, r=albertlarsan68
matthiaskrgr Sep 5, 2024
c4afefa
Auto merge of #129999 - matthiaskrgr:rollup-pzr9c8p, r=matthiaskrgr
bors Sep 6, 2024
1b9b8e1
Auto merge of #129176 - EnzymeAD:enzyme-backend, r=albertlarsan68
bors Sep 6, 2024
0fba741
Auto merge of #121848 - lcnr:stabilize-next-solver, r=compiler-errors
bors Sep 6, 2024
8851e4f
Fix tools
compiler-errors Jun 14, 2024
daf002f
Auto merge of #128776 - Bryanskiy:deep-reject-ctxt, r=lcnr
bors Sep 6, 2024
2d013ca
Auto merge of #129341 - madsmtm:refactor-deployment-target, r=petroch…
bors Sep 7, 2024
1e797d0
Auto merge of #128871 - onur-ozkan:128180, r=Kobzol
bors Sep 7, 2024
57794b1
Auto merge of #126161 - Bryanskiy:delegation-generics-4, r=petrochenkov
bors Sep 7, 2024
4e02d81
Auto merge of #129941 - BoxyUwU:bump-boostrap, r=albertlarsan68
bors Sep 7, 2024
a9bf2ca
Rollup merge of #126452 - compiler-errors:raw-lifetimes, r=spastorino
matthiaskrgr Sep 7, 2024
c15d8ca
Rollup merge of #129555 - RalfJung:const_float_bits_conv, r=dtolnay
matthiaskrgr Sep 7, 2024
db52d26
Rollup merge of #129594 - lolbinarycat:explain-curl-options, r=albert…
matthiaskrgr Sep 7, 2024
a387cfc
Rollup merge of #129677 - compiler-errors:by-move-body-err, r=cjgillot
matthiaskrgr Sep 7, 2024
a092fa8
Rollup merge of #129847 - compiler-errors:async-cycle, r=davidtwco
matthiaskrgr Sep 7, 2024
4ffc2cb
Rollup merge of #129869 - cyrgani:master, r=Mark-Simulacrum
matthiaskrgr Sep 7, 2024
40f53d4
Rollup merge of #130009 - notriddle:notriddle/trailing-arrow, r=lolbi…
matthiaskrgr Sep 7, 2024
d24ea5b
Rollup merge of #130046 - RalfJung:const_str_as_mut, r=dtolnay
matthiaskrgr Sep 7, 2024
72ea9cc
Rollup merge of #130047 - ChrisDenton:win-dbghelp, r=wesleywiser
matthiaskrgr Sep 7, 2024
3d212e0
Rollup merge of #130059 - gurry:130039-remove-skip-rebuild, r=Kobzol
matthiaskrgr Sep 7, 2024
622f540
Auto merge of #130091 - matthiaskrgr:rollup-kalu1cs, r=matthiaskrgr
bors Sep 7, 2024
6c67392
Auto merge of #129313 - RalfJung:coroutine-niches, r=compiler-errors
bors Sep 8, 2024
17687fc
Auto merge of #129346 - nnethercote:fix-double-handling-in-collect_to…
bors Sep 8, 2024
da60b80
Auto merge of #130072 - ChrisDenton:split-ci, r=Kobzol
bors Sep 8, 2024
69c9e89
Auto merge of #129019 - kromych:master, r=workingjubilee
bors Sep 8, 2024
ba73f83
Auto merge of #130002 - orlp:better-div-floor-ceil, r=thomcc
bors Sep 8, 2024
cb585b5
Auto merge of #130036 - weiznich:diagnostic_unstable_tracking, r=comp…
bors Sep 8, 2024
fdf9552
Auto merge of #128939 - bjorn3:windows_cg_clif_component, r=albertlar…
bors Sep 9, 2024
f4e0cc3
Auto merge of #129337 - EtomicBomb:rfc, r=notriddle
bors Sep 10, 2024
29b74a2
Auto merge of #130025 - Urgau:missing_docs-expect, r=petrochenkov
bors Sep 10, 2024
a5d9bd4
Auto merge of #129975 - notriddle:notriddle/lint-skip, r=GuillaumeGomez
bors Sep 11, 2024
5ae5a1f
Auto merge of #130050 - cjgillot:expect-attr-id, r=fee1-dead
bors Sep 11, 2024
0bbc657
Auto merge of #129992 - alexcrichton:update-compiler-builtins, r=tgro…
bors Sep 12, 2024
439cd4e
Auto merge of #130052 - khuey:clear-dilocation-after-const-emission, …
bors Sep 13, 2024
0c37543
Auto merge of #125419 - GuillaumeGomez:add-gcc-to-dist, r=Kobzol
bors Sep 14, 2024
12aa050
Auto merge of #129974 - cuviper:ci-llvm-19, r=Mark-Simulacrum
bors Sep 14, 2024
08344c2
layout computation: eagerly error for unexpected unsized fields
Sep 15, 2024
cd442a0
assert that unexpectedly unsized fields are sized in the param env
Sep 16, 2024
4e34f33
Auto merge of #127633 - SamuelMarks:eq-exit-code, r=dtolnay
bors Sep 16, 2024
705d602
Auto merge of #129970 - lukas-code:LayoutCalculator, r=compiler-errors
bors Sep 17, 2024
d8dd1ac
Auto merge of #130456 - matthiaskrgr:rollup-h2qvk1f, r=matthiaskrgr
bors Sep 17, 2024
1df2577
Auto merge of #130145 - fee1-dead-contrib:repeatn, r=lcnr,workingjubilee
bors Sep 17, 2024
8aeb624
Auto merge of #130455 - compiler-errors:inline-ordering, r=saethlin
bors Sep 17, 2024
24b9924
Auto merge of #129073 - compiler-errors:receiver-variance, r=lcnr
bors Sep 17, 2024
4a20edb
Auto merge of #129845 - scottmcm:redo-layout, r=Noratrieb
bors Sep 18, 2024
92e7438
Auto merge of #129491 - StackOverflowExcept1on:master, r=m-ou-se
bors Sep 18, 2024
0882373
Auto merge of #130069 - GuillaumeGomez:gen-scraped-buttons, r=notriddle
bors Sep 19, 2024
8260678
Auto merge of #124895 - obeis:static-mut-hidden-ref, r=compiler-errors
bors Sep 20, 2024
02f6773
add `C-cmse-nonsecure-entry` ABI
folkertdev Aug 15, 2024
c1520a1
Rollup merge of #127766 - folkertdev:c-cmse-nonsecure-entry, r=jackh726
compiler-errors Sep 21, 2024
ba5fa1a
Rollup merge of #129629 - compiler-errors:rtn-in-path, r=jackh726
compiler-errors Sep 21, 2024
3b430df
Rollup merge of #130408 - okaneco:into_lossy_refactor, r=Noratrieb
compiler-errors Sep 21, 2024
15ac93d
Rollup merge of #130651 - qwertynerd97:patch-1, r=Kobzol
compiler-errors Sep 21, 2024
fac02bc
Rollup merge of #130653 - RalfJung:result-abi-compat, r=traviscross
compiler-errors Sep 21, 2024
f06619a
Rollup merge of #130666 - compiler-errors:super-bounds, r=fee1-dead,f…
compiler-errors Sep 21, 2024
fae597b
Rollup merge of #130667 - workingjubilee:she-is-c-c-c-cold, r=compile…
compiler-errors Sep 21, 2024
376cf60
Rollup merge of #130673 - GrigorenkoPV:path-triple-colon, r=compiler-…
compiler-errors Sep 21, 2024
67f74f5
Auto merge of #130674 - compiler-errors:rollup-yu105fl, r=compiler-er…
bors Sep 21, 2024
d6b3016
Auto merge of #130337 - BoxyUwU:anon_const_macro_call, r=camelid
bors Sep 22, 2024
051fd99
Auto merge of #130246 - dianne:issue-97589-fix, r=petrochenkov
bors Sep 22, 2024
c7c237e
Auto merge of #130446 - durin42:llvm-20-fix-CommandLineArgs, r=workin…
bors Sep 22, 2024
5535897
Auto merge of #130689 - RalfJung:rustc_nonnull_optimization_guarantee…
bors Sep 22, 2024
77c49ae
Auto merge of #130697 - bjoernager:const-char-make-ascii, r=dtolnay
bors Sep 22, 2024
bbffadb
Auto merge of #130680 - saethlin:module-name-to-str, r=jieyouxu
bors Sep 22, 2024
00037a0
Auto merge of #129047 - DianQK:early_otherwise_branch_scalar, r=cjgillot
bors Sep 23, 2024
3d1569d
Auto merge of #130641 - cuviper:llvm-19.1.0, r=nikic
bors Sep 23, 2024
f7ca65f
Auto merge of #130620 - onur-ozkan:update-make-prepare, r=Kobzol
bors Sep 23, 2024
af6b99c
Auto merge of #130389 - Luv-Ray:LLVMMDNodeInContext2, r=nikic
bors Sep 24, 2024
34842bc
Auto merge of #129587 - Voultapher:opt-for-size-variants-of-sort-impl…
bors Sep 24, 2024
d62a3e7
Preparing for merge from rust-lang/rust
lnicola Sep 25, 2024
37f7190
Merge from rust-lang/rust
lnicola Sep 25, 2024
d0c3ef0
Bump rustc crates
lnicola Sep 25, 2024
6c24765
Add more LayoutError variants
lnicola Sep 25, 2024
f4bcae3
Run rustfmt
lnicola Sep 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
24 changes: 12 additions & 12 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,11 @@ tt = { path = "./crates/tt", version = "0.0.0" }
vfs-notify = { path = "./crates/vfs-notify", version = "0.0.0" }
vfs = { path = "./crates/vfs", version = "0.0.0" }

ra-ap-rustc_lexer = { version = "0.63.0", default-features = false }
ra-ap-rustc_parse_format = { version = "0.63.0", default-features = false }
ra-ap-rustc_index = { version = "0.63.0", default-features = false }
ra-ap-rustc_abi = { version = "0.63.0", default-features = false }
ra-ap-rustc_pattern_analysis = { version = "0.63.0", default-features = false }
ra-ap-rustc_lexer = { version = "0.68.0", default-features = false }
ra-ap-rustc_parse_format = { version = "0.68.0", default-features = false }
ra-ap-rustc_index = { version = "0.68.0", default-features = false }
ra-ap-rustc_abi = { version = "0.68.0", default-features = false }
ra-ap-rustc_pattern_analysis = { version = "0.68.0", default-features = false }

# local crates that aren't published to crates.io. These should not have versions.
test-fixture = { path = "./crates/test-fixture" }
Expand Down
3 changes: 3 additions & 0 deletions crates/hir-expand/src/inert_attr_macro.rs
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,9 @@ pub const INERT_ATTRIBUTES: &[BuiltinAttribute] = &[
// Used by the `rustc::potential_query_instability` lint to warn methods which
// might not be stable during incremental compilation.
rustc_attr!(rustc_lint_query_instability, Normal, template!(Word), WarnFollowing, INTERNAL_UNSTABLE),
// Used by the `rustc::untracked_query_information` lint to warn methods which
// might break incremental compilation.
rustc_attr!(rustc_lint_untracked_query_information, Normal, template!(Word), WarnFollowing, INTERNAL_UNSTABLE),
// Used by the `rustc::untranslatable_diagnostic` and `rustc::diagnostic_outside_of_impl` lints
// to assist in changes to diagnostic APIs.
rustc_attr!(rustc_lint_diagnostics, Normal, template!(Word), WarnFollowing, INTERNAL_UNSTABLE),
Expand Down
70 changes: 39 additions & 31 deletions crates/hir-ty/src/layout.rs
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
//! Compute the binary representation of a type

use std::{borrow::Cow, fmt};
use std::fmt;

use base_db::salsa::Cycle;
use chalk_ir::{AdtId, FloatTy, IntTy, TyKind, UintTy};
use hir_def::{
layout::{
Abi, FieldsShape, Float, Integer, LayoutCalculator, LayoutS, Primitive, ReprOptions,
Scalar, Size, StructKind, TargetDataLayout, WrappingRange,
Abi, FieldsShape, Float, Integer, LayoutCalculator, LayoutCalculatorError, LayoutS,
Primitive, ReprOptions, Scalar, Size, StructKind, TargetDataLayout, WrappingRange,
},
LocalFieldId, StructId,
};
use la_arena::{Idx, RawIdx};
use rustc_abi::AddressSpace;
use rustc_index::{IndexSlice, IndexVec};

use stdx::never;
use triomphe::Arc;

use crate::{
Expand Down Expand Up @@ -73,6 +72,7 @@ pub type Variants = hir_def::layout::Variants<RustcFieldIdx, RustcEnumVariantIdx

#[derive(Debug, PartialEq, Eq, Clone)]
pub enum LayoutError {
EmptyUnion,
HasErrorConst,
HasErrorType,
HasPlaceholder,
Expand All @@ -81,6 +81,7 @@ pub enum LayoutError {
RecursiveTypeWithoutIndirection,
SizeOverflow,
TargetLayoutNotAvailable,
UnexpectedUnsized,
Unknown,
UserReprTooSmall,
}
Expand All @@ -89,6 +90,7 @@ impl std::error::Error for LayoutError {}
impl fmt::Display for LayoutError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
LayoutError::EmptyUnion => write!(f, "type is an union with no fields"),
LayoutError::HasErrorConst => write!(f, "type contains an unevaluatable const"),
LayoutError::HasErrorType => write!(f, "type contains an error"),
LayoutError::HasPlaceholder => write!(f, "type contains placeholders"),
Expand All @@ -99,6 +101,9 @@ impl fmt::Display for LayoutError {
}
LayoutError::SizeOverflow => write!(f, "size overflow"),
LayoutError::TargetLayoutNotAvailable => write!(f, "target layout not available"),
LayoutError::UnexpectedUnsized => {
write!(f, "an unsized type was found where a sized type was expected")
}
LayoutError::Unknown => write!(f, "unknown"),
LayoutError::UserReprTooSmall => {
write!(f, "the `#[repr]` hint is too small to hold the discriminants of the enum")
Expand All @@ -107,19 +112,23 @@ impl fmt::Display for LayoutError {
}
}

struct LayoutCx<'a> {
target: &'a TargetDataLayout,
impl<F> From<LayoutCalculatorError<F>> for LayoutError {
fn from(err: LayoutCalculatorError<F>) -> Self {
match err {
LayoutCalculatorError::EmptyUnion => LayoutError::EmptyUnion,
LayoutCalculatorError::UnexpectedUnsized(_) => LayoutError::UnexpectedUnsized,
LayoutCalculatorError::SizeOverflow => LayoutError::SizeOverflow,
}
}
}

impl<'a> LayoutCalculator for LayoutCx<'a> {
type TargetDataLayoutRef = &'a TargetDataLayout;

fn delayed_bug(&self, txt: impl Into<Cow<'static, str>>) {
never!("{}", txt.into());
}
struct LayoutCx<'a> {
calc: LayoutCalculator<&'a TargetDataLayout>,
}

fn current_data_layout(&self) -> &'a TargetDataLayout {
self.target
impl<'a> LayoutCx<'a> {
fn new(target: &'a TargetDataLayout) -> Self {
Self { calc: LayoutCalculator::new(target) }
}
}

Expand Down Expand Up @@ -205,8 +214,8 @@ pub fn layout_of_ty_query(
let Ok(target) = db.target_data_layout(krate) else {
return Err(LayoutError::TargetLayoutNotAvailable);
};
let cx = LayoutCx { target: &target };
let dl = cx.current_data_layout();
let dl = &*target;
let cx = LayoutCx::new(dl);
let ty = normalize(db, trait_env.clone(), ty);
let result = match ty.kind(Interner) {
TyKind::Adt(AdtId(def), subst) => {
Expand Down Expand Up @@ -281,7 +290,7 @@ pub fn layout_of_ty_query(
.collect::<Result<Vec<_>, _>>()?;
let fields = fields.iter().map(|it| &**it).collect::<Vec<_>>();
let fields = fields.iter().collect::<IndexVec<_, _>>();
cx.univariant(dl, &fields, &ReprOptions::default(), kind).ok_or(LayoutError::Unknown)?
cx.calc.univariant(&fields, &ReprOptions::default(), kind)?
}
TyKind::Array(element, count) => {
let count = try_const_usize(db, count).ok_or(LayoutError::HasErrorConst)? as u64;
Expand Down Expand Up @@ -367,12 +376,12 @@ pub fn layout_of_ty_query(
};

// Effectively a (ptr, meta) tuple.
cx.scalar_pair(data_ptr, metadata)
cx.calc.scalar_pair(data_ptr, metadata)
}
TyKind::FnDef(_, _) => layout_of_unit(&cx, dl)?,
TyKind::Never => cx.layout_of_never_type(),
TyKind::FnDef(_, _) => layout_of_unit(&cx)?,
TyKind::Never => cx.calc.layout_of_never_type(),
TyKind::Dyn(_) | TyKind::Foreign(_) => {
let mut unit = layout_of_unit(&cx, dl)?;
let mut unit = layout_of_unit(&cx)?;
match &mut unit.abi {
Abi::Aggregate { sized } => *sized = false,
_ => return Err(LayoutError::Unknown),
Expand Down Expand Up @@ -414,8 +423,7 @@ pub fn layout_of_ty_query(
.collect::<Result<Vec<_>, _>>()?;
let fields = fields.iter().map(|it| &**it).collect::<Vec<_>>();
let fields = fields.iter().collect::<IndexVec<_, _>>();
cx.univariant(dl, &fields, &ReprOptions::default(), StructKind::AlwaysSized)
.ok_or(LayoutError::Unknown)?
cx.calc.univariant(&fields, &ReprOptions::default(), StructKind::AlwaysSized)?
}
TyKind::Coroutine(_, _) | TyKind::CoroutineWitness(_, _) => {
return Err(LayoutError::NotImplemented)
Expand Down Expand Up @@ -447,14 +455,14 @@ pub fn layout_of_ty_recover(
Err(LayoutError::RecursiveTypeWithoutIndirection)
}

fn layout_of_unit(cx: &LayoutCx<'_>, dl: &TargetDataLayout) -> Result<Layout, LayoutError> {
cx.univariant::<RustcFieldIdx, RustcEnumVariantIdx, &&Layout>(
dl,
IndexSlice::empty(),
&ReprOptions::default(),
StructKind::AlwaysSized,
)
.ok_or(LayoutError::Unknown)
fn layout_of_unit(cx: &LayoutCx<'_>) -> Result<Layout, LayoutError> {
cx.calc
.univariant::<RustcFieldIdx, RustcEnumVariantIdx, &&Layout>(
IndexSlice::empty(),
&ReprOptions::default(),
StructKind::AlwaysSized,
)
.map_err(Into::into)
}

fn struct_tail_erasing_lifetimes(db: &dyn HirDatabase, pointee: Ty) -> Ty {
Expand Down
13 changes: 6 additions & 7 deletions crates/hir-ty/src/layout/adt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use std::{cmp, ops::Bound};
use base_db::salsa::Cycle;
use hir_def::{
data::adt::VariantData,
layout::{Integer, LayoutCalculator, ReprOptions, TargetDataLayout},
layout::{Integer, ReprOptions, TargetDataLayout},
AdtId, VariantId,
};
use intern::sym;
Expand Down Expand Up @@ -36,8 +36,8 @@ pub fn layout_of_adt_query(
let Ok(target) = db.target_data_layout(krate) else {
return Err(LayoutError::TargetLayoutNotAvailable);
};
let cx = LayoutCx { target: &target };
let dl = cx.current_data_layout();
let dl = &*target;
let cx = LayoutCx::new(dl);
let handle_variant = |def: VariantId, var: &VariantData| {
var.fields()
.iter()
Expand Down Expand Up @@ -73,9 +73,9 @@ pub fn layout_of_adt_query(
.collect::<SmallVec<[_; 1]>>();
let variants = variants.iter().map(|it| it.iter().collect()).collect::<IndexVec<_, _>>();
let result = if matches!(def, AdtId::UnionId(..)) {
cx.layout_of_union(&repr, &variants).ok_or(LayoutError::Unknown)?
cx.calc.layout_of_union(&repr, &variants)?
} else {
cx.layout_of_struct_or_enum(
cx.calc.layout_of_struct_or_enum(
&repr,
&variants,
matches!(def, AdtId::EnumId(..)),
Expand Down Expand Up @@ -103,8 +103,7 @@ pub fn layout_of_adt_query(
.next()
.and_then(|it| it.iter().last().map(|it| !it.is_unsized()))
.unwrap_or(true),
)
.ok_or(LayoutError::SizeOverflow)?
)?
};
Ok(Arc::new(result))
}
Expand Down
3 changes: 3 additions & 0 deletions crates/hir-ty/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,7 @@ pub enum FnAbi {
AvrNonBlockingInterrupt,
C,
CCmseNonsecureCall,
CCmseNonsecureEntry,
CDecl,
CDeclUnwind,
CUnwind,
Expand Down Expand Up @@ -436,6 +437,7 @@ impl FnAbi {
s if *s == sym::avr_dash_interrupt => FnAbi::AvrInterrupt,
s if *s == sym::avr_dash_non_dash_blocking_dash_interrupt => FnAbi::AvrNonBlockingInterrupt,
s if *s == sym::C_dash_cmse_dash_nonsecure_dash_call => FnAbi::CCmseNonsecureCall,
s if *s == sym::C_dash_cmse_dash_nonsecure_dash_entry => FnAbi::CCmseNonsecureEntry,
s if *s == sym::C_dash_unwind => FnAbi::CUnwind,
s if *s == sym::C => FnAbi::C,
s if *s == sym::cdecl_dash_unwind => FnAbi::CDeclUnwind,
Expand Down Expand Up @@ -479,6 +481,7 @@ impl FnAbi {
FnAbi::AvrNonBlockingInterrupt => "avr-non-blocking-interrupt",
FnAbi::C => "C",
FnAbi::CCmseNonsecureCall => "C-cmse-nonsecure-call",
FnAbi::CCmseNonsecureEntry => "C-cmse-nonsecure-entry",
FnAbi::CDecl => "C-decl",
FnAbi::CDeclUnwind => "cdecl-unwind",
FnAbi::CUnwind => "C-unwind",
Expand Down
1 change: 1 addition & 0 deletions crates/ide-completion/src/completions/extern_abi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ const SUPPORTED_CALLING_CONVENTIONS: &[&str] = &[
"riscv-interrupt-m",
"riscv-interrupt-s",
"C-cmse-nonsecure-call",
"C-cmse-nonsecure-entry",
"wasm",
"system",
"system-unwind",
Expand Down
1 change: 1 addition & 0 deletions crates/intern/src/symbol/symbols.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ define_symbols! {
avr_dash_interrupt = "avr-interrupt",
avr_dash_non_dash_blocking_dash_interrupt = "avr-non-blocking-interrupt",
C_dash_cmse_dash_nonsecure_dash_call = "C-cmse-nonsecure-call",
C_dash_cmse_dash_nonsecure_dash_entry = "C-cmse-nonsecure-entry",
C_dash_unwind = "C-unwind",
cdecl_dash_unwind = "cdecl-unwind",
fastcall_dash_unwind = "fastcall-unwind",
Expand Down
5 changes: 5 additions & 0 deletions crates/parser/src/lexed_str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,11 @@ impl<'a> Converter<'a> {
}
LIFETIME_IDENT
}
rustc_lexer::TokenKind::UnknownPrefixLifetime => {
err = "Unknown lifetime prefix";
LIFETIME_IDENT
}
rustc_lexer::TokenKind::RawLifetime => LIFETIME_IDENT,

rustc_lexer::TokenKind::Semi => T![;],
rustc_lexer::TokenKind::Comma => T![,],
Expand Down
2 changes: 1 addition & 1 deletion rust-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6cf068db566de080dfa7ed24a216ea3aed2b98ce
1b5aa96d6016bafe50e071b45d4d2e3c90fd766f