summary refs log tree commit diff
path: root/compiler/rustc_span/src
AgeCommit message (Collapse)AuthorLines
2022-10-29Rollup merge of #103656 - camsteffen:symbol-to-string, r=compiler-errorsMatthias Krüger-0/+7
Specialize ToString for Symbol
2022-10-28Specialize ToString for SymbolCameron Steffen-0/+7
2022-10-28Auto merge of #103071 - wesleywiser:fix_inlined_line_numbers, r=davidtwcobors-1/+7
Fix line numbers for MIR inlined code `should_collapse_debuginfo` detects if the specified span is part of a macro expansion however it does this by checking if the span is anything other than a normal (non-expanded) kind, then the span sequence is walked backwards to the root span. This doesn't work when the MIR inliner inlines code as it creates spans with expansion information set to `ExprKind::Inlined` and results in the line number being attributed to the inline callsite rather than the normal line number of the inlined code. Fixes #103068
2022-10-24Auto merge of #102536 - scottmcm:lookup_line-tweak, r=jackh726bors-4/+1
Shorten the `lookup_line` code slightly The `match` looks like it's exactly the same as `checked_sub(1)`, so we might as well see if perf says we can just do that to save a couple lines.
2022-10-20fix rust-lang#101880: suggest let for assignment, and some code refactoryukang-0/+20
2022-10-20Auto merge of #103185 - chenyukang:yukang/fix-span-next-point, r=davidtwcobors-8/+61
Fix the bug of next_point in source_map There is a bug in `next_point`, the new span won't move to next position when be called in the first time. For this reason, our current code is working like this: 1. When we really want to move to the next position, we called two times of `next_point` 2. Some code which use `next_point` actually done the same thing with `shrink_to_hi` This fix make sure when `next_point` is called, span will move with the width at least 1, and also work correctly in the scenario of multiple bytes. Ref: https://github.com/rust-lang/rust/pull/103140#discussion_r997710998 r? `@davidtwco`
2022-10-19Add testcase for next_point, fix more trivial issues in ↵yukang-6/+58
find_width_of_character_at_span
2022-10-18Fix the bug of next_point in spanyukang-3/+4
2022-10-17Make diagnostic for unsatisfied Termination bounds more preciseLeón Orell Valerian Liehr-0/+1
2022-10-14Fix line numbers for MIR inlined codeWesley Wiser-1/+7
`should_collapse_debuginfo` detects if the specified span is part of a macro expansion however it does this by checking if the span is anything other than a normal (non-expanded) kind, then the span sequence is walked backwards to the root span. This doesn't work when the MIR inliner inlines code as it creates spans with expansion information set to `ExprKind::Inlined` and results in the line number being attributed to the inline callsite rather than the normal line number of the inlined code.
2022-10-11rename rustc_allocator_nounwind to rustc_nounwindRalf Jung-1/+1
2022-10-10Rollup merge of #102860 - ↵Yuki Okushi-0/+4
GuillaumeGomez:missing-docs-FileNameDisplayPreference, r=nagisa Add missing documentation for FileNameDisplayPreference variants Took me a while to find the information when I needed it so hopefully it should save some time for the next ones. r? ``@thomcc``
2022-10-09Add missing documentation for FileNameDisplayPreference variantsGuillaume Gomez-0/+4
2022-10-08Split slice part of feature(half_open_range_patterns) to [...]_in_slicesUrgau-0/+1
2022-10-01Shorten the `lookup_line` code slightlyScott McMurray-4/+1
The `match` looks like it's exactly the same as `checked_sub(1)`, so we might as well see if perf says we can just do that to save a couple lines.
2022-09-30Rollup merge of #102382 - cuviper:defid-order, r=fee1-deadMatthias Krüger-1/+19
Manually order `DefId` on 64-bit big-endian `DefId` uses different field orders on 64-bit big-endian vs. others, in order to optimize its `Hash` implementation. However, that also made it derive different lexical ordering for `PartialOrd` and `Ord`. That caused spurious differences wherever `DefId`s are sorted, like the candidate sources list in `report_method_error`. Now we manually implement `PartialOrd` and `Ord` on 64-bit big-endian to match the same lexical ordering as other targets, fixing at least one test, `src/test/ui/methods/method-ambig-two-traits-cross-crate.rs`.
2022-09-30Auto merge of #102387 - nnethercote:inline-Token-PartialEq, r=lqdbors-0/+2
Inline a few functions. r? `@ghost`
2022-09-29Inline two `Ident` methods.Nicholas Nethercote-0/+2
2022-09-28Auto merge of #100719 - CohenArthur:rust-safe-intrinsic-attribute, r=wesleywiserbors-0/+1
Add `#[rustc_safe_intrinsic]` This PR adds the `#[rustc_safe_intrinsic]` attribute as mentionned on Zulip. The goal of this attribute is to avoid keeping a list of symbols as the source for stable intrinsics, and instead rely on an attribute. This is similar to `#[rustc_const_stable]` and `#[rustc_const_unstable]`, which among other things, are used to mark the constness of intrinsic functions.
2022-09-28Auto merge of #102388 - JohnTitor:rollup-mbyw6fl, r=JohnTitorbors-0/+3
Rollup of 8 pull requests Successful merges: - #100747 (Add long description and test for E0311) - #102232 (Stabilize bench_black_box) - #102288 (Suggest unwrapping `???<T>` if a method cannot be found on it but is present on `T`.) - #102338 (Deny associated type bindings within associated type bindings) - #102347 (Unescaping cleanups) - #102348 (Tweak `FulfillProcessor`.) - #102378 (Use already resolved `self_ty` in `confirm_fn_pointer_candidate`) - #102380 (rustdoc: remove redundant mobile `.source > .sidebar` CSS) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-09-27Manually order `DefId` on 64-bit big-endianJosh Stone-1/+19
`DefId` uses different field orders on 64-bit big-endian vs. others, in order to optimize its `Hash` implementation. However, that also made it derive different lexical ordering for `PartialOrd` and `Ord`. That caused spurious differences wherever `DefId`s are sorted, like the candidate sources list in `report_method_error`. Now we manually implement `PartialOrd` and `Ord` on 64-bit big-endian to match the same lexical ordering as other targets, fixing at least one test, `src/test/ui/methods/method-ambig-two-traits-cross-crate.rs`.
2022-09-27Address feedbackmejrs-0/+1
2022-09-27Wrapper suggestionsmejrs-0/+2
2022-09-27attributes: Add #[rustc_safe_intrinsic] builtinArthur Cohen-0/+1
2022-09-27Rewrite and refactor format_args!() builtin macro.Mara Bos-0/+11
2022-09-26remove cfg(bootstrap)Pietro Albini-1/+0
2022-09-23Rollup merge of #100734 - ComputerDruid:afit_feature, r=compiler-errorsMatthias Krüger-0/+1
Split out async_fn_in_trait into a separate feature PR #101224 added support for async fn in trait desuraging behind the `return_position_impl_trait_in_trait` feature. Split this out so that it's behind its own feature gate, since async fn in trait doesn't need to follow the same stabilization schedule.
2022-09-22Auto merge of #98840 - cjgillot:span-inline-ctxt, r=wesleywiserbors-14/+31
Inline SyntaxContext in both encoded span representation. The current interned representation for spans does not use the `ctxt_or_zero: u16` field. This PR proposes to use this field to store the `SyntaxContext` of the interned span instead. When `ctxt_or_zero` and the interned span's `ctxt` don't match, the inlined one takes precedence. This allows to implement `Span::ctxt` and `Span::with_ctxt` with much less probability to access the interner. Those functions are used a lot for hygiene, so this may be worth it.
2022-09-22Auto merge of #101999 - the8472:source-lines-partition-point, r=davidtwcobors-4/+3
use partition_point instead of binary_search when looking up source lines In local benchmarks this results in 0.4% fewer cycles in a critical sequential section when compiling libcore.
2022-09-21Split out async_fn_in_trait into a separate featureDan Johnson-0/+1
PR #101224 added support for async fn in trait desuraging behind the return_position_impl_trait_in_trait feature. Split this out so that it's behind its own feature gate, since async fn in trait doesn't need to follow the same stabilization schedule.
2022-09-21FIX - adopt new Diagnostic naming in newly migrated modulesJhonny Bill Mena-2/+2
FIX - ambiguous Diagnostic link in docs UPDATE - rename diagnostic_items to IntoDiagnostic and AddToDiagnostic [Gardening] FIX - formatting via `x fmt` FIX - rebase conflicts. NOTE: Confirm wheather or not we want to handle TargetDataLayoutErrorsWrapper this way DELETE - unneeded allow attributes in Handler method FIX - broken test FIX - Rebase conflict UPDATE - rename residual _SessionDiagnostic and fix LintDiag link
2022-09-21UPDATE - rename SessionSubdiagnostic macro to SubdiagnosticJhonny Bill Mena-1/+1
Also renames: - sym::AddSubdiagnostic to sym:: Subdiagnostic - rustc_diagnostic_item = "AddSubdiagnostic" to rustc_diagnostic_item = "Subdiagnostic"
2022-09-21UPDATE - rename DiagnosticHandler macro to DiagnosticJhonny Bill Mena-1/+1
2022-09-21UPDATE - rename DiagnosticHandler trait to IntoDiagnosticJhonny Bill Mena-1/+1
2022-09-19use partition_point instead of binary_search when looking up source linesThe 8472-4/+3
In local benchmarks this results in 0.4% fewer cycles in a critical sequential section when compiling libcore.
2022-09-17Rollup merge of #101713 - Bryanskiy:AccessLevels, r=petrochenkovMatthias Krüger-1/+1
change AccessLevels representation Part of RFC (https://github.com/rust-lang/rust/issues/48054). This patch implements effective visibility table with basic methods and change AccessLevels table representation according to it. r? ``@petrochenkov``
2022-09-17Rollup merge of #98441 - calebzulawski:simd_as, r=oli-obkDylan DPC-0/+3
Implement simd_as for pointers Expands `simd_as` (and `simd_cast`) to handle pointer-to-pointer, pointer-to-integer, and integer-to-pointer conversions. cc ``@programmerjake`` ``@thomcc``
2022-09-15Only enable the let_else feature on bootstrapest31-1/+1
On later stages, the feature is already stable. Result of running: rg -l "feature.let_else" compiler/ src/librustdoc/ library/ | xargs sed -s -i "s#\\[feature.let_else#\\[cfg_attr\\(bootstrap, feature\\(let_else\\)#"
2022-09-14Auto merge of #101212 - eholk:dyn-star, r=compiler-errorsbors-0/+1
Initial implementation of dyn* This PR adds extremely basic and incomplete support for [dyn*](https://smallcultfollowing.com/babysteps//blog/2022/03/29/dyn-can-we-make-dyn-sized/). The goal is to get something in tree behind a flag to make collaboration easier, and also to make sure the implementation so far is not unreasonable. This PR does quite a few things: * Introduce `dyn_star` feature flag * Adds parsing for `dyn* Trait` types * Defines `dyn* Trait` as a sized type * Adds support for explicit casts, like `42usize as dyn* Debug` * Including const evaluation of such casts * Adds codegen for drop glue so things are cleaned up properly when a `dyn* Trait` object goes out of scope * Adds codegen for method calls, at least for methods that take `&self` Quite a bit is still missing, but this gives us a starting point. Note that this is never intended to become stable surface syntax for Rust, but rather `dyn*` is planned to be used as an implementation detail for async functions in dyn traits. Joint work with `@nikomatsakis` and `@compiler-errors.` r? `@bjorn3`
2022-09-14change AccessLevels representationBryanskiy-1/+1
2022-09-13Auto merge of #100640 - reitermarkus:socket-display-buffer, r=thomccbors-0/+1
Use `DisplayBuffer` for socket addresses. Continuation of https://github.com/rust-lang/rust/pull/100625 for socket addresses. Renames `net::addr` to `net::addr::socket`, `net::ip` to `net::addr::ip` and `net::ip::display_buffer::IpDisplayBuffer` to `net::addr::display_buffer::DisplayBuffer`.
2022-09-13Auto merge of #99556 - davidtwco:collapse-debuginfo, r=wesleywiserbors-12/+24
ssa: implement `#[collapse_debuginfo]` cc #39153 rust-lang/compiler-team#386 Debuginfo line information for macro invocations are collapsed by default - line information are replaced by the line of the outermost expansion site. Using `-Zdebug-macros` disables this behaviour. When the `collapse_debuginfo` feature is enabled, the default behaviour is reversed so that debuginfo is not collapsed by default. In addition, the `#[collapse_debuginfo]` attribute is available and can be applied to macro definitions which will then have their line information collapsed. r? rust-lang/wg-debugging
2022-09-12Introduce dyn_star feature flagEric Holk-0/+1
The primary purpose of this commit is to introduce the dyn_star flag so we can begin experimenting with implementation. In order to have something to do in the feature gate test, we also add parser support for `dyn* Trait` objects. These are currently treated just like `dyn Trait` objects, but this will change in the future. Note that for now `dyn* Trait` is experimental syntax to enable implementing some of the machinery needed for async fn in dyn traits without fully supporting the feature.
2022-09-12Rollup merge of #101732 - Nemo157:gate-rustdoc-missing-examples, ↵Guillaume Gomez-0/+1
r=GuillaumeGomez Feature gate the `rustdoc::missing_doc_code_examples` lint Moves the lint from being implicitly active on nightly `rustdoc` to requiring a feature to activate, like other unstable lints. Uses the new tracking issue https://github.com/rust-lang/rust/issues/101730
2022-09-12Feature gate the rustdoc::missing_doc_code_examples lintWim Looman-0/+1
2022-09-12Simplify `clippy` fix.Markus Reiter-0/+1
2022-09-12Auto merge of #99334 - NiklasJonsson:84447/error-privacy, r=oli-obkbors-2/+7
rustc_error, rustc_private: Switch to stable hash containers Relates https://github.com/rust-lang/rust/issues/84447
2022-09-12Auto merge of #100251 - compiler-errors:tuple-trait-2, r=jackh726bors-0/+1
Implement `std::marker::Tuple` Split out from #99943 (https://github.com/rust-lang/rust/pull/99943#pullrequestreview-1064459183). Implements part of rust-lang/compiler-team#537 r? `@jackh726`
2022-09-11add generator_clone feature gateAndrew Cann-0/+1
2022-09-10Auto merge of #101483 - oli-obk:guaranteed_opt, r=fee1-deadbors-2/+1
The `<*const T>::guaranteed_*` methods now return an option for the unknown case cc https://github.com/rust-lang/rust/issues/53020#issuecomment-1236932443 I chose `0` for "not equal" and `1` for "equal" and left `2` for the unknown case so backends can just forward to raw pointer equality and it works ✨ r? `@fee1-dead` or `@lcnr` cc `@rust-lang/wg-const-eval`