about summary refs log tree commit diff
path: root/compiler/rustc_span/src
AgeCommit message (Collapse)AuthorLines
2020-10-28Rollup merge of #78447 - bugadani:typo, r=matthewjasperDylan DPC-2/+2
Fix typo in comment I hope I got all the typos in that word. :)
2020-10-28Rollup merge of #78152 - spastorino:separate-unsized-locals, r=oli-obkDylan DPC-0/+1
Separate unsized locals Closes #71694 Takes over again #72029 and #74971 cc @RalfJung @oli-obk @pnkfelix @eddyb as they've participated in previous reviews of this PR.
2020-10-27Auto merge of #75671 - nathanwhit:cstring-temp-lint, r=oli-obkbors-0/+7
Uplift `temporary-cstring-as-ptr` lint from `clippy` into rustc The general consensus seems to be that this lint covers a common enough mistake to warrant inclusion in rustc. The diagnostic message might need some tweaking, as I'm not sure the use of second-person perspective matches the rest of rustc, but I'd like to hear others' thoughts on that. (cc #53224). r? `@oli-obk`
2020-10-27rustc_span: represent line bounds with RangeTyson Nottingham-30/+24
2020-10-27Add unsized_fn_params featureSantiago Pastorino-0/+1
2020-10-27Fix typo in commentDániel Buga-2/+2
2020-10-27Changed lint to check for `std::fmt::Pointer` and `transmute`Ayrton-0/+2
The lint checks arguments in calls to `transmute` or functions that have `Pointer` as a trait bound and displays a warning if the argument is a function reference. Also checks for `std::fmt::Pointer::fmt` to handle formatting macros although it doesn't depend on the exact expansion of the macro or formatting internals. `std::fmt::Pointer` and `std::fmt::Pointer::fmt` were also added as diagnostic items and symbols.
2020-10-27Show the inline stack of MIR lints that only occur after inliningOliver Scherer-0/+3
2020-10-27Rollup merge of #78396 - josephlr:ermsb, r=petrochenkovYuki Okushi-0/+1
Add compiler support for LLVM's x86_64 ERMSB feature This change is needed for compiler-builtins to check for this feature when implementing memcpy/memset. See: https://github.com/rust-lang/compiler-builtins/pull/365 Without this change, the following code compiles, but does nothing: ```rust #[cfg(target_feature = "ermsb")] pub unsafe fn ermsb_memcpy() { ... } ``` The change just does compile-time detection. I think that runtime detection will have to come in a follow-up CL to std-detect. Like all the CPU feature flags, this just references #44839 Signed-off-by: Joe Richey <joerichey@google.com>
2020-10-26rustc_span: improve bounds checks in byte_pos_to_line_and_colTyson Nottingham-4/+39
The effect of this change is to consider edge-case spans that start or end at the position one past the end of a file to be valid during span hashing and encoding. This change means that these spans will be preserved across incremental compilation sessions when they are part of a serialized query result, instead of causing the dummy span to be used.
2020-10-26Address review commentsNathan Whitaker-0/+1
2020-10-26Address review commentsNathan Whitaker-0/+6
2020-10-26rustc_span: avoid hashing ExpnId tag when using cached hashTyson Nottingham-2/+1
2020-10-26Add compiler support for LLVM's x86 ERMSB featureJoe Richey-0/+1
This change is needed for compiler-builtins to check for this feature when implementing memcpy/memset. See: https://github.com/rust-lang/compiler-builtins/pull/365 The change just does compile-time detection. I think that runtime detection will have to come in a follow-up CL to std-detect. Like all the CPU feature flags, this just references #44839 Signed-off-by: Joe Richey <joerichey@google.com>
2020-10-25Rollup merge of #78208 - liketechnik:issue-69399, r=oli-obkYuki Okushi-0/+1
replace `#[allow_internal_unstable]` with `#[rustc_allow_const_fn_unstable]` for `const fn`s `#[allow_internal_unstable]` is currently used to side-step feature gate and stability checks. While it was originally only meant to be used only on macros, its use was expanded to `const fn`s. This pr adds stricter checks for the usage of `#[allow_internal_unstable]` (only on macros) and introduces the `#[rustc_allow_const_fn_unstable]` attribute for usage on `const fn`s. This pr does not change any of the functionality associated with the use of `#[allow_internal_unstable]` on macros or the usage of `#[rustc_allow_const_fn_unstable]` (instead of `#[allow_internal_unstable]`) on `const fn`s (see https://github.com/rust-lang/rust/issues/69399#issuecomment-712911540). Note: The check for `#[rustc_allow_const_fn_unstable]` currently only validates that the attribute is used on a function, because I don't know how I would check if the function is a `const fn` at the place of the check. I therefore openend this as a 'draft pull request'. Closes rust-lang/rust#69399 r? @oli-obk
2020-10-22Fix const core::panic!(non_literal_str).Mara Bos-0/+1
2020-10-21add rustc_allow_const_fn_unstable attributeFlorian Warzecha-0/+1
allow_internal_unstable is currently used to side-step feature gate and stability checks. While it was originally only meant to be used only on macros, its use was expanded to const functions. This commit prepares stricter checks for the usage of allow_internal_unstable (only on macros) and introduces the rustc_allow_const_fn_unstable attribute for usage on functions. See rust-lang/rust#69399
2020-10-16Add inline_const feature flagSantiago Pastorino-0/+1
2020-10-15Rollup merge of #77739 - est31:remove_unused_code, r=petrochenkov,varkorYuki Okushi-23/+0
Remove unused code Rustc has a builtin lint for detecting unused code inside a crate, but when an item is marked `pub`, the code, even if unused inside the entire workspace, is never marked as such. Therefore, I've built [warnalyzer](https://github.com/est31/warnalyzer) to detect unused items in a cross-crate setting. Closes https://github.com/est31/warnalyzer/issues/2
2020-10-14Add support for SHA256 source file hashing for LLVM 11+.Arlo Siemsen-1/+8
2020-10-14Remove unused code from rustc_spanest31-23/+0
2020-10-11Add hack to keep `actix-web` and `actori-web` compilingAaron Hill-0/+1
This extends the existing `ident_name_compatibility_hack` to handle the `tuple_from_req` macro defined in `actix-web` (and its fork `actori-web`).
2020-10-09Auto merge of #77687 - est31:hash_shorter_path, r=davidtwcobors-6/+6
Use shorter path for std::hash::Hash
2020-10-08Implement the instruction_set attributexd009642-0/+5
2020-10-08Use shorter path for std::hash::Hashest31-6/+6
2020-10-07Auto merge of #77464 - ecstatic-morse:const-fn-impl-trait, r=oli-obkbors-0/+1
Give `impl Trait` in a `const fn` its own feature gate ...previously it was gated under `#![feature(const_fn)]`. I think we actually want to do this in all const-contexts? If so, this should be `#![feature(const_impl_trait)]` instead. I don't think there's any way to make use of `impl Trait` within a `const` initializer. cc #77463 r? `@oli-obk`
2020-10-07Rollup merge of #76784 - lzutao:rd_doc, r=GuillaumeGomezDylan DPC-0/+1
Add some docs to rustdoc::clean::inline and def_id functions Split from #76571 .
2020-10-06Add some docs to rustdoc::clean::inline and def_id functionsLzu Tao-0/+1
Co-authored-by: Joshua Nelson <joshua@yottadb.com>
2020-10-05Remove `fn` from feature nameDylan MacKenzie-1/+1
2020-10-05Add `#![feature(const_fn_impl)]`Dylan MacKenzie-0/+1
2020-10-05Updates to experimental coverage counter injectionRich Kadel-67/+96
This is a combination of 18 commits. Commit #2: Additional examples and some small improvements. Commit #3: fixed mir-opt non-mir extensions and spanview title elements Corrected a fairly recent assumption in runtest.rs that all MIR dump files end in .mir. (It was appending .mir to the graphviz .dot and spanview .html file names when generating blessed output files. That also left outdated files in the baseline alongside the files with the incorrect names, which I've now removed.) Updated spanview HTML title elements to match their content, replacing a hardcoded and incorrect name that was left in accidentally when originally submitted. Commit #4: added more test examples also improved Makefiles with support for non-zero exit status and to force validation of tests unless a specific test overrides it with a specific comment. Commit #5: Fixed rare issues after testing on real-world crate Commit #6: Addressed PR feedback, and removed temporary -Zexperimental-coverage -Zinstrument-coverage once again supports the latest capabilities of LLVM instrprof coverage instrumentation. Also fixed a bug in spanview. Commit #7: Fix closure handling, add tests for closures and inner items And cleaned up other tests for consistency, and to make it more clear where spans start/end by breaking up lines. Commit #8: renamed "typical" test results "expected" Now that the `llvm-cov show` tests are improved to normally expect matching actuals, and to allow individual tests to override that expectation. Commit #9: test coverage of inline generic struct function Commit #10: Addressed review feedback * Removed unnecessary Unreachable filter. * Replaced a match wildcard with remining variants. * Added more comments to help clarify the role of successors() in the CFG traversal Commit #11: refactoring based on feedback * refactored `fn coverage_spans()`. * changed the way I expand an empty coverage span to improve performance * fixed a typo that I had accidently left in, in visit.rs Commit #12: Optimized use of SourceMap and SourceFile Commit #13: Fixed a regression, and synched with upstream Some generated test file names changed due to some new change upstream. Commit #14: Stripping out crate disambiguators from demangled names These can vary depending on the test platform. Commit #15: Ignore llvm-cov show diff on test with generics, expand IO error message Tests with generics produce llvm-cov show results with demangled names that can include an unstable "crate disambiguator" (hex value). The value changes when run in the Rust CI Windows environment. I added a sed filter to strip them out (in a prior commit), but sed also appears to fail in the same environment. Until I can figure out a workaround, I'm just going to ignore this specific test result. I added a FIXME to follow up later, but it's not that critical. I also saw an error with Windows GNU, but the IO error did not specify a path for the directory or file that triggered the error. I updated the error messages to provide more info for next, time but also noticed some other tests with similar steps did not fail. Looks spurious. Commit #16: Modify rust-demangler to strip disambiguators by default Commit #17: Remove std::process::exit from coverage tests Due to Issue #77553, programs that call std::process::exit() do not generate coverage results on Windows MSVC. Commit #18: fix: test file paths exceeding Windows max path len
2020-10-02Implement Make `handle_alloc_error` default to panic (for no_std + liballoc)Harald Hoyer-0/+1
Related: https://github.com/rust-lang/rust/issues/66741 Guarded with `#![feature(default_alloc_error_handler)]` a default `alloc_error_handler` is called, if a custom allocator is used and no other custom `#[alloc_error_handler]` is defined. The panic message does not contain the size anymore, because it would pull in the fmt machinery, which would blow up the code size significantly.
2020-09-30Add support for cmse_nonsecure_entry attributeHugues de Valon-0/+1
This patch adds support for the LLVM cmse_nonsecure_entry attribute. This is a target-dependent attribute that only has sense for the thumbv8m Rust targets. You can find more information about this attribute here: https://developer.arm.com/documentation/ecm0359818/latest/ Signed-off-by: Hugues de Valon <hugues.devalon@arm.com>
2020-09-28Rollup merge of #77170 - ecstatic-morse:const-fn-ptr, r=oli-obkRalf Jung-1/+1
Remove `#[rustc_allow_const_fn_ptr]` and add `#![feature(const_fn_fn_ptr_basics)]` `rustc_allow_const_fn_ptr` was a hack to work around the lack of an escape hatch for the "min `const fn`" checks in const-stable functions. Now that we have co-opted `allow_internal_unstable` for this purpose, we no longer need a bespoke attribute. Now this functionality is gated under `const_fn_fn_ptr_basics` (how concise!), and `#[allow_internal_unstable(const_fn_fn_ptr_basics)]` replaces `#[rustc_allow_const_fn_ptr]`. `const_fn_fn_ptr_basics` allows function pointer types to appear in the arguments and locals of a `const fn` as well as function pointer casts to be performed inside a `const fn`. Both of these were allowed in constants and statics already. Notably, this does **not** allow users to invoke function pointers in a const context. Presumably, we will use a nicer name for that (`const_fn_ptr`?). r? @oli-obk
2020-09-27Remove `rustc_allow_const_fn_ptr`Dylan MacKenzie-1/+0
This was a hack to work around the lack of an escape hatch for the "min `const fn`" checks in const-stable functions. Now that we have co-opted `allow_internal_unstable` for this purpose, we no longer need the bespoke attribute.
2020-09-27Add a feature gate for basic function pointer use in `const fn`Dylan MacKenzie-0/+1
2020-09-27Rollup merge of #77263 - bugadani:cleanup, r=lcnrJonas Schievink-1/+1
Clean up trivial if let
2020-09-27Rollup merge of #77256 - jyn514:typo, r=Aaron1011Jonas Schievink-1/+1
Fix typo in ExpnData documentation This mis-highlighted the entire documentation as code: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_span/hygiene/struct.ExpnData.html#structfield.krate
2020-09-27Clean up trivial if letDániel Buga-1/+1
2020-09-27Fix typo in ExpnData documentationJoshua Nelson-1/+1
This mis-highlighted the entire documentation as code.
2020-09-26Rollup merge of #77122 - ecstatic-morse:const-fn-arithmetic, r=RalfJung,oli-obkRalf Jung-0/+1
Add `#![feature(const_fn_floating_point_arithmetic)]` cc #76618 This is a template for splitting up `const_fn` into granular feature gates. I think this will make it easier, both for us and for users, to track stabilization of each individual feature. We don't *have* to do this, however. We could also keep stabilizing things out from under `const_fn`. cc @rust-lang/wg-const-eval r? @oli-obk
2020-09-25Remove now unused `double_braced_*` symbolsmarmeladema-7/+0
2020-09-25Move from {{closure}}#0 syntax to {closure#0} for (def) path componentsmarmeladema-0/+4
2020-09-25Add `const_fn_floating_point_arithmetic`Dylan MacKenzie-0/+1
2020-09-25Rollup merge of #77121 - duckymirror:html-root-url, r=jyn514Jonas Schievink-1/+1
Updated html_root_url for compiler crates Closes #77103 r? @jyn514
2020-09-23/nightly/nightly-rustcErik Hofmayer-1/+1
2020-09-23Updated html_root_url for compiler cratesErik Hofmayer-1/+1
2020-09-23Rollup merge of #76994 - yuk1ty:fix-small-typo, r=estebankDylan DPC-1/+1
fix small typo in docs and comments Fixed `the the` to `the`, as far as I found.
2020-09-23Rollup merge of #76965 - fusion-engineering-forks:fix-atomic-from-mut, r=AmanieuDylan DPC-0/+1
Add cfg(target_has_atomic_equal_alignment) and use it for Atomic::from_mut. Fixes some platform-specific problems with #74532 by using the actual alignment of the types instead of hardcoding a few `target_arch`s. r? @RalfJung
2020-09-21Remove cast to usize for BytePos and CharPosJames Whaley-2/+2
The case shouldn't be necessary and implicitly truncating BytePos is not desirable.