about summary refs log tree commit diff
path: root/compiler/rustc_span
AgeCommit message (Collapse)AuthorLines
2021-07-29Add feature gates for `for` and `?` in constsJonas Schievink-0/+2
2021-07-28Add new const_format_args!() macro and use it in panics.Mara Bos-0/+1
2021-07-28Make const panic!("..") work in Rust 2021.Mara Bos-0/+4
During const eval, this replaces calls to core::panicking::panic_fmt and std::panicking::being_panic_fmt with a call to a new const fn: core::panicking::const_panic_fmt. That function uses fmt::Arguments::as_str() to get the str and calls panic_str with that instead. panic!() invocations with formatting arguments are still not accepted, as the creation of such a fmt::Arguments cannot be done in constant functions right now.
2021-07-27Permit deriving default on enums with `#[default]`Jacob Pratt-0/+1
2021-07-26Actually infer args in visitorskadmin-0/+1
2021-07-20Add internal attribute and tests.Charles Lew-0/+1
2021-07-19Auto merge of #87225 - estebank:cleanup, r=oli-obkbors-2/+2
Various diagnostics clean ups/tweaks * Always point at macros, including derive macros * Point at non-local items that introduce a trait requirement * On private associated item, point at definition
2021-07-19Various diagnostics clean ups/tweaksEsteban Küber-2/+2
* Always point at macros, including derive macros * Point at non-local items that introduce a trait requirement * On private associated item, point at definition
2021-07-18Support negative numbers in Literal::from_strDavid Tolnay-0/+4
2021-07-18Rollup merge of #87170 - xFrednet:clippy-5393-add-diagnostic-items, ↵Yuki Okushi-0/+22
r=Manishearth,oli-obk Add diagnostic items for Clippy This adds a bunch of diagnostic items to `std`/`core`/`alloc` functions, structs and traits used in Clippy. The actual refactorings in Clippy to use these items will be done in a different PR in Clippy after the next sync. This PR doesn't include all paths Clippy uses, I've only gone through the first 85 lines of Clippy's [`paths.rs`](https://github.com/rust-lang/rust-clippy/blob/ecf85f4bdc319f9d9d853d1fff68a8a25e64c7a8/clippy_utils/src/paths.rs) (after rust-lang/rust-clippy#7466) to get some feedback early on. I've also decided against adding diagnostic items to methods, as it would be nicer and more scalable to access them in a nicer fashion, like adding a `is_diagnostic_assoc_item(did, sym::Iterator, sym::map)` function or something similar (Suggested by `@camsteffen` [on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/147480-t-compiler.2Fwg-diagnostics/topic/Diagnostic.20Item.20Naming.20Convention.3F/near/225024603)) There seems to be some different naming conventions when it comes to diagnostic items, some use UpperCamelCase (`BinaryHeap`) and some snake_case (`hashmap_type`). This PR uses UpperCamelCase for structs and traits and snake_case with the module name as a prefix for functions. Any feedback on is this welcome. cc: rust-lang/rust-clippy#5393 r? `@Manishearth`
2021-07-17Simplify Expn creation.Camille GILLOT-27/+25
2021-07-17Rename expn_info -> expn_data.Camille GILLOT-8/+8
2021-07-17Pass ExpnData by reference.Camille GILLOT-3/+3
2021-07-17Drop ExpnData::krate.Camille GILLOT-19/+10
2021-07-17Drop orig_id.Camille GILLOT-33/+9
2021-07-17Encode ExpnId using ExpnHash for incr. comp.Camille GILLOT-66/+57
2021-07-17Choose encoding format in caller code.Camille GILLOT-72/+26
2021-07-17Use LocalExpnId where possible.Camille GILLOT-14/+1
2021-07-17Make the CrateNum part of the ExpnId.Camille GILLOT-96/+251
2021-07-17Corrected symbol order after adding diagnostic itemsxFrednet-1/+1
2021-07-15Added diagnostic items to structs and traits for ClippyxFrednet-0/+13
2021-07-15Added diagnostic items to functions for ClippyxFrednet-0/+9
2021-07-15Simplify metadata decoding.Camille GILLOT-30/+8
2021-07-15Separate encoding paths.Camille GILLOT-52/+87
The two paths will be modified independently in the next few commits.
2021-07-14Auto merge of #87106 - Mark-Simulacrum:edition-no-clone, r=petrochenkovbors-1/+1
Avoid cloning ExpnData to access Span edition ExpnData is a fairly hefty structure to clone; cloning it may not be cheap. In some cases this may get optimized out, but it's not clear that will always be the case. Try to avoid that cost. r? `@ghost` -- opening for a perf run to start with
2021-07-13Auto merge of #87044 - cjgillot:expnhash, r=petrochenkovbors-194/+144
Cache expansion hash globally ... instead of computing it multiple times. Split from #86676 r? `@petrochenkov`
2021-07-13Cache expansion hash.Camille GILLOT-171/+122
2021-07-13Move HashStable implementations.Camille GILLOT-61/+60
2021-07-13Avoid cloning ExpnData to access Span editionMark Rousskov-1/+1
ExpnData is a fairly hefty structure to clone; cloning it may not be cheap. In some cases this may get optimized out, but it's not clear that will always be the case. Try to avoid that cost.
2021-07-13Auto merge of #86922 - joshtriplett:target-abi, r=oli-obkbors-0/+2
target abi Implement cfg(target_abi) (RFC 2992) Add an `abi` field to `TargetOptions`, defaulting to "". Support using `cfg(target_abi = "...")` for conditional compilation on that field. Gated by `feature(cfg_target_abi)`. Add a test for `target_abi`, and a test for the feature gate. Add `target_abi` to tidy as a platform-specific cfg. Update targets to use `target_abi` All eabi targets have `target_abi = "eabi".` All eabihf targets have `target_abi = "eabihf"`. `armv6_unknown_freebsd` and `armv7_unknown_freebsd` have `target_abi = "eabihf"`. All abi64 targets have `target_abi = "abi64"`. All ilp32 targets have `target_abi = "ilp32"`. All softfloat targets have `target_abi = "softfloat"`. All *-uwp-windows-* targets have `target_abi = "uwp"`. All spe targets have `target_abi = "spe"`. All macabi targets have `target_abi = "macabi"`. aarch64-apple-ios-sim has `target_abi = "sim"`. `x86_64-fortanix-unknown-sgx` has `target_abi = "fortanix"`. `x86_64-unknown-linux-gnux32` has `target_abi = "x32"`. Add FIXME entries for targets for which existing values need to change once `cfg_target_abi` becomes stable. (All of them are tier 3 targets.) Add a test for `target_abi` in `--print cfg`.
2021-07-13Auto merge of #86857 - fee1-dead:add-attr, r=oli-obkbors-0/+1
Add #[default_method_body_is_const] `@rustbot` label F-const_trait_impl
2021-07-11Auto merge of #87042 - petrochenkov:cleanquotspan, r=Aaron1011bors-42/+29
Cleanup span quoting I finally got to reviewing https://github.com/rust-lang/rust/pull/84278. See the individual commit messages. r? `@Aaron1011`
2021-07-11Auto merge of #86416 - Amanieu:asm_clobber_only, r=nagisabors-0/+3
Add clobber-only register classes for asm! These are needed to properly express a function call ABI using a clobber list, even though we don't support passing actual values into/out of these registers.
2021-07-11rustc_span: Reorder some `ExpnData` fields in accordance with commentsVadim Petrochenkov-26/+25
A drive-by change.
2021-07-10rustc_span: Revert addition of `proc_macro` field to `ExpnKind::Macro`Vadim Petrochenkov-16/+4
The flag has a vague meaning and is used for a single diagnostic change that is low benefit and appears only under `-Z macro_backtrace`.
2021-07-10Add clobber-only register classes for asm!Amanieu d'Antras-0/+3
These are needed to properly express a function call ABI using a clobber list, even though we don't support passing actual values into/out of these registers.
2021-07-10Add #[default_method_body_is_const]Deadbeef-0/+1
2021-07-09Rollup merge of #86881 - tmiasko:lookup-line, r=nagisaMara Bos-25/+16
Inline implementation of lookup_line to avoid unnecessary conversions from `Option<usize>` to `isize` and back.
2021-07-09Auto merge of #85828 - scottmcm:raw-eq, r=oli-obkbors-0/+1
Stop generating `alloca`s & `memcmp` for simple short array equality Example: ```rust pub fn demo(x: [u16; 6], y: [u16; 6]) -> bool { x == y } ``` Before: ```llvm define zeroext i1 `@_ZN10playground4demo17h48537f7eac23948fE(i96` %0, i96 %1) unnamed_addr #0 { start: %y = alloca [6 x i16], align 8 %x = alloca [6 x i16], align 8 %.0..sroa_cast = bitcast [6 x i16]* %x to i96* store i96 %0, i96* %.0..sroa_cast, align 8 %.0..sroa_cast3 = bitcast [6 x i16]* %y to i96* store i96 %1, i96* %.0..sroa_cast3, align 8 %_11.i.i.i = bitcast [6 x i16]* %x to i8* %_14.i.i.i = bitcast [6 x i16]* %y to i8* %bcmp.i.i.i = call i32 `@bcmp(i8*` nonnull dereferenceable(12) %_11.i.i.i, i8* nonnull dereferenceable(12) %_14.i.i.i, i64 12) #2, !alias.scope !2 %2 = icmp eq i32 %bcmp.i.i.i, 0 ret i1 %2 } ``` ```x86 playground::demo: # `@playground::demo` sub rsp, 32 mov qword ptr [rsp], rdi mov dword ptr [rsp + 8], esi mov qword ptr [rsp + 16], rdx mov dword ptr [rsp + 24], ecx xor rdi, rdx xor esi, ecx or rsi, rdi sete al add rsp, 32 ret ``` After: ```llvm define zeroext i1 `@_ZN4mini4demo17h7a8994aaa314c981E(i96` %0, i96 %1) unnamed_addr #0 { start: %2 = icmp eq i96 %0, %1 ret i1 %2 } ``` ```x86 _ZN4mini4demo17h7a8994aaa314c981E: xor rcx, r8 xor edx, r9d or rdx, rcx sete al ret ```
2021-07-09Auto merge of #86904 - m-ou-se:prelude-collision-check-trait, r=nikomatsakisbors-0/+1
Check FromIterator trait impl in prelude collision check. Fixes #86902.
2021-07-08Stop generating `alloca`s+`memcmp` for simple array equalityScott McMurray-0/+1
2021-07-08Inline implementation of lookup_lineTomasz Miąsko-25/+16
to simplify the implementation and avoid unnecessary conversions from `Option<usize>` to `isize` and back.
2021-07-08Rollup merge of #86726 - ↵Guillaume Gomez-3/+2
sexxi-goose:use-diagnostic-item-for-rfc2229-migration, r=nikomatsakis Use diagnostic items instead of lang items for rfc2229 migrations This PR removes the `Send`, `UnwindSafe` and `RefUnwindSafe` lang items introduced in https://github.com/rust-lang/rust/pull/84730, and uses diagnostic items instead to check for `Send`, `UnwindSafe` and `RefUnwindSafe` traits for RFC2229 migrations. r? ```@nikomatsakis```
2021-07-08Rework SESSION_GLOBALS API to prevent overwriting itGuillaume Gomez-19/+65
2021-07-07Implement cfg(target_abi) (RFC 2992)Josh Triplett-0/+2
Add an `abi` field to `TargetOptions`, defaulting to "". Support using `cfg(target_abi = "...")` for conditional compilation on that field. Gated by `feature(cfg_target_abi)`. Add a test for `target_abi`, and a test for the feature gate. Add `target_abi` to tidy as a platform-specific cfg. This does not add an abi to any existing target.
2021-07-07Check FromIterator trait impl in prelude collision check.Mara Bos-0/+1
2021-07-06Auto merge of #86143 - bjorn3:revert_revert_merge_crate_disambiguator, ↵bors-45/+32
r=michaelwoerister Reland "Merge CrateDisambiguator into StableCrateId" Reverts https://github.com/rust-lang/rust/pull/85891 as this revert of #85804 made perf even worse. r? `@Mark-Simulacrum`
2021-07-06Revert "Revert "Merge CrateDisambiguator into StableCrateId""bjorn3-45/+32
This reverts commit 8176ab8bc18fdd7d3c2cf7f720c51166364c33a3.
2021-07-06Store macro parent module in ExpnData.Camille GILLOT-2/+10
2021-07-03Auto merge of #86778 - tmiasko:fast-multiline, r=davidtwcobors-3/+7
Avoid byte to char position conversions in `is_multiline` Converting a byte position into a char position is currently linear in the number of multibyte characters in the source code. Avoid it when checking if a range spans across lines. This makes it feasible to compile source files with a large number of multibyte characters.