about summary refs log tree commit diff
path: root/compiler/rustc_span
AgeCommit message (Collapse)AuthorLines
2024-07-18Be more accurate about calculating `display_col` from a `BytePos`Esteban Küber-160/+41
No longer track "zero-width" chars in `SourceMap`, read directly from the line when calculating the `display_col` of a `BytePos`. Move `char_width` to `rustc_span` and use it from the emitter. This change allows the following to properly align in terminals (depending on the font, the replaced control codepoints are rendered as 1 or 2 width, on my terminal they are rendered as 1, on VSCode text they are rendered as 2): ``` error: this file contains an unclosed delimiter --> $DIR/issue-68629.rs:5:17 | LL | ␜␟ts␀![{i | -- unclosed delimiter | | | unclosed delimiter LL | ␀␀ fn rݻoa>rݻm | ^ ```
2024-07-18Rollup merge of #127854 - fmease:glob-import-type_ir_inherent-lint, ↵Matthias Krüger-0/+1
r=compiler-errors Add internal lint for detecting non-glob imports of `rustc_type_ir::inherent` https://github.com/rust-lang/rust/pull/127627#issuecomment-2225295951 r? compiler-errors
2024-07-18Add internal lint for detecting non-glob imports of `rustc_type_ir::inherent`León Orell Valerian Liehr-0/+1
2024-07-17Split part of `adt_const_params` into `unsized_const_params`Boxy-0/+4
2024-07-17rustc_target: add known safe s390x target featuresliushuyu-0/+1
2024-07-16Fix unsafe_op_in_unsafe_fn in compilerMichael Goulet-9/+9
2024-07-16fmtMichael Goulet-42/+49
2024-07-12rustc_span: derivative -> derive-wherePavel Grigorenko-5/+6
2024-07-12Added the `xop` target feature and `xop_target_feature` gatesayantn-0/+1
2024-07-11Add the feature gate and target-featuressayantn-0/+1
2024-07-05Auto merge of #127008 - Jules-Bertholet:tc-ergonomics, r=Nadrierilbors-0/+1
Match ergonomics 2024: Implement TC's match ergonomics proposal Under gate `ref_pat_eat_one_layer_2024_structural`. Enabling `ref_pat_eat_one_layer_2024` at the same time allows the union of what the individual gates allow. `@traviscross` r? `@Nadrieril` cc https://github.com/rust-lang/rust/issues/123076 `@rustbot` label A-edition-2024 A-patterns
2024-07-05use old ctx if has same expand environment during decode spanbohan-0/+8
2024-06-30add `rustc_dump_def_parents` attributeBoxy-0/+1
2024-06-28address review commentsDeadbeef-2/+2
2024-06-28implement new effects desugaringDeadbeef-0/+9
2024-06-28Rollup merge of #124741 - nebulark:patchable-function-entries-pr, ↵Matthias Krüger-0/+3
r=estebank,workingjubilee patchable-function-entry: Add unstable compiler flag and attribute Tracking issue: #123115 Add the -Z patchable-function-entry compiler flag and the #[patchable_function_entry(prefix_nops = m, entry_nops = n)] attribute. Rebased and adjusted the canditate implementation to match changes in the RFC.
2024-06-27Implement TC's match ergonomics 2024 proposalJules Bertholet-0/+1
Under gate `ref_pat_eat_one_layer_2024_structural`. Enabling `ref_pat_eat_one_layer_2024` at the same time allows the union of what the individual gates allow.
2024-06-25Updated code for changes to RFC, added additional error handling, addedFlorian Schmiderer-2/+2
tests
2024-06-25Support `#[patchable_function_entries]`Matthew Maurer-0/+3
See [RFC](https://github.com/maurer/rust-rfcs/blob/patchable-function-entry/text/0000-patchable-function-entry.md) (yet to be numbered) TODO before submission: * Needs an RFC * Improve error reporting for malformed attributes
2024-06-25Auto merge of #126326 - eggyal:ununsafe-StableOrd, r=michaelwoeristerbors-2/+4
Un-unsafe the `StableOrd` trait Whilst incorrect implementations of this trait can cause miscompilation, they cannot cause memory unsafety in rustc. [Discussed on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/Policy.20of.20.60unsafe.60.20within.20the.20compiler). cc [MCP 533](https://github.com/rust-lang/compiler-team/issues/533), #105175, `@michaelwoerister` r? `@Nilstrieb`
2024-06-24Rollup merge of #125575 - dingxiangfei2009:derive-smart-ptr, r=davidtwcoMichael Goulet-0/+8
SmartPointer derive-macro <!-- If this PR is related to an unstable feature or an otherwise tracked effort, please link to the relevant tracking issue here. If you don't know of a related tracking issue or there are none, feel free to ignore this. This PR will get automatically assigned to a reviewer. In case you would like a specific user to review your work, you can assign it to them by using r​? <reviewer name> --> Possibly replacing #123472 for continued upkeep of the proposal rust-lang/rfcs#3621 and implementation of the tracking issue #123430. cc `@Darksonn` `@wedsonaf`
2024-06-24Rollup merge of #125241 - Veykril:tool-rust-analyzer, r=davidtwcoMatthias Krüger-0/+1
Add `rust_analyzer` as a predefined tool Given all the other rust-lang tools have it, I'd expect r-a to have it too. (we have a few ideas for using this https://github.com/rust-lang/rust-analyzer/issues/11556).
2024-06-24SmartPointer derive-macroXiangfei Ding-0/+8
Co-authored-by: Wedson Almeida Filho <walmeida@microsoft.com>
2024-06-22Allow "C-unwind" fn to have C variadicsJubilee Young-0/+1
2024-06-22Rollup merge of #126686 - fmease:dump-preds-n-item-bounds, r=compiler-errorsGuillaume Gomez-0/+2
Add `#[rustc_dump_{predicates,item_bounds}]` Conflicts with #126668. As discussed r? compiler-errors CC ``@fee1-dead``
2024-06-22Ensure careful consideration is given by implsAlan Egerton-1/+3
Added an associated `const THIS_IMPLEMENTATION_HAS_BEEN_TRIPLE_CHECKED` to the `StableOrd` trait to ensure that implementors carefully consider whether the trait's contract is upheld, as incorrect implementations can cause miscompilations.
2024-06-22Add `#[rustc_dump_{predicates,item_bounds}]`León Orell Valerian Liehr-0/+2
2024-06-21Rollup merge of #126530 - beetrees:f16-inline-asm-riscv, r=AmanieuJubilee-0/+2
Add `f16` inline ASM support for RISC-V This PR adds `f16` inline ASM support for RISC-V. A `FIXME` is left for `f128` support as LLVM does not support the required `Q` (Quad-Precision Floating-Point) extension yet. Relevant issue: #125398 Tracking issue: #116909 `@rustbot` label +F-f16_and_f128
2024-06-21Add `f16` inline ASM support for RISC-Vbeetrees-0/+2
2024-06-21Auto merge of #123165 - oli-obk:no_ord_def_id3, r=cjgillotbors-32/+16
Stop sorting `Span`s' `SyntaxContext`, as that is incompatible with incremental work towards https://github.com/rust-lang/rust/issues/90317 Luckily no one actually needed these to be sorted, so it didn't even affect diagnostics. I'm guessing they'd have been sorted by creation time anyway, so it wouldn't really have mattered. r? `@cjgillot`
2024-06-21Add `rust_analyzer` as a predefined toolLukas Wirth-0/+1
2024-06-20[GVN] Add tests for generic pointees with PtrMetadataScott McMurray-0/+1
2024-06-20rustc_span: Optimize span parent get/set methodsVadim Petrochenkov-35/+70
2024-06-19Rollup merge of #126668 - fmease:rm-rustc_dump_program_clauses-attrs, ↵fee1-dead-2/+0
r=fee1-dead Remove now NOP attrs `#[rustc_dump{,_env}_program_clauses]` Likely NOP since #113303. r? `@fee1-dead`
2024-06-19Remove now NOP attrs `#[rustc_dump{,_env}_program_clauses]`León Orell Valerian Liehr-2/+0
2024-06-19Rollup merge of #125293 - dingxiangfei2009:tail-expr-temp-lifetime, ↵许杰友 Jieyou Xu (Joe)-0/+1
r=estebank,davidtwco Place tail expression behind terminating scope This PR implements #123739 so that we can do further experiments in nightly. A little rewrite has been applied to `for await` lowering. It was previously `unsafe { Pin::unchecked_new(into_async_iter(..)) }`. Under the edition 2024 rule, however, `into_async_iter` gets dropped at the end of the `unsafe` block. This presumably the first Edition 2024 migration rule goes by hoisting `into_async_iter(..)` into `match` one level above, so it now looks like the following. ```rust match into_async_iter($iter_expr) { ref mut iter => match unsafe { Pin::unchecked_new(iter) } { ... } } ```
2024-06-18tail expression behind terminating scopeDing Xiang Fei-0/+1
2024-06-17[perf] More span update benchmarkingVadim Petrochenkov-30/+11
2024-06-16Auto merge of #126543 - petrochenkov:upctxt4, r=cjgillotbors-15/+25
rustc_span: Optimize more hygiene operations using `Span::map_ctxt` I missed these in https://github.com/rust-lang/rust/pull/125017.
2024-06-16rustc_span: Minor improvementsVadim Petrochenkov-10/+14
Introduce `{IndexNewtype,SyntaxContext}::from_u16` for convenience because small indices are sometimes encoded as `u16`. Use `SpanData::span` instead of `Span::new` where appropriate. Add a clarifying comment about decoding span parents.
2024-06-16rustc_span: Optimize more hygiene operations using `Span::map_ctxt`Vadim Petrochenkov-15/+25
2024-06-15Rollup merge of #125829 - petrochenkov:upctxt2, r=michaelwoeristerMatthias Krüger-113/+178
rustc_span: Add conveniences for working with span formats This is the refactoring part of https://github.com/rust-lang/rust/pull/125017.
2024-06-14Auto merge of #118958 - c410-f3r:concat-again, r=petrochenkovbors-0/+1
Add a new concat metavar expr Revival of #111930 Giving it another try now that #117050 was merged. With the new rules, meta-variable expressions must be referenced with a dollar sign (`$`) and this can cause misunderstands with `$concat`. ```rust macro_rules! foo { ( $bar:ident ) => { const ${concat(VAR, bar)}: i32 = 1; }; } // Will produce `VARbar` instead of `VAR_123` foo!(_123); ``` In other words, forgetting the dollar symbol can produce undesired outputs. cc #29599 cc https://github.com/rust-lang/rust/issues/124225
2024-06-13Add a new concat metavar exprCaio-0/+1
2024-06-13rustc_span: Remove transmutes from span encodingVadim Petrochenkov-15/+37
2024-06-13rustc_span: By-value interface for ctxt updateVadim Petrochenkov-28/+22
2024-06-13rustc_span: Add conveniences for working with span formatsVadim Petrochenkov-100/+149
2024-06-13LangItem-ify Coroutine trait in solversMichael Goulet-0/+2
2024-06-12Un-unsafe the `StableOrd` traitAlan Egerton-2/+2
Whilst incorrect implementations of this trait can cause miscompilation, they cannot cause memory unsafety in rustc.
2024-06-10rustc_span: Optimize syntax context updates in spansVadim Petrochenkov-68/+144