about summary refs log tree commit diff
path: root/compiler
AgeCommit message (Collapse)AuthorLines
2021-07-05Auto merge of #86282 - camelid:macro_rules-matchers, r=jyn514bors-3/+3
Pretty-print macro matchers instead of using source code Fixes #86208.
2021-07-05Auto merge of #86867 - JohnTitor:convert-to-actual-assert, r=jackh726bors-1/+1
Convert `debug_assert!` to `assert!` in `Binder::dummy` This is needed for #85350 not to be passed. r? `@jackh726`
2021-07-05Rollup merge of #86862 - tmiasko:re-export-SwitchIntEdgeEffects, ↵Yuki Okushi-1/+1
r=jonas-schievink re-export SwitchIntEdgeEffects This makes it possible to use `switch_int_edge_effects` outside `rustc_mir::dataflow::impls`.
2021-07-05Rollup merge of #86477 - tlyu:e0716-clarification, r=JohnTitorYuki Okushi-2/+4
E0716: clarify that equivalent code example is erroneous In E0716, there is a code block that is equivalent to the erroneous code example. Especially when viewed with `rustc --explain`, it's not obvious that it is also erroneous, and some users have been confused when they try to change their code to match the erroneous equivalent. `@rustbot` label +A-diagnostics +D-newcomer-roadblock +T-compiler
2021-07-04Auto merge of #86866 - nikomatsakis:issue-84841, r=oli-obkbors-57/+87
Hack: Ignore inference variables in certain queries Fixes #84841 Fixes #86753 Some queries are not built to accept types with inference variables, which can lead to ICEs. These queries probably ought to be converted to canonical form, but as a quick workaround, we can return conservative results in the case that inference variables are found. We should file a follow-up issue (and update the FIXMEs...) to do the proper refactoring. cc `@arora-aman` r? `@oli-obk`
2021-07-04remove outdated commentNiko Matsakis-2/+0
2021-07-04tag issues with FIXMENiko Matsakis-2/+2
2021-07-04Update compiler/rustc_middle/src/ty/normalize_erasing_regions.rsNiko Matsakis-1/+1
Co-authored-by: Rémy Rakic <remy.rakic+github@gmail.com>
2021-07-05Convert `debug_assert!` to `assert!` in `Binder::dummy`Yuki Okushi-1/+1
This is needed for #85350 not to be passed.
2021-07-04remove some ad-hoc has_infer_types checks that aren't needed anymoreNiko Matsakis-26/+17
2021-07-04be conservative in has_significant_dropNiko Matsakis-0/+9
2021-07-04allow inference vars in type_implements_traitNiko Matsakis-19/+49
2021-07-04remove unused OptionNiko Matsakis-18/+11
2021-07-04E0716: clarify that equivalent code example is erroneousTaylor Yu-2/+4
In E0716, there is a code block that is equivalent to the erroneous code example. Especially when viewed with `rustc --explain`, it's not obvious that it is also erroneous, and some users have been confused when they try to change their code to match the erroneous equivalent.
2021-07-04re-export SwitchIntEdgeEffectsTomasz Miąsko-1/+1
This makes it possible to use `switch_int_edge_effects` outside `rustc_mir::dataflow::impls`.
2021-07-04Auto merge of #86255 - Smittyvb:mir-alloc-oom, r=RalfJung,oli-obkbors-21/+63
Support allocation failures when interpreting MIR This closes #79601 by handling the case where memory allocation fails during MIR interpretation, and translates that failure into an `InterpError`. The error message is "tried to allocate more memory than available to compiler" to make it clear that the memory shortage is happening at compile-time by the compiler itself, and that it is not a runtime issue. Now that memory allocation can fail, it would be neat if Miri could simulate low-memory devices to make it easy to see how much memory a Rust program needs. Note that this breaks Miri because it assumes that allocation can never fail.
2021-07-04Auto merge of #86849 - jyn514:rustdoc-group, r=Manishearthbors-16/+0
Warn when `rustdoc::` group is omitted from lint names When rustdoc lints were first made a tool lint, they gave an unconditional warning when you used the original name: ``` warning: lint `broken_intra_doc_links` has been renamed to `rustdoc::broken_intra_doc_links` --> $DIR/renamed-lint-still-applies.rs:2:9 | LL | #![deny(broken_intra_doc_links)] | ^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `rustdoc::broken_intra_doc_links` | = note: `#[warn(renamed_and_removed_lints)]` on by default ``` That was reverted in https://github.com/rust-lang/rust/pull/83203 because adding `rustdoc::x` lints would cause the code to break on old versions of the compiler (due to https://github.com/rust-lang/rust/issues/66079#issuecomment-788589193, "fixed" in https://github.com/rust-lang/rust/pull/83216 in the sense that you can now opt-in to not breaking on nightly, which is not ideal but `register_tool` is a long way from stabilizing). Since https://github.com/rust-lang/rust/pull/80527 is now on 1.52.0 stable, we can re-enable the warning. For nightly users, they can change immediately and still have their code work on stable; for stable users, they can change their code in 12 weeks and still have it work up to 3 releases back (about 18 weeks). That seems reasonable to me. r? `@Manishearth` cc `@rust-lang/rustdoc`
2021-07-03introduce helper functionNiko Matsakis-4/+13
2021-07-03rustc_ast_pretty: Don't print space after `$`Noah Lev-3/+3
For example, this code: $arg:expr used to be pretty-printed as: $ arg : expr but is now pretty-printed as: $arg : expr
2021-07-03Auto merge of #85090 - Aaron1011:type-outlives-global, r=matthewjasper,jackh726bors-1/+9
Return `EvaluatedToOk` when type in outlives predicate is global A global type doesn't reference any local regions or types, so it's guaranteed to outlive any region.
2021-07-03Warn when `rustdoc::` group is omitted from lint namesJoshua Nelson-16/+0
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.
2021-07-03add note about MAX_ALLOC_LIMITSmittyvb-1/+1
Co-authored-by: Ralf Jung <post@ralfj.de>
2021-07-03Make vtable_allocation always succeedSmitty-14/+9
2021-07-03Auto merge of #86571 - fee1-dead:const-trait-impl-fix, r=jackh726bors-0/+63
deny using default function in impl const Trait Fixes #79450. I don't know if my implementation is correct: - The check is in `rustc_passes::check_const`, should I put it somewhere else instead? - Is my approach (to checking the impl) optimal? It works for the current tests, but it might have some issues or there might be a better way of doing this.
2021-07-03Auto merge of #86795 - JohnTitor:fix-bind, r=jackh726bors-125/+138
Fix const-generics ICE related to binding Fixes #83765, fixes #85848 r? `@jackh726` as you're familiar with `Binding`. I'd like to get some views if the current approach is right path.
2021-07-02Allocation failure in constprop panics right awaySmitty-3/+12
2021-07-02Auto merge of #86817 - JohnTitor:rollup-rcysc95, r=JohnTitorbors-5/+37
Rollup of 7 pull requests Successful merges: - #84029 (add `track_path::path` fn for usage in `proc_macro`s) - #85001 (Merge `sys_common::bytestring` back into `os_str_bytes`) - #86308 (Docs: clarify that certain intrinsics are not unsafe) - #86796 (Add a regression test for issue-70703) - #86803 (Remove & from Command::args calls in documentation) - #86807 (Fix double import in wasm thread ) - #86813 (Add a help message to `unused_doc_comments` lint) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2021-07-03Rollup merge of #86813 - JohnTitor:unused-doc-comments-help, r=jackh726Yuki Okushi-2/+13
Add a help message to `unused_doc_comments` lint Fixes #83492 This adds a help message to suggest a plain comment like the E0658 error. I've yet to come up with the best message about the doc attribute but the current shouldn't harm anything. I was thinking of recovering in the `doc_comment_between_if_else` case, but I came to the conclusion that it unlikely happened and was an overkill.
2021-07-03Rollup merge of #86308 - bstrie:intrinsafe, r=JohnTitorYuki Okushi-0/+4
Docs: clarify that certain intrinsics are not unsafe As determined by the hardcoded list at https://github.com/rust-lang/rust/blob/003b8eadd7a476c51956fe447894532d6e21937e/compiler/rustc_typeck/src/check/intrinsic.rs#L59-L92
2021-07-03Rollup merge of #84029 - drahnr:master, r=petrochenkovYuki Okushi-3/+20
add `track_path::path` fn for usage in `proc_macro`s Adds a way to declare a dependency on external files without including them, to either re-trigger the build of a file as well as covering the use case of including dependencies within the `rustc` invocation, such that tools like `sccache`/`cachepot` are able to handle references to external files which are not included. Ref #73921
2021-07-03Simplify `visit_region` implementationYuki Okushi-14/+4
2021-07-02Auto merge of #85269 - dpaoliello:dpaoliello/DebugSymbols, r=michaelwoeristerbors-135/+310
Improve debug symbol names to avoid ambiguity and work better with MSVC's debugger There are several cases where names of types and functions in the debug info are either ambiguous, or not helpful, such as including ambiguous placeholders (e.g., `{{impl}}`, `{{closure}}` or `dyn _'`) or dropping qualifications (e.g., for dynamic types). Instead, each debug symbol name should be unique and useful: * Include disambiguators for anonymous `DefPathDataName` (closures and generators), and unify their formatting when used as a path-qualifier vs item being qualified. * Qualify the principal trait for dynamic types. * If there is no principal trait for a dynamic type, emit all other traits instead. * Respect the `qualified` argument when emitting ref and pointer types. * For implementations, emit the disambiguator. * Print const generics when emitting generic parameters or arguments. Additionally, when targeting MSVC, its debugger treats many command arguments as C++ expressions, even when the argument is defined to be a symbol name. As such names in the debug info need to be more C++-like to be parsed correctly: * Avoid characters with special meaning (`#`, `[`, `"`, `+`). * Never start a name with `<` or `{` as this is treated as an operator. * `>>` is always treated as a right-shift, even when parsing generic arguments (so add a space to avoid this). * Emit function declarations using C/C++ style syntax (e.g., leading return type). * Emit arrays as a synthetic `array$<type, size>` type. * Include a `$` in all synthetic types as this is a legal character for C++, but not Rust (thus we avoid collisions with user types).
2021-07-03Remove `ty::Binder::bind()`Yuki Okushi-122/+26
Co-authored-by: Noah Lev <camelidcamel@gmail.com>
2021-07-03Correct `visit_region` implementationYuki Okushi-1/+26
2021-07-03Use `BoundVarsCollector` for nowYuki Okushi-10/+97
2021-07-03Fix const-generics ICE related to bindingYuki Okushi-1/+8
2021-07-03Add a help message to `unused_doc_comments` lintYuki Okushi-2/+13
2021-07-02Rollup merge of #86776 - tmiasko:v0-skip-layout-query, r=petrochenkovGuillaume Gomez-5/+5
Skip layout query when computing integer type size during mangling
2021-07-02Auto merge of #80182 - in42:stack_trace, r=tmandrybors-0/+50
Implement printing of stack traces on LLVM segfaults and aborts Implement #79153 Based on discussion, try to extend the rust_backtrace=1 feature to handle segfault or aborts in the llvm backend
2021-07-02add track_path::path fn for proc-macro usageBernhard Schuster-3/+20
Ref #73921
2021-07-02Use signal handler only on supported platformsTyler Mandry-37/+42
2021-07-02Auto merge of #86777 - tmiasko:estimate-terminators, r=estebankbors-1/+1
Include terminators in instance size estimate For example, drop glue generated for struct below, doesn't have any statements, only terminators. Previously it received an estimate of 0, the new estimate is 13 (6+5 drop terminators, +1 resume, +1 return). ```rust struct S { a: String, b: String, c: String, d: String, e: String, f: String, } ``` Originally reported in https://github.com/rust-lang/rust/issues/69382#issue-569392141
2021-07-01Auto merge of #86791 - JohnTitor:rollup-96ltzpz, r=JohnTitorbors-30/+41
Rollup of 7 pull requests Successful merges: - #86148 (Check the number of generic lifetime and const parameters of intrinsics) - #86659 (fix(rustdoc): generics search) - #86768 (Add myself to mailmap) - #86775 (Test for const trait impls behind feature gates) - #86779 (Allow anyone to add or remove any label starting with perf-) - #86783 (Move Mutex::unlock to T: ?Sized) - #86785 (proc_macro/bridge: Remove dead code Slice type) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2021-07-02Rollup merge of #86148 - FabianWolff:issue-85855, r=varkorYuki Okushi-30/+41
Check the number of generic lifetime and const parameters of intrinsics This pull request fixes #85855. The current code for type checking intrinsics only checks the number of generic _type_ parameters, but does not check for an incorrect number of lifetime or const parameters, which can cause problems later on, such as the ICE in #85855, where the code thought that it was looking at a type parameter but found a lifetime parameter: ``` error: internal compiler error: compiler/rustc_middle/src/ty/generics.rs:188:18: expected type parameter, but found another generic parameter ``` The changes in this PR add checks for the number of lifetime and const parameters, expand the scope of `E0094` to also apply to these cases, and improve the error message by properly pluralizing the number of expected generic parameters.
2021-07-01Auto merge of #86749 - bjorn3:link_info_refactor_part1, r=petrochenkovbors-27/+23
Rename all_crate_nums query to crates and remove useless wrapper Split out of https://github.com/rust-lang/rust/pull/86105 r? `@petrochenkov`
2021-07-01Update cdb tests for expected outputWesley Wiser-2/+12
Also an fix issue with tuple type names where we can't cast to them in natvis (required by the visualizer for `HashMap`) because of peculiarities with the natvis expression evaluator.
2021-07-01Auto merge of #86304 - klensy:hex-length, r=jackh726bors-1/+21
rustc_mir: calc hex number length without string allocation
2021-07-01Minor adjustments and refactoringFabian Wolff-56/+26
2021-07-01rustc_mir: calc hex number length without string allocationklensy-1/+21