Santiago Pastorino
708fc3b1a2
Add unsized_fn_params feature
2020-10-27 14:45:02 -03:00
Esteban Küber
cd259dbd19
Do not ICE on invalid input
2020-10-26 17:42:46 -07:00
Bastian Kauschke
60bcc58dce
debug log AbstractConst::new
2020-10-26 14:56:58 +01:00
Dylan DPC
083a5cd9a2
Rollup merge of #78214 - estebank:match-semicolon, r=oli-obk
...
Tweak match arm semicolon removal suggestion to account for futures
* Tweak and extend "use `.await`" suggestions
* Suggest removal of semicolon on prior match arm
* Account for `impl Future` when suggesting semicolon removal
* Silence some errors when encountering `await foo()?` as can't be certain what the intent was
*Thanks to https://twitter.com/a_hoverbear/status/1318960787105353728 for pointing this out!*
2020-10-26 03:09:06 +01:00
Bastian Kauschke
0e419efb1c
check for object safety violations in constants
2020-10-25 18:33:45 +01:00
Jonas Schievink
5ed8ac45d4
Rollup merge of #78272 - lcnr:abstract-const-unused-node, r=oli-obk
...
const_evaluatable_checked: deal with unused nodes + div
r? @oli-obk
2020-10-24 22:39:57 +02:00
Esteban Küber
f71e9ed7f1
review comments
2020-10-23 12:51:06 -07:00
Esteban Küber
b334eef162
Do not ICE with TraitPredicates containing [type error]
...
Fix #77919 .
2020-10-23 12:21:47 -07:00
Esteban Küber
86df9039b2
Tweak "use .await
" suggestion
2020-10-23 08:02:57 -07:00
Bastian Kauschke
47cb871f14
review
2020-10-23 15:04:12 +02:00
Bastian Kauschke
6ad140ca19
const_eval_checked: deal with unused nodes + div
2020-10-23 12:16:58 +02:00
Matthew Jasper
50dde2e4d8
Normalize when finding trait object candidates
2020-10-22 08:18:29 +01:00
Matthew Jasper
6c43a64931
Fix ICE from projection cycle
...
Cycles in normalization can cause evaluations to change from Unknown to
Err. This means that some selection that were applicable no longer are.
To avoid this:
* Selection candidates that are known to be applicable are prefered
over candidates that are not.
* We don't ICE if a candidate is no longer applicable.
2020-10-21 19:43:20 +01:00
Yuki Okushi
9583029a2d
Rollup merge of #78002 - estebank:issue-77598, r=oli-obk
...
Tweak "object unsafe" errors
CC #77598 .
2020-10-21 13:59:35 +09:00
Guillaume Gomez
01e6019448
Rollup merge of #78076 - est31:orphan_mod, r=Mark-Simulacrum
...
Move orphan module-name/mod.rs files into module-name.rs files
2020-10-20 21:46:35 +02:00
Esteban Küber
88f5e110db
review comments
2020-10-20 09:26:15 -07:00
Esteban Küber
ae0e3d0511
Tweak "object unsafe" errors
...
Fix #77598 .
2020-10-20 09:26:14 -07:00
Yuki Okushi
3f1c637db4
Rollup merge of #78111 - SNCPlay42:not-always-self, r=lcnr
...
Trait predicate ambiguities are not always in `Self`
When reporting ambiguities in trait predicates, the compiler incorrectly assumed the ambiguity was always in the type the trait should be implemented on, and never the generic parameters of the trait. This caused silly suggestions for predicates like `<KnownType as Trait<_>>`, such as giving explicit types to completely unrelated variables that happened to be of type `KnownType`.
This also reverts #73027 , which worked around this issue in some cases and does not appear to be necessary any more.
fixes #77982
fixes #78055
2020-10-20 12:11:11 +09:00
SNCPlay42
71ca239f80
don't assume trait ambiguity happens in Self
2020-10-19 21:11:40 +01:00
bors
f90e617305
Auto merge of #77908 - bugadani:obl-forest, r=nnethercote
...
Try to make ObligationForest more efficient
This PR tries to decrease the number of allocations in ObligationForest, as well as moves some cold path code to an uninlined function.
2020-10-19 15:14:15 +00:00
est31
66c1fc4c87
Move orphan module-name/mod.rs files into module-name.rs files
2020-10-18 20:56:15 +02:00
bors
4d247ad7d3
Auto merge of #77306 - lcnr:inline-ok, r=eddyb
...
normalize substs while inlining
fixes #68347 or more precisely, this fixes the same ICE in rust analyser as veloren is pinned to a specific nightly
and had an error with the current one.
I didn't look into creating an MVCE here as that seems fairly annoying, will spend a few minutes doing so rn. (failed)
r? `@eddyb` cc `@bjorn3`
2020-10-18 16:10:00 +00:00
Jack Huey
f6a53b4c69
Review comments
2020-10-16 15:14:38 -04:00
Jack Huey
eba10270c6
map_bound_ref -> rebind
2020-10-16 14:29:21 -04:00
Jack Huey
dd5c9bf139
Use map_bound(_ref) instead of Binder::bind when possible
2020-10-16 12:58:50 -04:00
Dániel Buga
8c7a8a62dd
Turn Outcome into an opaque type to remove some runtime checks
2020-10-15 08:32:41 +02:00
bors
93deabce03
Auto merge of #77873 - sexxi-goose:use_tuple_inference_for_closures, r=nikomatsakis
...
Replace tuple of infer vars for upvar_tys with single infer var
This commit allows us to decide the number of captures required after
completing capture ananysis, which is required as part of implementing
RFC-2229.
closes https://github.com/rust-lang/project-rfc-2229/issues/4
r? `@nikomatsakis`
2020-10-15 04:17:10 +00:00
Roxane
a64ad51ff7
Address comments
2020-10-14 00:17:42 -04:00
est31
215cd36e1c
Remove unused code from remaining compiler crates
2020-10-14 04:14:32 +02:00
est31
a0fc455d30
Replace absolute paths with relative ones
...
Modern compilers allow reaching external crates
like std or core via relative paths in modules
outside of lib.rs and main.rs.
2020-10-13 14:16:45 +02:00
bors
abbdec3be6
Auto merge of #77792 - matthewjasper:instrument-trait-selection, r=oli-obk
...
Use tracing spans in rustc_trait_selection
Spans are very helpful when debugging this code. It's also hot enough to make a good benchmark.
r? `@oli-obk`
2020-10-12 23:04:55 +00:00
Yuki Okushi
687d7646de
Rollup merge of #77550 - lcnr:ty-dep-path-ct-cleanup, r=ecstatic-morse
...
add shims for WithOptConstParam query calls
r? @ecstatic-morse @eddyb
2020-10-13 04:07:50 +09:00
Matthew Jasper
b8d2560dca
Use tracing spans in rustc_trait_selection
2020-10-11 16:08:23 +01:00
Aman Arora
3c46fd67f8
traits diagnostics: Don't print closure/generator upvar_tys tuple
...
Co-authored-by: Roxane Fruytier <roxane.fruytier@hotmail.com>
2020-10-11 03:33:27 -04:00
Aman Arora
08d1ab0bf1
Always return tupled_upvar_tys for Closure/Generator consituent tys
...
Depending on if upvar_tys inferred or not, we were returning either an
inference variable which later resolves to a tuple or else the upvar tys
themselves
Co-authored-by: Roxane Fruytier <roxane.fruytier@hotmail.com>
2020-10-11 03:32:35 -04:00
Roxane
dc183702da
Replace tuple of infer vars for upvar_tys with single infer var
...
This commit allows us to decide the number of captures required after
completing capture ananysis, which is required as part of implementing
RFC-2229.
Co-authored-by: Aman Arora <me@aman-arora.com>
Co-authored-by: Jenny Wills <wills.jenniferg@gmail.com>
2020-10-11 03:32:35 -04:00
Dániel Buga
7993ddd89d
Add find_map_relevant_impl
2020-10-09 16:22:49 +02:00
Bastian Kauschke
f0487cee74
normalize substs during inlining
2020-10-07 10:04:08 +02:00
Bastian Kauschke
9c302f55bd
normalize in codegen_fulfill_obligations
2020-10-07 09:50:30 +02:00
Matthew Jasper
022c148fcd
Fix tests from rebase
2020-10-06 11:19:33 +01:00
Matthew Jasper
27534b3932
Fix rebase
2020-10-06 11:19:33 +01:00
Matthew Jasper
852073a7d2
Deduplicate item bounds after normalization
2020-10-06 11:19:32 +01:00
Matthew Jasper
e42c97919c
Don't require lifetime super-bounds on traits apply to trait objects of that trait
2020-10-06 11:19:32 +01:00
Matthew Jasper
e674cf0200
Normalize super trait bounds when confirming object candidates
2020-10-06 11:19:32 +01:00
Matthew Jasper
d08ab945de
Fix rebase
2020-10-06 11:19:32 +01:00
Matthew Jasper
6c4feb681f
Fix bootstrap
2020-10-06 11:19:32 +01:00
Matthew Jasper
ed32482534
Handle multiple trait-def projection candidates
2020-10-06 11:19:32 +01:00
Matthew Jasper
0dfa6ff3be
Avoid cycles from projection bounds
...
Only check the own predicates of associated types when confirming
projection candidates.
Also consider implied bounds when comparing trait and impl methods.
2020-10-06 11:19:32 +01:00
Matthew Jasper
596d6c4b3b
Avoid cycle with projections from object types
...
Normalizing `<dyn Iterator<Item = ()> as Iterator>::Item` no longer
requires selecting `dyn Iterator<Item = ()>: Iterator`. This was
previously worked around by using a special type-folder to normalize
things.
2020-10-06 11:19:31 +01:00
Matthew Jasper
34e5a4992c
Normalize projection bounds when considering candidates
...
This unfortunately requires some winnowing hacks to avoid
now ambiguous candidates.
2020-10-06 11:19:31 +01:00
Matthew Jasper
cfee49593d
Handle multiple applicable projection candidates
2020-10-06 11:19:31 +01:00
Matthew Jasper
bc08b791bc
Fix bugs in evaluating WellFormed predicates
...
- List the nestsed obligations in an order that works with the
single pass used by evaluation
- Propagate recursion depth correctly
2020-10-06 11:19:31 +01:00
Matthew Jasper
f52b2d8890
Avoid cycle in nested obligations for object candidate
...
Bounds of the form `type Future: Future<Result=Self::Result>` exist in
some ecosystem crates. To validate these bounds for trait objects we
need to normalize `Self::Result` in a way that doesn't cause a cycle.
2020-10-06 11:19:31 +01:00
Matthew Jasper
8787090964
Address review comments
2020-10-06 11:19:31 +01:00
Matthew Jasper
21eccbb587
Fix ICE
2020-10-06 11:19:30 +01:00
Matthew Jasper
042464f75a
Fix tests and bootstrap
2020-10-06 11:19:30 +01:00
Matthew Jasper
2bdf723da7
Ensure that associated types for trait objects satisfy their bounds
2020-10-06 11:19:30 +01:00
Matthew Jasper
0a76584dcc
Move some code from rustc_typeck to rustc_trait_selection
2020-10-06 11:19:30 +01:00
Matthew Jasper
d4d9e7f67f
Remove unused part of return value from replace_bound_vars_with_placeholders
2020-10-06 11:19:30 +01:00
Matthew Jasper
1b07991574
Check associated type bounds for object safety violations
2020-10-06 11:19:30 +01:00
Matthew Jasper
5b279c8016
Check opaque types satisfy their bounds
2020-10-06 11:19:30 +01:00
Matthew Jasper
b3057f4d5f
Check projections are well-formed when using projection candidates
2020-10-06 11:19:29 +01:00
Matthew Jasper
87f2f42dc2
Make projection wf check the predicates for the projection
2020-10-06 11:19:29 +01:00
Matthew Jasper
d297147e62
Split bounds from predicates
2020-10-06 11:19:22 +01:00
Matthew Jasper
0eb87ed55f
Rename projection_predicates to item_bounds
2020-10-06 11:18:45 +01:00
Yuki Okushi
2970af8e28
Rollup merge of #77559 - camelid:fix-rustdoc-warnings-invalid-rust-syntax, r=lcnr
...
Fix rustdoc warnings about invalid Rust syntax
2020-10-06 16:26:09 +09:00
Camelid
c8d25af698
Fixup
2020-10-05 15:07:27 -07:00
bors
ea7e131435
Auto merge of #77171 - VFLashM:better_sso_structures, r=oli-obk
...
Better sso structures
This change greatly expands interface of MiniSet/MiniMap and renames them because they are no longer "Mini".
2020-10-05 17:18:01 +00:00
Bastian Kauschke
8160bfa39c
query_name_of_opt_const_arg -> query_name_opt_const_arg
2020-10-05 08:49:21 +02:00
Camelid
c877ff3664
Fix rustdoc warnings about invalid Rust syntax
2020-10-04 19:35:44 -07:00
Dylan DPC
9dbc9ed870
Rollup merge of #77514 - scottmcm:less-once-chain-once, r=estebank
...
Replace some once(x).chain(once(y)) with [x, y] IntoIter
Now that we have by-value array iterators that are [already used](25c8c53dd9/compiler/rustc_hir/src/def.rs (L305-L307)
)...
For example,
```diff
- once(self.type_ns).chain(once(self.value_ns)).chain(once(self.macro_ns)).filter_map(|it| it)
+ IntoIter::new([self.type_ns, self.value_ns, self.macro_ns]).filter_map(|it| it)
```
2020-10-05 02:29:42 +02:00
Dylan DPC
5fa978fa1b
Rollup merge of #75928 - JulianKnodt:non_utf8, r=estebank
...
Remove trait_selection error message in specific case
In the case that a trait is not implemented for an ADT with type errors, cancel the error.
Fixes #75627
2020-10-05 02:29:25 +02:00
Bastian Kauschke
536674fb69
cleanup WithOptConstParam queries
2020-10-04 23:22:08 +02:00
Scott McMurray
d74b8e0505
Replace some once(x).chain(once(y)) with [x, y] IntoIter
...
Now that we have by-value array iterators...
2020-10-03 16:51:43 -07:00
Dylan DPC
6d3cfd9d51
Rollup merge of #77305 - lcnr:candidate_from_obligation, r=davidtwco
...
move candidate_from_obligation_no_cache
It's only called from `candidate_from_obligation` which is already in this file.
2020-10-01 02:13:37 +02:00
Dylan DPC
f23559451b
Rollup merge of #77303 - lcnr:const-evaluatable-TooGeneric, r=oli-obk,varkor
...
const evaluatable: improve `TooGeneric` handling
Instead of emitting an error in `fulfill`, we now correctly stall on inference variables.
As `const_eval_resolve` returns `ErrorHandled::TooGeneric` when encountering generic parameters on which
we actually do want to error, we check for inference variables and eagerly emit an error if they don't exist, returning `ErrorHandled::Reported` instead.
Also contains a small bugfix for `ConstEquate` where we previously only stalled on type variables. This is probably a leftover from
when we did not yet support stalling on const inference variables.
r? @oli-obk cc @varkor @eddyb
2020-10-01 02:13:35 +02:00
Bastian Kauschke
db5b70f193
move candidate_from_obligation_no_cache
2020-09-28 20:21:44 +02:00
Bastian Kauschke
a4783debe0
const evaluatable: improve TooGeneric
handling
2020-09-28 20:18:06 +02:00
Dylan MacKenzie
c4d8089f00
Revert "Add an unused field of type Option<DefId>
to ParamEnv
struct."
...
This reverts commit ab83d372ed
.
2020-09-26 21:01:09 -07:00
Valerii Lashmanov
5c224a484d
MiniSet/MiniMap moved and renamed into SsoHashSet/SsoHashMap
...
It is a more descriptive name and with upcoming changes
there will be nothing "mini" about them.
2020-09-26 14:30:05 -05:00
Ralf Jung
9e02642fb3
Rollup merge of #77211 - est31:remove_unused_allow, r=oli-obk
...
Remove unused #[allow(...)] statements from compiler/
2020-09-26 12:58:34 +02:00
Ralf Jung
ac8169dc10
Rollup merge of #77093 - lcnr:const-generics-infer-warning, r=varkor
...
merge `need_type_info_err(_const)`
I hoped that this would automatically solve #76737 but it doesn't quite seem like it
fixes #77092
r? @varkor
2020-09-26 12:58:17 +02:00
Bastian Kauschke
32195ac8f4
rename functions
2020-09-26 10:28:15 +02:00
est31
12187b7f86
Remove unused #[allow(...)] statements from compiler/
2020-09-26 01:25:55 +02:00
Jonas Schievink
e739468f97
Rollup merge of #77155 - lcnr:ImplSource, r=ecstatic-morse
...
remove enum name from ImplSource variants
This is quite a lot cleaner in my opinion.
2020-09-25 19:42:48 +02:00
bors
521d8d8a22
Auto merge of #77041 - lcnr:const-eval-perf, r=ecstatic-morse
...
perf: move cold path of `process_obligations` into a separate function
cc #76575
This probably won't matter too much in the long run once #69218 is merged so we may not want to merge this.
r? `@ecstatic-morse`
2020-09-25 10:14:47 +00:00
Jonas Schievink
6f3da3d53f
Rollup merge of #77121 - duckymirror:html-root-url, r=jyn514
...
Updated html_root_url for compiler crates
Closes #77103
r? @jyn514
2020-09-25 02:29:45 +02:00
Bastian Kauschke
06d2325a50
perf: split progress_obligations with inline(never)
2020-09-24 22:13:41 +02:00
Bastian Kauschke
1857184cd1
remove enum name from ImplSource variants
2020-09-24 19:22:36 +02:00
Bastian Kauschke
b8402d6a6e
assign the correct DefId
in nominal_obligations
2020-09-24 09:04:23 +02:00
Erik Hofmayer
138a2e5eaa
/nightly/nightly-rustc
2020-09-23 21:51:56 +02:00
Erik Hofmayer
dd66ea2d3d
Updated html_root_url for compiler crates
2020-09-23 21:14:43 +02:00
Dylan DPC
98e5ee7df0
Rollup merge of #76939 - lcnr:const-evaluatable-cont, r=oli-obk
...
emit errors during AbstractConst building
There changes are currently still untested, so I don't expect this to pass CI 😆
It seems to me like this is the direction we want to go in, though we didn't have too much of a discussion about this.
r? @oli-obk
2020-09-23 14:54:02 +02:00
Bastian Kauschke
45d92b43e3
merge need_type_info_err(_const)
2020-09-23 09:24:58 +02:00
bors
6d3acf5129
Auto merge of #76928 - lcnr:opaque-types-cache, r=tmandry
...
cache types during normalization
partially fixes #75992
reduces the following test from 14 to 3 seconds locally.
cc `@Mark-Simulacrum` would it make sense to add that test to `perf`?
```rust
#![recursion_limit="2048"]
#![type_length_limit="112457564"]
pub async fn h0(v: &String, x: &u64) { println!("{} {}", v, x) }
pub async fn h1(v: &String, x: &u64) { h0(v, x).await }
pub async fn h2(v: &String, x: &u64) { h1(v, x).await }
pub async fn h3(v: &String, x: &u64) { h2(v, x).await }
pub async fn h4(v: &String, x: &u64) { h3(v, x).await }
pub async fn h5(v: &String, x: &u64) { h4(v, x).await }
pub async fn h6(v: &String, x: &u64) { h5(v, x).await }
pub async fn h7(v: &String, x: &u64) { h6(v, x).await }
pub async fn h8(v: &String, x: &u64) { h7(v, x).await }
pub async fn h9(v: &String, x: &u64) { h8(v, x).await }
pub async fn h10(v: &String, x: &u64) { h9(v, x).await }
pub async fn h11(v: &String, x: &u64) { h10(v, x).await }
pub async fn h12(v: &String, x: &u64) { h11(v, x).await }
pub async fn h13(v: &String, x: &u64) { h12(v, x).await }
pub async fn h14(v: &String, x: &u64) { h13(v, x).await }
pub async fn h15(v: &String, x: &u64) { h14(v, x).await }
pub async fn h16(v: &String, x: &u64) { h15(v, x).await }
pub async fn h17(v: &String, x: &u64) { h16(v, x).await }
pub async fn h18(v: &String, x: &u64) { h17(v, x).await }
pub async fn h19(v: &String, x: &u64) { h18(v, x).await }
macro_rules! async_recursive {
(29, $inner:expr) => { async { async_recursive!(28, $inner) }.await };
(28, $inner:expr) => { async { async_recursive!(27, $inner) }.await };
(27, $inner:expr) => { async { async_recursive!(26, $inner) }.await };
(26, $inner:expr) => { async { async_recursive!(25, $inner) }.await };
(25, $inner:expr) => { async { async_recursive!(24, $inner) }.await };
(24, $inner:expr) => { async { async_recursive!(23, $inner) }.await };
(23, $inner:expr) => { async { async_recursive!(22, $inner) }.await };
(22, $inner:expr) => { async { async_recursive!(21, $inner) }.await };
(21, $inner:expr) => { async { async_recursive!(20, $inner) }.await };
(20, $inner:expr) => { async { async_recursive!(19, $inner) }.await };
(19, $inner:expr) => { async { async_recursive!(18, $inner) }.await };
(18, $inner:expr) => { async { async_recursive!(17, $inner) }.await };
(17, $inner:expr) => { async { async_recursive!(16, $inner) }.await };
(16, $inner:expr) => { async { async_recursive!(15, $inner) }.await };
(15, $inner:expr) => { async { async_recursive!(14, $inner) }.await };
(14, $inner:expr) => { async { async_recursive!(13, $inner) }.await };
(13, $inner:expr) => { async { async_recursive!(12, $inner) }.await };
(12, $inner:expr) => { async { async_recursive!(11, $inner) }.await };
(11, $inner:expr) => { async { async_recursive!(10, $inner) }.await };
(10, $inner:expr) => { async { async_recursive!(9, $inner) }.await };
(9, $inner:expr) => { async { async_recursive!(8, $inner) }.await };
(8, $inner:expr) => { async { async_recursive!(7, $inner) }.await };
(7, $inner:expr) => { async { async_recursive!(6, $inner) }.await };
(6, $inner:expr) => { async { async_recursive!(5, $inner) }.await };
(5, $inner:expr) => { async { async_recursive!(4, $inner) }.await };
(4, $inner:expr) => { async { async_recursive!(3, $inner) }.await };
(3, $inner:expr) => { async { async_recursive!(2, $inner) }.await };
(2, $inner:expr) => { async { async_recursive!(1, $inner) }.await };
(1, $inner:expr) => { async { async_recursive!(0, $inner) }.await };
(0, $inner:expr) => { async { h19(&String::from("owo"), &0).await; $inner }.await };
}
async fn f() {
async_recursive!(14, println!("hello"));
}
fn main() {
let _ = f();
}
```
r? `@eddyb` requires a perf run.
2020-09-22 22:52:07 +00:00
Bastian Kauschke
2f893e458a
review
2020-09-21 23:25:52 +02:00
Bram van den Heuvel
ab83d372ed
Add an unused field of type Option<DefId>
to ParamEnv
struct.
2020-09-21 09:39:26 +02:00
Bastian Kauschke
30cbc97296
words
2020-09-19 22:27:52 +02:00
Bastian Kauschke
d4039c55c9
wip emit errors during AbstractConst building
2020-09-19 22:17:52 +02:00
Bastian Kauschke
1146c39da7
cache types during normalization
2020-09-19 17:27:13 +02:00