Skip to content

Commit 36645eb

Browse files
committed
Auto merge of #157787 - cuviper:beta-next, r=cuviper
[beta] backports - Revert "Build shared LLVM lib for windows-gnullvm" #156962 - Allow building the source tarballs while offline #157014 - resolve: Partially revert "Remove a special case for dummy imports" #157719 - resolve: Remove exported imports from `maybe_unused_trait_imports` #157713 - [beta-1.97] Update cargo submodule #157792 r? cuviper
2 parents a57ed7f + 4cc2134 commit 36645eb

14 files changed

Lines changed: 132 additions & 7 deletions

compiler/rustc_resolve/src/check_unused.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ impl<'a, 'ra, 'tcx> UnusedImportCheckVisitor<'a, 'ra, 'tcx> {
105105
let def_id = self.r.owner_def_id(id);
106106
if self.r.effective_visibilities.is_exported(def_id) {
107107
self.check_import_as_underscore(use_tree, id);
108+
self.r.maybe_unused_trait_imports.swap_remove(&def_id);
108109
return;
109110
}
110111

compiler/rustc_resolve/src/imports.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -568,6 +568,15 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
568568
orig_ident_span,
569569
warn_ambiguity,
570570
|this, resolution| {
571+
if res == Res::Err
572+
&& let Some(old_decl) = resolution.best_decl()
573+
&& old_decl.res() != Res::Err
574+
{
575+
// Do not override real declarations with `Res::Err`s from error recovery.
576+
// FIXME: this special case shouldn't be necessary, but removing it triggers an ICE
577+
// due to some other issues (#157406, tests/ui/imports/dummy-import-ice.rs).
578+
return Ok(());
579+
}
571580
if decl.is_glob_import() {
572581
resolution.glob_decl = Some(match resolution.glob_decl {
573582
Some(old_decl) => this.select_glob_decl(

src/bootstrap/src/core/build_steps/vendor.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,13 @@ impl Step for Vendor {
114114
cmd.arg("--sync").arg(sync_arg);
115115
}
116116

117+
// Reuse vendored dependencies when building source tarball for offline support.
118+
if builder.config.vendor {
119+
cmd.arg("--respect-source-config")
120+
.arg("--config")
121+
.arg(builder.src.join(".cargo").join("config.toml"));
122+
}
123+
117124
// Will read the libstd Cargo.toml
118125
// which uses the unstable `public-dependency` feature.
119126
cmd.env("RUSTC_BOOTSTRAP", "1");
@@ -135,6 +142,13 @@ impl Step for Vendor {
135142
cmd.arg("--versioned-dirs");
136143
}
137144

145+
// Reuse vendored dependencies when building source tarball for offline support.
146+
if builder.config.vendor {
147+
cmd.arg("--respect-source-config")
148+
.arg("--config")
149+
.arg(builder.src.join("library").join(".cargo").join("config.toml"));
150+
}
151+
138152
// Will read the libstd Cargo.toml
139153
// which uses the unstable `public-dependency` feature.
140154
cmd.env("RUSTC_BOOTSTRAP", "1");

src/ci/github-actions/jobs.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -722,7 +722,6 @@ auto:
722722
--target=aarch64-pc-windows-gnullvm,i686-pc-windows-gnullvm
723723
--enable-full-tools
724724
--enable-profiler
725-
--enable-llvm-link-shared
726725
DIST_REQUIRE_ALL_TOOLS: 1
727726
CODEGEN_BACKENDS: llvm,cranelift
728727
CC_i686_pc_windows_gnullvm: i686-w64-mingw32-clang
@@ -735,7 +734,6 @@ auto:
735734
--build=x86_64-pc-windows-gnullvm
736735
--enable-full-tools
737736
--enable-profiler
738-
--enable-llvm-link-shared
739737
DIST_REQUIRE_ALL_TOOLS: 1
740738
CODEGEN_BACKENDS: llvm,cranelift
741739
<<: *job-windows
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
extern crate proc_macro;
2+
use proc_macro::TokenStream;
3+
4+
#[proc_macro]
5+
pub fn my_macro(_: proc_macro::TokenStream) -> proc_macro::TokenStream {
6+
r"
7+
use own::*;
8+
mod own {
9+
pub use super::submodule::*;
10+
pub use super::ambiguous;
11+
}
12+
"
13+
.parse()
14+
.unwrap()
15+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Regression test for issue #157406.
2+
3+
//@ check-pass
4+
//@ proc-macro: dummy-import-ice-macro.rs
5+
6+
extern crate dummy_import_ice_macro;
7+
8+
pub fn foo() {
9+
ambiguous();
10+
}
11+
12+
mod submodule {
13+
pub fn ambiguous() {}
14+
}
15+
16+
pub mod ambiguous {}
17+
18+
dummy_import_ice_macro::my_macro!();
19+
20+
fn main() {}

tests/ui/imports/issue-56125.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ mod m2 {
1515
mod m3 {
1616
mod empty {}
1717
use empty::issue_56125; //~ ERROR unresolved import `empty::issue_56125`
18-
use issue_56125::*;
18+
use issue_56125::*; //~ ERROR `issue_56125` is ambiguous
1919
}
2020

2121
fn main() {}

tests/ui/imports/issue-56125.stderr

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,24 @@ LL | use issue_56125::non_last_segment::non_last_segment::*;
5454
= help: consider adding an explicit import of `issue_56125` to disambiguate
5555
= help: or use `self::issue_56125` to refer to this module unambiguously
5656

57-
error: aborting due to 3 previous errors
57+
error[E0659]: `issue_56125` is ambiguous
58+
--> $DIR/issue-56125.rs:18:9
59+
|
60+
LL | use issue_56125::*;
61+
| ^^^^^^^^^^^ ambiguous name
62+
|
63+
= note: ambiguous because of a conflict between a name from a glob import and an outer scope during import or macro resolution
64+
= note: `issue_56125` could refer to a crate passed with `--extern`
65+
= help: use `::issue_56125` to refer to this crate unambiguously
66+
note: `issue_56125` could also refer to the module imported here
67+
--> $DIR/issue-56125.rs:18:9
68+
|
69+
LL | use issue_56125::*;
70+
| ^^^^^^^^^^^^^^
71+
= help: consider adding an explicit import of `issue_56125` to disambiguate
72+
= help: or use `self::issue_56125` to refer to this module unambiguously
73+
74+
error: aborting due to 4 previous errors
5875

5976
Some errors have detailed explanations: E0432, E0659.
6077
For more information about an error, try `rustc --explain E0432`.

tests/ui/imports/shadow-glob-module-resolution-2.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,7 @@ use a::*;
1414
use e as b;
1515
//~^ ERROR: unresolved import `e`
1616
use b::c::D as e;
17+
//~^ ERROR: cannot determine resolution for the import
18+
//~| ERROR: cannot determine resolution for the import
1719

1820
fn main() { }

0 commit comments

Comments
 (0)