Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 10 pull requests #57075

Closed
wants to merge 30 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
e38e954
Simplify MIR generation for logical ops
sinkuu Dec 17, 2018
f731445
Mark tuple structs as live if their constructors are used
oli-obk Dec 18, 2018
c2402dc
Replace "native pointer" in error message with "raw pointer"
varkor Dec 18, 2018
d6969ac
Fix string for raw pointer deref suggestion
varkor Dec 18, 2018
0309874
Fix string for array access suggestion
varkor Dec 18, 2018
e7c5146
Remove `TokenStream::JointTree`.
nnethercote Dec 19, 2018
405d8b0
Copyrite
oli-obk Dec 20, 2018
59f643f
Point to return span when writing `return;` on non-() fn
estebank Dec 20, 2018
cdbccf5
Point at coercion source on type errors for fn returning `impl Trait`
estebank Dec 21, 2018
f8e508c
Fix a recently introduces regression
oli-obk Dec 17, 2018
b9d74fc
Also test projections
oli-obk Dec 17, 2018
3414be0
fix deprecation warnings in liballoc benches
RalfJung Dec 21, 2018
6ed596e
Update tests to changes on master
oli-obk Dec 21, 2018
097d39d
Fix alignment for array indexing
nikic Dec 21, 2018
3986c96
enum type instead of variant suggestion unification
zackmdavis Nov 19, 2018
64ad3e2
adjust enum type instead of variant suggestions for prelude enums
zackmdavis Nov 23, 2018
2820dc8
Remove dead code
estebank Dec 23, 2018
b42a3ac
stabilize min_const_unsafe_fn in 1.33.
Centril Dec 22, 2018
bd1d5bc
stabilize min_const_unsafe_fn --bless tests.
Centril Dec 22, 2018
7ae6fb2
stabilize min_const_unsafe_fn -- revert const-size_of-cycle changes
Centril Dec 22, 2018
cd93b16
Rollup merge of #56188 - zackmdavis:if_i_may_suggest, r=davidtwco
Centril Dec 23, 2018
d9bad38
Rollup merge of #56916 - oli-obk:static_mut_beta_regression, r=davidtwco
Centril Dec 23, 2018
6fa0b0a
Rollup merge of #56917 - sinkuu:mir_build_logicop, r=davidtwco
Centril Dec 23, 2018
99f4ce2
Rollup merge of #56953 - oli-obk:dead_const, r=petrochenkov
Centril Dec 23, 2018
3a5e4da
Rollup merge of #56964 - nnethercote:TokenStream-IsJoint, r=petrochenkov
Centril Dec 23, 2018
d875fcd
Rollup merge of #56966 - varkor:raw-pointer-deref-parens, r=zackmdavis
Centril Dec 23, 2018
174dfb8
Rollup merge of #57020 - estebank:return-span, r=zackmdavis
Centril Dec 23, 2018
ee1c818
Rollup merge of #57032 - RalfJung:alloc-bench-deprecations, r=Centril
Centril Dec 23, 2018
841af07
Rollup merge of #57053 - nikic:fix-gep-align, r=nagisa
Centril Dec 23, 2018
24a5335
Rollup merge of #57067 - Centril:stabilize-min_const_unsafe_fn, r=oli…
Centril Dec 23, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
adjust enum type instead of variant suggestions for prelude enums
The present author regrets not thinking of a more eloquent way to do
this.
  • Loading branch information
zackmdavis committed Dec 23, 2018
commit 64ad3e2c423f701b856a6780380a0dbb03f90c22
12 changes: 11 additions & 1 deletion src/librustc_resolve/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3237,7 +3237,17 @@ impl<'a> Resolver<'a> {
err.span_suggestions_with_applicability(
span,
&msg,
enum_candidates.into_iter().map(|(_variant, enum_ty)| enum_ty),
enum_candidates.into_iter()
.map(|(_variant_path, enum_ty_path)| enum_ty_path)
// variants reëxported in prelude doesn't mean `prelude::v1` is the
// type name! FIXME: is there a more principled way to do this that
// would work for other reëxports?
.filter(|enum_ty_path| enum_ty_path != "std::prelude::v1")
// also say `Option` rather than `std::prelude::v1::Option`
.map(|enum_ty_path| {
// FIXME #56861: DRYer prelude filtering
enum_ty_path.trim_start_matches("std::prelude::v1::").to_owned()
}),
Applicability::MachineApplicable,
);
}
Expand Down
1 change: 1 addition & 0 deletions src/librustc_typeck/check/demand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
let sole_field_ty = sole_field.ty(self.tcx, substs);
if self.can_coerce(expr_ty, sole_field_ty) {
let variant_path = self.tcx.item_path_str(variant.did);
// FIXME #56861: DRYer prelude filtering
Some(variant_path.trim_start_matches("std::prelude::v1::").to_string())
} else {
None
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ enum Solidify { Set }
enum UnorderedCollection { Set }

fn setup() -> Set { Set }
//~^ ERROR cannot find type `Set` in this scope
//~| ERROR cannot find value `Set` in this scope

fn main() {
setup();
Expand Down
22 changes: 8 additions & 14 deletions src/test/ui/issues/issue-35675.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,10 @@ error[E0573]: expected type, found variant `Ok`
--> $DIR/issue-35675.rs:29:13
|
LL | fn foo() -> Ok {
| ^^ not a type
help: try using the variant's enum
|
LL | fn foo() -> std::prelude::v1 {
| ^^^^^^^^^^^^^^^^
LL | fn foo() -> std::result::Result {
| ^^^^^^^^^^^^^^^^^^^
| ^^
| |
| not a type
| help: try using the variant's enum: `std::result::Result`

error[E0412]: cannot find type `Variant3` in this scope
--> $DIR/issue-35675.rs:34:13
Expand All @@ -63,13 +60,10 @@ error[E0573]: expected type, found variant `Some`
--> $DIR/issue-35675.rs:38:13
|
LL | fn qux() -> Some {
| ^^^^ not a type
help: try using the variant's enum
|
LL | fn qux() -> std::prelude::v1::Option {
| ^^^^^^^^^^^^^^^^^^^^^^^^
LL | fn qux() -> std::prelude::v1 {
| ^^^^^^^^^^^^^^^^
| ^^^^
| |
| not a type
| help: try using the variant's enum: `Option`

error: aborting due to 7 previous errors

Expand Down