Commit Graph

36 Commits

Author SHA1 Message Date
Camille GILLOT
4706c38e17 Use HirId in TraitCandidate. 2020-02-13 16:39:09 +01:00
Mazdak Farrokhzad
05e5530577 parser: address review comments 2020-02-13 10:39:24 +01:00
Mazdak Farrokhzad
e839b2ec84 Constness -> enum Const { Yes(Span), No }
Same idea for `Unsafety` & use new span for better diagnostics.
2020-02-13 10:39:23 +01:00
Camille GILLOT
fc73e196d9 Review comments. 2020-02-11 23:21:21 +01:00
Camille GILLOT
d3b2385d40 Move it all into rustc_hir. 2020-02-11 23:14:07 +01:00
bors
840bdc349d Auto merge of #67665 - Patryk27:master, r=zackmdavis
Improve reporting errors and suggestions for trait bounds

Fix #66802

- When printing errors for unsized function parameter, properly point at the parameter instead of function's body.
- Improve `consider further restricting this bound` (and related) messages by separating human-oriented hints from the machine-oriented ones.
2020-02-09 22:13:05 +00:00
Jonas Schievink
da005822ce
Rollup merge of #68913 - Areredify:gat_pretty, r=cramertj
Pretty-print generic params and where clauses on associated types

closes #67509
2020-02-09 18:23:34 +01:00
Patryk Wychowaniec
a8d34c1062
Improve reporting errors and suggestions for trait bounds 2020-02-09 10:33:47 +01:00
Aaron Hill
619051e4f0
Move librustc_hir/def_id.rs to librustc_span/def_id.rs
For noww, librustc_hir re-exports the `def_id` module from
librustc_span, so the rest of rustc can continue to reference
rustc_hir::def_id
2020-02-08 16:48:01 -05:00
Mikhail Babenko
bf82582d6f add hir printing 2020-02-07 18:27:12 +03:00
bors
333c32a5a4 Auto merge of #68583 - estebank:hrlt, r=oli-obk
Account for HR lifetimes when suggesting introduction of named lifetime

```
error[E0106]: missing lifetime specifier
 --> src/test/ui/suggestions/fn-missing-lifetime-in-item.rs:2:32
  |
2 | struct S2<F: Fn(&i32, &i32) -> &i32>(F);
  |                 ----  ----     ^ expected named lifetime parameter
  |
  = help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from argument 1 or argument 2
  = note: for more information on higher-ranked polymorphism, visit https://doc.rust-lang.org/nomicon/hrtb.html
help: consider making the bound lifetime-generic with a new `'a` lifetime
  |
2 | struct S2<F: for<'a> Fn(&'a i32, &'a i32) -> &'a i32>(F);
  |              ^^^^^^^    ^^^^^^^  ^^^^^^^     ^^^
help: consider introducing a named lifetime parameter
  |
2 | struct S2<'a, F: Fn(&'a i32, &'a i32) -> &'a i32>(F);=
  |           ^^^       ^^^^^^^  ^^^^^^^     ^^^
```

Follow up to #68267. Addresses the diagnostics part of #49287.
2020-02-06 05:19:52 +00:00
Esteban Küber
2100b31535 review comments 2020-02-05 10:32:01 -08:00
Esteban Küber
183dfac1f3 Account for HKTB when suggesting introduction of named lifetime 2020-02-05 10:32:01 -08:00
ljedrz
e8b72f44b0 move item reference comment 2020-02-05 11:29:07 +01:00
ljedrz
28b0ed020a merge item id stable hashing functions 2020-02-05 11:11:34 +01:00
Esteban Küber
a52ec87a17 Use more appropriate spans on object unsafe traits and provide structured suggestions when possible 2020-02-02 11:53:10 -08:00
Mazdak Farrokhzad
e233331a51 syntax::print -> new crate rustc_ast_pretty 2020-02-01 18:59:49 +01:00
Mazdak Farrokhzad
097d5e1c5e 1. move node_id to syntax
2. invert rustc_session & syntax deps
3. drop rustc_session dep in rustc_hir
2020-02-01 18:58:08 +01:00
Mazdak Farrokhzad
64d0143c2c pretty: remove ParseSess dependency 2020-02-01 18:54:55 +01:00
Victor Ding
6a6ebb4403 Add -Z no-link flag
Adds a compiler option to allow rustc compile a crate without linking.
With this flag, rustc serializes codegen_results into a .rlink file.
2020-01-23 11:00:36 +11:00
Dylan MacKenzie
eb60346cc9 Add MaybeConst variant to {ast,hir}::TraitBoundModifier 2020-01-20 00:00:08 -08:00
Dylan MacKenzie
a790f9bb2d Add constness field to hir::ItemKind::Impl 2020-01-19 23:41:44 -08:00
Dylan MacKenzie
4743995ed3 Use named fields for hir::ItemKind::Impl 2020-01-17 16:14:29 -08:00
Esteban Küber
00e2626895 Account for object safety when suggesting Box<dyn Trait> 2020-01-16 09:49:14 -08:00
Mazdak Farrokhzad
50d76d6471
Rollup merge of #68114 - ecstatic-morse:fix-feature-gating, r=Centril
Don't require `allow_internal_unstable` unless `staged_api` is enabled.

#63770 changed `qualify_min_const_fn` to require `allow_internal_unstable` for *all* crates that used an unstable feature, regardless of whether `staged_api` was enabled or the `fn` that used that feature was stably const. In practice, this meant that every crate in the ecosystem that wanted to use nightly features added `#![feature(const_fn)]`, which skips `qualify_min_const_fn` entirely.

After this PR, crates that do not have `#![feature(staged_api)]` will only need to enable the feature they are interested in. For example, `#![feature(const_if_match)]` will be enough to enable `if` and `match` in constants. Crates with `staged_api` (e.g., `libstd`) require `#[allow_internal_unstable]` to be added to a function if it uses nightly features unless that function is also marked `#[rustc_const_unstable]`. This prevents proliferation of `#[allow_internal_unstable]` into functions that are not callable in a `const` context on stable.

r? @oli-obk (author of #63770)
cc @Centril
2020-01-11 12:36:14 +01:00
Dylan MacKenzie
09b5c854de Remove unnecessary const_fn feature gates
This flag opts out of the min-const-fn checks entirely, which is usually
not what we want. The few cases where the flag is still necessary have
been annotated.
2020-01-10 18:51:12 -08:00
Mazdak Farrokhzad
d5598aa7a0 Introduce #![feature(half_open_range_patterns)].
This feature adds `X..`, `..X`, and `..=X` patterns.
2020-01-10 07:29:04 +01:00
Mazdak Farrokhzad
2db97ede27 refactor 'Output = $ty' & reduce rustc dep 2020-01-09 08:57:24 +01:00
Mazdak Farrokhzad
922f8b70f2 intravisit: use walk_list! more 2020-01-08 22:01:07 +01:00
Mazdak Farrokhzad
37d76dc2f7 {rustc::hir -> rustc_hir}::intravisit 2020-01-08 22:01:07 +01:00
Matthew Jasper
9462c8babb Improve hygiene of newtype_index
Also add unit tests
2020-01-06 20:43:10 +00:00
Mazdak Farrokhzad
cdf32e1a0f pacify the parallel compiler 2020-01-04 19:03:27 +01:00
Mazdak Farrokhzad
937c76bfb2 cleanup librustc_hir/Cargo.toml 2020-01-04 19:03:27 +01:00
Mazdak Farrokhzad
ef08662613 hir::{hir,def,itemlikevisit,pat_util,print} -> rustc_hir
Also fix fallout wrt. HashStable.
2020-01-04 19:03:27 +01:00
Mazdak Farrokhzad
72241ad348 move HirId to librustc_hir::hir_id 2020-01-04 19:01:42 +01:00
Mazdak Farrokhzad
7a14073875 move def_id to new rustc_hir crate 2020-01-04 19:01:42 +01:00