Skip to content

Rollup of 11 pull requests #81212

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

Closed
wants to merge 29 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
c78bfba
Use consistent punctuation for 'Prelude contents' docs
camelid Dec 18, 2020
4a6014b
Use heading style for 'The I/O Prelude' in `std::io::prelude`
camelid Dec 18, 2020
2eb4ccd
Improve grammar in documentation of format strings
steffahn Jan 1, 2021
4274ba4
Use lowercase for prelude items
camelid Jan 6, 2021
25a4964
Use heading for `std::prelude` and not `io::prelude`
camelid Jan 6, 2021
77b5ced
Fix formatting for removed lints
jyn514 Jan 17, 2021
96e9562
Visit only terminators when removing landing pads
tmiasko Jan 18, 2021
d829e40
Improve unknown external crate error
rylev Jan 15, 2021
38b7742
Add tests for resolution changes
rylev Jan 18, 2021
9abd80c
Fix internal rustdoc broken links
CPerezz Jan 18, 2021
20d8478
Fix intersperse_fold
tesuji Jan 18, 2021
d926147
Remove unnecessary `after_run` function
jyn514 Jan 19, 2021
9272d53
Stop `fold` at first None when iterator yield
m-ou-se Jan 19, 2021
203df17
Fix typo in counters.rs
eltociear Jan 19, 2021
3fb53c2
Fix ICE in mir when evaluating SizeOf on unsized type
osa1 Jan 19, 2021
bc6720f
Add SpecFromIter ref in the comments directly
CPerezz Jan 19, 2021
230d5b1
Stabilize std::panic::panic_any.
m-ou-se Jan 19, 2021
8cac04e
Make 'static bound on panic_any explicit.
m-ou-se Jan 19, 2021
9343d94
Rollup merge of #80172 - camelid:prelude-docs-consistent-punct, r=ste…
m-ou-se Jan 20, 2021
f18b766
Rollup merge of #80601 - steffahn:improve_format_string_grammar, r=m-…
m-ou-se Jan 20, 2021
e047457
Rollup merge of #81046 - rylev:unknown-external-crate, r=estebank
m-ou-se Jan 20, 2021
bfc2533
Rollup merge of #81135 - jyn514:no-backticks, r=flip1995
m-ou-se Jan 20, 2021
9c8f0fe
Rollup merge of #81152 - lzutao:intersperse_fold, r=m-ou-se
m-ou-se Jan 20, 2021
8253984
Rollup merge of #81178 - tmiasko:no-landing-pads, r=oli-obk
m-ou-se Jan 20, 2021
1afc006
Rollup merge of #81179 - CPerezz:fix_interal_doc_warns, r=jyn514
m-ou-se Jan 20, 2021
e190e8c
Rollup merge of #81184 - jyn514:combine-after, r=CraftSpider
m-ou-se Jan 20, 2021
4fcee03
Rollup merge of #81185 - osa1:fix_80742, r=oli-obk
m-ou-se Jan 20, 2021
ce50269
Rollup merge of #81187 - eltociear:patch-6, r=jonas-schievink
m-ou-se Jan 20, 2021
0cdd7f0
Rollup merge of #81194 - m-ou-se:stabilize-panic-any, r=m-ou-se
m-ou-se Jan 20, 2021
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
Improve unknown external crate error
  • Loading branch information
rylev committed Jan 18, 2021
commit d829e40c7b11d6ba41819b59b3fd0b0bd64e06ba
7 changes: 7 additions & 0 deletions compiler/rustc_resolve/src/late.rs
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,13 @@ impl<'a> PathSource<'a> {
// "function" here means "anything callable" rather than `DefKind::Fn`,
// this is not precise but usually more helpful than just "value".
Some(ExprKind::Call(call_expr, _)) => match &call_expr.kind {
// the case of `::some_crate()`
ExprKind::Path(_, path)
if path.segments.len() == 2
&& path.segments[0].ident.name == kw::PathRoot =>
{
"external crate"
}
ExprKind::Path(_, path) => {
let mut msg = "function";
if let Some(segment) = path.segments.iter().last() {
Expand Down
14 changes: 10 additions & 4 deletions compiler/rustc_resolve/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2458,20 +2458,26 @@ impl<'a> Resolver<'a> {
(format!("use of undeclared crate or module `{}`", ident), None)
}
} else {
let mut msg =
format!("could not find `{}` in `{}`", ident, path[i - 1].ident);
let parent = path[i - 1].ident.name;
let parent = if parent == kw::PathRoot {
"crate root".to_owned()
} else {
format!("`{}`", parent)
};

let mut msg = format!("could not find `{}` in {}", ident, parent);
if ns == TypeNS || ns == ValueNS {
let ns_to_try = if ns == TypeNS { ValueNS } else { TypeNS };
if let FindBindingResult::Binding(Ok(binding)) =
find_binding_in_ns(self, ns_to_try)
{
let mut found = |what| {
msg = format!(
"expected {}, found {} `{}` in `{}`",
"expected {}, found {} `{}` in {}",
ns.descr(),
what,
ident,
path[i - 1].ident
parent
)
};
if binding.module().is_some() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ error[E0432]: unresolved import `E`
--> $DIR/edition-imports-virtual-2015-gated.rs:8:5
|
LL | gen_gated!();
| ^^^^^^^^^^^^^ could not find `E` in `{{root}}`
| ^^^^^^^^^^^^^ could not find `E` in crate root
|
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@

fn main() {
let s = ::xcrate::S;
//~^ ERROR failed to resolve: could not find `xcrate` in `{{root}}`
//~^ ERROR failed to resolve: could not find `xcrate` in crate root
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
error[E0433]: failed to resolve: could not find `xcrate` in `{{root}}`
error[E0433]: failed to resolve: could not find `xcrate` in crate root
--> $DIR/non-existent-2.rs:4:15
|
LL | let s = ::xcrate::S;
| ^^^^^^ could not find `xcrate` in `{{root}}`
| ^^^^^^ could not find `xcrate` in crate root

error: aborting due to previous error

Expand Down