Skip to content

[WIP] Try packing hot type flags in the Ty (pointer) #110795

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
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
127 commits
Select commit Hold shift + click to select a range
2f02a4e
coverage: Don't underflow column number
tmandry May 24, 2022
6f7ca32
black_box doc corrections - Issue #107957
pat-nel87 Feb 24, 2023
21549da
black_box hint - Adjust for improved readability
pat-nel87 Mar 7, 2023
3970793
Replace `yes` command by `while-echo`
flba-eb Mar 20, 2023
af489af
Merge branch 'master' into Issue-107957-black_box_docs
pat-nel87 Mar 26, 2023
9c567fd
Update documentation wording on path 'try_exists' functions
tgross35 Apr 13, 2023
e3de409
Move test from rustdoc-ui to rustdoc-json
aDotInTheVoid Apr 14, 2023
b9f9604
spelling: github
jsoref Apr 9, 2023
b9b48e7
spelling: typographical
jsoref Apr 10, 2023
b0a7d6e
Suggest deref on comparison binop RHS even if type is not Copy
compiler-errors Apr 19, 2023
01c4f31
Fix `std` compilation error for wasi+atomics
tomaka Apr 20, 2023
77c83c0
Add `impl_tag!` macro to implement `Tag` for tagged pointer easily
WaffleLapkin Apr 20, 2023
0892a73
change usages of explicit_item_bounds to bound_explicit_item_bounds
kylematsuda Apr 17, 2023
f3b279f
add EarlyBinder to output of explicit_item_bounds; replace bound_expl…
kylematsuda Apr 17, 2023
e54854f
add subst_identity_iter and subst_identity_iter_copied methods on Ear…
kylematsuda Apr 17, 2023
96905d5
Use `impl Tag for $T` syntax for `impl_tag!`
WaffleLapkin Apr 20, 2023
7cfecf2
Remove confusing comment
WaffleLapkin Apr 20, 2023
ad8c7b6
Simplify `bits_for_tags` impl
WaffleLapkin Apr 20, 2023
5731655
Fix no_global_oom_handling build
arlosi Apr 21, 2023
5a69b5d
Changes from review
kylematsuda Apr 20, 2023
06ff310
Migrate `rustc_hir_analysis` to session diagnostic
obeis Apr 14, 2023
1c3efc6
Add new rustdoc book chapter to describe in-doc settings
GuillaumeGomez Apr 21, 2023
7aa257f
Update dependencies
heiher Apr 23, 2023
15e5072
Do not bother optimizing impossible functions.
cjgillot Apr 23, 2023
1f67ba6
Rewrite MemDecoder around pointers not a slice
saethlin Apr 21, 2023
2b8d27b
Switch `impl_tag!` from explicit tags to `${index()}`
WaffleLapkin Apr 24, 2023
0f85779
Fully clear the body.
cjgillot Apr 24, 2023
794cb89
Consider polarity in new solver
compiler-errors Apr 22, 2023
603e5d7
Revert "Download the GCC sources insecurely"
cuviper Apr 25, 2023
34136ab
Add support for allocators in LinkedList
rytheo Mar 19, 2023
bb2cb89
Negative coherence test
compiler-errors Apr 24, 2023
5f2fa4c
Add loongarch64 asm! support
zhaixiaojuan Aug 19, 2022
241cbca
Use the standard macOS CI runner
rylev Apr 25, 2023
999e6e5
Auto merge of #101069 - zhaixiaojuan:loongarch64-inline-asm, r=Amanieu
bors Apr 25, 2023
20d90b1
Auto merge of #103093 - rytheo:linked-list-alloc-api, r=Mark-Simulacrum
bors Apr 25, 2023
3b196fb
Updating Wake example to use new 'pin!' macro
madsravn Apr 25, 2023
a7aa205
Auto merge of #110325 - obeis:hir-analysis-migrate-diagnostics-4, r=d…
bors Apr 25, 2023
f56b6d0
pass `unused_extern_crates` in `librustdoc::doctest::make_test`
onur-ozkan Apr 25, 2023
040e1b6
Fix ICE on --print=... i/o errors
dtolnay Apr 25, 2023
666fee2
Auto merge of #110518 - loongarch-rs:update-linux-raw-sys, r=Mark-Sim…
bors Apr 25, 2023
0ee32fb
Move unstatisfaction check earlier.
cjgillot Apr 25, 2023
021a12c
Sprinkle some `#[inline]` in `rustc_data_structures::tagged_ptr`
WaffleLapkin Apr 25, 2023
bec7ce4
Add `#[inline]` in `impl_tag`
WaffleLapkin Apr 25, 2023
eeb5276
Add deny lint to prevent untranslatable diagnostics using static strings
clubby789 Mar 5, 2023
0138513
Fix static string lints
clubby789 Apr 10, 2023
451e86c
simplify TrustedLen impls
tamird Apr 25, 2023
297b222
Rollup merge of #110556 - kylematsuda:earlybinder-explicit-item-bound…
matthiaskrgr Apr 25, 2023
8d00a8d
Rollup merge of #110615 - WaffleLapkin:impl_tag, r=cjgillot
matthiaskrgr Apr 25, 2023
94dfb3b
Rollup merge of #110649 - arlosi:fix_no_global_oom_handling, r=Mark-S…
matthiaskrgr Apr 25, 2023
95e9f68
Rollup merge of #110671 - compiler-errors:polarity, r=lcnr
matthiaskrgr Apr 25, 2023
f5a3039
Rollup merge of #110783 - dtolnay:safeprint, r=petrochenkov
matthiaskrgr Apr 25, 2023
77752a0
Rollup merge of #110796 - madsravn:wake-example, r=Mark-Simulacrum
matthiaskrgr Apr 25, 2023
458d4da
Auto merge of #110821 - matthiaskrgr:rollup-mzxrvw7, r=matthiaskrgr
bors Apr 25, 2023
bb99cdc
vars are ?
compiler-errors Apr 22, 2023
1bfbac7
diagnostics: add test case for already-solved issue
notriddle Apr 25, 2023
2f35448
Add regression tests for const-generic IATs
fmease Apr 25, 2023
f33379b
Auto merge of #110811 - compiler-errors:vars-are-question-mark, r=Waf…
bors Apr 25, 2023
d9c176e
Update cargo
weihanglo Apr 25, 2023
e7ed5ba
Add definitions for riscv64gc-unknown-fuchsia
ComputerDruid Apr 19, 2023
8216b7f
Make some region folders a little stricter.
nnethercote Apr 26, 2023
84d4f16
Auto merge of #110834 - weihanglo:update-cargo, r=weihanglo
bors Apr 26, 2023
05a665f
Lower `intrinsics::offset` to `mir::BinOp::Offset`
scottmcm Apr 25, 2023
adaac6b
Auto merge of #110634 - saethlin:pointy-decoder, r=cjgillot
bors Apr 26, 2023
70540d5
Auto merge of #110784 - cuviper:build-gcc-https, r=jyn514
bors Apr 26, 2023
27c0d92
add cfg SPEC declaration.
infdahai Apr 20, 2023
9cb9346
Spelling library/
jsoref Apr 11, 2023
1042b2c
rewrite: long_line_flushed description
jsoref Apr 19, 2023
9a55e9e
rewrite: line_long_tail_not_flushed description
jsoref Apr 19, 2023
ab7e01e
Rollup merge of #108416 - pat-nel87:Issue-107957-black_box_docs, r=jy…
jyn514 Apr 26, 2023
fff8503
Rollup merge of #109379 - flba-eb:108596_fixtest_sigpipe, r=jyn514
jyn514 Apr 26, 2023
ce30232
Rollup merge of #110266 - tgross35:try-exists-wording, r=jyn514
jyn514 Apr 26, 2023
a1d4718
Rollup merge of #110329 - aDotInTheVoid:json-inline-again, r=jyn514
jyn514 Apr 26, 2023
3163dfd
Rollup merge of #110418 - jsoref:spelling-rustdoc, r=jyn514
jyn514 Apr 26, 2023
3fbaf78
Rollup merge of #110587 - tomaka:fix-109727, r=jyn514
jyn514 Apr 26, 2023
62b5bea
Rollup merge of #110594 - infdahai:cfg_chore, r=jyn514
jyn514 Apr 26, 2023
a441144
Rollup merge of #110792 - rylev:standard-macos-ci, r=pietroalbini
jyn514 Apr 26, 2023
8c0dfa3
Rollup merge of #110817 - fmease:fix-109759, r=compiler-errors
jyn514 Apr 26, 2023
ae3ab14
Auto merge of #110839 - jyn514:rollup-uikilwm, r=jyn514
bors Apr 26, 2023
6a41cfe
Migrate `rustc_passes` to translatable diagnostics
clubby789 Apr 25, 2023
8763965
Auto merge of #97368 - tmandry:coverage-underflow, r=jyn514
bors Apr 26, 2023
b311ec0
Try to improve tidy errors on TODOs
WaffleLapkin Mar 21, 2023
2b7dd08
rustdoc-json: Time serialization.
aDotInTheVoid Apr 26, 2023
9c044d7
Auto merge of #110822 - scottmcm:lower-offset-to-mir, r=compiler-errors
bors Apr 26, 2023
ef6d4c5
Remove repeated definite articles
cuishuang Apr 25, 2023
309496c
Rollup merge of #108760 - clubby789:autolintstuff, r=wesleywiser
matthiaskrgr Apr 26, 2023
ea8bd06
Rollup merge of #109444 - WaffleLapkin:undeprecate_todos, r=jyn514
matthiaskrgr Apr 26, 2023
9babe98
Rollup merge of #110419 - jsoref:spelling-library, r=jyn514
matthiaskrgr Apr 26, 2023
8e6fffc
Rollup merge of #110550 - compiler-errors:deref-on-binop-rhs, r=wesle…
matthiaskrgr Apr 26, 2023
66a5ac0
Rollup merge of #110641 - GuillaumeGomez:rustdoc-in-doc-settings, r=n…
matthiaskrgr Apr 26, 2023
1d73549
Rollup merge of #110798 - ozkanonur:rustdoc-unused-extern-crates, r=j…
matthiaskrgr Apr 26, 2023
8fe7a49
Rollup merge of #110819 - tamird:flattencompat-trustedlen, r=the8472
matthiaskrgr Apr 26, 2023
bcd55ce
Rollup merge of #110825 - notriddle:notriddle/issue-70082, r=compiler…
matthiaskrgr Apr 26, 2023
e47562c
Rollup merge of #110835 - nnethercote:strict-region-folders-2, r=comp…
matthiaskrgr Apr 26, 2023
63bccce
Rollup merge of #110847 - aDotInTheVoid:rdj-time-serialization, r=Gui…
matthiaskrgr Apr 26, 2023
1c42cb4
Auto merge of #110852 - matthiaskrgr:rollup-jz3eosr, r=matthiaskrgr
bors Apr 26, 2023
fba5cfe
Restructure and rename thread local things in std.
m-ou-se Apr 26, 2023
5a62ebb
Remove libstd_thread_internals from unstable book.
m-ou-se Apr 26, 2023
12fee7b
Update tests.
m-ou-se Apr 26, 2023
0776a4b
docs(style): add more let-else examples
calebcartwright Apr 16, 2023
0fabceb
Make method-not-found-generic-arg-elision.rs error message not path d…
compiler-errors Apr 26, 2023
cb9aa8c
Auto merge of #110861 - m-ou-se:thread-local-restructure, r=workingju…
bors Apr 26, 2023
c18e7b7
IntoFuture::into_future is no longer unstable
compiler-errors Apr 26, 2023
5b6e747
Nicer ICE for #67981
Jules-Bertholet Apr 26, 2023
e3ccd4b
Auto merge of #110562 - ComputerDruid:riscv, r=tmandry
bors Apr 27, 2023
8b8110e
Auto merge of #110728 - cjgillot:no-false-optes, r=oli-obk
bors Apr 27, 2023
f04b8fe
rename `needs_infer` to `has_infer`
BoxyUwU Apr 27, 2023
8424197
rename `needs_subst` to `has_param`
BoxyUwU Apr 27, 2023
6ce2273
Auto merge of #110882 - BoxyUwU:rename-some-ty-flags, r=compiler-errors
bors Apr 27, 2023
c2a79fb
Rollup merge of #110426 - calebcartwright:style-let-else-examples, r=…
matthiaskrgr Apr 27, 2023
5215782
Rollup merge of #110804 - cuishuang:master, r=jyn514
matthiaskrgr Apr 27, 2023
b1ff6e3
Rollup merge of #110814 - WaffleLapkin:sprinkle_#inline, r=Nilstrieb
matthiaskrgr Apr 27, 2023
63fbb05
Rollup merge of #110816 - clubby789:rustc-passes-diagnostics, r=compi…
matthiaskrgr Apr 27, 2023
563eb04
Rollup merge of #110864 - compiler-errors:into-future-stable, r=jackh726
matthiaskrgr Apr 27, 2023
1ca3f33
Rollup merge of #110866 - compiler-errors:test, r=jyn514
matthiaskrgr Apr 27, 2023
52d550b
Rollup merge of #110872 - Jules-Bertholet:err-67981, r=wesleywiser
matthiaskrgr Apr 27, 2023
901fdb3
Auto merge of #110896 - matthiaskrgr:rollup-h8fetzd, r=matthiaskrgr
bors Apr 27, 2023
dd97cc5
Allow using `Interned<..>` in tagged pointers
WaffleLapkin Apr 17, 2023
85099df
Prepare for using tagged pointers in `Ty`
WaffleLapkin Apr 17, 2023
299c04e
tmp
WaffleLapkin Apr 17, 2023
657f4df
tmp2
WaffleLapkin Apr 17, 2023
123ebce
rebase fix
WaffleLapkin Apr 25, 2023
c0a61be
debug_assrt
WaffleLapkin Apr 25, 2023
4f6a316
unhide lifetime param
WaffleLapkin Apr 25, 2023
6c903cb
fmt
WaffleLapkin Apr 25, 2023
38edcdd
akncwe;ue3v;yer;yr:b
WaffleLapkin Apr 27, 2023
8726fc8
?
WaffleLapkin Apr 27, 2023
872ce00
hello??
WaffleLapkin Apr 27, 2023
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
12 changes: 6 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ jobs:
NO_DEBUG_ASSERTIONS: 1
NO_OVERFLOW_CHECKS: 1
DIST_REQUIRE_ALL_TOOLS: 1
os: macos-12-xl
os: macos-latest
- name: dist-apple-various
env:
SCRIPT: "./x.py dist bootstrap --include-default-paths --host='' --target=aarch64-apple-ios,x86_64-apple-ios,aarch64-apple-ios-sim"
Expand All @@ -337,7 +337,7 @@ jobs:
NO_LLVM_ASSERTIONS: 1
NO_DEBUG_ASSERTIONS: 1
NO_OVERFLOW_CHECKS: 1
os: macos-12-xl
os: macos-latest
- name: dist-x86_64-apple-alt
env:
SCRIPT: "./x.py dist bootstrap --include-default-paths"
Expand All @@ -348,7 +348,7 @@ jobs:
NO_LLVM_ASSERTIONS: 1
NO_DEBUG_ASSERTIONS: 1
NO_OVERFLOW_CHECKS: 1
os: macos-12-xl
os: macos-latest
- name: x86_64-apple-1
env:
SCRIPT: "./x.py --stage 2 test --exclude tests/ui --exclude tests/rustdoc --exclude tests/run-make-fulldeps"
Expand All @@ -359,7 +359,7 @@ jobs:
NO_LLVM_ASSERTIONS: 1
NO_DEBUG_ASSERTIONS: 1
NO_OVERFLOW_CHECKS: 1
os: macos-12-xl
os: macos-latest
- name: x86_64-apple-2
env:
SCRIPT: "./x.py --stage 2 test tests/ui tests/rustdoc tests/run-make-fulldeps"
Expand All @@ -370,7 +370,7 @@ jobs:
NO_LLVM_ASSERTIONS: 1
NO_DEBUG_ASSERTIONS: 1
NO_OVERFLOW_CHECKS: 1
os: macos-12-xl
os: macos-latest
- name: dist-aarch64-apple
env:
SCRIPT: "./x.py dist bootstrap --include-default-paths --stage 2"
Expand All @@ -385,7 +385,7 @@ jobs:
NO_OVERFLOW_CHECKS: 1
DIST_REQUIRE_ALL_TOOLS: 1
JEMALLOC_SYS_WITH_LG_PAGE: 14
os: macos-12-xl
os: macos-latest
- name: x86_64-msvc-1
env:
RUST_CONFIGURE_ARGS: "--build=x86_64-pc-windows-msvc --enable-profiler"
Expand Down
41 changes: 25 additions & 16 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1170,13 +1170,13 @@ dependencies = [

[[package]]
name = "errno"
version = "0.2.8"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f639046355ee4f37944e44f60642c6f3a7efa3cf6b78c78a0d989a8ce6c396a1"
checksum = "4bcfec3a70f97c962c307b2d2c56e358cf1d00b558d74262b5f929ee8cc7e73a"
dependencies = [
"errno-dragonfly",
"libc",
"winapi",
"windows-sys 0.48.0",
]

[[package]]
Expand Down Expand Up @@ -1831,14 +1831,14 @@ dependencies = [

[[package]]
name = "is-terminal"
version = "0.4.4"
version = "0.4.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "21b6b32576413a8e69b90e952e4a026476040d81017b80445deda5f2d3921857"
checksum = "adcf93614601c8129ddf72e2d5633df827ba6551541c6d8c59520a371475be1f"
dependencies = [
"hermit-abi 0.3.0",
"io-lifetimes",
"rustix",
"windows-sys 0.45.0",
"windows-sys 0.48.0",
]

[[package]]
Expand Down Expand Up @@ -1937,9 +1937,9 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55"

[[package]]
name = "libc"
version = "0.2.140"
version = "0.2.142"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "99227334921fae1a979cf0bfdfcc6b3e5ce376ef57e16fb6fb3ea2ed6095f80c"
checksum = "6a987beff54b60ffa6d51982e1aa1146bc42f19bd26be28b0586f252fccf5317"
dependencies = [
"rustc-std-workspace-core",
]
Expand Down Expand Up @@ -2025,9 +2025,9 @@ dependencies = [

[[package]]
name = "linux-raw-sys"
version = "0.1.4"
version = "0.3.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f051f77a7c8e6957c0696eac88f26b0117e54f52d3fc682ab19397a8812846a4"
checksum = "36eb31c1778188ae1e64398743890d0877fef36d11521ac60406b42016e8c2cf"

[[package]]
name = "litemap"
Expand Down Expand Up @@ -4350,16 +4350,16 @@ dependencies = [

[[package]]
name = "rustix"
version = "0.36.5"
version = "0.37.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a3807b5d10909833d3e9acd1eb5fb988f79376ff10fce42937de71a449c4c588"
checksum = "2aae838e49b3d63e9274e1c01833cc8139d3fec468c3b84688c628f44b1ae11d"
dependencies = [
"bitflags",
"errno",
"io-lifetimes",
"libc",
"linux-raw-sys",
"windows-sys 0.42.0",
"windows-sys 0.45.0",
]

[[package]]
Expand Down Expand Up @@ -4791,12 +4791,12 @@ dependencies = [

[[package]]
name = "terminal_size"
version = "0.2.3"
version = "0.2.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cb20089a8ba2b69debd491f8d2d023761cbf196e999218c591fa1e7e15a21907"
checksum = "8e6bf6f19e9f8ed8d4048dc22981458ebcf406d67e94cd422e5ecd73d63b3237"
dependencies = [
"rustix",
"windows-sys 0.42.0",
"windows-sys 0.48.0",
]

[[package]]
Expand Down Expand Up @@ -5513,6 +5513,15 @@ dependencies = [
"windows-targets 0.42.2",
]

[[package]]
name = "windows-sys"
version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9"
dependencies = [
"windows-targets 0.48.0",
]

[[package]]
name = "windows-targets"
version = "0.42.2"
Expand Down
7 changes: 1 addition & 6 deletions compiler/rustc_ast_lowering/src/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -858,13 +858,8 @@ impl<'hir> LoweringContext<'_, 'hir> {
let awaitee_arm = self.arm(awaitee_pat, loop_expr);

// `match ::std::future::IntoFuture::into_future(<expr>) { ... }`
let into_future_span = self.mark_span_with_reason(
DesugaringKind::Await,
dot_await_span,
self.allow_into_future.clone(),
);
let into_future_expr = self.expr_call_lang_item_fn(
into_future_span,
span,
hir::LangItem::IntoFutureIntoFuture,
arena_vec![self; expr],
Some(expr_hir_id),
Expand Down
1 change: 0 additions & 1 deletion compiler/rustc_ast_lowering/src/item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ impl<'a, 'hir> ItemLowerer<'a, 'hir> {
impl_trait_bounds: Vec::new(),
allow_try_trait: Some([sym::try_trait_v2, sym::yeet_desugar_details][..].into()),
allow_gen_future: Some([sym::gen_future, sym::closure_track_caller][..].into()),
allow_into_future: Some([sym::into_future][..].into()),
generics_def_id_map: Default::default(),
};
lctx.with_hir_id_owner(owner, |lctx| f(lctx));
Expand Down
1 change: 0 additions & 1 deletion compiler/rustc_ast_lowering/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,6 @@ struct LoweringContext<'a, 'hir> {

allow_try_trait: Option<Lrc<[Symbol]>>,
allow_gen_future: Option<Lrc<[Symbol]>>,
allow_into_future: Option<Lrc<[Symbol]>>,

/// Mapping from generics `def_id`s to TAIT generics `def_id`s.
/// For each captured lifetime (e.g., 'a), we create a new lifetime parameter that is a generic
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -702,7 +702,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
.copied()
.find_map(find_fn_kind_from_did),
ty::Alias(ty::Opaque, ty::AliasTy { def_id, substs, .. }) => tcx
.bound_explicit_item_bounds(def_id)
.explicit_item_bounds(def_id)
.subst_iter_copied(tcx, substs)
.find_map(find_fn_kind_from_did),
ty::Closure(_, substs) => match substs.as_closure().kind() {
Expand Down
19 changes: 19 additions & 0 deletions compiler/rustc_builtin_macros/messages.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,25 @@ builtin_macros_format_pos_mismatch = {$n} positional {$n ->
[one] argument
*[more] arguments
} in format string, but {$desc}

builtin_macros_offset_of_expected_field = expected field

builtin_macros_offset_of_expected_two_args = expected 2 arguments

builtin_macros_test_case_non_item = `#[test_case]` attribute is only allowed on items

builtin_macros_test_bad_fn = {$kind} functions cannot be used for tests
.label = `{$kind}` because of this

builtin_macros_asm_explicit_register_name = explicit register arguments cannot have names

builtin_macros_asm_mutually_exclusive = the `{$opt1}` and `{$opt2}` options are mutually exclusive

builtin_macros_asm_pure_combine = the `pure` option must be combined with either `nomem` or `readonly`

builtin_macros_asm_pure_no_output = asm with the `pure` option must have at least one output

builtin_macros_asm_modifier_invalid = asm template modifier must be a single character

builtin_macros_test_runner_invalid = `test_runner` argument must be a path
builtin_macros_test_runner_nargs = `#![test_runner(..)]` accepts exactly 1 argument
28 changes: 8 additions & 20 deletions compiler/rustc_builtin_macros/src/asm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ use rustc_span::{InnerSpan, Span};
use rustc_target::asm::InlineAsmArch;
use smallvec::smallvec;

use crate::errors;

pub struct AsmArgs {
pub templates: Vec<P<ast::Expr>>,
pub operands: Vec<(ast::InlineAsmOperand, Span)>,
Expand Down Expand Up @@ -205,7 +207,7 @@ pub fn parse_asm_args<'a>(
// of the argument available.
if explicit_reg {
if name.is_some() {
diag.struct_span_err(span, "explicit register arguments cannot have names").emit();
diag.emit_err(errors::AsmExplicitRegisterName { span });
}
args.reg_args.insert(slot);
} else if let Some(name) = name {
Expand Down Expand Up @@ -240,25 +242,19 @@ pub fn parse_asm_args<'a>(
&& args.options.contains(ast::InlineAsmOptions::READONLY)
{
let spans = args.options_spans.clone();
diag.struct_span_err(spans, "the `nomem` and `readonly` options are mutually exclusive")
.emit();
diag.emit_err(errors::AsmMutuallyExclusive { spans, opt1: "nomem", opt2: "readonly" });
}
if args.options.contains(ast::InlineAsmOptions::PURE)
&& args.options.contains(ast::InlineAsmOptions::NORETURN)
{
let spans = args.options_spans.clone();
diag.struct_span_err(spans, "the `pure` and `noreturn` options are mutually exclusive")
.emit();
diag.emit_err(errors::AsmMutuallyExclusive { spans, opt1: "pure", opt2: "noreturn" });
}
if args.options.contains(ast::InlineAsmOptions::PURE)
&& !args.options.intersects(ast::InlineAsmOptions::NOMEM | ast::InlineAsmOptions::READONLY)
{
let spans = args.options_spans.clone();
diag.struct_span_err(
spans,
"the `pure` option must be combined with either `nomem` or `readonly`",
)
.emit();
diag.emit_err(errors::AsmPureCombine { spans });
}

let mut have_real_output = false;
Expand All @@ -285,11 +281,7 @@ pub fn parse_asm_args<'a>(
}
}
if args.options.contains(ast::InlineAsmOptions::PURE) && !have_real_output {
diag.struct_span_err(
args.options_spans.clone(),
"asm with the `pure` option must have at least one output",
)
.emit();
diag.emit_err(errors::AsmPureNoOutput { spans: args.options_spans.clone() });
}
if args.options.contains(ast::InlineAsmOptions::NORETURN) && !outputs_sp.is_empty() {
let err = diag
Expand Down Expand Up @@ -705,11 +697,7 @@ fn expand_preparsed_asm(ecx: &mut ExtCtxt<'_>, args: AsmArgs) -> Option<ast::Inl
.ty_span
.map(|sp| template_sp.from_inner(InnerSpan::new(sp.start, sp.end)))
.unwrap_or(template_sp);
ecx.struct_span_err(
span,
"asm template modifier must be a single character",
)
.emit();
ecx.emit_err(errors::AsmModifierInvalid { span });
modifier = None;
}

Expand Down
68 changes: 68 additions & 0 deletions compiler/rustc_builtin_macros/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -551,3 +551,71 @@ pub(crate) struct FormatPositionalMismatch {
#[subdiagnostic]
pub(crate) highlight: SingleLabelManySpans,
}

#[derive(Diagnostic)]
#[diag(builtin_macros_test_case_non_item)]
pub(crate) struct TestCaseNonItem {
#[primary_span]
pub(crate) span: Span,
}

#[derive(Diagnostic)]
#[diag(builtin_macros_test_bad_fn)]
pub(crate) struct TestBadFn {
#[primary_span]
pub(crate) span: Span,
#[label]
pub(crate) cause: Span,
pub(crate) kind: &'static str,
}

#[derive(Diagnostic)]
#[diag(builtin_macros_asm_explicit_register_name)]
pub(crate) struct AsmExplicitRegisterName {
#[primary_span]
pub(crate) span: Span,
}

#[derive(Diagnostic)]
#[diag(builtin_macros_asm_mutually_exclusive)]
pub(crate) struct AsmMutuallyExclusive {
#[primary_span]
pub(crate) spans: Vec<Span>,
pub(crate) opt1: &'static str,
pub(crate) opt2: &'static str,
}

#[derive(Diagnostic)]
#[diag(builtin_macros_asm_pure_combine)]
pub(crate) struct AsmPureCombine {
#[primary_span]
pub(crate) spans: Vec<Span>,
}

#[derive(Diagnostic)]
#[diag(builtin_macros_asm_pure_no_output)]
pub(crate) struct AsmPureNoOutput {
#[primary_span]
pub(crate) spans: Vec<Span>,
}

#[derive(Diagnostic)]
#[diag(builtin_macros_asm_modifier_invalid)]
pub(crate) struct AsmModifierInvalid {
#[primary_span]
pub(crate) span: Span,
}

#[derive(Diagnostic)]
#[diag(builtin_macros_test_runner_invalid)]
pub(crate) struct TestRunnerInvalid {
#[primary_span]
pub(crate) span: Span,
}

#[derive(Diagnostic)]
#[diag(builtin_macros_test_runner_nargs)]
pub(crate) struct TestRunnerNargs {
#[primary_span]
pub(crate) span: Span,
}
Loading