about summary refs log tree commit diff
path: root/src/librustc_hir
AgeCommit message (Collapse)AuthorLines
2020-06-20Remove `NodeId` to `HirId` conversion APIsmarmeladema-11/+1
2020-06-20Move `trait_map` into `hir::Crate`marmeladema-1/+3
2020-06-19Rollup merge of #73357 - petrochenkov:tmap, r=davidtwcoManish Goregaokar-16/+3
Use `LocalDefId` for import IDs in trait map cc https://github.com/rust-lang/rust/pull/73291#discussion_r439734867
2020-06-19Rollup merge of #73261 - estebank:generics-sized, r=nikomatsakisManish Goregaokar-8/+2
Suggest `?Sized` when applicable for ADTs Address #71790, fix #27964.
2020-06-19Rollup merge of #73011 - richkadel:llvm-count-from-mir-pass, r=tmandryRalf Jung-0/+2
first stage of implementing LLVM code coverage This PR replaces #70680 (WIP toward LLVM Code Coverage for Rust) since I am re-implementing the Rust LLVM code coverage feature in a different part of the compiler (in MIR pass(es) vs AST). This PR updates rustc with `-Zinstrument-coverage` option that injects the llvm intrinsic `instrprof.increment()` for code generation. This initial version only injects counters at the top of each function, and does not yet implement the required coverage map. Upcoming PRs will add the coverage map, and add more counters and/or counter expressions for each conditional code branch. Rust compiler MCP https://github.com/rust-lang/compiler-team/issues/278 Relevant issue: #34701 - Implement support for LLVMs code coverage instrumentation ***[I put together some development notes here, under a separate branch.](https://github.com/richkadel/rust/blob/cfa0b21d34ee64e4ebee226101bd2ef0c6757865/src/test/codegen/coverage-experiments/README-THIS-IS-TEMPORARY.md)***
2020-06-15Suggest `?Sized` when applicable for ADTsEsteban Küber-8/+2
Fix #71790.
2020-06-15[WIP] injects llvm intrinsic instrprof.increment for coverage reportsRich Kadel-0/+2
This initial version only injects counters at the top of each function. Rust Coverage will require injecting additional counters at each conditional code branch.
2020-06-15Expand "recursive opaque type" diagnosticEsteban Küber-0/+12
Fix #70968, partially address #66523.
2020-06-15Use `LocalDefId` for import IDs in trait mapVadim Petrochenkov-16/+3
2020-06-15Rollup merge of #72707 - matthewjasper:rustc_min_spec, r=oli-obkRalf Jung-35/+35
Use min_specialization in the remaining rustc crates This adds a lot of `transmute` calls to replace the unsound uses of specialization. It's ugly, but at least it's honest about what's going on. cc #71420, @RalfJung
2020-06-15Auto merge of #72080 - matthewjasper:uniform-impl-trait, r=nikomatsakisbors-24/+11
Clean up type alias impl trait implementation - Removes special case for top-level impl trait - Removes associated opaque types - Forbid lifetime elision in let position impl trait. This is consistent with the behavior for inferred types. - Handle lifetimes in type alias impl trait more uniformly with other parameters cc #69323 cc #63063 Closes #57188 Closes #62988 Closes #69136 Closes #73061
2020-06-12Rollup merge of #73178 - petrochenkov:explint, r=varkorDylan DPC-0/+6
expand: More precise locations for expansion-time lints First commit: a macro expansion doesn't have a `NodeId` associated with it, but it has a parent `DefId` which we can use for linting. The observable effect is that lints associated with macro expansions can now be `allow`ed at finer-grained level than whole crate. Second commit: each macro definition has a `NodeId` which we can use for linting, unless that macro definition was decoded from other crate.
2020-06-11Rename `TyKind::Def` to `OpaqueDef`Matthew Jasper-6/+6
2020-06-11Forbid lifetime elision in let position impl TraitMatthew Jasper-1/+3
This is consistent with types.
2020-06-11Remove associated opaque typesMatthew Jasper-17/+2
They're unused now.
2020-06-10Track span of function in method calls, and use this in #[track_caller]Aaron Hill-3/+5
Fixes #69977 When we parse a chain of method calls like `foo.a().b().c()`, each `MethodCallExpr` gets assigned a span that starts at the beginning of the call chain (`foo`). While this is useful for diagnostics, it means that `Location::caller` will return the same location for every call in a call chain. This PR makes us separately record the span of the function name and arguments for a method call (e.g. `b()` in `foo.a().b().c()`). This `Span` is passed through HIR lowering and MIR building to `TerminatorKind::Call`, where it is used in preference to `Terminator.source_info.span` when determining `Location::caller`. This new span is also useful for diagnostics where we want to emphasize a particular method call - for an example, see https://github.com/rust-lang/rust/pull/72389#discussion_r436035990
2020-06-10Use min_specialization in the remaining rustc cratesMatthew Jasper-35/+35
2020-06-09expand: Give reasonable NodeIds to lints associated with macro expansionsVadim Petrochenkov-0/+6
2020-06-06Auto merge of #72927 - petrochenkov:rustc, r=Mark-Simulacrumbors-1/+1
Rename all remaining compiler crates to use the `rustc_foo` pattern libarena -> librustc_arena libfmt_macros -> librustc_parse_format libgraphviz -> librustc_graphviz libserialize -> librustc_serialize Closes https://github.com/rust-lang/rust/issues/71177 in particular.
2020-06-04Remove unsused `NodeId` related APIs in hir mapmarmeladema-0/+6
2020-06-02Make things build againVadim Petrochenkov-1/+1
2020-05-31Rollup merge of #72715 - estebank:trailing-comma-where, r=petrochenkovRalf Jung-0/+7
Account for trailing comma when suggesting `where` clauses Fix #72693.
2020-05-30Rollup merge of #72625 - Amanieu:asm-srcloc, r=petrochenkovRalf Jung-0/+1
Improve inline asm error diagnostics Previously we were just using the raw LLVM error output (with line, caret, etc) as the diagnostic message, which ends up looking rather out of place with our existing diagnostics. The new diagnostics properly format the diagnostics and also take advantage of LLVM's per-line `srcloc` attribute to map an error in inline assembly directly to the relevant line of source code. Incidentally also fixes #71639 by disabling `srcloc` metadata during LTO builds since we don't know what crate it might have come from. We can only resolve `srcloc`s from the currently crate since it indexes into the source map for the current crate. Fixes #72664 Fixes #71639 r? @petrochenkov ### Old style ```rust #![feature(llvm_asm)] fn main() { unsafe { let _x: i32; llvm_asm!( "mov $0, $1 invalid_instruction $0, $1 mov $0, $1" : "=&r" (_x) : "r" (0) :: "intel" ); } } ``` ``` error: <inline asm>:3:14: error: invalid instruction mnemonic 'invalid_instruction' invalid_instruction ecx, eax ^~~~~~~~~~~~~~~~~~~ --> src/main.rs:6:9 | 6 | / llvm_asm!( 7 | | "mov $0, $1 8 | | invalid_instruction $0, $1 9 | | mov $0, $1" ... | 12 | | :: "intel" 13 | | ); | |__________^ ``` ### New style ```rust #![feature(asm)] fn main() { unsafe { asm!( "mov {0}, {1} invalid_instruction {0}, {1} mov {0}, {1}", out(reg) _, in(reg) 0i64, ); } } ``` ``` error: invalid instruction mnemonic 'invalid_instruction' --> test.rs:7:14 | 7 | invalid_instruction {0}, {1} | ^ | note: instantiated into assembly here --> <inline asm>:3:14 | 3 | invalid_instruction rax, rcx | ^^^^^^^^^^^^^^^^^^^ ```
2020-05-29Remove remaining calls to `as_local_node_id`marmeladema-11/+0
2020-05-29Move common code to `WhereClause`Esteban Küber-0/+7
2020-05-29Improve inline asm error diagnosticsAmanieu d'Antras-0/+1
2020-05-27Store `LocalDefId` directly in `rustc_resolve::Resolver` where possiblemarmeladema-5/+0
This commit also include the following changes: * Remove unused `hir::Map::as_local_node_id` method * Remove outdated comment about `hir::Map::local_def_id` method * Remove confusing `GlobMap` type alias * Use `LocalDefId` instead of `DefId` in `extern_crate_map` * Use `LocalDefId` instead of `DefId` in `maybe_unused_extern_crates` * Modify `extern_mod_stmt_cnum` query to accept a `LocalDefId` instead of a `DefId`
2020-05-25Rollup merge of #72450 - csmoe:issue-72442, r=oli-obkDylan DPC-0/+2
Fix ice-#72442 Closes #72442 Closes #72426 r? @oli-obk
2020-05-22only try to suggest for try trait_refcsmoe-0/+2
2020-05-21Use `HirId` as key for `ResolverOutputs::trait_map` instead of `NodeId`marmeladema-1/+3
2020-05-21Auto merge of #70705 - lcnr:generic_discriminant, r=nikomatsakisbors-0/+1
Use `T`'s discriminant type in `mem::Discriminant<T>` instead of `u64`. fixes #70509 Adds the lang-item `discriminant_kind`. Updates the function signature of `intrinsics::discriminant_value`. Adds the *probably permanently unstable* trait `DiscriminantKind`. `mem::Discriminant` should now be smaller in some cases. r? @ghost
2020-05-19update libcore, add `discriminant_kind` lang-itemBastian Kauschke-0/+1
2020-05-18Move InlineAsmTemplatePiece and InlineAsmOptions to librustc_astAmanieu d'Antras-2/+3
2020-05-18Implement AST lowering for asm!Amanieu d'Antras-1/+4
2020-05-18Add asm! to HIRAmanieu d'Antras-0/+75
2020-05-10use min_specialization for some rustc crates where it requires no changesRalf Jung-1/+1
2020-05-09Rollup merge of #71555 - cjgillot:nameless, r=matthewjasperRalf Jung-11/+12
Remove ast::{Ident, Name} reexports. The reexport of `Symbol` into `Name` confused me.
2020-05-08Rollup merge of #71989 - ecstatic-morse:const-context-enum, r=oli-obkDylan DPC-0/+47
Use a single enum for the kind of a const context This adds a `ConstContext` enum to the `rustc_hir` crate and method that can be called via `tcx.hir()` to get the `ConstContext` for a given body owner. This arose from discussion in #71824. r? @oli-obk
2020-05-08Remove ast::{Ident, Name} reexports.Camille GILLOT-11/+12
2020-05-07Add `hir::ConstContext`Dylan MacKenzie-0/+47
2020-05-04review comments: use or-patternEsteban Küber-3/+7
2020-05-04Handle binop on unbound type paramEsteban Küber-0/+30
When encountering a binary operation involving a type parameter that has no bindings, suggest adding the appropriate bound.
2020-05-02fix rustdoc warningsTshepang Lekhonkhobe-2/+2
2020-05-01fix doc referenceTshepang Lekhonkhobe-1/+1
Should of been in e0ce9f8c0a97e5949c9cadd220279d6969289daa, but that had a typo.
2020-04-26Fix broken link in `QPath` documentationLeSeulArtichaut-1/+1
2020-04-26Rollup merge of #70043 - mark-i-m:def-kind-more, r=eddybDylan DPC-32/+38
Add all remaining `DefKind`s. r? @eddyb or @Centril ~~I'm not sure if this is what you were thinking of. There are also a few places where I'm not sure what the correct choice is because I don't fully understand the meaning of some variants.~~ ~~In general, it feels a bit odd to add some of these as `DefKind`s (e.g. `Arm`) because they don't feel like definitions. Are there things that it makes sense not to add?~~
2020-04-24Avoid unused Option::map resultsJosh Stone-1/+1
These are changes that would be needed if we add `#[must_use]` to `Option::map`, per #71484.
2020-04-24Remove redundant `descr`/`descriptive_variant` methods from HIR.Eduard-Mihai Burtescu-31/+0
2020-04-24Tweak `descr` for `AnonConst` and fix `article` for `Use` and `ExternCrate`.Eduard-Mihai Burtescu-3/+4
2020-04-24Split out the `Generator` case from `DefKind::Closure`.Eduard-Mihai Burtescu-0/+3