about summary refs log tree commit diff
path: root/src/librustc/middle/dead.rs
AgeCommit message (Collapse)AuthorLines
2019-03-29Rollup merge of #59486 - varkor:dead-code-impl, r=sanxiynMazdak Farrokhzad-8/+6
Visit `ImplItem` in `dead_code` lint Fixes https://github.com/rust-lang/rust/issues/47131.
2019-03-28Walk all items for dead_code lint by defaultvarkor-9/+6
2019-03-28Rollup merge of #59216 - stepnivlk:type_dependent_defs-wrappers, r=oli-obkMazdak Farrokhzad-2/+2
Type dependent defs wrappers First of all, forgive me if something would seem lame to you or I offend some rule (although I tried to read through docs), this is my first PR. Issue: https://github.com/rust-lang/rust/issues/59094 This PR adds 3 helper methods to `TypeckTables`: * `opt_type_dependent_def` * `opt_type_dependent_def_id` * `type_dependent_def_id` I didn't add `type_dependent_def` as was proposed in the issue simply because it wasn't used anywhere in the code. Only non-option wrapped`type_dependent_defs()[]` accesses were found in clippy which always called `def_id()` on result. Speaking of clippy, should I open separate PR in its own repo, given it's used as submodule here? Sry it took me so long, as I said I'm new here and I had tough week :).
2019-03-28Visit ItemKind::Impl for dead code lintvarkor-0/+1
2019-03-25Allocate HIR id counters for use trees in MiscCollectorJohn Kåre Alsaker-1/+1
2019-03-24Re-order fields in `Def::Ctor`.David Wood-1/+1
This commit moves the `DefId` field of `Def::Ctor` to be the first field.
2019-03-24Move `CtorOf` into `hir::def`.David Wood-2/+2
This commit moves the definition of `CtorOf` from `rustc::hir` to `rustc::hir::def` and adds imports wherever it is used.
2019-03-24Separate variant id and variant constructor id.David Wood-12/+27
This commit makes two changes - separating the `NodeId` that identifies an enum variant from the `NodeId` that identifies the variant's constructor; and no longer creating a `NodeId` for `Struct`-style enum variants and structs. Separation of the variant id and variant constructor id will allow the rest of RFC 2008 to be implemented by lowering the visibility of the variant's constructor without lowering the visbility of the variant itself. No longer creating a `NodeId` for `Struct`-style enum variants and structs mostly simplifies logic as previously this `NodeId` wasn't used. There were various cases where the `NodeId` wouldn't be used unless there was an unit or tuple struct or enum variant but not all uses of this `NodeId` had that condition, by removing this `NodeId`, this must be explicitly dealt with. This change mostly applied cleanly, but there were one or two cases in name resolution and one case in type check where the existing logic required a id for `Struct`-style enum variants and structs.
2019-03-23Auto merge of #59096 - ljedrz:HirIdify_AccessLevel, r=Zoxcbors-1/+1
middle: replace NodeId with HirId in AccessLevels Pushing the limits of HirIdification (#57578). Replaces `NodeId` with `HirId` in `middle::privacy::AccessLevels`. Actually this time I was more successful and cracked it; I probably tried to HirIdify too much at once when I attempted it last time ^^. r? @Zoxc
2019-03-16Add def getting methods to librustc/ty/contextTomas Koutsky-2/+2
2019-03-15rustc: remove TyCtxt::parent_def_id in favor of TyCtxt::parent.Eduard-Mihai Burtescu-2/+2
2019-03-13middle: replace NodeId with HirId in AccessLevelsljedrz-1/+1
2019-03-12Visit impl Trait for dead_code lintSeo Sanghyeon-1/+12
2019-03-02hir: HirIdify Impl&TraitItemIdljedrz-1/+1
2019-03-02hir: remove NodeId from Itemljedrz-1/+1
2019-03-02hir: remove NodeId from StructFieldljedrz-1/+1
2019-03-01middle: HirIdify deadljedrz-58/+59
2019-02-24hir: remove NodeId from Exprljedrz-5/+5
2019-02-20hir: HirId-ify intravisitljedrz-2/+2
2019-02-09cleanup: rename node_id_to_type(_opt)ljedrz-1/+1
2019-02-05move librustc to 2018Mark Mansi-12/+12
2019-01-15Querify entry_fnIgor Matuszewski-1/+1
2018-12-26Store `Ident` rather than just `Name` in HIR types `Item` and `ForeignItem`.Alexander Regueiro-3/+3
2018-12-25Remove licensesMark Rousskov-10/+0
2018-12-18Mark tuple structs as live if their constructors are usedOliver Scherer-42/+38
2018-12-07Various minor/cosmetic improvements to codeAlexander Regueiro-1/+1
2018-12-06Use a function to access the Hir map to be able to turn it into a query laterJohn Kåre Alsaker-12/+12
2018-12-03Handle existential types in dead code analysisOliver Scherer-0/+1
2018-11-18Fix ICEs from imports of items not defined in modulesVadim Petrochenkov-1/+1
2018-11-02Remove deprecated unstable `#[panic_implementation]`Vadim Petrochenkov-4/+2
It was superseded by `#[panic_handler]`
2018-10-19Remove unused boxOliver Scherer-5/+4
2018-10-19Prefer `Default::default` over `FxHash*::default` in struct constructorsOliver Scherer-1/+2
2018-10-19Deprecate the `FxHashMap()` and `FxHashSet()` constructor function hackOliver Scherer-2/+2
2018-10-07Auto merge of #54810 - 1aim:unused-impl-trait, r=oli-obkbors-1/+7
Fix dead code lint for functions using impl Trait Fixes https://github.com/rust-lang/rust/issues/54754 This is a minimal fix that doesn't add any new queries or touches unnecessary code. Please nominate for beta backport if wanted.
2018-10-07Auto merge of #54451 - alexcrichton:no-mangle-extern-linkage, r=michaelwoeristerbors-5/+10
rustc: Allow `#[no_mangle]` anywhere in a crate This commit updates the compiler to allow the `#[no_mangle]` (and `#[export_name]` attributes) to be located anywhere within a crate. These attributes are unconditionally processed, causing the compiler to always generate an exported symbol with the appropriate name. After some discussion on #54135 it was found that not a great reason this hasn't been allowed already, and it seems to match the behavior that many expect! Previously the compiler would only export a `#[no_mangle]` symbol if it were *publicly reachable*, meaning that it itself is `pub` and it's otherwise publicly reachable from the root of the crate. This new definition is that `#[no_mangle]` *is always reachable*, no matter where it is in a crate or whether it has `pub` or not. This should make it much easier to declare an exported symbol with a known and unique name, even when it's an internal implementation detail of the crate itself. Note that these symbols will persist beyond LTO as well, always making their way to the linker. Along the way this commit removes the `private_no_mangle_functions` lint (also for statics) as there's no longer any need to lint these situations. Furthermore a good number of tests were updated now that symbol visibility has been changed. Closes #54135
2018-10-06rustc: Allow `#[no_mangle]` anywhere in a crateAlex Crichton-5/+10
This commit updates the compiler to allow the `#[no_mangle]` (and `#[export_name]` attributes) to be located anywhere within a crate. These attributes are unconditionally processed, causing the compiler to always generate an exported symbol with the appropriate name. After some discussion on #54135 it was found that not a great reason this hasn't been allowed already, and it seems to match the behavior that many expect! Previously the compiler would only export a `#[no_mangle]` symbol if it were *publicly reachable*, meaning that it itself is `pub` and it's otherwise publicly reachable from the root of the crate. This new definition is that `#[no_mangle]` *is always reachable*, no matter where it is in a crate or whether it has `pub` or not. This should make it much easier to declare an exported symbol with a known and unique name, even when it's an internal implementation detail of the crate itself. Note that these symbols will persist beyond LTO as well, always making their way to the linker. Along the way this commit removes the `private_no_mangle_functions` lint (also for statics) as there's no longer any need to lint these situations. Furthermore a good number of tests were updated now that symbol visibility has been changed. Closes #54135
2018-10-06rustc/middle: whitespace & formatting fixesljedrz-3/+3
2018-10-06rustc/middle: improve some patternsljedrz-4/+2
2018-10-04Fix dead code lint for functions using impl TraitJonas Schievink-1/+7
2018-09-29don't elide lifetimes in paths in librustc/Zack M. Davis-1/+1
This seemed like a good way to kick the tires on the elided-lifetimes-in-paths lint (#52069)—seems to work! This was also pretty tedious—it sure would be nice if `cargo fix` worked on this codebase (#53896)!
2018-08-27Rename hir::map::NodeKind to hir::Nodevarkor-11/+11
2018-08-27Remove path prefixes from NodeKindvarkor-10/+10
2018-08-27Rename hir::map::Node to hir::map::NodeKindvarkor-10/+10
2018-08-23add #[panic_handler]; deprecate #[panic_implementation]Jorge Aparicio-1/+3
2018-08-22Remove unnecessary TyKind::svarkor-1/+1
2018-08-22Remove Ty prefix from ↵varkor-4/+4
Ty{Adt|Array|Slice|RawPtr|Ref|FnDef|FnPtr|Dynamic|Closure|Generator|GeneratorWitness|Never|Tuple|Projection|Anon|Infer|Error}
2018-08-22Rename ty::TyVariants to ty::TyKindvarkor-1/+1
2018-08-19mv codemap() source_map()Donato Sciarra-2/+2
2018-08-19mv (mod) codemap source_mapDonato Sciarra-2/+2
2018-08-07Add HirId to VisibilityKind::RestrictedMark Rousskov-1/+1